material 3.7.2 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/NOTICE +223 -0
  2. package/README.md +5 -3
  3. package/dist/components/extended-fab/types.d.ts +3 -0
  4. package/dist/components/fab/types.d.ts +3 -0
  5. package/dist/components/slider/features/controller.js +24 -8
  6. package/dist/elements/css/card.css +1 -1
  7. package/dist/elements/css/card.js +1 -1
  8. package/dist/elements/css/dialog.css +1 -1
  9. package/dist/elements/css/dialog.js +1 -1
  10. package/dist/elements/css/menu.css +1 -1
  11. package/dist/elements/css/menu.js +1 -1
  12. package/dist/elements/css/select.css +1 -1
  13. package/dist/elements/css/select.js +1 -1
  14. package/dist/elements/css/slider.css +1 -1
  15. package/dist/elements/css/slider.js +1 -1
  16. package/dist/elements/css/tabs.css +1 -1
  17. package/dist/elements/css/tabs.js +1 -1
  18. package/dist/elements/css/timepicker.css +1 -1
  19. package/dist/elements/css/timepicker.js +1 -1
  20. package/dist/elements/extended-fab.d.ts +1 -0
  21. package/dist/elements/fab.d.ts +1 -0
  22. package/dist/elements/preupgrade/badge.css +1 -1
  23. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  24. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  25. package/dist/elements/preupgrade/button-group.css +1 -1
  26. package/dist/elements/preupgrade/button.css +1 -1
  27. package/dist/elements/preupgrade/card.css +1 -1
  28. package/dist/elements/preupgrade/carousel.css +1 -1
  29. package/dist/elements/preupgrade/checkbox.css +1 -1
  30. package/dist/elements/preupgrade/chips.css +1 -1
  31. package/dist/elements/preupgrade/datepicker.css +1 -1
  32. package/dist/elements/preupgrade/dialog.css +1 -1
  33. package/dist/elements/preupgrade/divider.css +1 -1
  34. package/dist/elements/preupgrade/drawer.css +1 -1
  35. package/dist/elements/preupgrade/extended-fab.css +1 -1
  36. package/dist/elements/preupgrade/fab-menu.css +1 -1
  37. package/dist/elements/preupgrade/fab.css +1 -1
  38. package/dist/elements/preupgrade/icon-button.css +1 -1
  39. package/dist/elements/preupgrade/list.css +1 -1
  40. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  41. package/dist/elements/preupgrade/menu.css +1 -1
  42. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  43. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  44. package/dist/elements/preupgrade/progress.css +1 -1
  45. package/dist/elements/preupgrade/radios.css +1 -1
  46. package/dist/elements/preupgrade/search.css +1 -1
  47. package/dist/elements/preupgrade/select.css +1 -1
  48. package/dist/elements/preupgrade/side-sheet.css +1 -1
  49. package/dist/elements/preupgrade/slider.css +1 -1
  50. package/dist/elements/preupgrade/snackbar.css +1 -1
  51. package/dist/elements/preupgrade/split-button.css +1 -1
  52. package/dist/elements/preupgrade/switch.css +1 -1
  53. package/dist/elements/preupgrade/tabs.css +1 -1
  54. package/dist/elements/preupgrade/text-field.css +1 -1
  55. package/dist/elements/preupgrade/timepicker.css +1 -1
  56. package/dist/elements/preupgrade/toolbar.css +1 -1
  57. package/dist/elements/preupgrade/tooltip.css +1 -1
  58. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  59. package/dist/elements/preupgrade.css +1 -1
  60. package/dist/styles/badge.css +1 -1
  61. package/dist/styles/base-lite.css +2 -2
  62. package/dist/styles/base.css +2 -2
  63. package/dist/styles/bottom-app-bar.css +1 -1
  64. package/dist/styles/bottom-sheet.css +1 -1
  65. package/dist/styles/button-group.css +1 -1
  66. package/dist/styles/button.css +1 -1
  67. package/dist/styles/card.css +2 -2
  68. package/dist/styles/carousel.css +1 -1
  69. package/dist/styles/checkbox.css +1 -1
  70. package/dist/styles/chips.css +1 -1
  71. package/dist/styles/contrast.css +2 -2
  72. package/dist/styles/datepicker.css +1 -1
  73. package/dist/styles/dialog.css +2 -2
  74. package/dist/styles/divider.css +1 -1
  75. package/dist/styles/drawer.css +1 -1
  76. package/dist/styles/extended-fab.css +1 -1
  77. package/dist/styles/fab-menu.css +1 -1
  78. package/dist/styles/fab.css +1 -1
  79. package/dist/styles/icon-button.css +1 -1
  80. package/dist/styles/list.css +1 -1
  81. package/dist/styles/loading-indicator.css +1 -1
  82. package/dist/styles/menu.css +2 -2
  83. package/dist/styles/navigation-bar.css +1 -1
  84. package/dist/styles/navigation-rail.css +1 -1
  85. package/dist/styles/progress.css +1 -1
  86. package/dist/styles/radios.css +1 -1
  87. package/dist/styles/search.css +1 -1
  88. package/dist/styles/select.css +2 -2
  89. package/dist/styles/side-sheet.css +1 -1
  90. package/dist/styles/slider.css +2 -2
  91. package/dist/styles/snackbar.css +1 -1
  92. package/dist/styles/split-button.css +1 -1
  93. package/dist/styles/switch.css +1 -1
  94. package/dist/styles/tabs.css +2 -2
  95. package/dist/styles/text-field.css +1 -1
  96. package/dist/styles/timepicker.css +2 -2
  97. package/dist/styles/toolbar.css +1 -1
  98. package/dist/styles/tooltip.css +1 -1
  99. package/dist/styles/top-app-bar.css +1 -1
  100. package/dist/styles/typography.css +1 -1
  101. package/dist/styles/utilities.css +1 -1
  102. package/dist/styles.css +2 -2
  103. package/dist/theme/image.d.ts +2 -0
  104. package/dist/theme/image.js +5 -0
  105. package/dist/theme/index.d.ts +23 -0
  106. package/dist/theme/index.js +32 -0
  107. package/dist/theme/roles.js +68 -0
  108. package/dist/theme/variants.d.ts +9 -0
  109. package/dist/theme/variants.js +17 -0
  110. package/dist/theme/vendor/contrast/contrast.js +72 -0
  111. package/dist/theme/vendor/dislike/dislike_analyzer.js +31 -0
  112. package/dist/theme/vendor/dynamiccolor/color_spec_2021.d.ts +63 -0
  113. package/dist/theme/vendor/dynamiccolor/color_spec_2021.js +663 -0
  114. package/dist/theme/vendor/dynamiccolor/contrast_curve.js +42 -0
  115. package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +24 -0
  116. package/dist/theme/vendor/dynamiccolor/dynamic_color.js +264 -0
  117. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +87 -0
  118. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.js +418 -0
  119. package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.d.ts +124 -0
  120. package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.js +311 -0
  121. package/dist/theme/vendor/dynamiccolor/tone_delta_pair.js +27 -0
  122. package/dist/theme/vendor/dynamiccolor/variant.js +28 -0
  123. package/dist/theme/vendor/hct/cam16.js +249 -0
  124. package/dist/theme/vendor/hct/hct.d.ts +23 -0
  125. package/dist/theme/vendor/hct/hct.js +86 -0
  126. package/dist/theme/vendor/hct/hct_solver.js +390 -0
  127. package/dist/theme/vendor/hct/viewing_conditions.js +73 -0
  128. package/dist/theme/vendor/palettes/tonal_palette.js +114 -0
  129. package/dist/theme/vendor/quantize/lab_point_provider.js +31 -0
  130. package/dist/theme/vendor/quantize/quantizer_celebi.js +25 -0
  131. package/dist/theme/vendor/quantize/quantizer_map.js +31 -0
  132. package/dist/theme/vendor/quantize/quantizer_wsmeans.js +178 -0
  133. package/dist/theme/vendor/quantize/quantizer_wu.js +342 -0
  134. package/dist/theme/vendor/scheme/scheme_content.js +30 -0
  135. package/dist/theme/vendor/scheme/scheme_expressive.js +30 -0
  136. package/dist/theme/vendor/scheme/scheme_fidelity.js +30 -0
  137. package/dist/theme/vendor/scheme/scheme_monochrome.js +30 -0
  138. package/dist/theme/vendor/scheme/scheme_neutral.js +30 -0
  139. package/dist/theme/vendor/scheme/scheme_tonal_spot.js +30 -0
  140. package/dist/theme/vendor/scheme/scheme_vibrant.js +30 -0
  141. package/dist/theme/vendor/score/score.js +100 -0
  142. package/dist/theme/vendor/temperature/temperature_cache.js +198 -0
  143. package/dist/theme/vendor/utils/color_utils.js +173 -0
  144. package/dist/theme/vendor/utils/image_utils.js +72 -0
  145. package/dist/theme/vendor/utils/math_utils.js +75 -0
  146. package/dist/theme/vendor/utils/string_utils.js +61 -0
  147. package/dist/themes/autumn-contrast.css +2 -2
  148. package/dist/themes/autumn.css +2 -2
  149. package/dist/themes/baseline-contrast.css +2 -2
  150. package/dist/themes/baseline.css +2 -2
  151. package/dist/themes/brownbeige-contrast.css +2 -2
  152. package/dist/themes/brownbeige.css +2 -2
  153. package/dist/themes/content-contrast.css +2 -2
  154. package/dist/themes/content.css +2 -2
  155. package/dist/themes/desert-contrast.css +2 -2
  156. package/dist/themes/desert.css +2 -2
  157. package/dist/themes/expressive-contrast.css +2 -2
  158. package/dist/themes/expressive.css +2 -2
  159. package/dist/themes/fidelity-contrast.css +2 -2
  160. package/dist/themes/fidelity.css +2 -2
  161. package/dist/themes/forest-contrast.css +2 -2
  162. package/dist/themes/forest.css +2 -2
  163. package/dist/themes/fruit-salad-contrast.css +2 -2
  164. package/dist/themes/fruit-salad.css +2 -2
  165. package/dist/themes/highcontrast-contrast.css +2 -2
  166. package/dist/themes/highcontrast.css +2 -2
  167. package/dist/themes/monochrome-contrast.css +2 -2
  168. package/dist/themes/monochrome.css +2 -2
  169. package/dist/themes/neutral-contrast.css +2 -2
  170. package/dist/themes/neutral.css +2 -2
  171. package/dist/themes/ocean-contrast.css +2 -2
  172. package/dist/themes/ocean.css +2 -2
  173. package/dist/themes/rainbow-contrast.css +2 -2
  174. package/dist/themes/rainbow.css +2 -2
  175. package/dist/themes/sageivory-contrast.css +2 -2
  176. package/dist/themes/sageivory.css +2 -2
  177. package/dist/themes/spring-contrast.css +2 -2
  178. package/dist/themes/spring.css +2 -2
  179. package/dist/themes/summer-contrast.css +2 -2
  180. package/dist/themes/summer.css +2 -2
  181. package/dist/themes/sunset-contrast.css +2 -2
  182. package/dist/themes/sunset.css +2 -2
  183. package/dist/themes/tealcaramel-contrast.css +2 -2
  184. package/dist/themes/tealcaramel.css +2 -2
  185. package/dist/themes/vibrant-contrast.css +2 -2
  186. package/dist/themes/vibrant.css +2 -2
  187. package/package.json +15 -1
  188. package/src/styles/abstract/_base.scss +0 -1
  189. package/src/styles/abstract/_direction.scss +121 -152
  190. package/src/styles/abstract/_emit.scss +7 -16
  191. package/src/styles/abstract/_floating-placement.scss +9 -10
  192. package/src/styles/abstract/_functions.scss +64 -79
  193. package/src/styles/abstract/_mixins.scss +355 -459
  194. package/src/styles/abstract/_theme.scss +122 -136
  195. package/src/styles/abstract/_variables.scss +320 -390
  196. package/src/styles/abstract/chips/_assist.scss +2 -3
  197. package/src/styles/abstract/chips/_filter.scss +2 -3
  198. package/src/styles/abstract/chips/_input.scss +2 -3
  199. package/src/styles/abstract/chips/_suggestion.scss +2 -3
  200. package/src/styles/base/_body-theme.scss +10 -15
  201. package/src/styles/base/_document.scss +10 -33
  202. package/src/styles/base/_reset.scss +20 -40
  203. package/src/styles/base/_tokens.scss +6 -21
  204. package/src/styles/base/_typescale-tokens.scss +12 -16
  205. package/src/styles/base/_typography.scss +28 -37
  206. package/src/styles/components/_badge.scss +171 -193
  207. package/src/styles/components/_bottom-app-bar.scss +72 -90
  208. package/src/styles/components/_bottom-sheet.scss +188 -232
  209. package/src/styles/components/_button-group.scss +140 -189
  210. package/src/styles/components/_button.scss +382 -478
  211. package/src/styles/components/_card.scss +349 -473
  212. package/src/styles/components/_carousel.scss +134 -156
  213. package/src/styles/components/_checkbox.scss +208 -249
  214. package/src/styles/components/_chips.scss +239 -304
  215. package/src/styles/components/_datepicker.scss +172 -222
  216. package/src/styles/components/_dialog.scss +428 -553
  217. package/src/styles/components/_divider.scss +37 -46
  218. package/src/styles/components/_drawer.scss +571 -678
  219. package/src/styles/components/_extended-fab.scss +263 -294
  220. package/src/styles/components/_fab-menu.scss +225 -267
  221. package/src/styles/components/_fab.scss +197 -218
  222. package/src/styles/components/_icon-button.scss +483 -588
  223. package/src/styles/components/_list.scss +115 -144
  224. package/src/styles/components/_loading-indicator.scss +23 -29
  225. package/src/styles/components/_menu.scss +543 -699
  226. package/src/styles/components/_navigation-bar.scss +189 -234
  227. package/src/styles/components/_navigation-rail.scss +256 -312
  228. package/src/styles/components/_progress.scss +60 -85
  229. package/src/styles/components/_radios.scss +170 -207
  230. package/src/styles/components/_search.scss +369 -455
  231. package/src/styles/components/_select.scss +78 -185
  232. package/src/styles/components/_side-sheet.scss +234 -292
  233. package/src/styles/components/_slider.scss +289 -367
  234. package/src/styles/components/_snackbar.scss +149 -198
  235. package/src/styles/components/_split-button.scss +139 -228
  236. package/src/styles/components/_switch.scss +282 -349
  237. package/src/styles/components/_tabs.scss +350 -547
  238. package/src/styles/components/_text-field.scss +788 -980
  239. package/src/styles/components/_timepicker.scss +435 -506
  240. package/src/styles/components/_toolbar.scss +178 -242
  241. package/src/styles/components/_tooltip.scss +152 -197
  242. package/src/styles/components/_top-app-bar.scss +206 -230
  243. package/src/styles/elements/_badge.scss +42 -61
  244. package/src/styles/elements/_bottom-app-bar.scss +14 -20
  245. package/src/styles/elements/_bottom-sheet.scss +0 -3
  246. package/src/styles/elements/_button-group.scss +80 -80
  247. package/src/styles/elements/_button.scss +72 -88
  248. package/src/styles/elements/_card.scss +48 -57
  249. package/src/styles/elements/_carousel.scss +2 -5
  250. package/src/styles/elements/_checkbox.scss +32 -43
  251. package/src/styles/elements/_chips.scss +18 -22
  252. package/src/styles/elements/_config.scss +11 -26
  253. package/src/styles/elements/_datepicker.scss +17 -22
  254. package/src/styles/elements/_dialog.scss +0 -3
  255. package/src/styles/elements/_divider.scss +11 -13
  256. package/src/styles/elements/_drawer.scss +9 -14
  257. package/src/styles/elements/_extended-fab.scss +36 -40
  258. package/src/styles/elements/_fab-menu.scss +21 -25
  259. package/src/styles/elements/_fab.scss +17 -20
  260. package/src/styles/elements/_field.scss +93 -114
  261. package/src/styles/elements/_icon-button.scss +34 -38
  262. package/src/styles/elements/_index.scss +0 -4
  263. package/src/styles/elements/_list.scss +19 -26
  264. package/src/styles/elements/_loading-indicator.scss +6 -9
  265. package/src/styles/elements/_menu.scss +0 -3
  266. package/src/styles/elements/_navigation-bar.scss +5 -9
  267. package/src/styles/elements/_navigation-rail.scss +10 -15
  268. package/src/styles/elements/_progress.scss +15 -18
  269. package/src/styles/elements/_radios.scss +24 -49
  270. package/src/styles/elements/_search.scss +19 -24
  271. package/src/styles/elements/_select.scss +4 -9
  272. package/src/styles/elements/_side-sheet.scss +0 -3
  273. package/src/styles/elements/_slider.scss +15 -35
  274. package/src/styles/elements/_snackbar.scss +0 -3
  275. package/src/styles/elements/_split-button.scss +33 -39
  276. package/src/styles/elements/_switch.scss +50 -90
  277. package/src/styles/elements/_tabs.scss +9 -13
  278. package/src/styles/elements/_text-field.scss +150 -178
  279. package/src/styles/elements/_timepicker.scss +0 -3
  280. package/src/styles/elements/_toolbar.scss +30 -35
  281. package/src/styles/elements/_tooltip.scss +0 -3
  282. package/src/styles/elements/_top-app-bar.scss +38 -45
  283. package/src/styles/main.scss +0 -15
  284. package/src/styles/themes/_autumn.scss +258 -258
  285. package/src/styles/themes/_base-theme.scss +112 -134
  286. package/src/styles/themes/_baseline.scss +291 -314
  287. package/src/styles/themes/_brownbeige.scss +270 -250
  288. package/src/styles/themes/_content.scss +268 -248
  289. package/src/styles/themes/_desert.scss +270 -250
  290. package/src/styles/themes/_expressive.scss +270 -250
  291. package/src/styles/themes/_fidelity.scss +268 -248
  292. package/src/styles/themes/_forest.scss +260 -259
  293. package/src/styles/themes/_fruit-salad.scss +270 -250
  294. package/src/styles/themes/_highcontrast.scss +183 -172
  295. package/src/styles/themes/_index.scss +0 -1
  296. package/src/styles/themes/_monochrome.scss +254 -234
  297. package/src/styles/themes/_neutral.scss +270 -250
  298. package/src/styles/themes/_ocean.scss +260 -259
  299. package/src/styles/themes/_rainbow.scss +270 -250
  300. package/src/styles/themes/_sageivory.scss +270 -250
  301. package/src/styles/themes/_spring.scss +256 -255
  302. package/src/styles/themes/_summer.scss +270 -250
  303. package/src/styles/themes/_sunset.scss +260 -259
  304. package/src/styles/themes/_tealcaramel.scss +270 -250
  305. package/src/styles/themes/_vibrant.scss +270 -250
  306. package/src/styles/utilities/_colors.scss +44 -50
  307. package/src/styles/utilities/_flexbox.scss +48 -59
  308. package/src/styles/utilities/_layout.scss +516 -591
  309. package/src/styles/utilities/_ripple.scss +61 -70
  310. package/src/styles/utilities/_spacing.scss +120 -127
  311. package/src/styles/utilities/_typography.scss +45 -58
  312. package/src/styles/utilities/_visibility.scss +61 -76
  313. package/dist/package.json +0 -488
