@eschoolbase/client-ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -18
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +3 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.types.d.ts +21 -0
- package/dist/components/ConfirmDialog/index.d.ts +2 -0
- package/dist/components/DataTable/DataTable.d.ts +10 -0
- package/dist/components/DataTable/DataTable.types.d.ts +154 -0
- package/dist/components/DataTable/SelectionBar.d.ts +18 -0
- package/dist/components/DataTable/dataTableUtils.d.ts +13 -0
- package/dist/components/DataTable/dataTableUtils.test.d.ts +1 -0
- package/dist/components/DataTable/index.d.ts +6 -0
- package/dist/components/DataTable/remote.d.ts +36 -0
- package/dist/components/DataTable/remote.test.d.ts +1 -0
- package/dist/components/DataTable/useDebouncedValue.d.ts +2 -0
- package/dist/components/DatePicker/Calendar.d.ts +15 -0
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +45 -0
- package/dist/components/DatePicker/MonthCalendar.d.ts +12 -0
- package/dist/components/DatePicker/PickerField.d.ts +40 -0
- package/dist/components/DatePicker/TimeColumns.d.ts +12 -0
- package/dist/components/DatePicker/createDisabledPredicate.test.d.ts +1 -0
- package/dist/components/DatePicker/dateUtils.d.ts +70 -0
- package/dist/components/DatePicker/dateUtils.test.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/monthDateTimeUtils.test.d.ts +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -0
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +50 -0
- package/dist/components/DateTimePicker/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.d.ts +3 -0
- package/dist/components/Drawer/Drawer.types.d.ts +10 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +7 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +21 -0
- package/dist/components/DropdownMenu/index.d.ts +2 -0
- package/dist/components/FileInput/FileInput.d.ts +6 -0
- package/dist/components/FileInput/FileInput.types.d.ts +55 -0
- package/dist/components/FileInput/ImageCropper.d.ts +21 -0
- package/dist/components/FileInput/fileUtils.d.ts +8 -0
- package/dist/components/FileInput/index.d.ts +3 -0
- package/dist/components/Input/Input.types.d.ts +16 -0
- package/dist/components/Input/PickerTypeInput.d.ts +14 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +6 -0
- package/dist/components/Modal/Modal.types.d.ts +39 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/MonthPicker/MonthPicker.d.ts +3 -0
- package/dist/components/MonthPicker/MonthPicker.types.d.ts +37 -0
- package/dist/components/MonthPicker/index.d.ts +2 -0
- package/dist/components/Overlay/Overlay.d.ts +25 -0
- package/dist/components/Overlay/OverlayContent.d.ts +14 -0
- package/dist/components/PageHeader/PageHeader.d.ts +12 -0
- package/dist/components/PageHeader/index.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts +6 -0
- package/dist/components/Pagination/Pagination.types.d.ts +29 -0
- package/dist/components/Pagination/index.d.ts +4 -0
- package/dist/components/Pagination/paginationUtils.d.ts +7 -0
- package/dist/components/Pagination/paginationUtils.test.d.ts +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +7 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +7 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/StatusPill/StatusPill.d.ts +10 -0
- package/dist/components/StatusPill/index.d.ts +2 -0
- package/dist/components/Table/Table.d.ts +16 -0
- package/dist/components/Table/Table.types.d.ts +31 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/TableFilters/DynamicFilterRows.d.ts +24 -0
- package/dist/components/TableFilters/FilterValueControl.d.ts +14 -0
- package/dist/components/TableFilters/TableFilters.d.ts +6 -0
- package/dist/components/TableFilters/TableFilters.types.d.ts +32 -0
- package/dist/components/TableFilters/filterUtils.d.ts +5 -0
- package/dist/components/TableFilters/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +3750 -615
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/ThemeProvider.d.ts +2 -0
- package/dist/theme/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,24 +28,24 @@ function w(e) {
|
|
|
28
28
|
}
|
|
29
29
|
var T = (e) => (b.add(e), () => {
|
|
30
30
|
b.delete(e);
|
|
31
|
-
}),
|
|
32
|
-
function
|
|
33
|
-
let e = i(S), t = u(T,
|
|
31
|
+
}), E = () => y;
|
|
32
|
+
function D() {
|
|
33
|
+
let e = i(S), t = u(T, E, E), n = w(e ?? t);
|
|
34
34
|
return a(() => {
|
|
35
35
|
n || x || (x = !0, console.error("[client-ui] Missing or invalid license key. Components are disabled. Pass licenseKey to <ThemeProvider> or call setLicenseKey() once at app start."));
|
|
36
36
|
}, [n]), n;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
38
|
+
var O = { root: "cui-UnlicensedNotice-module__root--FdnRG" };
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/license/UnlicensedNotice.tsx
|
|
41
|
-
function
|
|
41
|
+
function k() {
|
|
42
42
|
return /* @__PURE__ */ f("span", {
|
|
43
43
|
role: "alert",
|
|
44
|
-
className:
|
|
44
|
+
className: O.root,
|
|
45
45
|
children: "client-ui: missing or invalid license key"
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var A = {
|
|
49
49
|
button: "cui-Button-module__button--2ZuB7",
|
|
50
50
|
sm: "cui-Button-module__sm--NhG0g",
|
|
51
51
|
md: "cui-Button-module__md--hH4h3",
|
|
@@ -59,8 +59,8 @@ var O = {
|
|
|
59
59
|
link: "cui-Button-module__link--Zt5hw",
|
|
60
60
|
spinner: "cui-Button-module__spinner--ZExvW",
|
|
61
61
|
spin: "cui-Button-module__spin--JvkZu"
|
|
62
|
-
},
|
|
63
|
-
return
|
|
62
|
+
}, j = n(function({ variant: e = "primary", size: t = "md", loading: n = !1, fullWidth: r = !1, type: i = "button", disabled: a, className: o, children: s, ...c }, l) {
|
|
63
|
+
return D() ? /* @__PURE__ */ p("button", {
|
|
64
64
|
...c,
|
|
65
65
|
ref: l,
|
|
66
66
|
type: i,
|
|
@@ -68,15 +68,15 @@ var O = {
|
|
|
68
68
|
"aria-busy": n || void 0,
|
|
69
69
|
"data-variant": e,
|
|
70
70
|
"data-size": t,
|
|
71
|
-
className: h(
|
|
71
|
+
className: h(A.button, A[e], A[t], r && A.fullWidth, o),
|
|
72
72
|
children: [n ? /* @__PURE__ */ f("span", {
|
|
73
|
-
className:
|
|
73
|
+
className: A.spinner,
|
|
74
74
|
"aria-hidden": "true"
|
|
75
75
|
}) : null, s]
|
|
76
|
-
}) : /* @__PURE__ */ f(
|
|
77
|
-
}),
|
|
78
|
-
function
|
|
79
|
-
let t = i(
|
|
76
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
77
|
+
}), M = e(null);
|
|
78
|
+
function N(e) {
|
|
79
|
+
let t = i(M), n = o(), r = t?.id ?? e.id ?? n, a = !!(e.required ?? t?.required), s = !!(e.disabled ?? t?.disabled), c = !!e.error || !!t?.invalid, l = [e["aria-describedby"], t?.describedById].filter(Boolean).join(" ") || void 0;
|
|
80
80
|
return {
|
|
81
81
|
id: r,
|
|
82
82
|
required: a,
|
|
@@ -87,7 +87,7 @@ function A(e) {
|
|
|
87
87
|
"aria-describedby": l
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
var
|
|
90
|
+
var P = {
|
|
91
91
|
root: "cui-FormField-module__root--QkVj-",
|
|
92
92
|
label: "cui-FormField-module__label--98wVM",
|
|
93
93
|
labelDisabled: "cui-FormField-module__labelDisabled--I5V6c",
|
|
@@ -98,7 +98,7 @@ var j = {
|
|
|
98
98
|
};
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/components/FormField/FormField.tsx
|
|
101
|
-
function
|
|
101
|
+
function F({ children: e, label: t, required: n = !1, helperText: r, error: i, disabled: a = !1, id: c, className: l, ...u }) {
|
|
102
102
|
let d = o(), m = c ?? d, g = !!i, _ = g ? `${m}-error` : r ? `${m}-helper` : void 0, v = s(() => ({
|
|
103
103
|
id: m,
|
|
104
104
|
describedById: _,
|
|
@@ -114,18 +114,18 @@ function M({ children: e, label: t, required: n = !1, helperText: r, error: i, d
|
|
|
114
114
|
a,
|
|
115
115
|
g
|
|
116
116
|
]);
|
|
117
|
-
return
|
|
117
|
+
return D() ? /* @__PURE__ */ f(M.Provider, {
|
|
118
118
|
value: v,
|
|
119
119
|
children: /* @__PURE__ */ p("div", {
|
|
120
120
|
...u,
|
|
121
|
-
className: h(
|
|
121
|
+
className: h(P.root, l),
|
|
122
122
|
children: [
|
|
123
123
|
t ? /* @__PURE__ */ p("label", {
|
|
124
124
|
id: `${m}-label`,
|
|
125
125
|
htmlFor: m,
|
|
126
|
-
className: h(
|
|
126
|
+
className: h(P.label, a && P.labelDisabled),
|
|
127
127
|
children: [t, n ? /* @__PURE__ */ f("span", {
|
|
128
|
-
className:
|
|
128
|
+
className: P.required,
|
|
129
129
|
"aria-hidden": "true",
|
|
130
130
|
children: "*"
|
|
131
131
|
}) : null]
|
|
@@ -133,19 +133,901 @@ function M({ children: e, label: t, required: n = !1, helperText: r, error: i, d
|
|
|
133
133
|
e,
|
|
134
134
|
g ? /* @__PURE__ */ f("p", {
|
|
135
135
|
id: _,
|
|
136
|
-
className: h(
|
|
136
|
+
className: h(P.message, P.error),
|
|
137
137
|
role: "alert",
|
|
138
138
|
children: i
|
|
139
139
|
}) : r ? /* @__PURE__ */ f("p", {
|
|
140
140
|
id: _,
|
|
141
|
-
className: h(
|
|
141
|
+
className: h(P.message, P.helper),
|
|
142
142
|
children: r
|
|
143
143
|
}) : null
|
|
144
144
|
]
|
|
145
145
|
})
|
|
146
|
-
}) : /* @__PURE__ */ f(
|
|
146
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/components/DatePicker/dateUtils.ts
|
|
150
|
+
var I = (e, t = 2) => String(e).padStart(t, "0"), L = (e) => `${I(e.getFullYear(), 4)}-${I(e.getMonth() + 1)}-${I(e.getDate())}`;
|
|
151
|
+
function R(e) {
|
|
152
|
+
if (!e || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return null;
|
|
153
|
+
let t = /* @__PURE__ */ new Date(`${e}T12:00:00`);
|
|
154
|
+
return Number.isFinite(t.getTime()) && L(t) === e ? t : null;
|
|
155
|
+
}
|
|
156
|
+
var z = () => {
|
|
157
|
+
let e = /* @__PURE__ */ new Date();
|
|
158
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate(), 12);
|
|
159
|
+
}, B = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t, 12);
|
|
160
|
+
function V(e, t) {
|
|
161
|
+
let n = new Date(e.getFullYear(), e.getMonth() + t, 1, 12), r = new Date(n.getFullYear(), n.getMonth() + 1, 0, 12).getDate();
|
|
162
|
+
return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r), 12);
|
|
163
|
+
}
|
|
164
|
+
var H = (e, t) => !!(e && t && L(e) === L(t));
|
|
165
|
+
function ee(e, t) {
|
|
166
|
+
let n = new Date(e.getFullYear(), e.getMonth(), 1, 12), r = (n.getDay() - t + 7) % 7;
|
|
167
|
+
return Array.from({ length: 42 }, (e, t) => B(n, t - r));
|
|
168
|
+
}
|
|
169
|
+
function U(e, t = z()) {
|
|
170
|
+
let n = R(e.min), r = R(e.max), i = L(t), a = new Set((e.disabledDates ?? []).map((e) => e instanceof Date ? L(e) : R(e) ? e : null).filter((e) => e !== null)), o = (e.disabledRanges ?? []).map((e) => ({
|
|
171
|
+
from: R(e.from),
|
|
172
|
+
to: R(e.to)
|
|
173
|
+
})).filter((e) => e.from !== null && e.to !== null).map((e) => ({
|
|
174
|
+
from: L(e.from),
|
|
175
|
+
to: L(e.to)
|
|
176
|
+
})), s = new Set(e.disabledDaysOfWeek ?? []);
|
|
177
|
+
return (t) => {
|
|
178
|
+
let c = L(t);
|
|
179
|
+
return n && c < L(n) || r && c > L(r) || e.disablePast && c < i || e.disableFuture && c > i || a.has(c) || s.has(t.getDay()) || o.some((e) => c >= e.from && c <= e.to) ? !0 : e.isDateDisabled?.(t) ?? !1;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function te(e, t) {
|
|
183
|
+
if (!t(e)) return e;
|
|
184
|
+
for (let n = 1; n <= 366; n++) {
|
|
185
|
+
let r = B(e, n);
|
|
186
|
+
if (!t(r)) return r;
|
|
187
|
+
let i = B(e, -n);
|
|
188
|
+
if (!t(i)) return i;
|
|
189
|
+
}
|
|
190
|
+
return e;
|
|
191
|
+
}
|
|
192
|
+
var W = (e) => `${I(e.getFullYear(), 4)}-${I(e.getMonth() + 1)}`;
|
|
193
|
+
function ne(e) {
|
|
194
|
+
return !e || !/^\d{4}-\d{2}$/.test(e) ? null : R(`${e}-01`);
|
|
195
|
+
}
|
|
196
|
+
function re(e, t = z()) {
|
|
197
|
+
let n = e.min && ne(e.min) ? e.min : null, r = e.max && ne(e.max) ? e.max : null, i = W(t), a = new Set((e.disabledMonths ?? []).filter((e) => ne(e)));
|
|
198
|
+
return (t) => {
|
|
199
|
+
let o = W(t);
|
|
200
|
+
return n && o < n || r && o > r || e.disablePast && o < i || e.disableFuture && o > i || a.has(o) ? !0 : e.isMonthDisabled?.(t) ?? !1;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
var ie = (e) => `${L(e)}T${I(e.getHours())}:${I(e.getMinutes())}`;
|
|
204
|
+
function ae(e) {
|
|
205
|
+
let t = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(e ?? "");
|
|
206
|
+
if (!t) return null;
|
|
207
|
+
let n = R(t[1]), r = Number(t[2]), i = Number(t[3]);
|
|
208
|
+
return !n || r > 23 || i > 59 ? null : new Date(n.getFullYear(), n.getMonth(), n.getDate(), r, i);
|
|
209
|
+
}
|
|
210
|
+
var oe = (e, t, n) => new Date(e.getFullYear(), e.getMonth(), e.getDate(), t, n), G = {
|
|
211
|
+
root: "cui-Calendar-module__root--Nuha8",
|
|
212
|
+
header: "cui-Calendar-module__header--BPQQc",
|
|
213
|
+
title: "cui-Calendar-module__title--HmlTp",
|
|
214
|
+
nav: "cui-Calendar-module__nav--m7oVU",
|
|
215
|
+
titleButton: "cui-Calendar-module__titleButton--o056C",
|
|
216
|
+
day: "cui-Calendar-module__day--3Adk8",
|
|
217
|
+
cell: "cui-Calendar-module__cell--i93Lx",
|
|
218
|
+
footerButton: "cui-Calendar-module__footerButton--xlHWH",
|
|
219
|
+
weekdays: "cui-Calendar-module__weekdays--q0AWC",
|
|
220
|
+
grid: "cui-Calendar-module__grid--QMyQn",
|
|
221
|
+
selected: "cui-Calendar-module__selected--6Q-na",
|
|
222
|
+
outside: "cui-Calendar-module__outside--JWMZI",
|
|
223
|
+
today: "cui-Calendar-module__today--DNP-o",
|
|
224
|
+
cells: "cui-Calendar-module__cells--741gl",
|
|
225
|
+
active: "cui-Calendar-module__active--Moaen",
|
|
226
|
+
footer: "cui-Calendar-module__footer--Kkc3d",
|
|
227
|
+
footerPrimary: "cui-Calendar-module__footerPrimary--nNPYm",
|
|
228
|
+
currentCell: "cui-Calendar-module__currentCell--9oL2S"
|
|
229
|
+
}, se = (e) => /* @__PURE__ */ f("svg", {
|
|
230
|
+
viewBox: "0 0 20 20",
|
|
231
|
+
fill: "none",
|
|
232
|
+
stroke: "currentColor",
|
|
233
|
+
strokeWidth: "2",
|
|
234
|
+
strokeLinecap: "round",
|
|
235
|
+
strokeLinejoin: "round",
|
|
236
|
+
"aria-hidden": "true",
|
|
237
|
+
focusable: "false",
|
|
238
|
+
children: /* @__PURE__ */ f("path", { d: e === "left" ? "M12 5l-5 5 5 5" : "M8 5l5 5-5 5" })
|
|
239
|
+
});
|
|
240
|
+
function ce({ selected: e, isDisabled: t, weekStartsOn: n, locale: r, onSelect: i, allowClear: o, showFooter: u = !0 }) {
|
|
241
|
+
let m = z(), [g, _] = l(() => te(e ?? m, t)), [v, y] = l("days"), b = c(null), x = c(!0), S = s(() => new Intl.DateTimeFormat(r, { month: "long" }).format(g), [g, r]), C = s(() => Array.from({ length: 12 }, (e, t) => new Intl.DateTimeFormat(r, { month: "short" }).format(new Date(2024, t, 1))), [r]), w = s(() => {
|
|
242
|
+
let e = new Date(2024, 0, 7 + n);
|
|
243
|
+
return Array.from({ length: 7 }, (t, n) => {
|
|
244
|
+
let i = B(e, n);
|
|
245
|
+
return {
|
|
246
|
+
short: new Intl.DateTimeFormat(r, { weekday: "short" }).format(i),
|
|
247
|
+
long: new Intl.DateTimeFormat(r, { weekday: "long" }).format(i)
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
}, [r, n]), T = s(() => new Intl.DateTimeFormat(r, { dateStyle: "full" }), [r]), E = s(() => ee(g, n), [g, n]), D = g.getFullYear(), O = Math.floor((D - 1) / 12) * 12 + 1, k = L(g);
|
|
251
|
+
a(() => {
|
|
252
|
+
v === "days" && x.current && b.current?.querySelector(`[data-date="${k}"]`)?.focus({ preventScroll: !0 });
|
|
253
|
+
}, [k, v]);
|
|
254
|
+
let A = (e) => {
|
|
255
|
+
x.current = !0, _(e);
|
|
256
|
+
}, j = (e) => {
|
|
257
|
+
let t = {
|
|
258
|
+
ArrowLeft: () => B(g, -1),
|
|
259
|
+
ArrowRight: () => B(g, 1),
|
|
260
|
+
ArrowUp: () => B(g, -7),
|
|
261
|
+
ArrowDown: () => B(g, 7),
|
|
262
|
+
PageUp: () => V(g, e.shiftKey ? -12 : -1),
|
|
263
|
+
PageDown: () => V(g, e.shiftKey ? 12 : 1),
|
|
264
|
+
Home: () => B(g, -((g.getDay() - n + 7) % 7)),
|
|
265
|
+
End: () => B(g, 6 - (g.getDay() - n + 7) % 7)
|
|
266
|
+
}[e.key];
|
|
267
|
+
t && (e.preventDefault(), A(t()));
|
|
268
|
+
}, M = (e) => {
|
|
269
|
+
x.current = !1, _((t) => V(t, e * (v === "years" ? 144 : v === "months" ? 12 : 1)));
|
|
270
|
+
}, N = v === "years" ? "Previous 12 years" : v === "months" ? "Previous year" : "Previous month", P = v === "years" ? "Next 12 years" : v === "months" ? "Next year" : "Next month";
|
|
271
|
+
return /* @__PURE__ */ p("div", {
|
|
272
|
+
className: G.root,
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ p("div", {
|
|
275
|
+
className: G.header,
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ f("button", {
|
|
278
|
+
type: "button",
|
|
279
|
+
className: G.nav,
|
|
280
|
+
"aria-label": N,
|
|
281
|
+
onClick: () => M(-1),
|
|
282
|
+
children: se("left")
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ f("div", {
|
|
285
|
+
className: G.title,
|
|
286
|
+
"aria-live": "polite",
|
|
287
|
+
children: v === "years" ? /* @__PURE__ */ p("span", { children: [
|
|
288
|
+
O,
|
|
289
|
+
" - ",
|
|
290
|
+
O + 11
|
|
291
|
+
] }) : /* @__PURE__ */ p(d, { children: [v === "days" ? /* @__PURE__ */ f("button", {
|
|
292
|
+
type: "button",
|
|
293
|
+
className: G.titleButton,
|
|
294
|
+
"aria-label": "Choose month",
|
|
295
|
+
onClick: () => y("months"),
|
|
296
|
+
children: S
|
|
297
|
+
}) : null, /* @__PURE__ */ f("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
className: G.titleButton,
|
|
300
|
+
"aria-label": "Choose year",
|
|
301
|
+
onClick: () => y("years"),
|
|
302
|
+
children: D
|
|
303
|
+
})] })
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ f("button", {
|
|
306
|
+
type: "button",
|
|
307
|
+
className: G.nav,
|
|
308
|
+
"aria-label": P,
|
|
309
|
+
onClick: () => M(1),
|
|
310
|
+
children: se("right")
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
}),
|
|
314
|
+
v === "days" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
|
|
315
|
+
className: G.weekdays,
|
|
316
|
+
"aria-hidden": "true",
|
|
317
|
+
children: w.map((e) => /* @__PURE__ */ f("span", { children: e.short }, e.long))
|
|
318
|
+
}), /* @__PURE__ */ f("div", {
|
|
319
|
+
ref: b,
|
|
320
|
+
className: G.grid,
|
|
321
|
+
role: "group",
|
|
322
|
+
"aria-label": `${S} ${D}`,
|
|
323
|
+
onKeyDown: j,
|
|
324
|
+
children: E.map((n) => {
|
|
325
|
+
let r = L(n), a = n.getMonth() !== g.getMonth(), o = H(n, e);
|
|
326
|
+
return /* @__PURE__ */ f("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
"data-date": r,
|
|
329
|
+
tabIndex: H(n, g) ? 0 : -1,
|
|
330
|
+
"aria-disabled": t(n) || void 0,
|
|
331
|
+
"aria-label": T.format(n),
|
|
332
|
+
"aria-pressed": o,
|
|
333
|
+
"aria-current": H(n, m) ? "date" : void 0,
|
|
334
|
+
className: h(G.day, a && G.outside, H(n, m) && G.today, o && G.selected),
|
|
335
|
+
onClick: () => {
|
|
336
|
+
t(n) || i(n);
|
|
337
|
+
},
|
|
338
|
+
children: n.getDate()
|
|
339
|
+
}, r);
|
|
340
|
+
})
|
|
341
|
+
})] }) : v === "months" ? /* @__PURE__ */ f("div", {
|
|
342
|
+
className: G.cells,
|
|
343
|
+
children: C.map((e, t) => /* @__PURE__ */ f("button", {
|
|
344
|
+
type: "button",
|
|
345
|
+
className: h(G.cell, t === g.getMonth() && G.active),
|
|
346
|
+
onClick: () => {
|
|
347
|
+
x.current = !0, _((e) => V(e, t - e.getMonth())), y("days");
|
|
348
|
+
},
|
|
349
|
+
children: e
|
|
350
|
+
}, e))
|
|
351
|
+
}) : /* @__PURE__ */ f("div", {
|
|
352
|
+
className: G.cells,
|
|
353
|
+
children: Array.from({ length: 12 }, (e, t) => O + t).map((e) => /* @__PURE__ */ f("button", {
|
|
354
|
+
type: "button",
|
|
355
|
+
className: h(G.cell, e === D && G.active),
|
|
356
|
+
onClick: () => {
|
|
357
|
+
x.current = !0, _((t) => V(t, (e - t.getFullYear()) * 12)), y("months");
|
|
358
|
+
},
|
|
359
|
+
children: e
|
|
360
|
+
}, e))
|
|
361
|
+
}),
|
|
362
|
+
u ? /* @__PURE__ */ p("div", {
|
|
363
|
+
className: G.footer,
|
|
364
|
+
children: [o ? /* @__PURE__ */ f("button", {
|
|
365
|
+
type: "button",
|
|
366
|
+
className: G.footerButton,
|
|
367
|
+
onClick: () => i(null),
|
|
368
|
+
children: "Clear"
|
|
369
|
+
}) : /* @__PURE__ */ f("span", {}), /* @__PURE__ */ f("button", {
|
|
370
|
+
type: "button",
|
|
371
|
+
className: h(G.footerButton, G.footerPrimary),
|
|
372
|
+
disabled: t(m),
|
|
373
|
+
onClick: () => i(m),
|
|
374
|
+
children: "Today"
|
|
375
|
+
})]
|
|
376
|
+
}) : null
|
|
377
|
+
]
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
var K = {
|
|
381
|
+
control: "cui-PickerField-module__control--hv4-k",
|
|
382
|
+
trigger: "cui-PickerField-module__trigger--nMtV1",
|
|
383
|
+
open: "cui-PickerField-module__open--2Fuec",
|
|
384
|
+
value: "cui-PickerField-module__value--ygNxN",
|
|
385
|
+
placeholder: "cui-PickerField-module__placeholder--1Dyyf",
|
|
386
|
+
sm: "cui-PickerField-module__sm--D-r4h",
|
|
387
|
+
md: "cui-PickerField-module__md--BznWY",
|
|
388
|
+
lg: "cui-PickerField-module__lg--kVaWE",
|
|
389
|
+
icon: "cui-PickerField-module__icon--d3eU4",
|
|
390
|
+
clear: "cui-PickerField-module__clear--aFEVN",
|
|
391
|
+
invalid: "cui-PickerField-module__invalid--rZMR8",
|
|
392
|
+
disabled: "cui-PickerField-module__disabled--YO0Rv",
|
|
393
|
+
panel: "cui-PickerField-module__panel--QoUNQ",
|
|
394
|
+
"cui-datepicker-in": "cui-PickerField-module__cui-datepicker-in--J-Ky1"
|
|
395
|
+
}, le = 4, ue = 420, de = "button:not([disabled]):not([tabindex=\"-1\"]), [tabindex=\"0\"]", q = n(function({ id: e, required: t, disabled: n, error: i, "aria-describedby": s, size: u = "md", displayText: g, placeholder: _, name: v, hiddenValue: y, clearable: b, onClear: x, clearLabel: S, panelLabel: C, panelWidth: w = 300, icon: T = "calendar", className: E, onClick: D, onKeyDown: O, children: k, ...A }, j) {
|
|
396
|
+
let M = N({
|
|
397
|
+
id: e,
|
|
398
|
+
required: t,
|
|
399
|
+
disabled: n,
|
|
400
|
+
error: i,
|
|
401
|
+
"aria-describedby": s
|
|
402
|
+
}), P = `${o()}-panel`, F = c(null), I = c(null), L = c(null), R = r((e) => {
|
|
403
|
+
I.current = e, typeof j == "function" ? j(e) : j && (j.current = e);
|
|
404
|
+
}, [j]), [z, B] = l(!1), [V, H] = l(null), [ee, U] = l(), te = r(() => {
|
|
405
|
+
let e = F.current;
|
|
406
|
+
if (!e) return;
|
|
407
|
+
let t = e.getBoundingClientRect(), n = window.innerHeight - t.bottom, r = n < ue && t.top > n, i = { left: Math.max(8, Math.min(t.left, window.innerWidth - w)) };
|
|
408
|
+
r ? i.bottom = window.innerHeight - t.top + le : i.top = t.bottom + le, H(i);
|
|
409
|
+
}, [w]), W = () => {
|
|
410
|
+
M.disabled || (te(), U(F.current?.closest("[data-theme]")?.getAttribute("data-theme") ?? void 0), B(!0));
|
|
411
|
+
}, [ne, re] = l(0), ie = (e = !0) => {
|
|
412
|
+
B(!1), e && re((e) => e + 1);
|
|
413
|
+
};
|
|
414
|
+
a(() => {
|
|
415
|
+
ne > 0 && I.current?.focus({ preventScroll: !0 });
|
|
416
|
+
}, [ne]), a(() => {
|
|
417
|
+
if (!z) return;
|
|
418
|
+
let e = () => requestAnimationFrame(te), t = (e) => {
|
|
419
|
+
let t = e.target;
|
|
420
|
+
!F.current?.contains(t) && !L.current?.contains(t) && B(!1);
|
|
421
|
+
};
|
|
422
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t, !0), () => {
|
|
423
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t, !0);
|
|
424
|
+
};
|
|
425
|
+
}, [z, te]);
|
|
426
|
+
let ae = (e) => {
|
|
427
|
+
if (e.key === "Escape") {
|
|
428
|
+
e.preventDefault(), e.stopPropagation(), ie();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (e.key !== "Tab") return;
|
|
432
|
+
let t = Array.from(L.current?.querySelectorAll(de) ?? []), n = t[0], r = t[t.length - 1];
|
|
433
|
+
n && r && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
434
|
+
}, oe = g !== null, G = b && oe && !M.disabled;
|
|
435
|
+
return /* @__PURE__ */ p("div", {
|
|
436
|
+
ref: F,
|
|
437
|
+
className: h(K.control, K[u], M.invalid && K.invalid, M.disabled && K.disabled, z && K.open, E),
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ f("button", {
|
|
440
|
+
...A,
|
|
441
|
+
ref: R,
|
|
442
|
+
id: M.id,
|
|
443
|
+
type: "button",
|
|
444
|
+
"aria-haspopup": "dialog",
|
|
445
|
+
"aria-expanded": z,
|
|
446
|
+
"aria-controls": z ? P : void 0,
|
|
447
|
+
"aria-invalid": M["aria-invalid"],
|
|
448
|
+
"aria-describedby": M["aria-describedby"],
|
|
449
|
+
"aria-required": M.required || void 0,
|
|
450
|
+
disabled: M.disabled,
|
|
451
|
+
className: h(K.trigger, !oe && K.placeholder),
|
|
452
|
+
onClick: (e) => {
|
|
453
|
+
D?.(e), !e.defaultPrevented && (z ? ie(!1) : W());
|
|
454
|
+
},
|
|
455
|
+
onKeyDown: (e) => {
|
|
456
|
+
O?.(e), !e.defaultPrevented && !z && e.key === "ArrowDown" && (e.preventDefault(), W());
|
|
457
|
+
},
|
|
458
|
+
children: /* @__PURE__ */ f("span", {
|
|
459
|
+
className: K.value,
|
|
460
|
+
children: g ?? _
|
|
461
|
+
})
|
|
462
|
+
}),
|
|
463
|
+
G ? /* @__PURE__ */ f("button", {
|
|
464
|
+
type: "button",
|
|
465
|
+
className: K.clear,
|
|
466
|
+
"aria-label": S,
|
|
467
|
+
onClick: () => {
|
|
468
|
+
x(), I.current?.focus({ preventScroll: !0 });
|
|
469
|
+
},
|
|
470
|
+
children: /* @__PURE__ */ f("svg", {
|
|
471
|
+
viewBox: "0 0 20 20",
|
|
472
|
+
fill: "none",
|
|
473
|
+
stroke: "currentColor",
|
|
474
|
+
strokeWidth: "2",
|
|
475
|
+
strokeLinecap: "round",
|
|
476
|
+
"aria-hidden": "true",
|
|
477
|
+
focusable: "false",
|
|
478
|
+
children: /* @__PURE__ */ f("path", { d: "M6 6l8 8M14 6l-8 8" })
|
|
479
|
+
})
|
|
480
|
+
}) : null,
|
|
481
|
+
/* @__PURE__ */ f("svg", {
|
|
482
|
+
className: K.icon,
|
|
483
|
+
viewBox: "0 0 24 24",
|
|
484
|
+
fill: "none",
|
|
485
|
+
stroke: "currentColor",
|
|
486
|
+
strokeWidth: "1.8",
|
|
487
|
+
strokeLinecap: "round",
|
|
488
|
+
strokeLinejoin: "round",
|
|
489
|
+
"aria-hidden": "true",
|
|
490
|
+
focusable: "false",
|
|
491
|
+
children: T === "clock" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("circle", {
|
|
492
|
+
cx: "12",
|
|
493
|
+
cy: "12",
|
|
494
|
+
r: "8"
|
|
495
|
+
}), /* @__PURE__ */ f("path", { d: "M12 7v5l3 2" })] }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("rect", {
|
|
496
|
+
x: "4",
|
|
497
|
+
y: "5",
|
|
498
|
+
width: "16",
|
|
499
|
+
height: "15",
|
|
500
|
+
rx: "2"
|
|
501
|
+
}), /* @__PURE__ */ f("path", { d: "M4 10h16M9 3v4M15 3v4" })] })
|
|
502
|
+
}),
|
|
503
|
+
v ? /* @__PURE__ */ f("input", {
|
|
504
|
+
type: "hidden",
|
|
505
|
+
name: v,
|
|
506
|
+
value: y
|
|
507
|
+
}) : null,
|
|
508
|
+
z && V ? m(/* @__PURE__ */ f("div", {
|
|
509
|
+
ref: L,
|
|
510
|
+
id: P,
|
|
511
|
+
role: "dialog",
|
|
512
|
+
"aria-label": C,
|
|
513
|
+
className: K.panel,
|
|
514
|
+
style: V,
|
|
515
|
+
"data-theme": ee,
|
|
516
|
+
onKeyDown: ae,
|
|
517
|
+
children: k({ close: ie })
|
|
518
|
+
}), document.body) : null
|
|
519
|
+
]
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
function fe({ label: e, helperText: t, error: n, required: r, disabled: i, id: a, children: o }) {
|
|
523
|
+
return D() ? !e && !t && !n ? /* @__PURE__ */ f(d, { children: o }) : /* @__PURE__ */ f(F, {
|
|
524
|
+
id: a,
|
|
525
|
+
label: e,
|
|
526
|
+
helperText: t,
|
|
527
|
+
error: n,
|
|
528
|
+
required: r,
|
|
529
|
+
disabled: i,
|
|
530
|
+
children: o
|
|
531
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
532
|
+
}
|
|
533
|
+
var pe = q, me = n(function({ label: e, helperText: t, error: n, required: r, disabled: i, id: a, value: o, defaultValue: c, onChange: u, min: d, max: p, disablePast: m, disableFuture: h, disabledDates: g, disabledRanges: _, disabledDaysOfWeek: v, isDateDisabled: y, placeholder: b = "Select a date", name: x, clearable: S = !0, weekStartsOn: C = 0, locale: w, ...T }, E) {
|
|
534
|
+
let D = o !== void 0, [O, k] = l(c ?? ""), A = R(D ? o : O), j = U({
|
|
535
|
+
min: d,
|
|
536
|
+
max: p,
|
|
537
|
+
disablePast: m,
|
|
538
|
+
disableFuture: h,
|
|
539
|
+
disabledDates: g,
|
|
540
|
+
disabledRanges: _,
|
|
541
|
+
disabledDaysOfWeek: v,
|
|
542
|
+
isDateDisabled: y
|
|
543
|
+
}), M = s(() => new Intl.DateTimeFormat(w, {
|
|
544
|
+
day: "2-digit",
|
|
545
|
+
month: "short",
|
|
546
|
+
year: "numeric"
|
|
547
|
+
}), [w]), N = (e) => {
|
|
548
|
+
D || k(e), u?.(e);
|
|
549
|
+
};
|
|
550
|
+
return /* @__PURE__ */ f(fe, {
|
|
551
|
+
label: e,
|
|
552
|
+
helperText: t,
|
|
553
|
+
error: n,
|
|
554
|
+
required: r,
|
|
555
|
+
disabled: i,
|
|
556
|
+
id: a,
|
|
557
|
+
children: /* @__PURE__ */ f(pe, {
|
|
558
|
+
...T,
|
|
559
|
+
ref: E,
|
|
560
|
+
id: a,
|
|
561
|
+
required: r,
|
|
562
|
+
disabled: i,
|
|
563
|
+
error: n,
|
|
564
|
+
name: x,
|
|
565
|
+
hiddenValue: A ? L(A) : "",
|
|
566
|
+
displayText: A ? M.format(A) : null,
|
|
567
|
+
placeholder: b,
|
|
568
|
+
clearable: S,
|
|
569
|
+
clearLabel: "Clear date",
|
|
570
|
+
onClear: () => N(""),
|
|
571
|
+
panelLabel: "Choose date",
|
|
572
|
+
children: ({ close: e }) => /* @__PURE__ */ f(ce, {
|
|
573
|
+
selected: A,
|
|
574
|
+
isDisabled: j,
|
|
575
|
+
weekStartsOn: C,
|
|
576
|
+
locale: w,
|
|
577
|
+
allowClear: S,
|
|
578
|
+
onSelect: (t) => {
|
|
579
|
+
N(t ? L(t) : ""), e();
|
|
580
|
+
}
|
|
581
|
+
})
|
|
582
|
+
})
|
|
583
|
+
});
|
|
584
|
+
}), he = {
|
|
585
|
+
root: "cui-TimeColumns-module__root--Cvrka",
|
|
586
|
+
column: "cui-TimeColumns-module__column--pbegA",
|
|
587
|
+
list: "cui-TimeColumns-module__list--7VPVy",
|
|
588
|
+
option: "cui-TimeColumns-module__option--cz6mr",
|
|
589
|
+
selected: "cui-TimeColumns-module__selected--HDZ6k"
|
|
590
|
+
}, ge = (e) => String(e).padStart(2, "0");
|
|
591
|
+
function _e({ hours: e, minutes: t, onChange: n, minuteStep: r, use12Hours: i, isTimeDisabled: a }) {
|
|
592
|
+
let o = e ?? 0, s = t ?? 0, c = o >= 12, l = Array.from({ length: Math.ceil(60 / r) }, (e, t) => t * r).filter((e) => e < 60);
|
|
593
|
+
t !== null && !l.includes(t) && l.push(t), l.sort((e, t) => e - t);
|
|
594
|
+
let u = (e) => l.every((t) => a(e, t)), d = i ? Array.from({ length: 12 }, (e, t) => {
|
|
595
|
+
let n = t + (c ? 12 : 0);
|
|
596
|
+
return {
|
|
597
|
+
value: n,
|
|
598
|
+
label: String(t === 0 ? 12 : t),
|
|
599
|
+
disabled: u(n)
|
|
600
|
+
};
|
|
601
|
+
}) : Array.from({ length: 24 }, (e, t) => ({
|
|
602
|
+
value: t,
|
|
603
|
+
label: ge(t),
|
|
604
|
+
disabled: u(t)
|
|
605
|
+
})), m = l.map((e) => ({
|
|
606
|
+
value: e,
|
|
607
|
+
label: ge(e),
|
|
608
|
+
disabled: a(o, e)
|
|
609
|
+
})), h = (e) => Array.from({ length: 12 }, (t, n) => e + n).every(u), g = [{
|
|
610
|
+
value: 0,
|
|
611
|
+
label: "AM",
|
|
612
|
+
disabled: h(0)
|
|
613
|
+
}, {
|
|
614
|
+
value: 12,
|
|
615
|
+
label: "PM",
|
|
616
|
+
disabled: h(12)
|
|
617
|
+
}];
|
|
618
|
+
return /* @__PURE__ */ p("div", {
|
|
619
|
+
className: he.root,
|
|
620
|
+
children: [
|
|
621
|
+
/* @__PURE__ */ f(ve, {
|
|
622
|
+
label: "Hours",
|
|
623
|
+
options: d,
|
|
624
|
+
selected: e,
|
|
625
|
+
onSelect: (e) => n(e, s)
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ f(ve, {
|
|
628
|
+
label: "Minutes",
|
|
629
|
+
options: m,
|
|
630
|
+
selected: t,
|
|
631
|
+
onSelect: (e) => n(o, e)
|
|
632
|
+
}),
|
|
633
|
+
i ? /* @__PURE__ */ f(ve, {
|
|
634
|
+
label: "AM or PM",
|
|
635
|
+
options: g,
|
|
636
|
+
selected: e === null ? null : c ? 12 : 0,
|
|
637
|
+
onSelect: (e) => n(o % 12 + e, s)
|
|
638
|
+
}) : null
|
|
639
|
+
]
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
function ve({ label: e, options: t, selected: n, onSelect: r }) {
|
|
643
|
+
let i = c(null), o = t.findIndex((e) => e.value === n);
|
|
644
|
+
return a(() => {
|
|
645
|
+
let e = i.current, t = e?.querySelector("[aria-selected=\"true\"]");
|
|
646
|
+
e && t && (e.scrollTop = Math.max(0, t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2));
|
|
647
|
+
}, [n]), /* @__PURE__ */ f("div", {
|
|
648
|
+
className: he.column,
|
|
649
|
+
children: /* @__PURE__ */ f("div", {
|
|
650
|
+
ref: i,
|
|
651
|
+
role: "listbox",
|
|
652
|
+
"aria-label": e,
|
|
653
|
+
className: he.list,
|
|
654
|
+
onKeyDown: (e) => {
|
|
655
|
+
let t = Array.from(i.current?.querySelectorAll("[role=\"option\"]") ?? []), n = t.indexOf(document.activeElement), r = -1;
|
|
656
|
+
e.key === "ArrowDown" ? r = Math.min(n + 1, t.length - 1) : e.key === "ArrowUp" ? r = Math.max(n - 1, 0) : e.key === "Home" ? r = 0 : e.key === "End" && (r = t.length - 1), !(r < 0) && (e.preventDefault(), t[r]?.focus({ preventScroll: !1 }));
|
|
657
|
+
},
|
|
658
|
+
children: t.map((e, t) => {
|
|
659
|
+
let i = e.value === n;
|
|
660
|
+
return /* @__PURE__ */ f("button", {
|
|
661
|
+
type: "button",
|
|
662
|
+
role: "option",
|
|
663
|
+
"aria-selected": i,
|
|
664
|
+
"aria-disabled": e.disabled || void 0,
|
|
665
|
+
tabIndex: i || o === -1 && t === 0 ? 0 : -1,
|
|
666
|
+
className: h(he.option, i && he.selected),
|
|
667
|
+
onClick: () => {
|
|
668
|
+
e.disabled || r(e.value);
|
|
669
|
+
},
|
|
670
|
+
children: e.label
|
|
671
|
+
}, e.value);
|
|
672
|
+
})
|
|
673
|
+
})
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
var ye = {
|
|
677
|
+
timeHeading: "cui-DateTimePicker-module__timeHeading--Wk-z9",
|
|
678
|
+
footer: "cui-DateTimePicker-module__footer---mP1S",
|
|
679
|
+
footerActions: "cui-DateTimePicker-module__footerActions--Io2QZ",
|
|
680
|
+
footerButton: "cui-DateTimePicker-module__footerButton--gUs4k",
|
|
681
|
+
done: "cui-DateTimePicker-module__done--XjGrY"
|
|
682
|
+
};
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/components/DateTimePicker/DateTimePicker.tsx
|
|
685
|
+
function be(e, t) {
|
|
686
|
+
if (!e) return null;
|
|
687
|
+
let n = ae(e);
|
|
688
|
+
if (n) return n;
|
|
689
|
+
let r = R(e);
|
|
690
|
+
return r ? oe(r, t ? 23 : 0, t ? 59 : 0) : null;
|
|
691
|
+
}
|
|
692
|
+
var xe = (e) => {
|
|
693
|
+
let t = /^(\d{2}):(\d{2})$/.exec(e), n = t ? Number(t[1]) : 0, r = t ? Number(t[2]) : 0;
|
|
694
|
+
return n > 23 || r > 59 ? [0, 0] : [n, r];
|
|
695
|
+
}, Se = n(function({ label: e, helperText: t, error: n, required: r, disabled: i, id: a, value: o, defaultValue: c, onChange: u, min: d, max: m, disablePast: h, disableFuture: g, disabledDates: _, disabledRanges: v, disabledDaysOfWeek: y, isDateDisabled: b, minuteStep: x = 5, use12Hours: S = !1, defaultTime: C = "00:00", placeholder: w = "Select date and time", name: T, clearable: E = !0, weekStartsOn: D = 0, locale: O, ...k }, A) {
|
|
696
|
+
let j = o !== void 0, [M, N] = l(c ?? ""), P = ae(j ? o : M), F = /* @__PURE__ */ new Date(), I = [be(d, !1), h ? F : null].filter((e) => e !== null).sort((e, t) => t.getTime() - e.getTime())[0], R = [be(m, !0), g ? F : null].filter((e) => e !== null).sort((e, t) => e.getTime() - t.getTime())[0], V = U({
|
|
697
|
+
min: I ? L(I) : void 0,
|
|
698
|
+
max: R ? L(R) : void 0,
|
|
699
|
+
disabledDates: _,
|
|
700
|
+
disabledRanges: v,
|
|
701
|
+
disabledDaysOfWeek: y,
|
|
702
|
+
isDateDisabled: b
|
|
703
|
+
}), H = (e) => V(e) || I !== void 0 && e < oe(I, I.getHours(), I.getMinutes()) || R !== void 0 && e > oe(R, R.getHours(), R.getMinutes()), ee = s(() => new Intl.DateTimeFormat(O, {
|
|
704
|
+
day: "2-digit",
|
|
705
|
+
month: "short",
|
|
706
|
+
year: "numeric",
|
|
707
|
+
hour: "2-digit",
|
|
708
|
+
minute: "2-digit",
|
|
709
|
+
hour12: S
|
|
710
|
+
}), [O, S]), W = (e) => {
|
|
711
|
+
let t = e ? ie(e) : "";
|
|
712
|
+
j || N(t), u?.(t);
|
|
713
|
+
}, ne = (e, t, n) => {
|
|
714
|
+
let r = oe(e, t, n);
|
|
715
|
+
if (!H(r)) return r;
|
|
716
|
+
for (let t = 0; t < 1440; t += x) {
|
|
717
|
+
let n = oe(e, Math.floor(t / 60), t % 60);
|
|
718
|
+
if (!H(n)) return n;
|
|
719
|
+
}
|
|
720
|
+
return r;
|
|
721
|
+
}, re = () => P ?? te(z(), V), [G, se] = xe(C), K = /* @__PURE__ */ new Date();
|
|
722
|
+
return /* @__PURE__ */ f(fe, {
|
|
723
|
+
label: e,
|
|
724
|
+
helperText: t,
|
|
725
|
+
error: n,
|
|
726
|
+
required: r,
|
|
727
|
+
disabled: i,
|
|
728
|
+
id: a,
|
|
729
|
+
children: /* @__PURE__ */ f(pe, {
|
|
730
|
+
...k,
|
|
731
|
+
ref: A,
|
|
732
|
+
id: a,
|
|
733
|
+
required: r,
|
|
734
|
+
disabled: i,
|
|
735
|
+
error: n,
|
|
736
|
+
name: T,
|
|
737
|
+
hiddenValue: P ? ie(P) : "",
|
|
738
|
+
displayText: P ? ee.format(P) : null,
|
|
739
|
+
placeholder: w,
|
|
740
|
+
clearable: E,
|
|
741
|
+
clearLabel: "Clear date and time",
|
|
742
|
+
onClear: () => W(null),
|
|
743
|
+
panelLabel: "Choose date and time",
|
|
744
|
+
panelWidth: S ? 340 : 320,
|
|
745
|
+
icon: "clock",
|
|
746
|
+
children: ({ close: e }) => /* @__PURE__ */ p("div", { children: [
|
|
747
|
+
/* @__PURE__ */ f(ce, {
|
|
748
|
+
selected: P,
|
|
749
|
+
isDisabled: V,
|
|
750
|
+
weekStartsOn: D,
|
|
751
|
+
locale: O,
|
|
752
|
+
allowClear: E,
|
|
753
|
+
showFooter: !1,
|
|
754
|
+
onSelect: (e) => {
|
|
755
|
+
e && W(ne(e, P?.getHours() ?? G, P?.getMinutes() ?? se));
|
|
756
|
+
}
|
|
757
|
+
}),
|
|
758
|
+
/* @__PURE__ */ f("div", {
|
|
759
|
+
className: ye.timeHeading,
|
|
760
|
+
children: "Time"
|
|
761
|
+
}),
|
|
762
|
+
/* @__PURE__ */ f(_e, {
|
|
763
|
+
hours: P ? P.getHours() : null,
|
|
764
|
+
minutes: P ? P.getMinutes() : null,
|
|
765
|
+
minuteStep: x,
|
|
766
|
+
use12Hours: S,
|
|
767
|
+
isTimeDisabled: (e, t) => H(oe(re(), e, t)),
|
|
768
|
+
onChange: (e, t) => W(oe(re(), e, t))
|
|
769
|
+
}),
|
|
770
|
+
/* @__PURE__ */ p("div", {
|
|
771
|
+
className: ye.footer,
|
|
772
|
+
children: [E ? /* @__PURE__ */ f("button", {
|
|
773
|
+
type: "button",
|
|
774
|
+
className: ye.footerButton,
|
|
775
|
+
onClick: () => {
|
|
776
|
+
W(null);
|
|
777
|
+
},
|
|
778
|
+
children: "Clear"
|
|
779
|
+
}) : /* @__PURE__ */ f("span", {}), /* @__PURE__ */ p("span", {
|
|
780
|
+
className: ye.footerActions,
|
|
781
|
+
children: [/* @__PURE__ */ f("button", {
|
|
782
|
+
type: "button",
|
|
783
|
+
className: ye.footerButton,
|
|
784
|
+
disabled: H(K),
|
|
785
|
+
onClick: () => W(oe(B(K, 0), K.getHours(), K.getMinutes())),
|
|
786
|
+
children: "Now"
|
|
787
|
+
}), /* @__PURE__ */ f("button", {
|
|
788
|
+
type: "button",
|
|
789
|
+
className: `${ye.footerButton} ${ye.done}`,
|
|
790
|
+
onClick: () => e(),
|
|
791
|
+
children: "Done"
|
|
792
|
+
})]
|
|
793
|
+
})]
|
|
794
|
+
})
|
|
795
|
+
] })
|
|
796
|
+
})
|
|
797
|
+
});
|
|
798
|
+
}), Ce = (e) => /* @__PURE__ */ f("svg", {
|
|
799
|
+
viewBox: "0 0 20 20",
|
|
800
|
+
fill: "none",
|
|
801
|
+
stroke: "currentColor",
|
|
802
|
+
strokeWidth: "2",
|
|
803
|
+
strokeLinecap: "round",
|
|
804
|
+
strokeLinejoin: "round",
|
|
805
|
+
"aria-hidden": "true",
|
|
806
|
+
focusable: "false",
|
|
807
|
+
children: /* @__PURE__ */ f("path", { d: e === "left" ? "M12 5l-5 5 5 5" : "M8 5l5 5-5 5" })
|
|
808
|
+
}), we = (e, t) => new Date(e, t, 1, 12);
|
|
809
|
+
function Te({ selected: e, isDisabled: t, locale: n, onSelect: r, allowClear: i }) {
|
|
810
|
+
let o = z(), [u, d] = l(() => we((e ?? o).getFullYear(), (e ?? o).getMonth())), [m, g] = l("months"), _ = c(null), v = c(!0), y = u.getFullYear(), b = Math.floor((y - 1) / 12) * 12 + 1, x = s(() => Array.from({ length: 12 }, (e, t) => new Intl.DateTimeFormat(n, { month: "short" }).format(new Date(2024, t, 1))), [n]), S = s(() => new Intl.DateTimeFormat(n, {
|
|
811
|
+
month: "long",
|
|
812
|
+
year: "numeric"
|
|
813
|
+
}), [n]), C = W(u);
|
|
814
|
+
a(() => {
|
|
815
|
+
m === "months" && v.current && _.current?.querySelector(`[data-month="${C}"]`)?.focus({ preventScroll: !0 });
|
|
816
|
+
}, [C, m]);
|
|
817
|
+
let w = (e) => {
|
|
818
|
+
let t = {
|
|
819
|
+
ArrowLeft: -1,
|
|
820
|
+
ArrowRight: 1,
|
|
821
|
+
ArrowUp: -3,
|
|
822
|
+
ArrowDown: 3,
|
|
823
|
+
PageUp: -12,
|
|
824
|
+
PageDown: 12
|
|
825
|
+
}[e.key];
|
|
826
|
+
t !== void 0 && (e.preventDefault(), v.current = !0, d((e) => V(e, t)));
|
|
827
|
+
}, T = (e) => {
|
|
828
|
+
v.current = !1, d((t) => V(t, e * (m === "years" ? 144 : 12)));
|
|
829
|
+
};
|
|
830
|
+
return /* @__PURE__ */ p("div", {
|
|
831
|
+
className: G.root,
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ p("div", {
|
|
834
|
+
className: G.header,
|
|
835
|
+
children: [
|
|
836
|
+
/* @__PURE__ */ f("button", {
|
|
837
|
+
type: "button",
|
|
838
|
+
className: G.nav,
|
|
839
|
+
"aria-label": m === "years" ? "Previous 12 years" : "Previous year",
|
|
840
|
+
onClick: () => T(-1),
|
|
841
|
+
children: Ce("left")
|
|
842
|
+
}),
|
|
843
|
+
/* @__PURE__ */ f("div", {
|
|
844
|
+
className: G.title,
|
|
845
|
+
"aria-live": "polite",
|
|
846
|
+
children: m === "years" ? /* @__PURE__ */ p("span", { children: [
|
|
847
|
+
b,
|
|
848
|
+
" - ",
|
|
849
|
+
b + 11
|
|
850
|
+
] }) : /* @__PURE__ */ f("button", {
|
|
851
|
+
type: "button",
|
|
852
|
+
className: G.titleButton,
|
|
853
|
+
"aria-label": "Choose year",
|
|
854
|
+
onClick: () => g("years"),
|
|
855
|
+
children: y
|
|
856
|
+
})
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ f("button", {
|
|
859
|
+
type: "button",
|
|
860
|
+
className: G.nav,
|
|
861
|
+
"aria-label": m === "years" ? "Next 12 years" : "Next year",
|
|
862
|
+
onClick: () => T(1),
|
|
863
|
+
children: Ce("right")
|
|
864
|
+
})
|
|
865
|
+
]
|
|
866
|
+
}),
|
|
867
|
+
m === "months" ? /* @__PURE__ */ f("div", {
|
|
868
|
+
ref: _,
|
|
869
|
+
className: G.cells,
|
|
870
|
+
role: "group",
|
|
871
|
+
"aria-label": `Months of ${y}`,
|
|
872
|
+
onKeyDown: w,
|
|
873
|
+
children: x.map((n, i) => {
|
|
874
|
+
let a = we(y, i), s = W(a), c = e !== null && W(e) === s;
|
|
875
|
+
return /* @__PURE__ */ f("button", {
|
|
876
|
+
type: "button",
|
|
877
|
+
"data-month": s,
|
|
878
|
+
tabIndex: i === u.getMonth() ? 0 : -1,
|
|
879
|
+
"aria-label": S.format(a),
|
|
880
|
+
"aria-pressed": c,
|
|
881
|
+
"aria-current": W(o) === s ? "date" : void 0,
|
|
882
|
+
"aria-disabled": t(a) || void 0,
|
|
883
|
+
className: h(G.cell, c && G.active, W(o) === s && !c && G.currentCell),
|
|
884
|
+
onClick: () => {
|
|
885
|
+
t(a) || r(a);
|
|
886
|
+
},
|
|
887
|
+
children: n
|
|
888
|
+
}, s);
|
|
889
|
+
})
|
|
890
|
+
}) : /* @__PURE__ */ f("div", {
|
|
891
|
+
className: G.cells,
|
|
892
|
+
children: Array.from({ length: 12 }, (e, t) => b + t).map((e) => /* @__PURE__ */ f("button", {
|
|
893
|
+
type: "button",
|
|
894
|
+
className: h(G.cell, e === y && G.active),
|
|
895
|
+
onClick: () => {
|
|
896
|
+
v.current = !0, d((t) => V(t, (e - t.getFullYear()) * 12)), g("months");
|
|
897
|
+
},
|
|
898
|
+
children: e
|
|
899
|
+
}, e))
|
|
900
|
+
}),
|
|
901
|
+
/* @__PURE__ */ p("div", {
|
|
902
|
+
className: G.footer,
|
|
903
|
+
children: [i ? /* @__PURE__ */ f("button", {
|
|
904
|
+
type: "button",
|
|
905
|
+
className: G.footerButton,
|
|
906
|
+
onClick: () => r(null),
|
|
907
|
+
children: "Clear"
|
|
908
|
+
}) : /* @__PURE__ */ f("span", {}), /* @__PURE__ */ f("button", {
|
|
909
|
+
type: "button",
|
|
910
|
+
className: h(G.footerButton, G.footerPrimary),
|
|
911
|
+
disabled: t(we(o.getFullYear(), o.getMonth())),
|
|
912
|
+
onClick: () => r(ne(W(o))),
|
|
913
|
+
children: "This month"
|
|
914
|
+
})]
|
|
915
|
+
})
|
|
916
|
+
]
|
|
917
|
+
});
|
|
147
918
|
}
|
|
148
|
-
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/components/MonthPicker/MonthPicker.tsx
|
|
921
|
+
var Ee = n(function({ label: e, helperText: t, error: n, required: r, disabled: i, id: a, value: o, defaultValue: c, onChange: u, min: d, max: p, disablePast: m, disableFuture: h, disabledMonths: g, isMonthDisabled: _, placeholder: v = "Select a month", name: y, clearable: b = !0, locale: x, ...S }, C) {
|
|
922
|
+
let w = o !== void 0, [T, E] = l(c ?? ""), D = ne(w ? o : T), O = re({
|
|
923
|
+
min: d,
|
|
924
|
+
max: p,
|
|
925
|
+
disablePast: m,
|
|
926
|
+
disableFuture: h,
|
|
927
|
+
disabledMonths: g,
|
|
928
|
+
isMonthDisabled: _
|
|
929
|
+
}), k = s(() => new Intl.DateTimeFormat(x, {
|
|
930
|
+
month: "long",
|
|
931
|
+
year: "numeric"
|
|
932
|
+
}), [x]), A = (e) => {
|
|
933
|
+
w || E(e), u?.(e);
|
|
934
|
+
};
|
|
935
|
+
return /* @__PURE__ */ f(fe, {
|
|
936
|
+
label: e,
|
|
937
|
+
helperText: t,
|
|
938
|
+
error: n,
|
|
939
|
+
required: r,
|
|
940
|
+
disabled: i,
|
|
941
|
+
id: a,
|
|
942
|
+
children: /* @__PURE__ */ f(pe, {
|
|
943
|
+
...S,
|
|
944
|
+
ref: C,
|
|
945
|
+
id: a,
|
|
946
|
+
required: r,
|
|
947
|
+
disabled: i,
|
|
948
|
+
error: n,
|
|
949
|
+
name: y,
|
|
950
|
+
hiddenValue: D ? W(D) : "",
|
|
951
|
+
displayText: D ? k.format(D) : null,
|
|
952
|
+
placeholder: v,
|
|
953
|
+
clearable: b,
|
|
954
|
+
clearLabel: "Clear month",
|
|
955
|
+
onClear: () => A(""),
|
|
956
|
+
panelLabel: "Choose month",
|
|
957
|
+
children: ({ close: e }) => /* @__PURE__ */ f(Te, {
|
|
958
|
+
selected: D,
|
|
959
|
+
isDisabled: O,
|
|
960
|
+
locale: x,
|
|
961
|
+
allowClear: b,
|
|
962
|
+
onSelect: (t) => {
|
|
963
|
+
A(t ? W(t) : ""), e();
|
|
964
|
+
}
|
|
965
|
+
})
|
|
966
|
+
})
|
|
967
|
+
});
|
|
968
|
+
}), De = [
|
|
969
|
+
"date",
|
|
970
|
+
"datetime-local",
|
|
971
|
+
"month"
|
|
972
|
+
], Oe = (e) => De.includes(e), ke = n(function({ type: e, label: t, helperText: n, error: i, required: a, disabled: o, id: s, name: u, size: m, value: h, defaultValue: g, onChange: _, min: v, max: y, placeholder: b, className: x, dateOptions: S = {} }, C) {
|
|
973
|
+
let w = c(null), T = r((e) => {
|
|
974
|
+
w.current = e, typeof C == "function" ? C(e) : C && (C.current = e);
|
|
975
|
+
}, [C]), E = h !== void 0, [D, O] = l(String(g ?? "")), k = E ? String(h) : D, A = {
|
|
976
|
+
id: s,
|
|
977
|
+
label: t,
|
|
978
|
+
helperText: n,
|
|
979
|
+
error: i,
|
|
980
|
+
required: a,
|
|
981
|
+
disabled: o,
|
|
982
|
+
size: m,
|
|
983
|
+
placeholder: b,
|
|
984
|
+
className: x,
|
|
985
|
+
value: k,
|
|
986
|
+
onChange: (e) => {
|
|
987
|
+
let t = w.current;
|
|
988
|
+
t && (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
989
|
+
},
|
|
990
|
+
min: v === void 0 ? void 0 : String(v),
|
|
991
|
+
max: y === void 0 ? void 0 : String(y),
|
|
992
|
+
locale: S.locale,
|
|
993
|
+
clearable: S.clearable,
|
|
994
|
+
disablePast: S.disablePast,
|
|
995
|
+
disableFuture: S.disableFuture
|
|
996
|
+
};
|
|
997
|
+
return /* @__PURE__ */ p(d, { children: [e === "month" ? /* @__PURE__ */ f(Ee, {
|
|
998
|
+
...A,
|
|
999
|
+
disabledMonths: S.disabledMonths,
|
|
1000
|
+
isMonthDisabled: S.isMonthDisabled
|
|
1001
|
+
}) : e === "datetime-local" ? /* @__PURE__ */ f(Se, {
|
|
1002
|
+
...A,
|
|
1003
|
+
disabledDates: S.disabledDates,
|
|
1004
|
+
disabledRanges: S.disabledRanges,
|
|
1005
|
+
disabledDaysOfWeek: S.disabledDaysOfWeek,
|
|
1006
|
+
isDateDisabled: S.isDateDisabled,
|
|
1007
|
+
weekStartsOn: S.weekStartsOn,
|
|
1008
|
+
minuteStep: S.minuteStep,
|
|
1009
|
+
use12Hours: S.use12Hours,
|
|
1010
|
+
defaultTime: S.defaultTime
|
|
1011
|
+
}) : /* @__PURE__ */ f(me, {
|
|
1012
|
+
...A,
|
|
1013
|
+
disabledDates: S.disabledDates,
|
|
1014
|
+
disabledRanges: S.disabledRanges,
|
|
1015
|
+
disabledDaysOfWeek: S.disabledDaysOfWeek,
|
|
1016
|
+
isDateDisabled: S.isDateDisabled,
|
|
1017
|
+
weekStartsOn: S.weekStartsOn
|
|
1018
|
+
}), /* @__PURE__ */ f("input", {
|
|
1019
|
+
ref: T,
|
|
1020
|
+
hidden: !0,
|
|
1021
|
+
readOnly: !0,
|
|
1022
|
+
tabIndex: -1,
|
|
1023
|
+
type: "text",
|
|
1024
|
+
name: u,
|
|
1025
|
+
value: k,
|
|
1026
|
+
onChange: (e) => {
|
|
1027
|
+
E || O(e.target.value), _?.(e);
|
|
1028
|
+
}
|
|
1029
|
+
})] });
|
|
1030
|
+
}), Ae = {
|
|
149
1031
|
control: "cui-Input-module__control--e3jPo",
|
|
150
1032
|
disabled: "cui-Input-module__disabled--nzcnQ",
|
|
151
1033
|
invalid: "cui-Input-module__invalid--VyrnA",
|
|
@@ -155,8 +1037,8 @@ var N = {
|
|
|
155
1037
|
input: "cui-Input-module__input--WjT81",
|
|
156
1038
|
affix: "cui-Input-module__affix--zz0Xe",
|
|
157
1039
|
readOnly: "cui-Input-module__readOnly--0ag-W"
|
|
158
|
-
},
|
|
159
|
-
let m =
|
|
1040
|
+
}, je = n(function({ id: e, required: t, disabled: n, error: r, "aria-describedby": i, prefix: a, suffix: o, size: s = "md", readOnly: c, className: l, ...u }, d) {
|
|
1041
|
+
let m = N({
|
|
160
1042
|
id: e,
|
|
161
1043
|
required: t,
|
|
162
1044
|
disabled: n,
|
|
@@ -164,10 +1046,10 @@ var N = {
|
|
|
164
1046
|
"aria-describedby": i
|
|
165
1047
|
});
|
|
166
1048
|
return /* @__PURE__ */ p("div", {
|
|
167
|
-
className: h(
|
|
1049
|
+
className: h(Ae.control, Ae[s], m.invalid && Ae.invalid, m.disabled && Ae.disabled, c && Ae.readOnly, l),
|
|
168
1050
|
children: [
|
|
169
1051
|
a ? /* @__PURE__ */ f("span", {
|
|
170
|
-
className:
|
|
1052
|
+
className: Ae.affix,
|
|
171
1053
|
children: a
|
|
172
1054
|
}) : null,
|
|
173
1055
|
/* @__PURE__ */ f("input", {
|
|
@@ -179,207 +1061,601 @@ var N = {
|
|
|
179
1061
|
readOnly: c,
|
|
180
1062
|
"aria-invalid": m["aria-invalid"],
|
|
181
1063
|
"aria-describedby": m["aria-describedby"],
|
|
182
|
-
className:
|
|
1064
|
+
className: Ae.input
|
|
183
1065
|
}),
|
|
184
1066
|
o ? /* @__PURE__ */ f("span", {
|
|
185
|
-
className:
|
|
1067
|
+
className: Ae.affix,
|
|
186
1068
|
children: o
|
|
187
1069
|
}) : null
|
|
188
1070
|
]
|
|
189
1071
|
});
|
|
190
|
-
}),
|
|
191
|
-
return
|
|
1072
|
+
}), Me = n(function({ label: e, helperText: t, ...n }, r) {
|
|
1073
|
+
return D() ? Oe(n.type) ? /* @__PURE__ */ f(ke, {
|
|
1074
|
+
label: e,
|
|
1075
|
+
helperText: t,
|
|
1076
|
+
...n,
|
|
1077
|
+
type: n.type,
|
|
1078
|
+
ref: r
|
|
1079
|
+
}) : !e && !t && !n.error ? /* @__PURE__ */ f(je, {
|
|
192
1080
|
...n,
|
|
193
1081
|
ref: r
|
|
194
|
-
}) : /* @__PURE__ */ f(
|
|
1082
|
+
}) : /* @__PURE__ */ f(F, {
|
|
195
1083
|
id: n.id,
|
|
196
1084
|
label: e,
|
|
197
1085
|
helperText: t,
|
|
198
1086
|
error: n.error,
|
|
199
1087
|
required: n.required,
|
|
200
1088
|
disabled: n.disabled,
|
|
201
|
-
children: /* @__PURE__ */ f(
|
|
1089
|
+
children: /* @__PURE__ */ f(je, {
|
|
202
1090
|
...n,
|
|
203
1091
|
ref: r
|
|
204
1092
|
})
|
|
205
|
-
}) : /* @__PURE__ */ f(
|
|
206
|
-
}),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
1093
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
1094
|
+
}), Ne = { toggle: "cui-PasswordInput-module__toggle--WNeX9" }, Pe = n(function({ showLabel: e = "Show password", hideLabel: t = "Hide password", autoComplete: n, disabled: r, ...i }, a) {
|
|
1095
|
+
let [o, s] = l(!1);
|
|
1096
|
+
return /* @__PURE__ */ f(Me, {
|
|
1097
|
+
...i,
|
|
1098
|
+
ref: a,
|
|
1099
|
+
type: o ? "text" : "password",
|
|
1100
|
+
autoComplete: n ?? "current-password",
|
|
1101
|
+
disabled: r,
|
|
1102
|
+
suffix: /* @__PURE__ */ f("button", {
|
|
1103
|
+
type: "button",
|
|
1104
|
+
className: Ne.toggle,
|
|
1105
|
+
"aria-label": o ? t : e,
|
|
1106
|
+
"aria-pressed": o,
|
|
1107
|
+
disabled: r,
|
|
1108
|
+
onClick: () => s((e) => !e),
|
|
1109
|
+
children: /* @__PURE__ */ p("svg", {
|
|
1110
|
+
viewBox: "0 0 24 24",
|
|
1111
|
+
fill: "none",
|
|
1112
|
+
stroke: "currentColor",
|
|
1113
|
+
strokeWidth: "1.8",
|
|
1114
|
+
strokeLinecap: "round",
|
|
1115
|
+
strokeLinejoin: "round",
|
|
1116
|
+
"aria-hidden": "true",
|
|
1117
|
+
focusable: "false",
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ f("path", { d: "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z" }),
|
|
1120
|
+
/* @__PURE__ */ f("circle", {
|
|
1121
|
+
cx: "12",
|
|
1122
|
+
cy: "12",
|
|
1123
|
+
r: "3"
|
|
1124
|
+
}),
|
|
1125
|
+
o ? null : /* @__PURE__ */ f("path", { d: "M4 4l16 16" })
|
|
1126
|
+
]
|
|
1127
|
+
})
|
|
1128
|
+
})
|
|
1129
|
+
});
|
|
1130
|
+
}), Fe = {
|
|
1131
|
+
search: "cui-SearchInput-module__search--XCZD4",
|
|
1132
|
+
icon: "cui-SearchInput-module__icon--I9nEG",
|
|
1133
|
+
clear: "cui-SearchInput-module__clear--r3kgN"
|
|
1134
|
+
}, Ie = n(function({ value: e, defaultValue: t, onChange: n, onClear: i, clearLabel: a = "Clear search", disabled: o, readOnly: s, ...u }, d) {
|
|
1135
|
+
let m = c(null), h = r((e) => {
|
|
1136
|
+
m.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
|
|
1137
|
+
}, [d]), g = e !== void 0, [_, v] = l(String(t ?? "")), y = g ? String(e) : _, b = y.length > 0 && !o && !s;
|
|
1138
|
+
return /* @__PURE__ */ f(Me, {
|
|
1139
|
+
...u,
|
|
1140
|
+
ref: h,
|
|
1141
|
+
type: "search",
|
|
1142
|
+
className: Fe.search,
|
|
1143
|
+
value: y,
|
|
1144
|
+
disabled: o,
|
|
1145
|
+
readOnly: s,
|
|
1146
|
+
onChange: (e) => {
|
|
1147
|
+
g || v(e.target.value), n?.(e);
|
|
1148
|
+
},
|
|
1149
|
+
prefix: /* @__PURE__ */ p("svg", {
|
|
1150
|
+
className: Fe.icon,
|
|
1151
|
+
viewBox: "0 0 24 24",
|
|
1152
|
+
fill: "none",
|
|
1153
|
+
stroke: "currentColor",
|
|
1154
|
+
strokeWidth: "1.8",
|
|
1155
|
+
strokeLinecap: "round",
|
|
1156
|
+
"aria-hidden": "true",
|
|
1157
|
+
focusable: "false",
|
|
1158
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
1159
|
+
cx: "11",
|
|
1160
|
+
cy: "11",
|
|
1161
|
+
r: "6.5"
|
|
1162
|
+
}), /* @__PURE__ */ f("path", { d: "M16 16l4.5 4.5" })]
|
|
1163
|
+
}),
|
|
1164
|
+
suffix: b ? /* @__PURE__ */ f("button", {
|
|
1165
|
+
type: "button",
|
|
1166
|
+
className: Fe.clear,
|
|
1167
|
+
"aria-label": a,
|
|
1168
|
+
onClick: () => {
|
|
1169
|
+
g || v(""), i?.(), m.current?.focus();
|
|
1170
|
+
},
|
|
1171
|
+
children: /* @__PURE__ */ f("svg", {
|
|
1172
|
+
viewBox: "0 0 20 20",
|
|
1173
|
+
fill: "none",
|
|
1174
|
+
stroke: "currentColor",
|
|
1175
|
+
strokeWidth: "2",
|
|
1176
|
+
strokeLinecap: "round",
|
|
1177
|
+
"aria-hidden": "true",
|
|
1178
|
+
focusable: "false",
|
|
1179
|
+
children: /* @__PURE__ */ f("path", { d: "M6 6l8 8M14 6l-8 8" })
|
|
1180
|
+
})
|
|
1181
|
+
}) : void 0
|
|
1182
|
+
});
|
|
1183
|
+
}), Le = "(prefers-color-scheme: dark)";
|
|
1184
|
+
function Re() {
|
|
1185
|
+
return u((e) => {
|
|
1186
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
1187
|
+
let t = window.matchMedia(Le);
|
|
1188
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
1189
|
+
}, () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(Le).matches, () => !1);
|
|
1190
|
+
}
|
|
1191
|
+
var ze = /* @__PURE__ */ new Set();
|
|
1192
|
+
function Be(e) {
|
|
1193
|
+
try {
|
|
1194
|
+
return window.localStorage.getItem(e);
|
|
1195
|
+
} catch {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function Ve(e, t) {
|
|
1200
|
+
try {
|
|
1201
|
+
window.localStorage.setItem(e, t);
|
|
1202
|
+
} catch {}
|
|
1203
|
+
ze.forEach((e) => e());
|
|
1204
|
+
}
|
|
1205
|
+
function He(e) {
|
|
1206
|
+
return u((e) => (ze.add(e), window.addEventListener("storage", e), () => {
|
|
1207
|
+
ze.delete(e), window.removeEventListener("storage", e);
|
|
1208
|
+
}), () => e ? Be(e) : null, () => null);
|
|
1209
|
+
}
|
|
1210
|
+
var Ue = { root: "cui-ThemeProvider-module__root--2DEGi" }, We = e(null);
|
|
1211
|
+
function Ge({ children: e, theme: t, defaultTheme: n = "light", onThemeChange: a, storageKey: o, licenseKey: c, className: u, ...d }) {
|
|
1212
|
+
let [p, m] = l(n), g = He(t === void 0 ? o : void 0), _ = Re(), v = t ?? g ?? p, y = v === "system" ? _ ? "dark" : "light" : v, b = r((e) => {
|
|
1213
|
+
t === void 0 && (m(e), o && Ve(o, e)), a?.(e);
|
|
248
1214
|
}, [
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
]),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
1215
|
+
t,
|
|
1216
|
+
a,
|
|
1217
|
+
o
|
|
1218
|
+
]), x = s(() => ({
|
|
1219
|
+
theme: v,
|
|
1220
|
+
resolvedTheme: y,
|
|
1221
|
+
setTheme: b
|
|
1222
|
+
}), [
|
|
1223
|
+
v,
|
|
1224
|
+
y,
|
|
1225
|
+
b
|
|
1226
|
+
]), C = i(S);
|
|
1227
|
+
return /* @__PURE__ */ f(We.Provider, {
|
|
1228
|
+
value: x,
|
|
1229
|
+
children: /* @__PURE__ */ f(S.Provider, {
|
|
1230
|
+
value: c ?? C,
|
|
1231
|
+
children: /* @__PURE__ */ f("div", {
|
|
1232
|
+
...d,
|
|
1233
|
+
"data-theme": y,
|
|
1234
|
+
className: h(Ue.root, u),
|
|
1235
|
+
children: e
|
|
1236
|
+
})
|
|
1237
|
+
})
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
function Ke() {
|
|
1241
|
+
let e = i(We);
|
|
1242
|
+
if (!e) throw Error("useTheme must be used within a <ThemeProvider>.");
|
|
1243
|
+
return e;
|
|
1244
|
+
}
|
|
1245
|
+
function qe() {
|
|
1246
|
+
return i(We);
|
|
1247
|
+
}
|
|
1248
|
+
var Je = {
|
|
1249
|
+
backdrop: "cui-Overlay-module__backdrop--HLwOh",
|
|
1250
|
+
"cui-overlay-fade": "cui-Overlay-module__cui-overlay-fade--coHyQ",
|
|
1251
|
+
center: "cui-Overlay-module__center--vmNyk",
|
|
1252
|
+
right: "cui-Overlay-module__right--TmGqB",
|
|
1253
|
+
left: "cui-Overlay-module__left--MRs4h",
|
|
1254
|
+
panel: "cui-Overlay-module__panel--c5Gk2",
|
|
1255
|
+
"cui-overlay-pop": "cui-Overlay-module__cui-overlay-pop--5VC2-",
|
|
1256
|
+
"cui-overlay-slide-right": "cui-Overlay-module__cui-overlay-slide-right--2aZId",
|
|
1257
|
+
"cui-overlay-slide-left": "cui-Overlay-module__cui-overlay-slide-left--0nCKr"
|
|
1258
|
+
}, Ye = "a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Xe = 0, Ze = "";
|
|
1259
|
+
function Qe() {
|
|
1260
|
+
Xe === 0 && (Ze = document.body.style.overflow, document.body.style.overflow = "hidden"), Xe += 1;
|
|
1261
|
+
}
|
|
1262
|
+
function $e() {
|
|
1263
|
+
Xe = Math.max(0, Xe - 1), Xe === 0 && (document.body.style.overflow = Ze);
|
|
1264
|
+
}
|
|
1265
|
+
function et({ open: e, onClose: t, placement: n, panelClassName: r, closeOnBackdrop: i = !0, closeOnEscape: s = !0, role: l = "dialog", "aria-label": u, children: d, className: p }) {
|
|
1266
|
+
let g = o(), _ = `${g}-title`, v = `${g}-description`, y = c(null), b = c(!1), x = qe();
|
|
1267
|
+
return a(() => {
|
|
1268
|
+
if (!e) return;
|
|
1269
|
+
let t = document.activeElement;
|
|
1270
|
+
Qe();
|
|
1271
|
+
let n = y.current;
|
|
1272
|
+
return (n?.querySelector("[data-autofocus]") ?? n)?.focus({ preventScroll: !0 }), () => {
|
|
1273
|
+
$e(), t?.focus?.({ preventScroll: !0 });
|
|
1274
|
+
};
|
|
1275
|
+
}, [e]), e ? m(/* @__PURE__ */ f("div", {
|
|
1276
|
+
className: h(Je.backdrop, Je[n]),
|
|
1277
|
+
"data-theme": x?.resolvedTheme,
|
|
1278
|
+
onMouseDown: (e) => {
|
|
1279
|
+
b.current = e.target === e.currentTarget;
|
|
1280
|
+
},
|
|
1281
|
+
onClick: (e) => {
|
|
1282
|
+
i && b.current && e.target === e.currentTarget && t(), b.current = !1;
|
|
1283
|
+
},
|
|
1284
|
+
children: /* @__PURE__ */ f("div", {
|
|
1285
|
+
ref: y,
|
|
1286
|
+
role: l,
|
|
1287
|
+
"aria-modal": "true",
|
|
1288
|
+
"aria-label": u,
|
|
1289
|
+
"aria-labelledby": u ? void 0 : _,
|
|
1290
|
+
"aria-describedby": v,
|
|
1291
|
+
tabIndex: -1,
|
|
1292
|
+
className: h(Je.panel, r, p),
|
|
1293
|
+
onKeyDown: (e) => {
|
|
1294
|
+
if (e.key === "Escape" && s) {
|
|
1295
|
+
e.preventDefault(), e.stopPropagation(), t();
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (e.key !== "Tab") return;
|
|
1299
|
+
let n = Array.from(y.current?.querySelectorAll(Ye) ?? []), r = n[0], i = n[n.length - 1];
|
|
1300
|
+
if (!r || !i) {
|
|
1301
|
+
e.preventDefault();
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
let a = document.activeElement;
|
|
1305
|
+
e.shiftKey && (a === r || a === y.current) ? (e.preventDefault(), i.focus()) : !e.shiftKey && a === i && (e.preventDefault(), r.focus());
|
|
1306
|
+
},
|
|
1307
|
+
children: d({
|
|
1308
|
+
titleId: _,
|
|
1309
|
+
descriptionId: v
|
|
1310
|
+
})
|
|
1311
|
+
})
|
|
1312
|
+
}), document.body) : null;
|
|
1313
|
+
}
|
|
1314
|
+
var tt = {
|
|
1315
|
+
header: "cui-OverlayContent-module__header--uLtSD",
|
|
1316
|
+
heading: "cui-OverlayContent-module__heading--8AaPl",
|
|
1317
|
+
title: "cui-OverlayContent-module__title--I6nN9",
|
|
1318
|
+
description: "cui-OverlayContent-module__description--fRdN6",
|
|
1319
|
+
close: "cui-OverlayContent-module__close--uCSa1",
|
|
1320
|
+
body: "cui-OverlayContent-module__body--EGPJE",
|
|
1321
|
+
footer: "cui-OverlayContent-module__footer--qJLyt"
|
|
1322
|
+
};
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region src/components/Overlay/OverlayContent.tsx
|
|
1325
|
+
function nt({ titleId: e, descriptionId: t, title: n, description: r, footer: i, hideCloseButton: a, closeLabel: o = "Close", onClose: s, children: c }) {
|
|
1326
|
+
return /* @__PURE__ */ p(d, { children: [
|
|
1327
|
+
n || r || !a ? /* @__PURE__ */ p("header", {
|
|
1328
|
+
className: tt.header,
|
|
1329
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1330
|
+
className: tt.heading,
|
|
1331
|
+
children: [n ? /* @__PURE__ */ f("h2", {
|
|
1332
|
+
id: e,
|
|
1333
|
+
className: tt.title,
|
|
1334
|
+
children: n
|
|
1335
|
+
}) : null, r ? /* @__PURE__ */ f("p", {
|
|
1336
|
+
id: t,
|
|
1337
|
+
className: tt.description,
|
|
1338
|
+
children: r
|
|
1339
|
+
}) : null]
|
|
1340
|
+
}), a ? null : /* @__PURE__ */ f("button", {
|
|
1341
|
+
type: "button",
|
|
1342
|
+
className: tt.close,
|
|
1343
|
+
"aria-label": o,
|
|
1344
|
+
onClick: s,
|
|
1345
|
+
children: /* @__PURE__ */ f("svg", {
|
|
1346
|
+
viewBox: "0 0 24 24",
|
|
1347
|
+
fill: "none",
|
|
1348
|
+
stroke: "currentColor",
|
|
1349
|
+
strokeWidth: "2.2",
|
|
1350
|
+
strokeLinecap: "round",
|
|
1351
|
+
"aria-hidden": "true",
|
|
1352
|
+
focusable: "false",
|
|
1353
|
+
children: /* @__PURE__ */ f("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
1354
|
+
})
|
|
1355
|
+
})]
|
|
1356
|
+
}) : null,
|
|
1357
|
+
/* @__PURE__ */ f("div", {
|
|
1358
|
+
className: tt.body,
|
|
1359
|
+
children: c
|
|
1360
|
+
}),
|
|
1361
|
+
i ? /* @__PURE__ */ f("footer", {
|
|
1362
|
+
className: tt.footer,
|
|
1363
|
+
children: i
|
|
1364
|
+
}) : null
|
|
1365
|
+
] });
|
|
1366
|
+
}
|
|
1367
|
+
var rt = {
|
|
1368
|
+
panel: "cui-Modal-module__panel--lp9I7",
|
|
1369
|
+
sm: "cui-Modal-module__sm--K5k3W",
|
|
1370
|
+
md: "cui-Modal-module__md--gvyR7",
|
|
1371
|
+
lg: "cui-Modal-module__lg--BgB1a",
|
|
1372
|
+
xl: "cui-Modal-module__xl--MR-68",
|
|
1373
|
+
full: "cui-Modal-module__full--z-yai",
|
|
1374
|
+
bare: "cui-Modal-module__bare--8uhGX"
|
|
1375
|
+
};
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region src/components/Modal/Modal.tsx
|
|
1378
|
+
function it({ open: e, onClose: t, title: n, description: r, children: i, footer: a, size: o = "md", closeOnBackdrop: s, closeOnEscape: c, hideCloseButton: l, bare: u = !1, role: d, "aria-label": p, className: m }) {
|
|
1379
|
+
return D() ? /* @__PURE__ */ f(et, {
|
|
1380
|
+
open: e,
|
|
1381
|
+
onClose: t,
|
|
1382
|
+
placement: "center",
|
|
1383
|
+
panelClassName: h(rt.panel, rt[o], u && rt.bare),
|
|
1384
|
+
className: m,
|
|
1385
|
+
closeOnBackdrop: s,
|
|
1386
|
+
closeOnEscape: c,
|
|
1387
|
+
role: d,
|
|
1388
|
+
"aria-label": p,
|
|
1389
|
+
children: ({ titleId: e, descriptionId: o }) => u ? typeof i == "function" ? i({
|
|
1390
|
+
titleId: e,
|
|
1391
|
+
descriptionId: o,
|
|
1392
|
+
onClose: t
|
|
1393
|
+
}) : i : /* @__PURE__ */ f(nt, {
|
|
1394
|
+
titleId: e,
|
|
1395
|
+
descriptionId: o,
|
|
1396
|
+
title: n,
|
|
1397
|
+
description: r,
|
|
1398
|
+
footer: a,
|
|
1399
|
+
hideCloseButton: l,
|
|
1400
|
+
onClose: t,
|
|
1401
|
+
children: typeof i == "function" ? null : i
|
|
1402
|
+
})
|
|
1403
|
+
}) : e ? /* @__PURE__ */ f(k, {}) : null;
|
|
1404
|
+
}
|
|
1405
|
+
var at = {
|
|
1406
|
+
panel: "cui-Drawer-module__panel--wUX0N",
|
|
1407
|
+
sm: "cui-Drawer-module__sm--AQ96e",
|
|
1408
|
+
md: "cui-Drawer-module__md---2Ihw",
|
|
1409
|
+
lg: "cui-Drawer-module__lg--gWSe1"
|
|
1410
|
+
};
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region src/components/Drawer/Drawer.tsx
|
|
1413
|
+
function ot({ open: e, onClose: t, title: n, description: r, children: i, footer: a, placement: o = "right", size: s = "md", closeOnBackdrop: c, closeOnEscape: l, hideCloseButton: u, role: d, "aria-label": p, className: m }) {
|
|
1414
|
+
return D() ? /* @__PURE__ */ f(et, {
|
|
1415
|
+
open: e,
|
|
1416
|
+
onClose: t,
|
|
1417
|
+
placement: o,
|
|
1418
|
+
panelClassName: h(at.panel, at[s]),
|
|
1419
|
+
className: m,
|
|
1420
|
+
closeOnBackdrop: c,
|
|
1421
|
+
closeOnEscape: l,
|
|
1422
|
+
role: d,
|
|
1423
|
+
"aria-label": p,
|
|
1424
|
+
children: ({ titleId: e, descriptionId: o }) => /* @__PURE__ */ f(nt, {
|
|
1425
|
+
titleId: e,
|
|
1426
|
+
descriptionId: o,
|
|
1427
|
+
title: n,
|
|
1428
|
+
description: r,
|
|
1429
|
+
footer: a,
|
|
1430
|
+
hideCloseButton: u,
|
|
1431
|
+
onClose: t,
|
|
1432
|
+
children: i
|
|
1433
|
+
})
|
|
1434
|
+
}) : e ? /* @__PURE__ */ f(k, {}) : null;
|
|
1435
|
+
}
|
|
1436
|
+
var st = { confirmText: "cui-ConfirmDialog-module__confirmText--NaqTy" };
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/components/ConfirmDialog/ConfirmDialog.tsx
|
|
1439
|
+
function ct({ open: e, onClose: t, onConfirm: n, title: r, message: i, confirmLabel: a = "Confirm", cancelLabel: o = "Cancel", tone: s = "default", loading: c = !1, requireText: u }) {
|
|
1440
|
+
let [m, h] = l(""), g = u === void 0 || m === u, _ = s === "danger";
|
|
1441
|
+
return /* @__PURE__ */ f(it, {
|
|
1442
|
+
open: e,
|
|
1443
|
+
onClose: () => {
|
|
1444
|
+
c || (h(""), t());
|
|
1445
|
+
},
|
|
1446
|
+
role: "alertdialog",
|
|
1447
|
+
size: "sm",
|
|
1448
|
+
title: r,
|
|
1449
|
+
description: i,
|
|
1450
|
+
closeOnBackdrop: !c,
|
|
1451
|
+
closeOnEscape: !c,
|
|
1452
|
+
hideCloseButton: !0,
|
|
1453
|
+
footer: /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(j, {
|
|
1454
|
+
variant: "outline",
|
|
1455
|
+
disabled: c,
|
|
1456
|
+
"data-autofocus": _ ? "" : void 0,
|
|
1457
|
+
onClick: () => {
|
|
1458
|
+
h(""), t();
|
|
1459
|
+
},
|
|
1460
|
+
children: o
|
|
1461
|
+
}), /* @__PURE__ */ f(j, {
|
|
1462
|
+
variant: _ ? "danger" : "primary",
|
|
1463
|
+
loading: c,
|
|
1464
|
+
disabled: !g,
|
|
1465
|
+
"data-autofocus": _ ? void 0 : "",
|
|
1466
|
+
onClick: n,
|
|
1467
|
+
children: a
|
|
1468
|
+
})] }),
|
|
1469
|
+
children: u === void 0 ? null : /* @__PURE__ */ f("div", {
|
|
1470
|
+
className: st.confirmText,
|
|
1471
|
+
children: /* @__PURE__ */ f(Me, {
|
|
1472
|
+
label: `Type ${u} to confirm`,
|
|
1473
|
+
value: m,
|
|
1474
|
+
disabled: c,
|
|
1475
|
+
autoComplete: "off",
|
|
1476
|
+
placeholder: u,
|
|
1477
|
+
onChange: (e) => h(e.target.value)
|
|
1478
|
+
})
|
|
1479
|
+
})
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
var J = {
|
|
1483
|
+
control: "cui-Select-module__control--OqOfI",
|
|
1484
|
+
trigger: "cui-Select-module__trigger--ECKfC",
|
|
1485
|
+
open: "cui-Select-module__open--PADOK",
|
|
1486
|
+
value: "cui-Select-module__value--7CDNo",
|
|
1487
|
+
placeholder: "cui-Select-module__placeholder--yUgBU",
|
|
1488
|
+
sm: "cui-Select-module__sm--TPJwf",
|
|
1489
|
+
md: "cui-Select-module__md--nOV6u",
|
|
1490
|
+
lg: "cui-Select-module__lg--NGPOa",
|
|
1491
|
+
chevron: "cui-Select-module__chevron--PLUsh",
|
|
1492
|
+
clear: "cui-Select-module__clear--2OgzI",
|
|
1493
|
+
invalid: "cui-Select-module__invalid--opDrx",
|
|
1494
|
+
disabled: "cui-Select-module__disabled--8YgjS",
|
|
1495
|
+
popover: "cui-Select-module__popover--VnWAu",
|
|
1496
|
+
"cui-select-in": "cui-Select-module__cui-select-in--VGYFd",
|
|
1497
|
+
top: "cui-Select-module__top--v5FSw",
|
|
1498
|
+
"cui-select-in-top": "cui-Select-module__cui-select-in-top--fwYA4",
|
|
1499
|
+
searchWrap: "cui-Select-module__searchWrap--YBOFZ",
|
|
1500
|
+
search: "cui-Select-module__search--FrUXx",
|
|
1501
|
+
list: "cui-Select-module__list--CI08p",
|
|
1502
|
+
option: "cui-Select-module__option--Hvo8n",
|
|
1503
|
+
optionLabel: "cui-Select-module__optionLabel--FGiUZ",
|
|
1504
|
+
selected: "cui-Select-module__selected--8A13A",
|
|
1505
|
+
highlighted: "cui-Select-module__highlighted--YIVPT",
|
|
1506
|
+
optionDisabled: "cui-Select-module__optionDisabled--FhDw-",
|
|
1507
|
+
check: "cui-Select-module__check--RxZrV",
|
|
1508
|
+
empty: "cui-Select-module__empty--KmYrm",
|
|
1509
|
+
spinner: "cui-Select-module__spinner--OxCAP",
|
|
1510
|
+
"cui-select-spin": "cui-Select-module__cui-select-spin--MQqaM"
|
|
1511
|
+
}, lt = 4, ut = 280, dt = 500, ft = (e) => Array.isArray(e) ? e : e ? [e] : [], pt = n(function({ options: e, placeholder: t = "Select an option", size: n = "md", multiple: i = !1, clearable: u = !0, onSearch: d, loading: g = !1, emptyMessage: _ = "No options found.", listClassName: v, name: y, value: b, defaultValue: x, onChange: S, id: C, required: w, disabled: T, error: E, "aria-describedby": D, className: O, onKeyDown: k, onClick: A, ...j }, M) {
|
|
1512
|
+
let P = N({
|
|
1513
|
+
id: C,
|
|
1514
|
+
required: w,
|
|
1515
|
+
disabled: T,
|
|
1516
|
+
error: E,
|
|
1517
|
+
"aria-describedby": D
|
|
1518
|
+
}), F = o(), I = `${F}-list`, L = `${F}-value`, R = (e) => `${F}-option-${e}`, z = c(null), B = c(null), V = c(null), H = c(null), ee = c(null), [U, te] = l(!1), [W, ne] = l(null), [re, ie] = l(""), [ae, oe] = l(!1), [G, se] = l(0), ce = b !== void 0, [K, le] = l(() => ft(x)), ue = ce ? ft(b) : K, de = r((e) => {
|
|
1519
|
+
B.current = e, typeof M == "function" ? M(e) : M && (M.current = e);
|
|
1520
|
+
}, [M]), q = s(() => {
|
|
1521
|
+
if (d || !re) return e;
|
|
1522
|
+
let t = re.toLowerCase();
|
|
1523
|
+
return e.filter((e) => e.label.toLowerCase().includes(t));
|
|
1524
|
+
}, [
|
|
1525
|
+
e,
|
|
1526
|
+
re,
|
|
1527
|
+
d
|
|
1528
|
+
]), fe = (e) => {
|
|
1529
|
+
ce || le(e), S?.(i ? e : e[0] ?? "");
|
|
1530
|
+
}, pe = (e) => {
|
|
1531
|
+
let t = e.findIndex((e) => !e.disabled);
|
|
1532
|
+
return t === -1 ? 0 : t;
|
|
1533
|
+
}, me = r(() => {
|
|
1534
|
+
let e = z.current;
|
|
1535
|
+
if (!e) return;
|
|
1536
|
+
let t = e.getBoundingClientRect(), n = window.innerHeight - t.bottom, r = n < ut && t.top > n ? "top" : "bottom", i = {
|
|
1537
|
+
left: t.left,
|
|
1538
|
+
width: t.width
|
|
1539
|
+
};
|
|
1540
|
+
r === "bottom" ? i.top = t.bottom + lt : i.bottom = window.innerHeight - t.top + lt, ne({
|
|
1541
|
+
style: i,
|
|
1542
|
+
placement: r
|
|
267
1543
|
});
|
|
268
|
-
}, []),
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
let t = e.findIndex((e) =>
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
1544
|
+
}, []), he = () => {
|
|
1545
|
+
if (P.disabled) return;
|
|
1546
|
+
me(), ie(""), oe(!1);
|
|
1547
|
+
let t = e.findIndex((e) => ue.includes(e.value));
|
|
1548
|
+
se(t === -1 ? pe(e) : t), te(!0);
|
|
1549
|
+
}, ge = (e = !0) => {
|
|
1550
|
+
te(!1), e && B.current?.focus({ preventScroll: !0 });
|
|
1551
|
+
}, _e = (e) => {
|
|
1552
|
+
e.disabled || (i ? fe(ue.includes(e.value) ? ue.filter((t) => t !== e.value) : [...ue, e.value]) : (fe([e.value]), ge()), ie(""), oe(!1));
|
|
275
1553
|
}, ve = (e) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
for (let n = 0; n < J.length && (t = (t + e + J.length) % J.length, J[t]?.disabled); n++);
|
|
281
|
-
W(t);
|
|
1554
|
+
if (!q.length) return;
|
|
1555
|
+
let t = G;
|
|
1556
|
+
for (let n = 0; n < q.length && (t = (t + e + q.length) % q.length, q[t]?.disabled); n++);
|
|
1557
|
+
se(t);
|
|
282
1558
|
};
|
|
283
1559
|
a(() => {
|
|
284
|
-
|
|
285
|
-
}, [
|
|
286
|
-
|
|
287
|
-
}, [
|
|
288
|
-
let
|
|
1560
|
+
U && H.current?.focus({ preventScroll: !0 });
|
|
1561
|
+
}, [U]), a(() => {
|
|
1562
|
+
ae && ee.current?.focus({ preventScroll: !0 });
|
|
1563
|
+
}, [ae]);
|
|
1564
|
+
let ye = c(d);
|
|
289
1565
|
a(() => {
|
|
290
|
-
|
|
1566
|
+
ye.current = d;
|
|
291
1567
|
}, [d]), a(() => {
|
|
292
|
-
if (!
|
|
293
|
-
let e = setTimeout(() =>
|
|
1568
|
+
if (!U || !ye.current) return;
|
|
1569
|
+
let e = setTimeout(() => ye.current?.(re), dt);
|
|
294
1570
|
return () => clearTimeout(e);
|
|
295
|
-
}, [
|
|
296
|
-
if (!
|
|
297
|
-
let e = () => requestAnimationFrame(
|
|
1571
|
+
}, [re, U]), a(() => {
|
|
1572
|
+
if (!U) return;
|
|
1573
|
+
let e = () => requestAnimationFrame(me);
|
|
298
1574
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
299
1575
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
300
1576
|
};
|
|
301
|
-
}, [
|
|
302
|
-
if (!
|
|
1577
|
+
}, [U, me]), a(() => {
|
|
1578
|
+
if (!U) return;
|
|
303
1579
|
let e = (e) => {
|
|
304
1580
|
let t = e.target;
|
|
305
|
-
!
|
|
1581
|
+
!z.current?.contains(t) && !V.current?.contains(t) && te(!1);
|
|
306
1582
|
};
|
|
307
1583
|
return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
|
|
308
|
-
}, [
|
|
309
|
-
if (!
|
|
310
|
-
let e =
|
|
1584
|
+
}, [U]), a(() => {
|
|
1585
|
+
if (!U) return;
|
|
1586
|
+
let e = H.current, t = e?.children[G];
|
|
311
1587
|
e && t && (t.offsetTop < e.scrollTop ? e.scrollTop = t.offsetTop : t.offsetTop + t.offsetHeight > e.scrollTop + e.clientHeight && (e.scrollTop = t.offsetTop + t.offsetHeight - e.clientHeight));
|
|
312
|
-
}, [
|
|
313
|
-
let
|
|
314
|
-
|
|
315
|
-
},
|
|
1588
|
+
}, [G, U]);
|
|
1589
|
+
let be = (e) => {
|
|
1590
|
+
k?.(e), !e.defaultPrevented && !U && (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), he());
|
|
1591
|
+
}, xe = (e) => {
|
|
316
1592
|
switch (e.key) {
|
|
317
1593
|
case "Escape":
|
|
318
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1594
|
+
e.preventDefault(), e.stopPropagation(), ge();
|
|
319
1595
|
return;
|
|
320
1596
|
case "ArrowDown":
|
|
321
|
-
e.preventDefault(),
|
|
1597
|
+
e.preventDefault(), ve(1);
|
|
322
1598
|
return;
|
|
323
1599
|
case "ArrowUp":
|
|
324
|
-
e.preventDefault(),
|
|
1600
|
+
e.preventDefault(), ve(-1);
|
|
325
1601
|
return;
|
|
326
1602
|
case "Home":
|
|
327
|
-
if (
|
|
328
|
-
e.preventDefault(),
|
|
1603
|
+
if (ae) return;
|
|
1604
|
+
e.preventDefault(), se(pe(q));
|
|
329
1605
|
return;
|
|
330
1606
|
case "End":
|
|
331
|
-
if (
|
|
332
|
-
e.preventDefault(),
|
|
1607
|
+
if (ae) return;
|
|
1608
|
+
e.preventDefault(), se(Math.max(q.length - 1, 0));
|
|
333
1609
|
return;
|
|
334
1610
|
case "Enter":
|
|
335
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1611
|
+
e.preventDefault(), e.stopPropagation(), q[G] && _e(q[G]);
|
|
336
1612
|
return;
|
|
337
1613
|
case "Tab":
|
|
338
|
-
|
|
1614
|
+
te(!1), B.current?.focus({ preventScroll: !0 });
|
|
339
1615
|
return;
|
|
340
1616
|
case " ":
|
|
341
|
-
if (
|
|
342
|
-
e.preventDefault(),
|
|
1617
|
+
if (ae) return;
|
|
1618
|
+
e.preventDefault(), q[G] && _e(q[G]);
|
|
343
1619
|
return;
|
|
344
1620
|
}
|
|
345
1621
|
let t = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
346
|
-
!
|
|
347
|
-
},
|
|
1622
|
+
!ae && t && (e.preventDefault(), ie(e.key), se(0), oe(!0));
|
|
1623
|
+
}, Se = e.filter((e) => ue.includes(e.value)), Ce = ue.length > 0, we = ue.length > 1 ? `${ue.length} selected` : Se[0]?.label ?? t, Te = u && Ce && !P.disabled, Ee = U ? z.current?.closest("[data-theme]")?.getAttribute("data-theme") : void 0, De = U && q[G] ? R(G) : void 0, Oe = P.labelId ? `${P.labelId} ${L}` : void 0;
|
|
348
1624
|
return /* @__PURE__ */ p("div", {
|
|
349
|
-
ref:
|
|
350
|
-
className: h(
|
|
1625
|
+
ref: z,
|
|
1626
|
+
className: h(J.control, J[n], P.invalid && J.invalid, P.disabled && J.disabled, U && J.open, O),
|
|
351
1627
|
children: [
|
|
352
1628
|
/* @__PURE__ */ f("button", {
|
|
353
|
-
...
|
|
354
|
-
ref:
|
|
355
|
-
id:
|
|
1629
|
+
...j,
|
|
1630
|
+
ref: de,
|
|
1631
|
+
id: P.id,
|
|
356
1632
|
type: "button",
|
|
357
1633
|
role: "combobox",
|
|
358
1634
|
"aria-haspopup": "listbox",
|
|
359
|
-
"aria-expanded":
|
|
360
|
-
"aria-controls":
|
|
361
|
-
"aria-labelledby":
|
|
362
|
-
"aria-invalid":
|
|
363
|
-
"aria-describedby":
|
|
364
|
-
"aria-required":
|
|
365
|
-
disabled:
|
|
366
|
-
className: h(
|
|
1635
|
+
"aria-expanded": U,
|
|
1636
|
+
"aria-controls": U ? I : void 0,
|
|
1637
|
+
"aria-labelledby": Oe,
|
|
1638
|
+
"aria-invalid": P["aria-invalid"],
|
|
1639
|
+
"aria-describedby": P["aria-describedby"],
|
|
1640
|
+
"aria-required": P.required || void 0,
|
|
1641
|
+
disabled: P.disabled,
|
|
1642
|
+
className: h(J.trigger, !Se.length && J.placeholder),
|
|
367
1643
|
onClick: (e) => {
|
|
368
|
-
|
|
1644
|
+
A?.(e), !e.defaultPrevented && (U ? ge(!1) : he());
|
|
369
1645
|
},
|
|
370
|
-
onKeyDown:
|
|
1646
|
+
onKeyDown: be,
|
|
371
1647
|
children: /* @__PURE__ */ f("span", {
|
|
372
|
-
id:
|
|
373
|
-
className:
|
|
1648
|
+
id: L,
|
|
1649
|
+
className: J.value,
|
|
374
1650
|
children: we
|
|
375
1651
|
})
|
|
376
1652
|
}),
|
|
377
1653
|
Te ? /* @__PURE__ */ f("button", {
|
|
378
1654
|
type: "button",
|
|
379
|
-
className:
|
|
1655
|
+
className: J.clear,
|
|
380
1656
|
"aria-label": "Clear selection",
|
|
381
1657
|
onClick: () => {
|
|
382
|
-
|
|
1658
|
+
fe([]), B.current?.focus({ preventScroll: !0 });
|
|
383
1659
|
},
|
|
384
1660
|
children: /* @__PURE__ */ f("svg", {
|
|
385
1661
|
viewBox: "0 0 20 20",
|
|
@@ -393,122 +1669,2160 @@ var N = {
|
|
|
393
1669
|
strokeLinecap: "round"
|
|
394
1670
|
})
|
|
395
1671
|
})
|
|
396
|
-
}) : null,
|
|
397
|
-
/* @__PURE__ */ f("svg", {
|
|
398
|
-
className:
|
|
399
|
-
viewBox: "0 0 20 20",
|
|
400
|
-
"aria-hidden": "true",
|
|
401
|
-
focusable: "false",
|
|
402
|
-
children: /* @__PURE__ */ f("path", {
|
|
403
|
-
d: "M5 7.5l5 5 5-5",
|
|
404
|
-
fill: "none",
|
|
405
|
-
stroke: "currentColor",
|
|
406
|
-
strokeWidth: "2",
|
|
407
|
-
strokeLinecap: "round",
|
|
408
|
-
strokeLinejoin: "round"
|
|
1672
|
+
}) : null,
|
|
1673
|
+
/* @__PURE__ */ f("svg", {
|
|
1674
|
+
className: J.chevron,
|
|
1675
|
+
viewBox: "0 0 20 20",
|
|
1676
|
+
"aria-hidden": "true",
|
|
1677
|
+
focusable: "false",
|
|
1678
|
+
children: /* @__PURE__ */ f("path", {
|
|
1679
|
+
d: "M5 7.5l5 5 5-5",
|
|
1680
|
+
fill: "none",
|
|
1681
|
+
stroke: "currentColor",
|
|
1682
|
+
strokeWidth: "2",
|
|
1683
|
+
strokeLinecap: "round",
|
|
1684
|
+
strokeLinejoin: "round"
|
|
1685
|
+
})
|
|
1686
|
+
}),
|
|
1687
|
+
y ? ue.length > 0 ? ue.map((e) => /* @__PURE__ */ f("input", {
|
|
1688
|
+
type: "hidden",
|
|
1689
|
+
name: y,
|
|
1690
|
+
value: e
|
|
1691
|
+
}, e)) : !i && /* @__PURE__ */ f("input", {
|
|
1692
|
+
type: "hidden",
|
|
1693
|
+
name: y,
|
|
1694
|
+
value: ""
|
|
1695
|
+
}) : null,
|
|
1696
|
+
U && W ? m(/* @__PURE__ */ p("div", {
|
|
1697
|
+
ref: V,
|
|
1698
|
+
className: h(J.popover, J[W.placement]),
|
|
1699
|
+
style: W.style,
|
|
1700
|
+
"data-theme": Ee ?? void 0,
|
|
1701
|
+
onKeyDown: xe,
|
|
1702
|
+
children: [ae ? /* @__PURE__ */ f("div", {
|
|
1703
|
+
className: J.searchWrap,
|
|
1704
|
+
children: /* @__PURE__ */ f("input", {
|
|
1705
|
+
ref: ee,
|
|
1706
|
+
type: "text",
|
|
1707
|
+
className: J.search,
|
|
1708
|
+
placeholder: "Search options...",
|
|
1709
|
+
"aria-label": "Search options",
|
|
1710
|
+
"aria-controls": I,
|
|
1711
|
+
"aria-activedescendant": De,
|
|
1712
|
+
autoComplete: "off",
|
|
1713
|
+
value: re,
|
|
1714
|
+
onChange: (e) => {
|
|
1715
|
+
let t = e.target.value;
|
|
1716
|
+
ie(t), se(0), t === "" && (oe(!1), H.current?.focus({ preventScroll: !0 }));
|
|
1717
|
+
}
|
|
1718
|
+
})
|
|
1719
|
+
}) : null, /* @__PURE__ */ f("ul", {
|
|
1720
|
+
ref: H,
|
|
1721
|
+
id: I,
|
|
1722
|
+
role: "listbox",
|
|
1723
|
+
tabIndex: -1,
|
|
1724
|
+
"aria-labelledby": Oe,
|
|
1725
|
+
"aria-multiselectable": i || void 0,
|
|
1726
|
+
"aria-activedescendant": ae ? void 0 : De,
|
|
1727
|
+
className: h(J.list, v),
|
|
1728
|
+
children: q.length > 0 ? q.map((e, t) => {
|
|
1729
|
+
let n = ue.includes(e.value);
|
|
1730
|
+
return /* @__PURE__ */ p("li", {
|
|
1731
|
+
id: R(t),
|
|
1732
|
+
role: "option",
|
|
1733
|
+
"aria-selected": n,
|
|
1734
|
+
"aria-disabled": e.disabled || void 0,
|
|
1735
|
+
className: h(J.option, n && J.selected, t === G && J.highlighted, e.disabled && J.optionDisabled),
|
|
1736
|
+
onMouseEnter: () => !e.disabled && se(t),
|
|
1737
|
+
onClick: () => _e(e),
|
|
1738
|
+
children: [/* @__PURE__ */ f("span", {
|
|
1739
|
+
className: J.optionLabel,
|
|
1740
|
+
children: e.label
|
|
1741
|
+
}), n ? /* @__PURE__ */ f("svg", {
|
|
1742
|
+
className: J.check,
|
|
1743
|
+
viewBox: "0 0 20 20",
|
|
1744
|
+
"aria-hidden": "true",
|
|
1745
|
+
focusable: "false",
|
|
1746
|
+
children: /* @__PURE__ */ f("path", {
|
|
1747
|
+
d: "M4.5 10.5l3.5 3.5 7.5-8",
|
|
1748
|
+
fill: "none",
|
|
1749
|
+
stroke: "currentColor",
|
|
1750
|
+
strokeWidth: "2",
|
|
1751
|
+
strokeLinecap: "round",
|
|
1752
|
+
strokeLinejoin: "round"
|
|
1753
|
+
})
|
|
1754
|
+
}) : null]
|
|
1755
|
+
}, e.value);
|
|
1756
|
+
}) : /* @__PURE__ */ f("li", {
|
|
1757
|
+
className: J.empty,
|
|
1758
|
+
role: "presentation",
|
|
1759
|
+
children: g ? /* @__PURE__ */ f("span", {
|
|
1760
|
+
className: J.spinner,
|
|
1761
|
+
role: "status",
|
|
1762
|
+
"aria-label": "Loading"
|
|
1763
|
+
}) : _
|
|
1764
|
+
})
|
|
1765
|
+
})]
|
|
1766
|
+
}), document.body) : null
|
|
1767
|
+
]
|
|
1768
|
+
});
|
|
1769
|
+
}), mt = n(function({ label: e, helperText: t, ...n }, r) {
|
|
1770
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
1771
|
+
let i = n;
|
|
1772
|
+
return !e && !t && !n.error ? /* @__PURE__ */ f(pt, {
|
|
1773
|
+
...i,
|
|
1774
|
+
ref: r
|
|
1775
|
+
}) : /* @__PURE__ */ f(F, {
|
|
1776
|
+
id: n.id,
|
|
1777
|
+
label: e,
|
|
1778
|
+
helperText: t,
|
|
1779
|
+
error: n.error,
|
|
1780
|
+
required: n.required,
|
|
1781
|
+
disabled: n.disabled,
|
|
1782
|
+
children: /* @__PURE__ */ f(pt, {
|
|
1783
|
+
...i,
|
|
1784
|
+
ref: r
|
|
1785
|
+
})
|
|
1786
|
+
});
|
|
1787
|
+
});
|
|
1788
|
+
//#endregion
|
|
1789
|
+
//#region src/components/Pagination/paginationUtils.ts
|
|
1790
|
+
function ht(e, t, n = 1, r = 1) {
|
|
1791
|
+
let i = Math.max(0, Math.floor(t));
|
|
1792
|
+
if (i === 0) return [];
|
|
1793
|
+
let a = Math.min(Math.max(1, Math.floor(e)), i), o = (e, t) => Array.from({ length: Math.max(0, t - e + 1) }, (t, n) => e + n), s = o(1, Math.min(r, i)), c = o(Math.max(i - r + 1, r + 1), i), l = Math.max(Math.min(a - n, i - r - n * 2 - 1), r + 2), u = Math.min(Math.max(a + n, r + n * 2 + 2), c.length > 0 ? c[0] - 2 : i - 1), d = [...s];
|
|
1794
|
+
return l > r + 2 ? d.push("ellipsis-start") : r + 1 < i - r && d.push(r + 1), d.push(...o(l, u)), u < i - r - 1 ? d.push("ellipsis-end") : i - r > r && d.push(i - r), d.push(...c), d.filter((e, t) => typeof e != "number" || d.indexOf(e) === t);
|
|
1795
|
+
}
|
|
1796
|
+
var Y = {
|
|
1797
|
+
root: "cui-Pagination-module__root--ITRjt",
|
|
1798
|
+
info: "cui-Pagination-module__info--4yuss",
|
|
1799
|
+
summary: "cui-Pagination-module__summary--ZTggV",
|
|
1800
|
+
pageSize: "cui-Pagination-module__pageSize--rDNL9",
|
|
1801
|
+
pages: "cui-Pagination-module__pages--Fz8bC",
|
|
1802
|
+
button: "cui-Pagination-module__button----Saq",
|
|
1803
|
+
current: "cui-Pagination-module__current--Ca1M4",
|
|
1804
|
+
ellipsis: "cui-Pagination-module__ellipsis--V294k",
|
|
1805
|
+
split: "cui-Pagination-module__split--GnzEp",
|
|
1806
|
+
splitLeft: "cui-Pagination-module__splitLeft--s3TPn",
|
|
1807
|
+
splitCenter: "cui-Pagination-module__splitCenter--1Sosz",
|
|
1808
|
+
splitRight: "cui-Pagination-module__splitRight--3gp2C",
|
|
1809
|
+
joined: "cui-Pagination-module__joined--SDJ-W",
|
|
1810
|
+
pageOf: "cui-Pagination-module__pageOf--pEVDE",
|
|
1811
|
+
pageNumber: "cui-Pagination-module__pageNumber--rayzm",
|
|
1812
|
+
first: "cui-Pagination-module__first--2Gg56",
|
|
1813
|
+
prev: "cui-Pagination-module__prev--aNYld",
|
|
1814
|
+
next: "cui-Pagination-module__next--QC3Z9",
|
|
1815
|
+
last: "cui-Pagination-module__last--zJ-7Y"
|
|
1816
|
+
}, gt = (e) => /* @__PURE__ */ f("svg", {
|
|
1817
|
+
viewBox: "0 0 20 20",
|
|
1818
|
+
fill: "none",
|
|
1819
|
+
stroke: "currentColor",
|
|
1820
|
+
strokeWidth: "2",
|
|
1821
|
+
strokeLinecap: "round",
|
|
1822
|
+
strokeLinejoin: "round",
|
|
1823
|
+
"aria-hidden": "true",
|
|
1824
|
+
focusable: "false",
|
|
1825
|
+
children: /* @__PURE__ */ f("path", { d: e })
|
|
1826
|
+
});
|
|
1827
|
+
function _t({ page: e, pageCount: t, onPageChange: n, siblingCount: r = 1, boundaryCount: i = 1, showFirstLast: a = !1, layout: o = "default", pageSize: s, totalItems: c, pageSizeOptions: l, onPageSizeChange: u, disabled: m = !1, "aria-label": g = "Pagination", className: _, ...v }) {
|
|
1828
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
1829
|
+
let y = Math.max(1, t), b = Math.min(Math.max(1, e), y), x = ht(b, y, r, i), S = (e) => {
|
|
1830
|
+
!m && e >= 1 && e <= y && e !== b && n(e);
|
|
1831
|
+
}, C = o === "split", w = a || C, T = s !== void 0 && c !== void 0, E = c === 0 || !s ? 0 : (b - 1) * s + 1, O = s && c !== void 0 ? Math.min(b * s, c) : 0, A = l && l.length > 0 && u, j = T ? /* @__PURE__ */ f("span", {
|
|
1832
|
+
className: Y.summary,
|
|
1833
|
+
children: C ? `Showing ${E}-${O} of ${c} Rows` : `Showing ${E}-${O} of ${c}`
|
|
1834
|
+
}) : null, M = A ? /* @__PURE__ */ p("div", {
|
|
1835
|
+
className: Y.pageSize,
|
|
1836
|
+
children: [/* @__PURE__ */ f("span", {
|
|
1837
|
+
"aria-hidden": "true",
|
|
1838
|
+
children: C ? "Row Per Page" : "Rows per page"
|
|
1839
|
+
}), /* @__PURE__ */ f(mt, {
|
|
1840
|
+
"aria-label": "Rows per page",
|
|
1841
|
+
size: "sm",
|
|
1842
|
+
clearable: !1,
|
|
1843
|
+
disabled: m,
|
|
1844
|
+
value: String(s ?? l[0]),
|
|
1845
|
+
options: l.map((e) => ({
|
|
1846
|
+
label: String(e),
|
|
1847
|
+
value: String(e)
|
|
1848
|
+
})),
|
|
1849
|
+
onChange: (e) => u(Number(e))
|
|
1850
|
+
})]
|
|
1851
|
+
}) : null, N = /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("ul", {
|
|
1852
|
+
className: h(Y.pages, C && Y.joined),
|
|
1853
|
+
children: [
|
|
1854
|
+
w ? /* @__PURE__ */ f("li", {
|
|
1855
|
+
className: Y.first,
|
|
1856
|
+
children: /* @__PURE__ */ f("button", {
|
|
1857
|
+
type: "button",
|
|
1858
|
+
className: Y.button,
|
|
1859
|
+
"aria-label": "First page",
|
|
1860
|
+
disabled: m || b === 1,
|
|
1861
|
+
onClick: () => S(1),
|
|
1862
|
+
children: gt("M11 5l-5 5 5 5M15 5v10")
|
|
1863
|
+
})
|
|
1864
|
+
}) : null,
|
|
1865
|
+
/* @__PURE__ */ f("li", {
|
|
1866
|
+
className: Y.prev,
|
|
1867
|
+
children: /* @__PURE__ */ f("button", {
|
|
1868
|
+
type: "button",
|
|
1869
|
+
className: Y.button,
|
|
1870
|
+
"aria-label": "Previous page",
|
|
1871
|
+
disabled: m || b === 1,
|
|
1872
|
+
onClick: () => S(b - 1),
|
|
1873
|
+
children: gt("M12 5l-5 5 5 5")
|
|
1874
|
+
})
|
|
1875
|
+
}),
|
|
1876
|
+
x.map((e) => typeof e == "number" ? /* @__PURE__ */ f("li", {
|
|
1877
|
+
className: Y.pageNumber,
|
|
1878
|
+
children: /* @__PURE__ */ f("button", {
|
|
1879
|
+
type: "button",
|
|
1880
|
+
className: h(Y.button, e === b && Y.current),
|
|
1881
|
+
"aria-label": `Page ${e}`,
|
|
1882
|
+
"aria-current": e === b ? "page" : void 0,
|
|
1883
|
+
disabled: m,
|
|
1884
|
+
onClick: () => S(e),
|
|
1885
|
+
children: e
|
|
1886
|
+
})
|
|
1887
|
+
}, e) : /* @__PURE__ */ f("li", {
|
|
1888
|
+
className: h(Y.ellipsis, Y.pageNumber),
|
|
1889
|
+
"aria-hidden": "true",
|
|
1890
|
+
children: "…"
|
|
1891
|
+
}, e)),
|
|
1892
|
+
/* @__PURE__ */ f("li", {
|
|
1893
|
+
className: Y.next,
|
|
1894
|
+
children: /* @__PURE__ */ f("button", {
|
|
1895
|
+
type: "button",
|
|
1896
|
+
className: Y.button,
|
|
1897
|
+
"aria-label": "Next page",
|
|
1898
|
+
disabled: m || b === y,
|
|
1899
|
+
onClick: () => S(b + 1),
|
|
1900
|
+
children: gt("M8 5l5 5-5 5")
|
|
1901
|
+
})
|
|
1902
|
+
}),
|
|
1903
|
+
w ? /* @__PURE__ */ f("li", {
|
|
1904
|
+
className: Y.last,
|
|
1905
|
+
children: /* @__PURE__ */ f("button", {
|
|
1906
|
+
type: "button",
|
|
1907
|
+
className: Y.button,
|
|
1908
|
+
"aria-label": "Last page",
|
|
1909
|
+
disabled: m || b === y,
|
|
1910
|
+
onClick: () => S(y),
|
|
1911
|
+
children: gt("M9 5l5 5-5 5M5 5v10")
|
|
1912
|
+
})
|
|
1913
|
+
}) : null
|
|
1914
|
+
]
|
|
1915
|
+
}), C ? /* @__PURE__ */ p("span", {
|
|
1916
|
+
className: Y.pageOf,
|
|
1917
|
+
"aria-hidden": "true",
|
|
1918
|
+
children: [
|
|
1919
|
+
"Page ",
|
|
1920
|
+
/* @__PURE__ */ f("strong", { children: b }),
|
|
1921
|
+
" of ",
|
|
1922
|
+
y
|
|
1923
|
+
]
|
|
1924
|
+
}) : null] });
|
|
1925
|
+
return C ? /* @__PURE__ */ p("nav", {
|
|
1926
|
+
...v,
|
|
1927
|
+
"aria-label": g,
|
|
1928
|
+
className: h(Y.root, Y.split, _),
|
|
1929
|
+
children: [
|
|
1930
|
+
/* @__PURE__ */ f("div", {
|
|
1931
|
+
className: Y.splitLeft,
|
|
1932
|
+
children: M
|
|
1933
|
+
}),
|
|
1934
|
+
/* @__PURE__ */ f("div", {
|
|
1935
|
+
className: Y.splitCenter,
|
|
1936
|
+
children: N
|
|
1937
|
+
}),
|
|
1938
|
+
/* @__PURE__ */ f("div", {
|
|
1939
|
+
className: Y.splitRight,
|
|
1940
|
+
children: j
|
|
1941
|
+
})
|
|
1942
|
+
]
|
|
1943
|
+
}) : /* @__PURE__ */ p("nav", {
|
|
1944
|
+
...v,
|
|
1945
|
+
"aria-label": g,
|
|
1946
|
+
className: h(Y.root, _),
|
|
1947
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1948
|
+
className: Y.info,
|
|
1949
|
+
children: [j, M]
|
|
1950
|
+
}), N]
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
var X = {
|
|
1954
|
+
container: "cui-Table-module__container--Kb-5q",
|
|
1955
|
+
table: "cui-Table-module__table--Dkosn",
|
|
1956
|
+
caption: "cui-Table-module__caption--9vU1I",
|
|
1957
|
+
head: "cui-Table-module__head--nm9rX",
|
|
1958
|
+
th: "cui-Table-module__th--PNuEx",
|
|
1959
|
+
sorted: "cui-Table-module__sorted--PJE-z",
|
|
1960
|
+
sortable: "cui-Table-module__sortable--W4c6P",
|
|
1961
|
+
sortButton: "cui-Table-module__sortButton--V9clQ",
|
|
1962
|
+
center: "cui-Table-module__center--kj838",
|
|
1963
|
+
end: "cui-Table-module__end--eOUuQ",
|
|
1964
|
+
sticky: "cui-Table-module__sticky--QfxLu",
|
|
1965
|
+
td: "cui-Table-module__td--jv9tA",
|
|
1966
|
+
start: "cui-Table-module__start--H-44v",
|
|
1967
|
+
foot: "cui-Table-module__foot--0JhPm",
|
|
1968
|
+
row: "cui-Table-module__row--DD8Km",
|
|
1969
|
+
selected: "cui-Table-module__selected--DTjQs",
|
|
1970
|
+
clickable: "cui-Table-module__clickable--B6Si-",
|
|
1971
|
+
sortIcon: "cui-Table-module__sortIcon--V3-dH",
|
|
1972
|
+
sortActive: "cui-Table-module__sortActive--4aqxc",
|
|
1973
|
+
sortIdle: "cui-Table-module__sortIdle--ja3Xa",
|
|
1974
|
+
flush: "cui-Table-module__flush--sZ9XS"
|
|
1975
|
+
}, vt = n(function({ stickyHeader: e = !1, bordered: t = !0, containerClassName: n, scrollLabel: r, className: i, ...a }, o) {
|
|
1976
|
+
return D() ? /* @__PURE__ */ f("div", {
|
|
1977
|
+
className: h(X.container, !t && X.flush, n),
|
|
1978
|
+
tabIndex: 0,
|
|
1979
|
+
role: "region",
|
|
1980
|
+
"aria-label": r,
|
|
1981
|
+
children: /* @__PURE__ */ f("table", {
|
|
1982
|
+
...a,
|
|
1983
|
+
ref: o,
|
|
1984
|
+
className: h(X.table, e && X.sticky, i)
|
|
1985
|
+
})
|
|
1986
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
1987
|
+
}), yt = n(function({ className: e, ...t }, n) {
|
|
1988
|
+
return /* @__PURE__ */ f("thead", {
|
|
1989
|
+
...t,
|
|
1990
|
+
ref: n,
|
|
1991
|
+
className: h(X.head, e)
|
|
1992
|
+
});
|
|
1993
|
+
}), bt = n(function({ className: e, ...t }, n) {
|
|
1994
|
+
return /* @__PURE__ */ f("tbody", {
|
|
1995
|
+
...t,
|
|
1996
|
+
ref: n,
|
|
1997
|
+
className: e
|
|
1998
|
+
});
|
|
1999
|
+
}), xt = n(function({ className: e, ...t }, n) {
|
|
2000
|
+
return /* @__PURE__ */ f("tfoot", {
|
|
2001
|
+
...t,
|
|
2002
|
+
ref: n,
|
|
2003
|
+
className: h(X.foot, e)
|
|
2004
|
+
});
|
|
2005
|
+
}), St = n(function({ selected: e = !1, className: t, ...n }, r) {
|
|
2006
|
+
return /* @__PURE__ */ f("tr", {
|
|
2007
|
+
...n,
|
|
2008
|
+
ref: r,
|
|
2009
|
+
"data-selected": e || void 0,
|
|
2010
|
+
className: h(X.row, e && X.selected, n.onClick && X.clickable, t)
|
|
2011
|
+
});
|
|
2012
|
+
}), Ct = n(function({ align: e = "start", sortable: t = !1, sortDirection: n = null, onSort: r, className: i, children: a, scope: o = "col", ...s }, c) {
|
|
2013
|
+
let l = t ? n === "asc" ? "ascending" : n === "desc" ? "descending" : "none" : void 0;
|
|
2014
|
+
return /* @__PURE__ */ f("th", {
|
|
2015
|
+
...s,
|
|
2016
|
+
ref: c,
|
|
2017
|
+
scope: o,
|
|
2018
|
+
"aria-sort": l,
|
|
2019
|
+
className: h(X.th, X[e], t && X.sortable, t && n && X.sorted, i),
|
|
2020
|
+
children: t ? /* @__PURE__ */ p("button", {
|
|
2021
|
+
type: "button",
|
|
2022
|
+
className: X.sortButton,
|
|
2023
|
+
onClick: r,
|
|
2024
|
+
children: [a, /* @__PURE__ */ f("svg", {
|
|
2025
|
+
className: h(X.sortIcon, n ? X.sortActive : X.sortIdle),
|
|
2026
|
+
viewBox: "0 0 24 24",
|
|
2027
|
+
fill: "none",
|
|
2028
|
+
stroke: "currentColor",
|
|
2029
|
+
strokeWidth: n ? 3 : 2,
|
|
2030
|
+
strokeLinecap: "round",
|
|
2031
|
+
strokeLinejoin: "round",
|
|
2032
|
+
"aria-hidden": "true",
|
|
2033
|
+
focusable: "false",
|
|
2034
|
+
children: n === "asc" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("path", { d: "m5 12 7-7 7 7" }), /* @__PURE__ */ f("path", { d: "M12 19V5" })] }) : n === "desc" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("path", { d: "M12 5v14" }), /* @__PURE__ */ f("path", { d: "m19 12-7 7-7-7" })] }) : /* @__PURE__ */ p(d, { children: [
|
|
2035
|
+
/* @__PURE__ */ f("path", { d: "m21 16-4 4-4-4" }),
|
|
2036
|
+
/* @__PURE__ */ f("path", { d: "M17 20V4" }),
|
|
2037
|
+
/* @__PURE__ */ f("path", { d: "m3 8 4-4 4 4" }),
|
|
2038
|
+
/* @__PURE__ */ f("path", { d: "M7 4v16" })
|
|
2039
|
+
] })
|
|
2040
|
+
})]
|
|
2041
|
+
}) : a
|
|
2042
|
+
});
|
|
2043
|
+
}), wt = n(function({ align: e = "start", className: t, ...n }, r) {
|
|
2044
|
+
return /* @__PURE__ */ f("td", {
|
|
2045
|
+
...n,
|
|
2046
|
+
ref: r,
|
|
2047
|
+
className: h(X.td, X[e], t)
|
|
2048
|
+
});
|
|
2049
|
+
}), Tt = n(function({ className: e, ...t }, n) {
|
|
2050
|
+
return /* @__PURE__ */ f("caption", {
|
|
2051
|
+
...t,
|
|
2052
|
+
ref: n,
|
|
2053
|
+
className: h(X.caption, e)
|
|
2054
|
+
});
|
|
2055
|
+
}), Et = {
|
|
2056
|
+
root: "cui-PageHeader-module__root--agDwp",
|
|
2057
|
+
main: "cui-PageHeader-module__main--ePn-k",
|
|
2058
|
+
back: "cui-PageHeader-module__back--L-i-M",
|
|
2059
|
+
heading: "cui-PageHeader-module__heading--tWgg0",
|
|
2060
|
+
title: "cui-PageHeader-module__title--mv-ab",
|
|
2061
|
+
subtitle: "cui-PageHeader-module__subtitle--NHWmM",
|
|
2062
|
+
actions: "cui-PageHeader-module__actions--6XyFL"
|
|
2063
|
+
};
|
|
2064
|
+
//#endregion
|
|
2065
|
+
//#region src/components/PageHeader/PageHeader.tsx
|
|
2066
|
+
function Dt({ title: e, subtitle: t, onBack: n, backLabel: r = "Go back", actions: i, className: a, ...o }) {
|
|
2067
|
+
return D() ? /* @__PURE__ */ p("header", {
|
|
2068
|
+
...o,
|
|
2069
|
+
className: h(Et.root, a),
|
|
2070
|
+
children: [/* @__PURE__ */ p("div", {
|
|
2071
|
+
className: Et.main,
|
|
2072
|
+
children: [n ? /* @__PURE__ */ f("button", {
|
|
2073
|
+
type: "button",
|
|
2074
|
+
className: Et.back,
|
|
2075
|
+
"aria-label": r,
|
|
2076
|
+
onClick: n,
|
|
2077
|
+
children: /* @__PURE__ */ f("svg", {
|
|
2078
|
+
viewBox: "0 0 24 24",
|
|
2079
|
+
fill: "none",
|
|
2080
|
+
stroke: "currentColor",
|
|
2081
|
+
strokeWidth: "2.2",
|
|
2082
|
+
strokeLinecap: "round",
|
|
2083
|
+
strokeLinejoin: "round",
|
|
2084
|
+
"aria-hidden": "true",
|
|
2085
|
+
focusable: "false",
|
|
2086
|
+
children: /* @__PURE__ */ f("path", { d: "m12 19-7-7 7-7M19 12H5" })
|
|
2087
|
+
})
|
|
2088
|
+
}) : null, /* @__PURE__ */ p("div", {
|
|
2089
|
+
className: Et.heading,
|
|
2090
|
+
children: [/* @__PURE__ */ f("h1", {
|
|
2091
|
+
className: Et.title,
|
|
2092
|
+
children: e
|
|
2093
|
+
}), t ? /* @__PURE__ */ f("p", {
|
|
2094
|
+
className: Et.subtitle,
|
|
2095
|
+
children: t
|
|
2096
|
+
}) : null]
|
|
2097
|
+
})]
|
|
2098
|
+
}), i ? /* @__PURE__ */ f("div", {
|
|
2099
|
+
className: Et.actions,
|
|
2100
|
+
children: i
|
|
2101
|
+
}) : null]
|
|
2102
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
2103
|
+
}
|
|
2104
|
+
var Ot = {
|
|
2105
|
+
pill: "cui-StatusPill-module__pill--kySDR",
|
|
2106
|
+
label: "cui-StatusPill-module__label--tqHM5",
|
|
2107
|
+
dot: "cui-StatusPill-module__dot--pfXRR",
|
|
2108
|
+
pulse: "cui-StatusPill-module__pulse--UHRQO",
|
|
2109
|
+
"cui-status-pulse": "cui-StatusPill-module__cui-status-pulse--Li6eg",
|
|
2110
|
+
success: "cui-StatusPill-module__success--gn6ct",
|
|
2111
|
+
info: "cui-StatusPill-module__info--hBiaf",
|
|
2112
|
+
danger: "cui-StatusPill-module__danger--G-Lnk",
|
|
2113
|
+
warning: "cui-StatusPill-module__warning--9shGi",
|
|
2114
|
+
neutral: "cui-StatusPill-module__neutral--FL7Kb",
|
|
2115
|
+
empty: "cui-StatusPill-module__empty--78LZC"
|
|
2116
|
+
}, kt = {
|
|
2117
|
+
active: "success",
|
|
2118
|
+
completed: "info",
|
|
2119
|
+
expired: "danger",
|
|
2120
|
+
cancelled: "danger",
|
|
2121
|
+
canceled: "danger",
|
|
2122
|
+
pending: "warning"
|
|
2123
|
+
};
|
|
2124
|
+
function At({ status: e, tone: t, className: n, ...r }) {
|
|
2125
|
+
if (!e) return /* @__PURE__ */ f("span", {
|
|
2126
|
+
className: Ot.empty,
|
|
2127
|
+
children: "—"
|
|
2128
|
+
});
|
|
2129
|
+
let i = e.trim().toLowerCase(), a = t ?? kt[i] ?? "neutral", o = a === "success" || i === "completed";
|
|
2130
|
+
return /* @__PURE__ */ p("span", {
|
|
2131
|
+
className: h(Ot.pill, Ot[a], n),
|
|
2132
|
+
...r,
|
|
2133
|
+
children: [/* @__PURE__ */ f("span", {
|
|
2134
|
+
className: h(Ot.dot, o && Ot.pulse),
|
|
2135
|
+
"aria-hidden": "true"
|
|
2136
|
+
}), /* @__PURE__ */ f("span", {
|
|
2137
|
+
className: Ot.label,
|
|
2138
|
+
children: e
|
|
2139
|
+
})]
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
var jt = {
|
|
2143
|
+
root: "cui-Checkbox-module__root--mY3qk",
|
|
2144
|
+
label: "cui-Checkbox-module__label--cwRtI",
|
|
2145
|
+
disabled: "cui-Checkbox-module__disabled--x7-eg",
|
|
2146
|
+
input: "cui-Checkbox-module__input--2kt-h",
|
|
2147
|
+
box: "cui-Checkbox-module__box--OCPee",
|
|
2148
|
+
check: "cui-Checkbox-module__check--4HYWn",
|
|
2149
|
+
dash: "cui-Checkbox-module__dash--5Dkdl",
|
|
2150
|
+
invalid: "cui-Checkbox-module__invalid---Cs7q",
|
|
2151
|
+
text: "cui-Checkbox-module__text--EmtRj",
|
|
2152
|
+
required: "cui-Checkbox-module__required--t9DLN",
|
|
2153
|
+
message: "cui-Checkbox-module__message--ZPKsV",
|
|
2154
|
+
helper: "cui-Checkbox-module__helper--16DrX",
|
|
2155
|
+
error: "cui-Checkbox-module__error--E-bmD"
|
|
2156
|
+
}, Mt = n(function({ label: e, helperText: t, error: n, indeterminate: i = !1, id: o, required: s, disabled: l, "aria-describedby": u, className: d, ...m }, g) {
|
|
2157
|
+
let _ = c(null), v = r((e) => {
|
|
2158
|
+
_.current = e, typeof g == "function" ? g(e) : g && (g.current = e);
|
|
2159
|
+
}, [g]);
|
|
2160
|
+
a(() => {
|
|
2161
|
+
_.current && (_.current.indeterminate = i);
|
|
2162
|
+
}, [i]);
|
|
2163
|
+
let y = N({
|
|
2164
|
+
id: o,
|
|
2165
|
+
required: s,
|
|
2166
|
+
disabled: l,
|
|
2167
|
+
error: n,
|
|
2168
|
+
"aria-describedby": u
|
|
2169
|
+
});
|
|
2170
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
2171
|
+
let b = `${y.id}-message`, x = !!(n || t), S = [y["aria-describedby"], x ? b : void 0].filter(Boolean).join(" ") || void 0;
|
|
2172
|
+
return /* @__PURE__ */ p("div", {
|
|
2173
|
+
className: h(jt.root, d),
|
|
2174
|
+
children: [/* @__PURE__ */ p("label", {
|
|
2175
|
+
className: h(jt.label, y.disabled && jt.disabled),
|
|
2176
|
+
children: [
|
|
2177
|
+
/* @__PURE__ */ f("input", {
|
|
2178
|
+
...m,
|
|
2179
|
+
ref: v,
|
|
2180
|
+
id: y.id,
|
|
2181
|
+
type: "checkbox",
|
|
2182
|
+
required: y.required,
|
|
2183
|
+
disabled: y.disabled,
|
|
2184
|
+
"aria-invalid": y["aria-invalid"],
|
|
2185
|
+
"aria-describedby": S,
|
|
2186
|
+
className: h(jt.input, y.invalid && jt.invalid)
|
|
2187
|
+
}),
|
|
2188
|
+
/* @__PURE__ */ p("span", {
|
|
2189
|
+
className: jt.box,
|
|
2190
|
+
"aria-hidden": "true",
|
|
2191
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
2192
|
+
className: jt.check,
|
|
2193
|
+
viewBox: "0 0 20 20",
|
|
2194
|
+
focusable: "false",
|
|
2195
|
+
children: /* @__PURE__ */ f("path", {
|
|
2196
|
+
d: "M4.5 10.5l3.5 3.5 7.5-8",
|
|
2197
|
+
fill: "none",
|
|
2198
|
+
stroke: "currentColor",
|
|
2199
|
+
strokeWidth: "2.5",
|
|
2200
|
+
strokeLinecap: "round",
|
|
2201
|
+
strokeLinejoin: "round"
|
|
2202
|
+
})
|
|
2203
|
+
}), /* @__PURE__ */ f("svg", {
|
|
2204
|
+
className: jt.dash,
|
|
2205
|
+
viewBox: "0 0 20 20",
|
|
2206
|
+
focusable: "false",
|
|
2207
|
+
children: /* @__PURE__ */ f("path", {
|
|
2208
|
+
d: "M5 10h10",
|
|
2209
|
+
fill: "none",
|
|
2210
|
+
stroke: "currentColor",
|
|
2211
|
+
strokeWidth: "2.5",
|
|
2212
|
+
strokeLinecap: "round"
|
|
2213
|
+
})
|
|
2214
|
+
})]
|
|
2215
|
+
}),
|
|
2216
|
+
e ? /* @__PURE__ */ p("span", {
|
|
2217
|
+
className: jt.text,
|
|
2218
|
+
children: [e, y.required ? /* @__PURE__ */ f("span", {
|
|
2219
|
+
className: jt.required,
|
|
2220
|
+
"aria-hidden": "true",
|
|
2221
|
+
children: "*"
|
|
2222
|
+
}) : null]
|
|
2223
|
+
}) : null
|
|
2224
|
+
]
|
|
2225
|
+
}), x ? /* @__PURE__ */ f("p", {
|
|
2226
|
+
id: b,
|
|
2227
|
+
className: h(jt.message, n ? jt.error : jt.helper),
|
|
2228
|
+
role: n ? "alert" : void 0,
|
|
2229
|
+
children: n || t
|
|
2230
|
+
}) : null]
|
|
2231
|
+
});
|
|
2232
|
+
}), Nt = {
|
|
2233
|
+
root: "cui-DropdownMenu-module__root--5ZetV",
|
|
2234
|
+
trigger: "cui-DropdownMenu-module__trigger--9fhIT",
|
|
2235
|
+
open: "cui-DropdownMenu-module__open--tByXu",
|
|
2236
|
+
custom: "cui-DropdownMenu-module__custom--Ow9rI",
|
|
2237
|
+
menu: "cui-DropdownMenu-module__menu---RiRW",
|
|
2238
|
+
"cui-dropdown-in": "cui-DropdownMenu-module__cui-dropdown-in--pvAgp",
|
|
2239
|
+
item: "cui-DropdownMenu-module__item--T-QPZ",
|
|
2240
|
+
danger: "cui-DropdownMenu-module__danger--C0jN3",
|
|
2241
|
+
label: "cui-DropdownMenu-module__label--6yP76",
|
|
2242
|
+
icon: "cui-DropdownMenu-module__icon--zOP3d"
|
|
2243
|
+
}, Pt = 4, Ft = 192, It = 200, Lt = "[role=\"menuitem\"]:not([aria-disabled=\"true\"])";
|
|
2244
|
+
function Rt({ items: e, position: t = "right", label: n = "More actions", children: i, onOpenChange: s, disabled: u = !1, className: d }) {
|
|
2245
|
+
let g = D(), _ = `${o()}-menu`, v = c(null), y = c(null), [b, x] = l(!1), [S, C] = l(null), [w, T] = l(), [E, O] = l(0), A = r(() => {
|
|
2246
|
+
let e = v.current;
|
|
2247
|
+
if (!e) return;
|
|
2248
|
+
let n = e.getBoundingClientRect(), r = window.innerHeight - n.bottom, i = r < It && n.top > r ? { bottom: window.innerHeight - n.top + Pt } : { top: n.bottom + Pt }, a = n.left + Ft <= window.innerWidth - 8;
|
|
2249
|
+
t === "right" && a ? i.left = n.left : i.right = Math.max(8, window.innerWidth - n.right), C(i);
|
|
2250
|
+
}, [t]), j = (e) => {
|
|
2251
|
+
x(e), s?.(e);
|
|
2252
|
+
}, M = () => {
|
|
2253
|
+
u || (A(), T(v.current?.closest("[data-theme]")?.getAttribute("data-theme") ?? void 0), j(!0));
|
|
2254
|
+
}, N = (e = !0) => {
|
|
2255
|
+
j(!1), e && O((e) => e + 1);
|
|
2256
|
+
};
|
|
2257
|
+
if (a(() => {
|
|
2258
|
+
E > 0 && v.current?.focus({ preventScroll: !0 });
|
|
2259
|
+
}, [E]), a(() => {
|
|
2260
|
+
b && y.current?.querySelector(Lt)?.focus({ preventScroll: !0 });
|
|
2261
|
+
}, [b]), a(() => {
|
|
2262
|
+
if (!b) return;
|
|
2263
|
+
let e = () => requestAnimationFrame(A), t = (e) => {
|
|
2264
|
+
let t = e.target;
|
|
2265
|
+
!v.current?.contains(t) && !y.current?.contains(t) && (x(!1), s?.(!1));
|
|
2266
|
+
};
|
|
2267
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t, !0), () => {
|
|
2268
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t, !0);
|
|
2269
|
+
};
|
|
2270
|
+
}, [
|
|
2271
|
+
b,
|
|
2272
|
+
A,
|
|
2273
|
+
s
|
|
2274
|
+
]), !g) return /* @__PURE__ */ f(k, {});
|
|
2275
|
+
let P = (e) => {
|
|
2276
|
+
let t = Array.from(y.current?.querySelectorAll(Lt) ?? []);
|
|
2277
|
+
if (t.length === 0) return;
|
|
2278
|
+
let n = t.indexOf(document.activeElement);
|
|
2279
|
+
t[e === "first" ? 0 : e === "last" ? t.length - 1 : (n + e + t.length) % t.length]?.focus({ preventScroll: !0 });
|
|
2280
|
+
};
|
|
2281
|
+
return /* @__PURE__ */ p("span", {
|
|
2282
|
+
className: h(Nt.root, d),
|
|
2283
|
+
children: [/* @__PURE__ */ f("button", {
|
|
2284
|
+
ref: v,
|
|
2285
|
+
type: "button",
|
|
2286
|
+
className: h(Nt.trigger, b && Nt.open, i !== void 0 && Nt.custom),
|
|
2287
|
+
"aria-haspopup": "menu",
|
|
2288
|
+
"aria-expanded": b,
|
|
2289
|
+
"aria-controls": b ? _ : void 0,
|
|
2290
|
+
"aria-label": n,
|
|
2291
|
+
title: n,
|
|
2292
|
+
disabled: u,
|
|
2293
|
+
onClick: () => b ? N(!1) : M(),
|
|
2294
|
+
onKeyDown: (e) => {
|
|
2295
|
+
!b && (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), M());
|
|
2296
|
+
},
|
|
2297
|
+
children: i ?? /* @__PURE__ */ p("svg", {
|
|
2298
|
+
viewBox: "0 0 20 20",
|
|
2299
|
+
fill: "currentColor",
|
|
2300
|
+
"aria-hidden": "true",
|
|
2301
|
+
focusable: "false",
|
|
2302
|
+
children: [
|
|
2303
|
+
/* @__PURE__ */ f("circle", {
|
|
2304
|
+
cx: "10",
|
|
2305
|
+
cy: "4",
|
|
2306
|
+
r: "1.6"
|
|
2307
|
+
}),
|
|
2308
|
+
/* @__PURE__ */ f("circle", {
|
|
2309
|
+
cx: "10",
|
|
2310
|
+
cy: "10",
|
|
2311
|
+
r: "1.6"
|
|
2312
|
+
}),
|
|
2313
|
+
/* @__PURE__ */ f("circle", {
|
|
2314
|
+
cx: "10",
|
|
2315
|
+
cy: "16",
|
|
2316
|
+
r: "1.6"
|
|
2317
|
+
})
|
|
2318
|
+
]
|
|
2319
|
+
})
|
|
2320
|
+
}), b && S ? m(/* @__PURE__ */ f("div", {
|
|
2321
|
+
ref: y,
|
|
2322
|
+
id: _,
|
|
2323
|
+
role: "menu",
|
|
2324
|
+
"aria-label": n,
|
|
2325
|
+
className: Nt.menu,
|
|
2326
|
+
style: S,
|
|
2327
|
+
"data-theme": w,
|
|
2328
|
+
onKeyDown: (e) => {
|
|
2329
|
+
let t = {
|
|
2330
|
+
ArrowDown: () => P(1),
|
|
2331
|
+
ArrowUp: () => P(-1),
|
|
2332
|
+
Home: () => P("first"),
|
|
2333
|
+
End: () => P("last"),
|
|
2334
|
+
Escape: () => N(),
|
|
2335
|
+
Tab: () => N()
|
|
2336
|
+
}[e.key];
|
|
2337
|
+
t && (e.key !== "Tab" && (e.preventDefault(), e.stopPropagation()), t());
|
|
2338
|
+
},
|
|
2339
|
+
children: e.map((e, t) => /* @__PURE__ */ p("button", {
|
|
2340
|
+
type: "button",
|
|
2341
|
+
role: "menuitem",
|
|
2342
|
+
tabIndex: -1,
|
|
2343
|
+
"aria-disabled": e.disabled || void 0,
|
|
2344
|
+
className: h(Nt.item, e.variant === "danger" && Nt.danger),
|
|
2345
|
+
onClick: () => {
|
|
2346
|
+
if (!e.disabled) try {
|
|
2347
|
+
e.onClick();
|
|
2348
|
+
} finally {
|
|
2349
|
+
N();
|
|
2350
|
+
}
|
|
2351
|
+
},
|
|
2352
|
+
children: [/* @__PURE__ */ f("span", {
|
|
2353
|
+
className: Nt.label,
|
|
2354
|
+
children: e.label
|
|
2355
|
+
}), e.icon ? /* @__PURE__ */ f("span", {
|
|
2356
|
+
className: Nt.icon,
|
|
2357
|
+
"aria-hidden": "true",
|
|
2358
|
+
children: e.icon
|
|
2359
|
+
}) : null]
|
|
2360
|
+
}, `${e.label}-${t}`))
|
|
2361
|
+
}), document.body) : null]
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
var zt = {
|
|
2365
|
+
root: "cui-Skeleton-module__root--qaX19",
|
|
2366
|
+
"cui-skeleton-pulse": "cui-Skeleton-module__cui-skeleton-pulse--HzSoY",
|
|
2367
|
+
rect: "cui-Skeleton-module__rect--do1uR",
|
|
2368
|
+
text: "cui-Skeleton-module__text---A8IF",
|
|
2369
|
+
circle: "cui-Skeleton-module__circle--DYcl8"
|
|
2370
|
+
};
|
|
2371
|
+
//#endregion
|
|
2372
|
+
//#region src/components/Skeleton/Skeleton.tsx
|
|
2373
|
+
function Bt({ variant: e = "rect", width: t, height: n, className: r, style: i, ...a }) {
|
|
2374
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
2375
|
+
let o = {
|
|
2376
|
+
width: t,
|
|
2377
|
+
height: n ?? (e === "circle" ? t : void 0)
|
|
2378
|
+
};
|
|
2379
|
+
return /* @__PURE__ */ f("span", {
|
|
2380
|
+
"aria-hidden": "true",
|
|
2381
|
+
...a,
|
|
2382
|
+
className: h(zt.root, zt[e], r),
|
|
2383
|
+
style: {
|
|
2384
|
+
...o,
|
|
2385
|
+
...i
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2389
|
+
var Z = {
|
|
2390
|
+
root: "cui-DataTable-module__root--HvZz-",
|
|
2391
|
+
toolbar: "cui-DataTable-module__toolbar--4lbQW",
|
|
2392
|
+
tableArea: "cui-DataTable-module__tableArea--2IsW7",
|
|
2393
|
+
scroll: "cui-DataTable-module__scroll--grEU0",
|
|
2394
|
+
selectCell: "cui-DataTable-module__selectCell--yjLWA",
|
|
2395
|
+
actionsColumn: "cui-DataTable-module__actionsColumn--6fXOt",
|
|
2396
|
+
actions: "cui-DataTable-module__actions--1wPSm",
|
|
2397
|
+
actionButton: "cui-DataTable-module__actionButton--ihRbN",
|
|
2398
|
+
actionDanger: "cui-DataTable-module__actionDanger--CkExi",
|
|
2399
|
+
actionText: "cui-DataTable-module__actionText--6T0WJ",
|
|
2400
|
+
cellText: "cui-DataTable-module__cellText--1ji4z",
|
|
2401
|
+
stateBox: "cui-DataTable-module__stateBox--O065C",
|
|
2402
|
+
empty: "cui-DataTable-module__empty--s0Jz2",
|
|
2403
|
+
emptyIcon: "cui-DataTable-module__emptyIcon--RgTU-",
|
|
2404
|
+
errorCell: "cui-DataTable-module__errorCell--xz1j4",
|
|
2405
|
+
errorIcon: "cui-DataTable-module__errorIcon--Wtuhr",
|
|
2406
|
+
errorText: "cui-DataTable-module__errorText--Huxzu",
|
|
2407
|
+
footer: "cui-DataTable-module__footer--1nvuh",
|
|
2408
|
+
srOnly: "cui-DataTable-module__srOnly--oPO5S",
|
|
2409
|
+
selectionBar: "cui-DataTable-module__selectionBar--EPNRt",
|
|
2410
|
+
selectionCount: "cui-DataTable-module__selectionCount--6vKgz",
|
|
2411
|
+
selectionDivider: "cui-DataTable-module__selectionDivider--Ye0rn",
|
|
2412
|
+
bulkButton: "cui-DataTable-module__bulkButton--YxXgc",
|
|
2413
|
+
bulkDanger: "cui-DataTable-module__bulkDanger--nRDT6",
|
|
2414
|
+
selectionClear: "cui-DataTable-module__selectionClear--XAB0l"
|
|
2415
|
+
};
|
|
2416
|
+
//#endregion
|
|
2417
|
+
//#region src/components/DataTable/SelectionBar.tsx
|
|
2418
|
+
function Vt({ count: e, actions: t = [], onClear: n, className: r }) {
|
|
2419
|
+
return e <= 0 ? null : /* @__PURE__ */ p("div", {
|
|
2420
|
+
role: "region",
|
|
2421
|
+
"aria-label": "Selection",
|
|
2422
|
+
className: h(Z.selectionBar, r),
|
|
2423
|
+
children: [
|
|
2424
|
+
/* @__PURE__ */ p("span", {
|
|
2425
|
+
className: Z.selectionCount,
|
|
2426
|
+
"aria-live": "polite",
|
|
2427
|
+
children: [e, " selected"]
|
|
2428
|
+
}),
|
|
2429
|
+
t.length > 0 ? /* @__PURE__ */ f("span", {
|
|
2430
|
+
className: Z.selectionDivider,
|
|
2431
|
+
"aria-hidden": "true"
|
|
2432
|
+
}) : null,
|
|
2433
|
+
t.map((e) => /* @__PURE__ */ p(j, {
|
|
2434
|
+
variant: "outline",
|
|
2435
|
+
size: "sm",
|
|
2436
|
+
className: h(Z.bulkButton, e.variant === "danger" && Z.bulkDanger),
|
|
2437
|
+
disabled: e.disabled,
|
|
2438
|
+
onClick: e.onClick,
|
|
2439
|
+
children: [e.icon, e.label]
|
|
2440
|
+
}, e.label)),
|
|
2441
|
+
/* @__PURE__ */ f("button", {
|
|
2442
|
+
type: "button",
|
|
2443
|
+
className: Z.selectionClear,
|
|
2444
|
+
onClick: n,
|
|
2445
|
+
children: "Clear selection"
|
|
2446
|
+
})
|
|
2447
|
+
]
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
//#endregion
|
|
2451
|
+
//#region src/components/TableFilters/FilterValueControl.tsx
|
|
2452
|
+
function Ht({ field: e, value: t, onChange: n, label: r, ariaLabel: i, size: a = "md", placeholder: o }) {
|
|
2453
|
+
let s = r ? { label: r } : { "aria-label": i ?? e.label };
|
|
2454
|
+
return e.type === "select" ? /* @__PURE__ */ f(mt, {
|
|
2455
|
+
...s,
|
|
2456
|
+
size: a,
|
|
2457
|
+
placeholder: o ?? e.placeholder ?? `Any ${e.label.toLowerCase()}`,
|
|
2458
|
+
options: e.options ?? [],
|
|
2459
|
+
value: t,
|
|
2460
|
+
onChange: n
|
|
2461
|
+
}) : e.type === "date" ? /* @__PURE__ */ f(me, {
|
|
2462
|
+
...s,
|
|
2463
|
+
size: a,
|
|
2464
|
+
placeholder: o ?? e.placeholder,
|
|
2465
|
+
value: t,
|
|
2466
|
+
onChange: n
|
|
2467
|
+
}) : /* @__PURE__ */ f(Me, {
|
|
2468
|
+
...s,
|
|
2469
|
+
size: a,
|
|
2470
|
+
placeholder: o ?? e.placeholder,
|
|
2471
|
+
value: t,
|
|
2472
|
+
onChange: (e) => n(e.target.value)
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
var Ut = {
|
|
2476
|
+
root: "cui-TableFilters-module__root--zi-Kz",
|
|
2477
|
+
bar: "cui-TableFilters-module__bar--B-b9P",
|
|
2478
|
+
barEnd: "cui-TableFilters-module__barEnd--HPVWe",
|
|
2479
|
+
search: "cui-TableFilters-module__search--QrMo-",
|
|
2480
|
+
actions: "cui-TableFilters-module__actions--UnPiI",
|
|
2481
|
+
filtersIcon: "cui-TableFilters-module__filtersIcon--XyAIP",
|
|
2482
|
+
panelFooter: "cui-TableFilters-module__panelFooter--xaqMb",
|
|
2483
|
+
count: "cui-TableFilters-module__count--5M3Un",
|
|
2484
|
+
chips: "cui-TableFilters-module__chips--reWRQ",
|
|
2485
|
+
chip: "cui-TableFilters-module__chip--QEswZ",
|
|
2486
|
+
chipLabel: "cui-TableFilters-module__chipLabel--CzGgZ",
|
|
2487
|
+
chipValue: "cui-TableFilters-module__chipValue---2oKH",
|
|
2488
|
+
chipRemove: "cui-TableFilters-module__chipRemove--6xGcC",
|
|
2489
|
+
clearAll: "cui-TableFilters-module__clearAll--wPJlE",
|
|
2490
|
+
dynamic: "cui-TableFilters-module__dynamic--Y3yu6",
|
|
2491
|
+
noFilters: "cui-TableFilters-module__noFilters--bCV6B",
|
|
2492
|
+
rows: "cui-TableFilters-module__rows--Zj1HM",
|
|
2493
|
+
row: "cui-TableFilters-module__row--smRHE",
|
|
2494
|
+
rowField: "cui-TableFilters-module__rowField--n7iAh",
|
|
2495
|
+
rowValue: "cui-TableFilters-module__rowValue--VTRCH",
|
|
2496
|
+
rowRemove: "cui-TableFilters-module__rowRemove--ddRMK"
|
|
2497
|
+
}, Wt = 0, Gt = () => Wt += 1;
|
|
2498
|
+
function Kt(e) {
|
|
2499
|
+
return Object.entries(e).map(([e, t]) => ({
|
|
2500
|
+
id: Gt(),
|
|
2501
|
+
key: e,
|
|
2502
|
+
value: t
|
|
2503
|
+
}));
|
|
2504
|
+
}
|
|
2505
|
+
function qt(e) {
|
|
2506
|
+
let t = {};
|
|
2507
|
+
for (let n of e) n.key && n.value.trim() !== "" && (t[n.key] = n.value);
|
|
2508
|
+
return t;
|
|
2509
|
+
}
|
|
2510
|
+
function Jt({ fields: e, rows: t, onChange: n }) {
|
|
2511
|
+
let r = new Set(t.map((e) => e.key).filter(Boolean)), i = e.filter((e) => !r.has(e.key)), a = (e, r) => n(t.map((t) => t.id === e ? {
|
|
2512
|
+
...t,
|
|
2513
|
+
...r
|
|
2514
|
+
} : t));
|
|
2515
|
+
return /* @__PURE__ */ p("div", {
|
|
2516
|
+
className: Ut.dynamic,
|
|
2517
|
+
children: [t.length === 0 ? /* @__PURE__ */ f("p", {
|
|
2518
|
+
className: Ut.noFilters,
|
|
2519
|
+
children: "No filters yet. Add one to narrow down the table."
|
|
2520
|
+
}) : /* @__PURE__ */ f("ul", {
|
|
2521
|
+
className: Ut.rows,
|
|
2522
|
+
children: t.map((i, o) => {
|
|
2523
|
+
let s = e.find((e) => e.key === i.key), c = e.filter((e) => e.key === i.key || !r.has(e.key));
|
|
2524
|
+
return /* @__PURE__ */ p("li", {
|
|
2525
|
+
className: Ut.row,
|
|
2526
|
+
"aria-label": `Filter ${o + 1}`,
|
|
2527
|
+
children: [
|
|
2528
|
+
/* @__PURE__ */ f("div", {
|
|
2529
|
+
className: Ut.rowField,
|
|
2530
|
+
children: /* @__PURE__ */ f(mt, {
|
|
2531
|
+
"aria-label": `Field for filter ${o + 1}`,
|
|
2532
|
+
size: "sm",
|
|
2533
|
+
clearable: !1,
|
|
2534
|
+
value: i.key,
|
|
2535
|
+
options: c.map((e) => ({
|
|
2536
|
+
label: e.label,
|
|
2537
|
+
value: e.key
|
|
2538
|
+
})),
|
|
2539
|
+
onChange: (e) => a(i.id, {
|
|
2540
|
+
key: e,
|
|
2541
|
+
value: ""
|
|
2542
|
+
})
|
|
2543
|
+
})
|
|
2544
|
+
}),
|
|
2545
|
+
/* @__PURE__ */ f("div", {
|
|
2546
|
+
className: Ut.rowValue,
|
|
2547
|
+
children: s ? /* @__PURE__ */ f(Ht, {
|
|
2548
|
+
field: s,
|
|
2549
|
+
value: i.value,
|
|
2550
|
+
size: "sm",
|
|
2551
|
+
ariaLabel: `Value for ${s.label}`,
|
|
2552
|
+
onChange: (e) => a(i.id, { value: e })
|
|
2553
|
+
}, s.key) : null
|
|
2554
|
+
}),
|
|
2555
|
+
/* @__PURE__ */ f("button", {
|
|
2556
|
+
type: "button",
|
|
2557
|
+
className: Ut.rowRemove,
|
|
2558
|
+
"aria-label": `Delete ${s?.label ?? "empty"} filter`,
|
|
2559
|
+
onClick: () => n(t.filter((e) => e.id !== i.id)),
|
|
2560
|
+
children: /* @__PURE__ */ f("svg", {
|
|
2561
|
+
viewBox: "0 0 20 20",
|
|
2562
|
+
fill: "none",
|
|
2563
|
+
stroke: "currentColor",
|
|
2564
|
+
strokeWidth: "2",
|
|
2565
|
+
strokeLinecap: "round",
|
|
2566
|
+
"aria-hidden": "true",
|
|
2567
|
+
focusable: "false",
|
|
2568
|
+
children: /* @__PURE__ */ f("path", { d: "M6 6l8 8M14 6l-8 8" })
|
|
2569
|
+
})
|
|
2570
|
+
})
|
|
2571
|
+
]
|
|
2572
|
+
}, i.id);
|
|
2573
|
+
})
|
|
2574
|
+
}), /* @__PURE__ */ f(j, {
|
|
2575
|
+
variant: "outline",
|
|
2576
|
+
size: "sm",
|
|
2577
|
+
disabled: i.length === 0,
|
|
2578
|
+
onClick: () => {
|
|
2579
|
+
let e = i[0];
|
|
2580
|
+
e && n([...t, {
|
|
2581
|
+
id: Gt(),
|
|
2582
|
+
key: e.key,
|
|
2583
|
+
value: ""
|
|
2584
|
+
}]);
|
|
2585
|
+
},
|
|
2586
|
+
children: "+ Add filter"
|
|
2587
|
+
})]
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
//#endregion
|
|
2591
|
+
//#region src/components/TableFilters/filterUtils.ts
|
|
2592
|
+
function Yt(e) {
|
|
2593
|
+
return Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e.trim() !== ""));
|
|
2594
|
+
}
|
|
2595
|
+
function Xt(e, t) {
|
|
2596
|
+
return e.type === "select" ? e.options?.find((e) => e.value === t)?.label ?? t : t;
|
|
2597
|
+
}
|
|
2598
|
+
//#endregion
|
|
2599
|
+
//#region src/components/TableFilters/TableFilters.tsx
|
|
2600
|
+
function Zt({ fields: e, values: t, onApply: n, onClose: r, title: i }) {
|
|
2601
|
+
let [a, o] = l(() => Kt(t));
|
|
2602
|
+
return /* @__PURE__ */ f(ot, {
|
|
2603
|
+
open: !0,
|
|
2604
|
+
onClose: r,
|
|
2605
|
+
title: i,
|
|
2606
|
+
description: "Add the filters you want to use.",
|
|
2607
|
+
size: "sm",
|
|
2608
|
+
footer: /* @__PURE__ */ p("div", {
|
|
2609
|
+
className: Ut.panelFooter,
|
|
2610
|
+
children: [/* @__PURE__ */ f(j, {
|
|
2611
|
+
variant: "outline",
|
|
2612
|
+
disabled: a.length === 0,
|
|
2613
|
+
onClick: () => o([]),
|
|
2614
|
+
children: "Reset"
|
|
2615
|
+
}), /* @__PURE__ */ f(j, {
|
|
2616
|
+
onClick: () => {
|
|
2617
|
+
n(qt(a)), r();
|
|
2618
|
+
},
|
|
2619
|
+
children: "Apply Filters"
|
|
2620
|
+
})]
|
|
2621
|
+
}),
|
|
2622
|
+
children: /* @__PURE__ */ f(Jt, {
|
|
2623
|
+
fields: e,
|
|
2624
|
+
rows: a,
|
|
2625
|
+
onChange: o
|
|
2626
|
+
})
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
function Qt({ search: e = "", onSearchChange: t, searchPlaceholder: n = "Search...", searchDelay: r = 0, fields: i, values: o, onValuesChange: s, panelTitle: u = "Filters", className: d }) {
|
|
2630
|
+
let m = D(), [g, _] = l(!1), [v, y] = l(e), b = c(void 0), x = c(e);
|
|
2631
|
+
if (x.current !== e && (x.current = e, e !== v && y(e)), a(() => () => clearTimeout(b.current), []), !m) return /* @__PURE__ */ f(k, {});
|
|
2632
|
+
let S = Yt(o), C = (i ?? []).filter((e) => S[e.key] !== void 0), w = !!(i && i.length > 0 && s), T = (e) => {
|
|
2633
|
+
y(e), clearTimeout(b.current), r > 0 ? b.current = setTimeout(() => t?.(e), r) : t?.(e);
|
|
2634
|
+
};
|
|
2635
|
+
return /* @__PURE__ */ p("div", {
|
|
2636
|
+
className: h(Ut.root, d),
|
|
2637
|
+
children: [
|
|
2638
|
+
/* @__PURE__ */ p("div", {
|
|
2639
|
+
className: Ut.bar,
|
|
2640
|
+
children: [t ? /* @__PURE__ */ f("div", {
|
|
2641
|
+
className: Ut.search,
|
|
2642
|
+
children: /* @__PURE__ */ f(Ie, {
|
|
2643
|
+
"aria-label": "Search",
|
|
2644
|
+
placeholder: n,
|
|
2645
|
+
value: v,
|
|
2646
|
+
onChange: (e) => T(e.target.value),
|
|
2647
|
+
onClear: () => T("")
|
|
2648
|
+
})
|
|
2649
|
+
}) : null, /* @__PURE__ */ f("div", {
|
|
2650
|
+
className: Ut.barEnd,
|
|
2651
|
+
children: w ? /* @__PURE__ */ p(j, {
|
|
2652
|
+
variant: "outline",
|
|
2653
|
+
size: "sm",
|
|
2654
|
+
"aria-haspopup": "dialog",
|
|
2655
|
+
onClick: () => _(!0),
|
|
2656
|
+
children: [
|
|
2657
|
+
/* @__PURE__ */ f("svg", {
|
|
2658
|
+
className: Ut.filtersIcon,
|
|
2659
|
+
viewBox: "0 0 20 20",
|
|
2660
|
+
fill: "none",
|
|
2661
|
+
stroke: "currentColor",
|
|
2662
|
+
strokeWidth: "1.8",
|
|
2663
|
+
strokeLinecap: "round",
|
|
2664
|
+
strokeLinejoin: "round",
|
|
2665
|
+
"aria-hidden": "true",
|
|
2666
|
+
focusable: "false",
|
|
2667
|
+
children: /* @__PURE__ */ f("path", { d: "M3 5.5h14M5.5 10h9M8 14.5h4" })
|
|
2668
|
+
}),
|
|
2669
|
+
"Filters",
|
|
2670
|
+
C.length > 0 ? /* @__PURE__ */ f("span", {
|
|
2671
|
+
className: Ut.count,
|
|
2672
|
+
"aria-label": `${C.length} active`,
|
|
2673
|
+
children: C.length
|
|
2674
|
+
}) : null
|
|
2675
|
+
]
|
|
2676
|
+
}) : null
|
|
2677
|
+
})]
|
|
2678
|
+
}),
|
|
2679
|
+
C.length > 0 ? /* @__PURE__ */ p("ul", {
|
|
2680
|
+
className: Ut.chips,
|
|
2681
|
+
"aria-label": "Active filters",
|
|
2682
|
+
children: [C.map((e) => /* @__PURE__ */ p("li", {
|
|
2683
|
+
className: Ut.chip,
|
|
2684
|
+
children: [
|
|
2685
|
+
/* @__PURE__ */ p("span", {
|
|
2686
|
+
className: Ut.chipLabel,
|
|
2687
|
+
children: [e.label, ":"]
|
|
2688
|
+
}),
|
|
2689
|
+
" ",
|
|
2690
|
+
/* @__PURE__ */ f("strong", {
|
|
2691
|
+
className: Ut.chipValue,
|
|
2692
|
+
children: Xt(e, S[e.key])
|
|
2693
|
+
}),
|
|
2694
|
+
/* @__PURE__ */ f("button", {
|
|
2695
|
+
type: "button",
|
|
2696
|
+
className: Ut.chipRemove,
|
|
2697
|
+
"aria-label": `Remove filter ${e.label}`,
|
|
2698
|
+
onClick: () => {
|
|
2699
|
+
let { [e.key]: t, ...n } = S;
|
|
2700
|
+
s?.(n);
|
|
2701
|
+
},
|
|
2702
|
+
children: /* @__PURE__ */ f("svg", {
|
|
2703
|
+
viewBox: "0 0 20 20",
|
|
2704
|
+
fill: "none",
|
|
2705
|
+
stroke: "currentColor",
|
|
2706
|
+
strokeWidth: "2",
|
|
2707
|
+
strokeLinecap: "round",
|
|
2708
|
+
"aria-hidden": "true",
|
|
2709
|
+
focusable: "false",
|
|
2710
|
+
children: /* @__PURE__ */ f("path", { d: "M6 6l8 8M14 6l-8 8" })
|
|
2711
|
+
})
|
|
2712
|
+
})
|
|
2713
|
+
]
|
|
2714
|
+
}, e.key)), /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
|
|
2715
|
+
type: "button",
|
|
2716
|
+
className: Ut.clearAll,
|
|
2717
|
+
onClick: () => s?.({}),
|
|
2718
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
2719
|
+
viewBox: "0 0 20 20",
|
|
2720
|
+
fill: "none",
|
|
2721
|
+
stroke: "currentColor",
|
|
2722
|
+
strokeWidth: "1.8",
|
|
2723
|
+
strokeLinecap: "round",
|
|
2724
|
+
strokeLinejoin: "round",
|
|
2725
|
+
"aria-hidden": "true",
|
|
2726
|
+
focusable: "false",
|
|
2727
|
+
children: /* @__PURE__ */ f("path", { d: "M4 10a6 6 0 106-6H7M7 1.5L4.5 4 7 6.5" })
|
|
2728
|
+
}), "Clear all"]
|
|
2729
|
+
}) })]
|
|
2730
|
+
}) : null,
|
|
2731
|
+
g && w ? /* @__PURE__ */ f(Zt, {
|
|
2732
|
+
fields: i ?? [],
|
|
2733
|
+
values: S,
|
|
2734
|
+
title: u,
|
|
2735
|
+
onApply: (e) => s?.(e),
|
|
2736
|
+
onClose: () => _(!1)
|
|
2737
|
+
}) : null
|
|
2738
|
+
]
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
//#endregion
|
|
2742
|
+
//#region src/components/DataTable/dataTableUtils.ts
|
|
2743
|
+
function $t(e, t) {
|
|
2744
|
+
return e.accessor ? e.accessor(t) : t[String(e.accessorKey)];
|
|
2745
|
+
}
|
|
2746
|
+
var en = (e) => e == null ? "" : e instanceof Date ? e.toISOString() : String(e);
|
|
2747
|
+
function tn(e, t, n) {
|
|
2748
|
+
let r = n.trim().toLowerCase();
|
|
2749
|
+
return r ? e.filter((e) => t.some((t) => (t.searchValue ? t.searchValue(e) : en($t(t, e))).toLowerCase().includes(r))) : e;
|
|
2750
|
+
}
|
|
2751
|
+
function nn(e, t, n) {
|
|
2752
|
+
let r = Object.entries(n).filter(([, e]) => e.trim() !== "");
|
|
2753
|
+
return r.length === 0 ? e : e.filter((e) => r.every(([n, r]) => {
|
|
2754
|
+
let i = t.find((e) => String(e.accessorKey) === n);
|
|
2755
|
+
if (!i) return !0;
|
|
2756
|
+
if (i.filterFn) return i.filterFn(e, r);
|
|
2757
|
+
let a = en($t(i, e));
|
|
2758
|
+
return i.filterType === "select" || i.filterType === "date" ? a === r : a.toLowerCase().includes(r.trim().toLowerCase());
|
|
2759
|
+
}));
|
|
2760
|
+
}
|
|
2761
|
+
var rn = new Intl.Collator(void 0, {
|
|
2762
|
+
numeric: !0,
|
|
2763
|
+
sensitivity: "base"
|
|
2764
|
+
});
|
|
2765
|
+
function an(e, t, n) {
|
|
2766
|
+
if (!n) return e;
|
|
2767
|
+
let r = t.find((e) => String(e.accessorKey) === n.key);
|
|
2768
|
+
if (!r) return e;
|
|
2769
|
+
let i = (e) => r.sortValue ? r.sortValue(e) : $t(r, e), a = n.direction === "asc" ? 1 : -1;
|
|
2770
|
+
return e.map((e, t) => ({
|
|
2771
|
+
row: e,
|
|
2772
|
+
index: t,
|
|
2773
|
+
value: i(e)
|
|
2774
|
+
})).sort((e, t) => {
|
|
2775
|
+
let n = e.value === null || e.value === void 0 || e.value === "", r = t.value === null || t.value === void 0 || t.value === "";
|
|
2776
|
+
if (n || r) return n === r ? e.index - t.index : n ? 1 : -1;
|
|
2777
|
+
let i = typeof e.value == "number" && typeof t.value == "number" ? e.value - t.value : e.value instanceof Date && t.value instanceof Date ? e.value.getTime() - t.value.getTime() : rn.compare(en(e.value), en(t.value));
|
|
2778
|
+
return i === 0 ? e.index - t.index : i * a;
|
|
2779
|
+
}).map((e) => e.row);
|
|
2780
|
+
}
|
|
2781
|
+
function on(e, t, n) {
|
|
2782
|
+
let r = (Math.max(1, t) - 1) * n;
|
|
2783
|
+
return e.slice(r, r + n);
|
|
2784
|
+
}
|
|
2785
|
+
function sn(e, t) {
|
|
2786
|
+
return !e || e.key !== t ? {
|
|
2787
|
+
key: t,
|
|
2788
|
+
direction: "asc"
|
|
2789
|
+
} : e.direction === "asc" ? {
|
|
2790
|
+
key: t,
|
|
2791
|
+
direction: "desc"
|
|
2792
|
+
} : null;
|
|
2793
|
+
}
|
|
2794
|
+
//#endregion
|
|
2795
|
+
//#region src/components/DataTable/remote.ts
|
|
2796
|
+
var cn = [
|
|
2797
|
+
10,
|
|
2798
|
+
15,
|
|
2799
|
+
20,
|
|
2800
|
+
50,
|
|
2801
|
+
100
|
|
2802
|
+
], ln = async (e, t) => await (await fetch(e, t)).json();
|
|
2803
|
+
function un(e) {
|
|
2804
|
+
let t = /^https?:/i.test(e.fetchUrl) ? e.fetchUrl : `${e.apiBaseUrl ?? ""}${e.fetchUrl}`, n = [];
|
|
2805
|
+
e.search && n.push(`searchText:${e.search}`), e.additionalFilter && n.push(e.additionalFilter), e.sort && (n.push(`orderByColumn:${e.sort.key}`), n.push(`orderBy:${e.sort.direction}`));
|
|
2806
|
+
for (let [t, r] of Object.entries(e.filters)) r && n.push(`${t}:${r}`);
|
|
2807
|
+
let r = new URLSearchParams();
|
|
2808
|
+
return r.append("pageNo", String(e.pageNo)), r.append("pageSize", String(e.pageSize)), n.length > 0 && r.append("filter", n.join(";")), `${t}${t.includes("?") ? "&" : "?"}${r.toString()}`;
|
|
2809
|
+
}
|
|
2810
|
+
function dn(e) {
|
|
2811
|
+
let t = e.data, n = Array.isArray(t) ? t : t?.items ?? t ?? [], r = Array.isArray(t) ? {} : t ?? {};
|
|
2812
|
+
return {
|
|
2813
|
+
rows: Array.isArray(n) ? n : [],
|
|
2814
|
+
totalPages: r.totalPage ?? 0,
|
|
2815
|
+
totalItems: r.totalData ?? 0
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
var fn = class extends Error {};
|
|
2819
|
+
async function pn(e, t) {
|
|
2820
|
+
let n = await t(e, { method: "GET" });
|
|
2821
|
+
if (n.status === !1) throw new fn(n.message || "Failed to fetch data");
|
|
2822
|
+
return dn(n);
|
|
2823
|
+
}
|
|
2824
|
+
async function mn(e, t) {
|
|
2825
|
+
let n = [], r = 1, i;
|
|
2826
|
+
do {
|
|
2827
|
+
let a = await pn(e(r, 100), t);
|
|
2828
|
+
n.push(...a.rows), i = a.totalPages || 1, r += 1;
|
|
2829
|
+
} while (r <= i && r <= 100);
|
|
2830
|
+
return n;
|
|
2831
|
+
}
|
|
2832
|
+
//#endregion
|
|
2833
|
+
//#region src/components/DataTable/useDebouncedValue.ts
|
|
2834
|
+
function hn(e, t) {
|
|
2835
|
+
let [n, r] = l(e);
|
|
2836
|
+
return a(() => {
|
|
2837
|
+
if (t <= 0) return;
|
|
2838
|
+
let n = setTimeout(() => r(e), t);
|
|
2839
|
+
return () => clearTimeout(n);
|
|
2840
|
+
}, [e, t]), t <= 0 ? e : n;
|
|
2841
|
+
}
|
|
2842
|
+
//#endregion
|
|
2843
|
+
//#region src/components/DataTable/DataTable.tsx
|
|
2844
|
+
var gn = [
|
|
2845
|
+
128,
|
|
2846
|
+
80,
|
|
2847
|
+
96
|
|
2848
|
+
], _n = (e) => e === "left" ? "start" : e === "right" ? "end" : e, vn = /* @__PURE__ */ p("svg", {
|
|
2849
|
+
viewBox: "0 0 24 24",
|
|
2850
|
+
fill: "none",
|
|
2851
|
+
stroke: "currentColor",
|
|
2852
|
+
strokeWidth: "1.8",
|
|
2853
|
+
strokeLinecap: "round",
|
|
2854
|
+
strokeLinejoin: "round",
|
|
2855
|
+
"aria-hidden": "true",
|
|
2856
|
+
focusable: "false",
|
|
2857
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
2858
|
+
cx: "12",
|
|
2859
|
+
cy: "12",
|
|
2860
|
+
r: "9"
|
|
2861
|
+
}), /* @__PURE__ */ f("path", { d: "M12 7.5v5M12 16h.01" })]
|
|
2862
|
+
}), yn = /* @__PURE__ */ p("svg", {
|
|
2863
|
+
viewBox: "0 0 24 24",
|
|
2864
|
+
fill: "none",
|
|
2865
|
+
stroke: "currentColor",
|
|
2866
|
+
strokeWidth: "1.6",
|
|
2867
|
+
strokeLinecap: "round",
|
|
2868
|
+
strokeLinejoin: "round",
|
|
2869
|
+
"aria-hidden": "true",
|
|
2870
|
+
focusable: "false",
|
|
2871
|
+
children: [/* @__PURE__ */ f("rect", {
|
|
2872
|
+
x: "3",
|
|
2873
|
+
y: "4",
|
|
2874
|
+
width: "18",
|
|
2875
|
+
height: "5",
|
|
2876
|
+
rx: "1"
|
|
2877
|
+
}), /* @__PURE__ */ f("path", { d: "M5 9v9a1 1 0 001 1h12a1 1 0 001-1V9M10 13h4" })]
|
|
2878
|
+
});
|
|
2879
|
+
function bn({ columns: e, data: t, fetchUrl: n, apiBaseUrl: r, callApi: i = ln, additionalFilter: o, refreshTrigger: c, debounceMs: u, registerApi: d, getRowId: m, loading: g = !1, loadingRows: _ = 5, emptyMessage: v, emptyState: y, searchable: b = !0, searchPlaceholder: x, search: S, defaultSearch: C = "", onSearchChange: w, filters: T, defaultFilters: E, onFiltersChange: O, manualFiltering: A = !1, sort: M, defaultSort: N = null, onSortChange: P, manualSorting: F = !1, pagination: I, page: L, defaultPage: R = 1, onPageChange: z, pageSize: B, defaultPageSize: V = 10, onPageSizeChange: H, pageSizeOptions: ee = cn, manualPagination: U = !1, totalItems: te, selection: W, onRowClick: ne, actions: re, actionsClassName: ie, belowToolbar: ae, bulkActions: oe, caption: G, stickyHeader: se = !0, className: ce, tableClassName: K, containerClassName: le, "aria-label": ue }) {
|
|
2880
|
+
let de = D(), q = n !== void 0, fe = I ?? !0, [pe, me] = l(C), [he, ge] = l(E ?? {}), [_e, ve] = l(N), [ye, be] = l(R), [xe, Se] = l(V), Ce = S ?? pe, we = T ?? he, Te = M === void 0 ? _e : M, Ee = B ?? xe, De = L ?? ye, Oe = s(() => e.filter((e) => e.filterable).map((e) => ({
|
|
2881
|
+
key: String(e.accessorKey),
|
|
2882
|
+
label: typeof e.header == "string" ? e.header : String(e.accessorKey),
|
|
2883
|
+
type: e.filterType ?? "text",
|
|
2884
|
+
options: e.filterOptions
|
|
2885
|
+
})), [e]), ke = () => {
|
|
2886
|
+
De !== 1 && (L === void 0 && be(1), z?.(1));
|
|
2887
|
+
}, Ae = (e) => {
|
|
2888
|
+
S === void 0 && me(e), w?.(e), ke();
|
|
2889
|
+
}, je = (e) => {
|
|
2890
|
+
T === void 0 && ge(e), O?.(e), ke();
|
|
2891
|
+
}, Me = (e) => {
|
|
2892
|
+
let t = sn(Te, e);
|
|
2893
|
+
M === void 0 && ve(t), P?.(t);
|
|
2894
|
+
}, Ne = (e) => {
|
|
2895
|
+
L === void 0 && be(e), z?.(e);
|
|
2896
|
+
}, Pe = (e) => {
|
|
2897
|
+
B === void 0 && Se(e), H?.(e), ke();
|
|
2898
|
+
}, Fe = u ?? (q ? 500 : 0), Ie = hn(Ce, Fe), Le = hn(we, Fe), Re = JSON.stringify([
|
|
2899
|
+
n,
|
|
2900
|
+
r,
|
|
2901
|
+
o,
|
|
2902
|
+
c,
|
|
2903
|
+
fe,
|
|
2904
|
+
De,
|
|
2905
|
+
Ee,
|
|
2906
|
+
Te,
|
|
2907
|
+
Ie,
|
|
2908
|
+
Le
|
|
2909
|
+
]), [ze, Be] = l(null);
|
|
2910
|
+
a(() => {
|
|
2911
|
+
if (!q) return;
|
|
2912
|
+
let e = !1, t = (e, t) => un({
|
|
2913
|
+
fetchUrl: n,
|
|
2914
|
+
apiBaseUrl: r,
|
|
2915
|
+
pageNo: e,
|
|
2916
|
+
pageSize: t,
|
|
2917
|
+
search: Ie,
|
|
2918
|
+
additionalFilter: o,
|
|
2919
|
+
sort: Te,
|
|
2920
|
+
filters: Le
|
|
2921
|
+
});
|
|
2922
|
+
return (async () => {
|
|
2923
|
+
try {
|
|
2924
|
+
if (fe) {
|
|
2925
|
+
let e = await pn(t(De, Ee), i);
|
|
2926
|
+
return {
|
|
2927
|
+
key: Re,
|
|
2928
|
+
error: null,
|
|
2929
|
+
...e
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2932
|
+
let e = await mn(t, i);
|
|
2933
|
+
return {
|
|
2934
|
+
key: Re,
|
|
2935
|
+
error: null,
|
|
2936
|
+
rows: e,
|
|
2937
|
+
totalPages: 0,
|
|
2938
|
+
totalItems: 0
|
|
2939
|
+
};
|
|
2940
|
+
} catch (e) {
|
|
2941
|
+
let t = e instanceof Error && e.message ? e.message : "An unexpected error occurred";
|
|
2942
|
+
return {
|
|
2943
|
+
key: Re,
|
|
2944
|
+
error: t,
|
|
2945
|
+
rows: [],
|
|
2946
|
+
totalPages: 0,
|
|
2947
|
+
totalItems: 0
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
})().then((t) => {
|
|
2951
|
+
e || Be(t);
|
|
2952
|
+
}), () => {
|
|
2953
|
+
e = !0;
|
|
2954
|
+
};
|
|
2955
|
+
}, [Re]), a(() => {
|
|
2956
|
+
d?.({ updateRow: (e, t) => Be((n) => n && {
|
|
2957
|
+
...n,
|
|
2958
|
+
rows: n.rows.map((n) => n.id === e ? {
|
|
2959
|
+
...n,
|
|
2960
|
+
...t
|
|
2961
|
+
} : n)
|
|
2962
|
+
}) });
|
|
2963
|
+
}, [d]);
|
|
2964
|
+
let Ve = q ? ze?.key !== Re : g, He = q && !Ve ? ze?.error ?? null : null, Ue = s(() => q ? ze?.rows ?? [] : t ?? [], [
|
|
2965
|
+
q,
|
|
2966
|
+
ze,
|
|
2967
|
+
t
|
|
2968
|
+
]), We = q || A, Ge = s(() => {
|
|
2969
|
+
let t = Ue;
|
|
2970
|
+
return We || (t = nn(tn(t, e, Ce), e, we)), q || F || (t = an(t, e, Te)), t;
|
|
2971
|
+
}, [
|
|
2972
|
+
Ue,
|
|
2973
|
+
e,
|
|
2974
|
+
Ce,
|
|
2975
|
+
we,
|
|
2976
|
+
Te,
|
|
2977
|
+
We,
|
|
2978
|
+
q,
|
|
2979
|
+
F
|
|
2980
|
+
]);
|
|
2981
|
+
if (!de) return /* @__PURE__ */ f(k, {});
|
|
2982
|
+
let Ke = q || U, qe = q ? ze?.totalItems ?? 0 : U ? te ?? Ue.length : Ge.length, Je = q ? Math.max(1, ze?.totalPages ?? 1) : Math.max(1, Math.ceil(qe / Ee)), Ye = Math.min(Math.max(1, De), Je), Xe = !fe || Ke ? Ge : on(Ge, Ye, Ee), Ze = (e, t) => String(m ? m(e, t) : e.id ?? t), Qe = Xe.map(Ze), $e = W?.selected ?? [], et = Qe.filter((e) => $e.includes(e)), tt = Qe.length > 0 && et.length === Qe.length, nt = et.length > 0 && !tt, rt = () => {
|
|
2983
|
+
W && W.onChange(tt ? $e.filter((e) => !Qe.includes(e)) : [.../* @__PURE__ */ new Set([...$e, ...Qe])]);
|
|
2984
|
+
}, it = (e) => {
|
|
2985
|
+
W && W.onChange($e.includes(e) ? $e.filter((t) => t !== e) : [...$e, e]);
|
|
2986
|
+
}, at = !!(re && re.length > 0), ot = b || Oe.length > 0, st = Ce.trim() !== "" || Object.values(we).some((e) => e.trim() !== ""), ct = e.length + +!!W + +!!at, J = { onClick: (e) => e.stopPropagation() }, lt = v ?? "No data available", ut = (e, t) => {
|
|
2987
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ne?.(t));
|
|
2988
|
+
}, dt = (e) => {
|
|
2989
|
+
let t = (re ?? []).filter((t) => !t.hidden?.(e));
|
|
2990
|
+
if (t.length === 0) return null;
|
|
2991
|
+
let n = (e) => e.variant === "danger";
|
|
2992
|
+
if (t.length === 1) {
|
|
2993
|
+
let r = t[0];
|
|
2994
|
+
return /* @__PURE__ */ f("button", {
|
|
2995
|
+
type: "button",
|
|
2996
|
+
className: h(Z.actionButton, n(r) && Z.actionDanger),
|
|
2997
|
+
title: r.label,
|
|
2998
|
+
"aria-label": r.label,
|
|
2999
|
+
onClick: () => r.onClick(e),
|
|
3000
|
+
children: r.icon ?? /* @__PURE__ */ f("span", {
|
|
3001
|
+
className: Z.actionText,
|
|
3002
|
+
children: r.label
|
|
3003
|
+
})
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
return /* @__PURE__ */ f(Rt, { items: t.map((t) => ({
|
|
3007
|
+
label: t.label,
|
|
3008
|
+
icon: t.icon,
|
|
3009
|
+
variant: n(t) ? "danger" : "default",
|
|
3010
|
+
onClick: () => t.onClick(e)
|
|
3011
|
+
})) });
|
|
3012
|
+
}, ft = /* @__PURE__ */ f("div", {
|
|
3013
|
+
className: Z.tableArea,
|
|
3014
|
+
"aria-busy": Ve || void 0,
|
|
3015
|
+
children: /* @__PURE__ */ p(vt, {
|
|
3016
|
+
"aria-label": ue,
|
|
3017
|
+
scrollLabel: ue ? `${ue} (scrollable)` : void 0,
|
|
3018
|
+
stickyHeader: se,
|
|
3019
|
+
bordered: !1,
|
|
3020
|
+
className: K,
|
|
3021
|
+
containerClassName: h(Z.scroll, le),
|
|
3022
|
+
children: [
|
|
3023
|
+
G ? /* @__PURE__ */ f(Tt, { children: G }) : null,
|
|
3024
|
+
/* @__PURE__ */ f(yt, { children: /* @__PURE__ */ p(St, { children: [
|
|
3025
|
+
W ? /* @__PURE__ */ f(Ct, {
|
|
3026
|
+
className: Z.selectCell,
|
|
3027
|
+
children: /* @__PURE__ */ f(Mt, {
|
|
3028
|
+
"aria-label": "Select all rows",
|
|
3029
|
+
checked: tt,
|
|
3030
|
+
indeterminate: nt,
|
|
3031
|
+
disabled: Qe.length === 0 || Ve,
|
|
3032
|
+
onChange: rt
|
|
3033
|
+
})
|
|
3034
|
+
}) : null,
|
|
3035
|
+
e.map((e) => {
|
|
3036
|
+
let t = String(e.accessorKey);
|
|
3037
|
+
return /* @__PURE__ */ f(Ct, {
|
|
3038
|
+
align: _n(e.align),
|
|
3039
|
+
sortable: e.sortable,
|
|
3040
|
+
sortDirection: Te?.key === t ? Te.direction : null,
|
|
3041
|
+
onSort: () => Me(t),
|
|
3042
|
+
className: e.className,
|
|
3043
|
+
style: e.width === void 0 ? void 0 : { width: e.width },
|
|
3044
|
+
children: e.header
|
|
3045
|
+
}, t);
|
|
3046
|
+
}),
|
|
3047
|
+
at ? /* @__PURE__ */ f(Ct, {
|
|
3048
|
+
align: "center",
|
|
3049
|
+
className: ie ?? Z.actionsColumn,
|
|
3050
|
+
children: "Actions"
|
|
3051
|
+
}) : null
|
|
3052
|
+
] }) }),
|
|
3053
|
+
/* @__PURE__ */ f(bt, { children: He ? /* @__PURE__ */ f(St, { children: /* @__PURE__ */ f(wt, {
|
|
3054
|
+
colSpan: ct,
|
|
3055
|
+
className: Z.errorCell,
|
|
3056
|
+
children: /* @__PURE__ */ p("div", {
|
|
3057
|
+
className: Z.stateBox,
|
|
3058
|
+
role: "alert",
|
|
3059
|
+
children: [/* @__PURE__ */ f("span", {
|
|
3060
|
+
className: Z.errorIcon,
|
|
3061
|
+
children: vn
|
|
3062
|
+
}), /* @__PURE__ */ f("span", {
|
|
3063
|
+
className: Z.errorText,
|
|
3064
|
+
children: He
|
|
3065
|
+
})]
|
|
3066
|
+
})
|
|
3067
|
+
}) }) : Ve ? Array.from({ length: _ }, (e, t) => /* @__PURE__ */ f(St, { children: Array.from({ length: ct }, (e, t) => /* @__PURE__ */ f(wt, {
|
|
3068
|
+
align: at && t === ct - 1 ? "center" : void 0,
|
|
3069
|
+
children: at && t === ct - 1 ? /* @__PURE__ */ f(Bt, {
|
|
3070
|
+
width: 32,
|
|
3071
|
+
height: 32,
|
|
3072
|
+
style: {
|
|
3073
|
+
borderRadius: 6,
|
|
3074
|
+
display: "inline-block"
|
|
3075
|
+
}
|
|
3076
|
+
}) : /* @__PURE__ */ f(Bt, {
|
|
3077
|
+
variant: "text",
|
|
3078
|
+
height: 16,
|
|
3079
|
+
width: gn[t === 0 ? 0 : t % 2 == 0 ? 2 : 1],
|
|
3080
|
+
style: { borderRadius: 4 }
|
|
3081
|
+
})
|
|
3082
|
+
}, t)) }, `loading-${t}`)) : Xe.length === 0 ? /* @__PURE__ */ f(St, { children: /* @__PURE__ */ f(wt, {
|
|
3083
|
+
colSpan: ct,
|
|
3084
|
+
className: Z.empty,
|
|
3085
|
+
children: y ?? /* @__PURE__ */ p("div", {
|
|
3086
|
+
className: Z.stateBox,
|
|
3087
|
+
children: [
|
|
3088
|
+
/* @__PURE__ */ f("span", {
|
|
3089
|
+
className: Z.emptyIcon,
|
|
3090
|
+
children: yn
|
|
3091
|
+
}),
|
|
3092
|
+
/* @__PURE__ */ f("span", { children: st ? "No results match your search or filters." : lt }),
|
|
3093
|
+
st ? /* @__PURE__ */ f(j, {
|
|
3094
|
+
variant: "link",
|
|
3095
|
+
size: "sm",
|
|
3096
|
+
onClick: () => {
|
|
3097
|
+
Ae(""), je({});
|
|
3098
|
+
},
|
|
3099
|
+
children: "Clear search and filters"
|
|
3100
|
+
}) : null
|
|
3101
|
+
]
|
|
3102
|
+
})
|
|
3103
|
+
}) }) : Xe.map((t, n) => {
|
|
3104
|
+
let r = Ze(t, n), i = $e.includes(r);
|
|
3105
|
+
return /* @__PURE__ */ p(St, {
|
|
3106
|
+
selected: i,
|
|
3107
|
+
onClick: ne ? () => ne(t) : void 0,
|
|
3108
|
+
onKeyDown: ne ? (e) => ut(e, t) : void 0,
|
|
3109
|
+
tabIndex: ne ? 0 : void 0,
|
|
3110
|
+
children: [
|
|
3111
|
+
W ? /* @__PURE__ */ f(wt, {
|
|
3112
|
+
className: Z.selectCell,
|
|
3113
|
+
...J,
|
|
3114
|
+
children: /* @__PURE__ */ f(Mt, {
|
|
3115
|
+
"aria-label": "Select row",
|
|
3116
|
+
checked: i,
|
|
3117
|
+
onChange: () => it(r)
|
|
3118
|
+
})
|
|
3119
|
+
}) : null,
|
|
3120
|
+
e.map((e) => {
|
|
3121
|
+
let n = $t(e, t);
|
|
3122
|
+
return /* @__PURE__ */ f(wt, {
|
|
3123
|
+
align: _n(e.align),
|
|
3124
|
+
className: e.className,
|
|
3125
|
+
style: e.width === void 0 ? void 0 : { width: e.width },
|
|
3126
|
+
children: e.render ? e.render(n, t) : /* @__PURE__ */ f("span", {
|
|
3127
|
+
className: Z.cellText,
|
|
3128
|
+
children: n == null ? "-" : String(n)
|
|
3129
|
+
})
|
|
3130
|
+
}, String(e.accessorKey));
|
|
3131
|
+
}),
|
|
3132
|
+
at ? /* @__PURE__ */ f(wt, {
|
|
3133
|
+
align: "center",
|
|
3134
|
+
className: ie ?? Z.actionsColumn,
|
|
3135
|
+
...J,
|
|
3136
|
+
children: /* @__PURE__ */ f("div", {
|
|
3137
|
+
className: Z.actions,
|
|
3138
|
+
children: dt(t)
|
|
3139
|
+
})
|
|
3140
|
+
}) : null
|
|
3141
|
+
]
|
|
3142
|
+
}, r);
|
|
3143
|
+
}) })
|
|
3144
|
+
]
|
|
3145
|
+
})
|
|
3146
|
+
});
|
|
3147
|
+
return /* @__PURE__ */ p("div", {
|
|
3148
|
+
className: h(Z.root, ce),
|
|
3149
|
+
children: [
|
|
3150
|
+
ot ? /* @__PURE__ */ f("div", {
|
|
3151
|
+
className: Z.toolbar,
|
|
3152
|
+
children: /* @__PURE__ */ f(Qt, {
|
|
3153
|
+
search: b ? Ce : void 0,
|
|
3154
|
+
onSearchChange: b ? Ae : void 0,
|
|
3155
|
+
searchPlaceholder: x ?? "Search...",
|
|
3156
|
+
fields: Oe,
|
|
3157
|
+
values: we,
|
|
3158
|
+
onValuesChange: Oe.length > 0 ? je : void 0
|
|
3159
|
+
})
|
|
3160
|
+
}) : null,
|
|
3161
|
+
W && $e.length > 0 ? /* @__PURE__ */ f(Vt, {
|
|
3162
|
+
count: $e.length,
|
|
3163
|
+
actions: oe?.map((e) => ({
|
|
3164
|
+
...e,
|
|
3165
|
+
onClick: () => e.onClick($e)
|
|
3166
|
+
})),
|
|
3167
|
+
onClear: () => W.onChange([])
|
|
3168
|
+
}) : null,
|
|
3169
|
+
ae,
|
|
3170
|
+
ft,
|
|
3171
|
+
/* @__PURE__ */ f("div", {
|
|
3172
|
+
role: "status",
|
|
3173
|
+
className: Z.srOnly,
|
|
3174
|
+
children: Ve ? "Loading" : He ? "Error" : `${qe} ${qe === 1 ? "result" : "results"}`
|
|
3175
|
+
}),
|
|
3176
|
+
fe ? /* @__PURE__ */ f("div", {
|
|
3177
|
+
className: Z.footer,
|
|
3178
|
+
children: /* @__PURE__ */ f(_t, {
|
|
3179
|
+
layout: "split",
|
|
3180
|
+
page: Ye,
|
|
3181
|
+
pageCount: Je,
|
|
3182
|
+
onPageChange: Ne,
|
|
3183
|
+
pageSize: Ee,
|
|
3184
|
+
totalItems: qe,
|
|
3185
|
+
pageSizeOptions: ee,
|
|
3186
|
+
onPageSizeChange: Pe,
|
|
3187
|
+
disabled: Ve
|
|
3188
|
+
})
|
|
3189
|
+
}) : null
|
|
3190
|
+
]
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
//#endregion
|
|
3194
|
+
//#region src/components/FileInput/fileUtils.ts
|
|
3195
|
+
function xn(e) {
|
|
3196
|
+
if (e < 1024) return `${e} B`;
|
|
3197
|
+
if (e < 1048576) return `${Math.round(e / 1024)} KB`;
|
|
3198
|
+
let t = e / 1048576;
|
|
3199
|
+
return `${t < 10 ? t.toFixed(1) : Math.round(t)} MB`;
|
|
3200
|
+
}
|
|
3201
|
+
function Sn(e, t) {
|
|
3202
|
+
let n = (t ?? "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
3203
|
+
if (n.length === 0) return !0;
|
|
3204
|
+
let r = e.name.toLowerCase(), i = e.type.toLowerCase();
|
|
3205
|
+
return n.some((e) => e.startsWith(".") ? r.endsWith(e) : e.endsWith("/*") ? i.startsWith(e.slice(0, -1)) : i === e);
|
|
3206
|
+
}
|
|
3207
|
+
var Cn = (e, t) => e.name === t.name && e.size === t.size && e.lastModified === t.lastModified, wn = (e) => `${e.name}-${e.size}-${e.lastModified}`, Tn = (e) => e.type.startsWith("image/"), En = {
|
|
3208
|
+
backdrop: "cui-ImageCropper-module__backdrop--0zPLq",
|
|
3209
|
+
dialog: "cui-ImageCropper-module__dialog--h13vH",
|
|
3210
|
+
title: "cui-ImageCropper-module__title--ZWlWm",
|
|
3211
|
+
frame: "cui-ImageCropper-module__frame--yTW8V",
|
|
3212
|
+
circle: "cui-ImageCropper-module__circle--GRs32",
|
|
3213
|
+
image: "cui-ImageCropper-module__image--vUaXt",
|
|
3214
|
+
loading: "cui-ImageCropper-module__loading--rNK90",
|
|
3215
|
+
zoom: "cui-ImageCropper-module__zoom--CIboz",
|
|
3216
|
+
error: "cui-ImageCropper-module__error---SDrv",
|
|
3217
|
+
actions: "cui-ImageCropper-module__actions--OC3A0",
|
|
3218
|
+
cancel: "cui-ImageCropper-module__cancel--miwJS",
|
|
3219
|
+
apply: "cui-ImageCropper-module__apply--9Ncg6"
|
|
3220
|
+
}, Dn = 280, On = 4, kn = 12, An = (e) => e === "image/png" ? "png" : e === "image/webp" ? "webp" : "jpg";
|
|
3221
|
+
function jn({ file: e, aspect: t, shape: n, outputWidth: r, outputType: i, outputQuality: s, title: u = "Crop photo", theme: g, onApply: _, onCancel: v }) {
|
|
3222
|
+
let y = o(), b = c(null), [x, S] = l(null), [C, w] = l(!1), [T, E] = l(1), [D, O] = l({
|
|
3223
|
+
x: 0,
|
|
3224
|
+
y: 0
|
|
3225
|
+
}), [k, A] = l(!1), j = c(null), M = t >= 1 ? Dn : Math.round(Dn * t), N = t >= 1 ? Math.round(Dn / t) : Dn;
|
|
3226
|
+
a(() => {
|
|
3227
|
+
let e = document.activeElement;
|
|
3228
|
+
return b.current?.focus({ preventScroll: !0 }), () => e?.focus?.({ preventScroll: !0 });
|
|
3229
|
+
}, []), a(() => {
|
|
3230
|
+
let t, n = new Image();
|
|
3231
|
+
n.onload = () => S({
|
|
3232
|
+
image: n,
|
|
3233
|
+
width: n.naturalWidth,
|
|
3234
|
+
height: n.naturalHeight
|
|
3235
|
+
}), n.onerror = () => w(!0);
|
|
3236
|
+
try {
|
|
3237
|
+
t = URL.createObjectURL(e), n.src = t;
|
|
3238
|
+
} catch {
|
|
3239
|
+
n.onerror?.(new Event("error"));
|
|
3240
|
+
}
|
|
3241
|
+
return () => {
|
|
3242
|
+
n.onload = null, n.onerror = null, t && URL.revokeObjectURL(t);
|
|
3243
|
+
};
|
|
3244
|
+
}, [e]);
|
|
3245
|
+
let P = x ? Math.max(M / x.width, N / x.height) : 1, F = P * T, I = (e, t, n) => {
|
|
3246
|
+
if (!x) return {
|
|
3247
|
+
x: 0,
|
|
3248
|
+
y: 0
|
|
3249
|
+
};
|
|
3250
|
+
let r = Math.max(0, (x.width * n - M) / 2), i = Math.max(0, (x.height * n - N) / 2);
|
|
3251
|
+
return {
|
|
3252
|
+
x: Math.min(r, Math.max(-r, e)),
|
|
3253
|
+
y: Math.min(i, Math.max(-i, t))
|
|
3254
|
+
};
|
|
3255
|
+
}, L = (e) => {
|
|
3256
|
+
let t = Math.min(On, Math.max(1, e));
|
|
3257
|
+
E(t), O((e) => I(e.x, e.y, P * t));
|
|
3258
|
+
}, R = (e, t) => O((n) => I(n.x + e, n.y + t, F)), z = (e) => {
|
|
3259
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), j.current = {
|
|
3260
|
+
x: e.clientX,
|
|
3261
|
+
y: e.clientY,
|
|
3262
|
+
ox: D.x,
|
|
3263
|
+
oy: D.y
|
|
3264
|
+
};
|
|
3265
|
+
}, B = (e) => {
|
|
3266
|
+
let t = j.current;
|
|
3267
|
+
t && O(I(t.ox + e.clientX - t.x, t.oy + e.clientY - t.y, F));
|
|
3268
|
+
}, V = () => {
|
|
3269
|
+
j.current = null;
|
|
3270
|
+
}, H = () => {
|
|
3271
|
+
if (!x || k) return;
|
|
3272
|
+
A(!0);
|
|
3273
|
+
let n = Math.round(r), a = Math.max(1, Math.round(r / t)), o = document.createElement("canvas");
|
|
3274
|
+
o.width = n, o.height = a;
|
|
3275
|
+
let c = o.getContext("2d");
|
|
3276
|
+
if (!c) {
|
|
3277
|
+
A(!1), w(!0);
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
let l = (x.width * F - M) / 2 / F - D.x / F, u = (x.height * F - N) / 2 / F - D.y / F;
|
|
3281
|
+
c.imageSmoothingQuality = "high", c.drawImage(x.image, l, u, M / F, N / F, 0, 0, n, a), o.toBlob((t) => {
|
|
3282
|
+
if (!t) {
|
|
3283
|
+
A(!1), w(!0);
|
|
3284
|
+
return;
|
|
3285
|
+
}
|
|
3286
|
+
let n = e.name.replace(/\.[^.]+$/, "") || "photo", r = t.type || i;
|
|
3287
|
+
_(new File([t], `${n}.${An(r)}`, {
|
|
3288
|
+
type: r,
|
|
3289
|
+
lastModified: Date.now()
|
|
3290
|
+
}));
|
|
3291
|
+
}, i, s);
|
|
3292
|
+
}, ee = /* @__PURE__ */ f("div", {
|
|
3293
|
+
className: En.backdrop,
|
|
3294
|
+
"data-theme": g,
|
|
3295
|
+
children: /* @__PURE__ */ p("div", {
|
|
3296
|
+
ref: b,
|
|
3297
|
+
role: "dialog",
|
|
3298
|
+
"aria-modal": "true",
|
|
3299
|
+
"aria-labelledby": y,
|
|
3300
|
+
tabIndex: -1,
|
|
3301
|
+
className: En.dialog,
|
|
3302
|
+
onKeyDown: (e) => {
|
|
3303
|
+
if (e.key === "Escape") {
|
|
3304
|
+
e.preventDefault(), e.stopPropagation(), v();
|
|
3305
|
+
return;
|
|
3306
|
+
}
|
|
3307
|
+
if (e.key === "Tab") {
|
|
3308
|
+
let t = Array.from(b.current?.querySelectorAll("button:not([disabled]), input, [tabindex=\"0\"]") ?? []), n = t[0], r = t[t.length - 1];
|
|
3309
|
+
if (!n || !r) return;
|
|
3310
|
+
e.shiftKey && (document.activeElement === n || document.activeElement === b.current) ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
3311
|
+
}
|
|
3312
|
+
},
|
|
3313
|
+
children: [
|
|
3314
|
+
/* @__PURE__ */ f("h2", {
|
|
3315
|
+
id: y,
|
|
3316
|
+
className: En.title,
|
|
3317
|
+
children: u
|
|
3318
|
+
}),
|
|
3319
|
+
C ? /* @__PURE__ */ f("p", {
|
|
3320
|
+
className: En.error,
|
|
3321
|
+
role: "alert",
|
|
3322
|
+
children: "This image could not be opened. Try a different file."
|
|
3323
|
+
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
|
|
3324
|
+
className: h(En.frame, n === "circle" && En.circle),
|
|
3325
|
+
style: {
|
|
3326
|
+
width: M,
|
|
3327
|
+
height: N
|
|
3328
|
+
},
|
|
3329
|
+
tabIndex: 0,
|
|
3330
|
+
role: "group",
|
|
3331
|
+
"aria-label": "Crop area. Drag, or use the arrow keys to move the photo and plus and minus to zoom.",
|
|
3332
|
+
onPointerDown: z,
|
|
3333
|
+
onPointerMove: B,
|
|
3334
|
+
onPointerUp: V,
|
|
3335
|
+
onPointerCancel: V,
|
|
3336
|
+
onKeyDown: (e) => {
|
|
3337
|
+
let t = {
|
|
3338
|
+
ArrowLeft: [kn, 0],
|
|
3339
|
+
ArrowRight: [-12, 0],
|
|
3340
|
+
ArrowUp: [0, kn],
|
|
3341
|
+
ArrowDown: [0, -12]
|
|
3342
|
+
}[e.key];
|
|
3343
|
+
t ? (e.preventDefault(), R(t[0], t[1])) : e.key === "+" || e.key === "=" ? (e.preventDefault(), L(T + .1)) : e.key === "-" ? (e.preventDefault(), L(T - .1)) : e.key === "Enter" && (e.preventDefault(), H());
|
|
3344
|
+
},
|
|
3345
|
+
children: x ? /* @__PURE__ */ f("img", {
|
|
3346
|
+
src: x.image.src,
|
|
3347
|
+
alt: "",
|
|
3348
|
+
draggable: !1,
|
|
3349
|
+
className: En.image,
|
|
3350
|
+
style: {
|
|
3351
|
+
width: x.width * F,
|
|
3352
|
+
height: x.height * F,
|
|
3353
|
+
transform: `translate(calc(-50% + ${D.x}px), calc(-50% + ${D.y}px))`
|
|
3354
|
+
}
|
|
3355
|
+
}) : /* @__PURE__ */ f("span", {
|
|
3356
|
+
className: En.loading,
|
|
3357
|
+
children: "Loading…"
|
|
3358
|
+
})
|
|
3359
|
+
}), /* @__PURE__ */ p("label", {
|
|
3360
|
+
className: En.zoom,
|
|
3361
|
+
children: [/* @__PURE__ */ f("span", { children: "Zoom" }), /* @__PURE__ */ f("input", {
|
|
3362
|
+
type: "range",
|
|
3363
|
+
min: 1,
|
|
3364
|
+
max: On,
|
|
3365
|
+
step: .01,
|
|
3366
|
+
value: T,
|
|
3367
|
+
disabled: !x,
|
|
3368
|
+
"aria-label": "Zoom",
|
|
3369
|
+
onChange: (e) => L(Number(e.target.value))
|
|
3370
|
+
})]
|
|
3371
|
+
})] }),
|
|
3372
|
+
/* @__PURE__ */ p("div", {
|
|
3373
|
+
className: En.actions,
|
|
3374
|
+
children: [/* @__PURE__ */ f("button", {
|
|
3375
|
+
type: "button",
|
|
3376
|
+
className: En.cancel,
|
|
3377
|
+
onClick: v,
|
|
3378
|
+
children: "Cancel"
|
|
3379
|
+
}), /* @__PURE__ */ f("button", {
|
|
3380
|
+
type: "button",
|
|
3381
|
+
className: En.apply,
|
|
3382
|
+
disabled: !x || k || C,
|
|
3383
|
+
onClick: H,
|
|
3384
|
+
children: k ? "Saving…" : "Apply"
|
|
3385
|
+
})]
|
|
3386
|
+
})
|
|
3387
|
+
]
|
|
3388
|
+
})
|
|
3389
|
+
});
|
|
3390
|
+
return m(ee, document.body);
|
|
3391
|
+
}
|
|
3392
|
+
var Q = {
|
|
3393
|
+
root: "cui-FileInput-module__root--UvQj-",
|
|
3394
|
+
zone: "cui-FileInput-module__zone--KEX1g",
|
|
3395
|
+
disabled: "cui-FileInput-module__disabled--uRez3",
|
|
3396
|
+
dragging: "cui-FileInput-module__dragging--4Sxh9",
|
|
3397
|
+
invalid: "cui-FileInput-module__invalid--2Qqgy",
|
|
3398
|
+
tile: "cui-FileInput-module__tile--FgwD7",
|
|
3399
|
+
addTile: "cui-FileInput-module__addTile--sQKX0",
|
|
3400
|
+
fieldFace: "cui-FileInput-module__fieldFace--DCcJw",
|
|
3401
|
+
input: "cui-FileInput-module__input--dBre-",
|
|
3402
|
+
icon: "cui-FileInput-module__icon--5x7xh",
|
|
3403
|
+
browseLink: "cui-FileInput-module__browseLink--Trbwz",
|
|
3404
|
+
hint: "cui-FileInput-module__hint--2lRnS",
|
|
3405
|
+
hintText: "cui-FileInput-module__hintText--QTvBs",
|
|
3406
|
+
list: "cui-FileInput-module__list--TzN0u",
|
|
3407
|
+
item: "cui-FileInput-module__item--ud4cx",
|
|
3408
|
+
itemThumb: "cui-FileInput-module__itemThumb--HcBdl",
|
|
3409
|
+
itemIcon: "cui-FileInput-module__itemIcon--qwa4y",
|
|
3410
|
+
name: "cui-FileInput-module__name--INaW3",
|
|
3411
|
+
size: "cui-FileInput-module__size--x3JyK",
|
|
3412
|
+
remove: "cui-FileInput-module__remove--STMmH",
|
|
3413
|
+
rejected: "cui-FileInput-module__rejected--Fu9ek",
|
|
3414
|
+
buttonRow: "cui-FileInput-module__buttonRow--gdqos",
|
|
3415
|
+
buttonFace: "cui-FileInput-module__buttonFace--ClnEW",
|
|
3416
|
+
button: "cui-FileInput-module__button--i8fAu",
|
|
3417
|
+
buttonIcon: "cui-FileInput-module__buttonIcon--di6dt",
|
|
3418
|
+
summary: "cui-FileInput-module__summary--5T73u",
|
|
3419
|
+
fieldValue: "cui-FileInput-module__fieldValue--dqK5-",
|
|
3420
|
+
fieldPlaceholder: "cui-FileInput-module__fieldPlaceholder--HZAla",
|
|
3421
|
+
browse: "cui-FileInput-module__browse--fpTZh",
|
|
3422
|
+
imageRoot: "cui-FileInput-module__imageRoot--rYX4H",
|
|
3423
|
+
circle: "cui-FileInput-module__circle--bmCto",
|
|
3424
|
+
tileImage: "cui-FileInput-module__tileImage--olRdu",
|
|
3425
|
+
tileEmpty: "cui-FileInput-module__tileEmpty--fY9QB",
|
|
3426
|
+
overlay: "cui-FileInput-module__overlay--IC-qb",
|
|
3427
|
+
imageSide: "cui-FileInput-module__imageSide--g8HVF",
|
|
3428
|
+
removeText: "cui-FileInput-module__removeText--3kIrj",
|
|
3429
|
+
gallery: "cui-FileInput-module__gallery--wpMjX",
|
|
3430
|
+
thumbItem: "cui-FileInput-module__thumbItem--5BdfZ",
|
|
3431
|
+
addItem: "cui-FileInput-module__addItem--gAv77",
|
|
3432
|
+
thumbImage: "cui-FileInput-module__thumbImage--68iIu",
|
|
3433
|
+
thumbFallback: "cui-FileInput-module__thumbFallback--EuLpR",
|
|
3434
|
+
thumbName: "cui-FileInput-module__thumbName--1uZrH",
|
|
3435
|
+
thumbRemove: "cui-FileInput-module__thumbRemove--jpxg4"
|
|
3436
|
+
}, Mn = () => typeof URL < "u" && typeof URL.createObjectURL == "function";
|
|
3437
|
+
function Nn(e) {
|
|
3438
|
+
try {
|
|
3439
|
+
return URL.createObjectURL(e);
|
|
3440
|
+
} catch {
|
|
3441
|
+
return;
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
var Pn = ({ className: e }) => /* @__PURE__ */ f("svg", {
|
|
3445
|
+
className: e,
|
|
3446
|
+
viewBox: "0 0 24 24",
|
|
3447
|
+
fill: "none",
|
|
3448
|
+
stroke: "currentColor",
|
|
3449
|
+
strokeWidth: "1.6",
|
|
3450
|
+
strokeLinecap: "round",
|
|
3451
|
+
strokeLinejoin: "round",
|
|
3452
|
+
"aria-hidden": "true",
|
|
3453
|
+
focusable: "false",
|
|
3454
|
+
children: /* @__PURE__ */ f("path", { d: "M12 16V4M7 9l5-5 5 5M4 16v3a1 1 0 001 1h14a1 1 0 001-1v-3" })
|
|
3455
|
+
}), Fn = ({ className: e }) => /* @__PURE__ */ p("svg", {
|
|
3456
|
+
className: e,
|
|
3457
|
+
viewBox: "0 0 24 24",
|
|
3458
|
+
fill: "none",
|
|
3459
|
+
stroke: "currentColor",
|
|
3460
|
+
strokeWidth: "1.6",
|
|
3461
|
+
strokeLinecap: "round",
|
|
3462
|
+
strokeLinejoin: "round",
|
|
3463
|
+
"aria-hidden": "true",
|
|
3464
|
+
focusable: "false",
|
|
3465
|
+
children: [
|
|
3466
|
+
/* @__PURE__ */ f("rect", {
|
|
3467
|
+
x: "3",
|
|
3468
|
+
y: "4",
|
|
3469
|
+
width: "18",
|
|
3470
|
+
height: "16",
|
|
3471
|
+
rx: "2"
|
|
3472
|
+
}),
|
|
3473
|
+
/* @__PURE__ */ f("circle", {
|
|
3474
|
+
cx: "9",
|
|
3475
|
+
cy: "10",
|
|
3476
|
+
r: "1.5"
|
|
3477
|
+
}),
|
|
3478
|
+
/* @__PURE__ */ f("path", { d: "M21 16l-5-5-8 8" })
|
|
3479
|
+
]
|
|
3480
|
+
}), In = ({ className: e }) => /* @__PURE__ */ p("svg", {
|
|
3481
|
+
className: e,
|
|
3482
|
+
viewBox: "0 0 24 24",
|
|
3483
|
+
fill: "none",
|
|
3484
|
+
stroke: "currentColor",
|
|
3485
|
+
strokeWidth: "1.6",
|
|
3486
|
+
strokeLinecap: "round",
|
|
3487
|
+
strokeLinejoin: "round",
|
|
3488
|
+
"aria-hidden": "true",
|
|
3489
|
+
focusable: "false",
|
|
3490
|
+
children: [/* @__PURE__ */ f("path", { d: "M7 3h7l5 5v12a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z" }), /* @__PURE__ */ f("path", { d: "M14 3v5h5" })]
|
|
3491
|
+
}), Ln = () => /* @__PURE__ */ f("svg", {
|
|
3492
|
+
viewBox: "0 0 20 20",
|
|
3493
|
+
fill: "none",
|
|
3494
|
+
stroke: "currentColor",
|
|
3495
|
+
strokeWidth: "2",
|
|
3496
|
+
strokeLinecap: "round",
|
|
3497
|
+
"aria-hidden": "true",
|
|
3498
|
+
focusable: "false",
|
|
3499
|
+
children: /* @__PURE__ */ f("path", { d: "M6 6l8 8M14 6l-8 8" })
|
|
3500
|
+
}), Rn = n(function({ id: e, required: t, disabled: n, error: i, "aria-describedby": s, variant: u = "dropzone", multiple: m, accept: g, maxSize: _, maxFiles: v, preview: y = !0, shape: b = "square", aspectRatio: x = 4 / 3, tileSize: S = 128, crop: C = !0, cropOutputWidth: w, cropOutputType: T, cropOutputQuality: E, cropTitle: D, buttonLabel: O, placeholder: k = "No file chosen", onFilesChange: A, className: j, ...M }, P) {
|
|
3501
|
+
let F = N({
|
|
3502
|
+
id: e,
|
|
3503
|
+
required: t,
|
|
3504
|
+
disabled: n,
|
|
3505
|
+
error: i,
|
|
3506
|
+
"aria-describedby": s
|
|
3507
|
+
}), I = o(), L = `${I}-hint`, R = `${I}-rejected`, z = u === "image" || u === "gallery", B = u === "gallery" ? !0 : u === "image" ? !1 : m ?? !1, V = g ?? (z ? "image/*" : void 0), H = c(null), ee = r((e) => {
|
|
3508
|
+
H.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
|
|
3509
|
+
}, [P]), [U, te] = l([]), [W, ne] = l([]), [re, ie] = l(!1), [ae, oe] = l(null), [G, se] = l({}), ce = c({});
|
|
3510
|
+
a(() => () => {
|
|
3511
|
+
Object.values(ce.current).forEach((e) => URL.revokeObjectURL(e));
|
|
3512
|
+
}, []);
|
|
3513
|
+
let K = (e) => {
|
|
3514
|
+
try {
|
|
3515
|
+
let t = new DataTransfer();
|
|
3516
|
+
e.forEach((e) => t.items.add(e)), H.current && (H.current.files = t.files);
|
|
3517
|
+
} catch {}
|
|
3518
|
+
}, le = (e) => {
|
|
3519
|
+
let t = {};
|
|
3520
|
+
if (Mn()) {
|
|
3521
|
+
for (let n of e) {
|
|
3522
|
+
let e = wn(n), r = ce.current[e];
|
|
3523
|
+
if (r) t[e] = r;
|
|
3524
|
+
else if (Tn(n)) {
|
|
3525
|
+
let r = Nn(n);
|
|
3526
|
+
r && (t[e] = r);
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
for (let [e, n] of Object.entries(ce.current)) t[e] || URL.revokeObjectURL(n);
|
|
3530
|
+
}
|
|
3531
|
+
ce.current = t, se(t), te(e), K(e), A?.(e);
|
|
3532
|
+
}, ue = (e) => {
|
|
3533
|
+
if (F.disabled || e.length === 0) return;
|
|
3534
|
+
let t = [], n = [];
|
|
3535
|
+
for (let r of e) Sn(r, V) ? _ !== void 0 && r.size > _ ? t.push(`${r.name}: larger than ${xn(_)}`) : n.push(r) : t.push(`${r.name}: file type not accepted`);
|
|
3536
|
+
let r = n[0];
|
|
3537
|
+
if (u === "image" && C && r && r.type !== "image/svg+xml") {
|
|
3538
|
+
ne(t), oe({
|
|
3539
|
+
file: r,
|
|
3540
|
+
theme: H.current?.closest("[data-theme]")?.getAttribute("data-theme") ?? void 0
|
|
3541
|
+
});
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
let i;
|
|
3545
|
+
if (!B) i = n.length > 0 ? [n[0]] : U;
|
|
3546
|
+
else {
|
|
3547
|
+
i = [...U];
|
|
3548
|
+
for (let e of n) i.some((t) => Cn(t, e)) || i.push(e);
|
|
3549
|
+
v !== void 0 && i.length > v && (t.push(`You can add up to ${v} files`), i = i.slice(0, v));
|
|
3550
|
+
}
|
|
3551
|
+
ne(t), i.length !== U.length || i.some((e, t) => e !== U[t]) ? le(i) : K(U);
|
|
3552
|
+
}, de = (e) => {
|
|
3553
|
+
ue(Array.from(e.target.files ?? []));
|
|
3554
|
+
}, q = (e) => {
|
|
3555
|
+
e.preventDefault(), ie(!1), ue(Array.from(e.dataTransfer.files));
|
|
3556
|
+
}, fe = (e) => {
|
|
3557
|
+
ne([]), le(U.filter((t) => t !== e));
|
|
3558
|
+
}, pe = [V ? `Accepted: ${V.split(",").map((e) => e.trim()).join(", ")}` : null, _ === void 0 ? null : `Max ${xn(_)} each`].filter(Boolean).join(" · "), me = [
|
|
3559
|
+
F["aria-describedby"],
|
|
3560
|
+
pe ? L : void 0,
|
|
3561
|
+
W.length ? R : void 0
|
|
3562
|
+
].filter(Boolean).join(" ") || void 0, he = F.invalid || W.length > 0, ge = () => {
|
|
3563
|
+
F.disabled || H.current?.click();
|
|
3564
|
+
}, _e = {
|
|
3565
|
+
onDragEnter: (e) => {
|
|
3566
|
+
e.preventDefault(), F.disabled || ie(!0);
|
|
3567
|
+
},
|
|
3568
|
+
onDragOver: (e) => e.preventDefault(),
|
|
3569
|
+
onDragLeave: (e) => {
|
|
3570
|
+
e.currentTarget.contains(e.relatedTarget) || ie(!1);
|
|
3571
|
+
},
|
|
3572
|
+
onDrop: q
|
|
3573
|
+
}, ve = /* @__PURE__ */ f("input", {
|
|
3574
|
+
...M,
|
|
3575
|
+
ref: ee,
|
|
3576
|
+
id: F.id,
|
|
3577
|
+
type: "file",
|
|
3578
|
+
multiple: B,
|
|
3579
|
+
accept: V,
|
|
3580
|
+
required: F.required && U.length === 0,
|
|
3581
|
+
disabled: F.disabled,
|
|
3582
|
+
"aria-invalid": he ? !0 : void 0,
|
|
3583
|
+
"aria-describedby": me,
|
|
3584
|
+
className: Q.input,
|
|
3585
|
+
onChange: de,
|
|
3586
|
+
onClick: (e) => e.stopPropagation()
|
|
3587
|
+
}), ye = b === "rectangle" ? Math.max(.2, x) : 1, be = Math.round(S / ye), xe = w ?? (b === "rectangle" ? 800 : 512), Se = h(he && Q.invalid, F.disabled && Q.disabled), Ce = U.map((e) => e.name).join(", "), we = (e, t) => {
|
|
3588
|
+
let n = G[wn(e)];
|
|
3589
|
+
return n ? /* @__PURE__ */ f("img", {
|
|
3590
|
+
src: n,
|
|
3591
|
+
alt: "",
|
|
3592
|
+
className: t
|
|
3593
|
+
}) : null;
|
|
3594
|
+
}, Te = U.length > 0 ? /* @__PURE__ */ f("ul", {
|
|
3595
|
+
className: Q.list,
|
|
3596
|
+
"aria-label": "Selected files",
|
|
3597
|
+
children: U.map((e) => /* @__PURE__ */ p("li", {
|
|
3598
|
+
className: Q.item,
|
|
3599
|
+
children: [
|
|
3600
|
+
y && G[wn(e)] ? we(e, Q.itemThumb ?? "") : /* @__PURE__ */ f(In, { className: Q.itemIcon }),
|
|
3601
|
+
/* @__PURE__ */ f("span", {
|
|
3602
|
+
className: Q.name,
|
|
3603
|
+
children: e.name
|
|
3604
|
+
}),
|
|
3605
|
+
/* @__PURE__ */ f("span", {
|
|
3606
|
+
className: Q.size,
|
|
3607
|
+
children: xn(e.size)
|
|
3608
|
+
}),
|
|
3609
|
+
/* @__PURE__ */ f("button", {
|
|
3610
|
+
type: "button",
|
|
3611
|
+
className: Q.remove,
|
|
3612
|
+
"aria-label": `Remove ${e.name}`,
|
|
3613
|
+
disabled: F.disabled,
|
|
3614
|
+
onClick: () => fe(e),
|
|
3615
|
+
children: /* @__PURE__ */ f(Ln, {})
|
|
3616
|
+
})
|
|
3617
|
+
]
|
|
3618
|
+
}, wn(e)))
|
|
3619
|
+
}) : null, Ee = pe && u !== "dropzone" ? /* @__PURE__ */ f("span", {
|
|
3620
|
+
id: L,
|
|
3621
|
+
className: Q.hintText,
|
|
3622
|
+
children: pe
|
|
3623
|
+
}) : null, De;
|
|
3624
|
+
if (u === "button") De = /* @__PURE__ */ p(d, { children: [
|
|
3625
|
+
/* @__PURE__ */ p("div", {
|
|
3626
|
+
className: Q.buttonRow,
|
|
3627
|
+
children: [/* @__PURE__ */ p("div", {
|
|
3628
|
+
className: h(Q.buttonFace, Se),
|
|
3629
|
+
onClick: ge,
|
|
3630
|
+
children: [ve, /* @__PURE__ */ p("span", {
|
|
3631
|
+
className: Q.button,
|
|
3632
|
+
children: [/* @__PURE__ */ f(Pn, { className: Q.buttonIcon }), O ?? (B ? "Choose files" : "Choose file")]
|
|
3633
|
+
})]
|
|
3634
|
+
}), /* @__PURE__ */ f("span", {
|
|
3635
|
+
className: Q.summary,
|
|
3636
|
+
children: Ce || k
|
|
3637
|
+
})]
|
|
3638
|
+
}),
|
|
3639
|
+
Ee,
|
|
3640
|
+
Te
|
|
3641
|
+
] });
|
|
3642
|
+
else if (u === "field") De = /* @__PURE__ */ p(d, { children: [
|
|
3643
|
+
/* @__PURE__ */ p("div", {
|
|
3644
|
+
className: h(Q.fieldFace, Se),
|
|
3645
|
+
onClick: ge,
|
|
3646
|
+
children: [
|
|
3647
|
+
ve,
|
|
3648
|
+
/* @__PURE__ */ f("span", {
|
|
3649
|
+
className: h(Q.fieldValue, !Ce && Q.fieldPlaceholder),
|
|
3650
|
+
children: Ce || k
|
|
3651
|
+
}),
|
|
3652
|
+
/* @__PURE__ */ f("span", {
|
|
3653
|
+
className: Q.browse,
|
|
3654
|
+
children: "Browse"
|
|
409
3655
|
})
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
"
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
fe(t), W(0), t === "" && (pe(!1), R.current?.focus({ preventScroll: !0 }));
|
|
441
|
-
}
|
|
3656
|
+
]
|
|
3657
|
+
}),
|
|
3658
|
+
Ee,
|
|
3659
|
+
Te
|
|
3660
|
+
] });
|
|
3661
|
+
else if (u === "image") {
|
|
3662
|
+
let e = U[0], t = e ? G[wn(e)] : void 0;
|
|
3663
|
+
De = /* @__PURE__ */ p("div", {
|
|
3664
|
+
className: Q.imageRoot,
|
|
3665
|
+
children: [/* @__PURE__ */ p("div", {
|
|
3666
|
+
className: h(Q.tile, b === "circle" && Q.circle, re && Q.dragging, Se),
|
|
3667
|
+
style: {
|
|
3668
|
+
width: S,
|
|
3669
|
+
height: be
|
|
3670
|
+
},
|
|
3671
|
+
onClick: ge,
|
|
3672
|
+
..._e,
|
|
3673
|
+
children: [
|
|
3674
|
+
ve,
|
|
3675
|
+
t ? /* @__PURE__ */ f("img", {
|
|
3676
|
+
src: t,
|
|
3677
|
+
alt: e?.name ?? "",
|
|
3678
|
+
className: Q.tileImage
|
|
3679
|
+
}) : /* @__PURE__ */ p("span", {
|
|
3680
|
+
className: Q.tileEmpty,
|
|
3681
|
+
children: [/* @__PURE__ */ f(Fn, { className: Q.icon }), /* @__PURE__ */ f("span", { children: e ? e.name : "Upload photo" })]
|
|
3682
|
+
}),
|
|
3683
|
+
/* @__PURE__ */ f("span", {
|
|
3684
|
+
className: Q.overlay,
|
|
3685
|
+
children: e ? "Change" : "Choose"
|
|
442
3686
|
})
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
className:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
3687
|
+
]
|
|
3688
|
+
}), /* @__PURE__ */ p("div", {
|
|
3689
|
+
className: Q.imageSide,
|
|
3690
|
+
children: [e ? /* @__PURE__ */ p(d, { children: [
|
|
3691
|
+
/* @__PURE__ */ f("span", {
|
|
3692
|
+
className: Q.name,
|
|
3693
|
+
children: e.name
|
|
3694
|
+
}),
|
|
3695
|
+
/* @__PURE__ */ f("span", {
|
|
3696
|
+
className: Q.size,
|
|
3697
|
+
children: xn(e.size)
|
|
3698
|
+
}),
|
|
3699
|
+
/* @__PURE__ */ f("button", {
|
|
3700
|
+
type: "button",
|
|
3701
|
+
className: Q.removeText,
|
|
3702
|
+
disabled: F.disabled,
|
|
3703
|
+
onClick: () => fe(e),
|
|
3704
|
+
children: "Remove image"
|
|
3705
|
+
})
|
|
3706
|
+
] }) : null, Ee]
|
|
3707
|
+
})]
|
|
3708
|
+
});
|
|
3709
|
+
} else if (u === "gallery") {
|
|
3710
|
+
let e = v !== void 0 && U.length >= v;
|
|
3711
|
+
De = /* @__PURE__ */ p(d, { children: [
|
|
3712
|
+
/* @__PURE__ */ p("ul", {
|
|
3713
|
+
className: Q.gallery,
|
|
3714
|
+
"aria-label": "Selected images",
|
|
3715
|
+
children: [U.map((e) => /* @__PURE__ */ p("li", {
|
|
3716
|
+
className: Q.thumbItem,
|
|
3717
|
+
children: [
|
|
3718
|
+
G[wn(e)] ? we(e, Q.thumbImage ?? "") : /* @__PURE__ */ f("span", {
|
|
3719
|
+
className: Q.thumbFallback,
|
|
3720
|
+
children: /* @__PURE__ */ f(In, { className: Q.icon })
|
|
3721
|
+
}),
|
|
3722
|
+
/* @__PURE__ */ f("span", {
|
|
3723
|
+
className: Q.thumbName,
|
|
3724
|
+
children: e.name
|
|
3725
|
+
}),
|
|
3726
|
+
/* @__PURE__ */ f("button", {
|
|
3727
|
+
type: "button",
|
|
3728
|
+
className: h(Q.remove, Q.thumbRemove),
|
|
3729
|
+
"aria-label": `Remove ${e.name}`,
|
|
3730
|
+
disabled: F.disabled,
|
|
3731
|
+
onClick: () => fe(e),
|
|
3732
|
+
children: /* @__PURE__ */ f(Ln, {})
|
|
3733
|
+
})
|
|
3734
|
+
]
|
|
3735
|
+
}, wn(e))), e ? null : /* @__PURE__ */ f("li", {
|
|
3736
|
+
className: Q.addItem,
|
|
3737
|
+
children: /* @__PURE__ */ p("div", {
|
|
3738
|
+
className: h(Q.addTile, re && Q.dragging, Se),
|
|
3739
|
+
onClick: ge,
|
|
3740
|
+
..._e,
|
|
3741
|
+
children: [
|
|
3742
|
+
ve,
|
|
3743
|
+
/* @__PURE__ */ f(Fn, { className: Q.icon }),
|
|
3744
|
+
/* @__PURE__ */ f("span", { children: "Add images" })
|
|
3745
|
+
]
|
|
488
3746
|
})
|
|
489
3747
|
})]
|
|
490
|
-
}),
|
|
3748
|
+
}),
|
|
3749
|
+
e ? ve : null,
|
|
3750
|
+
Ee
|
|
3751
|
+
] });
|
|
3752
|
+
} else De = /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("div", {
|
|
3753
|
+
className: h(Q.zone, re && Q.dragging, Se),
|
|
3754
|
+
onClick: ge,
|
|
3755
|
+
..._e,
|
|
3756
|
+
children: [
|
|
3757
|
+
ve,
|
|
3758
|
+
/* @__PURE__ */ f(Pn, { className: Q.icon }),
|
|
3759
|
+
/* @__PURE__ */ p("span", {
|
|
3760
|
+
className: Q.prompt,
|
|
3761
|
+
children: [
|
|
3762
|
+
/* @__PURE__ */ f("span", {
|
|
3763
|
+
className: Q.browseLink,
|
|
3764
|
+
children: B ? "Choose files" : "Choose a file"
|
|
3765
|
+
}),
|
|
3766
|
+
" ",
|
|
3767
|
+
"or drag and drop"
|
|
3768
|
+
]
|
|
3769
|
+
}),
|
|
3770
|
+
pe ? /* @__PURE__ */ f("span", {
|
|
3771
|
+
id: L,
|
|
3772
|
+
className: Q.hint,
|
|
3773
|
+
children: pe
|
|
3774
|
+
}) : null
|
|
3775
|
+
]
|
|
3776
|
+
}), Te] });
|
|
3777
|
+
return /* @__PURE__ */ p("div", {
|
|
3778
|
+
className: h(Q.root, j),
|
|
3779
|
+
children: [
|
|
3780
|
+
De,
|
|
3781
|
+
ae ? /* @__PURE__ */ f(jn, {
|
|
3782
|
+
file: ae.file,
|
|
3783
|
+
aspect: ye,
|
|
3784
|
+
shape: b === "circle" ? "circle" : "rect",
|
|
3785
|
+
outputWidth: xe,
|
|
3786
|
+
outputType: T ?? ([
|
|
3787
|
+
"image/png",
|
|
3788
|
+
"image/jpeg",
|
|
3789
|
+
"image/webp"
|
|
3790
|
+
].includes(ae.file.type) ? ae.file.type : "image/png"),
|
|
3791
|
+
outputQuality: E,
|
|
3792
|
+
title: D,
|
|
3793
|
+
theme: ae.theme,
|
|
3794
|
+
onApply: (e) => {
|
|
3795
|
+
oe(null), le([e]), H.current?.focus({ preventScroll: !0 });
|
|
3796
|
+
},
|
|
3797
|
+
onCancel: () => {
|
|
3798
|
+
oe(null), K(U), H.current?.focus({ preventScroll: !0 });
|
|
3799
|
+
}
|
|
3800
|
+
}) : null,
|
|
3801
|
+
W.length > 0 ? /* @__PURE__ */ f("p", {
|
|
3802
|
+
id: R,
|
|
3803
|
+
className: Q.rejected,
|
|
3804
|
+
role: "alert",
|
|
3805
|
+
children: W.join(". ")
|
|
3806
|
+
}) : null
|
|
491
3807
|
]
|
|
492
3808
|
});
|
|
493
|
-
}),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return !e && !t && !n.error ? /* @__PURE__ */ f(I, {
|
|
497
|
-
...i,
|
|
3809
|
+
}), zn = n(function({ label: e, helperText: t, ...n }, r) {
|
|
3810
|
+
return D() ? !e && !t && !n.error ? /* @__PURE__ */ f(Rn, {
|
|
3811
|
+
...n,
|
|
498
3812
|
ref: r
|
|
499
|
-
}) : /* @__PURE__ */ f(
|
|
3813
|
+
}) : /* @__PURE__ */ f(F, {
|
|
500
3814
|
id: n.id,
|
|
501
3815
|
label: e,
|
|
502
3816
|
helperText: t,
|
|
503
3817
|
error: n.error,
|
|
504
3818
|
required: n.required,
|
|
505
3819
|
disabled: n.disabled,
|
|
506
|
-
children: /* @__PURE__ */ f(
|
|
507
|
-
...
|
|
3820
|
+
children: /* @__PURE__ */ f(Rn, {
|
|
3821
|
+
...n,
|
|
508
3822
|
ref: r
|
|
509
3823
|
})
|
|
510
|
-
});
|
|
511
|
-
}),
|
|
3824
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
3825
|
+
}), Bn = {
|
|
512
3826
|
textarea: "cui-Textarea-module__textarea--Z-y6g",
|
|
513
3827
|
invalid: "cui-Textarea-module__invalid--E88X-",
|
|
514
3828
|
"resize-none": "cui-Textarea-module__resize-none---T499",
|
|
@@ -516,8 +3830,8 @@ var N = {
|
|
|
516
3830
|
"resize-horizontal": "cui-Textarea-module__resize-horizontal--htj2f",
|
|
517
3831
|
"resize-both": "cui-Textarea-module__resize-both--wR4os",
|
|
518
3832
|
readOnly: "cui-Textarea-module__readOnly--mI513"
|
|
519
|
-
},
|
|
520
|
-
let d =
|
|
3833
|
+
}, Vn = n(function({ id: e, required: t, disabled: n, error: r, "aria-describedby": i, rows: a = 3, resize: o = "vertical", readOnly: s, className: c, ...l }, u) {
|
|
3834
|
+
let d = N({
|
|
521
3835
|
id: e,
|
|
522
3836
|
required: t,
|
|
523
3837
|
disabled: n,
|
|
@@ -534,115 +3848,25 @@ var N = {
|
|
|
534
3848
|
readOnly: s,
|
|
535
3849
|
"aria-invalid": d["aria-invalid"],
|
|
536
3850
|
"aria-describedby": d["aria-describedby"],
|
|
537
|
-
className: h(
|
|
3851
|
+
className: h(Bn.textarea, Bn[`resize-${o}`], d.invalid && Bn.invalid, s && Bn.readOnly, c)
|
|
538
3852
|
});
|
|
539
|
-
}),
|
|
540
|
-
return
|
|
3853
|
+
}), Hn = n(function({ label: e, helperText: t, ...n }, r) {
|
|
3854
|
+
return D() ? !e && !t && !n.error ? /* @__PURE__ */ f(Vn, {
|
|
541
3855
|
...n,
|
|
542
3856
|
ref: r
|
|
543
|
-
}) : /* @__PURE__ */ f(
|
|
3857
|
+
}) : /* @__PURE__ */ f(F, {
|
|
544
3858
|
id: n.id,
|
|
545
3859
|
label: e,
|
|
546
3860
|
helperText: t,
|
|
547
3861
|
error: n.error,
|
|
548
3862
|
required: n.required,
|
|
549
3863
|
disabled: n.disabled,
|
|
550
|
-
children: /* @__PURE__ */ f(
|
|
3864
|
+
children: /* @__PURE__ */ f(Vn, {
|
|
551
3865
|
...n,
|
|
552
3866
|
ref: r
|
|
553
3867
|
})
|
|
554
|
-
}) : /* @__PURE__ */ f(
|
|
555
|
-
}),
|
|
556
|
-
root: "cui-Checkbox-module__root--mY3qk",
|
|
557
|
-
label: "cui-Checkbox-module__label--cwRtI",
|
|
558
|
-
disabled: "cui-Checkbox-module__disabled--x7-eg",
|
|
559
|
-
input: "cui-Checkbox-module__input--2kt-h",
|
|
560
|
-
box: "cui-Checkbox-module__box--OCPee",
|
|
561
|
-
check: "cui-Checkbox-module__check--4HYWn",
|
|
562
|
-
dash: "cui-Checkbox-module__dash--5Dkdl",
|
|
563
|
-
invalid: "cui-Checkbox-module__invalid---Cs7q",
|
|
564
|
-
text: "cui-Checkbox-module__text--EmtRj",
|
|
565
|
-
required: "cui-Checkbox-module__required--t9DLN",
|
|
566
|
-
message: "cui-Checkbox-module__message--ZPKsV",
|
|
567
|
-
helper: "cui-Checkbox-module__helper--16DrX",
|
|
568
|
-
error: "cui-Checkbox-module__error--E-bmD"
|
|
569
|
-
}, ue = n(function({ label: e, helperText: t, error: n, indeterminate: i = !1, id: o, required: s, disabled: l, "aria-describedby": u, className: d, ...m }, g) {
|
|
570
|
-
let _ = c(null), v = r((e) => {
|
|
571
|
-
_.current = e, typeof g == "function" ? g(e) : g && (g.current = e);
|
|
572
|
-
}, [g]);
|
|
573
|
-
a(() => {
|
|
574
|
-
_.current && (_.current.indeterminate = i);
|
|
575
|
-
}, [i]);
|
|
576
|
-
let y = A({
|
|
577
|
-
id: o,
|
|
578
|
-
required: s,
|
|
579
|
-
disabled: l,
|
|
580
|
-
error: n,
|
|
581
|
-
"aria-describedby": u
|
|
582
|
-
});
|
|
583
|
-
if (!E()) return /* @__PURE__ */ f(D, {});
|
|
584
|
-
let b = `${y.id}-message`, x = !!(n || t), S = [y["aria-describedby"], x ? b : void 0].filter(Boolean).join(" ") || void 0;
|
|
585
|
-
return /* @__PURE__ */ p("div", {
|
|
586
|
-
className: h(z.root, d),
|
|
587
|
-
children: [/* @__PURE__ */ p("label", {
|
|
588
|
-
className: h(z.label, y.disabled && z.disabled),
|
|
589
|
-
children: [
|
|
590
|
-
/* @__PURE__ */ f("input", {
|
|
591
|
-
...m,
|
|
592
|
-
ref: v,
|
|
593
|
-
id: y.id,
|
|
594
|
-
type: "checkbox",
|
|
595
|
-
required: y.required,
|
|
596
|
-
disabled: y.disabled,
|
|
597
|
-
"aria-invalid": y["aria-invalid"],
|
|
598
|
-
"aria-describedby": S,
|
|
599
|
-
className: h(z.input, y.invalid && z.invalid)
|
|
600
|
-
}),
|
|
601
|
-
/* @__PURE__ */ p("span", {
|
|
602
|
-
className: z.box,
|
|
603
|
-
"aria-hidden": "true",
|
|
604
|
-
children: [/* @__PURE__ */ f("svg", {
|
|
605
|
-
className: z.check,
|
|
606
|
-
viewBox: "0 0 20 20",
|
|
607
|
-
focusable: "false",
|
|
608
|
-
children: /* @__PURE__ */ f("path", {
|
|
609
|
-
d: "M4.5 10.5l3.5 3.5 7.5-8",
|
|
610
|
-
fill: "none",
|
|
611
|
-
stroke: "currentColor",
|
|
612
|
-
strokeWidth: "2.5",
|
|
613
|
-
strokeLinecap: "round",
|
|
614
|
-
strokeLinejoin: "round"
|
|
615
|
-
})
|
|
616
|
-
}), /* @__PURE__ */ f("svg", {
|
|
617
|
-
className: z.dash,
|
|
618
|
-
viewBox: "0 0 20 20",
|
|
619
|
-
focusable: "false",
|
|
620
|
-
children: /* @__PURE__ */ f("path", {
|
|
621
|
-
d: "M5 10h10",
|
|
622
|
-
fill: "none",
|
|
623
|
-
stroke: "currentColor",
|
|
624
|
-
strokeWidth: "2.5",
|
|
625
|
-
strokeLinecap: "round"
|
|
626
|
-
})
|
|
627
|
-
})]
|
|
628
|
-
}),
|
|
629
|
-
e ? /* @__PURE__ */ p("span", {
|
|
630
|
-
className: z.text,
|
|
631
|
-
children: [e, y.required ? /* @__PURE__ */ f("span", {
|
|
632
|
-
className: z.required,
|
|
633
|
-
"aria-hidden": "true",
|
|
634
|
-
children: "*"
|
|
635
|
-
}) : null]
|
|
636
|
-
}) : null
|
|
637
|
-
]
|
|
638
|
-
}), x ? /* @__PURE__ */ f("p", {
|
|
639
|
-
id: b,
|
|
640
|
-
className: h(z.message, n ? z.error : z.helper),
|
|
641
|
-
role: n ? "alert" : void 0,
|
|
642
|
-
children: n || t
|
|
643
|
-
}) : null]
|
|
644
|
-
});
|
|
645
|
-
}), B = {
|
|
3868
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
3869
|
+
}), Un = {
|
|
646
3870
|
root: "cui-Switch-module__root--Y5Ydi",
|
|
647
3871
|
label: "cui-Switch-module__label--LrH7V",
|
|
648
3872
|
disabled: "cui-Switch-module__disabled--2aZ0V",
|
|
@@ -654,20 +3878,20 @@ var N = {
|
|
|
654
3878
|
message: "cui-Switch-module__message--fA-a5",
|
|
655
3879
|
helper: "cui-Switch-module__helper--gZCYS",
|
|
656
3880
|
error: "cui-Switch-module__error--OSPrU"
|
|
657
|
-
},
|
|
658
|
-
let u =
|
|
3881
|
+
}, Wn = n(function({ label: e, helperText: t, error: n, id: r, required: i, disabled: a, "aria-describedby": o, className: s, ...c }, l) {
|
|
3882
|
+
let u = N({
|
|
659
3883
|
id: r,
|
|
660
3884
|
required: i,
|
|
661
3885
|
disabled: a,
|
|
662
3886
|
error: n,
|
|
663
3887
|
"aria-describedby": o
|
|
664
3888
|
});
|
|
665
|
-
if (!
|
|
3889
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
666
3890
|
let d = `${u.id}-message`, m = !!(n || t), g = [u["aria-describedby"], m ? d : void 0].filter(Boolean).join(" ") || void 0;
|
|
667
3891
|
return /* @__PURE__ */ p("div", {
|
|
668
|
-
className: h(
|
|
3892
|
+
className: h(Un.root, s),
|
|
669
3893
|
children: [/* @__PURE__ */ p("label", {
|
|
670
|
-
className: h(
|
|
3894
|
+
className: h(Un.label, u.disabled && Un.disabled),
|
|
671
3895
|
children: [
|
|
672
3896
|
/* @__PURE__ */ f("input", {
|
|
673
3897
|
...c,
|
|
@@ -679,17 +3903,17 @@ var N = {
|
|
|
679
3903
|
disabled: u.disabled,
|
|
680
3904
|
"aria-invalid": u["aria-invalid"],
|
|
681
3905
|
"aria-describedby": g,
|
|
682
|
-
className: h(
|
|
3906
|
+
className: h(Un.input, u.invalid && Un.invalid)
|
|
683
3907
|
}),
|
|
684
3908
|
/* @__PURE__ */ f("span", {
|
|
685
|
-
className:
|
|
3909
|
+
className: Un.track,
|
|
686
3910
|
"aria-hidden": "true",
|
|
687
|
-
children: /* @__PURE__ */ f("span", { className:
|
|
3911
|
+
children: /* @__PURE__ */ f("span", { className: Un.thumb })
|
|
688
3912
|
}),
|
|
689
3913
|
e ? /* @__PURE__ */ p("span", {
|
|
690
|
-
className:
|
|
3914
|
+
className: Un.text,
|
|
691
3915
|
children: [e, u.required ? /* @__PURE__ */ f("span", {
|
|
692
|
-
className:
|
|
3916
|
+
className: Un.required,
|
|
693
3917
|
"aria-hidden": "true",
|
|
694
3918
|
children: "*"
|
|
695
3919
|
}) : null]
|
|
@@ -697,12 +3921,12 @@ var N = {
|
|
|
697
3921
|
]
|
|
698
3922
|
}), m ? /* @__PURE__ */ f("p", {
|
|
699
3923
|
id: d,
|
|
700
|
-
className: h(
|
|
3924
|
+
className: h(Un.message, n ? Un.error : Un.helper),
|
|
701
3925
|
role: n ? "alert" : void 0,
|
|
702
3926
|
children: n || t
|
|
703
3927
|
}) : null]
|
|
704
3928
|
});
|
|
705
|
-
}),
|
|
3929
|
+
}), Gn = {
|
|
706
3930
|
root: "cui-Badge-module__root--5osNT",
|
|
707
3931
|
dot: "cui-Badge-module__dot--i0c-G",
|
|
708
3932
|
neutral: "cui-Badge-module__neutral--lulSm",
|
|
@@ -714,42 +3938,17 @@ var N = {
|
|
|
714
3938
|
};
|
|
715
3939
|
//#endregion
|
|
716
3940
|
//#region src/components/Badge/Badge.tsx
|
|
717
|
-
function
|
|
718
|
-
return
|
|
3941
|
+
function Kn({ color: e = "neutral", dot: t = !1, className: n, children: r, ...i }) {
|
|
3942
|
+
return D() ? /* @__PURE__ */ p("span", {
|
|
719
3943
|
...i,
|
|
720
|
-
className: h(
|
|
3944
|
+
className: h(Gn.root, Gn[e], n),
|
|
721
3945
|
children: [t ? /* @__PURE__ */ f("span", {
|
|
722
|
-
className:
|
|
3946
|
+
className: Gn.dot,
|
|
723
3947
|
"aria-hidden": "true"
|
|
724
3948
|
}) : null, r]
|
|
725
|
-
}) : /* @__PURE__ */ f(
|
|
726
|
-
}
|
|
727
|
-
var H = {
|
|
728
|
-
root: "cui-Skeleton-module__root--qaX19",
|
|
729
|
-
"cui-skeleton-pulse": "cui-Skeleton-module__cui-skeleton-pulse--HzSoY",
|
|
730
|
-
rect: "cui-Skeleton-module__rect--do1uR",
|
|
731
|
-
text: "cui-Skeleton-module__text---A8IF",
|
|
732
|
-
circle: "cui-Skeleton-module__circle--DYcl8"
|
|
733
|
-
};
|
|
734
|
-
//#endregion
|
|
735
|
-
//#region src/components/Skeleton/Skeleton.tsx
|
|
736
|
-
function pe({ variant: e = "rect", width: t, height: n, className: r, style: i, ...a }) {
|
|
737
|
-
if (!E()) return /* @__PURE__ */ f(D, {});
|
|
738
|
-
let o = {
|
|
739
|
-
width: t,
|
|
740
|
-
height: n ?? (e === "circle" ? t : void 0)
|
|
741
|
-
};
|
|
742
|
-
return /* @__PURE__ */ f("span", {
|
|
743
|
-
"aria-hidden": "true",
|
|
744
|
-
...a,
|
|
745
|
-
className: h(H.root, H[e], r),
|
|
746
|
-
style: {
|
|
747
|
-
...o,
|
|
748
|
-
...i
|
|
749
|
-
}
|
|
750
|
-
});
|
|
3949
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
751
3950
|
}
|
|
752
|
-
var
|
|
3951
|
+
var qn = {
|
|
753
3952
|
root: "cui-Tabs-module__root---VKVI",
|
|
754
3953
|
list: "cui-Tabs-module__list--qRVME",
|
|
755
3954
|
tab: "cui-Tabs-module__tab--IdDYc",
|
|
@@ -759,9 +3958,9 @@ var U = {
|
|
|
759
3958
|
};
|
|
760
3959
|
//#endregion
|
|
761
3960
|
//#region src/components/Tabs/Tabs.tsx
|
|
762
|
-
function
|
|
3961
|
+
function Jn({ items: e, value: t, defaultValue: n, onValueChange: r, className: i, "aria-label": a, ...s }) {
|
|
763
3962
|
let u = o(), d = c([]), m = e.find((e) => !e.disabled)?.value, [g, _] = l(n ?? m);
|
|
764
|
-
if (!
|
|
3963
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
765
3964
|
let v = t ?? g, y = e.findIndex((e) => e.value === v), b = e[y], x = (e) => {
|
|
766
3965
|
t === void 0 && _(e), r?.(e);
|
|
767
3966
|
}, S = (t, n) => {
|
|
@@ -785,11 +3984,11 @@ function W({ items: e, value: t, defaultValue: n, onValueChange: r, className: i
|
|
|
785
3984
|
}, w = (e) => `${u}-tab-${e}`, T = (e) => `${u}-panel-${e}`;
|
|
786
3985
|
return /* @__PURE__ */ p("div", {
|
|
787
3986
|
...s,
|
|
788
|
-
className: h(
|
|
3987
|
+
className: h(qn.root, i),
|
|
789
3988
|
children: [/* @__PURE__ */ f("div", {
|
|
790
3989
|
role: "tablist",
|
|
791
3990
|
"aria-label": a,
|
|
792
|
-
className:
|
|
3991
|
+
className: qn.list,
|
|
793
3992
|
children: e.map((e, t) => {
|
|
794
3993
|
let n = t === y;
|
|
795
3994
|
return /* @__PURE__ */ p("button", {
|
|
@@ -803,11 +4002,11 @@ function W({ items: e, value: t, defaultValue: n, onValueChange: r, className: i
|
|
|
803
4002
|
"aria-controls": n && e.content !== void 0 ? T(t) : void 0,
|
|
804
4003
|
tabIndex: n ? 0 : -1,
|
|
805
4004
|
disabled: e.disabled,
|
|
806
|
-
className: h(
|
|
4005
|
+
className: h(qn.tab, n && qn.selected),
|
|
807
4006
|
onClick: () => x(e.value),
|
|
808
4007
|
onKeyDown: (e) => C(e, t),
|
|
809
4008
|
children: [e.icon ? /* @__PURE__ */ f("span", {
|
|
810
|
-
className:
|
|
4009
|
+
className: qn.icon,
|
|
811
4010
|
"aria-hidden": "true",
|
|
812
4011
|
children: e.icon
|
|
813
4012
|
}) : null, e.label]
|
|
@@ -818,12 +4017,12 @@ function W({ items: e, value: t, defaultValue: n, onValueChange: r, className: i
|
|
|
818
4017
|
id: T(y),
|
|
819
4018
|
"aria-labelledby": w(y),
|
|
820
4019
|
tabIndex: 0,
|
|
821
|
-
className:
|
|
4020
|
+
className: qn.panel,
|
|
822
4021
|
children: b.content
|
|
823
4022
|
}) : null]
|
|
824
4023
|
});
|
|
825
4024
|
}
|
|
826
|
-
var
|
|
4025
|
+
var Yn = {
|
|
827
4026
|
root: "cui-FormSection-module__root--M70AE",
|
|
828
4027
|
header: "cui-FormSection-module__header--xTDAF",
|
|
829
4028
|
heading: "cui-FormSection-module__heading--QU0-u",
|
|
@@ -836,34 +4035,34 @@ var G = {
|
|
|
836
4035
|
};
|
|
837
4036
|
//#endregion
|
|
838
4037
|
//#region src/components/FormSection/FormSection.tsx
|
|
839
|
-
function
|
|
4038
|
+
function Xn({ title: e, subtitle: n, children: r, columns: i = 1, headingLevel: a = 3, className: s, ...c }) {
|
|
840
4039
|
let l = o(), u = !!(e || n);
|
|
841
|
-
return
|
|
4040
|
+
return D() ? /* @__PURE__ */ p("section", {
|
|
842
4041
|
...c,
|
|
843
4042
|
"aria-labelledby": e ? l : c["aria-labelledby"],
|
|
844
|
-
className: h(
|
|
4043
|
+
className: h(Yn.root, s),
|
|
845
4044
|
children: [u ? /* @__PURE__ */ p("div", {
|
|
846
|
-
className:
|
|
4045
|
+
className: Yn.header,
|
|
847
4046
|
children: [/* @__PURE__ */ p("div", {
|
|
848
|
-
className:
|
|
4047
|
+
className: Yn.heading,
|
|
849
4048
|
children: [e ? t(`h${a}`, {
|
|
850
4049
|
id: l,
|
|
851
|
-
className:
|
|
4050
|
+
className: Yn.title
|
|
852
4051
|
}, e) : null, n ? /* @__PURE__ */ f("p", {
|
|
853
|
-
className:
|
|
4052
|
+
className: Yn.subtitle,
|
|
854
4053
|
children: n
|
|
855
4054
|
}) : null]
|
|
856
4055
|
}), /* @__PURE__ */ f("span", {
|
|
857
|
-
className:
|
|
4056
|
+
className: Yn.divider,
|
|
858
4057
|
"aria-hidden": "true"
|
|
859
4058
|
})]
|
|
860
4059
|
}) : null, /* @__PURE__ */ f("div", {
|
|
861
|
-
className: h(
|
|
4060
|
+
className: h(Yn.fields, Yn[`columns${i}`]),
|
|
862
4061
|
children: r
|
|
863
4062
|
})]
|
|
864
|
-
}) : /* @__PURE__ */ f(
|
|
4063
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
865
4064
|
}
|
|
866
|
-
var
|
|
4065
|
+
var Zn = {
|
|
867
4066
|
root: "cui-Avatar-module__root--fXu-J",
|
|
868
4067
|
xs: "cui-Avatar-module__xs--oSaLL",
|
|
869
4068
|
sm: "cui-Avatar-module__sm--sZ2bk",
|
|
@@ -878,31 +4077,31 @@ var K = {
|
|
|
878
4077
|
tone3: "cui-Avatar-module__tone3--goa6z",
|
|
879
4078
|
tone4: "cui-Avatar-module__tone4--g6kRy",
|
|
880
4079
|
primary: "cui-Avatar-module__primary--HKPgn"
|
|
881
|
-
},
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
4080
|
+
}, Qn = [
|
|
4081
|
+
Zn.tone0,
|
|
4082
|
+
Zn.tone1,
|
|
4083
|
+
Zn.tone2,
|
|
4084
|
+
Zn.tone3,
|
|
4085
|
+
Zn.tone4
|
|
887
4086
|
];
|
|
888
|
-
function
|
|
4087
|
+
function $n(e) {
|
|
889
4088
|
let t = (e ?? "").trim().split(/\s+/).filter(Boolean);
|
|
890
4089
|
return t.length === 0 ? "" : ((t[0]?.[0] ?? "") + (t.length > 1 ? t[t.length - 1]?.[0] ?? "" : "")).toUpperCase();
|
|
891
4090
|
}
|
|
892
|
-
function
|
|
4091
|
+
function er(e) {
|
|
893
4092
|
let t = e ?? "", n = 0;
|
|
894
4093
|
for (let e = 0; e < t.length; e++) n = n * 31 + t.charCodeAt(e) >>> 0;
|
|
895
|
-
return
|
|
4094
|
+
return Qn[n % Qn.length];
|
|
896
4095
|
}
|
|
897
|
-
function
|
|
898
|
-
let [o, s] = l(null), c = !!t && t !== o, u =
|
|
899
|
-
return
|
|
4096
|
+
function tr({ name: e, src: t, size: n = "md", tone: r = "auto", className: i, ...a }) {
|
|
4097
|
+
let [o, s] = l(null), c = !!t && t !== o, u = $n(e);
|
|
4098
|
+
return D() ? /* @__PURE__ */ f("span", {
|
|
900
4099
|
role: a["aria-hidden"] ? void 0 : "img",
|
|
901
4100
|
"aria-label": a["aria-hidden"] || !e ? void 0 : e,
|
|
902
4101
|
...a,
|
|
903
|
-
className: h(
|
|
4102
|
+
className: h(Zn.root, Zn[n], !c && (r === "primary" ? Zn.primary : er(e)), i),
|
|
904
4103
|
children: c ? /* @__PURE__ */ f("img", {
|
|
905
|
-
className:
|
|
4104
|
+
className: Zn.image,
|
|
906
4105
|
src: t ?? void 0,
|
|
907
4106
|
alt: "",
|
|
908
4107
|
onError: () => s(t ?? null)
|
|
@@ -910,7 +4109,7 @@ function Y({ name: e, src: t, size: n = "md", tone: r = "auto", className: i, ..
|
|
|
910
4109
|
"aria-hidden": "true",
|
|
911
4110
|
children: u
|
|
912
4111
|
}) : /* @__PURE__ */ p("svg", {
|
|
913
|
-
className:
|
|
4112
|
+
className: Zn.fallback,
|
|
914
4113
|
viewBox: "0 0 24 24",
|
|
915
4114
|
"aria-hidden": "true",
|
|
916
4115
|
focusable: "false",
|
|
@@ -924,9 +4123,9 @@ function Y({ name: e, src: t, size: n = "md", tone: r = "auto", className: i, ..
|
|
|
924
4123
|
fill: "currentColor"
|
|
925
4124
|
})]
|
|
926
4125
|
})
|
|
927
|
-
}) : /* @__PURE__ */ f(
|
|
4126
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
928
4127
|
}
|
|
929
|
-
var
|
|
4128
|
+
var $ = {
|
|
930
4129
|
root: "cui-AccountPanel-module__root--Twbp0",
|
|
931
4130
|
rootSidebar: "cui-AccountPanel-module__rootSidebar--OMB7L",
|
|
932
4131
|
contents: "cui-AccountPanel-module__contents--OFL-r",
|
|
@@ -966,23 +4165,23 @@ var X = {
|
|
|
966
4165
|
appName: "cui-AccountPanel-module__appName--MJc25",
|
|
967
4166
|
danger: "cui-AccountPanel-module__danger--t0t-L",
|
|
968
4167
|
dangerAction: "cui-AccountPanel-module__dangerAction--jvJ7-"
|
|
969
|
-
},
|
|
4168
|
+
}, nr = 8, rr = 12, ir = 352, ar = "a[href], button:not([disabled])", or = ({ href: e, className: t, title: n, onClick: r, children: i }) => /* @__PURE__ */ f("a", {
|
|
970
4169
|
href: e,
|
|
971
4170
|
className: t,
|
|
972
4171
|
title: n,
|
|
973
4172
|
onClick: r,
|
|
974
4173
|
children: i
|
|
975
|
-
}),
|
|
976
|
-
primary:
|
|
977
|
-
info:
|
|
978
|
-
success:
|
|
979
|
-
warning:
|
|
980
|
-
danger:
|
|
981
|
-
neutral:
|
|
4174
|
+
}), sr = {
|
|
4175
|
+
primary: $.tonePrimary,
|
|
4176
|
+
info: $.toneInfo,
|
|
4177
|
+
success: $.toneSuccess,
|
|
4178
|
+
warning: $.toneWarning,
|
|
4179
|
+
danger: $.toneDanger,
|
|
4180
|
+
neutral: $.toneNeutral
|
|
982
4181
|
};
|
|
983
|
-
function
|
|
4182
|
+
function cr() {
|
|
984
4183
|
return /* @__PURE__ */ f("svg", {
|
|
985
|
-
className:
|
|
4184
|
+
className: $.externalIcon,
|
|
986
4185
|
viewBox: "0 0 20 20",
|
|
987
4186
|
"aria-hidden": "true",
|
|
988
4187
|
focusable: "false",
|
|
@@ -996,71 +4195,71 @@ function xe() {
|
|
|
996
4195
|
})
|
|
997
4196
|
});
|
|
998
4197
|
}
|
|
999
|
-
function
|
|
1000
|
-
let v = r === "sidebar", y = o(), b = c(null), x = c(null), S = c(null), [C, w] = l(!1), [T,
|
|
4198
|
+
function lr({ user: e, apps: t = [], actions: n = [], placement: r = "header", collapsed: i = !1, appsTitle: s = "All Apps", greeting: u = "Hi", renderLink: g = or, className: _ }) {
|
|
4199
|
+
let v = r === "sidebar", y = o(), b = c(null), x = c(null), S = c(null), [C, w] = l(!1), [T, E] = l(null), [O, A] = l(), j = () => {
|
|
1001
4200
|
let e = x.current;
|
|
1002
4201
|
if (!e) return;
|
|
1003
4202
|
let t = e.getBoundingClientRect();
|
|
1004
4203
|
if (v) {
|
|
1005
|
-
let e = Math.min(
|
|
1006
|
-
|
|
1007
|
-
left: Math.max(
|
|
1008
|
-
bottom: Math.max(
|
|
4204
|
+
let e = Math.min(ir, window.innerWidth - 24);
|
|
4205
|
+
E({
|
|
4206
|
+
left: Math.max(rr, Math.min(t.right + nr, window.innerWidth - e - rr)),
|
|
4207
|
+
bottom: Math.max(rr, window.innerHeight - t.bottom)
|
|
1009
4208
|
});
|
|
1010
|
-
} else
|
|
1011
|
-
top: t.bottom +
|
|
1012
|
-
right: Math.max(
|
|
4209
|
+
} else E({
|
|
4210
|
+
top: t.bottom + nr,
|
|
4211
|
+
right: Math.max(rr, window.innerWidth - t.right)
|
|
1013
4212
|
});
|
|
1014
|
-
},
|
|
1015
|
-
|
|
1016
|
-
},
|
|
4213
|
+
}, M = () => {
|
|
4214
|
+
j(), A(b.current?.closest("[data-theme]")?.getAttribute("data-theme") ?? void 0), w(!0);
|
|
4215
|
+
}, N = () => w(!1);
|
|
1017
4216
|
a(() => {
|
|
1018
4217
|
C && S.current?.focus({ preventScroll: !0 });
|
|
1019
4218
|
}, [C]), a(() => {
|
|
1020
4219
|
if (!C) return;
|
|
1021
|
-
let e = () => requestAnimationFrame(
|
|
4220
|
+
let e = () => requestAnimationFrame(j), t = (e) => {
|
|
1022
4221
|
let t = e.target;
|
|
1023
|
-
!b.current?.contains(t) && !S.current?.contains(t) &&
|
|
4222
|
+
!b.current?.contains(t) && !S.current?.contains(t) && N();
|
|
1024
4223
|
};
|
|
1025
4224
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t, !0), () => {
|
|
1026
4225
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t, !0);
|
|
1027
4226
|
};
|
|
1028
4227
|
}, [C, v]);
|
|
1029
|
-
let
|
|
4228
|
+
let P = (e) => {
|
|
1030
4229
|
if (e.key === "Escape") {
|
|
1031
|
-
e.preventDefault(), e.stopPropagation(),
|
|
4230
|
+
e.preventDefault(), e.stopPropagation(), N(), x.current?.focus({ preventScroll: !0 });
|
|
1032
4231
|
return;
|
|
1033
4232
|
}
|
|
1034
4233
|
if (e.key !== "Tab") return;
|
|
1035
|
-
let t = Array.from(S.current?.querySelectorAll(
|
|
4234
|
+
let t = Array.from(S.current?.querySelectorAll(ar) ?? []), n = t[0], r = t[t.length - 1];
|
|
1036
4235
|
n && r && (e.shiftKey && (document.activeElement === n || document.activeElement === S.current) ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
1037
4236
|
};
|
|
1038
|
-
if (!
|
|
1039
|
-
let
|
|
1040
|
-
e.onClick?.(),
|
|
1041
|
-
},
|
|
4237
|
+
if (!D()) return /* @__PURE__ */ f(k, {});
|
|
4238
|
+
let F = e.name.trim().split(/\s+/)[0] ?? e.name, I = n.filter((e) => e.tone !== "danger"), L = n.filter((e) => e.tone === "danger"), R = (e) => {
|
|
4239
|
+
e.onClick?.(), N();
|
|
4240
|
+
}, z = /* @__PURE__ */ p("div", {
|
|
1042
4241
|
ref: S,
|
|
1043
4242
|
id: y,
|
|
1044
4243
|
role: "dialog",
|
|
1045
4244
|
"aria-label": "Account",
|
|
1046
4245
|
tabIndex: -1,
|
|
1047
|
-
className: h(
|
|
4246
|
+
className: h($.panel, v && $.panelSidebar),
|
|
1048
4247
|
style: T ?? void 0,
|
|
1049
|
-
"data-theme":
|
|
1050
|
-
onKeyDown:
|
|
4248
|
+
"data-theme": O,
|
|
4249
|
+
onKeyDown: P,
|
|
1051
4250
|
children: [
|
|
1052
4251
|
/* @__PURE__ */ p("div", {
|
|
1053
|
-
className:
|
|
4252
|
+
className: $.identity,
|
|
1054
4253
|
children: [
|
|
1055
4254
|
e.email ? /* @__PURE__ */ f("p", {
|
|
1056
|
-
className:
|
|
4255
|
+
className: $.email,
|
|
1057
4256
|
children: e.email
|
|
1058
4257
|
}) : null,
|
|
1059
4258
|
/* @__PURE__ */ f("span", {
|
|
1060
|
-
className:
|
|
4259
|
+
className: $.avatarRing,
|
|
1061
4260
|
children: /* @__PURE__ */ f("span", {
|
|
1062
|
-
className:
|
|
1063
|
-
children: /* @__PURE__ */ f(
|
|
4261
|
+
className: $.avatarInner,
|
|
4262
|
+
children: /* @__PURE__ */ f(tr, {
|
|
1064
4263
|
name: e.name,
|
|
1065
4264
|
src: e.avatarUrl,
|
|
1066
4265
|
size: "xl",
|
|
@@ -1070,53 +4269,53 @@ function Se({ user: e, apps: t = [], actions: n = [], placement: r = "header", c
|
|
|
1070
4269
|
})
|
|
1071
4270
|
}),
|
|
1072
4271
|
/* @__PURE__ */ p("p", {
|
|
1073
|
-
className:
|
|
4272
|
+
className: $.greeting,
|
|
1074
4273
|
children: [
|
|
1075
4274
|
u,
|
|
1076
4275
|
", ",
|
|
1077
|
-
|
|
4276
|
+
F,
|
|
1078
4277
|
"!"
|
|
1079
4278
|
]
|
|
1080
4279
|
}),
|
|
1081
4280
|
e.role ? /* @__PURE__ */ f("span", {
|
|
1082
|
-
className:
|
|
4281
|
+
className: $.role,
|
|
1083
4282
|
children: e.role
|
|
1084
4283
|
}) : null,
|
|
1085
|
-
|
|
1086
|
-
className:
|
|
1087
|
-
children:
|
|
4284
|
+
I.length > 0 ? /* @__PURE__ */ f("div", {
|
|
4285
|
+
className: $.pills,
|
|
4286
|
+
children: I.map((e) => {
|
|
1088
4287
|
let t = /* @__PURE__ */ p(d, { children: [
|
|
1089
4288
|
e.icon ? /* @__PURE__ */ f("span", {
|
|
1090
|
-
className:
|
|
4289
|
+
className: $.actionIcon,
|
|
1091
4290
|
"aria-hidden": "true",
|
|
1092
4291
|
children: e.icon
|
|
1093
4292
|
}) : null,
|
|
1094
4293
|
/* @__PURE__ */ f("span", { children: e.label }),
|
|
1095
|
-
e.external ? /* @__PURE__ */ f(
|
|
4294
|
+
e.external ? /* @__PURE__ */ f(cr, {}) : null
|
|
1096
4295
|
] });
|
|
1097
4296
|
return e.href && !e.disabled ? e.external ? /* @__PURE__ */ f("a", {
|
|
1098
4297
|
href: e.href,
|
|
1099
4298
|
target: "_blank",
|
|
1100
4299
|
rel: "noreferrer",
|
|
1101
4300
|
title: e.title,
|
|
1102
|
-
className:
|
|
1103
|
-
onClick: () =>
|
|
4301
|
+
className: $.pill,
|
|
4302
|
+
onClick: () => N(),
|
|
1104
4303
|
children: t
|
|
1105
4304
|
}, e.id) : /* @__PURE__ */ f("span", {
|
|
1106
|
-
className:
|
|
4305
|
+
className: $.contents,
|
|
1107
4306
|
children: g({
|
|
1108
4307
|
href: e.href,
|
|
1109
|
-
className:
|
|
4308
|
+
className: $.pill ?? "",
|
|
1110
4309
|
title: e.title,
|
|
1111
|
-
onClick: () =>
|
|
4310
|
+
onClick: () => N(),
|
|
1112
4311
|
children: t
|
|
1113
4312
|
})
|
|
1114
4313
|
}, e.id) : /* @__PURE__ */ f("button", {
|
|
1115
4314
|
type: "button",
|
|
1116
4315
|
disabled: e.disabled,
|
|
1117
4316
|
title: e.title,
|
|
1118
|
-
className:
|
|
1119
|
-
onClick: () =>
|
|
4317
|
+
className: $.pill,
|
|
4318
|
+
onClick: () => R(e),
|
|
1120
4319
|
children: t
|
|
1121
4320
|
}, e.id);
|
|
1122
4321
|
})
|
|
@@ -1124,36 +4323,36 @@ function Se({ user: e, apps: t = [], actions: n = [], placement: r = "header", c
|
|
|
1124
4323
|
]
|
|
1125
4324
|
}),
|
|
1126
4325
|
e.details?.length ? /* @__PURE__ */ f("dl", {
|
|
1127
|
-
className:
|
|
4326
|
+
className: $.details,
|
|
1128
4327
|
children: e.details.map((e) => /* @__PURE__ */ p("div", {
|
|
1129
|
-
className:
|
|
4328
|
+
className: $.detailRow,
|
|
1130
4329
|
children: [/* @__PURE__ */ f("dt", { children: e.label }), /* @__PURE__ */ f("dd", { children: e.value })]
|
|
1131
4330
|
}, e.label))
|
|
1132
4331
|
}) : null,
|
|
1133
4332
|
t.length > 0 ? /* @__PURE__ */ p("section", {
|
|
1134
|
-
className:
|
|
4333
|
+
className: $.apps,
|
|
1135
4334
|
"aria-label": s,
|
|
1136
4335
|
children: [/* @__PURE__ */ f("p", {
|
|
1137
|
-
className:
|
|
4336
|
+
className: $.appsTitle,
|
|
1138
4337
|
children: s
|
|
1139
4338
|
}), /* @__PURE__ */ f("div", {
|
|
1140
|
-
className:
|
|
4339
|
+
className: $.grid,
|
|
1141
4340
|
children: t.map((e) => {
|
|
1142
4341
|
let t = /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
1143
|
-
className: h(
|
|
4342
|
+
className: h($.tile, sr[e.tone ?? "primary"]),
|
|
1144
4343
|
"aria-hidden": "true",
|
|
1145
4344
|
children: e.icon
|
|
1146
4345
|
}), /* @__PURE__ */ f("span", {
|
|
1147
|
-
className:
|
|
4346
|
+
className: $.appName,
|
|
1148
4347
|
children: e.name
|
|
1149
4348
|
})] });
|
|
1150
4349
|
return e.current ? /* @__PURE__ */ f("span", {
|
|
1151
|
-
className:
|
|
4350
|
+
className: $.contents,
|
|
1152
4351
|
children: g({
|
|
1153
4352
|
href: e.url,
|
|
1154
|
-
className:
|
|
4353
|
+
className: $.app ?? "",
|
|
1155
4354
|
title: e.description,
|
|
1156
|
-
onClick: () =>
|
|
4355
|
+
onClick: () => N(),
|
|
1157
4356
|
children: t
|
|
1158
4357
|
})
|
|
1159
4358
|
}, e.id) : /* @__PURE__ */ f("a", {
|
|
@@ -1161,22 +4360,22 @@ function Se({ user: e, apps: t = [], actions: n = [], placement: r = "header", c
|
|
|
1161
4360
|
target: "_blank",
|
|
1162
4361
|
rel: "noreferrer",
|
|
1163
4362
|
title: e.description,
|
|
1164
|
-
className:
|
|
4363
|
+
className: $.app,
|
|
1165
4364
|
children: t
|
|
1166
4365
|
}, e.id);
|
|
1167
4366
|
})
|
|
1168
4367
|
})]
|
|
1169
4368
|
}) : null,
|
|
1170
|
-
|
|
1171
|
-
className:
|
|
1172
|
-
children:
|
|
4369
|
+
L.length > 0 ? /* @__PURE__ */ f("div", {
|
|
4370
|
+
className: $.danger,
|
|
4371
|
+
children: L.map((e) => /* @__PURE__ */ p("button", {
|
|
1173
4372
|
type: "button",
|
|
1174
4373
|
disabled: e.disabled,
|
|
1175
4374
|
title: e.title,
|
|
1176
|
-
className:
|
|
1177
|
-
onClick: () =>
|
|
4375
|
+
className: $.dangerAction,
|
|
4376
|
+
onClick: () => R(e),
|
|
1178
4377
|
children: [e.icon ? /* @__PURE__ */ f("span", {
|
|
1179
|
-
className:
|
|
4378
|
+
className: $.actionIcon,
|
|
1180
4379
|
"aria-hidden": "true",
|
|
1181
4380
|
children: e.icon
|
|
1182
4381
|
}) : null, e.label]
|
|
@@ -1186,7 +4385,7 @@ function Se({ user: e, apps: t = [], actions: n = [], placement: r = "header", c
|
|
|
1186
4385
|
});
|
|
1187
4386
|
return /* @__PURE__ */ p("div", {
|
|
1188
4387
|
ref: b,
|
|
1189
|
-
className: h(
|
|
4388
|
+
className: h($.root, v && $.rootSidebar, _),
|
|
1190
4389
|
children: [/* @__PURE__ */ p("button", {
|
|
1191
4390
|
ref: x,
|
|
1192
4391
|
type: "button",
|
|
@@ -1194,28 +4393,28 @@ function Se({ user: e, apps: t = [], actions: n = [], placement: r = "header", c
|
|
|
1194
4393
|
"aria-haspopup": "dialog",
|
|
1195
4394
|
"aria-expanded": C,
|
|
1196
4395
|
"aria-controls": C ? y : void 0,
|
|
1197
|
-
className: h(v ?
|
|
1198
|
-
onClick: () => C ?
|
|
1199
|
-
children: [/* @__PURE__ */ f(
|
|
4396
|
+
className: h(v ? $.triggerSidebar : $.triggerHeader, v && i && $.collapsed, C && $.triggerOpen),
|
|
4397
|
+
onClick: () => C ? N() : M(),
|
|
4398
|
+
children: [/* @__PURE__ */ f(tr, {
|
|
1200
4399
|
name: e.name,
|
|
1201
4400
|
src: e.avatarUrl,
|
|
1202
4401
|
size: "sm",
|
|
1203
4402
|
tone: "primary",
|
|
1204
4403
|
"aria-hidden": "true"
|
|
1205
4404
|
}), v && !i ? /* @__PURE__ */ p("span", {
|
|
1206
|
-
className:
|
|
4405
|
+
className: $.identityText,
|
|
1207
4406
|
children: [/* @__PURE__ */ f("span", {
|
|
1208
|
-
className:
|
|
4407
|
+
className: $.triggerName,
|
|
1209
4408
|
children: e.name
|
|
1210
4409
|
}), e.role ? /* @__PURE__ */ f("span", {
|
|
1211
|
-
className:
|
|
4410
|
+
className: $.triggerRole,
|
|
1212
4411
|
children: e.role
|
|
1213
4412
|
}) : null]
|
|
1214
4413
|
}) : null]
|
|
1215
|
-
}), C && T ? m(
|
|
4414
|
+
}), C && T ? m(z, document.body) : null]
|
|
1216
4415
|
});
|
|
1217
4416
|
}
|
|
1218
|
-
var
|
|
4417
|
+
var ur = {
|
|
1219
4418
|
root: "cui-Typography-module__root--PebSf",
|
|
1220
4419
|
h1: "cui-Typography-module__h1--pJqnF",
|
|
1221
4420
|
h2: "cui-Typography-module__h2--8YqGv",
|
|
@@ -1242,7 +4441,7 @@ var Q = {
|
|
|
1242
4441
|
"align-center": "cui-Typography-module__align-center--2Ng2u",
|
|
1243
4442
|
"align-end": "cui-Typography-module__align-end--6LwA3",
|
|
1244
4443
|
truncate: "cui-Typography-module__truncate--3B0O4"
|
|
1245
|
-
},
|
|
4444
|
+
}, dr = {
|
|
1246
4445
|
h1: "h1",
|
|
1247
4446
|
h2: "h2",
|
|
1248
4447
|
h3: "h3",
|
|
@@ -1251,93 +4450,29 @@ var Q = {
|
|
|
1251
4450
|
"body-sm": "p",
|
|
1252
4451
|
caption: "span",
|
|
1253
4452
|
label: "span"
|
|
1254
|
-
},
|
|
1255
|
-
h1:
|
|
1256
|
-
h2:
|
|
1257
|
-
h3:
|
|
1258
|
-
h4:
|
|
1259
|
-
body:
|
|
1260
|
-
"body-sm":
|
|
1261
|
-
caption:
|
|
1262
|
-
label:
|
|
4453
|
+
}, fr = {
|
|
4454
|
+
h1: ur.h1,
|
|
4455
|
+
h2: ur.h2,
|
|
4456
|
+
h3: ur.h3,
|
|
4457
|
+
h4: ur.h4,
|
|
4458
|
+
body: ur.body,
|
|
4459
|
+
"body-sm": ur.bodySm,
|
|
4460
|
+
caption: ur.caption,
|
|
4461
|
+
label: ur.label
|
|
1263
4462
|
};
|
|
1264
|
-
function
|
|
1265
|
-
return
|
|
4463
|
+
function pr({ variant: e = "body", as: n, color: r = "default", weight: i, align: a, truncate: o = !1, className: s, ...c }) {
|
|
4464
|
+
return D() ? t(n ?? dr[e], {
|
|
1266
4465
|
...c,
|
|
1267
|
-
className: h(
|
|
1268
|
-
}) : /* @__PURE__ */ f(
|
|
1269
|
-
}
|
|
1270
|
-
//#endregion
|
|
1271
|
-
//#region src/theme/themeStore.ts
|
|
1272
|
-
var Ee = "(prefers-color-scheme: dark)";
|
|
1273
|
-
function De() {
|
|
1274
|
-
return u((e) => {
|
|
1275
|
-
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
1276
|
-
let t = window.matchMedia(Ee);
|
|
1277
|
-
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
1278
|
-
}, () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(Ee).matches, () => !1);
|
|
1279
|
-
}
|
|
1280
|
-
var $ = /* @__PURE__ */ new Set();
|
|
1281
|
-
function Oe(e) {
|
|
1282
|
-
try {
|
|
1283
|
-
return window.localStorage.getItem(e);
|
|
1284
|
-
} catch {
|
|
1285
|
-
return null;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
function ke(e, t) {
|
|
1289
|
-
try {
|
|
1290
|
-
window.localStorage.setItem(e, t);
|
|
1291
|
-
} catch {}
|
|
1292
|
-
$.forEach((e) => e());
|
|
1293
|
-
}
|
|
1294
|
-
function Ae(e) {
|
|
1295
|
-
return u((e) => ($.add(e), window.addEventListener("storage", e), () => {
|
|
1296
|
-
$.delete(e), window.removeEventListener("storage", e);
|
|
1297
|
-
}), () => e ? Oe(e) : null, () => null);
|
|
1298
|
-
}
|
|
1299
|
-
var je = { root: "cui-ThemeProvider-module__root--2DEGi" }, Me = e(null);
|
|
1300
|
-
function Ne({ children: e, theme: t, defaultTheme: n = "light", onThemeChange: a, storageKey: o, licenseKey: c, className: u, ...d }) {
|
|
1301
|
-
let [p, m] = l(n), g = Ae(t === void 0 ? o : void 0), _ = De(), v = t ?? g ?? p, y = v === "system" ? _ ? "dark" : "light" : v, b = r((e) => {
|
|
1302
|
-
t === void 0 && (m(e), o && ke(o, e)), a?.(e);
|
|
1303
|
-
}, [
|
|
1304
|
-
t,
|
|
1305
|
-
a,
|
|
1306
|
-
o
|
|
1307
|
-
]), x = s(() => ({
|
|
1308
|
-
theme: v,
|
|
1309
|
-
resolvedTheme: y,
|
|
1310
|
-
setTheme: b
|
|
1311
|
-
}), [
|
|
1312
|
-
v,
|
|
1313
|
-
y,
|
|
1314
|
-
b
|
|
1315
|
-
]), C = i(S);
|
|
1316
|
-
return /* @__PURE__ */ f(Me.Provider, {
|
|
1317
|
-
value: x,
|
|
1318
|
-
children: /* @__PURE__ */ f(S.Provider, {
|
|
1319
|
-
value: c ?? C,
|
|
1320
|
-
children: /* @__PURE__ */ f("div", {
|
|
1321
|
-
...d,
|
|
1322
|
-
"data-theme": y,
|
|
1323
|
-
className: h(je.root, u),
|
|
1324
|
-
children: e
|
|
1325
|
-
})
|
|
1326
|
-
})
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
function Pe() {
|
|
1330
|
-
let e = i(Me);
|
|
1331
|
-
if (!e) throw Error("useTheme must be used within a <ThemeProvider>.");
|
|
1332
|
-
return e;
|
|
4466
|
+
className: h(ur.root, fr[e], ur[`color-${r}`], i && ur[`weight-${i}`], a && ur[`align-${a}`], o && ur.truncate, s)
|
|
4467
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
1333
4468
|
}
|
|
1334
|
-
var
|
|
4469
|
+
var mr = {
|
|
1335
4470
|
root: "cui-ThemeToggle-module__root--k2-Go",
|
|
1336
4471
|
option: "cui-ThemeToggle-module__option--CngnC",
|
|
1337
4472
|
input: "cui-ThemeToggle-module__input--0nC-Q",
|
|
1338
4473
|
face: "cui-ThemeToggle-module__face--jX0TD",
|
|
1339
4474
|
icon: "cui-ThemeToggle-module__icon--N0Uj1"
|
|
1340
|
-
},
|
|
4475
|
+
}, hr = {
|
|
1341
4476
|
light: /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("circle", {
|
|
1342
4477
|
cx: "12",
|
|
1343
4478
|
cy: "12",
|
|
@@ -1351,26 +4486,26 @@ var Fe = {
|
|
|
1351
4486
|
height: "12",
|
|
1352
4487
|
rx: "2"
|
|
1353
4488
|
}), /* @__PURE__ */ f("path", { d: "M8 20h8M12 16v4" })] })
|
|
1354
|
-
},
|
|
4489
|
+
}, gr = {
|
|
1355
4490
|
light: "Light",
|
|
1356
4491
|
dark: "Dark",
|
|
1357
4492
|
system: "System"
|
|
1358
4493
|
};
|
|
1359
|
-
function
|
|
4494
|
+
function _r({ modes: e = [
|
|
1360
4495
|
"light",
|
|
1361
4496
|
"dark",
|
|
1362
4497
|
"system"
|
|
1363
4498
|
], compact: t = !1, className: n, "aria-label": r = "Theme", ...i }) {
|
|
1364
|
-
let { theme: a, setTheme: s } =
|
|
1365
|
-
return
|
|
4499
|
+
let { theme: a, setTheme: s } = Ke(), c = o();
|
|
4500
|
+
return D() ? /* @__PURE__ */ f("div", {
|
|
1366
4501
|
...i,
|
|
1367
4502
|
role: "radiogroup",
|
|
1368
4503
|
"aria-label": r,
|
|
1369
|
-
className: h(
|
|
4504
|
+
className: h(mr.root, n),
|
|
1370
4505
|
children: e.map((e) => {
|
|
1371
|
-
let n =
|
|
4506
|
+
let n = gr[e] ?? e;
|
|
1372
4507
|
return /* @__PURE__ */ p("label", {
|
|
1373
|
-
className:
|
|
4508
|
+
className: mr.option,
|
|
1374
4509
|
title: t ? n : void 0,
|
|
1375
4510
|
children: [/* @__PURE__ */ f("input", {
|
|
1376
4511
|
type: "radio",
|
|
@@ -1378,12 +4513,12 @@ function Re({ modes: e = [
|
|
|
1378
4513
|
value: e,
|
|
1379
4514
|
checked: a === e,
|
|
1380
4515
|
onChange: () => s(e),
|
|
1381
|
-
className:
|
|
4516
|
+
className: mr.input,
|
|
1382
4517
|
"aria-label": t ? n : void 0
|
|
1383
4518
|
}), /* @__PURE__ */ p("span", {
|
|
1384
|
-
className:
|
|
1385
|
-
children: [
|
|
1386
|
-
className:
|
|
4519
|
+
className: mr.face,
|
|
4520
|
+
children: [hr[e] ? /* @__PURE__ */ f("svg", {
|
|
4521
|
+
className: mr.icon,
|
|
1387
4522
|
viewBox: "0 0 24 24",
|
|
1388
4523
|
fill: "none",
|
|
1389
4524
|
stroke: "currentColor",
|
|
@@ -1392,14 +4527,14 @@ function Re({ modes: e = [
|
|
|
1392
4527
|
strokeLinejoin: "round",
|
|
1393
4528
|
"aria-hidden": "true",
|
|
1394
4529
|
focusable: "false",
|
|
1395
|
-
children:
|
|
4530
|
+
children: hr[e]
|
|
1396
4531
|
}) : null, t ? null : n]
|
|
1397
4532
|
})]
|
|
1398
4533
|
}, e);
|
|
1399
4534
|
})
|
|
1400
|
-
}) : /* @__PURE__ */ f(
|
|
4535
|
+
}) : /* @__PURE__ */ f(k, {});
|
|
1401
4536
|
}
|
|
1402
4537
|
//#endregion
|
|
1403
|
-
export {
|
|
4538
|
+
export { lr as AccountPanel, tr as Avatar, Kn as Badge, j as Button, Mt as Checkbox, ct as ConfirmDialog, bn as DataTable, me as DatePicker, Se as DateTimePicker, ot as Drawer, Rt as DropdownMenu, zn as FileInput, F as FormField, Xn as FormSection, Me as Input, it as Modal, Ee as MonthPicker, Dt as PageHeader, _t as Pagination, Pe as PasswordInput, Ie as SearchInput, mt as Select, Vt as SelectionBar, Bt as Skeleton, At as StatusPill, Wn as Switch, vt as Table, bt as TableBody, Tt as TableCaption, wt as TableCell, xt as TableFoot, yt as TableHead, Ct as TableHeaderCell, St as TableRow, Jn as Tabs, Hn as Textarea, Ge as ThemeProvider, _r as ThemeToggle, pr as Typography, h as cn, xn as formatFileSize, $n as getInitials, ht as getPageItems, C as setLicenseKey, N as useFormFieldControl, Ke as useTheme };
|
|
1404
4539
|
|
|
1405
4540
|
//# sourceMappingURL=index.js.map
|