@shlinkio/shlink-frontend-kit 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { CardProps } from 'reactstrap';
2
2
  import { ChangeEvent } from 'react';
3
+ import { Dispatch } from 'react';
3
4
  import { DropdownToggleProps } from 'reactstrap/types/lib/DropdownToggle';
4
5
  import { FC } from 'react';
5
6
  import { JSX } from 'react/jsx-runtime';
6
7
  import { PropsWithChildren } from 'react';
7
8
  import { ReactNode } from 'react';
8
9
  import { RefObject } from 'react';
10
+ import { SetStateAction } from 'react';
9
11
 
10
12
  declare type BooleanControlProps = PropsWithChildren<{
11
13
  checked?: boolean;
@@ -199,6 +201,8 @@ export declare const useOrder: <T>(initialOrder: Order<T>) => [Order<T>, (orderF
199
201
 
200
202
  export declare const useParsedQuery: <T>() => T;
201
203
 
204
+ export declare const useTheme: (initialTheme?: Theme) => readonly [Theme, Dispatch<SetStateAction<Theme>>];
205
+
202
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];
203
207
 
204
208
  export declare const useToggle: (initialValue?: boolean) => ToggleResult;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx as o, 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 b } from "@fortawesome/react-fontawesome";
3
+ import { FontAwesomeIcon as w } from "@fortawesome/react-fontawesome";
4
4
  import { clsx as u } from "clsx";
5
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 w, useRef as C, useCallback as f, useMemo as Q, Children as V, isValidElement as Y } from "react";
7
- import { useLocation as W, NavLink as z } from "react-router";
8
- const de = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: c = !1 }) => /* @__PURE__ */ o(
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";
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
9
  _,
10
10
  {
11
11
  body: !0,
@@ -22,18 +22,18 @@ const de = ({ className: e, children: r, loading: t = !1, type: n = "default", f
22
22
  "text-danger": n === "error"
23
23
  }),
24
24
  children: [
25
- t && /* @__PURE__ */ o(b, { icon: I, spin: !0 }),
25
+ t && /* @__PURE__ */ o(w, { icon: I, spin: !0 }),
26
26
  t && /* @__PURE__ */ o("span", { className: "ms-2", children: r ?? "Loading..." }),
27
27
  !t && r
28
28
  ]
29
29
  }
30
30
  )
31
31
  }
32
- ), J = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ d(_, { ...n, children: [
32
+ ), X = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ d(_, { ...n, children: [
33
33
  e && /* @__PURE__ */ o(H, { role: "heading", "aria-level": 4, children: e }),
34
34
  /* @__PURE__ */ o(M, { className: t, children: r })
35
- ] }), me = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ o(
36
- J,
35
+ ] }), fe = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ o(
36
+ X,
37
37
  {
38
38
  role: "document",
39
39
  className: u("text-center", {
@@ -56,12 +56,12 @@ const de = ({ className: e, children: r, loading: t = !1, type: n = "default", f
56
56
  /* @__PURE__ */ o("input", { type: "checkbox", className: "form-check-input", id: l, checked: e, onChange: a }),
57
57
  /* @__PURE__ */ o("label", { className: "form-check-label", htmlFor: l, children: n })
58
58
  ] });
59
- }, ue = (e) => /* @__PURE__ */ o(x, { type: "checkbox", ...e }), he = (e) => /* @__PURE__ */ o(x, { type: "switch", ...e }), X = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: c = !1, id: s }) => /* @__PURE__ */ d("div", { className: `${t} ${c ? "" : "mb-3"}`, children: [
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
60
  /* @__PURE__ */ o("label", { className: `form-label ${n}`, htmlFor: s, children: r }),
61
61
  e
62
- ] }), fe = ({ children: e, value: r, onChange: t, type: n, required: c, placeholder: s, className: l, labelClassName: a }) => {
62
+ ] }), we = ({ children: e, value: r, onChange: t, type: n, required: c, placeholder: s, className: l, labelClassName: a }) => {
63
63
  const i = T();
64
- return /* @__PURE__ */ o(X, { label: /* @__PURE__ */ d(N, { children: [
64
+ return /* @__PURE__ */ o(Z, { label: /* @__PURE__ */ d(N, { children: [
65
65
  e,
66
66
  ":"
67
67
  ] }), className: l, labelClassName: a, id: i, children: /* @__PURE__ */ o(
@@ -76,13 +76,13 @@ const de = ({ className: e, children: r, loading: t = !1, type: n = "default", f
76
76
  onChange: (m) => t(m.target.value)
77
77
  }
78
78
  ) });
79
- }, Z = 500;
80
- let p;
79
+ }, B = 500;
80
+ let b;
81
81
  const v = () => {
82
- p !== null && clearTimeout(p), p = null;
83
- }, pe = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: c = "", setTimeout_: s = setTimeout }) => {
84
- const [l, a] = w(c), i = (m, h = Z) => {
85
- a(m), v(), p = s(() => {
82
+ 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
86
  e(m), v();
87
87
  }, h);
88
88
  };
@@ -100,7 +100,7 @@ const v = () => {
100
100
  onChange: (m) => i(m.target.value)
101
101
  }
102
102
  ),
103
- /* @__PURE__ */ o(b, { icon: A, className: "search-field__icon" }),
103
+ /* @__PURE__ */ o(w, { icon: A, className: "search-field__icon" }),
104
104
  /* @__PURE__ */ o(
105
105
  "button",
106
106
  {
@@ -113,7 +113,7 @@ const v = () => {
113
113
  }
114
114
  )
115
115
  ] });
116
- }, B = (e) => {
116
+ }, K = (e) => {
117
117
  const r = new URLSearchParams(e), t = {};
118
118
  return r.forEach((n, c) => {
119
119
  if (c.endsWith("[]")) {
@@ -122,23 +122,23 @@ const v = () => {
122
122
  } else
123
123
  t[c] = n;
124
124
  }), t;
125
- }, be = (e) => {
125
+ }, Ne = (e) => {
126
126
  const r = new URLSearchParams();
127
127
  for (const [t, n] of Object.entries(e))
128
128
  n !== void 0 && (Array.isArray(n) ? n.forEach((c) => r.append(`${t}[]`, `${c}`)) : r.append(t, `${n}`));
129
129
  return r.toString();
130
- }, K = (e = !1) => {
131
- const [r, t] = w(e), n = f(() => t((l) => !l), []), c = f(() => t(!0), []), s = f(() => t(!1), []);
130
+ }, ee = (e = !1) => {
131
+ const [r, t] = p(e), n = f(() => t((l) => !l), []), c = f(() => t(!0), []), s = f(() => t(!1), []);
132
132
  return [r, n, c, s];
133
- }, we = (e = !1, r = 2e3, t = window.setTimeout, n = window.clearTimeout) => {
134
- const [c, s] = w(e), l = C(e), a = C(void 0), i = f(() => {
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
135
  s(!l.current), a.current && n(a.current), a.current = t(() => s(l.current), r);
136
136
  }, [n, r, t]);
137
137
  return [c, i];
138
- }, ge = () => C(null), Ne = () => {
139
- const { search: e } = W();
140
- return Q(() => B(e), [e]);
141
- }, ee = ({
138
+ }, _e = () => C(null), Oe = () => {
139
+ const { search: e } = z();
140
+ return Q(() => K(e), [e]);
141
+ }, re = ({
142
142
  text: e,
143
143
  disabled: r = !1,
144
144
  className: t,
@@ -151,7 +151,7 @@ const v = () => {
151
151
  size: m,
152
152
  ...h
153
153
  }) => {
154
- const [y, L] = K(), D = u("dropdown-btn__toggle", t, {
154
+ const [y, L] = ee(), D = u("dropdown-btn__toggle", t, {
155
155
  "btn-block": !i,
156
156
  "dropdown-btn__toggle--with-caret": !s
157
157
  }), R = { minWidth: a && `${a}px` };
@@ -159,10 +159,10 @@ const v = () => {
159
159
  /* @__PURE__ */ o(k, { size: m, caret: !s, className: D, color: "primary", ...h, children: e }),
160
160
  /* @__PURE__ */ o(S, { className: "w-100", end: l, style: R, children: n })
161
161
  ] });
162
- }, Ce = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ o(
163
- ee,
162
+ }, ve = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ o(
163
+ re,
164
164
  {
165
- text: /* @__PURE__ */ o(b, { className: "px-1", icon: E }),
165
+ text: /* @__PURE__ */ o(w, { className: "px-1", icon: E }),
166
166
  "aria-label": t,
167
167
  size: "sm",
168
168
  minWidth: r,
@@ -171,8 +171,8 @@ const v = () => {
171
171
  inline: !0,
172
172
  children: e
173
173
  }
174
- ), re = ({ children: e, ...r }) => /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(G, { className: "nav-pills__nav-link", tag: z, ...r, children: e }) }), _e = ({ 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 !== re)
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)
176
176
  throw new Error("Only NavPillItem children are allowed inside NavPills.");
177
177
  return n;
178
178
  }) }) });
