@eldrajs/ui 0.0.0-stage → 0.1.1
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 +1724 -0
- package/LICENSE +21 -0
- package/README.md +3177 -2
- package/dist/VariantPicker-CKw8hmxt.js +9009 -0
- package/dist/componentNames.d.ts +19 -0
- package/dist/components/accordion/Accordion.vue.d.ts +18 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +26 -0
- package/dist/components/accordion/context.d.ts +20 -0
- package/dist/components/accordion/detailsExclusivity.d.ts +3 -0
- package/dist/components/accordion/heightTransition.d.ts +59 -0
- package/dist/components/accordion/types.d.ts +40 -0
- package/dist/components/avatar/Avatar.vue.d.ts +10 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +7 -0
- package/dist/components/avatar/types.d.ts +61 -0
- package/dist/components/badge/Badge.vue.d.ts +24 -0
- package/dist/components/badge/StockBadge.vue.d.ts +10 -0
- package/dist/components/badge/types.d.ts +79 -0
- package/dist/components/breadcrumb/Breadcrumb.vue.d.ts +10 -0
- package/dist/components/breadcrumb/types.d.ts +53 -0
- package/dist/components/button/Button.vue.d.ts +37 -0
- package/dist/components/button/ButtonGroup.vue.d.ts +17 -0
- package/dist/components/button/types.d.ts +68 -0
- package/dist/components/card/ContentCard.vue.d.ts +36 -0
- package/dist/components/card/FeatureCard.vue.d.ts +27 -0
- package/dist/components/card/cueArrow.d.ts +10 -0
- package/dist/components/card/stretchedLink.d.ts +45 -0
- package/dist/components/card/types.d.ts +92 -0
- package/dist/components/carousel/Carousel.vue.d.ts +39 -0
- package/dist/components/carousel/types.d.ts +75 -0
- package/dist/components/carousel/useCarousel.d.ts +152 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +36 -0
- package/dist/components/checkbox/CheckboxGroup.vue.d.ts +16 -0
- package/dist/components/checkbox/types.d.ts +78 -0
- package/dist/components/chip/Chip.vue.d.ts +37 -0
- package/dist/components/chip/ChipGroup.vue.d.ts +21 -0
- package/dist/components/chip/context.d.ts +22 -0
- package/dist/components/chip/types.d.ts +84 -0
- package/dist/components/container/Container.vue.d.ts +18 -0
- package/dist/components/container/types.d.ts +17 -0
- package/dist/components/currency-input/CurrencyInput.vue.d.ts +17 -0
- package/dist/components/currency-input/types.d.ts +8 -0
- package/dist/components/dialog/Dialog.vue.d.ts +34 -0
- package/dist/components/dialog/types.d.ts +25 -0
- package/dist/components/drawer/Drawer.vue.d.ts +36 -0
- package/dist/components/drawer/types.d.ts +30 -0
- package/dist/components/empty-state/EditorPlaceholder.vue.d.ts +9 -0
- package/dist/components/empty-state/EmptyState.vue.d.ts +28 -0
- package/dist/components/empty-state/types.d.ts +59 -0
- package/dist/components/field-wrapper/FieldError.vue.d.ts +37 -0
- package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +30 -0
- package/dist/components/field-wrapper/context.d.ts +44 -0
- package/dist/components/field-wrapper/types.d.ts +38 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +48 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +77 -0
- package/dist/components/filter-panel/Histogram.vue.d.ts +15 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +20 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/shared.d.ts +39 -0
- package/dist/components/filter-panel/northwind.d.ts +32 -0
- package/dist/components/filter-panel/swatchInk.d.ts +50 -0
- package/dist/components/filter-panel/types.d.ts +183 -0
- package/dist/components/filter-panel/useFilterPanel.d.ts +230 -0
- package/dist/components/form-layout/FormLayout.vue.d.ts +36 -0
- package/dist/components/form-layout/context.d.ts +33 -0
- package/dist/components/form-layout/focusInvalid.d.ts +18 -0
- package/dist/components/form-layout/types.d.ts +52 -0
- package/dist/components/icon/Icon.vue.d.ts +8 -0
- package/dist/components/icon/types.d.ts +29 -0
- package/dist/components/image/Image.vue.d.ts +21 -0
- package/dist/components/image/types.d.ts +81 -0
- package/dist/components/input/Input.vue.d.ts +47 -0
- package/dist/components/input/classes.d.ts +110 -0
- package/dist/components/input/types.d.ts +55 -0
- package/dist/components/internal/ValueText.vue.d.ts +7 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +19 -0
- package/dist/components/lightbox/types.d.ts +47 -0
- package/dist/components/link/Link.vue.d.ts +23 -0
- package/dist/components/link/types.d.ts +40 -0
- package/dist/components/load-more/LoadMore.vue.d.ts +12 -0
- package/dist/components/load-more/types.d.ts +21 -0
- package/dist/components/logo-item/LogoItem.vue.d.ts +10 -0
- package/dist/components/logo-item/types.d.ts +37 -0
- package/dist/components/pagination/Pagination.vue.d.ts +15 -0
- package/dist/components/pagination/types.d.ts +51 -0
- package/dist/components/popover/Popover.vue.d.ts +31 -0
- package/dist/components/popover/types.d.ts +53 -0
- package/dist/components/price/Price.vue.d.ts +25 -0
- package/dist/components/price/types.d.ts +104 -0
- package/dist/components/product-card/ProductCard.vue.d.ts +22 -0
- package/dist/components/product-card/types.d.ts +123 -0
- package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +26 -0
- package/dist/components/quantity-stepper/types.d.ts +35 -0
- package/dist/components/radio/RadioGroup.vue.d.ts +38 -0
- package/dist/components/radio/types.d.ts +39 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +70 -0
- package/dist/components/range-slider/types.d.ts +151 -0
- package/dist/components/range-slider/useRangeSlider.d.ts +106 -0
- package/dist/components/rating/Rating.vue.d.ts +22 -0
- package/dist/components/rating/RatingStars.vue.d.ts +16 -0
- package/dist/components/rating/types.d.ts +45 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +47 -0
- package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +93 -0
- package/dist/components/search-bar/shortcutOwner.d.ts +39 -0
- package/dist/components/search-bar/types.d.ts +122 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +53 -0
- package/dist/components/search-modal/types.d.ts +59 -0
- package/dist/components/section/Section.vue.d.ts +21 -0
- package/dist/components/section/context.d.ts +23 -0
- package/dist/components/section/types.d.ts +34 -0
- package/dist/components/select/MultiSelect.vue.d.ts +62 -0
- package/dist/components/select/Select.vue.d.ts +57 -0
- package/dist/components/select/SelectPanel.vue.d.ts +97 -0
- package/dist/components/select/openRegistry.d.ts +11 -0
- package/dist/components/select/panelParts.d.ts +91 -0
- package/dist/components/select/types.d.ts +129 -0
- package/dist/components/select/useListbox.d.ts +106 -0
- package/dist/components/select/useOptionList.d.ts +61 -0
- package/dist/components/select/usePopover.d.ts +147 -0
- package/dist/components/skeleton/Skeleton.vue.d.ts +12 -0
- package/dist/components/skeleton/types.d.ts +38 -0
- package/dist/components/spinner/Spinner.vue.d.ts +3 -0
- package/dist/components/switch/Switch.vue.d.ts +30 -0
- package/dist/components/switch/types.d.ts +20 -0
- package/dist/components/tabs/Tab.vue.d.ts +17 -0
- package/dist/components/tabs/TabPanel.vue.d.ts +16 -0
- package/dist/components/tabs/Tabs.vue.d.ts +28 -0
- package/dist/components/tabs/context.d.ts +48 -0
- package/dist/components/tabs/types.d.ts +63 -0
- package/dist/components/textarea/Textarea.vue.d.ts +27 -0
- package/dist/components/textarea/supportsFieldSizing.d.ts +10 -0
- package/dist/components/textarea/types.d.ts +32 -0
- package/dist/components/toast/Toast.vue.d.ts +16 -0
- package/dist/components/toast/Toaster.vue.d.ts +13 -0
- package/dist/components/toast/types.d.ts +44 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +9 -0
- package/dist/components/tooltip/supportsFocusVisible.d.ts +17 -0
- package/dist/components/tooltip/types.d.ts +46 -0
- package/dist/components/unit-input/UnitInput.vue.d.ts +55 -0
- package/dist/components/unit-input/types.d.ts +68 -0
- package/dist/components/unit-input/undo-redo.d.ts +6 -0
- package/dist/components/variant-picker/VariantPicker.vue.d.ts +15 -0
- package/dist/components/variant-picker/types.d.ts +49 -0
- package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +18 -0
- package/dist/components/visually-hidden/types.d.ts +14 -0
- package/dist/composables/dialogStack.d.ts +52 -0
- package/dist/composables/teleportTarget.d.ts +79 -0
- package/dist/composables/useControllableModel.d.ts +16 -0
- package/dist/composables/useDialog.d.ts +84 -0
- package/dist/composables/useFloating.d.ts +82 -0
- package/dist/composables/useHeadingTag.d.ts +24 -0
- package/dist/composables/useLocale.d.ts +81 -0
- package/dist/composables/useMessages.d.ts +30 -0
- package/dist/composables/useOverlay.d.ts +88 -0
- package/dist/composables/useSlotPresence.d.ts +29 -0
- package/dist/composables/useToast.d.ts +53 -0
- package/dist/icons/paths.d.ts +10 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +12586 -0
- package/dist/listFormat-1UrH38f2.js +39 -0
- package/dist/messages/en-US.d.ts +485 -0
- package/dist/messages/index.d.ts +2 -0
- package/dist/messages/is-IS.d.ts +16 -0
- package/dist/messages/is-IS.js +169 -0
- package/dist/resolver.d.ts +43 -0
- package/dist/resolver.js +121 -0
- package/dist/style.css +5251 -0
- package/dist/tailwind.css +2057 -0
- package/dist/tokens.css +134 -0
- package/dist/utils/avatar.d.ts +15 -0
- package/dist/utils/color.d.ts +11 -0
- package/dist/utils/cssTiming.d.ts +40 -0
- package/dist/utils/cx.d.ts +31 -0
- package/dist/utils/date.d.ts +45 -0
- package/dist/utils/id.d.ts +36 -0
- package/dist/utils/listFormat.d.ts +22 -0
- package/dist/utils/mask.d.ts +48 -0
- package/dist/utils/number-format.d.ts +250 -0
- package/dist/utils/numeric-input.d.ts +42 -0
- package/dist/utils/rating.d.ts +26 -0
- package/dist/utils/ratio.d.ts +18 -0
- package/dist/utils/tagRecipe.d.ts +24 -0
- package/dist/utils/valueFade.d.ts +42 -0
- package/dist/vee-validate/FieldCheckbox.vue.d.ts +14 -0
- package/dist/vee-validate/FieldCheckboxGroup.vue.d.ts +14 -0
- package/dist/vee-validate/FieldCurrencyInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldMultiSelect.vue.d.ts +14 -0
- package/dist/vee-validate/FieldQuantityStepper.vue.d.ts +14 -0
- package/dist/vee-validate/FieldRadioGroup.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSearchBar.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSelect.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSwitch.vue.d.ts +14 -0
- package/dist/vee-validate/FieldTextarea.vue.d.ts +14 -0
- package/dist/vee-validate/FieldUnitInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldVariantPicker.vue.d.ts +14 -0
- package/dist/vee-validate/Form.vue.d.ts +27 -0
- package/dist/vee-validate/context.d.ts +48 -0
- package/dist/vee-validate/index.d.ts +27 -0
- package/dist/vee-validate/types.d.ts +115 -0
- package/dist/vee-validate/useFieldControl.d.ts +67 -0
- package/dist/vee-validate.js +1154 -0
- package/package.json +105 -3
package/README.md
CHANGED
|
@@ -1,3 +1,3178 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@eldrajs/ui`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessible Vue 3 core components for Eldra storefronts, themed through CSS design tokens.
|
|
4
|
+
|
|
5
|
+
The components are built to
|
|
6
|
+
[`eldra-starter-spec/01-core-components.md`](../../eldra-starter-spec/01-core-components.md) (WCAG
|
|
7
|
+
2.2 AA). Plan 1 — foundations, actions and forms (`Button`/`ButtonGroup`, `Link`, `Input`,
|
|
8
|
+
`Textarea`, `FieldWrapper`, `FormLayout`, `Checkbox`/`CheckboxGroup`, `RadioGroup`, `Switch`,
|
|
9
|
+
`Select`/`MultiSelect`, `QuantityStepper`, `VariantPicker`, `SearchBar`) — is complete, plus
|
|
10
|
+
`UnitInput` and `CurrencyInput`, which the spec has no equivalent of; display, commerce, layout, overlays, navigation
|
|
11
|
+
and feedback components land in the two sub-projects that follow, in the same delivery order the
|
|
12
|
+
spec's "Components and delivery order" section lays out. What this package ships that the spec does
|
|
13
|
+
not name is listed under
|
|
14
|
+
[Additions beyond the spec](#additions-beyond-the-spec), and where it departs from a property table
|
|
15
|
+
it is recorded under [Deviations](#deviations) — neither is left for a reader to find.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @eldrajs/ui vue
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Peer: **`vue ^3.5`**. The floor is 3.5, not 3.4: every control's ids come from `useId()`, which Vue
|
|
24
|
+
added in 3.5, so on 3.4 the install succeeds and the first control to mount throws
|
|
25
|
+
`useId is not a function`. `vee-validate ^4.12` is an **optional** peer — only the `./vee-validate`
|
|
26
|
+
entry needs it, and nothing else in the package imports it.
|
|
27
|
+
|
|
28
|
+
## Styles
|
|
29
|
+
|
|
30
|
+
Three 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.
|
|
33
|
+
|
|
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:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
@import 'tailwindcss';
|
|
47
|
+
@import '@eldrajs/ui/tailwind.css';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **`@eldrajs/ui/style.css`** — the package's own compiled build of `tailwind.css` plus every
|
|
51
|
+
component's utilities, for a consumer with no Tailwind build of their own:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@import '@eldrajs/ui/style.css';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This is also what a project whose own Tailwind build cannot share this package's utility prefix
|
|
58
|
+
(a `ui:`-prefixed theme, for example) reaches for.
|
|
59
|
+
|
|
60
|
+
## Fonts
|
|
61
|
+
|
|
62
|
+
The type tokens' defaults are `--eldra-font-heading: "Bricolage Grotesque", ui-sans-serif,
|
|
63
|
+
system-ui, -apple-system, "Segoe UI", sans-serif` and `--eldra-font-body: "Instrument Sans",
|
|
64
|
+
ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`. The package does not load either
|
|
65
|
+
font — it only names them — so a consumer either loads Bricolage Grotesque and Instrument Sans
|
|
66
|
+
themselves (self-hosted, or a Google Fonts `<link>`/`@import`) or overrides `--eldra-font-heading`
|
|
67
|
+
and `--eldra-font-body` with their own stack. Until one or the other happens, text renders in the
|
|
68
|
+
fallback system stack, which is legible but not the spec's intended look.
|
|
69
|
+
|
|
70
|
+
## Customisation
|
|
71
|
+
|
|
72
|
+
Every component supports all five of these; none hard-codes anything a store might want to change.
|
|
73
|
+
|
|
74
|
+
1. **Tokens.** Every colour, radius, height, spacing step, font, duration, easing and z-index a
|
|
75
|
+
component uses resolves to a `--eldra-*` variable from [Styles](#styles) above — set one on any
|
|
76
|
+
ancestor (typically `:root`) and every component reading it follows. **`:root` rather than a
|
|
77
|
+
wrapper**, for the popup panels: `Select`, `MultiSelect` and `SearchBar` render theirs through a
|
|
78
|
+
`<Teleport>` to `body` (see [Layering](#layering)), so a variable set on a `<div>` around the
|
|
79
|
+
control is not an ancestor of the panel any more and is not inherited by it.
|
|
80
|
+
2. **Per-component CSS variables**, declared on the component's own root with a token-derived
|
|
81
|
+
default, for the handful of values that are not shared design tokens — a size with no dedicated
|
|
82
|
+
token, a component-specific corner radius. Each one is documented on the component's own
|
|
83
|
+
Storybook docs page; the variables currently declared:
|
|
84
|
+
|
|
85
|
+
| Component | CSS variables |
|
|
86
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
87
|
+
| `Accordion` | none — the top divider is a stock `border-t`, no per-component variable |
|
|
88
|
+
| `AccordionItem` | `--eldra-accordion-title-line` (default `1.4`) — the label's line ratio, no token of its own |
|
|
89
|
+
| `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) |
|
|
90
|
+
| `AvatarGroup` | none — the overlap and stack order are plain Tailwind, no per-component variable |
|
|
91
|
+
| `Badge` | `--eldra-badge-line-height` (default `1`) — the badge text's line ratio, no token of its own |
|
|
92
|
+
| `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 |
|
|
93
|
+
| `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) |
|
|
94
|
+
| `ButtonGroup` | none — reads only the shared tokens from layer 1 |
|
|
95
|
+
| `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) |
|
|
96
|
+
| `Checkbox` | `--eldra-checkbox-radius` (default `var(--eldra-radius-sm)`), `--eldra-checkbox-border-width` (default `1.5px`), `--eldra-checkbox-border-width-invalid` (default `2px`) |
|
|
97
|
+
| `CheckboxGroup` | none — reads only the shared tokens from layer 1 |
|
|
98
|
+
| `Chip` | none — the selected/hover fills are `color-mix()` over shared `--eldra-color-*` tokens, no per-component variable |
|
|
99
|
+
| `ChipGroup` | none — reads only the shared tokens from layer 1 |
|
|
100
|
+
| `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 |
|
|
101
|
+
| `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 |
|
|
102
|
+
| `CurrencyInput` | `UnitInput`'s exactly (it renders a `UnitInput` with `isCurrency` always on) — see the `UnitInput` row |
|
|
103
|
+
| `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)`) |
|
|
104
|
+
| `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 |
|
|
105
|
+
| `EditorPlaceholder` | `--eldra-editor-placeholder-border-width` (default `1.5px`) — the dashed boundary's width, distinct from `EmptyState`'s own stock `border` (1px) |
|
|
106
|
+
| `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 |
|
|
107
|
+
| `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 |
|
|
108
|
+
| `FieldWrapper` | `--eldra-field-note-line-height` (default `1.45`) — the line the help and error text share |
|
|
109
|
+
| `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 |
|
|
110
|
+
| `FormLayout` | `--eldra-form-summary-radius` (default `var(--eldra-radius-md)`) — the status summary box's corner radius |
|
|
111
|
+
| `Icon` | none — reads only the shared tokens from layer 1 |
|
|
112
|
+
| `Image` | `--eldra-image-hatch-gap` (default `0.75rem`) — the live "No image" placeholder's diagonal-line repeat distance |
|
|
113
|
+
| `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`) |
|
|
114
|
+
| `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` |
|
|
115
|
+
| `Link` | `--eldra-link-radius` (default `2px`) — the focus ring's corner radius on every variant |
|
|
116
|
+
| `LoadMore` | none — the status/meter/button sizes all reuse shared tokens (`text-body-sm`, `control-h`, `text-button-md`), no per-component variable |
|
|
117
|
+
| `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`) |
|
|
118
|
+
| `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 |
|
|
119
|
+
| `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 |
|
|
120
|
+
| `Popover` | `--eldra-z-popover` (default `30`), shared with the other popover panels — no per-component variable of its own: it has no fixed size to clamp, unlike `Select`'s panel |
|
|
121
|
+
| `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 |
|
|
122
|
+
| `ProductCard` | none of its own — it composes `Image`/`Badge`/`StockBadge`/`Price`/`Button`, each restyled through its own row above |
|
|
123
|
+
| `QuantityStepper` | `--eldra-stepper-radius` (default `var(--eldra-radius-md)`) |
|
|
124
|
+
| `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` |
|
|
125
|
+
| `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 |
|
|
126
|
+
| `Rating` | none — the half-star overlay (`eldra-rating-half`) is a fixed `clip-path`, no per-component variable |
|
|
127
|
+
| `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) |
|
|
128
|
+
| `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`) |
|
|
129
|
+
| `Section` | none — the vertical rhythm (`--eldra-section-{sm,md,lg}`) and the gutters it shares with `Container` are shared tokens |
|
|
130
|
+
| `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) |
|
|
131
|
+
| `Skeleton` | none — `width` sets an inline style directly (see the Deviations entry), no CSS variable involved |
|
|
132
|
+
| `StockBadge` | `--eldra-stock-status-line` (default `1.4`) — the status line text's line ratio, no token of its own |
|
|
133
|
+
| `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) |
|
|
134
|
+
| `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) |
|
|
135
|
+
| `TabPanel` | none — reads only the shared tokens from layer 1 |
|
|
136
|
+
| `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 |
|
|
137
|
+
| `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`) |
|
|
138
|
+
| `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 |
|
|
139
|
+
| `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 |
|
|
140
|
+
| `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 |
|
|
141
|
+
| `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) |
|
|
142
|
+
| `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`) |
|
|
143
|
+
| `VisuallyHidden` | none — reads only the shared tokens from layer 1 (it renders no visible box at all) |
|
|
144
|
+
|
|
145
|
+
Every component this package ships has a row above; `src/__tests__/readmeCoverage.spec.ts`
|
|
146
|
+
fails the build if `src/componentNames.ts` gains a name this table has not. "None" means the
|
|
147
|
+
component reads only the shared tokens from layer 1 above, with no CSS variable of its own.
|
|
148
|
+
|
|
149
|
+
One variable in that list is **derived, not a knob**: `--eldra-field-invalid-radius` is declared
|
|
150
|
+
by the `eldra-field-invalid` utility on the field root that carries it (every control with the
|
|
151
|
+
2px error boundary — `Input`, `UnitInput`, `Select`, `MultiSelect`, `Textarea`, `SearchBar`) as
|
|
152
|
+
`var(--eldra-field-radius, var(--eldra-input-radius, var(--eldra-radius-md)))`, so the inset
|
|
153
|
+
error line can round to the field's own corner minus the border width. It exists because a
|
|
154
|
+
two-deep `var()` fallback written inline inside a `calc()` makes every consumer's PostCSS print a
|
|
155
|
+
parse warning — see the Deviations entry. Setting it from outside does nothing, because the
|
|
156
|
+
utility declares it on the same element: change the radius it reads instead.
|
|
157
|
+
|
|
158
|
+
3. **A `classes` prop**, typed `Partial<Record<Part, string>>` where `Part` is the union of that
|
|
159
|
+
component's `data-part` names from the design spec's anatomy (`container`, `label`,
|
|
160
|
+
`leadingIcon`, `trailingIcon`, `spinner` for `Button`; see each component's exported
|
|
161
|
+
`<Name>Part` type and its Storybook docs page for the exact list). Values merge onto that part's
|
|
162
|
+
own classes with `tailwind-merge` (via this package's own `cx`, also exported for a consumer
|
|
163
|
+
composing a wrapper the same way), so `classes.root: 'rounded-full'` replaces
|
|
164
|
+
`eldra-button-radius` instead of landing beside it.
|
|
165
|
+
4. **A slot for every part that holds content** (`label`, `description`, `error`, `leading`,
|
|
166
|
+
`trailing`, `empty`, `header`, `footer`, `item`, …), named after the part it replaces.
|
|
167
|
+
5. **`as`**, on the components whose spec allows a different rendered _root_ element (`Button`,
|
|
168
|
+
`Link`, `Badge`, `Container`, `Section`, `VisuallyHidden`, `Rating`, `LogoItem`). `Button` renders
|
|
169
|
+
an `<a>` automatically when `href` is set, without needing `as` for that case; `Badge` defaults
|
|
170
|
+
to `<span>` and is never a link; `Section` picks `<section>`/`<div>` itself from whether it is
|
|
171
|
+
named (`as` overrides that choice outright, for a `<header>`/`<footer>` landmark that needs no
|
|
172
|
+
name of its own). **`linkAs`**, not `as`, on `ContentCard`/`FeatureCard`/`ProductCard`/
|
|
173
|
+
`Breadcrumb`/`Pagination`: each of these has a spec-fixed root (`<article>`/`<div>`/`<nav>`), and
|
|
174
|
+
`linkAs` instead picks the element for a _nested_ part — the stretched title link on the cards,
|
|
175
|
+
every level's link on `Breadcrumb`, a page/previous/next control on `Pagination` — so the name
|
|
176
|
+
never collides with the root-tag meaning `as` carries everywhere else (a string still takes
|
|
177
|
+
`href`; a component receives the destination as `to`, the same contract `as` uses).
|
|
178
|
+
|
|
179
|
+
Two naming rules hold across every component, on top of the five capabilities above:
|
|
180
|
+
|
|
181
|
+
- **`ariaLabel` is always an accessible name; `label`/`title` are visible text.** `Section.ariaLabel`
|
|
182
|
+
and `ChipGroup.ariaLabel` render `aria-label` and nothing else — there is no visible text
|
|
183
|
+
anywhere they could name instead. `label` means visible content everywhere else it appears
|
|
184
|
+
(`Badge`, `Chip`, `Checkbox`, `Select`, `RadioGroup`, `VariantPicker`, `EditorPlaceholder`), and
|
|
185
|
+
`FormLayout`/`CheckboxGroup`/`RadioGroup`'s own `ariaLabel` prop (plan 1) already followed this
|
|
186
|
+
rule — `Section`/`ChipGroup` used to call the same accessible-name-only concept `label`, which
|
|
187
|
+
the starter's own `[...slug].vue` fell into once, passing `:label` where `:labelled-by` pointing
|
|
188
|
+
at a real heading was the fix (see the Deviations entry). `AvatarGroup.label` is the one
|
|
189
|
+
exception that is not a bug: it is spoken content ("Makers: Ingrid, Tomas…"), not an
|
|
190
|
+
accessible-name-only prop.
|
|
191
|
+
- **The visually hidden part on a component with one is always named `srText`**, not `srLabel` —
|
|
192
|
+
`Avatar`/`LogoItem`/`Price` (`Price.compareAt`'s hidden "Sale price"/"Regular price" labels used
|
|
193
|
+
to be `srLabel`) all agree on `srText` now. `Badge`'s `hiddenSuffix` is a deliberate exception: it
|
|
194
|
+
mirrors its own prop name (`hiddenSuffix`), not a generic "hidden text" part.
|
|
195
|
+
|
|
196
|
+
## Fields: the context a `FieldWrapper` provides
|
|
197
|
+
|
|
198
|
+
A `FieldWrapper` owns the visible label, the help text and the error message, and provides what it
|
|
199
|
+
knows to the control inside it (`FIELD_KEY`, typed as `FieldContext`) — so a bare `<Input />`
|
|
200
|
+
inside one needs no wiring at all:
|
|
201
|
+
|
|
202
|
+
| Field | What the control does with it |
|
|
203
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
204
|
+
| `id` | Takes it as its own `id`, so the wrapper's `<label for>` names it |
|
|
205
|
+
| `labelId` | The label element's own id, for a control a `<label for>` cannot name (`Select`'s `<button>` trigger uses it as `aria-labelledby`) |
|
|
206
|
+
| `describedBy` | The wrapper's error, help and counter ids, in that order |
|
|
207
|
+
| `invalid` | Mirrors it as `aria-invalid="true"` |
|
|
208
|
+
| `required` | Mirrors it as native `required` |
|
|
209
|
+
| `labelsControl` | `false` for a `group` (a `<fieldset>` named by its `<legend>`): a control that draws a label of its own keeps it, and nothing claims the fieldset's id |
|
|
210
|
+
|
|
211
|
+
**`id`, `invalid` and `required` are replaced by the control's own props; `describedBy` is
|
|
212
|
+
composed.** One rule for every control here: **its own ids come first, then the context's.** So a
|
|
213
|
+
`describedBy` prop _adds_ to the wrapper's error and help ids rather than replacing them —
|
|
214
|
+
|
|
215
|
+
```vue
|
|
216
|
+
<FieldWrapper label="Email" error="Enter a valid email">
|
|
217
|
+
<Input described-by="newsletter-note" />
|
|
218
|
+
</FieldWrapper>
|
|
219
|
+
<!-- aria-describedby="newsletter-note <error-id>" — the error is still described -->
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
— and so does a control's own part: `Switch`'s description id and the group controls'
|
|
223
|
+
(`RadioGroup`, `CheckboxGroup`, `QuantityStepper`) own error id both lead, with the context's ids
|
|
224
|
+
after them. `aria-describedby` is announced in the order its ids are listed, so the control's own
|
|
225
|
+
message is heard first.
|
|
226
|
+
|
|
227
|
+
**`Textarea` is the one exception, and it is deliberate:** its order is `describedBy` prop, then the
|
|
228
|
+
context's ids, then its **own counter** last — `joinIds(joinIds(prop, context), counterId)`. The
|
|
229
|
+
counter is a running "18 of 200 characters", not something that has to be heard before the error
|
|
230
|
+
that says what to fix, so it is the one own-part that trails rather than leads.
|
|
231
|
+
|
|
232
|
+
Ids are deduplicated **per id, not per argument** — every value here may itself be several
|
|
233
|
+
space-separated ids, so `joinIds('a b', 'b c')` is `'a b c'` and not `'a b b c'` — first occurrence
|
|
234
|
+
wins, so the order above survives. The attribute is omitted rather than rendered empty; `joinIds`
|
|
235
|
+
(exported from the root) is the helper the components use, for a consumer composing a control of
|
|
236
|
+
their own.
|
|
237
|
+
|
|
238
|
+
The three group controls take no `describedBy` prop of their own — they are `<fieldset>`s named by
|
|
239
|
+
a `<legend>`, and their `error` prop is what they describe themselves with.
|
|
240
|
+
|
|
241
|
+
## Messages
|
|
242
|
+
|
|
243
|
+
Text a component renders itself — "Close", "Clear", "No matches for…", pagination labels — comes
|
|
244
|
+
from a `messages` prop merged over English defaults, never from an i18n library:
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
import { provideEldraUiMessages } from '@eldrajs/ui';
|
|
248
|
+
|
|
249
|
+
provideEldraUiMessages({ close: 'Loka' }); // during setup(); sets it for everything below
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`app.provide(MESSAGES_KEY, messages)` does the same app-wide, from outside a `setup()` scope.
|
|
253
|
+
Precedence, low to high: the English defaults (`enUS` / `defaultMessages`), whatever an ancestor
|
|
254
|
+
provided through `provideEldraUiMessages`/`MESSAGES_KEY`, then a component's own `messages` prop.
|
|
255
|
+
|
|
256
|
+
`@eldrajs/ui/messages/is-IS` ships the complete Icelandic set as its own entry point, so an
|
|
257
|
+
English-only store never bundles it:
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
import { MESSAGES_KEY } from '@eldrajs/ui';
|
|
261
|
+
import { isIS } from '@eldrajs/ui/messages/is-IS';
|
|
262
|
+
|
|
263
|
+
app.provide(MESSAGES_KEY, isIS);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Composables
|
|
267
|
+
|
|
268
|
+
Exported from the package root — the same building blocks `Select`, `MultiSelect`, `SearchBar` and
|
|
269
|
+
every other stateful component here are built on, not a separate public API layered over private
|
|
270
|
+
internals, so a consumer building a control this package does not ship yet (a menu, a combobox with
|
|
271
|
+
its own shape) reuses exactly what those components use. `useControllableModel` is the model every
|
|
272
|
+
stateful component here uses; `useFloating`, `useOverlay` and `usePopover` are the parts of a
|
|
273
|
+
**non-modal popup** — a select panel, a search results panel, a menu — that are easy to get wrong.
|
|
274
|
+
Neither `useOverlay` nor `usePopover` traps focus: the design spec's non-negotiables reserve
|
|
275
|
+
`<dialog>` and focus traps for modal surfaces, and say these popups are not dialogs.
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
import { useFloating, useOverlay } from '@eldrajs/ui';
|
|
279
|
+
|
|
280
|
+
const open = ref(false);
|
|
281
|
+
const trigger = ref<HTMLElement | null>(null);
|
|
282
|
+
const panel = ref<HTMLElement | null>(null);
|
|
283
|
+
|
|
284
|
+
// Closing and focus. Listens on `document` only while `open` is true.
|
|
285
|
+
const { close, focusFirst, focusables } = useOverlay({
|
|
286
|
+
open,
|
|
287
|
+
trigger,
|
|
288
|
+
content: panel,
|
|
289
|
+
setOpen: (next) => (open.value = next),
|
|
290
|
+
// closeOnOutsideClick: true, // an outside `pointerdown`, or focus landing outside
|
|
291
|
+
// closeOnEscape: true, // `Escape`, consumed so an enclosing <dialog> does not also close
|
|
292
|
+
// returnFocus: true, // back to the trigger, but never off what the user just clicked
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Position. `@floating-ui/vue` with `autoUpdate`, kept current while both elements are mounted.
|
|
296
|
+
const { styles, placement, update } = useFloating(trigger, panel, {
|
|
297
|
+
placement: 'auto', // 'auto' = below, flipping above when it does not fit; 'above' never flips
|
|
298
|
+
offset: 4, // the gap in pixels
|
|
299
|
+
matchWidth: true, // adds `minWidth` equal to the trigger's
|
|
300
|
+
});
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
`useListbox` is another: the keyboard and the active row of a listbox popup, which `Select` and
|
|
304
|
+
`MultiSelect` share. It owns no DOM — `activeId` is what you bind to `aria-activedescendant` on
|
|
305
|
+
whichever element holds focus (the trigger, or the search field when there is one) — and everything
|
|
306
|
+
that differs between a single and a multiple select is a callback.
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
import { useListbox } from '@eldrajs/ui';
|
|
310
|
+
|
|
311
|
+
const listbox = useListbox({
|
|
312
|
+
options: () => visibleOptions.value, // already filtered, in DOM order
|
|
313
|
+
isOpen: () => open.value,
|
|
314
|
+
searchable: () => searchable.value, // a search field owns Home/End, Space and printable keys
|
|
315
|
+
canOpen: () => !disabled && !readonly, // a control that cannot open must not swallow the keys
|
|
316
|
+
optionId: (value) => `${id.value}-o${indexOf(value)}`,
|
|
317
|
+
open: (edge) => openPanel(edge), // 'end' is ArrowUp on a closed, non-searchable trigger
|
|
318
|
+
close: () => closePanel(),
|
|
319
|
+
select: (option) => choose(option), // closing afterwards is yours to decide
|
|
320
|
+
clear: () => clearValue(), // Backspace/Delete; return true if something was cleared
|
|
321
|
+
startQuery: (character) => setQuery(character),
|
|
322
|
+
escape: () => clearQuery(), // return true to consume Escape instead of closing
|
|
323
|
+
});
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
`onKeydown` is the whole of the design spec's two Select keyboard tables: arrow movement that skips
|
|
327
|
+
disabled and filtered-out rows and stops at the ends, `PageUp`/`PageDown` by ten, `Home`/`End`,
|
|
328
|
+
`Alt+ArrowUp`, `Escape` clearing a query before it closes, `Tab` closing without preventing focus
|
|
329
|
+
from moving on, and type-ahead with a 0.6s buffer that ignores case and diacritics (`normalizeText`
|
|
330
|
+
is exported for the same folding in a search filter).
|
|
331
|
+
|
|
332
|
+
`styles` is a plain object for `:style` — `position`, `top`, `left`, and `minWidth` under
|
|
333
|
+
`matchWidth` — not a transform, so the panel keeps `transform` for its own open animation.
|
|
334
|
+
`matchWidth` is a _floor_, never a fixed width: the spec's popover "min width = trigger, grows to
|
|
335
|
+
fit its content up to min(22rem, 90vw)", and that upper clamp is the panel's own `max-width`
|
|
336
|
+
(`eldra-select-panel-width`, over `--eldra-select-panel-max-width`), not this composable's.
|
|
337
|
+
`placement` is the placement actually used, after flipping.
|
|
338
|
+
|
|
339
|
+
`focusables()` is the tab sequence inside the content, so an element the platform keeps out of it —
|
|
340
|
+
`tabindex="-1"`, `disabled`, `aria-hidden="true"`, anything under `[hidden]` — is not in the list
|
|
341
|
+
even when it is programmatically focusable.
|
|
342
|
+
|
|
343
|
+
Two things `useOverlay` deliberately does not do:
|
|
344
|
+
|
|
345
|
+
- **A panel rendered through a `<Teleport>` is only recognised if it says so.** Give it
|
|
346
|
+
`data-eldra-overlay-owner="<the content element's id>"`; without that, a press inside it reads as
|
|
347
|
+
a press outside and closes the popup.
|
|
348
|
+
- **"Only one open at a time" is the consumer's.** `Escape` is consumed with `preventDefault()` and
|
|
349
|
+
`stopPropagation()`, which is enough to keep an enclosing native `<dialog>` from closing behind
|
|
350
|
+
the popup — but `stopPropagation()` at `document` does not stop other listeners already on
|
|
351
|
+
`document`, and nothing here knows about other overlays. Opening one select closing any other is
|
|
352
|
+
a registry the consumer keeps (`src/components/select/openRegistry.ts` is this package's).
|
|
353
|
+
|
|
354
|
+
`usePopover` is that registry, wired up: the one composable this package's own non-modal popups
|
|
355
|
+
(`Select`, `MultiSelect`, `SearchBar`'s results panel) actually build on, exported from the root for
|
|
356
|
+
a consumer whose control needs the same six things rather than reassembling them from
|
|
357
|
+
`useFloating`/`useOverlay` by hand:
|
|
358
|
+
|
|
359
|
+
- **the registry** — opening claims a module-level "only one open at a time" slot (via a stable
|
|
360
|
+
per-instance handle) and closes whatever held it;
|
|
361
|
+
- **the teleport** — `teleport` (default `true`) returns `teleportTo` and `teleportDisabled` to
|
|
362
|
+
put on a `<Teleport>` around the panel, and switches `useFloating` to the `fixed` strategy to
|
|
363
|
+
match; `tabRedirect` keeps a panel that has tab stops inside the `Tab` walk it left with its
|
|
364
|
+
place in the DOM. See [Layering](#layering) below for both, and for how to turn the teleport off;
|
|
365
|
+
- **`useOverlay`** — the outside-press/focus-leaves/`Escape` closing rules, non-modal, so nothing
|
|
366
|
+
traps focus and `Tab` always moves on;
|
|
367
|
+
- **`useFloating`** — positioning, plus the `--eldra-popover-origin` the entrance keyframes read
|
|
368
|
+
(`top left` below the control, `bottom left` above it), so a panel that flips after floating-ui
|
|
369
|
+
measures changes a custom property rather than its `animation-name` (which would replay the
|
|
370
|
+
entrance);
|
|
371
|
+
- **the open sequence** — `open(activate?)` opens, runs `activate` (make a row active), then —
|
|
372
|
+
only when the call actually changed the state — runs `afterOpen` a tick later, which is where
|
|
373
|
+
focus moves into the panel; `close(returnFocus?)` closes and returns focus to the trigger unless
|
|
374
|
+
told not to;
|
|
375
|
+
- **the label-forwarded-click latch** — a `<label for>` naming the trigger forwards its click to
|
|
376
|
+
it, and the spec is explicit that clicking a field's label focuses the control **without**
|
|
377
|
+
opening it. A forwarded click is indistinguishable from a real one except that no pointer was
|
|
378
|
+
pressed and its `detail` is 0 (the same shape as a programmatic `element.click()`), so
|
|
379
|
+
`onTriggerPointerDown`/`onTriggerClick` (bound to the trigger) arm a latch on `pointerdown` and
|
|
380
|
+
release it on whichever `pointerup`/`pointercancel` follows, wherever it lands.
|
|
381
|
+
|
|
382
|
+
What stays with each control is what actually differs: which rows there are, what choosing one
|
|
383
|
+
does, and which element the popup is anchored to. See `src/components/select/usePopover.ts` for
|
|
384
|
+
the full option/return shape (`UsePopoverOptions`, `UsePopoverReturn`, also exported).
|
|
385
|
+
|
|
386
|
+
`useDialog` is the **modal** counterpart: the shared "Modal dialogs" rules applied to a native
|
|
387
|
+
`<dialog>`, built for `Dialog` and reused by every modal surface after it (`Drawer`, `Lightbox` and
|
|
388
|
+
`SearchModal`) instead of each reimplementing them. `Drawer` is `Dialog`'s side-sheet
|
|
389
|
+
sibling: it adds only what a side sheet needs beyond the shared contract — a per-side slide, a
|
|
390
|
+
full-screen mobile variant, and a right-side default of focusing the close button first (see the
|
|
391
|
+
README's Deviations for why that is the opposite of `Dialog`'s own initial-focus rule) — passing
|
|
392
|
+
its own `initialFocus` computed ref into the same `useDialog` call shown below.
|
|
393
|
+
|
|
394
|
+
```ts
|
|
395
|
+
import { useDialog } from '@eldrajs/ui';
|
|
396
|
+
|
|
397
|
+
const open = ref(false);
|
|
398
|
+
const dialog = ref<HTMLDialogElement | null>(null);
|
|
399
|
+
|
|
400
|
+
const { close, isTop } = useDialog({
|
|
401
|
+
open,
|
|
402
|
+
setOpen: (next) => (open.value = next),
|
|
403
|
+
dialog,
|
|
404
|
+
dismissable: () => !formIsDirty.value, // default true; read on every backdrop click
|
|
405
|
+
initialFocus: someRef, // else the first control that is not `[data-part="close"]`
|
|
406
|
+
onCancel: () => emit('cancel'), // Esc always closes — this is a notification, not a guard
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
It owns, through the native element alone — **no custom focus trap, no `role="dialog"`** (the
|
|
411
|
+
spec's own non-negotiable 2):
|
|
412
|
+
|
|
413
|
+
- **open/close**, synced to `open` via `showModal()`/`.close()`. A modal `<dialog>` already makes
|
|
414
|
+
the rest of the page inert and already contains `Tab`/`Shift+Tab` to its own controls, so nothing
|
|
415
|
+
here re-implements either;
|
|
416
|
+
- **nested modals** (operator override, 2026-09-26 — see [Deviations](#deviations)), **the scroll
|
|
417
|
+
lock**, and **the toast hand-off** — all in `src/composables/dialogStack.ts`, the module-level
|
|
418
|
+
stack every consumer of `useDialog` shares (the same shape as `usePopover`'s own
|
|
419
|
+
`openRegistry.ts`, but pushing on top rather than closing or refusing anything — a modal opening
|
|
420
|
+
while another is already open is simply left open, underneath). `Esc` and a backdrop click,
|
|
421
|
+
though, only ever act on the **topmost** entry (`isTop` below); a lower dialog ignores both, even
|
|
422
|
+
one dispatched at it directly. The scroll lock is held while the stack is non-empty, released only
|
|
423
|
+
once every open modal has closed. `TOAST_HOST_KEY` (exported) is a plain
|
|
424
|
+
`Ref<HTMLDialogElement | null>` tracking the **topmost** dialog, **not a Vue injection key**
|
|
425
|
+
despite the name matching this package's `*_KEY` convention — see its own doc comment for why: a
|
|
426
|
+
`Toaster` mounted near an app's root is a sibling of whatever opens a `Dialog` elsewhere in the
|
|
427
|
+
tree, and `provide`/`inject` cannot connect two siblings, so the hand-off is a plain shared
|
|
428
|
+
reference both sides read and write, exactly the same reasoning `usePopover`'s `topLayerDialog()`
|
|
429
|
+
already uses to teleport a panel into a dialog it did not render;
|
|
430
|
+
- **initial focus** — `initialFocus`, else the first focusable that is not `[data-part="close"]`
|
|
431
|
+
(this package's own "every part carries `data-part`" convention doubling as the composable's
|
|
432
|
+
exclusion rule, so any modal built on this contract needs no second constant to stay in sync),
|
|
433
|
+
else the close button itself, applied a tick after `showModal()` so slot content mounted alongside
|
|
434
|
+
the dialog (a form's first field) already exists to focus;
|
|
435
|
+
- **focus return** — whatever had focus immediately before `showModal()`, refocused the moment the
|
|
436
|
+
dialog actually closes, by any route — the page's own opener at the bottom of the stack, or,
|
|
437
|
+
for a modal opened from inside another one, whichever control still had focus in the modal
|
|
438
|
+
underneath, so closing the top one lands focus back there instead of on the page;
|
|
439
|
+
- **`Esc`** (the native `cancel` event) — closes the dialog, never gated by `dismissable`, but only
|
|
440
|
+
while it is the top of the stack; `onCancel` is a plain callback with nothing to call
|
|
441
|
+
`preventDefault()` on, so it cannot keep the dialog open;
|
|
442
|
+
- **backdrop click** — a `click` whose `target` is the `<dialog>` element itself (not a descendant),
|
|
443
|
+
closing it when `dismissable` reads `true` **and** it is the top of the stack.
|
|
444
|
+
|
|
445
|
+
`close(returnValue?)` is exposed so a consumer can close with an action value of their own — a
|
|
446
|
+
`Dialog`'s exposed `close` (`<Dialog ref="dialogRef">` then `dialogRef.value.close('remove')`) is
|
|
447
|
+
this, unchanged. `isTop` is `true` while this dialog is the **topmost** entry `dialogStack` holds —
|
|
448
|
+
`false` for one still open but covered by a modal opened on top of it.
|
|
449
|
+
`Tooltip` is built on `useFloating` and `useOverlay` directly rather than on `usePopover`, because
|
|
450
|
+
it must never join the "only one open at a time" registry — showing a tooltip must never close
|
|
451
|
+
somebody else's open `Select`. It still shares the _teleport target_ logic (an internal
|
|
452
|
+
`useTeleportTarget`, not exported: body, or the open modal `<dialog>` the trigger sits in) with
|
|
453
|
+
`usePopover`, so both answer "where does this popup escape to" the same way. See
|
|
454
|
+
[Layering](#layering) below.
|
|
455
|
+
|
|
456
|
+
`useToast` is the toast queue behind `Toast`/`Toaster` (design spec "Toast") — a **module-level**
|
|
457
|
+
store, not a `provide`d instance: call it from anywhere, not only from inside a `Toaster`'s own
|
|
458
|
+
subtree (a fetch error handler, a Pinia/Vuex store, a route guard).
|
|
459
|
+
|
|
460
|
+
```ts
|
|
461
|
+
import { useToast } from '@eldrajs/ui';
|
|
462
|
+
|
|
463
|
+
const toast = useToast();
|
|
464
|
+
toast.show({
|
|
465
|
+
title: 'Added to cart',
|
|
466
|
+
text: 'Merino crew sweater · Oatmeal · M',
|
|
467
|
+
action: { label: 'View cart (3)', href: '/cart' }, // or { label, onActivate: () => {...} }
|
|
468
|
+
});
|
|
469
|
+
const dangerId = toast.show({ variant: 'danger', title: "Couldn't update your cart" });
|
|
470
|
+
toast.dismiss(dangerId); // closes it early, e.g. once a retry succeeds
|
|
471
|
+
toast.clear(); // empties the queue
|
|
472
|
+
toast.toasts; // Readonly<Ref<ToastItem[]>> — what a mounted `Toaster` renders
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
`show` resolves `variant` (default `"success"`) and `duration` together: `success` defaults to
|
|
476
|
+
6000ms, `warning` to 10000ms, both overridable per call, and `danger` is always `0` (never
|
|
477
|
+
auto-dismissed) regardless of what is passed. An `id` is a dedupe key — a second `show()` with the
|
|
478
|
+
same `id` replaces that toast in place (same position, a fresh timer) instead of adding a second
|
|
479
|
+
one; omitted, one is generated. At most three toasts are queued at once; a fourth evicts the
|
|
480
|
+
oldest.
|
|
481
|
+
|
|
482
|
+
**SSR-safe**: nothing in `useToast` touches `window`/`document`, and it starts no timer — a single
|
|
483
|
+
`<Toaster />`, mounted once near an app's root, owns every timer (paused while the pointer is over
|
|
484
|
+
the stack or focus is inside it, resumed for whatever time was left) and where the region actually
|
|
485
|
+
renders: `TOAST_HOST_KEY` (see `useDialog` above) if a modal `Dialog` is open, `<body>` otherwise —
|
|
486
|
+
the same hand-off `Dialog`, `Drawer`, `Lightbox` and `SearchModal` already share, so a toast raised
|
|
487
|
+
during a modal flow is never inert behind it.
|
|
488
|
+
|
|
489
|
+
`useCarousel` is the scroll-snap carousel's whole behaviour with no rendering of its own — index
|
|
490
|
+
tracking, previous/next/`goTo`, edge detection for the arrows, and autoplay with the spec's pause
|
|
491
|
+
rules — so `Carousel` renders the markup around it and `Lightbox` (its own track reuses this file
|
|
492
|
+
unchanged) needs nothing else.
|
|
493
|
+
|
|
494
|
+
```ts
|
|
495
|
+
import { ref } from 'vue';
|
|
496
|
+
import { useCarousel } from '@eldrajs/ui';
|
|
497
|
+
|
|
498
|
+
// Declared locally and passed in, the same shape `useDialog`'s own `dialog` option takes — a
|
|
499
|
+
// plain top-level `const x = ref(...)` is what <script setup>'s template-ref wiring
|
|
500
|
+
// (`ref="rootRef"`/`ref="trackRef"` in the template) recognises.
|
|
501
|
+
const rootRef = ref<HTMLElement | null>(null); // hover/focus-within/tab-hidden pause autoplay
|
|
502
|
+
const trackRef = ref<HTMLElement | null>(null); // its real DOM children are what this composable reads
|
|
503
|
+
|
|
504
|
+
const {
|
|
505
|
+
index, // 0-based, the slide whose start is closest to the track's scroll position
|
|
506
|
+
count, // the track's current child count, read from the live DOM
|
|
507
|
+
canPrev,
|
|
508
|
+
canNext, // false at an end — including when nothing overflows, so both arrows disable together
|
|
509
|
+
goTo,
|
|
510
|
+
next,
|
|
511
|
+
prev, // never loop — arrows/dots disable at the ends instead
|
|
512
|
+
trackFocusable, // true only while no slide holds anything focusable — bind the track's tabindex
|
|
513
|
+
onTrackKeydown, // the whole keyboard, both models — bind to the track's `keydown`
|
|
514
|
+
focusItem, // move the entry point (and focus) onto a slide; the arrow keys' own path
|
|
515
|
+
playing,
|
|
516
|
+
pause,
|
|
517
|
+
resume,
|
|
518
|
+
toggle, // autoplay's own toggle state, independent of the momentary hover/focus pause
|
|
519
|
+
} = useCarousel({
|
|
520
|
+
rootRef,
|
|
521
|
+
trackRef,
|
|
522
|
+
autoplay: () => props.autoplay, // ms; 0/undefined means off, and it never starts under reduced motion
|
|
523
|
+
slideLabel: () => messages.value.slideOf, // (position, total) => string, 1-based
|
|
524
|
+
draggable: () => props.draggable, // mouse/pen drag on the track; default true if omitted
|
|
525
|
+
onChange: (i) => emit('change', i),
|
|
526
|
+
});
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
It reads `trackRef.value.children` directly rather than Vue's slot vnodes: a carousel's whole job
|
|
530
|
+
is scroll geometry (`scrollLeft`, `offsetLeft`, `scrollWidth`), which only exists once the browser
|
|
531
|
+
has laid the slides out, so `count`, the index-from-scroll math and the per-slide `aria-label`s all
|
|
532
|
+
agree with what is really on screen however the slide markup got there. Every slide is annotated in
|
|
533
|
+
place — `data-part="slide"`, `role="group"`, `aria-roledescription="slide"`, the `slideLabel`
|
|
534
|
+
result as `aria-label`, and the `eldra-carousel-slide` sizing class — through a `MutationObserver`
|
|
535
|
+
on the track, so a consumer's own `<li>`/`<figure>`/component root becomes the slide with no
|
|
536
|
+
wrapper element added around it. `resolveCarouselPerView` and `carouselPerViewStyle` turn
|
|
537
|
+
`CarouselProps['perView']` into the three inline custom properties (`--eldra-carousel-per-view-base`
|
|
538
|
+
/`-md`/`-lg`) the `eldra-carousel-track` utility resolves into `--eldra-carousel-per-view` per
|
|
539
|
+
container-query breakpoint, so `Carousel` and `Lightbox` share one reading of the prop. An inline
|
|
540
|
+
style rather than classes, deliberately — see the Deviations entry. `prefersReducedMotion` is the one
|
|
541
|
+
JavaScript check CSS's own `motion-reduce:` cannot make on its own — whether autoplay may start at
|
|
542
|
+
all.
|
|
543
|
+
|
|
544
|
+
**Keyboard: one tab stop, wherever the cards are.** Spec "Keyboard": "Composite widgets (tabs,
|
|
545
|
+
listboxes, menus, carousels, radio groups) take one tab stop and use arrow keys inside, following
|
|
546
|
+
the WAI-ARIA Authoring Practices." Which shape that takes is decided by the slides' own content,
|
|
547
|
+
with no prop to choose it — `trackFocusable` is the answer and the track's `tabindex` is bound to
|
|
548
|
+
it:
|
|
549
|
+
|
|
550
|
+
- **No slide holds anything focusable** (a single-slide image gallery, a `Lightbox` stage): the
|
|
551
|
+
track itself is the one stop (`tabindex="0"`) and `←`/`→` step it. The spec's own "Track:
|
|
552
|
+
`tabindex="0"`" case, unchanged.
|
|
553
|
+
- **Any slide holds a link or a button** (a product row, a gallery of "view larger" tiles, a linked
|
|
554
|
+
hero figure): the **active slide** owns the one entry point and the track is not a stop at all.
|
|
555
|
+
Its own controls keep their natural `tabindex`, so `Tab`/`Shift+Tab` move through _that card's_
|
|
556
|
+
link, wishlist and quick-add in DOM order and then leave the carousel entirely — every other
|
|
557
|
+
slide's controls are parked at `tabindex="-1"`, which is what stops `Tab` from walking into the
|
|
558
|
+
next card. `←`/`→` move between slides from anywhere inside one, `Home`/`End` jump to the
|
|
559
|
+
first/last, focus follows onto the new slide's entry point and the track scrolls to it (clamped,
|
|
560
|
+
never wrapping, instant under reduced motion). `Enter`/`Space` are left to the focused control, so
|
|
561
|
+
a card's own link navigates the way the browser means it to.
|
|
562
|
+
|
|
563
|
+
**What the arrows are never taken from**, exactly: every `<input>` except
|
|
564
|
+
`checkbox`/`button`/`submit`/`reset`/`image`/`file`/`color` — so the text-like types, and also
|
|
565
|
+
`radio`, `range` and `number` and the date/time family, each of which really does read `←`/`→`
|
|
566
|
+
itself (a native radio group moves its selection with them, so moving the row as well would fire
|
|
567
|
+
two things on one key) — plus `textarea`, `select`, `[contenteditable]`, the
|
|
568
|
+
`combobox`/`listbox`/`radiogroup`/`slider`/`spinbutton`/`tablist`/`tree`/`treegrid`/`grid`/`menu`/
|
|
569
|
+
`menubar`/`textbox` roles, `audio`/`video` with controls, and anything an author opts out with
|
|
570
|
+
`data-no-arrow-keys`. A checkbox, a submit button and a file picker own no horizontal arrows, so
|
|
571
|
+
the row still moves from one.
|
|
572
|
+
|
|
573
|
+
**Where focus lands, and when the slide element itself is the stop.** The entry point is the
|
|
574
|
+
slide's first _tab stop candidate_: rendered, outside `aria-hidden="true"`, not `disabled`, and
|
|
575
|
+
not at the author's own `tabindex="-1"`. A card's decorative image link marked
|
|
576
|
+
`aria-hidden="true" tabindex="-1"` ahead of the real title link is therefore stepped past rather
|
|
577
|
+
than focused — focus inside `aria-hidden` announces nothing. A slide with no candidate at all (an
|
|
578
|
+
unlinked figure, or one whose only focusable content is an author's `-1` focus target) becomes
|
|
579
|
+
the stop itself: `tabindex="0"` while active, `-1` otherwise, plus the package's `eldra-focus`
|
|
580
|
+
ring, so a carousel is never left with zero tab stops. A slide that _does_ hold a control gets no
|
|
581
|
+
`tabindex` written on it at all.
|
|
582
|
+
|
|
583
|
+
What this costs, deliberately: a card's secondary control is reachable only once that card is the
|
|
584
|
+
active one, i.e. after the arrow keys (or the arrows, the dots or a scroll) have moved to it. That
|
|
585
|
+
is the WAI-ARIA Authoring Practices trade every composite widget makes, and it is what the
|
|
586
|
+
alternative — one tab stop per card, thirteen presses to get past a twelve-card row — costs
|
|
587
|
+
instead. `Carousel` renders the hint for it once per carousel: a visually hidden
|
|
588
|
+
`slideInstructions` paragraph (`data-part="instructions"`), referenced by the **root's** own
|
|
589
|
+
`aria-describedby` so it is announced on entering the carousel rather than again on every slide the
|
|
590
|
+
arrow keys walk through, alongside `aria-roledescription="carousel"` on the root and
|
|
591
|
+
`role="group"`/`aria-roledescription="slide"`/`aria-label="2 of 4"` on each slide.
|
|
592
|
+
|
|
593
|
+
The whole pass re-runs on mount, whenever the slides change, whenever anything _inside_ a slide
|
|
594
|
+
changes (a second `MutationObserver` over the track's subtree — a product row's cards replace four
|
|
595
|
+
skeletons without the slide elements themselves changing at all; it watches children plus
|
|
596
|
+
`tabindex`/`aria-hidden`/`disabled`, so a quick-add going `disabled` moves the entry point, and
|
|
597
|
+
coalesces a burst into one pass) and whenever the active slide changes, including from an arrow
|
|
598
|
+
button, a dot, autoplay, a drag or a plain two-finger scroll — so `Tab` always lands on the card
|
|
599
|
+
the shopper is looking at. A parked control gets back the exact `tabindex` it had (usually none at
|
|
600
|
+
all, so the attribute is removed rather than set to `"0"`), and this composable owns `tabindex` on
|
|
601
|
+
the slides and their controls outright: pass none of your own.
|
|
602
|
+
|
|
603
|
+
**Before the first client render there is no roving model.** The pass runs in `onMounted`, so a
|
|
604
|
+
server-rendered page — and a page whose JavaScript never arrives — carries the pre-enhancement
|
|
605
|
+
shape: the track focusable, every card's link in the tab sequence. That is deliberate, it is the
|
|
606
|
+
same progressive enhancement the per-slide labelling already relies on, and the first client render
|
|
607
|
+
matches the server's exactly (nothing to mismatch); the model only moves afterwards. One more
|
|
608
|
+
consequence worth stating: with `controls: "below"` or `dots`, `Tab` from the active card's last
|
|
609
|
+
control reaches the carousel's own below-row controls before it reaches the page — they are stops
|
|
610
|
+
in their own right, as they always were — and `Shift+Tab` from the first reaches the header arrows
|
|
611
|
+
the same way. "Leaves the carousel" means it never walks into another card, not that the carousel's
|
|
612
|
+
own controls are skipped.
|
|
613
|
+
|
|
614
|
+
**Pointer drag** (operator decision): touch already swipes the track for free through native
|
|
615
|
+
scroll-snap; `draggable` (default `true`) adds the mouse/pen equivalent. `pointerdown` on the
|
|
616
|
+
track — the primary button, anywhere except an editable/range control (`input`, `textarea`,
|
|
617
|
+
`select`, `[contenteditable]`, `input[type="range"]`) or an element opted out with `data-no-drag` —
|
|
618
|
+
starts tracking the pointer, buttons and links included (fix, 2026-09-26: a `ProductCard`'s
|
|
619
|
+
stretched title link covers the whole card, so a blanket "no interactive descendant" rule left no
|
|
620
|
+
way to drag from a card at all — the operator's own words: "we are not able to drag on a card, we
|
|
621
|
+
have to place the cursor between cards"). The `pointerdown` itself is never `preventDefault()`ed, so
|
|
622
|
+
native focus/click behaviour is untouched below the threshold. Once the pointer has moved 6px, the
|
|
623
|
+
gesture becomes a drag: `data-dragging="true"` goes on the track (the CSS `Carousel`/`Lightbox` read
|
|
624
|
+
it with — `data-[dragging=true]:snap-none` suspends scroll snapping, `data-[dragging=true]:cursor-grabbing`
|
|
625
|
+
swaps the cursor from `cursor-grab`), any text selection the native `mousedown` already started is
|
|
626
|
+
cleared (`window.getSelection()?.removeAllRanges()`), and `scrollLeft` follows the pointer 1:1. On
|
|
627
|
+
release, the track snaps to the nearest slide by position, nudged one slide further in the flick's
|
|
628
|
+
direction if the final movement was faster than 0.5px/ms — `goTo`, so it clamps and emits the same
|
|
629
|
+
as any other navigation — and, only because a real drag happened, the click that a mouse drag always
|
|
630
|
+
fires on release is cancelled so it never reaches whatever was under the pointer (a card's own link,
|
|
631
|
+
a quick-add button); a press that never crossed the threshold arms nothing, so its plain click or
|
|
632
|
+
link navigation lands exactly as if this composable did not exist. Autoplay pauses for the span of
|
|
633
|
+
the drag (folded into the same suspend `hovered`/`focusedWithin` already use, so the Pause/Play
|
|
634
|
+
button's label never flips) and resumes after. Reduced motion is respected the same way every other
|
|
635
|
+
`goTo` call already is — instant, not smooth. The drag also ends on `lostpointercapture`, not only
|
|
636
|
+
`pointerup`/`pointercancel` (fix, 2026-09-26): capture can be revoked with no preceding pointer event
|
|
637
|
+
at all — another element calling `setPointerCapture` for the same pointer, an OS/browser gesture (an
|
|
638
|
+
edge-swipe), the captured element becoming disabled — and without this the drag state (and
|
|
639
|
+
autoplay's suspension) would stay stuck forever with no further user action guaranteed to clear it.
|
|
640
|
+
It is handled identically to `pointercancel`, since there is nothing left to release by the time it
|
|
641
|
+
fires.
|
|
642
|
+
|
|
643
|
+
`RangeSlider`'s arithmetic is exported the same way, as pure functions rather than a composable:
|
|
644
|
+
the control's state is two numbers the component already holds through `useControllableModel`, so
|
|
645
|
+
there is nothing for a `use*` wrapper to own. What is worth sharing is the awkward half — the step
|
|
646
|
+
grid, and the rules that keep two thumbs from crossing.
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
import {
|
|
650
|
+
clampRangeThumb,
|
|
651
|
+
nearestRangeThumb,
|
|
652
|
+
normalizeRangeValue,
|
|
653
|
+
rangeKeyTransition,
|
|
654
|
+
rangePositionToValue,
|
|
655
|
+
rangeThumbLimits,
|
|
656
|
+
rangeValueToPercent,
|
|
657
|
+
snapToRangeStep,
|
|
658
|
+
} from '@eldrajs/ui';
|
|
659
|
+
|
|
660
|
+
const math = { min: 1200, max: 48_000, step: 100, largeStep: 1000 };
|
|
661
|
+
|
|
662
|
+
normalizeRangeValue([4800, 1200], math); // [1200, 4800] — ordered, snapped, inside the bounds
|
|
663
|
+
rangeValueToPercent(4800, math); // where that end sits along the track, 0-100
|
|
664
|
+
rangePositionToValue(clientX, track.getBoundingClientRect(), math); // a press, snapped to the grid
|
|
665
|
+
nearestRangeThumb(3000, [1200, 4800]); // 'min' — which thumb a press at that value should move
|
|
666
|
+
rangeThumbLimits('min', [1200, 4800], math); // { lo: 1200, hi: 4800 } — also the thumb's aria-value*
|
|
667
|
+
clampRangeThumb(9000, 'min', [1200, 4800], math); // 4800 — it stops where the other thumb is
|
|
668
|
+
rangeKeyTransition('PageUp', false, 'min', [1200, 4800], math); // the next value, or null for a key
|
|
669
|
+
// ...this control does not own (`Tab` above all)
|
|
670
|
+
snapToRangeStep(4830, math); // 4800 — or either bound, each of which is a stop of its own
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**The typed row is replaceable, and the value is not.** `RangeSlider`'s built-in min / "to" / max
|
|
674
|
+
fields are generic number fields, and money is not a generic number — a price filter wants the
|
|
675
|
+
store's own currency field. So `inputs` keeps deciding whether the row exists and the `inputs` slot
|
|
676
|
+
decides what is in it, while every write still goes through the control:
|
|
677
|
+
|
|
678
|
+
```vue
|
|
679
|
+
<RangeSlider v-model="range" label="Price" :min="span.min" :max="span.max" :step="step" inputs>
|
|
680
|
+
<template #inputs="{ labels, step, disabled, commit }">
|
|
681
|
+
<CurrencyInput
|
|
682
|
+
v-model="typedMin"
|
|
683
|
+
:currency="currency"
|
|
684
|
+
:max-fraction="0"
|
|
685
|
+
:step="step"
|
|
686
|
+
:disabled="disabled"
|
|
687
|
+
:aria-label="labels.min"
|
|
688
|
+
@blur="typedMin = commit(0, typedMin)"
|
|
689
|
+
@keydown.enter.prevent="typedMin = commit(0, typedMin)"
|
|
690
|
+
/>
|
|
691
|
+
<span aria-hidden="true">{{ labels.separator }}</span>
|
|
692
|
+
<!-- …the same for the maximum, through `commit(1, …)` -->
|
|
693
|
+
</template>
|
|
694
|
+
</RangeSlider>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
`commit(end, next)` applies that end exactly as a built-in field's blur does — snapped to the step
|
|
698
|
+
grid, clamped to the bounds, clamped against the other thumb, `change` emitted once — and returns
|
|
699
|
+
the number it actually applied, which is what a controlled field should show. **Assign that return
|
|
700
|
+
back to the field's own model** (`typedMin = commit(0, typedMin)`), not just call `commit` for its
|
|
701
|
+
side effect: the parent has not written the new value back when `commit` returns, and an `Enter`
|
|
702
|
+
commit leaves the field focused, so a field left showing its own stale `typedMin` can keep a figure
|
|
703
|
+
the control never actually applied — most visibly when a typed value snaps onto the thumb's
|
|
704
|
+
_current_ value, which writes nothing and fires no `change` at all. `null` is an emptied field and
|
|
705
|
+
falls back to that end of the range.
|
|
706
|
+
|
|
707
|
+
Three more rules about the replacement field itself. Bind it to a **local** number and call
|
|
708
|
+
`commit` on **blur or `Enter` only**, never per keystroke, or a half-typed figure is snapped and
|
|
709
|
+
clamped under the customer's caret. Pass it **no `min`/`max` of its own**: `commit` already clamps
|
|
710
|
+
to the bounds on commit, and a field that refuses the keystroke instead stops a customer typing
|
|
711
|
+
"1250" at the "1", then disagrees with a thumb a drag can park anywhere. And name it with
|
|
712
|
+
`aria-label="labels.min"`/`labels.max` rather than a visible `label` — those are the strings its
|
|
713
|
+
thumb already uses, and the row already shows the figure beside the separator, so a second visible
|
|
714
|
+
label would double it up; a screen reader must still hear the one name the thumb has, or it hears
|
|
715
|
+
two different names for one end of the range.
|
|
716
|
+
|
|
717
|
+
Two rules in there are not obvious and are the reason these are worth importing rather than
|
|
718
|
+
rewriting. **Both bounds are stops**, not just the multiples of `step`: a price filter's bounds come
|
|
719
|
+
from the catalogue and owe the step nothing, so with a step of 3 over a 0-10 range the stops are 0,
|
|
720
|
+
3, 6, 9 **and** 10 — snapping to the grid alone leaves the dearest product permanently filtered
|
|
721
|
+
out. And every result is **rounded to the digits the inputs are written with** (`fractionDigits`,
|
|
722
|
+
`rangeStepDigits`), because a `0.1` step added twenty times is `1.9999999999999998` in binary
|
|
723
|
+
floating point, and that number reaches the page, `aria-valuenow` and the field beside it.
|
|
724
|
+
|
|
725
|
+
### Layering
|
|
726
|
+
|
|
727
|
+
A popup panel rendered inside its own control is at the mercy of everything above it on the page.
|
|
728
|
+
An ancestor with `overflow: hidden` — a rounded card, a table cell, a carousel track, a scrolled
|
|
729
|
+
column — clips it at that ancestor's edge; and any element that starts its own **stacking context**
|
|
730
|
+
(a sticky header with a `z-index`, a section with `isolate`, anything with a `transform`, `filter`
|
|
731
|
+
or `opacity` below 1) paints over it whatever the panel's own `z-index` says, because a `z-index`
|
|
732
|
+
only orders siblings within one context.
|
|
733
|
+
|
|
734
|
+
So `Select`, `MultiSelect`, `SearchBar` and `Tooltip` render their panel (or bubble) through a
|
|
735
|
+
`<Teleport>` to
|
|
736
|
+
`document.body`, positioned with floating-ui's **`fixed`** strategy — the viewport being the one
|
|
737
|
+
frame the panel and its control still share once they are in different subtrees. `autoUpdate` keeps
|
|
738
|
+
them together: it watches every scrollable ancestor of the control, so the panel follows a trigger
|
|
739
|
+
that scrolls under it. On `body` the panel is a child of the root stacking context, where
|
|
740
|
+
`z-popover` (`--eldra-z-popover`, default `30`) means what the spec's layer table says it means,
|
|
741
|
+
above `z-sticky` (`20`) and below `z-drawer` (`40`).
|
|
742
|
+
|
|
743
|
+
Four things follow from the move, and each is a real consequence rather than a detail:
|
|
744
|
+
|
|
745
|
+
- **A modal native `<dialog>` is the exception, and is handled.** A dialog opened with
|
|
746
|
+
`showModal()` renders in the browser's _top layer_, above every `z-index` on the page, so a panel
|
|
747
|
+
on `body` would be behind the dialog that opened it and no `z-index` could help. When the control
|
|
748
|
+
sits inside one, the panel is teleported into **that dialog** instead — same escape from clipping
|
|
749
|
+
and stacking, same top layer. The nearest open ancestor `<dialog>` that matches `:modal` wins,
|
|
750
|
+
which is not always the nearest one (a non-modal `<dialog open>` can sit inside a modal one); if
|
|
751
|
+
none claims the top layer — either none is modal, or the engine does not implement `:modal` — the
|
|
752
|
+
nearest open dialog is used, because teleporting into a dialog that did not need it costs far
|
|
753
|
+
less than teleporting out of one that did. **The target is resolved on every open**, not once:
|
|
754
|
+
`closest()` answers about the DOM as it is, so a control that is sometimes inside an open dialog
|
|
755
|
+
and sometimes not gets the right answer each time.
|
|
756
|
+
- **The target itself has to be a clean frame.** A teleport target you name yourself — and the
|
|
757
|
+
enclosing `<dialog>`, when there is one — becomes the panel's containing block if it has a
|
|
758
|
+
`transform`, `filter`, `perspective`, `backdrop-filter`, `contain: paint/layout/strict/content`
|
|
759
|
+
or `will-change` on any of those: `position: fixed` then resolves against **that element**, not
|
|
760
|
+
the viewport, and its `overflow` clips the panel exactly like any other ancestor. This package's
|
|
761
|
+
own `Drawer` is one such element — its slide-in animation is a `transform` on the root
|
|
762
|
+
`<dialog>` itself (see `Drawer.vue`'s own comment on `rootClass`), so teleporting into an open
|
|
763
|
+
`Drawer` needs the same care as any other transformed ancestor. Point `teleport` at something
|
|
764
|
+
plain, or leave it at `body`.
|
|
765
|
+
- **Custom properties are no longer inherited from around the control.** Set `--eldra-*` overrides
|
|
766
|
+
on `:root` (which is what [Customisation](#customisation) asks for anyway), not on a wrapper
|
|
767
|
+
`<div>`. A consumer with their own top-layer elements sets `--eldra-z-popover` there.
|
|
768
|
+
- **The panel is no longer in document order after its control, so the `Tab` walk is restored by
|
|
769
|
+
hand.** Sequential focus order is the browser's and it follows the DOM; left alone, `Tab` from
|
|
770
|
+
the trigger would step past the teleported panel to the next thing on the page and close the
|
|
771
|
+
popup with its own controls never reached — which the spec's Multi-select Keyboard table forbids
|
|
772
|
+
("Tab moves from the search field (or the trigger) to the footer's Clear, then Done, with the
|
|
773
|
+
popover still open"). `usePopover`'s **`tabRedirect`** puts exactly those two boundary steps back:
|
|
774
|
+
`Tab` on the last tab stop the control still holds moves focus to the panel's first focusable,
|
|
775
|
+
and `Shift+Tab` on that first focusable moves it back to that stop. Everything between is the
|
|
776
|
+
browser's own order — including the steps _inside_ the control, which are still DOM siblings: a
|
|
777
|
+
`MultiSelect` showing a clear button walks trigger → clear button on the browser's own order,
|
|
778
|
+
then into the footer's Clear, then Done, exactly as the table says, and back the same way.
|
|
779
|
+
|
|
780
|
+
**This is a redirect, not a trap.** `Tab` on the panel's _last_ focusable is left entirely alone:
|
|
781
|
+
focus leaves for the next thing on the page and `useOverlay` closes the popup behind it. So there
|
|
782
|
+
is an exit forwards (past the last row) and an exit backwards (`Shift+Tab` to the trigger, then
|
|
783
|
+
on), which is what WCAG 2.1.2 asks for — no keyboard user is ever held anywhere, and nothing
|
|
784
|
+
corrects focus after the fact. Controls that already move focus into the panel on open (any
|
|
785
|
+
searchable `Select` or `MultiSelect`) are untouched: their order was already right. Turn it on
|
|
786
|
+
with `tabRedirect` when your own panel holds tab stops; it is inert when the panel is rendered in
|
|
787
|
+
place or has none. What counts as "the control" is `useOverlay`'s own answer — the trigger plus
|
|
788
|
+
anything carrying `data-eldra-overlay-owner="<the panel's id>"` — so a control of your own puts
|
|
789
|
+
its trigger-side buttons in the walk by marking them the way `MultiSelect`'s clear button does.
|
|
790
|
+
|
|
791
|
+
`teleport` is a prop on `Select`, `MultiSelect` and `SearchBar`, and an option on `usePopover`:
|
|
792
|
+
`true` (default), a CSS selector string for a target of your own, or `false` to keep the old
|
|
793
|
+
in-place `absolute` rendering when you know nothing above the control clips or stacks over it.
|
|
794
|
+
`Tooltip` has no `teleport` prop — it always teleports (`fixed` strategy, same target resolution),
|
|
795
|
+
because a tooltip has no in-place `absolute` rendering to fall back to.
|
|
796
|
+
|
|
797
|
+
## Resolver
|
|
798
|
+
|
|
799
|
+
`@eldrajs/ui/resolver` is a plain
|
|
800
|
+
[`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components) resolver:
|
|
801
|
+
|
|
802
|
+
```ts
|
|
803
|
+
// vite.config.ts
|
|
804
|
+
import Components from 'unplugin-vue-components/vite';
|
|
805
|
+
import { EldraUiResolver } from '@eldrajs/ui/resolver';
|
|
806
|
+
|
|
807
|
+
export default defineConfig({
|
|
808
|
+
plugins: [Components({ resolvers: [EldraUiResolver()] })],
|
|
809
|
+
});
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
A template can then write `<EldraButton>`, `<EldraSelect>`, and so on, with no explicit import —
|
|
813
|
+
the plugin auto-imports `{ Button }` (etc.) from `@eldrajs/ui` the first time it sees the tag; the
|
|
814
|
+
components are never globally registered. The default prefix is `'Eldra'`:
|
|
815
|
+
|
|
816
|
+
```ts
|
|
817
|
+
EldraUiResolver({ prefix: 'Acme' }); // <AcmeButton> instead
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
`EldraUiResolver(...).resolve(name)` returns `{ name, from: '@eldrajs/ui' }` for every component
|
|
821
|
+
`src/index.ts` exports under `<prefix><Name>`, and `undefined` for anything else — including a
|
|
822
|
+
`Ui`-prefixed tag. `Ui` is never the resolver's default prefix: that prefix belongs to the private
|
|
823
|
+
Eldra library and its own resolver. Pass `{ prefix: 'Ui' }` yourself if a consumer genuinely wants
|
|
824
|
+
that name — the package itself never implies it.
|
|
825
|
+
|
|
826
|
+
## `./vee-validate`
|
|
827
|
+
|
|
828
|
+
Everything above is validation-agnostic: `FieldWrapper` takes an `error` string, `Input` takes
|
|
829
|
+
`invalid`, and where those come from is the consumer's business. `@eldrajs/ui/vee-validate` is the
|
|
830
|
+
optional adapter for the one library the spec names — nothing else in the package imports it, and
|
|
831
|
+
the root entry loads fine without it (a test proves both, in the source graph and in `dist/`).
|
|
832
|
+
|
|
833
|
+
```bash
|
|
834
|
+
pnpm add vee-validate # optional peer, ^4.12
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
It exports `Form`, twelve `Field*` components, `API_ERRORS_KEY` and the `useFieldControl`
|
|
838
|
+
composable they are all built on.
|
|
839
|
+
|
|
840
|
+
### The `FieldWrapper` pattern
|
|
841
|
+
|
|
842
|
+
A `Field*` renders **only** the control. The label, the help text, the required mark and the error
|
|
843
|
+
row stay the `FieldWrapper`'s, exactly as they are without validation — so the message reaches the
|
|
844
|
+
wrapper through the form's default slot:
|
|
845
|
+
|
|
846
|
+
```vue
|
|
847
|
+
<script setup lang="ts">
|
|
848
|
+
import { Button, FieldWrapper } from '@eldrajs/ui';
|
|
849
|
+
import { FieldInput, Form } from '@eldrajs/ui/vee-validate';
|
|
850
|
+
|
|
851
|
+
const schema = { email: 'required|email' };
|
|
852
|
+
function send(values) {
|
|
853
|
+
/* … */
|
|
854
|
+
}
|
|
855
|
+
</script>
|
|
856
|
+
|
|
857
|
+
<template>
|
|
858
|
+
<Form heading="Ask the studio" :validation-schema="schema" @submit="send">
|
|
859
|
+
<template #default="{ errors }">
|
|
860
|
+
<FieldWrapper label="Email address" required :error="errors.email">
|
|
861
|
+
<FieldInput name="email" type="email" autocomplete="email" />
|
|
862
|
+
</FieldWrapper>
|
|
863
|
+
</template>
|
|
864
|
+
<template #actions>
|
|
865
|
+
<Button variant="primary" type="submit" label="Sending">Send message</Button>
|
|
866
|
+
</template>
|
|
867
|
+
</Form>
|
|
868
|
+
</template>
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
Vue refuses a `v-slot` on a component that also has named slot templates as children, so the fields
|
|
872
|
+
go in an explicit `<template #default="{ errors }">` whenever there is an actions row — which there
|
|
873
|
+
almost always is.
|
|
874
|
+
|
|
875
|
+
`errors` is keyed by each field's `name`, and holds only the messages that should currently
|
|
876
|
+
**show**: a field appears there once it has been touched or the form has been submitted. That is
|
|
877
|
+
the same gate each `Field*` puts on its own `aria-invalid`, so the wrapper and the control cannot
|
|
878
|
+
disagree about whether the field is in error. The other default-slot props are `values`, `meta`,
|
|
879
|
+
`isSubmitting` and `submitCount`.
|
|
880
|
+
|
|
881
|
+
Three of the controls own an `error` prop of their own — `FieldRadioGroup`, `FieldCheckboxGroup`
|
|
882
|
+
and `FieldQuantityStepper` — and those draw their message themselves **only outside** a
|
|
883
|
+
`FieldWrapper`. Inside one the wrapper says it, once.
|
|
884
|
+
|
|
885
|
+
### The components
|
|
886
|
+
|
|
887
|
+
| Component | Wraps | Field value |
|
|
888
|
+
| ---------------------- | ----------------- | ----------------------------------------------------------------------------- |
|
|
889
|
+
| `FieldInput` | `Input` | `string` |
|
|
890
|
+
| `FieldTextarea` | `Textarea` | `string` |
|
|
891
|
+
| `FieldUnitInput` | `UnitInput` | `number \| null` (`null` is an empty field) |
|
|
892
|
+
| `FieldCurrencyInput` | `CurrencyInput` | `number \| null` (`null` is an empty field) |
|
|
893
|
+
| `FieldCheckbox` | `Checkbox` | `boolean` (one consent box) |
|
|
894
|
+
| `FieldCheckboxGroup` | `CheckboxGroup` | `string[]` (one question, several answers) |
|
|
895
|
+
| `FieldRadioGroup` | `RadioGroup` | `string` |
|
|
896
|
+
| `FieldSwitch` | `Switch` | `boolean` |
|
|
897
|
+
| `FieldSelect` | `Select` | `string` |
|
|
898
|
+
| `FieldMultiSelect` | `MultiSelect` | `string[]` |
|
|
899
|
+
| `FieldQuantityStepper` | `QuantityStepper` | `number` |
|
|
900
|
+
| `FieldVariantPicker` | `VariantPicker` | `string` (`name` is the visible legend unless `legend` is given — see `path`) |
|
|
901
|
+
| `FieldSearchBar` | `SearchBar` | `string` |
|
|
902
|
+
|
|
903
|
+
Each takes `name` (the control's native `name`, and by default the field's path too), optional
|
|
904
|
+
`path`, optional `rules` (vee-validate's own `RuleExpression`: a rule string, an object, a function,
|
|
905
|
+
or a typed schema) and optional `label` — the name a rule message uses for the field, not a visible
|
|
906
|
+
label. Everything else its component takes is forwarded untouched, slots, `classes` and attributes
|
|
907
|
+
included; the props it keeps back are `modelValue`, `invalid` and `error`, which are `Omit`ted from
|
|
908
|
+
the type so passing one is a compile error rather than a prop that silently does nothing.
|
|
909
|
+
|
|
910
|
+
**`path` is for the one control whose `name` can be visible.** A `VariantPicker`'s `name` is drawn
|
|
911
|
+
in the legend as well as used as the radios' shared native name, so with `name="Size"` and no `path`
|
|
912
|
+
the field would be called `Size` in `initialValues`, `validationSchema`, `apiErrors` and the `errors`
|
|
913
|
+
slot prop, and either the legend or the key would have to be wrong:
|
|
914
|
+
|
|
915
|
+
```vue
|
|
916
|
+
<!-- the legend reads "Size"; values.size holds the choice -->
|
|
917
|
+
<FieldVariantPicker name="Size" path="size" :options="sizes" />
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
A page with more than one picker sharing an option name needs a _unique_ `name` per picker, which
|
|
921
|
+
is what `legend` is for — it separates the two jobs, so `name` is only the radios' grouping key and
|
|
922
|
+
`legend` is the visible (and accessible) name of the group. `FieldVariantPicker` forwards it like
|
|
923
|
+
every other `VariantPicker` prop:
|
|
924
|
+
|
|
925
|
+
```vue
|
|
926
|
+
<!-- the legend still reads "Size"; the radios group by a per-product name -->
|
|
927
|
+
<FieldVariantPicker :name="`size-${sku}`" path="size" legend="Size" :options="sizes" />
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
`path` defaults to `name`, so every other control needs nothing extra: a `RadioGroup`'s or
|
|
931
|
+
`CheckboxGroup`'s `name` is only the shared native field name, never the legend (that is `legend`),
|
|
932
|
+
and an `Input`'s is the native name outright.
|
|
933
|
+
|
|
934
|
+
`FieldSearchBar` is the odd one: a `SearchBar` renders a `<form>` of its own, so it belongs on a
|
|
935
|
+
Search page rather than inside a `Form`'s `<form>`; its `label` is both the control's accessible
|
|
936
|
+
name and the name rule messages use; and it takes neither `id` nor `name` from the field, because it
|
|
937
|
+
sets its own id and its native field is always `q`.
|
|
938
|
+
|
|
939
|
+
### `Form`
|
|
940
|
+
|
|
941
|
+
`Form` renders a `FormLayout` and passes every one of its props through — bar `focusOnInvalid`,
|
|
942
|
+
which it sets itself — so the layout, heading, actions row, two-column container query and polite
|
|
943
|
+
status region are the ones documented above. It adds:
|
|
944
|
+
|
|
945
|
+
- **`initialValues`** and **`validationSchema`** — handed to `useForm`.
|
|
946
|
+
- **`submit(values, ctx)`** — fires only with valid values; `ctx` is vee-validate's submission
|
|
947
|
+
context (`resetForm`, `setErrors`, …). **`invalid(errors)`** fires instead when validation fails,
|
|
948
|
+
after focus has already moved to the first invalid field.
|
|
949
|
+
- **`submitting`** — `isSubmitting`, or the prop, whichever is true. `submit` is an event rather
|
|
950
|
+
than an awaited handler, so bind `submitting` yourself for a request you own.
|
|
951
|
+
- **The error summary** — after a failed submit the spec's alert box appears above the fields with
|
|
952
|
+
a link to each error (the link text is the message; the target is the control's own id, which is
|
|
953
|
+
the one the `FieldWrapper` generated). Fill the `errorSummary` slot to replace the list; the box,
|
|
954
|
+
its border and its icon are still drawn for you.
|
|
955
|
+
- **`apiErrors`** — a `{ [path]: message }` map from the server, applied with `setErrors`. Each
|
|
956
|
+
entry disappears the moment **its own** field changes, because a server error is a statement about
|
|
957
|
+
the value that was sent, and every entry is dropped at the start of the next submit attempt for
|
|
958
|
+
the same reason. It is provided on `API_ERRORS_KEY`, so a `Field*` reads the same map outside a
|
|
959
|
+
`Form` too.
|
|
960
|
+
|
|
961
|
+
How long one survives a change to a **different** field is vee-validate's own behaviour rather
|
|
962
|
+
than a choice made here, and it is worth knowing: before the first submit — and with per-field
|
|
963
|
+
`rules` at any time — only the field that changed is revalidated, so another field's server error
|
|
964
|
+
stays put. After a submit, with a form-level `validationSchema`, vee-validate revalidates every
|
|
965
|
+
already-validated field on each change (`validated-only` mode), and a field that now passes has
|
|
966
|
+
its manually set error replaced by that pass, so the server's message for it goes too. Send the
|
|
967
|
+
current `apiErrors` with each response rather than treating one as sticky.
|
|
968
|
+
|
|
969
|
+
- **`successMessage`** — announced in the polite live region once a submit passes validation. It is
|
|
970
|
+
never visible: replacing the form with a confirmation, or navigating, stays the page's job (spec
|
|
971
|
+
"Form layout" → States, Success). An explicit `statusMessage` wins over it.
|
|
972
|
+
|
|
973
|
+
## Accessibility and testing
|
|
974
|
+
|
|
975
|
+
Every component in this package ships, as part of being done, not as an add-on:
|
|
976
|
+
|
|
977
|
+
- **Zero `axe` violations** (`vitest-axe`, the `region` rule disabled to match the starter) against
|
|
978
|
+
every state the spec's states table lists for that component.
|
|
979
|
+
- **A keyboard test for every row of the spec's keyboard table** — focus movement, `aria-*` state
|
|
980
|
+
and emitted events, exercised with `@vue/test-utils`' `trigger('keydown', …)`, not just a
|
|
981
|
+
mouse-click assertion.
|
|
982
|
+
- **A Storybook story per state**, titled with the spec's own state names ("Loading", "Sold out",
|
|
983
|
+
"Long content", "Narrow container", "Reduced motion", "Forced colours" — the last two via
|
|
984
|
+
emulated media in the story parameters), in `packages/ui/.storybook`
|
|
985
|
+
(`@storybook/vue3-vite`). Run it locally with `pnpm --filter @eldrajs/ui storybook`.
|
|
986
|
+
- **A screenshot regression harness**: `scripts/screenshots.mjs` captures every story at 1280 and
|
|
987
|
+
360px with Playwright and compares against committed baselines in `packages/ui/__screenshots__`
|
|
988
|
+
(pixelmatch, 0.1% threshold). `pnpm --filter @eldrajs/ui screenshots --update` refreshes them
|
|
989
|
+
after an intentional visual change. **The committed baselines are macOS/Chromium renderings**, and
|
|
990
|
+
font rasterisation differs enough between platforms that a run on Linux or Windows will fail on
|
|
991
|
+
nearly every story; regenerate them on your own platform (and do not commit that regeneration)
|
|
992
|
+
until per-platform baselines land. The harness is deliberately **outside `pnpm check`** and
|
|
993
|
+
outside CI for the same reason — it is run and reviewed by hand.
|
|
994
|
+
|
|
995
|
+
The design spec's own five-step testing protocol is the definition of done per component:
|
|
996
|
+
|
|
997
|
+
1. Run an automated accessibility checker against each state of each component. Zero violations.
|
|
998
|
+
2. Keyboard-only pass: reach, operate and leave every part using exactly the keys in the section's
|
|
999
|
+
table.
|
|
1000
|
+
3. Screen-reader pass on one desktop and one mobile screen reader: names, roles, states and
|
|
1001
|
+
announcements match the Accessibility notes.
|
|
1002
|
+
4. Contrast: check every text and non-text pair in the states table against the ratios in the
|
|
1003
|
+
colour table.
|
|
1004
|
+
5. 200% zoom and a 320px-wide viewport; reduced motion on; forced colours on.
|
|
1005
|
+
|
|
1006
|
+
**What is actually automated, precisely.** Step 1 (axe, per state), step 2 (the keyboard tests) and
|
|
1007
|
+
the visual half of step 5 (the reduced-motion and forced-colours stories, captured with Playwright's
|
|
1008
|
+
media emulation) — plus the screenshot baselines above. **Steps 3 and 4 are not automated in this
|
|
1009
|
+
package**, and step 5's zoom pass is not either: axe runs under happy-dom, where there is no layout
|
|
1010
|
+
and no computed paint, so its `color-contrast` rule cannot evaluate and reports nothing. Nothing
|
|
1011
|
+
under `src/` computes a relative luminance, and `scripts/build-tokens.mjs` only copies the token
|
|
1012
|
+
values across. The one automated ratio check on the whole branch is
|
|
1013
|
+
[`examples/starter-nuxt/test/tokens.spec.ts`](../../examples/starter-nuxt/test/tokens.spec.ts),
|
|
1014
|
+
which checks eleven pairs of the **starter's** `tokens.json`. Contrast, the screen-reader pass and
|
|
1015
|
+
the zoom/320px pass are therefore manual protocol steps, performed and recorded per component
|
|
1016
|
+
during development, outside this repository's own history.
|
|
1017
|
+
|
|
1018
|
+
## Additions beyond the spec
|
|
1019
|
+
|
|
1020
|
+
Things this package ships that design spec 1 does not name at all. Each is listed here so a reader
|
|
1021
|
+
comparing the package against the spec can tell an addition from a drift.
|
|
1022
|
+
|
|
1023
|
+
- **`Chip` and `ChipGroup`** — an operator addition (2026-09-25) for the private component
|
|
1024
|
+
library's `FilterChip`, which a store migrating onto this package needs an equivalent of. There
|
|
1025
|
+
is no spec 1 "Chip" section; the visual language is derived from two sections that do exist:
|
|
1026
|
+
Badge's pill shape and Multi-select's removable tag row, whose exact class recipe `Chip`'s `sm`
|
|
1027
|
+
size shares with `MultiSelect.vue` (`src/utils/tagRecipe.ts`, extracted rather than duplicated).
|
|
1028
|
+
A plain chip is a `<span>`, no role; `selectable` renders a real `<button type="button"
|
|
1029
|
+
aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same pair Badge's
|
|
1030
|
+
own `primary` tone fills with. `removable` adds a separate `<button>` named `"Remove <label>"`
|
|
1031
|
+
(`messages.removeTag`, `MultiSelect`'s own tag message, reused rather than duplicated) —
|
|
1032
|
+
**and always wins over `selectable`**: a removable chip's root is never also the selection
|
|
1033
|
+
toggle, because nesting a real `<button>` (remove) inside a real `<button>` (root) is invalid
|
|
1034
|
+
HTML. This is the same rule the private library's own `FilterChip` states outright in its
|
|
1035
|
+
`CLAUDE.md` ("removable mode is display-only for the chip body; only the close button is
|
|
1036
|
+
interactive"); a dev-only console warning fires for the combination. `Backspace`/`Delete` on a
|
|
1037
|
+
focused removable chip's root (`tabindex="0"`, no invented ARIA role) or its remove button emits
|
|
1038
|
+
`remove`; `Enter`/`Space` toggle a selectable chip through the native `<button>`'s own behaviour,
|
|
1039
|
+
with no separate keydown handler that could double-toggle. `icon` draws directly (Badge's own
|
|
1040
|
+
reasoning: neither chip size's icon dimension or stroke is one of `Icon.vue`'s four); `avatar`
|
|
1041
|
+
draws through `Avatar` at the chip's own icon size via `classes.root` — no built-in `Avatar` size
|
|
1042
|
+
is small enough to sit inside either chip size, so it is drawn undersized rather than left at
|
|
1043
|
+
`Avatar`'s own smallest, `sm`.
|
|
1044
|
+
|
|
1045
|
+
`ChipGroup` (`modelValue: string[]`, `ariaLabel`, `disabled`) is a slot wrapper like `ButtonGroup` —
|
|
1046
|
+
it does not render its children, a consumer places `<Chip value="…" selectable>`s in its default
|
|
1047
|
+
slot — that provides `CHIP_GROUP_KEY` context (`src/components/chip/context.ts`, exported from
|
|
1048
|
+
the root entry): a member chip with both `selectable` and a `value` reads its selected state from
|
|
1049
|
+
`modelValue` and toggles through the group's own `update:modelValue` instead of its own
|
|
1050
|
+
`selected`/`update:selected`. `role="group"` with the given `aria-label`; the wrap gap is
|
|
1051
|
+
`space-2`, `tokens.json`'s own token description for "chip gaps" — a narrower gap than
|
|
1052
|
+
`ButtonGroup`'s `space-3` "gap inside control groups", because these are a row of chips, not a
|
|
1053
|
+
row of whole controls.
|
|
1054
|
+
|
|
1055
|
+
- **`UnitInput` and `CurrencyInput`** — editable unit and money fields, and **ports of the two
|
|
1056
|
+
components Eldra's private component library ships**, not designs of this package's own. The spec
|
|
1057
|
+
has no editable numeric field: its `Price` is a display component (plan 2), and `Input`'s
|
|
1058
|
+
`type="number"` is a native number input, which cannot hold a locale-grouped value at all. They
|
|
1059
|
+
are `Input`'s box in every respect a customer can see (the same sizes, paddings, focus ring and
|
|
1060
|
+
error boundary, imported from `src/components/input/classes.ts`), plus the part a text field
|
|
1061
|
+
cannot do: a `number` on one side and an `Intl`-formatted string in the field **at all times**,
|
|
1062
|
+
reformatted on every keystroke with the caret mapped through the new text. They are a port so
|
|
1063
|
+
that a store that knows those fields knows these; the handful of places this port deliberately
|
|
1064
|
+
departs from them is listed under the deviations below.
|
|
1065
|
+
- **`FieldUnitInput` and `FieldCurrencyInput`**, their `./vee-validate` wrappers, binding
|
|
1066
|
+
`number | null`.
|
|
1067
|
+
- **`provideEldraUiLocale` / `useEldraUiLocale` / `LOCALE_KEY`** (`src/composables/useLocale.ts`) —
|
|
1068
|
+
the number locale as a provide/inject pair, the same shape as the messages one and deliberately a
|
|
1069
|
+
separate key: the strings a component renders and the locale its numbers are formatted in are
|
|
1070
|
+
different decisions. `UnitInput`, `CurrencyInput`, `QuantityStepper` and `Price` read it, and each
|
|
1071
|
+
one's own `locale` prop wins over it.
|
|
1072
|
+
- **`provideEldraUiCurrency` / `useEldraUiCurrency` / `CURRENCY_KEY`**
|
|
1073
|
+
(`src/composables/useLocale.ts`) — `LOCALE_KEY`'s sibling, the store currency `Price` formats
|
|
1074
|
+
with by default; `Price`'s own `currency` prop wins over it. **There is no default code**, unlike
|
|
1075
|
+
the locale pair: a component library a shop of any kind installs cannot guess a currency, and a
|
|
1076
|
+
dollar sign in front of krónur is a _wrong_ price where a bare number is only an incomplete one.
|
|
1077
|
+
So it answers `string | undefined`, and with no currency from either source `Price` formats the
|
|
1078
|
+
amount as a plain number — same `Intl` path, no symbol, no code. Providing `undefined` is itself
|
|
1079
|
+
an answer ("this store has no currency") and is silent; having no provider at all warns once per
|
|
1080
|
+
session in dev, since that is an app that never wired the key. `''` means the same as `undefined`
|
|
1081
|
+
— both here and in `Price`'s own `currency` prop, so a consumer that unwraps `CURRENCY_KEY` and
|
|
1082
|
+
passes the value down as a prop gets the same plain number either way.
|
|
1083
|
+
- **`FieldCheckboxGroup`** — the twelfth `Field*`, for the one root-entry control the spec's list
|
|
1084
|
+
of ten left without a way to validate it (see the deviation below).
|
|
1085
|
+
- **`filterNumericBeforeInput`** (`src/utils/numeric-input.ts`) — the `beforeinput` filter that
|
|
1086
|
+
keeps a numeric text field numeric, used by `QuantityStepper` and exported for a consumer
|
|
1087
|
+
building a numeric control of their own.
|
|
1088
|
+
- **`createNumberFormat` / `formatNumber` / `defaultUnitFormat` / `formatUnit` / `formatCurrency` /
|
|
1089
|
+
`currencySymbol` / `parseLocaleNumber` / `localeSeparators` / `currencyFractionDigits`**
|
|
1090
|
+
(`src/utils/number-format.ts`) — locale-aware number formatting and its inverse, behind the
|
|
1091
|
+
numeric controls and exported for use outside them.
|
|
1092
|
+
|
|
1093
|
+
**`defaultUnitFormat({ locale, unit, maxFraction, isCurrency, currency, narrow, minFraction }, extraOptions?)`**,
|
|
1094
|
+
**`formatUnit(value, { …same options })`** and
|
|
1095
|
+
**`formatCurrency(value, locale = 'en-US', currency = 'USD', narrowSymbol = true, maxFraction = 2, minFraction?)`**
|
|
1096
|
+
are **ports of the private Eldra library's own three helpers, and the canonical copy of them**:
|
|
1097
|
+
that library is expected to import all three and delete its `unit-utils.ts` outright, so the
|
|
1098
|
+
signatures are positional and the option names are its own, against this package's house style, and
|
|
1099
|
+
for the arguments it passes the output must stay identical character for character.
|
|
1100
|
+
|
|
1101
|
+
`defaultUnitFormat` is the one that holds the rule — it returns the `Intl.NumberFormat`, and the
|
|
1102
|
+
other two are wrappers over it exactly as the private library's own two are, which is why porting
|
|
1103
|
+
only the wrappers would have left the sign and digit rule still defined privately. The rule, in
|
|
1104
|
+
full: `style` is `"currency"` or `"unit"`; a unit carries `unit` and **no `unitDisplay`**, so
|
|
1105
|
+
`Intl`'s own `"short"` applies (which is why `UnitFormatOptions.narrow` affects a currency only —
|
|
1106
|
+
unlike `NumberFormatOptions.narrow`, which narrows a unit too); a currency carries `currency` and
|
|
1107
|
+
`currencyDisplay: narrow ? 'narrowSymbol' : 'symbol'`; `minimumFractionDigits` is `minFraction`
|
|
1108
|
+
(`0` when omitted) and `maximumFractionDigits` is `maxFraction`. `extraOptions` is a plain
|
|
1109
|
+
`Intl.NumberFormatOptions` bag spread **last**, so it overrides any of them — that is how the
|
|
1110
|
+
private `UnitInput` asks for `{ minimumFractionDigits: 2 }` on its placeholder.
|
|
1111
|
+
`src/utils/__tests__/number-format.spec.ts` holds parity tables that recompute that rule with
|
|
1112
|
+
`Intl` directly — formatted output _and_ `resolvedOptions()`, `extraOptions` included — and fail if
|
|
1113
|
+
the two ever diverge.
|
|
1114
|
+
|
|
1115
|
+
**`minFraction` is the one addition to the ported signature, and it is display-only: omit it to
|
|
1116
|
+
match input formatting.** Omitted — which is how the private library calls — the behaviour is
|
|
1117
|
+
exactly the contract above, so `28` formats as `"$28"` and `28.5` as `"$28.5"`: the rule a
|
|
1118
|
+
currency _field_ wants, where it shows what a person typed rather than what the minor unit
|
|
1119
|
+
allows. A _displayed_ amount wants the opposite, a price list in which one row reads `$96` and
|
|
1120
|
+
the next `$96.50` being no column of money, so it passes `currencyFractionDigits(currency, locale)`
|
|
1121
|
+
and gets `"$96.00"`. `Price` passes that count as **both** `minFraction` and `maxFraction`; a
|
|
1122
|
+
zero-decimal currency is unaffected by either, its own count being `0`. It **must not exceed
|
|
1123
|
+
`maxFraction`**, which defaults to `2` whatever the currency, so a three-decimal currency needs both
|
|
1124
|
+
passed — asking for `minFraction: 3` alone is refused with a `RangeError` naming both, rather than
|
|
1125
|
+
`Intl`'s own message blaming a `maximumFractionDigits` the caller never set.
|
|
1126
|
+
|
|
1127
|
+
`formatCurrency` is what a theme should reach for when it has to put money in a sentence ("Add to
|
|
1128
|
+
cart · ISK 2,800") rather than render a `<Price>`: a hand-built
|
|
1129
|
+
`Intl.NumberFormat({ style: 'currency' })` prints English for Icelandic in Chrome, which is not
|
|
1130
|
+
the shape this package's own prices and currency fields are in, and that mismatch is exactly the
|
|
1131
|
+
defect it exists to prevent. Note that `maxFraction` defaults to `2` whatever the currency, so a
|
|
1132
|
+
caller that wants the currency's own count passes it — which is what keeps a króna from growing a
|
|
1133
|
+
fraction it has no minor unit for, and `BHD` at three places. It **throws** `RangeError` for a
|
|
1134
|
+
code `Intl` rejects, as the private helper does; a caller inside a `computed` guards it the way
|
|
1135
|
+
`Price` does (plain decimal plus the raw code). `formatUnit` memoises its formatter per distinct
|
|
1136
|
+
shape, so a grid of prices pays for one construction rather than one per amount while the function
|
|
1137
|
+
stays pure; `defaultUnitFormat` and `createNumberFormat` are uncached, because they hand the
|
|
1138
|
+
formatter back and the caller already owns its lifetime.
|
|
1139
|
+
|
|
1140
|
+
**`currencySymbol(currency, locale, narrow = true)`** is this package's own addition rather than a
|
|
1141
|
+
port: the sign on its own — `"kr"`, `"kr."`, `"$"` — read out of `formatToParts` rather than a
|
|
1142
|
+
code → symbol table, for a place that names a currency rather than formatting an amount in it. A
|
|
1143
|
+
currency with no sign distinct from its code in that locale returns the code, so a caller pairing
|
|
1144
|
+
the two should compare them rather than printing `"ISK ISK"`. It never throws.
|
|
1145
|
+
|
|
1146
|
+
`currencyFractionDigits` is the one no component here calls: `UnitInput` and `CurrencyInput`
|
|
1147
|
+
keep the private library's rule that `maxFraction` is `2` whatever the currency, so it is
|
|
1148
|
+
exported for a consumer who wants the currency's own minor unit instead (`0` for ISK, `3` for
|
|
1149
|
+
KWD, read from ICU).
|
|
1150
|
+
|
|
1151
|
+
- **`frameAspectRatio`** (`src/utils/ratio.ts`) — turns an `ImageRatio` preset into the CSS
|
|
1152
|
+
`aspect-ratio` value `Image`'s frame and `Skeleton`'s `media` variant both resolve it to; exported
|
|
1153
|
+
so a consumer accepting an `ImageRatio` of their own (`ImageRatio` itself is public) can honour it.
|
|
1154
|
+
- **`formatDate`** (`src/utils/date.ts`) — the ISO-date formatter behind `ContentCard`'s `date` prop.
|
|
1155
|
+
Never throws: a malformed, empty or calendar-invalid value (`'2026-02-30'`) returns `null` rather
|
|
1156
|
+
than a fabricated date or a thrown `RangeError`, warning once per bad value in dev.
|
|
1157
|
+
- **`useSlotPresence`** (`src/composables/useSlotPresence.ts`) — reactive named-slot presence, used
|
|
1158
|
+
by every component in this package that branches on a slot (slots are not reactive on their own —
|
|
1159
|
+
see the composable's own comment).
|
|
1160
|
+
- **`useHeadingTag`** (`src/composables/useHeadingTag.ts`), and the shared **`HeadingLevel`** type
|
|
1161
|
+
(`2 | 3 | 4 | 5 | 6`) it takes — `headingLevel` → `<component :is>` tag name, factored out of
|
|
1162
|
+
`ContentCard`/`FeatureCard`/`ProductCard`/`EmptyState`/`FormLayout`, each of which used to
|
|
1163
|
+
redeclare the identical one-line `computed`. `FormLayout`'s own narrower `FormLayoutHeadingLevel`
|
|
1164
|
+
(`2 | 3 | 4`) is `Extract<HeadingLevel, 2 | 3 | 4>`, not a separately re-typed union.
|
|
1165
|
+
- **`roundRatingToHalf` / `ratingStarStates`** (`src/utils/rating.ts`) — `Rating`'s own
|
|
1166
|
+
round-to-nearest-half-star and five-star-fill-state rules, for a consumer building a rating
|
|
1167
|
+
display (or a custom `Rating` slot) that should round the same way.
|
|
1168
|
+
- **`initialsFromName`** (`src/utils/avatar.ts`) — `Avatar`'s own initials rule (first + last word's
|
|
1169
|
+
first letter, uppercase; a single word keeps its own first two letters), for a consumer's own
|
|
1170
|
+
avatar-shaped fallback.
|
|
1171
|
+
- **`FormLayout`'s `statusMessage` and `focusOnInvalid`, `Form`'s `successMessage`, and
|
|
1172
|
+
`FieldBinding`'s `path`** — each named in the deviations below, where the reason is.
|
|
1173
|
+
- **`Popover`** — an operator addition (2026-09-25) for the private component library's own
|
|
1174
|
+
`Popover`/`Dropdown`, which a store migrating onto this package needs a generic equivalent of.
|
|
1175
|
+
There is no spec 1 "Popover" section; the visual language is `Select`'s own popup (its rounded
|
|
1176
|
+
panel, border, shadow and `animate-eldra-popover-in` entrance) and the behaviour is `usePopover`'s
|
|
1177
|
+
— the same registry (`openRegistry`, "only one open at a time" _with_ `Select`/`MultiSelect`/
|
|
1178
|
+
`SearchBar` too), `useOverlay` closing rules, `useFloating` positioning (`placement`,
|
|
1179
|
+
`matchWidth`), teleport (`body`, or the open native `<dialog>` the trigger sits in) and pointer
|
|
1180
|
+
latch that those three controls already share, extracted one level further so a component with no
|
|
1181
|
+
listbox of its own — a menu, a filter panel, a dropdown — can use the exact same machinery instead
|
|
1182
|
+
of a hand-rolled copy.
|
|
1183
|
+
|
|
1184
|
+
Its `trigger` is not drawn by the component at all: a scoped slot (`{ open, toggle, attrs }`,
|
|
1185
|
+
mirroring the private library's own Studio-documented `#trigger="{ triggerAttrs }"` shape) hands
|
|
1186
|
+
the consumer everything to spread (`v-bind="attrs"`) onto whatever element they render — `id`,
|
|
1187
|
+
`type: 'button'`, `aria-haspopup`, `aria-expanded`, `aria-controls`, a `class` built from
|
|
1188
|
+
`classes.trigger`, and the click/pointerdown pair — because a generic popover cannot know whether
|
|
1189
|
+
its trigger should be a `<button>`, an `<a>`, or a table row the way `Select`'s always-a-button
|
|
1190
|
+
trigger can. The panel itself carries **no default `role`** — deliberately, unlike `Select`'s
|
|
1191
|
+
panel, which is always `role="listbox"` because it always is one: a `Popover`'s content could be a
|
|
1192
|
+
menu, a listbox, or a plain filter form, and a package-imposed role would be wrong for at least
|
|
1193
|
+
two of the three. `Popover`'s own `$attrs` (`inheritAttrs: false`) forward onto the panel instead
|
|
1194
|
+
— `<Popover role="menu">` puts `role="menu"` on it directly, the same shape the private library's
|
|
1195
|
+
own `Popover` forwards its fallthrough `attrs` onto its content element with — and `ariaLabel`
|
|
1196
|
+
(this package's own accessible-name convention) sets `aria-label` there for a panel with no
|
|
1197
|
+
visible heading. Opening moves no focus into the panel by default (the private library's own
|
|
1198
|
+
`Popover` makes the same `focusOnOpen: false` choice, for the same reason: it has no idea what is
|
|
1199
|
+
inside), but `tabRedirect` is always on, since a menu's rows or a filter form's fields are exactly
|
|
1200
|
+
the real tab stops that behaviour exists for.
|
|
1201
|
+
|
|
1202
|
+
- **`narrowSymbol` on `Price`, and `Price` formatting through `formatCurrency`** — `false` by
|
|
1203
|
+
default, the same default `CurrencyInput` carries, so every currency this package renders is
|
|
1204
|
+
written with the currency's **wide** sign: `"ISK 2,800"` under `en-US`/`ISK`, not `"kr 2,800"`,
|
|
1205
|
+
the form every Eldra surface writes (`docs/icelandic-formatting.md`). Set it to `true` for the narrow sign; a locale whose two signs
|
|
1206
|
+
are identical (`is-IS` writes `kr.` either way) is unaffected either way. **`ProductCard`'s price
|
|
1207
|
+
follows the same default and has no opt-out** — the prop is `Price`'s alone, not forwarded
|
|
1208
|
+
through the card, so a consumer who needs the narrow sign inside a card reaches for `Price`
|
|
1209
|
+
directly.
|
|
1210
|
+
|
|
1211
|
+
`Price` formats every amount through that ported `formatCurrency`, passing
|
|
1212
|
+
`currencyFractionDigits(currency, locale)` as **both** the maximum and the minimum fraction
|
|
1213
|
+
digits. The maximum keeps a zero-decimal currency integral (`"ISK 2,800"`, never `"ISK 2,800.4"`)
|
|
1214
|
+
and `BHD` at three places; the minimum is why a price reads `"$48.00"` rather than the `"$48"`
|
|
1215
|
+
the same formatter gives a currency _field_, which pads nothing because a field shows what
|
|
1216
|
+
someone typed. One formatter, two rules, and the caller says which.
|
|
1217
|
+
|
|
1218
|
+
- **`revalidating` on `Price`, `StockBadge` and `ProductCard`** — a second, distinct busy state for
|
|
1219
|
+
a value that is _already on screen_ while a fresher one is fetched, which the spec's own `loading`
|
|
1220
|
+
row does not cover. It exists for prerendered storefronts: a statically built product page or
|
|
1221
|
+
collection grid paints the price and the stock line from build-time data, then refreshes only
|
|
1222
|
+
those values after load, and the visitor must keep reading the value it already has rather than
|
|
1223
|
+
watch it turn back into a skeleton. So the two states are opposites, not degrees of one thing —
|
|
1224
|
+
`loading` means _there is no value yet_ (skeleton, nothing to read), `revalidating` means _this
|
|
1225
|
+
value is real but may be a moment old_ — and `loading` wins when both are set.
|
|
1226
|
+
|
|
1227
|
+
While it is on, the value keeps its text and its place, dimmed to `--eldra-revalidating-opacity`
|
|
1228
|
+
(a shared token, default `0.75`, applied through the `eldra-revalidating` utility — per value part,
|
|
1229
|
+
never on the root, because CSS opacity composites and a dimmed root would take the spinner down
|
|
1230
|
+
with it); a `1em` spinner — the same shape `Button` draws, from the package's own internal
|
|
1231
|
+
`Spinner.vue` — is drawn beside it; the root carries `aria-busy="true"`; and a visually hidden
|
|
1232
|
+
`aria-live="polite"` region reads `messages.updatingPrice` / `messages.updatingStock`.
|
|
1233
|
+
|
|
1234
|
+
**The spinner reserves no space at all.** It is a flex item of width `0` whose negative
|
|
1235
|
+
inline-start margin cancels, exactly, the gap the root would otherwise put in front of it
|
|
1236
|
+
(`-ms-2` against `Price`'s `gap-x-2`, `-ms-1.5` against `StockBadge`'s `gap-1.5`), with the
|
|
1237
|
+
circle absolutely positioned inside that zero-width box and overflowing to the right of it. So
|
|
1238
|
+
the component's width, its characters and its line breaks are identical with the state on and
|
|
1239
|
+
off — a refreshing value never moves the layout around it — while the circle still lands
|
|
1240
|
+
immediately after the last amount. (Anchoring it to the root's own box instead, `absolute` +
|
|
1241
|
+
`start-full`, looks equivalent and is not: these roots are `inline-flex`, and a flex or grid
|
|
1242
|
+
parent stretches that box to the column, which puts the spinner at the far edge of the column
|
|
1243
|
+
rather than beside the value.) On `Price` it renders before the `unit` part, which is
|
|
1244
|
+
`basis-full` and would otherwise push it onto a third line.
|
|
1245
|
+
|
|
1246
|
+
The cost of that is real and worth stating: the circle is **drawn outside the component's own
|
|
1247
|
+
box**, so an ancestor with `overflow: hidden` whose right edge hugs the text will clip it. The
|
|
1248
|
+
escape hatch is `classes.spinner` — restyle that part (a static position, a different offset, or
|
|
1249
|
+
a real width) for a layout that cannot let it overflow.
|
|
1250
|
+
|
|
1251
|
+
The live region is in the DOM whether or not it has anything to say, and only its text changes: a
|
|
1252
|
+
region that arrives already holding its message is announced unreliably, since a screen reader
|
|
1253
|
+
takes the region and its content in one pass and has no change to report. For the same reason, a
|
|
1254
|
+
page that **hydrates with `revalidating` already `true`** should flip the flag on after mount
|
|
1255
|
+
rather than render it on: a region that is already saying "Updating price" when the page first
|
|
1256
|
+
paints is part of the initial content, not a change, and nothing announces it.
|
|
1257
|
+
|
|
1258
|
+
`announce` (default `true`) turns that region off per instance — no `aria-live` element is
|
|
1259
|
+
rendered at all, while `aria-busy`, the dim and the spinner stay exactly as they are. That is
|
|
1260
|
+
what a grid wants: twelve refreshing cards otherwise hold twenty-four polite regions all speaking
|
|
1261
|
+
at once, so the page should pass `announce: false` and announce the refresh once itself.
|
|
1262
|
+
|
|
1263
|
+
**The change itself is eased, not just the waiting.** The first default dim here was shallow
|
|
1264
|
+
enough to be nearly invisible (`0.9`), and measured on a real prerendered product page it failed
|
|
1265
|
+
the thing the state exists for: the amount read as ordinary settled text for the three seconds
|
|
1266
|
+
the read took, and then the number simply changed — a visitor who looked away never saw it
|
|
1267
|
+
happen, and one who was looking saw it blink. So two things changed together, on an operator
|
|
1268
|
+
decision (2026-10-03):
|
|
1269
|
+
|
|
1270
|
+
- **The dim is deep enough to see** — `0.75`, a quarter of the way out rather than a tenth. That
|
|
1271
|
+
is the deepest dim at which every colour these values are drawn in (`text`, `muted`, `accent`,
|
|
1272
|
+
`success`, `warning`, `danger`) still clears **3:1** against all three grounds this package
|
|
1273
|
+
ships: worst case 3.60:1 on `background`, 3.41:1 on `surface`, 3.17:1 on `surface-strong`. It
|
|
1274
|
+
is **below 4.5:1** (1.4.3) for everything but `text`, and that is the trade this default takes
|
|
1275
|
+
— for the length of the read, with `aria-busy` set while it lasts. A store that needs 4.5:1
|
|
1276
|
+
unbroken raises the token: `0.9` clears it for all six on `background` and on `surface`, and
|
|
1277
|
+
`surface-strong` needs `0.94` (at either, the dim is nearly invisible and the spinner carries
|
|
1278
|
+
the state on its own). One that wants the state louder lowers it and gives up the 3:1 floor.
|
|
1279
|
+
Being a token rather than a number in a class is what makes either direction a one-line
|
|
1280
|
+
decision.
|
|
1281
|
+
- **A changed value fades in.** `Price`'s amount and compare-at, and `StockBadge`'s status line,
|
|
1282
|
+
play a 0 → 1 opacity fade over `--eldra-duration-base` when their formatted text changes
|
|
1283
|
+
(`src/utils/valueFade.ts`). **Enter only**: the new value is in the DOM the instant the props
|
|
1284
|
+
change — in the same render as `aria-busy`, the dim and the spinner — and fades in from there.
|
|
1285
|
+
Nothing fades out, because a leaving half would keep the previous amount on screen for the
|
|
1286
|
+
length of the fade, after the component had already stopped saying it was busy. On a price that
|
|
1287
|
+
is the one thing not to do: an assistive technology re-reading when `aria-busy` clears would
|
|
1288
|
+
read the stale number, and a sighted visitor would watch the old one brighten to full strength
|
|
1289
|
+
before vanishing. **Still never a skeleton**: a value on screen stays on screen throughout.
|
|
1290
|
+
|
|
1291
|
+
**It is one element, animated in JavaScript, and that is deliberate.** A Vue `<Transition>` keyed
|
|
1292
|
+
on the text cannot do this. `mode="out-in"` renders a placeholder as soon as the key changes and
|
|
1293
|
+
brings the new child in on a _later_ render pass, so the DOM's text lags the props by a pass for
|
|
1294
|
+
every value change in the package, refresh or not — measured, not assumed: with that shape the
|
|
1295
|
+
starter's cart line total still read the old amount a tick after the stepper click, and emptying
|
|
1296
|
+
the leave classes did not change it, because the extra pass is the mode. The default mode is no
|
|
1297
|
+
better: it keeps the leaving element in the DOM for two animation frames, which is a second copy
|
|
1298
|
+
of the value in the accessibility tree. One stable element with its text interpolated normally
|
|
1299
|
+
has neither problem, so that is what `ValueText` (internal) is: a bare `<span>` carrying the
|
|
1300
|
+
caller's own `data-part` and `class`, with `Element.animate()` played on it after each change.
|
|
1301
|
+
|
|
1302
|
+
Reduced motion is answered twice over — `prefers-reduced-motion: reduce` is checked before the
|
|
1303
|
+
animation starts, and the duration is read from `--eldra-duration-base` on the element itself,
|
|
1304
|
+
which `tokens.css` zeroes under that same query; either one alone skips the fade entirely, and
|
|
1305
|
+
the value still changes instantly. Duration and easing come from the element's computed style
|
|
1306
|
+
rather than a literal, so overriding the tokens re-times this animation exactly as it re-times
|
|
1307
|
+
every CSS one (the house pattern `AccordionItem`'s panel height already follows;
|
|
1308
|
+
`src/utils/cssTiming.ts` is shared by both). The fade sits on an inner span
|
|
1309
|
+
(`currentValue`/`compareAtValue`/`labelValue`) while the dim stays on the value part: both are
|
|
1310
|
+
`opacity`, and one element cannot animate a property another rule is holding at the token's
|
|
1311
|
+
value — composited instead, the span fades 0 → 1 _inside_ the part's dim. Nothing reserves width:
|
|
1312
|
+
the amounts are already `tabular-nums`, so a number whose digit count does not change keeps
|
|
1313
|
+
exactly the width it had.
|
|
1314
|
+
|
|
1315
|
+
`ProductCard` draws none of this itself: it passes `revalidating` and `announce` to its `Price`
|
|
1316
|
+
and `StockBadge`, the two values a refresh actually changes, and the rest of the card (media,
|
|
1317
|
+
title, badges, quick add) stays exactly as it was and fully interactive.
|
|
1318
|
+
|
|
1319
|
+
New parts: `spinner` and `srStatus` on `Price` and `StockBadge` — `srStatus`, not `status`,
|
|
1320
|
+
because `LoadMore` already owns a visible `status` part and a collection page renders both — plus
|
|
1321
|
+
the fade's own value spans, `currentValue`/`compareAtValue` on `Price` and `labelValue` on
|
|
1322
|
+
`StockBadge`.
|
|
1323
|
+
|
|
1324
|
+
## Deviations
|
|
1325
|
+
|
|
1326
|
+
- **`FilterPanel`'s price range is inset by the thumb's radius plus the focus ring's reach (0.875rem), not the spec's bare 0.625rem.** The spec's Filter panel rows inset the track and the histogram by 0.625rem so the thumbs' centres reach the panel's edges; the extra ring reach keeps a focused end thumb from being clipped by a scrolling drawer body, which would otherwise show a horizontal scrollbar. It is still the thumb's own inset rather than `RangeSlider`'s default half-a-touch-target gutter (`eldra-range-gutter-thumb` versus `eldra-range-gutter`), which is what put a sidebar's track at two thirds of its width.
|
|
1327
|
+
|
|
1328
|
+
Additions and departures from the design spec, and why.
|
|
1329
|
+
|
|
1330
|
+
- **A `FilterPanel`'s applied chips put one more stop in the tab order than the spec's own table
|
|
1331
|
+
lists.** The spec's Keyboard row reads "head **Clear all**, active chips' remove buttons, then
|
|
1332
|
+
each group trigger …", and what a shopper actually meets is _chip, remove button, chip, remove
|
|
1333
|
+
button_ — because `Chip`'s own contract makes a removable chip's root focusable so that
|
|
1334
|
+
`Backspace`/`Delete` on it removes the chip (see the Additions entry for `Chip`). Nothing is
|
|
1335
|
+
reordered and nothing is unreachable, and suppressing the root's `tabindex` in this one panel
|
|
1336
|
+
would silently delete a behaviour the library promises everywhere else, so the extra stop is
|
|
1337
|
+
recorded here rather than removed. `filterPanelKeyboard.spec.ts` asserts it, so it cannot drift
|
|
1338
|
+
back into being an accident.
|
|
1339
|
+
- **A `FilterPanel`'s Min and Max fields are named by their own visible labels, not by the thumb
|
|
1340
|
+
they mirror.** `RangeSlider`'s `inputs` slot offers each field the name its thumb carries
|
|
1341
|
+
("Minimum price") and advises using it, so a screen reader does not hear two names for one end of
|
|
1342
|
+
the range. The Filter panel section overrides that for itself: its Anatomy gives each field a
|
|
1343
|
+
visible "Min" / "Max" label, and a control whose visible word is not in its accessible name fails
|
|
1344
|
+
2.5.3. The facet's own hidden `<legend>` ("Price") is what says which range the two belong to.
|
|
1345
|
+
- **A `FilterPanel`'s `list` rows and applied chips are styled through `classes.row`/`classes.chip`
|
|
1346
|
+
but addressed by the composed child's own `data-part`.** A `list` row is a `Checkbox`, so it is
|
|
1347
|
+
`[data-part="values"] [data-part="root"]` in the DOM, and `chip` marks the `<li>` around each
|
|
1348
|
+
`Chip`; Vue applies fallthrough attributes after a child's own template bindings, so putting
|
|
1349
|
+
`data-part="row"` on either would _replace_ the child's own and lose
|
|
1350
|
+
`[data-part="row"] [data-part="box"]`. The same convention `ProductCard` and `CheckboxGroup`
|
|
1351
|
+
already follow. A `colour` facet's rows and a `size` facet's tiles are drawn by this package and
|
|
1352
|
+
do carry `data-part="row"` / `"tile"`.
|
|
1353
|
+
- **The stretched-link + proxy-focus pattern is factored into `src/components/card/stretchedLink.ts`,
|
|
1354
|
+
shared by `ContentCard`, `FeatureCard` and `ProductCard`.** All three spec sections describe the
|
|
1355
|
+
identical shape — the card root proxies the ring for a visible title `<a>` that stretches to
|
|
1356
|
+
cover the whole card via `after:absolute after:inset-0` — so it is one exported set of class
|
|
1357
|
+
strings (`CARD_FOCUS_PROXY`, `STRETCHED_LINK`, `STRETCHED_LINK_OUTLINE`) rather than duplicated
|
|
1358
|
+
three times. `ProductCard`'s root layout classes (`flex h-full min-w-56 flex-col`) sit alongside
|
|
1359
|
+
`CARD_FOCUS_PROXY` rather than replacing any part of it. The title link uses `outline-none`, not
|
|
1360
|
+
`Rating.vue`'s `outline-hidden`: `outline-hidden` stays visible under forced colours by design,
|
|
1361
|
+
which here would draw a second, text-sized ring beside `eldra-focus-proxy`'s own card-wide one —
|
|
1362
|
+
the spec's own acceptance criterion for the sibling Product card rules that out ("the link shows
|
|
1363
|
+
no separate ring"). See `stretchedLink.ts`'s own comment for the rest of the reasoning.
|
|
1364
|
+
- **`ContentCard`'s `date` prop is formatted by `src/utils/date.ts#formatDate`, not a literal
|
|
1365
|
+
`"12 Sep 2026"` string.** The spec's own example is one locale's rendering (`Intl.DateTimeFormat`
|
|
1366
|
+
with `day: 'numeric', month: 'short', year: 'numeric'`), not a fixed format the component
|
|
1367
|
+
reproduces regardless of locale — `en-US` reads "Sep 12, 2026", `is-IS` reads "12. sep. 2026". The
|
|
1368
|
+
ISO string is parsed by its own calendar components rather than handed to `new Date(iso)`
|
|
1369
|
+
directly, because that constructor reads a date-only string as UTC midnight and a locale west of
|
|
1370
|
+
UTC would format it a calendar day early.
|
|
1371
|
+
- **`Skeleton`'s `width` prop sizes the root, not the shape's own literal width.** The spec's
|
|
1372
|
+
Properties table lists `width` as the text/title shape's own CSS width ("Default 100% (title
|
|
1373
|
+
60%)"). Read that literally, an override would have to be applied to a percentage-wide `line`
|
|
1374
|
+
directly, which does nothing to fix the same trap `Price`'s own loading skeleton once had: a
|
|
1375
|
+
percentage width inside a shrink-to-fit ancestor (`inline-flex`/`inline-block`) collapses to
|
|
1376
|
+
nothing regardless of
|
|
1377
|
+
which element carries the percentage, because the ancestor itself has no definite width to
|
|
1378
|
+
resolve it against. `width` is the escape hatch for exactly that case instead: it sets the root's
|
|
1379
|
+
own width (replacing its default `w-full`) to a literal, always-definite value, and every shape
|
|
1380
|
+
inside then renders at that full (now definite) width rather than its own default fraction of it
|
|
1381
|
+
— so `<Skeleton width="12rem" variant="title" />` still renders a 12rem-wide bar, just sized from
|
|
1382
|
+
the root down rather than the shape up, and works inside a shrink-to-fit container the literal
|
|
1383
|
+
reading would not fix.
|
|
1384
|
+
- **`Skeleton`'s `btn` variant takes `--eldra-control-height` (2.5rem), not the spec's literal
|
|
1385
|
+
2.75rem.** The Sizes table gives `btn` a fixed `2.75rem` — the same figure as `target-touch`,
|
|
1386
|
+
which `Button`'s own `md` size only grows to below a 48rem **container** (a container query this
|
|
1387
|
+
placeholder does not replicate). Reserving the shape that actually needs holding in the common,
|
|
1388
|
+
non-narrow case — a resting `Button`'s own height — means reading its `control-h` utility
|
|
1389
|
+
instead, the same one `Button`'s `md` size uses.
|
|
1390
|
+
- **`Skeleton`'s region-level `busyLabel` (spec :3340, default `"Loading products…"`) is a real
|
|
1391
|
+
`busyLabel?: string | null` prop** (final review, plan 2), not deferred. With one given, the root
|
|
1392
|
+
becomes the live busy region itself (`role="status"`, `aria-busy="true"`, `aria-label`, every
|
|
1393
|
+
shape individually `aria-hidden`); with none (the default), the root stays plain `aria-hidden`, as
|
|
1394
|
+
it always was — the right shape for a `Skeleton` composed _inside_ another component's own
|
|
1395
|
+
already-named busy region (`ProductCard`'s loading root already carries `role="group"
|
|
1396
|
+
aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matches it with
|
|
1397
|
+
`messages.loading`). `FeatureCard` has no `loading` variant of its own, so nothing there composes
|
|
1398
|
+
`Skeleton` at all.
|
|
1399
|
+
- **`Container`'s three finite widths are their own `eldra-container-{narrow,content,wide}`
|
|
1400
|
+
utilities, not Tailwind's auto-generated `max-w-narrow`/`-content`/`-wide`** (package bug, fixed
|
|
1401
|
+
2026-09-27). The spec's own numbers (40rem/64rem/80rem) are also exactly the container-query
|
|
1402
|
+
breakpoint scale this package declares `@narrow:`/`@content:`/`@wide:` against — `tailwind.css`'s
|
|
1403
|
+
`--container-{narrow,content,wide}` theme keys serve both purposes, which is normally free
|
|
1404
|
+
(Tailwind reads one scale for both the width utilities and the breakpoint variants). It is not
|
|
1405
|
+
free here: a `@container` condition cannot reference a custom property, so those three keys have
|
|
1406
|
+
to hold a literal length, not the `var(--eldra-container-*)` indirection every other `@theme`
|
|
1407
|
+
value in this file uses — and shipped with exactly that `var()`, which silently compiled every
|
|
1408
|
+
`@narrow:`/`@content:`/`@wide:` variant in the package to nothing at all (`Container`'s own
|
|
1409
|
+
`@content:` desktop gutter, and every starter block's `@content:` layout, never engaged). Making
|
|
1410
|
+
the three keys literal fixes the breakpoints but would otherwise cost `max-w-content` and its
|
|
1411
|
+
siblings their runtime overridability — the whole point of `--eldra-container-*` existing as a
|
|
1412
|
+
variable in `tokens.css` in the first place — so `Container.vue` reads three small dedicated
|
|
1413
|
+
utilities instead, each a one-line `max-width: var(--eldra-container-*)`, leaving the two scales
|
|
1414
|
+
(breakpoints and widths) sharing the same three numbers without sharing the same CSS declaration.
|
|
1415
|
+
See `tailwind.css`'s own `@theme` comment for the full mechanism, and
|
|
1416
|
+
`src/__tests__/containerQueryLiterals.spec.ts` /
|
|
1417
|
+
`src/__tests__/containerQueryBreakpoints.spec.ts` for the guards.
|
|
1418
|
+
- **`Section` marks every background, including `none`, with a new `data-section-bg` attribute**
|
|
1419
|
+
(distinct from `data-section`, which stays reserved for the `primary`/`accent` colour-inversion
|
|
1420
|
+
signal `Button`/`Link`/`Price`/`Rating` already read) — an implementation detail beyond the
|
|
1421
|
+
spec's own anatomy, needed for the spec's Do/Don't rule ("alternate `none` and `surface` between
|
|
1422
|
+
neighbouring blocks instead of adding divider lines"). An unlayered `tailwind.css` rule
|
|
1423
|
+
(`[data-section-bg=X] + [data-section-bg=X]`, five pairs — CSS has no same-value-as-previous-
|
|
1424
|
+
sibling selector) zeroes a `Section`'s own top padding whenever the **previous** sibling
|
|
1425
|
+
`Section` shares its background, and wins over _any_ layered `pt-*`/`py-*` class regardless of
|
|
1426
|
+
specificity or source order (CSS Cascade Layers) — not only `spacing`'s own default, but a
|
|
1427
|
+
consumer's `classes.root: 'pt-12'` too, since a class from any source still compiles into the
|
|
1428
|
+
same layered `@layer utilities`. The escape hatch is one of the two things this rule does not
|
|
1429
|
+
touch: give the two `Section`s different `background` values (the rule only fires on a match), or
|
|
1430
|
+
reach for an unlayered override of your own (`!pt-12`, which Tailwind never puts in a layer).
|
|
1431
|
+
- **`Section` provides a new `SECTION_KEY` context and warns, in development, when a `Section`
|
|
1432
|
+
mounts inside another one** — the spec's own text says "sections are never nested inside
|
|
1433
|
+
another section" but names no mechanism for catching a violation; this package's existing
|
|
1434
|
+
dev-only-warning convention (`Button`'s `iconOnly`/`label` warnings) is reused rather than
|
|
1435
|
+
invented fresh, and a warning, not a thrown error, so a misuse degrades instead of crashing a
|
|
1436
|
+
live storefront.
|
|
1437
|
+
- **`Section.ariaLabel`/`ChipGroup.ariaLabel`, not `label`** (final review, plan 2). Both shipped
|
|
1438
|
+
as `label` first; see the Customisation section's "`ariaLabel` is always an accessible name" rule
|
|
1439
|
+
above for why that collides with every other `label` in this package. Caught by the starter's own
|
|
1440
|
+
`[...slug].vue`, whose not-found `Section` passed `:label="t('notFound.title')"` two lines above a
|
|
1441
|
+
visible `<h1>` with the identical text — an `aria-label` duplicating a visible heading is exactly
|
|
1442
|
+
the case `labelledBy` exists for. Fixed there by giving the `<h1>` an `id` and switching the
|
|
1443
|
+
`Section` to `labelled-by` pointing at it, rather than by renaming the prop and leaving the
|
|
1444
|
+
duplication in place.
|
|
1445
|
+
- **Active buttons scale to 98% instead of moving down 1px** (operator decision, 2026-09-25). The
|
|
1446
|
+
spec's Button States table gives the pressed row "moves down 1px", and that is what shipped: an
|
|
1447
|
+
`active:` one-pixel downward translate utility. A 1px translate is below the threshold at which a
|
|
1448
|
+
press reads as tactile — at the sizes the spec gives, it looks like a rendering artefact rather
|
|
1449
|
+
than a button being pushed. The whole control now shrinks to 98% from its own centre over `duration-fast`
|
|
1450
|
+
(roughly half the ~4% the private Eldra library's button uses), on every variant but `link`,
|
|
1451
|
+
which the spec's own link row gives no press movement either, and never on a disabled or loading
|
|
1452
|
+
button. Mechanically it is the independent `scale` property, which is in `eldra-focus`'s
|
|
1453
|
+
transition list beside `translate`; under `prefers-reduced-motion: reduce` the button does not
|
|
1454
|
+
scale **at all** (`motion-reduce:active:scale-100`), because removing the transition alone would
|
|
1455
|
+
leave an instant 2% jump, which is still motion.
|
|
1456
|
+
- **One popover entrance for all three popovers, and it does not slide** (operator request,
|
|
1457
|
+
2026-09-25). The spec's Select section describes the opening as a fade plus a 0.25rem slide plus
|
|
1458
|
+
a _vertical_ scale from 98%; `SearchBar`'s results panel had no entrance at all. All three —
|
|
1459
|
+
`Select`, `MultiSelect`, `SearchBar` — now play the same one: opacity 0 → 1 and a **uniform**
|
|
1460
|
+
scale 0.98 → 1 over `duration-base` with `ease-out`, growing from the corner the panel is
|
|
1461
|
+
anchored by (`--eldra-popover-origin`: `top left` below the control, `bottom left` above it).
|
|
1462
|
+
The slide made the panel read as a separate object arriving from somewhere rather than as the
|
|
1463
|
+
control opening out, and a `scaleY`-only entrance visibly stretches the type inside the panel
|
|
1464
|
+
while it plays. `--eldra-popover-slide` is gone with it. Closing is instant, as the spec says,
|
|
1465
|
+
and under reduced motion the panel simply appears (`--eldra-duration-base` is `0ms` there).
|
|
1466
|
+
- **`Input`, `SearchBar` and `UnitInput` share one field recipe.** The spec describes one field
|
|
1467
|
+
box and three controls draw it; `SearchBar` used to hold a hand-copied duplicate of `Input`'s
|
|
1468
|
+
classes, and the copy had drifted — it had lost the `--eldra-input-radius` variable and carried
|
|
1469
|
+
its own spelling of the type-size rules, which is what an operator review saw as a search field
|
|
1470
|
+
that "does not behave like the regular input fields". The recipes now live in
|
|
1471
|
+
`src/components/input/classes.ts` and all three import them; a component may add its own deltas
|
|
1472
|
+
(`SearchBar`'s pill radius and its two sizes, `UnitInput`'s drag handle) and never a
|
|
1473
|
+
second copy of the box. The class strings are internal — a consumer restyles through tokens,
|
|
1474
|
+
per-component variables and `classes`, never by importing them.
|
|
1475
|
+
- **`QuantityStepper` filters typing with `beforeinput`.** It cannot be a native
|
|
1476
|
+
`<input type="number">` (see its own deviation below), which also means it does not get the
|
|
1477
|
+
browser's own numeric filtering — an operator review
|
|
1478
|
+
found you could type anything into a quantity field, and it was only corrected on blur.
|
|
1479
|
+
`filterNumericBeforeInput` cancels an insertion that would put something non-numeric in the
|
|
1480
|
+
field, letting deletions, undo and redo through untouched. **A paste is sanitised rather than
|
|
1481
|
+
refused**: pasting `12ab3` inserts `123`, because someone who copied a number with a stray label
|
|
1482
|
+
attached meant the number, and refusing the whole paste is a dead end with no message.
|
|
1483
|
+
|
|
1484
|
+
**The locale's group separator is refused on this whole-number field.** The same character means
|
|
1485
|
+
different things in different locales: `1,5` reads as "one thousand five" to the parser and as
|
|
1486
|
+
"one point five" to an Icelandic customer, and the field committed 15 while showing something
|
|
1487
|
+
that looked like 1.5. Refused, that character never reaches the field, so the text can never say
|
|
1488
|
+
one thing while the value says another. The control shows an **ungrouped** editing string while
|
|
1489
|
+
focused (`1,000` becomes `1000`), which is what makes refusing it free: there is never a
|
|
1490
|
+
separator in the field to type after. `filterNumericBeforeInput` still accepts it on a
|
|
1491
|
+
decimal field, for a consumer building one — someone pasting `1,234.50` means 1234.5.
|
|
1492
|
+
|
|
1493
|
+
**`UnitInput` and `CurrencyInput` do the opposite, on purpose** (see below): they let a
|
|
1494
|
+
non-numeric keystroke land and strip it on the reformat.
|
|
1495
|
+
|
|
1496
|
+
- **`UnitInput` and `CurrencyInput` are ports, and the behaviour is the private library's**
|
|
1497
|
+
(operator decision, 2026-09-25). "The currency input, unit input should function identical to how
|
|
1498
|
+
they do in the private ui." The field is formatted **while it is typed into** — there is no
|
|
1499
|
+
editing mode and no focus-dependent text — because that is what a merchant already knows these
|
|
1500
|
+
fields to do; a field that showed a plain number under the caret and a formatted one on blur was
|
|
1501
|
+
rejected. Everything that follows from it (the caret mapped by numeric content, the arrow/
|
|
1502
|
+
backspace/delete rules that step over separators and never eat the symbol, `,` and `.` both
|
|
1503
|
+
inserting the locale's decimal, the empty-until-blur rule, the controlled reconciliation, the
|
|
1504
|
+
drag handle) is ported case for case, and
|
|
1505
|
+
`src/components/{unit-input,currency-input}/__tests__/` carries the private specs' own cases
|
|
1506
|
+
under their own names.
|
|
1507
|
+
|
|
1508
|
+
**Typing is not filtered in these two.** A non-numeric keystroke lands and the reformat removes
|
|
1509
|
+
it — the opposite of `QuantityStepper`, and deliberate: this field's own text is full of
|
|
1510
|
+
characters that are not digits (a symbol, group separators, a literal), so a filter judging the
|
|
1511
|
+
resulting value would have to understand the formatted string it is judging. Pasting `12ab3`
|
|
1512
|
+
leaves `123` either way.
|
|
1513
|
+
|
|
1514
|
+
**Four deliberate departures from the private components**, each because the private behaviour is
|
|
1515
|
+
wrong here rather than merely different:
|
|
1516
|
+
|
|
1517
|
+
1. **A typed decimal separator is put back inside the number, not appended to the string.** The
|
|
1518
|
+
private component appends it, which is right for `$1,234.` and wrong for every suffix-symbol
|
|
1519
|
+
format — it produced `1,234 km.` and `1.234 kr.,`.
|
|
1520
|
+
2. **`CurrencyInput` forwards only the props that were actually passed.** The private wrapper
|
|
1521
|
+
spreads all of them, so `UnitInput` sees a bound `modelValue` on a field nobody bound and the
|
|
1522
|
+
reconciliation clears an uncontrolled field a tick after every keystroke.
|
|
1523
|
+
3. **Double-click is wired to the native `dblclick` event.** The private wrapper listens for a
|
|
1524
|
+
`doubleClick` that nothing emits, so selecting the digits by double-click never worked there.
|
|
1525
|
+
4. **Read-only and disabled fields do nothing at all** — no editing, no caret placement, no
|
|
1526
|
+
stepping, no drag, no clear button. The private component has no read-only state.
|
|
1527
|
+
|
|
1528
|
+
And the package conventions on top of the port: the `data-part` anatomy and `classes`, the three
|
|
1529
|
+
field sizes, the `FieldWrapper` context (`id`, `invalid`, `required`, composed `describedBy`),
|
|
1530
|
+
`locale` from a prop or `provideEldraUiLocale()` rather than from vue-i18n, and the form value
|
|
1531
|
+
below.
|
|
1532
|
+
|
|
1533
|
+
- **`UnitInput` draws its own `label` only when nothing above it names the field.** The prop is
|
|
1534
|
+
kept for parity with the private component, whose own wrapper draws a label; inside a
|
|
1535
|
+
`FieldWrapper` the wrapper owns the label, and a second one would say it twice. That is also why
|
|
1536
|
+
the field box is one element deeper than `Input`'s: the `field` part is what the leading icon and
|
|
1537
|
+
the suffix row are positioned against, so a label above them cannot shift them.
|
|
1538
|
+
- **`UnitInput` posts the raw number through a hidden input.** `name` renders
|
|
1539
|
+
`<input type="hidden" :name :value>` carrying `1234.5`, and the visible control has no `name` of
|
|
1540
|
+
its own, so exactly one value is posted and it is never the locale string — `"1.234,5"` would be
|
|
1541
|
+
read as `1.2345` by almost every server. (The private component posts the formatted string,
|
|
1542
|
+
because it has no hidden input; this package already made the other choice for its numeric
|
|
1543
|
+
fields, and a form value that parses differently on every server is not a parity worth keeping.)
|
|
1544
|
+
- **`UnitInput` has no `role="spinbutton"`, unlike `QuantityStepper`.** A spinbutton's value space
|
|
1545
|
+
is bounded by `aria-valuemin`/`-valuemax`, and this control's `max` defaults to the largest safe
|
|
1546
|
+
integer; a spinbutton with no meaningful bounds announces less than the plain text field a screen
|
|
1547
|
+
reader otherwise reads. `ArrowUp`/`ArrowDown` still step by `step`.
|
|
1548
|
+
- **The drag handle is out of the accessible tree** (`aria-hidden`, `tabindex="-1"`, pointer only).
|
|
1549
|
+
Every value it can reach is reachable with `ArrowUp`/`ArrowDown` on the field itself, so
|
|
1550
|
+
announcing a second control for the same job would only add a stop to the keyboard path.
|
|
1551
|
+
- **The tick in a `Checkbox` and in a multi-select option is Tabler's check, not the spec's literal
|
|
1552
|
+
ink box** (operator finding, 2026-09-25). The spec's Sizes tables give the tick as
|
|
1553
|
+
0.3125 × 0.625rem (and 0.25 × 0.5rem in an option row) — a 2 : 1 box — and drawn at exactly that
|
|
1554
|
+
it reads as a shallow V rather than as a tick. Both marks are now Tabler's `check` geometry
|
|
1555
|
+
(`M5 12l5 5l10 -10` over 24 units, ≈3 : 2), scaled to fit each box with the spec's 2px stroke and
|
|
1556
|
+
round caps, centred. The widths are unchanged, so the marks still fill the boxes they sit in; the
|
|
1557
|
+
indeterminate dash is untouched.
|
|
1558
|
+
- **A `Select` or `MultiSelect` trigger shows the focus ring while its popover is open** (operator
|
|
1559
|
+
request). A trigger opened with the pointer is focused but not `:focus-visible`, so the ring did
|
|
1560
|
+
not show, and an open popover hung off a control with nothing saying it was the one the keyboard
|
|
1561
|
+
was about to act on. `eldra-focus-open` is a modifier of `eldra-focus` in the same shape as
|
|
1562
|
+
`eldra-focus-always` and `eldra-focus-proxy` — it carries no ring of its own, it only turns on the
|
|
1563
|
+
one already there — keyed to the element's own `aria-expanded="true"`, so nothing has to be kept
|
|
1564
|
+
in sync and closing fades the ring back out over the transition `eldra-focus` already owns. The
|
|
1565
|
+
`SearchBar` never needed it: its trigger is a text field, and text fields carry
|
|
1566
|
+
`eldra-focus-always`.
|
|
1567
|
+
- **The focus ring fades in at full size rather than growing.** The design spec's Focus ring
|
|
1568
|
+
section says the ring and its infill "grow from 0 to 2px over `duration-base`", and that is what
|
|
1569
|
+
this package shipped first: an animated `outline-width` and `box-shadow` spread. A browser paints
|
|
1570
|
+
both at whole device pixels, so a 2px growth has only two or three distinct frames however long
|
|
1571
|
+
the transition runs — it reads as a 1 fps stagger, not as motion, and an operator review caught
|
|
1572
|
+
it on every control in Storybook. The ring is now drawn at its full 2px + 2px geometry at all
|
|
1573
|
+
times and its **opacity** is what animates, over the same `duration-base` with the same
|
|
1574
|
+
`ease-out`. Measured in Chromium: 13 distinct alpha values across the 200ms, against 2–3 before.
|
|
1575
|
+
The end state — the thing every contrast requirement in the spec is about — is byte-identical,
|
|
1576
|
+
and nothing else about the indicator changes.
|
|
1577
|
+
|
|
1578
|
+
Mechanically: `--eldra-focus-alpha` is registered with `@property` (`syntax: '<number>'`) so the
|
|
1579
|
+
engine can interpolate it, and both ring colours are
|
|
1580
|
+
`color-mix(in srgb, transparent, <role> calc(var(--eldra-focus-alpha) * 100%))`. Two fallbacks
|
|
1581
|
+
keep it safe rather than clever — an engine without `color-mix` gets the whole ring at once
|
|
1582
|
+
through an `@supports not` rule, an engine without `@property` switches the alpha 0 → 1 with no
|
|
1583
|
+
fade, and forced-colours mode still gets a static `outline` in the system `Highlight` colour
|
|
1584
|
+
(`box-shadow` is dropped there by the UA). In every one of those paths the ring is present at
|
|
1585
|
+
full size; only the fade is lost, which is exactly what `prefers-reduced-motion` asks for anyway.
|
|
1586
|
+
|
|
1587
|
+
- **`Button` `text-button-{sm,md,lg}` utilities, and the `lg` font size as a per-component
|
|
1588
|
+
variable.** The spec's Sizes table gives `lg` a 1.0625rem font, between `body` (1rem) and
|
|
1589
|
+
`body-lg` (1.125rem) with no token of its own in `tokens.json`. Writing `text-[1.0625rem]` in the
|
|
1590
|
+
component would put a literal in a component class, which this package's own rule forbids, so
|
|
1591
|
+
`tailwind.css` declares the three `text-button-*` utilities instead —
|
|
1592
|
+
`var(--eldra-button-font-size-lg, 1.0625rem)` for the one size with no token, which also makes it
|
|
1593
|
+
a documented customisation point.
|
|
1594
|
+
- **`Button` icon-only `md` does not grow to `target-touch`.** The Sizes table gives the icon-only
|
|
1595
|
+
row its own explicit heights ("square: width = height of its size") with no narrow-container
|
|
1596
|
+
growth, unlike the labelled `md` row. 2.5rem already clears the spec's 1.5rem touch-target floor,
|
|
1597
|
+
so nothing is lost.
|
|
1598
|
+
- **`Button` `secondary` on an accent section gets the same 12% `currentColor` hover as
|
|
1599
|
+
`outline`.** The spec says the secondary button there "becomes transparent with a `currentColor`
|
|
1600
|
+
border" and stops; since it then _is_ an outline button in every other respect, it takes the
|
|
1601
|
+
outline variant's hover fill rather than no hover feedback at all.
|
|
1602
|
+
- **`Button`'s `as` takes a router-link component, not only a tag name** — the same contract as
|
|
1603
|
+
`Link`'s, and the spec's "Customisation layers" §5 lists `as` on `Button`. It applies to the link
|
|
1604
|
+
form only: with `href` set and `as` a component (`NuxtLink`, `RouterLink`), the component receives
|
|
1605
|
+
the destination as `to`, matching those components' own prop contract; with `as` a plain string it
|
|
1606
|
+
stays a tag (or custom element) that still receives `href`. With no `href` there is no destination
|
|
1607
|
+
to route, so `as` is ignored and this is a `<button>` — `Button` still chooses `<button>` or `<a>`
|
|
1608
|
+
from `href` alone, per the spec's own Accessibility note. Everything else is unchanged: icon-only
|
|
1609
|
+
and loading naming, `aria-pressed`'s link rule, and the disabled-link semantics below all behave
|
|
1610
|
+
exactly as they do on a native `<a>`.
|
|
1611
|
+
- **A disabled `Button` with a component `as` renders a plain `<a href>`, not the router link.**
|
|
1612
|
+
`Button` stops a disabled click with `preventDefault()`, which is enough for a native `<a>`,
|
|
1613
|
+
whose navigation _is_ the default action. A `RouterLink`/`NuxtLink` does not navigate by a default
|
|
1614
|
+
action: it installs its own click listener on its own root, which runs before the handler passed
|
|
1615
|
+
down through fall-through attributes — so the route change had already happened by the time
|
|
1616
|
+
`preventDefault()` ran, and a disabled call to action navigated. While disabled, the element is
|
|
1617
|
+
therefore the plain anchor for the same destination (a `<span>` if there is somehow no `href`,
|
|
1618
|
+
which `href`-implies-link makes unreachable today). Everything else is unchanged — the `href`
|
|
1619
|
+
stays so it keeps `role="link"`, with `aria-disabled="true"` and `tabindex="-1"` — and it routes
|
|
1620
|
+
again the moment it is enabled, with no change from the caller.
|
|
1621
|
+
- **`Button` disabled link button keeps its `href`.** A disabled `<a>` that also drops `href`
|
|
1622
|
+
becomes a generic element and stops exposing `role="link"` — a screen reader stops naming what it
|
|
1623
|
+
is at the exact moment it needs to say "unavailable". `href` stays, and `aria-disabled="true"`,
|
|
1624
|
+
`tabindex="-1"` and a `preventDefault()` on click make it inert instead.
|
|
1625
|
+
- **`Button` `aria-pressed`.** Never emitted on a link button (`role="link"` has no pressed state,
|
|
1626
|
+
and a dev warning says why). On any variant but `outline`, `pressed` still sets the attribute (a
|
|
1627
|
+
screen reader must hear the state) but the spec's states table gives the toggle _fill_ to
|
|
1628
|
+
`outline` alone — a pressed `primary`/`secondary`/`ghost`/`danger` button looks identical whether
|
|
1629
|
+
it is pressed or not, which is the trade-off worth knowing, not a bug.
|
|
1630
|
+
- **`Button` never grows to the touch target; it always matches the input beside it** (operator
|
|
1631
|
+
addition, 2026-09-25: "the height of the button is a bit taller than of the inputs… make all
|
|
1632
|
+
scales match so sm button = sm input, base button = base input, large input = large button").
|
|
1633
|
+
The spec's "Actions and forms" → Compact controls says "Controls keep their height on mobile.
|
|
1634
|
+
Only primary action buttons grow to `target-touch` (2.75rem)" below a 48rem container. Every
|
|
1635
|
+
sized control in this package already shared the `control-h-sm`/`control-h`/`control-h-lg`
|
|
1636
|
+
tokens except `Button`, whose `md` `primary` variant grew to 2.75rem inside any `@container`
|
|
1637
|
+
narrower than 48rem (`ButtonGroup`, `FormLayout`, the theme's `Section`) — so a primary button
|
|
1638
|
+
next to an `md` input rendered taller than it, which is what the operator saw. That growth is
|
|
1639
|
+
removed: a Button stays on the shared control-height scale at every variant and size, in every
|
|
1640
|
+
container. The WCAG 2.5.8 24px minimum is still met at every size (`sm` is 2rem = 32px).
|
|
1641
|
+
`--eldra-target-touch` and the `target-touch` utility are unchanged and still available for a
|
|
1642
|
+
future component.
|
|
1643
|
+
- **`Link` underlines every variant at rest, including `standalone` — operator direction,
|
|
1644
|
+
2026-09-26: "I would preferably have all link elements also have underline by default — that
|
|
1645
|
+
goes for breadcrumbs as well, as that is the recommended WCAG 2.2 standard" (F73, 1.4.1).** This
|
|
1646
|
+
overrides the design spec's own text for the standalone variant ("No underline at rest ... bold
|
|
1647
|
+
weight + arrow identify it"), which stays true only for the new `underline: false` opt-out. A
|
|
1648
|
+
`Link` with `underline` at its default `true` gets the spec's inline/external recipe (1px at 55%
|
|
1649
|
+
of the text colour, thickening to 2px at full colour on hover, held through `:active`) on every
|
|
1650
|
+
variant; `underline: false` restores the old standalone-only shape — no underline at rest, 1px
|
|
1651
|
+
appearing on hover, 2px on `:active` — for a navigation bar whose own design removes it. The same
|
|
1652
|
+
decision reaches three other places that render a link-shaped affordance without going through
|
|
1653
|
+
`Link` itself, all updated alongside it: `Breadcrumb`'s trail links (`linkClass` — see that
|
|
1654
|
+
component's own Deviations entry below) and the stretched title links `ContentCard`, `FeatureCard`
|
|
1655
|
+
and `ProductCard` build from `stretchedLink.ts` (underlined at rest now, thickening on hover via
|
|
1656
|
+
the card root's `group`, not only on hover as the spec's own States rows read — see
|
|
1657
|
+
`stretchedLink.ts`'s own comment and each component's `titleLinkClass`/`linkClass`). `LogoItem`'s
|
|
1658
|
+
link and `Rating`'s linked variant were reviewed and intentionally left as they were — see the
|
|
1659
|
+
`LogoItem` Deviations entry above for why.
|
|
1660
|
+
- **`Link` has no `externalIcon` prop and no `@tabler/icons-vue` runtime dependency.** The arrow and
|
|
1661
|
+
external-link icons are both fixed by the spec's anatomy, not swappable the way `Button`'s
|
|
1662
|
+
`iconLeft`/`iconRight` are, so both are inline `<svg>`s using Tabler's own published path data —
|
|
1663
|
+
the same shape as `Button`'s spinner — keeping `@tabler/icons-vue` a devDependency only, matching
|
|
1664
|
+
this package's documented runtime dependencies (no icon library among them).
|
|
1665
|
+
- **`Link`'s `rel` is `"noopener noreferrer"`**, one step past the spec text's own `rel="noopener"`
|
|
1666
|
+
(every section of the spec that mentions it says just `noopener`) — the more defensive value, and
|
|
1667
|
+
the resolution given for this exact ambiguity when the component was built.
|
|
1668
|
+
- **`Link`'s `as` accepts a router-link component, not only a tag name.** With `href` set and `as` a
|
|
1669
|
+
component (`NuxtLink`, `RouterLink`), the component receives `to` instead of `href`, matching
|
|
1670
|
+
those components' own prop contract; with `as` a plain string it stays a tag (or custom element)
|
|
1671
|
+
that still receives `href`. With no `href` at all, `as` is ignored and the component always
|
|
1672
|
+
renders a plain `<span>` — there is no destination to route through.
|
|
1673
|
+
- **`Input`'s mobile 1rem override applies to `md` only.** The shared "Actions and forms" rule
|
|
1674
|
+
states it without qualification, but the spec's own Sizes table marks it only on the `md` row
|
|
1675
|
+
(`sm` stays 0.875rem, `lg` is already 1rem) — the more specific statement wins. Consequence worth
|
|
1676
|
+
knowing: an `sm` `Input` still zooms on focus on iOS, because 0.875rem is under the 16px browsers
|
|
1677
|
+
use as the no-zoom threshold.
|
|
1678
|
+
- **`Input`'s clear button is 1.5rem on `sm`, not the spec's 2rem.** The spec fixes the trailing
|
|
1679
|
+
action's size in the `md` row only ("2rem square at 0.25rem"); a 2rem button does not fit a 2rem
|
|
1680
|
+
`sm` field with a 0.25rem inset, so `sm` uses 1.5rem — still above the 2.5.8 touch-target minimum
|
|
1681
|
+
— with matching end padding. `md` and `lg` keep the spec's 2rem.
|
|
1682
|
+
- **`Input`'s `suffix` slot and the clear button share one end-anchored row**, `data-part="suffix"`,
|
|
1683
|
+
rather than two independently positioned elements. This keeps both on one row at any size and
|
|
1684
|
+
gives the keyboard table's "`Tab` reaches the clear button next" order for free, since the row
|
|
1685
|
+
follows the input in DOM order. One rough edge: the input's end padding is the spec's 2.5rem
|
|
1686
|
+
whether one trailing item or two is present, so a wide `suffix` plus the clear button can let a
|
|
1687
|
+
long value run underneath — measuring the slot would need JavaScript and is not in the spec.
|
|
1688
|
+
- **`Input`'s `clearable`/`invalid`/`required`/`describedBy` default to `undefined`, not `false`.**
|
|
1689
|
+
They fall back to a `FieldWrapper`'s context when there is one, and `false` there would be an
|
|
1690
|
+
answer rather than "no opinion". (`describedBy` **composes** with the context rather than
|
|
1691
|
+
replacing it — see [Fields](#fields-the-context-a-fieldwrapper-provides).) `readonly` and `disabled` have no context source and default to
|
|
1692
|
+
`false` as usual. The clear button is additionally hidden on a disabled or read-only field.
|
|
1693
|
+
- **`Textarea` has no `help`/slot forwarding into a `FieldWrapper`'s foot row.** `FieldWrapper` owns
|
|
1694
|
+
its _own_, independent `foot`/`counter` parts (see its Deviation below); `Textarea`'s own
|
|
1695
|
+
`foot`/`counter` exist purely for standalone use, matching `Input`'s precedent of being fully
|
|
1696
|
+
functional without a wrapper. A consumer composing `FieldWrapper` + `Textarea` uses one counter or
|
|
1697
|
+
the other, never both.
|
|
1698
|
+
- **`Textarea`'s `hardLimit` sets native `maxlength` only when `hardLimit` is true**, never merely
|
|
1699
|
+
because `maxLength` is present — `counter` and `hardLimit` are independent props, and the spec's
|
|
1700
|
+
documented default lets typing continue past a soft `counter` limit.
|
|
1701
|
+
- **`FormLayout` `statusMessage` and its status region.** The spec's Form layout States table ends
|
|
1702
|
+
with "Success: replace the form with a confirmation message (newsletter) or navigate (checkout),
|
|
1703
|
+
**and announce it in a polite live region**", and its acceptance criteria repeat it — but the
|
|
1704
|
+
properties table has nothing to announce _with_. So `FormLayout` always renders a visually hidden
|
|
1705
|
+
`role="status"` / `aria-live="polite"` paragraph (`data-part="status"`), fed by a
|
|
1706
|
+
`statusMessage?: string` prop. Always in the DOM, because a live region added to the page at the
|
|
1707
|
+
same moment as its text is not reliably announced; empty until there is something to say. The
|
|
1708
|
+
_visible_ confirmation is still the page's job.
|
|
1709
|
+
- **`FormLayout` `headingLevel`.** The spec calls the form's heading "h4 style", which names the
|
|
1710
|
+
type style (1.125rem, 600), not the outline level. The element is an `<h2>` by default — the
|
|
1711
|
+
level a form's own title takes under a page's `<h1>` — and `headingLevel?: 2 | 3 | 4` lets a form
|
|
1712
|
+
nested under a page's own `<h3>` avoid skipping a level. The type style never changes.
|
|
1713
|
+
- **`FieldWrapper` `aria-describedby` order.** The spec writes
|
|
1714
|
+
`aria-describedby="<error-id> <help-id> <counter-id>"`; only the ids that actually render are
|
|
1715
|
+
emitted, so a field with no help never points at an element that is not there.
|
|
1716
|
+
- **`FieldWrapper` slots are content.** `<template #error>` and `<template #help>` are richer ways
|
|
1717
|
+
of writing the `error` and `help` props (a message with a link in it, say), so a field with an
|
|
1718
|
+
`error` _slot_ is invalid and linked exactly as one with the prop is.
|
|
1719
|
+
- **`Checkbox` `describedBy`.** The spec's Checkbox property table has no way to point at an
|
|
1720
|
+
error, but its Accessibility notes require one ("Required consent: `required`,
|
|
1721
|
+
`aria-invalid="true"` and `aria-describedby` pointing to an error that says what to do"). So
|
|
1722
|
+
`Checkbox` takes `describedBy?: string`, exactly as `Input` and `Textarea` do, and composes it
|
|
1723
|
+
with a `FieldWrapper`'s context when there is one (own id first — see
|
|
1724
|
+
[Fields](#fields-the-context-a-fieldwrapper-provides)).
|
|
1725
|
+
- **`Checkbox`'s hint is part of the accessible name.** The spec's anatomy puts the hint "inside
|
|
1726
|
+
the label", and a `<label>`'s whole text is the control's name — so a box with a hint is
|
|
1727
|
+
announced as "Washed linen Pre-softened, will not shrink further". That is the spec's own
|
|
1728
|
+
structure, kept rather than swapped for an `aria-describedby` that would read the same words a
|
|
1729
|
+
beat later. It is also what makes the hint part of the click target.
|
|
1730
|
+
- **`CheckboxGroup`'s error is the group's, not each option's.** `error` puts `aria-invalid="true"`
|
|
1731
|
+
and the `aria-describedby` link on the `<fieldset>`; the individual boxes keep their ordinary
|
|
1732
|
+
boundary. The spec's own 2px `danger` box is written against the **required consent** case (a
|
|
1733
|
+
single `Checkbox` with `invalid`), and repeating "invalid" on every one of five options is noise
|
|
1734
|
+
rather than information. This matches `FieldWrapper`'s `group` variant, which reads the same way.
|
|
1735
|
+
- **A `Checkbox` inside a `FieldWrapper` drops its own `<label>`.** A `Checkbox` is normally a
|
|
1736
|
+
`<label>` wrapping its box and text, which is what makes the whole row the click target. A plain
|
|
1737
|
+
`FieldWrapper` renders a `<label for>` naming the same control, and one control with two labels
|
|
1738
|
+
is `form-field-multiple-labels` and an accessible name assembled out of both — so the box reads
|
|
1739
|
+
`FieldContext.labelsControl` and renders a `<span>` root instead, letting the wrapper's label
|
|
1740
|
+
name it. The drawn box stays clickable because the control covers it rather than being `sr-only`
|
|
1741
|
+
in a corner of it. A box with an `id` of its own keeps its label either way: the wrapper's `for`
|
|
1742
|
+
can no longer reach it.
|
|
1743
|
+
- **The spec's "Single consent" variant is `<FieldWrapper group>`.** The consent sentence belongs
|
|
1744
|
+
_beside_ the box, as its own label — so the wrapper must not be the thing labelling it. `group`
|
|
1745
|
+
gives a `<fieldset>` named by a `<legend>`, which labels nothing in particular, and contributes
|
|
1746
|
+
the error row and the `aria-describedby`/`aria-invalid` wiring. A control inside a group also
|
|
1747
|
+
leaves the context `id` alone, because that id is the fieldset's own.
|
|
1748
|
+
- **A `CheckboxGroup` is not put inside a `FieldWrapper` at all.** It draws its own `<fieldset>`
|
|
1749
|
+
and `<legend>` — the spec's group anatomy — so a `FieldWrapper` with `group` set around it nests
|
|
1750
|
+
a second fieldset and legend around the first. Use the group on its own.
|
|
1751
|
+
- **An invalid box that is checked keeps its `primary` fill.** The spec's States table gives the
|
|
1752
|
+
error row a `background` fill, but that row describes the _unchecked_ required-consent box. The
|
|
1753
|
+
mark is `primary-contrast`, so keeping `background` under a tick would draw the tick in the
|
|
1754
|
+
page's own colour and lose it — and "checked differs by fill and tick shape, not only colour"
|
|
1755
|
+
has to stay true in every state. An invalid marked box is `primary` fill plus the 2px `danger`
|
|
1756
|
+
boundary.
|
|
1757
|
+
- **`RadioGroup`'s error reaches the radios, unlike `CheckboxGroup`'s.** The spec's Radio group
|
|
1758
|
+
property table says `error` "sets `aria-invalid="true"` on the radios" (plural) — unlike
|
|
1759
|
+
`CheckboxGroup`, whose own error stays on the `<fieldset>` alone (see the `CheckboxGroup`
|
|
1760
|
+
deviation above). Both are followed as written: `RadioGroup`'s `aria-describedby` still links the
|
|
1761
|
+
fieldset to the message, and `aria-invalid` is additionally set on every radio.
|
|
1762
|
+
- **`RadioGroup`'s `size` is plain-layout only.** The spec's own property table scopes it: "Radio
|
|
1763
|
+
1.125rem or 1.5rem (**plain layouts**)". A card's radio is always the `md` circle, whichever size
|
|
1764
|
+
the caller asked for.
|
|
1765
|
+
- **The radio circle reuses `Checkbox`'s border-width utilities.** The spec gives it the identical
|
|
1766
|
+
numbers (1.5px, 2px in error) as the Checkbox box, so `eldra-checkbox-border`/`-invalid` are
|
|
1767
|
+
shared rather than duplicated as `eldra-radio-*`. The **card** itself is a different element with
|
|
1768
|
+
its own 1px number, so it gets `eldra-radio-card-border` of its own.
|
|
1769
|
+
- **A card's selected boundary is a real border plus an inset line**, the same technique
|
|
1770
|
+
`eldra-field-invalid` uses for a field's error state: the spec spells it out ("2px `primary` (1px
|
|
1771
|
+
border + 1px inset line)"), so growing the real border to 2px — which would shift the card's
|
|
1772
|
+
neighbours — is not what it asks for. `eldra-radio-card-selected` reads
|
|
1773
|
+
`--eldra-radio-card-selected-color` so the same utility draws the `danger` version too, for a
|
|
1774
|
+
selected option that is also in the group's error (no dedicated spec row; read the same way an
|
|
1775
|
+
invalid checked `Checkbox` is — see that deviation above).
|
|
1776
|
+
- **`RadioGroup`'s `label`, `hint` and `meta` are scoped slots as well as `option` fields**
|
|
1777
|
+
(`#label="{ option }"`, and so on), since the group is built from a data array rather than
|
|
1778
|
+
written-out children — richer content than plain text needs somewhere to go.
|
|
1779
|
+
- **`Switch` inside a `FieldWrapper`.** The spec never discusses a Switch inside a field wrapper at
|
|
1780
|
+
all (a Switch commits immediately; it is not submitted with a form), but the task named this
|
|
1781
|
+
wiring explicitly. It mirrors `Checkbox`'s `labelsControl`: a plain wrapper's `<label for>` names
|
|
1782
|
+
the button, so the switch drops its own `label` part and takes the wrapper's id. Unlike
|
|
1783
|
+
`Checkbox`, the root element never changes tag — it is always the `<button>` — only the inner
|
|
1784
|
+
label `<span>` is skipped, so the wrapper's visible text is not rendered twice.
|
|
1785
|
+
- **`Switch`'s description is `aria-hidden` inside the button, not a sibling.** The spec's anatomy
|
|
1786
|
+
diagram draws the description on its own line below the track, with an arrow to
|
|
1787
|
+
"`← description (aria-describedby)`", and its numbered list says the button holds "the track and
|
|
1788
|
+
the label" — label only. So the description renders inside the button's own content (which is
|
|
1789
|
+
what lets a two-column CSS grid, the same shape `Checkbox` uses, put it directly under the label
|
|
1790
|
+
for free) but is marked `aria-hidden="true"`, keeping it out of the button's accessible _name_
|
|
1791
|
+
while `aria-describedby` still exposes it as the _description_ — browsers read an
|
|
1792
|
+
`aria-describedby` target regardless of `aria-hidden` on that target, the standard technique for
|
|
1793
|
+
a description that must not double as the name.
|
|
1794
|
+
- **`Switch`'s hidden mirror `<input type="checkbox">` cannot live inside the button.** `<button>`'s
|
|
1795
|
+
content model forbids interactive descendants, and an `<input>` is interactive content
|
|
1796
|
+
regardless of the `hidden` attribute (that attribute doesn't change what category an element
|
|
1797
|
+
belongs to). So the component's template has two top-level nodes — the button and the hidden
|
|
1798
|
+
input as its sibling — a plain Vue 3 fragment, not a new wrapping element.
|
|
1799
|
+
- **`Switch`'s track and thumb each carry their own transition.** The spec's Behaviour & motion
|
|
1800
|
+
section asks for both: "The thumb slides _and the track fills_ over `duration-fast` with
|
|
1801
|
+
`ease-out`." Neither element carries `eldra-focus` (that sits on the button), so — exactly like
|
|
1802
|
+
Link's arrow — each may carry its own `transition-*`/`duration-fast` utility with a
|
|
1803
|
+
`motion-reduce:transition-none` fallback.
|
|
1804
|
+
- **`Select` is `modelValue`, not `value`.** The spec's property table names the two-way value
|
|
1805
|
+
`value`; every other control in this package takes `modelValue` with `update:modelValue`, which
|
|
1806
|
+
is what `v-model` binds, so `Select` matches them. The spec's own `change` and `clear` events are
|
|
1807
|
+
emitted exactly as written, alongside `open`, `close` and `search`.
|
|
1808
|
+
- **`Select`'s `optionIcon` part.** The spec's anatomy numbers the parts and then describes an
|
|
1809
|
+
option's contents in prose ("swatch, icon, label + hint, meta, check"), so the icon has no
|
|
1810
|
+
numbered name. It is a part all the same, and the _trigger_ reuses `optionSwatch` and
|
|
1811
|
+
`optionIcon` for the chosen option's mark — "an option's swatch" is styled once wherever it
|
|
1812
|
+
appears, rather than once in the list and again in the trigger.
|
|
1813
|
+
- **`Select`'s empty state is a sibling of the listbox, not a child.** A `role="listbox"` may own
|
|
1814
|
+
only `option` and `group` children, so "No matches for “…”" inside one is an
|
|
1815
|
+
`aria-required-children` violation. The listbox itself still renders when nothing matches (an
|
|
1816
|
+
empty one is merely "needs review"), because `aria-controls` is a _required_ property of
|
|
1817
|
+
`role="combobox"` and needs something real to point at while the popup is showing. The trigger
|
|
1818
|
+
carries `aria-controls` when it is closed too, as ARIA 1.2 asks; axe treats a collapsed
|
|
1819
|
+
combobox's reference to a not-yet-rendered popup as "needs review", not a violation.
|
|
1820
|
+
- **`Select`'s option rows carry a forced-colours boundary.** The spec draws the active row as a
|
|
1821
|
+
`surface-strong` fill and the selected row as weight 600 plus a check. Forced-colours mode
|
|
1822
|
+
replaces every fill and flattens the weight, so the two utilities `eldra-select-option-active`
|
|
1823
|
+
(a 2px `Highlight` inset outline) and `eldra-select-option-selected` (a 1px `CanvasText` one)
|
|
1824
|
+
apply _only_ there. On a row that is both, the active outline wins — selection is still carried
|
|
1825
|
+
by the check mark beside it.
|
|
1826
|
+
- **`Select`'s `noMatchesFor` message.** The spec asks for the empty state to read
|
|
1827
|
+
"No matches for “teal”" — the query is part of the string — and the message catalogue had only
|
|
1828
|
+
`noResults`. Both are used: `noResults` with no query, `noMatchesFor(query)` with one.
|
|
1829
|
+
- **`Select`'s clear button is named `aria-label` + `aria-labelledby`.** The spec wants
|
|
1830
|
+
"Clear Country", and the component does not know the label's text — only its id. So the button
|
|
1831
|
+
carries `aria-label="Clear"` and, inside a `FieldWrapper`, an `aria-labelledby` of
|
|
1832
|
+
`"<its own id> <the label's id>"`, which the platform resolves to "Clear Country". On its own it
|
|
1833
|
+
keeps the plain `aria-label`.
|
|
1834
|
+
- **`Select` distinguishes a label's forwarded click from a real one.** "Clicking the Field
|
|
1835
|
+
wrapper's label focuses the trigger (it doesn't open it)" — but a `<label for>` naming a
|
|
1836
|
+
`<button>` forwards its click to it, and a forwarded click is otherwise indistinguishable from a
|
|
1837
|
+
real one. The trigger therefore opens only for a click with a pointer press behind it (or a
|
|
1838
|
+
non-zero `detail`) — a press that ends anywhere but the trigger releases the latch, so a drag off
|
|
1839
|
+
the control cannot arm the next click — and focuses without opening otherwise. The cost: a programmatic
|
|
1840
|
+
`element.click()` focuses rather than opens. Keyboard activation never goes through a click at
|
|
1841
|
+
all, because `useListbox` consumes `Enter` and `Space` itself.
|
|
1842
|
+
- **`Select`'s `disabled` is the native `disabled` attribute.** The spec writes the state as
|
|
1843
|
+
`tabindex="-1"` plus `aria-disabled="true"`; a real `<button disabled>` is already unfocusable
|
|
1844
|
+
and inert, so the component uses it and adds `aria-disabled="true"` beside it rather than
|
|
1845
|
+
hand-rolling the tab behaviour.
|
|
1846
|
+
- **`Select`'s `required` reaches the hidden native `<select>`, as the spec asks.** That is what
|
|
1847
|
+
makes the placeholder "invalid on submit if required" without scripting. Be aware of the
|
|
1848
|
+
consequence in a browser: a `hidden` control that fails constraint validation cannot be focused
|
|
1849
|
+
to report the problem, so the form is blocked and the browser logs it rather than showing a
|
|
1850
|
+
bubble. Pair it with the `FieldWrapper`'s own `error` for a visible message.
|
|
1851
|
+
- **`Select`'s `placement` is read once.** `useFloating`'s options are not reactive (see
|
|
1852
|
+
[Composables](#composables)), so a select that has to change placement at runtime needs a `:key`
|
|
1853
|
+
change. It is a layout decision — "the footer's selectors use `above`" — not state.
|
|
1854
|
+
- **The popover panels are teleported, and positioned against the viewport** (operator decision,
|
|
1855
|
+
2026-09-25). They used to be rendered in place, positioned absolutely inside the component's own
|
|
1856
|
+
root, on the strength of the spec's own "Don't place a select inside a container that clips
|
|
1857
|
+
overflow" — a rule a store owner cannot be asked to hold, since the container is usually a card
|
|
1858
|
+
or a sticky header they did not write. `Select`, `MultiSelect` and `SearchBar` now render their
|
|
1859
|
+
panel through a `<Teleport>` to `body` (or to the modal `<dialog>` the control sits in) with
|
|
1860
|
+
floating-ui's `fixed` strategy. `data-part` and `classes` still reach it — both are on the
|
|
1861
|
+
element — but a descendant selector rooted above the control does not, custom properties set on
|
|
1862
|
+
a wrapper are no longer inherited, and the panel is no longer in document order after its
|
|
1863
|
+
trigger, so the `Tab` walk into it is `usePopover`'s `tabRedirect` rather than the browser's.
|
|
1864
|
+
[Layering](#layering) has the whole list, including why that redirect is not a focus trap and
|
|
1865
|
+
what a teleport target of your own has to avoid. `teleport: false` restores the old shape.
|
|
1866
|
+
- **`MultiSelect`'s parts include the footer's.** The API contract's part list stops at the tags; the
|
|
1867
|
+
spec's anatomy draws a footer ("live count · Clear (link button) · Done (primary sm)") and its
|
|
1868
|
+
acceptance criteria test it, so `footer`, `footerCount`, `footerClear` and `footerDone` are parts
|
|
1869
|
+
as well. `optionCheck` is reused for an option's **checkbox** — it is the mark that says a row is
|
|
1870
|
+
chosen in both controls, so a consumer styles it once — and the footer's two buttons are real
|
|
1871
|
+
`Button`s whose `data-part` is the multi-select's rather than `Button`'s own `container`.
|
|
1872
|
+
- **`MultiSelect`'s placeholder default is the spec's `"Any"`** (`is-IS`: `"Allt"`), not
|
|
1873
|
+
`"Select options"`. New messages with it: `selected` ("Selected", which names the tag list beside
|
|
1874
|
+
the field's own label), `selectedCount(n)` ("4 selected"), `noneSelected` and `done`.
|
|
1875
|
+
- **`MultiSelect`'s clear button belongs to the popover while it is open.** It carries
|
|
1876
|
+
`data-eldra-overlay-owner="<the panel's id>"`, which is how `useOverlay` recognises a part of an
|
|
1877
|
+
overlay that is not inside its content element, so focus or a pointer press landing on it does
|
|
1878
|
+
not close the popover — and it is why the button is still in the `Tab` walk the spec's table
|
|
1879
|
+
describes ("from the search field (or the trigger) to the footer's Clear, then Done, with the
|
|
1880
|
+
popover still open") now that the panel is teleported out of DOM order. `usePopover`'s
|
|
1881
|
+
`tabRedirect` reads that attribute to find the control's **last** tab stop and redirects only
|
|
1882
|
+
there, so the browser still walks trigger → clear button itself and the walk continues
|
|
1883
|
+
clear button → footer Clear → Done, and back the same way (see [Layering](#layering)).
|
|
1884
|
+
- **`Backspace` in a `MultiSelect`'s empty search field removes the last tag.** Not in the spec's
|
|
1885
|
+
keyboard table — it is the convention every chip input follows — and it is guarded on the query
|
|
1886
|
+
being empty, so it never eats a character the user meant to delete.
|
|
1887
|
+
- **A `MultiSelect` value with no option of its own is dropped** from the summary, the tags, the
|
|
1888
|
+
count and the hidden native select. It has no label to show and a `<select>` cannot hold it, so
|
|
1889
|
+
showing a count that includes it would make the trigger disagree with the tags underneath it.
|
|
1890
|
+
- **A disabled or read-only `MultiSelect` keeps its tags and drops their remove buttons.** The
|
|
1891
|
+
spec's States table ends a disabled control's row with "clear button hidden", and a read-only one
|
|
1892
|
+
is "the value is readable but fixed" — the tag list _is_ the value made readable, so it stays in
|
|
1893
|
+
both states while the control that would change it goes, exactly as the trigger's clear button
|
|
1894
|
+
already does. Hidden rather than `disabled`: a disabled button stays in the accessibility tree
|
|
1895
|
+
announcing a "Remove Sweaters" action that can never happen.
|
|
1896
|
+
- **`MultiSelect`'s `classes.value` and `classes.native` do nothing.** `value` is a `Select`'s
|
|
1897
|
+
chosen-option row; a multi-select draws `summary` (the labels and the "+N" pill) in its place.
|
|
1898
|
+
`native` marks the hidden native `<select>` with a `data-part` so a test or a form helper can
|
|
1899
|
+
find it, but the element is `hidden` in both controls, so there is nothing for a class to do.
|
|
1900
|
+
Both names stay in the part union so one `classes` object can be handed to either control.
|
|
1901
|
+
- **`MultiSelect`'s `value` slot takes `{ options }`** (the chosen ones, in the order they were
|
|
1902
|
+
chosen) and fills the `summary` part, and the `tag` slot takes `{ option }` and replaces a chip's
|
|
1903
|
+
**label**, leaving its remove button in place — a consumer restyling a chip should not have to
|
|
1904
|
+
rebuild the control that empties it.
|
|
1905
|
+
- **`QuantityStepper`'s field is `type="text"`, not the spec anatomy's literal
|
|
1906
|
+
`<input type="number">`.** A native number input's DOM value can only ever be the US-style,
|
|
1907
|
+
ungrouped floating-point grammar (digits and a single `.`); it cannot hold a locale-grouped
|
|
1908
|
+
string like `is-IS`'s `"1.234"` (`.` as the group separator) — assigning one is either silently
|
|
1909
|
+
rejected by the browser's value-sanitisation algorithm or misread as the decimal `1.234`. The
|
|
1910
|
+
API contract explicitly asks this control to parse a typed value with `parseLocaleNumber`, which
|
|
1911
|
+
only makes sense for text the browser has not already mangled. `inputmode="numeric"` and
|
|
1912
|
+
`role="spinbutton"` with `aria-valuenow`/`-valuemin`/`-valuemax` (the ARIA APG's own pattern for
|
|
1913
|
+
this shape of control) satisfy the spec's 4.1.2 note ("The input exposes its value, min and max
|
|
1914
|
+
natively") through the accessibility tree instead. "No native spin buttons" (the anatomy's own
|
|
1915
|
+
item 3) is satisfied for free: a text input has none to hide.
|
|
1916
|
+
- **`QuantityStepper`'s live region announces its own value, not a cart subtotal.** The spec's
|
|
1917
|
+
exact sentence ("Cart updates are announced in a polite live region near the cart total ...
|
|
1918
|
+
'Quantity updated, subtotal $112.00'") names a subtotal a single, reusable control has no access
|
|
1919
|
+
to — that announcement belongs to whatever composes this control with a cart total. What this
|
|
1920
|
+
component owns and announces once per settled change (never per keystroke) is its own value,
|
|
1921
|
+
via the new `quantityUpdated(n)` message.
|
|
1922
|
+
- **`QuantityStepper`'s group has one perimeter border, not one per part.** The spec's ASCII
|
|
1923
|
+
anatomy draws `┬`/`┴` between the three parts; the reference image shows one continuous
|
|
1924
|
+
boundary, so this is diagram notation, not a drawn divider. `overflow-hidden` on the rounded
|
|
1925
|
+
group is what gives the two outer corners' square first/last children the "inner radius is
|
|
1926
|
+
`radius-md` minus 1px" look the Sizes table asks for, without a literal px.
|
|
1927
|
+
- **`locale` is not part of the design spec's own Properties table for "Quantity stepper"** — the
|
|
1928
|
+
API contract adds it (default `"en-US"`) for display formatting and for parsing a typed value.
|
|
1929
|
+
`src/utils/number-format.ts` (`createNumberFormat`, `formatNumber`, `parseLocaleNumber`) is the
|
|
1930
|
+
general-purpose utility behind it, exported from the package root for use outside this control.
|
|
1931
|
+
- **`VariantPicker`'s sold-out diagonal lines are inline SVG, not CSS-only utilities.** A first
|
|
1932
|
+
attempt drew them with `background-image`/`box-shadow`, which broke two ways under real
|
|
1933
|
+
rendering: the gradient's stripe thickness is measured along the gradient's own diagonal length,
|
|
1934
|
+
so a label-dependent pill width turned the spec's "1px line" into a visibly thick band, and
|
|
1935
|
+
`background-color`/`box-shadow` are exactly the two properties forced-colours mode empties out —
|
|
1936
|
+
the swatch's sold-out line was completely invisible under `forced-colors: active`. An inline
|
|
1937
|
+
`<svg><line stroke="currentColor" vector-effect="non-scaling-stroke"></svg>` fixes both: a
|
|
1938
|
+
constant screen-pixel stroke regardless of the box's aspect ratio, and a stroke remaps under
|
|
1939
|
+
forced colours the same way a real border does.
|
|
1940
|
+
- **`VariantPicker`'s `, sold out` suffix is `messages.soldOut.toLowerCase()`**, not the message
|
|
1941
|
+
verbatim. The shared `soldOut` string is capitalised ("Sold out", used standalone e.g. as a
|
|
1942
|
+
badge); the spec's own inline examples are lower-case mid-sentence ("Clay, sold out"). Assumes
|
|
1943
|
+
`soldOut` has no interior capitals, true for `enUS` and `isIS` today; a future locale needing
|
|
1944
|
+
different mid-sentence casing would want its own message key instead.
|
|
1945
|
+
- **`VariantPicker`'s `name` is used unmodified as the native radio group name**, with no generated
|
|
1946
|
+
fallback — unlike `RadioGroup`, which mints one with `useUiId` when absent. Here `name` is
|
|
1947
|
+
required and always caller-supplied, per the spec's own Properties table ("Used in the legend and
|
|
1948
|
+
as the radio group name"). A page rendering more than one picker sharing an option name (two
|
|
1949
|
+
product cards each with their own "Size") must give each its own `name`
|
|
1950
|
+
(`"size-<productId>"`) — this component does not namespace it — and pass `legend` so the visible
|
|
1951
|
+
(and accessible) name stays "Size" rather than the grouping key.
|
|
1952
|
+
- **`SearchBar`'s panel holds a `listbox` rather than being one.** The spec's Accessibility notes
|
|
1953
|
+
say "The panel is `role="listbox"` named 'Search suggestions'" — but the same section's `none`
|
|
1954
|
+
view puts a title and a line of advice inside that panel, above chips that _are_ options, and a
|
|
1955
|
+
`role="listbox"` may own only `option` and `group` children. So the popup box is
|
|
1956
|
+
`data-part="panel"` and the element that owns the options is `data-part="listbox"` inside it,
|
|
1957
|
+
which is what `aria-controls` points at (and what always renders while the panel shows: a
|
|
1958
|
+
`role="combobox"` must point at something real). The no-results message and the loading rows are
|
|
1959
|
+
its siblings. `Select` solved the same conflict the same way.
|
|
1960
|
+
- **Four parts beyond the API contract's list, all in the spec's own anatomy**: `listbox` (above), `chip`
|
|
1961
|
+
(anatomy item 9), `clearRecent` (the idle view's "Clear recent searches" row) and `liveRegion`
|
|
1962
|
+
(anatomy item 11), plus `itemArrow` for the Sizes table's "Active arrow". A part the component
|
|
1963
|
+
draws and a consumer cannot reach is not a part.
|
|
1964
|
+
- **`SearchBar`'s `select` event carries `(item, type)`**, where `type` is one of the four result
|
|
1965
|
+
types or `"viewAll"`. The spec writes the payload as `{ type, url }` and the API contract as `(item)`;
|
|
1966
|
+
two arguments carry both without making a consumer destructure a synthetic object, and `item`
|
|
1967
|
+
is the same object the `item` slot receives.
|
|
1968
|
+
- **Articles and pages share one group.** The spec's `results` view names three groups — Products
|
|
1969
|
+
(max 4), Collections (max 3), Journal and help (max 3) — while `resultTypes` has four values, so
|
|
1970
|
+
`articles` and `pages` are drawn under one "Journal and help" heading, articles first, with three
|
|
1971
|
+
rows between them. `resultTypes` still filters each of the two independently.
|
|
1972
|
+
- **A row's sub line has nowhere to come from.** The spec's reference image shows a second line
|
|
1973
|
+
under each title ("Knitwear · 4 colours", "Journal · 4 min read") and a `muted` meta on
|
|
1974
|
+
collections ("48 products"), but the `SearchResults` shape this package ships (the API contract's, kept
|
|
1975
|
+
exactly) carries only `title`, `href` and a product's `price`. The `item` slot is how a store
|
|
1976
|
+
draws more; nothing was invented in the type.
|
|
1977
|
+
- **An idle panel with nothing in it does not open.** The spec says the panel opens on focus, and
|
|
1978
|
+
that neither the recent nor the popular list shows when it is empty — which together would leave
|
|
1979
|
+
an empty box under the field. `aria-expanded` stays `false` until there is something to show.
|
|
1980
|
+
- **The `none` view waits for a first response.** The spec's `none` view is "Query **without
|
|
1981
|
+
matches**" — an answer from the shop — so it is not drawn while `results` is still `undefined`,
|
|
1982
|
+
or a shopper typing "m" would be told there is nothing called "m" while the request for it is
|
|
1983
|
+
still in flight. Until the first response arrives the panel shows nothing at all; after 300ms the
|
|
1984
|
+
loading view takes over, exactly as the spec's own `loading` row says.
|
|
1985
|
+
- **One search bar on a page answers `/`.** The spec says the shortcut focuses "the header search",
|
|
1986
|
+
singular, but every instance listens on `document`. `src/components/search-bar/shortcutOwner.ts`
|
|
1987
|
+
is a module-level claim queue (the same shape as the select family's `openRegistry`): the first
|
|
1988
|
+
instance mounted with `shortcut` on owns the key, the others stand behind it, and an unmount — or
|
|
1989
|
+
a `shortcut` prop turned off — hands it to the next in line. Ownership is read at keystroke time,
|
|
1990
|
+
so nothing has to re-render for it to change hands.
|
|
1991
|
+
- **`resultsCount` and `viewAllResults` take the query as an optional second argument.** The spec
|
|
1992
|
+
names it in both sentences — "4 results for mer", "See all 12 results for “mer”" — while the same
|
|
1993
|
+
two messages are also used where there is no query to name (a filtered list's count, the Search
|
|
1994
|
+
modal's own "See all n results" row), so the query is optional rather than required: with it the
|
|
1995
|
+
message reads the spec's sentence, without it the plain count. One wording delta is left, because
|
|
1996
|
+
the catalogue is shared: the popular heading is `popularSearches` ("Popular searches", not the
|
|
1997
|
+
spec's "Popular right now"), which a store overrides through `messages`. New messages beside
|
|
1998
|
+
them: `noResultsFor(query)`, `searchSuggestions`, `searchProducts`, `searchCollections`,
|
|
1999
|
+
`searchJournal` and `searchAdvice`; `clearRecent` is now the spec's own "Clear recent searches"
|
|
2000
|
+
and `viewAllResults` its "See all", which `is-IS` already said.
|
|
2001
|
+
- **`SearchBar` writes the recent-search history itself** when `recent` is not given: on submit and
|
|
2002
|
+
on a followed row (not on every keystroke), most recent first, deduplicated without regard to
|
|
2003
|
+
case, capped at 5, and wrapped so a storage that refuses leaves the list in memory for that page
|
|
2004
|
+
only. A consumer that supplies `recent` owns the storage behind it and has `submit`/`select` to
|
|
2005
|
+
write from; nothing is written over their list.
|
|
2006
|
+
- **The `/` hint carries `messages.shortcutHint` as its `title`.** The visible chip is the spec's
|
|
2007
|
+
bare `/` and is `aria-hidden`, so the full sentence ("Press / to search") has nowhere to be
|
|
2008
|
+
announced; it is the chip's tooltip, and the field carries `aria-keyshortcuts="/"`.
|
|
2009
|
+
- **A row's active arrow is not animated.** The spec's Sizes table only says "visible only on the
|
|
2010
|
+
active row"; the package's own Motion conventions give hover/colour changes `duration-fast`, and
|
|
2011
|
+
other components carry their own `transition-*` for a similarly momentary reveal (Link's arrow,
|
|
2012
|
+
Switch's thumb and track) — but here `itemArrow` is a plain `v-if="isActive(row)"`, so the arrow
|
|
2013
|
+
appears and disappears with the row's active state, not a fade. Nothing in the spec's own text
|
|
2014
|
+
for this component asks for a transition; additive if wanted.
|
|
2015
|
+
- **`SearchBar`'s results panel shares the select family's "only one open at a time" registry.**
|
|
2016
|
+
It opens through `usePopover` (see [Composables](#composables)), the same composable `Select` and
|
|
2017
|
+
`MultiSelect` use, so opening a search bar's panel closes an open select's panel and vice versa —
|
|
2018
|
+
not only another search bar's. The spec discusses this only within the Select family; extending
|
|
2019
|
+
the one registry to `SearchBar` was a judgement call for a page that can show both at once,
|
|
2020
|
+
rather than a second, uncoordinated registry.
|
|
2021
|
+
- **`FieldCheckboxGroup` — an eleventh `Field*`, beyond the design spec's list of ten.** The spec
|
|
2022
|
+
names `FieldCheckbox` and `FieldRadioGroup` but no group checkbox, which would have left
|
|
2023
|
+
`CheckboxGroup` as the only form control the root entry exports with no way to validate it
|
|
2024
|
+
through this entry — while its exact peer, `RadioGroup`, has one. `FieldCheckbox` is therefore
|
|
2025
|
+
the spec's single **boolean** consent box (no `type: 'checkbox'` array mode), and
|
|
2026
|
+
`FieldCheckboxGroup` is the array question beside it. Additive: no name in the spec changed.
|
|
2027
|
+
- **A `Field*` never reads the error back to its `FieldWrapper`; the `Form` hands it down.** The
|
|
2028
|
+
wrapper is in the root entry and cannot know about vee-validate, and a control cannot write to
|
|
2029
|
+
the wrapper that provides its context — so `Form`'s default slot carries `errors`, keyed by field
|
|
2030
|
+
`name`, and the wrapper is bound to it (`:error="errors.email"`). It carries only the messages
|
|
2031
|
+
that should currently show, on the same "touched, or the form has been submitted" gate each
|
|
2032
|
+
`Field*` puts on its own `aria-invalid`, so the two cannot disagree.
|
|
2033
|
+
- **`Form` adds `successMessage`, which is not in the spec's Form layout property table.** The
|
|
2034
|
+
spec's Success state asks for the confirmation to be "announced in a polite live region", and
|
|
2035
|
+
`FormLayout` already has that region (`statusMessage`) — `successMessage` is simply the half a
|
|
2036
|
+
form component can own: it fills the region once a submit passes validation. The visible half —
|
|
2037
|
+
replacing the form or navigating — stays the page's. An explicit `statusMessage` wins over it.
|
|
2038
|
+
- **A server error shows immediately, without waiting for a blur or a submit.** The display gate
|
|
2039
|
+
above exists so a rule message does not appear under a half-typed value; an `apiErrors` entry is
|
|
2040
|
+
the answer to a submit that has already happened, so there is nothing left to wait for — and a
|
|
2041
|
+
form rendered with errors from an earlier round trip would otherwise show none of them.
|
|
2042
|
+
- **`FieldSearchBar` takes neither an `id` nor a `name` from the field.** A `SearchBar` sets its
|
|
2043
|
+
own id after its attribute fall-through and its native field is always `q`, because its form
|
|
2044
|
+
posts to the Search page. So the field's `name` is its validation path only, and an error summary
|
|
2045
|
+
lists it as text rather than linking to an id that would not exist.
|
|
2046
|
+
- **`path` on every `Field*`, for the one control that needs it.** The design spec's contract says
|
|
2047
|
+
a `Field*` "takes `name` and `rules`". That holds wherever `name` is the native form field name,
|
|
2048
|
+
but a `VariantPicker`'s `name` is also its **visible** legend (unless `legend` overrides it), so
|
|
2049
|
+
one `name` would have had to be both the option name a customer reads and the key in `values`.
|
|
2050
|
+
`path` separates them and defaults to `name`, so nothing else in the entry changes shape.
|
|
2051
|
+
- **A `Form` never posts without scripting; `FormLayout` still does.** vee-validate's
|
|
2052
|
+
`handleSubmit` calls `preventDefault()` on the event it is given, so the spec's "The form still
|
|
2053
|
+
posts without scripting" acceptance criterion cannot hold for a form whose whole purpose is to
|
|
2054
|
+
validate in the browser. `action` and `method` are still forwarded (they are `FormLayout`'s
|
|
2055
|
+
props), and the hidden native `<select>` inside every `Select` still carries its value — so a
|
|
2056
|
+
scripting-free post is one `FormLayout` away, without this entry.
|
|
2057
|
+
- **Fields are revalidated while submitting.** The spec's Submitting state says the fields "stay
|
|
2058
|
+
editable but aren't re-validated". vee-validate revalidates on value update regardless of
|
|
2059
|
+
`isSubmitting`, and suppressing that would mean a field edited mid-flight keeping a message that
|
|
2060
|
+
no longer matches its value. The _display_ gate is unchanged, so nothing new appears while the
|
|
2061
|
+
customer is mid-word.
|
|
2062
|
+
- **A `group` `FieldWrapper` renders `tabindex="-1"` on its `<fieldset>`.** Not in the spec's
|
|
2063
|
+
anatomy; it is what makes an error summary's link land. A group has no single control, so the
|
|
2064
|
+
summary points `#<id>` at the fieldset itself, and a browser moves focus to a fragment's target
|
|
2065
|
+
only when that target can take focus. `-1` keeps it out of the tab order. Programmatic focus
|
|
2066
|
+
(`FormLayout`'s own, and the `Form`'s) still prefers the first focusable control inside it.
|
|
2067
|
+
- **`FormLayout` gained `focusOnInvalid` (default `true`).** Not in the spec's property table. The
|
|
2068
|
+
`Form` in this entry validates asynchronously, so it has to own the focus move on a failed submit
|
|
2069
|
+
— on the first attempt nothing is marked `aria-invalid` yet for the layout to find. Without a way
|
|
2070
|
+
to turn the layout's own move off, a later refused submit would move focus twice.
|
|
2071
|
+
- **`StockBadge`'s four level icons are inline SVG path data, not an `icon` prop and not a runtime
|
|
2072
|
+
`@tabler/icons-vue` dependency** (operator decision). The spec fixes both the colour and
|
|
2073
|
+
the icon per level ("`in` = `success` + circle-check", and so on), so there is nothing for a
|
|
2074
|
+
consumer to choose; the `<path>` data for `circle-check`/`alert-triangle`/`circle-x`/`clock` is
|
|
2075
|
+
copied from that package's outline set (MIT licensed) the same way `Button`'s spinner is a
|
|
2076
|
+
hand-written SVG rather than a dependency on an icon package for one shape.
|
|
2077
|
+
- **`Badge`'s `outline` replaces the tone's fill entirely, rather than combining with it.** The
|
|
2078
|
+
spec's States table (`Badge` → States) gives `outline` exactly one row — `background` fill,
|
|
2079
|
+
1px inset `border-strong`, `text` text and icon — independent of `tone`/`variant`; there is no
|
|
2080
|
+
"outline danger" or "outline sale" row. So `outline: true` always renders that one boundary
|
|
2081
|
+
treatment, whatever `tone` or `variant` is also set, which is also why the icon-required dev
|
|
2082
|
+
warning still checks the underlying `tone` rather than the rendered colour: an outlined
|
|
2083
|
+
`danger` badge still needs its icon, even though outline hides the red fill.
|
|
2084
|
+
- **`Badge`'s `icon` prop takes an `IconComponent`, not the spec's `icon: string | null`.** Every
|
|
2085
|
+
icon prop in this package takes a Vue component rather than a name string (see `IconComponent`'s
|
|
2086
|
+
own doc comment) — `Button.iconLeft`/`iconRight`/`icon`, and now `Badge.icon` — so a consumer
|
|
2087
|
+
never depends on this package shipping or naming an icon set. `StockBadge`'s four level icons
|
|
2088
|
+
are the one exception, and are built in for the reason above.
|
|
2089
|
+
- **`Rating`'s linked accessible name reuses the static `messages.rating(value, count)` sentence**
|
|
2090
|
+
(operator decision), rather than the spec's separately worded linked hidden text ("the link
|
|
2091
|
+
text is the visible value + '128 reviews' + visually hidden ', rated 4.5 out of 5'"). The scope
|
|
2092
|
+
deliberately limits the new message vocabulary to exactly `rating` and `noReviews`; setting the
|
|
2093
|
+
same tested sentence as the `<a>`'s own `aria-label` — with the visible value/count marked
|
|
2094
|
+
`aria-hidden` in both forms — honours that budget and gives every screen reader one unambiguous
|
|
2095
|
+
name instead of two overlapping fragments, at the cost of not reproducing the spec's exact
|
|
2096
|
+
count-first wording for the linked form.
|
|
2097
|
+
- **`Rating`'s linked variant wraps its content in a second element, `<a data-part="link">`,
|
|
2098
|
+
rather than `root` itself becoming the anchor** (the way `Badge`/`Link`'s `as` swaps their own
|
|
2099
|
+
root tag). `root` stays a plain, always-present wrapper; the standard focus ring is drawn on it
|
|
2100
|
+
via the proxy-focus pattern (`eldra-focus-proxy`, `:has(:focus-visible)` — `Checkbox`'s and
|
|
2101
|
+
`VariantPicker`'s own technique) rather than on the `<a>` directly, which keeps the ring's box —
|
|
2102
|
+
and the 2.5.8 1.5rem minimum — `root`'s own predictable layout box regardless of what tag `as`
|
|
2103
|
+
renders, instead of depending on an inline `<a>`'s content-fitted focus box. Matches the design
|
|
2104
|
+
spec's own reference image, whose "Focus-visible (linked)" panel draws the ring around the whole
|
|
2105
|
+
rating, stars included, not just the link text.
|
|
2106
|
+
- **`Rating` adds one message beyond the API contract's named two (`rating`, `noReviews`):
|
|
2107
|
+
`reviewCount(n)`.** The spec's Anatomy names the linked variant's visible count text verbatim —
|
|
2108
|
+
"'(128)' on cards; '128 reviews' underlined when linked" — and the card form's `"(128)"` is a
|
|
2109
|
+
literal parenthesised number with no word to translate, but the linked form's "128 reviews" is a
|
|
2110
|
+
real, pluralised English/Icelandic sentence fragment. The Global Constraints require every piece
|
|
2111
|
+
of text a component renders itself to come from `useMessages()`, so that fragment needed its own
|
|
2112
|
+
key rather than a hand-written literal.
|
|
2113
|
+
- **`Rating`'s empty-star outline stroke is 1.75**, the same weight `Link`'s arrow/external icons
|
|
2114
|
+
use — the spec's Sizes table gives no number for it, and 1.75 is the closest existing "outline
|
|
2115
|
+
icon" precedent in this package (`StockBadge`'s icons, by contrast, are solid shapes with no
|
|
2116
|
+
stroke weight to match).
|
|
2117
|
+
- **`Rating` ignores `href` while `count` is `0`.** The spec's Linked variant assumes there are
|
|
2118
|
+
reviews to jump to, and the no-reviews state has its own `emptyAction` slot for an interactive
|
|
2119
|
+
link — wrapping that slot's content in a rating-wide `<a>` the moment a consumer used it would
|
|
2120
|
+
nest an `<a>` inside an `<a>`, invalid HTML that silently strips the inner link's own semantics.
|
|
2121
|
+
- **Trailing action pairs are 1.5rem wide with no gap** (operator report, 2026-09-25). A
|
|
2122
|
+
`UnitInput`/`CurrencyInput` with `clearable` and the drag handle both showing drew each action a
|
|
2123
|
+
full 2rem square with a 1px gap between them, so the two icons ended up roughly 1.1rem apart — far
|
|
2124
|
+
wider than any other icon pair in the library. With two of the field's own trailing actions
|
|
2125
|
+
present, the row now carries no gap and each action shrinks to `w-6` (1.5rem, still the WCAG
|
|
2126
|
+
2.5.8 24px minimum) at the row's own height, and the control's end padding grows to fit both. A
|
|
2127
|
+
single action (`Input`, `SearchBar`, and `UnitInput`/`CurrencyInput` with only one of clear/drag
|
|
2128
|
+
showing) is unchanged. The recipes are data in `src/components/input/classes.ts`
|
|
2129
|
+
(`FIELD_TRAILING_PAD_PAIR`, `FIELD_ACTION_PAIR_SIZE`), and `UnitInput` picks them by counting how
|
|
2130
|
+
many of its own actions are showing — never by the presence of a caller's `suffix` slot, whose
|
|
2131
|
+
width this package does not control.
|
|
2132
|
+
- **Every enabled button is `cursor: pointer`, overriding Tailwind's preflight default** (operator
|
|
2133
|
+
report, 2026-09-25: "all buttons should have cursor-pointer"). Tailwind v4's preflight sets
|
|
2134
|
+
`button { cursor: default }`, so nothing in the library showed a pointer unless a component said
|
|
2135
|
+
otherwise. Every live `Button` variant, the `Input`/`SearchBar`/`UnitInput` clear buttons, a live
|
|
2136
|
+
`QuantityStepper` +/- button, a live `Select`/`MultiSelect` trigger and clear button, a
|
|
2137
|
+
`MultiSelect` tag's remove button, and `Switch` now carry `cursor-pointer`; a disabled or
|
|
2138
|
+
read-only control keeps whatever cursor it already had (`cursor-not-allowed`, `cursor-progress`,
|
|
2139
|
+
or `Select`/`MultiSelect`'s read-only `cursor-default`), and the `UnitInput` drag handle keeps its
|
|
2140
|
+
own `cursor-ns-resize`. `Link` needed nothing — an `<a>` is a pointer already.
|
|
2141
|
+
- **The starter's `UiImage` is a thin wrapper over `Image`, not a replacement** (decision, 2026-09-25;
|
|
2142
|
+
the plan's own wording said "replace `UiImage`"). `Image` must stay standalone of
|
|
2143
|
+
`@eldrajs/theme-vue` (this package never depends on a theme package), but the starter's
|
|
2144
|
+
`examples/starter-nuxt/app/components/ui/UiImage.vue` carries Studio's preview-overlay framing
|
|
2145
|
+
contract — `imageFramingAttrs`/`imageFramingStyle` from `@eldrajs/theme-vue`, `entryId`/
|
|
2146
|
+
`fieldPath` for the overlay's interactive framing controls — which `Image` must not know about.
|
|
2147
|
+
So `UiImage` keeps its old prop names (`src`, `alt`, `framing`, `entryId`, `fieldPath`, `aspect`,
|
|
2148
|
+
`sizes`, `priority`, so every block under `examples/starter-nuxt/blocks/*` needed no change) and
|
|
2149
|
+
renders `Image` underneath: `framing.{x,y}` (0–1 fractions) map to `Image`'s `focal` (0–100
|
|
2150
|
+
percent), `framing.zoom` passes straight through, and `aspect` (`"16/9"`-style strings) maps to
|
|
2151
|
+
`Image`'s six `ImageRatio` presets, falling back to an inline `aspect-ratio` style on the root
|
|
2152
|
+
for anything else. `Image` recomputes `object-position`/`transform`/`transform-origin` from
|
|
2153
|
+
`focal`/`zoom` itself (the same clamped-transform-origin formula `imageFramingStyle` uses — see
|
|
2154
|
+
`Image.vue`'s own `focalBand`/`clampToFocalBand` comment), so the rendered style is
|
|
2155
|
+
byte-identical to the old hand-rolled version; `examples/starter-nuxt/test/framing.spec.ts`
|
|
2156
|
+
(asserting on the `Hero`/`Image` blocks' actual rendered `<img>`) needed no change. Only
|
|
2157
|
+
`imageFramingAttrs`' `data-eldra-framing*` marker attributes forward from `UiImage` to `Image`,
|
|
2158
|
+
never that helper's own `style` — `Image`'s attribute-forwarding rule (below) puts a caller's
|
|
2159
|
+
`style` on the root, not the media element, and `Image` already derives an equivalent style from
|
|
2160
|
+
`focal`/`zoom`. `class`/`style` passed to `UiImage` land on `Image`'s root (the figure/frame
|
|
2161
|
+
wrapper) rather than the `<img>` itself.
|
|
2162
|
+
- **Fix (2026-09-25): `UiImage` gained `rounded`/`fill`/`fit`/`classes`,
|
|
2163
|
+
and every block that needs a radius, a background fill, or an uncropped view was updated to use
|
|
2164
|
+
them.** The entry above claimed a block's leftover `rounded-*`/`object-cover`/`object-contain`
|
|
2165
|
+
class was now merely "redundant" once `class`/`style` moved to `Image`'s root — that was wrong. `Image`'s `frame` (not its root) is the part with
|
|
2166
|
+
`overflow-hidden`, so a `rounded-*` class stuck on the root clipped nothing and every rounded
|
|
2167
|
+
corner in the starter went square; the hero's `image-background` variant's
|
|
2168
|
+
`class="absolute inset-0 h-full w-full object-cover"` landed on the root too, but with no
|
|
2169
|
+
`aspect`/dimensions the frame it wraps had no definite height for that `h-full` to resolve
|
|
2170
|
+
against, so the background image stopped covering the section. Caught in review, not by any
|
|
2171
|
+
test — nothing exercised a legacy Tailwind radius/object-fit class against `Image`'s actual
|
|
2172
|
+
clip/cover contract, and only the packaged Storybook stories were re-baselined, never the
|
|
2173
|
+
starter's own rendered blocks. Fixed with four additions to `UiImage`, all optional and all
|
|
2174
|
+
mapped onto `Image`'s own `classes` prop (never onto `class`/`style`, which stay `Image`'s root):
|
|
2175
|
+
- **`rounded`** (`'none' | 'lg' | 'xl'`, default `'none'`) forwards straight to `Image`'s own
|
|
2176
|
+
`rounded` prop.
|
|
2177
|
+
- **`fill`** (`boolean`, default `false`) is for a background image that has to cover its
|
|
2178
|
+
positioned ancestor: `ratio="auto"` plus `absolute inset-0 h-full w-full` on `classes.root` and
|
|
2179
|
+
`h-full w-full` on `classes.frame`, so the frame's height comes from the ancestor via the
|
|
2180
|
+
`inset-0`/`h-full` chain instead of needing `media.width`/`height` (which this wrapper never
|
|
2181
|
+
has). Used by the hero block's `image-background` variant.
|
|
2182
|
+
- **`fit`** (`'cover' | 'contain'`, default `'cover'`) maps to `classes.media`, for a lightbox-
|
|
2183
|
+
style full view that must never crop. Used by the gallery block's lightbox, alongside
|
|
2184
|
+
`classes.frame: 'max-h-[85vh]'` for the height cap that used to sit on the `<img>` directly.
|
|
2185
|
+
(`fit="contain"`'s own class set was incomplete at first — see the "Second fix" entry below.)
|
|
2186
|
+
- **`classes`** passes straight through to `Image`'s own `classes` prop (merged with whatever
|
|
2187
|
+
`rounded`/`fill`/`fit` set, caller's value always wins) — the escape hatch for a radius `Image`
|
|
2188
|
+
has no preset for (`rounded-full` on the testimonials avatars, `rounded-md` on
|
|
2189
|
+
gallery/feature-grid thumbnails, neither of which is one of `Image`'s two presets).
|
|
2190
|
+
Regression coverage: a `[data-part="frame"]` radius assertion per affected block (`hero`,
|
|
2191
|
+
`gallery`, `feature-grid`, `testimonials`, `image`), a hero test asserting the `fill` classes and
|
|
2192
|
+
the resulting `aspect-ratio: auto` on the background variant, a gallery test asserting the
|
|
2193
|
+
lightbox's `object-contain`/`max-h-[85vh]`, and a `UiImage.spec.ts` contract test per prop with
|
|
2194
|
+
mutation checks (break the mapping, watch the test fail, restore).
|
|
2195
|
+
- **`AvatarGroup` has no `size` prop; every avatar in a group renders `sm`** (2rem). The API
|
|
2196
|
+
contract's own `AvatarGroupProps` type gives it none, and the spec's anatomy diagram shows a
|
|
2197
|
+
compact stacked row rather than naming a size — `sm` is the smallest of the four, the fit for a
|
|
2198
|
+
row of up to four overlapping circles plus a "+N" counter, distinct from the single `lg` avatars
|
|
2199
|
+
the spec shows elsewhere (a testimonial byline, a journal author card). A consumer who wants a
|
|
2200
|
+
different size restyles through `classes.item`/`classes.more` (both take the `size-*` group, so
|
|
2201
|
+
a replacement diameter also has to update the initials text size alongside it).
|
|
2202
|
+
- **`AvatarGroup`'s `max` is clamped to 0–3, whatever is passed, with a dev-only warning when it
|
|
2203
|
+
had to clamp** (the warning: final review, plan 2). The spec's Avatar section gives `max` a
|
|
2204
|
+
default of `3` and, separately, an unconditional acceptance criterion: "Groups never show more
|
|
2205
|
+
than four circles in total." Those two only agree if `max` itself never exceeds `3` — three
|
|
2206
|
+
avatars plus one "+N" counter — so the prop is clamped rather than trusted, and a caller who
|
|
2207
|
+
passes `max="10"` still sees at most four circles; the warning matches the same
|
|
2208
|
+
dev-only-when-overriding-a-caller convention `Badge`/`Button`/`Chip`/`Image`/`Price`/`Section`
|
|
2209
|
+
already use.
|
|
2210
|
+
- **`AvatarGroup`'s accessible sentence strips `Intl.ListFormat`'s own Oxford comma** (API contract:
|
|
2211
|
+
"Icelandic list joining: use `Intl.ListFormat` with the message locale where available"). Node's
|
|
2212
|
+
(and every major browser's) English "long conjunction" CLDR pattern joins three or more items as
|
|
2213
|
+
"a, b, and c", but the spec's own example — `aria-label="Makers: Ingrid, Tomas, Maya and 4
|
|
2214
|
+
more"` — has no comma before "and". Icelandic's own pattern already has no such comma, so its
|
|
2215
|
+
output needed no change; `src/utils/listFormat.ts#formatConjunctionList` keeps
|
|
2216
|
+
`Intl.ListFormat`'s locale-correct word, order and pluralisation and removes only that one
|
|
2217
|
+
separator (via `formatToParts`, not a regex over the whole rendered string), with a hand-written
|
|
2218
|
+
`", "`/`" and "`/`" og "` join as the fallback for a runtime with no `Intl.ListFormat` at all.
|
|
2219
|
+
- **`LogoItem` always renders a real `<li>`, and `root` moves to whichever element is the actual
|
|
2220
|
+
cell.** The spec's own anatomy already says this ("Cell: a centred grid cell (`<li>`, or an `<a>`
|
|
2221
|
+
inside the `<li>` when linked)"), but it is worth spelling out because every other component's
|
|
2222
|
+
`root` is a single element that never moves: `<ul role="list">` only reads as a list to
|
|
2223
|
+
assistive tech when its children are real `<li>`s (a bare `<a>` gets no implicit `listitem` role,
|
|
2224
|
+
and `<a>` is not valid content of `<ul>` at all), so unlike `Link`'s span/`a` swap, `LogoItem`
|
|
2225
|
+
cannot collapse the wrapper away. Unlinked, the `<li>` itself carries `data-part="root"` and the
|
|
2226
|
+
cell's own box. Linked, the box (and the `eldra-focus` ring — 2.5.8 needs the _target_ itself at
|
|
2227
|
+
least 4rem tall, not just a gutter around it) moves to the `<a>`/`as` cell, and the outer `<li>`
|
|
2228
|
+
is bare — no class list, no `data-part`, nothing `classes` can reach, because it carries nothing
|
|
2229
|
+
visual to restyle. `classes.root` always reaches the one element that is actually the cell,
|
|
2230
|
+
whichever tag that turns out to be.
|
|
2231
|
+
- **No `external` prop; whether the hidden link context appears is judged from `href` itself.**
|
|
2232
|
+
`LogoItemProps` (the API contract) has no `external` boolean the way `LinkProps` does, but the spec's
|
|
2233
|
+
own default for `linkContext` is conditional on the href — `" (stockist site)"` "when `href` is
|
|
2234
|
+
external" — so the component has to decide this on its own. `isExternalHref` in `LogoItem.vue`
|
|
2235
|
+
treats an absolute URL (a scheme like `https:`, or a protocol-relative `//`) as external and
|
|
2236
|
+
everything else (a root-relative path, a hash, a query) as on-site; a caller who knows better
|
|
2237
|
+
still overrides the judgement entirely with an explicit `linkContext` (including `''`, to
|
|
2238
|
+
deliberately suppress it on an otherwise-external href).
|
|
2239
|
+
- **`LogoItem`'s wordmark reuses three type tokens across two different styles rather than
|
|
2240
|
+
introducing a fourth.** The spec's wordmark is "heading family, 1.25rem, weight 700,
|
|
2241
|
+
line-height 1.15, letter-spacing −0.01em" — no single shared type style matches, but `h1`/`h2`'s
|
|
2242
|
+
weight (700), `h2`'s line-height (1.15) and `h3`'s tracking (−0.01em) each individually do, so
|
|
2243
|
+
`text-logo-wordmark` (`tailwind.css`) reads those three tokens directly and only the 1.25rem size
|
|
2244
|
+
is a new component variable (`--eldra-logo-wordmark-size`) with a literal default — the same
|
|
2245
|
+
"reuse what matches, one new variable for what doesn't" shape `text-card-title`/`text-stepper-value`
|
|
2246
|
+
already use, just spread across two donor styles instead of one.
|
|
2247
|
+
- **`LogoItem`'s link stays without an underline, even after the operator's "all link elements are
|
|
2248
|
+
underlined" decision below (`Link`, `Breadcrumb`, card titles).** Reviewed as part of that same
|
|
2249
|
+
change and deliberately left alone: the linked cell's own text is the greyscale/wordmark brand
|
|
2250
|
+
mark or an image, not a run of body copy — underlining a wordmark reads as a broken heading, not
|
|
2251
|
+
a link affordance, and the cell's non-colour affordance is already its own hover/focus treatment
|
|
2252
|
+
(opacity rising to 100%, the `eldra-focus` ring, the 4rem target) rather than a text decoration.
|
|
2253
|
+
`Rating`'s linked variant needed no change either: its `count` text ("128 reviews") was already
|
|
2254
|
+
underlined at rest before this task (`decoration-1 decoration-current/55`), not hover-gated.
|
|
2255
|
+
- **Second fix (2026-09-25): the navigation logo dropped `UiImage` entirely, and
|
|
2256
|
+
`fit="contain"` now also shrink-wraps the frame.** Two findings the first fix left open:
|
|
2257
|
+
- **The navigation block's logo was still routed through `UiImage`** with a bare
|
|
2258
|
+
`class="h-8 w-auto"`, the exact class-lands-on-the-root problem the first pass fixed everywhere else —
|
|
2259
|
+
missed because the first fix's own scope named five blocks and not this one. The logo is not a
|
|
2260
|
+
CMS-framed image at all (no `framing`, no `entryId`/`fieldPath`), so it no longer goes through
|
|
2261
|
+
`UiImage`: `blocks/navigation/Block.vue` now renders a plain
|
|
2262
|
+
`<img :src="data.logo.url" :alt="data.brand" class="h-8 w-auto" loading="eager"
|
|
2263
|
+
decoding="async">`, the same shape the rest of the starter's un-framed images already use.
|
|
2264
|
+
- **`fit="contain"` only changed `object-fit`, and `Image`'s `frame` is unconditionally
|
|
2265
|
+
`w-full overflow-hidden`.** A portrait image under `h-full w-full` still computes its box from
|
|
2266
|
+
the frame's full _width_, scaled by its own intrinsic ratio; once that scaled height passes a
|
|
2267
|
+
height cap on the frame (the lightbox's `max-h-[85vh]`), the frame's `overflow-hidden` **clips**
|
|
2268
|
+
it — the opposite of "contain". `fit="contain"` now also shrink-wraps the frame itself
|
|
2269
|
+
(`classes.frame` gains `w-auto max-w-full`, composed with any caller frame classes) and gives
|
|
2270
|
+
the media both a width and a height constraint together, not just an unconstrained
|
|
2271
|
+
`object-contain`: `classes.media` becomes `object-contain h-auto w-auto max-w-full
|
|
2272
|
+
max-h-[inherit]` — `max-h-[inherit]` reads the _frame's_ own `max-height` back onto the media,
|
|
2273
|
+
so the browser scales the image down to fit inside both caps at once, the same thing the
|
|
2274
|
+
original bare `<img class="max-h-[85vh] w-auto object-contain">` did by being the frame itself.
|
|
2275
|
+
Confirmed `max-h-[inherit]` compiles as a valid Tailwind v4 arbitrary value (built CSS contains
|
|
2276
|
+
`.max-h-\[inherit\]{max-height:inherit}`).
|
|
2277
|
+
Regression coverage: a navigation test asserting the logo `<img>` carries `h-8 w-auto` directly
|
|
2278
|
+
with no `[data-part]` wrapper; `UiImage.spec.ts` tests asserting the exact `contain` class set on
|
|
2279
|
+
both `frame` and `media` (and that `cover` is unchanged); a gallery lightbox test asserting the
|
|
2280
|
+
same on the actual rendered block. All four with mutation checks against the wiring itself (not
|
|
2281
|
+
just `UiImage` in isolation): reverting the navigation block's `<img>` back to `UiImage`, and
|
|
2282
|
+
disabling either half of `contain`'s class additions, each turns the corresponding new test red.
|
|
2283
|
+
- **`EmptyState`'s default icon is chosen per `variant`, not left unset.** The spec's Properties
|
|
2284
|
+
table gives `icon` a default of "per use" rather than naming one, but a consumer using the
|
|
2285
|
+
component with no icon at all still needs a decorative circle rather than an empty one —
|
|
2286
|
+
`empty`/`noResults`/`error` draw a built-in inbox, magnifying glass and warning triangle
|
|
2287
|
+
respectively (Tabler `inbox`/`search`/`alert-triangle` outline path data, copied the same way
|
|
2288
|
+
`StockBadge`'s icons are), at the spec's 1.75rem / 1.5 stroke. A caller's own `icon` always wins.
|
|
2289
|
+
- **`empty`/`noResults` render no `actions` row at all until a caller supplies the `actions`
|
|
2290
|
+
slot; `error` alone gets a generic built-in one ("Try again").** The spec's own examples for the
|
|
2291
|
+
first two ("Shop bestsellers", "Clear filters", "Browse all knitwear") are all store-specific —
|
|
2292
|
+
this package has no way to know what a store's bestsellers collection is called — so there is no
|
|
2293
|
+
generic default to fall back to. "Try again" is the one action every failed fetch shares, so
|
|
2294
|
+
`error` is the only variant with a built-in default (see `EmptyState.vue`'s own comment).
|
|
2295
|
+
- **`EmptyState`'s built-in "Try again" button label is a new `tryAgain` message key**
|
|
2296
|
+
(`src/messages/en-US.ts`/`is-IS.ts`), not part of the API contract's own message vocabulary. It is
|
|
2297
|
+
chrome this component renders itself (spec → Default copy, "Try again"), the same category as
|
|
2298
|
+
every other message key here, so it goes through `useMessages()` like the rest rather than being
|
|
2299
|
+
hard-coded English.
|
|
2300
|
+
- **`EditorPlaceholder`'s icon renders through the shared `Icon` component (1.5rem, exactly
|
|
2301
|
+
`Icon`'s `lg`), while `EmptyState`'s own icon (1.75rem, 1.5 stroke — neither of which matches
|
|
2302
|
+
any of `Icon`'s four sizes or its fixed 1.75 stroke) is hand-drawn**, the same split `Badge`
|
|
2303
|
+
(hand-drawn) versus every other icon-taking component (via `Icon`) already establishes.
|
|
2304
|
+
- **`ProductCard`'s media-corner "Sold out" is a plain outline `Badge`, not `StockBadge`.** The
|
|
2305
|
+
API contract's own framing ("a sale/new Badge and a StockBadge stack in the media corner")
|
|
2306
|
+
reads as though both components land there, but the design spec's anatomy line is explicit
|
|
2307
|
+
("Badge stack ... Badge sale / new / outline 'Sold out'") and its States table describes the
|
|
2308
|
+
sold-out badge as "inset 1px `border-strong`" — exactly `Badge`'s own `outline` recipe
|
|
2309
|
+
(`bg-background text-text border-border-strong`), which `StockBadge` has no equivalent of (it
|
|
2310
|
+
is bare inline text and an icon, no fill or border at all). The corner stack is therefore
|
|
2311
|
+
`Badge :outline`, matching the spec's literal styling; `StockBadge` composes elsewhere (next
|
|
2312
|
+
bullet), which is what gives the API contract's "Composes ... Badge/StockBadge ..." line a real,
|
|
2313
|
+
distinct component for each half.
|
|
2314
|
+
- **`ProductCardProduct.stock` and the `stockLine` part are an addition beyond the spec's own
|
|
2315
|
+
8-part anatomy.** The anatomy diagram draws no stock-status row at all, but the API contract's own
|
|
2316
|
+
`ProductCardProduct` type carries a `stock?: StockLevel | null` field distinct from
|
|
2317
|
+
`available`, and composing `StockBadge` needed a real use beyond the outline "Sold out" badge
|
|
2318
|
+
above (which is `Badge`, not `StockBadge` — see the previous bullet). When `stock` is set (and
|
|
2319
|
+
the product is not sold out, where the disabled quick-add button already carries the same
|
|
2320
|
+
meaning), a `StockBadge` status line renders above quick add, in the position most storefront
|
|
2321
|
+
cards put a "Only 3 left" line. Omit `stock` for a card that should render exactly the spec's
|
|
2322
|
+
own anatomy with nothing extra.
|
|
2323
|
+
- **The sold-out quick-add control is a disabled `Button`, not `StockBadge`.** Same reasoning as
|
|
2324
|
+
the corner badge: the spec's States table describes it as "`muted` on `surface-strong`, no
|
|
2325
|
+
border" — `Button`'s own `outline` variant's `DISABLED` recipe
|
|
2326
|
+
(`bg-surface-strong text-muted border-transparent`) verbatim — and its Accessibility section
|
|
2327
|
+
says sold out reads "the words 'Sold out' on **badge and button**", naming two separate
|
|
2328
|
+
elements. A disabled `<button>` (not `StockBadge`, which renders no button at all) is what
|
|
2329
|
+
keeps it out of the tab order natively, with no `tabindex` bookkeeping.
|
|
2330
|
+
- **The quick-add button's accessible name is one whole-sentence function message
|
|
2331
|
+
(`messages.quickAdd(title)`), applied as an explicit `aria-label`, not the visible "Quick add"
|
|
2332
|
+
text plus the raw title glued on as visually hidden content.** The spec's own English
|
|
2333
|
+
description ("'Quick add' + hidden ' Merino crew sweater'") is content-splicing shaped, and
|
|
2334
|
+
that shape was tried first — but Icelandic's natural phrasing puts the product name in the
|
|
2335
|
+
_middle_ of the sentence ("Setja {title} í körfu"), which splicing a fixed visible prefix with
|
|
2336
|
+
a trailing hidden suffix cannot express for every locale, only English's own word order. The
|
|
2337
|
+
whole sentence is therefore one catalogue entry (`quickAdd`, new in both `en-US`/`is-IS`) a
|
|
2338
|
+
locale can reorder freely, and it replaces `Button`'s own (otherwise absent, for a plain
|
|
2339
|
+
outline button) `aria-label` via ordinary Vue attribute fallthrough — confirmed empirically
|
|
2340
|
+
against this exact component (a fallthrough `aria-label` on `<Button>` overrides its own
|
|
2341
|
+
computed one) before relying on it, since `Button` only turns its `label` prop into
|
|
2342
|
+
`aria-label` for `iconOnly`/`loading` buttons. The _visible_ button text stays the spec's own
|
|
2343
|
+
"Quick add" (`messages.quickAddLabel`), a separate, non-parametrised catalogue entry.
|
|
2344
|
+
- **The hover zoom scales from the image's centre, not its authored focal point.** The spec says
|
|
2345
|
+
the zoom scales "from the image's focal point", which `Image`'s own `focal`/`zoom` props exist
|
|
2346
|
+
for — but they drive a _static_ crop, not a `:hover` transition, and `ProductCardProduct` (the
|
|
2347
|
+
API contract's own type) carries no per-image focal data for the card to read. The hover scale is
|
|
2348
|
+
a plain `group-hover:scale-[1.03]` CSS transform with the default `transform-origin: center`,
|
|
2349
|
+
which only matters visually for an image whose subject sits noticeably off-centre.
|
|
2350
|
+
- **`ProductCard`'s loading state renders a `<div role="group">`, not `<article role="group">`.**
|
|
2351
|
+
The spec's own Loading row asks for `role="group"` on "the card", but the ARIA-in-HTML
|
|
2352
|
+
allowed-roles table does not permit `group` on `<article>` (axe's `aria-allowed-role` rule
|
|
2353
|
+
catches it), and there is no article content to justify the tag while loading anyway — the
|
|
2354
|
+
element itself changes for that one state rather than fighting an invalid role onto `<article>`.
|
|
2355
|
+
`ContentCard`'s own loading state follows the same pattern (final review, plan 2): a `<div
|
|
2356
|
+
role="group" aria-busy aria-label="messages.loading">`, not the `<article>` its loaded state
|
|
2357
|
+
renders, so a loading card is always a named busy region rather than an unlabelled one.
|
|
2358
|
+
- **`ProductCard` wraps `Price`/`Rating`/`StockBadge` in their own `<div data-part="…">`, the same
|
|
2359
|
+
convention it already used for `Image`'s `media` wrapper** (final review, plan 2). Passing
|
|
2360
|
+
`data-part`/`class` straight through as fallthrough attributes on those three components
|
|
2361
|
+
replaced, rather than supplemented, each one's own `data-part="root"` — Vue applies fallthrough
|
|
2362
|
+
attributes after a child's own template bindings, so `<Price data-part="price">` left the
|
|
2363
|
+
rendered element with `data-part="price"`, not `"root"`, and no way to select
|
|
2364
|
+
`[data-part="price"] [data-part="root"]`. The wrapper keeps both: `ProductCard`'s own part name
|
|
2365
|
+
on the wrapper `<div>`, the composed child's full part tree intact inside it.
|
|
2366
|
+
- **The sale/new badge is suppressed while sold out, even if both are set on the same product.**
|
|
2367
|
+
`Badge`'s own acceptance criterion ("a third badge is never rendered") and the spec's own
|
|
2368
|
+
sold-out States row name only the outline "Sold out" badge, so `ProductCard` trusts `available`
|
|
2369
|
+
over `badge` when they conflict rather than stacking both.
|
|
2370
|
+
- **The sale badge's percentage is derived from `price`, independently of what set `badgeKind`,
|
|
2371
|
+
and renders no badge at all when that derivation finds no real discount** (the second half,
|
|
2372
|
+
final review, plan 2). `ProductCardProduct.badge` is the caller's own sale/new _decision_ (the
|
|
2373
|
+
spec's "derived automatically ... when tagged `new`" needs a tag vocabulary this type does not
|
|
2374
|
+
carry, so presence is trusted rather than re-derived) — but its rounded percentage text ("−20%")
|
|
2375
|
+
still comes from `price.amount`/`price.compareAt` via the same `compareAt > amount` rule
|
|
2376
|
+
`Price`'s own `isSale` uses, so the badge and the price never disagree about whether there is a
|
|
2377
|
+
discount. A caller passing `badge: { variant: 'sale' }` with no (or an equal/lower) `compareAt`
|
|
2378
|
+
previously still rendered a fabricated "−0%"; `discountPercent > 0` is now also a condition of
|
|
2379
|
+
showing the sale badge at all, not only of what number it prints.
|
|
2380
|
+
- **`Dialog`'s close button "moves down 1px" active state (spec "Dialog" → States) is a 2%
|
|
2381
|
+
`scale-[0.98]`, not a 1px translate — the same substitution `Button`'s own press state made
|
|
2382
|
+
(operator decision, 2026-09-25).** A 1px move reads as a rendering artefact rather than a press,
|
|
2383
|
+
and `src/__tests__/source-scan.spec.ts` fails the shipped stylesheet on any `active:` translate,
|
|
2384
|
+
`top`, or `margin-top` utility for exactly that reason — first caught here when this component's
|
|
2385
|
+
literal reading of the spec's own words tripped that guard.
|
|
2386
|
+
- **`Dialog`'s `close` event reason for a plain external close (a parent sets `modelValue` to
|
|
2387
|
+
`false` directly, through neither the close button, a backdrop click, nor the exposed
|
|
2388
|
+
`close(value)`) reads `"programmatic"`.** The spec names four reasons (`"escape"`, `"backdrop"`,
|
|
2389
|
+
`"button"`, an action value) and does not name this fifth route at all; `useDialog`'s own
|
|
2390
|
+
`hide()` calls the native `.close('programmatic')` for it. An earlier revision called the
|
|
2391
|
+
argument-less `.close()` instead, which per the HTML `close(returnValue)` steps leaves
|
|
2392
|
+
`returnValue` at whatever the _previous_ close set it to, so a consumer that closed once via the
|
|
2393
|
+
close button and later closed again through `v-model` read a stale `"button"` for a close that
|
|
2394
|
+
was not one — `"programmatic"` is both a distinct, honest fifth reason and a reset on every route
|
|
2395
|
+
through `hide()`. `Drawer` and `SearchModal` inherit the same reason through `useDialog`.
|
|
2396
|
+
- **Modal stacking is now allowed** (operator override, 2026-09-26, superseding the design spec's
|
|
2397
|
+
own shared modal rule "Never stack two modals" — every other rule in that section stays). The
|
|
2398
|
+
operator's own report: "we should allow modals to open inside of a modal, but Esc / click outside
|
|
2399
|
+
etc. must only close the topmost modal" — a cart `Drawer`'s "Remove" opening a confirm `Dialog` on
|
|
2400
|
+
top of it (`Drawer`'s `StackedConfirm` story) is exactly this. `src/composables/dialogStack.ts`
|
|
2401
|
+
changed from a single module-level slot that refused a second `showModal()` outright to a stack: a
|
|
2402
|
+
dialog opening while others are already open is pushed on top and left there, no refusal, no dev
|
|
2403
|
+
warning — the ones underneath stay open, simply no longer the top. `Esc` and a backdrop click act
|
|
2404
|
+
only on the topmost entry (`useDialog`'s own `isTop`, now "top of stack" rather than "the only
|
|
2405
|
+
entry"); a lower dialog ignores both, even one dispatched directly at it in a test, which real
|
|
2406
|
+
top-layer stacking would never route there in a browser. Closing the top returns focus to whatever
|
|
2407
|
+
was focused in the modal underneath (the same per-instance `opener` capture `useDialog` always
|
|
2408
|
+
had, unchanged — a modal opened from inside another one simply captures that other one's currently
|
|
2409
|
+
focused control as its own opener, for free). The scroll lock is held while the stack is
|
|
2410
|
+
non-empty, released only once every open modal has closed; `TOAST_HOST_KEY` tracks the topmost
|
|
2411
|
+
dialog, following it down as each closes. `docs/ui.md`'s "never stacking two" line and its
|
|
2412
|
+
Drawer entry's "one-modal-at-a-time slot" wording are updated to match; the design spec's own
|
|
2413
|
+
words are left as written (the spec is the historical record the override departs from, not
|
|
2414
|
+
something this package edits).
|
|
2415
|
+
- **`TOAST_HOST_KEY` (`src/composables/dialogStack.ts`) is a plain `Ref<HTMLDialogElement |
|
|
2416
|
+
null>`, not a Vue `InjectionKey`, despite matching this package's `*_KEY` naming convention for
|
|
2417
|
+
`provide`/`inject` pairs (`FIELD_KEY`, `MESSAGES_KEY`, `CHIP_GROUP_KEY`, …).** A `Toaster` is
|
|
2418
|
+
expected to mount once near an app's root — a sibling of whatever page content opens a `Dialog`
|
|
2419
|
+
elsewhere in the tree — and `provide`/`inject` only ever connects a provider to its own
|
|
2420
|
+
descendants, never to a sibling. The module-level `Ref` both `useDialog` (writer) and `Toaster`
|
|
2421
|
+
(reader) import directly is the same hand-off shape `usePopover`'s own `topLayerDialog()` already
|
|
2422
|
+
relies on to teleport a panel into a modal dialog it did not render. See the Composables section
|
|
2423
|
+
above and the constant's own doc comment for the full reasoning.
|
|
2424
|
+
- **`Dialog` exposes `close`/`isTop` via `defineExpose` rather than adding an `actionValue` prop
|
|
2425
|
+
or a dedicated footer-button component.** The spec's `close` event can carry "an action value"
|
|
2426
|
+
(the Confirm variant's "Remove", a form's successful submit), and the anatomy's `footer` is a
|
|
2427
|
+
plain slot the consumer fills with their own buttons — there is no library-owned action button
|
|
2428
|
+
for those buttons to be. A template ref to the `Dialog` (`<Dialog ref="dialogRef">`, then
|
|
2429
|
+
`dialogRef.value.close('remove')` from the consumer's own click handler) is the smallest surface
|
|
2430
|
+
that lets a footer button close with a value of its own, and matches how a native `<dialog>`'s
|
|
2431
|
+
own `.close(returnValue)` already works — no new prop, no new component.
|
|
2432
|
+
- **`Tabs`' spec property named `label` ships as `ariaLabel`.** Package convention, applied
|
|
2433
|
+
consistently everywhere a prop's only job is to name an element for assistive technology
|
|
2434
|
+
(`FormLayout`'s own `ariaLabel`, `ChipGroup`'s `label` predates the convention and is left as
|
|
2435
|
+
is): an accessible-name-only prop is `ariaLabel`, so it reads as what it does rather than
|
|
2436
|
+
colliding, in a reader's head, with a prop that renders visible text — which `Tab`'s own
|
|
2437
|
+
`title` is, following `Button`'s `label`/default-slot pattern.
|
|
2438
|
+
- **`TabPanel` gives `tabindex="0"` only to a panel with no focusable content of its own**, not
|
|
2439
|
+
unconditionally as the spec's own Accessibility line reads literally ("`tabindex="0"`" with no
|
|
2440
|
+
qualifier). This is the ARIA APG tabs pattern's own narrower rule — a panel that already
|
|
2441
|
+
contains a link or a button needs no second stop for the same content — and the API contract
|
|
2442
|
+
names it outright as "the panel focusability rule"; `TabPanel.vue` checks its own rendered DOM
|
|
2443
|
+
for a focusable descendant on mount and after every update.
|
|
2444
|
+
- **`Tab` and the `items` API carry no `disabled`.** The spec's "Tabs" section — Properties,
|
|
2445
|
+
States, Keyboard, Accessibility — never mentions a disabled tab (unlike `RadioGroup`'s or
|
|
2446
|
+
`Select`'s options, which the spec states explicitly), so none is added; a store that needs to
|
|
2447
|
+
keep a tab reachable-but-inert can hide its `Tab` entirely instead, the same way an unlinked
|
|
2448
|
+
`FeatureCard` has no tab stop at all.
|
|
2449
|
+
- **A `Tab`'s own type style reuses `VariantPicker`'s `text-variant-pill` utility**, not a new
|
|
2450
|
+
`text-tab`. The two are the exact same numbers — "0.9375rem … 500 (600 selected)" — and
|
|
2451
|
+
`text-variant-pill` already carries no baked-in weight for the same reason a new one would need
|
|
2452
|
+
none (see that component's own comment): one size, two weights depending on state, which no
|
|
2453
|
+
`font` shorthand can express, so the component pairs it with `font-medium`/`font-semibold`
|
|
2454
|
+
itself. A component reusing a differently-named cross-component utility is unusual enough to
|
|
2455
|
+
call out here rather than leave a reader wondering why `Tab.vue` imports nothing from
|
|
2456
|
+
`variant-picker/`.
|
|
2457
|
+
- **`Accordion`'s panel animates height on expand and collapse, through the Web Animations API, not
|
|
2458
|
+
CSS** (operator override, 2026-09-26: "the accordion should have some expand transition" —
|
|
2459
|
+
supersedes the original "fades, does not animate height" decision below it in earlier versions of
|
|
2460
|
+
this file). The spec's own Behaviour & motion text only asked for a fade ("Panel: fades in over
|
|
2461
|
+
`duration-base` `ease-out` when opened"), and a CSS grid-rows height animation was the original
|
|
2462
|
+
design and was rejected for it: making one work at all requires the panel to stay in the layout
|
|
2463
|
+
while "closed" — collapsed to a zero-height row rather than genuinely hidden — which means
|
|
2464
|
+
overriding the panel's own `display` so the browser's default
|
|
2465
|
+
`details:not([open]) > *:not(summary) { display: none; }` rule (the HTML spec's own UA style)
|
|
2466
|
+
never applies to it, defeating the Accordion acceptance criterion "Find-in-page finds text in
|
|
2467
|
+
closed panels and opens the item" (a `<details>`-specific browser feature keyed to that exact
|
|
2468
|
+
default hiding) to satisfy a different one. `eldra-accordion-panel` (see `tailwind.css`) still
|
|
2469
|
+
only ever touches `opacity` and `display`'s place in the transition list for exactly that reason,
|
|
2470
|
+
and the operator's height animation does not replace it — it runs alongside, entirely in
|
|
2471
|
+
JavaScript, entirely in `src/components/accordion/heightTransition.ts` and
|
|
2472
|
+
`AccordionItem.vue`'s `onToggle`/`onSummaryClick`: `Element.prototype.animate` on the panel
|
|
2473
|
+
element from a measured pixel height (`0` ↔ `scrollHeight`) to the other, which never touches
|
|
2474
|
+
`display` at all, so the find-in-page argument above never applies to it.
|
|
2475
|
+
- **Open** is driven by the native `toggle` event, not the click — the browser has already
|
|
2476
|
+
flipped `open` and revealed the panel by the time `toggle` fires, so `scrollHeight` is already
|
|
2477
|
+
accurate, and keying off `toggle` rather than a click handler is what makes a browser-forced
|
|
2478
|
+
open (find-in-page revealing a match inside a closed panel, `hidden="until-found"`) animate
|
|
2479
|
+
too, with no click ever having happened.
|
|
2480
|
+
- **Close** intercepts the summary's own `click` (`Enter`/`Space` reach it too, converted to a
|
|
2481
|
+
`click` by the browser's own default action) with `preventDefault()`, since the browser's
|
|
2482
|
+
default close action would otherwise remove the panel from layout before any script could
|
|
2483
|
+
measure it. The height animation plays in reverse and only then sets `details.open = false`
|
|
2484
|
+
itself, which is what fires the native `toggle` this component already listens for — the
|
|
2485
|
+
`modelValue`/`update:modelValue`/re-emitted `toggle` contract is completely unchanged, just
|
|
2486
|
+
deferred until the animation settles.
|
|
2487
|
+
- **Reduced motion** (`prefers-reduced-motion: reduce`) is checked the same way
|
|
2488
|
+
`useCarousel`/`Tooltip` do (`prefersReducedMotion()`), independently of `tokens.css` already
|
|
2489
|
+
zeroing `--eldra-duration-base` under the same media query — either one skips the animation.
|
|
2490
|
+
- **Duration and easing are read from the panel's own computed style** at animation time
|
|
2491
|
+
(`--eldra-duration-base`, `--eldra-ease-out` opening / `--eldra-ease-in` closing) rather than a
|
|
2492
|
+
literal number in `heightTransition.ts`, matching this package's "every duration/easing
|
|
2493
|
+
resolves to a token" rule even though this is a JS animation, not a CSS one — a consumer
|
|
2494
|
+
overriding those tokens changes this animation too. There is deliberately no literal fallback:
|
|
2495
|
+
when the variable does not resolve to a usable value at all (no stylesheet loaded — a unit
|
|
2496
|
+
test mounting the component with no CSS pipeline, most likely), the animation is skipped
|
|
2497
|
+
outright, exactly like `Element.prototype.animate` being unavailable.
|
|
2498
|
+
- **The documented gap**: an exclusive-`name` group's sibling that closes because another item
|
|
2499
|
+
opened is not reached through the click-intercept above at all — the browser (or
|
|
2500
|
+
`closeOtherOpenSiblings`'s happy-dom fallback, see below) flips that sibling's `open` directly,
|
|
2501
|
+
with no click of its own to intercept — so it still closes instantly, exactly as it did before
|
|
2502
|
+
this change. Animating that collapse too would mean one `AccordionItem` instance reaching into
|
|
2503
|
+
a sibling's; left as the deliberate trade-off an operator override at this scope calls for,
|
|
2504
|
+
not something left unfinished.
|
|
2505
|
+
- **`AccordionItem`'s open state is `modelValue` (two-way `update:modelValue`), not the spec's own
|
|
2506
|
+
`open`.** Every other stateful control in this package (`Switch`, `Checkbox`, `Select`, …) takes
|
|
2507
|
+
its state through `modelValue`/`v-model`, and `open` would be the one exception with no
|
|
2508
|
+
compensating benefit — a consumer already reaches for `v-model="isOpen"` on every other control
|
|
2509
|
+
here.
|
|
2510
|
+
- **Native same-`name` `<details>` exclusivity is feature-detected, with a JS fallback for an
|
|
2511
|
+
engine that lacks it**, rather than assumed or always re-implemented in script. Every current
|
|
2512
|
+
browser (Chromium, Firefox, Safari) already closes the previously open sibling itself — see
|
|
2513
|
+
`src/components/accordion/detailsExclusivity.ts` — so `AccordionItem.vue` only runs its own
|
|
2514
|
+
`closeOtherOpenSiblings` query when the one-time probe says the platform does not, which is also
|
|
2515
|
+
what makes the package's own test suite exercise that fallback at all: happy-dom implements
|
|
2516
|
+
neither the `name` grouping algorithm nor the `.name` IDL property (a fairly recent HTML
|
|
2517
|
+
addition), so both the probe and the fallback read/write `name` through `getAttribute`/
|
|
2518
|
+
`setAttribute` rather than the property, which is what Vue's own `:name` binding sets in every
|
|
2519
|
+
engine regardless of whether that engine also exposes it as a property.
|
|
2520
|
+
- **`Drawer`'s `label` becomes `ariaLabel`.** The API contract's own prop name is an accessible-name-only
|
|
2521
|
+
prop — it never renders as visible text, it only becomes the `<dialog>`'s `aria-label` when there
|
|
2522
|
+
is no `title` to be `aria-labelledby` instead (the menu drawer) — and this package's own naming
|
|
2523
|
+
rule for that shape is `ariaLabel`, not the bare noun (`title` is reserved for _visible_ text
|
|
2524
|
+
everywhere else in the package). Matches operator decision, 2026-09-25.
|
|
2525
|
+
- **`Drawer`'s full-screen mobile variant is a plain `@media (width < 48rem)` query baked into the
|
|
2526
|
+
`eldra-drawer-width` utility itself, never a `@container` query.** The design spec's own Global
|
|
2527
|
+
Constraints name exactly two rules in the whole spec that measure the **viewport** rather than
|
|
2528
|
+
the enclosing block — form-field text below a 48rem viewport, and "the full-screen variants of
|
|
2529
|
+
Drawer, Lightbox and Search modal" below a 48rem viewport — and this is the second one (operator
|
|
2530
|
+
decision, 2026-09-25). Every other responsive rule in this package measures a container
|
|
2531
|
+
(`@max-tablet`, `@two-col`, …); this one measures the screen a real device has, because a drawer
|
|
2532
|
+
covering "the whole screen" is a statement about the device, not about whatever page-builder
|
|
2533
|
+
column happens to contain it. `48rem` is Tailwind's own `md` breakpoint, the same edge
|
|
2534
|
+
`max-md:text-control-mobile` already measures for the other viewport exception, so the media
|
|
2535
|
+
query is written as literal CSS (`@media (width < 48rem)`, Tailwind v4's own compiled form of
|
|
2536
|
+
`max-md:`) nested inside the `@utility` body rather than a second Tailwind variant class, so a
|
|
2537
|
+
consumer overriding `classes.panel` cannot separate the width clamp from its own mobile
|
|
2538
|
+
exception — the two are one rule together, the same way `eldra-dialog-width`'s viewport clamp is
|
|
2539
|
+
baked into that utility rather than left to a second class.
|
|
2540
|
+
- **`Drawer`'s `width` prop feeds `--eldra-drawer-width` (default `28rem`) with the viewport clamp
|
|
2541
|
+
and the full-screen media query both inside the one `eldra-drawer-width` utility**, the same
|
|
2542
|
+
shape `--eldra-dialog-width` uses for `Dialog`'s own width — a literal per-component variable
|
|
2543
|
+
rather than a token, because the spec's own default sits between two tokens and has none of its
|
|
2544
|
+
own. `Textarea`'s `--eldra-textarea-min-height` is the precedent for setting one of these from a
|
|
2545
|
+
prop's inline style rather than a fixed default only.
|
|
2546
|
+
- **`Drawer`'s close button focuses first on the right side (cart, filters, quick view), unlike
|
|
2547
|
+
`Dialog`'s own initial-focus rule.** The design spec's own "Drawer" → Variants table gives the
|
|
2548
|
+
right side a different default than every other modal surface in this package: "Cart: the close
|
|
2549
|
+
button. Filters and quick view: the close button unless a control is marked `autofocus`" — the
|
|
2550
|
+
opposite of `Dialog`'s "never the close button while a better candidate exists." `Drawer.vue`
|
|
2551
|
+
computes its own `initialFocus` for `useDialog` (a native `[autofocus]` element inside the body,
|
|
2552
|
+
else the close button) only for `side="right"`; the left side (the menu) passes `undefined`, so
|
|
2553
|
+
`useDialog`'s own default — the first focusable that is not `[data-part="close"]` — already gives
|
|
2554
|
+
"the first link in the menu" for free, since the anatomy puts the `<nav>` first in the body.
|
|
2555
|
+
- **`Drawer` has no `dismissable` prop**, unlike `Dialog`. The design spec's own "Drawer" →
|
|
2556
|
+
Behaviour & motion row is unconditional — "Closes on `Esc`, the close button, and a backdrop
|
|
2557
|
+
click" — with no exception column the way the shared modal rules' "unless the dialog holds
|
|
2558
|
+
unsaved input" gives `Dialog`. `useDialog`'s `dismissable` option is simply never passed, which
|
|
2559
|
+
defaults to `true`.
|
|
2560
|
+
- **`Drawer`'s reduced-motion entrance reuses `Dialog`'s own `animate-eldra-dialog-in-reduced`
|
|
2561
|
+
keyframe rather than a third one of its own.** Both spec sections ask for the identical "plain
|
|
2562
|
+
opacity fade over `duration-base` (200ms), linear" — no rise, no scale, nothing side-specific — so
|
|
2563
|
+
a second keyframe with the same two declarations would only be a second name for the same rule.
|
|
2564
|
+
Only the non-reduced entrance gets `Drawer`-specific keyframes (`eldra-drawer-in-right`/`-left`,
|
|
2565
|
+
a `translateX` slide from the correct edge), since that part _is_ side-specific.
|
|
2566
|
+
- **`Drawer`'s slide animation is on the root `<dialog>`, not the panel**, the same placement
|
|
2567
|
+
`Dialog`'s own `animate-eldra-dialog-in` uses. The root is a full-viewport transparent flex box
|
|
2568
|
+
that only docks its (opaque) panel child to one edge; translating the root by a full 100% of its
|
|
2569
|
+
own (viewport) width slides the panel fully off-screen and back regardless of the panel's own
|
|
2570
|
+
width, while the `::backdrop` — a sibling box, not a descendant — is untouched by the transform
|
|
2571
|
+
and simply stays in place.
|
|
2572
|
+
- **`Drawer`'s close button aria-label is a function of whichever prop names the drawer, not a
|
|
2573
|
+
fixed string.** The design spec's own Accessibility notes give three different literal labels
|
|
2574
|
+
for the one control ("Close cart", "Close menu", "Close filters"), which this package cannot know
|
|
2575
|
+
in advance — a new `closeDrawer(name)` message (`Close ${name}`, is-IS `Loka ${name}`) reads
|
|
2576
|
+
whichever of `title`/`ariaLabel` names the drawer, so a consumer reaches the spec's exact wording
|
|
2577
|
+
by choosing that prop's value (`title="Cart"` reads "Close Cart") — falling back to the plain
|
|
2578
|
+
`close` message when the drawer has neither.
|
|
2579
|
+
- **`Drawer`'s events and props follow `Dialog`'s own naming, not the design spec's literal
|
|
2580
|
+
`open`/`openChange` two-way property and `afterLeave` event.** `modelValue` (two-way, `Dialog`'s
|
|
2581
|
+
own convention every stateful component in this package shares) replaces `open`/`openChange`;
|
|
2582
|
+
`close(reason)` fires with `"escape"`/`"backdrop"`/`"button"`/an action value, the identical shape
|
|
2583
|
+
`Dialog`'s own `close` event already uses, rather than a bare `close` with no reason. There is no
|
|
2584
|
+
`afterLeave`: the spec's own exit is "instant" (no animation to wait for), the same reasoning that
|
|
2585
|
+
gives `Dialog` no exit-coordination event either — an event that only ever fires on the same tick
|
|
2586
|
+
as `close` would tell a consumer nothing `close` does not already.
|
|
2587
|
+
- **`Tooltip`'s bubble stays mounted permanently, unlike every other teleported panel in this
|
|
2588
|
+
package.** `Select`/`MultiSelect`/`SearchBar` mount their panel fresh on every open (`v-if` on
|
|
2589
|
+
the `<Teleport>`), so `animate-eldra-popover-in`'s keyframe replays each time. The spec's own
|
|
2590
|
+
Tooltip motion is a plain opacity **transition** (`duration-fast`, `ease-out`), and a CSS
|
|
2591
|
+
transition only plays on a change to an element already in the DOM — mounting a fresh element
|
|
2592
|
+
straight into its end state plays no fade at all. So the bubble is teleported unconditionally
|
|
2593
|
+
(behind `teleportDisabled` until mount, same as everywhere else) and toggles
|
|
2594
|
+
`opacity`/`pointer-events` through a reactive class instead.
|
|
2595
|
+
- **The trigger's `aria-labelledby`/`aria-describedby` is grafted onto the slotted element with
|
|
2596
|
+
`cloneVNode`, not read from a scoped slot the consumer wires up.** The spec is explicit that
|
|
2597
|
+
"the component generates the tooltip id and wires the trigger to it" — the wiring is `Tooltip`'s
|
|
2598
|
+
job, not a prop the consumer must remember to bind — and that attribute has to land on the
|
|
2599
|
+
actual focusable element, not on `root` (the neutral wrapper span the hover/focus listeners live
|
|
2600
|
+
on): a screen reader computes an element's accessible name from what _that_ element points at.
|
|
2601
|
+
The default slot's single element is therefore cloned with the id merged in
|
|
2602
|
+
(`joinIds`, so an existing `aria-describedby` is not clobbered), via a stable
|
|
2603
|
+
functional-component wrapper (`<component :is="Trigger" />`) so Vue patches the same underlying
|
|
2604
|
+
element across renders rather than replacing it. This is the one place in the package that
|
|
2605
|
+
reaches into a slot's own vnode instead of only rendering it.
|
|
2606
|
+
**The trigger contract this implies: a plain element, or a component whose focusable root
|
|
2607
|
+
receives `$attrs`.** A `cloneVNode` merge only reaches the DOM when the vnode's own attrs land on
|
|
2608
|
+
a real element — `Button` works, since it lets `$attrs` fall through undisturbed, but a component
|
|
2609
|
+
declared `inheritAttrs: false` whose own template binds its _own_ `aria-describedby` after
|
|
2610
|
+
spreading `$attrs` (`Input`, `Textarea`, `Select`, `Switch`, and this package's other form
|
|
2611
|
+
controls) silently overwrites the grafted one instead: the tooltip still "works" from `Tooltip`'s
|
|
2612
|
+
own point of view, but the resulting DOM carries no trace of the graft, so it is invisible to
|
|
2613
|
+
assistive technology. A dev-only warning checks the rendered DOM for the expected id after every
|
|
2614
|
+
render (not `original.type`'s `inheritAttrs` statically, which would miss the same symptom
|
|
2615
|
+
arising from an unrelated `$attrs`-ordering issue) and names the fix: wrap such a control in a
|
|
2616
|
+
plain element the tooltip can attach to instead.
|
|
2617
|
+
- **No show delay, on hover or on focus.** The spec's own Behaviour bullet says it twice ("No
|
|
2618
|
+
delay on focus; none needed on hover") and the acceptance criteria repeat it ("appears ... with
|
|
2619
|
+
no delay on focus"); `Tooltip` shows on the very hover/focus event with no timer at all. The
|
|
2620
|
+
API contract's own test note ("hover (delay, fake timers)") is read as "prove there is no delay",
|
|
2621
|
+
not as a requirement for one — `__tests__/tooltip.spec.ts` uses fake timers to advance past a
|
|
2622
|
+
hover event and assert the bubble is already visible before any time has passed.
|
|
2623
|
+
- **"Focus within it" (spec → States, Shown) reads as _keyboard_ focus, and activating the trigger
|
|
2624
|
+
dismisses the tooltip like `Esc` does — neither is in the design spec's own text.** An operator
|
|
2625
|
+
report ("hover and click the element, the tooltip gets stuck and does not disappear on
|
|
2626
|
+
hover-out") traced to `focusWithin` counting any `focusin`, including the one a mouse click gives
|
|
2627
|
+
its own target — so `mouseleave` alone could no longer hide it. The controller's decision narrows
|
|
2628
|
+
"focus within it" to `keyboardFocusWithin`, gated on `element.matches(':focus-visible')` behind a
|
|
2629
|
+
`supportsFocusVisible` feature test (`supportsFocusVisible.ts`, mirroring `Textarea`'s
|
|
2630
|
+
`supportsFieldSizing`), falling back to a same-page "was the last input a key or a pointer" flag
|
|
2631
|
+
where `:focus-visible` cannot be trusted — this package's own test environment, happy-dom,
|
|
2632
|
+
implements it as a synonym for `:focus` rather than throwing, so the flag has to be reached for
|
|
2633
|
+
deliberately (a spec stubs `supportsFocusVisible` to exercise it) rather than detected by a
|
|
2634
|
+
`try`/`catch`. Beyond that narrowing, activating the trigger (`pointerdown`, `click`, or an
|
|
2635
|
+
`Enter`/`Space` `keydown`) now also sets the Dismissed state exactly like `Esc`, on the same
|
|
2636
|
+
reasoning: a clicked button should not keep its own label floating just because the click left it
|
|
2637
|
+
focused. The `hoveringTrigger` watcher that clears a dismissal fires on either edge, not only the
|
|
2638
|
+
pointer leaving, so a dismissal that started with no hover at all (an `Enter`/`Space` activation)
|
|
2639
|
+
still clears the next time the pointer enters, rather than needing an unrelated blur/refocus.
|
|
2640
|
+
- **Fix (2026-09-26): activation only counts for a button/link-like trigger, never an editable
|
|
2641
|
+
one.** The dismissal above was originally keyed off any `Enter`/`Space` `keydown` bubbling
|
|
2642
|
+
through the wrapper, with no check on what fired it. For a `role="description"` tooltip labelling
|
|
2643
|
+
a text input, that meant every space a shopper typed while composing their own text set
|
|
2644
|
+
`dismissed` — and since focus never actually left the field, nothing cleared it again until an
|
|
2645
|
+
unrelated blur/refocus, so the description tooltip vanished for the rest of that focus session
|
|
2646
|
+
after the first keystroke. `onRootKeyDown` now checks `event.target` via `isActivatableTarget`
|
|
2647
|
+
first: `Enter`/`Space` only dismisses when the target matches `button`, `a[href]`,
|
|
2648
|
+
`[role="button"]`, `[role="link"]` or `summary`, and is explicitly excluded for `input`,
|
|
2649
|
+
`textarea`, `select` and `[contenteditable]` regardless.
|
|
2650
|
+
- **The `0.5rem` hover bridge (WCAG 1.4.13) is a CSS `::before` on the bubble, not a fourth DOM
|
|
2651
|
+
part.** The anatomy lists three parts (`root`, `bubble`, `arrow`); the bridge is an invisible
|
|
2652
|
+
pseudo-element extending the bubble's own hit-test area back to the trigger's edge, sized and
|
|
2653
|
+
positioned to the gap, so a real pointer crossing it never leaves a hoverable element. It carries
|
|
2654
|
+
no `data-part` and is not reachable through `classes` for the same reason `Skeleton`'s shimmer
|
|
2655
|
+
and `Rating`'s half-star clip are not — it is drawn, not a component part.
|
|
2656
|
+
- **`useFloating`'s `FloatingPlacement` gained `top-end`/`bottom-end`.** `Tooltip`'s `align="end"`
|
|
2657
|
+
needs a floating-ui placement the existing union did not have (only the `-start` pair, for
|
|
2658
|
+
`Select`/`MultiSelect`'s own footer selectors); the two additions are purely additive and behave
|
|
2659
|
+
like their `-start` siblings (`flip: true`).
|
|
2660
|
+
- **The teleport-target lookup (`topLayerDialog`/`isTopLayer`, the "body, or the open modal
|
|
2661
|
+
`<dialog>` the trigger sits in" rule) moved to `src/composables/teleportTarget.ts`.** `usePopover`
|
|
2662
|
+
and `Tooltip` both need it and neither should duplicate it; it is not exported from the package
|
|
2663
|
+
root, the same as `openRegistry` — an internal building block the two share, not part of the
|
|
2664
|
+
public composable surface. `usePopover`'s own behaviour and tests are unchanged by the move.
|
|
2665
|
+
- **`Toast`'s exit is not animated, even though the spec asks for a 150ms fade out on dismiss**
|
|
2666
|
+
(spec "Toast" → Behaviour & motion) — the same "instant by default" trade-off `Dialog`'s own exit
|
|
2667
|
+
makes (see its own entry above). Final review item 7 asked specifically whether `Accordion`'s own
|
|
2668
|
+
CSS-only exit mechanism (`@starting-style` + `transition-behavior: allow-discrete` on a state held
|
|
2669
|
+
for one extra frame) would fit this case in roughly 40 lines; it does not, for a reason specific
|
|
2670
|
+
to _this_ removal rather than the general "no `<TransitionGroup>` in this package" one.
|
|
2671
|
+
`Accordion`'s panel animates a native `<details>` toggling its own `display` — the browser drives
|
|
2672
|
+
the open transition entirely from the `[open]` attribute change, and even the close (now
|
|
2673
|
+
intercepted by JS to play the height animation before that same attribute flips — see this
|
|
2674
|
+
file's own Accordion entry above, added after this comparison was written) still has one
|
|
2675
|
+
persistent element with a `[open]` attribute to key a transition off, at every point in the
|
|
2676
|
+
process. `Toaster` removes a toast by splicing Vue's reactive `toasts` array (`useToast`'s
|
|
2677
|
+
`dismiss()`), which unmounts the element immediately; there is no attribute to key a CSS
|
|
2678
|
+
transition off after that point; nothing renders to transition once it's gone. Reaching the same
|
|
2679
|
+
effect needs `Toaster` to intercept every removal, hold the removed item in a locally-tracked
|
|
2680
|
+
"leaving" set for one more render plus a 150ms timer before actually dropping it, and merge that
|
|
2681
|
+
set back into `nonDanger`/`danger` in the right list position — while staying correct under a
|
|
2682
|
+
toast being dedupe-replaced mid-exit, `clear()` wiping the queue while something is already
|
|
2683
|
+
leaving, and the existing hover/focus pause logic, which currently assumes `toasts` and "what's
|
|
2684
|
+
on screen" are the same list. That is a second, parallel list-lifecycle to get right beside the
|
|
2685
|
+
one `useToast` already owns, not a CSS utility — meaningfully more than the ~40-line budget this
|
|
2686
|
+
component's budget allowed, and risk (a reordering, a leaked timer, a `clear()` racing an exit) for a purely
|
|
2687
|
+
cosmetic 150ms fade. The entrance animation (fade + a 0.5rem rise over `duration-base`) ships as
|
|
2688
|
+
specified; `Toaster` removes a dismissed toast from the DOM immediately instead.
|
|
2689
|
+
- **`Toaster`'s own anatomy has only two named parts, `root` and `list`, even though a danger toast
|
|
2690
|
+
renders outside both** (spec "Toast" → Behaviour & motion: "insert them into the same fixed stack
|
|
2691
|
+
but outside the polite status element … so the two live regions aren't nested"). There is no
|
|
2692
|
+
visually distinct "danger group" box to name a third part for — a danger toast is simply a
|
|
2693
|
+
further direct child of `root`, a sibling of `list` (the `role="status" aria-live="polite"`
|
|
2694
|
+
element), so the two live regions never nest; each danger toast is its own `role="alert"` region,
|
|
2695
|
+
set on `Toast`'s own root by its `variant`. One consequence, accepted rather than solved: a mixed
|
|
2696
|
+
sequence of variants does not interleave perfectly in the visual stack (every non-danger toast is
|
|
2697
|
+
grouped inside `list`, so a danger toast raised in between still renders after that whole group).
|
|
2698
|
+
The spec does not describe cross-variant ordering closely enough to rule this out, and getting it
|
|
2699
|
+
exactly right would mean nesting the two live regions after all.
|
|
2700
|
+
- **`list` collapses to `hidden` (rather than staying `flex flex-col gap-3`) while it holds no
|
|
2701
|
+
non-danger toast**, purely so `root`'s own `gap-3` does not insert a spare 0.75rem gap above a
|
|
2702
|
+
danger-only stack (an empty `list` would otherwise still count as one flex item). This does not
|
|
2703
|
+
affect the polite announcement itself — an empty `aria-live="polite"` region announces nothing
|
|
2704
|
+
regardless of its own `display`, and Vue applies the class change in the same patch that inserts
|
|
2705
|
+
a first toast's markup, so the region is already visible by the time anything is announced.
|
|
2706
|
+
- **`Toast`'s own `keydown` handler calls `preventDefault()` on `Escape`**, beyond what closing
|
|
2707
|
+
just this toast requires. While a toast is teleported inside an open `Dialog` (`TOAST_HOST_KEY`)
|
|
2708
|
+
and holds focus, the platform's own Escape-closes-the-topmost-dialog behaviour would otherwise
|
|
2709
|
+
fire as well — closing the dialog behind the toast, not only the toast the spec's own Keyboard
|
|
2710
|
+
row asks Escape to close ("closes the toast that holds focus"). `preventDefault()` on the
|
|
2711
|
+
`keydown` suppresses that native "close request" before it reaches the dialog.
|
|
2712
|
+
- **A `Carousel` whose slides hold their own links or buttons takes one tab stop on the active
|
|
2713
|
+
slide, and its track is not focusable at all** — against the spec's own Carousel section, which
|
|
2714
|
+
gives the track `tabindex="0"` unconditionally ("Track: `tabindex="0"` with a label") and spells
|
|
2715
|
+
the tab order out as "the header arrows, then the track, then the links inside the cards".
|
|
2716
|
+
Operator decision, and the spec's own general Keyboard rule says the opposite in the stronger
|
|
2717
|
+
place: "Composite widgets (tabs, listboxes, menus, carousels, radio groups) take one tab stop and
|
|
2718
|
+
use arrow keys inside, following the WAI-ARIA Authoring Practices." Both halves of the Carousel
|
|
2719
|
+
section's own wording produce a double stop (the track, then immediately the first card's link)
|
|
2720
|
+
and then one stop per card after it — thirteen presses to get past a twelve-card row, which is
|
|
2721
|
+
what the decision calls bad practice. The track keeps `tabindex="0"` in exactly the case the
|
|
2722
|
+
section's wording was written for and where nothing else can take the stop: a single-slide image
|
|
2723
|
+
gallery whose slides hold nothing focusable, and the `Lightbox` stage ("Stage / track … focusable")
|
|
2724
|
+
— decided by content, since `CarouselProps` carries nothing that tells the component which
|
|
2725
|
+
variant it is (the same reason the slide-labelling entry below gives). Inside the active slide the
|
|
2726
|
+
tab sequence is untouched, so a card's link and its quick-add are still `Tab` and `Shift+Tab`
|
|
2727
|
+
from each other; a _different_ card's controls need the arrow keys first. `Carousel` adds one
|
|
2728
|
+
thing the spec does not name for it, the visually hidden `slideInstructions` sentence on the
|
|
2729
|
+
root's `aria-describedby` (see the README's `useCarousel` section), because a keyboard pattern
|
|
2730
|
+
nothing on screen explains is worth saying to the one visitor who cannot see the row it applies
|
|
2731
|
+
to.
|
|
2732
|
+
- **Every `Carousel` slide gets the spec's gallery treatment — `role="group"`,
|
|
2733
|
+
`aria-roledescription="slide"`, an "n of total" `aria-label` — including product rows.** The
|
|
2734
|
+
spec's own Accessibility section gives that markup to "gallery slides" only and calls a product
|
|
2735
|
+
row's own slides plain list items holding Product cards, but `CarouselProps` carries nothing that
|
|
2736
|
+
tells the component which of the two a given instance is (no `variant` prop — the spec's variant
|
|
2737
|
+
table is a controls/dots/counter combination, not a discriminant `useCarousel` can read), and the
|
|
2738
|
+
same track this composable drives is shared by both. One consistent rule for every slide, applied
|
|
2739
|
+
by `useCarousel` itself rather than duplicated per call site, was judged better than inventing a
|
|
2740
|
+
prop this package's own type does not have — a screen reader user hears "group, slide, 1 of
|
|
2741
|
+
4" on a product row's cards, slightly more verbose than the spec's plain list items, never less
|
|
2742
|
+
informative. The same gap means the **arrow buttons carry the gallery's own accessible names**
|
|
2743
|
+
("Previous slide"/"Next slide", `messages.previous`/`.next`) **on a product row too**, rather than
|
|
2744
|
+
the spec's row-specific wording ("Previous products"/"Next products"): with no discriminant to
|
|
2745
|
+
read, `Carousel.vue` uses the one pair of messages for both variants, the same reasoning as the
|
|
2746
|
+
slide-role rule above. A consumer wanting the spec's exact row wording overrides it per instance
|
|
2747
|
+
via the `messages` prop (`{ previous: 'Previous products', next: 'Next products' }`).
|
|
2748
|
+
- **The track's own accessible name is the fixed word "Slides", not the spec's two literal
|
|
2749
|
+
examples** ("Bestsellers, scrollable list" for a row, "Slides" for a gallery). Composing the
|
|
2750
|
+
first would mean formatting it from the region's own `ariaLabel`, coupling the track's wording to
|
|
2751
|
+
whatever a caller happened to name the whole carousel; the plain generic word reads correctly for
|
|
2752
|
+
both variants and needs no `messages` key of its own beyond `slides`.
|
|
2753
|
+
- **The Pause/Play button's accessible name is its visible text ("Pause"/"Play"), not the spec's
|
|
2754
|
+
longer "Pause slideshow"/"Play slideshow".** The API contract's own message-key guidance names the
|
|
2755
|
+
pair `pause`/`play`, one string each — this package uses that one string for both the visible
|
|
2756
|
+
label and the accessible name (a native `<button>`'s default accessible name is already its own
|
|
2757
|
+
text content) rather than adding a second, longer key purely for the ARIA name.
|
|
2758
|
+
- **The visible "n / total" counter is not bolded on its current number**, despite the spec's own
|
|
2759
|
+
Sizes row ("current number bold"). The counter is `aria-hidden` and rendered from
|
|
2760
|
+
`messages.counter(n, max)` — a single localized string ("n / max" in English, "n af max" in
|
|
2761
|
+
Icelandic) — so bolding only the leading number would mean splitting that string back apart by
|
|
2762
|
+
position, which breaks the moment a locale's own word order does not put the number first. The
|
|
2763
|
+
counter stays plain text; the locale-correct string was judged more important than the one-weight
|
|
2764
|
+
visual detail on a range that is not read by assistive technology.
|
|
2765
|
+
- **Arrow, Pause/Play and dot markup is hand-rolled `<button>`s rather than `<Button icon-only>` or
|
|
2766
|
+
`<Button variant="outline" size="sm">`**, even though the Pause/Play recipe is otherwise byte-for-
|
|
2767
|
+
byte `Button`'s own outline/`sm` box. `data-part="pause"` (and `"prev"`/`"next"`) needs to land on
|
|
2768
|
+
the actual rendered element, and no `Button` size is the arrow's own 2.75rem circle; reusing
|
|
2769
|
+
`Button` for Pause alone while hand-rolling the arrows beside it would leave one control built two
|
|
2770
|
+
different ways for no real gain.
|
|
2771
|
+
engine regardless of whether that engine also exposes it as a property.
|
|
2772
|
+
- **Fix (2026-09-26, operator report: "swiping/dragging on both lightbox and carousel is very
|
|
2773
|
+
broken — it starts and then kind of cancels; while dragging we are highlighting stuff"): the
|
|
2774
|
+
track's own `touch-action` changes from `touch-pan-y` alone to `touch-pan-x touch-pan-y`
|
|
2775
|
+
(`Carousel.vue`'s own `trackClass` comment has the full mechanism), and the pointer-drag state
|
|
2776
|
+
machine in `useCarousel` gains two fixes shared by `Carousel` and `Lightbox`.** First: the track
|
|
2777
|
+
keeps `scroll-behavior: smooth` at rest for its own arrow/dot/autoplay navigation, but every
|
|
2778
|
+
`scrollLeft` write the drag makes is a real, instant assignment — under `smooth`, each one started
|
|
2779
|
+
an animation the very next write interrupted, which is what read as "starts and then kind of
|
|
2780
|
+
cancels." `data-[dragging=true]:scroll-auto` (riding the same `data-dragging` attribute
|
|
2781
|
+
`data-[dragging=true]:snap-none` already used) turns `scroll-behavior` off for the drag's
|
|
2782
|
+
duration; a forced reflow between clearing the attribute and the release's `goTo()` call
|
|
2783
|
+
(`endTrackDrag`'s own comment) is what lets the class change actually take effect before the
|
|
2784
|
+
snap-back animates, rather than either jumping instantly or fighting the drag's own last write.
|
|
2785
|
+
Second: `pointermove`'s own `preventDefault()` (unchanged) never stopped the browser's native
|
|
2786
|
+
text-selection drag, which starts on `mousedown`, before any `pointermove` fires — so dragging
|
|
2787
|
+
across a slide's caption highlighted it. `onTrackPointerDown` now called `preventDefault()` itself,
|
|
2788
|
+
once every bail-out (wrong button, touch, an interactive descendant) had already passed, and the
|
|
2789
|
+
drag also toggles `user-select: none` on `document.documentElement` for its duration (the pointer
|
|
2790
|
+
can leave the track mid-drag, past the track's own `data-[dragging=true]:select-none`), restored on
|
|
2791
|
+
`pointerup`/`pointercancel`/`lostpointercapture` alike. Touch was never affected by either fix —
|
|
2792
|
+
it swipes through native scroll-snap panning, which is exactly what the `touch-action` change
|
|
2793
|
+
above restores. (The `preventDefault()`-on-`pointerdown` half of this fix was itself replaced the
|
|
2794
|
+
same day — see the later fix below.)
|
|
2795
|
+
- **Fix (2026-09-26, a second operator report: "we are not able to drag on a card, we have to place
|
|
2796
|
+
the cursor between cards. If it's a clickable entry we should cancel the click ... if we swipe
|
|
2797
|
+
over some offset. That way the click stays functional but we can still swipe."): a drag may now
|
|
2798
|
+
start on any pointer press inside the track — buttons and links included — not only the track's
|
|
2799
|
+
bare background between slides.** The earlier `isInteractiveDescendant` bailed out of
|
|
2800
|
+
tracking a pointerdown on _any_ `a[href]`/`button`/`input`/`[role="button"]`/etc., which is exactly
|
|
2801
|
+
why dragging never started on a `ProductCard` (its title link is stretched over the whole card).
|
|
2802
|
+
Replaced with `isNoDragTarget`, which only excludes an editable/range control (`input`, `textarea`,
|
|
2803
|
+
`select`, `[contenteditable]`, `input[type="range"]`) or an explicit `data-no-drag` opt-out. The
|
|
2804
|
+
earlier `preventDefault()` on every qualifying `pointerdown` is gone too — it was what stopped a
|
|
2805
|
+
slide's own link/button from focusing or clicking normally below the 6px threshold, which the
|
|
2806
|
+
decision requires ("Do NOT preventDefault() the pointerdown — keep native focus/click behaviour").
|
|
2807
|
+
In its place, `onTrackPointerMove` clears any text selection the bare `mousedown` already started
|
|
2808
|
+
(`window.getSelection()?.removeAllRanges()`) the instant the gesture crosses the threshold, which
|
|
2809
|
+
is the only moment a selection anchor stops being wanted. The click-cancelling half of the state
|
|
2810
|
+
machine (`suppressNextClick`, armed only once a real drag happened, consumed by a capture-phase
|
|
2811
|
+
listener on the track) needed no change — it already canceled a click "wherever the pointer lands,"
|
|
2812
|
+
drag start included.
|
|
2813
|
+
- **`Breadcrumb` never truncates a label, even a long one — this reverses a truncation rule an
|
|
2814
|
+
earlier draft of the task's own interface comment carried ("long titles truncate at 40ch with the
|
|
2815
|
+
full title in `title`").** The design spec text is explicit and binding over that comment: "Product
|
|
2816
|
+
titles are never truncated; the trail wraps" (Behaviour & motion), repeated as its own acceptance
|
|
2817
|
+
criterion ("At 320px and 200% zoom the trail wraps without horizontal scroll and titles are not
|
|
2818
|
+
truncated", 1.4.10). There is no `truncate`/`line-clamp` class anywhere in this component and no
|
|
2819
|
+
native `title` attribute either — nothing here is ever clipped, so a hover tooltip repeating text
|
|
2820
|
+
that is already fully visible would add nothing. `LongTitles` (Storybook) shows a long current-page
|
|
2821
|
+
title wrapping onto a second line instead of clipping.
|
|
2822
|
+
- **The separator between levels is an inline Tabler `chevron-right` SVG (`aria-hidden`, the same
|
|
2823
|
+
shape `AccordionItem`'s own chevron uses), not the CSS-drawn two-border chevron the design spec's
|
|
2824
|
+
own Sizes row describes ("a small chevron drawn in CSS between items").** Operator direction,
|
|
2825
|
+
2026-09-25: consistent with every other directional glyph this package draws (`Link`'s arrow,
|
|
2826
|
+
`AccordionItem`'s chevron), all of which are inline SVGs, not CSS pseudo-element borders — a
|
|
2827
|
+
second decorative-line technique for one component would be a new pattern with no reuse anywhere
|
|
2828
|
+
else in the package. It is still `aria-hidden` and still not text, so it is still never announced.
|
|
2829
|
+
- **Fix (2026-09-26): the separator's fixed `mt-1.875` — sized to centre a 0.375rem chevron on one
|
|
2830
|
+
`text-body-sm` line (1.3125rem) — was also being used before a link, whose own sibling box is
|
|
2831
|
+
`target-min` (1.5rem), not that line-height.** The operator reported "separators render as tiny
|
|
2832
|
+
marks sitting above the baseline" — true of most separators in an ordinary trail, since only the
|
|
2833
|
+
one immediately before the current page (see `BreadcrumbItem`'s own comment on wrapping) ever sits
|
|
2834
|
+
beside a plain, line-height-driven `<span>`; every other separator sits beside a `target-min` link
|
|
2835
|
+
or the ellipsis button. `separatorClass` (`Breadcrumb.vue`) now takes an `alignCenter` argument:
|
|
2836
|
+
`true` (`self-center`, letting the flexbox centre the chevron against its sibling's real height,
|
|
2837
|
+
no arithmetic needed) before a link or the ellipsis; `false` (the original `mt-1.875` math,
|
|
2838
|
+
unchanged) only before the trail's final, possibly-wrapping current-page item — `self-center`
|
|
2839
|
+
there would centre the chevron against the _whole_ wrapped block instead of its first line, which
|
|
2840
|
+
the `LongTitles` story and a dedicated `Breadcrumb.spec.ts` case both prove stays correct. The
|
|
2841
|
+
chevron's own size is unchanged (0.375rem, `size-1.5`, already the spec's own number); only the
|
|
2842
|
+
horizontal margin moved from `mr-0.5` (0.125rem, right only) to `mx-1` (0.25rem, both sides).
|
|
2843
|
+
- **Second fix (2026-09-26): the fix above still centred the two kinds of separator
|
|
2844
|
+
against two different reference boxes — `self-center` against a link's real 1.5rem `target-min`
|
|
2845
|
+
height, the fixed `mt-1.875` against the current page's plain 1.3125rem text line — so they never
|
|
2846
|
+
quite lined up (a pixel review of the built `navigation-breadcrumb--default`/`--long-titles`
|
|
2847
|
+
baselines found the current-page separator sitting visibly above the others, not centred on
|
|
2848
|
+
them).** `separatorClass` (`Breadcrumb.vue`) no longer takes an `alignCenter` argument or branches
|
|
2849
|
+
on position at all: every separator is now a `<span data-part="separator">` frame — `inline-flex
|
|
2850
|
+
items-center justify-center`, fixed at `h-6` (1.5rem = 24px, the same height `target-min` gives a
|
|
2851
|
+
link or the ellipsis button), `self-start` against the `<li>`'s own `items-start` — wrapping the
|
|
2852
|
+
actual 0.375rem chevron `<svg>` centred inside it. `currentClass` now carries the same `inline-
|
|
2853
|
+
flex items-center target-min` frame `linkClass` gives its sibling, so a non-wrapping current page
|
|
2854
|
+
lines up with a link exactly. That fixed, top-pinned 24px frame is also what keeps a _wrapping_
|
|
2855
|
+
current-page title's separator correct with the identical recipe rather than a special case: since
|
|
2856
|
+
the frame's own height never grows past 24px regardless of how tall the wrapped `<li>` becomes,
|
|
2857
|
+
and it is pinned to the `<li>`'s top edge, it stays centred on the title's first line exactly like
|
|
2858
|
+
it would if the title were a single line. `Breadcrumb.spec.ts`'s "separator geometry" tests now
|
|
2859
|
+
assert the class-recipe identity across positions directly (sorted class-list equality between the
|
|
2860
|
+
separator before a link and the one before the current page, wrapping or not) rather than only
|
|
2861
|
+
checking which one Tailwind class name a given position carries, per the review that caught this.
|
|
2862
|
+
- **Fix (2026-09-26, operator report: "Breadcrumb arrow icons are way, way too small"): the
|
|
2863
|
+
separator chevron grows from the spec's own `0.375rem` (`size-1.5`) to `1rem` (`size-4`) —
|
|
2864
|
+
superseding the "chevron's own size is unchanged" line in the fix above, which predates this
|
|
2865
|
+
report.** The spec's own Sizes row for "Separator" gives `0.375rem`, but the operator judged the
|
|
2866
|
+
built result illegible at a glance; `size-4` is this package's own override, recorded here rather
|
|
2867
|
+
than silently changed. The chevron still centres inside the same fixed `h-6` (24px) frame
|
|
2868
|
+
`separatorClass` (`Breadcrumb.vue`) already gives every separator — see that fix's own comment
|
|
2869
|
+
above for why the frame, not the chevron, is what keeps every separator's vertical position
|
|
2870
|
+
identical regardless of what it sits beside — so this is a pure size bump with no other geometry
|
|
2871
|
+
to reconcile. Stroke width (`1.75`) and colour (`text-muted`, inherited via `currentColor`) are
|
|
2872
|
+
unchanged.
|
|
2873
|
+
- **`Breadcrumb`'s trail links are underlined at rest, not only on hover — the same operator
|
|
2874
|
+
decision as `Link`'s own Deviations entry above ("all link elements... underline by default").**
|
|
2875
|
+
The spec's own States row for the Link part ("`muted`, underline hidden (transparent)" at rest)
|
|
2876
|
+
predates that decision; `linkClass` now carries `Link`'s own shared rest recipe (1px at 55% of the
|
|
2877
|
+
text colour, thickening to 2px on hover) instead of the old no-underline-until-hover shape. The
|
|
2878
|
+
current page (`currentClass`) is unaffected — it was never a link and carries no underline in
|
|
2879
|
+
either state.
|
|
2880
|
+
- **The `<nav>` landmark name and the ellipsis button's accessible name are catalogue messages
|
|
2881
|
+
(`breadcrumbLabel`, `showMoreLevels`), not literal strings baked into the template**, following
|
|
2882
|
+
this package's own rule that text a component renders on its own — never passed in by a caller —
|
|
2883
|
+
goes through `useMessages()`. Icelandic has no single settled UI term for "breadcrumb" the way it
|
|
2884
|
+
does for "close" or "search"; `breadcrumbLabel` reads `'Leiðarslóð'` (route/way trail) and
|
|
2885
|
+
`showMoreLevels` reads `` `Sýna ${n} þrep í viðbót` `` ("þrep", a rung/step, does not change form
|
|
2886
|
+
between one and many) — both judgement calls, recorded here rather than left silent.
|
|
2887
|
+
- **`Breadcrumb` emits its `BreadcrumbList` JSON-LD (spec "Breadcrumb" → Behaviour & motion: "Emit
|
|
2888
|
+
`BreadcrumbList` structured data from the same items") as a `<script type="application/ld+json">`
|
|
2889
|
+
inside the `<nav>`, set with `v-text` rather than mustache interpolation or `v-html`.** `<script>`
|
|
2890
|
+
is a RAWTEXT element, so Vue's compiler never parses `{{ }}` inside its children the same way it
|
|
2891
|
+
never parses them inside a `<textarea>` — the content would render as the literal four characters
|
|
2892
|
+
`{{ x }}`. `v-html` would work (a `<script>`'s `innerHTML` setter is a text-content assignment, not
|
|
2893
|
+
script execution) but reopens the fragment through the HTML parser, which resolves a `</script`
|
|
2894
|
+
substring inside the JSON as the tag's own close and truncates it — a real risk for a label a
|
|
2895
|
+
merchant wrote, not a synthetic one. `v-text` sets `el.textContent` directly and skips HTML
|
|
2896
|
+
parsing entirely, so nothing inside the JSON can end the tag early. The current page's own `item`
|
|
2897
|
+
URL is omitted from its `ListItem`, matching both schema.org's own guidance for a list's last entry
|
|
2898
|
+
and this component's rule that the last item is never a link regardless of what `href` it carries.
|
|
2899
|
+
- **`Pagination` renders as `<button>` elements emitting `update:page` without `hrefForPage`,
|
|
2900
|
+
rather than the spec's own literal default `?page={n}`** (controller decision). A consumer
|
|
2901
|
+
driving pagination from in-memory state (a client-side filtered grid, a `Load more`-adjacent
|
|
2902
|
+
paged view with no server round trip) has no URL to build, and the spec's own default would have
|
|
2903
|
+
forced one anyway. With `hrefForPage` given, every control — page, previous, next — renders as a
|
|
2904
|
+
real `<a href>` (or the `linkAs` component, `Link`'s own `as` contract) exactly as the spec describes;
|
|
2905
|
+
without it, the same controls are native `<button type="button">`s and the component is
|
|
2906
|
+
controlled through `page`/`update:page` instead.
|
|
2907
|
+
- **`Pagination`'s numbered and compact forms are two sibling subtrees inside one `<nav>`, switched
|
|
2908
|
+
by a `@container` query on the root, not one element that changes shape.** The design spec's own
|
|
2909
|
+
Behaviour bullet ("Numbered and compact are driven by the same data") reads either way; two
|
|
2910
|
+
subtrees was chosen because the two forms are not simply a style change of one control — the
|
|
2911
|
+
compact previous/next arrows are icon-only outline buttons with a different accessible name
|
|
2912
|
+
("Previous page") than the numbered form's chevron-plus-text link, and the compact form adds a
|
|
2913
|
+
"Page 2 of 12" status with nothing to correspond to in the numbered list. `compact` forces the
|
|
2914
|
+
compact form by not rendering the numbered subtree at all, rather than leaving it in the DOM and
|
|
2915
|
+
hidden; the default (unforced) case renders both, one `hidden @tablet:flex` and the other `flex
|
|
2916
|
+
@tablet:hidden`, with `--container-tablet` (`tailwind.css`, declared for exactly this edge —
|
|
2917
|
+
see its own comment) as the shared 48rem breakpoint.
|
|
2918
|
+
- **`Pagination`'s previous/next controls read "Previous page"/"Next page" in both forms**, not the
|
|
2919
|
+
spec's own shorter visible "Previous"/"Next" text for the numbered form with a separate,
|
|
2920
|
+
unspecified full sentence for the compact icon-only arrows. One message pair (`previousPage`/
|
|
2921
|
+
`nextPage`) serves both, which is also the exact pair the task's own message list names.
|
|
2922
|
+
- **`Pagination` gained a `pageOfTotal(page, total)` message beyond the task's listed set**, because
|
|
2923
|
+
the compact form's status ("Page 2 of 12") needs the total baked into the sentence, unlike
|
|
2924
|
+
`pageN(n)`'s single-page accessible name — composing it from two separate calls would leave "of"
|
|
2925
|
+
untranslated. `pageN` itself grew an optional second parameter (`current = false`) rather than a
|
|
2926
|
+
second key, so `pageN(6)` ("Page 6") and `pageN(6, true)` ("Page 6, current page") share one
|
|
2927
|
+
translatable sentence instead of a key that exists only to append four words.
|
|
2928
|
+
- **`Pagination`'s compact status bolds the page numbers inside the sentence by splitting the
|
|
2929
|
+
translated string on digit runs (`/(\d+)/`), not by changing the message contract.** The spec's
|
|
2930
|
+
own States table gives the numbers `text` weight 600 ("Page **2** of **12**"), but `pageOfTotal`
|
|
2931
|
+
is one translated sentence with no seam of its own to carry that markup across locales — a
|
|
2932
|
+
regex split on the digit runs a locale's own numerals produce is presentation only (the message
|
|
2933
|
+
key, its arity and every translation stay exactly as before; `messages/__tests__/parity.spec.ts`
|
|
2934
|
+
sees no change), and works the same way regardless of where in the sentence a locale's word order
|
|
2935
|
+
puts the numbers.
|
|
2936
|
+
- **`LoadMore`'s button is hand-rolled rather than a wrapped `<Button variant="outline">`**, the
|
|
2937
|
+
same reason `Drawer`'s own close button is hand-rolled instead of a wrapped `<Button icon-only>`:
|
|
2938
|
+
this part needs its own literal `data-part="button"`, and `Button`'s root hard-codes
|
|
2939
|
+
`data-part="container"` with no prop to override it. The recipe (`control-h`, `text-button-md`,
|
|
2940
|
+
the `eldra-focus` ring, the 98%-scale press) is `Button`'s own `outline` variant, copied rather
|
|
2941
|
+
than composed.
|
|
2942
|
+
- **`LoadMore`'s button stays clickable while `pending`, and is never `disabled`** — the same "a
|
|
2943
|
+
loading control is still clickable; the action is already under way" rule `Button`'s own
|
|
2944
|
+
`loading` state follows (see that component's own comment). `pending` shows a spinner and sets
|
|
2945
|
+
`aria-busy="true"`; a consumer wanting to prevent a duplicate `load` mid-flight guards its own
|
|
2946
|
+
handler, the same way a consumer of `Button loading` already must.
|
|
2947
|
+
- **`Image` gained a `fit?: 'cover' | 'contain'` prop (default `'cover'`, unchanged for every
|
|
2948
|
+
existing consumer).** The Image spec is explicit that "the frame always crops; it never
|
|
2949
|
+
stretches," but `Lightbox`'s own spec is just as explicit the other way ("Image: fits the stage
|
|
2950
|
+
height and width, keeps its aspect ratio (contain)") — a full-resolution photo in a viewer must
|
|
2951
|
+
never be cropped. Rather than duplicate `Image`'s frame/media/placeholder/caption machinery in a
|
|
2952
|
+
second component for one property, the crop behaviour became a prop; `focal`/`zoom` still apply
|
|
2953
|
+
under `cover` and have no effect under `contain` (there is nothing to pan once the whole image is
|
|
2954
|
+
always visible).
|
|
2955
|
+
- **`Lightbox`'s own `label` is `ariaLabel`, per this package's own convention** (an accessible-
|
|
2956
|
+
name-only prop is never the bare noun): the viewer has no visible heading of its own to be
|
|
2957
|
+
`aria-labelledby`, only `aria-label`.
|
|
2958
|
+
- **The viewer is unconditionally full screen, at every width — there is no windowed size above a
|
|
2959
|
+
48rem viewport.** The design spec's own "Global Constraints" section groups Drawer, Lightbox and
|
|
2960
|
+
Search modal together as "full-screen variants … apply below a 48rem viewport," which `Drawer`'s
|
|
2961
|
+
own `eldra-drawer-width` utility takes literally (a real windowed default above that edge). The
|
|
2962
|
+
Lightbox section itself, though, is unambiguous and stated twice ("Viewer: the full viewport …
|
|
2963
|
+
100% × 100%"; "Mobile: The Lightbox is always full screen, at every width") — a specialisation of
|
|
2964
|
+
the general rule that is trivially true at every width, not a contradiction of it, since "full
|
|
2965
|
+
screen below 48rem" is a subset of "full screen everywhere." The one behaviour that genuinely
|
|
2966
|
+
does change at that viewport edge is the close button's own size (spec: "2.5rem … 2.75rem below
|
|
2967
|
+
48rem"), implemented exactly like `Drawer`'s own close button (`size-10 max-md:size-11`, a real
|
|
2968
|
+
`@media` query, no `@container`).
|
|
2969
|
+
- **Every slide the track scrolls between is a plain `<div data-part="slide">`, not itself the
|
|
2970
|
+
`<figure>` the spec's own anatomy names ("Slide: a `<figure>` holding the image").**
|
|
2971
|
+
`useCarousel`'s shared `annotate()` puts `role="group"` on whatever element it treats as the
|
|
2972
|
+
slide, and axe's `aria-allowed-role` refuses that role specifically on a `<figure>` that also
|
|
2973
|
+
contains a `<figcaption>` (proven live: only the captioned images in this component's own tests
|
|
2974
|
+
failed it; the uncaptioned ones did not) — the same shape as `Carousel`'s own `<li>` exception,
|
|
2975
|
+
just discovered one level deeper. `Image`'s own `caption` prop already renders the real
|
|
2976
|
+
`<figure>`/`<figcaption>` pairing one level inside this wrapper, so the caption is still a real
|
|
2977
|
+
`<figcaption>` of a real `<figure>`, just not the element carrying the group semantics.
|
|
2978
|
+
- **Message vocabulary is `*Image`, never `*Slide`, anywhere in this component** (`previousImage`/
|
|
2979
|
+
`nextImage`/`imageOf`/`goToImage`), even where the design spec's own wording for the thumbnail
|
|
2980
|
+
strip reuses `Carousel`'s literal dot phrasing ("With thumbnails" → "each 'Go to slide n'"). A
|
|
2981
|
+
Lightbox viewer shares its track with `Carousel` as an implementation detail this package's own
|
|
2982
|
+
users never see; every string this component renders says "image," matching every other word in
|
|
2983
|
+
its own spec section (arrows, accessibility notes, anatomy).
|
|
2984
|
+
- **The visible counter is not bolded on its current number**, for the identical reason `Carousel`'s
|
|
2985
|
+
own counter is not (see that component's own Deviations entry): it is `aria-hidden` and rendered
|
|
2986
|
+
from one localized `messages.counter(n, max)` string that cannot be split back apart by character
|
|
2987
|
+
position across locales.
|
|
2988
|
+
- **`←`/`→` are handled on the `<dialog>` root itself, not through `useCarousel`'s own
|
|
2989
|
+
`onTrackKeydown` bound to the track.** The spec's own Keyboard row is explicit that these keys
|
|
2990
|
+
work "from anywhere in the viewer," not only a focused track — binding both the root's own
|
|
2991
|
+
listener and `onTrackKeydown` on the track would double-fire `next()`/`prev()` whenever the track
|
|
2992
|
+
itself holds focus, so this component reimplements the two-line key check once, at the root,
|
|
2993
|
+
instead.
|
|
2994
|
+
- **No `dismissable` prop, unconditionally the opposite of `Drawer`'s own unconditional rule.** The
|
|
2995
|
+
spec's own words are as direct as `Drawer`'s: "There is no backdrop click: the viewer fills the
|
|
2996
|
+
viewport and its ground is part of the viewer" — `useDialog`'s `dismissable` option is passed a
|
|
2997
|
+
literal `false`, never a prop.
|
|
2998
|
+
- **A disabled arrow's icon alone drops to 45% opacity (`disabled:text-background/45`); the border
|
|
2999
|
+
stays at its full 70%.** The spec's own States table gives the border and the icon separate
|
|
3000
|
+
values at that state ("border: same" / "icon: … at 45% opacity"), so the dimming lives on the
|
|
3001
|
+
icon's own `currentColor` rather than a whole-button `opacity-*`, which would fade the border too.
|
|
3002
|
+
- **Thumbnails have no size/state table of their own in the spec** ("Carousel dots styled as small
|
|
3003
|
+
images" is the whole description) — this component's own choice is a `size-12` square, opacity
|
|
3004
|
+
60% at rest raised to 100% on hover/selection, and a light `outline` (rather than a `ring`, to
|
|
3005
|
+
avoid a `ring-offset-color` arbitrary value against the ground's own `color-mix()` fill) on the
|
|
3006
|
+
image showing.
|
|
3007
|
+
- **Opening at a non-zero `index` moves the track there with no scroll animation, regardless of
|
|
3008
|
+
`prefers-reduced-motion`**, unlike every later move (arrows, `←`/`→`, a thumbnail), which scrolls
|
|
3009
|
+
smoothly unless reduced motion is on — the spec's own "Opens at index" is a distinct sentence from
|
|
3010
|
+
"Moving between images scrolls smoothly." `useCarousel`'s own `goTo` has no per-call override for
|
|
3011
|
+
this (and gaining one was judged not worth changing a composable shared with `Carousel`, under
|
|
3012
|
+
review concurrently as this task's own dependency), so `Lightbox.vue` temporarily replaces the
|
|
3013
|
+
track's own `scrollTo` for the duration of that one synchronous call and restores it immediately
|
|
3014
|
+
after — a local decorator, not a change to `useCarousel` itself.
|
|
3015
|
+
- **Every slide's `Image` (the element that actually carries a `src`) only exists in the DOM while
|
|
3016
|
+
the viewer is open — `v-if="model"` on `Image` itself, the slide `<div>` wrapping it staying
|
|
3017
|
+
mounted throughout (fix, corrected below).** An earlier draft of this component instead
|
|
3018
|
+
relied on the closed `<dialog>`'s own `display: none`, reasoning that "a UA fetches nothing
|
|
3019
|
+
inside an element with no layout box" — **true for `loading="lazy"`, false for an eager `<img>`**:
|
|
3020
|
+
a plain (non-lazy) `<img>`, which `priority` forces, begins fetching the moment it is _connected_
|
|
3021
|
+
to the DOM, independent of any ancestor's `display` — so a `Lightbox` mounted closed next to a
|
|
3022
|
+
product gallery (its whole intended usage) downloaded every full-resolution photo immediately,
|
|
3023
|
+
never open or not. Caught by code review, not the screenshot harness (every story and every test
|
|
3024
|
+
mounted already open, so the closed-state network behaviour was never observed) — fixed by
|
|
3025
|
+
gating `Image` on `model` instead. The slide _wrapper_ stays mounted unconditionally on purpose:
|
|
3026
|
+
`useCarousel`'s own index/count maths reads `trackRef.value.children.length` directly, and
|
|
3027
|
+
keeping that count constant across an open/close transition means neither depends on the
|
|
3028
|
+
`MutationObserver` timing a `v-if` on the wrapper itself would introduce (proven live: the
|
|
3029
|
+
existing "jumps to the starting index" test, which mounts closed and opens with a non-zero
|
|
3030
|
+
`index`, stayed green with no changes once the fix landed on `Image` alone). Every slide stays
|
|
3031
|
+
`priority` (eager) once it exists — by definition that is only while the viewer is open, so
|
|
3032
|
+
there is no `loading="lazy"` proximity heuristic left to fight (the problem the _original_ task
|
|
3033
|
+
hit, when only the current slide was eager and the rest never left that heuristic) and no reason
|
|
3034
|
+
to delay any of them once the shopper can already see the current one.
|
|
3035
|
+
- **The track's own accessible name is the spec's literal "Images" (a dedicated `lightboxImages`
|
|
3036
|
+
message key), not `Carousel`'s own "Slides."** Every other string this component renders already
|
|
3037
|
+
says "image" rather than "slide" (see `previousImage`/`imageOf`/`goToImage` above) — the track's
|
|
3038
|
+
label was the one place that still reused `Carousel`'s `slides` key by oversight, caught by code
|
|
3039
|
+
review (fix) since nothing asserted its value.
|
|
3040
|
+
- **The stage's own 4rem side padding (spec "Sizes": "room for the arrows") lives on each slide,
|
|
3041
|
+
not on the scrolling track.** Padding on the track itself (an `overflow-x-auto` element) does not
|
|
3042
|
+
shrink what a scroll-snapped, 100%-wide slide's own `clientWidth` shows at rest — it only shifts
|
|
3043
|
+
where the content starts, so the very next slide's own padding-width sliver was already visible
|
|
3044
|
+
beside the first one before any scrolling happened (caught live in the `Narrow` story's own
|
|
3045
|
+
360px-wide baseline, a real peek the spec's own "one slide = 100% of the stage, no gap" rule rules
|
|
3046
|
+
out). A slide's own inset costs nothing at the track's box-sizing level — its outer width is still
|
|
3047
|
+
exactly the track's own, since border-box already includes the padding — so moving `px-16` there
|
|
3048
|
+
removes the peek entirely while the image still loses the 4rem the arrows need.
|
|
3049
|
+
- **`index`'s two-way binding only reflects `props.index` at the moment the viewer transitions to
|
|
3050
|
+
open (or is already open at mount) — it does not reactively re-jump the track if a consumer
|
|
3051
|
+
changes `index` while the viewer is already open and visible.** The spec's own Properties wording
|
|
3052
|
+
("set it to the thumbnail that was activated _before opening_") only describes the opening
|
|
3053
|
+
moment, which is the only case `watch(model, …, { immediate: true })` actually calls
|
|
3054
|
+
`openAtIndex` for; an intentional scope limit, not a gap, but worth stating here since a future
|
|
3055
|
+
consumer reading only this file (not the task's own internal report) would otherwise have no way
|
|
3056
|
+
to know it was considered.
|
|
3057
|
+
- **`SearchModal` duplicates `SearchBar.vue`'s view logic (idle/results/none/loading, the grouping,
|
|
3058
|
+
the highlight arithmetic, recent-search storage) rather than importing it.** The spec's own words
|
|
3059
|
+
are "the same live search … everything else is exactly as the Search bar", which is a behavioural
|
|
3060
|
+
contract, not a markup one: the two components share almost no DOM (a floating popup with a boxed
|
|
3061
|
+
field versus a modal frame with a borderless one) beyond the `SearchResultsPanel`/`useListbox`
|
|
3062
|
+
pair this component reuses directly (`SearchResultsPanel`'s new `flat` prop renders it inline,
|
|
3063
|
+
with no border/shadow/radius/open-animation of its own, for exactly this reuse). Extracting the
|
|
3064
|
+
view logic into a third shared module was judged a larger refactor than this task's scope, with a
|
|
3065
|
+
real cost — `SearchBar.vue` must not be touched by this task, and a shared composable would need
|
|
3066
|
+
to keep both its own tests and this component's green at once for a limited win over predictable,
|
|
3067
|
+
read-side-by-side duplication.
|
|
3068
|
+
- **The query is `v-model:query`, not `v-model`/`modelValue`.** The spec's own Properties table
|
|
3069
|
+
gives `SearchModal` two independent two-way properties, `open` and `value`; this package's own
|
|
3070
|
+
convention already spends `modelValue` on a modal surface's open/closed state (`Dialog`, `Drawer`
|
|
3071
|
+
and now this component all use it that way), so the query needed a name of its own rather than
|
|
3072
|
+
displacing that convention for one component.
|
|
3073
|
+
- **The dialog's accessible name is `ariaLabel`, defaulting to `messages.search` ("Search"), not a
|
|
3074
|
+
`label` prop.** Package rule: an accessible-name-only prop is always `ariaLabel` (see `Drawer`'s
|
|
3075
|
+
own `ariaLabel`), which also keeps it from colliding with the _field_'s own accessible name
|
|
3076
|
+
(fixed to `messages.searchTheShop`, exactly as `SearchBar`'s own default, and not exposed as a
|
|
3077
|
+
prop — the spec's own Properties table for this component gives the modal no field-label
|
|
3078
|
+
override of its own).
|
|
3079
|
+
- **The three-step `Esc` is handled by a listener bound directly on the `<dialog>`'s `cancel` event
|
|
3080
|
+
in the template, not by `useDialog`'s `onCancel` option.** `onCancel` is a plain notification
|
|
3081
|
+
`useDialog`'s own listener always follows with an unconditional `close()` — right for `Dialog`/
|
|
3082
|
+
`Drawer` ("Esc always closes it"), but this component's first two steps (clear the active option;
|
|
3083
|
+
clear the query) must _not_ close it. Vue attaches a native element's template-bound listeners
|
|
3084
|
+
while mounting it, before any composable's own `onMounted` runs, so the template's own `@cancel`
|
|
3085
|
+
handler is guaranteed to see the event before `useDialog`'s internal one does; it calls
|
|
3086
|
+
`stopImmediatePropagation()` on the two steps that must not reach that internal listener at all,
|
|
3087
|
+
and does nothing on the third, letting `useDialog`'s own close proceed exactly as it already does
|
|
3088
|
+
for `Dialog`/`Drawer`.
|
|
3089
|
+
- **`/` and `⌘K`/`Ctrl+K` share `shortcutOwner.ts` with `SearchBar`, extended with a `kind`
|
|
3090
|
+
parameter (default `'/'`) rather than a second module.** The spec's own rule — "`/` opens it only
|
|
3091
|
+
when no SearchBar currently owns the `/` shortcut" — is exactly what claiming the _same_ queue
|
|
3092
|
+
`SearchBar` already claims produces: whichever of them mounted first, with its shortcut on, owns
|
|
3093
|
+
the key. `⌘K`/`Ctrl+K` needs its own independent queue (`'modal'`) instead, for the spec's "Only
|
|
3094
|
+
one search modal on a page may enable it" — a `SearchBar` never contends for it. Every existing
|
|
3095
|
+
call site (`claimShortcut(token)`, with no second argument) keeps claiming the `'/'` queue
|
|
3096
|
+
unchanged, so `SearchBar.vue` and its tests needed no edit.
|
|
3097
|
+
- **Choosing a result or "See all" row closes the modal (`close('select')`); submitting the form
|
|
3098
|
+
with no active option does not.** The spec's own Enter bullet says an active option "follows the
|
|
3099
|
+
link **and closes the dialog**", but is silent on closing for a plain submit to the Search page —
|
|
3100
|
+
a deliberate asymmetry this component preserves rather than smooths over by closing on every
|
|
3101
|
+
route that leaves the field.
|
|
3102
|
+
- **No `dismissable` prop.** The spec gives this component no exception to "a backdrop click …
|
|
3103
|
+
closes it (desktop and tablet)" the way `Dialog`'s own `dismissable` is. Below 48rem there is no
|
|
3104
|
+
backdrop area to click in the first place (the dialog fills the viewport), so the parenthetical's
|
|
3105
|
+
own carve-out falls out of the full-screen layout for free, with nothing to gate in script.
|
|
3106
|
+
- **The full-screen-below-a-48rem-_viewport_ media query is three separate bundled utilities
|
|
3107
|
+
(`eldra-search-modal-width`/`-max-height`/`-position`), the same technique `eldra-drawer-width`
|
|
3108
|
+
already documents**, rather than one utility or a class-level arbitrary value — width, max-height
|
|
3109
|
+
and position are three different CSS properties a consumer can restyle independently through
|
|
3110
|
+
`classes.root`, but each one's own desktop number and its full-screen override must travel
|
|
3111
|
+
together, the same reasoning `eldra-drawer-width` gives for its own single bundled rule.
|
|
3112
|
+
- **The radius/border/shadow removed below 48rem is plain `max-md:rounded-none`/`border-0`/
|
|
3113
|
+
`shadow-none` on the root, not a fourth bundled utility.** Unlike the three geometry numbers
|
|
3114
|
+
above, these three are already independent, token-driven stock Tailwind groups with nothing of
|
|
3115
|
+
their own to interpolate — bundling them would only rename three existing groups into one that
|
|
3116
|
+
still has to be undone by a consumer restyling just one of them.
|
|
3117
|
+
- **The Close/Cancel button is two `<button>` elements sharing one `data-part="close"`, toggled by
|
|
3118
|
+
`hidden`/`md:hidden` rather than one element whose content and accessible name change with the
|
|
3119
|
+
viewport.** The spec draws two genuinely different controls at the two sizes — an icon-only
|
|
3120
|
+
button needing `aria-label="Close search"`, and a "Cancel" text button whose own visible text is
|
|
3121
|
+
already its accessible name — and an element hidden with `display: none` is already removed from
|
|
3122
|
+
the accessibility tree and the tab order, so exactly one of the two is ever reachable at a time
|
|
3123
|
+
with no JavaScript viewport tracking required. `classes.close` restyles both, since a consumer
|
|
3124
|
+
restyling "the close control" almost always means both of its sizes.
|
|
3125
|
+
- **`Carousel`'s `perView` reaches the CSS as three inline custom properties on the track, not as
|
|
3126
|
+
Tailwind classes** (`--eldra-carousel-per-view-base`/`-md`/`-lg`, written by
|
|
3127
|
+
`carouselPerViewStyle`; the `eldra-carousel-track` utility resolves them into
|
|
3128
|
+
`--eldra-carousel-per-view` per container-query breakpoint). This is a _fix_, not a preference
|
|
3129
|
+
(2026-09-27). The component used to build interpolated arbitrary-property classes
|
|
3130
|
+
(`` `[--eldra-carousel-per-view:${n}]` ``, plus `@tablet:`/`@content:` steps), and Tailwind has no
|
|
3131
|
+
runtime: it scans source _text_ for class names, and an interpolated value is never in that text.
|
|
3132
|
+
A consumer's build (`@import '@eldrajs/ui/tailwind.css'`, whose `@source './'` scans `dist/*.js`)
|
|
3133
|
+
therefore emitted no rule for any of the three, `eldra-carousel-slide`'s width formula fell back
|
|
3134
|
+
to its own `1`, and every carousel rendered one full-width slide — the starter's testimonials,
|
|
3135
|
+
product row, `split-carousel` hero and `carousel` gallery all at once. The package's own Storybook
|
|
3136
|
+
hid it, because its `@source '../src'` happens to scan the very `.vue` file whose template literal
|
|
3137
|
+
holds the pattern. An inline style needs no scanner, so the numbers stay fully dynamic while the
|
|
3138
|
+
compiled CSS stays entirely static; `src/__tests__/source-scan.spec.ts` compiles what a consumer's
|
|
3139
|
+
own stylesheet says, against `dist`, and asserts both container-query steps reach it. The
|
|
3140
|
+
guarantee generalises: **no class name in this package is ever built by interpolating a value.**
|
|
3141
|
+
- **`Breadcrumb` resolves a component `linkAs` to something focusable itself, rather than requiring
|
|
3142
|
+
the component to expose a `focus`.** The spec's "activating the ellipsis moves focus to the first
|
|
3143
|
+
revealed link" has to hold for a component `linkAs` (a `NuxtLink`/`RouterLink` wrapper — the shape
|
|
3144
|
+
most consumers pass), where Vue hands a `:ref` callback the component's _public instance_, not its
|
|
3145
|
+
root element. The component now prefers an exposed `focus()` when there is one — a wrapper may
|
|
3146
|
+
have a better target in mind than its own root — and otherwise falls back to the instance's `$el`,
|
|
3147
|
+
guarded by its own `focus` check so a fragment root (whose `$el` is a comment node) is a no-op
|
|
3148
|
+
rather than a throw. Before this (fixed 2026-09-27) the ref was cast straight to `HTMLElement`,
|
|
3149
|
+
which reached a component's `focus` only when that component happened to expose one and did
|
|
3150
|
+
nothing at all otherwise: the guarantee was silently the consumer's, not the package's.
|
|
3151
|
+
- **A `classes` part given an array is flattened, and warned about once per component and part in
|
|
3152
|
+
dev.** `classes` is one class string per part, and TypeScript says so — but a JavaScript consumer,
|
|
3153
|
+
a `v-bind` of an untyped object and a value out of JSON all reach `partClass` anyway, and
|
|
3154
|
+
`Object.entries(['flex', 'gap-4'])` reads an array's _indices_, so an array used to render
|
|
3155
|
+
`class="0 1"`: two classes that style nothing, in place of the two that were written. `cx` now
|
|
3156
|
+
flattens one the way Vue's own `:class` array syntax does, and `partClass` names the component and
|
|
3157
|
+
the part in a single dev `console.warn` (`import.meta.env.DEV`, so production carries neither the
|
|
3158
|
+
message nor the check). The component name comes from `getCurrentInstance()`, which is set while a
|
|
3159
|
+
component renders — where every `classes` computed is first evaluated — so no call site had to
|
|
3160
|
+
change.
|
|
3161
|
+
- **`formatDate` takes an `Intl.DateTimeFormatOptions` subset as a third argument**
|
|
3162
|
+
(`FormatDateOptions`: `day`, `month`, `year`, `weekday`), with every omitted key keeping the
|
|
3163
|
+
spec's own `12 Sep 2026` default rather than dropping that part from the output — so
|
|
3164
|
+
`{ month: 'long' }` is a one-key change to the long form. The spec describes one rendering of one
|
|
3165
|
+
date; a block that needs two (the starter's `article` renders the long form for a wide block and
|
|
3166
|
+
the short one for a narrow, switched by a container query) would otherwise have to reach for
|
|
3167
|
+
`Intl.DateTimeFormat` directly and lose the ISO-parsing, invalid-date and never-throw guards this
|
|
3168
|
+
helper exists for. The never-throw contract extends to the options themselves: `Intl` throws a
|
|
3169
|
+
`RangeError` for a value outside its own enums, and this runs inside a `computed`, so a bogus
|
|
3170
|
+
value falls back to the default style and warns once in dev instead.
|
|
3171
|
+
- **`VariantPicker` takes a `legend` prop separate from `name`.** The spec's Properties table gives
|
|
3172
|
+
`name` two jobs — the radios' shared native `name` _and_ the visible legend — which a page
|
|
3173
|
+
rendering more than one picker cannot satisfy at once: giving each picker a unique group key
|
|
3174
|
+
(`size-<sku>`, a `useUiId()` value) so their radios don't join one group also printed that key
|
|
3175
|
+
above the pills and, because a `<fieldset>`'s `<legend>` is the group's accessible name, read it
|
|
3176
|
+
out to a screen reader. `legend` is what a shopper reads, `name` stays the grouping key, and
|
|
3177
|
+
`name`'s own behaviour is unchanged whenever `legend` is absent — so every caller written against
|
|
3178
|
+
the spec's single-prop shape keeps working.
|