material 3.7.2 → 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 (264) hide show
  1. package/README.md +2 -2
  2. package/dist/components/slider/features/controller.js +24 -8
  3. package/dist/elements/css/card.css +1 -1
  4. package/dist/elements/css/card.js +1 -1
  5. package/dist/elements/css/dialog.css +1 -1
  6. package/dist/elements/css/dialog.js +1 -1
  7. package/dist/elements/css/menu.css +1 -1
  8. package/dist/elements/css/menu.js +1 -1
  9. package/dist/elements/css/select.css +1 -1
  10. package/dist/elements/css/select.js +1 -1
  11. package/dist/elements/css/slider.css +1 -1
  12. package/dist/elements/css/slider.js +1 -1
  13. package/dist/elements/css/tabs.css +1 -1
  14. package/dist/elements/css/tabs.js +1 -1
  15. package/dist/elements/css/timepicker.css +1 -1
  16. package/dist/elements/css/timepicker.js +1 -1
  17. package/dist/elements/preupgrade/badge.css +1 -1
  18. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  19. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  20. package/dist/elements/preupgrade/button-group.css +1 -1
  21. package/dist/elements/preupgrade/button.css +1 -1
  22. package/dist/elements/preupgrade/card.css +1 -1
  23. package/dist/elements/preupgrade/carousel.css +1 -1
  24. package/dist/elements/preupgrade/checkbox.css +1 -1
  25. package/dist/elements/preupgrade/chips.css +1 -1
  26. package/dist/elements/preupgrade/datepicker.css +1 -1
  27. package/dist/elements/preupgrade/dialog.css +1 -1
  28. package/dist/elements/preupgrade/divider.css +1 -1
  29. package/dist/elements/preupgrade/drawer.css +1 -1
  30. package/dist/elements/preupgrade/extended-fab.css +1 -1
  31. package/dist/elements/preupgrade/fab-menu.css +1 -1
  32. package/dist/elements/preupgrade/fab.css +1 -1
  33. package/dist/elements/preupgrade/icon-button.css +1 -1
  34. package/dist/elements/preupgrade/list.css +1 -1
  35. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  36. package/dist/elements/preupgrade/menu.css +1 -1
  37. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  38. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  39. package/dist/elements/preupgrade/progress.css +1 -1
  40. package/dist/elements/preupgrade/radios.css +1 -1
  41. package/dist/elements/preupgrade/search.css +1 -1
  42. package/dist/elements/preupgrade/select.css +1 -1
  43. package/dist/elements/preupgrade/side-sheet.css +1 -1
  44. package/dist/elements/preupgrade/slider.css +1 -1
  45. package/dist/elements/preupgrade/snackbar.css +1 -1
  46. package/dist/elements/preupgrade/split-button.css +1 -1
  47. package/dist/elements/preupgrade/switch.css +1 -1
  48. package/dist/elements/preupgrade/tabs.css +1 -1
  49. package/dist/elements/preupgrade/text-field.css +1 -1
  50. package/dist/elements/preupgrade/timepicker.css +1 -1
  51. package/dist/elements/preupgrade/toolbar.css +1 -1
  52. package/dist/elements/preupgrade/tooltip.css +1 -1
  53. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  54. package/dist/elements/preupgrade.css +1 -1
  55. package/dist/styles/badge.css +1 -1
  56. package/dist/styles/base-lite.css +1 -1
  57. package/dist/styles/base.css +1 -1
  58. package/dist/styles/bottom-app-bar.css +1 -1
  59. package/dist/styles/bottom-sheet.css +1 -1
  60. package/dist/styles/button-group.css +1 -1
  61. package/dist/styles/button.css +1 -1
  62. package/dist/styles/card.css +2 -2
  63. package/dist/styles/carousel.css +1 -1
  64. package/dist/styles/checkbox.css +1 -1
  65. package/dist/styles/chips.css +1 -1
  66. package/dist/styles/contrast.css +1 -1
  67. package/dist/styles/datepicker.css +1 -1
  68. package/dist/styles/dialog.css +2 -2
  69. package/dist/styles/divider.css +1 -1
  70. package/dist/styles/drawer.css +1 -1
  71. package/dist/styles/extended-fab.css +1 -1
  72. package/dist/styles/fab-menu.css +1 -1
  73. package/dist/styles/fab.css +1 -1
  74. package/dist/styles/icon-button.css +1 -1
  75. package/dist/styles/list.css +1 -1
  76. package/dist/styles/loading-indicator.css +1 -1
  77. package/dist/styles/menu.css +2 -2
  78. package/dist/styles/navigation-bar.css +1 -1
  79. package/dist/styles/navigation-rail.css +1 -1
  80. package/dist/styles/progress.css +1 -1
  81. package/dist/styles/radios.css +1 -1
  82. package/dist/styles/search.css +1 -1
  83. package/dist/styles/select.css +2 -2
  84. package/dist/styles/side-sheet.css +1 -1
  85. package/dist/styles/slider.css +2 -2
  86. package/dist/styles/snackbar.css +1 -1
  87. package/dist/styles/split-button.css +1 -1
  88. package/dist/styles/switch.css +1 -1
  89. package/dist/styles/tabs.css +2 -2
  90. package/dist/styles/text-field.css +1 -1
  91. package/dist/styles/timepicker.css +2 -2
  92. package/dist/styles/toolbar.css +1 -1
  93. package/dist/styles/tooltip.css +1 -1
  94. package/dist/styles/top-app-bar.css +1 -1
  95. package/dist/styles/typography.css +1 -1
  96. package/dist/styles/utilities.css +1 -1
  97. package/dist/styles.css +2 -2
  98. package/dist/themes/autumn-contrast.css +1 -1
  99. package/dist/themes/autumn.css +1 -1
  100. package/dist/themes/baseline-contrast.css +1 -1
  101. package/dist/themes/baseline.css +1 -1
  102. package/dist/themes/brownbeige-contrast.css +1 -1
  103. package/dist/themes/brownbeige.css +1 -1
  104. package/dist/themes/content-contrast.css +1 -1
  105. package/dist/themes/content.css +1 -1
  106. package/dist/themes/desert-contrast.css +1 -1
  107. package/dist/themes/desert.css +1 -1
  108. package/dist/themes/expressive-contrast.css +1 -1
  109. package/dist/themes/expressive.css +1 -1
  110. package/dist/themes/fidelity-contrast.css +1 -1
  111. package/dist/themes/fidelity.css +1 -1
  112. package/dist/themes/forest-contrast.css +1 -1
  113. package/dist/themes/forest.css +1 -1
  114. package/dist/themes/fruit-salad-contrast.css +1 -1
  115. package/dist/themes/fruit-salad.css +1 -1
  116. package/dist/themes/highcontrast-contrast.css +1 -1
  117. package/dist/themes/highcontrast.css +1 -1
  118. package/dist/themes/monochrome-contrast.css +1 -1
  119. package/dist/themes/monochrome.css +1 -1
  120. package/dist/themes/neutral-contrast.css +1 -1
  121. package/dist/themes/neutral.css +1 -1
  122. package/dist/themes/ocean-contrast.css +1 -1
  123. package/dist/themes/ocean.css +1 -1
  124. package/dist/themes/rainbow-contrast.css +1 -1
  125. package/dist/themes/rainbow.css +1 -1
  126. package/dist/themes/sageivory-contrast.css +1 -1
  127. package/dist/themes/sageivory.css +1 -1
  128. package/dist/themes/spring-contrast.css +1 -1
  129. package/dist/themes/spring.css +1 -1
  130. package/dist/themes/summer-contrast.css +1 -1
  131. package/dist/themes/summer.css +1 -1
  132. package/dist/themes/sunset-contrast.css +1 -1
  133. package/dist/themes/sunset.css +1 -1
  134. package/dist/themes/tealcaramel-contrast.css +1 -1
  135. package/dist/themes/tealcaramel.css +1 -1
  136. package/dist/themes/vibrant-contrast.css +1 -1
  137. package/dist/themes/vibrant.css +1 -1
  138. package/package.json +2 -1
  139. package/src/styles/abstract/_base.scss +0 -1
  140. package/src/styles/abstract/_direction.scss +121 -152
  141. package/src/styles/abstract/_emit.scss +7 -16
  142. package/src/styles/abstract/_floating-placement.scss +9 -10
  143. package/src/styles/abstract/_functions.scss +64 -79
  144. package/src/styles/abstract/_mixins.scss +355 -459
  145. package/src/styles/abstract/_theme.scss +122 -136
  146. package/src/styles/abstract/_variables.scss +320 -390
  147. package/src/styles/abstract/chips/_assist.scss +2 -3
  148. package/src/styles/abstract/chips/_filter.scss +2 -3
  149. package/src/styles/abstract/chips/_input.scss +2 -3
  150. package/src/styles/abstract/chips/_suggestion.scss +2 -3
  151. package/src/styles/base/_body-theme.scss +10 -15
  152. package/src/styles/base/_document.scss +10 -33
  153. package/src/styles/base/_reset.scss +20 -40
  154. package/src/styles/base/_tokens.scss +6 -21
  155. package/src/styles/base/_typescale-tokens.scss +12 -16
  156. package/src/styles/base/_typography.scss +28 -37
  157. package/src/styles/components/_badge.scss +171 -193
  158. package/src/styles/components/_bottom-app-bar.scss +72 -90
  159. package/src/styles/components/_bottom-sheet.scss +188 -232
  160. package/src/styles/components/_button-group.scss +140 -189
  161. package/src/styles/components/_button.scss +382 -478
  162. package/src/styles/components/_card.scss +349 -473
  163. package/src/styles/components/_carousel.scss +134 -156
  164. package/src/styles/components/_checkbox.scss +208 -249
  165. package/src/styles/components/_chips.scss +239 -304
  166. package/src/styles/components/_datepicker.scss +172 -222
  167. package/src/styles/components/_dialog.scss +428 -553
  168. package/src/styles/components/_divider.scss +37 -46
  169. package/src/styles/components/_drawer.scss +571 -678
  170. package/src/styles/components/_extended-fab.scss +263 -294
  171. package/src/styles/components/_fab-menu.scss +225 -267
  172. package/src/styles/components/_fab.scss +197 -218
  173. package/src/styles/components/_icon-button.scss +483 -588
  174. package/src/styles/components/_list.scss +115 -144
  175. package/src/styles/components/_loading-indicator.scss +23 -29
  176. package/src/styles/components/_menu.scss +543 -699
  177. package/src/styles/components/_navigation-bar.scss +189 -234
  178. package/src/styles/components/_navigation-rail.scss +256 -312
  179. package/src/styles/components/_progress.scss +60 -85
  180. package/src/styles/components/_radios.scss +170 -207
  181. package/src/styles/components/_search.scss +369 -455
  182. package/src/styles/components/_select.scss +78 -185
  183. package/src/styles/components/_side-sheet.scss +234 -292
  184. package/src/styles/components/_slider.scss +289 -367
  185. package/src/styles/components/_snackbar.scss +149 -198
  186. package/src/styles/components/_split-button.scss +139 -228
  187. package/src/styles/components/_switch.scss +282 -349
  188. package/src/styles/components/_tabs.scss +350 -547
  189. package/src/styles/components/_text-field.scss +788 -980
  190. package/src/styles/components/_timepicker.scss +435 -506
  191. package/src/styles/components/_toolbar.scss +178 -242
  192. package/src/styles/components/_tooltip.scss +152 -197
  193. package/src/styles/components/_top-app-bar.scss +206 -230
  194. package/src/styles/elements/_badge.scss +42 -61
  195. package/src/styles/elements/_bottom-app-bar.scss +14 -20
  196. package/src/styles/elements/_bottom-sheet.scss +0 -3
  197. package/src/styles/elements/_button-group.scss +80 -80
  198. package/src/styles/elements/_button.scss +72 -88
  199. package/src/styles/elements/_card.scss +48 -57
  200. package/src/styles/elements/_carousel.scss +2 -5
  201. package/src/styles/elements/_checkbox.scss +32 -43
  202. package/src/styles/elements/_chips.scss +18 -22
  203. package/src/styles/elements/_config.scss +11 -26
  204. package/src/styles/elements/_datepicker.scss +17 -22
  205. package/src/styles/elements/_dialog.scss +0 -3
  206. package/src/styles/elements/_divider.scss +11 -13
  207. package/src/styles/elements/_drawer.scss +9 -14
  208. package/src/styles/elements/_extended-fab.scss +36 -40
  209. package/src/styles/elements/_fab-menu.scss +21 -25
  210. package/src/styles/elements/_fab.scss +17 -20
  211. package/src/styles/elements/_field.scss +93 -114
  212. package/src/styles/elements/_icon-button.scss +34 -38
  213. package/src/styles/elements/_index.scss +0 -4
  214. package/src/styles/elements/_list.scss +19 -26
  215. package/src/styles/elements/_loading-indicator.scss +6 -9
  216. package/src/styles/elements/_menu.scss +0 -3
  217. package/src/styles/elements/_navigation-bar.scss +5 -9
  218. package/src/styles/elements/_navigation-rail.scss +10 -15
  219. package/src/styles/elements/_progress.scss +15 -18
  220. package/src/styles/elements/_radios.scss +24 -49
  221. package/src/styles/elements/_search.scss +19 -24
  222. package/src/styles/elements/_select.scss +4 -9
  223. package/src/styles/elements/_side-sheet.scss +0 -3
  224. package/src/styles/elements/_slider.scss +15 -35
  225. package/src/styles/elements/_snackbar.scss +0 -3
  226. package/src/styles/elements/_split-button.scss +33 -39
  227. package/src/styles/elements/_switch.scss +50 -90
  228. package/src/styles/elements/_tabs.scss +9 -13
  229. package/src/styles/elements/_text-field.scss +150 -178
  230. package/src/styles/elements/_timepicker.scss +0 -3
  231. package/src/styles/elements/_toolbar.scss +30 -35
  232. package/src/styles/elements/_tooltip.scss +0 -3
  233. package/src/styles/elements/_top-app-bar.scss +38 -45
  234. package/src/styles/main.scss +0 -15
  235. package/src/styles/themes/_autumn.scss +240 -258
  236. package/src/styles/themes/_base-theme.scss +96 -128
  237. package/src/styles/themes/_baseline.scss +273 -314
  238. package/src/styles/themes/_brownbeige.scss +242 -250
  239. package/src/styles/themes/_content.scss +240 -248
  240. package/src/styles/themes/_desert.scss +242 -250
  241. package/src/styles/themes/_expressive.scss +242 -250
  242. package/src/styles/themes/_fidelity.scss +240 -248
  243. package/src/styles/themes/_forest.scss +242 -259
  244. package/src/styles/themes/_fruit-salad.scss +242 -250
  245. package/src/styles/themes/_highcontrast.scss +164 -172
  246. package/src/styles/themes/_index.scss +0 -1
  247. package/src/styles/themes/_monochrome.scss +226 -234
  248. package/src/styles/themes/_neutral.scss +242 -250
  249. package/src/styles/themes/_ocean.scss +242 -259
  250. package/src/styles/themes/_rainbow.scss +242 -250
  251. package/src/styles/themes/_sageivory.scss +242 -250
  252. package/src/styles/themes/_spring.scss +238 -255
  253. package/src/styles/themes/_summer.scss +242 -250
  254. package/src/styles/themes/_sunset.scss +242 -259
  255. package/src/styles/themes/_tealcaramel.scss +242 -250
  256. package/src/styles/themes/_vibrant.scss +242 -250
  257. package/src/styles/utilities/_colors.scss +44 -50
  258. package/src/styles/utilities/_flexbox.scss +48 -59
  259. package/src/styles/utilities/_layout.scss +516 -591
  260. package/src/styles/utilities/_ripple.scss +61 -70
  261. package/src/styles/utilities/_spacing.scss +120 -127
  262. package/src/styles/utilities/_typography.scss +45 -58
  263. package/src/styles/utilities/_visibility.scss +61 -76
  264. package/dist/package.json +0 -488
