@eldrajs/ui 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +114 -3
- package/dist/{VariantPicker-CKw8hmxt.js → VariantPicker-CqDAtSju.js} +208 -167
- package/dist/componentNames.d.ts +1 -1
- package/dist/components/image/types.d.ts +2 -2
- package/dist/components/nav-menu/NavMenu.vue.d.ts +58 -0
- package/dist/components/nav-menu/NavMenuPanel.vue.d.ts +32 -0
- package/dist/components/nav-menu/navLinks.d.ts +27 -0
- package/dist/components/nav-menu/navMenuKeys.d.ts +17 -0
- package/dist/components/nav-menu/types.d.ts +62 -0
- package/dist/components.css +5468 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +984 -158
- package/dist/messages/en-US.d.ts +8 -0
- package/dist/messages/is-IS.js +4 -0
- package/dist/resolver.js +1 -0
- package/dist/style.css +552 -205
- package/dist/tailwind.css +221 -117
- package/dist/utils/sizes.d.ts +2 -0
- package/dist/vee-validate.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,9 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
+
- **`NavMenu`** — the header navigation: top-level links, and buttons opening a `dropdown` panel or a `mega` panel of columns (entries with `description`, `badge`, `current`, `newTab`). Disclosure pattern: `Enter`/`Space` open, `Tab` walks through, `Escape` closes and returns focus, an outside click or focus leaving closes, one panel at a time; plus the APG arrow keys (`←`/`→`/`Home`/`End` along the bar, `↓`/`↑` into and through a panel, never wrapping). Optional `openOnHover`, opening after a 150ms rest and closing 150ms after the pointer leaves; a closing panel fades out. Below `collapseBelow` (default `lg`; also `md`, `xl`, the container breakpoints `@tablet`/`@content`/`@wide`, `never` and `always`) it becomes a menu button and a left `Drawer` with accordion rows. Takes a resolved Studio link tree as it is. `variant`: `ghost` (default; text colour with a fill on hover and while open) or `muted` (muted text turning the text colour on hover, while open and on the current page, no fill), for the bar and its panels alike. `linkAs`, `classes`, slots `panelItem`/`groupHeading`/`panelFooter`/`toggle`/`drawerFooter`, `v-model` (open panel) and `v-model:drawerOpen`, exposed `close()`. New messages `navMenuLabel`, `navMenuOpen`, `navMenuDrawer`, `navMenuOverview`; new CSS variables `--eldra-nav-menu-offset`, `--eldra-nav-menu-dropdown-min`/`-max`, `--eldra-nav-menu-column-min`.
|
|
11
|
+
- **`@eldrajs/ui/components.css`** — `style.css` without Tailwind's preflight, whose reset reached every element on the page (rich-text headings, lists, links and paragraphs lost their browser defaults). Same theme and utilities; the reset only touches elements inside a component: every component's outermost element, and every panel, bubble or toast region it teleports, now carries the public `data-eldra-ui` marker, and the reset reaches those and the `data-part` elements within them, so a site's own `data-part` elements (Ark UI and Zag included) keep their defaults. `Rating`'s stars, `FilterPanel`'s colour ring, `SearchBar`'s no-results text and `SearchModal`'s key hints no longer lean on the global reset, so they draw the same under either stylesheet.
|
|
12
|
+
- **`zoomSizes(sizes, zoom)`** — multiplies every length in an `<img sizes>` list by `zoom`, keeping its media conditions (`(min-width: 1024px) 50vw, 100vw` at zoom 3 is `(min-width: 1024px) calc(50vw * 3), calc(100vw * 3)`); a zoom of 1 or less, `auto` and a size-less condition are left as given. What `Image` now does to its own `sizes`, for a renderer that draws a zoomed crop itself.
|
|
10
13
|
- **`Breadcrumb`'s `structuredData` prop** (default `true`, so nothing changes by default). `false` omits the component's own `BreadcrumbList` JSON-LD `<script>`, for a page whose theme already writes one at page level (`@eldrajs/theme-core`'s `buildBreadcrumbLd`); two on one page is duplicate markup.
|
|
11
14
|
- **`RangeSlider`** — the design spec's new "Range slider" section: two thumbs on one track for a numeric span, `modelValue: [number, number]` that cannot cross, `min`/`max`/`step`/`largeStep`, an optional `inputs` row of typed min / "to" / max fields, `formatValue` for every number the control speaks or prints, `disabled`, `label` with `minLabel`/`maxLabel` for the two ends, per-part `classes` and the `messages` prop (five new keys: `minimum`, `maximum`, `minimumOf`, `maximumOf`, `to`). Each thumb is a `role="slider"` reporting **its own** limits — the minimum thumb's `aria-valuemax` is the maximum thumb's current value — with an `aria-valuetext` run through `formatValue`, so a price filter announces "$1,200" rather than "1200", and both ends are their own tab stop because both have to be reachable. `←`/`↓`/`→`/`↑` move by `step`, `Shift` with any of them and `PageUp`/`PageDown` by `largeStep`, `Home`/`End` to the focused thumb's own limits. A pointer press anywhere on the rail moves the **nearer** thumb and keeps dragging it, parking it against its neighbour rather than swapping; the rail is `target-touch` tall below its container's tablet width (`target-min` from it) and each thumb's hit area follows. A typed value commits on **blur or `Enter` only**, never on a keystroke, snapped and clamped to the bounds and to the other thumb, with an emptied field falling back to that end of the range. `update:modelValue` reports every move, `change` once the move is over (pointer release, key release, field commit, and a pointer capture lost without either) — the one anything that costs a request should listen to. The typed fields are the same box as `Input`, in the same states, drawn from the shared field recipes rather than a copy of them, and they ask for the decimal keypad when the step has fraction digits. A slider nobody binds `v-model` to **follows its bounds** until something moves it, so a price filter whose `facets.price` arrives after the first render spans the catalogue instead of collapsing at its cheapest product; a `max` below `min` is treated as an empty range at `min` (with a dev-only warning) rather than reporting a value outside its own thumb limits. Both bounds are stops of their own alongside the step grid, so a catalogue's off-grid highest price can still be chosen, and every result is rounded to the digits the step is written with (a `0.1` step twenty times is `2`, not `1.9999999999999998`).
|
|
12
15
|
- **`RangeSlider`'s `inputs` slot** — the typed min / "to" / max row is replaceable, and the value is not. A store filtering by price wants its *own* currency field (the symbol, the store's grouping, the caret behaviour a money field has), which the built-in generic number fields cannot be without this package deciding a consumer's money formatting for them. The slot is handed `{ value, min, max, step, disabled, labels, commit }`: `labels` is the two names the thumbs already carry plus the word between the fields (name a replacement field with the same string its thumb uses, or a screen reader hears two names for one end), and `commit(end, next)` — `end` being `0` or `1` — applies that end exactly as a built-in field's blur does: snapped to the step grid, clamped to `[min, max]`, clamped against the other thumb, then `change` emitted once. It returns the number actually applied, which is what a controlled field should show (the parent has not written back yet, and an `Enter` commit leaves the field focused), and `null` is an emptied field, falling back to that end of the range. Call it on **blur or `Enter`**, never per keystroke — a commit per character would snap and clamp a half-typed number. The built-in fields are the slot's default content, so nothing changes for a consumer that does not fill it, and the `inputs` prop still decides whether the row exists at all. New exported types: `RangeSliderInputsSlotProps`, `RangeSliderEnd`.
|
|
@@ -82,6 +85,9 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
82
85
|
|
|
83
86
|
### Fixed
|
|
84
87
|
|
|
88
|
+
- **`Image` with a `zoom` above 1 is sharp.** Under `fit: 'cover'` (the default) it multiplies every length in its effective `sizes` (the prop, else `media.sizes`) by the zoom, so the browser picks a `srcset` candidate for the magnified crop rather than for the frame, whose variant was up to `zoom` times too narrow. Write `sizes` for the frame as before; `fit: 'contain'` and a zoom of 1 leave it unchanged. See `docs/images.md`, "An art-directed crop".
|
|
89
|
+
- **A weight utility beside a type style now applies.** Most `text-*` type styles set the `font` shorthand, which Tailwind cannot place in its property order and so emits after every `font-*` weight utility: `text-body font-medium` rendered at 400. The type styles now set longhands and read their weight as `var(--tw-font-weight, <token>)`, so the weight utility wins in any order, a consumer's `classes` weight override included. Visible changes, each now the weight the component asks for: `NavMenu`'s bar entries and panel labels (500) and panel overview link (600); `Breadcrumb`'s current page (500) and ellipsis (600); `Rating`'s value, `Toast`'s action, `EditorPlaceholder`'s label, the search results' **See all** row, a selected single-`Select` option and a warning/danger option meta, `FilterPanel`'s checked colour and list labels (600); `SearchModal`'s **Cancel** and a selected `MultiSelect` option (500). `tabular-nums` beside a type style is no longer reset either: `QuantityStepper`'s value, `RadioGroup`'s card meta, the compact `Pagination` and the `CurrencyInput`/`UnitInput`/`RangeSlider` fields now print tabular figures. `LoadMore`'s button drops a `font-medium` the shorthand used to hide, so it stays at the outline button's 600.
|
|
90
|
+
- **`cx` merges the kit's own theme keys.** `shadow-float` and the `narrow`/`content`/`wide`/`tablet`/`two-col` container widths (`w-*`, `min-w-*`, `max-w-*`, `basis-*`) were unknown to `tailwind-merge`, so `cx('shadow-md', 'shadow-float')` kept both and a `classes` override landed beside the default instead of replacing it.
|
|
85
91
|
- **`Lightbox`** — the image sits centred with equal space above and below. Without a thumbnail strip the stage now has bottom padding matching the bar's height (4rem, 4.25rem below 48rem), where the image used to run to the bottom edge of the viewport.
|
|
86
92
|
- **`Drawer`** — the open dialog stretches between its pinned top and bottom edges instead of taking `100%` of the layout viewport, so a foot pinned to the panel's bottom edge (the filter drawer's **Clear all** / **Show N products**, the cart's **Check out**) sits at the bottom of the visible area on a phone — not under the browser's toolbar, and not above a strip of page.
|
|
87
93
|
- **`Tabs` no longer clips a focused pill's focus ring at the scrolling list's edge.** The tab list is `overflow-x-auto`, which forces `overflow-y` to compute `auto` as well, so it clips anything a tab paints outside its own border box — on every side, not just the two it scrolls on. The design spec's answer is padding on the list with a matching negative margin, and that was written as the literal `0.25rem` the two ring tokens add up to by default, leaving the ring flush against the clip edge with no slack: raise `--eldra-focus-offset` or `--eldra-focus-width` — a restyle, or simply a `Tabs` inside a `Carousel` slide, since the track sets `--eldra-focus-offset: 4px` and custom properties inherit — and the ring was cut off flat by the difference on three edges at once. The reservation is now `calc(var(--eldra-focus-offset) + var(--eldra-focus-width))`, per axis, with `scroll-padding` to match so the inline half cannot be scrolled out of the visible box; the list's rendered footprint is unchanged. The underline variant is untouched and reserves nothing, its tabs carrying the spec's own inset ring. Measured in a real browser with real `Tab` presses, in pixels (`tabsRing.browser.spec.ts`) — it needs Chromium, like the kit's other browser specs.
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ entry needs it, and nothing else in the package imports it.
|
|
|
27
27
|
|
|
28
28
|
## Styles
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Four CSS entries ship; pick the one that matches how the consumer builds CSS. Every one of them
|
|
31
31
|
starts from the same `--eldra-*` variables, so nothing here is a different theme, only a different
|
|
32
32
|
delivery shape.
|
|
33
33
|
|
|
@@ -47,6 +47,15 @@ delivery shape.
|
|
|
47
47
|
@import '@eldrajs/ui/tailwind.css';
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
The type styles (`text-body`, `text-h2`, …) set longhands, never the `font` shorthand, and read
|
|
51
|
+
their weight as `var(--tw-font-weight, <token>)`, the declaration Tailwind writes for its own
|
|
52
|
+
`--text-*--font-weight`. So a `font-medium`/`font-semibold` beside one wins whatever order the two
|
|
53
|
+
compile in, and a `tabular-nums` beside one is no longer reset. A base-layer
|
|
54
|
+
`@apply font-*` sets `--tw-font-weight` as well, so it reaches a type style on the same element.
|
|
55
|
+
Line height and tracking are plain longhands on purpose: the starter's own base rule
|
|
56
|
+
(`h1`–`h4` `@apply leading-[1.1] tracking-tight`) would otherwise override every heading's type
|
|
57
|
+
style.
|
|
58
|
+
|
|
50
59
|
- **`@eldrajs/ui/style.css`** — the package's own compiled build of `tailwind.css` plus every
|
|
51
60
|
component's utilities, for a consumer with no Tailwind build of their own:
|
|
52
61
|
|
|
@@ -57,6 +66,43 @@ delivery shape.
|
|
|
57
66
|
This is also what a project whose own Tailwind build cannot share this package's utility prefix
|
|
58
67
|
(a `ui:`-prefixed theme, for example) reaches for.
|
|
59
68
|
|
|
69
|
+
- **`@eldrajs/ui/components.css`** — `style.css` without Tailwind's preflight, for a site that has
|
|
70
|
+
its own stylesheet and adds a few components (a header menu, a cart drawer) to it:
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
@import '@eldrajs/ui/components.css';
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Preflight is a reset for the **whole page**: `style.css` sets every `h1`–`h6` to the surrounding
|
|
77
|
+
size and weight, every `ul`/`ol` to no bullets and no indent, every `a` to the surrounding colour
|
|
78
|
+
with no underline, every `p` and heading to no margin, and every `button` to no border or fill.
|
|
79
|
+
It sits in `@layer base`, so a site's own rules still win where they exist, but anything the site
|
|
80
|
+
left to the browser — rich text from the CMS, most often — loses its defaults. `components.css`
|
|
81
|
+
carries the same theme and the same utilities, byte for byte, and narrows the reset to the
|
|
82
|
+
elements the components render themselves, so the site's own elements keep the browser's
|
|
83
|
+
defaults and anything passed into a component's slot keeps the site's styling. Use `style.css`
|
|
84
|
+
when the page is built from this package; use `components.css` when the page is the site's own.
|
|
85
|
+
`src/styles/__tests__/componentsCss.browser.spec.ts` renders every component family under both,
|
|
86
|
+
the overlays open, and requires identical pixels.
|
|
87
|
+
|
|
88
|
+
**The `data-eldra-ui` marker.** Every component's outermost element carries `data-eldra-ui`, and
|
|
89
|
+
so does every element a component renders outside it: a `Select` or `MultiSelect` panel, a
|
|
90
|
+
`SearchBar` results panel, a `Popover` panel, a `Tooltip` bubble and the `Toaster` region, each
|
|
91
|
+
teleported out of its component. The reset reaches exactly those elements and the `data-part`
|
|
92
|
+
elements inside them, `:where([data-eldra-ui], [data-eldra-ui] [data-part])`, at zero
|
|
93
|
+
specificity. `data-part` alone is not enough, because it is not this package's name: a site's
|
|
94
|
+
own `<h2 data-part="title">`, or any Ark UI or Zag component (which put `data-part` on every
|
|
95
|
+
element they render), keeps the browser's defaults. The attribute is public and stable, so a
|
|
96
|
+
site can use it as a hook too (`a:not([data-eldra-ui], [data-eldra-ui] *)` keeps a site's global
|
|
97
|
+
link rule out of the components). One case stays inside the scope: an element carrying its own
|
|
98
|
+
`data-part` that the site passes into a component's slot (an Ark UI widget inside a `Dialog`,
|
|
99
|
+
say) is a `data-part` element inside a marked root, so it gets the reset as well.
|
|
100
|
+
|
|
101
|
+
Either way, the package's rules are in cascade layers and a site's **unlayered** rules beat them
|
|
102
|
+
regardless of specificity: a global `a { color: … }` or `button { font: … }` in the site's own CSS
|
|
103
|
+
restyles those elements inside the components too. Scope such rules (`.prose a`) or put the
|
|
104
|
+
site's stylesheet in a layer declared before the package's.
|
|
105
|
+
|
|
60
106
|
## Fonts
|
|
61
107
|
|
|
62
108
|
The type tokens' defaults are `--eldra-font-heading: "Bricolage Grotesque", ui-sans-serif,
|
|
@@ -115,6 +161,7 @@ Every component supports all five of these; none hard-codes anything a store mig
|
|
|
115
161
|
| `Link` | `--eldra-link-radius` (default `2px`) — the focus ring's corner radius on every variant |
|
|
116
162
|
| `LoadMore` | none — the status/meter/button sizes all reuse shared tokens (`text-body-sm`, `control-h`, `text-button-md`), no per-component variable |
|
|
117
163
|
| `LogoItem` | `--eldra-logo-image-max-height` (default `2.5rem`), `--eldra-logo-image-max-width` (default `9rem`) — the logo image's contain box; `--eldra-logo-wordmark-size` (default `1.25rem`) — the wordmark fallback's font size (its weight, line-height and letter-spacing reuse `h2`/`h3` tokens directly, see `text-logo-wordmark` in `tailwind.css`) |
|
|
164
|
+
| `NavMenu` | `--eldra-nav-menu-offset` (default `var(--eldra-space-2)`) — the gap between the bar and a panel, drawn as the panel's own top padding so a hovering pointer never leaves the menu; `--eldra-nav-menu-dropdown-min`/`-max` (defaults `14rem`/`24rem`, capped at `100vw - 2rem`) — a dropdown panel's width; `--eldra-nav-menu-column-min` (default `12rem`) — the narrowest a mega panel's column gets before the grid wraps (`classes.columns: 'grid-cols-5'` fixes the count instead). The drawer, its accordion rows and the badges are `Drawer`, `AccordionItem` and `Badge`, each restyled through its own row |
|
|
118
165
|
| `MultiSelect` | everything `Select` reads, plus `--eldra-select-pill-line` (the "+N" pill's line box) and `--eldra-checkbox-radius`/`--eldra-checkbox-border-width`, shared with `Checkbox` so a consumer restyles both at once |
|
|
119
166
|
| `Pagination` | none — every size (the 2.5rem page link/`control-h` previous-next, the `target-touch` compact arrows, the 0.9375rem `text-control` compact status) reuses a shared token or a shared arbitrary spacing multiple, no per-component variable |
|
|
120
167
|
| `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 |
|
|
@@ -161,7 +208,10 @@ Every component supports all five of these; none hard-codes anything a store mig
|
|
|
161
208
|
`<Name>Part` type and its Storybook docs page for the exact list). Values merge onto that part's
|
|
162
209
|
own classes with `tailwind-merge` (via this package's own `cx`, also exported for a consumer
|
|
163
210
|
composing a wrapper the same way), so `classes.root: 'rounded-full'` replaces
|
|
164
|
-
`eldra-button-radius` instead of landing beside it.
|
|
211
|
+
`eldra-button-radius` instead of landing beside it. The `@theme` keys that are not t-shirt sizes
|
|
212
|
+
(`shadow-float`, the `narrow`/`content`/`wide`/`tablet`/`two-col` container widths) merge the
|
|
213
|
+
same way, and a weight is never a conflict with a type style: `classes.label: 'font-bold'` keeps
|
|
214
|
+
`text-body-sm` and changes only the weight.
|
|
165
215
|
4. **A slot for every part that holds content** (`label`, `description`, `error`, `leading`,
|
|
166
216
|
`trailing`, `empty`, `header`, `footer`, `item`, …), named after the part it replaces.
|
|
167
217
|
5. **`as`**, on the components whose spec allows a different rendered _root_ element (`Button`,
|
|
@@ -170,7 +220,7 @@ Every component supports all five of these; none hard-codes anything a store mig
|
|
|
170
220
|
to `<span>` and is never a link; `Section` picks `<section>`/`<div>` itself from whether it is
|
|
171
221
|
named (`as` overrides that choice outright, for a `<header>`/`<footer>` landmark that needs no
|
|
172
222
|
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
|
|
223
|
+
`Breadcrumb`/`Pagination`/`NavMenu`: each of these has a spec-fixed root (`<article>`/`<div>`/`<nav>`), and
|
|
174
224
|
`linkAs` instead picks the element for a _nested_ part — the stretched title link on the cards,
|
|
175
225
|
every level's link on `Breadcrumb`, a page/previous/next control on `Pagination` — so the name
|
|
176
226
|
never collides with the root-tag meaning `as` carries everywhere else (a string still takes
|
|
@@ -1151,6 +1201,13 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
|
|
|
1151
1201
|
- **`frameAspectRatio`** (`src/utils/ratio.ts`) — turns an `ImageRatio` preset into the CSS
|
|
1152
1202
|
`aspect-ratio` value `Image`'s frame and `Skeleton`'s `media` variant both resolve it to; exported
|
|
1153
1203
|
so a consumer accepting an `ImageRatio` of their own (`ImageRatio` itself is public) can honour it.
|
|
1204
|
+
- **`zoomSizes(sizes, zoom)`** (`src/utils/sizes.ts`) — multiplies every length in an `<img sizes>`
|
|
1205
|
+
list by `zoom`, keeping its media conditions: `(min-width: 1024px) 50vw, 100vw` at zoom 3 becomes
|
|
1206
|
+
`(min-width: 1024px) calc(50vw * 3), calc(100vw * 3)`. `Image` applies it to its effective `sizes`
|
|
1207
|
+
whenever `fit` is `cover` and `zoom` is above 1, because a crop scaled by `transform: scale(zoom)`
|
|
1208
|
+
is drawn that many times wider than the frame `sizes` describes, and a `srcset` candidate chosen
|
|
1209
|
+
for the frame is soft. A zoom of 1 or less, `auto` and a size-less media condition are left as
|
|
1210
|
+
given. See [An art-directed crop](../../docs/images.md#an-art-directed-crop).
|
|
1154
1211
|
- **`formatDate`** (`src/utils/date.ts`) — the ISO-date formatter behind `ContentCard`'s `date` prop.
|
|
1155
1212
|
Never throws: a malformed, empty or calendar-invalid value (`'2026-02-30'`) returns `null` rather
|
|
1156
1213
|
than a fabricated date or a thrown `RangeError`, warning once per bad value in dev.
|
|
@@ -1199,6 +1256,60 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
|
|
|
1199
1256
|
inside), but `tabRedirect` is always on, since a menu's rows or a filter form's fields are exactly
|
|
1200
1257
|
the real tab stops that behaviour exists for.
|
|
1201
1258
|
|
|
1259
|
+
- **`NavMenu`** — a site header's navigation (2026-10-22), because every Eldra site was
|
|
1260
|
+
hand-building its header and dropdowns. Spec 1 names mega-menus only to say they are non-modal
|
|
1261
|
+
popups, not dialogs, and puts the mobile menu in a left `Drawer` with accordion rows; this
|
|
1262
|
+
follows both. It is the disclosure-navigation pattern, not an ARIA menu: a top-level entry with
|
|
1263
|
+
children is a `<button aria-expanded aria-controls>` and its panel follows it in the DOM, so `Tab`
|
|
1264
|
+
walks straight into the panel and on to the next entry, the panel closes when focus or a pointer
|
|
1265
|
+
press lands outside it (`useOverlay`, unchanged), `Escape` closes it and returns focus to the
|
|
1266
|
+
button, following a link closes it, and one panel is open at a time. On top of that it takes the
|
|
1267
|
+
APG pattern's optional arrow keys, ported from the starter's header: `←`/`→` move along the bar
|
|
1268
|
+
(landing on another trigger carries an open panel over to it), `Home`/`End` jump to its ends,
|
|
1269
|
+
`↓`/`↑` on a trigger open its panel at the first or last link, and inside a panel `↓`/`↑` step
|
|
1270
|
+
through its links and `Home`/`End` reach its ends. Nothing wraps, every link stays in the `Tab`
|
|
1271
|
+
order, and a modified key or a key typed into a field is left alone. `Enter`/`Space` stay the
|
|
1272
|
+
button's own. Panels are never teleported:
|
|
1273
|
+
a `dropdown` hangs under its own item, a `mega` panel spans the menu's root, and a site whose
|
|
1274
|
+
header should be the panel's width makes the root `static` (`classes.root`) and its header
|
|
1275
|
+
`relative` (or `contents`, which makes the bar and the menu button cells of the header's own
|
|
1276
|
+
grid). A closing panel fades out over `--eldra-duration-fast`, unclickable while it does.
|
|
1277
|
+
`openOnHover` adds a resting mouse pointer to the ways of opening: a panel opens after the
|
|
1278
|
+
pointer rests 150ms on its trigger, so passing over one opens nothing; leaving the menu closes a
|
|
1279
|
+
hover-opened panel 150ms later unless the pointer comes back or focus is inside it; a click keeps
|
|
1280
|
+
it, and touch never hovers.
|
|
1281
|
+
|
|
1282
|
+
**Data.** `items` takes `{ label, href?, newTab?, description?, badge?, group?, current?,
|
|
1283
|
+
children?, layout? }`, one level of children. Children sharing a `group` form a column under that
|
|
1284
|
+
heading, and grouped children default the panel to `mega`. The shape is the one
|
|
1285
|
+
`@eldrajs/theme-core`'s `resolveLink` returns for a Studio link tree — `href`, `label` and `group`
|
|
1286
|
+
may be `null`, a heading with no `href` opens a panel and links nowhere, an entry without a label
|
|
1287
|
+
is skipped — so a resolved tree is passed in as it is, with no dependency on the theme packages
|
|
1288
|
+
(`navLinks.spec.ts` asserts the assignability). A top-level entry with both `href` and children
|
|
1289
|
+
gets its own page as the panel's first link ("Journal: overview"). A `panelFooter` that renders
|
|
1290
|
+
nothing for a panel takes no room in it (`empty:hidden`), and a menu with no entry to show draws
|
|
1291
|
+
no empty `<nav>`.
|
|
1292
|
+
|
|
1293
|
+
**Narrow screens.** Below `collapseBelow` the bar is hidden and a menu button
|
|
1294
|
+
(`aria-controls` the drawer) opens a left `Drawer`, each panel an `AccordionItem` and each plain
|
|
1295
|
+
entry a row. `md`, `lg` (default) and `xl` are **viewport** breakpoints, since the menu's own width
|
|
1296
|
+
says nothing about how crowded the header is; `@tablet`, `@content` and `@wide` measure the nearest
|
|
1297
|
+
`@container` instead, for a header block whose own width is the measure; `never` keeps the bar and
|
|
1298
|
+
`always` shows only the button. The button is named by `messages.navMenuOpen` and the drawer by
|
|
1299
|
+
`messages.navMenuDrawer` (both "Menu"). `v-model` is the open panel's index and
|
|
1300
|
+
`v-model:drawerOpen` the drawer; `close()` (exposed) closes both, for a router's navigation hook.
|
|
1301
|
+
|
|
1302
|
+
**Variants.** `variant` names the two common looks, each after the component that already has
|
|
1303
|
+
it: `ghost` (default) is `Button`'s ghost — text colour, the same 6% text fill on hover and while
|
|
1304
|
+
a panel is open — and `muted` is `Link`'s muted tone — muted text turning the text colour on
|
|
1305
|
+
hover, while open and on the current page, with no fill, for a header of quiet text links. Both
|
|
1306
|
+
reach the panels' links; neither changes the weight, so nothing shifts as a panel opens; the
|
|
1307
|
+
current page keeps its underline in both, since colour alone cannot mark it. The drawer's rows
|
|
1308
|
+
are the same under either. Spacing, size and type are left to `classes`.
|
|
1309
|
+
|
|
1310
|
+
`classes.badge`, `drawer`, `drawerTrigger`, `drawerPanel` and `drawerFooter` restyle the composed
|
|
1311
|
+
`Badge`, `Drawer` and `AccordionItem`, which keep their own `data-part` names.
|
|
1312
|
+
|
|
1202
1313
|
- **`narrowSymbol` on `Price`, and `Price` formatting through `formatCurrency`** — `false` by
|
|
1203
1314
|
default, the same default `CurrencyInput` carries, so every currency this package renders is
|
|
1204
1315
|
written with the currency's **wide** sign: `"ISK 2,800"` under `en-US`/`ISK`, not `"kr 2,800"`,
|