@eldrajs/ui 0.2.8 → 0.3.0

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 (151) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +324 -161
  3. package/dist/{VariantPicker-CjWUVhlm.js → VariantPicker-C-9sMXGI.js} +3275 -2040
  4. package/dist/componentNames.d.ts +1 -1
  5. package/dist/components/accordion/Accordion.vue.d.ts +1 -2
  6. package/dist/components/accordion/AccordionItem.vue.d.ts +1 -1
  7. package/dist/components/accordion/types.d.ts +6 -7
  8. package/dist/components/avatar/Avatar.vue.d.ts +1 -1
  9. package/dist/components/avatar/types.d.ts +6 -4
  10. package/dist/components/badge/types.d.ts +6 -4
  11. package/dist/components/breadcrumb/types.d.ts +5 -2
  12. package/dist/components/button/Button.vue.d.ts +6 -3
  13. package/dist/components/button/ButtonGroup.vue.d.ts +0 -1
  14. package/dist/components/button/types.d.ts +39 -9
  15. package/dist/components/card/ContentCard.vue.d.ts +2 -2
  16. package/dist/components/card/FeatureCard.vue.d.ts +1 -1
  17. package/dist/components/card/stretchedLink.d.ts +3 -3
  18. package/dist/components/card/types.d.ts +6 -4
  19. package/dist/components/carousel/types.d.ts +7 -3
  20. package/dist/components/checkbox/Checkbox.vue.d.ts +5 -3
  21. package/dist/components/checkbox/CheckboxGroup.vue.d.ts +1 -1
  22. package/dist/components/checkbox/types.d.ts +21 -4
  23. package/dist/components/chip/Chip.vue.d.ts +5 -4
  24. package/dist/components/chip/ChipGroup.vue.d.ts +0 -1
  25. package/dist/components/chip/types.d.ts +5 -6
  26. package/dist/components/container/Container.vue.d.ts +0 -1
  27. package/dist/components/container/types.d.ts +0 -4
  28. package/dist/components/dialog/Dialog.vue.d.ts +13 -8
  29. package/dist/components/dialog/types.d.ts +16 -4
  30. package/dist/components/drawer/Drawer.vue.d.ts +2 -1
  31. package/dist/components/drawer/types.d.ts +5 -2
  32. package/dist/components/empty-state/EmptyState.vue.d.ts +1 -1
  33. package/dist/components/empty-state/types.d.ts +7 -6
  34. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +4 -1
  35. package/dist/components/field-wrapper/RequiredMark.vue.d.ts +15 -0
  36. package/dist/components/field-wrapper/context.d.ts +8 -0
  37. package/dist/components/field-wrapper/types.d.ts +17 -6
  38. package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
  39. package/dist/components/filter-panel/FilterPanel.vue.d.ts +7 -6
  40. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
  41. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
  42. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -1
  43. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
  44. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
  45. package/dist/components/filter-panel/facets/shared.d.ts +4 -4
  46. package/dist/components/filter-panel/types.d.ts +5 -2
  47. package/dist/components/form-layout/FormLayout.vue.d.ts +1 -1
  48. package/dist/components/form-layout/types.d.ts +5 -2
  49. package/dist/components/icon/Icon.vue.d.ts +1 -2
  50. package/dist/components/icon/types.d.ts +0 -4
  51. package/dist/components/image/types.d.ts +3 -2
  52. package/dist/components/input/Input.vue.d.ts +13 -8
  53. package/dist/components/input/classes.d.ts +33 -18
  54. package/dist/components/input/reassertValue.d.ts +13 -0
  55. package/dist/components/input/types.d.ts +18 -6
  56. package/dist/components/input/useAdornmentRoom.d.ts +15 -0
  57. package/dist/components/lightbox/Lightbox.vue.d.ts +2 -1
  58. package/dist/components/lightbox/types.d.ts +5 -2
  59. package/dist/components/link/Link.vue.d.ts +1 -1
  60. package/dist/components/link/types.d.ts +5 -2
  61. package/dist/components/load-more/types.d.ts +4 -3
  62. package/dist/components/logo-item/LogoItem.vue.d.ts +1 -1
  63. package/dist/components/logo-item/types.d.ts +2 -1
  64. package/dist/components/nav-menu/NavMenu.vue.d.ts +2 -1
  65. package/dist/components/nav-menu/navLinks.d.ts +1 -1
  66. package/dist/components/nav-menu/types.d.ts +3 -3
  67. package/dist/components/pagination/Pagination.vue.d.ts +154 -0
  68. package/dist/components/pagination/types.d.ts +36 -2
  69. package/dist/components/popover/Popover.vue.d.ts +29 -2
  70. package/dist/components/popover/types.d.ts +62 -9
  71. package/dist/components/price/types.d.ts +3 -2
  72. package/dist/components/product-card/ProductCard.vue.d.ts +2 -2
  73. package/dist/components/product-card/types.d.ts +3 -2
  74. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +4 -4
  75. package/dist/components/quantity-stepper/types.d.ts +5 -2
  76. package/dist/components/radio/Radio.vue.d.ts +33 -0
  77. package/dist/components/radio/RadioGroup.vue.d.ts +6 -2
  78. package/dist/components/radio/recipes.d.ts +41 -0
  79. package/dist/components/radio/types.d.ts +71 -4
  80. package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -1
  81. package/dist/components/range-slider/types.d.ts +5 -2
  82. package/dist/components/rating/Rating.vue.d.ts +1 -1
  83. package/dist/components/rating/types.d.ts +3 -2
  84. package/dist/components/search-bar/SearchBar.vue.d.ts +4 -3
  85. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
  86. package/dist/components/search-bar/types.d.ts +5 -2
  87. package/dist/components/search-modal/SearchModal.vue.d.ts +3 -2
  88. package/dist/components/search-modal/types.d.ts +7 -4
  89. package/dist/components/section/Section.vue.d.ts +0 -1
  90. package/dist/components/section/types.d.ts +0 -4
  91. package/dist/components/select/MultiSelect.vue.d.ts +53 -6
  92. package/dist/components/select/Select.vue.d.ts +24 -4
  93. package/dist/components/select/SelectPanel.vue.d.ts +25 -2
  94. package/dist/components/select/SelectTags.vue.d.ts +50 -0
  95. package/dist/components/select/openRegistry.d.ts +14 -4
  96. package/dist/components/select/panelParts.d.ts +45 -18
  97. package/dist/components/select/types.d.ts +54 -10
  98. package/dist/components/select/useOptionList.d.ts +31 -4
  99. package/dist/components/select/usePopover.d.ts +36 -39
  100. package/dist/components/select/useSummaryFit.d.ts +21 -0
  101. package/dist/components/select/useTagRows.d.ts +17 -0
  102. package/dist/components/site-form/SiteForm.vue.d.ts +3 -2
  103. package/dist/components/site-form/types.d.ts +6 -2
  104. package/dist/components/skeleton/Skeleton.vue.d.ts +2 -2
  105. package/dist/components/skeleton/types.d.ts +4 -4
  106. package/dist/components/switch/Switch.vue.d.ts +17 -10
  107. package/dist/components/switch/types.d.ts +29 -2
  108. package/dist/components/tabler-icon/TablerIcon.vue.d.ts +2 -3
  109. package/dist/components/tabler-icon/types.d.ts +0 -4
  110. package/dist/components/tabs/Tab.vue.d.ts +2 -1
  111. package/dist/components/tabs/TabPanel.vue.d.ts +1 -3
  112. package/dist/components/tabs/Tabs.vue.d.ts +1 -1
  113. package/dist/components/tabs/context.d.ts +6 -2
  114. package/dist/components/tabs/types.d.ts +22 -11
  115. package/dist/components/textarea/Textarea.vue.d.ts +23 -3
  116. package/dist/components/textarea/types.d.ts +15 -3
  117. package/dist/components/toast/Toast.vue.d.ts +2 -0
  118. package/dist/components/toast/Toaster.vue.d.ts +7 -1
  119. package/dist/components/toast/types.d.ts +52 -5
  120. package/dist/components/tooltip/types.d.ts +4 -3
  121. package/dist/components/unit-input/UnitInput.vue.d.ts +7 -7
  122. package/dist/components/unit-input/types.d.ts +5 -2
  123. package/dist/components/variant-picker/VariantPicker.vue.d.ts +1 -1
  124. package/dist/components/variant-picker/types.d.ts +3 -2
  125. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +0 -1
  126. package/dist/components/visually-hidden/types.d.ts +0 -4
  127. package/dist/components.css +1556 -2145
  128. package/dist/composables/useDialog.d.ts +7 -3
  129. package/dist/composables/useEldraScope.d.ts +24 -0
  130. package/dist/composables/useFloating.d.ts +21 -8
  131. package/dist/composables/useOverlay.d.ts +10 -5
  132. package/dist/composables/useToast.d.ts +3 -0
  133. package/dist/index.d.ts +12 -10
  134. package/dist/index.js +2553 -1185
  135. package/dist/messages/en-US.d.ts +2 -0
  136. package/dist/messages/is-IS.js +1 -0
  137. package/dist/resolver.js +1 -0
  138. package/dist/style.css +1561 -2150
  139. package/dist/tailwind.css +11 -2203
  140. package/dist/theme.css +108 -0
  141. package/dist/tokens.css +1 -0
  142. package/dist/useMessages-B5nzZghs.js +592 -0
  143. package/dist/utilities.css +2160 -0
  144. package/dist/utils/mergeClass.d.ts +3 -0
  145. package/dist/utils/tagRecipe.d.ts +3 -3
  146. package/dist/vee-validate.js +42 -6
  147. package/dist/vue-i18n/index.d.ts +50 -0
  148. package/dist/vue-i18n/shapes.d.ts +40 -0
  149. package/dist/vue-i18n.js +289 -0
  150. package/package.json +17 -3
  151. package/dist/utils/cx.d.ts +0 -31
