Commit Graph

142 Commits

Author SHA1 Message Date
Elizabeth Mitchell
668f0ee5e9 fix(textfield): no longer inherits text-align from parents
Fixes #5509

PiperOrigin-RevId: 614835633
2024-03-11 16:38:47 -07:00
Elizabeth Mitchell
c35bad0c64 fix: rename internal <styles>.css.js to <styles>.css
We are changing the names of these files to reduce similarity with CSS modules and avoid clashing with tooling built around that. If you're importing `*/internal/styles.css.js`, swap to `*/internal/styles.js`.

PiperOrigin-RevId: 611265000
2024-02-28 16:20:22 -08:00
Elizabeth Mitchell
ec0a8ebf6e chore: use CSSResultOrNative instead of CSSResult for static styles
PiperOrigin-RevId: 609760445
2024-02-23 10:01:56 -08:00
Elizabeth Mitchell
ce41b7bfb3 fix: use explicit CSSResult[] types for static styles
PiperOrigin-RevId: 609494809
2024-02-22 14:15:11 -08:00
Elizabeth Mitchell
04b7e9b120 chore(textfield): fix demo clear icon button not disabling
PiperOrigin-RevId: 601821460
2024-01-26 11:34:17 -08:00
Elizabeth Mitchell
5e40a1bcec chore: create shape logical tokens in Sass component token files
Adds `@material/web/tokens/internal/shape` to take a shape token and create 4 logical tokens from its value.

All components' logical shape tokens are now generated by the token files themselves, rather than added in each component's styles.

PiperOrigin-RevId: 601783846
2024-01-26 09:13:58 -08:00
Elizabeth Mitchell
84536d7416 chore: update components to use custom properties from tokens
PiperOrigin-RevId: 601597083
2024-01-25 16:13:41 -08:00
Elizabeth Mitchell
e056d1dd2f chore(textfield): move newly added tokens into Sass component tokens
PiperOrigin-RevId: 601397525
2024-01-25 03:31:32 -08:00
Jan Kuehle
4b4c373a6b chore: use import and export types
PiperOrigin-RevId: 599338980
2024-01-17 17:39:46 -08:00
Elizabeth Mitchell
7dd7a68ae9 fix: forms correctly focus the first invalid control instead of last
Previously all text fields would focus themselves when the form reports validity, meaning the last one got focus. In reality, reportValidity is supposed to focus the first invalid control.

I added a "call" method wrapper around the `onReportValidity` callback that handles focusing logic.

PiperOrigin-RevId: 597904790
2024-01-12 11:43:47 -08:00
Elizabeth Mitchell
3151fd8d90 fix(textfield): error styles not removing when an unrelated control is invalid
The bug: given a form with two required text fields,
1. Try to submit the form, both fields show error.
2. Add a value to the first field.
3. Try to submit the form, the first field does not remove its error.

This is fixed by listening to form submits and clearing the error state if the control is valid.

I refactored `injectFormReportValidityHooks()` into `addFormReportValidListener()` to keep the `OnReportValidity` class cleaner and better identify the problem we're trying to solve.

PiperOrigin-RevId: 597664564
2024-01-11 15:06:22 -08:00
Elizabeth Mitchell
6efc90403b fix(textfield): focus style lost after reportValidity() during change
PiperOrigin-RevId: 597047043
2024-01-09 14:34:16 -08:00
Elizabeth Mitchell
3c6e55006b feat(textfield): add no-spinner to remove number spin buttons
PiperOrigin-RevId: 595788647
2024-01-04 13:28:18 -08:00
Elizabeth Mitchell
9973b90981 fix(textfield): counter showing when max length is 0 or removed
Fixes #4998

This also fixes an error being thrown in text field's validator when minlength/maxlength change to out of bounds if they're not set in the correct order.

PiperOrigin-RevId: 594013553
2023-12-27 08:13:58 -08:00
Elizabeth Mitchell
eca1357f1a fix: rename and move internal/controller/events
Split `internal/controller/events` into `internal/events/redispatch-event` and `internal/events/form-label-activation`

PiperOrigin-RevId: 592350371
2023-12-19 14:49:35 -08:00
Elliott Marquez
422f1050ff docs(textfield): add jsdoc several properties
Added jsdoc to properties on textfield itself. I don't think we can count the bug closed until the api docs bot is fixed so that we can see what is exposed or not via the new mixins.

PiperOrigin-RevId: 592071151
2023-12-18 18:52:49 -08:00
Elizabeth Mitchell
2bb480fb82 chore: move events out of controller folder
PiperOrigin-RevId: 592021123
2023-12-18 15:07:51 -08:00
Elizabeth Mitchell
926edfb367 fix(textfield): remove Firefox high contrast mode background on linux
PiperOrigin-RevId: 591065806
2023-12-14 15:16:41 -08:00
Elizabeth Mitchell
52e568ddc8 refactor(text-field): add validator and use validity mixins
PiperOrigin-RevId: 587086864
2023-12-01 12:32:30 -08:00
Elliott Marquez
2adcb1479a docs: document events in jsdoc
PiperOrigin-RevId: 581041601
2023-11-09 15:25:21 -08:00
Elliott Marquez
6b5ab21332 fix(select,textfield): native form validation shows error state
PiperOrigin-RevId: 578632986
2023-11-01 13:59:55 -07:00
Elizabeth Mitchell
87dfee41af chore(field): reduce HCM styles and move from textfield/select to field
PiperOrigin-RevId: 578351982
2023-10-31 17:33:28 -07:00
Elizabeth Mitchell
1f55d4111f chore(behaviors): update form controls to use shared mixins
PiperOrigin-RevId: 578297611
2023-10-31 14:08:39 -07:00
Elizabeth Mitchell
c390291687 chore: format files with prettier
PiperOrigin-RevId: 576601342
2023-10-25 11:59:00 -07:00
Copybara-Service
04dcf25c4a Merge pull request #5000 from vdegenne:textfield-cols
PiperOrigin-RevId: 576205502
2023-10-24 11:24:10 -07:00
Elliott Marquez
03e5a7ec8b fix(textfield): forward the multiple field to the native input
fixes #5064

