@shlinkio/shlink-frontend-kit 0.8.1 → 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.
@@ -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,6 +58,19 @@ export declare type CloseButtonProps = {
51
58
  onClick?: HTMLProps<HTMLButtonElement>['onClick'];
52
59
  };
53
60
 
61
+ declare type CommonCardModalProps = {
62
+ /** Modal header title */
63
+ title: string;
64
+ };
65
+
66
+ declare type CoverCardModalProps = CommonCardModalProps & {
67
+ /**
68
+ * Cover dialogs have a body that span the whole dialog, and no buttons.
69
+ * The header overlaps the body with semi-transparent background.
70
+ */
71
+ variant: 'cover';
72
+ };
73
+
54
74
  export declare const ELLIPSIS = "...";
55
75
 
56
76
  declare type Ellipsis = typeof ELLIPSIS;
@@ -134,6 +154,22 @@ export declare const progressivePagination: (currentPage: number, pageCount: num
134
154
 
135
155
  declare type RegularButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'>;
136
156
 
157
+ declare type RegularCardModalProps = CommonCardModalProps & {
158
+ /** Danger dialogs use danger variants in title and confirm button */
159
+ variant?: 'default' | 'danger';
160
+ /** Determines the horizontal size of the dialog */
161
+ size?: Size | 'xl';
162
+ /** Value to display in confirm button. Defaults to 'Confirm' */
163
+ confirmText?: string;
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
+ */
170
+ onConfirm?: () => void;
171
+ };
172
+
137
173
  export declare const roundTen: (number: number) => number;
138
174
 
139
175
  export declare const SearchInput: FC<SearchInputProps>;
package/dist/tailwind.js CHANGED
@@ -1,12 +1,12 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as w, Fragment as I } from "react/jsx-runtime";
2
2
  import a from "clsx";
3
- import { createContext as C, useContext as m, useRef as S, useEffect as B, useId as L, useCallback as f, useMemo as v } from "react";
4
- import { Link as R } from "react-router";
5
- import { faClose as U, faSearch as A, faChevronLeft as T, faChevronRight as I } from "@fortawesome/free-solid-svg-icons";
6
- import { FontAwesomeIcon as b } from "@fortawesome/react-fontawesome";
7
- const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r }) => {
8
- const { responsive: e } = m(h);
9
- return /* @__PURE__ */ n(p.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
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
12
  className: a(
@@ -16,9 +16,9 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
16
16
  children: t
17
17
  }
18
18
  ) });
19
- }, O = ({ children: t, className: r }) => {
20
- const { responsive: e } = m(h);
21
- return /* @__PURE__ */ n(p.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
24
  className: a(
@@ -28,9 +28,9 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
28
28
  children: t
29
29
  }
30
30
  ) });
31
- }, W = ({ children: t, className: r }) => {
32
- const { responsive: e } = m(h);
33
- return /* @__PURE__ */ n(p.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
36
  className: a(
@@ -40,8 +40,8 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
40
40
  children: t
41
41
  }
42
42
  ) });
43
- }, _ = ({ children: t, className: r, ...e }) => {
44
- const o = m(p), d = (o == null ? void 0 : o.section) === "body", { responsive: l } = m(h);
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
  {
@@ -60,8 +60,8 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
60
60
  children: t
61
61
  }
62
62
  );
63
- }, q = ({ children: t, className: r, columnName: e, type: o, ...d }) => {
64
- const l = m(p), s = o ?? ((l == null ? void 0 : l.section) !== "body" ? "th" : "td"), { responsive: i } = m(h);
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
66
  s,
67
67
  {
@@ -80,38 +80,11 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
80
80
  children: t
81
81
  }
82
82
  );
