143 Commits

Author SHA1 Message Date
Elizabeth Mitchell
5bc15069d1 feat(button): add gradient support to container colors
This feature works by using the `background` shorthand instead of `background-color`. This property supports both CSS `<color>` and `<gradient>` types.

PiperOrigin-RevId: 751080245
2025-04-24 11:59:05 -07:00
Copybara-Service
c72650fa2e Merge pull request #5787 from material-components:disabled-link-support
PiperOrigin-RevId: 742326684
2025-03-31 11:11:15 -07:00
google-labs-jules[bot]
c3c48485b1 feat(button): add disabled link support 2025-03-28 20:17:50 +00:00
Copybara-Service
919fe12bad Merge pull request #5769 from TonySpegel:feat/button-download-filename
PiperOrigin-RevId: 723241863
2025-02-04 15:12:17 -08:00
Tony Spegel
8aefe1983d feat(button): rename attribute downloadFilename to download 2025-02-03 20:21:17 +01:00
Tony Spegel
4098832b8b feat(button): add download filename support for link buttons 2025-02-03 19:45:56 +01:00
Elizabeth Mitchell
55b4650063 fix(tokens)!: tokens.md-comp-*-values() include custom properties by default
BREAKING CHANGE: Sass component tokens, such as `tokens.md-comp-checkbox-values()`, return `var(--md-<component>, <value>)` instead of just the CSS value. Use `$exclude-custom-properties: true` to remove them.

PiperOrigin-RevId: 652550625
2024-07-15 11:43:52 -07:00
Zack Elliott
48124ba09f feat(button): add soft-disabled attribute for focusable disabled buttons
PiperOrigin-RevId: 651854744
2024-07-12 12:31:42 -07:00
Elizabeth Mitchell
5df9410e60 fix!: aria-labels announcing twice with "group" on components
BREAKING CHANGE: `querySelector` for `[role]` and `[aria-*]` attributes may no longer work. See `@material/web/migrations/v2/README.md` and `@material/web/migrations/v2/query-selector-aria.ts`.

Browser/SR test results (go/mwc-double-aria-test-results)
  -  VoiceOver on Chrome
  -  VoiceOver on iOS Safari
  -  TalkBack on Chrome
  -  ChromeVox on Chrome
  -  NVDA on Chrome
  -  NVDA on Firefox
  -  JAWS on Chrome
  -  JAWS on Firefox
  (Optional)
  -  VoiceOver on Safari
  -  VoiceOver on Firefox

PiperOrigin-RevId: 648859827
2024-07-02 15:22:12 -07:00
Elizabeth Mitchell
b75bd2ffb8 docs: button and icon button says "text" instead of "button" for type
Fixes #5650

PiperOrigin-RevId: 645142410
2024-06-20 13:44:05 -07:00
Benoit ROBIN
a2b5c91a54 fix(button): add part attribute to button 2024-05-21 16:24:31 +02:00
Elliott Marquez
758e61581e fix(button,fab,chips,labs): text-transform inherits through shadow root
PiperOrigin-RevId: 612948745
2024-03-05 13:24:40 -08:00
Elliott Marquez
b74e3dd2e3 fix(elevation): expose md-elevation ::part in all components
PiperOrigin-RevId: 612946796
2024-03-05 13:18:05 -08: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
e18d913eb3 chore(button): add unique aria labels to buttons with icons
PiperOrigin-RevId: 602512735
2024-01-29 15:10:29 -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
35913a6ea4 fix(dialog): buttons not reflecting value attribute when setting property
Fixes #5409

PiperOrigin-RevId: 600541901
2024-01-22 12:48:44 -08:00
Jan Kuehle
4b4c373a6b chore: use import and export types
PiperOrigin-RevId: 599338980
2024-01-17 17:39:46 -08:00
Chi-En Wu
37fad0660d
fix(button): add missing sass imports 2024-01-03 20:08:12 +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
Elizabeth Mitchell
2bb480fb82 chore: move events out of controller folder
PiperOrigin-RevId: 592021123
2023-12-18 15:07:51 -08:00
Elizabeth Mitchell
7cd657b83d fix(button): height increases when label wraps
PiperOrigin-RevId: 582478806
2023-11-14 16:41:20 -08:00
Elizabeth Mitchell
5d964adcf9 fix(button): labels not truncating, add support for multiline with text-wrap: wrap
There's currently a bug where wrapping buttons do not increase their height. That will come later to reduce the scope on this change.

PiperOrigin-RevId: 581383771
2023-11-10 15:17:14 -08:00
Elizabeth Mitchell
96481566ae refactor(button): move background content outside of inner button
Part of a series of changes to support text wrapping and host aria for button.

PiperOrigin-RevId: 581319862
2023-11-10 11:29:54 -08:00
Elizabeth Mitchell
710b87eb3a chore(button): remove lit static
Part of a chain of changes needed to support text wrapping and host aria

