kosmio 0.1.0 → 0.1.2
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/dist/formRegistry-C5VIE7xu.js +3469 -0
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/ui.js +1 -1
- package/package.json +1 -1
- package/dist/formRegistry-Lvs6aL14.js +0 -3468
|
@@ -0,0 +1,3469 @@
|
|
|
1
|
+
import { jsx as l, jsxs as V, Fragment as Tt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as te, useContext as Re, createContext as Ve, Children as at, isValidElement as Be, useState as U, useId as _e, useRef as ee, useEffect as Q, cloneElement as lt, useMemo as J, useCallback as W, Fragment as Et } from "react";
|
|
3
|
+
import { c as q } from "./classNames-CcykAxZN.js";
|
|
4
|
+
import { useTranslation as oe } from "react-i18next";
|
|
5
|
+
import { b as qe, u as it, e as ct, d as wt, c as Xe } from "./ViewportContext-z-ZwlTIZ.js";
|
|
6
|
+
import { createPortal as ut } from "react-dom";
|
|
7
|
+
import { r as At, d as Lt, s as It } from "./shortcuts-n31uRPcv.js";
|
|
8
|
+
import { b as Oe } from "./offlineWriteQueue-C31IjyB_.js";
|
|
9
|
+
const Ne = {
|
|
10
|
+
start: "kosmio-text-align-start",
|
|
11
|
+
center: "kosmio-text-align-center",
|
|
12
|
+
end: "kosmio-text-align-end",
|
|
13
|
+
left: "kosmio-text-align-left",
|
|
14
|
+
right: "kosmio-text-align-right",
|
|
15
|
+
justify: "kosmio-text-align-justify"
|
|
16
|
+
}, Ot = {
|
|
17
|
+
1: "t-color-1",
|
|
18
|
+
2: "t-color-2",
|
|
19
|
+
3: "t-color-3"
|
|
20
|
+
}, Dt = {
|
|
21
|
+
1: "t-color-d1",
|
|
22
|
+
2: "t-color-d2",
|
|
23
|
+
3: "t-color-d3"
|
|
24
|
+
}, zt = {
|
|
25
|
+
xxxl: "text-xxxl",
|
|
26
|
+
xxl: "text-xxl",
|
|
27
|
+
xl: "text-xl",
|
|
28
|
+
lg: "text-lg",
|
|
29
|
+
md: "text-md",
|
|
30
|
+
sm: "text-sm",
|
|
31
|
+
xs: "text-xs",
|
|
32
|
+
xxs: "text-xxs"
|
|
33
|
+
}, $t = {
|
|
34
|
+
default: "text-font-default",
|
|
35
|
+
main: "text-font-main",
|
|
36
|
+
mono: "text-font-mono"
|
|
37
|
+
}, Ft = {
|
|
38
|
+
regular: "text-weight-regular",
|
|
39
|
+
medium: "text-weight-medium",
|
|
40
|
+
semibold: "text-weight-semibold",
|
|
41
|
+
bold: "text-weight-bold"
|
|
42
|
+
}, Pt = {
|
|
43
|
+
none: "text-leading-none",
|
|
44
|
+
tight: "text-leading-tight",
|
|
45
|
+
normal: "text-leading-normal",
|
|
46
|
+
relaxed: "text-leading-relaxed"
|
|
47
|
+
};
|
|
48
|
+
function Mt(e, t) {
|
|
49
|
+
if (t == null || t === "") return;
|
|
50
|
+
const n = String(t);
|
|
51
|
+
return n.startsWith("var(") ? n : n.startsWith("--") ? `var(${n})` : `var(--kosmio-${e}-${n})`;
|
|
52
|
+
}
|
|
53
|
+
function Rt(e) {
|
|
54
|
+
return typeof e == "string" && (e.startsWith("var(") || e.startsWith("--"));
|
|
55
|
+
}
|
|
56
|
+
function pe(e, t, n = "") {
|
|
57
|
+
if (e == null || e === "") return "";
|
|
58
|
+
const r = t[e];
|
|
59
|
+
return r || (typeof e == "string" && n && e.startsWith(n) ? e : "");
|
|
60
|
+
}
|
|
61
|
+
function Vt(e) {
|
|
62
|
+
return e ? pe(e, Ne, "kosmio-text-align-") : "";
|
|
63
|
+
}
|
|
64
|
+
function Bt({ left: e, center: t, right: n }) {
|
|
65
|
+
return t ? Ne.center : n ? Ne.right : e ? Ne.left : "";
|
|
66
|
+
}
|
|
67
|
+
function dt(e, t, n, r) {
|
|
68
|
+
return q(
|
|
69
|
+
pe(e, $t, "text-font-"),
|
|
70
|
+
pe(t, Ft, "text-weight-"),
|
|
71
|
+
pe(n, zt, "text-"),
|
|
72
|
+
pe(r, Pt, "text-leading-")
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function je(e, t, n, r) {
|
|
76
|
+
const {
|
|
77
|
+
font: s = "default",
|
|
78
|
+
fontSize: o,
|
|
79
|
+
fontColor: a,
|
|
80
|
+
weight: i,
|
|
81
|
+
lineHeight: u,
|
|
82
|
+
as: d
|
|
83
|
+
} = e ?? {}, m = t ?? d, h = n ?? a, c = dt(s, i, o, u), b = te(function({
|
|
84
|
+
className: v,
|
|
85
|
+
...x
|
|
86
|
+
}, S) {
|
|
87
|
+
return /* @__PURE__ */ l(
|
|
88
|
+
_,
|
|
89
|
+
{
|
|
90
|
+
ref: S,
|
|
91
|
+
as: m,
|
|
92
|
+
color: h,
|
|
93
|
+
...x,
|
|
94
|
+
className: q(c, r, v)
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
return b.defaultPropsConfig = {
|
|
99
|
+
typoStyle: e,
|
|
100
|
+
as: m,
|
|
101
|
+
color: h,
|
|
102
|
+
className: r
|
|
103
|
+
}, b;
|
|
104
|
+
}
|
|
105
|
+
function Cr(e = []) {
|
|
106
|
+
return e.map((t) => {
|
|
107
|
+
if (Array.isArray(t)) {
|
|
108
|
+
const [n, r, s] = t;
|
|
109
|
+
return je(n, void 0, r, s);
|
|
110
|
+
}
|
|
111
|
+
return je(t);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function _t(e, t) {
|
|
115
|
+
if (e == null || Rt(e)) return "";
|
|
116
|
+
const r = (t ? Dt : Ot)[e];
|
|
117
|
+
return r || (t && typeof e == "string" && e.startsWith("t-color-") && !e.startsWith("t-color-d") ? e.replace("t-color-", "t-color-d") : typeof e == "string" && e.startsWith("t-color-") ? e : "");
|
|
118
|
+
}
|
|
119
|
+
const _ = te(function({
|
|
120
|
+
as: t = "p",
|
|
121
|
+
color: n,
|
|
122
|
+
dynamic: r = !1,
|
|
123
|
+
size: s = "",
|
|
124
|
+
font: o = "",
|
|
125
|
+
weight: a,
|
|
126
|
+
lineHeight: i = "",
|
|
127
|
+
align: u,
|
|
128
|
+
left: d = !1,
|
|
129
|
+
center: m = !1,
|
|
130
|
+
right: h = !1,
|
|
131
|
+
inline: c = !1,
|
|
132
|
+
ellipsis: b = !1,
|
|
133
|
+
elipsis: y = !1,
|
|
134
|
+
className: v = "",
|
|
135
|
+
style: x,
|
|
136
|
+
children: S,
|
|
137
|
+
...g
|
|
138
|
+
}, T) {
|
|
139
|
+
const N = t, k = dt(o, a, s, i), f = Vt(u), p = _t(n, r), E = p ? void 0 : Mt("color", n), w = b || y, C = u ? "" : Bt({ left: d, center: m, right: h }), G = {
|
|
140
|
+
...E ? { "--kosmio-text-color": E } : {}
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ l(
|
|
143
|
+
N,
|
|
144
|
+
{
|
|
145
|
+
ref: T,
|
|
146
|
+
className: q(
|
|
147
|
+
"kosmio-text text",
|
|
148
|
+
k,
|
|
149
|
+
f,
|
|
150
|
+
p,
|
|
151
|
+
E && "kosmio-text-colored",
|
|
152
|
+
C,
|
|
153
|
+
c && "kosmio-text-inline text-inline",
|
|
154
|
+
w && "kosmio-text-ellipsis text-elipsis",
|
|
155
|
+
v
|
|
156
|
+
),
|
|
157
|
+
style: {
|
|
158
|
+
...G,
|
|
159
|
+
...x
|
|
160
|
+
},
|
|
161
|
+
...g,
|
|
162
|
+
children: S
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}), qt = {
|
|
166
|
+
plain: "",
|
|
167
|
+
primary: "kosmio-button-primary primary",
|
|
168
|
+
searchFilter: "searchbar-filter",
|
|
169
|
+
searchAdd: "kosmio-button-primary primary searchbar-add"
|
|
170
|
+
}, We = (e) => e === "a", Yt = te(function({
|
|
171
|
+
as: t = "button",
|
|
172
|
+
variant: n = "plain",
|
|
173
|
+
danger: r = !1,
|
|
174
|
+
active: s = !0,
|
|
175
|
+
showTooltip: o = !1,
|
|
176
|
+
tooltipText: a = "",
|
|
177
|
+
tooltipDirection: i = "right",
|
|
178
|
+
className: u = "",
|
|
179
|
+
type: d,
|
|
180
|
+
disabled: m = !1,
|
|
181
|
+
onClick: h,
|
|
182
|
+
...c
|
|
183
|
+
}, b) {
|
|
184
|
+
const y = t, v = qt[n] ?? n, x = i === "left" ? "left" : "right", S = a || (typeof c["aria-label"] == "string" ? c["aria-label"] : ""), g = q(
|
|
185
|
+
"kosmio-button custom-button",
|
|
186
|
+
v,
|
|
187
|
+
r && "kosmio-button-danger danger",
|
|
188
|
+
s && "kosmio-button-active active",
|
|
189
|
+
o && `kosmio-button-tooltip tooltip tooltip-${x}`,
|
|
190
|
+
u
|
|
191
|
+
);
|
|
192
|
+
return /* @__PURE__ */ l(
|
|
193
|
+
y,
|
|
194
|
+
{
|
|
195
|
+
ref: b,
|
|
196
|
+
className: g,
|
|
197
|
+
onClick: (N) => {
|
|
198
|
+
if (m && We(t)) {
|
|
199
|
+
N.preventDefault();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
h?.(N);
|
|
203
|
+
},
|
|
204
|
+
...o ? { "data-tooltip": S } : {},
|
|
205
|
+
...We(t) ? {
|
|
206
|
+
"aria-disabled": m || void 0,
|
|
207
|
+
tabIndex: m ? -1 : c.tabIndex
|
|
208
|
+
} : {
|
|
209
|
+
type: d ?? "button",
|
|
210
|
+
disabled: m
|
|
211
|
+
},
|
|
212
|
+
...c
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
function Tr({
|
|
217
|
+
variant: e = "plain",
|
|
218
|
+
text: t,
|
|
219
|
+
icon: n,
|
|
220
|
+
iconPosition: r = "start",
|
|
221
|
+
onClick: s,
|
|
222
|
+
tooltipText: o,
|
|
223
|
+
className: a = "",
|
|
224
|
+
danger: i = !1,
|
|
225
|
+
...u
|
|
226
|
+
}) {
|
|
227
|
+
const d = u["aria-label"] ?? (typeof t == "string" ? t : void 0), m = n ? /* @__PURE__ */ l("span", { className: "kosmio-action-button-icon", children: n }) : null;
|
|
228
|
+
return /* @__PURE__ */ V(
|
|
229
|
+
Yt,
|
|
230
|
+
{
|
|
231
|
+
variant: e,
|
|
232
|
+
onClick: s,
|
|
233
|
+
"aria-label": d,
|
|
234
|
+
showTooltip: !!o,
|
|
235
|
+
tooltipText: o,
|
|
236
|
+
className: `kosmio-action-button ${a}`.trim(),
|
|
237
|
+
danger: i,
|
|
238
|
+
...u,
|
|
239
|
+
children: [
|
|
240
|
+
r === "start" ? m : null,
|
|
241
|
+
t ? /* @__PURE__ */ l(_, { as: "span", size: "sm", children: t }) : null,
|
|
242
|
+
r === "end" ? m : null
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
const Ht = {
|
|
248
|
+
default: "kosmio-icon icon dynamic-theme",
|
|
249
|
+
static: "kosmio-icon icon static-theme",
|
|
250
|
+
reversed: "kosmio-icon icon reversed-theme",
|
|
251
|
+
reversedDynamic: "kosmio-icon icon reversed-dynamic-theme",
|
|
252
|
+
accent: "kosmio-icon icon accent-theme",
|
|
253
|
+
invalid: "kosmio-icon icon invalid"
|
|
254
|
+
}, Gt = {
|
|
255
|
+
xs: "kosmio-icon-size-xs icon-size-xs",
|
|
256
|
+
sm: "kosmio-icon-size-sm icon-size-sm",
|
|
257
|
+
md: "kosmio-icon-size-md icon-size-md",
|
|
258
|
+
xmd: "kosmio-icon-size-xmd icon-size-xmd",
|
|
259
|
+
lg: "kosmio-icon-size-lg icon-size-lg",
|
|
260
|
+
xl: "kosmio-icon-size-xl icon-size-xl",
|
|
261
|
+
xxl: "kosmio-icon-size-xxl icon-size-xxl",
|
|
262
|
+
xxxl: "kosmio-icon-size-xxxl icon-size-xxxl"
|
|
263
|
+
}, ue = te(function({
|
|
264
|
+
src: t,
|
|
265
|
+
variant: n = "default",
|
|
266
|
+
size: r,
|
|
267
|
+
className: s = "",
|
|
268
|
+
alt: o = "",
|
|
269
|
+
decorative: a = !1,
|
|
270
|
+
style: i,
|
|
271
|
+
...u
|
|
272
|
+
}, d) {
|
|
273
|
+
const m = Ht[n] ?? n, h = Gt[r];
|
|
274
|
+
return typeof t == "string" && t.endsWith(".svg") && n !== "static" ? /* @__PURE__ */ l(
|
|
275
|
+
"span",
|
|
276
|
+
{
|
|
277
|
+
ref: d,
|
|
278
|
+
className: q(m, h, "kosmio-icon-mask icon-mask", s),
|
|
279
|
+
role: a ? void 0 : "img",
|
|
280
|
+
"aria-label": a ? void 0 : o,
|
|
281
|
+
"aria-hidden": a || void 0,
|
|
282
|
+
style: {
|
|
283
|
+
"--kosmio-icon-url": `url("${t}")`,
|
|
284
|
+
"--icon-url": `url("${t}")`,
|
|
285
|
+
...i
|
|
286
|
+
},
|
|
287
|
+
...u
|
|
288
|
+
}
|
|
289
|
+
) : /* @__PURE__ */ l(
|
|
290
|
+
"img",
|
|
291
|
+
{
|
|
292
|
+
ref: d,
|
|
293
|
+
className: q(m, h, s),
|
|
294
|
+
src: t,
|
|
295
|
+
alt: a ? "" : o,
|
|
296
|
+
"aria-hidden": a || void 0,
|
|
297
|
+
style: i,
|
|
298
|
+
...u
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}), ft = Ve({
|
|
302
|
+
icons: {},
|
|
303
|
+
defaultVariant: "default"
|
|
304
|
+
});
|
|
305
|
+
function Xt(e, t, n) {
|
|
306
|
+
return t ?? (e.alt != null ? e.alt : e.altKey ? n(e.altKey) : "");
|
|
307
|
+
}
|
|
308
|
+
function Er({ icons: e = {}, defaultVariant: t = "default", children: n }) {
|
|
309
|
+
return /* @__PURE__ */ l(ft.Provider, { value: { icons: e, defaultVariant: t }, children: n });
|
|
310
|
+
}
|
|
311
|
+
function jt() {
|
|
312
|
+
return Re(ft);
|
|
313
|
+
}
|
|
314
|
+
function mt({
|
|
315
|
+
name: e,
|
|
316
|
+
size: t,
|
|
317
|
+
variant: n,
|
|
318
|
+
alt: r,
|
|
319
|
+
decorative: s = !1,
|
|
320
|
+
...o
|
|
321
|
+
}) {
|
|
322
|
+
const { t: a } = oe(), { icons: i, defaultVariant: u } = jt(), d = i?.[e];
|
|
323
|
+
return d ? /* @__PURE__ */ l(
|
|
324
|
+
ue,
|
|
325
|
+
{
|
|
326
|
+
src: d.src,
|
|
327
|
+
size: t ?? d.size,
|
|
328
|
+
variant: n ?? d.variant ?? u,
|
|
329
|
+
alt: s ? "" : Xt(d, r, a),
|
|
330
|
+
decorative: s,
|
|
331
|
+
...o
|
|
332
|
+
}
|
|
333
|
+
) : null;
|
|
334
|
+
}
|
|
335
|
+
function wr({
|
|
336
|
+
id: e,
|
|
337
|
+
title: t = "forms.shared.actionFormTitle",
|
|
338
|
+
picture: n = null,
|
|
339
|
+
type: r = "short-form",
|
|
340
|
+
buildActions: s = null,
|
|
341
|
+
actions: o = []
|
|
342
|
+
}) {
|
|
343
|
+
return {
|
|
344
|
+
id: e,
|
|
345
|
+
title: t,
|
|
346
|
+
picture: n,
|
|
347
|
+
type: r,
|
|
348
|
+
buildActions: s,
|
|
349
|
+
actions: o
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function Wt(e, t, n) {
|
|
353
|
+
return e ? typeof e.buildActions == "function" ? e.buildActions(t, n) ?? [] : Array.isArray(e.actions) && e.actions.length > 0 ? e.actions : Array.isArray(t?.actions) ? t.actions : [] : [];
|
|
354
|
+
}
|
|
355
|
+
function Ar(e = null, t = []) {
|
|
356
|
+
return {
|
|
357
|
+
context: e,
|
|
358
|
+
actions: t
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function Lr({
|
|
362
|
+
actions: e,
|
|
363
|
+
context: t,
|
|
364
|
+
formName: n,
|
|
365
|
+
getForm: r,
|
|
366
|
+
resolveActions: s = Wt
|
|
367
|
+
}) {
|
|
368
|
+
const { t: o } = oe(), { form: a, formAction: i, formObject: u, openForm: d, setAdvancedForm: m, closeForm: h } = qe(), b = typeof r == "function" ? r(n ?? a, i) : null, y = u ?? null, v = t ?? y?.context ?? y ?? null, x = Array.isArray(e) ? e : s(b, y, {
|
|
369
|
+
openForm: d,
|
|
370
|
+
setAdvancedForm: m,
|
|
371
|
+
closeForm: h,
|
|
372
|
+
context: v,
|
|
373
|
+
t: o
|
|
374
|
+
});
|
|
375
|
+
return /* @__PURE__ */ l("form", { className: "full-view column-left actions-form", children: /* @__PURE__ */ l("div", { className: "full-view column-left", children: x.map((S, g) => {
|
|
376
|
+
const {
|
|
377
|
+
label: T,
|
|
378
|
+
icon: N,
|
|
379
|
+
iconName: k,
|
|
380
|
+
iconVariant: f,
|
|
381
|
+
onClick: p,
|
|
382
|
+
color: E,
|
|
383
|
+
disabled: w
|
|
384
|
+
} = S ?? {}, C = typeof T == "function" ? T(v) : T, G = typeof w == "function" ? w(v) : !!w, F = o(C);
|
|
385
|
+
return F ? /* @__PURE__ */ V(
|
|
386
|
+
"button",
|
|
387
|
+
{
|
|
388
|
+
className: `actions-form-option ${E || ""}`.trim(),
|
|
389
|
+
disabled: G,
|
|
390
|
+
onClick: (P) => {
|
|
391
|
+
P.preventDefault(), !G && p?.(v);
|
|
392
|
+
},
|
|
393
|
+
children: [
|
|
394
|
+
k ? /* @__PURE__ */ l(mt, { name: k, alt: F }) : null,
|
|
395
|
+
!k && N ? /* @__PURE__ */ l(ue, { src: N, alt: F, variant: f ?? "reversedDynamic" }) : null,
|
|
396
|
+
/* @__PURE__ */ l(_, { as: "p", size: "xs", dynamic: !0, color: 2, className: "select-sheet-label", children: F })
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
`${C}-${g}`
|
|
400
|
+
) : null;
|
|
401
|
+
}) }) });
|
|
402
|
+
}
|
|
403
|
+
function Qt({ className: e = "", label: t = "", onClick: n, style: r, ...s }) {
|
|
404
|
+
return /* @__PURE__ */ l(
|
|
405
|
+
"button",
|
|
406
|
+
{
|
|
407
|
+
type: "button",
|
|
408
|
+
className: q("kosmio-backdrop", e),
|
|
409
|
+
"aria-hidden": t ? void 0 : "true",
|
|
410
|
+
"aria-label": t || void 0,
|
|
411
|
+
onClick: n,
|
|
412
|
+
style: r,
|
|
413
|
+
tabIndex: t ? void 0 : -1,
|
|
414
|
+
...s
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function Ir({ children: e, className: t = "", ...n }) {
|
|
419
|
+
return /* @__PURE__ */ l("div", { className: q("kosmio-card card", t), ...n, children: e });
|
|
420
|
+
}
|
|
421
|
+
function Kt(e = 0) {
|
|
422
|
+
const t = e * 45;
|
|
423
|
+
return {
|
|
424
|
+
"--motion-row-delay": `${t}ms`,
|
|
425
|
+
opacity: 0,
|
|
426
|
+
animationName: "motion-row-appear",
|
|
427
|
+
animationDuration: "360ms",
|
|
428
|
+
animationDelay: `${t}ms`,
|
|
429
|
+
animationTimingFunction: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
430
|
+
animationFillMode: "forwards",
|
|
431
|
+
willChange: "transform, opacity"
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function Or({ children: e }) {
|
|
435
|
+
return at.map(e, (t, n) => Be(t) ? /* @__PURE__ */ l("div", { className: "full-w", style: Kt(n), children: t }, t.key ?? n) : t);
|
|
436
|
+
}
|
|
437
|
+
const Ut = {
|
|
438
|
+
plain: "",
|
|
439
|
+
custom: "customCheckbox-input"
|
|
440
|
+
}, Jt = te(function({
|
|
441
|
+
variant: t = "plain",
|
|
442
|
+
className: n = "",
|
|
443
|
+
containerClassName: r = "",
|
|
444
|
+
labelClassName: s = "",
|
|
445
|
+
markClassName: o = "",
|
|
446
|
+
textClassName: a = "",
|
|
447
|
+
label: i,
|
|
448
|
+
checked: u,
|
|
449
|
+
onChange: d,
|
|
450
|
+
onCheckedChange: m,
|
|
451
|
+
...h
|
|
452
|
+
}, c) {
|
|
453
|
+
const b = Ut[t] ?? t, y = (v) => {
|
|
454
|
+
d?.(v), m?.(v.target.checked, v);
|
|
455
|
+
};
|
|
456
|
+
return /* @__PURE__ */ V(_, { className: q(r, s), as: "label", children: [
|
|
457
|
+
/* @__PURE__ */ l("input", { ref: c, type: "checkbox", className: q(b, n), checked: u, onChange: y, ...h }),
|
|
458
|
+
o ? /* @__PURE__ */ l("span", { className: o }) : null,
|
|
459
|
+
i ? /* @__PURE__ */ l(_, { className: a, as: "span", children: i }) : null
|
|
460
|
+
] });
|
|
461
|
+
}), Zt = te(function({ className: t = "", type: n = "button", disabled: r = !1, children: s, ...o }, a) {
|
|
462
|
+
return /* @__PURE__ */ l(
|
|
463
|
+
"button",
|
|
464
|
+
{
|
|
465
|
+
ref: a,
|
|
466
|
+
type: n,
|
|
467
|
+
className: q("kosmio-clickable", t),
|
|
468
|
+
disabled: r,
|
|
469
|
+
...o,
|
|
470
|
+
children: s
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
});
|
|
474
|
+
function Dr({ titleBox: e, children: t, className: n = "", defaultExpanded: r = !0 }) {
|
|
475
|
+
const [s, o] = U(r), a = _e(), i = typeof e == "function" ? e(s) : e;
|
|
476
|
+
return /* @__PURE__ */ V("div", { className: `collapsible-box full-w ${s ? "is-expanded" : "is-collapsed"} ${n}`.trim(), children: [
|
|
477
|
+
/* @__PURE__ */ l(
|
|
478
|
+
Zt,
|
|
479
|
+
{
|
|
480
|
+
type: "button",
|
|
481
|
+
className: "flex full-w row-left collapsible-box-trigger",
|
|
482
|
+
onClick: () => o((u) => !u),
|
|
483
|
+
"aria-expanded": s,
|
|
484
|
+
"aria-controls": a,
|
|
485
|
+
children: i
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
/* @__PURE__ */ l("div", { id: a, className: "collapsible-box-content flex full-w column-left", children: t })
|
|
489
|
+
] });
|
|
490
|
+
}
|
|
491
|
+
function zr({ title: e, children: t, className: n = "", defaultExpanded: r = !0 }) {
|
|
492
|
+
const [s, o] = U(r), a = _e();
|
|
493
|
+
return /* @__PURE__ */ V("div", { className: `collapsible-card ${s ? "is-expanded" : "is-collapsed"} ${n}`.trim(), children: [
|
|
494
|
+
/* @__PURE__ */ V(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
type: "button",
|
|
498
|
+
className: "card-title spaced collapsible-card-trigger",
|
|
499
|
+
onClick: () => o((i) => !i),
|
|
500
|
+
"aria-expanded": s,
|
|
501
|
+
"aria-controls": a,
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ l(_, { as: "span", size: "xs", color: 3, children: e }),
|
|
504
|
+
/* @__PURE__ */ l("span", { className: "collapsible-card-chevron", "aria-hidden": "true" })
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
/* @__PURE__ */ V("div", { id: a, className: "collapsible-card-content flex full-w column-left", children: [
|
|
509
|
+
/* @__PURE__ */ l("span", { className: "card-divider full-w divider" }),
|
|
510
|
+
/* @__PURE__ */ l("div", { className: "card-content full-w", children: t })
|
|
511
|
+
] })
|
|
512
|
+
] });
|
|
513
|
+
}
|
|
514
|
+
function en(e) {
|
|
515
|
+
if (e)
|
|
516
|
+
return e.size === "0px" ? "none" : `${e.size} solid ${e.color}`;
|
|
517
|
+
}
|
|
518
|
+
function tn(e, t) {
|
|
519
|
+
if (t == null || t === "") return;
|
|
520
|
+
const n = String(t);
|
|
521
|
+
return n.startsWith("var(") ? n : n.startsWith("--") ? `var(${n})` : `var(--kosmio-${e}-${n})`;
|
|
522
|
+
}
|
|
523
|
+
function nn(e, t) {
|
|
524
|
+
if (!e) return t;
|
|
525
|
+
const n = {
|
|
526
|
+
"--kosmio-container-background": e.backgroundColor,
|
|
527
|
+
"--kosmio-container-border": en(e.borderStyle),
|
|
528
|
+
"--kosmio-container-padding": e.padding,
|
|
529
|
+
"--kosmio-container-radius": e.radii,
|
|
530
|
+
"--kosmio-container-color": tn("color", e.typoStyle?.fontColor),
|
|
531
|
+
...t
|
|
532
|
+
};
|
|
533
|
+
return Object.keys(n).forEach((r) => {
|
|
534
|
+
(n[r] == null || n[r] === "") && delete n[r];
|
|
535
|
+
}), n;
|
|
536
|
+
}
|
|
537
|
+
const rn = te(function({
|
|
538
|
+
as: t,
|
|
539
|
+
containerStyle: n,
|
|
540
|
+
children: r,
|
|
541
|
+
className: s = "",
|
|
542
|
+
style: o,
|
|
543
|
+
...a
|
|
544
|
+
}, i) {
|
|
545
|
+
const u = t ?? n?.typoStyle?.as ?? "div";
|
|
546
|
+
return /* @__PURE__ */ l(
|
|
547
|
+
u,
|
|
548
|
+
{
|
|
549
|
+
ref: i,
|
|
550
|
+
className: q("kosmio-container kosmio-card card", s),
|
|
551
|
+
style: nn(n, o),
|
|
552
|
+
...a,
|
|
553
|
+
children: r
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
});
|
|
557
|
+
function Qe(e, t, n) {
|
|
558
|
+
const r = t ?? e?.typoStyle?.as ?? "div", s = te(function({
|
|
559
|
+
className: a,
|
|
560
|
+
...i
|
|
561
|
+
}, u) {
|
|
562
|
+
return /* @__PURE__ */ l(
|
|
563
|
+
rn,
|
|
564
|
+
{
|
|
565
|
+
ref: u,
|
|
566
|
+
as: r,
|
|
567
|
+
containerStyle: e,
|
|
568
|
+
className: q(n, a),
|
|
569
|
+
...i
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
});
|
|
573
|
+
return s.defaultPropsConfig = { containerStyle: e, as: r, className: n }, s;
|
|
574
|
+
}
|
|
575
|
+
function $r(e = []) {
|
|
576
|
+
return e.map((t) => {
|
|
577
|
+
if (Array.isArray(t)) {
|
|
578
|
+
const [n, r, s] = t;
|
|
579
|
+
return Qe(n, r, s);
|
|
580
|
+
}
|
|
581
|
+
return Qe(t);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
const Fr = te(function({
|
|
585
|
+
icon: t,
|
|
586
|
+
label: n,
|
|
587
|
+
compact: r = !1,
|
|
588
|
+
className: s = "",
|
|
589
|
+
type: o = "button",
|
|
590
|
+
children: a,
|
|
591
|
+
...i
|
|
592
|
+
}, u) {
|
|
593
|
+
return /* @__PURE__ */ l(
|
|
594
|
+
"button",
|
|
595
|
+
{
|
|
596
|
+
ref: u,
|
|
597
|
+
type: o,
|
|
598
|
+
className: q("kosmio-floating-action-button", r && "is-compact", s),
|
|
599
|
+
"aria-label": n,
|
|
600
|
+
title: n,
|
|
601
|
+
...i,
|
|
602
|
+
children: t ? /* @__PURE__ */ l("span", { className: "kosmio-floating-action-button-icon", children: t }) : a
|
|
603
|
+
}
|
|
604
|
+
);
|
|
605
|
+
}), Pr = te(function({
|
|
606
|
+
icon: t,
|
|
607
|
+
title: n,
|
|
608
|
+
subtitle: r,
|
|
609
|
+
selectedLabel: s,
|
|
610
|
+
isSelectable: o = !0,
|
|
611
|
+
isSelected: a = !1,
|
|
612
|
+
className: i = "",
|
|
613
|
+
disabled: u = !1,
|
|
614
|
+
onClick: d,
|
|
615
|
+
...m
|
|
616
|
+
}, h) {
|
|
617
|
+
const c = u || !o || !d;
|
|
618
|
+
return /* @__PURE__ */ V(
|
|
619
|
+
"button",
|
|
620
|
+
{
|
|
621
|
+
ref: h,
|
|
622
|
+
type: "button",
|
|
623
|
+
className: q(
|
|
624
|
+
"kosmio-selection-button selection-button",
|
|
625
|
+
a && "is-selected",
|
|
626
|
+
!o && "is-not-selectable",
|
|
627
|
+
i
|
|
628
|
+
),
|
|
629
|
+
"aria-current": a ? "true" : void 0,
|
|
630
|
+
disabled: c,
|
|
631
|
+
onClick: c ? void 0 : d,
|
|
632
|
+
...m,
|
|
633
|
+
children: [
|
|
634
|
+
t ? /* @__PURE__ */ l("span", { className: "flex-center", children: t }) : null,
|
|
635
|
+
/* @__PURE__ */ V("span", { className: "column-left", children: [
|
|
636
|
+
/* @__PURE__ */ l(_, { as: "span", size: "xs", elipsis: !0, left: !0, children: n }),
|
|
637
|
+
r ? /* @__PURE__ */ l(_, { as: "span", size: "xxs", color: 3, left: !0, dynamic: !0, elipsis: !0, children: r }) : null
|
|
638
|
+
] }),
|
|
639
|
+
a && s ? /* @__PURE__ */ l(_, { as: "span", size: "xxs", color: 3, left: !0, dynamic: !0, children: s }) : null
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
);
|
|
643
|
+
});
|
|
644
|
+
function Mr({
|
|
645
|
+
children: e,
|
|
646
|
+
minColumnWidth: t = 150,
|
|
647
|
+
maxColumns: n,
|
|
648
|
+
gap: r = 10,
|
|
649
|
+
padding: s = 10,
|
|
650
|
+
className: o = "",
|
|
651
|
+
staggerMs: a = 50,
|
|
652
|
+
maxStaggerMs: i = 1e3,
|
|
653
|
+
...u
|
|
654
|
+
}) {
|
|
655
|
+
const d = ee(null), [m, h] = U(null);
|
|
656
|
+
Q(() => {
|
|
657
|
+
const b = () => {
|
|
658
|
+
if (!d.current) return;
|
|
659
|
+
const y = d.current.offsetWidth;
|
|
660
|
+
let v = Math.floor((y + r) / (t + r));
|
|
661
|
+
n && (v = Math.min(v, n)), h(Math.max(v, 1));
|
|
662
|
+
};
|
|
663
|
+
return b(), window.addEventListener("resize", b), () => window.removeEventListener("resize", b);
|
|
664
|
+
}, [t, n, r]);
|
|
665
|
+
const c = {
|
|
666
|
+
gridTemplateColumns: `repeat(${m ?? 1}, 1fr)`,
|
|
667
|
+
gap: `${r}px`,
|
|
668
|
+
padding: `${s}px`
|
|
669
|
+
};
|
|
670
|
+
return /* @__PURE__ */ l("div", { ref: d, className: `kosmio-grid ${o}`.trim(), style: c, ...u, children: m == null ? null : at.map(e, (b, y) => {
|
|
671
|
+
if (!Be(b)) return b;
|
|
672
|
+
const v = y % m, x = Math.floor(y / m), S = Math.min((x + v) * a, i), g = b.props?.style || {};
|
|
673
|
+
return lt(b, {
|
|
674
|
+
"data-grid-index": y,
|
|
675
|
+
"data-grid-columns": m,
|
|
676
|
+
style: {
|
|
677
|
+
...g,
|
|
678
|
+
"--kosmio-motion-delay": `${S}ms`
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
}) });
|
|
682
|
+
}
|
|
683
|
+
const Ke = {
|
|
684
|
+
xxs: { closed: "-2px", open: "-1px", size: "xs" },
|
|
685
|
+
xs: { closed: "-2px", open: "-1px" },
|
|
686
|
+
sm: { closed: "-2px", open: "-1px" },
|
|
687
|
+
md: { closed: "-2px", open: "-1px" },
|
|
688
|
+
xmd: { closed: "-3px", open: "-1px" },
|
|
689
|
+
lg: { closed: "-3px", open: "-1px" },
|
|
690
|
+
xl: { closed: "-4px", open: "-2px" },
|
|
691
|
+
xxl: { closed: "-5px", open: "-2px" },
|
|
692
|
+
xxxl: { closed: "-8px", open: "-4px" }
|
|
693
|
+
};
|
|
694
|
+
function on({ colored: e = !1, size: t = "xs", isOpen: n = !1, className: r = "", style: s = {}, ...o }) {
|
|
695
|
+
const a = Ke[t] ?? Ke.xs, i = a.size ?? t;
|
|
696
|
+
return /* @__PURE__ */ l(
|
|
697
|
+
"span",
|
|
698
|
+
{
|
|
699
|
+
className: q(
|
|
700
|
+
"kosmio-icon-chevron icon-chevron",
|
|
701
|
+
`kosmio-icon-size-${i}`,
|
|
702
|
+
`icon-size-${i}`,
|
|
703
|
+
n && "is-open",
|
|
704
|
+
e && "colored",
|
|
705
|
+
r
|
|
706
|
+
),
|
|
707
|
+
style: {
|
|
708
|
+
"--kosmio-icon-chevron-closed-shift": a.closed,
|
|
709
|
+
"--kosmio-icon-chevron-open-shift": a.open,
|
|
710
|
+
"--icon-chevron-closed-shift": a.closed,
|
|
711
|
+
"--icon-chevron-open-shift": a.open,
|
|
712
|
+
...s
|
|
713
|
+
},
|
|
714
|
+
"aria-hidden": "true",
|
|
715
|
+
...o
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
const sn = {
|
|
720
|
+
plain: "",
|
|
721
|
+
custom: "customInput",
|
|
722
|
+
search: "searchbar-input"
|
|
723
|
+
}, an = te(function({
|
|
724
|
+
variant: t = "plain",
|
|
725
|
+
className: n = "",
|
|
726
|
+
format: r,
|
|
727
|
+
isValid: s,
|
|
728
|
+
onChange: o,
|
|
729
|
+
onValueChange: a,
|
|
730
|
+
...i
|
|
731
|
+
}, u) {
|
|
732
|
+
const d = sn[t] ?? t, m = (c) => {
|
|
733
|
+
if (!r || c === "")
|
|
734
|
+
return !0;
|
|
735
|
+
if (r instanceof RegExp)
|
|
736
|
+
return r.lastIndex = 0, r.test(c);
|
|
737
|
+
try {
|
|
738
|
+
return new RegExp(r).test(c);
|
|
739
|
+
} catch {
|
|
740
|
+
return !0;
|
|
741
|
+
}
|
|
742
|
+
}, h = (c) => {
|
|
743
|
+
const b = c.target.value;
|
|
744
|
+
m(b) && (typeof s == "function" && !s(b, c) || (o?.(c), a?.(b, c)));
|
|
745
|
+
};
|
|
746
|
+
return /* @__PURE__ */ l(
|
|
747
|
+
"input",
|
|
748
|
+
{
|
|
749
|
+
ref: u,
|
|
750
|
+
className: `${q(d, n)} form-field`,
|
|
751
|
+
onChange: h,
|
|
752
|
+
...i
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
});
|
|
756
|
+
function ln({
|
|
757
|
+
option: e,
|
|
758
|
+
selected: t = !1,
|
|
759
|
+
onSelect: n,
|
|
760
|
+
renderIcon: r,
|
|
761
|
+
className: s = ""
|
|
762
|
+
}) {
|
|
763
|
+
const o = e?.label ?? e?.value ?? "", a = e?.icon, i = e?.iconName, u = e?.iconVariant ?? "default", d = e?.iconSize ?? "xl", m = e?.className ?? "", h = (y) => {
|
|
764
|
+
n?.(e, y);
|
|
765
|
+
}, c = r?.(e);
|
|
766
|
+
return /* @__PURE__ */ V("button", { type: "button", className: q("card column gap20 enum-option", !!!(c || !i && a) && "enum-option--text-only", t && "is-selected", m, s), "aria-pressed": t, onClick: h, children: [
|
|
767
|
+
c ?? (!i && a ? /* @__PURE__ */ l(ue, { src: a, alt: o, variant: u, size: d }) : null),
|
|
768
|
+
/* @__PURE__ */ l(_, { className: "enum-option-label", as: "span", size: "sm", children: o })
|
|
769
|
+
] });
|
|
770
|
+
}
|
|
771
|
+
const cn = (e) => typeof e == "string" || typeof e == "number", Ue = (e) => cn(e) ? { value: e } : e && typeof e == "object" && "value" in e ? e : null;
|
|
772
|
+
function un(e) {
|
|
773
|
+
return Array.isArray(e) ? e.map(Ue).filter(Boolean) : !e || typeof e != "object" ? [] : Object.values(e).map(Ue).filter(Boolean);
|
|
774
|
+
}
|
|
775
|
+
function Je(e, t, n) {
|
|
776
|
+
const r = e(t);
|
|
777
|
+
return r === t ? n : r;
|
|
778
|
+
}
|
|
779
|
+
function dn({
|
|
780
|
+
enumValues: e = [],
|
|
781
|
+
selectedValue: t = null,
|
|
782
|
+
onValueChange: n,
|
|
783
|
+
translationKeyPrefix: r = "",
|
|
784
|
+
getIcon: s,
|
|
785
|
+
getLabel: o,
|
|
786
|
+
renderIcon: a,
|
|
787
|
+
translate: i,
|
|
788
|
+
isOptionVisible: u = () => !0,
|
|
789
|
+
className: d = "",
|
|
790
|
+
optionClassName: m = "",
|
|
791
|
+
ariaLabel: h
|
|
792
|
+
}) {
|
|
793
|
+
const { t: c } = oe(), b = J(() => {
|
|
794
|
+
const y = i ?? c;
|
|
795
|
+
return un(e).filter((x) => u(x.value, x)).map((x) => {
|
|
796
|
+
const S = String(x.label ?? x.value), g = typeof o == "function" ? o(x.value, y, x) : x.labelKey ? Je(y, x.labelKey, S) : x.label != null ? x.label : r ? Je(y, `${r}.${x.value}`, S) : S;
|
|
797
|
+
return {
|
|
798
|
+
...x,
|
|
799
|
+
value: x.value,
|
|
800
|
+
label: g,
|
|
801
|
+
icon: x.icon ?? (typeof s == "function" ? s(x.value, x) : void 0),
|
|
802
|
+
iconName: x.iconName
|
|
803
|
+
};
|
|
804
|
+
});
|
|
805
|
+
}, [e, s, o, c, u, i, r]);
|
|
806
|
+
return /* @__PURE__ */ l("div", { className: q("enum-selector-grid", d), role: "radiogroup", "aria-label": h, children: b.map((y) => /* @__PURE__ */ l(
|
|
807
|
+
ln,
|
|
808
|
+
{
|
|
809
|
+
option: y,
|
|
810
|
+
selected: String(t) === String(y.value),
|
|
811
|
+
onSelect: () => n?.(y.value, y),
|
|
812
|
+
renderIcon: a,
|
|
813
|
+
className: m
|
|
814
|
+
},
|
|
815
|
+
String(y.value)
|
|
816
|
+
)) });
|
|
817
|
+
}
|
|
818
|
+
function Rr({
|
|
819
|
+
label: e,
|
|
820
|
+
checked: t = !1,
|
|
821
|
+
onChange: n,
|
|
822
|
+
required: r = !1,
|
|
823
|
+
className: s = "",
|
|
824
|
+
labelClassName: o = "",
|
|
825
|
+
fieldClassName: a = "",
|
|
826
|
+
disabled: i = !1,
|
|
827
|
+
requiredLabel: u
|
|
828
|
+
}) {
|
|
829
|
+
const { t: d } = oe(), m = u ?? d("forms.shared.required", { defaultValue: "Required" });
|
|
830
|
+
return /* @__PURE__ */ l("div", { className: `form-field customCheckbox ${s}`, children: /* @__PURE__ */ l(Jt, { variant: "custom", checked: t, onCheckedChange: n, required: r, disabled: i, className: a, containerClassName: `gap5 center ${o}`, markClassName: "", label: e ? /* @__PURE__ */ V(Tt, { children: [
|
|
831
|
+
e,
|
|
832
|
+
r && /* @__PURE__ */ l(_, { className: "form-field-required-text", as: "span", children: m })
|
|
833
|
+
] }) : null }) });
|
|
834
|
+
}
|
|
835
|
+
const fn = te(function({
|
|
836
|
+
label: t,
|
|
837
|
+
placeholder: n = "",
|
|
838
|
+
value: r,
|
|
839
|
+
onChange: s,
|
|
840
|
+
type: o = "text",
|
|
841
|
+
required: a,
|
|
842
|
+
validations: i = {},
|
|
843
|
+
className: u = "",
|
|
844
|
+
labelClassName: d = "",
|
|
845
|
+
fieldClassName: m = "",
|
|
846
|
+
invalid: h = !1,
|
|
847
|
+
invalidLabel: c = "",
|
|
848
|
+
requiredLabel: b,
|
|
849
|
+
format: y,
|
|
850
|
+
isValid: v,
|
|
851
|
+
onKeyDown: x,
|
|
852
|
+
...S
|
|
853
|
+
}, g) {
|
|
854
|
+
const { t: T } = oe(), N = b ?? T("forms.shared.required", { defaultValue: "Required" }), k = i.required ?? a, f = {
|
|
855
|
+
...i,
|
|
856
|
+
required: k
|
|
857
|
+
}, p = r == null || String(r).trim().length === 0;
|
|
858
|
+
return /* @__PURE__ */ V("div", { className: `form-field-container gap5 ${h ? "invalid" : ""} ${u}`, children: [
|
|
859
|
+
t && /* @__PURE__ */ V(_, { className: `form-field-label row-left ${d}`.trim(), as: "label", size: "xxs", children: [
|
|
860
|
+
t,
|
|
861
|
+
k && /* @__PURE__ */ l(_, { className: q("form-field-required-text", p && "empty"), as: "span", children: N })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ l(an, { ref: g, variant: "custom", type: o, placeholder: n, value: r, onValueChange: s, onKeyDown: x, "aria-invalid": h, format: y, isValid: v, ...f, ...S, className: `${m}` }),
|
|
864
|
+
h && c ? /* @__PURE__ */ l(_, { as: "p", size: "xxs", className: "form-field-warning-text", left: !0, children: c }) : null
|
|
865
|
+
] });
|
|
866
|
+
}), ht = Ve(null);
|
|
867
|
+
function we() {
|
|
868
|
+
const e = Re(ht);
|
|
869
|
+
if (!e)
|
|
870
|
+
throw new Error("Select components must be used inside SelectRoot");
|
|
871
|
+
return e;
|
|
872
|
+
}
|
|
873
|
+
function mn() {
|
|
874
|
+
const {
|
|
875
|
+
variantClass: e,
|
|
876
|
+
className: t,
|
|
877
|
+
disabled: n,
|
|
878
|
+
required: r,
|
|
879
|
+
isOpen: s,
|
|
880
|
+
hasValue: o,
|
|
881
|
+
displayLabel: a,
|
|
882
|
+
triggerRef: i,
|
|
883
|
+
forwardedRef: u,
|
|
884
|
+
toggleOpen: d,
|
|
885
|
+
open: m
|
|
886
|
+
} = we();
|
|
887
|
+
return /* @__PURE__ */ V(
|
|
888
|
+
"button",
|
|
889
|
+
{
|
|
890
|
+
ref: (c) => {
|
|
891
|
+
if (i.current = c, typeof u == "function") {
|
|
892
|
+
u(c);
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
u && (u.current = c);
|
|
896
|
+
},
|
|
897
|
+
type: "button",
|
|
898
|
+
className: q(
|
|
899
|
+
e,
|
|
900
|
+
t,
|
|
901
|
+
"form-field",
|
|
902
|
+
"select-trigger",
|
|
903
|
+
!o && "placeholder"
|
|
904
|
+
),
|
|
905
|
+
onClick: () => {
|
|
906
|
+
n || d();
|
|
907
|
+
},
|
|
908
|
+
onKeyDown: (c) => {
|
|
909
|
+
n || ((c.key === "Enter" || c.key === " ") && (c.preventDefault(), d()), c.key === "ArrowDown" && (c.preventDefault(), m()));
|
|
910
|
+
},
|
|
911
|
+
"aria-expanded": s,
|
|
912
|
+
"aria-haspopup": "listbox",
|
|
913
|
+
"aria-controls": "select-overlay-listbox",
|
|
914
|
+
"aria-disabled": n,
|
|
915
|
+
"aria-required": r,
|
|
916
|
+
"aria-placeholder": o ? void 0 : a,
|
|
917
|
+
disabled: n,
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ l("span", { className: "select-trigger-label", children: a }),
|
|
920
|
+
/* @__PURE__ */ l(on, { size: "xs", isOpen: s })
|
|
921
|
+
]
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
function pt({
|
|
926
|
+
label: e,
|
|
927
|
+
selected: t = !1,
|
|
928
|
+
className: n = "",
|
|
929
|
+
mobile: r = !1,
|
|
930
|
+
onClick: s
|
|
931
|
+
}) {
|
|
932
|
+
return /* @__PURE__ */ l(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
type: "button",
|
|
936
|
+
role: "option",
|
|
937
|
+
"aria-selected": t,
|
|
938
|
+
className: q(
|
|
939
|
+
r ? "sheet-option" : "select-option",
|
|
940
|
+
t && "is-selected",
|
|
941
|
+
n
|
|
942
|
+
),
|
|
943
|
+
onClick: s,
|
|
944
|
+
children: /* @__PURE__ */ l(
|
|
945
|
+
_,
|
|
946
|
+
{
|
|
947
|
+
as: "span",
|
|
948
|
+
size: "sm",
|
|
949
|
+
className: r ? "sheet-label" : "select-option-label",
|
|
950
|
+
dynamic: !0,
|
|
951
|
+
color: t ? 1 : 3,
|
|
952
|
+
children: e
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
}
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
function hn() {
|
|
959
|
+
const {
|
|
960
|
+
listboxId: e,
|
|
961
|
+
position: t,
|
|
962
|
+
options: n,
|
|
963
|
+
overlayRef: r,
|
|
964
|
+
currentValue: s,
|
|
965
|
+
handleSelect: o,
|
|
966
|
+
searchable: a,
|
|
967
|
+
searchTerm: i,
|
|
968
|
+
setSearchTerm: u,
|
|
969
|
+
searchIcon: d,
|
|
970
|
+
searchLabel: m,
|
|
971
|
+
emptyLabel: h
|
|
972
|
+
} = we();
|
|
973
|
+
return /* @__PURE__ */ l(
|
|
974
|
+
"div",
|
|
975
|
+
{
|
|
976
|
+
ref: r,
|
|
977
|
+
className: q("select-dropdown", "is-open", t.placement === "top" && "is-top"),
|
|
978
|
+
style: {
|
|
979
|
+
left: `${t.left}px`,
|
|
980
|
+
top: `${t.top}px`,
|
|
981
|
+
width: `${t.width}px`
|
|
982
|
+
},
|
|
983
|
+
children: /* @__PURE__ */ V("div", { className: "select-dropdown-panel", children: [
|
|
984
|
+
a ? /* @__PURE__ */ l("div", { className: "select-searchbar-wrap", children: /* @__PURE__ */ V("div", { className: "select-searchbar", children: [
|
|
985
|
+
/* @__PURE__ */ l(
|
|
986
|
+
"input",
|
|
987
|
+
{
|
|
988
|
+
type: "text",
|
|
989
|
+
className: "searchbar-input form-field",
|
|
990
|
+
value: i,
|
|
991
|
+
onChange: (c) => u(c.target.value),
|
|
992
|
+
placeholder: m
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
d ? /* @__PURE__ */ l("span", { className: "select-search-icon", children: d }) : null
|
|
996
|
+
] }) }) : null,
|
|
997
|
+
/* @__PURE__ */ l("div", { className: "select-dropdown-list", role: "listbox", id: e, children: n.length === 0 ? /* @__PURE__ */ l(_, { as: "p", size: "xs", center: !0, className: "select-empty-state", dynamic: !0, color: 3, children: h }) : n.map((c) => {
|
|
998
|
+
const b = String(c.value) === String(s);
|
|
999
|
+
return /* @__PURE__ */ l(
|
|
1000
|
+
pt,
|
|
1001
|
+
{
|
|
1002
|
+
label: c.label,
|
|
1003
|
+
selected: b,
|
|
1004
|
+
className: c.className,
|
|
1005
|
+
onClick: () => o(c.value)
|
|
1006
|
+
},
|
|
1007
|
+
String(c.value)
|
|
1008
|
+
);
|
|
1009
|
+
}) })
|
|
1010
|
+
] })
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
function pn(e) {
|
|
1015
|
+
return e ? Array.from(
|
|
1016
|
+
e.querySelectorAll(
|
|
1017
|
+
'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
1018
|
+
)
|
|
1019
|
+
).filter((t) => !t.hasAttribute("disabled") && t.getAttribute("aria-hidden") !== "true") : [];
|
|
1020
|
+
}
|
|
1021
|
+
function gn({
|
|
1022
|
+
enabled: e = !0,
|
|
1023
|
+
initialFocusRef: t,
|
|
1024
|
+
onEnterKeyDown: n,
|
|
1025
|
+
onEscapeKeyDown: r,
|
|
1026
|
+
restoreFocus: s = !0,
|
|
1027
|
+
rootRef: o,
|
|
1028
|
+
trapFocus: a = !1,
|
|
1029
|
+
useCapture: i = !1
|
|
1030
|
+
} = {}) {
|
|
1031
|
+
Q(() => {
|
|
1032
|
+
if (!e || typeof document > "u") return;
|
|
1033
|
+
const u = document.activeElement, d = o?.current, m = t?.current;
|
|
1034
|
+
requestAnimationFrame(() => {
|
|
1035
|
+
if (m?.focus) {
|
|
1036
|
+
m.focus();
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
d?.focus?.();
|
|
1040
|
+
});
|
|
1041
|
+
const h = (c) => {
|
|
1042
|
+
if (c.key === "Escape") {
|
|
1043
|
+
r?.(c);
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
if (c.key === "Enter") {
|
|
1047
|
+
n?.(c);
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
if (!a || c.key !== "Tab") return;
|
|
1051
|
+
const b = pn(o?.current);
|
|
1052
|
+
if (b.length === 0) {
|
|
1053
|
+
c.preventDefault(), o?.current?.focus?.();
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
const y = b[0], v = b[b.length - 1], x = document.activeElement;
|
|
1057
|
+
if (c.shiftKey && x === y) {
|
|
1058
|
+
c.preventDefault(), v.focus();
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
!c.shiftKey && x === v && (c.preventDefault(), y.focus());
|
|
1062
|
+
};
|
|
1063
|
+
return document.addEventListener("keydown", h, i), () => {
|
|
1064
|
+
document.removeEventListener("keydown", h, i), s && u?.focus && u.focus();
|
|
1065
|
+
};
|
|
1066
|
+
}, [e, t, n, r, s, o, a, i]);
|
|
1067
|
+
}
|
|
1068
|
+
function gt({
|
|
1069
|
+
className: e = "",
|
|
1070
|
+
backdropLabel: t = "",
|
|
1071
|
+
backdropStyle: n,
|
|
1072
|
+
closing: r = !1,
|
|
1073
|
+
centerContent: s = !0,
|
|
1074
|
+
initialFocusRef: o,
|
|
1075
|
+
onBackdropClick: a,
|
|
1076
|
+
onEnterKeyDown: i,
|
|
1077
|
+
onEscapeKeyDown: u,
|
|
1078
|
+
portal: d = !1,
|
|
1079
|
+
portalTarget: m,
|
|
1080
|
+
restoreFocus: h = !0,
|
|
1081
|
+
trapFocus: c = !1,
|
|
1082
|
+
useKeyboardCapture: b = !1,
|
|
1083
|
+
children: y,
|
|
1084
|
+
...v
|
|
1085
|
+
}) {
|
|
1086
|
+
const x = ee(null);
|
|
1087
|
+
gn({
|
|
1088
|
+
initialFocusRef: o,
|
|
1089
|
+
onEnterKeyDown: i,
|
|
1090
|
+
onEscapeKeyDown: u,
|
|
1091
|
+
rootRef: x,
|
|
1092
|
+
restoreFocus: h,
|
|
1093
|
+
trapFocus: c,
|
|
1094
|
+
useCapture: b
|
|
1095
|
+
});
|
|
1096
|
+
const S = /* @__PURE__ */ V(
|
|
1097
|
+
"div",
|
|
1098
|
+
{
|
|
1099
|
+
ref: x,
|
|
1100
|
+
className: q("kosmio-overlay", r && "is-closing", s && "kosmio-overlay-centered", e),
|
|
1101
|
+
tabIndex: -1,
|
|
1102
|
+
...v,
|
|
1103
|
+
children: [
|
|
1104
|
+
/* @__PURE__ */ l(Qt, { className: "kosmio-backdrop-animated", label: t, onClick: a, style: n }),
|
|
1105
|
+
/* @__PURE__ */ l("div", { className: q("kosmio-overlay-content", s && "kosmio-overlay-content-centered"), children: y })
|
|
1106
|
+
]
|
|
1107
|
+
}
|
|
1108
|
+
);
|
|
1109
|
+
if (!d) return S;
|
|
1110
|
+
const g = m ?? (typeof document > "u" ? null : document.body);
|
|
1111
|
+
return g ? ut(S, g) : null;
|
|
1112
|
+
}
|
|
1113
|
+
const yn = '[data-no-form-drag="true"]', ce = {
|
|
1114
|
+
backdropFade: 0.55,
|
|
1115
|
+
backdropMinOpacity: 0.18,
|
|
1116
|
+
closeDistance: 140,
|
|
1117
|
+
closeOffset: 48,
|
|
1118
|
+
closeVelocity: 0.55
|
|
1119
|
+
}, be = {
|
|
1120
|
+
active: !1,
|
|
1121
|
+
engaged: !1,
|
|
1122
|
+
mode: null,
|
|
1123
|
+
source: null,
|
|
1124
|
+
pointerId: null,
|
|
1125
|
+
startX: 0,
|
|
1126
|
+
startY: 0,
|
|
1127
|
+
startTime: 0
|
|
1128
|
+
};
|
|
1129
|
+
function bn(e) {
|
|
1130
|
+
if (!(e instanceof HTMLElement)) return !1;
|
|
1131
|
+
const { overflowY: t } = window.getComputedStyle(e);
|
|
1132
|
+
return ["auto", "scroll", "overlay"].includes(t) && e.scrollHeight > e.clientHeight + 1;
|
|
1133
|
+
}
|
|
1134
|
+
function vn(e, t) {
|
|
1135
|
+
if (!(e instanceof HTMLElement) || !(t instanceof HTMLElement) || e.closest(yn)) return !1;
|
|
1136
|
+
let n = e;
|
|
1137
|
+
for (; n && n !== t; ) {
|
|
1138
|
+
if (bn(n) && n.scrollTop > 0) return !1;
|
|
1139
|
+
n = n.parentElement;
|
|
1140
|
+
}
|
|
1141
|
+
return !0;
|
|
1142
|
+
}
|
|
1143
|
+
function ve(e) {
|
|
1144
|
+
return e?.[0] ?? null;
|
|
1145
|
+
}
|
|
1146
|
+
function he(e, t, n) {
|
|
1147
|
+
const r = Number.parseFloat(e.getPropertyValue(t));
|
|
1148
|
+
return Number.isFinite(r) ? r : n;
|
|
1149
|
+
}
|
|
1150
|
+
function Ze(e) {
|
|
1151
|
+
if (!(e instanceof HTMLElement)) return ce;
|
|
1152
|
+
const t = window.getComputedStyle(e);
|
|
1153
|
+
return {
|
|
1154
|
+
backdropFade: he(t, "--kosmio-sheet-backdrop-drag-fade", ce.backdropFade),
|
|
1155
|
+
backdropMinOpacity: he(t, "--kosmio-sheet-backdrop-min-opacity", ce.backdropMinOpacity),
|
|
1156
|
+
closeDistance: he(t, "--kosmio-sheet-close-distance", ce.closeDistance),
|
|
1157
|
+
closeOffset: he(t, "--kosmio-sheet-close-offset", ce.closeOffset),
|
|
1158
|
+
closeVelocity: he(t, "--kosmio-sheet-close-velocity", ce.closeVelocity)
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
function xn({
|
|
1162
|
+
canStartContentDrag: e = vn,
|
|
1163
|
+
closing: t = !1,
|
|
1164
|
+
containerRef: n,
|
|
1165
|
+
dragZoneRef: r,
|
|
1166
|
+
enableContentDrag: s = !0,
|
|
1167
|
+
isMobile: o = !1,
|
|
1168
|
+
onDragDismiss: a,
|
|
1169
|
+
onRequestClose: i,
|
|
1170
|
+
scrollRef: u,
|
|
1171
|
+
showDragHandle: d = !0
|
|
1172
|
+
} = {}) {
|
|
1173
|
+
const [m, h] = U(0), [c, b] = U(!1), [y, v] = U(!1), [x, S] = U(!1), g = ee(be), T = W(() => {
|
|
1174
|
+
g.current = be, b(!1), v(!1), S(!1), h(0);
|
|
1175
|
+
}, []), N = W(({ clientX: D, clientY: R, pointerId: O = null, mode: L, target: I, source: z }) => {
|
|
1176
|
+
!o || t || x || z === "content" && (!s || !e(I, n.current)) || (g.current = {
|
|
1177
|
+
active: !0,
|
|
1178
|
+
engaged: z === "handle",
|
|
1179
|
+
mode: L,
|
|
1180
|
+
source: z,
|
|
1181
|
+
pointerId: O,
|
|
1182
|
+
startX: D,
|
|
1183
|
+
startY: R,
|
|
1184
|
+
startTime: performance.now()
|
|
1185
|
+
}, L === "pointer" && O != null && n.current?.setPointerCapture?.(O), b(z === "handle"), v(!1), S(!1));
|
|
1186
|
+
}, [e, t, n, s, x, o]), k = W(({ clientX: D, clientY: R, preventDefault: O }) => {
|
|
1187
|
+
const L = g.current;
|
|
1188
|
+
if (!L.active || t || x) return;
|
|
1189
|
+
const I = R - L.startY, z = D - L.startX;
|
|
1190
|
+
if (!L.engaged) {
|
|
1191
|
+
if (L.source !== "handle") {
|
|
1192
|
+
if (I < -6 || Math.abs(z) > Math.abs(I)) {
|
|
1193
|
+
g.current = be, b(!1);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
if (I <= 6) return;
|
|
1197
|
+
}
|
|
1198
|
+
g.current = {
|
|
1199
|
+
...L,
|
|
1200
|
+
engaged: !0
|
|
1201
|
+
}, b(!0);
|
|
1202
|
+
}
|
|
1203
|
+
if (O?.(), I <= 0) {
|
|
1204
|
+
h(0);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
Math.abs(z) > I || h(I);
|
|
1208
|
+
}, [t, x]), f = W(({ clientY: D, pointerId: R = null }) => {
|
|
1209
|
+
const O = g.current;
|
|
1210
|
+
if (!O.active || O.mode === "pointer" && O.pointerId !== R) return;
|
|
1211
|
+
O.mode === "pointer" && R != null && n.current?.releasePointerCapture?.(R), g.current = be, b(!1);
|
|
1212
|
+
const L = Math.max(0, D - O.startY), I = Math.max(performance.now() - O.startTime, 1), z = L / I, $ = Ze(n.current);
|
|
1213
|
+
if (L >= $.closeDistance || z >= $.closeVelocity) {
|
|
1214
|
+
S(!0), v(!1), h((n.current?.offsetHeight ?? L) + $.closeOffset);
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
v(!0), h(0);
|
|
1218
|
+
}, [n]), p = W((D, R) => {
|
|
1219
|
+
D.pointerType !== "touch" && N({
|
|
1220
|
+
clientX: D.clientX,
|
|
1221
|
+
clientY: D.clientY,
|
|
1222
|
+
pointerId: D.pointerId,
|
|
1223
|
+
mode: "pointer",
|
|
1224
|
+
target: D.target,
|
|
1225
|
+
source: R
|
|
1226
|
+
});
|
|
1227
|
+
}, [N]), E = W((D) => {
|
|
1228
|
+
const R = g.current;
|
|
1229
|
+
R.mode !== "pointer" || R.pointerId !== D.pointerId || k({
|
|
1230
|
+
clientX: D.clientX,
|
|
1231
|
+
clientY: D.clientY,
|
|
1232
|
+
preventDefault: D.cancelable ? () => D.preventDefault() : void 0
|
|
1233
|
+
});
|
|
1234
|
+
}, [k]), w = W((D) => {
|
|
1235
|
+
f({
|
|
1236
|
+
clientY: D.clientY,
|
|
1237
|
+
pointerId: D.pointerId
|
|
1238
|
+
});
|
|
1239
|
+
}, [f]), C = W(() => {
|
|
1240
|
+
if (x) {
|
|
1241
|
+
T(), (a ?? i)?.();
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
y && v(!1);
|
|
1245
|
+
}, [y, x, a, i, T]);
|
|
1246
|
+
Q(() => {
|
|
1247
|
+
(t || !o) && T();
|
|
1248
|
+
}, [t, o, T]), Q(() => {
|
|
1249
|
+
if (!o) return;
|
|
1250
|
+
const D = r.current, R = u.current, O = n.current;
|
|
1251
|
+
if (!D && d || !R || !O) return;
|
|
1252
|
+
const L = (A) => {
|
|
1253
|
+
const Y = ve(A.touches);
|
|
1254
|
+
Y && N({
|
|
1255
|
+
clientX: Y.clientX,
|
|
1256
|
+
clientY: Y.clientY,
|
|
1257
|
+
mode: "touch",
|
|
1258
|
+
target: A.target,
|
|
1259
|
+
source: "handle"
|
|
1260
|
+
});
|
|
1261
|
+
}, I = (A) => {
|
|
1262
|
+
const Y = ve(A.touches);
|
|
1263
|
+
Y && N({
|
|
1264
|
+
clientX: Y.clientX,
|
|
1265
|
+
clientY: Y.clientY,
|
|
1266
|
+
mode: "touch",
|
|
1267
|
+
target: A.target,
|
|
1268
|
+
source: "content"
|
|
1269
|
+
});
|
|
1270
|
+
}, z = (A) => {
|
|
1271
|
+
if (g.current.mode !== "touch") return;
|
|
1272
|
+
const X = ve(A.touches);
|
|
1273
|
+
X && k({
|
|
1274
|
+
clientX: X.clientX,
|
|
1275
|
+
clientY: X.clientY,
|
|
1276
|
+
preventDefault: A.cancelable ? () => A.preventDefault() : void 0
|
|
1277
|
+
});
|
|
1278
|
+
}, $ = (A) => {
|
|
1279
|
+
const Y = g.current;
|
|
1280
|
+
if (Y.mode !== "touch") return;
|
|
1281
|
+
const X = ve(A.changedTouches);
|
|
1282
|
+
f({
|
|
1283
|
+
clientY: X?.clientY ?? Y.startY
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
return d && D?.addEventListener("touchstart", L, { passive: !0 }), R.addEventListener("touchstart", I, { passive: !0 }), O.addEventListener("touchmove", z, { passive: !1 }), O.addEventListener("touchend", $), O.addEventListener("touchcancel", $), () => {
|
|
1287
|
+
d && D?.removeEventListener("touchstart", L), R.removeEventListener("touchstart", I), O.removeEventListener("touchmove", z), O.removeEventListener("touchend", $), O.removeEventListener("touchcancel", $);
|
|
1288
|
+
};
|
|
1289
|
+
}, [
|
|
1290
|
+
N,
|
|
1291
|
+
t,
|
|
1292
|
+
n,
|
|
1293
|
+
r,
|
|
1294
|
+
f,
|
|
1295
|
+
o,
|
|
1296
|
+
u,
|
|
1297
|
+
d,
|
|
1298
|
+
k
|
|
1299
|
+
]);
|
|
1300
|
+
const G = n.current?.offsetHeight ?? 1, F = Ze(n.current), P = o ? Math.min(m / G, 1) : 0, M = o && (c || y || x) ? {
|
|
1301
|
+
"--kosmio-overlay-backdrop-opacity": Math.max(F.backdropMinOpacity, 1 - P * F.backdropFade)
|
|
1302
|
+
} : void 0, K = o && (c || y || x || m > 0) ? {
|
|
1303
|
+
transform: `translate3d(0, ${m}px, 0)`,
|
|
1304
|
+
transition: c ? "none" : "transform var(--kosmio-sheet-drag-settle-duration) ease-out"
|
|
1305
|
+
} : void 0;
|
|
1306
|
+
return {
|
|
1307
|
+
backdropStyle: M,
|
|
1308
|
+
dragging: c,
|
|
1309
|
+
gestureClosing: x,
|
|
1310
|
+
handlePointerDown: p,
|
|
1311
|
+
handlePointerEnd: w,
|
|
1312
|
+
handlePointerMove: E,
|
|
1313
|
+
handleTransitionEnd: C,
|
|
1314
|
+
sheetStyle: K
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
const Nn = "transform", kn = "kosmio-slide-up";
|
|
1318
|
+
function Sn(e, t) {
|
|
1319
|
+
if (e) {
|
|
1320
|
+
if (typeof e == "function") {
|
|
1321
|
+
e(t);
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
e.current = t;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
const Cn = te(function({
|
|
1328
|
+
isMobile: t = !1,
|
|
1329
|
+
closing: n = !1,
|
|
1330
|
+
className: r = "",
|
|
1331
|
+
backdropLabel: s = "",
|
|
1332
|
+
feedbackState: o = "",
|
|
1333
|
+
beforeScrollContent: a = null,
|
|
1334
|
+
showDragHandle: i = !0,
|
|
1335
|
+
enableContentDrag: u = !0,
|
|
1336
|
+
canStartContentDrag: d,
|
|
1337
|
+
initialFocusRef: m,
|
|
1338
|
+
onRequestClose: h,
|
|
1339
|
+
onDragDismiss: c,
|
|
1340
|
+
onAnimationEnd: b,
|
|
1341
|
+
onEscapeKeyDown: y,
|
|
1342
|
+
onTransitionEnd: v,
|
|
1343
|
+
portal: x = !1,
|
|
1344
|
+
portalTarget: S,
|
|
1345
|
+
restoreFocus: g,
|
|
1346
|
+
trapFocus: T,
|
|
1347
|
+
children: N,
|
|
1348
|
+
...k
|
|
1349
|
+
}, f) {
|
|
1350
|
+
const [p, E] = U(!0), w = ee(null), C = ee(null), G = ee(null), {
|
|
1351
|
+
backdropStyle: F,
|
|
1352
|
+
dragging: P,
|
|
1353
|
+
gestureClosing: M,
|
|
1354
|
+
handlePointerDown: K,
|
|
1355
|
+
handlePointerEnd: D,
|
|
1356
|
+
handlePointerMove: R,
|
|
1357
|
+
handleTransitionEnd: O,
|
|
1358
|
+
sheetStyle: L
|
|
1359
|
+
} = xn({
|
|
1360
|
+
canStartContentDrag: d,
|
|
1361
|
+
closing: n,
|
|
1362
|
+
containerRef: w,
|
|
1363
|
+
dragZoneRef: C,
|
|
1364
|
+
enableContentDrag: u,
|
|
1365
|
+
isMobile: t,
|
|
1366
|
+
onDragDismiss: c,
|
|
1367
|
+
onRequestClose: h,
|
|
1368
|
+
scrollRef: G,
|
|
1369
|
+
showDragHandle: i
|
|
1370
|
+
}), I = (A) => {
|
|
1371
|
+
w.current = A, Sn(f, A);
|
|
1372
|
+
}, z = (A) => {
|
|
1373
|
+
if (A.target !== A.currentTarget || A.propertyName !== Nn) {
|
|
1374
|
+
v?.(A);
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
O(), v?.(A);
|
|
1378
|
+
}, $ = (A) => {
|
|
1379
|
+
A.target === A.currentTarget && A.animationName === kn && E(!1), b?.(A);
|
|
1380
|
+
};
|
|
1381
|
+
return Q(() => {
|
|
1382
|
+
n || E(!0);
|
|
1383
|
+
}, [n]), Q(() => {
|
|
1384
|
+
P && E(!1);
|
|
1385
|
+
}, [P]), /* @__PURE__ */ l(
|
|
1386
|
+
gt,
|
|
1387
|
+
{
|
|
1388
|
+
className: "kosmio-sheet-layer",
|
|
1389
|
+
closing: n || M,
|
|
1390
|
+
backdropLabel: s,
|
|
1391
|
+
backdropStyle: F,
|
|
1392
|
+
centerContent: !1,
|
|
1393
|
+
initialFocusRef: m,
|
|
1394
|
+
onBackdropClick: h,
|
|
1395
|
+
onEscapeKeyDown: y,
|
|
1396
|
+
portal: x,
|
|
1397
|
+
portalTarget: S,
|
|
1398
|
+
restoreFocus: g,
|
|
1399
|
+
trapFocus: T,
|
|
1400
|
+
children: /* @__PURE__ */ V(
|
|
1401
|
+
"div",
|
|
1402
|
+
{
|
|
1403
|
+
...k,
|
|
1404
|
+
ref: I,
|
|
1405
|
+
className: q(
|
|
1406
|
+
"kosmio-sheet",
|
|
1407
|
+
r,
|
|
1408
|
+
p && "is-entering",
|
|
1409
|
+
P && "is-dragging",
|
|
1410
|
+
M && "is-gesture-closing",
|
|
1411
|
+
o && `is-feedback-${o}`
|
|
1412
|
+
),
|
|
1413
|
+
onClick: (A) => A.stopPropagation(),
|
|
1414
|
+
onAnimationEnd: $,
|
|
1415
|
+
onTransitionEnd: z,
|
|
1416
|
+
onPointerMove: R,
|
|
1417
|
+
onPointerUp: D,
|
|
1418
|
+
onPointerCancel: D,
|
|
1419
|
+
style: L,
|
|
1420
|
+
children: [
|
|
1421
|
+
o ? /* @__PURE__ */ l("div", { className: q("kosmio-sheet-feedback", `is-${o}`), "aria-hidden": "true" }) : null,
|
|
1422
|
+
a,
|
|
1423
|
+
i && t ? /* @__PURE__ */ l(
|
|
1424
|
+
"div",
|
|
1425
|
+
{
|
|
1426
|
+
className: "kosmio-sheet-drag-zone",
|
|
1427
|
+
onPointerDown: (A) => K(A, "handle"),
|
|
1428
|
+
ref: C,
|
|
1429
|
+
role: "presentation",
|
|
1430
|
+
children: /* @__PURE__ */ l("div", { className: "kosmio-sheet-drag-handle", "aria-hidden": "true" })
|
|
1431
|
+
}
|
|
1432
|
+
) : null,
|
|
1433
|
+
/* @__PURE__ */ l("div", { className: "kosmio-sheet-scroll", onPointerDown: (A) => K(A, "content"), ref: G, children: N })
|
|
1434
|
+
]
|
|
1435
|
+
}
|
|
1436
|
+
)
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1439
|
+
});
|
|
1440
|
+
function Tn() {
|
|
1441
|
+
const {
|
|
1442
|
+
isClosing: e,
|
|
1443
|
+
isMobile: t,
|
|
1444
|
+
listboxId: n,
|
|
1445
|
+
closeImmediately: r,
|
|
1446
|
+
requestClose: s,
|
|
1447
|
+
options: o,
|
|
1448
|
+
overlayRef: a,
|
|
1449
|
+
currentValue: i,
|
|
1450
|
+
handleSelect: u,
|
|
1451
|
+
placeholder: d,
|
|
1452
|
+
displayLabel: m,
|
|
1453
|
+
searchable: h,
|
|
1454
|
+
searchTerm: c,
|
|
1455
|
+
setSearchTerm: b,
|
|
1456
|
+
searchIcon: y,
|
|
1457
|
+
searchLabel: v,
|
|
1458
|
+
emptyLabel: x,
|
|
1459
|
+
closeLabel: S
|
|
1460
|
+
} = we(), g = d ?? m;
|
|
1461
|
+
return /* @__PURE__ */ l(
|
|
1462
|
+
Cn,
|
|
1463
|
+
{
|
|
1464
|
+
ref: a,
|
|
1465
|
+
isMobile: t,
|
|
1466
|
+
closing: e,
|
|
1467
|
+
className: "select-sheet",
|
|
1468
|
+
backdropLabel: S,
|
|
1469
|
+
onRequestClose: s,
|
|
1470
|
+
onDragDismiss: r,
|
|
1471
|
+
portal: !0,
|
|
1472
|
+
role: "dialog",
|
|
1473
|
+
"aria-modal": "true",
|
|
1474
|
+
"aria-labelledby": `${n}-title`,
|
|
1475
|
+
trapFocus: !0,
|
|
1476
|
+
children: /* @__PURE__ */ V("div", { className: "select-sheet-body", children: [
|
|
1477
|
+
/* @__PURE__ */ l("div", { className: "select-sheet-header", children: /* @__PURE__ */ l(_, { as: "p", size: "sm", dynamic: !0, color: 1, id: `${n}-title`, children: g }) }),
|
|
1478
|
+
h ? /* @__PURE__ */ l("div", { className: "select-searchbar-wrap select-sheet-searchbar-wrap", children: /* @__PURE__ */ V("div", { className: "select-searchbar", children: [
|
|
1479
|
+
/* @__PURE__ */ l(
|
|
1480
|
+
"input",
|
|
1481
|
+
{
|
|
1482
|
+
type: "text",
|
|
1483
|
+
className: "searchbar-input form-field",
|
|
1484
|
+
value: c,
|
|
1485
|
+
onChange: (T) => b(T.target.value),
|
|
1486
|
+
placeholder: v
|
|
1487
|
+
}
|
|
1488
|
+
),
|
|
1489
|
+
y ? /* @__PURE__ */ l("span", { className: "select-search-icon", children: y }) : null
|
|
1490
|
+
] }) }) : null,
|
|
1491
|
+
/* @__PURE__ */ l("div", { className: "select-sheet-list", role: "listbox", id: n, children: o.length === 0 ? /* @__PURE__ */ l(_, { as: "p", size: "xs", center: !0, className: "select-empty-state", dynamic: !0, color: 3, children: x }) : o.map((T) => {
|
|
1492
|
+
const N = String(T.value) === String(i);
|
|
1493
|
+
return /* @__PURE__ */ l(
|
|
1494
|
+
pt,
|
|
1495
|
+
{
|
|
1496
|
+
label: T.label,
|
|
1497
|
+
selected: N,
|
|
1498
|
+
className: T.className,
|
|
1499
|
+
mobile: !0,
|
|
1500
|
+
onClick: () => u(T.value)
|
|
1501
|
+
},
|
|
1502
|
+
String(T.value)
|
|
1503
|
+
);
|
|
1504
|
+
}) })
|
|
1505
|
+
] })
|
|
1506
|
+
}
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
function En() {
|
|
1510
|
+
const { isOpen: e, isMobile: t } = we();
|
|
1511
|
+
return e ? t ? /* @__PURE__ */ l(Tn, {}) : typeof document > "u" ? null : ut(/* @__PURE__ */ l(hn, {}), document.body) : null;
|
|
1512
|
+
}
|
|
1513
|
+
const wn = {
|
|
1514
|
+
plain: "",
|
|
1515
|
+
custom: "customSelect"
|
|
1516
|
+
}, An = "(max-width: 768px)", xe = 5, et = 12, De = 230, Ln = 150;
|
|
1517
|
+
function In(e) {
|
|
1518
|
+
return typeof e == "object" && e !== null ? {
|
|
1519
|
+
value: e.value,
|
|
1520
|
+
label: e.label,
|
|
1521
|
+
className: e.className ?? ""
|
|
1522
|
+
} : {
|
|
1523
|
+
value: e,
|
|
1524
|
+
label: e,
|
|
1525
|
+
className: ""
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
const On = te(function({
|
|
1529
|
+
variant: t = "plain",
|
|
1530
|
+
className: n = "",
|
|
1531
|
+
options: r = [],
|
|
1532
|
+
searchable: s = !1,
|
|
1533
|
+
placeholder: o,
|
|
1534
|
+
value: a,
|
|
1535
|
+
defaultValue: i = "",
|
|
1536
|
+
disabled: u = !1,
|
|
1537
|
+
required: d = !1,
|
|
1538
|
+
onChange: m,
|
|
1539
|
+
onValueChange: h,
|
|
1540
|
+
name: c,
|
|
1541
|
+
searchIcon: b = null,
|
|
1542
|
+
searchLabel: y,
|
|
1543
|
+
emptyLabel: v,
|
|
1544
|
+
closeLabel: x,
|
|
1545
|
+
selectOptionLabel: S
|
|
1546
|
+
}, g) {
|
|
1547
|
+
const { t: T } = oe(), N = y ?? T("common.actions.search", { defaultValue: "Search" }), k = v ?? T("common.messages.info.noResultMessage", { defaultValue: "No results" }), f = x ?? T("common.actions.close", { defaultValue: "Close" }), p = S ?? T("forms.shared.selectOption", { defaultValue: "Select option" }), E = wn[t] ?? t, w = ee(null), C = a !== void 0, [G, F] = U(i), [P, M] = U(!1), [K, D] = U(!1), [R, O] = U(!1), [L, I] = U({
|
|
1548
|
+
left: 0,
|
|
1549
|
+
top: 0,
|
|
1550
|
+
width: 0,
|
|
1551
|
+
placement: "bottom",
|
|
1552
|
+
maxHeight: De
|
|
1553
|
+
}), [z, $] = U(""), A = _e(), Y = ee(null), X = ee(null), ne = J(() => r.map(In), [r]), se = J(() => {
|
|
1554
|
+
const B = z.trim().toLowerCase();
|
|
1555
|
+
return !s || B.length === 0 ? ne : ne.filter(
|
|
1556
|
+
(j) => String(j.label).toLowerCase().includes(B)
|
|
1557
|
+
);
|
|
1558
|
+
}, [ne, z, s]), ae = C ? a : G, ge = o != null && String(o).trim() !== "" ? o : p, ie = ne.find(
|
|
1559
|
+
(B) => String(B.value) === String(ae)
|
|
1560
|
+
)?.label ?? ge, de = ae != null && String(ae).trim() !== "";
|
|
1561
|
+
Q(() => () => {
|
|
1562
|
+
X.current && window.clearTimeout(X.current);
|
|
1563
|
+
}, []), Q(() => {
|
|
1564
|
+
const B = window.matchMedia(An), j = () => O(B.matches);
|
|
1565
|
+
return j(), typeof B.addEventListener == "function" ? (B.addEventListener("change", j), () => B.removeEventListener("change", j)) : (B.addListener(j), () => B.removeListener(j));
|
|
1566
|
+
}, []), Q(() => {
|
|
1567
|
+
if (!P || R)
|
|
1568
|
+
return;
|
|
1569
|
+
const B = () => {
|
|
1570
|
+
const j = w.current?.getBoundingClientRect();
|
|
1571
|
+
if (!j)
|
|
1572
|
+
return;
|
|
1573
|
+
const re = window.innerHeight, me = Math.max(0, j.top - et - xe), Le = Math.max(
|
|
1574
|
+
0,
|
|
1575
|
+
re - j.bottom - et - xe
|
|
1576
|
+
), Ie = Le < De && me > Le, St = Ie ? "top" : "bottom", Ct = Math.max(
|
|
1577
|
+
120,
|
|
1578
|
+
Math.min(De, Ie ? me : Le)
|
|
1579
|
+
);
|
|
1580
|
+
I({
|
|
1581
|
+
left: j.left,
|
|
1582
|
+
top: Ie ? j.top - xe : j.bottom + xe,
|
|
1583
|
+
width: j.width,
|
|
1584
|
+
placement: St,
|
|
1585
|
+
maxHeight: Ct
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1588
|
+
return B(), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), () => {
|
|
1589
|
+
window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0);
|
|
1590
|
+
};
|
|
1591
|
+
}, [R, P]), Q(() => {
|
|
1592
|
+
if (!P || K) {
|
|
1593
|
+
$("");
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
const B = (re) => {
|
|
1597
|
+
const me = re.target;
|
|
1598
|
+
R && me instanceof Element && me.closest(".select-sheet") || w.current?.contains(re.target) || Y.current?.contains(re.target) || le();
|
|
1599
|
+
}, j = (re) => {
|
|
1600
|
+
re.key === "Escape" && (le(), w.current?.focus());
|
|
1601
|
+
};
|
|
1602
|
+
return document.addEventListener("mousedown", B), document.addEventListener("touchstart", B), document.addEventListener("keydown", j), () => {
|
|
1603
|
+
document.removeEventListener("mousedown", B), document.removeEventListener("touchstart", B), document.removeEventListener("keydown", j);
|
|
1604
|
+
};
|
|
1605
|
+
}, [K, R, P, A]);
|
|
1606
|
+
const Ae = (B) => {
|
|
1607
|
+
C || F(B);
|
|
1608
|
+
const j = {
|
|
1609
|
+
target: { name: c, value: B },
|
|
1610
|
+
currentTarget: { name: c, value: B }
|
|
1611
|
+
};
|
|
1612
|
+
m?.(j), h?.(B, j);
|
|
1613
|
+
}, fe = () => {
|
|
1614
|
+
X.current && (window.clearTimeout(X.current), X.current = null), D(!1), M(!1);
|
|
1615
|
+
}, le = () => {
|
|
1616
|
+
if (!(!P || K)) {
|
|
1617
|
+
if (!R) {
|
|
1618
|
+
fe();
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
D(!0), X.current = window.setTimeout(() => {
|
|
1622
|
+
X.current = null, fe();
|
|
1623
|
+
}, Ln);
|
|
1624
|
+
}
|
|
1625
|
+
}, ye = () => {
|
|
1626
|
+
X.current && (window.clearTimeout(X.current), X.current = null), D(!1), M(!0);
|
|
1627
|
+
}, Z = {
|
|
1628
|
+
className: n,
|
|
1629
|
+
closeImmediately: fe,
|
|
1630
|
+
currentValue: ae,
|
|
1631
|
+
disabled: u,
|
|
1632
|
+
displayLabel: ie,
|
|
1633
|
+
filteredOptions: se,
|
|
1634
|
+
forwardedRef: g,
|
|
1635
|
+
handleSelect: (B) => {
|
|
1636
|
+
Ae(B), le(), w.current?.focus();
|
|
1637
|
+
},
|
|
1638
|
+
hasValue: de,
|
|
1639
|
+
isClosing: K,
|
|
1640
|
+
isMobile: R,
|
|
1641
|
+
isOpen: P,
|
|
1642
|
+
listboxId: A,
|
|
1643
|
+
open: ye,
|
|
1644
|
+
options: se,
|
|
1645
|
+
overlayRef: Y,
|
|
1646
|
+
placeholder: ge,
|
|
1647
|
+
position: L,
|
|
1648
|
+
requestClose: le,
|
|
1649
|
+
required: d,
|
|
1650
|
+
searchIcon: b,
|
|
1651
|
+
searchLabel: N,
|
|
1652
|
+
searchable: s,
|
|
1653
|
+
searchTerm: z,
|
|
1654
|
+
setSearchTerm: $,
|
|
1655
|
+
emptyLabel: k,
|
|
1656
|
+
closeLabel: f,
|
|
1657
|
+
toggleOpen: () => {
|
|
1658
|
+
if (P) {
|
|
1659
|
+
le();
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
ye();
|
|
1663
|
+
},
|
|
1664
|
+
triggerRef: w,
|
|
1665
|
+
variantClass: E
|
|
1666
|
+
};
|
|
1667
|
+
return /* @__PURE__ */ l(ht.Provider, { value: Z, children: /* @__PURE__ */ V("div", { className: q("select-field", P && "is-open", R && "is-mobile"), children: [
|
|
1668
|
+
/* @__PURE__ */ l(mn, {}),
|
|
1669
|
+
/* @__PURE__ */ l(En, {})
|
|
1670
|
+
] }) });
|
|
1671
|
+
});
|
|
1672
|
+
function Pe({
|
|
1673
|
+
label: e,
|
|
1674
|
+
placeholder: t,
|
|
1675
|
+
value: n,
|
|
1676
|
+
defaultValue: r = "",
|
|
1677
|
+
onChange: s,
|
|
1678
|
+
options: o = [],
|
|
1679
|
+
searchable: a = !1,
|
|
1680
|
+
required: i = !1,
|
|
1681
|
+
className: u = "",
|
|
1682
|
+
labelClassName: d = "",
|
|
1683
|
+
fieldClassName: m = "",
|
|
1684
|
+
requiredLabel: h,
|
|
1685
|
+
selectOptionLabel: c,
|
|
1686
|
+
searchIcon: b = null,
|
|
1687
|
+
searchLabel: y,
|
|
1688
|
+
emptyLabel: v,
|
|
1689
|
+
closeLabel: x
|
|
1690
|
+
}) {
|
|
1691
|
+
const { t: S } = oe(), g = h ?? S("forms.shared.required", { defaultValue: "Required" }), T = c ?? S("forms.shared.selectOption", { defaultValue: "Select option" }), N = y ?? S("common.actions.search", { defaultValue: "Search" }), k = v ?? S("common.messages.info.noResultMessage", { defaultValue: "No results" }), f = x ?? S("common.actions.close", { defaultValue: "Close" }), p = n ?? r, E = t ?? T, w = p == null || String(p).trim().length === 0;
|
|
1692
|
+
return /* @__PURE__ */ V("div", { className: `form-field-container ${u}`.trim(), children: [
|
|
1693
|
+
e && /* @__PURE__ */ V(_, { className: `form-field-label ${d}`.trim(), as: "label", size: "xxs", children: [
|
|
1694
|
+
e,
|
|
1695
|
+
i && /* @__PURE__ */ l(_, { className: q("form-field-required-text", w && "empty"), as: "span", children: g })
|
|
1696
|
+
] }),
|
|
1697
|
+
/* @__PURE__ */ l(On, { variant: "custom", value: p, onValueChange: s, required: i, placeholder: E, options: o, searchable: a, className: `${m} ${p ? "" : "placeholder"}`, searchIcon: b, searchLabel: N, emptyLabel: k, closeLabel: f, selectOptionLabel: T })
|
|
1698
|
+
] });
|
|
1699
|
+
}
|
|
1700
|
+
function yt({ children: e, text: t, color: n, className: r = "", ...s }) {
|
|
1701
|
+
const o = e ?? t;
|
|
1702
|
+
return /* @__PURE__ */ l(
|
|
1703
|
+
_,
|
|
1704
|
+
{
|
|
1705
|
+
as: "span",
|
|
1706
|
+
className: `kosmio-tag tag ${r}`.trim(),
|
|
1707
|
+
size: "xxs",
|
|
1708
|
+
style: n ? { "--kosmio-tag-color": n, "--tag-color": n } : void 0,
|
|
1709
|
+
...s,
|
|
1710
|
+
children: o
|
|
1711
|
+
}
|
|
1712
|
+
);
|
|
1713
|
+
}
|
|
1714
|
+
function Vr({ children: e, text: t, color: n = "#5a95ad", className: r = "", ...s }) {
|
|
1715
|
+
return /* @__PURE__ */ l(yt, { color: n, className: `color-tag text-inline ${r}`.trim(), ...s, children: e ?? t });
|
|
1716
|
+
}
|
|
1717
|
+
const Dn = (e) => /* @__PURE__ */ l(_, { className: "tag generatorInput-chip", as: "p", size: "sm", children: e }), zn = (e) => e === "Backspace" || e === "Delete", tt = (e, t, n) => typeof e == "function" ? e(t, n) : Be(e) ? lt(e, {
|
|
1718
|
+
text: t,
|
|
1719
|
+
index: n
|
|
1720
|
+
}) : Dn(t);
|
|
1721
|
+
function $n({
|
|
1722
|
+
label: e,
|
|
1723
|
+
placeholder: t = "",
|
|
1724
|
+
value: n,
|
|
1725
|
+
defaultValue: r = [],
|
|
1726
|
+
onChange: s,
|
|
1727
|
+
onGeneratedChange: o,
|
|
1728
|
+
component: a = /* @__PURE__ */ l(yt, {}),
|
|
1729
|
+
className: i = "",
|
|
1730
|
+
labelClassName: u = "",
|
|
1731
|
+
fieldClassName: d = "",
|
|
1732
|
+
inputClassName: m = "",
|
|
1733
|
+
disabled: h = !1,
|
|
1734
|
+
onKeyDown: c,
|
|
1735
|
+
...b
|
|
1736
|
+
}) {
|
|
1737
|
+
const [y, v] = U(""), [x, S] = U(() => Array.isArray(r) ? r : []), g = ee(null), T = Array.isArray(n), N = T ? n : x, k = (C) => {
|
|
1738
|
+
T || S(C), s?.(C), o?.({
|
|
1739
|
+
texts: C,
|
|
1740
|
+
components: C.map((G, F) => tt(a, G, F))
|
|
1741
|
+
});
|
|
1742
|
+
}, f = () => {
|
|
1743
|
+
if (h) return;
|
|
1744
|
+
const C = y.trim();
|
|
1745
|
+
C && (k([...N, C]), v(""));
|
|
1746
|
+
}, p = () => {
|
|
1747
|
+
h || N.length === 0 || k(N.slice(0, -1));
|
|
1748
|
+
}, E = J(() => N.map((C, G) => {
|
|
1749
|
+
const F = tt(a, C, G), P = `${C}-${G}`;
|
|
1750
|
+
return typeof F == "string" || typeof F == "number" ? /* @__PURE__ */ l(_, { className: "tag generatorInput-chip", as: "span", size: "xxs", children: String(F) }, P) : /* @__PURE__ */ l(Et, { children: F }, P);
|
|
1751
|
+
}), [N, a]), w = (C) => {
|
|
1752
|
+
C.key === "Enter" ? (C.preventDefault(), f()) : zn(C.key) && y.length === 0 && (C.preventDefault(), p()), c?.(C);
|
|
1753
|
+
};
|
|
1754
|
+
return /* @__PURE__ */ V("div", { className: q("form-field-container gap5", i), children: [
|
|
1755
|
+
e && /* @__PURE__ */ l(_, { className: q("form-field-label row-left", u), as: "label", size: "xxs", children: e }),
|
|
1756
|
+
/* @__PURE__ */ V("div", { className: q("generatorInput-container form-field", d, h && "generatorInput-disabled"), onMouseDown: (C) => {
|
|
1757
|
+
C.target !== g.current && C.preventDefault(), g.current?.focus();
|
|
1758
|
+
}, children: [
|
|
1759
|
+
E,
|
|
1760
|
+
/* @__PURE__ */ l("input", { ref: g, type: "text", value: y, placeholder: N.length === 0 ? t : "", onChange: (C) => v(C.target.value), onKeyDown: w, className: q("generatorInput-input", m), disabled: h, ...b })
|
|
1761
|
+
] })
|
|
1762
|
+
] });
|
|
1763
|
+
}
|
|
1764
|
+
const Te = "__default_group__";
|
|
1765
|
+
function nt(e) {
|
|
1766
|
+
return String(e ?? "").toLowerCase().trim();
|
|
1767
|
+
}
|
|
1768
|
+
function Me(e, t) {
|
|
1769
|
+
const n = Number(e);
|
|
1770
|
+
return Number.isFinite(n) ? n : t;
|
|
1771
|
+
}
|
|
1772
|
+
function Ye(e = {}) {
|
|
1773
|
+
return e?.params && typeof e.params == "object" ? e.params : e?.param && typeof e.param == "object" ? e.param : {};
|
|
1774
|
+
}
|
|
1775
|
+
function Fn(e = {}, t = Number.MAX_SAFE_INTEGER) {
|
|
1776
|
+
const n = Ye(e), r = n.group ?? e.group;
|
|
1777
|
+
if (typeof r == "string" && r.trim())
|
|
1778
|
+
return {
|
|
1779
|
+
name: r.trim(),
|
|
1780
|
+
order: Me(n.groupIndex ?? e.groupIndex, t)
|
|
1781
|
+
};
|
|
1782
|
+
if (r && typeof r == "object") {
|
|
1783
|
+
const s = r.name ?? r.key ?? r.id;
|
|
1784
|
+
return {
|
|
1785
|
+
name: typeof s == "string" && s.trim() ? s.trim() : Te,
|
|
1786
|
+
order: Me(r.index, t)
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
return {
|
|
1790
|
+
name: Te,
|
|
1791
|
+
order: t
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
function Pn(e) {
|
|
1795
|
+
if (e == null || e === "") return "";
|
|
1796
|
+
if (typeof e == "string") {
|
|
1797
|
+
const t = e.trim();
|
|
1798
|
+
if (!t) return "";
|
|
1799
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(t)) return t.slice(0, 10);
|
|
1800
|
+
const n = new Date(t);
|
|
1801
|
+
return Number.isNaN(n.getTime()) ? t : [
|
|
1802
|
+
n.getFullYear(),
|
|
1803
|
+
String(n.getMonth() + 1).padStart(2, "0"),
|
|
1804
|
+
String(n.getDate()).padStart(2, "0")
|
|
1805
|
+
].join("-");
|
|
1806
|
+
}
|
|
1807
|
+
return e instanceof Date && !Number.isNaN(e.getTime()) ? [
|
|
1808
|
+
e.getFullYear(),
|
|
1809
|
+
String(e.getMonth() + 1).padStart(2, "0"),
|
|
1810
|
+
String(e.getDate()).padStart(2, "0")
|
|
1811
|
+
].join("-") : "";
|
|
1812
|
+
}
|
|
1813
|
+
function Mn(e = {}) {
|
|
1814
|
+
const t = Ye(e);
|
|
1815
|
+
return {
|
|
1816
|
+
values: t.enum ?? e.enum ?? [],
|
|
1817
|
+
i18nPath: t.enumI18nPath ?? e.enumI18nPath ?? t.enumPath ?? e.enumPath ?? null
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
function Rn(e, t) {
|
|
1821
|
+
return Array.isArray(e.values) ? e.values.map((n) => {
|
|
1822
|
+
if (n && typeof n == "object") {
|
|
1823
|
+
const a = n.value ?? n.id ?? n.key;
|
|
1824
|
+
if (a == null) return null;
|
|
1825
|
+
const i = e.i18nPath && n.label == null ? t(`${e.i18nPath}.${a}`) : null;
|
|
1826
|
+
return {
|
|
1827
|
+
...n,
|
|
1828
|
+
value: String(a),
|
|
1829
|
+
label: n.label ?? (i === `${e.i18nPath}.${a}` ? String(a) : i)
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
const r = String(n ?? "");
|
|
1833
|
+
if (!r) return null;
|
|
1834
|
+
const s = e.i18nPath != null ? t(`${e.i18nPath}.${r}`) : r, o = `${e.i18nPath}.${r}`;
|
|
1835
|
+
return {
|
|
1836
|
+
value: r,
|
|
1837
|
+
label: s === o ? r : s
|
|
1838
|
+
};
|
|
1839
|
+
}).filter(Boolean) : [];
|
|
1840
|
+
}
|
|
1841
|
+
function Br({
|
|
1842
|
+
modelProperties: e,
|
|
1843
|
+
form: t,
|
|
1844
|
+
onChange: n,
|
|
1845
|
+
optionsMap: r = {},
|
|
1846
|
+
customRenderers: s = {},
|
|
1847
|
+
onlyFields: o = null,
|
|
1848
|
+
mode: a = "create",
|
|
1849
|
+
i18nPath: i = null,
|
|
1850
|
+
groupI18nPath: u = null
|
|
1851
|
+
}) {
|
|
1852
|
+
const { t: d } = oe(), m = e?.fields ?? {}, h = {
|
|
1853
|
+
requiredLabel: d("forms.shared.required"),
|
|
1854
|
+
selectOptionLabel: d("forms.shared.selectOption"),
|
|
1855
|
+
searchLabel: d("common.actions.search"),
|
|
1856
|
+
emptyLabel: d("common.messages.info.noResultMessage"),
|
|
1857
|
+
closeLabel: d("common.actions.close")
|
|
1858
|
+
}, c = (f) => a === "edit" ? f.editable : f.writable, b = (f) => {
|
|
1859
|
+
if (!i) return f;
|
|
1860
|
+
const p = `${i}.${f}`, E = d(p);
|
|
1861
|
+
return E === p ? f : E;
|
|
1862
|
+
}, y = (f) => {
|
|
1863
|
+
if (!f || f === Te) return null;
|
|
1864
|
+
if (!u) return f;
|
|
1865
|
+
const p = `${u}.${f}`, E = d(p);
|
|
1866
|
+
return E === p ? f : E;
|
|
1867
|
+
}, v = (f, p, E) => {
|
|
1868
|
+
const w = nt(E);
|
|
1869
|
+
if (w === "number") {
|
|
1870
|
+
const C = p === "" || p == null ? null : Number(p);
|
|
1871
|
+
n(f, Number.isNaN(C) ? null : C);
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
if (w === "boolean" || w === "bool") {
|
|
1875
|
+
n(f, !!p);
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
n(f, p);
|
|
1879
|
+
}, x = (f) => f.iconName ? /* @__PURE__ */ l(mt, { name: f.iconName, alt: f.label, variant: f.iconVariant, size: f.iconSize ?? "xl" }) : null, S = Object.entries(m).map(([f, p], E) => ({
|
|
1880
|
+
name: f,
|
|
1881
|
+
meta: p,
|
|
1882
|
+
position: E
|
|
1883
|
+
})).filter(({ name: f, meta: p }) => !(!c(p) || o && !o.includes(f))).map((f) => {
|
|
1884
|
+
const p = Ye(f.meta), E = Fn(f.meta, f.position);
|
|
1885
|
+
return {
|
|
1886
|
+
...f,
|
|
1887
|
+
fieldIndex: Me(p.index ?? f.meta?.index, f.position),
|
|
1888
|
+
groupName: E.name,
|
|
1889
|
+
groupIndex: E.order
|
|
1890
|
+
};
|
|
1891
|
+
}).sort((f, p) => f.groupIndex !== p.groupIndex ? f.groupIndex - p.groupIndex : f.groupName !== p.groupName ? String(f.groupName).localeCompare(String(p.groupName)) : f.fieldIndex !== p.fieldIndex ? f.fieldIndex - p.fieldIndex : f.position - p.position), g = [], T = /* @__PURE__ */ new Map();
|
|
1892
|
+
for (const f of S) {
|
|
1893
|
+
const p = String(f.groupName);
|
|
1894
|
+
if (!T.has(p)) {
|
|
1895
|
+
const w = {
|
|
1896
|
+
key: p,
|
|
1897
|
+
name: f.groupName,
|
|
1898
|
+
index: f.groupIndex,
|
|
1899
|
+
fields: []
|
|
1900
|
+
};
|
|
1901
|
+
T.set(p, w), g.push(w);
|
|
1902
|
+
}
|
|
1903
|
+
const E = T.get(p);
|
|
1904
|
+
E.index = Math.min(E.index, f.groupIndex), E.fields.push(f);
|
|
1905
|
+
}
|
|
1906
|
+
const N = g.some((f) => f.name !== Te), k = ({ name: f, meta: p }) => {
|
|
1907
|
+
const E = t?.[f], w = nt(p?.type), C = b(f), G = Mn(p), F = Rn(G, d), P = Array.isArray(r[f]) && r[f].length > 0 ? r[f] : F;
|
|
1908
|
+
return s[f] ? /* @__PURE__ */ l("div", { children: s[f]({
|
|
1909
|
+
value: E,
|
|
1910
|
+
onChange: (M) => n(f, M),
|
|
1911
|
+
meta: p,
|
|
1912
|
+
name: f,
|
|
1913
|
+
label: C
|
|
1914
|
+
}) }, f) : w === "string" || w === "number" || w === "date" ? /* @__PURE__ */ l(
|
|
1915
|
+
fn,
|
|
1916
|
+
{
|
|
1917
|
+
label: C,
|
|
1918
|
+
placeholder: C,
|
|
1919
|
+
type: w === "string" ? void 0 : w,
|
|
1920
|
+
value: w === "date" ? Pn(E) : E ?? "",
|
|
1921
|
+
required: p.required,
|
|
1922
|
+
requiredLabel: h.requiredLabel,
|
|
1923
|
+
onChange: (M) => v(f, M, w)
|
|
1924
|
+
},
|
|
1925
|
+
f
|
|
1926
|
+
) : w === "boolean" || w === "bool" ? /* @__PURE__ */ V(_, { className: "row-left", as: "label", children: [
|
|
1927
|
+
/* @__PURE__ */ l("input", { type: "checkbox", checked: !!E, onChange: (M) => v(f, M.target.checked, w) }),
|
|
1928
|
+
C
|
|
1929
|
+
] }, f) : w.endsWith("[]") ? /* @__PURE__ */ l(
|
|
1930
|
+
$n,
|
|
1931
|
+
{
|
|
1932
|
+
label: C,
|
|
1933
|
+
placeholder: C,
|
|
1934
|
+
value: Array.isArray(E) ? E : [],
|
|
1935
|
+
onChange: (M) => n(f, M),
|
|
1936
|
+
component: (M, K) => /* @__PURE__ */ l(_, { className: "tag", as: "p", children: M }, `${M}-${K}`)
|
|
1937
|
+
},
|
|
1938
|
+
f
|
|
1939
|
+
) : w === "object" ? /* @__PURE__ */ l(
|
|
1940
|
+
Pe,
|
|
1941
|
+
{
|
|
1942
|
+
label: C,
|
|
1943
|
+
placeholder: C,
|
|
1944
|
+
options: r[f] || [],
|
|
1945
|
+
value: E ?? "",
|
|
1946
|
+
required: p.required,
|
|
1947
|
+
onChange: (M) => n(f, M),
|
|
1948
|
+
searchable: !0,
|
|
1949
|
+
...h
|
|
1950
|
+
},
|
|
1951
|
+
f
|
|
1952
|
+
) : w === "enum" ? F.length > 6 ? /* @__PURE__ */ l(
|
|
1953
|
+
Pe,
|
|
1954
|
+
{
|
|
1955
|
+
label: C,
|
|
1956
|
+
placeholder: C,
|
|
1957
|
+
options: F,
|
|
1958
|
+
value: E ?? "",
|
|
1959
|
+
required: p.required,
|
|
1960
|
+
onChange: (M) => n(f, M),
|
|
1961
|
+
searchable: !0,
|
|
1962
|
+
...h
|
|
1963
|
+
},
|
|
1964
|
+
f
|
|
1965
|
+
) : /* @__PURE__ */ V("div", { className: "column-left gap5", children: [
|
|
1966
|
+
C && /* @__PURE__ */ V(_, { className: "form-field-label row-left", as: "label", size: "xxs", children: [
|
|
1967
|
+
C,
|
|
1968
|
+
p.required && /* @__PURE__ */ l(_, { className: "form-field-required-text", as: "span", children: d("forms.shared.required") })
|
|
1969
|
+
] }),
|
|
1970
|
+
/* @__PURE__ */ l(
|
|
1971
|
+
dn,
|
|
1972
|
+
{
|
|
1973
|
+
enumValues: P,
|
|
1974
|
+
selectedValue: E ?? "",
|
|
1975
|
+
onValueChange: (M) => n(f, M),
|
|
1976
|
+
ariaLabel: C,
|
|
1977
|
+
className: "form-enum-selector",
|
|
1978
|
+
renderIcon: x
|
|
1979
|
+
}
|
|
1980
|
+
)
|
|
1981
|
+
] }, f) : null;
|
|
1982
|
+
};
|
|
1983
|
+
return N ? /* @__PURE__ */ l("div", { className: "full-view column-left gap20", children: g.map((f) => {
|
|
1984
|
+
const p = y(f.name);
|
|
1985
|
+
return /* @__PURE__ */ V("div", { className: "form-section", children: [
|
|
1986
|
+
p && /* @__PURE__ */ l(_, { as: "p", size: "xxs", children: p }),
|
|
1987
|
+
/* @__PURE__ */ l("div", { className: "section-fields", children: f.fields.map(k) })
|
|
1988
|
+
] }, f.key);
|
|
1989
|
+
}) }) : /* @__PURE__ */ l("div", { className: "column-left gap10 form-section", children: S.map(k) });
|
|
1990
|
+
}
|
|
1991
|
+
function _r({ className: e = "", ...t }) {
|
|
1992
|
+
return /* @__PURE__ */ l("div", { className: `kosmio-loader ${e}`.trim(), role: "status", ...t });
|
|
1993
|
+
}
|
|
1994
|
+
function qr({
|
|
1995
|
+
children: e,
|
|
1996
|
+
restoreFocus: t = !0,
|
|
1997
|
+
role: n = "dialog",
|
|
1998
|
+
trapFocus: r = !0,
|
|
1999
|
+
...s
|
|
2000
|
+
}) {
|
|
2001
|
+
return /* @__PURE__ */ l(gt, { ...s, "aria-modal": "true", restoreFocus: t, role: n, trapFocus: r, children: e });
|
|
2002
|
+
}
|
|
2003
|
+
function Yr({
|
|
2004
|
+
children: e,
|
|
2005
|
+
className: t = "full-view flex column-left gap20",
|
|
2006
|
+
formLauncher: n,
|
|
2007
|
+
showOperationsShortcut: r = !1,
|
|
2008
|
+
showContentCard: s = !0,
|
|
2009
|
+
fullsize: o = !1
|
|
2010
|
+
}) {
|
|
2011
|
+
const { clearFormLauncher: a, setFormLauncher: i, setShowOperationsShortcut: u } = it();
|
|
2012
|
+
return Q(() => {
|
|
2013
|
+
if (n !== void 0)
|
|
2014
|
+
return n ? i(n) : a(), () => a();
|
|
2015
|
+
}, [a, n, i]), Q(() => (u(r), () => u(!1)), [u, r]), /* @__PURE__ */ l("main", { className: q("page page-container", o && "fullsize", s && "page-content", t), children: e });
|
|
2016
|
+
}
|
|
2017
|
+
const Vn = {
|
|
2018
|
+
plain: "searchbar",
|
|
2019
|
+
full: "full-w searchbar"
|
|
2020
|
+
}, rt = te(function({
|
|
2021
|
+
variant: t = "full",
|
|
2022
|
+
className: n = "",
|
|
2023
|
+
placeholder: r,
|
|
2024
|
+
value: s,
|
|
2025
|
+
onChange: o,
|
|
2026
|
+
onValueChange: a,
|
|
2027
|
+
onSearch: i,
|
|
2028
|
+
onKeyDown: u,
|
|
2029
|
+
searchButtonType: d = "button",
|
|
2030
|
+
searchButtonLabel: m,
|
|
2031
|
+
searchIcon: h = null,
|
|
2032
|
+
inputRef: c,
|
|
2033
|
+
...b
|
|
2034
|
+
}, y) {
|
|
2035
|
+
const { t: v } = oe(), x = r ?? v("common.actions.search", { defaultValue: "Search" }), S = Vn[t] ?? t, g = (N) => {
|
|
2036
|
+
o?.(N), a?.(N.target.value, N);
|
|
2037
|
+
}, T = () => {
|
|
2038
|
+
i?.(s ?? "");
|
|
2039
|
+
};
|
|
2040
|
+
return /* @__PURE__ */ V("div", { ref: y, className: q(S, n, "pointer"), children: [
|
|
2041
|
+
/* @__PURE__ */ l(
|
|
2042
|
+
"input",
|
|
2043
|
+
{
|
|
2044
|
+
ref: c,
|
|
2045
|
+
type: "text",
|
|
2046
|
+
className: "searchbar-input form-field",
|
|
2047
|
+
placeholder: x,
|
|
2048
|
+
value: s,
|
|
2049
|
+
onChange: g,
|
|
2050
|
+
onKeyDown: (N) => {
|
|
2051
|
+
N.key === "Enter" && (N.preventDefault(), i?.(N.currentTarget.value)), u?.(N);
|
|
2052
|
+
},
|
|
2053
|
+
...b
|
|
2054
|
+
}
|
|
2055
|
+
),
|
|
2056
|
+
/* @__PURE__ */ l(
|
|
2057
|
+
"button",
|
|
2058
|
+
{
|
|
2059
|
+
type: d,
|
|
2060
|
+
className: "searchbar-button",
|
|
2061
|
+
onClick: T,
|
|
2062
|
+
"aria-label": m || x,
|
|
2063
|
+
children: h
|
|
2064
|
+
}
|
|
2065
|
+
)
|
|
2066
|
+
] });
|
|
2067
|
+
});
|
|
2068
|
+
function ze(e = "") {
|
|
2069
|
+
if (!e) return "/";
|
|
2070
|
+
const t = e.trim();
|
|
2071
|
+
return t === "/" ? "/" : t.replace(/\/+$/, "") || "/";
|
|
2072
|
+
}
|
|
2073
|
+
class Ee {
|
|
2074
|
+
constructor({
|
|
2075
|
+
id: t,
|
|
2076
|
+
name: n,
|
|
2077
|
+
label: r,
|
|
2078
|
+
url: s,
|
|
2079
|
+
to: o,
|
|
2080
|
+
path: a,
|
|
2081
|
+
routeKey: i,
|
|
2082
|
+
activeRoutes: u,
|
|
2083
|
+
icon: d,
|
|
2084
|
+
iconSelected: m,
|
|
2085
|
+
iconName: h,
|
|
2086
|
+
iconSelectedName: c,
|
|
2087
|
+
badge: b,
|
|
2088
|
+
className: y,
|
|
2089
|
+
active: v,
|
|
2090
|
+
isActive: x,
|
|
2091
|
+
onClick: S
|
|
2092
|
+
} = {}) {
|
|
2093
|
+
this.id = t ?? o ?? s ?? a ?? i ?? n, this.name = n, this.label = r ?? n, this.url = s, this.to = o ?? s, this.path = a, this.routeKey = i, this.activeRoutes = u ?? (i ? [i] : []), this.icon = d, this.iconSelected = m, this.iconName = h, this.iconSelectedName = c, this.badge = b, this.className = y, this.active = v, this.isActive = x, this.onClick = S;
|
|
2094
|
+
}
|
|
2095
|
+
matches(t) {
|
|
2096
|
+
return typeof this.active == "boolean" ? this.active : typeof this.isActive == "function" ? !!this.isActive(ze(t), this) : this.path ? ze(this.path) === ze(t) : !1;
|
|
2097
|
+
}
|
|
2098
|
+
static from(t = {}) {
|
|
2099
|
+
return t instanceof Ee ? t : new Ee(t);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
function Bn(e = "") {
|
|
2103
|
+
if (!e) return "/";
|
|
2104
|
+
const t = e.trim();
|
|
2105
|
+
return t === "/" ? "/" : t.replace(/\/+$/, "") || "/";
|
|
2106
|
+
}
|
|
2107
|
+
function _n(e) {
|
|
2108
|
+
return e || (typeof globalThis < "u" && globalThis.location?.pathname ? globalThis.location.pathname : "/");
|
|
2109
|
+
}
|
|
2110
|
+
function Hr({
|
|
2111
|
+
navItems: e = [],
|
|
2112
|
+
NavItemComponent: t,
|
|
2113
|
+
className: n = "",
|
|
2114
|
+
pathname: r
|
|
2115
|
+
}) {
|
|
2116
|
+
const s = Bn(_n(r));
|
|
2117
|
+
return t ? /* @__PURE__ */ l("nav", { className: n, children: e.map((o, a) => {
|
|
2118
|
+
const i = Ee.from(o), u = i.matches(s);
|
|
2119
|
+
return /* @__PURE__ */ l("div", { className: "full-w", children: /* @__PURE__ */ l(t, { navItem: i, active: u }) }, i.id ?? a);
|
|
2120
|
+
}) }) : null;
|
|
2121
|
+
}
|
|
2122
|
+
function Gr(e, t) {
|
|
2123
|
+
return { color: e, size: t };
|
|
2124
|
+
}
|
|
2125
|
+
function Xr(e, t, n, r, s) {
|
|
2126
|
+
return { fontSize: e, fontColor: t, weight: n, lineHeight: r, as: s };
|
|
2127
|
+
}
|
|
2128
|
+
function jr(e, t, n, r, s) {
|
|
2129
|
+
return {
|
|
2130
|
+
borderStyle: e,
|
|
2131
|
+
typoStyle: t,
|
|
2132
|
+
backgroundColor: n,
|
|
2133
|
+
padding: r,
|
|
2134
|
+
radii: s
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
function qn({ active: e, direction: t, sortAscIcon: n, sortDescIcon: r }) {
|
|
2138
|
+
return e ? t === "asc" ? n ?? /* @__PURE__ */ l("span", { className: "sort-icon sort-icon-asc", "aria-hidden": "true" }) : r ?? /* @__PURE__ */ l("span", { className: "sort-icon sort-icon-desc", "aria-hidden": "true" }) : null;
|
|
2139
|
+
}
|
|
2140
|
+
function Yn({ columns: e, sortConfig: t, requestSort: n, sortAscIcon: r, sortDescIcon: s }) {
|
|
2141
|
+
return /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: e.map((o) => {
|
|
2142
|
+
const a = t.key === o.key, i = o.headerClassName ?? o.className ?? "";
|
|
2143
|
+
return /* @__PURE__ */ l(
|
|
2144
|
+
"th",
|
|
2145
|
+
{
|
|
2146
|
+
onClick: () => n(o.key, o.sortable),
|
|
2147
|
+
className: `${o.sortable ? "th-sortable" : ""} ${i}`.trim(),
|
|
2148
|
+
style: {
|
|
2149
|
+
cursor: o.sortable ? "pointer" : "default",
|
|
2150
|
+
width: o.width || "auto"
|
|
2151
|
+
},
|
|
2152
|
+
children: /* @__PURE__ */ V(_, { size: "md", className: "row gap5", as: "span", color: 1, dynamic: !1, children: [
|
|
2153
|
+
o.header,
|
|
2154
|
+
/* @__PURE__ */ l(
|
|
2155
|
+
qn,
|
|
2156
|
+
{
|
|
2157
|
+
active: a,
|
|
2158
|
+
direction: t.direction,
|
|
2159
|
+
sortAscIcon: r,
|
|
2160
|
+
sortDescIcon: s
|
|
2161
|
+
}
|
|
2162
|
+
)
|
|
2163
|
+
] })
|
|
2164
|
+
},
|
|
2165
|
+
o.key
|
|
2166
|
+
);
|
|
2167
|
+
}) }) });
|
|
2168
|
+
}
|
|
2169
|
+
function bt({ icon: e = null }) {
|
|
2170
|
+
return /* @__PURE__ */ l("div", { className: "flex-center", children: e ?? /* @__PURE__ */ l("span", { className: "table-empty-cell-icon", "aria-hidden": "true" }) });
|
|
2171
|
+
}
|
|
2172
|
+
function Hn({ row: e, getValue: t, renderEmpty: n = /* @__PURE__ */ l(bt, {}) }) {
|
|
2173
|
+
const r = t(e);
|
|
2174
|
+
return r == null || r === "" ? n : /* @__PURE__ */ l("div", { className: "full-w flex-center gap10 overflow-x-none", children: /* @__PURE__ */ l(_, { as: "p", size: "sm", color: 1, dynamic: !0, className: "text-inline", children: r }) });
|
|
2175
|
+
}
|
|
2176
|
+
function Wr({ row: e, getIconName: t, getIconSrc: n, getAlt: r, getValue: s, renderIcon: o, size: a = "xmd" }) {
|
|
2177
|
+
const i = t?.(e), u = i ? null : n?.(e), d = r?.(e) ?? "";
|
|
2178
|
+
return /* @__PURE__ */ V("div", { className: "full-w flex gap10", children: [
|
|
2179
|
+
i && typeof o == "function" ? o({ name: i, alt: d, size: a, row: e }) : null,
|
|
2180
|
+
!i && u ? /* @__PURE__ */ l(ue, { src: u, alt: d, size: a }) : null,
|
|
2181
|
+
/* @__PURE__ */ l(_, { as: "p", size: "xs", color: 2, dynamic: !0, className: "text-inline", children: s(e) })
|
|
2182
|
+
] });
|
|
2183
|
+
}
|
|
2184
|
+
function Gn({ col: e, row: t }) {
|
|
2185
|
+
return e.cell ? e.cell(t) ?? /* @__PURE__ */ l(bt, {}) : /* @__PURE__ */ l(
|
|
2186
|
+
Hn,
|
|
2187
|
+
{
|
|
2188
|
+
row: t,
|
|
2189
|
+
getValue: (n) => {
|
|
2190
|
+
const r = e.accessor ? e.accessor(n) : n[e.key];
|
|
2191
|
+
return Array.isArray(r) && r.length === 0 ? null : r;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
function Xn({
|
|
2197
|
+
row: e,
|
|
2198
|
+
rowKey: t,
|
|
2199
|
+
idx: n,
|
|
2200
|
+
columns: r,
|
|
2201
|
+
striped: s,
|
|
2202
|
+
isSelected: o,
|
|
2203
|
+
conditionalRowClassName: a,
|
|
2204
|
+
hasInteractiveRows: i,
|
|
2205
|
+
rowHandlers: u
|
|
2206
|
+
}) {
|
|
2207
|
+
const d = s && n % 2 === 0 ? "row-even" : "row-odd", m = typeof a == "function" && a(e, n) || "";
|
|
2208
|
+
return /* @__PURE__ */ l(
|
|
2209
|
+
"tr",
|
|
2210
|
+
{
|
|
2211
|
+
className: `${d} ${o ? "row-selected" : ""} ${m}`,
|
|
2212
|
+
style: {
|
|
2213
|
+
cursor: i ? "pointer" : "default",
|
|
2214
|
+
...At({ index: n })
|
|
2215
|
+
},
|
|
2216
|
+
onClick: u.onClick,
|
|
2217
|
+
onDoubleClick: u.onDoubleClick,
|
|
2218
|
+
onContextMenu: u.onContextMenu,
|
|
2219
|
+
children: r.map((h) => {
|
|
2220
|
+
const c = h.cellClassName ?? h.className ?? "";
|
|
2221
|
+
return /* @__PURE__ */ l(
|
|
2222
|
+
"td",
|
|
2223
|
+
{
|
|
2224
|
+
className: c,
|
|
2225
|
+
style: { width: h.width || "auto" },
|
|
2226
|
+
children: Gn({ col: h, row: e })
|
|
2227
|
+
},
|
|
2228
|
+
h.key
|
|
2229
|
+
);
|
|
2230
|
+
})
|
|
2231
|
+
},
|
|
2232
|
+
t
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
function jn({
|
|
2236
|
+
sortedData: e,
|
|
2237
|
+
columns: t,
|
|
2238
|
+
getRowKey: n,
|
|
2239
|
+
striped: r,
|
|
2240
|
+
conditionalRowClassName: s,
|
|
2241
|
+
getRowHandlers: o,
|
|
2242
|
+
hasInteractiveRows: a
|
|
2243
|
+
}) {
|
|
2244
|
+
return /* @__PURE__ */ l("tbody", { children: e.map((i, u) => {
|
|
2245
|
+
const d = n(i, u), m = o(i, d);
|
|
2246
|
+
return /* @__PURE__ */ l(
|
|
2247
|
+
Xn,
|
|
2248
|
+
{
|
|
2249
|
+
row: i,
|
|
2250
|
+
rowKey: d,
|
|
2251
|
+
idx: u,
|
|
2252
|
+
columns: t,
|
|
2253
|
+
striped: r,
|
|
2254
|
+
isSelected: m.isSelected,
|
|
2255
|
+
conditionalRowClassName: s,
|
|
2256
|
+
hasInteractiveRows: a,
|
|
2257
|
+
rowHandlers: m
|
|
2258
|
+
},
|
|
2259
|
+
d
|
|
2260
|
+
);
|
|
2261
|
+
}) });
|
|
2262
|
+
}
|
|
2263
|
+
function Wn({ data: e, columns: t, initialSort: n }) {
|
|
2264
|
+
const [r, s] = U(n), o = (i, u) => {
|
|
2265
|
+
u && s((d) => ({
|
|
2266
|
+
key: i,
|
|
2267
|
+
direction: d.key === i && d.direction === "asc" ? "desc" : "asc"
|
|
2268
|
+
}));
|
|
2269
|
+
}, a = J(() => {
|
|
2270
|
+
if (!r.key) return e;
|
|
2271
|
+
const i = t.find((d) => d.key === r.key);
|
|
2272
|
+
if (!i) return e;
|
|
2273
|
+
const u = (d) => i.accessor ? i.accessor(d) : d[i.key];
|
|
2274
|
+
return [...e].sort((d, m) => {
|
|
2275
|
+
const h = u(d), c = u(m);
|
|
2276
|
+
return h == null && c != null ? -1 : h != null && c == null ? 1 : h == null && c == null ? 0 : h < c ? r.direction === "asc" ? -1 : 1 : h > c ? r.direction === "asc" ? 1 : -1 : 0;
|
|
2277
|
+
});
|
|
2278
|
+
}, [t, e, r]);
|
|
2279
|
+
return {
|
|
2280
|
+
sortConfig: r,
|
|
2281
|
+
requestSort: o,
|
|
2282
|
+
sortedData: a
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
function Qn({
|
|
2286
|
+
sortedData: e,
|
|
2287
|
+
getRowKey: t,
|
|
2288
|
+
tableRef: n,
|
|
2289
|
+
onRowClick: r,
|
|
2290
|
+
onSelectedClick: s,
|
|
2291
|
+
onDeselect: o,
|
|
2292
|
+
onSelectionChange: a,
|
|
2293
|
+
onRowRightClick: i,
|
|
2294
|
+
onEnterRow: u,
|
|
2295
|
+
selectOnRightClick: d = !0,
|
|
2296
|
+
enableKeyboardNav: m = !0,
|
|
2297
|
+
rowShortcuts: h = []
|
|
2298
|
+
}) {
|
|
2299
|
+
const [c, b] = U(null), y = ee(null), v = ee(!1), x = typeof u == "function";
|
|
2300
|
+
Q(() => {
|
|
2301
|
+
const N = (k) => {
|
|
2302
|
+
n.current && (k.target.closest(".floating-row-menu") || k.target.closest(".mobile-form-launcher") || n.current.contains(k.target) || (b(null), a?.(null, null), o?.()));
|
|
2303
|
+
};
|
|
2304
|
+
return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
|
|
2305
|
+
}, [o, a, n]), Q(() => () => clearTimeout(y.current), []), Q(() => {
|
|
2306
|
+
c == null || e.some((k, f) => t(k, f) === c) || (b(null), a?.(null, null), o?.());
|
|
2307
|
+
}, [t, o, a, c, e]);
|
|
2308
|
+
const S = W(
|
|
2309
|
+
(N) => {
|
|
2310
|
+
if (N == null) return -1;
|
|
2311
|
+
for (let k = 0; k < e.length; k += 1)
|
|
2312
|
+
if (t(e[k], k) === N) return k;
|
|
2313
|
+
return -1;
|
|
2314
|
+
},
|
|
2315
|
+
[t, e]
|
|
2316
|
+
), g = W(
|
|
2317
|
+
(N) => {
|
|
2318
|
+
if (!e.length) return;
|
|
2319
|
+
const k = Math.max(0, Math.min(N, e.length - 1)), f = e[k], p = t(f, k);
|
|
2320
|
+
b(p), a?.(f, p), r?.(f);
|
|
2321
|
+
},
|
|
2322
|
+
[t, r, a, e]
|
|
2323
|
+
);
|
|
2324
|
+
return Q(() => {
|
|
2325
|
+
if (!m) return;
|
|
2326
|
+
const N = (k) => {
|
|
2327
|
+
if (Lt(k.target)) return;
|
|
2328
|
+
if (k.key === "ArrowDown") {
|
|
2329
|
+
if (!e.length) return;
|
|
2330
|
+
if (k.preventDefault(), c == null) {
|
|
2331
|
+
g(0);
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
const w = S(c);
|
|
2335
|
+
g(w < 0 ? 0 : w + 1);
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
if (k.key === "ArrowUp") {
|
|
2339
|
+
if (!e.length) return;
|
|
2340
|
+
if (k.preventDefault(), c == null) {
|
|
2341
|
+
g(e.length - 1);
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
const w = S(c);
|
|
2345
|
+
g(w < 0 ? e.length - 1 : w - 1);
|
|
2346
|
+
return;
|
|
2347
|
+
}
|
|
2348
|
+
if (k.key === "Enter") {
|
|
2349
|
+
if (!x || c == null) return;
|
|
2350
|
+
k.preventDefault();
|
|
2351
|
+
const w = S(c), C = e[w];
|
|
2352
|
+
if (!C) return;
|
|
2353
|
+
u(C, k);
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (c == null || !Array.isArray(h) || h.length === 0)
|
|
2357
|
+
return;
|
|
2358
|
+
const f = S(c), p = e[f];
|
|
2359
|
+
if (!p) return;
|
|
2360
|
+
const E = h.find((w) => w?.enabled === !1 ? !1 : It(k, w));
|
|
2361
|
+
E && (E.preventDefault !== !1 && k.preventDefault(), E.stopPropagation && k.stopPropagation(), E.onTrigger?.(p, k));
|
|
2362
|
+
};
|
|
2363
|
+
return window.addEventListener("keydown", N), () => window.removeEventListener("keydown", N);
|
|
2364
|
+
}, [
|
|
2365
|
+
m,
|
|
2366
|
+
x,
|
|
2367
|
+
S,
|
|
2368
|
+
u,
|
|
2369
|
+
h,
|
|
2370
|
+
g,
|
|
2371
|
+
c,
|
|
2372
|
+
e
|
|
2373
|
+
]), {
|
|
2374
|
+
selectedKey: c,
|
|
2375
|
+
getRowHandlers: (N, k) => {
|
|
2376
|
+
const f = c === k;
|
|
2377
|
+
return {
|
|
2378
|
+
isSelected: f,
|
|
2379
|
+
onClick: (p) => {
|
|
2380
|
+
if (v.current) {
|
|
2381
|
+
v.current = !1;
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
if (f) {
|
|
2385
|
+
if (!x) {
|
|
2386
|
+
s?.(N, p);
|
|
2387
|
+
return;
|
|
2388
|
+
}
|
|
2389
|
+
clearTimeout(y.current);
|
|
2390
|
+
const E = { clientX: p.clientX, clientY: p.clientY };
|
|
2391
|
+
y.current = setTimeout(() => {
|
|
2392
|
+
s?.(N, E);
|
|
2393
|
+
}, 200);
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
b(k), a?.(N, k), r?.(N, p);
|
|
2397
|
+
},
|
|
2398
|
+
onDoubleClick: (p) => {
|
|
2399
|
+
p.preventDefault(), p.stopPropagation(), clearTimeout(y.current), v.current = !0, u?.(N, p);
|
|
2400
|
+
},
|
|
2401
|
+
onContextMenu: (p) => {
|
|
2402
|
+
p.preventDefault(), d && !f && (b(k), a?.(N, k)), i?.(N, p);
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
function Kn({
|
|
2409
|
+
data: e = [],
|
|
2410
|
+
columns: t = [],
|
|
2411
|
+
initialSort: n = {
|
|
2412
|
+
key: null,
|
|
2413
|
+
direction: "asc"
|
|
2414
|
+
},
|
|
2415
|
+
getRowKey: r = (p, E) => E,
|
|
2416
|
+
striped: s = !0,
|
|
2417
|
+
className: o = "",
|
|
2418
|
+
conditionalRowClassName: a,
|
|
2419
|
+
onRowClick: i,
|
|
2420
|
+
onSelectedClick: u,
|
|
2421
|
+
onDeselect: d,
|
|
2422
|
+
onSelectionChange: m,
|
|
2423
|
+
onRowRightClick: h,
|
|
2424
|
+
selectOnRightClick: c = !0,
|
|
2425
|
+
onEnterRow: b,
|
|
2426
|
+
enableKeyboardNav: y = !0,
|
|
2427
|
+
hasActiveSearch: v = !1,
|
|
2428
|
+
isLoading: x = !1,
|
|
2429
|
+
sourceDataCount: S = null,
|
|
2430
|
+
rowShortcuts: g = [],
|
|
2431
|
+
sortAscIcon: T,
|
|
2432
|
+
sortDescIcon: N,
|
|
2433
|
+
emptyState: k = null,
|
|
2434
|
+
noResultsState: f = null
|
|
2435
|
+
}) {
|
|
2436
|
+
const p = ee(null), { sortConfig: E, requestSort: w, sortedData: C } = Wn({
|
|
2437
|
+
data: e,
|
|
2438
|
+
columns: t,
|
|
2439
|
+
initialSort: n
|
|
2440
|
+
}), { getRowHandlers: G } = Qn({
|
|
2441
|
+
sortedData: C,
|
|
2442
|
+
getRowKey: r,
|
|
2443
|
+
tableRef: p,
|
|
2444
|
+
onRowClick: i,
|
|
2445
|
+
onSelectedClick: u,
|
|
2446
|
+
onDeselect: d,
|
|
2447
|
+
onSelectionChange: m,
|
|
2448
|
+
onRowRightClick: h,
|
|
2449
|
+
onEnterRow: b,
|
|
2450
|
+
selectOnRightClick: c,
|
|
2451
|
+
enableKeyboardNav: y,
|
|
2452
|
+
rowShortcuts: g
|
|
2453
|
+
}), F = typeof S == "number" ? S > 0 : null, P = !x && !e.length, M = P && (F === !0 || !!v), K = P && !M, D = !!(i || u), R = {
|
|
2454
|
+
className: o,
|
|
2455
|
+
columns: t,
|
|
2456
|
+
data: e,
|
|
2457
|
+
hasActiveSearch: v,
|
|
2458
|
+
sourceDataCount: S
|
|
2459
|
+
}, O = (L) => typeof L == "function" ? L(R) : L;
|
|
2460
|
+
return /* @__PURE__ */ l("div", { className: `full-w table-shell ${o}`.trim(), ref: p, children: x ? null : M ? O(f) : K ? O(k) : /* @__PURE__ */ l("div", { className: "table-scroll full-w", children: /* @__PURE__ */ V("table", { className: "table", children: [
|
|
2461
|
+
/* @__PURE__ */ l(
|
|
2462
|
+
Yn,
|
|
2463
|
+
{
|
|
2464
|
+
columns: t,
|
|
2465
|
+
sortConfig: E,
|
|
2466
|
+
requestSort: w,
|
|
2467
|
+
sortAscIcon: T,
|
|
2468
|
+
sortDescIcon: N
|
|
2469
|
+
}
|
|
2470
|
+
),
|
|
2471
|
+
/* @__PURE__ */ l(
|
|
2472
|
+
jn,
|
|
2473
|
+
{
|
|
2474
|
+
sortedData: C,
|
|
2475
|
+
columns: t,
|
|
2476
|
+
getRowKey: r,
|
|
2477
|
+
striped: s,
|
|
2478
|
+
conditionalRowClassName: a,
|
|
2479
|
+
getRowHandlers: G,
|
|
2480
|
+
hasInteractiveRows: D
|
|
2481
|
+
}
|
|
2482
|
+
)
|
|
2483
|
+
] }) }) });
|
|
2484
|
+
}
|
|
2485
|
+
function ot(e, t = 300) {
|
|
2486
|
+
const [n, r] = U(e);
|
|
2487
|
+
return Q(() => {
|
|
2488
|
+
const s = setTimeout(() => r(e), t);
|
|
2489
|
+
return () => clearTimeout(s);
|
|
2490
|
+
}, [e, t]), n;
|
|
2491
|
+
}
|
|
2492
|
+
const ke = "default", vt = "global", xt = Ve(null);
|
|
2493
|
+
function Se(e = "", t = e) {
|
|
2494
|
+
return { query: e, debouncedQuery: t };
|
|
2495
|
+
}
|
|
2496
|
+
function Qr({ children: e, resetKey: t }) {
|
|
2497
|
+
const [n, r] = U({});
|
|
2498
|
+
Q(() => {
|
|
2499
|
+
r({});
|
|
2500
|
+
}, [t]);
|
|
2501
|
+
const s = W((u = ke, d) => {
|
|
2502
|
+
r((m) => {
|
|
2503
|
+
const h = m[u] ?? Se();
|
|
2504
|
+
return h.query === d ? m : {
|
|
2505
|
+
...m,
|
|
2506
|
+
[u]: {
|
|
2507
|
+
...h,
|
|
2508
|
+
query: d
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
});
|
|
2512
|
+
}, []), o = W((u = ke, d) => {
|
|
2513
|
+
r((m) => {
|
|
2514
|
+
const h = m[u] ?? Se();
|
|
2515
|
+
return h.debouncedQuery === d ? m : {
|
|
2516
|
+
...m,
|
|
2517
|
+
[u]: {
|
|
2518
|
+
...h,
|
|
2519
|
+
debouncedQuery: d
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
});
|
|
2523
|
+
}, []), a = W((u = ke) => {
|
|
2524
|
+
r((d) => ({
|
|
2525
|
+
...d,
|
|
2526
|
+
[u]: Se()
|
|
2527
|
+
}));
|
|
2528
|
+
}, []), i = J(
|
|
2529
|
+
() => ({
|
|
2530
|
+
searchByScope: n,
|
|
2531
|
+
setQuery: s,
|
|
2532
|
+
setDebouncedQuery: o,
|
|
2533
|
+
clearQuery: a
|
|
2534
|
+
}),
|
|
2535
|
+
[a, n, o, s]
|
|
2536
|
+
);
|
|
2537
|
+
return /* @__PURE__ */ l(xt.Provider, { value: i, children: e });
|
|
2538
|
+
}
|
|
2539
|
+
function Nt(e = ke, { debounceMs: t = 250 } = {}) {
|
|
2540
|
+
const n = Re(xt), [r, s] = U(""), o = ot(r, t), a = n?.searchByScope?.[e] ?? Se(), i = n ? a.query : r, u = n ? a.debouncedQuery : o, d = ot(i, t);
|
|
2541
|
+
Q(() => {
|
|
2542
|
+
n && n.setDebouncedQuery(e, d);
|
|
2543
|
+
}, [n, d, e]);
|
|
2544
|
+
const m = W(
|
|
2545
|
+
(c) => {
|
|
2546
|
+
if (n) {
|
|
2547
|
+
n.setQuery(e, c);
|
|
2548
|
+
return;
|
|
2549
|
+
}
|
|
2550
|
+
s(c);
|
|
2551
|
+
},
|
|
2552
|
+
[n, e]
|
|
2553
|
+
), h = W(() => {
|
|
2554
|
+
if (n) {
|
|
2555
|
+
n.clearQuery(e);
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
s("");
|
|
2559
|
+
}, [n, e]);
|
|
2560
|
+
return {
|
|
2561
|
+
query: i,
|
|
2562
|
+
debouncedQuery: u,
|
|
2563
|
+
setQuery: m,
|
|
2564
|
+
clearQuery: h
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2567
|
+
function Un({ text: e, onClick: t, className: n, ariaLabel: r }) {
|
|
2568
|
+
return /* @__PURE__ */ l("button", { type: "button", className: n, onClick: t, "aria-label": r, children: e });
|
|
2569
|
+
}
|
|
2570
|
+
function Jn({
|
|
2571
|
+
options: e = [],
|
|
2572
|
+
selectedOption: t,
|
|
2573
|
+
onChangeOption: n,
|
|
2574
|
+
setData: r,
|
|
2575
|
+
onQueryChange: s,
|
|
2576
|
+
initialQuery: o = "",
|
|
2577
|
+
filters: a = !0,
|
|
2578
|
+
addButton: i = !0,
|
|
2579
|
+
buttonName: u = "common.actions.add",
|
|
2580
|
+
enableCtrlF: d = !1,
|
|
2581
|
+
translate: m,
|
|
2582
|
+
isMobile: h = !1,
|
|
2583
|
+
onAdd: c,
|
|
2584
|
+
searchIcon: b = null,
|
|
2585
|
+
renderActionButton: y = Un,
|
|
2586
|
+
searchScope: v
|
|
2587
|
+
}) {
|
|
2588
|
+
const { t: x } = oe(), S = ee(null), g = m ?? x, T = J(() => e.find((L) => L.value === t) ?? e[0] ?? null, [e, t]), N = T?.value ?? "", k = T?.data ?? [], f = v ?? N, { query: p, debouncedQuery: E, setQuery: w } = Nt(f), C = J(() => T ? T.searchKeys?.length ? T.searchKeys : ["name", "label"] : ["name", "label"], [T]), G = W(
|
|
2589
|
+
(O, L) => {
|
|
2590
|
+
if (!L) return !0;
|
|
2591
|
+
const I = L.toLowerCase();
|
|
2592
|
+
for (const z of C) {
|
|
2593
|
+
const $ = O?.[z];
|
|
2594
|
+
if ($ != null && String($).toLowerCase().includes(I)) return !0;
|
|
2595
|
+
}
|
|
2596
|
+
for (const z of Object.values(O || {}))
|
|
2597
|
+
if (typeof z == "string" && z.toLowerCase().includes(I)) return !0;
|
|
2598
|
+
return !1;
|
|
2599
|
+
},
|
|
2600
|
+
[C]
|
|
2601
|
+
), F = ee({ key: "", query: "", length: -1 }), P = W(
|
|
2602
|
+
(O) => {
|
|
2603
|
+
if (!T || typeof r != "function") return;
|
|
2604
|
+
const L = (O ?? "").trim(), I = Array.isArray(k) ? k : [], z = L ? I.filter((Y) => G(Y, L)) : I, $ = { key: N, query: L, length: z.length }, A = F.current;
|
|
2605
|
+
A.key === $.key && A.query === $.query && A.length === $.length || (F.current = $, r(z));
|
|
2606
|
+
},
|
|
2607
|
+
[T, k, N, G, r]
|
|
2608
|
+
), M = W(() => {
|
|
2609
|
+
typeof c == "function" && c(T);
|
|
2610
|
+
}, [T, c]);
|
|
2611
|
+
Q(() => {
|
|
2612
|
+
o && w(o);
|
|
2613
|
+
}, [o, w]), Q(() => {
|
|
2614
|
+
if (!T || typeof r != "function" || p.trim() !== "") return;
|
|
2615
|
+
const O = Array.isArray(k) ? k : [], L = { key: N, query: "", length: O.length }, I = F.current;
|
|
2616
|
+
I.key === L.key && I.query === L.query && I.length === L.length || (F.current = L, r(O));
|
|
2617
|
+
}, [p, T, k, N, r]), Q(() => {
|
|
2618
|
+
P(E);
|
|
2619
|
+
}, [E, N, P]), Q(() => {
|
|
2620
|
+
s?.(p);
|
|
2621
|
+
}, [p, s]), Q(() => {
|
|
2622
|
+
if (!d) return;
|
|
2623
|
+
const O = (L) => {
|
|
2624
|
+
const I = L.target, z = I?.tagName?.toLowerCase(), $ = z === "input" || z === "textarea" || z === "select" || I?.isContentEditable;
|
|
2625
|
+
if ((L.ctrlKey || L.metaKey) && L.key.toLowerCase() === "f") {
|
|
2626
|
+
L.preventDefault(), S.current?.focus(), S.current?.select();
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
!$ && L.key.toLowerCase() === "n" && (L.preventDefault(), M());
|
|
2630
|
+
};
|
|
2631
|
+
return window.addEventListener("keydown", O), () => window.removeEventListener("keydown", O);
|
|
2632
|
+
}, [d, M]);
|
|
2633
|
+
const K = g("common.shortcuts.add"), D = g("common.shortcuts.filters"), R = T?.addFormName && i ? y({
|
|
2634
|
+
variant: "primary",
|
|
2635
|
+
text: g(u),
|
|
2636
|
+
iconName: "actionAdd",
|
|
2637
|
+
alt: g("common.messages.addIconAlt"),
|
|
2638
|
+
onClick: M,
|
|
2639
|
+
ariaLabel: g(u),
|
|
2640
|
+
tooltipDirection: "left",
|
|
2641
|
+
tooltipText: g("common.shortcuts.tooltip", {
|
|
2642
|
+
label: g(u),
|
|
2643
|
+
shortcut: K
|
|
2644
|
+
}),
|
|
2645
|
+
className: h ? "full-w" : "searchbar-add"
|
|
2646
|
+
}) : null;
|
|
2647
|
+
return h ? /* @__PURE__ */ V("div", { className: "full-w flex column gap5", children: [
|
|
2648
|
+
/* @__PURE__ */ l(
|
|
2649
|
+
rt,
|
|
2650
|
+
{
|
|
2651
|
+
variant: "full",
|
|
2652
|
+
value: p,
|
|
2653
|
+
placeholder: g("common.actions.search"),
|
|
2654
|
+
searchButtonLabel: g("common.actions.search"),
|
|
2655
|
+
searchIcon: b,
|
|
2656
|
+
onValueChange: w,
|
|
2657
|
+
onSearch: P,
|
|
2658
|
+
inputRef: S
|
|
2659
|
+
}
|
|
2660
|
+
),
|
|
2661
|
+
R
|
|
2662
|
+
] }) : /* @__PURE__ */ V("div", { className: "searchbar-container flex row gap10", children: [
|
|
2663
|
+
e.length > 1 && /* @__PURE__ */ l(
|
|
2664
|
+
Pe,
|
|
2665
|
+
{
|
|
2666
|
+
value: T?.value || "",
|
|
2667
|
+
onChange: (O) => n?.(O),
|
|
2668
|
+
options: e.map(({ value: O, label: L }) => ({ value: O, label: L })),
|
|
2669
|
+
placeholder: g("common.messages.selectDataset"),
|
|
2670
|
+
requiredLabel: g("forms.shared.required"),
|
|
2671
|
+
selectOptionLabel: g("forms.shared.selectOption"),
|
|
2672
|
+
className: "searchbar-select"
|
|
2673
|
+
}
|
|
2674
|
+
),
|
|
2675
|
+
/* @__PURE__ */ l(
|
|
2676
|
+
rt,
|
|
2677
|
+
{
|
|
2678
|
+
variant: "full",
|
|
2679
|
+
value: p,
|
|
2680
|
+
placeholder: g("common.actions.search"),
|
|
2681
|
+
searchButtonLabel: g("common.actions.search"),
|
|
2682
|
+
searchIcon: b,
|
|
2683
|
+
onValueChange: w,
|
|
2684
|
+
onSearch: P,
|
|
2685
|
+
inputRef: S
|
|
2686
|
+
}
|
|
2687
|
+
),
|
|
2688
|
+
a ? y({
|
|
2689
|
+
text: g("common.actions.filters"),
|
|
2690
|
+
iconName: "actionFilter",
|
|
2691
|
+
alt: g("common.messages.filterIconAlt"),
|
|
2692
|
+
ariaLabel: g("common.actions.filters"),
|
|
2693
|
+
tooltipDirection: "left",
|
|
2694
|
+
tooltipText: g("common.shortcuts.tooltip", {
|
|
2695
|
+
label: g("common.actions.filters"),
|
|
2696
|
+
shortcut: D
|
|
2697
|
+
}),
|
|
2698
|
+
className: "searchbar-filter"
|
|
2699
|
+
}) : null
|
|
2700
|
+
] });
|
|
2701
|
+
}
|
|
2702
|
+
function Zn({ x: e, y: t, row: n, actions: r = [], onClose: s }) {
|
|
2703
|
+
if (!n) return null;
|
|
2704
|
+
const o = (u) => {
|
|
2705
|
+
u.stopPropagation();
|
|
2706
|
+
}, a = e > window.innerWidth / 2 ? "100%" : "0%", i = t > window.innerHeight / 2 ? "100%" : "0%";
|
|
2707
|
+
return /* @__PURE__ */ l("div", { className: "floating-row-menu", onClick: o, style: {
|
|
2708
|
+
position: "fixed",
|
|
2709
|
+
top: t + 4,
|
|
2710
|
+
left: e + 4,
|
|
2711
|
+
"--origin-x": a,
|
|
2712
|
+
"--origin-y": i
|
|
2713
|
+
}, children: /* @__PURE__ */ l("div", { className: "floating-row-menu-card", children: r.map(({
|
|
2714
|
+
label: u,
|
|
2715
|
+
icon: d,
|
|
2716
|
+
iconName: m,
|
|
2717
|
+
renderIcon: h,
|
|
2718
|
+
onClick: c,
|
|
2719
|
+
color: b,
|
|
2720
|
+
shortcut: y,
|
|
2721
|
+
disabled: v
|
|
2722
|
+
}, x) => {
|
|
2723
|
+
const S = typeof u == "function" ? u(n) : u, g = typeof v == "function" ? v(n) : !!v;
|
|
2724
|
+
return S ? /* @__PURE__ */ V("button", { type: "button", className: `menu-item ${b || ""}`, disabled: g, onClick: () => {
|
|
2725
|
+
g || (c?.(n), s?.());
|
|
2726
|
+
}, children: [
|
|
2727
|
+
/* @__PURE__ */ l(_, { as: "p", className: "full-w", children: S }),
|
|
2728
|
+
typeof h == "function" ? h({ icon: d, iconName: m, row: n }) : null,
|
|
2729
|
+
!h && d ? /* @__PURE__ */ l(ue, { src: d, decorative: !0 }) : null,
|
|
2730
|
+
y && /* @__PURE__ */ l("div", { className: "shortcut", children: /* @__PURE__ */ l(_, { as: "p", children: y }) })
|
|
2731
|
+
] }, S || x) : null;
|
|
2732
|
+
}) }) });
|
|
2733
|
+
}
|
|
2734
|
+
function er({ text: e, onClick: t, className: n, ariaLabel: r }) {
|
|
2735
|
+
return /* @__PURE__ */ l("button", { type: "button", className: n, onClick: t, "aria-label": r, children: e });
|
|
2736
|
+
}
|
|
2737
|
+
function tr({
|
|
2738
|
+
id: e,
|
|
2739
|
+
table_name: t = null,
|
|
2740
|
+
addFormName: n,
|
|
2741
|
+
searchKeys: r,
|
|
2742
|
+
columns: s,
|
|
2743
|
+
initialData: o = [],
|
|
2744
|
+
isLoading: a = !1,
|
|
2745
|
+
buttonName: i = "common.actions.add",
|
|
2746
|
+
onRowClick: u,
|
|
2747
|
+
onRowRightClick: d,
|
|
2748
|
+
onSelectedClick: m,
|
|
2749
|
+
onDeselect: h,
|
|
2750
|
+
onSelectionChange: c,
|
|
2751
|
+
onEnterRow: b,
|
|
2752
|
+
rowShortcuts: y = [],
|
|
2753
|
+
includeHeader: v = !0,
|
|
2754
|
+
emptyState: x,
|
|
2755
|
+
noResultsState: S,
|
|
2756
|
+
conditionalRowClassName: g,
|
|
2757
|
+
translate: T,
|
|
2758
|
+
renderActionButton: N = er,
|
|
2759
|
+
searchIcon: k = null,
|
|
2760
|
+
searchScope: f,
|
|
2761
|
+
includePageSearchbar: p = !1,
|
|
2762
|
+
useGlobalSearch: E = !1
|
|
2763
|
+
}) {
|
|
2764
|
+
const { t: w } = oe(), { openForm: C } = qe(), { isMobile: G } = ct(), F = T ?? w, P = E ? vt : f ?? e, { debouncedQuery: M } = Nt(P), K = v && !p && !E, D = M ?? "", R = [
|
|
2765
|
+
{
|
|
2766
|
+
value: e,
|
|
2767
|
+
label: F(t),
|
|
2768
|
+
data: o || [],
|
|
2769
|
+
addFormName: n,
|
|
2770
|
+
searchKeys: r
|
|
2771
|
+
}
|
|
2772
|
+
], O = () => {
|
|
2773
|
+
n && C(n, "add");
|
|
2774
|
+
}, L = F("common.shortcuts.add"), I = J(() => r?.length ? r : ["name", "label"], [r]), z = J(() => {
|
|
2775
|
+
const $ = Array.isArray(o) ? o : [], A = D.trim().toLowerCase();
|
|
2776
|
+
return A ? $.filter((Y) => {
|
|
2777
|
+
for (const X of I) {
|
|
2778
|
+
const ne = Y?.[X];
|
|
2779
|
+
if (ne != null && String(ne).toLowerCase().includes(A)) return !0;
|
|
2780
|
+
}
|
|
2781
|
+
for (const X of Object.values(Y || {}))
|
|
2782
|
+
if (typeof X == "string" && X.toLowerCase().includes(A)) return !0;
|
|
2783
|
+
return !1;
|
|
2784
|
+
}) : $;
|
|
2785
|
+
}, [o, I, D]);
|
|
2786
|
+
return /* @__PURE__ */ V("div", { className: "full-view flex column-left gap10 table-crud", children: [
|
|
2787
|
+
K && /* @__PURE__ */ l(
|
|
2788
|
+
Jn,
|
|
2789
|
+
{
|
|
2790
|
+
options: R,
|
|
2791
|
+
buttonName: i,
|
|
2792
|
+
enableCtrlF: !0,
|
|
2793
|
+
filters: !1,
|
|
2794
|
+
isMobile: G,
|
|
2795
|
+
onAdd: O,
|
|
2796
|
+
searchIcon: k,
|
|
2797
|
+
renderActionButton: N,
|
|
2798
|
+
searchScope: P
|
|
2799
|
+
}
|
|
2800
|
+
),
|
|
2801
|
+
/* @__PURE__ */ V("div", { className: "page-content column-left full-view gap20", children: [
|
|
2802
|
+
v && !G && /* @__PURE__ */ V("div", { className: "flex row full-w", children: [
|
|
2803
|
+
t && /* @__PURE__ */ l(_, { size: "xl", children: F(t) }),
|
|
2804
|
+
/* @__PURE__ */ l("div", { className: "full-w row-right", children: n ? N({
|
|
2805
|
+
variant: "primary",
|
|
2806
|
+
text: F(i),
|
|
2807
|
+
iconName: "actionAdd",
|
|
2808
|
+
alt: F("common.messages.addIconAlt"),
|
|
2809
|
+
onClick: O,
|
|
2810
|
+
ariaLabel: F(i),
|
|
2811
|
+
tooltipDirection: "left",
|
|
2812
|
+
tooltipText: F("common.shortcuts.tooltip", {
|
|
2813
|
+
label: F(i),
|
|
2814
|
+
shortcut: L
|
|
2815
|
+
}),
|
|
2816
|
+
className: "searchbar-add"
|
|
2817
|
+
}) : null })
|
|
2818
|
+
] }),
|
|
2819
|
+
/* @__PURE__ */ l(
|
|
2820
|
+
Kn,
|
|
2821
|
+
{
|
|
2822
|
+
data: z,
|
|
2823
|
+
columns: s.filter(Boolean),
|
|
2824
|
+
isLoading: a,
|
|
2825
|
+
onRowClick: u,
|
|
2826
|
+
onRowRightClick: d,
|
|
2827
|
+
onSelectedClick: m,
|
|
2828
|
+
onDeselect: h,
|
|
2829
|
+
onSelectionChange: c,
|
|
2830
|
+
conditionalRowClassName: g,
|
|
2831
|
+
onEnterRow: b,
|
|
2832
|
+
hasActiveSearch: !!D.trim(),
|
|
2833
|
+
sourceDataCount: Array.isArray(o) ? o.length : 0,
|
|
2834
|
+
rowShortcuts: y,
|
|
2835
|
+
emptyState: x,
|
|
2836
|
+
noResultsState: S
|
|
2837
|
+
}
|
|
2838
|
+
)
|
|
2839
|
+
] })
|
|
2840
|
+
] });
|
|
2841
|
+
}
|
|
2842
|
+
const $e = (e) => e != null && Object.prototype.hasOwnProperty.call(e, "archived") && !!e?.archived;
|
|
2843
|
+
function nr({
|
|
2844
|
+
id: e,
|
|
2845
|
+
table_name: t,
|
|
2846
|
+
addFormName: n,
|
|
2847
|
+
optionsFormName: r,
|
|
2848
|
+
searchKeys: s,
|
|
2849
|
+
columns: o,
|
|
2850
|
+
initialData: a = [],
|
|
2851
|
+
isLoading: i = !1,
|
|
2852
|
+
buttonName: u = "common.actions.add",
|
|
2853
|
+
mainAction: d,
|
|
2854
|
+
desktopMenuActions: m = [],
|
|
2855
|
+
onEditRow: h,
|
|
2856
|
+
onToggleArchiveRow: c,
|
|
2857
|
+
onDeleteRow: b,
|
|
2858
|
+
allowArchive: y = !0,
|
|
2859
|
+
allowDelete: v = !0,
|
|
2860
|
+
openMobileMenu: x,
|
|
2861
|
+
conditionalRowClassName: S,
|
|
2862
|
+
rowShortcuts: g = [],
|
|
2863
|
+
fillAvailableHeight: T = !1,
|
|
2864
|
+
includeHeader: N = !0,
|
|
2865
|
+
translate: k,
|
|
2866
|
+
createActionsPayload: f = (K, D) => ({ row: K, actions: D }),
|
|
2867
|
+
TableCRUDComponent: p = tr,
|
|
2868
|
+
renderActionButton: E,
|
|
2869
|
+
searchIcon: w = null,
|
|
2870
|
+
emptyState: C,
|
|
2871
|
+
noResultsState: G,
|
|
2872
|
+
searchScope: F,
|
|
2873
|
+
includePageSearchbar: P = !1,
|
|
2874
|
+
useGlobalSearch: M = !1
|
|
2875
|
+
}) {
|
|
2876
|
+
const { t: K } = oe(), { isMobile: D } = ct(), { openConfirm: R } = wt(), { openFormLauncher: O, setFormLauncher: L } = it(), I = k ?? K, [z, $] = U({
|
|
2877
|
+
visible: !1,
|
|
2878
|
+
x: 0,
|
|
2879
|
+
y: 0,
|
|
2880
|
+
row: null
|
|
2881
|
+
}), A = () => $({ visible: !1, x: 0, y: 0, row: null }), Y = W(
|
|
2882
|
+
(H) => {
|
|
2883
|
+
if (!y || typeof c != "function") return;
|
|
2884
|
+
const B = $e(H);
|
|
2885
|
+
if (!v) {
|
|
2886
|
+
R?.({
|
|
2887
|
+
title: I("common.messages.confirm.title"),
|
|
2888
|
+
message: I(B ? "common.messages.confirm.unarchiveItem" : "common.messages.confirm.archiveItem"),
|
|
2889
|
+
confirmText: I(B ? "common.actions.unarchive" : "common.actions.archive"),
|
|
2890
|
+
cancelText: I("common.actions.cancel"),
|
|
2891
|
+
danger: !1,
|
|
2892
|
+
onConfirm: () => c(H)
|
|
2893
|
+
});
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
2896
|
+
c(H);
|
|
2897
|
+
},
|
|
2898
|
+
[y, v, c, R, I]
|
|
2899
|
+
), X = W(
|
|
2900
|
+
(H) => {
|
|
2901
|
+
!v || typeof b != "function" || R?.({
|
|
2902
|
+
title: I("common.messages.confirm.title"),
|
|
2903
|
+
message: I("common.messages.confirm.deleteItem"),
|
|
2904
|
+
confirmText: I("common.actions.delete"),
|
|
2905
|
+
cancelText: I("common.actions.cancel"),
|
|
2906
|
+
danger: !0,
|
|
2907
|
+
onConfirm: () => b(H)
|
|
2908
|
+
});
|
|
2909
|
+
},
|
|
2910
|
+
[v, b, R, I]
|
|
2911
|
+
), ne = J(() => {
|
|
2912
|
+
const H = [];
|
|
2913
|
+
return typeof h == "function" && H.push({
|
|
2914
|
+
label: I("common.actions.edit"),
|
|
2915
|
+
onClick: h,
|
|
2916
|
+
shortcut: "E"
|
|
2917
|
+
}), y && typeof c == "function" && H.push({
|
|
2918
|
+
label: (Z) => $e(Z) ? I("common.actions.unarchive") : I("common.actions.archive"),
|
|
2919
|
+
onClick: Y,
|
|
2920
|
+
shortcut: "T"
|
|
2921
|
+
}), v && typeof b == "function" && H.push({
|
|
2922
|
+
label: I("common.actions.delete"),
|
|
2923
|
+
onClick: X,
|
|
2924
|
+
shortcut: "Del"
|
|
2925
|
+
}), H;
|
|
2926
|
+
}, [
|
|
2927
|
+
y,
|
|
2928
|
+
v,
|
|
2929
|
+
b,
|
|
2930
|
+
h,
|
|
2931
|
+
c,
|
|
2932
|
+
Y,
|
|
2933
|
+
X,
|
|
2934
|
+
I
|
|
2935
|
+
]), se = J(
|
|
2936
|
+
() => [...m, ...ne],
|
|
2937
|
+
[m, ne]
|
|
2938
|
+
), ae = J(() => {
|
|
2939
|
+
const H = [];
|
|
2940
|
+
return typeof h == "function" && H.push({ keys: "e", onTrigger: h }), y && typeof c == "function" && H.push({ keys: "t", onTrigger: Y }), v && typeof b == "function" && H.push({ keys: ["delete", "backspace"], onTrigger: X }), H;
|
|
2941
|
+
}, [
|
|
2942
|
+
y,
|
|
2943
|
+
v,
|
|
2944
|
+
b,
|
|
2945
|
+
h,
|
|
2946
|
+
c,
|
|
2947
|
+
Y,
|
|
2948
|
+
X
|
|
2949
|
+
]), ge = J(
|
|
2950
|
+
() => g.length > 0 ? g : ae,
|
|
2951
|
+
[g, ae]
|
|
2952
|
+
), He = J(() => (H, Z) => {
|
|
2953
|
+
const B = typeof S == "function" && S(H, Z) || "", j = $e(H) ? "row-archived" : "";
|
|
2954
|
+
return [B, j].filter(Boolean).join(" ");
|
|
2955
|
+
}, [S]);
|
|
2956
|
+
Q(() => {
|
|
2957
|
+
A();
|
|
2958
|
+
}, [a]);
|
|
2959
|
+
const ie = J(() => n ? Xe({
|
|
2960
|
+
group: n,
|
|
2961
|
+
action: "add",
|
|
2962
|
+
iconName: "actionAddFill",
|
|
2963
|
+
labelKey: u
|
|
2964
|
+
}) : null, [n, u]), de = W(
|
|
2965
|
+
(H) => !H || !r || se.length === 0 ? ie : Xe({
|
|
2966
|
+
group: r,
|
|
2967
|
+
action: "options",
|
|
2968
|
+
payload: f(H, se),
|
|
2969
|
+
iconName: "actionMenuFill",
|
|
2970
|
+
labelKey: "common.actions.menu",
|
|
2971
|
+
variant: "options"
|
|
2972
|
+
}),
|
|
2973
|
+
[f, ie, r, se]
|
|
2974
|
+
);
|
|
2975
|
+
Q(() => {
|
|
2976
|
+
L(ie);
|
|
2977
|
+
}, [ie, L]);
|
|
2978
|
+
const Ae = () => {
|
|
2979
|
+
z.visible && A();
|
|
2980
|
+
}, fe = (H, Z) => {
|
|
2981
|
+
if (z.visible && z.row?.id === H?.id) {
|
|
2982
|
+
A();
|
|
2983
|
+
return;
|
|
2984
|
+
}
|
|
2985
|
+
if (z.visible && A(), D) {
|
|
2986
|
+
d?.(H, Z);
|
|
2987
|
+
return;
|
|
2988
|
+
}
|
|
2989
|
+
if (!se.length) return;
|
|
2990
|
+
const j = Math.min(Z.clientX, window.innerWidth - 240), re = Math.min(Z.clientY, window.innerHeight - 200);
|
|
2991
|
+
$({ visible: !0, x: j, y: re, row: H });
|
|
2992
|
+
}, le = (H, Z) => {
|
|
2993
|
+
if (Z.preventDefault(), z.visible && A(), D) {
|
|
2994
|
+
const re = de(H);
|
|
2995
|
+
if (re?.type === "options") {
|
|
2996
|
+
O(re);
|
|
2997
|
+
return;
|
|
2998
|
+
}
|
|
2999
|
+
x?.(H, Z);
|
|
3000
|
+
return;
|
|
3001
|
+
}
|
|
3002
|
+
if (!se.length) return;
|
|
3003
|
+
const B = Math.min(Z.clientX, window.innerWidth - 240), j = Math.min(Z.clientY, window.innerHeight - 200);
|
|
3004
|
+
$({ visible: !0, x: B, y: j, row: H });
|
|
3005
|
+
}, ye = (H, Z) => {
|
|
3006
|
+
z.visible && A(), d?.(H, Z);
|
|
3007
|
+
}, Ge = W(
|
|
3008
|
+
(H) => {
|
|
3009
|
+
L(de(H));
|
|
3010
|
+
},
|
|
3011
|
+
[de, L]
|
|
3012
|
+
);
|
|
3013
|
+
return /* @__PURE__ */ V(
|
|
3014
|
+
"div",
|
|
3015
|
+
{
|
|
3016
|
+
className: `full-view column-left responsive-table ${T ? "table-fill-available" : ""}`.trim(),
|
|
3017
|
+
style: { position: "relative" },
|
|
3018
|
+
children: [
|
|
3019
|
+
/* @__PURE__ */ l(
|
|
3020
|
+
p,
|
|
3021
|
+
{
|
|
3022
|
+
id: e,
|
|
3023
|
+
table_name: t,
|
|
3024
|
+
addFormName: n,
|
|
3025
|
+
searchKeys: s,
|
|
3026
|
+
columns: o,
|
|
3027
|
+
initialData: a,
|
|
3028
|
+
isLoading: i,
|
|
3029
|
+
buttonName: u,
|
|
3030
|
+
onRowClick: Ae,
|
|
3031
|
+
onSelectedClick: fe,
|
|
3032
|
+
onDeselect: A,
|
|
3033
|
+
onSelectionChange: Ge,
|
|
3034
|
+
onRowRightClick: le,
|
|
3035
|
+
onEnterRow: ye,
|
|
3036
|
+
rowShortcuts: ge,
|
|
3037
|
+
includeHeader: N,
|
|
3038
|
+
conditionalRowClassName: He,
|
|
3039
|
+
renderActionButton: E,
|
|
3040
|
+
searchIcon: w,
|
|
3041
|
+
emptyState: C,
|
|
3042
|
+
noResultsState: G,
|
|
3043
|
+
searchScope: M ? vt : F ?? e,
|
|
3044
|
+
includePageSearchbar: P || M,
|
|
3045
|
+
useGlobalSearch: M
|
|
3046
|
+
}
|
|
3047
|
+
),
|
|
3048
|
+
!D && z.visible && z.row && se.length > 0 && /* @__PURE__ */ l(
|
|
3049
|
+
Zn,
|
|
3050
|
+
{
|
|
3051
|
+
x: z.x,
|
|
3052
|
+
y: z.y,
|
|
3053
|
+
row: z.row,
|
|
3054
|
+
actions: se,
|
|
3055
|
+
onClose: A
|
|
3056
|
+
}
|
|
3057
|
+
)
|
|
3058
|
+
]
|
|
3059
|
+
}
|
|
3060
|
+
);
|
|
3061
|
+
}
|
|
3062
|
+
const rr = { data: [], isLoading: !1, error: null, refetch: null }, or = { archived: "all" }, sr = (e) => e && typeof e.toJSON == "function" ? e.toJSON() : e, ar = (e) => e, lr = (e) => e?.id, ir = (e) => e ?? null, cr = (e) => !!e;
|
|
3063
|
+
function ur({
|
|
3064
|
+
crud: e,
|
|
3065
|
+
permissionScope: t,
|
|
3066
|
+
formGroupName: n,
|
|
3067
|
+
setFormObject: r,
|
|
3068
|
+
setAdvancedForm: s,
|
|
3069
|
+
staticData: o,
|
|
3070
|
+
listArchivedReq: a = or,
|
|
3071
|
+
normalizeItem: i = sr,
|
|
3072
|
+
transformData: u = ar,
|
|
3073
|
+
getRowId: d = lr,
|
|
3074
|
+
disableMutations: m = !1,
|
|
3075
|
+
resolveFormGroupName: h = ir,
|
|
3076
|
+
hasForm: c = cr
|
|
3077
|
+
}) {
|
|
3078
|
+
const b = !!t?.create, y = !!t?.edit, v = !!t?.archive, x = !!t?.unarchive, S = !!t?.listArchived, g = !!t?.delete, T = Array.isArray(o), N = h(n), k = c(N, "add") ? N : null, f = c(N, "edit") ? N : null, p = c(N, "options") ? N : null, E = J(() => {
|
|
3079
|
+
if (S)
|
|
3080
|
+
return a;
|
|
3081
|
+
}, [S, a]), w = T || !e?.useList ? rr : e.useList(E), { data: C = [], isLoading: G = !1, error: F = null, refetch: P = null } = w, M = e?.useDelete ? e.useDelete() : null, K = e?.useArchive ? e.useArchive() : null, D = e?.useUnarchive ? e.useUnarchive() : null, R = J(() => {
|
|
3082
|
+
const $ = T ? o : C, A = Array.isArray($) ? $.map((Y) => i(Y)) : [];
|
|
3083
|
+
return u(A);
|
|
3084
|
+
}, [T, C, o, i, u]), O = W(
|
|
3085
|
+
($) => {
|
|
3086
|
+
!y || !f || (r?.($), s?.(f, "edit", $));
|
|
3087
|
+
},
|
|
3088
|
+
[y, f, s, r]
|
|
3089
|
+
), L = W(
|
|
3090
|
+
($) => {
|
|
3091
|
+
if (!(!p && !f)) {
|
|
3092
|
+
if (r?.($), p) {
|
|
3093
|
+
s?.(p, "options", $);
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3096
|
+
s?.(f, "edit", $);
|
|
3097
|
+
}
|
|
3098
|
+
},
|
|
3099
|
+
[f, p, s, r]
|
|
3100
|
+
), I = W(
|
|
3101
|
+
($) => {
|
|
3102
|
+
if (m) return;
|
|
3103
|
+
const A = d($);
|
|
3104
|
+
if (A) {
|
|
3105
|
+
if ($?.archived) {
|
|
3106
|
+
if (!x) return;
|
|
3107
|
+
D?.mutate(
|
|
3108
|
+
{ pathParams: { id: A } },
|
|
3109
|
+
{ onSuccess: (Y) => {
|
|
3110
|
+
Oe(Y) || P?.();
|
|
3111
|
+
} }
|
|
3112
|
+
);
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
3115
|
+
v && K?.mutate(
|
|
3116
|
+
{ pathParams: { id: A } },
|
|
3117
|
+
{ onSuccess: (Y) => {
|
|
3118
|
+
Oe(Y) || P?.();
|
|
3119
|
+
} }
|
|
3120
|
+
);
|
|
3121
|
+
}
|
|
3122
|
+
},
|
|
3123
|
+
[
|
|
3124
|
+
K,
|
|
3125
|
+
v,
|
|
3126
|
+
x,
|
|
3127
|
+
m,
|
|
3128
|
+
d,
|
|
3129
|
+
P,
|
|
3130
|
+
D
|
|
3131
|
+
]
|
|
3132
|
+
), z = W(
|
|
3133
|
+
($) => {
|
|
3134
|
+
if (m || !g) return;
|
|
3135
|
+
const A = d($);
|
|
3136
|
+
A && M?.mutate(
|
|
3137
|
+
{ pathParams: { id: A } },
|
|
3138
|
+
{ onSuccess: (Y) => {
|
|
3139
|
+
Oe(Y) || P?.();
|
|
3140
|
+
} }
|
|
3141
|
+
);
|
|
3142
|
+
},
|
|
3143
|
+
[g, M, m, d, P]
|
|
3144
|
+
);
|
|
3145
|
+
return {
|
|
3146
|
+
data: R,
|
|
3147
|
+
isLoading: G,
|
|
3148
|
+
error: F,
|
|
3149
|
+
addFormName: b ? k : null,
|
|
3150
|
+
optionFormName: p,
|
|
3151
|
+
openMobileMenu: L,
|
|
3152
|
+
onEditRow: y ? O : void 0,
|
|
3153
|
+
onToggleArchiveRow: v || x ? I : void 0,
|
|
3154
|
+
onDeleteRow: g ? z : void 0,
|
|
3155
|
+
allowArchive: v || x,
|
|
3156
|
+
allowDelete: g,
|
|
3157
|
+
permissions: {
|
|
3158
|
+
canCreate: b,
|
|
3159
|
+
canEdit: y,
|
|
3160
|
+
canArchive: v,
|
|
3161
|
+
canUnarchive: x,
|
|
3162
|
+
canListArchived: S,
|
|
3163
|
+
canDelete: g
|
|
3164
|
+
}
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
function Kr({
|
|
3168
|
+
id: e,
|
|
3169
|
+
tableName: t,
|
|
3170
|
+
crud: n,
|
|
3171
|
+
permissionScope: r,
|
|
3172
|
+
formGroupName: s,
|
|
3173
|
+
columns: o,
|
|
3174
|
+
searchKeys: a,
|
|
3175
|
+
buttonName: i = "common.actions.add",
|
|
3176
|
+
mainAction: u,
|
|
3177
|
+
desktopMenuActions: d = [],
|
|
3178
|
+
listArchivedReq: m,
|
|
3179
|
+
normalizeItem: h,
|
|
3180
|
+
transformData: c,
|
|
3181
|
+
getRowId: b,
|
|
3182
|
+
staticData: y,
|
|
3183
|
+
disableMutations: v = !1,
|
|
3184
|
+
fillAvailableHeight: x = !1,
|
|
3185
|
+
useGlobalSearch: S = !0,
|
|
3186
|
+
useEntityTableActions: g = ur,
|
|
3187
|
+
ResponsiveTableComponent: T = nr,
|
|
3188
|
+
resolveFormGroupName: N,
|
|
3189
|
+
hasForm: k,
|
|
3190
|
+
addFormName: f,
|
|
3191
|
+
optionsFormName: p,
|
|
3192
|
+
openMobileMenu: E,
|
|
3193
|
+
onEditRow: w,
|
|
3194
|
+
onToggleArchiveRow: C,
|
|
3195
|
+
onDeleteRow: G,
|
|
3196
|
+
allowArchive: F,
|
|
3197
|
+
allowDelete: P,
|
|
3198
|
+
...M
|
|
3199
|
+
}) {
|
|
3200
|
+
const { setAdvancedForm: K, setFormObject: D } = qe();
|
|
3201
|
+
if (typeof g != "function")
|
|
3202
|
+
throw new Error("EntityTable requires a useEntityTableActions hook.");
|
|
3203
|
+
const {
|
|
3204
|
+
data: R,
|
|
3205
|
+
isLoading: O,
|
|
3206
|
+
addFormName: L,
|
|
3207
|
+
optionFormName: I,
|
|
3208
|
+
openMobileMenu: z,
|
|
3209
|
+
onEditRow: $,
|
|
3210
|
+
onToggleArchiveRow: A,
|
|
3211
|
+
onDeleteRow: Y,
|
|
3212
|
+
allowArchive: X,
|
|
3213
|
+
allowDelete: ne
|
|
3214
|
+
} = g({
|
|
3215
|
+
crud: n,
|
|
3216
|
+
permissionScope: r,
|
|
3217
|
+
formGroupName: s,
|
|
3218
|
+
setFormObject: D,
|
|
3219
|
+
setAdvancedForm: K,
|
|
3220
|
+
staticData: y,
|
|
3221
|
+
listArchivedReq: m,
|
|
3222
|
+
normalizeItem: h,
|
|
3223
|
+
transformData: c,
|
|
3224
|
+
getRowId: b,
|
|
3225
|
+
disableMutations: v,
|
|
3226
|
+
resolveFormGroupName: N,
|
|
3227
|
+
hasForm: k
|
|
3228
|
+
});
|
|
3229
|
+
return /* @__PURE__ */ l("div", { className: "full-w column-left", children: /* @__PURE__ */ l(
|
|
3230
|
+
T,
|
|
3231
|
+
{
|
|
3232
|
+
...M,
|
|
3233
|
+
id: e,
|
|
3234
|
+
table_name: t,
|
|
3235
|
+
addFormName: f ?? L,
|
|
3236
|
+
optionsFormName: p ?? I,
|
|
3237
|
+
buttonName: i,
|
|
3238
|
+
searchKeys: a,
|
|
3239
|
+
columns: o,
|
|
3240
|
+
initialData: R,
|
|
3241
|
+
isLoading: O,
|
|
3242
|
+
openMobileMenu: E ?? z,
|
|
3243
|
+
onEditRow: w ?? $,
|
|
3244
|
+
onToggleArchiveRow: C ?? A,
|
|
3245
|
+
onDeleteRow: G ?? Y,
|
|
3246
|
+
allowArchive: F ?? X,
|
|
3247
|
+
allowDelete: P ?? ne,
|
|
3248
|
+
mainAction: u,
|
|
3249
|
+
desktopMenuActions: d,
|
|
3250
|
+
fillAvailableHeight: x,
|
|
3251
|
+
useGlobalSearch: S
|
|
3252
|
+
}
|
|
3253
|
+
) });
|
|
3254
|
+
}
|
|
3255
|
+
function dr(e, t, n) {
|
|
3256
|
+
return t ?? (e.alt != null ? e.alt : e.altKey && n ? n(e.altKey) : e.altKey ?? "");
|
|
3257
|
+
}
|
|
3258
|
+
function Ur(e, t) {
|
|
3259
|
+
return function({ name: r, size: s, variant: o, alt: a, decorative: i = !1, translateAlt: u, ...d }) {
|
|
3260
|
+
const m = e[r];
|
|
3261
|
+
return m ? /* @__PURE__ */ l(
|
|
3262
|
+
ue,
|
|
3263
|
+
{
|
|
3264
|
+
src: m.src,
|
|
3265
|
+
size: s ?? m.size,
|
|
3266
|
+
variant: o ?? m.variant ?? t,
|
|
3267
|
+
alt: i ? "" : dr(m, a, u),
|
|
3268
|
+
decorative: i,
|
|
3269
|
+
...d
|
|
3270
|
+
}
|
|
3271
|
+
) : null;
|
|
3272
|
+
};
|
|
3273
|
+
}
|
|
3274
|
+
const kt = "formDrafts", Ce = (e) => e != null && typeof e == "object" && !Array.isArray(e), Fe = () => {
|
|
3275
|
+
if (typeof window > "u") return {};
|
|
3276
|
+
try {
|
|
3277
|
+
const e = window.localStorage.getItem(kt);
|
|
3278
|
+
if (!e) return {};
|
|
3279
|
+
const t = JSON.parse(e);
|
|
3280
|
+
return Ce(t) ? t : {};
|
|
3281
|
+
} catch {
|
|
3282
|
+
return {};
|
|
3283
|
+
}
|
|
3284
|
+
}, st = (e) => {
|
|
3285
|
+
if (!(typeof window > "u"))
|
|
3286
|
+
try {
|
|
3287
|
+
window.localStorage.setItem(kt, JSON.stringify(e));
|
|
3288
|
+
} catch {
|
|
3289
|
+
}
|
|
3290
|
+
};
|
|
3291
|
+
function Jr(e, t) {
|
|
3292
|
+
const [n, r] = U(() => {
|
|
3293
|
+
const o = typeof t == "function" ? t() : t;
|
|
3294
|
+
if (!e) return o;
|
|
3295
|
+
const i = Fe()?.[e];
|
|
3296
|
+
return !Ce(o) || !Ce(i) ? o : { ...o, ...i };
|
|
3297
|
+
});
|
|
3298
|
+
Q(() => {
|
|
3299
|
+
if (!e || !Ce(n)) return;
|
|
3300
|
+
const o = Fe();
|
|
3301
|
+
st({
|
|
3302
|
+
...o,
|
|
3303
|
+
[e]: n
|
|
3304
|
+
});
|
|
3305
|
+
}, [e, n]);
|
|
3306
|
+
const s = W(() => {
|
|
3307
|
+
if (!e) return;
|
|
3308
|
+
const o = Fe();
|
|
3309
|
+
e in o && (delete o[e], st(o));
|
|
3310
|
+
}, [e]);
|
|
3311
|
+
return { form: n, setForm: r, clearDraft: s };
|
|
3312
|
+
}
|
|
3313
|
+
function fr(e) {
|
|
3314
|
+
if (e == null || e === "") return null;
|
|
3315
|
+
if (typeof e != "object") return String(e);
|
|
3316
|
+
const t = e.id ?? e.value ?? e.ids?.[0] ?? null;
|
|
3317
|
+
return t == null || t === "" ? null : String(t);
|
|
3318
|
+
}
|
|
3319
|
+
function mr(e = {}) {
|
|
3320
|
+
return String(e?.type ?? "").toLowerCase() === "object";
|
|
3321
|
+
}
|
|
3322
|
+
function hr(e) {
|
|
3323
|
+
return e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : !0;
|
|
3324
|
+
}
|
|
3325
|
+
function pr(e, t, n = {}) {
|
|
3326
|
+
const r = new e(n).toJSON(), s = t?.fields ?? {};
|
|
3327
|
+
for (const [o, a] of Object.entries(s))
|
|
3328
|
+
mr(a) && (r[o] = fr(r[o]));
|
|
3329
|
+
return r;
|
|
3330
|
+
}
|
|
3331
|
+
function Zr(e, t, n = {}) {
|
|
3332
|
+
const r = {};
|
|
3333
|
+
for (const [s, o] of Object.entries(n ?? {}))
|
|
3334
|
+
hr(o) && (r[s] = o);
|
|
3335
|
+
return pr(e, t, r);
|
|
3336
|
+
}
|
|
3337
|
+
function eo({
|
|
3338
|
+
id: e,
|
|
3339
|
+
form: t = null,
|
|
3340
|
+
title: n,
|
|
3341
|
+
iconName: r = null,
|
|
3342
|
+
picture: s = null,
|
|
3343
|
+
type: o = "short-form",
|
|
3344
|
+
...a
|
|
3345
|
+
}) {
|
|
3346
|
+
return {
|
|
3347
|
+
id: e,
|
|
3348
|
+
form: t,
|
|
3349
|
+
title: n,
|
|
3350
|
+
iconName: r,
|
|
3351
|
+
picture: s,
|
|
3352
|
+
type: o,
|
|
3353
|
+
...a
|
|
3354
|
+
};
|
|
3355
|
+
}
|
|
3356
|
+
function to(e = {}) {
|
|
3357
|
+
return e;
|
|
3358
|
+
}
|
|
3359
|
+
function no({
|
|
3360
|
+
id: e,
|
|
3361
|
+
form: t = null,
|
|
3362
|
+
title: n = "forms.shared.actionFormTitle",
|
|
3363
|
+
picture: r = null,
|
|
3364
|
+
type: s = "short-form",
|
|
3365
|
+
buildActions: o = null,
|
|
3366
|
+
actions: a = [],
|
|
3367
|
+
...i
|
|
3368
|
+
}) {
|
|
3369
|
+
return {
|
|
3370
|
+
id: e,
|
|
3371
|
+
form: t,
|
|
3372
|
+
title: n,
|
|
3373
|
+
picture: r,
|
|
3374
|
+
type: s,
|
|
3375
|
+
buildActions: o,
|
|
3376
|
+
actions: a,
|
|
3377
|
+
...i
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
function ro(e = {}) {
|
|
3381
|
+
return {
|
|
3382
|
+
forms: e,
|
|
3383
|
+
getForm: (o, a = "default") => !o || o === "none" || !a || a === "none" ? null : e?.[o]?.[a] ?? null,
|
|
3384
|
+
getFormGroup: (o) => !o || o === "none" ? null : e?.[o] ?? null,
|
|
3385
|
+
getFormID: (o, a = "default") => !o || o === "none" || !a || a === "none" ? null : e?.[o]?.[a]?.id ?? null,
|
|
3386
|
+
getFormGroupActions: (o) => !o || o === "none" ? [] : Object.keys(e?.[o] ?? {})
|
|
3387
|
+
};
|
|
3388
|
+
}
|
|
3389
|
+
export {
|
|
3390
|
+
Xr as $,
|
|
3391
|
+
Tr as A,
|
|
3392
|
+
Qt as B,
|
|
3393
|
+
Ir as C,
|
|
3394
|
+
qr as D,
|
|
3395
|
+
bt as E,
|
|
3396
|
+
Fr as F,
|
|
3397
|
+
vt as G,
|
|
3398
|
+
On as H,
|
|
3399
|
+
ue as I,
|
|
3400
|
+
Pr as J,
|
|
3401
|
+
Cn as K,
|
|
3402
|
+
_r as L,
|
|
3403
|
+
Hr as M,
|
|
3404
|
+
Ee as N,
|
|
3405
|
+
gt as O,
|
|
3406
|
+
Yr as P,
|
|
3407
|
+
jn as Q,
|
|
3408
|
+
nr as R,
|
|
3409
|
+
rt as S,
|
|
3410
|
+
Kn as T,
|
|
3411
|
+
tr as U,
|
|
3412
|
+
Yn as V,
|
|
3413
|
+
Xn as W,
|
|
3414
|
+
Qr as X,
|
|
3415
|
+
yt as Y,
|
|
3416
|
+
_ as Z,
|
|
3417
|
+
Hn as _,
|
|
3418
|
+
Lr as a,
|
|
3419
|
+
Br as a0,
|
|
3420
|
+
wr as a1,
|
|
3421
|
+
Zr as a2,
|
|
3422
|
+
Ar as a3,
|
|
3423
|
+
Qe as a4,
|
|
3424
|
+
$r as a5,
|
|
3425
|
+
ro as a6,
|
|
3426
|
+
Ur as a7,
|
|
3427
|
+
dt as a8,
|
|
3428
|
+
je as a9,
|
|
3429
|
+
Cr as aa,
|
|
3430
|
+
no as ab,
|
|
3431
|
+
eo as ac,
|
|
3432
|
+
to as ad,
|
|
3433
|
+
pr as ae,
|
|
3434
|
+
Wt as af,
|
|
3435
|
+
ot as ag,
|
|
3436
|
+
ur as ah,
|
|
3437
|
+
Jr as ai,
|
|
3438
|
+
jt as aj,
|
|
3439
|
+
gn as ak,
|
|
3440
|
+
xn as al,
|
|
3441
|
+
Nt as am,
|
|
3442
|
+
Qn as an,
|
|
3443
|
+
Wn as ao,
|
|
3444
|
+
Or as b,
|
|
3445
|
+
Gr as c,
|
|
3446
|
+
Yt as d,
|
|
3447
|
+
Jt as e,
|
|
3448
|
+
Zt as f,
|
|
3449
|
+
Dr as g,
|
|
3450
|
+
zr as h,
|
|
3451
|
+
Vr as i,
|
|
3452
|
+
rn as j,
|
|
3453
|
+
jr as k,
|
|
3454
|
+
Kr as l,
|
|
3455
|
+
ln as m,
|
|
3456
|
+
dn as n,
|
|
3457
|
+
Zn as o,
|
|
3458
|
+
Rr as p,
|
|
3459
|
+
fn as q,
|
|
3460
|
+
Pe as r,
|
|
3461
|
+
Jn as s,
|
|
3462
|
+
$n as t,
|
|
3463
|
+
Mr as u,
|
|
3464
|
+
on as v,
|
|
3465
|
+
mt as w,
|
|
3466
|
+
Er as x,
|
|
3467
|
+
Wr as y,
|
|
3468
|
+
an as z
|
|
3469
|
+
};
|