@@ -1,4 +1,3 @@
1
- // src/styles/components/_button.scss
2
1
  @use 'sass:map';
3
2
  @use 'sass:list';
4
3
  @use '../../styles/abstract/base' as base;
@@ -9,491 +8,396 @@
9
8
 
10
9
  $component: '#{base.$prefix}-button';
11
10
 
12
- // =============================================================================
13
- // BUTTON COMPONENT STYLES
14
- // =============================================================================
15
- // Material Design 3 common button.
16
- //
17
- // Measurements, shapes and colour roles follow the Compose Material 3 token
18
- // files (ButtonXSmallTokens.kt … ButtonXLargeTokens.kt, FilledButtonTokens.kt,
19
- // ElevatedButtonTokens.kt, TonalButtonTokens.kt, OutlinedButtonTokens.kt,
20
- // TextButtonTokens.kt) and ButtonDefaults in Button.kt. Values live in the
21
- // $button map in abstract/_variables.scss.
22
- //
23
- // Supports:
24
- // - Five colour styles (filled, elevated, tonal, outlined, text)
25
- // - Five sizes (xs, s, m, l, xl) and two shapes (round, square)
26
- // - Leading icon, integrated progress indicator
27
- // - State layers, focus ring, pressed shape morph
28
- // - 48dp touch target on the xs and s sizes
29
- //
30
- // Shape hooks: a container (button group, split button) can override the
31
- // resting, pressed and selected corner shapes through the custom properties
32
- // --<prefix>-button-shape, --<prefix>-button-shape-pressed and
33
- // --<prefix>-button-shape-selected, without fighting the rules below.
34
- // =============================================================================
35
11
 
