@eldrajs/ui 0.3.7 → 0.3.8

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 (56) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE-country-flag-icons +25 -0
  3. package/README.md +230 -66
  4. package/dist/PhoneInput-CYGpERg4.js +749 -0
  5. package/dist/{VariantPicker-Cr_AkX47.js → VariantPicker-D_Gg80So.js} +88 -2302
  6. package/dist/components/chip/Chip.vue.d.ts +8 -0
  7. package/dist/components/dialog/Dialog.vue.d.ts +8 -0
  8. package/dist/components/drawer/Drawer.vue.d.ts +8 -0
  9. package/dist/components/filter-panel/FilterGroup.vue.d.ts +8 -0
  10. package/dist/components/filter-panel/FilterPanel.vue.d.ts +8 -0
  11. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +8 -0
  12. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +8 -0
  13. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +8 -0
  14. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +8 -0
  15. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +8 -0
  16. package/dist/components/lightbox/Lightbox.vue.d.ts +8 -0
  17. package/dist/components/nav-menu/NavMenu.vue.d.ts +8 -0
  18. package/dist/components/pagination/Pagination.vue.d.ts +8 -0
  19. package/dist/components/range-slider/RangeSlider.vue.d.ts +8 -0
  20. package/dist/components/search-bar/SearchBar.vue.d.ts +8 -0
  21. package/dist/components/search-modal/SearchModal.vue.d.ts +8 -0
  22. package/dist/components/select/MultiSelect.vue.d.ts +8 -0
  23. package/dist/components/select/Select.vue.d.ts +8 -0
  24. package/dist/components/site-form/SiteForm.vue.d.ts +8 -0
  25. package/dist/components/toast/Toast.vue.d.ts +8 -0
  26. package/dist/components/toast/Toaster.vue.d.ts +8 -0
  27. package/dist/components.css +64 -0
  28. package/dist/index.js +3 -2
  29. package/dist/messages/en-US.d.ts +19 -0
  30. package/dist/messages/is-IS.js +9 -1
  31. package/dist/phone/PhoneFlag.vue.d.ts +6 -0
  32. package/dist/phone/PhoneInput.vue.d.ts +220 -0
  33. package/dist/phone/caret.d.ts +14 -0
  34. package/dist/phone/examples.d.ts +2 -0
  35. package/dist/phone/flags.d.ts +8 -0
  36. package/dist/phone/index.d.ts +13 -0
  37. package/dist/phone/phone.d.ts +62 -0
  38. package/dist/phone/phoneFlagData.d.ts +2 -0
  39. package/dist/phone/rule.d.ts +22 -0
  40. package/dist/phone/types.d.ts +63 -0
  41. package/dist/phone/vee-validate/FieldPhoneInput.vue.d.ts +24 -0
  42. package/dist/phone/vee-validate/index.d.ts +3 -0
  43. package/dist/phone/vee-validate/types.d.ts +3 -0
  44. package/dist/phone/vee-validate.js +96 -0
  45. package/dist/phone.js +1 -0
  46. package/dist/phoneFlagData-D9dDT2uC.js +261 -0
  47. package/dist/resolver.d.ts +9 -2
  48. package/dist/resolver.js +15 -4
  49. package/dist/style.css +64 -0
  50. package/dist/useFieldControl-D_b9SC9s.js +273 -0
  51. package/dist/{useMessages-DOHGfip_.js → useMessages-DQQPh1P_.js} +20 -1
  52. package/dist/usePopover-4CQR2hB5.js +2228 -0
  53. package/dist/utilities.css +37 -0
  54. package/dist/vee-validate.js +6 -273
  55. package/dist/vue-i18n.js +4 -1
  56. package/package.json +19 -2
