@shlinkio/shlink-frontend-kit 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tailwind.js CHANGED
@@ -1,109 +1,111 @@
1
- import { jsx as n, jsxs as w, Fragment as I } from "react/jsx-runtime";
2
- import a from "clsx";
3
- import { createContext as L, useContext as g, useId as R, useRef as M, useCallback as k, useEffect as E, useMemo as T } from "react";
4
- import { Link as _ } from "react-router";
5
- import { faClose as U, faSearch as A, faChevronLeft as P, faChevronRight as B } from "@fortawesome/free-solid-svg-icons";
6
- import { FontAwesomeIcon as h } from "@fortawesome/react-fontawesome";
7
- const f = L(void 0), u = L({ responsive: !0 }), O = ({ children: t, className: r }) => {
8
- const { responsive: e } = g(u);
9
- return /* @__PURE__ */ n(f.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
1
+ import { jsx as n, jsxs as i, Fragment as T } from "react/jsx-runtime";
2
+ import w, { clsx as f } from "clsx";
3
+ import { createContext as S, useContext as g, useCallback as F, useId as H, useMemo as O, useRef as $, useEffect as L, useState as Q } from "react";
4
+ import { Link as U, NavLink as V } from "react-router";
5
+ import { faClose as X, faSearch as Y, faChevronLeft as M, faChevronRight as R, faCircleNotch as Z } from "@fortawesome/free-solid-svg-icons";
6
+ import { FontAwesomeIcon as b } from "@fortawesome/react-fontawesome";
7
+ import { createPortal as tt } from "react-dom";
8
+ import { u as et } from "./use-timeout-mQ792qNj.js";
9
+ const N = S(void 0), x = S({ responsive: !0 }), rt = ({ children: t, className: e }) => {
10
+ const { responsive: r } = g(x);
11
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
10
12
  "thead",
11
13
  {
12
- className: a(
13
- { "tw:hidden tw:lg:table-header-group": e },
14
- r
14
+ className: w(
15
+ { "tw:hidden tw:lg:table-header-group": r },
16
+ e
15
17
  ),
16
18
  children: t
17
19
  }
18
20
  ) });
19
- }, W = ({ children: t, className: r }) => {
20
- const { responsive: e } = g(u);
21
- return /* @__PURE__ */ n(f.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
21
+ }, ot = ({ children: t, className: e }) => {
22
+ const { responsive: r } = g(x);
23
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
22
24
  "tbody",
23
25
  {
24
- className: a(
25
- { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": e },
26
- r
26
+ className: w(
27
+ { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": r },
28
+ e
27
29
  ),
28
30
  children: t
29
31
  }
30
32
  ) });
31
- }, q = ({ children: t, className: r }) => {
32
- const { responsive: e } = g(u);
33
- return /* @__PURE__ */ n(f.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
33
+ }, nt = ({ children: t, className: e }) => {
34
+ const { responsive: r } = g(x);
35
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
34
36
  "tfoot",
35
37
  {
36
- className: a(
37
- { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": e },
38
- r
38
+ className: w(
39
+ { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": r },
40
+ e
39
41
  ),
40
42
  children: t
41
43
  }
42
44
  ) });
43
- }, G = ({ children: t, className: r, ...e }) => {
44
- const o = g(f), d = (o == null ? void 0 : o.section) === "body", { responsive: l } = g(u);
45
+ }, dt = ({ children: t, className: e, ...r }) => {
46
+ const o = g(N), d = (o == null ? void 0 : o.section) === "body", { responsive: a } = g(x);
45
47
  return /* @__PURE__ */ n(
46
48
  "tr",
47
49
  {
48
- className: a(
50
+ className: w(
49
51
  "tw:group",
50
52
  {
51
- "tw:lg:table-row tw:flex tw:flex-col": l,
52
- "tw:lg:border-0 tw:border-y-2 tw:border-lm-border tw:dark:border-dm-border": l,
53
+ "tw:lg:table-row tw:flex tw:flex-col": a,
54
+ "tw:lg:border-0 tw:border-y-2 tw:border-lm-border tw:dark:border-dm-border": a,
53
55
  "tw:hover:bg-lm-primary tw:dark:hover:bg-dm-primary": d,
54
56
  // Use a different hover bg color depending on the table being inside a card or not
55
57
  "tw:group-[&]/card:hover:bg-lm-secondary tw:dark:group-[&]/card:hover:bg-dm-secondary": d
56
58
  },
57
- r
59
+ e
58
60
  ),
59
- ...e,
61
+ ...r,
60
62
  children: t
61
63
  }
62
64
  );
63
- }, J = ({ children: t, className: r, columnName: e, type: o, ...d }) => {
64
- const l = g(f), s = o ?? ((l == null ? void 0 : l.section) !== "body" ? "th" : "td"), { responsive: i } = g(u);
65
+ }, lt = ({ children: t, className: e, columnName: r, type: o, ...d }) => {
66
+ const a = g(N), l = o ?? ((a == null ? void 0 : a.section) !== "body" ? "th" : "td"), { responsive: s } = g(x);
65
67
  return /* @__PURE__ */ n(
66
- s,
68
+ l,
67
69
  {
68
- "data-column": i ? e : void 0,
69
- className: a(
70
+ "data-column": s ? r : void 0,
71
+ className: w(
70
72
  "tw:p-2 tw:border-lm-border tw:dark:border-dm-border",
71
73
  {
72
- "tw:border-b-1": !i,
73
- "tw:block tw:lg:table-cell tw:not-last:border-b-1 tw:lg:border-b-1": i,
74
+ "tw:border-b-1": !s,
75
+ "tw:block tw:lg:table-cell tw:not-last:border-b-1 tw:lg:border-b-1": s,
74
76
  // For md and lower, display the content in data-column attribute as before
75
- "tw:before:lg:hidden tw:before:content-[attr(data-column)] tw:before:font-bold tw:before:mr-1": i && s === "td"
77
+ "tw:before:lg:hidden tw:before:content-[attr(data-column)] tw:before:font-bold tw:before:mr-1": s && l === "td"
76
78
  },
77
- r
79
+ e
78
80
  ),
79
81
  ...d,
80
82
  children: t
81
83
  }
82
84
  );
83
- }, K = ({ header: t, footer: r, children: e, responsive: o = !0, ...d }) => /* @__PURE__ */ n(u.Provider, { value: { responsive: o }, children: /* @__PURE__ */ w("table", { className: "tw:w-full", ...d, children: [
84
- /* @__PURE__ */ n(O, { children: t }),
85
- /* @__PURE__ */ n(W, { children: e }),
86
- r && /* @__PURE__ */ n(q, { children: r })
87
- ] }) }), xt = Object.assign(K, { Row: G, Cell: J }), Q = ({
85
+ }, at = ({ header: t, footer: e, children: r, responsive: o = !0, ...d }) => /* @__PURE__ */ n(x.Provider, { value: { responsive: o }, children: /* @__PURE__ */ i("table", { className: "tw:w-full", ...d, children: [
86
+ /* @__PURE__ */ n(rt, { children: t }),
87
+ /* @__PURE__ */ n(ot, { children: r }),
88
+ e && /* @__PURE__ */ n(nt, { children: e })
89
+ ] }) }), Rt = Object.assign(at, { Row: dt, Cell: lt }), wt = ({
88
90
  children: t,
89
- className: r,
90
- disabled: e,
91
+ className: e,
92
+ disabled: r,
91
93
  variant: o = "primary",
92
94
  size: d = "md",
93
- inline: l = !1,
94
- solid: s = !1,
95
- ...i
95
+ inline: a = !1,
96
+ solid: l = !1,
97
+ ...s
96
98
  }) => {
97
- const c = "to" in i ? _ : "button";
99
+ const c = "to" in s ? U : "button";
98
100
  return (
99
101
  // @ts-expect-error We are explicitly checking for the `to` prop before using Link
100
102
  /* @__PURE__ */ n(
101
103
  c,
102
104
  {
103
- className: a(
105
+ className: w(
104
106
  {
105
- "tw:inline-flex": l,
106
- "tw:flex": !l
107
+ "tw:inline-flex": a,
108
+ "tw:flex": !a
107
109
  },
108
110
  "tw:gap-2 tw:items-center tw:justify-center",
109
111
  "tw:border tw:rounded-md tw:no-underline",
@@ -120,11 +122,11 @@ const f = L(void 0), u = L({ responsive: !0 }), O = ({ children: t, className: r
120
122
  {
121
123
  "tw:border-brand tw:text-brand": o === "primary",
122
124
  "tw:border-zinc-500": o === "secondary",
123
- "tw:text-zinc-500": o === "secondary" && !s,
125
+ "tw:text-zinc-500": o === "secondary" && !l,
124
126
  "tw:border-danger": o === "danger",
125
- "tw:text-danger": o === "danger" && !s
127
+ "tw:text-danger": o === "danger" && !l
126
128
  },
127
- s && {
129
+ l && {
128
130
  "tw:text-white": !0,
129
131
  "tw:bg-brand": o === "primary",
130
132
  "tw:highlight:bg-brand-dark tw:highlight:border-brand-dark": o === "primary",
@@ -133,118 +135,143 @@ const f = L(void 0), u = L({ responsive: !0 }), O = ({ children: t, className: r
133
135
  "tw:bg-danger": o === "danger",
134
136
  "tw:highlight:bg-danger-dark tw:highlight:border-danger-dark": o === "danger"
135
137
  },
136
- !e && {
137
- "tw:highlight:text-white": !s,
138
+ !r && {
139
+ "tw:highlight:text-white": !l,
138
140
  "tw:highlight:bg-brand": o === "primary",
139
141
  "tw:highlight:bg-zinc-500": o === "secondary",
140
142
  "tw:highlight:bg-danger": o === "danger"
141
143
  },
142
144
  {
143
- "tw:pointer-events-none tw:opacity-65": e
145
+ "tw:pointer-events-none tw:opacity-65": r
144
146
  },
145
- r
147
+ e
146
148
  ),
147
- disabled: e,
148
- ...i,
149
+ disabled: r,
150
+ ...s,
149
151
  children: t
150
152
  }
151
153
  )
152
154
  );
153
- }, S = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
155
+ }, z = ({ className: t, onChange: e, ...r }) => {
156
+ const o = F((d) => e == null ? void 0 : e(d.target.checked, d), [e]);
157
+ return /* @__PURE__ */ n(
158
+ "input",
159
+ {
160
+ type: "checkbox",
161
+ className: f(
162
+ "tw:appearance-none tw:focus-ring",
163
+ "tw:border-1 tw:border-lm-input-border tw:dark:border-dm-input-border",
164
+ "tw:bg-lm-primary tw:dark:bg-dm-primary tw:checked:bg-brand tw:bg-no-repeat",
165
+ // Use different background color when rendered inside a card
166
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input",
167
+ t
168
+ ),
169
+ onChange: o,
170
+ ...r
171
+ }
172
+ );
173
+ }, jt = ({ className: t, ...e }) => /* @__PURE__ */ n(
174
+ z,
175
+ {
176
+ className: f("tw:rounded-sm tw:w-4 tw:h-4 tw:checked:bg-(image:--tick) tw:bg-center", t),
177
+ ...e
178
+ }
179
+ ), j = ({ onClick: t, label: e = "Close" }) => /* @__PURE__ */ n(
154
180
  "button",
155
181
  {
156
182
  onClick: t,
157
- className: a(
183
+ className: w(
158
184
  "tw:opacity-50 tw:highlight:opacity-80 tw:transition-opacity",
159
185
  "tw:rounded-md tw:focus-ring"
160
186
  ),
161
- "aria-label": r,
162
- children: /* @__PURE__ */ n(h, { icon: U, size: "xl" })
187
+ "aria-label": e,
188
+ children: /* @__PURE__ */ n(b, { icon: X, size: "xl" })
163
189
  }
164
- ), j = ({
190
+ ), A = ({
165
191
  borderless: t = !1,
166
- size: r = "md",
167
- feedback: e,
192
+ size: e = "md",
193
+ feedback: r,
168
194
  className: o,
169
195
  disabled: d,
170
- readOnly: l,
171
- ...s
196
+ readOnly: a,
197
+ ...l
172
198
  }) => {
173
- const i = !d && !l;
199
+ const s = !d && !a;
174
200
  return /* @__PURE__ */ n(
175
201
  "input",
176
202
  {
177
- className: a(
203
+ className: w(
178
204
  "tw:w-full",
179
205
  {
180
- "tw:focus-ring": !e,
181
- "tw:focus-ring-danger": e === "error"
206
+ "tw:focus-ring": !r,
207
+ "tw:focus-ring-danger": r === "error"
182
208
  },
183
209
  {
184
- "tw:px-2 tw:py-1 tw:text-sm": r === "sm",
185
- "tw:px-3 tw:py-1.5": r === "md",
186
- "tw:px-4 tw:py-2 tw:text-xl": r === "lg"
210
+ "tw:px-2 tw:py-1 tw:text-sm": e === "sm",
211
+ "tw:px-3 tw:py-1.5": e === "md",
212
+ "tw:px-4 tw:py-2 tw:text-xl": e === "lg"
187
213
  },
188
214
  {
189
215
  "tw:rounded-md tw:border": !t,
190
- "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !e,
191
- "tw:border-danger": !t && e === "error",
192
- "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !i,
193
- "tw:bg-lm-primary tw:dark:bg-dm-primary": i,
216
+ "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !r,
217
+ "tw:border-danger": !t && r === "error",
218
+ "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !s,
219
+ "tw:bg-lm-primary tw:dark:bg-dm-primary": s,
194
220
  // Use different background color when rendered inside a card
195
- "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": i
221
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": s
196
222
  },
197
223
  o
198
224
  ),
199
225
  disabled: d,
200
- readOnly: l,
201
- ...s
226
+ readOnly: a,
227
+ ...l
202
228
  }
203
229
  );
204
- }, H = ({ required: t, children: r, ...e }) => /* @__PURE__ */ w("label", { ...e, children: [
205
- r,
230
+ }, W = ({ required: t, children: e, ...r }) => /* @__PURE__ */ i("label", { ...r, children: [
231
+ e,
206
232
  t && /* @__PURE__ */ n("span", { className: "tw:text-danger tw:ml-1", "data-testid": "required-indicator", children: "*" })
207
- ] }), yt = ({ label: t, inputClassName: r, required: e, hiddenRequired: o, error: d, ...l }) => {
208
- const s = R();
209
- return /* @__PURE__ */ w("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
210
- /* @__PURE__ */ n(H, { htmlFor: s, required: e, children: t }),
233
+ ] }), Dt = ({ label: t, inputClassName: e, required: r, hiddenRequired: o, error: d, ...a }) => {
234
+ const l = H();
235
+ return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
236
+ /* @__PURE__ */ n(W, { htmlFor: l, required: r, children: t }),
211
237
  /* @__PURE__ */ n(
212
- j,
238
+ A,
213
239
  {
214
- id: s,
215
- className: r,
216
- required: e || o,
240
+ id: l,
241
+ className: e,
242
+ required: r || o,
217
243
  feedback: d ? "error" : void 0,
218
- ...l
244
+ ...a
219
245
  }
220
246
  ),
221
247
  d && /* @__PURE__ */ n("span", { className: "tw:text-danger", children: d })
222
248
  ] });
223
- }, V = String.raw`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>`, X = ({
249
+ }, st = ({
224
250
  className: t,
225
- size: r = "md",
226
- feedback: e,
251
+ size: e = "md",
252
+ feedback: r,
227
253
  style: o = {},
228
254
  disabled: d,
229
- ...l
255
+ ...a
230
256
  }) => /* @__PURE__ */ n(
231
257
  "select",
232
258
  {
233
- className: a(
234
- "tw:w-full tw:appearance-none tw:pr-9 tw:bg-no-repeat",
259
+ className: w(
260
+ "tw:w-full tw:appearance-none tw:pr-9",
261
+ "tw:bg-(image:--chevron-down) tw:bg-no-repeat",
235
262
  {
236
- "tw:focus-ring": !e,
237
- "tw:focus-ring-danger": e === "error"
263
+ "tw:focus-ring": !r,
264
+ "tw:focus-ring-danger": r === "error"
238
265
  },
239
266
  "tw:rounded-md tw:border",
240
267
  {
241
- "tw:border-lm-input-border tw:dark:border-dm-input-border": !e,
242
- "tw:border-danger": e === "error"
268
+ "tw:border-lm-input-border tw:dark:border-dm-input-border": !r,
269
+ "tw:border-danger": r === "error"
243
270
  },
244
271
  {
245
- "tw:pl-2 tw:py-1 tw:text-sm": r === "sm",
246
- "tw:pl-3 tw:py-1.5": r === "md",
247
- "tw:pl-4 tw:py-2 tw:text-xl": r === "lg",
272
+ "tw:pl-2 tw:py-1 tw:text-sm": e === "sm",
273
+ "tw:pl-3 tw:py-1.5": e === "md",
274
+ "tw:pl-4 tw:py-2 tw:text-xl": e === "lg",
248
275
  "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": d,
249
276
  // Apply different background color when rendered inside a card
250
277
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": !d
@@ -253,50 +280,34 @@ const f = L(void 0), u = L({ responsive: !0 }), O = ({ children: t, className: r
253
280
  ),
254
281
  style: {
255
282
  ...o,
256
- backgroundImage: `url("${V}")`,
257
- backgroundSize: "16px 12px",
258
- backgroundPosition: "right 0.75rem center"
283
+ background: "right 0.75rem center / 16px 12px"
259
284
  },
260
285
  disabled: d,
261
- ...l
286
+ ...a
262
287
  }
263
- ), kt = ({ selectClassName: t, label: r, required: e, hiddenRequired: o, ...d }) => {
264
- const l = R();
265
- return /* @__PURE__ */ w("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
266
- /* @__PURE__ */ n(H, { htmlFor: l, required: e, children: r }),
267
- /* @__PURE__ */ n(X, { id: l, className: t, required: e || o, ...d })
288
+ ), Ht = ({ selectClassName: t, label: e, required: r, hiddenRequired: o, ...d }) => {
289
+ const a = H();
290
+ return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
291
+ /* @__PURE__ */ n(W, { htmlFor: a, required: r, children: e }),
292
+ /* @__PURE__ */ n(st, { id: a, className: t, required: r || o, ...d })
268
293
  ] });
269
- };
270
- function Y(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
271
- const o = M(null), d = k(() => {
272
- o.current && e(o.current);
273
- }, [e]), l = k((s, i) => {
274
- d(), o.current = r(() => {
275
- s(), o.current = null;
276
- }, i ?? t);
277
- }, [d, t, r]);
278
- return E(() => d, [d]), T(
279
- () => ({ setTimeout: l, clearCurrentTimeout: d }),
280
- [d, l]
281
- );
282
- }
283
- const vt = ({
294
+ }, Ot = ({
284
295
  onChange: t,
285
- containerClassName: r,
286
- inputClassName: e,
296
+ containerClassName: e,
297
+ inputClassName: r,
287
298
  // Inputs have a default 'md' size. Search inputs are usually 'lg' as they are rendered at the top of sections
288
299
  size: o = "lg",
289
300
  ...d
290
301
  }) => {
291
- const { setTimeout: l, clearCurrentTimeout: s } = Y(500), i = k((c) => {
292
- c ? l(() => t(c)) : (s(), t(c));
293
- }, [s, t, l]);
294
- return /* @__PURE__ */ w("div", { className: a("tw:group tw:relative tw:focus-within:z-10", r), children: [
302
+ const { setTimeout: a, clearCurrentTimeout: l } = et(500), s = F((c) => {
303
+ c ? a(() => t(c)) : (l(), t(c));
304
+ }, [l, t, a]);
305
+ return /* @__PURE__ */ i("div", { className: w("tw:group tw:relative tw:focus-within:z-10", e), children: [
295
306
  /* @__PURE__ */ n(
296
- h,
307
+ b,
297
308
  {
298
- icon: A,
299
- className: a(
309
+ icon: Y,
310
+ className: w(
300
311
  "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:transition-colors",
301
312
  "tw:text-placeholder tw:group-focus-within:text-lm-text tw:dark:group-focus-within:text-dm-text",
302
313
  {
@@ -307,214 +318,278 @@ const vt = ({
307
318
  }
308
319
  ),
309
320
  /* @__PURE__ */ n(
310
- j,
321
+ A,
311
322
  {
312
323
  type: "search",
313
- className: a(
324
+ className: w(
314
325
  {
315
326
  "tw:pl-9": o !== "sm",
316
327
  "tw:pl-7": o === "sm"
317
328
  },
318
- e
329
+ r
319
330
  ),
320
331
  placeholder: "Search...",
321
- onChange: (c) => i(c.target.value),
332
+ onChange: (c) => s(c.target.value),
322
333
  size: o,
323
334
  ...d
324
335
  }
325
336
  )
326
337
  ] });
327
- }, Z = ({ className: t, disabled: r, size: e = "md", ...o }) => /* @__PURE__ */ n(
338
+ }, $t = ({ className: t, ...e }) => /* @__PURE__ */ n(
339
+ z,
340
+ {
341
+ className: f(
342
+ "tw:rounded-full tw:w-8 tw:h-4",
343
+ "tw:bg-(image:--circle-grey-dark) tw:dark:bg-(image:--circle-grey-light) tw:checked:bg-(image:--circle-white)",
344
+ "tw:focus-visible:not-checked:bg-(image:--circle-light-blue)",
345
+ "tw:checked:bg-right tw:transition-[background-position]",
346
+ t
347
+ ),
348
+ ...e
349
+ }
350
+ ), it = ({ className: t, disabled: e, size: r = "md", ...o }) => /* @__PURE__ */ n(
328
351
  "button",
329
352
  {
330
- className: a(
353
+ className: w(
331
354
  "tw:inline-flex tw:rounded-md tw:focus-ring",
332
355
  "tw:text-brand tw:highlight:text-brand-dark tw:highlight:underline",
333
356
  {
334
- "tw:px-1.5 tw:py-1 tw:text-sm": e === "sm",
335
- "tw:px-3 tw:py-1.5": e === "md",
336
- "tw:px-4 tw:py-2 tw:text-lg": e === "lg",
337
- "tw:pointer-events-none tw:opacity-65": r
357
+ "tw:px-1.5 tw:py-1 tw:text-sm": r === "sm",
358
+ "tw:px-3 tw:py-1.5": r === "md",
359
+ "tw:px-4 tw:py-2 tw:text-lg": r === "lg",
360
+ "tw:pointer-events-none tw:opacity-65": e
338
361
  },
339
362
  t
340
363
  ),
341
- disabled: r,
364
+ disabled: e,
342
365
  ...o
343
366
  }
344
- ), tt = new Intl.NumberFormat("en-US"), rt = (t) => tt.format(Number(t)), F = 10, Nt = (t) => Math.ceil(t / F) * F, b = 2, v = "...", et = (t, r) => Array.from({ length: r - t }, (e, o) => t + o), ot = (t, r) => {
345
- const e = et(
346
- Math.max(b, t - b),
347
- Math.min(r - 1, t + b) + 1
348
- );
349
- return t - b > b && e.unshift(v), t + b < r - 1 && e.push(v), e.unshift(1), e.push(r), e;
350
- }, p = (t) => t === v, nt = (t) => p(t) ? t : rt(t), dt = (t, r) => p(t) ? `${t}_${r}` : `${t}`, z = [
351
- "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
352
- "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
353
- ], D = (t = !1) => a(
354
- z,
355
- "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
356
- "tw:focus-ring tw:focus-visible:z-1",
357
- {
358
- "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
359
- "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
360
- }
361
- ), C = ({ children: t }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: a(z, "tw:px-3 py-2 tw:text-gray-400"), children: t }), $ = () => /* @__PURE__ */ n(C, { children: v });
362
- function lt({ children: t, active: r, isEllipsis: e, href: o, ...d }) {
363
- const l = T(() => D(r), [r]);
364
- return e ? /* @__PURE__ */ n($, {}) : /* @__PURE__ */ n(_, { className: l, to: o, ...d, children: t });
365
- }
366
- function st({ children: t, active: r, isEllipsis: e, ...o }) {
367
- const d = T(() => D(r), [r]);
368
- return e ? /* @__PURE__ */ n($, {}) : /* @__PURE__ */ n("button", { type: "button", className: d, ...o, children: t });
369
- }
370
- const Ct = ({ currentPage: t, pagesCount: r, ...e }) => {
371
- const o = "urlForPage" in e, d = o ? lt : st, l = k(
372
- (s) => o ? { href: p(s) ? void 0 : e.urlForPage(s) } : { onClick: () => !p(s) && e.onPageChange(s) },
373
- [o, e]
374
- );
375
- return r < 2 ? null : /* @__PURE__ */ w("div", { className: "tw:select-none tw:flex", "data-testid": "paginator", children: [
376
- t === 1 ? /* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(h, { size: "xs", icon: P }) }) : /* @__PURE__ */ n(d, { ...l(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ n(h, { size: "xs", icon: P }) }),
377
- ot(t, r).map((s, i) => /* @__PURE__ */ n(
378
- d,
379
- {
380
- active: s === t,
381
- isEllipsis: p(s),
382
- ...l(s),
383
- children: nt(s)
384
- },
385
- dt(s, i)
386
- )),
387
- t === r ? /* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(h, { size: "xs", icon: B }) }) : /* @__PURE__ */ n(d, { ...l(Math.min(r, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(h, { size: "xs", icon: B }) })
388
- ] });
389
- }, at = ({ className: t, ...r }) => /* @__PURE__ */ n(
367
+ ), ct = ({ className: t, ...e }) => /* @__PURE__ */ n(
390
368
  "div",
391
369
  {
392
- className: a(
370
+ className: w(
393
371
  "tw:px-4 tw:py-3 tw:rounded-t-md",
394
372
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-b tw:border-lm-border tw:dark:border-dm-border",
395
373
  t
396
374
  ),
397
- ...r
375
+ ...e
398
376
  }
399
- ), it = ({ className: t, ...r }) => /* @__PURE__ */ n(
377
+ ), mt = ({ className: t, ...e }) => /* @__PURE__ */ n(
400
378
  "div",
401
379
  {
402
- className: a(
380
+ className: w(
403
381
  "tw:p-4 tw:bg-lm-primary tw:dark:bg-dm-primary tw:first:rounded-t-md",
404
382
  "tw:first:rounded-t-md tw:last:rounded-b-md",
405
383
  t
406
384
  ),
407
- ...r
385
+ ...e
408
386
  }
409
- ), wt = ({ className: t, ...r }) => /* @__PURE__ */ n(
387
+ ), gt = ({ className: t, ...e }) => /* @__PURE__ */ n(
410
388
  "div",
411
389
  {
412
- className: a(
390
+ className: w(
413
391
  "tw:px-4 tw:py-3 tw:rounded-b-md",
414
392
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-t tw:border-lm-border tw:dark:border-dm-border",
415
393
  t
416
394
  ),
417
- ...r
395
+ ...e
418
396
  }
419
- ), ct = ({ className: t, ...r }) => /* @__PURE__ */ n(
397
+ ), bt = ({ className: t, ...e }) => /* @__PURE__ */ n(
420
398
  "div",
421
399
  {
422
- className: a(
400
+ className: w(
423
401
  "tw:group/card tw:rounded-md tw:shadow-md",
424
402
  "tw:border tw:border-lm-border tw:dark:border-dm-border tw:bg-lm-primary tw:dark:bg-dm-primary",
425
403
  t
426
404
  ),
427
- ...r
405
+ ...e
428
406
  }
429
- ), m = Object.assign(ct, { Body: it, Header: at, Footer: wt }), Tt = ({ bodyClassName: t, children: r, ...e }) => {
430
- const { title: o, titleSize: d = "md", ...l } = "title" in e ? e : {
431
- ...e,
407
+ ), m = Object.assign(bt, { Body: mt, Header: ct, Footer: gt }), pt = ({ bodyClassName: t, children: e, ...r }) => {
408
+ const { title: o, titleSize: d = "md", ...a } = "title" in r ? r : {
409
+ ...r,
432
410
  title: void 0,
433
411
  titleSize: void 0
434
412
  };
435
- return /* @__PURE__ */ w(m, { ...l, children: [
436
- o && /* @__PURE__ */ w(m.Header, { children: [
413
+ return /* @__PURE__ */ i(m, { ...a, children: [
414
+ o && /* @__PURE__ */ i(m.Header, { children: [
437
415
  d === "lg" && /* @__PURE__ */ n("h4", { children: o }),
438
416
  d === "md" && /* @__PURE__ */ n("h5", { children: o }),
439
417
  d === "sm" && /* @__PURE__ */ n("h6", { children: o })
440
418
  ] }),
441
- /* @__PURE__ */ n(m.Body, { className: t, children: r })
419
+ /* @__PURE__ */ n(m.Body, { className: t, children: e })
420
+ ] });
421
+ }, q = S(null), ht = ({ className: t, to: e, ...r }) => {
422
+ const o = g(q);
423
+ return /* @__PURE__ */ n(
424
+ V,
425
+ {
426
+ role: "menuitem",
427
+ to: e,
428
+ className: ({ isActive: d }) => w(
429
+ "tw:px-4 tw:pt-2 tw:pb-[calc(0.5rem-3px)] tw:border-b-3",
430
+ "tw:font-bold tw:no-underline tw:text-center tw:highlight:text-brand tw:transition-colors",
431
+ "tw:rounded-none tw:outline-none tw:focus-visible:inset-ring-2 tw:focus-visible:inset-ring-brand/50",
432
+ {
433
+ "tw:border-b-brand active": d,
434
+ "tw:border-b-transparent tw:text-gray-500": !d,
435
+ "tw:flex-grow": o == null ? void 0 : o.fill
436
+ },
437
+ t
438
+ ),
439
+ ...r
440
+ }
441
+ );
442
+ }, ut = ({ children: t, className: e, fill: r }) => /* @__PURE__ */ n(q.Provider, { value: { fill: r }, children: /* @__PURE__ */ n(m, { role: "menubar", className: w("tw:flex tw:overflow-hidden", e), children: t }) }), Ut = Object.assign(ut, { Pill: ht }), ft = new Intl.NumberFormat("en-US"), xt = (t) => ft.format(Number(t)), D = 10, zt = (t) => Math.ceil(t / D) * D, u = 2, C = "...", yt = (t, e) => Array.from({ length: e - t }, (r, o) => t + o), kt = (t, e) => {
443
+ const r = yt(
444
+ Math.max(u, t - u),
445
+ Math.min(e - 1, t + u) + 1
446
+ );
447
+ return t - u > u && r.unshift(C), t + u < e - 1 && r.push(C), r.unshift(1), r.push(e), r;
448
+ }, k = (t) => t === C, Nt = (t) => k(t) ? t : xt(t), vt = (t, e) => k(t) ? `${t}_${e}` : `${t}`, G = [
449
+ "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
450
+ "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
451
+ ], J = (t = !1) => w(
452
+ G,
453
+ "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
454
+ "tw:focus-ring tw:focus-visible:z-1",
455
+ {
456
+ "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
457
+ "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
458
+ }
459
+ ), B = ({ children: t }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: w(G, "tw:px-3 py-2 tw:text-gray-400"), children: t }), K = () => /* @__PURE__ */ n(B, { children: C });
460
+ function Pt({ children: t, active: e, isEllipsis: r, href: o, ...d }) {
461
+ const a = O(() => J(e), [e]);
462
+ return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n(U, { className: a, to: o, ...d, children: t });
463
+ }
464
+ function Ct({ children: t, active: e, isEllipsis: r, ...o }) {
465
+ const d = O(() => J(e), [e]);
466
+ return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n("button", { type: "button", className: d, ...o, children: t });
467
+ }
468
+ const At = ({ currentPage: t, pagesCount: e, ...r }) => {
469
+ const o = "urlForPage" in r, d = o ? Pt : Ct, a = F(
470
+ (l) => o ? { href: k(l) ? void 0 : r.urlForPage(l) } : { onClick: () => !k(l) && r.onPageChange(l) },
471
+ [o, r]
472
+ );
473
+ return e < 2 ? null : /* @__PURE__ */ i("div", { className: "tw:select-none tw:flex", "data-testid": "paginator", children: [
474
+ t === 1 ? /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(b, { size: "xs", icon: M }) }) : /* @__PURE__ */ n(d, { ...a(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ n(b, { size: "xs", icon: M }) }),
475
+ kt(t, e).map((l, s) => /* @__PURE__ */ n(
476
+ d,
477
+ {
478
+ active: l === t,
479
+ isEllipsis: k(l),
480
+ ...a(l),
481
+ children: Nt(l)
482
+ },
483
+ vt(l, s)
484
+ )),
485
+ t === e ? /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(b, { size: "xs", icon: R }) }) : /* @__PURE__ */ n(d, { ...a(Math.min(e, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(b, { size: "xs", icon: R }) })
442
486
  ] });
443
- }, mt = ({
487
+ }, It = ({
444
488
  open: t,
445
- children: r,
446
- className: e,
447
- ...o
489
+ children: e,
490
+ className: r,
491
+ onClose: o,
492
+ ...d
448
493
  }) => {
449
- const d = M(null);
450
- return E(() => {
451
- var c, x;
452
- const l = document.body, s = l.style.overflow, i = l.style.paddingRight;
494
+ const a = $(null);
495
+ return L(() => {
496
+ var v, y;
497
+ const l = document.body, s = l.style.overflow, c = l.style.paddingRight;
453
498
  if (t) {
454
- const y = window.outerWidth - l.clientWidth, N = l.scrollHeight > l.clientHeight;
455
- l.style.overflow = "hidden", N && (l.style.paddingRight = `${y}px`), (c = d.current) == null || c.showModal();
499
+ const I = window.outerWidth - l.clientWidth, p = l.scrollHeight > l.clientHeight;
500
+ l.style.overflow = "hidden", p && (l.style.paddingRight = `${I}px`), (v = a.current) == null || v.showModal();
456
501
  } else
457
- (x = d.current) == null || x.close();
502
+ (y = a.current) == null || y.close();
458
503
  return () => {
459
- l.style.overflow = s, l.style.paddingRight = i;
504
+ l.style.overflow = s, l.style.paddingRight = c;
460
505
  };
461
- }, [t]), /* @__PURE__ */ n(
462
- "dialog",
463
- {
464
- ref: d,
465
- className: a("tw:bg-transparent tw:backdrop:bg-black/50", e),
466
- ...o,
467
- children: t && r
468
- }
506
+ }, [t]), tt(
507
+ /* @__PURE__ */ n(
508
+ "dialog",
509
+ {
510
+ ref: a,
511
+ className: w("tw:bg-transparent tw:backdrop:bg-black/50", r),
512
+ onCancel: (l) => {
513
+ l.preventDefault(), o();
514
+ },
515
+ ...d,
516
+ children: t && e
517
+ }
518
+ ),
519
+ document.body
469
520
  );
470
- }, It = ({
521
+ }, Wt = ({
471
522
  open: t,
472
- onClose: r,
473
- variant: e = "default",
523
+ onClose: e,
524
+ variant: r = "default",
474
525
  title: o,
475
526
  children: d,
476
- className: l,
477
- ...s
527
+ className: a,
528
+ ...l
478
529
  }) => {
479
530
  const {
480
- size: i = "md",
531
+ size: s = "md",
481
532
  confirmText: c = "Confirm",
482
- confirmDisabled: x,
533
+ confirmDisabled: v,
483
534
  onConfirm: y,
484
- ...N
485
- } = "onConfirm" in s ? s : { ...s };
486
- return /* @__PURE__ */ n(
487
- mt,
535
+ ...I
536
+ } = "onConfirm" in l ? l : { ...l }, [p, _] = Q(t), P = $(null);
537
+ return L(() => {
538
+ if (t) {
539
+ _(!0);
540
+ return;
541
+ }
542
+ const h = P.current;
543
+ if (h) {
544
+ delete P.current.dataset.open;
545
+ const E = () => _(!1);
546
+ return h.addEventListener("transitionend", E, { once: !0 }), () => {
547
+ h.removeEventListener("transitionend", E);
548
+ };
549
+ }
550
+ }, [t]), L(() => {
551
+ const h = P.current;
552
+ p && h && (h.dataset.open = "");
553
+ }, [p]), /* @__PURE__ */ n(
554
+ It,
488
555
  {
489
- open: t,
490
- onClose: r,
491
- className: a(
492
- { "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": t },
493
- l
556
+ open: p,
557
+ onClose: e,
558
+ className: w(
559
+ {
560
+ "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": p,
561
+ "tw:overflow-hidden": r === "cover"
562
+ },
563
+ a
494
564
  ),
495
- ...N,
565
+ ...I,
496
566
  children: /* @__PURE__ */ n(
497
567
  "div",
498
568
  {
499
- className: a("tw:m-auto tw:p-4", {
500
- "tw:w-full tw:h-full": e === "cover"
501
- }),
502
- children: /* @__PURE__ */ n(m, { className: a(
503
- "tw:w-full",
504
- e !== "cover" && {
505
- "tw:md:w-sm": i === "sm",
506
- "tw:md:w-lg": i === "md",
507
- "tw:md:w-4xl": i === "lg",
508
- "tw:md:w-6xl": i === "xl"
569
+ "data-testid": "transition-container",
570
+ ref: P,
571
+ className: w(
572
+ "tw:w-full tw:m-auto tw:p-4 tw:sm:p-6",
573
+ // CSS transitions are based on the presence of the `data-open` attribute
574
+ "tw:-translate-y-4 tw:data-open:translate-y-0 tw:opacity-0 tw:data-open:opacity-100",
575
+ "tw:transition-[opacity_transform] tw:duration-300",
576
+ // Handle modal dimensions for different variants and sizes
577
+ r !== "cover" && {
578
+ "tw:sm:w-sm": s === "sm",
579
+ "tw:md:w-lg": s === "md",
580
+ "tw:md:w-4xl": s === "lg",
581
+ "tw:md:w-6xl": s === "xl"
509
582
  },
510
- {
511
- "tw:h-full tw:overflow-auto tw:relative": e === "cover"
512
- }
513
- ), children: e === "cover" ? /* @__PURE__ */ w(I, { children: [
514
- /* @__PURE__ */ w(
583
+ { "tw:h-full": r === "cover" }
584
+ ),
585
+ children: /* @__PURE__ */ n(m, { className: w(
586
+ "tw:w-full",
587
+ { "tw:h-full tw:relative tw:overflow-auto": r === "cover" }
588
+ ), children: r === "cover" ? /* @__PURE__ */ i(T, { children: [
589
+ /* @__PURE__ */ i(
515
590
  "div",
516
591
  {
517
- className: a(
592
+ className: w(
518
593
  "tw:px-4 tw:py-3 tw:absolute tw:top-0 tw:left-0 tw:right-0",
519
594
  "tw:flex tw:items-center tw:justify-between",
520
595
  "tw:text-white tw:bg-linear-to-b tw:from-black/70 tw:to-black/10",
@@ -522,34 +597,40 @@ const Ct = ({ currentPage: t, pagesCount: r, ...e }) => {
522
597
  ),
523
598
  children: [
524
599
  /* @__PURE__ */ n("h5", { children: o }),
525
- /* @__PURE__ */ n(S, { onClick: r, label: "Close dialog" })
600
+ /* @__PURE__ */ n(j, { onClick: e, label: "Close dialog" })
526
601
  ]
527
602
  }
528
603
  ),
529
604
  /* @__PURE__ */ n("div", { children: d })
530
- ] }) : /* @__PURE__ */ w(I, { children: [
531
- /* @__PURE__ */ w(m.Header, { className: "tw:flex tw:items-center tw:justify-between tw:sticky tw:top-0", children: [
532
- /* @__PURE__ */ n("h5", { className: a({ "tw:text-danger": e === "danger" }), children: o }),
533
- /* @__PURE__ */ n(S, { onClick: r, label: "Close dialog" })
605
+ ] }) : /* @__PURE__ */ i(T, { children: [
606
+ /* @__PURE__ */ i(m.Header, { className: w(
607
+ "tw:sticky tw:top-0",
608
+ "tw:flex tw:items-center tw:justify-between tw:gap-x-2"
609
+ ), children: [
610
+ /* @__PURE__ */ n("h5", { className: w({ "tw:text-danger": r === "danger" }), children: o }),
611
+ /* @__PURE__ */ n(j, { onClick: e, label: "Close dialog" })
534
612
  ] }),
535
613
  /* @__PURE__ */ n(m.Body, { children: d }),
536
- y && /* @__PURE__ */ w(
614
+ y && /* @__PURE__ */ i(
537
615
  m.Footer,
538
616
  {
539
617
  "data-testid": "footer",
540
- className: "tw:flex tw:flex-row-reverse tw:gap-x-2 tw:items-center tw:[&]:px-3 tw:sticky tw:bottom-0",
618
+ className: w(
619
+ "tw:flex tw:justify-end tw:items-center tw:gap-x-2",
620
+ "tw:[&]:px-3 tw:sticky tw:bottom-0"
621
+ ),
541
622
  children: [
623
+ /* @__PURE__ */ n(it, { onClick: e, children: "Cancel" }),
542
624
  /* @__PURE__ */ n(
543
- Q,
625
+ wt,
544
626
  {
545
627
  solid: !0,
546
- variant: e === "danger" ? "danger" : "primary",
547
- disabled: x,
628
+ variant: r === "danger" ? "danger" : "primary",
629
+ disabled: v,
548
630
  onClick: y,
549
631
  children: c
550
632
  }
551
- ),
552
- /* @__PURE__ */ n(Z, { onClick: r, children: "Cancel" })
633
+ )
553
634
  ]
554
635
  }
555
636
  )
@@ -558,29 +639,60 @@ const Ct = ({ currentPage: t, pagesCount: r, ...e }) => {
558
639
  )
559
640
  }
560
641
  );
561
- };
642
+ }, qt = ({ className: t, children: e, loading: r = !1, variant: o = "default" }) => /* @__PURE__ */ n(pt, { className: f({ "tw:[&]:border-danger": o === "error" }, t), children: /* @__PURE__ */ i("h3", { className: f("tw:text-center", {
643
+ "tw:text-gray-500 tw:dark:text-gray-400": o === "default",
644
+ "tw:text-danger": o === "error"
645
+ }), children: [
646
+ r && /* @__PURE__ */ i(T, { children: [
647
+ /* @__PURE__ */ n(b, { icon: Z, spin: !0 }),
648
+ /* @__PURE__ */ n("span", { className: "tw:ml-2", children: e ?? "Loading..." })
649
+ ] }),
650
+ !r && e
651
+ ] }) }), Gt = ({ variant: t, className: e, size: r = "md", children: o }) => /* @__PURE__ */ n(
652
+ "div",
653
+ {
654
+ className: f(
655
+ "tw:rounded-md tw:text-center",
656
+ {
657
+ "tw:p-2": r === "sm",
658
+ "tw:p-4": r === "md",
659
+ "tw:p-6": r === "lg",
660
+ "tw:[&]:text-white": t !== "warning",
661
+ "tw:bg-brand": t === "success",
662
+ "tw:bg-danger": t === "error",
663
+ "tw:bg-warning tw:text-black": t === "warning"
664
+ },
665
+ e
666
+ ),
667
+ children: o
668
+ }
669
+ );
562
670
  export {
563
- Q as Button,
671
+ wt as Button,
564
672
  m as Card,
565
- It as CardModal,
566
- S as CloseButton,
567
- v as ELLIPSIS,
568
- j as Input,
569
- H as Label,
570
- yt as LabelledInput,
571
- kt as LabelledSelect,
572
- Z as LinkButton,
573
- mt as ModalDialog,
574
- Ct as Paginator,
575
- vt as SearchInput,
576
- X as Select,
577
- Tt as SimpleCard,
578
- xt as Table,
579
- rt as formatNumber,
580
- dt as keyForPage,
581
- p as pageIsEllipsis,
582
- nt as prettifyPageNumber,
583
- ot as progressivePagination,
584
- Nt as roundTen,
585
- Y as useTimeout
673
+ Wt as CardModal,
674
+ jt as Checkbox,
675
+ j as CloseButton,
676
+ C as ELLIPSIS,
677
+ A as Input,
678
+ W as Label,
679
+ Dt as LabelledInput,
680
+ Ht as LabelledSelect,
681
+ it as LinkButton,
682
+ qt as Message,
683
+ It as ModalDialog,
684
+ Ut as NavPills,
685
+ At as Paginator,
686
+ Gt as Result,
687
+ Ot as SearchInput,
688
+ st as Select,
689
+ pt as SimpleCard,
690
+ Rt as Table,
691
+ $t as ToggleSwitch,
692
+ xt as formatNumber,
693
+ vt as keyForPage,
694
+ k as pageIsEllipsis,
695
+ Nt as prettifyPageNumber,
696
+ kt as progressivePagination,
697
+ zt as roundTen
586
698
  };