@kuina-ui/vue 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/components/alert/Alert.vue.d.ts +2 -0
  2. package/dist/components/date-picker/DateCalendar.vue.d.ts +40 -0
  3. package/dist/components/date-picker/DateCalendarMonth.vue.d.ts +27 -0
  4. package/dist/components/date-picker/DatePicker.vue.d.ts +44 -0
  5. package/dist/components/date-picker/DatePickerPanel.vue.d.ts +33 -0
  6. package/dist/components/date-picker/DateRangePicker.vue.d.ts +54 -0
  7. package/dist/components/date-picker/date-calendar.theme.d.ts +69 -0
  8. package/dist/components/date-picker/date-picker.theme.d.ts +19 -0
  9. package/dist/components/date-picker/datePickerProps.d.ts +39 -0
  10. package/dist/components/date-picker/index.d.ts +4 -0
  11. package/dist/components/date-picker/useDatePickerPopover.d.ts +21 -0
  12. package/dist/components/menu/Menu.vue.d.ts +2 -2
  13. package/dist/components/select/Select.vue.d.ts +81 -0
  14. package/dist/components/select/SelectField.vue.d.ts +70 -0
  15. package/dist/components/select/SelectOptionRow.vue.d.ts +33 -0
  16. package/dist/components/select/SelectPanel.vue.d.ts +67 -0
  17. package/dist/components/select/index.d.ts +6 -0
  18. package/dist/components/select/select-field.theme.d.ts +250 -0
  19. package/dist/components/select/select-panel.theme.d.ts +55 -0
  20. package/dist/components/select/selectOptions.d.ts +43 -0
  21. package/dist/components/select/useSelectControl.d.ts +77 -0
  22. package/dist/components/select/useSelectListbox.d.ts +48 -0
  23. package/dist/components/text-field/TextField.vue.d.ts +3 -0
  24. package/dist/components/text-field/text-field.theme.d.ts +6 -1
  25. package/dist/components/textarea/Textarea.vue.d.ts +3 -0
  26. package/dist/components/textarea/textarea.theme.d.ts +6 -1
  27. package/dist/elements/select-control/SelectControl.vue.d.ts +56 -0
  28. package/dist/elements/select-control/index.d.ts +3 -0
  29. package/dist/elements/select-control/select-control.theme.d.ts +87 -0
  30. package/dist/elements/text-link/TextLink.vue.d.ts +1 -1
  31. package/dist/index.d.ts +5 -0
  32. package/dist/index.js +1 -1
  33. package/dist/nuxt.js +1 -1
  34. package/dist/shared/composables/useCalendarLabels.d.ts +19 -0
  35. package/dist/shared/types/calendar.d.ts +14 -0
  36. package/dist/shared/utils/calendarMonth.d.ts +5 -0
  37. package/dist/shared/utils/createDateFormatters.d.ts +9 -0
  38. package/dist/shared/utils/floatingPanelTransition.d.ts +9 -0
  39. package/dist/shared/utils/isoDate.d.ts +18 -0
  40. package/dist/src-Cl5gtlze.js +6369 -0
  41. package/package.json +1 -1
  42. package/dist/src-Cn6KXW0m.js +0 -3486