@@ -1,6 +1,28 @@
1
- import { MultiSelectPart, MultiSelectProps, SelectOption, SelectSize } from './types.js';
1
+ import { MultiSelectProps, SelectOption, SelectSize } from './types.js';
2
2
  declare const __VLS_template: () => {
3
3
  __VLS_Slots: {
4
+ leading?: (props: {
5
+ options: SelectOption[];
6
+ open: boolean;
7
+ }) => any;
8
+ } & {
9
+ tagItem?: (props: {
10
+ option: SelectOption;
11
+ remove: () => void;
12
+ removable: boolean;
13
+ removeLabel: string;
14
+ }) => any;
15
+ } & {
16
+ tag?: (props: {
17
+ option: SelectOption;
18
+ remove: () => void;
19
+ }) => any;
20
+ } & {
21
+ leading?: (props: {
22
+ options: SelectOption[];
23
+ open: boolean;
24
+ }) => any;
25
+ } & {
4
26
  value?: (props: {
5
27
  options: SelectOption[];
6
28
  }) => any;
@@ -10,36 +32,56 @@ declare const __VLS_template: () => {
10
32
  selected: boolean;
11
33
  active: boolean;
12
34
  }) => any;
35
+ } & {
36
+ optionContent?: (props: {
37
+ option: SelectOption;
38
+ selected: boolean;
39
+ active: boolean;
40
+ match: import('./useOptionList.js').MatchParts | null;
41
+ }) => any;
13
42
  } & {
14
43
  empty?: (props: {}) => any;
44
+ } & {
45
+ loading?: (props: {}) => any;
46
+ } & {
47
+ tagItem?: (props: {
48
+ option: SelectOption;
49
+ remove: () => void;
50
+ removable: boolean;
51
+ removeLabel: string;
52
+ }) => any;
15
53
  } & {
16
54
  tag?: (props: {
17
55
  option: SelectOption;
56
+ remove: () => void;
18
57
  }) => any;
19
58
  };
