material 3.7.1 → 3.7.3

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 (276) hide show
  1. package/README.md +2 -2
  2. package/dist/components/slider/features/controller.js +24 -8
  3. package/dist/elements/css/bottom-app-bar.css +1 -1
  4. package/dist/elements/css/bottom-app-bar.js +1 -1
  5. package/dist/elements/css/card.css +1 -1
  6. package/dist/elements/css/card.js +1 -1
  7. package/dist/elements/css/checkbox.css +1 -1
  8. package/dist/elements/css/checkbox.js +1 -1
  9. package/dist/elements/css/datepicker.css +1 -1
  10. package/dist/elements/css/datepicker.js +1 -1
  11. package/dist/elements/css/dialog.css +1 -1
  12. package/dist/elements/css/dialog.js +1 -1
  13. package/dist/elements/css/menu.css +1 -1
  14. package/dist/elements/css/menu.js +1 -1
  15. package/dist/elements/css/radios.css +1 -1
  16. package/dist/elements/css/radios.js +1 -1
  17. package/dist/elements/css/select.css +1 -1
  18. package/dist/elements/css/select.js +1 -1
  19. package/dist/elements/css/slider.css +1 -1
  20. package/dist/elements/css/slider.js +1 -1
  21. package/dist/elements/css/tabs.css +1 -1
  22. package/dist/elements/css/tabs.js +1 -1
  23. package/dist/elements/css/text-field.css +1 -1
  24. package/dist/elements/css/text-field.js +1 -1
  25. package/dist/elements/css/timepicker.css +1 -1
  26. package/dist/elements/css/timepicker.js +1 -1
  27. package/dist/elements/css/top-app-bar.css +1 -1
  28. package/dist/elements/css/top-app-bar.js +1 -1
  29. package/dist/elements/preupgrade/badge.css +1 -1
  30. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  31. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  32. package/dist/elements/preupgrade/button-group.css +1 -1
  33. package/dist/elements/preupgrade/button.css +1 -1
  34. package/dist/elements/preupgrade/card.css +1 -1
  35. package/dist/elements/preupgrade/carousel.css +1 -1
  36. package/dist/elements/preupgrade/checkbox.css +1 -1
  37. package/dist/elements/preupgrade/chips.css +1 -1
  38. package/dist/elements/preupgrade/datepicker.css +1 -1
  39. package/dist/elements/preupgrade/dialog.css +1 -1
  40. package/dist/elements/preupgrade/divider.css +1 -1
  41. package/dist/elements/preupgrade/drawer.css +1 -1
  42. package/dist/elements/preupgrade/extended-fab.css +1 -1
  43. package/dist/elements/preupgrade/fab-menu.css +1 -1
  44. package/dist/elements/preupgrade/fab.css +1 -1
  45. package/dist/elements/preupgrade/icon-button.css +1 -1
  46. package/dist/elements/preupgrade/list.css +1 -1
  47. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  48. package/dist/elements/preupgrade/menu.css +1 -1
  49. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  50. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  51. package/dist/elements/preupgrade/progress.css +1 -1
  52. package/dist/elements/preupgrade/radios.css +1 -1
  53. package/dist/elements/preupgrade/search.css +1 -1
  54. package/dist/elements/preupgrade/select.css +1 -1
  55. package/dist/elements/preupgrade/side-sheet.css +1 -1
  56. package/dist/elements/preupgrade/slider.css +1 -1
  57. package/dist/elements/preupgrade/snackbar.css +1 -1
  58. package/dist/elements/preupgrade/split-button.css +1 -1
  59. package/dist/elements/preupgrade/switch.css +1 -1
  60. package/dist/elements/preupgrade/tabs.css +1 -1
  61. package/dist/elements/preupgrade/text-field.css +1 -1
  62. package/dist/elements/preupgrade/timepicker.css +1 -1
  63. package/dist/elements/preupgrade/toolbar.css +1 -1
  64. package/dist/elements/preupgrade/tooltip.css +1 -1
  65. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  66. package/dist/elements/preupgrade.css +1 -1
  67. package/dist/styles/badge.css +1 -1
  68. package/dist/styles/base-lite.css +1 -1
  69. package/dist/styles/base.css +1 -1
  70. package/dist/styles/bottom-app-bar.css +2 -2
  71. package/dist/styles/bottom-sheet.css +1 -1
  72. package/dist/styles/button-group.css +1 -1
  73. package/dist/styles/button.css +1 -1
  74. package/dist/styles/card.css +2 -2
  75. package/dist/styles/carousel.css +1 -1
  76. package/dist/styles/checkbox.css +2 -2
  77. package/dist/styles/chips.css +1 -1
  78. package/dist/styles/contrast.css +1 -1
  79. package/dist/styles/datepicker.css +2 -2
  80. package/dist/styles/dialog.css +2 -2
  81. package/dist/styles/divider.css +1 -1
  82. package/dist/styles/drawer.css +1 -1
  83. package/dist/styles/extended-fab.css +1 -1
  84. package/dist/styles/fab-menu.css +1 -1
  85. package/dist/styles/fab.css +1 -1
  86. package/dist/styles/icon-button.css +1 -1
  87. package/dist/styles/list.css +1 -1
  88. package/dist/styles/loading-indicator.css +1 -1
  89. package/dist/styles/menu.css +2 -2
  90. package/dist/styles/navigation-bar.css +1 -1
  91. package/dist/styles/navigation-rail.css +1 -1
  92. package/dist/styles/progress.css +1 -1
  93. package/dist/styles/radios.css +2 -2
  94. package/dist/styles/search.css +1 -1
  95. package/dist/styles/select.css +2 -2
  96. package/dist/styles/side-sheet.css +1 -1
  97. package/dist/styles/slider.css +2 -2
  98. package/dist/styles/snackbar.css +1 -1
  99. package/dist/styles/split-button.css +1 -1
  100. package/dist/styles/switch.css +1 -1
  101. package/dist/styles/tabs.css +2 -2
  102. package/dist/styles/text-field.css +2 -2
  103. package/dist/styles/timepicker.css +2 -2
  104. package/dist/styles/toolbar.css +1 -1
  105. package/dist/styles/tooltip.css +1 -1
  106. package/dist/styles/top-app-bar.css +2 -2
  107. package/dist/styles/typography.css +1 -1
  108. package/dist/styles/utilities.css +1 -1
  109. package/dist/styles.css +2 -2
  110. package/dist/themes/autumn-contrast.css +1 -1
  111. package/dist/themes/autumn.css +1 -1
  112. package/dist/themes/baseline-contrast.css +1 -1
  113. package/dist/themes/baseline.css +1 -1
  114. package/dist/themes/brownbeige-contrast.css +1 -1
  115. package/dist/themes/brownbeige.css +1 -1
  116. package/dist/themes/content-contrast.css +1 -1
  117. package/dist/themes/content.css +1 -1
  118. package/dist/themes/desert-contrast.css +1 -1
  119. package/dist/themes/desert.css +1 -1
  120. package/dist/themes/expressive-contrast.css +1 -1
  121. package/dist/themes/expressive.css +1 -1
  122. package/dist/themes/fidelity-contrast.css +1 -1
  123. package/dist/themes/fidelity.css +1 -1
  124. package/dist/themes/forest-contrast.css +1 -1
  125. package/dist/themes/forest.css +1 -1
  126. package/dist/themes/fruit-salad-contrast.css +1 -1
  127. package/dist/themes/fruit-salad.css +1 -1
  128. package/dist/themes/highcontrast-contrast.css +1 -1
  129. package/dist/themes/highcontrast.css +1 -1
  130. package/dist/themes/monochrome-contrast.css +1 -1
  131. package/dist/themes/monochrome.css +1 -1
  132. package/dist/themes/neutral-contrast.css +1 -1
  133. package/dist/themes/neutral.css +1 -1
  134. package/dist/themes/ocean-contrast.css +1 -1
  135. package/dist/themes/ocean.css +1 -1
  136. package/dist/themes/rainbow-contrast.css +1 -1
  137. package/dist/themes/rainbow.css +1 -1
  138. package/dist/themes/sageivory-contrast.css +1 -1
  139. package/dist/themes/sageivory.css +1 -1
  140. package/dist/themes/spring-contrast.css +1 -1
  141. package/dist/themes/spring.css +1 -1
  142. package/dist/themes/summer-contrast.css +1 -1
  143. package/dist/themes/summer.css +1 -1
  144. package/dist/themes/sunset-contrast.css +1 -1
  145. package/dist/themes/sunset.css +1 -1
  146. package/dist/themes/tealcaramel-contrast.css +1 -1
  147. package/dist/themes/tealcaramel.css +1 -1
  148. package/dist/themes/vibrant-contrast.css +1 -1
  149. package/dist/themes/vibrant.css +1 -1
  150. package/package.json +2 -1
  151. package/src/styles/abstract/_base.scss +0 -1
  152. package/src/styles/abstract/_direction.scss +121 -152
  153. package/src/styles/abstract/_emit.scss +7 -16
  154. package/src/styles/abstract/_floating-placement.scss +9 -10
  155. package/src/styles/abstract/_functions.scss +64 -79
  156. package/src/styles/abstract/_mixins.scss +355 -459
  157. package/src/styles/abstract/_theme.scss +122 -136
  158. package/src/styles/abstract/_variables.scss +320 -390
  159. package/src/styles/abstract/chips/_assist.scss +2 -3
  160. package/src/styles/abstract/chips/_filter.scss +2 -3
  161. package/src/styles/abstract/chips/_input.scss +2 -3
  162. package/src/styles/abstract/chips/_suggestion.scss +2 -3
  163. package/src/styles/base/_body-theme.scss +10 -15
  164. package/src/styles/base/_document.scss +10 -33
  165. package/src/styles/base/_reset.scss +20 -40
  166. package/src/styles/base/_tokens.scss +6 -21
  167. package/src/styles/base/_typescale-tokens.scss +12 -16
  168. package/src/styles/base/_typography.scss +28 -37
  169. package/src/styles/components/_badge.scss +171 -193
  170. package/src/styles/components/_bottom-app-bar.scss +72 -88
  171. package/src/styles/components/_bottom-sheet.scss +188 -232
  172. package/src/styles/components/_button-group.scss +140 -189
  173. package/src/styles/components/_button.scss +382 -478
  174. package/src/styles/components/_card.scss +349 -473
  175. package/src/styles/components/_carousel.scss +134 -156
  176. package/src/styles/components/_checkbox.scss +208 -247
  177. package/src/styles/components/_chips.scss +239 -304
  178. package/src/styles/components/_datepicker.scss +172 -220
  179. package/src/styles/components/_dialog.scss +428 -553
  180. package/src/styles/components/_divider.scss +37 -46
  181. package/src/styles/components/_drawer.scss +571 -678
  182. package/src/styles/components/_extended-fab.scss +263 -294
  183. package/src/styles/components/_fab-menu.scss +225 -267
  184. package/src/styles/components/_fab.scss +197 -218
  185. package/src/styles/components/_icon-button.scss +483 -588
  186. package/src/styles/components/_list.scss +115 -144
  187. package/src/styles/components/_loading-indicator.scss +23 -29
  188. package/src/styles/components/_menu.scss +543 -699
  189. package/src/styles/components/_navigation-bar.scss +189 -234
  190. package/src/styles/components/_navigation-rail.scss +256 -312
  191. package/src/styles/components/_progress.scss +60 -85
  192. package/src/styles/components/_radios.scss +170 -205
  193. package/src/styles/components/_search.scss +369 -455
  194. package/src/styles/components/_select.scss +78 -185
  195. package/src/styles/components/_side-sheet.scss +234 -292
  196. package/src/styles/components/_slider.scss +289 -367
  197. package/src/styles/components/_snackbar.scss +149 -198
  198. package/src/styles/components/_split-button.scss +139 -228
  199. package/src/styles/components/_switch.scss +282 -349
  200. package/src/styles/components/_tabs.scss +350 -547
  201. package/src/styles/components/_text-field.scss +788 -978
  202. package/src/styles/components/_timepicker.scss +435 -506
  203. package/src/styles/components/_toolbar.scss +178 -242
  204. package/src/styles/components/_tooltip.scss +152 -197
  205. package/src/styles/components/_top-app-bar.scss +206 -224
  206. package/src/styles/elements/_badge.scss +42 -61
  207. package/src/styles/elements/_bottom-app-bar.scss +14 -20
  208. package/src/styles/elements/_bottom-sheet.scss +0 -3
  209. package/src/styles/elements/_button-group.scss +80 -80
  210. package/src/styles/elements/_button.scss +72 -88
  211. package/src/styles/elements/_card.scss +48 -57
  212. package/src/styles/elements/_carousel.scss +2 -5
  213. package/src/styles/elements/_checkbox.scss +32 -43
  214. package/src/styles/elements/_chips.scss +18 -22
  215. package/src/styles/elements/_config.scss +11 -26
  216. package/src/styles/elements/_datepicker.scss +17 -22
  217. package/src/styles/elements/_dialog.scss +0 -3
  218. package/src/styles/elements/_divider.scss +11 -13
  219. package/src/styles/elements/_drawer.scss +9 -14
  220. package/src/styles/elements/_extended-fab.scss +36 -40
  221. package/src/styles/elements/_fab-menu.scss +21 -25
  222. package/src/styles/elements/_fab.scss +17 -20
  223. package/src/styles/elements/_field.scss +93 -114
  224. package/src/styles/elements/_icon-button.scss +34 -38
  225. package/src/styles/elements/_index.scss +0 -4
  226. package/src/styles/elements/_list.scss +19 -26
  227. package/src/styles/elements/_loading-indicator.scss +6 -9
  228. package/src/styles/elements/_menu.scss +0 -3
  229. package/src/styles/elements/_navigation-bar.scss +5 -9
  230. package/src/styles/elements/_navigation-rail.scss +10 -15
  231. package/src/styles/elements/_progress.scss +15 -18
  232. package/src/styles/elements/_radios.scss +24 -49
  233. package/src/styles/elements/_search.scss +19 -24
  234. package/src/styles/elements/_select.scss +4 -9
  235. package/src/styles/elements/_side-sheet.scss +0 -3
  236. package/src/styles/elements/_slider.scss +15 -35
  237. package/src/styles/elements/_snackbar.scss +0 -3
  238. package/src/styles/elements/_split-button.scss +33 -39
  239. package/src/styles/elements/_switch.scss +50 -90
  240. package/src/styles/elements/_tabs.scss +9 -13
  241. package/src/styles/elements/_text-field.scss +150 -178
  242. package/src/styles/elements/_timepicker.scss +0 -3
  243. package/src/styles/elements/_toolbar.scss +30 -35
  244. package/src/styles/elements/_tooltip.scss +0 -3
  245. package/src/styles/elements/_top-app-bar.scss +38 -45
  246. package/src/styles/main.scss +0 -15
  247. package/src/styles/themes/_autumn.scss +240 -258
  248. package/src/styles/themes/_base-theme.scss +96 -128
  249. package/src/styles/themes/_baseline.scss +273 -314
  250. package/src/styles/themes/_brownbeige.scss +242 -250
  251. package/src/styles/themes/_content.scss +240 -248
  252. package/src/styles/themes/_desert.scss +242 -250
  253. package/src/styles/themes/_expressive.scss +242 -250
  254. package/src/styles/themes/_fidelity.scss +240 -248
  255. package/src/styles/themes/_forest.scss +242 -259
  256. package/src/styles/themes/_fruit-salad.scss +242 -250
  257. package/src/styles/themes/_highcontrast.scss +164 -172
  258. package/src/styles/themes/_index.scss +0 -1
  259. package/src/styles/themes/_monochrome.scss +226 -234
  260. package/src/styles/themes/_neutral.scss +242 -250
  261. package/src/styles/themes/_ocean.scss +242 -259
  262. package/src/styles/themes/_rainbow.scss +242 -250
  263. package/src/styles/themes/_sageivory.scss +242 -250
  264. package/src/styles/themes/_spring.scss +238 -255
  265. package/src/styles/themes/_summer.scss +242 -250
  266. package/src/styles/themes/_sunset.scss +242 -259
  267. package/src/styles/themes/_tealcaramel.scss +242 -250
  268. package/src/styles/themes/_vibrant.scss +242 -250
  269. package/src/styles/utilities/_colors.scss +44 -50
  270. package/src/styles/utilities/_flexbox.scss +48 -59
  271. package/src/styles/utilities/_layout.scss +516 -591
  272. package/src/styles/utilities/_ripple.scss +61 -70
  273. package/src/styles/utilities/_spacing.scss +120 -127
  274. package/src/styles/utilities/_typography.scss +45 -58
  275. package/src/styles/utilities/_visibility.scss +61 -76
  276. 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
  }