@eldrajs/ui 0.2.9 → 0.3.1
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 +13 -0
- package/README.md +171 -151
- package/dist/{VariantPicker-Da41_oGA.js → VariantPicker-DDFlMvgJ.js} +1222 -833
- package/dist/components/accordion/Accordion.vue.d.ts +1 -2
- package/dist/components/accordion/AccordionItem.vue.d.ts +1 -1
- package/dist/components/accordion/types.d.ts +6 -7
- package/dist/components/avatar/Avatar.vue.d.ts +1 -1
- package/dist/components/avatar/types.d.ts +6 -4
- package/dist/components/badge/types.d.ts +6 -4
- package/dist/components/breadcrumb/types.d.ts +5 -2
- package/dist/components/button/Button.vue.d.ts +3 -3
- package/dist/components/button/ButtonGroup.vue.d.ts +0 -1
- package/dist/components/button/types.d.ts +7 -6
- package/dist/components/card/ContentCard.vue.d.ts +1 -1
- package/dist/components/card/FeatureCard.vue.d.ts +1 -1
- package/dist/components/card/stretchedLink.d.ts +3 -3
- package/dist/components/card/types.d.ts +6 -4
- package/dist/components/carousel/types.d.ts +7 -3
- package/dist/components/checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/checkbox/CheckboxGroup.vue.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts +10 -4
- package/dist/components/chip/Chip.vue.d.ts +1 -1
- package/dist/components/chip/ChipGroup.vue.d.ts +0 -1
- package/dist/components/chip/types.d.ts +5 -6
- package/dist/components/container/Container.vue.d.ts +0 -1
- package/dist/components/container/types.d.ts +0 -4
- package/dist/components/dialog/Dialog.vue.d.ts +2 -2
- package/dist/components/dialog/types.d.ts +5 -2
- package/dist/components/drawer/Drawer.vue.d.ts +1 -1
- package/dist/components/drawer/types.d.ts +5 -2
- package/dist/components/empty-state/EmptyState.vue.d.ts +1 -1
- package/dist/components/empty-state/types.d.ts +7 -6
- package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +1 -1
- package/dist/components/field-wrapper/types.d.ts +5 -2
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +4 -4
- package/dist/components/filter-panel/facets/shared.d.ts +4 -4
- package/dist/components/filter-panel/types.d.ts +5 -2
- package/dist/components/form-layout/FormLayout.vue.d.ts +1 -1
- package/dist/components/form-layout/types.d.ts +5 -2
- package/dist/components/icon/Icon.vue.d.ts +1 -2
- package/dist/components/icon/types.d.ts +0 -4
- package/dist/components/image/types.d.ts +3 -2
- package/dist/components/input/Input.vue.d.ts +6 -6
- package/dist/components/input/classes.d.ts +25 -19
- package/dist/components/input/types.d.ts +5 -2
- package/dist/components/lightbox/Lightbox.vue.d.ts +1 -1
- package/dist/components/lightbox/types.d.ts +5 -2
- package/dist/components/link/Link.vue.d.ts +1 -1
- package/dist/components/link/types.d.ts +5 -2
- package/dist/components/load-more/types.d.ts +4 -3
- package/dist/components/logo-item/LogoItem.vue.d.ts +1 -1
- package/dist/components/logo-item/types.d.ts +2 -1
- package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -1
- package/dist/components/nav-menu/navLinks.d.ts +1 -1
- package/dist/components/nav-menu/types.d.ts +3 -3
- package/dist/components/pagination/types.d.ts +5 -2
- package/dist/components/popover/Popover.vue.d.ts +1 -1
- package/dist/components/popover/types.d.ts +5 -6
- package/dist/components/price/types.d.ts +3 -2
- package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
- package/dist/components/product-card/types.d.ts +3 -2
- package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +4 -4
- package/dist/components/quantity-stepper/types.d.ts +5 -2
- package/dist/components/radio/Radio.vue.d.ts +3 -3
- package/dist/components/radio/RadioGroup.vue.d.ts +3 -3
- package/dist/components/radio/recipes.d.ts +11 -7
- package/dist/components/radio/types.d.ts +11 -5
- package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -1
- package/dist/components/range-slider/types.d.ts +5 -2
- package/dist/components/rating/Rating.vue.d.ts +1 -1
- package/dist/components/rating/types.d.ts +3 -2
- package/dist/components/search-bar/SearchBar.vue.d.ts +3 -3
- package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
- package/dist/components/search-bar/types.d.ts +5 -2
- package/dist/components/search-modal/SearchModal.vue.d.ts +2 -2
- package/dist/components/search-modal/types.d.ts +7 -4
- package/dist/components/section/Section.vue.d.ts +0 -1
- package/dist/components/section/types.d.ts +0 -4
- package/dist/components/select/MultiSelect.vue.d.ts +5 -5
- package/dist/components/select/Select.vue.d.ts +4 -4
- package/dist/components/select/SelectPanel.vue.d.ts +2 -2
- package/dist/components/select/panelParts.d.ts +21 -20
- package/dist/components/select/types.d.ts +10 -4
- package/dist/components/site-form/SiteForm.vue.d.ts +1 -1
- package/dist/components/site-form/types.d.ts +6 -2
- package/dist/components/skeleton/Skeleton.vue.d.ts +3 -2
- package/dist/components/skeleton/types.d.ts +16 -6
- package/dist/components/switch/Switch.vue.d.ts +2 -2
- package/dist/components/switch/types.d.ts +5 -2
- package/dist/components/tabler-icon/TablerIcon.vue.d.ts +2 -3
- package/dist/components/tabler-icon/types.d.ts +0 -4
- package/dist/components/tabs/Tab.vue.d.ts +1 -1
- package/dist/components/tabs/TabPanel.vue.d.ts +1 -3
- package/dist/components/tabs/Tabs.vue.d.ts +1 -1
- package/dist/components/tabs/types.d.ts +13 -11
- package/dist/components/textarea/Textarea.vue.d.ts +4 -4
- package/dist/components/textarea/types.d.ts +5 -2
- package/dist/components/toast/types.d.ts +9 -3
- package/dist/components/tooltip/types.d.ts +4 -3
- package/dist/components/unit-input/UnitInput.vue.d.ts +7 -7
- package/dist/components/unit-input/types.d.ts +5 -2
- package/dist/components/variant-picker/VariantPicker.vue.d.ts +1 -1
- package/dist/components/variant-picker/types.d.ts +3 -2
- package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +0 -1
- package/dist/components/visually-hidden/types.d.ts +0 -4
- package/dist/components.css +1481 -2342
- package/dist/composables/useDialog.d.ts +9 -1
- package/dist/composables/useEldraScope.d.ts +7 -9
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1380 -884
- package/dist/style.css +1487 -2348
- package/dist/tailwind.css +11 -2234
- package/dist/theme.css +108 -0
- package/dist/tokens.css +1 -0
- package/dist/utilities.css +2228 -0
- package/dist/utils/mergeClass.d.ts +3 -0
- package/dist/utils/tagRecipe.d.ts +3 -3
- package/dist/vee-validate.js +1 -1
- package/package.json +4 -3
- package/dist/scoped.css +0 -4623
- package/dist/utils/cx.d.ts +0 -31
|
@@ -3,267 +3,6 @@ import { Comment, Fragment, Teleport, Text, computed, createBlock, createComment
|
|
|
3
3
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
4
|
import { numberFormat } from "@eldrajs/sdk/format";
|
|
5
5
|
import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/vue";
|
|
6
|
-
// src/utils/cx.ts
|
|
7
|
-
/**
|
|
8
|
-
* Stock `twMerge` only knows Tailwind's own utilities: it has no idea `text-button-md` is a
|
|
9
|
-
* "font-size" utility, so a consumer's `classes.container: 'text-lg'` used to land *beside* it
|
|
10
|
-
* instead of replacing it, and CSS source order (not the override) decided which one painted.
|
|
11
|
-
*
|
|
12
|
-
* `src/styles/tailwind.css`'s `@utility` rules are invisible to `tailwind-merge` the same way —
|
|
13
|
-
* it never reads the package's CSS, it only pattern-matches class names against its built-in
|
|
14
|
-
* config — so every custom utility that shares a *concern* with a stock group (a font size, a
|
|
15
|
-
* height, a duration, a z-index, an animation, a border radius) is registered here under that
|
|
16
|
-
* group's id. The three with no stock equivalent (`eldra-focus*`, `target-min`, `target-touch`)
|
|
17
|
-
* get their own group ids instead, so they still conflict with each other without conflicting
|
|
18
|
-
* with unrelated utilities.
|
|
19
|
-
*
|
|
20
|
-
* `src/__tests__/custom-utility-coverage.spec.ts` parses every `@utility <name>` out of
|
|
21
|
-
* `tailwind.css` and fails if `cx(name, name)` does not collapse to one token, so a new custom
|
|
22
|
-
* utility that is never added here (as `eldra-link-radius` first shipped) is caught by a test
|
|
23
|
-
* instead of shipping unmerged.
|
|
24
|
-
*/
|
|
25
|
-
var twMerge = extendTailwindMerge({ extend: {
|
|
26
|
-
theme: {
|
|
27
|
-
shadow: ["float"],
|
|
28
|
-
container: [
|
|
29
|
-
"narrow",
|
|
30
|
-
"content",
|
|
31
|
-
"wide",
|
|
32
|
-
"tablet",
|
|
33
|
-
"two-col"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
classGroups: {
|
|
37
|
-
"font-size": [{ text: [
|
|
38
|
-
"display",
|
|
39
|
-
"h1",
|
|
40
|
-
"h2",
|
|
41
|
-
"h3",
|
|
42
|
-
"h4",
|
|
43
|
-
"body-lg",
|
|
44
|
-
"body",
|
|
45
|
-
"body-sm",
|
|
46
|
-
"caption",
|
|
47
|
-
"overline",
|
|
48
|
-
"label",
|
|
49
|
-
"code",
|
|
50
|
-
"button-sm",
|
|
51
|
-
"button-md",
|
|
52
|
-
"button-lg",
|
|
53
|
-
"control-sm",
|
|
54
|
-
"control",
|
|
55
|
-
"control-lg",
|
|
56
|
-
"control-mobile",
|
|
57
|
-
"counter",
|
|
58
|
-
"field-note",
|
|
59
|
-
"card-title",
|
|
60
|
-
"switch-label",
|
|
61
|
-
"switch-description",
|
|
62
|
-
"select-group",
|
|
63
|
-
"select-option",
|
|
64
|
-
"select-pill",
|
|
65
|
-
"stepper-value",
|
|
66
|
-
"stepper-value-sm",
|
|
67
|
-
"search-meta",
|
|
68
|
-
"search-title",
|
|
69
|
-
"search-kbd",
|
|
70
|
-
"variant-legend",
|
|
71
|
-
"variant-pill",
|
|
72
|
-
"logo-wordmark",
|
|
73
|
-
"badge",
|
|
74
|
-
"stock-status",
|
|
75
|
-
"price-sm",
|
|
76
|
-
"price-lg",
|
|
77
|
-
"price-current",
|
|
78
|
-
"price-secondary",
|
|
79
|
-
"price-unit",
|
|
80
|
-
"avatar-initials-sm",
|
|
81
|
-
"avatar-initials-md",
|
|
82
|
-
"avatar-initials-lg",
|
|
83
|
-
"avatar-initials-xl",
|
|
84
|
-
"empty-state-title",
|
|
85
|
-
"filter-trigger",
|
|
86
|
-
"filter-subheading",
|
|
87
|
-
"filter-tile-count",
|
|
88
|
-
"content-card-title",
|
|
89
|
-
"content-card-excerpt",
|
|
90
|
-
"dialog-title",
|
|
91
|
-
"accordion-title",
|
|
92
|
-
"drawer-title",
|
|
93
|
-
"tooltip",
|
|
94
|
-
"toast-title",
|
|
95
|
-
"search-modal-field",
|
|
96
|
-
"search-modal-foot",
|
|
97
|
-
"search-modal-kbd"
|
|
98
|
-
] }],
|
|
99
|
-
h: [
|
|
100
|
-
"control-h",
|
|
101
|
-
"control-h-sm",
|
|
102
|
-
"control-h-lg",
|
|
103
|
-
"eldra-range-track"
|
|
104
|
-
],
|
|
105
|
-
"min-h": [
|
|
106
|
-
"eldra-range-rail",
|
|
107
|
-
"eldra-drawer-header-height",
|
|
108
|
-
"eldra-nav-menu-drawer-row"
|
|
109
|
-
],
|
|
110
|
-
px: [
|
|
111
|
-
"eldra-range-gutter",
|
|
112
|
-
"eldra-range-gutter-thumb",
|
|
113
|
-
"eldra-drawer-gutter"
|
|
114
|
-
],
|
|
115
|
-
w: [
|
|
116
|
-
"eldra-dialog-width",
|
|
117
|
-
"eldra-dialog-width-sm",
|
|
118
|
-
"eldra-drawer-width",
|
|
119
|
-
"eldra-toast-width",
|
|
120
|
-
"eldra-search-modal-width"
|
|
121
|
-
],
|
|
122
|
-
size: [
|
|
123
|
-
"eldra-avatar-icon-sm",
|
|
124
|
-
"eldra-avatar-icon-md",
|
|
125
|
-
"eldra-avatar-icon-lg",
|
|
126
|
-
"eldra-avatar-icon-xl"
|
|
127
|
-
],
|
|
128
|
-
"target-min": ["target-min"],
|
|
129
|
-
"target-touch": ["target-touch"],
|
|
130
|
-
"eldra-scrollbar-hide": ["eldra-scrollbar-hide"],
|
|
131
|
-
"border-w": [
|
|
132
|
-
"eldra-field-border",
|
|
133
|
-
"eldra-checkbox-border",
|
|
134
|
-
"eldra-checkbox-border-invalid",
|
|
135
|
-
"eldra-radio-card-border",
|
|
136
|
-
"eldra-switch-track-border",
|
|
137
|
-
"eldra-variant-pill-border",
|
|
138
|
-
"eldra-variant-swatch-ring",
|
|
139
|
-
"eldra-variant-swatch-edge",
|
|
140
|
-
"eldra-filter-swatch-ring",
|
|
141
|
-
"eldra-editor-placeholder-border"
|
|
142
|
-
],
|
|
143
|
-
"eldra-field-invalid": ["eldra-field-invalid"],
|
|
144
|
-
"eldra-radio-card-selected": ["eldra-radio-card-selected"],
|
|
145
|
-
"eldra-switch-thumb-offset": ["eldra-switch-thumb-offset"],
|
|
146
|
-
"max-h": [
|
|
147
|
-
"eldra-select-panel-height",
|
|
148
|
-
"eldra-search-panel-height",
|
|
149
|
-
"eldra-dialog-max-height",
|
|
150
|
-
"eldra-search-modal-max-height"
|
|
151
|
-
],
|
|
152
|
-
m: ["eldra-search-modal-position"],
|
|
153
|
-
"max-w": [
|
|
154
|
-
"eldra-select-panel-width",
|
|
155
|
-
"eldra-container-narrow",
|
|
156
|
-
"eldra-container-content",
|
|
157
|
-
"eldra-container-wide"
|
|
158
|
-
],
|
|
159
|
-
"eldra-select-match": ["eldra-select-match"],
|
|
160
|
-
"eldra-select-swatch": ["eldra-select-swatch"],
|
|
161
|
-
"eldra-select-option-active": ["eldra-select-option-active"],
|
|
162
|
-
"eldra-select-option-selected": ["eldra-select-option-selected"],
|
|
163
|
-
"eldra-variant-pill-selected-line": ["eldra-variant-pill-selected-line"],
|
|
164
|
-
"eldra-focus": ["eldra-focus", "eldra-focus-inset"],
|
|
165
|
-
"eldra-focus-always": ["eldra-focus-always", "eldra-focus-inset-always"],
|
|
166
|
-
"eldra-focus-proxy": ["eldra-focus-proxy"],
|
|
167
|
-
"eldra-focus-open": ["eldra-focus-open"],
|
|
168
|
-
rounded: ["eldra-link-radius", "eldra-select-check-radius"],
|
|
169
|
-
duration: [
|
|
170
|
-
"duration-fast",
|
|
171
|
-
"duration-base",
|
|
172
|
-
"duration-slow"
|
|
173
|
-
],
|
|
174
|
-
opacity: ["eldra-revalidating"],
|
|
175
|
-
"eldra-skeleton": ["eldra-skeleton"],
|
|
176
|
-
"eldra-rating-half": ["eldra-rating-half"],
|
|
177
|
-
"eldra-image-placeholder-hatch": ["eldra-image-placeholder-hatch"],
|
|
178
|
-
"eldra-tooltip-arrow": ["eldra-tooltip-arrow"],
|
|
179
|
-
z: [
|
|
180
|
-
"z-sticky",
|
|
181
|
-
"z-popover",
|
|
182
|
-
"z-drawer",
|
|
183
|
-
"z-dialog",
|
|
184
|
-
"z-toast"
|
|
185
|
-
],
|
|
186
|
-
"eldra-accordion-chevron": ["eldra-accordion-chevron"],
|
|
187
|
-
"eldra-accordion-panel": ["eldra-accordion-panel"],
|
|
188
|
-
"eldra-carousel-slide": ["eldra-carousel-slide"],
|
|
189
|
-
"eldra-carousel-track": ["eldra-carousel-track"],
|
|
190
|
-
"eldra-carousel-dot": ["eldra-carousel-dot"],
|
|
191
|
-
"eldra-range-thumb": ["eldra-range-thumb"],
|
|
192
|
-
"eldra-filter-swatch-edge": ["eldra-filter-swatch-edge"],
|
|
193
|
-
"eldra-filter-histogram-bar": ["eldra-filter-histogram-bar"],
|
|
194
|
-
pt: ["eldra-nav-menu-panel", "eldra-drawer-header-top"],
|
|
195
|
-
"grid-cols": ["eldra-nav-menu-columns"],
|
|
196
|
-
"eldra-nav-menu-dropdown": ["eldra-nav-menu-dropdown"],
|
|
197
|
-
ps: ["eldra-nav-menu-drawer-nest"],
|
|
198
|
-
pb: [
|
|
199
|
-
"eldra-drawer-header-bottom",
|
|
200
|
-
"eldra-drawer-body-bottom",
|
|
201
|
-
"eldra-drawer-footer-bottom"
|
|
202
|
-
],
|
|
203
|
-
animate: [
|
|
204
|
-
"animate-eldra-spin",
|
|
205
|
-
"animate-eldra-pulse",
|
|
206
|
-
"animate-eldra-popover-in",
|
|
207
|
-
"animate-eldra-dialog-in",
|
|
208
|
-
"animate-eldra-dialog-in-reduced",
|
|
209
|
-
"animate-eldra-drawer-in-right",
|
|
210
|
-
"animate-eldra-drawer-in-left",
|
|
211
|
-
"animate-eldra-toast-in",
|
|
212
|
-
"animate-eldra-lightbox-in"
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
} });
|
|
216
|
-
/**
|
|
217
|
-
* Flattens one `cx` input into the class names it contributes.
|
|
218
|
-
*
|
|
219
|
-
* The array branch is the one that is not in `ClassValue`, and it exists
|
|
220
|
-
* because the alternative is silent nonsense rather than an error. `Object.
|
|
221
|
-
* entries(['flex', 'gap-4'])` yields `[['0', 'flex'], ['1', 'gap-4']]`, so the
|
|
222
|
-
* object branch below used to read an array's *indices* as class names and emit
|
|
223
|
-
* `"0 1"` — two classes that style nothing, in place of the two the consumer
|
|
224
|
-
* wrote. Flattening (recursively, so a nested array works the way Vue's own
|
|
225
|
-
* `:class` array syntax does) is what a caller passing one always meant;
|
|
226
|
-
* `partClass` is where it also gets told, in dev, that this package's `classes`
|
|
227
|
-
* prop takes a string per part.
|
|
228
|
-
*/
|
|
229
|
-
function flattenClassValue(input, out) {
|
|
230
|
-
if (!input) return;
|
|
231
|
-
if (typeof input === "string") {
|
|
232
|
-
out.push(input);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (Array.isArray(input)) {
|
|
236
|
-
for (const item of input) flattenClassValue(item, out);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (typeof input !== "object") return;
|
|
240
|
-
for (const [name, enabled] of Object.entries(input)) if (enabled) out.push(name);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Join class values, then resolve Tailwind conflicts so the last one wins.
|
|
244
|
-
*
|
|
245
|
-
* Every component builds its classes with this, which is what makes the
|
|
246
|
-
* `classes` prop work without `!important`: a consumer's `px-6` replaces the
|
|
247
|
-
* component's `px-4` instead of landing beside it and losing to source order.
|
|
248
|
-
*/
|
|
249
|
-
function cx(...inputs) {
|
|
250
|
-
const parts = [];
|
|
251
|
-
for (const input of inputs) flattenClassValue(input, parts);
|
|
252
|
-
return twMerge(parts.join(" "));
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* The classes for one named part of a component: the part's own classes with
|
|
256
|
-
* the consumer's override for that part merged over them.
|
|
257
|
-
*
|
|
258
|
-
* `Part` is the union of the part names in the component's spec anatomy, so a
|
|
259
|
-
* typo in a `classes` key is a type error rather than a silently ignored
|
|
260
|
-
* override.
|
|
261
|
-
*/
|
|
262
|
-
function partClass(base, classes, part) {
|
|
263
|
-
const override = classes?.[part];
|
|
264
|
-
if (Array.isArray(override)) return cx(base, ...override);
|
|
265
|
-
return cx(base, override);
|
|
266
|
-
}
|
|
267
6
|
// src/utils/id.ts
|
|
268
7
|
/**
|
|
269
8
|
* A stable, SSR-safe id for a component part, or the caller's own id when it
|
|
@@ -314,9 +53,8 @@ function joinIds(...ids) {
|
|
|
314
53
|
/** The injection key `provideEldraScope` provides under. */
|
|
315
54
|
var ELDRA_SCOPE_KEY = Symbol("eldra-scope");
|
|
316
55
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* "Embedding in another Tailwind app"). Call it in `setup()` of a wrapper or an app root.
|
|
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.
|
|
320
58
|
*
|
|
321
59
|
* Each component then renders `data-eldra-scope="<name>"` on its root and on every part it
|
|
322
60
|
* teleports (panels, dialogs, toasts). The name is free; the consumer's own variable overrides
|
|
@@ -327,12 +65,11 @@ function provideEldraScope(name = "default") {
|
|
|
327
65
|
provide(ELDRA_SCOPE_KEY, name || "default");
|
|
328
66
|
}
|
|
329
67
|
/**
|
|
330
|
-
* Internal:
|
|
331
|
-
* teleported root and kit-owned element sitting directly in a slot host
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* style without `scoped.css`), and never for a fallback, which is the kit's own markup.
|
|
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.
|
|
336
73
|
*/
|
|
337
74
|
function useEldraScope() {
|
|
338
75
|
const scope = inject(ELDRA_SCOPE_KEY, void 0);
|
|
@@ -368,6 +105,209 @@ function useControllableModel(props, emit, fallback) {
|
|
|
368
105
|
}
|
|
369
106
|
});
|
|
370
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
|
+
"max-h": [
|
|
235
|
+
"eldra-select-panel-height",
|
|
236
|
+
"eldra-search-panel-height",
|
|
237
|
+
"eldra-dialog-max-height",
|
|
238
|
+
"eldra-search-modal-max-height"
|
|
239
|
+
],
|
|
240
|
+
m: ["eldra-search-modal-position"],
|
|
241
|
+
"max-w": [
|
|
242
|
+
"eldra-select-panel-width",
|
|
243
|
+
"eldra-container-narrow",
|
|
244
|
+
"eldra-container-content",
|
|
245
|
+
"eldra-container-wide"
|
|
246
|
+
],
|
|
247
|
+
"eldra-select-match": ["eldra-select-match"],
|
|
248
|
+
"eldra-select-swatch": ["eldra-select-swatch"],
|
|
249
|
+
"eldra-select-option-active": ["eldra-select-option-active"],
|
|
250
|
+
"eldra-select-option-selected": ["eldra-select-option-selected"],
|
|
251
|
+
"eldra-variant-pill-selected-line": ["eldra-variant-pill-selected-line"],
|
|
252
|
+
"eldra-focus": ["eldra-focus", "eldra-focus-inset"],
|
|
253
|
+
"eldra-focus-always": ["eldra-focus-always", "eldra-focus-inset-always"],
|
|
254
|
+
"eldra-focus-proxy": ["eldra-focus-proxy"],
|
|
255
|
+
"eldra-focus-open": ["eldra-focus-open"],
|
|
256
|
+
rounded: ["eldra-link-radius", "eldra-select-check-radius"],
|
|
257
|
+
duration: [
|
|
258
|
+
"duration-fast",
|
|
259
|
+
"duration-base",
|
|
260
|
+
"duration-slow"
|
|
261
|
+
],
|
|
262
|
+
opacity: ["eldra-revalidating"],
|
|
263
|
+
"eldra-skeleton": ["eldra-skeleton"],
|
|
264
|
+
"eldra-skeleton-text": ["eldra-skeleton-text"],
|
|
265
|
+
"eldra-rating-half": ["eldra-rating-half"],
|
|
266
|
+
"eldra-image-placeholder-hatch": ["eldra-image-placeholder-hatch"],
|
|
267
|
+
"eldra-tooltip-arrow": ["eldra-tooltip-arrow"],
|
|
268
|
+
z: [
|
|
269
|
+
"z-sticky",
|
|
270
|
+
"z-popover",
|
|
271
|
+
"z-drawer",
|
|
272
|
+
"z-dialog",
|
|
273
|
+
"z-toast"
|
|
274
|
+
],
|
|
275
|
+
"eldra-accordion-chevron": ["eldra-accordion-chevron"],
|
|
276
|
+
"eldra-accordion-panel": ["eldra-accordion-panel"],
|
|
277
|
+
"eldra-carousel-slide": ["eldra-carousel-slide"],
|
|
278
|
+
"eldra-carousel-track": ["eldra-carousel-track"],
|
|
279
|
+
"eldra-carousel-dot": ["eldra-carousel-dot"],
|
|
280
|
+
"eldra-range-thumb": ["eldra-range-thumb"],
|
|
281
|
+
"eldra-filter-swatch-edge": ["eldra-filter-swatch-edge"],
|
|
282
|
+
"eldra-filter-histogram-bar": ["eldra-filter-histogram-bar"],
|
|
283
|
+
pt: ["eldra-nav-menu-panel", "eldra-drawer-header-top"],
|
|
284
|
+
"grid-cols": ["eldra-nav-menu-columns"],
|
|
285
|
+
"eldra-nav-menu-dropdown": ["eldra-nav-menu-dropdown"],
|
|
286
|
+
ps: ["eldra-nav-menu-drawer-nest"],
|
|
287
|
+
pb: [
|
|
288
|
+
"eldra-drawer-header-bottom",
|
|
289
|
+
"eldra-drawer-body-bottom",
|
|
290
|
+
"eldra-drawer-footer-bottom"
|
|
291
|
+
],
|
|
292
|
+
animate: [
|
|
293
|
+
"animate-eldra-spin",
|
|
294
|
+
"animate-eldra-pulse",
|
|
295
|
+
"animate-eldra-popover-in",
|
|
296
|
+
"animate-eldra-dialog-in",
|
|
297
|
+
"animate-eldra-dialog-in-reduced",
|
|
298
|
+
"animate-eldra-drawer-in-right",
|
|
299
|
+
"animate-eldra-drawer-in-left",
|
|
300
|
+
"animate-eldra-toast-in",
|
|
301
|
+
"animate-eldra-lightbox-in"
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
prefix: "eldra"
|
|
306
|
+
});
|
|
307
|
+
/** The component's own classes with `incoming` (a parent component's) merged over them. */
|
|
308
|
+
function mergeClass(own, incoming) {
|
|
309
|
+
return kitMerge(normalizeClass([own, incoming]));
|
|
310
|
+
}
|
|
371
311
|
// src/components/form-layout/context.ts
|
|
372
312
|
/**
|
|
373
313
|
* Whether the form this subtree belongs to is currently submitting.
|
|
@@ -408,10 +348,10 @@ var FORM_LAYOUT_KEY = Symbol("eldra-form-layout");
|
|
|
408
348
|
* literal length appears here or in the built CSS.
|
|
409
349
|
*/
|
|
410
350
|
var ICON_SIZE_CLASS = {
|
|
411
|
-
sm: "size-4",
|
|
412
|
-
md: "size-5",
|
|
413
|
-
lg: "size-6",
|
|
414
|
-
xl: "size-8"
|
|
351
|
+
sm: "eldra:size-4",
|
|
352
|
+
md: "eldra:size-5",
|
|
353
|
+
lg: "eldra:size-6",
|
|
354
|
+
xl: "eldra:size-8"
|
|
415
355
|
};
|
|
416
356
|
/** The spec's outline stroke weight. */
|
|
417
357
|
var ICON_STROKE_WIDTH = 1.75;
|
|
@@ -421,13 +361,12 @@ var Icon_default = /* @__PURE__ */ defineComponent({
|
|
|
421
361
|
props: {
|
|
422
362
|
icon: {},
|
|
423
363
|
size: { default: "md" },
|
|
424
|
-
label: { default: void 0 }
|
|
425
|
-
classes: { default: void 0 }
|
|
364
|
+
label: { default: void 0 }
|
|
426
365
|
},
|
|
427
366
|
setup(__props) {
|
|
428
367
|
const eldra = useEldraScope();
|
|
429
368
|
const props = __props;
|
|
430
|
-
const rootClass = computed(() =>
|
|
369
|
+
const rootClass = computed(() => [ICON_SIZE_CLASS[props.size], "eldra:shrink-0"]);
|
|
431
370
|
return (_ctx, _cache) => {
|
|
432
371
|
return openBlock(), createBlock(resolveDynamicComponent(__props.icon), {
|
|
433
372
|
"data-eldra-ui": "",
|
|
@@ -461,7 +400,7 @@ var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
|
461
400
|
return openBlock(), createElementBlock("svg", {
|
|
462
401
|
"data-eldra-ui": "",
|
|
463
402
|
"data-eldra-scope": unref(eldra).scope,
|
|
464
|
-
class: "animate-eldra-spin motion-reduce:animate-eldra-pulse",
|
|
403
|
+
class: "eldra:animate-eldra-spin eldra:motion-reduce:animate-eldra-pulse",
|
|
465
404
|
viewBox: "0 0 18 18",
|
|
466
405
|
fill: "none",
|
|
467
406
|
"aria-hidden": "true",
|
|
@@ -486,24 +425,30 @@ var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
|
486
425
|
var _hoisted_1$18 = ["data-eldra-slot"];
|
|
487
426
|
var _hoisted_2$16 = ["data-eldra-slot"];
|
|
488
427
|
var _hoisted_3$15 = ["data-eldra-slot"];
|
|
489
|
-
var BASE$1 = "relative inline-flex items-center justify-center
|
|
428
|
+
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";
|
|
429
|
+
/** The border (`--eldra-button-border-width`, default 1px, see `eldra-button-border`) and no
|
|
430
|
+
* underline, except `link`, which is a borderless underlined line box. */
|
|
431
|
+
var BOX$1 = "eldra:eldra-button-border eldra:no-underline";
|
|
432
|
+
var LINK_BOX = "eldra:border-0";
|
|
490
433
|
/**
|
|
491
434
|
* Sizes (spec "Button" → Sizes). `--spacing` is 0.25rem, so `px-3`/`px-4.5`/`px-6` are the spec's
|
|
492
435
|
* 0.75/1.125/1.5rem and `gap-1.5`/`gap-2` its 0.375/0.5rem.
|
|
493
436
|
*/
|
|
494
|
-
var FILLED_DISABLED = "bg-surface-strong text-muted border-transparent
|
|
495
|
-
var PRESS = "active:scale-[0.98] motion-reduce:active:scale-100";
|
|
437
|
+
var FILLED_DISABLED = "eldra:bg-surface-strong eldra:text-muted eldra:border-transparent";
|
|
438
|
+
var PRESS = "eldra:active:scale-[0.98] eldra:motion-reduce:active:scale-100";
|
|
496
439
|
/**
|
|
497
440
|
* The toggle-pressed fill (spec "Button" → States, toggle pressed): `surface-strong` with the
|
|
498
441
|
* `border-strong` boundary. The spec gives it to `outline`; `ghost` takes the same look, because a
|
|
499
442
|
* ghost toggle in a toolbar (bold, italic, a view switch) has no other way to show it is on, and
|
|
500
443
|
* the `border-strong` boundary is what keeps the state at 3:1 against the page (1.4.11) where the
|
|
501
|
-
* fill alone would not be. Only `pressed === true` draws it,
|
|
502
|
-
* always go together. The filled variants already carry a fill,
|
|
444
|
+
* fill alone would not be. Only `pressed === true` draws it, in place of the variant's `FILL`, so
|
|
445
|
+
* `aria-pressed="true"` and the look always go together. The filled variants already carry a fill,
|
|
446
|
+
* and `link` is a line box.
|
|
503
447
|
*/
|
|
504
|
-
var PRESSED_FILL = "bg-surface-strong border-border-strong";
|
|
448
|
+
var PRESSED_FILL = "eldra:bg-surface-strong eldra:border-border-strong";
|
|
505
449
|
// src/components/button/Button.vue
|
|
506
450
|
var Button_default = /* @__PURE__ */ defineComponent({
|
|
451
|
+
inheritAttrs: false,
|
|
507
452
|
__name: "Button",
|
|
508
453
|
props: {
|
|
509
454
|
variant: {},
|
|
@@ -549,9 +494,15 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
549
494
|
const props = __props;
|
|
550
495
|
const emit = __emit;
|
|
551
496
|
const slots = useSlots();
|
|
497
|
+
/** `class` is merged into the container's own; every other attribute lands on it as before. */
|
|
498
|
+
const attrs = useAttrs();
|
|
499
|
+
const forwardedAttrs = computed(() => {
|
|
500
|
+
const { class: _class, ...rest } = attrs;
|
|
501
|
+
return rest;
|
|
502
|
+
});
|
|
552
503
|
/**
|
|
553
|
-
* Shared box (spec "Button" → Anatomy and Behaviour & motion):
|
|
554
|
-
* colour, `radius-md` through the component's own variable, and the one focus ring.
|
|
504
|
+
* Shared box (spec "Button" → Anatomy and Behaviour & motion): a border that a variant may
|
|
505
|
+
* colour (see `BOX`), `radius-md` through the component's own variable, and the one focus ring.
|
|
555
506
|
*
|
|
556
507
|
* There is deliberately no `transition-*`/`duration-*` utility here. `eldra-focus` owns the
|
|
557
508
|
* element's transition list — background, border, text colour and the press scale at
|
|
@@ -561,21 +512,21 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
561
512
|
* `src/__tests__/focus-transition.spec.ts`.
|
|
562
513
|
*/
|
|
563
514
|
const SIZE = {
|
|
564
|
-
sm: "control-h-sm px-3 gap-1.5 text-button-sm",
|
|
565
|
-
md: "control-h px-4.5 gap-2 text-button-md",
|
|
566
|
-
lg: "control-h-lg px-6 gap-2 text-button-lg"
|
|
515
|
+
sm: "eldra:control-h-sm eldra:px-3 eldra:gap-1.5 eldra:text-button-sm",
|
|
516
|
+
md: "eldra:control-h eldra:px-4.5 eldra:gap-2 eldra:text-button-md",
|
|
517
|
+
lg: "eldra:control-h-lg eldra:px-6 eldra:gap-2 eldra:text-button-lg"
|
|
567
518
|
};
|
|
568
519
|
/** Icon-only is square at its size's height and never grows: the spec lists 2 / 2.5 / 3rem. */
|
|
569
520
|
const ICON_ONLY_SIZE = {
|
|
570
|
-
sm: "control-h-sm aspect-square px-0 text-button-sm",
|
|
571
|
-
md: "control-h aspect-square px-0 text-button-md",
|
|
572
|
-
lg: "control-h-lg aspect-square px-0 text-button-lg"
|
|
521
|
+
sm: "eldra:control-h-sm eldra:aspect-square eldra:px-0 eldra:text-button-sm",
|
|
522
|
+
md: "eldra:control-h eldra:aspect-square eldra:px-0 eldra:text-button-md",
|
|
523
|
+
lg: "eldra:control-h-lg eldra:aspect-square eldra:px-0 eldra:text-button-lg"
|
|
573
524
|
};
|
|
574
525
|
/** The link variant is a line box: no control height, no padding, and it never grows to 2.75rem. */
|
|
575
526
|
const LINK_SIZE = {
|
|
576
|
-
sm: "target-min px-0 gap-1.5 text-button-sm",
|
|
577
|
-
md: "target-min px-0 gap-2 text-button-md",
|
|
578
|
-
lg: "target-min px-0 gap-2 text-button-lg"
|
|
527
|
+
sm: "eldra:target-min eldra:px-0 eldra:gap-1.5 eldra:text-button-sm",
|
|
528
|
+
md: "eldra:target-min eldra:px-0 eldra:gap-2 eldra:text-button-md",
|
|
529
|
+
lg: "eldra:target-min eldra:px-0 eldra:gap-2 eldra:text-button-lg"
|
|
579
530
|
};
|
|
580
531
|
/**
|
|
581
532
|
* Variants (spec "Button" → Variants, States and On coloured sections).
|
|
@@ -584,66 +535,75 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
584
535
|
* puts in `primary` or `accent` without a new token: `primary` mixed 14% toward `background`,
|
|
585
536
|
* `accent` and `danger` 15% toward `text`, ghost `text` at 6% (11% pressed down).
|
|
586
537
|
*
|
|
587
|
-
* The `
|
|
588
|
-
* element carries `
|
|
538
|
+
* The `section-primary:`/`section-accent:` rules are the inversions for coloured sections. The
|
|
539
|
+
* section element carries `data-section="primary|accent"`; the focus ring never
|
|
589
540
|
* changes, because its white infill carries the contrast on dark grounds.
|
|
590
541
|
*
|
|
591
|
-
* Every live
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* `cursor-
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
|
|
542
|
+
* Every live button is `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in
|
|
543
|
+
* the README): Tailwind v4's preflight sets `button { cursor: default }`, so nothing here was a
|
|
544
|
+
* pointer until now. `cursorClass` picks it, `cursor-not-allowed` when disabled, or
|
|
545
|
+
* `cursor-progress` while loading.
|
|
546
|
+
*
|
|
547
|
+
* The resting fill and border colour live in `FILL`, apart from the rest, so the toggle-pressed
|
|
548
|
+
* fill can take their place.
|
|
549
|
+
*/
|
|
550
|
+
const FILL = {
|
|
551
|
+
primary: "eldra:bg-primary eldra:border-transparent",
|
|
552
|
+
secondary: "eldra:bg-accent eldra:border-transparent",
|
|
553
|
+
outline: "eldra:bg-background eldra:border-border-strong",
|
|
554
|
+
ghost: "eldra:bg-transparent eldra:border-transparent",
|
|
555
|
+
link: "eldra:bg-transparent eldra:border-transparent",
|
|
556
|
+
danger: "eldra:bg-danger eldra:border-transparent"
|
|
557
|
+
};
|
|
598
558
|
const VARIANT = {
|
|
599
559
|
primary: [
|
|
600
|
-
"
|
|
601
|
-
"hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]",
|
|
602
|
-
"
|
|
603
|
-
"
|
|
604
|
-
"
|
|
605
|
-
"
|
|
606
|
-
"
|
|
607
|
-
"
|
|
560
|
+
"eldra:text-primary-contrast",
|
|
561
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]",
|
|
562
|
+
"eldra:section-primary:bg-primary-contrast",
|
|
563
|
+
"eldra:section-primary:text-primary",
|
|
564
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,var(--eldra-color-primary-contrast),var(--eldra-color-primary)_14%)]",
|
|
565
|
+
"eldra:section-accent:bg-accent-contrast",
|
|
566
|
+
"eldra:section-accent:text-accent",
|
|
567
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,var(--eldra-color-accent-contrast),var(--eldra-color-accent)_14%)]"
|
|
608
568
|
].join(" "),
|
|
609
569
|
secondary: [
|
|
610
|
-
"
|
|
611
|
-
"hover:bg-[color-mix(in_oklab,var(--eldra-color-accent),var(--eldra-color-text)_15%)]",
|
|
612
|
-
"
|
|
613
|
-
"
|
|
614
|
-
"
|
|
615
|
-
"
|
|
570
|
+
"eldra:text-accent-contrast",
|
|
571
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-accent),var(--eldra-color-text)_15%)]",
|
|
572
|
+
"eldra:section-accent:bg-transparent",
|
|
573
|
+
"eldra:section-accent:border-current",
|
|
574
|
+
"eldra:section-accent:text-current",
|
|
575
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]"
|
|
616
576
|
].join(" "),
|
|
617
577
|
outline: [
|
|
618
|
-
"
|
|
619
|
-
"hover:border-text hover:bg-surface",
|
|
620
|
-
"
|
|
621
|
-
"
|
|
622
|
-
"
|
|
623
|
-
"
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"
|
|
628
|
-
"
|
|
629
|
-
"
|
|
578
|
+
"eldra:text-text",
|
|
579
|
+
"eldra:hover:border-text eldra:hover:bg-surface",
|
|
580
|
+
"eldra:section-primary:bg-transparent",
|
|
581
|
+
"eldra:section-primary:border-current",
|
|
582
|
+
"eldra:section-primary:text-current",
|
|
583
|
+
"eldra:section-primary:hover:border-current",
|
|
584
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]",
|
|
585
|
+
"eldra:section-accent:bg-transparent",
|
|
586
|
+
"eldra:section-accent:border-current",
|
|
587
|
+
"eldra:section-accent:text-current",
|
|
588
|
+
"eldra:section-accent:hover:border-current",
|
|
589
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]"
|
|
630
590
|
].join(" "),
|
|
631
591
|
ghost: [
|
|
632
|
-
"
|
|
633
|
-
"hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
634
|
-
"active:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_89%)]",
|
|
635
|
-
"
|
|
636
|
-
"
|
|
637
|
-
"
|
|
638
|
-
"
|
|
592
|
+
"eldra:text-text",
|
|
593
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
594
|
+
"eldra:active:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_89%)]",
|
|
595
|
+
"eldra:section-primary:text-current",
|
|
596
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,currentColor,transparent_94%)]",
|
|
597
|
+
"eldra:section-accent:text-current",
|
|
598
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_94%)]"
|
|
639
599
|
].join(" "),
|
|
640
600
|
link: [
|
|
641
|
-
"
|
|
642
|
-
"underline decoration-1 underline-offset-[0.2em] hover:decoration-2",
|
|
643
|
-
"
|
|
644
|
-
"
|
|
601
|
+
"eldra:text-text",
|
|
602
|
+
"eldra:underline eldra:decoration-1 eldra:underline-offset-[0.2em] eldra:hover:decoration-2",
|
|
603
|
+
"eldra:section-primary:text-current",
|
|
604
|
+
"eldra:section-accent:text-current"
|
|
645
605
|
].join(" "),
|
|
646
|
-
danger: ["
|
|
606
|
+
danger: ["eldra:text-background", "eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-danger),var(--eldra-color-text)_15%)]"].join(" ")
|
|
647
607
|
};
|
|
648
608
|
/**
|
|
649
609
|
* Disabled (spec "Button" → States): `surface-strong` fill, `muted` text, transparent border, no
|
|
@@ -655,8 +615,8 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
655
615
|
secondary: FILLED_DISABLED,
|
|
656
616
|
outline: FILLED_DISABLED,
|
|
657
617
|
danger: FILLED_DISABLED,
|
|
658
|
-
ghost: "bg-transparent text-muted border-transparent
|
|
659
|
-
link: "bg-transparent text-muted border-
|
|
618
|
+
ghost: "eldra:bg-transparent eldra:text-muted eldra:border-transparent",
|
|
619
|
+
link: "eldra:bg-transparent eldra:text-muted eldra:border-transparent eldra:underline eldra:decoration-1 eldra:underline-offset-[0.2em]"
|
|
660
620
|
};
|
|
661
621
|
/**
|
|
662
622
|
* The submitting flag a `FormLayout` provides. A submit button becomes a loading button; every
|
|
@@ -749,16 +709,31 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
749
709
|
* `isDisabled` below replacing the whole state class.
|
|
750
710
|
*/
|
|
751
711
|
const TOGGLE_VARIANTS = ["outline", "ghost"];
|
|
752
|
-
const stateClass = computed(() => isDisabled.value ? DISABLED[props.variant] :
|
|
753
|
-
|
|
712
|
+
const stateClass = computed(() => isDisabled.value ? DISABLED[props.variant] : [
|
|
713
|
+
props.pressed === true && TOGGLE_VARIANTS.includes(props.variant) ? PRESSED_FILL : FILL[props.variant],
|
|
714
|
+
VARIANT[props.variant],
|
|
715
|
+
props.variant !== "link" && !isLoading.value && PRESS
|
|
716
|
+
]);
|
|
717
|
+
const cursorClass = computed(() => {
|
|
718
|
+
if (isLoading.value) return "eldra:cursor-progress";
|
|
719
|
+
return isDisabled.value ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer";
|
|
720
|
+
});
|
|
721
|
+
const containerClass = computed(() => mergeClass([
|
|
722
|
+
BASE$1,
|
|
723
|
+
props.variant === "link" ? LINK_BOX : BOX$1,
|
|
724
|
+
sizeClass.value,
|
|
725
|
+
stateClass.value,
|
|
726
|
+
cursorClass.value,
|
|
727
|
+
props.block ? "eldra:w-full" : "eldra:w-fit"
|
|
728
|
+
], attrs.class));
|
|
754
729
|
const isOverlaySpinner = computed(() => props.spinnerPlacement !== "start");
|
|
755
730
|
const isInlineSpinner = computed(() => isLoading.value && !isOverlaySpinner.value);
|
|
756
731
|
/** Hidden, not removed: the label and icons keep their space so the width never jumps. An inline
|
|
757
732
|
* spinner hides nothing: it takes the leading icon's place and the label stays readable. */
|
|
758
|
-
const hiddenWhileLoading = computed(() => isLoading.value && isOverlaySpinner.value ? "invisible" : "");
|
|
733
|
+
const hiddenWhileLoading = computed(() => isLoading.value && isOverlaySpinner.value ? "eldra:invisible" : "");
|
|
759
734
|
/** With `keepNameWhileLoading` the label is transparent instead, so it stays in the accessibility
|
|
760
735
|
* tree and the slot content keeps naming the button. */
|
|
761
|
-
const labelHiddenWhileLoading = computed(() => hiddenWhileLoading.value && props.keepNameWhileLoading ? "opacity-0" : hiddenWhileLoading.value);
|
|
736
|
+
const labelHiddenWhileLoading = computed(() => hiddenWhileLoading.value && props.keepNameWhileLoading ? "eldra:opacity-0" : hiddenWhileLoading.value);
|
|
762
737
|
/** Whether slot output holds anything but text, which then lays out in the button's own gap. */
|
|
763
738
|
function hasElements(nodes) {
|
|
764
739
|
return nodes.some((node) => {
|
|
@@ -773,11 +748,23 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
773
748
|
* the container's own `gap`, so the icon sits exactly as `iconLeft` would.
|
|
774
749
|
*/
|
|
775
750
|
function labelClass() {
|
|
776
|
-
return
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
751
|
+
return mergeClass([
|
|
752
|
+
"eldra:whitespace-nowrap",
|
|
753
|
+
slots.default !== void 0 && hasElements(slots.default()) && "eldra:inline-flex eldra:items-center eldra:gap-[inherit]",
|
|
754
|
+
labelHiddenWhileLoading.value
|
|
755
|
+
], props.classes?.label);
|
|
756
|
+
}
|
|
757
|
+
const leadingIconClass = computed(() => [
|
|
758
|
+
"eldra:inline-flex eldra:shrink-0",
|
|
759
|
+
hiddenWhileLoading.value,
|
|
760
|
+
props.classes?.leadingIcon
|
|
761
|
+
]);
|
|
762
|
+
const trailingIconClass = computed(() => [
|
|
763
|
+
"eldra:inline-flex eldra:shrink-0",
|
|
764
|
+
hiddenWhileLoading.value,
|
|
765
|
+
props.classes?.trailingIcon
|
|
766
|
+
]);
|
|
767
|
+
const spinnerClass = computed(() => [isOverlaySpinner.value ? "eldra:absolute eldra:inset-0 eldra:flex eldra:items-center eldra:justify-center" : "eldra:inline-flex eldra:shrink-0", props.classes?.spinner]);
|
|
781
768
|
/** An icon-only button draws `icon`; everything else draws `iconLeft`. */
|
|
782
769
|
const leadingIcon = computed(() => props.iconOnly ? props.icon ?? props.iconLeft : props.iconLeft);
|
|
783
770
|
const hasLeading = computed(() => !isInlineSpinner.value && (leadingIcon.value !== void 0 || slots.leadingIcon !== void 0));
|
|
@@ -826,21 +813,23 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
826
813
|
"data-eldra-scope": unref(eldra).scope,
|
|
827
814
|
"data-part": "container",
|
|
828
815
|
class: containerClass.value,
|
|
829
|
-
type: isNativeButton.value ? __props.type : void 0
|
|
830
|
-
}, linkAttrs.value, {
|
|
816
|
+
type: isNativeButton.value ? __props.type : void 0,
|
|
831
817
|
tabindex: linkTabindex.value,
|
|
832
818
|
disabled: isNativeButton.value ? isDisabled.value || void 0 : void 0,
|
|
833
819
|
"aria-disabled": isInertLink.value ? "true" : void 0,
|
|
834
820
|
"aria-busy": isLoading.value ? "true" : void 0,
|
|
835
821
|
"aria-pressed": ariaPressed.value,
|
|
836
822
|
"aria-label": ariaLabel.value
|
|
837
|
-
}, toHandlers(rootListeners.value)
|
|
823
|
+
}, toHandlers(rootListeners.value), {
|
|
824
|
+
...linkAttrs.value,
|
|
825
|
+
...forwardedAttrs.value
|
|
826
|
+
}), {
|
|
838
827
|
default: withCtx(() => [
|
|
839
828
|
isInlineSpinner.value ? (openBlock(), createElementBlock("span", {
|
|
840
829
|
key: 0,
|
|
841
830
|
"data-part": "spinner",
|
|
842
831
|
class: normalizeClass(spinnerClass.value)
|
|
843
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true),
|
|
832
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true),
|
|
844
833
|
hasLeading.value ? (openBlock(), createElementBlock("span", {
|
|
845
834
|
key: 1,
|
|
846
835
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
@@ -869,7 +858,7 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
869
858
|
key: 4,
|
|
870
859
|
"data-part": "spinner",
|
|
871
860
|
class: normalizeClass(spinnerClass.value)
|
|
872
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true)
|
|
861
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true)
|
|
873
862
|
]),
|
|
874
863
|
_: 3
|
|
875
864
|
}, 16, [
|
|
@@ -919,9 +908,13 @@ var FieldError_default = /* @__PURE__ */ defineComponent({
|
|
|
919
908
|
* rendered.
|
|
920
909
|
*/
|
|
921
910
|
const props = __props;
|
|
922
|
-
const errorClass = computed(() =>
|
|
911
|
+
const errorClass = computed(() => [
|
|
912
|
+
"eldra:text-field-note eldra:text-danger eldra:flex eldra:items-start eldra:gap-1.25 eldra:font-medium",
|
|
913
|
+
props.rowClass,
|
|
914
|
+
props.classes?.error
|
|
915
|
+
]);
|
|
923
916
|
/** 1rem, nudged 0.1em down so it sits on the text rather than above it. */
|
|
924
|
-
const errorIconClass = computed(() =>
|
|
917
|
+
const errorIconClass = computed(() => ["eldra:size-4 eldra:shrink-0 eldra:translate-y-[0.1em]", props.classes?.errorIcon]);
|
|
925
918
|
return (_ctx, _cache) => {
|
|
926
919
|
return openBlock(), createElementBlock("p", {
|
|
927
920
|
id: __props.id,
|
|
@@ -965,7 +958,7 @@ var RequiredMark_default = /* @__PURE__ */ defineComponent({
|
|
|
965
958
|
* The asterisk is decorative: a control's native `required` is what announces it.
|
|
966
959
|
*/
|
|
967
960
|
const props = __props;
|
|
968
|
-
const markClass = computed(() =>
|
|
961
|
+
const markClass = computed(() => ["eldra:text-danger eldra:ms-0.5", props.classes?.requiredMark]);
|
|
969
962
|
return (_ctx, _cache) => {
|
|
970
963
|
return openBlock(), createElementBlock("span", {
|
|
971
964
|
"data-eldra-ui": "",
|
|
@@ -985,8 +978,7 @@ var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
|
985
978
|
focusable: {
|
|
986
979
|
type: Boolean,
|
|
987
980
|
default: false
|
|
988
|
-
}
|
|
989
|
-
classes: { default: void 0 }
|
|
981
|
+
}
|
|
990
982
|
},
|
|
991
983
|
setup(__props) {
|
|
992
984
|
const eldra = useEldraScope();
|
|
@@ -997,7 +989,7 @@ var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
|
997
989
|
* it with a literal size or a `display: none` that would also hide the content
|
|
998
990
|
* from screen readers.
|
|
999
991
|
*/
|
|
1000
|
-
const rootClass = computed(() =>
|
|
992
|
+
const rootClass = computed(() => ["eldra:sr-only", props.focusable && "eldra:focus:not-sr-only"]);
|
|
1001
993
|
return (_ctx, _cache) => {
|
|
1002
994
|
return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
1003
995
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
@@ -1041,13 +1033,15 @@ var _hoisted_3$14 = {
|
|
|
1041
1033
|
};
|
|
1042
1034
|
var _hoisted_4$13 = ["data-eldra-slot"];
|
|
1043
1035
|
var _hoisted_5$11 = ["data-eldra-slot"];
|
|
1044
|
-
var ROOT$
|
|
1036
|
+
var ROOT$3 = "eldra:group eldra:grid eldra:max-w-full eldra:gap-y-0.5 eldra:target-min";
|
|
1037
|
+
var ROOT_COLUMNS = "eldra:grid-cols-[auto_1fr] eldra:gap-x-2.5";
|
|
1038
|
+
var ROOT_INLINE = "eldra:w-fit eldra:items-start";
|
|
1045
1039
|
/**
|
|
1046
1040
|
* Spec "Checkbox" → Sizes: box 1.125rem "nudged 0.1875rem down to align with the first text line"
|
|
1047
1041
|
* at md, 1.5rem "top-aligned" at lg. `--spacing` is 0.25rem, so `size-4.5` is 1.125rem, `size-6`
|
|
1048
1042
|
* is 1.5rem and `mt-0.75` is the 0.1875rem nudge. A 1.5rem box on a 1.5rem line needs none.
|
|
1049
1043
|
*/
|
|
1050
|
-
var BOX = "relative inline-flex shrink-0 items-center justify-center rounded-[var(--eldra-checkbox-radius,var(--eldra-radius-sm))] eldra-focus eldra-focus-proxy";
|
|
1044
|
+
var BOX = "eldra:relative eldra:inline-flex eldra:shrink-0 eldra:items-center eldra:justify-center eldra:rounded-[var(--eldra-checkbox-radius,var(--eldra-radius-sm))] eldra:eldra-focus eldra:eldra-focus-proxy";
|
|
1051
1045
|
/**
|
|
1052
1046
|
* States (spec "Checkbox" → States). Driven from the component's own state rather than from CSS
|
|
1053
1047
|
* `:checked`/`:indeterminate` variants, for the reason Input.vue gives: a dead or invalid box must
|
|
@@ -1055,10 +1049,10 @@ var BOX = "relative inline-flex shrink-0 items-center justify-center rounded-[va
|
|
|
1055
1049
|
* the stylesheet. Only `:hover` — which nothing here can express in JavaScript — is a variant, and
|
|
1056
1050
|
* it is written only into the two states that have a hover.
|
|
1057
1051
|
*/
|
|
1058
|
-
var UNCHECKED = "bg-background border-border-strong group-hover:border-text eldra-checkbox-border";
|
|
1059
|
-
var CHECKED = "bg-primary border-primary eldra-checkbox-border";
|
|
1052
|
+
var UNCHECKED = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text eldra:eldra-checkbox-border";
|
|
1053
|
+
var CHECKED = "eldra:bg-primary eldra:border-primary eldra:eldra-checkbox-border";
|
|
1060
1054
|
/** Spec "Checkbox" → States, Error: `background` fill and a **2px** `danger` border. */
|
|
1061
|
-
var INVALID$4 = "bg-background border-danger group-hover:border-danger eldra-checkbox-border-invalid";
|
|
1055
|
+
var INVALID$4 = "eldra:bg-background eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
1062
1056
|
/**
|
|
1063
1057
|
* The error row of the spec's States table describes an *unchecked* box — that is the required
|
|
1064
1058
|
* consent it is written for. A box that is checked or indeterminate keeps its `primary` fill and
|
|
@@ -1067,16 +1061,16 @@ var INVALID$4 = "bg-background border-danger group-hover:border-danger eldra-che
|
|
|
1067
1061
|
* "Checked differs by fill and tick shape, not only colour" (Accessibility) has to stay true in
|
|
1068
1062
|
* every state, error included.
|
|
1069
1063
|
*/
|
|
1070
|
-
var INVALID_MARKED = "bg-primary border-danger group-hover:border-danger eldra-checkbox-border-invalid";
|
|
1071
|
-
var DISABLED$4 = "bg-surface-strong border-border border-dashed eldra-checkbox-border";
|
|
1072
|
-
var DISABLED_CHECKED = "bg-muted border-muted eldra-checkbox-border";
|
|
1064
|
+
var INVALID_MARKED = "eldra:bg-primary eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
1065
|
+
var DISABLED$4 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:eldra-checkbox-border";
|
|
1066
|
+
var DISABLED_CHECKED = "eldra:bg-muted eldra:border-muted eldra:eldra-checkbox-border";
|
|
1073
1067
|
/**
|
|
1074
1068
|
* A disabled box drops the danger boundary and keeps `aria-invalid` — the same reading as Input
|
|
1075
1069
|
* and Textarea: the field is still invalid, it just cannot be corrected here, so it shows the dead
|
|
1076
1070
|
* boundary rather than an actionable one.
|
|
1077
1071
|
*/
|
|
1078
|
-
var BOX_ONLY = "grid-cols-[auto] gap-x-0";
|
|
1079
|
-
var CONTROL = "absolute inset-0 m-0 size-full cursor-pointer appearance-none opacity-0 disabled:cursor-not-allowed";
|
|
1072
|
+
var BOX_ONLY = "eldra:grid-cols-[auto] eldra:gap-x-0";
|
|
1073
|
+
var CONTROL = "eldra:absolute eldra:inset-0 eldra:m-0 eldra:size-full eldra:cursor-pointer eldra:appearance-none eldra:opacity-0 eldra:disabled:cursor-not-allowed";
|
|
1080
1074
|
// src/components/checkbox/Checkbox.vue
|
|
1081
1075
|
var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
1082
1076
|
inheritAttrs: false,
|
|
@@ -1122,7 +1116,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1122
1116
|
const props = __props;
|
|
1123
1117
|
const emit = __emit;
|
|
1124
1118
|
const slots = useSlots();
|
|
1125
|
-
useAttrs();
|
|
1119
|
+
const attrs = useAttrs();
|
|
1126
1120
|
/** See Input.vue for the field-context rationale: any explicit prop wins over the wrapper. */
|
|
1127
1121
|
const field = inject(FIELD_KEY, null);
|
|
1128
1122
|
/**
|
|
@@ -1197,8 +1191,8 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1197
1191
|
* `gap-x-2.5` is the 0.625rem box-to-text gap, `gap-y-0.5` the hint's own line spacing.
|
|
1198
1192
|
*/
|
|
1199
1193
|
const BOX_SIZE = {
|
|
1200
|
-
md: "size-4.5 mt-0.75",
|
|
1201
|
-
lg: "size-6"
|
|
1194
|
+
md: "eldra:size-4.5 eldra:mt-0.75",
|
|
1195
|
+
lg: "eldra:size-6"
|
|
1202
1196
|
};
|
|
1203
1197
|
/**
|
|
1204
1198
|
* The drawn box (spec "Checkbox" → Anatomy: "a native `<input type="checkbox">` with custom
|
|
@@ -1234,7 +1228,18 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1234
1228
|
return hasHint.value || hasContent(slots.default?.() ?? []);
|
|
1235
1229
|
}
|
|
1236
1230
|
function rootClass(labelled) {
|
|
1237
|
-
return
|
|
1231
|
+
return mergeClass([
|
|
1232
|
+
ROOT$3,
|
|
1233
|
+
labelled ? ROOT_COLUMNS : BOX_ONLY,
|
|
1234
|
+
ROOT_INLINE,
|
|
1235
|
+
props.disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer"
|
|
1236
|
+
], attrs.class);
|
|
1237
|
+
}
|
|
1238
|
+
/** Every attribute but `class` lands on the control; `class` styles the root. */
|
|
1239
|
+
function controlAttrs() {
|
|
1240
|
+
const rest = { ...attrs };
|
|
1241
|
+
delete rest.class;
|
|
1242
|
+
return rest;
|
|
1238
1243
|
}
|
|
1239
1244
|
/**
|
|
1240
1245
|
* The control itself, stretched over the drawn box rather than `sr-only` in a corner of it.
|
|
@@ -1247,7 +1252,11 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1247
1252
|
* through. Covering the box with the control makes the box the target in both arrangements, and a
|
|
1248
1253
|
* click on it is a click on the control rather than a label forwarding one.
|
|
1249
1254
|
*/
|
|
1250
|
-
const boxClass = computed(() =>
|
|
1255
|
+
const boxClass = computed(() => [[
|
|
1256
|
+
BOX,
|
|
1257
|
+
BOX_SIZE[props.size],
|
|
1258
|
+
boxState.value
|
|
1259
|
+
], props.classes?.box]);
|
|
1251
1260
|
/**
|
|
1252
1261
|
* The mark (spec "Checkbox" → Behaviour & motion): "The tick scales in from 0 over `duration-fast`
|
|
1253
1262
|
* with `ease-out`. … With reduced motion the tick simply appears." Reduced motion needs no class:
|
|
@@ -1257,22 +1266,22 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1257
1266
|
* The mark is one part with two shapes, so a disabled *checked* box keeps its tick (spec's States
|
|
1258
1267
|
* table) while an empty one has nothing to show.
|
|
1259
1268
|
*/
|
|
1260
|
-
const checkClass = computed(() =>
|
|
1269
|
+
const checkClass = computed(() => [["eldra:pointer-events-none eldra:size-2.5 eldra:text-primary-contrast eldra:transition-transform eldra:duration-fast eldra:ease-out", isMarked.value ? "eldra:scale-100" : "eldra:scale-0"], props.classes?.check]);
|
|
1261
1270
|
/**
|
|
1262
1271
|
* Spec "Checkbox" → Sizes: label 0.9375rem on a 1.5rem line — the same two numbers as the
|
|
1263
1272
|
* compact-control type, so it is the same utility rather than a second one that would drift from
|
|
1264
1273
|
* it. (Not the mobile 1rem override: that rule is scoped to "inputs, textareas, select triggers
|
|
1265
1274
|
* and select search fields", where it stops iOS zooming into a focused field.)
|
|
1266
1275
|
*/
|
|
1267
|
-
const labelClass = computed(() =>
|
|
1276
|
+
const labelClass = computed(() => [["eldra:text-control eldra:min-w-0", props.disabled ? "eldra:text-muted" : "eldra:text-text"], props.classes?.label]);
|
|
1268
1277
|
/** Spec "Checkbox" → Sizes: "Hint: 0.875rem, `muted`, on its own line", in column 2 under it. */
|
|
1269
|
-
const hintClass = computed(() =>
|
|
1278
|
+
const hintClass = computed(() => ["eldra:text-body-sm eldra:text-muted eldra:col-start-2 eldra:min-w-0", props.classes?.hint]);
|
|
1270
1279
|
/**
|
|
1271
1280
|
* With an `error`, the row and its error message sit in one box (the `field` part), so the message
|
|
1272
1281
|
* stays outside the `<label>` and out of the control's name. Without one, the row is the root as
|
|
1273
1282
|
* it always was.
|
|
1274
1283
|
*/
|
|
1275
|
-
const fieldClass = computed(() =>
|
|
1284
|
+
const fieldClass = computed(() => ["eldra:grid eldra:w-fit eldra:max-w-full eldra:content-start eldra:gap-1", props.classes?.field]);
|
|
1276
1285
|
const Field = (_props, { slots: own }) => {
|
|
1277
1286
|
const row = own.default?.()[0];
|
|
1278
1287
|
if (!hasError.value) return row;
|
|
@@ -1310,7 +1319,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1310
1319
|
}, [createElementVNode("input", mergeProps({
|
|
1311
1320
|
ref_key: "controlRef",
|
|
1312
1321
|
ref: controlRef
|
|
1313
|
-
},
|
|
1322
|
+
}, controlAttrs(), {
|
|
1314
1323
|
class: CONTROL,
|
|
1315
1324
|
type: "checkbox",
|
|
1316
1325
|
id: unref(controlId),
|
|
@@ -1372,6 +1381,7 @@ var _hoisted_1$14 = [
|
|
|
1372
1381
|
"aria-describedby",
|
|
1373
1382
|
"aria-invalid"
|
|
1374
1383
|
];
|
|
1384
|
+
var ROOT$2 = "eldra:grid eldra:min-w-0 eldra:content-start eldra:gap-3 eldra:rounded-none eldra:border-0 eldra:p-0";
|
|
1375
1385
|
// src/components/checkbox/CheckboxGroup.vue
|
|
1376
1386
|
var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
1377
1387
|
__name: "CheckboxGroup",
|
|
@@ -1419,20 +1429,18 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1419
1429
|
* checkboxes looks the same whichever of the two draws it: "no border, padding or min-width, grid
|
|
1420
1430
|
* with a 0.75rem (`space-3`) gap, and the legend has a 0.5rem (`space-2`) bottom margin."
|
|
1421
1431
|
*/
|
|
1422
|
-
const
|
|
1423
|
-
/** The same type style as a `FieldWrapper` label, with a `<legend>`'s default padding removed. */
|
|
1424
|
-
const legendClass = computed(() => partClass("text-label text-text mb-2 block w-fit p-0", props.classes, "legend"));
|
|
1432
|
+
const legendClass = computed(() => ["eldra:text-label eldra:text-text eldra:mb-2 eldra:block eldra:w-fit eldra:p-0", props.classes?.legend]);
|
|
1425
1433
|
/**
|
|
1426
1434
|
* Spec "Checkbox" → Sizes: "Vertical group gap 0.5rem (`space-2`). Row group gap 0.5rem × 1.5rem
|
|
1427
1435
|
* (`space-2` × `space-6`), wrapping."
|
|
1428
1436
|
*/
|
|
1429
|
-
const optionsClass = computed(() =>
|
|
1437
|
+
const optionsClass = computed(() => [["eldra:flex eldra:min-w-0", props.layout === "row" ? "eldra:flex-row eldra:flex-wrap eldra:gap-x-6 eldra:gap-y-2" : "eldra:flex-col eldra:gap-2"], props.classes?.options]);
|
|
1430
1438
|
return (_ctx, _cache) => {
|
|
1431
1439
|
return openBlock(), createElementBlock("fieldset", {
|
|
1432
1440
|
"data-eldra-ui": "",
|
|
1433
1441
|
"data-eldra-scope": unref(eldra).scope,
|
|
1434
1442
|
"data-part": "root",
|
|
1435
|
-
class: normalizeClass(
|
|
1443
|
+
class: normalizeClass(ROOT$2),
|
|
1436
1444
|
"aria-describedby": describedBy.value,
|
|
1437
1445
|
"aria-invalid": __props.error ? "true" : void 0
|
|
1438
1446
|
}, [
|
|
@@ -1472,7 +1480,7 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1472
1480
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.error), 1)]),
|
|
1473
1481
|
_: 1
|
|
1474
1482
|
}, 8, ["id", "classes"])) : createCommentVNode("", true)
|
|
1475
|
-
],
|
|
1483
|
+
], 8, _hoisted_1$14);
|
|
1476
1484
|
};
|
|
1477
1485
|
}
|
|
1478
1486
|
});
|
|
@@ -1489,18 +1497,16 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1489
1497
|
* neither one appears to depend on the other: `MultiSelect` shipped first and `Chip` reuses its
|
|
1490
1498
|
* visual language, but the recipe itself belongs to neither.
|
|
1491
1499
|
*/
|
|
1492
|
-
var TAG_FILL = "bg-surface-strong text-text";
|
|
1500
|
+
var TAG_FILL = "eldra:bg-surface-strong eldra:text-text";
|
|
1493
1501
|
/** The pill shape and type: rounded-full, min 1.75rem tall, the caption size, `space-1` gap. */
|
|
1494
|
-
var TAG_SHAPE = "inline-flex min-h-7 items-center gap-1 rounded-full text-caption";
|
|
1502
|
+
var TAG_SHAPE = "eldra:inline-flex eldra:min-h-7 eldra:items-center eldra:gap-1 eldra:rounded-full eldra:text-caption";
|
|
1495
1503
|
/**
|
|
1496
1504
|
* Start padding is 0.625rem either way; the end padding is the remove button's own room, so a tag
|
|
1497
1505
|
* with no remove button is padded evenly instead of ending short.
|
|
1498
1506
|
*/
|
|
1499
1507
|
function tagPadding(hasRemoveButton) {
|
|
1500
|
-
return hasRemoveButton ? "ps-2.5 pe-0.5" : "px-2.5";
|
|
1508
|
+
return hasRemoveButton ? "eldra:ps-2.5 eldra:pe-0.5" : "eldra:px-2.5";
|
|
1501
1509
|
}
|
|
1502
|
-
/** The remove button: a 1.5rem circle, `muted` at rest, `text` on hover at 11% opacity. */
|
|
1503
|
-
var TAG_REMOVE_BUTTON = "inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted hover:text-text hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_89%)] eldra-focus";
|
|
1504
1510
|
// src/composables/useLocale.ts
|
|
1505
1511
|
/**
|
|
1506
1512
|
* The number locale the components format with, as a provide/inject pair — the same shape as
|
|
@@ -1975,7 +1981,7 @@ function currencySymbol(currency, locale = "en-US", narrow = true) {
|
|
|
1975
1981
|
* own **delta** — a pill radius, a different padding for an icon it draws itself — never a second
|
|
1976
1982
|
* copy of the box.
|
|
1977
1983
|
*
|
|
1978
|
-
* Nothing here is exported from the package: a consumer restyles through `classes`, tokens and
|
|
1984
|
+
* Nothing here is exported from the package: a consumer restyles through `class`, `classes`, tokens and
|
|
1979
1985
|
* the per-component CSS variables (see the README's Customisation section), not by importing our
|
|
1980
1986
|
* class strings, which are not a stable API.
|
|
1981
1987
|
*/
|
|
@@ -1991,7 +1997,10 @@ function currencySymbol(currency, locale = "en-US", narrow = true) {
|
|
|
1991
1997
|
* list, including the `duration-fast` border-colour change the spec's Behaviour section asks for.
|
|
1992
1998
|
* See `src/styles/tailwind.css` and `src/__tests__/focus-transition.spec.ts`.
|
|
1993
1999
|
*/
|
|
1994
|
-
var
|
|
2000
|
+
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";
|
|
2001
|
+
/** The box's radius, apart so a field with a radius of its own (`SearchBar`'s pill) takes one. */
|
|
2002
|
+
var FIELD_RADIUS = "eldra:rounded-[var(--eldra-input-radius,var(--eldra-radius-md))]";
|
|
2003
|
+
var FIELD_BASE = `${FIELD_BOX} ${FIELD_RADIUS}`;
|
|
1995
2004
|
/**
|
|
1996
2005
|
* The type style per size (spec "Input" → Sizes). Its own constant because `SearchBar`'s two sizes
|
|
1997
2006
|
* take exactly these rules while its paddings are its own — the `max-md:text-control-mobile`
|
|
@@ -1999,9 +2008,9 @@ var FIELD_BASE = "block w-full min-w-0 eldra-field-border bg-background text-tex
|
|
|
1999
2008
|
* is the half that had gone missing from the copy.
|
|
2000
2009
|
*/
|
|
2001
2010
|
var FIELD_TEXT = {
|
|
2002
|
-
sm: "text-control-sm",
|
|
2003
|
-
md: "text-control max-md:text-control-mobile",
|
|
2004
|
-
lg: "text-control-lg"
|
|
2011
|
+
sm: "eldra:text-control-sm",
|
|
2012
|
+
md: "eldra:text-control eldra:max-md:text-control-mobile",
|
|
2013
|
+
lg: "eldra:text-control-lg"
|
|
2005
2014
|
};
|
|
2006
2015
|
/**
|
|
2007
2016
|
* Sizes (spec "Input" → Sizes). `--spacing` is 0.25rem, so `py-0.75`/`px-2.25` are the spec's
|
|
@@ -2010,19 +2019,19 @@ var FIELD_TEXT = {
|
|
|
2010
2019
|
* inside the spec's box at every size.
|
|
2011
2020
|
*/
|
|
2012
2021
|
var FIELD_SIZE = {
|
|
2013
|
-
sm: `control-h-sm py-0.75 px-2.25 ${FIELD_TEXT.sm}`,
|
|
2014
|
-
md: `control-h py-1.75 px-2.75 ${FIELD_TEXT.md}`,
|
|
2015
|
-
lg: `control-h-lg py-2.75 px-2.75 ${FIELD_TEXT.lg}`
|
|
2022
|
+
sm: `eldra:control-h-sm eldra:py-0.75 eldra:px-2.25 ${FIELD_TEXT.sm}`,
|
|
2023
|
+
md: `eldra:control-h eldra:py-1.75 eldra:px-2.75 ${FIELD_TEXT.md}`,
|
|
2024
|
+
lg: `eldra:control-h-lg eldra:py-2.75 eldra:px-2.75 ${FIELD_TEXT.lg}`
|
|
2016
2025
|
};
|
|
2017
2026
|
var FIELD_TRAILING_PAD = {
|
|
2018
|
-
sm: "pe-8",
|
|
2019
|
-
md: "pe-10",
|
|
2020
|
-
lg: "pe-10"
|
|
2027
|
+
sm: "eldra:pe-8",
|
|
2028
|
+
md: "eldra:pe-10",
|
|
2029
|
+
lg: "eldra:pe-10"
|
|
2021
2030
|
};
|
|
2022
2031
|
var FIELD_CLEAR_SIZE = {
|
|
2023
|
-
sm: "size-6",
|
|
2024
|
-
md: "size-8",
|
|
2025
|
-
lg: "size-8"
|
|
2032
|
+
sm: "eldra:size-6",
|
|
2033
|
+
md: "eldra:size-8",
|
|
2034
|
+
lg: "eldra:size-8"
|
|
2026
2035
|
};
|
|
2027
2036
|
/**
|
|
2028
2037
|
* Two trailing actions (operator report, 2026-09-25; recorded under Deviations in the README): a
|
|
@@ -2038,26 +2047,38 @@ var FIELD_CLEAR_SIZE = {
|
|
|
2038
2047
|
* both of them plus the row's own 0.25rem inset from the edge.
|
|
2039
2048
|
*/
|
|
2040
2049
|
var FIELD_TRAILING_PAD_PAIR = {
|
|
2041
|
-
sm: "pe-14",
|
|
2042
|
-
md: "pe-14",
|
|
2043
|
-
lg: "pe-14"
|
|
2050
|
+
sm: "eldra:pe-14",
|
|
2051
|
+
md: "eldra:pe-14",
|
|
2052
|
+
lg: "eldra:pe-14"
|
|
2044
2053
|
};
|
|
2045
2054
|
var FIELD_ACTION_PAIR_SIZE = {
|
|
2046
|
-
sm: "w-6 h-6",
|
|
2047
|
-
md: "w-6 h-8",
|
|
2048
|
-
lg: "w-6 h-8"
|
|
2055
|
+
sm: "eldra:w-6 eldra:h-6",
|
|
2056
|
+
md: "eldra:w-6 eldra:h-8",
|
|
2057
|
+
lg: "eldra:w-6 eldra:h-8"
|
|
2049
2058
|
};
|
|
2050
2059
|
/**
|
|
2051
2060
|
* States (spec "Input" → States). Disabled and read-only replace the live colours outright rather
|
|
2052
2061
|
* than layering over them, so a `:hover` rule can never win back a live boundary on a dead field.
|
|
2053
|
-
* The error row's second 1px line is
|
|
2054
|
-
*
|
|
2062
|
+
* The error row's second 1px line is the ring's own outline at rest (`eldra-field-invalid`, on the
|
|
2063
|
+
* control beside this recipe). Each recipe carries the
|
|
2064
|
+
* fill, the text colour and the boundary, so a field renders exactly one of each: `fieldState`
|
|
2065
|
+
* picks the one recipe a field is in.
|
|
2055
2066
|
*/
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
2058
|
-
var
|
|
2067
|
+
var FIELD_LIVE_FILL = "eldra:bg-background eldra:text-text";
|
|
2068
|
+
var FIELD_READONLY_FILL = "eldra:bg-surface eldra:text-text";
|
|
2069
|
+
var FIELD_LIVE = `${FIELD_LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
|
|
2070
|
+
/** The error boundary alone; `fieldState` pairs it with the live or the read-only fill. */
|
|
2071
|
+
var FIELD_INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
|
|
2072
|
+
var FIELD_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
2073
|
+
var FIELD_READONLY = `${FIELD_READONLY_FILL} eldra:border-border`;
|
|
2074
|
+
/** The one state recipe a field box is in. `invalid` is the shown error, never set while disabled. */
|
|
2075
|
+
function fieldState(state) {
|
|
2076
|
+
if (state.disabled) return FIELD_DISABLED;
|
|
2077
|
+
if (state.readonly) return state.invalid ? `${FIELD_READONLY_FILL} ${FIELD_INVALID}` : FIELD_READONLY;
|
|
2078
|
+
return state.invalid ? `${FIELD_LIVE_FILL} ${FIELD_INVALID}` : FIELD_LIVE;
|
|
2079
|
+
}
|
|
2059
2080
|
/** Spec "Input" → Variants, `search`: "The browser's own clear button is hidden." */
|
|
2060
|
-
var FIELD_SEARCH_APPEARANCE = "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none";
|
|
2081
|
+
var FIELD_SEARCH_APPEARANCE = "eldra:[&::-webkit-search-cancel-button]:appearance-none eldra:[&::-webkit-search-decoration]:appearance-none";
|
|
2061
2082
|
/**
|
|
2062
2083
|
* A ghost icon button at the field's end edge (spec "Input" → Anatomy): square, `muted`, the ring.
|
|
2063
2084
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README): Tailwind
|
|
@@ -2065,9 +2086,11 @@ var FIELD_SEARCH_APPEARANCE = "[&::-webkit-search-cancel-button]:appearance-none
|
|
|
2065
2086
|
* package — `Input`'s, `SearchBar`'s and `UnitInput`'s (`CurrencyInput` wraps the last) — showed
|
|
2066
2087
|
* the default arrow rather than a pointer.
|
|
2067
2088
|
*/
|
|
2068
|
-
var
|
|
2089
|
+
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";
|
|
2090
|
+
/** The whole button. A field that shows or rounds it its own way takes `FIELD_CLEAR_BUTTON_BOX`. */
|
|
2091
|
+
var FIELD_CLEAR_BUTTON = `eldra:inline-flex ${FIELD_CLEAR_BUTTON_BOX} eldra:rounded-[var(--eldra-radius-sm)]`;
|
|
2069
2092
|
/** 1.125rem, `muted`, 0.6875rem from the start edge, and out of the pointer's way. */
|
|
2070
|
-
var FIELD_LEADING_ICON = "absolute start-2.75 inset-y-0 my-auto flex h-4.5 w-4.5 items-center justify-center text-muted pointer-events-none";
|
|
2093
|
+
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";
|
|
2071
2094
|
/**
|
|
2072
2095
|
* The end-edge area, 0.25rem from the edge (spec "Input" → Anatomy, "Trailing action"). The clear
|
|
2073
2096
|
* button and the `suffix` slot share it, so a field that has both keeps them on one row in reading
|
|
@@ -2079,21 +2102,21 @@ var FIELD_LEADING_ICON = "absolute start-2.75 inset-y-0 my-auto flex h-4.5 w-4.5
|
|
|
2079
2102
|
* so a field with both keeps them on one row"), and this constant is `Input`'s and `SearchBar`'s
|
|
2080
2103
|
* row too — dropping the gap here would silently change `Input`'s rendered output for that
|
|
2081
2104
|
* combination, which an early review caught. Only `UnitInput`'s two-action pair (see
|
|
2082
|
-
* `FIELD_TRAILING_PAD_PAIR` above) wants flush icons, and it
|
|
2083
|
-
*
|
|
2084
|
-
* merge-group registration is needed) rather than changing the shared default.
|
|
2105
|
+
* `FIELD_TRAILING_PAD_PAIR` above) wants flush icons, and it builds its row from
|
|
2106
|
+
* `FIELD_SUFFIX_ROW_BASE` with `gap-0` rather than changing the shared default.
|
|
2085
2107
|
*/
|
|
2086
|
-
var
|
|
2108
|
+
var FIELD_SUFFIX_ROW_BASE = "eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center";
|
|
2109
|
+
var FIELD_SUFFIX_ROW = `${FIELD_SUFFIX_ROW_BASE} eldra:gap-1`;
|
|
2087
2110
|
/**
|
|
2088
2111
|
* The start-edge mirror of `FIELD_SUFFIX_ROW`, for the `prefix` slot: interactive content (a
|
|
2089
2112
|
* calendar button) 0.25rem from the start edge, so unlike `FIELD_LEADING_ICON` it keeps the pointer.
|
|
2090
2113
|
*/
|
|
2091
|
-
var FIELD_PREFIX_ROW = "absolute start-1 inset-y-0 my-auto flex items-center gap-1";
|
|
2114
|
+
var FIELD_PREFIX_ROW = "eldra:absolute eldra:start-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center eldra:gap-1";
|
|
2092
2115
|
/** The start padding a `prefix` row reserves: the trailing action's room, mirrored. */
|
|
2093
2116
|
var FIELD_PREFIX_PAD = {
|
|
2094
|
-
sm: "ps-8",
|
|
2095
|
-
md: "ps-10",
|
|
2096
|
-
lg: "ps-10"
|
|
2117
|
+
sm: "eldra:ps-8",
|
|
2118
|
+
md: "eldra:ps-10",
|
|
2119
|
+
lg: "eldra:ps-10"
|
|
2097
2120
|
};
|
|
2098
2121
|
/** `FIELD_TRAILING_PAD`/`FIELD_PREFIX_PAD` in rem, for `useAdornmentRoom`'s comparison. */
|
|
2099
2122
|
var FIELD_ACTION_ROOM_REM = {
|
|
@@ -2176,6 +2199,13 @@ var _hoisted_6$8 = ["data-eldra-slot"];
|
|
|
2176
2199
|
var _hoisted_7$5 = ["data-eldra-scope", "aria-label"];
|
|
2177
2200
|
var _hoisted_8$4 = ["data-eldra-scope"];
|
|
2178
2201
|
var VALUE_DRAG_PIXELS_PER_STEP = 8;
|
|
2202
|
+
/**
|
|
2203
|
+
* `Number.MAX_SAFE_INTEGER`, written out. A property access in a prop default is a member
|
|
2204
|
+
* expression the bundler cannot prove pure (a getter may throw), which pins the whole component
|
|
2205
|
+
* into every consumer's bundle — importing `Button` alone pulled this file in with it.
|
|
2206
|
+
*/
|
|
2207
|
+
var MAX_SAFE_VALUE = 9007199254740991;
|
|
2208
|
+
var rootClass$6 = "eldra:block eldra:w-full";
|
|
2179
2209
|
// src/components/unit-input/UnitInput.vue
|
|
2180
2210
|
var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
2181
2211
|
inheritAttrs: false,
|
|
@@ -2186,7 +2216,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2186
2216
|
locale: { default: void 0 },
|
|
2187
2217
|
label: { default: void 0 },
|
|
2188
2218
|
maxFraction: { default: 2 },
|
|
2189
|
-
max: { default:
|
|
2219
|
+
max: { default: MAX_SAFE_VALUE },
|
|
2190
2220
|
min: { default: 0 },
|
|
2191
2221
|
step: { default: 1 },
|
|
2192
2222
|
enableDragAdjust: {
|
|
@@ -2710,21 +2740,41 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2710
2740
|
const hasLeading = computed(() => props.leadingIcon !== void 0 || slots.leadingIcon !== void 0);
|
|
2711
2741
|
/** The same rule as `Input`'s: a disabled field keeps its dead boundary and drops the danger one. */
|
|
2712
2742
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
2713
|
-
const
|
|
2714
|
-
const
|
|
2715
|
-
const
|
|
2716
|
-
|
|
2717
|
-
|
|
2743
|
+
const labelClass = computed(() => mergeClass("eldra:text-label eldra:text-text eldra:mb-1 eldra:block", props.classes?.label));
|
|
2744
|
+
const fieldClass = computed(() => ["eldra:relative eldra:block eldra:w-full", props.classes?.field]);
|
|
2745
|
+
const controlClass = computed(() => [
|
|
2746
|
+
FIELD_BASE,
|
|
2747
|
+
FIELD_SIZE[props.size],
|
|
2748
|
+
hasLeading.value && "eldra:ps-9",
|
|
2749
|
+
hasTrailing.value && (isActionPair.value ? FIELD_TRAILING_PAD_PAIR[props.size] : FIELD_TRAILING_PAD[props.size]),
|
|
2750
|
+
"eldra:tabular-nums",
|
|
2751
|
+
fieldState({
|
|
2752
|
+
disabled: props.disabled,
|
|
2753
|
+
readonly: props.readonly,
|
|
2754
|
+
invalid: showsInvalid.value
|
|
2755
|
+
}),
|
|
2756
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
2757
|
+
props.classes?.control
|
|
2758
|
+
]);
|
|
2759
|
+
const leadingIconClass = computed(() => [FIELD_LEADING_ICON, props.classes?.leadingIcon]);
|
|
2718
2760
|
/**
|
|
2719
2761
|
* `FIELD_SUFFIX_ROW`'s `gap-1` is the shared default (`Input`'s and `SearchBar`'s row too — see its
|
|
2720
|
-
* own doc comment). Only the two-action pair wants its icons flush, so that case alone
|
|
2721
|
-
*
|
|
2722
|
-
* group, so `cx` needs no new merge-group registration for this).
|
|
2762
|
+
* own doc comment). Only the two-action pair wants its icons flush, so that case alone builds the
|
|
2763
|
+
* row from `FIELD_SUFFIX_ROW_BASE` with `gap-0` rather than changing the shared constant.
|
|
2723
2764
|
*/
|
|
2724
|
-
const suffixClass = computed(() =>
|
|
2765
|
+
const suffixClass = computed(() => [isActionPair.value ? `${FIELD_SUFFIX_ROW_BASE} eldra:gap-0` : FIELD_SUFFIX_ROW, props.classes?.suffix]);
|
|
2725
2766
|
const actionSize = computed(() => isActionPair.value ? FIELD_ACTION_PAIR_SIZE[props.size] : FIELD_CLEAR_SIZE[props.size]);
|
|
2726
|
-
const clearButtonClass = computed(() =>
|
|
2727
|
-
|
|
2767
|
+
const clearButtonClass = computed(() => [
|
|
2768
|
+
FIELD_CLEAR_BUTTON,
|
|
2769
|
+
actionSize.value,
|
|
2770
|
+
props.classes?.clearButton
|
|
2771
|
+
]);
|
|
2772
|
+
const dragHandleClass = computed(() => [
|
|
2773
|
+
"eldra:inline-flex eldra:shrink-0 eldra:cursor-ns-resize eldra:touch-none eldra:items-center eldra:justify-center",
|
|
2774
|
+
"eldra:text-muted eldra:hover:text-text eldra:select-none",
|
|
2775
|
+
actionSize.value,
|
|
2776
|
+
props.classes?.dragHandle
|
|
2777
|
+
]);
|
|
2728
2778
|
/** `formatValue` is the private library's own exposed method: a caller formats one number the
|
|
2729
2779
|
* way this field would. */
|
|
2730
2780
|
__expose({ formatValue });
|
|
@@ -2733,7 +2783,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2733
2783
|
"data-eldra-ui": "",
|
|
2734
2784
|
"data-eldra-scope": unref(eldra).scope,
|
|
2735
2785
|
"data-part": "root",
|
|
2736
|
-
class: normalizeClass(rootClass.
|
|
2786
|
+
class: normalizeClass([rootClass$6, _ctx.$attrs.class])
|
|
2737
2787
|
}, [showOwnLabel.value ? (openBlock(), createElementBlock("label", {
|
|
2738
2788
|
key: 0,
|
|
2739
2789
|
"data-part": "label",
|
|
@@ -2748,15 +2798,20 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2748
2798
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
2749
2799
|
"data-part": "leadingIcon",
|
|
2750
2800
|
class: normalizeClass(leadingIconClass.value)
|
|
2751
|
-
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
2801
|
+
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
2752
2802
|
key: 0,
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2803
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
2804
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
2805
|
+
"aria-hidden": "true",
|
|
2806
|
+
focusable: "false"
|
|
2807
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$13)) : createCommentVNode("", true),
|
|
2756
2808
|
createElementVNode("input", mergeProps({
|
|
2757
2809
|
ref_key: "controlRef",
|
|
2758
2810
|
ref: controlRef
|
|
2759
|
-
},
|
|
2811
|
+
}, {
|
|
2812
|
+
..._ctx.$attrs,
|
|
2813
|
+
class: void 0
|
|
2814
|
+
}, {
|
|
2760
2815
|
"data-part": "control",
|
|
2761
2816
|
class: controlClass.value,
|
|
2762
2817
|
id: unref(controlId),
|
|
@@ -2800,7 +2855,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2800
2855
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
|
|
2801
2856
|
onClick: onClear
|
|
2802
2857
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
2803
|
-
class: "size-4.5",
|
|
2858
|
+
class: "eldra:size-4.5",
|
|
2804
2859
|
viewBox: "0 0 24 24",
|
|
2805
2860
|
fill: "none",
|
|
2806
2861
|
stroke: "currentColor",
|
|
@@ -2824,7 +2879,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2824
2879
|
onPointerdown: onDragPointerDown,
|
|
2825
2880
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent", "stop"]))
|
|
2826
2881
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
2827
|
-
class: "size-4.5",
|
|
2882
|
+
class: "eldra:size-4.5",
|
|
2828
2883
|
viewBox: "0 0 24 24",
|
|
2829
2884
|
fill: "none",
|
|
2830
2885
|
stroke: "currentColor",
|
|
@@ -3120,6 +3175,7 @@ var _hoisted_4$11 = [
|
|
|
3120
3175
|
];
|
|
3121
3176
|
var _hoisted_5$9 = ["data-eldra-slot"];
|
|
3122
3177
|
var _hoisted_6$7 = ["data-eldra-scope", "aria-label"];
|
|
3178
|
+
var rootClass$5 = "eldra:relative eldra:block eldra:w-full";
|
|
3123
3179
|
// src/components/input/Input.vue
|
|
3124
3180
|
var Input_default = /* @__PURE__ */ defineComponent({
|
|
3125
3181
|
inheritAttrs: false,
|
|
@@ -3235,15 +3291,29 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3235
3291
|
* disabled field is out of the conversation, so it keeps its dead grey boundary and drops the
|
|
3236
3292
|
* danger one (`aria-invalid` stays: the field is still invalid, it just cannot be fixed here). A
|
|
3237
3293
|
* read-only field keeps it — the value is shown, cannot be edited in place, and is still wrong.
|
|
3238
|
-
* The
|
|
3239
|
-
* the spec's 2px boundary
|
|
3294
|
+
* The border colour and `eldra-field-invalid` (the outline beside it) both read it, so the 1px
|
|
3295
|
+
* border and the 1px line that make up the spec's 2px boundary never appear one without the other.
|
|
3240
3296
|
*/
|
|
3241
3297
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3298
|
+
const controlClass = computed(() => [
|
|
3299
|
+
FIELD_BASE,
|
|
3300
|
+
FIELD_SIZE[props.size],
|
|
3301
|
+
hasLeading.value && "eldra:ps-9",
|
|
3302
|
+
hasPrefix.value && FIELD_PREFIX_PAD[props.size],
|
|
3303
|
+
hasTrailing.value && FIELD_TRAILING_PAD[props.size],
|
|
3304
|
+
props.type === "number" && "eldra:tabular-nums",
|
|
3305
|
+
props.type === "search" && "eldra:[&::-webkit-search-cancel-button]:appearance-none eldra:[&::-webkit-search-decoration]:appearance-none",
|
|
3306
|
+
fieldState({
|
|
3307
|
+
disabled: props.disabled,
|
|
3308
|
+
readonly: props.readonly,
|
|
3309
|
+
invalid: showsInvalid.value
|
|
3310
|
+
}),
|
|
3311
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
3312
|
+
props.classes?.control
|
|
3313
|
+
]);
|
|
3314
|
+
const leadingIconClass = computed(() => [FIELD_LEADING_ICON, props.classes?.leadingIcon]);
|
|
3315
|
+
const suffixClass = computed(() => [FIELD_SUFFIX_ROW, props.classes?.suffix]);
|
|
3316
|
+
const prefixClass = computed(() => [FIELD_PREFIX_ROW, props.classes?.prefix]);
|
|
3247
3317
|
/**
|
|
3248
3318
|
* A prefix or suffix row wider than one action pushes the text clear of it (see
|
|
3249
3319
|
* `useAdornmentRoom`); with no row or one action the padding classes above stand alone.
|
|
@@ -3256,7 +3326,11 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3256
3326
|
paddingInlineStart: prefixRoom.value,
|
|
3257
3327
|
paddingInlineEnd: suffixRoom.value
|
|
3258
3328
|
});
|
|
3259
|
-
const clearButtonClass = computed(() =>
|
|
3329
|
+
const clearButtonClass = computed(() => [
|
|
3330
|
+
FIELD_CLEAR_BUTTON,
|
|
3331
|
+
FIELD_CLEAR_SIZE[props.size],
|
|
3332
|
+
props.classes?.clearButton
|
|
3333
|
+
]);
|
|
3260
3334
|
/** The types whose selection API a browser actually implements; `number` and `email` throw. */
|
|
3261
3335
|
const SELECTABLE_TYPES = /* @__PURE__ */ new Set([
|
|
3262
3336
|
"text",
|
|
@@ -3304,7 +3378,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3304
3378
|
"data-eldra-ui": "",
|
|
3305
3379
|
"data-eldra-scope": unref(eldra).scope,
|
|
3306
3380
|
"data-part": "root",
|
|
3307
|
-
class: normalizeClass(rootClass.
|
|
3381
|
+
class: normalizeClass([rootClass$5, _ctx.$attrs.class])
|
|
3308
3382
|
}, [
|
|
3309
3383
|
hasPrefix.value ? (openBlock(), createElementBlock("span", {
|
|
3310
3384
|
key: 0,
|
|
@@ -3318,15 +3392,20 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3318
3392
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
3319
3393
|
"data-part": "leadingIcon",
|
|
3320
3394
|
class: normalizeClass(leadingIconClass.value)
|
|
3321
|
-
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
3395
|
+
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
3322
3396
|
key: 0,
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3397
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
3398
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
3399
|
+
"aria-hidden": "true",
|
|
3400
|
+
focusable: "false"
|
|
3401
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$12)) : createCommentVNode("", true),
|
|
3326
3402
|
createElementVNode("input", mergeProps({
|
|
3327
3403
|
ref_key: "controlRef",
|
|
3328
3404
|
ref: controlRef
|
|
3329
|
-
},
|
|
3405
|
+
}, {
|
|
3406
|
+
..._ctx.$attrs,
|
|
3407
|
+
class: void 0
|
|
3408
|
+
}, {
|
|
3330
3409
|
"data-part": "control",
|
|
3331
3410
|
class: controlClass.value,
|
|
3332
3411
|
style: controlStyle.value,
|
|
@@ -3365,7 +3444,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3365
3444
|
"aria-label": unref(m).clear,
|
|
3366
3445
|
onClick: onClear
|
|
3367
3446
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
3368
|
-
class: "size-4.5",
|
|
3447
|
+
class: "eldra:size-4.5",
|
|
3369
3448
|
viewBox: "0 0 24 24",
|
|
3370
3449
|
fill: "none",
|
|
3371
3450
|
stroke: "currentColor",
|
|
@@ -3484,19 +3563,19 @@ var _hoisted_7$4 = [
|
|
|
3484
3563
|
"checked",
|
|
3485
3564
|
"disabled"
|
|
3486
3565
|
];
|
|
3487
|
-
var ROOT = "group grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-0.5 w-fit max-w-full target-min rounded-sm border-0 bg-transparent p-0 text-start eldra-focus";
|
|
3488
|
-
var TRACK_BASE = "relative inline-flex shrink-0 rounded-[var(--eldra-switch-radius,var(--eldra-radius-full))] eldra-switch-track-border transition-colors duration-fast ease-out motion-reduce:transition-none";
|
|
3489
|
-
var TRACK_OFF = "bg-background border-border-strong group-hover:border-text";
|
|
3490
|
-
var TRACK_ON = "bg-primary border-primary group-hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]";
|
|
3491
|
-
var TRACK_DISABLED_OFF = "bg-surface-strong border-border-strong border-dashed";
|
|
3492
|
-
var TRACK_DISABLED_ON = "bg-muted border-muted";
|
|
3493
|
-
var THUMB_BASE = "absolute top-1/2
|
|
3494
|
-
var THUMB_OFF = "bg-border-strong";
|
|
3495
|
-
var THUMB_ON = "bg-primary-contrast text-primary";
|
|
3566
|
+
var ROOT$1 = "eldra:group eldra:grid eldra:grid-cols-[auto_1fr] eldra:items-center eldra:gap-x-3 eldra:gap-y-0.5 eldra:w-fit eldra:max-w-full eldra:target-min eldra:rounded-sm eldra:border-0 eldra:bg-transparent eldra:p-0 eldra:text-start eldra:eldra-focus";
|
|
3567
|
+
var TRACK_BASE = "eldra:relative eldra:inline-flex eldra:shrink-0 eldra:rounded-[var(--eldra-switch-radius,var(--eldra-radius-full))] eldra:eldra-switch-track-border eldra:transition-colors eldra:duration-fast eldra:ease-out eldra:motion-reduce:transition-none";
|
|
3568
|
+
var TRACK_OFF = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text";
|
|
3569
|
+
var TRACK_ON = "eldra:bg-primary eldra:border-primary eldra:group-hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]";
|
|
3570
|
+
var TRACK_DISABLED_OFF = "eldra:bg-surface-strong eldra:border-border-strong eldra:border-dashed";
|
|
3571
|
+
var TRACK_DISABLED_ON = "eldra:bg-muted eldra:border-muted";
|
|
3572
|
+
var THUMB_BASE = "eldra:absolute eldra:top-1/2 eldra:-translate-y-1/2 eldra:inline-flex eldra:items-center eldra:justify-center eldra:rounded-[var(--eldra-switch-radius,var(--eldra-radius-full))] eldra:eldra-switch-thumb-offset eldra:transition-[translate] eldra:duration-fast eldra:ease-out eldra:motion-reduce:transition-none";
|
|
3573
|
+
var THUMB_OFF = "eldra:bg-border-strong";
|
|
3574
|
+
var THUMB_ON = "eldra:bg-primary-contrast eldra:text-primary";
|
|
3496
3575
|
/** Ink for `thumb` slot content on the off thumb, which has no text colour of its own: `background`
|
|
3497
3576
|
* on `border-strong` is the spec's own 4.5:1 pair. Only added when the slot is filled. */
|
|
3498
|
-
var THUMB_OFF_INK = "text-background";
|
|
3499
|
-
var TRACK_SLOT_BASE = "pointer-events-none absolute top-1/2
|
|
3577
|
+
var THUMB_OFF_INK = "eldra:text-background";
|
|
3578
|
+
var TRACK_SLOT_BASE = "eldra:pointer-events-none eldra:absolute eldra:top-1/2 eldra:-translate-y-1/2 eldra:inline-flex eldra:items-center eldra:justify-center eldra:eldra-switch-thumb-offset";
|
|
3500
3579
|
// src/components/switch/Switch.vue
|
|
3501
3580
|
var Switch_default = /* @__PURE__ */ defineComponent({
|
|
3502
3581
|
inheritAttrs: false,
|
|
@@ -3568,7 +3647,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3568
3647
|
if (!hasError.value) return content;
|
|
3569
3648
|
return [...content, h(FieldError_default, {
|
|
3570
3649
|
id: errorId.value,
|
|
3571
|
-
rowClass: "mt-1",
|
|
3650
|
+
rowClass: "eldra:mt-1",
|
|
3572
3651
|
classes: props.classes
|
|
3573
3652
|
}, () => props.error)];
|
|
3574
3653
|
};
|
|
@@ -3596,7 +3675,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3596
3675
|
* element's transition list. See `src/styles/tailwind.css` and
|
|
3597
3676
|
* `src/__tests__/focus-transition.spec.ts`.
|
|
3598
3677
|
*/
|
|
3599
|
-
const rootClass = computed(() =>
|
|
3678
|
+
const rootClass = computed(() => [ROOT$1, props.disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer"]);
|
|
3600
3679
|
/**
|
|
3601
3680
|
* The track (spec "Switch" → Anatomy: "a pill with a 1.5px border"; → Sizes: 2.75 × 1.5rem at
|
|
3602
3681
|
* `md`, 2.25 × 1.25rem at `sm`, both `radius-full`). `--spacing` is 0.25rem, so every dimension
|
|
@@ -3608,15 +3687,19 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3608
3687
|
* — exactly like the thumb below, and Link's arrow — it may carry its own transition.
|
|
3609
3688
|
*/
|
|
3610
3689
|
const TRACK_SIZE = {
|
|
3611
|
-
md: "w-11 h-6",
|
|
3612
|
-
sm: "w-9 h-5"
|
|
3690
|
+
md: "eldra:w-11 eldra:h-6",
|
|
3691
|
+
sm: "eldra:w-9 eldra:h-5"
|
|
3613
3692
|
};
|
|
3614
3693
|
/** Spec "Switch" → States. Only `:hover` (nothing here can express it in JavaScript) is a variant. */
|
|
3615
3694
|
const trackState = computed(() => {
|
|
3616
3695
|
if (props.disabled) return model.value ? TRACK_DISABLED_ON : TRACK_DISABLED_OFF;
|
|
3617
3696
|
return model.value ? TRACK_ON : TRACK_OFF;
|
|
3618
3697
|
});
|
|
3619
|
-
const trackClass = computed(() =>
|
|
3698
|
+
const trackClass = computed(() => [[
|
|
3699
|
+
TRACK_BASE,
|
|
3700
|
+
TRACK_SIZE[props.size],
|
|
3701
|
+
trackState.value
|
|
3702
|
+
], props.classes?.track]);
|
|
3620
3703
|
/**
|
|
3621
3704
|
* The thumb (spec "Switch" → Anatomy: "a circle, with a check icon when on"; → Sizes: 1rem at
|
|
3622
3705
|
* `md`, 0.75rem at `sm`, resting 0.1875rem from the track's start edge, travelling 1.25rem/1rem to
|
|
@@ -3628,15 +3711,19 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3628
3711
|
* it may carry its own transition, exactly as Link's arrow does.
|
|
3629
3712
|
*/
|
|
3630
3713
|
const THUMB_SIZE = {
|
|
3631
|
-
md: "size-4",
|
|
3632
|
-
sm: "size-3"
|
|
3714
|
+
md: "eldra:size-4",
|
|
3715
|
+
sm: "eldra:size-3"
|
|
3633
3716
|
};
|
|
3634
3717
|
const THUMB_TRAVEL = {
|
|
3635
|
-
md: "translate-x-5",
|
|
3636
|
-
sm: "translate-x-4"
|
|
3718
|
+
md: "eldra:translate-x-5",
|
|
3719
|
+
sm: "eldra:translate-x-4"
|
|
3637
3720
|
};
|
|
3638
3721
|
/** Fill only changes with on/off, not with disabled (spec's States table repeats it unchanged). */
|
|
3639
|
-
const thumbClass = computed(() =>
|
|
3722
|
+
const thumbClass = computed(() => [[
|
|
3723
|
+
THUMB_BASE,
|
|
3724
|
+
THUMB_SIZE[props.size],
|
|
3725
|
+
model.value ? [THUMB_ON, THUMB_TRAVEL[props.size]] : [THUMB_OFF, slots.thumb !== void 0 && THUMB_OFF_INK]
|
|
3726
|
+
], props.classes?.thumb]);
|
|
3640
3727
|
const slotProps = computed(() => ({
|
|
3641
3728
|
checked: model.value,
|
|
3642
3729
|
disabled: props.disabled
|
|
@@ -3648,25 +3735,34 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3648
3735
|
* track `primary-contrast`; off, and on a disabled track, `muted`.
|
|
3649
3736
|
*/
|
|
3650
3737
|
function trackSlotClass(end, part) {
|
|
3651
|
-
return
|
|
3738
|
+
return [[
|
|
3739
|
+
TRACK_SLOT_BASE,
|
|
3740
|
+
THUMB_SIZE[props.size],
|
|
3741
|
+
end && THUMB_TRAVEL[props.size],
|
|
3742
|
+
model.value && !props.disabled ? "eldra:text-primary-contrast" : "eldra:text-muted"
|
|
3743
|
+
], props.classes?.[part]];
|
|
3652
3744
|
}
|
|
3653
3745
|
const trackStartClass = computed(() => trackSlotClass(false, "trackStart"));
|
|
3654
3746
|
const trackEndClass = computed(() => trackSlotClass(true, "trackEnd"));
|
|
3655
3747
|
/** Spec "Switch" → Sizes: check icon 0.75rem/3px stroke at `md`, 0.625rem at `sm`. */
|
|
3656
3748
|
const CHECK_SIZE = {
|
|
3657
|
-
md: "size-3",
|
|
3658
|
-
sm: "size-2.5"
|
|
3749
|
+
md: "eldra:size-3",
|
|
3750
|
+
sm: "eldra:size-2.5"
|
|
3659
3751
|
};
|
|
3660
|
-
const checkClass = computed(() =>
|
|
3752
|
+
const checkClass = computed(() => ["eldra:pointer-events-none", CHECK_SIZE[props.size]]);
|
|
3661
3753
|
/**
|
|
3662
3754
|
* The label (spec "Switch" → Sizes: "Label | 1rem" at `md`, "0.875rem / 1.5" at `sm` — the second
|
|
3663
3755
|
* number matches `text-body-sm` exactly, so `sm` reuses it rather than a near-identical utility).
|
|
3664
3756
|
*/
|
|
3665
3757
|
const LABEL_SIZE = {
|
|
3666
|
-
md: "text-switch-label",
|
|
3667
|
-
sm: "text-body-sm"
|
|
3758
|
+
md: "eldra:text-switch-label",
|
|
3759
|
+
sm: "eldra:text-body-sm"
|
|
3668
3760
|
};
|
|
3669
|
-
const labelClass = computed(() =>
|
|
3761
|
+
const labelClass = computed(() => [[
|
|
3762
|
+
LABEL_SIZE[props.size],
|
|
3763
|
+
"eldra:col-start-2 eldra:min-w-0",
|
|
3764
|
+
props.disabled ? "eldra:text-muted" : "eldra:text-text"
|
|
3765
|
+
], props.classes?.label]);
|
|
3670
3766
|
/**
|
|
3671
3767
|
* The description (spec "Switch" → Anatomy: "a `muted` second line"; → Accessibility: "The
|
|
3672
3768
|
* description is referenced by `aria-describedby`."). It sits in the grid's second row, `col-
|
|
@@ -3678,7 +3774,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3678
3774
|
* *description*; browsers read an `aria-describedby` target's text regardless of `aria-hidden` on
|
|
3679
3775
|
* that target, which is the standard technique for a description that must not double as the name.
|
|
3680
3776
|
*/
|
|
3681
|
-
const descriptionClass = computed(() =>
|
|
3777
|
+
const descriptionClass = computed(() => ["eldra:text-switch-description eldra:text-muted eldra:col-start-2", props.classes?.description]);
|
|
3682
3778
|
return (_ctx, _cache) => {
|
|
3683
3779
|
return openBlock(), createBlock(WithError, null, {
|
|
3684
3780
|
default: withCtx(() => [createElementVNode("button", mergeProps({
|
|
@@ -3721,7 +3817,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3721
3817
|
key: 0,
|
|
3722
3818
|
"data-eldra-slot": unref(eldra).slotHost("thumb"),
|
|
3723
3819
|
"aria-hidden": "true",
|
|
3724
|
-
class: "pointer-events-none inline-flex"
|
|
3820
|
+
class: "eldra:pointer-events-none eldra:inline-flex"
|
|
3725
3821
|
}, [renderSlot(_ctx.$slots, "thumb", normalizeProps(guardReactiveProps(slotProps.value)))], 8, _hoisted_4$10)) : unref(model) ? (openBlock(), createElementBlock("svg", {
|
|
3726
3822
|
key: 1,
|
|
3727
3823
|
class: normalizeClass(checkClass.value),
|
|
@@ -3800,14 +3896,14 @@ var _hoisted_1$10 = [
|
|
|
3800
3896
|
var _hoisted_2$10 = ["data-eldra-slot"];
|
|
3801
3897
|
var _hoisted_3$10 = ["data-eldra-slot"];
|
|
3802
3898
|
var _hoisted_4$9 = ["data-eldra-slot"];
|
|
3803
|
-
var ROOT_BASE$1 = "
|
|
3899
|
+
var ROOT_BASE$1 = "eldra:@container eldra:w-full";
|
|
3804
3900
|
/**
|
|
3805
3901
|
* Spec "Form layout" → Anatomy: "form (grid, 1rem row gap)". The inline form is the one exception:
|
|
3806
3902
|
* a wrapping flex row that keeps the field and the button on one line until there is no room
|
|
3807
3903
|
* ("inline form (flex, wraps, bottom-aligned)", 0.5rem gap).
|
|
3808
3904
|
*/
|
|
3809
|
-
var ACTIONS_BASE = "flex flex-wrap items-center
|
|
3810
|
-
var ACTIONS_STACKED = "
|
|
3905
|
+
var ACTIONS_BASE = "eldra:flex eldra:flex-wrap eldra:items-center eldra:[&>a:first-child]:me-auto";
|
|
3906
|
+
var ACTIONS_STACKED = "eldra:@max-two-col:flex-col-reverse eldra:@max-two-col:items-stretch eldra:@max-two-col:gap-2 eldra:@max-two-col:*:w-full";
|
|
3811
3907
|
// src/components/form-layout/FormLayout.vue
|
|
3812
3908
|
var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
3813
3909
|
__name: "FormLayout",
|
|
@@ -3872,9 +3968,9 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3872
3968
|
* this container for that purpose any more.
|
|
3873
3969
|
*/
|
|
3874
3970
|
const ROOT = {
|
|
3875
|
-
single: "grid gap-4",
|
|
3876
|
-
two: "grid gap-4",
|
|
3877
|
-
inline: "flex flex-wrap items-end gap-x-2 gap-y-1"
|
|
3971
|
+
single: "eldra:grid eldra:gap-4",
|
|
3972
|
+
two: "eldra:grid eldra:gap-4",
|
|
3973
|
+
inline: "eldra:flex eldra:flex-wrap eldra:items-end eldra:gap-x-2 eldra:gap-y-1"
|
|
3878
3974
|
};
|
|
3879
3975
|
/**
|
|
3880
3976
|
* Spec "Form layout" → Variants, Two-column: "pairs sit side by side from a 36rem container …
|
|
@@ -3887,9 +3983,9 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3887
3983
|
* row.
|
|
3888
3984
|
*/
|
|
3889
3985
|
const FIELDS = {
|
|
3890
|
-
single: "grid gap-4",
|
|
3891
|
-
two: "grid gap-4
|
|
3892
|
-
inline: "contents"
|
|
3986
|
+
single: "eldra:grid eldra:gap-4",
|
|
3987
|
+
two: "eldra:grid eldra:gap-4 eldra:@two-col:grid-cols-2",
|
|
3988
|
+
inline: "eldra:contents"
|
|
3893
3989
|
};
|
|
3894
3990
|
/**
|
|
3895
3991
|
* Spec "Form layout" → Sizes and Variants, Actions row: "0.75rem gap, wraps, items centred,
|
|
@@ -3908,11 +4004,11 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3908
4004
|
* the row so a caller does not have to set it per button for one breakpoint.
|
|
3909
4005
|
*/
|
|
3910
4006
|
const ACTIONS = {
|
|
3911
|
-
single: `justify-end pt-1 ${ACTIONS_STACKED}`,
|
|
3912
|
-
two: `justify-end pt-1 ${ACTIONS_STACKED}`,
|
|
3913
|
-
inline: "shrink-0 gap-2"
|
|
4007
|
+
single: `eldra:gap-3 eldra:justify-end eldra:pt-1 ${ACTIONS_STACKED}`,
|
|
4008
|
+
two: `eldra:gap-3 eldra:justify-end eldra:pt-1 ${ACTIONS_STACKED}`,
|
|
4009
|
+
inline: "eldra:shrink-0 eldra:gap-2"
|
|
3914
4010
|
};
|
|
3915
|
-
const rootClass = computed(() =>
|
|
4011
|
+
const rootClass = computed(() => [ROOT_BASE$1, ROOT[props.layout]]);
|
|
3916
4012
|
/**
|
|
3917
4013
|
* Spec "Form layout" → Anatomy: "Heading (optional): h4 style (1.125rem, 600)". `h4` names the
|
|
3918
4014
|
* type style, not the outline level — `headingLevel` picks the element, defaulting to the `<h2>` a
|
|
@@ -3920,18 +4016,18 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3920
4016
|
* the field and the button.
|
|
3921
4017
|
*/
|
|
3922
4018
|
const headingTag = useHeadingTag(() => props.headingLevel);
|
|
3923
|
-
const headingClass = computed(() =>
|
|
4019
|
+
const headingClass = computed(() => [["eldra:text-h4 eldra:text-text", props.layout === "inline" && "eldra:basis-full"], props.classes?.heading]);
|
|
3924
4020
|
/**
|
|
3925
4021
|
* Spec "Form layout" → States, Invalid on submit: "Long forms add an error summary alert at the
|
|
3926
4022
|
* top (`surface` fill, 1px `danger` border, `danger` icon) that lists a link to each error." The
|
|
3927
4023
|
* component draws the box and the icon; the slot supplies the list, because only the caller knows
|
|
3928
4024
|
* which fields failed and what to link to.
|
|
3929
4025
|
*/
|
|
3930
|
-
const errorSummaryClass = computed(() =>
|
|
3931
|
-
const fieldsClass = computed(() =>
|
|
3932
|
-
const actionsClass = computed(() =>
|
|
4026
|
+
const errorSummaryClass = computed(() => ["eldra:text-body-sm eldra:text-text eldra:border-danger eldra:bg-surface eldra:flex eldra:items-start eldra:gap-2 eldra:rounded-[var(--eldra-form-summary-radius,var(--eldra-radius-md))] eldra:border eldra:p-3", props.classes?.errorSummary]);
|
|
4027
|
+
const fieldsClass = computed(() => [FIELDS[props.layout], props.classes?.fields]);
|
|
4028
|
+
const actionsClass = computed(() => [[ACTIONS_BASE, ACTIONS[props.layout]], props.classes?.actions]);
|
|
3933
4029
|
/** Never visible; `classes.status` is here so a consumer can unhide it while debugging. */
|
|
3934
|
-
const statusClass = computed(() =>
|
|
4030
|
+
const statusClass = computed(() => props.classes?.status);
|
|
3935
4031
|
/**
|
|
3936
4032
|
* Spec "Form layout" → Events and States, Invalid on submit.
|
|
3937
4033
|
*
|
|
@@ -3989,7 +4085,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3989
4085
|
class: normalizeClass(errorSummaryClass.value),
|
|
3990
4086
|
role: "alert"
|
|
3991
4087
|
}, [_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
3992
|
-
class: "text-danger mt-0.5 size-5 shrink-0",
|
|
4088
|
+
class: "eldra:text-danger eldra:mt-0.5 eldra:size-5 eldra:shrink-0",
|
|
3993
4089
|
viewBox: "0 0 24 24",
|
|
3994
4090
|
fill: "none",
|
|
3995
4091
|
stroke: "currentColor",
|
|
@@ -4004,7 +4100,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4004
4100
|
createElementVNode("path", { d: "M12 16h.01" })
|
|
4005
4101
|
], -1)), createElementVNode("div", {
|
|
4006
4102
|
"data-eldra-slot": unref(eldra).slotHost("errorSummary"),
|
|
4007
|
-
class: "min-w-0"
|
|
4103
|
+
class: "eldra:min-w-0"
|
|
4008
4104
|
}, [renderSlot(_ctx.$slots, "errorSummary")], 8, _hoisted_2$10)], 2)) : createCommentVNode("", true),
|
|
4009
4105
|
createElementVNode("div", {
|
|
4010
4106
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
@@ -4022,11 +4118,11 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4022
4118
|
"data-part": "status",
|
|
4023
4119
|
role: "status",
|
|
4024
4120
|
"aria-live": "polite",
|
|
4025
|
-
|
|
4121
|
+
class: normalizeClass(statusClass.value)
|
|
4026
4122
|
}, {
|
|
4027
4123
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.statusMessage), 1)]),
|
|
4028
4124
|
_: 1
|
|
4029
|
-
}, 8, ["
|
|
4125
|
+
}, 8, ["class"])
|
|
4030
4126
|
], 42, _hoisted_1$10);
|
|
4031
4127
|
};
|
|
4032
4128
|
}
|
|
@@ -4038,8 +4134,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4038
4134
|
* (which renders the panel) and a trigger (which reuses an option's swatch and icon for the chosen
|
|
4039
4135
|
* option's mark) can call them.
|
|
4040
4136
|
*
|
|
4041
|
-
* Each
|
|
4042
|
-
* `tailwind-merge` rather than landing beside it.
|
|
4137
|
+
* Each returns a Vue class value with the consumer's per-part classes appended last.
|
|
4043
4138
|
*/
|
|
4044
4139
|
/**
|
|
4045
4140
|
* The popover (spec "Select" → Sizes, Popover row). Not a dialog: it is a non-modal popup
|
|
@@ -4059,24 +4154,49 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4059
4154
|
* (or on the teleport target), which is what the README's Customisation section already asks for.
|
|
4060
4155
|
*/
|
|
4061
4156
|
function panelClass(classes) {
|
|
4062
|
-
return
|
|
4157
|
+
return [
|
|
4158
|
+
"eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-hidden",
|
|
4159
|
+
"eldra:eldra-select-panel-height eldra:eldra-select-panel-width",
|
|
4160
|
+
"eldra:rounded-md eldra:border eldra:shadow-md",
|
|
4161
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
4162
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
4163
|
+
"eldra:text-[color:var(--eldra-select-panel-text)]",
|
|
4164
|
+
"eldra:animate-eldra-popover-in",
|
|
4165
|
+
classes?.panel
|
|
4166
|
+
];
|
|
4063
4167
|
}
|
|
4064
4168
|
/**
|
|
4065
4169
|
* Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem. No focus ring (a README
|
|
4066
4170
|
* Deviation): focus sits here whenever the panel is open, so the caret and the active row show it.
|
|
4067
4171
|
*/
|
|
4068
4172
|
function searchClass(classes) {
|
|
4069
|
-
return
|
|
4173
|
+
return [
|
|
4174
|
+
"eldra:control-h eldra:w-full eldra:min-w-0 eldra:rounded-t-md eldra:bg-transparent eldra:ps-8.5 eldra:pe-3",
|
|
4175
|
+
"eldra:text-control-sm eldra:max-md:text-control-mobile",
|
|
4176
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
4177
|
+
"eldra:placeholder:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4178
|
+
"eldra:outline-none",
|
|
4179
|
+
classes?.search
|
|
4180
|
+
];
|
|
4070
4181
|
}
|
|
4071
4182
|
function listboxClass(classes, hasOptions) {
|
|
4072
|
-
return
|
|
4183
|
+
return [
|
|
4184
|
+
"eldra:overflow-y-auto eldra:overscroll-contain",
|
|
4185
|
+
hasOptions ? "eldra:min-h-0 eldra:flex-1 eldra:p-1" : "eldra:h-0",
|
|
4186
|
+
classes?.listbox
|
|
4187
|
+
];
|
|
4073
4188
|
}
|
|
4074
4189
|
/** Spec: "Every group after the first gets a 1px `border` hairline and 0.25rem gap above it." */
|
|
4075
4190
|
function groupClass(classes, index) {
|
|
4076
|
-
return
|
|
4191
|
+
return [index > 0 && "eldra:mt-1 eldra:border-t eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]", classes?.group];
|
|
4077
4192
|
}
|
|
4078
4193
|
function groupLabelClass(classes, index) {
|
|
4079
|
-
return
|
|
4194
|
+
return [
|
|
4195
|
+
"eldra:text-select-group eldra:px-2 eldra:pb-1",
|
|
4196
|
+
"eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4197
|
+
index > 0 ? "eldra:pt-2.5" : "eldra:pt-2",
|
|
4198
|
+
classes?.groupLabel
|
|
4199
|
+
];
|
|
4080
4200
|
}
|
|
4081
4201
|
/**
|
|
4082
4202
|
* Spec "Select" → Sizes, Option row, and → States for active / selected / disabled.
|
|
@@ -4086,31 +4206,42 @@ function groupLabelClass(classes, index) {
|
|
|
4086
4206
|
* "Multi-select" → States, Option selected).
|
|
4087
4207
|
*/
|
|
4088
4208
|
function optionClass(classes, option, state) {
|
|
4089
|
-
return
|
|
4209
|
+
return [
|
|
4210
|
+
"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",
|
|
4211
|
+
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4212
|
+
state.selected && (state.multiple ? "eldra:font-medium" : "eldra:font-semibold"),
|
|
4213
|
+
state.selected && "eldra:eldra-select-option-selected",
|
|
4214
|
+
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",
|
|
4215
|
+
classes?.option
|
|
4216
|
+
];
|
|
4090
4217
|
}
|
|
4091
4218
|
/** A disabled row reads as disabled through the row's `muted` text and cursor, like `Checkbox`. */
|
|
4092
4219
|
function optionLabelClass(classes) {
|
|
4093
|
-
return
|
|
4220
|
+
return ["eldra:block", classes?.optionLabel];
|
|
4094
4221
|
}
|
|
4095
4222
|
function optionHintClass(classes) {
|
|
4096
|
-
return
|
|
4223
|
+
return ["eldra:text-caption eldra:block eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.optionHint];
|
|
4097
4224
|
}
|
|
4098
4225
|
var META_TONE = {
|
|
4099
|
-
warning: "text-warning font-semibold",
|
|
4100
|
-
danger: "text-danger font-semibold"
|
|
4226
|
+
warning: "eldra:text-warning eldra:font-semibold",
|
|
4227
|
+
danger: "eldra:text-danger eldra:font-semibold"
|
|
4101
4228
|
};
|
|
4102
4229
|
function optionMetaClass(classes, option) {
|
|
4103
|
-
return
|
|
4230
|
+
return [
|
|
4231
|
+
"eldra:ms-3 eldra:shrink-0 eldra:text-caption eldra:tabular-nums",
|
|
4232
|
+
option.metaTone === void 0 ? "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : META_TONE[option.metaTone],
|
|
4233
|
+
classes?.optionMeta
|
|
4234
|
+
];
|
|
4104
4235
|
}
|
|
4105
4236
|
function optionSwatchClass(classes) {
|
|
4106
|
-
return
|
|
4237
|
+
return ["eldra:size-4 eldra:shrink-0 eldra:rounded-full eldra:eldra-select-swatch", classes?.optionSwatch];
|
|
4107
4238
|
}
|
|
4108
4239
|
function optionIconClass(classes) {
|
|
4109
|
-
return
|
|
4240
|
+
return ["eldra:size-4.5 eldra:shrink-0", classes?.optionIcon];
|
|
4110
4241
|
}
|
|
4111
4242
|
/** Spec "Select" → States, Option selected: "check mark in `text` (never colour alone)". */
|
|
4112
4243
|
function optionCheckClass(classes) {
|
|
4113
|
-
return
|
|
4244
|
+
return ["eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-check,var(--eldra-color-text))]", classes?.optionCheck];
|
|
4114
4245
|
}
|
|
4115
4246
|
/**
|
|
4116
4247
|
* A multi-select option's checkbox (spec "Multi-select" → Sizes, "Checkbox in option"): "1rem
|
|
@@ -4123,18 +4254,24 @@ function optionCheckClass(classes) {
|
|
|
4123
4254
|
* restyled these; the radius is the spec's smaller 0.25rem, on its own variable.
|
|
4124
4255
|
*/
|
|
4125
4256
|
function optionBoxClass(classes, state) {
|
|
4126
|
-
return
|
|
4257
|
+
return [
|
|
4258
|
+
"eldra:relative eldra:inline-flex eldra:size-4 eldra:shrink-0 eldra:items-center eldra:justify-center",
|
|
4259
|
+
"eldra:eldra-checkbox-border eldra:eldra-select-check-radius",
|
|
4260
|
+
"eldra:transition-colors eldra:duration-fast eldra:ease-out",
|
|
4261
|
+
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))]",
|
|
4262
|
+
classes?.optionCheck
|
|
4263
|
+
];
|
|
4127
4264
|
}
|
|
4128
4265
|
/** Spec "Select" → Sizes, Empty state: "0.875rem, `muted`, centred, padding 1rem 0.75rem". */
|
|
4129
4266
|
function emptyClass(classes) {
|
|
4130
|
-
return
|
|
4267
|
+
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];
|
|
4131
4268
|
}
|
|
4132
4269
|
/**
|
|
4133
4270
|
* The loading row: the empty state's box, with the shared spinner before its text. It stands in
|
|
4134
4271
|
* for the list and the empty state while a `loading` control's options are being fetched.
|
|
4135
4272
|
*/
|
|
4136
4273
|
function loadingClass(classes) {
|
|
4137
|
-
return
|
|
4274
|
+
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];
|
|
4138
4275
|
}
|
|
4139
4276
|
/**
|
|
4140
4277
|
* The "Create “query”" row of a `creatable` control: an option row's own box and active fill, with
|
|
@@ -4142,7 +4279,12 @@ function loadingClass(classes) {
|
|
|
4142
4279
|
* by `SelectPanel`), so it reads as an action rather than one more match.
|
|
4143
4280
|
*/
|
|
4144
4281
|
function createOptionClass(classes, state) {
|
|
4145
|
-
return
|
|
4282
|
+
return [
|
|
4283
|
+
"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",
|
|
4284
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:cursor-pointer",
|
|
4285
|
+
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4286
|
+
classes?.createOption
|
|
4287
|
+
];
|
|
4146
4288
|
}
|
|
4147
4289
|
/**
|
|
4148
4290
|
* The tick inside that box (spec "Multi-select" → Sizes: "a `primary-contrast` tick (0.25 × 0.5rem,
|
|
@@ -4158,7 +4300,11 @@ function createOptionClass(classes, state) {
|
|
|
4158
4300
|
* `duration-fast` the way `Checkbox`'s does.
|
|
4159
4301
|
*/
|
|
4160
4302
|
function optionTickClass(selected) {
|
|
4161
|
-
return
|
|
4303
|
+
return [
|
|
4304
|
+
"eldra:text-[color:var(--eldra-select-panel-check-contrast,var(--eldra-color-primary-contrast))]",
|
|
4305
|
+
"eldra:pointer-events-none eldra:size-2 eldra:transition-transform eldra:duration-fast eldra:ease-out",
|
|
4306
|
+
selected ? "eldra:scale-100" : "eldra:scale-0"
|
|
4307
|
+
];
|
|
4162
4308
|
}
|
|
4163
4309
|
/**
|
|
4164
4310
|
* The cell a trigger stacks its chosen value in, with an invisible copy of the placeholder
|
|
@@ -4166,9 +4312,9 @@ function optionTickClass(selected) {
|
|
|
4166
4312
|
* least its placeholder's width once a value is chosen, as a native input keeps its width. The copy
|
|
4167
4313
|
* is generated content under `visibility: hidden`, so it adds no text and no accessible name.
|
|
4168
4314
|
*/
|
|
4169
|
-
var TRIGGER_VALUE_STACK = "relative grid min-w-0 flex-1 grid-cols-[minmax(0,1fr)] items-center after:invisible after:col-start-1 after:row-start-1 after:truncate after:content-[attr(data-placeholder)]";
|
|
4315
|
+
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)]";
|
|
4170
4316
|
/** The chosen value inside `TRIGGER_VALUE_STACK`, in the cell the placeholder copy shares. */
|
|
4171
|
-
var TRIGGER_VALUE_CELL = "col-start-1 row-start-1";
|
|
4317
|
+
var TRIGGER_VALUE_CELL = "eldra:col-start-1 eldra:row-start-1";
|
|
4172
4318
|
// src/components/select/SelectPanel.vue?vue&type=script&setup=true&lang.ts
|
|
4173
4319
|
var _hoisted_1$9 = [
|
|
4174
4320
|
"data-eldra-slot",
|
|
@@ -4208,11 +4354,11 @@ var _hoisted_7$3 = [
|
|
|
4208
4354
|
"onMouseenter"
|
|
4209
4355
|
];
|
|
4210
4356
|
var _hoisted_8$3 = ["data-eldra-scope"];
|
|
4211
|
-
var _hoisted_9$3 = { class: "min-w-0 flex-1" };
|
|
4212
|
-
var _hoisted_10$3 = { class: "eldra-select-match" };
|
|
4357
|
+
var _hoisted_9$3 = { class: "eldra:min-w-0 eldra:flex-1" };
|
|
4358
|
+
var _hoisted_10$3 = { class: "eldra:eldra-select-match" };
|
|
4213
4359
|
var _hoisted_11$3 = ["data-eldra-scope"];
|
|
4214
4360
|
var _hoisted_12$3 = ["id"];
|
|
4215
|
-
var _hoisted_13$2 = { class: "min-w-0 flex-1 truncate" };
|
|
4361
|
+
var _hoisted_13$2 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
4216
4362
|
var _hoisted_14$2 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4217
4363
|
var _hoisted_15$1 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4218
4364
|
var SCROLL_END_SLACK = 80;
|
|
@@ -4351,9 +4497,9 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4351
4497
|
__props.searchable ? (openBlock(), createElementBlock("div", {
|
|
4352
4498
|
key: 0,
|
|
4353
4499
|
"data-eldra-scope": unref(eldra).scope,
|
|
4354
|
-
class: "relative shrink-0 border-b border-[color:var(--eldra-select-panel-border,var(--color-border))]"
|
|
4500
|
+
class: "eldra:relative eldra:shrink-0 eldra:border-b eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]"
|
|
4355
4501
|
}, [_cache[3] || (_cache[3] = createElementVNode("svg", {
|
|
4356
|
-
class: "pointer-events-none absolute inset-y-0 start-2.5 my-auto size-4 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]",
|
|
4502
|
+
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))]",
|
|
4357
4503
|
viewBox: "0 0 24 24",
|
|
4358
4504
|
fill: "none",
|
|
4359
4505
|
stroke: "currentColor",
|
|
@@ -4451,12 +4597,19 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4451
4597
|
class: normalizeClass(optionSwatchClasses.value),
|
|
4452
4598
|
style: normalizeStyle({ backgroundColor: option.swatch }),
|
|
4453
4599
|
"aria-hidden": "true"
|
|
4454
|
-
}, null, 6)) : option.icon ? (openBlock(), createBlock(
|
|
4600
|
+
}, null, 6)) : option.icon ? (openBlock(), createBlock(resolveDynamicComponent(option.icon), {
|
|
4455
4601
|
key: 1,
|
|
4602
|
+
"data-eldra-scope": unref(eldra).scope,
|
|
4456
4603
|
"data-part": "optionIcon",
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4604
|
+
class: normalizeClass(optionIconClasses.value),
|
|
4605
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
4606
|
+
"aria-hidden": "true",
|
|
4607
|
+
focusable: "false"
|
|
4608
|
+
}, null, 8, [
|
|
4609
|
+
"data-eldra-scope",
|
|
4610
|
+
"class",
|
|
4611
|
+
"stroke-width"
|
|
4612
|
+
])) : createCommentVNode("", true),
|
|
4460
4613
|
createElementVNode("span", _hoisted_9$3, [createElementVNode("span", {
|
|
4461
4614
|
"data-part": "optionLabel",
|
|
4462
4615
|
class: normalizeClass(unref(optionLabelClass)(__props.classes))
|
|
@@ -4494,7 +4647,7 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4494
4647
|
}), 128)), __props.createOption ? (openBlock(), createElementBlock("div", {
|
|
4495
4648
|
key: 0,
|
|
4496
4649
|
role: "presentation",
|
|
4497
|
-
class: normalizeClass(__props.sections.length > 0 ? "mt-1 border-t border-[color:var(--eldra-select-panel-border,var(--color-border))] pt-1" : void 0)
|
|
4650
|
+
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)
|
|
4498
4651
|
}, [createElementVNode("div", {
|
|
4499
4652
|
id: __props.optionId(__props.createOption.value),
|
|
4500
4653
|
"data-part": "createOption",
|
|
@@ -4521,7 +4674,7 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4521
4674
|
"data-part": "loading",
|
|
4522
4675
|
role: "status",
|
|
4523
4676
|
class: normalizeClass(loadingClasses.value)
|
|
4524
|
-
}, [createVNode(Spinner_default, { class: "size-4" }), renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(__props.loadingText), 1)])], 10, _hoisted_14$2)) : !__props.hasOptions ? (openBlock(), createElementBlock("div", {
|
|
4677
|
+
}, [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", {
|
|
4525
4678
|
key: 2,
|
|
4526
4679
|
"data-eldra-slot": unref(eldra).slotHost("empty"),
|
|
4527
4680
|
"data-eldra-scope": unref(eldra).scope,
|
|
@@ -4542,7 +4695,7 @@ var _hoisted_1$8 = [
|
|
|
4542
4695
|
];
|
|
4543
4696
|
var _hoisted_2$8 = ["data-eldra-slot"];
|
|
4544
4697
|
var _hoisted_3$8 = ["data-eldra-slot"];
|
|
4545
|
-
var _hoisted_4$7 = { class: "min-w-0 truncate" };
|
|
4698
|
+
var _hoisted_4$7 = { class: "eldra:min-w-0 eldra:truncate" };
|
|
4546
4699
|
var _hoisted_5$6 = [
|
|
4547
4700
|
"data-eldra-scope",
|
|
4548
4701
|
"aria-label",
|
|
@@ -4568,29 +4721,52 @@ var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
|
4568
4721
|
const props = __props;
|
|
4569
4722
|
const emit = __emit;
|
|
4570
4723
|
const eldra = useEldraScope();
|
|
4571
|
-
const part = (base, name) => partClass(base, props.classes, name);
|
|
4572
4724
|
/**
|
|
4573
4725
|
* `tagRecipe`'s `TAG_FILL` and `TAG_REMOVE_BUTTON`, with each colour read through a
|
|
4574
4726
|
* `--eldra-select-tag-*` variable that falls back to the token the recipe uses, so a consumer
|
|
4575
4727
|
* recolours these tags without re-theming the `tag` slot's content or `Chip`.
|
|
4576
4728
|
*/
|
|
4577
|
-
const SELECT_TAG_FILL =
|
|
4578
|
-
const SELECT_TAG_REMOVE_BUTTON =
|
|
4729
|
+
const SELECT_TAG_FILL = ["eldra:bg-[color:var(--eldra-select-tag-background,var(--eldra-color-surface-strong))]", "eldra:text-[color:var(--eldra-select-tag-text,var(--eldra-color-text))]"];
|
|
4730
|
+
const SELECT_TAG_REMOVE_BUTTON = [
|
|
4731
|
+
"eldra:inline-flex eldra:size-6 eldra:shrink-0 eldra:cursor-pointer eldra:items-center eldra:justify-center eldra:rounded-full",
|
|
4732
|
+
"eldra:text-[color:var(--eldra-select-tag-muted,var(--eldra-color-muted))]",
|
|
4733
|
+
"eldra:hover:text-[color:var(--eldra-select-tag-text,var(--eldra-color-text))]",
|
|
4734
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-select-tag-text,var(--eldra-color-text)),transparent_89%)]",
|
|
4735
|
+
"eldra:eldra-focus"
|
|
4736
|
+
];
|
|
4579
4737
|
/**
|
|
4580
4738
|
* Spec "Multi-select" → Sizes, Tags: "small chips: min 1.75rem tall, 0.8125rem text, 0.625rem start
|
|
4581
4739
|
* padding, `surface-strong` fill, `radius-full`. … The list wraps with a 0.375rem gap, 0.25rem
|
|
4582
4740
|
* below the control." The chip and its remove button are the same recipe `Chip`'s own `sm` size
|
|
4583
4741
|
* draws — see `src/utils/tagRecipe.ts`.
|
|
4584
4742
|
*/
|
|
4585
|
-
const tagsClass = computed(() =>
|
|
4743
|
+
const tagsClass = computed(() => [props.inside ? "eldra:contents eldra:list-none" : "eldra:mt-1 eldra:flex eldra:list-none eldra:flex-wrap eldra:gap-1.5 eldra:p-0", props.classes?.tags]);
|
|
4586
4744
|
/** The inside list's "+N": a tag's shape and fill, no remove button. */
|
|
4587
|
-
const tagMoreClass = computed(() =>
|
|
4745
|
+
const tagMoreClass = computed(() => [
|
|
4746
|
+
SELECT_TAG_FILL,
|
|
4747
|
+
TAG_SHAPE,
|
|
4748
|
+
tagPadding(false),
|
|
4749
|
+
"eldra:relative eldra:z-1 eldra:select-none",
|
|
4750
|
+
props.classes?.tagMore
|
|
4751
|
+
]);
|
|
4588
4752
|
/** A disabled option's tag is fixed, as its row in the panel is: no remove button, no end inset. */
|
|
4589
|
-
const tagClass = (option) =>
|
|
4753
|
+
const tagClass = (option) => [
|
|
4754
|
+
SELECT_TAG_FILL,
|
|
4755
|
+
TAG_SHAPE,
|
|
4756
|
+
tagPadding(props.removable && !option.disabled),
|
|
4757
|
+
"eldra:min-w-0",
|
|
4758
|
+
props.inside && props.more > 0 ? "eldra:max-w-[calc(100%-3rem)]" : "eldra:max-w-full",
|
|
4759
|
+
props.inside && "eldra:relative eldra:z-1",
|
|
4760
|
+
props.classes?.tag
|
|
4761
|
+
];
|
|
4590
4762
|
/** A `tagItem` slot draws its own chip, so its `<li>` carries no fill, shape or padding. */
|
|
4591
|
-
const tagItemClass = computed(() =>
|
|
4763
|
+
const tagItemClass = computed(() => [
|
|
4764
|
+
"eldra:flex eldra:min-w-0 eldra:max-w-full",
|
|
4765
|
+
props.inside && "eldra:relative eldra:z-1",
|
|
4766
|
+
props.classes?.tag
|
|
4767
|
+
]);
|
|
4592
4768
|
/** "Remove button 1.5rem circle with a 0.875rem icon (hover `text` at 11%)." */
|
|
4593
|
-
const tagRemoveClass = computed(() =>
|
|
4769
|
+
const tagRemoveClass = computed(() => [SELECT_TAG_REMOVE_BUTTON, props.classes?.tagRemove]);
|
|
4594
4770
|
return (_ctx, _cache) => {
|
|
4595
4771
|
return openBlock(), createElementBlock("ul", {
|
|
4596
4772
|
id: __props.id,
|
|
@@ -4631,7 +4807,7 @@ var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
|
4631
4807
|
"aria-label": __props.removeLabel(option.label),
|
|
4632
4808
|
onClick: ($event) => emit("remove", option.value)
|
|
4633
4809
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
4634
|
-
class: "size-3.5",
|
|
4810
|
+
class: "eldra:size-3.5",
|
|
4635
4811
|
viewBox: "0 0 24 24",
|
|
4636
4812
|
fill: "none",
|
|
4637
4813
|
stroke: "currentColor",
|
|
@@ -5818,7 +5994,7 @@ var _hoisted_6$4 = ["data-placeholder"];
|
|
|
5818
5994
|
var _hoisted_7$2 = ["data-eldra-slot"];
|
|
5819
5995
|
var _hoisted_8$2 = {
|
|
5820
5996
|
key: 0,
|
|
5821
|
-
class: "min-w-0 truncate"
|
|
5997
|
+
class: "eldra:min-w-0 eldra:truncate"
|
|
5822
5998
|
};
|
|
5823
5999
|
var _hoisted_9$2 = [
|
|
5824
6000
|
"id",
|
|
@@ -5835,13 +6011,20 @@ var _hoisted_11$2 = [
|
|
|
5835
6011
|
var _hoisted_12$2 = ["label"];
|
|
5836
6012
|
var _hoisted_13$1 = ["value", "disabled"];
|
|
5837
6013
|
var _hoisted_14$1 = ["value", "disabled"];
|
|
5838
|
-
var SUMMARY_MEASURE = "pointer-events-none invisible absolute start-0 top-0 flex items-center gap-2 overflow-hidden";
|
|
5839
|
-
var
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
6014
|
+
var SUMMARY_MEASURE = "eldra:pointer-events-none eldra:invisible eldra:absolute eldra:start-0 eldra:top-0 eldra:flex eldra:items-center eldra:gap-2 eldra:overflow-hidden";
|
|
6015
|
+
var rootClass$4 = "eldra:relative eldra:block eldra:w-full";
|
|
6016
|
+
/**
|
|
6017
|
+
* The trigger box: the same box as `Select`'s, which is the same box as `Input`'s — including
|
|
6018
|
+
* `eldra-focus-open`, which keeps the ring on while the popover is open (see `Select.vue`'s own
|
|
6019
|
+
* comment for why a pointer-opened trigger needs it).
|
|
6020
|
+
*/
|
|
6021
|
+
var TRIGGER_BASE$1 = "eldra:flex eldra:w-full eldra:min-w-0 eldra:items-center eldra:gap-2 eldra:text-start eldra:eldra-field-border eldra:rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra:eldra-focus eldra:eldra-focus-open";
|
|
6022
|
+
var LIVE_FILL$2 = "eldra:bg-background eldra:text-text eldra:cursor-pointer";
|
|
6023
|
+
var REST$1 = "eldra:border-border-strong eldra:hover:border-text";
|
|
6024
|
+
var OPEN$1 = "eldra:border-text eldra:hover:border-text";
|
|
6025
|
+
var INVALID$3 = "eldra:border-danger eldra:hover:border-danger";
|
|
6026
|
+
var DISABLED$3 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
6027
|
+
var READONLY_FILL$2 = "eldra:bg-surface eldra:text-text eldra:cursor-default";
|
|
5845
6028
|
// src/components/select/MultiSelect.vue
|
|
5846
6029
|
var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
5847
6030
|
inheritAttrs: false,
|
|
@@ -6223,24 +6406,29 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6223
6406
|
listbox.activateFrom(void 0);
|
|
6224
6407
|
});
|
|
6225
6408
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
6226
|
-
const part = (base, name) => partClass(base, props.classes, name);
|
|
6227
|
-
const rootClass = computed(() => part(cx("relative block w-full", showsInvalid.value && "eldra-field-invalid"), "root"));
|
|
6228
|
-
/**
|
|
6229
|
-
* The trigger box: the same box as `Select`'s, which is the same box as `Input`'s — including
|
|
6230
|
-
* `eldra-focus-open`, which keeps the ring on while the popover is open (see `Select.vue`'s own
|
|
6231
|
-
* comment for why a pointer-opened trigger needs it).
|
|
6232
|
-
*/
|
|
6233
6409
|
const SIZE = {
|
|
6234
|
-
sm: "control-h-sm ps-2.25 pe-2.5 text-control-sm",
|
|
6235
|
-
md: "control-h ps-2.75 pe-2.5 text-control max-md:text-control-mobile",
|
|
6236
|
-
lg: "control-h-lg ps-2.75 pe-2.5 text-control-lg"
|
|
6410
|
+
sm: "eldra:control-h-sm eldra:ps-2.25 eldra:pe-2.5 eldra:text-control-sm",
|
|
6411
|
+
md: "eldra:control-h eldra:ps-2.75 eldra:pe-2.5 eldra:text-control eldra:max-md:text-control-mobile",
|
|
6412
|
+
lg: "eldra:control-h-lg eldra:ps-2.75 eldra:pe-2.5 eldra:text-control-lg"
|
|
6237
6413
|
};
|
|
6238
6414
|
/**
|
|
6239
6415
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README) replaces
|
|
6240
6416
|
* Tailwind v4 preflight's `button { cursor: default }`; read-only keeps `cursor-default` (it opens
|
|
6241
|
-
* no popover) and disabled keeps `cursor-not-allowed`.
|
|
6242
|
-
|
|
6243
|
-
|
|
6417
|
+
* no popover) and disabled keeps `cursor-not-allowed`. As in `Select`, the fill and the boundary
|
|
6418
|
+
* are picked apart: the error boundary over the open one over the rest one.
|
|
6419
|
+
*/
|
|
6420
|
+
function boxState() {
|
|
6421
|
+
if (props.disabled) return DISABLED$3;
|
|
6422
|
+
if (props.readonly) return `${READONLY_FILL$2} ${showsInvalid.value ? INVALID$3 : "eldra:border-border"}`;
|
|
6423
|
+
return `${LIVE_FILL$2} ${showsInvalid.value ? INVALID$3 : isOpen.value ? OPEN$1 : REST$1}`;
|
|
6424
|
+
}
|
|
6425
|
+
const triggerClass = computed(() => [
|
|
6426
|
+
TRIGGER_BASE$1,
|
|
6427
|
+
SIZE[props.size],
|
|
6428
|
+
boxState(),
|
|
6429
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
6430
|
+
props.classes?.trigger
|
|
6431
|
+
]);
|
|
6244
6432
|
/**
|
|
6245
6433
|
* `tagPlacement: 'inside'`: the field takes the trigger box's border, fill, states and ring (through
|
|
6246
6434
|
* `eldra-focus-proxy`, and while open through the expanded trigger inside it), wraps the tags and
|
|
@@ -6248,40 +6436,84 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6248
6436
|
* control height; the end padding keeps every row clear of the chevron, and of Clear while it shows.
|
|
6249
6437
|
*/
|
|
6250
6438
|
const FIELD_SIZE = {
|
|
6251
|
-
sm: "min-h-(--eldra-control-height-sm) py-px ps-0.75 text-control-sm",
|
|
6252
|
-
md: "min-h-(--eldra-control-height) py-1.25 ps-1.25 text-control max-md:text-control-mobile",
|
|
6253
|
-
lg: "min-h-(--eldra-control-height-lg) py-2.25 ps-2.25 text-control-lg"
|
|
6439
|
+
sm: "eldra:min-h-(--eldra-control-height-sm) eldra:py-px eldra:ps-0.75 eldra:text-control-sm",
|
|
6440
|
+
md: "eldra:min-h-(--eldra-control-height) eldra:py-1.25 eldra:ps-1.25 eldra:text-control eldra:max-md:text-control-mobile",
|
|
6441
|
+
lg: "eldra:min-h-(--eldra-control-height-lg) eldra:py-2.25 eldra:ps-2.25 eldra:text-control-lg"
|
|
6254
6442
|
};
|
|
6255
|
-
const fieldClass = computed(() => inside.value ?
|
|
6443
|
+
const fieldClass = computed(() => inside.value ? [
|
|
6444
|
+
"eldra:relative eldra:isolate eldra:flex eldra:w-full eldra:min-w-0 eldra:flex-wrap eldra:items-center eldra:gap-1.5 eldra:eldra-field-border",
|
|
6445
|
+
"eldra:rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra:eldra-focus eldra:eldra-focus-proxy",
|
|
6446
|
+
"eldra:has-[[aria-expanded=true]]:[--eldra-focus-alpha:1]",
|
|
6447
|
+
FIELD_SIZE[props.size],
|
|
6448
|
+
showClear.value ? "eldra:pe-15" : "eldra:pe-9",
|
|
6449
|
+
boxState(),
|
|
6450
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
6451
|
+
props.classes?.field
|
|
6452
|
+
] : "eldra:relative");
|
|
6256
6453
|
/** Inside, the trigger: under the tags across the field, or the placeholder's row with none. */
|
|
6257
|
-
const insideTriggerClass = computed(() =>
|
|
6454
|
+
const insideTriggerClass = computed(() => [
|
|
6455
|
+
"eldra:flex eldra:items-center eldra:bg-transparent eldra:text-start eldra:outline-none",
|
|
6456
|
+
hasSelection.value ? "eldra:absolute eldra:inset-0 eldra:rounded-[inherit]" : "eldra:min-h-7 eldra:min-w-8 eldra:flex-1 eldra:self-stretch eldra:ps-1.5",
|
|
6457
|
+
props.disabled ? "eldra:cursor-not-allowed" : props.readonly ? "eldra:cursor-default" : "eldra:cursor-pointer",
|
|
6458
|
+
props.classes?.trigger
|
|
6459
|
+
]);
|
|
6258
6460
|
/** The inside field's chevron: out of the flow, at the end, centred however many rows there are. */
|
|
6259
|
-
const insideChevronClass = computed(() =>
|
|
6260
|
-
|
|
6461
|
+
const insideChevronClass = computed(() => [
|
|
6462
|
+
"eldra:pointer-events-none eldra:absolute eldra:end-2.5 eldra:inset-y-0 eldra:my-auto eldra:size-4.5 eldra:text-muted",
|
|
6463
|
+
"eldra:transition-transform eldra:duration-base",
|
|
6464
|
+
isOpen.value && "eldra:rotate-180",
|
|
6465
|
+
props.classes?.chevron
|
|
6466
|
+
]);
|
|
6467
|
+
const leadingIconClass = computed(() => ["eldra:flex eldra:size-4.5 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:text-muted", props.classes?.leadingIcon]);
|
|
6261
6468
|
/** The summary row: the labels, then the "+N" pill. 1.75rem of end padding while Clear shows. */
|
|
6262
|
-
const summaryClass = computed(() =>
|
|
6469
|
+
const summaryClass = computed(() => [
|
|
6470
|
+
"eldra:flex eldra:min-w-0 eldra:flex-1 eldra:items-center eldra:gap-2",
|
|
6471
|
+
TRIGGER_VALUE_CELL,
|
|
6472
|
+
fitsSummary.value && "eldra:contain-inline-size",
|
|
6473
|
+
showClear.value && "eldra:pe-7",
|
|
6474
|
+
props.classes?.summary
|
|
6475
|
+
]);
|
|
6263
6476
|
/** Spec "Multi-select" → Sizes: min width 1.5rem, 1.25rem tall, 0.3125rem side padding. */
|
|
6264
|
-
const summaryMoreClass = computed(() =>
|
|
6265
|
-
const placeholderClass = computed(() =>
|
|
6266
|
-
|
|
6267
|
-
|
|
6477
|
+
const summaryMoreClass = computed(() => ["eldra:bg-surface-strong eldra:text-text eldra:inline-flex eldra:h-5 eldra:min-w-6 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:rounded-full eldra:px-1.25 eldra:text-select-pill", props.classes?.summaryMore]);
|
|
6478
|
+
const placeholderClass = computed(() => [
|
|
6479
|
+
"eldra:min-w-0 eldra:flex-1 eldra:truncate eldra:text-muted",
|
|
6480
|
+
showClear.value && "eldra:pe-7",
|
|
6481
|
+
props.classes?.placeholder
|
|
6482
|
+
]);
|
|
6483
|
+
const chevronClass = computed(() => [
|
|
6484
|
+
"eldra:size-4.5 eldra:shrink-0 eldra:text-muted eldra:transition-transform eldra:duration-base",
|
|
6485
|
+
isOpen.value && "eldra:rotate-180",
|
|
6486
|
+
props.classes?.chevron
|
|
6487
|
+
]);
|
|
6488
|
+
const clearButtonClass = computed(() => [
|
|
6489
|
+
"eldra:absolute eldra:end-8 eldra:inset-y-0 eldra:my-auto eldra:inline-flex eldra:size-6 eldra:cursor-pointer eldra:items-center eldra:justify-center",
|
|
6490
|
+
"eldra:rounded-sm eldra:text-muted eldra:hover:text-text",
|
|
6491
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
6492
|
+
"eldra:eldra-focus",
|
|
6493
|
+
props.classes?.clearButton
|
|
6494
|
+
]);
|
|
6268
6495
|
/**
|
|
6269
6496
|
* Spec "Multi-select" → Sizes, Footer: "padding 0.375rem (0.75rem at the start), 1px `border`
|
|
6270
6497
|
* hairline above, `background`, 0.5rem gap. The count … pushes the buttons to the end. It stays put
|
|
6271
6498
|
* while the list scrolls."
|
|
6272
6499
|
*/
|
|
6273
|
-
const footerClass = computed(() =>
|
|
6274
|
-
|
|
6500
|
+
const footerClass = computed(() => [
|
|
6501
|
+
"eldra:flex eldra:shrink-0 eldra:items-center eldra:gap-2 eldra:border-t eldra:p-1.5 eldra:ps-3",
|
|
6502
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
6503
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
6504
|
+
props.classes?.footer
|
|
6505
|
+
]);
|
|
6506
|
+
const footerCountClass = computed(() => ["eldra:text-caption eldra:me-auto eldra:tabular-nums eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", props.classes?.footerCount]);
|
|
6275
6507
|
/** Spec: "Clear = Button link sm (0.5rem side padding), Done = Button primary sm." */
|
|
6276
|
-
const footerClearClass = computed(() =>
|
|
6277
|
-
const footerDoneClass = computed(() =>
|
|
6508
|
+
const footerClearClass = computed(() => ["eldra:px-2", props.classes?.footerClear]);
|
|
6509
|
+
const footerDoneClass = computed(() => props.classes?.footerDone);
|
|
6278
6510
|
const emptyText = computed(() => query.value.trim() === "" ? m.value.noResults : m.value.noMatchesFor(query.value.trim()));
|
|
6279
6511
|
return (_ctx, _cache) => {
|
|
6280
6512
|
return openBlock(), createElementBlock("div", {
|
|
6281
6513
|
"data-eldra-ui": "",
|
|
6282
6514
|
"data-eldra-scope": unref(eldra).scope,
|
|
6283
6515
|
"data-part": "root",
|
|
6284
|
-
class: normalizeClass(rootClass.
|
|
6516
|
+
class: normalizeClass([rootClass$4, _ctx.$attrs.class])
|
|
6285
6517
|
}, [
|
|
6286
6518
|
createElementVNode("div", {
|
|
6287
6519
|
ref_key: "fieldRef",
|
|
@@ -6299,11 +6531,13 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6299
6531
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
6300
6532
|
options: selectedOptions.value,
|
|
6301
6533
|
open: unref(isOpen)
|
|
6302
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
6534
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
6303
6535
|
key: 0,
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6536
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
6537
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
6538
|
+
"aria-hidden": "true",
|
|
6539
|
+
focusable: "false"
|
|
6540
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$7)) : createCommentVNode("", true),
|
|
6307
6541
|
inside.value && hasSelection.value ? (openBlock(), createBlock(SelectTags_default, {
|
|
6308
6542
|
key: 1,
|
|
6309
6543
|
id: tagsId.value,
|
|
@@ -6341,7 +6575,10 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6341
6575
|
createElementVNode("button", mergeProps({
|
|
6342
6576
|
ref_key: "triggerRef",
|
|
6343
6577
|
ref: triggerRef
|
|
6344
|
-
},
|
|
6578
|
+
}, {
|
|
6579
|
+
..._ctx.$attrs,
|
|
6580
|
+
class: void 0
|
|
6581
|
+
}, {
|
|
6345
6582
|
"data-part": "trigger",
|
|
6346
6583
|
type: "button",
|
|
6347
6584
|
role: "combobox",
|
|
@@ -6370,11 +6607,13 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6370
6607
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
6371
6608
|
options: selectedOptions.value,
|
|
6372
6609
|
open: unref(isOpen)
|
|
6373
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
6610
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
6374
6611
|
key: 0,
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6612
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
6613
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
6614
|
+
"aria-hidden": "true",
|
|
6615
|
+
focusable: "false"
|
|
6616
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_5$5)) : createCommentVNode("", true),
|
|
6378
6617
|
inside.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [!hasSelection.value ? (openBlock(), createElementBlock("span", {
|
|
6379
6618
|
key: 0,
|
|
6380
6619
|
"data-part": "placeholder",
|
|
@@ -6401,7 +6640,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6401
6640
|
}, [createElementVNode("span", {
|
|
6402
6641
|
ref_key: "summaryRunRef",
|
|
6403
6642
|
ref: summaryRunRef,
|
|
6404
|
-
class: "whitespace-nowrap"
|
|
6643
|
+
class: "eldra:whitespace-nowrap"
|
|
6405
6644
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectedOptions.value, (option, index) => {
|
|
6406
6645
|
return openBlock(), createElementBlock("span", {
|
|
6407
6646
|
key: option.value,
|
|
@@ -6422,7 +6661,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6422
6661
|
class: normalizeClass(chevronClass.value),
|
|
6423
6662
|
"aria-hidden": "true"
|
|
6424
6663
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
6425
|
-
class: "size-4.5",
|
|
6664
|
+
class: "eldra:size-4.5",
|
|
6426
6665
|
viewBox: "0 0 24 24",
|
|
6427
6666
|
fill: "none",
|
|
6428
6667
|
stroke: "currentColor",
|
|
@@ -6438,7 +6677,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6438
6677
|
class: normalizeClass(insideChevronClass.value),
|
|
6439
6678
|
"aria-hidden": "true"
|
|
6440
6679
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
6441
|
-
class: "size-4.5",
|
|
6680
|
+
class: "eldra:size-4.5",
|
|
6442
6681
|
viewBox: "0 0 24 24",
|
|
6443
6682
|
fill: "none",
|
|
6444
6683
|
stroke: "currentColor",
|
|
@@ -6458,7 +6697,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6458
6697
|
"data-eldra-overlay-owner": panelId.value,
|
|
6459
6698
|
onClick: onClearClick
|
|
6460
6699
|
}, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
|
|
6461
|
-
class: "size-4",
|
|
6700
|
+
class: "eldra:size-4",
|
|
6462
6701
|
viewBox: "0 0 24 24",
|
|
6463
6702
|
fill: "none",
|
|
6464
6703
|
stroke: "currentColor",
|
|
@@ -6519,23 +6758,23 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6519
6758
|
size: "sm",
|
|
6520
6759
|
type: "button",
|
|
6521
6760
|
"data-part": "footerClear",
|
|
6522
|
-
|
|
6761
|
+
class: normalizeClass(footerClearClass.value),
|
|
6523
6762
|
onClick: onFooterClear
|
|
6524
6763
|
}, {
|
|
6525
6764
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).clear), 1)]),
|
|
6526
6765
|
_: 1
|
|
6527
|
-
}, 8, ["
|
|
6766
|
+
}, 8, ["class"]),
|
|
6528
6767
|
createVNode(Button_default, {
|
|
6529
6768
|
variant: "primary",
|
|
6530
6769
|
size: "sm",
|
|
6531
6770
|
type: "button",
|
|
6532
6771
|
"data-part": "footerDone",
|
|
6533
|
-
|
|
6772
|
+
class: normalizeClass(footerDoneClass.value),
|
|
6534
6773
|
onClick: onDone
|
|
6535
6774
|
}, {
|
|
6536
6775
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).done), 1)]),
|
|
6537
6776
|
_: 1
|
|
6538
|
-
}, 8, ["
|
|
6777
|
+
}, 8, ["class"])
|
|
6539
6778
|
], 10, _hoisted_10$2)]),
|
|
6540
6779
|
_: 2
|
|
6541
6780
|
}, [
|
|
@@ -6676,17 +6915,18 @@ var _hoisted_4$5 = [
|
|
|
6676
6915
|
];
|
|
6677
6916
|
var DEFAULT_MIN = 1;
|
|
6678
6917
|
var DEFAULT_MAX = 99;
|
|
6679
|
-
var ROOT_BASE = "relative inline-flex items-stretch w-fit max-w-full overflow-hidden
|
|
6918
|
+
var ROOT_BASE = "eldra:relative eldra:inline-flex eldra:items-stretch eldra:w-fit eldra:max-w-full eldra:overflow-hidden eldra:rounded-[var(--eldra-stepper-radius,var(--eldra-radius-md))] eldra:eldra-field-border";
|
|
6919
|
+
var ROOT_LIVE = "eldra:bg-background eldra:border-border-strong";
|
|
6680
6920
|
/** Spec "Quantity stepper" → States, "Disabled (sold out)" row, Group column. */
|
|
6681
|
-
var ROOT_DISABLED = "bg-surface-strong border-border border-dashed cursor-not-allowed";
|
|
6682
|
-
var BUTTON_BASE = "relative inline-flex shrink-0 items-center justify-center border-0 bg-transparent eldra-focus-inset";
|
|
6683
|
-
var BUTTON_HOVER = "text-text cursor-pointer hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]";
|
|
6921
|
+
var ROOT_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:cursor-not-allowed";
|
|
6922
|
+
var BUTTON_BASE = "eldra:relative eldra:inline-flex eldra:shrink-0 eldra:items-center eldra:justify-center eldra:border-0 eldra:bg-transparent eldra:eldra-focus-inset";
|
|
6923
|
+
var BUTTON_HOVER = "eldra:text-text eldra:cursor-pointer eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]";
|
|
6684
6924
|
/** Spec States, "At min / at max" row: "icon `muted` at 55% opacity ... no hover fill." */
|
|
6685
|
-
var BUTTON_AT_LIMIT = "text-muted opacity-55 cursor-not-allowed";
|
|
6925
|
+
var BUTTON_AT_LIMIT = "eldra:text-muted eldra:opacity-55 eldra:cursor-not-allowed";
|
|
6686
6926
|
/** Spec States, "Disabled (sold out)" row, Buttons column: "both disabled." */
|
|
6687
|
-
var BUTTON_DISABLED = "text-muted cursor-not-allowed";
|
|
6688
|
-
var INPUT_BASE = "min-w-0 border-0 bg-transparent text-center tabular-nums
|
|
6689
|
-
var INPUT_DISABLED = "text-muted cursor-not-allowed";
|
|
6927
|
+
var BUTTON_DISABLED = "eldra:text-muted eldra:cursor-not-allowed";
|
|
6928
|
+
var INPUT_BASE = "eldra:min-w-0 eldra:border-0 eldra:bg-transparent eldra:text-center eldra:tabular-nums eldra:eldra-focus-inset eldra:eldra-focus-inset-always";
|
|
6929
|
+
var INPUT_DISABLED = "eldra:text-muted eldra:cursor-not-allowed";
|
|
6690
6930
|
// src/components/quantity-stepper/QuantityStepper.vue
|
|
6691
6931
|
var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
6692
6932
|
inheritAttrs: false,
|
|
@@ -6938,7 +7178,7 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6938
7178
|
* own rounded corner clips whatever square background a button paints under it (see
|
|
6939
7179
|
* `select/panelParts.ts`'s own comment for the same technique on the select panel).
|
|
6940
7180
|
*/
|
|
6941
|
-
const rootClass = computed(() =>
|
|
7181
|
+
const rootClass = computed(() => [ROOT_BASE, props.disabled ? ROOT_DISABLED : ROOT_LIVE]);
|
|
6942
7182
|
/**
|
|
6943
7183
|
* Buttons (spec "Quantity stepper" → Sizes): 2.5×2.5rem square at `md`, 2×2rem at `sm` — both
|
|
6944
7184
|
* exact `control-h`/`control-h-sm` squares, the same `aspect-square` shape Button.vue's icon-only
|
|
@@ -6948,8 +7188,8 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6948
7188
|
* neighbour" → draw the ring just inside the edge).
|
|
6949
7189
|
*/
|
|
6950
7190
|
const BUTTON_SIZE = {
|
|
6951
|
-
md: "control-h aspect-square",
|
|
6952
|
-
sm: "control-h-sm aspect-square"
|
|
7191
|
+
md: "eldra:control-h eldra:aspect-square",
|
|
7192
|
+
sm: "eldra:control-h-sm eldra:aspect-square"
|
|
6953
7193
|
};
|
|
6954
7194
|
/**
|
|
6955
7195
|
* Spec States, "Button hover" row: "fill `text` at 6%" — the same mix Button.vue's `ghost`
|
|
@@ -6958,13 +7198,17 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6958
7198
|
* `BUTTON_DISABLED` below already carry `cursor-not-allowed` and replace this state outright.
|
|
6959
7199
|
*/
|
|
6960
7200
|
function buttonClass(atLimit) {
|
|
6961
|
-
return
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
7201
|
+
return [
|
|
7202
|
+
BUTTON_BASE,
|
|
7203
|
+
BUTTON_SIZE[props.size],
|
|
7204
|
+
props.disabled ? BUTTON_DISABLED : atLimit ? BUTTON_AT_LIMIT : BUTTON_HOVER
|
|
7205
|
+
];
|
|
7206
|
+
}
|
|
7207
|
+
const decreaseClass = computed(() => [buttonClass(atMin.value), props.classes?.decrease]);
|
|
7208
|
+
const increaseClass = computed(() => [buttonClass(atMax.value), props.classes?.increase]);
|
|
6965
7209
|
const ICON_SIZE = {
|
|
6966
|
-
md: "size-5",
|
|
6967
|
-
sm: "size-4"
|
|
7210
|
+
md: "eldra:size-5",
|
|
7211
|
+
sm: "eldra:size-4"
|
|
6968
7212
|
};
|
|
6969
7213
|
const iconClass = computed(() => ICON_SIZE[props.size]);
|
|
6970
7214
|
/**
|
|
@@ -6976,18 +7220,23 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6976
7220
|
* per the same "Inset variant" note as the buttons.
|
|
6977
7221
|
*/
|
|
6978
7222
|
const INPUT_SIZE = {
|
|
6979
|
-
md: "w-11 text-stepper-value",
|
|
6980
|
-
sm: "w-9 text-stepper-value-sm"
|
|
7223
|
+
md: "eldra:w-11 eldra:text-stepper-value",
|
|
7224
|
+
sm: "eldra:w-9 eldra:text-stepper-value-sm"
|
|
6981
7225
|
};
|
|
6982
7226
|
/** Spec States, "Disabled (sold out)" row, Input column: "muted." */
|
|
6983
|
-
const inputClass = computed(() =>
|
|
7227
|
+
const inputClass = computed(() => [
|
|
7228
|
+
INPUT_BASE,
|
|
7229
|
+
INPUT_SIZE[props.size],
|
|
7230
|
+
props.disabled ? INPUT_DISABLED : "eldra:text-text",
|
|
7231
|
+
props.classes?.input
|
|
7232
|
+
]);
|
|
6984
7233
|
return (_ctx, _cache) => {
|
|
6985
7234
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
6986
7235
|
createElementVNode("div", {
|
|
6987
7236
|
"data-eldra-ui": "",
|
|
6988
7237
|
"data-eldra-scope": unref(eldra).scope,
|
|
6989
7238
|
"data-part": "root",
|
|
6990
|
-
class: normalizeClass(rootClass.value)
|
|
7239
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
6991
7240
|
}, [
|
|
6992
7241
|
createElementVNode("button", {
|
|
6993
7242
|
type: "button",
|
|
@@ -7008,7 +7257,10 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
7008
7257
|
"aria-hidden": "true",
|
|
7009
7258
|
focusable: "false"
|
|
7010
7259
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M5 12l14 0" }, null, -1)])], 2))], 10, _hoisted_2$6),
|
|
7011
|
-
createElementVNode("input", mergeProps(
|
|
7260
|
+
createElementVNode("input", mergeProps({
|
|
7261
|
+
..._ctx.$attrs,
|
|
7262
|
+
class: void 0
|
|
7263
|
+
}, {
|
|
7012
7264
|
"data-part": "input",
|
|
7013
7265
|
type: "text",
|
|
7014
7266
|
inputmode: "numeric",
|
|
@@ -7082,10 +7334,14 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
7082
7334
|
* row never renders `meta`, so it only ever fills the first two columns; see `Checkbox.vue` for
|
|
7083
7335
|
* the two-column version this is built from.
|
|
7084
7336
|
*/
|
|
7085
|
-
var PLAIN_OPTION = "group grid w-fit max-w-full
|
|
7337
|
+
var PLAIN_OPTION = "eldra:group eldra:grid eldra:w-fit eldra:max-w-full eldra:items-start eldra:gap-y-0.5 eldra:target-min";
|
|
7338
|
+
/** The radio and its text column. */
|
|
7339
|
+
var PLAIN_COLUMNS = "eldra:grid-cols-[auto_1fr] eldra:gap-x-2.5";
|
|
7340
|
+
/** A radio with no label and no hint: the circle alone. */
|
|
7341
|
+
var PLAIN_BOX_ONLY = "eldra:grid-cols-[auto] eldra:gap-x-0";
|
|
7086
7342
|
/** The cursor a row (or card) shows: the whole option is the label, so it is the target. */
|
|
7087
7343
|
function optionCursor(disabled) {
|
|
7088
|
-
return disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
7344
|
+
return disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer";
|
|
7089
7345
|
}
|
|
7090
7346
|
/**
|
|
7091
7347
|
* The drawn radio (spec "Radio group" → Anatomy: "a native `<input type="radio">` with custom
|
|
@@ -7094,36 +7350,40 @@ function optionCursor(disabled) {
|
|
|
7094
7350
|
* (`:has(:focus-visible)`) draw the one focus ring around the shape a keyboard user can see, in
|
|
7095
7351
|
* every layout (spec's Focus-visible row: "standard focus ring around the radio", not the card).
|
|
7096
7352
|
*/
|
|
7097
|
-
var RADIO = "relative inline-flex shrink-0 items-center justify-center rounded-full eldra-focus eldra-focus-proxy";
|
|
7353
|
+
var RADIO = "eldra:relative eldra:inline-flex eldra:shrink-0 eldra:items-center eldra:justify-center eldra:rounded-full eldra:eldra-focus eldra:eldra-focus-proxy";
|
|
7098
7354
|
/**
|
|
7099
7355
|
* Spec "Radio group" → Sizes: "1.125rem circle (1.5rem at lg) … nudged 0.1875rem down at md" —
|
|
7100
7356
|
* the exact same numbers as the Checkbox box, so the same two class strings apply.
|
|
7101
7357
|
*/
|
|
7102
7358
|
var RADIO_SIZE = {
|
|
7103
|
-
md: "size-4.5 mt-0.75",
|
|
7104
|
-
lg: "size-6"
|
|
7359
|
+
md: "eldra:size-4.5 eldra:mt-0.75",
|
|
7360
|
+
lg: "eldra:size-6"
|
|
7105
7361
|
};
|
|
7106
7362
|
/**
|
|
7107
7363
|
* States (spec "Radio group" → States). The checkbox's own `eldra-checkbox-border` /
|
|
7108
7364
|
* `-invalid` utilities are reused unchanged: the spec gives the radio circle the identical 1.5px /
|
|
7109
7365
|
* 2px numbers, so a second pair of utilities for the same numbers would only drift from them.
|
|
7110
7366
|
*/
|
|
7111
|
-
var UNSELECTED = "bg-background border-border-strong group-hover:border-text eldra-checkbox-border";
|
|
7112
|
-
var SELECTED = "bg-primary border-primary eldra-checkbox-border";
|
|
7113
|
-
var INVALID$2 = "bg-background border-danger group-hover:border-danger eldra-checkbox-border-invalid";
|
|
7367
|
+
var UNSELECTED = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text eldra:eldra-checkbox-border";
|
|
7368
|
+
var SELECTED = "eldra:bg-primary eldra:border-primary eldra:eldra-checkbox-border";
|
|
7369
|
+
var INVALID$2 = "eldra:bg-background eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
7114
7370
|
/** Keeps its `primary` fill under an error exactly as `Checkbox`'s invalid-checked box does: the
|
|
7115
7371
|
* dot is `primary-contrast`, so a `background` fill would draw it in the page's own colour. */
|
|
7116
|
-
var INVALID_SELECTED = "bg-primary border-danger eldra-checkbox-border-invalid";
|
|
7117
|
-
var DISABLED$2 = "bg-surface-strong border-border border-dashed eldra-checkbox-border";
|
|
7118
|
-
var DISABLED_SELECTED = "bg-muted border-muted eldra-checkbox-border";
|
|
7372
|
+
var INVALID_SELECTED = "eldra:bg-primary eldra:border-danger eldra:eldra-checkbox-border-invalid";
|
|
7373
|
+
var DISABLED$2 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:eldra-checkbox-border";
|
|
7374
|
+
var DISABLED_SELECTED = "eldra:bg-muted eldra:border-muted eldra:eldra-checkbox-border";
|
|
7119
7375
|
function radioState({ selected, disabled, invalid }) {
|
|
7120
7376
|
if (disabled) return selected ? DISABLED_SELECTED : DISABLED$2;
|
|
7121
7377
|
if (selected) return invalid ? INVALID_SELECTED : SELECTED;
|
|
7122
7378
|
return invalid ? INVALID$2 : UNSELECTED;
|
|
7123
7379
|
}
|
|
7124
|
-
/** The drawn circle, before `classes.radio` is
|
|
7380
|
+
/** The drawn circle, before `classes.radio` is appended. */
|
|
7125
7381
|
function radioRecipe(size, state) {
|
|
7126
|
-
return
|
|
7382
|
+
return [
|
|
7383
|
+
RADIO,
|
|
7384
|
+
RADIO_SIZE[size],
|
|
7385
|
+
radioState(state)
|
|
7386
|
+
];
|
|
7127
7387
|
}
|
|
7128
7388
|
/**
|
|
7129
7389
|
* The dot (spec "Radio group" → Sizes: "0.5rem dot"). One fixed size regardless of `size`, the
|
|
@@ -7131,20 +7391,24 @@ function radioRecipe(size, state) {
|
|
|
7131
7391
|
* its own: the API contract's part list has no entry for it, unlike `Checkbox`'s `check`.
|
|
7132
7392
|
*/
|
|
7133
7393
|
function dotRecipe(selected) {
|
|
7134
|
-
return
|
|
7394
|
+
return ["eldra:pointer-events-none eldra:size-2 eldra:rounded-full eldra:bg-primary-contrast eldra:transition-transform eldra:duration-fast eldra:ease-out", selected ? "eldra:scale-100" : "eldra:scale-0"];
|
|
7135
7395
|
}
|
|
7136
7396
|
/** The native radio: invisible but hit-testable, stretched over the drawn circle. */
|
|
7137
|
-
var INPUT = "absolute inset-0 m-0 size-full cursor-pointer appearance-none opacity-0 disabled:cursor-not-allowed";
|
|
7397
|
+
var INPUT = "eldra:absolute eldra:inset-0 eldra:m-0 eldra:size-full eldra:cursor-pointer eldra:appearance-none eldra:opacity-0 eldra:disabled:cursor-not-allowed";
|
|
7138
7398
|
/**
|
|
7139
7399
|
* Spec "Radio group" → Sizes: "Plain row … 0.9375rem / 1.5rem text" for plain layouts, "Card title
|
|
7140
7400
|
* … 1rem 600 (line-height 1.4)" for cards — the same two type utilities `Checkbox`'s label and the
|
|
7141
7401
|
* `text-card-title` utility (see `tailwind.css`) already give those numbers.
|
|
7142
7402
|
*/
|
|
7143
7403
|
function labelRecipe(card, disabled) {
|
|
7144
|
-
return
|
|
7404
|
+
return [
|
|
7405
|
+
card ? "eldra:text-card-title" : "eldra:text-control",
|
|
7406
|
+
"eldra:min-w-0",
|
|
7407
|
+
disabled ? "eldra:text-muted" : "eldra:text-text"
|
|
7408
|
+
];
|
|
7145
7409
|
}
|
|
7146
7410
|
/** Spec "Radio group" → Sizes: the hint is `muted` in every layout, under the label's column. */
|
|
7147
|
-
var HINT = "text-body-sm text-muted col-start-2 min-w-0";
|
|
7411
|
+
var HINT = "eldra:text-body-sm eldra:text-muted eldra:col-start-2 eldra:min-w-0";
|
|
7148
7412
|
// src/components/radio/RadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
7149
7413
|
var _hoisted_1$5 = [
|
|
7150
7414
|
"data-eldra-scope",
|
|
@@ -7164,20 +7428,22 @@ var _hoisted_3$5 = ["data-eldra-slot"];
|
|
|
7164
7428
|
var _hoisted_4$4 = ["data-eldra-slot"];
|
|
7165
7429
|
var _hoisted_5$4 = ["data-eldra-slot"];
|
|
7166
7430
|
var _hoisted_6$3 = ["id"];
|
|
7167
|
-
var
|
|
7168
|
-
|
|
7169
|
-
var
|
|
7170
|
-
var
|
|
7431
|
+
var ROOT = "eldra:grid eldra:min-w-0 eldra:content-start eldra:gap-3 eldra:rounded-none eldra:border-0 eldra:p-0";
|
|
7432
|
+
/** `FieldWrapper`'s help type: 0.8125rem / 1.45, weight 400, `muted`. */
|
|
7433
|
+
var CARD_OPTION = "eldra:group eldra:relative eldra:grid eldra:w-full eldra:grid-cols-[auto_1fr_auto] eldra:items-start eldra:gap-x-2.5 eldra:gap-y-0.5 eldra:min-h-14 eldra:rounded-md eldra:px-4 eldra:py-3 eldra:eldra-radio-card-border eldra:eldra-transition-colors";
|
|
7434
|
+
var CARD_UNSELECTED = "eldra:bg-background eldra:border-border-strong eldra:hover:border-text";
|
|
7435
|
+
var CARD_SELECTED = "eldra:bg-surface eldra:border-primary eldra:eldra-radio-card-selected";
|
|
7436
|
+
var CARD_INVALID = "eldra:bg-background eldra:border-danger eldra:hover:border-danger";
|
|
7171
7437
|
/**
|
|
7172
7438
|
* Spec has no dedicated "selected and in error" card row; this follows the same reading `Checkbox`
|
|
7173
7439
|
* gives an invalid checked box (Decision: it keeps its fill and swaps only the border colour) —
|
|
7174
7440
|
* `eldra-radio-card-selected`'s inset line reads `--eldra-radio-card-selected-color` for exactly
|
|
7175
7441
|
* this, so one utility draws both the `primary` and the `danger` version of the same line.
|
|
7176
7442
|
*/
|
|
7177
|
-
var CARD_INVALID_SELECTED = "bg-surface border-danger eldra-radio-card-selected [--eldra-radio-card-selected-color:var(--eldra-color-danger)]";
|
|
7443
|
+
var CARD_INVALID_SELECTED = "eldra:bg-surface eldra:border-danger eldra:eldra-radio-card-selected eldra:[--eldra-radio-card-selected-color:var(--eldra-color-danger)]";
|
|
7178
7444
|
/** Spec "Radio group" → States, Disabled selected row: "as disabled" — the card draws no special
|
|
7179
7445
|
* selected look once it is also disabled; only the radio inside it keeps a distinct look. */
|
|
7180
|
-
var CARD_DISABLED = "bg-background border-border border-dashed";
|
|
7446
|
+
var CARD_DISABLED = "eldra:bg-background eldra:border-border eldra:border-dashed";
|
|
7181
7447
|
// src/components/radio/RadioGroup.vue
|
|
7182
7448
|
var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
7183
7449
|
__name: "RadioGroup",
|
|
@@ -7268,10 +7534,8 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7268
7534
|
* a radio group looks the same as any other fieldset: "no border, padding or min-width, grid with
|
|
7269
7535
|
* a 0.75rem (`space-3`) gap, and the legend has a 0.5rem (`space-2`) bottom margin."
|
|
7270
7536
|
*/
|
|
7271
|
-
const
|
|
7272
|
-
|
|
7273
|
-
const helpClass = computed(() => partClass("text-field-note text-muted min-w-0 font-normal", props.classes, "help"));
|
|
7274
|
-
const legendClass = computed(() => partClass("text-label text-text mb-2 block w-fit p-0", props.classes, "legend"));
|
|
7537
|
+
const helpClass = computed(() => ["eldra:text-field-note eldra:text-muted eldra:min-w-0 eldra:font-normal", props.classes?.help]);
|
|
7538
|
+
const legendClass = computed(() => ["eldra:text-label eldra:text-text eldra:mb-2 eldra:block eldra:w-fit eldra:p-0", props.classes?.legend]);
|
|
7275
7539
|
/**
|
|
7276
7540
|
* The legend, with `FieldWrapper`'s required mark after the text when `requiredMark` asks for it.
|
|
7277
7541
|
* A render function so a legend without the mark holds its text and nothing else — no `v-if`
|
|
@@ -7287,7 +7551,7 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7287
7551
|
* Cards are "stacked with a 0.5rem (`space-2`) gap" — the same numbers as vertical, so cards share
|
|
7288
7552
|
* its classes; only the option itself is drawn differently.
|
|
7289
7553
|
*/
|
|
7290
|
-
const optionsClass = computed(() =>
|
|
7554
|
+
const optionsClass = computed(() => [["eldra:flex eldra:min-w-0", props.layout === "row" ? "eldra:flex-row eldra:flex-wrap eldra:gap-x-6 eldra:gap-y-2" : "eldra:flex-col eldra:gap-2"], props.classes?.options]);
|
|
7291
7555
|
/**
|
|
7292
7556
|
* Spec "Radio group" → Sizes, Card row: "padding 0.75rem block / 1rem inline, 0.625rem gap, radius
|
|
7293
7557
|
* `radius-md`, 1px border, about 3.5rem tall with a hint line" — `min-h-14` is that 3.5rem, the
|
|
@@ -7301,23 +7565,27 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7301
7565
|
return inError.value ? CARD_INVALID : CARD_UNSELECTED;
|
|
7302
7566
|
}
|
|
7303
7567
|
function optionClass(option) {
|
|
7304
|
-
return
|
|
7568
|
+
return [
|
|
7569
|
+
props.layout === "cards" ? [CARD_OPTION, cardState(option)] : [PLAIN_OPTION, PLAIN_COLUMNS],
|
|
7570
|
+
optionCursor(option.disabled),
|
|
7571
|
+
props.classes?.option
|
|
7572
|
+
];
|
|
7305
7573
|
}
|
|
7306
7574
|
function radioClass(option) {
|
|
7307
|
-
return
|
|
7575
|
+
return [radioRecipe(radioSize.value, {
|
|
7308
7576
|
selected: isSelected(option.value),
|
|
7309
7577
|
disabled: option.disabled,
|
|
7310
7578
|
invalid: inError.value
|
|
7311
|
-
}), props.classes
|
|
7579
|
+
}), props.classes?.radio];
|
|
7312
7580
|
}
|
|
7313
7581
|
function dotClass(option) {
|
|
7314
|
-
return
|
|
7582
|
+
return [dotRecipe(isSelected(option.value)), props.classes?.dot];
|
|
7315
7583
|
}
|
|
7316
|
-
const inputClass = computed(() =>
|
|
7584
|
+
const inputClass = computed(() => [INPUT, props.classes?.input]);
|
|
7317
7585
|
function labelClass(option) {
|
|
7318
|
-
return
|
|
7586
|
+
return [labelRecipe(props.layout === "cards", option.disabled), props.classes?.label];
|
|
7319
7587
|
}
|
|
7320
|
-
const hintClass = computed(() =>
|
|
7588
|
+
const hintClass = computed(() => [HINT, props.classes?.hint]);
|
|
7321
7589
|
/**
|
|
7322
7590
|
* Spec "Radio group" → Sizes, Card title / hint / meta row: "1rem 600 tabular, no wrap, pushed to
|
|
7323
7591
|
* the end" — `tabular-nums` and `whitespace-nowrap` are stock Tailwind utilities, so meta reuses
|
|
@@ -7325,14 +7593,14 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7325
7593
|
* grid's third column is what pushes it to the end.
|
|
7326
7594
|
*/
|
|
7327
7595
|
function metaClass(option) {
|
|
7328
|
-
return
|
|
7596
|
+
return [["eldra:text-card-title eldra:col-start-3 eldra:min-w-0 eldra:justify-self-end eldra:tabular-nums eldra:whitespace-nowrap", option.disabled ? "eldra:text-muted" : "eldra:text-text"], props.classes?.meta];
|
|
7329
7597
|
}
|
|
7330
7598
|
return (_ctx, _cache) => {
|
|
7331
7599
|
return openBlock(), createElementBlock("fieldset", {
|
|
7332
7600
|
"data-eldra-ui": "",
|
|
7333
7601
|
"data-eldra-scope": unref(eldra).scope,
|
|
7334
7602
|
"data-part": "root",
|
|
7335
|
-
class: normalizeClass(
|
|
7603
|
+
class: normalizeClass(ROOT),
|
|
7336
7604
|
"aria-describedby": describedBy.value,
|
|
7337
7605
|
"aria-invalid": inError.value ? "true" : void 0
|
|
7338
7606
|
}, [
|
|
@@ -7398,7 +7666,7 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7398
7666
|
"data-part": "help",
|
|
7399
7667
|
class: normalizeClass(helpClass.value)
|
|
7400
7668
|
}, toDisplayString(__props.help), 11, _hoisted_6$3)) : createCommentVNode("", true)
|
|
7401
|
-
],
|
|
7669
|
+
], 8, _hoisted_1$5);
|
|
7402
7670
|
};
|
|
7403
7671
|
}
|
|
7404
7672
|
});
|
|
@@ -7411,8 +7679,8 @@ var _hoisted_1$4 = [
|
|
|
7411
7679
|
"data-view"
|
|
7412
7680
|
];
|
|
7413
7681
|
var _hoisted_2$4 = ["data-eldra-slot"];
|
|
7414
|
-
var _hoisted_3$4 = { class: "text-search-title m-0 break-words" };
|
|
7415
|
-
var _hoisted_4$3 = { class: "text-body-sm mt-1 mb-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]" };
|
|
7682
|
+
var _hoisted_3$4 = { class: "eldra:text-search-title eldra:m-0 eldra:break-words" };
|
|
7683
|
+
var _hoisted_4$3 = { class: "eldra:text-body-sm eldra:mt-1 eldra:mb-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" };
|
|
7416
7684
|
var _hoisted_5$3 = [
|
|
7417
7685
|
"id",
|
|
7418
7686
|
"aria-label",
|
|
@@ -7437,7 +7705,7 @@ var _hoisted_10$1 = [
|
|
|
7437
7705
|
var _hoisted_11$1 = ["src", "alt"];
|
|
7438
7706
|
var _hoisted_12$1 = {
|
|
7439
7707
|
key: 1,
|
|
7440
|
-
class: "size-4.5",
|
|
7708
|
+
class: "eldra:size-4.5",
|
|
7441
7709
|
viewBox: "0 0 24 24",
|
|
7442
7710
|
fill: "none",
|
|
7443
7711
|
stroke: "currentColor",
|
|
@@ -7447,7 +7715,7 @@ var _hoisted_12$1 = {
|
|
|
7447
7715
|
"aria-hidden": "true",
|
|
7448
7716
|
focusable: "false"
|
|
7449
7717
|
};
|
|
7450
|
-
var _hoisted_13 = { class: "eldra-select-match bg-transparent text-inherit" };
|
|
7718
|
+
var _hoisted_13 = { class: "eldra:eldra-select-match eldra:bg-transparent eldra:text-inherit" };
|
|
7451
7719
|
var _hoisted_14 = ["data-eldra-scope"];
|
|
7452
7720
|
var _hoisted_15 = ["data-eldra-scope"];
|
|
7453
7721
|
var _hoisted_16 = ["data-eldra-scope"];
|
|
@@ -7457,8 +7725,8 @@ var _hoisted_17 = [
|
|
|
7457
7725
|
"onMouseenter"
|
|
7458
7726
|
];
|
|
7459
7727
|
var _hoisted_18 = ["id", "href"];
|
|
7460
|
-
var _hoisted_19 = { class: "min-w-0 flex-1 truncate" };
|
|
7461
|
-
var LEADING_ICON = "size-4.5 shrink-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]";
|
|
7728
|
+
var _hoisted_19 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
7729
|
+
var LEADING_ICON = "eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]";
|
|
7462
7730
|
// src/components/search-bar/SearchResultsPanel.vue
|
|
7463
7731
|
var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
7464
7732
|
__name: "SearchResultsPanel",
|
|
@@ -7517,12 +7785,24 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7517
7785
|
* class list for a `teleport: false` search bar; the inline `position` from `useFloating` (`fixed`
|
|
7518
7786
|
* once teleported) is on the element and wins over it either way.
|
|
7519
7787
|
*/
|
|
7520
|
-
const panelClass = computed(() =>
|
|
7521
|
-
|
|
7788
|
+
const panelClass = computed(() => [props.flat ? ["eldra:flex eldra:h-full eldra:min-h-0 eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-2", "eldra:text-[color:var(--eldra-select-panel-text)]"] : [
|
|
7789
|
+
"eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-1.5",
|
|
7790
|
+
"eldra:eldra-search-panel-height",
|
|
7791
|
+
"eldra:rounded-lg eldra:border eldra:shadow-md",
|
|
7792
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
7793
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
7794
|
+
"eldra:text-[color:var(--eldra-select-panel-text)]",
|
|
7795
|
+
"eldra:animate-eldra-popover-in"
|
|
7796
|
+
], props.classes?.panel]);
|
|
7797
|
+
const listboxClass = computed(() => ["eldra:flex eldra:flex-col", props.classes?.listbox]);
|
|
7522
7798
|
/** "0.125rem block padding. Each group after the first has a 1px `border` hairline above." */
|
|
7523
|
-
const sectionClass = (index) =>
|
|
7799
|
+
const sectionClass = (index) => [
|
|
7800
|
+
"eldra:py-0.5",
|
|
7801
|
+
index > 0 && "eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))] eldra:mt-1 eldra:border-t eldra:pt-1.5",
|
|
7802
|
+
props.classes?.section
|
|
7803
|
+
];
|
|
7524
7804
|
/** "0.75rem, 600, uppercase, 0.06em tracking, `muted`, min 1.75rem row, padding 0.25rem 0.5rem." */
|
|
7525
|
-
const headingClass = computed(() =>
|
|
7805
|
+
const headingClass = computed(() => ["eldra:text-select-group eldra:flex eldra:min-h-7 eldra:items-center eldra:px-2 eldra:py-1 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", props.classes?.sectionHeading]);
|
|
7526
7806
|
/**
|
|
7527
7807
|
* An option row (spec → Sizes, Option): "min 2.5rem, padding 0.375rem 0.5rem, 0.75rem gap,
|
|
7528
7808
|
* `radius-md`", and → States, Active option: "`surface-strong` fill, and the arrow appears at the
|
|
@@ -7532,29 +7812,45 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7532
7812
|
* Rows carry no focus ring of their own: "focus stays in the input and the active row is the
|
|
7533
7813
|
* visual cue".
|
|
7534
7814
|
*/
|
|
7535
|
-
const rowClass = (row, part = "item") =>
|
|
7815
|
+
const rowClass = (row, part = "item") => [
|
|
7816
|
+
"eldra:flex eldra:min-h-10 eldra:scroll-my-1 eldra:cursor-pointer eldra:items-center eldra:gap-3 eldra:rounded-md eldra:px-2 eldra:py-1.5",
|
|
7817
|
+
"eldra:no-underline",
|
|
7818
|
+
row.kind === "clearRecent" ? "eldra:text-caption eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : "eldra:text-select-option eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
7819
|
+
isActive(row) && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
7820
|
+
props.classes?.[part]
|
|
7821
|
+
];
|
|
7536
7822
|
/** "See all" is 600 with the arrow always showing, 0.25rem below the last group. */
|
|
7537
|
-
const viewAllClass = computed(() => props.viewAll === void 0 ? "" :
|
|
7823
|
+
const viewAllClass = computed(() => props.viewAll === void 0 ? "" : [rowClass(props.viewAll, "viewAll"), "eldra:mt-1 eldra:font-semibold"]);
|
|
7538
7824
|
/** "Thumbnail / icon tile: 2.5rem square, `radius-sm`. Thumbnails sit on `surface-strong`." */
|
|
7539
|
-
const imageClass = (row) =>
|
|
7825
|
+
const imageClass = (row) => [
|
|
7826
|
+
"eldra:flex eldra:size-10 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:overflow-hidden eldra:rounded-sm",
|
|
7827
|
+
row.item?.image === void 0 ? "eldra:bg-surface eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : "eldra:bg-surface-strong",
|
|
7828
|
+
props.classes?.itemImage
|
|
7829
|
+
];
|
|
7540
7830
|
/** "Title and sub truncate with an ellipsis on one line." */
|
|
7541
|
-
const titleClass = computed(() =>
|
|
7831
|
+
const titleClass = computed(() => ["eldra:min-w-0 eldra:flex-1 eldra:truncate", props.classes?.itemTitle]);
|
|
7542
7832
|
/** "Meta: 0.875rem 600 tabular." */
|
|
7543
|
-
const metaClass = computed(() =>
|
|
7833
|
+
const metaClass = computed(() => ["eldra:ms-3 eldra:shrink-0 eldra:text-search-meta eldra:tabular-nums", props.classes?.itemMeta]);
|
|
7544
7834
|
/** "1rem `arrow-right`, `text`, at the end of the row. Visible only on the active row." */
|
|
7545
|
-
const arrowClass = computed(() =>
|
|
7835
|
+
const arrowClass = computed(() => ["eldra:size-4 eldra:shrink-0", props.classes?.itemArrow]);
|
|
7546
7836
|
/** A recent row's own leading icon: "a 1.125rem `muted` leading icon instead" of a tile. */
|
|
7547
|
-
const recentClass = computed(() =>
|
|
7548
|
-
const popularClass = computed(() =>
|
|
7837
|
+
const recentClass = computed(() => props.classes?.recent);
|
|
7838
|
+
const popularClass = computed(() => ["eldra:flex eldra:flex-wrap eldra:gap-1.5 eldra:px-2 eldra:pt-1 eldra:pb-2", props.classes?.popular]);
|
|
7549
7839
|
/**
|
|
7550
7840
|
* "Chips: min 2rem, padding 0 0.75rem, 1px `border-strong`, `radius-full`, 0.875rem, 0.375rem gap
|
|
7551
7841
|
* between chips, optional 0.875rem `muted` icon", and → States, Active chip: "`surface-strong`
|
|
7552
7842
|
* fill, border `text`".
|
|
7553
7843
|
*/
|
|
7554
|
-
const chipClass = (row) =>
|
|
7844
|
+
const chipClass = (row) => [
|
|
7845
|
+
"eldra:inline-flex eldra:min-h-8 eldra:cursor-pointer eldra:items-center eldra:gap-1.5 eldra:rounded-full eldra:border eldra:px-3",
|
|
7846
|
+
"eldra:text-body-sm eldra:no-underline",
|
|
7847
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
7848
|
+
isActive(row) ? "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:border-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:eldra-select-option-active" : "eldra:border-border-strong",
|
|
7849
|
+
props.classes?.chip
|
|
7850
|
+
];
|
|
7555
7851
|
/** "No-results message: centred, padding 1.5rem 1rem 0.75rem. Title 1rem 600 … advice 0.875rem." */
|
|
7556
|
-
const emptyClass = computed(() =>
|
|
7557
|
-
const loadingClass = computed(() =>
|
|
7852
|
+
const emptyClass = computed(() => ["eldra:px-4 eldra:pt-6 eldra:pb-3 eldra:text-center", props.classes?.empty]);
|
|
7853
|
+
const loadingClass = computed(() => ["eldra:flex eldra:flex-col eldra:gap-1", props.classes?.loading]);
|
|
7558
7854
|
/** The three skeleton rows: "a 2.5rem square + two text lines". */
|
|
7559
7855
|
const SKELETON_ROWS = [
|
|
7560
7856
|
0,
|
|
@@ -7611,9 +7907,9 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7611
7907
|
}, [(openBlock(), createElementBlock(Fragment, null, renderList(SKELETON_ROWS, (row) => {
|
|
7612
7908
|
return createElementVNode("div", {
|
|
7613
7909
|
key: row,
|
|
7614
|
-
class: "flex min-h-10 items-center gap-3 px-2 py-1.5",
|
|
7910
|
+
class: "eldra:flex eldra:min-h-10 eldra:items-center eldra:gap-3 eldra:px-2 eldra:py-1.5",
|
|
7615
7911
|
"aria-hidden": "true"
|
|
7616
|
-
}, [..._cache[2] || (_cache[2] = [createElementVNode("span", { class: "bg-surface-strong size-10 shrink-0 rounded-sm" }, null, -1), createElementVNode("span", { class: "flex min-w-0 flex-1 flex-col gap-1.5" }, [createElementVNode("span", { class: "bg-surface-strong h-2.5 w-3/4 rounded-sm" }), createElementVNode("span", { class: "bg-surface-strong h-2.5 w-1/3 rounded-sm" })], -1)])]);
|
|
7912
|
+
}, [..._cache[2] || (_cache[2] = [createElementVNode("span", { class: "eldra:bg-surface-strong eldra:size-10 eldra:shrink-0 eldra:rounded-sm" }, null, -1), createElementVNode("span", { class: "eldra:flex eldra:min-w-0 eldra:flex-1 eldra:flex-col eldra:gap-1.5" }, [createElementVNode("span", { class: "eldra:bg-surface-strong eldra:h-2.5 eldra:w-3/4 eldra:rounded-sm" }), createElementVNode("span", { class: "eldra:bg-surface-strong eldra:h-2.5 eldra:w-1/3 eldra:rounded-sm" })], -1)])]);
|
|
7617
7913
|
}), 64))], 2)) : createCommentVNode("", true),
|
|
7618
7914
|
createElementVNode("div", {
|
|
7619
7915
|
id: __props.listboxId,
|
|
@@ -7652,7 +7948,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7652
7948
|
onClick: ($event) => emit("select", row, $event),
|
|
7653
7949
|
onMouseenter: ($event) => emit("activate", row.value)
|
|
7654
7950
|
}, [_cache[3] || (_cache[3] = createElementVNode("svg", {
|
|
7655
|
-
class: "size-3.5 shrink-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]",
|
|
7951
|
+
class: "eldra:size-3.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
7656
7952
|
viewBox: "0 0 24 24",
|
|
7657
7953
|
fill: "none",
|
|
7658
7954
|
stroke: "currentColor",
|
|
@@ -7691,7 +7987,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7691
7987
|
key: 0,
|
|
7692
7988
|
src: row.item.image,
|
|
7693
7989
|
alt: row.item.imageAlt ?? "",
|
|
7694
|
-
class: "size-full object-cover"
|
|
7990
|
+
class: "eldra:size-full eldra:object-cover"
|
|
7695
7991
|
}, null, 8, _hoisted_11$1)) : (openBlock(), createElementBlock("svg", _hoisted_12$1, [row.type === "products" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
7696
7992
|
_cache[4] || (_cache[4] = createElementVNode("path", { d: "M15 8h.01" }, null, -1)),
|
|
7697
7993
|
_cache[5] || (_cache[5] = createElementVNode("path", { d: "M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z" }, null, -1)),
|
|
@@ -7759,7 +8055,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7759
8055
|
key: 0,
|
|
7760
8056
|
"data-part": "popular",
|
|
7761
8057
|
role: "presentation",
|
|
7762
|
-
class: normalizeClass([popularClass.value, "justify-center"])
|
|
8058
|
+
class: normalizeClass([popularClass.value, "eldra:justify-center"])
|
|
7763
8059
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.looseChips, (row) => {
|
|
7764
8060
|
return openBlock(), createElementBlock("a", {
|
|
7765
8061
|
key: row.value,
|
|
@@ -7772,7 +8068,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7772
8068
|
onClick: ($event) => emit("select", row, $event),
|
|
7773
8069
|
onMouseenter: ($event) => emit("activate", row.value)
|
|
7774
8070
|
}, [_cache[21] || (_cache[21] = createElementVNode("svg", {
|
|
7775
|
-
class: "size-3.5 shrink-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]",
|
|
8071
|
+
class: "eldra:size-3.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
7776
8072
|
viewBox: "0 0 24 24",
|
|
7777
8073
|
fill: "none",
|
|
7778
8074
|
stroke: "currentColor",
|
|
@@ -7854,6 +8150,7 @@ var RECENT_KEY = "eldra-ui:recent-searches";
|
|
|
7854
8150
|
var RECENT_MAX = 5;
|
|
7855
8151
|
var LOADING_DELAY_MS = 300;
|
|
7856
8152
|
var ANNOUNCE_DELAY_MS = 400;
|
|
8153
|
+
var rootClass$3 = "eldra:relative eldra:block eldra:w-full";
|
|
7857
8154
|
// src/components/search-bar/SearchBar.vue
|
|
7858
8155
|
var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
7859
8156
|
inheritAttrs: false,
|
|
@@ -8400,12 +8697,10 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8400
8697
|
if (typeof document === "undefined") return;
|
|
8401
8698
|
document.removeEventListener("keydown", onShortcut);
|
|
8402
8699
|
});
|
|
8403
|
-
const
|
|
8404
|
-
const rootClass = computed(() => part("relative block w-full", "root"));
|
|
8405
|
-
const formClass = computed(() => part("relative block w-full", "form"));
|
|
8700
|
+
const formClass = computed(() => ["eldra:relative eldra:block eldra:w-full", props.classes?.form]);
|
|
8406
8701
|
/**
|
|
8407
8702
|
* The field (spec "Search bar" → Sizes, and "Actions and forms" → Compact controls): the same box
|
|
8408
|
-
* as `Input`'s, **because it is one** — `
|
|
8703
|
+
* as `Input`'s, **because it is one** — `FIELD_BOX`, `FIELD_RADIUS`, `FIELD_TEXT` and `FIELD_LIVE` are imported
|
|
8409
8704
|
* from `../input/classes.ts` rather than copied here. The copy this replaces had drifted: it had
|
|
8410
8705
|
* lost the radius variable (it re-declared the radius in the ternary below instead) and kept its
|
|
8411
8706
|
* own spelling of the type-size rules, which is what the operator saw as a search field that
|
|
@@ -8422,28 +8717,50 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8422
8717
|
* the `max-md:` mobile override, which is a viewport rule so iOS never zooms into a focused field.
|
|
8423
8718
|
*/
|
|
8424
8719
|
const SIZE = {
|
|
8425
|
-
md: `control-h
|
|
8426
|
-
lg: `control-h-lg
|
|
8720
|
+
md: `eldra:control-h eldra:pe-11 ${FIELD_TEXT.md}`,
|
|
8721
|
+
lg: `eldra:control-h-lg eldra:pe-11 ${FIELD_TEXT.lg}`
|
|
8722
|
+
};
|
|
8723
|
+
const START_PAD = {
|
|
8724
|
+
md: "eldra:ps-9.5",
|
|
8725
|
+
lg: "eldra:ps-11"
|
|
8427
8726
|
};
|
|
8428
|
-
const fieldClass = computed(() =>
|
|
8727
|
+
const fieldClass = computed(() => [
|
|
8728
|
+
FIELD_BOX,
|
|
8729
|
+
props.pill ? "eldra:rounded-full eldra:ps-10" : `${FIELD_RADIUS} ${START_PAD[props.size]}`,
|
|
8730
|
+
FIELD_SEARCH_APPEARANCE,
|
|
8731
|
+
SIZE[props.size],
|
|
8732
|
+
FIELD_LIVE,
|
|
8733
|
+
props.classes?.field
|
|
8734
|
+
]);
|
|
8429
8735
|
/** "Search icon: `muted`, decorative", 1.125rem at 0.75rem (md) or 1.25rem at 0.875rem (lg). */
|
|
8430
8736
|
const ICON_SIZE = {
|
|
8431
|
-
md: "size-4.5",
|
|
8432
|
-
lg: "size-5"
|
|
8737
|
+
md: "eldra:size-4.5",
|
|
8738
|
+
lg: "eldra:size-5"
|
|
8433
8739
|
};
|
|
8434
|
-
const leadingIconClass = computed(() =>
|
|
8740
|
+
const leadingIconClass = computed(() => [
|
|
8741
|
+
"eldra:pointer-events-none eldra:absolute eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center eldra:justify-center eldra:text-muted",
|
|
8742
|
+
props.size === "lg" || props.pill ? "eldra:start-3.5" : "eldra:start-3",
|
|
8743
|
+
ICON_SIZE[props.size],
|
|
8744
|
+
props.classes?.leadingIcon
|
|
8745
|
+
]);
|
|
8435
8746
|
/**
|
|
8436
8747
|
* "Clear: 2rem ghost icon button, 0.25rem from the end edge … round in the pill variant." The
|
|
8437
|
-
* button itself is `Input`'s (`
|
|
8748
|
+
* button itself is `Input`'s (`FIELD_CLEAR_BUTTON_BOX`); what is added is where it sits — absolutely,
|
|
8438
8749
|
* because this field has no `suffix` row — its 2rem size at both sizes, and the pill's own radius.
|
|
8439
8750
|
*/
|
|
8440
|
-
const clearButtonClass = computed(() =>
|
|
8751
|
+
const clearButtonClass = computed(() => [
|
|
8752
|
+
"eldra:inline-flex",
|
|
8753
|
+
FIELD_CLEAR_BUTTON_BOX,
|
|
8754
|
+
"eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:size-8",
|
|
8755
|
+
props.pill ? "eldra:rounded-full" : "eldra:rounded-sm",
|
|
8756
|
+
props.classes?.clearButton
|
|
8757
|
+
]);
|
|
8441
8758
|
/**
|
|
8442
8759
|
* "Keyboard hint: `/` in a keyboard-key chip: monospace, 0.75rem, `surface` fill, 1px
|
|
8443
8760
|
* `border-strong`, `radius-sm`, `muted` text, 0.625rem from the end edge." `aria-hidden`, and out
|
|
8444
8761
|
* of the pointer's way: the shortcut it names is a keyboard affordance.
|
|
8445
8762
|
*/
|
|
8446
|
-
const shortcutHintClass = computed(() =>
|
|
8763
|
+
const shortcutHintClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:end-2.5 eldra:inset-y-0 eldra:my-auto eldra:inline-flex eldra:h-5 eldra:min-w-5 eldra:items-center eldra:justify-center eldra:rounded-sm eldra:border eldra:border-border-strong eldra:bg-surface eldra:px-1 eldra:text-search-kbd eldra:text-muted", props.classes?.shortcutHint]);
|
|
8447
8764
|
/**
|
|
8448
8765
|
* The **visible** half of the `loading` view, beside the field rather than only inside the panel.
|
|
8449
8766
|
*
|
|
@@ -8454,8 +8771,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8454
8771
|
* the same 300ms delay as the panel's own loading view so a fast read never flashes it. Decorative:
|
|
8455
8772
|
* the state is announced by the live region and by `aria-busy` on the listbox, never by the shape.
|
|
8456
8773
|
*/
|
|
8457
|
-
const busyClass = computed(() =>
|
|
8458
|
-
const liveRegionClass = computed(() => part("", "liveRegion"));
|
|
8774
|
+
const busyClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:end-10 eldra:inset-y-0 eldra:my-auto eldra:inline-flex eldra:items-center eldra:text-muted", props.classes?.busy]);
|
|
8459
8775
|
const showClear = computed(() => model.value.length > 0);
|
|
8460
8776
|
const showHint = computed(() => props.shortcut && model.value.length === 0);
|
|
8461
8777
|
return (_ctx, _cache) => {
|
|
@@ -8463,7 +8779,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8463
8779
|
"data-eldra-ui": "",
|
|
8464
8780
|
"data-eldra-scope": unref(eldra).scope,
|
|
8465
8781
|
"data-part": "root",
|
|
8466
|
-
class: normalizeClass(rootClass.
|
|
8782
|
+
class: normalizeClass([rootClass$3, _ctx.$attrs.class])
|
|
8467
8783
|
}, [
|
|
8468
8784
|
createElementVNode("form", {
|
|
8469
8785
|
"data-part": "form",
|
|
@@ -8490,7 +8806,10 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8490
8806
|
createElementVNode("input", mergeProps({
|
|
8491
8807
|
ref_key: "fieldRef",
|
|
8492
8808
|
ref: fieldRef
|
|
8493
|
-
},
|
|
8809
|
+
}, {
|
|
8810
|
+
..._ctx.$attrs,
|
|
8811
|
+
class: void 0
|
|
8812
|
+
}, {
|
|
8494
8813
|
id: unref(controlId),
|
|
8495
8814
|
"data-part": "field",
|
|
8496
8815
|
name: "q",
|
|
@@ -8516,7 +8835,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8516
8835
|
key: 0,
|
|
8517
8836
|
"data-part": "busy",
|
|
8518
8837
|
class: normalizeClass(busyClass.value)
|
|
8519
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true),
|
|
8838
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true),
|
|
8520
8839
|
showClear.value ? (openBlock(), createElementBlock("button", {
|
|
8521
8840
|
key: 1,
|
|
8522
8841
|
"data-part": "clearButton",
|
|
@@ -8525,7 +8844,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8525
8844
|
"aria-label": unref(m).clear,
|
|
8526
8845
|
onClick: onClear
|
|
8527
8846
|
}, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
8528
|
-
class: "size-4.5",
|
|
8847
|
+
class: "eldra:size-4.5",
|
|
8529
8848
|
viewBox: "0 0 24 24",
|
|
8530
8849
|
fill: "none",
|
|
8531
8850
|
stroke: "currentColor",
|
|
@@ -8596,11 +8915,11 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8596
8915
|
"data-part": "liveRegion",
|
|
8597
8916
|
role: "status",
|
|
8598
8917
|
"aria-live": "polite",
|
|
8599
|
-
|
|
8918
|
+
class: normalizeClass(__props.classes?.liveRegion)
|
|
8600
8919
|
}, {
|
|
8601
8920
|
default: withCtx(() => [createTextVNode(toDisplayString(announcement.value), 1)]),
|
|
8602
8921
|
_: 1
|
|
8603
|
-
}, 8, ["
|
|
8922
|
+
}, 8, ["class"])
|
|
8604
8923
|
], 10, _hoisted_1$3);
|
|
8605
8924
|
};
|
|
8606
8925
|
}
|
|
@@ -8623,7 +8942,7 @@ var _hoisted_2$2 = [
|
|
|
8623
8942
|
var _hoisted_3$2 = ["data-eldra-slot"];
|
|
8624
8943
|
var _hoisted_4$1 = ["data-placeholder"];
|
|
8625
8944
|
var _hoisted_5$1 = ["data-eldra-slot"];
|
|
8626
|
-
var _hoisted_6$1 = { class: "min-w-0 flex-1 truncate" };
|
|
8945
|
+
var _hoisted_6$1 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
8627
8946
|
var _hoisted_7 = [
|
|
8628
8947
|
"id",
|
|
8629
8948
|
"aria-label",
|
|
@@ -8638,12 +8957,27 @@ var _hoisted_9 = { value: "" };
|
|
|
8638
8957
|
var _hoisted_10 = ["label"];
|
|
8639
8958
|
var _hoisted_11 = ["value", "disabled"];
|
|
8640
8959
|
var _hoisted_12 = ["value", "disabled"];
|
|
8641
|
-
var
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8960
|
+
var rootClass$2 = "eldra:relative eldra:block eldra:w-full";
|
|
8961
|
+
/**
|
|
8962
|
+
* The trigger box (spec "Select" → Sizes): the same box as `Input`, "so selects and text fields
|
|
8963
|
+
* line up in a row". `eldra-focus` without `-always`: a trigger is a button, and the focus-ring
|
|
8964
|
+
* foundation's pointer-focus exception is for *text fields*, "because a caret alone is easy to
|
|
8965
|
+
* miss". No `transition-*` utility here — `eldra-focus` owns this element's transition list,
|
|
8966
|
+
* including the `duration-fast` border-colour change (see `src/styles/tailwind.css`).
|
|
8967
|
+
*
|
|
8968
|
+
* `eldra-focus-open` is the exception the operator asked for on top of that: a trigger opened with
|
|
8969
|
+
* the pointer is focused but not `:focus-visible`, so the ring stayed hidden while an open popover
|
|
8970
|
+
* hung off it — the control gave no sign that it was the thing the keyboard was about to act on.
|
|
8971
|
+
* The utility keys the ring to this element's own `aria-expanded`, so it needs nothing kept in
|
|
8972
|
+
* sync and closing fades it back out over `eldra-focus`'s own transition.
|
|
8973
|
+
*/
|
|
8974
|
+
var TRIGGER_BASE = "eldra:flex eldra:w-full eldra:min-w-0 eldra:items-center eldra:gap-2 eldra:text-start eldra:eldra-field-border eldra:rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra:eldra-focus eldra:eldra-focus-open";
|
|
8975
|
+
var LIVE_FILL$1 = "eldra:bg-background eldra:text-text eldra:cursor-pointer";
|
|
8976
|
+
var REST = "eldra:border-border-strong eldra:hover:border-text";
|
|
8977
|
+
var OPEN = "eldra:border-text eldra:hover:border-text";
|
|
8978
|
+
var INVALID$1 = "eldra:border-danger eldra:hover:border-danger";
|
|
8979
|
+
var DISABLED$1 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
8980
|
+
var READONLY_FILL$1 = "eldra:bg-surface eldra:text-text eldra:cursor-default";
|
|
8647
8981
|
// src/components/select/Select.vue
|
|
8648
8982
|
var Select_default = /* @__PURE__ */ defineComponent({
|
|
8649
8983
|
inheritAttrs: false,
|
|
@@ -8941,51 +9275,68 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
8941
9275
|
listbox.activateFrom(void 0);
|
|
8942
9276
|
});
|
|
8943
9277
|
/**
|
|
8944
|
-
* Spec "Select" → States, Error row: "2px `danger`
|
|
8945
|
-
*
|
|
8946
|
-
*
|
|
9278
|
+
* Spec "Select" → States, Error row: "2px `danger`". The same shape as `Input`: the 1px border
|
|
9279
|
+
* stays on the trigger in every state so the value never moves, and the second line is the
|
|
9280
|
+
* trigger's ring outline at rest (`eldra-field-invalid`). A disabled field drops it — it
|
|
8947
9281
|
* cannot be corrected here — while a read-only one keeps it.
|
|
8948
9282
|
*/
|
|
8949
9283
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
8950
|
-
const rootClass = computed(() => partClass(cx("relative block w-full", showsInvalid.value && "eldra-field-invalid"), props.classes, "root"));
|
|
8951
|
-
/**
|
|
8952
|
-
* The trigger box (spec "Select" → Sizes): the same box as `Input`, "so selects and text fields
|
|
8953
|
-
* line up in a row". `eldra-focus` without `-always`: a trigger is a button, and the focus-ring
|
|
8954
|
-
* foundation's pointer-focus exception is for *text fields*, "because a caret alone is easy to
|
|
8955
|
-
* miss". No `transition-*` utility here — `eldra-focus` owns this element's transition list,
|
|
8956
|
-
* including the `duration-fast` border-colour change (see `src/styles/tailwind.css`).
|
|
8957
|
-
*
|
|
8958
|
-
* `eldra-focus-open` is the exception the operator asked for on top of that: a trigger opened with
|
|
8959
|
-
* the pointer is focused but not `:focus-visible`, so the ring stayed hidden while an open popover
|
|
8960
|
-
* hung off it — the control gave no sign that it was the thing the keyboard was about to act on.
|
|
8961
|
-
* The utility keys the ring to this element's own `aria-expanded`, so it needs nothing kept in
|
|
8962
|
-
* sync and closing fades it back out over `eldra-focus`'s own transition.
|
|
8963
|
-
*/
|
|
8964
9284
|
const SIZE = {
|
|
8965
|
-
sm: "control-h-sm ps-2.25 pe-2.5 text-control-sm",
|
|
8966
|
-
md: "control-h ps-2.75 pe-2.5 text-control max-md:text-control-mobile",
|
|
8967
|
-
lg: "control-h-lg ps-2.75 pe-2.5 text-control-lg"
|
|
9285
|
+
sm: "eldra:control-h-sm eldra:ps-2.25 eldra:pe-2.5 eldra:text-control-sm",
|
|
9286
|
+
md: "eldra:control-h eldra:ps-2.75 eldra:pe-2.5 eldra:text-control eldra:max-md:text-control-mobile",
|
|
9287
|
+
lg: "eldra:control-h-lg eldra:ps-2.75 eldra:pe-2.5 eldra:text-control-lg"
|
|
8968
9288
|
};
|
|
8969
9289
|
/**
|
|
8970
9290
|
* Spec "Select" → States. Open and hover share the `text` boundary; disabled/read-only replace it.
|
|
8971
9291
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README) replaces
|
|
8972
9292
|
* Tailwind v4 preflight's `button { cursor: default }`; read-only keeps `cursor-default` (it opens
|
|
8973
|
-
* no popover) and disabled keeps `cursor-not-allowed`.
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
9293
|
+
* no popover) and disabled keeps `cursor-not-allowed`. The fill and the boundary are picked apart,
|
|
9294
|
+
* so the trigger carries one of each: the error boundary over the open one over the rest one.
|
|
9295
|
+
*/
|
|
9296
|
+
function triggerState() {
|
|
9297
|
+
if (props.disabled) return DISABLED$1;
|
|
9298
|
+
if (props.readonly) return `${READONLY_FILL$1} ${showsInvalid.value ? INVALID$1 : "eldra:border-border"}`;
|
|
9299
|
+
return `${LIVE_FILL$1} ${showsInvalid.value ? INVALID$1 : isOpen.value ? OPEN : REST}`;
|
|
9300
|
+
}
|
|
9301
|
+
const triggerClass = computed(() => [
|
|
9302
|
+
TRIGGER_BASE,
|
|
9303
|
+
SIZE[props.size],
|
|
9304
|
+
triggerState(),
|
|
9305
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
9306
|
+
props.classes?.trigger
|
|
9307
|
+
]);
|
|
9308
|
+
const leadingIconClass = computed(() => ["eldra:flex eldra:size-4.5 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:text-muted", props.classes?.leadingIcon]);
|
|
8977
9309
|
/** The chosen option's mark and label. 1.75rem of extra end padding while the clear button shows. */
|
|
8978
|
-
const valueClass = computed(() =>
|
|
8979
|
-
|
|
9310
|
+
const valueClass = computed(() => [
|
|
9311
|
+
"eldra:flex eldra:min-w-0 eldra:flex-1 eldra:items-center eldra:gap-2",
|
|
9312
|
+
TRIGGER_VALUE_CELL,
|
|
9313
|
+
showClear.value && "eldra:pe-7",
|
|
9314
|
+
props.classes?.value
|
|
9315
|
+
]);
|
|
9316
|
+
const placeholderClass = computed(() => [
|
|
9317
|
+
"eldra:min-w-0 eldra:flex-1 eldra:truncate eldra:text-muted",
|
|
9318
|
+
showClear.value && "eldra:pe-7",
|
|
9319
|
+
props.classes?.placeholder
|
|
9320
|
+
]);
|
|
8980
9321
|
/** Spec "Select" → States, Open: "chevron turned 180°", over `duration-base`. */
|
|
8981
|
-
const chevronClass = computed(() =>
|
|
9322
|
+
const chevronClass = computed(() => [
|
|
9323
|
+
"eldra:size-4.5 eldra:shrink-0 eldra:text-muted eldra:transition-transform eldra:duration-base",
|
|
9324
|
+
isOpen.value && "eldra:rotate-180",
|
|
9325
|
+
props.classes?.chevron
|
|
9326
|
+
]);
|
|
8982
9327
|
/**
|
|
8983
9328
|
* Spec "Select" → Anatomy, item 4: the clear button "is a separate `<button>` beside the chevron.
|
|
8984
9329
|
* **It is not inside the trigger.**" Which is also the only way it can exist — a `<button>` may not
|
|
8985
9330
|
* contain a `<button>` — so it is a sibling positioned over the trigger, after it in the DOM and
|
|
8986
9331
|
* therefore after it in the tab order, exactly as `Input`'s clear button is.
|
|
8987
9332
|
*/
|
|
8988
|
-
const clearButtonClass = computed(() =>
|
|
9333
|
+
const clearButtonClass = computed(() => [
|
|
9334
|
+
"eldra:absolute eldra:end-8 eldra:inset-y-0 eldra:my-auto eldra:inline-flex eldra:size-6 eldra:cursor-pointer eldra:items-center eldra:justify-center",
|
|
9335
|
+
"eldra:rounded-sm eldra:text-muted eldra:hover:text-text",
|
|
9336
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
9337
|
+
"eldra:eldra-focus",
|
|
9338
|
+
props.classes?.clearButton
|
|
9339
|
+
]);
|
|
8989
9340
|
/** The chosen option's mark in the trigger: the same two parts an option row draws it with. */
|
|
8990
9341
|
const triggerSwatchClass = computed(() => optionSwatchClass(props.classes));
|
|
8991
9342
|
const triggerIconClass = computed(() => optionIconClass(props.classes));
|
|
@@ -8996,12 +9347,15 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
8996
9347
|
"data-eldra-ui": "",
|
|
8997
9348
|
"data-eldra-scope": unref(eldra).scope,
|
|
8998
9349
|
"data-part": "root",
|
|
8999
|
-
class: normalizeClass(rootClass.
|
|
9350
|
+
class: normalizeClass([rootClass$2, _ctx.$attrs.class])
|
|
9000
9351
|
}, [
|
|
9001
9352
|
createElementVNode("button", mergeProps({
|
|
9002
9353
|
ref_key: "triggerRef",
|
|
9003
9354
|
ref: triggerRef
|
|
9004
|
-
},
|
|
9355
|
+
}, {
|
|
9356
|
+
..._ctx.$attrs,
|
|
9357
|
+
class: void 0
|
|
9358
|
+
}, {
|
|
9005
9359
|
"data-part": "trigger",
|
|
9006
9360
|
type: "button",
|
|
9007
9361
|
role: "combobox",
|
|
@@ -9030,11 +9384,13 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9030
9384
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
9031
9385
|
option: selectedOption.value,
|
|
9032
9386
|
open: unref(isOpen)
|
|
9033
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
9387
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
9034
9388
|
key: 0,
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9389
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
9390
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
9391
|
+
"aria-hidden": "true",
|
|
9392
|
+
focusable: "false"
|
|
9393
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$2)) : createCommentVNode("", true),
|
|
9038
9394
|
selectedOption.value ? (openBlock(), createElementBlock("span", {
|
|
9039
9395
|
key: 1,
|
|
9040
9396
|
class: normalizeClass(unref(TRIGGER_VALUE_STACK)),
|
|
@@ -9049,12 +9405,19 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9049
9405
|
class: normalizeClass(triggerSwatchClass.value),
|
|
9050
9406
|
style: normalizeStyle({ backgroundColor: selectedOption.value.swatch }),
|
|
9051
9407
|
"aria-hidden": "true"
|
|
9052
|
-
}, null, 6)) : selectedOption.value.icon ? (openBlock(), createBlock(
|
|
9408
|
+
}, null, 6)) : selectedOption.value.icon ? (openBlock(), createBlock(resolveDynamicComponent(selectedOption.value.icon), {
|
|
9053
9409
|
key: 1,
|
|
9410
|
+
"data-eldra-scope": unref(eldra).scope,
|
|
9054
9411
|
"data-part": "optionIcon",
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9412
|
+
class: normalizeClass(triggerIconClass.value),
|
|
9413
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
9414
|
+
"aria-hidden": "true",
|
|
9415
|
+
focusable: "false"
|
|
9416
|
+
}, null, 8, [
|
|
9417
|
+
"data-eldra-scope",
|
|
9418
|
+
"class",
|
|
9419
|
+
"stroke-width"
|
|
9420
|
+
])) : createCommentVNode("", true), createElementVNode("span", _hoisted_6$1, toDisplayString(selectedOption.value.label), 1)])], 10, _hoisted_5$1)], 10, _hoisted_4$1)) : (openBlock(), createElementBlock("span", {
|
|
9058
9421
|
key: 2,
|
|
9059
9422
|
"data-part": "placeholder",
|
|
9060
9423
|
class: normalizeClass(placeholderClass.value)
|
|
@@ -9065,7 +9428,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9065
9428
|
class: normalizeClass(chevronClass.value),
|
|
9066
9429
|
"aria-hidden": "true"
|
|
9067
9430
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
9068
|
-
class: "size-4.5",
|
|
9431
|
+
class: "eldra:size-4.5",
|
|
9069
9432
|
viewBox: "0 0 24 24",
|
|
9070
9433
|
fill: "none",
|
|
9071
9434
|
stroke: "currentColor",
|
|
@@ -9085,7 +9448,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9085
9448
|
"aria-labelledby": labelledBy.value ? `${clearId.value} ${labelledBy.value}` : void 0,
|
|
9086
9449
|
onClick: onClearClick
|
|
9087
9450
|
}, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
|
|
9088
|
-
class: "size-4",
|
|
9451
|
+
class: "eldra:size-4",
|
|
9089
9452
|
viewBox: "0 0 24 24",
|
|
9090
9453
|
fill: "none",
|
|
9091
9454
|
stroke: "currentColor",
|
|
@@ -9241,13 +9604,18 @@ var _hoisted_5 = ["data-eldra-scope", "aria-label"];
|
|
|
9241
9604
|
var _hoisted_6 = ["id"];
|
|
9242
9605
|
var MIN_ROWS = 3;
|
|
9243
9606
|
var MAX_ROWS = 10;
|
|
9244
|
-
var BASE = "block w-full min-w-0 resize-y eldra-field-border
|
|
9245
|
-
var
|
|
9246
|
-
var
|
|
9247
|
-
var
|
|
9248
|
-
var
|
|
9249
|
-
|
|
9250
|
-
|
|
9607
|
+
var BASE = "eldra:block eldra:w-full eldra:min-w-0 eldra:resize-y eldra:eldra-field-border eldra:placeholder:text-muted eldra:rounded-[var(--eldra-textarea-radius,var(--eldra-radius-md))] eldra:py-2 eldra:px-2.75 eldra:text-control eldra:max-md:text-control-mobile eldra:min-h-[var(--eldra-textarea-min-height)] eldra:max-h-64 eldra:overflow-y-auto eldra:field-sizing-content eldra:eldra-focus eldra:eldra-focus-always";
|
|
9608
|
+
var LIVE_FILL = "eldra:bg-background eldra:text-text";
|
|
9609
|
+
var READONLY_FILL = "eldra:bg-surface eldra:text-text";
|
|
9610
|
+
var INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
|
|
9611
|
+
var DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
9612
|
+
var rootClass$1 = "eldra:relative eldra:block eldra:w-full";
|
|
9613
|
+
/**
|
|
9614
|
+
* `Input`'s prefix and suffix rows, pinned to the first line rather than centred: 0.25rem from the
|
|
9615
|
+
* top puts a 2rem action's middle on the first line's middle (0.5rem padding plus half a 1.5rem
|
|
9616
|
+
* line). The control reserves one action's room on that side, as `Input`'s `md` size does.
|
|
9617
|
+
*/
|
|
9618
|
+
var ROW = "eldra:absolute eldra:top-1 eldra:flex eldra:h-8 eldra:items-center eldra:gap-1";
|
|
9251
9619
|
// src/components/textarea/Textarea.vue
|
|
9252
9620
|
var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
9253
9621
|
inheritAttrs: false,
|
|
@@ -9384,31 +9752,41 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9384
9752
|
immediate: true
|
|
9385
9753
|
});
|
|
9386
9754
|
/** Spec "Textarea" → Sizes and States, applied the same way Input.vue's BASE is. */
|
|
9755
|
+
const LIVE = `${LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
|
|
9756
|
+
const READONLY = `${READONLY_FILL} eldra:border-border`;
|
|
9757
|
+
/** See Input.vue: the danger boundary drops on a disabled field and stays on a read-only one. */
|
|
9387
9758
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
9388
|
-
/**
|
|
9389
|
-
* `eldra-field-invalid` draws its inset line at the *field's* radius, which it reads from
|
|
9390
|
-
* `--eldra-field-radius` (falling back to the Input's own `--eldra-input-radius`, then to
|
|
9391
|
-
* `radius-md`). A Textarea rounds by `--eldra-textarea-radius`, so it points the line's radius at
|
|
9392
|
-
* that one here rather than letting the line and the border round differently.
|
|
9393
|
-
*/
|
|
9394
|
-
const rootClass = computed(() => partClass(cx("relative block w-full [--eldra-field-radius:var(--eldra-textarea-radius,var(--eldra-radius-md))]", showsInvalid.value && "eldra-field-invalid"), props.classes, "root"));
|
|
9395
|
-
/**
|
|
9396
|
-
* `Input`'s prefix and suffix rows, pinned to the first line rather than centred: 0.25rem from the
|
|
9397
|
-
* top puts a 2rem action's middle on the first line's middle (0.5rem padding plus half a 1.5rem
|
|
9398
|
-
* line). The control reserves one action's room on that side, as `Input`'s `md` size does.
|
|
9399
|
-
*/
|
|
9400
9759
|
const hasPrefix = computed(() => slots.prefix !== void 0);
|
|
9401
9760
|
/** Shown while there is a value, and never on a field that cannot be edited — as `Input`'s is. */
|
|
9402
9761
|
const showClear = computed(() => props.clearable && !props.disabled && !props.readonly && model.value.length > 0);
|
|
9403
9762
|
const hasSuffix = computed(() => showClear.value || slots.suffix !== void 0);
|
|
9404
|
-
const prefixClass = computed(() =>
|
|
9405
|
-
|
|
9406
|
-
|
|
9763
|
+
const prefixClass = computed(() => [
|
|
9764
|
+
ROW,
|
|
9765
|
+
"eldra:start-1",
|
|
9766
|
+
props.classes?.prefix
|
|
9767
|
+
]);
|
|
9768
|
+
const suffixClass = computed(() => [
|
|
9769
|
+
ROW,
|
|
9770
|
+
"eldra:end-1",
|
|
9771
|
+
props.classes?.suffix
|
|
9772
|
+
]);
|
|
9773
|
+
const clearButtonClass = computed(() => [
|
|
9774
|
+
FIELD_CLEAR_BUTTON,
|
|
9775
|
+
FIELD_CLEAR_SIZE.md,
|
|
9776
|
+
props.classes?.clearButton
|
|
9777
|
+
]);
|
|
9407
9778
|
const prefixRef = ref(null);
|
|
9408
9779
|
const suffixRef = ref(null);
|
|
9409
9780
|
const prefixRoom = useAdornmentRoom(prefixRef, () => FIELD_ACTION_ROOM_REM.md);
|
|
9410
9781
|
const suffixRoom = useAdornmentRoom(suffixRef, () => FIELD_ACTION_ROOM_REM.md);
|
|
9411
|
-
const controlClass = computed(() =>
|
|
9782
|
+
const controlClass = computed(() => [
|
|
9783
|
+
BASE,
|
|
9784
|
+
hasPrefix.value && "eldra:ps-10",
|
|
9785
|
+
hasSuffix.value && "eldra:pe-10",
|
|
9786
|
+
props.disabled ? DISABLED : props.readonly ? showsInvalid.value ? `${READONLY_FILL} ${INVALID}` : READONLY : showsInvalid.value ? `${LIVE_FILL} ${INVALID}` : LIVE,
|
|
9787
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
9788
|
+
props.classes?.control
|
|
9789
|
+
]);
|
|
9412
9790
|
/** Spec "Textarea" → Properties, `counter`: shows only once there is something to count against. */
|
|
9413
9791
|
const showCounter = computed(() => props.counter && props.maxLength !== void 0);
|
|
9414
9792
|
/**
|
|
@@ -9420,8 +9798,12 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9420
9798
|
const length = computed(() => model.value.length);
|
|
9421
9799
|
/** Spec "Textarea" → States, Error row: "counter `danger` weight 600" once past the limit. */
|
|
9422
9800
|
const isOverLimit = computed(() => props.maxLength !== void 0 && length.value > props.maxLength);
|
|
9423
|
-
const footClass = computed(() =>
|
|
9424
|
-
const counterClass = computed(() =>
|
|
9801
|
+
const footClass = computed(() => ["eldra:mt-1 eldra:flex eldra:flex-wrap eldra:items-baseline eldra:gap-x-3 eldra:gap-y-1", props.classes?.foot]);
|
|
9802
|
+
const counterClass = computed(() => [
|
|
9803
|
+
"eldra:text-counter eldra:ms-auto eldra:shrink-0 eldra:tabular-nums eldra:whitespace-nowrap",
|
|
9804
|
+
isOverLimit.value ? "eldra:text-danger eldra:font-semibold" : "eldra:text-muted eldra:font-normal",
|
|
9805
|
+
props.classes?.counter
|
|
9806
|
+
]);
|
|
9425
9807
|
/**
|
|
9426
9808
|
* Spec "Textarea" → Behaviour & motion: "one polite, visually hidden live region announces once
|
|
9427
9809
|
* when the count reaches 80% of the limit ('20 characters left') and once when the limit is passed
|
|
@@ -9489,7 +9871,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9489
9871
|
"data-eldra-ui": "",
|
|
9490
9872
|
"data-eldra-scope": unref(eldra).scope,
|
|
9491
9873
|
"data-part": "root",
|
|
9492
|
-
class: normalizeClass(rootClass.
|
|
9874
|
+
class: normalizeClass([rootClass$1, _ctx.$attrs.class])
|
|
9493
9875
|
}, [
|
|
9494
9876
|
hasPrefix.value ? (openBlock(), createElementBlock("span", {
|
|
9495
9877
|
key: 0,
|
|
@@ -9502,7 +9884,10 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9502
9884
|
createElementVNode("textarea", mergeProps({
|
|
9503
9885
|
ref_key: "controlRef",
|
|
9504
9886
|
ref: controlRef
|
|
9505
|
-
},
|
|
9887
|
+
}, {
|
|
9888
|
+
..._ctx.$attrs,
|
|
9889
|
+
class: void 0
|
|
9890
|
+
}, {
|
|
9506
9891
|
"data-part": "control",
|
|
9507
9892
|
class: controlClass.value,
|
|
9508
9893
|
style: controlStyle.value,
|
|
@@ -9536,7 +9921,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9536
9921
|
"aria-label": unref(m).clear,
|
|
9537
9922
|
onClick: onClear
|
|
9538
9923
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
9539
|
-
class: "size-4.5",
|
|
9924
|
+
class: "eldra:size-4.5",
|
|
9540
9925
|
viewBox: "0 0 24 24",
|
|
9541
9926
|
fill: "none",
|
|
9542
9927
|
stroke: "currentColor",
|
|
@@ -9576,30 +9961,38 @@ var _hoisted_2 = [
|
|
|
9576
9961
|
];
|
|
9577
9962
|
var _hoisted_3 = {
|
|
9578
9963
|
key: 0,
|
|
9579
|
-
class: "sr-only"
|
|
9964
|
+
class: "eldra:sr-only"
|
|
9580
9965
|
};
|
|
9581
|
-
var
|
|
9966
|
+
var rootClass = "eldra:block eldra:min-w-0 eldra:rounded-none eldra:border-0 eldra:p-0";
|
|
9967
|
+
/**
|
|
9968
|
+
* Spec "Variant picker" → Anatomy, point 2: "the option name (weight 600) + the current value
|
|
9969
|
+
* (weight 400, `muted`), with a 0.5rem gap, baseline-aligned." `text-variant-legend` carries only
|
|
9970
|
+
* the size and line — see its own comment in `tailwind.css` for why the two weights cannot live in
|
|
9971
|
+
* one shorthand `font` declaration — so `font-semibold`/`text-text` here and `font-normal`/
|
|
9972
|
+
* `text-muted` on `legendValue` below are what split it into the spec's two runs.
|
|
9973
|
+
*/
|
|
9974
|
+
var PILL_BASE = "eldra:relative eldra:inline-flex eldra:min-w-12 eldra:items-center eldra:justify-center eldra:control-h eldra:rounded-md eldra:px-4 eldra:eldra-variant-pill-border eldra:eldra-focus eldra:eldra-focus-proxy";
|
|
9582
9975
|
/** Spec "Variant picker" → States, table rows "Default"/"Hover": `background` fill, 1px
|
|
9583
9976
|
* `border-strong` at rest, 1px `text` on hover. */
|
|
9584
|
-
var PILL_DEFAULT = "bg-background border-border-strong group-hover:border-text";
|
|
9977
|
+
var PILL_DEFAULT = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text";
|
|
9585
9978
|
/** States, "Selected" row: `primary` fill and border. The fill alone already carries the state, so
|
|
9586
9979
|
* the 1px border underneath the (invisible-against-the-fill) real border needs no colour of its
|
|
9587
9980
|
* own beyond matching the fill. */
|
|
9588
|
-
var PILL_SELECTED = "bg-primary border-primary";
|
|
9981
|
+
var PILL_SELECTED = "eldra:bg-primary eldra:border-primary";
|
|
9589
9982
|
/** States, "Sold out" row: `background` fill, 1px **dashed** `border-strong` — the diagonal line
|
|
9590
9983
|
* itself is the separate `soldOutLine` part, drawn on top. */
|
|
9591
|
-
var PILL_SOLD_OUT = "bg-background border-dashed border-border-strong group-hover:border-text";
|
|
9984
|
+
var PILL_SOLD_OUT = "eldra:bg-background eldra:border-dashed eldra:border-border-strong eldra:group-hover:border-text";
|
|
9592
9985
|
/** States, "Sold out + selected" row: `surface-strong` fill, **2px** solid `text`. The real border
|
|
9593
9986
|
* and the `eldra-variant-pill-selected-line` inset line share the same `text` colour so the two
|
|
9594
9987
|
* 1px layers read as one 2px boundary rather than two different-coloured rings. */
|
|
9595
|
-
var PILL_SOLD_OUT_SELECTED = "bg-surface-strong border-text eldra-variant-pill-selected-line";
|
|
9596
|
-
var SWATCH_BASE = "relative inline-flex size-11 shrink-0 items-center justify-center rounded-full p-0.75 eldra-variant-swatch-ring eldra-focus eldra-focus-proxy";
|
|
9988
|
+
var PILL_SOLD_OUT_SELECTED = "eldra:bg-surface-strong eldra:border-text eldra:eldra-variant-pill-selected-line";
|
|
9989
|
+
var SWATCH_BASE = "eldra:relative eldra:inline-flex eldra:size-11 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:rounded-full eldra:p-0.75 eldra:eldra-variant-swatch-ring eldra:eldra-focus eldra:eldra-focus-proxy";
|
|
9597
9990
|
/** States, "Swatch" column, "Default"/"Hover" rows: transparent at rest, `border-strong` ring on
|
|
9598
9991
|
* hover. */
|
|
9599
|
-
var SWATCH_RING_DEFAULT = "border-transparent group-hover:border-border-strong";
|
|
9992
|
+
var SWATCH_RING_DEFAULT = "eldra:border-transparent eldra:group-hover:border-border-strong";
|
|
9600
9993
|
/** States, "Selected" and "Sold out + selected" rows: "2px ring `text`" either way — the sold-out
|
|
9601
9994
|
* line is a separate part drawn on top, so the ring itself only ever depends on selection. */
|
|
9602
|
-
var SWATCH_RING_SELECTED = "border-text";
|
|
9995
|
+
var SWATCH_RING_SELECTED = "eldra:border-text";
|
|
9603
9996
|
// src/components/variant-picker/VariantPicker.vue
|
|
9604
9997
|
var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
9605
9998
|
__name: "VariantPicker",
|
|
@@ -9678,24 +10071,16 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9678
10071
|
* Spec "Variant picker" → Anatomy: "no border or padding." `min-w-0` keeps a long label or a
|
|
9679
10072
|
* narrow container (the `Narrow` story) from forcing the fieldset wider than its own column.
|
|
9680
10073
|
*/
|
|
9681
|
-
const
|
|
9682
|
-
|
|
9683
|
-
* Spec "Variant picker" → Anatomy, point 2: "the option name (weight 600) + the current value
|
|
9684
|
-
* (weight 400, `muted`), with a 0.5rem gap, baseline-aligned." `text-variant-legend` carries only
|
|
9685
|
-
* the size and line — see its own comment in `tailwind.css` for why the two weights cannot live in
|
|
9686
|
-
* one shorthand `font` declaration — so `font-semibold`/`text-text` here and `font-normal`/
|
|
9687
|
-
* `text-muted` on `legendValue` below are what split it into the spec's two runs.
|
|
9688
|
-
*/
|
|
9689
|
-
const legendClass = computed(() => partClass(cx("mb-3 flex w-fit items-baseline gap-2 text-variant-legend font-semibold text-text"), props.classes, "legend"));
|
|
9690
|
-
const legendValueClass = computed(() => partClass(cx("text-variant-legend font-normal text-muted"), props.classes, "legendValue"));
|
|
10074
|
+
const legendClass = computed(() => ["eldra:mb-3 eldra:flex eldra:w-fit eldra:items-baseline eldra:gap-2 eldra:text-variant-legend eldra:font-semibold eldra:text-text", props.classes?.legend]);
|
|
10075
|
+
const legendValueClass = computed(() => ["eldra:text-variant-legend eldra:font-normal eldra:text-muted", props.classes?.legendValue]);
|
|
9691
10076
|
/** Spec "Variant picker" → Anatomy, point 3: "wraps, 0.5rem (`space-2`) gap." */
|
|
9692
|
-
const optionsClass = computed(() =>
|
|
10077
|
+
const optionsClass = computed(() => ["eldra:flex eldra:flex-wrap eldra:gap-2", props.classes?.options]);
|
|
9693
10078
|
/**
|
|
9694
10079
|
* Spec "Variant picker" → Anatomy, point 4: "a `<label>` holding a native radio … and the visible
|
|
9695
10080
|
* pill or swatch." `group` is what lets `radio`'s own hover state read `group-hover:*` below,
|
|
9696
10081
|
* exactly as `RadioGroup`'s row does.
|
|
9697
10082
|
*/
|
|
9698
|
-
const optionClass = computed(() =>
|
|
10083
|
+
const optionClass = computed(() => ["eldra:group eldra:inline-flex eldra:cursor-pointer", props.classes?.option]);
|
|
9699
10084
|
/**
|
|
9700
10085
|
* The drawn pill (spec "Variant picker" → Sizes, Pill row: "min 2.5rem (`control-height`), min
|
|
9701
10086
|
* width 3rem | 0 1rem (`space-4`) | … | `radius-md`"). The native radio is `opacity-0` and
|
|
@@ -9712,8 +10097,8 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9712
10097
|
* selected, `text` sold-out-and-selected. Same shorthand-free reasoning as the legend above. */
|
|
9713
10098
|
function pillLabelState(option) {
|
|
9714
10099
|
const selected = isSelected(option.value);
|
|
9715
|
-
if (!option.available) return selected ? "font-semibold text-text" : "font-medium text-muted";
|
|
9716
|
-
return selected ? "font-semibold text-primary-contrast" : "font-medium text-text";
|
|
10100
|
+
if (!option.available) return selected ? "eldra:font-semibold eldra:text-text" : "eldra:font-medium eldra:text-muted";
|
|
10101
|
+
return selected ? "eldra:font-semibold eldra:text-primary-contrast" : "eldra:font-medium eldra:text-text";
|
|
9717
10102
|
}
|
|
9718
10103
|
/**
|
|
9719
10104
|
* The swatch's own ring (spec "Variant picker" → Sizes, Swatch row: "2.75 × 2.75rem outer; a 2px
|
|
@@ -9725,7 +10110,7 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9725
10110
|
* native radio and the proxy focus ring live on this same shape, same as the pill above.
|
|
9726
10111
|
*/
|
|
9727
10112
|
function radioClass(option) {
|
|
9728
|
-
return
|
|
10113
|
+
return [props.type === "swatches" ? [SWATCH_BASE, isSelected(option.value) ? SWATCH_RING_SELECTED : SWATCH_RING_DEFAULT] : [PILL_BASE, pillState(option)], props.classes?.radio];
|
|
9729
10114
|
}
|
|
9730
10115
|
/**
|
|
9731
10116
|
* The colour disc (spec "Variant picker" → Sizes, Swatch row: "the colour disc with a 1px inner
|
|
@@ -9735,20 +10120,24 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9735
10120
|
* own comment in `tailwind.css`. The one per-item colour the spec allows (`swatch`, from product
|
|
9736
10121
|
* data) is set as an inline style by the caller of this function, never a class.
|
|
9737
10122
|
*/
|
|
9738
|
-
const swatchClass = computed(() =>
|
|
10123
|
+
const swatchClass = computed(() => ["eldra:block eldra:size-full eldra:rounded-full eldra:border-border-strong eldra:eldra-variant-swatch-edge", props.classes?.swatch]);
|
|
9739
10124
|
/**
|
|
9740
10125
|
* Spec "Variant picker" → Sizes, Pill row: "0.9375rem, 500 (600 selected)." `text-variant-pill`
|
|
9741
10126
|
* carries only the size and line, for the same shorthand-free reason `text-variant-legend` does.
|
|
9742
10127
|
*/
|
|
9743
10128
|
function pillLabelClass(option) {
|
|
9744
|
-
return
|
|
10129
|
+
return [
|
|
10130
|
+
"eldra:text-variant-pill",
|
|
10131
|
+
pillLabelState(option),
|
|
10132
|
+
props.classes?.label
|
|
10133
|
+
];
|
|
9745
10134
|
}
|
|
9746
10135
|
/**
|
|
9747
10136
|
* Spec "Variant picker" → Variants, Swatches row: "The colour name lives in visually hidden text
|
|
9748
10137
|
* inside the label"; → Accessibility: "the colour name is visually hidden text inside the label, so
|
|
9749
10138
|
* it isn't conveyed by colour alone (1.4.1)."
|
|
9750
10139
|
*/
|
|
9751
|
-
const swatchLabelClass = computed(() =>
|
|
10140
|
+
const swatchLabelClass = computed(() => ["eldra:sr-only", props.classes?.label]);
|
|
9752
10141
|
function labelClass(option) {
|
|
9753
10142
|
return props.type === "swatches" ? swatchLabelClass.value : pillLabelClass(option);
|
|
9754
10143
|
}
|
|
@@ -9766,20 +10155,20 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9766
10155
|
* at (34.73, 9.27) and (9.27, 34.73) of a 44-unit box — (78.9, 21.1) and (21.1, 78.9) as the
|
|
9767
10156
|
* percentages `viewBox="0 0 100 100"` reads directly.
|
|
9768
10157
|
*/
|
|
9769
|
-
const soldOutSwatchLineClass = computed(() =>
|
|
10158
|
+
const soldOutSwatchLineClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:inset-0 eldra:size-full eldra:text-text", props.classes?.soldOutLine]);
|
|
9770
10159
|
/**
|
|
9771
10160
|
* The pill's sold-out diagonal line (spec "Variant picker" → States, Sold out row: "a 1px
|
|
9772
10161
|
* diagonal `border-strong` line (bottom-left to top-right)"), on the `<svg>` in the template
|
|
9773
10162
|
* below — see its own comment in `tailwind.css` for why a pill's line is an SVG rather than a
|
|
9774
10163
|
* class-only utility. `text-border-strong` sets the `currentColor` the `<line>` strokes with.
|
|
9775
10164
|
*/
|
|
9776
|
-
const soldOutPillLineClass = computed(() =>
|
|
10165
|
+
const soldOutPillLineClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:inset-0 eldra:size-full eldra:text-border-strong", props.classes?.soldOutLine]);
|
|
9777
10166
|
return (_ctx, _cache) => {
|
|
9778
10167
|
return openBlock(), createElementBlock("fieldset", {
|
|
9779
10168
|
"data-eldra-ui": "",
|
|
9780
10169
|
"data-eldra-scope": unref(eldra).scope,
|
|
9781
10170
|
"data-part": "root",
|
|
9782
|
-
class: normalizeClass(rootClass
|
|
10171
|
+
class: normalizeClass(rootClass)
|
|
9783
10172
|
}, [createElementVNode("legend", {
|
|
9784
10173
|
"data-part": "legend",
|
|
9785
10174
|
class: normalizeClass(legendClass.value)
|
|
@@ -9801,7 +10190,7 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9801
10190
|
createElementVNode("input", {
|
|
9802
10191
|
ref_for: true,
|
|
9803
10192
|
ref: (el) => radioRefs.value[index] = el,
|
|
9804
|
-
class: "absolute inset-0 m-0 size-full cursor-pointer appearance-none opacity-0",
|
|
10193
|
+
class: "eldra:absolute eldra:inset-0 eldra:m-0 eldra:size-full eldra:cursor-pointer eldra:appearance-none eldra:opacity-0",
|
|
9805
10194
|
type: "radio",
|
|
9806
10195
|
name: __props.name,
|
|
9807
10196
|
value: option.value,
|
|
@@ -9863,8 +10252,8 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9863
10252
|
class: normalizeClass(labelClass(option))
|
|
9864
10253
|
}, [createTextVNode(toDisplayString(option.label), 1), !option.available ? (openBlock(), createElementBlock("span", _hoisted_3, ", " + toDisplayString(soldOutSuffix.value), 1)) : createCommentVNode("", true)], 2)
|
|
9865
10254
|
], 2)], 2);
|
|
9866
|
-
}), 128))], 2)],
|
|
10255
|
+
}), 128))], 2)], 8, _hoisted_1);
|
|
9867
10256
|
};
|
|
9868
10257
|
}
|
|
9869
10258
|
});
|
|
9870
|
-
export {
|
|
10259
|
+
export { parseLocaleNumber as $, focusInvalid as A, joinIds as At, FIELD_CLEAR_BUTTON_BOX as B, topLayerDialog as C, FORM_LAYOUT_KEY as Ct, normalizeText as D, ELDRA_SCOPE_KEY as Dt, matchRange as E, useControllableModel as Et, defaultCharacterMeaning as F, createNumberFormat as G, FIELD_LIVE as H, stripMask as I, defaultUnitFormat as J, currencyFractionDigits as K, CurrencyInput_default as L, filterNumericBeforeInput as M, Input_default as N, useListbox as O, provideEldraScope as Ot, applyMask as P, localeSeparators as Q, UnitInput_default as R, useOverlay as S, ICON_STROKE_WIDTH as St, useFloating$1 as T, mergeClass as Tt, FIELD_SEARCH_APPEARANCE as U, FIELD_DISABLED as V, FIELD_SIZE as W, formatNumber as X, formatCurrency as Y, formatUnit as Z, optionCursor as _, FIELD_KEY as _t, claimShortcut as a, provideEldraUiCurrency as at, MultiSelect_default as b, Icon_default as bt, SearchResultsPanel_default as c, useEldraUiLocale as ct, INPUT as d, tagPadding as dt, useSlotPresence as et, PLAIN_BOX_ONLY as f, CheckboxGroup_default as ft, labelRecipe as g, FieldError_default as gt, dotRecipe as h, RequiredMark_default as ht, SearchBar_default as i, LOCALE_KEY as it, Switch_default as j, useUiId as jt, FormLayout_default as k, useEldraScope as kt, RadioGroup_default as l, TAG_FILL as lt, PLAIN_OPTION as m, VisuallyHidden_default as mt, Textarea_default as n, CURRENCY_KEY as nt, ownsShortcut as o, provideEldraUiLocale as ot, PLAIN_COLUMNS as p, Checkbox_default as pt, currencySymbol as q, Select_default as r, DEFAULT_UI_LOCALE as rt, releaseShortcut as s, useEldraUiCurrency as st, VariantPicker_default as t, useHeadingTag as tt, HINT as u, TAG_SHAPE as ut, radioRecipe as v, Button_default as vt, useTeleportTarget as w, FORM_SUBMITTING_KEY as wt, usePopover as x, ICON_SIZE_CLASS as xt, QuantityStepper_default as y, Spinner_default as yt, FIELD_BASE as z };
|