36
12
  $sizes: xs, s, m, l, xl;
37
13
 
38
- // Label typescale per size (ButtonDefaults.textStyleFor)
39
14
  $label-typescale: (
40
- 'xs': 'label-large',
41
- 's': 'label-large',
42
- 'm': 'title-medium',
43
- 'l': 'headline-small',
44
- 'xl': 'headline-large'
15
+ 'xs': 'label-large',
16
+ 's': 'label-large',
17
+ 'm': 'title-medium',
18
+ 'l': 'headline-small',
19
+ 'xl': 'headline-large'
45
20
  );
46
21
 
47
- // Colour of the icon and label per colour style. The state layer is drawn in
48
- // currentColor, so it takes the same role: M3 tints a button's state layer
49
- // with its content colour, for every style, selected or not.
50
22
  $content-color: (
51
- 'filled': 'on-primary',
52
- 'elevated': 'primary',
53
- 'tonal': 'on-secondary-container',
54
- 'outlined': 'on-surface-variant',
55
- 'text': 'primary'
23
+ 'filled': 'on-primary',
24
+ 'elevated': 'primary',
25
+ 'tonal': 'on-secondary-container',
26
+ 'outlined': 'on-surface-variant',
27
+ 'text': 'primary'
56
28
  );
57
29
 