@@ -182,23 +182,23 @@ function O(e, r, t) {
182
182
  DESC: void 0
183
183
  }[t] : "ASC";
184
184
  }
185
- function te(e, r, t) {
186
- return typeof e == "object" ? te(e.currentField, e.newField, e.currentOrderDir) : {
185
+ function ne(e, r, t) {
186
+ return typeof e == "object" ? ne(e.currentField, e.newField, e.currentOrderDir) : {
187
187
  field: r,
188
188
  dir: O(e, r, t)
189
189
  };
190
190
  }
191
- const Oe = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, c) => {
191
+ const Se = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, c) => {
192
192
  const s = t === "ASC" ? 1 : -1, l = t === "ASC" ? -1 : 1;
193
193
  return n[r] > c[r] ? s : l;
194
- }), ve = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, ke = (e) => {
194
+ }), Te = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, xe = (e) => {
195
195
  const [r, t] = e.split("-");
196
196
  return { field: r, dir: t };
197
- }, Se = (e) => {
198
- const [r, t] = w(e), n = f((c, s) => t({ field: c, dir: s }), []);
197
+ }, ye = (e) => {
198
+ const [r, t] = p(e), n = f((c, s) => t({ field: c, dir: s }), []);
199
199
  return [r, n];
200
200
  };
201
- function Te({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1, prefixed: s = !0 }) {
201
+ function Le({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1, prefixed: s = !0 }) {
202
202
  const l = (a) => () => {
203
203
  const i = O(a, r.field, r.dir);
204
204
  t(i ? a : void 0, i);
@@ -234,7 +234,7 @@ function Te({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1,
234
234
  className: "d-flex justify-content-between align-items-center",
235
235
  children: [
236
236
  i,
237
- r.field === a && /* @__PURE__ */ o(b, { icon: r.dir === "ASC" ? F : P })
237
+ r.field === a && /* @__PURE__ */ o(w, { icon: r.dir === "ASC" ? F : P })
238
238
  ]
239
239
  },
240
240
  a
@@ -244,46 +244,52 @@ function Te({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1,
244
244
  ] })
245
245
  ] });
246
246
  }
