@eldrajs/ui 0.2.8 → 0.2.9
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 +45 -0
- package/README.md +259 -87
- package/dist/{VariantPicker-CjWUVhlm.js → VariantPicker-Da41_oGA.js} +2244 -1399
- package/dist/componentNames.d.ts +1 -1
- package/dist/components/button/Button.vue.d.ts +3 -0
- package/dist/components/button/types.d.ts +32 -3
- package/dist/components/card/ContentCard.vue.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/types.d.ts +12 -1
- package/dist/components/chip/Chip.vue.d.ts +4 -3
- package/dist/components/dialog/Dialog.vue.d.ts +12 -7
- package/dist/components/dialog/types.d.ts +11 -2
- package/dist/components/drawer/Drawer.vue.d.ts +1 -0
- package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +3 -0
- package/dist/components/field-wrapper/RequiredMark.vue.d.ts +15 -0
- package/dist/components/field-wrapper/context.d.ts +8 -0
- package/dist/components/field-wrapper/types.d.ts +12 -4
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +3 -2
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -1
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
- package/dist/components/input/Input.vue.d.ts +7 -2
- package/dist/components/input/classes.d.ts +9 -0
- package/dist/components/input/reassertValue.d.ts +13 -0
- package/dist/components/input/types.d.ts +14 -5
- package/dist/components/input/useAdornmentRoom.d.ts +15 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +1 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -0
- package/dist/components/pagination/Pagination.vue.d.ts +154 -0
- package/dist/components/pagination/types.d.ts +31 -0
- package/dist/components/popover/Popover.vue.d.ts +28 -1
- package/dist/components/popover/types.d.ts +57 -3
- package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
- package/dist/components/radio/Radio.vue.d.ts +33 -0
- package/dist/components/radio/RadioGroup.vue.d.ts +4 -0
- package/dist/components/radio/recipes.d.ts +37 -0
- package/dist/components/radio/types.d.ts +64 -3
- package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +1 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +1 -0
- package/dist/components/select/MultiSelect.vue.d.ts +48 -1
- package/dist/components/select/Select.vue.d.ts +20 -0
- package/dist/components/select/SelectPanel.vue.d.ts +23 -0
- package/dist/components/select/SelectTags.vue.d.ts +50 -0
- package/dist/components/select/openRegistry.d.ts +14 -4
- package/dist/components/select/panelParts.d.ts +28 -2
- package/dist/components/select/types.d.ts +45 -7
- package/dist/components/select/useOptionList.d.ts +31 -4
- package/dist/components/select/usePopover.d.ts +36 -39
- package/dist/components/select/useSummaryFit.d.ts +21 -0
- package/dist/components/select/useTagRows.d.ts +17 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +2 -1
- package/dist/components/switch/Switch.vue.d.ts +15 -8
- package/dist/components/switch/types.d.ts +25 -1
- package/dist/components/tabs/Tab.vue.d.ts +1 -0
- package/dist/components/tabs/context.d.ts +6 -2
- package/dist/components/tabs/types.d.ts +9 -0
- package/dist/components/textarea/Textarea.vue.d.ts +21 -1
- package/dist/components/textarea/types.d.ts +11 -2
- package/dist/components/toast/Toast.vue.d.ts +2 -0
- package/dist/components/toast/Toaster.vue.d.ts +7 -1
- package/dist/components/toast/types.d.ts +43 -2
- package/dist/components.css +312 -13
- package/dist/composables/useDialog.d.ts +7 -3
- package/dist/composables/useEldraScope.d.ts +26 -0
- package/dist/composables/useFloating.d.ts +21 -8
- package/dist/composables/useOverlay.d.ts +10 -5
- package/dist/composables/useToast.d.ts +3 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1296 -405
- package/dist/messages/en-US.d.ts +2 -0
- package/dist/messages/is-IS.js +1 -0
- package/dist/resolver.js +1 -0
- package/dist/scoped.css +4623 -0
- package/dist/style.css +312 -13
- package/dist/tailwind.css +43 -12
- package/dist/useMessages-B5nzZghs.js +592 -0
- package/dist/vee-validate.js +42 -6
- package/dist/vue-i18n/index.d.ts +50 -0
- package/dist/vue-i18n/shapes.d.ts +40 -0
- package/dist/vue-i18n.js +289 -0
- package/package.json +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
+
- **`@eldrajs/ui/vue-i18n`** — the kit's messages read through an app's vue-i18n (`useEldraUiI18n()`, or `eldraUiI18nMessages(i18n.global)` for `MESSAGES_KEY`), so the kit is translated with the rest of the app and follows a locale switch. Keys live under `eldraUi.*`; `toVueI18nMessages(enUS | isIS | yours)` produces them (named values, plural forms, a suffixed key per non-count branch such as `pageN_current`); `icelandicPluralRule` for vue-i18n's `pluralRules`. A missing key falls back to English. `vue-i18n ^11` is a new optional peer, imported by this entry only.
|
|
11
|
+
- **`topLayerDialog(anchor)`** is exported: the open modal `<dialog>` a popup anchored to `anchor` must be teleported into (`body` would paint it behind the top layer), or `null`. The same answer `Select`, `Popover` and `Tooltip` use, for a consumer's own teleported popup.
|
|
12
|
+
- **`MultiSelect` `tagPlacement: 'inside'`** draws the removable tags in the field, which wraps and grows, with `maxTagRows` (default 2) collapsing the rest into a "+N" tag; new `field` and `tagMore` parts. The default stays `'below'`.
|
|
13
|
+
- **`Button` as a static tag, and `keepNameWhileLoading`.** A string `as` other than `'button'`/`'a'` with no `href` renders that tag (`<span>`, `<div>`) with the button look and nothing interactive — no `type`, `disabled`, `tabindex`, `aria-pressed`, `aria-disabled` or `aria-label` — for a button-looking part inside a control that is itself the button; `'button'`, `'a'` and a component `as` without `href` still render a `<button>`. `keepNameWhileLoading` (default `false`) keeps the label hidden by the overlay spinner in the accessibility tree (`opacity-0` instead of `invisible`), so slot content keeps naming a loading button that has no `label`; a `label` still wins.
|
|
14
|
+
- **`Switch`'s `invalid`**: `aria-invalid="true"` on the switch without an error row, for a caller that shows its own message, like `RadioGroup`'s `invalid`.
|
|
15
|
+
- **`data-variant` on every `Toast` root** (`success`, `warning`, `danger`, `info`), also on the toasts a `Toaster` renders, for a consumer's per-variant colours through an attribute selector.
|
|
16
|
+
- **`@eldrajs/ui/scoped.css` and `provideEldraScope(name = 'default')`**, for embedding the components in another Tailwind app or beside this package's own components on a page. `scoped.css` is `components.css` with every theme variable renamed into `--eldra-tw-*` and every keyframes into `eldra-*`, the token defaults on the outermost `[data-eldra-scope]` instead of `:root`, every rule inside `@scope ([data-eldra-scope]) to ([data-eldra-slot] > *)`, unlayered. Below `provideEldraScope`, every component renders `data-eldra-scope` on its root, its teleported parts and its own elements beside slot content; every element holding slot content carries `data-eldra-slot` (whenever the slot has content, provider or not), where the scoped styles stop. New export `ELDRA_SCOPE_KEY`.
|
|
17
|
+
- **Wrapper hooks on `Input` and `Textarea`.** Both expose `control` (the native element) and `focus()`. While the field is not invalid, an `aria-invalid` the caller passes (`"false"`) is kept. `Input`'s `inputmode` takes `false`, so a `number` field can render no `inputmode` at all.
|
|
18
|
+
- **`RadioGroup`'s `invalid`**: the error state and `aria-invalid="true"` on every radio without an error row, for a caller that shows its own message. Options take `optionAttrs` (the `<label>`) and `inputAttrs` (the native radio) for ids, classes and `data-*` hooks. New parts `input` and `dot`.
|
|
19
|
+
- **`Toast`'s `info` variant** (polite, timed like `success`, its icon in the text colour) and **`closable`** (default `true`; `false` renders no close button and ignores `Escape`), also on `useToast`'s `show()`.
|
|
20
|
+
- **`Pagination`'s wrapper options**: `fixedLength` (the row keeps the same number of items on every page, the window sliding against the ends), `disabled` (every control inert, the current page still marked), `responsive` (default `true`; `false` keeps the numbered form at every width), `showSinglePage` (renders with one page) and a per-instance `messages` prop.
|
|
21
|
+
- **`FieldWrapper` without a visible label, and `labelSuffix`.** `label` is optional: left out, no `<label>`/`<legend>` renders and the context's new `labelled` is `false` (`labelId` is still set), so name the control with `aria-label`; a `Checkbox` or `Switch` inside keeps its own label. The `labelSuffix` slot follows the required or optional mark inside the label. `counter.max` is optional: without one the counter shows the length alone.
|
|
22
|
+
- **`Toaster` renders an external queue**: `toasts` (`ToasterToast[]`; given, the `useToast` store is untouched and closing or a `duration` running out only emits `dismiss(id, reason)`), `position` (`top-left` … `bottom-right`, default `bottom-right`), `maxVisible` (the newest kept), `newestOnTop` (default `false`) and `teleportTo` (default `body`; an open `Dialog` still wins). New types `ToasterToast`, `ToasterPosition`.
|
|
23
|
+
- **Field chrome on standalone controls.** `Checkbox` and `Switch` take `requiredMark` (`FieldWrapper`'s `*`, plus a visually hidden "Required" when no native `required` announces it) and `error` (`FieldWrapper`'s error row, first in `aria-describedby`, and `aria-invalid="true"`); a `Checkbox` with an `error` wraps its row and the message in the new `field` part. `RadioGroup` takes `help` (`FieldWrapper`'s help row, described after the error). New parts `requiredMark`, `error`, `errorIcon` (and `Checkbox`'s `field`, `RadioGroup`'s `help`).
|
|
24
|
+
- **`Button`'s `to`, `spinnerPlacement` and rich slot content.** `to` hands a router destination (a path or route object) to a component `as` with no `href`; disabled, it stays the component, inert, its click cancelled before the router's handler. `spinnerPlacement: 'start'` (default `'overlay'`) draws the spinner before a visible label. A default slot holding elements (an icon and text) lays out in the button's own gap. New type `ButtonSpinnerPlacement`.
|
|
25
|
+
- **`Dialog`'s `title` slot** (your own heading markup in place of the `<h2>`, still the accessible name; `title` is now optional, so name a dialog with neither through `aria-label`), **`closeButton`** (default `true`) and **`closeOnEscape`** (default `true`; also a `useDialog` option, which also cancels the `Escape` keydown).
|
|
26
|
+
- **`Select` / `MultiSelect` wrapper hooks.** `keywords` on `SelectOption` (search matches them, never drawn); `loading` (a spinner status row in place of the list, the listbox `aria-busy`); `creatable` with the `create` event (a last "Create “query”" option, hidden when a label already equals the query); `renderBatch` (renders long lists in batches, search still covers every option); slots `optionContent` (a row's content, keeping its checkbox or check), `leading` (the trigger's leading mark, from the chosen option or options) and `loading`; the `tag` slot gains `remove`. New parts `loading`, `createOption`; new message `createOption`.
|
|
27
|
+
- **`Popover` options**: `offset`, `viewportPadding`, `reference`, `disabled`, `haspopup`, `labelledByTrigger`, `openOnArrowDown`, `focusOnOpen`, `closeOnOutsideClick`, `closeOnFocusOutside`, `closeOnEscape`, `returnFocus`, `closeWhenTriggerHidden` and `exclusive`; `placement` is followed while open and takes the `left`/`right` placements; the default slot gets `open`/`toggle`; exposes `open`/`close`/`toggle`/`update`.
|
|
28
|
+
- **`Tab`'s `disabled`** (also `TabsItem.disabled`): not selectable, skipped by the arrow keys and `Home`/`End`, `aria-disabled="true"`, never the default selection. `TabsEntry` gains an optional `disabled()`; an entry registered without it reads as enabled.
|
|
29
|
+
- **`Switch`'s `thumb`, `trackStart` and `trackEnd` slots** (`{ checked, disabled }`), decorative content drawn in the thumb and at its two resting places on the track. New parts `trackStart` and `trackEnd`, new type `SwitchSlotProps`.
|
|
30
|
+
- **`RadioGroup`'s optional `legend` and `requiredMark`.** Without `legend` no `<legend>` renders; name the fieldset with `aria-label`/`aria-labelledby`. `requiredMark` shows `FieldWrapper`'s `*` (plus a visually hidden "Required") without native `required`. New part `requiredMark`.
|
|
31
|
+
- **`Radio`** — one native radio in the `RadioGroup` plain-row design, for radios whose siblings are rendered apart: v-model of the group's value plus `value`, `name`, `label`/default slot, `hint`/slot, `size`, `disabled`, `invalid`, `classes`; attributes reach the input. New types `RadioProps`, `RadioPart`, `RadioValue`; `<EldraRadio>` through the resolver.
|
|
32
|
+
- **`Dialog`'s colour variables**: `--eldra-dialog-background`, `--eldra-dialog-border`, `--eldra-dialog-text`, `--eldra-dialog-muted` and `--eldra-dialog-backdrop`, read by the dialog's own chrome only and falling back to the theme colours, so a dialog can be recoloured without re-theming its slotted content.
|
|
33
|
+
- **`Input`'s `prefix` slot** (and part): interactive leading content such as a calendar button. A prefix or suffix row wider than one action now pushes the text clear of it.
|
|
34
|
+
- **`Textarea`'s `clearable`** with a `clear` event, `prefix`/`suffix` slots, and `prefix`/`clearButton`/`suffix` parts.
|
|
35
|
+
- **`MultiSelect`'s `tagItem` slot** (`{ option, remove, removable, removeLabel }`) replaces a whole tag, remove button included. Render the remove control only while `removable`, as a `<button type="button">` named `removeLabel`; `remove` deselects and returns focus to the trigger.
|
|
36
|
+
- **Chrome colour variables on `Popover`, the select panels and `MultiSelect` tags**, read by their own parts only, so a consumer recolours them without redefining theme variables over slotted content; each falls back to the token its part drew before. `Popover`: `--eldra-popover-background`, `-border`, `-text`. `Select`, `MultiSelect` and `SearchBar` panels: `--eldra-select-panel-background`, `-border`, `-text`, `-muted`, `-active`, `-check`, `-check-contrast`, `-check-border`. `MultiSelect` tags: `--eldra-select-tag-background`, `-text`, `-muted`.
|
|
10
37
|
- **`NavMenu`'s `groups`**: a column heading with a page of its own, `[{ label, href?, newTab?, current? }]` matched to the children's `group` by label, is a link in the bar and in the drawer (the new `groupLink` part) with no `groupHeading` slot. New type `NavMenuGroup`.
|
|
11
38
|
- **Phone menu variables.** `--eldra-nav-menu-drawer-row-height` (default `3.5rem`), every top-level row in `NavMenu`'s drawer; `--eldra-nav-menu-drawer-indent` (default `var(--eldra-space-4)`), how far a panel's links sit in from their row. `Drawer` takes `--eldra-drawer-header-height` (default `4rem`), `--eldra-drawer-header-padding` (default `var(--eldra-space-4)`; `0px` gives the row exactly the header height) and `--eldra-drawer-gutter` (default `1.5rem`), and adds the device's safe areas around its header, body and footer, so a full-screen drawer clears a notch and the home indicator under `viewport-fit=cover`.
|
|
12
39
|
|
|
@@ -42,6 +69,22 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
42
69
|
|
|
43
70
|
### Changed
|
|
44
71
|
|
|
72
|
+
- **A controlled `Input` or `Textarea` shows its `modelValue`, not what was typed.** After an input event, and after every render, the native value is written back when it differs from the bound value (`Input`'s masked text), so a parent that refuses a keystroke or strips it (`'12a'` → `'12'`), now or on the next tick, sees the field match its model; the caret keeps its distance from the end. A `modelValue` bound without an `update:modelValue` handler now holds the field still, as a native controlled input does. Like `Checkbox`'s and `RadioGroup`'s `checked`.
|
|
73
|
+
- **`ToastVariant` gains `info`**: an exhaustive `Record<ToastVariant, …>` or `switch` over it needs an `info` case.
|
|
74
|
+
- **A ghost `Button` with `pressed`** draws the toggle fill (`surface-strong`, `border-strong`), as `outline` does.
|
|
75
|
+
- **A `Checkbox` with no label and no hint is its box alone**: no label column, no gap. Name it with `aria-label`.
|
|
76
|
+
- **A popup opened from inside a `Popover` or select panel no longer closes it** (a teleported part marked `data-eldra-overlay-owner` with the id of an element in the panel, or controlled by an expanded trigger in it).
|
|
77
|
+
- **`Enter` and `Space` on a `Popover` trigger open it.**
|
|
78
|
+
- **A press that starts inside a `Dialog`, `Drawer`, `Lightbox` or `SearchModal` panel and is released on the backdrop no longer closes it** (selecting text, dragging out of a field).
|
|
79
|
+
- **A programmatic `click()` on a `Popover`, `Select` or `MultiSelect` trigger opens it**; a click forwarded by a `<label>` still only focuses.
|
|
80
|
+
- **The focus ring composes with Tailwind shadows.** `eldra-focus`'s `box-shadow` ends with `--tw-inset-shadow`, `--tw-inset-ring-shadow`, `--tw-ring-offset-shadow`, `--tw-ring-shadow` and `--tw-shadow`, each empty by default, so a `shadow-*` or `ring-*` on the same element draws beneath the ring instead of being dropped. `RangeSlider`'s thumb loses the `shadow-sm` that never painted under the ring, so it looks as before.
|
|
81
|
+
- **The inset focus ring sits against the element's edge, its gap inside it.** `eldra-focus-inset` and `eldra-focus-inset-always` swap their bands, so a select's search field, `SearchModal`'s field, underline `Tab`s and `QuantityStepper`'s parts no longer show a white band between their container's border and the ring.
|
|
82
|
+
- **A `Select` or `MultiSelect` panel's search field draws no focus ring.** It holds focus while the panel is open, so the inset ring framed it for as long as the panel showed.
|
|
83
|
+
- **A disabled `Select`/`MultiSelect` option is drawn muted, without the strikethrough**, and a multi-select's disabled selected box is `Checkbox`'s disabled checked box (`muted`, tick kept) instead of the `primary` fill. Recorded under Deviations.
|
|
84
|
+
- **A `MultiSelect` tag for a disabled option is fixed**: no remove button, and `Backspace` passes over it, as its row in the panel cannot be toggled either.
|
|
85
|
+
- **`MultiSelect`'s trigger lists as many labels as fit its width.** `maxSummary` takes `'fit'`, the new default: the labels before the "+N" pill are measured against the trigger and re-measured as it resizes, never fewer than one. Before the first measurement (and on the server) it lists two, as before. A number still lists exactly that many.
|
|
86
|
+
- **A `Select` or `MultiSelect` trigger keeps at least its placeholder's width once a value is chosen.** The value sits in one grid cell with an invisible copy of the placeholder (generated content, no text or accessible name), so a content-sized trigger no longer narrows when a short value replaces a long placeholder. A value longer than the placeholder still widens it.
|
|
87
|
+
|
|
45
88
|
- **`NavMenu`'s phone menu reads as two levels.** In both layouts a panel's links sit indented under a rule beneath their row (the new `drawerNest` part), and the top-level rows, links, accordion rows and section headings, are one height and type. `sections` headings are rows like the plain links rather than small capitals, so a section's last page and the next top-level link can no longer be mistaken for one list; a heading whose entry has a page is that link, and its panel then has no "overview" row. The drawer list no longer draws a top border under the header's own. Below 48rem, where a `Drawer` covers the screen, it no longer draws its inner-edge border either.
|
|
46
89
|
|
|
47
90
|
- **`NavMenu`'s drawer names its copies of the panel parts with a `drawer` prefix** (`drawerPanelLink`, `drawerGroupHeading`, `drawerOverview`, `drawerBadge`…), in `data-part` and in `classes` alike, so a bar panel's classes (`panelLink`, `columns`, `groupHeading`…) no longer reach the drawer's rows; move any drawer styling onto the prefixed keys. The `triggerIcon` part is now a `<span>` around the icon rather than the `<svg>` itself, so the `triggerIcon` slot's icon turns with it.
|
|
@@ -96,6 +139,8 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
96
139
|
|
|
97
140
|
### Fixed
|
|
98
141
|
|
|
142
|
+
- **`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.
|
|
143
|
+
- **`Popover` finds its trigger inside a fragment**, so a wrapper can forward its own `<slot>` into `trigger`.
|
|
99
144
|
- **A dialog opened by a tap or click focuses itself, not its first control** (`Dialog`, `Drawer`, `Lightbox`, `SearchModal`, and `NavMenu`'s phone menu). Safari draws a focus ring on a control that script focuses after a tap, so opening the phone menu ringed its first link (or a logo in its header) as if the keyboard had moved there. A tap or click now focuses the dialog itself, ringed by nothing, and `Tab` goes on from there; a text field or a control marked `autofocus` still takes focus, and a dialog opened from the keyboard focuses its first control as before.
|
|
100
145
|
- **`Image` crops with `zoomOrigin: 'focal'` position the picture absolutely**, so the offsets resolve against the frame on every engine. Older Safari ignored a relatively positioned picture's percentage `top` inside a frame sized by `aspect-ratio`, drawing the top of the picture (a house's roof) instead of the cropped region.
|
|
101
146
|
|