@rio-m3e/vue 0.7.0 → 0.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 (44) hide show
  1. package/dist/app-bar/AppBar.vue.js +3 -1
  2. package/dist/app-bar/context.js +3 -0
  3. package/dist/browser/rio-vue.css +366 -78
  4. package/dist/browser/rio-vue.global.js +21 -21
  5. package/dist/browser/rio-vue.js +21 -21
  6. package/dist/checkbox/Checkbox.vue.d.ts +1 -0
  7. package/dist/checkbox/Checkbox.vue.js +3 -0
  8. package/dist/chip/AssistChip.vue.d.ts +1 -0
  9. package/dist/chip/AssistChip.vue.js +3 -0
  10. package/dist/chip/ChipSet.vue.d.ts +1 -0
  11. package/dist/chip/ChipSet.vue.js +4 -1
  12. package/dist/chip/FilterChip.vue.d.ts +19 -3
  13. package/dist/chip/FilterChip.vue.js +54 -8
  14. package/dist/chip/InputChip.vue.d.ts +1 -0
  15. package/dist/chip/InputChip.vue.js +3 -0
  16. package/dist/chip/SuggestionChip.vue.d.ts +1 -0
  17. package/dist/chip/SuggestionChip.vue.js +3 -0
  18. package/dist/icon-button/IconButton.vue.d.ts +1 -0
  19. package/dist/icon-button/IconButton.vue.js +3 -0
  20. package/dist/index.d.ts +8 -6
  21. package/dist/index.js +8 -6
  22. package/dist/list/ListItem.vue.d.ts +7 -1
  23. package/dist/list/ListItem.vue.js +12 -3
  24. package/dist/radio/Radio.vue.d.ts +1 -0
  25. package/dist/radio/Radio.vue.js +3 -0
  26. package/dist/radio/RadioGroup.vue.d.ts +1 -0
  27. package/dist/radio/RadioGroup.vue.js +3 -0
  28. package/dist/rio/rio.js +2 -0
  29. package/dist/select/Select.vue.d.ts +1 -0
  30. package/dist/select/Select.vue.js +3 -0
  31. package/dist/switch/Switch.vue.d.ts +1 -0
  32. package/dist/switch/Switch.vue.js +3 -0
  33. package/dist/tabs/Tab.vue.d.ts +8 -1
  34. package/dist/tabs/Tab.vue.js +51 -26
  35. package/dist/tabs/Tabs.vue.d.ts +2 -0
  36. package/dist/tabs/Tabs.vue.js +21 -7
  37. package/dist/text-field/TextField.vue.d.ts +1 -0
  38. package/dist/text-field/TextField.vue.js +3 -0
  39. package/dist/theme/ThemeProvider.vue.d.ts +22 -0
  40. package/dist/theme/ThemeProvider.vue.js +26 -0
  41. package/dist/theme/context.d.ts +7 -0
  42. package/dist/theme/context.js +7 -0
  43. package/dist/tooltip/Tooltip.vue.js +10 -3
  44. package/package.json +4 -4
@@ -123,6 +123,25 @@
123
123
  --rio-button-on-accent: initial;
124
124
  }
125
125
 
126
+ /* @rio-m3e/styles/base/density.css */
127
+ /*
128
+ * The density variable, `--rio-density`: the spec's component density scale, 0 by default, then
129
+ * -1, -2, and -3. Core writes it in a component's root `style` (`densityVars`), and an app can set
130
+ * it on any element, as the document's root, for every component inside; the elements inside
131
+ * inherit it. Each stylesheet that reads it takes 4px per step off what it shrinks, down to its own
132
+ * least, and keeps the 48px target. Registered as an integer: a value that isn't one is left out,
133
+ * and the element keeps the density around it, 0 at the root.
134
+ *
135
+ * Dialogs, snackbars, date pickers' calendars, time pickers, and menus set it back to 0 for what is
136
+ * inside them, in their own stylesheets, and so do the places other components lay icon buttons out
137
+ * in at their default size, as a text field's icon places.
138
+ */
139
+ @property --rio-density {
140
+ syntax: '<integer>';
141
+ inherits: true;
142
+ initial-value: 0;
143
+ }
144
+
126
145
  /* @rio-m3e/styles/base/focus-ring.css */
127
146
  /*
128
147
  * Keyboard focus indicator: a ring around the element, shown only for keyboard-style focus
@@ -595,7 +614,8 @@
595
614
  * `rio-icon-button`, so it inherits the button's shapes (round, square, pressed, selected), shape
596
615
  * morphing, colors (the `standard` variant lives in `button.css` with the others), disabled rules,
597
616
  * state layer, ripple, and touch target. This file holds only what differs: the three widths, the
598
- * icon sizes, and no elevation.
617
+ * icon sizes, no elevation, and density (`base/density.css`), 4px off the height and the width a
618
+ * step, down to 24px, with the small sizes' corners kept under round.
599
619
  *
600
620
  * Values come from Material Web's component tokens (`_md-comp-icon-button-*.scss`, Material 3
601
621
  * v34.0.21). Every rule is `.rio-button.rio-icon-button`, so it beats `button.css` in any load
@@ -608,11 +628,24 @@
608
628
  --_padding: 8px;
609
629
  --_elevation: none;
610
630
  --_hover-elevation: none;
631
+ /* Density (`base/density.css`): 4px less height and width per step, down to 24px */
632
+ --_density: clamp(-3, var(--rio-density, 0), 0);
633
+ --_dense-height: max(24px, calc(var(--_height) + 4px * var(--_density)));
634
+ --_round: calc(var(--_dense-height) / 2);
611
635
 
612
- inline-size: calc(var(--_icon-size) + 2 * var(--_padding));
636
+ inline-size: max(24px, calc(var(--_icon-size) + 2 * var(--_padding) + 4px * var(--_density)));
637
+ block-size: var(--_dense-height);
613
638
  padding: 0;
614
639
  }
615
640
 
