@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/dist/componentNames.d.ts
CHANGED
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* it from `@eldrajs/ui`, where it does not exist, and would pull an optional peer into a project
|
|
16
16
|
* that never installed it. `src/__tests__/veeValidateIsolation.spec.ts` asserts both halves.
|
|
17
17
|
*/
|
|
18
|
-
export declare const componentNames: readonly ["Accordion", "AccordionItem", "Avatar", "AvatarGroup", "Badge", "Breadcrumb", "Button", "ButtonGroup", "Carousel", "Checkbox", "CheckboxGroup", "Chip", "ChipGroup", "Container", "ContentCard", "CurrencyInput", "Dialog", "Drawer", "EditorPlaceholder", "EmptyState", "FeatureCard", "FieldWrapper", "FilterPanel", "FormLayout", "Icon", "Image", "Input", "Lightbox", "Link", "LoadMore", "LogoItem", "MultiSelect", "NavMenu", "Pagination", "Popover", "Price", "ProductCard", "QuantityStepper", "RadioGroup", "RangeSlider", "Rating", "SearchBar", "SearchModal", "Section", "Select", "SiteForm", "Skeleton", "StockBadge", "Switch", "Tab", "TabPanel", "TablerIcon", "Tabs", "Textarea", "Toast", "Toaster", "Tooltip", "UnitInput", "VariantPicker", "VisuallyHidden"];
|
|
18
|
+
export declare const componentNames: readonly ["Accordion", "AccordionItem", "Avatar", "AvatarGroup", "Badge", "Breadcrumb", "Button", "ButtonGroup", "Carousel", "Checkbox", "CheckboxGroup", "Chip", "ChipGroup", "Container", "ContentCard", "CurrencyInput", "Dialog", "Drawer", "EditorPlaceholder", "EmptyState", "FeatureCard", "FieldWrapper", "FilterPanel", "FormLayout", "Icon", "Image", "Input", "Lightbox", "Link", "LoadMore", "LogoItem", "MultiSelect", "NavMenu", "Pagination", "Popover", "Price", "ProductCard", "QuantityStepper", "Radio", "RadioGroup", "RangeSlider", "Rating", "SearchBar", "SearchModal", "Section", "Select", "SiteForm", "Skeleton", "StockBadge", "Switch", "Tab", "TabPanel", "TablerIcon", "Tabs", "Textarea", "Toast", "Toaster", "Tooltip", "UnitInput", "VariantPicker", "VisuallyHidden"];
|
|
19
19
|
export type ComponentName = (typeof componentNames)[number];
|
|
@@ -20,11 +20,14 @@ declare const __VLS_base: import('vue').DefineComponent<ButtonProps, {}, {}, {},
|
|
|
20
20
|
type: "button" | "submit" | "reset";
|
|
21
21
|
href: string;
|
|
22
22
|
icon: import('../../index.js').IconComponent;
|
|
23
|
+
to: string | Record<string, unknown>;
|
|
23
24
|
loading: boolean;
|
|
24
25
|
as: string | import('vue').Component;
|
|
25
26
|
iconLeft: import('../../index.js').IconComponent;
|
|
26
27
|
iconRight: import('../../index.js').IconComponent;
|
|
27
28
|
iconOnly: boolean;
|
|
29
|
+
spinnerPlacement: import('./types.js').ButtonSpinnerPlacement;
|
|
30
|
+
keepNameWhileLoading: boolean;
|
|
28
31
|
block: boolean;
|
|
29
32
|
pressed: boolean;
|
|
30
33
|
disabled: boolean;
|
|
@@ -10,6 +10,8 @@ import { IconComponent } from '../icon/types.js';
|
|
|
10
10
|
export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'link' | 'danger';
|
|
11
11
|
/** The spec's three button heights: 2rem, 2.5rem and 3rem. */
|
|
12
12
|
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
13
|
+
/** Where `Button`'s loading spinner is drawn. */
|
|
14
|
+
export type ButtonSpinnerPlacement = 'overlay' | 'start';
|
|
13
15
|
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
14
16
|
export type ButtonPart = 'container' | 'leadingIcon' | 'label' | 'trailingIcon' | 'spinner';
|
|
15
17
|
export interface ButtonProps {
|
|
@@ -26,10 +28,22 @@ export interface ButtonProps {
|
|
|
26
28
|
* link component, for example `resolveComponent('NuxtLink')`, so an in-app destination routes
|
|
27
29
|
* instead of reloading the document. A string is used as the tag directly and still receives
|
|
28
30
|
* `href`; a component receives the destination as its `to` prop instead, matching Vue Router /
|
|
29
|
-
* NuxtLink's own contract.
|
|
30
|
-
* `<button>`,
|
|
31
|
+
* NuxtLink's own contract. With neither `href` nor `to`, a component `as` (or `'a'`/`'button'`)
|
|
32
|
+
* is ignored and this is a `<button>`, the same rule as `Link`'s `as`; any other string (`'span'`,
|
|
33
|
+
* `'div'`) renders that tag with the button look and nothing interactive — no `type`,
|
|
34
|
+
* `disabled`, `tabindex`, `aria-pressed`, `aria-disabled` or `aria-label` — for a part that only
|
|
35
|
+
* looks like a button inside another control (a row that is itself the button). Its name is its
|
|
36
|
+
* own text; an icon-only one is decorative.
|
|
31
37
|
*/
|
|
32
38
|
as?: string | Component;
|
|
39
|
+
/**
|
|
40
|
+
* A router destination (a path or a route object) for an `as` component, handed to it as its
|
|
41
|
+
* `to` prop, for a destination `href` cannot hold. Ignored without a component `as`. No `type`,
|
|
42
|
+
* `disabled` or `aria-pressed` is set on the component; while disabled it is
|
|
43
|
+
* `aria-disabled="true"`, out of the tab order, and its clicks are cancelled before the router
|
|
44
|
+
* link's own handler sees them.
|
|
45
|
+
*/
|
|
46
|
+
to?: string | Record<string, unknown>;
|
|
33
47
|
/** Leading icon component, for example `IconShoppingBag`. */
|
|
34
48
|
iconLeft?: IconComponent;
|
|
35
49
|
/** Trailing icon component, for example `IconArrowRight` on "Continue to checkout". */
|
|
@@ -46,9 +60,24 @@ export interface ButtonProps {
|
|
|
46
60
|
label?: string;
|
|
47
61
|
/** Shows the spinner, sets `aria-busy="true"` and keeps the button's width and focus. */
|
|
48
62
|
loading?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Where the spinner goes while `loading`. `"overlay"` (the default) centres it over the hidden
|
|
65
|
+
* label and icons, and `label` becomes the accessible name. `"start"` draws it in the leading
|
|
66
|
+
* icon's place, before the label, which stays visible and keeps naming the button.
|
|
67
|
+
*/
|
|
68
|
+
spinnerPlacement?: ButtonSpinnerPlacement;
|
|
69
|
+
/**
|
|
70
|
+
* While `loading` with the overlay spinner, keep the hidden label in the accessibility tree
|
|
71
|
+
* (transparent rather than `visibility: hidden`), so slot content keeps naming the button when
|
|
72
|
+
* there is no `label`. A `label` still wins as the name. Default `false`.
|
|
73
|
+
*/
|
|
74
|
+
keepNameWhileLoading?: boolean;
|
|
49
75
|
/** Full width of its container. */
|
|
50
76
|
block?: boolean;
|
|
51
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Toggle buttons only: sets `aria-pressed`. Leave it undefined for ordinary buttons. `true` draws
|
|
79
|
+
* the pressed fill (`surface-strong`, `border-strong` boundary) on `outline` and `ghost`.
|
|
80
|
+
*/
|
|
52
81
|
pressed?: boolean;
|
|
53
82
|
/** Native `disabled`. A disabled link button loses its `href` so it is not focusable either. */
|
|
54
83
|
disabled?: boolean;
|
|
@@ -22,11 +22,11 @@ declare const __VLS_base: import('vue').DefineComponent<ContentCardProps, {}, {}
|
|
|
22
22
|
variant: ContentCardVariant;
|
|
23
23
|
linkAs: string | import('vue').Component;
|
|
24
24
|
date: string | null;
|
|
25
|
+
locale: string;
|
|
25
26
|
ratio: import('./types.js').ContentCardRatio;
|
|
26
27
|
eyebrow: string | null;
|
|
27
28
|
excerpt: string | null;
|
|
28
29
|
cue: string | null;
|
|
29
|
-
locale: string;
|
|
30
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
31
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
@@ -20,10 +20,12 @@ declare const __VLS_base: import('vue').DefineComponent<CheckboxProps, {}, {}, {
|
|
|
20
20
|
classes: Partial<Record<import('./types.js').CheckboxPart, string>>;
|
|
21
21
|
modelValue: boolean;
|
|
22
22
|
required: boolean;
|
|
23
|
+
error: string;
|
|
23
24
|
id: string;
|
|
24
25
|
disabled: boolean;
|
|
25
26
|
invalid: boolean;
|
|
26
27
|
controls: string;
|
|
28
|
+
requiredMark: boolean;
|
|
27
29
|
hint: string;
|
|
28
30
|
indeterminate: boolean;
|
|
29
31
|
describedBy: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
2
|
-
export type CheckboxPart = 'root' | 'box' | 'check' | 'label' | 'hint';
|
|
2
|
+
export type CheckboxPart = 'root' | 'box' | 'check' | 'label' | 'hint' | 'requiredMark' | 'field' | 'error' | 'errorIcon';
|
|
3
3
|
/** The spec's two box sizes: 1.125rem and 1.5rem. */
|
|
4
4
|
export type CheckboxSize = 'md' | 'lg';
|
|
5
5
|
export interface CheckboxProps {
|
|
@@ -23,6 +23,17 @@ export interface CheckboxProps {
|
|
|
23
23
|
invalid?: boolean;
|
|
24
24
|
/** Native `required`. Comes from the `FieldWrapper` otherwise. */
|
|
25
25
|
required?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Shows `FieldWrapper`'s `*` after the label text. Without native `required` the label also ends
|
|
28
|
+
* with the visually hidden "Required" message, so the mark is announced. Default `false`.
|
|
29
|
+
*/
|
|
30
|
+
requiredMark?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* An error message drawn under the box in `FieldWrapper`'s error row, linked first in
|
|
33
|
+
* `aria-describedby`. Implies `invalid`. The row and the box are then wrapped in one element
|
|
34
|
+
* (the `field` part), which receives the root's place in the layout.
|
|
35
|
+
*/
|
|
36
|
+
error?: string;
|
|
26
37
|
/** Native `disabled`. */
|
|
27
38
|
disabled?: boolean;
|
|
28
39
|
/**
|
|
@@ -24,9 +24,6 @@ declare const __VLS_base: import('vue').DefineComponent<ChipProps, {}, {}, {}, {
|
|
|
24
24
|
icon: import('../../index.js').IconComponent;
|
|
25
25
|
selected: boolean;
|
|
26
26
|
disabled: boolean;
|
|
27
|
-
avatar: string | import('../../index.js').ImageMedia | null;
|
|
28
|
-
removable: boolean;
|
|
29
|
-
selectable: boolean;
|
|
30
27
|
messages: Partial<{
|
|
31
28
|
clear: string;
|
|
32
29
|
close: string;
|
|
@@ -45,6 +42,7 @@ declare const __VLS_base: import('vue').DefineComponent<ChipProps, {}, {}, {}, {
|
|
|
45
42
|
noResults: string;
|
|
46
43
|
noResultsFor: (query: string) => string;
|
|
47
44
|
noMatchesFor: (query: string) => string;
|
|
45
|
+
createOption: (query: string) => string;
|
|
48
46
|
moreSelected: (n: number) => string;
|
|
49
47
|
removeTag: (label: string) => string;
|
|
50
48
|
selected: string;
|
|
@@ -176,6 +174,9 @@ declare const __VLS_base: import('vue').DefineComponent<ChipProps, {}, {}, {}, {
|
|
|
176
174
|
formPendingTitle: string;
|
|
177
175
|
formPendingMessage: string;
|
|
178
176
|
}>;
|
|
177
|
+
avatar: string | import('../../index.js').ImageMedia | null;
|
|
178
|
+
removable: boolean;
|
|
179
|
+
selectable: boolean;
|
|
179
180
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
180
181
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
181
182
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DialogProps } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** The body, below the description. */
|
|
4
|
+
default?: () => unknown;
|
|
5
|
+
/** The action buttons. */
|
|
6
|
+
footer?: () => unknown;
|
|
7
|
+
/** Replaces the `<h2>` with markup of your own (an icon above the heading, a heading level the
|
|
8
|
+
* page needs). Still the dialog's accessible name; bring your own heading element. */
|
|
9
|
+
title?: () => unknown;
|
|
8
10
|
};
|
|
9
|
-
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
10
11
|
declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
|
|
11
12
|
close: (returnValue?: string) => void;
|
|
12
13
|
isTop: import('vue').ComputedRef<boolean>;
|
|
@@ -20,6 +21,7 @@ declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
|
|
|
20
21
|
onCancel?: (() => any) | undefined;
|
|
21
22
|
}>, {
|
|
22
23
|
size: import('./types.js').DialogSize;
|
|
24
|
+
title: string;
|
|
23
25
|
classes: Partial<Record<import('./types.js').DialogPart, string>>;
|
|
24
26
|
modelValue: boolean;
|
|
25
27
|
messages: Partial<{
|
|
@@ -40,6 +42,7 @@ declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
|
|
|
40
42
|
noResults: string;
|
|
41
43
|
noResultsFor: (query: string) => string;
|
|
42
44
|
noMatchesFor: (query: string) => string;
|
|
45
|
+
createOption: (query: string) => string;
|
|
43
46
|
moreSelected: (n: number) => string;
|
|
44
47
|
removeTag: (label: string) => string;
|
|
45
48
|
selected: string;
|
|
@@ -173,6 +176,8 @@ declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
|
|
|
173
176
|
}>;
|
|
174
177
|
description: string;
|
|
175
178
|
dismissable: boolean;
|
|
179
|
+
closeButton: boolean;
|
|
180
|
+
closeOnEscape: boolean;
|
|
176
181
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
177
182
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
178
183
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,8 +7,10 @@ export type DialogSize = 'sm' | 'md';
|
|
|
7
7
|
export interface DialogProps {
|
|
8
8
|
/** Shows the dialog with `showModal()` when `true`, closes it when `false` (two-way). */
|
|
9
9
|
modelValue?: boolean;
|
|
10
|
-
/** The `<h2>` title text; the dialog's accessible name (`aria-labelledby`).
|
|
11
|
-
|
|
10
|
+
/** The `<h2>` title text; the dialog's accessible name (`aria-labelledby`). Optional when the
|
|
11
|
+
* `title` slot draws the heading instead; with neither, name the dialog yourself through
|
|
12
|
+
* `aria-label` or `aria-labelledby` on the component (they land on the `<dialog>`). */
|
|
13
|
+
title?: string;
|
|
12
14
|
/** Body text below the title; the dialog is `aria-describedby` it. Omit when the body is a
|
|
13
15
|
* form — the spec's own Form variant carries no `description`. */
|
|
14
16
|
description?: string;
|
|
@@ -18,6 +20,13 @@ export interface DialogProps {
|
|
|
18
20
|
* `false` for a form with unsaved input, or a destructive confirm a stray click must not
|
|
19
21
|
* count as an answer for. Default `true`. */
|
|
20
22
|
dismissable?: boolean;
|
|
23
|
+
/** Whether the header's close button is drawn. Default `true`. `false` is for a dialog whose own
|
|
24
|
+
* footer already holds every way out; `Esc` still closes it unless `closeOnEscape` is `false`. */
|
|
25
|
+
closeButton?: boolean;
|
|
26
|
+
/** Whether `Esc` closes the dialog. Default `true`. `false` is for a decision the user must answer
|
|
27
|
+
* through the dialog's own actions; keep a visible way out (the close button or a footer action)
|
|
28
|
+
* whenever you turn this off. */
|
|
29
|
+
closeOnEscape?: boolean;
|
|
21
30
|
/** Message overrides (only `close` applies here). See `useMessages`. */
|
|
22
31
|
messages?: Partial<UiMessages>;
|
|
23
32
|
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
@@ -44,6 +44,7 @@ declare const __VLS_base: import('vue').DefineComponent<DrawerProps, {
|
|
|
44
44
|
noResults: string;
|
|
45
45
|
noResultsFor: (query: string) => string;
|
|
46
46
|
noMatchesFor: (query: string) => string;
|
|
47
|
+
createOption: (query: string) => string;
|
|
47
48
|
moreSelected: (n: number) => string;
|
|
48
49
|
removeTag: (label: string) => string;
|
|
49
50
|
selected: string;
|
|
@@ -2,6 +2,8 @@ import { FieldWrapperProps } from './types.js';
|
|
|
2
2
|
declare const __VLS_template: () => {
|
|
3
3
|
__VLS_Slots: {
|
|
4
4
|
label?: (props: {}) => any;
|
|
5
|
+
} & {
|
|
6
|
+
labelSuffix?: (props: {}) => any;
|
|
5
7
|
} & {
|
|
6
8
|
default?: (props: {}) => any;
|
|
7
9
|
} & {
|
|
@@ -12,6 +14,7 @@ declare const __VLS_template: () => {
|
|
|
12
14
|
};
|
|
13
15
|
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
14
16
|
declare const __VLS_base: import('vue').DefineComponent<FieldWrapperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldWrapperProps> & Readonly<{}>, {
|
|
17
|
+
label: string;
|
|
15
18
|
counter: import('./types.js').FieldWrapperCounter;
|
|
16
19
|
help: string;
|
|
17
20
|
classes: Partial<Record<import('./types.js').FieldWrapperPart, string>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The required mark a label or legend ends with: `*`, `danger`, a 0.125rem start margin and the
|
|
3
|
+
* label's own weight. **Internal**, like `FieldError`: it exists so `FieldWrapper` and `RadioGroup`
|
|
4
|
+
* draw one mark rather than two hand-copied ones. The `requiredMark` part and its `classes` key are
|
|
5
|
+
* the parent's, which is why the parent's `classes` object is handed straight through.
|
|
6
|
+
*
|
|
7
|
+
* The asterisk is decorative: a control's native `required` is what announces it.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
/** The parent's per-part overrides. Only `requiredMark` is read. */
|
|
11
|
+
classes?: Partial<Record<'requiredMark', string>>;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -21,8 +21,16 @@ export interface FieldContext {
|
|
|
21
21
|
* named with `aria-labelledby` pointing here instead. It lives on the context rather than being
|
|
22
22
|
* rebuilt from `id` by string convention in each control, so renaming it is one edit and cannot
|
|
23
23
|
* leave a control pointing at an element that no longer exists.
|
|
24
|
+
*
|
|
25
|
+
* Always set, even for a wrapper with no visible label; read `labelled` before pointing at it.
|
|
24
26
|
*/
|
|
25
27
|
labelId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the wrapper renders its label (or legend) element, so `labelId` names something. False
|
|
30
|
+
* for a wrapper with no visible label, whose control is named with its own `aria-label`.
|
|
31
|
+
* Optional so a hand-built context still compiles; leaving it out reads as `true`.
|
|
32
|
+
*/
|
|
33
|
+
labelled?: boolean;
|
|
26
34
|
/** The `aria-describedby` value: the error id first, then help. */
|
|
27
35
|
describedBy?: string;
|
|
28
36
|
/** Whether the field is in error, which the control mirrors as `aria-invalid="true"`. */
|
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
export type FieldWrapperPart = 'root' | 'label' | 'legend' | 'requiredMark' | 'optionalText' | 'help' | 'control' | 'error' | 'errorIcon' | 'foot' | 'counter';
|
|
3
3
|
/** The character counter shown at the end of the foot row. */
|
|
4
4
|
export interface FieldWrapperCounter {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The limit the value is counted against. Without one the counter shows the length alone
|
|
7
|
+
* ("12"), for a field that reports how much has been written but sets no limit.
|
|
8
|
+
*/
|
|
9
|
+
max?: number;
|
|
7
10
|
/** The current length. Defaults to `0`, so an empty field reads "0 / 200". */
|
|
8
11
|
value?: number;
|
|
9
12
|
}
|
|
10
13
|
export interface FieldWrapperProps {
|
|
11
|
-
/**
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The visible label, written as a noun ("Postcode"). Leave it out (and fill no `label` slot) for
|
|
16
|
+
* a field with no visible label: no `<label>` (or `<legend>`) renders, so name the control
|
|
17
|
+
* itself with `aria-label` (a group: the wrapper, whose attributes reach the `<fieldset>`). The
|
|
18
|
+
* required and optional marks live in the label, so they go with it.
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
13
21
|
/** The control's id. Generated when it is not given, and handed to the control either way. */
|
|
14
22
|
id?: string;
|
|
15
23
|
/** Shows `*` and sets native `required` on the control. */
|
|
@@ -54,6 +54,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
54
54
|
noResults: string;
|
|
55
55
|
noResultsFor: (query: string) => string;
|
|
56
56
|
noMatchesFor: (query: string) => string;
|
|
57
|
+
createOption: (query: string) => string;
|
|
57
58
|
moreSelected: (n: number) => string;
|
|
58
59
|
removeTag: (label: string) => string;
|
|
59
60
|
selected: string;
|
|
@@ -55,6 +55,8 @@ declare const __VLS_base: import('vue').DefineComponent<FilterPanelProps, {
|
|
|
55
55
|
title: string;
|
|
56
56
|
classes: Partial<Record<import('./types.js').FilterPanelPart, string>>;
|
|
57
57
|
modelValue: FilterSelection;
|
|
58
|
+
mode: import('./types.js').FilterPanelMode;
|
|
59
|
+
locale: string;
|
|
58
60
|
messages: Partial<{
|
|
59
61
|
clear: string;
|
|
60
62
|
close: string;
|
|
@@ -73,6 +75,7 @@ declare const __VLS_base: import('vue').DefineComponent<FilterPanelProps, {
|
|
|
73
75
|
noResults: string;
|
|
74
76
|
noResultsFor: (query: string) => string;
|
|
75
77
|
noMatchesFor: (query: string) => string;
|
|
78
|
+
createOption: (query: string) => string;
|
|
76
79
|
moreSelected: (n: number) => string;
|
|
77
80
|
removeTag: (label: string) => string;
|
|
78
81
|
selected: string;
|
|
@@ -204,11 +207,9 @@ declare const __VLS_base: import('vue').DefineComponent<FilterPanelProps, {
|
|
|
204
207
|
formPendingTitle: string;
|
|
205
208
|
formPendingMessage: string;
|
|
206
209
|
}>;
|
|
207
|
-
locale: string;
|
|
208
210
|
currency: string;
|
|
209
211
|
idPrefix: string;
|
|
210
212
|
dense: boolean;
|
|
211
|
-
mode: import('./types.js').FilterPanelMode;
|
|
212
213
|
facets: FilterFacet[];
|
|
213
214
|
showHead: boolean;
|
|
214
215
|
showApplied: boolean;
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
|
|
|
23
23
|
noResults: string;
|
|
24
24
|
noResultsFor: (query: string) => string;
|
|
25
25
|
noMatchesFor: (query: string) => string;
|
|
26
|
+
createOption: (query: string) => string;
|
|
26
27
|
moreSelected: (n: number) => string;
|
|
27
28
|
removeTag: (label: string) => string;
|
|
28
29
|
selected: string;
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
|
|
|
23
23
|
noResults: string;
|
|
24
24
|
noResultsFor: (query: string) => string;
|
|
25
25
|
noMatchesFor: (query: string) => string;
|
|
26
|
+
createOption: (query: string) => string;
|
|
26
27
|
moreSelected: (n: number) => string;
|
|
27
28
|
removeTag: (label: string) => string;
|
|
28
29
|
selected: string;
|
|
@@ -11,6 +11,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
|
|
|
11
11
|
onCommit?: ((range: [number, number]) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
13
|
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
14
|
+
locale: string;
|
|
14
15
|
messages: Partial<{
|
|
15
16
|
clear: string;
|
|
16
17
|
close: string;
|
|
@@ -29,6 +30,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
|
|
|
29
30
|
noResults: string;
|
|
30
31
|
noResultsFor: (query: string) => string;
|
|
31
32
|
noMatchesFor: (query: string) => string;
|
|
33
|
+
createOption: (query: string) => string;
|
|
32
34
|
moreSelected: (n: number) => string;
|
|
33
35
|
removeTag: (label: string) => string;
|
|
34
36
|
selected: string;
|
|
@@ -160,7 +162,6 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
|
|
|
160
162
|
formPendingTitle: string;
|
|
161
163
|
formPendingMessage: string;
|
|
162
164
|
}>;
|
|
163
|
-
locale: string;
|
|
164
165
|
currency: string;
|
|
165
166
|
dense: boolean;
|
|
166
167
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
|
|
|
23
23
|
noResults: string;
|
|
24
24
|
noResultsFor: (query: string) => string;
|
|
25
25
|
noMatchesFor: (query: string) => string;
|
|
26
|
+
createOption: (query: string) => string;
|
|
26
27
|
moreSelected: (n: number) => string;
|
|
27
28
|
removeTag: (label: string) => string;
|
|
28
29
|
selected: string;
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
|
|
|
23
23
|
noResults: string;
|
|
24
24
|
noResultsFor: (query: string) => string;
|
|
25
25
|
noMatchesFor: (query: string) => string;
|
|
26
|
+
createOption: (query: string) => string;
|
|
26
27
|
moreSelected: (n: number) => string;
|
|
27
28
|
removeTag: (label: string) => string;
|
|
28
29
|
selected: string;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { InputProps } from './types.js';
|
|
2
2
|
declare const __VLS_template: () => {
|
|
3
3
|
__VLS_Slots: {
|
|
4
|
+
prefix?: (props: {}) => any;
|
|
5
|
+
} & {
|
|
4
6
|
leadingIcon?: (props: {}) => any;
|
|
5
7
|
} & {
|
|
6
8
|
suffix?: (props: {}) => any;
|
|
7
9
|
};
|
|
8
10
|
};
|
|
9
11
|
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
10
|
-
declare const __VLS_base: import('vue').DefineComponent<InputProps, {
|
|
12
|
+
declare const __VLS_base: import('vue').DefineComponent<InputProps, {
|
|
13
|
+
control: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
14
|
+
focus: () => void | undefined;
|
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
16
|
blur: (event: FocusEvent) => any;
|
|
12
17
|
clear: () => any;
|
|
13
18
|
"update:modelValue": (value: string) => any;
|
|
@@ -32,7 +37,7 @@ declare const __VLS_base: import('vue').DefineComponent<InputProps, {}, {}, {},
|
|
|
32
37
|
leadingIcon: import('../../index.js').IconComponent;
|
|
33
38
|
disabled: boolean;
|
|
34
39
|
invalid: boolean;
|
|
35
|
-
inputmode: string;
|
|
40
|
+
inputmode: string | false;
|
|
36
41
|
describedBy: string;
|
|
37
42
|
min: number;
|
|
38
43
|
clearable: boolean;
|
|
@@ -108,3 +108,12 @@ export declare const FIELD_LEADING_ICON: string;
|
|
|
108
108
|
* merge-group registration is needed) rather than changing the shared default.
|
|
109
109
|
*/
|
|
110
110
|
export declare const FIELD_SUFFIX_ROW = "absolute end-1 inset-y-0 my-auto flex items-center gap-1";
|
|
111
|
+
/**
|
|
112
|
+
* The start-edge mirror of `FIELD_SUFFIX_ROW`, for the `prefix` slot: interactive content (a
|
|
113
|
+
* calendar button) 0.25rem from the start edge, so unlike `FIELD_LEADING_ICON` it keeps the pointer.
|
|
114
|
+
*/
|
|
115
|
+
export declare const FIELD_PREFIX_ROW = "absolute start-1 inset-y-0 my-auto flex items-center gap-1";
|
|
116
|
+
/** The start padding a `prefix` row reserves: the trailing action's room, mirrored. */
|
|
117
|
+
export declare const FIELD_PREFIX_PAD: Record<InputSize, string>;
|
|
118
|
+
/** `FIELD_TRAILING_PAD`/`FIELD_PREFIX_PAD` in rem, for `useAdornmentRoom`'s comparison. */
|
|
119
|
+
export declare const FIELD_ACTION_ROOM_REM: Record<InputSize, number>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes `value` onto a text control whose DOM value has drifted from it, keeping the caret.
|
|
3
|
+
*
|
|
4
|
+
* Vue patches `value` only when the bound value changes. A controlled parent that refuses a
|
|
5
|
+
* keystroke, or formats it back to what it already had (`'12a'` → `'12'`), leaves the bound value
|
|
6
|
+
* exactly as it was, so Vue patches nothing and the field keeps showing what was typed against a
|
|
7
|
+
* model that says otherwise. `Checkbox` and `RadioGroup` re-assert `checked` for the same reason.
|
|
8
|
+
*
|
|
9
|
+
* The caret keeps its distance from the end of the value, which is where it lands after a refused
|
|
10
|
+
* or stripped character wherever in the value it was typed. It is moved only on a focused control
|
|
11
|
+
* whose type has a selection API (`selectable`), so this never steals focus or throws.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reassertValue(el: HTMLInputElement | HTMLTextAreaElement | null, value: string, selectable?: boolean): void;
|
|
@@ -4,7 +4,7 @@ export type InputType = 'text' | 'email' | 'tel' | 'number' | 'search' | 'url' |
|
|
|
4
4
|
/** The spec's three compact-control heights: 2rem, 2.5rem and 3rem. */
|
|
5
5
|
export type InputSize = 'sm' | 'md' | 'lg';
|
|
6
6
|
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
7
|
-
export type InputPart = 'root' | 'leadingIcon' | 'control' | 'clearButton' | 'suffix';
|
|
7
|
+
export type InputPart = 'root' | 'leadingIcon' | 'prefix' | 'control' | 'clearButton' | 'suffix';
|
|
8
8
|
export interface InputProps {
|
|
9
9
|
/**
|
|
10
10
|
* The value (two-way). With `mask` set this is the **raw** value — the digits and letters the
|
|
@@ -23,19 +23,28 @@ export interface InputProps {
|
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
/** Always set it for personal data: `name`, `email`, `address-line1`, `postal-code`… */
|
|
25
25
|
autocomplete?: string;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* For example `numeric`. A `number` field defaults to `numeric`; `false` renders no `inputmode`
|
|
28
|
+
* at all, for a number field that needs the full keyboard (a decimal point or a minus sign).
|
|
29
|
+
*/
|
|
30
|
+
inputmode?: string | false;
|
|
28
31
|
/** For `type="number"`. */
|
|
29
32
|
min?: number;
|
|
30
33
|
/** For `type="number"`. */
|
|
31
34
|
max?: number;
|
|
32
35
|
/** For `type="number"`. */
|
|
33
36
|
step?: number;
|
|
34
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* A decorative icon at the start of the field (`search`, `mail`, `discount`). Not drawn when the
|
|
39
|
+
* `prefix` slot is given, which takes the start edge.
|
|
40
|
+
*/
|
|
35
41
|
leadingIcon?: IconComponent;
|
|
36
42
|
/** Shows the clear button while there is a value. Defaults to `true` for `type="search"`. */
|
|
37
43
|
clearable?: boolean;
|
|
38
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Sets `aria-invalid="true"` and the error boundary. Comes from the `FieldWrapper` otherwise.
|
|
46
|
+
* While it is not invalid, an `aria-invalid` attribute the caller passes is kept.
|
|
47
|
+
*/
|
|
39
48
|
invalid?: boolean;
|
|
40
49
|
/** `aria-describedby` ids, error id first. Comes from the `FieldWrapper` otherwise. */
|
|
41
50
|
describedBy?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The room an absolutely positioned prefix or suffix row needs on a text field.
|
|
4
|
+
*
|
|
5
|
+
* The field's padding classes reserve room for **one** action (a 2rem button 0.25rem from the
|
|
6
|
+
* edge, plus 0.25rem before the text). A row holding more than that — a spinner, a clear button
|
|
7
|
+
* and a password toggle side by side — would sit over the text. So the row is measured, and only
|
|
8
|
+
* when it is wider than what the class reserves does this return a `padding-inline-*` value: the
|
|
9
|
+
* row's width plus the same 0.5rem the one-action case leaves (0.25rem inset, 0.25rem before the
|
|
10
|
+
* text). A field with no row or one action keeps exactly the padding its classes give it.
|
|
11
|
+
*
|
|
12
|
+
* Client only: the row is measured once mounted and again whenever a `ResizeObserver` reports it
|
|
13
|
+
* changed. On the server, and before the first measurement, the class padding applies.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useAdornmentRoom(row: Ref<HTMLElement | null>, reservedRem: () => number): ComputedRef<string | undefined>;
|
|
@@ -30,6 +30,7 @@ declare const __VLS_export: import('vue').DefineComponent<LightboxProps, {
|
|
|
30
30
|
noResults: string;
|
|
31
31
|
noResultsFor: (query: string) => string;
|
|
32
32
|
noMatchesFor: (query: string) => string;
|
|
33
|
+
createOption: (query: string) => string;
|
|
33
34
|
moreSelected: (n: number) => string;
|
|
34
35
|
removeTag: (label: string) => string;
|
|
35
36
|
selected: string;
|
|
@@ -62,6 +62,7 @@ declare const __VLS_base: import('vue').DefineComponent<NavMenuProps, {
|
|
|
62
62
|
noResults: string;
|
|
63
63
|
noResultsFor: (query: string) => string;
|
|
64
64
|
noMatchesFor: (query: string) => string;
|
|
65
|
+
createOption: (query: string) => string;
|
|
65
66
|
moreSelected: (n: number) => string;
|
|
66
67
|
removeTag: (label: string) => string;
|
|
67
68
|
selected: string;
|