@eldrajs/ui 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +113 -122
- package/dist/{VariantPicker-Da41_oGA.js → VariantPicker-C-9sMXGI.js} +1188 -798
- 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 +2 -2
- package/dist/components/skeleton/types.d.ts +4 -4
- 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 +1422 -2310
- package/dist/composables/useEldraScope.d.ts +7 -9
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1357 -880
- package/dist/style.css +1427 -2315
- package/dist/tailwind.css +11 -2234
- package/dist/theme.css +108 -0
- package/dist/tokens.css +1 -0
- package/dist/utilities.css +2160 -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,206 @@ 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
|
+
],
|
|
189
|
+
"min-h": [
|
|
190
|
+
"eldra-range-rail",
|
|
191
|
+
"eldra-drawer-header-height",
|
|
192
|
+
"eldra-nav-menu-drawer-row"
|
|
193
|
+
],
|
|
194
|
+
px: [
|
|
195
|
+
"eldra-range-gutter",
|
|
196
|
+
"eldra-range-gutter-thumb",
|
|
197
|
+
"eldra-drawer-gutter"
|
|
198
|
+
],
|
|
199
|
+
w: [
|
|
200
|
+
"eldra-dialog-width",
|
|
201
|
+
"eldra-dialog-width-sm",
|
|
202
|
+
"eldra-drawer-width",
|
|
203
|
+
"eldra-toast-width",
|
|
204
|
+
"eldra-search-modal-width"
|
|
205
|
+
],
|
|
206
|
+
size: [
|
|
207
|
+
"eldra-avatar-icon-sm",
|
|
208
|
+
"eldra-avatar-icon-md",
|
|
209
|
+
"eldra-avatar-icon-lg",
|
|
210
|
+
"eldra-avatar-icon-xl"
|
|
211
|
+
],
|
|
212
|
+
"target-min": ["target-min"],
|
|
213
|
+
"target-touch": ["target-touch"],
|
|
214
|
+
"eldra-scrollbar-hide": ["eldra-scrollbar-hide"],
|
|
215
|
+
transition: ["eldra-transition-colors"],
|
|
216
|
+
"border-w": [
|
|
217
|
+
"eldra-field-border",
|
|
218
|
+
"eldra-button-border",
|
|
219
|
+
"eldra-checkbox-border",
|
|
220
|
+
"eldra-checkbox-border-invalid",
|
|
221
|
+
"eldra-radio-card-border",
|
|
222
|
+
"eldra-switch-track-border",
|
|
223
|
+
"eldra-variant-pill-border",
|
|
224
|
+
"eldra-variant-swatch-ring",
|
|
225
|
+
"eldra-variant-swatch-edge",
|
|
226
|
+
"eldra-filter-swatch-ring",
|
|
227
|
+
"eldra-editor-placeholder-border"
|
|
228
|
+
],
|
|
229
|
+
"eldra-field-invalid": ["eldra-field-invalid"],
|
|
230
|
+
"eldra-radio-card-selected": ["eldra-radio-card-selected"],
|
|
231
|
+
"eldra-switch-thumb-offset": ["eldra-switch-thumb-offset"],
|
|
232
|
+
"max-h": [
|
|
233
|
+
"eldra-select-panel-height",
|
|
234
|
+
"eldra-search-panel-height",
|
|
235
|
+
"eldra-dialog-max-height",
|
|
236
|
+
"eldra-search-modal-max-height"
|
|
237
|
+
],
|
|
238
|
+
m: ["eldra-search-modal-position"],
|
|
239
|
+
"max-w": [
|
|
240
|
+
"eldra-select-panel-width",
|
|
241
|
+
"eldra-container-narrow",
|
|
242
|
+
"eldra-container-content",
|
|
243
|
+
"eldra-container-wide"
|
|
244
|
+
],
|
|
245
|
+
"eldra-select-match": ["eldra-select-match"],
|
|
246
|
+
"eldra-select-swatch": ["eldra-select-swatch"],
|
|
247
|
+
"eldra-select-option-active": ["eldra-select-option-active"],
|
|
248
|
+
"eldra-select-option-selected": ["eldra-select-option-selected"],
|
|
249
|
+
"eldra-variant-pill-selected-line": ["eldra-variant-pill-selected-line"],
|
|
250
|
+
"eldra-focus": ["eldra-focus", "eldra-focus-inset"],
|
|
251
|
+
"eldra-focus-always": ["eldra-focus-always", "eldra-focus-inset-always"],
|
|
252
|
+
"eldra-focus-proxy": ["eldra-focus-proxy"],
|
|
253
|
+
"eldra-focus-open": ["eldra-focus-open"],
|
|
254
|
+
rounded: ["eldra-link-radius", "eldra-select-check-radius"],
|
|
255
|
+
duration: [
|
|
256
|
+
"duration-fast",
|
|
257
|
+
"duration-base",
|
|
258
|
+
"duration-slow"
|
|
259
|
+
],
|
|
260
|
+
opacity: ["eldra-revalidating"],
|
|
261
|
+
"eldra-skeleton": ["eldra-skeleton"],
|
|
262
|
+
"eldra-rating-half": ["eldra-rating-half"],
|
|
263
|
+
"eldra-image-placeholder-hatch": ["eldra-image-placeholder-hatch"],
|
|
264
|
+
"eldra-tooltip-arrow": ["eldra-tooltip-arrow"],
|
|
265
|
+
z: [
|
|
266
|
+
"z-sticky",
|
|
267
|
+
"z-popover",
|
|
268
|
+
"z-drawer",
|
|
269
|
+
"z-dialog",
|
|
270
|
+
"z-toast"
|
|
271
|
+
],
|
|
272
|
+
"eldra-accordion-chevron": ["eldra-accordion-chevron"],
|
|
273
|
+
"eldra-accordion-panel": ["eldra-accordion-panel"],
|
|
274
|
+
"eldra-carousel-slide": ["eldra-carousel-slide"],
|
|
275
|
+
"eldra-carousel-track": ["eldra-carousel-track"],
|
|
276
|
+
"eldra-carousel-dot": ["eldra-carousel-dot"],
|
|
277
|
+
"eldra-range-thumb": ["eldra-range-thumb"],
|
|
278
|
+
"eldra-filter-swatch-edge": ["eldra-filter-swatch-edge"],
|
|
279
|
+
"eldra-filter-histogram-bar": ["eldra-filter-histogram-bar"],
|
|
280
|
+
pt: ["eldra-nav-menu-panel", "eldra-drawer-header-top"],
|
|
281
|
+
"grid-cols": ["eldra-nav-menu-columns"],
|
|
282
|
+
"eldra-nav-menu-dropdown": ["eldra-nav-menu-dropdown"],
|
|
283
|
+
ps: ["eldra-nav-menu-drawer-nest"],
|
|
284
|
+
pb: [
|
|
285
|
+
"eldra-drawer-header-bottom",
|
|
286
|
+
"eldra-drawer-body-bottom",
|
|
287
|
+
"eldra-drawer-footer-bottom"
|
|
288
|
+
],
|
|
289
|
+
animate: [
|
|
290
|
+
"animate-eldra-spin",
|
|
291
|
+
"animate-eldra-pulse",
|
|
292
|
+
"animate-eldra-popover-in",
|
|
293
|
+
"animate-eldra-dialog-in",
|
|
294
|
+
"animate-eldra-dialog-in-reduced",
|
|
295
|
+
"animate-eldra-drawer-in-right",
|
|
296
|
+
"animate-eldra-drawer-in-left",
|
|
297
|
+
"animate-eldra-toast-in",
|
|
298
|
+
"animate-eldra-lightbox-in"
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
prefix: "eldra"
|
|
303
|
+
});
|
|
304
|
+
/** The component's own classes with `incoming` (a parent component's) merged over them. */
|
|
305
|
+
function mergeClass(own, incoming) {
|
|
306
|
+
return kitMerge(normalizeClass([own, incoming]));
|
|
307
|
+
}
|
|
371
308
|
// src/components/form-layout/context.ts
|
|
372
309
|
/**
|
|
373
310
|
* Whether the form this subtree belongs to is currently submitting.
|
|
@@ -408,10 +345,10 @@ var FORM_LAYOUT_KEY = Symbol("eldra-form-layout");
|
|
|
408
345
|
* literal length appears here or in the built CSS.
|
|
409
346
|
*/
|
|
410
347
|
var ICON_SIZE_CLASS = {
|
|
411
|
-
sm: "size-4",
|
|
412
|
-
md: "size-5",
|
|
413
|
-
lg: "size-6",
|
|
414
|
-
xl: "size-8"
|
|
348
|
+
sm: "eldra:size-4",
|
|
349
|
+
md: "eldra:size-5",
|
|
350
|
+
lg: "eldra:size-6",
|
|
351
|
+
xl: "eldra:size-8"
|
|
415
352
|
};
|
|
416
353
|
/** The spec's outline stroke weight. */
|
|
417
354
|
var ICON_STROKE_WIDTH = 1.75;
|
|
@@ -421,13 +358,12 @@ var Icon_default = /* @__PURE__ */ defineComponent({
|
|
|
421
358
|
props: {
|
|
422
359
|
icon: {},
|
|
423
360
|
size: { default: "md" },
|
|
424
|
-
label: { default: void 0 }
|
|
425
|
-
classes: { default: void 0 }
|
|
361
|
+
label: { default: void 0 }
|
|
426
362
|
},
|
|
427
363
|
setup(__props) {
|
|
428
364
|
const eldra = useEldraScope();
|
|
429
365
|
const props = __props;
|
|
430
|
-
const rootClass = computed(() =>
|
|
366
|
+
const rootClass = computed(() => [ICON_SIZE_CLASS[props.size], "eldra:shrink-0"]);
|
|
431
367
|
return (_ctx, _cache) => {
|
|
432
368
|
return openBlock(), createBlock(resolveDynamicComponent(__props.icon), {
|
|
433
369
|
"data-eldra-ui": "",
|
|
@@ -461,7 +397,7 @@ var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
|
461
397
|
return openBlock(), createElementBlock("svg", {
|
|
462
398
|
"data-eldra-ui": "",
|
|
463
399
|
"data-eldra-scope": unref(eldra).scope,
|
|
464
|
-
class: "animate-eldra-spin motion-reduce:animate-eldra-pulse",
|
|
400
|
+
class: "eldra:animate-eldra-spin eldra:motion-reduce:animate-eldra-pulse",
|
|
465
401
|
viewBox: "0 0 18 18",
|
|
466
402
|
fill: "none",
|
|
467
403
|
"aria-hidden": "true",
|
|
@@ -486,24 +422,30 @@ var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
|
486
422
|
var _hoisted_1$18 = ["data-eldra-slot"];
|
|
487
423
|
var _hoisted_2$16 = ["data-eldra-slot"];
|
|
488
424
|
var _hoisted_3$15 = ["data-eldra-slot"];
|
|
489
|
-
var BASE$1 = "relative inline-flex items-center justify-center
|
|
425
|
+
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";
|
|
426
|
+
/** The border (`--eldra-button-border-width`, default 1px, see `eldra-button-border`) and no
|
|
427
|
+
* underline, except `link`, which is a borderless underlined line box. */
|
|
428
|
+
var BOX$1 = "eldra:eldra-button-border eldra:no-underline";
|
|
429
|
+
var LINK_BOX = "eldra:border-0";
|
|
490
430
|
/**
|
|
491
431
|
* Sizes (spec "Button" → Sizes). `--spacing` is 0.25rem, so `px-3`/`px-4.5`/`px-6` are the spec's
|
|
492
432
|
* 0.75/1.125/1.5rem and `gap-1.5`/`gap-2` its 0.375/0.5rem.
|
|
493
433
|
*/
|
|
494
|
-
var FILLED_DISABLED = "bg-surface-strong text-muted border-transparent
|
|
495
|
-
var PRESS = "active:scale-[0.98] motion-reduce:active:scale-100";
|
|
434
|
+
var FILLED_DISABLED = "eldra:bg-surface-strong eldra:text-muted eldra:border-transparent";
|
|
435
|
+
var PRESS = "eldra:active:scale-[0.98] eldra:motion-reduce:active:scale-100";
|
|
496
436
|
/**
|
|
497
437
|
* The toggle-pressed fill (spec "Button" → States, toggle pressed): `surface-strong` with the
|
|
498
438
|
* `border-strong` boundary. The spec gives it to `outline`; `ghost` takes the same look, because a
|
|
499
439
|
* ghost toggle in a toolbar (bold, italic, a view switch) has no other way to show it is on, and
|
|
500
440
|
* 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,
|
|
441
|
+
* fill alone would not be. Only `pressed === true` draws it, in place of the variant's `FILL`, so
|
|
442
|
+
* `aria-pressed="true"` and the look always go together. The filled variants already carry a fill,
|
|
443
|
+
* and `link` is a line box.
|
|
503
444
|
*/
|
|
504
|
-
var PRESSED_FILL = "bg-surface-strong border-border-strong";
|
|
445
|
+
var PRESSED_FILL = "eldra:bg-surface-strong eldra:border-border-strong";
|
|
505
446
|
// src/components/button/Button.vue
|
|
506
447
|
var Button_default = /* @__PURE__ */ defineComponent({
|
|
448
|
+
inheritAttrs: false,
|
|
507
449
|
__name: "Button",
|
|
508
450
|
props: {
|
|
509
451
|
variant: {},
|
|
@@ -549,9 +491,15 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
549
491
|
const props = __props;
|
|
550
492
|
const emit = __emit;
|
|
551
493
|
const slots = useSlots();
|
|
494
|
+
/** `class` is merged into the container's own; every other attribute lands on it as before. */
|
|
495
|
+
const attrs = useAttrs();
|
|
496
|
+
const forwardedAttrs = computed(() => {
|
|
497
|
+
const { class: _class, ...rest } = attrs;
|
|
498
|
+
return rest;
|
|
499
|
+
});
|
|
552
500
|
/**
|
|
553
|
-
* Shared box (spec "Button" → Anatomy and Behaviour & motion):
|
|
554
|
-
* colour, `radius-md` through the component's own variable, and the one focus ring.
|
|
501
|
+
* Shared box (spec "Button" → Anatomy and Behaviour & motion): a border that a variant may
|
|
502
|
+
* colour (see `BOX`), `radius-md` through the component's own variable, and the one focus ring.
|
|
555
503
|
*
|
|
556
504
|
* There is deliberately no `transition-*`/`duration-*` utility here. `eldra-focus` owns the
|
|
557
505
|
* element's transition list — background, border, text colour and the press scale at
|
|
@@ -561,21 +509,21 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
561
509
|
* `src/__tests__/focus-transition.spec.ts`.
|
|
562
510
|
*/
|
|
563
511
|
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"
|
|
512
|
+
sm: "eldra:control-h-sm eldra:px-3 eldra:gap-1.5 eldra:text-button-sm",
|
|
513
|
+
md: "eldra:control-h eldra:px-4.5 eldra:gap-2 eldra:text-button-md",
|
|
514
|
+
lg: "eldra:control-h-lg eldra:px-6 eldra:gap-2 eldra:text-button-lg"
|
|
567
515
|
};
|
|
568
516
|
/** Icon-only is square at its size's height and never grows: the spec lists 2 / 2.5 / 3rem. */
|
|
569
517
|
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"
|
|
518
|
+
sm: "eldra:control-h-sm eldra:aspect-square eldra:px-0 eldra:text-button-sm",
|
|
519
|
+
md: "eldra:control-h eldra:aspect-square eldra:px-0 eldra:text-button-md",
|
|
520
|
+
lg: "eldra:control-h-lg eldra:aspect-square eldra:px-0 eldra:text-button-lg"
|
|
573
521
|
};
|
|
574
522
|
/** The link variant is a line box: no control height, no padding, and it never grows to 2.75rem. */
|
|
575
523
|
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"
|
|
524
|
+
sm: "eldra:target-min eldra:px-0 eldra:gap-1.5 eldra:text-button-sm",
|
|
525
|
+
md: "eldra:target-min eldra:px-0 eldra:gap-2 eldra:text-button-md",
|
|
526
|
+
lg: "eldra:target-min eldra:px-0 eldra:gap-2 eldra:text-button-lg"
|
|
579
527
|
};
|
|
580
528
|
/**
|
|
581
529
|
* Variants (spec "Button" → Variants, States and On coloured sections).
|
|
@@ -584,66 +532,75 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
584
532
|
* puts in `primary` or `accent` without a new token: `primary` mixed 14% toward `background`,
|
|
585
533
|
* `accent` and `danger` 15% toward `text`, ghost `text` at 6% (11% pressed down).
|
|
586
534
|
*
|
|
587
|
-
* The `
|
|
588
|
-
* element carries `
|
|
535
|
+
* The `section-primary:`/`section-accent:` rules are the inversions for coloured sections. The
|
|
536
|
+
* section element carries `data-section="primary|accent"`; the focus ring never
|
|
589
537
|
* changes, because its white infill carries the contrast on dark grounds.
|
|
590
538
|
*
|
|
591
|
-
* Every live
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* `cursor-
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
|
|
539
|
+
* Every live button is `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in
|
|
540
|
+
* the README): Tailwind v4's preflight sets `button { cursor: default }`, so nothing here was a
|
|
541
|
+
* pointer until now. `cursorClass` picks it, `cursor-not-allowed` when disabled, or
|
|
542
|
+
* `cursor-progress` while loading.
|
|
543
|
+
*
|
|
544
|
+
* The resting fill and border colour live in `FILL`, apart from the rest, so the toggle-pressed
|
|
545
|
+
* fill can take their place.
|
|
546
|
+
*/
|
|
547
|
+
const FILL = {
|
|
548
|
+
primary: "eldra:bg-primary eldra:border-transparent",
|
|
549
|
+
secondary: "eldra:bg-accent eldra:border-transparent",
|
|
550
|
+
outline: "eldra:bg-background eldra:border-border-strong",
|
|
551
|
+
ghost: "eldra:bg-transparent eldra:border-transparent",
|
|
552
|
+
link: "eldra:bg-transparent eldra:border-transparent",
|
|
553
|
+
danger: "eldra:bg-danger eldra:border-transparent"
|
|
554
|
+
};
|
|
598
555
|
const VARIANT = {
|
|
599
556
|
primary: [
|
|
600
|
-
"
|
|
601
|
-
"hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]",
|
|
602
|
-
"
|
|
603
|
-
"
|
|
604
|
-
"
|
|
605
|
-
"
|
|
606
|
-
"
|
|
607
|
-
"
|
|
557
|
+
"eldra:text-primary-contrast",
|
|
558
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-primary),var(--eldra-color-background)_14%)]",
|
|
559
|
+
"eldra:section-primary:bg-primary-contrast",
|
|
560
|
+
"eldra:section-primary:text-primary",
|
|
561
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,var(--eldra-color-primary-contrast),var(--eldra-color-primary)_14%)]",
|
|
562
|
+
"eldra:section-accent:bg-accent-contrast",
|
|
563
|
+
"eldra:section-accent:text-accent",
|
|
564
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,var(--eldra-color-accent-contrast),var(--eldra-color-accent)_14%)]"
|
|
608
565
|
].join(" "),
|
|
609
566
|
secondary: [
|
|
610
|
-
"
|
|
611
|
-
"hover:bg-[color-mix(in_oklab,var(--eldra-color-accent),var(--eldra-color-text)_15%)]",
|
|
612
|
-
"
|
|
613
|
-
"
|
|
614
|
-
"
|
|
615
|
-
"
|
|
567
|
+
"eldra:text-accent-contrast",
|
|
568
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-accent),var(--eldra-color-text)_15%)]",
|
|
569
|
+
"eldra:section-accent:bg-transparent",
|
|
570
|
+
"eldra:section-accent:border-current",
|
|
571
|
+
"eldra:section-accent:text-current",
|
|
572
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]"
|
|
616
573
|
].join(" "),
|
|
617
574
|
outline: [
|
|
618
|
-
"
|
|
619
|
-
"hover:border-text hover:bg-surface",
|
|
620
|
-
"
|
|
621
|
-
"
|
|
622
|
-
"
|
|
623
|
-
"
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"
|
|
628
|
-
"
|
|
629
|
-
"
|
|
575
|
+
"eldra:text-text",
|
|
576
|
+
"eldra:hover:border-text eldra:hover:bg-surface",
|
|
577
|
+
"eldra:section-primary:bg-transparent",
|
|
578
|
+
"eldra:section-primary:border-current",
|
|
579
|
+
"eldra:section-primary:text-current",
|
|
580
|
+
"eldra:section-primary:hover:border-current",
|
|
581
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]",
|
|
582
|
+
"eldra:section-accent:bg-transparent",
|
|
583
|
+
"eldra:section-accent:border-current",
|
|
584
|
+
"eldra:section-accent:text-current",
|
|
585
|
+
"eldra:section-accent:hover:border-current",
|
|
586
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_88%)]"
|
|
630
587
|
].join(" "),
|
|
631
588
|
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
|
-
"
|
|
589
|
+
"eldra:text-text",
|
|
590
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
591
|
+
"eldra:active:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_89%)]",
|
|
592
|
+
"eldra:section-primary:text-current",
|
|
593
|
+
"eldra:section-primary:hover:bg-[color-mix(in_oklab,currentColor,transparent_94%)]",
|
|
594
|
+
"eldra:section-accent:text-current",
|
|
595
|
+
"eldra:section-accent:hover:bg-[color-mix(in_oklab,currentColor,transparent_94%)]"
|
|
639
596
|
].join(" "),
|
|
640
597
|
link: [
|
|
641
|
-
"
|
|
642
|
-
"underline decoration-1 underline-offset-[0.2em] hover:decoration-2",
|
|
643
|
-
"
|
|
644
|
-
"
|
|
598
|
+
"eldra:text-text",
|
|
599
|
+
"eldra:underline eldra:decoration-1 eldra:underline-offset-[0.2em] eldra:hover:decoration-2",
|
|
600
|
+
"eldra:section-primary:text-current",
|
|
601
|
+
"eldra:section-accent:text-current"
|
|
645
602
|
].join(" "),
|
|
646
|
-
danger: ["
|
|
603
|
+
danger: ["eldra:text-background", "eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-danger),var(--eldra-color-text)_15%)]"].join(" ")
|
|
647
604
|
};
|
|
648
605
|
/**
|
|
649
606
|
* Disabled (spec "Button" → States): `surface-strong` fill, `muted` text, transparent border, no
|
|
@@ -655,8 +612,8 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
655
612
|
secondary: FILLED_DISABLED,
|
|
656
613
|
outline: FILLED_DISABLED,
|
|
657
614
|
danger: FILLED_DISABLED,
|
|
658
|
-
ghost: "bg-transparent text-muted border-transparent
|
|
659
|
-
link: "bg-transparent text-muted border-
|
|
615
|
+
ghost: "eldra:bg-transparent eldra:text-muted eldra:border-transparent",
|
|
616
|
+
link: "eldra:bg-transparent eldra:text-muted eldra:border-transparent eldra:underline eldra:decoration-1 eldra:underline-offset-[0.2em]"
|
|
660
617
|
};
|
|
661
618
|
/**
|
|
662
619
|
* The submitting flag a `FormLayout` provides. A submit button becomes a loading button; every
|
|
@@ -749,16 +706,31 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
749
706
|
* `isDisabled` below replacing the whole state class.
|
|
750
707
|
*/
|
|
751
708
|
const TOGGLE_VARIANTS = ["outline", "ghost"];
|
|
752
|
-
const stateClass = computed(() => isDisabled.value ? DISABLED[props.variant] :
|
|
753
|
-
|
|
709
|
+
const stateClass = computed(() => isDisabled.value ? DISABLED[props.variant] : [
|
|
710
|
+
props.pressed === true && TOGGLE_VARIANTS.includes(props.variant) ? PRESSED_FILL : FILL[props.variant],
|
|
711
|
+
VARIANT[props.variant],
|
|
712
|
+
props.variant !== "link" && !isLoading.value && PRESS
|
|
713
|
+
]);
|
|
714
|
+
const cursorClass = computed(() => {
|
|
715
|
+
if (isLoading.value) return "eldra:cursor-progress";
|
|
716
|
+
return isDisabled.value ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer";
|
|
717
|
+
});
|
|
718
|
+
const containerClass = computed(() => mergeClass([
|
|
719
|
+
BASE$1,
|
|
720
|
+
props.variant === "link" ? LINK_BOX : BOX$1,
|
|
721
|
+
sizeClass.value,
|
|
722
|
+
stateClass.value,
|
|
723
|
+
cursorClass.value,
|
|
724
|
+
props.block ? "eldra:w-full" : "eldra:w-fit"
|
|
725
|
+
], attrs.class));
|
|
754
726
|
const isOverlaySpinner = computed(() => props.spinnerPlacement !== "start");
|
|
755
727
|
const isInlineSpinner = computed(() => isLoading.value && !isOverlaySpinner.value);
|
|
756
728
|
/** Hidden, not removed: the label and icons keep their space so the width never jumps. An inline
|
|
757
729
|
* spinner hides nothing: it takes the leading icon's place and the label stays readable. */
|
|
758
|
-
const hiddenWhileLoading = computed(() => isLoading.value && isOverlaySpinner.value ? "invisible" : "");
|
|
730
|
+
const hiddenWhileLoading = computed(() => isLoading.value && isOverlaySpinner.value ? "eldra:invisible" : "");
|
|
759
731
|
/** With `keepNameWhileLoading` the label is transparent instead, so it stays in the accessibility
|
|
760
732
|
* tree and the slot content keeps naming the button. */
|
|
761
|
-
const labelHiddenWhileLoading = computed(() => hiddenWhileLoading.value && props.keepNameWhileLoading ? "opacity-0" : hiddenWhileLoading.value);
|
|
733
|
+
const labelHiddenWhileLoading = computed(() => hiddenWhileLoading.value && props.keepNameWhileLoading ? "eldra:opacity-0" : hiddenWhileLoading.value);
|
|
762
734
|
/** Whether slot output holds anything but text, which then lays out in the button's own gap. */
|
|
763
735
|
function hasElements(nodes) {
|
|
764
736
|
return nodes.some((node) => {
|
|
@@ -773,11 +745,23 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
773
745
|
* the container's own `gap`, so the icon sits exactly as `iconLeft` would.
|
|
774
746
|
*/
|
|
775
747
|
function labelClass() {
|
|
776
|
-
return
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
748
|
+
return mergeClass([
|
|
749
|
+
"eldra:whitespace-nowrap",
|
|
750
|
+
slots.default !== void 0 && hasElements(slots.default()) && "eldra:inline-flex eldra:items-center eldra:gap-[inherit]",
|
|
751
|
+
labelHiddenWhileLoading.value
|
|
752
|
+
], props.classes?.label);
|
|
753
|
+
}
|
|
754
|
+
const leadingIconClass = computed(() => [
|
|
755
|
+
"eldra:inline-flex eldra:shrink-0",
|
|
756
|
+
hiddenWhileLoading.value,
|
|
757
|
+
props.classes?.leadingIcon
|
|
758
|
+
]);
|
|
759
|
+
const trailingIconClass = computed(() => [
|
|
760
|
+
"eldra:inline-flex eldra:shrink-0",
|
|
761
|
+
hiddenWhileLoading.value,
|
|
762
|
+
props.classes?.trailingIcon
|
|
763
|
+
]);
|
|
764
|
+
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
765
|
/** An icon-only button draws `icon`; everything else draws `iconLeft`. */
|
|
782
766
|
const leadingIcon = computed(() => props.iconOnly ? props.icon ?? props.iconLeft : props.iconLeft);
|
|
783
767
|
const hasLeading = computed(() => !isInlineSpinner.value && (leadingIcon.value !== void 0 || slots.leadingIcon !== void 0));
|
|
@@ -826,21 +810,23 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
826
810
|
"data-eldra-scope": unref(eldra).scope,
|
|
827
811
|
"data-part": "container",
|
|
828
812
|
class: containerClass.value,
|
|
829
|
-
type: isNativeButton.value ? __props.type : void 0
|
|
830
|
-
}, linkAttrs.value, {
|
|
813
|
+
type: isNativeButton.value ? __props.type : void 0,
|
|
831
814
|
tabindex: linkTabindex.value,
|
|
832
815
|
disabled: isNativeButton.value ? isDisabled.value || void 0 : void 0,
|
|
833
816
|
"aria-disabled": isInertLink.value ? "true" : void 0,
|
|
834
817
|
"aria-busy": isLoading.value ? "true" : void 0,
|
|
835
818
|
"aria-pressed": ariaPressed.value,
|
|
836
819
|
"aria-label": ariaLabel.value
|
|
837
|
-
}, toHandlers(rootListeners.value)
|
|
820
|
+
}, toHandlers(rootListeners.value), {
|
|
821
|
+
...linkAttrs.value,
|
|
822
|
+
...forwardedAttrs.value
|
|
823
|
+
}), {
|
|
838
824
|
default: withCtx(() => [
|
|
839
825
|
isInlineSpinner.value ? (openBlock(), createElementBlock("span", {
|
|
840
826
|
key: 0,
|
|
841
827
|
"data-part": "spinner",
|
|
842
828
|
class: normalizeClass(spinnerClass.value)
|
|
843
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true),
|
|
829
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true),
|
|
844
830
|
hasLeading.value ? (openBlock(), createElementBlock("span", {
|
|
845
831
|
key: 1,
|
|
846
832
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
@@ -869,7 +855,7 @@ var Button_default = /* @__PURE__ */ defineComponent({
|
|
|
869
855
|
key: 4,
|
|
870
856
|
"data-part": "spinner",
|
|
871
857
|
class: normalizeClass(spinnerClass.value)
|
|
872
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true)
|
|
858
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true)
|
|
873
859
|
]),
|
|
874
860
|
_: 3
|
|
875
861
|
}, 16, [
|
|
@@ -919,9 +905,13 @@ var FieldError_default = /* @__PURE__ */ defineComponent({
|
|
|
919
905
|
* rendered.
|
|
920
906
|
*/
|
|
921
907
|
const props = __props;
|
|
922
|
-
const errorClass = computed(() =>
|
|
908
|
+
const errorClass = computed(() => [
|
|
909
|
+
"eldra:text-field-note eldra:text-danger eldra:flex eldra:items-start eldra:gap-1.25 eldra:font-medium",
|
|
910
|
+
props.rowClass,
|
|
911
|
+
props.classes?.error
|
|
912
|
+
]);
|
|
923
913
|
/** 1rem, nudged 0.1em down so it sits on the text rather than above it. */
|
|
924
|
-
const errorIconClass = computed(() =>
|
|
914
|
+
const errorIconClass = computed(() => ["eldra:size-4 eldra:shrink-0 eldra:translate-y-[0.1em]", props.classes?.errorIcon]);
|
|
925
915
|
return (_ctx, _cache) => {
|
|
926
916
|
return openBlock(), createElementBlock("p", {
|
|
927
917
|
id: __props.id,
|
|
@@ -965,7 +955,7 @@ var RequiredMark_default = /* @__PURE__ */ defineComponent({
|
|
|
965
955
|
* The asterisk is decorative: a control's native `required` is what announces it.
|
|
966
956
|
*/
|
|
967
957
|
const props = __props;
|
|
968
|
-
const markClass = computed(() =>
|
|
958
|
+
const markClass = computed(() => ["eldra:text-danger eldra:ms-0.5", props.classes?.requiredMark]);
|
|
969
959
|
return (_ctx, _cache) => {
|
|
970
960
|
return openBlock(), createElementBlock("span", {
|
|
971
961
|
"data-eldra-ui": "",
|
|
@@ -985,8 +975,7 @@ var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
|
985
975
|
focusable: {
|
|
986
976
|
type: Boolean,
|
|
987
977
|
default: false
|
|
988
|
-
}
|
|
989
|
-
classes: { default: void 0 }
|
|
978
|
+
}
|
|
990
979
|
},
|
|
991
980
|
setup(__props) {
|
|
992
981
|
const eldra = useEldraScope();
|
|
@@ -997,7 +986,7 @@ var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
|
997
986
|
* it with a literal size or a `display: none` that would also hide the content
|
|
998
987
|
* from screen readers.
|
|
999
988
|
*/
|
|
1000
|
-
const rootClass = computed(() =>
|
|
989
|
+
const rootClass = computed(() => ["eldra:sr-only", props.focusable && "eldra:focus:not-sr-only"]);
|
|
1001
990
|
return (_ctx, _cache) => {
|
|
1002
991
|
return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
1003
992
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
@@ -1041,13 +1030,15 @@ var _hoisted_3$14 = {
|
|
|
1041
1030
|
};
|
|
1042
1031
|
var _hoisted_4$13 = ["data-eldra-slot"];
|
|
1043
1032
|
var _hoisted_5$11 = ["data-eldra-slot"];
|
|
1044
|
-
var ROOT$
|
|
1033
|
+
var ROOT$3 = "eldra:group eldra:grid eldra:max-w-full eldra:gap-y-0.5 eldra:target-min";
|
|
1034
|
+
var ROOT_COLUMNS = "eldra:grid-cols-[auto_1fr] eldra:gap-x-2.5";
|
|
1035
|
+
var ROOT_INLINE = "eldra:w-fit eldra:items-start";
|
|
1045
1036
|
/**
|
|
1046
1037
|
* Spec "Checkbox" → Sizes: box 1.125rem "nudged 0.1875rem down to align with the first text line"
|
|
1047
1038
|
* at md, 1.5rem "top-aligned" at lg. `--spacing` is 0.25rem, so `size-4.5` is 1.125rem, `size-6`
|
|
1048
1039
|
* is 1.5rem and `mt-0.75` is the 0.1875rem nudge. A 1.5rem box on a 1.5rem line needs none.
|
|
1049
1040
|
*/
|
|
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";
|
|
1041
|
+
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
1042
|
/**
|
|
1052
1043
|
* States (spec "Checkbox" → States). Driven from the component's own state rather than from CSS
|
|
1053
1044
|
* `:checked`/`:indeterminate` variants, for the reason Input.vue gives: a dead or invalid box must
|
|
@@ -1055,10 +1046,10 @@ var BOX = "relative inline-flex shrink-0 items-center justify-center rounded-[va
|
|
|
1055
1046
|
* the stylesheet. Only `:hover` — which nothing here can express in JavaScript — is a variant, and
|
|
1056
1047
|
* it is written only into the two states that have a hover.
|
|
1057
1048
|
*/
|
|
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";
|
|
1049
|
+
var UNCHECKED = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text eldra:eldra-checkbox-border";
|
|
1050
|
+
var CHECKED = "eldra:bg-primary eldra:border-primary eldra:eldra-checkbox-border";
|
|
1060
1051
|
/** 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";
|
|
1052
|
+
var INVALID$4 = "eldra:bg-background eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
1062
1053
|
/**
|
|
1063
1054
|
* The error row of the spec's States table describes an *unchecked* box — that is the required
|
|
1064
1055
|
* consent it is written for. A box that is checked or indeterminate keeps its `primary` fill and
|
|
@@ -1067,16 +1058,16 @@ var INVALID$4 = "bg-background border-danger group-hover:border-danger eldra-che
|
|
|
1067
1058
|
* "Checked differs by fill and tick shape, not only colour" (Accessibility) has to stay true in
|
|
1068
1059
|
* every state, error included.
|
|
1069
1060
|
*/
|
|
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";
|
|
1061
|
+
var INVALID_MARKED = "eldra:bg-primary eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
1062
|
+
var DISABLED$4 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:eldra-checkbox-border";
|
|
1063
|
+
var DISABLED_CHECKED = "eldra:bg-muted eldra:border-muted eldra:eldra-checkbox-border";
|
|
1073
1064
|
/**
|
|
1074
1065
|
* A disabled box drops the danger boundary and keeps `aria-invalid` — the same reading as Input
|
|
1075
1066
|
* and Textarea: the field is still invalid, it just cannot be corrected here, so it shows the dead
|
|
1076
1067
|
* boundary rather than an actionable one.
|
|
1077
1068
|
*/
|
|
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";
|
|
1069
|
+
var BOX_ONLY = "eldra:grid-cols-[auto] eldra:gap-x-0";
|
|
1070
|
+
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
1071
|
// src/components/checkbox/Checkbox.vue
|
|
1081
1072
|
var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
1082
1073
|
inheritAttrs: false,
|
|
@@ -1122,7 +1113,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1122
1113
|
const props = __props;
|
|
1123
1114
|
const emit = __emit;
|
|
1124
1115
|
const slots = useSlots();
|
|
1125
|
-
useAttrs();
|
|
1116
|
+
const attrs = useAttrs();
|
|
1126
1117
|
/** See Input.vue for the field-context rationale: any explicit prop wins over the wrapper. */
|
|
1127
1118
|
const field = inject(FIELD_KEY, null);
|
|
1128
1119
|
/**
|
|
@@ -1197,8 +1188,8 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1197
1188
|
* `gap-x-2.5` is the 0.625rem box-to-text gap, `gap-y-0.5` the hint's own line spacing.
|
|
1198
1189
|
*/
|
|
1199
1190
|
const BOX_SIZE = {
|
|
1200
|
-
md: "size-4.5 mt-0.75",
|
|
1201
|
-
lg: "size-6"
|
|
1191
|
+
md: "eldra:size-4.5 eldra:mt-0.75",
|
|
1192
|
+
lg: "eldra:size-6"
|
|
1202
1193
|
};
|
|
1203
1194
|
/**
|
|
1204
1195
|
* The drawn box (spec "Checkbox" → Anatomy: "a native `<input type="checkbox">` with custom
|
|
@@ -1234,7 +1225,18 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1234
1225
|
return hasHint.value || hasContent(slots.default?.() ?? []);
|
|
1235
1226
|
}
|
|
1236
1227
|
function rootClass(labelled) {
|
|
1237
|
-
return
|
|
1228
|
+
return mergeClass([
|
|
1229
|
+
ROOT$3,
|
|
1230
|
+
labelled ? ROOT_COLUMNS : BOX_ONLY,
|
|
1231
|
+
ROOT_INLINE,
|
|
1232
|
+
props.disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer"
|
|
1233
|
+
], attrs.class);
|
|
1234
|
+
}
|
|
1235
|
+
/** Every attribute but `class` lands on the control; `class` styles the root. */
|
|
1236
|
+
function controlAttrs() {
|
|
1237
|
+
const rest = { ...attrs };
|
|
1238
|
+
delete rest.class;
|
|
1239
|
+
return rest;
|
|
1238
1240
|
}
|
|
1239
1241
|
/**
|
|
1240
1242
|
* The control itself, stretched over the drawn box rather than `sr-only` in a corner of it.
|
|
@@ -1247,7 +1249,11 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1247
1249
|
* through. Covering the box with the control makes the box the target in both arrangements, and a
|
|
1248
1250
|
* click on it is a click on the control rather than a label forwarding one.
|
|
1249
1251
|
*/
|
|
1250
|
-
const boxClass = computed(() =>
|
|
1252
|
+
const boxClass = computed(() => [[
|
|
1253
|
+
BOX,
|
|
1254
|
+
BOX_SIZE[props.size],
|
|
1255
|
+
boxState.value
|
|
1256
|
+
], props.classes?.box]);
|
|
1251
1257
|
/**
|
|
1252
1258
|
* The mark (spec "Checkbox" → Behaviour & motion): "The tick scales in from 0 over `duration-fast`
|
|
1253
1259
|
* with `ease-out`. … With reduced motion the tick simply appears." Reduced motion needs no class:
|
|
@@ -1257,22 +1263,22 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1257
1263
|
* The mark is one part with two shapes, so a disabled *checked* box keeps its tick (spec's States
|
|
1258
1264
|
* table) while an empty one has nothing to show.
|
|
1259
1265
|
*/
|
|
1260
|
-
const checkClass = computed(() =>
|
|
1266
|
+
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
1267
|
/**
|
|
1262
1268
|
* Spec "Checkbox" → Sizes: label 0.9375rem on a 1.5rem line — the same two numbers as the
|
|
1263
1269
|
* compact-control type, so it is the same utility rather than a second one that would drift from
|
|
1264
1270
|
* it. (Not the mobile 1rem override: that rule is scoped to "inputs, textareas, select triggers
|
|
1265
1271
|
* and select search fields", where it stops iOS zooming into a focused field.)
|
|
1266
1272
|
*/
|
|
1267
|
-
const labelClass = computed(() =>
|
|
1273
|
+
const labelClass = computed(() => [["eldra:text-control eldra:min-w-0", props.disabled ? "eldra:text-muted" : "eldra:text-text"], props.classes?.label]);
|
|
1268
1274
|
/** Spec "Checkbox" → Sizes: "Hint: 0.875rem, `muted`, on its own line", in column 2 under it. */
|
|
1269
|
-
const hintClass = computed(() =>
|
|
1275
|
+
const hintClass = computed(() => ["eldra:text-body-sm eldra:text-muted eldra:col-start-2 eldra:min-w-0", props.classes?.hint]);
|
|
1270
1276
|
/**
|
|
1271
1277
|
* With an `error`, the row and its error message sit in one box (the `field` part), so the message
|
|
1272
1278
|
* stays outside the `<label>` and out of the control's name. Without one, the row is the root as
|
|
1273
1279
|
* it always was.
|
|
1274
1280
|
*/
|
|
1275
|
-
const fieldClass = computed(() =>
|
|
1281
|
+
const fieldClass = computed(() => ["eldra:grid eldra:w-fit eldra:max-w-full eldra:content-start eldra:gap-1", props.classes?.field]);
|
|
1276
1282
|
const Field = (_props, { slots: own }) => {
|
|
1277
1283
|
const row = own.default?.()[0];
|
|
1278
1284
|
if (!hasError.value) return row;
|
|
@@ -1310,7 +1316,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1310
1316
|
}, [createElementVNode("input", mergeProps({
|
|
1311
1317
|
ref_key: "controlRef",
|
|
1312
1318
|
ref: controlRef
|
|
1313
|
-
},
|
|
1319
|
+
}, controlAttrs(), {
|
|
1314
1320
|
class: CONTROL,
|
|
1315
1321
|
type: "checkbox",
|
|
1316
1322
|
id: unref(controlId),
|
|
@@ -1372,6 +1378,7 @@ var _hoisted_1$14 = [
|
|
|
1372
1378
|
"aria-describedby",
|
|
1373
1379
|
"aria-invalid"
|
|
1374
1380
|
];
|
|
1381
|
+
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
1382
|
// src/components/checkbox/CheckboxGroup.vue
|
|
1376
1383
|
var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
1377
1384
|
__name: "CheckboxGroup",
|
|
@@ -1419,20 +1426,18 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1419
1426
|
* checkboxes looks the same whichever of the two draws it: "no border, padding or min-width, grid
|
|
1420
1427
|
* with a 0.75rem (`space-3`) gap, and the legend has a 0.5rem (`space-2`) bottom margin."
|
|
1421
1428
|
*/
|
|
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"));
|
|
1429
|
+
const legendClass = computed(() => ["eldra:text-label eldra:text-text eldra:mb-2 eldra:block eldra:w-fit eldra:p-0", props.classes?.legend]);
|
|
1425
1430
|
/**
|
|
1426
1431
|
* Spec "Checkbox" → Sizes: "Vertical group gap 0.5rem (`space-2`). Row group gap 0.5rem × 1.5rem
|
|
1427
1432
|
* (`space-2` × `space-6`), wrapping."
|
|
1428
1433
|
*/
|
|
1429
|
-
const optionsClass = computed(() =>
|
|
1434
|
+
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
1435
|
return (_ctx, _cache) => {
|
|
1431
1436
|
return openBlock(), createElementBlock("fieldset", {
|
|
1432
1437
|
"data-eldra-ui": "",
|
|
1433
1438
|
"data-eldra-scope": unref(eldra).scope,
|
|
1434
1439
|
"data-part": "root",
|
|
1435
|
-
class: normalizeClass(
|
|
1440
|
+
class: normalizeClass(ROOT$2),
|
|
1436
1441
|
"aria-describedby": describedBy.value,
|
|
1437
1442
|
"aria-invalid": __props.error ? "true" : void 0
|
|
1438
1443
|
}, [
|
|
@@ -1472,7 +1477,7 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1472
1477
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.error), 1)]),
|
|
1473
1478
|
_: 1
|
|
1474
1479
|
}, 8, ["id", "classes"])) : createCommentVNode("", true)
|
|
1475
|
-
],
|
|
1480
|
+
], 8, _hoisted_1$14);
|
|
1476
1481
|
};
|
|
1477
1482
|
}
|
|
1478
1483
|
});
|
|
@@ -1489,18 +1494,16 @@ var CheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
1489
1494
|
* neither one appears to depend on the other: `MultiSelect` shipped first and `Chip` reuses its
|
|
1490
1495
|
* visual language, but the recipe itself belongs to neither.
|
|
1491
1496
|
*/
|
|
1492
|
-
var TAG_FILL = "bg-surface-strong text-text";
|
|
1497
|
+
var TAG_FILL = "eldra:bg-surface-strong eldra:text-text";
|
|
1493
1498
|
/** 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";
|
|
1499
|
+
var TAG_SHAPE = "eldra:inline-flex eldra:min-h-7 eldra:items-center eldra:gap-1 eldra:rounded-full eldra:text-caption";
|
|
1495
1500
|
/**
|
|
1496
1501
|
* Start padding is 0.625rem either way; the end padding is the remove button's own room, so a tag
|
|
1497
1502
|
* with no remove button is padded evenly instead of ending short.
|
|
1498
1503
|
*/
|
|
1499
1504
|
function tagPadding(hasRemoveButton) {
|
|
1500
|
-
return hasRemoveButton ? "ps-2.5 pe-0.5" : "px-2.5";
|
|
1505
|
+
return hasRemoveButton ? "eldra:ps-2.5 eldra:pe-0.5" : "eldra:px-2.5";
|
|
1501
1506
|
}
|
|
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
1507
|
// src/composables/useLocale.ts
|
|
1505
1508
|
/**
|
|
1506
1509
|
* The number locale the components format with, as a provide/inject pair — the same shape as
|
|
@@ -1975,7 +1978,7 @@ function currencySymbol(currency, locale = "en-US", narrow = true) {
|
|
|
1975
1978
|
* own **delta** — a pill radius, a different padding for an icon it draws itself — never a second
|
|
1976
1979
|
* copy of the box.
|
|
1977
1980
|
*
|
|
1978
|
-
* Nothing here is exported from the package: a consumer restyles through `classes`, tokens and
|
|
1981
|
+
* Nothing here is exported from the package: a consumer restyles through `class`, `classes`, tokens and
|
|
1979
1982
|
* the per-component CSS variables (see the README's Customisation section), not by importing our
|
|
1980
1983
|
* class strings, which are not a stable API.
|
|
1981
1984
|
*/
|
|
@@ -1991,7 +1994,10 @@ function currencySymbol(currency, locale = "en-US", narrow = true) {
|
|
|
1991
1994
|
* list, including the `duration-fast` border-colour change the spec's Behaviour section asks for.
|
|
1992
1995
|
* See `src/styles/tailwind.css` and `src/__tests__/focus-transition.spec.ts`.
|
|
1993
1996
|
*/
|
|
1994
|
-
var
|
|
1997
|
+
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";
|
|
1998
|
+
/** The box's radius, apart so a field with a radius of its own (`SearchBar`'s pill) takes one. */
|
|
1999
|
+
var FIELD_RADIUS = "eldra:rounded-[var(--eldra-input-radius,var(--eldra-radius-md))]";
|
|
2000
|
+
var FIELD_BASE = `${FIELD_BOX} ${FIELD_RADIUS}`;
|
|
1995
2001
|
/**
|
|
1996
2002
|
* The type style per size (spec "Input" → Sizes). Its own constant because `SearchBar`'s two sizes
|
|
1997
2003
|
* take exactly these rules while its paddings are its own — the `max-md:text-control-mobile`
|
|
@@ -1999,9 +2005,9 @@ var FIELD_BASE = "block w-full min-w-0 eldra-field-border bg-background text-tex
|
|
|
1999
2005
|
* is the half that had gone missing from the copy.
|
|
2000
2006
|
*/
|
|
2001
2007
|
var FIELD_TEXT = {
|
|
2002
|
-
sm: "text-control-sm",
|
|
2003
|
-
md: "text-control max-md:text-control-mobile",
|
|
2004
|
-
lg: "text-control-lg"
|
|
2008
|
+
sm: "eldra:text-control-sm",
|
|
2009
|
+
md: "eldra:text-control eldra:max-md:text-control-mobile",
|
|
2010
|
+
lg: "eldra:text-control-lg"
|
|
2005
2011
|
};
|
|
2006
2012
|
/**
|
|
2007
2013
|
* Sizes (spec "Input" → Sizes). `--spacing` is 0.25rem, so `py-0.75`/`px-2.25` are the spec's
|
|
@@ -2010,19 +2016,19 @@ var FIELD_TEXT = {
|
|
|
2010
2016
|
* inside the spec's box at every size.
|
|
2011
2017
|
*/
|
|
2012
2018
|
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}`
|
|
2019
|
+
sm: `eldra:control-h-sm eldra:py-0.75 eldra:px-2.25 ${FIELD_TEXT.sm}`,
|
|
2020
|
+
md: `eldra:control-h eldra:py-1.75 eldra:px-2.75 ${FIELD_TEXT.md}`,
|
|
2021
|
+
lg: `eldra:control-h-lg eldra:py-2.75 eldra:px-2.75 ${FIELD_TEXT.lg}`
|
|
2016
2022
|
};
|
|
2017
2023
|
var FIELD_TRAILING_PAD = {
|
|
2018
|
-
sm: "pe-8",
|
|
2019
|
-
md: "pe-10",
|
|
2020
|
-
lg: "pe-10"
|
|
2024
|
+
sm: "eldra:pe-8",
|
|
2025
|
+
md: "eldra:pe-10",
|
|
2026
|
+
lg: "eldra:pe-10"
|
|
2021
2027
|
};
|
|
2022
2028
|
var FIELD_CLEAR_SIZE = {
|
|
2023
|
-
sm: "size-6",
|
|
2024
|
-
md: "size-8",
|
|
2025
|
-
lg: "size-8"
|
|
2029
|
+
sm: "eldra:size-6",
|
|
2030
|
+
md: "eldra:size-8",
|
|
2031
|
+
lg: "eldra:size-8"
|
|
2026
2032
|
};
|
|
2027
2033
|
/**
|
|
2028
2034
|
* Two trailing actions (operator report, 2026-09-25; recorded under Deviations in the README): a
|
|
@@ -2038,26 +2044,38 @@ var FIELD_CLEAR_SIZE = {
|
|
|
2038
2044
|
* both of them plus the row's own 0.25rem inset from the edge.
|
|
2039
2045
|
*/
|
|
2040
2046
|
var FIELD_TRAILING_PAD_PAIR = {
|
|
2041
|
-
sm: "pe-14",
|
|
2042
|
-
md: "pe-14",
|
|
2043
|
-
lg: "pe-14"
|
|
2047
|
+
sm: "eldra:pe-14",
|
|
2048
|
+
md: "eldra:pe-14",
|
|
2049
|
+
lg: "eldra:pe-14"
|
|
2044
2050
|
};
|
|
2045
2051
|
var FIELD_ACTION_PAIR_SIZE = {
|
|
2046
|
-
sm: "w-6 h-6",
|
|
2047
|
-
md: "w-6 h-8",
|
|
2048
|
-
lg: "w-6 h-8"
|
|
2052
|
+
sm: "eldra:w-6 eldra:h-6",
|
|
2053
|
+
md: "eldra:w-6 eldra:h-8",
|
|
2054
|
+
lg: "eldra:w-6 eldra:h-8"
|
|
2049
2055
|
};
|
|
2050
2056
|
/**
|
|
2051
2057
|
* States (spec "Input" → States). Disabled and read-only replace the live colours outright rather
|
|
2052
2058
|
* than layering over them, so a `:hover` rule can never win back a live boundary on a dead field.
|
|
2053
2059
|
* The error row's second 1px line is drawn by the root's `eldra-field-invalid` pseudo-element,
|
|
2054
|
-
* because the ring already owns this element's `outline` and `box-shadow`.
|
|
2060
|
+
* because the ring already owns this element's `outline` and `box-shadow`. Each recipe carries the
|
|
2061
|
+
* fill, the text colour and the boundary, so a field renders exactly one of each: `fieldState`
|
|
2062
|
+
* picks the one recipe a field is in.
|
|
2055
2063
|
*/
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
2058
|
-
var
|
|
2064
|
+
var FIELD_LIVE_FILL = "eldra:bg-background eldra:text-text";
|
|
2065
|
+
var FIELD_READONLY_FILL = "eldra:bg-surface eldra:text-text";
|
|
2066
|
+
var FIELD_LIVE = `${FIELD_LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
|
|
2067
|
+
/** The error boundary alone; `fieldState` pairs it with the live or the read-only fill. */
|
|
2068
|
+
var FIELD_INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
|
|
2069
|
+
var FIELD_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
2070
|
+
var FIELD_READONLY = `${FIELD_READONLY_FILL} eldra:border-border`;
|
|
2071
|
+
/** The one state recipe a field box is in. `invalid` is the shown error, never set while disabled. */
|
|
2072
|
+
function fieldState(state) {
|
|
2073
|
+
if (state.disabled) return FIELD_DISABLED;
|
|
2074
|
+
if (state.readonly) return state.invalid ? `${FIELD_READONLY_FILL} ${FIELD_INVALID}` : FIELD_READONLY;
|
|
2075
|
+
return state.invalid ? `${FIELD_LIVE_FILL} ${FIELD_INVALID}` : FIELD_LIVE;
|
|
2076
|
+
}
|
|
2059
2077
|
/** 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";
|
|
2078
|
+
var FIELD_SEARCH_APPEARANCE = "eldra:[&::-webkit-search-cancel-button]:appearance-none eldra:[&::-webkit-search-decoration]:appearance-none";
|
|
2061
2079
|
/**
|
|
2062
2080
|
* A ghost icon button at the field's end edge (spec "Input" → Anatomy): square, `muted`, the ring.
|
|
2063
2081
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README): Tailwind
|
|
@@ -2065,9 +2083,11 @@ var FIELD_SEARCH_APPEARANCE = "[&::-webkit-search-cancel-button]:appearance-none
|
|
|
2065
2083
|
* package — `Input`'s, `SearchBar`'s and `UnitInput`'s (`CurrencyInput` wraps the last) — showed
|
|
2066
2084
|
* the default arrow rather than a pointer.
|
|
2067
2085
|
*/
|
|
2068
|
-
var
|
|
2086
|
+
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";
|
|
2087
|
+
/** The whole button. A field that shows or rounds it its own way takes `FIELD_CLEAR_BUTTON_BOX`. */
|
|
2088
|
+
var FIELD_CLEAR_BUTTON = `eldra:inline-flex ${FIELD_CLEAR_BUTTON_BOX} eldra:rounded-[var(--eldra-radius-sm)]`;
|
|
2069
2089
|
/** 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";
|
|
2090
|
+
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
2091
|
/**
|
|
2072
2092
|
* The end-edge area, 0.25rem from the edge (spec "Input" → Anatomy, "Trailing action"). The clear
|
|
2073
2093
|
* button and the `suffix` slot share it, so a field that has both keeps them on one row in reading
|
|
@@ -2079,21 +2099,21 @@ var FIELD_LEADING_ICON = "absolute start-2.75 inset-y-0 my-auto flex h-4.5 w-4.5
|
|
|
2079
2099
|
* so a field with both keeps them on one row"), and this constant is `Input`'s and `SearchBar`'s
|
|
2080
2100
|
* row too — dropping the gap here would silently change `Input`'s rendered output for that
|
|
2081
2101
|
* 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.
|
|
2102
|
+
* `FIELD_TRAILING_PAD_PAIR` above) wants flush icons, and it builds its row from
|
|
2103
|
+
* `FIELD_SUFFIX_ROW_BASE` with `gap-0` rather than changing the shared default.
|
|
2085
2104
|
*/
|
|
2086
|
-
var
|
|
2105
|
+
var FIELD_SUFFIX_ROW_BASE = "eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center";
|
|
2106
|
+
var FIELD_SUFFIX_ROW = `${FIELD_SUFFIX_ROW_BASE} eldra:gap-1`;
|
|
2087
2107
|
/**
|
|
2088
2108
|
* The start-edge mirror of `FIELD_SUFFIX_ROW`, for the `prefix` slot: interactive content (a
|
|
2089
2109
|
* calendar button) 0.25rem from the start edge, so unlike `FIELD_LEADING_ICON` it keeps the pointer.
|
|
2090
2110
|
*/
|
|
2091
|
-
var FIELD_PREFIX_ROW = "absolute start-1 inset-y-0 my-auto flex items-center gap-1";
|
|
2111
|
+
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
2112
|
/** The start padding a `prefix` row reserves: the trailing action's room, mirrored. */
|
|
2093
2113
|
var FIELD_PREFIX_PAD = {
|
|
2094
|
-
sm: "ps-8",
|
|
2095
|
-
md: "ps-10",
|
|
2096
|
-
lg: "ps-10"
|
|
2114
|
+
sm: "eldra:ps-8",
|
|
2115
|
+
md: "eldra:ps-10",
|
|
2116
|
+
lg: "eldra:ps-10"
|
|
2097
2117
|
};
|
|
2098
2118
|
/** `FIELD_TRAILING_PAD`/`FIELD_PREFIX_PAD` in rem, for `useAdornmentRoom`'s comparison. */
|
|
2099
2119
|
var FIELD_ACTION_ROOM_REM = {
|
|
@@ -2176,6 +2196,13 @@ var _hoisted_6$8 = ["data-eldra-slot"];
|
|
|
2176
2196
|
var _hoisted_7$5 = ["data-eldra-scope", "aria-label"];
|
|
2177
2197
|
var _hoisted_8$4 = ["data-eldra-scope"];
|
|
2178
2198
|
var VALUE_DRAG_PIXELS_PER_STEP = 8;
|
|
2199
|
+
/**
|
|
2200
|
+
* `Number.MAX_SAFE_INTEGER`, written out. A property access in a prop default is a member
|
|
2201
|
+
* expression the bundler cannot prove pure (a getter may throw), which pins the whole component
|
|
2202
|
+
* into every consumer's bundle — importing `Button` alone pulled this file in with it.
|
|
2203
|
+
*/
|
|
2204
|
+
var MAX_SAFE_VALUE = 9007199254740991;
|
|
2205
|
+
var rootClass$2 = "eldra:block eldra:w-full";
|
|
2179
2206
|
// src/components/unit-input/UnitInput.vue
|
|
2180
2207
|
var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
2181
2208
|
inheritAttrs: false,
|
|
@@ -2186,7 +2213,7 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2186
2213
|
locale: { default: void 0 },
|
|
2187
2214
|
label: { default: void 0 },
|
|
2188
2215
|
maxFraction: { default: 2 },
|
|
2189
|
-
max: { default:
|
|
2216
|
+
max: { default: MAX_SAFE_VALUE },
|
|
2190
2217
|
min: { default: 0 },
|
|
2191
2218
|
step: { default: 1 },
|
|
2192
2219
|
enableDragAdjust: {
|
|
@@ -2710,21 +2737,44 @@ var UnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
2710
2737
|
const hasLeading = computed(() => props.leadingIcon !== void 0 || slots.leadingIcon !== void 0);
|
|
2711
2738
|
/** The same rule as `Input`'s: a disabled field keeps its dead boundary and drops the danger one. */
|
|
2712
2739
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
2713
|
-
const
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2740
|
+
const labelClass = computed(() => mergeClass("eldra:text-label eldra:text-text eldra:mb-1 eldra:block", props.classes?.label));
|
|
2741
|
+
const fieldClass = computed(() => [
|
|
2742
|
+
"eldra:relative eldra:block eldra:w-full",
|
|
2743
|
+
showsInvalid.value && "eldra:eldra-field-invalid",
|
|
2744
|
+
props.classes?.field
|
|
2745
|
+
]);
|
|
2746
|
+
const controlClass = computed(() => [
|
|
2747
|
+
FIELD_BASE,
|
|
2748
|
+
FIELD_SIZE[props.size],
|
|
2749
|
+
hasLeading.value && "eldra:ps-9",
|
|
2750
|
+
hasTrailing.value && (isActionPair.value ? FIELD_TRAILING_PAD_PAIR[props.size] : FIELD_TRAILING_PAD[props.size]),
|
|
2751
|
+
"eldra:tabular-nums",
|
|
2752
|
+
fieldState({
|
|
2753
|
+
disabled: props.disabled,
|
|
2754
|
+
readonly: props.readonly,
|
|
2755
|
+
invalid: showsInvalid.value
|
|
2756
|
+
}),
|
|
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$2, _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",
|
|
@@ -3239,11 +3294,25 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3239
3294
|
* the spec's 2px boundary can never appear one without the other.
|
|
3240
3295
|
*/
|
|
3241
3296
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
3242
|
-
const rootClass = computed(() =>
|
|
3243
|
-
const controlClass = computed(() =>
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3297
|
+
const rootClass = computed(() => ["eldra:relative eldra:block eldra:w-full", showsInvalid.value && "eldra:eldra-field-invalid"]);
|
|
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
|
+
props.classes?.control
|
|
3312
|
+
]);
|
|
3313
|
+
const leadingIconClass = computed(() => [FIELD_LEADING_ICON, props.classes?.leadingIcon]);
|
|
3314
|
+
const suffixClass = computed(() => [FIELD_SUFFIX_ROW, props.classes?.suffix]);
|
|
3315
|
+
const prefixClass = computed(() => [FIELD_PREFIX_ROW, props.classes?.prefix]);
|
|
3247
3316
|
/**
|
|
3248
3317
|
* A prefix or suffix row wider than one action pushes the text clear of it (see
|
|
3249
3318
|
* `useAdornmentRoom`); with no row or one action the padding classes above stand alone.
|
|
@@ -3256,7 +3325,11 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3256
3325
|
paddingInlineStart: prefixRoom.value,
|
|
3257
3326
|
paddingInlineEnd: suffixRoom.value
|
|
3258
3327
|
});
|
|
3259
|
-
const clearButtonClass = computed(() =>
|
|
3328
|
+
const clearButtonClass = computed(() => [
|
|
3329
|
+
FIELD_CLEAR_BUTTON,
|
|
3330
|
+
FIELD_CLEAR_SIZE[props.size],
|
|
3331
|
+
props.classes?.clearButton
|
|
3332
|
+
]);
|
|
3260
3333
|
/** The types whose selection API a browser actually implements; `number` and `email` throw. */
|
|
3261
3334
|
const SELECTABLE_TYPES = /* @__PURE__ */ new Set([
|
|
3262
3335
|
"text",
|
|
@@ -3304,7 +3377,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3304
3377
|
"data-eldra-ui": "",
|
|
3305
3378
|
"data-eldra-scope": unref(eldra).scope,
|
|
3306
3379
|
"data-part": "root",
|
|
3307
|
-
class: normalizeClass(rootClass.value)
|
|
3380
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
3308
3381
|
}, [
|
|
3309
3382
|
hasPrefix.value ? (openBlock(), createElementBlock("span", {
|
|
3310
3383
|
key: 0,
|
|
@@ -3318,15 +3391,20 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3318
3391
|
"data-eldra-slot": unref(eldra).slotHost("leadingIcon"),
|
|
3319
3392
|
"data-part": "leadingIcon",
|
|
3320
3393
|
class: normalizeClass(leadingIconClass.value)
|
|
3321
|
-
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
3394
|
+
}, [renderSlot(_ctx.$slots, "leadingIcon", {}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
3322
3395
|
key: 0,
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3396
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
3397
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
3398
|
+
"aria-hidden": "true",
|
|
3399
|
+
focusable: "false"
|
|
3400
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$12)) : createCommentVNode("", true),
|
|
3326
3401
|
createElementVNode("input", mergeProps({
|
|
3327
3402
|
ref_key: "controlRef",
|
|
3328
3403
|
ref: controlRef
|
|
3329
|
-
},
|
|
3404
|
+
}, {
|
|
3405
|
+
..._ctx.$attrs,
|
|
3406
|
+
class: void 0
|
|
3407
|
+
}, {
|
|
3330
3408
|
"data-part": "control",
|
|
3331
3409
|
class: controlClass.value,
|
|
3332
3410
|
style: controlStyle.value,
|
|
@@ -3365,7 +3443,7 @@ var Input_default = /* @__PURE__ */ defineComponent({
|
|
|
3365
3443
|
"aria-label": unref(m).clear,
|
|
3366
3444
|
onClick: onClear
|
|
3367
3445
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
3368
|
-
class: "size-4.5",
|
|
3446
|
+
class: "eldra:size-4.5",
|
|
3369
3447
|
viewBox: "0 0 24 24",
|
|
3370
3448
|
fill: "none",
|
|
3371
3449
|
stroke: "currentColor",
|
|
@@ -3484,19 +3562,19 @@ var _hoisted_7$4 = [
|
|
|
3484
3562
|
"checked",
|
|
3485
3563
|
"disabled"
|
|
3486
3564
|
];
|
|
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";
|
|
3565
|
+
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";
|
|
3566
|
+
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";
|
|
3567
|
+
var TRACK_OFF = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text";
|
|
3568
|
+
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%)]";
|
|
3569
|
+
var TRACK_DISABLED_OFF = "eldra:bg-surface-strong eldra:border-border-strong eldra:border-dashed";
|
|
3570
|
+
var TRACK_DISABLED_ON = "eldra:bg-muted eldra:border-muted";
|
|
3571
|
+
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";
|
|
3572
|
+
var THUMB_OFF = "eldra:bg-border-strong";
|
|
3573
|
+
var THUMB_ON = "eldra:bg-primary-contrast eldra:text-primary";
|
|
3496
3574
|
/** Ink for `thumb` slot content on the off thumb, which has no text colour of its own: `background`
|
|
3497
3575
|
* 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
|
|
3576
|
+
var THUMB_OFF_INK = "eldra:text-background";
|
|
3577
|
+
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
3578
|
// src/components/switch/Switch.vue
|
|
3501
3579
|
var Switch_default = /* @__PURE__ */ defineComponent({
|
|
3502
3580
|
inheritAttrs: false,
|
|
@@ -3568,7 +3646,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3568
3646
|
if (!hasError.value) return content;
|
|
3569
3647
|
return [...content, h(FieldError_default, {
|
|
3570
3648
|
id: errorId.value,
|
|
3571
|
-
rowClass: "mt-1",
|
|
3649
|
+
rowClass: "eldra:mt-1",
|
|
3572
3650
|
classes: props.classes
|
|
3573
3651
|
}, () => props.error)];
|
|
3574
3652
|
};
|
|
@@ -3596,7 +3674,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3596
3674
|
* element's transition list. See `src/styles/tailwind.css` and
|
|
3597
3675
|
* `src/__tests__/focus-transition.spec.ts`.
|
|
3598
3676
|
*/
|
|
3599
|
-
const rootClass = computed(() =>
|
|
3677
|
+
const rootClass = computed(() => [ROOT$1, props.disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer"]);
|
|
3600
3678
|
/**
|
|
3601
3679
|
* The track (spec "Switch" → Anatomy: "a pill with a 1.5px border"; → Sizes: 2.75 × 1.5rem at
|
|
3602
3680
|
* `md`, 2.25 × 1.25rem at `sm`, both `radius-full`). `--spacing` is 0.25rem, so every dimension
|
|
@@ -3608,15 +3686,19 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3608
3686
|
* — exactly like the thumb below, and Link's arrow — it may carry its own transition.
|
|
3609
3687
|
*/
|
|
3610
3688
|
const TRACK_SIZE = {
|
|
3611
|
-
md: "w-11 h-6",
|
|
3612
|
-
sm: "w-9 h-5"
|
|
3689
|
+
md: "eldra:w-11 eldra:h-6",
|
|
3690
|
+
sm: "eldra:w-9 eldra:h-5"
|
|
3613
3691
|
};
|
|
3614
3692
|
/** Spec "Switch" → States. Only `:hover` (nothing here can express it in JavaScript) is a variant. */
|
|
3615
3693
|
const trackState = computed(() => {
|
|
3616
3694
|
if (props.disabled) return model.value ? TRACK_DISABLED_ON : TRACK_DISABLED_OFF;
|
|
3617
3695
|
return model.value ? TRACK_ON : TRACK_OFF;
|
|
3618
3696
|
});
|
|
3619
|
-
const trackClass = computed(() =>
|
|
3697
|
+
const trackClass = computed(() => [[
|
|
3698
|
+
TRACK_BASE,
|
|
3699
|
+
TRACK_SIZE[props.size],
|
|
3700
|
+
trackState.value
|
|
3701
|
+
], props.classes?.track]);
|
|
3620
3702
|
/**
|
|
3621
3703
|
* The thumb (spec "Switch" → Anatomy: "a circle, with a check icon when on"; → Sizes: 1rem at
|
|
3622
3704
|
* `md`, 0.75rem at `sm`, resting 0.1875rem from the track's start edge, travelling 1.25rem/1rem to
|
|
@@ -3628,15 +3710,19 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3628
3710
|
* it may carry its own transition, exactly as Link's arrow does.
|
|
3629
3711
|
*/
|
|
3630
3712
|
const THUMB_SIZE = {
|
|
3631
|
-
md: "size-4",
|
|
3632
|
-
sm: "size-3"
|
|
3713
|
+
md: "eldra:size-4",
|
|
3714
|
+
sm: "eldra:size-3"
|
|
3633
3715
|
};
|
|
3634
3716
|
const THUMB_TRAVEL = {
|
|
3635
|
-
md: "translate-x-5",
|
|
3636
|
-
sm: "translate-x-4"
|
|
3717
|
+
md: "eldra:translate-x-5",
|
|
3718
|
+
sm: "eldra:translate-x-4"
|
|
3637
3719
|
};
|
|
3638
3720
|
/** Fill only changes with on/off, not with disabled (spec's States table repeats it unchanged). */
|
|
3639
|
-
const thumbClass = computed(() =>
|
|
3721
|
+
const thumbClass = computed(() => [[
|
|
3722
|
+
THUMB_BASE,
|
|
3723
|
+
THUMB_SIZE[props.size],
|
|
3724
|
+
model.value ? [THUMB_ON, THUMB_TRAVEL[props.size]] : [THUMB_OFF, slots.thumb !== void 0 && THUMB_OFF_INK]
|
|
3725
|
+
], props.classes?.thumb]);
|
|
3640
3726
|
const slotProps = computed(() => ({
|
|
3641
3727
|
checked: model.value,
|
|
3642
3728
|
disabled: props.disabled
|
|
@@ -3648,25 +3734,34 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3648
3734
|
* track `primary-contrast`; off, and on a disabled track, `muted`.
|
|
3649
3735
|
*/
|
|
3650
3736
|
function trackSlotClass(end, part) {
|
|
3651
|
-
return
|
|
3737
|
+
return [[
|
|
3738
|
+
TRACK_SLOT_BASE,
|
|
3739
|
+
THUMB_SIZE[props.size],
|
|
3740
|
+
end && THUMB_TRAVEL[props.size],
|
|
3741
|
+
model.value && !props.disabled ? "eldra:text-primary-contrast" : "eldra:text-muted"
|
|
3742
|
+
], props.classes?.[part]];
|
|
3652
3743
|
}
|
|
3653
3744
|
const trackStartClass = computed(() => trackSlotClass(false, "trackStart"));
|
|
3654
3745
|
const trackEndClass = computed(() => trackSlotClass(true, "trackEnd"));
|
|
3655
3746
|
/** Spec "Switch" → Sizes: check icon 0.75rem/3px stroke at `md`, 0.625rem at `sm`. */
|
|
3656
3747
|
const CHECK_SIZE = {
|
|
3657
|
-
md: "size-3",
|
|
3658
|
-
sm: "size-2.5"
|
|
3748
|
+
md: "eldra:size-3",
|
|
3749
|
+
sm: "eldra:size-2.5"
|
|
3659
3750
|
};
|
|
3660
|
-
const checkClass = computed(() =>
|
|
3751
|
+
const checkClass = computed(() => ["eldra:pointer-events-none", CHECK_SIZE[props.size]]);
|
|
3661
3752
|
/**
|
|
3662
3753
|
* The label (spec "Switch" → Sizes: "Label | 1rem" at `md`, "0.875rem / 1.5" at `sm` — the second
|
|
3663
3754
|
* number matches `text-body-sm` exactly, so `sm` reuses it rather than a near-identical utility).
|
|
3664
3755
|
*/
|
|
3665
3756
|
const LABEL_SIZE = {
|
|
3666
|
-
md: "text-switch-label",
|
|
3667
|
-
sm: "text-body-sm"
|
|
3757
|
+
md: "eldra:text-switch-label",
|
|
3758
|
+
sm: "eldra:text-body-sm"
|
|
3668
3759
|
};
|
|
3669
|
-
const labelClass = computed(() =>
|
|
3760
|
+
const labelClass = computed(() => [[
|
|
3761
|
+
LABEL_SIZE[props.size],
|
|
3762
|
+
"eldra:col-start-2 eldra:min-w-0",
|
|
3763
|
+
props.disabled ? "eldra:text-muted" : "eldra:text-text"
|
|
3764
|
+
], props.classes?.label]);
|
|
3670
3765
|
/**
|
|
3671
3766
|
* The description (spec "Switch" → Anatomy: "a `muted` second line"; → Accessibility: "The
|
|
3672
3767
|
* description is referenced by `aria-describedby`."). It sits in the grid's second row, `col-
|
|
@@ -3678,7 +3773,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3678
3773
|
* *description*; browsers read an `aria-describedby` target's text regardless of `aria-hidden` on
|
|
3679
3774
|
* that target, which is the standard technique for a description that must not double as the name.
|
|
3680
3775
|
*/
|
|
3681
|
-
const descriptionClass = computed(() =>
|
|
3776
|
+
const descriptionClass = computed(() => ["eldra:text-switch-description eldra:text-muted eldra:col-start-2", props.classes?.description]);
|
|
3682
3777
|
return (_ctx, _cache) => {
|
|
3683
3778
|
return openBlock(), createBlock(WithError, null, {
|
|
3684
3779
|
default: withCtx(() => [createElementVNode("button", mergeProps({
|
|
@@ -3721,7 +3816,7 @@ var Switch_default = /* @__PURE__ */ defineComponent({
|
|
|
3721
3816
|
key: 0,
|
|
3722
3817
|
"data-eldra-slot": unref(eldra).slotHost("thumb"),
|
|
3723
3818
|
"aria-hidden": "true",
|
|
3724
|
-
class: "pointer-events-none inline-flex"
|
|
3819
|
+
class: "eldra:pointer-events-none eldra:inline-flex"
|
|
3725
3820
|
}, [renderSlot(_ctx.$slots, "thumb", normalizeProps(guardReactiveProps(slotProps.value)))], 8, _hoisted_4$10)) : unref(model) ? (openBlock(), createElementBlock("svg", {
|
|
3726
3821
|
key: 1,
|
|
3727
3822
|
class: normalizeClass(checkClass.value),
|
|
@@ -3800,14 +3895,14 @@ var _hoisted_1$10 = [
|
|
|
3800
3895
|
var _hoisted_2$10 = ["data-eldra-slot"];
|
|
3801
3896
|
var _hoisted_3$10 = ["data-eldra-slot"];
|
|
3802
3897
|
var _hoisted_4$9 = ["data-eldra-slot"];
|
|
3803
|
-
var ROOT_BASE$1 = "
|
|
3898
|
+
var ROOT_BASE$1 = "eldra:@container eldra:w-full";
|
|
3804
3899
|
/**
|
|
3805
3900
|
* Spec "Form layout" → Anatomy: "form (grid, 1rem row gap)". The inline form is the one exception:
|
|
3806
3901
|
* a wrapping flex row that keeps the field and the button on one line until there is no room
|
|
3807
3902
|
* ("inline form (flex, wraps, bottom-aligned)", 0.5rem gap).
|
|
3808
3903
|
*/
|
|
3809
|
-
var ACTIONS_BASE = "flex flex-wrap items-center
|
|
3810
|
-
var ACTIONS_STACKED = "
|
|
3904
|
+
var ACTIONS_BASE = "eldra:flex eldra:flex-wrap eldra:items-center eldra:[&>a:first-child]:me-auto";
|
|
3905
|
+
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
3906
|
// src/components/form-layout/FormLayout.vue
|
|
3812
3907
|
var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
3813
3908
|
__name: "FormLayout",
|
|
@@ -3872,9 +3967,9 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3872
3967
|
* this container for that purpose any more.
|
|
3873
3968
|
*/
|
|
3874
3969
|
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"
|
|
3970
|
+
single: "eldra:grid eldra:gap-4",
|
|
3971
|
+
two: "eldra:grid eldra:gap-4",
|
|
3972
|
+
inline: "eldra:flex eldra:flex-wrap eldra:items-end eldra:gap-x-2 eldra:gap-y-1"
|
|
3878
3973
|
};
|
|
3879
3974
|
/**
|
|
3880
3975
|
* Spec "Form layout" → Variants, Two-column: "pairs sit side by side from a 36rem container …
|
|
@@ -3887,9 +3982,9 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3887
3982
|
* row.
|
|
3888
3983
|
*/
|
|
3889
3984
|
const FIELDS = {
|
|
3890
|
-
single: "grid gap-4",
|
|
3891
|
-
two: "grid gap-4
|
|
3892
|
-
inline: "contents"
|
|
3985
|
+
single: "eldra:grid eldra:gap-4",
|
|
3986
|
+
two: "eldra:grid eldra:gap-4 eldra:@two-col:grid-cols-2",
|
|
3987
|
+
inline: "eldra:contents"
|
|
3893
3988
|
};
|
|
3894
3989
|
/**
|
|
3895
3990
|
* Spec "Form layout" → Sizes and Variants, Actions row: "0.75rem gap, wraps, items centred,
|
|
@@ -3908,11 +4003,11 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3908
4003
|
* the row so a caller does not have to set it per button for one breakpoint.
|
|
3909
4004
|
*/
|
|
3910
4005
|
const ACTIONS = {
|
|
3911
|
-
single: `justify-end pt-1 ${ACTIONS_STACKED}`,
|
|
3912
|
-
two: `justify-end pt-1 ${ACTIONS_STACKED}`,
|
|
3913
|
-
inline: "shrink-0 gap-2"
|
|
4006
|
+
single: `eldra:gap-3 eldra:justify-end eldra:pt-1 ${ACTIONS_STACKED}`,
|
|
4007
|
+
two: `eldra:gap-3 eldra:justify-end eldra:pt-1 ${ACTIONS_STACKED}`,
|
|
4008
|
+
inline: "eldra:shrink-0 eldra:gap-2"
|
|
3914
4009
|
};
|
|
3915
|
-
const rootClass = computed(() =>
|
|
4010
|
+
const rootClass = computed(() => [ROOT_BASE$1, ROOT[props.layout]]);
|
|
3916
4011
|
/**
|
|
3917
4012
|
* Spec "Form layout" → Anatomy: "Heading (optional): h4 style (1.125rem, 600)". `h4` names the
|
|
3918
4013
|
* type style, not the outline level — `headingLevel` picks the element, defaulting to the `<h2>` a
|
|
@@ -3920,18 +4015,18 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3920
4015
|
* the field and the button.
|
|
3921
4016
|
*/
|
|
3922
4017
|
const headingTag = useHeadingTag(() => props.headingLevel);
|
|
3923
|
-
const headingClass = computed(() =>
|
|
4018
|
+
const headingClass = computed(() => [["eldra:text-h4 eldra:text-text", props.layout === "inline" && "eldra:basis-full"], props.classes?.heading]);
|
|
3924
4019
|
/**
|
|
3925
4020
|
* Spec "Form layout" → States, Invalid on submit: "Long forms add an error summary alert at the
|
|
3926
4021
|
* top (`surface` fill, 1px `danger` border, `danger` icon) that lists a link to each error." The
|
|
3927
4022
|
* component draws the box and the icon; the slot supplies the list, because only the caller knows
|
|
3928
4023
|
* which fields failed and what to link to.
|
|
3929
4024
|
*/
|
|
3930
|
-
const errorSummaryClass = computed(() =>
|
|
3931
|
-
const fieldsClass = computed(() =>
|
|
3932
|
-
const actionsClass = computed(() =>
|
|
4025
|
+
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]);
|
|
4026
|
+
const fieldsClass = computed(() => [FIELDS[props.layout], props.classes?.fields]);
|
|
4027
|
+
const actionsClass = computed(() => [[ACTIONS_BASE, ACTIONS[props.layout]], props.classes?.actions]);
|
|
3933
4028
|
/** Never visible; `classes.status` is here so a consumer can unhide it while debugging. */
|
|
3934
|
-
const statusClass = computed(() =>
|
|
4029
|
+
const statusClass = computed(() => props.classes?.status);
|
|
3935
4030
|
/**
|
|
3936
4031
|
* Spec "Form layout" → Events and States, Invalid on submit.
|
|
3937
4032
|
*
|
|
@@ -3989,7 +4084,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
3989
4084
|
class: normalizeClass(errorSummaryClass.value),
|
|
3990
4085
|
role: "alert"
|
|
3991
4086
|
}, [_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
3992
|
-
class: "text-danger mt-0.5 size-5 shrink-0",
|
|
4087
|
+
class: "eldra:text-danger eldra:mt-0.5 eldra:size-5 eldra:shrink-0",
|
|
3993
4088
|
viewBox: "0 0 24 24",
|
|
3994
4089
|
fill: "none",
|
|
3995
4090
|
stroke: "currentColor",
|
|
@@ -4004,7 +4099,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4004
4099
|
createElementVNode("path", { d: "M12 16h.01" })
|
|
4005
4100
|
], -1)), createElementVNode("div", {
|
|
4006
4101
|
"data-eldra-slot": unref(eldra).slotHost("errorSummary"),
|
|
4007
|
-
class: "min-w-0"
|
|
4102
|
+
class: "eldra:min-w-0"
|
|
4008
4103
|
}, [renderSlot(_ctx.$slots, "errorSummary")], 8, _hoisted_2$10)], 2)) : createCommentVNode("", true),
|
|
4009
4104
|
createElementVNode("div", {
|
|
4010
4105
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
@@ -4022,11 +4117,11 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4022
4117
|
"data-part": "status",
|
|
4023
4118
|
role: "status",
|
|
4024
4119
|
"aria-live": "polite",
|
|
4025
|
-
|
|
4120
|
+
class: normalizeClass(statusClass.value)
|
|
4026
4121
|
}, {
|
|
4027
4122
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.statusMessage), 1)]),
|
|
4028
4123
|
_: 1
|
|
4029
|
-
}, 8, ["
|
|
4124
|
+
}, 8, ["class"])
|
|
4030
4125
|
], 42, _hoisted_1$10);
|
|
4031
4126
|
};
|
|
4032
4127
|
}
|
|
@@ -4038,8 +4133,7 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4038
4133
|
* (which renders the panel) and a trigger (which reuses an option's swatch and icon for the chosen
|
|
4039
4134
|
* option's mark) can call them.
|
|
4040
4135
|
*
|
|
4041
|
-
* Each
|
|
4042
|
-
* `tailwind-merge` rather than landing beside it.
|
|
4136
|
+
* Each returns a Vue class value with the consumer's per-part classes appended last.
|
|
4043
4137
|
*/
|
|
4044
4138
|
/**
|
|
4045
4139
|
* The popover (spec "Select" → Sizes, Popover row). Not a dialog: it is a non-modal popup
|
|
@@ -4059,24 +4153,49 @@ var FormLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
4059
4153
|
* (or on the teleport target), which is what the README's Customisation section already asks for.
|
|
4060
4154
|
*/
|
|
4061
4155
|
function panelClass(classes) {
|
|
4062
|
-
return
|
|
4156
|
+
return [
|
|
4157
|
+
"eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-hidden",
|
|
4158
|
+
"eldra:eldra-select-panel-height eldra:eldra-select-panel-width",
|
|
4159
|
+
"eldra:rounded-md eldra:border eldra:shadow-md",
|
|
4160
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
4161
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
4162
|
+
"eldra:text-[color:var(--eldra-select-panel-text)]",
|
|
4163
|
+
"eldra:animate-eldra-popover-in",
|
|
4164
|
+
classes?.panel
|
|
4165
|
+
];
|
|
4063
4166
|
}
|
|
4064
4167
|
/**
|
|
4065
4168
|
* Spec "Select" → Sizes, Search field: 2.5rem tall, text from 2.125rem. No focus ring (a README
|
|
4066
4169
|
* Deviation): focus sits here whenever the panel is open, so the caret and the active row show it.
|
|
4067
4170
|
*/
|
|
4068
4171
|
function searchClass(classes) {
|
|
4069
|
-
return
|
|
4172
|
+
return [
|
|
4173
|
+
"eldra:control-h eldra:w-full eldra:min-w-0 eldra:rounded-t-md eldra:bg-transparent eldra:ps-8.5 eldra:pe-3",
|
|
4174
|
+
"eldra:text-control-sm eldra:max-md:text-control-mobile",
|
|
4175
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
4176
|
+
"eldra:placeholder:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4177
|
+
"eldra:outline-none",
|
|
4178
|
+
classes?.search
|
|
4179
|
+
];
|
|
4070
4180
|
}
|
|
4071
4181
|
function listboxClass(classes, hasOptions) {
|
|
4072
|
-
return
|
|
4182
|
+
return [
|
|
4183
|
+
"eldra:overflow-y-auto eldra:overscroll-contain",
|
|
4184
|
+
hasOptions ? "eldra:min-h-0 eldra:flex-1 eldra:p-1" : "eldra:h-0",
|
|
4185
|
+
classes?.listbox
|
|
4186
|
+
];
|
|
4073
4187
|
}
|
|
4074
4188
|
/** Spec: "Every group after the first gets a 1px `border` hairline and 0.25rem gap above it." */
|
|
4075
4189
|
function groupClass(classes, index) {
|
|
4076
|
-
return
|
|
4190
|
+
return [index > 0 && "eldra:mt-1 eldra:border-t eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]", classes?.group];
|
|
4077
4191
|
}
|
|
4078
4192
|
function groupLabelClass(classes, index) {
|
|
4079
|
-
return
|
|
4193
|
+
return [
|
|
4194
|
+
"eldra:text-select-group eldra:px-2 eldra:pb-1",
|
|
4195
|
+
"eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
4196
|
+
index > 0 ? "eldra:pt-2.5" : "eldra:pt-2",
|
|
4197
|
+
classes?.groupLabel
|
|
4198
|
+
];
|
|
4080
4199
|
}
|
|
4081
4200
|
/**
|
|
4082
4201
|
* Spec "Select" → Sizes, Option row, and → States for active / selected / disabled.
|
|
@@ -4086,31 +4205,42 @@ function groupLabelClass(classes, index) {
|
|
|
4086
4205
|
* "Multi-select" → States, Option selected).
|
|
4087
4206
|
*/
|
|
4088
4207
|
function optionClass(classes, option, state) {
|
|
4089
|
-
return
|
|
4208
|
+
return [
|
|
4209
|
+
"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",
|
|
4210
|
+
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4211
|
+
state.selected && (state.multiple ? "eldra:font-medium" : "eldra:font-semibold"),
|
|
4212
|
+
state.selected && "eldra:eldra-select-option-selected",
|
|
4213
|
+
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",
|
|
4214
|
+
classes?.option
|
|
4215
|
+
];
|
|
4090
4216
|
}
|
|
4091
4217
|
/** A disabled row reads as disabled through the row's `muted` text and cursor, like `Checkbox`. */
|
|
4092
4218
|
function optionLabelClass(classes) {
|
|
4093
|
-
return
|
|
4219
|
+
return ["eldra:block", classes?.optionLabel];
|
|
4094
4220
|
}
|
|
4095
4221
|
function optionHintClass(classes) {
|
|
4096
|
-
return
|
|
4222
|
+
return ["eldra:text-caption eldra:block eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", classes?.optionHint];
|
|
4097
4223
|
}
|
|
4098
4224
|
var META_TONE = {
|
|
4099
|
-
warning: "text-warning font-semibold",
|
|
4100
|
-
danger: "text-danger font-semibold"
|
|
4225
|
+
warning: "eldra:text-warning eldra:font-semibold",
|
|
4226
|
+
danger: "eldra:text-danger eldra:font-semibold"
|
|
4101
4227
|
};
|
|
4102
4228
|
function optionMetaClass(classes, option) {
|
|
4103
|
-
return
|
|
4229
|
+
return [
|
|
4230
|
+
"eldra:ms-3 eldra:shrink-0 eldra:text-caption eldra:tabular-nums",
|
|
4231
|
+
option.metaTone === void 0 ? "eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : META_TONE[option.metaTone],
|
|
4232
|
+
classes?.optionMeta
|
|
4233
|
+
];
|
|
4104
4234
|
}
|
|
4105
4235
|
function optionSwatchClass(classes) {
|
|
4106
|
-
return
|
|
4236
|
+
return ["eldra:size-4 eldra:shrink-0 eldra:rounded-full eldra:eldra-select-swatch", classes?.optionSwatch];
|
|
4107
4237
|
}
|
|
4108
4238
|
function optionIconClass(classes) {
|
|
4109
|
-
return
|
|
4239
|
+
return ["eldra:size-4.5 eldra:shrink-0", classes?.optionIcon];
|
|
4110
4240
|
}
|
|
4111
4241
|
/** Spec "Select" → States, Option selected: "check mark in `text` (never colour alone)". */
|
|
4112
4242
|
function optionCheckClass(classes) {
|
|
4113
|
-
return
|
|
4243
|
+
return ["eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-check,var(--eldra-color-text))]", classes?.optionCheck];
|
|
4114
4244
|
}
|
|
4115
4245
|
/**
|
|
4116
4246
|
* A multi-select option's checkbox (spec "Multi-select" → Sizes, "Checkbox in option"): "1rem
|
|
@@ -4123,18 +4253,24 @@ function optionCheckClass(classes) {
|
|
|
4123
4253
|
* restyled these; the radius is the spec's smaller 0.25rem, on its own variable.
|
|
4124
4254
|
*/
|
|
4125
4255
|
function optionBoxClass(classes, state) {
|
|
4126
|
-
return
|
|
4256
|
+
return [
|
|
4257
|
+
"eldra:relative eldra:inline-flex eldra:size-4 eldra:shrink-0 eldra:items-center eldra:justify-center",
|
|
4258
|
+
"eldra:eldra-checkbox-border eldra:eldra-select-check-radius",
|
|
4259
|
+
"eldra:transition-colors eldra:duration-fast eldra:ease-out",
|
|
4260
|
+
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))]",
|
|
4261
|
+
classes?.optionCheck
|
|
4262
|
+
];
|
|
4127
4263
|
}
|
|
4128
4264
|
/** Spec "Select" → Sizes, Empty state: "0.875rem, `muted`, centred, padding 1rem 0.75rem". */
|
|
4129
4265
|
function emptyClass(classes) {
|
|
4130
|
-
return
|
|
4266
|
+
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
4267
|
}
|
|
4132
4268
|
/**
|
|
4133
4269
|
* The loading row: the empty state's box, with the shared spinner before its text. It stands in
|
|
4134
4270
|
* for the list and the empty state while a `loading` control's options are being fetched.
|
|
4135
4271
|
*/
|
|
4136
4272
|
function loadingClass(classes) {
|
|
4137
|
-
return
|
|
4273
|
+
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
4274
|
}
|
|
4139
4275
|
/**
|
|
4140
4276
|
* The "Create “query”" row of a `creatable` control: an option row's own box and active fill, with
|
|
@@ -4142,7 +4278,12 @@ function loadingClass(classes) {
|
|
|
4142
4278
|
* by `SelectPanel`), so it reads as an action rather than one more match.
|
|
4143
4279
|
*/
|
|
4144
4280
|
function createOptionClass(classes, state) {
|
|
4145
|
-
return
|
|
4281
|
+
return [
|
|
4282
|
+
"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",
|
|
4283
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))] eldra:cursor-pointer",
|
|
4284
|
+
state.active && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
4285
|
+
classes?.createOption
|
|
4286
|
+
];
|
|
4146
4287
|
}
|
|
4147
4288
|
/**
|
|
4148
4289
|
* The tick inside that box (spec "Multi-select" → Sizes: "a `primary-contrast` tick (0.25 × 0.5rem,
|
|
@@ -4158,7 +4299,11 @@ function createOptionClass(classes, state) {
|
|
|
4158
4299
|
* `duration-fast` the way `Checkbox`'s does.
|
|
4159
4300
|
*/
|
|
4160
4301
|
function optionTickClass(selected) {
|
|
4161
|
-
return
|
|
4302
|
+
return [
|
|
4303
|
+
"eldra:text-[color:var(--eldra-select-panel-check-contrast,var(--eldra-color-primary-contrast))]",
|
|
4304
|
+
"eldra:pointer-events-none eldra:size-2 eldra:transition-transform eldra:duration-fast eldra:ease-out",
|
|
4305
|
+
selected ? "eldra:scale-100" : "eldra:scale-0"
|
|
4306
|
+
];
|
|
4162
4307
|
}
|
|
4163
4308
|
/**
|
|
4164
4309
|
* The cell a trigger stacks its chosen value in, with an invisible copy of the placeholder
|
|
@@ -4166,9 +4311,9 @@ function optionTickClass(selected) {
|
|
|
4166
4311
|
* least its placeholder's width once a value is chosen, as a native input keeps its width. The copy
|
|
4167
4312
|
* is generated content under `visibility: hidden`, so it adds no text and no accessible name.
|
|
4168
4313
|
*/
|
|
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)]";
|
|
4314
|
+
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
4315
|
/** 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";
|
|
4316
|
+
var TRIGGER_VALUE_CELL = "eldra:col-start-1 eldra:row-start-1";
|
|
4172
4317
|
// src/components/select/SelectPanel.vue?vue&type=script&setup=true&lang.ts
|
|
4173
4318
|
var _hoisted_1$9 = [
|
|
4174
4319
|
"data-eldra-slot",
|
|
@@ -4208,11 +4353,11 @@ var _hoisted_7$3 = [
|
|
|
4208
4353
|
"onMouseenter"
|
|
4209
4354
|
];
|
|
4210
4355
|
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" };
|
|
4356
|
+
var _hoisted_9$3 = { class: "eldra:min-w-0 eldra:flex-1" };
|
|
4357
|
+
var _hoisted_10$3 = { class: "eldra:eldra-select-match" };
|
|
4213
4358
|
var _hoisted_11$3 = ["data-eldra-scope"];
|
|
4214
4359
|
var _hoisted_12$3 = ["id"];
|
|
4215
|
-
var _hoisted_13$2 = { class: "min-w-0 flex-1 truncate" };
|
|
4360
|
+
var _hoisted_13$2 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
4216
4361
|
var _hoisted_14$2 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4217
4362
|
var _hoisted_15$1 = ["data-eldra-slot", "data-eldra-scope"];
|
|
4218
4363
|
var SCROLL_END_SLACK = 80;
|
|
@@ -4351,9 +4496,9 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4351
4496
|
__props.searchable ? (openBlock(), createElementBlock("div", {
|
|
4352
4497
|
key: 0,
|
|
4353
4498
|
"data-eldra-scope": unref(eldra).scope,
|
|
4354
|
-
class: "relative shrink-0 border-b border-[color:var(--eldra-select-panel-border,var(--color-border))]"
|
|
4499
|
+
class: "eldra:relative eldra:shrink-0 eldra:border-b eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]"
|
|
4355
4500
|
}, [_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))]",
|
|
4501
|
+
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
4502
|
viewBox: "0 0 24 24",
|
|
4358
4503
|
fill: "none",
|
|
4359
4504
|
stroke: "currentColor",
|
|
@@ -4451,12 +4596,19 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4451
4596
|
class: normalizeClass(optionSwatchClasses.value),
|
|
4452
4597
|
style: normalizeStyle({ backgroundColor: option.swatch }),
|
|
4453
4598
|
"aria-hidden": "true"
|
|
4454
|
-
}, null, 6)) : option.icon ? (openBlock(), createBlock(
|
|
4599
|
+
}, null, 6)) : option.icon ? (openBlock(), createBlock(resolveDynamicComponent(option.icon), {
|
|
4455
4600
|
key: 1,
|
|
4601
|
+
"data-eldra-scope": unref(eldra).scope,
|
|
4456
4602
|
"data-part": "optionIcon",
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4603
|
+
class: normalizeClass(optionIconClasses.value),
|
|
4604
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
4605
|
+
"aria-hidden": "true",
|
|
4606
|
+
focusable: "false"
|
|
4607
|
+
}, null, 8, [
|
|
4608
|
+
"data-eldra-scope",
|
|
4609
|
+
"class",
|
|
4610
|
+
"stroke-width"
|
|
4611
|
+
])) : createCommentVNode("", true),
|
|
4460
4612
|
createElementVNode("span", _hoisted_9$3, [createElementVNode("span", {
|
|
4461
4613
|
"data-part": "optionLabel",
|
|
4462
4614
|
class: normalizeClass(unref(optionLabelClass)(__props.classes))
|
|
@@ -4494,7 +4646,7 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4494
4646
|
}), 128)), __props.createOption ? (openBlock(), createElementBlock("div", {
|
|
4495
4647
|
key: 0,
|
|
4496
4648
|
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)
|
|
4649
|
+
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
4650
|
}, [createElementVNode("div", {
|
|
4499
4651
|
id: __props.optionId(__props.createOption.value),
|
|
4500
4652
|
"data-part": "createOption",
|
|
@@ -4521,7 +4673,7 @@ var SelectPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
4521
4673
|
"data-part": "loading",
|
|
4522
4674
|
role: "status",
|
|
4523
4675
|
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", {
|
|
4676
|
+
}, [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
4677
|
key: 2,
|
|
4526
4678
|
"data-eldra-slot": unref(eldra).slotHost("empty"),
|
|
4527
4679
|
"data-eldra-scope": unref(eldra).scope,
|
|
@@ -4542,7 +4694,7 @@ var _hoisted_1$8 = [
|
|
|
4542
4694
|
];
|
|
4543
4695
|
var _hoisted_2$8 = ["data-eldra-slot"];
|
|
4544
4696
|
var _hoisted_3$8 = ["data-eldra-slot"];
|
|
4545
|
-
var _hoisted_4$7 = { class: "min-w-0 truncate" };
|
|
4697
|
+
var _hoisted_4$7 = { class: "eldra:min-w-0 eldra:truncate" };
|
|
4546
4698
|
var _hoisted_5$6 = [
|
|
4547
4699
|
"data-eldra-scope",
|
|
4548
4700
|
"aria-label",
|
|
@@ -4568,29 +4720,52 @@ var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
|
4568
4720
|
const props = __props;
|
|
4569
4721
|
const emit = __emit;
|
|
4570
4722
|
const eldra = useEldraScope();
|
|
4571
|
-
const part = (base, name) => partClass(base, props.classes, name);
|
|
4572
4723
|
/**
|
|
4573
4724
|
* `tagRecipe`'s `TAG_FILL` and `TAG_REMOVE_BUTTON`, with each colour read through a
|
|
4574
4725
|
* `--eldra-select-tag-*` variable that falls back to the token the recipe uses, so a consumer
|
|
4575
4726
|
* recolours these tags without re-theming the `tag` slot's content or `Chip`.
|
|
4576
4727
|
*/
|
|
4577
|
-
const SELECT_TAG_FILL =
|
|
4578
|
-
const SELECT_TAG_REMOVE_BUTTON =
|
|
4728
|
+
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))]"];
|
|
4729
|
+
const SELECT_TAG_REMOVE_BUTTON = [
|
|
4730
|
+
"eldra:inline-flex eldra:size-6 eldra:shrink-0 eldra:cursor-pointer eldra:items-center eldra:justify-center eldra:rounded-full",
|
|
4731
|
+
"eldra:text-[color:var(--eldra-select-tag-muted,var(--eldra-color-muted))]",
|
|
4732
|
+
"eldra:hover:text-[color:var(--eldra-select-tag-text,var(--eldra-color-text))]",
|
|
4733
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-select-tag-text,var(--eldra-color-text)),transparent_89%)]",
|
|
4734
|
+
"eldra:eldra-focus"
|
|
4735
|
+
];
|
|
4579
4736
|
/**
|
|
4580
4737
|
* Spec "Multi-select" → Sizes, Tags: "small chips: min 1.75rem tall, 0.8125rem text, 0.625rem start
|
|
4581
4738
|
* padding, `surface-strong` fill, `radius-full`. … The list wraps with a 0.375rem gap, 0.25rem
|
|
4582
4739
|
* below the control." The chip and its remove button are the same recipe `Chip`'s own `sm` size
|
|
4583
4740
|
* draws — see `src/utils/tagRecipe.ts`.
|
|
4584
4741
|
*/
|
|
4585
|
-
const tagsClass = computed(() =>
|
|
4742
|
+
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
4743
|
/** The inside list's "+N": a tag's shape and fill, no remove button. */
|
|
4587
|
-
const tagMoreClass = computed(() =>
|
|
4744
|
+
const tagMoreClass = computed(() => [
|
|
4745
|
+
SELECT_TAG_FILL,
|
|
4746
|
+
TAG_SHAPE,
|
|
4747
|
+
tagPadding(false),
|
|
4748
|
+
"eldra:relative eldra:z-1 eldra:select-none",
|
|
4749
|
+
props.classes?.tagMore
|
|
4750
|
+
]);
|
|
4588
4751
|
/** A disabled option's tag is fixed, as its row in the panel is: no remove button, no end inset. */
|
|
4589
|
-
const tagClass = (option) =>
|
|
4752
|
+
const tagClass = (option) => [
|
|
4753
|
+
SELECT_TAG_FILL,
|
|
4754
|
+
TAG_SHAPE,
|
|
4755
|
+
tagPadding(props.removable && !option.disabled),
|
|
4756
|
+
"eldra:min-w-0",
|
|
4757
|
+
props.inside && props.more > 0 ? "eldra:max-w-[calc(100%-3rem)]" : "eldra:max-w-full",
|
|
4758
|
+
props.inside && "eldra:relative eldra:z-1",
|
|
4759
|
+
props.classes?.tag
|
|
4760
|
+
];
|
|
4590
4761
|
/** A `tagItem` slot draws its own chip, so its `<li>` carries no fill, shape or padding. */
|
|
4591
|
-
const tagItemClass = computed(() =>
|
|
4762
|
+
const tagItemClass = computed(() => [
|
|
4763
|
+
"eldra:flex eldra:min-w-0 eldra:max-w-full",
|
|
4764
|
+
props.inside && "eldra:relative eldra:z-1",
|
|
4765
|
+
props.classes?.tag
|
|
4766
|
+
]);
|
|
4592
4767
|
/** "Remove button 1.5rem circle with a 0.875rem icon (hover `text` at 11%)." */
|
|
4593
|
-
const tagRemoveClass = computed(() =>
|
|
4768
|
+
const tagRemoveClass = computed(() => [SELECT_TAG_REMOVE_BUTTON, props.classes?.tagRemove]);
|
|
4594
4769
|
return (_ctx, _cache) => {
|
|
4595
4770
|
return openBlock(), createElementBlock("ul", {
|
|
4596
4771
|
id: __props.id,
|
|
@@ -4631,7 +4806,7 @@ var SelectTags_default = /* @__PURE__ */ defineComponent({
|
|
|
4631
4806
|
"aria-label": __props.removeLabel(option.label),
|
|
4632
4807
|
onClick: ($event) => emit("remove", option.value)
|
|
4633
4808
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
4634
|
-
class: "size-3.5",
|
|
4809
|
+
class: "eldra:size-3.5",
|
|
4635
4810
|
viewBox: "0 0 24 24",
|
|
4636
4811
|
fill: "none",
|
|
4637
4812
|
stroke: "currentColor",
|
|
@@ -5818,7 +5993,7 @@ var _hoisted_6$4 = ["data-placeholder"];
|
|
|
5818
5993
|
var _hoisted_7$2 = ["data-eldra-slot"];
|
|
5819
5994
|
var _hoisted_8$2 = {
|
|
5820
5995
|
key: 0,
|
|
5821
|
-
class: "min-w-0 truncate"
|
|
5996
|
+
class: "eldra:min-w-0 eldra:truncate"
|
|
5822
5997
|
};
|
|
5823
5998
|
var _hoisted_9$2 = [
|
|
5824
5999
|
"id",
|
|
@@ -5835,13 +6010,14 @@ var _hoisted_11$2 = [
|
|
|
5835
6010
|
var _hoisted_12$2 = ["label"];
|
|
5836
6011
|
var _hoisted_13$1 = ["value", "disabled"];
|
|
5837
6012
|
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 TRIGGER_BASE$1 = "flex w-full min-w-0 items-center gap-2 text-start eldra-field-border rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra-focus eldra-focus-open";
|
|
5840
|
-
var
|
|
5841
|
-
var
|
|
5842
|
-
var
|
|
5843
|
-
var
|
|
5844
|
-
var
|
|
6013
|
+
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";
|
|
6014
|
+
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";
|
|
6015
|
+
var LIVE_FILL$2 = "eldra:bg-background eldra:text-text eldra:cursor-pointer";
|
|
6016
|
+
var REST$1 = "eldra:border-border-strong eldra:hover:border-text";
|
|
6017
|
+
var OPEN$1 = "eldra:border-text eldra:hover:border-text";
|
|
6018
|
+
var INVALID$3 = "eldra:border-danger eldra:hover:border-danger";
|
|
6019
|
+
var DISABLED$3 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
6020
|
+
var READONLY_FILL$2 = "eldra:bg-surface eldra:text-text eldra:cursor-default";
|
|
5845
6021
|
// src/components/select/MultiSelect.vue
|
|
5846
6022
|
var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
5847
6023
|
inheritAttrs: false,
|
|
@@ -6223,24 +6399,34 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6223
6399
|
listbox.activateFrom(void 0);
|
|
6224
6400
|
});
|
|
6225
6401
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
6226
|
-
const
|
|
6227
|
-
const rootClass = computed(() => part(cx("relative block w-full", showsInvalid.value && "eldra-field-invalid"), "root"));
|
|
6402
|
+
const rootClass = computed(() => ["eldra:relative eldra:block eldra:w-full", showsInvalid.value && "eldra:eldra-field-invalid"]);
|
|
6228
6403
|
/**
|
|
6229
6404
|
* The trigger box: the same box as `Select`'s, which is the same box as `Input`'s — including
|
|
6230
6405
|
* `eldra-focus-open`, which keeps the ring on while the popover is open (see `Select.vue`'s own
|
|
6231
6406
|
* comment for why a pointer-opened trigger needs it).
|
|
6232
6407
|
*/
|
|
6233
6408
|
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"
|
|
6409
|
+
sm: "eldra:control-h-sm eldra:ps-2.25 eldra:pe-2.5 eldra:text-control-sm",
|
|
6410
|
+
md: "eldra:control-h eldra:ps-2.75 eldra:pe-2.5 eldra:text-control eldra:max-md:text-control-mobile",
|
|
6411
|
+
lg: "eldra:control-h-lg eldra:ps-2.75 eldra:pe-2.5 eldra:text-control-lg"
|
|
6237
6412
|
};
|
|
6238
6413
|
/**
|
|
6239
6414
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README) replaces
|
|
6240
6415
|
* 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
|
-
|
|
6416
|
+
* no popover) and disabled keeps `cursor-not-allowed`. As in `Select`, the fill and the boundary
|
|
6417
|
+
* are picked apart: the error boundary over the open one over the rest one.
|
|
6418
|
+
*/
|
|
6419
|
+
function boxState() {
|
|
6420
|
+
if (props.disabled) return DISABLED$3;
|
|
6421
|
+
if (props.readonly) return `${READONLY_FILL$2} ${showsInvalid.value ? INVALID$3 : "eldra:border-border"}`;
|
|
6422
|
+
return `${LIVE_FILL$2} ${showsInvalid.value ? INVALID$3 : isOpen.value ? OPEN$1 : REST$1}`;
|
|
6423
|
+
}
|
|
6424
|
+
const triggerClass = computed(() => [
|
|
6425
|
+
TRIGGER_BASE$1,
|
|
6426
|
+
SIZE[props.size],
|
|
6427
|
+
boxState(),
|
|
6428
|
+
props.classes?.trigger
|
|
6429
|
+
]);
|
|
6244
6430
|
/**
|
|
6245
6431
|
* `tagPlacement: 'inside'`: the field takes the trigger box's border, fill, states and ring (through
|
|
6246
6432
|
* `eldra-focus-proxy`, and while open through the expanded trigger inside it), wraps the tags and
|
|
@@ -6248,40 +6434,83 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6248
6434
|
* control height; the end padding keeps every row clear of the chevron, and of Clear while it shows.
|
|
6249
6435
|
*/
|
|
6250
6436
|
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"
|
|
6437
|
+
sm: "eldra:min-h-(--eldra-control-height-sm) eldra:py-px eldra:ps-0.75 eldra:text-control-sm",
|
|
6438
|
+
md: "eldra:min-h-(--eldra-control-height) eldra:py-1.25 eldra:ps-1.25 eldra:text-control eldra:max-md:text-control-mobile",
|
|
6439
|
+
lg: "eldra:min-h-(--eldra-control-height-lg) eldra:py-2.25 eldra:ps-2.25 eldra:text-control-lg"
|
|
6254
6440
|
};
|
|
6255
|
-
const fieldClass = computed(() => inside.value ?
|
|
6441
|
+
const fieldClass = computed(() => inside.value ? [
|
|
6442
|
+
"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",
|
|
6443
|
+
"eldra:rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra:eldra-focus eldra:eldra-focus-proxy",
|
|
6444
|
+
"eldra:has-[[aria-expanded=true]]:[--eldra-focus-alpha:1]",
|
|
6445
|
+
FIELD_SIZE[props.size],
|
|
6446
|
+
showClear.value ? "eldra:pe-15" : "eldra:pe-9",
|
|
6447
|
+
boxState(),
|
|
6448
|
+
props.classes?.field
|
|
6449
|
+
] : "eldra:relative");
|
|
6256
6450
|
/** Inside, the trigger: under the tags across the field, or the placeholder's row with none. */
|
|
6257
|
-
const insideTriggerClass = computed(() =>
|
|
6451
|
+
const insideTriggerClass = computed(() => [
|
|
6452
|
+
"eldra:flex eldra:items-center eldra:bg-transparent eldra:text-start eldra:outline-none",
|
|
6453
|
+
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",
|
|
6454
|
+
props.disabled ? "eldra:cursor-not-allowed" : props.readonly ? "eldra:cursor-default" : "eldra:cursor-pointer",
|
|
6455
|
+
props.classes?.trigger
|
|
6456
|
+
]);
|
|
6258
6457
|
/** The inside field's chevron: out of the flow, at the end, centred however many rows there are. */
|
|
6259
|
-
const insideChevronClass = computed(() =>
|
|
6260
|
-
|
|
6458
|
+
const insideChevronClass = computed(() => [
|
|
6459
|
+
"eldra:pointer-events-none eldra:absolute eldra:end-2.5 eldra:inset-y-0 eldra:my-auto eldra:size-4.5 eldra:text-muted",
|
|
6460
|
+
"eldra:transition-transform eldra:duration-base",
|
|
6461
|
+
isOpen.value && "eldra:rotate-180",
|
|
6462
|
+
props.classes?.chevron
|
|
6463
|
+
]);
|
|
6464
|
+
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
6465
|
/** The summary row: the labels, then the "+N" pill. 1.75rem of end padding while Clear shows. */
|
|
6262
|
-
const summaryClass = computed(() =>
|
|
6466
|
+
const summaryClass = computed(() => [
|
|
6467
|
+
"eldra:flex eldra:min-w-0 eldra:flex-1 eldra:items-center eldra:gap-2",
|
|
6468
|
+
TRIGGER_VALUE_CELL,
|
|
6469
|
+
fitsSummary.value && "eldra:contain-inline-size",
|
|
6470
|
+
showClear.value && "eldra:pe-7",
|
|
6471
|
+
props.classes?.summary
|
|
6472
|
+
]);
|
|
6263
6473
|
/** 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
|
-
|
|
6474
|
+
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]);
|
|
6475
|
+
const placeholderClass = computed(() => [
|
|
6476
|
+
"eldra:min-w-0 eldra:flex-1 eldra:truncate eldra:text-muted",
|
|
6477
|
+
showClear.value && "eldra:pe-7",
|
|
6478
|
+
props.classes?.placeholder
|
|
6479
|
+
]);
|
|
6480
|
+
const chevronClass = computed(() => [
|
|
6481
|
+
"eldra:size-4.5 eldra:shrink-0 eldra:text-muted eldra:transition-transform eldra:duration-base",
|
|
6482
|
+
isOpen.value && "eldra:rotate-180",
|
|
6483
|
+
props.classes?.chevron
|
|
6484
|
+
]);
|
|
6485
|
+
const clearButtonClass = computed(() => [
|
|
6486
|
+
"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",
|
|
6487
|
+
"eldra:rounded-sm eldra:text-muted eldra:hover:text-text",
|
|
6488
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
6489
|
+
"eldra:eldra-focus",
|
|
6490
|
+
props.classes?.clearButton
|
|
6491
|
+
]);
|
|
6268
6492
|
/**
|
|
6269
6493
|
* Spec "Multi-select" → Sizes, Footer: "padding 0.375rem (0.75rem at the start), 1px `border`
|
|
6270
6494
|
* hairline above, `background`, 0.5rem gap. The count … pushes the buttons to the end. It stays put
|
|
6271
6495
|
* while the list scrolls."
|
|
6272
6496
|
*/
|
|
6273
|
-
const footerClass = computed(() =>
|
|
6274
|
-
|
|
6497
|
+
const footerClass = computed(() => [
|
|
6498
|
+
"eldra:flex eldra:shrink-0 eldra:items-center eldra:gap-2 eldra:border-t eldra:p-1.5 eldra:ps-3",
|
|
6499
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
6500
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
6501
|
+
props.classes?.footer
|
|
6502
|
+
]);
|
|
6503
|
+
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
6504
|
/** Spec: "Clear = Button link sm (0.5rem side padding), Done = Button primary sm." */
|
|
6276
|
-
const footerClearClass = computed(() =>
|
|
6277
|
-
const footerDoneClass = computed(() =>
|
|
6505
|
+
const footerClearClass = computed(() => ["eldra:px-2", props.classes?.footerClear]);
|
|
6506
|
+
const footerDoneClass = computed(() => props.classes?.footerDone);
|
|
6278
6507
|
const emptyText = computed(() => query.value.trim() === "" ? m.value.noResults : m.value.noMatchesFor(query.value.trim()));
|
|
6279
6508
|
return (_ctx, _cache) => {
|
|
6280
6509
|
return openBlock(), createElementBlock("div", {
|
|
6281
6510
|
"data-eldra-ui": "",
|
|
6282
6511
|
"data-eldra-scope": unref(eldra).scope,
|
|
6283
6512
|
"data-part": "root",
|
|
6284
|
-
class: normalizeClass(rootClass.value)
|
|
6513
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
6285
6514
|
}, [
|
|
6286
6515
|
createElementVNode("div", {
|
|
6287
6516
|
ref_key: "fieldRef",
|
|
@@ -6299,11 +6528,13 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6299
6528
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
6300
6529
|
options: selectedOptions.value,
|
|
6301
6530
|
open: unref(isOpen)
|
|
6302
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
6531
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
6303
6532
|
key: 0,
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6533
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
6534
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
6535
|
+
"aria-hidden": "true",
|
|
6536
|
+
focusable: "false"
|
|
6537
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$7)) : createCommentVNode("", true),
|
|
6307
6538
|
inside.value && hasSelection.value ? (openBlock(), createBlock(SelectTags_default, {
|
|
6308
6539
|
key: 1,
|
|
6309
6540
|
id: tagsId.value,
|
|
@@ -6341,7 +6572,10 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6341
6572
|
createElementVNode("button", mergeProps({
|
|
6342
6573
|
ref_key: "triggerRef",
|
|
6343
6574
|
ref: triggerRef
|
|
6344
|
-
},
|
|
6575
|
+
}, {
|
|
6576
|
+
..._ctx.$attrs,
|
|
6577
|
+
class: void 0
|
|
6578
|
+
}, {
|
|
6345
6579
|
"data-part": "trigger",
|
|
6346
6580
|
type: "button",
|
|
6347
6581
|
role: "combobox",
|
|
@@ -6370,11 +6604,13 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6370
6604
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
6371
6605
|
options: selectedOptions.value,
|
|
6372
6606
|
open: unref(isOpen)
|
|
6373
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
6607
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
6374
6608
|
key: 0,
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6609
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
6610
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
6611
|
+
"aria-hidden": "true",
|
|
6612
|
+
focusable: "false"
|
|
6613
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_5$5)) : createCommentVNode("", true),
|
|
6378
6614
|
inside.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [!hasSelection.value ? (openBlock(), createElementBlock("span", {
|
|
6379
6615
|
key: 0,
|
|
6380
6616
|
"data-part": "placeholder",
|
|
@@ -6401,7 +6637,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6401
6637
|
}, [createElementVNode("span", {
|
|
6402
6638
|
ref_key: "summaryRunRef",
|
|
6403
6639
|
ref: summaryRunRef,
|
|
6404
|
-
class: "whitespace-nowrap"
|
|
6640
|
+
class: "eldra:whitespace-nowrap"
|
|
6405
6641
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectedOptions.value, (option, index) => {
|
|
6406
6642
|
return openBlock(), createElementBlock("span", {
|
|
6407
6643
|
key: option.value,
|
|
@@ -6422,7 +6658,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6422
6658
|
class: normalizeClass(chevronClass.value),
|
|
6423
6659
|
"aria-hidden": "true"
|
|
6424
6660
|
}, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
|
|
6425
|
-
class: "size-4.5",
|
|
6661
|
+
class: "eldra:size-4.5",
|
|
6426
6662
|
viewBox: "0 0 24 24",
|
|
6427
6663
|
fill: "none",
|
|
6428
6664
|
stroke: "currentColor",
|
|
@@ -6438,7 +6674,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6438
6674
|
class: normalizeClass(insideChevronClass.value),
|
|
6439
6675
|
"aria-hidden": "true"
|
|
6440
6676
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
6441
|
-
class: "size-4.5",
|
|
6677
|
+
class: "eldra:size-4.5",
|
|
6442
6678
|
viewBox: "0 0 24 24",
|
|
6443
6679
|
fill: "none",
|
|
6444
6680
|
stroke: "currentColor",
|
|
@@ -6458,7 +6694,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6458
6694
|
"data-eldra-overlay-owner": panelId.value,
|
|
6459
6695
|
onClick: onClearClick
|
|
6460
6696
|
}, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
|
|
6461
|
-
class: "size-4",
|
|
6697
|
+
class: "eldra:size-4",
|
|
6462
6698
|
viewBox: "0 0 24 24",
|
|
6463
6699
|
fill: "none",
|
|
6464
6700
|
stroke: "currentColor",
|
|
@@ -6519,23 +6755,23 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
6519
6755
|
size: "sm",
|
|
6520
6756
|
type: "button",
|
|
6521
6757
|
"data-part": "footerClear",
|
|
6522
|
-
|
|
6758
|
+
class: normalizeClass(footerClearClass.value),
|
|
6523
6759
|
onClick: onFooterClear
|
|
6524
6760
|
}, {
|
|
6525
6761
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).clear), 1)]),
|
|
6526
6762
|
_: 1
|
|
6527
|
-
}, 8, ["
|
|
6763
|
+
}, 8, ["class"]),
|
|
6528
6764
|
createVNode(Button_default, {
|
|
6529
6765
|
variant: "primary",
|
|
6530
6766
|
size: "sm",
|
|
6531
6767
|
type: "button",
|
|
6532
6768
|
"data-part": "footerDone",
|
|
6533
|
-
|
|
6769
|
+
class: normalizeClass(footerDoneClass.value),
|
|
6534
6770
|
onClick: onDone
|
|
6535
6771
|
}, {
|
|
6536
6772
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).done), 1)]),
|
|
6537
6773
|
_: 1
|
|
6538
|
-
}, 8, ["
|
|
6774
|
+
}, 8, ["class"])
|
|
6539
6775
|
], 10, _hoisted_10$2)]),
|
|
6540
6776
|
_: 2
|
|
6541
6777
|
}, [
|
|
@@ -6676,17 +6912,18 @@ var _hoisted_4$5 = [
|
|
|
6676
6912
|
];
|
|
6677
6913
|
var DEFAULT_MIN = 1;
|
|
6678
6914
|
var DEFAULT_MAX = 99;
|
|
6679
|
-
var ROOT_BASE = "relative inline-flex items-stretch w-fit max-w-full overflow-hidden
|
|
6915
|
+
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";
|
|
6916
|
+
var ROOT_LIVE = "eldra:bg-background eldra:border-border-strong";
|
|
6680
6917
|
/** 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%)]";
|
|
6918
|
+
var ROOT_DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:cursor-not-allowed";
|
|
6919
|
+
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";
|
|
6920
|
+
var BUTTON_HOVER = "eldra:text-text eldra:cursor-pointer eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]";
|
|
6684
6921
|
/** 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";
|
|
6922
|
+
var BUTTON_AT_LIMIT = "eldra:text-muted eldra:opacity-55 eldra:cursor-not-allowed";
|
|
6686
6923
|
/** 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";
|
|
6924
|
+
var BUTTON_DISABLED = "eldra:text-muted eldra:cursor-not-allowed";
|
|
6925
|
+
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";
|
|
6926
|
+
var INPUT_DISABLED = "eldra:text-muted eldra:cursor-not-allowed";
|
|
6690
6927
|
// src/components/quantity-stepper/QuantityStepper.vue
|
|
6691
6928
|
var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
6692
6929
|
inheritAttrs: false,
|
|
@@ -6938,7 +7175,7 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6938
7175
|
* own rounded corner clips whatever square background a button paints under it (see
|
|
6939
7176
|
* `select/panelParts.ts`'s own comment for the same technique on the select panel).
|
|
6940
7177
|
*/
|
|
6941
|
-
const rootClass = computed(() =>
|
|
7178
|
+
const rootClass = computed(() => [ROOT_BASE, props.disabled ? ROOT_DISABLED : ROOT_LIVE]);
|
|
6942
7179
|
/**
|
|
6943
7180
|
* Buttons (spec "Quantity stepper" → Sizes): 2.5×2.5rem square at `md`, 2×2rem at `sm` — both
|
|
6944
7181
|
* exact `control-h`/`control-h-sm` squares, the same `aspect-square` shape Button.vue's icon-only
|
|
@@ -6948,8 +7185,8 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6948
7185
|
* neighbour" → draw the ring just inside the edge).
|
|
6949
7186
|
*/
|
|
6950
7187
|
const BUTTON_SIZE = {
|
|
6951
|
-
md: "control-h aspect-square",
|
|
6952
|
-
sm: "control-h-sm aspect-square"
|
|
7188
|
+
md: "eldra:control-h eldra:aspect-square",
|
|
7189
|
+
sm: "eldra:control-h-sm eldra:aspect-square"
|
|
6953
7190
|
};
|
|
6954
7191
|
/**
|
|
6955
7192
|
* Spec States, "Button hover" row: "fill `text` at 6%" — the same mix Button.vue's `ghost`
|
|
@@ -6958,13 +7195,17 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6958
7195
|
* `BUTTON_DISABLED` below already carry `cursor-not-allowed` and replace this state outright.
|
|
6959
7196
|
*/
|
|
6960
7197
|
function buttonClass(atLimit) {
|
|
6961
|
-
return
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
7198
|
+
return [
|
|
7199
|
+
BUTTON_BASE,
|
|
7200
|
+
BUTTON_SIZE[props.size],
|
|
7201
|
+
props.disabled ? BUTTON_DISABLED : atLimit ? BUTTON_AT_LIMIT : BUTTON_HOVER
|
|
7202
|
+
];
|
|
7203
|
+
}
|
|
7204
|
+
const decreaseClass = computed(() => [buttonClass(atMin.value), props.classes?.decrease]);
|
|
7205
|
+
const increaseClass = computed(() => [buttonClass(atMax.value), props.classes?.increase]);
|
|
6965
7206
|
const ICON_SIZE = {
|
|
6966
|
-
md: "size-5",
|
|
6967
|
-
sm: "size-4"
|
|
7207
|
+
md: "eldra:size-5",
|
|
7208
|
+
sm: "eldra:size-4"
|
|
6968
7209
|
};
|
|
6969
7210
|
const iconClass = computed(() => ICON_SIZE[props.size]);
|
|
6970
7211
|
/**
|
|
@@ -6976,18 +7217,23 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
6976
7217
|
* per the same "Inset variant" note as the buttons.
|
|
6977
7218
|
*/
|
|
6978
7219
|
const INPUT_SIZE = {
|
|
6979
|
-
md: "w-11 text-stepper-value",
|
|
6980
|
-
sm: "w-9 text-stepper-value-sm"
|
|
7220
|
+
md: "eldra:w-11 eldra:text-stepper-value",
|
|
7221
|
+
sm: "eldra:w-9 eldra:text-stepper-value-sm"
|
|
6981
7222
|
};
|
|
6982
7223
|
/** Spec States, "Disabled (sold out)" row, Input column: "muted." */
|
|
6983
|
-
const inputClass = computed(() =>
|
|
7224
|
+
const inputClass = computed(() => [
|
|
7225
|
+
INPUT_BASE,
|
|
7226
|
+
INPUT_SIZE[props.size],
|
|
7227
|
+
props.disabled ? INPUT_DISABLED : "eldra:text-text",
|
|
7228
|
+
props.classes?.input
|
|
7229
|
+
]);
|
|
6984
7230
|
return (_ctx, _cache) => {
|
|
6985
7231
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
6986
7232
|
createElementVNode("div", {
|
|
6987
7233
|
"data-eldra-ui": "",
|
|
6988
7234
|
"data-eldra-scope": unref(eldra).scope,
|
|
6989
7235
|
"data-part": "root",
|
|
6990
|
-
class: normalizeClass(rootClass.value)
|
|
7236
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
6991
7237
|
}, [
|
|
6992
7238
|
createElementVNode("button", {
|
|
6993
7239
|
type: "button",
|
|
@@ -7008,7 +7254,10 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
7008
7254
|
"aria-hidden": "true",
|
|
7009
7255
|
focusable: "false"
|
|
7010
7256
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M5 12l14 0" }, null, -1)])], 2))], 10, _hoisted_2$6),
|
|
7011
|
-
createElementVNode("input", mergeProps(
|
|
7257
|
+
createElementVNode("input", mergeProps({
|
|
7258
|
+
..._ctx.$attrs,
|
|
7259
|
+
class: void 0
|
|
7260
|
+
}, {
|
|
7012
7261
|
"data-part": "input",
|
|
7013
7262
|
type: "text",
|
|
7014
7263
|
inputmode: "numeric",
|
|
@@ -7082,10 +7331,14 @@ var QuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
7082
7331
|
* row never renders `meta`, so it only ever fills the first two columns; see `Checkbox.vue` for
|
|
7083
7332
|
* the two-column version this is built from.
|
|
7084
7333
|
*/
|
|
7085
|
-
var PLAIN_OPTION = "group grid w-fit max-w-full
|
|
7334
|
+
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";
|
|
7335
|
+
/** The radio and its text column. */
|
|
7336
|
+
var PLAIN_COLUMNS = "eldra:grid-cols-[auto_1fr] eldra:gap-x-2.5";
|
|
7337
|
+
/** A radio with no label and no hint: the circle alone. */
|
|
7338
|
+
var PLAIN_BOX_ONLY = "eldra:grid-cols-[auto] eldra:gap-x-0";
|
|
7086
7339
|
/** The cursor a row (or card) shows: the whole option is the label, so it is the target. */
|
|
7087
7340
|
function optionCursor(disabled) {
|
|
7088
|
-
return disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
7341
|
+
return disabled ? "eldra:cursor-not-allowed" : "eldra:cursor-pointer";
|
|
7089
7342
|
}
|
|
7090
7343
|
/**
|
|
7091
7344
|
* The drawn radio (spec "Radio group" → Anatomy: "a native `<input type="radio">` with custom
|
|
@@ -7094,36 +7347,40 @@ function optionCursor(disabled) {
|
|
|
7094
7347
|
* (`:has(:focus-visible)`) draw the one focus ring around the shape a keyboard user can see, in
|
|
7095
7348
|
* every layout (spec's Focus-visible row: "standard focus ring around the radio", not the card).
|
|
7096
7349
|
*/
|
|
7097
|
-
var RADIO = "relative inline-flex shrink-0 items-center justify-center rounded-full eldra-focus eldra-focus-proxy";
|
|
7350
|
+
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
7351
|
/**
|
|
7099
7352
|
* Spec "Radio group" → Sizes: "1.125rem circle (1.5rem at lg) … nudged 0.1875rem down at md" —
|
|
7100
7353
|
* the exact same numbers as the Checkbox box, so the same two class strings apply.
|
|
7101
7354
|
*/
|
|
7102
7355
|
var RADIO_SIZE = {
|
|
7103
|
-
md: "size-4.5 mt-0.75",
|
|
7104
|
-
lg: "size-6"
|
|
7356
|
+
md: "eldra:size-4.5 eldra:mt-0.75",
|
|
7357
|
+
lg: "eldra:size-6"
|
|
7105
7358
|
};
|
|
7106
7359
|
/**
|
|
7107
7360
|
* States (spec "Radio group" → States). The checkbox's own `eldra-checkbox-border` /
|
|
7108
7361
|
* `-invalid` utilities are reused unchanged: the spec gives the radio circle the identical 1.5px /
|
|
7109
7362
|
* 2px numbers, so a second pair of utilities for the same numbers would only drift from them.
|
|
7110
7363
|
*/
|
|
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";
|
|
7364
|
+
var UNSELECTED = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text eldra:eldra-checkbox-border";
|
|
7365
|
+
var SELECTED = "eldra:bg-primary eldra:border-primary eldra:eldra-checkbox-border";
|
|
7366
|
+
var INVALID$2 = "eldra:bg-background eldra:border-danger eldra:group-hover:border-danger eldra:eldra-checkbox-border-invalid";
|
|
7114
7367
|
/** Keeps its `primary` fill under an error exactly as `Checkbox`'s invalid-checked box does: the
|
|
7115
7368
|
* 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";
|
|
7369
|
+
var INVALID_SELECTED = "eldra:bg-primary eldra:border-danger eldra:eldra-checkbox-border-invalid";
|
|
7370
|
+
var DISABLED$2 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:eldra-checkbox-border";
|
|
7371
|
+
var DISABLED_SELECTED = "eldra:bg-muted eldra:border-muted eldra:eldra-checkbox-border";
|
|
7119
7372
|
function radioState({ selected, disabled, invalid }) {
|
|
7120
7373
|
if (disabled) return selected ? DISABLED_SELECTED : DISABLED$2;
|
|
7121
7374
|
if (selected) return invalid ? INVALID_SELECTED : SELECTED;
|
|
7122
7375
|
return invalid ? INVALID$2 : UNSELECTED;
|
|
7123
7376
|
}
|
|
7124
|
-
/** The drawn circle, before `classes.radio` is
|
|
7377
|
+
/** The drawn circle, before `classes.radio` is appended. */
|
|
7125
7378
|
function radioRecipe(size, state) {
|
|
7126
|
-
return
|
|
7379
|
+
return [
|
|
7380
|
+
RADIO,
|
|
7381
|
+
RADIO_SIZE[size],
|
|
7382
|
+
radioState(state)
|
|
7383
|
+
];
|
|
7127
7384
|
}
|
|
7128
7385
|
/**
|
|
7129
7386
|
* The dot (spec "Radio group" → Sizes: "0.5rem dot"). One fixed size regardless of `size`, the
|
|
@@ -7131,20 +7388,24 @@ function radioRecipe(size, state) {
|
|
|
7131
7388
|
* its own: the API contract's part list has no entry for it, unlike `Checkbox`'s `check`.
|
|
7132
7389
|
*/
|
|
7133
7390
|
function dotRecipe(selected) {
|
|
7134
|
-
return
|
|
7391
|
+
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
7392
|
}
|
|
7136
7393
|
/** 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";
|
|
7394
|
+
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
7395
|
/**
|
|
7139
7396
|
* Spec "Radio group" → Sizes: "Plain row … 0.9375rem / 1.5rem text" for plain layouts, "Card title
|
|
7140
7397
|
* … 1rem 600 (line-height 1.4)" for cards — the same two type utilities `Checkbox`'s label and the
|
|
7141
7398
|
* `text-card-title` utility (see `tailwind.css`) already give those numbers.
|
|
7142
7399
|
*/
|
|
7143
7400
|
function labelRecipe(card, disabled) {
|
|
7144
|
-
return
|
|
7401
|
+
return [
|
|
7402
|
+
card ? "eldra:text-card-title" : "eldra:text-control",
|
|
7403
|
+
"eldra:min-w-0",
|
|
7404
|
+
disabled ? "eldra:text-muted" : "eldra:text-text"
|
|
7405
|
+
];
|
|
7145
7406
|
}
|
|
7146
7407
|
/** 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";
|
|
7408
|
+
var HINT = "eldra:text-body-sm eldra:text-muted eldra:col-start-2 eldra:min-w-0";
|
|
7148
7409
|
// src/components/radio/RadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
7149
7410
|
var _hoisted_1$5 = [
|
|
7150
7411
|
"data-eldra-scope",
|
|
@@ -7164,20 +7425,22 @@ var _hoisted_3$5 = ["data-eldra-slot"];
|
|
|
7164
7425
|
var _hoisted_4$4 = ["data-eldra-slot"];
|
|
7165
7426
|
var _hoisted_5$4 = ["data-eldra-slot"];
|
|
7166
7427
|
var _hoisted_6$3 = ["id"];
|
|
7167
|
-
var
|
|
7168
|
-
|
|
7169
|
-
var
|
|
7170
|
-
var
|
|
7428
|
+
var ROOT = "eldra:grid eldra:min-w-0 eldra:content-start eldra:gap-3 eldra:rounded-none eldra:border-0 eldra:p-0";
|
|
7429
|
+
/** `FieldWrapper`'s help type: 0.8125rem / 1.45, weight 400, `muted`. */
|
|
7430
|
+
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";
|
|
7431
|
+
var CARD_UNSELECTED = "eldra:bg-background eldra:border-border-strong eldra:hover:border-text";
|
|
7432
|
+
var CARD_SELECTED = "eldra:bg-surface eldra:border-primary eldra:eldra-radio-card-selected";
|
|
7433
|
+
var CARD_INVALID = "eldra:bg-background eldra:border-danger eldra:hover:border-danger";
|
|
7171
7434
|
/**
|
|
7172
7435
|
* Spec has no dedicated "selected and in error" card row; this follows the same reading `Checkbox`
|
|
7173
7436
|
* gives an invalid checked box (Decision: it keeps its fill and swaps only the border colour) —
|
|
7174
7437
|
* `eldra-radio-card-selected`'s inset line reads `--eldra-radio-card-selected-color` for exactly
|
|
7175
7438
|
* this, so one utility draws both the `primary` and the `danger` version of the same line.
|
|
7176
7439
|
*/
|
|
7177
|
-
var CARD_INVALID_SELECTED = "bg-surface border-danger eldra-radio-card-selected [--eldra-radio-card-selected-color:var(--eldra-color-danger)]";
|
|
7440
|
+
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
7441
|
/** Spec "Radio group" → States, Disabled selected row: "as disabled" — the card draws no special
|
|
7179
7442
|
* 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";
|
|
7443
|
+
var CARD_DISABLED = "eldra:bg-background eldra:border-border eldra:border-dashed";
|
|
7181
7444
|
// src/components/radio/RadioGroup.vue
|
|
7182
7445
|
var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
7183
7446
|
__name: "RadioGroup",
|
|
@@ -7268,10 +7531,8 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7268
7531
|
* a radio group looks the same as any other fieldset: "no border, padding or min-width, grid with
|
|
7269
7532
|
* a 0.75rem (`space-3`) gap, and the legend has a 0.5rem (`space-2`) bottom margin."
|
|
7270
7533
|
*/
|
|
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"));
|
|
7534
|
+
const helpClass = computed(() => ["eldra:text-field-note eldra:text-muted eldra:min-w-0 eldra:font-normal", props.classes?.help]);
|
|
7535
|
+
const legendClass = computed(() => ["eldra:text-label eldra:text-text eldra:mb-2 eldra:block eldra:w-fit eldra:p-0", props.classes?.legend]);
|
|
7275
7536
|
/**
|
|
7276
7537
|
* The legend, with `FieldWrapper`'s required mark after the text when `requiredMark` asks for it.
|
|
7277
7538
|
* A render function so a legend without the mark holds its text and nothing else — no `v-if`
|
|
@@ -7287,7 +7548,7 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7287
7548
|
* Cards are "stacked with a 0.5rem (`space-2`) gap" — the same numbers as vertical, so cards share
|
|
7288
7549
|
* its classes; only the option itself is drawn differently.
|
|
7289
7550
|
*/
|
|
7290
|
-
const optionsClass = computed(() =>
|
|
7551
|
+
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
7552
|
/**
|
|
7292
7553
|
* Spec "Radio group" → Sizes, Card row: "padding 0.75rem block / 1rem inline, 0.625rem gap, radius
|
|
7293
7554
|
* `radius-md`, 1px border, about 3.5rem tall with a hint line" — `min-h-14` is that 3.5rem, the
|
|
@@ -7301,23 +7562,27 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7301
7562
|
return inError.value ? CARD_INVALID : CARD_UNSELECTED;
|
|
7302
7563
|
}
|
|
7303
7564
|
function optionClass(option) {
|
|
7304
|
-
return
|
|
7565
|
+
return [
|
|
7566
|
+
props.layout === "cards" ? [CARD_OPTION, cardState(option)] : [PLAIN_OPTION, PLAIN_COLUMNS],
|
|
7567
|
+
optionCursor(option.disabled),
|
|
7568
|
+
props.classes?.option
|
|
7569
|
+
];
|
|
7305
7570
|
}
|
|
7306
7571
|
function radioClass(option) {
|
|
7307
|
-
return
|
|
7572
|
+
return [radioRecipe(radioSize.value, {
|
|
7308
7573
|
selected: isSelected(option.value),
|
|
7309
7574
|
disabled: option.disabled,
|
|
7310
7575
|
invalid: inError.value
|
|
7311
|
-
}), props.classes
|
|
7576
|
+
}), props.classes?.radio];
|
|
7312
7577
|
}
|
|
7313
7578
|
function dotClass(option) {
|
|
7314
|
-
return
|
|
7579
|
+
return [dotRecipe(isSelected(option.value)), props.classes?.dot];
|
|
7315
7580
|
}
|
|
7316
|
-
const inputClass = computed(() =>
|
|
7581
|
+
const inputClass = computed(() => [INPUT, props.classes?.input]);
|
|
7317
7582
|
function labelClass(option) {
|
|
7318
|
-
return
|
|
7583
|
+
return [labelRecipe(props.layout === "cards", option.disabled), props.classes?.label];
|
|
7319
7584
|
}
|
|
7320
|
-
const hintClass = computed(() =>
|
|
7585
|
+
const hintClass = computed(() => [HINT, props.classes?.hint]);
|
|
7321
7586
|
/**
|
|
7322
7587
|
* Spec "Radio group" → Sizes, Card title / hint / meta row: "1rem 600 tabular, no wrap, pushed to
|
|
7323
7588
|
* the end" — `tabular-nums` and `whitespace-nowrap` are stock Tailwind utilities, so meta reuses
|
|
@@ -7325,14 +7590,14 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7325
7590
|
* grid's third column is what pushes it to the end.
|
|
7326
7591
|
*/
|
|
7327
7592
|
function metaClass(option) {
|
|
7328
|
-
return
|
|
7593
|
+
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
7594
|
}
|
|
7330
7595
|
return (_ctx, _cache) => {
|
|
7331
7596
|
return openBlock(), createElementBlock("fieldset", {
|
|
7332
7597
|
"data-eldra-ui": "",
|
|
7333
7598
|
"data-eldra-scope": unref(eldra).scope,
|
|
7334
7599
|
"data-part": "root",
|
|
7335
|
-
class: normalizeClass(
|
|
7600
|
+
class: normalizeClass(ROOT),
|
|
7336
7601
|
"aria-describedby": describedBy.value,
|
|
7337
7602
|
"aria-invalid": inError.value ? "true" : void 0
|
|
7338
7603
|
}, [
|
|
@@ -7398,7 +7663,7 @@ var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
7398
7663
|
"data-part": "help",
|
|
7399
7664
|
class: normalizeClass(helpClass.value)
|
|
7400
7665
|
}, toDisplayString(__props.help), 11, _hoisted_6$3)) : createCommentVNode("", true)
|
|
7401
|
-
],
|
|
7666
|
+
], 8, _hoisted_1$5);
|
|
7402
7667
|
};
|
|
7403
7668
|
}
|
|
7404
7669
|
});
|
|
@@ -7411,8 +7676,8 @@ var _hoisted_1$4 = [
|
|
|
7411
7676
|
"data-view"
|
|
7412
7677
|
];
|
|
7413
7678
|
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))]" };
|
|
7679
|
+
var _hoisted_3$4 = { class: "eldra:text-search-title eldra:m-0 eldra:break-words" };
|
|
7680
|
+
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
7681
|
var _hoisted_5$3 = [
|
|
7417
7682
|
"id",
|
|
7418
7683
|
"aria-label",
|
|
@@ -7437,7 +7702,7 @@ var _hoisted_10$1 = [
|
|
|
7437
7702
|
var _hoisted_11$1 = ["src", "alt"];
|
|
7438
7703
|
var _hoisted_12$1 = {
|
|
7439
7704
|
key: 1,
|
|
7440
|
-
class: "size-4.5",
|
|
7705
|
+
class: "eldra:size-4.5",
|
|
7441
7706
|
viewBox: "0 0 24 24",
|
|
7442
7707
|
fill: "none",
|
|
7443
7708
|
stroke: "currentColor",
|
|
@@ -7447,7 +7712,7 @@ var _hoisted_12$1 = {
|
|
|
7447
7712
|
"aria-hidden": "true",
|
|
7448
7713
|
focusable: "false"
|
|
7449
7714
|
};
|
|
7450
|
-
var _hoisted_13 = { class: "eldra-select-match bg-transparent text-inherit" };
|
|
7715
|
+
var _hoisted_13 = { class: "eldra:eldra-select-match eldra:bg-transparent eldra:text-inherit" };
|
|
7451
7716
|
var _hoisted_14 = ["data-eldra-scope"];
|
|
7452
7717
|
var _hoisted_15 = ["data-eldra-scope"];
|
|
7453
7718
|
var _hoisted_16 = ["data-eldra-scope"];
|
|
@@ -7457,8 +7722,8 @@ var _hoisted_17 = [
|
|
|
7457
7722
|
"onMouseenter"
|
|
7458
7723
|
];
|
|
7459
7724
|
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))]";
|
|
7725
|
+
var _hoisted_19 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
7726
|
+
var LEADING_ICON = "eldra:size-4.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]";
|
|
7462
7727
|
// src/components/search-bar/SearchResultsPanel.vue
|
|
7463
7728
|
var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
7464
7729
|
__name: "SearchResultsPanel",
|
|
@@ -7517,12 +7782,24 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7517
7782
|
* class list for a `teleport: false` search bar; the inline `position` from `useFloating` (`fixed`
|
|
7518
7783
|
* once teleported) is on the element and wins over it either way.
|
|
7519
7784
|
*/
|
|
7520
|
-
const panelClass = computed(() =>
|
|
7521
|
-
|
|
7785
|
+
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)]"] : [
|
|
7786
|
+
"eldra:absolute eldra:z-popover eldra:flex eldra:flex-col eldra:overflow-y-auto eldra:overscroll-contain eldra:p-1.5",
|
|
7787
|
+
"eldra:eldra-search-panel-height",
|
|
7788
|
+
"eldra:rounded-lg eldra:border eldra:shadow-md",
|
|
7789
|
+
"eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))]",
|
|
7790
|
+
"eldra:bg-[color:var(--eldra-select-panel-background,var(--eldra-color-background))]",
|
|
7791
|
+
"eldra:text-[color:var(--eldra-select-panel-text)]",
|
|
7792
|
+
"eldra:animate-eldra-popover-in"
|
|
7793
|
+
], props.classes?.panel]);
|
|
7794
|
+
const listboxClass = computed(() => ["eldra:flex eldra:flex-col", props.classes?.listbox]);
|
|
7522
7795
|
/** "0.125rem block padding. Each group after the first has a 1px `border` hairline above." */
|
|
7523
|
-
const sectionClass = (index) =>
|
|
7796
|
+
const sectionClass = (index) => [
|
|
7797
|
+
"eldra:py-0.5",
|
|
7798
|
+
index > 0 && "eldra:border-[color:var(--eldra-select-panel-border,var(--eldra-color-border))] eldra:mt-1 eldra:border-t eldra:pt-1.5",
|
|
7799
|
+
props.classes?.section
|
|
7800
|
+
];
|
|
7524
7801
|
/** "0.75rem, 600, uppercase, 0.06em tracking, `muted`, min 1.75rem row, padding 0.25rem 0.5rem." */
|
|
7525
|
-
const headingClass = computed(() =>
|
|
7802
|
+
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
7803
|
/**
|
|
7527
7804
|
* An option row (spec → Sizes, Option): "min 2.5rem, padding 0.375rem 0.5rem, 0.75rem gap,
|
|
7528
7805
|
* `radius-md`", and → States, Active option: "`surface-strong` fill, and the arrow appears at the
|
|
@@ -7532,29 +7809,45 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7532
7809
|
* Rows carry no focus ring of their own: "focus stays in the input and the active row is the
|
|
7533
7810
|
* visual cue".
|
|
7534
7811
|
*/
|
|
7535
|
-
const rowClass = (row, part = "item") =>
|
|
7812
|
+
const rowClass = (row, part = "item") => [
|
|
7813
|
+
"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",
|
|
7814
|
+
"eldra:no-underline",
|
|
7815
|
+
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))]",
|
|
7816
|
+
isActive(row) && "eldra:bg-[color:var(--eldra-select-panel-active,var(--eldra-color-surface-strong))] eldra:eldra-select-option-active",
|
|
7817
|
+
props.classes?.[part]
|
|
7818
|
+
];
|
|
7536
7819
|
/** "See all" is 600 with the arrow always showing, 0.25rem below the last group. */
|
|
7537
|
-
const viewAllClass = computed(() => props.viewAll === void 0 ? "" :
|
|
7820
|
+
const viewAllClass = computed(() => props.viewAll === void 0 ? "" : [rowClass(props.viewAll, "viewAll"), "eldra:mt-1 eldra:font-semibold"]);
|
|
7538
7821
|
/** "Thumbnail / icon tile: 2.5rem square, `radius-sm`. Thumbnails sit on `surface-strong`." */
|
|
7539
|
-
const imageClass = (row) =>
|
|
7822
|
+
const imageClass = (row) => [
|
|
7823
|
+
"eldra:flex eldra:size-10 eldra:shrink-0 eldra:items-center eldra:justify-center eldra:overflow-hidden eldra:rounded-sm",
|
|
7824
|
+
row.item?.image === void 0 ? "eldra:bg-surface eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]" : "eldra:bg-surface-strong",
|
|
7825
|
+
props.classes?.itemImage
|
|
7826
|
+
];
|
|
7540
7827
|
/** "Title and sub truncate with an ellipsis on one line." */
|
|
7541
|
-
const titleClass = computed(() =>
|
|
7828
|
+
const titleClass = computed(() => ["eldra:min-w-0 eldra:flex-1 eldra:truncate", props.classes?.itemTitle]);
|
|
7542
7829
|
/** "Meta: 0.875rem 600 tabular." */
|
|
7543
|
-
const metaClass = computed(() =>
|
|
7830
|
+
const metaClass = computed(() => ["eldra:ms-3 eldra:shrink-0 eldra:text-search-meta eldra:tabular-nums", props.classes?.itemMeta]);
|
|
7544
7831
|
/** "1rem `arrow-right`, `text`, at the end of the row. Visible only on the active row." */
|
|
7545
|
-
const arrowClass = computed(() =>
|
|
7832
|
+
const arrowClass = computed(() => ["eldra:size-4 eldra:shrink-0", props.classes?.itemArrow]);
|
|
7546
7833
|
/** 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(() =>
|
|
7834
|
+
const recentClass = computed(() => props.classes?.recent);
|
|
7835
|
+
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
7836
|
/**
|
|
7550
7837
|
* "Chips: min 2rem, padding 0 0.75rem, 1px `border-strong`, `radius-full`, 0.875rem, 0.375rem gap
|
|
7551
7838
|
* between chips, optional 0.875rem `muted` icon", and → States, Active chip: "`surface-strong`
|
|
7552
7839
|
* fill, border `text`".
|
|
7553
7840
|
*/
|
|
7554
|
-
const chipClass = (row) =>
|
|
7841
|
+
const chipClass = (row) => [
|
|
7842
|
+
"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",
|
|
7843
|
+
"eldra:text-body-sm eldra:no-underline",
|
|
7844
|
+
"eldra:text-[color:var(--eldra-select-panel-text,var(--eldra-color-text))]",
|
|
7845
|
+
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",
|
|
7846
|
+
props.classes?.chip
|
|
7847
|
+
];
|
|
7555
7848
|
/** "No-results message: centred, padding 1.5rem 1rem 0.75rem. Title 1rem 600 … advice 0.875rem." */
|
|
7556
|
-
const emptyClass = computed(() =>
|
|
7557
|
-
const loadingClass = computed(() =>
|
|
7849
|
+
const emptyClass = computed(() => ["eldra:px-4 eldra:pt-6 eldra:pb-3 eldra:text-center", props.classes?.empty]);
|
|
7850
|
+
const loadingClass = computed(() => ["eldra:flex eldra:flex-col eldra:gap-1", props.classes?.loading]);
|
|
7558
7851
|
/** The three skeleton rows: "a 2.5rem square + two text lines". */
|
|
7559
7852
|
const SKELETON_ROWS = [
|
|
7560
7853
|
0,
|
|
@@ -7611,9 +7904,9 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7611
7904
|
}, [(openBlock(), createElementBlock(Fragment, null, renderList(SKELETON_ROWS, (row) => {
|
|
7612
7905
|
return createElementVNode("div", {
|
|
7613
7906
|
key: row,
|
|
7614
|
-
class: "flex min-h-10 items-center gap-3 px-2 py-1.5",
|
|
7907
|
+
class: "eldra:flex eldra:min-h-10 eldra:items-center eldra:gap-3 eldra:px-2 eldra:py-1.5",
|
|
7615
7908
|
"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)])]);
|
|
7909
|
+
}, [..._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
7910
|
}), 64))], 2)) : createCommentVNode("", true),
|
|
7618
7911
|
createElementVNode("div", {
|
|
7619
7912
|
id: __props.listboxId,
|
|
@@ -7652,7 +7945,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7652
7945
|
onClick: ($event) => emit("select", row, $event),
|
|
7653
7946
|
onMouseenter: ($event) => emit("activate", row.value)
|
|
7654
7947
|
}, [_cache[3] || (_cache[3] = createElementVNode("svg", {
|
|
7655
|
-
class: "size-3.5 shrink-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]",
|
|
7948
|
+
class: "eldra:size-3.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
7656
7949
|
viewBox: "0 0 24 24",
|
|
7657
7950
|
fill: "none",
|
|
7658
7951
|
stroke: "currentColor",
|
|
@@ -7691,7 +7984,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7691
7984
|
key: 0,
|
|
7692
7985
|
src: row.item.image,
|
|
7693
7986
|
alt: row.item.imageAlt ?? "",
|
|
7694
|
-
class: "size-full object-cover"
|
|
7987
|
+
class: "eldra:size-full eldra:object-cover"
|
|
7695
7988
|
}, null, 8, _hoisted_11$1)) : (openBlock(), createElementBlock("svg", _hoisted_12$1, [row.type === "products" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
7696
7989
|
_cache[4] || (_cache[4] = createElementVNode("path", { d: "M15 8h.01" }, null, -1)),
|
|
7697
7990
|
_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 +8052,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7759
8052
|
key: 0,
|
|
7760
8053
|
"data-part": "popular",
|
|
7761
8054
|
role: "presentation",
|
|
7762
|
-
class: normalizeClass([popularClass.value, "justify-center"])
|
|
8055
|
+
class: normalizeClass([popularClass.value, "eldra:justify-center"])
|
|
7763
8056
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.looseChips, (row) => {
|
|
7764
8057
|
return openBlock(), createElementBlock("a", {
|
|
7765
8058
|
key: row.value,
|
|
@@ -7772,7 +8065,7 @@ var SearchResultsPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
7772
8065
|
onClick: ($event) => emit("select", row, $event),
|
|
7773
8066
|
onMouseenter: ($event) => emit("activate", row.value)
|
|
7774
8067
|
}, [_cache[21] || (_cache[21] = createElementVNode("svg", {
|
|
7775
|
-
class: "size-3.5 shrink-0 text-[color:var(--eldra-select-panel-muted,var(--color-muted))]",
|
|
8068
|
+
class: "eldra:size-3.5 eldra:shrink-0 eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]",
|
|
7776
8069
|
viewBox: "0 0 24 24",
|
|
7777
8070
|
fill: "none",
|
|
7778
8071
|
stroke: "currentColor",
|
|
@@ -7854,6 +8147,7 @@ var RECENT_KEY = "eldra-ui:recent-searches";
|
|
|
7854
8147
|
var RECENT_MAX = 5;
|
|
7855
8148
|
var LOADING_DELAY_MS = 300;
|
|
7856
8149
|
var ANNOUNCE_DELAY_MS = 400;
|
|
8150
|
+
var rootClass$1 = "eldra:relative eldra:block eldra:w-full";
|
|
7857
8151
|
// src/components/search-bar/SearchBar.vue
|
|
7858
8152
|
var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
7859
8153
|
inheritAttrs: false,
|
|
@@ -8400,12 +8694,10 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8400
8694
|
if (typeof document === "undefined") return;
|
|
8401
8695
|
document.removeEventListener("keydown", onShortcut);
|
|
8402
8696
|
});
|
|
8403
|
-
const
|
|
8404
|
-
const rootClass = computed(() => part("relative block w-full", "root"));
|
|
8405
|
-
const formClass = computed(() => part("relative block w-full", "form"));
|
|
8697
|
+
const formClass = computed(() => ["eldra:relative eldra:block eldra:w-full", props.classes?.form]);
|
|
8406
8698
|
/**
|
|
8407
8699
|
* The field (spec "Search bar" → Sizes, and "Actions and forms" → Compact controls): the same box
|
|
8408
|
-
* as `Input`'s, **because it is one** — `
|
|
8700
|
+
* as `Input`'s, **because it is one** — `FIELD_BOX`, `FIELD_RADIUS`, `FIELD_TEXT` and `FIELD_LIVE` are imported
|
|
8409
8701
|
* from `../input/classes.ts` rather than copied here. The copy this replaces had drifted: it had
|
|
8410
8702
|
* lost the radius variable (it re-declared the radius in the ternary below instead) and kept its
|
|
8411
8703
|
* own spelling of the type-size rules, which is what the operator saw as a search field that
|
|
@@ -8422,28 +8714,50 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8422
8714
|
* the `max-md:` mobile override, which is a viewport rule so iOS never zooms into a focused field.
|
|
8423
8715
|
*/
|
|
8424
8716
|
const SIZE = {
|
|
8425
|
-
md: `control-h
|
|
8426
|
-
lg: `control-h-lg
|
|
8717
|
+
md: `eldra:control-h eldra:pe-11 ${FIELD_TEXT.md}`,
|
|
8718
|
+
lg: `eldra:control-h-lg eldra:pe-11 ${FIELD_TEXT.lg}`
|
|
8427
8719
|
};
|
|
8428
|
-
const
|
|
8720
|
+
const START_PAD = {
|
|
8721
|
+
md: "eldra:ps-9.5",
|
|
8722
|
+
lg: "eldra:ps-11"
|
|
8723
|
+
};
|
|
8724
|
+
const fieldClass = computed(() => [
|
|
8725
|
+
FIELD_BOX,
|
|
8726
|
+
props.pill ? "eldra:rounded-full eldra:ps-10" : `${FIELD_RADIUS} ${START_PAD[props.size]}`,
|
|
8727
|
+
FIELD_SEARCH_APPEARANCE,
|
|
8728
|
+
SIZE[props.size],
|
|
8729
|
+
FIELD_LIVE,
|
|
8730
|
+
props.classes?.field
|
|
8731
|
+
]);
|
|
8429
8732
|
/** "Search icon: `muted`, decorative", 1.125rem at 0.75rem (md) or 1.25rem at 0.875rem (lg). */
|
|
8430
8733
|
const ICON_SIZE = {
|
|
8431
|
-
md: "size-4.5",
|
|
8432
|
-
lg: "size-5"
|
|
8734
|
+
md: "eldra:size-4.5",
|
|
8735
|
+
lg: "eldra:size-5"
|
|
8433
8736
|
};
|
|
8434
|
-
const leadingIconClass = computed(() =>
|
|
8737
|
+
const leadingIconClass = computed(() => [
|
|
8738
|
+
"eldra:pointer-events-none eldra:absolute eldra:inset-y-0 eldra:my-auto eldra:flex eldra:items-center eldra:justify-center eldra:text-muted",
|
|
8739
|
+
props.size === "lg" || props.pill ? "eldra:start-3.5" : "eldra:start-3",
|
|
8740
|
+
ICON_SIZE[props.size],
|
|
8741
|
+
props.classes?.leadingIcon
|
|
8742
|
+
]);
|
|
8435
8743
|
/**
|
|
8436
8744
|
* "Clear: 2rem ghost icon button, 0.25rem from the end edge … round in the pill variant." The
|
|
8437
|
-
* button itself is `Input`'s (`
|
|
8745
|
+
* button itself is `Input`'s (`FIELD_CLEAR_BUTTON_BOX`); what is added is where it sits — absolutely,
|
|
8438
8746
|
* because this field has no `suffix` row — its 2rem size at both sizes, and the pill's own radius.
|
|
8439
8747
|
*/
|
|
8440
|
-
const clearButtonClass = computed(() =>
|
|
8748
|
+
const clearButtonClass = computed(() => [
|
|
8749
|
+
"eldra:inline-flex",
|
|
8750
|
+
FIELD_CLEAR_BUTTON_BOX,
|
|
8751
|
+
"eldra:absolute eldra:end-1 eldra:inset-y-0 eldra:my-auto eldra:size-8",
|
|
8752
|
+
props.pill ? "eldra:rounded-full" : "eldra:rounded-sm",
|
|
8753
|
+
props.classes?.clearButton
|
|
8754
|
+
]);
|
|
8441
8755
|
/**
|
|
8442
8756
|
* "Keyboard hint: `/` in a keyboard-key chip: monospace, 0.75rem, `surface` fill, 1px
|
|
8443
8757
|
* `border-strong`, `radius-sm`, `muted` text, 0.625rem from the end edge." `aria-hidden`, and out
|
|
8444
8758
|
* of the pointer's way: the shortcut it names is a keyboard affordance.
|
|
8445
8759
|
*/
|
|
8446
|
-
const shortcutHintClass = computed(() =>
|
|
8760
|
+
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
8761
|
/**
|
|
8448
8762
|
* The **visible** half of the `loading` view, beside the field rather than only inside the panel.
|
|
8449
8763
|
*
|
|
@@ -8454,8 +8768,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8454
8768
|
* the same 300ms delay as the panel's own loading view so a fast read never flashes it. Decorative:
|
|
8455
8769
|
* the state is announced by the live region and by `aria-busy` on the listbox, never by the shape.
|
|
8456
8770
|
*/
|
|
8457
|
-
const busyClass = computed(() =>
|
|
8458
|
-
const liveRegionClass = computed(() => part("", "liveRegion"));
|
|
8771
|
+
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
8772
|
const showClear = computed(() => model.value.length > 0);
|
|
8460
8773
|
const showHint = computed(() => props.shortcut && model.value.length === 0);
|
|
8461
8774
|
return (_ctx, _cache) => {
|
|
@@ -8463,7 +8776,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8463
8776
|
"data-eldra-ui": "",
|
|
8464
8777
|
"data-eldra-scope": unref(eldra).scope,
|
|
8465
8778
|
"data-part": "root",
|
|
8466
|
-
class: normalizeClass(rootClass.
|
|
8779
|
+
class: normalizeClass([rootClass$1, _ctx.$attrs.class])
|
|
8467
8780
|
}, [
|
|
8468
8781
|
createElementVNode("form", {
|
|
8469
8782
|
"data-part": "form",
|
|
@@ -8490,7 +8803,10 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8490
8803
|
createElementVNode("input", mergeProps({
|
|
8491
8804
|
ref_key: "fieldRef",
|
|
8492
8805
|
ref: fieldRef
|
|
8493
|
-
},
|
|
8806
|
+
}, {
|
|
8807
|
+
..._ctx.$attrs,
|
|
8808
|
+
class: void 0
|
|
8809
|
+
}, {
|
|
8494
8810
|
id: unref(controlId),
|
|
8495
8811
|
"data-part": "field",
|
|
8496
8812
|
name: "q",
|
|
@@ -8516,7 +8832,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8516
8832
|
key: 0,
|
|
8517
8833
|
"data-part": "busy",
|
|
8518
8834
|
class: normalizeClass(busyClass.value)
|
|
8519
|
-
}, [createVNode(Spinner_default, { class: "size-4.5" })], 2)) : createCommentVNode("", true),
|
|
8835
|
+
}, [createVNode(Spinner_default, { class: "eldra:size-4.5" })], 2)) : createCommentVNode("", true),
|
|
8520
8836
|
showClear.value ? (openBlock(), createElementBlock("button", {
|
|
8521
8837
|
key: 1,
|
|
8522
8838
|
"data-part": "clearButton",
|
|
@@ -8525,7 +8841,7 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8525
8841
|
"aria-label": unref(m).clear,
|
|
8526
8842
|
onClick: onClear
|
|
8527
8843
|
}, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
8528
|
-
class: "size-4.5",
|
|
8844
|
+
class: "eldra:size-4.5",
|
|
8529
8845
|
viewBox: "0 0 24 24",
|
|
8530
8846
|
fill: "none",
|
|
8531
8847
|
stroke: "currentColor",
|
|
@@ -8596,11 +8912,11 @@ var SearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
8596
8912
|
"data-part": "liveRegion",
|
|
8597
8913
|
role: "status",
|
|
8598
8914
|
"aria-live": "polite",
|
|
8599
|
-
|
|
8915
|
+
class: normalizeClass(__props.classes?.liveRegion)
|
|
8600
8916
|
}, {
|
|
8601
8917
|
default: withCtx(() => [createTextVNode(toDisplayString(announcement.value), 1)]),
|
|
8602
8918
|
_: 1
|
|
8603
|
-
}, 8, ["
|
|
8919
|
+
}, 8, ["class"])
|
|
8604
8920
|
], 10, _hoisted_1$3);
|
|
8605
8921
|
};
|
|
8606
8922
|
}
|
|
@@ -8623,7 +8939,7 @@ var _hoisted_2$2 = [
|
|
|
8623
8939
|
var _hoisted_3$2 = ["data-eldra-slot"];
|
|
8624
8940
|
var _hoisted_4$1 = ["data-placeholder"];
|
|
8625
8941
|
var _hoisted_5$1 = ["data-eldra-slot"];
|
|
8626
|
-
var _hoisted_6$1 = { class: "min-w-0 flex-1 truncate" };
|
|
8942
|
+
var _hoisted_6$1 = { class: "eldra:min-w-0 eldra:flex-1 eldra:truncate" };
|
|
8627
8943
|
var _hoisted_7 = [
|
|
8628
8944
|
"id",
|
|
8629
8945
|
"aria-label",
|
|
@@ -8638,12 +8954,13 @@ var _hoisted_9 = { value: "" };
|
|
|
8638
8954
|
var _hoisted_10 = ["label"];
|
|
8639
8955
|
var _hoisted_11 = ["value", "disabled"];
|
|
8640
8956
|
var _hoisted_12 = ["value", "disabled"];
|
|
8641
|
-
var TRIGGER_BASE = "flex w-full min-w-0 items-center gap-2 text-start eldra-field-border rounded-[var(--eldra-field-radius,var(--eldra-radius-md))] eldra-focus eldra-focus-open";
|
|
8642
|
-
var
|
|
8643
|
-
var
|
|
8644
|
-
var
|
|
8645
|
-
var
|
|
8646
|
-
var
|
|
8957
|
+
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";
|
|
8958
|
+
var LIVE_FILL$1 = "eldra:bg-background eldra:text-text eldra:cursor-pointer";
|
|
8959
|
+
var REST = "eldra:border-border-strong eldra:hover:border-text";
|
|
8960
|
+
var OPEN = "eldra:border-text eldra:hover:border-text";
|
|
8961
|
+
var INVALID$1 = "eldra:border-danger eldra:hover:border-danger";
|
|
8962
|
+
var DISABLED$1 = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
8963
|
+
var READONLY_FILL$1 = "eldra:bg-surface eldra:text-text eldra:cursor-default";
|
|
8647
8964
|
// src/components/select/Select.vue
|
|
8648
8965
|
var Select_default = /* @__PURE__ */ defineComponent({
|
|
8649
8966
|
inheritAttrs: false,
|
|
@@ -8947,7 +9264,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
8947
9264
|
* cannot be corrected here — while a read-only one keeps it.
|
|
8948
9265
|
*/
|
|
8949
9266
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
8950
|
-
const rootClass = computed(() =>
|
|
9267
|
+
const rootClass = computed(() => ["eldra:relative eldra:block eldra:w-full", showsInvalid.value && "eldra:eldra-field-invalid"]);
|
|
8951
9268
|
/**
|
|
8952
9269
|
* The trigger box (spec "Select" → Sizes): the same box as `Input`, "so selects and text fields
|
|
8953
9270
|
* line up in a row". `eldra-focus` without `-always`: a trigger is a button, and the focus-ring
|
|
@@ -8962,30 +9279,60 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
8962
9279
|
* sync and closing fades it back out over `eldra-focus`'s own transition.
|
|
8963
9280
|
*/
|
|
8964
9281
|
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"
|
|
9282
|
+
sm: "eldra:control-h-sm eldra:ps-2.25 eldra:pe-2.5 eldra:text-control-sm",
|
|
9283
|
+
md: "eldra:control-h eldra:ps-2.75 eldra:pe-2.5 eldra:text-control eldra:max-md:text-control-mobile",
|
|
9284
|
+
lg: "eldra:control-h-lg eldra:ps-2.75 eldra:pe-2.5 eldra:text-control-lg"
|
|
8968
9285
|
};
|
|
8969
9286
|
/**
|
|
8970
9287
|
* Spec "Select" → States. Open and hover share the `text` boundary; disabled/read-only replace it.
|
|
8971
9288
|
* `cursor-pointer` (operator report, 2026-09-25; recorded under Deviations in the README) replaces
|
|
8972
9289
|
* 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
|
-
|
|
9290
|
+
* no popover) and disabled keeps `cursor-not-allowed`. The fill and the boundary are picked apart,
|
|
9291
|
+
* so the trigger carries one of each: the error boundary over the open one over the rest one.
|
|
9292
|
+
*/
|
|
9293
|
+
function triggerState() {
|
|
9294
|
+
if (props.disabled) return DISABLED$1;
|
|
9295
|
+
if (props.readonly) return `${READONLY_FILL$1} ${showsInvalid.value ? INVALID$1 : "eldra:border-border"}`;
|
|
9296
|
+
return `${LIVE_FILL$1} ${showsInvalid.value ? INVALID$1 : isOpen.value ? OPEN : REST}`;
|
|
9297
|
+
}
|
|
9298
|
+
const triggerClass = computed(() => [
|
|
9299
|
+
TRIGGER_BASE,
|
|
9300
|
+
SIZE[props.size],
|
|
9301
|
+
triggerState(),
|
|
9302
|
+
props.classes?.trigger
|
|
9303
|
+
]);
|
|
9304
|
+
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
9305
|
/** The chosen option's mark and label. 1.75rem of extra end padding while the clear button shows. */
|
|
8978
|
-
const valueClass = computed(() =>
|
|
8979
|
-
|
|
9306
|
+
const valueClass = computed(() => [
|
|
9307
|
+
"eldra:flex eldra:min-w-0 eldra:flex-1 eldra:items-center eldra:gap-2",
|
|
9308
|
+
TRIGGER_VALUE_CELL,
|
|
9309
|
+
showClear.value && "eldra:pe-7",
|
|
9310
|
+
props.classes?.value
|
|
9311
|
+
]);
|
|
9312
|
+
const placeholderClass = computed(() => [
|
|
9313
|
+
"eldra:min-w-0 eldra:flex-1 eldra:truncate eldra:text-muted",
|
|
9314
|
+
showClear.value && "eldra:pe-7",
|
|
9315
|
+
props.classes?.placeholder
|
|
9316
|
+
]);
|
|
8980
9317
|
/** Spec "Select" → States, Open: "chevron turned 180°", over `duration-base`. */
|
|
8981
|
-
const chevronClass = computed(() =>
|
|
9318
|
+
const chevronClass = computed(() => [
|
|
9319
|
+
"eldra:size-4.5 eldra:shrink-0 eldra:text-muted eldra:transition-transform eldra:duration-base",
|
|
9320
|
+
isOpen.value && "eldra:rotate-180",
|
|
9321
|
+
props.classes?.chevron
|
|
9322
|
+
]);
|
|
8982
9323
|
/**
|
|
8983
9324
|
* Spec "Select" → Anatomy, item 4: the clear button "is a separate `<button>` beside the chevron.
|
|
8984
9325
|
* **It is not inside the trigger.**" Which is also the only way it can exist — a `<button>` may not
|
|
8985
9326
|
* contain a `<button>` — so it is a sibling positioned over the trigger, after it in the DOM and
|
|
8986
9327
|
* therefore after it in the tab order, exactly as `Input`'s clear button is.
|
|
8987
9328
|
*/
|
|
8988
|
-
const clearButtonClass = computed(() =>
|
|
9329
|
+
const clearButtonClass = computed(() => [
|
|
9330
|
+
"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",
|
|
9331
|
+
"eldra:rounded-sm eldra:text-muted eldra:hover:text-text",
|
|
9332
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text),transparent_94%)]",
|
|
9333
|
+
"eldra:eldra-focus",
|
|
9334
|
+
props.classes?.clearButton
|
|
9335
|
+
]);
|
|
8989
9336
|
/** The chosen option's mark in the trigger: the same two parts an option row draws it with. */
|
|
8990
9337
|
const triggerSwatchClass = computed(() => optionSwatchClass(props.classes));
|
|
8991
9338
|
const triggerIconClass = computed(() => optionIconClass(props.classes));
|
|
@@ -8996,12 +9343,15 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
8996
9343
|
"data-eldra-ui": "",
|
|
8997
9344
|
"data-eldra-scope": unref(eldra).scope,
|
|
8998
9345
|
"data-part": "root",
|
|
8999
|
-
class: normalizeClass(rootClass.value)
|
|
9346
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
9000
9347
|
}, [
|
|
9001
9348
|
createElementVNode("button", mergeProps({
|
|
9002
9349
|
ref_key: "triggerRef",
|
|
9003
9350
|
ref: triggerRef
|
|
9004
|
-
},
|
|
9351
|
+
}, {
|
|
9352
|
+
..._ctx.$attrs,
|
|
9353
|
+
class: void 0
|
|
9354
|
+
}, {
|
|
9005
9355
|
"data-part": "trigger",
|
|
9006
9356
|
type: "button",
|
|
9007
9357
|
role: "combobox",
|
|
@@ -9030,11 +9380,13 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9030
9380
|
}, [renderSlot(_ctx.$slots, "leading", {
|
|
9031
9381
|
option: selectedOption.value,
|
|
9032
9382
|
open: unref(isOpen)
|
|
9033
|
-
}, () => [__props.leadingIcon ? (openBlock(), createBlock(
|
|
9383
|
+
}, () => [__props.leadingIcon ? (openBlock(), createBlock(resolveDynamicComponent(__props.leadingIcon), {
|
|
9034
9384
|
key: 0,
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9385
|
+
class: "eldra:size-4.5 eldra:shrink-0",
|
|
9386
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
9387
|
+
"aria-hidden": "true",
|
|
9388
|
+
focusable: "false"
|
|
9389
|
+
}, null, 8, ["stroke-width"])) : createCommentVNode("", true)])], 10, _hoisted_3$2)) : createCommentVNode("", true),
|
|
9038
9390
|
selectedOption.value ? (openBlock(), createElementBlock("span", {
|
|
9039
9391
|
key: 1,
|
|
9040
9392
|
class: normalizeClass(unref(TRIGGER_VALUE_STACK)),
|
|
@@ -9049,12 +9401,19 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9049
9401
|
class: normalizeClass(triggerSwatchClass.value),
|
|
9050
9402
|
style: normalizeStyle({ backgroundColor: selectedOption.value.swatch }),
|
|
9051
9403
|
"aria-hidden": "true"
|
|
9052
|
-
}, null, 6)) : selectedOption.value.icon ? (openBlock(), createBlock(
|
|
9404
|
+
}, null, 6)) : selectedOption.value.icon ? (openBlock(), createBlock(resolveDynamicComponent(selectedOption.value.icon), {
|
|
9053
9405
|
key: 1,
|
|
9406
|
+
"data-eldra-scope": unref(eldra).scope,
|
|
9054
9407
|
"data-part": "optionIcon",
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9408
|
+
class: normalizeClass(triggerIconClass.value),
|
|
9409
|
+
"stroke-width": unref(ICON_STROKE_WIDTH),
|
|
9410
|
+
"aria-hidden": "true",
|
|
9411
|
+
focusable: "false"
|
|
9412
|
+
}, null, 8, [
|
|
9413
|
+
"data-eldra-scope",
|
|
9414
|
+
"class",
|
|
9415
|
+
"stroke-width"
|
|
9416
|
+
])) : createCommentVNode("", true), createElementVNode("span", _hoisted_6$1, toDisplayString(selectedOption.value.label), 1)])], 10, _hoisted_5$1)], 10, _hoisted_4$1)) : (openBlock(), createElementBlock("span", {
|
|
9058
9417
|
key: 2,
|
|
9059
9418
|
"data-part": "placeholder",
|
|
9060
9419
|
class: normalizeClass(placeholderClass.value)
|
|
@@ -9065,7 +9424,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9065
9424
|
class: normalizeClass(chevronClass.value),
|
|
9066
9425
|
"aria-hidden": "true"
|
|
9067
9426
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
9068
|
-
class: "size-4.5",
|
|
9427
|
+
class: "eldra:size-4.5",
|
|
9069
9428
|
viewBox: "0 0 24 24",
|
|
9070
9429
|
fill: "none",
|
|
9071
9430
|
stroke: "currentColor",
|
|
@@ -9085,7 +9444,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
9085
9444
|
"aria-labelledby": labelledBy.value ? `${clearId.value} ${labelledBy.value}` : void 0,
|
|
9086
9445
|
onClick: onClearClick
|
|
9087
9446
|
}, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
|
|
9088
|
-
class: "size-4",
|
|
9447
|
+
class: "eldra:size-4",
|
|
9089
9448
|
viewBox: "0 0 24 24",
|
|
9090
9449
|
fill: "none",
|
|
9091
9450
|
stroke: "currentColor",
|
|
@@ -9241,13 +9600,12 @@ var _hoisted_5 = ["data-eldra-scope", "aria-label"];
|
|
|
9241
9600
|
var _hoisted_6 = ["id"];
|
|
9242
9601
|
var MIN_ROWS = 3;
|
|
9243
9602
|
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
|
-
var ROW = "absolute top-1 flex h-8 items-center gap-1";
|
|
9603
|
+
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";
|
|
9604
|
+
var LIVE_FILL = "eldra:bg-background eldra:text-text";
|
|
9605
|
+
var READONLY_FILL = "eldra:bg-surface eldra:text-text";
|
|
9606
|
+
var INVALID = "eldra:border-danger eldra:hover:border-danger eldra:focus:border-danger";
|
|
9607
|
+
var DISABLED = "eldra:bg-surface-strong eldra:border-border eldra:border-dashed eldra:text-muted eldra:cursor-not-allowed";
|
|
9608
|
+
var ROW = "eldra:absolute eldra:top-1 eldra:flex eldra:h-8 eldra:items-center eldra:gap-1";
|
|
9251
9609
|
// src/components/textarea/Textarea.vue
|
|
9252
9610
|
var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
9253
9611
|
inheritAttrs: false,
|
|
@@ -9384,6 +9742,9 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9384
9742
|
immediate: true
|
|
9385
9743
|
});
|
|
9386
9744
|
/** Spec "Textarea" → Sizes and States, applied the same way Input.vue's BASE is. */
|
|
9745
|
+
const LIVE = `${LIVE_FILL} eldra:border-border-strong eldra:hover:border-text eldra:focus:border-text`;
|
|
9746
|
+
const READONLY = `${READONLY_FILL} eldra:border-border`;
|
|
9747
|
+
/** See Input.vue: the danger boundary drops on a disabled field and stays on a read-only one. */
|
|
9387
9748
|
const showsInvalid = computed(() => isInvalid.value && !props.disabled);
|
|
9388
9749
|
/**
|
|
9389
9750
|
* `eldra-field-invalid` draws its inset line at the *field's* radius, which it reads from
|
|
@@ -9391,7 +9752,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9391
9752
|
* `radius-md`). A Textarea rounds by `--eldra-textarea-radius`, so it points the line's radius at
|
|
9392
9753
|
* that one here rather than letting the line and the border round differently.
|
|
9393
9754
|
*/
|
|
9394
|
-
const rootClass = computed(() =>
|
|
9755
|
+
const rootClass = computed(() => ["eldra:relative eldra:block eldra:w-full eldra:[--eldra-field-radius:var(--eldra-textarea-radius,var(--eldra-radius-md))]", showsInvalid.value && "eldra:eldra-field-invalid"]);
|
|
9395
9756
|
/**
|
|
9396
9757
|
* `Input`'s prefix and suffix rows, pinned to the first line rather than centred: 0.25rem from the
|
|
9397
9758
|
* top puts a 2rem action's middle on the first line's middle (0.5rem padding plus half a 1.5rem
|
|
@@ -9401,14 +9762,32 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9401
9762
|
/** Shown while there is a value, and never on a field that cannot be edited — as `Input`'s is. */
|
|
9402
9763
|
const showClear = computed(() => props.clearable && !props.disabled && !props.readonly && model.value.length > 0);
|
|
9403
9764
|
const hasSuffix = computed(() => showClear.value || slots.suffix !== void 0);
|
|
9404
|
-
const prefixClass = computed(() =>
|
|
9405
|
-
|
|
9406
|
-
|
|
9765
|
+
const prefixClass = computed(() => [
|
|
9766
|
+
ROW,
|
|
9767
|
+
"eldra:start-1",
|
|
9768
|
+
props.classes?.prefix
|
|
9769
|
+
]);
|
|
9770
|
+
const suffixClass = computed(() => [
|
|
9771
|
+
ROW,
|
|
9772
|
+
"eldra:end-1",
|
|
9773
|
+
props.classes?.suffix
|
|
9774
|
+
]);
|
|
9775
|
+
const clearButtonClass = computed(() => [
|
|
9776
|
+
FIELD_CLEAR_BUTTON,
|
|
9777
|
+
FIELD_CLEAR_SIZE.md,
|
|
9778
|
+
props.classes?.clearButton
|
|
9779
|
+
]);
|
|
9407
9780
|
const prefixRef = ref(null);
|
|
9408
9781
|
const suffixRef = ref(null);
|
|
9409
9782
|
const prefixRoom = useAdornmentRoom(prefixRef, () => FIELD_ACTION_ROOM_REM.md);
|
|
9410
9783
|
const suffixRoom = useAdornmentRoom(suffixRef, () => FIELD_ACTION_ROOM_REM.md);
|
|
9411
|
-
const controlClass = computed(() =>
|
|
9784
|
+
const controlClass = computed(() => [
|
|
9785
|
+
BASE,
|
|
9786
|
+
hasPrefix.value && "eldra:ps-10",
|
|
9787
|
+
hasSuffix.value && "eldra:pe-10",
|
|
9788
|
+
props.disabled ? DISABLED : props.readonly ? showsInvalid.value ? `${READONLY_FILL} ${INVALID}` : READONLY : showsInvalid.value ? `${LIVE_FILL} ${INVALID}` : LIVE,
|
|
9789
|
+
props.classes?.control
|
|
9790
|
+
]);
|
|
9412
9791
|
/** Spec "Textarea" → Properties, `counter`: shows only once there is something to count against. */
|
|
9413
9792
|
const showCounter = computed(() => props.counter && props.maxLength !== void 0);
|
|
9414
9793
|
/**
|
|
@@ -9420,8 +9799,12 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9420
9799
|
const length = computed(() => model.value.length);
|
|
9421
9800
|
/** Spec "Textarea" → States, Error row: "counter `danger` weight 600" once past the limit. */
|
|
9422
9801
|
const isOverLimit = computed(() => props.maxLength !== void 0 && length.value > props.maxLength);
|
|
9423
|
-
const footClass = computed(() =>
|
|
9424
|
-
const counterClass = computed(() =>
|
|
9802
|
+
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]);
|
|
9803
|
+
const counterClass = computed(() => [
|
|
9804
|
+
"eldra:text-counter eldra:ms-auto eldra:shrink-0 eldra:tabular-nums eldra:whitespace-nowrap",
|
|
9805
|
+
isOverLimit.value ? "eldra:text-danger eldra:font-semibold" : "eldra:text-muted eldra:font-normal",
|
|
9806
|
+
props.classes?.counter
|
|
9807
|
+
]);
|
|
9425
9808
|
/**
|
|
9426
9809
|
* Spec "Textarea" → Behaviour & motion: "one polite, visually hidden live region announces once
|
|
9427
9810
|
* when the count reaches 80% of the limit ('20 characters left') and once when the limit is passed
|
|
@@ -9489,7 +9872,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9489
9872
|
"data-eldra-ui": "",
|
|
9490
9873
|
"data-eldra-scope": unref(eldra).scope,
|
|
9491
9874
|
"data-part": "root",
|
|
9492
|
-
class: normalizeClass(rootClass.value)
|
|
9875
|
+
class: normalizeClass([rootClass.value, _ctx.$attrs.class])
|
|
9493
9876
|
}, [
|
|
9494
9877
|
hasPrefix.value ? (openBlock(), createElementBlock("span", {
|
|
9495
9878
|
key: 0,
|
|
@@ -9502,7 +9885,10 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9502
9885
|
createElementVNode("textarea", mergeProps({
|
|
9503
9886
|
ref_key: "controlRef",
|
|
9504
9887
|
ref: controlRef
|
|
9505
|
-
},
|
|
9888
|
+
}, {
|
|
9889
|
+
..._ctx.$attrs,
|
|
9890
|
+
class: void 0
|
|
9891
|
+
}, {
|
|
9506
9892
|
"data-part": "control",
|
|
9507
9893
|
class: controlClass.value,
|
|
9508
9894
|
style: controlStyle.value,
|
|
@@ -9536,7 +9922,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
9536
9922
|
"aria-label": unref(m).clear,
|
|
9537
9923
|
onClick: onClear
|
|
9538
9924
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
9539
|
-
class: "size-4.5",
|
|
9925
|
+
class: "eldra:size-4.5",
|
|
9540
9926
|
viewBox: "0 0 24 24",
|
|
9541
9927
|
fill: "none",
|
|
9542
9928
|
stroke: "currentColor",
|
|
@@ -9576,30 +9962,38 @@ var _hoisted_2 = [
|
|
|
9576
9962
|
];
|
|
9577
9963
|
var _hoisted_3 = {
|
|
9578
9964
|
key: 0,
|
|
9579
|
-
class: "sr-only"
|
|
9965
|
+
class: "eldra:sr-only"
|
|
9580
9966
|
};
|
|
9581
|
-
var
|
|
9967
|
+
var rootClass = "eldra:block eldra:min-w-0 eldra:rounded-none eldra:border-0 eldra:p-0";
|
|
9968
|
+
/**
|
|
9969
|
+
* Spec "Variant picker" → Anatomy, point 2: "the option name (weight 600) + the current value
|
|
9970
|
+
* (weight 400, `muted`), with a 0.5rem gap, baseline-aligned." `text-variant-legend` carries only
|
|
9971
|
+
* the size and line — see its own comment in `tailwind.css` for why the two weights cannot live in
|
|
9972
|
+
* one shorthand `font` declaration — so `font-semibold`/`text-text` here and `font-normal`/
|
|
9973
|
+
* `text-muted` on `legendValue` below are what split it into the spec's two runs.
|
|
9974
|
+
*/
|
|
9975
|
+
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
9976
|
/** Spec "Variant picker" → States, table rows "Default"/"Hover": `background` fill, 1px
|
|
9583
9977
|
* `border-strong` at rest, 1px `text` on hover. */
|
|
9584
|
-
var PILL_DEFAULT = "bg-background border-border-strong group-hover:border-text";
|
|
9978
|
+
var PILL_DEFAULT = "eldra:bg-background eldra:border-border-strong eldra:group-hover:border-text";
|
|
9585
9979
|
/** States, "Selected" row: `primary` fill and border. The fill alone already carries the state, so
|
|
9586
9980
|
* the 1px border underneath the (invisible-against-the-fill) real border needs no colour of its
|
|
9587
9981
|
* own beyond matching the fill. */
|
|
9588
|
-
var PILL_SELECTED = "bg-primary border-primary";
|
|
9982
|
+
var PILL_SELECTED = "eldra:bg-primary eldra:border-primary";
|
|
9589
9983
|
/** States, "Sold out" row: `background` fill, 1px **dashed** `border-strong` — the diagonal line
|
|
9590
9984
|
* 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";
|
|
9985
|
+
var PILL_SOLD_OUT = "eldra:bg-background eldra:border-dashed eldra:border-border-strong eldra:group-hover:border-text";
|
|
9592
9986
|
/** States, "Sold out + selected" row: `surface-strong` fill, **2px** solid `text`. The real border
|
|
9593
9987
|
* and the `eldra-variant-pill-selected-line` inset line share the same `text` colour so the two
|
|
9594
9988
|
* 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";
|
|
9989
|
+
var PILL_SOLD_OUT_SELECTED = "eldra:bg-surface-strong eldra:border-text eldra:eldra-variant-pill-selected-line";
|
|
9990
|
+
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
9991
|
/** States, "Swatch" column, "Default"/"Hover" rows: transparent at rest, `border-strong` ring on
|
|
9598
9992
|
* hover. */
|
|
9599
|
-
var SWATCH_RING_DEFAULT = "border-transparent group-hover:border-border-strong";
|
|
9993
|
+
var SWATCH_RING_DEFAULT = "eldra:border-transparent eldra:group-hover:border-border-strong";
|
|
9600
9994
|
/** States, "Selected" and "Sold out + selected" rows: "2px ring `text`" either way — the sold-out
|
|
9601
9995
|
* line is a separate part drawn on top, so the ring itself only ever depends on selection. */
|
|
9602
|
-
var SWATCH_RING_SELECTED = "border-text";
|
|
9996
|
+
var SWATCH_RING_SELECTED = "eldra:border-text";
|
|
9603
9997
|
// src/components/variant-picker/VariantPicker.vue
|
|
9604
9998
|
var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
9605
9999
|
__name: "VariantPicker",
|
|
@@ -9678,24 +10072,16 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9678
10072
|
* Spec "Variant picker" → Anatomy: "no border or padding." `min-w-0` keeps a long label or a
|
|
9679
10073
|
* narrow container (the `Narrow` story) from forcing the fieldset wider than its own column.
|
|
9680
10074
|
*/
|
|
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"));
|
|
10075
|
+
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]);
|
|
10076
|
+
const legendValueClass = computed(() => ["eldra:text-variant-legend eldra:font-normal eldra:text-muted", props.classes?.legendValue]);
|
|
9691
10077
|
/** Spec "Variant picker" → Anatomy, point 3: "wraps, 0.5rem (`space-2`) gap." */
|
|
9692
|
-
const optionsClass = computed(() =>
|
|
10078
|
+
const optionsClass = computed(() => ["eldra:flex eldra:flex-wrap eldra:gap-2", props.classes?.options]);
|
|
9693
10079
|
/**
|
|
9694
10080
|
* Spec "Variant picker" → Anatomy, point 4: "a `<label>` holding a native radio … and the visible
|
|
9695
10081
|
* pill or swatch." `group` is what lets `radio`'s own hover state read `group-hover:*` below,
|
|
9696
10082
|
* exactly as `RadioGroup`'s row does.
|
|
9697
10083
|
*/
|
|
9698
|
-
const optionClass = computed(() =>
|
|
10084
|
+
const optionClass = computed(() => ["eldra:group eldra:inline-flex eldra:cursor-pointer", props.classes?.option]);
|
|
9699
10085
|
/**
|
|
9700
10086
|
* The drawn pill (spec "Variant picker" → Sizes, Pill row: "min 2.5rem (`control-height`), min
|
|
9701
10087
|
* width 3rem | 0 1rem (`space-4`) | … | `radius-md`"). The native radio is `opacity-0` and
|
|
@@ -9712,8 +10098,8 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9712
10098
|
* selected, `text` sold-out-and-selected. Same shorthand-free reasoning as the legend above. */
|
|
9713
10099
|
function pillLabelState(option) {
|
|
9714
10100
|
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";
|
|
10101
|
+
if (!option.available) return selected ? "eldra:font-semibold eldra:text-text" : "eldra:font-medium eldra:text-muted";
|
|
10102
|
+
return selected ? "eldra:font-semibold eldra:text-primary-contrast" : "eldra:font-medium eldra:text-text";
|
|
9717
10103
|
}
|
|
9718
10104
|
/**
|
|
9719
10105
|
* The swatch's own ring (spec "Variant picker" → Sizes, Swatch row: "2.75 × 2.75rem outer; a 2px
|
|
@@ -9725,7 +10111,7 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9725
10111
|
* native radio and the proxy focus ring live on this same shape, same as the pill above.
|
|
9726
10112
|
*/
|
|
9727
10113
|
function radioClass(option) {
|
|
9728
|
-
return
|
|
10114
|
+
return [props.type === "swatches" ? [SWATCH_BASE, isSelected(option.value) ? SWATCH_RING_SELECTED : SWATCH_RING_DEFAULT] : [PILL_BASE, pillState(option)], props.classes?.radio];
|
|
9729
10115
|
}
|
|
9730
10116
|
/**
|
|
9731
10117
|
* The colour disc (spec "Variant picker" → Sizes, Swatch row: "the colour disc with a 1px inner
|
|
@@ -9735,20 +10121,24 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9735
10121
|
* own comment in `tailwind.css`. The one per-item colour the spec allows (`swatch`, from product
|
|
9736
10122
|
* data) is set as an inline style by the caller of this function, never a class.
|
|
9737
10123
|
*/
|
|
9738
|
-
const swatchClass = computed(() =>
|
|
10124
|
+
const swatchClass = computed(() => ["eldra:block eldra:size-full eldra:rounded-full eldra:border-border-strong eldra:eldra-variant-swatch-edge", props.classes?.swatch]);
|
|
9739
10125
|
/**
|
|
9740
10126
|
* Spec "Variant picker" → Sizes, Pill row: "0.9375rem, 500 (600 selected)." `text-variant-pill`
|
|
9741
10127
|
* carries only the size and line, for the same shorthand-free reason `text-variant-legend` does.
|
|
9742
10128
|
*/
|
|
9743
10129
|
function pillLabelClass(option) {
|
|
9744
|
-
return
|
|
10130
|
+
return [
|
|
10131
|
+
"eldra:text-variant-pill",
|
|
10132
|
+
pillLabelState(option),
|
|
10133
|
+
props.classes?.label
|
|
10134
|
+
];
|
|
9745
10135
|
}
|
|
9746
10136
|
/**
|
|
9747
10137
|
* Spec "Variant picker" → Variants, Swatches row: "The colour name lives in visually hidden text
|
|
9748
10138
|
* inside the label"; → Accessibility: "the colour name is visually hidden text inside the label, so
|
|
9749
10139
|
* it isn't conveyed by colour alone (1.4.1)."
|
|
9750
10140
|
*/
|
|
9751
|
-
const swatchLabelClass = computed(() =>
|
|
10141
|
+
const swatchLabelClass = computed(() => ["eldra:sr-only", props.classes?.label]);
|
|
9752
10142
|
function labelClass(option) {
|
|
9753
10143
|
return props.type === "swatches" ? swatchLabelClass.value : pillLabelClass(option);
|
|
9754
10144
|
}
|
|
@@ -9766,20 +10156,20 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9766
10156
|
* 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
10157
|
* percentages `viewBox="0 0 100 100"` reads directly.
|
|
9768
10158
|
*/
|
|
9769
|
-
const soldOutSwatchLineClass = computed(() =>
|
|
10159
|
+
const soldOutSwatchLineClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:inset-0 eldra:size-full eldra:text-text", props.classes?.soldOutLine]);
|
|
9770
10160
|
/**
|
|
9771
10161
|
* The pill's sold-out diagonal line (spec "Variant picker" → States, Sold out row: "a 1px
|
|
9772
10162
|
* diagonal `border-strong` line (bottom-left to top-right)"), on the `<svg>` in the template
|
|
9773
10163
|
* below — see its own comment in `tailwind.css` for why a pill's line is an SVG rather than a
|
|
9774
10164
|
* class-only utility. `text-border-strong` sets the `currentColor` the `<line>` strokes with.
|
|
9775
10165
|
*/
|
|
9776
|
-
const soldOutPillLineClass = computed(() =>
|
|
10166
|
+
const soldOutPillLineClass = computed(() => ["eldra:pointer-events-none eldra:absolute eldra:inset-0 eldra:size-full eldra:text-border-strong", props.classes?.soldOutLine]);
|
|
9777
10167
|
return (_ctx, _cache) => {
|
|
9778
10168
|
return openBlock(), createElementBlock("fieldset", {
|
|
9779
10169
|
"data-eldra-ui": "",
|
|
9780
10170
|
"data-eldra-scope": unref(eldra).scope,
|
|
9781
10171
|
"data-part": "root",
|
|
9782
|
-
class: normalizeClass(rootClass
|
|
10172
|
+
class: normalizeClass(rootClass)
|
|
9783
10173
|
}, [createElementVNode("legend", {
|
|
9784
10174
|
"data-part": "legend",
|
|
9785
10175
|
class: normalizeClass(legendClass.value)
|
|
@@ -9801,7 +10191,7 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9801
10191
|
createElementVNode("input", {
|
|
9802
10192
|
ref_for: true,
|
|
9803
10193
|
ref: (el) => radioRefs.value[index] = el,
|
|
9804
|
-
class: "absolute inset-0 m-0 size-full cursor-pointer appearance-none opacity-0",
|
|
10194
|
+
class: "eldra:absolute eldra:inset-0 eldra:m-0 eldra:size-full eldra:cursor-pointer eldra:appearance-none eldra:opacity-0",
|
|
9805
10195
|
type: "radio",
|
|
9806
10196
|
name: __props.name,
|
|
9807
10197
|
value: option.value,
|
|
@@ -9863,8 +10253,8 @@ var VariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
9863
10253
|
class: normalizeClass(labelClass(option))
|
|
9864
10254
|
}, [createTextVNode(toDisplayString(option.label), 1), !option.available ? (openBlock(), createElementBlock("span", _hoisted_3, ", " + toDisplayString(soldOutSuffix.value), 1)) : createCommentVNode("", true)], 2)
|
|
9865
10255
|
], 2)], 2);
|
|
9866
|
-
}), 128))], 2)],
|
|
10256
|
+
}), 128))], 2)], 8, _hoisted_1);
|
|
9867
10257
|
};
|
|
9868
10258
|
}
|
|
9869
10259
|
});
|
|
9870
|
-
export {
|
|
10260
|
+
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 };
|