@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.
Files changed (85) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +259 -87
  3. package/dist/{VariantPicker-CjWUVhlm.js → VariantPicker-Da41_oGA.js} +2244 -1399
  4. package/dist/componentNames.d.ts +1 -1
  5. package/dist/components/button/Button.vue.d.ts +3 -0
  6. package/dist/components/button/types.d.ts +32 -3
  7. package/dist/components/card/ContentCard.vue.d.ts +1 -1
  8. package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
  9. package/dist/components/checkbox/types.d.ts +12 -1
  10. package/dist/components/chip/Chip.vue.d.ts +4 -3
  11. package/dist/components/dialog/Dialog.vue.d.ts +12 -7
  12. package/dist/components/dialog/types.d.ts +11 -2
  13. package/dist/components/drawer/Drawer.vue.d.ts +1 -0
  14. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +3 -0
  15. package/dist/components/field-wrapper/RequiredMark.vue.d.ts +15 -0
  16. package/dist/components/field-wrapper/context.d.ts +8 -0
  17. package/dist/components/field-wrapper/types.d.ts +12 -4
  18. package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
  19. package/dist/components/filter-panel/FilterPanel.vue.d.ts +3 -2
  20. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
  21. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
  22. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -1
  23. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
  24. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
  25. package/dist/components/input/Input.vue.d.ts +7 -2
  26. package/dist/components/input/classes.d.ts +9 -0
  27. package/dist/components/input/reassertValue.d.ts +13 -0
  28. package/dist/components/input/types.d.ts +14 -5
  29. package/dist/components/input/useAdornmentRoom.d.ts +15 -0
  30. package/dist/components/lightbox/Lightbox.vue.d.ts +1 -0
  31. package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -0
  32. package/dist/components/pagination/Pagination.vue.d.ts +154 -0
  33. package/dist/components/pagination/types.d.ts +31 -0
  34. package/dist/components/popover/Popover.vue.d.ts +28 -1
  35. package/dist/components/popover/types.d.ts +57 -3
  36. package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
  37. package/dist/components/radio/Radio.vue.d.ts +33 -0
  38. package/dist/components/radio/RadioGroup.vue.d.ts +4 -0
  39. package/dist/components/radio/recipes.d.ts +37 -0
  40. package/dist/components/radio/types.d.ts +64 -3
  41. package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -0
  42. package/dist/components/search-bar/SearchBar.vue.d.ts +1 -0
  43. package/dist/components/search-modal/SearchModal.vue.d.ts +1 -0
  44. package/dist/components/select/MultiSelect.vue.d.ts +48 -1
  45. package/dist/components/select/Select.vue.d.ts +20 -0
  46. package/dist/components/select/SelectPanel.vue.d.ts +23 -0
  47. package/dist/components/select/SelectTags.vue.d.ts +50 -0
  48. package/dist/components/select/openRegistry.d.ts +14 -4
  49. package/dist/components/select/panelParts.d.ts +28 -2
  50. package/dist/components/select/types.d.ts +45 -7
  51. package/dist/components/select/useOptionList.d.ts +31 -4
  52. package/dist/components/select/usePopover.d.ts +36 -39
  53. package/dist/components/select/useSummaryFit.d.ts +21 -0
  54. package/dist/components/select/useTagRows.d.ts +17 -0
  55. package/dist/components/site-form/SiteForm.vue.d.ts +2 -1
  56. package/dist/components/switch/Switch.vue.d.ts +15 -8
  57. package/dist/components/switch/types.d.ts +25 -1
  58. package/dist/components/tabs/Tab.vue.d.ts +1 -0
  59. package/dist/components/tabs/context.d.ts +6 -2
  60. package/dist/components/tabs/types.d.ts +9 -0
  61. package/dist/components/textarea/Textarea.vue.d.ts +21 -1
  62. package/dist/components/textarea/types.d.ts +11 -2
  63. package/dist/components/toast/Toast.vue.d.ts +2 -0
  64. package/dist/components/toast/Toaster.vue.d.ts +7 -1
  65. package/dist/components/toast/types.d.ts +43 -2
  66. package/dist/components.css +312 -13
  67. package/dist/composables/useDialog.d.ts +7 -3
  68. package/dist/composables/useEldraScope.d.ts +26 -0
  69. package/dist/composables/useFloating.d.ts +21 -8
  70. package/dist/composables/useOverlay.d.ts +10 -5
  71. package/dist/composables/useToast.d.ts +3 -0
  72. package/dist/index.d.ts +7 -4
  73. package/dist/index.js +1296 -405
  74. package/dist/messages/en-US.d.ts +2 -0
  75. package/dist/messages/is-IS.js +1 -0
  76. package/dist/resolver.js +1 -0
  77. package/dist/scoped.css +4623 -0
  78. package/dist/style.css +312 -13
  79. package/dist/tailwind.css +43 -12
  80. package/dist/useMessages-B5nzZghs.js +592 -0
  81. package/dist/vee-validate.js +42 -6
  82. package/dist/vue-i18n/index.d.ts +50 -0
  83. package/dist/vue-i18n/shapes.d.ts +40 -0
  84. package/dist/vue-i18n.js +289 -0
  85. package/package.json +16 -3