PiperOrigin-RevId: 574295848
2023-10-17 16:21:07 -07:00
Elliott Marquez
8f999d4a0d fix(textfield): calling focus on textfield with a leading icon focuses the input
PiperOrigin-RevId: 574285365
2023-10-17 15:39:25 -07:00
vdegenne
20c9447d4c chore(textfield): Add cols attribute to type textarea 2023-09-26 15:26:41 +02:00
vdegenne
98e7d168bd chore(textfield): Add cols attribute to type textarea 2023-09-26 15:25:34 +02:00
Elizabeth Mitchell
4ad2336b87 feat(select): add required and form association
Fixes #4903

PiperOrigin-RevId: 565260839
2023-09-13 22:45:10 -07:00
Elizabeth Mitchell
7866a939b9 fix(textfield): add demo a11y and fix outlined label navigation
PiperOrigin-RevId: 565191993
2023-09-13 16:19:47 -07:00
Elizabeth Mitchell
c26a578448 fix(textfield): broken required validity on Safari
Fixes #4796

PiperOrigin-RevId: 564562802
2023-09-11 18:39:59 -07:00
Elizabeth Mitchell
61c8f6db46 fix(textfield): don't show focus indicator when focused on icon
PiperOrigin-RevId: 564527586
2023-09-11 16:01:43 -07:00
Copybara-Service
c478b3f9ca Merge pull request #4838 from vdegenne:textfield-autocomplete
PiperOrigin-RevId: 564437185
2023-09-11 10:52:24 -07:00
vdegenne
4d9d2cbd01 chore(text-field): add autocomplete attribute 2023-09-09 14:41:04 +02:00
Andrew Jakubowicz
86aaacd32c fix(textfield): remove icon that appears in search input in chrome and safari
PiperOrigin-RevId: 563914174
2023-09-08 20:03:37 -07:00
Andrew Jakubowicz
82e9e92a19 fix(textfield): change slot names to kebab-case
BREAKING CHANGE: replace slot names `leadingicon` and `trailingicon` with `leading-icon` and `trailing-icon`

PiperOrigin-RevId: 563605216
2023-09-07 18:41:25 -07:00
Elizabeth Mitchell
0c5a2a2886 fix(text-field,select): remove font shorthand tokens
BREAKING CHANGE: replace `*-type` font tokens with `-font`, `-size`, `-line-height`, and `-weight`

PiperOrigin-RevId: 563160975
2023-09-06 11:18:59 -07:00
vdegenne
e4daa8225a chore(text-field): add autocomplete attribute 2023-09-06 10:03:48 +02:00
vdegenne
c6821b44d4 chore(text-field): add autocomplete attribute 2023-09-04 12:12:24 +02:00
Elizabeth Mitchell
ecac7ecbad fix(textfield): show overflowing content like popups and focus rings
Fixes #4071

Note: Right now textareas cannot display overflowing content due to `resize` requiring hidden overflow.

BREAKING CHANGE: The field component must add the `resizable` attribute rather than using CSS. CSS `resize` can still customize the direction (defaults to both).

PiperOrigin-RevId: 561981406
2023-09-01 09:57:57 -07:00
Elizabeth Mitchell
3e13634d64 chore: make formAssociated readonly
PiperOrigin-RevId: 558255234
2023-08-18 14:57:38 -07:00
Elizabeth Mitchell
5d0cbf5e97 feat(textfield): support inputmode attribute
PiperOrigin-RevId: 557881129
2023-08-17 11:18:45 -07:00
Elizabeth Mitchell
a167cabeff fix(textfield): add form validity support
Also fixes form.reportValidity() not working for checkbox.

Fixes #4435

PiperOrigin-RevId: 557654271
2023-08-16 17:43:25 -07:00
Elizabeth Mitchell
0510496e60 chore: avoid this in static context
PiperOrigin-RevId: 554933524
2023-08-08 14:00:25 -07:00
vdegenne
33987c3f4b inline event input parameters 2023-08-02 19:23:44 +02:00
vdegenne
46626bb009 chore(textfield): remove unecessary redispatchEvent 2023-08-02 08:45:15 +02:00
Elliott Marquez
86ccec3e7e build: use firebase for hosting and remove url prefixes 2023-07-27 09:17:27 -07:00
Andrew Jakubowicz
6ec3f06429 fix!: rename "lib" directory to "internal"
BREAKING CHANGE: Rename `@material/web/<component>/lib` to `@material/web/<component>/internal`. Prefer not using internal files.

PiperOrigin-RevId: 550633216
2023-07-24 12:02:59 -07:00
Andrew Jakubowicz
dac3639721 fix(field)!: rename "lib" directory to "internal"
BREAKING CHANGE: Rename `@material/web/field/lib` to `@material/web/field/internal`. Prefer not using internal files.

PiperOrigin-RevId: 550049784
2023-07-21 14:24:05 -07:00