@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
@@ -8,6 +8,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
8
  declare const __VLS_base: import('vue').DefineComponent<TabProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TabProps> & Readonly<{}>, {
9
9
  title: string;
10
10
  classes: Partial<Record<import('./types.js').TabPart, string>>;
11
+ disabled: boolean;
11
12
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
14
  declare const _default: typeof __VLS_export;
@@ -6,6 +6,9 @@ export interface TabsEntry {
6
6
  value: string;
7
7
  /** Moves real DOM focus to this tab's `<button>`. */
8
8
  focus: () => void;
9
+ /** Whether the tab is disabled now: skipped by the arrow keys and never the default selection.
10
+ * Optional, so an entry registered without it reads as enabled. */
11
+ disabled?: () => boolean;
9
12
  }
10
13
  /**
11
14
  * What `Tabs` provides, and every `Tab`/`TabPanel` injects.
@@ -35,9 +38,10 @@ export interface TabsContext {
35
38
  /** Adds a `Tab` to the registration order. Returns the function that removes it again. */
36
39
  register: (entry: TabsEntry) => () => void;
37
40
  /** `ArrowRight` (`delta` 1) / `ArrowLeft` (`delta` -1) from `current`: moves focus to the next
38
- * tab, wrapping at the ends, and — under automatic activation — selects it too. */
41
+ * tab that is not disabled, wrapping at the ends, and — under automatic activation — selects it too. */
39
42
  moveFocus: (current: string, delta: 1 | -1) => void;
40
- /** `Home` (`'first'`) / `End` (`'last'`): same as `moveFocus`, but to an end of the list. */
43
+ /** `Home` (`'first'`) / `End` (`'last'`): same as `moveFocus`, but to the first / last tab that
44
+ * is not disabled. */
41
45
  focusEdge: (edge: 'first' | 'last') => void;
42
46
  /** The `id` a `Tab` with this value renders, and what its `TabPanel`'s `aria-labelledby` reads. */
43
47
  tabId: (value: string) => string;
@@ -19,6 +19,8 @@ export interface TabsItem {
19
19
  title: string;
20
20
  /** The panel's plain-text content. Use the slots API instead for richer panel content. */
21
21
  content?: string;
22
+ /** Not selectable, skipped by the arrow keys and `Home`/`End`. See `TabProps.disabled`. */
23
+ disabled?: boolean;
22
24
  }
23
25
  export interface TabsProps {
24
26
  /** The selected tab's value (two-way). Defaults to the first tab — the first `Tab` to register,
@@ -50,6 +52,13 @@ export interface TabProps {
50
52
  /** The visible label. Also the default slot's fallback, the same shape `Button`'s `label` and
51
53
  * default slot follow. */
52
54
  title?: string;
55
+ /**
56
+ * The tab cannot be selected: a click does nothing, the arrow keys and `Home`/`End` skip it, and
57
+ * it carries `aria-disabled="true"` rather than native `disabled`, so a disabled tab that is
58
+ * already selected stays the list's one tab stop. The default selection is the first tab that is
59
+ * not disabled. Defaults to `false`.
60
+ */
61
+ disabled?: boolean;
53
62
  /** Per-part class overrides, merged with `tailwind-merge`. */
54
63
  classes?: Partial<Record<TabPart, string>>;
55
64
  }
@@ -1,9 +1,22 @@
1
1
  import { TextareaProps } from './types.js';
2
- declare const __VLS_export: import('vue').DefineComponent<TextareaProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ prefix?: (props: {}) => any;
5
+ } & {
6
+ suffix?: (props: {}) => any;
7
+ };
8
+ };
9
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
10
+ declare const __VLS_base: import('vue').DefineComponent<TextareaProps, {
11
+ control: import('vue').Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
12
+ focus: () => void | undefined;
13
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ clear: () => any;
3
15
  input: (value: string) => any;
4
16
  "update:modelValue": (value: string) => any;
5
17
  change: (value: string) => any;
6
18
  }, string, import('vue').PublicProps, Readonly<TextareaProps> & Readonly<{
19
+ onClear?: (() => any) | undefined;
7
20
  onInput?: ((value: string) => any) | undefined;
8
21
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
9
22
  onChange?: ((value: string) => any) | undefined;
@@ -18,10 +31,17 @@ declare const __VLS_export: import('vue').DefineComponent<TextareaProps, {}, {},
18
31
  disabled: boolean;
19
32
  invalid: boolean;
20
33
  describedBy: string;
34
+ clearable: boolean;
21
35
  readonly: boolean;
22
36
  maxLength: number;
23
37
  hardLimit: boolean;
24
38
  minHeight: string;
25
39
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
40
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
41
  declare const _default: typeof __VLS_export;
27
42
  export default _default;
43
+ type __VLS_WithSlots<T, S> = T & {
44
+ new (): {
45
+ $slots: S;
46
+ };
47
+ };
@@ -1,5 +1,5 @@
1
1
  /** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
2
- export type TextareaPart = 'root' | 'control' | 'foot' | 'counter';
2
+ export type TextareaPart = 'root' | 'prefix' | 'control' | 'clearButton' | 'suffix' | 'foot' | 'counter';
3
3
  export interface TextareaProps {
4
4
  /** The text (two-way). */
5
5
  modelValue?: string;
@@ -11,9 +11,18 @@ export interface TextareaProps {
11
11
  counter?: boolean;
12
12
  /** Also sets the native `maxlength`, so typing stops at the limit. */
13
13
  hardLimit?: boolean;
14
+ /**
15
+ * Shows `Input`'s clear button at the end of the first line while there is a value and the field
16
+ * can be edited. Clicking it empties the field, emits `clear` and returns focus. Defaults to
17
+ * `false`.
18
+ */
19
+ clearable?: boolean;
14
20
  /** Size to the expected answer, in rem. Defaults to `5rem` (about 3 lines). */
15
21
  minHeight?: string;
16
- /** Sets `aria-invalid="true"`. Comes from the `FieldWrapper` otherwise. */
22
+ /**
23
+ * Sets `aria-invalid="true"`. Comes from the `FieldWrapper` otherwise. While it is not invalid,
24
+ * an `aria-invalid` attribute the caller passes is kept.
25
+ */
17
26
  invalid?: boolean;
18
27
  /** Native `required`. Comes from the `FieldWrapper` otherwise. */
19
28
  required?: boolean;
@@ -27,6 +27,7 @@ declare const __VLS_export: import('vue').DefineComponent<ToastProps, {}, {}, {}
27
27
  noResults: string;
28
28
  noResultsFor: (query: string) => string;
29
29
  noMatchesFor: (query: string) => string;
30
+ createOption: (query: string) => string;
30
31
  moreSelected: (n: number) => string;
31
32
  removeTag: (label: string) => string;
32
33
  selected: string;
@@ -159,6 +160,7 @@ declare const __VLS_export: import('vue').DefineComponent<ToastProps, {}, {}, {}
159
160
  formPendingMessage: string;
160
161
  }>;
161
162
  action: import('./types.js').ToastAction;
163
+ closable: boolean;
162
164
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
163
165
  declare const _default: typeof __VLS_export;
164
166
  export default _default;
@@ -1,4 +1,4 @@
1
- import { ToasterProps } from './types.js';
1
+ import { ToasterPosition, ToasterProps, ToasterToast } from './types.js';
2
2
  declare const __VLS_export: import('vue').DefineComponent<ToasterProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
3
  action: (id: string) => any;
4
4
  dismiss: (id: string, reason: "button" | "escape" | "timeout") => any;
@@ -6,6 +6,7 @@ declare const __VLS_export: import('vue').DefineComponent<ToasterProps, {}, {},
6
6
  onAction?: ((id: string) => any) | undefined;
7
7
  onDismiss?: ((id: string, reason: "button" | "escape" | "timeout") => any) | undefined;
8
8
  }>, {
9
+ position: ToasterPosition;
9
10
  classes: Partial<Record<import('./types.js').ToasterPart, string>>;
10
11
  messages: Partial<{
11
12
  clear: string;
@@ -25,6 +26,7 @@ declare const __VLS_export: import('vue').DefineComponent<ToasterProps, {}, {},
25
26
  noResults: string;
26
27
  noResultsFor: (query: string) => string;
27
28
  noMatchesFor: (query: string) => string;
29
+ createOption: (query: string) => string;
28
30
  moreSelected: (n: number) => string;
29
31
  removeTag: (label: string) => string;
30
32
  selected: string;
@@ -156,6 +158,10 @@ declare const __VLS_export: import('vue').DefineComponent<ToasterProps, {}, {},
156
158
  formPendingTitle: string;
157
159
  formPendingMessage: string;
158
160
  }>;
161
+ teleportTo: string | HTMLElement;
162
+ toasts: ToasterToast[];
163
+ maxVisible: number;
164
+ newestOnTop: boolean;
159
165
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
160
166
  declare const _default: typeof __VLS_export;
161
167
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import { UiMessages } from '../../composables/useMessages.js';
2
2
  /** Spec "Toast" -> Variants: icon, colour and timing all key off this. */
3
- export type ToastVariant = 'success' | 'warning' | 'danger';
3
+ /** `info` is neutral news: the text colour, polite, timed like `success`. */
4
+ export type ToastVariant = 'success' | 'info' | 'warning' | 'danger';
4
5
  /**
5
6
  * One action a toast offers (spec "Toast" -> Properties, `action` row): "One action: a link
6
7
  * ('View cart (3)') or a button ('Try again')." A discriminated union rather than one interface
@@ -18,7 +19,7 @@ export type ToastAction = {
18
19
  export type ToastPart = 'root' | 'icon' | 'title' | 'text' | 'action' | 'close';
19
20
  export interface ToastProps {
20
21
  /** Icon, colour and auto-dismiss timing (see `useToast`'s `DEFAULT_DURATION`). Default
21
- * `"success"`. */
22
+ * `"success"`. Also on the root as `data-variant`, for a consumer's per-variant selector. */
22
23
  variant?: ToastVariant;
23
24
  /** The message. The meaning is always in this text — colour and icon are extras (1.4.1). */
24
25
  title: string;
@@ -26,6 +27,11 @@ export interface ToastProps {
26
27
  text?: string;
27
28
  /** One action: a link or a link-style button. */
28
29
  action?: ToastAction;
30
+ /**
31
+ * Shows the close button and closes on `Escape`. Default `true`. `false` is for a toast that must
32
+ * stay until its own timer or the app removes it.
33
+ */
34
+ closable?: boolean;
29
35
  /** Message overrides (only `dismissNotification` applies here). See `useMessages`. */
30
36
  messages?: Partial<UiMessages>;
31
37
  /** Per-part class overrides, merged with `tailwind-merge`. */
@@ -35,7 +41,42 @@ export interface ToastProps {
35
41
  * and the polite status list inside it — see `Toaster.vue`'s own doc comment for why a danger
36
42
  * toast is not inside `list`). */
37
43
  export type ToasterPart = 'root' | 'list';
44
+ /** Where the stack sits in the viewport. */
45
+ export type ToasterPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
46
+ /**
47
+ * One toast in an externally owned list (`Toaster`'s `toasts`). `useToast`'s `ToastItem` is one;
48
+ * `variant` defaults to `"success"`, and with no `duration` (or `0`) the toast keeps no timer of
49
+ * the `Toaster`'s own, so the list's owner decides when it leaves.
50
+ */
51
+ export interface ToasterToast {
52
+ id: string;
53
+ title: string;
54
+ variant?: ToastVariant;
55
+ text?: string;
56
+ action?: ToastAction;
57
+ closable?: boolean;
58
+ /** Auto-dismiss time in ms, after which `dismiss(id, "timeout")` fires. Ignored for `danger`. */
59
+ duration?: number;
60
+ }
38
61
  export interface ToasterProps {
62
+ /**
63
+ * An externally owned queue to render instead of `useToast`'s. Given, the `Toaster` never touches
64
+ * the `useToast` store: closing a toast (or its timer running out) only emits `dismiss`, and the
65
+ * owner removes it from the list. Default: the `useToast` queue.
66
+ */
67
+ toasts?: ToasterToast[];
68
+ /** Where the stack sits. Default `"bottom-right"`. */
69
+ position?: ToasterPosition;
70
+ /** Renders at most this many toasts, the newest kept. Default: every toast in the queue
71
+ * (`useToast` itself keeps three). */
72
+ maxVisible?: number;
73
+ /** Draws the newest toast first, at the top of the stack. Default `false`: newest at the bottom. */
74
+ newestOnTop?: boolean;
75
+ /**
76
+ * Where the region is teleported while no modal dialog is open. Default `"body"`. An open
77
+ * `Dialog` still wins, since a toast outside a modal dialog cannot be reached.
78
+ */
79
+ teleportTo?: string | HTMLElement;
39
80
  /** Message overrides, passed through to every `Toast` this renders and to the region's own
40
81
  * `aria-label`. See `useMessages`. */
41
82
  messages?: Partial<UiMessages>;