@shlinkio/shlink-frontend-kit 0.8.3 → 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/index.d.ts CHANGED
@@ -16,6 +16,8 @@ declare type BooleanControlProps = PropsWithChildren<{
16
16
  inline?: boolean;
17
17
  }>;
18
18
 
19
+ export declare type Callback = () => unknown;
20
+
19
21
  export declare const changeThemeInMarkup: (theme: Theme) => void | undefined;
20
22
 
21
23
  export declare const Checkbox: FC<BooleanControlProps>;
@@ -191,7 +193,7 @@ export declare type Theme = 'dark' | 'light';
191
193
 
192
194
  export declare type TimeoutToggle = typeof useTimeoutToggle;
193
195
 
194
- declare type ToggleResult = [boolean, () => void, () => void, () => void];
196
+ export declare type ToggleResult = [boolean, () => void, () => void, () => void];
195
197
 
196
198
  export declare const ToggleSwitch: FC<BooleanControlProps>;
197
199
 
@@ -203,7 +205,23 @@ export declare const useParsedQuery: <T>() => T;
203
205
 
204
206
  export declare const useTheme: (initialTheme?: Theme) => readonly [Theme, Dispatch<SetStateAction<Theme>>];
205
207
 
206
- export declare const useTimeoutToggle: (initialValue?: boolean, delay?: number, setTimeout?: ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) & typeof globalThis.setTimeout, clearTimeout?: ((id: number | undefined) => void) & typeof globalThis.clearTimeout) => [boolean, () => void];
208
+ export declare function useTimeout(defaultDelay: number,
209
+ /** Test seam. Defaults to global setTimeout */
210
+ setTimeout_?: typeof globalThis.setTimeout,
211
+ /** Test seam. Defaults to global clearTimeout */
212
+ clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
213
+
214
+ export declare type UseTimeoutResult = {
215
+ /**
216
+ * Clears any in-progress timeout, and schedules a new callback.
217
+ * It optionally allows a delay to be provided, or falls back to the default delay otherwise.
218
+ */
219
+ setTimeout: (callback: Callback, delay?: number) => void;
220
+ /** Clears any in-progress timeout */
221
+ clearCurrentTimeout: () => void;
222
+ };
223
+
224
+ export declare const useTimeoutToggle: (initialValue?: boolean, delay?: number, setTimeout_?: typeof setTimeout, clearTimeout_?: typeof clearTimeout) => [boolean, () => void];
207
225
 
208
226
  export declare const useToggle: (initialValue?: boolean) => ToggleResult;
209
227
 
package/dist/index.js CHANGED
@@ -1,17 +1,18 @@
1
- import { jsx as o, jsxs as d, Fragment as N } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as d, Fragment as N } from "react/jsx-runtime";
2
2
  import { faCircleNotch as I, faSearch as A, faEllipsisV as E, faSortAmountUp as F, faSortAmountDown as P } from "@fortawesome/free-solid-svg-icons";
3
- import { FontAwesomeIcon as w } from "@fortawesome/react-fontawesome";
3
+ import { FontAwesomeIcon as g } from "@fortawesome/react-fontawesome";
4
4
  import { clsx as u } from "clsx";
5
- import { Card as _, CardHeader as H, CardBody as M, Dropdown as $, DropdownToggle as k, DropdownMenu as S, NavItem as j, NavLink as G, Nav as U, UncontrolledDropdown as q, DropdownItem as g } from "reactstrap";
6
- import { useId as T, useState as p, useRef as C, useCallback as f, useMemo as Q, Children as V, isValidElement as Y, useEffect as W } from "react";
5
+ import { Card as C, CardHeader as H, CardBody as M, Dropdown as $, DropdownToggle as O, DropdownMenu as k, NavItem as j, NavLink as G, Nav as U, UncontrolledDropdown as q, DropdownItem as w } from "reactstrap";
6
+ import { useId as v, useState as p, useRef as S, useMemo as Q, useCallback as f, Children as V, isValidElement as Y, useEffect as W } from "react";
7
7
  import { useLocation as z, NavLink as J } from "react-router";
8
- const he = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: c = !1 }) => /* @__PURE__ */ o(
9
- _,
8
+ import { u as X } from "./use-timeout-mQ792qNj.js";
9
+ const pe = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: o = !1 }) => /* @__PURE__ */ s(
10
+ C,
10
11
  {
11
12
  body: !0,
12
13
  className: u(e, {
13
- "w-100": c,
14
- "w-75 mx-auto": !c,
14
+ "w-100": o,
15
+ "w-75 mx-auto": !o,
15
16
  "border-danger": n === "error"
16
17
  }),
17
18
  children: /* @__PURE__ */ d(
@@ -22,18 +23,18 @@ const he = ({ className: e, children: r, loading: t = !1, type: n = "default", f
22
23
  "text-danger": n === "error"
23
24
  }),
24
25
  children: [
25
- t && /* @__PURE__ */ o(w, { icon: I, spin: !0 }),
26
- t && /* @__PURE__ */ o("span", { className: "ms-2", children: r ?? "Loading..." }),
26
+ t && /* @__PURE__ */ s(g, { icon: I, spin: !0 }),
27
+ t && /* @__PURE__ */ s("span", { className: "ms-2", children: r ?? "Loading..." }),
27
28
  !t && r
28
29
  ]
29
30
  }
30
31
  )
31
32
  }
