@shlinkio/shlink-frontend-kit 0.9.13 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,275 +1,1674 @@
1
- import { jsx as n, jsxs as i, Fragment as f } from "react/jsx-runtime";
2
- import { faCircleNotch as S, faSearch as R, faEllipsisV as D, faSortAmountUp as P, faSortAmountDown as E } from "@fortawesome/free-solid-svg-icons";
3
- import { FontAwesomeIcon as g } from "@fortawesome/react-fontawesome";
4
- import { clsx as u } from "clsx";
5
- import { Card as w, CardHeader as H, CardBody as M, Dropdown as v, DropdownToggle as k, DropdownMenu as C, NavItem as $, NavLink as F, Nav as G, DropdownItem as b } from "reactstrap";
6
- import { useId as O, useState as x, useRef as j, useCallback as U, useMemo as q, Children as Q, isValidElement as V, useEffect as Y } from "react";
7
- import { u as L, d as W } from "./ordering-pAYMfJPl.js";
8
- import { e as He, i as Me, o as $e, s as Fe, f as Ge, a as je, g as Ue, b as qe, c as Qe } from "./ordering-pAYMfJPl.js";
9
- import { useNavigate as z, useLocation as J, NavLink as X } from "react-router";
10
- const ue = ({ className: r, children: e, loading: s = !1, type: t = "default", fullWidth: a = !1 }) => /* @__PURE__ */ n(
11
- w,
1
+ import { jsxs as h, jsx as a, Fragment as j } from "react/jsx-runtime";
2
+ import g, { clsx as f } from "clsx";
3
+ import { useRef as I, useState as D, useEffect as S, forwardRef as N, useCallback as v, createContext as q, useContext as E, useId as _, useImperativeHandle as we, useMemo as P } from "react";
4
+ import { Link as Q, useNavigate as ve, useLocation as le, NavLink as Ne } from "react-router";
5
+ import { faClose as Ce, faEyeSlash as Ae, faEye as Ie, faCircleNotch as se, faSearch as Oe, faCheck as Le, faCaretDown as Re, faChevronUp as Te, faChevronDown as Se, faChevronLeft as te, faChevronRight as re, faEllipsisV as De, faSortAmountUp as Pe, faSortAmountDown as Ee } from "@fortawesome/free-solid-svg-icons";
6
+ import { FontAwesomeIcon as A } from "@fortawesome/react-fontawesome";
7
+ import { useFloating as ie, flip as Me, offset as _e, useClick as Be, useInteractions as de, autoPlacement as Fe, arrow as $e, useHover as He, useTransitionStyles as je } from "@floating-ui/react";
8
+ import { faClone as Ue } from "@fortawesome/free-regular-svg-icons";
9
+ import { createPortal as Ge } from "react-dom";
10
+ const tr = ({ children: t, summary: r, summaryClasses: e, ...n }) => {
11
+ const l = I(null), [o, s] = D(!1);
12
+ return S(() => {
13
+ const i = l.current, d = () => s(!!(i != null && i.open));
14
+ return i == null || i.addEventListener("toggle", d), () => i == null ? void 0 : i.removeEventListener("toggle", d);
15
+ }, []), /* @__PURE__ */ h("details", { ref: l, ...n, children: [
16
+ /* @__PURE__ */ a("summary", { className: f("focus-ring px-1 -mx-1 rounded-sm", e), children: r }),
17
+ o && /* @__PURE__ */ a("div", { className: "mt-3 flex flex-col gap-y-3", children: t })
18
+ ] });
19
+ }, We = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
20
+ "div",
12
21
  {
13
- body: !0,
14
- className: u(r, {
15
- "w-100": a,
16
- "w-75 mx-auto": !a,
17
- "border-danger": t === "error"
18
- }),
19
- children: /* @__PURE__ */ i(
20
- "h3",
21
- {
22
- className: u("text-center mb-0", {
23
- "text-muted": t === "default",
24
- "text-danger": t === "error"
25
- }),
26
- children: [
27
- s && /* @__PURE__ */ n(g, { icon: S, spin: !0 }),
28
- s && /* @__PURE__ */ n("span", { className: "ms-2", children: e ?? "Loading..." }),
29
- !s && e
30
- ]
31
- }
32
- )
22
+ className: g(
23
+ "px-4 py-3 rounded-t-md",
24
+ "bg-lm-primary dark:bg-dm-primary border-b border-lm-border dark:border-dm-border",
25
+ t
26
+ ),
27
+ ...r,
28
+ ref: e
29
+ }
30
+ )), Ke = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
31
+ "div",
32
+ {
33
+ className: g(
34
+ "p-4 bg-lm-primary dark:bg-dm-primary first:rounded-t-md",
35
+ "first:rounded-t-md last:rounded-b-md",
36
+ t
37
+ ),
38
+ ...r,
39
+ ref: e
40
+ }
41
+ )), qe = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
42
+ "div",
43
+ {
44
+ className: g(
45
+ "px-4 py-3 rounded-b-md",
46
+ "bg-lm-primary dark:bg-dm-primary border-t border-lm-border dark:border-dm-border",
47
+ t
48
+ ),
49
+ ...r,
50
+ ref: e
33
51
  }
34
- ), Z = ({ title: r, children: e, bodyClassName: s, ...t }) => /* @__PURE__ */ i(w, { ...t, children: [
35
- r && /* @__PURE__ */ n(H, { role: "heading", "aria-level": 4, children: r }),
36
- /* @__PURE__ */ n(M, { className: s, children: e })
37
- ] }), fe = ({ children: r, type: e, className: s, small: t = !1 }) => /* @__PURE__ */ n(
38
- Z,
52
+ )), Qe = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
53
+ "div",
39
54
  {
40
- role: "document",
41
- className: u("text-center", {
42
- "w-75 mx-auto": !t,
43
- "w-100": t,
44
- "bg-main": e === "success",
45
- "bg-danger": e === "error",
46
- "bg-warning": e === "warning",
47
- "text-white": e !== "warning"
48
- }, s),
49
- bodyClassName: u({ "p-2": t }),
50
- children: r
55
+ className: g(
56
+ "group/card rounded-md shadow-md",
57
+ "border border-lm-border dark:border-dm-border bg-lm-primary dark:bg-dm-primary",
58
+ t
59
+ ),
60
+ ...r,
61
+ ref: e
51
62
  }