20
59
  };
21
60
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
22
61
  declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
- clear: () => any;
24
62
  search: (query: string) => any;
25
63
  "update:modelValue": (value: string[]) => any;
64
+ clear: () => any;
26
65
  open: () => any;
27
66
  close: () => any;
28
67
  change: (value: string[]) => any;
68
+ create: (query: string) => any;
29
69
  }, string, import('vue').PublicProps, Readonly<MultiSelectProps> & Readonly<{
30
- onClear?: (() => any) | undefined;
31
70
  onSearch?: ((query: string) => any) | undefined;
32
71
  "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
72
+ onClear?: (() => any) | undefined;
33
73
  onOpen?: (() => any) | undefined;
34
74
  onClose?: (() => any) | undefined;
35
75
  onChange?: ((value: string[]) => any) | undefined;
76
+ onCreate?: ((query: string) => any) | undefined;
36
77
  }>, {
37
- size: SelectSize;
38
78
  name: string;
39
- classes: Partial<Record<MultiSelectPart, string>>;
79
+ size: SelectSize;
40
80
  modelValue: string[];
81
+ classes: Partial<Record<import('./types.js').MultiSelectPart, string>>;
41
82
  required: boolean;
42
83
  placeholder: string;
84
+ loading: boolean;
43
85
  id: string;
44
86
  leadingIcon: import('../../index.js').IconComponent;
45
87
  disabled: boolean;
@@ -63,6 +105,7 @@ declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}
63
105
  noResults: string;
64
106
  noResultsFor: (query: string) => string;
65
107
  noMatchesFor: (query: string) => string;
108
+ createOption: (query: string) => string;
66
109
  moreSelected: (n: number) => string;
67
110
  removeTag: (label: string) => string;
68
111
  selected: string;
@@ -199,8 +242,12 @@ declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}
199
242
  searchPlaceholder: string;
200
243
  placement: import('./types.js').SelectPlacement;
201
244
  teleport: string | boolean;
245
+ creatable: boolean;
246
+ renderBatch: number;
202
247
  showTags: boolean;
203
- maxSummary: number;
248
+ tagPlacement: "below" | "inside";
249
+ maxTagRows: number;
250
+ maxSummary: number | "fit";
204
251
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
205
252
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
206
253
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,11 @@
1
1
  import { SelectOption, SelectProps, SelectSize } from './types.js';
2
2
  declare const __VLS_template: () => {
3
3
  __VLS_Slots: {
4
+ leading?: (props: {
5
+ option: SelectOption | undefined;
6
+ open: boolean;
7
+ }) => any;
8
+ } & {
4
9
  value?: (props: {
5
10
  option: SelectOption;
6
11
  }) => any;
@@ -10,32 +15,44 @@ declare const __VLS_template: () => {
10
15
  selected: boolean;
11
16
  active: boolean;
12
17
  }) => any;
18
+ } & {
19
+ optionContent?: (props: {
20
+ option: SelectOption;
21
+ selected: boolean;
22
+ active: boolean;
23
+ match: import('./useOptionList.js').MatchParts | null;
24
+ }) => any;
13
25
  } & {
14
26
  empty?: (props: {}) => any;
27
+ } & {
28
+ loading?: (props: {}) => any;
15
29
  };
16
30
  };
17
31
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
18
32
  declare const __VLS_base: import('vue').DefineComponent<SelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
- clear: () => any;
20
33
  search: (query: string) => any;
21
34
  "update:modelValue": (value: string) => any;
35
+ clear: () => any;
22
36
  open: () => any;
23
37
  close: () => any;
