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/components/checkbox/_checkbox.scss
2
1
  @use '../../styles/abstract/base' as base;
3
2
  @use '../../styles/abstract/variables' as v;
4
3
  @use '../../styles/abstract/functions' as f;
@@ -8,253 +7,213 @@
8
7
  $component: '#{base.$prefix}-checkbox';
9
8
 
10
9
  .#{$component} {
11
- // Base styles
12
- display: inline-flex;
13
- align-items: center;
14
- position: relative;
15
- // 48dp minimum interactive size: MDC minTouchTargetSize, Compose
16
- // minimumInteractiveComponentSize(). Compose has no checkbox token for it. The input
17
- // below is absolute at 100%/100%, so the hit area follows this box; min-width covers
18
- // the unlabelled case, where the content is only the 18px icon.
19
- min-height: 48px;
20
- min-width: 48px;
21
- // Without the base reset: the 4px padding must stay inside the 48px target.
22
- box-sizing: border-box;
23
- padding: 4px 0;
24
- user-select: none;
25
-
26
- // With no label the root is its own 48px target, so the box belongs in its
27
- // centre: M3 "Icon alignment Center-aligned", (48 - 18) / 2 = 15px a side,
28
- // which leaves the 40px state layer 4px inside the root on all sides. With
29
- // a label the root hugs box, gap and label, has no free space, and keeps
30
- // the box at the inline-start (the layout scripts/check-elements.ts holds
31
- // as its contract).
32
- &:not(:has(> .#{$component}__label)) {
33
- justify-content: center;
34
- }
35
-
36
- // Input (visually hidden but accessible)
37
- &__input {
38
- font: inherit;
39
- position: absolute;
40
- opacity: 0;
41
- width: 100%;
42
- height: 100%;
43
- margin: 0;
44
- cursor: pointer;
45
- z-index: 1;
46
-
47
- &:disabled {
48
- cursor: not-allowed;
49
- }
50
- }
51
-
52
- // The box: 18dp, a 2dp corner and a 2dp on-surface-variant outline, with no fill
53
- // until selected (CheckboxTokens, md-comp-checkbox). It carried a
54
- // surface-container-highest fill and an outline-coloured stroke.
55
- &__icon {
56
- position: relative;
57
- flex-shrink: 0;
58
- width: 18px;
59
- height: 18px;
60
- box-sizing: border-box;
61
- // CheckboxTokens.ContainerShape: 2dp, outside the shape scale
62
- border-radius: 2px;
63
- background-color: transparent;
64
- border: 2px solid t.color('on-surface-variant');
65
- transition: m.spring(background-color, fast-effects), m.spring(border-color, fast-effects);
66
-
67
- // The 40dp state layer, centred on the box. Its colour carries the state
68
- // opacity, so its outline can be the focus ring at full strength.
69
- &::before {
70
- content: '';
71
- position: absolute;
72
- inset: -13px;
73
- border-radius: 50%;
74
- background-color: transparent;
75
- pointer-events: none;
76
- }
77
-
78
- // The check draws in on the default spatial spring and snaps off, as Compose's
79
- // does: the transition belongs to the checked state only.
80
- svg {
81
- position: absolute;
82
- top: 50%;
83
- left: 50%;
84
- width: 18px;
85
- height: 18px;
86
- transform: translate(-50%, -50%) scale(0);
87
- fill: currentColor;
88
- color: t.color('on-primary');
89
- }
90
- }
91
-
92
- // Label styling
93
- &__label {
94
- @include m.typography('body-large');
95
- color: t.color('on-surface');
96
- }
97
-
98
- // The gap follows the reading direction on both sides.
99
- &--label-end .#{$component}__label {
100
- margin-inline-start: 12px;
101
- }
102
-
103
- &--label-start .#{$component}__label {
104
- margin-inline-end: 12px;
105
- }
106
-
107
- // Selected: checked or indeterminate, primary with on-primary content.
108
- .#{$component}__input:checked ~ .#{$component}__icon,
109
- &--indeterminate .#{$component}__icon {
110
- background-color: t.color('primary');
111
- border-color: t.color('primary');
112
- }
113
-
114
- .#{$component}__input:checked ~ .#{$component}__icon svg {
115
- transform: translate(-50%, -50%) scale(1);
116
- transition: m.spring(transform, default-spatial);
117
- }
118
-
119
- // Indeterminate state
120
- &--indeterminate {
121
- .#{$component}__icon {
122
- &::after {
123
- content: '';
124
- position: absolute;
125
- top: 50%;
126
- left: 50%;
127
- transform: translate(-50%, -50%);
128
- width: 10px;
129
- height: 2px;
130
- background-color: t.color('on-primary');
131
- }
132
-
133
- svg {
134
- display: none;
135
- }
136
- }
137
- }
138
-
139
- // Error (m3: "those states on error"): the outline, the selected container and
140
- // every state layer are error, the check and dash on-error.
141
- &--error {
142
- .#{$component}__icon {
143
- border-color: t.color('error');
144
- }
145
-
146
- .#{$component}__input:checked ~ .#{$component}__icon,
147
- &.#{$component}--indeterminate .#{$component}__icon {
148
- background-color: t.color('error');
149
- border-color: t.color('error');
150
- }
151
-
152
- .#{$component}__icon svg {
153
- color: t.color('on-error');
154
- }
155
-
156
- &.#{$component}--indeterminate .#{$component}__icon::after {
157
- background-color: t.color('on-error');
158
- }
159
- }
160
-
161
- // Disabled state. Per role, not a blanket opacity: CheckboxTokens gives the
162
- // unselected outline and the selected container OnSurface at 0.38, and the selected
163
- // checkmark Surface at full opacity. The indeterminate dash follows the check: it
164
- // was an on-primary dash on a transparent box, which painted nothing.
165
- &--disabled {
166
- .#{$component}__input {
167
- cursor: not-allowed;
168
- }
169
-
170
- .#{$component}__icon {
171
- background-color: transparent;
172
- border-color: t.alpha('on-surface', 0.38);
173
- }
174
-
175
- .#{$component}__input:checked ~ .#{$component}__icon,
176
- &.#{$component}--indeterminate .#{$component}__icon {
177
- background-color: t.alpha('on-surface', 0.38);
178
- border-color: transparent;
179
- }
180
-
181
- .#{$component}__icon svg {
182
- color: t.color('surface');
183
- }
184
-
185
- &.#{$component}--indeterminate .#{$component}__icon::after {
186
- background-color: t.color('surface');
187
- }
188
-
189
- .#{$component}__label {
190
- color: t.alpha('on-surface', 0.38);
191
- }
192
- }
193
-
194
- // State layers (md-comp-checkbox). Unselected: on-surface on hover and focus, and
195
- // the outline turns on-surface; selected: primary. A press takes the colour of the
196
- // state it leads to (unselected presses primary, selected presses on-surface), and
197
- // error is error throughout. Checked hover used the pressed opacity.
198
- &:not(&--disabled) {
199
- $input: '.#{$component}__input';
200
- $layer: '.#{$component}__icon::before';
201
-
202
- #{$input}:is(:hover, :focus-visible, :active):not(:checked) ~ .#{$component}__icon {
203
- border-color: t.color('on-surface');
204
- }
205
-
206
- #{$input}:hover ~ #{$layer} { background-color: t.alpha('on-surface', v.state('hover-state-layer-opacity')); }
207
- #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('on-surface', v.state('focus-state-layer-opacity')); }
208
- #{$input}:active ~ #{$layer} { background-color: t.alpha('primary', v.state('pressed-state-layer-opacity')); }
209
-
210
- #{$input}:checked:hover ~ #{$layer},
211
- &.#{$component}--indeterminate #{$input}:hover ~ #{$layer} { background-color: t.alpha('primary', v.state('hover-state-layer-opacity')); }
212
- #{$input}:checked:focus-visible ~ #{$layer},
213
- &.#{$component}--indeterminate #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('primary', v.state('focus-state-layer-opacity')); }
214
- #{$input}:checked:active ~ #{$layer},
215
- &.#{$component}--indeterminate #{$input}:active ~ #{$layer} { background-color: t.alpha('on-surface', v.state('pressed-state-layer-opacity')); }
216
-
217
- &.#{$component}--error {
218
- #{$input}:not(:checked):is(:hover, :focus-visible, :active) ~ .#{$component}__icon { border-color: t.color('error'); }
219
- #{$input}:hover ~ #{$layer} { background-color: t.alpha('error', v.state('hover-state-layer-opacity')); }
220
- #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('error', v.state('focus-state-layer-opacity')); }
221
- #{$input}:active ~ #{$layer} { background-color: t.alpha('error', v.state('pressed-state-layer-opacity')); }
222
- }
223
-
224
- // md.comp.focus-ring: 3dp secondary, 2dp outside the state layer.
225
- #{$input}:focus-visible ~ #{$layer} {
226
- outline: 3px solid t.color('secondary');
227
- outline-offset: 2px;
228
- }
229
- }
230
-
231
- // Accessibility
232
- @include m.reduced-motion {
233
- .#{$component}__icon,
234
- .#{$component}__icon svg {
235
- transition: none;
236
- }
237
- }
238
-
239
- @include m.high-contrast {
240
- .#{$component}__icon {
241
- border-width: 2px;
242
- }
243
- }
244
-
245
- // Touch target
246
- // @include m.touch-target;
247
- }
248
-
249
- // Checkbox group layout
10
+ display: inline-flex;
11
+ align-items: center;
12
+ position: relative;
13
+ min-height: 48px;
14
+ min-width: 48px;
15
+ box-sizing: border-box;
16
+ padding: 4px 0;
17
+ user-select: none;
18
+
19
+ &:not(:has(> .#{$component}__label)) {
20
+ justify-content: center;
21
+ }
22
+
23
+ &__input {
24
+ font: inherit;
25
+ position: absolute;
26
+ opacity: 0;
27
+ width: 100%;
28
+ height: 100%;
29
+ margin: 0;
30
+ cursor: pointer;
31
+ z-index: 1;
32
+
33
+ &:disabled {
34
+ cursor: not-allowed;
35
+ }
36
+ }
37
+
38
+ &__icon {
39
+ position: relative;
40
+ flex-shrink: 0;
41
+ width: 18px;
42
+ height: 18px;
43
+ box-sizing: border-box;
44
+ border-radius: 2px;
45
+ background-color: transparent;
46
+ border: 2px solid t.color('on-surface-variant');
47
+ transition: m.spring(background-color, fast-effects), m.spring(border-color, fast-effects);
48
+
49
+ &::before {
50
+ content: '';
51
+ position: absolute;
52
+ inset: -13px;
53
+ border-radius: 50%;
54
+ background-color: transparent;
55
+ pointer-events: none;
56
+ }
57
+
58
+ svg {
59
+ position: absolute;
60
+ top: 50%;
61
+ left: 50%;
62
+ width: 18px;
63
+ height: 18px;
64
+ transform: translate(-50%, -50%) scale(0);
65
+ fill: currentColor;
66
+ color: t.color('on-primary');
67
+ }
68
+ }
69
+
70
+ &__label {
71
+ @include m.typography('body-large');
72
+ color: t.color('on-surface');
73
+ }
74
+
75
+ &--label-end .#{$component}__label {
76
+ margin-inline-start: 12px;
77
+ }
78
+
79
+ &--label-start .#{$component}__label {
80
+ margin-inline-end: 12px;
81
+ }
82
+
83
+ .#{$component}__input:checked ~ .#{$component}__icon,
84
+ &--indeterminate .#{$component}__icon {
85
+ background-color: t.color('primary');
86
+ border-color: t.color('primary');
87
+ }
88
+
89
+ .#{$component}__input:checked ~ .#{$component}__icon svg {
90
+ transform: translate(-50%, -50%) scale(1);
91
+ transition: m.spring(transform, default-spatial);
92
+ }
93
+
94
+ &--indeterminate {
95
+ .#{$component}__icon {
96
+ &::after {
97
+ content: '';
98
+ position: absolute;
99
+ top: 50%;
100
+ left: 50%;
101
+ transform: translate(-50%, -50%);
102
+ width: 10px;
103
+ height: 2px;
104
+ background-color: t.color('on-primary');
105
+ }
106
+
107
+ svg {
108
+ display: none;
109
+ }
110
+ }
111
+ }
112
+
113
+ &--error {
114
+ .#{$component}__icon {
115
+ border-color: t.color('error');
116
+ }
117
+
118
+ .#{$component}__input:checked ~ .#{$component}__icon,
119
+ &.#{$component}--indeterminate .#{$component}__icon {
120
+ background-color: t.color('error');
121
+ border-color: t.color('error');
122
+ }
123
+
124
+ .#{$component}__icon svg {
125
+ color: t.color('on-error');
126
+ }
127
+
128
+ &.#{$component}--indeterminate .#{$component}__icon::after {
129
+ background-color: t.color('on-error');
130
+ }
131
+ }
132
+
133
+ &--disabled {
134
+ .#{$component}__input {
135
+ cursor: not-allowed;
136
+ }
137
+
138
+ .#{$component}__icon {
139
+ background-color: transparent;
140
+ border-color: t.alpha('on-surface', 0.38);
141
+ }
142
+
143
+ .#{$component}__input:checked ~ .#{$component}__icon,
144
+ &.#{$component}--indeterminate .#{$component}__icon {
145
+ background-color: t.alpha('on-surface', 0.38);
146
+ border-color: transparent;
147
+ }
148
+
149
+ .#{$component}__icon svg {
150
+ color: t.color('surface');
151
+ }
152
+
153
+ &.#{$component}--indeterminate .#{$component}__icon::after {
154
+ background-color: t.color('surface');
155
+ }
156
+
157
+ .#{$component}__label {
158
+ color: t.alpha('on-surface', 0.38);
159
+ }
160
+ }
161
+
162
+ &:not(&--disabled) {
163
+ $input: '.#{$component}__input';
164
+ $layer: '.#{$component}__icon::before';
165
+
166
+ #{$input}:is(:hover, :focus-visible, :active):not(:checked) ~ .#{$component}__icon {
167
+ border-color: t.color('on-surface');
168
+ }
169
+
170
+ #{$input}:hover ~ #{$layer} { background-color: t.alpha('on-surface', v.state('hover-state-layer-opacity')); }
171
+ #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('on-surface', v.state('focus-state-layer-opacity')); }
172
+ #{$input}:active ~ #{$layer} { background-color: t.alpha('primary', v.state('pressed-state-layer-opacity')); }
173
+
174
+ #{$input}:checked:hover ~ #{$layer},
175
+ &.#{$component}--indeterminate #{$input}:hover ~ #{$layer} { background-color: t.alpha('primary', v.state('hover-state-layer-opacity')); }
176
+ #{$input}:checked:focus-visible ~ #{$layer},
177
+ &.#{$component}--indeterminate #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('primary', v.state('focus-state-layer-opacity')); }
178
+ #{$input}:checked:active ~ #{$layer},
179
+ &.#{$component}--indeterminate #{$input}:active ~ #{$layer} { background-color: t.alpha('on-surface', v.state('pressed-state-layer-opacity')); }
180
+
181
+ &.#{$component}--error {
182
+ #{$input}:not(:checked):is(:hover, :focus-visible, :active) ~ .#{$component}__icon { border-color: t.color('error'); }
183
+ #{$input}:hover ~ #{$layer} { background-color: t.alpha('error', v.state('hover-state-layer-opacity')); }
184
+ #{$input}:focus-visible ~ #{$layer} { background-color: t.alpha('error', v.state('focus-state-layer-opacity')); }
185
+ #{$input}:active ~ #{$layer} { background-color: t.alpha('error', v.state('pressed-state-layer-opacity')); }
186
+ }
187
+
188
+ #{$input}:focus-visible ~ #{$layer} {
189
+ outline: 3px solid t.color('secondary');
190
+ outline-offset: 2px;
191
+ }
192
+ }
193
+
194
+ @include m.reduced-motion {
195
+ .#{$component}__icon,
196
+ .#{$component}__icon svg {
197
+ transition: none;
198
+ }
199
+ }
200
+
201
+ @include m.high-contrast {
202
+ .#{$component}__icon {
203
+ border-width: 2px;
204
+ }
205
+ }
206
+
207
+ }
208
+
250
209
  .#{$component}-group {
251
- display: flex;
252
- flex-direction: column;
253
- gap: 8px;
254
-
255
- &--horizontal {
256
- flex-direction: row;
257
- gap: 16px;
258
- flex-wrap: wrap;
259
- }
210
+ display: flex;
211
+ flex-direction: column;
212
+ gap: 8px;
213
+
214
+ &--horizontal {
215
+ flex-direction: row;
216
+ gap: 16px;
217
+ flex-wrap: wrap;
218
+ }
260
219
  }