@@ -1,4 +1,3 @@
1
- // src/components/tabs/_styles.scss
2
1
  @use "sass:string";
3
2
  @use "../../styles/abstract/base" as base;
4
3
  @use "../../styles/abstract/variables" as v;
@@ -9,557 +8,361 @@
9
8
  $component: "#{base.$prefix}-button.#{base.$prefix}-tab";
10
9
  $container: "#{base.$prefix}-tabs";
11
10
 
12
- // Tabs Container Styles (1. Container)
13
11
  .#{$container} {
14
- position: relative;
15
- display: flex;
16
- flex-direction: column;
17
- width: 100%;
18
- // background-color: t.color('surface'); // MD3: Surface color
19
- box-sizing: border-box;
20
-
21
- // Basic container sizing
22
- &--primary {
23
- min-height: 48px;
24
-
25
- // Tab container with icons and text needs more space
26
- &:has(.#{$component}--icon-and-text) {
27
- min-height: 64px;
28
- }
29
-
30
- // Primary indicator: m3.material.io tabs specs, shape "3, 3, 0, 0" (the top
31
- // corners only; Compose rounds all four) at 3dp, set by indicator.ts.
32
- .#{$container}__indicator {
33
- border-radius: 3px 3px 0 0;
34
- background-color: t.color("primary");
35
- }
36
- }
37
-
38
- &--secondary {
39
- min-height: 48px;
40
- // Tab indicator styling for secondary variant
41
- .#{$container}__indicator {
42
- // 2dp, set by indicator.ts: the site's secondary indicator height (Compose's
43
- // SecondaryIndicator takes the primary 3dp; the site wins).
44
- border-radius: 0;
45
- background-color: t.color("primary");
46
- }
47
- }
48
-
49
- // A tab is built on a text button, which paints its own ::before state layer in
50
- // currentColor. The tab paints its own per-variant layer below, so the button's
51
- // would stack a second one over it. Keep the tab's.
52
- .#{$component}::before {
53
- content: none;
54
- }
55
-
56
- // Fixed form: Compose divides the row evenly (tabRowWidth / tabCount,
57
- // TabRow.kt:443-447). Without `scrollable` the component never builds a scroll
58
- // container, so the tabs are direct children of the root.
59
- //
60
- // Which is why the direction has to be row here. The container is column
61
- // so that a scroll container sits above the divider, and with no scroll
62
- // container the tabs inherited that and stacked vertically -- `flex: 1`
63
- // below was dividing the height rather than the row the comment above
64
- // describes. The divider and the indicator are both absolutely
65
- // positioned, so neither depends on the container's direction.
66
- &:not(&--scrollable) {
67
- flex-direction: row;
68
- }
69
-
70
- &:not(&--scrollable) > .#{$component} {
71
- flex: 1;
72
- }
73
-
74
- // Scrollable container
75
- &--scrollable {
76
- overflow: hidden;
77
-
78
- .#{$container}__scroll {
79
- display: flex;
80
- // ScrollableTabRowEdgeStartPadding, applied at both edges: TabRow.kt:239
81
- // documents it as the padding between the starting and ending edge and the
82
- // tabs inside the row.
83
- padding-inline: 52px;
84
- overflow-x: auto;
85
- // The scroll buttons name no behaviour, so that reduced motion can stop it
86
- scroll-behavior: smooth;
87
- scrollbar-width: none; // Firefox
88
- -ms-overflow-style: none; // IE and Edge
89
-
90
- &::-webkit-scrollbar {
91
- display: none; // Chrome, Safari, and Opera
92
- }
93
- }
94
- }
95
-
96
- // Container divider (5. Divider)
97
- &__divider {
98
- position: absolute;
99
- bottom: 0;
100
- left: 0;
101
- right: 0;
102
- height: 1px;
103
- background-color: t.color(
104
- "outline-variant"
105
- ); // MD3: Outline variant color
106
- }
107
-
108
- // Tab indicator styling - base styles
109
- &__indicator {
110
- position: absolute;
111
- // On the row's bottom edge, over the divider, as the site draws it.
112
- bottom: 0;
113
- // indicator.ts measures from the scroll container's left edge and moves the
114
- // indicator with translateX, so it has to start there. Without `left` an
115
- // absolute box sits at its static position: 0 in the fixed row, but past the
116
- // 52px padding-inline of the scrollable row, which offset every tab by that.
117
- left: 0;
118
- // Compose springs the indicator's offset and width (damping 0.9, stiffness
119
- // 700): the default spatial spring. indicator.ts moves it without motion on
120
- // the first render and on resize.
121
- transition: m.spring(transform, default-spatial), m.spring(width, default-spatial);
122
- z-index: 1; // Ensure indicator appears above divider
123
- }
124
-
125
- // Resting position where anchor positioning exists (Baseline 2026). `left: 0`
126
- // above stays the fallback, and older browsers keep the transform spring.
127
- // The name is scoped to this component. The active tab carries it; a primary
128
- // label replaces it so the indicator insets that text.
129
- @supports (#{string.unquote("anchor-name: --a")}) {
130
- anchor-scope: string.unquote("--#{base.$prefix}-tabs-indicator");
131
- $anchor: string.unquote("--#{base.$prefix}-tabs-indicator");
132
-
133
- &__indicator {
134
- position-anchor: $anchor;
135
- }
136
-
137
- .#{base.$prefix}-tab--active {
138
- anchor-name: $anchor;
139
- }
140
-
141
- &--primary:not(:has(#{&}__indicator--fixed)):not(:has(#{&}__indicator--dynamic)) {
142
- .#{base.$prefix}-tab--active:has(.#{base.$prefix}-button__text) {
143
- anchor-name: none;
144
- }
145
-
146
- .#{base.$prefix}-tab--active .#{base.$prefix}-button__text {
147
- anchor-name: $anchor;
148
- }
149
- }
150
-
151
- &--primary &__indicator,
152
- &--secondary &__indicator {
153
- transition: m.spring(left, default-spatial), m.spring(width, default-spatial);
154
- }
155
-
156
- &--primary &__indicator {
157
- width: string.unquote("max(24px, calc(anchor-size(width) - 4px))");
158
- left: string.unquote("calc(anchor(center) - 0.5 * max(24px, anchor-size(width) - 4px))");
159
- }
160
-
161
- &--secondary &__indicator {
162
- left: anchor(left);
163
- width: anchor-size(width);
164
- min-width: 0;
165
- }
166
-
167
- // Same specificity as the variant rules above, and later, so a strategy wins.
168
- // A primary tab with no label uses the dynamic half, centred on the tab.
169
- &--primary:has(.#{base.$prefix}-tab--active:not(:has(.#{base.$prefix}-button__text))) &__indicator:not(#{&}__indicator--fixed):not(#{&}__indicator--content),
170
- &--primary &__indicator--dynamic,
171
- &--secondary &__indicator--dynamic {
172
- width: string.unquote("max(30px, calc(anchor-size(width) / 2))");
173
- left: string.unquote("calc(anchor(center) - 0.5 * max(30px, calc(anchor-size(width) / 2)))");
174
- }
175
-
176
- &--primary &__indicator--content,
177
- &--secondary &__indicator--content {
178
- width: string.unquote("max(30px, anchor-size(width))");
179
- left: string.unquote("calc(anchor(center) - 0.5 * max(30px, anchor-size(width)))");
180
- }
181
-
182
- &:has(.#{base.$prefix}-tab--active:not(:has(.#{base.$prefix}-button__text))) &__indicator--content,
183
- &--primary &__indicator--fixed,
184
- &--secondary &__indicator--fixed {
185
- width: var(--#{base.$prefix}-tabs-indicator-width, 40px);
186
- left: string.unquote("calc(anchor(center) - 0.5 * var(--#{base.$prefix}-tabs-indicator-width, 40px))");
187
- }
188
- }
189
- }
190
-
191
- // Individual Tab Styles
12
+ position: relative;
13
+ display: flex;
14
+ flex-direction: column;
15
+ width: 100%;
16
+ box-sizing: border-box;
17
+
18
+ &--primary {
19
+ min-height: 48px;
20
+
21
+ &:has(.#{$component}--icon-and-text) {
22
+ min-height: 64px;
23
+ }
24
+
25
+ .#{$container}__indicator {
26
+ border-radius: 3px 3px 0 0;
27
+ background-color: t.color("primary");
28
+ }
29
+ }
30
+
31
+ &--secondary {
32
+ min-height: 48px;
33
+ .#{$container}__indicator {
34
+ border-radius: 0;
35
+ background-color: t.color("primary");
36
+ }
37
+ }
38
+
39
+ .#{$component}::before {
40
+ content: none;
41
+ }
42
+
43
+ &:not(&--scrollable) {
44
+ flex-direction: row;
45
+ }
46
+
47
+ &:not(&--scrollable) > .#{$component} {
48
+ flex: 1;
49
+ }
50
+
51
+ &--scrollable {
52
+ overflow: hidden;
53
+
54
+ .#{$container}__scroll {
55
+ display: flex;
56
+ padding-inline: 52px;
57
+ overflow-x: auto;
58
+ scroll-behavior: smooth;
59
+ scrollbar-width: none;
60
+ -ms-overflow-style: none;
61
+
62
+ &::-webkit-scrollbar {
63
+ display: none;
64
+ }
65
+ }
66
+ }
67
+
68
+ &__divider {
69
+ position: absolute;
70
+ bottom: 0;
71
+ left: 0;
72
+ right: 0;
73
+ height: 1px;
74
+ background-color: t.color(
75
+ "outline-variant"
76
+ );
77
+ }
78
+
79
+ &__indicator {
80
+ position: absolute;
81
+ bottom: 0;
82
+ left: 0;
83
+ transition: m.spring(transform, default-spatial), m.spring(width, default-spatial);
84
+ z-index: 1;
85
+ }
86
+
87
+ @supports (#{string.unquote("anchor-name: --a")}) {
88
+ anchor-scope: string.unquote("--#{base.$prefix}-tabs-indicator");
89
+ $anchor: string.unquote("--#{base.$prefix}-tabs-indicator");
90
+
91
+ &__indicator {
92
+ position-anchor: $anchor;
93
+ }
94
+
95
+ .#{base.$prefix}-tab--active {
96
+ anchor-name: $anchor;
97
+ }
98
+
99
+ &--primary:not(:has(#{&}__indicator--fixed)):not(:has(#{&}__indicator--dynamic)) {
100
+ .#{base.$prefix}-tab--active:has(.#{base.$prefix}-button__text) {
101
+ anchor-name: none;
102
+ }
103
+
104
+ .#{base.$prefix}-tab--active .#{base.$prefix}-button__text {
105
+ anchor-name: $anchor;
106
+ }
107
+ }
108
+
109
+ &--primary &__indicator,
110
+ &--secondary &__indicator {
111
+ transition: m.spring(left, default-spatial), m.spring(width, default-spatial);
112
+ }
113
+
114
+ &--primary &__indicator {
115
+ width: string.unquote("max(24px, calc(anchor-size(width) - 4px))");
116
+ left: string.unquote("calc(anchor(center) - 0.5 * max(24px, anchor-size(width) - 4px))");
117
+ }
118
+
119
+ &--secondary &__indicator {
120
+ left: anchor(left);
121
+ width: anchor-size(width);
122
+ min-width: 0;
123
+ }
124
+
125
+ &--primary:has(.#{base.$prefix}-tab--active:not(:has(.#{base.$prefix}-button__text))) &__indicator:not(#{&}__indicator--fixed):not(#{&}__indicator--content),
126
+ &--primary &__indicator--dynamic,
127
+ &--secondary &__indicator--dynamic {
128
+ width: string.unquote("max(30px, calc(anchor-size(width) / 2))");
129
+ left: string.unquote("calc(anchor(center) - 0.5 * max(30px, calc(anchor-size(width) / 2)))");
130
+ }
131
+
132
+ &--primary &__indicator--content,
133
+ &--secondary &__indicator--content {
134
+ width: string.unquote("max(30px, anchor-size(width))");
135
+ left: string.unquote("calc(anchor(center) - 0.5 * max(30px, anchor-size(width)))");
136
+ }
137
+
138
+ &:has(.#{base.$prefix}-tab--active:not(:has(.#{base.$prefix}-button__text))) &__indicator--content,
139
+ &--primary &__indicator--fixed,
140
+ &--secondary &__indicator--fixed {
141
+ width: var(--#{base.$prefix}-tabs-indicator-width, 40px);
142
+ left: string.unquote("calc(anchor(center) - 0.5 * var(--#{base.$prefix}-tabs-indicator-width, 40px))");
143
+ }
144
+ }
145
+ }
146
+
192
147
  .#{$component} {
193
- position: relative;
194
- display: inline-flex;
195
- align-items: center;
196
- justify-content: center;
197
- min-width: 90px;
198
- max-width: 360px;
199
- padding: 0 16px;
200
- border: none;
201
- border-radius: 0;
202
- background-color: transparent;
203
- color: t.color("on-surface-variant");
204
- cursor: pointer;
205
- user-select: none;
206
- flex-shrink: 0;
207
-
208
- // Typography for label text (4. Label): LabelTextFont = TitleSmall
209
- @include m.typography("title-small");
210
-
211
- // Transition for state changes
212
- transition:
213
- background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
214
- color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
215
-
216
- // Container heights based on layout
217
- &--text-only {
218
- height: 48px;
219
- }
220
-
221
- &--icon-only {
222
- height: 48px;
223
- }
224
-
225
- &--icon-and-text {
226
- height: 64px;
227
- flex-direction: column;
228
- }
229
-
230
- // A tab with an icon is a button with an icon, whose text-button padding is
231
- // 12dp on the icon side: the stacked icon sat 2px off-centre.
232
- &.#{base.$prefix}-button--icon {
233
- padding: 0 16px;
234
- }
235
-
236
- // Focus styles (3/7. Focused state)
237
- &:focus {
238
- outline: none;
239
- }
240
-
241
- // md.comp.focus-ring: 3dp in secondary, drawn inward because a tab sits at the
242
- // row's edge and inside a scroll container that would clip it.
243
- &:focus-visible {
244
- outline: 3px solid t.color("secondary");
245
- outline-offset: -3px;
246
- z-index: 1;
247
- }
248
-
249
- // Disabled state
250
- &--disabled,
251
- &:disabled {
252
- pointer-events: none;
253
- opacity: 0.38;
254
- }
255
-
256
- // Tab Icon (3. Icon - optional)
257
- // The icon element the button builds carries mtrl-icon + mtrl-button__icon; a
258
- // nested &__icon would concatenate onto the compound root and match nothing.
259
- .#{base.$prefix}-button__icon {
260
- display: flex;
261
- align-items: center;
262
- justify-content: center;
263
- width: 24px;
264
- height: 24px;
265
-
266
- svg {
267
- width: 100%;
268
- height: 100%;
269
- fill: currentColor;
270
- }
271
- }
272
-
273
- // Ensure proper vertical spacing for icon and text
274
- &--icon-and-text {
275
- .#{base.$prefix}-button__icon {
276
- margin-bottom: 4px;
277
- }
278
- }
279
-
280
- // Tab Text (4. Label)
281
- .#{base.$prefix}-button__text {
282
- @include m.truncate;
283
- max-width: 100%;
284
- text-align: center;
285
- line-height: 1.2;
286
- }
287
-
288
- // The modifier is on the tab root, so the label is a descendant of &, not of a
289
- // second tab.
290
- &--icon-only .#{base.$prefix}-button__text {
291
- @include m.visually-hidden;
292
- }
293
-
294
- // Badge on the icon, else the label (tab.ts): 6dp over the icon, 4dp after the
295
- // label, mirrored in RTL (m3.material.io/components/{tabs/specs,badges/guidelines}).
296
- &--icon-only .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right,
297
- &--icon-and-text .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right {
298
- top: 0;
299
- right: auto;
300
- left: calc(100% - 6px);
301
-
302
- @include m.rtl {
303
- right: calc(100% - 6px);
304
- left: auto;
305
- }
306
- }
307
-
308
- &--text-only .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right {
309
- top: 50%;
310
- right: auto;
311
- left: calc(100% + 4px);
312
- transform: translateY(-50%);
313
-
314
- @include m.rtl {
315
- right: calc(100% + 4px);
316
- left: auto;
317
- }
318
- }
319
-
320
- // ACTIVE TAB STATES - PRIMARY VARIANT
321
- .#{$container}--primary & {
322
- // Active Tab Base State - Apply to primary variant
323
- &--active {
324
- color: t.color("primary");
325
- border-radius: 0;
326
- .#{base.$prefix}-button__icon {
327
- color: t.color("primary");
328
- }
329
-
330
- // Hover state for active tabs
331
- &:hover,
332
- &.#{$component}--hover {
333
- background-color: t.alpha("primary", v.state("hover-state-layer-opacity"));
334
- }
335
-
336
- // Focused state for active tabs
337
- &:focus-visible,
338
- &.#{$component}--focus {
339
- background-color: t.alpha("primary", v.state("focus-state-layer-opacity"));
340
- }
341
-
342
- // Pressed state for active tabs
343
- // A rippled tab leaves the press to its ripple.
344
- &:active:not(:has(> .#{base.$prefix}-ripple)),
345
- &.#{$component}--pressed {
346
- background-color: t.alpha("primary", v.state("pressed-state-layer-opacity"));
347
- }
348
- }
349
-
350
- // Inactive Tabs - Primary variant
351
- &:not(.#{$component}--active):not(.#{$component}--disabled):not(
352
- :disabled
353
- ) {
354
- color: t.color("on-surface-variant");
355
-
356
- // An inactive tab's label and icon turn on-surface in every interaction
357
- // state (InactiveHover/Focus/PressedLabelTextColor = OnSurface), over an
358
- // on-surface layer;
359
- &:hover,
360
- &.#{$component}--hover {
361
- color: t.color("on-surface");
362
- background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
363
- }
364
-
365
- &:focus-visible,
366
- &.#{$component}--focus {
367
- color: t.color("on-surface");
368
- background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
369
- }
370
-
371
- // The press is primary: "tapping a non-selected tab will select it"
372
- // (MDC inactive_pressed_state_layer_color). The ripple draws it.
373
- &:active,
374
- &.#{$component}--pressed {
375
- color: t.color("on-surface");
376
- }
377
-
378
- &:active:not(:has(> .#{base.$prefix}-ripple)),
379
- &.#{$component}--pressed {
380
- background-color: t.alpha("primary", v.state("pressed-state-layer-opacity"));
381
- }
382
-
383
- .#{base.$prefix}-ripple-wave {
384
- background-color: t.color("primary");
385
- }
386
- }
387
- }
388
-
389
- // ACTIVE TAB STATES - SECONDARY VARIANT
390
- .#{$container}--secondary & {
391
- // Active Tab - Secondary variant
392
- &--active {
393
- color: t.color("on-surface");
394
- border-radius: 0;
395
- .#{base.$prefix}-button__icon {
396
- color: t.color("on-surface");
397
- }
398
-
399
- // Hover state for active tabs - secondary
400
- &:hover,
401
- &.#{$component}--hover {
402
- background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
403
- }
404
-
405
- // Focused state for active tabs - secondary
406
- &:focus-visible,
407
- &.#{$component}--focus {
408
- background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
409
- }
410
-
411
- // Pressed state for active tabs - secondary
412
- // A rippled tab leaves the press to its ripple.
413
- &:active:not(:has(> .#{base.$prefix}-ripple)),
414
- &.#{$component}--pressed {
415
- background-color: t.alpha("on-surface", v.state("pressed-state-layer-opacity"));
416
- }
417
- }
418
-
419
- // Inactive Tabs - Secondary variant
420
- &:not(.#{$component}--active):not(.#{$component}--disabled):not(
421
- :disabled
422
- ) {
423
- color: t.color("on-surface-variant");
424
-
425
- // Secondary tabs: label, icon and layer on-surface in every interaction
426
- // state, active or not (SecondaryNavigationTabTokens).
427
- &:hover,
428
- &.#{$component}--hover {
429
- color: t.color("on-surface");
430
- background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
431
- }
432
-
433
- &:focus-visible,
434
- &.#{$component}--focus {
435
- color: t.color("on-surface");
436
- background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
437
- }
438
-
439
- &:active,
440
- &.#{$component}--pressed {
441
- color: t.color("on-surface");
442
- }
443
-
444
- // A rippled tab leaves the press to its ripple.
445
- &:active:not(:has(> .#{base.$prefix}-ripple)),
446
- &.#{$component}--pressed {
447
- background-color: t.alpha("on-surface", v.state("pressed-state-layer-opacity"));
448
- }
449
- }
450
- }
451
-
452
- // No ripple rules here: the ripple feature appends .mtrl-ripple with
453
- // .mtrl-ripple-wave children, both styled by the ripple utility in the base
454
- // bundle. What stood here addressed .mtrl-button.mtrl-tab-ripple and a bare
455
- // .ripple, neither of which is ever emitted, and duplicated the utility besides.
456
- }
457
-
458
- // Tab panel styles
148
+ position: relative;
149
+ display: inline-flex;
150
+ align-items: center;
151
+ justify-content: center;
152
+ min-width: 90px;
153
+ max-width: 360px;
154
+ padding: 0 16px;
155
+ border: none;
156
+ border-radius: 0;
157
+ background-color: transparent;
158
+ color: t.color("on-surface-variant");
159
+ cursor: pointer;
160
+ user-select: none;
161
+ flex-shrink: 0;
162
+
163
+ @include m.typography("title-small");
164
+
165
+ transition:
166
+ background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
167
+ color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
168
+
169
+ &--text-only {
170
+ height: 48px;
171
+ }
172
+
173
+ &--icon-only {
174
+ height: 48px;
175
+ }
176
+
177
+ &--icon-and-text {
178
+ height: 64px;
179
+ flex-direction: column;
180
+ }
181
+
182
+ &.#{base.$prefix}-button--icon {
183
+ padding: 0 16px;
184
+ }
185
+
186
+ &:focus {
187
+ outline: none;
188
+ }
189
+
190
+ &:focus-visible {
191
+ outline: 3px solid t.color("secondary");
192
+ outline-offset: -3px;
193
+ z-index: 1;
194
+ }
195
+
196
+ &--disabled,
197
+ &:disabled {
198
+ pointer-events: none;
199
+ opacity: 0.38;
200
+ }
201
+
202
+ .#{base.$prefix}-button__icon {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ width: 24px;
207
+ height: 24px;
208
+
209
+ svg {
210
+ width: 100%;
211
+ height: 100%;
212
+ fill: currentColor;
213
+ }
214
+ }
215
+
216
+ &--icon-and-text {
217
+ .#{base.$prefix}-button__icon {
218
+ margin-bottom: 4px;
219
+ }
220
+ }
221
+
222
+ .#{base.$prefix}-button__text {
223
+ @include m.truncate;
224
+ max-width: 100%;
225
+ text-align: center;
226
+ line-height: 1.2;
227
+ }
228
+
229
+ &--icon-only .#{base.$prefix}-button__text {
230
+ @include m.visually-hidden;
231
+ }
232
+
233
+ &--icon-only .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right,
234
+ &--icon-and-text .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right {
235
+ top: 0;
236
+ right: auto;
237
+ left: calc(100% - 6px);
238
+
239
+ @include m.rtl {
240
+ right: calc(100% - 6px);
241
+ left: auto;
242
+ }
243
+ }
244
+
245
+ &--text-only .#{base.$prefix}-badge__wrapper .#{base.$prefix}-badge--top-right {
246
+ top: 50%;
247
+ right: auto;
248
+ left: calc(100% + 4px);
249
+ transform: translateY(-50%);
250
+
251
+ @include m.rtl {
252
+ right: calc(100% + 4px);
253
+ left: auto;
254
+ }
255
+ }
256
+
257
+ .#{$container}--primary & {
258
+ &--active {
259
+ color: t.color("primary");
260
+ border-radius: 0;
261
+ .#{base.$prefix}-button__icon {
262
+ color: t.color("primary");
263
+ }
264
+
265
+ &:hover {
266
+ background-color: t.alpha("primary", v.state("hover-state-layer-opacity"));
267
+ }
268
+
269
+ &:focus-visible {
270
+ background-color: t.alpha("primary", v.state("focus-state-layer-opacity"));
271
+ }
272
+
273
+ &:active:not(:has(> .#{base.$prefix}-ripple)) {
274
+ background-color: t.alpha("primary", v.state("pressed-state-layer-opacity"));
275
+ }
276
+ }
277
+
278
+ &:not(.#{$component}--active):not(.#{$component}--disabled):not(
279
+ :disabled
280
+ ) {
281
+ color: t.color("on-surface-variant");
282
+
283
+ &:hover {
284
+ color: t.color("on-surface");
285
+ background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
286
+ }
287
+
288
+ &:focus-visible {
289
+ color: t.color("on-surface");
290
+ background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
291
+ }
292
+
293
+ &:active {
294
+ color: t.color("on-surface");
295
+ }
296
+
297
+ &:active:not(:has(> .#{base.$prefix}-ripple)) {
298
+ background-color: t.alpha("primary", v.state("pressed-state-layer-opacity"));
299
+ }
300
+
301
+ .#{base.$prefix}-ripple-wave {
302
+ background-color: t.color("primary");
303
+ }
304
+ }
305
+ }
306
+
307
+ .#{$container}--secondary & {
308
+ &--active {
309
+ color: t.color("on-surface");
310
+ border-radius: 0;
311
+ .#{base.$prefix}-button__icon {
312
+ color: t.color("on-surface");
313
+ }
314
+
315
+ &:hover {
316
+ background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
317
+ }
318
+
319
+ &:focus-visible {
320
+ background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
321
+ }
322
+
323
+ &:active:not(:has(> .#{base.$prefix}-ripple)) {
324
+ background-color: t.alpha("on-surface", v.state("pressed-state-layer-opacity"));
325
+ }
326
+ }
327
+
328
+ &:not(.#{$component}--active):not(.#{$component}--disabled):not(
329
+ :disabled
330
+ ) {
331
+ color: t.color("on-surface-variant");
332
+
333
+ &:hover {
334
+ color: t.color("on-surface");
335
+ background-color: t.alpha("on-surface", v.state("hover-state-layer-opacity"));
336
+ }
337
+
338
+ &:focus-visible {
339
+ color: t.color("on-surface");
340
+ background-color: t.alpha("on-surface", v.state("focus-state-layer-opacity"));
341
+ }
342
+
343
+ &:active {
344
+ color: t.color("on-surface");
345
+ }
346
+
347
+ &:active:not(:has(> .#{base.$prefix}-ripple)) {
348
+ background-color: t.alpha("on-surface", v.state("pressed-state-layer-opacity"));
349
+ }
350
+ }
351
+ }
352
+
353
+ }
354
+
459
355
  .#{base.$prefix}-tab-panel {
