@ghentcdh/ui 1.1.1 → 3.0.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 (55) hide show
  1. package/ControlWrapper-DejmeYzV.js +1 -0
  2. package/ControlWrapper-DqO2d36v.js +152 -0
  3. package/Markdown-DcpBYoNe.js +1 -0
  4. package/Markdown-Dj1gzJJq.js +59 -0
  5. package/button/Btn.properties.d.ts +6 -2
  6. package/button/btn.vue.d.ts +15 -5
  7. package/const/colors.d.ts +2 -1
  8. package/drawer/drawer.properties.d.ts +4 -0
  9. package/drawer/drawer.vue.d.ts +9 -0
  10. package/filter/filter.vue.d.ts +1 -1
  11. package/form/Checkbox.properties.d.ts +14 -1
  12. package/form/Checkbox.vue.d.ts +41 -8
  13. package/form/Input.properties.d.ts +18 -1
  14. package/form/Input.vue.d.ts +50 -8
  15. package/form/InputNumber.properties.d.ts +14 -1
  16. package/form/InputNumber.vue.d.ts +41 -8
  17. package/form/Textarea.properties.d.ts +26 -1
  18. package/form/Textarea.vue.d.ts +68 -8
  19. package/form/core/ControlWrapper.properties.d.ts +54 -1
  20. package/form/core/ControlWrapper.vue.d.ts +42 -8
  21. package/form/core/properties.d.ts +2 -16
  22. package/form/core/styles.d.ts +1 -1
  23. package/form/core/utils/style.d.ts +3 -3
  24. package/form/index.d.ts +273 -1
  25. package/form/select/AutoComplete.properties.d.ts +27 -2
  26. package/form/select/AutoComplete.vue.d.ts +75 -15
  27. package/form/select/ListResults.properties.d.ts +7 -1
  28. package/form/select/ListResults.vue.d.ts +12 -3
  29. package/form/select/MultiSelect.vue.d.ts +73 -13
  30. package/form/select/SelectComponent.vue.d.ts +61 -10
  31. package/form/select/SelectWrapper.properties.d.ts +57 -9
  32. package/form/select/SelectWrapper.vue.d.ts +99 -17
  33. package/form/text/Markdown.vue.d.ts +41 -8
  34. package/form/text/MarkdownComponent.properties.d.ts +14 -1
  35. package/form/text/MarkdownFallback.vue.d.ts +267 -0
  36. package/icons/icon-list.d.ts +3 -1
  37. package/index.css +3 -1
  38. package/index.d.ts +1 -0
  39. package/index.js +2 -2
  40. package/index.mjs +2318 -2359
  41. package/modal/modal.vue.d.ts +1 -0
  42. package/package.json +26 -16
  43. package/table/cells/text.cell.vue.d.ts +1 -1
  44. package/table/column.model.d.ts +6 -0
  45. package/table/header/sort.header.properties.d.ts +1 -1
  46. package/table/header/sort.header.vue.d.ts +2 -2
  47. package/table/index.d.ts +2 -0
  48. package/table/pagination.component.properties.d.ts +5 -0
  49. package/table/pagination.component.vue.d.ts +9 -0
  50. package/table/table.component.properties.d.ts +4 -0
  51. package/table/table.component.vue.d.ts +9 -0
  52. package/table/table.model.d.ts +4 -1
  53. package/testing.js +1 -1
  54. package/testing.mjs +338 -419
  55. package/test-utils/withSetup.d.ts +0 -4