83
- }, G = ({ header: t, footer: r, children: e, responsive: o = !0, ...d }) => /* @__PURE__ */ n(h.Provider, { value: { responsive: o }, children: /* @__PURE__ */ c("table", { className: "tw:w-full", ...d, children: [
84
- /* @__PURE__ */ n(D, { children: t }),
85
- /* @__PURE__ */ n(O, { children: e }),
86
- r && /* @__PURE__ */ n(W, { children: r })
87
- ] }) }), bt = Object.assign(G, { Row: _, Cell: q }), ht = ({
88
- open: t,
89
- children: r,
90
- className: e,
91
- ...o
92
- }) => {
93
- const d = S(null);
94
- return B(() => {
95
- var w, N;
96
- const l = document.body, s = l.style.overflow, i = l.style.paddingRight;
97
- if (t) {
98
- const $ = window.outerWidth - l.clientWidth, z = l.scrollHeight > l.clientHeight;
99
- l.style.overflow = "hidden", z && (l.style.paddingRight = `${$}px`), (w = d.current) == null || w.showModal();
100
- } else
101
- (N = d.current) == null || N.close();
102
- return () => {
103
- l.style.overflow = s, l.style.paddingRight = i;
104
- };
105
- }, [t]), /* @__PURE__ */ n(
106
- "dialog",
107
- {
108
- ref: d,
109
- className: a("tw:bg-transparent tw:backdrop:bg-black/50", e),
110
- ...o,
111
- children: t && r
112
- }
113
- );
114
- }, ut = ({
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 = ({
115
88
  children: t,
116
89
  className: r,
117
90
  disabled: e,
@@ -121,11 +94,11 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
121
94
  solid: s = !1,
122
95
  ...i
123
96
  }) => {
124
- const w = "to" in i ? R : "button";
97
+ const c = "to" in i ? _ : "button";
125
98
  return (
126
99
  // @ts-expect-error We are explicitly checking for the `to` prop before using Link
127
100
  /* @__PURE__ */ n(
128
- w,
101
+ c,
129
102
  {
130
103
  className: a(
131
104
  {
@@ -177,7 +150,7 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
177
150
  }
178
151
  )
179
152
  );
180
- }, pt = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
153
+ }, S = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
181
154
  "button",
182
155
  {
183
156
  onClick: t,
@@ -186,9 +159,9 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
186
159
  "tw:rounded-md tw:focus-ring"
187
160
  ),
188
161
  "aria-label": r,
189
- children: /* @__PURE__ */ n(b, { icon: U, size: "xl" })
162
+ children: /* @__PURE__ */ n(h, { icon: U, size: "xl" })
190
163
  }
191
- ), F = ({
164
+ ), j = ({
192
165
  borderless: t = !1,
193
166
  size: r = "md",
194
167
  feedback: e,
@@ -228,15 +201,15 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
228
201
  ...s
229
202
  }
230
203
  );
231
- }, E = ({ required: t, children: r, ...e }) => /* @__PURE__ */ c("label", { ...e, children: [
204
+ }, H = ({ required: t, children: r, ...e }) => /* @__PURE__ */ w("label", { ...e, children: [
232
205
  r,
233
206
  t && /* @__PURE__ */ n("span", { className: "tw:text-danger tw:ml-1", "data-testid": "required-indicator", children: "*" })
234
- ] }), ft = ({ label: t, inputClassName: r, required: e, hiddenRequired: o, error: d, ...l }) => {
235
- const s = L();
236
- return /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
237
- /* @__PURE__ */ n(E, { htmlFor: s, 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 }),
238
211
  /* @__PURE__ */ n(
239
- F,
212
+ j,
240
213
  {
241
214
  id: s,
242
215
  className: r,
@@ -247,7 +220,7 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
247
220
  ),
248
221
  d && /* @__PURE__ */ n("span", { className: "tw:text-danger", children: d })
249
222
  ] });
250
- }, J = 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>`, K = ({
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 = ({
251
224
  className: t,
252
225
  size: r = "md",
253
226
  feedback: e,
@@ -280,34 +253,34 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
280
253
  ),
281
254
  style: {
282
255
  ...o,
283
- backgroundImage: `url("${J}")`,
256
+ backgroundImage: `url("${V}")`,
284
257
  backgroundSize: "16px 12px",
285
258
  backgroundPosition: "right 0.75rem center"
286
259
  },
287
260
  disabled: d,
288
261
  ...l
289
262
  }
290
- ), yt = ({ selectClassName: t, label: r, required: e, hiddenRequired: o, ...d }) => {
291
- const l = L();
292
- return /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
293
- /* @__PURE__ */ n(E, { htmlFor: l, required: e, children: r }),
294
- /* @__PURE__ */ n(K, { 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 })
295
268
  ] });
296
269
  };
297
- function Q(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
298
- const o = S(null), d = f(() => {
270
+ function Y(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
271
+ const o = M(null), d = k(() => {
299
272
  o.current && e(o.current);
300
- }, [e]), l = f((s, i) => {
273
+ }, [e]), l = k((s, i) => {
301
274
  d(), o.current = r(() => {
302
275
  s(), o.current = null;
303
276
  }, i ?? t);
304
277
  }, [d, t, r]);
305
- return B(() => d, [d]), v(
278
+ return E(() => d, [d]), T(
306
279
  () => ({ setTimeout: l, clearCurrentTimeout: d }),
307
280
  [d, l]
308
281
  );
309
282
  }
310
- const xt = ({
283
+ const vt = ({
311
284
  onChange: t,
312
285
  containerClassName: r,
313
286
  inputClassName: e,
@@ -315,12 +288,12 @@ const xt = ({
315
288
  size: o = "lg",
316
289
  ...d
317
290
  }) => {
318
- const { setTimeout: l, clearCurrentTimeout: s } = Q(500), i = f((w) => {
319
- w ? l(() => t(w)) : (s(), t(w));
291
+ const { setTimeout: l, clearCurrentTimeout: s } = Y(500), i = k((c) => {
292
+ c ? l(() => t(c)) : (s(), t(c));
320
293
  }, [s, t, l]);
321
- return /* @__PURE__ */ c("div", { className: a("tw:group tw:relative tw:focus-within:z-10", r), children: [
294
+ return /* @__PURE__ */ w("div", { className: a("tw:group tw:relative tw:focus-within:z-10", r), children: [
322
295
  /* @__PURE__ */ n(
323
- b,
296
+ h,
324
297
  {
325
298
  icon: A,
326
299
  className: a(
@@ -334,7 +307,7 @@ const xt = ({
334
307
  }
335
308
  ),
336
309
  /* @__PURE__ */ n(
337
- F,
310
+ j,
338
311
  {
339
312
  type: "search",
340
313
  className: a(
@@ -345,19 +318,13 @@ const xt = ({
345
318
  e
346
319
  ),
347
320
  placeholder: "Search...",
348
- onChange: (w) => i(w.target.value),
321
+ onChange: (c) => i(c.target.value),
349
322
  size: o,
350
323
  ...d
351
324
  }
352
325
  )
353
326
  ] });
354
- }, V = new Intl.NumberFormat("en-US"), X = (t) => V.format(Number(t)), P = 10, kt = (t) => Math.ceil(t / P) * P, g = 2, y = "...", Y = (t, r) => Array.from({ length: r - t }, (e, o) => t + o), Z = (t, r) => {
355
- const e = Y(
356
- Math.max(g, t - g),
357
- Math.min(r - 1, t + g) + 1
358
- );
359
- return t - g > g && e.unshift(y), t + g < r - 1 && e.push(y), e.unshift(1), e.push(r), e;
360
- }, u = (t) => t === y, tt = (t) => u(t) ? t : X(t), rt = (t, r) => u(t) ? `${t}_${r}` : `${t}`, vt = ({ className: t, disabled: r, size: e = "md", ...o }) => /* @__PURE__ */ n(
327
+ }, Z = ({ className: t, disabled: r, size: e = "md", ...o }) => /* @__PURE__ */ n(
361
328
  "button",
362
329
  {
363
330
  className: a(
@@ -374,46 +341,52 @@ const xt = ({
374
341
  disabled: r,
375
342
  ...o
376
343
  }
377
- ), M = [
344
+ ), tt = new Intl.NumberFormat("en-US"), rt = (t) => tt.format(Number(t)), F = 10, Nt = (t) => Math.ceil(t / F) * F, b = 2, v = "...", et = (t, r) => Array.from({ length: r - t }, (e, o) => t + o), ot = (t, r) => {
345
+ const e = et(
346
+ Math.max(b, t - b),
347
+ Math.min(r - 1, t + b) + 1
348
+ );
349
+ return t - b > b && e.unshift(v), t + b < r - 1 && e.push(v), e.unshift(1), e.push(r), e;
350
+ }, p = (t) => t === v, nt = (t) => p(t) ? t : rt(t), dt = (t, r) => p(t) ? `${t}_${r}` : `${t}`, z = [
378
351
  "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
379
352
  "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
380
- ], j = (t = !1) => a(
381
- M,
353
+ ], D = (t = !1) => a(
354
+ z,
382
355
  "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
383
356
  "tw:focus-ring tw:focus-visible:z-1",
384
357
  {
385
358
  "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
386
359
  "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
387
360
  }
388
- ), k = ({ children: t }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: a(M, "tw:px-3 py-2 tw:text-gray-400"), children: t }), H = () => /* @__PURE__ */ n(k, { children: y });
389
- function et({ children: t, active: r, isEllipsis: e, href: o, ...d }) {
390
- const l = v(() => j(r), [r]);
391
- return e ? /* @__PURE__ */ n(H, {}) : /* @__PURE__ */ n(R, { className: l, to: o, ...d, children: t });
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 });
392
365
  }
393
- function ot({ children: t, active: r, isEllipsis: e, ...o }) {
394
- const d = v(() => j(r), [r]);
395
- return e ? /* @__PURE__ */ n(H, {}) : /* @__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 });
396
369
  }
397
- const Nt = ({ currentPage: t, pagesCount: r, ...e }) => {
398
- const o = "urlForPage" in e, d = o ? et : ot, l = f(
399
- (s) => o ? { href: u(s) ? void 0 : e.urlForPage(s) } : { onClick: () => !u(s) && e.onPageChange(s) },
370
+ const Ct = ({ currentPage: t, pagesCount: r, ...e }) => {
371
+ const o = "urlForPage" in e, d = o ? lt : st, l = k(
372
+ (s) => o ? { href: p(s) ? void 0 : e.urlForPage(s) } : { onClick: () => !p(s) && e.onPageChange(s) },
400
373
  [o, e]
401
374
  );
402
- return r < 2 ? null : /* @__PURE__ */ c("div", { className: "tw:select-none tw:flex", "data-testid": "paginator", children: [
403
- t === 1 ? /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(b, { size: "xs", icon: T }) }) : /* @__PURE__ */ n(d, { ...l(Math.max(1, t - 1)), "aria-label": "Previous", children: /* @__PURE__ */ n(b, { size: "xs", icon: T }) }),
404
- Z(t, r).map((s, i) => /* @__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(
405
378
  d,
406
379
  {
407
380
  active: s === t,
408
- isEllipsis: u(s),
381
+ isEllipsis: p(s),
409
382
  ...l(s),
410
- children: tt(s)
383
+ children: nt(s)
411
384
  },
412
- rt(s, i)
385
+ dt(s, i)
413
386
  )),
414
- t === r ? /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(b, { size: "xs", icon: I }) }) : /* @__PURE__ */ n(d, { ...l(Math.min(r, t + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(b, { size: "xs", icon: I }) })
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 }) })
415
388
  ] });
416
- }, nt = ({ className: t, ...r }) => /* @__PURE__ */ n(
389
+ }, at = ({ className: t, ...r }) => /* @__PURE__ */ n(
417
390
  "div",
418
391
  {
419
392
  className: a(
@@ -423,7 +396,7 @@ const Nt = ({ currentPage: t, pagesCount: r, ...e }) => {
423
396
  ),
424
397
  ...r
425
398
  }
426
- ), dt = ({ className: t, ...r }) => /* @__PURE__ */ n(
399
+ ), it = ({ className: t, ...r }) => /* @__PURE__ */ n(
427
400
  "div",
428
401
  {
429
402
  className: a(
@@ -433,7 +406,7 @@ const Nt = ({ currentPage: t, pagesCount: r, ...e }) => {
433
406
  ),
434
407
  ...r
435
408
  }
436
- ), lt = ({ className: t, ...r }) => /* @__PURE__ */ n(
409
+ ), wt = ({ className: t, ...r }) => /* @__PURE__ */ n(
437
410
  "div",
438
411
  {
439
412
  className: a(
@@ -443,7 +416,7 @@ const Nt = ({ currentPage: t, pagesCount: r, ...e }) => {
443
416
  ),
444
417
  ...r
445
418
  }
446
- ), st = ({ className: t, ...r }) => /* @__PURE__ */ n(
419
+ ), ct = ({ className: t, ...r }) => /* @__PURE__ */ n(
447
420
  "div",
448
421
  {
449
422
  className: a(
@@ -453,42 +426,161 @@ const Nt = ({ currentPage: t, pagesCount: r, ...e }) => {
453
426
  ),
454
427
  ...r
455
428
  }
456
- ), x = Object.assign(st, { Body: dt, Header: nt, Footer: lt }), Tt = ({ bodyClassName: t, children: r, ...e }) => {
429
+ ), m = Object.assign(ct, { Body: it, Header: at, Footer: wt }), Tt = ({ bodyClassName: t, children: r, ...e }) => {
457
430
  const { title: o, titleSize: d = "md", ...l } = "title" in e ? e : {
458
431
  ...e,
459
432
  title: void 0,
460
433
  titleSize: void 0
461
434
  };
462
- return /* @__PURE__ */ c(x, { ...l, children: [
463
- o && /* @__PURE__ */ c(x.Header, { children: [
435
+ return /* @__PURE__ */ w(m, { ...l, children: [
436
+ o && /* @__PURE__ */ w(m.Header, { children: [
464
437
  d === "lg" && /* @__PURE__ */ n("h4", { children: o }),
465
438
  d === "md" && /* @__PURE__ */ n("h5", { children: o }),
466
439
  d === "sm" && /* @__PURE__ */ n("h6", { children: o })
467
440
  ] }),
468
- /* @__PURE__ */ n(x.Body, { className: t, children: r })
441
+ /* @__PURE__ */ n(m.Body, { className: t, children: r })
469
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
+ );
470
+ }, It = ({
471
+ open: t,
472
+ onClose: r,
473
+ variant: e = "default",
474
+ title: o,
475
+ children: d,
476
+ className: l,
477
+ ...s
478
+ }) => {
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,
488
+ {
489
+ open: t,
490
+ onClose: r,
491
+ className: a(
492
+ { "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": t },
493
+ l
494
+ ),
495
+ ...N,
496
+ children: /* @__PURE__ */ n(
497
+ "div",
498
+ {
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
+ ] }) })
557
+ }
558
+ )
559
+ }
560
+ );
470
561
  };
471
562
  export {
472
- ut as Button,
473
- x as Card,
474
- pt as CloseButton,
475
- y as ELLIPSIS,
476
- F as Input,
477
- E as Label,
478
- ft as LabelledInput,
479
- yt as LabelledSelect,
480
- vt as LinkButton,
481
- ht as ModalDialog,
482
- Nt as Paginator,
483
- xt as SearchInput,
484
- K as Select,
563
+ Q as Button,
564
+ m as Card,
565
+ It as CardModal,
566
+ S as CloseButton,
567
+ v as ELLIPSIS,
568
+ j as Input,
569
+ H as Label,
570
+ yt as LabelledInput,
571
+ kt as LabelledSelect,
572
+ Z as LinkButton,
573
+ mt as ModalDialog,
574
+ Ct as Paginator,
575
+ vt as SearchInput,
576
+ X as Select,
485
577
  Tt as SimpleCard,
486
- bt as Table,
487
- X as formatNumber,
488
- rt as keyForPage,
489
- u as pageIsEllipsis,
490
- tt as prettifyPageNumber,
491
- Z as progressivePagination,
492
- kt as roundTen,
493
- Q as useTimeout
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
494
586
  };
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.1"
91
+ "version": "0.8.2"
92
92
  }