58
30
  .#{$component} {
59
- // Base styles (the s size is the default)
60
- position: relative;
61
- display: inline-flex;
62
- align-items: center;
63
- justify-content: center;
64
- gap: v.button('icon-gap-s');
65
- min-width: v.button('min-width');
66
- height: v.button('height-s');
67
- padding: 0 v.button('padding-s');
68
- border: none;
69
- border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-round-s'));
70
- background-color: transparent;
71
- color: inherit;
72
- font: inherit;
73
- text-decoration: none;
74
- cursor: pointer;
75
- user-select: none;
76
- vertical-align: middle;
77
- appearance: none;
78
- will-change: border-radius;
79
-
80
- // Typography
81
- @include m.typography('label-large');
82
-
83
- // Colours follow the default effects spring, the shape morph the fast
84
- // spatial spring (Compose Button and ToggleButton animation specs)
85
- transition:
86
- background-color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
87
- color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
88
- box-shadow v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
89
- border-color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
90
- border-radius v.motion('spring-fast-spatial-duration') v.motion('spring-fast-spatial-easing');
91
-
92
- // Focus indicator: 3dp secondary ring, 2dp outside the container
93
- // (material-web tokens/_md-comp-focus-ring.scss)
94
- &:focus {
95
- outline: none;
96
- }
97
-
98
- &:focus-visible {
99
- outline: 3px solid t.color('secondary');
100
- outline-offset: 2px;
101
- }
102
-
103
- // Disabled: container on-surface 10%, label and icon on-surface-variant 38%
104
- // (FilledButtonTokens.Disabled*)
105
- &:disabled {
106
- pointer-events: none;
107
- color: t.alpha('on-surface-variant', 0.38);
108
- background-color: t.alpha('on-surface', 0.1);
109
- box-shadow: none;
110
-
111
- .#{$component}__icon {
112
- color: t.alpha('on-surface-variant', 0.38);
113
- }
114
- }
115
-
116
- // State layer: one ::before in currentColor, the content role each colour
117
- // style and toggle state sets as `color`. Hover, focus and pressed change
118
- // only its opacity (m3.material.io state layers: 0.08, 0.10, 0.10). The
119
- // ripple is the press: a button that carries one leaves its
120
- // pressed layer to the wave, as m.state-layer does.
121
- &::before {
122
- content: '';
123
- position: absolute;
124
- inset: 0;
125
- background-color: currentColor;
126
- opacity: 0;
127
- pointer-events: none;
128
- border-radius: inherit;
129
- transition: opacity v.motion('duration-short2') v.motion('easing-standard');
130
- }
131
-
132
- &:hover::before {
133
- opacity: f.get-state-opacity('hover');
134
- }
135
-
136
- &:focus-visible::before {
137
- opacity: f.get-state-opacity('focus');
138
- }
139
-
140
- &:active:not(:has(> .#{base.$prefix}-ripple))::before,
141
- &--active:not(:has(> .#{base.$prefix}-ripple))::before {
142
- opacity: f.get-state-opacity('pressed');
143
- }
144
-
145
- // Icon
146
- &__icon {
147
- display: inline-flex;
148
- align-items: center;
149
- justify-content: center;
150
- flex: none;
151
- width: v.button('icon-size-s');
152
- height: v.button('icon-size-s');
153
-
154
- svg {
155
- width: 100%;
156
- height: 100%;
157
- }
158
- }
159
-
160
- // Progress indicator: takes the icon slot
161
- &__progress {
162
- display: inline-flex;
163
- align-items: center;
164
- justify-content: center;
165
- flex: none;
166
- width: v.button('icon-size-s');
167
- height: v.button('icon-size-s');
168
-
169
- &.#{base.$prefix}-progress {
170
- width: v.button('icon-size-s');
171
- height: v.button('icon-size-s');
172
- transition: opacity v.motion('duration-short2') v.motion('easing-standard');
173
- }
174
-
175
- .#{base.$prefix}-progress__canvas {
176
- color: currentColor;
177
- }
178
- }
179
-
180
- &__text {
181
- @include m.truncate;
182
- }
183
-
184
- // ---------------------------------------------------------------------------
185
- // Sizes
186
- // ---------------------------------------------------------------------------
187
- @each $size in $sizes {
188
- &--#{$size} {
189
- height: v.button('height-#{$size}');
190
- padding: 0 v.button('padding-#{$size}');
191
- gap: v.button('icon-gap-#{$size}');
192
- @include m.typography(map.get($label-typescale, $size));
193
-
194
- .#{$component}__icon,
195
- .#{$component}__progress,
196
- .#{$component}__progress.#{base.$prefix}-progress {
197
- width: v.button('icon-size-#{$size}');
198
- height: v.button('icon-size-#{$size}');
199
- }
200
-
201
- // Round shape at rest: half the height, so the pressed shape is a
202
- // morph rather than a snap. See shape-round-* in $button.
203
- border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-round-#{$size}'));
204
-
205
- // Square shape at rest
206
- &.#{$component}--square {
207
- border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-square-#{$size}'));
208
- }
209
-
210
- // Outlined outline width
211
- &.#{$component}--outlined {
212
- border-width: v.button('outline-width-#{$size}');
213
- }
214
- }
215
- }
216
-
217
- // Small button next to an icon: 12dp on the icon side on pointer devices
218
- // (ButtonDefaults.getSmallContentPadding). Logical, so the start side follows
219
- // direction. Direction inherits into a shadow root; a [dir] selector does not
220
- // see a direction set outside one, which is how the icon already mirrors.
221
- &--s.#{$component}--icon {
222
- padding-inline-start: v.button('padding-icon');
223
-
224
- &:has(.#{$component}__icon--end) {
225
- padding-inline-start: v.button('padding-s');
226
- padding-inline-end: v.button('padding-icon');
227
- }
228
- }
229
-
230
- // The xs and s sizes keep a 48dp touch target (m3.material.io button specs,
231
- // target areas): the hit area extends above and below the container.
232
- &--xs,
233
- &--s {
234
- &::after {
235
- content: '';
236
- position: absolute;
237
- left: 0;
238
- right: 0;
239
- top: 50%;
240
- height: v.button('touch-target');
241
- transform: translateY(-50%);
242
- }
243
- }
244
-
245
- // ---------------------------------------------------------------------------
246
- // Pressed shape: the container squares off while pressed, for both shapes
247
- // (Button*Tokens.PressedContainerShape). Declared after the size and shape
248
- // rules so it wins at equal specificity.
249
- // ---------------------------------------------------------------------------
250
- &:active,
251
- &--active {
252
- border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-s'));
253
- box-shadow: none;
254
- }
255
-
256
- @each $size in $sizes {
257
- &--#{$size} {
258
- &:active,
259
- &.#{$component}--active {
260
- border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-#{$size}'));
261
- }
262
- }
263
- }
264
-
265
- // ---------------------------------------------------------------------------
266
- // Colour styles
267
- // ---------------------------------------------------------------------------
268
- @each $variant, $role in $content-color {
269
- &--#{$variant} {
270
- @if $variant == 'text' {
271
- // A container can recolour its text buttons, into the element's shadow
272
- // root: the vibrant toolbar's "standard button" is on-primary-container.
273
- color: var(--#{base.$prefix}-button-text-color, #{t.color($role)});
274
- } @else {
275
- color: t.color($role);
276
- }
277
- }
278
- }
279
-
280
- // Filled: primary container, level 1 on hover (FilledButtonTokens)
281
- &--filled {
282
- background-color: t.color('primary');
283
-
284
- &:hover {
285
- @include m.elevation(1);
286
- }
287
-
288
- &:active,
289
- &.#{$component}--active,
290
- &:disabled {
291
- @include m.elevation(0);
292
- }
293
- }
294
-
295
- // Elevated: surface-container-low, level 1 at rest, 2 on hover, 0 disabled
296
- // (ElevatedButtonTokens)
297
- &--elevated {
298
- background-color: t.color('surface-container-low');
299
- @include m.elevation(1);
300
-
301
- &:hover {
302
- @include m.elevation(2);
303
- }
304
-
305
- &:active,
306
- &.#{$component}--active {
307
- @include m.elevation(1);
308
- }
309
-
310
- &:disabled {
311
- box-shadow: none;
312
- }
313
- }
314
-
315
- // Tonal: secondary container, level 1 on hover (TonalButtonTokens)
316
- &--tonal {
317
- background-color: t.color('secondary-container');
318
-
319
- &:hover {
320
- @include m.elevation(1);
321
- }
322
-
323
- &:active,
324
- &.#{$component}--active,
325
- &:disabled {
326
- @include m.elevation(0);
327
- }
328
- }
329
-
330
- // Outlined: outline-variant outline, on-surface-variant content
331
- // (OutlinedButtonTokens, ButtonDefaults.outlinedButtonBorder)
332
- &--outlined {
333
- border: v.button('outline-width-s') solid t.color('outline-variant');
334
-
335
- &:disabled {
336
- background-color: transparent;
337
- border-color: t.alpha('outline-variant', 0.1);
338
- }
339
- }
340
-
341
- // Text: no container, 12dp horizontal padding, 16dp beside the label when
342
- // there is an icon (ButtonDefaults.TextButtonContentPadding,
343
- // TextButtonWithIconContentPadding). The icon insets are logical, for the
344
- // same reason as the small button. Larger sizes use the size's spacing.
345
- &--text {
346
- padding: 0 v.button('padding-horizontal-small');
347
-
348
- &.#{$component}--icon {
349
- padding-inline: v.button('padding-horizontal-small') v.button('padding-s');
350
-
351
- &:has(.#{$component}__icon--end) {
352
- padding-inline: v.button('padding-s') v.button('padding-horizontal-small');
353
- }
354
- }
355
-
356
- @each $size in m, l, xl {
357
- &.#{$component}--#{$size} {
358
- padding: 0 v.button('padding-#{$size}');
359
- }
360
- }
361
-
362
- &:disabled {
363
- background-color: transparent;
364
- }
365
- }
366
-
367
- // ---------------------------------------------------------------------------
368
- // Toggle buttons (ToggleButtonDefaults in ToggleButton.kt, *ButtonTokens
369
- // Unselected*/Selected* roles). Unselected filled buttons drop to
370
- // surface-container; selected buttons take the selected roles and swap
371
- // the resting shape: round becomes square, square becomes round
372
- // (m3.material.io button specs, "When selected").
373
- // ---------------------------------------------------------------------------
374
- &--toggle {
375
- // A toggle's states are state layers, not elevation: ToggleButtonDefaults
376
- // carries colours and shapes only, and every state below is a layer. As a
377
- // standalone button the filled and tonal containers still rise on hover
378
- // (ButtonDefaults.buttonElevation); as toggles they stay flat, which also
379
- // keeps a connected group's segment from casting a shadow over the
380
- // neighbour 2dp away. An elevated toggle keeps its elevation: that is what
381
- // its container is.
382
- &.#{$component}--filled,
383
- &.#{$component}--tonal {
384
- &,
385
- &:hover,
386
- &:active,
387
- &.#{$component}--active {
388
- box-shadow: none;
389
- }
390
- }
391
-
392
- &.#{$component}--filled {
393
- background-color: t.color('surface-container');
394
- color: t.color('on-surface-variant');
395
- }
396
-
397
- &.#{$component}--selected {
398
- $selected: (
399
- 'filled': ('primary', 'on-primary'),
400
- 'elevated': ('primary', 'on-primary'),
401
- 'tonal': ('secondary', 'on-secondary'),
402
- 'outlined': ('inverse-surface', 'inverse-on-surface')
403
- );
404
-
405
- @each $variant, $roles in $selected {
406
- $container: list.nth($roles, 1);
407
- $content: list.nth($roles, 2);
408
-
409
- &.#{$component}--#{$variant} {
410
- background-color: t.color($container);
411
- color: t.color($content);
412
- }
413
- }
414
-
415
- &.#{$component}--outlined {
416
- border-color: transparent;
417
- }
418
-
419
- // Shape swap: a round toggle squares off, a square one rounds
420
- @each $size in $sizes {
421
- &.#{$component}--#{$size} {
422
- border-radius: var(--#{base.$prefix}-button-shape-selected, v.button('shape-square-#{$size}'));
423
- }
424
- }
425
-
426
- @each $size in $sizes {
427
- &.#{$component}--square.#{$component}--#{$size} {
428
- border-radius: var(--#{base.$prefix}-button-shape-selected, v.button('shape-round-#{$size}'));
429
- }
430
- }
431
-
432
- @each $size in $sizes {
433
- &.#{$component}--#{$size}:active,
434
- &.#{$component}--#{$size}.#{$component}--active {
435
- border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-#{$size}'));
436
- }
437
- }
438
- }
439
-
440
- // Disabled keeps the common disabled roles whatever the selection
441
- &:disabled,
442
- &.#{$component}--selected:disabled {
443
- color: t.alpha('on-surface-variant', 0.38);
444
- background-color: t.alpha('on-surface', 0.1);
445
- border-color: t.alpha('outline-variant', 0.1);
446
- box-shadow: none;
447
- }
448
-
449
- &.#{$component}--outlined:disabled {
450
- background-color: transparent;
451
- }
452
- }
453
-
454
- // ---------------------------------------------------------------------------
455
- // Circular buttons
456
- // ---------------------------------------------------------------------------
457
- &--circular {
458
- flex: none !important;
459
- border-radius: 50%;
460
- padding: 8px;
461
- min-width: unset;
462
- width: v.button('height-s') !important;
463
- height: v.button('height-s');
464
-
465
- &:active,
466
- &.#{$component}--active {
467
- border-radius: 50%;
468
-
469
- &.#{$component}--square {
470
- border-radius: v.shape('medium') !important; // ButtonSmallTokens square: corner-medium
471
- }
472
- }
473
-
474
- &.#{$component}--square {
475
- border-radius: v.shape('medium');
476
- }
477
-
478
- @each $size in $sizes {
479
- &.#{$component}--#{$size} {
480
- width: v.button('height-#{$size}');
481
- height: v.button('height-#{$size}');
482
- padding: 0;
483
- }
484
- }
485
-
486
- .#{$component}__text {
487
- display: none;
488
- }
489
-
490
- &.#{$component}--progress {
491
- padding: 0 !important;
492
- }
493
- }
494
-
495
- // Progress showing while disabled (loading state)
496
- &[disabled].#{$component}--progress .#{$component}__progress {
497
- opacity: 0.7;
498
- }
31
+ position: relative;
32
+ display: inline-flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ gap: v.button('icon-gap-s');
36
+ min-width: v.button('min-width');
37
+ height: v.button('height-s');
38
+ padding: 0 v.button('padding-s');
39
+ border: none;
40
+ border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-round-s'));
41
+ background-color: transparent;
42
+ color: inherit;
43
+ font: inherit;
44
+ text-decoration: none;
45
+ cursor: pointer;
46
+ user-select: none;
47
+ vertical-align: middle;
48
+ appearance: none;
49
+ will-change: border-radius;
50
+
51
+ @include m.typography('label-large');
52
+
53
+ transition:
54
+ background-color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
55
+ color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
56
+ box-shadow v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
57
+ border-color v.motion('spring-default-effects-duration') v.motion('spring-default-effects-easing'),
58
+ border-radius v.motion('spring-fast-spatial-duration') v.motion('spring-fast-spatial-easing');
59
+
60
+ &:focus {
61
+ outline: none;
62
+ }
63
+
64
+ &:focus-visible {
65
+ outline: 3px solid t.color('secondary');
66
+ outline-offset: 2px;
67
+ }
68
+
69
+ &:disabled {
70
+ pointer-events: none;
71
+ color: t.alpha('on-surface-variant', 0.38);
72
+ background-color: t.alpha('on-surface', 0.1);
73
+ box-shadow: none;
74
+
75
+ .#{$component}__icon {
76
+ color: t.alpha('on-surface-variant', 0.38);
77
+ }
78
+ }
79
+
80
+ &::before {
81
+ content: '';
82
+ position: absolute;
83
+ inset: 0;
84
+ background-color: currentColor;
85
+ opacity: 0;
86
+ pointer-events: none;
87
+ border-radius: inherit;
88
+ transition: opacity v.motion('duration-short2') v.motion('easing-standard');
89
+ }
90
+
91
+ &:hover::before {
92
+ opacity: f.get-state-opacity('hover');
93
+ }
94
+
95
+ &:focus-visible::before {
96
+ opacity: f.get-state-opacity('focus');
97
+ }
98
+
99
+ &:active:not(:has(> .#{base.$prefix}-ripple))::before,
100
+ &--active:not(:has(> .#{base.$prefix}-ripple))::before {
101
+ opacity: f.get-state-opacity('pressed');
102
+ }
103
+
104
+ &__icon {
105
+ display: inline-flex;
106
+ align-items: center;
107
+ justify-content: center;
108
+ flex: none;
109
+ width: v.button('icon-size-s');
110
+ height: v.button('icon-size-s');
111
+
112
+ svg {
113
+ width: 100%;
114
+ height: 100%;
115
+ }
116
+ }
117
+
118
+ &__progress {
119
+ display: inline-flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ flex: none;
123
+ width: v.button('icon-size-s');
124
+ height: v.button('icon-size-s');
125
+
126
+ &.#{base.$prefix}-progress {
127
+ width: v.button('icon-size-s');
128
+ height: v.button('icon-size-s');
129
+ transition: opacity v.motion('duration-short2') v.motion('easing-standard');
130
+ }
131
+
132
+ .#{base.$prefix}-progress__canvas {
133
+ color: currentColor;
134
+ }
135
+ }
136
+
137
+ &__text {
138
+ @include m.truncate;
139
+ }
140
+
141
+ @each $size in $sizes {
142
+ &--#{$size} {
143
+ height: v.button('height-#{$size}');
144
+ padding: 0 v.button('padding-#{$size}');
145
+ gap: v.button('icon-gap-#{$size}');
146
+ @include m.typography(map.get($label-typescale, $size));
147
+
148
+ .#{$component}__icon,
149
+ .#{$component}__progress,
150
+ .#{$component}__progress.#{base.$prefix}-progress {
151
+ width: v.button('icon-size-#{$size}');
152
+ height: v.button('icon-size-#{$size}');
153
+ }
154
+
155
+ border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-round-#{$size}'));
156
+
157
+ &.#{$component}--square {
158
+ border-radius: var(--#{base.$prefix}-button-shape, v.button('shape-square-#{$size}'));
159
+ }
160
+
161
+ &.#{$component}--outlined {
162
+ border-width: v.button('outline-width-#{$size}');
163
+ }
164
+ }
165
+ }
166
+
167
+ &--s.#{$component}--icon {
168
+ padding-inline-start: v.button('padding-icon');
169
+
170
+ &:has(.#{$component}__icon--end) {
171
+ padding-inline-start: v.button('padding-s');
172
+ padding-inline-end: v.button('padding-icon');
173
+ }
174
+ }
175
+
176
+ &--xs,
177
+ &--s {
178
+ &::after {
179
+ content: '';
180
+ position: absolute;
181
+ left: 0;
182
+ right: 0;
183
+ top: 50%;
184
+ height: v.button('touch-target');
185
+ transform: translateY(-50%);
186
+ }
187
+ }
188
+
189
+ &:active,
190
+ &--active {
191
+ border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-s'));
192
+ box-shadow: none;
193
+ }
194
+
195
+ @each $size in $sizes {
196
+ &--#{$size} {
197
+ &:active,
198
+ &.#{$component}--active {
199
+ border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-#{$size}'));
200
+ }
201
+ }
202
+ }
203
+
204
+ @each $variant, $role in $content-color {
205
+ &--#{$variant} {
206
+ @if $variant == 'text' {
207
+ color: var(--#{base.$prefix}-button-text-color, #{t.color($role)});
208
+ } @else {
209
+ color: t.color($role);
210
+ }
211
+ }
212
+ }
213
+
214
+ &--filled {
215
+ background-color: t.color('primary');
216
+
217
+ &:hover {
218
+ @include m.elevation(1);
219
+ }
220
+
221
+ &:active,
222
+ &.#{$component}--active,
223
+ &:disabled {
224
+ @include m.elevation(0);
225
+ }
226
+ }
227
+
228
+ &--elevated {
229
+ background-color: t.color('surface-container-low');
230
+ @include m.elevation(1);
231
+
232
+ &:hover {
233
+ @include m.elevation(2);
234
+ }
235
+
236
+ &:active,
237
+ &.#{$component}--active {
238
+ @include m.elevation(1);
239
+ }
240
+
241
+ &:disabled {
242
+ box-shadow: none;
243
+ }
244
+ }
245
+
246
+ &--tonal {
247
+ background-color: t.color('secondary-container');
248
+
249
+ &:hover {
250
+ @include m.elevation(1);
251
+ }
252
+
253
+ &:active,
254
+ &.#{$component}--active,
255
+ &:disabled {
256
+ @include m.elevation(0);
257
+ }
258
+ }
259
+
260
+ &--outlined {
261
+ border: v.button('outline-width-s') solid t.color('outline-variant');
262
+
263
+ &:disabled {
264
+ background-color: transparent;
265
+ border-color: t.alpha('outline-variant', 0.1);
266
+ }
267
+ }
268
+
269
+ &--text {
270
+ padding: 0 v.button('padding-horizontal-small');
271
+
272
+ &.#{$component}--icon {
273
+ padding-inline: v.button('padding-horizontal-small') v.button('padding-s');
274
+
275
+ &:has(.#{$component}__icon--end) {
276
+ padding-inline: v.button('padding-s') v.button('padding-horizontal-small');
277
+ }
278
+ }
279
+
280
+ @each $size in m, l, xl {
281
+ &.#{$component}--#{$size} {
282
+ padding: 0 v.button('padding-#{$size}');
283
+ }
284
+ }
285
+
286
+ &:disabled {
287
+ background-color: transparent;
288
+ }
289
+ }
290
+
291
+ &--toggle {
292
+ &.#{$component}--filled,
293
+ &.#{$component}--tonal {
294
+ &,
295
+ &:hover,
296
+ &:active,
297
+ &.#{$component}--active {
298
+ box-shadow: none;
299
+ }
300
+ }
301
+
302
+ &.#{$component}--filled {
303
+ background-color: t.color('surface-container');
304
+ color: t.color('on-surface-variant');
305
+ }
306
+
307
+ &.#{$component}--selected {
308
+ $selected: (
309
+ 'filled': ('primary', 'on-primary'),
310
+ 'elevated': ('primary', 'on-primary'),
311
+ 'tonal': ('secondary', 'on-secondary'),
312
+ 'outlined': ('inverse-surface', 'inverse-on-surface')
313
+ );
314
+
315
+ @each $variant, $roles in $selected {
316
+ $container: list.nth($roles, 1);
317
+ $content: list.nth($roles, 2);
318
+
319
+ &.#{$component}--#{$variant} {
320
+ background-color: t.color($container);
321
+ color: t.color($content);
322
+ }
323
+ }
324
+
325
+ &.#{$component}--outlined {
326
+ border-color: transparent;
327
+ }
328
+
329
+ @each $size in $sizes {
330
+ &.#{$component}--#{$size} {
331
+ border-radius: var(--#{base.$prefix}-button-shape-selected, v.button('shape-square-#{$size}'));
332
+ }
333
+ }
334
+
335
+ @each $size in $sizes {
336
+ &.#{$component}--square.#{$component}--#{$size} {
337
+ border-radius: var(--#{base.$prefix}-button-shape-selected, v.button('shape-round-#{$size}'));
338
+ }
339
+ }
340
+
341
+ @each $size in $sizes {
342
+ &.#{$component}--#{$size}:active,
343
+ &.#{$component}--#{$size}.#{$component}--active {
344
+ border-radius: var(--#{base.$prefix}-button-shape-pressed, v.button('shape-pressed-#{$size}'));
345
+ }
346
+ }
347
+ }
348
+
349
+ &:disabled,
350
+ &.#{$component}--selected:disabled {
351
+ color: t.alpha('on-surface-variant', 0.38);
352
+ background-color: t.alpha('on-surface', 0.1);
353
+ border-color: t.alpha('outline-variant', 0.1);
354
+ box-shadow: none;
355
+ }
356
+
357
+ &.#{$component}--outlined:disabled {
358
+ background-color: transparent;
359
+ }
360
+ }
361
+
362
+ &--circular {
363
+ flex: none !important;
364
+ border-radius: 50%;
365
+ padding: 8px;
366
+ min-width: unset;
367
+ width: v.button('height-s') !important;
368
+ height: v.button('height-s');
369
+
370
+ &:active,
371
+ &.#{$component}--active {
372
+ border-radius: 50%;
373
+
374
+ &.#{$component}--square {
375
+ border-radius: v.shape('medium') !important;
376
+ }
377
+ }
378
+
379
+ &.#{$component}--square {
380
+ border-radius: v.shape('medium');
381
+ }
382
+
383
+ @each $size in $sizes {
384
+ &.#{$component}--#{$size} {
385
+ width: v.button('height-#{$size}');
386
+ height: v.button('height-#{$size}');
387
+ padding: 0;
388
+ }
389
+ }
390
+
391
+ .#{$component}__text {
392
+ display: none;
393
+ }
394
+
395
+ &.#{$component}--progress {
396
+ padding: 0 !important;
397
+ }
398
+ }
399
+
400
+ &[disabled].#{$component}--progress .#{$component}__progress {
401
+ opacity: 0.7;
402
+ }
499
403
  }