@shlinkio/shlink-frontend-kit 1.4.0 → 1.5.0

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