PiperOrigin-RevId: 581030820
2023-11-09 14:45:01 -08:00
Elizabeth Mitchell
8dcb3f62c7 fix(button): don't show overflowing labels
PiperOrigin-RevId: 580659287
2023-11-08 14:29:00 -08:00
Elizabeth Mitchell
5bb4a422de fix(button): allow overriding padding and gap
More customization and necessary prep to move styles to host for host aria and text wrapping customization.

PiperOrigin-RevId: 580565272
2023-11-08 09:55:35 -08:00
Elizabeth Mitchell
18522381d8 fix(button): allow overriding min-width and user-select
PiperOrigin-RevId: 580324948
2023-11-07 15:50:07 -08:00
Elizabeth Mitchell
f08ecce357 chore(button): remove unused styles
PiperOrigin-RevId: 580031279
2023-11-06 19:59:25 -08:00
Elizabeth Mitchell
48d84f86ee chore(button): remove BEM css class name style
Why? We don't use https://getbem.com/ styles anymore now that we have shadow dom.

Just cleanup to help with child changes.

PiperOrigin-RevId: 579980984
2023-11-06 15:50:24 -08:00
Elizabeth Mitchell
798f5ae179 fix(button): allow overriding cursor using CSS
Prep to move some styles to the host, which allows for better host styling, like setting padding and text wrapping. It will also support host aria by not relying on `<button>` pseudo selectors.

PiperOrigin-RevId: 579977848
2023-11-06 15:38:50 -08:00
Elizabeth Mitchell
e7bc633e18 chore(behaviors): add ElementInternals mixin
PiperOrigin-RevId: 576937116
2023-10-26 11:31:33 -07:00
Elizabeth Mitchell
c390291687 chore: format files with prettier
PiperOrigin-RevId: 576601342
2023-10-25 11:59:00 -07:00
Elizabeth Mitchell
c1d3cc0f50 chore: add missing licenses
PiperOrigin-RevId: 575915441
2023-10-23 13:39:04 -07:00
Elizabeth Mitchell
8894c20c6b fix(button): remove font shorthand tokens
BREAKING CHANGE: replace `label-text-type` tokens with `label-text-font`, `-size`, `-line-height`, and `-weight`

PiperOrigin-RevId: 563153211
2023-09-06 10:56:22 -07:00
Elizabeth Mitchell
4b61e8d203 fix(button): update demos to fix a11y
Also fixes disabled elevated buttons animating their shadow.

PiperOrigin-RevId: 561367294
2023-08-30 09:44:30 -07:00
Elizabeth Mitchell
f23fac1465 fix(button): add value to form when submitting
Fixes #4526

PiperOrigin-RevId: 558261952
2023-08-18 15:24:42 -07:00
Elizabeth Mitchell
3e13634d64 chore: make formAssociated readonly
PiperOrigin-RevId: 558255234
2023-08-18 14:57:38 -07:00
Elizabeth Mitchell
a2dce1679a chore(button): refactor render methods
PiperOrigin-RevId: 557937034
2023-08-17 14:28:32 -07:00
Andrew Jakubowicz
d665864cba fix(button): href and target default value is now an empty string
The type of `target` has also been made stricter, now only accepting '_blank'|'_parent'|'_self'|'_top'|''.

PiperOrigin-RevId: 557624071
2023-08-16 15:42:04 -07:00
Andrew Jakubowicz
b144227438 fix(button): incorrect HCM colors
PiperOrigin-RevId: 557601131
2023-08-16 14:21:48 -07:00
Elizabeth Mitchell
0e492ade43 chore: remove sass theme utilities
PiperOrigin-RevId: 556915539
2023-08-14 14:39:19 -07:00
Elizabeth Mitchell
1f46179e83 feat(button): add touch target configs
PiperOrigin-RevId: 555666648
2023-08-10 14:57:37 -07:00
Elizabeth Mitchell
c0da72b6dc feat(iconbutton): add form submission
This is needed for `<md-dialog>` for close icon buttons.

I split out button's logic into a static helper method. I also added a symbol to share ElementInternals.

PiperOrigin-RevId: 554943716
2023-08-08 14:33:01 -07:00
Elizabeth Mitchell
0510496e60 chore: avoid this in static context
PiperOrigin-RevId: 554933524
2023-08-08 14:00:25 -07:00
Andrew Jakubowicz
1be2b6263f test: move button form test into internal button_test
PiperOrigin-RevId: 554533904
2023-08-07 11:13:15 -07:00
Elizabeth Mitchell
97f5b616d6 fix(button)!: type is submit by default
Also fixes the button not being the correct `submitter` for submit events.

BREAKING CHANGE: Buttons submit forms by default, like `<button>`. Add `type="button"` to not submit forms.

PiperOrigin-RevId: 553248284
2023-08-02 13:57:32 -07:00