@eldrajs/ui 0.3.9 → 0.3.10

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +48 -3
  3. package/dist/{PhoneInput-CX83wgD0.js → PhoneInput-BVH32MEg.js} +2 -2
  4. package/dist/{VariantPicker-BqLbiONX.js → VariantPicker-CKDdeFmV.js} +2945 -2548
  5. package/dist/componentNames.d.ts +1 -1
  6. package/dist/components/autocomplete/Autocomplete.vue.d.ts +216 -0
  7. package/dist/components/autocomplete/types.d.ts +50 -0
  8. package/dist/components/button/Button.vue.d.ts +4 -4
  9. package/dist/components/card/ContentCard.vue.d.ts +1 -1
  10. package/dist/components/carousel/Carousel.vue.d.ts +1 -1
  11. package/dist/components/checkbox/Checkbox.vue.d.ts +3 -3
  12. package/dist/components/chip/Chip.vue.d.ts +2 -1
  13. package/dist/components/container/Container.vue.d.ts +1 -1
  14. package/dist/components/dialog/Dialog.vue.d.ts +1 -0
  15. package/dist/components/drawer/Drawer.vue.d.ts +4 -3
  16. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +1 -1
  17. package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
  18. package/dist/components/filter-panel/FilterPanel.vue.d.ts +5 -4
  19. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
  20. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
  21. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -1
  22. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
  23. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
  24. package/dist/components/form-layout/FormLayout.vue.d.ts +2 -2
  25. package/dist/components/image/Image.vue.d.ts +3 -3
  26. package/dist/components/input/Input.vue.d.ts +7 -7
  27. package/dist/components/lightbox/Lightbox.vue.d.ts +2 -1
  28. package/dist/components/nav-menu/NavMenu.vue.d.ts +4 -3
  29. package/dist/components/pagination/Pagination.vue.d.ts +3 -2
  30. package/dist/components/popover/Popover.vue.d.ts +3 -3
  31. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +2 -2
  32. package/dist/components/radio/Radio.vue.d.ts +1 -1
  33. package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -1
  34. package/dist/components/search-bar/SearchBar.vue.d.ts +4 -3
  35. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
  36. package/dist/components/search-modal/SearchModal.vue.d.ts +3 -2
  37. package/dist/components/select/MultiSelect.vue.d.ts +11 -10
  38. package/dist/components/select/Select.vue.d.ts +12 -11
  39. package/dist/components/select/SelectPanel.vue.d.ts +1 -1
  40. package/dist/components/site-form/SiteForm.vue.d.ts +1 -0
  41. package/dist/components/skeleton/Skeleton.vue.d.ts +1 -1
  42. package/dist/components/switch/Switch.vue.d.ts +1 -1
  43. package/dist/components/textarea/Textarea.vue.d.ts +3 -3
  44. package/dist/components/toast/Toast.vue.d.ts +2 -1
  45. package/dist/components/toast/Toaster.vue.d.ts +1 -0
  46. package/dist/components/unit-input/UnitInput.vue.d.ts +6 -6
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +4 -4
  49. package/dist/messages/en-US.d.ts +2 -0
  50. package/dist/messages/is-IS.js +1 -0
  51. package/dist/phone/PhoneInput.vue.d.ts +7 -6
  52. package/dist/phone/vee-validate.js +4 -4
  53. package/dist/phone.js +1 -1
  54. package/dist/resolver.js +1 -0
  55. package/dist/{useFieldControl-D1j54YON.js → useFieldControl-CGH6GEWM.js} +2 -2
  56. package/dist/{useMessages-CkhrRmu7.js → useMessages-CYnyGVRG.js} +2 -0
  57. package/dist/{usePopover-ECHpsSRF.js → useOptionList-CPHHDvPF.js} +1475 -1475
  58. package/dist/vee-validate/FieldAutocomplete.vue.d.ts +20 -0
  59. package/dist/vee-validate/Form.vue.d.ts +2 -2
  60. package/dist/vee-validate/index.d.ts +3 -2
  61. package/dist/vee-validate/types.d.ts +4 -1
  62. package/dist/vee-validate/useFieldControl.d.ts +1 -1
  63. package/dist/vee-validate.js +71 -4
  64. package/dist/vue-i18n.js +1 -1
  65. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ Release-please writes the generated notes from commit messages and does not repl
7
7
 
8
8
  ### Added
9
9
 
