@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.
- package/CHANGELOG.md +4 -0
- package/LICENSE-country-flag-icons +25 -0
- package/README.md +230 -66
- package/dist/PhoneInput-CYGpERg4.js +749 -0
- package/dist/{VariantPicker-Cr_AkX47.js → VariantPicker-D_Gg80So.js} +88 -2302
- package/dist/components/chip/Chip.vue.d.ts +8 -0
- package/dist/components/dialog/Dialog.vue.d.ts +8 -0
- package/dist/components/drawer/Drawer.vue.d.ts +8 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +8 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +8 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +8 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +8 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +8 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +8 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +8 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +8 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +8 -0
- package/dist/components/pagination/Pagination.vue.d.ts +8 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +8 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +8 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +8 -0
- package/dist/components/select/MultiSelect.vue.d.ts +8 -0
- package/dist/components/select/Select.vue.d.ts +8 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +8 -0
- package/dist/components/toast/Toast.vue.d.ts +8 -0
- package/dist/components/toast/Toaster.vue.d.ts +8 -0
- package/dist/components.css +64 -0
- package/dist/index.js +3 -2
- package/dist/messages/en-US.d.ts +19 -0
- package/dist/messages/is-IS.js +9 -1
- package/dist/phone/PhoneFlag.vue.d.ts +6 -0
- package/dist/phone/PhoneInput.vue.d.ts +220 -0
- package/dist/phone/caret.d.ts +14 -0
- package/dist/phone/examples.d.ts +2 -0
- package/dist/phone/flags.d.ts +8 -0
- package/dist/phone/index.d.ts +13 -0
- package/dist/phone/phone.d.ts +62 -0
- package/dist/phone/phoneFlagData.d.ts +2 -0
- package/dist/phone/rule.d.ts +22 -0
- package/dist/phone/types.d.ts +63 -0
- package/dist/phone/vee-validate/FieldPhoneInput.vue.d.ts +24 -0
- package/dist/phone/vee-validate/index.d.ts +3 -0
- package/dist/phone/vee-validate/types.d.ts +3 -0
- package/dist/phone/vee-validate.js +96 -0
- package/dist/phone.js +1 -0
- package/dist/phoneFlagData-D9dDT2uC.js +261 -0
- package/dist/resolver.d.ts +9 -2
- package/dist/resolver.js +15 -4
- package/dist/style.css +64 -0
- package/dist/useFieldControl-D_b9SC9s.js +273 -0
- package/dist/{useMessages-DOHGfip_.js → useMessages-DQQPh1P_.js} +20 -1
- package/dist/usePopover-4CQR2hB5.js +2228 -0
- package/dist/utilities.css +37 -0
- package/dist/vee-validate.js +6 -273
- package/dist/vue-i18n.js +4 -1
- package/package.json +19 -2
|
@@ -1,317 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { $ as useEldraScope, A as FIELD_SEARCH_APPEARANCE, D as FIELD_PREFIX_PAD, E as FIELD_LIVE, F as FIELD_TRAILING_PAD, G as FIELD_KEY, I as FIELD_TRAILING_PAD_PAIR, J as ICON_STROKE_WIDTH$1, K as Spinner_default, L as fieldState, M as FIELD_SUFFIX_ROW, N as FIELD_SUFFIX_ROW_BASE, O as FIELD_PREFIX_ROW, P as FIELD_TEXT, S as FIELD_CLEAR_SIZE, W as useEldraUiLocale, X as useControllableModel, Y as mergeClass, _ as FIELD_ACTION_ROOM_REM, b as FIELD_CLEAR_BUTTON, c as useOptionList, d as SelectPanel_default, et as joinIds, f as TRIGGER_VALUE_CELL, g as FIELD_ACTION_PAIR_SIZE, h as optionSwatchClass, j as FIELD_SIZE, k as FIELD_RADIUS, m as optionIconClass, p as TRIGGER_VALUE_STACK, q as ICON_SIZE_CLASS, s as matchRange, t as usePopover, tt as useUiId, u as useListbox, v as FIELD_BASE, w as FIELD_LEADING_ICON, x as FIELD_CLEAR_BUTTON_BOX, y as FIELD_BOX } from "./usePopover-4CQR2hB5.js";
|
|
2
|
+
import { r as useMessages } from "./useMessages-DQQPh1P_.js";
|
|
3
|
+
import { Comment, Fragment, Teleport, Text, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toValue, unref, useAttrs, useSlots, watch, watchPostEffect, withCtx, withModifiers } from "vue";
|
|
4
4
|
import { numberFormat } from "@eldrajs/sdk/format";
|
|
5
|
-
import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/vue";
|
|
6
|
-
// src/utils/id.ts
|
|
7
|
-
/**
|
|
8
|
-
* A stable, SSR-safe id for a component part, or the caller's own id when it
|
|
9
|
-
* gave one.
|
|
10
|
-
*
|
|
11
|
-
* Built on Vue's `useId()` (Vue 3.5+), so the server and the client produce the
|
|
12
|
-
* same value and `aria-describedby`/`for` wiring does not break on hydration.
|
|
13
|
-
* Must be called during `setup()`, like every other Vue composable.
|
|
14
|
-
*/
|
|
15
|
-
function useUiId(prefix, explicit) {
|
|
16
|
-
const generated = useId();
|
|
17
|
-
return computed(() => toValue(explicit) ?? `eldra-${prefix}-${generated}`);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Compose an `aria-describedby` (or `aria-labelledby`) value from ids that may
|
|
21
|
-
* be absent.
|
|
22
|
-
*
|
|
23
|
-
* One rule, everywhere in this package: **a control's own ids come first, then
|
|
24
|
-
* whatever the field context adds.** `aria-describedby` is read in document
|
|
25
|
-
* order of the listed ids, so the control's own error, counter or description is
|
|
26
|
-
* what a screen reader hears first, and the wrapper's help text follows. Nothing
|
|
27
|
-
* ever *replaces* the context — a `describedBy` prop adds to it, so
|
|
28
|
-
* `<FieldWrapper error="…"><Input described-by="x"/></FieldWrapper>` still
|
|
29
|
-
* describes the error.
|
|
30
|
-
*
|
|
31
|
-
* Duplicates are dropped (the same id listed twice is announced twice), and an
|
|
32
|
-
* empty result is `undefined` rather than `""`, so the attribute is omitted
|
|
33
|
-
* instead of rendered empty.
|
|
34
|
-
*
|
|
35
|
-
* **Deduplication is per id, not per argument.** Every argument here is itself an
|
|
36
|
-
* `aria-describedby` value, so it may already hold several space-separated ids —
|
|
37
|
-
* a `FieldWrapper`'s context contributes its error, help and counter ids as one
|
|
38
|
-
* string, and a consumer's `describedBy` prop may do the same. Comparing whole
|
|
39
|
-
* arguments would only have caught the case where two of them were byte-identical,
|
|
40
|
-
* and `joinIds('a b', 'b c')` would have announced `b` twice. Each argument is
|
|
41
|
-
* split on whitespace and the ids are deduplicated individually, first occurrence
|
|
42
|
-
* winning, so the order the rule promises is preserved.
|
|
43
|
-
*/
|
|
44
|
-
function joinIds(...ids) {
|
|
45
|
-
const seen = /* @__PURE__ */ new Set();
|
|
46
|
-
for (const value of ids) {
|
|
47
|
-
if (typeof value !== "string") continue;
|
|
48
|
-
for (const id of value.split(/\s+/)) if (id.length > 0) seen.add(id);
|
|
49
|
-
}
|
|
50
|
-
return seen.size > 0 ? [...seen].join(" ") : void 0;
|
|
51
|
-
}
|
|
52
|
-
// src/composables/useEldraScope.ts
|
|
53
|
-
/** The injection key `provideEldraScope` provides under. */
|
|
54
|
-
var ELDRA_SCOPE_KEY = Symbol("eldra-scope");
|
|
55
|
-
/**
|
|
56
|
-
* Names a theming scope for every component of this package rendered below the caller (see the
|
|
57
|
-
* README, "Theming a subtree"). Call it in `setup()` of a wrapper or an app root.
|
|
58
|
-
*
|
|
59
|
-
* Each component then renders `data-eldra-scope="<name>"` on its root and on every part it
|
|
60
|
-
* teleports (panels, dialogs, toasts). The name is free; the consumer's own variable overrides
|
|
61
|
-
* target it (`[data-eldra-scope='studio'] { --eldra-color-primary: … }`). Without a provider the
|
|
62
|
-
* attribute is not rendered, so the output is unchanged.
|
|
63
|
-
*/
|
|
64
|
-
function provideEldraScope(name = "default") {
|
|
65
|
-
provide(ELDRA_SCOPE_KEY, name || "default");
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Internal: the theming hooks a component of this package binds. `scope` goes on every root,
|
|
69
|
-
* teleported root and kit-owned element sitting directly in a slot host, so a scope's variables
|
|
70
|
-
* reach it; it is `undefined` without a provider. `slotHost(...names)` is `data-eldra-slot`, on
|
|
71
|
-
* the element holding those slots, a hook for consumer CSS. It renders whenever one of the slots
|
|
72
|
-
* has content, provider or not, and never for a fallback, which is the kit's own markup.
|
|
73
|
-
*/
|
|
74
|
-
function useEldraScope() {
|
|
75
|
-
const scope = inject(ELDRA_SCOPE_KEY, void 0);
|
|
76
|
-
const slots = useSlots();
|
|
77
|
-
return {
|
|
78
|
-
scope,
|
|
79
|
-
slotHost: (...names) => names.some((name) => slots[name] !== void 0) ? "" : void 0
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// src/composables/useControllableModel.ts
|
|
83
|
-
/**
|
|
84
|
-
* A model that works both ways round: controlled when the parent passes
|
|
85
|
-
* `modelValue`, self-managing when it does not.
|
|
86
|
-
*
|
|
87
|
-
* Every stateful component in this package uses it, so a consumer can drop a
|
|
88
|
-
* `Select` in with no `v-model` and still get a working control, while a
|
|
89
|
-
* consumer that does bind `v-model` stays the single source of truth — writes
|
|
90
|
-
* are emitted and never applied locally, so a parent that refuses a value
|
|
91
|
-
* actually refuses it.
|
|
92
|
-
*
|
|
93
|
-
* `fallback` supplies the uncontrolled starting value and is called once.
|
|
94
|
-
*/
|
|
95
|
-
function useControllableModel(props, emit, fallback) {
|
|
96
|
-
const internal = ref(props.modelValue === void 0 ? fallback() : props.modelValue);
|
|
97
|
-
watch(() => props.modelValue, (value) => {
|
|
98
|
-
if (value !== void 0) internal.value = value;
|
|
99
|
-
});
|
|
100
|
-
return computed({
|
|
101
|
-
get: () => props.modelValue === void 0 ? internal.value : props.modelValue,
|
|
102
|
-
set: (value) => {
|
|
103
|
-
if (props.modelValue === void 0) internal.value = value;
|
|
104
|
-
emit("update:modelValue", value);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
var kitMerge = extendTailwindMerge({
|
|
109
|
-
extend: {
|
|
110
|
-
theme: {
|
|
111
|
-
shadow: ["float"],
|
|
112
|
-
container: [
|
|
113
|
-
"narrow",
|
|
114
|
-
"content",
|
|
115
|
-
"wide",
|
|
116
|
-
"tablet",
|
|
117
|
-
"two-col"
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
classGroups: {
|
|
121
|
-
"font-size": [{ text: [
|
|
122
|
-
"display",
|
|
123
|
-
"h1",
|
|
124
|
-
"h2",
|
|
125
|
-
"h3",
|
|
126
|
-
"h4",
|
|
127
|
-
"body-lg",
|
|
128
|
-
"body",
|
|
129
|
-
"body-sm",
|
|
130
|
-
"caption",
|
|
131
|
-
"overline",
|
|
132
|
-
"label",
|
|
133
|
-
"code",
|
|
134
|
-
"button-sm",
|
|
135
|
-
"button-md",
|
|
136
|
-
"button-lg",
|
|
137
|
-
"control-sm",
|
|
138
|
-
"control",
|
|
139
|
-
"control-lg",
|
|
140
|
-
"control-mobile",
|
|
141
|
-
"counter",
|
|
142
|
-
"field-note",
|
|
143
|
-
"card-title",
|
|
144
|
-
"switch-label",
|
|
145
|
-
"switch-description",
|
|
146
|
-
"select-group",
|
|
147
|
-
"select-option",
|
|
148
|
-
"select-pill",
|
|
149
|
-
"stepper-value",
|
|
150
|
-
"stepper-value-sm",
|
|
151
|
-
"search-meta",
|
|
152
|
-
"search-title",
|
|
153
|
-
"search-kbd",
|
|
154
|
-
"variant-legend",
|
|
155
|
-
"variant-pill",
|
|
156
|
-
"logo-wordmark",
|
|
157
|
-
"badge",
|
|
158
|
-
"stock-status",
|
|
159
|
-
"price-sm",
|
|
160
|
-
"price-lg",
|
|
161
|
-
"price-current",
|
|
162
|
-
"price-secondary",
|
|
163
|
-
"price-unit",
|
|
164
|
-
"avatar-initials-sm",
|
|
165
|
-
"avatar-initials-md",
|
|
166
|
-
"avatar-initials-lg",
|
|
167
|
-
"avatar-initials-xl",
|
|
168
|
-
"empty-state-title",
|
|
169
|
-
"filter-trigger",
|
|
170
|
-
"filter-subheading",
|
|
171
|
-
"filter-tile-count",
|
|
172
|
-
"content-card-title",
|
|
173
|
-
"content-card-excerpt",
|
|
174
|
-
"dialog-title",
|
|
175
|
-
"accordion-title",
|
|
176
|
-
"drawer-title",
|
|
177
|
-
"tooltip",
|
|
178
|
-
"toast-title",
|
|
179
|
-
"search-modal-field",
|
|
180
|
-
"search-modal-foot",
|
|
181
|
-
"search-modal-kbd"
|
|
182
|
-
] }],
|
|
183
|
-
h: [
|
|
184
|
-
"control-h",
|
|
185
|
-
"control-h-sm",
|
|
186
|
-
"control-h-lg",
|
|
187
|
-
"eldra-range-track",
|
|
188
|
-
"eldra-skeleton-title",
|
|
189
|
-
"eldra-skeleton-box"
|
|
190
|
-
],
|
|
191
|
-
"min-h": [
|
|
192
|
-
"eldra-range-rail",
|
|
193
|
-
"eldra-drawer-header-height",
|
|
194
|
-
"eldra-nav-menu-drawer-row"
|
|
195
|
-
],
|
|
196
|
-
px: [
|
|
197
|
-
"eldra-range-gutter",
|
|
198
|
-
"eldra-range-gutter-thumb",
|
|
199
|
-
"eldra-drawer-gutter"
|
|
200
|
-
],
|
|
201
|
-
w: [
|
|
202
|
-
"eldra-dialog-width",
|
|
203
|
-
"eldra-dialog-width-sm",
|
|
204
|
-
"eldra-drawer-width",
|
|
205
|
-
"eldra-toast-width",
|
|
206
|
-
"eldra-search-modal-width"
|
|
207
|
-
],
|
|
208
|
-
size: [
|
|
209
|
-
"eldra-avatar-icon-sm",
|
|
210
|
-
"eldra-avatar-icon-md",
|
|
211
|
-
"eldra-avatar-icon-lg",
|
|
212
|
-
"eldra-avatar-icon-xl"
|
|
213
|
-
],
|
|
214
|
-
"target-min": ["target-min"],
|
|
215
|
-
"target-touch": ["target-touch"],
|
|
216
|
-
"eldra-scrollbar-hide": ["eldra-scrollbar-hide"],
|
|
217
|
-
transition: ["eldra-transition-colors"],
|
|
218
|
-
"border-w": [
|
|
219
|
-
"eldra-field-border",
|
|
220
|
-
"eldra-button-border",
|
|
221
|
-
"eldra-checkbox-border",
|
|
222
|
-
"eldra-checkbox-border-invalid",
|
|
223
|
-
"eldra-radio-card-border",
|
|
224
|
-
"eldra-switch-track-border",
|
|
225
|
-
"eldra-variant-pill-border",
|
|
226
|
-
"eldra-variant-swatch-ring",
|
|
227
|
-
"eldra-variant-swatch-edge",
|
|
228
|
-
"eldra-filter-swatch-ring",
|
|
229
|
-
"eldra-editor-placeholder-border"
|
|
230
|
-
],
|
|
231
|
-
"eldra-field-invalid": ["eldra-field-invalid"],
|
|
232
|
-
"eldra-radio-card-selected": ["eldra-radio-card-selected"],
|
|
233
|
-
"eldra-switch-thumb-offset": ["eldra-switch-thumb-offset"],
|
|
234
|
-
"eldra-dialog-fullscreen": ["eldra-dialog-fullscreen"],
|
|
235
|
-
"eldra-drawer-motion": ["eldra-drawer-motion"],
|
|
236
|
-
"eldra-drawer-sheet": ["eldra-drawer-sheet"],
|
|
237
|
-
"max-h": [
|
|
238
|
-
"eldra-select-panel-height",
|
|
239
|
-
"eldra-search-panel-height",
|
|
240
|
-
"eldra-dialog-max-height",
|
|
241
|
-
"eldra-search-modal-max-height",
|
|
242
|
-
"eldra-drawer-sheet-height"
|
|
243
|
-
],
|
|
244
|
-
m: ["eldra-search-modal-position"],
|
|
245
|
-
"max-w": [
|
|
246
|
-
"eldra-select-panel-width",
|
|
247
|
-
"eldra-container-narrow",
|
|
248
|
-
"eldra-container-content",
|
|
249
|
-
"eldra-container-wide"
|
|
250
|
-
],
|
|
251
|
-
"eldra-select-match": ["eldra-select-match"],
|
|
252
|
-
"eldra-select-swatch": ["eldra-select-swatch"],
|
|
253
|
-
"eldra-select-option-active": ["eldra-select-option-active"],
|
|
254
|
-
"eldra-select-option-selected": ["eldra-select-option-selected"],
|
|
255
|
-
"eldra-variant-pill-selected-line": ["eldra-variant-pill-selected-line"],
|
|
256
|
-
"eldra-focus": ["eldra-focus", "eldra-focus-inset"],
|
|
257
|
-
"eldra-focus-always": ["eldra-focus-always", "eldra-focus-inset-always"],
|
|
258
|
-
"eldra-focus-proxy": ["eldra-focus-proxy"],
|
|
259
|
-
"eldra-focus-open": ["eldra-focus-open"],
|
|
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
5
|
// src/components/form-layout/context.ts
|
|
316
6
|
/**
|
|
317
7
|
* Whether the form this subtree belongs to is currently submitting.
|
|
@@ -345,20 +35,6 @@ var FORM_SUBMITTING_KEY = Symbol("eldra-form-submitting");
|
|
|
345
35
|
* ```
|
|
346
36
|
*/
|
|
347
37
|
var FORM_LAYOUT_KEY = Symbol("eldra-form-layout");
|
|
348
|
-
// src/components/icon/sizes.ts
|
|
349
|
-
/**
|
|
350
|
-
* The spec's sizes as Tailwind utilities. The theme's `--spacing` is 0.25rem,
|
|
351
|
-
* so `size-4`/`size-5`/`size-6`/`size-8` are exactly 1/1.25/1.5/2rem — no
|
|
352
|
-
* literal length appears here or in the built CSS.
|
|
353
|
-
*/
|
|
354
|
-
var ICON_SIZE_CLASS = {
|
|
355
|
-
sm: "eldra:size-4",
|
|
356
|
-
md: "eldra:size-5",
|
|
357
|
-
lg: "eldra:size-6",
|
|
358
|
-
xl: "eldra:size-8"
|
|
359
|
-
};
|
|
360
|
-
/** The spec's outline stroke weight. */
|
|
361
|
-
var ICON_STROKE_WIDTH$1 = 1.75;
|
|
362
38
|
// src/components/icon/Icon.vue
|
|
363
39
|
var Icon_default = /* @__PURE__ */ defineComponent({
|
|
364
40
|
__name: "Icon",
|
|
@@ -393,60 +69,10 @@ var Icon_default = /* @__PURE__ */ defineComponent({
|
|
|
393
69
|
};
|
|
394
70
|
}
|
|
395
71
|
});
|
|
396
|
-
// src/components/spinner/Spinner.vue?vue&type=script&setup=true&lang.ts
|
|
397
|
-
var _hoisted_1$19 = [
|
|
398
|
-
"data-eldra-scope",
|
|
399
|
-
"role",
|
|
400
|
-
"aria-label",
|
|
401
|
-
"aria-hidden"
|
|
402
|
-
];
|
|
403
|
-
// src/components/spinner/Spinner.vue
|
|
404
|
-
var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
405
|
-
inheritAttrs: false,
|
|
406
|
-
__name: "Spinner",
|
|
407
|
-
props: { label: { default: void 0 } },
|
|
408
|
-
setup(__props) {
|
|
409
|
-
const props = __props;
|
|
410
|
-
const eldra = useEldraScope();
|
|
411
|
-
const attrs = useAttrs();
|
|
412
|
-
const forwardedAttrs = computed(() => {
|
|
413
|
-
const { class: _class, ...rest } = attrs;
|
|
414
|
-
return rest;
|
|
415
|
-
});
|
|
416
|
-
const rootClass = computed(() => mergeClass("eldra:size-4.5 eldra:animate-eldra-spin eldra:motion-reduce:animate-eldra-pulse", attrs.class));
|
|
417
|
-
/** `""` names nothing, so it is decorative too. */
|
|
418
|
-
const named = computed(() => props.label !== void 0 && props.label !== "");
|
|
419
|
-
return (_ctx, _cache) => {
|
|
420
|
-
return openBlock(), createElementBlock("svg", mergeProps({
|
|
421
|
-
"data-eldra-ui": "",
|
|
422
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
423
|
-
class: rootClass.value,
|
|
424
|
-
viewBox: "0 0 18 18",
|
|
425
|
-
fill: "none",
|
|
426
|
-
role: named.value ? "img" : void 0,
|
|
427
|
-
"aria-label": named.value ? __props.label : void 0,
|
|
428
|
-
"aria-hidden": named.value ? void 0 : "true",
|
|
429
|
-
focusable: "false"
|
|
430
|
-
}, forwardedAttrs.value), [..._cache[0] || (_cache[0] = [createElementVNode("circle", {
|
|
431
|
-
cx: "9",
|
|
432
|
-
cy: "9",
|
|
433
|
-
r: "8",
|
|
434
|
-
stroke: "currentColor",
|
|
435
|
-
"stroke-width": "2",
|
|
436
|
-
"stroke-opacity": "0.3"
|
|
437
|
-
}, null, -1), createElementVNode("path", {
|
|
438
|
-
d: "M17 9a8 8 0 0 0-8-8",
|
|
439
|
-
stroke: "currentColor",
|
|
440
|
-
"stroke-width": "2",
|
|
441
|
-
"stroke-linecap": "round"
|
|
442
|
-
}, null, -1)])], 16, _hoisted_1$19);
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
72
|
// src/components/button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
447
|
-
var _hoisted_1$
|
|
448
|
-
var _hoisted_2$
|
|
449
|
-
var _hoisted_3$
|
|
73
|
+
var _hoisted_1$17 = ["data-eldra-slot"];
|
|
74
|
+
var _hoisted_2$15 = ["data-eldra-slot"];
|
|
75
|
+
var _hoisted_3$14 = ["data-eldra-slot"];
|
|
450
76
|
var BASE$1 = "eldra:relative eldra:inline-flex eldra:items-center eldra:justify-center eldra:rounded-[var(--eldra-button-radius,var(--eldra-radius-md))] eldra:eldra-focus";
|
|
451
77
|
/** The border (`--eldra-button-border-width`, default 1px, see `eldra-button-border`) and no
|
|
452
78
|
* underline, except `link`, which is a borderless underlined line box. */
|
|
@@ -770,9 +396,10 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
770
396
|
* the container's own `gap`, so the icon sits exactly as `iconLeft` would.
|
|
771
397
|
*/
|
|
772
398
|
function labelClass() {
|
|
399
|
+
const rich = slots.default !== void 0 && hasElements(slots.default());
|
|
773
400
|
return mergeClass([
|
|
774
401
|
"eldra:whitespace-nowrap",
|
|
775
|
-
|
|
402
|
+
rich && "eldra:inline-flex eldra:items-center eldra:gap-[inherit]",
|
|
776
403
|
labelHiddenWhileLoading.value
|
|
777
404
|
], props.classes?.label);
|
|
778
405
|
}
|
|
@@ -860,13 +487,13 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
860
487
|
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [leadingIcon.value ? (openBlock(), createBlock(Icon_default, {
|
|
861
488
|
key: 0,
|
|
862
489
|
icon: leadingIcon.value
|
|
863
|
-
}, null, 8, ["icon"])) : createCommentVNode("", true)])], 10, _hoisted_1$
|
|
490
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true)])], 10, _hoisted_1$17)) : createCommentVNode("", true),
|
|
864
491
|
!__props.iconOnly ? (openBlock(), createElementBlock("span", {
|
|
865
492
|
key: 2,
|
|
866
493
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
867
494
|
"data-part": "label",
|
|
868
495
|
class: normalizeClass(labelClass())
|
|
869
|
-
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 10, _hoisted_2$
|
|
496
|
+
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 10, _hoisted_2$15)) : createCommentVNode("", true),
|
|
870
497
|
hasTrailing.value ? (openBlock(), createElementBlock("span", {
|
|
871
498
|
key: 3,
|
|
872
499
|
"data-eldra-slot": unref(eldra).slotHost("trailingIcon"),
|
|
@@ -875,7 +502,7 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
875
502
|
}, [renderSlot(_ctx.$slots, "trailingIcon", {}, () => [__props.iconRight ? (openBlock(), createBlock(Icon_default, {
|
|
876
503
|
key: 0,
|
|
877
504
|
icon: __props.iconRight
|
|
878
|
-
}, null, 8, ["icon"])) : createCommentVNode("", true)])], 10, _hoisted_3$
|
|
505
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true)])], 10, _hoisted_3$14)) : createCommentVNode("", true),
|
|
879
506
|
isLoading.value && isOverlaySpinner.value ? (openBlock(), createElementBlock("span", {
|
|
880
507
|
key: 4,
|
|
881
508
|
"data-part": "spinner",
|
|
@@ -897,12 +524,9 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
897
524
|
};
|
|
898
525
|
}
|
|
899
526
|
});
|
|
900
|
-
// src/components/field-wrapper/context.ts
|
|
901
|
-
/** The key a `FieldWrapper` provides its `FieldContext` on. */
|
|
902
|
-
var FIELD_KEY = Symbol("eldra-ui:field");
|
|
903
527
|
// src/components/field-wrapper/FieldError.vue?vue&type=script&setup=true&lang.ts
|
|
904
|
-
var _hoisted_1$
|
|
905
|
-
var _hoisted_2$
|
|
528
|
+
var _hoisted_1$16 = ["id", "data-eldra-scope"];
|
|
529
|
+
var _hoisted_2$14 = ["data-eldra-slot"];
|
|
906
530
|
// src/components/field-wrapper/FieldError.vue
|
|
907
531
|
var FieldError_default = /* @__PURE__ */ defineComponent({
|
|
908
532
|
__name: "FieldError",
|
|
@@ -959,12 +583,12 @@ var FieldError_default = /* @__PURE__ */ defineComponent({
|
|
|
959
583
|
createElementVNode("path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" }, null, -1),
|
|
960
584
|
createElementVNode("path", { d: "M12 8v4" }, null, -1),
|
|
961
585
|
createElementVNode("path", { d: "M12 16h.01" }, null, -1)
|
|
962
|
-
])], 2)), createElementVNode("span", { "data-eldra-slot": unref(eldra).slotHost("default") }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_2$
|
|
586
|
+
])], 2)), createElementVNode("span", { "data-eldra-slot": unref(eldra).slotHost("default") }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_2$14)], 10, _hoisted_1$16);
|
|
963
587
|
};
|
|
964
588
|
}
|
|
965
589
|
});
|
|
966
590
|
// src/components/field-wrapper/RequiredMark.vue?vue&type=script&setup=true&lang.ts
|
|
967
|
-
var _hoisted_1$
|
|
591
|
+
var _hoisted_1$15 = ["data-eldra-scope"];
|
|
968
592
|
// src/components/field-wrapper/RequiredMark.vue
|
|
969
593
|
var RequiredMark_default = /* @__PURE__ */ defineComponent({
|
|
970
594
|
__name: "RequiredMark",
|
|
@@ -988,7 +612,7 @@ var RequiredMark_default = /* @__PURE__ */ defineComponent({
|
|
|
988
612
|
"data-part": "requiredMark",
|
|
989
613
|
class: normalizeClass(markClass.value),
|
|
990
614
|
"aria-hidden": "true"
|
|
991
|
-
}, "*", 10, _hoisted_1$
|
|
615
|
+
}, "*", 10, _hoisted_1$15);
|
|
992
616
|
};
|
|
993
617
|
}
|
|
994
618
|
});
|
|
@@ -1031,7 +655,7 @@ var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
|
1031
655
|
}
|
|
1032
656
|
});
|
|
1033
657
|
// src/components/checkbox/Checkbox.vue?vue&type=script&setup=true&lang.ts
|
|
1034
|
-
var _hoisted_1$
|
|
658
|
+
var _hoisted_1$14 = [
|
|
1035
659
|
"id",
|
|
1036
660
|
"name",
|
|
1037
661
|
"value",
|
|
@@ -1043,18 +667,18 @@ var _hoisted_1$15 = [
|
|
|
1043
667
|
"aria-controls",
|
|
1044
668
|
"aria-checked"
|
|
1045
669
|
];
|
|
1046
|
-
var _hoisted_2$
|
|
670
|
+
var _hoisted_2$13 = {
|
|
1047
671
|
key: 0,
|
|
1048
672
|
"data-mark": "dash",
|
|
1049
673
|
d: "M1 5h8"
|
|
1050
674
|
};
|
|
1051
|
-
var _hoisted_3$
|
|
675
|
+
var _hoisted_3$13 = {
|
|
1052
676
|
key: 1,
|
|
1053
677
|
"data-mark": "tick",
|
|
1054
678
|
d: "M1.25 5l2.5 2.5l5 -5"
|
|
1055
679
|
};
|
|
1056
|
-
var _hoisted_4$
|
|
1057
|
-
var _hoisted_5$
|
|
680
|
+
var _hoisted_4$12 = ["data-eldra-slot"];
|
|
681
|
+
var _hoisted_5$10 = ["data-eldra-slot"];
|
|
1058
682
|
var ROOT$3 = "eldra:group eldra:grid eldra:max-w-full eldra:gap-y-0.5 eldra:target-min";
|
|
1059
683
|
var ROOT_COLUMNS = "eldra:grid-cols-[auto_1fr] eldra:gap-x-2.5";
|
|
1060
684
|
var ROOT_INLINE = "eldra:w-fit eldra:items-start";
|
|
@@ -1355,7 +979,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1355
979
|
"aria-controls": __props.controls,
|
|
1356
980
|
"aria-checked": __props.indeterminate ? "mixed" : void 0,
|
|
1357
981
|
onChange
|
|
1358
|
-
}), null, 16, _hoisted_1$
|
|
982
|
+
}), null, 16, _hoisted_1$14), (openBlock(), createElementBlock("svg", {
|
|
1359
983
|
"data-part": "check",
|
|
1360
984
|
class: normalizeClass(checkClass.value),
|
|
1361
985
|
viewBox: "0 0 10 10",
|
|
@@ -1366,7 +990,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1366
990
|
"stroke-linejoin": "round",
|
|
1367
991
|
"aria-hidden": "true",
|
|
1368
992
|
focusable: "false"
|
|
1369
|
-
}, [__props.indeterminate ? (openBlock(), createElementBlock("path", _hoisted_2$
|
|
993
|
+
}, [__props.indeterminate ? (openBlock(), createElementBlock("path", _hoisted_2$13)) : (openBlock(), createElementBlock("path", _hoisted_3$13))], 2))], 2),
|
|
1370
994
|
isLabelled() ? (openBlock(), createElementBlock("span", {
|
|
1371
995
|
key: 0,
|
|
1372
996
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
@@ -1382,13 +1006,13 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1382
1006
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).required), 1)]),
|
|
1383
1007
|
_: 1
|
|
1384
1008
|
})) : createCommentVNode("", true)
|
|
1385
|
-
], 10, _hoisted_4$
|
|
1009
|
+
], 10, _hoisted_4$12)) : createCommentVNode("", true),
|
|
1386
1010
|
hasHint.value ? (openBlock(), createElementBlock("span", {
|
|
1387
1011
|
key: 1,
|
|
1388
1012
|
"data-eldra-slot": unref(eldra).slotHost("hint"),
|
|
1389
1013
|
"data-part": "hint",
|
|
1390
1014
|
class: normalizeClass(hintClass.value)
|
|
1391
|
-
}, [renderSlot(_ctx.$slots, "hint", {}, () => [createTextVNode(toDisplayString(__props.hint), 1)])], 10, _hoisted_5$
|
|
1015
|
+
}, [renderSlot(_ctx.$slots, "hint", {}, () => [createTextVNode(toDisplayString(__props.hint), 1)])], 10, _hoisted_5$10)) : createCommentVNode("", true)
|
|
1392
1016
|
]),
|
|
1393
1017
|
_: 3
|
|
1394
1018
|
}, 8, ["data-eldra-scope", "class"]))]),
|
|
@@ -1398,7 +1022,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1398
1022
|
}
|
|
1399
1023
|
});
|
|
1400
1024
|
// src/components/checkbox/CheckboxGroup.vue?vue&type=script&setup=true&lang.ts
|
|
1401
|
-
var _hoisted_1$
|
|
1025
|
+
var _hoisted_1$13 = [
|
|
1402
1026
|
"data-eldra-scope",
|
|
1403
1027
|
"aria-describedby",
|
|
1404
1028
|
"aria-invalid"
|
|
@@ -1502,7 +1126,7 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1502
1126
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.error), 1)]),
|
|
1503
1127
|
_: 1
|
|
1504
1128
|
}, 8, ["id", "classes"])) : createCommentVNode("", true)
|
|
1505
|
-
], 8, _hoisted_1$
|
|
1129
|
+
], 8, _hoisted_1$13);
|
|
1506
1130
|
};
|
|
1507
1131
|
}
|
|
1508
1132
|
});
|
|
@@ -1529,107 +1153,6 @@ var TAG_SHAPE = "eldra:inline-flex eldra:min-h-7 eldra:items-center eldra:gap-1
|
|
|
1529
1153
|
function tagPadding(hasRemoveButton) {
|
|
1530
1154
|
return hasRemoveButton ? "eldra:ps-2.5 eldra:pe-0.5" : "eldra:px-2.5";
|
|
1531
1155
|
}
|
|
1532
|
-
// src/composables/useLocale.ts
|
|
1533
|
-
/**
|
|
1534
|
-
* The number locale the components format with, as a provide/inject pair — the same shape as
|
|
1535
|
-
* `useMessages`, and deliberately separate from it: the *strings* a component renders and the
|
|
1536
|
-
* *locale its numbers are formatted in* are two different decisions, and a store that accepts the
|
|
1537
|
-
* English defaults may still be an Icelandic shop.
|
|
1538
|
-
*
|
|
1539
|
-
* It is an ambient default, never an answer: every component that reads it also takes a `locale`
|
|
1540
|
-
* prop, and the prop wins. With nothing provided the components format in `en-US`.
|
|
1541
|
-
*/
|
|
1542
|
-
var DEFAULT_UI_LOCALE = "en-US";
|
|
1543
|
-
/**
|
|
1544
|
-
* The injection key the locale provider writes to. Exported so an app can set the locale from
|
|
1545
|
-
* outside a `setup()` scope — and so it can provide a **getter**, which is what makes a locale
|
|
1546
|
-
* switch reactive without an effect that outlives a server request:
|
|
1547
|
-
*
|
|
1548
|
-
* ```ts
|
|
1549
|
-
* import { LOCALE_KEY } from '@eldrajs/ui';
|
|
1550
|
-
* app.provide(LOCALE_KEY, () => store.locale);
|
|
1551
|
-
* ```
|
|
1552
|
-
*/
|
|
1553
|
-
var LOCALE_KEY = Symbol("eldra-ui-locale");
|
|
1554
|
-
/**
|
|
1555
|
-
* Set the number locale for this component and everything below it.
|
|
1556
|
-
*
|
|
1557
|
-
* Wraps Vue's `provide`, so it must be called during `setup()`. Use
|
|
1558
|
-
* `app.provide(LOCALE_KEY, locale)` for the app-wide case.
|
|
1559
|
-
*/
|
|
1560
|
-
function provideEldraUiLocale(locale) {
|
|
1561
|
-
provide(LOCALE_KEY, locale);
|
|
1562
|
-
}
|
|
1563
|
-
/**
|
|
1564
|
-
* The locale a component should format numbers in: whatever an ancestor provided, else `en-US`.
|
|
1565
|
-
* A ref or a getter is unwrapped on every read, so the value follows a locale switch.
|
|
1566
|
-
*/
|
|
1567
|
-
function useEldraUiLocale() {
|
|
1568
|
-
const provided = inject(LOCALE_KEY, void 0);
|
|
1569
|
-
return computed(() => toValue(provided) ?? "en-US");
|
|
1570
|
-
}
|
|
1571
|
-
/**
|
|
1572
|
-
* The injection key the store currency is provided under (spec "Price" → Properties, `currency`
|
|
1573
|
-
* row: "store currency") — the same provide/inject shape as `LOCALE_KEY` and deliberately separate
|
|
1574
|
-
* from it: a store's number locale and its currency are two different decisions (an
|
|
1575
|
-
* `en-US`-formatted store may still sell in `ISK`). It is an ambient default, never an answer:
|
|
1576
|
-
* every component that reads it also takes a `currency` prop, and the prop wins. **With nothing
|
|
1577
|
-
* provided there is no currency at all** — see `useEldraUiCurrency` for what the components then
|
|
1578
|
-
* render, and why this pair has no default code.
|
|
1579
|
-
*
|
|
1580
|
-
* Exported so an app can set the currency from
|
|
1581
|
-
* outside a `setup()` scope — and so it can provide a **getter**, which is what makes a currency
|
|
1582
|
-
* switch reactive without an effect that outlives a server request:
|
|
1583
|
-
*
|
|
1584
|
-
* ```ts
|
|
1585
|
-
* import { CURRENCY_KEY } from '@eldrajs/ui';
|
|
1586
|
-
* app.provide(CURRENCY_KEY, () => store.currency);
|
|
1587
|
-
* ```
|
|
1588
|
-
*
|
|
1589
|
-
* Providing `undefined` is meaningful and different from not providing at all: it says the store
|
|
1590
|
-
* has **no** currency, which is the answer a platform that has not been told one must be able to
|
|
1591
|
-
* give. Vue's `inject` consults `key in provides`, so the two cases stay distinguishable (see
|
|
1592
|
-
* `useEldraUiCurrency`).
|
|
1593
|
-
*/
|
|
1594
|
-
var CURRENCY_KEY = Symbol("eldra-ui-currency");
|
|
1595
|
-
/**
|
|
1596
|
-
* Set the store currency for this component and everything below it.
|
|
1597
|
-
*
|
|
1598
|
-
* Wraps Vue's `provide`, so it must be called during `setup()`. Use
|
|
1599
|
-
* `app.provide(CURRENCY_KEY, currency)` for the app-wide case.
|
|
1600
|
-
*/
|
|
1601
|
-
function provideEldraUiCurrency(currency) {
|
|
1602
|
-
provide(CURRENCY_KEY, currency);
|
|
1603
|
-
}
|
|
1604
|
-
/**
|
|
1605
|
-
* A value no provider can supply, so `inject`'s default tells "nobody provided a currency" apart
|
|
1606
|
-
* from "a provider answered: this store has none". Vue's `inject` returns a provided `undefined`
|
|
1607
|
-
* rather than the default (it tests `key in provides`), which is what makes the distinction real.
|
|
1608
|
-
*/
|
|
1609
|
-
var NO_CURRENCY_PROVIDER = Symbol("eldra-ui-currency-absent");
|
|
1610
|
-
/**
|
|
1611
|
-
* The currency a component should format money in: whatever an ancestor provided, else **nothing**.
|
|
1612
|
-
* A ref or a getter is unwrapped on every read, so the value follows a currency switch.
|
|
1613
|
-
*
|
|
1614
|
-
* **There is no default code.** A component library installed by a shop of any kind cannot guess
|
|
1615
|
-
* one: a `USD` fallback puts a dollar sign in front of krónur, and a wrong price is worse than an
|
|
1616
|
-
* incomplete one. So `undefined` comes back whenever there is no currency to name, and a component
|
|
1617
|
-
* reading it formats the amount as a plain number through the same `Intl` path, with no symbol and
|
|
1618
|
-
* no code (`Price` does exactly that). The empty string is read as "no currency" too: it is not a
|
|
1619
|
-
* code `Intl` accepts, and it was the only way to decline one while this composable still defaulted.
|
|
1620
|
-
*
|
|
1621
|
-
* Two ways to arrive at `undefined`, and only one of them is a mistake. A provider that supplies
|
|
1622
|
-
* `undefined` (or `''`) has *answered* — this store has no currency — and nothing is logged. Having
|
|
1623
|
-
* no provider at all is unwired, and warns once per session in dev.
|
|
1624
|
-
*/
|
|
1625
|
-
function useEldraUiCurrency() {
|
|
1626
|
-
const provided = inject(CURRENCY_KEY, NO_CURRENCY_PROVIDER);
|
|
1627
|
-
return computed(() => {
|
|
1628
|
-
if (provided === NO_CURRENCY_PROVIDER) return;
|
|
1629
|
-
const currency = toValue(provided);
|
|
1630
|
-
return currency === void 0 || currency === "" ? void 0 : currency;
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
1156
|
// src/composables/useHeadingTag.ts
|
|
1634
1157
|
/**
|
|
1635
1158
|
* Turns a `headingLevel` prop into the tag name `<component :is>` renders — pulled out of the five
|
|
@@ -1987,165 +1510,6 @@ function currencySymbol(currency, locale = "en-US", narrow = true) {
|
|
|
1987
1510
|
return currency;
|
|
1988
1511
|
}
|
|
1989
1512
|
}
|
|
1990
|
-
// src/components/input/classes.ts
|
|
1991
|
-
/**
|
|
1992
|
-
* The field recipes of the design spec's **Input**, in one place.
|
|
1993
|
-
*
|
|
1994
|
-
* `Input` is the spec's field box, and two other controls draw the same box: `SearchBar`'s search
|
|
1995
|
-
* field ("Search bar" → Sizes says it *is* an input) and `UnitInput` (so `CurrencyInput` too).
|
|
1996
|
-
* `SearchBar` used to carry a
|
|
1997
|
-
* hand-copied duplicate of these strings, and the copy drifted — the operator's report was that
|
|
1998
|
-
* the search field "does not behave like the regular input fields", which was exactly that: the
|
|
1999
|
-
* copy had lost the radius variable and the mobile type-size rule, so the field rounded and
|
|
2000
|
-
* resized differently from every `Input` beside it.
|
|
2001
|
-
*
|
|
2002
|
-
* So the recipes live here and the three components import them. What a component may add is its
|
|
2003
|
-
* own **delta** — a pill radius, a different padding for an icon it draws itself — never a second
|
|
2004
|
-
* copy of the box.
|
|
2005
|
-
*
|
|
2006
|
-
* Nothing here is exported from the package: a consumer restyles through `class`, `classes`, tokens and
|
|
2007
|
-
* the per-component CSS variables (see the README's Customisation section), not by importing our
|
|
2008
|
-
* class strings, which are not a stable API.
|
|
2009
|
-
*/
|
|
2010
|
-
/**
|
|
2011
|
-
* The shared box (spec "Input" → Anatomy, Sizes, States). The `<input>` *is* the field box — the
|
|
2012
|
-
* anatomy calls it "the native `<input>`, full width" — so the border, the radius and the one
|
|
2013
|
-
* focus ring all live on it, and any leading or trailing decoration is absolutely positioned over
|
|
2014
|
-
* the padding the sizes reserve for it.
|
|
2015
|
-
*
|
|
2016
|
-
* `eldra-focus-always` is the text-field rule from the focus-ring foundation: the ring shows on
|
|
2017
|
-
* *any* focus, pointer included, "because a caret alone is easy to miss". There is deliberately no
|
|
2018
|
-
* `transition-*`/`duration-*` utility beside it — `eldra-focus` owns this element's transition
|
|
2019
|
-
* list, including the `duration-fast` border-colour change the spec's Behaviour section asks for.
|
|
2020
|
-
* See `src/styles/tailwind.css` and `src/__tests__/focus-transition.spec.ts`.
|
|
2021
|
-
*/
|
|
2022
|
-
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";
|
|
2023
|
-
/** The box's radius, apart so a field with a radius of its own (`SearchBar`'s pill) takes one. */
|
|
2024
|
-
var FIELD_RADIUS = "eldra:rounded-[var(--eldra-input-radius,var(--eldra-radius-md))]";
|
|
2025
|
-
var FIELD_BASE = `${FIELD_BOX} ${FIELD_RADIUS}`;
|
|
2026
|
-
/**
|
|
2027
|
-
* The type style per size (spec "Input" → Sizes). Its own constant because `SearchBar`'s two sizes
|
|
2028
|
-
* take exactly these rules while its paddings are its own — the `max-md:text-control-mobile`
|
|
2029
|
-
* override in particular, which is a *viewport* rule (so iOS never zooms into a focused field) and
|
|
2030
|
-
* is the half that had gone missing from the copy.
|
|
2031
|
-
*/
|
|
2032
|
-
var FIELD_TEXT = {
|
|
2033
|
-
sm: "eldra:text-control-sm",
|
|
2034
|
-
md: "eldra:text-control eldra:max-md:text-control-mobile",
|
|
2035
|
-
lg: "eldra:text-control-lg"
|
|
2036
|
-
};
|
|
2037
|
-
/**
|
|
2038
|
-
* Sizes (spec "Input" → Sizes). `--spacing` is 0.25rem, so `py-0.75`/`px-2.25` are the spec's
|
|
2039
|
-
* 0.1875/0.5625rem, `py-1.75`/`px-2.75` its 0.4375/0.6875rem and `py-2.75` its 0.6875rem.
|
|
2040
|
-
* The 1.5rem line comes from the `text-control*` utilities, so the value sits on the spec's line
|
|
2041
|
-
* inside the spec's box at every size.
|
|
2042
|
-
*/
|
|
2043
|
-
var FIELD_SIZE = {
|
|
2044
|
-
sm: `eldra:control-h-sm eldra:py-0.75 eldra:px-2.25 ${FIELD_TEXT.sm}`,
|
|
2045
|
-
md: `eldra:control-h eldra:py-1.75 eldra:px-2.75 ${FIELD_TEXT.md}`,
|
|
2046
|
-
lg: `eldra:control-h-lg eldra:py-2.75 eldra:px-2.75 ${FIELD_TEXT.lg}`
|
|
2047
|
-
};
|
|
2048
|
-
var FIELD_TRAILING_PAD = {
|
|
2049
|
-
sm: "eldra:pe-8",
|
|
2050
|
-
md: "eldra:pe-10",
|
|
2051
|
-
lg: "eldra:pe-10"
|
|
2052
|
-
};
|
|
2053
|
-
var FIELD_CLEAR_SIZE = {
|
|
2054
|
-
sm: "eldra:size-6",
|
|
2055
|
-
md: "eldra:size-8",
|
|
2056
|
-
lg: "eldra:size-8"
|
|
2057
|
-
};
|
|
2058
|
-
/**
|
|
2059
|
-
* Two trailing actions (operator report, 2026-09-25; recorded under Deviations in the README): a
|
|
2060
|
-
* `UnitInput`/`CurrencyInput` with `clearable` and a drag handle both on showed `$1,234,567.89 ×
|
|
2061
|
-
* ↕` — each action a full 2rem square around a 1.125rem icon, `gap-1` between them, so the two
|
|
2062
|
-
* icons ended up roughly 1.1rem apart, far wider than any other icon pair in the library (the
|
|
2063
|
-
* private library's own handle sits `px-0` beside the clear button, no gap at all).
|
|
2064
|
-
*
|
|
2065
|
-
* A single action keeps `FIELD_TRAILING_PAD`/`FIELD_CLEAR_SIZE` unchanged (`Input`'s and
|
|
2066
|
-
* `SearchBar`'s only ever have one, and their rendered classes must not change). With two, the row
|
|
2067
|
-
* itself carries no gap (`FIELD_SUFFIX_ROW` below), each action shrinks to `w-6` (1.5rem — still
|
|
2068
|
-
* the WCAG 2.5.8 24px minimum) at the row's own height, and the control's end padding grows to fit
|
|
2069
|
-
* both of them plus the row's own 0.25rem inset from the edge.
|
|
2070
|
-
*/
|
|
2071
|
-
var FIELD_TRAILING_PAD_PAIR = {
|
|
2072
|
-
sm: "eldra:pe-14",
|
|
2073
|
-
md: "eldra:pe-14",
|
|
2074
|
-
lg: "eldra:pe-14"
|
|
2075
|
-
};
|
|
2076
|
-
var FIELD_ACTION_PAIR_SIZE = {
|
|
2077
|
-
sm: "eldra:w-6 eldra:h-6",
|
|
2078
|
-
md: "eldra:w-6 eldra:h-8",
|
|
2079
|
-
lg: "eldra:w-6 eldra:h-8"
|
|
2080
|
-
};
|
|
2081
|
-
/**
|
|
2082
|
-
* States (spec "Input" → States). Disabled and read-only replace the live colours outright rather
|
|
2083
|
-
* than layering over them, so a `:hover` rule can never win back a live boundary on a dead field.
|
|
2084
|
-
* The error row's second 1px line is the ring's own outline at rest (`eldra-field-invalid`, on the
|
|
2085
|
-
* control beside this recipe). Each recipe carries the
|
|
2086
|
-
* fill, the text colour and the boundary, so a field renders exactly one of each: `fieldState`
|
|
2087
|
-
* picks the one recipe a field is in.
|
|
2088
|
-
*/
|
|
2089
|
-
var FIELD_LIVE_FILL = "eldra:bg-background eldra:text-text";
|
|
2090
|
-
var FIELD_READONLY_FILL = "eldra:bg-surface eldra:text-text";
|
|
2091
|
-
var FIELD_LIVE = `${FIELD_LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
|
|
2092
|
-
/** The error boundary alone; `fieldState` pairs it with the live or the read-only fill. */
|
|
2093
|
-
var FIELD_INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
|
|
2094
|
-
var FIELD_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
2095
|
-
var FIELD_READONLY = `${FIELD_READONLY_FILL} eldra:border-border`;
|
|
2096
|
-
/** The one state recipe a field box is in. `invalid` is the shown error, never set while disabled. */
|
|
2097
|
-
function fieldState(state) {
|
|
2098
|
-
if (state.disabled) return FIELD_DISABLED;
|
|
2099
|
-
if (state.readonly) return state.invalid ? `${FIELD_READONLY_FILL} ${FIELD_INVALID}` : FIELD_READONLY;
|
|
2100
|
-
return state.invalid ? `${FIELD_LIVE_FILL} ${FIELD_INVALID}` : FIELD_LIVE;
|
|
2101
|
-
}
|
|
2102
|
-
/** Spec "Input" → Variants, `search`: "The browser's own clear button is hidden." */
|
|
2103
|
-
var FIELD_SEARCH_APPEARANCE = "eldra:[&::-webkit-search-cancel-button]:appearance-none eldra:[&::-webkit-search-decoration]:appearance-none";
|
|
2104
|
-
/**
|
|
2105
|
-
* A ghost icon button at the field's end edge (spec "Input" → Anatomy): square, `muted`, the ring.
|
|
2106
|
-
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README): Tailwind
|
|
2107
|
-
* v4's preflight sets `button { cursor: default }`, so without it every clear button in the
|
|
2108
|
-
* package — `Input`'s, `SearchBar`'s and `UnitInput`'s (`CurrencyInput` wraps the last) — showed
|
|
2109
|
-
* the default arrow rather than a pointer.
|
|
2110
|
-
*/
|
|
2111
|
-
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";
|
|
2112
|
-
/** The whole button. A field that shows or rounds it its own way takes `FIELD_CLEAR_BUTTON_BOX`. */
|
|
2113
|
-
var FIELD_CLEAR_BUTTON = `eldra:inline-flex ${FIELD_CLEAR_BUTTON_BOX} eldra:rounded-[var(--eldra-radius-sm)]`;
|
|
2114
|
-
/** 1.125rem, `muted`, 0.6875rem from the start edge, and out of the pointer's way. */
|
|
2115
|
-
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";
|
|
2116
|
-
/**
|
|
2117
|
-
* The end-edge area, 0.25rem from the edge (spec "Input" → Anatomy, "Trailing action"). The clear
|
|
2118
|
-
* button and the `suffix` slot share it, so a field that has both keeps them on one row in reading
|
|
2119
|
-
* order — which is also the tab order the Keyboard table asks for: the input first, the clear
|
|
2120
|
-
* button next.
|
|
2121
|
-
*
|
|
2122
|
-
* `gap-1` is the shared default: `Input`'s own doc comment documents `clearable`/`type="search"`
|
|
2123
|
-
* plus a populated `suffix` slot as first-class ("the clear button and the `suffix` slot share it,
|
|
2124
|
-
* so a field with both keeps them on one row"), and this constant is `Input`'s and `SearchBar`'s
|
|
2125
|
-
* row too — dropping the gap here would silently change `Input`'s rendered output for that
|
|
2126
|
-
* combination, which an early review caught. Only `UnitInput`'s two-action pair (see
|
|
2127
|
-
* `FIELD_TRAILING_PAD_PAIR` above) wants flush icons, and it builds its row from
|
|
2128
|
-
* `FIELD_SUFFIX_ROW_BASE` with `gap-0` rather than changing the shared default.
|
|
2129
|
-
*/
|
|
2130
|
-
var FIELD_SUFFIX_ROW_BASE = "eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center";
|
|
2131
|
-
var FIELD_SUFFIX_ROW = `${FIELD_SUFFIX_ROW_BASE} eldra:gap-1`;
|
|
2132
|
-
/**
|
|
2133
|
-
* The start-edge mirror of `FIELD_SUFFIX_ROW`, for the `prefix` slot: interactive content (a
|
|
2134
|
-
* calendar button) 0.25rem from the start edge, so unlike `FIELD_LEADING_ICON` it keeps the pointer.
|
|
2135
|
-
*/
|
|
2136
|
-
var FIELD_PREFIX_ROW = "eldra:absolute eldra:start-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center eldra:gap-1";
|
|
2137
|
-
/** The start padding a `prefix` row reserves: the trailing action's room, mirrored. */
|
|
2138
|
-
var FIELD_PREFIX_PAD = {
|
|
2139
|
-
sm: "eldra:ps-8",
|
|
2140
|
-
md: "eldra:ps-10",
|
|
2141
|
-
lg: "eldra:ps-10"
|
|
2142
|
-
};
|
|
2143
|
-
/** `FIELD_TRAILING_PAD`/`FIELD_PREFIX_PAD` in rem, for `useAdornmentRoom`'s comparison. */
|
|
2144
|
-
var FIELD_ACTION_ROOM_REM = {
|
|
2145
|
-
sm: 2,
|
|
2146
|
-
md: 2.5,
|
|
2147
|
-
lg: 2.5
|
|
2148
|
-
};
|
|
2149
1513
|
// src/components/unit-input/undo-redo.ts
|
|
2150
1514
|
function useUndoRedo(value) {
|
|
2151
1515
|
const undo = ref([]);
|
|
@@ -2203,10 +1567,10 @@ function useUndoRedo(value) {
|
|
|
2203
1567
|
return { onKeydown };
|
|
2204
1568
|
}
|
|
2205
1569
|
// src/components/unit-input/UnitInput.vue?vue&type=script&setup=true&lang.ts
|
|
2206
|
-
var _hoisted_1$
|
|
2207
|
-
var _hoisted_2$
|
|
2208
|
-
var _hoisted_3$
|
|
2209
|
-
var _hoisted_4$
|
|
1570
|
+
var _hoisted_1$12 = ["data-eldra-scope"];
|
|
1571
|
+
var _hoisted_2$12 = ["for"];
|
|
1572
|
+
var _hoisted_3$12 = ["data-eldra-slot"];
|
|
1573
|
+
var _hoisted_4$11 = [
|
|
2210
1574
|
"id",
|
|
2211
1575
|
"value",
|
|
2212
1576
|
"placeholder",
|
|
@@ -2216,10 +1580,10 @@ var _hoisted_4$12 = [
|
|
|
2216
1580
|
"aria-invalid",
|
|
2217
1581
|
"aria-describedby"
|
|
2218
1582
|
];
|
|
2219
|
-
var _hoisted_5$
|
|
2220
|
-
var _hoisted_6$
|
|
2221
|
-
var _hoisted_7$
|
|
2222
|
-
var _hoisted_8$
|
|
1583
|
+
var _hoisted_5$9 = ["name", "value"];
|
|
1584
|
+
var _hoisted_6$7 = ["data-eldra-slot"];
|
|
1585
|
+
var _hoisted_7$5 = ["data-eldra-scope", "aria-label"];
|
|
1586
|
+
var _hoisted_8$3 = ["data-eldra-scope"];
|
|
2223
1587
|
var VALUE_DRAG_PIXELS_PER_STEP = 8;
|
|
2224
1588
|
/**
|
|
2225
1589
|
* `Number.MAX_SAFE_INTEGER`, written out. A property access in a prop default is a member
|
|
@@ -2811,7 +2175,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2811
2175
|
"data-part": "label",
|
|
2812
2176
|
for: unref(controlId),
|
|
2813
2177
|
class: normalizeClass(labelClass.value)
|
|
2814
|
-
}, toDisplayString(__props.label), 11, _hoisted_2$
|
|
2178
|
+
}, toDisplayString(__props.label), 11, _hoisted_2$12)) : createCommentVNode("", true), createElementVNode("span", {
|
|
2815
2179
|
"data-part": "field",
|
|
2816
2180
|
class: normalizeClass(fieldClass.value)
|
|
2817
2181
|
}, [
|
|
@@ -2826,7 +2190,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2826
2190
|
"stroke-width": unref(ICON_STROKE_WIDTH$1),
|
|
2827
2191
|
"aria-hidden": "true",
|
|
2828
2192
|
focusable: "false"
|
|
2829
|
-
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$
|
|
2193
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$12)) : createCommentVNode("", true),
|
|
2830
2194
|
createElementVNode("input", mergeProps({
|
|
2831
2195
|
ref_key: "controlRef",
|
|
2832
2196
|
ref: controlRef
|
|
@@ -2854,13 +2218,13 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2854
2218
|
onDblclick: onDoubleClick,
|
|
2855
2219
|
onFocus,
|
|
2856
2220
|
onBlur
|
|
2857
|
-
}), null, 16, _hoisted_4$
|
|
2221
|
+
}), null, 16, _hoisted_4$11),
|
|
2858
2222
|
__props.name ? (openBlock(), createElementBlock("input", {
|
|
2859
2223
|
key: 1,
|
|
2860
2224
|
type: "hidden",
|
|
2861
2225
|
name: __props.name,
|
|
2862
2226
|
value: numericModel.value ?? ""
|
|
2863
|
-
}, null, 8, _hoisted_5$
|
|
2227
|
+
}, null, 8, _hoisted_5$9)) : createCommentVNode("", true),
|
|
2864
2228
|
hasTrailing.value ? (openBlock(), createElementBlock("span", {
|
|
2865
2229
|
key: 2,
|
|
2866
2230
|
"data-eldra-slot": unref(eldra).slotHost("suffix"),
|
|
@@ -2886,7 +2250,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2886
2250
|
"stroke-linejoin": "round",
|
|
2887
2251
|
"aria-hidden": "true",
|
|
2888
2252
|
focusable: "false"
|
|
2889
|
-
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 42, _hoisted_7$
|
|
2253
|
+
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 42, _hoisted_7$5)) : createCommentVNode("", true),
|
|
2890
2254
|
showDragHandle.value ? (openBlock(), createElementBlock("button", {
|
|
2891
2255
|
key: 1,
|
|
2892
2256
|
ref_key: "dragHandleRef",
|
|
@@ -2914,10 +2278,10 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2914
2278
|
createElementVNode("path", { d: "M12 3l0 18" }),
|
|
2915
2279
|
createElementVNode("path", { d: "M15 6l-3 -3l-3 3" }),
|
|
2916
2280
|
createElementVNode("path", { d: "M15 18l-3 3l-3 -3" })
|
|
2917
|
-
], -1)])], 42, _hoisted_8$
|
|
2281
|
+
], -1)])], 42, _hoisted_8$3)) : createCommentVNode("", true),
|
|
2918
2282
|
renderSlot(_ctx.$slots, "suffix")
|
|
2919
|
-
], 10, _hoisted_6$
|
|
2920
|
-
], 2)], 10, _hoisted_1$
|
|
2283
|
+
], 10, _hoisted_6$7)) : createCommentVNode("", true)
|
|
2284
|
+
], 2)], 10, _hoisted_1$12);
|
|
2921
2285
|
};
|
|
2922
2286
|
}
|
|
2923
2287
|
});
|
|
@@ -3175,10 +2539,10 @@ function useAdornmentRoom(row, reservedRem) {
|
|
|
3175
2539
|
});
|
|
3176
2540
|
}
|
|
3177
2541
|
// src/components/input/Input.vue?vue&type=script&setup=true&lang.ts
|
|
3178
|
-
var _hoisted_1$
|
|
3179
|
-
var _hoisted_2$
|
|
3180
|
-
var _hoisted_3$
|
|
3181
|
-
var _hoisted_4$
|
|
2542
|
+
var _hoisted_1$11 = ["data-eldra-scope"];
|
|
2543
|
+
var _hoisted_2$11 = ["data-eldra-slot"];
|
|
2544
|
+
var _hoisted_3$11 = ["data-eldra-slot"];
|
|
2545
|
+
var _hoisted_4$10 = [
|
|
3182
2546
|
"id",
|
|
3183
2547
|
"name",
|
|
3184
2548
|
"type",
|
|
@@ -3195,8 +2559,8 @@ var _hoisted_4$11 = [
|
|
|
3195
2559
|
"aria-invalid",
|
|
3196
2560
|
"aria-describedby"
|
|
3197
2561
|
];
|
|
3198
|
-
var _hoisted_5$
|
|
3199
|
-
var _hoisted_6$
|
|
2562
|
+
var _hoisted_5$8 = ["data-eldra-slot"];
|
|
2563
|
+
var _hoisted_6$6 = ["data-eldra-scope", "aria-label"];
|
|
3200
2564
|
var rootClass$5 = "eldra:relative eldra:block eldra:w-full";
|
|
3201
2565
|
// src/components/input/Input.vue
|
|
3202
2566
|
var Input_default = /* @__PURE__ */ defineComponent({
|
|
@@ -3409,7 +2773,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3409
2773
|
"data-eldra-slot": unref(eldra).slotHost("prefix"),
|
|
3410
2774
|
"data-part": "prefix",
|
|
3411
2775
|
class: normalizeClass(prefixClass.value)
|
|
3412
|
-
}, [renderSlot(_ctx.$slots, "prefix")], 10, _hoisted_2$
|
|
2776
|
+
}, [renderSlot(_ctx.$slots, "prefix")], 10, _hoisted_2$11)) : hasLeading.value ? (openBlock(), createElementBlock("span", {
|
|
3413
2777
|
key: 1,
|
|
3414
2778
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
3415
2779
|
"data-part": "leadingIcon",
|
|
@@ -3420,7 +2784,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3420
2784
|
"stroke-width": unref(ICON_STROKE_WIDTH$1),
|
|
3421
2785
|
"aria-hidden": "true",
|
|
3422
2786
|
focusable: "false"
|
|
3423
|
-
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$
|
|
2787
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$11)) : createCommentVNode("", true),
|
|
3424
2788
|
createElementVNode("input", mergeProps({
|
|
3425
2789
|
ref_key: "controlRef",
|
|
3426
2790
|
ref: controlRef
|
|
@@ -3449,7 +2813,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3449
2813
|
onInput,
|
|
3450
2814
|
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
3451
2815
|
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
|
|
3452
|
-
}), null, 16, _hoisted_4$
|
|
2816
|
+
}), null, 16, _hoisted_4$10),
|
|
3453
2817
|
hasTrailing.value ? (openBlock(), createElementBlock("span", {
|
|
3454
2818
|
key: 2,
|
|
3455
2819
|
ref_key: "suffixRef",
|
|
@@ -3475,8 +2839,8 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3475
2839
|
"stroke-linejoin": "round",
|
|
3476
2840
|
"aria-hidden": "true",
|
|
3477
2841
|
focusable: "false"
|
|
3478
|
-
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 10, _hoisted_6$
|
|
3479
|
-
], 10, _hoisted_1$
|
|
2842
|
+
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 10, _hoisted_6$6)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "suffix")], 10, _hoisted_5$8)) : createCommentVNode("", true)
|
|
2843
|
+
], 10, _hoisted_1$11);
|
|
3480
2844
|
};
|
|
3481
2845
|
}
|
|
3482
2846
|
});
|
|
@@ -3566,7 +2930,7 @@ function filterNumericBeforeInput(event, options = {}) {
|
|
|
3566
2930
|
return true;
|
|
3567
2931
|
}
|
|
3568
2932
|
// src/components/switch/Switch.vue?vue&type=script&setup=true&lang.ts
|
|
3569
|
-
var _hoisted_1$
|
|
2933
|
+
var _hoisted_1$10 = [
|
|
3570
2934
|
"data-eldra-scope",
|
|
3571
2935
|
"id",
|
|
3572
2936
|
"aria-checked",
|
|
@@ -3574,12 +2938,12 @@ var _hoisted_1$11 = [
|
|
|
3574
2938
|
"aria-invalid",
|
|
3575
2939
|
"disabled"
|
|
3576
2940
|
];
|
|
3577
|
-
var _hoisted_2$
|
|
3578
|
-
var _hoisted_3$
|
|
3579
|
-
var _hoisted_4$
|
|
3580
|
-
var _hoisted_5$
|
|
3581
|
-
var _hoisted_6$
|
|
3582
|
-
var _hoisted_7$
|
|
2941
|
+
var _hoisted_2$10 = ["data-eldra-slot"];
|
|
2942
|
+
var _hoisted_3$10 = ["data-eldra-slot"];
|
|
2943
|
+
var _hoisted_4$9 = ["data-eldra-slot"];
|
|
2944
|
+
var _hoisted_5$7 = ["data-eldra-slot"];
|
|
2945
|
+
var _hoisted_6$5 = ["data-eldra-slot", "id"];
|
|
2946
|
+
var _hoisted_7$4 = [
|
|
3583
2947
|
"data-eldra-scope",
|
|
3584
2948
|
"name",
|
|
3585
2949
|
"checked",
|
|
@@ -3826,14 +3190,14 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3826
3190
|
"data-part": "trackStart",
|
|
3827
3191
|
"aria-hidden": "true",
|
|
3828
3192
|
class: normalizeClass(trackStartClass.value)
|
|
3829
|
-
}, [renderSlot(_ctx.$slots, "trackStart", normalizeProps(guardReactiveProps(slotProps.value)))], 10, _hoisted_2$
|
|
3193
|
+
}, [renderSlot(_ctx.$slots, "trackStart", normalizeProps(guardReactiveProps(slotProps.value)))], 10, _hoisted_2$10)) : createCommentVNode("", true),
|
|
3830
3194
|
_ctx.$slots.trackEnd ? (openBlock(), createElementBlock("span", {
|
|
3831
3195
|
key: 1,
|
|
3832
3196
|
"data-eldra-slot": unref(eldra).slotHost("trackEnd"),
|
|
3833
3197
|
"data-part": "trackEnd",
|
|
3834
3198
|
"aria-hidden": "true",
|
|
3835
3199
|
class: normalizeClass(trackEndClass.value)
|
|
3836
|
-
}, [renderSlot(_ctx.$slots, "trackEnd", normalizeProps(guardReactiveProps(slotProps.value)))], 10, _hoisted_3$
|
|
3200
|
+
}, [renderSlot(_ctx.$slots, "trackEnd", normalizeProps(guardReactiveProps(slotProps.value)))], 10, _hoisted_3$10)) : createCommentVNode("", true),
|
|
3837
3201
|
createElementVNode("span", {
|
|
3838
3202
|
"data-part": "thumb",
|
|
3839
3203
|
class: normalizeClass(thumbClass.value)
|
|
@@ -3842,7 +3206,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3842
3206
|
"data-eldra-slot": unref(eldra).slotHost("thumb"),
|
|
3843
3207
|
"aria-hidden": "true",
|
|
3844
3208
|
class: "eldra:pointer-events-none eldra:inline-flex"
|
|
3845
|
-
}, [renderSlot(_ctx.$slots, "thumb", normalizeProps(guardReactiveProps(slotProps.value)))], 8, _hoisted_4$
|
|
3209
|
+
}, [renderSlot(_ctx.$slots, "thumb", normalizeProps(guardReactiveProps(slotProps.value)))], 8, _hoisted_4$9)) : unref(model) ? (openBlock(), createElementBlock("svg", {
|
|
3846
3210
|
key: 1,
|
|
3847
3211
|
class: normalizeClass(checkClass.value),
|
|
3848
3212
|
viewBox: "0 0 12 12",
|
|
@@ -3870,7 +3234,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3870
3234
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).required), 1)]),
|
|
3871
3235
|
_: 1
|
|
3872
3236
|
})) : createCommentVNode("", true)
|
|
3873
|
-
], 10, _hoisted_5$
|
|
3237
|
+
], 10, _hoisted_5$7)) : createCommentVNode("", true),
|
|
3874
3238
|
hasDescription.value ? (openBlock(), createElementBlock("span", {
|
|
3875
3239
|
key: 1,
|
|
3876
3240
|
"data-eldra-slot": unref(eldra).slotHost("description"),
|
|
@@ -3878,8 +3242,8 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3878
3242
|
"data-part": "description",
|
|
3879
3243
|
"aria-hidden": "true",
|
|
3880
3244
|
class: normalizeClass(descriptionClass.value)
|
|
3881
|
-
}, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 10, _hoisted_6$
|
|
3882
|
-
], 16, _hoisted_1$
|
|
3245
|
+
}, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 10, _hoisted_6$5)) : createCommentVNode("", true)
|
|
3246
|
+
], 16, _hoisted_1$10), createElementVNode("input", {
|
|
3883
3247
|
"data-eldra-ui": "",
|
|
3884
3248
|
"data-eldra-scope": unref(eldra).scope,
|
|
3885
3249
|
type: "checkbox",
|
|
@@ -3889,7 +3253,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3889
3253
|
name: __props.name,
|
|
3890
3254
|
checked: unref(model),
|
|
3891
3255
|
disabled: __props.disabled || void 0
|
|
3892
|
-
}, null, 8, _hoisted_7$
|
|
3256
|
+
}, null, 8, _hoisted_7$4)]),
|
|
3893
3257
|
_: 3
|
|
3894
3258
|
});
|
|
3895
3259
|
};
|
|
@@ -3909,7 +3273,7 @@ function focusInvalid(element) {
|
|
|
3909
3273
|
(element.matches("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [href], [tabindex]:not([tabindex=\"-1\"])") ? element : element.querySelector("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [href], [tabindex]:not([tabindex=\"-1\"])") ?? element).focus();
|
|
3910
3274
|
}
|
|
3911
3275
|
// src/components/form-layout/FormLayout.vue?vue&type=script&setup=true&lang.ts
|
|
3912
|
-
var _hoisted_1$
|
|
3276
|
+
var _hoisted_1$9 = [
|
|
3913
3277
|
"data-eldra-scope",
|
|
3914
3278
|
"action",
|
|
3915
3279
|
"method",
|
|
@@ -3917,9 +3281,9 @@ var _hoisted_1$10 = [
|
|
|
3917
3281
|
"aria-labelledby",
|
|
3918
3282
|
"aria-label"
|
|
3919
3283
|
];
|
|
3920
|
-
var _hoisted_2$
|
|
3921
|
-
var _hoisted_3$
|
|
3922
|
-
var _hoisted_4$
|
|
3284
|
+
var _hoisted_2$9 = ["data-eldra-slot"];
|
|
3285
|
+
var _hoisted_3$9 = ["data-eldra-slot"];
|
|
3286
|
+
var _hoisted_4$8 = ["data-eldra-slot"];
|
|
3923
3287
|
var ROOT_BASE$1 = "eldra:@container eldra:w-full";
|
|
3924
3288
|
/**
|
|
3925
3289
|
* Spec "Form layout" → Anatomy: "form (grid, 1rem row gap)". The inline form is the one exception:
|
|
@@ -4125,18 +3489,18 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4125
3489
|
], -1)), createElementVNode("div", {
|
|
4126
3490
|
"data-eldra-slot": unref(eldra).slotHost("errorSummary"),
|
|
4127
3491
|
class: "eldra:min-w-0"
|
|
4128
|
-
}, [renderSlot(_ctx.$slots, "errorSummary")], 8, _hoisted_2$
|
|
3492
|
+
}, [renderSlot(_ctx.$slots, "errorSummary")], 8, _hoisted_2$9)], 2)) : createCommentVNode("", true),
|
|
4129
3493
|
createElementVNode("div", {
|
|
4130
3494
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
4131
3495
|
"data-part": "fields",
|
|
4132
3496
|
class: normalizeClass(fieldsClass.value)
|
|
4133
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_3$
|
|
3497
|
+
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_3$9),
|
|
4134
3498
|
hasActions.value ? (openBlock(), createElementBlock("div", {
|
|
4135
3499
|
key: 2,
|
|
4136
3500
|
"data-eldra-slot": unref(eldra).slotHost("actions"),
|
|
4137
3501
|
"data-part": "actions",
|
|
4138
3502
|
class: normalizeClass(actionsClass.value)
|
|
4139
|
-
}, [renderSlot(_ctx.$slots, "actions")], 10, _hoisted_4$
|
|
3503
|
+
}, [renderSlot(_ctx.$slots, "actions")], 10, _hoisted_4$8)) : createCommentVNode("", true),
|
|
4140
3504
|
createVNode(VisuallyHidden_default, {
|
|
4141
3505
|
as: "p",
|
|
4142
3506
|
"data-part": "status",
|
|
@@ -4147,587 +3511,28 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4147
3511
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.statusMessage), 1)]),
|
|
4148
3512
|
_: 1
|
|
4149
3513
|
}, 8, ["class"])
|
|
4150
|
-
], 42, _hoisted_1$
|
|
3514
|
+
], 42, _hoisted_1$9);
|
|
4151
3515
|
};
|
|
4152
3516
|
}
|
|
4153
3517
|
});
|
|
4154
|
-
// src/components/select/
|
|
4155
|
-
|
|
4156
|
-
* Every class the **panel** of a select draws, in one place, because `Select` and `MultiSelect`
|
|
4157
|
-
* draw the same panel. They are plain functions rather than computeds so that both `SelectPanel`
|
|
4158
|
-
* (which renders the panel) and a trigger (which reuses an option's swatch and icon for the chosen
|
|
4159
|
-
* option's mark) can call them.
|
|
4160
|
-
*
|
|
4161
|
-
* Each returns a Vue class value with the consumer's per-part classes appended last.
|
|
4162
|
-
*/
|
|
4163
|
-
/**
|
|
4164
|
-
* The popover (spec "Select" → Sizes, Popover row). Not a dialog: it is a non-modal popup
|
|
4165
|
-
* (non-negotiable 2), positioned by `useFloating` against the trigger.
|
|
4166
|
-
*
|
|
4167
|
-
* It is **teleported** — to `body`, or to the open `<dialog>` the control sits in — so that no
|
|
4168
|
-
* ancestor's `overflow: hidden` clips it and no later stacking context paints over it. `absolute`
|
|
4169
|
-
* stays in the class list because it is what a `teleport: false` panel needs; the inline
|
|
4170
|
-
* `position` `useFloating` writes (`fixed` once teleported) is on the element itself and wins
|
|
4171
|
-
* over it either way. `z-popover` puts it over the sticky header, `overflow-hidden` keeps the
|
|
4172
|
-
* search field's top corners on the popover's radius, and the list — not the panel — is what
|
|
4173
|
-
* scrolls.
|
|
4174
|
-
*
|
|
4175
|
-
* Because the panel leaves the control's subtree, a consumer's `classes`/`data-part` styling still
|
|
4176
|
-
* reaches it (both are on the element), but a **descendant selector rooted above the control does
|
|
4177
|
-
* not**, and neither do custom properties set on a wrapper: set `--eldra-*` overrides on `:root`
|
|
4178
|
-
* (or on the teleport target), which is what the README's Customisation section already asks for.
|
|
4179
|
-
*/
|
|
4180
|
-
function panelClass(classes) {
|
|
4181
|
-
return [
|
|
4182
|
-
"eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-hidden",
|
|
4183
|
-
"eldra:eldra-select-panel-height eldra:eldra-select-panel-width",
|
|
4184
|
-
"eldra:rounded-md eldra:border eldra:shadow-md",
|
|
4185
|
-
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
4186
|
-
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
4187
|
-
"eldra:text-[color:var(--eldra-select-panel-text)]",
|
|
4188
|
-
"eldra:animate-eldra-popover-in",
|
|
4189
|
-
classes?.panel
|
|
4190
|
-
];
|
|
4191
|
-
}
|
|
4192
|
-
/**
|
|
4193
|
-
* Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem. No focus ring (a README
|
|
4194
|
-
* Deviation): focus sits here whenever the panel is open, so the caret and the active row show it.
|
|
4195
|
-
*/
|
|
4196
|
-
function searchClass(classes) {
|
|
4197
|
-
return [
|
|
4198
|
-
"eldra:control-h eldra:w-full eldra:min-w-0 eldra:rounded-t-md eldra:bg-transparent eldra:ps-8.5 eldra:pe-3",
|
|
4199
|
-
"eldra:text-control-sm eldra:max-md:text-control-mobile",
|
|
4200
|
-
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
4201
|
-
"eldra:placeholder:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4202
|
-
"eldra:outline-none",
|
|
4203
|
-
classes?.search
|
|
4204
|
-
];
|
|
4205
|
-
}
|
|
4206
|
-
function listboxClass(classes, hasOptions) {
|
|
4207
|
-
return [
|
|
4208
|
-
"eldra:overflow-y-auto eldra:overscroll-contain",
|
|
4209
|
-
hasOptions ? "eldra:min-h-0 eldra:flex-1 eldra:p-1" : "eldra:h-0",
|
|
4210
|
-
classes?.listbox
|
|
4211
|
-
];
|
|
4212
|
-
}
|
|
4213
|
-
/** Spec: "Every group after the first gets a 1px `border` hairline and 0.25rem gap above it." */
|
|
4214
|
-
function groupClass(classes, index) {
|
|
4215
|
-
return [index > 0 && "eldra:mt-1 eldra:border-t eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]", classes?.group];
|
|
4216
|
-
}
|
|
4217
|
-
function groupLabelClass(classes, index) {
|
|
4218
|
-
return [
|
|
4219
|
-
"eldra:text-select-group eldra:px-2 eldra:pb-1",
|
|
4220
|
-
"eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4221
|
-
index > 0 ? "eldra:pt-2.5" : "eldra:pt-2",
|
|
4222
|
-
classes?.groupLabel
|
|
4223
|
-
];
|
|
4224
|
-
}
|
|
4225
|
-
/**
|
|
4226
|
-
* Spec "Select" → Sizes, Option row, and → States for active / selected / disabled.
|
|
4227
|
-
*
|
|
4228
|
-
* `multiple` is the one difference the spec draws between the two controls' rows: a multi-select's
|
|
4229
|
-
* selection is carried by the filled box, so its label is "weight 500 (not 600)" (spec
|
|
4230
|
-
* "Multi-select" → States, Option selected).
|
|
4231
|
-
*/
|
|
4232
|
-
function optionClass(classes, option, state) {
|
|
4233
|
-
return [
|
|
4234
|
-
"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",
|
|
4235
|
-
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4236
|
-
state.selected && (state.multiple ? "eldra:font-medium" : "eldra:font-semibold"),
|
|
4237
|
-
state.selected && "eldra:eldra-select-option-selected",
|
|
4238
|
-
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",
|
|
4239
|
-
classes?.option
|
|
4240
|
-
];
|
|
4241
|
-
}
|
|
4242
|
-
/** A disabled row reads as disabled through the row's `muted` text and cursor, like `Checkbox`. */
|
|
4243
|
-
function optionLabelClass(classes) {
|
|
4244
|
-
return ["eldra:block", classes?.optionLabel];
|
|
4245
|
-
}
|
|
4246
|
-
function optionHintClass(classes) {
|
|
4247
|
-
return ["eldra:text-caption eldra:block eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.optionHint];
|
|
4248
|
-
}
|
|
4249
|
-
var META_TONE = {
|
|
4250
|
-
warning: "eldra:text-warning eldra:font-semibold",
|
|
4251
|
-
danger: "eldra:text-danger eldra:font-semibold"
|
|
4252
|
-
};
|
|
4253
|
-
function optionMetaClass(classes, option) {
|
|
4254
|
-
return [
|
|
4255
|
-
"eldra:ms-3 eldra:shrink-0 eldra:text-caption eldra:tabular-nums",
|
|
4256
|
-
option.metaTone === void 0 ? "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : META_TONE[option.metaTone],
|
|
4257
|
-
classes?.optionMeta
|
|
4258
|
-
];
|
|
4259
|
-
}
|
|
4260
|
-
function optionSwatchClass(classes) {
|
|
4261
|
-
return ["eldra:size-4 eldra:shrink-0 eldra:rounded-full eldra:eldra-select-swatch", classes?.optionSwatch];
|
|
4262
|
-
}
|
|
4263
|
-
function optionIconClass(classes) {
|
|
4264
|
-
return ["eldra:size-4.5 eldra:shrink-0", classes?.optionIcon];
|
|
4265
|
-
}
|
|
4266
|
-
/** Spec "Select" → States, Option selected: "check mark in `text` (never colour alone)". */
|
|
4267
|
-
function optionCheckClass(classes) {
|
|
4268
|
-
return ["eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-check,var(--eldra-color-text))]", classes?.optionCheck];
|
|
4269
|
-
}
|
|
4270
|
-
/**
|
|
4271
|
-
* A multi-select option's checkbox (spec "Multi-select" → Sizes, "Checkbox in option"): "1rem
|
|
4272
|
-
* square, 1.5px `border-strong`, 0.25rem radius, `background` fill. Checked: `primary` fill and
|
|
4273
|
-
* border with a `primary-contrast` tick."
|
|
4274
|
-
*
|
|
4275
|
-
* It is the `optionCheck` part — the same part a single select's check mark is — so "the mark that
|
|
4276
|
-
* says this row is chosen" is one styling hook in both controls. The border width is `Checkbox`'s
|
|
4277
|
-
* own `eldra-checkbox-border`, so a consumer that has restyled their checkboxes' boundary has
|
|
4278
|
-
* restyled these; the radius is the spec's smaller 0.25rem, on its own variable.
|
|
4279
|
-
*/
|
|
4280
|
-
function optionBoxClass(classes, state) {
|
|
4281
|
-
return [
|
|
4282
|
-
"eldra:relative eldra:inline-flex eldra:size-4 eldra:shrink-0 eldra:items-center eldra:justify-center",
|
|
4283
|
-
"eldra:eldra-checkbox-border eldra:eldra-select-check-radius",
|
|
4284
|
-
"eldra:transition-colors eldra:duration-fast eldra:ease-out",
|
|
4285
|
-
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))]",
|
|
4286
|
-
classes?.optionCheck
|
|
4287
|
-
];
|
|
4288
|
-
}
|
|
4289
|
-
/** Spec "Select" → Sizes, Empty state: "0.875rem, `muted`, centred, padding 1rem 0.75rem". */
|
|
4290
|
-
function emptyClass(classes) {
|
|
4291
|
-
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];
|
|
4292
|
-
}
|
|
4293
|
-
/**
|
|
4294
|
-
* The loading row: the empty state's box, with the shared spinner before its text. It stands in
|
|
4295
|
-
* for the list and the empty state while a `loading` control's options are being fetched.
|
|
4296
|
-
*/
|
|
4297
|
-
function loadingClass(classes) {
|
|
4298
|
-
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];
|
|
4299
|
-
}
|
|
4300
|
-
/**
|
|
4301
|
-
* The "Create “query”" row of a `creatable` control: an option row's own box and active fill, with
|
|
4302
|
-
* a `plus` where a row draws its mark. After other rows it sits under a group's hairline (drawn
|
|
4303
|
-
* by `SelectPanel`), so it reads as an action rather than one more match.
|
|
4304
|
-
*/
|
|
4305
|
-
function createOptionClass(classes, state) {
|
|
4306
|
-
return [
|
|
4307
|
-
"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",
|
|
4308
|
-
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:cursor-pointer",
|
|
4309
|
-
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4310
|
-
classes?.createOption
|
|
4311
|
-
];
|
|
4312
|
-
}
|
|
4313
|
-
/**
|
|
4314
|
-
* The tick inside that box (spec "Multi-select" → Sizes: "a `primary-contrast` tick (0.25 × 0.5rem,
|
|
4315
|
-
* 2px stroke)").
|
|
4316
|
-
*
|
|
4317
|
-
* The svg is drawn 0.5rem square — `size-2` on the 0.25rem spacing step — over an 8 × 8 viewBox,
|
|
4318
|
-
* so one viewBox unit is one pixel of the drawn mark and `stroke-width="2"` is the spec's 2px.
|
|
4319
|
-
* (The same relationship `Checkbox` has at its own larger size; a 10-unit viewBox squeezed into
|
|
4320
|
-
* 0.5rem would render that same `2` as 1.6px.) The mark is Tabler's check at 3 : 2 — 0.5 × 0.375rem
|
|
4321
|
-
* of ink rather than the spec's literal 0.5 × 0.25rem, which read flat (see `Checkbox.vue`).
|
|
4322
|
-
*
|
|
4323
|
-
* It is always rendered and scaled from 0, rather than added and removed, so it can grow in over
|
|
4324
|
-
* `duration-fast` the way `Checkbox`'s does.
|
|
4325
|
-
*/
|
|
4326
|
-
function optionTickClass(selected) {
|
|
4327
|
-
return [
|
|
4328
|
-
"eldra:text-[color:var(--eldra-select-panel-check-contrast,var(--eldra-color-primary-contrast))]",
|
|
4329
|
-
"eldra:pointer-events-none eldra:size-2 eldra:transition-transform eldra:duration-fast eldra:ease-out",
|
|
4330
|
-
selected ? "eldra:scale-100" : "eldra:scale-0"
|
|
4331
|
-
];
|
|
4332
|
-
}
|
|
4333
|
-
/**
|
|
4334
|
-
* The cell a trigger stacks its chosen value in, with an invisible copy of the placeholder
|
|
4335
|
-
* (`data-placeholder`, drawn by `::after`) in the same grid cell: a content-sized trigger keeps at
|
|
4336
|
-
* least its placeholder's width once a value is chosen, as a native input keeps its width. The copy
|
|
4337
|
-
* is generated content under `visibility: hidden`, so it adds no text and no accessible name.
|
|
4338
|
-
*/
|
|
4339
|
-
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)]";
|
|
4340
|
-
/** The chosen value inside `TRIGGER_VALUE_STACK`, in the cell the placeholder copy shares. */
|
|
4341
|
-
var TRIGGER_VALUE_CELL = "eldra:col-start-1 eldra:row-start-1";
|
|
4342
|
-
// src/components/select/SelectPanel.vue?vue&type=script&setup=true&lang.ts
|
|
4343
|
-
var _hoisted_1$9 = [
|
|
4344
|
-
"data-eldra-slot",
|
|
3518
|
+
// src/components/select/SelectTags.vue?vue&type=script&setup=true&lang.ts
|
|
3519
|
+
var _hoisted_1$8 = [
|
|
4345
3520
|
"id",
|
|
4346
3521
|
"data-eldra-scope",
|
|
4347
|
-
"data-eldra-overlay-owner",
|
|
4348
|
-
"data-placement"
|
|
4349
|
-
];
|
|
4350
|
-
var _hoisted_2$9 = ["data-eldra-scope"];
|
|
4351
|
-
var _hoisted_3$9 = [
|
|
4352
|
-
"value",
|
|
4353
|
-
"placeholder",
|
|
4354
3522
|
"aria-label",
|
|
4355
|
-
"aria-
|
|
4356
|
-
"aria-activedescendant"
|
|
3523
|
+
"aria-labelledby"
|
|
4357
3524
|
];
|
|
4358
|
-
var
|
|
3525
|
+
var _hoisted_2$8 = ["data-eldra-slot"];
|
|
3526
|
+
var _hoisted_3$8 = ["data-eldra-slot"];
|
|
3527
|
+
var _hoisted_4$7 = { class: "eldra:min-w-0 eldra:truncate" };
|
|
3528
|
+
var _hoisted_5$6 = [
|
|
4359
3529
|
"data-eldra-scope",
|
|
4360
|
-
"id",
|
|
4361
|
-
"aria-multiselectable",
|
|
4362
|
-
"aria-labelledby",
|
|
4363
3530
|
"aria-label",
|
|
4364
|
-
"
|
|
4365
|
-
];
|
|
4366
|
-
var _hoisted_5$7 = [
|
|
4367
|
-
"data-part",
|
|
4368
|
-
"role",
|
|
4369
|
-
"aria-labelledby"
|
|
4370
|
-
];
|
|
4371
|
-
var _hoisted_6$5 = ["id"];
|
|
4372
|
-
var _hoisted_7$4 = [
|
|
4373
|
-
"data-eldra-slot",
|
|
4374
|
-
"id",
|
|
4375
|
-
"aria-selected",
|
|
4376
|
-
"aria-disabled",
|
|
4377
|
-
"onClick",
|
|
4378
|
-
"onMouseenter"
|
|
3531
|
+
"onClick"
|
|
4379
3532
|
];
|
|
4380
|
-
|
|
4381
|
-
var
|
|
4382
|
-
|
|
4383
|
-
var _hoisted_11$3 = ["data-eldra-scope"];
|
|
4384
|
-
var _hoisted_12$3 = ["id"];
|
|
4385
|
-
var _hoisted_13$2 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
4386
|
-
var _hoisted_14$2 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4387
|
-
var _hoisted_15$1 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4388
|
-
var SCROLL_END_SLACK = 80;
|
|
4389
|
-
var FOCUSABLE$1 = "input, button, a[href], textarea, select, [tabindex]:not([tabindex^=\"-\"])";
|
|
4390
|
-
// src/components/select/SelectPanel.vue
|
|
4391
|
-
var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
4392
|
-
__name: "SelectPanel",
|
|
4393
|
-
props: {
|
|
4394
|
-
panelId: {},
|
|
4395
|
-
listboxId: {},
|
|
4396
|
-
sections: {},
|
|
4397
|
-
hasOptions: { type: Boolean },
|
|
4398
|
-
highlights: {},
|
|
4399
|
-
optionId: {},
|
|
4400
|
-
activeValue: { default: void 0 },
|
|
4401
|
-
selectedValues: {},
|
|
4402
|
-
searchable: { type: Boolean },
|
|
4403
|
-
query: {},
|
|
4404
|
-
searchPlaceholder: {},
|
|
4405
|
-
emptyText: {},
|
|
4406
|
-
labelledBy: { default: void 0 },
|
|
4407
|
-
fallbackLabel: { default: void 0 },
|
|
4408
|
-
multiple: {
|
|
4409
|
-
type: Boolean,
|
|
4410
|
-
default: false
|
|
4411
|
-
},
|
|
4412
|
-
loading: {
|
|
4413
|
-
type: Boolean,
|
|
4414
|
-
default: false
|
|
4415
|
-
},
|
|
4416
|
-
loadingText: { default: void 0 },
|
|
4417
|
-
createOption: { default: void 0 },
|
|
4418
|
-
createText: { default: void 0 },
|
|
4419
|
-
panelStyle: { default: void 0 },
|
|
4420
|
-
placement: { default: void 0 },
|
|
4421
|
-
classes: { default: void 0 }
|
|
4422
|
-
},
|
|
4423
|
-
emits: [
|
|
4424
|
-
"search",
|
|
4425
|
-
"select",
|
|
4426
|
-
"activate",
|
|
4427
|
-
"keydown",
|
|
4428
|
-
"scrollEnd"
|
|
4429
|
-
],
|
|
4430
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4431
|
-
const eldra = useEldraScope();
|
|
4432
|
-
/**
|
|
4433
|
-
* The popover a `Select` and a `MultiSelect` both open: the search field, the listbox with its
|
|
4434
|
-
* groups and option rows, and the empty state — plus a `footer` slot, which only a multi-select
|
|
4435
|
-
* fills.
|
|
4436
|
-
*
|
|
4437
|
-
* It exists so that the two controls share one panel rather than two copies of the same markup.
|
|
4438
|
-
* Everything it knows is a prop: it owns no open/closed state, no query, no value, and no keyboard
|
|
4439
|
-
* (that is `useListbox`). What it does own is the DOM the parents cannot: the panel element and
|
|
4440
|
-
* the search input, both exposed so the parent can position the one and focus the other, and the
|
|
4441
|
-
* pointer-press guard that keeps a press inside the panel from blurring the focused element.
|
|
4442
|
-
*
|
|
4443
|
-
* `multiple` is the one behavioural switch, and it is the spec's own: a multi-select's rows carry a
|
|
4444
|
-
* checkbox instead of a trailing check mark, and its listbox is `aria-multiselectable="true"`.
|
|
4445
|
-
*/
|
|
4446
|
-
const props = __props;
|
|
4447
|
-
const emit = __emit;
|
|
4448
|
-
const root = ref(null);
|
|
4449
|
-
const searchInput = ref(null);
|
|
4450
|
-
__expose({
|
|
4451
|
-
root,
|
|
4452
|
-
searchInput
|
|
4453
|
-
});
|
|
4454
|
-
const isActive = (option) => props.activeValue === option.value;
|
|
4455
|
-
const isSelected = (option) => props.selectedValues.includes(option.value);
|
|
4456
|
-
const panelClasses = computed(() => panelClass(props.classes));
|
|
4457
|
-
const searchClasses = computed(() => searchClass(props.classes));
|
|
4458
|
-
const listboxClasses = computed(() => listboxClass(props.classes, props.hasOptions));
|
|
4459
|
-
const optionHintClasses = computed(() => optionHintClass(props.classes));
|
|
4460
|
-
const optionSwatchClasses = computed(() => optionSwatchClass(props.classes));
|
|
4461
|
-
const optionIconClasses = computed(() => optionIconClass(props.classes));
|
|
4462
|
-
const optionCheckClasses = computed(() => optionCheckClass(props.classes));
|
|
4463
|
-
const emptyClasses = computed(() => emptyClass(props.classes));
|
|
4464
|
-
const loadingClasses = computed(() => loadingClass(props.classes));
|
|
4465
|
-
const createClasses = computed(() => props.createOption === void 0 ? "" : createOptionClass(props.classes, { active: isActive(props.createOption) }));
|
|
4466
|
-
/** Within this many pixels of the end — two rows — the next render batch is asked for. */
|
|
4467
|
-
function onListScroll(event) {
|
|
4468
|
-
const list = event.currentTarget;
|
|
4469
|
-
if (list.scrollHeight - list.scrollTop - list.clientHeight <= SCROLL_END_SLACK) emit("scrollEnd");
|
|
4470
|
-
}
|
|
4471
|
-
const rowClass = (option) => optionClass(props.classes, option, {
|
|
4472
|
-
active: isActive(option),
|
|
4473
|
-
selected: isSelected(option),
|
|
4474
|
-
multiple: props.multiple
|
|
4475
|
-
});
|
|
4476
|
-
const boxClass = (option) => optionBoxClass(props.classes, {
|
|
4477
|
-
selected: isSelected(option),
|
|
4478
|
-
disabled: option.disabled === true
|
|
4479
|
-
});
|
|
4480
|
-
/**
|
|
4481
|
-
* Spec "Select" → Behaviour: "The active option is scrolled into view with a 0.25rem margin
|
|
4482
|
-
* whenever it changes" — the margin is the row's own `scroll-my-1`.
|
|
4483
|
-
*
|
|
4484
|
-
* It lives here rather than in either parent because it is the one part of "the active row" that
|
|
4485
|
-
* needs an element, and the panel is what has the elements. Both controls get it from one copy.
|
|
4486
|
-
*/
|
|
4487
|
-
function scrollActiveIntoView() {
|
|
4488
|
-
const value = props.activeValue;
|
|
4489
|
-
if (value === void 0 || typeof document === "undefined") return;
|
|
4490
|
-
document.getElementById(props.optionId(value))?.scrollIntoView?.({ block: "nearest" });
|
|
4491
|
-
}
|
|
4492
|
-
onMounted(scrollActiveIntoView);
|
|
4493
|
-
watch(() => props.activeValue, () => void nextTick(scrollActiveIntoView));
|
|
4494
|
-
function onSearchInput(event) {
|
|
4495
|
-
emit("search", event.target.value);
|
|
4496
|
-
}
|
|
4497
|
-
/**
|
|
4498
|
-
* Anything inside the panel that wants the pointer's default action: it takes focus, or places a
|
|
4499
|
-
* caret. The search field and — in a multi-select — the footer's Clear and Done buttons.
|
|
4500
|
-
*/
|
|
4501
|
-
function onPanelMouseDown(event) {
|
|
4502
|
-
const target = event.target;
|
|
4503
|
-
if (target instanceof Element && target.closest(FOCUSABLE$1) !== null) return;
|
|
4504
|
-
event.preventDefault();
|
|
4505
|
-
}
|
|
4506
|
-
return (_ctx, _cache) => {
|
|
4507
|
-
return openBlock(), createElementBlock("div", {
|
|
4508
|
-
ref_key: "root",
|
|
4509
|
-
ref: root,
|
|
4510
|
-
"data-eldra-slot": unref(eldra).slotHost("footer"),
|
|
4511
|
-
id: __props.panelId,
|
|
4512
|
-
"data-eldra-ui": "",
|
|
4513
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4514
|
-
"data-part": "panel",
|
|
4515
|
-
"data-eldra-overlay-owner": __props.panelId,
|
|
4516
|
-
class: normalizeClass(panelClasses.value),
|
|
4517
|
-
style: normalizeStyle(__props.panelStyle),
|
|
4518
|
-
"data-placement": __props.placement,
|
|
4519
|
-
onMousedown: onPanelMouseDown
|
|
4520
|
-
}, [
|
|
4521
|
-
__props.searchable ? (openBlock(), createElementBlock("div", {
|
|
4522
|
-
key: 0,
|
|
4523
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4524
|
-
class: "eldra:relative eldra:shrink-0 eldra:border-b eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]"
|
|
4525
|
-
}, [_cache[3] || (_cache[3] = createElementVNode("svg", {
|
|
4526
|
-
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))]",
|
|
4527
|
-
viewBox: "0 0 24 24",
|
|
4528
|
-
fill: "none",
|
|
4529
|
-
stroke: "currentColor",
|
|
4530
|
-
"stroke-width": "1.75",
|
|
4531
|
-
"stroke-linecap": "round",
|
|
4532
|
-
"stroke-linejoin": "round",
|
|
4533
|
-
"aria-hidden": "true",
|
|
4534
|
-
focusable: "false"
|
|
4535
|
-
}, [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", {
|
|
4536
|
-
ref_key: "searchInput",
|
|
4537
|
-
ref: searchInput,
|
|
4538
|
-
"data-part": "search",
|
|
4539
|
-
type: "text",
|
|
4540
|
-
role: "combobox",
|
|
4541
|
-
class: normalizeClass(searchClasses.value),
|
|
4542
|
-
value: __props.query,
|
|
4543
|
-
placeholder: __props.searchPlaceholder,
|
|
4544
|
-
"aria-label": __props.searchPlaceholder,
|
|
4545
|
-
"aria-autocomplete": "list",
|
|
4546
|
-
"aria-expanded": "true",
|
|
4547
|
-
"aria-controls": __props.listboxId,
|
|
4548
|
-
"aria-activedescendant": __props.activeValue === void 0 ? void 0 : __props.optionId(__props.activeValue),
|
|
4549
|
-
autocomplete: "off",
|
|
4550
|
-
spellcheck: "false",
|
|
4551
|
-
onInput: onSearchInput,
|
|
4552
|
-
onKeydown: _cache[0] || (_cache[0] = ($event) => emit("keydown", $event))
|
|
4553
|
-
}, null, 42, _hoisted_3$9)], 8, _hoisted_2$9)) : createCommentVNode("", true),
|
|
4554
|
-
createElementVNode("div", {
|
|
4555
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4556
|
-
id: __props.listboxId,
|
|
4557
|
-
"data-part": "listbox",
|
|
4558
|
-
role: "listbox",
|
|
4559
|
-
class: normalizeClass(listboxClasses.value),
|
|
4560
|
-
"aria-multiselectable": __props.multiple ? "true" : void 0,
|
|
4561
|
-
"aria-labelledby": __props.labelledBy,
|
|
4562
|
-
"aria-label": __props.fallbackLabel,
|
|
4563
|
-
"aria-busy": __props.loading ? "true" : void 0,
|
|
4564
|
-
onScrollPassive: onListScroll
|
|
4565
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.sections, (section, sectionIndex) => {
|
|
4566
|
-
return openBlock(), createElementBlock("div", {
|
|
4567
|
-
key: section.key,
|
|
4568
|
-
"data-part": section.label ? "group" : void 0,
|
|
4569
|
-
role: section.label ? "group" : "presentation",
|
|
4570
|
-
class: normalizeClass(section.label ? unref(groupClass)(__props.classes, sectionIndex) : void 0),
|
|
4571
|
-
"aria-labelledby": section.labelId
|
|
4572
|
-
}, [section.label ? (openBlock(), createElementBlock("div", {
|
|
4573
|
-
key: 0,
|
|
4574
|
-
id: section.labelId,
|
|
4575
|
-
"data-part": "groupLabel",
|
|
4576
|
-
role: "presentation",
|
|
4577
|
-
class: normalizeClass(unref(groupLabelClass)(__props.classes, sectionIndex))
|
|
4578
|
-
}, toDisplayString(section.label), 11, _hoisted_6$5)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(section.options, (option) => {
|
|
4579
|
-
return openBlock(), createElementBlock("div", {
|
|
4580
|
-
key: option.value,
|
|
4581
|
-
"data-eldra-slot": unref(eldra).slotHost("option", "optionContent"),
|
|
4582
|
-
id: __props.optionId(option.value),
|
|
4583
|
-
"data-part": "option",
|
|
4584
|
-
role: "option",
|
|
4585
|
-
class: normalizeClass(rowClass(option)),
|
|
4586
|
-
"aria-selected": isSelected(option) ? "true" : "false",
|
|
4587
|
-
"aria-disabled": option.disabled ? "true" : void 0,
|
|
4588
|
-
onClick: ($event) => emit("select", option),
|
|
4589
|
-
onMouseenter: ($event) => option.disabled ? void 0 : emit("activate", option.value)
|
|
4590
|
-
}, [renderSlot(_ctx.$slots, "option", {
|
|
4591
|
-
option,
|
|
4592
|
-
selected: isSelected(option),
|
|
4593
|
-
active: isActive(option)
|
|
4594
|
-
}, () => [
|
|
4595
|
-
__props.multiple ? (openBlock(), createElementBlock("span", {
|
|
4596
|
-
key: 0,
|
|
4597
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4598
|
-
"data-part": "optionCheck",
|
|
4599
|
-
class: normalizeClass(boxClass(option)),
|
|
4600
|
-
"aria-hidden": "true"
|
|
4601
|
-
}, [(openBlock(), createElementBlock("svg", {
|
|
4602
|
-
class: normalizeClass(unref(optionTickClass)(isSelected(option))),
|
|
4603
|
-
viewBox: "0 0 8 8",
|
|
4604
|
-
fill: "none",
|
|
4605
|
-
stroke: "currentColor",
|
|
4606
|
-
"stroke-width": "2",
|
|
4607
|
-
"stroke-linecap": "round",
|
|
4608
|
-
"stroke-linejoin": "round",
|
|
4609
|
-
"aria-hidden": "true",
|
|
4610
|
-
focusable: "false"
|
|
4611
|
-
}, [..._cache[4] || (_cache[4] = [createElementVNode("path", { d: "M1 4l2 2l4 -4" }, null, -1)])], 2))], 10, _hoisted_8$3)) : createCommentVNode("", true),
|
|
4612
|
-
renderSlot(_ctx.$slots, "optionContent", {
|
|
4613
|
-
option,
|
|
4614
|
-
selected: isSelected(option),
|
|
4615
|
-
active: isActive(option),
|
|
4616
|
-
match: __props.highlights.get(option.value) ?? null
|
|
4617
|
-
}, () => [
|
|
4618
|
-
option.swatch ? (openBlock(), createElementBlock("span", {
|
|
4619
|
-
key: 0,
|
|
4620
|
-
"data-part": "optionSwatch",
|
|
4621
|
-
class: normalizeClass(optionSwatchClasses.value),
|
|
4622
|
-
style: normalizeStyle({ backgroundColor: option.swatch }),
|
|
4623
|
-
"aria-hidden": "true"
|
|
4624
|
-
}, null, 6)) : option.icon ? (openBlock(), createBlock(resolveDynamicComponent(option.icon), {
|
|
4625
|
-
key: 1,
|
|
4626
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4627
|
-
"data-part": "optionIcon",
|
|
4628
|
-
class: normalizeClass(optionIconClasses.value),
|
|
4629
|
-
"stroke-width": unref(ICON_STROKE_WIDTH$1),
|
|
4630
|
-
"aria-hidden": "true",
|
|
4631
|
-
focusable: "false"
|
|
4632
|
-
}, null, 8, [
|
|
4633
|
-
"data-eldra-scope",
|
|
4634
|
-
"class",
|
|
4635
|
-
"stroke-width"
|
|
4636
|
-
])) : createCommentVNode("", true),
|
|
4637
|
-
createElementVNode("span", _hoisted_9$3, [createElementVNode("span", {
|
|
4638
|
-
"data-part": "optionLabel",
|
|
4639
|
-
class: normalizeClass(unref(optionLabelClass)(__props.classes))
|
|
4640
|
-
}, [__props.highlights.get(option.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4641
|
-
createTextVNode(toDisplayString(__props.highlights.get(option.value)?.before), 1),
|
|
4642
|
-
createElementVNode("span", _hoisted_10$3, toDisplayString(__props.highlights.get(option.value)?.match), 1),
|
|
4643
|
-
createTextVNode(toDisplayString(__props.highlights.get(option.value)?.after), 1)
|
|
4644
|
-
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(option.label), 1)], 64))], 2), option.hint ? (openBlock(), createElementBlock("span", {
|
|
4645
|
-
key: 0,
|
|
4646
|
-
"data-part": "optionHint",
|
|
4647
|
-
class: normalizeClass(optionHintClasses.value)
|
|
4648
|
-
}, toDisplayString(option.hint), 3)) : createCommentVNode("", true)]),
|
|
4649
|
-
option.meta ? (openBlock(), createElementBlock("span", {
|
|
4650
|
-
key: 2,
|
|
4651
|
-
"data-part": "optionMeta",
|
|
4652
|
-
class: normalizeClass(unref(optionMetaClass)(__props.classes, option))
|
|
4653
|
-
}, toDisplayString(option.meta), 3)) : createCommentVNode("", true)
|
|
4654
|
-
]),
|
|
4655
|
-
!__props.multiple && isSelected(option) ? (openBlock(), createElementBlock("svg", {
|
|
4656
|
-
key: 1,
|
|
4657
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4658
|
-
"data-part": "optionCheck",
|
|
4659
|
-
class: normalizeClass(optionCheckClasses.value),
|
|
4660
|
-
viewBox: "0 0 24 24",
|
|
4661
|
-
fill: "none",
|
|
4662
|
-
stroke: "currentColor",
|
|
4663
|
-
"stroke-width": "1.75",
|
|
4664
|
-
"stroke-linecap": "round",
|
|
4665
|
-
"stroke-linejoin": "round",
|
|
4666
|
-
"aria-hidden": "true",
|
|
4667
|
-
focusable: "false"
|
|
4668
|
-
}, [..._cache[5] || (_cache[5] = [createElementVNode("path", { d: "M5 12l5 5l10 -10" }, null, -1)])], 10, _hoisted_11$3)) : createCommentVNode("", true)
|
|
4669
|
-
])], 42, _hoisted_7$4);
|
|
4670
|
-
}), 128))], 10, _hoisted_5$7);
|
|
4671
|
-
}), 128)), __props.createOption ? (openBlock(), createElementBlock("div", {
|
|
4672
|
-
key: 0,
|
|
4673
|
-
role: "presentation",
|
|
4674
|
-
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)
|
|
4675
|
-
}, [createElementVNode("div", {
|
|
4676
|
-
id: __props.optionId(__props.createOption.value),
|
|
4677
|
-
"data-part": "createOption",
|
|
4678
|
-
role: "option",
|
|
4679
|
-
"aria-selected": "false",
|
|
4680
|
-
class: normalizeClass(createClasses.value),
|
|
4681
|
-
onClick: _cache[1] || (_cache[1] = ($event) => emit("select", __props.createOption)),
|
|
4682
|
-
onMouseenter: _cache[2] || (_cache[2] = ($event) => emit("activate", __props.createOption.value))
|
|
4683
|
-
}, [(openBlock(), createElementBlock("svg", {
|
|
4684
|
-
class: normalizeClass(optionIconClasses.value),
|
|
4685
|
-
viewBox: "0 0 24 24",
|
|
4686
|
-
fill: "none",
|
|
4687
|
-
stroke: "currentColor",
|
|
4688
|
-
"stroke-width": "1.75",
|
|
4689
|
-
"stroke-linecap": "round",
|
|
4690
|
-
"stroke-linejoin": "round",
|
|
4691
|
-
"aria-hidden": "true",
|
|
4692
|
-
focusable: "false"
|
|
4693
|
-
}, [..._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$2, toDisplayString(__props.createText), 1)], 42, _hoisted_12$3)], 2)) : createCommentVNode("", true)], 42, _hoisted_4$8),
|
|
4694
|
-
__props.loading ? (openBlock(), createElementBlock("div", {
|
|
4695
|
-
key: 1,
|
|
4696
|
-
"data-eldra-slot": unref(eldra).slotHost("loading"),
|
|
4697
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4698
|
-
"data-part": "loading",
|
|
4699
|
-
role: "status",
|
|
4700
|
-
class: normalizeClass(loadingClasses.value)
|
|
4701
|
-
}, [createVNode(Spinner_default, { class: "eldra:size-4" }), renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(__props.loadingText), 1)])], 10, _hoisted_14$2)) : !__props.hasOptions ? (openBlock(), createElementBlock("div", {
|
|
4702
|
-
key: 2,
|
|
4703
|
-
"data-eldra-slot": unref(eldra).slotHost("empty"),
|
|
4704
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
4705
|
-
"data-part": "empty",
|
|
4706
|
-
class: normalizeClass(emptyClasses.value)
|
|
4707
|
-
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText), 1)])], 10, _hoisted_15$1)) : createCommentVNode("", true),
|
|
4708
|
-
renderSlot(_ctx.$slots, "footer")
|
|
4709
|
-
], 46, _hoisted_1$9);
|
|
4710
|
-
};
|
|
4711
|
-
}
|
|
4712
|
-
});
|
|
4713
|
-
// src/components/select/SelectTags.vue?vue&type=script&setup=true&lang.ts
|
|
4714
|
-
var _hoisted_1$8 = [
|
|
4715
|
-
"id",
|
|
4716
|
-
"data-eldra-scope",
|
|
4717
|
-
"aria-label",
|
|
4718
|
-
"aria-labelledby"
|
|
4719
|
-
];
|
|
4720
|
-
var _hoisted_2$8 = ["data-eldra-slot"];
|
|
4721
|
-
var _hoisted_3$8 = ["data-eldra-slot"];
|
|
4722
|
-
var _hoisted_4$7 = { class: "eldra:min-w-0 eldra:truncate" };
|
|
4723
|
-
var _hoisted_5$6 = [
|
|
4724
|
-
"data-eldra-scope",
|
|
4725
|
-
"aria-label",
|
|
4726
|
-
"onClick"
|
|
4727
|
-
];
|
|
4728
|
-
// src/components/select/SelectTags.vue
|
|
4729
|
-
var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
4730
|
-
__name: "SelectTags",
|
|
3533
|
+
// src/components/select/SelectTags.vue
|
|
3534
|
+
var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
3535
|
+
__name: "SelectTags",
|
|
4731
3536
|
props: {
|
|
4732
3537
|
options: {},
|
|
4733
3538
|
id: {},
|
|
@@ -4977,1025 +3782,6 @@ function useTagRows(field, maxRows, enabled, watched) {
|
|
|
4977
3782
|
measure
|
|
4978
3783
|
};
|
|
4979
3784
|
}
|
|
4980
|
-
// src/components/select/useListbox.ts
|
|
4981
|
-
/** Spec Select → Keyboard, open: "`PageDown` / `PageUp` | Move by 10." */
|
|
4982
|
-
var PAGE = 10;
|
|
4983
|
-
/** Spec Select → Keyboard, closed: "the buffer resets after 0.6s". */
|
|
4984
|
-
var TYPEAHEAD_RESET_MS = 600;
|
|
4985
|
-
/**
|
|
4986
|
-
* Case- and diacritic-insensitive, so the spec's "'island' finds 'Ísland'" holds for type-ahead
|
|
4987
|
-
* and for the search field alike. `NFD` splits a letter from its accent and the range drops the
|
|
4988
|
-
* combining marks that are left.
|
|
4989
|
-
*/
|
|
4990
|
-
function normalizeText(text) {
|
|
4991
|
-
return text.normalize("NFD").replaceAll(/[̀-ͯ]/g, "").toLowerCase();
|
|
4992
|
-
}
|
|
4993
|
-
/** A key that types a character, rather than a chord or a named key. */
|
|
4994
|
-
function isPrintable(event) {
|
|
4995
|
-
return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
4996
|
-
}
|
|
4997
|
-
function clamp(value, min, max) {
|
|
4998
|
-
return value < min ? min : value > max ? max : value;
|
|
4999
|
-
}
|
|
5000
|
-
/**
|
|
5001
|
-
* The keyboard and the active row of a listbox popup — everything in the design spec's Select →
|
|
5002
|
-
* Keyboard tables that is not about *what* choosing a row does.
|
|
5003
|
-
*
|
|
5004
|
-
* It is separate from `Select.vue` on purpose. `MultiSelect` (the next component) has the same two
|
|
5005
|
-
* keyboard tables with three differences — `Enter` toggles instead of choosing-and-closing,
|
|
5006
|
-
* `Space` toggles, and the popup stays open — all of which are the caller's `select` callback and
|
|
5007
|
-
* the caller's decision about closing. Everything else (arrow movement that skips disabled and
|
|
5008
|
-
* filtered-out rows and stops at the ends, `PageUp`/`PageDown` by ten, `Home`/`End` unless a
|
|
5009
|
-
* search field owns them, `Alt+ArrowUp`, `Escape` clearing a query before it closes, `Tab`
|
|
5010
|
-
* closing without a choice, and type-ahead with a 0.6s buffer) is identical, and identical code
|
|
5011
|
-
* that is written twice stops being identical.
|
|
5012
|
-
*
|
|
5013
|
-
* The composable owns no DOM. `aria-activedescendant` is `activeId`, which the caller binds to
|
|
5014
|
-
* whichever element is focused — the trigger when there is no search field, the search field when
|
|
5015
|
-
* there is — and scrolling the active row into view is the caller's, because only the caller knows
|
|
5016
|
-
* which element a value maps to.
|
|
5017
|
-
*
|
|
5018
|
-
* ```ts
|
|
5019
|
-
* const listbox = useListbox({
|
|
5020
|
-
* options: () => visibleOptions.value,
|
|
5021
|
-
* isOpen: () => open.value,
|
|
5022
|
-
* searchable: () => searchable.value,
|
|
5023
|
-
* optionId: (value) => `${id.value}-option-${value}`,
|
|
5024
|
-
* open: (edge) => openPanel(edge),
|
|
5025
|
-
* close: () => closePanel(),
|
|
5026
|
-
* select: (option) => choose(option.value),
|
|
5027
|
-
* });
|
|
5028
|
-
* ```
|
|
5029
|
-
*/
|
|
5030
|
-
function useListbox(options) {
|
|
5031
|
-
const activeValue = ref(void 0);
|
|
5032
|
-
const activeId = computed(() => activeValue.value === void 0 ? void 0 : options.optionId(activeValue.value));
|
|
5033
|
-
/** Only enabled rows are reachable: "Arrow keys skip it" (Select → Variants, Disabled option). */
|
|
5034
|
-
const enabled = () => options.options().filter((option) => !option.disabled);
|
|
5035
|
-
const setActive = (value) => {
|
|
5036
|
-
activeValue.value = value;
|
|
5037
|
-
};
|
|
5038
|
-
const first = () => setActive(enabled()[0]?.value);
|
|
5039
|
-
const last = () => setActive(enabled().at(-1)?.value);
|
|
5040
|
-
const activateFrom = (value) => {
|
|
5041
|
-
const rows = enabled();
|
|
5042
|
-
const match = rows.find((option) => option.value === value);
|
|
5043
|
-
setActive((match ?? rows[0])?.value);
|
|
5044
|
-
};
|
|
5045
|
-
const move = (step) => {
|
|
5046
|
-
const rows = enabled();
|
|
5047
|
-
if (rows.length === 0) {
|
|
5048
|
-
setActive(void 0);
|
|
5049
|
-
return;
|
|
5050
|
-
}
|
|
5051
|
-
const index = rows.findIndex((option) => option.value === activeValue.value);
|
|
5052
|
-
if (index === -1) {
|
|
5053
|
-
setActive((step > 0 ? rows[0] : rows.at(-1))?.value);
|
|
5054
|
-
return;
|
|
5055
|
-
}
|
|
5056
|
-
setActive(rows[clamp(index + step, 0, rows.length - 1)]?.value);
|
|
5057
|
-
};
|
|
5058
|
-
const selectActive = () => {
|
|
5059
|
-
const option = options.options().find((row) => row.value === activeValue.value);
|
|
5060
|
-
if (option === void 0 || option.disabled === true) return;
|
|
5061
|
-
options.select(option);
|
|
5062
|
-
};
|
|
5063
|
-
let buffer = "";
|
|
5064
|
-
let timer;
|
|
5065
|
-
const resetTypeahead = () => {
|
|
5066
|
-
buffer = "";
|
|
5067
|
-
if (timer !== void 0) clearTimeout(timer);
|
|
5068
|
-
timer = void 0;
|
|
5069
|
-
};
|
|
5070
|
-
onScopeDispose(resetTypeahead);
|
|
5071
|
-
function typeahead(character, inclusive = false) {
|
|
5072
|
-
buffer += character;
|
|
5073
|
-
if (timer !== void 0) clearTimeout(timer);
|
|
5074
|
-
timer = setTimeout(resetTypeahead, TYPEAHEAD_RESET_MS);
|
|
5075
|
-
const rows = enabled();
|
|
5076
|
-
if (rows.length === 0) return;
|
|
5077
|
-
const prefix = normalizeText(buffer);
|
|
5078
|
-
const current = rows.findIndex((option) => option.value === activeValue.value);
|
|
5079
|
-
const from = buffer.length === 1 && !inclusive ? current + 1 : Math.max(current, 0);
|
|
5080
|
-
for (let step = 0; step < rows.length; step += 1) {
|
|
5081
|
-
const option = rows[(from + step + rows.length) % rows.length];
|
|
5082
|
-
if (option !== void 0 && normalizeText(option.label).startsWith(prefix)) {
|
|
5083
|
-
setActive(option.value);
|
|
5084
|
-
return;
|
|
5085
|
-
}
|
|
5086
|
-
}
|
|
5087
|
-
}
|
|
5088
|
-
function onClosedKeydown(event) {
|
|
5089
|
-
switch (event.key) {
|
|
5090
|
-
case "ArrowDown":
|
|
5091
|
-
case "Enter":
|
|
5092
|
-
case " ":
|
|
5093
|
-
event.preventDefault();
|
|
5094
|
-
options.open("start");
|
|
5095
|
-
return;
|
|
5096
|
-
case "ArrowUp":
|
|
5097
|
-
event.preventDefault();
|
|
5098
|
-
options.open(options.searchable() ? "start" : "end");
|
|
5099
|
-
return;
|
|
5100
|
-
case "Backspace":
|
|
5101
|
-
case "Delete":
|
|
5102
|
-
if (options.clear?.() === true) event.preventDefault();
|
|
5103
|
-
return;
|
|
5104
|
-
default:
|
|
5105
|
-
if (!isPrintable(event)) return;
|
|
5106
|
-
event.preventDefault();
|
|
5107
|
-
options.open("start");
|
|
5108
|
-
if (options.searchable()) options.startQuery?.(event.key);
|
|
5109
|
-
else typeahead(event.key, true);
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
function onOpenKeydown(event) {
|
|
5113
|
-
switch (event.key) {
|
|
5114
|
-
case "ArrowDown":
|
|
5115
|
-
event.preventDefault();
|
|
5116
|
-
move(1);
|
|
5117
|
-
return;
|
|
5118
|
-
case "ArrowUp":
|
|
5119
|
-
event.preventDefault();
|
|
5120
|
-
if (event.altKey) selectActive();
|
|
5121
|
-
else move(-1);
|
|
5122
|
-
return;
|
|
5123
|
-
case "PageDown":
|
|
5124
|
-
event.preventDefault();
|
|
5125
|
-
move(PAGE);
|
|
5126
|
-
return;
|
|
5127
|
-
case "PageUp":
|
|
5128
|
-
event.preventDefault();
|
|
5129
|
-
move(-10);
|
|
5130
|
-
return;
|
|
5131
|
-
case "Home":
|
|
5132
|
-
if (options.searchable()) return;
|
|
5133
|
-
event.preventDefault();
|
|
5134
|
-
first();
|
|
5135
|
-
return;
|
|
5136
|
-
case "End":
|
|
5137
|
-
if (options.searchable()) return;
|
|
5138
|
-
event.preventDefault();
|
|
5139
|
-
last();
|
|
5140
|
-
return;
|
|
5141
|
-
case "Enter":
|
|
5142
|
-
event.preventDefault();
|
|
5143
|
-
selectActive();
|
|
5144
|
-
return;
|
|
5145
|
-
case " ":
|
|
5146
|
-
if (options.searchable()) return;
|
|
5147
|
-
event.preventDefault();
|
|
5148
|
-
selectActive();
|
|
5149
|
-
return;
|
|
5150
|
-
case "Escape":
|
|
5151
|
-
if (options.escape?.() !== true) return;
|
|
5152
|
-
event.preventDefault();
|
|
5153
|
-
event.stopPropagation();
|
|
5154
|
-
return;
|
|
5155
|
-
case "Tab":
|
|
5156
|
-
options.close();
|
|
5157
|
-
return;
|
|
5158
|
-
default:
|
|
5159
|
-
if (options.searchable() || !isPrintable(event)) return;
|
|
5160
|
-
event.preventDefault();
|
|
5161
|
-
typeahead(event.key);
|
|
5162
|
-
}
|
|
5163
|
-
}
|
|
5164
|
-
function onKeydown(event) {
|
|
5165
|
-
if (event.defaultPrevented) return;
|
|
5166
|
-
if (options.isOpen()) {
|
|
5167
|
-
onOpenKeydown(event);
|
|
5168
|
-
return;
|
|
5169
|
-
}
|
|
5170
|
-
if (options.canOpen?.() === false) return;
|
|
5171
|
-
onClosedKeydown(event);
|
|
5172
|
-
}
|
|
5173
|
-
return {
|
|
5174
|
-
activeValue,
|
|
5175
|
-
activeId,
|
|
5176
|
-
setActive,
|
|
5177
|
-
activateFrom,
|
|
5178
|
-
first,
|
|
5179
|
-
last,
|
|
5180
|
-
move,
|
|
5181
|
-
selectActive,
|
|
5182
|
-
onKeydown,
|
|
5183
|
-
resetTypeahead
|
|
5184
|
-
};
|
|
5185
|
-
}
|
|
5186
|
-
// src/components/select/useOptionList.ts
|
|
5187
|
-
/**
|
|
5188
|
-
* Where a query matches inside a label, in **code points of the original string**.
|
|
5189
|
-
*
|
|
5190
|
-
* Matching is case- and diacritic-insensitive (the spec's "'island' finds 'Ísland'"), so the
|
|
5191
|
-
* comparison happens on a normalised copy — and the match has to be reported back in the original
|
|
5192
|
-
* string's own offsets, or the bold-and-underlined run would land on the wrong characters for any
|
|
5193
|
-
* label holding an accent. Hence the per-character walk: each original code point contributes zero
|
|
5194
|
-
* (a combining mark) or more normalised characters, and `positions` maps back.
|
|
5195
|
-
*/
|
|
5196
|
-
function matchRange(label, rawQuery) {
|
|
5197
|
-
const needle = normalizeText(rawQuery);
|
|
5198
|
-
if (needle === "") return null;
|
|
5199
|
-
const characters = [...label];
|
|
5200
|
-
const positions = [];
|
|
5201
|
-
let normalized = "";
|
|
5202
|
-
for (const [index, character] of characters.entries()) {
|
|
5203
|
-
const piece = normalizeText(character);
|
|
5204
|
-
for (let step = 0; step < piece.length; step += 1) positions.push(index);
|
|
5205
|
-
normalized += piece;
|
|
5206
|
-
}
|
|
5207
|
-
const at = normalized.indexOf(needle);
|
|
5208
|
-
if (at === -1) return null;
|
|
5209
|
-
return {
|
|
5210
|
-
start: positions[at] ?? 0,
|
|
5211
|
-
end: (positions[at + needle.length - 1] ?? characters.length - 1) + 1
|
|
5212
|
-
};
|
|
5213
|
-
}
|
|
5214
|
-
/**
|
|
5215
|
-
* Options bucketed by `group`, in the order each group first appears — so a "Most used" group
|
|
5216
|
-
* written first stays first, which is exactly the spec's advice ("Put the 3 to 5 most likely
|
|
5217
|
-
* answers first"). Options with no `group` form an unlabelled section of their own.
|
|
5218
|
-
*/
|
|
5219
|
-
function groupOptions(list, idPrefix, controlId) {
|
|
5220
|
-
const order = [];
|
|
5221
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
5222
|
-
for (const option of list) {
|
|
5223
|
-
const key = option.group ?? "";
|
|
5224
|
-
let bucket = buckets.get(key);
|
|
5225
|
-
if (bucket === void 0) {
|
|
5226
|
-
bucket = [];
|
|
5227
|
-
buckets.set(key, bucket);
|
|
5228
|
-
order.push(key);
|
|
5229
|
-
}
|
|
5230
|
-
bucket.push(option);
|
|
5231
|
-
}
|
|
5232
|
-
return order.map((key, index) => ({
|
|
5233
|
-
key: key === "" ? `${idPrefix}-plain-${index}` : `${idPrefix}-group-${key}`,
|
|
5234
|
-
label: key === "" ? void 0 : key,
|
|
5235
|
-
labelId: key === "" ? void 0 : `${controlId}-g${index}`,
|
|
5236
|
-
options: buckets.get(key) ?? []
|
|
5237
|
-
}));
|
|
5238
|
-
}
|
|
5239
|
-
/**
|
|
5240
|
-
* The value of the "Create “query”" row a `creatable` control appends. A control character no
|
|
5241
|
-
* merchant value holds, so it never collides with an option's own value.
|
|
5242
|
-
*/
|
|
5243
|
-
var CREATE_VALUE = "\0eldra-create";
|
|
5244
|
-
/**
|
|
5245
|
-
* The list a select panel shows: filtering, grouping, match highlighting, the create row and the
|
|
5246
|
-
* render batch.
|
|
5247
|
-
*
|
|
5248
|
-
* Shared by `Select` and `MultiSelect`, which differ in what choosing a row *does* and in nothing
|
|
5249
|
-
* about which rows there are. No DOM; its one piece of state is how many rows are rendered.
|
|
5250
|
-
*/
|
|
5251
|
-
function useOptionList(options) {
|
|
5252
|
-
const trimmedQuery = computed(() => options.searchable() ? options.query().trim() : "");
|
|
5253
|
-
const loading = computed(() => options.loading?.() === true);
|
|
5254
|
-
/**
|
|
5255
|
-
* The options a query leaves, in the consumer's order. Not returned: every caller wants them
|
|
5256
|
-
* bucketed (`sections`) or in DOM order (`listOptions`), and a third view of the same list would
|
|
5257
|
-
* only be a way to disagree with those two.
|
|
5258
|
-
*/
|
|
5259
|
-
const visibleOptions = computed(() => {
|
|
5260
|
-
if (loading.value) return [];
|
|
5261
|
-
const trimmed = trimmedQuery.value;
|
|
5262
|
-
if (trimmed === "") return options.options();
|
|
5263
|
-
const needle = normalizeText(trimmed);
|
|
5264
|
-
return options.options().filter((option) => matchRange(option.label, trimmed) !== null || option.keywords?.some((keyword) => normalizeText(keyword).includes(needle)) === true);
|
|
5265
|
-
});
|
|
5266
|
-
/** Every visible option in DOM order, before the render batch cuts it. */
|
|
5267
|
-
const orderedOptions = computed(() => groupOptions(visibleOptions.value, "panel", options.controlId()).flatMap((section) => section.options));
|
|
5268
|
-
const batchSize = () => {
|
|
5269
|
-
const size = options.renderBatch?.();
|
|
5270
|
-
return size === void 0 || !(size >= 1) ? Number.POSITIVE_INFINITY : Math.floor(size);
|
|
5271
|
-
};
|
|
5272
|
-
const rendered = ref(batchSize());
|
|
5273
|
-
const resetBatch = () => {
|
|
5274
|
-
rendered.value = batchSize();
|
|
5275
|
-
};
|
|
5276
|
-
const renderMore = () => {
|
|
5277
|
-
if (rendered.value < orderedOptions.value.length) rendered.value += batchSize();
|
|
5278
|
-
};
|
|
5279
|
-
const reveal = (value) => {
|
|
5280
|
-
if (value === void 0 || !Number.isFinite(rendered.value)) return;
|
|
5281
|
-
const index = orderedOptions.value.findIndex((option) => option.value === value);
|
|
5282
|
-
if (index < rendered.value) return;
|
|
5283
|
-
const size = batchSize();
|
|
5284
|
-
rendered.value = Math.ceil((index + 1) / size) * size;
|
|
5285
|
-
};
|
|
5286
|
-
watch(trimmedQuery, resetBatch);
|
|
5287
|
-
watch(() => options.renderBatch?.(), resetBatch);
|
|
5288
|
-
const renderedOptions = computed(() => Number.isFinite(rendered.value) ? orderedOptions.value.slice(0, rendered.value) : orderedOptions.value);
|
|
5289
|
-
const sections = computed(() => groupOptions(renderedOptions.value, "panel", options.controlId()));
|
|
5290
|
-
const nativeSections = computed(() => groupOptions(options.options(), "native", options.controlId()));
|
|
5291
|
-
/**
|
|
5292
|
-
* Spec-free addition: a query no option's label already equals can be offered as a new option.
|
|
5293
|
-
* Equal ignoring case and accents, the same comparison the search itself makes, so "Shirt" is
|
|
5294
|
-
* not offered beside an existing "shirt".
|
|
5295
|
-
*/
|
|
5296
|
-
const createOption = computed(() => {
|
|
5297
|
-
const trimmed = trimmedQuery.value;
|
|
5298
|
-
if (options.creatable?.() !== true || loading.value || trimmed === "") return void 0;
|
|
5299
|
-
const needle = normalizeText(trimmed);
|
|
5300
|
-
if (options.options().some((option) => normalizeText(option.label) === needle)) return;
|
|
5301
|
-
return {
|
|
5302
|
-
value: CREATE_VALUE,
|
|
5303
|
-
label: trimmed
|
|
5304
|
-
};
|
|
5305
|
-
});
|
|
5306
|
-
const listOptions = computed(() => createOption.value === void 0 ? orderedOptions.value : [...orderedOptions.value, createOption.value]);
|
|
5307
|
-
return {
|
|
5308
|
-
sections,
|
|
5309
|
-
nativeSections,
|
|
5310
|
-
listOptions,
|
|
5311
|
-
hasOptions: computed(() => listOptions.value.length > 0),
|
|
5312
|
-
highlights: computed(() => {
|
|
5313
|
-
const trimmed = trimmedQuery.value;
|
|
5314
|
-
return new Map(renderedOptions.value.map((option) => {
|
|
5315
|
-
const range = trimmed === "" ? null : matchRange(option.label, trimmed);
|
|
5316
|
-
if (range === null) return [option.value, null];
|
|
5317
|
-
const characters = [...option.label];
|
|
5318
|
-
return [option.value, {
|
|
5319
|
-
before: characters.slice(0, range.start).join(""),
|
|
5320
|
-
match: characters.slice(range.start, range.end).join(""),
|
|
5321
|
-
after: characters.slice(range.end).join("")
|
|
5322
|
-
}];
|
|
5323
|
-
}));
|
|
5324
|
-
}),
|
|
5325
|
-
createOption,
|
|
5326
|
-
renderMore,
|
|
5327
|
-
reveal,
|
|
5328
|
-
resetBatch
|
|
5329
|
-
};
|
|
5330
|
-
}
|
|
5331
|
-
// src/composables/useFloating.ts
|
|
5332
|
-
/** What each of the spec's two named placements means to `@floating-ui/dom`. */
|
|
5333
|
-
var RESOLVED = {
|
|
5334
|
-
auto: {
|
|
5335
|
-
placement: "bottom-start",
|
|
5336
|
-
flip: true
|
|
5337
|
-
},
|
|
5338
|
-
above: {
|
|
5339
|
-
placement: "top-start",
|
|
5340
|
-
flip: false
|
|
5341
|
-
},
|
|
5342
|
-
bottom: {
|
|
5343
|
-
placement: "bottom",
|
|
5344
|
-
flip: true
|
|
5345
|
-
},
|
|
5346
|
-
"bottom-start": {
|
|
5347
|
-
placement: "bottom-start",
|
|
5348
|
-
flip: true
|
|
5349
|
-
},
|
|
5350
|
-
"bottom-end": {
|
|
5351
|
-
placement: "bottom-end",
|
|
5352
|
-
flip: true
|
|
5353
|
-
},
|
|
5354
|
-
top: {
|
|
5355
|
-
placement: "top",
|
|
5356
|
-
flip: true
|
|
5357
|
-
},
|
|
5358
|
-
"top-start": {
|
|
5359
|
-
placement: "top-start",
|
|
5360
|
-
flip: true
|
|
5361
|
-
},
|
|
5362
|
-
"top-end": {
|
|
5363
|
-
placement: "top-end",
|
|
5364
|
-
flip: true
|
|
5365
|
-
},
|
|
5366
|
-
left: {
|
|
5367
|
-
placement: "left",
|
|
5368
|
-
flip: true
|
|
5369
|
-
},
|
|
5370
|
-
"left-start": {
|
|
5371
|
-
placement: "left-start",
|
|
5372
|
-
flip: true
|
|
5373
|
-
},
|
|
5374
|
-
"left-end": {
|
|
5375
|
-
placement: "left-end",
|
|
5376
|
-
flip: true
|
|
5377
|
-
},
|
|
5378
|
-
right: {
|
|
5379
|
-
placement: "right",
|
|
5380
|
-
flip: true
|
|
5381
|
-
},
|
|
5382
|
-
"right-start": {
|
|
5383
|
-
placement: "right-start",
|
|
5384
|
-
flip: true
|
|
5385
|
-
},
|
|
5386
|
-
"right-end": {
|
|
5387
|
-
placement: "right-end",
|
|
5388
|
-
flip: true
|
|
5389
|
-
}
|
|
5390
|
-
};
|
|
5391
|
-
/**
|
|
5392
|
-
* Positions a floating panel against the element that opened it — the one piece of every popup in
|
|
5393
|
-
* this package that has to measure the page.
|
|
5394
|
-
*
|
|
5395
|
-
* It is a thin wrap of `@floating-ui/vue`: `autoUpdate` keeps the position current while both
|
|
5396
|
-
* elements are mounted (scrolling, resizing, an ancestor moving), `offset` sets the gap, `flip`
|
|
5397
|
-
* turns the panel above the trigger when there is no room below, `shift` keeps it inside the
|
|
5398
|
-
* viewport, and `size` measures the trigger for `matchWidth` (a floor on the panel's width — the
|
|
5399
|
-
* spec lets a select's panel grow past its trigger up to its own `max-width` — or a floor and a
|
|
5400
|
-
* ceiling under `'exact'`). What the wrap adds is the design spec's vocabulary (`auto` / `above`)
|
|
5401
|
-
* and a plain style object rather than a transform, so a consumer writes `<div :style="styles">`
|
|
5402
|
-
* and nothing else.
|
|
5403
|
-
*
|
|
5404
|
-
* `top` and `left` are used instead of the default `transform`, because a panel positioned by
|
|
5405
|
-
* transform is blurry on fractional pixels and, more to the point, cannot then use `transform` for
|
|
5406
|
-
* the spec's own open animation (fade + 0.25rem slide + a vertical scale from the top edge).
|
|
5407
|
-
*
|
|
5408
|
-
* ```ts
|
|
5409
|
-
* const trigger = ref<HTMLElement | null>(null);
|
|
5410
|
-
* const panel = ref<HTMLElement | null>(null);
|
|
5411
|
-
* const { styles, placement } = useFloating(trigger, panel, { matchWidth: true });
|
|
5412
|
-
* ```
|
|
5413
|
-
*
|
|
5414
|
-
* The reference may be a Floating UI **virtual element** (`{ getBoundingClientRect() }`), for a
|
|
5415
|
-
* panel anchored to a caret or a pointer position rather than to a node; call `update()` after it
|
|
5416
|
-
* moves, since nothing observes a virtual element's geometry.
|
|
5417
|
-
*/
|
|
5418
|
-
function useFloating$1(reference, floating, options = {}) {
|
|
5419
|
-
const resolved = computed(() => RESOLVED[toValue(options.placement) ?? "auto"]);
|
|
5420
|
-
const exactWidth = options.matchWidth === "exact";
|
|
5421
|
-
const matchWidth = options.matchWidth === true || exactWidth;
|
|
5422
|
-
const referenceWidth = ref(0);
|
|
5423
|
-
const middleware = computed(() => {
|
|
5424
|
-
const list = [offset(toValue(options.offset) ?? 4)];
|
|
5425
|
-
if (options.flip ?? resolved.value.flip) list.push(flip());
|
|
5426
|
-
list.push(shift({ padding: toValue(options.padding) ?? 8 }));
|
|
5427
|
-
if (matchWidth) list.push(size({ apply({ rects }) {
|
|
5428
|
-
referenceWidth.value = rects.reference.width;
|
|
5429
|
-
} }));
|
|
5430
|
-
return list;
|
|
5431
|
-
});
|
|
5432
|
-
const position = useFloating(reference, floating, {
|
|
5433
|
-
placement: computed(() => resolved.value.placement),
|
|
5434
|
-
strategy: options.strategy ?? "absolute",
|
|
5435
|
-
transform: false,
|
|
5436
|
-
middleware,
|
|
5437
|
-
whileElementsMounted: autoUpdate
|
|
5438
|
-
});
|
|
5439
|
-
return {
|
|
5440
|
-
styles: computed(() => {
|
|
5441
|
-
const base = {
|
|
5442
|
-
position: position.strategy.value,
|
|
5443
|
-
left: `${position.x.value}px`,
|
|
5444
|
-
top: `${position.y.value}px`
|
|
5445
|
-
};
|
|
5446
|
-
if (matchWidth) base.minWidth = `${referenceWidth.value}px`;
|
|
5447
|
-
if (exactWidth) base.maxWidth = `${referenceWidth.value}px`;
|
|
5448
|
-
return base;
|
|
5449
|
-
}),
|
|
5450
|
-
placement: computed(() => position.placement.value),
|
|
5451
|
-
update: position.update
|
|
5452
|
-
};
|
|
5453
|
-
}
|
|
5454
|
-
// src/composables/teleportTarget.ts
|
|
5455
|
-
/**
|
|
5456
|
-
* Whether an element is a dialog the browser has put in its **top layer**.
|
|
5457
|
-
*
|
|
5458
|
-
* `:modal` is the only way to ask: a `<dialog>` has the `open` attribute whether it was shown with
|
|
5459
|
-
* `show()` (an ordinary in-flow element, which clips and stacks like any other) or with
|
|
5460
|
-
* `showModal()` (top layer, above every z-index, with a backdrop), and nothing else in the DOM
|
|
5461
|
-
* tells the two apart. Engines that do not implement `:modal` answer `false` here — happy-dom
|
|
5462
|
-
* parses the selector and never matches it, jsdom does not implement `<dialog>` modality at all —
|
|
5463
|
-
* which is what the caller's fallback is for.
|
|
5464
|
-
*
|
|
5465
|
-
* Wrapped in a `try`: a selector an engine cannot parse is a `SyntaxError`, not a `false`.
|
|
5466
|
-
*/
|
|
5467
|
-
function isTopLayer(element) {
|
|
5468
|
-
try {
|
|
5469
|
-
return element.matches(":modal");
|
|
5470
|
-
} catch {
|
|
5471
|
-
return false;
|
|
5472
|
-
}
|
|
5473
|
-
}
|
|
5474
|
-
/**
|
|
5475
|
-
* The `<dialog>` a popup anchored to `anchor` has to be teleported *into* rather than escape, or
|
|
5476
|
-
* `null` when there is none.
|
|
5477
|
-
*
|
|
5478
|
-
* A **modal** dialog is the one place `document.body` is the wrong target: the dialog is in the top
|
|
5479
|
-
* layer, so a popup on the body would be painted behind it and no `z-index` could raise it. So the
|
|
5480
|
-
* nearest open ancestor dialog that is actually in the top layer wins — which is not always the
|
|
5481
|
-
* nearest one, since a non-modal `<dialog open>` may sit inside a modal one.
|
|
5482
|
-
*
|
|
5483
|
-
* When **no** ancestor dialog claims the top layer, the nearest open one is still the answer. That
|
|
5484
|
-
* case is ambiguous — either they really are all non-modal, or the engine does not implement
|
|
5485
|
-
* `:modal` and cannot say — and the two mistakes are not equally bad. Teleporting into a dialog
|
|
5486
|
-
* that did not need it still escapes everything between the control and that dialog, and the
|
|
5487
|
-
* dialog is a box the popup had no business overflowing anyway; teleporting to `body` out of a
|
|
5488
|
-
* dialog that *was* modal puts the popup behind it, invisibly, which is the very bug this whole
|
|
5489
|
-
* mechanism exists to fix. There is no engine-independent probe to break the tie —
|
|
5490
|
-
* `CSS.supports('selector(:modal)')` answers `true` for nonsense in happy-dom — so the safe
|
|
5491
|
-
* mistake is the one taken. A non-modal `<dialog open>` is in any case close to hypothetical here:
|
|
5492
|
-
* the design spec's non-negotiable 2 opens every modal surface with `showModal()`, and says the
|
|
5493
|
-
* non-modal popups are not dialogs at all.
|
|
5494
|
-
*/
|
|
5495
|
-
function topLayerDialog(anchor) {
|
|
5496
|
-
const nearest = anchor.closest("dialog[open]");
|
|
5497
|
-
if (nearest === null) return null;
|
|
5498
|
-
for (let dialog = nearest; dialog !== null; dialog = dialog.parentElement?.closest("dialog[open]") ?? null) if (isTopLayer(dialog)) return dialog;
|
|
5499
|
-
return nearest;
|
|
5500
|
-
}
|
|
5501
|
-
/**
|
|
5502
|
-
* Where a teleported popup is rendered: `usePopover`'s and `Tooltip`'s shared answer to "escape
|
|
5503
|
-
* clipping and stacking, but not the browser's own top layer."
|
|
5504
|
-
*
|
|
5505
|
-
* A panel (or bubble) rendered inside its own control is at the mercy of everything above it: an
|
|
5506
|
-
* ancestor with `overflow: hidden` (a card, a table cell, a carousel track) clips it, and any later
|
|
5507
|
-
* sibling that starts a stacking context (a sticky header with a `z-index`, a section with
|
|
5508
|
-
* `isolate`) paints over it however high its own `z-index` is. On `body` neither can happen — except
|
|
5509
|
-
* for a native `<dialog>` opened with `showModal()`, which renders in the top layer above every
|
|
5510
|
-
* `z-index` on the page, so a popup teleported to `body` out from under one would be invisible
|
|
5511
|
-
* behind it. `topLayerDialog` is the one exception that rule needs.
|
|
5512
|
-
*
|
|
5513
|
-
* ```ts
|
|
5514
|
-
* const isOpen = ref(false);
|
|
5515
|
-
* const trigger = ref<HTMLElement | null>(null);
|
|
5516
|
-
* const { teleportTo, teleportDisabled } = useTeleportTarget({ trigger, teleport: true, isOpen });
|
|
5517
|
-
* ```
|
|
5518
|
-
*/
|
|
5519
|
-
function useTeleportTarget(options) {
|
|
5520
|
-
const { trigger, teleport, isOpen } = options;
|
|
5521
|
-
/**
|
|
5522
|
-
* Only `true` after `onMounted`, which never runs on the server. Everything that reads the
|
|
5523
|
-
* document below is behind it.
|
|
5524
|
-
*/
|
|
5525
|
-
const isMounted = ref(false);
|
|
5526
|
-
onMounted(() => {
|
|
5527
|
-
isMounted.value = true;
|
|
5528
|
-
});
|
|
5529
|
-
const teleportDisabled = computed(() => teleport === false || !isMounted.value);
|
|
5530
|
-
return {
|
|
5531
|
-
teleportTo: computed(() => {
|
|
5532
|
-
if (!isMounted.value) return "body";
|
|
5533
|
-
if (typeof teleport === "string") return teleport;
|
|
5534
|
-
isOpen.value;
|
|
5535
|
-
const anchor = trigger.value;
|
|
5536
|
-
return (anchor === null ? null : topLayerDialog(anchor)) ?? document.body;
|
|
5537
|
-
}),
|
|
5538
|
-
teleportDisabled
|
|
5539
|
-
};
|
|
5540
|
-
}
|
|
5541
|
-
// src/composables/useOverlay.ts
|
|
5542
|
-
/**
|
|
5543
|
-
* Anything the platform lets a user reach with `Tab`, plus the elements a component has opted in
|
|
5544
|
-
* with a `tabindex`. `tabindex="-1"` is deliberately excluded: it is programmatically focusable,
|
|
5545
|
-
* not part of the sequence a keyboard user walks, and `focusFirst()` exists to put focus where a
|
|
5546
|
-
* user would have put it themselves.
|
|
5547
|
-
*/
|
|
5548
|
-
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^=\"-\"])";
|
|
5549
|
-
/**
|
|
5550
|
-
* Marks an element that belongs to an overlay whose content element has this `id`.
|
|
5551
|
-
*
|
|
5552
|
-
* Exported for `usePopover`, which has to find those elements rather than only recognise one it is
|
|
5553
|
-
* handed: a teleported panel's `Tab` walk runs through them (see its `tabRedirect` option).
|
|
5554
|
-
*/
|
|
5555
|
-
var OVERLAY_OWNER_ATTRIBUTE = "data-eldra-overlay-owner";
|
|
5556
|
-
var read = (setting, fallback) => setting === void 0 ? fallback : typeof setting === "function" ? setting() : setting;
|
|
5557
|
-
/**
|
|
5558
|
-
* The closing and focus rules shared by every **non-modal** popup in this package — the Select and
|
|
5559
|
-
* Multi-select panels, the Search bar's results panel, menus.
|
|
5560
|
-
*
|
|
5561
|
-
* Non-modal is the whole point. The design spec's non-negotiables put every *modal* surface in a
|
|
5562
|
-
* native `<dialog>` opened with `showModal()`, and say in the same breath that these popups are not
|
|
5563
|
-
* dialogs: "Non-modal popups (select panels, search results panel, mega-menus, tooltips) are **not**
|
|
5564
|
-
* dialogs." So there is no focus trap here and no `Tab` cycling — `Tab` simply moves on, and focus
|
|
5565
|
-
* landing outside is what closes the popup (WCAG 2.1.2: no keyboard trap). Everything this
|
|
5566
|
-
* composable does is close at the right moment and leave focus somewhere sensible.
|
|
5567
|
-
*
|
|
5568
|
-
* What it listens for, and only while `open` is `true`:
|
|
5569
|
-
*
|
|
5570
|
-
* - **A pointer press outside** (`pointerdown`, captured, so a handler inside the page that stops
|
|
5571
|
-
* propagation cannot hide the press from us). Inside is the trigger, the content, and anything
|
|
5572
|
-
* under an element carrying `data-eldra-overlay-owner="<the content's id>"` — which is how a
|
|
5573
|
-
* panel rendered through a `<Teleport>` still counts as part of the overlay. Closing this way
|
|
5574
|
-
* never moves focus: the user is pressing something else, and pulling focus back to the trigger
|
|
5575
|
-
* would take it off whatever they just pressed.
|
|
5576
|
-
* - **Focus leaving** (`focusout`). If the new focus owner is outside the overlay, the popup
|
|
5577
|
-
* closes and focus stays where the user sent it. If focus went *nowhere* (`relatedTarget` is
|
|
5578
|
-
* `null` — the content is about to be removed from under it), `returnFocus` puts it back on the
|
|
5579
|
-
* trigger rather than letting it fall to `<body>`.
|
|
5580
|
-
* - **`Escape`** (`keydown`, bubbling, so a component that wants the first go at `Escape` — the
|
|
5581
|
-
* Select clears its search query before it closes — can handle it and stop propagation). It
|
|
5582
|
-
* closes, returns focus to the trigger, and both `preventDefault()`s and stops propagation: a
|
|
5583
|
-
* popup inside a native `<dialog>` must consume the key, or the dialog closes behind it.
|
|
5584
|
-
*
|
|
5585
|
-
* Listeners go on `document` when the overlay opens and come off when it closes or the scope is
|
|
5586
|
-
* disposed, so a closed overlay costs nothing and an unmounted one leaves nothing behind. Nothing
|
|
5587
|
-
* touches the DOM during SSR.
|
|
5588
|
-
*
|
|
5589
|
-
* ```ts
|
|
5590
|
-
* const open = ref(false);
|
|
5591
|
-
* const trigger = ref<HTMLElement | null>(null);
|
|
5592
|
-
* const content = ref<HTMLElement | null>(null);
|
|
5593
|
-
* const overlay = useOverlay({ open, trigger, content, setOpen: (next) => (open.value = next) });
|
|
5594
|
-
* ```
|
|
5595
|
-
*/
|
|
5596
|
-
function useOverlay(options) {
|
|
5597
|
-
const { open, trigger, content, setOpen } = options;
|
|
5598
|
-
const closeOnOutsideClick = () => read(options.closeOnOutsideClick, true);
|
|
5599
|
-
const closeOnFocusOutside = () => read(options.closeOnFocusOutside, closeOnOutsideClick());
|
|
5600
|
-
const closeOnEscape = () => read(options.closeOnEscape, true);
|
|
5601
|
-
const returnFocus = () => read(options.returnFocus, true);
|
|
5602
|
-
const focusables = (from) => {
|
|
5603
|
-
const root = from === void 0 ? content.value : from;
|
|
5604
|
-
if (!root) return [];
|
|
5605
|
-
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);
|
|
5606
|
-
};
|
|
5607
|
-
const focusFirst = () => {
|
|
5608
|
-
focusables()[0]?.focus();
|
|
5609
|
-
};
|
|
5610
|
-
const close = () => setOpen(false);
|
|
5611
|
-
/**
|
|
5612
|
-
* A teleported part of the overlay is in the DOM somewhere else entirely, so containment says
|
|
5613
|
-
* nothing about it. It is claimed one of two ways, both followed transitively:
|
|
5614
|
-
*
|
|
5615
|
-
* - **An owner marker**: an ancestor carrying `data-eldra-overlay-owner` names the content's id —
|
|
5616
|
-
* or the id of any element that is itself inside this overlay, so a picker teleported out of a
|
|
5617
|
-
* panel can point at the field inside the panel it belongs to.
|
|
5618
|
-
* - **An open control inside the overlay**: an element with `aria-expanded="true"` inside this
|
|
5619
|
-
* overlay names, in `aria-controls`, an element in the node's popup — the owner-marked panel
|
|
5620
|
-
* that element sits in, or the element itself. That is a nested popup (a `Select` or another
|
|
5621
|
-
* `Popover` opened from this panel) whose own panel is teleported too.
|
|
5622
|
-
*
|
|
5623
|
-
* Walked by hand rather than through selectors so an id with a character CSS would have to
|
|
5624
|
-
* escape cannot break the check.
|
|
5625
|
-
*/
|
|
5626
|
-
const isInside = (node, visited = /* @__PURE__ */ new Set()) => {
|
|
5627
|
-
if (!(node instanceof Node) || visited.has(node)) return false;
|
|
5628
|
-
visited.add(node);
|
|
5629
|
-
if (trigger.value?.contains(node) === true) return true;
|
|
5630
|
-
if (content.value?.contains(node) === true) return true;
|
|
5631
|
-
const id = content.value?.id;
|
|
5632
|
-
if (id === void 0 || id === "" || typeof document === "undefined") return false;
|
|
5633
|
-
for (let element = node instanceof Element ? node : node.parentElement; element !== null; element = element.parentElement) {
|
|
5634
|
-
const owner = element.getAttribute(OVERLAY_OWNER_ATTRIBUTE);
|
|
5635
|
-
if (owner === id) return true;
|
|
5636
|
-
if (owner === null || owner === "") continue;
|
|
5637
|
-
const named = document.getElementById(owner);
|
|
5638
|
-
if (named !== null && !named.contains(element) && isInside(named, visited)) return true;
|
|
5639
|
-
}
|
|
5640
|
-
for (const control of document.querySelectorAll("[aria-controls]")) {
|
|
5641
|
-
if (control.getAttribute("aria-expanded") !== "true" || control.contains(node)) continue;
|
|
5642
|
-
for (const controlled of (control.getAttribute("aria-controls") ?? "").split(/\s+/)) {
|
|
5643
|
-
const target = controlled === "" ? null : document.getElementById(controlled);
|
|
5644
|
-
if (target === null) continue;
|
|
5645
|
-
const popup = target.closest(`[data-eldra-overlay-owner]`) ?? target;
|
|
5646
|
-
if (!popup.contains(node) || popup.contains(control)) continue;
|
|
5647
|
-
if (isInside(control, visited)) return true;
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
return false;
|
|
5651
|
-
};
|
|
5652
|
-
const onPointerDown = (event) => {
|
|
5653
|
-
if (!open.value || !closeOnOutsideClick() || isInside(event.target)) return;
|
|
5654
|
-
close();
|
|
5655
|
-
};
|
|
5656
|
-
const onFocusOut = (event) => {
|
|
5657
|
-
if (!open.value || !closeOnFocusOutside()) return;
|
|
5658
|
-
if (!isInside(event.target)) return;
|
|
5659
|
-
const next = event.relatedTarget;
|
|
5660
|
-
if (isInside(next)) return;
|
|
5661
|
-
close();
|
|
5662
|
-
if (returnFocus() && next === null) trigger.value?.focus();
|
|
5663
|
-
};
|
|
5664
|
-
const onKeyDown = (event) => {
|
|
5665
|
-
if (!open.value || event.key !== "Escape" || !closeOnEscape()) return;
|
|
5666
|
-
event.preventDefault();
|
|
5667
|
-
event.stopPropagation();
|
|
5668
|
-
close();
|
|
5669
|
-
if (returnFocus()) trigger.value?.focus();
|
|
5670
|
-
};
|
|
5671
|
-
let listening = false;
|
|
5672
|
-
const attach = () => {
|
|
5673
|
-
if (listening || typeof document === "undefined") return;
|
|
5674
|
-
listening = true;
|
|
5675
|
-
document.addEventListener("pointerdown", onPointerDown, true);
|
|
5676
|
-
document.addEventListener("focusout", onFocusOut);
|
|
5677
|
-
document.addEventListener("keydown", onKeyDown);
|
|
5678
|
-
};
|
|
5679
|
-
const detach = () => {
|
|
5680
|
-
if (!listening) return;
|
|
5681
|
-
listening = false;
|
|
5682
|
-
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
5683
|
-
document.removeEventListener("focusout", onFocusOut);
|
|
5684
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
5685
|
-
};
|
|
5686
|
-
watch(open, (isOpen) => isOpen ? attach() : detach(), { immediate: true });
|
|
5687
|
-
onScopeDispose(detach);
|
|
5688
|
-
return {
|
|
5689
|
-
close,
|
|
5690
|
-
focusFirst,
|
|
5691
|
-
focusables,
|
|
5692
|
-
isInside: (node) => isInside(node)
|
|
5693
|
-
};
|
|
5694
|
-
}
|
|
5695
|
-
// src/components/select/openRegistry.ts
|
|
5696
|
-
/**
|
|
5697
|
-
* The open popups, outermost first. Without nesting it never holds more than one entry; a popup
|
|
5698
|
-
* opened from inside another's panel is stacked on it instead of closing it.
|
|
5699
|
-
*/
|
|
5700
|
-
var stack = [];
|
|
5701
|
-
/**
|
|
5702
|
-
* Claim the slot and close whatever held it — except the popups the new one is nested in.
|
|
5703
|
-
*
|
|
5704
|
-
* The slot is reassigned *before* the previous popups are closed, so the `unregisterOpen` that
|
|
5705
|
-
* closing triggers sees a slot that is no longer its own and leaves the new owner alone.
|
|
5706
|
-
*/
|
|
5707
|
-
function registerOpen(close, options = {}) {
|
|
5708
|
-
if (stack.at(-1)?.close === close) return;
|
|
5709
|
-
const { anchor } = options;
|
|
5710
|
-
const kept = [];
|
|
5711
|
-
const closed = [];
|
|
5712
|
-
for (const entry of stack) {
|
|
5713
|
-
if (entry.close === close) continue;
|
|
5714
|
-
(anchor !== void 0 && anchor !== null && entry.contains?.(anchor) === true ? kept : closed).push(entry);
|
|
5715
|
-
}
|
|
5716
|
-
stack = [...kept, {
|
|
5717
|
-
close,
|
|
5718
|
-
contains: options.contains
|
|
5719
|
-
}];
|
|
5720
|
-
for (const entry of closed) entry.close();
|
|
5721
|
-
}
|
|
5722
|
-
/** Release the slot, if it is still this popup's. */
|
|
5723
|
-
function unregisterOpen(close) {
|
|
5724
|
-
stack = stack.filter((entry) => entry.close !== close);
|
|
5725
|
-
}
|
|
5726
|
-
// src/components/select/usePopover.ts
|
|
5727
|
-
/**
|
|
5728
|
-
* The open/closed life of a **non-modal popup** anchored to a control: `Select`'s panel,
|
|
5729
|
-
* `MultiSelect`'s, and the `SearchBar`'s results panel.
|
|
5730
|
-
*
|
|
5731
|
-
* Every one of them needs the same six things, and before this composable the first two controls
|
|
5732
|
-
* held a line-identical copy of all of them:
|
|
5733
|
-
*
|
|
5734
|
-
* - **"Only one open at a time"** (`openRegistry`): opening claims a module-level slot and closes
|
|
5735
|
-
* whatever held it. The handle is stable per instance, so a late close cannot blank out the
|
|
5736
|
-
* popup that took its place.
|
|
5737
|
-
* - **Closing** (`useOverlay`): an outside pointer press, focus leaving, `Escape`. Non-modal, so
|
|
5738
|
-
* nothing is trapped and `Tab` always moves on.
|
|
5739
|
-
* - **Getting out of the way of the page** (`teleport`): the panel is rendered through a
|
|
5740
|
-
* `<Teleport>` to `body` — or to the modal `<dialog>` the trigger is in, which is the one place
|
|
5741
|
-
* `body` would be *behind* — and positioned with floating-ui's `fixed` strategy, so no ancestor's
|
|
5742
|
-
* `overflow: hidden` clips it and no later stacking context paints over it. `tabRedirect` puts a
|
|
5743
|
-
* panel that has real tab stops back into the `Tab` walk it left with its place in the DOM.
|
|
5744
|
-
* - **Positioning** (`useFloating`), plus the `--eldra-popover-origin` the entrance keyframes read,
|
|
5745
|
-
* so a panel that flips after floating-ui measures changes a custom property rather than its
|
|
5746
|
-
* `animation-name` (which would replay the entrance).
|
|
5747
|
-
* - **The open sequence**: open, make a row active, and — only when the call actually changed the
|
|
5748
|
-
* state — run `afterOpen` a tick later, which is where focus moves into the panel.
|
|
5749
|
-
* - **The label-forwarded-click latch**: a `<label for>` naming the trigger forwards its click to
|
|
5750
|
-
* it, and the spec is explicit that clicking a field's label focuses the control **without**
|
|
5751
|
-
* opening it. A forwarded click differs from a real one in that no pointer was pressed on the
|
|
5752
|
-
* trigger and its `detail` is 0. The latch is armed on `pointerdown` and released on the
|
|
5753
|
-
* `pointerup` or `pointercancel` that follows, wherever it lands: a press that ends off the
|
|
5754
|
-
* trigger (a drag, a cancelled touch) would otherwise leave the latch standing and arm the
|
|
5755
|
-
* *next* click. A programmatic `element.click()` has the same shape, so it is told apart by what
|
|
5756
|
-
* it is not (see `isProgrammaticClick`): not forwarded from a label clicked in the same task,
|
|
5757
|
-
* not trusted, and a `PointerEvent`, which is what `click()` dispatches.
|
|
5758
|
-
*
|
|
5759
|
-
* What stays with each control is what actually differs: which rows there are, what choosing one
|
|
5760
|
-
* does, and which element the popup is anchored to.
|
|
5761
|
-
*/
|
|
5762
|
-
/**
|
|
5763
|
-
* The control a `<label>` click is about to forward to, until the task that clicked it ends. A
|
|
5764
|
-
* label's activation behaviour fires its forwarded click synchronously after its own click's
|
|
5765
|
-
* dispatch, so a capture listener on `document` sees the label's click first. One listener for the
|
|
5766
|
-
* whole page, attached on first use in a browser.
|
|
5767
|
-
*/
|
|
5768
|
-
var forwardingTo = null;
|
|
5769
|
-
var labelWatcherAttached = false;
|
|
5770
|
-
function watchLabelClicks() {
|
|
5771
|
-
if (labelWatcherAttached || typeof document === "undefined") return;
|
|
5772
|
-
labelWatcherAttached = true;
|
|
5773
|
-
document.addEventListener("click", (event) => {
|
|
5774
|
-
const target = event.target;
|
|
5775
|
-
if (!(target instanceof Element)) return;
|
|
5776
|
-
const control = target.closest("label")?.control ?? null;
|
|
5777
|
-
if (!(control instanceof HTMLElement) || control.contains(target)) return;
|
|
5778
|
-
forwardingTo = control;
|
|
5779
|
-
setTimeout(() => {
|
|
5780
|
-
if (forwardingTo === control) forwardingTo = null;
|
|
5781
|
-
}, 0);
|
|
5782
|
-
}, true);
|
|
5783
|
-
}
|
|
5784
|
-
/**
|
|
5785
|
-
* Whether a click with no pointer press behind it came from code (`trigger.click()`) rather than a
|
|
5786
|
-
* `<label>` forwarding its own: not forwarded from a label clicked in this task, untrusted (a
|
|
5787
|
-
* user's label click forwards a trusted one), and a `PointerEvent`, which is what `click()`
|
|
5788
|
-
* dispatches. A bare `dispatchEvent(new MouseEvent('click'))` keeps counting as forwarded, as it
|
|
5789
|
-
* always has; so does every click in an engine whose `click()` still sends a `MouseEvent`.
|
|
5790
|
-
*/
|
|
5791
|
-
function isProgrammaticClick(event, trigger) {
|
|
5792
|
-
if (trigger !== null && forwardingTo !== null && trigger.contains(forwardingTo)) return false;
|
|
5793
|
-
return !event.isTrusted && typeof PointerEvent !== "undefined" && event instanceof PointerEvent;
|
|
5794
|
-
}
|
|
5795
|
-
function usePopover(options) {
|
|
5796
|
-
const { trigger, content } = options;
|
|
5797
|
-
watchLabelClicks();
|
|
5798
|
-
const canOpen = () => options.canOpen?.() !== false;
|
|
5799
|
-
const isOpen = ref(false);
|
|
5800
|
-
const isExclusive = () => {
|
|
5801
|
-
const setting = options.exclusive ?? true;
|
|
5802
|
-
return typeof setting === "function" ? setting() : setting;
|
|
5803
|
-
};
|
|
5804
|
-
/** The `anchor`, when it is a real element rather than a virtual one. */
|
|
5805
|
-
const anchorElement = () => {
|
|
5806
|
-
const anchor = options.anchor?.value ?? null;
|
|
5807
|
-
return typeof HTMLElement !== "undefined" && anchor instanceof HTMLElement ? anchor : null;
|
|
5808
|
-
};
|
|
5809
|
-
/** The registry's handle on this popup. Stable, so the registry can tell ours from another's. */
|
|
5810
|
-
const closeFromRegistry = () => setOpen(false);
|
|
5811
|
-
function setOpen(next) {
|
|
5812
|
-
if (next === isOpen.value) return;
|
|
5813
|
-
if (next) {
|
|
5814
|
-
if (!canOpen()) return;
|
|
5815
|
-
isOpen.value = true;
|
|
5816
|
-
if (isExclusive()) registerOpen(closeFromRegistry, {
|
|
5817
|
-
anchor: trigger.value ?? anchorElement(),
|
|
5818
|
-
contains: (node) => overlay.isInside(node)
|
|
5819
|
-
});
|
|
5820
|
-
options.onOpen?.();
|
|
5821
|
-
return;
|
|
5822
|
-
}
|
|
5823
|
-
isOpen.value = false;
|
|
5824
|
-
unregisterOpen(closeFromRegistry);
|
|
5825
|
-
options.onClose?.();
|
|
5826
|
-
}
|
|
5827
|
-
const overlay = useOverlay({
|
|
5828
|
-
open: isOpen,
|
|
5829
|
-
trigger,
|
|
5830
|
-
content,
|
|
5831
|
-
setOpen: (next) => setOpen(next),
|
|
5832
|
-
closeOnOutsideClick: options.closeOnOutsideClick,
|
|
5833
|
-
closeOnFocusOutside: options.closeOnFocusOutside,
|
|
5834
|
-
closeOnEscape: options.closeOnEscape,
|
|
5835
|
-
returnFocus: options.returnFocus
|
|
5836
|
-
});
|
|
5837
|
-
const teleport = options.teleport ?? true;
|
|
5838
|
-
const { teleportTo, teleportDisabled } = useTeleportTarget({
|
|
5839
|
-
trigger: computed(() => trigger.value ?? anchorElement()),
|
|
5840
|
-
teleport,
|
|
5841
|
-
isOpen
|
|
5842
|
-
});
|
|
5843
|
-
const { styles: floatingStyles, placement, update } = useFloating$1(computed(() => options.anchor?.value ?? trigger.value), content, {
|
|
5844
|
-
placement: options.placement ?? "auto",
|
|
5845
|
-
offset: options.offset,
|
|
5846
|
-
padding: options.padding,
|
|
5847
|
-
matchWidth: options.matchWidth,
|
|
5848
|
-
strategy: teleport === false ? "absolute" : "fixed"
|
|
5849
|
-
});
|
|
5850
|
-
const wantsTabRedirect = () => {
|
|
5851
|
-
const setting = options.tabRedirect ?? false;
|
|
5852
|
-
return typeof setting === "function" ? setting() : setting;
|
|
5853
|
-
};
|
|
5854
|
-
/**
|
|
5855
|
-
* Every tab stop of this overlay that is **not** in the panel, in document order — the trigger,
|
|
5856
|
-
* plus anything claiming the panel's id with `data-eldra-overlay-owner` (a multi-select's clear
|
|
5857
|
-
* button). These keep their natural place in the walk: the redirect happens at the **last** of
|
|
5858
|
-
* them, so `Tab` still passes each one on the way to the panel.
|
|
5859
|
-
*
|
|
5860
|
-
* The owner elements are found with a plain attribute-presence selector and filtered by value in
|
|
5861
|
-
* JavaScript, for the reason `useOverlay` walks the attribute by hand: an id is merchant-settable
|
|
5862
|
-
* through the `id` prop, and one holding a character CSS would need escaped must not break this.
|
|
5863
|
-
*/
|
|
5864
|
-
function stopsBeforePanel(panel) {
|
|
5865
|
-
const roots = [];
|
|
5866
|
-
if (trigger.value !== null) roots.push(trigger.value);
|
|
5867
|
-
const id = panel.id;
|
|
5868
|
-
if (id !== "") for (const owner of document.querySelectorAll(`[${OVERLAY_OWNER_ATTRIBUTE}]`)) {
|
|
5869
|
-
if (owner.getAttribute("data-eldra-overlay-owner") !== id) continue;
|
|
5870
|
-
if (panel.contains(owner) || roots.includes(owner)) continue;
|
|
5871
|
-
roots.push(owner);
|
|
5872
|
-
}
|
|
5873
|
-
return roots.flatMap((root) => overlay.focusables(root)).sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) === 0 ? 1 : -1);
|
|
5874
|
-
}
|
|
5875
|
-
/**
|
|
5876
|
-
* The two boundary keystrokes of the walk described on the `tabRedirect` option: into the panel
|
|
5877
|
-
* from the last tab stop the control still holds, and back out of the panel's first row to that
|
|
5878
|
-
* same stop. Everything else about `Tab` is left to the browser, which is what keeps this a
|
|
5879
|
-
* redirect rather than a trap — including the steps *within* the control, so a multi-select's
|
|
5880
|
-
* clear button is passed on the way in and returned to on the way back.
|
|
5881
|
-
*
|
|
5882
|
-
* It listens in the **capture** phase, before the control's own `keydown` reaches its handler:
|
|
5883
|
-
* `useListbox`'s `Tab` case asks the caller to close (the `SearchBar` does), and a popup that has
|
|
5884
|
-
* already closed has nothing left to walk into. Propagation is stopped only on the two keystrokes
|
|
5885
|
-
* actually redirected, so every other `Tab` arrives at the control untouched.
|
|
5886
|
-
*/
|
|
5887
|
-
function onTabKeyDown(event) {
|
|
5888
|
-
if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
5889
|
-
if (!isOpen.value || teleportDisabled.value || !wantsTabRedirect()) return;
|
|
5890
|
-
const panel = content.value;
|
|
5891
|
-
const active = document.activeElement;
|
|
5892
|
-
if (panel === null || active === null) return;
|
|
5893
|
-
const first = overlay.focusables()[0];
|
|
5894
|
-
if (first === void 0) return;
|
|
5895
|
-
const last = stopsBeforePanel(panel).at(-1);
|
|
5896
|
-
if (event.shiftKey) {
|
|
5897
|
-
if (active !== first) return;
|
|
5898
|
-
event.preventDefault();
|
|
5899
|
-
event.stopPropagation();
|
|
5900
|
-
(last ?? trigger.value)?.focus();
|
|
5901
|
-
return;
|
|
5902
|
-
}
|
|
5903
|
-
if (panel.contains(active) || !overlay.isInside(active)) return;
|
|
5904
|
-
if (last !== void 0 && active !== last) return;
|
|
5905
|
-
event.preventDefault();
|
|
5906
|
-
event.stopPropagation();
|
|
5907
|
-
first.focus();
|
|
5908
|
-
}
|
|
5909
|
-
const attachTabRedirect = () => {
|
|
5910
|
-
if (typeof document === "undefined") return;
|
|
5911
|
-
document.addEventListener("keydown", onTabKeyDown, true);
|
|
5912
|
-
};
|
|
5913
|
-
const detachTabRedirect = () => {
|
|
5914
|
-
if (typeof document === "undefined") return;
|
|
5915
|
-
document.removeEventListener("keydown", onTabKeyDown, true);
|
|
5916
|
-
};
|
|
5917
|
-
watch(isOpen, (open) => open ? attachTabRedirect() : detachTabRedirect(), { immediate: true });
|
|
5918
|
-
function open(activate) {
|
|
5919
|
-
if (!canOpen()) return;
|
|
5920
|
-
const wasOpen = isOpen.value;
|
|
5921
|
-
setOpen(true);
|
|
5922
|
-
if (!isOpen.value) return;
|
|
5923
|
-
activate?.(wasOpen);
|
|
5924
|
-
if (!wasOpen) options.afterOpen?.();
|
|
5925
|
-
}
|
|
5926
|
-
function close(returnFocus = true) {
|
|
5927
|
-
if (!isOpen.value) return;
|
|
5928
|
-
setOpen(false);
|
|
5929
|
-
if (returnFocus) trigger.value?.focus();
|
|
5930
|
-
}
|
|
5931
|
-
let pressedTrigger = false;
|
|
5932
|
-
function releaseTrigger(event) {
|
|
5933
|
-
detachTriggerRelease();
|
|
5934
|
-
const target = event.target;
|
|
5935
|
-
if (target instanceof Node && trigger.value?.contains(target) === true) return;
|
|
5936
|
-
pressedTrigger = false;
|
|
5937
|
-
}
|
|
5938
|
-
function detachTriggerRelease() {
|
|
5939
|
-
if (typeof document === "undefined") return;
|
|
5940
|
-
document.removeEventListener("pointerup", releaseTrigger, true);
|
|
5941
|
-
document.removeEventListener("pointercancel", releaseTrigger, true);
|
|
5942
|
-
}
|
|
5943
|
-
function onTriggerPointerDown() {
|
|
5944
|
-
pressedTrigger = true;
|
|
5945
|
-
if (typeof document === "undefined") return;
|
|
5946
|
-
document.addEventListener("pointerup", releaseTrigger, true);
|
|
5947
|
-
document.addEventListener("pointercancel", releaseTrigger, true);
|
|
5948
|
-
}
|
|
5949
|
-
function onTriggerClick(event) {
|
|
5950
|
-
const fromPointer = pressedTrigger || event.detail > 0 || isProgrammaticClick(event, trigger.value);
|
|
5951
|
-
pressedTrigger = false;
|
|
5952
|
-
if (!canOpen()) return;
|
|
5953
|
-
if (!fromPointer) {
|
|
5954
|
-
trigger.value?.focus();
|
|
5955
|
-
return;
|
|
5956
|
-
}
|
|
5957
|
-
if (isOpen.value) close();
|
|
5958
|
-
else options.openFromPointer?.();
|
|
5959
|
-
}
|
|
5960
|
-
onBeforeUnmount(() => {
|
|
5961
|
-
unregisterOpen(closeFromRegistry);
|
|
5962
|
-
detachTriggerRelease();
|
|
5963
|
-
detachTabRedirect();
|
|
5964
|
-
});
|
|
5965
|
-
/**
|
|
5966
|
-
* Which corner the panel grows from: the one it is anchored by, so the entrance reads as the
|
|
5967
|
-
* control opening out rather than as a box arriving from somewhere. A panel below the control
|
|
5968
|
-
* grows from `top left`, a flipped one from `bottom left`. A custom property rather than a second
|
|
5969
|
-
* animation class: see the composable's own comment above, and the keyframes in `tailwind.css`.
|
|
5970
|
-
*
|
|
5971
|
-
* Logical directions are deliberately not used. `transform-origin` takes physical keywords only
|
|
5972
|
-
* (`left`/`right`, never `inline-start`), and every panel in this package is `start`-aligned and
|
|
5973
|
-
* at least as wide as its control, so the horizontal half barely moves the result either way.
|
|
5974
|
-
*/
|
|
5975
|
-
const origin = computed(() => {
|
|
5976
|
-
if (placement.value.startsWith("top")) return "bottom left";
|
|
5977
|
-
if (placement.value.startsWith("left")) return "top right";
|
|
5978
|
-
return "top left";
|
|
5979
|
-
});
|
|
5980
|
-
return {
|
|
5981
|
-
isOpen,
|
|
5982
|
-
setOpen,
|
|
5983
|
-
open,
|
|
5984
|
-
close,
|
|
5985
|
-
panelStyle: computed(() => ({
|
|
5986
|
-
...floatingStyles.value,
|
|
5987
|
-
"--eldra-popover-origin": origin.value
|
|
5988
|
-
})),
|
|
5989
|
-
placement,
|
|
5990
|
-
teleportTo,
|
|
5991
|
-
teleportDisabled,
|
|
5992
|
-
onTriggerPointerDown,
|
|
5993
|
-
onTriggerClick,
|
|
5994
|
-
focusFirst: overlay.focusFirst,
|
|
5995
|
-
isInside: overlay.isInside,
|
|
5996
|
-
update
|
|
5997
|
-
};
|
|
5998
|
-
}
|
|
5999
3785
|
// src/components/select/MultiSelect.vue?vue&type=script&setup=true&lang.ts
|
|
6000
3786
|
var _hoisted_1$7 = ["data-eldra-scope"];
|
|
6001
3787
|
var _hoisted_2$7 = ["data-part", "data-eldra-overlay-owner"];
|
|
@@ -10332,4 +8118,4 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
10332
8118
|
};
|
|
10333
8119
|
}
|
|
10334
8120
|
});
|
|
10335
|
-
export {
|
|
8121
|
+
export { FORM_SUBMITTING_KEY as $, UnitInput_default as A, useSlotPresence as B, Switch_default as C, defaultCharacterMeaning as D, applyMask as E, formatCurrency as F, CheckboxGroup_default as G, TAG_FILL as H, formatNumber as I, RequiredMark_default as J, Checkbox_default as K, formatUnit as L, currencyFractionDigits as M, currencySymbol as N, stripMask as O, defaultUnitFormat as P, FORM_LAYOUT_KEY as Q, localeSeparators as R, focusInvalid as S, Input_default as T, TAG_SHAPE as U, useHeadingTag as V, tagPadding as W, Button_default as X, FieldError_default as Y, Icon_default as Z, optionCursor as _, claimShortcut as a, MultiSelect_default as b, SearchResultsPanel_default as c, INPUT as d, PLAIN_BOX_ONLY as f, labelRecipe as g, dotRecipe as h, SearchBar_default as i, createNumberFormat as j, CurrencyInput_default as k, RadioGroup_default as l, PLAIN_OPTION as m, Textarea_default as n, ownsShortcut as o, PLAIN_COLUMNS as p, VisuallyHidden_default as q, Select_default as r, releaseShortcut as s, VariantPicker_default as t, HINT as u, radioRecipe as v, filterNumericBeforeInput as w, FormLayout_default as x, QuantityStepper_default as y, parseLocaleNumber as z };
|