@eldrajs/ui 0.0.0-stage → 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 +105 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FilterFacet, FilterPanelProps, FilterSelection } from './types.js';
|
|
2
|
+
import { UiMessages } from '../../messages/en-US.js';
|
|
3
|
+
declare function focusTitle(): void;
|
|
4
|
+
/**
|
|
5
|
+
* Focus one applied chip's remove button — what a consumer calls after removing a chip of its own,
|
|
6
|
+
* and what keeps focus inside the chip row rather than at the top of the page.
|
|
7
|
+
*/
|
|
8
|
+
declare function focusChip(index: number): void;
|
|
9
|
+
type __VLS_Slots = {
|
|
10
|
+
/**
|
|
11
|
+
* The drawer foot (spec → Anatomy item 14). Its default content is **Clear all** and **Show N
|
|
12
|
+
* products**, which is what the spec draws, so a consumer fills this only to replace them — the
|
|
13
|
+
* slot is handed the selection, the live count and the two callbacks, so a replacement foot is
|
|
14
|
+
* still this panel's foot rather than a second source of truth beside it.
|
|
15
|
+
*/
|
|
16
|
+
foot?: (props: {
|
|
17
|
+
selection: FilterSelection;
|
|
18
|
+
resultCount: number | null;
|
|
19
|
+
clear: () => void;
|
|
20
|
+
apply: () => void;
|
|
21
|
+
}) => unknown;
|
|
22
|
+
/**
|
|
23
|
+
* One facet's body, for a facet type this package does not draw — the escape hatch that keeps a
|
|
24
|
+
* store from forking the panel to add one group of its own. The head, the chips, the disclosure,
|
|
25
|
+
* the badge and the summary are all still the panel's.
|
|
26
|
+
*/
|
|
27
|
+
facet?: (props: {
|
|
28
|
+
facet: FilterFacet;
|
|
29
|
+
selection: FilterSelection;
|
|
30
|
+
toggle: (value: string, checked: boolean) => void;
|
|
31
|
+
}) => unknown;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_base: import('vue').DefineComponent<FilterPanelProps, {
|
|
34
|
+
focusTitle: typeof focusTitle;
|
|
35
|
+
focusChip: typeof focusChip;
|
|
36
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
37
|
+
clear: () => any;
|
|
38
|
+
"update:modelValue": (selection: FilterSelection) => any;
|
|
39
|
+
change: (selection: FilterSelection) => any;
|
|
40
|
+
remove: (removal: {
|
|
41
|
+
facetId: string;
|
|
42
|
+
value: string;
|
|
43
|
+
}) => any;
|
|
44
|
+
apply: (selection: FilterSelection) => any;
|
|
45
|
+
}, string, import('vue').PublicProps, Readonly<FilterPanelProps> & Readonly<{
|
|
46
|
+
onClear?: (() => any) | undefined;
|
|
47
|
+
"onUpdate:modelValue"?: ((selection: FilterSelection) => any) | undefined;
|
|
48
|
+
onChange?: ((selection: FilterSelection) => any) | undefined;
|
|
49
|
+
onRemove?: ((removal: {
|
|
50
|
+
facetId: string;
|
|
51
|
+
value: string;
|
|
52
|
+
}) => any) | undefined;
|
|
53
|
+
onApply?: ((selection: FilterSelection) => any) | undefined;
|
|
54
|
+
}>, {
|
|
55
|
+
label: string;
|
|
56
|
+
title: string;
|
|
57
|
+
classes: Partial<Record<import('./types.js').FilterPanelPart, string>>;
|
|
58
|
+
modelValue: FilterSelection;
|
|
59
|
+
messages: Partial<UiMessages>;
|
|
60
|
+
locale: string;
|
|
61
|
+
currency: string;
|
|
62
|
+
idPrefix: string;
|
|
63
|
+
dense: boolean;
|
|
64
|
+
mode: import('./types.js').FilterPanelMode;
|
|
65
|
+
facets: FilterFacet[];
|
|
66
|
+
showHead: boolean;
|
|
67
|
+
showApplied: boolean;
|
|
68
|
+
resultCount: number | null;
|
|
69
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
70
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
71
|
+
declare const _default: typeof __VLS_export;
|
|
72
|
+
export default _default;
|
|
73
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
74
|
+
new (): {
|
|
75
|
+
$slots: S;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FilterPanelPart } from './types.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** One product count per equal bucket over `limits`. */
|
|
4
|
+
bars: number[];
|
|
5
|
+
/** The selected span, which decides which bars read as inside it. */
|
|
6
|
+
range: [number, number];
|
|
7
|
+
/** The facet's own bounds, which the buckets are spread over. */
|
|
8
|
+
limits: [number, number];
|
|
9
|
+
classes?: Partial<Record<FilterPanelPart, string>>;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
classes: Partial<Record<FilterPanelPart, string>>;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FacetProps } from './shared.js';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
toggle: (value: string, checked: boolean) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<FacetProps> & Readonly<{
|
|
5
|
+
onToggle?: ((value: string, checked: boolean) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
8
|
+
messages: Partial<import('../../../index.js').UiMessages>;
|
|
9
|
+
dense: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FacetProps } from './shared.js';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
toggle: (value: string, checked: boolean) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<FacetProps> & Readonly<{
|
|
5
|
+
onToggle?: ((value: string, checked: boolean) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
8
|
+
messages: Partial<import('../../../index.js').UiMessages>;
|
|
9
|
+
dense: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FacetProps } from './shared.js';
|
|
2
|
+
type __VLS_Props = FacetProps & {
|
|
3
|
+
/** The locale numbers and prices are formatted in. The panel's own, resolved there. */
|
|
4
|
+
locale?: string;
|
|
5
|
+
/** The currency a money range is formatted in. */
|
|
6
|
+
currency?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
commit: (range: [number, number]) => any;
|
|
10
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
onCommit?: ((range: [number, number]) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
14
|
+
messages: Partial<import('../../../index.js').UiMessages>;
|
|
15
|
+
locale: string;
|
|
16
|
+
currency: string;
|
|
17
|
+
dense: boolean;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FacetProps } from './shared.js';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
toggle: (value: string, checked: boolean) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<FacetProps> & Readonly<{
|
|
5
|
+
onToggle?: ((value: string, checked: boolean) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
8
|
+
messages: Partial<import('../../../index.js').UiMessages>;
|
|
9
|
+
dense: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FacetProps } from './shared.js';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
toggle: (value: string, checked: boolean) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<FacetProps> & Readonly<{
|
|
5
|
+
onToggle?: ((value: string, checked: boolean) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
classes: Partial<Record<import('../types.js').FilterPanelPart, string>>;
|
|
8
|
+
messages: Partial<import('../../../index.js').UiMessages>;
|
|
9
|
+
dense: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { UiMessages } from '../../../messages/en-US.js';
|
|
2
|
+
import { FilterFacet, FilterPanelPart, FilterSelection } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What every facet component is handed. They are private to `FilterPanel`, which is why there is
|
|
5
|
+
* one shared interface rather than five: the panel passes the same bag to all of them, each draws
|
|
6
|
+
* the facet its own way, and each emits the shopper's intent rather than writing the selection.
|
|
7
|
+
*/
|
|
8
|
+
export interface FacetProps {
|
|
9
|
+
facet: FilterFacet;
|
|
10
|
+
/** The whole selection, so a facet can ask whether one of its values is in it. */
|
|
11
|
+
selection: FilterSelection;
|
|
12
|
+
/** Namespaces the ids a facet mints, so a sidebar and a drawer never collide. */
|
|
13
|
+
idPrefix: string;
|
|
14
|
+
/** The tighter targets of a 15rem sidebar. */
|
|
15
|
+
dense?: boolean;
|
|
16
|
+
classes?: Partial<Record<FilterPanelPart, string>>;
|
|
17
|
+
messages?: Partial<UiMessages>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Spec "Filter panel" → Sizes, Option row: "Count 0.8125rem `muted`, tabular figures, pushed to
|
|
21
|
+
* the end." The same count sits at the end of a swatch row and a switch row, so it is written
|
|
22
|
+
* once.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FACET_COUNT = "ms-auto shrink-0 text-caption text-muted tabular-nums";
|
|
25
|
+
/**
|
|
26
|
+
* Spec → States, "Option row, hover" and "Swatch row/tile, hover": "`text` at 6%".
|
|
27
|
+
*
|
|
28
|
+
* A `color-mix` against the token rather than a tint of its own, so a store that changes `text`
|
|
29
|
+
* changes the hover with it — the same shape `Switch`'s own hover fill uses.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FACET_ROW_HOVER = "hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]";
|
|
32
|
+
/**
|
|
33
|
+
* Spec → Sizes, Option row: "padding 0.25rem 0.5rem with a −0.5rem side margin (the hover tint
|
|
34
|
+
* bleeds into the gutter)". The negative margin is what lets the tint reach past the panel's own
|
|
35
|
+
* text edge, so a hovered row reads as a row rather than as a highlighted label.
|
|
36
|
+
*/
|
|
37
|
+
export declare const FACET_ROW_GUTTER = "-mx-2 px-2";
|
|
38
|
+
/** The same, at the swatch row's own tighter 0.375rem padding (spec → Sizes, Swatch row). */
|
|
39
|
+
export declare const FACET_SWATCH_GUTTER = "-mx-1.5 px-1.5";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FilterFacet } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The design spec's own Northwind facets, shared by this component's specs, its stories and its
|
|
4
|
+
* browser spec, so all three are reviewed against the same panel. The colours are the palette the
|
|
5
|
+
* spec publishes by name, which is also what makes the check-mark ink assertions meaningful.
|
|
6
|
+
*
|
|
7
|
+
* It sits beside the component rather than under `__tests__/` because the stories read it too, and
|
|
8
|
+
* nothing in `src/index.ts` imports it — so it is sample content for this package's own review
|
|
9
|
+
* surfaces and never reaches a consumer's bundle.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NORTHWIND_COLOURS: {
|
|
12
|
+
readonly black: "#1f1d1b";
|
|
13
|
+
readonly brown: "#7a5236";
|
|
14
|
+
readonly natural: "#dccfb8";
|
|
15
|
+
readonly white: "#f7f5f0";
|
|
16
|
+
readonly charcoal: "#3d3c3b";
|
|
17
|
+
readonly clay: "#b0603f";
|
|
18
|
+
readonly moss: "#5f6b47";
|
|
19
|
+
readonly navy: "#27324a";
|
|
20
|
+
readonly multi: "conic-gradient(#b0603f 0deg 90deg, #5f6b47 90deg 180deg, #27324a 180deg 270deg, #dccfb8 270deg 360deg)";
|
|
21
|
+
};
|
|
22
|
+
export declare const CATEGORY_FACET: FilterFacet;
|
|
23
|
+
/** Thirteen values: past the search threshold as well as past the six-value one. */
|
|
24
|
+
export declare const MATERIAL_FACET: FilterFacet;
|
|
25
|
+
export declare const COLOUR_FACET: FilterFacet;
|
|
26
|
+
export declare const SIZE_FACET: FilterFacet;
|
|
27
|
+
export declare const PRICE_FACET: FilterFacet;
|
|
28
|
+
export declare const AVAILABILITY_FACET: FilterFacet;
|
|
29
|
+
/** Every facet type at once, in the order the spec's own anatomy draws them. */
|
|
30
|
+
export declare const ALL_FACETS: FilterFacet[];
|
|
31
|
+
/** A facet the store answers as a tree: children sit one indent in under their parent. */
|
|
32
|
+
export declare const CATEGORY_TREE_FACET: FilterFacet;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which ink a check mark takes inside a colour swatch.
|
|
3
|
+
*
|
|
4
|
+
* A swatch's colour is **product data**, not a token — the one place in this package where a
|
|
5
|
+
* colour arrives from outside — so nothing can decide the check mark's colour ahead of time. The
|
|
6
|
+
* design spec's "Filter panel" → Variants gives the rule: work out the swatch colour's relative
|
|
7
|
+
* luminance (sRGB channels linearised, `0.2126 R + 0.7152 G + 0.0722 B`); above `0.35` the check
|
|
8
|
+
* is `text`, otherwise `focus-inner` (the ring's white infill, which is the package's "ink on a
|
|
9
|
+
* dark fill" role). Gradients and patterns count as dark.
|
|
10
|
+
*
|
|
11
|
+
* Pure and framework-free on purpose: this is the one rule in the panel that has a right answer
|
|
12
|
+
* independent of any DOM, and a unit test over the spec's own Northwind palette is a sharper
|
|
13
|
+
* check than any rendering of it. It is exported from the package root for a consumer drawing a
|
|
14
|
+
* swatch of its own.
|
|
15
|
+
*/
|
|
16
|
+
/** The two inks a check mark can take. Token role names, not colours. */
|
|
17
|
+
export type SwatchInk = 'text' | 'focus-inner';
|
|
18
|
+
/**
|
|
19
|
+
* The spec's own threshold. Above it the swatch is light enough for the dark `text` check; at it
|
|
20
|
+
* or below, the white `focus-inner` one.
|
|
21
|
+
*
|
|
22
|
+
* It sits well above the 0.179 midpoint WCAG's own contrast maths would suggest, which is
|
|
23
|
+
* deliberate: a check mark is a 3px stroke, not a block of text, and the spec places the boundary
|
|
24
|
+
* so that only the genuinely pale swatches (Natural, White) take the dark check.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SWATCH_INK_LUMINANCE_THRESHOLD = 0.35;
|
|
27
|
+
/**
|
|
28
|
+
* The relative luminance of one flat CSS colour, `0` (black) to `1` (white), or `null` when the
|
|
29
|
+
* value is not a flat colour this module can read without a browser.
|
|
30
|
+
*
|
|
31
|
+
* `null` is the honest answer for a gradient, a pattern, a named colour (`rebeccapurple`) or a
|
|
32
|
+
* `color-mix()`: resolving any of those needs the engine's own colour parser, which a pure module
|
|
33
|
+
* does not have. `swatchInk` turns every `null` into the dark swatch's white check, which is the
|
|
34
|
+
* spec's own rule for gradients and the safe side of the two: a white check on a dark swatch that
|
|
35
|
+
* turned out to be pale is still visible against its 1px `text` edge, while a dark check on a
|
|
36
|
+
* swatch that turned out to be black is not visible at all.
|
|
37
|
+
*
|
|
38
|
+
* Hex, `rgb()`/`rgba()` and `hsl()`/`hsla()` cover what product data carries — the spec's own
|
|
39
|
+
* facet shape says "a colour (hex) or a gradient".
|
|
40
|
+
*/
|
|
41
|
+
export declare function swatchLuminance(swatch: string | null | undefined): number | null;
|
|
42
|
+
/**
|
|
43
|
+
* The ink a check mark takes inside a swatch of this colour.
|
|
44
|
+
*
|
|
45
|
+
* `text` only for a swatch whose relative luminance is **above** `SWATCH_INK_LUMINANCE_THRESHOLD`;
|
|
46
|
+
* `focus-inner` for everything else, gradients, patterns and anything unreadable included. On the
|
|
47
|
+
* spec's Northwind palette that is `text` for Natural (`#dccfb8`) and White (`#f7f5f0`), and
|
|
48
|
+
* `focus-inner` for Black, Brown, Charcoal, Clay, Moss, Navy and the Multi gradient.
|
|
49
|
+
*/
|
|
50
|
+
export declare function swatchInk(swatch: string | null | undefined): SwatchInk;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { UiMessages } from '../../messages/en-US.js';
|
|
2
|
+
/**
|
|
3
|
+
* The five facet kinds of the design spec's "Filter panel" → Variants table. They are not five
|
|
4
|
+
* different data shapes but five ways of drawing the same values: `list` is checkbox rows,
|
|
5
|
+
* `colour` swatches (rows or tiles), `size` equal tiles grouped by size system, `toggle` a switch
|
|
6
|
+
* per yes/no facet, and `range` the only one that is a span rather than a set.
|
|
7
|
+
*/
|
|
8
|
+
export type FilterFacetType = 'list' | 'colour' | 'size' | 'range' | 'toggle';
|
|
9
|
+
/** Colour facets only (spec → Facet shape, `layout`): swatch rows or swatch tiles. */
|
|
10
|
+
export type FilterFacetLayout = 'list' | 'grid';
|
|
11
|
+
/** One value of a facet (spec → Facet shape, `values[]`). */
|
|
12
|
+
export interface FilterFacetValue {
|
|
13
|
+
/** The value as it appears in the selection, and in the URL the owning block writes. */
|
|
14
|
+
value: string;
|
|
15
|
+
/** The visible label ("Brown", "M", "Sweaters"). */
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* How many products this value would leave. Computed **without this facet's own filter
|
|
19
|
+
* applied**, so a `0` means another facet rules the value out — which is why a 0 is shown
|
|
20
|
+
* disabled rather than hidden (spec → Do / Don't).
|
|
21
|
+
*/
|
|
22
|
+
count: number;
|
|
23
|
+
/**
|
|
24
|
+
* The real product colour, for a `colour` facet: any CSS colour, or a gradient for "Multi" and
|
|
25
|
+
* patterned items. It comes from product data and is drawn as an inline style, never a token —
|
|
26
|
+
* see `swatchInk.ts` for how the check mark picks its ink against it.
|
|
27
|
+
*/
|
|
28
|
+
swatch?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The size system this value belongs to, for a `size` facet ("Knitwear", "Socks (EU)"). Sizes
|
|
31
|
+
* are grouped under one sub-heading per system and never mixed in one grid (spec → Do / Don't).
|
|
32
|
+
* Values with no `group` are drawn as one unlabelled grid.
|
|
33
|
+
*/
|
|
34
|
+
group?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Nothing is left for this value: it stays in place, not operable, struck through. A value the
|
|
37
|
+
* shopper has selected is never disabled, whatever this says — the panel enforces that itself.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The `value` of the row this one sits under, for a facet the store answers as a tree (a
|
|
42
|
+
* category list). Drawn one indent in, inside a `role="group"` named after the parent — a real
|
|
43
|
+
* grouping for a screen reader and **no extra tab stop**, so `Tab`, `Esc` and **Show all N**
|
|
44
|
+
* behave exactly as they do in a flat facet.
|
|
45
|
+
*/
|
|
46
|
+
parent?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Ticked because its `parent` is, not because it is a filter of its own: the request carries the
|
|
49
|
+
* parent's value and the platform expands it. Said out loud in the row's accessible name,
|
|
50
|
+
* because a ticked, disabled box with no explanation reads as a dead end.
|
|
51
|
+
*/
|
|
52
|
+
implied?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** One facet group, in the order the panel draws them (spec → Properties, `facets`). */
|
|
55
|
+
export interface FilterFacet {
|
|
56
|
+
/** Stable key. It is also the key this facet's selection is held under (`colour`, `price`). */
|
|
57
|
+
id: string;
|
|
58
|
+
/** The group name ("Colour"). Also the hidden `<legend>` of its `<fieldset>`. */
|
|
59
|
+
label: string;
|
|
60
|
+
/** Which of the five shapes to draw. */
|
|
61
|
+
type: FilterFacetType;
|
|
62
|
+
/** Start closed. A facet with a selected value always starts open, whatever this says. */
|
|
63
|
+
collapsed?: boolean;
|
|
64
|
+
/** Colour facets only: swatch rows (`list`, the default) or swatch tiles (`grid`). */
|
|
65
|
+
layout?: FilterFacetLayout;
|
|
66
|
+
/** The values, in the order they are drawn. Ignored by a `range` facet. */
|
|
67
|
+
values?: FilterFacetValue[];
|
|
68
|
+
/** Range facets: the lowest value either thumb can reach. */
|
|
69
|
+
min?: number;
|
|
70
|
+
/** Range facets: the highest. */
|
|
71
|
+
max?: number;
|
|
72
|
+
/** Range facets: the granularity every move lands on. */
|
|
73
|
+
step?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Range facets: product counts per equal bucket over `[min, max]`, drawn as the decorative
|
|
76
|
+
* histogram above the track (the spec's own distribution is 24 buckets). Leave it out to draw
|
|
77
|
+
* no histogram at all — the panel never invents one from the page it can see, because one page
|
|
78
|
+
* is not the range.
|
|
79
|
+
*/
|
|
80
|
+
histogram?: number[];
|
|
81
|
+
/** Size facets: the destination of the **Size guide** link under the tiles. */
|
|
82
|
+
sizeGuideHref?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Range facets: whether this range is money, so the Min and Max fields are the store's own
|
|
85
|
+
* currency fields rather than generic number fields. A `price` facet sets it.
|
|
86
|
+
*/
|
|
87
|
+
currency?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Range facets: draw the two-thumb track (and the histogram, when one arrives), or omit it and
|
|
90
|
+
* show the labelled Min and Max fields alone. Default `true`. `false` is for a catalogue whose
|
|
91
|
+
* prices sit in a few tight clusters a track cannot separate — the fields keep the same
|
|
92
|
+
* clamping, snapping and commit rules either way, because they are the one `RangeSlider` under
|
|
93
|
+
* both shapes (`RangeSlider`'s own `trackVisible` prop).
|
|
94
|
+
*/
|
|
95
|
+
slider?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* One facet's selection: an array of values for `list`, `colour`, `size` and `toggle` facets, and
|
|
99
|
+
* the two ends of the span for a `range`.
|
|
100
|
+
*
|
|
101
|
+
* The two are told apart at runtime by the first element's type, which is why a range is a pair of
|
|
102
|
+
* **numbers** and a value list is a list of **strings** — see `isRangeSelection`.
|
|
103
|
+
*/
|
|
104
|
+
export type FilterFacetSelection = string[] | [number, number];
|
|
105
|
+
/** The whole selection, keyed by facet id (spec → Properties, `value`). */
|
|
106
|
+
export type FilterSelection = Record<string, FilterFacetSelection>;
|
|
107
|
+
/**
|
|
108
|
+
* Where the panel is drawn (spec → Variants): `sidebar` applies every change at once, `drawer`
|
|
109
|
+
* batches them until **Show N products**.
|
|
110
|
+
*/
|
|
111
|
+
export type FilterPanelMode = 'sidebar' | 'drawer';
|
|
112
|
+
/** What `remove` reports: the chip the shopper took off. */
|
|
113
|
+
export interface FilterRemoval {
|
|
114
|
+
facetId: string;
|
|
115
|
+
value: string;
|
|
116
|
+
}
|
|
117
|
+
/** One applied-filter chip (spec → Anatomy item 2). */
|
|
118
|
+
export interface AppliedFilter {
|
|
119
|
+
facetId: string;
|
|
120
|
+
/** The facet's own label, for the remove button's name ("Remove filter Colour: Brown"). */
|
|
121
|
+
facetLabel: string;
|
|
122
|
+
value: string;
|
|
123
|
+
/** The value's own label, which is the chip's visible text. */
|
|
124
|
+
label: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The parts a consumer can restyle through `classes`, named as the design spec's "Filter panel"
|
|
128
|
+
* anatomy names them. One flat union across the panel, its groups and all five facets: `FilterGroup`
|
|
129
|
+
* and the facet components are private, so `FilterPanel` is the only place a `classes` prop can be
|
|
130
|
+
* passed, and it hands the whole bag down.
|
|
131
|
+
*
|
|
132
|
+
* Several parts are drawn more than once (`group`, `row`, `swatch`, `tile`, `chip`, …) — one class
|
|
133
|
+
* string styles every instance, and each element carries a `data-facet` or `data-value` attribute
|
|
134
|
+
* for the rare rule that has to tell them apart.
|
|
135
|
+
*
|
|
136
|
+
* Two parts are composed children rather than elements of the panel's own, so they are *styled*
|
|
137
|
+
* through these keys but **addressed** by the child's own `data-part`, which is the convention the
|
|
138
|
+
* rest of the package follows (`CheckboxGroup` does the same with its options): a `list` facet's
|
|
139
|
+
* `row` is a `Checkbox`, so it is `[data-part="values"] [data-part="root"]` in the DOM, and `chip`
|
|
140
|
+
* marks the `<li>` around each `Chip` rather than the chip itself. A `colour` facet's rows and a
|
|
141
|
+
* `size` facet's tiles are drawn by this package and do carry `data-part="row"`/`"tile"`.
|
|
142
|
+
*/
|
|
143
|
+
export type FilterPanelPart = 'root' | 'head' | 'title' | 'clear' | 'applied' | 'chip' | 'group' | 'trigger' | 'groupLabel' | 'badge' | 'summary' | 'chevron' | 'body' | 'legend' | 'search' | 'noMatches' | 'values' | 'row' | 'rowLabel' | 'count' | 'checkbox' | 'showAll' | 'swatch' | 'swatchMark' | 'swatchStrike' | 'subheading' | 'tile' | 'tileLabel' | 'sizeGuide' | 'range' | 'histogram' | 'histogramBar' | 'fields' | 'field' | 'fieldLabel' | 'separator' | 'switchRow' | 'foot';
|
|
144
|
+
export interface FilterPanelProps {
|
|
145
|
+
/**
|
|
146
|
+
* The selection (two-way), keyed by facet id. Unset, the panel manages its own — which is what
|
|
147
|
+
* makes it usable in a story or a prototype, while a store binds `v-model` and keeps the URL.
|
|
148
|
+
*/
|
|
149
|
+
modelValue?: FilterSelection;
|
|
150
|
+
/** The facet groups, in the order they are drawn. */
|
|
151
|
+
facets?: FilterFacet[];
|
|
152
|
+
/** `sidebar` applies every change at once; `drawer` batches until **Show N products**. */
|
|
153
|
+
mode?: FilterPanelMode;
|
|
154
|
+
/** The head's visible title. Defaults to the `filterPanelTitle` message ("Filters"). */
|
|
155
|
+
title?: string;
|
|
156
|
+
/** Draw the head (title + **Clear all**). Set it to `false` inside the drawer. */
|
|
157
|
+
showHead?: boolean;
|
|
158
|
+
/** Draw the applied-filter chips above the groups. */
|
|
159
|
+
showApplied?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* The accessible name of the `<form>`. Defaults to the `filterPanelLabel` message ("Product
|
|
162
|
+
* filters"). Named `label` rather than `ariaLabel` because the head's `title` is the visible
|
|
163
|
+
* text and this is the name of the form around it — see `FilterPanel.vue`'s own comment.
|
|
164
|
+
*/
|
|
165
|
+
label?: string;
|
|
166
|
+
/** The locale numbers and currencies are formatted in. Defaults to the ambient locale. */
|
|
167
|
+
locale?: string;
|
|
168
|
+
/** The currency a money range is formatted in. Defaults to the ambient store currency. */
|
|
169
|
+
currency?: string;
|
|
170
|
+
/**
|
|
171
|
+
* The live product count for the current (pending) selection. Drawer mode puts it in **Show N
|
|
172
|
+
* products**; the panel never announces it itself — the owning block's own count does that.
|
|
173
|
+
*/
|
|
174
|
+
resultCount?: number | null;
|
|
175
|
+
/** The tighter targets of a 15rem sidebar. */
|
|
176
|
+
dense?: boolean;
|
|
177
|
+
/** Namespaces every id this panel mints, so a sidebar and a drawer never collide. */
|
|
178
|
+
idPrefix?: string;
|
|
179
|
+
/** Per-part class overrides, merged with `tailwind-merge`. */
|
|
180
|
+
classes?: Partial<Record<FilterPanelPart, string>>;
|
|
181
|
+
/** Overrides for the strings this component renders itself. */
|
|
182
|
+
messages?: Partial<UiMessages>;
|
|
183
|
+
}
|