@eldrajs/ui 0.0.0 → 0.1.2

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 (205) hide show
  1. package/CHANGELOG.md +1725 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3177 -2
  4. package/dist/VariantPicker-CKw8hmxt.js +9009 -0
  5. package/dist/componentNames.d.ts +19 -0
  6. package/dist/components/accordion/Accordion.vue.d.ts +18 -0
  7. package/dist/components/accordion/AccordionItem.vue.d.ts +26 -0
  8. package/dist/components/accordion/context.d.ts +20 -0
  9. package/dist/components/accordion/detailsExclusivity.d.ts +3 -0
  10. package/dist/components/accordion/heightTransition.d.ts +59 -0
  11. package/dist/components/accordion/types.d.ts +40 -0
  12. package/dist/components/avatar/Avatar.vue.d.ts +10 -0
  13. package/dist/components/avatar/AvatarGroup.vue.d.ts +7 -0
  14. package/dist/components/avatar/types.d.ts +61 -0
  15. package/dist/components/badge/Badge.vue.d.ts +24 -0
  16. package/dist/components/badge/StockBadge.vue.d.ts +10 -0
  17. package/dist/components/badge/types.d.ts +79 -0
  18. package/dist/components/breadcrumb/Breadcrumb.vue.d.ts +10 -0
  19. package/dist/components/breadcrumb/types.d.ts +53 -0
  20. package/dist/components/button/Button.vue.d.ts +37 -0
  21. package/dist/components/button/ButtonGroup.vue.d.ts +17 -0
  22. package/dist/components/button/types.d.ts +68 -0
  23. package/dist/components/card/ContentCard.vue.d.ts +36 -0
  24. package/dist/components/card/FeatureCard.vue.d.ts +27 -0
  25. package/dist/components/card/cueArrow.d.ts +10 -0
  26. package/dist/components/card/stretchedLink.d.ts +45 -0
  27. package/dist/components/card/types.d.ts +92 -0
  28. package/dist/components/carousel/Carousel.vue.d.ts +39 -0
  29. package/dist/components/carousel/types.d.ts +75 -0
  30. package/dist/components/carousel/useCarousel.d.ts +152 -0
  31. package/dist/components/checkbox/Checkbox.vue.d.ts +36 -0
  32. package/dist/components/checkbox/CheckboxGroup.vue.d.ts +16 -0
  33. package/dist/components/checkbox/types.d.ts +78 -0
  34. package/dist/components/chip/Chip.vue.d.ts +37 -0
  35. package/dist/components/chip/ChipGroup.vue.d.ts +21 -0
  36. package/dist/components/chip/context.d.ts +22 -0
  37. package/dist/components/chip/types.d.ts +84 -0
  38. package/dist/components/container/Container.vue.d.ts +18 -0
  39. package/dist/components/container/types.d.ts +17 -0
  40. package/dist/components/currency-input/CurrencyInput.vue.d.ts +17 -0
  41. package/dist/components/currency-input/types.d.ts +8 -0
  42. package/dist/components/dialog/Dialog.vue.d.ts +34 -0
  43. package/dist/components/dialog/types.d.ts +25 -0
  44. package/dist/components/drawer/Drawer.vue.d.ts +36 -0
  45. package/dist/components/drawer/types.d.ts +30 -0
  46. package/dist/components/empty-state/EditorPlaceholder.vue.d.ts +9 -0
  47. package/dist/components/empty-state/EmptyState.vue.d.ts +28 -0
  48. package/dist/components/empty-state/types.d.ts +59 -0
  49. package/dist/components/field-wrapper/FieldError.vue.d.ts +37 -0
  50. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +30 -0
  51. package/dist/components/field-wrapper/context.d.ts +44 -0
  52. package/dist/components/field-wrapper/types.d.ts +38 -0
  53. package/dist/components/filter-panel/FilterGroup.vue.d.ts +48 -0
  54. package/dist/components/filter-panel/FilterPanel.vue.d.ts +77 -0
  55. package/dist/components/filter-panel/Histogram.vue.d.ts +15 -0
  56. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +12 -0
  57. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +12 -0
  58. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +20 -0
  59. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +12 -0
  60. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +12 -0
  61. package/dist/components/filter-panel/facets/shared.d.ts +39 -0
  62. package/dist/components/filter-panel/northwind.d.ts +32 -0
  63. package/dist/components/filter-panel/swatchInk.d.ts +50 -0
  64. package/dist/components/filter-panel/types.d.ts +183 -0
  65. package/dist/components/filter-panel/useFilterPanel.d.ts +230 -0
  66. package/dist/components/form-layout/FormLayout.vue.d.ts +36 -0
  67. package/dist/components/form-layout/context.d.ts +33 -0
  68. package/dist/components/form-layout/focusInvalid.d.ts +18 -0
  69. package/dist/components/form-layout/types.d.ts +52 -0
  70. package/dist/components/icon/Icon.vue.d.ts +8 -0
  71. package/dist/components/icon/types.d.ts +29 -0
  72. package/dist/components/image/Image.vue.d.ts +21 -0
  73. package/dist/components/image/types.d.ts +81 -0
  74. package/dist/components/input/Input.vue.d.ts +47 -0
  75. package/dist/components/input/classes.d.ts +110 -0
  76. package/dist/components/input/types.d.ts +55 -0
  77. package/dist/components/internal/ValueText.vue.d.ts +7 -0
  78. package/dist/components/lightbox/Lightbox.vue.d.ts +19 -0
  79. package/dist/components/lightbox/types.d.ts +47 -0
  80. package/dist/components/link/Link.vue.d.ts +23 -0
  81. package/dist/components/link/types.d.ts +40 -0
  82. package/dist/components/load-more/LoadMore.vue.d.ts +12 -0
  83. package/dist/components/load-more/types.d.ts +21 -0
  84. package/dist/components/logo-item/LogoItem.vue.d.ts +10 -0
  85. package/dist/components/logo-item/types.d.ts +37 -0
  86. package/dist/components/pagination/Pagination.vue.d.ts +15 -0
  87. package/dist/components/pagination/types.d.ts +51 -0
  88. package/dist/components/popover/Popover.vue.d.ts +31 -0
  89. package/dist/components/popover/types.d.ts +53 -0
  90. package/dist/components/price/Price.vue.d.ts +25 -0
  91. package/dist/components/price/types.d.ts +104 -0
  92. package/dist/components/product-card/ProductCard.vue.d.ts +22 -0
  93. package/dist/components/product-card/types.d.ts +123 -0
  94. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +26 -0
  95. package/dist/components/quantity-stepper/types.d.ts +35 -0
  96. package/dist/components/radio/RadioGroup.vue.d.ts +38 -0
  97. package/dist/components/radio/types.d.ts +39 -0
  98. package/dist/components/range-slider/RangeSlider.vue.d.ts +70 -0
  99. package/dist/components/range-slider/types.d.ts +151 -0
  100. package/dist/components/range-slider/useRangeSlider.d.ts +106 -0
  101. package/dist/components/rating/Rating.vue.d.ts +22 -0
  102. package/dist/components/rating/RatingStars.vue.d.ts +16 -0
  103. package/dist/components/rating/types.d.ts +45 -0
  104. package/dist/components/search-bar/SearchBar.vue.d.ts +47 -0
  105. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +93 -0
  106. package/dist/components/search-bar/shortcutOwner.d.ts +39 -0
  107. package/dist/components/search-bar/types.d.ts +122 -0
  108. package/dist/components/search-modal/SearchModal.vue.d.ts +53 -0
  109. package/dist/components/search-modal/types.d.ts +59 -0
  110. package/dist/components/section/Section.vue.d.ts +21 -0
  111. package/dist/components/section/context.d.ts +23 -0
  112. package/dist/components/section/types.d.ts +34 -0
  113. package/dist/components/select/MultiSelect.vue.d.ts +62 -0
  114. package/dist/components/select/Select.vue.d.ts +57 -0
  115. package/dist/components/select/SelectPanel.vue.d.ts +97 -0
  116. package/dist/components/select/openRegistry.d.ts +11 -0
  117. package/dist/components/select/panelParts.d.ts +91 -0
  118. package/dist/components/select/types.d.ts +129 -0
  119. package/dist/components/select/useListbox.d.ts +106 -0
  120. package/dist/components/select/useOptionList.d.ts +61 -0
  121. package/dist/components/select/usePopover.d.ts +147 -0
  122. package/dist/components/skeleton/Skeleton.vue.d.ts +12 -0
  123. package/dist/components/skeleton/types.d.ts +38 -0
  124. package/dist/components/spinner/Spinner.vue.d.ts +3 -0
  125. package/dist/components/switch/Switch.vue.d.ts +30 -0
  126. package/dist/components/switch/types.d.ts +20 -0
  127. package/dist/components/tabs/Tab.vue.d.ts +17 -0
  128. package/dist/components/tabs/TabPanel.vue.d.ts +16 -0
  129. package/dist/components/tabs/Tabs.vue.d.ts +28 -0
  130. package/dist/components/tabs/context.d.ts +48 -0
  131. package/dist/components/tabs/types.d.ts +63 -0
  132. package/dist/components/textarea/Textarea.vue.d.ts +27 -0
  133. package/dist/components/textarea/supportsFieldSizing.d.ts +10 -0
  134. package/dist/components/textarea/types.d.ts +32 -0
  135. package/dist/components/toast/Toast.vue.d.ts +16 -0
  136. package/dist/components/toast/Toaster.vue.d.ts +13 -0
  137. package/dist/components/toast/types.d.ts +44 -0
  138. package/dist/components/tooltip/Tooltip.vue.d.ts +9 -0
  139. package/dist/components/tooltip/supportsFocusVisible.d.ts +17 -0
  140. package/dist/components/tooltip/types.d.ts +46 -0
  141. package/dist/components/unit-input/UnitInput.vue.d.ts +55 -0
  142. package/dist/components/unit-input/types.d.ts +68 -0
  143. package/dist/components/unit-input/undo-redo.d.ts +6 -0
  144. package/dist/components/variant-picker/VariantPicker.vue.d.ts +15 -0
  145. package/dist/components/variant-picker/types.d.ts +49 -0
  146. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +18 -0
  147. package/dist/components/visually-hidden/types.d.ts +14 -0
  148. package/dist/composables/dialogStack.d.ts +52 -0
  149. package/dist/composables/teleportTarget.d.ts +79 -0
  150. package/dist/composables/useControllableModel.d.ts +16 -0
  151. package/dist/composables/useDialog.d.ts +84 -0
  152. package/dist/composables/useFloating.d.ts +82 -0
  153. package/dist/composables/useHeadingTag.d.ts +24 -0
  154. package/dist/composables/useLocale.d.ts +81 -0
  155. package/dist/composables/useMessages.d.ts +30 -0
  156. package/dist/composables/useOverlay.d.ts +88 -0
  157. package/dist/composables/useSlotPresence.d.ts +29 -0
  158. package/dist/composables/useToast.d.ts +53 -0
  159. package/dist/icons/paths.d.ts +10 -0
  160. package/dist/index.d.ts +135 -0
  161. package/dist/index.js +12587 -0
  162. package/dist/listFormat-1UrH38f2.js +39 -0
  163. package/dist/messages/en-US.d.ts +485 -0
  164. package/dist/messages/index.d.ts +2 -0
  165. package/dist/messages/is-IS.d.ts +16 -0
  166. package/dist/messages/is-IS.js +169 -0
  167. package/dist/resolver.d.ts +43 -0
  168. package/dist/resolver.js +121 -0
  169. package/dist/style.css +5259 -0
  170. package/dist/tailwind.css +2057 -0
  171. package/dist/tokens.css +134 -0
  172. package/dist/utils/avatar.d.ts +15 -0
  173. package/dist/utils/color.d.ts +11 -0
  174. package/dist/utils/cssTiming.d.ts +40 -0
  175. package/dist/utils/cx.d.ts +31 -0
  176. package/dist/utils/date.d.ts +45 -0
  177. package/dist/utils/id.d.ts +36 -0
  178. package/dist/utils/listFormat.d.ts +22 -0
  179. package/dist/utils/mask.d.ts +48 -0
  180. package/dist/utils/number-format.d.ts +250 -0
  181. package/dist/utils/numeric-input.d.ts +42 -0
  182. package/dist/utils/rating.d.ts +26 -0
  183. package/dist/utils/ratio.d.ts +18 -0
  184. package/dist/utils/tagRecipe.d.ts +24 -0
  185. package/dist/utils/valueFade.d.ts +42 -0
  186. package/dist/vee-validate/FieldCheckbox.vue.d.ts +14 -0
  187. package/dist/vee-validate/FieldCheckboxGroup.vue.d.ts +14 -0
  188. package/dist/vee-validate/FieldCurrencyInput.vue.d.ts +14 -0
  189. package/dist/vee-validate/FieldInput.vue.d.ts +14 -0
  190. package/dist/vee-validate/FieldMultiSelect.vue.d.ts +14 -0
  191. package/dist/vee-validate/FieldQuantityStepper.vue.d.ts +14 -0
  192. package/dist/vee-validate/FieldRadioGroup.vue.d.ts +14 -0
  193. package/dist/vee-validate/FieldSearchBar.vue.d.ts +14 -0
  194. package/dist/vee-validate/FieldSelect.vue.d.ts +14 -0
  195. package/dist/vee-validate/FieldSwitch.vue.d.ts +14 -0
  196. package/dist/vee-validate/FieldTextarea.vue.d.ts +14 -0
  197. package/dist/vee-validate/FieldUnitInput.vue.d.ts +14 -0
  198. package/dist/vee-validate/FieldVariantPicker.vue.d.ts +14 -0
  199. package/dist/vee-validate/Form.vue.d.ts +27 -0
  200. package/dist/vee-validate/context.d.ts +48 -0
  201. package/dist/vee-validate/index.d.ts +27 -0
  202. package/dist/vee-validate/types.d.ts +115 -0
  203. package/dist/vee-validate/useFieldControl.d.ts +67 -0
  204. package/dist/vee-validate.js +1154 -0
  205. package/package.json +99 -2