10
+ - **`Autocomplete`** — a free-text field with a list of suggestions under it: an `Input` (same box, sizes, states, clear button and `FieldWrapper` wiring) that is an ARIA combobox with list autocomplete. `suggestions` (`{ value, label, description?, disabled? }[]`) are supplied by the consumer for the text now in the field; `loading`, `minLength` (default `1`), `messages`, `classes`, and `Input`'s `size`, `id`, `name`, `placeholder`, `autocomplete`, `inputmode`, `leadingIcon`, `clearable`, `invalid`, `describedBy`, `required`, `readonly`, `disabled`. The value is always the text: choosing a row emits `update:modelValue` with its `label`, then `select` with the suggestion, and anything else may be typed and kept. Slots `option` (`{ suggestion, active }`) and `footer`, plus `Input`'s three. With no suggestions the panel is closed. New parts `busy`, `panel`, `listbox`, `option`, `optionLabel`, `optionDescription`, `footer`; new message `suggestions` ("Suggestions" / "Tillögur"), also through `@eldrajs/ui/vue-i18n`; new types `AutocompleteProps`, `AutocompleteSuggestion`, `AutocompletePart`, `AutocompleteOptionSlotProps`; `<EldraAutocomplete>` through the resolver.
11
+ - **`FieldAutocomplete`** in `@eldrajs/ui/vee-validate` — `Autocomplete` bound to a vee-validate field, with the typed-control validation defaults. New type `FieldAutocompleteProps`.
10
12
  - **`MultiSelect` `selectAll`** adds a "Select all" button to the footer, before Clear. It adds every enabled option the list is showing to the selection, so with a search typed it selects the matches only, and it is disabled once they are all selected. New part `footerSelectAll` and message `selectAll` ("Select all" / "Velja allt"). On by default: an existing `MultiSelect` gains the button; `:select-all="false"` leaves it out.
11
13
  - **`@eldrajs/ui/flag`** — `CountryFlag`, the flag `PhoneInput` draws, for use on its own: `<CountryFlag country="NO" />` beside a country's name in a select, an address or a language switch (decorative), or with `label` as a named image. No peer dependency. The artwork is the same lazy chunk `@eldrajs/ui/phone` loads, fetched when the first flag mounts; `preloadCountryFlags()` fetches it sooner. `<EldraCountryFlag>` resolves from this entry (`flagComponentNames` in `@eldrajs/ui/resolver`). `preloadPhoneFlags` stays in `@eldrajs/ui/phone`, as the same function.
12
14
  - **`@eldrajs/ui/phone`** — `PhoneInput`, a phone number field with its country inside it: a country button (flag, dialling code) that opens a searchable country list under the field (`preferredCountries` first, then A to Z; found by name, dialling code or ISO code), and a number spaced the way the country writes it as it is typed, with the caret kept in place. `modelValue` is the number in E.164; `v-model:country`, `defaultCountry`, `countries`, `locale`, `size`, `name` (posts the E.164 value), `placeholder` (an example number by default), a `flag` slot and a `change` event (`{ e164, country, callingCode, nationalNumber, valid }`). Typing or pasting a number that starts with `+` picks the country. Also exported: `isValidPhone`, `parsePhone`, `phoneRule`, `phoneCountries`, `phoneCallingCode`, `phoneCountryName`, `phoneExample`, `preloadPhoneFlags`. `libphonenumber-js ^1.13` is a new optional peer, imported by this entry only; the flags (country-flag-icons, MIT) are one lazy chunk. `<EldraPhoneInput>` through the resolver, from `@eldrajs/ui/phone` (`phoneComponentNames`).
@@ -166,6 +168,7 @@ Release-please writes the generated notes from commit messages and does not repl
166
168
 
167
169
  ### Fixed
168
170
 
