@eldrajs/ui 0.3.11 → 0.3.13

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
@@ -87,6 +87,7 @@ Release-please writes the generated notes from commit messages and does not repl
87
87
 
88
88
  ### Changed
89
89
 
90
+ - **`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.
90
91
  - **`@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.
91
92
  - **`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.
92
93
  - **The skeleton shimmer is slower and softer**: one sweep over the first 1.8s of a 3s cycle, eased at both ends, then a rest, with the glare a soft band rather than a wash the width of the shape. It was a 1.4s `ease-out` sweep, back to back.
@@ -168,6 +169,8 @@ Release-please writes the generated notes from commit messages and does not repl
168
169
 
169
170
  ### Fixed
170
171
 
172
+ - **`SearchModal` shows its results in Safari, and long results scroll.** The results area took no height in Safari, so the dialog drew only the field and the footer. In every browser, results taller than the dialog's max height were cut off instead of scrolling. The `results` part is now a flex column sized by its content (`flex-auto`, was `flex-1`), and the panel inside it fills it and scrolls (`flex-auto`, was `h-full`).
173
+ - **Opening a `Dialog`, `Drawer`, `Lightbox` or `SearchModal` no longer shifts the page sideways.** The scroll lock hid the page's scrollbar and the content widened into its space; `<html>` is now padded on the right by the scrollbar's width while a modal is open, added to any padding it already has and restored on close. Nothing changes with overlay scrollbars or on a page that does not scroll. An element with `position: fixed` and `right: 0` still spans the freed strip.
171
174
  - **`Input` follows a `leadingIcon`, `prefix` or `suffix` slot given or taken away after mount.** The end padding and the slot's row were decided from the slots the field was mounted with, so a `<template #suffix v-if="…">` toggled later was not drawn.
172
175
  - **A press on empty space in a `FieldWrapper` blurs the focused input again**, as on any other empty space. 0.3.4 cancelled that press, which kept the focus in the input; that change is reverted.
173
176
  - **A field's 2px error boundary no longer splits into two lines at 90%, 110% or 125% zoom.** `Input`, `Textarea`, `UnitInput`, `Select`, `MultiSelect` (and `SearchBar`, `CurrencyInput` through them) draw the second line as the focus ring's resting band in `danger`, a `box-shadow` against the outside of the border, instead of a pseudo-element inset on the field's root. `eldra-field-invalid` now sits on the control (the input, textarea, select trigger, or the `MultiSelect` field holding inside tags), and `--eldra-field-invalid-radius` is gone. On focus the line moves out to become the focus ring.