@@ -0,0 +1,2228 @@
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toValue, unref, useAttrs, useId, useSlots, watch } from "vue";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+ import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/vue";
4
+ // src/utils/id.ts
5
+ /**
6
+ * A stable, SSR-safe id for a component part, or the caller's own id when it
7
+ * gave one.
8
+ *
9
+ * Built on Vue's `useId()` (Vue 3.5+), so the server and the client produce the
10
+ * same value and `aria-describedby`/`for` wiring does not break on hydration.
11
+ * Must be called during `setup()`, like every other Vue composable.
12
+ */
13
+ function useUiId(prefix, explicit) {
14
+ const generated = useId();
15
+ return computed(() => toValue(explicit) ?? `eldra-${prefix}-${generated}`);
16
+ }
17
+ /**
18
+ * Compose an `aria-describedby` (or `aria-labelledby`) value from ids that may
19
+ * be absent.
20
+ *
21
+ * One rule, everywhere in this package: **a control's own ids come first, then
22
+ * whatever the field context adds.** `aria-describedby` is read in document
23
+ * order of the listed ids, so the control's own error, counter or description is
24
+ * what a screen reader hears first, and the wrapper's help text follows. Nothing
25
+ * ever *replaces* the context — a `describedBy` prop adds to it, so
26
+ * `<FieldWrapper error="…"><Input described-by="x"/></FieldWrapper>` still
27
+ * describes the error.
28
+ *
29
+ * Duplicates are dropped (the same id listed twice is announced twice), and an
30
+ * empty result is `undefined` rather than `""`, so the attribute is omitted
31
+ * instead of rendered empty.
32
+ *
33
+ * **Deduplication is per id, not per argument.** Every argument here is itself an
34
+ * `aria-describedby` value, so it may already hold several space-separated ids —
35
+ * a `FieldWrapper`'s context contributes its error, help and counter ids as one
36
+ * string, and a consumer's `describedBy` prop may do the same. Comparing whole
37
+ * arguments would only have caught the case where two of them were byte-identical,
38
+ * and `joinIds('a b', 'b c')` would have announced `b` twice. Each argument is
39
+ * split on whitespace and the ids are deduplicated individually, first occurrence
40
+ * winning, so the order the rule promises is preserved.
41
+ */
42
+ function joinIds(...ids) {
43
+ const seen = /* @__PURE__ */ new Set();
44
+ for (const value of ids) {
45
+ if (typeof value !== "string") continue;
46
+ for (const id of value.split(/\s+/)) if (id.length > 0) seen.add(id);
47
+ }
48
+ return seen.size > 0 ? [...seen].join(" ") : void 0;
49
+ }
50
+ // src/composables/useEldraScope.ts
51
+ /** The injection key `provideEldraScope` provides under. */
52
+ var ELDRA_SCOPE_KEY = Symbol("eldra-scope");
53
+ /**
54
+ * Names a theming scope for every component of this package rendered below the caller (see the
55
+ * README, "Theming a subtree"). Call it in `setup()` of a wrapper or an app root.
56
+ *
57
+ * Each component then renders `data-eldra-scope="<name>"` on its root and on every part it
58
+ * teleports (panels, dialogs, toasts). The name is free; the consumer's own variable overrides
59
+ * target it (`[data-eldra-scope='studio'] { --eldra-color-primary: … }`). Without a provider the
60
+ * attribute is not rendered, so the output is unchanged.
61
+ */
62
+ function provideEldraScope(name = "default") {
63
+ provide(ELDRA_SCOPE_KEY, name || "default");
64
+ }
65
+ /**
66
+ * Internal: the theming hooks a component of this package binds. `scope` goes on every root,
67
+ * teleported root and kit-owned element sitting directly in a slot host, so a scope's variables
68
+ * reach it; it is `undefined` without a provider. `slotHost(...names)` is `data-eldra-slot`, on
69
+ * the element holding those slots, a hook for consumer CSS. It renders whenever one of the slots
70
+ * has content, provider or not, and never for a fallback, which is the kit's own markup.
71
+ */
72
+ function useEldraScope() {
73
+ const scope = inject(ELDRA_SCOPE_KEY, void 0);
74
+ const slots = useSlots();
75
+ return {
76
+ scope,
77
+ slotHost: (...names) => names.some((name) => slots[name] !== void 0) ? "" : void 0
78
+ };
79
+ }
80
+ // src/composables/useControllableModel.ts
81
+ /**
82
+ * A model that works both ways round: controlled when the parent passes
83
+ * `modelValue`, self-managing when it does not.
84
+ *
85
+ * Every stateful component in this package uses it, so a consumer can drop a
86
+ * `Select` in with no `v-model` and still get a working control, while a
87
+ * consumer that does bind `v-model` stays the single source of truth — writes
88
+ * are emitted and never applied locally, so a parent that refuses a value
89
+ * actually refuses it.
90
+ *
91
+ * `fallback` supplies the uncontrolled starting value and is called once.
92
+ */
93
+ function useControllableModel(props, emit, fallback) {
94
+ const internal = ref(props.modelValue === void 0 ? fallback() : props.modelValue);
95
+ watch(() => props.modelValue, (value) => {
96
+ if (value !== void 0) internal.value = value;
97
+ });
98
+ return computed({
99
+ get: () => props.modelValue === void 0 ? internal.value : props.modelValue,
100
+ set: (value) => {
101
+ if (props.modelValue === void 0) internal.value = value;
102
+ emit("update:modelValue", value);
103
+ }
104
+ });
105
+ }
106
+ var kitMerge = extendTailwindMerge({
107
+ extend: {
108
+ theme: {
109
+ shadow: ["float"],
110
+ container: [
111
+ "narrow",
112
+ "content",
113
+ "wide",
114
+ "tablet",
115
+ "two-col"
116
+ ]
117
+ },
118
+ classGroups: {
119
+ "font-size": [{ text: [
120
+ "display",
121
+ "h1",
122
+ "h2",
123
+ "h3",
124
+ "h4",
125
+ "body-lg",
126
+ "body",
127
+ "body-sm",
128
+ "caption",
129
+ "overline",
130
+ "label",
131
+ "code",
132
+ "button-sm",
133
+ "button-md",
134
+ "button-lg",
135
+ "control-sm",
136
+ "control",
137
+ "control-lg",
138
+ "control-mobile",
139
+ "counter",
140
+ "field-note",
141
+ "card-title",
142
+ "switch-label",
143
+ "switch-description",
144
+ "select-group",
145
+ "select-option",
146
+ "select-pill",
147
+ "stepper-value",
148
+ "stepper-value-sm",
149
+ "search-meta",
150
+ "search-title",
151
+ "search-kbd",
152
+ "variant-legend",
153
+ "variant-pill",
154
+ "logo-wordmark",
155
+ "badge",
156
+ "stock-status",
157
+ "price-sm",
158
+ "price-lg",
159
+ "price-current",
160
+ "price-secondary",
161
+ "price-unit",
162
+ "avatar-initials-sm",
163
+ "avatar-initials-md",
164
+ "avatar-initials-lg",
165
+ "avatar-initials-xl",
166
+ "empty-state-title",
167
+ "filter-trigger",
168
+ "filter-subheading",
169
+ "filter-tile-count",
170
+ "content-card-title",
171
+ "content-card-excerpt",
172
+ "dialog-title",
173
+ "accordion-title",
174
+ "drawer-title",
175
+ "tooltip",
176
+ "toast-title",
177
+ "search-modal-field",
178
+ "search-modal-foot",
179
+ "search-modal-kbd"
180
+ ] }],
181
+ h: [
182
+ "control-h",
183
+ "control-h-sm",
184
+ "control-h-lg",
185
+ "eldra-range-track",
186
+ "eldra-skeleton-title",
187
+ "eldra-skeleton-box"
188
+ ],
189
+ "min-h": [
190
+ "eldra-range-rail",
191
+ "eldra-drawer-header-height",
192
+ "eldra-nav-menu-drawer-row"
193
+ ],
194
+ px: [
195
+ "eldra-range-gutter",
196
+ "eldra-range-gutter-thumb",
197
+ "eldra-drawer-gutter"
198
+ ],
199
+ w: [
200
+ "eldra-dialog-width",
201
+ "eldra-dialog-width-sm",
202
+ "eldra-drawer-width",
203
+ "eldra-toast-width",
204
+ "eldra-search-modal-width"
205
+ ],
206
+ size: [
207
+ "eldra-avatar-icon-sm",
208
+ "eldra-avatar-icon-md",
209
+ "eldra-avatar-icon-lg",
210
+ "eldra-avatar-icon-xl"
211
+ ],
212
+ "target-min": ["target-min"],
213
+ "target-touch": ["target-touch"],
214
+ "eldra-scrollbar-hide": ["eldra-scrollbar-hide"],
215
+ transition: ["eldra-transition-colors"],
216
+ "border-w": [
217
+ "eldra-field-border",
218
+ "eldra-button-border",
219
+ "eldra-checkbox-border",
220
+ "eldra-checkbox-border-invalid",
221
+ "eldra-radio-card-border",
222
+ "eldra-switch-track-border",
223
+ "eldra-variant-pill-border",
224
+ "eldra-variant-swatch-ring",
225
+ "eldra-variant-swatch-edge",
226
+ "eldra-filter-swatch-ring",
227
+ "eldra-editor-placeholder-border"
228
+ ],
229
+ "eldra-field-invalid": ["eldra-field-invalid"],
230
+ "eldra-radio-card-selected": ["eldra-radio-card-selected"],
231
+ "eldra-switch-thumb-offset": ["eldra-switch-thumb-offset"],
232
+ "eldra-dialog-fullscreen": ["eldra-dialog-fullscreen"],
233
+ "eldra-drawer-motion": ["eldra-drawer-motion"],
234
+ "eldra-drawer-sheet": ["eldra-drawer-sheet"],
235
+ "max-h": [
236
+ "eldra-select-panel-height",
237
+ "eldra-search-panel-height",
238
+ "eldra-dialog-max-height",
239
+ "eldra-search-modal-max-height",
240
+ "eldra-drawer-sheet-height"
241
+ ],
242
+ m: ["eldra-search-modal-position"],
243
+ "max-w": [
244
+ "eldra-select-panel-width",
245
+ "eldra-container-narrow",
246
+ "eldra-container-content",
247
+ "eldra-container-wide"
248
+ ],
249
+ "eldra-select-match": ["eldra-select-match"],
250
+ "eldra-select-swatch": ["eldra-select-swatch"],
251
+ "eldra-select-option-active": ["eldra-select-option-active"],
252
+ "eldra-select-option-selected": ["eldra-select-option-selected"],
253
+ "eldra-variant-pill-selected-line": ["eldra-variant-pill-selected-line"],
254
+ "eldra-focus": ["eldra-focus", "eldra-focus-inset"],
255
+ "eldra-focus-always": ["eldra-focus-always", "eldra-focus-inset-always"],
256
+ "eldra-focus-proxy": ["eldra-focus-proxy"],
257
+ "eldra-focus-open": ["eldra-focus-open"],
258
+ "eldra-focus-has-open": ["eldra-focus-has-open"],
259
+ "eldra-phone-flag": ["eldra-phone-flag"],
260
+ rounded: ["eldra-link-radius", "eldra-select-check-radius"],
261
+ duration: [
262
+ "duration-fast",
263
+ "duration-base",
264
+ "duration-slow"
265
+ ],
266
+ opacity: ["eldra-revalidating"],
267
+ "eldra-skeleton": ["eldra-skeleton"],
268
+ "eldra-skeleton-text": ["eldra-skeleton-text"],
269
+ "eldra-rating-half": ["eldra-rating-half"],
270
+ "eldra-image-placeholder-hatch": ["eldra-image-placeholder-hatch"],
271
+ "eldra-tooltip-arrow": ["eldra-tooltip-arrow"],
272
+ z: [
273
+ "z-sticky",
274
+ "z-popover",
275
+ "z-drawer",
276
+ "z-dialog",
277
+ "z-toast"
278
+ ],
279
+ "eldra-accordion-chevron": ["eldra-accordion-chevron"],
280
+ "eldra-accordion-panel": ["eldra-accordion-panel"],
281
+ "eldra-carousel-slide": ["eldra-carousel-slide"],
282
+ "eldra-carousel-track": ["eldra-carousel-track"],
283
+ "eldra-carousel-dot": ["eldra-carousel-dot"],
284
+ "eldra-range-thumb": ["eldra-range-thumb"],
285
+ "eldra-filter-swatch-edge": ["eldra-filter-swatch-edge"],
286
+ "eldra-filter-histogram-bar": ["eldra-filter-histogram-bar"],
287
+ pt: ["eldra-nav-menu-panel", "eldra-drawer-header-top"],
288
+ "grid-cols": ["eldra-nav-menu-columns"],
289
+ "eldra-nav-menu-dropdown": ["eldra-nav-menu-dropdown"],
290
+ ps: ["eldra-nav-menu-drawer-nest"],
291
+ pb: [
292
+ "eldra-drawer-header-bottom",
293
+ "eldra-drawer-body-bottom",
294
+ "eldra-drawer-footer-bottom"
295
+ ],
296
+ animate: [
297
+ "animate-eldra-spin",
298
+ "animate-eldra-pulse",
299
+ "animate-eldra-popover-in",
300
+ "animate-eldra-dialog-in",
301
+ "animate-eldra-dialog-in-reduced",
302
+ "animate-eldra-drawer-in-right",
303
+ "animate-eldra-drawer-in-left",
304
+ "animate-eldra-toast-in",
305
+ "animate-eldra-lightbox-in"
306
+ ]
307
+ }
308
+ },
309
+ prefix: "eldra"
310
+ });
311
+ /** The component's own classes with `incoming` (a parent component's) merged over them. */
312
+ function mergeClass(own, incoming) {
313
+ return kitMerge(normalizeClass([own, incoming]));
314
+ }
315
+ // src/components/icon/sizes.ts
316
+ /**
317
+ * The spec's sizes as Tailwind utilities. The theme's `--spacing` is 0.25rem,
318
+ * so `size-4`/`size-5`/`size-6`/`size-8` are exactly 1/1.25/1.5/2rem — no
319
+ * literal length appears here or in the built CSS.
320
+ */
321
+ var ICON_SIZE_CLASS = {
322
+ sm: "eldra:size-4",
323
+ md: "eldra:size-5",
324
+ lg: "eldra:size-6",
325
+ xl: "eldra:size-8"
326
+ };
327
+ /** The spec's outline stroke weight. */
328
+ var ICON_STROKE_WIDTH = 1.75;
329
+ // src/components/spinner/Spinner.vue?vue&type=script&setup=true&lang.ts
330
+ var _hoisted_1$1 = [
331
+ "data-eldra-scope",
332
+ "role",
333
+ "aria-label",
334
+ "aria-hidden"
335
+ ];
336
+ // src/components/spinner/Spinner.vue
337
+ var Spinner_default = /* @__PURE__ */ defineComponent({
338
+ inheritAttrs: false,
339
+ __name: "Spinner",
340
+ props: { label: { default: void 0 } },
341
+ setup(__props) {
342
+ const props = __props;
343
+ const eldra = useEldraScope();
344
+ const attrs = useAttrs();
345
+ const forwardedAttrs = computed(() => {
346
+ const { class: _class, ...rest } = attrs;
347
+ return rest;
348
+ });
349
+ const rootClass = computed(() => mergeClass("eldra:size-4.5 eldra:animate-eldra-spin eldra:motion-reduce:animate-eldra-pulse", attrs.class));
350
+ /** `""` names nothing, so it is decorative too. */
351
+ const named = computed(() => props.label !== void 0 && props.label !== "");
352
+ return (_ctx, _cache) => {
353
+ return openBlock(), createElementBlock("svg", mergeProps({
354
+ "data-eldra-ui": "",
355
+ "data-eldra-scope": unref(eldra).scope,
356
+ class: rootClass.value,
357
+ viewBox: "0 0 18 18",
358
+ fill: "none",
359
+ role: named.value ? "img" : void 0,
360
+ "aria-label": named.value ? __props.label : void 0,
361
+ "aria-hidden": named.value ? void 0 : "true",
362
+ focusable: "false"
363
+ }, forwardedAttrs.value), [..._cache[0] || (_cache[0] = [createElementVNode("circle", {
364
+ cx: "9",
365
+ cy: "9",
366
+ r: "8",
367
+ stroke: "currentColor",
368
+ "stroke-width": "2",
369
+ "stroke-opacity": "0.3"
370
+ }, null, -1), createElementVNode("path", {
371
+ d: "M17 9a8 8 0 0 0-8-8",
372
+ stroke: "currentColor",
373
+ "stroke-width": "2",
374
+ "stroke-linecap": "round"
375
+ }, null, -1)])], 16, _hoisted_1$1);
376
+ };
377
+ }
378
+ });
379
+ // src/components/field-wrapper/context.ts
380
+ /** The key a `FieldWrapper` provides its `FieldContext` on. */
381
+ var FIELD_KEY = Symbol("eldra-ui:field");
382
+ // src/composables/useLocale.ts
383
+ /**
384
+ * The number locale the components format with, as a provide/inject pair — the same shape as
385
+ * `useMessages`, and deliberately separate from it: the *strings* a component renders and the
386
+ * *locale its numbers are formatted in* are two different decisions, and a store that accepts the
387
+ * English defaults may still be an Icelandic shop.
388
+ *
389
+ * It is an ambient default, never an answer: every component that reads it also takes a `locale`
390
+ * prop, and the prop wins. With nothing provided the components format in `en-US`.
391
+ */
392
+ var DEFAULT_UI_LOCALE = "en-US";
393
+ /**
394
+ * The injection key the locale provider writes to. Exported so an app can set the locale from
395
+ * outside a `setup()` scope — and so it can provide a **getter**, which is what makes a locale
396
+ * switch reactive without an effect that outlives a server request:
397
+ *
398
+ * ```ts
399
+ * import { LOCALE_KEY } from '@eldrajs/ui';
400
+ * app.provide(LOCALE_KEY, () => store.locale);
401
+ * ```
402
+ */
403
+ var LOCALE_KEY = Symbol("eldra-ui-locale");
404
+ /**
405
+ * Set the number locale for this component and everything below it.
406
+ *
407
+ * Wraps Vue's `provide`, so it must be called during `setup()`. Use
408
+ * `app.provide(LOCALE_KEY, locale)` for the app-wide case.
409
+ */
410
+ function provideEldraUiLocale(locale) {
411
+ provide(LOCALE_KEY, locale);
412
+ }
413
+ /**
414
+ * The locale a component should format numbers in: whatever an ancestor provided, else `en-US`.
415
+ * A ref or a getter is unwrapped on every read, so the value follows a locale switch.
416
+ */
417
+ function useEldraUiLocale() {
418
+ const provided = inject(LOCALE_KEY, void 0);
419
+ return computed(() => toValue(provided) ?? "en-US");
420
+ }
421
+ /**
422
+ * The injection key the store currency is provided under (spec "Price" → Properties, `currency`
423
+ * row: "store currency") — the same provide/inject shape as `LOCALE_KEY` and deliberately separate
424
+ * from it: a store's number locale and its currency are two different decisions (an
425
+ * `en-US`-formatted store may still sell in `ISK`). It is an ambient default, never an answer:
426
+ * every component that reads it also takes a `currency` prop, and the prop wins. **With nothing
427
+ * provided there is no currency at all** — see `useEldraUiCurrency` for what the components then
428
+ * render, and why this pair has no default code.
429
+ *
430
+ * Exported so an app can set the currency from
431
+ * outside a `setup()` scope — and so it can provide a **getter**, which is what makes a currency
432
+ * switch reactive without an effect that outlives a server request:
433
+ *
434
+ * ```ts
435
+ * import { CURRENCY_KEY } from '@eldrajs/ui';
436
+ * app.provide(CURRENCY_KEY, () => store.currency);
437
+ * ```
438
+ *
439
+ * Providing `undefined` is meaningful and different from not providing at all: it says the store
440
+ * has **no** currency, which is the answer a platform that has not been told one must be able to
441
+ * give. Vue's `inject` consults `key in provides`, so the two cases stay distinguishable (see
442
+ * `useEldraUiCurrency`).
443
+ */
444
+ var CURRENCY_KEY = Symbol("eldra-ui-currency");
445
+ /**
446
+ * Set the store currency for this component and everything below it.
447
+ *
448
+ * Wraps Vue's `provide`, so it must be called during `setup()`. Use
449
+ * `app.provide(CURRENCY_KEY, currency)` for the app-wide case.
450
+ */
451
+ function provideEldraUiCurrency(currency) {
452
+ provide(CURRENCY_KEY, currency);
453
+ }
454
+ /**
455
+ * A value no provider can supply, so `inject`'s default tells "nobody provided a currency" apart
456
+ * from "a provider answered: this store has none". Vue's `inject` returns a provided `undefined`
457
+ * rather than the default (it tests `key in provides`), which is what makes the distinction real.
458
+ */
459
+ var NO_CURRENCY_PROVIDER = Symbol("eldra-ui-currency-absent");
460
+ /**
461
+ * The currency a component should format money in: whatever an ancestor provided, else **nothing**.
462
+ * A ref or a getter is unwrapped on every read, so the value follows a currency switch.
463
+ *
464
+ * **There is no default code.** A component library installed by a shop of any kind cannot guess
465
+ * one: a `USD` fallback puts a dollar sign in front of krónur, and a wrong price is worse than an
466
+ * incomplete one. So `undefined` comes back whenever there is no currency to name, and a component
467
+ * reading it formats the amount as a plain number through the same `Intl` path, with no symbol and
468
+ * no code (`Price` does exactly that). The empty string is read as "no currency" too: it is not a
469
+ * code `Intl` accepts, and it was the only way to decline one while this composable still defaulted.
470
+ *
471
+ * Two ways to arrive at `undefined`, and only one of them is a mistake. A provider that supplies
472
+ * `undefined` (or `''`) has *answered* — this store has no currency — and nothing is logged. Having
473
+ * no provider at all is unwired, and warns once per session in dev.
474
+ */
475
+ function useEldraUiCurrency() {
476
+ const provided = inject(CURRENCY_KEY, NO_CURRENCY_PROVIDER);
477
+ return computed(() => {
478
+ if (provided === NO_CURRENCY_PROVIDER) return;
479
+ const currency = toValue(provided);
480
+ return currency === void 0 || currency === "" ? void 0 : currency;
481
+ });
482
+ }
483
+ // src/components/input/classes.ts
484
+ /**
485
+ * The field recipes of the design spec's **Input**, in one place.
486
+ *
487
+ * `Input` is the spec's field box, and two other controls draw the same box: `SearchBar`'s search
488
+ * field ("Search bar" → Sizes says it *is* an input) and `UnitInput` (so `CurrencyInput` too).
489
+ * `SearchBar` used to carry a
490
+ * hand-copied duplicate of these strings, and the copy drifted — the operator's report was that
491
+ * the search field "does not behave like the regular input fields", which was exactly that: the
492
+ * copy had lost the radius variable and the mobile type-size rule, so the field rounded and
493
+ * resized differently from every `Input` beside it.
494
+ *
495
+ * So the recipes live here and the three components import them. What a component may add is its
496
+ * own **delta** — a pill radius, a different padding for an icon it draws itself — never a second
497
+ * copy of the box.
498
+ *
499
+ * Nothing here is exported from the package: a consumer restyles through `class`, `classes`, tokens and
500
+ * the per-component CSS variables (see the README's Customisation section), not by importing our
501
+ * class strings, which are not a stable API.
502
+ */
503
+ /**
504
+ * The shared box (spec "Input" → Anatomy, Sizes, States). The `<input>` *is* the field box — the
505
+ * anatomy calls it "the native `<input>`, full width" — so the border, the radius and the one
506
+ * focus ring all live on it, and any leading or trailing decoration is absolutely positioned over
507
+ * the padding the sizes reserve for it.
508
+ *
509
+ * `eldra-focus-always` is the text-field rule from the focus-ring foundation: the ring shows on
510
+ * *any* focus, pointer included, "because a caret alone is easy to miss". There is deliberately no
511
+ * `transition-*`/`duration-*` utility beside it — `eldra-focus` owns this element's transition
512
+ * list, including the `duration-fast` border-colour change the spec's Behaviour section asks for.
513
+ * See `src/styles/tailwind.css` and `src/__tests__/focus-transition.spec.ts`.
514
+ */
515
+ var FIELD_BOX = "eldra:block eldra:w-full eldra:min-w-0 eldra:eldra-field-border eldra:placeholder:text-muted eldra:eldra-focus eldra:eldra-focus-always";
516
+ /** The box's radius, apart so a field with a radius of its own (`SearchBar`'s pill) takes one. */
517
+ var FIELD_RADIUS = "eldra:rounded-[var(--eldra-input-radius,var(--eldra-radius-md))]";
518
+ var FIELD_BASE = `${FIELD_BOX} ${FIELD_RADIUS}`;
519
+ /**
520
+ * The type style per size (spec "Input" → Sizes). Its own constant because `SearchBar`'s two sizes
521
+ * take exactly these rules while its paddings are its own — the `max-md:text-control-mobile`
522
+ * override in particular, which is a *viewport* rule (so iOS never zooms into a focused field) and
523
+ * is the half that had gone missing from the copy.
524
+ */
525
+ var FIELD_TEXT = {
526
+ sm: "eldra:text-control-sm",
527
+ md: "eldra:text-control eldra:max-md:text-control-mobile",
528
+ lg: "eldra:text-control-lg"
529
+ };
530
+ /**
531
+ * Sizes (spec "Input" → Sizes). `--spacing` is 0.25rem, so `py-0.75`/`px-2.25` are the spec's
532
+ * 0.1875/0.5625rem, `py-1.75`/`px-2.75` its 0.4375/0.6875rem and `py-2.75` its 0.6875rem.
533
+ * The 1.5rem line comes from the `text-control*` utilities, so the value sits on the spec's line
534
+ * inside the spec's box at every size.
535
+ */
536
+ var FIELD_SIZE = {
537
+ sm: `eldra:control-h-sm eldra:py-0.75 eldra:px-2.25 ${FIELD_TEXT.sm}`,
538
+ md: `eldra:control-h eldra:py-1.75 eldra:px-2.75 ${FIELD_TEXT.md}`,
539
+ lg: `eldra:control-h-lg eldra:py-2.75 eldra:px-2.75 ${FIELD_TEXT.lg}`
540
+ };
541
+ /**
542
+ * Room for the decorations (spec "Input" → Sizes, md row): "With a leading icon, the start padding
543
+ * is 2.25rem. With a trailing action, the end padding is 2.5rem." The leading icon is 1.125rem at
544
+ * every size, so its 2.25rem applies to all three; the trailing action is 2rem square, which does
545
+ * not fit a 2rem sm box, so sm uses a 1.5rem button (still the 2.5.8 target minimum) and 2rem of
546
+ * end padding to match.
547
+ */
548
+ var FIELD_LEADING_PAD = "eldra:ps-9";
549
+ var FIELD_TRAILING_PAD = {
550
+ sm: "eldra:pe-8",
551
+ md: "eldra:pe-10",
552
+ lg: "eldra:pe-10"
553
+ };
554
+ var FIELD_CLEAR_SIZE = {
555
+ sm: "eldra:size-6",
556
+ md: "eldra:size-8",
557
+ lg: "eldra:size-8"
558
+ };
559
+ /**
560
+ * Two trailing actions (operator report, 2026-09-25; recorded under Deviations in the README): a
561
+ * `UnitInput`/`CurrencyInput` with `clearable` and a drag handle both on showed `$1,234,567.89 ×
562
+ * ↕` — each action a full 2rem square around a 1.125rem icon, `gap-1` between them, so the two
563
+ * icons ended up roughly 1.1rem apart, far wider than any other icon pair in the library (the
564
+ * private library's own handle sits `px-0` beside the clear button, no gap at all).
565
+ *
566
+ * A single action keeps `FIELD_TRAILING_PAD`/`FIELD_CLEAR_SIZE` unchanged (`Input`'s and
567
+ * `SearchBar`'s only ever have one, and their rendered classes must not change). With two, the row
568
+ * itself carries no gap (`FIELD_SUFFIX_ROW` below), each action shrinks to `w-6` (1.5rem — still
569
+ * the WCAG 2.5.8 24px minimum) at the row's own height, and the control's end padding grows to fit
570
+ * both of them plus the row's own 0.25rem inset from the edge.
571
+ */
572
+ var FIELD_TRAILING_PAD_PAIR = {
573
+ sm: "eldra:pe-14",
574
+ md: "eldra:pe-14",
575
+ lg: "eldra:pe-14"
576
+ };
577
+ var FIELD_ACTION_PAIR_SIZE = {
578
+ sm: "eldra:w-6 eldra:h-6",
579
+ md: "eldra:w-6 eldra:h-8",
580
+ lg: "eldra:w-6 eldra:h-8"
581
+ };
582
+ /**
583
+ * States (spec "Input" → States). Disabled and read-only replace the live colours outright rather
584
+ * than layering over them, so a `:hover` rule can never win back a live boundary on a dead field.
585
+ * The error row's second 1px line is the ring's own outline at rest (`eldra-field-invalid`, on the
586
+ * control beside this recipe). Each recipe carries the
587
+ * fill, the text colour and the boundary, so a field renders exactly one of each: `fieldState`
588
+ * picks the one recipe a field is in.
589
+ */
590
+ var FIELD_LIVE_FILL = "eldra:bg-background eldra:text-text";
591
+ var FIELD_READONLY_FILL = "eldra:bg-surface eldra:text-text";
592
+ var FIELD_LIVE = `${FIELD_LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
593
+ /** The error boundary alone; `fieldState` pairs it with the live or the read-only fill. */
594
+ var FIELD_INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
595
+ var FIELD_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
596
+ var FIELD_READONLY = `${FIELD_READONLY_FILL} eldra:border-border`;
597
+ /** The one state recipe a field box is in. `invalid` is the shown error, never set while disabled. */
598
+ function fieldState(state) {
599
+ if (state.disabled) return FIELD_DISABLED;
600
+ if (state.readonly) return state.invalid ? `${FIELD_READONLY_FILL} ${FIELD_INVALID}` : FIELD_READONLY;
601
+ return state.invalid ? `${FIELD_LIVE_FILL} ${FIELD_INVALID}` : FIELD_LIVE;
602
+ }
603
+ /** Spec "Input" → Variants, `search`: "The browser's own clear button is hidden." */
604
+ var FIELD_SEARCH_APPEARANCE = "eldra:[&::-webkit-search-cancel-button]:appearance-none eldra:[&::-webkit-search-decoration]:appearance-none";
605
+ /**
606
+ * A ghost icon button at the field's end edge (spec "Input" → Anatomy): square, `muted`, the ring.
607
+ * `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README): Tailwind
608
+ * v4's preflight sets `button { cursor: default }`, so without it every clear button in the
609
+ * package — `Input`'s, `SearchBar`'s and `UnitInput`'s (`CurrencyInput` wraps the last) — showed
610
+ * the default arrow rather than a pointer.
611
+ */
612
+ var FIELD_CLEAR_BUTTON_BOX = "eldra:shrink-0 eldra:items-center eldra:justify-center eldra:text-muted eldra:hover:text-text eldra:cursor-pointer eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)] eldra:eldra-focus";
613
+ /** The whole button. A field that shows or rounds it its own way takes `FIELD_CLEAR_BUTTON_BOX`. */
614
+ var FIELD_CLEAR_BUTTON = `eldra:inline-flex ${FIELD_CLEAR_BUTTON_BOX} eldra:rounded-[var(--eldra-radius-sm)]`;
615
+ /** 1.125rem, `muted`, 0.6875rem from the start edge, and out of the pointer's way. */
616
+ var FIELD_LEADING_ICON = "eldra:absolute eldra:start-2.75 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:h-4.5 eldra:w-4.5 eldra:items-center eldra:justify-center eldra:text-muted eldra:pointer-events-none";
617
+ /**
618
+ * The end-edge area, 0.25rem from the edge (spec "Input" → Anatomy, "Trailing action"). The clear
619
+ * button and the `suffix` slot share it, so a field that has both keeps them on one row in reading
620
+ * order — which is also the tab order the Keyboard table asks for: the input first, the clear
621
+ * button next.
622
+ *
623
+ * `gap-1` is the shared default: `Input`'s own doc comment documents `clearable`/`type="search"`
624
+ * plus a populated `suffix` slot as first-class ("the clear button and the `suffix` slot share it,
625
+ * so a field with both keeps them on one row"), and this constant is `Input`'s and `SearchBar`'s
626
+ * row too — dropping the gap here would silently change `Input`'s rendered output for that
627
+ * combination, which an early review caught. Only `UnitInput`'s two-action pair (see
628
+ * `FIELD_TRAILING_PAD_PAIR` above) wants flush icons, and it builds its row from
629
+ * `FIELD_SUFFIX_ROW_BASE` with `gap-0` rather than changing the shared default.
630
+ */
631
+ var FIELD_SUFFIX_ROW_BASE = "eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center";
632
+ var FIELD_SUFFIX_ROW = `${FIELD_SUFFIX_ROW_BASE} eldra:gap-1`;
633
+ /**
634
+ * The start-edge mirror of `FIELD_SUFFIX_ROW`, for the `prefix` slot: interactive content (a
635
+ * calendar button) 0.25rem from the start edge, so unlike `FIELD_LEADING_ICON` it keeps the pointer.
636
+ */
637
+ var FIELD_PREFIX_ROW = "eldra:absolute eldra:start-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center eldra:gap-1";
638
+ /** The start padding a `prefix` row reserves: the trailing action's room, mirrored. */
639
+ var FIELD_PREFIX_PAD = {
640
+ sm: "eldra:ps-8",
641
+ md: "eldra:ps-10",
642
+ lg: "eldra:ps-10"
643
+ };
644
+ /** `FIELD_TRAILING_PAD`/`FIELD_PREFIX_PAD` in rem, for `useAdornmentRoom`'s comparison. */
645
+ var FIELD_ACTION_ROOM_REM = {
646
+ sm: 2,
647
+ md: 2.5,
648
+ lg: 2.5
649
+ };
650
+ // src/components/select/panelParts.ts
651
+ /**
652
+ * Every class the **panel** of a select draws, in one place, because `Select` and `MultiSelect`
653
+ * draw the same panel. They are plain functions rather than computeds so that both `SelectPanel`
654
+ * (which renders the panel) and a trigger (which reuses an option's swatch and icon for the chosen
655
+ * option's mark) can call them.
656
+ *
657
+ * Each returns a Vue class value with the consumer's per-part classes appended last.
658
+ */
659
+ /**
660
+ * The popover (spec "Select" → Sizes, Popover row). Not a dialog: it is a non-modal popup
661
+ * (non-negotiable 2), positioned by `useFloating` against the trigger.
662
+ *
663
+ * It is **teleported** — to `body`, or to the open `<dialog>` the control sits in — so that no
664
+ * ancestor's `overflow: hidden` clips it and no later stacking context paints over it. `absolute`
665
+ * stays in the class list because it is what a `teleport: false` panel needs; the inline
666
+ * `position` `useFloating` writes (`fixed` once teleported) is on the element itself and wins
667
+ * over it either way. `z-popover` puts it over the sticky header, `overflow-hidden` keeps the
668
+ * search field's top corners on the popover's radius, and the list — not the panel — is what
669
+ * scrolls.
670
+ *
671
+ * Because the panel leaves the control's subtree, a consumer's `classes`/`data-part` styling still
672
+ * reaches it (both are on the element), but a **descendant selector rooted above the control does
673
+ * not**, and neither do custom properties set on a wrapper: set `--eldra-*` overrides on `:root`
674
+ * (or on the teleport target), which is what the README's Customisation section already asks for.
675
+ */
676
+ function panelClass(classes) {
677
+ return [
678
+ "eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-hidden",
679
+ "eldra:eldra-select-panel-height eldra:eldra-select-panel-width",
680
+ "eldra:rounded-md eldra:border eldra:shadow-md",
681
+ "eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
682
+ "eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
683
+ "eldra:text-[color:var(--eldra-select-panel-text)]",
684
+ "eldra:animate-eldra-popover-in",
685
+ classes?.panel
686
+ ];
687
+ }
688
+ /**
689
+ * Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem. No focus ring (a README
690
+ * Deviation): focus sits here whenever the panel is open, so the caret and the active row show it.
691
+ */
692
+ function searchClass(classes) {
693
+ return [
694
+ "eldra:control-h eldra:w-full eldra:min-w-0 eldra:rounded-t-md eldra:bg-transparent eldra:ps-8.5 eldra:pe-3",
695
+ "eldra:text-control-sm eldra:max-md:text-control-mobile",
696
+ "eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
697
+ "eldra:placeholder:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
698
+ "eldra:outline-none",
699
+ classes?.search
700
+ ];
701
+ }
702
+ function listboxClass(classes, hasOptions) {
703
+ return [
704
+ "eldra:overflow-y-auto eldra:overscroll-contain",
705
+ hasOptions ? "eldra:min-h-0 eldra:flex-1 eldra:p-1" : "eldra:h-0",
706
+ classes?.listbox
707
+ ];
708
+ }
709
+ /** Spec: "Every group after the first gets a 1px `border` hairline and 0.25rem gap above it." */
710
+ function groupClass(classes, index) {
711
+ return [index > 0 && "eldra:mt-1 eldra:border-t eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]", classes?.group];
712
+ }
713
+ function groupLabelClass(classes, index) {
714
+ return [
715
+ "eldra:text-select-group eldra:px-2 eldra:pb-1",
716
+ "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
717
+ index > 0 ? "eldra:pt-2.5" : "eldra:pt-2",
718
+ classes?.groupLabel
719
+ ];
720
+ }
721
+ /**
722
+ * Spec "Select" → Sizes, Option row, and → States for active / selected / disabled.
723
+ *
724
+ * `multiple` is the one difference the spec draws between the two controls' rows: a multi-select's
725
+ * selection is carried by the filled box, so its label is "weight 500 (not 600)" (spec
726
+ * "Multi-select" → States, Option selected).
727
+ */
728
+ function optionClass(classes, option, state) {
729
+ return [
730
+ "eldra:flex eldra:min-h-9 eldra:scroll-my-1 eldra:items-center eldra:gap-2 eldra:rounded-sm eldra:px-2 eldra:py-1.5 eldra:text-select-option",
731
+ state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
732
+ state.selected && (state.multiple ? "eldra:font-medium" : "eldra:font-semibold"),
733
+ state.selected && "eldra:eldra-select-option-selected",
734
+ option.disabled === true ? "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))] eldra:cursor-not-allowed" : "eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:cursor-pointer",
735
+ classes?.option
736
+ ];
737
+ }
738
+ /** A disabled row reads as disabled through the row's `muted` text and cursor, like `Checkbox`. */
739
+ function optionLabelClass(classes) {
740
+ return ["eldra:block", classes?.optionLabel];
741
+ }
742
+ function optionHintClass(classes) {
743
+ return ["eldra:text-caption eldra:block eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.optionHint];
744
+ }
745
+ var META_TONE = {
746
+ warning: "eldra:text-warning eldra:font-semibold",
747
+ danger: "eldra:text-danger eldra:font-semibold"
748
+ };
749
+ function optionMetaClass(classes, option) {
750
+ return [
751
+ "eldra:ms-3 eldra:shrink-0 eldra:text-caption eldra:tabular-nums",
752
+ option.metaTone === void 0 ? "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : META_TONE[option.metaTone],
753
+ classes?.optionMeta
754
+ ];
755
+ }
756
+ function optionSwatchClass(classes) {
757
+ return ["eldra:size-4 eldra:shrink-0 eldra:rounded-full eldra:eldra-select-swatch", classes?.optionSwatch];
758
+ }
759
+ function optionIconClass(classes) {
760
+ return ["eldra:size-4.5 eldra:shrink-0", classes?.optionIcon];
761
+ }
762
+ /** Spec "Select" → States, Option selected: "check mark in `text` (never colour alone)". */
763
+ function optionCheckClass(classes) {
764
+ return ["eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-check,var(--eldra-color-text))]", classes?.optionCheck];
765
+ }
766
+ /**
767
+ * A multi-select option's checkbox (spec "Multi-select" → Sizes, "Checkbox in option"): "1rem
768
+ * square, 1.5px `border-strong`, 0.25rem radius, `background` fill. Checked: `primary` fill and
769
+ * border with a `primary-contrast` tick."
770
+ *
771
+ * It is the `optionCheck` part — the same part a single select's check mark is — so "the mark that
772
+ * says this row is chosen" is one styling hook in both controls. The border width is `Checkbox`'s
773
+ * own `eldra-checkbox-border`, so a consumer that has restyled their checkboxes' boundary has
774
+ * restyled these; the radius is the spec's smaller 0.25rem, on its own variable.
775
+ */
776
+ function optionBoxClass(classes, state) {
777
+ return [
778
+ "eldra:relative eldra:inline-flex eldra:size-4 eldra:shrink-0 eldra:items-center eldra:justify-center",
779
+ "eldra:eldra-checkbox-border eldra:eldra-select-check-radius",
780
+ "eldra:transition-colors eldra:duration-fast eldra:ease-out",
781
+ state.selected && state.disabled ? "eldra:bg-muted eldra:border-muted" : state.selected ? "eldra:bg-[color:var(--eldra-select-panel-check,var(--eldra-color-primary))] eldra:border-[color:var(--eldra-select-panel-check,var(--eldra-color-primary))]" : state.disabled ? "eldra:bg-surface-strong eldra:border-border eldra:border-dashed" : "eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))] eldra:border-[color:var(--eldra-select-panel-check-border,var(--eldra-color-border-strong))]",
782
+ classes?.optionCheck
783
+ ];
784
+ }
785
+ /** Spec "Select" → Sizes, Empty state: "0.875rem, `muted`, centred, padding 1rem 0.75rem". */
786
+ function emptyClass(classes) {
787
+ return ["eldra:px-3 eldra:py-4 eldra:text-center eldra:text-body-sm eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.empty];
788
+ }
789
+ /**
790
+ * The loading row: the empty state's box, with the shared spinner before its text. It stands in
791
+ * for the list and the empty state while a `loading` control's options are being fetched.
792
+ */
793
+ function loadingClass(classes) {
794
+ return ["eldra:flex eldra:items-center eldra:justify-center eldra:gap-2 eldra:px-3 eldra:py-4 eldra:text-body-sm eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.loading];
795
+ }
796
+ /**
797
+ * The "Create “query”" row of a `creatable` control: an option row's own box and active fill, with
798
+ * a `plus` where a row draws its mark. After other rows it sits under a group's hairline (drawn
799
+ * by `SelectPanel`), so it reads as an action rather than one more match.
800
+ */
801
+ function createOptionClass(classes, state) {
802
+ return [
803
+ "eldra:flex eldra:min-h-9 eldra:scroll-my-1 eldra:items-center eldra:gap-2 eldra:rounded-sm eldra:px-2 eldra:py-1.5 eldra:text-select-option",
804
+ "eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:cursor-pointer",
805
+ state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
806
+ classes?.createOption
807
+ ];
808
+ }
809
+ /**
810
+ * The tick inside that box (spec "Multi-select" → Sizes: "a `primary-contrast` tick (0.25 × 0.5rem,
811
+ * 2px stroke)").
812
+ *
813
+ * The svg is drawn 0.5rem square — `size-2` on the 0.25rem spacing step — over an 8 × 8 viewBox,
814
+ * so one viewBox unit is one pixel of the drawn mark and `stroke-width="2"` is the spec's 2px.
815
+ * (The same relationship `Checkbox` has at its own larger size; a 10-unit viewBox squeezed into
816
+ * 0.5rem would render that same `2` as 1.6px.) The mark is Tabler's check at 3 : 2 — 0.5 × 0.375rem
817
+ * of ink rather than the spec's literal 0.5 × 0.25rem, which read flat (see `Checkbox.vue`).
818
+ *
819
+ * It is always rendered and scaled from 0, rather than added and removed, so it can grow in over
820
+ * `duration-fast` the way `Checkbox`'s does.
821
+ */
822
+ function optionTickClass(selected) {
823
+ return [
824
+ "eldra:text-[color:var(--eldra-select-panel-check-contrast,var(--eldra-color-primary-contrast))]",
825
+ "eldra:pointer-events-none eldra:size-2 eldra:transition-transform eldra:duration-fast eldra:ease-out",
826
+ selected ? "eldra:scale-100" : "eldra:scale-0"
827
+ ];
828
+ }
829
+ /**
830
+ * The cell a trigger stacks its chosen value in, with an invisible copy of the placeholder
831
+ * (`data-placeholder`, drawn by `::after`) in the same grid cell: a content-sized trigger keeps at
832
+ * least its placeholder's width once a value is chosen, as a native input keeps its width. The copy
833
+ * is generated content under `visibility: hidden`, so it adds no text and no accessible name.
834
+ */
835
+ var TRIGGER_VALUE_STACK = "eldra:relative eldra:grid eldra:min-w-0 eldra:flex-1 eldra:grid-cols-[minmax(0,1fr)] eldra:items-center eldra:after:invisible eldra:after:col-start-1 eldra:after:row-start-1 eldra:after:truncate eldra:after:content-[attr(data-placeholder)]";
836
+ /** The chosen value inside `TRIGGER_VALUE_STACK`, in the cell the placeholder copy shares. */
837
+ var TRIGGER_VALUE_CELL = "eldra:col-start-1 eldra:row-start-1";
838
+ // src/components/select/SelectPanel.vue?vue&type=script&setup=true&lang.ts
839
+ var _hoisted_1 = [
840
+ "data-eldra-slot",
841
+ "id",
842
+ "data-eldra-scope",
843
+ "data-eldra-overlay-owner",
844
+ "data-placement"
845
+ ];
846
+ var _hoisted_2 = ["data-eldra-scope"];
847
+ var _hoisted_3 = [
848
+ "value",
849
+ "placeholder",
850
+ "aria-label",
851
+ "aria-controls",
852
+ "aria-activedescendant"
853
+ ];
854
+ var _hoisted_4 = [
855
+ "data-eldra-scope",
856
+ "id",
857
+ "aria-multiselectable",
858
+ "aria-labelledby",
859
+ "aria-label",
860
+ "aria-busy"
861
+ ];
862
+ var _hoisted_5 = [
863
+ "data-part",
864
+ "role",
865
+ "aria-labelledby"
866
+ ];
867
+ var _hoisted_6 = ["id"];
868
+ var _hoisted_7 = [
869
+ "data-eldra-slot",
870
+ "id",
871
+ "aria-selected",
872
+ "aria-disabled",
873
+ "onClick",
874
+ "onMouseenter"
875
+ ];
876
+ var _hoisted_8 = ["data-eldra-scope"];
877
+ var _hoisted_9 = { class: "eldra:min-w-0 eldra:flex-1" };
878
+ var _hoisted_10 = { class: "eldra:eldra-select-match" };
879
+ var _hoisted_11 = ["data-eldra-scope"];
880
+ var _hoisted_12 = ["id"];
881
+ var _hoisted_13 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
882
+ var _hoisted_14 = ["data-eldra-slot", "data-eldra-scope"];
883
+ var _hoisted_15 = ["data-eldra-slot", "data-eldra-scope"];
884
+ var SCROLL_END_SLACK = 80;
885
+ var FOCUSABLE$1 = "input, button, a[href], textarea, select, [tabindex]:not([tabindex^=\"-\"])";
886
+ // src/components/select/SelectPanel.vue
887
+ var SelectPanel_default = /* @__PURE__ */ defineComponent({
888
+ __name: "SelectPanel",
889
+ props: {
890
+ panelId: {},
891
+ listboxId: {},
892
+ sections: {},
893
+ hasOptions: { type: Boolean },
894
+ highlights: {},
895
+ optionId: {},
896
+ activeValue: { default: void 0 },
897
+ selectedValues: {},
898
+ searchable: { type: Boolean },
899
+ query: {},
900
+ searchPlaceholder: {},
901
+ emptyText: {},
902
+ labelledBy: { default: void 0 },
903
+ fallbackLabel: { default: void 0 },
904
+ multiple: {
905
+ type: Boolean,
906
+ default: false
907
+ },
908
+ loading: {
909
+ type: Boolean,
910
+ default: false
911
+ },
912
+ loadingText: { default: void 0 },
913
+ createOption: { default: void 0 },
914
+ createText: { default: void 0 },
915
+ panelStyle: { default: void 0 },
916
+ placement: { default: void 0 },
917
+ classes: { default: void 0 }
918
+ },
919
+ emits: [
920
+ "search",
921
+ "select",
922
+ "activate",
923
+ "keydown",
924
+ "scrollEnd"
925
+ ],
926
+ setup(__props, { expose: __expose, emit: __emit }) {
927
+ const eldra = useEldraScope();
928
+ /**
929
+ * The popover a `Select` and a `MultiSelect` both open: the search field, the listbox with its
930
+ * groups and option rows, and the empty state — plus a `footer` slot, which only a multi-select
931
+ * fills.
932
+ *
933
+ * It exists so that the two controls share one panel rather than two copies of the same markup.
934
+ * Everything it knows is a prop: it owns no open/closed state, no query, no value, and no keyboard
935
+ * (that is `useListbox`). What it does own is the DOM the parents cannot: the panel element and
936
+ * the search input, both exposed so the parent can position the one and focus the other, and the
937
+ * pointer-press guard that keeps a press inside the panel from blurring the focused element.
938
+ *
939
+ * `multiple` is the one behavioural switch, and it is the spec's own: a multi-select's rows carry a
940
+ * checkbox instead of a trailing check mark, and its listbox is `aria-multiselectable="true"`.
941
+ */
942
+ const props = __props;
943
+ const emit = __emit;
944
+ const root = ref(null);
945
+ const searchInput = ref(null);
946
+ __expose({
947
+ root,
948
+ searchInput
949
+ });
950
+ const isActive = (option) => props.activeValue === option.value;
951
+ const isSelected = (option) => props.selectedValues.includes(option.value);
952
+ const panelClasses = computed(() => panelClass(props.classes));
953
+ const searchClasses = computed(() => searchClass(props.classes));
954
+ const listboxClasses = computed(() => listboxClass(props.classes, props.hasOptions));
955
+ const optionHintClasses = computed(() => optionHintClass(props.classes));
956
+ const optionSwatchClasses = computed(() => optionSwatchClass(props.classes));
957
+ const optionIconClasses = computed(() => optionIconClass(props.classes));
958
+ const optionCheckClasses = computed(() => optionCheckClass(props.classes));
959
+ const emptyClasses = computed(() => emptyClass(props.classes));
960
+ const loadingClasses = computed(() => loadingClass(props.classes));
961
+ const createClasses = computed(() => props.createOption === void 0 ? "" : createOptionClass(props.classes, { active: isActive(props.createOption) }));
962
+ /** Within this many pixels of the end — two rows — the next render batch is asked for. */
963
+ function onListScroll(event) {
964
+ const list = event.currentTarget;
965
+ if (list.scrollHeight - list.scrollTop - list.clientHeight <= SCROLL_END_SLACK) emit("scrollEnd");
966
+ }
967
+ const rowClass = (option) => optionClass(props.classes, option, {
968
+ active: isActive(option),
969
+ selected: isSelected(option),
970
+ multiple: props.multiple
971
+ });
972
+ const boxClass = (option) => optionBoxClass(props.classes, {
973
+ selected: isSelected(option),
974
+ disabled: option.disabled === true
975
+ });
976
+ /**
977
+ * Spec "Select" → Behaviour: "The active option is scrolled into view with a 0.25rem margin
978
+ * whenever it changes" — the margin is the row's own `scroll-my-1`.
979
+ *
980
+ * It lives here rather than in either parent because it is the one part of "the active row" that
981
+ * needs an element, and the panel is what has the elements. Both controls get it from one copy.
982
+ */
983
+ function scrollActiveIntoView() {
984
+ const value = props.activeValue;
985
+ if (value === void 0 || typeof document === "undefined") return;
986
+ document.getElementById(props.optionId(value))?.scrollIntoView?.({ block: "nearest" });
987
+ }
988
+ onMounted(scrollActiveIntoView);
989
+ watch(() => props.activeValue, () => void nextTick(scrollActiveIntoView));
990
+ function onSearchInput(event) {
991
+ emit("search", event.target.value);
992
+ }
993
+ /**
994
+ * Anything inside the panel that wants the pointer's default action: it takes focus, or places a
995
+ * caret. The search field and — in a multi-select — the footer's Clear and Done buttons.
996
+ */
997
+ function onPanelMouseDown(event) {
998
+ const target = event.target;
999
+ if (target instanceof Element && target.closest(FOCUSABLE$1) !== null) return;
1000
+ event.preventDefault();
1001
+ }
1002
+ return (_ctx, _cache) => {
1003
+ return openBlock(), createElementBlock("div", {
1004
+ ref_key: "root",
1005
+ ref: root,
1006
+ "data-eldra-slot": unref(eldra).slotHost("footer"),
1007
+ id: __props.panelId,
1008
+ "data-eldra-ui": "",
1009
+ "data-eldra-scope": unref(eldra).scope,
1010
+ "data-part": "panel",
1011
+ "data-eldra-overlay-owner": __props.panelId,
1012
+ class: normalizeClass(panelClasses.value),
1013
+ style: normalizeStyle(__props.panelStyle),
1014
+ "data-placement": __props.placement,
1015
+ onMousedown: onPanelMouseDown
1016
+ }, [
1017
+ __props.searchable ? (openBlock(), createElementBlock("div", {
1018
+ key: 0,
1019
+ "data-eldra-scope": unref(eldra).scope,
1020
+ class: "eldra:relative eldra:shrink-0 eldra:border-b eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]"
1021
+ }, [_cache[3] || (_cache[3] = createElementVNode("svg", {
1022
+ class: "eldra:pointer-events-none eldra:absolute eldra:inset-y-0 eldra:start-2.5 eldra:my-auto eldra:size-4 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
1023
+ viewBox: "0 0 24 24",
1024
+ fill: "none",
1025
+ stroke: "currentColor",
1026
+ "stroke-width": "1.75",
1027
+ "stroke-linecap": "round",
1028
+ "stroke-linejoin": "round",
1029
+ "aria-hidden": "true",
1030
+ focusable: "false"
1031
+ }, [createElementVNode("path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" }), createElementVNode("path", { d: "M21 21l-6 -6" })], -1)), createElementVNode("input", {
1032
+ ref_key: "searchInput",
1033
+ ref: searchInput,
1034
+ "data-part": "search",
1035
+ type: "text",
1036
+ role: "combobox",
1037
+ class: normalizeClass(searchClasses.value),
1038
+ value: __props.query,
1039
+ placeholder: __props.searchPlaceholder,
1040
+ "aria-label": __props.searchPlaceholder,
1041
+ "aria-autocomplete": "list",
1042
+ "aria-expanded": "true",
1043
+ "aria-controls": __props.listboxId,
1044
+ "aria-activedescendant": __props.activeValue === void 0 ? void 0 : __props.optionId(__props.activeValue),
1045
+ autocomplete: "off",
1046
+ spellcheck: "false",
1047
+ onInput: onSearchInput,
1048
+ onKeydown: _cache[0] || (_cache[0] = ($event) => emit("keydown", $event))
1049
+ }, null, 42, _hoisted_3)], 8, _hoisted_2)) : createCommentVNode("", true),
1050
+ createElementVNode("div", {
1051
+ "data-eldra-scope": unref(eldra).scope,
1052
+ id: __props.listboxId,
1053
+ "data-part": "listbox",
1054
+ role: "listbox",
1055
+ class: normalizeClass(listboxClasses.value),
1056
+ "aria-multiselectable": __props.multiple ? "true" : void 0,
1057
+ "aria-labelledby": __props.labelledBy,
1058
+ "aria-label": __props.fallbackLabel,
1059
+ "aria-busy": __props.loading ? "true" : void 0,
1060
+ onScrollPassive: onListScroll
1061
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.sections, (section, sectionIndex) => {
1062
+ return openBlock(), createElementBlock("div", {
1063
+ key: section.key,
1064
+ "data-part": section.label ? "group" : void 0,
1065
+ role: section.label ? "group" : "presentation",
1066
+ class: normalizeClass(section.label ? unref(groupClass)(__props.classes, sectionIndex) : void 0),
1067
+ "aria-labelledby": section.labelId
1068
+ }, [section.label ? (openBlock(), createElementBlock("div", {
1069
+ key: 0,
1070
+ id: section.labelId,
1071
+ "data-part": "groupLabel",
1072
+ role: "presentation",
1073
+ class: normalizeClass(unref(groupLabelClass)(__props.classes, sectionIndex))
1074
+ }, toDisplayString(section.label), 11, _hoisted_6)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(section.options, (option) => {
1075
+ return openBlock(), createElementBlock("div", {
1076
+ key: option.value,
1077
+ "data-eldra-slot": unref(eldra).slotHost("option", "optionContent"),
1078
+ id: __props.optionId(option.value),
1079
+ "data-part": "option",
1080
+ role: "option",
1081
+ class: normalizeClass(rowClass(option)),
1082
+ "aria-selected": isSelected(option) ? "true" : "false",
1083
+ "aria-disabled": option.disabled ? "true" : void 0,
1084
+ onClick: ($event) => emit("select", option),
1085
+ onMouseenter: ($event) => option.disabled ? void 0 : emit("activate", option.value)
1086
+ }, [renderSlot(_ctx.$slots, "option", {
1087
+ option,
1088
+ selected: isSelected(option),
1089
+ active: isActive(option)
1090
+ }, () => [
1091
+ __props.multiple ? (openBlock(), createElementBlock("span", {
1092
+ key: 0,
1093
+ "data-eldra-scope": unref(eldra).scope,
1094
+ "data-part": "optionCheck",
1095
+ class: normalizeClass(boxClass(option)),
1096
+ "aria-hidden": "true"
1097
+ }, [(openBlock(), createElementBlock("svg", {
1098
+ class: normalizeClass(unref(optionTickClass)(isSelected(option))),
1099
+ viewBox: "0 0 8 8",
1100
+ fill: "none",
1101
+ stroke: "currentColor",
1102
+ "stroke-width": "2",
1103
+ "stroke-linecap": "round",
1104
+ "stroke-linejoin": "round",
1105
+ "aria-hidden": "true",
1106
+ focusable: "false"
1107
+ }, [..._cache[4] || (_cache[4] = [createElementVNode("path", { d: "M1 4l2 2l4 -4" }, null, -1)])], 2))], 10, _hoisted_8)) : createCommentVNode("", true),
1108
+ renderSlot(_ctx.$slots, "optionContent", {
1109
+ option,
1110
+ selected: isSelected(option),
1111
+ active: isActive(option),
1112
+ match: __props.highlights.get(option.value) ?? null
1113
+ }, () => [
1114
+ option.swatch ? (openBlock(), createElementBlock("span", {
1115
+ key: 0,
1116
+ "data-part": "optionSwatch",
1117
+ class: normalizeClass(optionSwatchClasses.value),
1118
+ style: normalizeStyle({ backgroundColor: option.swatch }),
1119
+ "aria-hidden": "true"
1120
+ }, null, 6)) : option.icon ? (openBlock(), createBlock(resolveDynamicComponent(option.icon), {
1121
+ key: 1,
1122
+ "data-eldra-scope": unref(eldra).scope,
1123
+ "data-part": "optionIcon",
1124
+ class: normalizeClass(optionIconClasses.value),
1125
+ "stroke-width": unref(ICON_STROKE_WIDTH),
1126
+ "aria-hidden": "true",
1127
+ focusable: "false"
1128
+ }, null, 8, [
1129
+ "data-eldra-scope",
1130
+ "class",
1131
+ "stroke-width"
1132
+ ])) : createCommentVNode("", true),
1133
+ createElementVNode("span", _hoisted_9, [createElementVNode("span", {
1134
+ "data-part": "optionLabel",
1135
+ class: normalizeClass(unref(optionLabelClass)(__props.classes))
1136
+ }, [__props.highlights.get(option.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1137
+ createTextVNode(toDisplayString(__props.highlights.get(option.value)?.before), 1),
1138
+ createElementVNode("span", _hoisted_10, toDisplayString(__props.highlights.get(option.value)?.match), 1),
1139
+ createTextVNode(toDisplayString(__props.highlights.get(option.value)?.after), 1)
1140
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(option.label), 1)], 64))], 2), option.hint ? (openBlock(), createElementBlock("span", {
1141
+ key: 0,
1142
+ "data-part": "optionHint",
1143
+ class: normalizeClass(optionHintClasses.value)
1144
+ }, toDisplayString(option.hint), 3)) : createCommentVNode("", true)]),
1145
+ option.meta ? (openBlock(), createElementBlock("span", {
1146
+ key: 2,
1147
+ "data-part": "optionMeta",
1148
+ class: normalizeClass(unref(optionMetaClass)(__props.classes, option))
1149
+ }, toDisplayString(option.meta), 3)) : createCommentVNode("", true)
1150
+ ]),
1151
+ !__props.multiple && isSelected(option) ? (openBlock(), createElementBlock("svg", {
1152
+ key: 1,
1153
+ "data-eldra-scope": unref(eldra).scope,
1154
+ "data-part": "optionCheck",
1155
+ class: normalizeClass(optionCheckClasses.value),
1156
+ viewBox: "0 0 24 24",
1157
+ fill: "none",
1158
+ stroke: "currentColor",
1159
+ "stroke-width": "1.75",
1160
+ "stroke-linecap": "round",
1161
+ "stroke-linejoin": "round",
1162
+ "aria-hidden": "true",
1163
+ focusable: "false"
1164
+ }, [..._cache[5] || (_cache[5] = [createElementVNode("path", { d: "M5 12l5 5l10 -10" }, null, -1)])], 10, _hoisted_11)) : createCommentVNode("", true)
1165
+ ])], 42, _hoisted_7);
1166
+ }), 128))], 10, _hoisted_5);
1167
+ }), 128)), __props.createOption ? (openBlock(), createElementBlock("div", {
1168
+ key: 0,
1169
+ role: "presentation",
1170
+ class: normalizeClass(__props.sections.length > 0 ? "eldra:mt-1 eldra:border-t eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))] eldra:pt-1" : void 0)
1171
+ }, [createElementVNode("div", {
1172
+ id: __props.optionId(__props.createOption.value),
1173
+ "data-part": "createOption",
1174
+ role: "option",
1175
+ "aria-selected": "false",
1176
+ class: normalizeClass(createClasses.value),
1177
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("select", __props.createOption)),
1178
+ onMouseenter: _cache[2] || (_cache[2] = ($event) => emit("activate", __props.createOption.value))
1179
+ }, [(openBlock(), createElementBlock("svg", {
1180
+ class: normalizeClass(optionIconClasses.value),
1181
+ viewBox: "0 0 24 24",
1182
+ fill: "none",
1183
+ stroke: "currentColor",
1184
+ "stroke-width": "1.75",
1185
+ "stroke-linecap": "round",
1186
+ "stroke-linejoin": "round",
1187
+ "aria-hidden": "true",
1188
+ focusable: "false"
1189
+ }, [..._cache[6] || (_cache[6] = [createElementVNode("path", { d: "M12 5l0 14" }, null, -1), createElementVNode("path", { d: "M5 12l14 0" }, null, -1)])], 2)), createElementVNode("span", _hoisted_13, toDisplayString(__props.createText), 1)], 42, _hoisted_12)], 2)) : createCommentVNode("", true)], 42, _hoisted_4),
1190
+ __props.loading ? (openBlock(), createElementBlock("div", {
1191
+ key: 1,
1192
+ "data-eldra-slot": unref(eldra).slotHost("loading"),
1193
+ "data-eldra-scope": unref(eldra).scope,
1194
+ "data-part": "loading",
1195
+ role: "status",
1196
+ class: normalizeClass(loadingClasses.value)
1197
+ }, [createVNode(Spinner_default, { class: "eldra:size-4" }), renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(__props.loadingText), 1)])], 10, _hoisted_14)) : !__props.hasOptions ? (openBlock(), createElementBlock("div", {
1198
+ key: 2,
1199
+ "data-eldra-slot": unref(eldra).slotHost("empty"),
1200
+ "data-eldra-scope": unref(eldra).scope,
1201
+ "data-part": "empty",
1202
+ class: normalizeClass(emptyClasses.value)
1203
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText), 1)])], 10, _hoisted_15)) : createCommentVNode("", true),
1204
+ renderSlot(_ctx.$slots, "footer")
1205
+ ], 46, _hoisted_1);
1206
+ };
1207
+ }
1208
+ });
1209
+ // src/components/select/useListbox.ts
1210
+ /** Spec Select → Keyboard, open: "`PageDown` / `PageUp` | Move by 10." */
1211
+ var PAGE = 10;
1212
+ /** Spec Select → Keyboard, closed: "the buffer resets after 0.6s". */
1213
+ var TYPEAHEAD_RESET_MS = 600;
1214
+ /**
1215
+ * Case- and diacritic-insensitive, so the spec's "'island' finds 'Ísland'" holds for type-ahead
1216
+ * and for the search field alike. `NFD` splits a letter from its accent and the range drops the
1217
+ * combining marks that are left.
1218
+ */
1219
+ function normalizeText(text) {
1220
+ return text.normalize("NFD").replaceAll(/[̀-ͯ]/g, "").toLowerCase();
1221
+ }
1222
+ /** A key that types a character, rather than a chord or a named key. */
1223
+ function isPrintable(event) {
1224
+ return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
1225
+ }
1226
+ function clamp(value, min, max) {
1227
+ return value < min ? min : value > max ? max : value;
1228
+ }
1229
+ /**
1230
+ * The keyboard and the active row of a listbox popup — everything in the design spec's Select →
1231
+ * Keyboard tables that is not about *what* choosing a row does.
1232
+ *
1233
+ * It is separate from `Select.vue` on purpose. `MultiSelect` (the next component) has the same two
1234
+ * keyboard tables with three differences — `Enter` toggles instead of choosing-and-closing,
1235
+ * `Space` toggles, and the popup stays open — all of which are the caller's `select` callback and
1236
+ * the caller's decision about closing. Everything else (arrow movement that skips disabled and
1237
+ * filtered-out rows and stops at the ends, `PageUp`/`PageDown` by ten, `Home`/`End` unless a
1238
+ * search field owns them, `Alt+ArrowUp`, `Escape` clearing a query before it closes, `Tab`
1239
+ * closing without a choice, and type-ahead with a 0.6s buffer) is identical, and identical code
1240
+ * that is written twice stops being identical.
1241
+ *
1242
+ * The composable owns no DOM. `aria-activedescendant` is `activeId`, which the caller binds to
1243
+ * whichever element is focused — the trigger when there is no search field, the search field when
1244
+ * there is — and scrolling the active row into view is the caller's, because only the caller knows
1245
+ * which element a value maps to.
1246
+ *
1247
+ * ```ts
1248
+ * const listbox = useListbox({
1249
+ * options: () => visibleOptions.value,
1250
+ * isOpen: () => open.value,
1251
+ * searchable: () => searchable.value,
1252
+ * optionId: (value) => `${id.value}-option-${value}`,
1253
+ * open: (edge) => openPanel(edge),
1254
+ * close: () => closePanel(),
1255
+ * select: (option) => choose(option.value),
1256
+ * });
1257
+ * ```
1258
+ */
1259
+ function useListbox(options) {
1260
+ const activeValue = ref(void 0);
1261
+ const activeId = computed(() => activeValue.value === void 0 ? void 0 : options.optionId(activeValue.value));
1262
+ /** Only enabled rows are reachable: "Arrow keys skip it" (Select → Variants, Disabled option). */
1263
+ const enabled = () => options.options().filter((option) => !option.disabled);
1264
+ const setActive = (value) => {
1265
+ activeValue.value = value;
1266
+ };
1267
+ const first = () => setActive(enabled()[0]?.value);
1268
+ const last = () => setActive(enabled().at(-1)?.value);
1269
+ const activateFrom = (value) => {
1270
+ const rows = enabled();
1271
+ const match = rows.find((option) => option.value === value);
1272
+ setActive((match ?? rows[0])?.value);
1273
+ };
1274
+ const move = (step) => {
1275
+ const rows = enabled();
1276
+ if (rows.length === 0) {
1277
+ setActive(void 0);
1278
+ return;
1279
+ }
1280
+ const index = rows.findIndex((option) => option.value === activeValue.value);
1281
+ if (index === -1) {
1282
+ setActive((step > 0 ? rows[0] : rows.at(-1))?.value);
1283
+ return;
1284
+ }
1285
+ setActive(rows[clamp(index + step, 0, rows.length - 1)]?.value);
1286
+ };
1287
+ const selectActive = () => {
1288
+ const option = options.options().find((row) => row.value === activeValue.value);
1289
+ if (option === void 0 || option.disabled === true) return;
1290
+ options.select(option);
1291
+ };
1292
+ let buffer = "";
1293
+ let timer;
1294
+ const resetTypeahead = () => {
1295
+ buffer = "";
1296
+ if (timer !== void 0) clearTimeout(timer);
1297
+ timer = void 0;
1298
+ };
1299
+ onScopeDispose(resetTypeahead);
1300
+ function typeahead(character, inclusive = false) {
1301
+ buffer += character;
1302
+ if (timer !== void 0) clearTimeout(timer);
1303
+ timer = setTimeout(resetTypeahead, TYPEAHEAD_RESET_MS);
1304
+ const rows = enabled();
1305
+ if (rows.length === 0) return;
1306
+ const prefix = normalizeText(buffer);
1307
+ const current = rows.findIndex((option) => option.value === activeValue.value);
1308
+ const from = buffer.length === 1 && !inclusive ? current + 1 : Math.max(current, 0);
1309
+ for (let step = 0; step < rows.length; step += 1) {
1310
+ const option = rows[(from + step + rows.length) % rows.length];
1311
+ if (option !== void 0 && normalizeText(option.label).startsWith(prefix)) {
1312
+ setActive(option.value);
1313
+ return;
1314
+ }
1315
+ }
1316
+ }
1317
+ function onClosedKeydown(event) {
1318
+ switch (event.key) {
1319
+ case "ArrowDown":
1320
+ case "Enter":
1321
+ case " ":
1322
+ event.preventDefault();
1323
+ options.open("start");
1324
+ return;
1325
+ case "ArrowUp":
1326
+ event.preventDefault();
1327
+ options.open(options.searchable() ? "start" : "end");
1328
+ return;
1329
+ case "Backspace":
1330
+ case "Delete":
1331
+ if (options.clear?.() === true) event.preventDefault();
1332
+ return;
1333
+ default:
1334
+ if (!isPrintable(event)) return;
1335
+ event.preventDefault();
1336
+ options.open("start");
1337
+ if (options.searchable()) options.startQuery?.(event.key);
1338
+ else typeahead(event.key, true);
1339
+ }
1340
+ }
1341
+ function onOpenKeydown(event) {
1342
+ switch (event.key) {
1343
+ case "ArrowDown":
1344
+ event.preventDefault();
1345
+ move(1);
1346
+ return;
1347
+ case "ArrowUp":
1348
+ event.preventDefault();
1349
+ if (event.altKey) selectActive();
1350
+ else move(-1);
1351
+ return;
1352
+ case "PageDown":
1353
+ event.preventDefault();
1354
+ move(PAGE);
1355
+ return;
1356
+ case "PageUp":
1357
+ event.preventDefault();
1358
+ move(-10);
1359
+ return;
1360
+ case "Home":
1361
+ if (options.searchable()) return;
1362
+ event.preventDefault();
1363
+ first();
1364
+ return;
1365
+ case "End":
1366
+ if (options.searchable()) return;
1367
+ event.preventDefault();
1368
+ last();
1369
+ return;
1370
+ case "Enter":
1371
+ event.preventDefault();
1372
+ selectActive();
1373
+ return;
1374
+ case " ":
1375
+ if (options.searchable()) return;
1376
+ event.preventDefault();
1377
+ selectActive();
1378
+ return;
1379
+ case "Escape":
1380
+ if (options.escape?.() !== true) return;
1381
+ event.preventDefault();
1382
+ event.stopPropagation();
1383
+ return;
1384
+ case "Tab":
1385
+ options.close();
1386
+ return;
1387
+ default:
1388
+ if (options.searchable() || !isPrintable(event)) return;
1389
+ event.preventDefault();
1390
+ typeahead(event.key);
1391
+ }
1392
+ }
1393
+ function onKeydown(event) {
1394
+ if (event.defaultPrevented) return;
1395
+ if (options.isOpen()) {
1396
+ onOpenKeydown(event);
1397
+ return;
1398
+ }
1399
+ if (options.canOpen?.() === false) return;
1400
+ onClosedKeydown(event);
1401
+ }
1402
+ return {
1403
+ activeValue,
1404
+ activeId,
1405
+ setActive,
1406
+ activateFrom,
1407
+ first,
1408
+ last,
1409
+ move,
1410
+ selectActive,
1411
+ onKeydown,
1412
+ resetTypeahead
1413
+ };
1414
+ }
1415
+ // src/components/select/useOptionList.ts
1416
+ /**
1417
+ * Where a query matches inside a label, in **code points of the original string**.
1418
+ *
1419
+ * Matching is case- and diacritic-insensitive (the spec's "'island' finds 'Ísland'"), so the
1420
+ * comparison happens on a normalised copy — and the match has to be reported back in the original
1421
+ * string's own offsets, or the bold-and-underlined run would land on the wrong characters for any
1422
+ * label holding an accent. Hence the per-character walk: each original code point contributes zero
1423
+ * (a combining mark) or more normalised characters, and `positions` maps back.
1424
+ */
1425
+ function matchRange(label, rawQuery) {
1426
+ const needle = normalizeText(rawQuery);
1427
+ if (needle === "") return null;
1428
+ const characters = [...label];
1429
+ const positions = [];
1430
+ let normalized = "";
1431
+ for (const [index, character] of characters.entries()) {
1432
+ const piece = normalizeText(character);
1433
+ for (let step = 0; step < piece.length; step += 1) positions.push(index);
1434
+ normalized += piece;
1435
+ }
1436
+ const at = normalized.indexOf(needle);
1437
+ if (at === -1) return null;
1438
+ return {
1439
+ start: positions[at] ?? 0,
1440
+ end: (positions[at + needle.length - 1] ?? characters.length - 1) + 1
1441
+ };
1442
+ }
1443
+ /**
1444
+ * Options bucketed by `group`, in the order each group first appears — so a "Most used" group
1445
+ * written first stays first, which is exactly the spec's advice ("Put the 3 to 5 most likely
1446
+ * answers first"). Options with no `group` form an unlabelled section of their own.
1447
+ */
1448
+ function groupOptions(list, idPrefix, controlId) {
1449
+ const order = [];
1450
+ const buckets = /* @__PURE__ */ new Map();
1451
+ for (const option of list) {
1452
+ const key = option.group ?? "";
1453
+ let bucket = buckets.get(key);
1454
+ if (bucket === void 0) {
1455
+ bucket = [];
1456
+ buckets.set(key, bucket);
1457
+ order.push(key);
1458
+ }
1459
+ bucket.push(option);
1460
+ }
1461
+ return order.map((key, index) => ({
1462
+ key: key === "" ? `${idPrefix}-plain-${index}` : `${idPrefix}-group-${key}`,
1463
+ label: key === "" ? void 0 : key,
1464
+ labelId: key === "" ? void 0 : `${controlId}-g${index}`,
1465
+ options: buckets.get(key) ?? []
1466
+ }));
1467
+ }
1468
+ /**
1469
+ * The value of the "Create “query”" row a `creatable` control appends. A control character no
1470
+ * merchant value holds, so it never collides with an option's own value.
1471
+ */
1472
+ var CREATE_VALUE = "\0eldra-create";
1473
+ /**
1474
+ * The list a select panel shows: filtering, grouping, match highlighting, the create row and the
1475
+ * render batch.
1476
+ *
1477
+ * Shared by `Select` and `MultiSelect`, which differ in what choosing a row *does* and in nothing
1478
+ * about which rows there are. No DOM; its one piece of state is how many rows are rendered.
1479
+ */
1480
+ function useOptionList(options) {
1481
+ const trimmedQuery = computed(() => options.searchable() ? options.query().trim() : "");
1482
+ const loading = computed(() => options.loading?.() === true);
1483
+ /**
1484
+ * The options a query leaves, in the consumer's order. Not returned: every caller wants them
1485
+ * bucketed (`sections`) or in DOM order (`listOptions`), and a third view of the same list would
1486
+ * only be a way to disagree with those two.
1487
+ */
1488
+ const visibleOptions = computed(() => {
1489
+ if (loading.value) return [];
1490
+ const trimmed = trimmedQuery.value;
1491
+ if (trimmed === "") return options.options();
1492
+ const needle = normalizeText(trimmed);
1493
+ return options.options().filter((option) => matchRange(option.label, trimmed) !== null || option.keywords?.some((keyword) => normalizeText(keyword).includes(needle)) === true);
1494
+ });
1495
+ /** Every visible option in DOM order, before the render batch cuts it. */
1496
+ const orderedOptions = computed(() => groupOptions(visibleOptions.value, "panel", options.controlId()).flatMap((section) => section.options));
1497
+ const batchSize = () => {
1498
+ const size = options.renderBatch?.();
1499
+ return size === void 0 || !(size >= 1) ? Number.POSITIVE_INFINITY : Math.floor(size);
1500
+ };
1501
+ const rendered = ref(batchSize());
1502
+ const resetBatch = () => {
1503
+ rendered.value = batchSize();
1504
+ };
1505
+ const renderMore = () => {
1506
+ if (rendered.value < orderedOptions.value.length) rendered.value += batchSize();
1507
+ };
1508
+ const reveal = (value) => {
1509
+ if (value === void 0 || !Number.isFinite(rendered.value)) return;
1510
+ const index = orderedOptions.value.findIndex((option) => option.value === value);
1511
+ if (index < rendered.value) return;
1512
+ const size = batchSize();
1513
+ rendered.value = Math.ceil((index + 1) / size) * size;
1514
+ };
1515
+ watch(trimmedQuery, resetBatch);
1516
+ watch(() => options.renderBatch?.(), resetBatch);
1517
+ const renderedOptions = computed(() => Number.isFinite(rendered.value) ? orderedOptions.value.slice(0, rendered.value) : orderedOptions.value);
1518
+ const sections = computed(() => groupOptions(renderedOptions.value, "panel", options.controlId()));
1519
+ const nativeSections = computed(() => groupOptions(options.options(), "native", options.controlId()));
1520
+ /**
1521
+ * Spec-free addition: a query no option's label already equals can be offered as a new option.
1522
+ * Equal ignoring case and accents, the same comparison the search itself makes, so "Shirt" is
1523
+ * not offered beside an existing "shirt".
1524
+ */
1525
+ const createOption = computed(() => {
1526
+ const trimmed = trimmedQuery.value;
1527
+ if (options.creatable?.() !== true || loading.value || trimmed === "") return void 0;
1528
+ const needle = normalizeText(trimmed);
1529
+ if (options.options().some((option) => normalizeText(option.label) === needle)) return;
1530
+ return {
1531
+ value: CREATE_VALUE,
1532
+ label: trimmed
1533
+ };
1534
+ });
1535
+ const listOptions = computed(() => createOption.value === void 0 ? orderedOptions.value : [...orderedOptions.value, createOption.value]);
1536
+ return {
1537
+ sections,
1538
+ nativeSections,
1539
+ listOptions,
1540
+ hasOptions: computed(() => listOptions.value.length > 0),
1541
+ highlights: computed(() => {
1542
+ const trimmed = trimmedQuery.value;
1543
+ return new Map(renderedOptions.value.map((option) => {
1544
+ const range = trimmed === "" ? null : matchRange(option.label, trimmed);
1545
+ if (range === null) return [option.value, null];
1546
+ const characters = [...option.label];
1547
+ return [option.value, {
1548
+ before: characters.slice(0, range.start).join(""),
1549
+ match: characters.slice(range.start, range.end).join(""),
1550
+ after: characters.slice(range.end).join("")
1551
+ }];
1552
+ }));
1553
+ }),
1554
+ createOption,
1555
+ renderMore,
1556
+ reveal,
1557
+ resetBatch
1558
+ };
1559
+ }
1560
+ // src/composables/useFloating.ts
1561
+ /** What each of the spec's two named placements means to `@floating-ui/dom`. */
1562
+ var RESOLVED = {
1563
+ auto: {
1564
+ placement: "bottom-start",
1565
+ flip: true
1566
+ },
1567
+ above: {
1568
+ placement: "top-start",
1569
+ flip: false
1570
+ },
1571
+ bottom: {
1572
+ placement: "bottom",
1573
+ flip: true
1574
+ },
1575
+ "bottom-start": {
1576
+ placement: "bottom-start",
1577
+ flip: true
1578
+ },
1579
+ "bottom-end": {
1580
+ placement: "bottom-end",
1581
+ flip: true
1582
+ },
1583
+ top: {
1584
+ placement: "top",
1585
+ flip: true
1586
+ },
1587
+ "top-start": {
1588
+ placement: "top-start",
1589
+ flip: true
1590
+ },
1591
+ "top-end": {
1592
+ placement: "top-end",
1593
+ flip: true
1594
+ },
1595
+ left: {
1596
+ placement: "left",
1597
+ flip: true
1598
+ },
1599
+ "left-start": {
1600
+ placement: "left-start",
1601
+ flip: true
1602
+ },
1603
+ "left-end": {
1604
+ placement: "left-end",
1605
+ flip: true
1606
+ },
1607
+ right: {
1608
+ placement: "right",
1609
+ flip: true
1610
+ },
1611
+ "right-start": {
1612
+ placement: "right-start",
1613
+ flip: true
1614
+ },
1615
+ "right-end": {
1616
+ placement: "right-end",
1617
+ flip: true
1618
+ }
1619
+ };
1620
+ /**
1621
+ * Positions a floating panel against the element that opened it — the one piece of every popup in
1622
+ * this package that has to measure the page.
1623
+ *
1624
+ * It is a thin wrap of `@floating-ui/vue`: `autoUpdate` keeps the position current while both
1625
+ * elements are mounted (scrolling, resizing, an ancestor moving), `offset` sets the gap, `flip`
1626
+ * turns the panel above the trigger when there is no room below, `shift` keeps it inside the
1627
+ * viewport, and `size` measures the trigger for `matchWidth` (a floor on the panel's width — the
1628
+ * spec lets a select's panel grow past its trigger up to its own `max-width` — or a floor and a
1629
+ * ceiling under `'exact'`). What the wrap adds is the design spec's vocabulary (`auto` / `above`)
1630
+ * and a plain style object rather than a transform, so a consumer writes `<div :style="styles">`
1631
+ * and nothing else.
1632
+ *
1633
+ * `top` and `left` are used instead of the default `transform`, because a panel positioned by
1634
+ * transform is blurry on fractional pixels and, more to the point, cannot then use `transform` for
1635
+ * the spec's own open animation (fade + 0.25rem slide + a vertical scale from the top edge).
1636
+ *
1637
+ * ```ts
1638
+ * const trigger = ref<HTMLElement | null>(null);
1639
+ * const panel = ref<HTMLElement | null>(null);
1640
+ * const { styles, placement } = useFloating(trigger, panel, { matchWidth: true });
1641
+ * ```
1642
+ *
1643
+ * The reference may be a Floating UI **virtual element** (`{ getBoundingClientRect() }`), for a
1644
+ * panel anchored to a caret or a pointer position rather than to a node; call `update()` after it
1645
+ * moves, since nothing observes a virtual element's geometry.
1646
+ */
1647
+ function useFloating$1(reference, floating, options = {}) {
1648
+ const resolved = computed(() => RESOLVED[toValue(options.placement) ?? "auto"]);
1649
+ const exactWidth = options.matchWidth === "exact";
1650
+ const matchWidth = options.matchWidth === true || exactWidth;
1651
+ const referenceWidth = ref(0);
1652
+ const middleware = computed(() => {
1653
+ const list = [offset(toValue(options.offset) ?? 4)];
1654
+ if (options.flip ?? resolved.value.flip) list.push(flip());
1655
+ list.push(shift({ padding: toValue(options.padding) ?? 8 }));
1656
+ if (matchWidth) list.push(size({ apply({ rects }) {
1657
+ referenceWidth.value = rects.reference.width;
1658
+ } }));
1659
+ return list;
1660
+ });
1661
+ const position = useFloating(reference, floating, {
1662
+ placement: computed(() => resolved.value.placement),
1663
+ strategy: options.strategy ?? "absolute",
1664
+ transform: false,
1665
+ middleware,
1666
+ whileElementsMounted: autoUpdate
1667
+ });
1668
+ return {
1669
+ styles: computed(() => {
1670
+ const base = {
1671
+ position: position.strategy.value,
1672
+ left: `${position.x.value}px`,
1673
+ top: `${position.y.value}px`
1674
+ };
1675
+ if (matchWidth) base.minWidth = `${referenceWidth.value}px`;
1676
+ if (exactWidth) base.maxWidth = `${referenceWidth.value}px`;
1677
+ return base;
1678
+ }),
1679
+ placement: computed(() => position.placement.value),
1680
+ update: position.update
1681
+ };
1682
+ }
1683
+ // src/composables/teleportTarget.ts
1684
+ /**
1685
+ * Whether an element is a dialog the browser has put in its **top layer**.
1686
+ *
1687
+ * `:modal` is the only way to ask: a `<dialog>` has the `open` attribute whether it was shown with
1688
+ * `show()` (an ordinary in-flow element, which clips and stacks like any other) or with
1689
+ * `showModal()` (top layer, above every z-index, with a backdrop), and nothing else in the DOM
1690
+ * tells the two apart. Engines that do not implement `:modal` answer `false` here — happy-dom
1691
+ * parses the selector and never matches it, jsdom does not implement `<dialog>` modality at all —
1692
+ * which is what the caller's fallback is for.
1693
+ *
1694
+ * Wrapped in a `try`: a selector an engine cannot parse is a `SyntaxError`, not a `false`.
1695
+ */
1696
+ function isTopLayer(element) {
1697
+ try {
1698
+ return element.matches(":modal");
1699
+ } catch {
1700
+ return false;
1701
+ }
1702
+ }
1703
+ /**
1704
+ * The `<dialog>` a popup anchored to `anchor` has to be teleported *into* rather than escape, or
1705
+ * `null` when there is none.
1706
+ *
1707
+ * A **modal** dialog is the one place `document.body` is the wrong target: the dialog is in the top
1708
+ * layer, so a popup on the body would be painted behind it and no `z-index` could raise it. So the
1709
+ * nearest open ancestor dialog that is actually in the top layer wins — which is not always the
1710
+ * nearest one, since a non-modal `<dialog open>` may sit inside a modal one.
1711
+ *
1712
+ * When **no** ancestor dialog claims the top layer, the nearest open one is still the answer. That
1713
+ * case is ambiguous — either they really are all non-modal, or the engine does not implement
1714
+ * `:modal` and cannot say — and the two mistakes are not equally bad. Teleporting into a dialog
1715
+ * that did not need it still escapes everything between the control and that dialog, and the
1716
+ * dialog is a box the popup had no business overflowing anyway; teleporting to `body` out of a
1717
+ * dialog that *was* modal puts the popup behind it, invisibly, which is the very bug this whole
1718
+ * mechanism exists to fix. There is no engine-independent probe to break the tie —
1719
+ * `CSS.supports('selector(:modal)')` answers `true` for nonsense in happy-dom — so the safe
1720
+ * mistake is the one taken. A non-modal `<dialog open>` is in any case close to hypothetical here:
1721
+ * the design spec's non-negotiable 2 opens every modal surface with `showModal()`, and says the
1722
+ * non-modal popups are not dialogs at all.
1723
+ */
1724
+ function topLayerDialog(anchor) {
1725
+ const nearest = anchor.closest("dialog[open]");
1726
+ if (nearest === null) return null;
1727
+ for (let dialog = nearest; dialog !== null; dialog = dialog.parentElement?.closest("dialog[open]") ?? null) if (isTopLayer(dialog)) return dialog;
1728
+ return nearest;
1729
+ }
1730
+ /**
1731
+ * Where a teleported popup is rendered: `usePopover`'s and `Tooltip`'s shared answer to "escape
1732
+ * clipping and stacking, but not the browser's own top layer."
1733
+ *
1734
+ * A panel (or bubble) rendered inside its own control is at the mercy of everything above it: an
1735
+ * ancestor with `overflow: hidden` (a card, a table cell, a carousel track) clips it, and any later
1736
+ * sibling that starts a stacking context (a sticky header with a `z-index`, a section with
1737
+ * `isolate`) paints over it however high its own `z-index` is. On `body` neither can happen — except
1738
+ * for a native `<dialog>` opened with `showModal()`, which renders in the top layer above every
1739
+ * `z-index` on the page, so a popup teleported to `body` out from under one would be invisible
1740
+ * behind it. `topLayerDialog` is the one exception that rule needs.
1741
+ *
1742
+ * ```ts
1743
+ * const isOpen = ref(false);
1744
+ * const trigger = ref<HTMLElement | null>(null);
1745
+ * const { teleportTo, teleportDisabled } = useTeleportTarget({ trigger, teleport: true, isOpen });
1746
+ * ```
1747
+ */
1748
+ function useTeleportTarget(options) {
1749
+ const { trigger, teleport, isOpen } = options;
1750
+ /**
1751
+ * Only `true` after `onMounted`, which never runs on the server. Everything that reads the
1752
+ * document below is behind it.
1753
+ */
1754
+ const isMounted = ref(false);
1755
+ onMounted(() => {
1756
+ isMounted.value = true;
1757
+ });
1758
+ const teleportDisabled = computed(() => teleport === false || !isMounted.value);
1759
+ return {
1760
+ teleportTo: computed(() => {
1761
+ if (!isMounted.value) return "body";
1762
+ if (typeof teleport === "string") return teleport;
1763
+ isOpen.value;
1764
+ const anchor = trigger.value;
1765
+ return (anchor === null ? null : topLayerDialog(anchor)) ?? document.body;
1766
+ }),
1767
+ teleportDisabled
1768
+ };
1769
+ }
1770
+ // src/composables/useOverlay.ts
1771
+ /**
1772
+ * Anything the platform lets a user reach with `Tab`, plus the elements a component has opted in
1773
+ * with a `tabindex`. `tabindex="-1"` is deliberately excluded: it is programmatically focusable,
1774
+ * not part of the sequence a keyboard user walks, and `focusFirst()` exists to put focus where a
1775
+ * user would have put it themselves.
1776
+ */
1777
+ var FOCUSABLE = "a[href], area[href], button, input, select, textarea, details > summary:first-of-type, iframe, audio[controls], video[controls], [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex^=\"-\"])";
1778
+ /**
1779
+ * Marks an element that belongs to an overlay whose content element has this `id`.
1780
+ *
1781
+ * Exported for `usePopover`, which has to find those elements rather than only recognise one it is
1782
+ * handed: a teleported panel's `Tab` walk runs through them (see its `tabRedirect` option).
1783
+ */
1784
+ var OVERLAY_OWNER_ATTRIBUTE = "data-eldra-overlay-owner";
1785
+ var read = (setting, fallback) => setting === void 0 ? fallback : typeof setting === "function" ? setting() : setting;
1786
+ /**
1787
+ * The closing and focus rules shared by every **non-modal** popup in this package — the Select and
1788
+ * Multi-select panels, the Search bar's results panel, menus.
1789
+ *
1790
+ * Non-modal is the whole point. The design spec's non-negotiables put every *modal* surface in a
1791
+ * native `<dialog>` opened with `showModal()`, and say in the same breath that these popups are not
1792
+ * dialogs: "Non-modal popups (select panels, search results panel, mega-menus, tooltips) are **not**
1793
+ * dialogs." So there is no focus trap here and no `Tab` cycling — `Tab` simply moves on, and focus
1794
+ * landing outside is what closes the popup (WCAG 2.1.2: no keyboard trap). Everything this
1795
+ * composable does is close at the right moment and leave focus somewhere sensible.
1796
+ *
1797
+ * What it listens for, and only while `open` is `true`:
1798
+ *
1799
+ * - **A pointer press outside** (`pointerdown`, captured, so a handler inside the page that stops
1800
+ * propagation cannot hide the press from us). Inside is the trigger, the content, and anything
1801
+ * under an element carrying `data-eldra-overlay-owner="<the content's id>"` — which is how a
1802
+ * panel rendered through a `<Teleport>` still counts as part of the overlay. Closing this way
1803
+ * never moves focus: the user is pressing something else, and pulling focus back to the trigger
1804
+ * would take it off whatever they just pressed.
1805
+ * - **Focus leaving** (`focusout`). If the new focus owner is outside the overlay, the popup
1806
+ * closes and focus stays where the user sent it. If focus went *nowhere* (`relatedTarget` is
1807
+ * `null` — the content is about to be removed from under it), `returnFocus` puts it back on the
1808
+ * trigger rather than letting it fall to `<body>`.
1809
+ * - **`Escape`** (`keydown`, bubbling, so a component that wants the first go at `Escape` — the
1810
+ * Select clears its search query before it closes — can handle it and stop propagation). It
1811
+ * closes, returns focus to the trigger, and both `preventDefault()`s and stops propagation: a
1812
+ * popup inside a native `<dialog>` must consume the key, or the dialog closes behind it.
1813
+ *
1814
+ * Listeners go on `document` when the overlay opens and come off when it closes or the scope is
1815
+ * disposed, so a closed overlay costs nothing and an unmounted one leaves nothing behind. Nothing
1816
+ * touches the DOM during SSR.
1817
+ *
1818
+ * ```ts
1819
+ * const open = ref(false);
1820
+ * const trigger = ref<HTMLElement | null>(null);
1821
+ * const content = ref<HTMLElement | null>(null);
1822
+ * const overlay = useOverlay({ open, trigger, content, setOpen: (next) => (open.value = next) });
1823
+ * ```
1824
+ */
1825
+ function useOverlay(options) {
1826
+ const { open, trigger, content, setOpen } = options;
1827
+ const closeOnOutsideClick = () => read(options.closeOnOutsideClick, true);
1828
+ const closeOnFocusOutside = () => read(options.closeOnFocusOutside, closeOnOutsideClick());
1829
+ const closeOnEscape = () => read(options.closeOnEscape, true);
1830
+ const returnFocus = () => read(options.returnFocus, true);
1831
+ const focusables = (from) => {
1832
+ const root = from === void 0 ? content.value : from;
1833
+ if (!root) return [];
1834
+ return [root, ...root.querySelectorAll(FOCUSABLE)].filter((element) => element.matches(FOCUSABLE) && element.tabIndex >= 0 && !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true" && element.closest("[hidden]") === null);
1835
+ };
1836
+ const focusFirst = () => {
1837
+ focusables()[0]?.focus();
1838
+ };
1839
+ const close = () => setOpen(false);
1840
+ /**
1841
+ * A teleported part of the overlay is in the DOM somewhere else entirely, so containment says
1842
+ * nothing about it. It is claimed one of two ways, both followed transitively:
1843
+ *
1844
+ * - **An owner marker**: an ancestor carrying `data-eldra-overlay-owner` names the content's id —
1845
+ * or the id of any element that is itself inside this overlay, so a picker teleported out of a
1846
+ * panel can point at the field inside the panel it belongs to.
1847
+ * - **An open control inside the overlay**: an element with `aria-expanded="true"` inside this
1848
+ * overlay names, in `aria-controls`, an element in the node's popup — the owner-marked panel
1849
+ * that element sits in, or the element itself. That is a nested popup (a `Select` or another
1850
+ * `Popover` opened from this panel) whose own panel is teleported too.
1851
+ *
1852
+ * Walked by hand rather than through selectors so an id with a character CSS would have to
1853
+ * escape cannot break the check.
1854
+ */
1855
+ const isInside = (node, visited = /* @__PURE__ */ new Set()) => {
1856
+ if (!(node instanceof Node) || visited.has(node)) return false;
1857
+ visited.add(node);
1858
+ if (trigger.value?.contains(node) === true) return true;
1859
+ if (content.value?.contains(node) === true) return true;
1860
+ const id = content.value?.id;
1861
+ if (id === void 0 || id === "" || typeof document === "undefined") return false;
1862
+ for (let element = node instanceof Element ? node : node.parentElement; element !== null; element = element.parentElement) {
1863
+ const owner = element.getAttribute(OVERLAY_OWNER_ATTRIBUTE);
1864
+ if (owner === id) return true;
1865
+ if (owner === null || owner === "") continue;
1866
+ const named = document.getElementById(owner);
1867
+ if (named !== null && !named.contains(element) && isInside(named, visited)) return true;
1868
+ }
1869
+ for (const control of document.querySelectorAll("[aria-controls]")) {
1870
+ if (control.getAttribute("aria-expanded") !== "true" || control.contains(node)) continue;
1871
+ for (const controlled of (control.getAttribute("aria-controls") ?? "").split(/\s+/)) {
1872
+ const target = controlled === "" ? null : document.getElementById(controlled);
1873
+ if (target === null) continue;
1874
+ const popup = target.closest(`[data-eldra-overlay-owner]`) ?? target;
1875
+ if (!popup.contains(node) || popup.contains(control)) continue;
1876
+ if (isInside(control, visited)) return true;
1877
+ }
1878
+ }
1879
+ return false;
1880
+ };
1881
+ const onPointerDown = (event) => {
1882
+ if (!open.value || !closeOnOutsideClick() || isInside(event.target)) return;
1883
+ close();
1884
+ };
1885
+ const onFocusOut = (event) => {
1886
+ if (!open.value || !closeOnFocusOutside()) return;
1887
+ if (!isInside(event.target)) return;
1888
+ const next = event.relatedTarget;
1889
+ if (isInside(next)) return;
1890
+ close();
1891
+ if (returnFocus() && next === null) trigger.value?.focus();
1892
+ };
1893
+ const onKeyDown = (event) => {
1894
+ if (!open.value || event.key !== "Escape" || !closeOnEscape()) return;
1895
+ event.preventDefault();
1896
+ event.stopPropagation();
1897
+ close();
1898
+ if (returnFocus()) trigger.value?.focus();
1899
+ };
1900
+ let listening = false;
1901
+ const attach = () => {
1902
+ if (listening || typeof document === "undefined") return;
1903
+ listening = true;
1904
+ document.addEventListener("pointerdown", onPointerDown, true);
1905
+ document.addEventListener("focusout", onFocusOut);
1906
+ document.addEventListener("keydown", onKeyDown);
1907
+ };
1908
+ const detach = () => {
1909
+ if (!listening) return;
1910
+ listening = false;
1911
+ document.removeEventListener("pointerdown", onPointerDown, true);
1912
+ document.removeEventListener("focusout", onFocusOut);
1913
+ document.removeEventListener("keydown", onKeyDown);
1914
+ };
1915
+ watch(open, (isOpen) => isOpen ? attach() : detach(), { immediate: true });
1916
+ onScopeDispose(detach);
1917
+ return {
1918
+ close,
1919
+ focusFirst,
1920
+ focusables,
1921
+ isInside: (node) => isInside(node)
1922
+ };
1923
+ }
1924
+ // src/components/select/openRegistry.ts
1925
+ /**
1926
+ * The open popups, outermost first. Without nesting it never holds more than one entry; a popup
1927
+ * opened from inside another's panel is stacked on it instead of closing it.
1928
+ */
1929
+ var stack = [];
1930
+ /**
1931
+ * Claim the slot and close whatever held it — except the popups the new one is nested in.
1932
+ *
1933
+ * The slot is reassigned *before* the previous popups are closed, so the `unregisterOpen` that
1934
+ * closing triggers sees a slot that is no longer its own and leaves the new owner alone.
1935
+ */
1936
+ function registerOpen(close, options = {}) {
1937
+ if (stack.at(-1)?.close === close) return;
1938
+ const { anchor } = options;
1939
+ const kept = [];
1940
+ const closed = [];
1941
+ for (const entry of stack) {
1942
+ if (entry.close === close) continue;
1943
+ (anchor !== void 0 && anchor !== null && entry.contains?.(anchor) === true ? kept : closed).push(entry);
1944
+ }
1945
+ stack = [...kept, {
1946
+ close,
1947
+ contains: options.contains
1948
+ }];
1949
+ for (const entry of closed) entry.close();
1950
+ }
1951
+ /** Release the slot, if it is still this popup's. */
1952
+ function unregisterOpen(close) {
1953
+ stack = stack.filter((entry) => entry.close !== close);
1954
+ }
1955
+ // src/components/select/usePopover.ts
1956
+ /**
1957
+ * The open/closed life of a **non-modal popup** anchored to a control: `Select`'s panel,
1958
+ * `MultiSelect`'s, and the `SearchBar`'s results panel.
1959
+ *
1960
+ * Every one of them needs the same six things, and before this composable the first two controls
1961
+ * held a line-identical copy of all of them:
1962
+ *
1963
+ * - **"Only one open at a time"** (`openRegistry`): opening claims a module-level slot and closes
1964
+ * whatever held it. The handle is stable per instance, so a late close cannot blank out the
1965
+ * popup that took its place.
1966
+ * - **Closing** (`useOverlay`): an outside pointer press, focus leaving, `Escape`. Non-modal, so
1967
+ * nothing is trapped and `Tab` always moves on.
1968
+ * - **Getting out of the way of the page** (`teleport`): the panel is rendered through a
1969
+ * `<Teleport>` to `body` — or to the modal `<dialog>` the trigger is in, which is the one place
1970
+ * `body` would be *behind* — and positioned with floating-ui's `fixed` strategy, so no ancestor's
1971
+ * `overflow: hidden` clips it and no later stacking context paints over it. `tabRedirect` puts a
1972
+ * panel that has real tab stops back into the `Tab` walk it left with its place in the DOM.
1973
+ * - **Positioning** (`useFloating`), plus the `--eldra-popover-origin` the entrance keyframes read,
1974
+ * so a panel that flips after floating-ui measures changes a custom property rather than its
1975
+ * `animation-name` (which would replay the entrance).
1976
+ * - **The open sequence**: open, make a row active, and — only when the call actually changed the
1977
+ * state — run `afterOpen` a tick later, which is where focus moves into the panel.
1978
+ * - **The label-forwarded-click latch**: a `<label for>` naming the trigger forwards its click to
1979
+ * it, and the spec is explicit that clicking a field's label focuses the control **without**
1980
+ * opening it. A forwarded click differs from a real one in that no pointer was pressed on the
1981
+ * trigger and its `detail` is 0. The latch is armed on `pointerdown` and released on the
1982
+ * `pointerup` or `pointercancel` that follows, wherever it lands: a press that ends off the
1983
+ * trigger (a drag, a cancelled touch) would otherwise leave the latch standing and arm the
1984
+ * *next* click. A programmatic `element.click()` has the same shape, so it is told apart by what
1985
+ * it is not (see `isProgrammaticClick`): not forwarded from a label clicked in the same task,
1986
+ * not trusted, and a `PointerEvent`, which is what `click()` dispatches.
1987
+ *
1988
+ * What stays with each control is what actually differs: which rows there are, what choosing one
1989
+ * does, and which element the popup is anchored to.
1990
+ */
1991
+ /**
1992
+ * The control a `<label>` click is about to forward to, until the task that clicked it ends. A
1993
+ * label's activation behaviour fires its forwarded click synchronously after its own click's
1994
+ * dispatch, so a capture listener on `document` sees the label's click first. One listener for the
1995
+ * whole page, attached on first use in a browser.
1996
+ */
1997
+ var forwardingTo = null;
1998
+ var labelWatcherAttached = false;
1999
+ function watchLabelClicks() {
2000
+ if (labelWatcherAttached || typeof document === "undefined") return;
2001
+ labelWatcherAttached = true;
2002
+ document.addEventListener("click", (event) => {
2003
+ const target = event.target;
2004
+ if (!(target instanceof Element)) return;
2005
+ const control = target.closest("label")?.control ?? null;
2006
+ if (!(control instanceof HTMLElement) || control.contains(target)) return;
2007
+ forwardingTo = control;
2008
+ setTimeout(() => {
2009
+ if (forwardingTo === control) forwardingTo = null;
2010
+ }, 0);
2011
+ }, true);
2012
+ }
2013
+ /**
2014
+ * Whether a click with no pointer press behind it came from code (`trigger.click()`) rather than a
2015
+ * `<label>` forwarding its own: not forwarded from a label clicked in this task, untrusted (a
2016
+ * user's label click forwards a trusted one), and a `PointerEvent`, which is what `click()`
2017
+ * dispatches. A bare `dispatchEvent(new MouseEvent('click'))` keeps counting as forwarded, as it
2018
+ * always has; so does every click in an engine whose `click()` still sends a `MouseEvent`.
2019
+ */
2020
+ function isProgrammaticClick(event, trigger) {
2021
+ if (trigger !== null && forwardingTo !== null && trigger.contains(forwardingTo)) return false;
2022
+ return !event.isTrusted && typeof PointerEvent !== "undefined" && event instanceof PointerEvent;
2023
+ }
2024
+ function usePopover(options) {
2025
+ const { trigger, content } = options;
2026
+ watchLabelClicks();
2027
+ const canOpen = () => options.canOpen?.() !== false;
2028
+ const isOpen = ref(false);
2029
+ const isExclusive = () => {
2030
+ const setting = options.exclusive ?? true;
2031
+ return typeof setting === "function" ? setting() : setting;
2032
+ };
2033
+ /** The `anchor`, when it is a real element rather than a virtual one. */
2034
+ const anchorElement = () => {
2035
+ const anchor = options.anchor?.value ?? null;
2036
+ return typeof HTMLElement !== "undefined" && anchor instanceof HTMLElement ? anchor : null;
2037
+ };
2038
+ /** The registry's handle on this popup. Stable, so the registry can tell ours from another's. */
2039
+ const closeFromRegistry = () => setOpen(false);
2040
+ function setOpen(next) {
2041
+ if (next === isOpen.value) return;
2042
+ if (next) {
2043
+ if (!canOpen()) return;
2044
+ isOpen.value = true;
2045
+ if (isExclusive()) registerOpen(closeFromRegistry, {
2046
+ anchor: trigger.value ?? anchorElement(),
2047
+ contains: (node) => overlay.isInside(node)
2048
+ });
2049
+ options.onOpen?.();
2050
+ return;
2051
+ }
2052
+ isOpen.value = false;
2053
+ unregisterOpen(closeFromRegistry);
2054
+ options.onClose?.();
2055
+ }
2056
+ const overlay = useOverlay({
2057
+ open: isOpen,
2058
+ trigger,
2059
+ content,
2060
+ setOpen: (next) => setOpen(next),
2061
+ closeOnOutsideClick: options.closeOnOutsideClick,
2062
+ closeOnFocusOutside: options.closeOnFocusOutside,
2063
+ closeOnEscape: options.closeOnEscape,
2064
+ returnFocus: options.returnFocus
2065
+ });
2066
+ const teleport = options.teleport ?? true;
2067
+ const { teleportTo, teleportDisabled } = useTeleportTarget({
2068
+ trigger: computed(() => trigger.value ?? anchorElement()),
2069
+ teleport,
2070
+ isOpen
2071
+ });
2072
+ const { styles: floatingStyles, placement, update } = useFloating$1(computed(() => options.anchor?.value ?? trigger.value), content, {
2073
+ placement: options.placement ?? "auto",
2074
+ offset: options.offset,
2075
+ padding: options.padding,
2076
+ matchWidth: options.matchWidth,
2077
+ strategy: teleport === false ? "absolute" : "fixed"
2078
+ });
2079
+ const wantsTabRedirect = () => {
2080
+ const setting = options.tabRedirect ?? false;
2081
+ return typeof setting === "function" ? setting() : setting;
2082
+ };
2083
+ /**
2084
+ * Every tab stop of this overlay that is **not** in the panel, in document order — the trigger,
2085
+ * plus anything claiming the panel's id with `data-eldra-overlay-owner` (a multi-select's clear
2086
+ * button). These keep their natural place in the walk: the redirect happens at the **last** of
2087
+ * them, so `Tab` still passes each one on the way to the panel.
2088
+ *
2089
+ * The owner elements are found with a plain attribute-presence selector and filtered by value in
2090
+ * JavaScript, for the reason `useOverlay` walks the attribute by hand: an id is merchant-settable
2091
+ * through the `id` prop, and one holding a character CSS would need escaped must not break this.
2092
+ */
2093
+ function stopsBeforePanel(panel) {
2094
+ const roots = [];
2095
+ if (trigger.value !== null) roots.push(trigger.value);
2096
+ const id = panel.id;
2097
+ if (id !== "") for (const owner of document.querySelectorAll(`[${OVERLAY_OWNER_ATTRIBUTE}]`)) {
2098
+ if (owner.getAttribute("data-eldra-overlay-owner") !== id) continue;
2099
+ if (panel.contains(owner) || roots.includes(owner)) continue;
2100
+ roots.push(owner);
2101
+ }
2102
+ return roots.flatMap((root) => overlay.focusables(root)).sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) === 0 ? 1 : -1);
2103
+ }
2104
+ /**
2105
+ * The two boundary keystrokes of the walk described on the `tabRedirect` option: into the panel
2106
+ * from the last tab stop the control still holds, and back out of the panel's first row to that
2107
+ * same stop. Everything else about `Tab` is left to the browser, which is what keeps this a
2108
+ * redirect rather than a trap — including the steps *within* the control, so a multi-select's
2109
+ * clear button is passed on the way in and returned to on the way back.
2110
+ *
2111
+ * It listens in the **capture** phase, before the control's own `keydown` reaches its handler:
2112
+ * `useListbox`'s `Tab` case asks the caller to close (the `SearchBar` does), and a popup that has
2113
+ * already closed has nothing left to walk into. Propagation is stopped only on the two keystrokes
2114
+ * actually redirected, so every other `Tab` arrives at the control untouched.
2115
+ */
2116
+ function onTabKeyDown(event) {
2117
+ if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
2118
+ if (!isOpen.value || teleportDisabled.value || !wantsTabRedirect()) return;
2119
+ const panel = content.value;
2120
+ const active = document.activeElement;
2121
+ if (panel === null || active === null) return;
2122
+ const first = overlay.focusables()[0];
2123
+ if (first === void 0) return;
2124
+ const last = stopsBeforePanel(panel).at(-1);
2125
+ if (event.shiftKey) {
2126
+ if (active !== first) return;
2127
+ event.preventDefault();
2128
+ event.stopPropagation();
2129
+ (last ?? trigger.value)?.focus();
2130
+ return;
2131
+ }
2132
+ if (panel.contains(active) || !overlay.isInside(active)) return;
2133
+ if (last !== void 0 && active !== last) return;
2134
+ event.preventDefault();
2135
+ event.stopPropagation();
2136
+ first.focus();
2137
+ }
2138
+ const attachTabRedirect = () => {
2139
+ if (typeof document === "undefined") return;
2140
+ document.addEventListener("keydown", onTabKeyDown, true);
2141
+ };
2142
+ const detachTabRedirect = () => {
2143
+ if (typeof document === "undefined") return;
2144
+ document.removeEventListener("keydown", onTabKeyDown, true);
2145
+ };
2146
+ watch(isOpen, (open) => open ? attachTabRedirect() : detachTabRedirect(), { immediate: true });
2147
+ function open(activate) {
2148
+ if (!canOpen()) return;
2149
+ const wasOpen = isOpen.value;
2150
+ setOpen(true);
2151
+ if (!isOpen.value) return;
2152
+ activate?.(wasOpen);
2153
+ if (!wasOpen) options.afterOpen?.();
2154
+ }
2155
+ function close(returnFocus = true) {
2156
+ if (!isOpen.value) return;
2157
+ setOpen(false);
2158
+ if (returnFocus) trigger.value?.focus();
2159
+ }
2160
+ let pressedTrigger = false;
2161
+ function releaseTrigger(event) {
2162
+ detachTriggerRelease();
2163
+ const target = event.target;
2164
+ if (target instanceof Node && trigger.value?.contains(target) === true) return;
2165
+ pressedTrigger = false;
2166
+ }
2167
+ function detachTriggerRelease() {
2168
+ if (typeof document === "undefined") return;
2169
+ document.removeEventListener("pointerup", releaseTrigger, true);
2170
+ document.removeEventListener("pointercancel", releaseTrigger, true);
2171
+ }
2172
+ function onTriggerPointerDown() {
2173
+ pressedTrigger = true;
2174
+ if (typeof document === "undefined") return;
2175
+ document.addEventListener("pointerup", releaseTrigger, true);
2176
+ document.addEventListener("pointercancel", releaseTrigger, true);
2177
+ }
2178
+ function onTriggerClick(event) {
2179
+ const fromPointer = pressedTrigger || event.detail > 0 || isProgrammaticClick(event, trigger.value);
2180
+ pressedTrigger = false;
2181
+ if (!canOpen()) return;
2182
+ if (!fromPointer) {
2183
+ trigger.value?.focus();
2184
+ return;
2185
+ }
2186
+ if (isOpen.value) close();
2187
+ else options.openFromPointer?.();
2188
+ }
2189
+ onBeforeUnmount(() => {
2190
+ unregisterOpen(closeFromRegistry);
2191
+ detachTriggerRelease();
2192
+ detachTabRedirect();
2193
+ });
2194
+ /**
2195
+ * Which corner the panel grows from: the one it is anchored by, so the entrance reads as the
2196
+ * control opening out rather than as a box arriving from somewhere. A panel below the control
2197
+ * grows from `top left`, a flipped one from `bottom left`. A custom property rather than a second
2198
+ * animation class: see the composable's own comment above, and the keyframes in `tailwind.css`.
2199
+ *
2200
+ * Logical directions are deliberately not used. `transform-origin` takes physical keywords only
2201
+ * (`left`/`right`, never `inline-start`), and every panel in this package is `start`-aligned and
2202
+ * at least as wide as its control, so the horizontal half barely moves the result either way.
2203
+ */
2204
+ const origin = computed(() => {
2205
+ if (placement.value.startsWith("top")) return "bottom left";
2206
+ if (placement.value.startsWith("left")) return "top right";
2207
+ return "top left";
2208
+ });
2209
+ return {
2210
+ isOpen,
2211
+ setOpen,
2212
+ open,
2213
+ close,
2214
+ panelStyle: computed(() => ({
2215
+ ...floatingStyles.value,
2216
+ "--eldra-popover-origin": origin.value
2217
+ })),
2218
+ placement,
2219
+ teleportTo,
2220
+ teleportDisabled,
2221
+ onTriggerPointerDown,
2222
+ onTriggerClick,
2223
+ focusFirst: overlay.focusFirst,
2224
+ isInside: overlay.isInside,
2225
+ update
2226
+ };
2227
+ }
2228
+ export { useEldraScope as $, FIELD_SEARCH_APPEARANCE as A, LOCALE_KEY as B, FIELD_DISABLED as C, FIELD_PREFIX_PAD as D, FIELD_LIVE as E, FIELD_TRAILING_PAD as F, FIELD_KEY as G, provideEldraUiLocale as H, FIELD_TRAILING_PAD_PAIR as I, ICON_STROKE_WIDTH as J, Spinner_default as K, fieldState as L, FIELD_SUFFIX_ROW as M, FIELD_SUFFIX_ROW_BASE as N, FIELD_PREFIX_ROW as O, FIELD_TEXT as P, provideEldraScope as Q, CURRENCY_KEY as R, FIELD_CLEAR_SIZE as S, FIELD_LEADING_PAD as T, useEldraUiCurrency as U, provideEldraUiCurrency as V, useEldraUiLocale as W, useControllableModel as X, mergeClass as Y, ELDRA_SCOPE_KEY as Z, FIELD_ACTION_ROOM_REM as _, useFloating$1 as a, FIELD_CLEAR_BUTTON as b, useOptionList as c, SelectPanel_default as d, joinIds as et, TRIGGER_VALUE_CELL as f, FIELD_ACTION_PAIR_SIZE as g, optionSwatchClass as h, useTeleportTarget as i, FIELD_SIZE as j, FIELD_RADIUS as k, normalizeText as l, optionIconClass as m, useOverlay as n, CREATE_VALUE as o, TRIGGER_VALUE_STACK as p, ICON_SIZE_CLASS as q, topLayerDialog as r, matchRange as s, usePopover as t, useUiId as tt, useListbox as u, FIELD_BASE as v, FIELD_LEADING_ICON as w, FIELD_CLEAR_BUTTON_BOX as x, FIELD_BOX as y, DEFAULT_UI_LOCALE as z };