package/index.mjs CHANGED
@@ -1,2372 +1,2331 @@
1
- import { defineComponent as k, computed as v, openBlock as r, createBlock as y, resolveDynamicComponent as ne, normalizeClass as $, createCommentVNode as _, createElementBlock as f, createElementVNode as u, toDisplayString as w, unref as g, Fragment as L, renderList as M, mergeProps as B, resolveComponent as ce, withCtx as S, createTextVNode as E, ref as x, watch as j, onUnmounted as _e, onMounted as $e, withModifiers as le, renderSlot as P, createVNode as V, withDirectives as Y, vModelCheckbox as Ce, normalizeStyle as X, useAttrs as Ie, getCurrentInstance as De, camelize as Re, toHandlerKey as re, nextTick as xe, normalizeProps as ee, guardReactiveProps as te, Transition as Te, useModel as F, mergeModels as I, onBeforeUnmount as Ee, vModelDynamic as ze, vModelText as Le, useSlots as Se, toRef as we } from "vue";
2
- import { RouterLink as Ne } from "vue-router";
3
- import { v4 as de } from "uuid";
4
- import { LinkIcon as qe, DocumentTextIcon as je, EyeIcon as Fe, CheckIcon as Ke, LanguageIcon as Ue, ChevronDoubleRightIcon as He, ChevronDoubleLeftIcon as We, ChevronUpIcon as Ge, ChevronDownIcon as Xe, ChevronLeftIcon as Ze, ChevronRightIcon as Je, Bars3Icon as Qe, PaperClipIcon as Ye, PlusCircleIcon as et, XMarkIcon as tt, FunnelIcon as ot, BarsArrowUpIcon as st, BarsArrowDownIcon as nt, TrashIcon as lt, PencilSquareIcon as at } from "@heroicons/vue/24/outline";
5
- import rt from "@tiptap/starter-kit";
6
- import { useEditor as it, EditorContent as ut } from "@tiptap/vue-3";
7
- import { Markdown as ct } from "tiptap-markdown";
8
- import { ChevronDownIcon as dt, ChevronRightIcon as pt } from "@heroicons/vue/24/solid";
9
- var R = /* @__PURE__ */ ((e) => (e.Edit = "Edit", e.Delete = "Delete", e.BarsArrowDown = "BarsArrowDown", e.BarsArrowUp = "BarsArrowUp", e.Funnel = "Funnel", e.Close = "Close", e.Plus = "Plus", e.PaperClip = "PaperClip", e.Hamburger = "Hamburger", e.ChevronRight = "ChevronRight", e.ChevronLeft = "ChevronLeft", e.ChevronDown = "ChevronDown", e.ChevronUp = "ChevronUp", e.DblChevronLeft = "DblChevronLeft", e.DblChevronRight = "DblChevronRight", e.Language = "Language", e.Check = "Check", e.View = "View", e.Text = "Text", e.Link = "Link", e))(R || {});
10
- const ft = {
11
- Edit: at,
12
- Delete: lt,
13
- BarsArrowDown: nt,
14
- BarsArrowUp: st,
15
- Funnel: ot,
16
- Close: tt,
17
- Plus: et,
18
- PaperClip: Ye,
19
- Hamburger: Qe,
20
- ChevronRight: Je,
21
- ChevronLeft: Ze,
22
- ChevronDown: Xe,
23
- ChevronUp: Ge,
24
- DblChevronLeft: We,
25
- DblChevronRight: He,
26
- Language: Ue,
27
- Check: Ke,
28
- View: Fe,
29
- Text: je,
30
- Link: qe
31
- }, mt = {
32
- icon: { type: [String, Object, Function] },
33
- size: { type: String }
34
- }, q = /* @__PURE__ */ k({
35
- __name: "icon",
36
- props: mt,
37
- setup(e) {
38
- const t = e, o = v(() => t.icon ? typeof t.icon == "string" ? ft[t.icon] : t.icon : null);
39
- return (n, l) => o.value ? (r(), y(ne(o.value), {
40
- key: 0,
41
- "aria-hidden": "true",
42
- class: $([
43
- {
44
- "w-full h-full": !n.size,
45
- "w-2 h-2": n.size === "xs",
46
- "w-4 h-4": n.size === "sm",
47
- "w-6 h-6": n.size === "lg",
48
- "w-8 h-8": n.size === "xl"
49
- }
50
- ])
51
- }, null, 8, ["class"])) : _("", !0);
52
- }
53
- }), bt = { class: "dropdown dropdown-end" }, gt = {
54
- tabindex: "0",
55
- role: "menu",
56
- class: "menu dropdown-content bg-white z-1 mt-4 p-2 shadow-sm"
57
- }, vt = { class: "min-w-max flex-no-wrap text-black" }, pe = /* @__PURE__ */ k({
58
- __name: "sub-menu",
59
- props: {
60
- label: {},
61
- items: {},
62
- action: { type: Function },
63
- disabled: { type: Boolean },
64
- btnClass: {},
65
- disableArrow: { type: Boolean }
66
- },
67
- setup(e) {
68
- return (t, o) => (r(), f("div", bt, [
69
- u("div", {
70
- tabindex: "0",
71
- role: "button",
72
- "aria-haspopup": "menu",
73
- class: $([e.btnClass, "btn btn-ghost text-right flex-nowrap flex"])
74
- }, [
75
- u("span", null, w(e.label), 1),
76
- e.disableArrow ? _("", !0) : (r(), y(g(q), {
77
- key: 0,
78
- icon: g(R).ChevronDown,
79
- size: "sm"
80
- }, null, 8, ["icon"]))
81
- ], 2),
82
- u("ul", gt, [
83
- u("li", vt, [
84
- (r(!0), f(L, null, M(e.items, (n) => (r(), y(Pe, B({
85
- key: n.label
86
- }, { ref_for: !0 }, n), null, 16))), 128))
87
- ])
88
- ])
89
- ]));
90
- }
91
- }), oe = "btn btn-ghost text-left justify-between min-w-max font-normal", Pe = /* @__PURE__ */ k({
92
- __name: "menu-item",
93
- props: {
94
- label: {},
95
- items: {},
96
- action: {},
97
- disabled: { type: Boolean, default: !1 }
98
- },
99
- setup(e) {
100
- const t = e, o = v(() => !t.disabled && t.action && "routerLink" in t.action), n = v(() => !t.disabled && t.action), l = v(() => t.items?.length), a = v(() => {
101
- const d = t.action;
102
- return d && "routerLink" in d && "params" in d ? {
103
- name: d.routerLink,
104
- params: d.params
105
- } : "";
106
- }), c = () => {
107
- t.action?.();
108
- };
109
- return (d, p) => {
110
- const i = ce("RouterLink");
111
- return l.value ? (r(), y(pe, B({ key: 0 }, t, { "btn-class": oe }), null, 16)) : o.value ? (r(), y(i, {
112
- key: 1,
113
- to: a.value,
114
- class: $(oe),
115
- onClick: c
116
- }, {
117
- default: S(() => [
118
- E(w(e.label), 1)
119
- ]),
120
- _: 1
121
- }, 8, ["to"])) : n.value ? (r(), f("button", {
122
- key: 2,
123
- class: $(oe),
124
- onClick: c
125
- }, w(e.label), 1)) : (r(), f("div", {
126
- key: 3,
127
- class: $([oe, { "btn-disabled": e.disabled }])
128
- }, w(e.label), 3));
129
- };
130
- }
131
- }), ht = { class: "navbar bg-base-100 shadow-sm" }, yt = { class: "flex-1" }, wt = {
132
- key: 0,
133
- class: "breadcrumbs text-sm"
134
- }, kt = { class: "flex grow justify-end px-2" }, _t = { class: "flex items-stretch" }, wn = /* @__PURE__ */ k({
135
- __name: "menu",
136
- props: {
137
- menu: {},
138
- breadcrumbs: {}
139
- },
140
- setup(e) {
141
- return (t, o) => {
142
- const n = ce("RouterLink");
143
- return r(), f("nav", ht, [
144
- u("div", yt, [
145
- e.breadcrumbs ? (r(), f("div", wt, [
146
- u("ul", null, [
147
- (r(!0), f(L, null, M(e.breadcrumbs, (l) => (r(), f("li", {
148
- key: l.label
149
- }, [
150
- l.routerLink ? (r(), y(n, {
151
- key: 0,
152
- to: { name: l.routerLink, params: l.params },
153
- role: "navigation",
154
- "aria-label": l.label
155
- }, {
156
- default: S(() => [
157
- E(w(l.label), 1)
158
- ]),
159
- _: 2
160
- }, 1032, ["to", "aria-label"])) : (r(), f(L, { key: 1 }, [
161
- E(w(l.label), 1)
162
- ], 64))
163
- ]))), 128))
164
- ])
165
- ])) : _("", !0)
166
- ]),
167
- u("div", kt, [
168
- u("div", _t, [
169
- (r(!0), f(L, null, M(e.menu, (l) => (r(), y(Pe, B({
170
- key: l.label
171
- }, { ref_for: !0 }, l), null, 16))), 128))
172
- ])
173
- ])
174
- ]);
175
- };
176
- }
177
- }), kn = /* @__PURE__ */ k({
178
- __name: "dropdown",
179
- props: {
180
- items: {}
181
- },
182
- setup(e) {
183
- const t = x(!0);
184
- return (o, n) => (r(), y(pe, {
185
- items: e.items,
186
- label: "test",
187
- open: t.value,
188
- "btn-class": "",
189
- "disable-arrow": !0
190
- }, null, 8, ["items", "open"]));
191
- }
192
- }), $t = {
193
- modalTitle: { type: String, required: !0 },
194
- buttonLabel: { type: String },
195
- buttonSaveLabel: { type: String },
196
- data: { default: void 0 },
197
- open: { type: Boolean, default: !1 },
198
- disableClose: { type: Boolean, default: !1 },
199
- width: { type: String, default: "sm" }
200
- }, Ct = ["closeModal"], xt = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])', ke = (e) => Array.from(e.querySelectorAll(xt)), Lt = ({
201
- containerRef: e,
202
- isActive: t,
203
- onEscape: o,
204
- restoreFocus: n = !0
205
- }) => {
206
- let l = null;
207
- const a = (p) => {
208
- const i = e.value;
209
- if (!i) return;
210
- if (p.key === "Escape") {
211
- o?.();
212
- return;
213
- }
214
- if (p.key !== "Tab") return;
215
- const s = ke(i);
216
- if (s.length === 0) return;
217
- const m = s[0], b = s[s.length - 1];
218
- p.shiftKey ? document.activeElement === m && (p.preventDefault(), b.focus()) : document.activeElement === b && (p.preventDefault(), m.focus());
219
- }, c = () => {
220
- const p = e.value;
221
- if (!p) return;
222
- l = document.activeElement, document.addEventListener("keydown", a);
223
- const i = ke(p);
224
- i.length > 0 && i[0].focus();
225
- }, d = () => {
226
- document.removeEventListener("keydown", a), n && l && (l.focus(), l = null);
227
- };
228
- j(t, (p) => {
229
- p ? c() : d();
230
- }, { immediate: !0 }), _e(() => {
231
- d();
232
- });
233
- }, St = {
234
- xs: "max-w-xs w-[50VW]",
235
- sm: "max-w-sm w-[50VW]",
236
- lg: "max-w-2xl w-[80VW]",
237
- xl: "max-w-[80VW] w-[80VW]"
238
- }, Pt = {
239
- xs: "btn-xs",
240
- sm: "btn-sm",
241
- lg: "btn-sm",
242
- xl: "btn"
243
- }, Mt = {
244
- xs: "badge-xs text-xxs",
245
- sm: "badge-sm text-xs",
246
- lg: "badge-sm text-xs",
247
- xl: "badge text-xs"
248
- }, Bt = { class: "flex justify-end gap-2 pt-2 mt-2 border-t border-gray-300 shrink-0" }, Vt = /* @__PURE__ */ k({
249
- __name: "modal",
250
- props: $t,
251
- emits: Ct,
252
- setup(e, { expose: t, emit: o }) {
253
- const n = e, l = `modal_${de()}`, a = `${l}_title`, c = `${l}_content`, d = x(null), p = x(!1), i = o, s = () => {
254
- d.value?.showModal(), p.value = !0;
255
- }, m = () => {
256
- d.value?.close(), p.value = !1, i("closeModal");
257
- }, b = () => {
258
- n.disableClose || m();
259
- };
260
- return Lt({
261
- containerRef: d,
262
- isActive: p,
263
- onEscape: () => {
264
- n.disableClose || m();
265
- }
266
- }), t({ closeModal: m, openModal: s }), j(
267
- () => n.open,
268
- () => {
269
- n.open ? s() : m();
270
- }
271
- ), $e(() => {
272
- n.open && s();
273
- }), (h, D) => (r(), f("dialog", {
274
- ref_key: "dialogRef",
275
- ref: d,
276
- class: "modal",
277
- role: "dialog",
278
- "aria-modal": "true",
279
- "aria-labelledby": a,
280
- "aria-describedby": c,
281
- onCancel: le(b, ["prevent"])
282
- }, [
283
- u("div", {
284
- class: $([
285
- "modal-box bg-white min-h-0 max-h-[90vh] flex flex-col overflow-hidden",
286
- g(St)[h.width]
287
- ])
288
- }, [
289
- h.disableClose ? _("", !0) : (r(), f("button", {
290
- key: 0,
291
- type: "button",
292
- class: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2",
293
- "aria-label": "Close",
294
- onClick: m
295
- }, " ✕ ")),
296
- u("h3", {
297
- id: a,
298
- class: "font-bold shrink-0"
299
- }, w(h.modalTitle), 1),
300
- u("div", {
301
- id: c,
302
- class: "pt-4 flex-1 min-h-0 flex flex-col"
303
- }, [
304
- P(h.$slots, "content")
305
- ]),
306
- u("div", Bt, [
307
- P(h.$slots, "actions")
308
- ])
309
- ], 2)
310
- ], 544));
311
- }
312
- });
313
- var fe = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(fe || {}), Me = /* @__PURE__ */ ((e) => (e.a = "a", e.button = "button", e))(Me || {}), z = /* @__PURE__ */ ((e) => (e.blank = "blank", e.primary = "primary", e.secondary = "secondary", e.error = "error", e))(z || {});
314
- const At = {
315
- blank: "btn-ghost",
316
- primary: "btn-primary",
317
- secondary: "btn-soft btn-primary",
318
- error: "btn-error"
319
- }, Ot = {
320
- blank: "badge-ghost",
321
- primary: "badge-primary",
322
- secondary: "badge-soft badge-primary",
323
- error: "badge-error"
324
- }, It = {
325
- href: { type: String },
326
- disabled: { type: Boolean, default: !1 },
327
- tooltip: { type: String },
328
- as: { type: String, default: Me.button },
329
- icon: { type: [String, Object, Function] },
330
- type: { type: String, default: fe.button },
331
- outline: { type: Boolean, default: !1 },
332
- color: { type: String, default: z.primary },
333
- size: { type: String, default: "sm" },
334
- square: { type: Boolean, default: !1 }
335
- }, Dt = ["click"], Rt = {
336
- icon: { type: [String, Object, Function] },
337
- type: { type: String, default: fe.button },
338
- color: { type: String, default: z.primary },
339
- disabled: { type: Boolean, default: !1 },
340
- size: { type: String, default: "sm" }
341
- }, Tt = ["click"], N = /* @__PURE__ */ k({
342
- __name: "btn",
343
- props: It,
344
- emits: Dt,
345
- setup(e, { emit: t }) {
346
- const o = e, n = t;
347
- return (l, a) => (r(), y(ne(o.as), {
348
- class: $([
349
- "btn p-1 flex justify-center flex-nowrap",
350
- g(At)[o.color],
351
- g(Pt)[o.size],
352
- { "btn-outline": o.outline, "btn-square": o.square, tooltip: o.tooltip }
353
- ]),
354
- href: o.href,
355
- type: o.type,
356
- disabled: o.disabled,
357
- "data-tip": o.tooltip,
358
- onClick: a[0] || (a[0] = (c) => n("click"))
359
- }, {
360
- default: S(() => [
361
- o.icon ? (r(), y(g(q), {
362
- key: 0,
363
- icon: o.icon,
364
- size: o.size
365
- }, null, 8, ["icon", "size"])) : _("", !0),
366
- P(l.$slots, "default")
367
- ]),
368
- _: 3
369
- }, 8, ["class", "href", "type", "disabled", "data-tip"]));
370
- }
371
- }), Et = ["type", "disabled"], _n = /* @__PURE__ */ k({
372
- __name: "btn-badge",
373
- props: Rt,
374
- emits: Tt,
375
- setup(e, { emit: t }) {
376
- const o = e, n = t;
377
- return (l, a) => (r(), f("button", {
378
- class: $(["badge gap-1", g(Mt)[o.size], g(Ot)[o.color]]),
379
- type: o.type,
380
- disabled: o.disabled,
381
- onClick: a[0] || (a[0] = (c) => n("click"))
382
- }, [
383
- P(l.$slots, "default"),
384
- o.icon ? (r(), y(g(q), {
385
- key: 0,
386
- icon: o.icon,
387
- size: o.size
388
- }, null, 8, ["icon", "size"])) : _("", !0)
389
- ], 10, Et));
390
- }
391
- }), zt = /* @__PURE__ */ k({
392
- __name: "confirmModal",
393
- props: {
394
- title: {},
395
- message: {},
396
- confirmLabel: { default: "Ok" },
397
- cancelLabel: { default: "Cancel" }
398
- },
399
- emits: ["closeModal"],
400
- setup(e, { emit: t }) {
401
- const o = t, n = (l) => {
402
- o("closeModal", { confirmed: l });
403
- };
404
- return (l, a) => (r(), y(Vt, {
405
- "modal-title": e.title,
406
- open: !0,
407
- "disable-close": !0
408
- }, {
409
- content: S(() => [
410
- E(w(e.message), 1)
411
- ]),
412
- actions: S(() => [
413
- V(g(N), {
414
- color: g(z).secondary,
415
- outline: !0,
416
- "aria-label": e.cancelLabel,
417
- onClick: a[0] || (a[0] = (c) => n(!1))
418
- }, {
419
- default: S(() => [
420
- E(w(e.cancelLabel), 1)
421
- ]),
422
- _: 1
423
- }, 8, ["color", "aria-label"]),
424
- V(g(N), {
425
- "aria-label": e.confirmLabel,
426
- onClick: a[1] || (a[1] = (c) => n(!0))
427
- }, {
428
- default: S(() => [
429
- E(w(e.confirmLabel), 1)
430
- ]),
431
- _: 1
432
- }, 8, ["aria-label"])
433
- ]),
434
- _: 1
435
- }, 8, ["modal-title"]));
436
- }
437
- });
438
- class me {
439
- constructor() {
440
- this.showModal = x(!1), this.modals = [];
441
- }
442
- openModal(t) {
443
- const o = t.props.onClose, n = de(), l = t;
444
- t.props.onClose = (a) => {
445
- o(a), this.closeModal(n);
446
- }, l.id = n, this.modals = [...this.modals, l], this.showModal.value = Date.now();
447
- }
448
- closeModal(t) {
449
- this.modals = this.modals.filter((o) => o.id !== t), this.showModal.value = Date.now();
450
- }
451
- static showConfirm(t) {
452
- this.getInstance().openModal({
453
- component: zt,
454
- props: t
455
- });
456
- }
457
- static openModal(t) {
458
- this.getInstance().openModal(t);
459
- }
460
- static getInstance() {
461
- return this.instance || (this.instance = new me()), this.instance;
462
- }
463
- static closeAll() {
464
- this.instance.closeAll();
465
- }
466
- closeAll() {
467
- this.modals = [], this.showModal.value = !1;
468
- }
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./ControlWrapper-DqO2d36v.js";
2
+ import { Fragment as l, Teleport as u, Transition as d, camelize as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createTextVNode as v, createVNode as y, defineAsyncComponent as b, defineComponent as x, getCurrentInstance as S, guardReactiveProps as C, h as w, mergeModels as T, mergeProps as E, nextTick as D, normalizeClass as O, normalizeProps as k, normalizeStyle as A, onMounted as ee, onUnmounted as te, openBlock as j, ref as M, renderList as N, renderSlot as P, resolveComponent as ne, resolveDynamicComponent as F, toDisplayString as I, toHandlerKey as L, toRef as re, unref as R, useAttrs as ie, useModel as z, useSlots as ae, vModelCheckbox as oe, vModelDynamic as se, vModelText as ce, watch as B, withCtx as V, withDirectives as H, withModifiers as U } from "vue";
3
+ import { RouterLink as le } from "vue-router";
4
+ //#region src/icons/icon-list.ts
5
+ function W(e) {
6
+ return x({ render() {
7
+ return w("svg", {
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ fill: "none",
10
+ viewBox: "0 0 24 24",
11
+ "stroke-width": "1.5",
12
+ stroke: "currentColor",
13
+ "aria-hidden": "true"
14
+ }, e.map((e) => w("path", {
15
+ "stroke-linecap": "round",
16
+ "stroke-linejoin": "round",
17
+ d: e
18
+ })));
19
+ } });
469
20
  }
470
- const Nt = /* @__PURE__ */ k({
471
- __name: "modalWrapper",
472
- setup(e) {
473
- const t = me.getInstance(), o = v(() => t.showModal.value ? t.modals : []);
474
- return (n, l) => (r(!0), f(L, null, M(o.value, (a) => (r(), y(ne(a?.component), B({
475
- key: a.id,
476
- ref_for: !0
477
- }, a?.props, {
478
- open: !0,
479
- onCloseModal: a?.props?.onClose
480
- }), null, 16, ["onCloseModal"]))), 128));
481
- }
482
- }), qt = /* @__PURE__ */ k({
483
- __name: "notification-message",
484
- props: {
485
- message: {},
486
- type: {}
487
- },
488
- setup(e) {
489
- const t = {
490
- success: "alert-success",
491
- error: "alert-error",
492
- warning: "alert-warning",
493
- info: "alert-info"
494
- };
495
- return (o, n) => (r(), f("div", {
496
- role: "alert",
497
- class: $(`alert ${t[e.type]} `)
498
- }, [
499
- u("span", null, w(e.message), 1)
500
- ], 2));
501
- }
502
- }), jt = 5e3;
503
- class be {
504
- constructor() {
505
- this.notifications = x([]), this.addNotification = (t, o = "info") => {
506
- const n = {
507
- id: de(),
508
- duration: jt,
509
- message: t,
510
- type: o
511
- };
512
- this.notifications.value.push(n), this.removeNotificationAfterDuration(n);
513
- }, this.removeNotificationAfterDuration = (t) => {
514
- setTimeout(() => {
515
- this.removeNotification(t.id);
516
- }, t.duration);
517
- }, this.removeNotification = (t) => {
518
- this.notifications.value = this.notifications.value.filter((o) => o.id !== t);
519
- };
520
- }
521
- static getInstance() {
522
- return this.instance || (this.instance = new be()), this.instance;
523
- }
524
- static info(t) {
525
- this.getInstance().addNotification(t, "info");
526
- }
527
- static success(t) {
528
- this.getInstance().addNotification(t, "success");
529
- }
530
- static warning(t) {
531
- this.getInstance().addNotification(t, "warning");
532
- }
533
- static error(t) {
534
- this.getInstance().addNotification(t, "error");
535
- }
536
- static removeNotification(t) {
537
- this.getInstance().removeNotification(t);
538
- }
539
- }
540
- const Ft = { class: "toast toast-top toast-center z-[999]" }, Kt = /* @__PURE__ */ k({
541
- __name: "notifications",
542
- setup(e) {
543
- const t = be.getInstance();
544
- return (o, n) => (r(), f("div", Ft, [
545
- (r(!0), f(L, null, M(g(t).notifications.value, (l) => (r(), y(qt, B({
546
- key: l.id
547
- }, { ref_for: !0 }, l), null, 16))), 128))
548
- ]));
549
- }
550
- }), Ut = { class: "flex h-screen flex-col" }, Ht = { class: "shrink-0" }, Wt = { class: "navbar bg-primary text-primary-content w-full z-100" }, Gt = { class: "navbar-start" }, Xt = { class: "navbar-center" }, Zt = ["href"], Jt = { class: "navbar-end" }, Qt = { class: "drawer-content overflow-y-auto mb-2 mr-2 shadow-md" }, Yt = { class: "drawer-side h-full shadow-md" }, eo = { class: "flex-grow overflow-y-auto" }, to = { class: "bg-base-200 p-4" }, $n = /* @__PURE__ */ k({
551
- __name: "shell.component",
552
- props: {
553
- title: {},
554
- menu: {},
555
- user: {},
556
- version: {},
557
- widthSidebar: { default: 300 }
558
- },
559
- emits: ["logout"],
560
- setup(e, { emit: t }) {
561
- const n = e, l = x(!1), a = () => {
562
- l.value = !l.value;
563
- }, c = t, d = v(() => n.user ? {
564
- label: n.user.name,
565
- items: [
566
- {
567
- label: "Logout",
568
- action: () => {
569
- c("logout");
570
- }
571
- }
572
- ]
573
- } : null);
574
- return (p, i) => (r(), f(L, null, [
575
- V(Kt),
576
- V(g(Nt)),
577
- u("div", Ut, [
578
- u("header", Ht, [
579
- u("nav", Wt, [
580
- u("div", Gt, [
581
- u("button", {
582
- "aria-label": "open sidebar",
583
- class: "btn btn-square btn-ghost p-1",
584
- onClick: a
585
- }, [
586
- V(g(q), {
587
- icon: g(R).Hamburger
588
- }, null, 8, ["icon"])
589
- ])
590
- ]),
591
- u("div", Xt, [
592
- u("a", {
593
- class: "btn btn-ghost text-primary-content text-lg color-white",
594
- href: g("/")
595
- }, w(e.title), 9, Zt)
596
- ]),
597
- u("div", Jt, [
598
- d.value ? (r(), y(g(pe), B({ key: 0 }, d.value, { "btn-class": "" }), null, 16)) : _("", !0)
599
- ])
600
- ])
601
- ]),
602
- u("div", {
603
- class: $(["drawer flex-1 overflow-hidden", { "drawer-open": l.value }])
604
- }, [
605
- Y(u("input", {
606
- id: "app-drawer",
607
- "onUpdate:modelValue": i[0] || (i[0] = (s) => l.value = s),
608
- type: "checkbox",
609
- class: "drawer-toggle"
610
- }, null, 512), [
611
- [Ce, l.value]
612
- ]),
613
- u("main", Qt, [
614
- P(p.$slots, "default")
615
- ]),
616
- u("div", Yt, [
617
- i[1] || (i[1] = u("label", {
618
- for: "app-drawer",
619
- "aria-label": "close sidebar",
620
- class: "drawer-overlay"
621
- }, null, -1)),
622
- u("div", {
623
- class: "menu bg-base-100 h-full flex flex-col justify-between",
624
- style: X({ width: e.widthSidebar + "px" })
625
- }, [
626
- u("ul", eo, [
627
- (r(!0), f(L, null, M(e.menu, (s) => (r(), f("li", {
628
- key: s.label
629
- }, [
630
- V(g(Ne), {
631
- to: { name: s.routerLink, params: s.params }
632
- }, {
633
- default: S(() => [
634
- E(w(s.label), 1)
635
- ]),
636
- _: 2
637
- }, 1032, ["to"])
638
- ]))), 128))
639
- ]),
640
- u("div", to, " version: " + w(e.version), 1)
641
- ], 4)
642
- ])
643
- ], 2)
644
- ])
645
- ], 64));
646
- }
647
- }), oo = {
648
- currentPage: { type: Number, required: !0 },
649
- page: { type: Number, required: !0 },
650
- label: { type: String, required: !0 },
651
- neverActive: { type: Boolean, default: !1 },
652
- disabled: { type: Boolean, default: !1 }
653
- }, so = ["updatePage", "updatePageSize"], J = /* @__PURE__ */ k({
654
- __name: "pagination-button.component",
655
- props: oo,
656
- emits: so,
657
- setup(e, { emit: t }) {
658
- const o = e, n = t, l = v(
659
- () => o.neverActive ? !1 : o.page === o.currentPage
660
- ), a = v(() => o.neverActive ? z.blank : l.value ? z.primary : z.secondary), c = () => {
661
- n("updatePage", o.page);
662
- };
663
- return (d, p) => (r(), y(g(N), {
664
- disabled: d.disabled,
665
- square: !0,
666
- size: "xs",
667
- color: a.value,
668
- onClick: p[0] || (p[0] = (i) => c())
669
- }, {
670
- default: S(() => [
671
- E(w(d.label), 1)
672
- ]),
673
- _: 1
674
- }, 8, ["disabled", "color"]));
675
- }
676
- }), no = {
677
- totalItems: { type: Number, default: 0 },
678
- itemsPerPage: { type: Number, default: 1 },
679
- currentPage: { type: Number, default: 1 }
680
- }, lo = ["updatePage", "updatePageSize"], ao = { class: "flex gap-2" }, ro = { class: "flex flex-1 justify-center items-center" }, io = { class: "flex gap-1" }, uo = { class: "text-sm" }, Q = 6, co = /* @__PURE__ */ k({
681
- __name: "pagination.component",
682
- props: no,
683
- emits: lo,
684
- setup(e, { emit: t }) {
685
- const o = e, n = t, l = v(() => {
686
- let s = Math.ceil(o.totalItems / o.itemsPerPage);
687
- return s < 1 ? 1 : s;
688
- }), a = Q / 2, c = v(() => {
689
- if (l.value <= Q)
690
- return {
691
- min: 1,
692
- max: l.value
693
- };
694
- let s = o.currentPage - a;
695
- s <= 1 ? s = 1 : s + Q > l.value && (s = l.value - Q);
696
- let m = s + Q;
697
- return {
698
- min: s,
699
- max: m
700
- };
701
- }), d = (s) => ({
702
- label: "...",
703
- currentPage: s,
704
- page: -10,
705
- disabled: !0,
706
- neverActive: !0
707
- }), p = v(() => {
708
- let s = l.value;
709
- s < 1 && (s = 1);
710
- const m = o.currentPage, b = [], { min: h, max: D } = c.value;
711
- return Array.from({ length: s }, (H, A) => {
712
- const C = A + 1;
713
- C !== 1 && C !== s && (C > D || C < h) || (C === s && s > 1 && D < s && b.push(d(m)), b.push({
714
- label: `${C}`,
715
- totalPages: s,
716
- currentPage: m,
717
- page: C
718
- }), C === 1 && s > 1 && h > 1 && b.push(d(m)));
719
- }), b;
720
- }), i = (s) => {
721
- n("updatePage", s);
722
- };
723
- return (s, m) => (r(), f("div", ao, [
724
- u("div", ro, [
725
- u("div", io, [
726
- V(J, B(o, {
727
- page: 1,
728
- label: "<<",
729
- "current-page": s.currentPage,
730
- "never-active": !0,
731
- disabled: s.currentPage === 1,
732
- onUpdatePage: i
733
- }), null, 16, ["current-page", "disabled"]),
734
- V(J, B(o, {
735
- page: s.currentPage - 1,
736
- label: "<",
737
- "current-page": s.currentPage,
738
- "never-active": !0,
739
- disabled: s.currentPage === 1,
740
- onUpdatePage: i
741
- }), null, 16, ["page", "current-page", "disabled"]),
742
- (r(!0), f(L, null, M(p.value, (b) => (r(), y(J, B({
743
- key: b.page,
744
- ref_for: !0
745
- }, b, { onUpdatePage: i }), null, 16))), 128)),
746
- V(J, B(o, {
747
- page: s.currentPage + 1,
748
- label: ">",
749
- "current-page": s.currentPage,
750
- "never-active": !0,
751
- disabled: o.currentPage === l.value,
752
- onUpdatePage: i
753
- }), null, 16, ["page", "current-page", "disabled"]),
754
- V(J, B(o, {
755
- page: l.value,
756
- label: ">>",
757
- "current-page": s.currentPage,
758
- "never-active": !0,
759
- disabled: o.currentPage === l.value,
760
- onUpdatePage: i
761
- }), null, 16, ["page", "current-page", "disabled"])
762
- ])
763
- ]),
764
- u("div", uo, " page " + w(s.currentPage) + " of " + w(l.value), 1)
765
- ]));
766
- }
767
- }), Be = {
768
- data: { type: Object, required: !0 },
769
- column: { type: Object, required: !0 },
770
- options: { type: Object }
771
- }, Cn = /* @__PURE__ */ k({
772
- __name: "text.cell",
773
- props: Be,
774
- setup(e) {
775
- const t = e, o = v(() => {
776
- const n = t.data[t.column.id];
777
- return n ? t.column.options?.format === "keyValue" ? n[t.column.options.key] : n : null;
778
- });
779
- return (n, l) => w(o.value);
780
- }
781
- }), po = {
782
- column: { type: Object, required: !0 },
783
- sortColumn: { type: String },
784
- sortDirection: { type: String }
785
- }, fo = ["sort"], mo = { class: "flex-grow pr-2" }, bo = { class: "h-4 w-4" }, go = /* @__PURE__ */ k({
786
- __name: "sort.header",
787
- props: po,
788
- emits: fo,
789
- setup(e, { emit: t }) {
790
- const o = e, n = t, l = v(
791
- () => o.sortDirection === "asc" ? R.BarsArrowUp : R.BarsArrowDown
792
- ), a = v(() => o.column.options?.sortId ?? o.column.id), c = () => {
793
- n("sort", a.value);
794
- };
795
- return (d, p) => (r(), f("button", {
796
- class: "flex items-center",
797
- onClick: c
798
- }, [
799
- u("span", mo, w(d.column.label), 1),
800
- u("div", bo, [
801
- d.sortColumn === a.value ? (r(), y(g(q), {
802
- key: 0,
803
- icon: l.value
804
- }, null, 8, ["icon"])) : _("", !0)
805
- ])
806
- ]));
807
- }
808
- }), vo = {
809
- loading: { type: Boolean, default: !1 },
810
- actions: { type: Array },
811
- data: { type: Array },
812
- displayColumns: {
813
- type: Array,
814
- required: !0
815
- },
816
- page: { type: Object },
817
- sort: { type: Object }
818
- }, ho = ["updatePage", "sort"], yo = { class: "table w-full" }, wo = { key: 0 }, ko = ["colspan"], _o = ["ui-id"], $o = { class: "flex gap-2" }, xn = /* @__PURE__ */ k({
819
- __name: "table.component",
820
- props: vo,
821
- emits: ho,
822
- setup(e, { emit: t }) {
823
- const o = t, n = Ie(), l = v(() => "onEdit" in n), a = v(() => "onDelete" in n), c = (s) => {
824
- n.onEdit?.(s);
825
- }, d = (s) => {
826
- n.onDelete?.(s);
827
- }, p = (s) => {
828
- o("updatePage", s);
829
- }, i = (s) => {
830
- o("sort", s);
831
- };
832
- return (s, m) => (r(), f(L, null, [
833
- u("table", yo, [
834
- u("thead", null, [
835
- u("tr", null, [
836
- (r(!0), f(L, null, M(s.displayColumns, (b) => (r(), f("th", {
837
- key: b.scope
838
- }, [
839
- V(go, B({ column: b }, { ref_for: !0 }, s.sort, { onSort: i }), null, 16, ["column"])
840
- ]))), 128)),
841
- m[0] || (m[0] = u("th", null, null, -1))
842
- ])
843
- ]),
844
- u("tbody", null, [
845
- s.loading ? (r(), f("tr", wo, [
846
- u("td", {
847
- colspan: s.displayColumns.length + 1,
848
- class: "text-center"
849
- }, [...m[1] || (m[1] = [
850
- u("span", { class: "loading loading-bars loading-xs" }, null, -1)
851
- ])], 8, ko)
852
- ])) : _("", !0),
853
- (r(!0), f(L, null, M(s.data, (b) => (r(), f("tr", {
854
- key: b.id,
855
- "ui-id": `table_${b.id}`
856
- }, [
857
- (r(!0), f(L, null, M(s.displayColumns, (h) => (r(), f("td", {
858
- key: h.scope
859
- }, [
860
- (r(), y(ne(h.component), B({ ref_for: !0 }, h, {
861
- data: b,
862
- column: h
863
- }), null, 16, ["data", "column"]))
864
- ]))), 128)),
865
- u("td", null, [
866
- u("span", $o, [
867
- (r(!0), f(L, null, M(s.actions, (h) => (r(), y(N, {
868
- key: h.label,
869
- "aria-label": h.label,
870
- icon: h.icon,
871
- outline: !0,
872
- onClick: (D) => h.action(b)
873
- }, {
874
- default: S(() => [
875
- E(w(h.label), 1)
876
- ]),
877
- _: 2
878
- }, 1032, ["aria-label", "icon", "onClick"]))), 128)),
879
- l.value ? (r(), y(N, {
880
- key: 0,
881
- "aria-label": "Edit",
882
- icon: g(R).Edit,
883
- outline: !0,
884
- onClick: (h) => c(b)
885
- }, null, 8, ["icon", "onClick"])) : _("", !0),
886
- a.value ? (r(), y(N, {
887
- key: 1,
888
- "aria-label": "Delete",
889
- icon: g(R).Delete,
890
- outline: !0,
891
- onClick: (h) => d(b)
892
- }, null, 8, ["icon", "onClick"])) : _("", !0)
893
- ])
894
- ])
895
- ], 8, _o))), 128))
896
- ])
897
- ]),
898
- s.page ? (r(), y(co, {
899
- key: 0,
900
- class: "border-gray-300 border-t pt-4 border-x-0 border-b-0",
901
- "total-items": s.page.count,
902
- "items-per-page": s.page.pageSize,
903
- "current-page": s.page.page,
904
- onUpdatePage: p
905
- }, null, 8, ["total-items", "items-per-page", "current-page"])) : _("", !0)
906
- ], 64));
907
- }
908
- }), Co = { class: "flex justify-center" }, Ln = /* @__PURE__ */ k({
909
- __name: "boolean.cell",
910
- props: Be,
911
- setup(e) {
912
- const t = e, o = v(() => {
913
- const n = t.data[t.column.id];
914
- return n ? t.column.options?.format === "keyValue" ? n[t.column.options.key] : n : null;
915
- });
916
- return (n, l) => (r(), f("div", Co, [
917
- o.value === !0 ? (r(), y(q, {
918
- key: 0,
919
- icon: g(R).Check,
920
- size: "sm"
921
- }, null, 8, ["icon"])) : _("", !0)
922
- ]));
923
- }
924
- }), xo = (e, t) => {
925
- const o = e.__vccOpts || e;
926
- for (const [n, l] of t)
927
- o[n] = l;
928
- return o;
929
- }, Lo = {}, So = { class: "card bg-base-100 shadow-sm" }, Po = { class: "card-body" }, Mo = {
930
- key: 0,
931
- class: "card-title"
932
- }, Bo = {
933
- key: 1,
934
- class: "card-actions justify-end"
21
+ var ue = W(["M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"]), de = W(["M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0-3.75-3.75M17.25 21 21 17.25"]), fe = W(["M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"]), pe = W(["m4.5 12.75 6 6 9-13.5"]), me = W(["m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5"]), he = W(["m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5"]), ge = W(["m19.5 8.25-7.5 7.5-7.5-7.5"]), _e = W(["M15.75 19.5 8.25 12l7.5-7.5"]), ve = W(["m8.25 4.5 7.5 7.5-7.5 7.5"]), ye = W(["m4.5 15.75 7.5-7.5 7.5 7.5"]), be = W(["M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"]), xe = W(["M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z", "M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"]), Se = W(["M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"]), Ce = W(["m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"]), we = W(["M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"]), Te = W(["m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"]), Ee = W(["m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"]), De = W(["M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"]), Oe = W(["m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"]), ke = W(["M6 18 18 6M6 6l12 12"]), Ae = W(["M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"]), je = W(["M3 4a1 1 0 011-1h16a1 1 0 011 1v2a1 1 0 01-.293.707L13 13.414V19a1 1 0 01-.553.894l-4 2A1 1 0 017 21v-7.586L3.293 6.707A1 1 0 013 6V4z"]), G = /* @__PURE__ */ function(e) {
22
+ return e.Edit = "Edit", e.Delete = "Delete", e.BarsArrowDown = "BarsArrowDown", e.BarsArrowUp = "BarsArrowUp", e.Funnel = "Funnel", e.Close = "Close", e.Plus = "Plus", e.PaperClip = "PaperClip", e.Hamburger = "Hamburger", e.ChevronRight = "ChevronRight", e.ChevronLeft = "ChevronLeft", e.ChevronDown = "ChevronDown", e.ChevronUp = "ChevronUp", e.DblChevronLeft = "DblChevronLeft", e.DblChevronRight = "DblChevronRight", e.Language = "Language", e.Check = "Check", e.View = "View", e.Text = "Text", e.Link = "Link", e.Filter = "Filter", e.Sync = "Sync", e;
23
+ }({}), Me = {
24
+ Edit: Ee,
25
+ Delete: Oe,
26
+ BarsArrowDown: de,
27
+ BarsArrowUp: fe,
28
+ Funnel: Se,
29
+ Close: ke,
30
+ Plus: De,
31
+ PaperClip: Te,
32
+ Hamburger: ue,
33
+ ChevronRight: ve,
34
+ ChevronLeft: _e,
35
+ ChevronDown: ge,
36
+ ChevronUp: ye,
37
+ DblChevronLeft: me,
38
+ DblChevronRight: he,
39
+ Language: Ce,
40
+ Check: pe,
41
+ View: xe,
42
+ Text: be,
43
+ Link: we,
44
+ Filter: je,
45
+ Sync: Ae
46
+ }, Ne = {
47
+ icon: { type: [
48
+ String,
49
+ Object,
50
+ Function
51
+ ] },
52
+ size: { type: String }
53
+ }, K = /* @__PURE__ */ x({
54
+ __name: "icon",
55
+ props: Ne,
56
+ setup(e) {
57
+ let t = e, n = p(() => t.icon ? typeof t.icon == "string" ? Me[t.icon] : t.icon : null);
58
+ return (e, t) => n.value ? (j(), m(F(n.value), {
59
+ key: 0,
60
+ "aria-hidden": "true",
61
+ class: O([{
62
+ "w-full h-full": !e.size,
63
+ "w-2 h-2": e.size === "xs",
64
+ "w-4 h-4": e.size === "sm",
65
+ "w-6 h-6": e.size === "lg",
66
+ "w-8 h-8": e.size === "xl"
67
+ }])
68
+ }, null, 8, ["class"])) : h("", !0);
69
+ }
70
+ }), Pe = { class: "dropdown dropdown-end" }, Fe = {
71
+ tabindex: "0",
72
+ role: "menu",
73
+ class: "menu dropdown-content bg-white z-1 mt-4 p-2 shadow-sm"
74
+ }, Ie = { class: "min-w-max flex-no-wrap text-black" }, q = /* @__PURE__ */ x({
75
+ __name: "sub-menu",
76
+ props: {
77
+ label: {},
78
+ items: {},
79
+ action: { type: Function },
80
+ disabled: { type: Boolean },
81
+ btnClass: {},
82
+ disableArrow: { type: Boolean }
83
+ },
84
+ setup(e) {
85
+ return (t, n) => (j(), g("div", Pe, [_("div", {
86
+ tabindex: "0",
87
+ role: "button",
88
+ "aria-haspopup": "menu",
89
+ class: O([e.btnClass, "btn btn-ghost text-right flex-nowrap flex"])
90
+ }, [_("span", null, I(e.label), 1), e.disableArrow ? h("", !0) : (j(), m(R(K), {
91
+ key: 0,
92
+ icon: R(G).ChevronDown,
93
+ size: "sm"
94
+ }, null, 8, ["icon"]))], 2), _("ul", Fe, [_("li", Ie, [(j(!0), g(l, null, N(e.items, (e) => (j(), m(Le, E({ key: e.label }, { ref_for: !0 }, e), null, 16))), 128))])])]));
95
+ }
96
+ }), J = "btn btn-ghost text-left justify-between min-w-max font-normal", Le = /* @__PURE__ */ x({
97
+ __name: "menu-item",
98
+ props: {
99
+ label: {},
100
+ items: {},
101
+ action: {},
102
+ disabled: {
103
+ type: Boolean,
104
+ default: !1
105
+ }
106
+ },
107
+ setup(e) {
108
+ let t = e, n = p(() => !t.disabled && t.action && "routerLink" in t.action), r = p(() => !t.disabled && t.action), i = p(() => t.items?.length), a = p(() => {
109
+ let e = t.action;
110
+ return e && "routerLink" in e && "params" in e ? {
111
+ name: e.routerLink,
112
+ params: e.params
113
+ } : "";
114
+ }), o = () => {
115
+ t.action?.();
116
+ };
117
+ return (s, c) => {
118
+ let l = ne("RouterLink");
119
+ return i.value ? (j(), m(q, E({ key: 0 }, t, { "btn-class": J }), null, 16)) : n.value ? (j(), m(l, {
120
+ key: 1,
121
+ to: a.value,
122
+ class: O(J),
123
+ onClick: o
124
+ }, {
125
+ default: V(() => [v(I(e.label), 1)]),
126
+ _: 1
127
+ }, 8, ["to"])) : r.value ? (j(), g("button", {
128
+ key: 2,
129
+ class: O(J),
130
+ onClick: o
131
+ }, I(e.label), 1)) : (j(), g("div", {
132
+ key: 3,
133
+ class: O([J, { "btn-disabled": e.disabled }])
134
+ }, I(e.label), 3));
135
+ };
136
+ }
137
+ }), Re = { class: "navbar bg-base-100 shadow-sm" }, ze = { class: "flex-1" }, Be = {
138
+ key: 0,
139
+ class: "breadcrumbs text-sm"
140
+ }, Ve = { class: "flex grow justify-end px-2" }, He = { class: "flex items-stretch" }, Ue = /* @__PURE__ */ x({
141
+ __name: "menu",
142
+ props: {
143
+ menu: {},
144
+ breadcrumbs: {}
145
+ },
146
+ setup(e) {
147
+ return (t, n) => {
148
+ let r = ne("RouterLink");
149
+ return j(), g("nav", Re, [_("div", ze, [e.breadcrumbs ? (j(), g("div", Be, [_("ul", null, [(j(!0), g(l, null, N(e.breadcrumbs, (e) => (j(), g("li", { key: e.label }, [e.routerLink ? (j(), m(r, {
150
+ key: 0,
151
+ to: {
152
+ name: e.routerLink,
153
+ params: e.params
154
+ },
155
+ role: "navigation",
156
+ "aria-label": e.label
157
+ }, {
158
+ default: V(() => [v(I(e.label), 1)]),
159
+ _: 2
160
+ }, 1032, ["to", "aria-label"])) : (j(), g(l, { key: 1 }, [v(I(e.label), 1)], 64))]))), 128))])])) : h("", !0)]), _("div", Ve, [_("div", He, [(j(!0), g(l, null, N(e.menu, (e) => (j(), m(Le, E({ key: e.label }, { ref_for: !0 }, e), null, 16))), 128))])])]);
161
+ };
162
+ }
163
+ }), We = /* @__PURE__ */ x({
164
+ __name: "dropdown",
165
+ props: { items: {} },
166
+ setup(e) {
167
+ let t = M(!0);
168
+ return (n, r) => (j(), m(q, {
169
+ items: e.items,
170
+ label: "test",
171
+ open: t.value,
172
+ "btn-class": "",
173
+ "disable-arrow": !0
174
+ }, null, 8, ["items", "open"]));
175
+ }
176
+ }), Ge = {
177
+ modalTitle: {
178
+ type: String,
179
+ required: !0
180
+ },
181
+ buttonLabel: { type: String },
182
+ buttonSaveLabel: { type: String },
183
+ data: { default: void 0 },
184
+ open: {
185
+ type: Boolean,
186
+ default: !1
187
+ },
188
+ disableClose: {
189
+ type: Boolean,
190
+ default: !1
191
+ },
192
+ width: {
193
+ type: String,
194
+ default: "sm"
195
+ }
196
+ }, Ke = ["closeModal"], qe = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Je = (e) => Array.from(e.querySelectorAll(qe)), Ye = ({ containerRef: e, isActive: t, onEscape: n, restoreFocus: r = !0 }) => {
197
+ let i = null, a = (t) => {
198
+ let r = e.value;
199
+ if (!r) return;
200
+ if (t.key === "Escape") {
201
+ n?.();
202
+ return;
203
+ }
204
+ if (t.key !== "Tab") return;
205
+ let i = Je(r);
206
+ if (i.length === 0) return;
207
+ let a = i[0], o = i[i.length - 1];
208
+ t.shiftKey ? document.activeElement === a && (t.preventDefault(), o.focus()) : document.activeElement === o && (t.preventDefault(), a.focus());
209
+ }, o = () => {
210
+ let t = e.value;
211
+ if (!t) return;
212
+ i = document.activeElement, document.addEventListener("keydown", a);
213
+ let n = Je(t);
214
+ n.length > 0 && n[0].focus();
215
+ }, s = () => {
216
+ document.removeEventListener("keydown", a), r && i && (i.focus(), i = null);
217
+ };
218
+ B(t, (e) => {
219
+ e ? o() : s();
220
+ }, { immediate: !0 }), te(() => {
221
+ s();
222
+ });
223
+ }, Xe = {
224
+ xs: "max-w-xs w-[50VW]",
225
+ sm: "max-w-sm w-[50VW]",
226
+ lg: "max-w-2xl w-[80VW]",
227
+ xl: "max-w-[80VW] w-[80VW]"
228
+ }, Ze = {
229
+ xs: "btn-xs",
230
+ sm: "btn-sm",
231
+ lg: "btn-sm",
232
+ xl: "btn"
233
+ }, Qe = {
234
+ xs: "badge-xs text-xxs",
235
+ sm: "badge-sm text-xs",
236
+ lg: "badge-sm text-xs",
237
+ xl: "badge text-xs"
238
+ }, $e = { class: "flex justify-end gap-2 pt-2 mt-2 border-t border-gray-300 shrink-0" }, et = /* @__PURE__ */ x({
239
+ __name: "modal",
240
+ props: Ge,
241
+ emits: Ke,
242
+ setup(e, { expose: t, emit: n }) {
243
+ let r = e, i = `modal_${crypto.randomUUID()}`, a = `${i}_title`, o = `${i}_content`, s = M(null), c = M(!1), l = n, u = () => {
244
+ s.value?.showModal(), c.value = !0;
245
+ }, d = () => {
246
+ s.value?.close(), c.value = !1, l("closeModal");
247
+ }, f = () => {
248
+ r.disableClose || d();
249
+ };
250
+ return Ye({
251
+ containerRef: s,
252
+ isActive: c,
253
+ onEscape: () => {
254
+ r.disableClose || d();
255
+ }
256
+ }), t({
257
+ closeModal: d,
258
+ openModal: u
259
+ }), B(() => r.open, () => {
260
+ r.open ? u() : d();
261
+ }), ee(() => {
262
+ r.open && u();
263
+ }), (e, t) => (j(), g("dialog", {
264
+ ref_key: "dialogRef",
265
+ ref: s,
266
+ class: "modal",
267
+ role: "dialog",
268
+ "aria-modal": "true",
269
+ "aria-labelledby": a,
270
+ "aria-describedby": o,
271
+ onCancel: U(f, ["prevent"])
272
+ }, [_("div", { class: O(["modal-box bg-white min-h-0 max-h-[90vh] flex flex-col overflow-hidden", R(Xe)[e.width]]) }, [
273
+ e.disableClose ? h("", !0) : (j(), g("button", {
274
+ key: 0,
275
+ type: "button",
276
+ class: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2",
277
+ "aria-label": "Close",
278
+ onClick: d
279
+ }, "")),
280
+ e.$slots.title ? P(e.$slots, "title", { key: 1 }) : (j(), g("h3", {
281
+ key: 2,
282
+ id: a,
283
+ class: "font-bold shrink-0"
284
+ }, I(e.modalTitle), 1)),
285
+ _("div", {
286
+ id: o,
287
+ class: "pt-4 flex-1 min-h-0 flex flex-col"
288
+ }, [P(e.$slots, "content")]),
289
+ _("div", $e, [P(e.$slots, "actions")])
290
+ ], 2)], 544));
291
+ }
292
+ }), Y = /* @__PURE__ */ function(e) {
293
+ return e.button = "button", e.submit = "submit", e.reset = "reset", e;
294
+ }({}), tt = /* @__PURE__ */ function(e) {
295
+ return e.a = "a", e.button = "button", e;
296
+ }({}), X = /* @__PURE__ */ function(e) {
297
+ return e.blank = "blank", e.primary = "primary", e.secondary = "secondary", e.error = "error", e.ghost = "ghost", e;
298
+ }({}), nt = {
299
+ blank: "btn-ghost",
300
+ primary: "btn-primary",
301
+ secondary: "btn-soft btn-primary",
302
+ error: "btn-error",
303
+ ghost: "btn-ghost"
304
+ }, rt = {
305
+ blank: "badge-ghost",
306
+ primary: "badge-primary",
307
+ secondary: "badge-soft badge-primary",
308
+ error: "badge-error",
309
+ ghost: "badge-ghost"
310
+ }, it = {
311
+ href: { type: String },
312
+ disabled: {
313
+ type: Boolean,
314
+ default: !1
315
+ },
316
+ tooltip: { type: String },
317
+ as: {
318
+ type: String,
319
+ default: tt.button
320
+ },
321
+ icon: { type: [
322
+ String,
323
+ Object,
324
+ Function
325
+ ] },
326
+ type: {
327
+ type: String,
328
+ default: Y.button
329
+ },
330
+ outline: {
331
+ type: Boolean,
332
+ default: !1
333
+ },
334
+ color: {
335
+ type: String,
336
+ default: X.primary
337
+ },
338
+ size: {
339
+ type: String,
340
+ default: "sm"
341
+ },
342
+ square: {
343
+ type: Boolean,
344
+ default: !1
345
+ },
346
+ noBorder: {
347
+ type: Boolean,
348
+ default: !1
349
+ }
350
+ }, at = ["click"], ot = {
351
+ icon: { type: [
352
+ String,
353
+ Object,
354
+ Function
355
+ ] },
356
+ type: {
357
+ type: String,
358
+ default: Y.button
359
+ },
360
+ color: {
361
+ type: String,
362
+ default: X.primary
363
+ },
364
+ disabled: {
365
+ type: Boolean,
366
+ default: !1
367
+ },
368
+ size: {
369
+ type: String,
370
+ default: "sm"
371
+ }
372
+ }, st = ["click"], ct = {
373
+ key: 1,
374
+ class: "whitespace-nowrap"
375
+ }, Z = /* @__PURE__ */ x({
376
+ __name: "btn",
377
+ props: it,
378
+ emits: at,
379
+ setup(e, { emit: t }) {
380
+ let n = e, r = t;
381
+ return (e, t) => (j(), m(F(n.as), {
382
+ class: O([
383
+ "btn p-1 flex justify-center flex-nowrap",
384
+ R(nt)[n.color],
385
+ R(Ze)[n.size],
386
+ {
387
+ "btn-outline": n.outline,
388
+ "btn-square": n.square,
389
+ tooltip: n.tooltip,
390
+ "border-0": n.noBorder
391
+ }
392
+ ]),
393
+ href: n.href,
394
+ type: n.type,
395
+ disabled: n.disabled,
396
+ "data-tip": n.tooltip,
397
+ onClick: t[0] ||= (e) => r("click")
398
+ }, {
399
+ default: V(() => [n.icon ? (j(), m(R(K), {
400
+ key: 0,
401
+ icon: n.icon
402
+ }, null, 8, ["icon"])) : h("", !0), e.$slots.default ? (j(), g("span", ct, [P(e.$slots, "default")])) : h("", !0)]),
403
+ _: 3
404
+ }, 8, [
405
+ "class",
406
+ "href",
407
+ "type",
408
+ "disabled",
409
+ "data-tip"
410
+ ]));
411
+ }
412
+ }), lt = ["type", "disabled"], ut = /* @__PURE__ */ x({
413
+ __name: "btn-badge",
414
+ props: ot,
415
+ emits: st,
416
+ setup(e, { emit: t }) {
417
+ let n = e, r = t;
418
+ return (e, t) => (j(), g("button", {
419
+ class: O([
420
+ "badge gap-1",
421
+ R(Qe)[n.size],
422
+ R(rt)[n.color]
423
+ ]),
424
+ type: n.type,
425
+ disabled: n.disabled,
426
+ onClick: t[0] ||= (e) => r("click")
427
+ }, [P(e.$slots, "default"), n.icon ? (j(), m(R(K), {
428
+ key: 0,
429
+ icon: n.icon,
430
+ size: n.size
431
+ }, null, 8, ["icon", "size"])) : h("", !0)], 10, lt));
432
+ }
433
+ }), dt = /* @__PURE__ */ x({
434
+ __name: "confirmModal",
435
+ props: {
436
+ title: {},
437
+ message: {},
438
+ confirmLabel: { default: "Ok" },
439
+ cancelLabel: { default: "Cancel" }
440
+ },
441
+ emits: ["closeModal"],
442
+ setup(e, { emit: t }) {
443
+ let n = t, r = (e) => {
444
+ n("closeModal", { confirmed: e });
445
+ };
446
+ return (t, n) => (j(), m(et, {
447
+ "modal-title": e.title,
448
+ open: !0,
449
+ "disable-close": !0
450
+ }, {
451
+ content: V(() => [v(I(e.message), 1)]),
452
+ actions: V(() => [y(R(Z), {
453
+ color: R(X).secondary,
454
+ outline: !0,
455
+ "aria-label": e.cancelLabel,
456
+ onClick: n[0] ||= (e) => r(!1)
457
+ }, {
458
+ default: V(() => [v(I(e.cancelLabel), 1)]),
459
+ _: 1
460
+ }, 8, ["color", "aria-label"]), y(R(Z), {
461
+ "aria-label": e.confirmLabel,
462
+ onClick: n[1] ||= (e) => r(!0)
463
+ }, {
464
+ default: V(() => [v(I(e.confirmLabel), 1)]),
465
+ _: 1
466
+ }, 8, ["aria-label"])]),
467
+ _: 1
468
+ }, 8, ["modal-title"]));
469
+ }
470
+ }), ft = class e {
471
+ constructor() {
472
+ this.showModal = M(!1), this.modals = [];
473
+ }
474
+ openModal(e) {
475
+ let t = e.props.onClose, n = crypto.randomUUID(), r = e;
476
+ e.props.onClose = (e) => {
477
+ t(e), this.closeModal(n);
478
+ }, r.id = n, this.modals = [...this.modals, r], this.showModal.value = Date.now();
479
+ }
480
+ closeModal(e) {
481
+ this.modals = this.modals.filter((t) => t.id !== e), this.showModal.value = Date.now();
482
+ }
483
+ static showConfirm(e) {
484
+ this.getInstance().openModal({
485
+ component: dt,
486
+ props: e
487
+ });
488
+ }
489
+ static openModal(e) {
490
+ this.getInstance().openModal(e);
491
+ }
492
+ static getInstance() {
493
+ return this.instance ||= new e(), this.instance;
494
+ }
495
+ static closeAll() {
496
+ this.instance.closeAll();
497
+ }
498
+ closeAll() {
499
+ this.modals = [], this.showModal.value = !1;
500
+ }
501
+ }, pt = /* @__PURE__ */ x({
502
+ __name: "modalWrapper",
503
+ setup(e) {
504
+ let t = ft.getInstance(), n = p(() => t.showModal.value ? t.modals : []);
505
+ return (e, t) => (j(!0), g(l, null, N(n.value, (e) => (j(), m(F(e?.component), E({
506
+ key: e.id,
507
+ ref_for: !0
508
+ }, e?.props, {
509
+ open: !0,
510
+ onCloseModal: e?.props?.onClose
511
+ }), null, 16, ["onCloseModal"]))), 128));
512
+ }
513
+ }), mt = /* @__PURE__ */ x({
514
+ __name: "notification-message",
515
+ props: {
516
+ message: {},
517
+ type: {}
518
+ },
519
+ setup(e) {
520
+ let t = {
521
+ success: "alert-success",
522
+ error: "alert-error",
523
+ warning: "alert-warning",
524
+ info: "alert-info"
525
+ };
526
+ return (n, r) => (j(), g("div", {
527
+ role: "alert",
528
+ class: O(`alert ${t[e.type]} `)
529
+ }, [_("span", null, I(e.message), 1)], 2));
530
+ }
531
+ }), ht = 5e3, gt = class e {
532
+ constructor() {
533
+ this.notifications = M([]), this.addNotification = (e, t = "info") => {
534
+ let n = {
535
+ id: crypto.randomUUID(),
536
+ duration: ht,
537
+ message: e,
538
+ type: t
539
+ };
540
+ this.notifications.value.push(n), this.removeNotificationAfterDuration(n);
541
+ }, this.removeNotificationAfterDuration = (e) => {
542
+ setTimeout(() => {
543
+ this.removeNotification(e.id);
544
+ }, e.duration);
545
+ }, this.removeNotification = (e) => {
546
+ this.notifications.value = this.notifications.value.filter((t) => t.id !== e);
547
+ };
548
+ }
549
+ static getInstance() {
550
+ return this.instance ||= new e(), this.instance;
551
+ }
552
+ static info(e) {
553
+ this.getInstance().addNotification(e, "info");
554
+ }
555
+ static success(e) {
556
+ this.getInstance().addNotification(e, "success");
557
+ }
558
+ static warning(e) {
559
+ this.getInstance().addNotification(e, "warning");
560
+ }
561
+ static error(e) {
562
+ this.getInstance().addNotification(e, "error");
563
+ }
564
+ static removeNotification(e) {
565
+ this.getInstance().removeNotification(e);
566
+ }
567
+ }, _t = { class: "toast toast-top toast-center z-[999]" }, vt = /* @__PURE__ */ x({
568
+ __name: "notifications",
569
+ setup(e) {
570
+ let t = gt.getInstance();
571
+ return (e, n) => (j(), g("div", _t, [(j(!0), g(l, null, N(R(t).notifications.value, (e) => (j(), m(mt, E({ key: e.id }, { ref_for: !0 }, e), null, 16))), 128))]));
572
+ }
573
+ }), yt = { class: "flex h-screen flex-col" }, bt = { class: "shrink-0" }, xt = { class: "navbar bg-primary text-primary-content w-full z-100" }, St = {
574
+ key: 0,
575
+ class: "navbar-start"
576
+ }, Ct = { class: "navbar-center" }, wt = ["href"], Tt = { class: "navbar-end" }, Et = { class: "drawer-content overflow-y-auto mb-2 mr-2 shadow-md" }, Dt = { class: "drawer-side h-full shadow-md" }, Ot = { class: "flex-grow overflow-y-auto" }, kt = { class: "bg-base-200 p-4" }, At = /* @__PURE__ */ x({
577
+ __name: "shell.component",
578
+ props: {
579
+ title: {},
580
+ menu: {},
581
+ user: {},
582
+ version: {},
583
+ widthSidebar: { default: 300 }
584
+ },
585
+ emits: ["logout"],
586
+ setup(e, { emit: t }) {
587
+ let n = e, r = M(!1), i = () => {
588
+ r.value = !r.value;
589
+ }, a = t, o = p(() => n.user ? {
590
+ label: n.user.name,
591
+ items: [{
592
+ label: "Logout",
593
+ action: () => {
594
+ a("logout");
595
+ }
596
+ }]
597
+ } : null);
598
+ return (t, n) => (j(), g(l, null, [
599
+ y(vt),
600
+ y(R(pt)),
601
+ _("div", yt, [_("header", bt, [_("nav", xt, [
602
+ e.menu?.length ? (j(), g("div", St, [_("button", {
603
+ "aria-label": "open sidebar",
604
+ class: "btn btn-square btn-ghost p-1",
605
+ onClick: i
606
+ }, [y(R(K), { icon: R(G).Hamburger }, null, 8, ["icon"])])])) : h("", !0),
607
+ _("div", Ct, [_("a", {
608
+ class: "btn btn-ghost text-primary-content text-lg color-white",
609
+ href: R("/")
610
+ }, I(e.title), 9, wt)]),
611
+ _("div", Tt, [o.value ? (j(), m(R(q), E({ key: 0 }, o.value, { "btn-class": "" }), null, 16)) : h("", !0)])
612
+ ])]), _("div", { class: O(["drawer flex-1 overflow-hidden", { "drawer-open": r.value }]) }, [
613
+ H(_("input", {
614
+ id: "app-drawer",
615
+ "onUpdate:modelValue": n[0] ||= (e) => r.value = e,
616
+ type: "checkbox",
617
+ class: "drawer-toggle"
618
+ }, null, 512), [[oe, r.value]]),
619
+ _("main", Et, [P(t.$slots, "default")]),
620
+ _("div", Dt, [n[1] ||= _("label", {
621
+ for: "app-drawer",
622
+ "aria-label": "close sidebar",
623
+ class: "drawer-overlay"
624
+ }, null, -1), _("div", {
625
+ class: "menu bg-base-100 h-full flex flex-col justify-between",
626
+ style: A({ width: e.widthSidebar + "px" })
627
+ }, [_("ul", Ot, [(j(!0), g(l, null, N(e.menu, (e) => (j(), g("li", { key: e.label }, [y(R(le), { to: {
628
+ name: e.routerLink,
629
+ params: e.params
630
+ } }, {
631
+ default: V(() => [v(I(e.label), 1)]),
632
+ _: 2
633
+ }, 1032, ["to"])]))), 128))]), _("div", kt, " version: " + I(e.version), 1)], 4)])
634
+ ], 2)])
635
+ ], 64));
636
+ }
637
+ }), Q = /* @__PURE__ */ x({
638
+ __name: "pagination-button.component",
639
+ props: {
640
+ currentPage: {
641
+ type: Number,
642
+ required: !0
643
+ },
644
+ page: {
645
+ type: Number,
646
+ required: !0
647
+ },
648
+ label: {
649
+ type: String,
650
+ required: !0
651
+ },
652
+ neverActive: {
653
+ type: Boolean,
654
+ default: !1
655
+ },
656
+ disabled: {
657
+ type: Boolean,
658
+ default: !1
659
+ }
660
+ },
661
+ emits: ["updatePage", "updatePageSize"],
662
+ setup(e, { emit: t }) {
663
+ let n = e, r = t, i = p(() => n.neverActive ? !1 : n.page === n.currentPage), a = p(() => n.neverActive ? X.blank : i.value ? X.primary : X.secondary), o = () => {
664
+ r("updatePage", n.page);
665
+ };
666
+ return (e, t) => (j(), m(R(Z), {
667
+ disabled: e.disabled,
668
+ square: !0,
669
+ size: "xs",
670
+ color: a.value,
671
+ onClick: t[0] ||= (e) => o()
672
+ }, {
673
+ default: V(() => [v(I(e.label), 1)]),
674
+ _: 1
675
+ }, 8, ["disabled", "color"]));
676
+ }
677
+ }), jt = {
678
+ totalItems: {
679
+ type: Number,
680
+ default: 0
681
+ },
682
+ itemsPerPage: {
683
+ type: Number,
684
+ default: 1
685
+ },
686
+ currentPage: {
687
+ type: Number,
688
+ default: 1
689
+ },
690
+ pageSizeOptions: {
691
+ type: Array,
692
+ default: () => [
693
+ 10,
694
+ 20,
695
+ 50,
696
+ 100
697
+ ]
698
+ }
699
+ }, Mt = ["updatePage", "updatePageSize"], Nt = { class: "flex items-center justify-between gap-4" }, Pt = { class: "flex gap-1" }, Ft = { class: "flex items-center gap-4 text-xs text-base-content/60" }, It = { class: "flex items-center gap-2 whitespace-nowrap text-sm" }, Lt = ["value"], Rt = ["value"], zt = { class: "whitespace-nowrap" }, $ = 6, Bt = /* @__PURE__ */ x({
700
+ __name: "pagination.component",
701
+ props: jt,
702
+ emits: Mt,
703
+ setup(e, { emit: t }) {
704
+ let n = e, r = t, i = p(() => {
705
+ let e = Math.ceil(n.totalItems / n.itemsPerPage);
706
+ return e < 1 ? 1 : e;
707
+ }), a = $ / 2, o = p(() => {
708
+ if (i.value <= $) return {
709
+ min: 1,
710
+ max: i.value
711
+ };
712
+ let e = n.currentPage - a;
713
+ e <= 1 ? e = 1 : e + $ > i.value && (e = i.value - $);
714
+ let t = e + $;
715
+ return {
716
+ min: e,
717
+ max: t
718
+ };
719
+ }), s = (e) => ({
720
+ label: "...",
721
+ currentPage: e,
722
+ page: -10,
723
+ disabled: !0,
724
+ neverActive: !0
725
+ }), c = p(() => {
726
+ let e = i.value;
727
+ e < 1 && (e = 1);
728
+ let t = n.currentPage, r = [], { min: a, max: c } = o.value;
729
+ return Array.from({ length: e }, (n, i) => {
730
+ let o = i + 1;
731
+ o !== 1 && o !== e && (o > c || o < a) || (o === e && e > 1 && c < e && r.push(s(t)), r.push({
732
+ label: `${o}`,
733
+ totalPages: e,
734
+ currentPage: t,
735
+ page: o
736
+ }), o === 1 && e > 1 && a > 1 && r.push(s(t)));
737
+ }), r;
738
+ }), u = p(() => {
739
+ let e = (n.currentPage - 1) * n.itemsPerPage;
740
+ return Math.min(e + n.itemsPerPage, n.totalItems);
741
+ }), d = (e) => {
742
+ r("updatePage", e);
743
+ }, f = (e) => {
744
+ r("updatePageSize", Number(e.target.value));
745
+ };
746
+ return (e, t) => (j(), g("div", Nt, [_("div", Pt, [
747
+ y(Q, E(n, {
748
+ page: 1,
749
+ label: "<<",
750
+ "current-page": e.currentPage,
751
+ "never-active": !0,
752
+ disabled: e.currentPage === 1,
753
+ onUpdatePage: d
754
+ }), null, 16, ["current-page", "disabled"]),
755
+ y(Q, E(n, {
756
+ page: e.currentPage - 1,
757
+ label: "<",
758
+ "current-page": e.currentPage,
759
+ "never-active": !0,
760
+ disabled: e.currentPage === 1,
761
+ onUpdatePage: d
762
+ }), null, 16, [
763
+ "page",
764
+ "current-page",
765
+ "disabled"
766
+ ]),
767
+ (j(!0), g(l, null, N(c.value, (e) => (j(), m(Q, E({
768
+ key: e.page,
769
+ ref_for: !0
770
+ }, e, { onUpdatePage: d }), null, 16))), 128)),
771
+ y(Q, E(n, {
772
+ page: e.currentPage + 1,
773
+ label: ">",
774
+ "current-page": e.currentPage,
775
+ "never-active": !0,
776
+ disabled: n.currentPage === i.value,
777
+ onUpdatePage: d
778
+ }), null, 16, [
779
+ "page",
780
+ "current-page",
781
+ "disabled"
782
+ ]),
783
+ y(Q, E(n, {
784
+ page: i.value,
785
+ label: ">>",
786
+ "current-page": e.currentPage,
787
+ "never-active": !0,
788
+ disabled: n.currentPage === i.value,
789
+ onUpdatePage: d
790
+ }), null, 16, [
791
+ "page",
792
+ "current-page",
793
+ "disabled"
794
+ ])
795
+ ]), _("div", Ft, [_("label", It, [t[0] ||= v(" Records per page: ", -1), _("select", {
796
+ class: "select select-xs select-bordered",
797
+ value: n.itemsPerPage,
798
+ onChange: f
799
+ }, [(j(!0), g(l, null, N(e.pageSizeOptions, (e) => (j(), g("option", {
800
+ key: e,
801
+ value: e
802
+ }, I(e), 9, Rt))), 128))], 40, Lt)]), _("span", zt, " Showing " + I(u.value) + " of " + I(e.totalItems) + " records", 1)])]));
803
+ }
804
+ }), Vt = {
805
+ column: {
806
+ type: Object,
807
+ required: !0
808
+ },
809
+ sortColumn: { type: String },
810
+ sortDirection: { type: String }
811
+ }, Ht = ["sort"], Ut = ["disabled"], Wt = { class: "whitespace-nowrap" }, Gt = { class: "h-4 w-4 relative" }, Kt = /* @__PURE__ */ x({
812
+ __name: "sort.header",
813
+ props: Vt,
814
+ emits: Ht,
815
+ setup(e, { emit: t }) {
816
+ let n = e, r = t, i = p(() => n.column.options?.sortable !== !1), a = p(() => n.sortDirection === "asc" ? G.BarsArrowUp : G.BarsArrowDown), o = p(() => n.column.options?.sortId ?? n.column.id), s = () => {
817
+ i.value && r("sort", o.value);
818
+ };
819
+ return (e, t) => (j(), g("button", {
820
+ class: O(["flex items-center gap-2", i.value ? "cursor-pointer" : "cursor-default"]),
821
+ disabled: !i.value,
822
+ onClick: s
823
+ }, [_("span", Wt, I(e.column.label), 1), _("div", Gt, [i.value && e.sortColumn === o.value ? (j(), m(R(K), {
824
+ key: 0,
825
+ icon: a.value
826
+ }, null, 8, ["icon"])) : h("", !0)])], 10, Ut));
827
+ }
828
+ }), qt = {
829
+ loading: {
830
+ type: Boolean,
831
+ default: !1
832
+ },
833
+ multiselect: {
834
+ type: Boolean,
835
+ default: !1
836
+ },
837
+ actions: { type: Array },
838
+ data: { type: Array },
839
+ displayColumns: {
840
+ type: Array,
841
+ required: !0
842
+ },
843
+ page: { type: Object },
844
+ sort: { type: Object }
845
+ }, Jt = [
846
+ "updatePage",
847
+ "updatePageSize",
848
+ "sort",
849
+ "selectionChange"
850
+ ], Yt = { class: "border border-gray-200" }, Xt = { class: "overflow-x-auto" }, Zt = { class: "w-full text-sm" }, Qt = { class: "text-xs text-text-muted font-medium border-b border-gray-200 border-solid sticky top-0 rounded-md" }, $t = { class: "border-b border-gray-200" }, en = {
851
+ key: 0,
852
+ class: "px-3 py-1 w-10 text-left border-r border-gray-200"
853
+ }, tn = ["checked", "indeterminate"], nn = { key: 0 }, rn = ["colspan"], an = { key: 1 }, on = ["colspan"], sn = ["ui-id"], cn = {
854
+ key: 0,
855
+ class: "py-1 px-3"
856
+ }, ln = ["checked", "onChange"], un = {
857
+ class: "px-3 flex items-center gap-2 rounded-sm relative border hover:bg-gray-50 hover:border-gray-200 border-transparent max-w-56",
858
+ style: {
859
+ "min-width": "100%",
860
+ "min-height": "38px"
861
+ }
862
+ }, dn = { class: "whitespace-nowrap overflow-hidden overflow-ellipsis" }, fn = { class: "align-middle p-0 sticky right-0 bg-white hover:bg-gray-50 shadow-[-4px_0_6px_-2px_rgba(0,0,0,0.05)]" }, pn = { class: "px-3 py-1 items-center justify-end gap-1 flex whitespace-nowrap" }, mn = { key: 0 }, hn = /* @__PURE__ */ x({
863
+ inheritAttrs: !1,
864
+ __name: "table.component",
865
+ props: qt,
866
+ emits: Jt,
867
+ setup(e, { emit: t }) {
868
+ let n = e, r = M(/* @__PURE__ */ new Set());
869
+ B(() => n.data, () => {
870
+ r.value.clear();
871
+ });
872
+ let i = p(() => !!n.data?.length && n.data.every((e) => r.value.has(e.id))), a = p(() => !!n.data?.some((e) => r.value.has(e.id)) && !i.value), o = (e) => {
873
+ let t = new Set(r.value);
874
+ t.has(e.id) ? t.delete(e.id) : t.add(e.id), r.value = t, u("selectionChange", n.data?.filter((e) => t.has(e.id)) ?? []);
875
+ }, s = () => {
876
+ i.value ? r.value = /* @__PURE__ */ new Set() : r.value = new Set(n.data?.map((e) => e.id) ?? []), u("selectionChange", n.data?.filter((e) => r.value.has(e.id)) ?? []);
877
+ }, c = p(() => {
878
+ let e = n.actions ?? [];
879
+ return f.value && e.push({
880
+ tooltip: "View",
881
+ icon: G.View,
882
+ action: x
883
+ }), v.value && e.push({
884
+ tooltip: "Edit",
885
+ icon: G.Edit,
886
+ action: S
887
+ }), b.value && e.push({
888
+ tooltip: "Delete",
889
+ icon: G.Delete,
890
+ action: C
891
+ }), e;
892
+ }), u = t, d = ie(), f = p(() => "onView" in d), v = p(() => "onEdit" in d), b = p(() => "onDelete" in d), x = (e) => {
893
+ d.onView?.(e);
894
+ }, S = (e) => {
895
+ d.onEdit?.(e);
896
+ }, C = (e) => {
897
+ d.onDelete?.(e);
898
+ }, w = (e) => {
899
+ u("updatePage", e);
900
+ }, T = (e) => {
901
+ u("updatePageSize", e);
902
+ }, D = (e) => {
903
+ u("sort", e);
904
+ };
905
+ return (e, t) => (j(), g("div", Yt, [_("div", Xt, [_("table", Zt, [_("thead", Qt, [_("tr", $t, [
906
+ e.multiselect ? (j(), g("th", en, [_("input", {
907
+ type: "checkbox",
908
+ checked: i.value,
909
+ indeterminate: a.value,
910
+ class: "cursor-pointer",
911
+ onChange: s
912
+ }, null, 40, tn)])) : h("", !0),
913
+ (j(!0), g(l, null, N(e.displayColumns, (t) => (j(), g("th", {
914
+ key: t.scope,
915
+ class: "relative px-3 py-1 text-left font-semibold text-text-accent hover:bg-gray-50 select-none border-r border-gray-200",
916
+ style: A(t.width ? {
917
+ width: t.width,
918
+ maxWidth: t.width,
919
+ minWidth: t.width
920
+ } : { minWidth: "150px" })
921
+ }, [y(Kt, E({ column: t }, { ref_for: !0 }, e.sort, { onSort: D }), null, 16, ["column"])], 4))), 128)),
922
+ t[0] ||= _("th", { class: "sticky right-0 w-10 cursor-grab rounded-tr-md visible bg-white shadow-[-4px_0_6px_-2px_rgba(0,0,0,0.05)]" }, " \xA0 ", -1)
923
+ ])]), _("tbody", null, [e.loading ? (j(), g("tr", nn, [_("td", {
924
+ colspan: e.displayColumns.length + 1 + +!!e.multiselect,
925
+ class: "text-center p-2"
926
+ }, [...t[1] ||= [_("span", { class: "loading loading-bars loading-xs" }, null, -1)]], 8, rn)])) : e.data?.length ? h("", !0) : (j(), g("tr", an, [_("td", {
927
+ colspan: e.displayColumns.length + 1 + +!!e.multiselect,
928
+ class: "text-center p-8 font-bold"
929
+ }, " No records found ", 8, on)])), (j(!0), g(l, null, N(e.data, (t) => (j(), g("tr", {
930
+ key: t.id,
931
+ "ui-id": `table_${t.id}`,
932
+ class: "hover:bg-gray-100 transition-none transition-colors border-b border-gray-200"
933
+ }, [
934
+ e.multiselect ? (j(), g("td", cn, [_("input", {
935
+ type: "checkbox",
936
+ checked: r.value.has(t.id),
937
+ class: "cursor-pointer",
938
+ onChange: (e) => o(t)
939
+ }, null, 40, ln)])) : h("", !0),
940
+ (j(!0), g(l, null, N(e.displayColumns, (e) => (j(), g("td", {
941
+ key: e.scope,
942
+ class: "py-1 px-3 text-sm overflow-hidden"
943
+ }, [_("div", un, [_("div", dn, [(j(), m(F(e.component), E({ ref_for: !0 }, e, {
944
+ data: t,
945
+ column: e
946
+ }), null, 16, ["data", "column"]))])])]))), 128)),
947
+ _("td", fn, [_("span", pn, [(j(!0), g(l, null, N(c.value, (e) => (j(), g(l, { key: e.label }, [!e.visible || e.visible(t) ? (j(), m(Z, {
948
+ key: 0,
949
+ "aria-label": e.tooltip ?? e.label,
950
+ icon: e.icon,
951
+ color: R(X).secondary,
952
+ size: "xs",
953
+ onClick: (n) => e.action(t)
954
+ }, {
955
+ default: V(() => [e.label ? (j(), g("span", mn, I(e.label), 1)) : h("", !0)]),
956
+ _: 2
957
+ }, 1032, [
958
+ "aria-label",
959
+ "icon",
960
+ "color",
961
+ "onClick"
962
+ ])) : h("", !0)], 64))), 128))])])
963
+ ], 8, sn))), 128))])])]), e.page ? (j(), m(Bt, {
964
+ key: 0,
965
+ class: "p-3",
966
+ "total-items": e.page.count,
967
+ "items-per-page": e.page.pageSize,
968
+ "current-page": e.page.page,
969
+ onUpdatePage: w,
970
+ onUpdatePageSize: T
971
+ }, null, 8, [
972
+ "total-items",
973
+ "items-per-page",
974
+ "current-page"
975
+ ])) : h("", !0)]));
976
+ }
977
+ }), gn = {
978
+ data: {
979
+ type: Object,
980
+ required: !0
981
+ },
982
+ column: {
983
+ type: Object,
984
+ required: !0
985
+ },
986
+ options: { type: Object }
987
+ }, _n = { class: "truncate" }, vn = ["href"], yn = /* @__PURE__ */ x({
988
+ __name: "text.cell",
989
+ props: gn,
990
+ setup(e) {
991
+ let t = e, n = p(() => {
992
+ let e = t.column.options?.dataPath ?? t.column.id, n = t.data[e];
993
+ if (n == null) return null;
994
+ let r = t.column.options?.key;
995
+ return r ? n[r] ?? null : t.column.options?.format === "keyValue" ? n[t.column.options.key] : n;
996
+ }), r = p(() => typeof n.value == "string" && n.value.startsWith("http"));
997
+ return (e, t) => (j(), g("div", _n, [r.value ? (j(), g("a", {
998
+ key: 0,
999
+ href: n.value,
1000
+ target: "_blank",
1001
+ rel: "noopener noreferrer"
1002
+ }, I(n.value), 9, vn)) : (j(), g(l, { key: 1 }, [v(I(n.value), 1)], 64))]));
1003
+ }
1004
+ }), bn = { class: "flex justify-center" }, xn = /* @__PURE__ */ x({
1005
+ __name: "boolean.cell",
1006
+ props: gn,
1007
+ setup(e) {
1008
+ let t = e, n = p(() => {
1009
+ let e = t.data[t.column.id];
1010
+ return e ? t.column.options?.format === "keyValue" ? e[t.column.options.key] : e : null;
1011
+ });
1012
+ return (e, t) => (j(), g("div", bn, [n.value === !0 ? (j(), m(K, {
1013
+ key: 0,
1014
+ icon: R(G).Check,
1015
+ size: "sm"
1016
+ }, null, 8, ["icon"])) : h("", !0)]));
1017
+ }
1018
+ }), Sn = (e, t) => {
1019
+ let n = e.__vccOpts || e;
1020
+ for (let [e, r] of t) n[e] = r;
1021
+ return n;
1022
+ }, Cn = {}, wn = { class: "card bg-base-100 shadow-sm" }, Tn = { class: "card-body" }, En = {
1023
+ key: 0,
1024
+ class: "card-title"
1025
+ }, Dn = {
1026
+ key: 1,
1027
+ class: "card-actions justify-end"
935
1028
  };
936
- function Vo(e, t) {
937
- return r(), f("div", So, [
938
- u("div", Po, [
939
- e.$slots.title ? (r(), f("h2", Mo, [
940
- P(e.$slots, "title")
941
- ])) : _("", !0),
942
- u("p", null, [
943
- P(e.$slots, "default"),
944
- P(e.$slots, "content")
945
- ]),
946
- e.$slots.actions ? (r(), f("div", Bo, [
947
- P(e.$slots, "actions")
948
- ])) : _("", !0)
949
- ])
950
- ]);
1029
+ function On(e, t) {
1030
+ return j(), g("div", wn, [_("div", Tn, [
1031
+ e.$slots.title ? (j(), g("h2", En, [P(e.$slots, "title")])) : h("", !0),
1032
+ _("p", null, [P(e.$slots, "default"), P(e.$slots, "content")]),
1033
+ e.$slots.actions ? (j(), g("div", Dn, [P(e.$slots, "actions")])) : h("", !0)
1034
+ ])]);
951
1035
  }
952
- const Sn = /* @__PURE__ */ xo(Lo, [["render", Vo]]), Pn = (e, t) => {
953
- if (!e) return null;
954
- const o = (n) => {
955
- e.contains(n.target) || t();
956
- };
957
- return document.addEventListener("click", o), o;
958
- }, Mn = (e) => {
959
- document.removeEventListener("click", e);
960
- }, Bn = {
961
- beforeMount(e, t) {
962
- e.clickOutsideEvent = function(o) {
963
- e === o.target || e.contains(o.target) || t.value(o);
964
- }, document.addEventListener("click", e.clickOutsideEvent);
965
- },
966
- unmounted(e) {
967
- document.removeEventListener("click", e.clickOutsideEvent);
968
- }
1036
+ var kn = /* @__PURE__ */ Sn(Cn, [["render", On]]), An = (e, t) => {
1037
+ if (!e) return null;
1038
+ let n = (n) => {
1039
+ e.contains(n.target) || t();
1040
+ };
1041
+ return document.addEventListener("click", n), n;
1042
+ }, jn = (e) => {
1043
+ document.removeEventListener("click", e);
1044
+ }, Mn = {
1045
+ beforeMount(e, t) {
1046
+ e.clickOutsideEvent = function(n) {
1047
+ e === n.target || e.contains(n.target) || t.value(n);
1048
+ }, document.addEventListener("click", e.clickOutsideEvent);
1049
+ },
1050
+ unmounted(e) {
1051
+ document.removeEventListener("click", e.clickOutsideEvent);
1052
+ }
969
1053
  };
970
- function Ao(e) {
971
- return e.replace(/[:\s_-]+(.)/g, (t, o) => o.toUpperCase()).replace(/^[A-Z]/, (t) => t.toLowerCase());
1054
+ //#endregion
1055
+ //#region src/utils/hasCustomEventListener.ts
1056
+ function Nn(e) {
1057
+ return e.replace(/[:\s_-]+(.)/g, (e, t) => t.toUpperCase()).replace(/^[A-Z]/, (e) => e.toLowerCase());
972
1058
  }
973
- function Vn(e) {
974
- const t = De();
975
- if (!t)
976
- return !1;
977
- const o = t.vnode.props;
978
- if (!o)
979
- return !1;
980
- const n = Ao(e), l = Re(e);
981
- return [
982
- re(e),
983
- re(l),
984
- re(n),
985
- `on:${e}`,
986
- `on:${l}`,
987
- `on:${n}`
988
- ].some(
989
- (c) => !!o[c]
990
- );
1059
+ function Pn(e) {
1060
+ let t = S();
1061
+ if (!t) return !1;
1062
+ let n = t.vnode.props;
1063
+ if (!n) return !1;
1064
+ let r = Nn(e), i = f(e);
1065
+ return [
1066
+ L(e),
1067
+ L(i),
1068
+ L(r),
1069
+ `on:${e}`,
1070
+ `on:${i}`,
1071
+ `on:${r}`
1072
+ ].some((e) => !!n[e]);
991
1073
  }
992
- const Oo = ["select"], ge = {
993
- options: { type: Array, required: !1 },
994
- isLoading: {
995
- type: Boolean,
996
- default: !1
997
- },
998
- query: { type: String, default: null },
999
- isActive: { type: Function, default: (e) => !1 }
1000
- }, se = {
1001
- group: {
1002
- root: "group",
1003
- label: "text-primary text-lg font-bold",
1004
- item: "group-item"
1005
- },
1006
- verticalLayout: {
1007
- root: "flex flex-col gap-x-2",
1008
- item: "w-full"
1009
- },
1010
- horizontalLayout: {
1011
- root: "flex flex-row gap-x-2",
1012
- item: "w-full"
1013
- },
1014
- arrayList: {
1015
- root: "fieldset",
1016
- legend: "fieldset-legend text-xl capitalize"
1017
- },
1018
- control: {
1019
- root: "fieldset",
1020
- wrapper: "fieldset",
1021
- label: "fieldset-legend",
1022
- error: "",
1023
- input: "input",
1024
- textarea: "input h-32",
1025
- checkbox: "checkbox",
1026
- select: "input pr-14",
1027
- description: "form-control--description label text-xs text-gray-500"
1028
- },
1029
- fixedArrayList: {
1030
- root: "flex flex-row gap-x-2",
1031
- item: "w-full"
1032
- }
1033
- }, ae = (e) => {
1034
- if (!e) return { ...se };
1035
- const t = { ...se };
1036
- for (const o of Object.keys(e)) {
1037
- const n = e[o];
1038
- n && typeof n == "object" && (t[o] = { ...se[o], ...n });
1039
- }
1040
- return t;
1041
- }, K = {
1042
- id: { type: String },
1043
- placeholder: { type: String },
1044
- description: { type: String },
1045
- errors: { type: String },
1046
- label: { type: String },
1047
- visible: { type: Boolean, default: !1 },
1048
- required: { type: Boolean, default: !1 },
1049
- enabled: { type: Boolean, default: !0 },
1050
- isFocused: { type: Boolean, default: !1 },
1051
- isTouched: { type: Boolean, default: !1 },
1052
- hideLabel: { type: Boolean, default: !1 },
1053
- styles: {
1054
- type: Object,
1055
- default: () => se
1056
- },
1057
- width: { type: String, default: "w-48" }
1058
- }, ve = {
1059
- ...K,
1060
- options: { type: Array, required: !0 },
1061
- /** Key to use as the display label when options are objects */
1062
- labelKey: { type: String, default: "label" },
1063
- /** Key to use as the stored
1064
- value when options are objects */
1065
- valueKey: { type: String, default: "value" },
1066
- /** add a new button next to the list*/
1067
- enableCreate: { type: Boolean, default: !1 }
1068
- }, Io = ["select", "clear", "close", "create"], Ve = {
1069
- ...ge,
1070
- ...ve,
1071
- isOpen: { type: Boolean, default: !1 },
1072
- isActive: { type: Function, default: (e) => !1 }
1073
- }, Do = {
1074
- key: 1,
1075
- tabindex: "-1",
1076
- class: "pointer-events-none"
1077
- }, Ro = ["data-index", "aria-selected", "onMousedown", "onMousemove"], To = ["innerHTML"], Eo = {
1078
- key: 0,
1079
- xmlns: "http://www.w3.org/2000/svg",
1080
- class: "h-4 w-4 shrink-0 opacity-80",
1081
- fill: "none",
1082
- viewBox: "0 0 24 24",
1083
- stroke: "currentColor",
1084
- "stroke-width": "2.5"
1074
+ //#endregion
1075
+ //#region src/form/text/MarkdownFallback.vue?vue&type=script&setup=true&lang.ts
1076
+ var Fn = [
1077
+ "id",
1078
+ "aria-label",
1079
+ "value"
1080
+ ], In = /* @__PURE__ */ x({
1081
+ __name: "MarkdownFallback",
1082
+ props: /* @__PURE__ */ T(e, {
1083
+ modelValue: {},
1084
+ modelModifiers: {}
1085
+ }),
1086
+ emits: /* @__PURE__ */ T(a, ["update:modelValue"]),
1087
+ setup(e, { emit: t }) {
1088
+ let n = e, r = t, i = z(e, "modelValue"), a = (e) => {
1089
+ let t = e.target.value;
1090
+ i.value = t, r("change", t);
1091
+ };
1092
+ return (e, t) => (j(), m(c, k(C(n)), {
1093
+ default: V(() => [_("textarea", {
1094
+ id: e.id,
1095
+ "aria-label": e.id,
1096
+ class: O([[e.minHeight, e.width], "textarea textarea-bordered w-full font-mono text-sm"]),
1097
+ value: i.value ?? "",
1098
+ onInput: a
1099
+ }, null, 42, Fn)]),
1100
+ _: 1
1101
+ }, 16));
1102
+ }
1103
+ }), Ln = ["select"], Rn = {
1104
+ options: {
1105
+ type: Array,
1106
+ required: !1
1107
+ },
1108
+ isLoading: {
1109
+ type: Boolean,
1110
+ default: !1
1111
+ },
1112
+ query: {
1113
+ type: String,
1114
+ default: void 0
1115
+ },
1116
+ isActive: {
1117
+ type: Function,
1118
+ default: (e) => !1
1119
+ },
1120
+ teleported: {
1121
+ type: Boolean,
1122
+ default: !1
1123
+ }
1124
+ }, zn = {
1125
+ ...s,
1126
+ options: {
1127
+ type: Array,
1128
+ required: !0
1129
+ },
1130
+ labelKey: {
1131
+ type: String,
1132
+ default: "label"
1133
+ },
1134
+ valueKey: {
1135
+ type: String,
1136
+ default: "value"
1137
+ },
1138
+ enableCreate: {
1139
+ type: Boolean,
1140
+ default: !1
1141
+ },
1142
+ clearable: {
1143
+ type: Boolean,
1144
+ default: !1
1145
+ },
1146
+ value: {
1147
+ type: null,
1148
+ default: void 0
1149
+ }
1150
+ }, Bn = [
1151
+ "select",
1152
+ "clear",
1153
+ "close",
1154
+ "create"
1155
+ ], Vn = {
1156
+ ...Rn,
1157
+ ...zn,
1158
+ isOpen: {
1159
+ type: Boolean,
1160
+ default: !1
1161
+ },
1162
+ isActive: {
1163
+ type: Function,
1164
+ default: (e) => !1
1165
+ }
1166
+ }, Hn = {
1167
+ key: 1,
1168
+ tabindex: "-1",
1169
+ class: "pointer-events-none"
1170
+ }, Un = [
1171
+ "data-index",
1172
+ "aria-selected",
1173
+ "aria-disabled",
1174
+ "onMousedown",
1175
+ "onMousemove"
1176
+ ], Wn = ["innerHTML"], Gn = {
1177
+ key: 0,
1178
+ xmlns: "http://www.w3.org/2000/svg",
1179
+ class: "h-4 w-4 shrink-0 opacity-80 text-primary",
1180
+ fill: "none",
1181
+ viewBox: "0 0 24 24",
1182
+ stroke: "currentColor",
1183
+ "stroke-width": "2.5"
1085
1184
  };
1086
- function zo(e, t) {
1087
- if (!t) return e;
1088
- const o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1089
- return e.replace(
1090
- new RegExp(`(${o})`, "gi"),
1091
- '<mark class="bg-warning/40 text-inherit rounded-sm px-0.5">$1</mark>'
1092
- );
1185
+ function Kn(e, t, n) {
1186
+ if (e || !n) return t;
1187
+ let r = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1188
+ return t.replace(RegExp(`(${r})`, "gi"), "<mark class=\"bg-warning/40 text-inherit rounded-sm px-0.5\">$1</mark>");
1093
1189
  }
1094
- const No = /* @__PURE__ */ k({
1095
- __name: "ListResults",
1096
- props: ge,
1097
- emits: Oo,
1098
- setup(e, { expose: t, emit: o }) {
1099
- const n = e, l = x(-1), a = x(), c = o;
1100
- j(
1101
- () => n.options,
1102
- () => {
1103
- l.value = -1;
1104
- }
1105
- );
1106
- function d() {
1107
- xe(() => {
1108
- a.value?.querySelector(
1109
- `[data-index="${l.value}"]`
1110
- )?.scrollIntoView({ block: "nearest" });
1111
- });
1112
- }
1113
- function p(s) {
1114
- const m = n.options?.length ?? 0;
1115
- if (m)
1116
- switch (s.key) {
1117
- case "ArrowDown":
1118
- s.preventDefault(), l.value = (l.value + 1) % m, d();
1119
- break;
1120
- case "ArrowUp":
1121
- s.preventDefault(), l.value = l.value <= 0 ? m - 1 : l.value - 1, d();
1122
- break;
1123
- case "Enter":
1124
- s.preventDefault(), l.value >= 0 && l.value < m && i(n.options[l.value]);
1125
- break;
1126
- }
1127
- }
1128
- function i(s) {
1129
- l.value = -1, c("select", s);
1130
- }
1131
- return t({ handleKeydown: p }), (s, m) => (r(), f("ul", {
1132
- ref_key: "listRef",
1133
- ref: a,
1134
- role: "listbox",
1135
- class: "absolute z-50 w-full mt-1 bg-base-100 border border-base-300 rounded-box shadow-xl overflow-auto max-h-64 origin-top p-1"
1136
- }, [
1137
- s.isLoading ? (r(), f(L, { key: 0 }, M(2, (b) => u("li", {
1138
- key: `skel-${b}`,
1139
- class: "pointer-events-none px-3 py-2"
1140
- }, [...m[0] || (m[0] = [
1141
- u("div", { class: "flex items-center gap-3" }, [
1142
- u("div", { class: "skeleton h-3 w-3/4 rounded" })
1143
- ], -1)
1144
- ])])), 64)) : s.options?.length === 0 ? (r(), f("li", Do, [...m[1] || (m[1] = [
1145
- u("span", { class: "px-3 py-2 text-sm opacity-50 italic" }, " No results found ", -1)
1146
- ])])) : (r(!0), f(L, { key: 2 }, M(s.options, (b, h) => (r(), f("li", {
1147
- key: b.value,
1148
- "data-index": h,
1149
- role: "option",
1150
- "aria-selected": h === l.value,
1151
- onMousedown: le((D) => i(b), ["prevent"]),
1152
- onMousemove: (D) => l.value = h
1153
- }, [
1154
- u("a", {
1155
- class: $(["flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-sm transition-colors duration-100", {
1156
- "active bg-secondary text-primary-content": h === l.value,
1157
- "hover:bg-base-200": h !== l.value
1158
- }])
1159
- }, [
1160
- u("span", {
1161
- class: "whitespace-nowrap",
1162
- innerHTML: zo(b.label, s.query)
1163
- }, null, 8, To),
1164
- s.isActive(b) ? (r(), f("svg", Eo, [...m[2] || (m[2] = [
1165
- u("path", {
1166
- "stroke-linecap": "round",
1167
- "stroke-linejoin": "round",
1168
- d: "M5 13l4 4L19 7"
1169
- }, null, -1)
1170
- ])])) : _("", !0)
1171
- ], 2)
1172
- ], 40, Ro))), 128))
1173
- ], 512));
1174
- }
1175
- }), Ae = ({ isTouched: e, errors: t }) => !!(e && t), qo = (e, t, o, n) => t === void 0 || t !== void 0 && !e || !n && !o, U = (e, t) => [e, { "input-error": Ae(t) }], jo = { key: 0 }, Z = /* @__PURE__ */ k({
1176
- __name: "ControlWrapper",
1177
- props: K,
1178
- setup(e) {
1179
- const t = e, o = v(() => !qo(
1180
- t.visible,
1181
- t.description,
1182
- t.isFocused,
1183
- !0
1184
- )), n = v(() => t.required), l = v(() => Ae(t)), a = v(() => ae(t.styles));
1185
- return (c, d) => (r(), f("fieldset", {
1186
- class: $(["fieldset", [c.width, a.value.control.wrapper]])
1187
- }, [
1188
- u("legend", {
1189
- class: $(a.value.control.label)
1190
- }, [
1191
- c.hideLabel ? _("", !0) : (r(), f(L, { key: 0 }, [
1192
- u("span", null, w(c.label), 1),
1193
- n.value ? (r(), f("span", jo, "*")) : _("", !0)
1194
- ], 64)),
1195
- d[0] || (d[0] = E("   ", -1))
1196
- ], 2),
1197
- P(c.$slots, "default"),
1198
- u("p", {
1199
- class: $(["fieldset-label h-4", { "text-error": l.value }])
1200
- }, w(l.value ? c.errors : o.value ? c.description : null), 3)
1201
- ], 2));
1202
- }
1203
- }), Fo = ["aria-label"], Ko = { class: "flex items-center w-full" }, Uo = { class: "overflow-hidden w-full" }, Ho = { class: "absolute inset-y-0 right-0 flex items-center pr-3 gap-1 pointer-events-none" }, Wo = {
1204
- key: 0,
1205
- class: "loading loading-spinner loading-xs text-primary pointer-events-none"
1206
- }, he = /* @__PURE__ */ k({
1207
- __name: "SelectWrapper",
1208
- props: Ve,
1209
- emits: Io,
1210
- setup(e, { emit: t }) {
1211
- const o = e, n = x(), l = x(), a = t, c = () => {
1212
- d(), a("clear");
1213
- }, d = () => {
1214
- a("close");
1215
- }, p = (s) => {
1216
- if (s.key === "Escape") {
1217
- d();
1218
- return;
1219
- }
1220
- l.value?.handleKeydown(s);
1221
- }, i = (s) => {
1222
- n.value && !n.value.contains(s.target) && d();
1223
- };
1224
- return $e(() => {
1225
- document.addEventListener("click", i);
1226
- }), _e(() => {
1227
- document.removeEventListener("click", i);
1228
- }), (s, m) => (r(), f("div", {
1229
- ref_key: "selectWrapperRef",
1230
- ref: n,
1231
- "aria-label": s.id,
1232
- role: "select"
1233
- }, [
1234
- V(Z, ee(te(o)), {
1235
- default: S(() => [
1236
- u("div", Ko, [
1237
- u("div", {
1238
- class: "relative w-full",
1239
- onKeydown: p
1240
- }, [
1241
- u("div", Uo, [
1242
- P(s.$slots, "default")
1243
- ]),
1244
- u("div", Ho, [
1245
- s.isLoading && !s.label ? (r(), f("span", Wo)) : _("", !0),
1246
- s.query && !s.isLoading ? (r(), f("button", {
1247
- key: 1,
1248
- type: "button",
1249
- class: "pointer-events-auto btn btn-ghost btn-xs btn-circle opacity-60 hover:opacity-100",
1250
- tabindex: "-1",
1251
- "aria-label": "Clear",
1252
- onMousedown: le(c, ["prevent"])
1253
- }, [...m[2] || (m[2] = [
1254
- u("svg", {
1255
- xmlns: "http://www.w3.org/2000/svg",
1256
- class: "h-3.5 w-3.5",
1257
- fill: "none",
1258
- viewBox: "0 0 24 24",
1259
- stroke: "currentColor",
1260
- "stroke-width": "2.5"
1261
- }, [
1262
- u("path", {
1263
- "stroke-linecap": "round",
1264
- "stroke-linejoin": "round",
1265
- d: "M6 18L18 6M6 6l12 12"
1266
- })
1267
- ], -1)
1268
- ])], 32)) : _("", !0),
1269
- (r(), f("svg", {
1270
- xmlns: "http://www.w3.org/2000/svg",
1271
- class: $(["h-4 w-4 opacity-40 transition-transform duration-200", { "rotate-180": s.isOpen }]),
1272
- fill: "none",
1273
- viewBox: "0 0 24 24",
1274
- stroke: "currentColor",
1275
- "stroke-width": "2"
1276
- }, [...m[3] || (m[3] = [
1277
- u("path", {
1278
- "stroke-linecap": "round",
1279
- "stroke-linejoin": "round",
1280
- d: "M19 9l-7 7-7-7"
1281
- }, null, -1)
1282
- ])], 2))
1283
- ]),
1284
- V(Te, {
1285
- "enter-active-class": "transition-all duration-150 ease-out",
1286
- "enter-from-class": "opacity-0 -translate-y-1 scale-y-95",
1287
- "enter-to-class": "opacity-100 translate-y-0 scale-y-100",
1288
- "leave-active-class": "transition-all duration-100 ease-in",
1289
- "leave-from-class": "opacity-100 translate-y-0 scale-y-100",
1290
- "leave-to-class": "opacity-0 -translate-y-1 scale-y-95"
1291
- }, {
1292
- default: S(() => [
1293
- s.isOpen ? (r(), y(No, {
1294
- key: 0,
1295
- ref_key: "listResultsRef",
1296
- ref: l,
1297
- query: s.query,
1298
- options: s.options,
1299
- "is-loading": s.isLoading,
1300
- "is-active": s.isActive,
1301
- onSelect: m[0] || (m[0] = (b) => a("select", b))
1302
- }, null, 8, ["query", "options", "is-loading", "is-active"])) : _("", !0)
1303
- ]),
1304
- _: 1
1305
- })
1306
- ], 32),
1307
- s.enableCreate ? (r(), y(N, {
1308
- key: 0,
1309
- icon: g(R).Plus,
1310
- color: g(z).blank,
1311
- size: "lg",
1312
- tooltip: "Create new",
1313
- "aria-label": "create",
1314
- onClick: m[1] || (m[1] = (b) => a("create"))
1315
- }, null, 8, ["icon", "color"])) : _("", !0)
1316
- ])
1317
- ]),
1318
- _: 3
1319
- }, 16)
1320
- ], 8, Fo));
1321
- }
1322
- }), ue = (e, t) => {
1323
- if (e)
1324
- return typeof e == "object" ? e[t.labelKey] : e;
1325
- }, ie = (e, t) => {
1326
- if (e)
1327
- return typeof e == "object" ? e[t.valueKey] : e;
1328
- }, Go = (e) => {
1329
- const t = x([]), o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), l = (s) => {
1330
- const m = [];
1331
- o.clear(), n.clear(), s?.forEach((b) => {
1332
- const h = {
1333
- value: ie(b, e),
1334
- label: ue(b, e)
1335
- };
1336
- o.set(h.value, b), n.set(h.value, h), m.push(h);
1337
- }), t.value = m;
1338
- }, a = (s) => o.get(s.value);
1339
- return {
1340
- options: t,
1341
- setOptions: l,
1342
- getOriginal: a,
1343
- getLabels: (...s) => s.map((m) => ue(m, e)),
1344
- getValues: (...s) => s.map((m) => ie(m, e)),
1345
- getOption: (s) => n.get(ie(s, e)),
1346
- getOriginals: (...s) => s.map(a).filter(Boolean)
1347
- };
1348
- }, ye = (e) => Go(e), Xo = ["aria-label"], An = /* @__PURE__ */ k({
1349
- __name: "SelectComponent",
1350
- props: /* @__PURE__ */ I(ve, {
1351
- modelValue: {},
1352
- modelModifiers: {}
1353
- }),
1354
- emits: /* @__PURE__ */ I(["update:modelValue", "change", "clear", "focus", "blur"], ["update:modelValue"]),
1355
- setup(e, { emit: t }) {
1356
- const o = x(!1), n = e, l = t, a = F(e, "modelValue"), c = ye(n), { options: d } = c;
1357
- j(
1358
- () => n.options,
1359
- () => {
1360
- c.setOptions(n.options);
1361
- },
1362
- { immediate: !0 }
1363
- );
1364
- const p = (A) => {
1365
- l("change", A);
1366
- }, i = v(
1367
- () => a.value ? c.getLabels(a.value)[0] : ""
1368
- ), s = v(() => ae(n.styles)), m = v(
1369
- () => U(s.value.control.select, n)
1370
- ), b = (A) => {
1371
- const C = c.getOriginal(A);
1372
- a.value = C, p(C);
1373
- }, h = () => {
1374
- o.value = !1, a.value = null, p(void 0);
1375
- }, D = (A) => c.getValues(a.value)?.[0] === A.value, H = () => {
1376
- o.value = !1;
1377
- };
1378
- return (A, C) => (r(), y(he, B(n, {
1379
- options: g(d),
1380
- disabled: !A.enabled,
1381
- "is-open": o.value,
1382
- query: i.value,
1383
- "is-active": D,
1384
- onClose: H,
1385
- onSelect: b,
1386
- onClear: h
1387
- }), {
1388
- default: S(() => [
1389
- u("button", {
1390
- type: "button",
1391
- class: $(["truncate block text-left", [m.value, A.width]]),
1392
- "aria-label": A.id,
1393
- role: "combobox",
1394
- onClick: C[0] || (C[0] = (T) => o.value = !0)
1395
- }, w(i.value ?? "Select value"), 11, Xo)
1396
- ]),
1397
- _: 1
1398
- }, 16, ["options", "disabled", "is-open", "query"]));
1399
- }
1400
- }), Zo = {
1401
- ...ve,
1402
- ...ge,
1403
- /** v-model binding */
1404
- modelValue: {
1405
- type: [String, Object],
1406
- default: ""
1407
- },
1408
- /**
1409
- * HTTP mode: async function that receives the search string and returns
1410
- * an array of strings or { label, value } objects.
1411
- * e.g. :fetchOptions="(q) => fetch(`/api/search?q=${q}`).then(r => r.json())"
1412
- */
1413
- fetchOptions: {
1414
- type: Function,
1415
- default: null
1416
- },
1417
- /** Debounce delay in ms for HTTP mode */
1418
- debounceMs: {
1419
- type: Number,
1420
- default: 200
1421
- },
1422
- /** How many results to show at once */
1423
- maxResults: {
1424
- type: Number,
1425
- default: 8
1426
- },
1427
- /** Allow free-text (don't clear input if nothing selected) */
1428
- freeText: {
1429
- type: Boolean,
1430
- default: !1
1431
- }
1190
+ //#endregion
1191
+ //#region src/form/select/ListResults.vue
1192
+ var qn = /* @__PURE__ */ x({
1193
+ __name: "ListResults",
1194
+ props: Rn,
1195
+ emits: Ln,
1196
+ setup(e, { expose: t, emit: n }) {
1197
+ let r = e, i = M(-1), a = M(), o = n;
1198
+ B(() => r.options, () => {
1199
+ i.value = -1;
1200
+ });
1201
+ function s() {
1202
+ D(() => {
1203
+ (a.value?.querySelector(`[data-index="${i.value}"]`))?.scrollIntoView({ block: "nearest" });
1204
+ });
1205
+ }
1206
+ function c(e) {
1207
+ let t = r.options?.length ?? 0;
1208
+ if (t) switch (e.key) {
1209
+ case "ArrowDown":
1210
+ e.preventDefault(), i.value = (i.value + 1) % t, s();
1211
+ break;
1212
+ case "ArrowUp":
1213
+ e.preventDefault(), i.value = i.value <= 0 ? t - 1 : i.value - 1, s();
1214
+ break;
1215
+ case "Enter":
1216
+ if (e.preventDefault(), i.value >= 0 && i.value < t) {
1217
+ let e = r.options[i.value];
1218
+ e.disabled || u(e);
1219
+ }
1220
+ break;
1221
+ }
1222
+ }
1223
+ function u(e) {
1224
+ i.value = -1, o("select", e);
1225
+ }
1226
+ return t({ handleKeydown: c }), (e, t) => (j(), g("ul", {
1227
+ ref_key: "listRef",
1228
+ ref: a,
1229
+ role: "listbox",
1230
+ "data-select-listbox": "",
1231
+ class: O(["bg-base-100 border border-base-300 rounded-box shadow-xl overflow-auto max-h-72 origin-top p-1", e.teleported ? "" : "absolute z-50 w-full mt-1"])
1232
+ }, [e.isLoading ? (j(), g(l, { key: 0 }, N(2, (e) => _("li", {
1233
+ key: `skel-${e}`,
1234
+ class: "pointer-events-none px-3 py-2"
1235
+ }, [...t[0] ||= [_("div", { class: "flex items-center gap-3" }, [_("div", { class: "skeleton h-3 w-3/4 rounded" })], -1)]])), 64)) : e.options?.length === 0 ? (j(), g("li", Hn, [...t[1] ||= [_("span", { class: "px-3 py-2 text-sm opacity-50 italic" }, " No results found ", -1)]])) : (j(!0), g(l, { key: 2 }, N(e.options, (n, r) => (j(), g("li", {
1236
+ key: n.value,
1237
+ "data-index": r,
1238
+ role: "option",
1239
+ "aria-selected": r === i.value,
1240
+ "aria-disabled": n.disabled,
1241
+ onMousedown: U((e) => !n.disabled && u(n), ["prevent"]),
1242
+ onMousemove: (e) => !n.disabled && (i.value = r)
1243
+ }, [_("a", { class: O(["text-sm flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-sm text-base-content no-underline transition-colors duration-100", {
1244
+ "opacity-40 cursor-not-allowed": n.disabled,
1245
+ "cursor-pointer": !n.disabled,
1246
+ "bg-base-200": !n.disabled && r === i.value,
1247
+ "bg-base-300": e.isActive(n),
1248
+ "hover:bg-base-200": !n.disabled && r !== i.value
1249
+ }]) }, [_("span", {
1250
+ class: "whitespace-nowrap",
1251
+ innerHTML: Kn(e.isActive(n), n.label, e.query)
1252
+ }, null, 8, Wn), e.isActive(n) ? (j(), g("svg", Gn, [...t[2] ||= [_("path", {
1253
+ "stroke-linecap": "round",
1254
+ "stroke-linejoin": "round",
1255
+ d: "M5 13l4 4L19 7"
1256
+ }, null, -1)]])) : h("", !0)], 2)], 40, Un))), 128))], 2));
1257
+ }
1258
+ }), Jn = ["aria-label"], Yn = { class: "flex items-center w-full" }, Xn = { class: "overflow-hidden w-full" }, Zn = { class: "absolute inset-y-0 right-0 flex items-center pr-3 gap-1 pointer-events-none" }, Qn = {
1259
+ key: 0,
1260
+ class: "loading loading-spinner loading-xs text-primary pointer-events-none"
1261
+ }, $n = /* @__PURE__ */ x({
1262
+ __name: "SelectWrapper",
1263
+ props: Vn,
1264
+ emits: Bn,
1265
+ setup(e, { emit: t }) {
1266
+ let n = e, r = M(), i = M(), a = M(), o = t, s = M("body"), l = p(() => {
1267
+ let e = i.value ?? r.value;
1268
+ if (!e) return {};
1269
+ let t = e.getBoundingClientRect();
1270
+ return {
1271
+ position: "fixed",
1272
+ zIndex: 9999,
1273
+ top: `${t.bottom + 4}px`,
1274
+ left: `${t.left}px`,
1275
+ width: `${t.width}px`
1276
+ };
1277
+ }), f = () => {
1278
+ v(), o("clear");
1279
+ }, v = () => {
1280
+ o("close");
1281
+ }, b = (e) => {
1282
+ if (e.key === "Escape") {
1283
+ v();
1284
+ return;
1285
+ }
1286
+ a.value?.handleKeydown(e);
1287
+ }, x = (e) => {
1288
+ r.value && !r.value.contains(e.target) && v();
1289
+ };
1290
+ return ee(() => {
1291
+ document.addEventListener("click", x);
1292
+ let e = r.value?.closest("dialog");
1293
+ e && (s.value = e);
1294
+ }), te(() => {
1295
+ document.removeEventListener("click", x);
1296
+ }), (e, t) => (j(), g("div", {
1297
+ ref_key: "selectWrapperRef",
1298
+ ref: r,
1299
+ "aria-label": e.id,
1300
+ role: "select"
1301
+ }, [y(c, k(C(n)), {
1302
+ default: V(() => [_("div", Yn, [_("div", {
1303
+ ref_key: "inputWrapperRef",
1304
+ ref: i,
1305
+ class: "relative w-full",
1306
+ onKeydown: b
1307
+ }, [
1308
+ _("div", Xn, [P(e.$slots, "default")]),
1309
+ _("div", Zn, [
1310
+ e.isLoading && !e.label ? (j(), g("span", Qn)) : h("", !0),
1311
+ e.query && !e.isLoading && e.clearable ? (j(), g("button", {
1312
+ key: 1,
1313
+ type: "button",
1314
+ class: "pointer-events-auto btn btn-ghost btn-xs btn-circle opacity-60 hover:opacity-100",
1315
+ tabindex: "-1",
1316
+ "aria-label": "Clear",
1317
+ onMousedown: U(f, ["prevent"])
1318
+ }, [...t[2] ||= [_("svg", {
1319
+ xmlns: "http://www.w3.org/2000/svg",
1320
+ class: "h-3.5 w-3.5",
1321
+ fill: "none",
1322
+ viewBox: "0 0 24 24",
1323
+ stroke: "currentColor",
1324
+ "stroke-width": "2.5"
1325
+ }, [_("path", {
1326
+ "stroke-linecap": "round",
1327
+ "stroke-linejoin": "round",
1328
+ d: "M6 18L18 6M6 6l12 12"
1329
+ })], -1)]], 32)) : h("", !0),
1330
+ (j(), g("svg", {
1331
+ xmlns: "http://www.w3.org/2000/svg",
1332
+ class: O(["h-4 w-4 opacity-40 transition-transform duration-200", { "rotate-180": e.isOpen }]),
1333
+ fill: "none",
1334
+ viewBox: "0 0 24 24",
1335
+ stroke: "currentColor",
1336
+ "stroke-width": "2"
1337
+ }, [...t[3] ||= [_("path", {
1338
+ "stroke-linecap": "round",
1339
+ "stroke-linejoin": "round",
1340
+ d: "M19 9l-7 7-7-7"
1341
+ }, null, -1)]], 2))
1342
+ ]),
1343
+ (j(), m(u, { to: s.value }, [y(d, {
1344
+ "enter-active-class": "transition-all duration-150 ease-out",
1345
+ "enter-from-class": "opacity-0 -translate-y-1 scale-y-95",
1346
+ "enter-to-class": "opacity-100 translate-y-0 scale-y-100",
1347
+ "leave-active-class": "transition-all duration-100 ease-in",
1348
+ "leave-from-class": "opacity-100 translate-y-0 scale-y-100",
1349
+ "leave-to-class": "opacity-0 -translate-y-1 scale-y-95"
1350
+ }, {
1351
+ default: V(() => [e.isOpen ? (j(), m(qn, {
1352
+ key: 0,
1353
+ ref_key: "listResultsRef",
1354
+ ref: a,
1355
+ teleported: !0,
1356
+ style: A(l.value),
1357
+ query: void 0,
1358
+ options: e.options,
1359
+ "is-loading": e.isLoading,
1360
+ "is-active": e.isActive,
1361
+ onSelect: t[0] ||= (e) => o("select", e)
1362
+ }, null, 8, [
1363
+ "style",
1364
+ "options",
1365
+ "is-loading",
1366
+ "is-active"
1367
+ ])) : h("", !0)]),
1368
+ _: 1
1369
+ })], 8, ["to"]))
1370
+ ], 544), e.enableCreate ? (j(), m(Z, {
1371
+ key: 0,
1372
+ icon: R(G).Plus,
1373
+ color: R(X).blank,
1374
+ size: "lg",
1375
+ tooltip: "Create new",
1376
+ "aria-label": "create",
1377
+ onClick: t[1] ||= (e) => o("create")
1378
+ }, null, 8, ["icon", "color"])) : h("", !0)])]),
1379
+ _: 3
1380
+ }, 16)], 8, Jn));
1381
+ }
1382
+ }), er = (e, t) => {
1383
+ if (e) return typeof e == "object" ? e[t.labelKey] : e;
1384
+ }, tr = (e, t) => {
1385
+ if (e) return typeof e == "object" ? e[t.valueKey] : e;
1386
+ }, nr = (e) => {
1387
+ let t = M([]), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (i) => {
1388
+ let a = [];
1389
+ n.clear(), r.clear(), i?.forEach((t) => {
1390
+ let i = {
1391
+ value: tr(t, e),
1392
+ label: er(t, e),
1393
+ ...t?.disabled !== void 0 && { disabled: !!t.disabled }
1394
+ };
1395
+ n.set(i.value, t), r.set(i.value, i), a.push(i);
1396
+ }), t.value = a;
1397
+ }, a = (e) => n.get(e.value);
1398
+ return {
1399
+ options: t,
1400
+ setOptions: i,
1401
+ getOriginal: a,
1402
+ getLabels: (...t) => t.map((t) => t != null && typeof t != "object" ? r.get(String(t))?.label ?? String(t) : er(t, e)),
1403
+ getValues: (...t) => t.map((t) => tr(t, e)),
1404
+ getOption: (t) => r.get(tr(t, e)),
1405
+ getOriginals: (...e) => e.map(a).filter(Boolean)
1406
+ };
1407
+ }, rr = (e) => nr(e), ir = ["aria-label"], ar = /* @__PURE__ */ x({
1408
+ __name: "SelectComponent",
1409
+ props: /* @__PURE__ */ T(zn, {
1410
+ modelValue: {},
1411
+ modelModifiers: {}
1412
+ }),
1413
+ emits: /* @__PURE__ */ T([
1414
+ "update:modelValue",
1415
+ "change",
1416
+ "clear",
1417
+ "focus",
1418
+ "blur"
1419
+ ], ["update:modelValue"]),
1420
+ setup(e, { emit: n }) {
1421
+ let r = M(!1), a = e, o = n, s = z(e, "modelValue"), c = rr(a), { options: l } = c;
1422
+ B(() => a.options, () => {
1423
+ c.setOptions(a.options);
1424
+ }, { immediate: !0 });
1425
+ let u = (e) => {
1426
+ o("change", e);
1427
+ }, d = p(() => s.value ?? a.value), f = p(() => d.value ? c.getLabels(d.value)[0] : ""), h = p(() => t(a.styles)), g = p(() => i(h.value.control.select, a)), v = (e) => {
1428
+ let t = c.getOriginal(e);
1429
+ s.value = t, r.value = !1, u(t);
1430
+ }, y = () => {
1431
+ r.value = !1, s.value = null, u(void 0);
1432
+ }, b = (e) => c.getValues(d.value)?.[0] === e.value, x = () => {
1433
+ r.value = !1;
1434
+ };
1435
+ return (e, t) => (j(), m($n, E(a, {
1436
+ options: R(l),
1437
+ disabled: !e.enabled,
1438
+ "is-open": r.value,
1439
+ query: f.value,
1440
+ "is-active": b,
1441
+ clearable: a.clearable,
1442
+ onClose: x,
1443
+ onSelect: v,
1444
+ onClear: y
1445
+ }), {
1446
+ default: V(() => [_("button", {
1447
+ type: "button",
1448
+ class: O(["truncate block text-left", [g.value, e.width]]),
1449
+ "aria-label": e.id,
1450
+ role: "combobox",
1451
+ onClick: t[0] ||= (e) => r.value = !0
1452
+ }, I(f.value ?? "Select value"), 11, ir)]),
1453
+ _: 1
1454
+ }, 16, [
1455
+ "options",
1456
+ "disabled",
1457
+ "is-open",
1458
+ "query",
1459
+ "clearable"
1460
+ ]));
1461
+ }
1462
+ }), or = {
1463
+ ...zn,
1464
+ ...Rn,
1465
+ modelValue: {
1466
+ type: [String, Object],
1467
+ default: ""
1468
+ },
1469
+ fetchOptions: {
1470
+ type: Function,
1471
+ default: null
1472
+ },
1473
+ debounceMs: {
1474
+ type: Number,
1475
+ default: 200
1476
+ },
1477
+ maxResults: {
1478
+ type: Number,
1479
+ default: 8
1480
+ },
1481
+ freeText: {
1482
+ type: Boolean,
1483
+ default: !1
1484
+ }
1432
1485
  };
1433
- function Jo(e) {
1434
- const t = x([]), o = x(!1);
1435
- function n(a) {
1436
- if (!e.options) {
1437
- t.value = [];
1438
- return;
1439
- }
1440
- const c = a.toLowerCase(), d = c ? e.options.filter(
1441
- (p) => ue(p, e).toLowerCase().includes(c)
1442
- ) : e.options;
1443
- t.value = d.slice(0, e.maxResults);
1444
- }
1445
- function l() {
1446
- t.value = [];
1447
- }
1448
- return { results: t, isLoading: o, search: n, clear: l };
1486
+ //#endregion
1487
+ //#region src/form/select/composables/useSearch.ts
1488
+ function sr(e) {
1489
+ let t = M([]), n = M(!1);
1490
+ function r(n) {
1491
+ if (!e.options) {
1492
+ t.value = [];
1493
+ return;
1494
+ }
1495
+ let r = n.toLowerCase();
1496
+ t.value = (r ? e.options.filter((t) => er(t, e).toLowerCase().includes(r)) : e.options).slice(0, e.maxResults);
1497
+ }
1498
+ function i() {
1499
+ t.value = [];
1500
+ }
1501
+ return {
1502
+ results: t,
1503
+ isLoading: n,
1504
+ search: r,
1505
+ clear: i
1506
+ };
1449
1507
  }
1450
- function Qo(e) {
1451
- const t = x([]), o = x(!1);
1452
- let n = null, l = null;
1453
- async function a(p) {
1454
- l && l.abort(), l = new AbortController(), o.value = !0;
1455
- try {
1456
- const i = await e.fetchOptions(p, l.signal);
1457
- t.value = (i || []).slice(0, e.maxResults);
1458
- } catch (i) {
1459
- i.name !== "AbortError" && (t.value = []);
1460
- } finally {
1461
- o.value = !1;
1462
- }
1463
- }
1464
- function c(p) {
1465
- n && clearTimeout(n), o.value = !0, n = setTimeout(() => {
1466
- a(p);
1467
- }, e.debounceMs);
1468
- }
1469
- function d() {
1470
- n && clearTimeout(n), l && l.abort(), t.value = [], o.value = !1;
1471
- }
1472
- return { results: t, isLoading: o, search: c, clear: d };
1508
+ function cr(e) {
1509
+ let t = M([]), n = M(!1), r = null, i = null;
1510
+ async function a(r) {
1511
+ i && i.abort(), i = new AbortController(), n.value = !0;
1512
+ try {
1513
+ t.value = (await e.fetchOptions(r, i.signal) || []).slice(0, e.maxResults);
1514
+ } catch (e) {
1515
+ e.name !== "AbortError" && (t.value = []);
1516
+ } finally {
1517
+ n.value = !1;
1518
+ }
1519
+ }
1520
+ function o(t) {
1521
+ r && clearTimeout(r), n.value = !0, r = setTimeout(() => {
1522
+ a(t);
1523
+ }, e.debounceMs);
1524
+ }
1525
+ function s() {
1526
+ r && clearTimeout(r), i && i.abort(), t.value = [], n.value = !1;
1527
+ }
1528
+ return {
1529
+ results: t,
1530
+ isLoading: n,
1531
+ search: o,
1532
+ clear: s
1533
+ };
1473
1534
  }
1474
- function Yo(e) {
1475
- const t = e.fetchOptions ? Qo(e) : Jo(e);
1476
- function o(n) {
1477
- t.search(n);
1478
- }
1479
- return {
1480
- results: t.results,
1481
- isLoading: t.isLoading,
1482
- triggerSearch: o,
1483
- clear: t.clear
1484
- };
1535
+ function lr(e) {
1536
+ let t = e.fetchOptions ? cr(e) : sr(e);
1537
+ function n(e) {
1538
+ t.search(e);
1539
+ }
1540
+ return {
1541
+ results: t.results,
1542
+ isLoading: t.isLoading,
1543
+ triggerSearch: n,
1544
+ clear: t.clear
1545
+ };
1485
1546
  }
1486
- const es = ["aria-label", "aria-expanded", "value", "placeholder", "disabled"], On = /* @__PURE__ */ k({
1487
- __name: "AutoComplete",
1488
- props: Zo,
1489
- emits: ["update:modelValue", "change", "clear", "focus", "blur"],
1490
- setup(e, { emit: t }) {
1491
- const o = e, n = t, l = x(null), a = x(""), c = x(!1), d = Yo(o), { isLoading: p, triggerSearch: i, clear: s } = d, m = ye(o), { options: b } = m;
1492
- j(
1493
- () => d.results.value,
1494
- () => {
1495
- m.setOptions(d.results.value);
1496
- },
1497
- { immediate: !0 }
1498
- ), j(
1499
- () => o.modelValue,
1500
- (O) => {
1501
- if (O == null || O === "") {
1502
- a.value = "";
1503
- return;
1504
- }
1505
- const G = typeof O == "object" ? O[o.labelKey] : O;
1506
- G !== a.value && (a.value = G);
1507
- },
1508
- { immediate: !0 }
1509
- );
1510
- const h = (O) => {
1511
- a.value = O.target.value, o.freeText ? n("update:modelValue", a.value) : n("update:modelValue", ""), i(a.value), c.value = !0;
1512
- }, D = () => {
1513
- i(a.value), c.value = !0;
1514
- };
1515
- function H() {
1516
- setTimeout(() => {
1517
- c.value = !1, o.freeText ? n("change", a.value) : o.modelValue || (a.value = "");
1518
- }, 150);
1519
- }
1520
- const A = (O) => {
1521
- const G = m.getOriginal(O);
1522
- a.value = O.label, c.value = !1, n("update:modelValue", G), n("change", G);
1523
- }, C = () => {
1524
- a.value = "", s(), c.value = !1, n("update:modelValue", ""), n("clear"), xe(() => l.value?.focus());
1525
- }, T = () => {
1526
- c.value = !1;
1527
- }, W = v(() => ae(o.styles)), Oe = v(
1528
- () => U(W.value.control.select, o)
1529
- );
1530
- return (O, G) => (r(), y(he, B(o, {
1531
- options: g(b),
1532
- "is-loading": g(p),
1533
- "is-open": c.value,
1534
- query: a.value,
1535
- onClose: T,
1536
- onSelect: A,
1537
- onClear: C
1538
- }), {
1539
- default: S(() => [
1540
- u("input", {
1541
- ref_key: "inputRef",
1542
- ref: l,
1543
- type: "text",
1544
- role: "combobox",
1545
- "aria-label": O.id,
1546
- "aria-expanded": c.value,
1547
- "aria-autocomplete": "list",
1548
- "aria-haspopup": "listbox",
1549
- autocomplete: "off",
1550
- autocorrect: "off",
1551
- spellcheck: "false",
1552
- class: $([Oe.value, "w-full"]),
1553
- value: a.value,
1554
- placeholder: O.placeholder,
1555
- disabled: !O.enabled,
1556
- onInput: h,
1557
- onFocus: D,
1558
- onBlur: H
1559
- }, null, 42, es)
1560
- ]),
1561
- _: 1
1562
- }, 16, ["options", "is-loading", "is-open", "query"]));
1563
- }
1564
- }), ts = ["aria-label"], In = /* @__PURE__ */ k({
1565
- __name: "MultiSelect",
1566
- props: /* @__PURE__ */ I(Ve, {
1567
- modelValue: {},
1568
- modelModifiers: {}
1569
- }),
1570
- emits: /* @__PURE__ */ I(["update:modelValue", "change", "clear", "focus", "blur"], ["update:modelValue"]),
1571
- setup(e, { emit: t }) {
1572
- const o = x(!1), n = e, l = t, a = F(e, "modelValue"), c = (C) => {
1573
- l("change", C);
1574
- }, d = ye(n), { options: p } = d;
1575
- j(
1576
- () => n.options,
1577
- () => {
1578
- d.setOptions(n.options);
1579
- },
1580
- { immediate: !0 }
1581
- );
1582
- const i = v(
1583
- () => a.value ? d.getLabels(...a.value).join(", ") : void 0
1584
- ), s = v(
1585
- () => d.getValues(...a.value ?? [])
1586
- ), m = (C) => {
1587
- let T = a.value ?? [];
1588
- if (D(C))
1589
- T = T.filter(
1590
- (W) => d.getOption(W)?.value !== C.value
1591
- );
1592
- else {
1593
- const W = d.getOriginal(C);
1594
- T.push(W);
1595
- }
1596
- a.value = T, c(T);
1597
- }, b = () => {
1598
- o.value = !1, a.value = [], c([]);
1599
- }, h = () => {
1600
- o.value = !1;
1601
- }, D = (C) => s.value?.includes(C.value) ?? !1, H = v(() => ae(n.styles)), A = v(
1602
- () => U(H.value.control.select, n)
1603
- );
1604
- return (C, T) => (r(), y(he, B(n, {
1605
- options: g(p),
1606
- "is-open": o.value,
1607
- disabled: !C.enabled,
1608
- query: i.value,
1609
- "is-active": D,
1610
- onClose: h,
1611
- onSelect: m,
1612
- onClear: b
1613
- }), {
1614
- default: S(() => [
1615
- u("button", {
1616
- type: "button",
1617
- class: $(["truncate block text-left", [A.value, C.width]]),
1618
- "aria-label": C.id,
1619
- role: "combobox",
1620
- onClick: T[0] || (T[0] = (W) => o.value = !0)
1621
- }, w(i.value ?? "Select value"), 11, ts)
1622
- ]),
1623
- _: 1
1624
- }, 16, ["options", "is-open", "disabled", "query"]));
1625
- }
1626
- }), os = ["change"], ss = {
1627
- ...K,
1628
- width: { type: String, default: "w-48" },
1629
- minHeight: { type: String, default: "min-h-[50vh]" },
1630
- actions: {
1631
- type: Object,
1632
- default: () => [
1633
- {
1634
- label: "<strong>B</strong>",
1635
- name: "bold",
1636
- action: (e) => e?.chain().focus().toggleBold().run()
1637
- },
1638
- {
1639
- label: "<em>I</em>",
1640
- name: "italic",
1641
- action: (e) => e?.chain().focus().toggleItalic().run()
1642
- }
1643
- ]
1644
- }
1645
- }, ns = ["aria-label"], ls = { class: "flex items-center gap-1 px-3 py-2 border-b border-base-300 bg-base-200" }, as = ["title", "onClick"], rs = ["innerHTML"], is = { class: "card-body p-3" }, Dn = /* @__PURE__ */ k({
1646
- __name: "Markdown",
1647
- props: /* @__PURE__ */ I(ss, {
1648
- modelValue: {},
1649
- modelModifiers: {}
1650
- }),
1651
- emits: /* @__PURE__ */ I(os, ["update:modelValue"]),
1652
- setup(e, { emit: t }) {
1653
- const o = e, n = t, l = F(e, "modelValue"), a = it({
1654
- content: l.value ?? "",
1655
- extensions: [
1656
- rt.configure({
1657
- heading: !1,
1658
- blockquote: !1,
1659
- bulletList: !1,
1660
- orderedList: !1,
1661
- listItem: !1,
1662
- code: !1,
1663
- codeBlock: !1,
1664
- horizontalRule: !1,
1665
- hardBreak: !1
1666
- }),
1667
- ct.configure({
1668
- html: !1,
1669
- transformPastedText: !0
1670
- // parse markdown on paste
1671
- })
1672
- ],
1673
- onUpdate({ editor: c }) {
1674
- const d = c.storage.markdown.getMarkdown();
1675
- l.value = d, n("change", d);
1676
- }
1677
- });
1678
- return Ee(() => {
1679
- a.value?.destroy();
1680
- }), (c, d) => (r(), y(Z, ee(te(o)), {
1681
- default: S(() => [
1682
- u("div", {
1683
- class: $([[c.minHeight], "card bg-base-100 border border-base-300 w-full"]),
1684
- "aria-label": c.id,
1685
- role: "textbox"
1686
- }, [
1687
- u("div", ls, [
1688
- (r(!0), f(L, null, M(c.actions, (p) => (r(), f("button", {
1689
- key: p.name,
1690
- tabindex: "-1",
1691
- type: "button",
1692
- class: $(["btn btn-sm btn-ghost", { "btn-active": g(a)?.isActive(p.name) }]),
1693
- title: p.label,
1694
- onClick: (i) => p.action(g(a))
1695
- }, [
1696
- u("span", {
1697
- innerHTML: p.label
1698
- }, null, 8, rs)
1699
- ], 10, as))), 128))
1700
- ]),
1701
- u("div", is, [
1702
- V(g(ut), {
1703
- editor: g(a),
1704
- class: "prose prose-sm max-w-none h-full"
1705
- }, null, 8, ["editor"])
1706
- ])
1707
- ], 10, ns)
1708
- ]),
1709
- _: 1
1710
- }, 16));
1711
- }
1712
- }), us = {
1713
- ...K
1714
- }, cs = ["change", "focus", "blur"], ds = { class: "flex items-center justify-center h-full" }, ps = { class: "fieldset-label" }, fs = ["aria-label", "disabled"], ms = { class: "font-bold text-gray-500 text-sm" }, Rn = /* @__PURE__ */ k({
1715
- __name: "Checkbox",
1716
- props: /* @__PURE__ */ I(us, {
1717
- modelValue: {},
1718
- modelModifiers: {}
1719
- }),
1720
- emits: /* @__PURE__ */ I(cs, ["update:modelValue"]),
1721
- setup(e, { emit: t }) {
1722
- const o = e, n = t, l = F(e, "modelValue"), a = (i) => {
1723
- n("change", l.value);
1724
- }, c = (i) => {
1725
- n("focus", i);
1726
- }, d = (i) => {
1727
- n("blur", i);
1728
- }, p = v(
1729
- () => U(o.styles.control.checkbox, o)
1730
- );
1731
- return (i, s) => (r(), f("div", ds, [
1732
- V(Z, B(o, { "hide-label": !0 }), {
1733
- default: S(() => [
1734
- u("label", ps, [
1735
- Y(u("input", {
1736
- "onUpdate:modelValue": s[0] || (s[0] = (m) => l.value = m),
1737
- "aria-label": i.id,
1738
- role: "checkbox",
1739
- type: "checkbox",
1740
- class: $(p.value),
1741
- disabled: !i.enabled,
1742
- onChange: a,
1743
- onFocus: c,
1744
- onBlur: d
1745
- }, null, 42, fs), [
1746
- [Ce, l.value]
1747
- ]),
1748
- u("span", ms, w(i.label), 1)
1749
- ])
1750
- ]),
1751
- _: 1
1752
- }, 16)
1753
- ]));
1754
- }
1755
- }), bs = {
1756
- ...K,
1757
- type: { type: String, default: "text" }
1758
- }, gs = ["change", "focus", "blur"], vs = ["aria-label", "type", "disabled", "autofocus", "placeholder"], Tn = /* @__PURE__ */ k({
1759
- __name: "Input",
1760
- props: /* @__PURE__ */ I(bs, {
1761
- modelValue: {},
1762
- modelModifiers: {}
1763
- }),
1764
- emits: /* @__PURE__ */ I(gs, ["update:modelValue"]),
1765
- setup(e, { emit: t }) {
1766
- const o = e, n = t, l = F(e, "modelValue"), a = (i) => {
1767
- n("change", i);
1768
- }, c = (i) => {
1769
- n("focus", i);
1770
- }, d = (i) => {
1771
- n("blur", i);
1772
- }, p = v(
1773
- () => U(o.styles.control.input, o)
1774
- );
1775
- return (i, s) => (r(), y(Z, ee(te(o)), {
1776
- default: S(() => [
1777
- Y(u("input", {
1778
- "onUpdate:modelValue": s[0] || (s[0] = (m) => l.value = m),
1779
- "aria-label": i.id,
1780
- autocomplete: "off",
1781
- type: i.type,
1782
- class: $(["w-full", p.value]),
1783
- disabled: !i.enabled,
1784
- autofocus: i.isFocused,
1785
- placeholder: i.placeholder,
1786
- onChange: a,
1787
- onFocus: c,
1788
- onBlur: d
1789
- }, null, 42, vs), [
1790
- [ze, l.value]
1791
- ])
1792
- ]),
1793
- _: 1
1794
- }, 16));
1795
- }
1796
- }), hs = {
1797
- ...K,
1798
- steps: { type: Number, default: 1 }
1799
- }, ys = ["change", "focus", "blur"], ws = ["aria-label", "disabled", "step", "autofocus", "placeholder"], En = /* @__PURE__ */ k({
1800
- __name: "InputNumber",
1801
- props: /* @__PURE__ */ I(hs, {
1802
- modelValue: {},
1803
- modelModifiers: {}
1804
- }),
1805
- emits: /* @__PURE__ */ I(ys, ["update:modelValue"]),
1806
- setup(e, { emit: t }) {
1807
- const o = e, n = t, l = F(e, "modelValue"), a = (i) => {
1808
- n("change", i);
1809
- }, c = (i) => {
1810
- n("focus", i);
1811
- }, d = (i) => {
1812
- n("blur", i);
1813
- }, p = v(
1814
- () => U(o.styles?.control?.input, o)
1815
- );
1816
- return (i, s) => (r(), y(Z, ee(te(o)), {
1817
- default: S(() => [
1818
- Y(u("input", {
1819
- "onUpdate:modelValue": s[0] || (s[0] = (m) => l.value = m),
1820
- autocomplete: "off",
1821
- "aria-label": i.id,
1822
- type: "number",
1823
- class: $(["w-full", [p.value]]),
1824
- disabled: !i.enabled,
1825
- step: i.steps,
1826
- autofocus: i.isFocused,
1827
- placeholder: i.placeholder,
1828
- onChange: a,
1829
- onFocus: c,
1830
- onBlur: d
1831
- }, null, 42, ws), [
1832
- [Le, l.value]
1833
- ])
1834
- ]),
1835
- _: 1
1836
- }, 16));
1837
- }
1838
- }), ks = {
1839
- ...K,
1840
- rows: { type: Number, default: 4 }
1841
- }, _s = ["change", "focus", "blur"], $s = ["aria-label", "disabled", "rows", "autofocus", "placeholder"], zn = /* @__PURE__ */ k({
1842
- __name: "Textarea",
1843
- props: /* @__PURE__ */ I(ks, {
1844
- modelValue: {},
1845
- modelModifiers: {}
1846
- }),
1847
- emits: /* @__PURE__ */ I(_s, ["update:modelValue"]),
1848
- setup(e, { emit: t }) {
1849
- const o = e, n = t, l = F(e, "modelValue"), a = (i) => {
1850
- n("change", i);
1851
- }, c = (i) => {
1852
- n("focus", i);
1853
- }, d = (i) => {
1854
- n("blur", i);
1855
- }, p = v(
1856
- () => U(o.styles.control.textarea, o)
1857
- );
1858
- return (i, s) => (r(), y(Z, ee(te(o)), {
1859
- default: S(() => [
1860
- Y(u("textarea", {
1861
- "onUpdate:modelValue": s[0] || (s[0] = (m) => l.value = m),
1862
- autocomplete: "off",
1863
- type: "text",
1864
- "aria-label": i.id,
1865
- class: $(["w-full", p.value]),
1866
- disabled: !i.enabled,
1867
- rows: i.rows,
1868
- autofocus: i.isFocused,
1869
- placeholder: i.placeholder,
1870
- onChange: a,
1871
- onFocus: c,
1872
- onBlur: d
1873
- }, null, 42, $s), [
1874
- [Le, l.value]
1875
- ])
1876
- ]),
1877
- _: 1
1878
- }, 16));
1879
- }
1880
- }), Cs = {
1881
- widthLeft: { type: Number, default: 200 },
1882
- widthRight: { type: Number, default: 200 },
1883
- initialLeftOpen: { type: Boolean, default: !0 },
1884
- initialRightOpen: { type: Boolean, default: !0 }
1885
- }, xs = { class: "flex h-full overflow-hidden gap-2" }, Ls = {
1886
- key: 0,
1887
- id: "drawer-left",
1888
- class: "min-h-0 relative flex-shrink-0 bg-white overflow-visible flex"
1889
- }, Ss = ["aria-expanded", "aria-label"], Ps = { class: "flex-1 overflow-y-auto bg-white" }, Ms = {
1890
- key: 1,
1891
- class: "min-h-0 relative flex-shrink-0 bg-white overflow-visible flex"
1892
- }, Bs = ["aria-expanded", "aria-label"], Nn = /* @__PURE__ */ k({
1893
- __name: "drawer",
1894
- props: Cs,
1895
- setup(e) {
1896
- const t = e, o = Se(), n = v(() => !!o["left-drawer"]), l = v(() => !!o["right-drawer"]), a = x({
1897
- left: t.initialLeftOpen,
1898
- right: t.initialRightOpen
1899
- }), c = (d) => {
1900
- a.value[d] = !a.value[d];
1901
- };
1902
- return (d, p) => (r(), f("main", xs, [
1903
- n.value ? (r(), f("aside", Ls, [
1904
- u("div", {
1905
- id: "drawer-left-panel",
1906
- style: X({ width: a.value.left ? d.widthLeft + "px" : "0px" }),
1907
- class: "h-full overflow-hidden bg-white shadow-sm transition-[width] duration-300 ease-in-out"
1908
- }, [
1909
- u("div", {
1910
- style: X({ width: d.widthLeft + "px" }),
1911
- class: "h-full overflow-y-auto p-4"
1912
- }, [
1913
- P(d.$slots, "left-drawer")
1914
- ], 4)
1915
- ], 4),
1916
- u("button", {
1917
- "aria-expanded": a.value.left,
1918
- "aria-controls": "drawer-left-panel",
1919
- "aria-label": a.value.left ? "Collapse left panel" : "Expand left panel",
1920
- class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1921
- onClick: p[0] || (p[0] = (i) => c("left"))
1922
- }, [
1923
- V(g(q), {
1924
- size: "lg",
1925
- icon: a.value.left ? g(R).ChevronLeft : g(R).ChevronRight
1926
- }, null, 8, ["icon"])
1927
- ], 8, Ss)
1928
- ])) : _("", !0),
1929
- u("div", Ps, [
1930
- P(d.$slots, "default")
1931
- ]),
1932
- l.value ? (r(), f("aside", Ms, [
1933
- u("button", {
1934
- "aria-expanded": a.value.right,
1935
- "aria-controls": "drawer-right-panel",
1936
- "aria-label": a.value.right ? "Collapse right panel" : "Expand right panel",
1937
- class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1938
- onClick: p[1] || (p[1] = (i) => c("right"))
1939
- }, [
1940
- V(g(q), {
1941
- size: "lg",
1942
- icon: a.value.right ? g(R).ChevronRight : g(R).ChevronLeft
1943
- }, null, 8, ["icon"])
1944
- ], 8, Bs),
1945
- u("div", {
1946
- id: "drawer-right-panel",
1947
- style: X({ width: a.value.right ? d.widthRight + "px" : "0px" }),
1948
- class: "h-full overflow-hidden bg-white shadow-sm transition-[width] duration-300 ease-in-out"
1949
- }, [
1950
- u("div", {
1951
- style: X({ width: d.widthRight + "px" }),
1952
- class: "h-full overflow-y-auto p-4"
1953
- }, [
1954
- P(d.$slots, "right-drawer")
1955
- ], 4)
1956
- ], 4)
1957
- ])) : _("", !0)
1958
- ]));
1959
- }
1960
- }), Vs = { class: "ml-1" }, As = { class: "truncate flex-1 min-w-0 text-left" }, Os = {
1961
- key: 0,
1962
- class: "badge badge-ghost badge-sm flex-shrink-0"
1963
- }, Is = /* @__PURE__ */ k({
1964
- __name: "TreeItem",
1965
- props: {
1966
- active: {},
1967
- node: {},
1968
- expanded: {},
1969
- isExpanded: { type: Function }
1970
- },
1971
- emits: ["toggle", "select"],
1972
- setup(e, { emit: t }) {
1973
- const o = e, n = t, l = v(() => o.active === o.node.id);
1974
- return (a, c) => {
1975
- const d = ce("TreeItem", !0);
1976
- return r(), f("li", Vs, [
1977
- u("div", {
1978
- class: $([
1979
- `flex items-center gap-1 cursor-pointer rounded-md px-1 py-0.5
1980
- hover:bg-gray-100`,
1981
- l.value ? "text-primary" : ""
1982
- ])
1983
- }, [
1984
- (e.node?.children?.length ?? 0) > 0 ? (r(), f("span", {
1985
- key: 0,
1986
- class: "flex items-center justify-center",
1987
- onClick: c[0] || (c[0] = (p) => n("toggle", e.node))
1988
- }, [
1989
- e.node.children && e.isExpanded(e.node.id) ? (r(), y(g(dt), {
1990
- key: 0,
1991
- class: "w-3 h-3"
1992
- })) : (r(), y(g(pt), {
1993
- key: 1,
1994
- class: "w-3 h-3"
1995
- }))
1996
- ])) : _("", !0),
1997
- u("div", {
1998
- class: "flex items-center gap-2 w-full min-w-0",
1999
- onClick: c[1] || (c[1] = (p) => n("select", e.node))
2000
- }, [
2001
- u("div", As, w(e.node.label), 1),
2002
- e.node.tag ? (r(), f("div", Os, w(e.node.tag), 1)) : _("", !0)
2003
- ])
2004
- ], 2),
2005
- e.node.children && e.isExpanded(e.node.id) ? (r(), f("ul", {
2006
- key: 0,
2007
- class: $([
2008
- "ml-4 border-l pl-2",
2009
- { "border-gray-200": !l.value, "border-primary": l.value }
2010
- ])
2011
- }, [
2012
- (r(!0), f(L, null, M(e.node.children, (p) => (r(), y(d, {
2013
- key: p.id,
2014
- node: p,
2015
- expanded: e.expanded,
2016
- active: e.active,
2017
- "is-expanded": e.isExpanded,
2018
- onToggle: c[2] || (c[2] = (i) => n("toggle", i)),
2019
- onSelect: c[3] || (c[3] = (i) => n("select", i))
2020
- }, null, 8, ["node", "expanded", "active", "is-expanded"]))), 128))
2021
- ], 2)) : _("", !0)
2022
- ]);
2023
- };
2024
- }
2025
- }), Ds = { class: "select-none text-sm" }, qn = /* @__PURE__ */ k({
2026
- __name: "TreeView",
2027
- props: {
2028
- data: {},
2029
- active: {}
2030
- },
2031
- emits: ["select"],
2032
- setup(e, { emit: t }) {
2033
- const o = e, n = t, l = x(/* @__PURE__ */ new Set()), a = (p) => {
2034
- const i = p.id;
2035
- if (!p.children || p.children.length === 0) {
2036
- n("select", p);
2037
- return;
2038
- }
2039
- l.value.has(i) ? l.value.delete(i) : l.value.add(i);
2040
- }, c = (p) => {
2041
- n("select", p), l.value.add(p.id);
2042
- }, d = (p) => l.value.has(p);
2043
- return (p, i) => (r(), f("ul", Ds, [
2044
- (r(!0), f(L, null, M(o.data, (s) => (r(), y(Is, {
2045
- key: s.id,
2046
- node: s,
2047
- expanded: l.value,
2048
- active: e.active,
2049
- "is-expanded": d,
2050
- onToggle: a,
2051
- onSelect: c
2052
- }, null, 8, ["node", "expanded", "active"]))), 128))
2053
- ]));
2054
- }
2055
- }), Rs = {
2056
- key: 0,
2057
- role: "status",
2058
- "aria-live": "polite",
2059
- class: "flex items-center justify-center h-20"
2060
- }, jn = /* @__PURE__ */ k({
2061
- __name: "loading",
2062
- props: {
2063
- loading: { type: Boolean }
2064
- },
2065
- setup(e) {
2066
- return (t, o) => e.loading ? (r(), f("div", Rs, [...o[0] || (o[0] = [
2067
- u("span", {
2068
- "aria-hidden": "true",
2069
- class: "loading loading-bars loading-md text-primary"
2070
- }, null, -1),
2071
- u("span", { class: "sr-only" }, "Loading...", -1)
2072
- ])])) : _("", !0);
2073
- }
2074
- }), Ts = {
2075
- title: { type: String, required: !0 },
2076
- opened: { type: Boolean, default: !0 },
2077
- heightFull: { type: Boolean, default: !1 },
2078
- scrollable: { type: Boolean, default: !1 },
2079
- disabled: { type: Boolean, default: !1 },
2080
- actions: {
2081
- type: Array,
2082
- default: () => []
2083
- }
2084
- }, Es = ["checked", "aria-label"], zs = { class: "collapse-title text-gray-500 text-xs font-medium" }, Ns = { class: "flex items-center justify-between" }, qs = {
2085
- key: 0,
2086
- class: "list bg-base-100"
2087
- }, js = {
2088
- key: 1,
2089
- class: "shrink-0 pt-2"
2090
- }, Fs = /* @__PURE__ */ k({
2091
- __name: "Collapse",
2092
- props: Ts,
2093
- setup(e) {
2094
- const t = Se(), o = e, n = x(o.opened), l = x(o.opened || o.disabled);
2095
- return (a, c) => (r(), f("div", {
2096
- class: $(["collapse collapse-arrow bg-white border border-gray-300", [
2097
- a.scrollable ? "flex-1 min-h-0 !grid-rows-[auto_1fr] overflow-hidden" : "",
2098
- a.heightFull ? "h-full" : "",
2099
- a.disabled ? "collapse-open" : "",
2100
- l.value && !a.scrollable ? "overflow-visible" : ""
2101
- ]])
2102
- }, [
2103
- a.disabled ? _("", !0) : (r(), f("input", {
2104
- key: 0,
2105
- type: "checkbox",
2106
- checked: n.value,
2107
- tabindex: "-1",
2108
- "aria-label": "Toggle " + a.title,
2109
- onChange: c[0] || (c[0] = (d) => l.value = d.target.checked)
2110
- }, null, 40, Es)),
2111
- u("div", zs, [
2112
- u("div", Ns, [
2113
- u("span", null, w(a.title), 1),
2114
- o.actions.length > 0 ? (r(), f("div", {
2115
- key: 0,
2116
- class: "relative z-10 flex gap-1 overflow-y-auto",
2117
- onClick: c[1] || (c[1] = le(() => {
2118
- }, ["stop"]))
2119
- }, [
2120
- (r(!0), f(L, null, M(o.actions, (d, p) => (r(), y(g(N), {
2121
- key: p,
2122
- color: g(z).blank,
2123
- size: "xs",
2124
- icon: d.icon,
2125
- tooltip: d.tooltip,
2126
- disabled: d.disabled,
2127
- onClick: d.onClick
2128
- }, {
2129
- default: S(() => [
2130
- E(w(d.label), 1)
2131
- ]),
2132
- _: 2
2133
- }, 1032, ["color", "icon", "tooltip", "disabled", "onClick"]))), 128))
2134
- ])) : _("", !0)
2135
- ])
2136
- ]),
2137
- u("div", {
2138
- class: $(["collapse-content", [
2139
- a.scrollable ? "!flex !flex-col min-h-0" : "",
2140
- g(t).list ? "p-0" : ""
2141
- ]])
2142
- }, [
2143
- u("div", {
2144
- class: $(a.scrollable ? "flex-1 min-h-0 overflow-y-auto" : "")
2145
- }, [
2146
- P(a.$slots, "default")
2147
- ], 2),
2148
- g(t).list ? (r(), f("ul", qs, [
2149
- P(a.$slots, "list")
2150
- ])) : _("", !0),
2151
- g(t).footer ? (r(), f("div", js, [
2152
- P(a.$slots, "footer")
2153
- ])) : _("", !0)
2154
- ], 2)
2155
- ], 2));
2156
- }
2157
- }), Ks = {
2158
- title: { type: String },
2159
- label: { type: String },
2160
- labelLink: { type: String },
2161
- description: { type: String },
2162
- descriptionLink: { type: String }
2163
- }, Us = { class: "list-row" }, Hs = { class: "list-col-grow" }, Ws = { key: 0 }, Gs = {
2164
- key: 1,
2165
- class: "text-xs text-gray-600"
2166
- }, Xs = ["href"], Zs = { key: 1 }, Js = {
2167
- key: 0,
2168
- class: "text-xs text-gray-500"
2169
- }, Qs = ["href"], Ys = { key: 1 }, Fn = /* @__PURE__ */ k({
2170
- __name: "CollapseRow",
2171
- props: Ks,
2172
- setup(e) {
2173
- return (t, o) => (r(), f("li", Us, [
2174
- u("div", Hs, [
2175
- t.title ? (r(), f("div", Ws, w(t.title), 1)) : _("", !0),
2176
- t.description || t.descriptionLink ? (r(), f("div", Gs, [
2177
- t.descriptionLink ? (r(), f("a", {
2178
- key: 0,
2179
- href: t.descriptionLink,
2180
- target: "_blank"
2181
- }, w(t.description ?? t.descriptionLink), 9, Xs)) : (r(), f("span", Zs, w(t.description), 1))
2182
- ])) : _("", !0)
2183
- ]),
2184
- t.label ? (r(), f("div", Js, [
2185
- t.labelLink ? (r(), f("a", {
2186
- key: 0,
2187
- href: t.labelLink,
2188
- target: "_blank"
2189
- }, w(t.label), 9, Qs)) : (r(), f("span", Ys, w(t.label), 1))
2190
- ])) : _("", !0),
2191
- P(t.$slots, "default")
2192
- ]));
2193
- }
2194
- }), en = { class: "text-gray-800" }, Kn = /* @__PURE__ */ k({
2195
- __name: "alert",
2196
- props: {
2197
- message: {},
2198
- type: {}
2199
- },
2200
- setup(e) {
2201
- const t = {
2202
- success: "alert-success",
2203
- error: "alert-error",
2204
- warning: "alert-warning",
2205
- info: "alert-info"
2206
- };
2207
- return (o, n) => (r(), f("div", {
2208
- role: "alert",
2209
- class: $(`alert alert-soft ${t[e.type]} `)
2210
- }, [
2211
- u("span", en, w(e.message), 1),
2212
- P(o.$slots, "default")
2213
- ], 2));
2214
- }
2215
- }), tn = {
2216
- title: { type: String, required: !0 },
2217
- items: {
2218
- type: Array,
2219
- required: !0
2220
- },
2221
- modelValue: {
2222
- type: Array,
2223
- default: () => []
2224
- },
2225
- labelKey: { type: String, default: "label" },
2226
- valueKey: { type: String, default: "id" },
2227
- colorKey: { type: String, default: void 0 },
2228
- countKey: { type: String, default: "count" },
2229
- counts: {
2230
- type: Object,
2231
- default: void 0
2232
- },
2233
- opened: { type: Boolean, default: !0 }
2234
- }, on = ["update:modelValue"], sn = (e, t, o, n) => {
2235
- const l = v(
2236
- () => e.value.map((s) => s[o.value])
2237
- ), a = (s) => t.value.includes(s), c = v(() => {
2238
- const s = t.value.length;
2239
- return s === 0 ? "None" : s === l.value.length ? "All" : `${s}`;
2240
- });
2241
- return { isSelected: a, selectedLabel: c, selectAll: () => n("update:modelValue", [...l.value]), selectNone: () => n("update:modelValue", []), toggleItem: (s, m) => {
2242
- m ? n("update:modelValue", [...t.value, s]) : n(
2243
- "update:modelValue",
2244
- t.value.filter((b) => b !== s)
2245
- );
2246
- } };
2247
- }, nn = { class: "flex items-center justify-between mb-2" }, ln = { class: "text-xs text-base-content/50" }, an = { class: "flex gap-1" }, rn = { class: "flex flex-col gap-1" }, un = ["checked", "onChange"], cn = { class: "text-sm flex-1 select-none" }, dn = {
2248
- key: 1,
2249
- class: "badge badge-sm badge-ghost"
2250
- }, Un = /* @__PURE__ */ k({
2251
- __name: "filter",
2252
- props: tn,
2253
- emits: on,
2254
- setup(e, { emit: t }) {
2255
- const o = e, n = t, l = v(() => o.items ?? []), { isSelected: a, selectedLabel: c, selectAll: d, selectNone: p, toggleItem: i } = sn(l, we(o, "modelValue"), we(o, "valueKey"), n);
2256
- return (s, m) => (r(), y(g(Fs), {
2257
- title: s.title,
2258
- opened: s.opened
2259
- }, {
2260
- default: S(() => [
2261
- u("div", nn, [
2262
- u("span", ln, w(g(c)) + " of " + w(l.value.length) + " items ", 1),
2263
- u("div", an, [
2264
- u("button", {
2265
- class: "btn btn-ghost btn-xs",
2266
- type: "button",
2267
- tabindex: "-1",
2268
- onClick: m[0] || (m[0] = //@ts-ignore
2269
- (...b) => g(d) && g(d)(...b))
2270
- }, " All "),
2271
- u("button", {
2272
- class: "btn btn-ghost btn-xs",
2273
- type: "button",
2274
- tabindex: "-1",
2275
- onClick: m[1] || (m[1] = //@ts-ignore
2276
- (...b) => g(p) && g(p)(...b))
2277
- }, " None ")
2278
- ])
2279
- ]),
2280
- u("div", rn, [
2281
- (r(!0), f(L, null, M(l.value, (b) => (r(), f("label", {
2282
- key: b[s.valueKey],
2283
- class: $(["flex items-center gap-3 px-2 py-1.5 rounded-lg cursor-pointer transition-colors hover:bg-base-200", { "bg-base-200/60": g(a)(b[s.valueKey]) }])
2284
- }, [
2285
- u("input", {
2286
- type: "checkbox",
2287
- class: "checkbox checkbox-sm",
2288
- checked: g(a)(b[s.valueKey]),
2289
- onChange: (h) => g(i)(
2290
- b[s.valueKey],
2291
- h.target.checked
2292
- )
2293
- }, null, 40, un),
2294
- s.colorKey && b[s.colorKey] ? (r(), f("span", {
2295
- key: 0,
2296
- class: "w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10",
2297
- style: X({ backgroundColor: b[s.colorKey] })
2298
- }, null, 4)) : _("", !0),
2299
- u("span", cn, w(b[s.labelKey]), 1),
2300
- b[s.countKey] > 0 ? (r(), f("span", dn, w(b[s.countKey]), 1)) : _("", !0)
2301
- ], 2))), 128))
2302
- ])
2303
- ]),
2304
- _: 1
2305
- }, 8, ["title", "opened"]));
2306
- }
1547
+ //#endregion
1548
+ //#region src/form/select/AutoComplete.vue?vue&type=script&setup=true&lang.ts
1549
+ var ur = [
1550
+ "aria-label",
1551
+ "aria-expanded",
1552
+ "value",
1553
+ "placeholder",
1554
+ "disabled"
1555
+ ], dr = /* @__PURE__ */ x({
1556
+ __name: "AutoComplete",
1557
+ props: or,
1558
+ emits: [
1559
+ "update:modelValue",
1560
+ "change",
1561
+ "clear",
1562
+ "focus",
1563
+ "blur"
1564
+ ],
1565
+ setup(e, { emit: n }) {
1566
+ let r = e, a = n, o = M(null), s = M(""), c = M(!1), l = lr(r), { isLoading: u, triggerSearch: d, clear: f } = l, h = rr(r), { options: g } = h;
1567
+ B(() => l.results.value, () => {
1568
+ h.setOptions(l.results.value);
1569
+ }, { immediate: !0 }), B(() => r.modelValue, (e) => {
1570
+ if (e == null || e === "") {
1571
+ s.value = "";
1572
+ return;
1573
+ }
1574
+ let t = typeof e == "object" ? e[r.labelKey] : e;
1575
+ t !== s.value && (s.value = t);
1576
+ }, { immediate: !0 });
1577
+ let v = (e) => {
1578
+ s.value = e.target.value, r.freeText ? a("update:modelValue", s.value) : a("update:modelValue", ""), d(s.value), c.value = !0;
1579
+ }, y = () => {
1580
+ d(s.value), c.value = !0;
1581
+ };
1582
+ function b() {
1583
+ setTimeout(() => {
1584
+ c.value = !1, r.freeText ? a("change", s.value) : r.modelValue || (s.value = "");
1585
+ }, 150);
1586
+ }
1587
+ let x = (e) => {
1588
+ let t = h.getOriginal(e);
1589
+ s.value = e.label, c.value = !1, a("update:modelValue", t), a("change", t);
1590
+ }, S = () => {
1591
+ s.value = "", f(), c.value = !1, a("update:modelValue", ""), a("clear"), D(() => o.value?.focus());
1592
+ }, C = () => {
1593
+ c.value = !1;
1594
+ }, w = p(() => t(r.styles)), T = p(() => i(w.value.control.select, r));
1595
+ return (e, t) => (j(), m($n, E(r, {
1596
+ options: R(g),
1597
+ "is-loading": R(u),
1598
+ "is-open": c.value,
1599
+ query: s.value,
1600
+ onClose: C,
1601
+ onSelect: x,
1602
+ onClear: S
1603
+ }), {
1604
+ default: V(() => [_("input", {
1605
+ ref_key: "inputRef",
1606
+ ref: o,
1607
+ type: "text",
1608
+ role: "combobox",
1609
+ "aria-label": e.id,
1610
+ "aria-expanded": c.value,
1611
+ "aria-autocomplete": "list",
1612
+ "aria-haspopup": "listbox",
1613
+ autocomplete: "off",
1614
+ autocorrect: "off",
1615
+ spellcheck: "false",
1616
+ class: O([T.value, "w-full"]),
1617
+ value: s.value,
1618
+ placeholder: e.placeholder,
1619
+ disabled: !e.enabled,
1620
+ onInput: v,
1621
+ onFocus: y,
1622
+ onBlur: b
1623
+ }, null, 42, ur)]),
1624
+ _: 1
1625
+ }, 16, [
1626
+ "options",
1627
+ "is-loading",
1628
+ "is-open",
1629
+ "query"
1630
+ ]));
1631
+ }
1632
+ }), fr = ["aria-label"], pr = /* @__PURE__ */ x({
1633
+ __name: "MultiSelect",
1634
+ props: /* @__PURE__ */ T(Vn, {
1635
+ modelValue: {},
1636
+ modelModifiers: {}
1637
+ }),
1638
+ emits: /* @__PURE__ */ T([
1639
+ "update:modelValue",
1640
+ "change",
1641
+ "clear",
1642
+ "focus",
1643
+ "blur"
1644
+ ], ["update:modelValue"]),
1645
+ setup(e, { emit: n }) {
1646
+ let r = M(!1), a = e, o = n, s = z(e, "modelValue"), c = (e) => {
1647
+ o("change", e);
1648
+ }, l = rr(a), { options: u } = l;
1649
+ B(() => a.options, () => {
1650
+ l.setOptions(a.options);
1651
+ }, { immediate: !0 });
1652
+ let d = p(() => s.value ? l.getLabels(...s.value).join(", ") : void 0), f = p(() => l.getValues(...s.value ?? [])), h = (e) => {
1653
+ let t = s.value ?? [];
1654
+ if (y(e)) t = t.filter((t) => l.getOption(t)?.value !== e.value);
1655
+ else {
1656
+ let n = l.getOriginal(e);
1657
+ t.push(n);
1658
+ }
1659
+ s.value = t, c(t);
1660
+ }, g = () => {
1661
+ r.value = !1, s.value = [], c([]);
1662
+ }, v = () => {
1663
+ r.value = !1;
1664
+ }, y = (e) => f.value?.includes(e.value) ?? !1, b = p(() => t(a.styles)), x = p(() => i(b.value.control.select, a));
1665
+ return (e, t) => (j(), m($n, E(a, {
1666
+ options: R(u),
1667
+ "is-open": r.value,
1668
+ disabled: !e.enabled,
1669
+ query: void 0,
1670
+ "is-active": y,
1671
+ onClose: v,
1672
+ onSelect: h,
1673
+ onClear: g
1674
+ }), {
1675
+ default: V(() => [_("button", {
1676
+ type: "button",
1677
+ class: O(["truncate block text-left", [x.value, e.width]]),
1678
+ "aria-label": e.id,
1679
+ role: "combobox",
1680
+ onClick: t[0] ||= (e) => r.value = !0
1681
+ }, I(d.value ?? "Select value"), 11, fr)]),
1682
+ _: 1
1683
+ }, 16, [
1684
+ "options",
1685
+ "is-open",
1686
+ "disabled"
1687
+ ]));
1688
+ }
1689
+ }), mr = { ...s }, hr = [
1690
+ "change",
1691
+ "focus",
1692
+ "blur"
1693
+ ], gr = { class: "flex items-center justify-center h-full" }, _r = { class: "fieldset-label" }, vr = ["aria-label", "disabled"], yr = { class: "font-bold text-gray-500 text-sm" }, br = /* @__PURE__ */ x({
1694
+ __name: "Checkbox",
1695
+ props: /* @__PURE__ */ T(mr, {
1696
+ modelValue: {},
1697
+ modelModifiers: {}
1698
+ }),
1699
+ emits: /* @__PURE__ */ T(hr, ["update:modelValue"]),
1700
+ setup(e, { emit: t }) {
1701
+ let n = e, r = t, a = z(e, "modelValue"), o = (e) => {
1702
+ r("change", a.value);
1703
+ }, s = (e) => {
1704
+ r("focus", e);
1705
+ }, l = (e) => {
1706
+ r("blur", e);
1707
+ }, u = p(() => i(n.styles.control.checkbox, n));
1708
+ return (e, t) => (j(), g("div", gr, [y(c, E(n, { "hide-label": !0 }), {
1709
+ default: V(() => [_("label", _r, [H(_("input", {
1710
+ "onUpdate:modelValue": t[0] ||= (e) => a.value = e,
1711
+ "aria-label": e.id,
1712
+ role: "checkbox",
1713
+ type: "checkbox",
1714
+ class: O(u.value),
1715
+ disabled: !e.enabled,
1716
+ onChange: o,
1717
+ onFocus: s,
1718
+ onBlur: l
1719
+ }, null, 42, vr), [[oe, a.value]]), _("span", yr, I(e.label), 1)])]),
1720
+ _: 1
1721
+ }, 16)]));
1722
+ }
1723
+ }), xr = {
1724
+ ...s,
1725
+ type: {
1726
+ type: String,
1727
+ default: "text"
1728
+ },
1729
+ clearable: {
1730
+ type: Boolean,
1731
+ default: !1
1732
+ }
1733
+ }, Sr = [
1734
+ "change",
1735
+ "focus",
1736
+ "blur",
1737
+ "clear"
1738
+ ], Cr = { class: "relative w-full" }, wr = [
1739
+ "aria-label",
1740
+ "type",
1741
+ "disabled",
1742
+ "autofocus",
1743
+ "placeholder"
1744
+ ], Tr = /* @__PURE__ */ x({
1745
+ __name: "Input",
1746
+ props: /* @__PURE__ */ T(xr, {
1747
+ modelValue: {},
1748
+ modelModifiers: {}
1749
+ }),
1750
+ emits: /* @__PURE__ */ T(Sr, ["update:modelValue"]),
1751
+ setup(e, { emit: t }) {
1752
+ let n = e, r = t, a = z(e, "modelValue"), o = (e) => {
1753
+ r("change", e);
1754
+ }, s = (e) => {
1755
+ r("focus", e);
1756
+ }, l = (e) => {
1757
+ r("blur", e);
1758
+ }, u = () => {
1759
+ a.value = "", r("clear");
1760
+ }, d = p(() => i(n.styles.control.input, n));
1761
+ return (e, t) => (j(), m(c, k(C(n)), {
1762
+ default: V(() => [_("div", Cr, [H(_("input", {
1763
+ "onUpdate:modelValue": t[0] ||= (e) => a.value = e,
1764
+ "aria-label": e.id,
1765
+ autocomplete: "off",
1766
+ type: e.type,
1767
+ class: O([[d.value, { "pr-7": e.clearable && a.value }], "!w-full"]),
1768
+ disabled: !e.enabled,
1769
+ autofocus: e.isFocused,
1770
+ placeholder: e.placeholder,
1771
+ onChange: o,
1772
+ onFocus: s,
1773
+ onBlur: l
1774
+ }, null, 42, wr), [[se, a.value]]), e.clearable && a.value ? (j(), g("button", {
1775
+ key: 0,
1776
+ type: "button",
1777
+ class: "absolute inset-y-0 right-0 flex items-center pr-2 btn btn-ghost btn-xs btn-circle opacity-60 hover:opacity-100",
1778
+ tabindex: "-1",
1779
+ "aria-label": "Clear",
1780
+ onMousedown: U(u, ["prevent"])
1781
+ }, [...t[1] ||= [_("svg", {
1782
+ xmlns: "http://www.w3.org/2000/svg",
1783
+ class: "h-3.5 w-3.5",
1784
+ fill: "none",
1785
+ viewBox: "0 0 24 24",
1786
+ stroke: "currentColor",
1787
+ "stroke-width": "2.5"
1788
+ }, [_("path", {
1789
+ "stroke-linecap": "round",
1790
+ "stroke-linejoin": "round",
1791
+ d: "M6 18L18 6M6 6l12 12"
1792
+ })], -1)]], 32)) : h("", !0)])]),
1793
+ _: 1
1794
+ }, 16));
1795
+ }
1796
+ }), Er = {
1797
+ ...s,
1798
+ steps: {
1799
+ type: Number,
1800
+ default: 1
1801
+ }
1802
+ }, Dr = [
1803
+ "change",
1804
+ "focus",
1805
+ "blur"
1806
+ ], Or = [
1807
+ "aria-label",
1808
+ "disabled",
1809
+ "step",
1810
+ "autofocus",
1811
+ "placeholder"
1812
+ ], kr = /* @__PURE__ */ x({
1813
+ __name: "InputNumber",
1814
+ props: /* @__PURE__ */ T(Er, {
1815
+ modelValue: {},
1816
+ modelModifiers: {}
1817
+ }),
1818
+ emits: /* @__PURE__ */ T(Dr, ["update:modelValue"]),
1819
+ setup(e, { emit: t }) {
1820
+ let n = e, r = t, a = z(e, "modelValue"), o = (e) => {
1821
+ r("change", e);
1822
+ }, s = (e) => {
1823
+ r("focus", e);
1824
+ }, l = (e) => {
1825
+ r("blur", e);
1826
+ }, u = p(() => i(n.styles?.control?.input, n));
1827
+ return (e, t) => (j(), m(c, k(C(n)), {
1828
+ default: V(() => [H(_("input", {
1829
+ "onUpdate:modelValue": t[0] ||= (e) => a.value = e,
1830
+ autocomplete: "off",
1831
+ "aria-label": e.id,
1832
+ type: "number",
1833
+ class: O(["w-full", [u.value]]),
1834
+ disabled: !e.enabled,
1835
+ step: e.steps,
1836
+ autofocus: e.isFocused,
1837
+ placeholder: e.placeholder,
1838
+ onChange: o,
1839
+ onFocus: s,
1840
+ onBlur: l
1841
+ }, null, 42, Or), [[ce, a.value]])]),
1842
+ _: 1
1843
+ }, 16));
1844
+ }
1845
+ }), Ar = {
1846
+ ...s,
1847
+ rows: {
1848
+ type: Number,
1849
+ default: 4
1850
+ },
1851
+ dir: {
1852
+ type: String,
1853
+ default: "ltr"
1854
+ },
1855
+ height: {
1856
+ type: String,
1857
+ default: void 0
1858
+ },
1859
+ minHeight: {
1860
+ type: String,
1861
+ default: void 0
1862
+ }
1863
+ }, jr = [
1864
+ "change",
1865
+ "focus",
1866
+ "blur"
1867
+ ], Mr = [
1868
+ "aria-label",
1869
+ "disabled",
1870
+ "rows",
1871
+ "dir",
1872
+ "autofocus",
1873
+ "placeholder"
1874
+ ], Nr = /* @__PURE__ */ x({
1875
+ __name: "Textarea",
1876
+ props: /* @__PURE__ */ T(Ar, {
1877
+ modelValue: {},
1878
+ modelModifiers: {}
1879
+ }),
1880
+ emits: /* @__PURE__ */ T(jr, ["update:modelValue"]),
1881
+ setup(e, { emit: t }) {
1882
+ let n = e, r = t, a = z(e, "modelValue"), o = (e) => {
1883
+ r("change", e);
1884
+ }, s = (e) => {
1885
+ r("focus", e);
1886
+ }, l = (e) => {
1887
+ r("blur", e);
1888
+ }, u = p(() => i(n.styles.control.textarea, n));
1889
+ return (e, t) => (j(), m(c, k(C(n)), {
1890
+ default: V(() => [H(_("textarea", {
1891
+ "onUpdate:modelValue": t[0] ||= (e) => a.value = e,
1892
+ autocomplete: "off",
1893
+ type: "text",
1894
+ "aria-label": e.id,
1895
+ class: O(["w-full", u.value]),
1896
+ disabled: !e.enabled,
1897
+ rows: e.rows,
1898
+ dir: e.dir,
1899
+ style: A({
1900
+ height: e.height,
1901
+ minHeight: e.minHeight
1902
+ }),
1903
+ autofocus: e.isFocused,
1904
+ placeholder: e.placeholder,
1905
+ onChange: o,
1906
+ onFocus: s,
1907
+ onBlur: l
1908
+ }, null, 46, Mr), [[ce, a.value]])]),
1909
+ _: 1
1910
+ }, 16));
1911
+ }
1912
+ }), Pr = b({
1913
+ loader: () => import("./Markdown-Dj1gzJJq.js"),
1914
+ errorComponent: In,
1915
+ onError(e, t, n) {
1916
+ console.warn("[@ghentcdh/ui] Markdown editor could not load — install the TipTap peer dependencies (@tiptap/pm, @tiptap/starter-kit, @tiptap/vue-3, tiptap-markdown) to enable it. Falling back to a plain textarea.", e), n();
1917
+ }
1918
+ }), Fr = {
1919
+ widthLeft: {
1920
+ type: Number,
1921
+ default: 200
1922
+ },
1923
+ widthRight: {
1924
+ type: Number,
1925
+ default: 200
1926
+ },
1927
+ initialLeftOpen: {
1928
+ type: Boolean,
1929
+ default: !0
1930
+ },
1931
+ initialRightOpen: {
1932
+ type: Boolean,
1933
+ default: !0
1934
+ },
1935
+ drawerColor: {
1936
+ type: String,
1937
+ default: "bg-base-200"
1938
+ }
1939
+ }, Ir = { class: "flex h-full overflow-hidden gap-2" }, Lr = {
1940
+ key: 0,
1941
+ id: "drawer-left",
1942
+ class: "min-h-0 relative flex-shrink-0 overflow-visible flex"
1943
+ }, Rr = ["aria-expanded", "aria-label"], zr = { class: "flex-1 overflow-y-auto bg-white" }, Br = {
1944
+ key: 1,
1945
+ class: "min-h-0 relative flex-shrink-0 bg-white overflow-visible flex"
1946
+ }, Vr = ["aria-expanded", "aria-label"], Hr = /* @__PURE__ */ x({
1947
+ __name: "drawer",
1948
+ props: Fr,
1949
+ setup(e) {
1950
+ let t = e, n = ae(), r = p(() => !!n["left-drawer"]), i = p(() => !!n["right-drawer"]), a = M({
1951
+ left: t.initialLeftOpen,
1952
+ right: t.initialRightOpen
1953
+ }), o = (e) => {
1954
+ a.value[e] = !a.value[e];
1955
+ };
1956
+ return (e, t) => (j(), g("main", Ir, [
1957
+ r.value ? (j(), g("aside", Lr, [_("div", {
1958
+ id: "drawer-left-panel",
1959
+ style: A({ width: a.value.left ? e.widthLeft + "px" : "0px" }),
1960
+ class: O(["h-full overflow-hidden shadow-sm transition-[width] duration-300 ease-in-out", [e.drawerColor]])
1961
+ }, [_("div", {
1962
+ style: A({ width: e.widthLeft + "px" }),
1963
+ class: "h-full overflow-y-auto p-4"
1964
+ }, [P(e.$slots, "left-drawer")], 4)], 6), _("button", {
1965
+ "aria-expanded": a.value.left,
1966
+ "aria-controls": "drawer-left-panel",
1967
+ "aria-label": a.value.left ? "Collapse left panel" : "Expand left panel",
1968
+ class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1969
+ onClick: t[0] ||= (e) => o("left")
1970
+ }, [y(R(K), {
1971
+ size: "lg",
1972
+ icon: a.value.left ? R(G).ChevronLeft : R(G).ChevronRight
1973
+ }, null, 8, ["icon"])], 8, Rr)])) : h("", !0),
1974
+ _("div", zr, [P(e.$slots, "default")]),
1975
+ i.value ? (j(), g("aside", Br, [_("button", {
1976
+ "aria-expanded": a.value.right,
1977
+ "aria-controls": "drawer-right-panel",
1978
+ "aria-label": a.value.right ? "Collapse right panel" : "Expand right panel",
1979
+ class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1980
+ onClick: t[1] ||= (e) => o("right")
1981
+ }, [y(R(K), {
1982
+ size: "lg",
1983
+ icon: a.value.right ? R(G).ChevronRight : R(G).ChevronLeft
1984
+ }, null, 8, ["icon"])], 8, Vr), _("div", {
1985
+ id: "drawer-right-panel",
1986
+ style: A({ width: a.value.right ? e.widthRight + "px" : "0px" }),
1987
+ class: O(["h-full overflow-hidden shadow-sm transition-[width] duration-300 ease-in-out", [e.drawerColor]])
1988
+ }, [_("div", {
1989
+ style: A({ width: e.widthRight + "px" }),
1990
+ class: "h-full overflow-y-auto p-4"
1991
+ }, [P(e.$slots, "right-drawer")], 4)], 6)])) : h("", !0)
1992
+ ]));
1993
+ }
1994
+ }), Ur = { class: "ml-1" }, Wr = {
1995
+ key: 0,
1996
+ xmlns: "http://www.w3.org/2000/svg",
1997
+ viewBox: "0 0 24 24",
1998
+ fill: "currentColor",
1999
+ "aria-hidden": "true",
2000
+ class: "w-3 h-3"
2001
+ }, Gr = {
2002
+ key: 1,
2003
+ xmlns: "http://www.w3.org/2000/svg",
2004
+ viewBox: "0 0 24 24",
2005
+ fill: "currentColor",
2006
+ "aria-hidden": "true",
2007
+ class: "w-3 h-3"
2008
+ }, Kr = { class: "truncate flex-1 min-w-0 text-left" }, qr = {
2009
+ key: 0,
2010
+ class: "badge badge-ghost badge-sm flex-shrink-0"
2011
+ }, Jr = /* @__PURE__ */ x({
2012
+ __name: "TreeItem",
2013
+ props: {
2014
+ active: {},
2015
+ node: {},
2016
+ expanded: {},
2017
+ isExpanded: { type: Function }
2018
+ },
2019
+ emits: ["toggle", "select"],
2020
+ setup(e, { emit: t }) {
2021
+ let n = e, r = t, i = p(() => n.active === n.node.id);
2022
+ return (t, n) => {
2023
+ let a = ne("TreeItem", !0);
2024
+ return j(), g("li", Ur, [_("div", { class: O(["flex items-center gap-1 cursor-pointer rounded-md px-1 py-0.5\n hover:bg-gray-100", i.value ? "text-primary" : ""]) }, [(e.node?.children?.length ?? 0) > 0 ? (j(), g("span", {
2025
+ key: 0,
2026
+ class: "flex items-center justify-center",
2027
+ onClick: n[0] ||= (t) => r("toggle", e.node)
2028
+ }, [e.node.children && e.isExpanded(e.node.id) ? (j(), g("svg", Wr, [...n[4] ||= [_("path", {
2029
+ "fill-rule": "evenodd",
2030
+ d: "M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",
2031
+ "clip-rule": "evenodd"
2032
+ }, null, -1)]])) : (j(), g("svg", Gr, [...n[5] ||= [_("path", {
2033
+ "fill-rule": "evenodd",
2034
+ d: "M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",
2035
+ "clip-rule": "evenodd"
2036
+ }, null, -1)]]))])) : h("", !0), _("div", {
2037
+ class: "flex items-center gap-2 w-full min-w-0",
2038
+ onClick: n[1] ||= (t) => r("select", e.node)
2039
+ }, [_("div", Kr, I(e.node.label), 1), e.node.tag ? (j(), g("div", qr, I(e.node.tag), 1)) : h("", !0)])], 2), e.node.children && e.isExpanded(e.node.id) ? (j(), g("ul", {
2040
+ key: 0,
2041
+ class: O(["ml-4 border-l pl-2", {
2042
+ "border-gray-200": !i.value,
2043
+ "border-primary": i.value
2044
+ }])
2045
+ }, [(j(!0), g(l, null, N(e.node.children, (t) => (j(), m(a, {
2046
+ key: t.id,
2047
+ node: t,
2048
+ expanded: e.expanded,
2049
+ active: e.active,
2050
+ "is-expanded": e.isExpanded,
2051
+ onToggle: n[2] ||= (e) => r("toggle", e),
2052
+ onSelect: n[3] ||= (e) => r("select", e)
2053
+ }, null, 8, [
2054
+ "node",
2055
+ "expanded",
2056
+ "active",
2057
+ "is-expanded"
2058
+ ]))), 128))], 2)) : h("", !0)]);
2059
+ };
2060
+ }
2061
+ }), Yr = { class: "select-none text-sm" }, Xr = /* @__PURE__ */ x({
2062
+ __name: "TreeView",
2063
+ props: {
2064
+ data: {},
2065
+ active: {}
2066
+ },
2067
+ emits: ["select"],
2068
+ setup(e, { emit: t }) {
2069
+ let n = e, r = t, i = M(/* @__PURE__ */ new Set()), a = (e) => {
2070
+ let t = e.id;
2071
+ if (!e.children || e.children.length === 0) {
2072
+ r("select", e);
2073
+ return;
2074
+ }
2075
+ i.value.has(t) ? i.value.delete(t) : i.value.add(t);
2076
+ }, o = (e) => {
2077
+ r("select", e), i.value.add(e.id);
2078
+ }, s = (e) => i.value.has(e);
2079
+ return (t, r) => (j(), g("ul", Yr, [(j(!0), g(l, null, N(n.data, (t) => (j(), m(Jr, {
2080
+ key: t.id,
2081
+ node: t,
2082
+ expanded: i.value,
2083
+ active: e.active,
2084
+ "is-expanded": s,
2085
+ onToggle: a,
2086
+ onSelect: o
2087
+ }, null, 8, [
2088
+ "node",
2089
+ "expanded",
2090
+ "active"
2091
+ ]))), 128))]));
2092
+ }
2093
+ }), Zr = {
2094
+ key: 0,
2095
+ role: "status",
2096
+ "aria-live": "polite",
2097
+ class: "flex items-center justify-center h-20"
2098
+ }, Qr = /* @__PURE__ */ x({
2099
+ __name: "loading",
2100
+ props: { loading: { type: Boolean } },
2101
+ setup(e) {
2102
+ return (t, n) => e.loading ? (j(), g("div", Zr, [...n[0] ||= [_("span", {
2103
+ "aria-hidden": "true",
2104
+ class: "loading loading-bars loading-md text-primary"
2105
+ }, null, -1), _("span", { class: "sr-only" }, "Loading...", -1)]])) : h("", !0);
2106
+ }
2107
+ }), $r = {
2108
+ title: {
2109
+ type: String,
2110
+ required: !0
2111
+ },
2112
+ opened: {
2113
+ type: Boolean,
2114
+ default: !0
2115
+ },
2116
+ heightFull: {
2117
+ type: Boolean,
2118
+ default: !1
2119
+ },
2120
+ scrollable: {
2121
+ type: Boolean,
2122
+ default: !1
2123
+ },
2124
+ disabled: {
2125
+ type: Boolean,
2126
+ default: !1
2127
+ },
2128
+ actions: {
2129
+ type: Array,
2130
+ default: () => []
2131
+ }
2132
+ }, ei = ["checked", "aria-label"], ti = { class: "collapse-title text-gray-500 text-xs font-medium" }, ni = { class: "flex items-center justify-between" }, ri = {
2133
+ key: 0,
2134
+ class: "list bg-base-100"
2135
+ }, ii = {
2136
+ key: 1,
2137
+ class: "shrink-0 pt-2"
2138
+ }, ai = /* @__PURE__ */ x({
2139
+ __name: "Collapse",
2140
+ props: $r,
2141
+ setup(e) {
2142
+ let t = ae(), n = e, r = M(n.opened), i = M(n.opened || n.disabled);
2143
+ return (e, a) => (j(), g("div", { class: O(["collapse collapse-arrow bg-white border border-gray-300", [
2144
+ e.scrollable ? "flex-1 min-h-0 !grid-rows-[auto_1fr] overflow-hidden" : "",
2145
+ e.heightFull ? "h-full" : "",
2146
+ e.disabled ? "collapse-open" : "",
2147
+ i.value && !e.scrollable ? "overflow-visible" : ""
2148
+ ]]) }, [
2149
+ e.disabled ? h("", !0) : (j(), g("input", {
2150
+ key: 0,
2151
+ type: "checkbox",
2152
+ checked: r.value,
2153
+ tabindex: "-1",
2154
+ "aria-label": "Toggle " + e.title,
2155
+ onChange: a[0] ||= (e) => i.value = e.target.checked
2156
+ }, null, 40, ei)),
2157
+ _("div", ti, [_("div", ni, [_("span", null, I(e.title), 1), n.actions.length > 0 ? (j(), g("div", {
2158
+ key: 0,
2159
+ class: "relative z-10 flex gap-1 overflow-y-auto",
2160
+ onClick: a[1] ||= U(() => {}, ["stop"])
2161
+ }, [(j(!0), g(l, null, N(n.actions, (e, t) => (j(), m(R(Z), {
2162
+ key: t,
2163
+ color: R(X).blank,
2164
+ size: "xs",
2165
+ icon: e.icon,
2166
+ tooltip: e.tooltip,
2167
+ disabled: e.disabled,
2168
+ onClick: e.onClick
2169
+ }, {
2170
+ default: V(() => [v(I(e.label), 1)]),
2171
+ _: 2
2172
+ }, 1032, [
2173
+ "color",
2174
+ "icon",
2175
+ "tooltip",
2176
+ "disabled",
2177
+ "onClick"
2178
+ ]))), 128))])) : h("", !0)])]),
2179
+ _("div", { class: O(["collapse-content", [e.scrollable ? "!flex !flex-col min-h-0" : "", R(t).list ? "p-0" : ""]]) }, [
2180
+ _("div", { class: O(e.scrollable ? "flex-1 min-h-0 overflow-y-auto" : "") }, [P(e.$slots, "default")], 2),
2181
+ R(t).list ? (j(), g("ul", ri, [P(e.$slots, "list")])) : h("", !0),
2182
+ R(t).footer ? (j(), g("div", ii, [P(e.$slots, "footer")])) : h("", !0)
2183
+ ], 2)
2184
+ ], 2));
2185
+ }
2186
+ }), oi = {
2187
+ title: { type: String },
2188
+ label: { type: String },
2189
+ labelLink: { type: String },
2190
+ description: { type: String },
2191
+ descriptionLink: { type: String }
2192
+ }, si = { class: "list-row" }, ci = { class: "list-col-grow" }, li = { key: 0 }, ui = {
2193
+ key: 1,
2194
+ class: "text-xs text-gray-600"
2195
+ }, di = ["href"], fi = { key: 1 }, pi = {
2196
+ key: 0,
2197
+ class: "text-xs text-gray-500"
2198
+ }, mi = ["href"], hi = { key: 1 }, gi = /* @__PURE__ */ x({
2199
+ __name: "CollapseRow",
2200
+ props: oi,
2201
+ setup(e) {
2202
+ return (e, t) => (j(), g("li", si, [
2203
+ _("div", ci, [e.title ? (j(), g("div", li, I(e.title), 1)) : h("", !0), e.description || e.descriptionLink ? (j(), g("div", ui, [e.descriptionLink ? (j(), g("a", {
2204
+ key: 0,
2205
+ href: e.descriptionLink,
2206
+ target: "_blank"
2207
+ }, I(e.description ?? e.descriptionLink), 9, di)) : (j(), g("span", fi, I(e.description), 1))])) : h("", !0)]),
2208
+ e.label ? (j(), g("div", pi, [e.labelLink ? (j(), g("a", {
2209
+ key: 0,
2210
+ href: e.labelLink,
2211
+ target: "_blank"
2212
+ }, I(e.label), 9, mi)) : (j(), g("span", hi, I(e.label), 1))])) : h("", !0),
2213
+ P(e.$slots, "default")
2214
+ ]));
2215
+ }
2216
+ }), _i = { class: "text-gray-800" }, vi = /* @__PURE__ */ x({
2217
+ __name: "alert",
2218
+ props: {
2219
+ message: {},
2220
+ type: {}
2221
+ },
2222
+ setup(e) {
2223
+ let t = {
2224
+ success: "alert-success",
2225
+ error: "alert-error",
2226
+ warning: "alert-warning",
2227
+ info: "alert-info"
2228
+ };
2229
+ return (n, r) => (j(), g("div", {
2230
+ role: "alert",
2231
+ class: O(`alert alert-soft ${t[e.type]} `)
2232
+ }, [_("span", _i, I(e.message), 1), P(n.$slots, "default")], 2));
2233
+ }
2234
+ }), yi = {
2235
+ title: {
2236
+ type: String,
2237
+ required: !0
2238
+ },
2239
+ items: {
2240
+ type: Array,
2241
+ required: !0
2242
+ },
2243
+ modelValue: {
2244
+ type: Array,
2245
+ default: () => []
2246
+ },
2247
+ labelKey: {
2248
+ type: String,
2249
+ default: "label"
2250
+ },
2251
+ valueKey: {
2252
+ type: String,
2253
+ default: "id"
2254
+ },
2255
+ colorKey: {
2256
+ type: String,
2257
+ default: void 0
2258
+ },
2259
+ countKey: {
2260
+ type: String,
2261
+ default: "count"
2262
+ },
2263
+ counts: {
2264
+ type: Object,
2265
+ default: void 0
2266
+ },
2267
+ opened: {
2268
+ type: Boolean,
2269
+ default: !0
2270
+ }
2271
+ }, bi = ["update:modelValue"], xi = (e, t, n, r) => {
2272
+ let i = p(() => e.value.map((e) => e[n.value]));
2273
+ return {
2274
+ isSelected: (e) => t.value.includes(e),
2275
+ selectedLabel: p(() => {
2276
+ let e = t.value.length;
2277
+ return e === 0 ? "None" : e === i.value.length ? "All" : `${e}`;
2278
+ }),
2279
+ selectAll: () => r("update:modelValue", [...i.value]),
2280
+ selectNone: () => r("update:modelValue", []),
2281
+ toggleItem: (e, n) => {
2282
+ n ? r("update:modelValue", [...t.value, e]) : r("update:modelValue", t.value.filter((t) => t !== e));
2283
+ }
2284
+ };
2285
+ }, Si = { class: "flex items-center justify-between mb-2" }, Ci = { class: "text-xs text-base-content/50" }, wi = { class: "flex gap-1" }, Ti = { class: "flex flex-col gap-1" }, Ei = ["checked", "onChange"], Di = { class: "text-sm flex-1 select-none" }, Oi = {
2286
+ key: 1,
2287
+ class: "badge badge-sm badge-ghost"
2288
+ }, ki = /* @__PURE__ */ x({
2289
+ __name: "filter",
2290
+ props: yi,
2291
+ emits: bi,
2292
+ setup(e, { emit: t }) {
2293
+ let n = e, r = t, i = p(() => n.items ?? []), { isSelected: a, selectedLabel: o, selectAll: s, selectNone: c, toggleItem: u } = xi(i, re(n, "modelValue"), re(n, "valueKey"), r);
2294
+ return (e, t) => (j(), m(R(ai), {
2295
+ title: e.title,
2296
+ opened: e.opened
2297
+ }, {
2298
+ default: V(() => [_("div", Si, [_("span", Ci, I(R(o)) + " of " + I(i.value.length) + " items ", 1), _("div", wi, [_("button", {
2299
+ class: "btn btn-ghost btn-xs",
2300
+ type: "button",
2301
+ tabindex: "-1",
2302
+ onClick: t[0] ||= (...e) => R(s) && R(s)(...e)
2303
+ }, " All "), _("button", {
2304
+ class: "btn btn-ghost btn-xs",
2305
+ type: "button",
2306
+ tabindex: "-1",
2307
+ onClick: t[1] ||= (...e) => R(c) && R(c)(...e)
2308
+ }, " None ")])]), _("div", Ti, [(j(!0), g(l, null, N(i.value, (t) => (j(), g("label", {
2309
+ key: t[e.valueKey],
2310
+ class: O(["flex items-center gap-3 px-2 py-1.5 rounded-lg cursor-pointer transition-colors hover:bg-base-200", { "bg-base-200/60": R(a)(t[e.valueKey]) }])
2311
+ }, [
2312
+ _("input", {
2313
+ type: "checkbox",
2314
+ class: "checkbox checkbox-sm",
2315
+ checked: R(a)(t[e.valueKey]),
2316
+ onChange: (n) => R(u)(t[e.valueKey], n.target.checked)
2317
+ }, null, 40, Ei),
2318
+ e.colorKey && t[e.colorKey] ? (j(), g("span", {
2319
+ key: 0,
2320
+ class: "w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10",
2321
+ style: A({ backgroundColor: t[e.colorKey] })
2322
+ }, null, 4)) : h("", !0),
2323
+ _("span", Di, I(t[e.labelKey]), 1),
2324
+ t[e.countKey] > 0 ? (j(), g("span", Oi, I(t[e.countKey]), 1)) : h("", !0)
2325
+ ], 2))), 128))])]),
2326
+ _: 1
2327
+ }, 8, ["title", "opened"]));
2328
+ }
2307
2329
  });
2308
- export {
2309
- Kn as Alert,
2310
- On as Autocomplete,
2311
- Mt as BadgeSize,
2312
- Ln as BooleanCell,
2313
- N as Btn,
2314
- _n as BtnBadge,
2315
- Tt as BtnBadgeEmits,
2316
- Rt as BtnBadgeProperties,
2317
- Dt as BtnEmits,
2318
- It as BtnProperties,
2319
- Pt as ButtonSize,
2320
- Me as ButtonTag,
2321
- fe as ButtonType,
2322
- Sn as Card,
2323
- Rn as Checkbox,
2324
- Bn as ClickOutside,
2325
- Fs as Collapse,
2326
- Fn as CollapseRow,
2327
- z as Color,
2328
- zt as ConfirmModal,
2329
- Z as ControlWrapper,
2330
- Nn as Drawer,
2331
- kn as Dropdown,
2332
- Un as Filter,
2333
- on as FilterEmits,
2334
- tn as FilterProperties,
2335
- q as Icon,
2336
- R as IconEnum,
2337
- ft as IconMap,
2338
- mt as IconProperties,
2339
- Tn as Input,
2340
- En as InputNumber,
2341
- jn as Loading,
2342
- Dn as Markdown,
2343
- wn as Menu,
2344
- Vt as Modal,
2345
- Ct as ModalEmits,
2346
- $t as ModalProperties,
2347
- me as ModalService,
2348
- St as ModalSize,
2349
- Nt as ModalWrapper,
2350
- In as MultiSelect,
2351
- qt as NotificationMessage,
2352
- be as NotificationService,
2353
- Kt as Notifications,
2354
- co as PaginationComponent,
2355
- An as SelectComponent,
2356
- $n as ShellComponent,
2357
- pe as SubMenu,
2358
- xn as Table,
2359
- xn as TableComponent,
2360
- Cn as TextCell,
2361
- zn as Textarea,
2362
- qn as TreeView,
2363
- Pn as addClickOutsideEventListener,
2364
- U as buildInputStyle,
2365
- Vn as hasCustomEventListener,
2366
- qo as isDescriptionHidden,
2367
- ae as mergeStyles,
2368
- se as myStyles,
2369
- Mn as removeClickOutsideEventListener,
2370
- Ae as showErrors,
2371
- sn as useFilter
2372
- };
2330
+ //#endregion
2331
+ export { vi as Alert, dr as Autocomplete, Qe as BadgeSize, xn as BooleanCell, Z as Btn, ut as BtnBadge, st as BtnBadgeEmits, ot as BtnBadgeProperties, at as BtnEmits, it as BtnProperties, Ze as ButtonSize, tt as ButtonTag, Y as ButtonType, kn as Card, br as Checkbox, Mn as ClickOutside, ai as Collapse, gi as CollapseRow, X as Color, dt as ConfirmModal, c as ControlWrapper, s as ControlWrapperProperties, Hr as Drawer, We as Dropdown, ki as Filter, bi as FilterEmits, yi as FilterProperties, K as Icon, G as IconEnum, Me as IconMap, Ne as IconProperties, Tr as Input, kr as InputNumber, Qr as Loading, Pr as Markdown, Ue as Menu, et as Modal, Ke as ModalEmits, Ge as ModalProperties, ft as ModalService, Xe as ModalSize, pt as ModalWrapper, pr as MultiSelect, mt as NotificationMessage, gt as NotificationService, vt as Notifications, Bt as PaginationComponent, ar as SelectComponent, At as ShellComponent, q as SubMenu, hn as Table, hn as TableComponent, yn as TextCell, Nr as Textarea, Xr as TreeView, An as addClickOutsideEventListener, i as buildInputStyle, Pn as hasCustomEventListener, o as isDescriptionHidden, t as mergeStyles, r as myStyles, jn as removeClickOutsideEventListener, n as showErrors, xi as useFilter, Ye as useFocusTrap };