@eldrajs/ui 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +113 -122
  3. package/dist/{VariantPicker-Da41_oGA.js → VariantPicker-C-9sMXGI.js} +1188 -798
  4. package/dist/components/accordion/Accordion.vue.d.ts +1 -2
  5. package/dist/components/accordion/AccordionItem.vue.d.ts +1 -1
  6. package/dist/components/accordion/types.d.ts +6 -7
  7. package/dist/components/avatar/Avatar.vue.d.ts +1 -1
  8. package/dist/components/avatar/types.d.ts +6 -4
  9. package/dist/components/badge/types.d.ts +6 -4
  10. package/dist/components/breadcrumb/types.d.ts +5 -2
  11. package/dist/components/button/Button.vue.d.ts +3 -3
  12. package/dist/components/button/ButtonGroup.vue.d.ts +0 -1
  13. package/dist/components/button/types.d.ts +7 -6
  14. package/dist/components/card/ContentCard.vue.d.ts +1 -1
  15. package/dist/components/card/FeatureCard.vue.d.ts +1 -1
  16. package/dist/components/card/stretchedLink.d.ts +3 -3
  17. package/dist/components/card/types.d.ts +6 -4
  18. package/dist/components/carousel/types.d.ts +7 -3
  19. package/dist/components/checkbox/Checkbox.vue.d.ts +3 -3
  20. package/dist/components/checkbox/CheckboxGroup.vue.d.ts +1 -1
  21. package/dist/components/checkbox/types.d.ts +10 -4
  22. package/dist/components/chip/Chip.vue.d.ts +1 -1
  23. package/dist/components/chip/ChipGroup.vue.d.ts +0 -1
  24. package/dist/components/chip/types.d.ts +5 -6
  25. package/dist/components/container/Container.vue.d.ts +0 -1
  26. package/dist/components/container/types.d.ts +0 -4
  27. package/dist/components/dialog/Dialog.vue.d.ts +2 -2
  28. package/dist/components/dialog/types.d.ts +5 -2
  29. package/dist/components/drawer/Drawer.vue.d.ts +1 -1
  30. package/dist/components/drawer/types.d.ts +5 -2
  31. package/dist/components/empty-state/EmptyState.vue.d.ts +1 -1
  32. package/dist/components/empty-state/types.d.ts +7 -6
  33. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +1 -1
  34. package/dist/components/field-wrapper/types.d.ts +5 -2
  35. package/dist/components/filter-panel/FilterPanel.vue.d.ts +4 -4
  36. package/dist/components/filter-panel/facets/shared.d.ts +4 -4
  37. package/dist/components/filter-panel/types.d.ts +5 -2
  38. package/dist/components/form-layout/FormLayout.vue.d.ts +1 -1
  39. package/dist/components/form-layout/types.d.ts +5 -2
  40. package/dist/components/icon/Icon.vue.d.ts +1 -2
  41. package/dist/components/icon/types.d.ts +0 -4
  42. package/dist/components/image/types.d.ts +3 -2
  43. package/dist/components/input/Input.vue.d.ts +6 -6
  44. package/dist/components/input/classes.d.ts +25 -19
  45. package/dist/components/input/types.d.ts +5 -2
  46. package/dist/components/lightbox/Lightbox.vue.d.ts +1 -1
  47. package/dist/components/lightbox/types.d.ts +5 -2
  48. package/dist/components/link/Link.vue.d.ts +1 -1
  49. package/dist/components/link/types.d.ts +5 -2
  50. package/dist/components/load-more/types.d.ts +4 -3
  51. package/dist/components/logo-item/LogoItem.vue.d.ts +1 -1
  52. package/dist/components/logo-item/types.d.ts +2 -1
  53. package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -1
  54. package/dist/components/nav-menu/navLinks.d.ts +1 -1
  55. package/dist/components/nav-menu/types.d.ts +3 -3
  56. package/dist/components/pagination/types.d.ts +5 -2
  57. package/dist/components/popover/Popover.vue.d.ts +1 -1
  58. package/dist/components/popover/types.d.ts +5 -6
  59. package/dist/components/price/types.d.ts +3 -2
  60. package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
  61. package/dist/components/product-card/types.d.ts +3 -2
  62. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +4 -4
  63. package/dist/components/quantity-stepper/types.d.ts +5 -2
  64. package/dist/components/radio/Radio.vue.d.ts +3 -3
  65. package/dist/components/radio/RadioGroup.vue.d.ts +3 -3
  66. package/dist/components/radio/recipes.d.ts +11 -7
  67. package/dist/components/radio/types.d.ts +11 -5
  68. package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -1
  69. package/dist/components/range-slider/types.d.ts +5 -2
  70. package/dist/components/rating/Rating.vue.d.ts +1 -1
  71. package/dist/components/rating/types.d.ts +3 -2
  72. package/dist/components/search-bar/SearchBar.vue.d.ts +3 -3
  73. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
  74. package/dist/components/search-bar/types.d.ts +5 -2
  75. package/dist/components/search-modal/SearchModal.vue.d.ts +2 -2
  76. package/dist/components/search-modal/types.d.ts +7 -4
  77. package/dist/components/section/Section.vue.d.ts +0 -1
  78. package/dist/components/section/types.d.ts +0 -4
  79. package/dist/components/select/MultiSelect.vue.d.ts +5 -5
  80. package/dist/components/select/Select.vue.d.ts +4 -4
  81. package/dist/components/select/SelectPanel.vue.d.ts +2 -2
  82. package/dist/components/select/panelParts.d.ts +21 -20
  83. package/dist/components/select/types.d.ts +10 -4
  84. package/dist/components/site-form/SiteForm.vue.d.ts +1 -1
  85. package/dist/components/site-form/types.d.ts +6 -2
  86. package/dist/components/skeleton/Skeleton.vue.d.ts +2 -2
  87. package/dist/components/skeleton/types.d.ts +4 -4
  88. package/dist/components/switch/Switch.vue.d.ts +2 -2
  89. package/dist/components/switch/types.d.ts +5 -2
  90. package/dist/components/tabler-icon/TablerIcon.vue.d.ts +2 -3
  91. package/dist/components/tabler-icon/types.d.ts +0 -4
  92. package/dist/components/tabs/Tab.vue.d.ts +1 -1
  93. package/dist/components/tabs/TabPanel.vue.d.ts +1 -3
  94. package/dist/components/tabs/Tabs.vue.d.ts +1 -1
  95. package/dist/components/tabs/types.d.ts +13 -11
  96. package/dist/components/textarea/Textarea.vue.d.ts +4 -4
  97. package/dist/components/textarea/types.d.ts +5 -2
  98. package/dist/components/toast/types.d.ts +9 -3
  99. package/dist/components/tooltip/types.d.ts +4 -3
  100. package/dist/components/unit-input/UnitInput.vue.d.ts +7 -7
  101. package/dist/components/unit-input/types.d.ts +5 -2
  102. package/dist/components/variant-picker/VariantPicker.vue.d.ts +1 -1
  103. package/dist/components/variant-picker/types.d.ts +3 -2
  104. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +0 -1
  105. package/dist/components/visually-hidden/types.d.ts +0 -4
  106. package/dist/components.css +1422 -2310
  107. package/dist/composables/useEldraScope.d.ts +7 -9
  108. package/dist/index.d.ts +5 -6
  109. package/dist/index.js +1357 -880
  110. package/dist/style.css +1427 -2315
  111. package/dist/tailwind.css +11 -2234
  112. package/dist/theme.css +108 -0
  113. package/dist/tokens.css +1 -0
  114. package/dist/utilities.css +2160 -0
  115. package/dist/utils/mergeClass.d.ts +3 -0
  116. package/dist/utils/tagRecipe.d.ts +3 -3
  117. package/dist/vee-validate.js +1 -1
  118. package/package.json +4 -3
  119. package/dist/scoped.css +0 -4623
  120. package/dist/utils/cx.d.ts +0 -31