@@ -1,3486 +0,0 @@
1
- import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, guardReactiveProps as u, inject as d, mergeModels as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, provide as x, readonly as S, renderList as C, renderSlot as w, resolveComponent as T, resolveDynamicComponent as E, shallowRef as D, toDisplayString as O, toValue as k, unref as A, useId as j, useModel as M, useSlots as N, useTemplateRef as P, vModelCheckbox as F, vModelDynamic as I, vModelRadio as L, vModelText as R, watch as z, withCtx as B, withDirectives as V, withModifiers as ee } from "vue";
2
- import { Check as te, ChevronRight as ne, CircleAlert as H, CircleCheck as re, Info as U, TriangleAlert as W, X as ie } from "lucide-vue-next";
3
- import { tv as G } from "tailwind-variants";
4
- // \0rolldown/runtime.js
5
- var K = Object.defineProperty, ae = (e, t) => {
6
- let n = {};
7
- for (var r in e) K(n, r, {
8
- get: e[r],
9
- enumerable: !0
10
- });
11
- return t || K(n, Symbol.toStringTag, { value: "Module" }), n;
12
- }, q = {
13
- "3xs": {
14
- height: "h-5.5",
15
- width: "w-5.5",
16
- gutter: "px-1.5",
17
- pillGutter: "px-2",
18
- radius: "rounded-md",
19
- fontSize: "text-xs/none",
20
- contentGap: "gap-0.75",
21
- iconSize: "size-3.5",
22
- leadingIconOffset: "-ml-px",
23
- trailingIconOffset: "-mr-px",
24
- loadingIndicatorSize: "text-[11px]"
25
- },
26
- "2xs": {
27
- height: "h-6",
28
- width: "w-6",
29
- gutter: "px-2",
30
- pillGutter: "px-2.75",
31
- radius: "rounded-md",
32
- fontSize: "text-xs/none",
33
- contentGap: "gap-1",
34
- iconSize: "size-4",
35
- leadingIconOffset: "-ml-px",
36
- trailingIconOffset: "-mr-px",
37
- loadingIndicatorSize: "text-xs"
38
- },
39
- xs: {
40
- height: "h-6.5",
41
- width: "w-6.5",
42
- gutter: "px-2",
43
- pillGutter: "px-2.75",
44
- radius: "rounded-md",
45
- fontSize: "text-sm/none",
46
- contentGap: "gap-1",
47
- iconSize: "size-4",
48
- leadingIconOffset: "-ml-px",
49
- trailingIconOffset: "-mr-px",
50
- loadingIndicatorSize: "text-[13px]"
51
- },
52
- sm: {
53
- height: "h-7",
54
- width: "w-7",
55
- gutter: "px-2.5",
56
- pillGutter: "px-3.25",
57
- radius: "rounded-md",
58
- fontSize: "text-sm/none",
59
- contentGap: "gap-1",
60
- iconSize: "size-4.5",
61
- leadingIconOffset: "-ml-px",
62
- trailingIconOffset: "-mr-px",
63
- loadingIndicatorSize: "text-[15px]"
64
- },
65
- md: {
66
- height: "h-8",
67
- width: "w-8",
68
- gutter: "px-3",
69
- pillGutter: "px-4",
70
- radius: "rounded-lg",
71
- fontSize: "text-sm/none",
72
- contentGap: "gap-1.5",
73
- iconSize: "size-4.5",
74
- leadingIconOffset: "-ml-px",
75
- trailingIconOffset: "-mr-px",
76
- loadingIndicatorSize: "text-base"
77
- },
78
- lg: {
79
- height: "h-9",
80
- width: "w-9",
81
- gutter: "px-3",
82
- pillGutter: "px-4",
83
- radius: "rounded-lg",
84
- fontSize: "text-sm/none",
85
- contentGap: "gap-1.5",
86
- iconSize: "size-4.5",
87
- leadingIconOffset: "-ml-px",
88
- trailingIconOffset: "-mr-px",
89
- loadingIndicatorSize: "text-base"
90
- },
91
- xl: {
92
- height: "h-10",
93
- width: "w-10",
94
- gutter: "px-3.5",
95
- pillGutter: "px-4.75",
96
- radius: "rounded-[10px]",
97
- fontSize: "text-sm/none",
98
- contentGap: "gap-1.5",
99
- iconSize: "size-4.5",
100
- leadingIconOffset: "-ml-px",
101
- trailingIconOffset: "-mr-px",
102
- loadingIndicatorSize: "text-lg"
103
- },
104
- "2xl": {
105
- height: "h-11",
106
- width: "w-11",
107
- gutter: "px-3.5",
108
- pillGutter: "px-4.75",
109
- radius: "rounded-xl",
110
- fontSize: "text-base/none",
111
- contentGap: "gap-1.5",
112
- iconSize: "size-5",
113
- leadingIconOffset: "-ml-0.5",
114
- trailingIconOffset: "-mr-0.5",
115
- loadingIndicatorSize: "text-lg"
116
- },
117
- "3xl": {
118
- height: "h-12",
119
- width: "w-12",
120
- gutter: "px-4",
121
- pillGutter: "px-5.25",
122
- radius: "rounded-xl",
123
- fontSize: "text-base/none",
124
- contentGap: "gap-1.5",
125
- iconSize: "size-5",
126
- leadingIconOffset: "-ml-0.5",
127
- trailingIconOffset: "-mr-0.5",
128
- loadingIndicatorSize: "text-xl"
129
- },
130
- "4xl": {
131
- height: "h-14",
132
- width: "w-14",
133
- gutter: "px-4.5",
134
- pillGutter: "px-6",
135
- radius: "rounded-2xl",
136
- fontSize: "text-base/none",
137
- contentGap: "gap-3",
138
- iconSize: "size-6",
139
- leadingIconOffset: "-ml-0.5",
140
- trailingIconOffset: "-mr-0.5",
141
- loadingIndicatorSize: "text-2xl"
142
- }
143
- }, J = Object.keys(q), Y = {
144
- surface: "light:before:bg-stone-950/8 dark:before:bg-stone-200/12",
145
- selectedSurface: "light:before:bg-stone-950/12 dark:before:bg-stone-200/16",
146
- text: "",
147
- selectedText: "",
148
- interaction: "light:hover:before:bg-stone-950/12 dark:hover:before:bg-stone-200/16 light:active:before:bg-stone-950/16 dark:active:before:bg-stone-200/20"
149
- }, X = {
150
- solid: {
151
- primary: {
152
- surface: "before:bg-primary",
153
- selectedSurface: "before:bg-primary before:brightness-90",
154
- text: "light:text-white dark:text-stone-950",
155
- selectedText: "light:text-white dark:text-stone-950",
156
- interaction: "hover:before:brightness-90"
157
- },
158
- secondary: {
159
- surface: "before:bg-secondary",
160
- selectedSurface: "before:bg-secondary before:brightness-90",
161
- text: "light:text-white dark:text-stone-950",
162
- selectedText: "light:text-white dark:text-stone-950",
163
- interaction: "hover:before:brightness-90"
164
- },
165
- neutral: {
166
- surface: "light:before:bg-neutral-900 dark:before:bg-stone-200",
167
- selectedSurface: "light:before:bg-neutral-800 dark:before:bg-stone-300",
168
- text: "light:text-white dark:text-stone-950",
169
- selectedText: "light:text-white dark:text-stone-950",
170
- interaction: "light:hover:before:bg-neutral-800 dark:hover:before:bg-stone-300 light:active:before:bg-neutral-700"
171
- },
172
- gray: {
173
- surface: "light:before:bg-stone-600 dark:before:bg-stone-700",
174
- selectedSurface: "light:before:bg-stone-700 dark:before:bg-stone-600",
175
- text: "light:text-white dark:text-white",
176
- selectedText: "light:text-white dark:text-white",
177
- interaction: "light:hover:before:bg-stone-700 dark:hover:before:bg-stone-600 light:active:before:bg-stone-800"
178
- },
179
- danger: {
180
- surface: "light:before:bg-red-600 dark:before:bg-red-600",
181
- selectedSurface: "light:before:bg-red-700 dark:before:bg-red-700",
182
- text: "light:text-white dark:text-white",
183
- selectedText: "light:text-white dark:text-white",
184
- interaction: "light:hover:before:bg-red-700 dark:hover:before:bg-red-700"
185
- }
186
- },
187
- soft: {
188
- primary: {
189
- surface: "before:bg-primary/16",
190
- selectedSurface: "before:bg-primary/30",
191
- text: "text-primary",
192
- selectedText: "text-primary",
193
- interaction: "hover:before:bg-primary/30"
194
- },
195
- secondary: {
196
- surface: "before:bg-secondary/16",
197
- selectedSurface: "before:bg-secondary/30",
198
- text: "text-secondary",
199
- selectedText: "text-secondary",
200
- interaction: "hover:before:bg-secondary/30"
201
- },
202
- neutral: Y,
203
- gray: Y,
204
- danger: {
205
- surface: "light:before:bg-red-500/16 dark:before:bg-red-400/16",
206
- selectedSurface: "light:before:bg-red-500/30 dark:before:bg-red-400/30",
207
- text: "light:text-red-600 dark:text-red-400",
208
- selectedText: "light:text-red-600 dark:text-red-400",
209
- interaction: "light:hover:before:bg-red-500/30 dark:hover:before:bg-red-400/30"
210
- }
211
- },
212
- outline: {
213
- primary: {
214
- surface: "before:border before:border-primary",
215
- selectedSurface: "before:border before:border-primary before:bg-primary/8",
216
- text: "text-primary",
217
- selectedText: "text-primary",
218
- interaction: "hover:before:bg-primary/8"
219
- },
220
- secondary: {
221
- surface: "before:border before:border-secondary",
222
- selectedSurface: "before:border before:border-secondary before:bg-secondary/8",
223
- text: "text-secondary",
224
- selectedText: "text-secondary",
225
- interaction: "hover:before:bg-secondary/8"
226
- },
227
- neutral: {
228
- surface: "before:border light:before:border-stone-950/16 dark:before:border-stone-200/25",
229
- selectedSurface: "before:border light:before:border-stone-950/20 dark:before:border-stone-200/30 light:before:bg-stone-950/2 dark:before:bg-stone-200/4",
230
- text: "",
231
- selectedText: "",
232
- interaction: "light:hover:before:border-stone-950/20 dark:hover:before:border-stone-200/30 light:hover:before:bg-stone-950/2 dark:hover:before:bg-stone-200/4 light:active:before:bg-stone-950/4 dark:active:before:bg-stone-200/6"
233
- },
234
- gray: {
235
- surface: "before:border light:before:border-stone-950/16 dark:before:border-stone-200/25",
236
- selectedSurface: "before:border light:before:border-stone-950/20 dark:before:border-stone-200/30 light:before:bg-stone-950/2 dark:before:bg-stone-200/4",
237
- text: "text-muted",
238
- selectedText: "",
239
- interaction: "hover:text-inherit light:hover:before:border-stone-950/20 dark:hover:before:border-stone-200/30 light:hover:before:bg-stone-950/2 dark:hover:before:bg-stone-200/4 light:active:before:bg-stone-950/4 dark:active:before:bg-stone-200/6"
240
- },
241
- danger: {
242
- surface: "before:border light:before:border-red-600 dark:before:border-red-400",
243
- selectedSurface: "before:border light:before:border-red-600 dark:before:border-red-400 light:before:bg-red-500/8 dark:before:bg-red-400/8",
244
- text: "light:text-red-600 dark:text-red-400",
245
- selectedText: "light:text-red-600 dark:text-red-400",
246
- interaction: "light:hover:before:bg-red-500/8 dark:hover:before:bg-red-400/8"
247
- }
248
- },
249
- ghost: {
250
- primary: {
251
- surface: "before:scale-96 before:opacity-0 before:bg-primary/16",
252
- selectedSurface: "before:bg-primary/16",
253
- text: "text-primary",
254
- selectedText: "text-primary",
255
- interaction: "hover:before:scale-100 hover:before:opacity-100"
256
- },
257
- secondary: {
258
- surface: "before:scale-96 before:opacity-0 before:bg-secondary/16",
259
- selectedSurface: "before:bg-secondary/16",
260
- text: "text-secondary",
261
- selectedText: "text-secondary",
262
- interaction: "hover:before:scale-100 hover:before:opacity-100"
263
- },
264
- neutral: {
265
- surface: "before:scale-96 before:opacity-0 light:before:bg-stone-950/8 dark:before:bg-stone-200/12",
266
- selectedSurface: "light:before:bg-stone-950/8 dark:before:bg-stone-200/12",
267
- text: "",
268
- selectedText: "",
269
- interaction: "hover:before:scale-100 hover:before:opacity-100 light:active:before:bg-stone-950/12 dark:active:before:bg-stone-200/16"
270
- },
271
- gray: {
272
- surface: "before:scale-96 before:opacity-0 light:before:bg-stone-950/8 dark:before:bg-stone-200/12",
273
- selectedSurface: "light:before:bg-stone-950/8 dark:before:bg-stone-200/12",
274
- text: "text-muted",
275
- selectedText: "",
276
- interaction: "hover:text-inherit hover:before:scale-100 hover:before:opacity-100 light:active:before:bg-stone-950/12 dark:active:before:bg-stone-200/16"
277
- },
278
- danger: {
279
- surface: "before:scale-96 before:opacity-0 light:before:bg-red-500/16 dark:before:bg-red-400/16",
280
- selectedSurface: "light:before:bg-red-500/16 dark:before:bg-red-400/16",
281
- text: "light:text-red-600 dark:text-red-400",
282
- selectedText: "light:text-red-600 dark:text-red-400",
283
- interaction: "hover:before:scale-100 hover:before:opacity-100"
284
- }
285
- }
286
- }, oe = Object.keys(X), se = Object.keys(X.solid);
287
- function ce(e) {
288
- return {
289
- base: [e.height, e.fontSize],
290
- content: e.contentGap,
291
- leadingIcon: e.iconSize,
292
- trailingIcon: e.iconSize,
293
- loadingIndicator: e.loadingIndicatorSize
294
- };
295
- }
296
- function le(e) {
297
- let t = q[e];
298
- return [
299
- {
300
- size: e,
301
- square: !1,
302
- pill: !0,
303
- class: { base: ["rounded-full", t.pillGutter] }
304
- },
305
- {
306
- size: e,
307
- square: !1,
308
- pill: !1,
309
- class: { base: [t.radius, t.gutter] }
310
- },
311
- {
312
- size: e,
313
- square: !0,
314
- class: { base: t.width }
315
- },
316
- {
317
- size: e,
318
- square: !0,
319
- pill: !1,
320
- class: { base: t.radius }
321
- },
322
- {
323
- size: e,
324
- square: !1,
325
- class: {
326
- leadingIcon: t.leadingIconOffset,
327
- trailingIcon: t.trailingIconOffset
328
- }
329
- }
330
- ];
331
- }
332
- function ue(e, t) {
333
- let n = X[e][t];
334
- return [
335
- {
336
- variant: e,
337
- color: t,
338
- disabled: !1,
339
- selected: !1,
340
- class: { base: [n.surface, n.text] }
341
- },
342
- {
343
- variant: e,
344
- color: t,
345
- disabled: !1,
346
- selected: !0,
347
- class: { base: [n.selectedSurface, n.selectedText] }
348
- },
349
- {
350
- variant: e,
351
- color: t,
352
- disabled: !1,
353
- loading: !1,
354
- class: { base: n.interaction }
355
- }
356
- ];
357
- }
358
- var de = Object.fromEntries(J.map((e) => [e, ce(q[e])])), fe = J.flatMap(le), pe = oe.flatMap((e) => se.flatMap((t) => ue(e, t))), me = G({
359
- slots: {
360
- base: "relative inline-flex shrink-0 cursor-pointer items-center justify-center font-medium whitespace-nowrap outline-primary transition-colors duration-150 select-none before:absolute before:inset-0 before:rounded-[inherit] before:transition before:duration-150 focus-visible:outline-2",
361
- loadingOverlay: "absolute inset-0 flex items-center justify-center",
362
- loadingIndicator: "loading-indicator",
363
- content: "relative flex size-full items-center justify-center",
364
- label: "",
365
- leadingIcon: "shrink-0",
366
- trailingIcon: "shrink-0"
367
- },
368
- variants: {
369
- variant: {
370
- solid: { base: "focus-visible:outline-offset-2" },
371
- soft: { base: "focus-visible:outline-offset-2" },
372
- outline: { base: "focus-visible:-outline-offset-1" },
373
- ghost: { base: "focus-visible:-outline-offset-1" }
374
- },
375
- color: {
376
- primary: "",
377
- secondary: "",
378
- neutral: "",
379
- gray: "",
380
- danger: ""
381
- },
382
- size: de,
383
- square: { true: "" },
384
- pill: { true: "" },
385
- block: { true: { base: "w-full" } },
386
- disabled: { true: { base: "cursor-not-allowed light:text-stone-400 dark:text-stone-500" } },
387
- loading: { true: {
388
- base: "pointer-events-none",
389
- content: "opacity-0"
390
- } },
391
- selected: { true: "" }
392
- },
393
- compoundVariants: [
394
- ...fe,
395
- ...pe,
396
- {
397
- square: !0,
398
- pill: !0,
399
- class: { base: "rounded-full" }
400
- },
401
- {
402
- disabled: !0,
403
- variant: ["solid", "soft"],
404
- class: { base: "light:before:bg-stone-950/5 dark:before:bg-stone-200/5" }
405
- },
406
- {
407
- disabled: !0,
408
- variant: "outline",
409
- class: { base: "before:border light:before:border-stone-950/6 dark:before:border-stone-200/6" }
410
- },
411
- {
412
- disabled: !1,
413
- loading: !1,
414
- square: !0,
415
- class: { base: "active:before:scale-96" }
416
- },
417
- {
418
- disabled: !1,
419
- loading: !1,
420
- square: !1,
421
- block: !0,
422
- class: { base: "active:before:scale-[0.995]" }
423
- },
424
- {
425
- disabled: !1,
426
- loading: !1,
427
- square: !1,
428
- block: !1,
429
- class: { base: "active:before:scale-97" }
430
- }
431
- ]
432
- }), Z = /* @__PURE__ */ l({
433
- __name: "Button",
434
- props: {
435
- label: {},
436
- variant: { default: "solid" },
437
- color: { default: "neutral" },
438
- size: { default: "md" },
439
- leadingIcon: {},
440
- trailingIcon: {},
441
- square: { type: Boolean },
442
- pill: {
443
- type: Boolean,
444
- default: !0
445
- },
446
- block: { type: Boolean },
447
- disabled: { type: Boolean },
448
- loading: { type: Boolean },
449
- selected: { type: Boolean },
450
- type: { default: "button" },
451
- href: {},
452
- ui: {},
453
- class: { type: [
454
- Array,
455
- String,
456
- null,
457
- Number,
458
- Boolean
459
- ] }
460
- },
461
- setup(e) {
462
- let t = e, c = n(() => me({
463
- variant: t.variant,
464
- color: t.color,
465
- size: t.size,
466
- square: t.square,
467
- pill: t.pill,
468
- block: t.block,
469
- disabled: t.disabled,
470
- loading: t.loading,
471
- selected: t.selected
472
- })), l = n(() => t.href ? "a" : "button"), u = n(() => {
473
- let e = t.square ? { "aria-label": t.label } : {};
474
- return t.href ? t.disabled ? {
475
- ...e,
476
- role: "link",
477
- "aria-disabled": "true"
478
- } : {
479
- ...e,
480
- href: t.href
481
- } : {
482
- ...e,
483
- type: t.type,
484
- disabled: t.disabled || t.loading,
485
- "aria-busy": t.loading || void 0,
486
- "aria-pressed": t.selected || void 0
487
- };
488
- });
489
- return (n, d) => (b(), r(E(l.value), p(u.value, { class: c.value.base({ class: [e.ui?.base, t.class] }) }), {
490
- default: B(() => [e.loading ? (b(), a("span", {
491
- key: 0,
492
- class: h(c.value.loadingOverlay({ class: e.ui?.loadingOverlay }))
493
- }, [o("span", { class: h(c.value.loadingIndicator({ class: e.ui?.loadingIndicator })) }, null, 2)], 2)) : i("", !0), o("span", { class: h(c.value.content({ class: e.ui?.content })) }, [
494
- e.leadingIcon ? (b(), r(E(e.leadingIcon), {
495
- key: 0,
496
- class: h(c.value.leadingIcon({ class: e.ui?.leadingIcon }))
497
- }, null, 8, ["class"])) : i("", !0),
498
- !e.square && (e.label || n.$slots.default) ? (b(), a("span", {
499
- key: 1,
500
- class: h(c.value.label({ class: e.ui?.label }))
501
- }, [w(n.$slots, "default", {}, () => [s(O(e.label), 1)])], 2)) : i("", !0),
502
- e.trailingIcon && !e.square ? (b(), r(E(e.trailingIcon), {
503
- key: 2,
504
- class: h(c.value.trailingIcon({ class: e.ui?.trailingIcon }))
505
- }, null, 8, ["class"])) : i("", !0)
506
- ], 2)]),
507
- _: 3
508
- }, 16, ["class"]));
509
- }
510
- }), he = {
511
- outline: {
512
- primary: "inset-ring inset-ring-line",
513
- success: "inset-ring light:inset-ring-green-600 light:text-green-700 dark:inset-ring-green-500 dark:text-green-400",
514
- warning: "inset-ring light:inset-ring-orange-600 light:text-orange-700 dark:inset-ring-orange-500 dark:text-orange-400",
515
- caution: "inset-ring light:inset-ring-yellow-600 light:text-yellow-700 dark:inset-ring-yellow-500 dark:text-yellow-400",
516
- danger: "inset-ring light:inset-ring-red-600 light:text-red-600 dark:inset-ring-red-500 dark:text-red-400",
517
- info: "inset-ring light:inset-ring-blue-600 light:text-blue-600 dark:inset-ring-blue-400 dark:text-blue-300",
518
- discovery: "inset-ring light:inset-ring-purple-600 light:text-purple-600 dark:inset-ring-purple-400 dark:text-purple-300"
519
- },
520
- soft: {
521
- primary: "inset-ring light:bg-stone-950/4 light:inset-ring-stone-950/6 dark:bg-white/6 dark:inset-ring-white/8",
522
- success: "inset-ring light:bg-green-500/6 light:inset-ring-green-500/16 light:text-green-700 dark:bg-green-400/10 dark:inset-ring-green-400/20 dark:text-green-400",
523
- warning: "inset-ring light:bg-orange-500/6 light:inset-ring-orange-500/16 light:text-orange-700 dark:bg-orange-400/10 dark:inset-ring-orange-400/20 dark:text-orange-400",
524
- caution: "inset-ring light:bg-yellow-500/8 light:inset-ring-yellow-500/20 light:text-yellow-800 dark:bg-yellow-400/10 dark:inset-ring-yellow-400/20 dark:text-yellow-400",
525
- danger: "inset-ring light:bg-red-500/6 light:inset-ring-red-500/16 light:text-red-600 dark:bg-red-400/10 dark:inset-ring-red-400/20 dark:text-red-400",
526
- info: "inset-ring light:bg-blue-500/6 light:inset-ring-blue-500/16 light:text-blue-600 dark:bg-blue-400/10 dark:inset-ring-blue-400/20 dark:text-blue-300",
527
- discovery: "inset-ring light:bg-purple-500/6 light:inset-ring-purple-500/16 light:text-purple-600 dark:bg-purple-400/10 dark:inset-ring-purple-400/20 dark:text-purple-300"
528
- },
529
- solid: {
530
- primary: "light:bg-neutral-900 light:text-white dark:bg-stone-200 dark:text-stone-950",
531
- success: "light:bg-green-600 light:text-white dark:bg-green-600 dark:text-white",
532
- warning: "light:bg-orange-600 light:text-white dark:bg-orange-600 dark:text-white",
533
- caution: "light:bg-yellow-700 light:text-white dark:bg-yellow-700 dark:text-white",
534
- danger: "light:bg-red-600 light:text-white dark:bg-red-600 dark:text-white",
535
- info: "light:bg-blue-600 light:text-white dark:bg-blue-500 dark:text-white",
536
- discovery: "light:bg-purple-600 light:text-white dark:bg-purple-500 dark:text-white"
537
- }
538
- }, ge = Object.keys(he), _e = Object.keys(he.outline), ve = ge.flatMap((e) => _e.map((t) => ({
539
- variant: e,
540
- color: t,
541
- class: { root: he[e][t] }
542
- }))), ye = G({
543
- slots: {
544
- root: "@container w-full rounded-xl p-4 text-sm leading-5",
545
- body: "flex gap-3",
546
- icon: "size-5 shrink-0",
547
- content: "min-w-0 flex-1",
548
- wrapper: "min-w-0 flex-1",
549
- title: "font-semibold text-pretty",
550
- description: "text-pretty",
551
- actions: "flex shrink-0 gap-2",
552
- closeButton: "shrink-0"
553
- },
554
- variants: {
555
- variant: {
556
- outline: "",
557
- soft: "",
558
- solid: ""
559
- },
560
- color: {
561
- primary: "",
562
- success: "",
563
- warning: "",
564
- caution: "",
565
- danger: "",
566
- info: "",
567
- discovery: ""
568
- },
569
- actionsPlacement: {
570
- end: "",
571
- bottom: ""
572
- },
573
- hasActions: {
574
- true: "",
575
- false: { body: "items-center" }
576
- },
577
- hasTitle: { true: { description: "mt-0.5" } }
578
- },
579
- compoundVariants: [
580
- ...ve,
581
- {
582
- hasActions: !0,
583
- actionsPlacement: "end",
584
- class: {
585
- body: "items-start @md:items-center",
586
- content: "@md:flex @md:items-center @md:justify-between",
587
- actions: "mt-4 @md:mt-0 @md:ml-4"
588
- }
589
- },
590
- {
591
- hasActions: !0,
592
- actionsPlacement: "bottom",
593
- class: {
594
- body: "items-start",
595
- actions: "mt-4"
596
- }
597
- }
598
- ]
599
- }), be = ["role"], xe = /* @__PURE__ */ l({
600
- __name: "Alert",
601
- props: /*@__PURE__*/ f({
602
- title: {},
603
- description: {},
604
- variant: { default: "outline" },
605
- color: { default: "primary" },
606
- icon: {},
607
- showIcon: {
608
- type: Boolean,
609
- default: !0
610
- },
611
- actionsPlacement: { default: "end" },
612
- closable: { type: Boolean },
613
- ui: {},
614
- class: { type: [
615
- Array,
616
- String,
617
- null,
618
- Number,
619
- Boolean
620
- ] }
621
- }, {
622
- open: {
623
- type: Boolean,
624
- default: !0
625
- },
626
- openModifiers: {}
627
- }),
628
- emits: ["update:open"],
629
- setup(e) {
630
- let t = e, c = M(e, "open"), l = N(), u = {
631
- warning: W,
632
- caution: W,
633
- danger: W,
634
- success: re
635
- }, d = n(() => t.icon ?? u[t.color] ?? U), f = n(() => !!(t.title || l.title)), p = n(() => !!(t.description || l.description)), m = n(() => !!l.actions), g = n(() => ye({
636
- variant: t.variant,
637
- color: t.color,
638
- actionsPlacement: t.actionsPlacement,
639
- hasActions: m.value,
640
- hasTitle: f.value
641
- }));
642
- return (n, l) => c.value ? (b(), a("div", {
643
- key: 0,
644
- role: e.color === "danger" ? "alert" : void 0,
645
- class: h(g.value.root({ class: [e.ui?.root, t.class] }))
646
- }, [o("div", { class: h(g.value.body({ class: e.ui?.body })) }, [
647
- e.showIcon ? (b(), r(E(d.value), {
648
- key: 0,
649
- class: h(g.value.icon({ class: e.ui?.icon }))
650
- }, null, 8, ["class"])) : i("", !0),
651
- o("div", { class: h(g.value.content({ class: e.ui?.content })) }, [o("div", { class: h(g.value.wrapper({ class: e.ui?.wrapper })) }, [f.value ? (b(), a("div", {
652
- key: 0,
653
- class: h(g.value.title({ class: e.ui?.title }))
654
- }, [w(n.$slots, "title", {}, () => [s(O(e.title), 1)])], 2)) : i("", !0), p.value ? (b(), a("div", {
655
- key: 1,
656
- class: h(g.value.description({ class: e.ui?.description }))
657
- }, [w(n.$slots, "description", {}, () => [s(O(e.description), 1)])], 2)) : i("", !0)], 2), m.value ? (b(), a("div", {
658
- key: 0,
659
- class: h(g.value.actions({ class: e.ui?.actions }))
660
- }, [w(n.$slots, "actions")], 2)) : i("", !0)], 2),
661
- e.closable ? (b(), r(A(Z), {
662
- key: 1,
663
- label: "Close",
664
- size: "xs",
665
- variant: "ghost",
666
- color: "gray",
667
- square: "",
668
- "leading-icon": A(ie),
669
- class: h(g.value.closeButton({ class: e.ui?.closeButton })),
670
- onClick: l[0] ||= (e) => c.value = !1
671
- }, null, 8, ["leading-icon", "class"])) : i("", !0)
672
- ], 2)], 10, be)) : i("", !0);
673
- }
674
- }), Se = {
675
- "3xs": {
676
- sizeVariable: "[--avatar-size:22px]",
677
- radius: "rounded-md"
678
- },
679
- "2xs": {
680
- sizeVariable: "[--avatar-size:24px]",
681
- radius: "rounded-md"
682
- },
683
- xs: {
684
- sizeVariable: "[--avatar-size:26px]",
685
- radius: "rounded-md"
686
- },
687
- sm: {
688
- sizeVariable: "[--avatar-size:28px]",
689
- radius: "rounded-md"
690
- },
691
- md: {
692
- sizeVariable: "[--avatar-size:32px]",
693
- radius: "rounded-lg"
694
- },
695
- lg: {
696
- sizeVariable: "[--avatar-size:36px]",
697
- radius: "rounded-lg"
698
- },
699
- xl: {
700
- sizeVariable: "[--avatar-size:40px]",
701
- radius: "rounded-[10px]"
702
- },
703
- "2xl": {
704
- sizeVariable: "[--avatar-size:44px]",
705
- radius: "rounded-xl"
706
- },
707
- "3xl": {
708
- sizeVariable: "[--avatar-size:48px]",
709
- radius: "rounded-xl"
710
- },
711
- "4xl": {
712
- sizeVariable: "[--avatar-size:56px]",
713
- radius: "rounded-2xl"
714
- },
715
- "5xl": {
716
- sizeVariable: "[--avatar-size:64px]",
717
- radius: "rounded-2xl"
718
- },
719
- "6xl": {
720
- sizeVariable: "[--avatar-size:80px]",
721
- radius: "rounded-3xl"
722
- }
723
- }, Ce = Object.keys(Se), we = {
724
- soft: {
725
- primary: "light:bg-stone-200 dark:bg-stone-700",
726
- secondary: "bg-secondary/16 text-secondary",
727
- gray: "light:bg-stone-200 dark:bg-stone-700",
728
- success: "light:bg-green-100 light:text-green-700 dark:bg-green-950 dark:text-green-400",
729
- info: "light:bg-blue-100 light:text-blue-700 dark:bg-blue-950 dark:text-blue-300",
730
- discovery: "light:bg-purple-100 light:text-purple-700 dark:bg-purple-950 dark:text-purple-300",
731
- danger: "light:bg-red-100 light:text-red-700 dark:bg-red-950 dark:text-red-400"
732
- },
733
- solid: {
734
- primary: "light:bg-neutral-900 light:text-white dark:bg-stone-200 dark:text-stone-950",
735
- secondary: "bg-secondary light:text-white dark:text-stone-950",
736
- gray: "light:bg-stone-600 light:text-white dark:bg-stone-600 dark:text-white",
737
- success: "light:bg-green-600 light:text-white dark:bg-green-600 dark:text-white",
738
- info: "light:bg-blue-600 light:text-white dark:bg-blue-500 dark:text-white",
739
- discovery: "light:bg-purple-600 light:text-white dark:bg-purple-500 dark:text-white",
740
- danger: "light:bg-red-600 light:text-white dark:bg-red-600 dark:text-white"
741
- }
742
- }, Te = Object.keys(we), Ee = Object.keys(we.soft), De = Object.fromEntries(Ce.map((e) => [e, { base: Se[e].sizeVariable }])), Oe = Ce.flatMap((e) => [{
743
- size: e,
744
- pill: !0,
745
- class: { base: "rounded-full" }
746
- }, {
747
- size: e,
748
- pill: !1,
749
- class: { base: Se[e].radius }
750
- }]), ke = Te.flatMap((e) => Ee.map((t) => ({
751
- variant: e,
752
- color: t,
753
- class: { base: we[e][t] }
754
- }))), Ae = G({
755
- slots: {
756
- base: "relative inline-flex size-(--avatar-size) shrink-0 items-center justify-center overflow-hidden select-none",
757
- image: "absolute inset-0 size-full rounded-[inherit] object-cover",
758
- icon: "size-[calc(var(--avatar-size)*0.55)] shrink-0",
759
- label: "font-semibold",
760
- overflowSign: "relative -top-[calc(var(--avatar-size)/24)] -ml-px"
761
- },
762
- variants: {
763
- variant: {
764
- soft: "",
765
- solid: ""
766
- },
767
- color: {
768
- primary: "",
769
- secondary: "",
770
- gray: "",
771
- success: "",
772
- info: "",
773
- discovery: "",
774
- danger: ""
775
- },
776
- size: De,
777
- pill: { true: "" },
778
- hasImage: { true: { base: "after:absolute after:inset-0 after:rounded-[inherit] after:border light:after:border-black/4 dark:after:border-white/15" } },
779
- isLink: { true: { base: "outline-primary focus-visible:outline-2 focus-visible:outline-offset-2" } },
780
- isOverflow: { true: { label: "flex" } },
781
- labelCharacterCount: {
782
- one: "",
783
- two: "",
784
- many: { label: "text-[length:calc(var(--avatar-size)*0.3)]/none" }
785
- }
786
- },
787
- compoundVariants: [
788
- ...Oe,
789
- ...ke,
790
- {
791
- isOverflow: !1,
792
- labelCharacterCount: "one",
793
- class: { label: "text-[length:calc(var(--avatar-size)*0.5)]/none" }
794
- },
795
- {
796
- isOverflow: !1,
797
- labelCharacterCount: "two",
798
- class: { label: "text-[length:calc(var(--avatar-size)*0.4)]/none" }
799
- },
800
- {
801
- isOverflow: !0,
802
- labelCharacterCount: "one",
803
- class: { label: "text-[length:calc(var(--avatar-size)*0.45)]/none" }
804
- },
805
- {
806
- isOverflow: !0,
807
- labelCharacterCount: "two",
808
- class: { label: "text-[length:calc(var(--avatar-size)*0.37)]/none" }
809
- }
810
- ]
811
- }), je = ["src"], Me = /* @__PURE__ */ l({
812
- __name: "Avatar",
813
- props: {
814
- name: { default: "" },
815
- imageUrl: {},
816
- icon: {},
817
- initials: {},
818
- overflowCount: { default: 0 },
819
- variant: { default: "soft" },
820
- color: { default: "gray" },
821
- size: { default: "md" },
822
- pill: {
823
- type: Boolean,
824
- default: !0
825
- },
826
- href: {},
827
- ui: {},
828
- class: { type: [
829
- Array,
830
- String,
831
- null,
832
- Number,
833
- Boolean
834
- ] }
835
- },
836
- setup(e) {
837
- let t = e, i = n(() => t.overflowCount > 0), c = n(() => t.overflowCount >= 1e6 ? `${Math.round(t.overflowCount / 1e6)}m` : t.overflowCount >= 1e3 ? `${Math.round(t.overflowCount / 1e3)}k` : String(t.overflowCount)), l = n(() => t.initials || t.name.charAt(0).toUpperCase()), u = n(() => t.name || (i.value ? `${t.overflowCount} more` : "")), d = n(() => {
838
- let e = i.value ? c.value.length : l.value.length;
839
- return e <= 1 ? "one" : e === 2 ? "two" : "many";
840
- }), f = n(() => Ae({
841
- variant: t.variant,
842
- color: t.color,
843
- size: t.size,
844
- pill: t.pill,
845
- hasImage: !!t.imageUrl,
846
- isLink: !!t.href,
847
- isOverflow: i.value,
848
- labelCharacterCount: d.value
849
- })), m = n(() => t.href ? "a" : "span"), g = n(() => t.href ? {
850
- href: t.href,
851
- "aria-label": u.value || void 0
852
- } : u.value ? {
853
- role: "img",
854
- "aria-label": u.value
855
- } : { "aria-hidden": "true" });
856
- return (n, u) => (b(), r(E(m.value), p(g.value, { class: f.value.base({ class: [e.ui?.base, t.class] }) }), {
857
- default: B(() => [e.imageUrl ? (b(), a("img", {
858
- key: 0,
859
- src: e.imageUrl,
860
- alt: "",
861
- class: h(f.value.image({ class: e.ui?.image }))
862
- }, null, 10, je)) : e.icon ? (b(), r(E(e.icon), {
863
- key: 1,
864
- class: h(f.value.icon({ class: e.ui?.icon }))
865
- }, null, 8, ["class"])) : i.value ? (b(), a("span", {
866
- key: 2,
867
- "aria-hidden": "true",
868
- class: h(f.value.label({ class: e.ui?.label }))
869
- }, [o("span", { class: h(f.value.overflowSign({ class: e.ui?.overflowSign })) }, "+", 2), s(" " + O(c.value), 1)], 2)) : (b(), a("span", {
870
- key: 3,
871
- "aria-hidden": "true",
872
- class: h(f.value.label({ class: e.ui?.label }))
873
- }, O(l.value), 3))]),
874
- _: 1
875
- }, 16, ["class"]));
876
- }
877
- }), Ne = G({
878
- slots: { base: "flex *:ring-3" },
879
- variants: {
880
- stack: {
881
- start: { base: "flex-row-reverse justify-end *:not-first:-me-[calc(var(--avatar-size)/4)]" },
882
- end: { base: "*:not-first:-ms-[calc(var(--avatar-size)/4)]" }
883
- },
884
- surface: {
885
- widget: { base: "*:ring-widget" },
886
- canvas: { base: "*:ring-canvas" }
887
- },
888
- hasOverflow: { true: "" }
889
- },
890
- compoundVariants: [{
891
- stack: "start",
892
- hasOverflow: !0,
893
- class: { base: "*:first:z-10" }
894
- }]
895
- }), Pe = ["role", "aria-label"], Fe = /* @__PURE__ */ l({
896
- __name: "AvatarGroup",
897
- props: {
898
- avatars: {},
899
- label: {},
900
- size: { default: "md" },
901
- stack: { default: "start" },
902
- overflowCount: { default: 0 },
903
- surface: { default: "widget" },
904
- ui: {},
905
- class: { type: [
906
- Array,
907
- String,
908
- null,
909
- Number,
910
- Boolean
911
- ] }
912
- },
913
- setup(t) {
914
- let i = t, o = n(() => i.overflowCount > 0), s = n(() => {
915
- let e = (o.value ? [...i.avatars, { overflowCount: i.overflowCount }] : [...i.avatars]).map((e, t) => ({
916
- avatarProps: e,
917
- avatarPosition: t
918
- }));
919
- return i.stack === "start" ? e.reverse() : e;
920
- }), c = n(() => Ne({
921
- stack: i.stack,
922
- surface: i.surface,
923
- hasOverflow: o.value
924
- }));
925
- return (n, o) => (b(), a("div", {
926
- role: t.label ? "group" : void 0,
927
- "aria-label": t.label || void 0,
928
- class: h(c.value.base({ class: [t.ui?.base, i.class] }))
929
- }, [(b(!0), a(e, null, C(s.value, (e) => (b(), r(A(Me), p({ key: e.avatarPosition }, { ref_for: !0 }, e.avatarProps, { size: t.size }), null, 16, ["size"]))), 128))], 10, Pe));
930
- }
931
- });
932
- // src/shared/utils/isApplePlatform.ts
933
- function Ie() {
934
- return /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent);
935
- }
936
- // src/shared/composables/useApplePlatform.ts
937
- function Le() {
938
- let e = D(!1);
939
- return y(() => {
940
- e.value = Ie();
941
- }), S(e);
942
- }
943
- // src/shared/composables/useDismissOnOutsidePointerDown.ts
944
- function Re(e, t) {
945
- function n(n) {
946
- let r = n.target;
947
- r instanceof Node && (e.some((e) => k(e)?.contains(r)) || t.onDismiss());
948
- }
949
- y(() => {
950
- z(() => k(t.active), (e, t, r) => {
951
- e && (document.addEventListener("pointerdown", n, { capture: !0 }), r(() => document.removeEventListener("pointerdown", n, { capture: !0 })));
952
- }, { immediate: !0 });
953
- });
954
- }
955
- // src/shared/utils/parseShortcut.ts
956
- var ze = /* @__PURE__ */ new Set([
957
- "ctrl",
958
- "meta",
959
- "alt",
960
- "shift",
961
- "mod"
962
- ]), Be = {
963
- space: " ",
964
- plus: "+"
965
- }, Ve = /* @__PURE__ */ new Set([
966
- "escape",
967
- "enter",
968
- "tab",
969
- "backspace",
970
- "delete",
971
- "insert",
972
- "arrowup",
973
- "arrowdown",
974
- "arrowleft",
975
- "arrowright",
976
- "home",
977
- "end",
978
- "pageup",
979
- "pagedown"
980
- ]), He = /^f([1-9]|1\d|2[0-4])$/;
981
- function Ue(e) {
982
- return ze.has(e);
983
- }
984
- function We(e) {
985
- return [...e].length === 1 || Ve.has(e) || He.test(e);
986
- }
987
- function Ge(e, t) {
988
- let n = e.toLowerCase().split("+"), r = n.pop() ?? "", i = Be[r] ?? r;
989
- if (!We(i)) throw Error(`Unknown key "${r}" in shortcut "${t}".`);
990
- let a = n.map((e) => {
991
- if (!Ue(e)) throw Error(`Unknown modifier "${e}" in shortcut "${t}".`);
992
- return e;
993
- });
994
- return {
995
- key: i,
996
- modifiers: new Set(a)
997
- };
998
- }
999
- function Ke(e) {
1000
- return e.trim().split(/\s+/).map((t) => Ge(t, e));
1001
- }
1002
- // src/shared/utils/createShortcutHandler.ts
1003
- var qe = 1e3, Je = /* @__PURE__ */ new Set([
1004
- "shift",
1005
- "control",
1006
- "alt",
1007
- "meta",
1008
- "altgraph",
1009
- "capslock",
1010
- "fn"
1011
- ]), Ye = /^(?:Key|Digit)(.)$/;
1012
- function Xe(e) {
1013
- return [...e].length === 1 && e.toLowerCase() === e.toUpperCase();
1014
- }
1015
- function Ze(e, t) {
1016
- if (e.key.toLowerCase() === t) return !0;
1017
- let n = Ye.exec(e.code)?.[1]?.toLowerCase();
1018
- return e.altKey && n === t;
1019
- }
1020
- function Qe(e, t) {
1021
- let { modifiers: n } = t, r = Ie(), i = Xe(t.key), a = i && e.getModifierState("AltGraph"), o = n.has("ctrl") || n.has("mod") && !r, s = n.has("meta") || n.has("mod") && r;
1022
- return e.metaKey === s && (a || e.ctrlKey === o) && (a || e.altKey === n.has("alt")) && (i || e.shiftKey === n.has("shift"));
1023
- }
1024
- function $e(e, t) {
1025
- return t ? Ze(e, t.key) && Qe(e, t) : !1;
1026
- }
1027
- function et(e, t) {
1028
- let n = typeof t == "function" ? { handler: t } : t;
1029
- return {
1030
- shortcut: e,
1031
- keySequence: Ke(e),
1032
- handler: n.handler,
1033
- preventDefault: n.preventDefault ?? !0,
1034
- allowInEditable: n.allowInEditable ?? !1
1035
- };
1036
- }
1037
- function tt(e, t = {}) {
1038
- let n = Object.entries(e).map(([e, t]) => et(e, t)), r = t.guards ?? [], i = t.sequenceTimeout ?? qe, a = /* @__PURE__ */ new Map(), o;
1039
- function s(e, t) {
1040
- let n = a.get(t) ?? 0;
1041
- return $e(e, t.keySequence[n]) ? n + 1 : +!!$e(e, t.keySequence[0]);
1042
- }
1043
- function c(e, t) {
1044
- t.preventDefault && e.preventDefault(), t.handler(e, { shortcut: t.shortcut });
1045
- }
1046
- function l() {
1047
- clearTimeout(o), a.size > 0 && (o = setTimeout(() => a.clear(), i));
1048
- }
1049
- return function(e) {
1050
- if (e instanceof KeyboardEvent && !e.isComposing && !Je.has(e.key.toLowerCase())) {
1051
- for (let t of n) {
1052
- let n = r.every((n) => n(e, t)) ? s(e, t) : 0;
1053
- n === t.keySequence.length ? (a.delete(t), c(e, t)) : n > 0 ? a.set(t, n) : a.delete(t);
1054
- }
1055
- l();
1056
- }
1057
- };
1058
- }
1059
- // src/shared/utils/computeFloatingPosition.ts
1060
- function Q(e, t, n, r) {
1061
- return r.align === "center" ? e + (t - n) / 2 : r.align === "end" ? e + t - n - r.alignOffset : e + r.alignOffset;
1062
- }
1063
- var nt = {
1064
- top: ({ anchorRect: e, floatingSize: t }, n) => ({
1065
- x: Q(e.x, e.width, t.width, n),
1066
- y: e.y - t.height - n.sideOffset
1067
- }),
1068
- bottom: ({ anchorRect: e, floatingSize: t }, n) => ({
1069
- x: Q(e.x, e.width, t.width, n),
1070
- y: e.y + e.height + n.sideOffset
1071
- }),
1072
- left: ({ anchorRect: e, floatingSize: t }, n) => ({
1073
- x: e.x - t.width - n.sideOffset,
1074
- y: Q(e.y, e.height, t.height, n)
1075
- }),
1076
- right: ({ anchorRect: e, floatingSize: t }, n) => ({
1077
- x: e.x + e.width + n.sideOffset,
1078
- y: Q(e.y, e.height, t.height, n)
1079
- })
1080
- };
1081
- function rt(e, t) {
1082
- return {
1083
- ...nt[t.side](e, t),
1084
- placement: t
1085
- };
1086
- }
1087
- function it(e, t, n = []) {
1088
- return n.reduce((t, n) => n(t, e), rt(e, t));
1089
- }
1090
- // src/shared/composables/useFloatingPosition.ts
1091
- function at(e, t) {
1092
- if (t === "fixed") return {
1093
- x: 0,
1094
- y: 0
1095
- };
1096
- let n = e.offsetParent;
1097
- if (!(n instanceof HTMLElement) || (n === document.body || n === document.documentElement) && getComputedStyle(n).position === "static") return {
1098
- x: -window.scrollX,
1099
- y: -window.scrollY
1100
- };
1101
- let r = n.getBoundingClientRect();
1102
- return {
1103
- x: r.x + n.clientLeft - n.scrollLeft,
1104
- y: r.y + n.clientTop - n.scrollTop
1105
- };
1106
- }
1107
- function ot(e) {
1108
- return Math.round(e * window.devicePixelRatio) / window.devicePixelRatio;
1109
- }
1110
- function st(e, t) {
1111
- return e?.x === t.x && e.y === t.y && e.placement.side === t.placement.side && e.placement.align === t.placement.align;
1112
- }
1113
- function ct(e, t, r) {
1114
- let i = D(), a = D(0), o = n(() => k(r.strategy) ?? "absolute"), s = n(() => ({
1115
- side: k(r.side) ?? "bottom",
1116
- align: k(r.align) ?? "start",
1117
- sideOffset: k(r.sideOffset) ?? 0,
1118
- alignOffset: k(r.alignOffset) ?? 0
1119
- }));
1120
- function c() {
1121
- let n = k(e), l = k(t);
1122
- if (!k(r.open) || !n || !l) return;
1123
- let u = n.getBoundingClientRect();
1124
- if (u.width !== a.value) {
1125
- a.value = u.width, m(c);
1126
- return;
1127
- }
1128
- let d = it({
1129
- anchorRect: {
1130
- x: u.x,
1131
- y: u.y,
1132
- width: u.width,
1133
- height: u.height
1134
- },
1135
- floatingSize: {
1136
- width: l.offsetWidth,
1137
- height: l.offsetHeight
1138
- },
1139
- viewportSize: {
1140
- width: document.documentElement.clientWidth,
1141
- height: document.documentElement.clientHeight
1142
- }
1143
- }, s.value, k(r.positionModifiers)), f = at(l, o.value), p = {
1144
- x: ot(d.x - f.x),
1145
- y: ot(d.y - f.y),
1146
- placement: d.placement
1147
- };
1148
- st(i.value, p) || (i.value = p);
1149
- }
1150
- function l(t) {
1151
- let n = t.target;
1152
- if (n === document || n === document.documentElement) {
1153
- o.value === "fixed" && c();
1154
- return;
1155
- }
1156
- let r = k(e);
1157
- r && n instanceof Node && n.contains(r) && c();
1158
- }
1159
- y(() => {
1160
- z(() => [
1161
- k(r.open),
1162
- k(e),
1163
- k(t)
1164
- ], ([e, t, n], r, i) => {
1165
- if (!e || !t || !n) return;
1166
- c();
1167
- let a = new ResizeObserver(() => c());
1168
- a.observe(t), a.observe(n), window.addEventListener("scroll", l, {
1169
- capture: !0,
1170
- passive: !0
1171
- }), window.addEventListener("resize", c, { passive: !0 }), i(() => {
1172
- a.disconnect(), window.removeEventListener("scroll", l, { capture: !0 }), window.removeEventListener("resize", c);
1173
- });
1174
- }, {
1175
- immediate: !0,
1176
- flush: "post"
1177
- }), z([
1178
- s,
1179
- o,
1180
- () => k(r.positionModifiers)
1181
- ], c, { flush: "post" });
1182
- });
1183
- let u = n(() => i.value !== void 0);
1184
- return {
1185
- floatingStyles: n(() => ({
1186
- position: o.value,
1187
- top: `${i.value?.y ?? 0}px`,
1188
- left: `${i.value?.x ?? 0}px`,
1189
- visibility: u.value ? void 0 : "hidden",
1190
- "--floating-anchor-width": `${a.value}px`
1191
- })),
1192
- floatingPlacement: n(() => i.value?.placement ?? s.value),
1193
- isPositioned: u,
1194
- updatePosition: c
1195
- };
1196
- }
1197
- // src/shared/utils/createTypeaheadSearch.ts
1198
- function lt(e = 500) {
1199
- let t = "", n;
1200
- return function(r, i, a) {
1201
- clearTimeout(n), t += r.toLowerCase(), n = setTimeout(() => {
1202
- t = "";
1203
- }, e);
1204
- let o = t.charAt(0), s = [...t].every((e) => e === o) ? o : t, c = s.length === 1 ? a + 1 : Math.max(a, 0);
1205
- for (let e = 0; e < i.length; e++) {
1206
- let t = (c + e) % i.length;
1207
- if (i[t]?.toLowerCase().startsWith(s)) return t;
1208
- }
1209
- return -1;
1210
- };
1211
- }
1212
- // src/shared/utils/flipFloatingPosition.ts
1213
- var ut = {
1214
- top: "bottom",
1215
- bottom: "top",
1216
- left: "right",
1217
- right: "left"
1218
- };
1219
- function dt(e, { floatingSize: t, viewportSize: n }, r) {
1220
- return {
1221
- top: r - e.y,
1222
- bottom: e.y + t.height - (n.height - r),
1223
- left: r - e.x,
1224
- right: e.x + t.width - (n.width - r)
1225
- }[e.placement.side];
1226
- }
1227
- function ft(e = 8) {
1228
- return (t, n) => {
1229
- let r = dt(t, n, e);
1230
- if (r <= 0) return t;
1231
- let i = rt(n, {
1232
- ...t.placement,
1233
- side: ut[t.placement.side]
1234
- });
1235
- return dt(i, n, e) < r ? i : t;
1236
- };
1237
- }
1238
- // src/shared/utils/formatShortcut.ts
1239
- var pt = [
1240
- ["ctrl", "⌃"],
1241
- ["alt", "⌥"],
1242
- ["shift", "⇧"],
1243
- ["meta", "⌘"]
1244
- ], mt = [
1245
- ["ctrl", "Ctrl"],
1246
- ["alt", "Alt"],
1247
- ["shift", "Shift"],
1248
- ["meta", "Win"]
1249
- ], ht = {
1250
- " ": {
1251
- apple: "Space",
1252
- other: "Space"
1253
- },
1254
- escape: {
1255
- apple: "Esc",
1256
- other: "Esc"
1257
- },
1258
- enter: {
1259
- apple: "↩",
1260
- other: "Enter"
1261
- },
1262
- tab: {
1263
- apple: "⇥",
1264
- other: "Tab"
1265
- },
1266
- backspace: {
1267
- apple: "⌫",
1268
- other: "Backspace"
1269
- },
1270
- delete: {
1271
- apple: "⌦",
1272
- other: "Delete"
1273
- },
1274
- insert: {
1275
- apple: "Insert",
1276
- other: "Insert"
1277
- },
1278
- arrowup: {
1279
- apple: "↑",
1280
- other: "↑"
1281
- },
1282
- arrowdown: {
1283
- apple: "↓",
1284
- other: "↓"
1285
- },
1286
- arrowleft: {
1287
- apple: "←",
1288
- other: "←"
1289
- },
1290
- arrowright: {
1291
- apple: "→",
1292
- other: "→"
1293
- },
1294
- home: {
1295
- apple: "Home",
1296
- other: "Home"
1297
- },
1298
- end: {
1299
- apple: "End",
1300
- other: "End"
1301
- },
1302
- pageup: {
1303
- apple: "Page Up",
1304
- other: "Page Up"
1305
- },
1306
- pagedown: {
1307
- apple: "Page Down",
1308
- other: "Page Down"
1309
- }
1310
- };
1311
- function gt(e, t) {
1312
- let n = ht[e];
1313
- return n ? t ? n.apple : n.other : e.toUpperCase();
1314
- }
1315
- function _t(e, t) {
1316
- let n = new Set([...e.modifiers].map((e) => e === "mod" ? t ? "meta" : "ctrl" : e)), r = gt(e.key, t);
1317
- return t ? pt.filter(([e]) => n.has(e)).map(([, e]) => e).join("") + r : [...mt.filter(([e]) => n.has(e)).map(([, e]) => e), r].join("+");
1318
- }
1319
- function vt(e, t) {
1320
- return Ke(e).map((e) => _t(e, t)).join(" ");
1321
- }
1322
- // src/shared/utils/isExternalUrl.ts
1323
- function yt(e) {
1324
- return /^https?:\/\//.test(e);
1325
- }
1326
- // src/components/menu/menuContext.ts
1327
- var bt = Symbol("menuContext");
1328
- function xt() {
1329
- let e = d(bt);
1330
- if (!e) throw Error("A menu panel must be rendered inside KMenu.");
1331
- return e;
1332
- }
1333
- // src/components/menu/MenuItemRow.vue
1334
- var St = /* @__PURE__ */ l({
1335
- __name: "MenuItemRow",
1336
- props: {
1337
- menuItem: {},
1338
- menuThemeSlots: {},
1339
- submenuKey: {},
1340
- submenuId: {},
1341
- isSubmenuOpen: { type: Boolean }
1342
- },
1343
- emits: ["select", "selectAction"],
1344
- setup(t, { emit: s }) {
1345
- let c = t, l = s, { menuSettings: u, usesApplePlatform: d } = xt(), f = {
1346
- checkbox: "menuitemcheckbox",
1347
- radio: "menuitemradio"
1348
- }, m = n(() => u.value.ui), g = n(() => c.menuItem.type !== void 0), _ = n(() => !!c.menuItem.submenu), v = n(() => !!c.menuItem.actions?.length), y = n(() => !!c.menuItem.disabled), x = n(() => !!c.menuItem.checked), S = n(() => !!c.menuItem.href && !g.value && !_.value && !v.value), w = n(() => S.value && yt(c.menuItem.href ?? "")), T = n(() => c.menuItem.shortcut ? vt(c.menuItem.shortcut, d.value) : void 0), D = n(() => {
1349
- let e = {
1350
- role: c.menuItem.type ? f[c.menuItem.type] : "menuitem",
1351
- tabindex: -1,
1352
- "aria-disabled": y.value || void 0,
1353
- "data-menu-item-label": c.menuItem.label
1354
- };
1355
- return S.value ? {
1356
- ...e,
1357
- href: y.value ? void 0 : c.menuItem.href,
1358
- target: w.value ? "_blank" : void 0,
1359
- rel: w.value ? "noopener noreferrer" : void 0
1360
- } : _.value ? {
1361
- ...e,
1362
- "aria-haspopup": "menu",
1363
- "aria-expanded": String(!!c.isSubmenuOpen),
1364
- "aria-controls": c.isSubmenuOpen ? c.submenuId : void 0,
1365
- "data-submenu-key": c.submenuKey
1366
- } : {
1367
- ...e,
1368
- "aria-checked": g.value ? String(x.value) : void 0
1369
- };
1370
- });
1371
- return (n, s) => (b(), r(E(S.value ? "a" : "div"), p(D.value, {
1372
- class: t.menuThemeSlots.item({
1373
- color: t.menuItem.color,
1374
- disabled: y.value,
1375
- hasActions: v.value,
1376
- class: m.value?.item
1377
- }),
1378
- onClick: s[0] ||= (e) => l("select", e)
1379
- }), {
1380
- default: B(() => [o("span", { class: h(t.menuThemeSlots.itemContent({
1381
- hasIndicator: g.value,
1382
- class: m.value?.itemContent
1383
- })) }, [
1384
- g.value ? (b(), a("span", {
1385
- key: 0,
1386
- "aria-hidden": "true",
1387
- class: h(t.menuThemeSlots.indicatorWrapper({ class: m.value?.indicatorWrapper }))
1388
- }, [o("span", { class: h(t.menuThemeSlots.indicator({
1389
- type: t.menuItem.type,
1390
- checked: x.value,
1391
- class: m.value?.indicator
1392
- })) }, [x.value ? (b(), a(e, { key: 0 }, [t.menuItem.type === "radio" ? (b(), a("span", {
1393
- key: 0,
1394
- class: h(t.menuThemeSlots.radioDot({ class: m.value?.radioDot }))
1395
- }, null, 2)) : (b(), r(A(te), {
1396
- key: 1,
1397
- class: h(t.menuThemeSlots.indicatorCheckIcon({ class: m.value?.indicatorCheckIcon }))
1398
- }, null, 8, ["class"]))], 64)) : i("", !0)], 2)], 2)) : i("", !0),
1399
- t.menuItem.icon ? (b(), r(E(t.menuItem.icon), {
1400
- key: 1,
1401
- class: h(t.menuThemeSlots.itemIcon({ class: m.value?.itemIcon }))
1402
- }, null, 8, ["class"])) : i("", !0),
1403
- o("span", { class: h(t.menuThemeSlots.itemText({ class: m.value?.itemText })) }, [o("span", { class: h(t.menuThemeSlots.itemLabel({ class: m.value?.itemLabel })) }, O(t.menuItem.label), 3), t.menuItem.description ? (b(), a("span", {
1404
- key: 0,
1405
- class: h(t.menuThemeSlots.itemDescription({ class: m.value?.itemDescription }))
1406
- }, O(t.menuItem.description), 3)) : i("", !0)], 2),
1407
- T.value ? (b(), a("kbd", {
1408
- key: 2,
1409
- class: h(t.menuThemeSlots.itemShortcut({ class: m.value?.itemShortcut }))
1410
- }, O(T.value), 3)) : i("", !0),
1411
- v.value ? (b(), a("span", {
1412
- key: 3,
1413
- class: h(t.menuThemeSlots.itemActions({ class: m.value?.itemActions }))
1414
- }, [(b(!0), a(e, null, C(t.menuItem.actions, (e, t) => (b(), r(A(Z), {
1415
- key: t,
1416
- label: e.label,
1417
- "leading-icon": e.icon,
1418
- variant: "ghost",
1419
- color: "gray",
1420
- size: "xs",
1421
- square: "",
1422
- pill: !1,
1423
- tabindex: "-1",
1424
- "data-menu-item-action": "",
1425
- onClick: ee((t) => l("selectAction", e, t), ["stop"])
1426
- }, null, 8, [
1427
- "label",
1428
- "leading-icon",
1429
- "onClick"
1430
- ]))), 128))], 2)) : i("", !0),
1431
- _.value ? (b(), r(A(ne), {
1432
- key: 4,
1433
- class: h(t.menuThemeSlots.submenuIcon({ class: m.value?.submenuIcon }))
1434
- }, null, 8, ["class"])) : i("", !0)
1435
- ], 2), w.value ? (b(), a("span", {
1436
- key: 0,
1437
- class: h(t.menuThemeSlots.newTabHint({ class: m.value?.newTabHint }))
1438
- }, "(opens in a new tab)", 2)) : i("", !0)]),
1439
- _: 1
1440
- }, 16, ["class"]));
1441
- }
1442
- });
1443
- // src/components/menu/menuEntries.ts
1444
- function Ct(e) {
1445
- return "separator" in e;
1446
- }
1447
- function $(e) {
1448
- return "items" in e;
1449
- }
1450
- function wt(e) {
1451
- return "readOnly" in e;
1452
- }
1453
- function Tt(e) {
1454
- return !Ct(e) && !$(e) && !wt(e);
1455
- }
1456
- function Et(e) {
1457
- return e.flatMap((e) => $(e) ? Et(e.items) : Tt(e) ? [e, ...Et(e.submenu ?? [])] : []);
1458
- }
1459
- function Dt(e) {
1460
- let t = {};
1461
- for (let n of Et(e)) {
1462
- let e = n.onSelect;
1463
- n.shortcut && !n.disabled && e && (t[n.shortcut] = (t) => e(t));
1464
- }
1465
- return t;
1466
- }
1467
- // src/components/menu/menu.theme.ts
1468
- var Ot = "inset-ring light:inset-ring-stone-950/16 dark:inset-ring-stone-200/25 light:group-focus-within/menu-item:inset-ring-stone-950/25", kt = G({
1469
- slots: {
1470
- root: "inline-flex h-fit",
1471
- panel: "z-10 rounded-xl border border-line bg-widget p-1.5 text-left text-sm leading-5 font-normal shadow-lg outline-hidden transition duration-350 ease-[cubic-bezier(0.19,1,0.22,1)] starting:scale-95 starting:opacity-0",
1472
- separator: "-mx-1.5 my-1.5 h-px bg-line",
1473
- groupLabel: "px-2 py-1.5 text-muted",
1474
- header: "px-2 py-1.5",
1475
- headerLabel: "truncate font-medium",
1476
- headerDescription: "truncate text-muted",
1477
- item: "group/menu-item relative flex w-full rounded-md px-2 py-1.5 outline-hidden select-none before:absolute before:inset-0 before:rounded-md before:transition before:duration-150 before:ease-[cubic-bezier(0.19,1,0.22,1)] light:before:bg-stone-950/8 dark:before:bg-stone-200/10",
1478
- itemContent: "relative flex min-w-0 flex-1 items-start",
1479
- itemIcon: "my-px size-4.5 shrink-0 stroke-[1.5px]",
1480
- itemText: "min-w-0 flex-1",
1481
- itemLabel: "block truncate",
1482
- itemDescription: "block truncate text-muted",
1483
- itemShortcut: "shrink-0 pl-2 font-sans text-muted",
1484
- itemActions: "-mr-1.25 flex h-5 shrink-0 items-center gap-0.5 opacity-0 transition-opacity duration-150 group-hover/menu-item:opacity-100 group-focus-within/menu-item:opacity-100",
1485
- submenuIcon: "my-0.5 -mr-0.5 size-4 shrink-0 opacity-75 transition-opacity group-hover/menu-item:opacity-100 group-focus-within/menu-item:opacity-100 group-aria-expanded/menu-item:opacity-100",
1486
- indicatorWrapper: "flex h-5 shrink-0 items-center",
1487
- indicator: "flex size-4.5 items-center justify-center",
1488
- indicatorCheckIcon: "",
1489
- radioDot: "size-2 rounded-full transition-transform duration-400 ease-[cubic-bezier(0.19,1,0.22,1)] dark:bg-stone-950 starting:scale-0 light:bg-white",
1490
- newTabHint: "sr-only"
1491
- },
1492
- variants: {
1493
- side: {
1494
- top: "",
1495
- bottom: "",
1496
- left: "",
1497
- right: ""
1498
- },
1499
- align: {
1500
- start: "",
1501
- center: "",
1502
- end: ""
1503
- },
1504
- width: {
1505
- trigger: { panel: "w-(--floating-anchor-width)" },
1506
- auto: { panel: "w-max max-w-80" },
1507
- sm: { panel: "w-48" },
1508
- md: { panel: "w-56" },
1509
- lg: { panel: "w-64" },
1510
- xl: { panel: "w-72" }
1511
- },
1512
- indicatorPosition: {
1513
- start: "",
1514
- end: { indicatorWrapper: "order-last" }
1515
- },
1516
- indicatorVariant: {
1517
- solid: {
1518
- indicator: "rounded-full transition-shadow",
1519
- indicatorCheckIcon: "size-3.5"
1520
- },
1521
- ghost: { indicatorCheckIcon: "size-4" }
1522
- },
1523
- color: { danger: { item: "light:text-red-600 dark:text-red-400 light:before:bg-red-600/8 dark:before:bg-red-400/12" } },
1524
- type: {
1525
- checkbox: "",
1526
- radio: { indicator: "rounded-full transition-shadow" }
1527
- },
1528
- checked: {
1529
- true: "",
1530
- false: ""
1531
- },
1532
- disabled: {
1533
- true: { item: "cursor-not-allowed opacity-50 before:hidden" },
1534
- false: { item: "cursor-pointer before:scale-98 before:opacity-0 focus-within:before:scale-100 focus-within:before:opacity-100 aria-expanded:before:scale-100 aria-expanded:before:opacity-100 active:before:scale-98" }
1535
- },
1536
- hasIndicator: {
1537
- true: { itemContent: "gap-2" },
1538
- false: { itemContent: "gap-1.5" }
1539
- },
1540
- hasActions: { true: { item: "has-[button:hover]:before:opacity-40" } }
1541
- },
1542
- compoundVariants: [
1543
- {
1544
- side: "bottom",
1545
- align: "start",
1546
- class: { panel: "origin-top-left" }
1547
- },
1548
- {
1549
- side: "bottom",
1550
- align: "center",
1551
- class: { panel: "origin-top" }
1552
- },
1553
- {
1554
- side: "bottom",
1555
- align: "end",
1556
- class: { panel: "origin-top-right" }
1557
- },
1558
- {
1559
- side: "top",
1560
- align: "start",
1561
- class: { panel: "origin-bottom-left" }
1562
- },
1563
- {
1564
- side: "top",
1565
- align: "center",
1566
- class: { panel: "origin-bottom" }
1567
- },
1568
- {
1569
- side: "top",
1570
- align: "end",
1571
- class: { panel: "origin-bottom-right" }
1572
- },
1573
- {
1574
- side: "right",
1575
- align: "start",
1576
- class: { panel: "origin-top-left" }
1577
- },
1578
- {
1579
- side: "right",
1580
- align: "center",
1581
- class: { panel: "origin-left" }
1582
- },
1583
- {
1584
- side: "right",
1585
- align: "end",
1586
- class: { panel: "origin-bottom-left" }
1587
- },
1588
- {
1589
- side: "left",
1590
- align: "start",
1591
- class: { panel: "origin-top-right" }
1592
- },
1593
- {
1594
- side: "left",
1595
- align: "center",
1596
- class: { panel: "origin-right" }
1597
- },
1598
- {
1599
- side: "left",
1600
- align: "end",
1601
- class: { panel: "origin-bottom-right" }
1602
- },
1603
- {
1604
- type: "radio",
1605
- checked: !1,
1606
- class: { indicator: Ot }
1607
- },
1608
- {
1609
- type: "radio",
1610
- checked: !0,
1611
- class: { indicator: "light:bg-neutral-900 dark:bg-stone-200" }
1612
- },
1613
- {
1614
- type: "checkbox",
1615
- indicatorVariant: "solid",
1616
- checked: !1,
1617
- class: { indicator: Ot }
1618
- },
1619
- {
1620
- type: "checkbox",
1621
- indicatorVariant: "solid",
1622
- checked: !0,
1623
- class: { indicator: "light:bg-neutral-900 light:text-white dark:bg-stone-200 dark:text-stone-950" }
1624
- }
1625
- ],
1626
- defaultVariants: {
1627
- side: "bottom",
1628
- align: "start",
1629
- width: "md",
1630
- indicatorPosition: "end",
1631
- indicatorVariant: "solid",
1632
- checked: !1,
1633
- disabled: !1,
1634
- hasIndicator: !1
1635
- }
1636
- }), At = ["id", "aria-label"], jt = ["aria-label"], Mt = 150, Nt = /* @__PURE__ */ l({
1637
- __name: "MenuPanel",
1638
- props: {
1639
- panelId: {},
1640
- label: {},
1641
- entries: {},
1642
- anchorElement: {},
1643
- side: {},
1644
- align: {},
1645
- width: {},
1646
- sideOffset: {},
1647
- alignOffset: {},
1648
- focusRequest: {},
1649
- isSubmenu: { type: Boolean }
1650
- },
1651
- emits: ["requestClose", "pointerEntered"],
1652
- setup(s, { emit: c }) {
1653
- let l = s, u = c, d = xt(), f = P("menuPanel"), p = j(), m = D(), g = lt(), y, { floatingStyles: x, floatingPlacement: S, isPositioned: w } = ct(() => l.anchorElement, f, {
1654
- open: !0,
1655
- side: () => l.side,
1656
- align: () => l.align,
1657
- sideOffset: () => l.sideOffset,
1658
- alignOffset: () => l.alignOffset,
1659
- strategy: () => d.menuSettings.value.strategy,
1660
- positionModifiers: n(() => d.menuSettings.value.flip ? [ft()] : [])
1661
- }), E = n(() => kt({
1662
- side: S.value.side,
1663
- align: S.value.align,
1664
- width: l.width,
1665
- indicatorPosition: d.menuSettings.value.indicatorPosition,
1666
- indicatorVariant: d.menuSettings.value.indicatorVariant
1667
- })), k = n(() => d.menuSettings.value.ui), M = n(() => {
1668
- let e = /* @__PURE__ */ new Map();
1669
- return l.entries.forEach((t, n) => {
1670
- $(t) ? t.items.forEach((t, r) => {
1671
- t.submenu && e.set(`${n}.${r}`, t);
1672
- }) : Tt(t) && t.submenu && e.set(String(n), t);
1673
- }), e;
1674
- }), N = n(() => {
1675
- if (m.value) return f.value?.querySelector(`[data-submenu-key="${m.value.submenuKey}"]`);
1676
- });
1677
- function F() {
1678
- return Array.from(f.value?.querySelectorAll("[role^=\"menuitem\"]:not([aria-disabled=\"true\"])") ?? []);
1679
- }
1680
- function I() {
1681
- let e = document.activeElement;
1682
- return !(e instanceof HTMLElement) || !f.value?.contains(e) ? null : e.closest("[role^=\"menuitem\"]");
1683
- }
1684
- function L(e) {
1685
- let t = F();
1686
- ({
1687
- panel: f.value,
1688
- firstItem: t.at(0),
1689
- lastItem: t.at(-1)
1690
- }[e] ?? f.value)?.focus({ preventScroll: !0 });
1691
- }
1692
- function R(e) {
1693
- let t = F(), n = t.findIndex((e) => e === I());
1694
- n === -1 ? L(e === 1 ? "firstItem" : "lastItem") : t[(n + e + t.length) % t.length]?.focus();
1695
- }
1696
- function B(e, t) {
1697
- let n = M.value.get(e);
1698
- n && !n.disabled && (clearTimeout(y), (m.value?.submenuKey !== e || t) && (m.value = {
1699
- submenuKey: e,
1700
- menuItem: n,
1701
- focusRequest: t ? { focusTarget: t } : void 0
1702
- }));
1703
- }
1704
- function V({ focusParentItem: e }) {
1705
- clearTimeout(y);
1706
- let t = N.value;
1707
- m.value = void 0, e && t?.focus();
1708
- }
1709
- function ee() {
1710
- m.value && (clearTimeout(y), y = setTimeout(() => V({ focusParentItem: !1 }), Mt));
1711
- }
1712
- function te() {
1713
- clearTimeout(y);
1714
- }
1715
- function ne() {
1716
- let e = I(), t = e?.dataset.submenuKey;
1717
- if (!e) return;
1718
- if (t) {
1719
- B(t, "firstItem");
1720
- return;
1721
- }
1722
- let n = Array.from(e.querySelectorAll("[data-menu-item-action]"));
1723
- n[n.findIndex((e) => e === document.activeElement) + 1]?.focus();
1724
- }
1725
- function H() {
1726
- let e = I(), t = Array.from(e?.querySelectorAll("[data-menu-item-action]") ?? []), n = t.findIndex((e) => e === document.activeElement);
1727
- n > 0 ? t[n - 1]?.focus() : n === 0 ? e?.focus() : l.isSubmenu && u("requestClose");
1728
- }
1729
- function re(e) {
1730
- if (document.activeElement === f.value) {
1731
- e.preventDefault();
1732
- return;
1733
- }
1734
- let t = F().find((e) => e === document.activeElement);
1735
- t && (e.preventDefault(), t.dataset.submenuKey ? B(t.dataset.submenuKey, "firstItem") : t.click());
1736
- }
1737
- let U = {
1738
- handler: () => d.closeMenu({ restoreFocus: !0 }),
1739
- preventDefault: !1
1740
- }, W = {
1741
- handler: re,
1742
- preventDefault: !1
1743
- }, ie = tt({
1744
- arrowdown: () => R(1),
1745
- arrowup: () => R(-1),
1746
- home: () => L("firstItem"),
1747
- end: () => L("lastItem"),
1748
- arrowright: ne,
1749
- arrowleft: H,
1750
- escape: () => l.isSubmenu ? u("requestClose") : d.closeMenu({ restoreFocus: !0 }),
1751
- tab: U,
1752
- "shift+tab": U,
1753
- enter: W,
1754
- space: W
1755
- });
1756
- function G(e) {
1757
- let t = [...e.key].length === 1 && e.key !== " ", n = e.ctrlKey || e.metaKey || e.altKey;
1758
- if (e.defaultPrevented || !t || n) return;
1759
- let r = F(), i = r.findIndex((e) => e === I()), a = r.map((e) => e.dataset.menuItemLabel ?? "");
1760
- r[g(e.key, a, i)]?.focus();
1761
- }
1762
- function K(e) {
1763
- ie(e), G(e);
1764
- }
1765
- function ae(e) {
1766
- let t = e.target instanceof Element ? e.target.closest("[role^=\"menuitem\"]") : null, n = t !== null && t.getAttribute("aria-disabled") !== "true", r = n ? t.dataset.submenuKey : void 0;
1767
- if (r ? B(r) : ee(), t?.contains(document.activeElement)) return;
1768
- let i = n ? t : f.value;
1769
- i && document.activeElement !== i && i.focus({ preventScroll: !0 });
1770
- }
1771
- function q() {
1772
- f.value?.contains(document.activeElement) && f.value.focus({ preventScroll: !0 });
1773
- }
1774
- function J(e, t, n) {
1775
- e.submenu ? B(t, n.detail === 0 ? "firstItem" : void 0) : d.selectMenuItem(e, n);
1776
- }
1777
- function Y(e, t) {
1778
- d.selectMenuItemAction(e, t);
1779
- }
1780
- return z([w, () => l.focusRequest], ([e, t]) => {
1781
- e && t && L(t.focusTarget);
1782
- }, { flush: "post" }), v(() => clearTimeout(y)), (n, c) => {
1783
- let l = T("MenuPanel", !0);
1784
- return b(), a("div", {
1785
- id: s.panelId,
1786
- ref_key: "menuPanel",
1787
- ref: f,
1788
- role: "menu",
1789
- "aria-label": s.label,
1790
- tabindex: "-1",
1791
- style: _(A(x)),
1792
- class: h(E.value.panel({ class: k.value?.panel })),
1793
- onKeydown: K,
1794
- onPointermove: ae,
1795
- onPointerleave: q,
1796
- onPointerenter: c[1] ||= (e) => u("pointerEntered")
1797
- }, [(b(!0), a(e, null, C(s.entries, (t, n) => (b(), a(e, { key: n }, [A(Ct)(t) ? (b(), a("div", {
1798
- key: 0,
1799
- role: "separator",
1800
- class: h(E.value.separator({ class: k.value?.separator }))
1801
- }, null, 2)) : A($)(t) ? (b(), a("div", {
1802
- key: 1,
1803
- role: "group",
1804
- "aria-label": t.label
1805
- }, [o("div", {
1806
- "aria-hidden": "true",
1807
- class: h(E.value.groupLabel({ class: k.value?.groupLabel }))
1808
- }, O(t.label), 3), (b(!0), a(e, null, C(t.items, (e, t) => (b(), r(St, {
1809
- key: t,
1810
- "menu-item": e,
1811
- "menu-theme-slots": E.value,
1812
- "submenu-key": `${n}.${t}`,
1813
- "submenu-id": A(p),
1814
- "is-submenu-open": m.value?.submenuKey === `${n}.${t}`,
1815
- onSelect: (r) => J(e, `${n}.${t}`, r),
1816
- onSelectAction: Y
1817
- }, null, 8, [
1818
- "menu-item",
1819
- "menu-theme-slots",
1820
- "submenu-key",
1821
- "submenu-id",
1822
- "is-submenu-open",
1823
- "onSelect"
1824
- ]))), 128))], 8, jt)) : A(wt)(t) ? (b(), a("div", {
1825
- key: 2,
1826
- class: h(E.value.header({ class: k.value?.header }))
1827
- }, [o("div", { class: h(E.value.headerLabel({ class: k.value?.headerLabel })) }, O(t.label), 3), t.description ? (b(), a("div", {
1828
- key: 0,
1829
- class: h(E.value.headerDescription({ class: k.value?.headerDescription }))
1830
- }, O(t.description), 3)) : i("", !0)], 2)) : (b(), r(St, {
1831
- key: 3,
1832
- "menu-item": t,
1833
- "menu-theme-slots": E.value,
1834
- "submenu-key": String(n),
1835
- "submenu-id": A(p),
1836
- "is-submenu-open": m.value?.submenuKey === String(n),
1837
- onSelect: (e) => J(t, String(n), e),
1838
- onSelectAction: Y
1839
- }, null, 8, [
1840
- "menu-item",
1841
- "menu-theme-slots",
1842
- "submenu-key",
1843
- "submenu-id",
1844
- "is-submenu-open",
1845
- "onSelect"
1846
- ]))], 64))), 128)), m.value?.menuItem.submenu ? (b(), r(t, {
1847
- key: 0,
1848
- to: A(d).menuLayer.value
1849
- }, [(b(), r(l, {
1850
- key: m.value.submenuKey,
1851
- "panel-id": A(p),
1852
- label: m.value.menuItem.label,
1853
- entries: m.value.menuItem.submenu,
1854
- "anchor-element": N.value,
1855
- side: "right",
1856
- align: "start",
1857
- width: "auto",
1858
- "side-offset": 4,
1859
- "align-offset": -7,
1860
- "focus-request": m.value.focusRequest,
1861
- "is-submenu": "",
1862
- onRequestClose: c[0] ||= (e) => V({ focusParentItem: !0 }),
1863
- onPointerEntered: te
1864
- }, null, 8, [
1865
- "panel-id",
1866
- "label",
1867
- "entries",
1868
- "anchor-element",
1869
- "focus-request"
1870
- ]))], 8, ["to"])) : i("", !0)], 46, At);
1871
- };
1872
- }
1873
- }), Pt = /* @__PURE__ */ l({
1874
- __name: "Menu",
1875
- props: /*@__PURE__*/ f({
1876
- label: {},
1877
- items: {},
1878
- trigger: {},
1879
- side: { default: "bottom" },
1880
- align: { default: "start" },
1881
- width: { default: "md" },
1882
- indicatorPosition: { default: "end" },
1883
- indicatorVariant: { default: "solid" },
1884
- strategy: { default: "absolute" },
1885
- flip: {
1886
- type: Boolean,
1887
- default: !0
1888
- },
1889
- ui: {},
1890
- class: { type: [
1891
- Array,
1892
- String,
1893
- null,
1894
- Number,
1895
- Boolean
1896
- ] }
1897
- }, {
1898
- open: {
1899
- type: Boolean,
1900
- default: !1
1901
- },
1902
- openModifiers: {}
1903
- }),
1904
- emits: ["update:open"],
1905
- setup(e) {
1906
- let o = e, s = M(e, "open"), l = j(), d = P("menuRoot"), f = P("menuLayer"), m = D(), _ = Le(), v = n(() => ({
1907
- ui: o.ui,
1908
- indicatorPosition: o.indicatorPosition,
1909
- indicatorVariant: o.indicatorVariant,
1910
- strategy: o.strategy,
1911
- flip: o.flip
1912
- })), y = n(() => kt().root({ class: [o.ui?.root, o.class] }));
1913
- function S() {
1914
- return d.value?.querySelector("button, [href], [tabindex]:not([tabindex=\"-1\"])");
1915
- }
1916
- function C(e) {
1917
- m.value = { focusTarget: e }, s.value = !0;
1918
- }
1919
- function T({ restoreFocus: e }) {
1920
- s.value = !1, e && S()?.focus();
1921
- }
1922
- function E(e) {
1923
- s.value ? T({ restoreFocus: !1 }) : C(e.detail === 0 ? "firstItem" : "panel");
1924
- }
1925
- let O = tt({
1926
- arrowdown: () => C("firstItem"),
1927
- arrowup: () => C("lastItem")
1928
- });
1929
- function k(e, t) {
1930
- e.disabled ? t.preventDefault() : (e.onSelect?.(t), e.type !== "checkbox" && T({ restoreFocus: !0 }));
1931
- }
1932
- function N(e, t) {
1933
- e.onSelect?.(t), T({ restoreFocus: !0 });
1934
- }
1935
- let F = n(() => ({
1936
- open: s.value,
1937
- triggerAttributes: {
1938
- "aria-haspopup": "menu",
1939
- "aria-expanded": s.value,
1940
- "aria-controls": s.value ? l : void 0,
1941
- onClick: E,
1942
- onKeydown: O
1943
- }
1944
- }));
1945
- return x(bt, {
1946
- menuSettings: v,
1947
- menuLayer: f,
1948
- usesApplePlatform: _,
1949
- closeMenu: T,
1950
- selectMenuItem: k,
1951
- selectMenuItemAction: N
1952
- }), Re([d, f], {
1953
- active: s,
1954
- onDismiss: () => T({ restoreFocus: !1 })
1955
- }), (n, o) => (b(), a("div", {
1956
- ref_key: "menuRoot",
1957
- ref: d,
1958
- class: h(y.value)
1959
- }, [w(n.$slots, "trigger", g(u(F.value)), () => [c(A(Z), p({
1960
- ...e.trigger,
1961
- ...F.value.triggerAttributes
1962
- }, {
1963
- label: e.label,
1964
- selected: s.value,
1965
- "aria-pressed": void 0
1966
- }), null, 16, ["label", "selected"])]), (b(), r(t, { to: "body" }, [s.value ? (b(), a("div", {
1967
- key: 0,
1968
- ref_key: "menuLayer",
1969
- ref: f
1970
- }, [c(Nt, {
1971
- "panel-id": A(l),
1972
- label: e.label,
1973
- entries: e.items,
1974
- "anchor-element": d.value,
1975
- side: e.side,
1976
- align: e.align,
1977
- width: e.width,
1978
- "side-offset": 6,
1979
- "align-offset": 0,
1980
- "focus-request": m.value
1981
- }, null, 8, [
1982
- "panel-id",
1983
- "label",
1984
- "entries",
1985
- "anchor-element",
1986
- "side",
1987
- "align",
1988
- "width",
1989
- "focus-request"
1990
- ])], 512)) : i("", !0)]))], 2));
1991
- }
1992
- });
1993
- // src/shared/composables/useFieldDescription.ts
1994
- function Ft(e) {
1995
- let t = j(), r = n(() => e.id ?? t), i = n(() => `${r.value}-hint`), a = n(() => `${r.value}-error`);
1996
- return {
1997
- fieldId: r,
1998
- hintId: i,
1999
- errorMessageId: a,
2000
- isInvalid: n(() => !!(e.invalid || e.errorMessage)),
2001
- describingElementId: n(() => {
2002
- if (e.errorMessage) return a.value;
2003
- if (e.hint) return i.value;
2004
- })
2005
- };
2006
- }
2007
- // src/components/text-field/text-field.theme.ts
2008
- var It = {
2009
- md: {
2010
- height: "h-8",
2011
- fontSize: "text-sm",
2012
- labelFontSize: "text-[11px] peer-placeholder-shown:text-sm peer-focus:text-[11px]",
2013
- trailingActionFontSize: "text-sm",
2014
- iconSize: "size-3",
2015
- pillShape: {
2016
- corners: "rounded-full",
2017
- leadingPadding: "pl-4",
2018
- leadingPaddingWithIcon: "pl-9",
2019
- trailingPadding: "pr-4",
2020
- trailingPaddingWithIcon: "pr-9",
2021
- trailingPaddingWithAction: "pr-12",
2022
- labelOffset: "left-3",
2023
- labelOffsetWithLeadingIcon: "left-3 peer-placeholder-shown:left-8 peer-focus:left-3",
2024
- leadingIconOffset: "left-4",
2025
- trailingIconOffset: "right-4",
2026
- trailingActionOffset: "right-3"
2027
- },
2028
- roundedShape: {
2029
- corners: "rounded-lg",
2030
- leadingPadding: "pl-3",
2031
- leadingPaddingWithIcon: "pl-8",
2032
- trailingPadding: "pr-3",
2033
- trailingPaddingWithIcon: "pr-8",
2034
- trailingPaddingWithAction: "pr-11",
2035
- labelOffset: "left-2",
2036
- labelOffsetWithLeadingIcon: "left-2 peer-placeholder-shown:left-7 peer-focus:left-2",
2037
- leadingIconOffset: "left-3",
2038
- trailingIconOffset: "right-3",
2039
- trailingActionOffset: "right-2"
2040
- }
2041
- },
2042
- lg: {
2043
- height: "h-9",
2044
- fontSize: "text-sm",
2045
- labelFontSize: "text-[11px] peer-placeholder-shown:text-sm peer-focus:text-[11px]",
2046
- trailingActionFontSize: "text-sm",
2047
- iconSize: "size-3",
2048
- pillShape: {
2049
- corners: "rounded-full",
2050
- leadingPadding: "pl-4",
2051
- leadingPaddingWithIcon: "pl-9",
2052
- trailingPadding: "pr-4",
2053
- trailingPaddingWithIcon: "pr-9",
2054
- trailingPaddingWithAction: "pr-12",
2055
- labelOffset: "left-3",
2056
- labelOffsetWithLeadingIcon: "left-3 peer-placeholder-shown:left-8 peer-focus:left-3",
2057
- leadingIconOffset: "left-4",
2058
- trailingIconOffset: "right-4",
2059
- trailingActionOffset: "right-3"
2060
- },
2061
- roundedShape: {
2062
- corners: "rounded-lg",
2063
- leadingPadding: "pl-3",
2064
- leadingPaddingWithIcon: "pl-8",
2065
- trailingPadding: "pr-3",
2066
- trailingPaddingWithIcon: "pr-8",
2067
- trailingPaddingWithAction: "pr-11",
2068
- labelOffset: "left-2",
2069
- labelOffsetWithLeadingIcon: "left-2 peer-placeholder-shown:left-7 peer-focus:left-2",
2070
- leadingIconOffset: "left-3",
2071
- trailingIconOffset: "right-3",
2072
- trailingActionOffset: "right-2"
2073
- }
2074
- },
2075
- xl: {
2076
- height: "h-10",
2077
- fontSize: "text-base",
2078
- labelFontSize: "text-[11px] peer-placeholder-shown:text-base peer-focus:text-[11px]",
2079
- trailingActionFontSize: "text-sm",
2080
- iconSize: "size-3.5",
2081
- pillShape: {
2082
- corners: "rounded-full",
2083
- leadingPadding: "pl-4.75",
2084
- leadingPaddingWithIcon: "pl-10.25",
2085
- trailingPadding: "pr-4.75",
2086
- trailingPaddingWithIcon: "pr-10.25",
2087
- trailingPaddingWithAction: "pr-13",
2088
- labelOffset: "left-3.75",
2089
- labelOffsetWithLeadingIcon: "left-3.75 peer-placeholder-shown:left-9.25 peer-focus:left-3.75",
2090
- leadingIconOffset: "left-4.75",
2091
- trailingIconOffset: "right-4.75",
2092
- trailingActionOffset: "right-3.75"
2093
- },
2094
- roundedShape: {
2095
- corners: "rounded-[10px]",
2096
- leadingPadding: "pl-3.5",
2097
- leadingPaddingWithIcon: "pl-9",
2098
- trailingPadding: "pr-3.5",
2099
- trailingPaddingWithIcon: "pr-9",
2100
- trailingPaddingWithAction: "pr-12",
2101
- labelOffset: "left-2.5",
2102
- labelOffsetWithLeadingIcon: "left-2.5 peer-placeholder-shown:left-8 peer-focus:left-2.5",
2103
- leadingIconOffset: "left-3.5",
2104
- trailingIconOffset: "right-3.5",
2105
- trailingActionOffset: "right-2.5"
2106
- }
2107
- },
2108
- "2xl": {
2109
- height: "h-11",
2110
- fontSize: "text-base",
2111
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2112
- trailingActionFontSize: "text-sm",
2113
- iconSize: "size-4",
2114
- pillShape: {
2115
- corners: "rounded-full",
2116
- leadingPadding: "pl-5.25",
2117
- leadingPaddingWithIcon: "pl-11.25",
2118
- trailingPadding: "pr-5.25",
2119
- trailingPaddingWithIcon: "pr-11.25",
2120
- trailingPaddingWithAction: "pr-14",
2121
- labelOffset: "left-4.25",
2122
- labelOffsetWithLeadingIcon: "left-4.25 peer-placeholder-shown:left-10.25 peer-focus:left-4.25",
2123
- leadingIconOffset: "left-5.25",
2124
- trailingIconOffset: "right-5.25",
2125
- trailingActionOffset: "right-4.25"
2126
- },
2127
- roundedShape: {
2128
- corners: "rounded-xl",
2129
- leadingPadding: "pl-4",
2130
- leadingPaddingWithIcon: "pl-10",
2131
- trailingPadding: "pr-4",
2132
- trailingPaddingWithIcon: "pr-10",
2133
- trailingPaddingWithAction: "pr-12",
2134
- labelOffset: "left-3",
2135
- labelOffsetWithLeadingIcon: "left-3 peer-placeholder-shown:left-9 peer-focus:left-3",
2136
- leadingIconOffset: "left-4",
2137
- trailingIconOffset: "right-4",
2138
- trailingActionOffset: "right-3"
2139
- }
2140
- },
2141
- "3xl": {
2142
- height: "h-12",
2143
- fontSize: "text-base",
2144
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2145
- trailingActionFontSize: "text-sm",
2146
- iconSize: "size-4",
2147
- pillShape: {
2148
- corners: "rounded-full",
2149
- leadingPadding: "pl-5.25",
2150
- leadingPaddingWithIcon: "pl-11.25",
2151
- trailingPadding: "pr-5.25",
2152
- trailingPaddingWithIcon: "pr-11.25",
2153
- trailingPaddingWithAction: "pr-14",
2154
- labelOffset: "left-4.25",
2155
- labelOffsetWithLeadingIcon: "left-4.25 peer-placeholder-shown:left-10.25 peer-focus:left-4.25",
2156
- leadingIconOffset: "left-5.25",
2157
- trailingIconOffset: "right-5.25",
2158
- trailingActionOffset: "right-4.25"
2159
- },
2160
- roundedShape: {
2161
- corners: "rounded-xl",
2162
- leadingPadding: "pl-4",
2163
- leadingPaddingWithIcon: "pl-10",
2164
- trailingPadding: "pr-4",
2165
- trailingPaddingWithIcon: "pr-10",
2166
- trailingPaddingWithAction: "pr-12",
2167
- labelOffset: "left-3",
2168
- labelOffsetWithLeadingIcon: "left-3 peer-placeholder-shown:left-9 peer-focus:left-3",
2169
- leadingIconOffset: "left-4",
2170
- trailingIconOffset: "right-4",
2171
- trailingActionOffset: "right-3"
2172
- }
2173
- },
2174
- "4xl": {
2175
- height: "h-14",
2176
- fontSize: "text-base",
2177
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2178
- trailingActionFontSize: "text-sm",
2179
- iconSize: "size-4",
2180
- pillShape: {
2181
- corners: "rounded-full",
2182
- leadingPadding: "pl-6",
2183
- leadingPaddingWithIcon: "pl-12",
2184
- trailingPadding: "pr-6",
2185
- trailingPaddingWithIcon: "pr-12",
2186
- trailingPaddingWithAction: "pr-16",
2187
- labelOffset: "left-5",
2188
- labelOffsetWithLeadingIcon: "left-5 peer-placeholder-shown:left-11 peer-focus:left-5",
2189
- leadingIconOffset: "left-6",
2190
- trailingIconOffset: "right-6",
2191
- trailingActionOffset: "right-5"
2192
- },
2193
- roundedShape: {
2194
- corners: "rounded-2xl",
2195
- leadingPadding: "pl-4.5",
2196
- leadingPaddingWithIcon: "pl-10.5",
2197
- trailingPadding: "pr-4.5",
2198
- trailingPaddingWithIcon: "pr-10.5",
2199
- trailingPaddingWithAction: "pr-13",
2200
- labelOffset: "left-3.5",
2201
- labelOffsetWithLeadingIcon: "left-3.5 peer-placeholder-shown:left-9.5 peer-focus:left-3.5",
2202
- leadingIconOffset: "left-4.5",
2203
- trailingIconOffset: "right-4.5",
2204
- trailingActionOffset: "right-3.5"
2205
- }
2206
- }
2207
- }, Lt = Object.keys(It);
2208
- function Rt(e) {
2209
- return {
2210
- base: [e.height, e.fontSize],
2211
- label: e.labelFontSize,
2212
- leadingIcon: e.iconSize,
2213
- trailingIcon: e.iconSize,
2214
- trailingAction: e.trailingActionFontSize
2215
- };
2216
- }
2217
- function zt(e) {
2218
- let t = It[e];
2219
- return [!0, !1].flatMap((n) => {
2220
- let r = n ? t.pillShape : t.roundedShape;
2221
- return [
2222
- {
2223
- size: e,
2224
- pill: n,
2225
- class: {
2226
- base: r.corners,
2227
- leadingIcon: r.leadingIconOffset,
2228
- trailingIconButton: r.trailingIconOffset,
2229
- trailingAction: r.trailingActionOffset
2230
- }
2231
- },
2232
- {
2233
- size: e,
2234
- pill: n,
2235
- hasLeadingIcon: !1,
2236
- class: {
2237
- base: r.leadingPadding,
2238
- label: r.labelOffset
2239
- }
2240
- },
2241
- {
2242
- size: e,
2243
- pill: n,
2244
- hasLeadingIcon: !0,
2245
- class: {
2246
- base: r.leadingPaddingWithIcon,
2247
- label: r.labelOffsetWithLeadingIcon
2248
- }
2249
- },
2250
- {
2251
- size: e,
2252
- pill: n,
2253
- trailingContent: "none",
2254
- class: { base: r.trailingPadding }
2255
- },
2256
- {
2257
- size: e,
2258
- pill: n,
2259
- trailingContent: ["icon", "iconButton"],
2260
- class: { base: r.trailingPaddingWithIcon }
2261
- },
2262
- {
2263
- size: e,
2264
- pill: n,
2265
- trailingContent: "icon",
2266
- class: { trailingIcon: r.trailingIconOffset }
2267
- },
2268
- {
2269
- size: e,
2270
- pill: n,
2271
- trailingContent: "action",
2272
- class: { base: r.trailingPaddingWithAction }
2273
- }
2274
- ];
2275
- });
2276
- }
2277
- var Bt = Object.fromEntries(Lt.map((e) => [e, Rt(It[e])])), Vt = Lt.flatMap(zt), Ht = G({
2278
- slots: {
2279
- root: "",
2280
- container: "relative",
2281
- base: "peer w-full border bg-field outline-hidden transition-colors",
2282
- label: "pointer-events-none absolute top-0 -translate-y-1/2 bg-linear-to-b from-canvas from-50% to-field to-50% px-1 transition-colors peer-placeholder-shown:top-1/2 peer-placeholder-shown:transition-all peer-focus:transition-all peer-placeholder-shown:bg-none peer-focus:top-0 peer-focus:bg-linear-to-b",
2283
- leadingIcon: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted",
2284
- trailingIcon: "",
2285
- trailingIconButton: "absolute top-1/2 flex -translate-y-1/2 cursor-pointer rounded-full text-muted outline-primary transition-colors hover:text-inherit focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed",
2286
- trailingAction: "absolute top-1/2 -translate-y-1/2 cursor-pointer font-medium text-primary disabled:cursor-not-allowed aria-disabled:cursor-not-allowed",
2287
- hint: "mt-2 text-xs text-muted",
2288
- errorMessage: "mt-2 flex items-start gap-x-1.5 text-xs light:text-red-600 dark:text-red-400",
2289
- errorIcon: "mt-px size-3.5 shrink-0"
2290
- },
2291
- variants: {
2292
- variant: {
2293
- outline: "",
2294
- soft: ""
2295
- },
2296
- size: Bt,
2297
- pill: { true: "" },
2298
- hasLeadingIcon: { true: "" },
2299
- trailingContent: {
2300
- none: "",
2301
- icon: { trailingIcon: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted" },
2302
- iconButton: "",
2303
- action: ""
2304
- },
2305
- invalid: { true: {
2306
- base: "light:border-red-600 dark:border-red-500 light:selection:bg-red-500/16 dark:selection:bg-red-400/16",
2307
- label: "light:text-red-600 dark:text-red-400"
2308
- } },
2309
- disabled: { true: { container: "opacity-50" } }
2310
- },
2311
- compoundVariants: [
2312
- ...Vt,
2313
- {
2314
- invalid: !1,
2315
- disabled: !1,
2316
- variant: "outline",
2317
- class: {
2318
- base: "border-line light:not-focus:hover:border-stone-950/20 dark:not-focus:hover:border-white/20 focus:border-primary",
2319
- label: "text-muted peer-focus:text-primary"
2320
- }
2321
- },
2322
- {
2323
- invalid: !1,
2324
- disabled: !1,
2325
- variant: "soft",
2326
- class: {
2327
- base: "border-transparent focus:border-primary",
2328
- label: "text-muted peer-focus:text-primary"
2329
- }
2330
- },
2331
- {
2332
- invalid: !1,
2333
- disabled: !0,
2334
- variant: "outline",
2335
- class: {
2336
- base: "cursor-not-allowed border-line",
2337
- label: "text-muted"
2338
- }
2339
- },
2340
- {
2341
- invalid: !1,
2342
- disabled: !0,
2343
- variant: "soft",
2344
- class: {
2345
- base: "cursor-not-allowed border-transparent",
2346
- label: "text-muted"
2347
- }
2348
- }
2349
- ]
2350
- }), Ut = [
2351
- "id",
2352
- "type",
2353
- "disabled",
2354
- "aria-describedby",
2355
- "aria-invalid"
2356
- ], Wt = ["for"], Gt = ["aria-label", "disabled"], Kt = ["id"], qt = ["id"], Jt = /* @__PURE__ */ l({
2357
- inheritAttrs: !1,
2358
- __name: "TextField",
2359
- props: /*@__PURE__*/ f({
2360
- label: {},
2361
- id: {},
2362
- type: { default: "text" },
2363
- variant: { default: "outline" },
2364
- size: { default: "4xl" },
2365
- pill: {
2366
- type: Boolean,
2367
- default: !0
2368
- },
2369
- leadingIcon: {},
2370
- trailingIcon: {},
2371
- trailingIconLabel: {},
2372
- trailingActionLabel: {},
2373
- trailingActionHref: {},
2374
- hint: {},
2375
- errorMessage: {},
2376
- invalid: { type: Boolean },
2377
- disabled: { type: Boolean },
2378
- ui: {},
2379
- class: { type: [
2380
- Array,
2381
- String,
2382
- null,
2383
- Number,
2384
- Boolean
2385
- ] }
2386
- }, {
2387
- modelValue: {},
2388
- modelModifiers: {}
2389
- }),
2390
- emits: /*@__PURE__*/ f(["trailingIconClick", "trailingActionClick"], ["update:modelValue"]),
2391
- setup(e, { emit: t }) {
2392
- let l = e, u = t, d = M(e, "modelValue"), { fieldId: f, hintId: m, errorMessageId: g, isInvalid: _, describingElementId: v } = Ft(l), y = n(() => l.trailingActionLabel ? "action" : l.trailingIcon ? l.trailingIconLabel ? "iconButton" : "icon" : "none"), x = n(() => Ht({
2393
- variant: l.variant,
2394
- size: l.size,
2395
- pill: l.pill,
2396
- hasLeadingIcon: !!l.leadingIcon,
2397
- trailingContent: y.value,
2398
- invalid: _.value,
2399
- disabled: l.disabled
2400
- })), S = n(() => l.trailingActionHref ? "a" : "button"), C = n(() => l.trailingActionHref ? l.disabled ? {
2401
- role: "link",
2402
- "aria-disabled": "true"
2403
- } : { href: l.trailingActionHref } : {
2404
- type: "button",
2405
- disabled: l.disabled
2406
- });
2407
- function w(e) {
2408
- l.disabled || u("trailingActionClick", e);
2409
- }
2410
- return (t, n) => (b(), a("div", { class: h(x.value.root({ class: [e.ui?.root, l.class] })) }, [o("div", { class: h(x.value.container({ class: e.ui?.container })) }, [
2411
- V(o("input", p(t.$attrs, {
2412
- id: A(f),
2413
- "onUpdate:modelValue": n[0] ||= (e) => d.value = e,
2414
- type: e.type,
2415
- disabled: e.disabled,
2416
- "aria-describedby": A(v),
2417
- "aria-invalid": A(_) || void 0,
2418
- placeholder: " ",
2419
- class: x.value.base({ class: e.ui?.base })
2420
- }), null, 16, Ut), [[I, d.value]]),
2421
- o("label", {
2422
- for: A(f),
2423
- class: h(x.value.label({ class: e.ui?.label }))
2424
- }, O(e.label), 11, Wt),
2425
- e.leadingIcon ? (b(), r(E(e.leadingIcon), {
2426
- key: 0,
2427
- class: h(x.value.leadingIcon({ class: e.ui?.leadingIcon }))
2428
- }, null, 8, ["class"])) : i("", !0),
2429
- y.value === "action" ? (b(), r(E(S.value), p({ key: 1 }, C.value, {
2430
- class: x.value.trailingAction({ class: e.ui?.trailingAction }),
2431
- onClick: w
2432
- }), {
2433
- default: B(() => [s(O(e.trailingActionLabel), 1)]),
2434
- _: 1
2435
- }, 16, ["class"])) : y.value === "iconButton" ? (b(), a("button", {
2436
- key: 2,
2437
- type: "button",
2438
- "aria-label": e.trailingIconLabel,
2439
- disabled: e.disabled,
2440
- class: h(x.value.trailingIconButton({ class: e.ui?.trailingIconButton })),
2441
- onClick: n[1] ||= (e) => u("trailingIconClick", e)
2442
- }, [(b(), r(E(e.trailingIcon), { class: h(x.value.trailingIcon({ class: e.ui?.trailingIcon })) }, null, 8, ["class"]))], 10, Gt)) : y.value === "icon" ? (b(), r(E(e.trailingIcon), {
2443
- key: 3,
2444
- class: h(x.value.trailingIcon({ class: e.ui?.trailingIcon }))
2445
- }, null, 8, ["class"])) : i("", !0)
2446
- ], 2), e.errorMessage ? (b(), a("p", {
2447
- key: 0,
2448
- id: A(g),
2449
- class: h(x.value.errorMessage({ class: e.ui?.errorMessage }))
2450
- }, [c(A(H), { class: h(x.value.errorIcon({ class: e.ui?.errorIcon })) }, null, 8, ["class"]), s(" " + O(e.errorMessage), 1)], 10, Kt)) : e.hint ? (b(), a("p", {
2451
- key: 1,
2452
- id: A(m),
2453
- class: h(x.value.hint({ class: e.ui?.hint }))
2454
- }, O(e.hint), 11, qt)) : i("", !0)], 2));
2455
- }
2456
- }), Yt = {
2457
- md: {
2458
- fontSize: "text-sm",
2459
- verticalPadding: "py-1.25",
2460
- labelFontSize: "text-[11px] peer-placeholder-shown:text-sm peer-focus:text-[11px]",
2461
- labelRestingTop: "peer-placeholder-shown:top-4",
2462
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+12px)] max-h-[calc(var(--textarea-max-rows)*1lh+12px)]",
2463
- pillShape: {
2464
- corners: "rounded-2xl",
2465
- horizontalPadding: "px-4",
2466
- labelOffset: "left-3"
2467
- },
2468
- roundedShape: {
2469
- corners: "rounded-lg",
2470
- horizontalPadding: "px-3",
2471
- labelOffset: "left-2"
2472
- }
2473
- },
2474
- lg: {
2475
- fontSize: "text-sm",
2476
- verticalPadding: "py-1.75",
2477
- labelFontSize: "text-[11px] peer-placeholder-shown:text-sm peer-focus:text-[11px]",
2478
- labelRestingTop: "peer-placeholder-shown:top-4.5",
2479
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+16px)] max-h-[calc(var(--textarea-max-rows)*1lh+16px)]",
2480
- pillShape: {
2481
- corners: "rounded-[18px]",
2482
- horizontalPadding: "px-4",
2483
- labelOffset: "left-3"
2484
- },
2485
- roundedShape: {
2486
- corners: "rounded-lg",
2487
- horizontalPadding: "px-3",
2488
- labelOffset: "left-2"
2489
- }
2490
- },
2491
- xl: {
2492
- fontSize: "text-base",
2493
- verticalPadding: "py-1.75",
2494
- labelFontSize: "text-[11px] peer-placeholder-shown:text-base peer-focus:text-[11px]",
2495
- labelRestingTop: "peer-placeholder-shown:top-5",
2496
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+16px)] max-h-[calc(var(--textarea-max-rows)*1lh+16px)]",
2497
- pillShape: {
2498
- corners: "rounded-[20px]",
2499
- horizontalPadding: "px-4.75",
2500
- labelOffset: "left-3.75"
2501
- },
2502
- roundedShape: {
2503
- corners: "rounded-[10px]",
2504
- horizontalPadding: "px-3.5",
2505
- labelOffset: "left-2.5"
2506
- }
2507
- },
2508
- "2xl": {
2509
- fontSize: "text-base",
2510
- verticalPadding: "py-2.25",
2511
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2512
- labelRestingTop: "peer-placeholder-shown:top-5.5",
2513
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+20px)] max-h-[calc(var(--textarea-max-rows)*1lh+20px)]",
2514
- pillShape: {
2515
- corners: "rounded-[22px]",
2516
- horizontalPadding: "px-5.25",
2517
- labelOffset: "left-4.25"
2518
- },
2519
- roundedShape: {
2520
- corners: "rounded-xl",
2521
- horizontalPadding: "px-4",
2522
- labelOffset: "left-3"
2523
- }
2524
- },
2525
- "3xl": {
2526
- fontSize: "text-base",
2527
- verticalPadding: "py-2.75",
2528
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2529
- labelRestingTop: "peer-placeholder-shown:top-6",
2530
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+24px)] max-h-[calc(var(--textarea-max-rows)*1lh+24px)]",
2531
- pillShape: {
2532
- corners: "rounded-3xl",
2533
- horizontalPadding: "px-5.25",
2534
- labelOffset: "left-4.25"
2535
- },
2536
- roundedShape: {
2537
- corners: "rounded-xl",
2538
- horizontalPadding: "px-4",
2539
- labelOffset: "left-3"
2540
- }
2541
- },
2542
- "4xl": {
2543
- fontSize: "text-base",
2544
- verticalPadding: "py-3.75",
2545
- labelFontSize: "text-xs peer-placeholder-shown:text-base peer-focus:text-xs",
2546
- labelRestingTop: "peer-placeholder-shown:top-7",
2547
- autoResizeHeights: "min-h-[calc(var(--textarea-min-rows)*1lh+32px)] max-h-[calc(var(--textarea-max-rows)*1lh+32px)]",
2548
- pillShape: {
2549
- corners: "rounded-[28px]",
2550
- horizontalPadding: "px-6",
2551
- labelOffset: "left-5"
2552
- },
2553
- roundedShape: {
2554
- corners: "rounded-2xl",
2555
- horizontalPadding: "px-4.5",
2556
- labelOffset: "left-3.5"
2557
- }
2558
- }
2559
- }, Xt = Object.keys(Yt);
2560
- function Zt(e) {
2561
- return {
2562
- base: [e.fontSize, e.verticalPadding],
2563
- label: [e.labelFontSize, e.labelRestingTop]
2564
- };
2565
- }
2566
- function Qt(e) {
2567
- let t = Yt[e];
2568
- return [
2569
- {
2570
- size: e,
2571
- pill: !0,
2572
- class: {
2573
- base: [t.pillShape.corners, t.pillShape.horizontalPadding],
2574
- label: t.pillShape.labelOffset
2575
- }
2576
- },
2577
- {
2578
- size: e,
2579
- pill: !1,
2580
- class: {
2581
- base: [t.roundedShape.corners, t.roundedShape.horizontalPadding],
2582
- label: t.roundedShape.labelOffset
2583
- }
2584
- },
2585
- {
2586
- size: e,
2587
- autoResize: !0,
2588
- class: { base: t.autoResizeHeights }
2589
- }
2590
- ];
2591
- }
2592
- var $t = Object.fromEntries(Xt.map((e) => [e, Zt(Yt[e])])), en = Xt.flatMap(Qt), tn = G({
2593
- slots: {
2594
- root: "",
2595
- container: "relative",
2596
- base: "peer block w-full resize-none border bg-field outline-hidden transition-colors",
2597
- label: "pointer-events-none absolute top-0 -translate-y-1/2 bg-linear-to-b from-canvas from-50% to-field to-50% px-1 transition-colors peer-placeholder-shown:bg-none peer-placeholder-shown:transition-all peer-focus:top-0 peer-focus:bg-linear-to-b peer-focus:transition-all",
2598
- footer: "mt-2 flex items-start gap-x-4 text-xs",
2599
- hint: "text-muted",
2600
- errorMessage: "flex items-start gap-x-1.5 light:text-red-600 dark:text-red-400",
2601
- errorIcon: "mt-px size-3.5 shrink-0",
2602
- characterCount: "ml-auto shrink-0 text-muted tabular-nums"
2603
- },
2604
- variants: {
2605
- variant: {
2606
- outline: "",
2607
- soft: ""
2608
- },
2609
- size: $t,
2610
- pill: { true: "" },
2611
- autoResize: { true: { base: "field-sizing-content" } },
2612
- invalid: { true: {
2613
- base: "light:border-red-600 dark:border-red-500 light:selection:bg-red-500/16 dark:selection:bg-red-400/16",
2614
- label: "light:text-red-600 dark:text-red-400"
2615
- } },
2616
- disabled: { true: { container: "opacity-50" } }
2617
- },
2618
- compoundVariants: [
2619
- ...en,
2620
- {
2621
- invalid: !1,
2622
- disabled: !1,
2623
- variant: "outline",
2624
- class: {
2625
- base: "border-line light:not-focus:hover:border-stone-950/20 dark:not-focus:hover:border-white/20 focus:border-primary",
2626
- label: "text-muted peer-focus:text-primary"
2627
- }
2628
- },
2629
- {
2630
- invalid: !1,
2631
- disabled: !1,
2632
- variant: "soft",
2633
- class: {
2634
- base: "border-transparent focus:border-primary",
2635
- label: "text-muted peer-focus:text-primary"
2636
- }
2637
- },
2638
- {
2639
- invalid: !1,
2640
- disabled: !0,
2641
- variant: "outline",
2642
- class: {
2643
- base: "cursor-not-allowed border-line",
2644
- label: "text-muted"
2645
- }
2646
- },
2647
- {
2648
- invalid: !1,
2649
- disabled: !0,
2650
- variant: "soft",
2651
- class: {
2652
- base: "cursor-not-allowed border-transparent",
2653
- label: "text-muted"
2654
- }
2655
- }
2656
- ]
2657
- }), nn = [
2658
- "id",
2659
- "rows",
2660
- "maxlength",
2661
- "disabled",
2662
- "aria-describedby",
2663
- "aria-invalid"
2664
- ], rn = ["for"], an = ["id"], on = ["id"], sn = /* @__PURE__ */ l({
2665
- inheritAttrs: !1,
2666
- __name: "Textarea",
2667
- props: /*@__PURE__*/ f({
2668
- label: {},
2669
- id: {},
2670
- rows: { default: 3 },
2671
- autoResize: { type: Boolean },
2672
- maxRows: { default: 10 },
2673
- maxlength: {},
2674
- variant: { default: "outline" },
2675
- size: { default: "4xl" },
2676
- pill: {
2677
- type: Boolean,
2678
- default: !0
2679
- },
2680
- hint: {},
2681
- errorMessage: {},
2682
- invalid: { type: Boolean },
2683
- disabled: { type: Boolean },
2684
- ui: {},
2685
- class: { type: [
2686
- Array,
2687
- String,
2688
- null,
2689
- Number,
2690
- Boolean
2691
- ] }
2692
- }, {
2693
- modelValue: {},
2694
- modelModifiers: {}
2695
- }),
2696
- emits: ["update:modelValue"],
2697
- setup(e) {
2698
- let t = e, r = M(e, "modelValue"), { fieldId: l, hintId: u, errorMessageId: d, isInvalid: f, describingElementId: m } = Ft(t), g = n(() => tn({
2699
- variant: t.variant,
2700
- size: t.size,
2701
- pill: t.pill,
2702
- autoResize: t.autoResize,
2703
- invalid: f.value,
2704
- disabled: t.disabled
2705
- })), _ = n(() => t.autoResize ? {
2706
- "--textarea-min-rows": t.rows,
2707
- "--textarea-max-rows": t.maxRows
2708
- } : void 0), v = n(() => r.value?.length ?? 0), y = n(() => !!(t.errorMessage || t.hint || t.maxlength));
2709
- return (n, x) => (b(), a("div", { class: h(g.value.root({ class: [e.ui?.root, t.class] })) }, [o("div", { class: h(g.value.container({ class: e.ui?.container })) }, [V(o("textarea", p(n.$attrs, {
2710
- id: A(l),
2711
- "onUpdate:modelValue": x[0] ||= (e) => r.value = e,
2712
- rows: e.rows,
2713
- maxlength: e.maxlength,
2714
- disabled: e.disabled,
2715
- "aria-describedby": A(m),
2716
- "aria-invalid": A(f) || void 0,
2717
- style: _.value,
2718
- placeholder: " ",
2719
- class: g.value.base({ class: e.ui?.base })
2720
- }), null, 16, nn), [[R, r.value]]), o("label", {
2721
- for: A(l),
2722
- class: h(g.value.label({ class: e.ui?.label }))
2723
- }, O(e.label), 11, rn)], 2), y.value ? (b(), a("div", {
2724
- key: 0,
2725
- class: h(g.value.footer({ class: e.ui?.footer }))
2726
- }, [e.errorMessage ? (b(), a("p", {
2727
- key: 0,
2728
- id: A(d),
2729
- class: h(g.value.errorMessage({ class: e.ui?.errorMessage }))
2730
- }, [c(A(H), { class: h(g.value.errorIcon({ class: e.ui?.errorIcon })) }, null, 8, ["class"]), s(" " + O(e.errorMessage), 1)], 10, an)) : e.hint ? (b(), a("p", {
2731
- key: 1,
2732
- id: A(u),
2733
- class: h(g.value.hint({ class: e.ui?.hint }))
2734
- }, O(e.hint), 11, on)) : i("", !0), e.maxlength ? (b(), a("p", {
2735
- key: 2,
2736
- class: h(g.value.characterCount({ class: e.ui?.characterCount }))
2737
- }, O(v.value) + "/" + O(e.maxlength), 3)) : i("", !0)], 2)) : i("", !0)], 2));
2738
- }
2739
- }), cn = {
2740
- sm: {
2741
- height: "h-5",
2742
- fontSize: "text-xs/none tracking-wide",
2743
- gutter: "px-1.25",
2744
- pillGutter: "px-1.75",
2745
- radius: "rounded-sm",
2746
- iconSize: "size-3",
2747
- dotSize: "size-1.5"
2748
- },
2749
- md: {
2750
- height: "h-5.5",
2751
- fontSize: "text-sm/none",
2752
- gutter: "px-1.5",
2753
- pillGutter: "px-2",
2754
- radius: "rounded-sm",
2755
- iconSize: "size-4",
2756
- dotSize: "size-1.5"
2757
- },
2758
- lg: {
2759
- height: "h-6",
2760
- fontSize: "text-sm/none",
2761
- gutter: "px-2",
2762
- pillGutter: "px-2.75",
2763
- radius: "rounded-md",
2764
- iconSize: "size-4",
2765
- dotSize: "size-2"
2766
- }
2767
- }, ln = Object.keys(cn), un = {
2768
- soft: {
2769
- secondary: "bg-secondary/16 text-secondary",
2770
- gray: "light:bg-stone-950/8 dark:bg-stone-200/12",
2771
- success: "light:bg-green-500/16 light:text-green-700 dark:bg-green-400/16 dark:text-green-400",
2772
- warning: "light:bg-orange-500/16 light:text-orange-700 dark:bg-orange-400/16 dark:text-orange-400",
2773
- danger: "light:bg-red-500/16 light:text-red-600 dark:bg-red-400/16 dark:text-red-400",
2774
- info: "light:bg-blue-500/16 light:text-blue-600 dark:bg-blue-400/16 dark:text-blue-300",
2775
- discovery: "light:bg-purple-500/16 light:text-purple-600 dark:bg-purple-400/16 dark:text-purple-300"
2776
- },
2777
- solid: {
2778
- secondary: "bg-secondary light:text-white dark:text-stone-950",
2779
- gray: "light:bg-stone-600 light:text-white dark:bg-stone-600 dark:text-white",
2780
- success: "light:bg-green-600 light:text-white dark:bg-green-600 dark:text-white",
2781
- warning: "light:bg-orange-600 light:text-white dark:bg-orange-600 dark:text-white",
2782
- danger: "light:bg-red-600 light:text-white dark:bg-red-600 dark:text-white",
2783
- info: "light:bg-blue-600 light:text-white dark:bg-blue-500 dark:text-white",
2784
- discovery: "light:bg-purple-600 light:text-white dark:bg-purple-500 dark:text-white"
2785
- },
2786
- outline: {
2787
- secondary: "inset-ring inset-ring-secondary text-secondary",
2788
- gray: "inset-ring text-muted light:inset-ring-stone-950/16 dark:inset-ring-stone-200/25",
2789
- success: "inset-ring light:inset-ring-green-600 light:text-green-700 dark:inset-ring-green-500 dark:text-green-400",
2790
- warning: "inset-ring light:inset-ring-orange-600 light:text-orange-700 dark:inset-ring-orange-500 dark:text-orange-400",
2791
- danger: "inset-ring light:inset-ring-red-600 light:text-red-600 dark:inset-ring-red-500 dark:text-red-400",
2792
- info: "inset-ring light:inset-ring-blue-600 light:text-blue-600 dark:inset-ring-blue-400 dark:text-blue-300",
2793
- discovery: "inset-ring light:inset-ring-purple-600 light:text-purple-600 dark:inset-ring-purple-400 dark:text-purple-300"
2794
- }
2795
- }, dn = Object.keys(un), fn = Object.keys(un.soft);
2796
- function pn(e) {
2797
- return {
2798
- base: [e.height, e.fontSize],
2799
- dot: e.dotSize,
2800
- leadingIcon: e.iconSize,
2801
- trailingIcon: e.iconSize
2802
- };
2803
- }
2804
- function mn(e) {
2805
- let t = cn[e];
2806
- return [{
2807
- size: e,
2808
- pill: !0,
2809
- class: { base: ["rounded-full", t.pillGutter] }
2810
- }, {
2811
- size: e,
2812
- pill: !1,
2813
- class: { base: [t.radius, t.gutter] }
2814
- }];
2815
- }
2816
- var hn = Object.fromEntries(ln.map((e) => [e, pn(cn[e])])), gn = ln.flatMap(mn), _n = dn.flatMap((e) => fn.map((t) => ({
2817
- variant: e,
2818
- color: t,
2819
- class: { base: un[e][t] }
2820
- }))), vn = G({
2821
- slots: {
2822
- base: "inline-flex shrink-0 items-center gap-1 font-semibold whitespace-nowrap",
2823
- dot: "shrink-0 rounded-full bg-current",
2824
- leadingIcon: "-ml-px shrink-0",
2825
- trailingIcon: "-mr-px shrink-0"
2826
- },
2827
- variants: {
2828
- variant: {
2829
- soft: "",
2830
- solid: "",
2831
- outline: ""
2832
- },
2833
- color: {
2834
- secondary: "",
2835
- gray: "",
2836
- success: "",
2837
- warning: "",
2838
- danger: "",
2839
- info: "",
2840
- discovery: ""
2841
- },
2842
- size: hn,
2843
- pill: { true: "" }
2844
- },
2845
- compoundVariants: [...gn, ..._n]
2846
- }), yn = /* @__PURE__ */ l({
2847
- __name: "Badge",
2848
- props: {
2849
- label: {},
2850
- variant: { default: "soft" },
2851
- color: { default: "gray" },
2852
- size: { default: "sm" },
2853
- leadingIcon: {},
2854
- trailingIcon: {},
2855
- dot: { type: Boolean },
2856
- pill: { type: Boolean },
2857
- ui: {},
2858
- class: { type: [
2859
- Array,
2860
- String,
2861
- null,
2862
- Number,
2863
- Boolean
2864
- ] }
2865
- },
2866
- setup(e) {
2867
- let t = e, o = n(() => vn({
2868
- variant: t.variant,
2869
- color: t.color,
2870
- size: t.size,
2871
- pill: t.pill
2872
- }));
2873
- return (n, c) => (b(), a("span", { class: h(o.value.base({ class: [e.ui?.base, t.class] })) }, [
2874
- e.dot ? (b(), a("span", {
2875
- key: 0,
2876
- "aria-hidden": "true",
2877
- class: h(o.value.dot({ class: e.ui?.dot }))
2878
- }, null, 2)) : i("", !0),
2879
- e.leadingIcon ? (b(), r(E(e.leadingIcon), {
2880
- key: 1,
2881
- class: h(o.value.leadingIcon({ class: e.ui?.leadingIcon }))
2882
- }, null, 8, ["class"])) : i("", !0),
2883
- w(n.$slots, "default", {}, () => [s(O(e.label), 1)]),
2884
- e.trailingIcon ? (b(), r(E(e.trailingIcon), {
2885
- key: 2,
2886
- class: h(o.value.trailingIcon({ class: e.ui?.trailingIcon }))
2887
- }, null, 8, ["class"])) : i("", !0)
2888
- ], 2));
2889
- }
2890
- });
2891
- // src/shared/composables/useCustomColor.ts
2892
- function bn(e, t) {
2893
- let r = n(() => k(e) in t);
2894
- return {
2895
- themeColor: n(() => r.value ? k(e) : "primary"),
2896
- customColorVariable: n(() => r.value ? void 0 : { "--color-primary": k(e) })
2897
- };
2898
- }
2899
- // src/elements/checkbox/checkbox.theme.ts
2900
- var xn = G({
2901
- slots: {
2902
- root: "flex cursor-pointer items-start gap-x-2 text-sm leading-5",
2903
- base: "relative top-px size-4.5 shrink-0 rounded-sm border outline-primary transition-colors has-focus-visible:outline-2 has-focus-visible:outline-offset-2 light:border-stone-300 light:not-has-checked:hover:border-stone-400 dark:border-stone-600 dark:not-has-checked:hover:border-stone-500",
2904
- checkMark: "checkbox-check-mark hidden peer-checked:block light:text-white dark:text-stone-950"
2905
- },
2906
- variants: {
2907
- color: {
2908
- primary: { base: "has-checked:border-primary has-checked:bg-primary" },
2909
- secondary: { base: "has-checked:border-secondary has-checked:bg-secondary" },
2910
- neutral: { base: "light:has-checked:border-neutral-900 light:has-checked:bg-neutral-900 dark:has-checked:border-stone-200 dark:has-checked:bg-stone-200" }
2911
- },
2912
- labelPosition: {
2913
- start: { root: "flex-row-reverse justify-end" },
2914
- end: ""
2915
- }
2916
- }
2917
- }), Sn = ["checked"], Cn = /* @__PURE__ */ l({
2918
- inheritAttrs: !1,
2919
- __name: "Checkbox",
2920
- props: /*@__PURE__*/ f({
2921
- label: {},
2922
- color: { default: "neutral" },
2923
- labelPosition: { default: "end" },
2924
- ui: {},
2925
- class: { type: [
2926
- Array,
2927
- String,
2928
- null,
2929
- Number,
2930
- Boolean
2931
- ] }
2932
- }, {
2933
- modelValue: {
2934
- type: Boolean,
2935
- default: !1
2936
- },
2937
- modelModifiers: {}
2938
- }),
2939
- emits: ["update:modelValue"],
2940
- setup(e) {
2941
- let t = e, r = M(e, "modelValue"), { themeColor: i, customColorVariable: c } = bn(() => t.color, xn.variants.color), l = n(() => xn({
2942
- color: i.value,
2943
- labelPosition: t.labelPosition
2944
- }));
2945
- return (n, i) => (b(), a("label", {
2946
- class: h(l.value.root({ class: [e.ui?.root, t.class] })),
2947
- style: _(A(c))
2948
- }, [o("span", { class: h(l.value.base({ class: e.ui?.base })) }, [V(o("input", p(n.$attrs, {
2949
- "onUpdate:modelValue": i[0] ||= (e) => r.value = e,
2950
- checked: r.value,
2951
- type: "checkbox",
2952
- class: "peer sr-only"
2953
- }), null, 16, Sn), [[F, r.value]]), o("span", {
2954
- "aria-hidden": "true",
2955
- class: h(l.value.checkMark({ class: e.ui?.checkMark }))
2956
- }, null, 2)], 2), s(" " + O(e.label), 1)], 6));
2957
- }
2958
- }), wn = G({ slots: {
2959
- base: "size-7 -rotate-90 fill-none stroke-2",
2960
- track: "stroke-primary/15",
2961
- indicator: "stroke-primary transition-[stroke-dashoffset] duration-300"
2962
- } }), Tn = ["aria-label", "aria-valuenow"], En = ["stroke-dashoffset"], Dn = /* @__PURE__ */ l({
2963
- __name: "CircularProgress",
2964
- props: {
2965
- progress: {},
2966
- label: { default: "Progress" },
2967
- ui: {},
2968
- class: { type: [
2969
- Array,
2970
- String,
2971
- null,
2972
- Number,
2973
- Boolean
2974
- ] }
2975
- },
2976
- setup(e) {
2977
- let t = e, r = wn(), i = n(() => Math.min(Math.max(t.progress, 0), 100)), s = n(() => 50 - 50 * i.value / 100);
2978
- return (n, c) => (b(), a("svg", {
2979
- viewBox: "0 0 20 20",
2980
- role: "progressbar",
2981
- "aria-label": e.label,
2982
- "aria-valuemin": "0",
2983
- "aria-valuemax": "100",
2984
- "aria-valuenow": i.value,
2985
- class: h(A(r).base({ class: [e.ui?.base, t.class] }))
2986
- }, [o("circle", {
2987
- cx: "10",
2988
- cy: "10",
2989
- r: "8",
2990
- class: h(A(r).track({ class: e.ui?.track }))
2991
- }, null, 2), o("circle", {
2992
- cx: "10",
2993
- cy: "10",
2994
- r: "8",
2995
- "stroke-dasharray": 50,
2996
- "stroke-dashoffset": s.value,
2997
- "stroke-linecap": "round",
2998
- class: h(A(r).indicator({ class: e.ui?.indicator }))
2999
- }, null, 10, En)], 10, Tn));
3000
- }
3001
- }), On = G({ slots: { base: "flex loading-dots h-lh items-center gap-1" } }), kn = ["aria-label"], An = /* @__PURE__ */ l({
3002
- __name: "LoadingDots",
3003
- props: {
3004
- label: { default: "Loading" },
3005
- ui: {},
3006
- class: { type: [
3007
- Array,
3008
- String,
3009
- null,
3010
- Number,
3011
- Boolean
3012
- ] }
3013
- },
3014
- setup(t) {
3015
- let n = t, r = On();
3016
- return (i, s) => (b(), a("div", {
3017
- role: "status",
3018
- "aria-label": t.label,
3019
- class: h(A(r).base({ class: [t.ui?.base, n.class] }))
3020
- }, [(b(), a(e, null, C(3, (e) => o("span", { key: e })), 64))], 10, kn));
3021
- }
3022
- }), jn = G({ slots: { base: "loading-indicator" } }), Mn = ["aria-label"], Nn = /* @__PURE__ */ l({
3023
- __name: "LoadingIndicator",
3024
- props: {
3025
- label: { default: "Loading" },
3026
- ui: {},
3027
- class: { type: [
3028
- Array,
3029
- String,
3030
- null,
3031
- Number,
3032
- Boolean
3033
- ] }
3034
- },
3035
- setup(e) {
3036
- let t = e, n = jn();
3037
- return (r, i) => (b(), a("div", {
3038
- role: "status",
3039
- "aria-label": e.label,
3040
- class: h(A(n).base({ class: [e.ui?.base, t.class] }))
3041
- }, null, 10, Mn));
3042
- }
3043
- }), Pn = G({
3044
- slots: {
3045
- root: "min-w-0",
3046
- legend: "",
3047
- optionList: "",
3048
- option: "items-start text-sm leading-5",
3049
- container: "flex h-5 shrink-0 items-center",
3050
- base: "relative flex size-4 items-center justify-center rounded-full border outline-primary transition-colors has-focus-visible:outline-2 has-focus-visible:outline-offset-2",
3051
- indicator: "hidden size-1.5 rounded-full transition-transform duration-600 ease-[cubic-bezier(0.19,1,0.22,1)] peer-checked:block starting:scale-0 light:bg-white dark:bg-stone-950",
3052
- wrapper: "",
3053
- label: "block font-medium",
3054
- description: "mt-0.5 block text-muted",
3055
- errorMessage: "mt-3 flex items-start gap-x-1.5 text-xs light:text-red-600 dark:text-red-400",
3056
- errorIcon: "mt-px size-3.5 shrink-0"
3057
- },
3058
- variants: {
3059
- variant: {
3060
- default: { option: "inline-flex" },
3061
- card: { option: "flex w-full gap-x-2.5 rounded-2xl border p-4 transition-colors" }
3062
- },
3063
- direction: {
3064
- row: "",
3065
- col: ""
3066
- },
3067
- color: {
3068
- primary: { base: "has-checked:border-primary has-checked:bg-primary" },
3069
- secondary: { base: "has-checked:border-secondary has-checked:bg-secondary" },
3070
- neutral: { base: "light:has-checked:border-neutral-900 light:has-checked:bg-neutral-900 dark:has-checked:border-stone-200 dark:has-checked:bg-stone-200" }
3071
- },
3072
- hideLabel: {
3073
- true: { legend: "sr-only" },
3074
- false: { legend: "mb-3 text-sm font-semibold" }
3075
- },
3076
- hasDescriptions: { true: "" },
3077
- invalid: { true: { base: "light:border-red-600 dark:border-red-500" } },
3078
- optionDisabled: {
3079
- true: { option: "cursor-not-allowed opacity-50" },
3080
- false: { option: "cursor-pointer" }
3081
- },
3082
- optionHasDescription: { true: "" }
3083
- },
3084
- compoundVariants: [
3085
- {
3086
- variant: "card",
3087
- direction: "row",
3088
- class: { optionList: "grid gap-3 sm:auto-cols-fr sm:grid-flow-col" }
3089
- },
3090
- {
3091
- variant: "card",
3092
- direction: "col",
3093
- class: { optionList: "flex flex-col gap-y-3" }
3094
- },
3095
- {
3096
- variant: "default",
3097
- direction: "row",
3098
- class: { optionList: "flex flex-wrap gap-x-5 gap-y-2.5" }
3099
- },
3100
- {
3101
- variant: "default",
3102
- direction: "col",
3103
- hasDescriptions: !0,
3104
- class: { optionList: "flex flex-col items-start gap-y-4" }
3105
- },
3106
- {
3107
- variant: "default",
3108
- direction: "col",
3109
- hasDescriptions: !1,
3110
- class: { optionList: "flex flex-col items-start gap-y-2.5" }
3111
- },
3112
- {
3113
- variant: "default",
3114
- optionHasDescription: !0,
3115
- class: { option: "gap-x-2.5" }
3116
- },
3117
- {
3118
- variant: "default",
3119
- optionHasDescription: !1,
3120
- class: { option: "gap-x-1.5" }
3121
- },
3122
- {
3123
- variant: "card",
3124
- color: "primary",
3125
- class: { option: "has-checked:border-primary" }
3126
- },
3127
- {
3128
- variant: "card",
3129
- color: "secondary",
3130
- class: { option: "has-checked:border-secondary" }
3131
- },
3132
- {
3133
- variant: "card",
3134
- color: "neutral",
3135
- class: { option: "light:has-checked:border-neutral-900 dark:has-checked:border-stone-200" }
3136
- },
3137
- {
3138
- variant: "card",
3139
- invalid: !0,
3140
- class: { option: "light:border-red-600 dark:border-red-500" }
3141
- },
3142
- {
3143
- variant: "card",
3144
- invalid: !1,
3145
- optionDisabled: !0,
3146
- class: { option: "border-line" }
3147
- },
3148
- {
3149
- variant: "card",
3150
- invalid: !1,
3151
- optionDisabled: !1,
3152
- class: { option: "border-line light:not-has-checked:hover:border-stone-950/20 dark:not-has-checked:hover:border-white/20" }
3153
- },
3154
- {
3155
- invalid: !1,
3156
- optionDisabled: !0,
3157
- class: { base: "light:border-stone-300 dark:border-stone-600" }
3158
- },
3159
- {
3160
- invalid: !1,
3161
- optionDisabled: !1,
3162
- class: { base: "light:border-stone-300 light:not-has-checked:hover:border-stone-400 dark:border-stone-600 dark:not-has-checked:hover:border-stone-500" }
3163
- }
3164
- ]
3165
- }), Fn = [
3166
- "disabled",
3167
- "aria-invalid",
3168
- "aria-describedby"
3169
- ], In = [
3170
- "name",
3171
- "value",
3172
- "disabled",
3173
- "aria-labelledby",
3174
- "aria-describedby"
3175
- ], Ln = ["id"], Rn = ["id"], zn = /* @__PURE__ */ l({
3176
- __name: "RadioGroup",
3177
- props: /*@__PURE__*/ f({
3178
- label: {},
3179
- options: {},
3180
- name: {},
3181
- direction: { default: "row" },
3182
- variant: { default: "default" },
3183
- color: { default: "neutral" },
3184
- hideLabel: { type: Boolean },
3185
- disabled: { type: Boolean },
3186
- errorMessage: {},
3187
- ui: {},
3188
- class: { type: [
3189
- Array,
3190
- String,
3191
- null,
3192
- Number,
3193
- Boolean
3194
- ] }
3195
- }, {
3196
- modelValue: {},
3197
- modelModifiers: {}
3198
- }),
3199
- emits: ["update:modelValue"],
3200
- setup(t) {
3201
- let r = t, l = M(t, "modelValue"), { themeColor: u, customColorVariable: d } = bn(() => r.color, Pn.variants.color), f = j(), p = `${f}-error`, m = n(() => r.name ?? f), g = n(() => Pn({
3202
- variant: r.variant,
3203
- direction: r.direction,
3204
- color: u.value,
3205
- hideLabel: r.hideLabel,
3206
- hasDescriptions: r.options.some((e) => e.description),
3207
- invalid: !!r.errorMessage
3208
- }));
3209
- function v(e) {
3210
- return `${f}-option-${e}`;
3211
- }
3212
- function y(e) {
3213
- return r.disabled || !!e.disabled;
3214
- }
3215
- return (n, u) => (b(), a("fieldset", {
3216
- role: "radiogroup",
3217
- disabled: t.disabled,
3218
- "aria-invalid": t.errorMessage ? "true" : void 0,
3219
- "aria-describedby": t.errorMessage ? p : void 0,
3220
- class: h(g.value.root({ class: [t.ui?.root, r.class] })),
3221
- style: _(A(d))
3222
- }, [
3223
- o("legend", { class: h(g.value.legend({ class: t.ui?.legend })) }, O(t.label), 3),
3224
- o("div", { class: h(g.value.optionList({ class: t.ui?.optionList })) }, [(b(!0), a(e, null, C(t.options, (n, r) => (b(), a("label", {
3225
- key: n.value,
3226
- class: h(g.value.option({
3227
- optionDisabled: y(n),
3228
- optionHasDescription: !!n.description,
3229
- class: t.ui?.option
3230
- }))
3231
- }, [o("span", { class: h(g.value.container({ class: t.ui?.container })) }, [o("span", { class: h(g.value.base({
3232
- optionDisabled: y(n),
3233
- class: t.ui?.base
3234
- })) }, [V(o("input", {
3235
- "onUpdate:modelValue": u[0] ||= (e) => l.value = e,
3236
- type: "radio",
3237
- name: m.value,
3238
- value: n.value,
3239
- disabled: n.disabled,
3240
- "aria-labelledby": n.description ? `${v(r)}-label` : void 0,
3241
- "aria-describedby": n.description ? `${v(r)}-description` : void 0,
3242
- class: "peer sr-only"
3243
- }, null, 8, In), [[L, l.value]]), o("span", {
3244
- "aria-hidden": "true",
3245
- class: h(g.value.indicator({ class: t.ui?.indicator }))
3246
- }, null, 2)], 2)], 2), n.description ? (b(), a("span", {
3247
- key: 0,
3248
- class: h(g.value.wrapper({ class: t.ui?.wrapper }))
3249
- }, [o("span", {
3250
- id: `${v(r)}-label`,
3251
- class: h(g.value.label({ class: t.ui?.label }))
3252
- }, O(n.label), 11, Ln), o("span", {
3253
- id: `${v(r)}-description`,
3254
- class: h(g.value.description({ class: t.ui?.description }))
3255
- }, O(n.description), 11, Rn)], 2)) : (b(), a(e, { key: 1 }, [s(O(n.label), 1)], 64))], 2))), 128))], 2),
3256
- t.errorMessage ? (b(), a("p", {
3257
- key: 0,
3258
- id: p,
3259
- class: h(g.value.errorMessage({ class: t.ui?.errorMessage }))
3260
- }, [c(A(H), { class: h(g.value.errorIcon({ class: t.ui?.errorIcon })) }, null, 8, ["class"]), s(" " + O(t.errorMessage), 1)], 2)) : i("", !0)
3261
- ], 14, Fn));
3262
- }
3263
- }), Bn = G({
3264
- slots: {
3265
- root: "flex items-start text-sm leading-5 select-none",
3266
- base: "relative h-4.75 w-8 shrink-0 rounded-full outline-primary transition-colors duration-250 ease-[cubic-bezier(0.65,0,0.35,1)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 light:bg-stone-200 dark:bg-stone-700",
3267
- thumb: "absolute top-0.75 left-0.75 size-3.25 rounded-full bg-white transition duration-250 ease-[cubic-bezier(0.65,0,0.35,1)] peer-checked:translate-x-3.25 dark:peer-checked:bg-stone-950",
3268
- wrapper: "min-w-0",
3269
- label: "block font-medium",
3270
- description: "mt-0.5 block text-muted"
3271
- },
3272
- variants: {
3273
- color: {
3274
- primary: { base: "has-checked:bg-primary" },
3275
- secondary: { base: "has-checked:bg-secondary" },
3276
- neutral: { base: "light:has-checked:bg-neutral-900 dark:has-checked:bg-stone-200" }
3277
- },
3278
- labelPosition: {
3279
- start: { root: "flex-row-reverse" },
3280
- end: ""
3281
- },
3282
- block: {
3283
- true: { root: "w-full justify-between gap-x-4" },
3284
- false: { root: "w-fit gap-x-2" }
3285
- },
3286
- disabled: {
3287
- true: { root: "cursor-not-allowed opacity-50" },
3288
- false: {
3289
- root: "cursor-pointer",
3290
- base: "light:not-has-checked:hover:bg-stone-300 dark:not-has-checked:hover:bg-stone-600",
3291
- thumb: "shadow-[0_1px_2px_rgb(0_0_0/20%)]"
3292
- }
3293
- },
3294
- hasLabel: { true: { base: "top-px" } }
3295
- }
3296
- }), Vn = [
3297
- "checked",
3298
- "disabled",
3299
- "aria-labelledby",
3300
- "aria-describedby"
3301
- ], Hn = /* @__PURE__ */ l({
3302
- inheritAttrs: !1,
3303
- __name: "Switch",
3304
- props: /*@__PURE__*/ f({
3305
- label: {},
3306
- description: {},
3307
- color: { default: "neutral" },
3308
- labelPosition: { default: "end" },
3309
- block: { type: Boolean },
3310
- disabled: { type: Boolean },
3311
- ui: {},
3312
- class: { type: [
3313
- Array,
3314
- String,
3315
- null,
3316
- Number,
3317
- Boolean
3318
- ] }
3319
- }, {
3320
- modelValue: {
3321
- type: Boolean,
3322
- default: !1
3323
- },
3324
- modelModifiers: {}
3325
- }),
3326
- emits: ["update:modelValue"],
3327
- setup(t) {
3328
- let r = t, c = M(t, "modelValue"), { themeColor: l, customColorVariable: u } = bn(() => r.color, Bn.variants.color), d = j(), f = `${d}-label`, m = `${d}-description`, g = n(() => !!(r.label && r.description)), v = n(() => Bn({
3329
- color: l.value,
3330
- labelPosition: r.labelPosition,
3331
- block: r.block,
3332
- disabled: r.disabled,
3333
- hasLabel: !!r.label
3334
- }));
3335
- return (n, l) => (b(), a("label", {
3336
- class: h(v.value.root({ class: [t.ui?.root, r.class] })),
3337
- style: _(A(u))
3338
- }, [o("span", { class: h(v.value.base({ class: t.ui?.base })) }, [V(o("input", p(n.$attrs, {
3339
- "onUpdate:modelValue": l[0] ||= (e) => c.value = e,
3340
- checked: c.value,
3341
- type: "checkbox",
3342
- role: "switch",
3343
- disabled: t.disabled,
3344
- "aria-labelledby": g.value ? f : void 0,
3345
- "aria-describedby": g.value ? m : void 0,
3346
- class: "peer sr-only"
3347
- }), null, 16, Vn), [[F, c.value]]), o("span", {
3348
- "aria-hidden": "true",
3349
- class: h(v.value.thumb({ class: t.ui?.thumb }))
3350
- }, null, 2)], 2), g.value ? (b(), a("span", {
3351
- key: 0,
3352
- class: h(v.value.wrapper({ class: t.ui?.wrapper }))
3353
- }, [o("span", {
3354
- id: f,
3355
- class: h(v.value.label({ class: t.ui?.label }))
3356
- }, O(t.label), 3), o("span", {
3357
- id: m,
3358
- class: h(v.value.description({ class: t.ui?.description }))
3359
- }, O(t.description), 3)], 2)) : t.label ? (b(), a(e, { key: 1 }, [s(O(t.label), 1)], 64)) : i("", !0)], 6));
3360
- }
3361
- }), Un = G({
3362
- slots: {
3363
- base: "rounded-sm wrap-anywhere outline-primary transition-colors focus-visible:outline-2 focus-visible:outline-offset-1",
3364
- leadingIcon: "size-[1em] shrink-0",
3365
- trailingIcon: "size-[1em] shrink-0",
3366
- newTabHint: "sr-only"
3367
- },
3368
- variants: {
3369
- color: {
3370
- inherit: { base: "hover:text-current/80" },
3371
- muted: { base: "text-muted light:hover:text-stone-950 dark:hover:text-white" },
3372
- primary: { base: "text-primary light:hover:text-[color-mix(in_oklab,var(--color-primary),black_25%)] dark:hover:text-[color-mix(in_oklab,var(--color-primary),white_25%)]" }
3373
- },
3374
- weight: {
3375
- inherit: "",
3376
- medium: { base: "font-medium" },
3377
- semibold: { base: "font-semibold" }
3378
- },
3379
- underline: { true: { base: "underline decoration-current/70 underline-offset-[0.1em]" } },
3380
- hasIcon: { true: { base: "inline-flex items-center gap-0.5" } }
3381
- }
3382
- }), Wn = [
3383
- "href",
3384
- "target",
3385
- "rel"
3386
- ], Gn = /* @__PURE__ */ l({
3387
- __name: "TextLink",
3388
- props: {
3389
- label: {},
3390
- href: { default: "#" },
3391
- color: { default: "inherit" },
3392
- weight: { default: "inherit" },
3393
- underline: {
3394
- type: Boolean,
3395
- default: void 0
3396
- },
3397
- external: {
3398
- type: Boolean,
3399
- default: void 0
3400
- },
3401
- leadingIcon: {},
3402
- trailingIcon: {},
3403
- ui: {},
3404
- class: { type: [
3405
- Array,
3406
- String,
3407
- null,
3408
- Number,
3409
- Boolean
3410
- ] }
3411
- },
3412
- setup(e) {
3413
- let t = e, o = n(() => t.underline ?? t.color !== "primary"), c = n(() => t.external ?? yt(t.href)), l = n(() => Un({
3414
- color: t.color,
3415
- weight: t.weight,
3416
- underline: o.value,
3417
- hasIcon: !!(t.leadingIcon || t.trailingIcon)
3418
- }));
3419
- return (n, o) => (b(), a("a", {
3420
- href: e.href,
3421
- target: c.value ? "_blank" : void 0,
3422
- rel: c.value ? "noopener noreferrer" : void 0,
3423
- class: h(l.value.base({ class: [e.ui?.base, t.class] }))
3424
- }, [
3425
- e.leadingIcon ? (b(), r(E(e.leadingIcon), {
3426
- key: 0,
3427
- class: h(l.value.leadingIcon({ class: e.ui?.leadingIcon }))
3428
- }, null, 8, ["class"])) : i("", !0),
3429
- w(n.$slots, "default", {}, () => [s(O(e.label), 1)]),
3430
- e.trailingIcon ? (b(), r(E(e.trailingIcon), {
3431
- key: 1,
3432
- class: h(l.value.trailingIcon({ class: e.ui?.trailingIcon }))
3433
- }, null, 8, ["class"])) : i("", !0),
3434
- c.value ? (b(), a("span", {
3435
- key: 2,
3436
- class: h(l.value.newTabHint({ class: e.ui?.newTabHint }))
3437
- }, "(opens in a new tab)", 2)) : i("", !0)
3438
- ], 10, Wn));
3439
- }
3440
- }), Kn = /* @__PURE__ */ new Set([
3441
- "INPUT",
3442
- "TEXTAREA",
3443
- "SELECT"
3444
- ]);
3445
- function qn(e) {
3446
- return e instanceof HTMLElement && (e.isContentEditable || Kn.has(e.tagName));
3447
- }
3448
- var Jn = (e, t) => t.allowInEditable || !qn(e.target);
3449
- // src/shared/composables/useShortcuts.ts
3450
- function Yn(e, t = {}) {
3451
- function n() {
3452
- return t.target === void 0 ? document : k(t.target);
3453
- }
3454
- y(() => {
3455
- z(() => [
3456
- k(e),
3457
- n(),
3458
- k(t.enabled) ?? !0
3459
- ], ([e, n, r], i, a) => {
3460
- if (!r || !n) return;
3461
- let o = tt(e, { guards: [Jn, ...t.guards ?? []] });
3462
- n.addEventListener("keydown", o), a(() => n.removeEventListener("keydown", o));
3463
- }, { immediate: !0 });
3464
- });
3465
- }
3466
- // src/index.ts
3467
- var Xn = /* @__PURE__ */ ae({
3468
- KAlert: () => xe,
3469
- KAvatar: () => Me,
3470
- KAvatarGroup: () => Fe,
3471
- KBadge: () => yn,
3472
- KButton: () => Z,
3473
- KCheckbox: () => Cn,
3474
- KCircularProgress: () => Dn,
3475
- KLoadingDots: () => An,
3476
- KLoadingIndicator: () => Nn,
3477
- KMenu: () => Pt,
3478
- KRadioGroup: () => zn,
3479
- KSwitch: () => Hn,
3480
- KTextField: () => Jt,
3481
- KTextLink: () => Gn,
3482
- KTextarea: () => sn,
3483
- extractMenuShortcuts: () => Dt,
3484
- useShortcuts: () => Yn
3485
- });
3486
- export { xe as _, zn as a, Dn as c, sn as d, Jt as f, Me as g, Fe as h, Hn as i, Cn as l, Dt as m, Yn as n, Nn as o, Pt as p, Gn as r, An as s, Xn as t, yn as u, Z as v };