247
- const xe = "#4696e5", ye = "rgba(70, 150, 229, 0.4)", Le = "#f77f28", De = "rgba(247, 127, 40, 0.4)", Re = "white", Ie = "#161b22", Ae = (e) => {
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
248
  var r;
249
249
  return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", e);
250
- }, Ee = () => {
250
+ }, Pe = () => {
251
251
  var e;
252
252
  return ((e = document.querySelector("html")) == null ? void 0 : e.getAttribute("data-theme")) === "dark";
253
- }, Fe = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light";
253
+ }, ce = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", He = (e) => {
254
+ const [r, t] = p(() => e ?? ce());
255
+ return W(() => {
256
+ oe(r);
257
+ }, [r]), [r, t];
258
+ };
254
259
  export {
255
- ue as Checkbox,
256
- ee as DropdownBtn,
257
- Le as HIGHLIGHTED_COLOR,
258
- De as HIGHLIGHTED_COLOR_ALPHA,
259
- fe as InputFormGroup,
260
- X as LabeledFormGroup,
261
- xe as MAIN_COLOR,
262
- ye as MAIN_COLOR_ALPHA,
263
- de as Message,
264
- re as NavPillItem,
265
- _e as NavPills,
266
- Te as OrderingDropdown,
267
- Ie as PRIMARY_DARK_COLOR,
268
- Re as PRIMARY_LIGHT_COLOR,
269
- me as Result,
270
- Ce as RowDropdownBtn,
271
- pe as SearchField,
272
- J as SimpleCard,
273
- he as ToggleSwitch,
274
- Ae as changeThemeInMarkup,
275
- te as determineOrder,
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,
275
+ ve as RowDropdownBtn,
276
+ ge as SearchField,
277
+ X as SimpleCard,
278
+ be as ToggleSwitch,
279
+ oe as changeThemeInMarkup,
280
+ ne as determineOrder,
276
281
  O as determineOrderDir,
277
- Fe as getSystemPreferredTheme,
278
- Ee as isDarkThemeEnabled,
279
- ve as orderToString,
280
- B as parseQueryString,
281
- Oe as sortList,
282
- ke as stringToOrder,
283
- be as stringifyQueryParams,
284
- ge as useElementRef,
285
- Se as useOrder,
286
- Ne as useParsedQuery,
287
- we as useTimeoutToggle,
288
- K as useToggle
282
+ 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,
291
+ Oe as useParsedQuery,
292
+ He as useTheme,
293
+ Ce as useTimeoutToggle,
294
+ ee as useToggle
289
295
  };
@@ -29,6 +29,13 @@ export declare const Card: FC<CardProps> & {
29
29
  Footer: FC<CardProps>;
30
30
  };
31
31
 
32
+ /**
33
+ * A ModalDialog that renders a Card as its content
34
+ */
35
+ export declare const CardModal: FC<CardModalProps>;
36
+
37
+ export declare type CardModalProps = Omit<ModalDialogProps, 'title' | 'size'> & (CoverCardModalProps | RegularCardModalProps);
38
+
32
39
  export declare type CardProps = HTMLProps<HTMLDivElement>;
33
40
 