package/CHANGELOG.md CHANGED
@@ -7,6 +7,7 @@ Release-please writes the generated notes from commit messages and does not repl
7
7
 
8
8
  ### Added
9
9
 
10
+ - **`--eldra-button-border-width`** (default `1px`) sets the border width of every `Button` variant except `link`, at the same height; an attached `ButtonGroup` overlaps its buttons by the same width, so they still share one line.
10
11
  - **`@eldrajs/ui/vue-i18n`** — the kit's messages read through an app's vue-i18n (`useEldraUiI18n()`, or `eldraUiI18nMessages(i18n.global)` for `MESSAGES_KEY`), so the kit is translated with the rest of the app and follows a locale switch. Keys live under `eldraUi.*`; `toVueI18nMessages(enUS | isIS | yours)` produces them (named values, plural forms, a suffixed key per non-count branch such as `pageN_current`); `icelandicPluralRule` for vue-i18n's `pluralRules`. A missing key falls back to English. `vue-i18n ^11` is a new optional peer, imported by this entry only.
11
12
  - **`topLayerDialog(anchor)`** is exported: the open modal `<dialog>` a popup anchored to `anchor` must be teleported into (`body` would paint it behind the top layer), or `null`. The same answer `Select`, `Popover` and `Tooltip` use, for a consumer's own teleported popup.
12
13
  - **`MultiSelect` `tagPlacement: 'inside'`** draws the removable tags in the field, which wraps and grows, with `maxTagRows` (default 2) collapsing the rest into a "+N" tag; new `field` and `tagMore` parts. The default stays `'below'`.
@@ -69,6 +70,12 @@ Release-please writes the generated notes from commit messages and does not repl
69
70
 
70
71
  ### Changed
71
72
 