171
+ - **`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.
169
172
  - **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.
170
173
  - **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.
171
174
  - **`scoped.css` leaves a `Popover` or `Tooltip` trigger to the consumer.** The root is the slot host (`data-eldra-slot`) while the trigger is filled, so the consumer's own element keeps its border, padding and background instead of the kit's reset and utilities.
package/README.md CHANGED
@@ -179,6 +179,7 @@ Every component supports all five of these; none hard-codes anything a store mig
179
179
  | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
180
  | `Accordion` | none — the top divider is a stock `border-t`, no per-component variable |
181
181
  | `AccordionItem` | `--eldra-accordion-title-line` (default `1.4`) — the label's line ratio, no token of its own |
182
+ | `Autocomplete` | `Input`'s exactly for the field, because it renders an `Input`; the panel reads `Select`'s `--eldra-select-panel-max-height` (default `20rem`), the `--eldra-select-panel-*` colours and `--eldra-z-popover` (default `30`), and is as wide as the field |
182
183
  | `Avatar` | `--eldra-avatar-initials-size-{sm,md,lg,xl}` (defaults `0.76rem`/`0.95rem`/`1.33rem`/`2.28rem`, "38% of diameter" — no token of its own), `--eldra-avatar-initials-tracking` (default `0.02em`), `--eldra-avatar-icon-size-{sm,md,lg,xl}` (defaults `0.857rem`/`1.071rem`/`1.5rem`/`2.571rem`, the spec's own lg number scaled proportionally to the other three diameters) |
183
184
  | `AvatarGroup` | none — the overlap and stack order are plain Tailwind, no per-component variable |
184
185
  | `Badge` | `--eldra-badge-line-height` (default `1`) — the badge text's line ratio, no token of its own |
@@ -1031,7 +1032,8 @@ Four things follow from the move, and each is a real consequence rather than a d
1031
1032
  anything carrying `data-eldra-overlay-owner="<the panel's id>"` — so a control of your own puts
1032
1033
  its trigger-side buttons in the walk by marking them the way `MultiSelect`'s clear button does.
1033
1034
 
1034
- `teleport` is a prop on `Select`, `MultiSelect` and `SearchBar`, and an option on `usePopover`:
1035
+ `teleport` is a prop on `Select`, `MultiSelect` and `SearchBar`, and an option on `usePopover`
1036
+ (`Autocomplete` always teleports its panel):
1035
1037
  `true` (default), a CSS selector string for a target of your own, or `false` to keep the old
1036
1038
  in-place `absolute` rendering when you know nothing above the control clips or stacks over it.
1037
1039
  `Tooltip` has no `teleport` prop — it always teleports (`fixed` strategy, same target resolution),
@@ -1081,7 +1083,7 @@ the root entry loads fine without it (a test proves both, in the source graph an
1081
1083
  pnpm add vee-validate # optional peer, ^4.12
1082
1084
  ```
1083
1085
 
1084
- It exports `Form`, twelve `Field*` components, `API_ERRORS_KEY` and the `useFieldControl`
1086
+ It exports `Form`, fourteen `Field*` components, `API_ERRORS_KEY` and the `useFieldControl`
1085
1087
  composable they are all built on.
1086
1088
 
1087
1089
  ### The `FieldWrapper` pattern
@@ -1141,7 +1143,7 @@ Submitting the form always validates every field and shows every result, whateve
1141
1143
 
1142
1144
  | Kind | Components | `validateOnValueUpdate` | Why |
1143
1145
  | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1144
- | Typed | `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`, `FieldUnitInput`, `FieldSearchBar` | `false` | The value is built up one keystroke at a time, so validating each change would judge a half-typed value. |
1146
+ | Typed | `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`, `FieldUnitInput`, `FieldSearchBar`, `FieldAutocomplete` | `false` | The value is built up one keystroke at a time, so validating each change would judge a half-typed value. |
1145
1147
  | Choice | `FieldCheckbox`, `FieldCheckboxGroup`, `FieldRadioGroup`, `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`, `FieldQuantityStepper` | `true` | One click or selection is the whole value, often with no blur after it: a box that only validated on blur would go on saying "required" after it had been ticked. |
1146
1148
 
1147
1149
  `FieldQuantityStepper` is a choice although it has a text field: a `QuantityStepper` writes its
@@ -1190,6 +1192,7 @@ and `FieldQuantityStepper` — and those draw their message themselves **only ou
1190
1192
  | ---------------------- | ----------------- | ----------------------------------------------------------------------------- |
1191
1193
  | `FieldInput` | `Input` | `string` |
1192
1194
  | `FieldTextarea` | `Textarea` | `string` |
1195
+ | `FieldAutocomplete` | `Autocomplete` | `string` (the text in the field, typed or written by a chosen suggestion) |
1193
1196
  | `FieldUnitInput` | `UnitInput` | `number \| null` (`null` is an empty field) |
1194
1197
  | `FieldCurrencyInput` | `CurrencyInput` | `number \| null` (`null` is an empty field) |
1195
1198
  | `FieldCheckbox` | `Checkbox` | `boolean` (one consent box) |
