@eldrajs/ui 0.2.8 → 0.2.9
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.
- package/CHANGELOG.md +45 -0
- package/README.md +259 -87
- package/dist/{VariantPicker-CjWUVhlm.js → VariantPicker-Da41_oGA.js} +2244 -1399
- package/dist/componentNames.d.ts +1 -1
- package/dist/components/button/Button.vue.d.ts +3 -0
- package/dist/components/button/types.d.ts +32 -3
- package/dist/components/card/ContentCard.vue.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/types.d.ts +12 -1
- package/dist/components/chip/Chip.vue.d.ts +4 -3
- package/dist/components/dialog/Dialog.vue.d.ts +12 -7
- package/dist/components/dialog/types.d.ts +11 -2
- package/dist/components/drawer/Drawer.vue.d.ts +1 -0
- package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +3 -0
- package/dist/components/field-wrapper/RequiredMark.vue.d.ts +15 -0
- package/dist/components/field-wrapper/context.d.ts +8 -0
- package/dist/components/field-wrapper/types.d.ts +12 -4
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +3 -2
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -1
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
- package/dist/components/input/Input.vue.d.ts +7 -2
- package/dist/components/input/classes.d.ts +9 -0
- package/dist/components/input/reassertValue.d.ts +13 -0
- package/dist/components/input/types.d.ts +14 -5
- package/dist/components/input/useAdornmentRoom.d.ts +15 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +1 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -0
- package/dist/components/pagination/Pagination.vue.d.ts +154 -0
- package/dist/components/pagination/types.d.ts +31 -0
- package/dist/components/popover/Popover.vue.d.ts +28 -1
- package/dist/components/popover/types.d.ts +57 -3
- package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
- package/dist/components/radio/Radio.vue.d.ts +33 -0
- package/dist/components/radio/RadioGroup.vue.d.ts +4 -0
- package/dist/components/radio/recipes.d.ts +37 -0
- package/dist/components/radio/types.d.ts +64 -3
- package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +1 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +1 -0
- package/dist/components/select/MultiSelect.vue.d.ts +48 -1
- package/dist/components/select/Select.vue.d.ts +20 -0
- package/dist/components/select/SelectPanel.vue.d.ts +23 -0
- package/dist/components/select/SelectTags.vue.d.ts +50 -0
- package/dist/components/select/openRegistry.d.ts +14 -4
- package/dist/components/select/panelParts.d.ts +28 -2
- package/dist/components/select/types.d.ts +45 -7
- package/dist/components/select/useOptionList.d.ts +31 -4
- package/dist/components/select/usePopover.d.ts +36 -39
- package/dist/components/select/useSummaryFit.d.ts +21 -0
- package/dist/components/select/useTagRows.d.ts +17 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +2 -1
- package/dist/components/switch/Switch.vue.d.ts +15 -8
- package/dist/components/switch/types.d.ts +25 -1
- package/dist/components/tabs/Tab.vue.d.ts +1 -0
- package/dist/components/tabs/context.d.ts +6 -2
- package/dist/components/tabs/types.d.ts +9 -0
- package/dist/components/textarea/Textarea.vue.d.ts +21 -1
- package/dist/components/textarea/types.d.ts +11 -2
- package/dist/components/toast/Toast.vue.d.ts +2 -0
- package/dist/components/toast/Toaster.vue.d.ts +7 -1
- package/dist/components/toast/types.d.ts +43 -2
- package/dist/components.css +312 -13
- package/dist/composables/useDialog.d.ts +7 -3
- package/dist/composables/useEldraScope.d.ts +26 -0
- package/dist/composables/useFloating.d.ts +21 -8
- package/dist/composables/useOverlay.d.ts +10 -5
- package/dist/composables/useToast.d.ts +3 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1296 -405
- package/dist/messages/en-US.d.ts +2 -0
- package/dist/messages/is-IS.js +1 -0
- package/dist/resolver.js +1 -0
- package/dist/scoped.css +4623 -0
- package/dist/style.css +312 -13
- package/dist/tailwind.css +43 -12
- package/dist/useMessages-B5nzZghs.js +592 -0
- package/dist/vee-validate.js +42 -6
- package/dist/vue-i18n/index.d.ts +50 -0
- package/dist/vue-i18n/shapes.d.ts +40 -0
- package/dist/vue-i18n.js +289 -0
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Accessible Vue 3 core components for Eldra storefronts, themed through CSS desig
|
|
|
5
5
|
The components are built to
|
|
6
6
|
[`eldra-starter-spec/01-core-components.md`](../../eldra-starter-spec/01-core-components.md) (WCAG
|
|
7
7
|
2.2 AA). Plan 1 — foundations, actions and forms (`Button`/`ButtonGroup`, `Link`, `Input`,
|
|
8
|
-
`Textarea`, `FieldWrapper`, `FormLayout`, `Checkbox`/`CheckboxGroup`, `RadioGroup`, `Switch`,
|
|
8
|
+
`Textarea`, `FieldWrapper`, `FormLayout`, `Checkbox`/`CheckboxGroup`, `Radio`/`RadioGroup`, `Switch`,
|
|
9
9
|
`Select`/`MultiSelect`, `QuantityStepper`, `VariantPicker`, `SearchBar`) — is complete, plus
|
|
10
10
|
`UnitInput` and `CurrencyInput`, which the spec has no equivalent of; display, commerce, layout, overlays, navigation
|
|
11
11
|
and feedback components land in the two sub-projects that follow, in the same delivery order the
|
|
@@ -27,7 +27,7 @@ entry needs it, and nothing else in the package imports it.
|
|
|
27
27
|
|
|
28
28
|
## Styles
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Five CSS entries ship; pick the one that matches how the consumer builds CSS. Every one of them
|
|
31
31
|
starts from the same `--eldra-*` variables, so nothing here is a different theme, only a different
|
|
32
32
|
delivery shape.
|
|
33
33
|
|
|
@@ -103,6 +103,60 @@ delivery shape.
|
|
|
103
103
|
restyles those elements inside the components too. Scope such rules (`.prose a`) or put the
|
|
104
104
|
site's stylesheet in a layer declared before the package's.
|
|
105
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:
|
|
116
|
+
|
|
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
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```css
|
|
124
|
+
@import '@eldrajs/ui/scoped.css';
|
|
125
|
+
|
|
126
|
+
/* Re-theme through the --eldra-* variables, on the scope: */
|
|
127
|
+
[data-eldra-scope='studio'] {
|
|
128
|
+
--eldra-color-primary: #0b5cad;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
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.
|
|
159
|
+
|
|
106
160
|
## Fonts
|
|
107
161
|
|
|
108
162
|
The type tokens' defaults are `--eldra-font-heading: "Bricolage Grotesque", ui-sans-serif,
|
|
@@ -128,68 +182,69 @@ Every component supports all five of these; none hard-codes anything a store mig
|
|
|
128
182
|
token, a component-specific corner radius. Each one is documented on the component's own
|
|
129
183
|
Storybook docs page; the variables currently declared:
|
|
130
184
|
|
|
131
|
-
| Component | CSS variables
|
|
132
|
-
| ------------------- |
|
|
133
|
-
| `Accordion` | none — the top divider is a stock `border-t`, no per-component variable
|
|
134
|
-
| `AccordionItem` | `--eldra-accordion-title-line` (default `1.4`) — the label's line ratio, no token of its own
|
|
135
|
-
| `Avatar` | `--eldra-avatar-initials-size-{sm,md,lg,xl}` (defaults `0.76rem`/`0.95rem`/`1.33rem`/`2.28rem`, "38% of diameter" — no token of its own), `--eldra-avatar-initials-tracking` (default `0.02em`), `--eldra-avatar-icon-size-{sm,md,lg,xl}` (defaults `0.857rem`/`1.071rem`/`1.5rem`/`2.571rem`, the spec's own lg number scaled proportionally to the other three diameters)
|
|
136
|
-
| `AvatarGroup` | none — the overlap and stack order are plain Tailwind, no per-component variable
|
|
137
|
-
| `Badge` | `--eldra-badge-line-height` (default `1`) — the badge text's line ratio, no token of its own
|
|
138
|
-
| `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
|
|
139
|
-
| `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)
|
|
140
|
-
| `ButtonGroup` | none — reads only the shared tokens from layer 1
|
|
141
|
-
| `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)
|
|
142
|
-
| `Checkbox` | `--eldra-checkbox-radius` (default `var(--eldra-radius-sm)`), `--eldra-checkbox-border-width` (default `1.5px`), `--eldra-checkbox-border-width-invalid` (default `2px`)
|
|
143
|
-
| `CheckboxGroup` | none — reads only the shared tokens from layer 1
|
|
144
|
-
| `Chip` | none — the selected/hover fills are `color-mix()` over shared `--eldra-color-*` tokens, no per-component variable
|
|
145
|
-
| `ChipGroup` | none — reads only the shared tokens from layer 1
|
|
146
|
-
| `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
|
|
147
|
-
| `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
|
|
148
|
-
| `CurrencyInput` | `UnitInput`'s exactly (it renders a `UnitInput` with `isCurrency` always on) — see the `UnitInput` row
|
|
149
|
-
| `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)`)
|
|
150
|
-
| `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`
|
|
151
|
-
| `EditorPlaceholder` | `--eldra-editor-placeholder-border-width` (default `1.5px`) — the dashed boundary's width, distinct from `EmptyState`'s own stock `border` (1px)
|
|
152
|
-
| `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
|
|
153
|
-
| `FeatureCard` | Shares `ContentCard`'s `--eldra-content-card-excerpt-size`/`-line` for its own `body` text (`text-content-card-excerpt`); its `title` reads `text-h4` directly, no variable of its own
|
|
154
|
-
| `FieldWrapper` | `--eldra-field-note-line-height` (default `1.45`) — the line the help and error text share
|
|
155
|
-
| `FilterPanel` | `--eldra-filter-subheading-tracking` (default `0.06em`, a size-system sub-heading's letter spacing — the overline token's own 0.12em pushes "SOCKS (EU)" onto two lines in a 15rem sidebar), `--eldra-filter-swatch-edge-width` (default `1px`) and `--eldra-filter-swatch-ring-width` (default `1.5px`) for a colour swatch's edge and the ring it gains when picked, and `--eldra-filter-histogram-bar-min` / `--eldra-filter-histogram-bar-radius` (defaults `2px` / `1px`) for one histogram bar's minimum height and its two top corners. Everything else is a shared token or comes from the components it composes (`Checkbox`, `Switch`, `Chip`, `Badge`, `Input`, `Button`, `CurrencyInput`, `RangeSlider`), each restyled through its own row
|
|
156
|
-
| `FormLayout` | `--eldra-form-summary-radius` (default `var(--eldra-radius-md)`) — the status summary box's corner radius
|
|
157
|
-
| `Icon` | none — reads only the shared tokens from layer 1
|
|
158
|
-
| `Image` | `--eldra-image-hatch-gap` (default `0.75rem`) — the live "No image" placeholder's diagonal-line repeat distance
|
|
159
|
-
| `Input` | `--eldra-input-radius` (default `var(--eldra-radius-md)`), `--eldra-control-font-size` (default `0.9375rem`), `--eldra-control-font-size-mobile` (default `1rem`), `--eldra-control-line-height` (default `1.5rem`), `--eldra-field-border-width` (default `1px`)
|
|
160
|
-
| `Lightbox` | none of its own — the entrance keyframe (`eldra-lightbox-in`) and every size are either shared tokens or literal component-specific classes (`px-16`, `size-11`/`max-md:size-11`), the same "no dedicated variable" shape as `AvatarGroup`/`ButtonGroup`
|
|
161
|
-
| `Link` | `--eldra-link-radius` (default `2px`) — the focus ring's corner radius on every variant
|
|
162
|
-
| `LoadMore` | none — the status/meter/button sizes all reuse shared tokens (`text-body-sm`, `control-h`, `text-button-md`), no per-component variable
|
|
163
|
-
| `LogoItem` | `--eldra-logo-image-max-height` (default `2.5rem`), `--eldra-logo-image-max-width` (default `9rem`) — the logo image's contain box; `--eldra-logo-wordmark-size` (default `1.25rem`) — the wordmark fallback's font size (its weight, line-height and letter-spacing reuse `h2`/`h3` tokens directly, see `text-logo-wordmark` in `tailwind.css`)
|
|
164
|
-
| `NavMenu` | `--eldra-nav-menu-offset` (default `var(--eldra-space-2)`) — the gap between the bar and a panel, drawn as the panel's own top padding so a hovering pointer never leaves the menu; `--eldra-nav-menu-dropdown-min`/`-max` (defaults `14rem`/`24rem`, capped at `100vw - 2rem`) — a dropdown panel's width; `--eldra-nav-menu-column-min` (default `12rem`) — the narrowest a mega panel's column gets before the grid wraps (`classes.columns: 'grid-cols-5'` fixes the count instead). `--eldra-nav-menu-drawer-row-height` (default `3.5rem`) — every top-level row in the drawer, link, accordion row or section heading; `--eldra-nav-menu-drawer-indent` (default `var(--eldra-space-4)`) — how far a panel's links sit in from their row. The drawer itself and the badges are `Drawer` and `Badge`, each restyled through its own row
|
|
165
|
-
| `MultiSelect` | everything `Select` reads, plus `--eldra-select-pill-line` (the "+N" pill's line box) and `--eldra-checkbox-radius`/`--eldra-checkbox-border-width`, shared with `Checkbox` so a consumer restyles both at once
|
|
166
|
-
| `Pagination` | none — every size (the 2.5rem page link/`control-h` previous-next, the `target-touch` compact arrows, the 0.9375rem `text-control` compact status) reuses a shared token or a shared arbitrary spacing multiple, no per-component variable
|
|
167
|
-
| `Popover` | `--eldra-z-popover` (default `30`), shared with the other popover panels
|
|
168
|
-
| `Price` | `--eldra-price-current-sm-size` (default `0.9375rem`), `--eldra-price-current-lg-size` (default `1.5rem`) — only `sm`/`lg` need one: `md`'s current price inherits the surrounding text, and `compareAt`/`from`/`unit` scale off whichever size the root sets (`0.9em`, a literal ratio the spec itself gives, and a fixed `0.8125rem`), so neither needs a variable of its own
|
|
169
|
-
| `ProductCard` | none of its own — it composes `Image`/`Badge`/`StockBadge`/`Price`/`Button`, each restyled through its own row above
|
|
170
|
-
| `QuantityStepper` | `--eldra-stepper-radius` (default `var(--eldra-radius-md)`)
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
185
|
+
| Component | CSS variables |
|
|
186
|
+
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `Accordion` | none — the top divider is a stock `border-t`, no per-component variable |
|
|
188
|
+
| `AccordionItem` | `--eldra-accordion-title-line` (default `1.4`) — the label's line ratio, no token of its own |
|
|
189
|
+
| `Avatar` | `--eldra-avatar-initials-size-{sm,md,lg,xl}` (defaults `0.76rem`/`0.95rem`/`1.33rem`/`2.28rem`, "38% of diameter" — no token of its own), `--eldra-avatar-initials-tracking` (default `0.02em`), `--eldra-avatar-icon-size-{sm,md,lg,xl}` (defaults `0.857rem`/`1.071rem`/`1.5rem`/`2.571rem`, the spec's own lg number scaled proportionally to the other three diameters) |
|
|
190
|
+
| `AvatarGroup` | none — the overlap and stack order are plain Tailwind, no per-component variable |
|
|
191
|
+
| `Badge` | `--eldra-badge-line-height` (default `1`) — the badge text's line ratio, no token of its own |
|
|
192
|
+
| `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) |
|
|
194
|
+
| `ButtonGroup` | none — reads only the shared tokens from layer 1 |
|
|
195
|
+
| `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
|
+
| `Checkbox` | `--eldra-checkbox-radius` (default `var(--eldra-radius-sm)`), `--eldra-checkbox-border-width` (default `1.5px`), `--eldra-checkbox-border-width-invalid` (default `2px`) |
|
|
197
|
+
| `CheckboxGroup` | none — reads only the shared tokens from layer 1 |
|
|
198
|
+
| `Chip` | none — the selected/hover fills are `color-mix()` over shared `--eldra-color-*` tokens, no per-component variable |
|
|
199
|
+
| `ChipGroup` | none — reads only the shared tokens from layer 1 |
|
|
200
|
+
| `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
|
+
| `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
|
+
| `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 |
|
|
204
|
+
| `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
|
+
| `EditorPlaceholder` | `--eldra-editor-placeholder-border-width` (default `1.5px`) — the dashed boundary's width, distinct from `EmptyState`'s own stock `border` (1px) |
|
|
206
|
+
| `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 |
|
|
207
|
+
| `FeatureCard` | Shares `ContentCard`'s `--eldra-content-card-excerpt-size`/`-line` for its own `body` text (`text-content-card-excerpt`); its `title` reads `text-h4` directly, no variable of its own |
|
|
208
|
+
| `FieldWrapper` | `--eldra-field-note-line-height` (default `1.45`) — the line the help and error text share |
|
|
209
|
+
| `FilterPanel` | `--eldra-filter-subheading-tracking` (default `0.06em`, a size-system sub-heading's letter spacing — the overline token's own 0.12em pushes "SOCKS (EU)" onto two lines in a 15rem sidebar), `--eldra-filter-swatch-edge-width` (default `1px`) and `--eldra-filter-swatch-ring-width` (default `1.5px`) for a colour swatch's edge and the ring it gains when picked, and `--eldra-filter-histogram-bar-min` / `--eldra-filter-histogram-bar-radius` (defaults `2px` / `1px`) for one histogram bar's minimum height and its two top corners. Everything else is a shared token or comes from the components it composes (`Checkbox`, `Switch`, `Chip`, `Badge`, `Input`, `Button`, `CurrencyInput`, `RangeSlider`), each restyled through its own row |
|
|
210
|
+
| `FormLayout` | `--eldra-form-summary-radius` (default `var(--eldra-radius-md)`) — the status summary box's corner radius |
|
|
211
|
+
| `Icon` | none — reads only the shared tokens from layer 1 |
|
|
212
|
+
| `Image` | `--eldra-image-hatch-gap` (default `0.75rem`) — the live "No image" placeholder's diagonal-line repeat distance |
|
|
213
|
+
| `Input` | `--eldra-input-radius` (default `var(--eldra-radius-md)`), `--eldra-control-font-size` (default `0.9375rem`), `--eldra-control-font-size-mobile` (default `1rem`), `--eldra-control-line-height` (default `1.5rem`), `--eldra-field-border-width` (default `1px`) |
|
|
214
|
+
| `Lightbox` | none of its own — the entrance keyframe (`eldra-lightbox-in`) and every size are either shared tokens or literal component-specific classes (`px-16`, `size-11`/`max-md:size-11`), the same "no dedicated variable" shape as `AvatarGroup`/`ButtonGroup` |
|
|
215
|
+
| `Link` | `--eldra-link-radius` (default `2px`) — the focus ring's corner radius on every variant |
|
|
216
|
+
| `LoadMore` | none — the status/meter/button sizes all reuse shared tokens (`text-body-sm`, `control-h`, `text-button-md`), no per-component variable |
|
|
217
|
+
| `LogoItem` | `--eldra-logo-image-max-height` (default `2.5rem`), `--eldra-logo-image-max-width` (default `9rem`) — the logo image's contain box; `--eldra-logo-wordmark-size` (default `1.25rem`) — the wordmark fallback's font size (its weight, line-height and letter-spacing reuse `h2`/`h3` tokens directly, see `text-logo-wordmark` in `tailwind.css`) |
|
|
218
|
+
| `NavMenu` | `--eldra-nav-menu-offset` (default `var(--eldra-space-2)`) — the gap between the bar and a panel, drawn as the panel's own top padding so a hovering pointer never leaves the menu; `--eldra-nav-menu-dropdown-min`/`-max` (defaults `14rem`/`24rem`, capped at `100vw - 2rem`) — a dropdown panel's width; `--eldra-nav-menu-column-min` (default `12rem`) — the narrowest a mega panel's column gets before the grid wraps (`classes.columns: 'grid-cols-5'` fixes the count instead). `--eldra-nav-menu-drawer-row-height` (default `3.5rem`) — every top-level row in the drawer, link, accordion row or section heading; `--eldra-nav-menu-drawer-indent` (default `var(--eldra-space-4)`) — how far a panel's links sit in from their row. The drawer itself and the badges are `Drawer` and `Badge`, each restyled through its own row |
|
|
219
|
+
| `MultiSelect` | everything `Select` reads, plus `--eldra-select-pill-line` (the "+N" pill's line box) and `--eldra-checkbox-radius`/`--eldra-checkbox-border-width`, shared with `Checkbox` so a consumer restyles both at once; the tags' own colours `--eldra-select-tag-background` (default `var(--color-surface-strong)`), `--eldra-select-tag-text` (default `var(--color-text)`, also the remove button's hover colour and tint) and `--eldra-select-tag-muted` (default `var(--color-muted)`, the remove button at rest) — read by the tag and remove-button parts only, so `Chip` and a `tag` slot's content keep the theme |
|
|
220
|
+
| `Pagination` | none — every size (the 2.5rem page link/`control-h` previous-next, the `target-touch` compact arrows, the 0.9375rem `text-control` compact status) reuses a shared token or a shared arbitrary spacing multiple, no per-component variable |
|
|
221
|
+
| `Popover` | `--eldra-z-popover` (default `30`), shared with the other popover panels; `--eldra-popover-background` (default `var(--color-background)`), `--eldra-popover-border` (default `var(--color-border)`) and `--eldra-popover-text` (no default: unset, the panel inherits its colour as before) — the panel chrome's own colours, read by the `panel` part only, so setting them recolours it without re-theming the slotted content the way redefining `--eldra-color-*` there would. No size variable: it has no fixed size to clamp, unlike `Select`'s panel |
|
|
222
|
+
| `Price` | `--eldra-price-current-sm-size` (default `0.9375rem`), `--eldra-price-current-lg-size` (default `1.5rem`) — only `sm`/`lg` need one: `md`'s current price inherits the surrounding text, and `compareAt`/`from`/`unit` scale off whichever size the root sets (`0.9em`, a literal ratio the spec itself gives, and a fixed `0.8125rem`), so neither needs a variable of its own |
|
|
223
|
+
| `ProductCard` | none of its own — it composes `Image`/`Badge`/`StockBadge`/`Price`/`Button`, each restyled through its own row above |
|
|
224
|
+
| `QuantityStepper` | `--eldra-stepper-radius` (default `var(--eldra-radius-md)`) |
|
|
225
|
+
| `Radio` | the radio circle reads `--eldra-checkbox-border-width`/`-invalid`, shared with `Checkbox` and `RadioGroup` |
|
|
226
|
+
| `RadioGroup` | `--eldra-radio-card-border-width` (default `1px`) and `--eldra-radio-card-radius` (default `radius-md`) for the card boundary; `--eldra-checkbox-border-width`/`-invalid` for the radio circle itself, shared with `Checkbox` |
|
|
227
|
+
| `RangeSlider` | `--eldra-range-thumb-size` (default `1.25rem`), `--eldra-range-thumb-border-width` (default `1.5px`), `--eldra-range-thumb-halo` (default `0.25rem`, the hover/dragging ring drawn outside the thumb) and `--eldra-range-track-height` (default `0.375rem`), read by the `eldra-range-thumb`/`-track`/`-gutter` utilities — the gutter that keeps a thumb, its focus ring **and** its pointer target inside the control is the larger of the ring's reach and half the target, `calc()`-ed from those variables (and switched on the same 48rem container edge the target is), so enlarging any of them moves the reservation with it |
|
|
228
|
+
| `Rating` | none — the half-star overlay (`eldra-rating-half`) is a fixed `clip-path`, no per-component variable |
|
|
229
|
+
| `SearchBar` | `--eldra-search-panel-max-height` (default `32rem`, clamped to `70vh`), `--eldra-search-text-line`, `--eldra-search-empty-line`, `--eldra-search-kbd-line`, `--eldra-input-radius`, `--eldra-field-border-width`, `--eldra-z-popover`, and `--eldra-popover-origin` (set by the panel itself from the placement it resolved to: `top left` below the field, `bottom left` above it); and `Select`'s `--eldra-select-panel-background`/`-border`/`-text`/`-muted`/`-active` (same defaults) for the results panel's surface, edge and hairlines, rows and chips, headings, minor rows, icons and no-results advice, and the active row and chip fill |
|
|
230
|
+
| `SearchModal` | `--eldra-search-modal-width` (default `40rem`), `--eldra-search-modal-max-height` (default `40rem`) — both clamped to the viewport inside their own utility, which also carries the full-screen-below-a-48rem-_viewport_ media query; `--eldra-search-modal-field-size` (default `1.0625rem`), `--eldra-search-modal-foot-size`/`-line` (defaults `0.75rem`/`1.4`), `--eldra-search-modal-kbd-size` (default `0.6875rem`) — none with a token of their own; plus everything `SearchBar`'s reused `SearchResultsPanel` reads (`--eldra-search-text-line`, `--eldra-search-empty-line`, `--eldra-control-line-height`) |
|
|
231
|
+
| `Section` | none — the vertical rhythm (`--eldra-section-{sm,md,lg}`) and the gutters it shares with `Container` are shared tokens |
|
|
232
|
+
| `Select` | `--eldra-select-panel-max-height` (default `20rem`), `--eldra-select-panel-max-width` (default `22rem`, clamped to `90vw`), `--eldra-z-popover` (default `30`), `--eldra-field-radius`, `--eldra-field-border-width`, `--eldra-select-group-tracking`, `--eldra-select-option-line`, `--eldra-select-swatch-edge`, the `--eldra-select-match-*` trio, and `--eldra-popover-origin` (`top left` / `bottom left`, set by the panel from the placement it resolved to); and the panel chrome's own colours, the `--eldra-select-panel-*` family `MultiSelect` and `SearchBar` read too: `--eldra-select-panel-background` (default `var(--color-background)`; the panel, `MultiSelect`'s footer and an unchosen option box), `--eldra-select-panel-border` (default `var(--color-border)`; the panel's edge, the search field's divider, group and create-row hairlines, the footer's top line), `--eldra-select-panel-text` (default `var(--color-text)` on the search field, the option and create rows; unset, the panel itself inherits its colour as before), `--eldra-select-panel-muted` (default `var(--color-muted)`; the search icon and placeholder, group headings, disabled rows, hints, untoned meta, the empty and loading rows, the footer count), `--eldra-select-panel-active` (default `var(--color-surface-strong)`; the active row's fill), `--eldra-select-panel-check` (the selected mark: default `var(--color-text)` for `Select`'s check, `var(--color-primary)` for `MultiSelect`'s filled box), `--eldra-select-panel-check-contrast` (default `var(--color-primary-contrast)`, `MultiSelect`'s tick) and `--eldra-select-panel-check-border` (default `var(--color-border-strong)`, an unchosen box's edge) — read by the panel's parts only, so setting them on `:root` or the teleport target recolours the panel without re-theming slotted option content the way redefining `--eldra-color-*` there would |
|
|
233
|
+
| `SiteForm` | none of its own: it composes `FormLayout`, `FieldWrapper`, `Input`, `Textarea`, `Select`, `Checkbox` and `Button`, each restyled through its own row; its `classes` reach their parts (see [Site forms](#site-forms)) |
|
|
234
|
+
| `Skeleton` | none — `width` sets an inline style directly (see the Deviations entry), no CSS variable involved |
|
|
235
|
+
| `StockBadge` | `--eldra-stock-status-line` (default `1.4`) — the status line text's line ratio, no token of its own |
|
|
236
|
+
| `Switch` | `--eldra-switch-radius` (default `var(--eldra-radius-full)`), `--eldra-switch-track-border-width` (default `1.5px`), `--eldra-switch-thumb-offset` (default `0.1875rem`, the thumb's rest inset from the track's start edge) |
|
|
237
|
+
| `Tab` | none — reads only the shared tokens from layer 1, plus `VariantPicker`'s `text-variant-pill` type style (no per-component variable of its own; see that component's row) |
|
|
238
|
+
| `TabPanel` | none — reads only the shared tokens from layer 1 |
|
|
239
|
+
| `TablerIcon` | none — reads only the shared tokens from layer 1, the same as `Icon` |
|
|
240
|
+
| `Tabs` | none — reads only the shared tokens from layer 1; the `eldra-scrollbar-hide` utility the tab list uses has no variable of its own. The pills list's own padding, the negative margin that cancels it and its scroll padding are all `calc(var(--eldra-focus-offset) + var(--eldra-focus-width))` — the focus ring's own reach, so raising either ring token widens the room the scrolling list keeps for a focused pill's ring instead of letting it clip (the underline variant reserves nothing: its tabs ring _inside_ their own box, per the design spec, and padding that list vertically would push its hairline off the tabs). Set a gutter through `classes.list` only if it is wider than that reach — a `px-*`/`-mx-*`/`scroll-px-*` utility of your own replaces the reservation on that axis rather than composing with it, the way `--eldra-carousel-bleed` does for the carousel |
|
|
241
|
+
| `Textarea` | `--eldra-textarea-radius` (default `var(--eldra-radius-md)`), `--eldra-textarea-min-height` (set from the `minHeight` prop, default `5rem`), `--eldra-counter-line-height` (default `1.5`) |
|
|
242
|
+
| `Toast` | `--eldra-toast-title-size` (default `0.9375rem`), `--eldra-toast-title-line` (default `1.4`) — the title's own size/line, sitting between two type-scale steps with no token of its own |
|
|
243
|
+
| `Toaster` | `--eldra-toast-width` (default `24rem`) — the fixed region's own width, always capped at `100vw - 2rem` inside the utility itself, the same shape as `Dialog`'s own width variables |
|
|
244
|
+
| `Tooltip` | `--eldra-tooltip-arrow-size` (default `0.3125rem`) — the arrow's side length, no token of its own; `--eldra-z-popover` (default `30`), shared with the popover panels |
|
|
245
|
+
| `UnitInput` | `Input`'s exactly, because it draws `Input`'s box: `--eldra-input-radius`, `--eldra-control-font-size`, `--eldra-control-font-size-mobile`, `--eldra-control-line-height`, `--eldra-field-border-width` (`CurrencyInput` is a `UnitInput`, so the same) |
|
|
246
|
+
| `VariantPicker` | `--eldra-variant-legend-line` (default `1.4`), `--eldra-variant-pill-border-width` (default `1px`), `--eldra-variant-pill-selected-color` (default `var(--eldra-color-text)`), `--eldra-variant-pill-radius` (default `var(--eldra-radius-md)`), `--eldra-variant-swatch-ring-width` (default `2px`), `--eldra-variant-swatch-edge-width` (default `1px`) |
|
|
247
|
+
| `VisuallyHidden` | none — reads only the shared tokens from layer 1 (it renders no visible box at all) |
|
|
193
248
|
|
|
194
249
|
Every component this package ships has a row above; `src/__tests__/readmeCoverage.spec.ts`
|
|
195
250
|
fails the build if `src/componentNames.ts` gains a name this table has not. "None" means the
|
|
@@ -255,6 +310,7 @@ inside one needs no wiring at all:
|
|
|
255
310
|
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
256
311
|
| `id` | Takes it as its own `id`, so the wrapper's `<label for>` names it |
|
|
257
312
|
| `labelId` | The label element's own id, for a control a `<label for>` cannot name (`Select`'s `<button>` trigger uses it as `aria-labelledby`) |
|
|
313
|
+
| `labelled` | `false` when the wrapper draws no label (no `label` prop or slot), so nothing points at `labelId`; the control is named by its own `aria-label` |
|
|
258
314
|
| `describedBy` | The wrapper's error, help and counter ids, in that order |
|
|
259
315
|
| `invalid` | Mirrors it as `aria-invalid="true"` |
|
|
260
316
|
| `required` | Mirrors it as native `required` |
|
|
@@ -315,6 +371,46 @@ import { isIS } from '@eldrajs/ui/messages/is-IS';
|
|
|
315
371
|
app.provide(MESSAGES_KEY, isIS);
|
|
316
372
|
```
|
|
317
373
|
|
|
374
|
+
### With vue-i18n
|
|
375
|
+
|
|
376
|
+
The optional `@eldrajs/ui/vue-i18n` entry reads every message through the app's vue-i18n, so the
|
|
377
|
+
kit is translated where the rest of the app is, and follows a locale switch. `vue-i18n ^11` is an
|
|
378
|
+
optional peer; nothing else in the package imports it.
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
import { createI18n } from 'vue-i18n';
|
|
382
|
+
import { enUS } from '@eldrajs/ui';
|
|
383
|
+
import { isIS } from '@eldrajs/ui/messages/is-IS';
|
|
384
|
+
import { icelandicPluralRule, toVueI18nMessages, useEldraUiI18n } from '@eldrajs/ui/vue-i18n';
|
|
385
|
+
|
|
386
|
+
const i18n = createI18n({
|
|
387
|
+
legacy: false,
|
|
388
|
+
locale: 'is-IS',
|
|
389
|
+
fallbackLocale: 'en-US',
|
|
390
|
+
pluralRules: { 'is-IS': icelandicPluralRule }, // 21 is singular in Icelandic
|
|
391
|
+
messages: {
|
|
392
|
+
'en-US': { eldraUi: toVueI18nMessages(enUS) },
|
|
393
|
+
'is-IS': { eldraUi: toVueI18nMessages(isIS) },
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// in the root component's setup(); or app.provide(MESSAGES_KEY, eldraUiI18nMessages(i18n.global))
|
|
398
|
+
useEldraUiI18n();
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
- **Keys** live under `eldraUi` (option `prefix`): `eldraUi.close`, `eldraUi.createOption`, …
|
|
402
|
+
`toVueI18nMessages` turns any complete message set into them, so start a new language from
|
|
403
|
+
`toVueI18nMessages(enUS)` and translate the values.
|
|
404
|
+
- **Values** are vue-i18n messages: `createOption` is `Create “{query}”`, `resultsCount` is
|
|
405
|
+
`{n} result | {n} results` (plural forms, picked by the count).
|
|
406
|
+
- **Branches** that are not a count get a suffixed key of their own: `pageN` / `pageN_current`,
|
|
407
|
+
`resultsCount` / `resultsCount_query`, `viewAllResults_query`, `stockLow_unknown`,
|
|
408
|
+
`stockPreorder_date`, and `avatarGroup_more` (the "N more" entry the names list ends with).
|
|
409
|
+
- **A key you leave out** falls back to the English default (option `fallback`), so a partial
|
|
410
|
+
translation is fine. The vue-i18n locale's own fallback chain is honoured first.
|
|
411
|
+
- It needs vue-i18n's message compiler (the default build): the messages are strings merged at
|
|
412
|
+
runtime.
|
|
413
|
+
|
|
318
414
|
## Site forms
|
|
319
415
|
|
|
320
416
|
`SiteForm` draws any form a merchant builds in Studio (Settings › Forms) from its public definition,
|
|
@@ -511,10 +607,12 @@ a consumer whose control needs the same six things rather than reassembling them
|
|
|
511
607
|
told not to;
|
|
512
608
|
- **the label-forwarded-click latch** — a `<label for>` naming the trigger forwards its click to
|
|
513
609
|
it, and the spec is explicit that clicking a field's label focuses the control **without**
|
|
514
|
-
opening it. A forwarded click
|
|
515
|
-
|
|
516
|
-
`
|
|
517
|
-
|
|
610
|
+
opening it. A forwarded click differs from a real one in that no pointer was pressed and its
|
|
611
|
+
`detail` is 0, so `onTriggerPointerDown`/`onTriggerClick` (bound to the trigger) arm a latch on
|
|
612
|
+
`pointerdown` and release it on whichever `pointerup`/`pointercancel` follows, wherever it lands.
|
|
613
|
+
A programmatic `element.click()` has the same shape and still toggles: a click counts as
|
|
614
|
+
forwarded when a `<label>` whose control is the trigger was clicked in the same task, or when it
|
|
615
|
+
is trusted, or when it is not a `PointerEvent` (what `click()` dispatches).
|
|
518
616
|
|
|
519
617
|
What stays with each control is what actually differs: which rows there are, what choosing one
|
|
520
618
|
does, and which element the popup is anchored to. See `src/components/select/usePopover.ts` for
|
|
@@ -540,7 +638,8 @@ const { close, isTop } = useDialog({
|
|
|
540
638
|
dialog,
|
|
541
639
|
dismissable: () => !formIsDirty.value, // default true; read on every backdrop click
|
|
542
640
|
initialFocus: someRef, // else the first control that is not `[data-part="close"]`
|
|
543
|
-
onCancel: () => emit('cancel'), // Esc
|
|
641
|
+
onCancel: () => emit('cancel'), // Esc closes — this is a notification, not a guard
|
|
642
|
+
closeOnEscape: true, // default true; false ignores Esc (no onCancel, no close)
|
|
544
643
|
});
|
|
545
644
|
```
|
|
546
645
|
|
|
@@ -577,9 +676,11 @@ spec's own non-negotiable 2):
|
|
|
577
676
|
underneath, so closing the top one lands focus back there instead of on the page;
|
|
578
677
|
- **`Esc`** (the native `cancel` event) — closes the dialog, never gated by `dismissable`, but only
|
|
579
678
|
while it is the top of the stack; `onCancel` is a plain callback with nothing to call
|
|
580
|
-
`preventDefault()` on, so it cannot keep the dialog open
|
|
581
|
-
-
|
|
582
|
-
|
|
679
|
+
`preventDefault()` on, so it cannot keep the dialog open. `closeOnEscape: false` is the one
|
|
680
|
+
opt-out: `Esc` is then ignored (no `onCancel`, no close);
|
|
681
|
+
- **backdrop click** — a `click` whose `target` is the `<dialog>` element itself (not a descendant,
|
|
682
|
+
and not a press that began inside the panel and was released on the backdrop), closing it when
|
|
683
|
+
`dismissable` reads `true` **and** it is the top of the stack.
|
|
583
684
|
|
|
584
685
|
`close(returnValue?)` is exposed so a consumer can close with an action value of their own — a
|
|
585
686
|
`Dialog`'s exposed `close` (`<Dialog ref="dialogRef">` then `dialogRef.value.close('remove')`) is
|
|
@@ -625,6 +726,15 @@ renders: `TOAST_HOST_KEY` (see `useDialog` above) if a modal `Dialog` is open, `
|
|
|
625
726
|
the same hand-off `Dialog`, `Drawer`, `Lightbox` and `SearchModal` already share, so a toast raised
|
|
626
727
|
during a modal flow is never inert behind it.
|
|
627
728
|
|
|
729
|
+
An app with a toast queue of its own renders it through the same `Toaster`: pass it as `toasts`
|
|
730
|
+
(`ToasterToast[]`: `id`, `title`, optional `variant`, `text`, `action`, `closable`, `duration`) and
|
|
731
|
+
the `useToast` store is left alone. Closing a toast, or its `duration` running out, only emits
|
|
732
|
+
`dismiss(id, reason)`; the owner removes it. With no `duration` the owner keeps the time.
|
|
733
|
+
`position` (`top-left` … `bottom-right`, default `bottom-right`), `maxVisible` (the newest kept),
|
|
734
|
+
`newestOnTop` (default `false`) and `teleportTo` (default `body`; an open `Dialog` still wins)
|
|
735
|
+
apply either way. Every toast's root carries `data-variant="success|warning|danger|info"`, so a
|
|
736
|
+
consumer maps per-variant colours with an attribute selector (`[data-eldra-ui][data-variant='info']`).
|
|
737
|
+
|
|
628
738
|
`useCarousel` is the scroll-snap carousel's whole behaviour with no rendering of its own — index
|
|
629
739
|
tracking, previous/next/`goTo`, edge detection for the arrows, and autoplay with the spec's pause
|
|
630
740
|
rules — so `Carousel` renders the markup around it and `Lightbox` (its own track reuses this file
|
|
@@ -1159,6 +1269,22 @@ during development, outside this repository's own history.
|
|
|
1159
1269
|
Things this package ships that design spec 1 does not name at all. Each is listed here so a reader
|
|
1160
1270
|
comparing the package against the spec can tell an addition from a drift.
|
|
1161
1271
|
|
|
1272
|
+
- **Wrapper hooks** (operator decision, 2026-11-08): options that let the private component library
|
|
1273
|
+
render these components as designed instead of keeping copies of them. Each is opt-in, and output
|
|
1274
|
+
is unchanged without it; see the changelog for the details. `Input`/`Textarea`: exposed `control`
|
|
1275
|
+
and `focus()`, a caller's `aria-invalid` kept while valid, `inputmode: false`; an interactive
|
|
1276
|
+
`prefix` slot on `Input`; `clearable` (with `clear`) and `prefix`/`suffix` slots on `Textarea`;
|
|
1277
|
+
measured prefix/suffix room on both. `Dialog`: `--eldra-dialog-*` chrome colours, `title`
|
|
1278
|
+
slot, optional `title`, `closeButton`, `closeOnEscape`. `FieldWrapper`:
|
|
1279
|
+
optional `label`, `labelSuffix` slot, `counter` without `max`. `RadioGroup`: `invalid`, per-option
|
|
1280
|
+
`optionAttrs`/`inputAttrs`, `input`/`dot` parts, optional `legend`, `requiredMark`; and a standalone
|
|
1281
|
+
`Radio`. `Toast`: `info`, `closable`, `data-variant` on the root. `Pagination`: `fixedLength`, `disabled`,
|
|
1282
|
+
`responsive`, `showSinglePage`, `messages`. `Popover`: offset, reference, close and focus
|
|
1283
|
+
switches, `exclusive`, left/right placements. `Select`/`MultiSelect`: `keywords`, `loading`,
|
|
1284
|
+
`creatable`, `renderBatch`, `optionContent`/`leading`/`loading`/`tagItem` slots; `MultiSelect`
|
|
1285
|
+
`tagPlacement: 'inside'` with `maxTagRows`, and `maxSummary: 'fit'`. `Tab`: `disabled`.
|
|
1286
|
+
`Switch`: `thumb`/`trackStart`/`trackEnd` slots, `invalid`. `Checkbox`: box alone without a
|
|
1287
|
+
label. `Button`: pressed fill on `ghost`, a static string `as` tag, `keepNameWhileLoading`.
|
|
1162
1288
|
- **`SiteForm` and `useSiteForm`**: a form from the platform's Forms API, drawn from its public
|
|
1163
1289
|
definition with this package's own controls, checked by the platform's rules and submitted
|
|
1164
1290
|
through `@eldrajs/sdk`. The spec has form controls and a form layout but no platform form; see
|
|
@@ -1346,7 +1472,9 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
|
|
|
1346
1472
|
|
|
1347
1473
|
Its `trigger` is not drawn by the component at all: a scoped slot (`{ open, toggle, attrs }`,
|
|
1348
1474
|
mirroring the private library's own Studio-documented `#trigger="{ triggerAttrs }"` shape) hands
|
|
1349
|
-
the consumer everything to spread (`v-bind="attrs"`) onto whatever element they render
|
|
1475
|
+
the consumer everything to spread (`v-bind="attrs"`) onto whatever element they render (the
|
|
1476
|
+
first element found, looking through fragments, so a wrapper can forward its own `<slot>` into
|
|
1477
|
+
it) — `id`,
|
|
1350
1478
|
`type: 'button'`, `aria-haspopup`, `aria-expanded`, `aria-controls`, a `class` built from
|
|
1351
1479
|
`classes.trigger`, and the click/pointerdown pair — because a generic popover cannot know whether
|
|
1352
1480
|
its trigger should be a `<button>`, an `<a>`, or a table row the way `Select`'s always-a-button
|
|
@@ -1615,6 +1743,17 @@ children?, layout?, groups? }`, one level of children. Children sharing a `group
|
|
|
1615
1743
|
|
|
1616
1744
|
Additions and departures from the design spec, and why.
|
|
1617
1745
|
|
|
1746
|
+
- **A `Select`/`MultiSelect` panel's search field draws no focus ring** (operator decision,
|
|
1747
|
+
2026-11-09). The spec asks for the inset ring, but the field holds focus for as long as the panel
|
|
1748
|
+
is open, so the ring framed it permanently and read as a stray border. The caret, the divider
|
|
1749
|
+
under the field and the active row (`aria-activedescendant`) show where focus is; `SearchModal`'s
|
|
1750
|
+
field and `FilterPanel`'s keep their rings.
|
|
1751
|
+
- **A disabled `Select`/`MultiSelect` option is muted, not struck through** (operator decision,
|
|
1752
|
+
2026-11-08). The row keeps the spec's `muted` text and `not-allowed` cursor; the strike is gone,
|
|
1753
|
+
because a disabled option is as often a fixed, always-on choice as a sold-out one, and the strike
|
|
1754
|
+
read as "removed". A multi-select's disabled _selected_ box is `Checkbox`'s disabled checked box
|
|
1755
|
+
(`muted` fill and border, tick kept) rather than the `primary` fill, and its tag has no remove
|
|
1756
|
+
button. A sold-out reason still goes in `hint` or `meta`.
|
|
1618
1757
|
- **A `FilterPanel`'s applied chips put one more stop in the tab order than the spec's own table
|
|
1619
1758
|
lists.** The spec's Keyboard row reads "head **Clear all**, active chips' remove buttons, then
|
|
1620
1759
|
each group trigger …", and what a shopper actually meets is _chip, remove button, chip, remove
|
|
@@ -1891,9 +2030,11 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
1891
2030
|
`Link`'s, and the spec's "Customisation layers" §5 lists `as` on `Button`. It applies to the link
|
|
1892
2031
|
form only: with `href` set and `as` a component (`NuxtLink`, `RouterLink`), the component receives
|
|
1893
2032
|
the destination as `to`, matching those components' own prop contract; with `as` a plain string it
|
|
1894
|
-
stays a tag (or custom element) that still receives `href`.
|
|
1895
|
-
|
|
1896
|
-
|
|
2033
|
+
stays a tag (or custom element) that still receives `href`. A destination `href` cannot hold (a
|
|
2034
|
+
route object) goes in `to` instead, which a component `as` receives as its own `to`; while
|
|
2035
|
+
disabled it stays the component, `aria-disabled="true"` and `tabindex="-1"`, and its click is
|
|
2036
|
+
cancelled in the capture phase, before the router link's own handler. With neither `href` nor
|
|
2037
|
+
`to` there is no destination to route, so `as` is ignored and this is a `<button>`. Everything else is unchanged: icon-only
|
|
1897
2038
|
and loading naming, `aria-pressed`'s link rule, and the disabled-link semantics below all behave
|
|
1898
2039
|
exactly as they do on a native `<a>`.
|
|
1899
2040
|
- **A disabled `Button` with a component `as` renders a plain `<a href>`, not the router link.**
|
|
@@ -1906,6 +2047,21 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
1906
2047
|
which `href`-implies-link makes unreachable today). Everything else is unchanged — the `href`
|
|
1907
2048
|
stays so it keeps `role="link"`, with `aria-disabled="true"` and `tabindex="-1"` — and it routes
|
|
1908
2049
|
again the moment it is enabled, with no change from the caller.
|
|
2050
|
+
- **`Button`'s slot content and spinner.** A default slot holding elements (an icon beside the
|
|
2051
|
+
text) makes the label a flex row in the button's own `gap`; plain text renders as before.
|
|
2052
|
+
`spinnerPlacement: 'start'` draws the loading spinner in the leading icon's place with the label
|
|
2053
|
+
still visible, and the visible label keeps naming the button (no `aria-label` from `label`).
|
|
2054
|
+
`keepNameWhileLoading` keeps the overlay-hidden label in the accessibility tree (`opacity-0`
|
|
2055
|
+
rather than `invisible`), so slot content still names a loading button with no `label`.
|
|
2056
|
+
- **`Button` as a static tag.** A string `as` other than `'button'`/`'a'` with no `href` renders
|
|
2057
|
+
that tag (`<span>`, `<div>`) with the button look and nothing interactive: no `type`,
|
|
2058
|
+
`disabled`, `tabindex`, `aria-pressed`, `aria-disabled` or `aria-label`, since a generic element
|
|
2059
|
+
takes none of them. It is for a part that only looks like a button inside a control that is
|
|
2060
|
+
itself the button; its name is its own text, and an icon-only one is decorative.
|
|
2061
|
+
- **The focus ring composes with Tailwind shadows.** `eldra-focus` ends its `box-shadow` with
|
|
2062
|
+
`--tw-inset-shadow`, `--tw-inset-ring-shadow`, `--tw-ring-offset-shadow`, `--tw-ring-shadow` and
|
|
2063
|
+
`--tw-shadow`, each empty by default, so a `shadow-*` or `ring-*` on the same element is drawn
|
|
2064
|
+
beneath the ring rather than dropped.
|
|
1909
2065
|
- **`Button` disabled link button keeps its `href`.** A disabled `<a>` that also drops `href`
|
|
1910
2066
|
becomes a generic element and stops exposing `role="link"` — a screen reader stops naming what it
|
|
1911
2067
|
is at the exact moment it needs to say "unavailable". `href` stays, and `aria-disabled="true"`,
|
|
@@ -1970,9 +2126,11 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
1970
2126
|
- **`Input`'s `suffix` slot and the clear button share one end-anchored row**, `data-part="suffix"`,
|
|
1971
2127
|
rather than two independently positioned elements. This keeps both on one row at any size and
|
|
1972
2128
|
gives the keyboard table's "`Tab` reaches the clear button next" order for free, since the row
|
|
1973
|
-
follows the input in DOM order.
|
|
1974
|
-
|
|
1975
|
-
|
|
2129
|
+
follows the input in DOM order. The input's end padding is the spec's 2.5rem for one trailing
|
|
2130
|
+
item; a row wider than that (a spinner, the clear button and a password toggle) is measured once
|
|
2131
|
+
mounted, through a `ResizeObserver`, and the end padding grows to the row's width plus the same
|
|
2132
|
+
0.5rem, as an inline `padding-inline-end` set only then. The `prefix` row does the same at the
|
|
2133
|
+
start. Server-rendered output and the first paint carry the class padding alone.
|
|
1976
2134
|
- **`Input`'s `clearable`/`invalid`/`required`/`describedBy` default to `undefined`, not `false`.**
|
|
1977
2135
|
They fall back to a `FieldWrapper`'s context when there is one, and `false` there would be an
|
|
1978
2136
|
answer rather than "no opinion". (`describedBy` **composes** with the context rather than
|
|
@@ -2122,10 +2280,11 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
2122
2280
|
- **`Select` distinguishes a label's forwarded click from a real one.** "Clicking the Field
|
|
2123
2281
|
wrapper's label focuses the trigger (it doesn't open it)" — but a `<label for>` naming a
|
|
2124
2282
|
`<button>` forwards its click to it, and a forwarded click is otherwise indistinguishable from a
|
|
2125
|
-
real one. The trigger therefore opens
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
`
|
|
2283
|
+
real one. The trigger therefore opens for a click with a pointer press behind it (or a non-zero
|
|
2284
|
+
`detail`) — a press that ends anywhere but the trigger releases the latch, so a drag off the
|
|
2285
|
+
control cannot arm the next click — or for a programmatic `element.click()` (an untrusted
|
|
2286
|
+
`PointerEvent` with no label clicked in the same task), and focuses without opening otherwise.
|
|
2287
|
+
Keyboard activation never goes through a click at
|
|
2129
2288
|
all, because `useListbox` consumes `Enter` and `Space` itself.
|
|
2130
2289
|
- **`Select`'s `disabled` is the native `disabled` attribute.** The spec writes the state as
|
|
2131
2290
|
`tabindex="-1"` plus `aria-disabled="true"`; a real `<button disabled>` is already unfocusable
|
|
@@ -2136,9 +2295,9 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
2136
2295
|
consequence in a browser: a `hidden` control that fails constraint validation cannot be focused
|
|
2137
2296
|
to report the problem, so the form is blocked and the browser logs it rather than showing a
|
|
2138
2297
|
bubble. Pair it with the `FieldWrapper`'s own `error` for a visible message.
|
|
2139
|
-
- **`Select`'s `placement` is read once.** `useFloating`
|
|
2140
|
-
|
|
2141
|
-
change. It is a layout decision — "the footer's selectors use `above`" — not state.
|
|
2298
|
+
- **`Select`'s `placement` is read once.** `Select` hands `useFloating` the value, not a getter
|
|
2299
|
+
(`Popover` follows its `placement` while open), so a select that has to change placement at
|
|
2300
|
+
runtime needs a `:key` change. It is a layout decision — "the footer's selectors use `above`" — not state.
|
|
2142
2301
|
- **The popover panels are teleported, and positioned against the viewport** (operator decision,
|
|
2143
2302
|
2026-09-25). They used to be rendered in place, positioned absolutely inside the component's own
|
|
2144
2303
|
root, on the strength of the spec's own "Don't place a select inside a container that clips
|
|
@@ -2189,7 +2348,20 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
2189
2348
|
- **`MultiSelect`'s `value` slot takes `{ options }`** (the chosen ones, in the order they were
|
|
2190
2349
|
chosen) and fills the `summary` part, and the `tag` slot takes `{ option }` and replaces a chip's
|
|
2191
2350
|
**label**, leaving its remove button in place — a consumer restyling a chip should not have to
|
|
2192
|
-
rebuild the control that empties it.
|
|
2351
|
+
rebuild the control that empties it. A consumer that draws its own whole chip uses the
|
|
2352
|
+
`tagItem` slot instead (`{ option, remove, removable, removeLabel }`): it replaces the chip and
|
|
2353
|
+
its remove button inside the `<li data-part="tag">`, which then draws nothing of its own. The
|
|
2354
|
+
consumer owns the remove control then: render it only while `removable` (false when `disabled` or
|
|
2355
|
+
`readonly`), as a real `<button type="button">` named `removeLabel` ("Remove <label>"), calling
|
|
2356
|
+
`remove`, which deselects and returns focus to the trigger.
|
|
2357
|
+
- **`MultiSelect`'s tags can sit inside the field (`tagPlacement: 'inside'`).** The field then
|
|
2358
|
+
draws the trigger box (the `field` part) and wraps the tags and the trigger, growing a row at a
|
|
2359
|
+
time; the trigger is the rest of the last row, or a row of its own, and the panel matches the
|
|
2360
|
+
field's width. Past `maxTagRows` rows (default 2, `0` for no cap) the rest collapse into a "+N"
|
|
2361
|
+
tag (`tagMore`). `Backspace` on the closed trigger removes the last tag there, where it sits
|
|
2362
|
+
like a chip input's caret; `Delete` still clears. The tag list keeps `role="list"` and its name
|
|
2363
|
+
while `display: contents` lays its chips into the field. `showTags` and `maxSummary` apply to the
|
|
2364
|
+
default `'below'` placement only.
|
|
2193
2365
|
- **`QuantityStepper`'s field is `type="text"`, not the spec anatomy's literal
|
|
2194
2366
|
`<input type="number">`.** A native number input's DOM value can only ever be the US-style,
|
|
2195
2367
|
ungrouped floating-point grammar (digits and a single `.`); it cannot hold a locale-grouped
|