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,22 +1,9 @@
1
- // src/components/slider/_styles.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;
5
4
  @use '../../styles/abstract/mixins' as m;
6
5
  @use '../../styles/abstract/theme' as t;
7
6
 
8
- // Motion. A value change that does not follow a pointer -- a tap on the
9
- // track, a key, setValue() -- carries the handle, the value indicator and the track
10
- // to the new value on the default spatial spring, as the m3.material.io sliders
11
- // video shows: a tap slides the handle over, peaking about 300ms in with a 3-5%
12
- // overshoot and settled by 450ms. The default spatial spring peaks at about 270ms
13
- // with 1.5% and settles in 450ms; the fast one (140ms, 9%) was visibly too strong. The controller sets
14
- // `--settling` for those changes alone, so a drag follows the pointer and a layout
15
- // render (the first one, a resize) never moves anything.
16
- //
17
- // The value indicator grows out of the handle and shrinks back into it: in on
18
- // motionDurationMedium4 emphasized decelerate, out on motionDurationShort3
19
- // emphasized accelerate (material-components-android BaseSlider label animator).
20
7
  $bubble-in: v.motion('duration-medium4') v.motion('easing-emphasized-decelerate');
21
8
  $bubble-out: v.motion('duration-short3') v.motion('easing-emphasized-accelerate');
22
9
  $bubble-transition: scale $bubble-out, opacity $bubble-out, visibility 0s linear v.motion('duration-short3');
@@ -25,358 +12,293 @@ $bubble-transition-visible: scale $bubble-in, opacity $bubble-in, visibility 0s;
25
12
  $component: '#{base.$prefix}-slider';
26
13
 
27
14
  .#{$component} {