52
- ), T = ({ checked: r = !1, onChange: e, className: s, children: t, type: a, inline: c = !1 }) => {
53
- const l = O(), h = (m) => e == null ? void 0 : e(m.target.checked, m), d = {
54
- "form-switch": a === "switch",
55
- "form-checkbox": a === "checkbox"
56
- }, o = c ? { display: "inline-block" } : {};
57
- return /* @__PURE__ */ i("span", { className: u("form-check", d, s), style: o, children: [
58
- /* @__PURE__ */ n("input", { type: "checkbox", className: "form-check-input", id: l, checked: r, onChange: h }),
59
- /* @__PURE__ */ n("label", { className: "form-check-label", htmlFor: l, children: t })
63
+ )), R = Object.assign(Qe, { Body: Ke, Header: We, Footer: qe }), Ye = N(({ bodyClassName: t, children: r, ...e }, n) => {
64
+ const { title: l, titleSize: o = "md", ...s } = "title" in e ? e : {
65
+ ...e,
66
+ title: void 0,
67
+ titleSize: void 0
68
+ };
69
+ return /* @__PURE__ */ h(R, { ...s, ref: n, children: [
70
+ l && /* @__PURE__ */ h(R.Header, { children: [
71
+ o === "lg" && /* @__PURE__ */ a("h4", { children: l }),
72
+ o === "md" && /* @__PURE__ */ a("h5", { children: l }),
73
+ o === "sm" && /* @__PURE__ */ a("h6", { children: l })
74
+ ] }),
75
+ /* @__PURE__ */ a(R.Body, { className: t, children: r })
60
76
  ] });
61
- }, pe = (r) => /* @__PURE__ */ n(T, { type: "checkbox", ...r }), ge = (r) => /* @__PURE__ */ n(T, { type: "switch", ...r }), B = ({ children: r, label: e, className: s = "", labelClassName: t = "", noMargin: a = !1, id: c }) => /* @__PURE__ */ i("div", { className: `${s} ${a ? "" : "mb-3"}`, children: [
62
- /* @__PURE__ */ n("label", { className: `form-label ${t}`, htmlFor: c, children: e }),
63
- r
64
- ] }), be = ({ children: r, value: e, onChange: s, type: t, required: a, placeholder: c, className: l, labelClassName: h }) => {
65
- const d = O();
66
- return /* @__PURE__ */ n(B, { label: /* @__PURE__ */ i(f, { children: [
67
- r,
68
- ":"
69
- ] }), className: l, labelClassName: h, id: d, children: /* @__PURE__ */ n(
70
- "input",
77
+ });
78
+ function Xe({
79
+ id: t,
80
+ items: r,
81
+ onSelectItem: e,
82
+ onActiveItemChange: n,
83
+ renderItem: l,
84
+ className: o,
85
+ noItemsMessage: s = "No items",
86
+ anchor: i,
87
+ "aria-label": d = "Items",
88
+ ...c
89
+ }) {
90
+ const [y, k] = D(0), u = v((w) => {
91
+ if (k(w), n) {
92
+ const [m, p] = [...r.entries()][w];
93
+ n(m, p);
94
+ }
95
+ }, [r, n]);
96
+ return S(() => {
97
+ const w = i == null ? void 0 : i.current;
98
+ if (!w)
99
+ return;
100
+ const m = (p) => {
101
+ ["Enter", "ArrowUp", "ArrowDown"].includes(p.key) && p.preventDefault(), p.key === "ArrowDown" ? u(Math.min(y + 1, r.size - 1)) : p.key === "ArrowUp" ? u(Math.max(y - 1, 0)) : p.key === "Enter" && e([...r.values()][y]);
102
+ };
103
+ return w.addEventListener("keydown", m), () => w.removeEventListener("keydown", m);
104
+ }, [y, i, u, r, e]), /* @__PURE__ */ h(
105
+ R,
71
106
  {
72
- id: d,
73
- className: "form-control",
74
- type: t ?? "text",
75
- value: e,
76
- required: a ?? !0,
77
- placeholder: c,
78
- onChange: (o) => s(o.target.value)
107
+ id: t,
108
+ className: g("py-1 flex flex-col", o),
109
+ role: "listbox",
110
+ "aria-orientation": "vertical",
111
+ "aria-label": d,
112
+ ...c,
113
+ children: [
114
+ r.size === 0 && /* @__PURE__ */ a("i", { role: "option", "aria-disabled": !0, "aria-selected": !1, "data-testid": "no-items", className: "px-2 py-1", children: s }),
115
+ [...r.entries()].map(([w, m], p) => /* @__PURE__ */ a(
116
+ "button",
117
+ {
118
+ id: `${t}_${w}`,
119
+ type: "button",
120
+ role: "option",
121
+ "aria-selected": p === y,
122
+ className: g(
123
+ "px-2 py-1 text-left truncate",
124
+ { "bg-lm-secondary dark:bg-dm-secondary": p === y }
125
+ ),
126
+ tabIndex: -1,
127
+ onClick: () => e(m),
128
+ onMouseOver: () => u(p),
129
+ children: l(m)
130
+ },
131
+ w
132
+ ))
133
+ ]
134
+ }
135
+ );
136
+ }
137
+ const U = q(void 0), F = q({ responsive: !0, size: "md" }), Je = ({ children: t, className: r }) => {
138
+ const { responsive: e } = E(F);
139
+ return /* @__PURE__ */ a(U.Provider, { value: { section: "head" }, children: /* @__PURE__ */ a(
140
+ "thead",
141
+ {
142
+ className: g(
143
+ { "hidden lg:table-header-group": e },
144
+ r
145
+ ),
146
+ children: t
79
147
  }
80
148
  ) });
81
- }, K = 500;
82
- let p;
83
- const _ = () => {
84
- p !== null && clearTimeout(p), p = null;
85
- }, we = ({ onChange: r, className: e, large: s = !0, noBorder: t = !1, initialValue: a = "", setTimeout_: c = setTimeout }) => {
86
- const [l, h] = x(a), d = (o, m = K) => {
87
- h(o), _(), p = c(() => {
88
- r(o), _();
89
- }, m);
90
- };
91
- return /* @__PURE__ */ i("div", { className: u("search-field", e), children: [
92
- /* @__PURE__ */ n(
93
- "input",
149
+ }, Ze = ({ children: t, className: r }) => {
150
+ const { responsive: e } = E(F);
151
+ return /* @__PURE__ */ a(U.Provider, { value: { section: "body" }, children: /* @__PURE__ */ a(
152
+ "tbody",
153
+ {
154
+ className: g(
155
+ { "lg:table-row-group flex flex-col gap-y-3": e },
156
+ r
157
+ ),
158
+ children: t
159
+ }
160
+ ) });
161
+ }, Ve = ({ children: t, className: r }) => {
162
+ const { responsive: e } = E(F);
163
+ return /* @__PURE__ */ a(U.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ a(
164
+ "tfoot",
165
+ {
166
+ className: g(
167
+ { "lg:table-row-group flex flex-col gap-y-3 mt-4": e },
168
+ r
169
+ ),
170
+ children: t
171
+ }
172
+ ) });
173
+ }, ze = ({ children: t, className: r, ...e }) => {
174
+ const n = E(U), l = (n == null ? void 0 : n.section) === "body", { responsive: o } = E(F);
175
+ return /* @__PURE__ */ a(
176
+ "tr",
177
+ {
178
+ className: g(
179
+ "group",
180
+ {
181
+ "lg:table-row flex flex-col": o,
182
+ "lg:border-0 border-y-2 border-lm-border dark:border-dm-border": o,
183
+ "hover:bg-lm-primary dark:hover:bg-dm-primary": l,
184
+ // Use a different hover bg color depending on the table being inside a card or not
185
+ "group-[&]/card:hover:bg-lm-secondary dark:group-[&]/card:hover:bg-dm-secondary": l
186
+ },
187
+ r
188
+ ),
189
+ ...e,
190
+ children: t
191
+ }
192
+ );
193
+ }, et = ({ children: t, className: r, columnName: e, type: n, ...l }) => {
194
+ const o = E(U), s = n ?? ((o == null ? void 0 : o.section) !== "body" ? "th" : "td"), { responsive: i, size: d } = E(F);
195
+ return /* @__PURE__ */ a(
196
+ s,
197
+ {
198
+ "data-column": i ? e : void 0,
199
+ className: g(
200
+ "border-lm-border dark:border-dm-border",
201
+ {
202
+ "p-1": d === "sm",
203
+ "p-2": d === "md",
204
+ "p-3": d === "lg",
205
+ "border-b-1": !i,
206
+ "block lg:table-cell not-last:border-b-1 lg:border-b-1": i,
207
+ "text-left": s === "th",
208
+ // For responsive tables, display the content in data-column attribute for md sizes and lower
209
+ "before:lg:hidden before:content-[attr(data-column)] before:font-bold before:mr-1": i && s === "td"
210
+ },
211
+ r
212
+ ),
213
+ ...l,
214
+ children: t
215
+ }
216
+ );
217
+ }, tt = ({ header: t, footer: r, children: e, responsive: n = !0, size: l = "md", ...o }) => /* @__PURE__ */ a(F.Provider, { value: { responsive: n, size: l }, children: /* @__PURE__ */ h("table", { className: "w-full", ...o, children: [
218
+ /* @__PURE__ */ a(Je, { children: t }),
219
+ /* @__PURE__ */ a(Ze, { children: e }),
220
+ r && /* @__PURE__ */ a(Ve, { children: r })
221
+ ] }) }), rr = Object.assign(tt, { Row: ze, Cell: et }), ce = N(({
222
+ className: t,
223
+ disabled: r,
224
+ variant: e = "primary",
225
+ size: n = "md",
226
+ inline: l = !1,
227
+ solid: o = !1,
228
+ type: s = "button",
229
+ ...i
230
+ }, d) => {
231
+ const c = "to" in i && typeof i.to == "string", y = c ? Q : "button", k = c ? void 0 : s;
232
+ return /* @__PURE__ */ a(
233
+ y,
234
+ {
235
+ ref: d,
236
+ className: g(
237
+ {
238
+ "inline-flex": l,
239
+ flex: !l
240
+ },
241
+ "gap-2 items-center justify-center",
242
+ "border rounded-md no-underline",
243
+ "transition-colors",
244
+ {
245
+ "focus-ring": e === "primary",
246
+ "focus-ring-secondary": e === "secondary",
247
+ "focus-ring-danger": e === "danger"
248
+ },
249
+ {
250
+ "px-1.5 py-1 text-sm": n === "sm",
251
+ "px-3 py-1.5": n === "md",
252
+ "px-4 py-2 text-lg": n === "lg"
253
+ },
254
+ {
255
+ "border-lm-brand dark:border-dm-brand": e === "primary",
256
+ "text-lm-brand dark:text-dm-brand": e === "primary" && !o,
257
+ "border-zinc-500": e === "secondary",
258
+ "text-zinc-500": e === "secondary" && !o,
259
+ "border-danger": e === "danger",
260
+ "text-danger": e === "danger" && !o
261
+ },
262
+ o && {
263
+ "text-white": !0,
264
+ "bg-lm-brand dark:bg-dm-brand": e === "primary",
265
+ "highlight:bg-lm-brand-dark dark:highlight:bg-dm-brand-dark": e === "primary",
266
+ "highlight:border-lm-brand-dark dark:highlight:border-dm-brand-dark": e === "primary",
267
+ "bg-zinc-500": e === "secondary",
268
+ "highlight:bg-zinc-600 highlight:border-zinc-600": e === "secondary",
269
+ "bg-danger": e === "danger",
270
+ "highlight:bg-danger-dark highlight:border-danger-dark": e === "danger"
271
+ },
272
+ !r && {
273
+ "highlight:text-white": !o,
274
+ "highlight:bg-lm-brand dark:highlight:bg-dm-brand": e === "primary",
275
+ "highlight:bg-zinc-500": e === "secondary",
276
+ "highlight:bg-danger": e === "danger"
277
+ },
278
+ {
279
+ "cursor-pointer": !r,
280
+ "pointer-events-none opacity-65": r
281
+ },
282
+ t
283
+ ),
284
+ disabled: c ? void 0 : r,
285
+ "aria-disabled": c ? r : void 0,
286
+ type: k,
287
+ ...i
288
+ }
289
+ );
290
+ }), me = N(({ className: t, onChange: r, ...e }, n) => {
291
+ const l = v((o) => r == null ? void 0 : r(o.target.checked, o), [r]);
292
+ return /* @__PURE__ */ a(
293
+ "input",
294
+ {
295
+ ref: n,
296
+ type: "checkbox",
297
+ className: f(
298
+ "appearance-none focus-ring cursor-[inherit]",
299
+ "border-1 border-lm-input-border dark:border-dm-input-border",
300
+ "bg-lm-primary dark:bg-dm-primary checked:bg-lm-brand dark:checked:bg-dm-brand bg-no-repeat",
301
+ // Use different background color when rendered inside a card
302
+ "group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input",
303
+ t
304
+ ),
305
+ onChange: l,
306
+ ...e
307
+ }
308
+ );
309
+ }), nr = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
310
+ me,
311
+ {
312
+ ref: e,
313
+ className: f("rounded-sm w-4 h-4 checked:bg-(image:--tick) bg-center", t),
314
+ ...r
315
+ }
316
+ )), X = N(({ onClick: t, className: r, label: e = "Close", size: n = "lg", solid: l }, o) => /* @__PURE__ */ a(
317
+ "button",
318
+ {
319
+ ref: o,
320
+ type: "button",
321
+ onClick: t,
322
+ className: g(
323
+ "rounded-md focus-ring cursor-pointer",
94
324
  {
95
- type: "text",
96
- className: u("form-control search-field__input", {
97
- "form-control-lg": s,
98
- "search-field__input--no-border": t
99
- }),
100
- placeholder: "Search...",
101
- value: l,
102
- onChange: (o) => d(o.target.value)
325
+ "opacity-50 highlight:opacity-80 transition-opacity": !l
326
+ },
327
+ r
328
+ ),
329
+ "aria-label": e,
330
+ children: /* @__PURE__ */ a(A, { icon: Ce, size: n === "lg" ? "xl" : n === "md" ? "lg" : void 0 })
331
+ }
332
+ )), Z = N(({
333
+ borderless: t = !1,
334
+ size: r = "md",
335
+ feedback: e,
336
+ variant: n = "default",
337
+ className: l,
338
+ disabled: o,
339
+ ...s
340
+ }, i) => /* @__PURE__ */ a(
341
+ "input",
342
+ {
343
+ ref: i,
344
+ className: g(
345
+ "outline-none",
346
+ n === "default" && [
347
+ "w-full",
348
+ {
349
+ "focus-ring": !e,
350
+ "focus-ring-danger": e === "error",
351
+ "px-2 py-1 text-sm": r === "sm",
352
+ "px-3 py-1.5": r === "md",
353
+ "px-4 py-2 text-xl": r === "lg",
354
+ "rounded-md border": !t,
355
+ "border-lm-input-border dark:border-dm-input-border": !t && !e,
356
+ "border-danger": !t && e === "error",
357
+ "bg-lm-disabled-input dark:bg-dm-disabled-input": o,
358
+ "bg-lm-primary dark:bg-dm-primary": !o,
359
+ // Use different background color when rendered inside a card
360
+ "group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input": !o
361
+ }
362
+ ],
363
+ l
364
+ ),
365
+ disabled: o,
366
+ ...s
367
+ }
368
+ )), V = ({ required: t, children: r, className: e, ...n }) => /* @__PURE__ */ h("label", { className: f("cursor-pointer", e), ...n, children: [
369
+ r,
370
+ t && /* @__PURE__ */ a("span", { className: "text-danger ml-1", "data-testid": "required-indicator", children: "*" })
371
+ ] }), z = ({ children: t, helpText: r, error: e, "data-testid": n }) => /* @__PURE__ */ h("div", { className: "flex flex-col gap-1", "data-testid": n, children: [
372
+ t,
373
+ r && /* @__PURE__ */ a(
374
+ "small",
375
+ {
376
+ "data-testid": n ? `${n}-help-text` : "help-text",
377
+ className: "text-gray-500 dark:text-gray-400",
378
+ children: r
379
+ }
380
+ ),
381
+ e && /* @__PURE__ */ a("span", { "data-testid": n ? `${n}-error` : "error", className: "text-danger", children: e })
382
+ ] }), or = N(({ label: t, inputClassName: r, required: e, hiddenRequired: n, error: l, helpText: o, "data-testid": s, ...i }, d) => {
383
+ const c = _();
384
+ return /* @__PURE__ */ h(z, { error: l, helpText: o, "data-testid": s, children: [
385
+ /* @__PURE__ */ a(V, { htmlFor: c, required: e, children: t }),
386
+ /* @__PURE__ */ a(
387
+ Z,
388
+ {
389
+ ref: d,
390
+ id: c,
391
+ className: r,
392
+ required: e || n,
393
+ feedback: l ? "error" : void 0,
394
+ ...i
395
+ }
396
+ )
397
+ ] });
398
+ }), rt = N(({ containerClassName: t, className: r, size: e, ...n }, l) => {
399
+ const { flag: o, toggle: s, setToFalse: i } = pe(), d = I(null), c = v(({ relatedTarget: y }) => {
400
+ var k;
401
+ (k = d.current) != null && k.contains(y) || i();
402
+ }, [d, i]);
403
+ return /* @__PURE__ */ h(
404
+ "div",
405
+ {
406
+ className: f("group relative", t),
407
+ ref: d,
408
+ onBlurCapture: c,
409
+ children: [
410
+ /* @__PURE__ */ a(
411
+ Z,
412
+ {
413
+ ref: l,
414
+ type: o ? "text" : "password",
415
+ className: f(
416
+ {
417
+ "pr-10": e !== "sm",
418
+ "pr-8": e === "sm"
419
+ },
420
+ r
421
+ ),
422
+ size: e,
423
+ "data-testid": "input",
424
+ ...n
425
+ }
426
+ ),
427
+ /* @__PURE__ */ a(
428
+ "button",
429
+ {
430
+ type: "button",
431
+ onClick: s,
432
+ title: o ? "Hide password" : "Show password",
433
+ "aria-label": o ? "Hide password" : "Show password",
434
+ className: f(
435
+ "absolute top-[50%] translate-y-[-50%] px-1 cursor-pointer",
436
+ "text-placeholder hover:text-lm-text hover:dark:text-dm-text transition-colors",
437
+ {
438
+ "right-1.5": e !== "sm",
439
+ "scale-85 right-1": e === "sm"
440
+ }
441
+ ),
442
+ tabIndex: -1,
443
+ children: /* @__PURE__ */ a(A, { fixedWidth: !0, icon: o ? Ae : Ie })
444
+ }
445
+ )
446
+ ]
447
+ }
448
+ );
449
+ }), ar = N(({ label: t, inputClassName: r, required: e, hiddenRequired: n, error: l, helpText: o, "data-testid": s, ...i }, d) => {
450
+ const c = _();
451
+ return /* @__PURE__ */ h(z, { error: l, helpText: o, "data-testid": s, children: [
452
+ /* @__PURE__ */ a(V, { htmlFor: c, required: e, children: t }),
453
+ /* @__PURE__ */ a(
454
+ rt,
455
+ {
456
+ ref: d,
457
+ id: c,
458
+ className: r,
459
+ required: e || n,
460
+ feedback: l ? "error" : void 0,
461
+ ...i
462
+ }
463
+ )
464
+ ] });
465
+ }), nt = N(({
466
+ className: t,
467
+ size: r = "md",
468
+ feedback: e,
469
+ disabled: n,
470
+ ...l
471
+ }, o) => /* @__PURE__ */ a(
472
+ "select",
473
+ {
474
+ ref: o,
475
+ className: g(
476
+ "w-full rounded-md border appearance-none pr-9",
477
+ "bg-(image:--chevron-down) bg-no-repeat bg-position-[right_0.75rem_center] bg-size-[16px_12px]",
478
+ {
479
+ "focus-ring": !e,
480
+ "focus-ring-danger": e === "error",
481
+ "border-lm-input-border dark:border-dm-input-border": !e,
482
+ "border-danger": e === "error",
483
+ "pl-2 py-1 text-sm": r === "sm",
484
+ "pl-3 py-1.5": r === "md",
485
+ "pl-4 py-2 text-xl": r === "lg",
486
+ "bg-lm-disabled-input dark:bg-dm-disabled-input": n,
487
+ // Apply different background color when rendered inside a card
488
+ "bg-lm-primary dark:bg-dm-primary group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input": !n
489
+ },
490
+ t
491
+ ),
492
+ disabled: n,
493
+ ...l
494
+ }
495
+ )), lr = N(({ selectClassName: t, label: r, error: e, helpText: n, required: l, hiddenRequired: o, "data-testid": s, ...i }, d) => {
496
+ const c = _();
497
+ return /* @__PURE__ */ h(z, { error: e, helpText: n, "data-testid": s, children: [
498
+ /* @__PURE__ */ a(V, { htmlFor: c, required: l, children: r }),
499
+ /* @__PURE__ */ a(
500
+ nt,
501
+ {
502
+ ref: d,
503
+ id: c,
504
+ className: t,
505
+ required: l || o,
506
+ feedback: e ? "error" : void 0,
507
+ ...i
508
+ }
509
+ )
510
+ ] });
511
+ }), ot = N(({
512
+ onChange: t,
513
+ containerClassName: r,
514
+ inputClassName: e,
515
+ // Inputs have a default 'md' size. Search inputs are usually 'lg' as they are rendered at the top of sections
516
+ size: n = "lg",
517
+ loading: l = !1,
518
+ variant: o = "default",
519
+ immediate: s = !1,
520
+ ...i
521
+ }, d) => {
522
+ const { setTimeout: c, clearCurrentTimeout: y } = ue(500), k = v((u) => {
523
+ !u || s ? (y(), t(u)) : c(() => t(u));
524
+ }, [y, s, t, c]);
525
+ return /* @__PURE__ */ h("div", { className: g("group relative focus-within:z-10", r), children: [
526
+ o === "default" && /* @__PURE__ */ a(
527
+ A,
528
+ {
529
+ icon: l ? se : Oe,
530
+ spin: l,
531
+ className: g(
532
+ "absolute top-[50%] translate-y-[-50%] transition-colors",
533
+ "text-placeholder group-focus-within:text-lm-text dark:group-focus-within:text-dm-text",
534
+ {
535
+ "left-3": n !== "sm",
536
+ "scale-85 left-2": n === "sm"
537
+ }
538
+ )
103
539
  }
104
540
  ),
105
- /* @__PURE__ */ n(g, { icon: R, className: "search-field__icon" }),
106
- /* @__PURE__ */ n(
107
- "button",
541
+ /* @__PURE__ */ a(
542
+ Z,
108
543
  {
109
- "aria-label": "Clear search",
110
- type: "button",
111
- className: "close search-field__close btn-close",
112
- hidden: l === "",
113
- id: "search-field__close",
114
- onClick: () => d("", 0)
544
+ ref: d,
545
+ variant: o,
546
+ type: "search",
547
+ className: g(
548
+ o === "default" && {
549
+ "pl-9": n !== "sm",
550
+ "pl-7": n === "sm"
551
+ },
552
+ e
553
+ ),
554
+ placeholder: "Search...",
555
+ onChange: (u) => k(u.target.value),
556
+ size: n,
557
+ ...i
115
558
  }
116
559
  )
117
560
  ] });
118
- }, Ne = () => j(null), _e = () => {
119
- const r = z();
120
- return U(() => r(-1), [r]);
121
- }, ee = (r) => {
122
- const e = new URLSearchParams(r), s = {};
123
- return e.forEach((t, a) => {
124
- if (a.endsWith("[]")) {
125
- const c = a.slice(0, -2);
126
- s[c] ?? (s[c] = []), s[c].push(t);
561
+ });
562
+ function at({
563
+ searchResults: t,
564
+ onSearch: r,
565
+ onSelectSearchResult: e,
566
+ renderSearchResult: n,
567
+ size: l = "md",
568
+ // SearchInput defaults its size to 'lg'. Change it to 'md'
569
+ listboxSpan: o = "full",
570
+ onFocus: s,
571
+ containerClassName: i,
572
+ listboxClassName: d,
573
+ ...c
574
+ }, y) {
575
+ const k = _(), [u, w] = D(), m = I(null);
576
+ we(y, () => m.current);
577
+ const p = P(
578
+ () => t ? u ?? [...t.keys()][0] : void 0,
579
+ [u, t]
580
+ ), x = v((b) => {
581
+ e(b), r(""), m.current.value = "";
582
+ }, [r, e, m]);
583
+ return /* @__PURE__ */ h(
584
+ "div",
585
+ {
586
+ className: g("relative", i),
587
+ onBlur: (b) => {
588
+ b.currentTarget.contains(b.relatedTarget) || r("");
589
+ },
590
+ children: [
591
+ /* @__PURE__ */ a(
592
+ ot,
593
+ {
594
+ onChange: r,
595
+ size: l,
596
+ ref: m,
597
+ role: "combobox",
598
+ "aria-autocomplete": "list",
599
+ "aria-expanded": !!t,
600
+ "aria-controls": k,
601
+ "aria-activedescendant": p ? `${k}_${p}` : void 0,
602
+ autoComplete: "off",
603
+ autoCorrect: "off",
604
+ onFocus: (b) => {
605
+ s == null || s(b), r(b.target.value);
606
+ },
607
+ ...c
608
+ }
609
+ ),
610
+ t && /* @__PURE__ */ a(
611
+ Xe,
612
+ {
613
+ id: k,
614
+ items: t,
615
+ anchor: m,
616
+ onSelectItem: x,
617
+ onActiveItemChange: w,
618
+ renderItem: n,
619
+ className: g(
620
+ "absolute top-full mt-1 z-10",
621
+ {
622
+ "min-w-60": o === "auto",
623
+ "w-full": o === "full"
624
+ },
625
+ d
626
+ ),
627
+ "aria-label": "Matching items",
628
+ noItemsMessage: "No results found matching search"
629
+ }
630
+ )
631
+ ]
632
+ }
633
+ );
634
+ }
635
+ const lt = N(at), st = ({ name: t, color: r }) => /* @__PURE__ */ h("div", { className: "inline-flex items-center gap-2", children: [
636
+ /* @__PURE__ */ a("div", { "aria-hidden": !0, className: "w-4 h-4 rounded-full", style: { backgroundColor: r } }),
637
+ t
638
+ ] }), it = ({ tag: t, color: r, size: e, onRemove: n }) => (
639
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
640
+ /* @__PURE__ */ h(
641
+ "li",
642
+ {
643
+ className: f(
644
+ "inline-flex items-center gap-1 font-bold [&]:rounded-md",
645
+ {
646
+ "px-1 text-sm": e === "sm",
647
+ "py-0.25 px-1.5": e === "md",
648
+ "py-0.5 px-1.5": e === "lg"
649
+ }
650
+ ),
651
+ style: {
652
+ backgroundColor: r,
653
+ color: ut(r) ? "#000" : "#fff"
654
+ },
655
+ onClick: (l) => l.stopPropagation(),
656
+ children: [
657
+ t,
658
+ /* @__PURE__ */ a(X, { label: `Remove ${t}`, solid: !0, size: "sm", onClick: () => n(t) })
659
+ ]
660
+ }
661
+ )
662
+ ), dt = /\s+/g, ne = "#99a1af", oe = (t) => t.trim().toLowerCase().replace(dt, "-"), sr = ({
663
+ tags: t,
664
+ selectedTags: r = [],
665
+ onTagsChange: e,
666
+ getColorForTag: n,
667
+ searchMode: l = "startsWith",
668
+ immutable: o = !1,
669
+ size: s = "md",
670
+ disabled: i,
671
+ containerClassName: d,
672
+ ...c
673
+ }) => {
674
+ const [y, k] = D(), u = v((x) => {
675
+ const b = x.toLowerCase().trim();
676
+ if (!b) {
677
+ k(void 0);
678
+ return;
679
+ }
680
+ const O = t.filter((C) => {
681
+ if (r.includes(C))
682
+ return !1;
683
+ const M = C.toLowerCase();
684
+ return l === "startsWith" ? M.startsWith(b) : M.includes(b);
685
+ }).slice(0, 5);
686
+ o || O.push(`Add "${b.split(",").map(oe).join(",")}" tag`), k(new Map(O.map((C) => [C, C])));
687
+ }, [o, l, r, t]), w = v((x) => {
688
+ const b = x.match(/Add\s+"([^"]+)"\s+tag/), O = ((b == null ? void 0 : b[1]) ?? x).split(",").map(oe);
689
+ e == null || e([.../* @__PURE__ */ new Set([...r, ...O])]);
690
+ }, [e, r]), m = v(
691
+ (x) => e == null ? void 0 : e(r.filter((b) => b !== x)),
692
+ [e, r]
693
+ ), p = I(null);
694
+ return (
695
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
696
+ /* @__PURE__ */ h(
697
+ "div",
698
+ {
699
+ className: f(
700
+ "rounded-md flex flex-wrap gap-1",
701
+ "border border-lm-input-border dark:border-dm-input-border",
702
+ "cursor-text focus-within:focus-within-ring",
703
+ {
704
+ "p-0.5": s === "sm",
705
+ "p-1.25": s === "md",
706
+ "p-2": s === "lg",
707
+ "bg-lm-disabled-input dark:bg-dm-disabled-input": i,
708
+ "bg-lm-primary dark:bg-dm-primary": !i,
709
+ // Use different background color when rendered inside a card
710
+ "group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input": !i
711
+ },
712
+ d
713
+ ),
714
+ onClick: (x) => {
715
+ var b;
716
+ x.target !== p.current && ((b = p.current) == null || b.focus());
717
+ },
718
+ children: [
719
+ /* @__PURE__ */ a("ul", { className: "m-0 p-0 flex flex-wrap gap-1", children: r.map((x, b) => {
720
+ const O = (n == null ? void 0 : n(x)) ?? ne;
721
+ return /* @__PURE__ */ a(it, { tag: x, color: O, onRemove: m, size: s }, `${x}${b}`);
722
+ }) }),
723
+ /* @__PURE__ */ a(
724
+ lt,
725
+ {
726
+ variant: "unstyled",
727
+ listboxSpan: "auto",
728
+ containerClassName: "flex items-center",
729
+ listboxClassName: "whitespace-nowrap",
730
+ inputClassName: f(
731
+ "no-clear-button",
732
+ {
733
+ "px-1 text-sm": s === "sm",
734
+ "px-2 h-[26px]": s === "md",
735
+ "px-3 text-xl": s === "lg"
736
+ }
737
+ ),
738
+ searchResults: y,
739
+ onSearch: u,
740
+ onSelectSearchResult: w,
741
+ renderSearchResult: (x) => x.match(/Add\s+"([^"]+)"\s+tag/) ? x : /* @__PURE__ */ a(st, { name: x, color: (n == null ? void 0 : n(x)) ?? ne }),
742
+ onKeyDown: (x) => {
743
+ x.key === "Backspace" && !y && m(r[r.length - 1]);
744
+ },
745
+ size: s,
746
+ disabled: i,
747
+ ref: p,
748
+ immediate: !0,
749
+ ...c
750
+ }
751
+ )
752
+ ]
753
+ }
754
+ )
755
+ );
756
+ }, ir = N(({ className: t, ...r }, e) => /* @__PURE__ */ a(
757
+ me,
758
+ {
759
+ ref: e,
760
+ className: f(
761
+ "rounded-full w-8 h-4",
762
+ "bg-(image:--circle-grey-dark) dark:bg-(image:--circle-grey-light) checked:bg-(image:--circle-white)",
763
+ "focus-visible:not-checked:bg-(image:--circle-blue-light)",
764
+ "checked:bg-right transition-[background-position]",
765
+ t
766
+ ),
767
+ ...r
768
+ }
769
+ ));
770
+ function ct(t, { elementsSelector: r, focusFirstItem: e = !1, vertical: n = !0, horizontal: l = !0 }) {
771
+ const o = P(() => {
772
+ const d = [];
773
+ return n && d.push("ArrowDown"), l && d.push("ArrowRight"), d;
774
+ }, [l, n]), s = P(() => {
775
+ const d = [];
776
+ return n && d.push("ArrowUp"), l && d.push("ArrowLeft"), d;
777
+ }, [l, n]), i = P(() => [...o, ...s], [o, s]);
778
+ S(() => {
779
+ const d = t.current;
780
+ if (!d)
781
+ return () => {
782
+ };
783
+ const c = new AbortController(), y = () => [...d.querySelectorAll(r)], k = y(), u = Math.max(k.findIndex((w) => w.dataset.selected === "true"), 0);
784
+ return k.forEach((w, m) => {
785
+ w.tabIndex = m === u ? 0 : -1, e && m === u && w.focus();
786
+ }), d.addEventListener("keydown", (w) => {
787
+ if (!i.includes(w.key))
788
+ return;
789
+ w.preventDefault();
790
+ const m = y(), p = m.findIndex((b) => b.tabIndex === 0), x = o.includes(w.key) ? m[p + 1] ?? m[0] : m[p - 1] ?? m[m.length - 1];
791
+ m.forEach((b) => {
792
+ b.tabIndex = -1;
793
+ }), x.tabIndex = 0, x.focus();
794
+ }, { signal: c.signal }), () => c.abort();
795
+ }, [i, t, r, e, o]);
796
+ }
797
+ const dr = () => {
798
+ const t = ve();
799
+ return v(() => t(-1), [t]);
800
+ }, mt = 128;
801
+ function ut(t) {
802
+ const [r, e, n] = (t.match(/../g) ?? []).map((o) => parseInt(o, 16) || 0);
803
+ return Math.round(Math.sqrt(0.299 * r ** 2 + 0.587 * e ** 2 + 0.114 * n ** 2)) >= mt;
804
+ }
805
+ const cr = ({ text: t, className: r, size: e = "lg", initialCopied: n = !1, navigator_: l = globalThis.navigator, ...o }) => {
806
+ const [s, i] = gt({ initialValue: n }), d = v(
807
+ () => l.clipboard.writeText(t).then(i),
808
+ [l.clipboard, t, i]
809
+ );
810
+ return /* @__PURE__ */ a(
811
+ "button",
812
+ {
813
+ type: "button",
814
+ className: f(
815
+ "focus-ring rounded-sm cursor-pointer",
816
+ {
817
+ "text-md": e === "sm",
818
+ "text-lg": e === "md",
819
+ "text-xl": e === "lg"
820
+ },
821
+ r
822
+ ),
823
+ "aria-label": `Copy ${t} to clipboard`,
824
+ title: "Copy to clipboard",
825
+ onClick: d,
826
+ ...o,
827
+ children: /* @__PURE__ */ a(A, { icon: s ? Le : Ue, fixedWidth: !0 })
828
+ }
829
+ );
830
+ }, pt = (t) => {
831
+ const r = new URLSearchParams(t), e = {};
832
+ return r.forEach((n, l) => {
833
+ if (l.endsWith("[]")) {
834
+ const o = l.slice(0, -2);
835
+ e[o] ?? (e[o] = []), e[o].push(n);
127
836
  } else
128
- s[a] = t;
129
- }), s;
130
- }, ve = (r) => {
131
- const e = new URLSearchParams();
132
- for (const [s, t] of Object.entries(r))
133
- t !== void 0 && (Array.isArray(t) ? t.forEach((a) => e.append(`${s}[]`, `${a}`)) : e.append(s, `${t}`));
134
- return e.toString();
135
- }, ke = () => {
136
- const { search: r } = J();
137
- return q(() => ee(r), [r]);
138
- }, re = ({
139
- text: r,
140
- disabled: e = !1,
141
- className: s,
837
+ e[l] = n;
838
+ }), e;
839
+ }, mr = (t) => {
840
+ const r = new URLSearchParams();
841
+ for (const [e, n] of Object.entries(t))
842
+ n !== void 0 && (Array.isArray(n) ? n.forEach((l) => r.append(`${e}[]`, `${l}`)) : r.append(e, `${n}`));
843
+ return r.toString();
844
+ }, ur = () => {
845
+ const { search: t } = le();
846
+ return P(() => pt(t), [t]);
847
+ };
848
+ function ue(t, r = globalThis.setTimeout, e = globalThis.clearTimeout) {
849
+ const n = I(null), l = v(() => {
850
+ n.current && e(n.current);
851
+ }, [e]), o = v((s, i) => {
852
+ l(), n.current = r(() => {
853
+ s(), n.current = null;
854
+ }, i ?? t);
855
+ }, [l, t, r]);
856
+ return S(() => l, [l]), P(
857
+ () => ({ setTimeout: o, clearCurrentTimeout: l }),
858
+ [l, o]
859
+ );
860
+ }
861
+ const bt = 2e3, gt = ({ initialValue: t = !1, delay: r = bt } = {}, e = globalThis.setTimeout, n = globalThis.clearTimeout) => {
862
+ const { setTimeout: l } = ue(r, e, n), [o, s] = D(t), i = I(t), d = v(() => {
863
+ s(!i.current), l(() => s(i.current));
864
+ }, [l]);
865
+ return [o, d];
866
+ };
867
+ function pe(t = !1) {
868
+ const [r, e] = D(t), n = v(() => e((s) => !s), []), l = v(() => e(!0), []), o = v(() => e(!1), []);
869
+ return { flag: r, toggle: n, setToTrue: l, setToFalse: o };
870
+ }
871
+ const be = q({}), ht = ({ className: t, selected: r, disabled: e, onClick: n, ...l }) => {
872
+ const o = "to" in l && typeof l.to == "string", s = o ? Q : "button", { onItemClick: i } = E(be);
873
+ return (
874
+ // @ts-expect-error The Tag is inferred from provided props, so they should always match
875
+ /* @__PURE__ */ a(
876
+ s,
877
+ {
878
+ role: "menuitem",
879
+ "data-selected": r,
880
+ className: f(
881
+ "flex items-center gap-2",
882
+ "w-full px-3 py-1.5 focus-ring",
883
+ // Overwrite link styles in case a Link is being used
884
+ "no-underline text-inherit",
885
+ {
886
+ "cursor-pointer": !e,
887
+ "pointer-events-none opacity-50": e,
888
+ "bg-lm-secondary dark:bg-dm-secondary": r && !e,
889
+ "highlight:bg-lm-secondary dark:highlight:bg-dm-secondary highlight:z-1 relative": !r && !e
890
+ },
891
+ t
892
+ ),
893
+ tabIndex: -1,
894
+ disabled: o ? void 0 : e,
895
+ "aria-disabled": o ? e : void 0,
896
+ type: o ? void 0 : "button",
897
+ onClick: (d) => {
898
+ n == null || n(d), i == null || i();
899
+ },
900
+ ...l
901
+ }
902
+ )
903
+ );
904
+ }, ft = () => (
905
+ // TODO Use an <hr /> tag once tailwind styles are not set with !important
906
+ /* @__PURE__ */ a("div", { role: "separator", "aria-hidden": !0, className: "border-b border-lm-border dark:border-dm-border my-2" })
907
+ ), xt = ({ children: t }) => /* @__PURE__ */ a(
908
+ "div",
909
+ {
910
+ role: "heading",
911
+ "aria-level": 6,
912
+ "aria-hidden": !0,
913
+ className: f(
914
+ "flex items-center w-full px-3 py-1.5",
915
+ "text-gray-500 text-sm font-semibold"
916
+ ),
917
+ onClick: (r) => r.stopPropagation(),
918
+ children: t
919
+ }
920
+ ), yt = ({ className: t, ...r }) => /* @__PURE__ */ a("div", { className: f("px-3 py-1.5", t), ...r }), kt = ({
142
921
  children: t,
143
- dropdownClassName: a,
144
- noCaret: c,
145
- end: l = !1,
146
- minWidth: h,
147
- inline: d,
148
- size: o,
149
- ...m
922
+ className: r,
923
+ focusableElementsSelector: e = '[role="menuitem"]:not([disabled]):not([aria-disabled])',
924
+ focusFirstItem: n = !1,
925
+ onItemClick: l,
926
+ ...o
150
927
  }) => {
151
- const [N, y] = L(), A = u("dropdown-btn__toggle", s, {
152
- "btn-block": !d,
153
- "dropdown-btn__toggle--with-caret": !c
154
- }), I = { minWidth: h && `${h}px` };
155
- return /* @__PURE__ */ i(v, { isOpen: N, toggle: y, disabled: e, className: a, children: [
156
- /* @__PURE__ */ n(k, { size: o, caret: !c, className: A, color: "primary", ...m, children: r }),
157
- /* @__PURE__ */ n(C, { className: "w-100", end: l, style: I, children: N && t })
928
+ const s = I(null);
929
+ return ct(s, { elementsSelector: e, focusFirstItem: n }), /* @__PURE__ */ a(R, { ref: s, role: "menu", className: f("py-2 whitespace-nowrap", r), ...o, children: /* @__PURE__ */ a(be.Provider, { value: { onItemClick: l }, children: t }) });
930
+ }, $ = Object.assign(kt, { Item: ht, Separator: ft, Title: xt, Misc: yt }), wt = ({
931
+ children: t,
932
+ menuAlignment: r = "left",
933
+ buttonVariant: e = "button",
934
+ buttonContent: n,
935
+ buttonClassName: l,
936
+ buttonSize: o = "md",
937
+ buttonDisabled: s = !1,
938
+ containerClassName: i,
939
+ menuClassName: d,
940
+ caretless: c,
941
+ buttonLabel: y,
942
+ menuOffset: k = 3
943
+ }) => {
944
+ const [u, w] = D(!1), m = v(() => w(!1), []), p = I(null), { refs: x, floatingStyles: b, context: O } = ie({
945
+ open: u,
946
+ onOpenChange: w,
947
+ placement: r === "right" ? "bottom-end" : "bottom-start",
948
+ middleware: [Me(), _e(k)],
949
+ // eslint-disable-next-line react-compiler/react-compiler
950
+ elements: { reference: p.current }
951
+ }), C = Be(O), { getReferenceProps: M, getFloatingProps: G } = de([
952
+ C
953
+ ]), W = _(), Y = I(null);
954
+ return S(() => {
955
+ const L = Y.current;
956
+ if (!L || !u)
957
+ return () => {
958
+ };
959
+ const ee = new AbortController();
960
+ return document.body.addEventListener("click", (ke) => {
961
+ ke.composedPath().includes(L) || m();
962
+ }, { signal: ee.signal }), () => ee.abort();
963
+ }, [m, u]), // eslint-disable-next-line jsx-a11y/no-static-element-interactions
964
+ /* @__PURE__ */ h(
965
+ "div",
966
+ {
967
+ ref: Y,
968
+ className: f("relative inline-block", i),
969
+ onKeyDown: (L) => {
970
+ L.key === "Escape" && m();
971
+ },
972
+ onBlur: (L) => {
973
+ L.relatedTarget && !Y.current.contains(L.relatedTarget) && m();
974
+ },
975
+ children: [
976
+ /* @__PURE__ */ h(
977
+ "button",
978
+ {
979
+ ref: p,
980
+ ...M(),
981
+ type: "button",
982
+ "aria-haspopup": !0,
983
+ "aria-expanded": u,
984
+ "aria-controls": W,
985
+ "aria-label": y,
986
+ disabled: s,
987
+ className: f(
988
+ "flex items-center rounded-md focus-ring",
989
+ {
990
+ "justify-between": !c,
991
+ "cursor-pointer": !s,
992
+ "pointer-events-none opacity-50": s,
993
+ // Button variant
994
+ "border border-lm-border dark:border-dm-border": e === "button",
995
+ "bg-lm-primary dark:bg-dm-primary": e === "button",
996
+ // Use different bg color when inside a card
997
+ "group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input": e === "button",
998
+ // Link variant
999
+ "text-lm-brand dark:text-dm-brand": e === "link",
1000
+ "highlight:text-lm-brand-dark dark:highlight:text-dm-brand-dark highlight:underline": e === "link",
1001
+ // Button sizes
1002
+ "px-1.5 py-1 text-sm": e !== "text" && o === "sm",
1003
+ "px-3 py-1.5": e !== "text" && o === "md",
1004
+ "px-4 py-2 text-lg": e !== "text" && o === "lg",
1005
+ "gap-x-1.5": o === "sm",
1006
+ "gap-x-2": o !== "sm"
1007
+ },
1008
+ l
1009
+ ),
1010
+ onKeyDown: (L) => {
1011
+ L.key === "ArrowDown" && (L.preventDefault(), w(!0));
1012
+ },
1013
+ children: [
1014
+ n,
1015
+ !c && /* @__PURE__ */ a(A, { icon: Re, size: "xs" })
1016
+ ]
1017
+ }
1018
+ ),
1019
+ u && /* @__PURE__ */ a(
1020
+ "div",
1021
+ {
1022
+ ref: x.setFloating,
1023
+ style: b,
1024
+ className: "min-w-full z-500",
1025
+ ...G(),
1026
+ children: /* @__PURE__ */ a(
1027
+ $,
1028
+ {
1029
+ className: d,
1030
+ id: W,
1031
+ focusableElementsSelector: '[role="menuitem"]:not([disabled]):not([aria-disabled]),input:not([disabled]),select:not([disabled])',
1032
+ focusFirstItem: !0,
1033
+ onItemClick: m,
1034
+ children: t
1035
+ }
1036
+ )
1037
+ }
1038
+ )
1039
+ ]
1040
+ }
1041
+ );
1042
+ }, T = Object.assign(wt, {
1043
+ Item: $.Item,
1044
+ Separator: $.Separator,
1045
+ Title: $.Title,
1046
+ Misc: $.Misc
1047
+ }), vt = N(({ className: t, disabled: r, size: e = "md", type: n = "button", ...l }, o) => /* @__PURE__ */ a(
1048
+ "button",
1049
+ {
1050
+ className: g(
1051
+ "inline-flex rounded-md focus-ring",
1052
+ "text-lm-brand dark:text-dm-brand",
1053
+ "highlight:text-lm-brand-dark dark:highlight:text-dm-brand-dark highlight:underline",
1054
+ {
1055
+ "px-1.5 py-1 text-sm": e === "sm",
1056
+ "px-3 py-1.5": e === "md",
1057
+ "px-4 py-2 text-lg": e === "lg",
1058
+ "cursor-pointer": !r,
1059
+ "pointer-events-none opacity-65": r
1060
+ },
1061
+ t
1062
+ ),
1063
+ disabled: r,
1064
+ type: n,
1065
+ ...l,
1066
+ ref: o
1067
+ }
1068
+ )), Nt = ({ className: t, active: r, ...e }) => /* @__PURE__ */ a("li", { role: "menuitem", className: "w-full flex", "data-active": r, children: /* @__PURE__ */ a(
1069
+ Q,
1070
+ {
1071
+ className: f(
1072
+ "px-2 py-3",
1073
+ "max-md:w-full max-md:px-3 max-md:py-2",
1074
+ "text-white no-underline highlight:opacity-100 transition-opacity",
1075
+ {
1076
+ "opacity-60": !r,
1077
+ "opacity-100": r
1078
+ },
1079
+ t
1080
+ ),
1081
+ ...e
1082
+ }
1083
+ ) }), Ct = ({ containerClassName: t, buttonClassName: r, menuClassName: e, active: n, ...l }) => /* @__PURE__ */ a("li", { role: "menuitem", "aria-haspopup": !0, className: "w-full flex", "data-active": n, children: /* @__PURE__ */ a(
1084
+ T,
1085
+ {
1086
+ containerClassName: f("max-md:w-full", t),
1087
+ buttonVariant: "text",
1088
+ buttonClassName: f(
1089
+ "px-2 py-3",
1090
+ "max-md:w-full max-md:px-3 max-md:py-2",
1091
+ "text-white highlight:opacity-100 transition-opacity",
1092
+ {
1093
+ "opacity-60": !n,
1094
+ "opacity-100": n
1095
+ },
1096
+ r
1097
+ ),
1098
+ menuAlignment: "right",
1099
+ menuOffset: -3,
1100
+ menuClassName: f("mx-2", e),
1101
+ ...l
1102
+ }
1103
+ ) }), At = ({ className: t, brand: r, children: e }) => {
1104
+ const { flag: n, toggle: l, setToFalse: o } = pe(), s = _(), i = _(), { pathname: d } = le();
1105
+ return S(() => o(), [d, o]), /* @__PURE__ */ h(
1106
+ "nav",
1107
+ {
1108
+ className: f(
1109
+ "w-full relative",
1110
+ "bg-lm-main dark:bg-dm-main",
1111
+ "flex max-md:flex-col items-center justify-between",
1112
+ t
1113
+ ),
1114
+ children: [
1115
+ /* @__PURE__ */ h("div", { className: "w-full relative", children: [
1116
+ /* @__PURE__ */ a(
1117
+ "h4",
1118
+ {
1119
+ className: f(
1120
+ "text-white px-4 py-3",
1121
+ "max-md:w-full max-md:flex max-md:flex-col items-center"
1122
+ ),
1123
+ children: r
1124
+ }
1125
+ ),
1126
+ /* @__PURE__ */ a(
1127
+ ce,
1128
+ {
1129
+ id: i,
1130
+ variant: "secondary",
1131
+ className: f(
1132
+ "absolute right-0 top-[50%] translate-y-[-50%]",
1133
+ "md:hidden mx-2 [&]:px-2",
1134
+ "opacity-60 highlight:opacity-100 transition-opacity",
1135
+ "[&]:text-inherit [&]:border-white [&]:highlight:bg-transparent"
1136
+ ),
1137
+ onClick: l,
1138
+ "aria-label": `${n ? "Hide" : "Show"} menu`,
1139
+ "aria-controls": s,
1140
+ children: /* @__PURE__ */ a(A, { icon: n ? Te : Se })
1141
+ }
1142
+ )
1143
+ ] }),
1144
+ /* @__PURE__ */ a(
1145
+ "ul",
1146
+ {
1147
+ id: s,
1148
+ "aria-labelledby": i,
1149
+ role: "menu",
1150
+ className: f(
1151
+ "m-0 p-0",
1152
+ "max-md:w-full md:mr-2 max-md:absolute max-md:top-full z-2000",
1153
+ "flex max-md:flex-col items-center",
1154
+ "bg-lm-main dark:bg-dm-main",
1155
+ { "max-md:hidden": !n }
1156
+ ),
1157
+ children: e
1158
+ }
1159
+ )
1160
+ ]
1161
+ }
1162
+ );
1163
+ }, pr = Object.assign(At, { MenuItem: Nt, Dropdown: Ct }), ge = q(null), It = ({ className: t, to: r, ...e }) => {
1164
+ const n = E(ge);
1165
+ return /* @__PURE__ */ a(
1166
+ Ne,
1167
+ {
1168
+ role: "menuitem",
1169
+ to: r,
1170
+ className: ({ isActive: l }) => g(
1171
+ "px-4 pt-2 pb-[calc(0.5rem-3px)] border-b-3",
1172
+ "highlight:text-lm-brand dark:highlight:text-dm-brand",
1173
+ "font-bold text-center no-underline transition-colors",
1174
+ "rounded-none outline-none focus-visible:inset-ring-2",
1175
+ "focus-visible:inset-ring-lm-brand/50 dark:focus-visible:inset-ring-dm-brand/50",
1176
+ {
1177
+ "text-lm-brand dark:text-dm-brand": l,
1178
+ "border-b-lm-brand dark:border-b-dm-brand active": l,
1179
+ "border-b-transparent text-gray-500": !l,
1180
+ "flex-grow": n == null ? void 0 : n.fill
1181
+ },
1182
+ t
1183
+ ),
1184
+ ...e
1185
+ }
1186
+ );
1187
+ }, Ot = ({ children: t, className: r, fill: e }) => /* @__PURE__ */ a(ge.Provider, { value: { fill: e }, children: /* @__PURE__ */ a(R, { role: "menubar", className: g("flex overflow-hidden", r), children: t }) }), br = Object.assign(Ot, { Pill: It }), Lt = new Intl.NumberFormat("en-US"), Rt = (t) => Lt.format(Number(t)), ae = 10, gr = (t) => Math.ceil(t / ae) * ae, B = 2, K = "...", Tt = (t, r) => Array.from({ length: r - t }, (e, n) => t + n), St = (t, r) => {
1188
+ const e = Tt(
1189
+ Math.max(B, t - B),
1190
+ Math.min(r - 1, t + B) + 1
1191
+ );
1192
+ return t - B > B && e.unshift(K), t + B < r - 1 && e.push(K), e.unshift(1), e.push(r), e;
1193
+ }, H = (t) => t === K, Dt = (t) => H(t) ? t : Rt(t), Pt = (t, r) => H(t) ? `${t}_${r}` : `${t}`, he = [
1194
+ "border border-r-0 last:border-r border-lm-border dark:border-dm-border",
1195
+ "rounded-none first:rounded-l last:rounded-r"
1196
+ ], fe = (t = !1) => g(
1197
+ he,
1198
+ "px-3 py-2 cursor-pointer no-underline",
1199
+ "focus-ring focus-visible:z-1",
1200
+ !t && [
1201
+ "text-lm-brand dark:text-dm-brand",
1202
+ "bg-lm-primary dark:bg-dm-primary",
1203
+ "highlight:bg-lm-secondary dark:highlight:bg-dm-secondary"
1204
+ ],
1205
+ t && "bg-lm-main dark:bg-dm-main text-white"
1206
+ ), J = ({ children: t }) => /* @__PURE__ */ a("span", { "aria-hidden": !0, className: g(he, "px-3 py-2 text-gray-400"), children: t }), xe = () => /* @__PURE__ */ a(J, { children: K });
1207
+ function Et({ children: t, active: r, isEllipsis: e, href: n, ...l }) {
1208
+ const o = P(() => fe(r), [r]);
1209
+ return e ? /* @__PURE__ */ a(xe, {}) : /* @__PURE__ */ a(Q, { className: o, to: n, ...l, "data-active": r, children: t });
1210
+ }
1211
+ function Mt({ children: t, active: r, isEllipsis: e, ...n }) {
1212
+ const l = P(() => fe(r), [r]);
1213
+ return e ? /* @__PURE__ */ a(xe, {}) : /* @__PURE__ */ a("button", { type: "button", className: l, ...n, "data-active": r, children: t });
1214
+ }
1215
+ const hr = ({ currentPage: t, pagesCount: r, ...e }) => {
1216
+ const n = "urlForPage" in e, l = n ? Et : Mt, o = v(
1217
+ (s) => n ? { href: H(s) ? void 0 : e.urlForPage(s) } : { onClick: () => !H(s) && e.onPageChange(s) },
1218
+ [n, e]
1219
+ );
1220
+ return r < 2 ? null : /* @__PURE__ */ h("div", { className: "select-none flex", "data-testid": "paginator", children: [
1221
+ t === 1 ? /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(A, { size: "xs", icon: te }) }) : /* @__PURE__ */ a(l, { ...o(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ a(A, { size: "xs", icon: te }) }),
1222
+ St(t, r).map((s, i) => /* @__PURE__ */ a(
1223
+ l,
1224
+ {
1225
+ active: s === t,
1226
+ isEllipsis: H(s),
1227
+ ...o(s),
1228
+ children: Dt(s)
1229
+ },
1230
+ Pt(s, i)
1231
+ )),
1232
+ t === r ? /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(A, { size: "xs", icon: re }) }) : /* @__PURE__ */ a(l, { ...o(Math.min(r, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ a(A, { size: "xs", icon: re }) })
158
1233
  ] });
159
- }, Ce = ({ children: r, minWidth: e, label: s = "Options" }) => /* @__PURE__ */ n(
160
- re,
1234
+ }, _t = ({ buttonLabel: t = "Options", buttonSize: r = "md", ...e }) => /* @__PURE__ */ a(
1235
+ T,
161
1236
  {
162
- text: /* @__PURE__ */ n(g, { className: "px-1", icon: D }),
163
- "aria-label": s,
164
- size: "sm",
165
- minWidth: e,
166
- end: !0,
167
- noCaret: !0,
168
- inline: !0,
169
- children: r
1237
+ buttonContent: /* @__PURE__ */ a(
1238
+ A,
1239
+ {
1240
+ icon: De,
1241
+ className: f({ "px-1": r === "sm" })
1242
+ }
1243
+ ),
1244
+ caretless: !0,
1245
+ buttonLabel: t,
1246
+ buttonSize: r,
1247
+ ...e
170
1248
  }
171
- ), te = ({ children: r, ...e }) => /* @__PURE__ */ n($, { children: /* @__PURE__ */ n(F, { className: "nav-pills__nav-link", tag: X, ...e, children: r }) }), Oe = ({ children: r, fill: e = !1, className: s = "" }) => /* @__PURE__ */ n(w, { className: `nav-pills__nav p-0 overflow-hidden ${s}`, body: !0, children: /* @__PURE__ */ n(G, { pills: !0, fill: e, children: Q.map(r, (t) => {
172
- if (!V(t) || t.type !== te)
173
- throw new Error("Only NavPillItem children are allowed inside NavPills.");
174
- return t;
175
- }) }) });
176
- function xe({ items: r, order: e, onChange: s, isButton: t = !0, right: a = !1, prefixed: c = !0 }) {
177
- const [l, h] = L(), d = (o) => () => {
178
- const m = W(o, e.field, e.dir);
179
- s(m ? o : void 0, m);
180
- };
181
- return /* @__PURE__ */ i(v, { isOpen: l, toggle: h, children: [
182
- /* @__PURE__ */ i(
183
- k,
1249
+ ), fr = Object.assign(_t, {
1250
+ Item: T.Item,
1251
+ Separator: T.Separator,
1252
+ Title: T.Title,
1253
+ Misc: T.Misc
1254
+ }), Bt = ({
1255
+ open: t,
1256
+ children: r,
1257
+ className: e,
1258
+ onClose: n,
1259
+ ...l
1260
+ }) => {
1261
+ const o = I(null);
1262
+ return S(() => {
1263
+ var c, y;
1264
+ const s = document.body, i = s.style.overflow, d = s.style.paddingRight;
1265
+ if (t) {
1266
+ const k = window.outerWidth - s.clientWidth, u = s.scrollHeight > s.clientHeight;
1267
+ s.style.overflow = "hidden", u && (s.style.paddingRight = `${k}px`), (c = o.current) == null || c.showModal();
1268
+ } else
1269
+ (y = o.current) == null || y.close();
1270
+ return () => {
1271
+ s.style.overflow = i, s.style.paddingRight = d;
1272
+ };
1273
+ }, [t]), Ge(
1274
+ /* @__PURE__ */ a(
1275
+ "dialog",
184
1276
  {
185
- caret: !0,
186
- color: t ? "primary" : "link",
187
- className: u({
188
- "dropdown-btn__toggle btn-block pe-4 overflow-hidden": t,
189
- "btn-sm p-0": !t
190
- }),
191
- children: [
192
- !t && /* @__PURE__ */ n(f, { children: "Order by" }),
193
- t && !e.field && /* @__PURE__ */ n("i", { children: "Order by..." }),
194
- t && e.field && /* @__PURE__ */ i(f, { children: [
195
- c && "Order by: ",
196
- r[e.field],
197
- " - ",
198
- /* @__PURE__ */ n("small", { children: e.dir ?? "DESC" })
199
- ] })
200
- ]
1277
+ ref: o,
1278
+ className: g("bg-transparent backdrop:bg-black/50", e),
1279
+ onCancel: (s) => {
1280
+ s.preventDefault(), n();
1281
+ },
1282
+ ...l,
1283
+ children: t && r
201
1284
  }
202
1285
  ),
203
- /* @__PURE__ */ n(C, { end: a, className: "w-100", style: t ? void 0 : { minWidth: "11rem" }, children: l && /* @__PURE__ */ i(f, { children: [
204
- Object.entries(r).map(([o, m]) => /* @__PURE__ */ i(
205
- b,
1286
+ document.body
1287
+ );
1288
+ }, xr = ({
1289
+ open: t,
1290
+ onClose: r,
1291
+ variant: e = "default",
1292
+ title: n,
1293
+ children: l,
1294
+ className: o,
1295
+ ...s
1296
+ }) => {
1297
+ const {
1298
+ size: i = "md",
1299
+ confirmText: d = "Confirm",
1300
+ cancelText: c = "Cancel",
1301
+ confirmDisabled: y,
1302
+ onConfirm: k,
1303
+ onClosed: u,
1304
+ ...w
1305
+ } = "onConfirm" in s ? s : { ...s }, [m, p] = D(t), x = I(null), b = I("cancel"), O = v((C) => {
1306
+ C.preventDefault(), C.stopPropagation(), b.current = "confirm", k == null || k();
1307
+ }, [k]);
1308
+ return S(() => {
1309
+ if (t) {
1310
+ b.current = "cancel", p(!0);
1311
+ return;
1312
+ }
1313
+ const C = x.current;
1314
+ if (C) {
1315
+ delete x.current.dataset.open;
1316
+ let M = !1;
1317
+ const G = (W) => {
1318
+ M || W.target !== C || (M = !0, p(!1), u == null || u(b.current));
1319
+ };
1320
+ return C.addEventListener("transitionend", G), () => {
1321
+ C.removeEventListener("transitionend", G);
1322
+ };
1323
+ }
1324
+ }, [u, t]), S(() => {
1325
+ const C = x.current;
1326
+ m && C && (C.dataset.open = "");
1327
+ }, [m]), /* @__PURE__ */ a(
1328
+ Bt,
1329
+ {
1330
+ open: m,
1331
+ onClose: r,
1332
+ className: g(
206
1333
  {
207
- active: e.field === o,
208
- onClick: d(o),
209
- className: "d-flex justify-content-between align-items-center",
210
- tabIndex: -1,
211
- children: [
212
- m,
213
- e.field === o && /* @__PURE__ */ n(g, { icon: e.dir === "ASC" ? P : E })
214
- ]
1334
+ "flex w-screen h-screen max-w-screen max-h-screen": m,
1335
+ "overflow-hidden": e === "cover"
215
1336
  },
216
1337
  o
217
- )),
218
- /* @__PURE__ */ n(b, { divider: !0, tag: "hr" }),
219
- /* @__PURE__ */ n(b, { disabled: !e.field, onClick: () => s(), tabIndex: -1, children: /* @__PURE__ */ n("i", { children: "Clear selection" }) })
220
- ] }) })
221
- ] });
1338
+ ),
1339
+ ...w,
1340
+ children: /* @__PURE__ */ a(
1341
+ "form",
1342
+ {
1343
+ "data-testid": "transition-container",
1344
+ ref: x,
1345
+ className: g(
1346
+ "w-full m-auto p-4 sm:p-6",
1347
+ // CSS transitions are based on the presence of the `data-open` attribute
1348
+ "-translate-y-4 data-open:translate-y-0 opacity-0 data-open:opacity-100",
1349
+ "transition-[opacity_,_translate] duration-300",
1350
+ // Handle modal dimensions for different variants and sizes
1351
+ e !== "cover" && {
1352
+ "sm:w-sm": i === "sm",
1353
+ "md:w-lg": i === "md",
1354
+ "md:w-4xl": i === "lg",
1355
+ "md:w-6xl": i === "xl"
1356
+ },
1357
+ { "h-full": e === "cover" }
1358
+ ),
1359
+ onSubmit: O,
1360
+ children: /* @__PURE__ */ a(R, { className: g(
1361
+ "w-full",
1362
+ { "h-full relative overflow-auto": e === "cover" }
1363
+ ), children: e === "cover" ? /* @__PURE__ */ h(j, { children: [
1364
+ /* @__PURE__ */ h(
1365
+ "div",
1366
+ {
1367
+ className: g(
1368
+ "px-4 py-3 absolute top-0 left-0 right-0 z-3000",
1369
+ "flex items-center justify-between",
1370
+ "text-white bg-linear-to-b from-black/70 to-black/10",
1371
+ "[text-shadow:_0_2px_4px_rgb(0_0_0/_0.8)]"
1372
+ ),
1373
+ children: [
1374
+ /* @__PURE__ */ a("h5", { children: n }),
1375
+ /* @__PURE__ */ a(X, { onClick: r, label: "Close dialog" })
1376
+ ]
1377
+ }
1378
+ ),
1379
+ l
1380
+ ] }) : /* @__PURE__ */ h(j, { children: [
1381
+ /* @__PURE__ */ h(R.Header, { className: g(
1382
+ "sticky top-0",
1383
+ "flex items-center justify-between gap-x-2"
1384
+ ), children: [
1385
+ /* @__PURE__ */ a("h5", { className: g({ "text-danger": e === "danger" }), children: n }),
1386
+ /* @__PURE__ */ a(X, { onClick: r, label: "Close dialog" })
1387
+ ] }),
1388
+ /* @__PURE__ */ a(R.Body, { children: l }),
1389
+ k && /* @__PURE__ */ h(
1390
+ R.Footer,
1391
+ {
1392
+ "data-testid": "footer",
1393
+ className: g(
1394
+ "flex justify-end items-center gap-x-2",
1395
+ "[&]:px-3 sticky bottom-0"
1396
+ ),
1397
+ children: [
1398
+ /* @__PURE__ */ a(vt, { onClick: r, children: c }),
1399
+ /* @__PURE__ */ a(
1400
+ ce,
1401
+ {
1402
+ solid: !0,
1403
+ variant: e === "danger" ? "danger" : "primary",
1404
+ disabled: y,
1405
+ type: "submit",
1406
+ children: d
1407
+ }
1408
+ )
1409
+ ]
1410
+ }
1411
+ )
1412
+ ] }) })
1413
+ }
1414
+ )
1415
+ }
1416
+ );
1417
+ }, yr = ({ className: t, children: r, loading: e = !1, variant: n = "default" }) => /* @__PURE__ */ a(Ye, { className: f({ "[&]:border-danger": n === "error" }, t), children: /* @__PURE__ */ h("h3", { className: f("text-center", {
1418
+ "text-gray-500 dark:text-gray-400": n === "default",
1419
+ "text-danger": n === "error"
1420
+ }), children: [
1421
+ e && /* @__PURE__ */ h(j, { children: [
1422
+ /* @__PURE__ */ a(A, { icon: se, spin: !0 }),
1423
+ /* @__PURE__ */ a("span", { className: "ml-2", children: r ?? "Loading..." })
1424
+ ] }),
1425
+ !e && r
1426
+ ] }) }), kr = ({ variant: t, className: r, size: e = "md", children: n }) => /* @__PURE__ */ a(
1427
+ "div",
1428
+ {
1429
+ className: f(
1430
+ "rounded-md text-center",
1431
+ {
1432
+ "p-2": e === "sm",
1433
+ "p-4": e === "md",
1434
+ "p-6": e === "lg",
1435
+ "[&]:text-white": t !== "warning",
1436
+ "bg-lm-brand dark:bg-dm-brand": t === "success",
1437
+ "bg-danger": t === "error",
1438
+ "bg-warning text-black": t === "warning"
1439
+ },
1440
+ r
1441
+ ),
1442
+ children: n
1443
+ }
1444
+ ), wr = ({ placement: t = "auto" } = {}) => {
1445
+ const r = I(null), e = (() => {
1446
+ const p = [];
1447
+ return t === "auto" && p.push(Fe()), p.push($e({ element: r })), p;
1448
+ })(), [n, l] = D(!1), { refs: o, floatingStyles: s, context: i, middlewareData: d } = ie({
1449
+ placement: t === "auto" ? void 0 : t,
1450
+ open: n,
1451
+ onOpenChange: l,
1452
+ middleware: e
1453
+ }), c = He(i, {
1454
+ delay: { open: 300 },
1455
+ move: !0
1456
+ }), { getFloatingProps: y, getReferenceProps: k } = de([c]), { isMounted: u, styles: w } = je(i, { duration: 200 }), m = P(() => {
1457
+ const p = i.placement.split("-")[0];
1458
+ return {
1459
+ top: "bottom",
1460
+ right: "left",
1461
+ bottom: "top",
1462
+ left: "right"
1463
+ }[p] ?? "";
1464
+ }, [i.placement]);
1465
+ return {
1466
+ anchor: { ...k(), ref: o.setReference },
1467
+ tooltip: {
1468
+ ...y(),
1469
+ refSetter: o.setFloating,
1470
+ isMounted: u,
1471
+ styles: { ...s, ...w },
1472
+ arrowPos: d.arrow,
1473
+ arrowRef: r,
1474
+ arrowSide: m
1475
+ }
1476
+ };
1477
+ }, vr = ({ children: t, isMounted: r, styles: e, refSetter: n, arrowRef: l, arrowPos: o, arrowSide: s, ...i }) => {
1478
+ var d;
1479
+ return r && /* @__PURE__ */ a(
1480
+ "div",
1481
+ {
1482
+ role: "tooltip",
1483
+ "aria-live": "polite",
1484
+ className: f(
1485
+ "z-500 max-w-64",
1486
+ // Add space between anchor and tooltip via padding, so that if the tooltip is inside the anchor, you can hover it
1487
+ // and it's never closed
1488
+ {
1489
+ "pt-2.5": s === "top",
1490
+ "pb-2.5": s === "bottom",
1491
+ "pr-2.5": s === "right",
1492
+ "pl-2.5": s === "left"
1493
+ }
1494
+ ),
1495
+ ref: n,
1496
+ style: e,
1497
+ ...i,
1498
+ children: /* @__PURE__ */ h("div", { className: "relative px-1.5 py-1 rounded bg-black/90 text-white text-center", children: [
1499
+ /* @__PURE__ */ a("span", { className: "sr-only", children: "Tooltip: " }),
1500
+ t,
1501
+ /* @__PURE__ */ a(
1502
+ "div",
1503
+ {
1504
+ ref: l,
1505
+ className: f(
1506
+ "absolute",
1507
+ // Render as a triangle
1508
+ "border-l-6 border-r-6 border-b-6 border-l-transparent border-r-transparent border-b-black/90",
1509
+ // Rotate triangle so that it points to the correct direction
1510
+ {
1511
+ "rotate-180": s === "bottom",
1512
+ "rotate-90 mr-[-3px]": s === "right",
1513
+ "rotate-270 ml-[-3px]": s === "left"
1514
+ }
1515
+ ),
1516
+ style: {
1517
+ left: o == null ? void 0 : o.x,
1518
+ top: o == null ? void 0 : o.y,
1519
+ [s]: `${-(((d = l.current) == null ? void 0 : d.offsetWidth) ?? 0) / 2}px`
1520
+ },
1521
+ "data-testid": "arrow"
1522
+ }
1523
+ )
1524
+ ] })
1525
+ }
1526
+ );
1527
+ };
1528
+ function Ft(t) {
1529
+ if (t.currentField !== t.newField)
1530
+ return "ASC";
1531
+ const r = {
1532
+ ASC: "DESC",
1533
+ DESC: void 0
1534
+ };
1535
+ return t.currentOrderDir ? r[t.currentOrderDir] : "ASC";
1536
+ }
1537
+ function $t(t) {
1538
+ const r = Ft(t);
1539
+ return {
1540
+ field: r ? t.newField : void 0,
1541
+ dir: r
1542
+ };
1543
+ }
1544
+ const Nr = (t, { field: r, dir: e }) => !r || !e ? t : t.sort((n, l) => {
1545
+ const o = e === "ASC" ? 1 : -1, s = e === "ASC" ? -1 : 1;
1546
+ return n[r] > l[r] ? o : s;
1547
+ }), Cr = (t) => t.dir ? `${t.field}-${t.dir}` : void 0, Ar = (t) => {
1548
+ const [r, e] = t.split("-");
1549
+ return { field: r, dir: e };
1550
+ };
1551
+ function Ir({ items: t, order: r, onChange: e, prefixed: n = !0, buttonVariant: l = "button", ...o }) {
1552
+ const s = v((d) => {
1553
+ const c = $t({ currentOrderDir: r.dir, currentField: r.field, newField: d });
1554
+ e(c);
1555
+ }, [e, r.dir, r.field]), i = l === "button";
1556
+ return /* @__PURE__ */ h(
1557
+ T,
1558
+ {
1559
+ buttonContent: /* @__PURE__ */ h(j, { children: [
1560
+ !i && "Order by",
1561
+ i && !r.field && /* @__PURE__ */ a("i", { children: "Order by..." }),
1562
+ i && r.field && /* @__PURE__ */ h(j, { children: [
1563
+ n && "Order by: ",
1564
+ t[r.field],
1565
+ " - ",
1566
+ r.dir ?? "DESC"
1567
+ ] })
1568
+ ] }),
1569
+ buttonVariant: l,
1570
+ ...o,
1571
+ children: [
1572
+ Object.entries(t).map(([d, c]) => /* @__PURE__ */ h(
1573
+ T.Item,
1574
+ {
1575
+ selected: r.field === d,
1576
+ onClick: () => s(d),
1577
+ className: "flex items-center justify-between gap-2",
1578
+ children: [
1579
+ c,
1580
+ r.field === d && /* @__PURE__ */ a(A, { icon: r.dir === "ASC" ? Pe : Ee })
1581
+ ]
1582
+ },
1583
+ d
1584
+ )),
1585
+ /* @__PURE__ */ a(T.Separator, {}),
1586
+ /* @__PURE__ */ a(T.Item, { disabled: !r.field, onClick: () => e({}), children: /* @__PURE__ */ a("i", { children: "Clear selection" }) })
1587
+ ]
1588
+ }
1589
+ );
222
1590
  }
223
- const Le = "#4696e5", Te = "rgba(70, 150, 229, 0.4)", ye = "#f77f28", Ae = "rgba(247, 127, 40, 0.4)", Ie = "white", Se = "#161b22", se = (r) => {
224
- var e;
225
- return (e = document.querySelector("html")) == null ? void 0 : e.setAttribute("data-theme", r);
226
- }, Re = () => {
1591
+ const Ht = "#4696e5", jt = "rgba(70, 150, 229, 0.4)", Ut = "#2078CF", Gt = "rgba(32, 120, 207, 0.4)", Or = () => ye() ? Ht : Ut, Lr = () => ye() ? jt : Gt, Rr = "#f77f28", Tr = "rgba(247, 127, 40, 0.4)", Sr = "white", Dr = "#161b22", Wt = (t) => {
227
1592
  var r;
228
- return ((r = document.querySelector("html")) == null ? void 0 : r.getAttribute("data-theme")) === "dark";
229
- }, ne = (r = window.matchMedia.bind(window)) => r("(prefers-color-scheme: dark)").matches ? "dark" : "light", De = (r) => {
230
- const [e, s] = x(() => r ?? ne());
231
- return Y(() => {
232
- se(e);
233
- }, [e]), [e, s];
1593
+ return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", t);
1594
+ }, ye = () => {
1595
+ var t;
1596
+ return ((t = document.querySelector("html")) == null ? void 0 : t.getAttribute("data-theme")) === "dark";
1597
+ }, Kt = (t = window.matchMedia.bind(window)) => t("(prefers-color-scheme: dark)").matches ? "dark" : "light", Pr = (t) => {
1598
+ const [r, e] = D(() => t ?? Kt());
1599
+ return S(() => {
1600
+ Wt(r);
1601
+ }, [r]), [r, e];
234
1602
  };
235
1603
  export {
236
- pe as Checkbox,
237
- re as DropdownBtn,
238
- ye as HIGHLIGHTED_COLOR,
239
- Ae as HIGHLIGHTED_COLOR_ALPHA,
240
- be as InputFormGroup,
241
- B as LabeledFormGroup,
242
- Le as MAIN_COLOR,
243
- Te as MAIN_COLOR_ALPHA,
244
- ue as Message,
245
- te as NavPillItem,
246
- Oe as NavPills,
247
- xe as OrderingDropdown,
248
- Se as PRIMARY_DARK_COLOR,
249
- Ie as PRIMARY_LIGHT_COLOR,
250
- fe as Result,
251
- Ce as RowDropdownBtn,
252
- we as SearchField,
253
- Z as SimpleCard,
254
- ge as ToggleSwitch,
255
- se as changeThemeInMarkup,
256
- He as determineOrder,
257
- W as determineOrderDir,
258
- ne as getSystemPreferredTheme,
259
- Re as isDarkThemeEnabled,
260
- Me as isLightColor,
261
- $e as orderToString,
262
- ee as parseQueryString,
263
- Fe as sortList,
264
- Ge as stringToOrder,
265
- ve as stringifyQueryParams,
266
- je as useArrowKeyNavigation,
267
- Ne as useElementRef,
268
- _e as useGoBack,
269
- Ue as useOrder,
270
- ke as useParsedQuery,
271
- De as useTheme,
272
- qe as useTimeout,
273
- Qe as useTimeoutToggle,
274
- L as useToggle
1604
+ jt as BRAND_COLOR_ALPHA_DM,
1605
+ Gt as BRAND_COLOR_ALPHA_LM,
1606
+ Ht as BRAND_COLOR_DM,
1607
+ Ut as BRAND_COLOR_LM,
1608
+ At as BaseNavBar,
1609
+ ce as Button,
1610
+ R as Card,
1611
+ xr as CardModal,
1612
+ nr as Checkbox,
1613
+ X as CloseButton,
1614
+ cr as CopyToClipboardButton,
1615
+ tr as Details,
1616
+ T as Dropdown,
1617
+ K as ELLIPSIS,
1618
+ Rr as HIGHLIGHTED_COLOR,
1619
+ Tr as HIGHLIGHTED_COLOR_ALPHA,
1620
+ Z as Input,
1621
+ V as Label,
1622
+ or as LabelledInput,
1623
+ ar as LabelledRevealablePasswordInput,
1624
+ lr as LabelledSelect,
1625
+ vt as LinkButton,
1626
+ Xe as Listbox,
1627
+ $ as Menu,
1628
+ yr as Message,
1629
+ Bt as ModalDialog,
1630
+ pr as NavBar,
1631
+ br as NavPills,
1632
+ Ir as OrderingDropdown,
1633
+ Dr as PRIMARY_DARK_COLOR,
1634
+ Sr as PRIMARY_LIGHT_COLOR,
1635
+ hr as Paginator,
1636
+ kr as Result,
1637
+ rt as RevealablePasswordInput,
1638
+ fr as RowDropdown,
1639
+ lt as SearchCombobox,
1640
+ ot as SearchInput,
1641
+ nt as Select,
1642
+ Ye as SimpleCard,
1643
+ rr as Table,
1644
+ sr as TagsAutocomplete,
1645
+ ir as ToggleSwitch,
1646
+ vr as Tooltip,
1647
+ Or as brandColor,
1648
+ Lr as brandColorAlpha,
1649
+ Wt as changeThemeInMarkup,
1650
+ $t as determineOrder,
1651
+ Ft as determineOrderDir,
1652
+ Rt as formatNumber,
1653
+ Kt as getSystemPreferredTheme,
1654
+ ye as isDarkThemeEnabled,
1655
+ ut as isLightColor,
1656
+ Pt as keyForPage,
1657
+ Cr as orderToString,
1658
+ H as pageIsEllipsis,
1659
+ pt as parseQueryString,
1660
+ Dt as prettifyPageNumber,
1661
+ St as progressivePagination,
1662
+ gr as roundTen,
1663
+ Nr as sortList,
1664
+ Ar as stringToOrder,
1665
+ mr as stringifyQueryParams,
1666
+ ct as useArrowKeyNavigation,
1667
+ dr as useGoBack,
1668
+ ur as useParsedQuery,
1669
+ Pr as useTheme,
1670
+ ue as useTimeout,
1671
+ gt as useTimeoutToggle,
1672
+ pe as useToggle,
1673
+ wr as useTooltip
275
1674
  };