32
- ), X = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ d(_, { ...n, children: [
33
- e && /* @__PURE__ */ o(H, { role: "heading", "aria-level": 4, children: e }),
34
- /* @__PURE__ */ o(M, { className: t, children: r })
35
- ] }), fe = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ o(
36
- X,
33
+ ), Z = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ d(C, { ...n, children: [
34
+ e && /* @__PURE__ */ s(H, { role: "heading", "aria-level": 4, children: e }),
35
+ /* @__PURE__ */ s(M, { className: t, children: r })
36
+ ] }), be = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ s(
37
+ Z,
37
38
  {
38
39
  role: "document",
39
40
  className: u("text-center", {
@@ -47,47 +48,47 @@ const he = ({ className: e, children: r, loading: t = !1, type: n = "default", f
47
48
  bodyClassName: u({ "p-2": n }),
48
49
  children: e
49
50
  }
50
- ), x = ({ checked: e = !1, onChange: r, className: t, children: n, type: c, inline: s = !1 }) => {
51
- const l = T(), a = (h) => r == null ? void 0 : r(h.target.checked, h), i = {
52
- "form-switch": c === "switch",
53
- "form-checkbox": c === "checkbox"
54
- }, m = s ? { display: "inline-block" } : {};
51
+ ), y = ({ checked: e = !1, onChange: r, className: t, children: n, type: o, inline: c = !1 }) => {
52
+ const l = v(), a = (h) => r == null ? void 0 : r(h.target.checked, h), i = {
53
+ "form-switch": o === "switch",
54
+ "form-checkbox": o === "checkbox"
55
+ }, m = c ? { display: "inline-block" } : {};
55
56
  return /* @__PURE__ */ d("span", { className: u("form-check", i, t), style: m, children: [
56
- /* @__PURE__ */ o("input", { type: "checkbox", className: "form-check-input", id: l, checked: e, onChange: a }),
57
- /* @__PURE__ */ o("label", { className: "form-check-label", htmlFor: l, children: n })
57
+ /* @__PURE__ */ s("input", { type: "checkbox", className: "form-check-input", id: l, checked: e, onChange: a }),
58
+ /* @__PURE__ */ s("label", { className: "form-check-label", htmlFor: l, children: n })
58
59
  ] });
59
- }, pe = (e) => /* @__PURE__ */ o(x, { type: "checkbox", ...e }), be = (e) => /* @__PURE__ */ o(x, { type: "switch", ...e }), Z = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: c = !1, id: s }) => /* @__PURE__ */ d("div", { className: `${t} ${c ? "" : "mb-3"}`, children: [
60
- /* @__PURE__ */ o("label", { className: `form-label ${n}`, htmlFor: s, children: r }),
60
+ }, ge = (e) => /* @__PURE__ */ s(y, { type: "checkbox", ...e }), we = (e) => /* @__PURE__ */ s(y, { type: "switch", ...e }), B = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: o = !1, id: c }) => /* @__PURE__ */ d("div", { className: `${t} ${o ? "" : "mb-3"}`, children: [
61
+ /* @__PURE__ */ s("label", { className: `form-label ${n}`, htmlFor: c, children: r }),
61
62
  e
62
- ] }), we = ({ children: e, value: r, onChange: t, type: n, required: c, placeholder: s, className: l, labelClassName: a }) => {
63
- const i = T();
64
- return /* @__PURE__ */ o(Z, { label: /* @__PURE__ */ d(N, { children: [
63
+ ] }), Ne = ({ children: e, value: r, onChange: t, type: n, required: o, placeholder: c, className: l, labelClassName: a }) => {
64
+ const i = v();
65
+ return /* @__PURE__ */ s(B, { label: /* @__PURE__ */ d(N, { children: [
65
66
  e,
66
67
  ":"
67
- ] }), className: l, labelClassName: a, id: i, children: /* @__PURE__ */ o(
68
+ ] }), className: l, labelClassName: a, id: i, children: /* @__PURE__ */ s(
68
69
  "input",
69
70
  {
70
71
  id: i,
71
72
  className: "form-control",
72
73
  type: n ?? "text",
73
74
  value: r,
74
- required: c ?? !0,
75
- placeholder: s,
75
+ required: o ?? !0,
76
+ placeholder: c,
76
77
  onChange: (m) => t(m.target.value)
77
78
  }
78
79
  ) });
79
- }, B = 500;
80
+ }, K = 500;
80
81
  let b;
81
- const v = () => {
82
+ const _ = () => {
82
83
  b !== null && clearTimeout(b), b = null;
83
- }, ge = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: c = "", setTimeout_: s = setTimeout }) => {
84
- const [l, a] = p(c), i = (m, h = B) => {
85
- a(m), v(), b = s(() => {
86
- e(m), v();
84
+ }, Ce = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: o = "", setTimeout_: c = setTimeout }) => {
85
+ const [l, a] = p(o), i = (m, h = K) => {
86
+ a(m), _(), b = c(() => {
87
+ e(m), _();
87
88
  }, h);
88
89
  };
89
90
  return /* @__PURE__ */ d("div", { className: u("search-field", r), children: [
90
- /* @__PURE__ */ o(
91
+ /* @__PURE__ */ s(
91
92
  "input",
92
93
  {
93
94
  type: "text",
@@ -100,8 +101,8 @@ const v = () => {
100
101
  onChange: (m) => i(m.target.value)
101
102
  }
102
103
  ),
103
- /* @__PURE__ */ o(w, { icon: A, className: "search-field__icon" }),
104
- /* @__PURE__ */ o(
104
+ /* @__PURE__ */ s(g, { icon: A, className: "search-field__icon" }),
105
+ /* @__PURE__ */ s(
105
106
  "button",
106
107
  {
107
108
  "aria-label": "Clear search",
@@ -113,56 +114,56 @@ const v = () => {
113
114
  }
114
115
  )
115
116
  ] });
116
- }, K = (e) => {
117
+ }, Te = () => S(null), ee = (e) => {
117
118
  const r = new URLSearchParams(e), t = {};
118
- return r.forEach((n, c) => {
119
- if (c.endsWith("[]")) {
120
- const s = c.slice(0, -2);
121
- t[s] ?? (t[s] = []), t[s].push(n);
119
+ return r.forEach((n, o) => {
120
+ if (o.endsWith("[]")) {
121
+ const c = o.slice(0, -2);
122
+ t[c] ?? (t[c] = []), t[c].push(n);
122
123
  } else
123
- t[c] = n;
124
+ t[o] = n;
124
125
  }), t;
125
- }, Ne = (e) => {
126
+ }, _e = (e) => {
126
127
  const r = new URLSearchParams();
127
128
  for (const [t, n] of Object.entries(e))
128
- n !== void 0 && (Array.isArray(n) ? n.forEach((c) => r.append(`${t}[]`, `${c}`)) : r.append(t, `${n}`));
129
+ n !== void 0 && (Array.isArray(n) ? n.forEach((o) => r.append(`${t}[]`, `${o}`)) : r.append(t, `${n}`));
129
130
  return r.toString();
130
- }, ee = (e = !1) => {
131
- const [r, t] = p(e), n = f(() => t((l) => !l), []), c = f(() => t(!0), []), s = f(() => t(!1), []);
132
- return [r, n, c, s];
133
- }, Ce = (e = !1, r = 2e3, t = window.setTimeout, n = window.clearTimeout) => {
134
- const [c, s] = p(e), l = C(e), a = C(void 0), i = f(() => {
135
- s(!l.current), a.current && n(a.current), a.current = t(() => s(l.current), r);
136
- }, [n, r, t]);
137
- return [c, i];
138
- }, _e = () => C(null), Oe = () => {
131
+ }, Oe = () => {
139
132
  const { search: e } = z();
140
- return Q(() => K(e), [e]);
141
- }, re = ({
133
+ return Q(() => ee(e), [e]);
134
+ }, ke = (e = !1, r = 2e3, t = globalThis.setTimeout.bind(globalThis), n = globalThis.clearTimeout.bind(globalThis)) => {
135
+ const { setTimeout: o } = X(r, t, n), [c, l] = p(e), a = S(e), i = f(() => {
136
+ l(!a.current), o(() => l(a.current));
137
+ }, [o]);
138
+ return [c, i];
139
+ }, re = (e = !1) => {
140
+ const [r, t] = p(e), n = f(() => t((l) => !l), []), o = f(() => t(!0), []), c = f(() => t(!1), []);
141
+ return [r, n, o, c];
142
+ }, te = ({
142
143
  text: e,
143
144
  disabled: r = !1,
144
145
  className: t,
145
146
  children: n,
146
- dropdownClassName: c,
147
- noCaret: s,
147
+ dropdownClassName: o,
148
+ noCaret: c,
148
149
  end: l = !1,
149
150
  minWidth: a,
150
151
  inline: i,
151
152
  size: m,
152
153
  ...h
153
154
  }) => {
154
- const [y, L] = ee(), D = u("dropdown-btn__toggle", t, {
155
+ const [x, L] = re(), D = u("dropdown-btn__toggle", t, {
155
156
  "btn-block": !i,
156
- "dropdown-btn__toggle--with-caret": !s
157
+ "dropdown-btn__toggle--with-caret": !c
157
158
  }), R = { minWidth: a && `${a}px` };
158
- return /* @__PURE__ */ d($, { isOpen: y, toggle: L, disabled: r, className: c, children: [
159
- /* @__PURE__ */ o(k, { size: m, caret: !s, className: D, color: "primary", ...h, children: e }),
160
- /* @__PURE__ */ o(S, { className: "w-100", end: l, style: R, children: n })
159
+ return /* @__PURE__ */ d($, { isOpen: x, toggle: L, disabled: r, className: o, children: [
160
+ /* @__PURE__ */ s(O, { size: m, caret: !c, className: D, color: "primary", ...h, children: e }),
161
+ /* @__PURE__ */ s(k, { className: "w-100", end: l, style: R, children: n })
161
162
  ] });
162
- }, ve = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ o(
163
- re,
163
+ }, ve = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ s(
164
+ te,
164
165
  {
165
- text: /* @__PURE__ */ o(w, { className: "px-1", icon: E }),
166
+ text: /* @__PURE__ */ s(g, { className: "px-1", icon: E }),
166
167
  "aria-label": t,
167
168
  size: "sm",
168
169
  minWidth: r,
@@ -171,41 +172,41 @@ const v = () => {
171
172
  inline: !0,
172
173
  children: e
173
174
  }
174
- ), te = ({ children: e, ...r }) => /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(G, { className: "nav-pills__nav-link", tag: J, ...r, children: e }) }), ke = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ o(_, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ o(U, { pills: !0, fill: r, children: V.map(e, (n) => {
175
- if (!Y(n) || n.type !== te)
175
+ ), ne = ({ children: e, ...r }) => /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s(G, { className: "nav-pills__nav-link", tag: J, ...r, children: e }) }), Se = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ s(C, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ s(U, { pills: !0, fill: r, children: V.map(e, (n) => {
176
+ if (!Y(n) || n.type !== ne)
176
177
  throw new Error("Only NavPillItem children are allowed inside NavPills.");
177
178
  return n;
178
179
  }) }) });
179
- function O(e, r, t) {
180
- return typeof e == "object" ? O(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
180
+ function T(e, r, t) {
181
+ return typeof e == "object" ? T(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
181
182
  ASC: "DESC",
182
183
  DESC: void 0
183
184
  }[t] : "ASC";
184
185
  }
185
- function ne(e, r, t) {
186
- return typeof e == "object" ? ne(e.currentField, e.newField, e.currentOrderDir) : {
186
+ function se(e, r, t) {
187
+ return typeof e == "object" ? se(e.currentField, e.newField, e.currentOrderDir) : {
187
188
  field: r,
188
- dir: O(e, r, t)
189
+ dir: T(e, r, t)
189
190
  };
190
191
  }
191
- const Se = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, c) => {
192
- const s = t === "ASC" ? 1 : -1, l = t === "ASC" ? -1 : 1;
193
- return n[r] > c[r] ? s : l;
194
- }), Te = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, xe = (e) => {
192
+ const ye = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, o) => {
193
+ const c = t === "ASC" ? 1 : -1, l = t === "ASC" ? -1 : 1;
194
+ return n[r] > o[r] ? c : l;
195
+ }), xe = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, Le = (e) => {
195
196
  const [r, t] = e.split("-");
196
197
  return { field: r, dir: t };
197
- }, ye = (e) => {
198
- const [r, t] = p(e), n = f((c, s) => t({ field: c, dir: s }), []);
198
+ }, De = (e) => {
199
+ const [r, t] = p(e), n = f((o, c) => t({ field: o, dir: c }), []);
199
200
  return [r, n];
200
201
  };
201
- function Le({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1, prefixed: s = !0 }) {
202
+ function Re({ items: e, order: r, onChange: t, isButton: n = !0, right: o = !1, prefixed: c = !0 }) {
202
203
  const l = (a) => () => {
203
- const i = O(a, r.field, r.dir);
204
+ const i = T(a, r.field, r.dir);
204
205
  t(i ? a : void 0, i);
205
206
  };
206
207
  return /* @__PURE__ */ d(q, { children: [
207
208
  /* @__PURE__ */ d(
208
- k,
209
+ O,
209
210
  {
210
211
  caret: !0,
211
212
  color: n ? "primary" : "link",
@@ -214,82 +215,83 @@ function Le({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1,
214
215
  "btn-sm p-0": !n
215
216
  }),
216
217
  children: [
217
- !n && /* @__PURE__ */ o(N, { children: "Order by" }),
218
- n && !r.field && /* @__PURE__ */ o("i", { children: "Order by..." }),
218
+ !n && /* @__PURE__ */ s(N, { children: "Order by" }),
219
+ n && !r.field && /* @__PURE__ */ s("i", { children: "Order by..." }),
219
220
  n && r.field && /* @__PURE__ */ d(N, { children: [
220
- s && "Order by: ",
221
+ c && "Order by: ",
221
222
  e[r.field],
222
223
  " - ",
223
- /* @__PURE__ */ o("small", { children: r.dir ?? "DESC" })
224
+ /* @__PURE__ */ s("small", { children: r.dir ?? "DESC" })
224
225
  ] })
225
226
  ]
226
227
  }
227
228
  ),
228
- /* @__PURE__ */ d(S, { end: c, className: "w-100", style: n ? void 0 : { minWidth: "11rem" }, children: [
229
+ /* @__PURE__ */ d(k, { end: o, className: "w-100", style: n ? void 0 : { minWidth: "11rem" }, children: [
229
230
  Object.entries(e).map(([a, i]) => /* @__PURE__ */ d(
230
- g,
231
+ w,
231
232
  {
232
233
  active: r.field === a,
233
234
  onClick: l(a),
234
235
  className: "d-flex justify-content-between align-items-center",
235
236
  children: [
236
237
  i,
237
- r.field === a && /* @__PURE__ */ o(w, { icon: r.dir === "ASC" ? F : P })
238
+ r.field === a && /* @__PURE__ */ s(g, { icon: r.dir === "ASC" ? F : P })
238
239
  ]
239
240
  },
240
241
  a
241
242
  )),
242
- /* @__PURE__ */ o(g, { divider: !0 }),
243
- /* @__PURE__ */ o(g, { disabled: !r.field, onClick: () => t(), children: /* @__PURE__ */ o("i", { children: "Clear selection" }) })
243
+ /* @__PURE__ */ s(w, { divider: !0 }),
244
+ /* @__PURE__ */ s(w, { disabled: !r.field, onClick: () => t(), children: /* @__PURE__ */ s("i", { children: "Clear selection" }) })
244
245
  ] })
245
246
  ] });
246
247
  }
247
- const De = "#4696e5", Re = "rgba(70, 150, 229, 0.4)", Ie = "#f77f28", Ae = "rgba(247, 127, 40, 0.4)", Ee = "white", Fe = "#161b22", oe = (e) => {
248
+ const Ie = "#4696e5", Ae = "rgba(70, 150, 229, 0.4)", Ee = "#f77f28", Fe = "rgba(247, 127, 40, 0.4)", Pe = "white", He = "#161b22", oe = (e) => {
248
249
  var r;
249
250
  return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", e);
250
- }, Pe = () => {
251
+ }, Me = () => {
251
252
  var e;
252
253
  return ((e = document.querySelector("html")) == null ? void 0 : e.getAttribute("data-theme")) === "dark";
253
- }, ce = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", He = (e) => {
254
+ }, ce = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", $e = (e) => {
254
255
  const [r, t] = p(() => e ?? ce());
255
256
  return W(() => {
256
257
  oe(r);
257
258
  }, [r]), [r, t];
258
259
  };
259
260
  export {
260
- pe as Checkbox,
261
- re as DropdownBtn,
262
- Ie as HIGHLIGHTED_COLOR,
263
- Ae as HIGHLIGHTED_COLOR_ALPHA,
264
- we as InputFormGroup,
265
- Z as LabeledFormGroup,
266
- De as MAIN_COLOR,
267
- Re as MAIN_COLOR_ALPHA,
268
- he as Message,
269
- te as NavPillItem,
270
- ke as NavPills,
271
- Le as OrderingDropdown,
272
- Fe as PRIMARY_DARK_COLOR,
273
- Ee as PRIMARY_LIGHT_COLOR,
274
- fe as Result,
261
+ ge as Checkbox,
262
+ te as DropdownBtn,
263
+ Ee as HIGHLIGHTED_COLOR,
264
+ Fe as HIGHLIGHTED_COLOR_ALPHA,
265
+ Ne as InputFormGroup,
266
+ B as LabeledFormGroup,
267
+ Ie as MAIN_COLOR,
268
+ Ae as MAIN_COLOR_ALPHA,
269
+ pe as Message,
270
+ ne as NavPillItem,
271
+ Se as NavPills,
272
+ Re as OrderingDropdown,
273
+ He as PRIMARY_DARK_COLOR,
274
+ Pe as PRIMARY_LIGHT_COLOR,
275
+ be as Result,
275
276
  ve as RowDropdownBtn,
276
- ge as SearchField,
277
- X as SimpleCard,
278
- be as ToggleSwitch,
277
+ Ce as SearchField,
278
+ Z as SimpleCard,
279
+ we as ToggleSwitch,
279
280
  oe as changeThemeInMarkup,
280
- ne as determineOrder,
281
- O as determineOrderDir,
281
+ se as determineOrder,
282
+ T as determineOrderDir,
282
283
  ce as getSystemPreferredTheme,
283
- Pe as isDarkThemeEnabled,
284
- Te as orderToString,
285
- K as parseQueryString,
286
- Se as sortList,
287
- xe as stringToOrder,
288
- Ne as stringifyQueryParams,
289
- _e as useElementRef,
290
- ye as useOrder,
284
+ Me as isDarkThemeEnabled,
285
+ xe as orderToString,
286
+ ee as parseQueryString,
287
+ ye as sortList,
288
+ Le as stringToOrder,
289
+ _e as stringifyQueryParams,
290
+ Te as useElementRef,
291
+ De as useOrder,
291
292
  Oe as useParsedQuery,
292
- He as useTheme,
293
- Ce as useTimeoutToggle,
294
- ee as useToggle
293
+ $e as useTheme,
294
+ X as useTimeout,
295
+ ke as useTimeoutToggle,
296
+ re as useToggle
295
297
  };
@@ -26,8 +26,6 @@ export declare type ButtonProps = PropsWithChildren<{
26
26
  solid?: boolean;
27
27
  } & (RegularButtonProps | LinkButtonProps_2)>;
28
28
 
29
- export declare type Callback = () => unknown;
30
-
31
29
  export declare const Card: FC<CardProps> & {
32
30
  Body: FC<CardProps>;
33
31
  Header: FC<CardProps>;
@@ -268,20 +266,4 @@ export declare const ToggleSwitch: FC<ToggleSwitchProps>;
268
266
 
269
267
  export declare type ToggleSwitchProps = BooleanControlProps;
270
268
 
271
- export declare function useTimeout(defaultDelay: number,
272
- /** Test seam. Defaults to global setTimeout */
273
- setTimeout_?: typeof globalThis.setTimeout,
274
- /** Test seam. Defaults to global clearTimeout */
275
- clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
276
-
277
- export declare type UseTimeoutResult = {
278
- /**
279
- * Clears any in-progress timeout, and schedules a new callback.
280
- * It optionally allows a delay to be provided, or falls back to the default delay otherwise.
281
- */
282
- setTimeout: (callback: Callback, delay?: number) => void;
283
- /** Clears any in-progress timeout */
284
- clearCurrentTimeout: () => void;
285
- };
286
-
287
269
  export { }
package/dist/tailwind.js CHANGED
@@ -1,51 +1,53 @@
1
- import { jsx as n, jsxs as i, Fragment as B } from "react/jsx-runtime";
2
- import s, { clsx as f } from "clsx";
3
- import { createContext as F, useContext as g, useCallback as N, useId as $, useRef as R, useEffect as T, useMemo as E, useState as Q } from "react";
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
4
  import { Link as U, NavLink as V } from "react-router";
5
- import { faClose as X, faSearch as Y, faChevronLeft as j, faChevronRight as D, faCircleNotch as Z } from "@fortawesome/free-solid-svg-icons";
5
+ import { faClose as X, faSearch as Y, faChevronLeft as M, faChevronRight as R, faCircleNotch as Z } from "@fortawesome/free-solid-svg-icons";
6
6
  import { FontAwesomeIcon as b } from "@fortawesome/react-fontawesome";
7
- const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className: e }) => {
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 }) => {
8
10
  const { responsive: r } = g(x);
9
- return /* @__PURE__ */ n(v.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
11
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
10
12
  "thead",
11
13
  {
12
- className: s(
14
+ className: w(
13
15
  { "tw:hidden tw:lg:table-header-group": r },
14
16
  e
15
17
  ),
16
18
  children: t
17
19
  }
18
20
  ) });
19
- }, et = ({ children: t, className: e }) => {
21
+ }, ot = ({ children: t, className: e }) => {
20
22
  const { responsive: r } = g(x);
21
- return /* @__PURE__ */ n(v.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
23
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
22
24
  "tbody",
23
25
  {
24
- className: s(
26
+ className: w(
25
27
  { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": r },
26
28
  e
27
29
  ),
28
30
  children: t
29
31
  }
30
32
  ) });
31
- }, rt = ({ children: t, className: e }) => {
33
+ }, nt = ({ children: t, className: e }) => {
32
34
  const { responsive: r } = g(x);
33
- return /* @__PURE__ */ n(v.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
35
+ return /* @__PURE__ */ n(N.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
34
36
  "tfoot",
35
37
  {
36
- className: s(
38
+ className: w(
37
39
  { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": r },
38
40
  e
39
41
  ),
40
42
  children: t
41
43
  }
42
44
  ) });
43
- }, ot = ({ children: t, className: e, ...r }) => {
44
- const o = g(v), d = (o == null ? void 0 : o.section) === "body", { responsive: a } = g(x);
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: s(
50
+ className: w(
49
51
  "tw:group",
50
52
  {
51
53
  "tw:lg:table-row tw:flex tw:flex-col": a,
@@ -60,19 +62,19 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
60
62
  children: t
61
63
  }
62
64
  );
63
- }, nt = ({ children: t, className: e, columnName: r, type: o, ...d }) => {
64
- const a = g(v), l = o ?? ((a == null ? void 0 : a.section) !== "body" ? "th" : "td"), { responsive: w } = g(x);
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
68
  l,
67
69
  {
68
- "data-column": w ? r : void 0,
69
- className: s(
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": !w,
73
- "tw:block tw:lg:table-cell tw:not-last:border-b-1 tw:lg:border-b-1": w,
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": w && l === "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
79
  e
78
80
  ),
@@ -80,11 +82,11 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
80
82
  children: t
81
83
  }
82
84
  );
83
- }, dt = ({ 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: [
84
- /* @__PURE__ */ n(tt, { children: t }),
85
- /* @__PURE__ */ n(et, { children: r }),
86
- e && /* @__PURE__ */ n(rt, { children: e })
87
- ] }) }), Rt = Object.assign(dt, { Row: ot, Cell: nt }), lt = ({
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
91
  className: e,
90
92
  disabled: r,
@@ -92,15 +94,15 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
92
94
  size: d = "md",
93
95
  inline: a = !1,
94
96
  solid: l = !1,
95
- ...w
97
+ ...s
96
98
  }) => {
97
- const c = "to" in w ? U : "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: s(
105
+ className: w(
104
106
  {
105
107
  "tw:inline-flex": a,
106
108
  "tw:flex": !a
@@ -145,13 +147,13 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
145
147
  e
146
148
  ),
147
149
  disabled: r,
148
- ...w,
150
+ ...s,
149
151
  children: t
150
152
  }
151
153
  )
152
154
  );
153
155
  }, z = ({ className: t, onChange: e, ...r }) => {
154
- const o = N((d) => e == null ? void 0 : e(d.target.checked, d), [e]);
156
+ const o = F((d) => e == null ? void 0 : e(d.target.checked, d), [e]);
155
157
  return /* @__PURE__ */ n(
156
158
  "input",
157
159
  {
@@ -168,17 +170,17 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
168
170
  ...r
169
171
  }
170
172
  );
171
- }, Et = ({ className: t, ...e }) => /* @__PURE__ */ n(
173
+ }, jt = ({ className: t, ...e }) => /* @__PURE__ */ n(
172
174
  z,
173
175
  {
174
176
  className: f("tw:rounded-sm tw:w-4 tw:h-4 tw:checked:bg-(image:--tick) tw:bg-center", t),
175
177
  ...e
176
178
  }
177
- ), H = ({ onClick: t, label: e = "Close" }) => /* @__PURE__ */ n(
179
+ ), j = ({ onClick: t, label: e = "Close" }) => /* @__PURE__ */ n(
178
180
  "button",
179
181
  {
180
182
  onClick: t,
181
- className: s(
183
+ className: w(
182
184
  "tw:opacity-50 tw:highlight:opacity-80 tw:transition-opacity",
183
185
  "tw:rounded-md tw:focus-ring"
184
186
  ),
@@ -194,11 +196,11 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
194
196
  readOnly: a,
195
197
  ...l
196
198
  }) => {
197
- const w = !d && !a;
199
+ const s = !d && !a;
198
200
  return /* @__PURE__ */ n(
199
201
  "input",
200
202
  {
201
- className: s(
203
+ className: w(
202
204
  "tw:w-full",
203
205
  {
204
206
  "tw:focus-ring": !r,
@@ -213,10 +215,10 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
213
215
  "tw:rounded-md tw:border": !t,
214
216
  "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !r,
215
217
  "tw:border-danger": !t && r === "error",
216
- "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !w,
217
- "tw:bg-lm-primary tw:dark:bg-dm-primary": w,
218
+ "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !s,
219
+ "tw:bg-lm-primary tw:dark:bg-dm-primary": s,
218
220
  // Use different background color when rendered inside a card
219
- "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": w
221
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": s
220
222
  },
221
223
  o
222
224
  ),
@@ -228,8 +230,8 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
228
230
  }, W = ({ required: t, children: e, ...r }) => /* @__PURE__ */ i("label", { ...r, children: [
229
231
  e,
230
232
  t && /* @__PURE__ */ n("span", { className: "tw:text-danger tw:ml-1", "data-testid": "required-indicator", children: "*" })
231
- ] }), Mt = ({ label: t, inputClassName: e, required: r, hiddenRequired: o, error: d, ...a }) => {
232
- const l = $();
233
+ ] }), Dt = ({ label: t, inputClassName: e, required: r, hiddenRequired: o, error: d, ...a }) => {
234
+ const l = H();
233
235
  return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
234
236
  /* @__PURE__ */ n(W, { htmlFor: l, required: r, children: t }),
235
237
  /* @__PURE__ */ n(
@@ -244,7 +246,7 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
244
246
  ),
245
247
  d && /* @__PURE__ */ n("span", { className: "tw:text-danger", children: d })
246
248
  ] });
247
- }, at = ({
249
+ }, st = ({
248
250
  className: t,
249
251
  size: e = "md",
250
252
  feedback: r,
@@ -254,7 +256,7 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
254
256
  }) => /* @__PURE__ */ n(
255
257
  "select",
256
258
  {
257
- className: s(
259
+ className: w(
258
260
  "tw:w-full tw:appearance-none tw:pr-9",
259
261
  "tw:bg-(image:--chevron-down) tw:bg-no-repeat",
260
262
  {
@@ -283,27 +285,13 @@ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className:
283
285
  disabled: d,
284
286
  ...a
285
287
  }
286
- ), _t = ({ selectClassName: t, label: e, required: r, hiddenRequired: o, ...d }) => {
287
- const a = $();
288
+ ), Ht = ({ selectClassName: t, label: e, required: r, hiddenRequired: o, ...d }) => {
289
+ const a = H();
288
290
  return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
289
291
  /* @__PURE__ */ n(W, { htmlFor: a, required: r, children: e }),
290
- /* @__PURE__ */ n(at, { id: a, className: t, required: r || o, ...d })
292
+ /* @__PURE__ */ n(st, { id: a, className: t, required: r || o, ...d })
291
293
  ] });
292
- };
293
- function st(t, e = globalThis.setTimeout.bind(globalThis), r = globalThis.clearTimeout.bind(globalThis)) {
294
- const o = R(null), d = N(() => {
295
- o.current && r(o.current);
296
- }, [r]), a = N((l, w) => {
297
- d(), o.current = e(() => {
298
- l(), o.current = null;
299
- }, w ?? t);
300
- }, [d, t, e]);
301
- return T(() => d, [d]), E(
302
- () => ({ setTimeout: a, clearCurrentTimeout: d }),
303
- [d, a]
304
- );
305
- }
306
- const jt = ({
294
+ }, Ot = ({
307
295
  onChange: t,
308
296
  containerClassName: e,
309
297
  inputClassName: r,
@@ -311,15 +299,15 @@ const jt = ({
311
299
  size: o = "lg",
312
300
  ...d
313
301
  }) => {
314
- const { setTimeout: a, clearCurrentTimeout: l } = st(500), w = N((c) => {
302
+ const { setTimeout: a, clearCurrentTimeout: l } = et(500), s = F((c) => {
315
303
  c ? a(() => t(c)) : (l(), t(c));
316
304
  }, [l, t, a]);
317
- return /* @__PURE__ */ i("div", { className: s("tw:group tw:relative tw:focus-within:z-10", e), children: [
305
+ return /* @__PURE__ */ i("div", { className: w("tw:group tw:relative tw:focus-within:z-10", e), children: [
318
306
  /* @__PURE__ */ n(
319
307
  b,
320
308
  {
321
309
  icon: Y,
322
- className: s(
310
+ className: w(
323
311
  "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:transition-colors",
324
312
  "tw:text-placeholder tw:group-focus-within:text-lm-text tw:dark:group-focus-within:text-dm-text",
325
313
  {
@@ -333,7 +321,7 @@ const jt = ({
333
321
  A,
334
322
  {
335
323
  type: "search",
336
- className: s(
324
+ className: w(
337
325
  {
338
326
  "tw:pl-9": o !== "sm",
339
327
  "tw:pl-7": o === "sm"
@@ -341,13 +329,13 @@ const jt = ({
341
329
  r
342
330
  ),
343
331
  placeholder: "Search...",
344
- onChange: (c) => w(c.target.value),
332
+ onChange: (c) => s(c.target.value),
345
333
  size: o,
346
334
  ...d
347
335
  }
348
336
  )
349
337
  ] });
350
- }, Dt = ({ className: t, ...e }) => /* @__PURE__ */ n(
338
+ }, $t = ({ className: t, ...e }) => /* @__PURE__ */ n(
351
339
  z,
352
340
  {
353
341
  className: f(
@@ -359,10 +347,10 @@ const jt = ({
359
347
  ),
360
348
  ...e
361
349
  }
362
- ), wt = ({ className: t, disabled: e, size: r = "md", ...o }) => /* @__PURE__ */ n(
350
+ ), it = ({ className: t, disabled: e, size: r = "md", ...o }) => /* @__PURE__ */ n(
363
351
  "button",
364
352
  {
365
- className: s(
353
+ className: w(
366
354
  "tw:inline-flex tw:rounded-md tw:focus-ring",
367
355
  "tw:text-brand tw:highlight:text-brand-dark tw:highlight:underline",
368
356
  {
@@ -376,47 +364,47 @@ const jt = ({
376
364
  disabled: e,
377
365
  ...o
378
366
  }
379
- ), it = ({ className: t, ...e }) => /* @__PURE__ */ n(
367
+ ), ct = ({ className: t, ...e }) => /* @__PURE__ */ n(
380
368
  "div",
381
369
  {
382
- className: s(
370
+ className: w(
383
371
  "tw:px-4 tw:py-3 tw:rounded-t-md",
384
372
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-b tw:border-lm-border tw:dark:border-dm-border",
385
373
  t
386
374
  ),
387
375
  ...e
388
376
  }
389
- ), ct = ({ className: t, ...e }) => /* @__PURE__ */ n(
377
+ ), mt = ({ className: t, ...e }) => /* @__PURE__ */ n(
390
378
  "div",
391
379
  {
392
- className: s(
380
+ className: w(
393
381
  "tw:p-4 tw:bg-lm-primary tw:dark:bg-dm-primary tw:first:rounded-t-md",
394
382
  "tw:first:rounded-t-md tw:last:rounded-b-md",
395
383
  t
396
384
  ),
397
385
  ...e
398
386
  }
399
- ), mt = ({ className: t, ...e }) => /* @__PURE__ */ n(
387
+ ), gt = ({ className: t, ...e }) => /* @__PURE__ */ n(
400
388
  "div",
401
389
  {
402
- className: s(
390
+ className: w(
403
391
  "tw:px-4 tw:py-3 tw:rounded-b-md",
404
392
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-t tw:border-lm-border tw:dark:border-dm-border",
405
393
  t
406
394
  ),
407
395
  ...e
408
396
  }
409
- ), gt = ({ className: t, ...e }) => /* @__PURE__ */ n(
397
+ ), bt = ({ className: t, ...e }) => /* @__PURE__ */ n(
410
398
  "div",
411
399
  {
412
- className: s(
400
+ className: w(
413
401
  "tw:group/card tw:rounded-md tw:shadow-md",
414
402
  "tw:border tw:border-lm-border tw:dark:border-dm-border tw:bg-lm-primary tw:dark:bg-dm-primary",
415
403
  t
416
404
  ),
417
405
  ...e
418
406
  }
419
- ), m = Object.assign(gt, { Body: ct, Header: it, Footer: mt }), bt = ({ bodyClassName: t, children: e, ...r }) => {
407
+ ), m = Object.assign(bt, { Body: mt, Header: ct, Footer: gt }), pt = ({ bodyClassName: t, children: e, ...r }) => {
420
408
  const { title: o, titleSize: d = "md", ...a } = "title" in r ? r : {
421
409
  ...r,
422
410
  title: void 0,
@@ -430,14 +418,14 @@ const jt = ({
430
418
  ] }),
431
419
  /* @__PURE__ */ n(m.Body, { className: t, children: e })
432
420
  ] });
433
- }, q = F(null), ut = ({ className: t, to: e, ...r }) => {
421
+ }, q = S(null), ht = ({ className: t, to: e, ...r }) => {
434
422
  const o = g(q);
435
423
  return /* @__PURE__ */ n(
436
424
  V,
437
425
  {
438
426
  role: "menuitem",
439
427
  to: e,
440
- className: ({ isActive: d }) => s(
428
+ className: ({ isActive: d }) => w(
441
429
  "tw:px-4 tw:pt-2 tw:pb-[calc(0.5rem-3px)] tw:border-b-3",
442
430
  "tw:font-bold tw:no-underline tw:text-center tw:highlight:text-brand tw:transition-colors",
443
431
  "tw:rounded-none tw:outline-none tw:focus-visible:inset-ring-2 tw:focus-visible:inset-ring-brand/50",
@@ -451,16 +439,16 @@ const jt = ({
451
439
  ...r
452
440
  }
453
441
  );
454
- }, ht = ({ children: t, className: e, fill: r }) => /* @__PURE__ */ n(q.Provider, { value: { fill: r }, children: /* @__PURE__ */ n(m, { role: "menubar", className: s("tw:flex tw:overflow-hidden", e), children: t }) }), Ht = Object.assign(ht, { Pill: ut }), pt = new Intl.NumberFormat("en-US"), ft = (t) => pt.format(Number(t)), O = 10, Ot = (t) => Math.ceil(t / O) * O, p = 2, I = "...", xt = (t, e) => Array.from({ length: e - t }, (r, o) => t + o), yt = (t, e) => {
455
- const r = xt(
456
- Math.max(p, t - p),
457
- Math.min(e - 1, t + p) + 1
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
458
446
  );
459
- return t - p > p && r.unshift(I), t + p < e - 1 && r.push(I), r.unshift(1), r.push(e), r;
460
- }, k = (t) => t === I, kt = (t) => k(t) ? t : ft(t), Nt = (t, e) => k(t) ? `${t}_${e}` : `${t}`, G = [
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 = [
461
449
  "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
462
450
  "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
463
- ], J = (t = !1) => s(
451
+ ], J = (t = !1) => w(
464
452
  G,
465
453
  "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
466
454
  "tw:focus-ring tw:focus-visible:z-1",
@@ -468,66 +456,69 @@ const jt = ({
468
456
  "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
469
457
  "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
470
458
  }
471
- ), S = ({ children: t }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: s(G, "tw:px-3 py-2 tw:text-gray-400"), children: t }), K = () => /* @__PURE__ */ n(S, { children: I });
472
- function vt({ children: t, active: e, isEllipsis: r, href: o, ...d }) {
473
- const a = E(() => J(e), [e]);
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]);
474
462
  return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n(U, { className: a, to: o, ...d, children: t });
475
463
  }
476
- function Pt({ children: t, active: e, isEllipsis: r, ...o }) {
477
- const d = E(() => J(e), [e]);
464
+ function Ct({ children: t, active: e, isEllipsis: r, ...o }) {
465
+ const d = O(() => J(e), [e]);
478
466
  return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n("button", { type: "button", className: d, ...o, children: t });
479
467
  }
480
- const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
481
- const o = "urlForPage" in r, d = o ? vt : Pt, a = N(
468
+ const At = ({ currentPage: t, pagesCount: e, ...r }) => {
469
+ const o = "urlForPage" in r, d = o ? Pt : Ct, a = F(
482
470
  (l) => o ? { href: k(l) ? void 0 : r.urlForPage(l) } : { onClick: () => !k(l) && r.onPageChange(l) },
483
471
  [o, r]
484
472
  );
485
473
  return e < 2 ? null : /* @__PURE__ */ i("div", { className: "tw:select-none tw:flex", "data-testid": "paginator", children: [
486
- t === 1 ? /* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(b, { size: "xs", icon: j }) }) : /* @__PURE__ */ n(d, { ...a(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ n(b, { size: "xs", icon: j }) }),
487
- yt(t, e).map((l, w) => /* @__PURE__ */ n(
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(
488
476
  d,
489
477
  {
490
478
  active: l === t,
491
479
  isEllipsis: k(l),
492
480
  ...a(l),
493
- children: kt(l)
481
+ children: Nt(l)
494
482
  },
495
- Nt(l, w)
483
+ vt(l, s)
496
484
  )),
497
- t === e ? /* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(b, { size: "xs", icon: D }) }) : /* @__PURE__ */ n(d, { ...a(Math.min(e, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(b, { size: "xs", icon: D }) })
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 }) })
498
486
  ] });
499
- }, Ct = ({
487
+ }, It = ({
500
488
  open: t,
501
489
  children: e,
502
490
  className: r,
503
491
  onClose: o,
504
492
  ...d
505
493
  }) => {
506
- const a = R(null);
507
- return T(() => {
508
- var P, y;
509
- const l = document.body, w = l.style.overflow, c = 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;
510
498
  if (t) {
511
- const L = window.outerWidth - l.clientWidth, u = l.scrollHeight > l.clientHeight;
512
- l.style.overflow = "hidden", u && (l.style.paddingRight = `${L}px`), (P = a.current) == null || P.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();
513
501
  } else
514
502
  (y = a.current) == null || y.close();
515
503
  return () => {
516
- l.style.overflow = w, l.style.paddingRight = c;
504
+ l.style.overflow = s, l.style.paddingRight = c;
517
505
  };
518
- }, [t]), /* @__PURE__ */ n(
519
- "dialog",
520
- {
521
- ref: a,
522
- className: s("tw:bg-transparent tw:backdrop:bg-black/50", r),
523
- onCancel: (l) => {
524
- l.preventDefault(), o();
525
- },
526
- ...d,
527
- children: t && e
528
- }
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
529
520
  );
530
- }, Ut = ({
521
+ }, Wt = ({
531
522
  open: t,
532
523
  onClose: e,
533
524
  variant: r = "default",
@@ -537,68 +528,68 @@ const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
537
528
  ...l
538
529
  }) => {
539
530
  const {
540
- size: w = "md",
531
+ size: s = "md",
541
532
  confirmText: c = "Confirm",
542
- confirmDisabled: P,
533
+ confirmDisabled: v,
543
534
  onConfirm: y,
544
- ...L
545
- } = "onConfirm" in l ? l : { ...l }, [u, M] = Q(t), C = R(null);
546
- return T(() => {
535
+ ...I
536
+ } = "onConfirm" in l ? l : { ...l }, [p, _] = Q(t), P = $(null);
537
+ return L(() => {
547
538
  if (t) {
548
- M(!0);
539
+ _(!0);
549
540
  return;
550
541
  }
551
- const h = C.current;
542
+ const h = P.current;
552
543
  if (h) {
553
- delete C.current.dataset.open;
554
- const _ = () => M(!1);
555
- return h.addEventListener("transitionend", _, { once: !0 }), () => {
556
- h.removeEventListener("transitionend", _);
544
+ delete P.current.dataset.open;
545
+ const E = () => _(!1);
546
+ return h.addEventListener("transitionend", E, { once: !0 }), () => {
547
+ h.removeEventListener("transitionend", E);
557
548
  };
558
549
  }
559
- }, [t]), T(() => {
560
- const h = C.current;
561
- u && h && (h.dataset.open = "");
562
- }, [u]), /* @__PURE__ */ n(
563
- Ct,
550
+ }, [t]), L(() => {
551
+ const h = P.current;
552
+ p && h && (h.dataset.open = "");
553
+ }, [p]), /* @__PURE__ */ n(
554
+ It,
564
555
  {
565
- open: u,
556
+ open: p,
566
557
  onClose: e,
567
- className: s(
558
+ className: w(
568
559
  {
569
- "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": u,
560
+ "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": p,
570
561
  "tw:overflow-hidden": r === "cover"
571
562
  },
572
563
  a
573
564
  ),
574
- ...L,
565
+ ...I,
575
566
  children: /* @__PURE__ */ n(
576
567
  "div",
577
568
  {
578
569
  "data-testid": "transition-container",
579
- ref: C,
580
- className: s(
570
+ ref: P,
571
+ className: w(
581
572
  "tw:w-full tw:m-auto tw:p-4 tw:sm:p-6",
582
573
  // CSS transitions are based on the presence of the `data-open` attribute
583
574
  "tw:-translate-y-4 tw:data-open:translate-y-0 tw:opacity-0 tw:data-open:opacity-100",
584
575
  "tw:transition-[opacity_transform] tw:duration-300",
585
576
  // Handle modal dimensions for different variants and sizes
586
577
  r !== "cover" && {
587
- "tw:sm:w-sm": w === "sm",
588
- "tw:md:w-lg": w === "md",
589
- "tw:md:w-4xl": w === "lg",
590
- "tw:md:w-6xl": w === "xl"
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"
591
582
  },
592
583
  { "tw:h-full": r === "cover" }
593
584
  ),
594
- children: /* @__PURE__ */ n(m, { className: s(
585
+ children: /* @__PURE__ */ n(m, { className: w(
595
586
  "tw:w-full",
596
587
  { "tw:h-full tw:relative tw:overflow-auto": r === "cover" }
597
- ), children: r === "cover" ? /* @__PURE__ */ i(B, { children: [
588
+ ), children: r === "cover" ? /* @__PURE__ */ i(T, { children: [
598
589
  /* @__PURE__ */ i(
599
590
  "div",
600
591
  {
601
- className: s(
592
+ className: w(
602
593
  "tw:px-4 tw:py-3 tw:absolute tw:top-0 tw:left-0 tw:right-0",
603
594
  "tw:flex tw:items-center tw:justify-between",
604
595
  "tw:text-white tw:bg-linear-to-b tw:from-black/70 tw:to-black/10",
@@ -606,36 +597,36 @@ const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
606
597
  ),
607
598
  children: [
608
599
  /* @__PURE__ */ n("h5", { children: o }),
609
- /* @__PURE__ */ n(H, { onClick: e, label: "Close dialog" })
600
+ /* @__PURE__ */ n(j, { onClick: e, label: "Close dialog" })
610
601
  ]
611
602
  }
612
603
  ),
613
604
  /* @__PURE__ */ n("div", { children: d })
614
- ] }) : /* @__PURE__ */ i(B, { children: [
615
- /* @__PURE__ */ i(m.Header, { className: s(
605
+ ] }) : /* @__PURE__ */ i(T, { children: [
606
+ /* @__PURE__ */ i(m.Header, { className: w(
616
607
  "tw:sticky tw:top-0",
617
608
  "tw:flex tw:items-center tw:justify-between tw:gap-x-2"
618
609
  ), children: [
619
- /* @__PURE__ */ n("h5", { className: s({ "tw:text-danger": r === "danger" }), children: o }),
620
- /* @__PURE__ */ n(H, { onClick: e, label: "Close dialog" })
610
+ /* @__PURE__ */ n("h5", { className: w({ "tw:text-danger": r === "danger" }), children: o }),
611
+ /* @__PURE__ */ n(j, { onClick: e, label: "Close dialog" })
621
612
  ] }),
622
613
  /* @__PURE__ */ n(m.Body, { children: d }),
623
614
  y && /* @__PURE__ */ i(
624
615
  m.Footer,
625
616
  {
626
617
  "data-testid": "footer",
627
- className: s(
618
+ className: w(
628
619
  "tw:flex tw:justify-end tw:items-center tw:gap-x-2",
629
620
  "tw:[&]:px-3 tw:sticky tw:bottom-0"
630
621
  ),
631
622
  children: [
632
- /* @__PURE__ */ n(wt, { onClick: e, children: "Cancel" }),
623
+ /* @__PURE__ */ n(it, { onClick: e, children: "Cancel" }),
633
624
  /* @__PURE__ */ n(
634
- lt,
625
+ wt,
635
626
  {
636
627
  solid: !0,
637
628
  variant: r === "danger" ? "danger" : "primary",
638
- disabled: P,
629
+ disabled: v,
639
630
  onClick: y,
640
631
  children: c
641
632
  }
@@ -648,16 +639,16 @@ const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
648
639
  )
649
640
  }
650
641
  );
651
- }, zt = ({ className: t, children: e, loading: r = !1, variant: o = "default" }) => /* @__PURE__ */ n(bt, { className: f({ "tw:[&]:border-danger": o === "error" }, t), children: /* @__PURE__ */ i("h3", { className: f("tw:text-center", {
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", {
652
643
  "tw:text-gray-500 tw:dark:text-gray-400": o === "default",
653
644
  "tw:text-danger": o === "error"
654
645
  }), children: [
655
- r && /* @__PURE__ */ i(B, { children: [
646
+ r && /* @__PURE__ */ i(T, { children: [
656
647
  /* @__PURE__ */ n(b, { icon: Z, spin: !0 }),
657
648
  /* @__PURE__ */ n("span", { className: "tw:ml-2", children: e ?? "Loading..." })
658
649
  ] }),
659
650
  !r && e
660
- ] }) }), At = ({ variant: t, className: e, size: r = "md", children: o }) => /* @__PURE__ */ n(
651
+ ] }) }), Gt = ({ variant: t, className: e, size: r = "md", children: o }) => /* @__PURE__ */ n(
661
652
  "div",
662
653
  {
663
654
  className: f(
@@ -677,32 +668,31 @@ const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
677
668
  }
678
669
  );
679
670
  export {
680
- lt as Button,
671
+ wt as Button,
681
672
  m as Card,
682
- Ut as CardModal,
683
- Et as Checkbox,
684
- H as CloseButton,
685
- I as ELLIPSIS,
673
+ Wt as CardModal,
674
+ jt as Checkbox,
675
+ j as CloseButton,
676
+ C as ELLIPSIS,
686
677
  A as Input,
687
678
  W as Label,
688
- Mt as LabelledInput,
689
- _t as LabelledSelect,
690
- wt as LinkButton,
691
- zt as Message,
692
- Ct as ModalDialog,
693
- Ht as NavPills,
694
- $t as Paginator,
695
- At as Result,
696
- jt as SearchInput,
697
- at as Select,
698
- bt as SimpleCard,
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,
699
690
  Rt as Table,
700
- Dt as ToggleSwitch,
701
- ft as formatNumber,
702
- Nt as keyForPage,
691
+ $t as ToggleSwitch,
692
+ xt as formatNumber,
693
+ vt as keyForPage,
703
694
  k as pageIsEllipsis,
704
- kt as prettifyPageNumber,
705
- yt as progressivePagination,
706
- Ot as roundTen,
707
- st as useTimeout
695
+ Nt as prettifyPageNumber,
696
+ kt as progressivePagination,
697
+ zt as roundTen
708
698
  };
@@ -0,0 +1,17 @@
1
+ import { useRef as c, useCallback as s, useEffect as b, useMemo as m } from "react";
2
+ function a(u, o = globalThis.setTimeout.bind(globalThis), r = globalThis.clearTimeout.bind(globalThis)) {
3
+ const t = c(null), e = s(() => {
4
+ t.current && r(t.current);
5
+ }, [r]), n = s((i, l) => {
6
+ e(), t.current = o(() => {
7
+ i(), t.current = null;
8
+ }, l ?? u);
9
+ }, [e, u, o]);
10
+ return b(() => e, [e]), m(
11
+ () => ({ setTimeout: n, clearCurrentTimeout: e }),
12
+ [e, n]
13
+ );
14
+ }
15
+ export {
16
+ a as u
17
+ };
package/package.json CHANGED
@@ -89,5 +89,5 @@
89
89
  "not ie <= 11",
90
90
  "not op_mini all"
91
91
  ],
92
- "version": "0.8.3"
92
+ "version": "0.8.4"
93
93
  }