73
+ - **Breaking: the components ship prebuilt, with `eldra:`-prefixed classes, below the app's utilities.** Every class a component renders is `eldra:`-prefixed (`eldra:px-4`, `eldra:hover:bg-primary`), and `style.css` / `components.css` put them in `@layer components`, below Tailwind's `utilities`. A class you set on a component (`class`, `classes`) is added beside the component's own and wins by layer, in every state (a plain `bg-*` also replaces the hover fill). An app's own Tailwind no longer restyles a component through a same-named utility or theme variable. `tailwind.css` no longer builds the components (its `@source` is gone): a Tailwind app imports `@eldrajs/ui/components.css` beside it. New entries `theme.css` and `utilities.css` (the two halves of `tailwind.css`'s Tailwind part). A test or stylesheet that selects a component by one of its utility classes must use the prefixed name (`.eldra\:px-4`); `data-part` is the stable hook.
74
+ - **Breaking: `cx`, `partClass` and `ClassValue` are no longer exported.** The components bind their classes with Vue's own `class`/`:class`, one class per concern on each element, and a consumer's class is added beside the component's own (it wins by layer) rather than merged. Use Vue's `:class` in your own markup, and `tailwind-merge` directly if you need to merge your own classes.
75
+ - **Breaking: the outermost element is styled with `class`, not `classes`.** The `classes` key for the element `class` already reaches is removed: `root` on almost every component, `Button`'s `container`, `Tab`'s `tab`, `Radio`'s `option`; write `class="…"` instead. `Container`, `Section`, `Icon`, `TablerIcon`, `VisuallyHidden`, `ChipGroup`, `ButtonGroup`, `TabPanel` and `Accordion` had no other part, so they no longer take `classes` (`ContainerPart`, `IconPart`, `SectionPart`, `TablerIconPart` and `VisuallyHiddenPart` are no longer exported). `Toaster` (teleported) and `LogoItem` (a linked one's root part is the inner `<a>`) keep `root`, and `NavMenu` keeps `drawerRoot`. On `Input`, `Textarea`, `UnitInput`, `CurrencyInput`, `QuantityStepper`, `Select`, `MultiSelect`, `SearchBar`, `SearchModal`, `Checkbox` and `Radio`, `class` now styles the root instead of the native control or trigger; every other attribute still goes to the control, and `classes.control` (or the trigger part) styles it. `Popover`'s `class` stays on the panel, with its other attributes.
76
+ - **Breaking: `@eldrajs/ui/scoped.css` is removed**; `components.css` now shares nothing with an app's Tailwind on its own. `provideEldraScope` stays: `data-eldra-scope` and `data-eldra-slot` are theming hooks.
77
+ - **`Button` fits its content by default (`w-fit`).** In a flex column or a grid cell it no longer stretches to the full width; pass `block` for that, or a width class (`w-full`, `w-auto`) in `class`, which wins over `w-fit`. `SiteForm`'s stacked submit keeps its full width below `@two-col`.
78
+ - **Colour changes fade instead of switching.** Hover, selection and other colour changes on every control with a focus ring now run over `--eldra-duration-base` (200ms) with the new `--eldra-ease-in-out` token, instead of `duration-fast` `ease-out`; the press scale stays `duration-fast`. Card title links, facet rows, radio cards, tab indicators and logo wordmarks get the same timing through the new `eldra-transition-colors` utility.
72
79
  - **A controlled `Input` or `Textarea` shows its `modelValue`, not what was typed.** After an input event, and after every render, the native value is written back when it differs from the bound value (`Input`'s masked text), so a parent that refuses a keystroke or strips it (`'12a'` → `'12'`), now or on the next tick, sees the field match its model; the caret keeps its distance from the end. A `modelValue` bound without an `update:modelValue` handler now holds the field still, as a native controlled input does. Like `Checkbox`'s and `RadioGroup`'s `checked`.
73
80
  - **`ToastVariant` gains `info`**: an exhaustive `Record<ToastVariant, …>` or `switch` over it needs an `info` case.
74
81
  - **A ghost `Button` with `pressed`** draws the toggle fill (`surface-strong`, `border-strong`), as `outline` does.
package/README.md CHANGED
@@ -27,47 +27,24 @@ entry needs it, and nothing else in the package imports it.
27
27
 
28
28
  ## Styles
29
29
 
30
- Five CSS entries ship; pick the one that matches how the consumer builds CSS. Every one of them
31
- starts from the same `--eldra-*` variables, so nothing here is a different theme, only a different
32
- delivery shape.
30
+ The components come **prebuilt**: an app never compiles this package's styles and needs no Tailwind
31
+ of its own to use them. Every class a component renders is `eldra:`-prefixed (`eldra:px-4`,
32
+ `eldra:hover:bg-primary`), compiled with Tailwind's `prefix(eldra)`, and every theme variable it
33
+ reads is `--eldra-*`. Nothing in the package's CSS uses a name an app's own Tailwind build uses, so
34
+ the two never restyle each other's markup.
33
35
 
34
- - **`@eldrajs/ui/tokens.css`** — the `--eldra-*` variables only (colours, radii, spacing, type,
35
- motion, z-index, and the one opacity — `--eldra-revalidating-opacity`), declared on `:root` with
36
- the spec's defaults, plus a
37
- `@media (prefers-reduced-motion: reduce)` rule that zeroes every duration variable.
38
- - **`@eldrajs/ui/tailwind.css`** — `tokens.css`, then a Tailwind v4 `@theme` block mapping its own
39
- namespaces onto those variables (`--color-primary: var(--eldra-color-primary)`, `--radius-md`,
40
- `--font-heading`, `--spacing-*`, `--shadow-*`, `--ease-*`) plus the package's custom utilities
41
- (control heights, the `eldra-focus` ring, the type styles, motion and layer utilities) and a
42
- `@source "../dist"` so a consumer's own Tailwind build scans the package's _compiled_ components.
43
- For a project that already runs Tailwind v4, `main.css` (or equivalent) becomes:
36
+ Five CSS entries ship. Every one starts from the same `--eldra-*` variables, so none is a different
37
+ theme, only a different delivery shape.
44
38
 
45
- ```css
46
- @import 'tailwindcss';
47
- @import '@eldrajs/ui/tailwind.css';
48
- ```
49
-
50
- The type styles (`text-body`, `text-h2`, …) set longhands, never the `font` shorthand, and read
51
- their weight as `var(--tw-font-weight, <token>)`, the declaration Tailwind writes for its own
52
- `--text-*--font-weight`. So a `font-medium`/`font-semibold` beside one wins whatever order the two
53
- compile in, and a `tabular-nums` beside one is no longer reset. A base-layer
54
- `@apply font-*` sets `--tw-font-weight` as well, so it reaches a type style on the same element.
55
- Line height and tracking are plain longhands on purpose: the starter's own base rule
56
- (`h1`–`h4` `@apply leading-[1.1] tracking-tight`) would otherwise override every heading's type
57
- style.
58
-
59
- - **`@eldrajs/ui/style.css`** — the package's own compiled build of `tailwind.css` plus every
60
- component's utilities, for a consumer with no Tailwind build of their own:
39
+ - **`@eldrajs/ui/style.css`** — the tokens, Tailwind's preflight and every component's styles, for
40
+ a page built from this package:
61
41
 
62
42
  ```css
63
43
  @import '@eldrajs/ui/style.css';
64
44
  ```
65
45
 
66
- This is also what a project whose own Tailwind build cannot share this package's utility prefix
67
- (a `ui:`-prefixed theme, for example) reaches for.
68
-
69
46
  - **`@eldrajs/ui/components.css`** — `style.css` without Tailwind's preflight, for a site that has
70
- its own stylesheet and adds a few components (a header menu, a cart drawer) to it:
47
+ its own stylesheet (or its own Tailwind) and adds components to it:
71
48
 
72
49
  ```css
73
50
  @import '@eldrajs/ui/components.css';
@@ -85,77 +62,91 @@ delivery shape.
85
62
  `src/styles/__tests__/componentsCss.browser.spec.ts` renders every component family under both,
86
63
  the overlays open, and requires identical pixels.
87
64
 
88
- **The `data-eldra-ui` marker.** Every component's outermost element carries `data-eldra-ui`, and
89
- so does every element a component renders outside it: a `Select` or `MultiSelect` panel, a
90
- `SearchBar` results panel, a `Popover` panel, a `Tooltip` bubble and the `Toaster` region, each
91
- teleported out of its component. The reset reaches exactly those elements and the `data-part`
92
- elements inside them, `:where([data-eldra-ui], [data-eldra-ui] [data-part])`, at zero
93
- specificity. `data-part` alone is not enough, because it is not this package's name: a site's
94
- own `<h2 data-part="title">`, or any Ark UI or Zag component (which put `data-part` on every
95
- element they render), keeps the browser's defaults. The attribute is public and stable, so a
96
- site can use it as a hook too (`a:not([data-eldra-ui], [data-eldra-ui] *)` keeps a site's global
97
- link rule out of the components). One case stays inside the scope: an element carrying its own
98
- `data-part` that the site passes into a component's slot (an Ark UI widget inside a `Dialog`,
99
- say) is a `data-part` element inside a marked root, so it gets the reset as well.
100
-
101
- Either way, the package's rules are in cascade layers and a site's **unlayered** rules beat them
102
- regardless of specificity: a global `a { color: … }` or `button { font: … }` in the site's own CSS
103
- restyles those elements inside the components too. Scope such rules (`.prose a`) or put the
104
- site's stylesheet in a layer declared before the package's.
105
-
106
- - **`@eldrajs/ui/scoped.css`** — for embedding the components in another Tailwind app, or in a
107
- page that already has this package's components of its own. See the next section.
108
-
109
- ### Embedding in another Tailwind app
110
-
111
- The other entries compile to the same names any Tailwind build uses: theme variables
112
- (`--color-text`, `--spacing`, `--radius-md`) and utility classes (`p-4`, `text-text`). Next to an
113
- app's own Tailwind the two themes overwrite each other, and the app's markup inside a component's
114
- slot picks up this package's theme. `scoped.css` is `components.css` rewritten so it shares nothing
115
- with the page:
65
+ - **`@eldrajs/ui/tokens.css`** — the `--eldra-*` variables only (colours, radii, spacing, type,
66
+ motion, z-index, and the one opacity — `--eldra-revalidating-opacity`), declared on `:root` with
67
+ the spec's defaults, plus a `@media (prefers-reduced-motion: reduce)` rule that zeroes every
68
+ duration variable.
116
69
 
117
- ```ts
118
- // In the setup() of a wrapper, or of the app root.
119
- import { provideEldraScope } from '@eldrajs/ui';
120
- provideEldraScope('studio'); // the name is yours; 'default' when left out
70
+ - **`@eldrajs/ui/tailwind.css`** — for an app that runs Tailwind v4 and wants its **own** markup
71
+ on the same design tokens: `tokens.css`, then a `@theme` block mapping Tailwind's namespaces
72
+ onto those variables (`--color-primary: var(--eldra-color-primary)`, `--radius-md`,
73
+ `--font-heading`, `--spacing-*`, `--shadow-*`, `--ease-*`) and the package's custom utilities
74
+ (control heights, the `eldra-focus` ring, the type styles, motion and layer utilities). It builds
75
+ none of the components; import the prebuilt ones beside it. `theme.css` (the `@theme` block) and
76
+ `utilities.css` (the utilities) ship on their own too.
77
+
78
+ ```css
79
+ @import 'tailwindcss';
80
+ @import '@eldrajs/ui/tailwind.css';
81
+ @import '@eldrajs/ui/components.css';
82
+ ```
83
+
84
+ The type styles (`text-body`, `text-h2`, …) set longhands, never the `font` shorthand, and read
85
+ their weight as `var(--tw-font-weight, <token>)`, the declaration Tailwind writes for its own
86
+ `--text-*--font-weight`. So a `font-medium`/`font-semibold` beside one wins whatever order the two
87
+ compile in, and a `tabular-nums` beside one is no longer reset. A base-layer
88
+ `@apply font-*` sets `--tw-font-weight` as well, so it reaches a type style on the same element.
89
+ Line height and tracking are plain longhands on purpose: the starter's own base rule
90
+ (`h1`–`h4` `@apply leading-[1.1] tracking-tight`) would otherwise override every heading's type
91
+ style.
92
+
93
+ ### Overriding a component's classes
94
+
95
+ The components' styles sit in `@layer components`, below Tailwind's `@layer utilities`, and both
96
+ `style.css` and `components.css` declare the standard order (`properties, theme, base, components,
97
+ utilities`), so it holds whichever stylesheet loads first. A class you put on a component, with
98
+ `class` (its outermost element) or a part of `classes` (an element inside it), is not prefixed and
99
+ is added to the component's own classes; it wins by layer, whatever its specificity. Nothing is
100
+ merged or removed at runtime: the components bind their classes the plain Vue way, one class per
101
+ concern on each element.
102
+
103
+ ```vue
104
+ <Button class="px-8">Checkout</Button>
105
+ <!-- renders class="eldra:control-h eldra:px-4.5 … px-8": px-8 wins -->
121
106
  ```
122
107
 
123
- ```css
124
- @import '@eldrajs/ui/scoped.css';
108
+ - It wins in every state: a plain `bg-red-600` on a `Button` replaces its hover and active fills
109
+ too, because a utilities-layer rule beats any components-layer one. Write the states you want
110
+ (`bg-red-600 hover:bg-red-700`).
111
+ - Your app's own Tailwind must generate the class (it is in your source, so it does). Without a
112
+ Tailwind of your own, any CSS of yours that is unlayered or in a layer declared after
113
+ `components` wins the same way.
114
+
115
+ ### The `data-eldra-ui` marker
116
+
117
+ Every component's outermost element carries `data-eldra-ui`, and so does every element a component
118
+ renders outside it: a `Select` or `MultiSelect` panel, a `SearchBar` results panel, a `Popover`
119
+ panel, a `Tooltip` bubble and the `Toaster` region, each teleported out of its component.
120
+ `components.css`'s reset reaches exactly those elements and the `data-part` elements inside them,
121
+ `:where([data-eldra-ui], [data-eldra-ui] [data-part])`, at zero specificity. `data-part` alone is
122
+ not enough, because it is not this package's name: a site's own `<h2 data-part="title">`, or any
123
+ Ark UI or Zag component (which put `data-part` on every element they render), keeps the browser's
124
+ defaults. The attribute is public and stable, so a site can use it as a hook too
125
+ (`a:not([data-eldra-ui], [data-eldra-ui] *)` keeps a site's global link rule out of the
126
+ components). One case stays inside the scope: an element carrying its own `data-part` that the site
127
+ passes into a component's slot (an Ark UI widget inside a `Dialog`, say) is a `data-part` element
128
+ inside a marked root, so it gets the reset as well.
129
+
130
+ A site's **unlayered** element rules beat the package's layered ones regardless of specificity: a
131
+ global `a { color: … }` or `button { font: … }` restyles those elements inside the components too.
132
+ Scope such rules (`.prose a`) or put them in a layer.
133
+
134
+ ### Theming a subtree
135
+
136
+ `provideEldraScope(name)`, called in the `setup()` of a wrapper or an app root, makes every
137
+ component below it render `data-eldra-scope="<name>"` on its root and on every part it teleports
138
+ (panels, bubbles, dialogs, toasts), so the `--eldra-*` variables can be set for those components
139
+ alone, teleported parts included:
125
140
 
126
- /* Re-theme through the --eldra-* variables, on the scope: */
141
+ ```css
127
142
  [data-eldra-scope='studio'] {
128
143
  --eldra-color-primary: #0b5cad;
129
144
  }
130
145
  ```
131
146
 
132
- - **Names.** Every theme variable is renamed into `--eldra-tw-*` (`--color-text` is
133
- `--eldra-tw-color-text`) and every keyframes into `eldra-*`; `--eldra-*` and `--tw-*` keep
134
- theirs. The page's own `--color-text` and `--spacing` are neither read nor overwritten.
135
- - **Scope.** Every component below `provideEldraScope` renders `data-eldra-scope="<name>"` on its
136
- root and on every part it teleports (panels, bubbles, dialogs, toasts), and every rule in
137
- `scoped.css` matches only inside `[data-eldra-scope]`. A page's own components of this package
138
- (unscoped, on `components.css` or `style.css`) are never matched, and the token defaults sit on
139
- the outermost scope root, not on `:root`, so neither side re-themes the other.
140
- - **Slots.** Every element holding slot content you passed in carries `data-eldra-slot` (a
141
- `Button`'s label, a `Dialog`'s title, body and footer, a `Popover` panel, a `Popover` or
142
- `Tooltip` root holding your trigger, a `Chip` label, a select option…), and the scope ends at its children: your markup there is styled by your own
143
- CSS only, so a `class="text-text"` in a button label is your `text-text`. The package's own
144
- elements beside your content carry `data-eldra-scope` and stay styled. The attribute renders
145
- whenever the slot has content, with or without a provider, and never for a fallback.
146
- - **Cascade.** The file is unlayered, so it beats your layered preflight and utilities on the
147
- components' own elements; your classes on a component still win through `classes`/`class`, which
148
- `tailwind-merge` puts in place of the component's own. Your **unlayered** global rules still
149
- reach the components' elements, as with the other entries.
150
- - **Limits.** A class of yours that has the same name as one of this package's (`p-4`) and is set
151
- on a component's own element through `classes` resolves to this package's definition. Layout
152
- rules a component gives its direct children (`ButtonGroup`'s joined corners, `FormLayout`'s
153
- full-width and first-link actions) reach a child that is one of this package's components, not
154
- an element of yours. It needs CSS `@scope`: Chrome 118 and Safari 17.4 or newer, and a Firefox that ships it.
155
-
156
- `scripts/scoped-css.mjs` is the transform; `src/styles/__tests__/componentsCss.browser.spec.ts`
157
- draws every component family, the overlays open, under `scoped.css` beside a Tailwind build whose
158
- theme disagrees on every shared name, and requires the same pixels as `style.css` alone.
147
+ Every element holding slot content you passed in also carries `data-eldra-slot` (a `Button`'s
148
+ label, a `Dialog`'s title, body and footer, a `Popover` panel…), whenever the slot has content and
149
+ never for a fallback, as a hook for your own CSS.
159
150
 
160
151
  ## Fonts
161
152
 
@@ -190,7 +181,7 @@ Every component supports all five of these; none hard-codes anything a store mig
190
181
  | `AvatarGroup` | none — the overlap and stack order are plain Tailwind, no per-component variable |
191
182
  | `Badge` | `--eldra-badge-line-height` (default `1`) — the badge text's line ratio, no token of its own |
192
183
  | `Breadcrumb` | none — the collapse threshold reads `--container-tablet` (`Container`'s own 48rem gutter breakpoint), and the link/ellipsis boxes reuse `target-min`/`eldra-link-radius`/`radius-sm`, no per-component variable of its own |
193
- | `Button` | `--eldra-button-radius` (default `var(--eldra-radius-md)`), `--eldra-button-line-height` (default `1.2`), `--eldra-button-font-size-lg` (default `1.0625rem`, the one button size with no type token of its own) |
184
+ | `Button` | `--eldra-button-radius` (default `var(--eldra-radius-md)`), `--eldra-button-border-width` (default `1px`; the height stays the same, and an attached `ButtonGroup` overlaps by this width), `--eldra-button-line-height` (default `1.2`), `--eldra-button-font-size-lg` (default `1.0625rem`, the one button size with no type token of its own) |
194
185
  | `ButtonGroup` | none — reads only the shared tokens from layer 1 |
195
186
  | `Carousel` | `--eldra-carousel-per-view-base`/`-md`/`-lg` (bound as an inline style on the track by `carouselPerViewStyle`, resolved into `--eldra-carousel-per-view` per container-query breakpoint by the `eldra-carousel-track` utility, no default of its own — a slide with none set stays full width) and `--eldra-carousel-gap` (default `var(--eldra-space-4)`), both read by the `eldra-carousel-slide` utility's width formula; `--eldra-carousel-dot-size` (default `0.5rem`) and `--eldra-carousel-dot-ring` (default `1.5px`), read by `eldra-carousel-dot`; `--eldra-carousel-bleed` (default `0px`) — the inline gutter the track bleeds out to, as its own padding, the negative margin that cancels that padding and its scroll padding at once, each `max()`-ed with the focus ring's reach so a bleed never costs the ring the room the track reserves for it (set it per breakpoint through `classes.track`, never a `px-*`/`-mx-*`/`scroll-px-*` utility of your own — those replace the reservation on that axis instead of composing with it) |
196
187
  | `Checkbox` | `--eldra-checkbox-radius` (default `var(--eldra-radius-sm)`), `--eldra-checkbox-border-width` (default `1.5px`), `--eldra-checkbox-border-width-invalid` (default `2px`) |
@@ -200,7 +191,7 @@ Every component supports all five of these; none hard-codes anything a store mig
200
191
  | `Container` | none — the gutter widths (`--eldra-gutter-{mobile,tablet,desktop}`) are shared tokens, also read by `Section`; the three finite `width` values likewise read the shared `--eldra-container-{narrow,content,wide}` tokens directly, through `Container`'s own `eldra-container-{narrow,content,wide}` utilities rather than Tailwind's `max-w-narrow`/`-content`/`-wide` — see the Deviations entry below |
201
192
  | `ContentCard` | `--eldra-content-card-title-size` (default `1.25rem`) and `--eldra-content-card-title-line` (default `1.3`) — the title's own size and line ratio, no token of its own; `--eldra-content-card-excerpt-size` (default `0.9375rem`) and `--eldra-content-card-excerpt-line` (default `1.5`) — the excerpt's own size and line ratio, shared by `FeatureCard`'s `body` (`text-content-card-excerpt` in `tailwind.css`), since both read the same spec number |
202
193
  | `CurrencyInput` | `UnitInput`'s exactly (it renders a `UnitInput` with `isCurrency` always on) — see the `UnitInput` row |
203
- | `Dialog` | `--eldra-dialog-title-size` (default `1.25rem`), `--eldra-dialog-title-line` (default `1.3`) — the title's own size/line, no token of its own; `--eldra-dialog-width` (default `32rem`), `--eldra-dialog-width-sm` (default `24rem`) — the panel's own width, always capped at `100vw - 2rem` inside the utility itself; `--eldra-dialog-max-height` (default `calc(100vh - 4rem)`); `--eldra-dialog-background` (default `var(--color-background)`), `--eldra-dialog-border` (default `var(--color-border)`), `--eldra-dialog-text` (default `var(--color-text)`, also the close button's hover and press tint), `--eldra-dialog-muted` (default `var(--color-muted)`, the description) and `--eldra-dialog-backdrop` (default `var(--color-overlay)`) — the chrome's own colours, read by the dialog's parts only, so setting them on the `<dialog>` (`classes.root`) recolours it without re-theming the slotted content the way redefining `--eldra-color-*` there would |
194
+ | `Dialog` | `--eldra-dialog-title-size` (default `1.25rem`), `--eldra-dialog-title-line` (default `1.3`) — the title's own size/line, no token of its own; `--eldra-dialog-width` (default `32rem`), `--eldra-dialog-width-sm` (default `24rem`) — the panel's own width, always capped at `100vw - 2rem` inside the utility itself; `--eldra-dialog-max-height` (default `calc(100vh - 4rem)`); `--eldra-dialog-background` (default `var(--color-background)`), `--eldra-dialog-border` (default `var(--color-border)`), `--eldra-dialog-text` (default `var(--color-text)`, also the close button's hover and press tint), `--eldra-dialog-muted` (default `var(--color-muted)`, the description) and `--eldra-dialog-backdrop` (default `var(--color-overlay)`) — the chrome's own colours, read by the dialog's parts only, so setting them on the `<dialog>` (`class`) recolours it without re-theming the slotted content the way redefining `--eldra-color-*` there would |
204
195
  | `Drawer` | `--eldra-drawer-title-size` (default `1.25rem`), `--eldra-drawer-title-line` (default `1.3`) — the title's own size/line, no token of its own (the same numbers as `Dialog`'s, but its own variable pair); `--eldra-drawer-width` (default `28rem`) — the panel's own maximum width, capped at the viewport inside the utility itself, which also carries the full-screen-below-a-48rem-_viewport_ media query; `--eldra-drawer-header-height` (default `4rem`) — the header row's least height, with `--eldra-drawer-header-padding` (default `var(--eldra-space-4)`) — its top and bottom padding, `0px` to centre the row's content in exactly that height, such as a site header's; `--eldra-drawer-gutter` (default `1.5rem`) — the header's, body's and footer's side padding. The device's safe areas (`env(safe-area-inset-*)`) are added around both, so a full-screen drawer clears a notch and the home indicator on a page with `viewport-fit=cover` |
205
196
  | `EditorPlaceholder` | `--eldra-editor-placeholder-border-width` (default `1.5px`) — the dashed boundary's width, distinct from `EmptyState`'s own stock `border` (1px) |
206
197
  | `EmptyState` | `--eldra-empty-state-title-size` (default `1.25rem`) and `--eldra-empty-state-title-line` (default `1.3`) — the title's own size and line ratio, no token of its own |
@@ -262,13 +253,11 @@ Every component supports all five of these; none hard-codes anything a store mig
262
253
  3. **A `classes` prop**, typed `Partial<Record<Part, string>>` where `Part` is the union of that
263
254
  component's `data-part` names from the design spec's anatomy (`container`, `label`,
264
255
  `leadingIcon`, `trailingIcon`, `spinner` for `Button`; see each component's exported
265
- `<Name>Part` type and its Storybook docs page for the exact list). Values merge onto that part's
266
- own classes with `tailwind-merge` (via this package's own `cx`, also exported for a consumer
267
- composing a wrapper the same way), so `classes.root: 'rounded-full'` replaces
268
- `eldra-button-radius` instead of landing beside it. The `@theme` keys that are not t-shirt sizes
269
- (`shadow-float`, the `narrow`/`content`/`wide`/`tablet`/`two-col` container widths) merge the
270
- same way, and a weight is never a conflict with a type style: `classes.label: 'font-bold'` keeps
271
- `text-body-sm` and changes only the weight.
256
+ `<Name>Part` type and its Storybook docs page for the exact list). The outermost element has no
257
+ key: style it with `class`. A part's value is added to that part's own classes and wins by layer
258
+ (see "Overriding a component's classes"), so `class="rounded-full"` on a `Button` beats
259
+ `eldra-button-radius`, and `classes.label: 'font-bold'` keeps `text-body-sm` and changes only
260
+ the weight.
272
261
  4. **A slot for every part that holds content** (`label`, `description`, `error`, `leading`,
273
262
  `trailing`, `empty`, `header`, `footer`, `item`, …), named after the part it replaces.
274
263
  5. **`as`**, on the components whose spec allows a different rendered _root_ element (`Button`,
@@ -1307,7 +1296,7 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
1307
1296
  `remove`; `Enter`/`Space` toggle a selectable chip through the native `<button>`'s own behaviour,
1308
1297
  with no separate keydown handler that could double-toggle. `icon` draws directly (Badge's own
1309
1298
  reasoning: neither chip size's icon dimension or stroke is one of `Icon.vue`'s four); `avatar`
1310
- draws through `Avatar` at the chip's own icon size via `classes.root` — no built-in `Avatar` size
1299
+ draws through `Avatar` at the chip's own icon size via `class` — no built-in `Avatar` size
1311
1300
  is small enough to sit inside either chip size, so it is drawn undersized rather than left at
1312
1301
  `Avatar`'s own smallest, `sm`.
1313
1302
 
@@ -1505,7 +1494,7 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
1505
1494
  order, and a modified key or a key typed into a field is left alone. `Enter`/`Space` stay the
1506
1495
  button's own. Panels are never teleported:
1507
1496
  a `dropdown` hangs under its own item, a `mega` panel spans the menu's root, and a site whose
1508
- header should be the panel's width makes the root `static` (`classes.root`) and its header
1497
+ header should be the panel's width makes the root `static` (`class`) and its header
1509
1498
  `relative` (or `contents`, which makes the bar and the menu button cells of the header's own
1510
1499
  grid). A closing panel fades out over `--eldra-duration-fast`, unclickable while it does.
1511
1500
  `openOnHover` adds a resting mouse pointer to the ways of opening: a panel opens after the
@@ -1743,6 +1732,18 @@ children?, layout?, groups? }`, one level of children. Children sharing a `group
1743
1732
 
1744
1733
  Additions and departures from the design spec, and why.
1745
1734
 
1735
+ - **Colour changes fade over `duration-base` with `ease-in-out`, not `duration-fast` `ease-out`**
1736
+ (operator decision, 2026-11-10). At 150ms on an ease-out curve a hover colour is 85% of the way
1737
+ there after 67ms and reads as a switch. `eldra-focus` and `eldra-focus-inset` now give colour,
1738
+ background, border and underline changes 200ms eased at both ends (`--eldra-ease-in-out`); the
1739
+ press scale and translate stay `duration-fast` `ease-out`, so a press still feels immediate.
1740
+ Elements with no focus utility that change colour on hover (card title links, a facet row, a
1741
+ radio card) carry `eldra-transition-colors`, the same timing. `Switch` keeps `duration-fast`, so
1742
+ its track fills in step with the thumb.
1743
+ - **A `Button` fits its content (`w-fit`)**, also as a flex-column or grid item, where it used to
1744
+ stretch to the full width. `block` is the full-width form; a `w-full` (or any width) in `class`
1745
+ wins over `w-fit` by layer.
1746
+
1746
1747
  - **A `Select`/`MultiSelect` panel's search field draws no focus ring** (operator decision,
1747
1748
  2026-11-09). The spec asks for the inset ring, but the field holds focus for as long as the panel
1748
1749
  is open, so the ring framed it permanently and read as a stray border. The caret, the divider
@@ -1851,7 +1852,7 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
1851
1852
  sibling selector) zeroes a `Section`'s own top padding whenever the **previous** sibling
1852
1853
  `Section` shares its background, and wins over _any_ layered `pt-*`/`py-*` class regardless of
1853
1854
  specificity or source order (CSS Cascade Layers) — not only `spacing`'s own default, but a
1854
- consumer's `classes.root: 'pt-12'` too, since a class from any source still compiles into the
1855
+ consumer's `class="pt-12"` too, since a class from any source still compiles into the
1855
1856
  same layered `@layer utilities`. The escape hatch is one of the two things this rule does not
1856
1857
  touch: give the two `Section`s different `background` values (the rule only fires on a match), or
1857
1858
  reach for an unlayered override of your own (`!pt-12`, which Tailwind never puts in a layer).
@@ -2467,7 +2468,7 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
2467
2468
  bare `/` and is `aria-hidden`, so the full sentence ("Press / to search") has nowhere to be
2468
2469
  announced; it is the chip's tooltip, and the field carries `aria-keyshortcuts="/"`.
2469
2470
  - **A row's active arrow is not animated.** The spec's Sizes table only says "visible only on the
2470
- active row"; the package's own Motion conventions give hover/colour changes `duration-fast`, and
2471
+ active row"; the package's own Motion conventions give hover/colour changes `duration-base`, and
2471
2472
  other components carry their own `transition-*` for a similarly momentary reveal (Link's arrow,
2472
2473
  Switch's thumb and track) — but here `itemArrow` is a plain `v-if="isActive(row)"`, so the arrow
2473
2474
  appears and disappears with the row's active state, not a fade. Nothing in the spec's own text
@@ -2635,7 +2636,7 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
2635
2636
  - **`rounded`** (`'none' | 'lg' | 'xl'`, default `'none'`) forwards straight to `Image`'s own
2636
2637
  `rounded` prop.
2637
2638
  - **`fill`** (`boolean`, default `false`) is for a background image that has to cover its
2638
- positioned ancestor: `ratio="auto"` plus `absolute inset-0 h-full w-full` on `classes.root` and
2639
+ positioned ancestor: `ratio="auto"` plus `absolute inset-0 h-full w-full` on the root (`class`) and
2639
2640
  `h-full w-full` on `classes.frame`, so the frame's height comes from the ancestor via the
2640
2641
  `inset-0`/`h-full` chain instead of needing `media.width`/`height` (which this wrapper never
2641
2642
  has). Used by the hero block's `image-background` variant.
@@ -2686,7 +2687,7 @@ more"` — has no comma before "and". Icelandic's own pattern already has no suc
2686
2687
  cell's own box. Linked, the box (and the `eldra-focus` ring — 2.5.8 needs the _target_ itself at
2687
2688
  least 4rem tall, not just a gutter around it) moves to the `<a>`/`as` cell, and the outer `<li>`