24
38
  change: (value: string) => any;
39
+ create: (query: string) => any;
25
40
  }, string, import('vue').PublicProps, Readonly<SelectProps> & Readonly<{
26
- onClear?: (() => any) | undefined;
27
41
  onSearch?: ((query: string) => any) | undefined;
28
42
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
43
+ onClear?: (() => any) | undefined;
29
44
  onOpen?: (() => any) | undefined;
30
45
  onClose?: (() => any) | undefined;
31
46
  onChange?: ((value: string) => any) | undefined;
47
+ onCreate?: ((query: string) => any) | undefined;
32
48
  }>, {
33
- size: SelectSize;
34
49
  name: string;
35
- classes: Partial<Record<import('./types.js').SelectPart, string>>;
50
+ size: SelectSize;
36
51
  modelValue: string;
52
+ classes: Partial<Record<import('./types.js').SelectPart, string>>;
37
53
  required: boolean;
38
54
  placeholder: string;
55
+ loading: boolean;
39
56
  id: string;
40
57
  leadingIcon: import('../../index.js').IconComponent;
41
58
  disabled: boolean;
@@ -59,6 +76,7 @@ declare const __VLS_base: import('vue').DefineComponent<SelectProps, {}, {}, {},
59
76
  noResults: string;
60
77
  noResultsFor: (query: string) => string;
61
78
  noMatchesFor: (query: string) => string;
79
+ createOption: (query: string) => string;
62
80
  moreSelected: (n: number) => string;
63
81
  removeTag: (label: string) => string;
64
82
  selected: string;
@@ -196,6 +214,8 @@ declare const __VLS_base: import('vue').DefineComponent<SelectProps, {}, {}, {},
196
214
  searchPlaceholder: string;
197
215
  placement: import('./types.js').SelectPlacement;
198
216
  teleport: string | boolean;
217
+ creatable: boolean;
218
+ renderBatch: number;
199
219
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
200
220
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
201
221
  declare const _default: typeof __VLS_export;
@@ -48,6 +48,14 @@ type __VLS_Props = {
48
48
  fallbackLabel?: string;
49
49
  /** Checkbox rows and `aria-multiselectable="true"`. */
50
50
  multiple?: boolean;
51
+ /** Draws the loading row in place of the list and the empty state. */
52
+ loading?: boolean;
53
+ /** The loading row's text. */
54
+ loadingText?: string;
55
+ /** The "Create “query”" row, last in the list; `undefined` draws none. */
56
+ createOption?: SelectOption;
57
+ /** The create row's text ("Create “teal”"). */
58
+ createText?: string;
51
59
  /** Inline position from `useFloating`, and the placement it resolved to. */
52
60
  panelStyle?: Record<string, string>;
53
61
  placement?: string;
@@ -60,6 +68,15 @@ declare const __VLS_template: () => {
60
68
  selected: boolean;
61
69
  active: boolean;
62
70
  }) => any;
71
+ } & {
72
+ optionContent?: (props: {
73
+ option: SelectOption;
74
+ selected: boolean;
75
+ active: boolean;
76
+ match: MatchParts | null;
77
+ }) => any;
78
+ } & {
79
+ loading?: (props: {}) => any;
63
80
  } & {
64
81
  empty?: (props: {}) => any;
65
82
  } & {
@@ -71,22 +88,28 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
71
88
  root: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
72
89
  searchInput: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
73
90
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
74
- select: (option: SelectOption) => any;
75
91
  search: (query: string) => any;
92
+ select: (option: SelectOption) => any;
76
93
  keydown: (event: KeyboardEvent) => any;
77
94
  activate: (value: string) => any;
95
+ scrollEnd: () => any;
78
96
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
79
- onSelect?: ((option: SelectOption) => any) | undefined;
80
97
  onSearch?: ((query: string) => any) | undefined;
98
+ onSelect?: ((option: SelectOption) => any) | undefined;
81
99
  onKeydown?: ((event: KeyboardEvent) => any) | undefined;
82
100
  onActivate?: ((value: string) => any) | undefined;
101
+ onScrollEnd?: (() => any) | undefined;
83
102
  }>, {
84
103
  multiple: boolean;
85
104
  classes: Partial<Record<import('./types.js').SelectPart, string>>;
105
+ loading: boolean;
106
+ createOption: SelectOption;
86
107
  placement: string;
87
108
  activeValue: string;
88
109
  labelledBy: string;
89
110
  fallbackLabel: string;
111
+ loadingText: string;
112
+ createText: string;
90
113
  panelStyle: Record<string, string>;
91
114
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
92
115
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,50 @@
1
+ import { MultiSelectPart, SelectOption } from './types.js';
2
+ /**
3
+ * A multi-select's chosen values as removable chips: below the control, or inside its field
4
+ * (`inside`, where `more` counts the chips `maxTagRows` hides and the list is `display: contents`,
5
+ * so its chips wrap in the field's own row with the trigger). Internal, so `MultiSelect` draws the
6
+ * one list in either place.
7
+ */
8
+ type __VLS_Props = {
9
+ options: SelectOption[];
10
+ id: string;
11
+ label: string;
12
+ labelledBy?: string;
13
+ inside: boolean;
14
+ classes?: Partial<Record<MultiSelectPart, string>>;
15
+ removable: boolean;
16
+ removeLabel: (label: string) => string;
17
+ more: number;
18
+ moreLabel: string;
19
+ };
20
+ declare const __VLS_template: () => {
21
+ __VLS_Slots: {
22
+ tagItem?: (props: {
23
+ option: SelectOption;
24
+ remove: () => void;
25
+ removable: boolean;
26
+ removeLabel: string;
27
+ }) => any;
28
+ } & {
29
+ tag?: (props: {
30
+ option: SelectOption;
31
+ remove: () => void;
32
+ }) => any;
33
+ };
34
+ };
35
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
36
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
37
+ remove: (value: string) => any;
38
+ deselect: (value: string) => any;
39
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
40
+ onRemove?: ((value: string) => any) | undefined;
41
+ onDeselect?: ((value: string) => any) | undefined;
42
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
43
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
44
+ declare const _default: typeof __VLS_export;
45
+ export default _default;
46
+ type __VLS_WithSlots<T, S> = T & {
47
+ new (): {
48
+ $slots: S;
49
+ };
50
+ };
@@ -1,11 +1,21 @@
1
+ export interface RegisterOpenOptions {
2
+ /** The element the opening popup is anchored to — its trigger. */
3
+ anchor?: Node | null;
4
+ /**
5
+ * Whether a node belongs to the opening popup (its `useOverlay` `isInside`). Asked later, when
6
+ * another popup opens: one whose `anchor` this popup contains is *nested* in it — a `Select` in
7
+ * a `Popover`'s panel — and opening it leaves this one open.
8
+ */
9
+ contains?: (node: Node) => boolean;
10
+ }
1
11
  /**
2
- * Claim the slot and close whatever held it.
12
+ * Claim the slot and close whatever held it — except the popups the new one is nested in.
3
13
  *
4
- * The slot is reassigned *before* the previous popup is closed, so the `unregisterOpen` that
14
+ * The slot is reassigned *before* the previous popups are closed, so the `unregisterOpen` that
5
15
  * closing triggers sees a slot that is no longer its own and leaves the new owner alone.
6
16
  */
7
- export declare function registerOpen(close: () => void): void;
17
+ export declare function registerOpen(close: () => void, options?: RegisterOpenOptions): void;
8
18
  /** Release the slot, if it is still this popup's. */
9
19
  export declare function unregisterOpen(close: () => void): void;
10
- /** The currently open popup's close function, or `null`. Exposed for tests. */
20
+ /** The innermost open popup's close function, or `null`. Exposed for tests. */
11
21
  export declare function currentOpen(): (() => void) | null;
@@ -7,14 +7,15 @@ import { SelectOption, SelectPart } from './types.js';
7
7
  * which is the point: a consumer styles `option` once and both controls take it.
8
8
  */
9
9
  export type PanelClasses = Partial<Record<SelectPart, string>>;
10
+ /** What every function below returns: a Vue `class` value. */
11
+ export type PanelClassValue = ReadonlyArray<string | false | undefined>;
10
12
  /**
11
13
  * Every class the **panel** of a select draws, in one place, because `Select` and `MultiSelect`
12
14
  * draw the same panel. They are plain functions rather than computeds so that both `SelectPanel`
13
15
  * (which renders the panel) and a trigger (which reuses an option's swatch and icon for the chosen
14
16
  * option's mark) can call them.
15
17
  *
16
- * Each ends in `partClass`, so a consumer's per-part override merges over ours through
17
- * `tailwind-merge` rather than landing beside it.
18
+ * Each returns a Vue class value with the consumer's per-part classes appended last.
18
19
  */
19
20
  /**
20
21
  * The popover (spec "Select" → Sizes, Popover row). Not a dialog: it is a non-modal popup
@@ -33,13 +34,16 @@ export type PanelClasses = Partial<Record<SelectPart, string>>;
33
34
  * not**, and neither do custom properties set on a wrapper: set `--eldra-*` overrides on `:root`
34
35
  * (or on the teleport target), which is what the README's Customisation section already asks for.
35
36
  */
36
- export declare function panelClass(classes: PanelClasses | undefined): string;
37
- /** Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem, inset focus ring. */
38
- export declare function searchClass(classes: PanelClasses | undefined): string;
39
- export declare function listboxClass(classes: PanelClasses | undefined, hasOptions: boolean): string;
37
+ export declare function panelClass(classes: PanelClasses | undefined): PanelClassValue;
38
+ /**
39
+ * Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem. No focus ring (a README
40
+ * Deviation): focus sits here whenever the panel is open, so the caret and the active row show it.
41
+ */
42
+ export declare function searchClass(classes: PanelClasses | undefined): PanelClassValue;
43
+ export declare function listboxClass(classes: PanelClasses | undefined, hasOptions: boolean): PanelClassValue;
40
44
  /** Spec: "Every group after the first gets a 1px `border` hairline and 0.25rem gap above it." */
41
- export declare function groupClass(classes: PanelClasses | undefined, index: number): string;
42
- export declare function groupLabelClass(classes: PanelClasses | undefined, index: number): string;
45
+ export declare function groupClass(classes: PanelClasses | undefined, index: number): PanelClassValue;
46
+ export declare function groupLabelClass(classes: PanelClasses | undefined, index: number): PanelClassValue;
43
47
  /**
44
48
  * Spec "Select" → Sizes, Option row, and → States for active / selected / disabled.
45
49
  *
@@ -51,14 +55,15 @@ export declare function optionClass(classes: PanelClasses | undefined, option: S
51
55
  active: boolean;
52
56
  selected: boolean;
53
57
  multiple: boolean;
54
- }): string;
55
- export declare function optionLabelClass(classes: PanelClasses | undefined, option: SelectOption): string;
56
- export declare function optionHintClass(classes: PanelClasses | undefined): string;
57
- export declare function optionMetaClass(classes: PanelClasses | undefined, option: SelectOption): string;
58
- export declare function optionSwatchClass(classes: PanelClasses | undefined): string;
59
- export declare function optionIconClass(classes: PanelClasses | undefined): string;
58
+ }): PanelClassValue;
59
+ /** A disabled row reads as disabled through the row's `muted` text and cursor, like `Checkbox`. */
60
+ export declare function optionLabelClass(classes: PanelClasses | undefined): PanelClassValue;
61
+ export declare function optionHintClass(classes: PanelClasses | undefined): PanelClassValue;
62
+ export declare function optionMetaClass(classes: PanelClasses | undefined, option: SelectOption): PanelClassValue;
63
+ export declare function optionSwatchClass(classes: PanelClasses | undefined): PanelClassValue;
64
+ export declare function optionIconClass(classes: PanelClasses | undefined): PanelClassValue;
60
65
  /** Spec "Select" → States, Option selected: "check mark in `text` (never colour alone)". */
61
- export declare function optionCheckClass(classes: PanelClasses | undefined): string;
66
+ export declare function optionCheckClass(classes: PanelClasses | undefined): PanelClassValue;
62
67
  /**
63
68
  * A multi-select option's checkbox (spec "Multi-select" → Sizes, "Checkbox in option"): "1rem
64
69
  * square, 1.5px `border-strong`, 0.25rem radius, `background` fill. Checked: `primary` fill and
@@ -72,9 +77,22 @@ export declare function optionCheckClass(classes: PanelClasses | undefined): str
72
77
  export declare function optionBoxClass(classes: PanelClasses | undefined, state: {
73
78
  selected: boolean;
74
79
  disabled: boolean;
75
- }): string;
80
+ }): PanelClassValue;
76
81
  /** Spec "Select" → Sizes, Empty state: "0.875rem, `muted`, centred, padding 1rem 0.75rem". */
77
- export declare function emptyClass(classes: PanelClasses | undefined): string;
82
+ export declare function emptyClass(classes: PanelClasses | undefined): PanelClassValue;
83
+ /**
84
+ * The loading row: the empty state's box, with the shared spinner before its text. It stands in
85
+ * for the list and the empty state while a `loading` control's options are being fetched.
86
+ */
87
+ export declare function loadingClass(classes: PanelClasses | undefined): PanelClassValue;
88
+ /**
89
+ * The "Create “query”" row of a `creatable` control: an option row's own box and active fill, with
90
+ * a `plus` where a row draws its mark. After other rows it sits under a group's hairline (drawn
91
+ * by `SelectPanel`), so it reads as an action rather than one more match.
92
+ */
93
+ export declare function createOptionClass(classes: PanelClasses | undefined, state: {
94
+ active: boolean;
95
+ }): PanelClassValue;
78
96
  /**
79
97
  * The tick inside that box (spec "Multi-select" → Sizes: "a `primary-contrast` tick (0.25 × 0.5rem,
80
98
  * 2px stroke)").
@@ -88,4 +106,13 @@ export declare function emptyClass(classes: PanelClasses | undefined): string;
88
106
  * It is always rendered and scaled from 0, rather than added and removed, so it can grow in over
89
107
  * `duration-fast` the way `Checkbox`'s does.
90
108
  */
91
- export declare function optionTickClass(selected: boolean): string;
109
+ export declare function optionTickClass(selected: boolean): PanelClassValue;
110
+ /**
111
+ * The cell a trigger stacks its chosen value in, with an invisible copy of the placeholder
112
+ * (`data-placeholder`, drawn by `::after`) in the same grid cell: a content-sized trigger keeps at
113
+ * least its placeholder's width once a value is chosen, as a native input keeps its width. The copy
114
+ * is generated content under `visibility: hidden`, so it adds no text and no accessible name.
115
+ */
116
+ export declare const TRIGGER_VALUE_STACK: string;
117
+ /** The chosen value inside `TRIGGER_VALUE_STACK`, in the cell the placeholder copy shares. */
118
+ export declare const TRIGGER_VALUE_CELL = "eldra:col-start-1 eldra:row-start-1";
@@ -5,8 +5,8 @@ import { IconComponent } from '../icon/types.js';
5
5
  *
6
6
  * Everything past `value`/`label` is the spec's "Rich options" variant: a `swatch` (a colour from
7
7
  * product data), an `icon`, a `hint` line under the label, a `meta` note aligned to the end, and