34
41
  export declare type CellProps = HTMLProps<HTMLTableCellElement> & {
@@ -51,16 +58,12 @@ export declare type CloseButtonProps = {
51
58
  onClick?: HTMLProps<HTMLButtonElement>['onClick'];
52
59
  };
53
60
 
54
- declare type CommonModalDialogProps = {
55
- open: boolean;
56
- size?: Size | 'xl' | 'full';
61
+ declare type CommonCardModalProps = {
57
62
  /** Modal header title */
58
63
  title: string;
59
- /** Invoked when the modal is closed for any reason */
60
- onClose?: () => void;
61
64
  };
62
65
 
63
- declare type CoverModalDialogProps = CommonModalDialogProps & {
66
+ declare type CoverCardModalProps = CommonCardModalProps & {
64
67
  /**
65
68
  * Cover dialogs have a body that span the whole dialog, and no buttons.
66
69
  * The header overlaps the body with semi-transparent background.
@@ -118,7 +121,12 @@ declare type LinkButtonProps_2 = LinkProps;
118
121
 
119
122
  export declare const ModalDialog: FC<ModalDialogProps>;
120
123
 
121
- export declare type ModalDialogProps = Omit<HTMLProps<HTMLDialogElement>, 'title' | 'size'> & (CoverModalDialogProps | RegularModalDialogProps);
124
+ export declare type ModalDialogProps = HTMLProps<HTMLDialogElement> & {
125
+ /** Whether the dialog is open or not */
126
+ open: boolean;
127
+ /** Invoked when the dialog is closed for any reason */
128
+ onClose: () => void;
129
+ };
122
130
 
123
131
  declare type NoTitleProps = {
124
132
  title?: never;
@@ -146,12 +154,19 @@ export declare const progressivePagination: (currentPage: number, pageCount: num
146
154
 
147
155
  declare type RegularButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'>;
148
156
 
149
- declare type RegularModalDialogProps = CommonModalDialogProps & {
157
+ declare type RegularCardModalProps = CommonCardModalProps & {
150
158
  /** Danger dialogs use danger variants in title and confirm button */
151
159
  variant?: 'default' | 'danger';
160
+ /** Determines the horizontal size of the dialog */
161
+ size?: Size | 'xl';
152
162
  /** Value to display in confirm button. Defaults to 'Confirm' */
153
163
  confirmText?: string;
154
- /** Invoked when the modal is closed via confirm button */
164
+ /** Whether the confirm button is disabled or not */
165
+ confirmDisabled?: boolean;
166
+ /**
167
+ * A footer with confirm and cancel buttons will be rendered if provided.
168
+ * Invoked when the confirm button is actioned.
169
+ */
155
170
  onConfirm?: () => void;
156
171
  };
157
172
 
package/dist/tailwind.js CHANGED
@@ -1,51 +1,51 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
- import w from "clsx";
3
- import { createContext as I, useContext as b, useId as B, useRef as S, useCallback as p, useEffect as F, useMemo as T } from "react";
4
- import { Link as L } from "react-router";
5
- import { faClose as $, faSearch as O, faChevronLeft as q, faChevronRight as _ } from "@fortawesome/free-solid-svg-icons";
6
- import { FontAwesomeIcon as k } from "@fortawesome/react-fontawesome";
7
- const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r }) => {
8
- const { responsive: e } = b(f);
9
- return /* @__PURE__ */ n(y.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
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(
10
10
  "thead",
11
11
  {
12
- className: w(
12
+ className: a(
13
13
  { "tw:hidden tw:lg:table-header-group": e },
14
14
  r
15
15
  ),
16
16
  children: t
17
17
  }
18
18
  ) });
19
- }, J = ({ children: t, className: r }) => {
20
- const { responsive: e } = b(f);
21
- return /* @__PURE__ */ n(y.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
19
+ }, W = ({ children: t, className: r }) => {
20
+ const { responsive: e } = g(u);
21
+ return /* @__PURE__ */ n(f.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
22
22
  "tbody",
23
23
  {
24
- className: w(
24
+ className: a(
25
25
  { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": e },
26
26
  r
27
27
  ),
28
28
  children: t
29
29
  }
30
30
  ) });
31
- }, K = ({ children: t, className: r }) => {
32
- const { responsive: e } = b(f);
33
- return /* @__PURE__ */ n(y.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
31
+ }, q = ({ children: t, className: r }) => {
32
+ const { responsive: e } = g(u);
33
+ return /* @__PURE__ */ n(f.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
34
34
  "tfoot",
35
35
  {
36
- className: w(
36
+ className: a(
37
37
  { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": e },
38
38
  r
39
39
  ),
40
40
  children: t
41
41
  }
42
42
  ) });
43
- }, Q = ({ children: t, className: r, ...e }) => {
44
- const o = b(y), d = (o == null ? void 0 : o.section) === "body", { responsive: l } = b(f);
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
45
  return /* @__PURE__ */ n(
46
46
  "tr",
47
47
  {
48
- className: w(
48
+ className: a(
49
49
  "tw:group",
50
50
  {
51
51
  "tw:lg:table-row tw:flex tw:flex-col": l,
@@ -60,19 +60,19 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
60
60
  children: t
61
61
  }
62
62
  );
63
- }, V = ({ children: t, className: r, columnName: e, type: o, ...d }) => {
64
- const l = b(y), a = o ?? ((l == null ? void 0 : l.section) !== "body" ? "th" : "td"), { responsive: s } = b(f);
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
65
  return /* @__PURE__ */ n(
66
- a,
66
+ s,
67
67
  {
68
- "data-column": s ? e : void 0,
69
- className: w(
68
+ "data-column": i ? e : void 0,
69
+ className: a(
70
70
  "tw:p-2 tw:border-lm-border tw:dark:border-dm-border",
71
71
  {
72
- "tw:border-b-1": !s,
73
- "tw:block tw:lg:table-cell tw:not-last:border-b-1 tw:lg:border-b-1": s,
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
74
  // 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": s && a === "td"
75
+ "tw:before:lg:hidden tw:before:content-[attr(data-column)] tw:before:font-bold tw:before:mr-1": i && s === "td"
76
76
  },
77
77
  r
78
78
  ),
@@ -80,27 +80,27 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
80
80
  children: t
81
81
  }
82
82
  );
83
- }, W = ({ header: t, footer: r, children: e, responsive: o = !0, ...d }) => /* @__PURE__ */ n(f.Provider, { value: { responsive: o }, children: /* @__PURE__ */ c("table", { className: "tw:w-full", ...d, children: [
84
- /* @__PURE__ */ n(G, { children: t }),
85
- /* @__PURE__ */ n(J, { children: e }),
86
- r && /* @__PURE__ */ n(K, { children: r })
87
- ] }) }), yt = Object.assign(W, { Row: Q, Cell: V }), X = ({
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 = ({
88
88
  children: t,
89
89
  className: r,
90
90
  disabled: e,
91
91
  variant: o = "primary",
92
92
  size: d = "md",
93
93
  inline: l = !1,
94
- solid: a = !1,
95
- ...s
94
+ solid: s = !1,
95
+ ...i
96
96
  }) => {
97
- const m = "to" in s ? L : "button";
97
+ const c = "to" in i ? _ : "button";
98
98
  return (
99
99
  // @ts-expect-error We are explicitly checking for the `to` prop before using Link
100
100
  /* @__PURE__ */ n(
101
- m,
101
+ c,
102
102
  {
103
- className: w(
103
+ className: a(
104
104
  {
105
105
  "tw:inline-flex": l,
106
106
  "tw:flex": !l
@@ -120,11 +120,11 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
120
120
  {
121
121
  "tw:border-brand tw:text-brand": o === "primary",
122
122
  "tw:border-zinc-500": o === "secondary",
123
- "tw:text-zinc-500": o === "secondary" && !a,
123
+ "tw:text-zinc-500": o === "secondary" && !s,
124
124
  "tw:border-danger": o === "danger",
125
- "tw:text-danger": o === "danger" && !a
125
+ "tw:text-danger": o === "danger" && !s
126
126
  },
127
- a && {
127
+ s && {
128
128
  "tw:text-white": !0,
129
129
  "tw:bg-brand": o === "primary",
130
130
  "tw:highlight:bg-brand-dark tw:highlight:border-brand-dark": o === "primary",
@@ -134,7 +134,7 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
134
134
  "tw:highlight:bg-danger-dark tw:highlight:border-danger-dark": o === "danger"
135
135
  },
136
136
  !e && {
137
- "tw:highlight:text-white": !a,
137
+ "tw:highlight:text-white": !s,
138
138
  "tw:highlight:bg-brand": o === "primary",
139
139
  "tw:highlight:bg-zinc-500": o === "secondary",
140
140
  "tw:highlight:bg-danger": o === "danger"
@@ -145,36 +145,36 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
145
145
  r
146
146
  ),
147
147
  disabled: e,
148
- ...s,
148
+ ...i,
149
149
  children: t
150
150
  }
151
151
  )
152
152
  );
153
- }, Y = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
153
+ }, S = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
154
154
  "button",
155
155
  {
156
156
  onClick: t,
157
- className: w(
157
+ className: a(
158
158
  "tw:opacity-50 tw:highlight:opacity-80 tw:transition-opacity",
159
159
  "tw:rounded-md tw:focus-ring"
160
160
  ),
161
161
  "aria-label": r,
162
- children: /* @__PURE__ */ n(k, { icon: $, size: "xl" })
162
+ children: /* @__PURE__ */ n(h, { icon: U, size: "xl" })
163
163
  }
164
- ), R = ({
164
+ ), j = ({
165
165
  borderless: t = !1,
166
166
  size: r = "md",
167
167
  feedback: e,
168
168
  className: o,
169
169
  disabled: d,
170
170
  readOnly: l,
171
- ...a
171
+ ...s
172
172
  }) => {
173
- const s = !d && !l;
173
+ const i = !d && !l;
174
174
  return /* @__PURE__ */ n(
175
175
  "input",
176
176
  {
177
- className: w(
177
+ className: a(
178
178
  "tw:w-full",
179
179
  {
180
180
  "tw:focus-ring": !e,
@@ -189,29 +189,29 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
189
189
  "tw:rounded-md tw:border": !t,
190
190
  "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !e,
191
191
  "tw:border-danger": !t && e === "error",
192
- "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !s,
193
- "tw:bg-lm-primary tw:dark:bg-dm-primary": s,
192
+ "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !i,
193
+ "tw:bg-lm-primary tw:dark:bg-dm-primary": i,
194
194
  // Use different background color when rendered inside a card
195
- "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": s
195
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": i
196
196
  },
197
197
  o
198
198
  ),
199
199
  disabled: d,
200
200
  readOnly: l,
201
- ...a
201
+ ...s
202
202
  }
203
203
  );
204
- }, E = ({ required: t, children: r, ...e }) => /* @__PURE__ */ c("label", { ...e, children: [
204
+ }, H = ({ required: t, children: r, ...e }) => /* @__PURE__ */ w("label", { ...e, children: [
205
205
  r,
206
206
  t && /* @__PURE__ */ n("span", { className: "tw:text-danger tw:ml-1", "data-testid": "required-indicator", children: "*" })
207
- ] }), kt = ({ label: t, inputClassName: r, required: e, hiddenRequired: o, error: d, ...l }) => {
208
- const a = B();
209
- return /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
210
- /* @__PURE__ */ n(E, { htmlFor: a, required: e, children: t }),
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 }),
211
211
  /* @__PURE__ */ n(
212
- R,
212
+ j,
213
213
  {
214
- id: a,
214
+ id: s,
215
215
  className: r,
216
216
  required: e || o,
217
217
  feedback: d ? "error" : void 0,
@@ -220,7 +220,7 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
220
220
  ),
221
221
  d && /* @__PURE__ */ n("span", { className: "tw:text-danger", children: d })
222
222
  ] });
223
- }, Z = 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>`, z = ({
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 = ({
224
224
  className: t,
225
225
  size: r = "md",
226
226
  feedback: e,
@@ -230,7 +230,7 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
230
230
  }) => /* @__PURE__ */ n(
231
231
  "select",
232
232
  {
233
- className: w(
233
+ className: a(
234
234
  "tw:w-full tw:appearance-none tw:pr-9 tw:bg-no-repeat",
235
235
  {
236
236
  "tw:focus-ring": !e,
@@ -253,34 +253,34 @@ const y = I(void 0), f = I({ responsive: !0 }), G = ({ children: t, className: r
253
253
  ),
254
254
  style: {
255
255
  ...o,
256
- backgroundImage: `url("${Z}")`,
256
+ backgroundImage: `url("${V}")`,
257
257
  backgroundSize: "16px 12px",
258
258
  backgroundPosition: "right 0.75rem center"
259
259
  },
260
260
  disabled: d,
261
261
  ...l
262
262
  }
263
- ), vt = ({ selectClassName: t, label: r, required: e, hiddenRequired: o, ...d }) => {
264
- const l = B();
265
- return /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
266
- /* @__PURE__ */ n(E, { htmlFor: l, required: e, children: r }),
267
- /* @__PURE__ */ n(z, { id: l, className: t, required: e || o, ...d })
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 })
268
268
  ] });
269
269
  };
270
- function tt(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
271
- const o = S(null), d = p(() => {
270
+ function Y(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
271
+ const o = M(null), d = k(() => {
272
272
  o.current && e(o.current);
273
- }, [e]), l = p((a, s) => {
273
+ }, [e]), l = k((s, i) => {
274
274
  d(), o.current = r(() => {
275
- a(), o.current = null;
276
- }, s ?? t);
275
+ s(), o.current = null;
276
+ }, i ?? t);
277
277
  }, [d, t, r]);
278
- return F(() => d, [d]), T(
278
+ return E(() => d, [d]), T(
279
279
  () => ({ setTimeout: l, clearCurrentTimeout: d }),
280
280
  [d, l]
281
281
  );
282
282
  }
283
- const Nt = ({
283
+ const vt = ({
284
284
  onChange: t,
285
285
  containerClassName: r,
286
286
  inputClassName: e,
@@ -288,15 +288,15 @@ const Nt = ({
288
288
  size: o = "lg",
289
289
  ...d
290
290
  }) => {
291
- const { setTimeout: l, clearCurrentTimeout: a } = tt(500), s = p((m) => {
292
- m ? l(() => t(m)) : (a(), t(m));
293
- }, [a, t, l]);
294
- return /* @__PURE__ */ c("div", { className: w("tw:group tw:relative tw:focus-within:z-10", r), children: [
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: [
295
295
  /* @__PURE__ */ n(
296
- k,
296
+ h,
297
297
  {
298
- icon: O,
299
- className: w(
298
+ icon: A,
299
+ className: a(
300
300
  "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:transition-colors",
301
301
  "tw:text-placeholder tw:group-focus-within:text-lm-text tw:dark:group-focus-within:text-dm-text",
302
302
  {
@@ -307,10 +307,10 @@ const Nt = ({
307
307
  }
308
308
  ),
309
309
  /* @__PURE__ */ n(
310
- R,
310
+ j,
311
311
  {
312
312
  type: "search",
313
- className: w(
313
+ className: a(
314
314
  {
315
315
  "tw:pl-9": o !== "sm",
316
316
  "tw:pl-7": o === "sm"
@@ -318,16 +318,16 @@ const Nt = ({
318
318
  e
319
319
  ),
320
320
  placeholder: "Search...",
321
- onChange: (m) => s(m.target.value),
321
+ onChange: (c) => i(c.target.value),
322
322
  size: o,
323
323
  ...d
324
324
  }
325
325
  )
326
326
  ] });
327
- }, rt = ({ className: t, disabled: r, size: e = "md", ...o }) => /* @__PURE__ */ n(
327
+ }, Z = ({ className: t, disabled: r, size: e = "md", ...o }) => /* @__PURE__ */ n(
328
328
  "button",
329
329
  {
330
- className: w(
330
+ className: a(
331
331
  "tw:inline-flex tw:rounded-md tw:focus-ring",
332
332
  "tw:text-brand tw:highlight:text-brand-dark tw:highlight:underline",
333
333
  {
@@ -341,194 +341,246 @@ const Nt = ({
341
341
  disabled: r,
342
342
  ...o
343
343
  }
344
- ), et = new Intl.NumberFormat("en-US"), ot = (t) => et.format(Number(t)), P = 10, Tt = (t) => Math.ceil(t / P) * P, h = 2, v = "...", nt = (t, r) => Array.from({ length: r - t }, (e, o) => t + o), dt = (t, r) => {
345
- const e = nt(
346
- Math.max(h, t - h),
347
- Math.min(r - 1, t + h) + 1
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
348
  );
349
- return t - h > h && e.unshift(v), t + h < r - 1 && e.push(v), e.unshift(1), e.push(r), e;
350
- }, x = (t) => t === v, lt = (t) => x(t) ? t : ot(t), at = (t, r) => x(t) ? `${t}_${r}` : `${t}`, M = (t = !1) => w(
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
351
  "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
352
- "tw:first:rounded-l tw:last:rounded-r",
352
+ "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
353
+ ], D = (t = !1) => a(
354
+ z,
353
355
  "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
354
- "tw:outline-none tw:focus-visible:ring-3 tw:focus-visible:ring-brand/75 tw:focus-visible:z-1",
356
+ "tw:focus-ring tw:focus-visible:z-1",
355
357
  {
356
- "tw:hover:bg-lm-secondary tw:dark:hover:bg-dm-secondary tw:text-brand tw:border-r-lm-border tw:dark:border-r-dm-border": !t,
357
- "tw:bg-brand tw:text-white tw:border-r-brand": t
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
358
360
  }
359
- );
360
- function j() {
361
- return /* @__PURE__ */ n(
362
- "span",
363
- {
364
- "aria-hidden": !0,
365
- className: "tw:border-r tw:last:border-none tw:px-3 py-2 tw:text-gray-400 tw:border-r-(--border-color)",
366
- children: v
367
- }
368
- );
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 });
369
365
  }
370
- function st({ children: t, active: r, isEllipsis: e, href: o, ...d }) {
371
- const l = T(() => M(r), [r]);
372
- return e ? /* @__PURE__ */ n(j, {}) : /* @__PURE__ */ n(L, { className: l, to: o, ...d, children: t });
373
- }
374
- function wt({ children: t, active: r, isEllipsis: e, ...o }) {
375
- const d = T(() => M(r), [r]);
376
- return e ? /* @__PURE__ */ n(j, {}) : /* @__PURE__ */ n("button", { type: "button", className: d, ...o, children: t });
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 });
377
369
  }
378
370
  const Ct = ({ currentPage: t, pagesCount: r, ...e }) => {
379
- const o = "urlForPage" in e, d = o ? st : wt, l = p(
380
- (a) => o ? { href: x(a) ? void 0 : e.urlForPage(a) } : { onClick: () => !x(a) && e.onPageChange(a) },
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) },
381
373
  [o, e]
382
374
  );
383
- return r < 2 ? null : /* @__PURE__ */ c("div", { className: "tw:select-none tw:flex", "data-testid": "paginator", children: [
384
- /* @__PURE__ */ n(d, { ...l(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ n(k, { size: "xs", icon: q }) }),
385
- dt(t, r).map((a, s) => /* @__PURE__ */ n(
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(
386
378
  d,
387
379
  {
388
- active: a === t,
389
- isEllipsis: x(a),
390
- ...l(a),
391
- children: lt(a)
380
+ active: s === t,
381
+ isEllipsis: p(s),
382
+ ...l(s),
383
+ children: nt(s)
392
384
  },
393
- at(a, s)
385
+ dt(s, i)
394
386
  )),
395
- /* @__PURE__ */ n(d, { ...l(Math.min(r, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(k, { size: "xs", icon: _ }) })
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 }) })
396
388
  ] });
397
- }, it = ({ className: t, ...r }) => /* @__PURE__ */ n(
389
+ }, at = ({ className: t, ...r }) => /* @__PURE__ */ n(
398
390
  "div",
399
391
  {
400
- className: w(
392
+ className: a(
401
393
  "tw:px-4 tw:py-3 tw:rounded-t-md",
402
394
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-b tw:border-lm-border tw:dark:border-dm-border",
403
395
  t
404
396
  ),
405
397
  ...r
406
398
  }
407
- ), ct = ({ className: t, ...r }) => /* @__PURE__ */ n(
399
+ ), it = ({ className: t, ...r }) => /* @__PURE__ */ n(
408
400
  "div",
409
401
  {
410
- className: w(
402
+ className: a(
411
403
  "tw:p-4 tw:bg-lm-primary tw:dark:bg-dm-primary tw:first:rounded-t-md",
412
404
  "tw:first:rounded-t-md tw:last:rounded-b-md",
413
405
  t
414
406
  ),
415
407
  ...r
416
408
  }
417
- ), mt = ({ className: t, ...r }) => /* @__PURE__ */ n(
409
+ ), wt = ({ className: t, ...r }) => /* @__PURE__ */ n(
418
410
  "div",
419
411
  {
420
- className: w(
412
+ className: a(
421
413
  "tw:px-4 tw:py-3 tw:rounded-b-md",
422
414
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-t tw:border-lm-border tw:dark:border-dm-border",
423
415
  t
424
416
  ),
425
417
  ...r
426
418
  }
427
- ), gt = ({ className: t, ...r }) => /* @__PURE__ */ n(
419
+ ), ct = ({ className: t, ...r }) => /* @__PURE__ */ n(
428
420
  "div",
429
421
  {
430
- className: w(
422
+ className: a(
431
423
  "tw:group/card tw:rounded-md tw:shadow-md",
432
424
  "tw:border tw:border-lm-border tw:dark:border-dm-border tw:bg-lm-primary tw:dark:bg-dm-primary",
433
425
  t
434
426
  ),
435
427
  ...r
436
428
  }
437
- ), g = Object.assign(gt, { Body: ct, Header: it, Footer: mt }), Pt = ({ bodyClassName: t, children: r, ...e }) => {
429
+ ), m = Object.assign(ct, { Body: it, Header: at, Footer: wt }), Tt = ({ bodyClassName: t, children: r, ...e }) => {
438
430
  const { title: o, titleSize: d = "md", ...l } = "title" in e ? e : {
439
431
  ...e,
440
432
  title: void 0,
441
433
  titleSize: void 0
442
434
  };
443
- return /* @__PURE__ */ c(g, { ...l, children: [
444
- o && /* @__PURE__ */ c(g.Header, { children: [
435
+ return /* @__PURE__ */ w(m, { ...l, children: [
436
+ o && /* @__PURE__ */ w(m.Header, { children: [
445
437
  d === "lg" && /* @__PURE__ */ n("h4", { children: o }),
446
438
  d === "md" && /* @__PURE__ */ n("h5", { children: o }),
447
439
  d === "sm" && /* @__PURE__ */ n("h6", { children: o })
448
440
  ] }),
449
- /* @__PURE__ */ n(g.Body, { className: t, children: r })
441
+ /* @__PURE__ */ n(m.Body, { className: t, children: r })
450
442
  ] });
443
+ }, mt = ({
444
+ open: t,
445
+ children: r,
446
+ className: e,
447
+ ...o
448
+ }) => {
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;
453
+ 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();
456
+ } else
457
+ (x = d.current) == null || x.close();
458
+ return () => {
459
+ l.style.overflow = s, l.style.paddingRight = i;
460
+ };
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
+ }
469
+ );
451
470
  }, It = ({
452
471
  open: t,
453
- variant: r = "default",
454
- size: e = "md",
472
+ onClose: r,
473
+ variant: e = "default",
455
474
  title: o,
456
475
  children: d,
457
476
  className: l,
458
- ...a
477
+ ...s
459
478
  }) => {
460
- const { onConfirm: s, confirmText: m = "Confirm", ...H } = "onConfirm" in a ? a : {
461
- ...a,
462
- onConfirm: void 0,
463
- confirmText: void 0
464
- }, N = S(null), u = p(() => {
465
- var i;
466
- return (i = N.current) == null ? void 0 : i.close();
467
- }, []), A = p(() => {
468
- s == null || s(), u();
469
- }, [u, s]);
470
- return F(() => {
471
- var C;
472
- const i = document.querySelector("body"), D = i.style.overflow, U = i.style.paddingRight;
473
- return t ? (i.style.overflow = "hidden", i.scrollHeight > i.clientHeight && (i.style.paddingRight = "15px"), (C = N.current) == null || C.showModal()) : u(), () => {
474
- i.style.overflow = D, i.style.paddingRight = U;
475
- };
476
- }, [u, t]), /* @__PURE__ */ n(
477
- "dialog",
479
+ const {
480
+ size: i = "md",
481
+ confirmText: c = "Confirm",
482
+ confirmDisabled: x,
483
+ onConfirm: y,
484
+ ...N
485
+ } = "onConfirm" in s ? s : { ...s };
486
+ return /* @__PURE__ */ n(
487
+ mt,
478
488
  {
479
- ref: N,
480
- className: w(
481
- "tw:bg-transparent tw:backdrop:bg-black/50",
482
- {
483
- "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen tw:px-4": t
484
- },
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 },
485
493
  l
486
494
  ),
487
- ...H,
488
- children: t && /* @__PURE__ */ c(g, { className: w(
489
- "tw:m-auto tw:w-full",
495
+ ...N,
496
+ children: /* @__PURE__ */ n(
497
+ "div",
490
498
  {
491
- "tw:md:w-sm": e === "sm",
492
- "tw:md:w-lg": e === "md",
493
- "tw:md:w-4xl": e === "lg",
494
- "tw:md:w-6xl": e === "xl",
495
- "tw:w-full": e === "full"
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"
509
+ },
510
+ {
511
+ "tw:h-full tw:overflow-auto tw:relative": e === "cover"
512
+ }
513
+ ), children: e === "cover" ? /* @__PURE__ */ w(I, { children: [
514
+ /* @__PURE__ */ w(
515
+ "div",
516
+ {
517
+ className: a(
518
+ "tw:px-4 tw:py-3 tw:absolute tw:top-0 tw:left-0 tw:right-0",
519
+ "tw:flex tw:items-center tw:justify-between",
520
+ "tw:text-white tw:bg-linear-to-b tw:from-black/70 tw:to-black/10",
521
+ "tw:[text-shadow:_0_2px_4px_rgb(0_0_0/_0.8)]"
522
+ ),
523
+ children: [
524
+ /* @__PURE__ */ n("h5", { children: o }),
525
+ /* @__PURE__ */ n(S, { onClick: r, label: "Close dialog" })
526
+ ]
527
+ }
528
+ ),
529
+ /* @__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" })
534
+ ] }),
535
+ /* @__PURE__ */ n(m.Body, { children: d }),
536
+ y && /* @__PURE__ */ w(
537
+ m.Footer,
538
+ {
539
+ "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",
541
+ children: [
542
+ /* @__PURE__ */ n(
543
+ Q,
544
+ {
545
+ solid: !0,
546
+ variant: e === "danger" ? "danger" : "primary",
547
+ disabled: x,
548
+ onClick: y,
549
+ children: c
550
+ }
551
+ ),
552
+ /* @__PURE__ */ n(Z, { onClick: r, children: "Cancel" })
553
+ ]
554
+ }
555
+ )
556
+ ] }) })
496
557
  }
497
- ), children: [
498
- /* @__PURE__ */ c(g.Header, { className: "tw:flex tw:items-center tw:justify-between tw:sticky tw:top-0", children: [
499
- /* @__PURE__ */ n("h5", { className: w({ "tw:text-danger": r === "danger" }), children: o }),
500
- /* @__PURE__ */ n(Y, { onClick: u, label: "Close dialog" })
501
- ] }),
502
- /* @__PURE__ */ n(g.Body, { children: d }),
503
- /* @__PURE__ */ c(g.Footer, { className: "tw:flex tw:flex-row-reverse tw:gap-x-2 tw:items-center tw:py-4 tw:sticky tw:bottom-0", children: [
504
- s && /* @__PURE__ */ n(X, { variant: r === "danger" ? "danger" : "primary", onClick: A, children: m }),
505
- /* @__PURE__ */ n(rt, { onClick: u, children: "Cancel" })
506
- ] })
507
- ] })
558
+ )
508
559
  }
509
560
  );
510
561
  };
511
562
  export {
512
- X as Button,
513
- g as Card,
514
- Y as CloseButton,
563
+ Q as Button,
564
+ m as Card,
565
+ It as CardModal,
566
+ S as CloseButton,
515
567
  v as ELLIPSIS,
516
- R as Input,
517
- E as Label,
518
- kt as LabelledInput,
519
- vt as LabelledSelect,
520
- rt as LinkButton,
521
- It as ModalDialog,
568
+ j as Input,
569
+ H as Label,
570
+ yt as LabelledInput,
571
+ kt as LabelledSelect,
572
+ Z as LinkButton,
573
+ mt as ModalDialog,
522
574
  Ct as Paginator,
523
- Nt as SearchInput,
524
- z as Select,
525
- Pt as SimpleCard,
526
- yt as Table,
527
- ot as formatNumber,
528
- at as keyForPage,
529
- x as pageIsEllipsis,
530
- lt as prettifyPageNumber,
531
- dt as progressivePagination,
532
- Tt as roundTen,
533
- tt as useTimeout
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
534
586
  };
@@ -10,7 +10,7 @@
10
10
  --color-lm-main: #4696e5; /* TODO Rename to "brand" */
11
11
  --color-lm-main-dark: #1f69c0;
12
12
  --color-lm-primary: #ffffff;
13
- --color-lm-primary-alfa: rgba(var(--tw-color-lm-primary), .5);
13
+ --color-lm-primary-alfa: rgb(var(--tw-color-lm-primary) / .5);
14
14
  --color-lm-secondary: #f5f6fe;
15
15
  --color-lm-text: #232323;
16
16
  --color-lm-border: rgb(0 0 0 / .125);
@@ -27,7 +27,7 @@
27
27
  --color-dm-main: #4696e5; /* TODO Rename to "brand" */
28
28
  --color-dm-main-dark: #1f69c0;
29
29
  --color-dm-primary: #161b22;
30
- --color-dm-primary-alfa: rgba(var(--tw-color-dm-primary), .8);
30
+ --color-dm-primary-alfa: rgb(var(--tw-color-dm-primary) / .8);
31
31
  --color-dm-secondary: #0f131a;
32
32
  --color-dm-text: rgb(201 209 217);
33
33
  --color-dm-border: rgb(255 255 255 / .15);
package/package.json CHANGED
@@ -88,5 +88,5 @@
88
88
  "not ie <= 11",
89
89
  "not op_mini all"
90
90
  ],
91
- "version": "0.8.0"
91
+ "version": "0.8.2"
92
92
  }