@@ -1,4 +1,5 @@
1
- import { ComputedRef, Ref } from 'vue';
1
+ import { ReferenceElement } from '@floating-ui/vue';
2
+ import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
2
3
  /**
3
4
  * Where the panel goes.
4
5
  *
@@ -7,14 +8,22 @@ import { ComputedRef, Ref } from 'vue';
7
8
  * `above` always opens above — the footer's selectors, where below is off-screen by definition. The
8
9
  * remaining values are `@floating-ui/dom` placements for anything that wants to be explicit —
9
10
  * `top-end`/`bottom-end` are `Tooltip`'s own `align="end"`, added alongside the `-start` pair
10
- * already here for `align="start"`.
11
+ * already here for `align="start"`. The `left`/`right` family is for a panel that opens beside its
12
+ * reference (a submenu, a toolbar flyout); like every explicit placement it flips to the other side.
11
13
  */
12
- export type FloatingPlacement = 'auto' | 'above' | 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end';
14
+ export type FloatingPlacement = 'auto' | 'above' | 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
13
15
  export interface UseFloatingOptions {
14
- /** Default `'auto'` — below, flipping above when it does not fit. */
15
- placement?: FloatingPlacement;
16
- /** Gap between the reference and the panel, in pixels. Default `4` (the spec's 0.25rem). */
17
- offset?: number;
16
+ /**
17
+ * Default `'auto'` — below, flipping above when it does not fit. A ref or getter is followed: the
18
+ * panel repositions when it changes.
19
+ */
20
+ placement?: MaybeRefOrGetter<FloatingPlacement>;
21
+ /** Gap between the reference and the panel, in pixels. Default `4` (the spec's 0.25rem). Followed
22
+ * when a ref or getter. */
23
+ offset?: MaybeRefOrGetter<number | undefined>;
24
+ /** The least room `shift` keeps between the panel and the viewport edge, in pixels. Default `8`.
25
+ * Followed when a ref or getter. */
26
+ padding?: MaybeRefOrGetter<number | undefined>;
18
27
  /**
19
28
  * Tie the panel's width to the reference's.
20
29
  *
@@ -78,5 +87,9 @@ export interface UseFloatingReturn {
78
87
  * const panel = ref<HTMLElement | null>(null);
79
88
  * const { styles, placement } = useFloating(trigger, panel, { matchWidth: true });
80
89
  * ```
90
+ *
91
+ * The reference may be a Floating UI **virtual element** (`{ getBoundingClientRect() }`), for a
92
+ * panel anchored to a caret or a pointer position rather than to a node; call `update()` after it
93
+ * moves, since nothing observes a virtual element's geometry.
81
94
  */
82
- export declare function useFloating(reference: Ref<HTMLElement | null>, floating: Ref<HTMLElement | null>, options?: UseFloatingOptions): UseFloatingReturn;
95
+ export declare function useFloating(reference: Readonly<Ref<ReferenceElement | null>>, floating: Ref<HTMLElement | null>, options?: UseFloatingOptions): UseFloatingReturn;
@@ -15,12 +15,17 @@ export interface UseOverlayOptions {
15
15
  content: Ref<HTMLElement | null>;
16
16
  /** Asked to close. The consumer writes `open`; nothing here does. */
17
17
  setOpen: (open: boolean) => void;
18
- /** Close when a pointer press, or focus, lands outside the overlay. Default `true`. */
19
- closeOnOutsideClick?: boolean;
20
- /** Close on `Escape`. Default `true`. */
21
- closeOnEscape?: boolean;
18
+ /**
19
+ * Close when a pointer press lands outside the overlay — and, unless `closeOnFocusOutside` says
20
+ * otherwise, when focus does. Default `true`. A getter is asked on every event.
21
+ */
22
+ closeOnOutsideClick?: boolean | (() => boolean);
23
+ /** Close when focus moves outside the overlay. Default: whatever `closeOnOutsideClick` is. */
24
+ closeOnFocusOutside?: boolean | (() => boolean);
25
+ /** Close on `Escape`. Default `true`. A getter is asked on every keystroke. */
26
+ closeOnEscape?: boolean | (() => boolean);
22
27
  /** Put focus back on the trigger when closing would otherwise lose it. Default `true`. */
23
- returnFocus?: boolean;
28
+ returnFocus?: boolean | (() => boolean);
24
29
  }
25
30
  export interface UseOverlayReturn {
26
31
  /** Ask the consumer to close. */
@@ -9,6 +9,8 @@ export interface ToastOptions {
9
9
  text?: string;
10
10
  /** One action: a link (`{ label, href }`) or a button (`{ label, onActivate }`). */
11
11
  action?: ToastAction;
12
+ /** Shows the close button and closes on `Escape`. Default `true`. */
13
+ closable?: boolean;
12
14
  /** Auto-dismiss time in ms; `0` stays until closed. Ignored for `variant: "danger"` — it is
13
15
  * always `0` (spec "Toast" -> Properties, `duration` row: "Danger is always `0`."). Defaults to
14
16
  * the variant's own timing (see `DEFAULT_DURATION` below) when omitted. */
@@ -26,6 +28,7 @@ export interface ToastItem {
26
28
  title: string;
27
29
  text?: string;
28
30
  action?: ToastAction;
31
+ closable?: boolean;
29
32
  duration: number;
30
33
  }
31
34
  export interface UseToastReturn {
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export { default as Popover } from './components/popover/Popover.vue.js';
36
36
  export { default as Price } from './components/price/Price.vue.js';
37
37
  export { default as ProductCard } from './components/product-card/ProductCard.vue.js';
38
38
  export { default as QuantityStepper } from './components/quantity-stepper/QuantityStepper.vue.js';
39
+ export { default as Radio } from './components/radio/Radio.vue.js';
39
40
  export { default as RadioGroup } from './components/radio/RadioGroup.vue.js';
40
41
  export { default as RangeSlider } from './components/range-slider/RangeSlider.vue.js';
41
42
  export { default as Rating } from './components/rating/Rating.vue.js';
@@ -63,7 +64,7 @@ export type { AppliedFilter, FilterFacet, FilterFacetLayout, FilterFacetSelectio
63
64
  export type { AvatarGroupPart, AvatarGroupPerson, AvatarGroupProps, AvatarPart, AvatarProps, AvatarSize, } from './components/avatar/types.js';
64
65
  export type { BadgePart, BadgeProps, BadgeTone, BadgeVariant, StockBadgePart, StockBadgeProps, StockLevel, } from './components/badge/types.js';
65
66
  export type { BreadcrumbItem, BreadcrumbPart, BreadcrumbProps, } from './components/breadcrumb/types.js';
66
- export type { ButtonGroupPart, ButtonGroupProps, ButtonPart, ButtonProps, ButtonSize, ButtonVariant, } from './components/button/types.js';
67
+ export type { ButtonGroupPart, ButtonGroupProps, ButtonPart, ButtonProps, ButtonSize, ButtonSpinnerPlacement, ButtonVariant, } from './components/button/types.js';
67
68
  export type { CarouselControls, CarouselPart, CarouselPerViewBreakpoints, CarouselProps, } from './components/carousel/types.js';
68
69
  export type { CheckboxGroupLayout, CheckboxGroupOption, CheckboxGroupPart, CheckboxGroupProps, CheckboxPart, CheckboxProps, CheckboxSize, } from './components/checkbox/types.js';
69
70
  export type { ChipGroupPart, ChipGroupProps, ChipPart, ChipProps, ChipSize, } from './components/chip/types.js';
@@ -89,7 +90,7 @@ export type { PopoverPart, PopoverProps } from './components/popover/types.js';
89
90
  export type { PricePart, PriceProps, PriceSize } from './components/price/types.js';
90
91
  export type { ProductCardPart, ProductCardProduct, ProductCardProps, ProductCardRatio, } from './components/product-card/types.js';
91
92
  export type { QuantityStepperPart, QuantityStepperProps, QuantityStepperSize, } from './components/quantity-stepper/types.js';
92
- export type { RadioGroupLayout, RadioGroupOption, RadioGroupPart, RadioGroupProps, RadioGroupSize, } from './components/radio/types.js';
93
+ export type { RadioGroupLayout, RadioGroupOption, RadioGroupPart, RadioGroupProps, RadioGroupSize, RadioPart, RadioProps, RadioValue, } from './components/radio/types.js';
93
94
  export type { RangeSliderEnd, RangeSliderInputsSlotProps, RangeSliderPart, RangeSliderProps, RangeSliderThumb, RangeSliderTrackSlotProps, RangeSliderValue, } from './components/range-slider/types.js';
94
95
  export type { RatingPart, RatingProps, RatingSize } from './components/rating/types.js';
95
96
  export type { SearchBarPart, SearchBarProps, SearchBarSize, SearchResultItem, SearchResultType, SearchResults, SearchRow, SearchSection, SearchSelectType, } from './components/search-bar/types.js';
@@ -97,11 +98,11 @@ export type { SearchModalPart, SearchModalProps } from './components/search-moda
97
98
  export type { SectionBackground, SectionPart, SectionProps, SectionSpacing, } from './components/section/types.js';
98
99
  export type { SiteFormClient, SiteFormDefinition, SiteFormFailure, SiteFormFailureReason, SiteFormField, SiteFormLayout, SiteFormPart, SiteFormProps, SiteFormStatus, SiteFormSubmitOutcome, SiteFormSuccess, SiteFormValue, } from './components/site-form/types.js';
99
100
  export type { SkeletonPart, SkeletonProps, SkeletonVariant } from './components/skeleton/types.js';
100
- export type { SwitchPart, SwitchProps, SwitchSize } from './components/switch/types.js';
101
+ export type { SwitchPart, SwitchProps, SwitchSize, SwitchSlotProps, } from './components/switch/types.js';
101
102
  export type { TabPanelPart, TabPanelProps, TabPart, TabProps, TabsActivation, TabsItem, TabsPart, TabsProps, TabsVariant, } from './components/tabs/types.js';
102
103
  export type { TablerIconPart, TablerIconProps } from './components/tabler-icon/types.js';
103
104
  export type { TextareaPart, TextareaProps } from './components/textarea/types.js';
104
- export type { ToastAction, ToastPart, ToastProps, ToastVariant, ToasterPart, ToasterProps, } from './components/toast/types.js';
105
+ export type { ToastAction, ToastPart, ToastProps, ToastVariant, ToasterPart, ToasterPosition, ToasterProps, ToasterToast, } from './components/toast/types.js';
105
106
  export type { TooltipAlign, TooltipPart, TooltipPlacement, TooltipProps, TooltipRole, } from './components/tooltip/types.js';
106
107
  export type { UnitInputPart, UnitInputProps } from './components/unit-input/types.js';
107
108
  export type { VariantPickerOption, VariantPickerPart, VariantPickerProps, VariantPickerType, } from './components/variant-picker/types.js';
@@ -109,6 +110,7 @@ export type { VisuallyHiddenPart, VisuallyHiddenProps } from './components/visua
109
110
  export { defaultMessages, enUS } from './messages/index.js';
110
111
  export { MESSAGES_KEY, provideEldraUiMessages, useMessages, type UiMessages, } from './composables/useMessages.js';
111
112
  export { CURRENCY_KEY, DEFAULT_UI_LOCALE, LOCALE_KEY, provideEldraUiCurrency, provideEldraUiLocale, useEldraUiCurrency, useEldraUiLocale, } from './composables/useLocale.js';
113
+ export { ELDRA_SCOPE_KEY, provideEldraScope } from './composables/useEldraScope.js';
112
114
  export { useControllableModel } from './composables/useControllableModel.js';
113
115
  export { preloadTablerIcons } from './components/tabler-icon/registry.js';
114
116
  export { tablerIconName } from './components/tabler-icon/tablerIconName.js';
@@ -116,6 +118,7 @@ export { closeDialog, currentDialog, isOpenDialog, openDialog, TOAST_HOST_KEY, }
116
118
  export { useDialog, type UseDialogOptions, type UseDialogReturn } from './composables/useDialog.js';
117
119
  export { useToast, type ToastItem, type ToastOptions, type UseToastReturn, } from './composables/useToast.js';
118
120
  export { useFloating, type FloatingPlacement, type UseFloatingOptions, type UseFloatingReturn, } from './composables/useFloating.js';
121
+ export { topLayerDialog } from './composables/teleportTarget.js';
119
122
  export { useHeadingTag, type HeadingLevel } from './composables/useHeadingTag.js';
120
123
  export { useOverlay, type UseOverlayOptions, type UseOverlayReturn, } from './composables/useOverlay.js';
121
124
  export { normalizeText, useListbox, type ListboxOption, type UseListboxOptions, type UseListboxReturn, } from './components/select/useListbox.js';