@@ -1514,6 +1517,48 @@ comparing the package against the spec can tell an addition from a drift.
1514
1517
  keyboard and accessibility are written up under [`./phone`](#phone) above. Two utilities came
1515
1518
  with it: `eldra-focus-has-open` (the focus ring while a popup opened from inside the element is
1516
1519
  open) and `eldra-phone-flag`.
1520
+ - **`Autocomplete`** (WS-1039; not in spec 1): a free-text field with a list of suggestions under
1521
+ it, for a value that is still text once it is chosen: a street address, a company name. It is
1522
+ written up here in the spec's own section shape, since the spec has no section to point at. Not a
1523
+ `Select` (whose value must be one of its options) and not a `SearchBar` (a search landmark whose
1524
+ rows navigate).
1525
+
1526
+ - _Anatomy_: `Input`'s parts (`root`, `leadingIcon`, `prefix`, `control`, `clearButton`,
1527
+ `suffix`) · `busy` (the spinner, in the suffix row) · `panel` holding `listbox`, its `option`
1528
+ rows (`optionLabel`, `optionDescription`) and `footer` (optional).
1529
+ - _Properties_: `modelValue` (the text), `suggestions` (`{ value, label, description?,
1530
+ disabled? }[]`, supplied by the consumer for the text now in the field; the component filters
1531
+ nothing), `loading`, `minLength` (default `1`), `messages`, `classes`, and `Input`'s `size`,
1532
+ `id`, `name`, `placeholder`, `autocomplete`, `inputmode`, `leadingIcon`, `clearable`,
1533
+ `invalid`, `describedBy`, `required`, `readonly`, `disabled`. Events: `update:modelValue`,
1534
+ `select` (the chosen suggestion; `update:modelValue` with its `label` fires just before),
1535
+ `clear`, `focus`, `blur`. Slots: `option` (`{ suggestion, active }`), `footer`, and `Input`'s
1536
+ `leadingIcon`, `prefix`, `suffix`.
1537
+ - _Sizes_: the field is `Input`'s. The panel is `Select`'s (0.25rem under the field, option rows
1538
+ 2.25rem minimum, the description on a second line in `text-caption`), exactly as wide as the
1539
+ field; the footer is a `text-caption` line above a 1px hairline, padding 0.5rem 0.75rem.
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`
1543
+ or a press outside it stays closed, whatever `suggestions` holds, until the text is typed in
1544
+ again, the field is focused again, or an arrow key asks for it. While `loading`, an open panel
1545
+ keeps its rows (`aria-busy` on the list) even if `suggestions` is emptied, a closed one stays
1546
+ closed, and a spinner shows in the field once the wait has lasted 300ms. Active row:
1547
+ `Select`'s active fill. Disabled row: `muted`, skipped by the arrows, not chosen by a press.
1548
+ A disabled or read-only field never opens.
1549
+ - _Keyboard_: no row is active when the panel opens, so `Enter` submits the surrounding form as
1550
+ in a plain input. `ArrowDown` / `ArrowUp` move through the rows without wrapping (from none:
1551
+ the first / the last) and reopen a dismissed panel; `PageDown` / `PageUp` move by ten; `Enter`
1552
+ on an active row chooses it and does not submit; `Escape` closes and keeps the text; `Tab`
1553
+ closes without choosing and moves on. `Home`, `End`, `Space` and every printable key are the
1554
+ text field's.
1555
+ - _Accessibility_: the field is `role="combobox"` with `aria-autocomplete="list"`,
1556
+ `aria-expanded`, `aria-controls` (while open) and `aria-activedescendant` (while a row is
1557
+ active); focus never leaves it. The list is `role="listbox"` named by `messages.suggestions`
1558
+ ("Suggestions"); rows are `role="option"` with `aria-selected="true"` on the active one and
1559
+ `aria-disabled` on a disabled one. The consumer's `autocomplete` token is kept as given. The
1560
+ footer is not in the `Tab` walk: `Tab` closes the panel, so keep it to text.
1561
+
1517
1562
  - **Wrapper hooks** (operator decision, 2026-11-08): options that let the private component library
1518
1563
  render these components as designed instead of keeping copies of them. Each is opt-in, and output
1519
1564
  is unchanged without it; see the changelog for the details. `Input`/`Textarea`: exposed `control`
@@ -1,6 +1,6 @@
1
- import { G as FIELD_KEY, P as FIELD_TEXT, Q as useUiId, W as useEldraUiLocale, X as useControllableModel, Z as joinIds, c as useOptionList, d as SelectPanel_default, k as FIELD_RADIUS, t as usePopover, u as useListbox } from "./usePopover-ECHpsSRF.js";
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-CPHHDvPF.js";
2
2
  import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
3
- import { i as enUS, r as useMessages } from "./useMessages-CkhrRmu7.js";
3
+ import { i as enUS, r as useMessages } from "./useMessages-CYnyGVRG.js";
4
4
  import { t as CountryFlag_default } from "./CountryFlag-DOa8lOHp.js";
5
5
  import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, toDisplayString, toValue, unref, watch, withCtx } from "vue";
6
6
  import { comparator } from "@eldrajs/sdk/format";