2688
2689
  is bare — no class list, no `data-part`, nothing `classes` can reach, because it carries nothing
2689
- visual to restyle. `classes.root` always reaches the one element that is actually the cell,
2690
+ visual to restyle. `class` always reaches the one element that is actually the cell,
2690
2691
  whichever tag that turns out to be.
2691
2692
  - **No `external` prop; whether the hidden link context appears is judged from `href` itself.**
2692
2693
  `LogoItemProps` (the API contract) has no `external` boolean the way `LinkProps` does, but the spec's
@@ -3567,7 +3568,7 @@ flex items-center target-min` frame `linkClass` gives its sibling, so a non-wrap
3567
3568
  (`eldra-search-modal-width`/`-max-height`/`-position`), the same technique `eldra-drawer-width`
3568
3569
  already documents**, rather than one utility or a class-level arbitrary value — width, max-height
3569
3570
  and position are three different CSS properties a consumer can restyle independently through
3570
- `classes.root`, but each one's own desktop number and its full-screen override must travel
3571
+ `class`, but each one's own desktop number and its full-screen override must travel
3571
3572
  together, the same reasoning `eldra-drawer-width` gives for its own single bundled rule.
3572
3573
  - **The radius/border/shadow removed below 48rem is plain `max-md:rounded-none`/`border-0`/
3573
3574
  `shadow-none` on the root, not a fourth bundled utility.** Unlike the three geometry numbers
@@ -3589,7 +3590,7 @@ flex items-center target-min` frame `linkClass` gives its sibling, so a non-wrap
3589
3590
  (2026-09-27). The component used to build interpolated arbitrary-property classes
