@eldrajs/ui 0.1.2 → 0.2.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 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 })`.
@@ -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 structuredData = computed(() => JSON.stringify({
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(structuredData.value)
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/ui",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
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.2.9"
59
+ "@eldrajs/sdk": "^0.3.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@playwright/test": "1.62.1",