8
- * `disabled` for a sold-out choice — which the spec asks to *show*, struck through with its
9
- * reason, rather than hide.
8
+ * `disabled` for a choice that cannot change (sold out, or always on) — shown muted, with any reason
9
+ * in `hint` or `meta`, rather than hidden.
10
10
  */
11
11
  export interface SelectOption {
12
12
  /** The value posted, and the one `modelValue` holds when this option is chosen. */
@@ -25,8 +25,13 @@ export interface SelectOption {
25
25
  swatch?: string;
26
26
  /** A decorative icon for this option, shown in the row and in the trigger when it is chosen. */
27
27
  icon?: IconComponent;
28
- /** Sold out / unavailable. Skipped by the arrow keys, cannot be chosen, struck through. */
28
+ /** Sold out, or fixed. Skipped by the arrow keys, cannot be toggled, drawn muted. */
29
29
  disabled?: boolean;
30
+ /**
31
+ * More words the search field matches this option by, beside its label (an icon's tags, a
32
+ * country's code). Never drawn: a row found through a keyword shows its label unhighlighted.
33
+ */
34
+ keywords?: string[];
30
35
  }
31
36
  /**
32
37
  * The parts a consumer can restyle through `classes`, named as the spec's anatomy names them.
@@ -37,10 +42,10 @@ export interface SelectOption {
37
42
  * is styled once wherever it appears.
38
43
  *
39
44
  * `native` is the odd one out: it marks the hidden native `<select>` with a `data-part` so a test
40
- * or a form helper can find it, but the element is `hidden`, so `classes.native` merges onto
45
+ * or a form helper can find it, but the element is `hidden`, so `classes.native` lands on
41
46
  * nothing and has no effect. Every other part takes classes.
42
47
  */
43
- export type SelectPart = 'root' | 'trigger' | 'leadingIcon' | 'value' | 'placeholder' | 'chevron' | 'clearButton' | 'panel' | 'search' | 'listbox' | 'group' | 'groupLabel' | 'option' | 'optionLabel' | 'optionHint' | 'optionMeta' | 'optionSwatch' | 'optionIcon' | 'optionCheck' | 'empty' | 'native';
48
+ export type SelectPart = 'trigger' | 'leadingIcon' | 'value' | 'placeholder' | 'chevron' | 'clearButton' | 'panel' | 'search' | 'listbox' | 'group' | 'groupLabel' | 'option' | 'optionLabel' | 'optionHint' | 'optionMeta' | 'optionSwatch' | 'optionIcon' | 'optionCheck' | 'empty' | 'loading' | 'createOption' | 'native';
44
49
  /** The shared control box, exactly as `Input`'s: 2rem, 2.5rem or 3rem tall. */
45
50
  export type SelectSize = 'sm' | 'md' | 'lg';
46
51
  /**
@@ -90,9 +95,30 @@ export interface SelectProps {
90
95
  * Read once, like `placement`.
91
96
  */
92
97
  teleport?: boolean | string;
98
+ /**
99
+ * Draws the panel's loading row ("Loading", with a spinner, in a polite status region) in place
100
+ * of the list, for options that are still being fetched. The list is not navigable meanwhile.
101
+ */
102
+ loading?: boolean;
103
+ /**
104
+ * Adds a "Create “query”" row at the end of the list while the search field holds a query that
105
+ * no option's label already equals (ignoring case and accents). Choosing it emits `create` with
106
+ * the trimmed query; adding the option, and choosing it, is the consumer's. Turns `searchable`
107
+ * on unless `searchable` says otherwise.
108
+ */
109
+ creatable?: boolean;
110
+ /**
111
+ * Renders the list this many rows at a time: the first batch on open, the next as the list is
112
+ * scrolled near its end or the keyboard moves past the last rendered row. Search still covers
113
+ * every option. For lists of thousands; unset renders every row.
114
+ */
115
+ renderBatch?: number;
93
116
  /** Message overrides for this control alone. */
94
117
  messages?: Partial<UiMessages>;
95
- /** Per-part class overrides, merged with `tailwind-merge`. */
118
+ /**
119
+ * Per-part classes, appended to the part's own (they win by cascade layer). Style the root with
120
+ * `class`.
121
+ */
96
122
  classes?: Partial<Record<SelectPart, string>>;
97
123
  }