3590
3591
  (`` `[--eldra-carousel-per-view:${n}]` ``, plus `@tablet:`/`@content:` steps), and Tailwind has no
3591
3592
  runtime: it scans source _text_ for class names, and an interpolated value is never in that text.
3592
- A consumer's build (`@import '@eldrajs/ui/tailwind.css'`, whose `@source './'` scans `dist/*.js`)
3593
+ A consumer's build (which then compiled the components from `dist/*.js`; they ship prebuilt now)
3593
3594
  therefore emitted no rule for any of the three, `eldra-carousel-slide`'s width formula fell back
3594
3595
  to its own `1`, and every carousel rendered one full-width slide — the starter's testimonials,
3595
3596
  product row, `split-carousel` hero and `carousel` gallery all at once. The package's own Storybook
@@ -3608,16 +3609,6 @@ flex items-center target-min` frame `linkClass` gives its sibling, so a non-wrap
3608
3609
  rather than a throw. Before this (fixed 2026-09-27) the ref was cast straight to `HTMLElement`,
3609
3610
  which reached a component's `focus` only when that component happened to expose one and did
3610
3611
  nothing at all otherwise: the guarantee was silently the consumer's, not the package's.
3611
- - **A `classes` part given an array is flattened, and warned about once per component and part in
3612
- dev.** `classes` is one class string per part, and TypeScript says so — but a JavaScript consumer,
3613
- a `v-bind` of an untyped object and a value out of JSON all reach `partClass` anyway, and
3614
- `Object.entries(['flex', 'gap-4'])` reads an array's _indices_, so an array used to render
3615
- `class="0 1"`: two classes that style nothing, in place of the two that were written. `cx` now
3616
- flattens one the way Vue's own `:class` array syntax does, and `partClass` names the component and
3617
- the part in a single dev `console.warn` (`import.meta.env.DEV`, so production carries neither the
3618
- message nor the check). The component name comes from `getCurrentInstance()`, which is set while a
3619
- component renders — where every `classes` computed is first evaluated — so no call site had to
3620
- change.
3621
3612
  - **`formatDate` takes an `Intl.DateTimeFormatOptions` subset as a third argument**
3622
3613
  (`FormatDateOptions`: `day`, `month`, `year`, `weekday`), with every omitted key keeping the
3623
3614
  spec's own `12 Sep 2026` default rather than dropping that part from the output — so