460
- padding: 16px;
356
+ padding: 16px;
461
357
 
462
- &[hidden] {
463
- display: none;
464
- }
358
+ &[hidden] {
359
+ display: none;
360
+ }
465
361
  }
466
362
 
467
- // Scroll indicators
468
- .#{$container} {
469
- &__scroll-indicator {
470
- position: absolute;
471
- top: 0;
472
- bottom: 0;
473
- width: 24px;
474
- pointer-events: none;
475
- z-index: 1;
476
- opacity: 0;
477
- transition: opacity 0.2s ease;
478
-
479
- &.visible {
480
- opacity: 1;
481
- }
482
-
483
- &--left {
484
- left: 0;
485
- background: linear-gradient(
486
- to right,
487
- t.color("surface"),
488
- transparent
489
- );
490
- }
491
-
492
- &--right {
493
- right: 0;
494
- background: linear-gradient(
495
- to left,
496
- t.color("surface"),
497
- transparent
498
- );
499
- }
500
-
501
- &--shadow {
502
- &.#{$container}__scroll-indicator--left {
503
- box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.2);
504
- background: none;
505
- }
506
-
507
- &.#{$container}__scroll-indicator--right {
508
- box-shadow: -2px 0 4px -2px rgba(0, 0, 0, 0.2);
509
- background: none;
510
- }
511
- }
512
- }
513
-
514
- &__scroll-button {
515
- position: absolute;
516
- top: 50%;
517
- transform: translateY(-50%);
518
- width: 40px;
519
- height: 40px;
520
- border-radius: 50%;
521
- background-color: t.color("surface-container-high");
522
- border: none;
523
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
524
- display: flex;
525
- align-items: center;
526
- justify-content: center;
527
- cursor: pointer;
528
- z-index: 2;
529
-
530
- &:disabled {
531
- opacity: 0.38;
532
- cursor: default;
533
- }
534
-
535
- svg {
536
- width: 24px;
537
- height: 24px;
538
- fill: t.color("on-surface");
539
- }
540
-
541
- &--left {
542
- left: 4px;
543
- }
544
-
545
- &--right {
546
- right: 4px;
547
- }
548
-
549
- &:focus {
550
- outline: none;
551
- }
552
-
553
- &:focus-visible {
554
- outline: 2px solid t.color("primary");
555
- }
556
- }
557
- }
558
-
559
- // Responsive styles for small screens
560
363
  .#{$container}--responsive-small {
561
- .#{$component} {
562
- padding: 0 12px;
563
- min-width: 72px;
564
- }
364
+ .#{$component} {
365
+ padding: 0 12px;
366
+ min-width: 72px;
367
+ }
565
368
  }