98
124
  /**
@@ -109,7 +135,7 @@ export interface SelectProps {
109
135
  * none either. Both are kept in the union rather than subtracted from it, so that one `classes`
110
136
  * object can be handed to either control.
111
137
  */
112
- export type MultiSelectPart = SelectPart | 'summary' | 'summaryMore' | 'tags' | 'tag' | 'tagRemove' | 'footer' | 'footerCount' | 'footerClear' | 'footerDone';
138
+ export type MultiSelectPart = SelectPart | 'summary' | 'summaryMore' | 'tags' | 'tag' | 'tagRemove' | 'tagMore' | 'field' | 'footer' | 'footerCount' | 'footerClear' | 'footerDone';
113
139
  /**
114
140
  * Everything a `Select` takes except the three the spec redefines: the value is a list, the
115
141
  * placeholder's default is `"Any"` rather than `"Select"`, and there is no `clearable` — "the clear
@@ -122,8 +148,26 @@ export interface MultiSelectProps extends Omit<SelectProps, 'modelValue' | 'plac
122
148
  placeholder?: string;
123
149
  /** The removable tag list under the control. `false` for compact toolbars. */
124
150
  showTags?: boolean;
125
- /** How many labels the trigger lists before the "+N" pill. Defaults to 2. */
126
- maxSummary?: number;
127
- /** Per-part class overrides, merged with `tailwind-merge`. */
151
+ /**
152
+ * Where the tags go. `'below'` (the default) lists them under the control and summarises the
153
+ * selection in the trigger; `'inside'` draws them in the field itself, which wraps and grows, with
154
+ * the trigger after the last tag. `showTags` and `maxSummary` apply to `'below'` only.
155
+ */
156
+ tagPlacement?: 'below' | 'inside';
157
+ /**
158
+ * With `tagPlacement: 'inside'`, how many rows of tags the field shows before the rest collapse
159
+ * into a "+N" tag. Defaults to 2; `0` shows every tag.
160
+ */
161
+ maxTagRows?: number;
162
+ /**
163
+ * How many labels the trigger lists before the "+N" pill. `'fit'` (the default) lists as many as
164
+ * fit the trigger's width, re-measured as it resizes, and never fewer than one; a number lists
165
+ * exactly that many.
166
+ */
167
+ maxSummary?: number | 'fit';
168
+ /**
169
+ * Per-part classes, appended to the part's own (they win by cascade layer). Style the root with
170
+ * `class`.
171
+ */
128
172
  classes?: Partial<Record<MultiSelectPart, string>>;