28
- // Base styles
29
- position: relative;
30
- width: 100%;
31
- display: flex;
32
- flex-direction: column;
33
- user-select: none;
34
- touch-action: none;
35
-
36
- // Decoration inherits theme colours directly, without JavaScript subscriptions.
37
- // SliderTokens / SliderDefaults.colors(): the active track, the handle, the stop
38
- // indicator and the ticks on the inactive track take the colour (primary); the
39
- // inactive track and the ticks on the active track take its container colour
40
- // (secondaryContainer). A stylesheet overrides them per slider with
41
- // --<prefix>-slider-color, --<prefix>-slider-container-color and, for the ticks on
42
- // the active track alone, --<prefix>-slider-on-color.
43
- --#{base.$prefix}-slider-track-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
44
- --#{base.$prefix}-slider-inactive-track-color: var(--#{base.$prefix}-slider-container-color, #{t.color('secondary-container')});
45
- --#{base.$prefix}-slider-tick-color: var(--#{base.$prefix}-slider-on-color, var(--#{base.$prefix}-slider-inactive-track-color));
46
- --#{base.$prefix}-slider-active-opacity: 1;
47
- --#{base.$prefix}-slider-inactive-opacity: 1;
48
- // Ticks on the inactive track, then ticks on the active track.
49
- --#{base.$prefix}-slider-tick-opacity: 1;
50
- --#{base.$prefix}-slider-active-tick-opacity: 1;
51
-
52
- // Container should not have a focus outline
53
- &:focus {
54
- outline: none;
55
- }
56
-
57
- // Label
58
- // Body Large, as the checkbox, radio and switch labels.
59
- &__label {
60
- display: block;
61
- @include m.typography('body-large');
62
- color: t.color('on-surface');
63
- margin-bottom: 4px;
64
- // labelPosition: 'end' puts it below the track.
65
- &--end { margin-bottom: 0; margin-top: 4px; }
66
- }
67
-
68
- // Icon positioning
69
- &__icon {
70
- display: flex;
71
- align-items: center;
72
- justify-content: center;
73
- color: t.color('on-surface-variant');
74
- width: 40px;
75
- height: 40px;
76
-
77
- svg {
78
- width: 24px;
79
- height: 24px;
80
- }
81
- }
82
-
83
- // When slider has icon at end position
84
- // An icon outside the track sits level with it, before or after it (the M3
85
- // guidelines' icons at either end); the label spans the track's column, above or
86
- // below. It used to be absolutely placed at a fixed top on the start side, so
87
- // iconPosition and labelPosition changed nothing on screen.
88
- &--icon {
89
- display: grid;
90
- grid-template-columns: 40px minmax(0, 1fr);
91
- grid-template-areas: ". label" "icon track";
92
- column-gap: 8px;
93
- align-items: center;
94
- .#{$component}__label { grid-area: label; }
95
- .#{$component}__container { grid-area: track; }
96
- .#{$component}__icon { grid-area: icon; }
97
- }
98
- &--icon.#{$component}--label-end { grid-template-areas: "icon track" ". label"; }
99
- &--icon-end {
100
- grid-template-columns: minmax(0, 1fr) 40px;
101
- grid-template-areas: "label ." "track icon";
102
- }
103
- &--icon-end.#{$component}--label-end { grid-template-areas: "track icon" "label ."; }
104
-
105
- // Slider container - holds all the slider elements
106
- &__container {
107
- position: relative;
108
- height: 40px;
109
- display: flex;
110
- align-items: center;
111
- }
112
-
113
- // M3 defines primary only; the other colours pair with their own container the
114
- // way primary pairs with secondaryContainer.
115
- @each $color in (secondary, tertiary, error) {
116
- &--#{$color} {
117
- --#{base.$prefix}-slider-track-color: var(--#{base.$prefix}-slider-color, #{t.color($color)});
118
- --#{base.$prefix}-slider-inactive-track-color: var(--#{base.$prefix}-slider-container-color, #{t.color($color + '-container')});
119
- }
120
- }
121
- // Disabled (SliderDefaults.colors()): the active track and the ticks on the inactive
122
- // track onSurface at 0.38, the inactive track and the ticks on the active track
123
- // onSurface at 0.12.
124
- &--disabled {
125
- --#{base.$prefix}-slider-track-color: #{t.color('on-surface')};
126
- --#{base.$prefix}-slider-inactive-track-color: #{t.color('on-surface')};
127
- --#{base.$prefix}-slider-tick-color: #{t.color('on-surface')};
128
- --#{base.$prefix}-slider-active-opacity: 0.38;
129
- --#{base.$prefix}-slider-inactive-opacity: 0.12;
130
- --#{base.$prefix}-slider-tick-opacity: 0.38;
131
- --#{base.$prefix}-slider-active-tick-opacity: 0.12;
132
- }
133
- // Discrete ticks offset their repeat with cqw/cqh, which resolve against this
134
- // box. inset: 0 already gives it a definite size, so size containment holds.
135
- &__visual { position: absolute; inset: 0; pointer-events: none; container-type: size; }
136
- &__track { position: absolute; top: 50%; width: 100%; transform: translateY(-50%); overflow: hidden; }
137
- // The track clips the outer corners (its radius is set per size); a segment's own
138
- // corners are the inside ones, TrackInsideCornerSize = 2dp.
139
- &__segment {
140
- position: absolute; height: 100%; border-radius: 2px;
141
- background: var(--#{base.$prefix}-slider-inactive-track-color); opacity: var(--#{base.$prefix}-slider-inactive-opacity);
142
- &--active { background: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-active-opacity); }
143
- }
144
- &__ticks {
145
- position: absolute; inset: 0; color: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-tick-opacity);
146
- background-image: radial-gradient(circle at center, currentColor 2px, transparent 2px);
147
- background-repeat: repeat-x;
148
- &--active { color: var(--#{base.$prefix}-slider-tick-color); opacity: var(--#{base.$prefix}-slider-active-tick-opacity); }
149
- }
150
- // Inset icon: on the active track it takes the colour of the ticks there
151
- // (secondaryContainer), on the inactive track the colour of the ticks there (the
152
- // slider colour), as Compose's SliderWithTrackIconsSample tints it.
153
- &__inset-icon {
154
- position: absolute; top: 50%; transform: translateY(-50%);
155
- display: flex; align-items: center; justify-content: center;
156
- color: var(--#{base.$prefix}-slider-tick-color); opacity: var(--#{base.$prefix}-slider-active-tick-opacity);
157
- svg { width: 100%; height: 100%; fill: currentColor; }
158
- &--inactive { color: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-tick-opacity); }
159
- }
160
- // Stop indicator: 4dp in the active track colour, centred one corner radius from the
161
- // end. withTracks sets `right` per size.
162
- &__dot { position: absolute; top: calc(50% - 2px); width: 4px; height: 4px;
163
- border-radius: 50%; background: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-active-opacity); }
164
-
165
- // Handle - updated with T-shape and proper focus styles
166
- &__handle {
167
- position: absolute;
168
- top: 50%;
169
- transform: translate(-50%, -50%);
170
- cursor: pointer;
171
- z-index: 4;
172
- width: 14px;
173
- height: 50px;
174
- border-radius: 16px;
175
- background-color: rgba(red, .0);
176
-
177
- // Focus is shown the Compose way: the handle narrows (FocusHandleWidth, below) and
178
- // the value indicator appears. No outline ring.
179
- &:focus {
180
- outline: none;
181
- }
182
-
183
- // Create a T-shaped handle using pseudo-elements
184
- &::before {
185
- content: '';
186
- position: absolute;
187
- width: 4px;
188
- height: 100%;
189
- // --#{base.$prefix}-slider-color: the same per-slider override the canvas honours
190
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
191
- border-radius: v.shape('full'); // SliderTokens handle-shape
192
- left: 50%;
193
- top: 50%;
194
- transform: translate(-50%, -50%);
195
-
196
- .#{$component}--secondary & {
197
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
198
- }
199
-
200
- .#{$component}--tertiary & {
201
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
202
- }
203
-
204
- .#{$component}--error & {
205
- background-color: t.color('error');
206
- }
207
- }
208
-
209
- // Disabled pointer events on the pseudo-element
210
- &::before {
211
- pointer-events: none;
212
- }
213
-
214
- // PressedHandleWidth and FocusHandleWidth: 2dp, half the resting 4dp.
215
- .#{$component}--dragging &::before,
216
- &:active::before,
217
- &:focus-visible::before,
218
- &--focused::before {
219
- width: 2px;
220
- }
221
-
222
- // Hover state
223
- &:hover::before {
224
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
225
-
226
- .#{$component}--secondary & {
227
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
228
- }
229
-
230
- .#{$component}--tertiary & {
231
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
232
- }
233
-
234
- .#{$component}--error & {
235
- background-color: t.color('error');
236
- }
237
-
238
- .#{$component}--disabled & {
239
- background-color: t.color('on-surface');
240
- opacity: 0.38;
241
- }
242
- }
243
-
244
- // Active state
245
- &:active::before {
246
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
247
-
248
- .#{$component}--secondary & {
249
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
250
- }
251
-
252
- .#{$component}--tertiary & {
253
- background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
254
- }
255
-
256
- .#{$component}--error & {
257
- background-color: t.color('error');
258
- }
259
- }
260
- }
261
-
262
- // Range slider styles
263
- &--range {
264
- .#{$component}__handle {
265
- &:nth-of-type(1) {
266
- z-index: 3;
267
- }
268
- }
269
-
270
- // In range mode, both dots should be visible
271
- .#{$component}__dot {
272
- z-index: 2;
273
- }
274
- }
275
-
276
- // Value indicator: inverseSurface / inverseOnSurface, LabelLarge, 48 x 44dp, its
277
- // bottom 12dp above the handle's top (ValueIndicatorActiveBottomSpace). The handle
278
- // is centred in the container, so that is half the container plus half the handle
279
- // plus 12. The handle height is per size; withTracks publishes it.
280
- &__value {
281
- position: absolute;
282
- bottom: calc(50% + var(--#{base.$prefix}-slider-handle-height, 44px) / 2 + 12px);
283
- left: 0;
284
- box-sizing: border-box;
285
- min-width: 48px;
286
- height: 44px;
287
- padding: 0 16px;
288
- display: flex;
289
- align-items: center;
290
- justify-content: center;
291
- background-color: t.color('inverse-surface');
292
- color: t.color('inverse-on-surface');
293
- border-radius: v.shape('full'); // the value indicator: a pill
294
- @include m.typography('label-large');
295
- white-space: nowrap;
296
- transform: translateX(-50%);
297
- transform-origin: 50% 100%;
298
- scale: 0;
299
- visibility: hidden;
300
- opacity: 0;
301
- transition: $bubble-transition;
302
- pointer-events: none;
303
-
304
- // Show value when interacting
305
- &--visible {
306
- visibility: visible;
307
- opacity: 1;
308
- scale: 1;
309
- transition: $bubble-transition-visible;
310
- }
311
- }
312
-
313
- // Positions are written to left (right in RTL), or to bottom or top on a vertical
314
- // slider; lengths to width or height.
315
- $settle-position: m.spring(left, default-spatial), m.spring(right, default-spatial), m.spring(bottom, default-spatial), m.spring(top, default-spatial);
316
- $settle-length: m.spring(width, default-spatial), m.spring(height, default-spatial);
317
- &--settling {
318
- .#{$component}__handle, .#{$component}__inset-icon { transition: $settle-position; }
319
- .#{$component}__segment { transition: $settle-position, $settle-length; }
320
- .#{$component}__value { transition: $settle-position, $bubble-transition; }
321
- .#{$component}__value--visible { transition: $settle-position, $bubble-transition-visible; }
322
- }
323
-
324
- // Vertical: the same parts turned a quarter. withTracks and the
325
- // controller write positions along the axis -- to bottom, or to top with
326
- // topToBottom -- and thicknesses across it; the length is the slider's height.
327
- &--vertical {
328
- width: auto;
329
- height: 100%;
330
- align-items: center;
331
-
332
- .#{$component}__container { height: 100%; min-height: 120px; }
333
- .#{$component}__track { top: 0; left: 50%; width: auto; height: 100%; transform: translateX(-50%); }
334
- .#{$component}__segment { width: 100%; }
335
- .#{$component}__ticks { background-repeat: repeat-y; }
336
- .#{$component}__dot { top: auto; left: calc(50% - 2px); }
337
- .#{$component}__inset-icon { top: auto; left: 50%; transform: translateX(-50%); }
338
- .#{$component}__handle {
339
- top: auto;
340
- left: 50%;
341
- height: 14px;
342
- &::before { width: 100%; height: 4px; }
343
- }
344
- &.#{$component}--dragging .#{$component}__handle::before,
345
- .#{$component}__handle:active::before,
346
- .#{$component}__handle:focus-visible::before,
347
- .#{$component}__handle--focused::before {
348
- width: 100%;
349
- height: 2px;
350
- }
351
- // The value indicator sits beside the handle, on its start side.
352
- .#{$component}__value {
353
- left: auto;
354
- bottom: auto;
355
- right: calc(50% + var(--#{base.$prefix}-slider-handle-height, 44px) / 2 + 12px);
356
- transform-origin: 100% 50%;
357
- }
358
- }
359
-
360
- &--disabled {
361
-
362
- // Disabled state
363
- .#{$component}__handle {
364
- cursor: default;
365
- pointer-events: none;
366
-
367
- &::before {
368
- opacity: 0.38;
369
- background-color: t.color('on-surface');
370
- }
371
- }
372
- }
373
-
374
- // Discrete slider with steps
375
- &--discrete {
376
- .#{$component}__tick {
377
- width: 4px;
378
- height: 4px;
379
- }
380
- }
381
-
15
+ position: relative;
16
+ width: 100%;
17
+ display: flex;
18
+ flex-direction: column;
19
+ user-select: none;
20
+ touch-action: none;
21
+
22
+ --#{base.$prefix}-slider-track-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
23
+ --#{base.$prefix}-slider-inactive-track-color: var(--#{base.$prefix}-slider-container-color, #{t.color('secondary-container')});
24
+ --#{base.$prefix}-slider-tick-color: var(--#{base.$prefix}-slider-on-color, var(--#{base.$prefix}-slider-inactive-track-color));
25
+ --#{base.$prefix}-slider-active-opacity: 1;
26
+ --#{base.$prefix}-slider-inactive-opacity: 1;
27
+ --#{base.$prefix}-slider-tick-opacity: 1;
28
+ --#{base.$prefix}-slider-active-tick-opacity: 1;
29
+
30
+ &:focus {
31
+ outline: none;
32
+ }
33
+
34
+ &__label {
35
+ display: block;
36
+ @include m.typography('body-large');
37
+ color: t.color('on-surface');
38
+ margin-bottom: 4px;
39
+ &--end { margin-bottom: 0; margin-top: 4px; }
40
+ }
41
+
42
+ &__icon {
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ color: t.color('on-surface-variant');
47
+ width: 40px;
48
+ height: 40px;
49
+
50
+ svg {
51
+ width: 24px;
52
+ height: 24px;
53
+ }
54
+ }
55
+
56
+ &--icon {
57
+ display: grid;
58
+ grid-template-columns: 40px minmax(0, 1fr);
59
+ grid-template-areas: ". label" "icon track";
60
+ column-gap: 8px;
61
+ align-items: center;
62
+ .#{$component}__label { grid-area: label; }
63
+ .#{$component}__container { grid-area: track; }
64
+ .#{$component}__icon { grid-area: icon; }
65
+ }
66
+ &--icon.#{$component}--label-end { grid-template-areas: "icon track" ". label"; }
67
+ &--icon-end {
68
+ grid-template-columns: minmax(0, 1fr) 40px;
69
+ grid-template-areas: "label ." "track icon";
70
+ }
71
+ &--icon-end.#{$component}--label-end { grid-template-areas: "track icon" "label ."; }
72
+
73
+ &__container {
74
+ position: relative;
75
+ height: 40px;
76
+ display: flex;
77
+ align-items: center;
78
+ }
79
+
80
+ @each $color in (secondary, tertiary, error) {
81
+ &--#{$color} {
82
+ --#{base.$prefix}-slider-track-color: var(--#{base.$prefix}-slider-color, #{t.color($color)});
83
+ --#{base.$prefix}-slider-inactive-track-color: var(--#{base.$prefix}-slider-container-color, #{t.color($color + '-container')});
84
+ }
85
+ }
86
+ &--disabled {
87
+ --#{base.$prefix}-slider-track-color: #{t.color('on-surface')};
88
+ --#{base.$prefix}-slider-inactive-track-color: #{t.color('on-surface')};
89
+ --#{base.$prefix}-slider-tick-color: #{t.color('on-surface')};
90
+ --#{base.$prefix}-slider-active-opacity: 0.38;
91
+ --#{base.$prefix}-slider-inactive-opacity: 0.12;
92
+ --#{base.$prefix}-slider-tick-opacity: 0.38;
93
+ --#{base.$prefix}-slider-active-tick-opacity: 0.12;
94
+ }
95
+ &__visual { position: absolute; inset: 0; pointer-events: none; container-type: size; }
96
+ &__track { position: absolute; top: 50%; width: 100%; transform: translateY(-50%); }
97
+ &__segment {
98
+ position: absolute; height: 100%; border-radius: 2px;
99
+ background: var(--#{base.$prefix}-slider-inactive-track-color); opacity: var(--#{base.$prefix}-slider-inactive-opacity);
100
+ &--active { background: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-active-opacity); }
101
+ }
102
+ &__ticks {
103
+ position: absolute; inset: 0; color: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-tick-opacity);
104
+ background-image: radial-gradient(circle at center, currentColor 2px, transparent 2px);
105
+ background-repeat: repeat-x;
106
+ &--active { color: var(--#{base.$prefix}-slider-tick-color); opacity: var(--#{base.$prefix}-slider-active-tick-opacity); }
107
+ }
108
+ &__inset-icon {
109
+ position: absolute; top: 50%; transform: translateY(-50%);
110
+ display: flex; align-items: center; justify-content: center;
111
+ color: var(--#{base.$prefix}-slider-tick-color); opacity: var(--#{base.$prefix}-slider-active-tick-opacity);
112
+ svg { width: 100%; height: 100%; fill: currentColor; }
113
+ &--inactive { color: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-tick-opacity); }
114
+ }
115
+ &__dot { position: absolute; top: calc(50% - 2px); width: 4px; height: 4px;
116
+ border-radius: 50%; background: var(--#{base.$prefix}-slider-track-color); opacity: var(--#{base.$prefix}-slider-active-opacity); }
117
+
118
+ &__handle {
119
+ position: absolute;
120
+ top: 50%;
121
+ transform: translate(-50%, -50%);
122
+ cursor: pointer;
123
+ z-index: 4;
124
+ width: 14px;
125
+ height: 50px;
126
+ border-radius: 16px;
127
+ background-color: rgba(red, .0);
128
+
129
+ &:focus {
130
+ outline: none;
131
+ }
132
+
133
+ &::before {
134
+ content: '';
135
+ position: absolute;
136
+ width: 4px;
137
+ height: 100%;
138
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
139
+ border-radius: v.shape('full');
140
+ left: 50%;
141
+ top: 50%;
142
+ transform: translate(-50%, -50%);
143
+
144
+ .#{$component}--secondary & {
145
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
146
+ }
147
+
148
+ .#{$component}--tertiary & {
149
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
150
+ }
151
+
152
+ .#{$component}--error & {
153
+ background-color: t.color('error');
154
+ }
155
+ }
156
+
157
+ &::before {
158
+ pointer-events: none;
159
+ }
160
+
161
+ .#{$component}--dragging &::before,
162
+ &:active::before,
163
+ &:focus-visible::before,
164
+ &--focused::before {
165
+ width: 2px;
166
+ }
167
+
168
+ &:hover::before {
169
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
170
+
171
+ .#{$component}--secondary & {
172
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
173
+ }
174
+
175
+ .#{$component}--tertiary & {
176
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
177
+ }
178
+
179
+ .#{$component}--error & {
180
+ background-color: t.color('error');
181
+ }
182
+
183
+ .#{$component}--disabled & {
184
+ background-color: t.color('on-surface');
185
+ opacity: 0.38;
186
+ }
187
+ }
188
+
189
+ &:active::before {
190
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('primary')});
191
+
192
+ .#{$component}--secondary & {
193
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('secondary')});
194
+ }
195
+
196
+ .#{$component}--tertiary & {
197
+ background-color: var(--#{base.$prefix}-slider-color, #{t.color('tertiary')});
198
+ }
199
+
200
+ .#{$component}--error & {
201
+ background-color: t.color('error');
202
+ }
203
+ }
204
+ }
205
+
206
+ &--range {
207
+ .#{$component}__handle {
208
+ &:nth-of-type(1) {
209
+ z-index: 3;
210
+ }
211
+ }
212
+
213
+ .#{$component}__dot {
214
+ z-index: 2;
215
+ }
216
+ }
217
+
218
+ &__value {
219
+ position: absolute;
220
+ bottom: calc(50% + var(--#{base.$prefix}-slider-handle-height, 44px) / 2 + 12px);
221
+ left: 0;
222
+ box-sizing: border-box;
223
+ min-width: 48px;
224
+ height: 44px;
225
+ padding: 0 16px;
226
+ display: flex;
227
+ align-items: center;
228
+ justify-content: center;
229
+ background-color: t.color('inverse-surface');
230
+ color: t.color('inverse-on-surface');
231
+ border-radius: v.shape('full');
232
+ @include m.typography('label-large');
233
+ white-space: nowrap;
234
+ transform: translateX(-50%);
235
+ transform-origin: 50% 100%;
236
+ scale: 0;
237
+ visibility: hidden;
238
+ opacity: 0;
239
+ transition: $bubble-transition;
240
+ pointer-events: none;
241
+
242
+ &--visible {
243
+ visibility: visible;
244
+ opacity: 1;
245
+ scale: 1;
246
+ transition: $bubble-transition-visible;
247
+ }
248
+ }
249
+
250
+ $settle-position: m.spring(left, default-spatial), m.spring(right, default-spatial), m.spring(bottom, default-spatial), m.spring(top, default-spatial);
251
+ $settle-length: m.spring(width, default-spatial), m.spring(height, default-spatial);
252
+ &--settling {
253
+ .#{$component}__handle, .#{$component}__inset-icon { transition: $settle-position; }
254
+ .#{$component}__segment { transition: $settle-position, $settle-length; }
255
+ .#{$component}__value { transition: $settle-position, $bubble-transition; }
256
+ .#{$component}__value--visible { transition: $settle-position, $bubble-transition-visible; }
257
+ }
258
+
259
+ &--vertical {
260
+ width: auto;
261
+ height: 100%;
262
+ align-items: center;
263
+
264
+ .#{$component}__container { height: 100%; min-height: 120px; }
265
+ .#{$component}__track { top: 0; left: 50%; width: auto; height: 100%; transform: translateX(-50%); }
266
+ .#{$component}__segment { width: 100%; }
267
+ .#{$component}__ticks { background-repeat: repeat-y; }
268
+ .#{$component}__dot { top: auto; left: calc(50% - 2px); }
269
+ .#{$component}__inset-icon { top: auto; left: 50%; transform: translateX(-50%); }
270
+ .#{$component}__handle {
271
+ top: auto;
272
+ left: 50%;
273
+ height: 14px;
274
+ &::before { width: 100%; height: 4px; }
275
+ }
276
+ &.#{$component}--dragging .#{$component}__handle::before,
277
+ .#{$component}__handle:active::before,
278
+ .#{$component}__handle:focus-visible::before,
279
+ .#{$component}__handle--focused::before {
280
+ width: 100%;
281
+ height: 2px;
282
+ }
283
+ .#{$component}__value {
284
+ left: auto;
285
+ bottom: auto;
286
+ right: calc(50% + var(--#{base.$prefix}-slider-handle-height, 44px) / 2 + 12px);
287
+ transform-origin: 100% 50%;
288
+ }
289
+ }
290
+
291
+ &--disabled {
292
+
293
+ .#{$component}__handle {
294
+ cursor: default;
295
+ pointer-events: none;
296
+
297
+ &::before {
298
+ opacity: 0.38;
299
+ background-color: t.color('on-surface');
300
+ }
301
+ }
302
+ }
303
+
382
304
  }