@eldrajs/ui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,7 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
+
- **`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.
|
|
10
11
|
- **`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`).
|
|
11
12
|
- **`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`.
|
|
12
13
|
- **`FilterPanel`** — the design spec's new "Filter panel" section: the faceted product filter a collection or search page is narrowed with, as one core component. `facets: FilterFacet[]` are five ways of drawing the same values — `list` (checkbox rows with counts), `colour` (real product swatches as rows or tiles), `size` (equal tiles grouped under one sub-heading per size system, with a **Size guide** link), `range` (a two-thumb `RangeSlider` with Min/Max fields and an optional decorative histogram) and `toggle` (one `Switch` per yes/no facet, never a checkbox pair) — and `modelValue` is the selection keyed by facet id (two-way), an array of values per facet or the two ends of a range. `mode` is `sidebar` or `drawer`, `showHead` draws the title and **Clear all**, `showApplied` the removable chips, and `title`/`label`/`locale`/`currency`/`resultCount`/`dense`/`idPrefix`/`classes`/`messages` the rest. Events: `update:modelValue` and `change` after every check, switch, committed range or field; `apply` when the drawer's **Show N products** is pressed; `clear` after **Clear all** has reset every facet, ranges included; `remove` with `{facetId, value}` for a chip. Slots: `foot` (the drawer foot, whose default content is the spec's own two buttons) and `facet` (one facet's body, for a type this package does not draw). `defineExpose({ focusTitle, focusChip })`.
|
|
@@ -81,6 +82,7 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
81
82
|
|
|
82
83
|
### Fixed
|
|
83
84
|
|
|
85
|
+
- **`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.
|
|
84
86
|
- **`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.
|
|
85
87
|
- **`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.
|
|
86
88
|
|
|
@@ -5,6 +5,7 @@ declare const __VLS_export: import('vue').DefineComponent<BreadcrumbProps, {}, {
|
|
|
5
5
|
collapseAfter: number;
|
|
6
6
|
keepLast: number;
|
|
7
7
|
linkAs: string | Component;
|
|
8
|
+
structuredData: boolean;
|
|
8
9
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
10
|
declare const _default: typeof __VLS_export;
|
|
10
11
|
export default _default;
|
|
@@ -48,6 +48,12 @@ export interface BreadcrumbProps {
|
|
|
48
48
|
* which *does* pick the root tag — see this package's README "as vs linkAs" note.
|
|
49
49
|
*/
|
|
50
50
|
linkAs?: string | Component;
|
|
51
|
+
/**
|
|
52
|
+
* Write the trail's own `BreadcrumbList` JSON-LD `<script>`. Defaults to `true`, so the
|
|
53
|
+
* component stays standalone. Pass `false` when the page already emits one (a theme's
|
|
54
|
+
* page-level structured data), because two `BreadcrumbList`s on one page are duplicate markup.
|
|
55
|
+
*/
|
|
56
|
+
structuredData?: boolean;
|
|
51
57
|
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
52
58
|
classes?: Partial<Record<BreadcrumbPart, string>>;
|
|
53
59
|
}
|
package/dist/index.js
CHANGED
|
@@ -838,6 +838,10 @@ var Breadcrumb_default = /* @__PURE__ */ defineComponent({
|
|
|
838
838
|
collapseAfter: { default: 1 },
|
|
839
839
|
keepLast: { default: 2 },
|
|
840
840
|
linkAs: { default: void 0 },
|
|
841
|
+
structuredData: {
|
|
842
|
+
type: Boolean,
|
|
843
|
+
default: true
|
|
844
|
+
},
|
|
841
845
|
classes: { default: void 0 }
|
|
842
846
|
},
|
|
843
847
|
setup(__props) {
|
|
@@ -1081,7 +1085,7 @@ var Breadcrumb_default = /* @__PURE__ */ defineComponent({
|
|
|
1081
1085
|
* — see `endItems` above) — the full, uncollapsed `items` prop feeds this regardless of whether the
|
|
1082
1086
|
* trail is visually collapsed, since collapsing is a display concern only.
|
|
1083
1087
|
*/
|
|
1084
|
-
const
|
|
1088
|
+
const structuredDataJson = computed(() => JSON.stringify({
|
|
1085
1089
|
"@context": "https://schema.org",
|
|
1086
1090
|
"@type": "BreadcrumbList",
|
|
1087
1091
|
itemListElement: props.items.map((item, index) => {
|
|
@@ -1217,10 +1221,11 @@ var Breadcrumb_default = /* @__PURE__ */ defineComponent({
|
|
|
1217
1221
|
_: 2
|
|
1218
1222
|
}, 1040, ["class"]))], 2);
|
|
1219
1223
|
}), 128))
|
|
1220
|
-
], 2), (openBlock(), createBlock(resolveDynamicComponent("script"), {
|
|
1224
|
+
], 2), __props.structuredData ? (openBlock(), createBlock(resolveDynamicComponent("script"), {
|
|
1225
|
+
key: 0,
|
|
1221
1226
|
type: "application/ld+json",
|
|
1222
|
-
textContent: toDisplayString(
|
|
1223
|
-
}, null, 8, ["textContent"]))], 10, _hoisted_1$34);
|
|
1227
|
+
textContent: toDisplayString(structuredDataJson.value)
|
|
1228
|
+
}, null, 8, ["textContent"])) : createCommentVNode("", true)], 10, _hoisted_1$34);
|
|
1224
1229
|
};
|
|
1225
1230
|
}
|
|
1226
1231
|
});
|
|
@@ -8161,16 +8166,6 @@ var _hoisted_7 = [
|
|
|
8161
8166
|
"onClick"
|
|
8162
8167
|
];
|
|
8163
8168
|
var barClass = "flex shrink-0 items-center justify-between gap-4 px-4 py-3 text-body-sm text-background";
|
|
8164
|
-
var stageClass = "relative min-h-0 flex-1";
|
|
8165
|
-
/**
|
|
8166
|
-
* No padding here, deliberately — see `slideClass` below for where the 4rem inset actually lives
|
|
8167
|
-
* and why. One slide is always the full track width (`carouselPerViewStyle({ base: 1 })` +
|
|
8168
|
-
* `eldra-carousel-track`, shared with `Carousel` — see `eldra-carousel-slide`'s own comment in
|
|
8169
|
-
* `tailwind.css`), which needs the track's own content box to be exactly the track's own visible
|
|
8170
|
-
* width, no more and no less. The three per-view numbers reach the CSS as an inline style rather
|
|
8171
|
-
* than as classes for the reason `carouselPerViewStyle`'s own comment gives; constant here, so the
|
|
8172
|
-
* object is hoisted out of the render rather than recomputed per patch.
|
|
8173
|
-
*/
|
|
8174
8169
|
var imageRootClass = "flex h-full w-full flex-col items-center";
|
|
8175
8170
|
var imageFrameClass = "w-auto max-w-full flex-1 min-h-0 rounded-md";
|
|
8176
8171
|
/** Spec "Sizes": "Caption: 0.875rem, centred, padding 0.75rem 1rem 1rem" — overriding `Image`'s own
|
|
@@ -8235,6 +8230,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
8235
8230
|
* there, but there is nothing to pick between with one photo, so it is hidden too — a consumer
|
|
8236
8231
|
* who still passes `thumbnails` with one image gets the same result the spec's own rule implies. */
|
|
8237
8232
|
const single = computed(() => props.images.length <= 1);
|
|
8233
|
+
const showThumbnails = computed(() => props.thumbnails && !single.value);
|
|
8238
8234
|
const { index: carouselIndex, count, canPrev, canNext, goTo, next, prev } = useCarousel({
|
|
8239
8235
|
rootRef,
|
|
8240
8236
|
trackRef,
|
|
@@ -8352,6 +8348,16 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
8352
8348
|
/** A plain layout wrapper, not a named part (the spec's own anatomy numbers the track/arrows
|
|
8353
8349
|
* together as one "stage"; see `Lightbox.vue`'s own file comment). `min-h-0` is what lets `track`
|
|
8354
8350
|
* actually scroll within the flex column rather than growing the whole panel. */
|
|
8351
|
+
const stageClass = computed(() => cx("relative min-h-0 flex-1", !showThumbnails.value && "pb-16 max-md:pb-17"));
|
|
8352
|
+
/**
|
|
8353
|
+
* No padding here, deliberately — see `slideClass` below for where the 4rem inset actually lives
|
|
8354
|
+
* and why. One slide is always the full track width (`carouselPerViewStyle({ base: 1 })` +
|
|
8355
|
+
* `eldra-carousel-track`, shared with `Carousel` — see `eldra-carousel-slide`'s own comment in
|
|
8356
|
+
* `tailwind.css`), which needs the track's own content box to be exactly the track's own visible
|
|
8357
|
+
* width, no more and no less. The three per-view numbers reach the CSS as an inline style rather
|
|
8358
|
+
* than as classes for the reason `carouselPerViewStyle`'s own comment gives; constant here, so the
|
|
8359
|
+
* object is hoisted out of the render rather than recomputed per patch.
|
|
8360
|
+
*/
|
|
8355
8361
|
const TRACK_STYLE = carouselPerViewStyle({ base: 1 });
|
|
8356
8362
|
/**
|
|
8357
8363
|
* `touch-pan-x touch-pan-y`, `cursor-grab`/`-grabbing` and
|
|
@@ -8444,7 +8450,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
8444
8450
|
"aria-hidden": "true",
|
|
8445
8451
|
focusable: "false"
|
|
8446
8452
|
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 10, _hoisted_3$3)]),
|
|
8447
|
-
createElementVNode("div", { class: normalizeClass(stageClass) }, [
|
|
8453
|
+
createElementVNode("div", { class: normalizeClass(stageClass.value) }, [
|
|
8448
8454
|
!single.value ? (openBlock(), createElementBlock("button", {
|
|
8449
8455
|
key: 0,
|
|
8450
8456
|
ref_key: "prevButtonRef",
|
|
@@ -8526,8 +8532,8 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
8526
8532
|
"aria-hidden": "true",
|
|
8527
8533
|
focusable: "false"
|
|
8528
8534
|
}, [createElementVNode("path", { d: "M9 6l6 6l-6 6" })], -1)])], 10, _hoisted_6)) : createCommentVNode("", true)
|
|
8529
|
-
]),
|
|
8530
|
-
|
|
8535
|
+
], 2),
|
|
8536
|
+
showThumbnails.value && unref(model) ? (openBlock(), createElementBlock("div", {
|
|
8531
8537
|
key: 0,
|
|
8532
8538
|
"data-part": "thumbnails",
|
|
8533
8539
|
class: normalizeClass(thumbnailsClass.value)
|
package/dist/style.css
CHANGED
|
@@ -2903,6 +2903,10 @@
|
|
|
2903
2903
|
padding-bottom: var(--spacing-6);
|
|
2904
2904
|
}
|
|
2905
2905
|
|
|
2906
|
+
.pb-16 {
|
|
2907
|
+
padding-bottom: var(--spacing-16);
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2906
2910
|
.pb-80 {
|
|
2907
2911
|
padding-bottom: calc(var(--spacing) * 80);
|
|
2908
2912
|
}
|
|
@@ -4471,6 +4475,10 @@
|
|
|
4471
4475
|
padding-inline-end: calc(var(--spacing) * 30);
|
|
4472
4476
|
}
|
|
4473
4477
|
|
|
4478
|
+
.max-md\:pb-17 {
|
|
4479
|
+
padding-bottom: calc(var(--spacing) * 17);
|
|
4480
|
+
}
|
|
4481
|
+
|
|
4474
4482
|
.max-md\:shadow-none {
|
|
4475
4483
|
--tw-shadow: 0 0 #0000;
|
|
4476
4484
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Accessible Vue 3 core components for Eldra storefronts: buttons, forms, selects, cards, overlays and navigation, themed through CSS design tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessible",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@floating-ui/vue": "^1.1.5",
|
|
58
58
|
"tailwind-merge": "^3.0.0",
|
|
59
|
-
"@eldrajs/sdk": "^0.
|
|
59
|
+
"@eldrajs/sdk": "^0.3.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@playwright/test": "1.62.1",
|