@myghf/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/components/button/Button.vue.d.ts +80 -0
- package/dist/components/button/Button.vue.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +14 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.vue.d.ts +92 -0
- package/dist/components/data-table/DataTable.vue.d.ts.map +1 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +21 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.vue.d.ts +36 -0
- package/dist/components/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.vue.d.ts +22 -0
- package/dist/components/dropdown-menu/DropdownMenu.vue.d.ts.map +1 -0
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.d.ts +27 -0
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +42 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts.map +1 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +18 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts.map +1 -0
- package/dist/components/icon/Icon.vue.d.ts +9 -0
- package/dist/components/icon/Icon.vue.d.ts.map +1 -0
- package/dist/components/input/Input.vue.d.ts +22 -0
- package/dist/components/input/Input.vue.d.ts.map +1 -0
- package/dist/components/password/Password.vue.d.ts +18 -0
- package/dist/components/password/Password.vue.d.ts.map +1 -0
- package/dist/components/select/Select.vue.d.ts +25 -0
- package/dist/components/select/Select.vue.d.ts.map +1 -0
- package/dist/components/select-button/SelectButton.vue.d.ts +80 -0
- package/dist/components/select-button/SelectButton.vue.d.ts.map +1 -0
- package/dist/components/table/Table.vue.d.ts +26 -0
- package/dist/components/table/Table.vue.d.ts.map +1 -0
- package/dist/components/table/TableBody.vue.d.ts +18 -0
- package/dist/components/table/TableBody.vue.d.ts.map +1 -0
- package/dist/components/table/TableCell.vue.d.ts +24 -0
- package/dist/components/table/TableCell.vue.d.ts.map +1 -0
- package/dist/components/table/TableEmpty.vue.d.ts +22 -0
- package/dist/components/table/TableEmpty.vue.d.ts.map +1 -0
- package/dist/components/table/TableHead.vue.d.ts +25 -0
- package/dist/components/table/TableHead.vue.d.ts.map +1 -0
- package/dist/components/table/TableHeader.vue.d.ts +18 -0
- package/dist/components/table/TableHeader.vue.d.ts.map +1 -0
- package/dist/components/table/TablePagination.vue.d.ts +25 -0
- package/dist/components/table/TablePagination.vue.d.ts.map +1 -0
- package/dist/components/table/TableRow.vue.d.ts +23 -0
- package/dist/components/table/TableRow.vue.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.vue.d.ts +25 -0
- package/dist/components/tabs/Tabs.vue.d.ts.map +1 -0
- package/dist/components/tabs/TabsContent.vue.d.ts +24 -0
- package/dist/components/tabs/TabsContent.vue.d.ts.map +1 -0
- package/dist/components/tabs/TabsList.vue.d.ts +18 -0
- package/dist/components/tabs/TabsList.vue.d.ts.map +1 -0
- package/dist/components/tabs/TabsTrigger.vue.d.ts +22 -0
- package/dist/components/tabs/TabsTrigger.vue.d.ts.map +1 -0
- package/dist/components/tag/Tag.vue.d.ts +57 -0
- package/dist/components/tag/Tag.vue.d.ts.map +1 -0
- package/dist/components/textarea/Textarea.vue.d.ts +16 -0
- package/dist/components/textarea/Textarea.vue.d.ts.map +1 -0
- package/dist/components/transfer-list/TransferList.vue.d.ts +49 -0
- package/dist/components/transfer-list/TransferList.vue.d.ts.map +1 -0
- package/dist/components/tree-select/TreeSelect.vue.d.ts +27 -0
- package/dist/components/tree-select/TreeSelect.vue.d.ts.map +1 -0
- package/dist/components/tree-table/TreeTable.vue.d.ts +41 -0
- package/dist/components/tree-table/TreeTable.vue.d.ts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1543 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/date.d.ts +10 -0
- package/dist/lib/date.d.ts.map +1 -0
- package/dist/lib/icons.d.ts +8 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/pagination.d.ts +12 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/table.d.ts +23 -0
- package/dist/lib/table.d.ts.map +1 -0
- package/dist/lib/tableInteractions.d.ts +16 -0
- package/dist/lib/tableInteractions.d.ts.map +1 -0
- package/dist/lib/tree.d.ts +28 -0
- package/dist/lib/tree.d.ts.map +1 -0
- package/dist/tailwindPreset.js +95 -0
- package/dist/tokens.css +81 -0
- package/package.json +67 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1543 @@
|
|
|
1
|
+
import { clsx as e } from "clsx";
|
|
2
|
+
import { twMerge as t } from "tailwind-merge";
|
|
3
|
+
import { CalendarDate as n, CalendarDateTime as r, getLocalTimeZone as i } from "@internationalized/date";
|
|
4
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, mergeProps as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, renderSlot as S, resolveDynamicComponent as C, toDisplayString as w, unref as T, useAttrs as E, useSlots as D, vModelText as O, vShow as k, watch as A, withCtx as j, withDirectives as M, withModifiers as N } from "vue";
|
|
5
|
+
import * as P from "lucide-vue-next";
|
|
6
|
+
import { Calendar as ee, Check as F, ChevronDown as I, ChevronLeft as L, ChevronRight as R, ChevronUp as te, ChevronsLeft as ne, ChevronsRight as re, ChevronsUpDown as ie, Clock as ae, Eye as oe, EyeOff as se, Search as ce, X as z } from "lucide-vue-next";
|
|
7
|
+
import { tv as B } from "tailwind-variants";
|
|
8
|
+
import { CheckboxIndicator as le, CheckboxRoot as ue, DialogClose as de, DialogContent as fe, DialogDescription as pe, DialogOverlay as me, DialogPortal as he, DialogRoot as ge, DialogTitle as _e, DialogTrigger as ve, DropdownMenuContent as ye, DropdownMenuItem as be, DropdownMenuPortal as xe, DropdownMenuRoot as Se, DropdownMenuTrigger as Ce, PopoverContent as we, PopoverRoot as Te, PopoverTrigger as Ee, RadioGroupIndicator as De, RadioGroupItem as Oe, RadioGroupRoot as ke, SelectContent as Ae, SelectItem as je, SelectItemIndicator as Me, SelectItemText as Ne, SelectRoot as Pe, SelectTrigger as Fe, SelectValue as Ie, TabsContent as Le, TabsList as Re, TabsRoot as ze, TabsTrigger as Be, TreeItem as Ve, TreeRoot as He } from "reka-ui";
|
|
9
|
+
import { FlexRender as V, createExpandedRowModel as Ue, createPaginatedRowModel as We, createSortedRowModel as Ge, rowExpandingFeature as Ke, rowPaginationFeature as qe, rowSortingFeature as Je, sortFns as Ye, tableFeatures as Xe, useTable as Ze } from "@tanstack/vue-table";
|
|
10
|
+
//#region src/lib/cn.ts
|
|
11
|
+
function H(...n) {
|
|
12
|
+
return t(e(n));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/lib/date.ts
|
|
16
|
+
function Qe(e) {
|
|
17
|
+
return new n(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
18
|
+
}
|
|
19
|
+
function $e(e) {
|
|
20
|
+
return e instanceof r ? e.toDate(i()) : new Date(e.year, e.month - 1, e.day);
|
|
21
|
+
}
|
|
22
|
+
function U(e) {
|
|
23
|
+
let [t, n] = e.split(":").map(Number);
|
|
24
|
+
return t * 60 + (n || 0);
|
|
25
|
+
}
|
|
26
|
+
function et(e) {
|
|
27
|
+
let t = Math.floor(e / 60), n = e % 60;
|
|
28
|
+
return `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
29
|
+
}
|
|
30
|
+
function W(e, t) {
|
|
31
|
+
let n = new Date(e);
|
|
32
|
+
return n.setHours(Math.floor(U(t) / 60), U(t) % 60, 0, 0), n;
|
|
33
|
+
}
|
|
34
|
+
function G(e, t) {
|
|
35
|
+
return !e || !t || e.getTime() <= t.getTime() ? [e, t] : [t, e];
|
|
36
|
+
}
|
|
37
|
+
function K(e) {
|
|
38
|
+
let t = e.getMonth() + 1, n = e.getDate();
|
|
39
|
+
return `${e.getFullYear()}-${String(t).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/lib/icons.ts
|
|
43
|
+
function tt(e) {
|
|
44
|
+
return e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
45
|
+
}
|
|
46
|
+
var nt = "circle";
|
|
47
|
+
function rt(e) {
|
|
48
|
+
let t = e.trim();
|
|
49
|
+
return t ? t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase() : nt;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/icon/Icon.vue
|
|
53
|
+
var q = /* @__PURE__ */ p({
|
|
54
|
+
__name: "Icon",
|
|
55
|
+
props: {
|
|
56
|
+
name: {},
|
|
57
|
+
size: { default: 16 }
|
|
58
|
+
},
|
|
59
|
+
setup(e) {
|
|
60
|
+
let t = e, n = o(() => P[tt(rt(t.name))] ?? P.Circle);
|
|
61
|
+
return (t, r) => (y(), s(C(n.value), {
|
|
62
|
+
size: e.size,
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
"data-icon": "",
|
|
65
|
+
name: e.name
|
|
66
|
+
}, null, 8, ["size", "name"]));
|
|
67
|
+
}
|
|
68
|
+
}), it = [
|
|
69
|
+
"type",
|
|
70
|
+
"disabled",
|
|
71
|
+
"data-loading"
|
|
72
|
+
], at = {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
75
|
+
"aria-hidden": "true"
|
|
76
|
+
}, J = /* @__PURE__ */ p({
|
|
77
|
+
__name: "Button",
|
|
78
|
+
props: {
|
|
79
|
+
variant: { default: "default" },
|
|
80
|
+
size: { default: "default" },
|
|
81
|
+
type: { default: "button" },
|
|
82
|
+
disabled: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: !1
|
|
85
|
+
},
|
|
86
|
+
loading: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: !1
|
|
89
|
+
},
|
|
90
|
+
label: {}
|
|
91
|
+
},
|
|
92
|
+
setup(e) {
|
|
93
|
+
let t = B({
|
|
94
|
+
base: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 data-[loading=true]:cursor-not-allowed",
|
|
95
|
+
variants: {
|
|
96
|
+
variant: {
|
|
97
|
+
default: "bg-primary-500 text-white hover:bg-primary-600",
|
|
98
|
+
secondary: "bg-secondary-500 text-white hover:bg-secondary-600",
|
|
99
|
+
destructive: "bg-error-500 text-white hover:bg-error-600",
|
|
100
|
+
outline: "border border-border bg-surface text-foreground hover:bg-surface-muted",
|
|
101
|
+
ghost: "text-foreground hover:bg-surface-muted"
|
|
102
|
+
},
|
|
103
|
+
size: {
|
|
104
|
+
sm: "h-8 px-3 text-xs",
|
|
105
|
+
default: "h-9 px-4",
|
|
106
|
+
lg: "h-10 px-6",
|
|
107
|
+
icon: "size-9",
|
|
108
|
+
"icon-sm": "size-8"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
defaultVariants: {
|
|
112
|
+
variant: "default",
|
|
113
|
+
size: "default"
|
|
114
|
+
}
|
|
115
|
+
}), n = e, r = E(), i = o(() => n.disabled || n.loading || !!r.disabled);
|
|
116
|
+
return (n, a) => (y(), l("button", m({
|
|
117
|
+
type: e.type,
|
|
118
|
+
disabled: i.value,
|
|
119
|
+
"data-loading": e.loading || void 0,
|
|
120
|
+
class: T(t)({
|
|
121
|
+
variant: e.variant,
|
|
122
|
+
size: e.size
|
|
123
|
+
})
|
|
124
|
+
}, T(r)), [e.loading ? (y(), l("span", at)) : S(n.$slots, "default", {}, () => [d(w(e.label), 1)], void 0, 1)], 16, it));
|
|
125
|
+
}
|
|
126
|
+
}), ot = { class: "relative w-full" }, st = [
|
|
127
|
+
"value",
|
|
128
|
+
"placeholder",
|
|
129
|
+
"disabled"
|
|
130
|
+
], ct = /* @__PURE__ */ p({
|
|
131
|
+
__name: "Input",
|
|
132
|
+
props: {
|
|
133
|
+
modelValue: {},
|
|
134
|
+
placeholder: {},
|
|
135
|
+
disabled: { type: Boolean },
|
|
136
|
+
invalid: { type: Boolean },
|
|
137
|
+
leadingIcon: {},
|
|
138
|
+
trailingIcon: {},
|
|
139
|
+
size: { default: "default" }
|
|
140
|
+
},
|
|
141
|
+
emits: ["update:modelValue"],
|
|
142
|
+
setup(e, { expose: t, emit: n }) {
|
|
143
|
+
let r = n, i = E(), a = b();
|
|
144
|
+
return t({ focus: () => a.value?.focus() }), (t, n) => (y(), l("div", ot, [
|
|
145
|
+
e.leadingIcon ? (y(), s(q, {
|
|
146
|
+
key: 0,
|
|
147
|
+
name: e.leadingIcon,
|
|
148
|
+
class: "pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted"
|
|
149
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
150
|
+
u("input", m({
|
|
151
|
+
ref_key: "inputRef",
|
|
152
|
+
ref: a,
|
|
153
|
+
value: e.modelValue,
|
|
154
|
+
placeholder: e.placeholder,
|
|
155
|
+
disabled: e.disabled,
|
|
156
|
+
class: [
|
|
157
|
+
"flex w-full rounded-md border border-border bg-surface px-3 py-1 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50",
|
|
158
|
+
e.size === "sm" ? "h-8 text-xs" : e.size === "lg" ? "h-10" : "h-9",
|
|
159
|
+
e.leadingIcon ? "ps-9" : "ps-3",
|
|
160
|
+
e.trailingIcon ? "pe-9" : "pe-3",
|
|
161
|
+
e.invalid ? "border-error-500 focus-visible:ring-error-500" : ""
|
|
162
|
+
]
|
|
163
|
+
}, T(i), { onInput: n[0] ||= (e) => r("update:modelValue", e.target.value) }), null, 16, st),
|
|
164
|
+
e.trailingIcon ? (y(), s(q, {
|
|
165
|
+
key: 1,
|
|
166
|
+
name: e.trailingIcon,
|
|
167
|
+
class: "pointer-events-none absolute end-3 top-1/2 size-4 -translate-y-1/2 text-muted"
|
|
168
|
+
}, null, 8, ["name"])) : c("", !0)
|
|
169
|
+
]));
|
|
170
|
+
}
|
|
171
|
+
}), lt = [
|
|
172
|
+
"value",
|
|
173
|
+
"placeholder",
|
|
174
|
+
"disabled",
|
|
175
|
+
"rows"
|
|
176
|
+
], ut = /* @__PURE__ */ p({
|
|
177
|
+
__name: "Textarea",
|
|
178
|
+
props: {
|
|
179
|
+
modelValue: {},
|
|
180
|
+
placeholder: {},
|
|
181
|
+
disabled: { type: Boolean },
|
|
182
|
+
rows: { default: 3 },
|
|
183
|
+
invalid: { type: Boolean }
|
|
184
|
+
},
|
|
185
|
+
emits: ["update:modelValue"],
|
|
186
|
+
setup(e, { emit: t }) {
|
|
187
|
+
let n = t, r = E();
|
|
188
|
+
return (t, i) => (y(), l("textarea", m({
|
|
189
|
+
value: e.modelValue,
|
|
190
|
+
placeholder: e.placeholder,
|
|
191
|
+
disabled: e.disabled,
|
|
192
|
+
rows: e.rows,
|
|
193
|
+
class: ["w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50", e.invalid ? "border-error-500 focus-visible:ring-error-500" : ""]
|
|
194
|
+
}, T(r), { onInput: i[0] ||= (e) => n("update:modelValue", e.target.value) }), null, 16, lt));
|
|
195
|
+
}
|
|
196
|
+
}), dt = { class: "w-full" }, ft = { class: "relative w-full" }, pt = [
|
|
197
|
+
"id",
|
|
198
|
+
"type",
|
|
199
|
+
"value",
|
|
200
|
+
"placeholder",
|
|
201
|
+
"disabled"
|
|
202
|
+
], mt = ["disabled"], ht = {
|
|
203
|
+
key: 0,
|
|
204
|
+
class: "mt-1.5 flex items-center gap-1.5",
|
|
205
|
+
"aria-hidden": "true"
|
|
206
|
+
}, gt = /* @__PURE__ */ p({
|
|
207
|
+
__name: "Password",
|
|
208
|
+
props: {
|
|
209
|
+
modelValue: {},
|
|
210
|
+
placeholder: {},
|
|
211
|
+
disabled: { type: Boolean },
|
|
212
|
+
invalid: { type: Boolean },
|
|
213
|
+
feedback: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: !1
|
|
216
|
+
},
|
|
217
|
+
id: {}
|
|
218
|
+
},
|
|
219
|
+
emits: ["update:modelValue"],
|
|
220
|
+
setup(e, { emit: t }) {
|
|
221
|
+
let n = e, r = t, i = E(), d = b(!1), f = o(() => d.value ? "text" : "password"), p = o(() => {
|
|
222
|
+
let e = n.modelValue ?? "";
|
|
223
|
+
if (e.length === 0) return 0;
|
|
224
|
+
let t = 0;
|
|
225
|
+
return e.length >= 8 && t++, e.length >= 12 && t++, /[A-Z]/.test(e) && /[a-z]/.test(e) && t++, /\d/.test(e) && t++, /[^A-Za-z0-9]/.test(e) && t++, Math.max(1, Math.min(4, Math.ceil(t / 5 * 4)));
|
|
226
|
+
});
|
|
227
|
+
return (t, n) => (y(), l("div", dt, [u("div", ft, [u("input", m({
|
|
228
|
+
id: e.id,
|
|
229
|
+
type: f.value,
|
|
230
|
+
value: e.modelValue,
|
|
231
|
+
placeholder: e.placeholder,
|
|
232
|
+
disabled: e.disabled,
|
|
233
|
+
class: [
|
|
234
|
+
"flex h-9 w-full rounded-md border border-border bg-surface px-3 py-1 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50",
|
|
235
|
+
e.invalid ? "border-error-500 focus-visible:ring-error-500" : "",
|
|
236
|
+
"pe-10"
|
|
237
|
+
]
|
|
238
|
+
}, T(i), { onInput: n[0] ||= (e) => r("update:modelValue", e.target.value) }), null, 16, pt), u("button", {
|
|
239
|
+
type: "button",
|
|
240
|
+
disabled: e.disabled,
|
|
241
|
+
"aria-label": "Toggle password visibility",
|
|
242
|
+
class: "absolute end-2 top-1/2 -translate-y-1/2 rounded p-1 text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
243
|
+
onClick: n[1] ||= (e) => d.value = !d.value
|
|
244
|
+
}, [d.value ? (y(), s(T(se), {
|
|
245
|
+
key: 0,
|
|
246
|
+
class: "size-4"
|
|
247
|
+
})) : (y(), s(T(oe), {
|
|
248
|
+
key: 1,
|
|
249
|
+
class: "size-4"
|
|
250
|
+
}))], 8, mt)]), e.feedback && e.modelValue ? (y(), l("div", ht, [(y(), l(a, null, x(4, (e) => u("span", {
|
|
251
|
+
key: e,
|
|
252
|
+
class: h(["h-1 flex-1 rounded-full transition-colors", e <= p.value ? "bg-success-500" : "bg-surface-muted"])
|
|
253
|
+
}, null, 2)), 64))])) : c("", !0)]));
|
|
254
|
+
}
|
|
255
|
+
}), Y = /* @__PURE__ */ p({
|
|
256
|
+
__name: "Checkbox",
|
|
257
|
+
props: {
|
|
258
|
+
modelValue: {
|
|
259
|
+
type: Boolean,
|
|
260
|
+
default: !1
|
|
261
|
+
},
|
|
262
|
+
disabled: { type: Boolean },
|
|
263
|
+
id: {}
|
|
264
|
+
},
|
|
265
|
+
emits: ["update:modelValue"],
|
|
266
|
+
setup(e, { emit: t }) {
|
|
267
|
+
let n = t;
|
|
268
|
+
return (t, r) => (y(), s(T(ue), {
|
|
269
|
+
id: e.id,
|
|
270
|
+
"model-value": e.modelValue,
|
|
271
|
+
disabled: e.disabled,
|
|
272
|
+
class: "peer size-4 shrink-0 rounded border border-border bg-surface shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 data-[state=checked]:border-primary-500 data-[state=checked]:bg-primary-500 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
273
|
+
"onUpdate:modelValue": r[0] ||= (e) => n("update:modelValue", e)
|
|
274
|
+
}, {
|
|
275
|
+
default: j(() => [f(T(le), { class: "flex items-center justify-center text-white" }, {
|
|
276
|
+
default: j(() => [f(T(F), { class: "size-3.5" })]),
|
|
277
|
+
_: 1
|
|
278
|
+
})]),
|
|
279
|
+
_: 1
|
|
280
|
+
}, 8, [
|
|
281
|
+
"id",
|
|
282
|
+
"model-value",
|
|
283
|
+
"disabled"
|
|
284
|
+
]));
|
|
285
|
+
}
|
|
286
|
+
}), _t = ["aria-label"], vt = /* @__PURE__ */ p({
|
|
287
|
+
__name: "Tag",
|
|
288
|
+
props: {
|
|
289
|
+
tone: {},
|
|
290
|
+
icon: {},
|
|
291
|
+
removable: { type: Boolean },
|
|
292
|
+
removeLabel: { default: "Remove" }
|
|
293
|
+
},
|
|
294
|
+
emits: ["remove"],
|
|
295
|
+
setup(e, { emit: t }) {
|
|
296
|
+
let n = B({
|
|
297
|
+
base: "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
298
|
+
variants: { tone: {
|
|
299
|
+
info: "bg-primary-100 text-primary-800",
|
|
300
|
+
success: "bg-success-100 text-success-800",
|
|
301
|
+
warning: "bg-warning-100 text-warning-800",
|
|
302
|
+
danger: "bg-error-100 text-error-800",
|
|
303
|
+
secondary: "bg-surface-muted text-foreground"
|
|
304
|
+
} },
|
|
305
|
+
defaultVariants: { tone: "secondary" }
|
|
306
|
+
}), r = t;
|
|
307
|
+
return (t, i) => (y(), l("span", { class: h(T(n)({ tone: e.tone })) }, [
|
|
308
|
+
e.icon ? (y(), s(q, {
|
|
309
|
+
key: 0,
|
|
310
|
+
name: e.icon,
|
|
311
|
+
class: "size-3"
|
|
312
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
313
|
+
S(t.$slots, "default"),
|
|
314
|
+
e.removable ? (y(), l("button", {
|
|
315
|
+
key: 1,
|
|
316
|
+
type: "button",
|
|
317
|
+
"aria-label": e.removeLabel,
|
|
318
|
+
class: "-me-0.5 ms-0.5 rounded-full p-0.5 transition-colors hover:bg-black/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
319
|
+
onClick: i[0] ||= N((e) => r("remove"), ["stop"])
|
|
320
|
+
}, [f(T(z), { class: "size-3" })], 8, _t)) : c("", !0)
|
|
321
|
+
], 2));
|
|
322
|
+
}
|
|
323
|
+
}), yt = /* @__PURE__ */ p({
|
|
324
|
+
__name: "Tabs",
|
|
325
|
+
props: { modelValue: {} },
|
|
326
|
+
emits: ["update:modelValue"],
|
|
327
|
+
setup(e, { emit: t }) {
|
|
328
|
+
let n = t;
|
|
329
|
+
return (t, r) => (y(), s(T(ze), {
|
|
330
|
+
"model-value": e.modelValue,
|
|
331
|
+
"onUpdate:modelValue": r[0] ||= (e) => n("update:modelValue", e)
|
|
332
|
+
}, {
|
|
333
|
+
default: j(() => [S(t.$slots, "default")]),
|
|
334
|
+
_: 3
|
|
335
|
+
}, 8, ["model-value"]));
|
|
336
|
+
}
|
|
337
|
+
}), bt = /* @__PURE__ */ p({
|
|
338
|
+
__name: "TabsList",
|
|
339
|
+
setup(e) {
|
|
340
|
+
return (e, t) => (y(), s(T(Re), { class: "inline-flex h-9 w-full items-center justify-start gap-1 rounded-lg bg-surface-muted p-1 text-muted" }, {
|
|
341
|
+
default: j(() => [S(e.$slots, "default")]),
|
|
342
|
+
_: 3
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
}), xt = /* @__PURE__ */ p({
|
|
346
|
+
__name: "TabsTrigger",
|
|
347
|
+
props: {
|
|
348
|
+
value: {},
|
|
349
|
+
disabled: { type: Boolean }
|
|
350
|
+
},
|
|
351
|
+
setup(e) {
|
|
352
|
+
return (t, n) => (y(), s(T(Be), {
|
|
353
|
+
value: e.value,
|
|
354
|
+
disabled: e.disabled,
|
|
355
|
+
class: "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 data-[state=active]:bg-surface data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[disabled]:opacity-50"
|
|
356
|
+
}, {
|
|
357
|
+
default: j(() => [S(t.$slots, "default")]),
|
|
358
|
+
_: 3
|
|
359
|
+
}, 8, ["value", "disabled"]));
|
|
360
|
+
}
|
|
361
|
+
}), St = /* @__PURE__ */ p({
|
|
362
|
+
__name: "TabsContent",
|
|
363
|
+
props: {
|
|
364
|
+
value: {},
|
|
365
|
+
padding: {
|
|
366
|
+
type: Boolean,
|
|
367
|
+
default: !0
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
setup(e) {
|
|
371
|
+
return (t, n) => (y(), s(T(Le), {
|
|
372
|
+
value: e.value,
|
|
373
|
+
class: h(["focus-visible:outline-none", e.padding ? "pt-4" : ""])
|
|
374
|
+
}, {
|
|
375
|
+
default: j(() => [S(t.$slots, "default")]),
|
|
376
|
+
_: 3
|
|
377
|
+
}, 8, ["value", "class"]));
|
|
378
|
+
}
|
|
379
|
+
}), Ct = { class: "truncate" }, wt = { class: "ms-auto flex shrink-0 items-center gap-1" }, Tt = /* @__PURE__ */ p({
|
|
380
|
+
__name: "Select",
|
|
381
|
+
props: {
|
|
382
|
+
modelValue: {},
|
|
383
|
+
options: {},
|
|
384
|
+
optionLabel: { default: "label" },
|
|
385
|
+
optionValue: { default: "value" },
|
|
386
|
+
placeholder: { default: "" },
|
|
387
|
+
clearable: { type: Boolean },
|
|
388
|
+
disabled: { type: Boolean },
|
|
389
|
+
multiple: { type: Boolean },
|
|
390
|
+
size: { default: "default" },
|
|
391
|
+
invalid: { type: Boolean }
|
|
392
|
+
},
|
|
393
|
+
emits: ["update:modelValue"],
|
|
394
|
+
setup(e, { emit: t }) {
|
|
395
|
+
let n = e, r = t, i = b(!1);
|
|
396
|
+
function p(e) {
|
|
397
|
+
return e && typeof e == "object" && n.optionValue ? e[n.optionValue] ?? e : e;
|
|
398
|
+
}
|
|
399
|
+
function h(e) {
|
|
400
|
+
return e && typeof e == "object" && n.optionLabel ? String(e[n.optionLabel] ?? "") : e == null ? "" : String(e);
|
|
401
|
+
}
|
|
402
|
+
let g = o(() => n.multiple ? (Array.isArray(n.modelValue) ? n.modelValue : []).map((e) => h(n.options?.find((t) => p(t) === e))).filter(Boolean).join(", ") : n.modelValue == null ? "" : h(n.options?.find((e) => p(e) === n.modelValue))), _ = o(() => n.multiple && Array.isArray(n.modelValue) ? n.modelValue.length > 0 : n.modelValue != null);
|
|
403
|
+
function v() {
|
|
404
|
+
r("update:modelValue", n.multiple ? [] : null);
|
|
405
|
+
}
|
|
406
|
+
return (t, n) => (y(), s(T(Pe), {
|
|
407
|
+
open: i.value,
|
|
408
|
+
"onUpdate:open": n[0] ||= (e) => i.value = e,
|
|
409
|
+
"model-value": e.modelValue,
|
|
410
|
+
multiple: e.multiple,
|
|
411
|
+
disabled: e.disabled,
|
|
412
|
+
"onUpdate:modelValue": n[1] ||= (e) => r("update:modelValue", e)
|
|
413
|
+
}, {
|
|
414
|
+
default: j(() => [f(T(Fe), m({ class: T(H)("flex w-full items-center justify-between gap-2 rounded-md border border-border bg-surface px-3 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50", e.size === "sm" ? "h-8 text-xs" : "h-9", e.invalid ? "border-error-500 focus-visible:ring-error-500" : "", t.$attrs.class || "") }, t.$attrs), {
|
|
415
|
+
default: j(() => [f(T(Ie), { placeholder: e.placeholder }, {
|
|
416
|
+
default: j(() => [u("span", Ct, w(g.value || e.placeholder), 1)]),
|
|
417
|
+
_: 1
|
|
418
|
+
}, 8, ["placeholder"]), u("span", wt, [e.clearable && _.value ? (y(), l("button", {
|
|
419
|
+
key: 0,
|
|
420
|
+
type: "button",
|
|
421
|
+
"aria-label": "Clear selection",
|
|
422
|
+
class: "rounded p-0.5 text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
423
|
+
onClick: N(v, ["stop"])
|
|
424
|
+
}, [f(T(z), { class: "size-3.5" })])) : c("", !0), f(T(I), { class: "size-4 opacity-50" })])]),
|
|
425
|
+
_: 1
|
|
426
|
+
}, 16, ["class"]), i.value ? (y(), s(T(Ae), {
|
|
427
|
+
key: 0,
|
|
428
|
+
position: "popper",
|
|
429
|
+
"side-offset": 4,
|
|
430
|
+
class: "z-50 min-w-[--reka-select-trigger-width] rounded-md border border-border bg-surface p-1 shadow-popover"
|
|
431
|
+
}, {
|
|
432
|
+
default: j(() => [(y(!0), l(a, null, x(e.options, (e) => (y(), s(T(je), {
|
|
433
|
+
key: String(p(e)),
|
|
434
|
+
value: p(e),
|
|
435
|
+
class: "relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 pr-8 text-sm text-foreground outline-none transition-colors focus:bg-surface-muted data-[highlighted]:bg-surface-muted data-[disabled]:opacity-50"
|
|
436
|
+
}, {
|
|
437
|
+
default: j(() => [f(T(Ne), null, {
|
|
438
|
+
default: j(() => [d(w(h(e)), 1)]),
|
|
439
|
+
_: 2
|
|
440
|
+
}, 1024), f(T(Me), { class: "absolute end-2 flex items-center justify-center text-primary-600" }, {
|
|
441
|
+
default: j(() => [f(T(F), { class: "size-4" })]),
|
|
442
|
+
_: 1
|
|
443
|
+
})]),
|
|
444
|
+
_: 2
|
|
445
|
+
}, 1032, ["value"]))), 128))]),
|
|
446
|
+
_: 1
|
|
447
|
+
})) : c("", !0)]),
|
|
448
|
+
_: 1
|
|
449
|
+
}, 8, [
|
|
450
|
+
"open",
|
|
451
|
+
"model-value",
|
|
452
|
+
"multiple",
|
|
453
|
+
"disabled"
|
|
454
|
+
]));
|
|
455
|
+
}
|
|
456
|
+
}), Et = /* @__PURE__ */ p({
|
|
457
|
+
__name: "SelectButton",
|
|
458
|
+
props: {
|
|
459
|
+
modelValue: {},
|
|
460
|
+
options: {},
|
|
461
|
+
optionLabel: { default: "label" },
|
|
462
|
+
optionValue: { default: "value" },
|
|
463
|
+
disabled: { type: Boolean }
|
|
464
|
+
},
|
|
465
|
+
emits: ["update:modelValue"],
|
|
466
|
+
setup(e, { emit: t }) {
|
|
467
|
+
let n = e, r = t, i = b(null), o = b({
|
|
468
|
+
left: 0,
|
|
469
|
+
top: 0,
|
|
470
|
+
width: 0,
|
|
471
|
+
height: 0,
|
|
472
|
+
ready: !1
|
|
473
|
+
}), c = 0;
|
|
474
|
+
function p(e) {
|
|
475
|
+
return e?.[n.optionValue] ?? e;
|
|
476
|
+
}
|
|
477
|
+
function m(e) {
|
|
478
|
+
return String(e?.[n.optionLabel] ?? e ?? "");
|
|
479
|
+
}
|
|
480
|
+
function h() {
|
|
481
|
+
let e = (i.value?.$el)?.querySelector("[role=\"radio\"][data-state=\"checked\"]");
|
|
482
|
+
if (!e) {
|
|
483
|
+
o.value.ready = !1;
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
o.value = {
|
|
487
|
+
left: e.offsetLeft,
|
|
488
|
+
top: e.offsetTop,
|
|
489
|
+
width: e.offsetWidth,
|
|
490
|
+
height: e.offsetHeight,
|
|
491
|
+
ready: !0
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function S() {
|
|
495
|
+
cancelAnimationFrame(c), c = requestAnimationFrame(h);
|
|
496
|
+
}
|
|
497
|
+
let C;
|
|
498
|
+
return v(() => {
|
|
499
|
+
S(), typeof ResizeObserver < "u" && i.value?.$el && (C = new ResizeObserver(S), C.observe(i.value.$el)), window.addEventListener("resize", S);
|
|
500
|
+
}), _(() => {
|
|
501
|
+
cancelAnimationFrame(c), C?.disconnect(), window.removeEventListener("resize", S);
|
|
502
|
+
}), A(() => n.modelValue, S), A(() => n.options, S, { deep: !0 }), (t, n) => (y(), s(T(ke), {
|
|
503
|
+
ref_key: "rootEl",
|
|
504
|
+
ref: i,
|
|
505
|
+
"model-value": e.modelValue,
|
|
506
|
+
disabled: e.disabled,
|
|
507
|
+
class: "relative inline-flex flex-wrap items-center gap-1 rounded-md border border-border bg-surface p-1",
|
|
508
|
+
"onUpdate:modelValue": n[0] ||= (e) => r("update:modelValue", e)
|
|
509
|
+
}, {
|
|
510
|
+
default: j(() => [M(u("span", {
|
|
511
|
+
"aria-hidden": "true",
|
|
512
|
+
class: "pointer-events-none absolute rounded bg-primary-500 transition-all duration-200 ease-out motion-reduce:transition-none",
|
|
513
|
+
style: g({
|
|
514
|
+
left: `${o.value.left}px`,
|
|
515
|
+
top: `${o.value.top}px`,
|
|
516
|
+
width: `${o.value.width}px`,
|
|
517
|
+
height: `${o.value.height}px`
|
|
518
|
+
})
|
|
519
|
+
}, null, 4), [[k, o.value.ready]]), (y(!0), l(a, null, x(e.options, (t) => (y(), s(T(Oe), {
|
|
520
|
+
key: String(p(t)),
|
|
521
|
+
value: p(t),
|
|
522
|
+
disabled: e.disabled,
|
|
523
|
+
class: "relative inline-flex items-center justify-center rounded px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 data-[state=checked]:text-white data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
|
|
524
|
+
}, {
|
|
525
|
+
default: j(() => [f(T(De), { class: "hidden" }), d(" " + w(m(t)), 1)]),
|
|
526
|
+
_: 2
|
|
527
|
+
}, 1032, ["value", "disabled"]))), 128))]),
|
|
528
|
+
_: 1
|
|
529
|
+
}, 8, ["model-value", "disabled"]));
|
|
530
|
+
}
|
|
531
|
+
}), Dt = ["id", "disabled"], Ot = { class: "flex items-center justify-between" }, kt = { class: "text-sm font-medium" }, At = { class: "mt-2 grid grid-cols-7 gap-0.5 text-center text-xs" }, jt = { key: 0 }, Mt = ["onClick"], Nt = {
|
|
532
|
+
key: 0,
|
|
533
|
+
class: "mt-3 flex items-center justify-between gap-2 border-t border-border pt-3"
|
|
534
|
+
}, Pt = { class: "flex items-center gap-2 text-xs text-muted" }, Ft = { class: "flex items-center gap-2" }, It = ["disabled"], Lt = {
|
|
535
|
+
key: 1,
|
|
536
|
+
class: "mt-3 flex justify-end border-t border-border pt-3"
|
|
537
|
+
}, Rt = /* @__PURE__ */ p({
|
|
538
|
+
__name: "DatePicker",
|
|
539
|
+
props: {
|
|
540
|
+
mode: { default: "date" },
|
|
541
|
+
modelValue: {},
|
|
542
|
+
placeholder: { default: "Select date" },
|
|
543
|
+
disabled: { type: Boolean },
|
|
544
|
+
invalid: { type: Boolean },
|
|
545
|
+
size: { default: "default" },
|
|
546
|
+
inputId: {}
|
|
547
|
+
},
|
|
548
|
+
emits: ["update:modelValue"],
|
|
549
|
+
setup(e, { emit: t }) {
|
|
550
|
+
let n = e, r = t, i = b(!1), d = b(/* @__PURE__ */ new Date()), p = b(null), m = b(null), g = b("09:00"), _ = [
|
|
551
|
+
0,
|
|
552
|
+
1,
|
|
553
|
+
2,
|
|
554
|
+
3,
|
|
555
|
+
4,
|
|
556
|
+
5,
|
|
557
|
+
6
|
|
558
|
+
];
|
|
559
|
+
A(() => n.modelValue, (e) => {
|
|
560
|
+
Array.isArray(e) ? (p.value = e[0] ?? null, m.value = e[1] ?? null) : e instanceof Date ? (p.value = e, m.value = null) : (p.value = null, m.value = null);
|
|
561
|
+
}, { immediate: !0 });
|
|
562
|
+
let v = o(() => {
|
|
563
|
+
let e = (new Date(d.value.getFullYear(), d.value.getMonth(), 1).getDay() + 6) % 7, t = Array.from({ length: e }, () => null), n = new Date(d.value.getFullYear(), d.value.getMonth() + 1, 0).getDate();
|
|
564
|
+
for (let e = 1; e <= n; e++) t.push(new Date(d.value.getFullYear(), d.value.getMonth(), e));
|
|
565
|
+
return t;
|
|
566
|
+
});
|
|
567
|
+
function S(e) {
|
|
568
|
+
if (!p.value || !m.value) return !1;
|
|
569
|
+
let [t, n] = G(p.value, m.value);
|
|
570
|
+
return e.getTime() >= t.getTime() && e.getTime() <= n.getTime();
|
|
571
|
+
}
|
|
572
|
+
function C() {
|
|
573
|
+
return d.value.toLocaleString("en", {
|
|
574
|
+
month: "long",
|
|
575
|
+
year: "numeric"
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
function E(e) {
|
|
579
|
+
d.value = new Date(d.value.getFullYear(), d.value.getMonth() + e, 1);
|
|
580
|
+
}
|
|
581
|
+
function D() {
|
|
582
|
+
return n.mode === "range" ? !!(p.value && m.value) : !!p.value;
|
|
583
|
+
}
|
|
584
|
+
function k(e) {
|
|
585
|
+
if (n.mode === "range") {
|
|
586
|
+
if (!p.value || m.value) p.value = e, m.value = null;
|
|
587
|
+
else {
|
|
588
|
+
let [t, n] = G(p.value, e);
|
|
589
|
+
p.value = t, m.value = n;
|
|
590
|
+
}
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
p.value = e, n.mode !== "datetime" && (N(), i.value = !1);
|
|
594
|
+
}
|
|
595
|
+
function N() {
|
|
596
|
+
if (p.value) {
|
|
597
|
+
if (n.mode === "range") {
|
|
598
|
+
if (!m.value) return;
|
|
599
|
+
r("update:modelValue", [p.value, m.value]);
|
|
600
|
+
} else n.mode === "datetime" ? r("update:modelValue", W(p.value, g.value)) : r("update:modelValue", p.value);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
function P() {
|
|
604
|
+
p.value = null, m.value = null, r("update:modelValue", null), i.value = !1;
|
|
605
|
+
}
|
|
606
|
+
let F = o(() => {
|
|
607
|
+
if (n.mode === "range") {
|
|
608
|
+
if (!p.value || !m.value) return "";
|
|
609
|
+
let [e, t] = G(p.value, m.value);
|
|
610
|
+
return `${K(e)} – ${K(t)}`;
|
|
611
|
+
}
|
|
612
|
+
if (!p.value) return "";
|
|
613
|
+
let e = n.mode === "datetime" ? W(p.value, g.value) : p.value;
|
|
614
|
+
return `${K(e)}${n.mode === "datetime" ? " " + et(e.getHours() * 60 + e.getMinutes()) : ""}`;
|
|
615
|
+
});
|
|
616
|
+
return (t, n) => (y(), s(T(Te), {
|
|
617
|
+
open: i.value,
|
|
618
|
+
"onUpdate:open": n[4] ||= (e) => i.value = e
|
|
619
|
+
}, {
|
|
620
|
+
default: j(() => [f(T(Ee), { "as-child": "" }, {
|
|
621
|
+
default: j(() => [u("button", {
|
|
622
|
+
type: "button",
|
|
623
|
+
id: e.inputId,
|
|
624
|
+
disabled: e.disabled,
|
|
625
|
+
class: h([
|
|
626
|
+
"flex w-full items-center justify-between gap-2 rounded-md border border-border bg-surface px-3 text-sm text-foreground shadow-sm transition-colors hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50 data-[state=open]:border-primary-500",
|
|
627
|
+
e.size === "sm" ? "h-8 text-xs" : "h-9",
|
|
628
|
+
e.invalid ? "border-error-500" : ""
|
|
629
|
+
])
|
|
630
|
+
}, [u("span", { class: h(["truncate", F.value ? "text-foreground" : "text-muted"]) }, w(F.value || e.placeholder), 3), f(T(ee), { class: "size-4 shrink-0 text-muted" })], 10, Dt)]),
|
|
631
|
+
_: 1
|
|
632
|
+
}), f(T(we), {
|
|
633
|
+
"side-offset": 4,
|
|
634
|
+
class: "z-50 rounded-md border border-border bg-surface p-3 shadow-popover"
|
|
635
|
+
}, {
|
|
636
|
+
default: j(() => [
|
|
637
|
+
u("div", Ot, [
|
|
638
|
+
u("button", {
|
|
639
|
+
type: "button",
|
|
640
|
+
"aria-label": "Previous month",
|
|
641
|
+
class: "rounded p-1 text-muted transition-colors hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
642
|
+
onClick: n[0] ||= (e) => E(-1)
|
|
643
|
+
}, [f(T(L), { class: "size-4" })]),
|
|
644
|
+
u("span", kt, w(C()), 1),
|
|
645
|
+
u("button", {
|
|
646
|
+
type: "button",
|
|
647
|
+
"aria-label": "Next month",
|
|
648
|
+
class: "rounded p-1 text-muted transition-colors hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
649
|
+
onClick: n[1] ||= (e) => E(1)
|
|
650
|
+
}, [f(T(R), { class: "size-4" })])
|
|
651
|
+
]),
|
|
652
|
+
u("div", At, [(y(), l(a, null, x(_, (e) => u("span", {
|
|
653
|
+
key: e,
|
|
654
|
+
class: "py-1 font-medium text-muted"
|
|
655
|
+
}, w(new Date(2026, 0, 5 + e).toLocaleDateString("en", { weekday: "short" })), 1)), 64)), (y(!0), l(a, null, x(v.value, (e, t) => (y(), l(a, { key: t }, [e ? (y(), l("button", {
|
|
656
|
+
key: 1,
|
|
657
|
+
type: "button",
|
|
658
|
+
class: h([
|
|
659
|
+
"flex h-8 items-center justify-center rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
660
|
+
S(e) ? "bg-primary-100 text-primary-800" : "hover:bg-surface-muted",
|
|
661
|
+
p.value && p.value.getTime() === e.getTime() ? "bg-primary-500 text-white hover:bg-primary-500" : "",
|
|
662
|
+
m.value && m.value.getTime() === e.getTime() ? "bg-primary-500 text-white hover:bg-primary-500" : ""
|
|
663
|
+
]),
|
|
664
|
+
onClick: (t) => k(e)
|
|
665
|
+
}, w(e.getDate()), 11, Mt)) : (y(), l("span", jt))], 64))), 128))]),
|
|
666
|
+
e.mode === "datetime" ? (y(), l("div", Nt, [u("label", Pt, [f(T(ae), { class: "size-3.5" }), M(u("input", {
|
|
667
|
+
"onUpdate:modelValue": n[2] ||= (e) => g.value = e,
|
|
668
|
+
type: "time",
|
|
669
|
+
class: "rounded border border-border bg-surface px-2 py-1 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500"
|
|
670
|
+
}, null, 512), [[O, g.value]])]), u("div", Ft, [u("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
class: "rounded px-3 py-1 text-sm text-muted transition-colors hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
673
|
+
onClick: P
|
|
674
|
+
}, " Clear "), u("button", {
|
|
675
|
+
type: "button",
|
|
676
|
+
disabled: !p.value,
|
|
677
|
+
class: "rounded bg-primary-500 px-3 py-1 text-sm text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
678
|
+
onClick: n[3] ||= (e) => {
|
|
679
|
+
N(), i.value = !1;
|
|
680
|
+
}
|
|
681
|
+
}, " Apply ", 8, It)])])) : D() ? (y(), l("div", Lt, [u("button", {
|
|
682
|
+
type: "button",
|
|
683
|
+
class: "rounded px-3 py-1 text-sm text-muted transition-colors hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
684
|
+
onClick: P
|
|
685
|
+
}, " Clear ")])) : c("", !0)
|
|
686
|
+
]),
|
|
687
|
+
_: 1
|
|
688
|
+
})]),
|
|
689
|
+
_: 1
|
|
690
|
+
}, 8, ["open"]));
|
|
691
|
+
}
|
|
692
|
+
}), zt = { class: "flex items-start justify-between gap-4 border-b border-border p-5 pb-4" }, Bt = { class: "min-w-0" }, Vt = { class: "overflow-y-auto bg-surface p-5" }, Ht = {
|
|
693
|
+
key: 0,
|
|
694
|
+
class: "flex justify-end gap-2 border-t border-border bg-surface-muted p-4"
|
|
695
|
+
}, Ut = /* @__PURE__ */ p({
|
|
696
|
+
__name: "Dialog",
|
|
697
|
+
props: {
|
|
698
|
+
visible: { type: Boolean },
|
|
699
|
+
title: {},
|
|
700
|
+
description: {},
|
|
701
|
+
size: { default: "md" }
|
|
702
|
+
},
|
|
703
|
+
emits: ["update:visible", "close"],
|
|
704
|
+
setup(e, { emit: t }) {
|
|
705
|
+
let n = e, r = t, i = o({
|
|
706
|
+
get: () => n.visible ?? !1,
|
|
707
|
+
set: (e) => r("update:visible", e)
|
|
708
|
+
}), a = {
|
|
709
|
+
sm: "max-w-sm",
|
|
710
|
+
md: "max-w-md",
|
|
711
|
+
lg: "max-w-2xl",
|
|
712
|
+
xl: "max-w-4xl"
|
|
713
|
+
};
|
|
714
|
+
function p(e) {
|
|
715
|
+
r("update:visible", e), e || r("close");
|
|
716
|
+
}
|
|
717
|
+
return (t, n) => (y(), s(T(ge), {
|
|
718
|
+
open: i.value,
|
|
719
|
+
"onUpdate:open": p
|
|
720
|
+
}, {
|
|
721
|
+
default: j(() => [t.$slots.trigger ? (y(), s(T(ve), {
|
|
722
|
+
key: 0,
|
|
723
|
+
"as-child": ""
|
|
724
|
+
}, {
|
|
725
|
+
default: j(() => [S(t.$slots, "trigger")]),
|
|
726
|
+
_: 3
|
|
727
|
+
})) : c("", !0), f(T(he), null, {
|
|
728
|
+
default: j(() => [f(T(me), { class: "fixed inset-0 z-50 bg-black/50" }), f(T(fe), { class: h(["fixed left-1/2 top-1/2 z-50 w-full max-h-[85vh] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg border border-border bg-surface shadow-dialog focus-visible:outline-none", a[e.size]]) }, {
|
|
729
|
+
default: j(() => [
|
|
730
|
+
u("div", zt, [u("div", Bt, [e.title || t.$slots.header ? (y(), s(T(_e), {
|
|
731
|
+
key: 0,
|
|
732
|
+
class: "text-lg font-semibold text-foreground"
|
|
733
|
+
}, {
|
|
734
|
+
default: j(() => [S(t.$slots, "header", {}, () => [d(w(e.title), 1)])]),
|
|
735
|
+
_: 3
|
|
736
|
+
})) : c("", !0), e.description || t.$slots.description ? (y(), s(T(pe), {
|
|
737
|
+
key: 1,
|
|
738
|
+
class: "mt-1 text-sm text-muted"
|
|
739
|
+
}, {
|
|
740
|
+
default: j(() => [S(t.$slots, "description", {}, () => [d(w(e.description), 1)])]),
|
|
741
|
+
_: 3
|
|
742
|
+
})) : c("", !0)]), f(T(de), {
|
|
743
|
+
class: "rounded-md p-1 text-muted transition-colors hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
744
|
+
"aria-label": "Close"
|
|
745
|
+
}, {
|
|
746
|
+
default: j(() => [f(T(z), { class: "size-4" })]),
|
|
747
|
+
_: 1
|
|
748
|
+
})]),
|
|
749
|
+
u("div", Vt, [S(t.$slots, "default")]),
|
|
750
|
+
t.$slots.footer ? (y(), l("div", Ht, [S(t.$slots, "footer")])) : c("", !0)
|
|
751
|
+
]),
|
|
752
|
+
_: 3
|
|
753
|
+
}, 8, ["class"])]),
|
|
754
|
+
_: 3
|
|
755
|
+
})]),
|
|
756
|
+
_: 3
|
|
757
|
+
}, 8, ["open"]));
|
|
758
|
+
}
|
|
759
|
+
}), Wt = /* @__PURE__ */ p({
|
|
760
|
+
__name: "DropdownMenu",
|
|
761
|
+
emits: ["update:open"],
|
|
762
|
+
setup(e, { emit: t }) {
|
|
763
|
+
let n = t;
|
|
764
|
+
return (e, t) => (y(), s(T(Se), m(e.$attrs, { "onUpdate:open": t[0] ||= (e) => n("update:open", e) }), {
|
|
765
|
+
default: j(() => [S(e.$slots, "default")]),
|
|
766
|
+
_: 3
|
|
767
|
+
}, 16));
|
|
768
|
+
}
|
|
769
|
+
}), Gt = /* @__PURE__ */ p({
|
|
770
|
+
__name: "DropdownMenuTrigger",
|
|
771
|
+
setup(e) {
|
|
772
|
+
return (e, t) => (y(), s(T(Ce), {
|
|
773
|
+
"as-child": "",
|
|
774
|
+
"focus-on-select": ""
|
|
775
|
+
}, {
|
|
776
|
+
default: j(() => [S(e.$slots, "default")]),
|
|
777
|
+
_: 3
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
780
|
+
}), Kt = /* @__PURE__ */ p({
|
|
781
|
+
__name: "DropdownMenuContent",
|
|
782
|
+
props: {
|
|
783
|
+
align: { default: "start" },
|
|
784
|
+
side: { default: "bottom" },
|
|
785
|
+
sideOffset: { default: 4 }
|
|
786
|
+
},
|
|
787
|
+
setup(e) {
|
|
788
|
+
return (t, n) => (y(), s(T(xe), null, {
|
|
789
|
+
default: j(() => [f(T(ye), {
|
|
790
|
+
align: e.align,
|
|
791
|
+
side: e.side,
|
|
792
|
+
"side-offset": e.sideOffset,
|
|
793
|
+
class: "z-50 min-w-40 rounded-md border border-border bg-surface p-1 shadow-popover"
|
|
794
|
+
}, {
|
|
795
|
+
default: j(() => [S(t.$slots, "default")]),
|
|
796
|
+
_: 3
|
|
797
|
+
}, 8, [
|
|
798
|
+
"align",
|
|
799
|
+
"side",
|
|
800
|
+
"side-offset"
|
|
801
|
+
])]),
|
|
802
|
+
_: 3
|
|
803
|
+
}));
|
|
804
|
+
}
|
|
805
|
+
}), qt = /* @__PURE__ */ p({
|
|
806
|
+
__name: "DropdownMenuItem",
|
|
807
|
+
props: { variant: {} },
|
|
808
|
+
emits: ["select"],
|
|
809
|
+
setup(e, { emit: t }) {
|
|
810
|
+
let n = B({
|
|
811
|
+
base: "relative flex w-full cursor-pointer select-none items-center gap-2 rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-surface-muted data-[highlighted]:bg-surface-muted data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
812
|
+
variants: { variant: {
|
|
813
|
+
default: "text-foreground",
|
|
814
|
+
destructive: "text-error-600"
|
|
815
|
+
} },
|
|
816
|
+
defaultVariants: { variant: "default" }
|
|
817
|
+
}), r = t;
|
|
818
|
+
return (t, i) => (y(), s(T(be), {
|
|
819
|
+
class: h(T(n)({ variant: e.variant })),
|
|
820
|
+
onSelect: i[0] ||= (e) => r("select")
|
|
821
|
+
}, {
|
|
822
|
+
default: j(() => [S(t.$slots, "default")]),
|
|
823
|
+
_: 3
|
|
824
|
+
}, 8, ["class"]));
|
|
825
|
+
}
|
|
826
|
+
}), Jt = { class: "flex flex-col gap-2 sm:flex-row sm:items-stretch" }, Yt = { class: "border-b border-border px-3 py-2 text-xs font-medium text-muted" }, Xt = { class: "max-h-64 flex-1 overflow-y-auto p-1" }, Zt = ["disabled", "onClick"], Qt = { class: "truncate" }, $t = {
|
|
827
|
+
key: 0,
|
|
828
|
+
class: "px-2 py-1.5 text-sm text-muted"
|
|
829
|
+
}, en = { class: "flex flex-row items-center justify-center gap-1 sm:flex-col" }, tn = { class: "border-b border-border px-3 py-2 text-xs font-medium text-muted" }, nn = { class: "max-h-64 flex-1 overflow-y-auto p-1" }, rn = ["disabled", "onClick"], an = { class: "truncate" }, on = {
|
|
830
|
+
key: 0,
|
|
831
|
+
class: "px-2 py-1.5 text-sm text-muted"
|
|
832
|
+
}, sn = /* @__PURE__ */ p({
|
|
833
|
+
__name: "TransferList",
|
|
834
|
+
props: {
|
|
835
|
+
options: {},
|
|
836
|
+
modelValue: {},
|
|
837
|
+
sourceLabel: { default: "Available" },
|
|
838
|
+
targetLabel: { default: "Selected" },
|
|
839
|
+
disabled: {
|
|
840
|
+
type: Boolean,
|
|
841
|
+
default: !1
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
emits: ["update:modelValue"],
|
|
845
|
+
setup(e, { emit: t }) {
|
|
846
|
+
let n = e, r = t, i = b(new Set(n.modelValue ?? [])), s = b(/* @__PURE__ */ new Set()), p = b(/* @__PURE__ */ new Set()), m = o(() => n.options.filter((e) => !i.value.has(e.value))), g = o(() => n.options.filter((e) => i.value.has(e.value)));
|
|
847
|
+
function _() {
|
|
848
|
+
r("update:modelValue", g.value.map((e) => e.value));
|
|
849
|
+
}
|
|
850
|
+
function v(e, t) {
|
|
851
|
+
let n = new Set(e);
|
|
852
|
+
n.has(t) ? n.delete(t) : n.add(t), e.clear();
|
|
853
|
+
for (let t of n) e.add(t);
|
|
854
|
+
}
|
|
855
|
+
function C() {
|
|
856
|
+
for (let e of s.value) i.value.add(e);
|
|
857
|
+
s.value.clear(), _();
|
|
858
|
+
}
|
|
859
|
+
function E() {
|
|
860
|
+
for (let e of p.value) i.value.delete(e);
|
|
861
|
+
p.value.clear(), _();
|
|
862
|
+
}
|
|
863
|
+
function D() {
|
|
864
|
+
for (let e of n.options) i.value.add(e.value);
|
|
865
|
+
s.value.clear(), _();
|
|
866
|
+
}
|
|
867
|
+
function O() {
|
|
868
|
+
i.value.clear(), p.value.clear(), _();
|
|
869
|
+
}
|
|
870
|
+
return (t, n) => (y(), l("div", Jt, [
|
|
871
|
+
u("div", { class: h(["flex min-h-40 flex-1 flex-col rounded-md border border-border bg-surface", e.disabled && "opacity-50"]) }, [u("div", Yt, [S(t.$slots, "source-header", {}, () => [d(w(e.sourceLabel), 1)])]), u("ul", Xt, [(y(!0), l(a, null, x(m.value, (r) => (y(), l("li", { key: r.value }, [u("button", {
|
|
872
|
+
type: "button",
|
|
873
|
+
disabled: e.disabled,
|
|
874
|
+
class: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed",
|
|
875
|
+
onClick: (e) => v(s.value, r.value)
|
|
876
|
+
}, [f(Y, {
|
|
877
|
+
"model-value": s.value.has(r.value),
|
|
878
|
+
disabled: e.disabled,
|
|
879
|
+
onClick: n[0] ||= N(() => {}, ["stop"]),
|
|
880
|
+
"onUpdate:modelValue": (e) => v(s.value, r.value)
|
|
881
|
+
}, null, 8, [
|
|
882
|
+
"model-value",
|
|
883
|
+
"disabled",
|
|
884
|
+
"onUpdate:modelValue"
|
|
885
|
+
]), S(t.$slots, "item", { option: r }, () => [u("span", Qt, w(r.label), 1)])], 8, Zt)]))), 128)), m.value.length === 0 ? (y(), l("li", $t, "Empty")) : c("", !0)])], 2),
|
|
886
|
+
u("div", en, [
|
|
887
|
+
f(J, {
|
|
888
|
+
variant: "outline",
|
|
889
|
+
size: "icon-sm",
|
|
890
|
+
disabled: e.disabled || s.value.size === 0,
|
|
891
|
+
"aria-label": "Move selected to target",
|
|
892
|
+
onClick: C
|
|
893
|
+
}, {
|
|
894
|
+
default: j(() => [f(T(R), { class: "size-4" })]),
|
|
895
|
+
_: 1
|
|
896
|
+
}, 8, ["disabled"]),
|
|
897
|
+
f(J, {
|
|
898
|
+
variant: "outline",
|
|
899
|
+
size: "icon-sm",
|
|
900
|
+
disabled: e.disabled || p.value.size === 0,
|
|
901
|
+
"aria-label": "Move selected to source",
|
|
902
|
+
onClick: E
|
|
903
|
+
}, {
|
|
904
|
+
default: j(() => [f(T(L), { class: "size-4" })]),
|
|
905
|
+
_: 1
|
|
906
|
+
}, 8, ["disabled"]),
|
|
907
|
+
f(J, {
|
|
908
|
+
variant: "ghost",
|
|
909
|
+
size: "icon-sm",
|
|
910
|
+
disabled: e.disabled,
|
|
911
|
+
"aria-label": "Move all to target",
|
|
912
|
+
onClick: D
|
|
913
|
+
}, {
|
|
914
|
+
default: j(() => [f(T(re), { class: "size-4" })]),
|
|
915
|
+
_: 1
|
|
916
|
+
}, 8, ["disabled"]),
|
|
917
|
+
f(J, {
|
|
918
|
+
variant: "ghost",
|
|
919
|
+
size: "icon-sm",
|
|
920
|
+
disabled: e.disabled,
|
|
921
|
+
"aria-label": "Move all to source",
|
|
922
|
+
onClick: O
|
|
923
|
+
}, {
|
|
924
|
+
default: j(() => [f(T(ne), { class: "size-4" })]),
|
|
925
|
+
_: 1
|
|
926
|
+
}, 8, ["disabled"])
|
|
927
|
+
]),
|
|
928
|
+
u("div", { class: h(["flex min-h-40 flex-1 flex-col rounded-md border border-border bg-surface", e.disabled && "opacity-50"]) }, [u("div", tn, [S(t.$slots, "target-header", {}, () => [d(w(e.targetLabel), 1)])]), u("ul", nn, [(y(!0), l(a, null, x(g.value, (r) => (y(), l("li", { key: r.value }, [u("button", {
|
|
929
|
+
type: "button",
|
|
930
|
+
disabled: e.disabled,
|
|
931
|
+
class: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed",
|
|
932
|
+
onClick: (e) => v(p.value, r.value)
|
|
933
|
+
}, [f(Y, {
|
|
934
|
+
"model-value": p.value.has(r.value),
|
|
935
|
+
disabled: e.disabled,
|
|
936
|
+
onClick: n[1] ||= N(() => {}, ["stop"]),
|
|
937
|
+
"onUpdate:modelValue": (e) => v(p.value, r.value)
|
|
938
|
+
}, null, 8, [
|
|
939
|
+
"model-value",
|
|
940
|
+
"disabled",
|
|
941
|
+
"onUpdate:modelValue"
|
|
942
|
+
]), S(t.$slots, "item", { option: r }, () => [u("span", an, w(r.label), 1)])], 8, rn)]))), 128)), g.value.length === 0 ? (y(), l("li", on, "Empty")) : c("", !0)])], 2)
|
|
943
|
+
]));
|
|
944
|
+
}
|
|
945
|
+
}), cn = /* @__PURE__ */ p({
|
|
946
|
+
__name: "Table",
|
|
947
|
+
props: {
|
|
948
|
+
striped: { type: Boolean },
|
|
949
|
+
size: { default: "default" },
|
|
950
|
+
contained: {
|
|
951
|
+
type: Boolean,
|
|
952
|
+
default: !0
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
setup(e) {
|
|
956
|
+
let t = e, n = o(() => H("w-full border-collapse text-start text-sm text-foreground", t.size === "sm" ? "text-xs" : "text-sm", t.striped && "[&_tbody>tr:nth-child(even)]:bg-surface-muted/40", t.contained && "overflow-hidden rounded-md border border-border bg-surface"));
|
|
957
|
+
return (e, t) => (y(), l("table", { class: h(n.value) }, [S(e.$slots, "default")], 2));
|
|
958
|
+
}
|
|
959
|
+
}), ln = (e, t) => {
|
|
960
|
+
let n = e.__vccOpts || e;
|
|
961
|
+
for (let [e, r] of t) n[e] = r;
|
|
962
|
+
return n;
|
|
963
|
+
}, un = {}, dn = { class: "border-b border-border bg-surface-muted/60 text-xs font-medium text-muted" };
|
|
964
|
+
function fn(e, t) {
|
|
965
|
+
return y(), l("thead", dn, [S(e.$slots, "default")]);
|
|
966
|
+
}
|
|
967
|
+
var pn = /*#__PURE__*/ ln(un, [["render", fn]]), mn = {};
|
|
968
|
+
function hn(e, t) {
|
|
969
|
+
return y(), l("tbody", null, [S(e.$slots, "default")]);
|
|
970
|
+
}
|
|
971
|
+
var gn = /*#__PURE__*/ ln(mn, [["render", hn]]), X = /* @__PURE__ */ p({
|
|
972
|
+
__name: "TableRow",
|
|
973
|
+
props: { clickable: {
|
|
974
|
+
type: Boolean,
|
|
975
|
+
default: !1
|
|
976
|
+
} },
|
|
977
|
+
setup(e) {
|
|
978
|
+
return (t, n) => (y(), l("tr", { class: h(["border-b border-border/60 last:border-b-0", e.clickable && "cursor-pointer transition-colors hover:bg-surface-muted/50"]) }, [S(t.$slots, "default")], 2));
|
|
979
|
+
}
|
|
980
|
+
}), _n = ["aria-sort"], vn = /* @__PURE__ */ p({
|
|
981
|
+
__name: "TableHead",
|
|
982
|
+
props: {
|
|
983
|
+
sortDirection: {},
|
|
984
|
+
width: {},
|
|
985
|
+
align: { default: "start" }
|
|
986
|
+
},
|
|
987
|
+
setup(e) {
|
|
988
|
+
let t = e, n = o(() => t.sortDirection && t.sortDirection !== "none" ? t.sortDirection : void 0);
|
|
989
|
+
return (t, r) => (y(), l("th", {
|
|
990
|
+
scope: "col",
|
|
991
|
+
"aria-sort": n.value,
|
|
992
|
+
style: g(e.width ? { width: e.width } : void 0),
|
|
993
|
+
class: h(T(H)("px-3 py-2 font-medium", e.align === "center" && "text-center", e.align === "end" && "text-end"))
|
|
994
|
+
}, [S(t.$slots, "default")], 14, _n));
|
|
995
|
+
}
|
|
996
|
+
}), Z = /* @__PURE__ */ p({
|
|
997
|
+
__name: "TableCell",
|
|
998
|
+
props: {
|
|
999
|
+
align: { default: "start" },
|
|
1000
|
+
truncate: { type: Boolean }
|
|
1001
|
+
},
|
|
1002
|
+
setup(e) {
|
|
1003
|
+
let t = e, n = o(() => H("px-3 py-2 align-middle", t.align === "center" && "text-center", t.align === "end" && "text-end", t.truncate && "max-w-0 truncate"));
|
|
1004
|
+
return (e, t) => (y(), l("td", { class: h(n.value) }, [S(e.$slots, "default")], 2));
|
|
1005
|
+
}
|
|
1006
|
+
}), yn = ["colspan"], bn = /* @__PURE__ */ p({
|
|
1007
|
+
__name: "TableEmpty",
|
|
1008
|
+
props: {
|
|
1009
|
+
columns: {},
|
|
1010
|
+
label: {}
|
|
1011
|
+
},
|
|
1012
|
+
setup(e) {
|
|
1013
|
+
return (t, n) => (y(), l("tr", null, [u("td", {
|
|
1014
|
+
colspan: e.columns,
|
|
1015
|
+
class: "px-3 py-8 text-center text-sm text-muted"
|
|
1016
|
+
}, [S(t.$slots, "default", {}, () => [d(w(e.label), 1)])], 8, yn)]));
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
//#endregion
|
|
1020
|
+
//#region src/lib/pagination.ts
|
|
1021
|
+
function xn(e, t, n) {
|
|
1022
|
+
if (n <= 0 || t <= 0) return {
|
|
1023
|
+
from: 0,
|
|
1024
|
+
to: 0,
|
|
1025
|
+
total: Math.max(0, n)
|
|
1026
|
+
};
|
|
1027
|
+
let r = e * t + 1, i = Math.min(n, r + t - 1);
|
|
1028
|
+
return r > n ? {
|
|
1029
|
+
from: 0,
|
|
1030
|
+
to: 0,
|
|
1031
|
+
total: n
|
|
1032
|
+
} : {
|
|
1033
|
+
from: r,
|
|
1034
|
+
to: i,
|
|
1035
|
+
total: n
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
function Sn(e, t) {
|
|
1039
|
+
return t <= 0 ? 1 : Math.max(1, Math.ceil(e / t));
|
|
1040
|
+
}
|
|
1041
|
+
function Cn(e, t, n = 5) {
|
|
1042
|
+
if (t <= 0) return [];
|
|
1043
|
+
let r = Math.floor(n / 2), i = Math.max(0, Math.min(e - r, t - n)), a = Math.max(0, i);
|
|
1044
|
+
return Array.from({ length: Math.min(n, t - a) }, (e, t) => a + t + 1);
|
|
1045
|
+
}
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/components/table/TablePagination.vue?vue&type=script&setup=true&lang.ts
|
|
1048
|
+
var wn = { class: "flex flex-wrap items-center justify-between gap-3 px-3 py-2 text-sm text-muted" }, Tn = { class: "flex items-center gap-2" }, En = ["value"], Dn = ["value"], On = { class: "flex items-center gap-2" }, kn = { class: "flex items-center gap-1" }, An = /* @__PURE__ */ p({
|
|
1049
|
+
__name: "TablePagination",
|
|
1050
|
+
props: {
|
|
1051
|
+
pageIndex: {},
|
|
1052
|
+
pageSize: {},
|
|
1053
|
+
total: {},
|
|
1054
|
+
pageSizeOptions: { default: () => [
|
|
1055
|
+
5,
|
|
1056
|
+
10,
|
|
1057
|
+
20
|
|
1058
|
+
] },
|
|
1059
|
+
rowsPerPageLabel: { default: "Rows per page" },
|
|
1060
|
+
ofLabel: { default: "of" },
|
|
1061
|
+
previousLabel: { default: "Previous page" },
|
|
1062
|
+
nextLabel: { default: "Next page" }
|
|
1063
|
+
},
|
|
1064
|
+
emits: ["update:pageIndex", "update:pageSize"],
|
|
1065
|
+
setup(e, { emit: t }) {
|
|
1066
|
+
let n = e, r = t, i = o(() => Sn(n.total, n.pageSize)), c = o(() => xn(n.pageIndex, n.pageSize, n.total)), p = o(() => Cn(n.pageIndex, i.value));
|
|
1067
|
+
function m(e) {
|
|
1068
|
+
r("update:pageIndex", Math.max(0, Math.min(e, i.value - 1)));
|
|
1069
|
+
}
|
|
1070
|
+
return (t, n) => (y(), l("div", wn, [u("div", Tn, [u("span", null, w(e.rowsPerPageLabel), 1), u("select", {
|
|
1071
|
+
value: e.pageSize,
|
|
1072
|
+
class: "rounded-md border border-border bg-surface px-2 py-1 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
1073
|
+
onChange: n[0] ||= (e) => r("update:pageSize", Number(e.target.value))
|
|
1074
|
+
}, [(y(!0), l(a, null, x(e.pageSizeOptions, (e) => (y(), l("option", {
|
|
1075
|
+
key: e,
|
|
1076
|
+
value: e
|
|
1077
|
+
}, w(e), 9, Dn))), 128))], 40, En)]), u("div", On, [u("span", null, w(c.value.from) + "–" + w(c.value.to) + " " + w(e.ofLabel) + " " + w(c.value.total), 1), u("div", kn, [
|
|
1078
|
+
f(J, {
|
|
1079
|
+
variant: "ghost",
|
|
1080
|
+
size: "icon-sm",
|
|
1081
|
+
disabled: e.pageIndex <= 0,
|
|
1082
|
+
"aria-label": e.previousLabel,
|
|
1083
|
+
onClick: n[1] ||= (t) => m(e.pageIndex - 1)
|
|
1084
|
+
}, {
|
|
1085
|
+
default: j(() => [f(T(L), { class: "size-4 rtl:rotate-180" })]),
|
|
1086
|
+
_: 1
|
|
1087
|
+
}, 8, ["disabled", "aria-label"]),
|
|
1088
|
+
(y(!0), l(a, null, x(p.value, (t) => (y(), s(J, {
|
|
1089
|
+
key: t,
|
|
1090
|
+
variant: t - 1 === e.pageIndex ? "default" : "ghost",
|
|
1091
|
+
size: "icon-sm",
|
|
1092
|
+
"aria-current": t - 1 === e.pageIndex ? "page" : void 0,
|
|
1093
|
+
onClick: (e) => m(t - 1)
|
|
1094
|
+
}, {
|
|
1095
|
+
default: j(() => [d(w(t), 1)]),
|
|
1096
|
+
_: 2
|
|
1097
|
+
}, 1032, [
|
|
1098
|
+
"variant",
|
|
1099
|
+
"aria-current",
|
|
1100
|
+
"onClick"
|
|
1101
|
+
]))), 128)),
|
|
1102
|
+
f(J, {
|
|
1103
|
+
variant: "ghost",
|
|
1104
|
+
size: "icon-sm",
|
|
1105
|
+
disabled: e.pageIndex >= i.value - 1,
|
|
1106
|
+
"aria-label": e.nextLabel,
|
|
1107
|
+
onClick: n[2] ||= (t) => m(e.pageIndex + 1)
|
|
1108
|
+
}, {
|
|
1109
|
+
default: j(() => [f(T(R), { class: "size-4 rtl:rotate-180" })]),
|
|
1110
|
+
_: 1
|
|
1111
|
+
}, 8, ["disabled", "aria-label"])
|
|
1112
|
+
])])]));
|
|
1113
|
+
}
|
|
1114
|
+
}), jn = Xe({
|
|
1115
|
+
rowSortingFeature: Je,
|
|
1116
|
+
rowPaginationFeature: qe,
|
|
1117
|
+
rowExpandingFeature: Ke,
|
|
1118
|
+
sortedRowModel: Ge(),
|
|
1119
|
+
paginatedRowModel: We(),
|
|
1120
|
+
expandedRowModel: Ue(),
|
|
1121
|
+
sortFns: Ye
|
|
1122
|
+
}), Mn = [
|
|
1123
|
+
"a[href]",
|
|
1124
|
+
"button",
|
|
1125
|
+
"input",
|
|
1126
|
+
"select",
|
|
1127
|
+
"textarea",
|
|
1128
|
+
"label",
|
|
1129
|
+
"[role=\"checkbox\"]",
|
|
1130
|
+
"[role=\"switch\"]",
|
|
1131
|
+
"[role=\"combobox\"]",
|
|
1132
|
+
"[role=\"menu\"]",
|
|
1133
|
+
"[data-row-toggle-ignore]"
|
|
1134
|
+
].join(",");
|
|
1135
|
+
function Nn(e) {
|
|
1136
|
+
let t = e;
|
|
1137
|
+
return !t || typeof t.closest != "function" ? !1 : t.closest(Mn) !== null;
|
|
1138
|
+
}
|
|
1139
|
+
function Pn(e, t) {
|
|
1140
|
+
return e[t] ? {} : { [t]: !0 };
|
|
1141
|
+
}
|
|
1142
|
+
//#endregion
|
|
1143
|
+
//#region src/components/data-table/DataTable.vue?vue&type=script&setup=true&lang.ts
|
|
1144
|
+
var Fn = ["onClick"], In = /* @__PURE__ */ p({
|
|
1145
|
+
__name: "DataTable",
|
|
1146
|
+
props: {
|
|
1147
|
+
data: {},
|
|
1148
|
+
columns: {},
|
|
1149
|
+
getRowId: {},
|
|
1150
|
+
striped: {
|
|
1151
|
+
type: Boolean,
|
|
1152
|
+
default: !1
|
|
1153
|
+
},
|
|
1154
|
+
size: { default: "default" },
|
|
1155
|
+
emptyLabel: { default: "No results" },
|
|
1156
|
+
sortable: {
|
|
1157
|
+
type: Boolean,
|
|
1158
|
+
default: !0
|
|
1159
|
+
},
|
|
1160
|
+
expandable: {
|
|
1161
|
+
type: Boolean,
|
|
1162
|
+
default: !1
|
|
1163
|
+
},
|
|
1164
|
+
expanded: { default: () => ({}) },
|
|
1165
|
+
stopRowToggleOnInteractiveCells: {
|
|
1166
|
+
type: Boolean,
|
|
1167
|
+
default: !0
|
|
1168
|
+
},
|
|
1169
|
+
maxHeight: {}
|
|
1170
|
+
},
|
|
1171
|
+
emits: [
|
|
1172
|
+
"update:sorting",
|
|
1173
|
+
"update:expanded",
|
|
1174
|
+
"row-click"
|
|
1175
|
+
],
|
|
1176
|
+
setup(e, { emit: t }) {
|
|
1177
|
+
let n = e, r = t, i = D(), u = b([]), p = n.getRowId ? (e) => n.getRowId(e) : void 0, m = Ze({
|
|
1178
|
+
features: jn,
|
|
1179
|
+
get columns() {
|
|
1180
|
+
return n.columns;
|
|
1181
|
+
},
|
|
1182
|
+
get data() {
|
|
1183
|
+
return n.data;
|
|
1184
|
+
},
|
|
1185
|
+
getRowId: p,
|
|
1186
|
+
getRowCanExpand: () => n.expandable,
|
|
1187
|
+
state: {
|
|
1188
|
+
get sorting() {
|
|
1189
|
+
return u.value;
|
|
1190
|
+
},
|
|
1191
|
+
get expanded() {
|
|
1192
|
+
return n.expanded;
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
onSortingChange: (e) => {
|
|
1196
|
+
u.value = typeof e == "function" ? e(u.value) : e, r("update:sorting", u.value.map((e) => ({
|
|
1197
|
+
id: e.id,
|
|
1198
|
+
desc: e.desc
|
|
1199
|
+
})));
|
|
1200
|
+
},
|
|
1201
|
+
onExpandedChange: (e) => {
|
|
1202
|
+
let t = typeof e == "function" ? e(n.expanded) : e;
|
|
1203
|
+
r("update:expanded", t === !0 ? {} : t);
|
|
1204
|
+
}
|
|
1205
|
+
}), _ = o(() => m.getRowModel().rows), v = o(() => m.getAllLeafColumns().length);
|
|
1206
|
+
function C(e) {
|
|
1207
|
+
let t = m.getColumn(e);
|
|
1208
|
+
return t?.getIsSorted() ? t.getIsSorted() === "desc" ? "descending" : "ascending" : "none";
|
|
1209
|
+
}
|
|
1210
|
+
let E = (e) => !!i[`cell-${e}`], O = (e) => {
|
|
1211
|
+
let t = e.size;
|
|
1212
|
+
return t ? `${t}px` : void 0;
|
|
1213
|
+
};
|
|
1214
|
+
function k(e, t) {
|
|
1215
|
+
r("row-click", _.value.find((e) => e.id === t)?.original), n.expandable && (n.stopRowToggleOnInteractiveCells && Nn(e.target) || r("update:expanded", Pn(n.expanded, t)));
|
|
1216
|
+
}
|
|
1217
|
+
return (t, n) => (y(), l("div", {
|
|
1218
|
+
class: h(e.maxHeight ? "overflow-auto" : void 0),
|
|
1219
|
+
style: g(e.maxHeight ? { maxHeight: e.maxHeight } : void 0)
|
|
1220
|
+
}, [f(cn, {
|
|
1221
|
+
striped: e.striped,
|
|
1222
|
+
size: e.size
|
|
1223
|
+
}, {
|
|
1224
|
+
default: j(() => [f(pn, null, {
|
|
1225
|
+
default: j(() => [f(X, null, {
|
|
1226
|
+
default: j(() => [(y(!0), l(a, null, x(T(m).getHeaderGroups()[0]?.headers ?? [], (t) => (y(), s(vn, {
|
|
1227
|
+
key: t.id,
|
|
1228
|
+
width: O(t.column.columnDef),
|
|
1229
|
+
"sort-direction": t.column.getCanSort() ? C(t.column.id) : void 0
|
|
1230
|
+
}, {
|
|
1231
|
+
default: j(() => [e.sortable && t.column.getCanSort() ? (y(), l("button", {
|
|
1232
|
+
key: 0,
|
|
1233
|
+
type: "button",
|
|
1234
|
+
class: "inline-flex items-center gap-1 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
1235
|
+
onClick: (e) => t.column.toggleSorting()
|
|
1236
|
+
}, [f(T(V), { header: t }, null, 8, ["header"]), C(t.column.id) === "descending" ? (y(), s(T(I), {
|
|
1237
|
+
key: 0,
|
|
1238
|
+
class: "size-3.5"
|
|
1239
|
+
})) : C(t.column.id) === "ascending" ? (y(), s(T(te), {
|
|
1240
|
+
key: 1,
|
|
1241
|
+
class: "size-3.5"
|
|
1242
|
+
})) : (y(), s(T(ie), {
|
|
1243
|
+
key: 2,
|
|
1244
|
+
class: "size-3.5 opacity-40"
|
|
1245
|
+
}))], 8, Fn)) : (y(), s(T(V), {
|
|
1246
|
+
key: 1,
|
|
1247
|
+
header: t
|
|
1248
|
+
}, null, 8, ["header"]))]),
|
|
1249
|
+
_: 2
|
|
1250
|
+
}, 1032, ["width", "sort-direction"]))), 128))]),
|
|
1251
|
+
_: 1
|
|
1252
|
+
})]),
|
|
1253
|
+
_: 1
|
|
1254
|
+
}), f(gn, null, {
|
|
1255
|
+
default: j(() => [_.value.length === 0 ? (y(), s(bn, {
|
|
1256
|
+
key: 0,
|
|
1257
|
+
columns: v.value
|
|
1258
|
+
}, {
|
|
1259
|
+
default: j(() => [S(t.$slots, "empty", {}, () => [d(w(e.emptyLabel), 1)])]),
|
|
1260
|
+
_: 3
|
|
1261
|
+
}, 8, ["columns"])) : c("", !0), (y(!0), l(a, null, x(_.value, (n) => (y(), l(a, { key: n.id }, [f(X, {
|
|
1262
|
+
clickable: e.expandable,
|
|
1263
|
+
"data-row-id": n.id,
|
|
1264
|
+
"data-state": n.getIsExpanded() ? "expanded" : void 0,
|
|
1265
|
+
onClick: (e) => k(e, n.id)
|
|
1266
|
+
}, {
|
|
1267
|
+
default: j(() => [(y(!0), l(a, null, x(n.getAllCells(), (e) => (y(), s(Z, { key: e.id }, {
|
|
1268
|
+
default: j(() => [E(e.column.id) ? S(t.$slots, `cell-${e.column.id}`, {
|
|
1269
|
+
row: n,
|
|
1270
|
+
cell: e,
|
|
1271
|
+
value: e.getValue()
|
|
1272
|
+
}, void 0, void 0, 0) : (y(), s(T(V), {
|
|
1273
|
+
key: 1,
|
|
1274
|
+
cell: e
|
|
1275
|
+
}, null, 8, ["cell"]))]),
|
|
1276
|
+
_: 2
|
|
1277
|
+
}, 1024))), 128))]),
|
|
1278
|
+
_: 2
|
|
1279
|
+
}, 1032, [
|
|
1280
|
+
"clickable",
|
|
1281
|
+
"data-row-id",
|
|
1282
|
+
"data-state",
|
|
1283
|
+
"onClick"
|
|
1284
|
+
]), n.getIsExpanded() ? (y(), s(X, {
|
|
1285
|
+
key: 0,
|
|
1286
|
+
class: "bg-surface-muted/30"
|
|
1287
|
+
}, {
|
|
1288
|
+
default: j(() => [f(Z, { colspan: v.value }, {
|
|
1289
|
+
default: j(() => [S(t.$slots, "expansion", { row: n })]),
|
|
1290
|
+
_: 2
|
|
1291
|
+
}, 1032, ["colspan"])]),
|
|
1292
|
+
_: 2
|
|
1293
|
+
}, 1024)) : c("", !0)], 64))), 128))]),
|
|
1294
|
+
_: 3
|
|
1295
|
+
})]),
|
|
1296
|
+
_: 3
|
|
1297
|
+
}, 8, ["striped", "size"])], 6));
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
//#endregion
|
|
1301
|
+
//#region src/lib/tree.ts
|
|
1302
|
+
function Q(e, t, n = 1, r = null) {
|
|
1303
|
+
return e.flatMap((e) => {
|
|
1304
|
+
let i = {
|
|
1305
|
+
node: e,
|
|
1306
|
+
key: e.value,
|
|
1307
|
+
level: n,
|
|
1308
|
+
parentKey: r,
|
|
1309
|
+
hasChildren: !!e.children?.length
|
|
1310
|
+
};
|
|
1311
|
+
return !i.hasChildren || !t.includes(e.value) ? [i] : [i, ...Q(e.children, t, n + 1, e.value)];
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
function Ln(e, t) {
|
|
1315
|
+
for (let n of e) {
|
|
1316
|
+
if (n.value === t) return n;
|
|
1317
|
+
let e = n.children ? Ln(n.children, t) : void 0;
|
|
1318
|
+
if (e) return e;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
function $(e) {
|
|
1322
|
+
return e.flatMap((e) => e.children?.length ? $(e.children) : [e.value]);
|
|
1323
|
+
}
|
|
1324
|
+
function Rn(e, t) {
|
|
1325
|
+
let n = e.children?.length ? $([e]) : [e.value], r = n.filter((e) => t.includes(e)).length;
|
|
1326
|
+
return r === 0 ? "unchecked" : r === n.length ? "checked" : "indeterminate";
|
|
1327
|
+
}
|
|
1328
|
+
function zn(e, t, n = (e) => e.label ?? "") {
|
|
1329
|
+
let r = t.trim().toLowerCase();
|
|
1330
|
+
return r ? e.reduce((e, i) => {
|
|
1331
|
+
let a = i.children ? zn(i.children, t, n) : void 0;
|
|
1332
|
+
return !n(i).toLowerCase().includes(r) && (!a || a.length === 0) || e.push({
|
|
1333
|
+
...i,
|
|
1334
|
+
children: a
|
|
1335
|
+
}), e;
|
|
1336
|
+
}, []) : e;
|
|
1337
|
+
}
|
|
1338
|
+
//#endregion
|
|
1339
|
+
//#region src/components/tree-table/TreeTable.vue?vue&type=script&setup=true&lang.ts
|
|
1340
|
+
var Bn = { class: "overflow-hidden rounded-md border border-border bg-surface" }, Vn = { class: "px-3 py-2" }, Hn = ["aria-label", "onClick"], Un = {
|
|
1341
|
+
key: 1,
|
|
1342
|
+
class: "inline-block size-4"
|
|
1343
|
+
}, Wn = /* @__PURE__ */ p({
|
|
1344
|
+
__name: "TreeTable",
|
|
1345
|
+
props: {
|
|
1346
|
+
nodes: {},
|
|
1347
|
+
columns: {},
|
|
1348
|
+
expanded: { default: () => [] },
|
|
1349
|
+
rowLabel: {
|
|
1350
|
+
type: Function,
|
|
1351
|
+
default: (e) => e.label ?? e.value
|
|
1352
|
+
},
|
|
1353
|
+
rowColumnHeader: { default: "Name" }
|
|
1354
|
+
},
|
|
1355
|
+
emits: ["update:expanded"],
|
|
1356
|
+
setup(e, { emit: t }) {
|
|
1357
|
+
let n = e, r = t, i = o(() => `minmax(12rem, 1fr) ${n.columns.map((e) => e.width ?? "minmax(6rem, 1fr)").join(" ")}`), c = o(() => Q(n.nodes, n.expanded));
|
|
1358
|
+
return (t, n) => (y(), l("div", Bn, [u("div", {
|
|
1359
|
+
class: "grid border-b border-border bg-surface-muted/60 text-xs font-medium text-muted",
|
|
1360
|
+
style: g({ gridTemplateColumns: i.value })
|
|
1361
|
+
}, [u("div", Vn, [S(t.$slots, "header", {}, () => [d(w(e.rowColumnHeader), 1)])]), (y(!0), l(a, null, x(e.columns, (e) => (y(), l("div", {
|
|
1362
|
+
key: e.key,
|
|
1363
|
+
class: h(["px-3 py-2", [e.align === "center" && "text-center", e.align === "end" && "text-end"]])
|
|
1364
|
+
}, w(e.header), 3))), 128))], 4), f(T(He), {
|
|
1365
|
+
items: e.nodes,
|
|
1366
|
+
"get-key": (e) => e.value,
|
|
1367
|
+
"get-children": (e) => e.children,
|
|
1368
|
+
expanded: e.expanded,
|
|
1369
|
+
"onUpdate:expanded": n[0] ||= (e) => r("update:expanded", e)
|
|
1370
|
+
}, {
|
|
1371
|
+
default: j(() => [(y(!0), l(a, null, x(c.value, (n) => (y(), s(T(Ve), {
|
|
1372
|
+
key: n.key,
|
|
1373
|
+
value: n.node,
|
|
1374
|
+
level: n.level,
|
|
1375
|
+
as: "div",
|
|
1376
|
+
class: "grid items-center border-b border-border/60 text-sm last:border-b-0 data-[selected]:bg-surface-muted/30",
|
|
1377
|
+
style: g({ gridTemplateColumns: i.value })
|
|
1378
|
+
}, {
|
|
1379
|
+
default: j(({ isExpanded: r, handleToggle: i }) => [u("div", {
|
|
1380
|
+
class: "flex items-center gap-1 px-3 py-2",
|
|
1381
|
+
style: g({ paddingInlineStart: `calc(0.75rem + ${(n.level - 1) * 1.25}rem)` })
|
|
1382
|
+
}, [n.hasChildren ? (y(), l("button", {
|
|
1383
|
+
key: 0,
|
|
1384
|
+
type: "button",
|
|
1385
|
+
"aria-label": e.rowLabel(n.node),
|
|
1386
|
+
class: h(["rounded p-0.5 text-muted transition-transform hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500", r && "rotate-90"]),
|
|
1387
|
+
onClick: N(i, ["stop"])
|
|
1388
|
+
}, [f(T(R), { class: "size-3.5 rtl:rotate-180" })], 10, Hn)) : (y(), l("span", Un)), S(t.$slots, "row-label", {
|
|
1389
|
+
node: n.node,
|
|
1390
|
+
level: n.level
|
|
1391
|
+
}, () => [d(w(e.rowLabel(n.node)), 1)])], 4), (y(!0), l(a, null, x(e.columns, (e) => (y(), l("div", {
|
|
1392
|
+
key: e.key,
|
|
1393
|
+
class: h(["px-3 py-2", [e.align === "center" && "text-center", e.align === "end" && "text-end"]])
|
|
1394
|
+
}, [S(t.$slots, `cell-${e.key}`, {
|
|
1395
|
+
node: n.node,
|
|
1396
|
+
row: n,
|
|
1397
|
+
isExpanded: r,
|
|
1398
|
+
hasChildren: n.hasChildren,
|
|
1399
|
+
handleToggle: i
|
|
1400
|
+
})], 2))), 128))]),
|
|
1401
|
+
_: 2
|
|
1402
|
+
}, 1032, [
|
|
1403
|
+
"value",
|
|
1404
|
+
"level",
|
|
1405
|
+
"style"
|
|
1406
|
+
]))), 128))]),
|
|
1407
|
+
_: 3
|
|
1408
|
+
}, 8, [
|
|
1409
|
+
"items",
|
|
1410
|
+
"get-key",
|
|
1411
|
+
"get-children",
|
|
1412
|
+
"expanded"
|
|
1413
|
+
])]));
|
|
1414
|
+
}
|
|
1415
|
+
}), Gn = ["disabled"], Kn = {
|
|
1416
|
+
key: 0,
|
|
1417
|
+
class: "truncate text-muted"
|
|
1418
|
+
}, qn = {
|
|
1419
|
+
key: 1,
|
|
1420
|
+
class: "flex flex-wrap items-center gap-1"
|
|
1421
|
+
}, Jn = {
|
|
1422
|
+
key: 0,
|
|
1423
|
+
class: "relative mb-2"
|
|
1424
|
+
}, Yn = ["placeholder"], Xn = {
|
|
1425
|
+
key: 1,
|
|
1426
|
+
class: "block h-0.5 w-2 rounded bg-white"
|
|
1427
|
+
}, Zn = { class: "truncate" }, Qn = {
|
|
1428
|
+
key: 1,
|
|
1429
|
+
class: "mt-2 flex justify-end border-t border-border pt-2"
|
|
1430
|
+
}, $n = /* @__PURE__ */ p({
|
|
1431
|
+
__name: "TreeSelect",
|
|
1432
|
+
props: {
|
|
1433
|
+
modelValue: { default: () => [] },
|
|
1434
|
+
nodes: {},
|
|
1435
|
+
placeholder: { default: "Select" },
|
|
1436
|
+
filterable: {
|
|
1437
|
+
type: Boolean,
|
|
1438
|
+
default: !0
|
|
1439
|
+
},
|
|
1440
|
+
filterPlaceholder: { default: "Search" },
|
|
1441
|
+
disabled: { type: Boolean },
|
|
1442
|
+
leafOnly: {
|
|
1443
|
+
type: Boolean,
|
|
1444
|
+
default: !0
|
|
1445
|
+
},
|
|
1446
|
+
size: { default: "default" }
|
|
1447
|
+
},
|
|
1448
|
+
emits: ["update:modelValue"],
|
|
1449
|
+
setup(e, { emit: t }) {
|
|
1450
|
+
let n = e, r = t, i = b(!1), p = b(""), m = b([]), _ = o(() => zn(n.nodes, p.value)), v = o(() => Q(_.value, m.value)), S = o(() => $(n.nodes)), C = o(() => n.modelValue.map((e) => Ln(n.nodes, e)).filter((e) => !!e));
|
|
1451
|
+
function E(e) {
|
|
1452
|
+
return Rn(e, n.modelValue);
|
|
1453
|
+
}
|
|
1454
|
+
function D(e) {
|
|
1455
|
+
let t = (Array.isArray(e) ? e : []).map((e) => e.value);
|
|
1456
|
+
r("update:modelValue", n.leafOnly ? t.filter((e) => S.value.includes(e)) : t);
|
|
1457
|
+
}
|
|
1458
|
+
return (t, n) => (y(), s(T(Te), {
|
|
1459
|
+
open: i.value,
|
|
1460
|
+
"onUpdate:open": n[3] ||= (e) => i.value = e
|
|
1461
|
+
}, {
|
|
1462
|
+
default: j(() => [f(T(Ee), {
|
|
1463
|
+
"as-child": "",
|
|
1464
|
+
disabled: e.disabled
|
|
1465
|
+
}, {
|
|
1466
|
+
default: j(() => [u("button", {
|
|
1467
|
+
type: "button",
|
|
1468
|
+
disabled: e.disabled,
|
|
1469
|
+
class: h(["flex w-full items-center justify-between gap-2 rounded-md border border-border bg-surface px-3 text-start text-sm text-foreground shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50", e.size === "sm" ? "min-h-8 py-1 text-xs" : "min-h-9 py-1.5"])
|
|
1470
|
+
}, [C.value.length === 0 ? (y(), l("span", Kn, w(e.placeholder), 1)) : (y(), l("span", qn, [(y(!0), l(a, null, x(C.value, (e) => (y(), s(vt, {
|
|
1471
|
+
key: e.value,
|
|
1472
|
+
tone: "secondary"
|
|
1473
|
+
}, {
|
|
1474
|
+
default: j(() => [d(w(e.label ?? e.value), 1)]),
|
|
1475
|
+
_: 2
|
|
1476
|
+
}, 1024))), 128))])), f(T(I), { class: "size-4 shrink-0 opacity-50" })], 10, Gn)]),
|
|
1477
|
+
_: 1
|
|
1478
|
+
}, 8, ["disabled"]), f(T(we), {
|
|
1479
|
+
"side-offset": 4,
|
|
1480
|
+
class: "z-50 w-72 rounded-md border border-border bg-surface p-2 shadow-popover"
|
|
1481
|
+
}, {
|
|
1482
|
+
default: j(() => [
|
|
1483
|
+
e.filterable ? (y(), l("div", Jn, [f(T(ce), { class: "pointer-events-none absolute start-2 top-1/2 size-3.5 -translate-y-1/2 text-muted" }), M(u("input", {
|
|
1484
|
+
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
1485
|
+
placeholder: e.filterPlaceholder,
|
|
1486
|
+
class: "w-full rounded-md border border-border bg-surface py-1.5 pe-2 ps-7 text-sm placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500"
|
|
1487
|
+
}, null, 8, Yn), [[O, p.value]])])) : c("", !0),
|
|
1488
|
+
f(T(He), {
|
|
1489
|
+
"model-value": C.value,
|
|
1490
|
+
items: _.value,
|
|
1491
|
+
"get-key": (e) => e.value,
|
|
1492
|
+
"get-children": (e) => e.children,
|
|
1493
|
+
expanded: m.value,
|
|
1494
|
+
"onUpdate:expanded": n[1] ||= (e) => m.value = e,
|
|
1495
|
+
multiple: "",
|
|
1496
|
+
"bubble-select": "",
|
|
1497
|
+
"onUpdate:modelValue": D
|
|
1498
|
+
}, {
|
|
1499
|
+
default: j(() => [(y(!0), l(a, null, x(v.value, (e) => (y(), s(T(Ve), {
|
|
1500
|
+
key: e.key,
|
|
1501
|
+
value: e.node,
|
|
1502
|
+
level: e.level,
|
|
1503
|
+
as: "div",
|
|
1504
|
+
class: "flex items-center gap-2 rounded py-1.5 text-sm text-foreground data-[selected]:bg-surface-muted/50",
|
|
1505
|
+
style: g({ paddingInlineStart: `calc(0.5rem + ${(e.level - 1) * 1}rem)` })
|
|
1506
|
+
}, {
|
|
1507
|
+
default: j(() => [u("span", {
|
|
1508
|
+
class: h(["flex size-4 shrink-0 items-center justify-center rounded border border-border", E(e.node) !== "unchecked" && "border-primary-500 bg-primary-500 text-white"]),
|
|
1509
|
+
"aria-hidden": "true"
|
|
1510
|
+
}, [E(e.node) === "checked" ? (y(), s(T(F), {
|
|
1511
|
+
key: 0,
|
|
1512
|
+
class: "size-3"
|
|
1513
|
+
})) : E(e.node) === "indeterminate" ? (y(), l("span", Xn)) : c("", !0)], 2), u("span", Zn, w(e.node.label ?? e.node.value), 1)]),
|
|
1514
|
+
_: 2
|
|
1515
|
+
}, 1032, [
|
|
1516
|
+
"value",
|
|
1517
|
+
"level",
|
|
1518
|
+
"style"
|
|
1519
|
+
]))), 128))]),
|
|
1520
|
+
_: 1
|
|
1521
|
+
}, 8, [
|
|
1522
|
+
"model-value",
|
|
1523
|
+
"items",
|
|
1524
|
+
"get-key",
|
|
1525
|
+
"get-children",
|
|
1526
|
+
"expanded"
|
|
1527
|
+
]),
|
|
1528
|
+
e.modelValue.length ? (y(), l("div", Qn, [u("button", {
|
|
1529
|
+
type: "button",
|
|
1530
|
+
class: "inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-muted hover:bg-surface-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
|
|
1531
|
+
onClick: n[2] ||= (e) => r("update:modelValue", [])
|
|
1532
|
+
}, [f(T(z), { class: "size-3" }), n[4] ||= d("Clear ", -1)])])) : c("", !0)
|
|
1533
|
+
]),
|
|
1534
|
+
_: 1
|
|
1535
|
+
})]),
|
|
1536
|
+
_: 1
|
|
1537
|
+
}, 8, ["open"]));
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
//#endregion
|
|
1541
|
+
export { J as Button, Y as Checkbox, In as DataTable, Rt as DatePicker, Ut as Dialog, Wt as DropdownMenu, Kt as DropdownMenuContent, qt as DropdownMenuItem, Gt as DropdownMenuTrigger, q as Icon, ct as Input, gt as Password, Tt as Select, Et as SelectButton, cn as Table, gn as TableBody, Z as TableCell, bn as TableEmpty, vn as TableHead, pn as TableHeader, An as TablePagination, X as TableRow, yt as Tabs, St as TabsContent, bt as TabsList, xt as TabsTrigger, vt as Tag, ut as Textarea, sn as TransferList, $n as TreeSelect, Wn as TreeTable, W as clampTime, H as cn, Qe as dateToValue, rt as resolveIconName, G as sortRange, K as toISODate, U as toMinutes, tt as toPascalCase, et as toTime, $e as valueToDate };
|
|
1542
|
+
|
|
1543
|
+
//# sourceMappingURL=index.js.map
|