@@ -0,0 +1,2057 @@
1
+ /* Tailwind v4 theme for @eldrajs/ui. Every value is a --eldra-* variable from tokens.css, so a
2
+ consumer restyles by setting variables. Consumers with Tailwind import this file after
3
+ `@import 'tailwindcss'`; consumers without Tailwind use style.css.
4
+
5
+ Two kinds of value cannot be a variable and are written out here, nowhere else:
6
+ - container-query breakpoints, because a `@container (width < ...)` condition may not contain
7
+ `var()` — Tailwind inlines the `--container-*` value into the condition at build time;
8
+ - the spinner's own animation timings, which the spec fixes at 700ms (spin) and 1.2s (pulse). */
9
+ @import './tokens.css';
10
+ @source './';
11
+
12
+ @theme {
13
+ --color-*: initial;
14
+ --color-background: var(--eldra-color-background);
15
+ --color-surface: var(--eldra-color-surface);
16
+ --color-surface-strong: var(--eldra-color-surface-strong);
17
+ --color-border: var(--eldra-color-border);
18
+ --color-border-strong: var(--eldra-color-border-strong);
19
+ --color-text: var(--eldra-color-text);
20
+ --color-muted: var(--eldra-color-muted);
21
+ --color-primary: var(--eldra-color-primary);
22
+ --color-primary-contrast: var(--eldra-color-primary-contrast);
23
+ --color-accent: var(--eldra-color-accent);
24
+ --color-accent-contrast: var(--eldra-color-accent-contrast);
25
+ --color-success: var(--eldra-color-success);
26
+ --color-warning: var(--eldra-color-warning);
27
+ --color-danger: var(--eldra-color-danger);
28
+ --color-focus: var(--eldra-color-focus);
29
+ --color-focus-inner: var(--eldra-color-focus-inner);
30
+ --color-overlay: var(--eldra-color-overlay);
31
+ --color-transparent: transparent;
32
+ --color-current: currentColor;
33
+
34
+ --font-heading: var(--eldra-font-heading);
35
+ --font-body: var(--eldra-font-body);
36
+ --font-mono: var(--eldra-font-mono);
37
+
38
+ --spacing-*: initial;
39
+ --spacing: 0.25rem;
40
+ --spacing-1: var(--eldra-space-1);
41
+ --spacing-2: var(--eldra-space-2);
42
+ --spacing-3: var(--eldra-space-3);
43
+ --spacing-4: var(--eldra-space-4);
44
+ --spacing-5: var(--eldra-space-5);
45
+ --spacing-6: var(--eldra-space-6);
46
+ --spacing-8: var(--eldra-space-8);
47
+ --spacing-12: var(--eldra-space-12);
48
+ --spacing-16: var(--eldra-space-16);
49
+
50
+ --radius-*: initial;
51
+ --radius-sm: var(--eldra-radius-sm);
52
+ --radius-md: var(--eldra-radius-md);
53
+ --radius-lg: var(--eldra-radius-lg);
54
+ --radius-xl: var(--eldra-radius-xl);
55
+ --radius-full: var(--eldra-radius-full);
56
+
57
+ --shadow-*: initial;
58
+ --shadow-sm: var(--eldra-shadow-sm);
59
+ --shadow-md: var(--eldra-shadow-md);
60
+ --shadow-float: var(--eldra-shadow-float);
61
+
62
+ --ease-out: var(--eldra-ease-out);
63
+ --ease-in: var(--eldra-ease-in);
64
+
65
+ /* Container-query conditions cannot reference a custom property — `@container (width >=
66
+ var(--x))` is invalid CSS — so Tailwind requires a literal length in the `--container-*` theme
67
+ namespace before it emits `@narrow:`/`@content:`/`@wide:` variants at all. Shipping these three
68
+ as `var(--eldra-container-*)` (the tokens.css indirection every other value in this file uses)
69
+ compiled all three variants to nothing — no build error, no warning, just an absent rule — so
70
+ `Container`'s own `@content:px-[var(--eldra-gutter-desktop)]` desktop gutter, and every
71
+ starter block's own `@content:` layout, never engaged (bug, fixed 2026-09-27: see the README's
72
+ Deviations entry). The three literals below are `eldra-starter-spec/tokens.json`'s
73
+ `layout.container-{narrow,content,wide}` values, copied by hand — `scripts/build-tokens.mjs`
74
+ only ever emits a `var()`-holding `--eldra-*` custom property into `tokens.css`, never a
75
+ literal into this file, so it cannot generate this block for us —
76
+ `src/__tests__/containerQueryLiterals.spec.ts` asserts the two stay equal, catching the drift a
77
+ future token change could otherwise introduce silently.
78
+
79
+ This does not cost consumers runtime overridability of the three *widths*:
80
+ `--eldra-container-{narrow,content,wide}` in `tokens.css` are untouched, and `Container.vue`
81
+ reads them through its own `eldra-container-{narrow,content,wide}` utilities (declared further
82
+ down this file) rather than through Tailwind's auto-generated `max-w-narrow`/`-content`/
83
+ `-wide`. Those three still compile from the `--container-*` keys below — fine for an ad-hoc
84
+ `max-w-content` in a story or a consumer's own markup — but now to the *literal* number rather
85
+ than a `var()`, which would silently defeat `Container`'s own "a consumer restyles this by
86
+ setting a variable" contract were its width prop to keep reading them. */
87
+ --container-narrow: 40rem;
88
+ --container-content: 64rem;
89
+ --container-wide: 80rem;
90
+
91
+ /* In Tailwind v4 the `--container-*` namespace is the container-query breakpoint scale as well
92
+ as the width scale, so the three layout widths above already name the spec's `desktop`
93
+ (64rem, `--container-content`) and `wide` (80rem, `--container-wide`) breakpoints. The
94
+ mobile/tablet edge at 48rem has no layout width of its own, so it is named here: `@max-tablet`
95
+ is the spec's "narrower than 48rem", the breakpoint the spec's own "primary buttons grow to
96
+ `target-touch` below 48rem" rule would measure. `Button` no longer grows at any container
97
+ width (operator override, recorded under Deviations in the README), so nothing in this
98
+ package uses `@max-tablet` today — it stays declared for a future component that needs the
99
+ same edge. Declaring these keys does not disturb Tailwind's own `@sm`/`@md`/... container
100
+ scale — the theme never resets `--container-*`. */
101
+ --container-tablet: 48rem;
102
+
103
+ /* The two-column form layout's own edge (spec "Form layout" -> Sizes): "the form's container
104
+ >= 36rem", "measured on the containing block, so it works in narrow page-builder columns".
105
+ Like `--container-tablet` above it is a breakpoint with no layout width behind it, so it is
106
+ named here rather than borrowing whichever stock container key happens to be 36rem:
107
+ `@two-col:grid-cols-2` turns the pairs on, `@max-two-col:` is the spec's "narrow container
108
+ (< 36rem)" state, where the actions stack full width with the primary first. */
109
+ --container-two-col: 36rem;
110
+ }
111
+
112
+ /* `Container`'s own max-width utilities (spec "Container and section" → Sizes). `--eldra-
113
+ container-{narrow,content,wide}` (tokens.css, generated from `layout.container-*`) stay
114
+ `var()`-driven, unlike the `--container-*` breakpoint scale above whose values had to become
115
+ literals for the container-query engine — `max-width` accepts a `var()` just fine, so a consumer
116
+ still restyles a block's width by setting one of these three at runtime. `Container.vue` reads
117
+ these named utilities for its own width cap rather than Tailwind's auto-generated `max-w-narrow`/
118
+ `-content`/`-wide` (now literal numbers, from the `--container-*` keys above), which would
119
+ otherwise defeat that contract for the one place it actually matters. Each shares the stock
120
+ `max-w` merge group in `cx.ts`, alongside those three literal utilities, so a consumer's
121
+ `classes.root` override or `Container`'s own `full` (`max-w-none`) still replaces it outright. */
122
+ @utility eldra-container-narrow {
123
+ max-width: var(--eldra-container-narrow);
124
+ }
125
+ @utility eldra-container-content {
126
+ max-width: var(--eldra-container-content);
127
+ }
128
+ @utility eldra-container-wide {
129
+ max-width: var(--eldra-container-wide);
130
+ }
131
+
132
+ /* Type styles: one utility per spec style, e.g. `text-body-sm`. */
133
+ @utility text-display {
134
+ font: var(--eldra-text-display-weight) var(--eldra-text-display-size) /
135
+ var(--eldra-text-display-line) var(--eldra-text-display-family);
136
+ letter-spacing: var(--eldra-text-display-tracking);
137
+ }
138
+ @utility text-h1 {
139
+ font: var(--eldra-text-h1-weight) var(--eldra-text-h1-size) / var(--eldra-text-h1-line)
140
+ var(--eldra-text-h1-family);
141
+ letter-spacing: var(--eldra-text-h1-tracking);
142
+ }
143
+ @utility text-h2 {
144
+ font: var(--eldra-text-h2-weight) var(--eldra-text-h2-size) / var(--eldra-text-h2-line)
145
+ var(--eldra-text-h2-family);
146
+ letter-spacing: var(--eldra-text-h2-tracking);
147
+ }
148
+ @utility text-h3 {
149
+ font: var(--eldra-text-h3-weight) var(--eldra-text-h3-size) / var(--eldra-text-h3-line)
150
+ var(--eldra-text-h3-family);
151
+ letter-spacing: var(--eldra-text-h3-tracking);
152
+ }
153
+ @utility text-h4 {
154
+ font: var(--eldra-text-h4-weight) var(--eldra-text-h4-size) / var(--eldra-text-h4-line)
155
+ var(--eldra-text-h4-family);
156
+ letter-spacing: var(--eldra-text-h4-tracking);
157
+ }
158
+ @utility text-body-lg {
159
+ font: var(--eldra-text-body-lg-weight) var(--eldra-text-body-lg-size) /
160
+ var(--eldra-text-body-lg-line) var(--eldra-text-body-lg-family);
161
+ letter-spacing: var(--eldra-text-body-lg-tracking);
162
+ }
163
+ @utility text-body {
164
+ font: var(--eldra-text-body-weight) var(--eldra-text-body-size) / var(--eldra-text-body-line)
165
+ var(--eldra-text-body-family);
166
+ letter-spacing: var(--eldra-text-body-tracking);
167
+ }
168
+ @utility text-body-sm {
169
+ font: var(--eldra-text-body-sm-weight) var(--eldra-text-body-sm-size) /
170
+ var(--eldra-text-body-sm-line) var(--eldra-text-body-sm-family);
171
+ letter-spacing: var(--eldra-text-body-sm-tracking);
172
+ }
173
+ @utility text-caption {
174
+ font: var(--eldra-text-caption-weight) var(--eldra-text-caption-size) /
175
+ var(--eldra-text-caption-line) var(--eldra-text-caption-family);
176
+ letter-spacing: var(--eldra-text-caption-tracking);
177
+ }
178
+ @utility text-overline {
179
+ font: var(--eldra-text-overline-weight) var(--eldra-text-overline-size) /
180
+ var(--eldra-text-overline-line) var(--eldra-text-overline-family);
181
+ letter-spacing: var(--eldra-text-overline-tracking);
182
+ text-transform: uppercase;
183
+ }
184
+ @utility text-label {
185
+ font: var(--eldra-text-label-weight) var(--eldra-text-label-size) / var(--eldra-text-label-line)
186
+ var(--eldra-text-label-family);
187
+ letter-spacing: var(--eldra-text-label-tracking);
188
+ }
189
+ @utility text-code {
190
+ font: var(--eldra-text-code-weight) var(--eldra-text-code-size) / var(--eldra-text-code-line)
191
+ var(--eldra-text-code-family);
192
+ letter-spacing: var(--eldra-text-code-tracking);
193
+ }
194
+
195
+ /* Badge type (spec "Badge" → Sizes): "0.8125rem, weight 600, line-height 1, letter-spacing
196
+ 0.01em, no wrapping." The size and tracking already read the caption token exactly; the weight
197
+ reads the label token's 600 (the caption token's own weight is 400, which the badge does not
198
+ want); only the 1 line ratio has no token of its own, so — like `text-button-md`'s 1.2 — it is
199
+ a per-component variable with that literal default. */
200
+ @utility text-badge {
201
+ font: var(--eldra-text-label-weight) var(--eldra-text-caption-size) /
202
+ var(--eldra-badge-line-height, 1) var(--eldra-font-body);
203
+ letter-spacing: var(--eldra-text-caption-tracking);
204
+ }
205
+
206
+ /* The stock status line's own text (spec "Badge" → Sizes, "Status line text" row): "0.875rem,
207
+ weight 600." Both numbers already read tokens (`text-label-weight` is 600, `text-body-sm-size`
208
+ is 0.875rem); the spec gives no line ratio for this row, so — the same shape as
209
+ `text-card-title`'s 1.4 — it is a per-component variable with a literal default. Unlike the
210
+ badge text above, the status line is a short sentence rather than a tag, so it is allowed to
211
+ wrap on a narrow card rather than forcing `whitespace-nowrap`. */
212
+ @utility text-stock-status {
213
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-sm-size) /
214
+ var(--eldra-stock-status-line, 1.4) var(--eldra-font-body);
215
+ }
216
+
217
+ /* The Logo item wordmark fallback (spec "Logo item" → Sizes, "Wordmark" row): "heading family,
218
+ 1.25rem, weight 700, line-height 1.15, letter-spacing −0.01em." No shared type-scale token gives
219
+ that exact combination, but three of its four dimensions individually match ones that do:
220
+ `h1`/`h2`'s weight (700), `h2`'s line-height (1.15), `h3`'s tracking (−0.01em) — reused directly
221
+ rather than duplicated. Only the 1.25rem size has no token of its own, so — the same shape as
222
+ `Button`'s `--eldra-button-font-size-lg` — it is a per-component variable with that literal
223
+ default. */
224
+ @utility text-logo-wordmark {
225
+ font: var(--eldra-text-h2-weight) var(--eldra-logo-wordmark-size, 1.25rem) /
226
+ var(--eldra-text-h2-line) var(--eldra-text-h2-family);
227
+ letter-spacing: var(--eldra-text-h3-tracking);
228
+ }
229
+
230
+ /* --- Price -------------------------------------------------------------------------------- */
231
+
232
+ /* Price's root size (spec "Price" → Sizes): only `sm` and `lg` set an explicit font-size, on the
233
+ root rather than on `current` directly, because `compareAt`/`from` below need to read the same
234
+ size to compute their own 0.9em. `md`'s current price "inherits parent (1rem by default)" and
235
+ gets no utility of its own, so a `<Price size="md">` sitting inside a product-card title or a
236
+ cart line naturally matches whatever text surrounds it, exactly as the spec's own wording asks. */
237
+ @utility text-price-sm {
238
+ font-size: var(--eldra-price-current-sm-size, 0.9375rem);
239
+ }
240
+ @utility text-price-lg {
241
+ font-size: var(--eldra-price-current-lg-size, 1.5rem);
242
+ }
243
+
244
+ /* The current price (spec "Price" → Sizes): weight 600, tabular numerals, at the size the root
245
+ above sets or inherits. */
246
+ @utility text-price-current {
247
+ font-family: var(--eldra-font-body);
248
+ font-weight: var(--eldra-text-label-weight);
249
+ font-variant-numeric: tabular-nums;
250
+ }
251
+
252
+ /* The compare-at and "From" text (spec "Price" → Sizes, "Compare-at / From (0.9em)" column): 90%
253
+ of whatever size the root sets, weight 400. `0.9em` is the spec's own explicit multiplier, not a
254
+ rem magnitude with a token to reach for, so it is written literally — and it reproduces the
255
+ table's 0.84rem/0.9rem/1.35rem rows exactly (0.9 × 0.9375rem/1rem/1.5rem) from the one root size
256
+ rather than three more per-size variables. `tabular-nums` is harmless on "From" (no digits) and
257
+ required on the compare-at, which shares this utility (spec "Price" → Acceptance criteria:
258
+ "Numerals are tabular so prices align in lists"). */
259
+ @utility text-price-secondary {
260
+ font-family: var(--eldra-font-body);
261
+ font-size: 0.9em;
262
+ font-weight: var(--eldra-text-body-weight);
263
+ font-variant-numeric: tabular-nums;
264
+ }
265
+
266
+ /* The unit-price line (spec "Price" → Sizes, Unit column): "0.8125rem" at every size — the one
267
+ part of Price whose size does not scale with the root. Reuses the caption token's size exactly,
268
+ the same reuse `text-badge` makes. */
269
+ @utility text-price-unit {
270
+ font-family: var(--eldra-font-body);
271
+ font-size: var(--eldra-text-caption-size);
272
+ font-weight: var(--eldra-text-body-weight);
273
+ font-variant-numeric: tabular-nums;
274
+ }
275
+
276
+ /* --- Rating --------------------------------------------------------------------------------- */
277
+
278
+ /* A half star's filled overlay (spec "Rating" → Anatomy, part 1: "half-filled"; the API contract: "half
279
+ star via a clipped overlay"). Stacked absolutely over the same star's full outline icon
280
+ (`RatingStars.vue`), clipped to its own left half so the outline shows through the unfilled
281
+ half rather than leaving blank space. `50%`/`0` are the shape's own geometry, not a design
282
+ token — there is no "half" scale to register this against — so, like `eldra-variant-pill-
283
+ selected-line`'s inset line, it is a named utility purely so the one-off `clip-path` value has a
284
+ single documented home instead of an arbitrary bracket value repeated at the call site. */
285
+ @utility eldra-rating-half {
286
+ clip-path: inset(0 50% 0 0);
287
+ }
288
+
289
+ /* Button type (spec "Button" → Sizes): weight 600 on a 1.2 line at every size, with the size's
290
+ own font size. sm and md reuse the body-sm and body token sizes; lg's 1.0625rem sits between two
291
+ type styles and has no token, so it is a per-component variable with that default. */
292
+ @utility text-button-sm {
293
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-sm-size) /
294
+ var(--eldra-button-line-height, 1.2) var(--eldra-font-body);
295
+ }
296
+ @utility text-button-md {
297
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-size) /
298
+ var(--eldra-button-line-height, 1.2) var(--eldra-font-body);
299
+ }
300
+ @utility text-button-lg {
301
+ font: var(--eldra-text-label-weight) var(--eldra-button-font-size-lg, 1.0625rem) /
302
+ var(--eldra-button-line-height, 1.2) var(--eldra-font-body);
303
+ }
304
+
305
+ /* Compact-control type (spec "Actions and forms" → Compact controls, and "Input" → Sizes): the
306
+ text of a text input, textarea or select trigger, at body weight on the spec's fixed 1.5rem
307
+ line — not the body token's 1.6 ratio, which is a prose line and would make a 2.5rem box too
308
+ tall for its own text. sm and lg reuse the body-sm and body token sizes; md's 0.9375rem sits
309
+ between two type styles and has no token, so — like the button's lg size above — it is a
310
+ per-component variable with that default. `text-control-mobile` is the spec's viewport
311
+ exception: "Below a 48rem viewport the text of inputs … is 1rem, so iOS never zooms into a
312
+ focused field", applied as `max-md:text-control-mobile` (Tailwind's `md` *viewport* breakpoint
313
+ is 48rem, which is the edge the spec measures for this rule — a viewport query, not the block
314
+ `@max-tablet` container query the spec's own button touch-target growth would have measured). */
315
+ @utility text-control-sm {
316
+ font: var(--eldra-text-body-weight) var(--eldra-text-body-sm-size) /
317
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
318
+ }
319
+ @utility text-control {
320
+ font: var(--eldra-text-body-weight) var(--eldra-control-font-size, 0.9375rem) /
321
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
322
+ }
323
+ @utility text-control-lg {
324
+ font: var(--eldra-text-body-weight) var(--eldra-text-body-size) /
325
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
326
+ }
327
+ @utility text-control-mobile {
328
+ font: var(--eldra-text-body-weight) var(--eldra-control-font-size-mobile, 1rem) /
329
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
330
+ }
331
+
332
+ /* A field's character counter (spec "Textarea" → Sizes, Counter row): "0.8125rem, line-height
333
+ 1.5, tabular numerals, never wraps." The size reuses the caption token; the 1.5 ratio has no
334
+ token of its own (unlike the controls above, whose 1.5rem line is fixed, this one is the
335
+ button's kind of bare ratio), so — like `text-button-lg`'s font size — it is a per-component
336
+ variable with that literal default. Deliberately no `font-weight` here: the spec's over-limit
337
+ state needs `font-semibold` layered on top, and a shorthand `font` property here would fight a
338
+ separate `font-weight` utility for the same declaration depending on generation order, so the
339
+ component pairs this with the stock `font-normal`/`font-semibold` utilities instead. */
340
+ @utility text-counter {
341
+ font-family: var(--eldra-font-body);
342
+ font-size: var(--eldra-text-caption-size);
343
+ line-height: var(--eldra-counter-line-height, 1.5);
344
+ }
345
+
346
+ /* A field's help and error text (spec "Field wrapper" -> Sizes): both are 0.8125rem on a 1.45
347
+ line, and they differ only in weight and colour (help 400 `muted`, error 500 `danger`) — so
348
+ they share one type utility. The size reuses the caption token; the 1.45 ratio has no token of
349
+ its own, so — exactly like `text-counter` above — it is a per-component variable with that
350
+ literal default. Deliberately no `font-weight` here for the same reason `text-counter` has
351
+ none: the component pairs it with the stock `font-normal`/`font-medium` utilities, which are
352
+ unambiguously ordered against each other, rather than layering a `font-weight` utility over a
353
+ shorthand `font` declaration. */
354
+ @utility text-field-note {
355
+ font-family: var(--eldra-font-body);
356
+ font-size: var(--eldra-text-caption-size);
357
+ line-height: var(--eldra-field-note-line-height, 1.45);
358
+ }
359
+
360
+ /* A radio Card's title and meta (spec "Radio group" → Sizes, "Card title / hint / meta" row):
361
+ "1rem 600 (line-height 1.4)" for the title, and the same run again for the meta ("1rem 600
362
+ tabular, no wrap"), which pairs this with the stock `tabular-nums`/`whitespace-nowrap`
363
+ utilities rather than a second near-identical type utility. The weight and size both already
364
+ read a token (`text-label-weight` is 600, `text-body-size` is 1rem); only the 1.4 ratio has
365
+ none of its own, so — like `text-counter`'s 1.5 above — it is a per-component variable with
366
+ that literal default. The card's hint reuses `text-body-sm` `muted`, exactly as `Checkbox`'s
367
+ hint does. */
368
+ @utility text-card-title {
369
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-size) /
370
+ var(--eldra-radio-card-title-line, 1.4) var(--eldra-font-body);
371
+ }
372
+
373
+ /* Accordion's label (spec "Accordion" → Sizes, "Label" row): "1.0625rem / 1.4, weight 600" —
374
+ between `text-body` (1rem) and `text-h4` (1.125rem), no token of its own, so — the same shape as
375
+ `text-card-title` just above — it is its own utility reusing `--eldra-text-label-weight` (600)
376
+ and the body family, with the 1.4 line ratio as a per-component variable carrying that literal
377
+ default. */
378
+ @utility text-accordion-title {
379
+ font: var(--eldra-text-label-weight) 1.0625rem / var(--eldra-accordion-title-line, 1.4)
380
+ var(--eldra-font-body);
381
+ }
382
+
383
+ /* The Quantity stepper's value (spec "Quantity stepper" → Sizes): "0.9375rem, 600, tabular" at
384
+ `md`, "0.875rem" at `sm` (weight and line stay the same size only). The size matches
385
+ `text-control`/`text-control-sm` exactly, but the weight does not — `text-control`'s shorthand
386
+ bakes in `--eldra-text-body-weight` (400), and layering a `font-semibold` utility after a
387
+ shorthand `font` property is order-dependent (see `text-counter`'s own comment above) — so this
388
+ is its own utility rather than `text-control` plus an override, reusing `--eldra-text-label-
389
+ weight` (600) as `text-card-title` does for the same reason. */
390
+ @utility text-stepper-value {
391
+ font: var(--eldra-text-label-weight) var(--eldra-control-font-size, 0.9375rem) /
392
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
393
+ }
394
+ @utility text-stepper-value-sm {
395
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-sm-size) /
396
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
397
+ }
398
+
399
+ /* `FilterGroup`'s trigger label (spec "Filter panel" → Sizes, "Trigger" row): "0.9375rem weight
400
+ 600, left-aligned" — the same size and line as `text-control`, but that utility's shorthand
401
+ bakes in `--eldra-text-body-weight` (400) the same way `text-stepper-value`'s comment above
402
+ explains, so a trailing `font-semibold` is order-dependent rather than reliable. Its own
403
+ utility, reusing `--eldra-text-label-weight` (600), the same shape as `text-stepper-value`. */
404
+ @utility text-filter-trigger {
405
+ font: var(--eldra-text-label-weight) var(--eldra-control-font-size, 0.9375rem) /
406
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
407
+ }
408
+
409
+ /* `EmptyState`'s title (spec "Empty and error states" → Sizes, "Title" row): "heading family,
410
+ 1.25rem, line-height 1.3, weight 600" — between `text-h4` (1.125rem) and `text-h3` (1.5rem), so
411
+ it is its own utility rather than either. The weight is a literal spec number with no token of
412
+ its own (like `text-card-title`'s 600 above); the size and the 1.3 line ratio are both
413
+ per-component variables with that literal default, the same shape as `text-counter`'s 1.5 — see
414
+ the README's Customisation table for `--eldra-empty-state-title-size`. */
415
+ @utility text-empty-state-title {
416
+ font: var(--eldra-text-label-weight) var(--eldra-empty-state-title-size, 1.25rem) /
417
+ var(--eldra-empty-state-title-line, 1.3) var(--eldra-font-heading);
418
+ }
419
+
420
+ /* `ContentCard`'s title (spec "Content card" → Sizes, "Title" row): "heading family, 1.25rem,
421
+ line-height 1.3, weight 600, letter-spacing −0.01em" — the same size/line/weight/family
422
+ combination as `text-empty-state-title` just above, but with a tracking value that one has none
423
+ of, so it is its own utility rather than that one plus an arbitrary `tracking-*` alongside it.
424
+ The weight and tracking both already read tokens (`text-label-weight` is 600, `text-h3-tracking`
425
+ is −0.01em, reused directly the same way `text-logo-wordmark` reuses three `h2`/`h3` tokens at
426
+ once); the size and the 1.3 line ratio are both per-component variables with that literal
427
+ default — the same shape as `text-empty-state-title`'s own — see the README's Customisation
428
+ table for `--eldra-content-card-title-size`. */
429
+ @utility text-content-card-title {
430
+ font: var(--eldra-text-label-weight) var(--eldra-content-card-title-size, 1.25rem) /
431
+ var(--eldra-content-card-title-line, 1.3) var(--eldra-font-heading);
432
+ letter-spacing: var(--eldra-text-h3-tracking);
433
+ }
434
+
435
+ /* `ContentCard`'s excerpt and `FeatureCard`'s body (spec "Content card" → Sizes, "Excerpt" row:
436
+ "0.9375rem, clamp 3 lines"; "Feature card" → Sizes, "Body" row: "0.9375rem, `muted`") — the same
437
+ numeric size in both specs, reused as one utility across the two components rather than two
438
+ near-identical ones, the same "share when the numbers actually match" reuse `text-badge`/
439
+ `text-stock-status` make across their own components. Neither spec gives a line ratio for this
440
+ size, so — like `text-counter`'s 1.5 — it is a per-component variable with a literal default; a
441
+ readable paragraph ratio rather than a control's fixed line box, since both are prose. */
442
+ @utility text-content-card-excerpt {
443
+ font-family: var(--eldra-font-body);
444
+ font-size: var(--eldra-content-card-excerpt-size, 0.9375rem);
445
+ line-height: var(--eldra-content-card-excerpt-line, 1.5);
446
+ font-weight: var(--eldra-text-body-weight);
447
+ }
448
+
449
+ /* Control heights and targets. */
450
+ @utility control-h {
451
+ height: var(--eldra-control-height);
452
+ }
453
+ @utility control-h-sm {
454
+ height: var(--eldra-control-height-sm);
455
+ }
456
+ @utility control-h-lg {
457
+ height: var(--eldra-control-height-lg);
458
+ }
459
+ @utility target-min {
460
+ min-height: var(--eldra-target-min);
461
+ min-width: var(--eldra-target-min);
462
+ }
463
+ @utility target-touch {
464
+ min-height: var(--eldra-target-touch);
465
+ }
466
+
467
+ /* Motion. */
468
+ @utility duration-fast {
469
+ transition-duration: var(--eldra-duration-fast);
470
+ }
471
+ @utility duration-base {
472
+ transition-duration: var(--eldra-duration-base);
473
+ }
474
+ @utility duration-slow {
475
+ transition-duration: var(--eldra-duration-slow);
476
+ }
477
+
478
+ /* Accordion (spec "Accordion" → Behaviour & motion): "Chevron rotation: `duration-base` (200ms)
479
+ `ease-out`." self-conditioned on the ancestor `<details>`'s own native `[open]` attribute, so no
480
+ JS state is needed for it at all — `AccordionItem.vue` never touches this class beyond putting
481
+ it on the chevron `<svg>`. The reduced-motion override is baked into the utility itself, the
482
+ same shape as `eldra-focus`'s own `@media` block, rather than a `motion-reduce:` variant at the
483
+ call site: this is one bundled rule, not a component assembling stock `transition-*`/`duration-
484
+ *` pieces the way `Switch`'s track/thumb do. */
485
+ @utility eldra-accordion-chevron {
486
+ transition: rotate var(--eldra-duration-base) var(--eldra-ease-out);
487
+ details[open] & {
488
+ rotate: 180deg;
489
+ }
490
+ @media (prefers-reduced-motion: reduce) {
491
+ transition: none;
492
+ }
493
+ }
494
+
495
+ /* Accordion's panel (spec "Accordion" → Behaviour & motion): "Panel: fades in over `duration-base`
496
+ `ease-out` when opened." Deliberately an opacity fade only, not a height animation: the panel
497
+ `<div>` is a plain child of `<details>`, and its `display: none` while closed comes entirely
498
+ from the browser's own default rendering rule for `<details>` content
499
+ (`details:not([open]) > *:not(summary) { display: none; }`, the HTML spec's own UA style) —
500
+ nothing here touches or replaces that. `@starting-style` plus `transition-behavior: allow-
501
+ discrete` is the standard mechanism for animating *into* a value on an element whose `display`
502
+ toggles between `none` and its default (Chrome 117+, Safari 17.4+, Firefox 129+); everywhere
503
+ else the panel simply pops open, exactly like `<details>` always has, which is a fine
504
+ progressive-enhancement fallback and never a broken one.
505
+
506
+ A grid-rows height animation was the first design considered here and was rejected: making it
507
+ work at all requires overriding the panel's own `display` so it never actually leaves the
508
+ layout while "closed" (only collapsed to a zero-height row) — and the spec's own acceptance
509
+ criteria requires "Find-in-page finds text in closed panels and opens the item", which is a
510
+ `<details>`-specific browser feature keyed to the element's default closed-content hiding.
511
+ Overriding `display` to keep the row always rendered is exactly what would defeat that feature
512
+ in whichever engine implements it that way. This utility never sets `display` at all — only
513
+ `opacity` and `display`'s own place in the transition list — so the native hide/reveal (and
514
+ whatever a browser does with it for find-in-page) is completely untouched.
515
+
516
+ Operator override, 2026-09-26 ("the accordion should have some expand transition"):
517
+ `AccordionItem.vue` now also plays a *height* animation on the same panel element, through the
518
+ Web Animations API (`heightTransition.ts`) rather than CSS — it animates a measured pixel height
519
+ (`0` ↔ `scrollHeight`), never touches `display`, and needs no grid wrapper, so the find-in-page
520
+ argument above never applies to it. This utility is unchanged and keeps doing exactly what it
521
+ always did (the opacity fade); the two run side by side. See the README's Deviations entry for
522
+ the fuller account, including the exclusive-group sibling that still closes with no animation of
523
+ its own. */
524
+ @utility eldra-accordion-panel {
525
+ transition:
526
+ opacity var(--eldra-duration-base) var(--eldra-ease-out),
527
+ display var(--eldra-duration-base) allow-discrete;
528
+ @starting-style {
529
+ opacity: 0;
530
+ }
531
+ @media (prefers-reduced-motion: reduce) {
532
+ transition: none;
533
+ }
534
+ }
535
+
536
+ /* The Button spinner (spec "Button" → Behaviour & motion): it turns once every 700ms, linear,
537
+ without end; with reduced motion it pulses at 60-100% opacity over 1.2s instead of spinning.
538
+ These two timings are the spec's own and are the only durations in the package that do not read
539
+ `--eldra-duration-*` — the reduced-motion rule in tokens.css zeroes those, which would stop the
540
+ pulse as well. */
541
+ @keyframes eldra-spin {
542
+ to {
543
+ rotate: 360deg;
544
+ }
545
+ }
546
+ @keyframes eldra-pulse {
547
+ 0%,
548
+ 100% {
549
+ opacity: 0.6;
550
+ }
551
+ 50% {
552
+ opacity: 1;
553
+ }
554
+ }
555
+ @utility animate-eldra-spin {
556
+ animation: eldra-spin 700ms linear infinite;
557
+ }
558
+ @utility animate-eldra-pulse {
559
+ animation: eldra-pulse 1.2s var(--eldra-ease-out) infinite;
560
+ }
561
+
562
+ /* The skeleton shimmer (spec "Skeleton" → Behaviour & motion): "Shimmer sweeps left to right over
563
+ 1.4s, ease-out, infinitely… Reduced motion: shimmer removed; shapes are static." Shared
564
+ infrastructure rather than a `Price`-only rule: `Price`'s own loading state below is the first
565
+ consumer, and the `Skeleton` primitive (a later task) reuses this same utility for every shape.
566
+ The shape itself is a `surface-strong` fill (spec "Skeleton" → States, "Shape" row); the shimmer
567
+ is a `background`-coloured band at 60% strength (States, "Shimmer" row) that sweeps across it.
568
+ It is layered on with a `::after` that slides across rather than an animated
569
+ `background-position` on the shape's own fill, so the base fill and the moving highlight are
570
+ independent — reduced motion removes the highlight element outright (`display: none`) instead of
571
+ merely freezing it mid-sweep, which is what "shapes are static" asks for rather than an instant
572
+ jump to one frame of the animation. */
573
+ @keyframes eldra-shimmer {
574
+ from {
575
+ transform: translateX(-100%);
576
+ }
577
+ to {
578
+ transform: translateX(100%);
579
+ }
580
+ }
581
+ @utility eldra-skeleton {
582
+ position: relative;
583
+ overflow: hidden;
584
+ background-color: var(--color-surface-strong);
585
+ &::after {
586
+ content: '';
587
+ position: absolute;
588
+ inset: 0;
589
+ background: linear-gradient(
590
+ 90deg,
591
+ transparent,
592
+ color-mix(in oklab, var(--eldra-color-background), transparent 40%),
593
+ transparent
594
+ );
595
+ animation: eldra-shimmer 1.4s var(--eldra-ease-out) infinite;
596
+ }
597
+ @media (prefers-reduced-motion: reduce) {
598
+ &::after {
599
+ display: none;
600
+ }
601
+ }
602
+ }
603
+
604
+ /* A value that is still on screen while a fresher one is being fetched (`Price`, `StockBadge` and,
605
+ through them, `ProductCard`, with `revalidating` set): the value keeps its place and its text and
606
+ is drawn at `--eldra-revalidating-opacity`, with the spinner beside it left at full strength. Not
607
+ a literal `opacity-75`: the amount of the dim is a token a store restyles, like every other value
608
+ in this package. The default is the deepest dim at which every colour these values are drawn in
609
+ still clears 3:1 on every ground this package ships — deep enough to read as unsettled rather
610
+ than as settled text, and below 4.5:1 for everything but `text` while the read lasts (see
611
+ `eldra-starter-spec/tokens.json` for the numbers and for which way to move it). Registered in
612
+ `src/utils/cx.ts`'s `opacity` merge group, so a consumer's own `classes.current: 'opacity-100'`
613
+ replaces it rather than landing beside it.
614
+
615
+ The dim is only half of the treatment: the *change* is eased too. A changed amount, or a changed
616
+ stock line, fades in over `--eldra-duration-base` — played in JavaScript on the value's own inner
617
+ span (`src/utils/valueFade.ts`), not in CSS and not through a `<Transition>`, so the text itself
618
+ is never a frame behind the props. The fade is on that inner span rather than on the value part
619
+ for the same reason the dim is on the part: both are `opacity`, and one element cannot animate a
620
+ property another rule is holding at the token's value. */
621
+ @utility eldra-revalidating {
622
+ opacity: var(--eldra-revalidating-opacity);
623
+ }
624
+
625
+ /* Layers. */
626
+ @utility z-sticky {
627
+ z-index: var(--eldra-z-sticky);
628
+ }
629
+ /* A non-modal popup's layer (spec "Select" -> Sizes, Popover row): "Stacks above page content and
630
+ the sticky header (z-index 30; the sticky header is 20)." 30 sits between two tokens and has
631
+ none of its own, so — like `eldra-link-radius`'s 2px — it is a per-component variable with that
632
+ literal default here, and no literal reaches a component class. */
633
+ @utility z-popover {
634
+ z-index: var(--eldra-z-popover, 30);
635
+ }
636
+ @utility z-drawer {
637
+ z-index: var(--eldra-z-drawer);
638
+ }
639
+ @utility z-dialog {
640
+ z-index: var(--eldra-z-dialog);
641
+ }
642
+ @utility z-toast {
643
+ z-index: var(--eldra-z-toast);
644
+ }
645
+
646
+ /* The one focus ring (spec 1 "Focus ring"): 2px focus-inner infill hugging the element, 2px focus
647
+ ring outside it, arriving over duration-base. `eldra-focus` shows on :focus-visible; text fields
648
+ add `eldra-focus-always` so it shows on any focus. `eldra-focus-inset` draws both inside.
649
+
650
+ THE RING FADES IN AT FULL SIZE; IT DOES NOT GROW. The spec describes the ring "growing from 0 to
651
+ 2px over duration-base", and that is what this first shipped — an `outline-width` and a
652
+ `box-shadow` spread animating 0 -> 2px. It looks broken. A browser paints both at whole device
653
+ pixels, so a 2px growth has two or three distinct frames however long the transition runs, and a
654
+ 200ms stagger of three steps reads as a dropped-frame stutter rather than motion. Drawn at full
655
+ size and faded from alpha 0 to 1 the same 200ms is continuous, and the end state — the thing the
656
+ contrast requirements are about — is identical. Recorded under Deviations in the README.
657
+
658
+ The fade is driven by `--eldra-focus-alpha`, registered with `@property` above so it is a
659
+ `<number>` the engine can interpolate (an unregistered custom property is a token string and
660
+ jumps). Both ring colours are `color-mix(... calc(var(--eldra-focus-alpha) * 100%), transparent)`,
661
+ so one animated number fades both, and the frame-by-frame work is a colour change on a shadow
662
+ that never moves. Where `@property` is unsupported the alpha still switches 0 -> 1, so the ring
663
+ simply appears at full size — the same thing reduced motion asks for, never a missing ring.
664
+
665
+ The ring's geometry is one `box-shadow` pair rather than a shadow plus an `outline`: two spreads
666
+ off the same box stay locked together, and the shadow is what fades. `outline` stays at width 0
667
+ and is reinstated only under forced colours, where a UA drops `box-shadow` entirely — that rule
668
+ is static, because the system Highlight colour is not ours to fade.
669
+
670
+ Each mix reads `color-mix(in srgb, transparent, <colour> calc(...))` — transparent FIRST — on
671
+ purpose. Tailwind compiles every `color-mix()` with a plain fallback for engines that lack it,
672
+ and that fallback is the mix's first colour. Written the other way round the fallback is the
673
+ ring's colour at full strength, which paints a permanent black ring around every control in
674
+ those engines. This way the fallback is the resting state, and the `@supports not` block on each
675
+ focus selector draws the whole ring at once instead — the old behaviour minus the animation,
676
+ never a missing indicator.
677
+
678
+ `eldra-focus` and `eldra-focus-inset` OWN the transition list of the element they sit on, and a
679
+ component must not add a `transition-*`/`duration-*` utility beside them. `transition` is one
680
+ shorthand property: a `transition-[background-color] duration-fast` utility on the same element
681
+ is a later rule in the same layer, so it replaced the ring's entry outright and the ring arrived
682
+ instantly — silently, because the ring was still drawn. So the ring declares every property a
683
+ control in this package animates, each at the spec's duration for it: `duration-fast` for the
684
+ colour and press changes, `duration-base` for the ring's own alpha. Reduced motion is handled
685
+ here too, so components do not carry `motion-reduce:transition-none` either (it stays harmless
686
+ where a consumer adds it). `src/__tests__/focus-transition.spec.ts` fails a component that
687
+ breaks the rule. */
688
+ @property --eldra-focus-alpha {
689
+ syntax: '<number>';
690
+ inherits: false;
691
+ initial-value: 0;
692
+ }
693
+ @utility eldra-focus {
694
+ /* Width 0 in every colour mode but forced colours, where the ring below is dropped by the UA. */
695
+ outline: 0 solid transparent;
696
+ outline-offset: var(--eldra-focus-offset);
697
+ --eldra-focus-alpha: 0;
698
+ box-shadow:
699
+ 0 0 0 var(--eldra-focus-offset)
700
+ color-mix(
701
+ in srgb,
702
+ transparent,
703
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
704
+ ),
705
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
706
+ color-mix(
707
+ in srgb,
708
+ transparent,
709
+ var(--eldra-color-focus) calc(var(--eldra-focus-alpha) * 100%)
710
+ );
711
+ transition:
712
+ color var(--eldra-duration-fast) var(--eldra-ease-out),
713
+ background-color var(--eldra-duration-fast) var(--eldra-ease-out),
714
+ border-color var(--eldra-duration-fast) var(--eldra-ease-out),
715
+ text-decoration-color var(--eldra-duration-fast) var(--eldra-ease-out),
716
+ text-decoration-thickness var(--eldra-duration-fast) var(--eldra-ease-out),
717
+ translate var(--eldra-duration-fast) var(--eldra-ease-out),
718
+ scale var(--eldra-duration-fast) var(--eldra-ease-out),
719
+ opacity var(--eldra-duration-fast) var(--eldra-ease-out),
720
+ --eldra-focus-alpha var(--eldra-duration-base) var(--eldra-ease-out);
721
+ @media (prefers-reduced-motion: reduce) {
722
+ transition: none;
723
+ }
724
+ &:focus-visible {
725
+ --eldra-focus-alpha: 1;
726
+ @supports not (color: color-mix(in srgb, red, red)) {
727
+ box-shadow:
728
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
729
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus);
730
+ }
731
+ }
732
+ @media (forced-colors: active) {
733
+ &:focus-visible {
734
+ outline-width: var(--eldra-focus-width);
735
+ outline-color: Highlight;
736
+ }
737
+ }
738
+ }
739
+ @utility eldra-focus-always {
740
+ &:focus {
741
+ --eldra-focus-alpha: 1;
742
+ @supports not (color: color-mix(in srgb, red, red)) {
743
+ box-shadow:
744
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
745
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus);
746
+ }
747
+ }
748
+ @media (forced-colors: active) {
749
+ &:focus {
750
+ outline-width: var(--eldra-focus-width);
751
+ outline-color: Highlight;
752
+ }
753
+ }
754
+ }
755
+ /* The ring while a popup is open (operator request, 2026-09-25). A `Select` or `MultiSelect`
756
+ trigger opened with the *pointer* is focused but not `:focus-visible`, so the ring did not show —
757
+ and the control then had an open popover attached to a trigger with no visible indication that it
758
+ was the thing the keyboard was about to act on. The `SearchBar` has never had this problem: its
759
+ trigger is a text field, which carries `eldra-focus-always` and shows the ring on any focus.
760
+
761
+ A *modifier* of the same shape as `eldra-focus-always` and `eldra-focus-proxy` — it carries no
762
+ ring of its own, it only turns on the one `eldra-focus` already put on the element, keyed to the
763
+ state the element itself publishes in `aria-expanded`. So it never needs a second class to be
764
+ kept in sync, and closing the popup fades the ring back out over the transition `eldra-focus`
765
+ already owns rather than snapping it off. It carries no base, so it must never share a merge
766
+ group with `eldra-focus` (see `src/utils/cx.ts`): a modifier never shares a group with the thing
767
+ it modifies.
768
+
769
+ The forced-colours rule is repeated here for the same reason `eldra-focus-proxy` repeats it: the
770
+ one in `eldra-focus` is keyed to that element's own `:focus-visible`, which an open pointer-
771
+ opened trigger is not. */
772
+ @utility eldra-focus-open {
773
+ &[aria-expanded='true'] {
774
+ --eldra-focus-alpha: 1;
775
+ @supports not (color: color-mix(in srgb, red, red)) {
776
+ box-shadow:
777
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
778
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus);
779
+ }
780
+ }
781
+ @media (forced-colors: active) {
782
+ &[aria-expanded='true'] {
783
+ outline-width: var(--eldra-focus-width);
784
+ outline-color: Highlight;
785
+ }
786
+ }
787
+ }
788
+ /* Proxy focus (spec 1 "Focus ring" → Proxy focus): "When the focusable element is visually hidden
789
+ (the radio inside a size pill, the stretched link of a card), draw the ring on the visible shape
790
+ (the pill, the whole card), not on the hidden element."
791
+
792
+ Exactly the shape of `eldra-focus-always` above, and a *modifier* in the same way: it carries no
793
+ ring of its own, it only adds the rule that turns on the one `eldra-focus` already put on this
794
+ element. The difference is whose focus turns it on — a descendant's, not the element's own. So a
795
+ Checkbox writes `eldra-focus eldra-focus-proxy` on its drawn box and puts the `sr-only`
796
+ `<input>` inside it; the transition, the reduced-motion handling and the ring itself all still
797
+ live in `eldra-focus`, which is why the two must never share a merge group in `src/utils/cx.ts`.
798
+ The forced-colours rule is repeated here because the one in `eldra-focus` is keyed to that
799
+ element's own `:focus-visible`, which never happens on a box that is not focusable. */
800
+ @utility eldra-focus-proxy {
801
+ &:has(:focus-visible) {
802
+ --eldra-focus-alpha: 1;
803
+ @supports not (color: color-mix(in srgb, red, red)) {
804
+ box-shadow:
805
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
806
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus);
807
+ }
808
+ }
809
+ @media (forced-colors: active) {
810
+ &:has(:focus-visible) {
811
+ outline-width: var(--eldra-focus-width);
812
+ outline-color: Highlight;
813
+ }
814
+ }
815
+ }
816
+
817
+ /* The Link focus ring's corner radius (spec "Link" → Sizes): "2px for every variant." No radius
818
+ token is this small — radius-sm is 0.375rem, for badges and chips — so, like the button's
819
+ lg font size above, it is a per-component variable with a literal default and no token behind
820
+ it; a consumer restyles it with `--eldra-link-radius` on any ancestor. `box-shadow` and modern
821
+ `outline` both already follow an element's own `border-radius`, so this is enough to round both
822
+ rings the focus ring foundation draws. */
823
+ @utility eldra-link-radius {
824
+ border-radius: var(--eldra-link-radius, 2px);
825
+ }
826
+
827
+ /* The inset ring's "any focus" modifier, the exact counterpart of `eldra-focus-always` above and a
828
+ modifier in the same way: it carries no ring of its own. A select's search field is a text field,
829
+ and the focus-ring foundation's rule for those — "Text fields (Input, Textarea, Search bar, a
830
+ select's search field) show it on *any* focus, pointer included, because a caret alone is easy to
831
+ miss" — applies whether the ring is drawn outside the element or, as here, just inside it. */
832
+ @utility eldra-focus-inset-always {
833
+ &:focus {
834
+ --eldra-focus-alpha: 1;
835
+ @supports not (color: color-mix(in srgb, red, red)) {
836
+ box-shadow:
837
+ inset 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
838
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
839
+ var(--eldra-color-focus);
840
+ }
841
+ }
842
+ @media (forced-colors: active) {
843
+ &:focus {
844
+ outline-width: var(--eldra-focus-width);
845
+ outline-color: Highlight;
846
+ }
847
+ }
848
+ }
849
+
850
+ @utility eldra-focus-inset {
851
+ outline: 0 solid transparent;
852
+ outline-offset: calc(-1 * (var(--eldra-focus-width) + var(--eldra-focus-offset)));
853
+ --eldra-focus-alpha: 0;
854
+ box-shadow:
855
+ inset 0 0 0 var(--eldra-focus-offset)
856
+ color-mix(
857
+ in srgb,
858
+ transparent,
859
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
860
+ ),
861
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
862
+ color-mix(
863
+ in srgb,
864
+ transparent,
865
+ var(--eldra-color-focus) calc(var(--eldra-focus-alpha) * 100%)
866
+ );
867
+ transition:
868
+ color var(--eldra-duration-fast) var(--eldra-ease-out),
869
+ background-color var(--eldra-duration-fast) var(--eldra-ease-out),
870
+ border-color var(--eldra-duration-fast) var(--eldra-ease-out),
871
+ text-decoration-color var(--eldra-duration-fast) var(--eldra-ease-out),
872
+ text-decoration-thickness var(--eldra-duration-fast) var(--eldra-ease-out),
873
+ translate var(--eldra-duration-fast) var(--eldra-ease-out),
874
+ scale var(--eldra-duration-fast) var(--eldra-ease-out),
875
+ opacity var(--eldra-duration-fast) var(--eldra-ease-out),
876
+ --eldra-focus-alpha var(--eldra-duration-base) var(--eldra-ease-out);
877
+ @media (prefers-reduced-motion: reduce) {
878
+ transition: none;
879
+ }
880
+ &:focus-visible {
881
+ --eldra-focus-alpha: 1;
882
+ @supports not (color: color-mix(in srgb, red, red)) {
883
+ box-shadow:
884
+ inset 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
885
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
886
+ var(--eldra-color-focus);
887
+ }
888
+ }
889
+ @media (forced-colors: active) {
890
+ &:focus-visible {
891
+ outline-width: var(--eldra-focus-width);
892
+ outline-color: Highlight;
893
+ }
894
+ }
895
+ }
896
+
897
+ /* A field's own boundary (spec "Actions and forms" -> Compact controls: "1px `border-strong`
898
+ boundary"). The width is a variable rather than Tailwind's `border`, because the invalid inset
899
+ line below is inset by exactly this much and drawn exactly this thick: with `border` hard-wired
900
+ to 1px, setting `--eldra-field-border-width` moved the line without moving the border it sits
901
+ inside, and the two came apart. One variable now drives both. The literal default lives here,
902
+ not in a component class — the same shape as `eldra-link-radius` above. `border-style` comes
903
+ from Tailwind's preflight (`*, ::before, ::after { border: 0 solid }`), which both the
904
+ `tailwind.css` and the `style.css` route carry, so a width alone is a solid border and
905
+ `border-dashed` still wins where a component asks for one. */
906
+ @utility eldra-field-border {
907
+ border-width: var(--eldra-field-border-width, 1px);
908
+ }
909
+
910
+ /* The Checkbox box (spec "Checkbox" → Sizes: "Border | 1.5px", and → States, Error row: "**2px**
911
+ `danger`"). Neither number is a token — they are this component's own — so each is a variable
912
+ with a literal default here, the same shape as `eldra-link-radius` and `eldra-field-border`
913
+ above, and neither literal reaches a component class. They are two utilities rather than one
914
+ because the error state changes the width as well as the colour, and both sit in the `border-w`
915
+ merge group, so the error width replaces the ordinary one instead of landing beside it. */
916
+ @utility eldra-checkbox-border {
917
+ border-width: var(--eldra-checkbox-border-width, 1.5px);
918
+ }
919
+ @utility eldra-checkbox-border-invalid {
920
+ border-width: var(--eldra-checkbox-border-width-invalid, 2px);
921
+ }
922
+
923
+ /* `EditorPlaceholder`'s own boundary (spec "Empty and error states" → Sizes, "Editor hint" row:
924
+ "1.5px dashed border, `radius-lg`") — not a token, and a different number from the panel's own
925
+ `EmptyState` boundary (a stock `border` at 1px, spec's "Panel border and radius" row), so it
926
+ gets a variable of its own rather than reusing `eldra-checkbox-border`, the same shape as that
927
+ utility. `border-style: dashed` is a separate stock `border-dashed` utility on the component,
928
+ same as `EmptyState`'s panel. */
929
+ @utility eldra-editor-placeholder-border {
930
+ border-width: var(--eldra-editor-placeholder-border-width, 1.5px);
931
+ }
932
+
933
+ /* The error boundary of a field (spec "Input" → States, Error row): "2px `danger` (1px border +
934
+ 1px inset line). On focus the inset line sits inside the `focus-inner` infill."
935
+
936
+ Two things make that impossible to draw on the `<input>` itself. `eldra-focus` owns the
937
+ element's `box-shadow` (the focus infill) and its `outline` (the ring), and a second rule for
938
+ either would replace the ring rather than add to it; and an `<input>` is a replaced element, so
939
+ it has no `::after` to lend. So the inset line is drawn by the field's own wrapper — the one
940
+ element that shares the input's box exactly — as a pseudo-element inset by the input's border
941
+ width. Keeping the border at 1px in every state is the point: a 2px border would move the value
942
+ by 1px the moment the field went invalid. `pointer-events: none` keeps the clear button
943
+ clickable through it, and because the line is *inside* the box while the focus infill is
944
+ outside it, the two never overlap — which is what the spec's focus sentence asks for. */
945
+ @utility eldra-field-invalid {
946
+ position: relative;
947
+ &::after {
948
+ content: '';
949
+ position: absolute;
950
+ inset: var(--eldra-field-border-width, 1px);
951
+ border: var(--eldra-field-border-width, 1px) solid var(--eldra-color-danger);
952
+ /* The radius is lifted into a custom property of its own rather than written inline in the
953
+ `calc()`. It substitutes to exactly the same token chain — the computed value is unchanged,
954
+ and `source-scan.spec.ts` asserts both halves of it in the compiled stylesheet — but the
955
+ `calc()` a bundler's PostCSS pass then has to parse holds one level of `var()` fallback
956
+ instead of three. Two-deep nesting (`var(--a, var(--b, var(--c)))`) inside a `calc()` is
957
+ what postcss-calc's grammar chokes on, and it printed a "Parse error … got unexpected
958
+ RPAREN" warning on every consumer build (seen in the starter's). It is only a warning — the
959
+ declaration is passed through untouched — but a package cannot ship noise into every
960
+ consumer's build log, and a real parse error in that pass would look exactly the same. */
961
+ --eldra-field-invalid-radius: var(
962
+ --eldra-field-radius,
963
+ var(--eldra-input-radius, var(--eldra-radius-md))
964
+ );
965
+ border-radius: calc(var(--eldra-field-invalid-radius) - var(--eldra-field-border-width, 1px));
966
+ pointer-events: none;
967
+ }
968
+ @media (forced-colors: active) {
969
+ &::after {
970
+ border-color: CanvasText;
971
+ }
972
+ }
973
+ }
974
+
975
+ /* The radio group Card's own boundary (spec "Radio group" → Sizes, Card row: "1px border"). The
976
+ radio circle inside a card reuses `eldra-checkbox-border`/`-invalid` unchanged — the spec gives
977
+ it the exact same numbers as the Checkbox box (1.5px / 2px) — but the card itself is a
978
+ different element with its own 1px number, so it gets its own variable rather than sharing one
979
+ that happens to have a different default. */
980
+ @utility eldra-radio-card-border {
981
+ border-width: var(--eldra-radio-card-border-width, 1px);
982
+ }
983
+
984
+ /* The selected Card's boundary (spec "Radio group" → States, Selected row: "2px `primary` (1px
985
+ border + 1px inset line)"). The same technique as `eldra-field-invalid` above, and for the same
986
+ reason: keeping the real border at 1px in every state and adding a second 1px inset line only
987
+ when selected is what stops the card growing — and its neighbours shifting — the moment it is
988
+ chosen. The line's colour defaults to `primary`; the invalid-and-selected state (Decision: an
989
+ invalid `Checkbox` that is also checked keeps its fill and swaps only the border colour) sets
990
+ `--eldra-radio-card-selected-color` to `danger` instead, so one utility serves both cases rather
991
+ than two nearly-identical ones. */
992
+ @utility eldra-radio-card-selected {
993
+ position: relative;
994
+ &::after {
995
+ content: '';
996
+ position: absolute;
997
+ inset: var(--eldra-radio-card-border-width, 1px);
998
+ border: var(--eldra-radio-card-border-width, 1px) solid
999
+ var(--eldra-radio-card-selected-color, var(--eldra-color-primary));
1000
+ border-radius: calc(
1001
+ var(--eldra-radio-card-radius, var(--eldra-radius-md)) -
1002
+ var(--eldra-radio-card-border-width, 1px)
1003
+ );
1004
+ pointer-events: none;
1005
+ }
1006
+ }
1007
+
1008
+ /* The Switch track's own boundary (spec "Switch" → Sizes: "1.5px border", both sizes). A
1009
+ per-component variable with a literal default, the same shape as `eldra-checkbox-border`. */
1010
+ @utility eldra-switch-track-border {
1011
+ border-width: var(--eldra-switch-track-border-width, 1.5px);
1012
+ }
1013
+
1014
+ /* The Switch thumb's rest position (spec "Switch" → Sizes: "1rem, 0.1875rem from the track's
1015
+ start edge"). 0.1875rem is not a `--spacing` multiple (0.75 of a step), so it is a
1016
+ per-component variable rather than a spacing utility; logical so it reads correctly in an RTL
1017
+ document. The "on" position is the thumb's own `translate-x-*`, a `--spacing` multiple, added on
1018
+ top of this rest position. */
1019
+ @utility eldra-switch-thumb-offset {
1020
+ inset-inline-start: var(--eldra-switch-thumb-offset, 0.1875rem);
1021
+ }
1022
+
1023
+ /* The Switch label (spec "Switch" → Sizes: "Label | 1rem" at md; the sm row's "0.875rem / 1.5"
1024
+ reuses `text-body-sm` unchanged since the two numbers match a token exactly). 1rem already reads
1025
+ the body token's size; only the line-height has no token of its own (the spec gives it once, in
1026
+ the "with description" paragraph: "line-height 1.4"), so — like `text-card-title`'s 1.4 before
1027
+ it — it is a per-component variable with that literal default. */
1028
+ @utility text-switch-label {
1029
+ font: var(--eldra-text-body-weight) var(--eldra-text-body-size) /
1030
+ var(--eldra-switch-label-line, 1.4) var(--eldra-font-body);
1031
+ }
1032
+
1033
+ /* The Switch description (spec "Switch" → Sizes: "the description is 0.875rem `muted`", and the
1034
+ same paragraph's "line-height 1.4"). 0.875rem already reads the body-sm token's size; the line
1035
+ ratio is this component's own, exactly like `text-switch-label` above. */
1036
+ @utility text-switch-description {
1037
+ font: var(--eldra-text-body-weight) var(--eldra-text-body-sm-size) /
1038
+ var(--eldra-switch-description-line, 1.4) var(--eldra-font-body);
1039
+ }
1040
+
1041
+ /* --- Select ---------------------------------------------------------------------------------- */
1042
+
1043
+ /* A group heading inside a select panel (spec "Select" -> Sizes, Group heading row): "0.75rem,
1044
+ 600, uppercase, 0.06em tracking, `muted`". Every number but the tracking is the overline token's
1045
+ already; the spec's 0.06em is half the overline token's 0.12em, so it is this component's own
1046
+ and gets a variable with that literal default, exactly like `text-card-title`'s 1.4 line. */
1047
+ @utility text-select-group {
1048
+ font: var(--eldra-text-overline-weight) var(--eldra-text-overline-size) /
1049
+ var(--eldra-text-overline-line) var(--eldra-font-body);
1050
+ letter-spacing: var(--eldra-select-group-tracking, 0.06em);
1051
+ text-transform: uppercase;
1052
+ }
1053
+
1054
+ /* An option row's own text (spec "Select" -> Sizes, Option row): "0.9375rem text on a 1.35 line".
1055
+ The size is the control font size the trigger already uses (`--eldra-control-font-size`), so a
1056
+ row and the trigger above it read at one size; only the 1.35 line is this component's own. It is
1057
+ deliberately not `text-control`, whose fixed 1.5rem line is the height of a 2.5rem field box and
1058
+ would push a two-line option (label + hint) past the spec's row. */
1059
+ @utility text-select-option {
1060
+ font: var(--eldra-text-body-weight) var(--eldra-control-font-size, 0.9375rem) /
1061
+ var(--eldra-select-option-line, 1.35) var(--eldra-font-body);
1062
+ }
1063
+
1064
+ /* The "+N" pill on a Multi-select trigger (spec "Multi-select" -> Sizes: "0.75rem 600 tabular").
1065
+ The overline token carries both numbers, but `text-overline` itself is uppercase — which "+2"
1066
+ must not be — so the pill takes the token pair without the transform, on the pill's own 1.25rem
1067
+ height as its line box. `font-variant-numeric` comes after the `font` shorthand, which resets
1068
+ it. */
1069
+ @utility text-select-pill {
1070
+ font: var(--eldra-text-overline-weight) var(--eldra-text-overline-size) /
1071
+ var(--eldra-select-pill-line, 1.25rem) var(--eldra-font-body);
1072
+ font-variant-numeric: tabular-nums;
1073
+ }
1074
+
1075
+ /* The popover's own box (spec "Select" -> Sizes, Popover row): "Min width = trigger, grows to fit
1076
+ its content up to min(22rem, 90vw). Max height 20rem: the list scrolls while the search field
1077
+ stays put." Two utilities rather than one, because they belong to Tailwind's `max-h` and `max-w`
1078
+ merge groups respectively — so a consumer's `classes.panel: 'max-h-64'` replaces the height
1079
+ without also dropping the width clamp. */
1080
+ @utility eldra-select-panel-height {
1081
+ max-height: var(--eldra-select-panel-max-height, 20rem);
1082
+ }
1083
+ @utility eldra-select-panel-width {
1084
+ max-width: min(var(--eldra-select-panel-max-width, 22rem), 90vw);
1085
+ }
1086
+
1087
+ /* The matched run of a filtered option (spec "Select" -> States, "Option filtered match"):
1088
+ "matched characters weight 700, 2px underline at 0.15em offset". None of the three is a token —
1089
+ the type styles stop at 600 and no underline offset exists anywhere else — so all three are
1090
+ per-component variables with the spec's literals as defaults. */
1091
+ @utility eldra-select-match {
1092
+ font-weight: var(--eldra-select-match-weight, 700);
1093
+ text-decoration-line: underline;
1094
+ text-decoration-thickness: var(--eldra-select-match-underline, 2px);
1095
+ text-underline-offset: var(--eldra-select-match-underline-offset, 0.15em);
1096
+ }
1097
+
1098
+ /* An option's colour swatch (spec "Select" -> Sizes, Option row): "Swatch 1rem with a 1px inner
1099
+ edge of `text` at 30%", which the Accessibility notes explain — "Swatch edges carry a 1px inner
1100
+ edge so pale colours stay visible". An inner edge rather than a border, so the swatch stays
1101
+ exactly 1rem whatever colour a store's product data carries. */
1102
+ @utility eldra-select-swatch {
1103
+ box-shadow: inset 0 0 0 var(--eldra-select-swatch-edge, 1px)
1104
+ color-mix(in oklab, var(--eldra-color-text), transparent 70%);
1105
+ }
1106
+
1107
+ /* A Multi-select option's checkbox (spec "Multi-select" -> Sizes, "Checkbox in option"): "1rem
1108
+ square, 1.5px `border-strong`, 0.25rem radius". The radius is its own variable rather than
1109
+ `--eldra-checkbox-radius`: the box is 1rem where a `Checkbox`'s is 1.125rem or 1.5rem, and
1110
+ `radius-sm` (0.375rem) on a 1rem square reads as a pill rather than a checkbox. The border
1111
+ width is shared with `Checkbox` through `eldra-checkbox-border`. */
1112
+ @utility eldra-select-check-radius {
1113
+ border-radius: var(--eldra-select-check-radius, 0.25rem);
1114
+ }
1115
+
1116
+ /* The active and selected option rows under forced colours (spec "Select" -> States: the active row
1117
+ is "`surface-strong`" fill and the selected row is "weight 600 + check"). Forced-colours mode
1118
+ replaces every fill with the system canvas and flattens most weight differences, so each of the
1119
+ two states needs a real boundary there or the list reads as one undifferentiated block. Both are
1120
+ drawn as insets, so a row never changes size when it becomes active or selected.
1121
+
1122
+ `Highlight` for the active row is the system's own "this is where you are" colour, the same one
1123
+ the focus ring borrows; the selected row takes a thinner `CanvasText` line, which reads as a
1124
+ property of the row rather than as the cursor. `eldra-select-option-active` is declared *after*
1125
+ `-selected` on purpose: the two write the same `outline`, and on a row that is both, the one
1126
+ worth seeing is where the keyboard is — selection is still carried by the check mark beside it.
1127
+ Nothing here applies outside forced colours, so the two utilities never fight the fill and weight
1128
+ that carry the same states everywhere else. */
1129
+ @utility eldra-select-option-selected {
1130
+ @media (forced-colors: active) {
1131
+ outline: var(--eldra-select-selected-outline, 1px) solid CanvasText;
1132
+ outline-offset: calc(-1 * var(--eldra-select-selected-outline, 1px));
1133
+ }
1134
+ }
1135
+ @utility eldra-select-option-active {
1136
+ @media (forced-colors: active) {
1137
+ outline: var(--eldra-select-active-outline, 2px) solid Highlight;
1138
+ outline-offset: calc(-1 * var(--eldra-select-active-outline, 2px));
1139
+ }
1140
+ }
1141
+
1142
+ /* The entrance of EVERY popover in this package — `Select`'s panel, `MultiSelect`'s and the
1143
+ `SearchBar`'s results panel — is this one animation: opacity 0 -> 1 and a uniform scale 0.98 -> 1
1144
+ over `duration-base` with `ease-out`, growing from the corner the panel is anchored by. Closing
1145
+ is instant.
1146
+
1147
+ The spec ("Select" -> Behaviour & motion, Opening) writes it as a fade plus a 0.25rem slide plus
1148
+ a *vertical* scale, and that is what shipped first. Operator decision, 2026-09-25: drop the slide
1149
+ and scale both axes. The slide is what made the panel read as a separate object arriving from
1150
+ somewhere rather than as the control opening out, and a `scaleY`-only entrance stretches the type
1151
+ inside the panel while it plays. Recorded under Deviations in the README. The `SearchBar`'s panel
1152
+ had no entrance at all before that decision; it now plays the same one.
1153
+
1154
+ The origin is a custom property the panel sets inline from the placement it resolved to
1155
+ (`usePopover`'s `panelStyle`): `top left` below the control, `bottom left` above it, so the panel
1156
+ grows out of the edge it is attached to. One keyframe set with that property rather than two sets
1157
+ with two names: a panel that flips swaps its origin the frame after it mounts — floating-ui
1158
+ measures asynchronously — and a new `animation-name` would restart the animation from zero, so
1159
+ the popover visibly faded in twice. A custom property is read by the running animation instead,
1160
+ so the entrance plays exactly once whichever way it ends up pointing.
1161
+
1162
+ Reduced motion needs nothing here: `--eldra-duration-base` is 0ms under
1163
+ `prefers-reduced-motion: reduce` (tokens.css), so the panel simply appears in its end state — the
1164
+ same mechanism every transition in this package uses. `transform: scale()` rather than the
1165
+ independent `scale` property, because the panel's `transform` is otherwise untouched and the
1166
+ shorthand is the more widely animatable of the two. */
1167
+ @keyframes eldra-popover-in {
1168
+ from {
1169
+ opacity: 0;
1170
+ transform: scale(0.98);
1171
+ }
1172
+ to {
1173
+ opacity: 1;
1174
+ transform: none;
1175
+ }
1176
+ }
1177
+ @utility animate-eldra-popover-in {
1178
+ animation: eldra-popover-in var(--eldra-duration-base) var(--eldra-ease-out);
1179
+ transform-origin: var(--eldra-popover-origin, top left);
1180
+ }
1181
+
1182
+ /* --- Tooltip ---------------------------------------------------------------------------------- */
1183
+
1184
+ /* Spec "Tooltip" -> Sizes: "0.8125rem / 1.4, weight 500, one line (no wrap)". The size and line
1185
+ are `text-caption`'s exactly (0.8125rem / 1.4) -- reused rather than duplicated, the same shape
1186
+ as `text-variant-legend` reusing `text-body-sm`'s. The weight is left to the stock
1187
+ `font-medium` utility, also `text-variant-legend`'s own reasoning: a `font` shorthand here would
1188
+ bake a weight in ahead of it in source order, and `tailwind-merge`'s `font-size` group (this
1189
+ utility's own, via `cx.ts`) does not touch `font-weight` anyway. */
1190
+ @utility text-tooltip {
1191
+ font-family: var(--eldra-font-body);
1192
+ font-size: var(--eldra-text-caption-size);
1193
+ line-height: var(--eldra-text-caption-line);
1194
+ }
1195
+
1196
+ /* The arrow (spec "Tooltip" -> Sizes, Arrow row): "0.3125rem, centred (start / end: 1.25rem from
1197
+ the aligned edge)" -- a rotated square, half on each side of the boundary between the bubble and
1198
+ the trigger, so it reads as a triangle pointing at whichever one is behind it. `0.3125rem` has no
1199
+ shared token (nothing else in the package needs a fifth-of-a-rem), so it is a per-component
1200
+ variable with that literal default, the same shape as `--eldra-avatar-initials-size-*`; see the
1201
+ README's Customisation table. The horizontal alignment (`left-5`/`right-5`/centred) and the
1202
+ vertical offset (which edge, since the bubble can flip) are `Tooltip.vue`'s own reactive classes
1203
+ and inline style -- this utility only draws the shape. */
1204
+ @utility eldra-tooltip-arrow {
1205
+ position: absolute;
1206
+ width: var(--eldra-tooltip-arrow-size, 0.3125rem);
1207
+ height: var(--eldra-tooltip-arrow-size, 0.3125rem);
1208
+ background-color: var(--eldra-color-text);
1209
+ transform: rotate(45deg);
1210
+ pointer-events: none;
1211
+ }
1212
+
1213
+ /* --- Search bar ------------------------------------------------------------------------------- */
1214
+
1215
+ /* A result row's meta (spec "Search bar" -> Sizes, "Title / sub / meta" row): "0.875rem 600
1216
+ tabular" — a price. Both numbers already read tokens (`text-label-weight` is 600,
1217
+ `text-body-sm-size` is 0.875rem); only the 1.35 line of the row's text stack is this component's
1218
+ own, and it is shared with the row's title, which reuses `text-select-option` (the same
1219
+ 0.9375rem on the same 1.35 line the spec gives both components). `font-variant-numeric` comes
1220
+ after the `font` shorthand, which resets it. */
1221
+ @utility text-search-meta {
1222
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-sm-size) /
1223
+ var(--eldra-search-text-line, 1.35) var(--eldra-font-body);
1224
+ font-variant-numeric: tabular-nums;
1225
+ }
1226
+
1227
+ /* The no-results title (spec -> Sizes, "No-results message" row): "Title 1rem 600". The size and
1228
+ the weight are tokens; the 1.4 line has none of its own, so it is a per-component variable with
1229
+ that literal default, exactly like `text-card-title`'s. Its own utility rather than a stock
1230
+ weight layered over `text-body`, because layering `font-semibold` after a shorthand `font`
1231
+ property that already bakes in a weight is order-dependent (see `text-counter`'s comment). */
1232
+ @utility text-search-title {
1233
+ font: var(--eldra-text-label-weight) var(--eldra-text-body-size) /
1234
+ var(--eldra-search-empty-line, 1.4) var(--eldra-font-body);
1235
+ }
1236
+
1237
+ /* The `/` keyboard-key chip (spec -> Sizes, "Keyboard hint" row): "monospace, 0.75rem". The size
1238
+ is the overline token's, the family the mono token's, and the 1rem line box is the chip's own
1239
+ height rather than a ratio. */
1240
+ @utility text-search-kbd {
1241
+ font: var(--eldra-text-body-weight) var(--eldra-text-overline-size) /
1242
+ var(--eldra-search-kbd-line, 1rem) var(--eldra-font-mono);
1243
+ }
1244
+
1245
+ /* The results panel's own box (spec -> Sizes, Panel row): "Max height min(32rem, 70vh), scrolls
1246
+ inside". Tailwind's `max-h` group, so a consumer's `classes.panel: 'max-h-64'` replaces it
1247
+ outright. The panel's *width* is the field's (`useFloating`'s `matchWidth`), so there is no
1248
+ width clamp to go with it, unlike the select popover's pair. */
1249
+ @utility eldra-search-panel-height {
1250
+ max-height: min(var(--eldra-search-panel-max-height, 32rem), 70vh);
1251
+ }
1252
+
1253
+ /* --- Variant picker --------------------------------------------------------------------------- */
1254
+
1255
+ /* The legend's own text (spec "Variant picker" → Sizes, Legend row): "0.875rem; name 600, value
1256
+ 400 muted". Deliberately no weight in the shorthand, for the same reason `text-counter` and
1257
+ `text-field-note` have none: the name run and the value run need two different weights of the
1258
+ *same* size, and layering a `font-weight` utility after a shorthand `font` property that already
1259
+ bakes one in is order-dependent (see `text-counter`'s own comment above this component's
1260
+ utilities in the earlier "Sizes" section). So the component pairs this with the stock
1261
+ `font-semibold`/`font-normal` utilities instead, exactly as those two already do. The size reuses
1262
+ the body-sm token; the line ratio has no token of its own, so it is a per-component variable with
1263
+ a literal default, the same shape as `text-card-title`'s 1.4. */
1264
+ @utility text-variant-legend {
1265
+ font-family: var(--eldra-font-body);
1266
+ font-size: var(--eldra-text-body-sm-size);
1267
+ line-height: var(--eldra-variant-legend-line, 1.4);
1268
+ }
1269
+
1270
+ /* A pill option's own text (spec "Variant picker" → Sizes, Pill row): "0.9375rem, 500 (600
1271
+ selected)". Same reasoning as `text-variant-legend` above — one size, two weights depending on
1272
+ selection — so no weight in the shorthand; the component pairs this with `font-medium`/
1273
+ `font-semibold`. The size and line reuse the same control-font variables `text-control` already
1274
+ reads, so a pill's text sits at the same size as an Input's. */
1275
+ @utility text-variant-pill {
1276
+ font-family: var(--eldra-font-body);
1277
+ font-size: var(--eldra-control-font-size, 0.9375rem);
1278
+ line-height: var(--eldra-control-line-height, 1.5rem);
1279
+ }
1280
+
1281
+ /* A pill's own boundary (spec "Variant picker" → States): "1px" in every row but one. The width is
1282
+ a variable rather than Tailwind's `border`, the same shape as `eldra-field-border` and
1283
+ `eldra-checkbox-border` above: the "sold out + selected" row's own 2px line (below) is inset by
1284
+ exactly this much. */
1285
+ @utility eldra-variant-pill-border {
1286
+ border-width: var(--eldra-variant-pill-border-width, 1px);
1287
+ }
1288
+
1289
+ /* The sold-out-and-selected pill's boundary (spec "Variant picker" → States, "Sold out + selected"
1290
+ row): "**2px** solid `text`" — the only pill row whose border is thicker than the other four.
1291
+ The same technique as `eldra-radio-card-selected` and `eldra-field-invalid`: the real border
1292
+ stays `eldra-variant-pill-border`'s 1px in every state, so a pill never resizes (and its row
1293
+ neighbours never reflow) the moment it becomes both sold out and selected, and a second 1px
1294
+ inset line does the rest. */
1295
+ @utility eldra-variant-pill-selected-line {
1296
+ position: relative;
1297
+ &::after {
1298
+ content: '';
1299
+ position: absolute;
1300
+ inset: var(--eldra-variant-pill-border-width, 1px);
1301
+ border: var(--eldra-variant-pill-border-width, 1px) solid
1302
+ var(--eldra-variant-pill-selected-color, var(--eldra-color-text));
1303
+ border-radius: calc(
1304
+ var(--eldra-variant-pill-radius, var(--eldra-radius-md)) -
1305
+ var(--eldra-variant-pill-border-width, 1px)
1306
+ );
1307
+ pointer-events: none;
1308
+ }
1309
+ }
1310
+
1311
+ /* A sold-out pill's diagonal line (spec "Variant picker" → Anatomy: "sold out: dashed border +
1312
+ diagonal line"; → States, Sold out row: "a 1px diagonal `border-strong` line (bottom-left to
1313
+ top-right)"). Drawn in `VariantPicker.vue` as an inline `<svg viewBox="0 0 100 100"
1314
+ preserveAspectRatio="none">` stretched over the pill, with `vector-effect="non-scaling-stroke"`
1315
+ on its `<line>` — the SVG spec's own way to keep a stroke a constant screen-pixel width no
1316
+ matter how non-uniformly its coordinate system is scaled. A `background: linear-gradient`
1317
+ diagonal was tried first and rejected: its stripe is measured along the gradient line, whose
1318
+ length shrinks as a box gets wider relative to its height, so the same "1px" stop distance
1319
+ inflates into a visibly thick band on a long pill (`LongLabels` story) while staying correct on
1320
+ a short one — exactly what a pill's variable, label-dependent width guarantees will happen.
1321
+ Nothing in `tailwind.css` needs to know the pill's own colour class here: the `<svg>` reads
1322
+ `currentColor` (`text-border-strong`, set alongside it in the component), so it never needs a
1323
+ custom utility of its own; only the `<line>`'s literal `stroke-width="1"` (the spec's own
1324
+ number) lives outside a class, the same way `Checkbox`'s tick mark carries its own literal
1325
+ `stroke-width` and path. Real borders stay real borders in forced-colours mode (spec "Actions
1326
+ and forms" → Forced colours): the line sits *beside* the pill's own real
1327
+ `eldra-variant-pill-border`, which is what stays visible there; the two together are how the
1328
+ spec tells "sold out" from "selected" without colour alone (1.4.1). */
1329
+
1330
+ /* The swatch's own ring (spec "Variant picker" → Sizes, Swatch row): "a 2px ring (transparent at
1331
+ rest), then a 3px gap, then the colour disc". The ring is drawn as a real `border` on the
1332
+ outer 2.75rem shape — the same element the proxy focus ring sits on — kept at this one constant
1333
+ width in every state (spec: "transparent at rest"; hover and selected only ever recolour it, in
1334
+ `VariantPicker.vue`), so the swatch never resizes when it gains a ring. The 3px gap between the
1335
+ ring and the disc is the shape's own padding (`p-0.75`, `--spacing` × 0.75 = 0.1875rem = 3px —
1336
+ the same dynamic-spacing technique `RadioGroup`'s `mt-0.75` and `gap-x-2.5` already use), which
1337
+ is also what lets the inner disc fill the remaining space with a plain `size-full` rather than a
1338
+ second literal measurement. */
1339
+ @utility eldra-variant-swatch-ring {
1340
+ border-width: var(--eldra-variant-swatch-ring-width, 2px);
1341
+ }
1342
+
1343
+ /* The colour disc's own edge (spec "Variant picker" → Sizes, Swatch row: "the colour disc with a
1344
+ 1px inner `border-strong` edge"; → Accessibility: "The disc edge uses `border-strong`, so pale
1345
+ swatches (Ecru, Chalk) keep a 3:1 boundary (1.4.11)"). A real `border`, not `eldra-select-
1346
+ swatch`'s inset `box-shadow` (that one is this package's *other* swatch, the 1rem one inside a
1347
+ `Select` option row) — forced-colours mode can drop a decorative shadow, and the spec's own
1348
+ "Forced colours: borders stay as real borders" rule is written for exactly this boundary, the
1349
+ one WCAG 1.4.11 is about. Box-sizing keeps the disc's outer size unchanged by its own border, so
1350
+ it still fills the ring's padded interior exactly via `size-full`. */
1351
+ @utility eldra-variant-swatch-edge {
1352
+ border-width: var(--eldra-variant-swatch-edge-width, 1px);
1353
+ }
1354
+
1355
+ /* The live "No image" placeholder's hatching (spec "Image" → Sizes, "Placeholder hatching" row:
1356
+ "1px diagonal lines (135°) every 0.75rem in `border` at 70% strength over `surface`"). A
1357
+ `repeating-linear-gradient` rather than an SVG or a `background-image` data URI: it is one flat
1358
+ colour repeated, which a gradient expresses exactly and without shipping a raster/vector asset
1359
+ for a one-pixel line. "70% strength" is `border` mixed with 30% transparency, the same
1360
+ `color-mix(in oklab, …, transparent <n>%)` shape `eldra-skeleton`'s shimmer above already uses
1361
+ for its own "at 60% strength" fill. The repeat distance is a variable with the spec's own
1362
+ 0.75rem as its default rather than a literal in the gradient stops, so a consumer who wants a
1363
+ finer or coarser hatch does not have to redeclare the whole gradient. */
1364
+ @utility eldra-image-placeholder-hatch {
1365
+ --eldra-image-hatch-gap: 0.75rem;
1366
+ background-color: var(--color-surface);
1367
+ background-image: repeating-linear-gradient(
1368
+ 135deg,
1369
+ color-mix(in oklab, var(--eldra-color-border), transparent 30%) 0,
1370
+ color-mix(in oklab, var(--eldra-color-border), transparent 30%) 1px,
1371
+ transparent 1px,
1372
+ transparent var(--eldra-image-hatch-gap)
1373
+ );
1374
+ }
1375
+
1376
+ /* A sold-out swatch's diagonal line (spec "Variant picker" → States, Sold out row: "2px diagonal
1377
+ line in `text` with a 1.5px `background` halo, from 4px inside the top to 4px inside the bottom,
1378
+ rotated 45°") is drawn in `VariantPicker.vue` as an inline `<svg>`, not a class-only utility —
1379
+ the same reasoning as the pill's line above, and for an even sharper reason here: a first
1380
+ version drew it with `background-color` (the line) plus a `box-shadow` (the halo), and *both*
1381
+ properties are exactly the ones forced-colours mode empties out — the line vanished completely
1382
+ under `forced-colors: active`, the one mode this indicator exists to survive (spec "Actions and
1383
+ forms" → Forced colours; WCAG 1.4.1). An SVG `<line stroke="currentColor">` does not have that
1384
+ problem: forced-colours remaps a stroke the same way it remaps a real border. Two stacked
1385
+ `<line>`s (a wider one in `background`, first, then the spec's own 2px in `text`) draw the halo
1386
+ and the line together, at the endpoints the spec's "4px inside the top … rotated 45°" geometry
1387
+ actually produces — worked out once in that component's own comment rather than re-derived by a
1388
+ consumer reading a CSS transform. */
1389
+
1390
+ /* --- Avatar ---------------------------------------------------------------------------------- */
1391
+
1392
+ /* Avatar initials/"+N" type (spec "Avatar" → Sizes: the Initials column is "38% of diameter" —
1393
+ 0.76rem/0.95rem/1.33rem/2.28rem at sm/md/lg/xl, none of which matches a token in tokens.json —
1394
+ plus "Initials weight 600, letter-spacing 0.02em" from the paragraph under the table). Weight
1395
+ reuses `--eldra-text-label-weight` (600, the same token every other 600-weight utility in this
1396
+ file reads); the size and the 0.02em tracking have no token of their own, so — like
1397
+ `text-button-lg`'s 1.0625rem — each is a per-component CSS variable with the spec's own number
1398
+ as its literal default. One line (`/ 1`): initials are a single short run, never a wrapped
1399
+ paragraph, so there is no ratio to name. `AvatarGroup`'s "+N" counter reuses the same size at
1400
+ `sm` (`Avatar.vue`'s own comment) rather than a fifth type style, since the spec's States table
1401
+ gives it the identical treatment ("Initials / '+N' … `text`"). */
1402
+ @utility text-avatar-initials-sm {
1403
+ font: var(--eldra-text-label-weight) var(--eldra-avatar-initials-size-sm, 0.76rem) / 1
1404
+ var(--eldra-font-body);
1405
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1406
+ }
1407
+ @utility text-avatar-initials-md {
1408
+ font: var(--eldra-text-label-weight) var(--eldra-avatar-initials-size-md, 0.95rem) / 1
1409
+ var(--eldra-font-body);
1410
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1411
+ }
1412
+ @utility text-avatar-initials-lg {
1413
+ font: var(--eldra-text-label-weight) var(--eldra-avatar-initials-size-lg, 1.33rem) / 1
1414
+ var(--eldra-font-body);
1415
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1416
+ }
1417
+ @utility text-avatar-initials-xl {
1418
+ font: var(--eldra-text-label-weight) var(--eldra-avatar-initials-size-xl, 2.28rem) / 1
1419
+ var(--eldra-font-body);
1420
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1421
+ }
1422
+
1423
+ /* The user-icon fallback's size (spec "Avatar" → Sizes, closing paragraph: "Icon: 1.5rem in lg
1424
+ (scale proportionally)"). Only `lg` is given a literal number; the other three are that same
1425
+ icon-to-diameter ratio (1.5 / 3.5, the `lg` diameter) applied to their own diameter (2rem,
1426
+ 2.5rem, 6rem) and rounded to three decimal places — precise enough for a stroke this thin, and
1427
+ consistent with how every other one-off number in this file is a per-component variable with a
1428
+ literal default rather than a class-level arbitrary value. Registered in the `size` class group
1429
+ in `src/utils/cx.ts` (the same group `size-*` itself belongs to), so `classes.icon: 'size-6'`
1430
+ replaces one of these instead of landing beside it. */
1431
+ @utility eldra-avatar-icon-sm {
1432
+ width: var(--eldra-avatar-icon-size-sm, 0.857rem);
1433
+ height: var(--eldra-avatar-icon-size-sm, 0.857rem);
1434
+ }
1435
+ @utility eldra-avatar-icon-md {
1436
+ width: var(--eldra-avatar-icon-size-md, 1.071rem);
1437
+ height: var(--eldra-avatar-icon-size-md, 1.071rem);
1438
+ }
1439
+ @utility eldra-avatar-icon-lg {
1440
+ width: var(--eldra-avatar-icon-size-lg, 1.5rem);
1441
+ height: var(--eldra-avatar-icon-size-lg, 1.5rem);
1442
+ }
1443
+ @utility eldra-avatar-icon-xl {
1444
+ width: var(--eldra-avatar-icon-size-xl, 2.571rem);
1445
+ height: var(--eldra-avatar-icon-size-xl, 2.571rem);
1446
+ }
1447
+
1448
+ /* --- Container and section -------------------------------------------------------------------- */
1449
+
1450
+ /* Spec "Container and section" → Do/Don't: "Do alternate none and surface between neighbouring
1451
+ blocks instead of adding divider lines" and the acceptance criterion this rule is actually for —
1452
+ two adjacent same-background `Section`s read as one continuous band, not as two spacing bands
1453
+ stacked with a visible seam. `Section.vue` marks its own ground on every background (including
1454
+ `none`) with `data-section-bg`, and a second `Section` immediately after one with the same value
1455
+ drops its own top padding (`Section` splits its spacing into separate `pt-*`/`pb-*` utilities
1456
+ instead of the `py-*` shorthand for exactly this: only the top half is ever touched, so the
1457
+ bottom edge — what the *next* sibling's own top-drop reads against — never moves).
1458
+
1459
+ This is plain CSS, not `@utility`, and deliberately outside every `@layer`: Tailwind's utilities
1460
+ compile into `@layer utilities` (`@import 'tailwindcss'` declares the layer order), and a rule
1461
+ with no layer at all always wins the cascade over every layered rule regardless of selector
1462
+ specificity or source order (CSS Cascade Layers) — which is what lets `Section`'s own `spacing`
1463
+ stay an ordinary, always-overridable `pt-*`/`pb-*` utility while this one rule still beats it
1464
+ whenever two matching grounds are adjacent. `src/__tests__/sectionAdjacentBackground.spec.ts`
1465
+ compiles this file and asserts the built rule wins. Five explicit pairs, not a single generic
1466
+ attribute selector, because CSS has no "same value as the previous sibling" selector — only an
1467
+ exact value can be matched on each side. */
1468
+ [data-section-bg='none'] + [data-section-bg='none'],
1469
+ [data-section-bg='surface'] + [data-section-bg='surface'],
1470
+ [data-section-bg='surface-strong'] + [data-section-bg='surface-strong'],
1471
+ [data-section-bg='primary'] + [data-section-bg='primary'],
1472
+ [data-section-bg='accent'] + [data-section-bg='accent'] {
1473
+ padding-top: 0;
1474
+ }
1475
+
1476
+ /* --- Dialog ---------------------------------------------------------------------------------- */
1477
+
1478
+ /* The title (spec "Dialog" → Sizes): "heading font, 1.25rem / 1.3, weight 600, letter-spacing
1479
+ -0.01em." Weight and tracking already read `h3`'s own tokens exactly (600, -0.01em — the same
1480
+ reuse `text-logo-wordmark` makes for its own weight/tracking); only the 1.25rem size and 1.3 line
1481
+ sit between two type styles with no token of their own, so, like `Button`'s `lg` size, they are
1482
+ per-component variables with the spec's literals as defaults. */
1483
+ @utility text-dialog-title {
1484
+ font: var(--eldra-text-h3-weight) var(--eldra-dialog-title-size, 1.25rem) /
1485
+ var(--eldra-dialog-title-line, 1.3) var(--eldra-font-heading);
1486
+ letter-spacing: var(--eldra-text-h3-tracking);
1487
+ }
1488
+
1489
+ /* The panel's own box (spec "Dialog" → Sizes): "Width min(32rem, 100vw − 2rem) (sm: min(24rem,
1490
+ 100vw − 2rem))" and "Max height 100vh − 4rem; content beyond that scrolls inside the dialog." The
1491
+ width pair keep the viewport clamp inside the utility itself, unlike `eldra-select-panel-width`'s
1492
+ `min()` — a Dialog's own width is a fixed spec number a consumer can override with
1493
+ `--eldra-dialog-width(-sm)`, and the clamp must still apply to whatever that override is, not
1494
+ only to the default. Each is in Tailwind's own `w`/`max-h` group (`src/utils/cx.ts`), so a
1495
+ consumer's `classes.panel: 'w-full'` replaces the clamp instead of landing beside it. */
1496
+ @utility eldra-dialog-width {
1497
+ width: min(var(--eldra-dialog-width, 32rem), calc(100vw - 2rem));
1498
+ }
1499
+ @utility eldra-dialog-width-sm {
1500
+ width: min(var(--eldra-dialog-width-sm, 24rem), calc(100vw - 2rem));
1501
+ }
1502
+ @utility eldra-dialog-max-height {
1503
+ max-height: var(--eldra-dialog-max-height, calc(100vh - 4rem));
1504
+ }
1505
+
1506
+ /* The dialog's own entrance (spec "Dialog" → Behaviour & motion): "Enter: opacity 0 -> 1, 0.5rem
1507
+ rise and scale 0.98 -> 1, duration-slow (250ms) ease-out. Exit: instant." The house pattern is
1508
+ `eldra-popover-in` above — fade plus scale over a token duration, nothing to do for reduced
1509
+ motion because the duration token itself zeroes — but Dialog's own reduced-motion row is not
1510
+ "nothing moves, so the token collapsing to 0ms already reads as done": the spec asks for "a plain
1511
+ fade over duration-base (200ms), linear," a real, *visible* fade, the same exception
1512
+ `animate-eldra-pulse` makes for the Button spinner and for the same reason — reading
1513
+ `--eldra-duration-base` here would zero it too and the dialog would just snap into view with no
1514
+ fade at all. So the reduced-motion state is a second keyframe set with its own literal, always-on
1515
+ 200ms, applied through `motion-reduce:` (`Dialog.vue`: `animate-eldra-dialog-in
1516
+ motion-reduce:animate-eldra-dialog-in-reduced`) rather than through the zeroing token — exactly
1517
+ the two-utility shape `animate-eldra-spin`/`animate-eldra-pulse` already uses, registered in the
1518
+ same `animate` merge group in `src/utils/cx.ts`. Exit needs no utility at all: the spec's own
1519
+ "instant by default" is simply not animating the close. */
1520
+ @keyframes eldra-dialog-in {
1521
+ from {
1522
+ opacity: 0;
1523
+ transform: translateY(0.5rem) scale(0.98);
1524
+ }
1525
+ to {
1526
+ opacity: 1;
1527
+ transform: none;
1528
+ }
1529
+ }
1530
+ @keyframes eldra-dialog-in-reduced {
1531
+ from {
1532
+ opacity: 0;
1533
+ }
1534
+ to {
1535
+ opacity: 1;
1536
+ }
1537
+ }
1538
+ @utility animate-eldra-dialog-in {
1539
+ animation: eldra-dialog-in var(--eldra-duration-slow) var(--eldra-ease-out);
1540
+ }
1541
+ @utility animate-eldra-dialog-in-reduced {
1542
+ animation: eldra-dialog-in-reduced 200ms linear;
1543
+ }
1544
+ /* --- Tabs ---------------------------------------------------------------------------------- */
1545
+
1546
+ /* Spec "Tabs" → Anatomy, point 1: "scrolls horizontally when the tabs overflow (never wraps),
1547
+ scrollbar hidden." Tailwind has no stock utility for hiding a scrollbar — `overflow-x-auto`
1548
+ alone still shows the browser's own bar — so this is one small utility rather than an arbitrary
1549
+ value repeated at the call site. Registered in `src/utils/cx.ts` under its own class group (see
1550
+ `custom-utility-coverage.spec.ts`), the same shape as `target-min`/`target-touch` above: no stock
1551
+ Tailwind group covers "show/hide a scrollbar" either. */
1552
+ @utility eldra-scrollbar-hide {
1553
+ scrollbar-width: none;
1554
+ -ms-overflow-style: none;
1555
+ &::-webkit-scrollbar {
1556
+ display: none;
1557
+ }
1558
+ }
1559
+
1560
+ /* --- Drawer ----------------------------------------------------------------------------------- */
1561
+
1562
+ /* The title (spec "Drawer" → Sizes): "heading font, 1.25rem / 1.3, weight 600, letter-spacing
1563
+ -0.01em" — the exact same numbers as `text-dialog-title` above, but its own variable pair
1564
+ rather than a shared one: a consumer restyling one component's title should not have to think
1565
+ about whether the other one moves with it. */
1566
+ @utility text-drawer-title {
1567
+ font: var(--eldra-text-h3-weight) var(--eldra-drawer-title-size, 1.25rem) /
1568
+ var(--eldra-drawer-title-line, 1.3) var(--eldra-font-heading);
1569
+ letter-spacing: var(--eldra-text-h3-tracking);
1570
+ }
1571
+
1572
+ /* The panel's own width (spec "Drawer" → Properties, `width` row: "Maximum width; always capped
1573
+ at 100% of the viewport") plus the full-screen mobile variant (spec "Drawer" → Mobile: "On any
1574
+ viewport narrower than the drawer's width, the drawer is full width and full height"; Global
1575
+ Constraints: the full-screen variants of Drawer, Lightbox and Search modal are one of only two
1576
+ rules in the whole spec measured on the **viewport**, not a container — operator decision,
1577
+ 2026-09-25). `--eldra-drawer-width` is a literal per-component variable (the spec's own 28rem
1578
+ default sits between two tokens and has none of its own, the same shape as `--eldra-dialog-
1579
+ width`), set from the `width` prop on the panel's own inline style; the viewport cap lives
1580
+ inside the utility itself so it still applies to whatever a consumer sets that variable to, not
1581
+ only to the default. The `48rem` edge below is a plain `@media` query — Tailwind's own `md`
1582
+ *viewport* breakpoint, the same one `max-md:text-control-mobile` above measures — never a
1583
+ `@container` query: this is one of the two rules in the whole design spec that measures the
1584
+ viewport on purpose, not the enclosing block. */
1585
+ @utility eldra-drawer-width {
1586
+ width: min(var(--eldra-drawer-width, 28rem), 100vw);
1587
+ @media (width < 48rem) {
1588
+ width: 100vw;
1589
+ }
1590
+ }
1591
+
1592
+ /* The drawer's own entrance (spec "Drawer" → Behaviour & motion): "Enter: slides in from its edge
1593
+ (translateX(100%) -> 0 for right, -100% -> 0 for left), duration-slow (250ms) ease-out. Exit:
1594
+ instant." Applied to the `<dialog>` root itself (`Drawer.vue`: `animate-eldra-drawer-in-{side}
1595
+ motion-reduce:animate-eldra-dialog-in-reduced`), the same placement `Dialog`'s own
1596
+ `animate-eldra-dialog-in` uses — the root is a full-viewport transparent flex box that only
1597
+ docks its (opaque) panel child to one edge, so translating the root by a full 100% of its own
1598
+ (viewport) width slides the panel fully off-screen and back regardless of the panel's own
1599
+ width, while the `::backdrop` (a sibling box, not a descendant) is untouched by the transform
1600
+ and simply stays put. Reduced motion reuses `Dialog`'s own `eldra-dialog-in-reduced` keyframe
1601
+ rather than a third one of its own: the spec's "plain fade over duration-base (200ms), linear"
1602
+ is the identical opacity-only fade Dialog's reduced-motion state already draws, so a second
1603
+ keyframe with the same two declarations would only be a second name for the same rule. Exit
1604
+ needs no utility at all, matching "instant by default" the same way Dialog's own exit does. */
1605
+ @keyframes eldra-drawer-in-right {
1606
+ from {
1607
+ transform: translateX(100%);
1608
+ }
1609
+ to {
1610
+ transform: translateX(0);
1611
+ }
1612
+ }
1613
+ @keyframes eldra-drawer-in-left {
1614
+ from {
1615
+ transform: translateX(-100%);
1616
+ }
1617
+ to {
1618
+ transform: translateX(0);
1619
+ }
1620
+ }
1621
+ @utility animate-eldra-drawer-in-right {
1622
+ animation: eldra-drawer-in-right var(--eldra-duration-slow) var(--eldra-ease-out);
1623
+ }
1624
+ @utility animate-eldra-drawer-in-left {
1625
+ animation: eldra-drawer-in-left var(--eldra-duration-slow) var(--eldra-ease-out);
1626
+ }
1627
+
1628
+ /* --- Search modal ------------------------------------------------------------------------------ */
1629
+
1630
+ /* The field's own type (spec "Search modal" → Sizes, Field row): "1.0625rem text" (desktop and
1631
+ tablet); mobile reuses `text-control-mobile`'s existing 1rem (`Input`'s own "the field text is
1632
+ 1rem below 48rem, so iOS never zooms into a focused field" rule applies here too), composed
1633
+ alongside this one the same way `Input`'s own `FIELD_TEXT.md` pairs `text-control` with
1634
+ `max-md:text-control-mobile` — two whole utilities, not one bundling a media query, because the
1635
+ mobile number already has a name. 1.0625rem sits between two type-scale steps with no token of
1636
+ its own, so, like `text-button-lg`'s identical number, it is a per-component variable with the
1637
+ spec's literal as its default. */
1638
+ @utility text-search-modal-field {
1639
+ font: var(--eldra-text-body-weight) var(--eldra-search-modal-field-size, 1.0625rem) /
1640
+ var(--eldra-control-line-height, 1.5rem) var(--eldra-font-body);
1641
+ }
1642
+
1643
+ /* The foot's own text (spec "Search modal" → Sizes, Foot row): "0.75rem `muted` text on `surface`".
1644
+ Plain body weight and family — unlike `text-overline` (also 0.75rem), this is sentence-case hint
1645
+ copy, not an uppercase, tracked label — so it is its own utility rather than that one plus an
1646
+ override. */
1647
+ @utility text-search-modal-foot {
1648
+ font: var(--eldra-text-body-weight) var(--eldra-search-modal-foot-size, 0.75rem) /
1649
+ var(--eldra-search-modal-foot-line, 1.4) var(--eldra-font-body);
1650
+ }
1651
+
1652
+ /* The foot's key caps (spec, same row): "monospace 0.6875rem, min-width 1.25rem" — smaller than
1653
+ `text-search-kbd` (the Search bar's own inline `/` chip, 0.75rem), for a denser row of three
1654
+ hints. */
1655
+ @utility text-search-modal-kbd {
1656
+ font: var(--eldra-text-body-weight) var(--eldra-search-modal-kbd-size, 0.6875rem) / 1rem
1657
+ var(--eldra-font-mono);
1658
+ }
1659
+
1660
+ /* The dialog's own box (spec "Search modal" → Sizes, Dialog row): "min(40rem, 100vw − 2rem) wide;
1661
+ max-height min(40rem, 100vh − 6rem); top margin 8vh, centred horizontally … radius-lg, 1px
1662
+ border, shadow-md" on desktop and tablet (viewport ≥ 48rem); "Full screen: 100% × 100%, no
1663
+ margin, radius or border" below it. One utility per CSS property — the same shape as `eldra-
1664
+ dialog-width`/`-max-height` — each bundling its own `@media (width < 48rem)` override, the exact
1665
+ technique `eldra-drawer-width` above already documents and this file's own
1666
+ `search-modal.spec.ts` compiles and asserts directly, rather than a class-level arbitrary value:
1667
+ a consumer overriding `classes.root` then replaces the desktop clamp *and* its full-screen
1668
+ exception together, never just one half of the rule. The radius/border/shadow removal below
1669
+ 48rem is plain `max-md:` utilities in `SearchModal.vue` instead — three independent, already-
1670
+ token-driven stock groups (`rounded`, `border-w`, `shadow`) that do not need a fourth bundled
1671
+ name of their own the way the three interdependent geometry numbers here do. */
1672
+ @utility eldra-search-modal-width {
1673
+ width: min(var(--eldra-search-modal-width, 40rem), calc(100vw - 2rem));
1674
+ @media (width < 48rem) {
1675
+ width: 100vw;
1676
+ }
1677
+ }
1678
+ @utility eldra-search-modal-max-height {
1679
+ max-height: min(var(--eldra-search-modal-max-height, 40rem), calc(100vh - 6rem));
1680
+ @media (width < 48rem) {
1681
+ max-height: 100vh;
1682
+ }
1683
+ }
1684
+ @utility eldra-search-modal-position {
1685
+ margin: 8vh auto auto;
1686
+ @media (width < 48rem) {
1687
+ margin: 0;
1688
+ }
1689
+ }
1690
+
1691
+ /* --- Toast ------------------------------------------------------------------------------------ */
1692
+
1693
+ /* The region's own width (spec "Toast" -> Sizes, "Region" row): "min(24rem, 100vw - 2rem) wide ...
1694
+ 1rem from the right and bottom edges." Same shape as `eldra-dialog-width`: the viewport clamp
1695
+ lives inside the utility itself, so a consumer's `--eldra-toast-width` override still gets
1696
+ capped on a narrow screen. In Tailwind's own `w` group (`src/utils/cx.ts`), so `classes.root:
1697
+ 'w-full'` replaces the clamp instead of landing beside it. */
1698
+ @utility eldra-toast-width {
1699
+ width: min(var(--eldra-toast-width, 24rem), calc(100vw - 2rem));
1700
+ }
1701
+
1702
+ /* The title (spec "Toast" -> Sizes, "Title" row): "0.9375rem, weight 600." The weight already
1703
+ reads the label token (600, the same reuse `text-stock-status` makes for its own weight); the
1704
+ size sits between two type-scale steps with none of its own — the same shape as `text-price-sm`'s
1705
+ 0.9375rem and `text-dialog-title`'s 1.25rem — so it is a per-component variable with that literal
1706
+ default. No line-height is given, so, like `text-stock-status`'s 1.4, it gets one too. */
1707
+ @utility text-toast-title {
1708
+ font: var(--eldra-text-label-weight) var(--eldra-toast-title-size, 0.9375rem) /
1709
+ var(--eldra-toast-title-line, 1.4) var(--eldra-font-body);
1710
+ }
1711
+
1712
+ /* The toast's own entrance (spec "Toast" -> Behaviour & motion): "Enter: fade in with a 0.5rem
1713
+ rise, duration-base (200ms) ease-out." Unlike `Dialog`, the spec's reduced-motion row here only
1714
+ asks that toasts "appear and disappear without movement" — not, as `Dialog`'s own row demands, a
1715
+ still-visible fade at a literal duration — so the ordinary zeroing `--eldra-duration-base`
1716
+ already satisfies it (an instant appearance has no movement to speak of) and this needs no
1717
+ second `-reduced` keyframe. Exit is not animated (no CSS at all): the spec asks for a 150ms fade
1718
+ out on removal, but animating a `v-for` departure needs Vue's `<TransitionGroup>`, which nothing
1719
+ else in this package uses and which is difficult to drive reliably under `vi.useFakeTimers()`;
1720
+ `Toaster` removes a dismissed toast from the DOM immediately, the same "instant by default"
1721
+ call `Dialog`'s own exit makes (see its Deviations entry) for the equivalent trade-off. */
1722
+ @keyframes eldra-toast-in {
1723
+ from {
1724
+ opacity: 0;
1725
+ transform: translateY(0.5rem);
1726
+ }
1727
+ to {
1728
+ opacity: 1;
1729
+ transform: none;
1730
+ }
1731
+ }
1732
+ @utility animate-eldra-toast-in {
1733
+ animation: eldra-toast-in var(--eldra-duration-base) var(--eldra-ease-out);
1734
+ }
1735
+ /* --- Carousel -------------------------------------------------------------------------------- */
1736
+
1737
+ /* A slide's own width (spec "Carousel" → Sizes, "Slide width" row): "default 80% of the track;
1738
+ product rows `(100% − 3 × 1rem) / 4` from 64rem block width, 3 per view from 48rem, ~80% below
1739
+ 48rem (peek); single-slide galleries 100%" — one formula, `(100% - (perView - 1) * gap) /
1740
+ perView`, covers every row of that table: `perView: 1` gives 100%, `perView: 4` with a 1rem gap
1741
+ gives the product-row formula verbatim, and the default `perView: 1.25` gives "~80%" (literally
1742
+ 80% minus a fifth of the gap, which is what the spec's own "~" already concedes).
1743
+ `--eldra-carousel-per-view` is set per container-query breakpoint by `eldra-carousel-track`
1744
+ below, from the three inline custom properties `carouselPerViewStyle` (`useCarousel.ts`) binds
1745
+ on the track — this utility only ever reads the one resolved variable, so `Carousel.vue` and
1746
+ `Lightbox` share one definition. The gap defaults to
1747
+ `--eldra-space-4` (1rem), the same token `gap-4` on the track itself resolves to, so the two
1748
+ numbers in the formula can never drift apart even if a consumer overrides one. */
1749
+ @utility eldra-carousel-slide {
1750
+ flex: none;
1751
+ scroll-snap-align: start;
1752
+ width: calc(
1753
+ (100% - (var(--eldra-carousel-per-view, 1) - 1) *
1754
+ var(--eldra-carousel-gap, var(--eldra-space-4))) /
1755
+ var(--eldra-carousel-per-view, 1)
1756
+ );
1757
+ }
1758
+
1759
+ /* The track's own per-view switch: picks one of the three inline custom properties
1760
+ `carouselPerViewStyle` (`useCarousel.ts`) binds on the track into the single
1761
+ `--eldra-carousel-per-view` its slides read above.
1762
+
1763
+ The values arrive as an inline style rather than as Tailwind arbitrary-property classes on
1764
+ purpose (bug, fixed 2026-09-27 — see `carouselPerViewStyle`'s own comment, the README's
1765
+ Deviations entry and the CHANGELOG): a class name built by interpolating a number is never in
1766
+ the text Tailwind scans, so a consumer's build emitted no rule for it and every carousel
1767
+ rendered one full-width slide. Keeping the *breakpoints* here, in static CSS, is the other half
1768
+ of that fix: nothing about this rule depends on what a component happened to render.
1769
+
1770
+ 48rem and 64rem are written out, not `var(--container-tablet)`/`var(--container-content)`,
1771
+ for the reason this file's own header states: a `@container` condition may not contain `var()`.
1772
+ They are the same two edges Tailwind's own `@tablet:`/`@content:` variants compile to, and
1773
+ `src/__tests__/containerQueryBreakpoints.spec.ts` is what keeps the pair in step.
1774
+
1775
+ The `var()` fallback chains repeat, in CSS, the narrowest-first resolution
1776
+ `carouselPerViewStyle` already does in JavaScript (which always writes all three): they are what
1777
+ makes a consumer setting only `--eldra-carousel-per-view-base` by hand behave the same way. */
1778
+ @utility eldra-carousel-track {
1779
+ --eldra-carousel-per-view: var(--eldra-carousel-per-view-base, 1);
1780
+ @container (width >= 48rem) {
1781
+ --eldra-carousel-per-view: var(
1782
+ --eldra-carousel-per-view-md,
1783
+ var(--eldra-carousel-per-view-base, 1)
1784
+ );
1785
+ }
1786
+ @container (width >= 64rem) {
1787
+ --eldra-carousel-per-view: var(
1788
+ --eldra-carousel-per-view-lg,
1789
+ var(--eldra-carousel-per-view-md, var(--eldra-carousel-per-view-base, 1))
1790
+ );
1791
+ }
1792
+ }
1793
+
1794
+ /* A dot's own visual (spec "Carousel" → Sizes, Dot row: "1.5rem square target; visible dot 0.5rem
1795
+ circle with a 1.5px ring; current: 1.25rem × 0.5rem pill; no gap between dot targets"). The
1796
+ 1.5rem target itself is a plain `size-6` button in `Carousel.vue`; this utility is only the
1797
+ dot's *visible* inner shape, switched by the button's own `aria-current` — a shape change as
1798
+ well as a colour change (spec → States: "shape change, not colour alone", 1.4.1), so the
1799
+ component computes no separate "current" class. The ring's width has no stock Tailwind border
1800
+ step (1.5px sits between `border-1`'s 1px and `border-2`'s 2px), so — like `eldra-field-border`'s
1801
+ own width — it is a per-component variable with that literal default. Motion: width and colour
1802
+ change over `duration-fast` `ease-out` (spec → Behaviour & motion), nothing under reduced
1803
+ motion — a shape/colour swap has no "motion" to remove, only a transition to skip. */
1804
+ @utility eldra-carousel-dot {
1805
+ display: block;
1806
+ width: var(--eldra-carousel-dot-size, 0.5rem);
1807
+ height: var(--eldra-carousel-dot-size, 0.5rem);
1808
+ border-radius: var(--radius-full);
1809
+ background-color: transparent;
1810
+ box-shadow: inset 0 0 0 var(--eldra-carousel-dot-ring, 1.5px) var(--color-border-strong);
1811
+ transition:
1812
+ width var(--eldra-duration-fast) var(--eldra-ease-out),
1813
+ background-color var(--eldra-duration-fast) var(--eldra-ease-out),
1814
+ box-shadow var(--eldra-duration-fast) var(--eldra-ease-out);
1815
+ @media (prefers-reduced-motion: reduce) {
1816
+ transition: none;
1817
+ }
1818
+ [aria-current='true'] > & {
1819
+ width: 1.25rem;
1820
+ background-color: var(--color-text);
1821
+ box-shadow: inset 0 0 0 var(--eldra-carousel-dot-ring, 1.5px) var(--color-text);
1822
+ }
1823
+ @media (forced-colors: active) {
1824
+ box-shadow: none;
1825
+ border: var(--eldra-carousel-dot-ring, 1.5px) solid CanvasText;
1826
+ [aria-current='true'] > & {
1827
+ background-color: CanvasText;
1828
+ }
1829
+ }
1830
+ }
1831
+
1832
+ /* --- Lightbox ----------------------------------------------------------------------------- */
1833
+
1834
+ /* The viewer's own entrance (spec "Lightbox" → Behaviour & motion: "Enter: fade in over
1835
+ duration-slow (250ms) ease-out. Moving between images scrolls smoothly." / "Reduced motion: the
1836
+ viewer fades in over duration-base (200ms) with no movement, and image changes are instant.").
1837
+ Unlike `Dialog`'s own entrance, there is no rise or scale here — the spec gives the Lightbox a
1838
+ plain fade, full stop, so this needs its own (simpler) keyframe rather than reusing
1839
+ `eldra-dialog-in`. The reduced-motion state, though, is the exact "plain opacity fade over
1840
+ duration-base (200ms), linear" `eldra-dialog-in-reduced` already draws for `Dialog` and `Drawer`
1841
+ — reused rather than given a third identical keyframe, the same call `Drawer`'s own comment on
1842
+ that utility makes. */
1843
+ @keyframes eldra-lightbox-in {
1844
+ from {
1845
+ opacity: 0;
1846
+ }
1847
+ to {
1848
+ opacity: 1;
1849
+ }
1850
+ }
1851
+ @utility animate-eldra-lightbox-in {
1852
+ animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
1853
+ }
1854
+
1855
+ /* --- Range slider ----------------------------------------------------------------------------- */
1856
+
1857
+ /* The gutter that keeps a thumb — its focus ring and its pointer target included — inside the
1858
+ control (spec "Range slider" → Anatomy): a thumb is centred on its value, so the one at `min`
1859
+ hangs half its own width past the start of the track, and **two** things hang further still. Its
1860
+ ring reaches `--eldra-focus-offset` + `--eldra-focus-width` past the circle; its 2.5.8 target
1861
+ (the `::after` box below) is centred on the circle too, so it reaches half the target from the
1862
+ thumb's centre — 22px of it below the tablet width, where that target is `--eldra-target-touch`.
1863
+
1864
+ The gutter is therefore the **larger** of the two reaches, per side. With only the ring's
1865
+ allowance, the maximum thumb at `max` pushed its target 8px past the end of the document at a
1866
+ 320px viewport: a horizontal scrollbar on a phone with nothing to pan to, against WCAG 1.4.10
1867
+ and the spec section's own 320px acceptance line (`__tests__/rangeSliderRing.browser.spec.ts`
1868
+ measures `scrollWidth` against `clientWidth` there, which is the condition the criterion states).
1869
+ Clipping the control is not the alternative: that would cut the focus ring, which is the other
1870
+ thing this reservation exists to protect.
1871
+
1872
+ Sized from the variables themselves, never from the numbers they happen to hold today: a
1873
+ consumer enlarging the thumb or the targets moves the gutter with them, and so does a raised ring
1874
+ token — a `Carousel` sets `--eldra-focus-offset: 4px` for its slides and a plain custom property
1875
+ inherits into everything inside it (the same lesson as `Tabs`' own list reservation).
1876
+
1877
+ `48rem` is written out for the reason this file's header states, and it is the same edge the
1878
+ target itself switches on below, so the two can never disagree about which target is in force. */
1879
+ @utility eldra-range-gutter {
1880
+ padding-inline: max(
1881
+ calc(
1882
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
1883
+ var(--eldra-focus-width)
1884
+ ),
1885
+ calc(var(--eldra-target-min) / 2)
1886
+ );
1887
+ @container (width < 48rem) {
1888
+ padding-inline: max(
1889
+ calc(
1890
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
1891
+ var(--eldra-focus-width)
1892
+ ),
1893
+ calc(var(--eldra-target-touch) / 2)
1894
+ );
1895
+ }
1896
+ }
1897
+
1898
+ /* The gutter a filter panel's price range uses instead (spec "Filter panel" → Sizes, Histogram
1899
+ and Range rows: "inset 0.625rem on each side"): the thumb's own radius plus the focus ring's
1900
+ reach — never the target half, which is what pushed the track to two thirds of a 15rem sidebar.
1901
+ The ring reach stays so a focused end thumb is not clipped by a scrolling drawer body, which
1902
+ makes the inset 0.875rem rather than the spec's 0.625rem; the README's Deviations entry says so. */
1903
+ @utility eldra-range-gutter-thumb {
1904
+ padding-inline: calc(
1905
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
1906
+ var(--eldra-focus-width)
1907
+ );
1908
+ }
1909
+
1910
+ /* The rail: the band a pointer press lands in (spec "Range slider" → Sizes, Rail row: "`target-
1911
+ touch` (2.75rem) below the tablet breakpoint, `target-min` (1.5rem) from it"). The touch size is
1912
+ on the *band*, not on the thumb alone, so there is a 44px-tall target across the whole control
1913
+ rather than two 44px circles that overlap — and therefore fight — when the range is narrow.
1914
+
1915
+ `48rem` is written out rather than `var(--container-tablet)` for the reason this file's header
1916
+ states: a `@container` condition may not contain `var()`. It is the same edge Tailwind's own
1917
+ `@max-tablet:` variant compiles to, measured against the component's own root (`RangeSlider.vue`
1918
+ is a `@container`), which is the spec's own breakpoint rule — the width of the block the control
1919
+ sits in, not the viewport. */
1920
+ @utility eldra-range-rail {
1921
+ min-height: var(--eldra-target-min);
1922
+ @container (width < 48rem) {
1923
+ min-height: var(--eldra-target-touch);
1924
+ }
1925
+ }
1926
+
1927
+ /* The track and the filled range share one height (spec → Anatomy items 3 and 4: "0.375rem tall,
1928
+ `radius-full`"). A literal per-component variable, like `--eldra-carousel-dot-size`: the spec's
1929
+ 0.375rem is a bar thickness, which no shared token carries. */
1930
+ @utility eldra-range-track {
1931
+ height: var(--eldra-range-track-height, 0.375rem);
1932
+ }
1933
+
1934
+ /* A thumb (spec → Anatomy item 5: "1.25rem, `background` fill, 1.5px `border-strong` edge,
1935
+ `shadow-sm`", and → States for the hover and dragging halo). Three things live here rather than
1936
+ in the component's classes, because each of them is a literal the spec gives and a variable a
1937
+ consumer should be able to move: the circle's size, its 1.5px edge (no stock Tailwind border step
1938
+ sits between 1px and 2px — the same call `eldra-carousel-dot`'s ring makes), and the halo.
1939
+
1940
+ `::before` is the halo, drawn outside the circle and faded in on hover and while dragging — an
1941
+ outline or a box-shadow would collide with `eldra-focus`, which owns this element's `outline`
1942
+ *and* its `box-shadow`. `::after` is the pointer target, centred on the thumb at `target-min`
1943
+ and growing to `target-touch` below the tablet breakpoint, so the thumb itself satisfies 2.5.8
1944
+ at every width (the rail above is the band that satisfies it across the whole control). Neither
1945
+ pseudo-element paints anything the thumb's own shape does not already say, so both are invisible
1946
+ to assistive technology by construction. */
1947
+ @utility eldra-range-thumb {
1948
+ width: var(--eldra-range-thumb-size, 1.25rem);
1949
+ height: var(--eldra-range-thumb-size, 1.25rem);
1950
+ border-width: var(--eldra-range-thumb-border-width, 1.5px);
1951
+ &::before {
1952
+ content: '';
1953
+ position: absolute;
1954
+ inset: calc(-1 * var(--eldra-range-thumb-halo, 0.25rem));
1955
+ border-radius: var(--radius-full);
1956
+ background-color: color-mix(in oklab, var(--color-text), transparent 92%);
1957
+ opacity: 0;
1958
+ transition: opacity var(--eldra-duration-fast) var(--eldra-ease-out);
1959
+ }
1960
+ &:hover::before {
1961
+ opacity: 1;
1962
+ }
1963
+ &[data-dragging='true']::before {
1964
+ opacity: 1;
1965
+ background-color: color-mix(in oklab, var(--color-text), transparent 86%);
1966
+ }
1967
+ &[aria-disabled='true']::before {
1968
+ display: none;
1969
+ }
1970
+ &::after {
1971
+ content: '';
1972
+ position: absolute;
1973
+ top: 50%;
1974
+ left: 50%;
1975
+ width: var(--eldra-target-min);
1976
+ height: var(--eldra-target-min);
1977
+ translate: -50% -50%;
1978
+ }
1979
+ @container (width < 48rem) {
1980
+ &::after {
1981
+ width: var(--eldra-target-touch);
1982
+ height: var(--eldra-target-touch);
1983
+ }
1984
+ }
1985
+ @media (prefers-reduced-motion: reduce) {
1986
+ &::before {
1987
+ transition: none;
1988
+ }
1989
+ }
1990
+ }
1991
+
1992
+ /* --- Filter panel ----------------------------------------------------------------------------- */
1993
+
1994
+ /* A size-system sub-heading (spec "Filter panel" → Sizes, Size-system sub-heading row: "0.75rem
1995
+ weight 600, uppercase, 0.06em letter spacing, `muted`"). It is nearly `text-overline` — same
1996
+ size, same weight, same transform — and differs only in tracking: the overline token's 0.12em is
1997
+ a label over a section, and the same spacing inside a 15rem sidebar pushes "SOCKS (EU)" onto two
1998
+ lines. So the size, line and weight read the existing tokens and the tracking is a
1999
+ per-component variable with the spec's own 0.06em as its default. */
2000
+ @utility text-filter-subheading {
2001
+ font-family: var(--eldra-font-body);
2002
+ font-size: var(--eldra-text-overline-size);
2003
+ line-height: var(--eldra-text-overline-line);
2004
+ font-weight: var(--eldra-text-label-weight);
2005
+ letter-spacing: var(--eldra-filter-subheading-tracking, 0.06em);
2006
+ text-transform: uppercase;
2007
+ }
2008
+
2009
+ /* A swatch tile's count (spec → Sizes, Swatch tile row: "count 0.75rem"). The one 0.75rem number
2010
+ in the panel, and the overline token is the only type style at that size — but an overline is
2011
+ uppercase with 0.12em of tracking, which on a column of tabular digits reads as a gap between
2012
+ them. So it borrows that token's size, the caption's line ratio and the body weight, and adds
2013
+ neither transform nor tracking of its own. */
2014
+ @utility text-filter-tile-count {
2015
+ font-family: var(--eldra-font-body);
2016
+ font-size: var(--eldra-text-overline-size);
2017
+ line-height: var(--eldra-text-caption-line);
2018
+ font-weight: var(--eldra-text-body-weight);
2019
+ }
2020
+
2021
+ /* A colour swatch's own edge (spec → Sizes, Swatch row: "Swatch 1.5rem circle with a 1px inner
2022
+ edge of `text` at 22%"). A real `border`, not a `box-shadow`, for the reason
2023
+ `eldra-variant-swatch-edge` records: forced-colours mode drops a decorative shadow and keeps a
2024
+ real border, and this boundary is the one WCAG 1.4.11 is about — a pale swatch has no other edge.
2025
+
2026
+ The width and the colour are bundled in one utility because they are one decision: the colour is
2027
+ not a token role (it is `text` at a fraction) and nothing else in the package draws it, so a
2028
+ consumer moves it through `--eldra-filter-swatch-edge-width` or replaces the whole rule through
2029
+ `classes.swatch`. Deliberately not `border-strong`, which `VariantPicker`'s own disc uses: a
2030
+ filter panel draws these at 1.5rem in a dense column where the stronger line reads as a second
2031
+ ring beside the selected one. */
2032
+ @utility eldra-filter-swatch-edge {
2033
+ border-width: var(--eldra-filter-swatch-edge-width, 1px);
2034
+ border-color: color-mix(in oklab, var(--color-text), transparent 78%);
2035
+ }
2036
+
2037
+ /* The ring a selected swatch gains (spec → Sizes, Selected swatch ring: "A 2px `background` gap,
2038
+ then a 1.5px `text` ring around the swatch"). The gap is the shape's own padding and the ring is
2039
+ a real border on it, kept at this one constant width in **every** state — transparent at rest —
2040
+ so the swatch never resizes when it is picked and the column never shifts under the pointer. The
2041
+ same shape `eldra-variant-swatch-ring` has, at this panel's own 1.5px rather than that
2042
+ component's 2px. */
2043
+ @utility eldra-filter-swatch-ring {
2044
+ border-width: var(--eldra-filter-swatch-ring-width, 1.5px);
2045
+ }
2046
+
2047
+ /* One histogram bar (spec → Sizes, Histogram row: "Bar min height 2px, top corners 1px"). The
2048
+ minimum height is what keeps an empty bucket visible as an empty bucket rather than as nothing
2049
+ at all, which is the difference between "no products here" and "no data"; the 1px top corners
2050
+ are the only rounding, because the bars sit on the histogram's own baseline. Two literals with
2051
+ no token between them — a bar is thinner than any radius or spacing step the scale carries — so
2052
+ each is a per-component variable with the spec's number as its default. */
2053
+ @utility eldra-filter-histogram-bar {
2054
+ min-height: var(--eldra-filter-histogram-bar-min, 2px);
2055
+ border-start-start-radius: var(--eldra-filter-histogram-bar-radius, 1px);
2056
+ border-start-end-radius: var(--eldra-filter-histogram-bar-radius, 1px);
2057
+ }