package/README.md CHANGED
@@ -1538,8 +1538,8 @@ disabled? }[]`, supplied by the consumer for the text now in the field; the comp
1538
1538
  2.25rem minimum, the description on a second line in `text-caption`), exactly as wide as the
1539
1539
  field; the footer is a `text-caption` line above a 1px hairline, padding 0.5rem 0.75rem.
1540
1540
  - _States_: the panel shows while the field has focus, the text is at least `minLength` long and
1541
- there is a suggestion to show. It is closed with no suggestions (there is no "no results" row)
1542
- and for a single suggestion whose label is exactly the text. After a selection, `Escape`, `Tab`
1541
+ there is a suggestion to show. It is closed with no suggestions (there is no "no results" row);
1542
+ a single suggestion whose label is exactly the text shows, as a confirmation. After a selection, `Escape`, `Tab`
1543
1543
  or a press outside it stays closed, whatever `suggestions` holds, until the text is typed in
1544
1544
  again, the field is focused again, or an arrow key asks for it. While `loading`, an open panel
1545
1545
  keeps its rows (`aria-busy` on the list) even if `suggestions` is emptied, a closed one stays
@@ -641,9 +641,7 @@ var Autocomplete_default = /* @__PURE__ */ defineComponent({
641
641
  const dismissed = ref(false);
642
642
  /** The rows on screen. `props.suggestions`, except while a wait holds the previous ones. */
643
643
  const rows = shallowRef(props.suggestions);
644
- /** A single suggestion that says exactly what the field already says offers nothing. */
645
- const onlyRepeatsText = computed(() => rows.value.length === 1 && rows.value[0]?.label === model.value);
646
- const canShow = computed(() => !props.disabled && !props.readonly && model.value.length >= props.minLength && rows.value.length > 0 && !onlyRepeatsText.value);
644
+ const canShow = computed(() => !props.disabled && !props.readonly && model.value.length >= props.minLength && rows.value.length > 0);
647
645
  const wantsOpen = computed(() => focused.value && !dismissed.value && canShow.value);
648
646
  /** True while the panel is being closed because `wantsOpen` turned false, not by the person. */
649
647
  let closingForConditions = false;
@@ -6078,7 +6076,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
6078
6076
  * class list for a `teleport: false` search bar; the inline `position` from `useFloating` (`fixed`
6079
6077
  * once teleported) is on the element and wins over it either way.
6080
6078
  */
6081
- const panelClass = computed(() => [props.flat ? ["eldra:flex eldra:h-full eldra:min-h-0 eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-2", "eldra:text-[color:var(--eldra-select-panel-text)]"] : [
6079
+ const panelClass = computed(() => [props.flat ? ["eldra:flex eldra:min-h-0 eldra:flex-auto eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-2", "eldra:text-[color:var(--eldra-select-panel-text)]"] : [
6082
6080
  "eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-1.5",
6083
6081
  "eldra:eldra-search-panel-height",
6084
6082
  "eldra:rounded-lg eldra:border eldra:shadow-md",
@@ -1364,6 +1364,10 @@
1364
1364
  flex: 14rem;
1365
1365
  }
1366
1366
 
1367
+ .eldra\:flex-auto {
1368
+ flex: auto;
1369
+ }
1370
+
1367
1371
  .eldra\:shrink-0 {
1368
1372
  flex-shrink: 0;
1369
1373
  }
@@ -31,7 +31,8 @@ export declare const TOAST_HOST_KEY: Ref<HTMLDialogElement | null>;
31
31
  *
32
32
  * The *first* claim (the stack going from empty to non-empty) locks the page's scroll (`<html>`
33
33
  * gets `overflow: hidden`, the shared modal rule: "While any modal surface is open … the root
34
- * element does not scroll") — later pushes leave it locked, already true. `TOAST_HOST_KEY` always
34
+ * element does not scroll"), padding `<html>` by the scrollbar's width so nothing shifts — later
35
+ * pushes leave it locked, already true. `TOAST_HOST_KEY` always
35
36
  * points at the new top.
36
37
  */
37
38
  export declare function openDialog(dialog: HTMLDialogElement): void;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $ as FIELD_KEY, A as ICON_STROKE_WIDTH$6, G as FIELD_SEARCH_APPEARANCE, I as FIELD_CLEAR_BUTTON_BOX, K as FIELD_SIZE, N as FIELD_BASE, R as FIELD_DISABLED, V as FIELD_LIVE, _ as useFloating, a as CURRENCY_KEY, c as provideEldraUiCurrency, d as useEldraUiLocale, et as mergeClass, f as Spinner_default, g as useTeleportTarget, h as topLayerDialog, k as ICON_SIZE_CLASS, l as provideEldraUiLocale, m as useOverlay, n as matchRange, nt as joinIds, o as DEFAULT_UI_LOCALE, p as usePopover, rt as useUiId, s as LOCALE_KEY, tt as useControllableModel, u as useEldraUiCurrency, v as normalizeText, y as useListbox } from "./useOptionList-CPHHDvPF.js";
2
2
  import { n as provideEldraScope, r as useEldraScope, t as ELDRA_SCOPE_KEY } from "./useEldraScope-BDbGzt7R.js";
3
- import { $ as defaultCharacterMeaning, A as defaultUnitFormat, B as CheckboxGroup_default, C as Switch_default, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as Button_default, H as VisuallyHidden_default, I as useHeadingTag, J as FORM_SUBMITTING_KEY, K as Icon_default, L as TAG_FILL, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as applyMask, R as TAG_SHAPE, S as focusInvalid, T as CurrencyInput_default, U as RequiredMark_default, V as Checkbox_default, W as FieldError_default, X as Input_default, Y as Autocomplete_default, Z as useSlotPresence, _ as optionCursor, a as claimShortcut, b as MultiSelect_default, c as SearchResultsPanel_default, d as INPUT, et as stripMask, f as PLAIN_BOX_ONLY, g as labelRecipe, h as dotRecipe, i as SearchBar_default, j as formatCurrency, k as currencySymbol, l as RadioGroup_default, m as PLAIN_OPTION, n as Textarea_default, o as ownsShortcut, p as PLAIN_COLUMNS, q as FORM_LAYOUT_KEY, r as Select_default, s as releaseShortcut, t as VariantPicker_default, u as HINT, v as radioRecipe, w as filterNumericBeforeInput, x as FormLayout_default, y as QuantityStepper_default, z as tagPadding } from "./VariantPicker-CKDdeFmV.js";
3
+ import { $ as defaultCharacterMeaning, A as defaultUnitFormat, B as CheckboxGroup_default, C as Switch_default, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as Button_default, H as VisuallyHidden_default, I as useHeadingTag, J as FORM_SUBMITTING_KEY, K as Icon_default, L as TAG_FILL, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as applyMask, R as TAG_SHAPE, S as focusInvalid, T as CurrencyInput_default, U as RequiredMark_default, V as Checkbox_default, W as FieldError_default, X as Input_default, Y as Autocomplete_default, Z as useSlotPresence, _ as optionCursor, a as claimShortcut, b as MultiSelect_default, c as SearchResultsPanel_default, d as INPUT, et as stripMask, f as PLAIN_BOX_ONLY, g as labelRecipe, h as dotRecipe, i as SearchBar_default, j as formatCurrency, k as currencySymbol, l as RadioGroup_default, m as PLAIN_OPTION, n as Textarea_default, o as ownsShortcut, p as PLAIN_COLUMNS, q as FORM_LAYOUT_KEY, r as Select_default, s as releaseShortcut, t as VariantPicker_default, u as HINT, v as radioRecipe, w as filterNumericBeforeInput, x as FormLayout_default, y as QuantityStepper_default, z as tagPadding } from "./VariantPicker-CHaKOzYT.js";
4
4
  import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-CYnyGVRG.js";
5
5
  import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onServerPrefetch, onUnmounted, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
6
6
  import { dateTimeFormat } from "@eldrajs/sdk/format/date";
@@ -4047,16 +4047,48 @@ var ContentCard_default = /* @__PURE__ */ defineComponent({
4047
4047
  var stack = [];
4048
4048
  /** The `<html>` inline `overflow` this module overwrote, restored when the lock is released. */
4049
4049
  var previousHtmlOverflow = null;
4050
+ /** The `<html>` inline `padding-right` this module overwrote, restored when the lock is released. */
4051
+ var previousHtmlPaddingRight = null;
4052
+ /**
4053
+ * The width the root's classic scrollbar takes from the viewport, `0` when there is none to take:
4054
+ * a page short enough not to scroll, or a platform drawing overlay scrollbars (macOS's default,
4055
+ * every phone) that never take layout space. A `clientWidth` of `0` means no layout at all (a
4056
+ * DOM-less test environment), not a scrollbar as wide as the window.
4057
+ */
4058
+ function rootScrollbarWidth(html) {
4059
+ if (html.clientWidth === 0) return 0;
4060
+ return Math.max(0, window.innerWidth - html.clientWidth);
4061
+ }
4062
+ /**
4063
+ * `overflow: hidden` on `<html>` removes a classic scrollbar, and the page's content widens into the
4064
+ * space it leaves — everything centred or right-aligned jumps sideways the moment a modal opens and
4065
+ * back when it closes. The lock pads `<html>` on the right by exactly the scrollbar's width for as
4066
+ * long as it holds, so the content box stays where it was.
4067
+ *
4068
+ * Padding rather than `scrollbar-gutter: stable`: a gutter keeps the strip but leaves it empty, so
4069
+ * the dialog's `::backdrop` stops short of the right edge and a right-hand `Drawer` docks against
4070
+ * the gutter instead of the window's edge, an undimmed bar beside it. Padding sits inside `<html>`'s
4071
+ * box, which the top layer covers whole.
4072
+ */
4050
4073
  function lockScroll() {
4051
4074
  if (typeof document === "undefined") return;
4052
4075
  const html = document.documentElement;
4076
+ const scrollbarWidth = rootScrollbarWidth(html);
4053
4077
  previousHtmlOverflow = html.style.overflow;
4078
+ previousHtmlPaddingRight = html.style.paddingRight;
4079
+ if (scrollbarWidth > 0) {
4080
+ const padding = Number.parseFloat(getComputedStyle(html).paddingRight) || 0;
4081
+ html.style.paddingRight = `${padding + scrollbarWidth}px`;
4082
+ }
4054
4083
  html.style.overflow = "hidden";
4055
4084
  }
4056
4085
  function unlockScroll() {
4057
4086
  if (typeof document === "undefined") return;
4058
- document.documentElement.style.overflow = previousHtmlOverflow ?? "";
4087
+ const html = document.documentElement;
4088
+ html.style.overflow = previousHtmlOverflow ?? "";
4089
+ html.style.paddingRight = previousHtmlPaddingRight ?? "";
4059
4090
  previousHtmlOverflow = null;
4091
+ previousHtmlPaddingRight = null;
4060
4092
  }
4061
4093
  /**
4062
4094
  * The DOM element a `Toaster` should render its live region into while a modal dialog is open, or
@@ -4090,7 +4122,8 @@ var TOAST_HOST_KEY = shallowRef(null);
4090
4122
  *
4091
4123
  * The *first* claim (the stack going from empty to non-empty) locks the page's scroll (`<html>`
4092
4124
  * gets `overflow: hidden`, the shared modal rule: "While any modal surface is open … the root
4093
- * element does not scroll") — later pushes leave it locked, already true. `TOAST_HOST_KEY` always
4125
+ * element does not scroll"), padding `<html>` by the scrollbar's width so nothing shifts — later
4126
+ * pushes leave it locked, already true. `TOAST_HOST_KEY` always
4094
4127
  * points at the new top.
4095
4128
  */
4096
4129
  function openDialog(dialog) {
@@ -13747,8 +13780,15 @@ var SearchModal_default = /* @__PURE__ */ defineComponent({
13747
13780
  ]);
13748
13781
  /** The frame's own bounding box around the reused panel (spec → Sizes, Panel row: "fills the
13749
13782
  * remaining height and scrolls") — distinct from that panel's own `panel` part, the scrollable box
13750
- * inside it. */
13751
- const resultsClass = computed(() => ["eldra:min-h-0 eldra:flex-1 eldra:overflow-hidden", props.classes?.results]);
13783
+ * inside it.
13784
+ *
13785
+ * `flex-auto`, not `flex-1`: the dialog has a `max-height` but no height on desktop, and Safari sizes
13786
+ * a `flex-basis: 0%` item in a column of indefinite height to nothing — the dialog drew the field
13787
+ * and the footer with no results between them. A content basis grows to the content and shrinks
13788
+ * under the max (`min-h-0`). It is a flex column itself so the panel inside shrinks to it and
13789
+ * scrolls, which a `height: 100%` against this box's indefinite height never did in any browser:
13790
+ * long results were clipped at the max with no way to reach them. */
13791
+ const resultsClass = computed(() => ["eldra:flex eldra:min-h-0 eldra:flex-auto eldra:flex-col eldra:overflow-hidden", props.classes?.results]);
13752
13792
  /** "Foot | padding 0.625rem 1rem, gap 0.5rem 1.25rem … 1px border above … hidden [below 48rem]." */
13753
13793
  const footerClass = computed(() => [
13754
13794
  "eldra:hidden eldra:items-center eldra:gap-x-5 eldra:gap-y-2 eldra:border-t eldra:border-border eldra:bg-surface eldra:px-4 eldra:py-2.5 eldra:md:flex",
package/dist/style.css CHANGED
@@ -1502,6 +1502,10 @@
1502
1502
  flex: 14rem;
1503
1503
  }
1504
1504
 
1505
+ .eldra\:flex-auto {
1506
+ flex: auto;
1507
+ }
1508
+
1505
1509
  .eldra\:shrink-0 {
1506
1510
  flex-shrink: 0;
1507
1511
  }
@@ -1,4 +1,4 @@
1
- import { B as CheckboxGroup_default, C as Switch_default, E as UnitInput_default, S as focusInvalid, T as CurrencyInput_default, V as Checkbox_default, X as Input_default, Y as Autocomplete_default, b as MultiSelect_default, i as SearchBar_default, l as RadioGroup_default, n as Textarea_default, r as Select_default, t as VariantPicker_default, x as FormLayout_default, y as QuantityStepper_default } from "./VariantPicker-CKDdeFmV.js";
1
+ import { B as CheckboxGroup_default, C as Switch_default, E as UnitInput_default, S as focusInvalid, T as CurrencyInput_default, V as Checkbox_default, X as Input_default, Y as Autocomplete_default, b as MultiSelect_default, i as SearchBar_default, l as RadioGroup_default, n as Textarea_default, r as Select_default, t as VariantPicker_default, x as FormLayout_default, y as QuantityStepper_default } from "./VariantPicker-CHaKOzYT.js";
2
2
  import { r as useMessages } from "./useMessages-CYnyGVRG.js";
3
3
  import { a as useControlProps, c as FIELD_ANCHORS_KEY, i as FIELD_VALIDATION_PROPS, l as FIELD_MESSAGES_KEY, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS, s as API_ERRORS_KEY, t as FIELD_CHOICE_VALIDATION_DEFAULTS } from "./useFieldControl-CGH6GEWM.js";
4
4
  import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/ui",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
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",