641
+ /* With density, the small sizes' corners stay apart from round: square, selected, and pressed stay
642
+ under half the height. */
643
+ .rio-button.rio-icon-button:where([data-size='xsmall'], [data-size='small']) {
644
+ --_square: min(var(--rio-shape-corner-medium), calc(var(--_round) - 4px));
645
+ --_selected-round: min(var(--rio-shape-corner-medium), calc(var(--_round) - 4px));
646
+ --_pressed: min(var(--rio-shape-corner-small), calc(var(--_round) - 8px));
647
+ }
648
+
616
649
  /* Sizes: icon size and the padding beside it for each width */
617
650
 
618
651
  .rio-button.rio-icon-button:where([data-size='xsmall']) {
@@ -763,6 +796,14 @@ span.rio-icon > * {
763
796
  * sit 4px apart and 4px from the container's edges.
764
797
  */
765
798
 
799
+ /*
800
+ * A density set around the menu stays outside it: what is inside lays out at its default,
801
+ * unless it sets its own (`base/density.css`). The rule adds no specificity.
802
+ */
803
+ :where(.rio-menu) {
804
+ --rio-density: 0;
805
+ }
806
+
766
807
  .rio-menu {
767
808
  --_container: var(--rio-color-surface-container-low);
768
809
  --_content: var(--rio-color-on-surface);
@@ -1182,6 +1223,14 @@ span.rio-icon > * {
1182
1223
  * is left, and the headline's copy fades in beside the buttons, as small bar's headline.
1183
1224
  */
1184
1225
 
1226
+ /*
1227
+ * The app bar's buttons lay out for icon buttons at their default size: a density set around them
1228
+ * stays outside (`base/density.css`). The rule adds no specificity.
1229
+ */
1230
+ :where(.rio-app-bar) {
1231
+ --rio-density: 0;
1232
+ }
1233
+
1185
1234
  .rio-app-bar {
1186
1235
  --_container: var(--rio-color-surface);
1187
1236
  --_headline-font: var(--rio-typescale-title-large);
@@ -1503,6 +1552,14 @@ span.rio-icon > * {
1503
1552
  * measurements. The scrim is 32% of the scrim color, as a dialog's.
1504
1553
  */
1505
1554
 
1555
+ /*
1556
+ * A side sheet's header buttons lay out for icon buttons at their default size: a density set
1557
+ * around them stays outside (`base/density.css`). The rule adds no specificity.
1558
+ */
1559
+ :where(.rio-side-sheet__header) {
1560
+ --rio-density: 0;
1561
+ }
1562
+
1506
1563
  /*
1507
1564
  * A modal sheet's scrim fades in as it opens, and out as it closes. Closing, the sheet stays in the
1508
1565
  * top layer until both its motion and the fade are over, which reduced motion keeps.
@@ -1875,6 +1932,15 @@ span.rio-icon > * {
1875
1932
  * change in standard groups is JavaScript (`attachButtonGroup` from `@rio-m3e/core`).
1876
1933
  */
1877
1934
 
1935
+ /*
1936
+ * A group's buttons, which density doesn't make shorter, and its icon buttons, lay out for icon
1937
+ * buttons at their default size: a density set around them stays outside (`base/density.css`). The
1938
+ * rule adds no specificity.
1939
+ */
1940
+ :where(.rio-button-group) {
1941
+ --rio-density: 0;
1942
+ }
1943
+
1878
1944
  .rio-button-group {
1879
1945
  /* Standard, small */
1880
1946
  --_between: 12px;
@@ -2034,6 +2100,15 @@ span.rio-icon > * {
2034
2100
  * Variant rules sit inside `:where()`, so an app's single class overrides them.
2035
2101
  */
2036
2102
 
2103
+ /*
2104
+ * A card header's trailing element and its pull toward the edge lay out for icon buttons at their
2105
+ * default size: a density set around them stays outside (`base/density.css`). The rule adds no
2106
+ * specificity.
2107
+ */
2108
+ :where(.rio-card__trailing) {
2109
+ --rio-density: 0;
2110
+ }
2111
+
2037
2112
  .rio-card {
2038
2113
  --_container: var(--rio-color-surface-container-highest);
2039
2114
  --_elevation: var(--rio-elevation-level0);
@@ -2224,9 +2299,10 @@ span.rio-icon > * {
2224
2299
  * which match the spec page. The checkmark is Material Web's: two bars that turn from the
2225
2300
  * checkmark's lowest point, and lie flat, one over the other, for the indeterminate dash.
2226
2301
  *
2227
- * The root lays out at the 48px target. It carries `data-selected` ('true' or 'false'),
2228
- * `data-indeterminate`, `data-error`, and `data-disabled`. The invisible input over it takes the
2229
- * presses; the ripple marks it and the state circle with `data-pressed`.
2302
+ * The root lays out at the 48px target, or in less room with density. It carries `data-selected`
2303
+ * ('true' or 'false'), `data-indeterminate`, `data-error`, and `data-disabled`. The invisible input
2304
+ * over it, 48px across, takes the presses; the ripple marks it and the state circle with
2305
+ * `data-pressed`.
2230
2306
  *
2231
2307
  * Colors: primary and on-primary go through the accent variables (`base/accent.css`), which a
2232
2308
  * `color` prop sets, with primary's roles as the fallbacks. The error state keeps error's.
@@ -2242,6 +2318,9 @@ span.rio-icon > * {
2242
2318
  --_state-layer: var(--rio-color-on-surface);
2243
2319
  --_state-layer-pressed: var(--rio-accent, var(--rio-color-primary));
2244
2320
 
2321
+ /* Density (`base/density.css`): 4px less room and a 4px smaller state circle per step */
2322
+ --_density: clamp(-3, var(--rio-density, 0), 0);
2323
+
2245
2324
  position: relative;
2246
2325
  /* Keeps the input's z-index inside, rather than over what the page stacks above the
2247
2326
  checkbox, such as a sticky app bar, where the input would take the presses. */
@@ -2250,8 +2329,8 @@ span.rio-icon > * {
2250
2329
  flex: none;
2251
2330
  align-items: center;
2252
2331
  justify-content: center;
2253
- inline-size: 48px;
2254
- block-size: 48px;
2332
+ inline-size: calc(48px + 4px * var(--_density));
2333
+ block-size: calc(48px + 4px * var(--_density));
2255
2334
  vertical-align: middle;
2256
2335
  -webkit-tap-highlight-color: transparent;
2257
2336
  }
@@ -2287,13 +2366,15 @@ span.rio-icon > * {
2287
2366
 
2288
2367
  .rio-checkbox__input {
2289
2368
  position: absolute;
2290
- inset: 0;
2369
+ /* The 48px target, centered, past the room a density leaves. Physical, like `translate`: a
2370
+ logical start would flip right to left and move the target off the checkbox. */
2371
+ top: 50%;
2372
+ left: 50%;
2291
2373
  z-index: 1;
2292
- /* WebKit keeps a native checkbox at its own size between the insets; the size stretches it over
2293
- the target. */
2294
- inline-size: 100%;
2295
- block-size: 100%;
2374
+ inline-size: 48px;
2375
+ block-size: 48px;
2296
2376
  margin: 0;
2377
+ translate: -50% -50%;
2297
2378
  opacity: 0;
2298
2379
  cursor: pointer;
2299
2380
  }
@@ -2302,11 +2383,11 @@ span.rio-icon > * {
2302
2383
  cursor: default;
2303
2384
  }
2304
2385
 
2305
- /* The 40px circle: the state layer on ::before, the ripple on ::after */
2386
+ /* The 40px circle, less with density: the state layer on ::before, the ripple on ::after */
2306
2387
  .rio-checkbox__state {
2307
2388
  position: absolute;
2308
- inline-size: 40px;
2309
- block-size: 40px;
2389
+ inline-size: calc(40px + 4px * var(--_density));
2390
+ block-size: calc(40px + 4px * var(--_density));
2310
2391
  border-radius: var(--rio-shape-corner-full);
2311
2392
  color: var(--_state-layer);
2312
2393
  pointer-events: none;
@@ -2475,10 +2556,11 @@ span.rio-icon > * {
2475
2556
  * Material 3 v34.0.21) match.
2476
2557
  *
2477
2558
  * The root carries `data-type`, plus `data-selected`, `data-elevated`, `data-icon`, `data-avatar`,
2478
- * `data-trailing`, `data-remove-only`, and `data-disabled`, as core's chip parts set them. The
2479
- * state part draws the state layer and the ripple over the whole chip in its own color, so a press
2480
- * can show the color it leads to. Type and state rules sit inside `:where()`, so the disabled rules
2481
- * always win.
2559
+ * `data-trailing`, `data-removable`, `data-remove-only`, and `data-disabled`, as core's chip parts
2560
+ * set them. A removable filter chip lays out as an input chip: its toggle, then its remove button.
2561
+ * The state part draws the state layer and the ripple over the whole chip in its own color, so a
2562
+ * press can show the color it leads to. Type and state rules sit inside `:where()`, so the disabled
2563
+ * rules always win.
2482
2564
  *
2483
2565
  * Colors: primary and secondary container, and on-secondary container, go through the accent
2484
2566
  * variables (`base/accent.css`), which a `color` prop sets on the chip or its set, with the spec's
@@ -2499,6 +2581,9 @@ span.rio-icon > * {
2499
2581
  /* The spec's paddings from the container's edge; the border, always 1px, takes its share. */
2500
2582
  --_start: 16px;
2501
2583
  --_end: 16px;
2584
+ /* Density (`base/density.css`): 4px less height per step, down to 24px */
2585
+ --_density: clamp(-2, var(--rio-density, 0), 0);
2586
+ --_height: calc(32px + 4px * var(--_density));
2502
2587
 
2503
2588
  position: relative;
2504
2589
  isolation: isolate;
@@ -2506,7 +2591,7 @@ span.rio-icon > * {
2506
2591
  align-items: center;
2507
2592
  gap: 8px;
2508
2593
  box-sizing: border-box;
2509
- block-size: 32px;
2594
+ block-size: var(--_height);
2510
2595
  margin: 0;
2511
2596
  padding-block: 0;
2512
2597
  padding-inline: calc(var(--_start) - 1px) calc(var(--_end) - 1px);
@@ -2546,6 +2631,11 @@ span.rio-icon > * {
2546
2631
  --_end: 8px;
2547
2632
  }
2548
2633
 
2634
+ /* A removable filter chip's remove button sits 8px from the end too. */
2635
+ .rio-chip:where([data-removable]) {
2636
+ --_end: 8px;
2637
+ }
2638
+
2549
2639
  /* An unselected filter chip's press shows the selected chip's color, and the other way round. */
2550
2640
  .rio-chip:where([data-type='filter']) {
2551
2641
  --_pressed: var(--rio-on-accent-container, var(--rio-color-on-secondary-container));
@@ -2557,6 +2647,8 @@ span.rio-icon > * {
2557
2647
 
2558
2648
  .rio-chip:where([data-avatar]) {
2559
2649
  --_start: 4px;
2650
+ /* The 24px avatar keeps 1px around it, inside the border: it stops at -1. */
2651
+ --_density: clamp(-1, var(--rio-density, 0), 0);
2560
2652
  }
2561
2653
 
2562
2654
  .rio-chip:where([data-trailing]) {
@@ -2655,7 +2747,7 @@ span.rio-icon > * {
2655
2747
 
2656
2748
  /* Parts */
2657
2749
 
2658
- /* The chip is 32px tall, below the spec's 48px minimum target. */
2750
+ /* The chip is 32px tall, or 24px with density, below the spec's 48px minimum target. */
2659
2751
  /* The state layer on ::before and the ripple on ::after, over the border too */
2660
2752
  .rio-chip__state {
2661
2753
  position: absolute;
@@ -2723,13 +2815,14 @@ span.rio-icon > * {
2723
2815
  object-fit: cover;
2724
2816
  }
2725
2817
 
2726
- /* The input chip's action holds the start of the chip, so a press there reaches it. With an action
2727
- of its own, the chip is at least 88px wide, so the remove button's 48px target leaves it room. */
2728
- .rio-chip:where([data-type='input']) {
2818
+ /* The action of an input chip, or of a removable filter chip, holds the start of the chip, so a
2819
+ press there reaches it. With an action of its own, the chip is at least 88px wide, so the remove
2820
+ button's 48px target leaves it room. */
2821
+ .rio-chip:where([data-type='input'], [data-removable]) {
2729
2822
  padding-inline-start: 0;
2730
2823
  }
2731
2824
 
2732
- .rio-chip:where([data-type='input']):not([data-remove-only]) {
2825
+ .rio-chip:where([data-type='input'], [data-removable]):not([data-remove-only]) {
2733
2826
  min-inline-size: 88px;
2734
2827
  }
2735
2828
 
@@ -2772,7 +2865,8 @@ span.rio-icon > * {
2772
2865
  .rio-chip__remove::before {
2773
2866
  content: '';
2774
2867
  position: absolute;
2775
- inset: -3px;
2868
+ /* A 24px circle, or as tall as the room inside a denser chip's border */
2869
+ inset: max(-3px, calc((20px - var(--_height)) / 2));
2776
2870
  border-radius: inherit;
2777
2871
  background-color: currentColor;
2778
2872
  opacity: 0;
@@ -2802,9 +2896,10 @@ span.rio-icon > * {
2802
2896
  .rio-chip-set[data-scroll] {
2803
2897
  flex-wrap: nowrap;
2804
2898
  overflow-x: auto;
2805
- /* Room for the focus rings, which the scrolling would cut off */
2806
- margin: -6px;
2807
- padding: 6px;
2899
+ /* Room for the focus rings, which the scrolling would cut off, and above and below for the 48px
2900
+ targets of the shortest chips */
2901
+ margin: -12px -6px;
2902
+ padding: 12px 6px;
2808
2903
  scrollbar-width: none;
2809
2904
  }
2810
2905
 
@@ -2841,6 +2936,14 @@ span.rio-icon > * {
2841
2936
  * (`base/accent.css`), which a `color` prop sets, with primary as the fallback. Error keeps its own.
2842
2937
  */
2843
2938
 
2939
+ /*
2940
+ * The leading and trailing icon places lay out for icon buttons at their default size: a density
2941
+ * set around them stays outside (`base/density.css`). The rule adds no specificity.
2942
+ */
2943
+ :where(.rio-text-field__leading-icon, .rio-text-field__trailing-icon) {
2944
+ --rio-density: 0;
2945
+ }
2946
+
2844
2947
  .rio-text-field {
2845
2948
  --_leading-space: 16px;
2846
2949
  --_trailing-space: 16px;
@@ -2848,10 +2951,12 @@ span.rio-icon > * {
2848
2951
  /* Where the label's text starts, measured from the container's edge */
2849
2952
  --_label-start: var(--_leading-space);
2850
2953
  --_label-float-start: var(--_label-start);
2851
- --_label-float-top: 8px;
2954
+ /* Density (`base/density.css`): 4px less height per step, 2px above the text and 2px below */
2955
+ --_density: clamp(-3, var(--rio-density, 0), 0);
2956
+ --_label-float-top: calc(8px + 2px * var(--_density));
2852
2957
 
2853
2958
  /* The label resting in the field. The rule for the label at the top changes these. */
2854
- --_label-top: 16px;
2959
+ --_label-top: calc(16px + 2px * var(--_density));
2855
2960
  --_label-x: var(--_label-start);
2856
2961
  --_label-size: var(--rio-typescale-body-large-size);
2857
2962
  --_label-line-height: var(--rio-typescale-body-large-line-height);
@@ -3028,18 +3133,32 @@ span.rio-icon > * {
3028
3133
  gap: var(--_icon-gap);
3029
3134
  box-sizing: border-box;
3030
3135
  min-inline-size: 0;
3031
- min-block-size: 56px;
3136
+ min-block-size: calc(56px + 4px * var(--_density));
3032
3137
  padding-inline: var(--_leading-space) var(--_trailing-space);
3033
3138
  border-radius: inherit;
3034
3139
  cursor: text;
3035
3140
  }
3036
3141
 
3142
+ /* A container that density makes shorter than the 48px target takes presses just above and below
3143
+ it too. Behind the content, so the input keeps its own presses. */
3144
+ .rio-text-field__container::after {
3145
+ content: '';
3146
+ position: absolute;
3147
+ inset-inline: 0;
3148
+ inset-block: min(0px, calc((100% - 48px) / 2));
3149
+ z-index: -1;
3150
+ }
3151
+
3037
3152
  /*
3038
3153
  * A text area can be made taller from the corner, but never shorter than its rows:
3039
- * the container's part sets `--rio-text-field-rows`, and the content's padding is 32px in all.
3154
+ * the container's part sets `--rio-text-field-rows`, and the content's padding is 32px in all. With
3155
+ * density, a text area stops at 48px: the container clips what reaches past it, the target too.
3040
3156
  */
3041
3157
  .rio-text-field[data-multiline] .rio-text-field__container {
3042
- min-block-size: calc(var(--rio-text-field-rows, 3) * 1lh + 32px);
3158
+ min-block-size: max(
3159
+ 48px,
3160
+ calc(var(--rio-text-field-rows, 3) * 1lh + 32px + 4px * var(--_density))
3161
+ );
3043
3162
  }
3044
3163
 
3045
3164
  .rio-text-field[data-multiline]:not([data-disabled]) .rio-text-field__container {
@@ -3157,22 +3276,21 @@ span.rio-icon > * {
3157
3276
  block-size: 24px;
3158
3277
  }
3159
3278
 
3160
- /* An icon button's icon lines up where a plain icon would. */
3161
- .rio-text-field__leading-icon:has(> .rio-icon-button) {
3162
- margin-inline-start: -8px;
3163
- }
3164
-
3279
+ /* An icon button's icon lines up where a plain icon would, and the text where it would beside one:
3280
+ the button reaches 8px past its icon at either side, as wide in the row as the icon. */
3281
+ .rio-text-field__leading-icon:has(> .rio-icon-button),
3165
3282
  .rio-text-field__trailing-icon:has(> .rio-icon-button) {
3166
- margin-inline-end: -8px;
3283
+ margin-inline: -8px;
3167
3284
  }
3168
3285
 
3169
- /* A text area's container clips what reaches past it, so a focus ring stays 1px further in. */
3286
+ /* A text area's container clips what reaches past it, so a focus ring stays 1px further in, and
3287
+ the button 1px further toward the text, which stays where it was. */
3170
3288
  .rio-text-field[data-multiline] .rio-text-field__leading-icon:has(> .rio-icon-button) {
3171
- margin-inline-start: -7px;
3289
+ margin-inline: -7px -9px;
3172
3290
  }
3173
3291
 
3174
3292
  .rio-text-field[data-multiline] .rio-text-field__trailing-icon:has(> .rio-icon-button) {
3175
- margin-inline-end: -7px;
3293
+ margin-inline: -9px -7px;
3176
3294
  }
3177
3295
 
3178
3296
  /* The label, prefix, input, and suffix */
@@ -3183,12 +3301,17 @@ span.rio-icon > * {
3183
3301
  align-self: stretch;
3184
3302
  align-items: center;
3185
3303
  min-inline-size: 0;
3186
- padding-block: 16px;
3304
+ padding-block: calc(16px + 2px * var(--_density));
3305
+ }
3306
+
3307
+ /* A filled label sits above the input, so the input moves down. With density, it keeps room for
3308
+ both: it stops at -1. */
3309
+ .rio-text-field[data-variant='filled'][data-label] {
3310
+ --_density: clamp(-1, var(--rio-density, 0), 0);
3187
3311
  }
3188
3312
 
3189
- /* A filled label sits above the input, so the input moves down. */
3190
3313
  .rio-text-field[data-variant='filled'][data-label] .rio-text-field__content {
3191
- padding-block: 24px 8px;
3314
+ padding-block: calc(24px + 2px * var(--_density)) calc(8px + 2px * var(--_density));
3192
3315
  }
3193
3316
 
3194
3317
  .rio-text-field[data-multiline] .rio-text-field__content {
@@ -3351,6 +3474,15 @@ textarea.rio-text-field__input {
3351
3474
  * fallbacks. The buttons inside take the accent too.
3352
3475
  */
3353
3476
 
3477
+ /*
3478
+ * A density set around the calendar stays outside it, docked or in a dialog: what is inside lays
3479
+ * out at its default, unless it sets its own (`base/density.css`). The field a docked picker opens
3480
+ * from takes the density around it. The rule adds no specificity.
3481
+ */
3482
+ :where(.rio-date-picker__menu, .rio-date-picker__calendar) {
3483
+ --rio-density: 0;
3484
+ }
3485
+
3354
3486
  .rio-date-picker {
3355
3487
  display: inline-flex;
3356
3488
  flex-direction: column;
@@ -3853,6 +3985,14 @@ textarea.rio-text-field__input {
3853
3985
  * between buttons. The scrim's color and 32% opacity come from `_md-comp-scrim.scss`.
3854
3986
  */
3855
3987
 
3988
+ /*
3989
+ * A density set around the dialog stays outside it: what is inside lays out at its default,
3990
+ * unless it sets its own (`base/density.css`). The rule adds no specificity.
3991
+ */
3992
+ :where(.rio-dialog) {
3993
+ --rio-density: 0;
3994
+ }
3995
+
3856
3996
  /* How much of the container shows, from the top: it expands as the dialog opens. */
3857
3997
  @property --_dialog-reveal {
3858
3998
  syntax: '<percentage>';
@@ -4189,7 +4329,8 @@ textarea.rio-text-field__input {
4189
4329
  * M3 divider: a 1px line on outline variant, from the spec's divider tokens
4190
4330
  * (`md.comp.divider.*`). `createDivider` from `@rio-m3e/core` sets `data-orientation` and
4191
4331
  * `data-inset`: horizontal across what holds it, or vertical down a flex row it stretches in;
4192
- * full width, 16px in at the start, or 16px in at both ends.
4332
+ * full width, 16px in at the start, or 16px in at both ends. `--rio-divider-inset` sets another
4333
+ * inset, as one that lines up with text after an icon.
4193
4334
  */
4194
4335
 
4195
4336
  .rio-divider {
@@ -4202,11 +4343,11 @@ textarea.rio-text-field__input {
4202
4343
  }
4203
4344
 
4204
4345
  .rio-divider[data-inset='start'] {
4205
- margin-inline-start: 16px;
4346
+ margin-inline-start: var(--rio-divider-inset, 16px);
4206
4347
  }
4207
4348
 
4208
4349
  .rio-divider[data-inset='middle'] {
4209
- margin-inline: 16px;
4350
+ margin-inline: var(--rio-divider-inset, 16px);
4210
4351
  }
4211
4352
 
4212
4353
  .rio-divider[data-orientation='vertical'] {
@@ -4217,11 +4358,11 @@ textarea.rio-text-field__input {
4217
4358
  }
4218
4359
 
4219
4360
  .rio-divider[data-orientation='vertical'][data-inset='start'] {
4220
- margin-block-start: 16px;
4361
+ margin-block-start: var(--rio-divider-inset, 16px);
4221
4362
  }
4222
4363
 
4223
4364
  .rio-divider[data-orientation='vertical'][data-inset='middle'] {
4224
- margin-block: 16px;
4365
+ margin-block: var(--rio-divider-inset, 16px);
4225
4366
  }
4226
4367
 
4227
4368
  @media (forced-colors: active) {
@@ -4847,6 +4988,44 @@ textarea.rio-text-field__input {
4847
4988
  min-inline-size: 0;
4848
4989
  }
4849
4990
 
4991
+ /*
4992
+ * A divider under the item (`data-divider`), 1px of outline variant along its bottom edge, as the
4993
+ * divider's, straight across the round corners. Inset, 16px from the start and 24px from the end,
4994
+ * as the list's measurements give it; full, across.
4995
+ */
4996
+ .rio-list-item[data-divider] .rio-list-item__text::after {
4997
+ content: '';
4998
+ position: absolute;
4999
+ inset-block-end: 0;
5000
+ inset-inline: 16px 24px;
5001
+ border-block-end: 1px solid var(--rio-color-outline-variant);
5002
+ pointer-events: none;
5003
+ }
5004
+
5005
+ .rio-list-item[data-divider='full'] .rio-list-item__text::after {
5006
+ inset-inline: 0;
5007
+ }
5008
+
5009
+ /*
5010
+ * From the text: with neither inline inset set, it starts where it would sit in the text, so it
5011
+ * lines up with the text after a leading icon or avatar, or 16px in without one. As wide as the
5012
+ * item, it runs past the item's end, which clips it there; 24px from the end, it is as wide as the
5013
+ * room from the text's start, as `attachListItem` measures it, less 24px, and until then reaches
5014
+ * the end.
5015
+ */
5016
+ .rio-list-item:is([data-divider='text'], [data-divider='text-inset']) {
5017
+ clip-path: inset(0);
5018
+ }
5019
+
5020
+ .rio-list-item:is([data-divider='text'], [data-divider='text-inset']) .rio-list-item__text::after {
5021
+ inset-inline: auto;
5022
+ inline-size: 100%;
5023
+ }
5024
+
5025
+ .rio-list-item[data-divider='text-inset'] .rio-list-item__text::after {
5026
+ inline-size: calc(100% - var(--rio-list-item-text-start, 0px) - 24px);
5027
+ }
5028
+
4850
5029
  .rio-list-item__overline {
4851
5030
  color: var(--rio-color-on-surface-variant);
4852
5031
  font: var(--rio-typescale-label-small);
@@ -4965,9 +5144,9 @@ textarea.rio-text-field__input {
4965
5144
  * v34.0.21), which match the spec page. The ring and the dot are Material Web's: a 20px ring with
4966
5145
  * a 2px stroke, and a 10px dot that grows in when selected.
4967
5146
  *
4968
- * The root lays out at the 48px target. It carries `data-selected` ('true' or 'false') and
4969
- * `data-disabled`. The invisible input over it takes the presses; the ripple marks it and the
4970
- * state circle with `data-pressed`.
5147
+ * The root lays out at the 48px target, or in less room with density. It carries `data-selected`
5148
+ * ('true' or 'false') and `data-disabled`. The invisible input over it, 48px across, takes the
5149
+ * presses; the ripple marks it and the state circle with `data-pressed`.
4971
5150
  *
4972
5151
  * Colors: primary goes through the accent variables (`base/accent.css`), which a `color` prop sets
4973
5152
  * on the radio button or on its group, with primary as the fallback.
@@ -4988,6 +5167,9 @@ textarea.rio-text-field__input {
4988
5167
  --_state-layer: var(--rio-color-on-surface);
4989
5168
  --_state-layer-pressed: var(--rio-accent, var(--rio-color-primary));
4990
5169
 
5170
+ /* Density (`base/density.css`): 4px less room and a 4px smaller state circle per step */
5171
+ --_density: clamp(-3, var(--rio-density, 0), 0);
5172
+
4991
5173
  position: relative;
4992
5174
  /* Keeps the input's z-index inside, rather than over what the page stacks above the
4993
5175
  radio button, such as a sticky app bar, where the input would take the presses. */
@@ -4996,8 +5178,8 @@ textarea.rio-text-field__input {
4996
5178
  flex: none;
4997
5179
  align-items: center;
4998
5180
  justify-content: center;
4999
- inline-size: 48px;
5000
- block-size: 48px;
5181
+ inline-size: calc(48px + 4px * var(--_density));
5182
+ block-size: calc(48px + 4px * var(--_density));
5001
5183
  vertical-align: middle;
5002
5184
  -webkit-tap-highlight-color: transparent;
5003
5185
  }
@@ -5021,13 +5203,15 @@ textarea.rio-text-field__input {
5021
5203
 
5022
5204
  .rio-radio__input {
5023
5205
  position: absolute;
5024
- inset: 0;
5206
+ /* The 48px target, centered, past the room a density leaves. Physical, like `translate`: a
5207
+ logical start would flip right to left and move the target off the radio button. */
5208
+ top: 50%;
5209
+ left: 50%;
5025
5210
  z-index: 1;
5026
- /* WebKit keeps a native radio at its own size between the insets; the size stretches it over
5027
- the target. */
5028
- inline-size: 100%;
5029
- block-size: 100%;
5211
+ inline-size: 48px;
5212
+ block-size: 48px;
5030
5213
  margin: 0;
5214
+ translate: -50% -50%;
5031
5215
  opacity: 0;
5032
5216
  cursor: pointer;
5033
5217
  }
@@ -5036,11 +5220,11 @@ textarea.rio-text-field__input {
5036
5220
  cursor: default;
5037
5221
  }
5038
5222
 
5039
- /* The 40px circle: the state layer on ::before, the ripple on ::after */
5223
+ /* The 40px circle, less with density: the state layer on ::before, the ripple on ::after */
5040
5224
  .rio-radio__state {
5041
5225
  position: absolute;
5042
- inline-size: 40px;
5043
- block-size: 40px;
5226
+ inline-size: calc(40px + 4px * var(--_density));
5227
+ block-size: calc(40px + 4px * var(--_density));
5044
5228
  border-radius: var(--rio-shape-corner-full);
5045
5229
  color: var(--_state-layer);
5046
5230
  pointer-events: none;
@@ -5193,6 +5377,10 @@ textarea.rio-text-field__input {
5193
5377
  --_track-width: 52px;
5194
5378
  --_track-height: 32px;
5195
5379
  --_outline-width: 2px;
5380
+ /* Density (`base/density.css`): a 4px smaller state circle per step, down to 32px, so it still
5381
+ shows round the pressed handle; the track stays */
5382
+ --_density: clamp(-2, var(--rio-density, 0), 0);
5383
+ --_state-size: calc(40px + 4px * var(--_density));
5196
5384
 
5197
5385
  /* The handle's center, measured from the track's starting edge */
5198
5386
  --rio-switch-handle-x-off: calc(var(--_track-height) / 2);
@@ -5343,13 +5531,14 @@ textarea.rio-text-field__input {
5343
5531
  cursor: default;
5344
5532
  }
5345
5533
 
5346
- /* The 40px circle around the handle: the state layer on ::before, the ripple on ::after */
5534
+ /* The 40px circle around the handle, less with density: the state layer on ::before, the ripple on
5535
+ ::after */
5347
5536
  .rio-switch .rio-switch__state {
5348
5537
  position: absolute;
5349
- inset-inline-start: calc(var(--_handle-x) - 20px - var(--_outline-width));
5350
- inset-block-start: calc(50% - 20px);
5351
- inline-size: 40px;
5352
- block-size: 40px;
5538
+ inset-inline-start: calc(var(--_handle-x) - var(--_state-size) / 2 - var(--_outline-width));
5539
+ inset-block-start: calc(50% - var(--_state-size) / 2);
5540
+ inline-size: var(--_state-size);
5541
+ block-size: var(--_state-size);
5353
5542
  border-radius: var(--rio-shape-corner-full);
5354
5543
  color: var(--_state-layer);
5355
5544
  pointer-events: none;
@@ -5738,6 +5927,14 @@ textarea.rio-text-field__input {
5738
5927
  * slide beside the icon, and the label under it.
5739
5928
  */
5740
5929
 
5930
+ /*
5931
+ * The rail's menu button and its other buttons lay out for icon buttons at their default size: a
5932
+ * density set around them stays outside (`base/density.css`). The rule adds no specificity.
5933
+ */
5934
+ :where(.rio-navigation-rail) {
5935
+ --rio-density: 0;
5936
+ }
5937
+
5741
5938
  /* The rail in the layout: its room, and the container behind the content */
5742
5939
  .rio-navigation-rail {
5743
5940
  display: flex;
@@ -6856,6 +7053,14 @@ textarea.rio-text-field__input {
6856
7053
  * window's sides.
6857
7054
  */
6858
7055
 
7056
+ /*
7057
+ * The search bar's and the search view's buttons lay out for icon buttons at their default size: a
7058
+ * density set around them stays outside (`base/density.css`). The rule adds no specificity.
7059
+ */
7060
+ :where(.rio-search, .rio-search__view) {
7061
+ --rio-density: 0;
7062
+ }
7063
+
6859
7064
  .rio-search {
6860
7065
  display: block;
6861
7066
  min-inline-size: min(360px, 100%);
@@ -7812,7 +8017,8 @@ textarea.rio-text-field__input {
7812
8017
  * 4px either side.
7813
8018
  * - An action under the message: the message 16px from the end, and the buttons at the end, 4px
7814
8019
  * above the bottom edge.
7815
- * - In the window: 12px from its edges, at most 600px wide, centered or at the start edge. Core
8020
+ * - In the window: 12px from its edges, at most 600px wide, centered or at the start edge; across
8021
+ * a compact window, and in a wider one as wide as its message, up to 600px. Core
7816
8022
  * lifts it over the FABs, toolbars, and navigation bars under its place (`--rio-snackbar-lift`),
7817
8023
  * and keeps it to the width a navigation rail beside it leaves (`--rio-snackbar-clear-start` and
7818
8024
  * `--rio-snackbar-clear-end`); `offset` (`--rio-snackbar-offset`, 12px by default) sets the space
@@ -7823,6 +8029,14 @@ textarea.rio-text-field__input {
7823
8029
  * as the action is.
7824
8030
  */
7825
8031
 
8032
+ /*
8033
+ * A density set around the snackbar stays outside it: what is inside lays out at its default,
8034
+ * unless it sets its own (`base/density.css`). The rule adds no specificity.
8035
+ */
8036
+ :where(.rio-snackbar) {
8037
+ --rio-density: 0;
8038
+ }
8039
+
7826
8040
  /* The host: in the top layer, at the bottom of the window, as wide as the snackbar */
7827
8041
 
7828
8042
  .rio-snackbar-host {
@@ -7860,6 +8074,18 @@ textarea.rio-text-field__input {
7860
8074
  margin-inline: var(--_margin) auto;
7861
8075
  }
7862
8076
 
8077
+ /* Wider than a compact window, it is as wide as its message, which wraps past 600px. */
8078
+ @media (width >= 600px) {
8079
+ .rio-snackbar-host {
8080
+ inline-size: fit-content;
8081
+ max-inline-size: min(
8082
+ 600px,
8083
+ 100% - var(--rio-snackbar-clear-start, 0px) - var(--rio-snackbar-clear-end, 0px) - 2 *
8084
+ var(--_margin)
8085
+ );
8086
+ }
8087
+ }
8088
+
7863
8089
  /* Leaving, it takes no more presses: they reach the page under it. */
7864
8090
  .rio-snackbar-host:not(:popover-open) {
7865
8091
  opacity: 0;
@@ -8152,6 +8378,10 @@ textarea.rio-text-field__input {
8152
8378
  * `md.comp.secondary-navigation-tab.*`) and its measurements, read on m3.material.io. A tab's color
8153
8379
  * is its state layer's, which the tokens give apart from its content's: the content takes its own.
8154
8380
  * The indicator's motion is JavaScript (`attachTabs`).
8381
+ *
8382
+ * Colors: primary goes through the accent variables (`base/accent.css`), which a `color` prop sets
8383
+ * on the row, with primary as the fallback. A disabled tab draws its content and its indicator in
8384
+ * on-surface at the disabled opacity, without a state layer.
8155
8385
  */
8156
8386
 
8157
8387
  /* The row: the container, with its divider inside its bottom edge, under the indicator */
@@ -8205,17 +8435,20 @@ textarea.rio-text-field__input {
8205
8435
  */
8206
8436
  .rio-tab {
8207
8437
  --_content: var(--rio-color-on-surface-variant);
8208
- --_content-active: var(--rio-color-primary);
8438
+ --_content-active: var(--rio-accent, var(--rio-color-primary));
8209
8439
  --_content-state: var(--rio-color-on-surface);
8210
8440
  --_layer: var(--rio-color-on-surface);
8211
- --_layer-active: var(--rio-color-primary);
8212
- --_layer-pressed: var(--rio-color-primary);
8441
+ --_layer-active: var(--rio-accent, var(--rio-color-primary));
8442
+ --_layer-pressed: var(--rio-accent, var(--rio-color-primary));
8443
+ --_indicator: var(--rio-accent, var(--rio-color-primary));
8444
+ /* Density (`base/density.css`): 4px less height per step */
8445
+ --_density: clamp(-3, var(--rio-density, 0), 0);
8213
8446
 
8214
8447
  display: flex;
8215
8448
  justify-content: center;
8216
8449
  box-sizing: border-box;
8217
8450
  min-inline-size: 0;
8218
- min-block-size: 48px;
8451
+ min-block-size: calc(48px + 4px * var(--_density));
8219
8452
  margin: 0;
8220
8453
  padding: 0 16px;
8221
8454
  border: 0;
@@ -8229,8 +8462,11 @@ textarea.rio-text-field__input {
8229
8462
  -webkit-tap-highlight-color: transparent;
8230
8463
  }
8231
8464
 
8232
- /* Secondary: the content on surface while selected; the state layer on surface throughout */
8233
- .rio-tabs[data-variant='secondary'] .rio-tab {
8465
+ /*
8466
+ * Secondary: the content on surface while selected; the state layer on surface throughout. The
8467
+ * variant sits in `:where()`, so a disabled tab's colors win.
8468
+ */
8469
+ .rio-tabs:where([data-variant='secondary']) .rio-tab {
8234
8470
  --_content-active: var(--rio-color-on-surface);
8235
8471
  --_layer-active: var(--rio-color-on-surface);
8236
8472
  --_layer-pressed: var(--rio-color-on-surface);
@@ -8240,18 +8476,37 @@ textarea.rio-text-field__input {
8240
8476
  color: var(--_layer-active);
8241
8477
  }
8242
8478
 
8479
+ .rio-tab[data-disabled] {
8480
+ --_content: color-mix(
8481
+ in srgb,
8482
+ var(--rio-color-on-surface) calc(var(--rio-state-disabled-state-layer-opacity) * 100%),
8483
+ transparent
8484
+ );
8485
+ --_content-active: var(--_content);
8486
+ --_content-state: var(--_content);
8487
+ --_indicator: var(--_content);
8488
+
8489
+ cursor: default;
8490
+ }
8491
+
8243
8492
  .rio-tab:is(:active, [data-pressed]) {
8244
8493
  color: var(--_layer-pressed);
8245
8494
  }
8246
8495
 
8496
+ /* An icon over its label keeps room for both and the indicator: it stops at 56px. */
8247
8497
  .rio-tab[data-layout='stacked'] {
8248
- min-block-size: 64px;
8498
+ min-block-size: max(56px, calc(64px + 4px * var(--_density)));
8249
8499
  }
8250
8500
 
8251
8501
  .rio-tabs[data-scrollable] .rio-tab {
8252
8502
  min-inline-size: 90px;
8253
8503
  }
8254
8504
 
8505
+ /* A scrolling row clips what reaches past it: a tab's target stays as tall as the tab. */
8506
+ .rio-tabs[data-scrollable] .rio-tab__touch {
8507
+ block-size: 100%;
8508
+ }
8509
+
8255
8510
  /*
8256
8511
  * The icon, the label, and an inline badge, centered in the tab, as tall as it: the primary
8257
8512
  * indicator sits at its bottom, as wide as it is. It keeps within the tab's padding, the label
@@ -8354,7 +8609,7 @@ textarea.rio-text-field__input {
8354
8609
  inline-size: max(24px, calc(100% - 4px));
8355
8610
  block-size: 3px;
8356
8611
  border-radius: 3px 3px 0 0;
8357
- background-color: var(--rio-color-primary);
8612
+ background-color: var(--_indicator);
8358
8613
  opacity: 0;
8359
8614
  transform: translateX(-50%);
8360
8615
  pointer-events: none;
@@ -8380,6 +8635,14 @@ textarea.rio-text-field__input {
8380
8635
  background-color: Highlight;
8381
8636
  }
8382
8637
 
8638
+ .rio-tab[data-disabled] {
8639
+ --_content: GrayText;
8640
+ }
8641
+
8642
+ .rio-tab[data-disabled] .rio-tab__indicator {
8643
+ background-color: GrayText;
8644
+ }
8645
+
8383
8646
  /* Forced colors take shadows away: the divider is a border there. */
8384
8647
  .rio-tabs {
8385
8648
  border-block-end: 1px solid CanvasText;
@@ -8387,6 +8650,15 @@ textarea.rio-text-field__input {
8387
8650
  }
8388
8651
  }
8389
8652
 
8653
+ /* @rio-m3e/styles/theme-provider.css */
8654
+ /*
8655
+ * A theme for a part of the page: the element holds the theme's variables in its inline style and
8656
+ * lays out as if it weren't there, so what is inside sits in the layout around it.
8657
+ */
8658
+ .rio-theme-provider {
8659
+ display: contents;
8660
+ }
8661
+
8390
8662
  /* @rio-m3e/styles/time-picker.css */
8391
8663
  /*
8392
8664
  * M3 Expressive time pickers: the input time picker on the page; the scroll time picker on the
@@ -8418,6 +8690,14 @@ textarea.rio-text-field__input {
8418
8690
  * fallbacks. The buttons and scroll fields inside take the accent too.
8419
8691
  */
8420
8692
 
8693
+ /*
8694
+ * A density set around the time picker stays outside it: what is inside lays out at its default,
8695
+ * unless it sets its own (`base/density.css`). The rule adds no specificity.
8696
+ */
8697
+ :where(.rio-time-picker) {
8698
+ --rio-density: 0;
8699
+ }
8700
+
8421
8701
  .rio-time-picker {
8422
8702
  --_field-width: 100px;
8423
8703
  --_field-height: 120px;
@@ -8868,6 +9148,14 @@ textarea.rio-text-field__input {
8868
9148
  * scroll goes toward the end edge by `--rio-dir-sign` (`base/direction.css`).
8869
9149
  */
8870
9150
 
9151
+ /*
9152
+ * A toolbar's buttons, and its overflow button, lay out for icon buttons at their default size: a
9153
+ * density set around them stays outside (`base/density.css`). The rule adds no specificity.
9154
+ */
9155
+ :where(.rio-toolbar) {
9156
+ --rio-density: 0;
9157
+ }
9158
+
8871
9159
  .rio-toolbar {
8872
9160
  --_container: var(--rio-color-surface-container);
8873
9161
  --_content: var(--rio-color-on-surface-variant);