@eldrajs/ui 0.3.21 → 0.3.22
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 +18 -0
- package/README.md +8 -0
- package/dist/{PhoneInput-f6wxvduD.js → PhoneInput-D_z9MuDw.js} +1 -1
- package/dist/{VariantPicker-CCci26If.js → VariantPicker-DgDBOM-w.js} +4 -4
- package/dist/components/currency-picker/CurrencyPicker.vue.d.ts +27 -1
- package/dist/components/currency-picker/types.d.ts +2 -1
- package/dist/components/nav-menu/NavMenu.vue.d.ts +3 -2
- package/dist/components/nav-menu/NavMenuDrawerList.vue.d.ts +39 -0
- package/dist/components/nav-menu/navLinks.d.ts +9 -0
- package/dist/components/nav-menu/types.d.ts +22 -2
- package/dist/components/product-card/ProductCard.vue.d.ts +6 -0
- package/dist/components/product-card/types.d.ts +25 -2
- package/dist/components.css +45 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +697 -329
- package/dist/phone/vee-validate.js +3 -3
- package/dist/phone.js +1 -1
- package/dist/style.css +45 -0
- package/dist/{useFieldControl-BnO3B37W.js → useFieldControl-D_h1RWyU.js} +1 -1
- package/dist/{useOptionList-UMUMayec.js → useOptionList-DuAKag8J.js} +1 -0
- package/dist/utilities.css +23 -0
- package/dist/vee-validate.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,8 +5,20 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- `Accordion`: opening an item no longer shows its panel fully open for a frame before it animates. The click opens the `<details>` and starts the height animation in the same task, instead of waiting for the browser's later `toggle`, which a busy page could paint before.
|
|
11
|
+
- `Select` and `MultiSelect`: the chevron's icon fills its `chevron` part instead of keeping a fixed 18px, so `classes.chevron` resizes it and an open picker's chevron turns about its own centre (it used to overflow a smaller part and shift as it rotated).
|
|
12
|
+
|
|
8
13
|
### Added
|
|
9
14
|
|
|
15
|
+
- **`NavMenuLink.current` takes `'true'` (WS-1468).** `current: 'true'` (or `'page'`, same as `true`) sets `aria-current="true"` on an entry that holds the current page without being it, such as a category's ancestor; a top-level trigger with a panel carries `aria-current` too. `containsCurrent` reads every value; new helper `currentMark` in `navLinks`.
|
|
16
|
+
- **`NavMenu` link descriptions are a description, not part of the name (WS-1464).** A linked panel entry with a `description` is named by its label (and the hidden new-tab text) through `aria-labelledby` and described by the description through `aria-describedby`; an entry without one carries neither and draws no empty element. The drawer shows the descriptions too.
|
|
17
|
+
- **`ProductCard` theme wording and order (WS-1277).** New props `vendorPlacement` (`'above'`, the default, or `'below'`: the vendor line after the price), `maxSwatches` (dots before "+N", default `3`), `saleBadgeLabel` (text in place of the "−20%" percentage), `quickAddLabel`, `quickAddName` (the visible text and the full accessible name of quick add, defaulting to the messages as before) and `quickAddIcon` (a leading icon). New parts `saleBadge`, `newBadge`, `soldOutBadge` (each badge's root) and `quickAddLabel` (the button's label, to hide the word on narrow cards while the name stays). Defaults unchanged.
|
|
18
|
+
- **`NavMenu` `drawerMode: 'inline'` (WS-1277).** The narrow-screen menu opens as a disclosure under the bar instead of the modal side sheet (`sheet`, still the default): it hangs from the menu's positioning box as a mega panel does (make the root `static` to hang it from a whole header), fills the window below its top edge and scrolls on its own, with the entries and then the `drawerFooter` slot, which sits at the bottom of the window while the entries are shorter than it (the drawer is `100dvh` tall, so the foot rises with a phone's browser toolbars) and pads its bottom by the device's safe area. It opens the same way as the bar's panels (`duration-base`) and closes back up (`duration-fast`). Its button toggles it, keeps `aria-expanded`/`aria-controls` without `aria-haspopup`, and while open is named by the `close` message and draws an × (the `toggle` slot already gets `open`). No focus trap: `Escape` closes it and puts focus back on the button, and a press outside or focus leaving it closes it, so focus never walks into the page it covers. The `drawer`, `drawerBody` and `drawerFooter` parts style it; `drawerHeader` is the sheet's only. New type `NavMenuDrawerMode`.
|
|
19
|
+
- **`NavMenuLink.tone` (WS-1277).** `'accent'` draws a top-level entry in the accent colour in every state, in the bar and as a drawer row (a "Sale" link), and the entry carries `data-tone`. New type `NavMenuTone`.
|
|
20
|
+
- **`NavMenu` panels carry `data-layout`** (`dropdown` or `mega`) on the `panel` and `content` parts, so a theme can style a dropdown apart from a mega panel. `NavMenuSection` is now exported.
|
|
21
|
+
- **`CurrencyPicker` slots `leading`, `value`, `optionContent` and `label`, and part `label` (WS-1277).** `leading`, `value` and `optionContent` are `Select`'s own, passed through, so a header can draw the closed picker as "Prices in ISK" with an icon and each row as the currency's name with its code apart: `value` gets `{ code, label }` and still defaults to the code, `optionContent` gets `{ code, currencyName, label, selected }`. With `showLabel`, the `label` slot replaces the label's content (an icon beside the words) and the `label` part styles it.
|
|
10
22
|
- **`parseAmount`, `readAmount` and `createAmountEditor`** (`src/utils/amount.ts`): the one amount parser and the format-while-typing editor behind `UnitInput` and `CurrencyInput`, for a consumer reading a typed or pasted amount the same way. Types `AmountReading`, `AmountText`, `AmountEdit`, `AmountEditor`, `AmountEditorOptions`, `AmountInvalidReason`.
|
|
11
23
|
- **`UnitInput` and `CurrencyInput` `fixedFraction`, `nullable` and `placeholder`**, the `update:valid` event, and `isValid` and `invalidReason` on the instance; `CurrencyInput` exposes the same three (WS-1390).
|
|
12
24
|
- **`FieldUnitInput` and `FieldCurrencyInput` fail on text they cannot read (WS-1390)**, before their `rules` run, so the form never submits the number the field held. New messages `amountNotANumber` ("Enter a number." / "Sláðu inn tölu.") and `amountNoDecimals` ("Enter a whole number." / "Sláðu inn heila tölu."). The check is a field rule, so a form-level `validationSchema` that replaces field rules does not see it.
|
|
@@ -99,6 +111,9 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
99
111
|
|
|
100
112
|
### Changed
|
|
101
113
|
|
|
114
|
+
- **`NavMenu` panels open from the bar (WS-1277).** Mega panels and dropdowns now show their top third at once and unroll the rest as they fade in and drop 0.25rem into place (`animate-eldra-menu-in`, `duration-base`), instead of playing the popover entrance, whose growth from the top-left corner read as the panel sliding in from the left.
|
|
115
|
+
|
|
116
|
+
- **`NavMenu` card pictures take their crop from `--eldra-nav-menu-card-aspect`** (set inline from `cardAspect`) through their own class, rather than an inline `aspect-ratio`, so a theme's class on `cardImage`/`drawerCardImage` can crop them differently (WS-1277).
|
|
102
117
|
- **`Autocomplete` shows a single suggestion whose label is exactly the text.** It kept the panel closed for it; shown, the row confirms what was typed, and the panel is there again when the field is focused again.
|
|
103
118
|
- **`@eldrajs/ui/vee-validate`: typed fields no longer revalidate while typing.** A `Field*` used to validate on every change of its value, so once it had been touched (or the form submitted) its message followed each keystroke. `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`, `FieldUnitInput` and `FieldSearchBar` now validate when they lose focus and when the form is submitted, and never in between: while a value is being typed no message appears, and a message already showing stays until the next blur or submit. The choice controls (`FieldCheckbox`, `FieldCheckboxGroup`, `FieldRadioGroup`, `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`, `FieldQuantityStepper`) keep validating on each change. The `Form`'s error summary and `errors` slot prop now change at the same moments as the fields. Set `validate-on-value-update` on a typed field to get the old live behaviour back.
|
|
104
119
|
- **`Drawer` opens and closes with a short slide and fade of its panel** instead of sliding the whole viewport-wide root in, and no longer closes instantly. Tune it with `--eldra-drawer-slide` (default `2rem`), `--eldra-drawer-enter-duration` (400ms) and `--eldra-drawer-exit-duration` (260ms); reduced motion fades only. The `animate-eldra-drawer-in-*` classes are no longer on the root.
|
|
@@ -181,6 +196,9 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
181
196
|
|
|
182
197
|
### Fixed
|
|
183
198
|
|
|
199
|
+
- **`NavMenu` marks one top-level entry as current (WS-1277).** A page that is its own entry and also a link in another entry's panel ("Ceramics" beside "Shop") marked both. The entry whose own link is the page wins; failing that, the first entry whose panel holds it.
|
|
200
|
+
|
|
201
|
+
- **`AccordionItem` no longer animates a panel that was open from the start (WS-1277).** The `toggle` a browser fires for a `<details>` created or hydrated open started the height animation from `0`, so every page load replayed the opening of an already open row, and where the page's animations did not advance (a background tab, a throttled preview iframe, a screenshot before the first frame) the panel stayed at height `0` with `overflow: hidden`, clipped, with the next row drawn over its content. Only a change of state animates now.
|
|
184
202
|
- **`UnitInput` and `CurrencyInput` read every amount with one parser (WS-1390).** A paste into a selection, autofill, a virtual keyboard or dictation, an IME composition and a decimal mark arriving without a key event are read like typing, so an amount is no longer read 10 to 1000 times off. The field still formats while typing, with the caret kept. A paste in the other convention is read (`1,000,000` into an Icelandic field is a million); a typed keystroke that would make the text unreadable is refused; text that cannot be read is kept and marked invalid instead of having its characters stripped. A currency without decimals (ISK) takes none, a `,00` tail is dropped and a non-zero fraction is invalid. An emptied field emits `min` (or `null` with `nullable`) at once instead of on blur. The keydown handling of `,`, `.`, Backspace, Delete and the arrow keys over separators is gone: deleting a separator deletes the digit beyond it.
|
|
185
203
|
|
|
186
204
|
- **`SearchBar` `autofocus` focuses after the page's own mount updates have rendered (WS-1277).** It focused inside `onMounted`, before updates other blocks queue in their mounted hooks had drawn, so the field was scrolled into view against a layout about to change and could end a pixel away from where the settled page puts it. It now focuses on the next tick.
|
package/README.md
CHANGED
|
@@ -1910,6 +1910,14 @@ children?, layout?, groups? }`, one level of children. Children sharing a `group
|
|
|
1910
1910
|
nothing for a panel takes no room in it (`empty:hidden`), and a menu with no entry to show draws
|
|
1911
1911
|
no empty `<nav>`.
|
|
1912
1912
|
|
|
1913
|
+
**Descriptions.** An entry's `description` is a muted second line under its label in a panel
|
|
1914
|
+
(`description` part, none when it is empty). A linked entry that has one is named by its label alone
|
|
1915
|
+
(`aria-labelledby` on the label and the hidden "opens in a new tab" text) and described by the
|
|
1916
|
+
description (`aria-describedby`), so a screen reader reads the title as the link's name. The
|
|
1917
|
+
drawer draws the same panel content, so the phone menu shows the descriptions too (deliberate: a
|
|
1918
|
+
link's one-line context is as useful on a phone, and the rows have the room). A `panelItem` slot
|
|
1919
|
+
replaces the entry and its ids; it is then up to the slot.
|
|
1920
|
+
|
|
1913
1921
|
**Narrow screens.** Below `collapseBelow` the bar is hidden and a menu button
|
|
1914
1922
|
(`aria-controls` the drawer) opens a left `Drawer`. `md`, `lg` (default) and `xl` are **viewport**
|
|
1915
1923
|
breakpoints, since the menu's own width says nothing about how crowded the header is; `@tablet`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as FIELD_KEY, W as FIELD_RADIUS, Y as FIELD_TEXT, d as useEldraUiLocale, i as SelectPanel_default, nt as joinIds, p as usePopover, r as useOptionList, rt as useUiId, tt as useControllableModel, y as useListbox } from "./useOptionList-
|
|
1
|
+
import { $ as FIELD_KEY, W as FIELD_RADIUS, Y as FIELD_TEXT, d as useEldraUiLocale, i as SelectPanel_default, nt as joinIds, p as usePopover, r as useOptionList, rt as useUiId, tt as useControllableModel, y as useListbox } from "./useOptionList-DuAKag8J.js";
|
|
2
2
|
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
3
3
|
import { i as enUS, r as useMessages } from "./useMessages-D8bTGX7c.js";
|
|
4
4
|
import { t as CountryFlag_default } from "./CountryFlag-DOa8lOHp.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as FIELD_KEY, A as ICON_STROKE_WIDTH$1, C as optionClass, D as optionSwatchClass, E as optionLabelClass, F as FIELD_CLEAR_BUTTON, G as FIELD_SEARCH_APPEARANCE, H as FIELD_PREFIX_PAD, I as FIELD_CLEAR_BUTTON_BOX, J as FIELD_SUFFIX_ROW_BASE, K as FIELD_SIZE, L as FIELD_CLEAR_SIZE, M as FIELD_ACTION_ROOM_REM, N as FIELD_BASE, O as panelClass, P as FIELD_BOX, Q as fieldState, S as listboxClass, T as optionIconClass, U as FIELD_PREFIX_ROW, V as FIELD_LIVE, W as FIELD_RADIUS, X as FIELD_TRAILING_PAD, Y as FIELD_TEXT, Z as FIELD_TRAILING_PAD_PAIR, b as TRIGGER_VALUE_CELL, d as useEldraUiLocale, et as mergeClass, f as Spinner_default, i as SelectPanel_default, j as FIELD_ACTION_PAIR_SIZE, k as ICON_SIZE_CLASS, n as matchRange, nt as joinIds, p as usePopover, q as FIELD_SUFFIX_ROW, r as useOptionList, rt as useUiId, tt as useControllableModel, w as optionHintClass, x as TRIGGER_VALUE_STACK, y as useListbox, z as FIELD_LEADING_ICON } from "./useOptionList-
|
|
1
|
+
import { $ as FIELD_KEY, A as ICON_STROKE_WIDTH$1, C as optionClass, D as optionSwatchClass, E as optionLabelClass, F as FIELD_CLEAR_BUTTON, G as FIELD_SEARCH_APPEARANCE, H as FIELD_PREFIX_PAD, I as FIELD_CLEAR_BUTTON_BOX, J as FIELD_SUFFIX_ROW_BASE, K as FIELD_SIZE, L as FIELD_CLEAR_SIZE, M as FIELD_ACTION_ROOM_REM, N as FIELD_BASE, O as panelClass, P as FIELD_BOX, Q as fieldState, S as listboxClass, T as optionIconClass, U as FIELD_PREFIX_ROW, V as FIELD_LIVE, W as FIELD_RADIUS, X as FIELD_TRAILING_PAD, Y as FIELD_TEXT, Z as FIELD_TRAILING_PAD_PAIR, b as TRIGGER_VALUE_CELL, d as useEldraUiLocale, et as mergeClass, f as Spinner_default, i as SelectPanel_default, j as FIELD_ACTION_PAIR_SIZE, k as ICON_SIZE_CLASS, n as matchRange, nt as joinIds, p as usePopover, q as FIELD_SUFFIX_ROW, r as useOptionList, rt as useUiId, tt as useControllableModel, w as optionHintClass, x as TRIGGER_VALUE_STACK, y as useListbox, z as FIELD_LEADING_ICON } from "./useOptionList-DuAKag8J.js";
|
|
2
2
|
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
3
3
|
import { r as useMessages } from "./useMessages-D8bTGX7c.js";
|
|
4
4
|
import { Comment, Fragment, Teleport, Text, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toValue, unref, useAttrs, useSlots, watch, watchPostEffect, withCtx, withModifiers } from "vue";
|
|
@@ -3990,7 +3990,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
3990
3990
|
class: normalizeClass(chevronClass.value),
|
|
3991
3991
|
"aria-hidden": "true"
|
|
3992
3992
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
3993
|
-
class: "eldra:size-
|
|
3993
|
+
class: "eldra:block eldra:size-full",
|
|
3994
3994
|
viewBox: "0 0 24 24",
|
|
3995
3995
|
fill: "none",
|
|
3996
3996
|
stroke: "currentColor",
|
|
@@ -5782,7 +5782,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
5782
5782
|
class: normalizeClass(chevronClass.value),
|
|
5783
5783
|
"aria-hidden": "true"
|
|
5784
5784
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
5785
|
-
class: "eldra:size-
|
|
5785
|
+
class: "eldra:block eldra:size-full",
|
|
5786
5786
|
viewBox: "0 0 24 24",
|
|
5787
5787
|
fill: "none",
|
|
5788
5788
|
stroke: "currentColor",
|
|
@@ -5798,7 +5798,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
5798
5798
|
class: normalizeClass(insideChevronClass.value),
|
|
5799
5799
|
"aria-hidden": "true"
|
|
5800
5800
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
5801
|
-
class: "eldra:size-
|
|
5801
|
+
class: "eldra:block eldra:size-full",
|
|
5802
5802
|
viewBox: "0 0 24 24",
|
|
5803
5803
|
fill: "none",
|
|
5804
5804
|
stroke: "currentColor",
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { CurrencyPickerProps } from './types.js';
|
|
2
|
-
declare const
|
|
2
|
+
declare const __VLS_template: () => {
|
|
3
|
+
__VLS_Slots: {
|
|
4
|
+
label?: (props: {}) => any;
|
|
5
|
+
} & {
|
|
6
|
+
leading?: (props: {}) => any;
|
|
7
|
+
} & {
|
|
8
|
+
optionContent?: (props: {
|
|
9
|
+
code: string;
|
|
10
|
+
currencyName: string;
|
|
11
|
+
label: string;
|
|
12
|
+
selected: boolean;
|
|
13
|
+
}) => any;
|
|
14
|
+
} & {
|
|
15
|
+
value?: (props: {
|
|
16
|
+
code: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}) => any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
22
|
+
declare const __VLS_base: import('vue').DefineComponent<CurrencyPickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
23
|
"update:modelValue": (code: string) => any;
|
|
4
24
|
}, string, import('vue').PublicProps, Readonly<CurrencyPickerProps> & Readonly<{
|
|
5
25
|
"onUpdate:modelValue"?: ((code: string) => any) | undefined;
|
|
@@ -13,5 +33,11 @@ declare const __VLS_export: import('vue').DefineComponent<CurrencyPickerProps, {
|
|
|
13
33
|
locale: string;
|
|
14
34
|
showLabel: boolean;
|
|
15
35
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
37
|
declare const _default: typeof __VLS_export;
|
|
17
38
|
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SelectPart } from '../select/types.js';
|
|
2
|
-
|
|
2
|
+
/** `label` is the visible label's, with `showLabel`. */
|
|
3
|
+
export type CurrencyPickerPart = 'root' | 'label' | SelectPart;
|
|
3
4
|
export interface CurrencyPickerProps {
|
|
4
5
|
/** ISO 4217 codes to offer, the store's own first. With fewer than two the picker renders nothing. */
|
|
5
6
|
currencies: readonly string[];
|
|
@@ -19,11 +19,11 @@ type __VLS_Slots = {
|
|
|
19
19
|
toggle?: (props: {
|
|
20
20
|
open: boolean;
|
|
21
21
|
}) => unknown;
|
|
22
|
-
/** The drawer's header row, before its close button: a logo, a call to action. */
|
|
22
|
+
/** The drawer's header row, before its close button: a logo, a call to action. The sheet only. */
|
|
23
23
|
drawerHeader?: (props: {
|
|
24
24
|
close: () => void;
|
|
25
25
|
}) => unknown;
|
|
26
|
-
/** The drawer's fixed
|
|
26
|
+
/** The drawer's footer: fixed in the sheet, after the entries in the inline drawer. */
|
|
27
27
|
drawerFooter?: (props: {
|
|
28
28
|
close: () => void;
|
|
29
29
|
}) => unknown;
|
|
@@ -217,6 +217,7 @@ declare const __VLS_base: import('vue').DefineComponent<NavMenuProps, {
|
|
|
217
217
|
collapseBelow: NavMenuCollapse;
|
|
218
218
|
drawerSide: import('../../index.js').DrawerSide;
|
|
219
219
|
drawerLayout: import('./types.js').NavMenuDrawerLayout;
|
|
220
|
+
drawerMode: import('./types.js').NavMenuDrawerMode;
|
|
220
221
|
drawerItems: readonly NavMenuItem[];
|
|
221
222
|
openOnHover: boolean;
|
|
222
223
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { UiMessages } from '../../composables/useMessages.js';
|
|
3
|
+
import { NavMenuDrawerLayout, NavMenuGroupHeadingSlotProps, NavMenuItem, NavMenuPanelItemSlotProps, NavMenuPart, NavMenuVariant } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The drawer's list of entries, the same in the modal sheet and the inline drawer: a plain link, an
|
|
6
|
+
* accordion row that opens its panel, or (`sections`) a heading row with its panel listed open.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
entries: readonly {
|
|
10
|
+
item: NavMenuItem;
|
|
11
|
+
index: number;
|
|
12
|
+
}[];
|
|
13
|
+
layout: NavMenuDrawerLayout;
|
|
14
|
+
/** The bar's panel id for an entry; the drawer's own ids are derived from it. */
|
|
15
|
+
panelId: (index: number) => string;
|
|
16
|
+
navLabel: string;
|
|
17
|
+
variant: NavMenuVariant;
|
|
18
|
+
messages: UiMessages;
|
|
19
|
+
linkAs?: string | Component;
|
|
20
|
+
cardAspect?: string;
|
|
21
|
+
classes?: Partial<Record<NavMenuPart, string>>;
|
|
22
|
+
};
|
|
23
|
+
type __VLS_Slots = {
|
|
24
|
+
panelItem?: (props: NavMenuPanelItemSlotProps) => unknown;
|
|
25
|
+
groupHeading?: (props: NavMenuGroupHeadingSlotProps) => unknown;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
28
|
+
follow: () => any;
|
|
29
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
|
+
onFollow?: (() => any) | undefined;
|
|
31
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -2,6 +2,8 @@ import { Component } from 'vue';
|
|
|
2
2
|
import { NavMenuItem, NavMenuLink, NavMenuPanelLayout } from './types.js';
|
|
3
3
|
/** How the page the visitor is on is marked, on every kind of link the menu draws. */
|
|
4
4
|
export declare const CURRENT_PAGE = "eldra:aria-[current=page]:underline eldra:aria-[current=page]:decoration-2 eldra:aria-[current=page]:underline-offset-[0.2em]";
|
|
5
|
+
/** The `aria-current` value an entry's `current` stands for, or `undefined` for no mark. */
|
|
6
|
+
export declare function currentMark(current: NavMenuLink['current']): 'page' | 'true' | undefined;
|
|
5
7
|
/** A run of panel entries under one column heading; `group` is `null` for entries without one. */
|
|
6
8
|
export interface NavMenuLinkRun {
|
|
7
9
|
group: string | null;
|
|
@@ -29,6 +31,13 @@ export declare function groupLinks(links: readonly NavMenuLink[]): NavMenuLinkRu
|
|
|
29
31
|
export declare function panelLayout(item: NavMenuItem): NavMenuPanelLayout;
|
|
30
32
|
/** Whether the item, or an entry in its panel, is the page the visitor is on. */
|
|
31
33
|
export declare function containsCurrent(item: NavMenuItem): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The one top-level entry the bar marks as holding the current page, or `null`. A page can sit in
|
|
36
|
+
* more than one entry — "Ceramics" as its own entry and again inside "Shop" — and marking both
|
|
37
|
+
* reads as two places at once. The entry whose own link is the page wins; failing that, the first
|
|
38
|
+
* entry that holds it in its panel (WS-1277).
|
|
39
|
+
*/
|
|
40
|
+
export declare function currentEntry(items: readonly NavMenuItem[]): NavMenuItem | null;
|
|
32
41
|
/** Whether an entry goes somewhere; one without a destination renders as plain text. */
|
|
33
42
|
export declare function hasHref(link: NavMenuLink): boolean;
|
|
34
43
|
/** The element an entry renders as: `linkAs` (or `a`) with a destination, else `span`. */
|
|
@@ -23,13 +23,24 @@ export interface NavMenuLink {
|
|
|
23
23
|
badge?: string | null;
|
|
24
24
|
/** The column heading this entry sits under; entries sharing one form a column. */
|
|
25
25
|
group?: string | null;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Marks the page the visitor is on: `true` or `'page'` is `aria-current="page"`, `'true'` is
|
|
28
|
+
* `aria-current="true"` for an entry that holds the page without being it (a section's entry on
|
|
29
|
+
* one of its pages), anything else is no mark.
|
|
30
|
+
*/
|
|
31
|
+
current?: boolean | 'page' | 'true';
|
|
28
32
|
/** `card` when the author made the entry a promotional card. With a resolved `card` the panel draws a picture, title and price; without one it is a plain link. */
|
|
29
33
|
display?: 'card' | 'link';
|
|
30
34
|
/** Set only on a resolved card; without it the entry is a plain link whatever `display` says. */
|
|
31
35
|
card?: NavMenuCard;
|
|
36
|
+
/**
|
|
37
|
+
* `accent` draws a top-level entry in the accent colour, in the bar and in the drawer (a "Sale"
|
|
38
|
+
* link). The entry carries it as `data-tone`. Not read on a panel's own entries.
|
|
39
|
+
*/
|
|
40
|
+
tone?: NavMenuTone;
|
|
32
41
|
}
|
|
42
|
+
/** How a top-level entry is coloured: as its siblings (`default`), or in the accent colour. */
|
|
43
|
+
export type NavMenuTone = 'default' | 'accent';
|
|
33
44
|
/** One column of a panel, as a resolved Studio link's `sections`. */
|
|
34
45
|
export interface NavMenuSection {
|
|
35
46
|
/** The column heading. Without one the column's links sit under no heading. */
|
|
@@ -76,6 +87,13 @@ export type NavMenuVariant = 'ghost' | 'muted';
|
|
|
76
87
|
* open under a heading row (a link when the entry has a page), its links indented beneath.
|
|
77
88
|
*/
|
|
78
89
|
export type NavMenuDrawerLayout = 'accordion' | 'sections';
|
|
90
|
+
/**
|
|
91
|
+
* `sheet` (default) opens the narrow-screen menu as a modal `Drawer` from the side. `inline` opens it
|
|
92
|
+
* as a disclosure hanging under the menu's positioning box (a whole header, when the root is made
|
|
93
|
+
* `static`), filling the window below and scrolling on its own; its button stays in view and reads
|
|
94
|
+
* as Close while it is open.
|
|
95
|
+
*/
|
|
96
|
+
export type NavMenuDrawerMode = 'sheet' | 'inline';
|
|
79
97
|
/** Where a panel's content is drawn: under the bar, or in the narrow-screen drawer. */
|
|
80
98
|
export type NavMenuPlacement = 'bar' | 'drawer';
|
|
81
99
|
/** The parts of a panel's content; in the drawer each one is named with a `drawer` prefix. */
|
|
@@ -116,6 +134,8 @@ export interface NavMenuProps {
|
|
|
116
134
|
drawerSide?: DrawerSide;
|
|
117
135
|
/** How the drawer shows a panel: `accordion` (default) rows that open, or `sections` listed open. */
|
|
118
136
|
drawerLayout?: NavMenuDrawerLayout;
|
|
137
|
+
/** How the drawer opens: `sheet` (default), a modal side sheet, or `inline` under the bar. */
|
|
138
|
+
drawerMode?: NavMenuDrawerMode;
|
|
119
139
|
/** The drawer's entries when they differ from the bar's. Defaults to `items`. */
|
|
120
140
|
drawerItems?: readonly NavMenuItem[];
|
|
121
141
|
/** Also open a panel when a mouse pointer rests 150ms on its trigger; leaving closes it again. */
|
|
@@ -7,6 +7,7 @@ declare const __VLS_export: import('vue').DefineComponent<ProductCardProps, {},
|
|
|
7
7
|
headingLevel: import('../../index.js').HeadingLevel;
|
|
8
8
|
classes: Partial<Record<import('./types.js').ProductCardPart, string>>;
|
|
9
9
|
loading: boolean;
|
|
10
|
+
quickAddLabel: string;
|
|
10
11
|
quickAdd: boolean;
|
|
11
12
|
linkAs: string | import('vue').Component;
|
|
12
13
|
locale: string;
|
|
@@ -15,8 +16,13 @@ declare const __VLS_export: import('vue').DefineComponent<ProductCardProps, {},
|
|
|
15
16
|
announce: boolean;
|
|
16
17
|
revalidating: boolean;
|
|
17
18
|
showVendor: boolean;
|
|
19
|
+
vendorPlacement: "above" | "below";
|
|
18
20
|
showRating: boolean;
|
|
19
21
|
showSwatches: boolean;
|
|
22
|
+
maxSwatches: number;
|
|
23
|
+
saleBadgeLabel: string;
|
|
24
|
+
quickAddName: string;
|
|
25
|
+
quickAddIcon: import('../../index.js').IconComponent;
|
|
20
26
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
27
|
declare const _default: typeof __VLS_export;
|
|
22
28
|
export default _default;
|
|
@@ -2,6 +2,7 @@ import { Component } from 'vue';
|
|
|
2
2
|
import { HeadingLevel } from '../../composables/useHeadingTag.js';
|
|
3
3
|
import { ImageMedia } from '../image/types.js';
|
|
4
4
|
import { StockLevel } from '../badge/types.js';
|
|
5
|
+
import { IconComponent } from '../icon/types.js';
|
|
5
6
|
/**
|
|
6
7
|
* The media ratios `ProductCard` itself offers (spec "Product card" → Properties, `ratio` row):
|
|
7
8
|
* a subset of `Image`'s own `ImageRatio` — the three the spec names for commerce grids, not
|
|
@@ -25,7 +26,8 @@ export interface ProductCardProduct {
|
|
|
25
26
|
title: string;
|
|
26
27
|
/** The product page. Also what `quickAdd` events identify the product by, alongside `title`. */
|
|
27
28
|
url: string;
|
|
28
|
-
/** Shown
|
|
29
|
+
/** Shown when `showVendor` is on: above the title, or after the price with
|
|
30
|
+
* `vendorPlacement: 'below'`. */
|
|
29
31
|
vendor?: string;
|
|
30
32
|
/** `null`/omitted renders `Image`'s own live "No image" placeholder at the same ratio. */
|
|
31
33
|
featuredImage?: ImageMedia | null;
|
|
@@ -67,17 +69,38 @@ export interface ProductCardProduct {
|
|
|
67
69
|
}
|
|
68
70
|
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them,
|
|
69
71
|
* plus `stockLine` for the addition beyond it (see `ProductCardProduct.stock`). */
|
|
70
|
-
export type ProductCardPart = 'media' | 'badges' | 'body' | 'vendor' | 'title' | 'link' | 'price' | 'notSold' | 'rating' | 'stockLine' | 'swatches' | 'swatch' | 'swatchOverflow' | 'quickAdd' | 'skeleton';
|
|
72
|
+
export type ProductCardPart = 'media' | 'badges' | 'saleBadge' | 'newBadge' | 'soldOutBadge' | 'body' | 'vendor' | 'title' | 'link' | 'price' | 'notSold' | 'rating' | 'stockLine' | 'swatches' | 'swatch' | 'swatchOverflow' | 'quickAdd' | 'quickAddLabel' | 'skeleton';
|
|
71
73
|
export interface ProductCardProps {
|
|
72
74
|
/** The product. See `ProductCardProduct`. */
|
|
73
75
|
product: ProductCardProduct;
|
|
74
76
|
/** Shows the vendor line. Defaults to `false` (spec "Product card" → Properties). */
|
|
75
77
|
showVendor?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Where the vendor line sits: `'above'` the title (the default, the spec's anatomy) or
|
|
80
|
+
* `'below'`, after the price — a maker line under the product name.
|
|
81
|
+
*/
|
|
82
|
+
vendorPlacement?: 'above' | 'below';
|
|
76
83
|
/** Shows `Rating`, when the product has one. Defaults to `true` — turn it off store-wide when
|
|
77
84
|
* the shop has no reviews at all. */
|
|
78
85
|
showRating?: boolean;
|
|
79
86
|
/** Shows the colour dots, when the product has any. Defaults to `true`. */
|
|
80
87
|
showSwatches?: boolean;
|
|
88
|
+
/** The most colour dots drawn before the rest collapse into "+N". Defaults to `3`. */
|
|
89
|
+
maxSwatches?: number;
|
|
90
|
+
/**
|
|
91
|
+
* The sale badge's text in place of the rounded percentage ("Sale" rather than "−25%"). Unset,
|
|
92
|
+
* the badge reads the percentage with a hidden " off".
|
|
93
|
+
*/
|
|
94
|
+
saleBadgeLabel?: string;
|
|
95
|
+
/** The quick-add button's visible text. Defaults to the `quickAddLabel` message ("Quick add"). */
|
|
96
|
+
quickAddLabel?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The quick-add button's full accessible name, product included ("Add Merino crew sweater to
|
|
99
|
+
* cart"). Defaults to the `quickAdd` message for the product's title.
|
|
100
|
+
*/
|
|
101
|
+
quickAddName?: string;
|
|
102
|
+
/** A leading icon on the quick-add button (a plus, say). None by default. */
|
|
103
|
+
quickAddIcon?: IconComponent;
|
|
81
104
|
/** Shows the quick-add control (the live button when available, the disabled "Sold out"
|
|
82
105
|
* button when not). Defaults to `true`. */
|
|
83
106
|
quickAdd?: boolean;
|
package/dist/components.css
CHANGED
|
@@ -834,6 +834,10 @@
|
|
|
834
834
|
field-sizing: content;
|
|
835
835
|
}
|
|
836
836
|
|
|
837
|
+
.eldra\:aspect-\(--eldra-nav-menu-card-aspect\) {
|
|
838
|
+
aspect-ratio: var(--eldra-nav-menu-card-aspect);
|
|
839
|
+
}
|
|
840
|
+
|
|
837
841
|
.eldra\:aspect-square {
|
|
838
842
|
aspect-ratio: 1;
|
|
839
843
|
}
|
|
@@ -1037,6 +1041,10 @@
|
|
|
1037
1041
|
height: 1em;
|
|
1038
1042
|
}
|
|
1039
1043
|
|
|
1044
|
+
.eldra\:h-\[calc\(100dvh-var\(--eldra-nav-menu-drawer-top\,0px\)\)\] {
|
|
1045
|
+
height: calc(100dvh - var(--eldra-nav-menu-drawer-top, 0px));
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1040
1048
|
.eldra\:h-auto {
|
|
1041
1049
|
height: auto;
|
|
1042
1050
|
}
|
|
@@ -1412,6 +1420,11 @@
|
|
|
1412
1420
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
1413
1421
|
}
|
|
1414
1422
|
|
|
1423
|
+
.eldra\:-translate-y-1 {
|
|
1424
|
+
--tw-translate-y: calc(var(--eldra-space-1) * -1);
|
|
1425
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1415
1428
|
.eldra\:-translate-y-1\/2 {
|
|
1416
1429
|
--tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
|
|
1417
1430
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
@@ -1535,6 +1548,10 @@
|
|
|
1535
1548
|
animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1536
1549
|
}
|
|
1537
1550
|
|
|
1551
|
+
.eldra\:animate-eldra-menu-in {
|
|
1552
|
+
animation: eldra-menu-in var(--eldra-duration-base) var(--eldra-ease-out);
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1538
1555
|
.eldra\:animate-eldra-spin {
|
|
1539
1556
|
animation: .7s linear infinite eldra-spin;
|
|
1540
1557
|
}
|
|
@@ -3708,6 +3725,12 @@
|
|
|
3708
3725
|
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
3709
3726
|
}
|
|
3710
3727
|
|
|
3728
|
+
.eldra\:transition-\[opacity\,translate\,clip-path\] {
|
|
3729
|
+
transition-property: opacity, translate, clip-path;
|
|
3730
|
+
transition-timing-function: var(--tw-ease, var(--eldra-default-transition-timing-function));
|
|
3731
|
+
transition-duration: var(--tw-duration, var(--eldra-default-transition-duration));
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3711
3734
|
.eldra\:transition-\[rotate\] {
|
|
3712
3735
|
transition-property: rotate;
|
|
3713
3736
|
transition-timing-function: var(--tw-ease, var(--eldra-default-transition-timing-function));
|
|
@@ -3851,6 +3874,14 @@
|
|
|
3851
3874
|
--eldra-radio-card-selected-color: var(--eldra-color-danger);
|
|
3852
3875
|
}
|
|
3853
3876
|
|
|
3877
|
+
.eldra\:\[clip-path\:inset\(0\)\] {
|
|
3878
|
+
clip-path: inset(0);
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
.eldra\:\[clip-path\:inset\(0_0_65\%_0\)\] {
|
|
3882
|
+
clip-path: inset(0 0 65%);
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3854
3885
|
.eldra\:eldra-rating-half {
|
|
3855
3886
|
clip-path: inset(0 50% 0 0);
|
|
3856
3887
|
}
|
|
@@ -5087,6 +5118,20 @@
|
|
|
5087
5118
|
}
|
|
5088
5119
|
}
|
|
5089
5120
|
|
|
5121
|
+
@keyframes eldra-menu-in {
|
|
5122
|
+
from {
|
|
5123
|
+
opacity: 0;
|
|
5124
|
+
clip-path: inset(0 -3rem 65%);
|
|
5125
|
+
transform: translateY(-.25rem);
|
|
5126
|
+
}
|
|
5127
|
+
|
|
5128
|
+
to {
|
|
5129
|
+
opacity: 1;
|
|
5130
|
+
clip-path: inset(0 -3rem -3rem);
|
|
5131
|
+
transform: none;
|
|
5132
|
+
}
|
|
5133
|
+
}
|
|
5134
|
+
|
|
5090
5135
|
[data-section-bg="none"] + [data-section-bg="none"], [data-section-bg="surface"] + [data-section-bg="surface"], [data-section-bg="surface-strong"] + [data-section-bg="surface-strong"], [data-section-bg="primary"] + [data-section-bg="primary"], [data-section-bg="accent"] + [data-section-bg="accent"] {
|
|
5091
5136
|
padding-top: 0;
|
|
5092
5137
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export type { LinkPart, LinkProps, LinkTone, LinkVariant } from './components/li
|
|
|
91
91
|
export type { LoadMorePart, LoadMoreProps } from './components/load-more/types.js';
|
|
92
92
|
export type { LogoItemPart, LogoItemProps } from './components/logo-item/types.js';
|
|
93
93
|
export type { MultiSelectPart, MultiSelectProps, SelectOption, SelectPart, SelectPlacement, SelectProps, SelectSize, } from './components/select/types.js';
|
|
94
|
-
export type { NavMenuCollapse, NavMenuDrawerLayout, NavMenuDrawerPanelPart, NavMenuGroup, NavMenuGroupHeadingSlotProps, NavMenuItem, NavMenuLink, NavMenuPanelItemSlotProps, NavMenuPanelLayout, NavMenuPanelPart, NavMenuPart, NavMenuPlacement, NavMenuProps, NavMenuVariant, } from './components/nav-menu/types.js';
|
|
94
|
+
export type { NavMenuCollapse, NavMenuDrawerLayout, NavMenuDrawerMode, NavMenuDrawerPanelPart, NavMenuGroup, NavMenuGroupHeadingSlotProps, NavMenuItem, NavMenuLink, NavMenuPanelItemSlotProps, NavMenuPanelLayout, NavMenuPanelPart, NavMenuPart, NavMenuPlacement, NavMenuProps, NavMenuSection, NavMenuTone, NavMenuVariant, } from './components/nav-menu/types.js';
|
|
95
95
|
export type { NoticePart, NoticeProps, NoticeTone } from './components/notice/types.js';
|
|
96
96
|
export type { PaginationPart, PaginationProps } from './components/pagination/types.js';
|
|
97
97
|
export type { PopoverPart, PopoverProps } from './components/popover/types.js';
|