@eldrajs/ui 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1724 -0
- package/LICENSE +21 -0
- package/README.md +3177 -2
- package/dist/VariantPicker-CKw8hmxt.js +9009 -0
- package/dist/componentNames.d.ts +19 -0
- package/dist/components/accordion/Accordion.vue.d.ts +18 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +26 -0
- package/dist/components/accordion/context.d.ts +20 -0
- package/dist/components/accordion/detailsExclusivity.d.ts +3 -0
- package/dist/components/accordion/heightTransition.d.ts +59 -0
- package/dist/components/accordion/types.d.ts +40 -0
- package/dist/components/avatar/Avatar.vue.d.ts +10 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +7 -0
- package/dist/components/avatar/types.d.ts +61 -0
- package/dist/components/badge/Badge.vue.d.ts +24 -0
- package/dist/components/badge/StockBadge.vue.d.ts +10 -0
- package/dist/components/badge/types.d.ts +79 -0
- package/dist/components/breadcrumb/Breadcrumb.vue.d.ts +10 -0
- package/dist/components/breadcrumb/types.d.ts +53 -0
- package/dist/components/button/Button.vue.d.ts +37 -0
- package/dist/components/button/ButtonGroup.vue.d.ts +17 -0
- package/dist/components/button/types.d.ts +68 -0
- package/dist/components/card/ContentCard.vue.d.ts +36 -0
- package/dist/components/card/FeatureCard.vue.d.ts +27 -0
- package/dist/components/card/cueArrow.d.ts +10 -0
- package/dist/components/card/stretchedLink.d.ts +45 -0
- package/dist/components/card/types.d.ts +92 -0
- package/dist/components/carousel/Carousel.vue.d.ts +39 -0
- package/dist/components/carousel/types.d.ts +75 -0
- package/dist/components/carousel/useCarousel.d.ts +152 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +36 -0
- package/dist/components/checkbox/CheckboxGroup.vue.d.ts +16 -0
- package/dist/components/checkbox/types.d.ts +78 -0
- package/dist/components/chip/Chip.vue.d.ts +37 -0
- package/dist/components/chip/ChipGroup.vue.d.ts +21 -0
- package/dist/components/chip/context.d.ts +22 -0
- package/dist/components/chip/types.d.ts +84 -0
- package/dist/components/container/Container.vue.d.ts +18 -0
- package/dist/components/container/types.d.ts +17 -0
- package/dist/components/currency-input/CurrencyInput.vue.d.ts +17 -0
- package/dist/components/currency-input/types.d.ts +8 -0
- package/dist/components/dialog/Dialog.vue.d.ts +34 -0
- package/dist/components/dialog/types.d.ts +25 -0
- package/dist/components/drawer/Drawer.vue.d.ts +36 -0
- package/dist/components/drawer/types.d.ts +30 -0
- package/dist/components/empty-state/EditorPlaceholder.vue.d.ts +9 -0
- package/dist/components/empty-state/EmptyState.vue.d.ts +28 -0
- package/dist/components/empty-state/types.d.ts +59 -0
- package/dist/components/field-wrapper/FieldError.vue.d.ts +37 -0
- package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +30 -0
- package/dist/components/field-wrapper/context.d.ts +44 -0
- package/dist/components/field-wrapper/types.d.ts +38 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +48 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +77 -0
- package/dist/components/filter-panel/Histogram.vue.d.ts +15 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +20 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +12 -0
- package/dist/components/filter-panel/facets/shared.d.ts +39 -0
- package/dist/components/filter-panel/northwind.d.ts +32 -0
- package/dist/components/filter-panel/swatchInk.d.ts +50 -0
- package/dist/components/filter-panel/types.d.ts +183 -0
- package/dist/components/filter-panel/useFilterPanel.d.ts +230 -0
- package/dist/components/form-layout/FormLayout.vue.d.ts +36 -0
- package/dist/components/form-layout/context.d.ts +33 -0
- package/dist/components/form-layout/focusInvalid.d.ts +18 -0
- package/dist/components/form-layout/types.d.ts +52 -0
- package/dist/components/icon/Icon.vue.d.ts +8 -0
- package/dist/components/icon/types.d.ts +29 -0
- package/dist/components/image/Image.vue.d.ts +21 -0
- package/dist/components/image/types.d.ts +81 -0
- package/dist/components/input/Input.vue.d.ts +47 -0
- package/dist/components/input/classes.d.ts +110 -0
- package/dist/components/input/types.d.ts +55 -0
- package/dist/components/internal/ValueText.vue.d.ts +7 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +19 -0
- package/dist/components/lightbox/types.d.ts +47 -0
- package/dist/components/link/Link.vue.d.ts +23 -0
- package/dist/components/link/types.d.ts +40 -0
- package/dist/components/load-more/LoadMore.vue.d.ts +12 -0
- package/dist/components/load-more/types.d.ts +21 -0
- package/dist/components/logo-item/LogoItem.vue.d.ts +10 -0
- package/dist/components/logo-item/types.d.ts +37 -0
- package/dist/components/pagination/Pagination.vue.d.ts +15 -0
- package/dist/components/pagination/types.d.ts +51 -0
- package/dist/components/popover/Popover.vue.d.ts +31 -0
- package/dist/components/popover/types.d.ts +53 -0
- package/dist/components/price/Price.vue.d.ts +25 -0
- package/dist/components/price/types.d.ts +104 -0
- package/dist/components/product-card/ProductCard.vue.d.ts +22 -0
- package/dist/components/product-card/types.d.ts +123 -0
- package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +26 -0
- package/dist/components/quantity-stepper/types.d.ts +35 -0
- package/dist/components/radio/RadioGroup.vue.d.ts +38 -0
- package/dist/components/radio/types.d.ts +39 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +70 -0
- package/dist/components/range-slider/types.d.ts +151 -0
- package/dist/components/range-slider/useRangeSlider.d.ts +106 -0
- package/dist/components/rating/Rating.vue.d.ts +22 -0
- package/dist/components/rating/RatingStars.vue.d.ts +16 -0
- package/dist/components/rating/types.d.ts +45 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +47 -0
- package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +93 -0
- package/dist/components/search-bar/shortcutOwner.d.ts +39 -0
- package/dist/components/search-bar/types.d.ts +122 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +53 -0
- package/dist/components/search-modal/types.d.ts +59 -0
- package/dist/components/section/Section.vue.d.ts +21 -0
- package/dist/components/section/context.d.ts +23 -0
- package/dist/components/section/types.d.ts +34 -0
- package/dist/components/select/MultiSelect.vue.d.ts +62 -0
- package/dist/components/select/Select.vue.d.ts +57 -0
- package/dist/components/select/SelectPanel.vue.d.ts +97 -0
- package/dist/components/select/openRegistry.d.ts +11 -0
- package/dist/components/select/panelParts.d.ts +91 -0
- package/dist/components/select/types.d.ts +129 -0
- package/dist/components/select/useListbox.d.ts +106 -0
- package/dist/components/select/useOptionList.d.ts +61 -0
- package/dist/components/select/usePopover.d.ts +147 -0
- package/dist/components/skeleton/Skeleton.vue.d.ts +12 -0
- package/dist/components/skeleton/types.d.ts +38 -0
- package/dist/components/spinner/Spinner.vue.d.ts +3 -0
- package/dist/components/switch/Switch.vue.d.ts +30 -0
- package/dist/components/switch/types.d.ts +20 -0
- package/dist/components/tabs/Tab.vue.d.ts +17 -0
- package/dist/components/tabs/TabPanel.vue.d.ts +16 -0
- package/dist/components/tabs/Tabs.vue.d.ts +28 -0
- package/dist/components/tabs/context.d.ts +48 -0
- package/dist/components/tabs/types.d.ts +63 -0
- package/dist/components/textarea/Textarea.vue.d.ts +27 -0
- package/dist/components/textarea/supportsFieldSizing.d.ts +10 -0
- package/dist/components/textarea/types.d.ts +32 -0
- package/dist/components/toast/Toast.vue.d.ts +16 -0
- package/dist/components/toast/Toaster.vue.d.ts +13 -0
- package/dist/components/toast/types.d.ts +44 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +9 -0
- package/dist/components/tooltip/supportsFocusVisible.d.ts +17 -0
- package/dist/components/tooltip/types.d.ts +46 -0
- package/dist/components/unit-input/UnitInput.vue.d.ts +55 -0
- package/dist/components/unit-input/types.d.ts +68 -0
- package/dist/components/unit-input/undo-redo.d.ts +6 -0
- package/dist/components/variant-picker/VariantPicker.vue.d.ts +15 -0
- package/dist/components/variant-picker/types.d.ts +49 -0
- package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +18 -0
- package/dist/components/visually-hidden/types.d.ts +14 -0
- package/dist/composables/dialogStack.d.ts +52 -0
- package/dist/composables/teleportTarget.d.ts +79 -0
- package/dist/composables/useControllableModel.d.ts +16 -0
- package/dist/composables/useDialog.d.ts +84 -0
- package/dist/composables/useFloating.d.ts +82 -0
- package/dist/composables/useHeadingTag.d.ts +24 -0
- package/dist/composables/useLocale.d.ts +81 -0
- package/dist/composables/useMessages.d.ts +30 -0
- package/dist/composables/useOverlay.d.ts +88 -0
- package/dist/composables/useSlotPresence.d.ts +29 -0
- package/dist/composables/useToast.d.ts +53 -0
- package/dist/icons/paths.d.ts +10 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +12586 -0
- package/dist/listFormat-1UrH38f2.js +39 -0
- package/dist/messages/en-US.d.ts +485 -0
- package/dist/messages/index.d.ts +2 -0
- package/dist/messages/is-IS.d.ts +16 -0
- package/dist/messages/is-IS.js +169 -0
- package/dist/resolver.d.ts +43 -0
- package/dist/resolver.js +121 -0
- package/dist/style.css +5251 -0
- package/dist/tailwind.css +2057 -0
- package/dist/tokens.css +134 -0
- package/dist/utils/avatar.d.ts +15 -0
- package/dist/utils/color.d.ts +11 -0
- package/dist/utils/cssTiming.d.ts +40 -0
- package/dist/utils/cx.d.ts +31 -0
- package/dist/utils/date.d.ts +45 -0
- package/dist/utils/id.d.ts +36 -0
- package/dist/utils/listFormat.d.ts +22 -0
- package/dist/utils/mask.d.ts +48 -0
- package/dist/utils/number-format.d.ts +250 -0
- package/dist/utils/numeric-input.d.ts +42 -0
- package/dist/utils/rating.d.ts +26 -0
- package/dist/utils/ratio.d.ts +18 -0
- package/dist/utils/tagRecipe.d.ts +24 -0
- package/dist/utils/valueFade.d.ts +42 -0
- package/dist/vee-validate/FieldCheckbox.vue.d.ts +14 -0
- package/dist/vee-validate/FieldCheckboxGroup.vue.d.ts +14 -0
- package/dist/vee-validate/FieldCurrencyInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldMultiSelect.vue.d.ts +14 -0
- package/dist/vee-validate/FieldQuantityStepper.vue.d.ts +14 -0
- package/dist/vee-validate/FieldRadioGroup.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSearchBar.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSelect.vue.d.ts +14 -0
- package/dist/vee-validate/FieldSwitch.vue.d.ts +14 -0
- package/dist/vee-validate/FieldTextarea.vue.d.ts +14 -0
- package/dist/vee-validate/FieldUnitInput.vue.d.ts +14 -0
- package/dist/vee-validate/FieldVariantPicker.vue.d.ts +14 -0
- package/dist/vee-validate/Form.vue.d.ts +27 -0
- package/dist/vee-validate/context.d.ts +48 -0
- package/dist/vee-validate/index.d.ts +27 -0
- package/dist/vee-validate/types.d.ts +115 -0
- package/dist/vee-validate/useFieldControl.d.ts +67 -0
- package/dist/vee-validate.js +1154 -0
- package/package.json +99 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* What a `ChipGroup` tells the `Chip`s inside it.
|
|
4
|
+
*
|
|
5
|
+
* A `ChipGroup` does not render its children — a consumer places `<Chip>`s in its default slot,
|
|
6
|
+
* same as `ButtonGroup` — so a child cannot be told its selected state or how to toggle through
|
|
7
|
+
* props the group would otherwise have to thread down manually. Context is what lets a bare
|
|
8
|
+
* `<Chip value="wool" selectable>` inside a `<ChipGroup>` need no wiring of its own: it injects
|
|
9
|
+
* this optionally (`inject(CHIP_GROUP_KEY, null)`), and only a `Chip` with both a `value` and a
|
|
10
|
+
* group above it defers to it — everywhere else, `Chip`'s own `selected` prop and
|
|
11
|
+
* `update:selected` emit are the only source of truth (see `Chip.vue`'s own comment).
|
|
12
|
+
*/
|
|
13
|
+
export interface ChipGroupContext {
|
|
14
|
+
/** Whether `value` is in the group's `modelValue`. */
|
|
15
|
+
isSelected: (value: string) => boolean;
|
|
16
|
+
/** Flips `value` in the group's `modelValue` and emits `update:modelValue`. */
|
|
17
|
+
toggle: (value: string) => void;
|
|
18
|
+
/** The group's own `disabled`, which a member `Chip` combines with its own (either disables it). */
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The key a `ChipGroup` provides its `ChipGroupContext` on. */
|
|
22
|
+
export declare const CHIP_GROUP_KEY: InjectionKey<ComputedRef<ChipGroupContext>>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { UiMessages } from '../../messages/en-US.js';
|
|
2
|
+
import { IconComponent } from '../icon/types.js';
|
|
3
|
+
import { ImageMedia } from '../image/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* `Chip` and `ChipGroup` are an operator addition (2026-09-25), not a design spec 1 section — see
|
|
6
|
+
* `README.md`'s Additions list. The visual language is derived from two spec sections that do
|
|
7
|
+
* exist: Badge's pill shape (`## Badge` → Properties, `pill` row) and Multi-select's removable tag
|
|
8
|
+
* row (`## Multi-select` → Sizes, Tags row), which is also where `Chip`'s `sm` size and its remove
|
|
9
|
+
* button come from directly — see `src/utils/tagRecipe.ts`, shared with `MultiSelect.vue`.
|
|
10
|
+
*/
|
|
11
|
+
export type ChipPart = 'root' | 'icon' | 'avatar' | 'label' | 'removeButton';
|
|
12
|
+
/**
|
|
13
|
+
* `sm` is the exact "small chip" `MultiSelect`'s own tag row draws (1.75rem min height, 0.8125rem
|
|
14
|
+
* text). `md` is this component's own, larger recipe: 2.25rem min height, 0.875rem text — a chip
|
|
15
|
+
* a consumer reaches for on its own, outside a control's tag row, wants a target closer to the
|
|
16
|
+
* package's other controls' minimum (2.5.8) than the tag row's compact 1.75rem.
|
|
17
|
+
*/
|
|
18
|
+
export type ChipSize = 'sm' | 'md';
|
|
19
|
+
export interface ChipProps {
|
|
20
|
+
/** The visible text (content). Also the default slot's fallback. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** One of the two sizes. Defaults to `md`. */
|
|
23
|
+
size?: ChipSize;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a remove button, named `"Remove <label>"` (`messages.removeTag`, the same message
|
|
26
|
+
* `MultiSelect`'s own tags use). See `Chip.vue`'s own comment for why a removable chip's root is
|
|
27
|
+
* never also the selection toggle, whatever `selectable` says.
|
|
28
|
+
*/
|
|
29
|
+
removable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Renders the root as a `<button type="button" aria-pressed>` that toggles `selected` on click —
|
|
32
|
+
* unless `removable` is also `true` (see `Chip.vue`'s comment). Ignored inside a `ChipGroup`
|
|
33
|
+
* that already derives `selected` for this chip (a `value` set and a group above it): the group
|
|
34
|
+
* still needs `selectable` on the child chip to render it as a button in the first place, but the
|
|
35
|
+
* *value* toggled is the group's `modelValue`, not this chip's own `selected`.
|
|
36
|
+
*/
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Selected state (two-way, `update:selected`). Ignored — read from the `ChipGroup` context
|
|
40
|
+
* instead — when this chip has both a `value` and a `ChipGroup` ancestor.
|
|
41
|
+
*/
|
|
42
|
+
selected?: boolean;
|
|
43
|
+
/** Not focusable or clickable; the remove button, if any, is disabled too. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** A decorative leading icon. Ignored when `avatar` is also given. */
|
|
46
|
+
icon?: IconComponent;
|
|
47
|
+
/**
|
|
48
|
+
* A decorative leading photo, drawn with `Avatar` at the chip's own icon size (see `Chip.vue`'s
|
|
49
|
+
* comment — no built-in `Avatar` size is small enough to sit inside either chip size). A missing
|
|
50
|
+
* or failed image falls back to initials of `label`, then to `Avatar`'s own user icon — both
|
|
51
|
+
* scaled down to fit the chip's own leading slot. Takes priority over `icon` when both are given.
|
|
52
|
+
*/
|
|
53
|
+
avatar?: ImageMedia | string | null;
|
|
54
|
+
/** This chip's value inside a `ChipGroup` — see `selected` and `ChipGroup`'s own docs. */
|
|
55
|
+
value?: string;
|
|
56
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
57
|
+
classes?: Partial<Record<ChipPart, string>>;
|
|
58
|
+
/**
|
|
59
|
+
* Overrides for the one string this component renders itself: `removeTag`, the remove button's
|
|
60
|
+
* accessible name, which defaults to "Remove <label>".
|
|
61
|
+
*
|
|
62
|
+
* It is a prop rather than only the ambient provide because the override is often **per chip**
|
|
63
|
+
* rather than per app: a row of filter chips all read "Brown", "M", "Sweaters", and each one's
|
|
64
|
+
* remove button has to say which facet it belongs to ("Remove filter Colour: Brown") — one
|
|
65
|
+
* provided string cannot, because it cannot see the chip.
|
|
66
|
+
*/
|
|
67
|
+
messages?: Partial<UiMessages>;
|
|
68
|
+
}
|
|
69
|
+
/** The one part a consumer can restyle through `ChipGroup`'s `classes`. */
|
|
70
|
+
export type ChipGroupPart = 'root';
|
|
71
|
+
export interface ChipGroupProps {
|
|
72
|
+
/** The selected chips' values (two-way, `update:modelValue`). */
|
|
73
|
+
modelValue: string[];
|
|
74
|
+
/**
|
|
75
|
+
* The group's accessible name (`aria-label` on the `role="group"` root). Named `ariaLabel`, not
|
|
76
|
+
* `label`: it is never visible text, unlike `label` on `Badge`/`Chip`/`Checkbox`/`Select` and the
|
|
77
|
+
* rest of the package — see the README's "`ariaLabel` is always an accessible name" rule.
|
|
78
|
+
*/
|
|
79
|
+
ariaLabel: string;
|
|
80
|
+
/** Disables every member `Chip`, in addition to whatever each one says on its own. */
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
83
|
+
classes?: Partial<Record<ChipGroupPart, string>>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContainerProps, ContainerWidth } from './types.js';
|
|
2
|
+
declare var __VLS_8: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_8) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<ContainerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ContainerProps> & Readonly<{}>, {
|
|
7
|
+
classes: Partial<Record<import('./types.js').ContainerPart, string>>;
|
|
8
|
+
as: string;
|
|
9
|
+
width: ContainerWidth;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The spec's four content widths (spec "Container and section" → Sizes). */
|
|
2
|
+
export type ContainerWidth = 'narrow' | 'content' | 'wide' | 'full';
|
|
3
|
+
/** The parts a consumer can restyle through `classes`. Container has only the one. */
|
|
4
|
+
export type ContainerPart = 'root';
|
|
5
|
+
export interface ContainerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Maximum content width. `narrow` (40rem: FAQ, rich text, newsletter, quote), `content` (64rem:
|
|
8
|
+
* most blocks, product detail, cart), `wide` (80rem: product grids, galleries, collection pages,
|
|
9
|
+
* header, footer) or `full` (100%, no gutters: full-bleed media, image-background hero, gallery
|
|
10
|
+
* carousel). Defaults to `content`.
|
|
11
|
+
*/
|
|
12
|
+
width?: ContainerWidth;
|
|
13
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
14
|
+
classes?: Partial<Record<ContainerPart, string>>;
|
|
15
|
+
/** Render as a different tag instead of a native `<div>` — a `<figure>` around full-bleed media. */
|
|
16
|
+
as?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CurrencyInputProps } from './types.js';
|
|
2
|
+
declare var __VLS_10: string, __VLS_11: any;
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<CurrencyInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CurrencyInputProps> & Readonly<{}>, {
|
|
7
|
+
currency: string;
|
|
8
|
+
narrowSymbol: boolean;
|
|
9
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UnitInputPart, UnitInputProps } from '../unit-input/types.js';
|
|
2
|
+
/** `CurrencyInput` is a `UnitInput`, so its parts are the same ones. */
|
|
3
|
+
export type CurrencyInputPart = UnitInputPart;
|
|
4
|
+
/**
|
|
5
|
+
* Everything `UnitInput` takes except the two things a money field decides for itself: it is
|
|
6
|
+
* always a currency, and a currency has no `unit`.
|
|
7
|
+
*/
|
|
8
|
+
export type CurrencyInputProps = Omit<UnitInputProps, 'isCurrency' | 'unit'>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DialogProps } from './types.js';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_3: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
footer?: (props: typeof __VLS_3) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
|
|
9
|
+
close: (returnValue?: string) => void;
|
|
10
|
+
isTop: import('vue').ComputedRef<boolean>;
|
|
11
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: boolean) => any;
|
|
13
|
+
close: (reason: string) => any;
|
|
14
|
+
cancel: () => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<DialogProps> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
onClose?: ((reason: string) => any) | undefined;
|
|
18
|
+
onCancel?: (() => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
size: import('./types.js').DialogSize;
|
|
21
|
+
classes: Partial<Record<import('./types.js').DialogPart, string>>;
|
|
22
|
+
modelValue: boolean;
|
|
23
|
+
messages: Partial<import('../../index.js').UiMessages>;
|
|
24
|
+
description: string;
|
|
25
|
+
dismissable: boolean;
|
|
26
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UiMessages } from '../../composables/useMessages.js';
|
|
2
|
+
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
3
|
+
export type DialogPart = 'root' | 'panel' | 'header' | 'title' | 'close' | 'description' | 'body' | 'footer';
|
|
4
|
+
/** The spec's two panel widths: `sm` 24rem, `md` (the default) 32rem — both capped at the
|
|
5
|
+
* viewport width minus 2rem. */
|
|
6
|
+
export type DialogSize = 'sm' | 'md';
|
|
7
|
+
export interface DialogProps {
|
|
8
|
+
/** Shows the dialog with `showModal()` when `true`, closes it when `false` (two-way). */
|
|
9
|
+
modelValue?: boolean;
|
|
10
|
+
/** The `<h2>` title text; the dialog's accessible name (`aria-labelledby`). */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Body text below the title; the dialog is `aria-describedby` it. Omit when the body is a
|
|
13
|
+
* form — the spec's own Form variant carries no `description`. */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Panel width: `sm` 24rem, `md` (default) 32rem, always capped at `100vw - 2rem`. */
|
|
16
|
+
size?: DialogSize;
|
|
17
|
+
/** Whether a backdrop click closes the dialog. `Esc` and the close button always do. Set
|
|
18
|
+
* `false` for a form with unsaved input, or a destructive confirm a stray click must not
|
|
19
|
+
* count as an answer for. Default `true`. */
|
|
20
|
+
dismissable?: boolean;
|
|
21
|
+
/** Message overrides (only `close` applies here). See `useMessages`. */
|
|
22
|
+
messages?: Partial<UiMessages>;
|
|
23
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
24
|
+
classes?: Partial<Record<DialogPart, string>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DrawerProps } from './types.js';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_3: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
footer?: (props: typeof __VLS_3) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<DrawerProps, {
|
|
9
|
+
close: (returnValue?: string) => void;
|
|
10
|
+
isTop: import('vue').ComputedRef<boolean>;
|
|
11
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: boolean) => any;
|
|
13
|
+
close: (reason: string) => any;
|
|
14
|
+
cancel: () => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<DrawerProps> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
onClose?: ((reason: string) => any) | undefined;
|
|
18
|
+
onCancel?: (() => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
title: string;
|
|
21
|
+
classes: Partial<Record<import('./types.js').DrawerPart, string>>;
|
|
22
|
+
modelValue: boolean;
|
|
23
|
+
ariaLabel: string;
|
|
24
|
+
count: number;
|
|
25
|
+
messages: Partial<import('../../index.js').UiMessages>;
|
|
26
|
+
width: string;
|
|
27
|
+
side: import('./types.js').DrawerSide;
|
|
28
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UiMessages } from '../../composables/useMessages.js';
|
|
2
|
+
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
3
|
+
export type DrawerPart = 'root' | 'panel' | 'header' | 'title' | 'count' | 'close' | 'body' | 'footer';
|
|
4
|
+
/** The edge the sheet slides in from. `left` is for the mobile menu; everything else (cart,
|
|
5
|
+
* filters, quick view) is `right`, the default. */
|
|
6
|
+
export type DrawerSide = 'right' | 'left';
|
|
7
|
+
export interface DrawerProps {
|
|
8
|
+
/** Shows the drawer with `showModal()` when `true`, closes it when `false` (two-way). */
|
|
9
|
+
modelValue?: boolean;
|
|
10
|
+
/** The edge the sheet slides in from. Default `"right"`. */
|
|
11
|
+
side?: DrawerSide;
|
|
12
|
+
/** The visible `<h2>` title, e.g. "Your cart"; the drawer is `aria-labelledby` it. Use either
|
|
13
|
+
* `title` or `ariaLabel`, never neither. */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** The drawer's accessible name when there is no visible heading that names it well (the menu:
|
|
16
|
+
* `ariaLabel="Menu"`). Ignored when `title` is set — `title` already names it. */
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
/** An optional count shown after the title in `muted`, weight 400: "Your cart (3)". Only
|
|
19
|
+
* rendered alongside `title`. */
|
|
20
|
+
count?: number;
|
|
21
|
+
/** The panel's own maximum width (a CSS length, e.g. `"26rem"`), always capped at 100% of the
|
|
22
|
+
* viewport. Default `"28rem"`. Below a 48rem *viewport* the drawer covers the full screen
|
|
23
|
+
* regardless of this value. */
|
|
24
|
+
width?: string;
|
|
25
|
+
/** Message overrides (only `close` applies here, unless a name is available — see
|
|
26
|
+
* `closeDrawer`). See `useMessages`. */
|
|
27
|
+
messages?: Partial<UiMessages>;
|
|
28
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
29
|
+
classes?: Partial<Record<DrawerPart, string>>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorPlaceholderProps } from './types.js';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<EditorPlaceholderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EditorPlaceholderProps> & Readonly<{}>, {
|
|
3
|
+
help: string | null;
|
|
4
|
+
classes: Partial<Record<import('./types.js').EditorPlaceholderPart, string>>;
|
|
5
|
+
icon: import('../../index.js').IconComponent | null;
|
|
6
|
+
inline: boolean;
|
|
7
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EmptyStateProps, EmptyStateVariant } from './types.js';
|
|
2
|
+
declare var __VLS_12: {
|
|
3
|
+
retrying: boolean;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
actions?: (props: typeof __VLS_12) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<EmptyStateProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
retry: () => any;
|
|
10
|
+
}, string, import('vue').PublicProps, Readonly<EmptyStateProps> & Readonly<{
|
|
11
|
+
onRetry?: (() => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
text: string | null;
|
|
14
|
+
classes: Partial<Record<import('./types.js').EmptyStatePart, string>>;
|
|
15
|
+
headingLevel: import('../../index.js').HeadingLevel;
|
|
16
|
+
icon: import('../../index.js').IconComponent;
|
|
17
|
+
variant: EmptyStateVariant;
|
|
18
|
+
plain: boolean;
|
|
19
|
+
retrying: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HeadingLevel } from '../../composables/useHeadingTag.js';
|
|
2
|
+
import { IconComponent } from '../icon/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The design spec's three empty/error states (spec "Empty and error states" → Properties,
|
|
5
|
+
* `variant` row). `noResults` sets `role="status"`; `error` sets `role="alert"` and colours the
|
|
6
|
+
* icon `danger`. `plain` (spec's fourth row) is a separate boolean modifier, not a variant — it
|
|
7
|
+
* only changes the boundary, not the content — see `EmptyStateProps.plain`.
|
|
8
|
+
*/
|
|
9
|
+
export type EmptyStateVariant = 'empty' | 'noResults' | 'error';
|
|
10
|
+
/** The parts a consumer can restyle through `classes`, named after the spec's anatomy: the icon
|
|
11
|
+
* circle (1), the title (2), the text (3) and the actions row (4). */
|
|
12
|
+
export type EmptyStatePart = 'root' | 'icon' | 'title' | 'text' | 'actions';
|
|
13
|
+
export interface EmptyStateProps {
|
|
14
|
+
/** Which state this is (spec "Empty and error states" → Variants). Defaults to `empty`. */
|
|
15
|
+
variant?: EmptyStateVariant;
|
|
16
|
+
/**
|
|
17
|
+
* The icon inside the decorative circle (spec → Properties, `icon` row: "per use", e.g.
|
|
18
|
+
* `shopping-bag`, `search`, `alert-triangle`, `heart`). Without one, a built-in default is drawn
|
|
19
|
+
* per `variant` — see `EmptyState.vue`'s own comment. `error` always colours the icon `danger`,
|
|
20
|
+
* whichever icon is showing (spec → Variants, "Error" row: "icon turns `danger`").
|
|
21
|
+
*/
|
|
22
|
+
icon?: IconComponent;
|
|
23
|
+
/** Plain statement ("Your cart is empty"); for `noResults`, echo the search query. Required —
|
|
24
|
+
* the spec gives every empty state exactly one next step, and that starts with a real title. */
|
|
25
|
+
title: string;
|
|
26
|
+
/** One or two sentences with the next step. `null` (the default) renders nothing. */
|
|
27
|
+
text?: string | null;
|
|
28
|
+
/** No border or background; for drawers, lists and cards that already draw their own boundary
|
|
29
|
+
* (spec → Variants, "Plain" row). */
|
|
30
|
+
plain?: boolean;
|
|
31
|
+
/** The title's heading level. `2` for a page-level state, `3` (the default) inside a block. */
|
|
32
|
+
headingLevel?: HeadingLevel;
|
|
33
|
+
/**
|
|
34
|
+
* `error` only: the built-in "Try again" button shows its busy state (spinner, `aria-busy`) —
|
|
35
|
+
* only takes effect while there is no `actions` slot, since a caller-supplied button reads this
|
|
36
|
+
* from the slot's own scope instead (see the `actions` slot below).
|
|
37
|
+
*/
|
|
38
|
+
retrying?: boolean;
|
|
39
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
40
|
+
classes?: Partial<Record<EmptyStatePart, string>>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The parts a consumer can restyle through `classes`: the icon (optional), the action label
|
|
44
|
+
* (strong) and the guidance text, named after the spec's own editor-hint anatomy.
|
|
45
|
+
*/
|
|
46
|
+
export type EditorPlaceholderPart = 'root' | 'icon' | 'label' | 'help';
|
|
47
|
+
export interface EditorPlaceholderProps {
|
|
48
|
+
/** E.g. `plus`, `photo`. `null` (the default) renders no icon. */
|
|
49
|
+
icon?: IconComponent | null;
|
|
50
|
+
/** The action, e.g. "Add products", "Choose an image", "Add a heading". */
|
|
51
|
+
label: string;
|
|
52
|
+
/** Guidance, e.g. "Pick a collection or up to 12 products to show in this grid." `null` (the
|
|
53
|
+
* default) renders no help line. */
|
|
54
|
+
help?: string | null;
|
|
55
|
+
/** Compact padding, for an empty inline field (e.g. an empty heading). Defaults to `false`. */
|
|
56
|
+
inline?: boolean;
|
|
57
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
58
|
+
classes?: Partial<Record<EditorPlaceholderPart, string>>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A field's error row: the `alert-circle` icon and the message, as the design spec's Field wrapper
|
|
3
|
+
* section sizes them (0.8125rem / 1.45, weight 500, `danger`, the icon top-aligned and 0.3125rem
|
|
4
|
+
* from the text — `gap-1.25` on the 0.25rem step).
|
|
5
|
+
*
|
|
6
|
+
* **Internal.** It is not exported from the package and has no props of its own beyond the wiring:
|
|
7
|
+
* it exists because `FieldWrapper` and `CheckboxGroup` draw the same row, and a hand-copied
|
|
8
|
+
* `<svg>` in two files is a path drifting apart. Both keep their own `error` and `errorIcon`
|
|
9
|
+
* parts — the `data-part`s and the `classes` keys are the *parent's*, not this component's, which
|
|
10
|
+
* is why the parent's `classes` object is handed straight through.
|
|
11
|
+
*
|
|
12
|
+
* The row is linked by id, never a live region: the spec's Accessibility notes put the error in
|
|
13
|
+
* `aria-describedby` so it is announced on focus, and leave announcing a failed submit to the
|
|
14
|
+
* form's own error summary. A `role="alert"` here would read every error again the moment it
|
|
15
|
+
* rendered.
|
|
16
|
+
*/
|
|
17
|
+
type __VLS_Props = {
|
|
18
|
+
/** The id the field points at with `aria-describedby`. */
|
|
19
|
+
id?: string;
|
|
20
|
+
/** Extra classes for the row — the inline form's full-width row. */
|
|
21
|
+
rowClass?: string;
|
|
22
|
+
/** The parent's per-part overrides. Only `error` and `errorIcon` are read. */
|
|
23
|
+
classes?: Partial<Record<'error' | 'errorIcon', string>>;
|
|
24
|
+
};
|
|
25
|
+
declare var __VLS_1: {};
|
|
26
|
+
type __VLS_Slots = {} & {
|
|
27
|
+
default?: (props: typeof __VLS_1) => any;
|
|
28
|
+
};
|
|
29
|
+
declare const __VLS_base: 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>;
|
|
30
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
32
|
+
export default _default;
|
|
33
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
34
|
+
new (): {
|
|
35
|
+
$slots: S;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FieldWrapperProps } from './types.js';
|
|
2
|
+
declare var __VLS_20: {}, __VLS_22: {}, __VLS_30: {}, __VLS_32: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
label?: (props: typeof __VLS_20) => any;
|
|
5
|
+
} & {
|
|
6
|
+
default?: (props: typeof __VLS_22) => any;
|
|
7
|
+
} & {
|
|
8
|
+
error?: (props: typeof __VLS_30) => any;
|
|
9
|
+
} & {
|
|
10
|
+
help?: (props: typeof __VLS_32) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import('vue').DefineComponent<FieldWrapperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldWrapperProps> & Readonly<{}>, {
|
|
13
|
+
counter: import('./types.js').FieldWrapperCounter;
|
|
14
|
+
help: string;
|
|
15
|
+
classes: Partial<Record<import('./types.js').FieldWrapperPart, string>>;
|
|
16
|
+
required: boolean;
|
|
17
|
+
optional: boolean;
|
|
18
|
+
error: string;
|
|
19
|
+
group: boolean;
|
|
20
|
+
id: string;
|
|
21
|
+
full: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* What a field wrapper tells the control inside it.
|
|
4
|
+
*
|
|
5
|
+
* The design spec's Input, Textarea, Select and the rest all sit in a **Field wrapper**, which
|
|
6
|
+
* owns the visible label, the help text and the error message — so it is the wrapper, not the
|
|
7
|
+
* control, that knows the control's `id`, which ids describe it (error first), whether it is
|
|
8
|
+
* currently in error and whether it is required. Providing that here is what lets a bare
|
|
9
|
+
* `<Input />` inside a `<FieldWrapper>` need no wiring at all.
|
|
10
|
+
*
|
|
11
|
+
* Every consumer injects it optionally (`inject(FIELD_KEY, null)`) and lets its own props win, so
|
|
12
|
+
* a control outside a wrapper behaves exactly as its props say.
|
|
13
|
+
*/
|
|
14
|
+
export interface FieldContext {
|
|
15
|
+
/** The control's `id`, which the wrapper's `<label for>` points at. */
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* The id of the wrapper's own `<label>` (or a group's `<legend>`).
|
|
19
|
+
*
|
|
20
|
+
* A `<label for>` cannot name a `<button>`, so the custom `Select`/`MultiSelect` triggers are
|
|
21
|
+
* named with `aria-labelledby` pointing here instead. It lives on the context rather than being
|
|
22
|
+
* rebuilt from `id` by string convention in each control, so renaming it is one edit and cannot
|
|
23
|
+
* leave a control pointing at an element that no longer exists.
|
|
24
|
+
*/
|
|
25
|
+
labelId: string;
|
|
26
|
+
/** The `aria-describedby` value: the error id first, then help. */
|
|
27
|
+
describedBy?: string;
|
|
28
|
+
/** Whether the field is in error, which the control mirrors as `aria-invalid="true"`. */
|
|
29
|
+
invalid: boolean;
|
|
30
|
+
/** Whether the field must be filled in, which the control mirrors as native `required`. */
|
|
31
|
+
required: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the wrapper renders a `<label for>` that already names the control with this `id`.
|
|
34
|
+
*
|
|
35
|
+
* True for an ordinary field, false for a `group` (a `<fieldset>` is named by its `<legend>`,
|
|
36
|
+
* which labels nothing in particular). A control that draws a `<label>` of **its own** — a
|
|
37
|
+
* `Checkbox` wraps its box and text in one — reads this and drops that label rather than giving
|
|
38
|
+
* one control two, and a control that would otherwise take `id` from here leaves it alone when
|
|
39
|
+
* this is false, because a group's `id` is the fieldset's own.
|
|
40
|
+
*/
|
|
41
|
+
labelsControl: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** The key a `FieldWrapper` provides its `FieldContext` on. */
|
|
44
|
+
export declare const FIELD_KEY: InjectionKey<ComputedRef<FieldContext>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
|
|
2
|
+
export type FieldWrapperPart = 'root' | 'label' | 'legend' | 'requiredMark' | 'optionalText' | 'help' | 'control' | 'error' | 'errorIcon' | 'foot' | 'counter';
|
|
3
|
+
/** The character counter shown at the end of the foot row. */
|
|
4
|
+
export interface FieldWrapperCounter {
|
|
5
|
+
/** The limit the value is counted against. */
|
|
6
|
+
max: number;
|
|
7
|
+
/** The current length. Defaults to `0`, so an empty field reads "0 / 200". */
|
|
8
|
+
value?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FieldWrapperProps {
|
|
11
|
+
/** The visible label, written as a noun ("Postcode"). */
|
|
12
|
+
label: string;
|
|
13
|
+
/** The control's id. Generated when it is not given, and handed to the control either way. */
|
|
14
|
+
id?: string;
|
|
15
|
+
/** Shows `*` and sets native `required` on the control. */
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Shows "(optional)". Mark only the minority of fields per form. */
|
|
18
|
+
optional?: boolean;
|
|
19
|
+
/** A short instruction ("Like BS1 4XE"), linked to the control by `aria-describedby`. */
|
|
20
|
+
help?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The error message. When set the error is shown with its icon, the control reads
|
|
23
|
+
* `aria-invalid="true"`, and the error's id comes first in `aria-describedby`.
|
|
24
|
+
*/
|
|
25
|
+
error?: string;
|
|
26
|
+
/** Shows the "n / max" counter in the foot row. */
|
|
27
|
+
counter?: FieldWrapperCounter;
|
|
28
|
+
/**
|
|
29
|
+
* Renders a `<fieldset>` with the label as its `<legend>`, for a set of checkboxes or radios
|
|
30
|
+
* that share one question. There is no single control to tie a `<label for>` to, so the help and
|
|
31
|
+
* error are linked to the fieldset itself.
|
|
32
|
+
*/
|
|
33
|
+
group?: boolean;
|
|
34
|
+
/** Spans both columns of a two-column `FormLayout`. */
|
|
35
|
+
full?: boolean;
|
|
36
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
37
|
+
classes?: Partial<Record<FieldWrapperPart, string>>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FilterFacet, FilterPanelPart } from './types.js';
|
|
2
|
+
import { UiMessages } from '../../messages/en-US.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
facet: FilterFacet;
|
|
5
|
+
/** Whether the body is on screen. The panel owns it; this component only asks to flip it. */
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** The badge's number. Hidden entirely at 0 (spec → Behaviour). */
|
|
8
|
+
count: number;
|
|
9
|
+
/** The selected labels, drawn as the summary while the group is collapsed. */
|
|
10
|
+
summary: string[];
|
|
11
|
+
triggerId: string;
|
|
12
|
+
panelId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to draw the rule **above** this group. Spec → Sizes, Group row: "1px `border` rule
|
|
15
|
+
* above every group and below the last. A group that comes first in the panel (no head) has no
|
|
16
|
+
* top rule" — every group draws the rule below itself, so only the first one needs this, and
|
|
17
|
+
* only when something (the head, the applied chips) sits above it.
|
|
18
|
+
*/
|
|
19
|
+
topRule?: boolean;
|
|
20
|
+
/** `Esc` collapses a group in the sidebar; in the drawer `Esc` belongs to the dialog. */
|
|
21
|
+
escCollapses?: boolean;
|
|
22
|
+
classes?: Partial<Record<FilterPanelPart, string>>;
|
|
23
|
+
messages?: Partial<UiMessages>;
|
|
24
|
+
};
|
|
25
|
+
declare var __VLS_13: {};
|
|
26
|
+
type __VLS_Slots = {} & {
|
|
27
|
+
default?: (props: typeof __VLS_13) => any;
|
|
28
|
+
};
|
|
29
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
toggle: () => any;
|
|
31
|
+
collapse: () => any;
|
|
32
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
33
|
+
onToggle?: (() => any) | undefined;
|
|
34
|
+
onCollapse?: (() => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
classes: Partial<Record<FilterPanelPart, string>>;
|
|
37
|
+
messages: Partial<UiMessages>;
|
|
38
|
+
topRule: boolean;
|
|
39
|
+
escCollapses: boolean;
|
|
40
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|