129
173
  }
@@ -32,6 +32,11 @@ export declare function matchRange(label: string, rawQuery: string): {
32
32
  * answers first"). Options with no `group` form an unlabelled section of their own.
33
33
  */
34
34
  export declare function groupOptions(list: SelectOption[], idPrefix: string, controlId: string): PanelSection[];
35
+ /**
36
+ * The value of the "Create “query”" row a `creatable` control appends. A control character no
37
+ * merchant value holds, so it never collides with an option's own value.
38
+ */
39
+ export declare const CREATE_VALUE = "\0eldra-create";
35
40
  export interface UseOptionListOptions {
36
41
  /** Every option the control was given, in the order the consumer wrote them. */
37
42
  options: () => SelectOption[];
@@ -40,22 +45,44 @@ export interface UseOptionListOptions {
40
45
  searchable: () => boolean;
41
46
  /** The control's own id, which the group headings' ids are built from. */
42
47
  controlId: () => string;
48
+ /** While loading, no row is visible or reachable. The native select still has every option. */
49
+ loading?: () => boolean;
50
+ /** Whether a query no label equals offers a "Create" row. */
51
+ creatable?: () => boolean;
52
+ /** How many rows to render at a time; `undefined` (or anything below 1) renders all of them. */
53
+ renderBatch?: () => number | undefined;
43
54
  }
44
55
  export interface UseOptionListReturn {
45
- /** The visible options bucketed into the panel's sections. */
56
+ /** The rendered options bucketed into the panel's sections. */
46
57
  sections: ComputedRef<PanelSection[]>;
47
58
  /** *Every* option bucketed, for the hidden native select's `<optgroup>`s. */
48
59
  nativeSections: ComputedRef<PanelSection[]>;
49
- /** The visible rows in DOM order — the section order, not the prop order, once groups interleave. */
60
+ /**
61
+ * Every row the keyboard can reach, in DOM order — the section order, not the prop order, once
62
+ * groups interleave — with the create row, when there is one, last. With `renderBatch` it runs
63
+ * past the rendered rows; reaching one renders it.
64
+ */
50
65
  listOptions: ComputedRef<SelectOption[]>;
51
66
  hasOptions: ComputedRef<boolean>;
52
67
  /** Per option value, where the query matched its label — or `null` when it did not. */
53
68
  highlights: ComputedRef<Map<string, MatchParts | null>>;
69
+ /** The "Create “query”" row, whose `label` is the trimmed query; `undefined` when there is none. */
70
+ createOption: ComputedRef<SelectOption | undefined>;
71
+ /** Render the next batch. The panel calls it when its list is scrolled near the end. */
72
+ renderMore: () => void;
73
+ /**
74
+ * Render every batch up to the row holding `value`, so a keyboard move past the rendered rows
75
+ * lands on a row that exists. Call it synchronously whenever the active row changes.
76
+ */
77
+ reveal: (value: string | undefined) => void;
78
+ /** Back to the first batch, for closing. */
79
+ resetBatch: () => void;
54
80
  }
55
81
  /**
56
- * The list a select panel shows: filtering, grouping and match highlighting.
82
+ * The list a select panel shows: filtering, grouping, match highlighting, the create row and the
83
+ * render batch.
57
84
  *
58
85
  * Shared by `Select` and `MultiSelect`, which differ in what choosing a row *does* and in nothing
59
- * about which rows there are. Pure derivation — no DOM, no state of its own.
86
+ * about which rows there are. No DOM; its one piece of state is how many rows are rendered.
60
87
  */
61
88
  export declare function useOptionList(options: UseOptionListOptions): UseOptionListReturn;