@shlinkio/shlink-frontend-kit 0.8.1 → 0.8.3

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.
@@ -1,3 +1,4 @@
1
+ import { ChangeEvent } from 'react';
1
2
  import { FC } from 'react';
2
3
  import { HTMLProps } from 'react';
3
4
  import { InputHTMLAttributes } from 'react';
@@ -10,6 +11,10 @@ export declare type BaseInputProps = {
10
11
  feedback?: 'error';
11
12
  };
12
13
 
14
+ declare type BooleanControlProps = Omit<HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'defaultValue'> & {
15
+ onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
16
+ };
17
+
13
18
  export declare const Button: FC<ButtonProps>;
14
19
 
15
20
  export declare type ButtonProps = PropsWithChildren<{
@@ -29,6 +34,13 @@ export declare const Card: FC<CardProps> & {
29
34
  Footer: FC<CardProps>;
30
35
  };
31
36
 
37
+ /**
38
+ * A ModalDialog that renders a Card as its content
39
+ */
40
+ export declare const CardModal: FC<CardModalProps>;
41
+
42
+ export declare type CardModalProps = Omit<ModalDialogProps, 'title' | 'size'> & (CoverCardModalProps | RegularCardModalProps);
43
+
32
44
  export declare type CardProps = HTMLProps<HTMLDivElement>;
33
45
 
34
46
  export declare type CellProps = HTMLProps<HTMLTableCellElement> & {
@@ -44,6 +56,10 @@ export declare type CellProps = HTMLProps<HTMLTableCellElement> & {
44
56
  type?: 'td' | 'th';
45
57
  };
46
58
 
59
+ export declare const Checkbox: FC<CheckboxProps>;
60
+
61
+ export declare type CheckboxProps = BooleanControlProps;
62
+
47
63
  export declare const CloseButton: FC<CloseButtonProps>;
48
64
 
49
65
  export declare type CloseButtonProps = {
@@ -51,6 +67,19 @@ export declare type CloseButtonProps = {
51
67
  onClick?: HTMLProps<HTMLButtonElement>['onClick'];
52
68
  };
53
69
 
70
+ declare type CommonCardModalProps = {
71
+ /** Modal header title */
72
+ title: string;
73
+ };
74
+
75
+ declare type CoverCardModalProps = CommonCardModalProps & {
76
+ /**
77
+ * Cover dialogs have a body that span the whole dialog, and no buttons.
78
+ * The header overlaps the body with semi-transparent background.
79
+ */
80
+ variant: 'cover';
81
+ };
82
+
54
83
  export declare const ELLIPSIS = "...";
55
84
 
56
85
  declare type Ellipsis = typeof ELLIPSIS;
@@ -70,7 +99,7 @@ export declare const Label: FC<LabelProps>;
70
99
  export declare const LabelledInput: FC<LabelledInputProps>;
71
100
 
72
101
  export declare type LabelledInputProps = Omit<InputProps, 'className' | 'id' | 'feedback'> & {
73
- label: string;
102
+ label: RequiredReactNode;
74
103
  inputClassName?: string;
75
104
  error?: string;
76
105
  /** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
@@ -80,7 +109,7 @@ export declare type LabelledInputProps = Omit<InputProps, 'className' | 'id' | '
80
109
  export declare const LabelledSelect: FC<LabelledSelectProps>;
81
110
 
82
111
  export declare type LabelledSelectProps = Omit<SelectProps, 'className' | 'id'> & {
83
- label: string;
112
+ label: RequiredReactNode;
84
113
  selectClassName?: string;
85
114
  /** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
86
115
  hiddenRequired?: boolean;
@@ -99,6 +128,17 @@ export declare type LinkButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'
99
128
 
100
129
  declare type LinkButtonProps_2 = LinkProps;
101
130
 
131
+ /**
132
+ * Component used to display a card with general information, about current page status, loading, etc.
133
+ */
134
+ export declare const Message: FC<MessageProps>;
135
+
136
+ export declare type MessageProps = PropsWithChildren<{
137
+ className?: string;
138
+ loading?: boolean;
139
+ variant?: 'default' | 'error';
140
+ }>;
141
+
102
142
  export declare const ModalDialog: FC<ModalDialogProps>;
103
143
 
104
144
  export declare type ModalDialogProps = HTMLProps<HTMLDialogElement> & {
@@ -108,6 +148,15 @@ export declare type ModalDialogProps = HTMLProps<HTMLDialogElement> & {
108
148
  onClose: () => void;
109
149
  };
110
150
 
151
+ export declare const NavPills: FC<NavPillsProps> & {
152
+ Pill: FC<LinkProps>;
153
+ };
154
+
155
+ export declare type NavPillsProps = PropsWithChildren<{
156
+ fill?: boolean;
157
+ className?: string;
158
+ }>;
159
+
111
160
  declare type NoTitleProps = {
112
161
  title?: never;
113
162
  titleSize?: never;
@@ -128,12 +177,43 @@ export declare type PaginatorProps = {
128
177
  urlForPage: (pageNumber: number) => string;
129
178
  });
130
179
 
180
+ export declare type PillProps = LinkProps;
181
+
131
182
  export declare const prettifyPageNumber: (pageNumber: NumberOrEllipsis) => string;
132
183
 
133
184
  export declare const progressivePagination: (currentPage: number, pageCount: number) => NumberOrEllipsis[];
134
185
 
135
186
  declare type RegularButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'>;
136
187
 
188
+ declare type RegularCardModalProps = CommonCardModalProps & {
189
+ /** Danger dialogs use danger variants in title and confirm button */
190
+ variant?: 'default' | 'danger';
191
+ /** Determines the horizontal size of the dialog */
192
+ size?: Size | 'xl';
193
+ /** Value to display in confirm button. Defaults to 'Confirm' */
194
+ confirmText?: string;
195
+ /** Whether the confirm button is disabled or not */
196
+ confirmDisabled?: boolean;
197
+ /**
198
+ * A footer with confirm and cancel buttons will be rendered if provided.
199
+ * Invoked when the confirm button is actioned.
200
+ */
201
+ onConfirm?: () => void;
202
+ };
203
+
204
+ export declare type RequiredReactNode = Exclude<ReactNode, undefined | null>;
205
+
206
+ /**
207
+ * Component used to display the result of an operation, which can be a success, failure or warning.
208
+ */
209
+ export declare const Result: FC<ResultProps>;
210
+
211
+ export declare type ResultProps = PropsWithChildren<{
212
+ variant: 'success' | 'error' | 'warning';
213
+ className?: string;
214
+ size?: Size;
215
+ }>;
216
+
137
217
  export declare const roundTen: (number: number) => number;
138
218
 
139
219
  export declare const SearchInput: FC<SearchInputProps>;
@@ -158,7 +238,7 @@ export declare type SimpleCardProps = Omit<CardProps, 'title' | 'size'> & {
158
238
  bodyClassName?: string;
159
239
  } & (TitleProps | NoTitleProps);
160
240
 
161
- declare type Size = 'sm' | 'md' | 'lg';
241
+ export declare type Size = 'sm' | 'md' | 'lg';
162
242
 
163
243
  export declare const Table: FC<TableProps> & {
164
244
  Row: FC<HTMLProps<HTMLTableRowElement>>;
@@ -184,6 +264,10 @@ declare type TitleProps = {
184
264
  titleSize?: Size;
185
265
  };
186
266
 
267
+ export declare const ToggleSwitch: FC<ToggleSwitchProps>;
268
+
269
+ export declare type ToggleSwitchProps = BooleanControlProps;
270
+
187
271
  export declare function useTimeout(defaultDelay: number,
188
272
  /** Test seam. Defaults to global setTimeout */
189
273
  setTimeout_?: typeof globalThis.setTimeout,
package/dist/tailwind.js CHANGED
@@ -1,136 +1,109 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
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";
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";
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";
6
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(
7
+ const v = F(void 0), x = F({ responsive: !0 }), tt = ({ children: t, className: e }) => {
8
+ const { responsive: r } = g(x);
9
+ return /* @__PURE__ */ n(v.Provider, { value: { section: "head" }, children: /* @__PURE__ */ n(
10
10
  "thead",
11
11
  {
12
- className: a(
13
- { "tw:hidden tw:lg:table-header-group": e },
14
- r
12
+ className: s(
13
+ { "tw:hidden tw:lg:table-header-group": r },
14
+ e
15
15
  ),
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
+ }, et = ({ children: t, className: e }) => {
20
+ const { responsive: r } = g(x);
21
+ return /* @__PURE__ */ n(v.Provider, { value: { section: "body" }, children: /* @__PURE__ */ n(
22
22
  "tbody",
23
23
  {
24
- className: a(
25
- { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": e },
26
- r
24
+ className: s(
25
+ { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3": r },
26
+ e
27
27
  ),
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
+ }, rt = ({ children: t, className: e }) => {
32
+ const { responsive: r } = g(x);
33
+ return /* @__PURE__ */ n(v.Provider, { value: { section: "footer" }, children: /* @__PURE__ */ n(
34
34
  "tfoot",
35
35
  {
36
- className: a(
37
- { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": e },
38
- r
36
+ className: s(
37
+ { "tw:lg:table-row-group tw:flex tw:flex-col tw:gap-y-3 tw:mt-4": r },
38
+ e
39
39
  ),
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
+ }, ot = ({ children: t, className: e, ...r }) => {
44
+ const o = g(v), d = (o == null ? void 0 : o.section) === "body", { responsive: a } = g(x);
45
45
  return /* @__PURE__ */ n(
46
46
  "tr",
47
47
  {
48
- className: a(
48
+ className: s(
49
49
  "tw:group",
50
50
  {
51
- "tw:lg:table-row tw:flex tw:flex-col": l,
52
- "tw:lg:border-0 tw:border-y-2 tw:border-lm-border tw:dark:border-dm-border": l,
51
+ "tw:lg:table-row tw:flex tw:flex-col": a,
52
+ "tw:lg:border-0 tw:border-y-2 tw:border-lm-border tw:dark:border-dm-border": a,
53
53
  "tw:hover:bg-lm-primary tw:dark:hover:bg-dm-primary": d,
54
54
  // Use a different hover bg color depending on the table being inside a card or not
55
55
  "tw:group-[&]/card:hover:bg-lm-secondary tw:dark:group-[&]/card:hover:bg-dm-secondary": d
56
56
  },
57
- r
57
+ e
58
58
  ),
59
- ...e,
59
+ ...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
+ }, 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
65
  return /* @__PURE__ */ n(
66
- s,
66
+ l,
67
67
  {
68
- "data-column": i ? e : void 0,
69
- className: a(
68
+ "data-column": w ? r : void 0,
69
+ className: s(
70
70
  "tw:p-2 tw:border-lm-border tw:dark:border-dm-border",
71
71
  {
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,
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
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": i && s === "td"
75
+ "tw:before:lg:hidden tw:before:content-[attr(data-column)] tw:before:font-bold tw:before:mr-1": w && l === "td"
76
76
  },
77
- r
77
+ e
78
78
  ),
79
79
  ...d,
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
+ }, 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 = ({
115
88
  children: t,
116
- className: r,
117
- disabled: e,
89
+ className: e,
90
+ disabled: r,
118
91
  variant: o = "primary",
119
92
  size: d = "md",
120
- inline: l = !1,
121
- solid: s = !1,
122
- ...i
93
+ inline: a = !1,
94
+ solid: l = !1,
95
+ ...w
123
96
  }) => {
124
- const w = "to" in i ? R : "button";
97
+ const c = "to" in w ? U : "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
- className: a(
103
+ className: s(
131
104
  {
132
- "tw:inline-flex": l,
133
- "tw:flex": !l
105
+ "tw:inline-flex": a,
106
+ "tw:flex": !a
134
107
  },
135
108
  "tw:gap-2 tw:items-center tw:justify-center",
136
109
  "tw:border tw:rounded-md tw:no-underline",
@@ -147,11 +120,11 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
147
120
  {
148
121
  "tw:border-brand tw:text-brand": o === "primary",
149
122
  "tw:border-zinc-500": o === "secondary",
150
- "tw:text-zinc-500": o === "secondary" && !s,
123
+ "tw:text-zinc-500": o === "secondary" && !l,
151
124
  "tw:border-danger": o === "danger",
152
- "tw:text-danger": o === "danger" && !s
125
+ "tw:text-danger": o === "danger" && !l
153
126
  },
154
- s && {
127
+ l && {
155
128
  "tw:text-white": !0,
156
129
  "tw:bg-brand": o === "primary",
157
130
  "tw:highlight:bg-brand-dark tw:highlight:border-brand-dark": o === "primary",
@@ -160,118 +133,143 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
160
133
  "tw:bg-danger": o === "danger",
161
134
  "tw:highlight:bg-danger-dark tw:highlight:border-danger-dark": o === "danger"
162
135
  },
163
- !e && {
164
- "tw:highlight:text-white": !s,
136
+ !r && {
137
+ "tw:highlight:text-white": !l,
165
138
  "tw:highlight:bg-brand": o === "primary",
166
139
  "tw:highlight:bg-zinc-500": o === "secondary",
167
140
  "tw:highlight:bg-danger": o === "danger"
168
141
  },
169
142
  {
170
- "tw:pointer-events-none tw:opacity-65": e
143
+ "tw:pointer-events-none tw:opacity-65": r
171
144
  },
172
- r
145
+ e
173
146
  ),
174
- disabled: e,
175
- ...i,
147
+ disabled: r,
148
+ ...w,
176
149
  children: t
177
150
  }
178
151
  )
179
152
  );
180
- }, pt = ({ onClick: t, label: r = "Close" }) => /* @__PURE__ */ n(
153
+ }, z = ({ className: t, onChange: e, ...r }) => {
154
+ const o = N((d) => e == null ? void 0 : e(d.target.checked, d), [e]);
155
+ return /* @__PURE__ */ n(
156
+ "input",
157
+ {
158
+ type: "checkbox",
159
+ className: f(
160
+ "tw:appearance-none tw:focus-ring",
161
+ "tw:border-1 tw:border-lm-input-border tw:dark:border-dm-input-border",
162
+ "tw:bg-lm-primary tw:dark:bg-dm-primary tw:checked:bg-brand tw:bg-no-repeat",
163
+ // Use different background color when rendered inside a card
164
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input",
165
+ t
166
+ ),
167
+ onChange: o,
168
+ ...r
169
+ }
170
+ );
171
+ }, Et = ({ className: t, ...e }) => /* @__PURE__ */ n(
172
+ z,
173
+ {
174
+ className: f("tw:rounded-sm tw:w-4 tw:h-4 tw:checked:bg-(image:--tick) tw:bg-center", t),
175
+ ...e
176
+ }
177
+ ), H = ({ onClick: t, label: e = "Close" }) => /* @__PURE__ */ n(
181
178
  "button",
182
179
  {
183
180
  onClick: t,
184
- className: a(
181
+ className: s(
185
182
  "tw:opacity-50 tw:highlight:opacity-80 tw:transition-opacity",
186
183
  "tw:rounded-md tw:focus-ring"
187
184
  ),
188
- "aria-label": r,
189
- children: /* @__PURE__ */ n(b, { icon: U, size: "xl" })
185
+ "aria-label": e,
186
+ children: /* @__PURE__ */ n(b, { icon: X, size: "xl" })
190
187
  }
191
- ), F = ({
188
+ ), A = ({
192
189
  borderless: t = !1,
193
- size: r = "md",
194
- feedback: e,
190
+ size: e = "md",
191
+ feedback: r,
195
192
  className: o,
196
193
  disabled: d,
197
- readOnly: l,
198
- ...s
194
+ readOnly: a,
195
+ ...l
199
196
  }) => {
200
- const i = !d && !l;
197
+ const w = !d && !a;
201
198
  return /* @__PURE__ */ n(
202
199
  "input",
203
200
  {
204
- className: a(
201
+ className: s(
205
202
  "tw:w-full",
206
203
  {
207
- "tw:focus-ring": !e,
208
- "tw:focus-ring-danger": e === "error"
204
+ "tw:focus-ring": !r,
205
+ "tw:focus-ring-danger": r === "error"
209
206
  },
210
207
  {
211
- "tw:px-2 tw:py-1 tw:text-sm": r === "sm",
212
- "tw:px-3 tw:py-1.5": r === "md",
213
- "tw:px-4 tw:py-2 tw:text-xl": r === "lg"
208
+ "tw:px-2 tw:py-1 tw:text-sm": e === "sm",
209
+ "tw:px-3 tw:py-1.5": e === "md",
210
+ "tw:px-4 tw:py-2 tw:text-xl": e === "lg"
214
211
  },
215
212
  {
216
213
  "tw:rounded-md tw:border": !t,
217
- "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !e,
218
- "tw:border-danger": !t && e === "error",
219
- "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": !i,
220
- "tw:bg-lm-primary tw:dark:bg-dm-primary": i,
214
+ "tw:border-lm-input-border tw:dark:border-dm-input-border": !t && !r,
215
+ "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,
221
218
  // Use different background color when rendered inside a card
222
- "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": i
219
+ "tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": w
223
220
  },
224
221
  o
225
222
  ),
226
223
  disabled: d,
227
- readOnly: l,
228
- ...s
224
+ readOnly: a,
225
+ ...l
229
226
  }
230
227
  );
231
- }, E = ({ required: t, children: r, ...e }) => /* @__PURE__ */ c("label", { ...e, children: [
232
- r,
228
+ }, W = ({ required: t, children: e, ...r }) => /* @__PURE__ */ i("label", { ...r, children: [
229
+ e,
233
230
  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 }),
231
+ ] }), Mt = ({ label: t, inputClassName: e, required: r, hiddenRequired: o, error: d, ...a }) => {
232
+ const l = $();
233
+ return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
234
+ /* @__PURE__ */ n(W, { htmlFor: l, required: r, children: t }),
238
235
  /* @__PURE__ */ n(
239
- F,
236
+ A,
240
237
  {
241
- id: s,
242
- className: r,
243
- required: e || o,
238
+ id: l,
239
+ className: e,
240
+ required: r || o,
244
241
  feedback: d ? "error" : void 0,
245
- ...l
242
+ ...a
246
243
  }
247
244
  ),
248
245
  d && /* @__PURE__ */ n("span", { className: "tw:text-danger", children: d })
249
246
  ] });
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 = ({
247
+ }, at = ({
251
248
  className: t,
252
- size: r = "md",
253
- feedback: e,
249
+ size: e = "md",
250
+ feedback: r,
254
251
  style: o = {},
255
252
  disabled: d,
256
- ...l
253
+ ...a
257
254
  }) => /* @__PURE__ */ n(
258
255
  "select",
259
256
  {
260
- className: a(
261
- "tw:w-full tw:appearance-none tw:pr-9 tw:bg-no-repeat",
257
+ className: s(
258
+ "tw:w-full tw:appearance-none tw:pr-9",
259
+ "tw:bg-(image:--chevron-down) tw:bg-no-repeat",
262
260
  {
263
- "tw:focus-ring": !e,
264
- "tw:focus-ring-danger": e === "error"
261
+ "tw:focus-ring": !r,
262
+ "tw:focus-ring-danger": r === "error"
265
263
  },
266
264
  "tw:rounded-md tw:border",
267
265
  {
268
- "tw:border-lm-input-border tw:dark:border-dm-input-border": !e,
269
- "tw:border-danger": e === "error"
266
+ "tw:border-lm-input-border tw:dark:border-dm-input-border": !r,
267
+ "tw:border-danger": r === "error"
270
268
  },
271
269
  {
272
- "tw:pl-2 tw:py-1 tw:text-sm": r === "sm",
273
- "tw:pl-3 tw:py-1.5": r === "md",
274
- "tw:pl-4 tw:py-2 tw:text-xl": r === "lg",
270
+ "tw:pl-2 tw:py-1 tw:text-sm": e === "sm",
271
+ "tw:pl-3 tw:py-1.5": e === "md",
272
+ "tw:pl-4 tw:py-2 tw:text-xl": e === "lg",
275
273
  "tw:bg-lm-disabled-input tw:dark:bg-dm-disabled-input": d,
276
274
  // Apply different background color when rendered inside a card
277
275
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:group-[&]/card:bg-lm-input tw:group-[&]/card:dark:bg-dm-input": !d
@@ -280,50 +278,48 @@ const p = C(void 0), h = C({ responsive: !0 }), D = ({ children: t, className: r
280
278
  ),
281
279
  style: {
282
280
  ...o,
283
- backgroundImage: `url("${J}")`,
284
- backgroundSize: "16px 12px",
285
- backgroundPosition: "right 0.75rem center"
281
+ background: "right 0.75rem center / 16px 12px"
286
282
  },
287
283
  disabled: d,
288
- ...l
284
+ ...a
289
285
  }
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 })
286
+ ), _t = ({ selectClassName: t, label: e, required: r, hiddenRequired: o, ...d }) => {
287
+ const a = $();
288
+ return /* @__PURE__ */ i("div", { className: "tw:flex tw:flex-col tw:gap-1", children: [
289
+ /* @__PURE__ */ n(W, { htmlFor: a, required: r, children: e }),
290
+ /* @__PURE__ */ n(at, { id: a, className: t, required: r || o, ...d })
295
291
  ] });
296
292
  };
297
- function Q(t, r = globalThis.setTimeout.bind(globalThis), e = globalThis.clearTimeout.bind(globalThis)) {
298
- const o = S(null), d = f(() => {
299
- o.current && e(o.current);
300
- }, [e]), l = f((s, i) => {
301
- d(), o.current = r(() => {
302
- s(), o.current = null;
303
- }, i ?? t);
304
- }, [d, t, r]);
305
- return B(() => d, [d]), v(
306
- () => ({ setTimeout: l, clearCurrentTimeout: d }),
307
- [d, l]
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]
308
304
  );
309
305
  }
310
- const xt = ({
306
+ const jt = ({
311
307
  onChange: t,
312
- containerClassName: r,
313
- inputClassName: e,
308
+ containerClassName: e,
309
+ inputClassName: r,
314
310
  // Inputs have a default 'md' size. Search inputs are usually 'lg' as they are rendered at the top of sections
315
311
  size: o = "lg",
316
312
  ...d
317
313
  }) => {
318
- const { setTimeout: l, clearCurrentTimeout: s } = Q(500), i = f((w) => {
319
- w ? l(() => t(w)) : (s(), t(w));
320
- }, [s, t, l]);
321
- return /* @__PURE__ */ c("div", { className: a("tw:group tw:relative tw:focus-within:z-10", r), children: [
314
+ const { setTimeout: a, clearCurrentTimeout: l } = st(500), w = N((c) => {
315
+ c ? a(() => t(c)) : (l(), t(c));
316
+ }, [l, t, a]);
317
+ return /* @__PURE__ */ i("div", { className: s("tw:group tw:relative tw:focus-within:z-10", e), children: [
322
318
  /* @__PURE__ */ n(
323
319
  b,
324
320
  {
325
- icon: A,
326
- className: a(
321
+ icon: Y,
322
+ className: s(
327
323
  "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:transition-colors",
328
324
  "tw:text-placeholder tw:group-focus-within:text-lm-text tw:dark:group-focus-within:text-dm-text",
329
325
  {
@@ -334,161 +330,379 @@ const xt = ({
334
330
  }
335
331
  ),
336
332
  /* @__PURE__ */ n(
337
- F,
333
+ A,
338
334
  {
339
335
  type: "search",
340
- className: a(
336
+ className: s(
341
337
  {
342
338
  "tw:pl-9": o !== "sm",
343
339
  "tw:pl-7": o === "sm"
344
340
  },
345
- e
341
+ r
346
342
  ),
347
343
  placeholder: "Search...",
348
- onChange: (w) => i(w.target.value),
344
+ onChange: (c) => w(c.target.value),
349
345
  size: o,
350
346
  ...d
351
347
  }
352
348
  )
353
349
  ] });
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(
350
+ }, Dt = ({ className: t, ...e }) => /* @__PURE__ */ n(
351
+ z,
352
+ {
353
+ className: f(
354
+ "tw:rounded-full tw:w-8 tw:h-4",
355
+ "tw:bg-(image:--circle-grey-dark) tw:dark:bg-(image:--circle-grey-light) tw:checked:bg-(image:--circle-white)",
356
+ "tw:focus-visible:not-checked:bg-(image:--circle-light-blue)",
357
+ "tw:checked:bg-right tw:transition-[background-position]",
358
+ t
359
+ ),
360
+ ...e
361
+ }
362
+ ), wt = ({ className: t, disabled: e, size: r = "md", ...o }) => /* @__PURE__ */ n(
361
363
  "button",
362
364
  {
363
- className: a(
365
+ className: s(
364
366
  "tw:inline-flex tw:rounded-md tw:focus-ring",
365
367
  "tw:text-brand tw:highlight:text-brand-dark tw:highlight:underline",
366
368
  {
367
- "tw:px-1.5 tw:py-1 tw:text-sm": e === "sm",
368
- "tw:px-3 tw:py-1.5": e === "md",
369
- "tw:px-4 tw:py-2 tw:text-lg": e === "lg",
370
- "tw:pointer-events-none tw:opacity-65": r
369
+ "tw:px-1.5 tw:py-1 tw:text-sm": r === "sm",
370
+ "tw:px-3 tw:py-1.5": r === "md",
371
+ "tw:px-4 tw:py-2 tw:text-lg": r === "lg",
372
+ "tw:pointer-events-none tw:opacity-65": e
371
373
  },
372
374
  t
373
375
  ),
374
- disabled: r,
376
+ disabled: e,
375
377
  ...o
376
378
  }
377
- ), M = [
378
- "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
379
- "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
380
- ], j = (t = !1) => a(
381
- M,
382
- "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
383
- "tw:focus-ring tw:focus-visible:z-1",
384
- {
385
- "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
386
- "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
387
- }
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 });
392
- }
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 });
396
- }
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) },
400
- [o, e]
401
- );
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(
405
- d,
406
- {
407
- active: s === t,
408
- isEllipsis: u(s),
409
- ...l(s),
410
- children: tt(s)
411
- },
412
- rt(s, i)
413
- )),
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 }) })
415
- ] });
416
- }, nt = ({ className: t, ...r }) => /* @__PURE__ */ n(
379
+ ), it = ({ className: t, ...e }) => /* @__PURE__ */ n(
417
380
  "div",
418
381
  {
419
- className: a(
382
+ className: s(
420
383
  "tw:px-4 tw:py-3 tw:rounded-t-md",
421
384
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-b tw:border-lm-border tw:dark:border-dm-border",
422
385
  t
423
386
  ),
424
- ...r
387
+ ...e
425
388
  }
426
- ), dt = ({ className: t, ...r }) => /* @__PURE__ */ n(
389
+ ), ct = ({ className: t, ...e }) => /* @__PURE__ */ n(
427
390
  "div",
428
391
  {
429
- className: a(
392
+ className: s(
430
393
  "tw:p-4 tw:bg-lm-primary tw:dark:bg-dm-primary tw:first:rounded-t-md",
431
394
  "tw:first:rounded-t-md tw:last:rounded-b-md",
432
395
  t
433
396
  ),
434
- ...r
397
+ ...e
435
398
  }
436
- ), lt = ({ className: t, ...r }) => /* @__PURE__ */ n(
399
+ ), mt = ({ className: t, ...e }) => /* @__PURE__ */ n(
437
400
  "div",
438
401
  {
439
- className: a(
402
+ className: s(
440
403
  "tw:px-4 tw:py-3 tw:rounded-b-md",
441
404
  "tw:bg-lm-primary tw:dark:bg-dm-primary tw:border-t tw:border-lm-border tw:dark:border-dm-border",
442
405
  t
443
406
  ),
444
- ...r
407
+ ...e
445
408
  }
446
- ), st = ({ className: t, ...r }) => /* @__PURE__ */ n(
409
+ ), gt = ({ className: t, ...e }) => /* @__PURE__ */ n(
447
410
  "div",
448
411
  {
449
- className: a(
412
+ className: s(
450
413
  "tw:group/card tw:rounded-md tw:shadow-md",
451
414
  "tw:border tw:border-lm-border tw:dark:border-dm-border tw:bg-lm-primary tw:dark:bg-dm-primary",
452
415
  t
453
416
  ),
454
- ...r
417
+ ...e
455
418
  }
456
- ), x = Object.assign(st, { Body: dt, Header: nt, Footer: lt }), Tt = ({ bodyClassName: t, children: r, ...e }) => {
457
- const { title: o, titleSize: d = "md", ...l } = "title" in e ? e : {
458
- ...e,
419
+ ), m = Object.assign(gt, { Body: ct, Header: it, Footer: mt }), bt = ({ bodyClassName: t, children: e, ...r }) => {
420
+ const { title: o, titleSize: d = "md", ...a } = "title" in r ? r : {
421
+ ...r,
459
422
  title: void 0,
460
423
  titleSize: void 0
461
424
  };
462
- return /* @__PURE__ */ c(x, { ...l, children: [
463
- o && /* @__PURE__ */ c(x.Header, { children: [
425
+ return /* @__PURE__ */ i(m, { ...a, children: [
426
+ o && /* @__PURE__ */ i(m.Header, { children: [
464
427
  d === "lg" && /* @__PURE__ */ n("h4", { children: o }),
465
428
  d === "md" && /* @__PURE__ */ n("h5", { children: o }),
466
429
  d === "sm" && /* @__PURE__ */ n("h6", { children: o })
467
430
  ] }),
468
- /* @__PURE__ */ n(x.Body, { className: t, children: r })
431
+ /* @__PURE__ */ n(m.Body, { className: t, children: e })
469
432
  ] });
470
- };
433
+ }, q = F(null), ut = ({ className: t, to: e, ...r }) => {
434
+ const o = g(q);
435
+ return /* @__PURE__ */ n(
436
+ V,
437
+ {
438
+ role: "menuitem",
439
+ to: e,
440
+ className: ({ isActive: d }) => s(
441
+ "tw:px-4 tw:pt-2 tw:pb-[calc(0.5rem-3px)] tw:border-b-3",
442
+ "tw:font-bold tw:no-underline tw:text-center tw:highlight:text-brand tw:transition-colors",
443
+ "tw:rounded-none tw:outline-none tw:focus-visible:inset-ring-2 tw:focus-visible:inset-ring-brand/50",
444
+ {
445
+ "tw:border-b-brand active": d,
446
+ "tw:border-b-transparent tw:text-gray-500": !d,
447
+ "tw:flex-grow": o == null ? void 0 : o.fill
448
+ },
449
+ t
450
+ ),
451
+ ...r
452
+ }
453
+ );
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
458
+ );
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 = [
461
+ "tw:border tw:border-r-0 tw:last:border-r tw:border-lm-border tw:dark:border-dm-border",
462
+ "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
463
+ ], J = (t = !1) => s(
464
+ G,
465
+ "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
466
+ "tw:focus-ring tw:focus-visible:z-1",
467
+ {
468
+ "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:text-brand": !t,
469
+ "tw:bg-lm-brand tw:dark:bg-dm-brand tw:text-white": t
470
+ }
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]);
474
+ return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n(U, { className: a, to: o, ...d, children: t });
475
+ }
476
+ function Pt({ children: t, active: e, isEllipsis: r, ...o }) {
477
+ const d = E(() => J(e), [e]);
478
+ return r ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ n("button", { type: "button", className: d, ...o, children: t });
479
+ }
480
+ const $t = ({ currentPage: t, pagesCount: e, ...r }) => {
481
+ const o = "urlForPage" in r, d = o ? vt : Pt, a = N(
482
+ (l) => o ? { href: k(l) ? void 0 : r.urlForPage(l) } : { onClick: () => !k(l) && r.onPageChange(l) },
483
+ [o, r]
484
+ );
485
+ 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(
488
+ d,
489
+ {
490
+ active: l === t,
491
+ isEllipsis: k(l),
492
+ ...a(l),
493
+ children: kt(l)
494
+ },
495
+ Nt(l, w)
496
+ )),
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 }) })
498
+ ] });
499
+ }, Ct = ({
500
+ open: t,
501
+ children: e,
502
+ className: r,
503
+ onClose: o,
504
+ ...d
505
+ }) => {
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;
510
+ 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();
513
+ } else
514
+ (y = a.current) == null || y.close();
515
+ return () => {
516
+ l.style.overflow = w, l.style.paddingRight = c;
517
+ };
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
+ }
529
+ );
530
+ }, Ut = ({
531
+ open: t,
532
+ onClose: e,
533
+ variant: r = "default",
534
+ title: o,
535
+ children: d,
536
+ className: a,
537
+ ...l
538
+ }) => {
539
+ const {
540
+ size: w = "md",
541
+ confirmText: c = "Confirm",
542
+ confirmDisabled: P,
543
+ onConfirm: y,
544
+ ...L
545
+ } = "onConfirm" in l ? l : { ...l }, [u, M] = Q(t), C = R(null);
546
+ return T(() => {
547
+ if (t) {
548
+ M(!0);
549
+ return;
550
+ }
551
+ const h = C.current;
552
+ if (h) {
553
+ delete C.current.dataset.open;
554
+ const _ = () => M(!1);
555
+ return h.addEventListener("transitionend", _, { once: !0 }), () => {
556
+ h.removeEventListener("transitionend", _);
557
+ };
558
+ }
559
+ }, [t]), T(() => {
560
+ const h = C.current;
561
+ u && h && (h.dataset.open = "");
562
+ }, [u]), /* @__PURE__ */ n(
563
+ Ct,
564
+ {
565
+ open: u,
566
+ onClose: e,
567
+ className: s(
568
+ {
569
+ "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": u,
570
+ "tw:overflow-hidden": r === "cover"
571
+ },
572
+ a
573
+ ),
574
+ ...L,
575
+ children: /* @__PURE__ */ n(
576
+ "div",
577
+ {
578
+ "data-testid": "transition-container",
579
+ ref: C,
580
+ className: s(
581
+ "tw:w-full tw:m-auto tw:p-4 tw:sm:p-6",
582
+ // CSS transitions are based on the presence of the `data-open` attribute
583
+ "tw:-translate-y-4 tw:data-open:translate-y-0 tw:opacity-0 tw:data-open:opacity-100",
584
+ "tw:transition-[opacity_transform] tw:duration-300",
585
+ // Handle modal dimensions for different variants and sizes
586
+ 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"
591
+ },
592
+ { "tw:h-full": r === "cover" }
593
+ ),
594
+ children: /* @__PURE__ */ n(m, { className: s(
595
+ "tw:w-full",
596
+ { "tw:h-full tw:relative tw:overflow-auto": r === "cover" }
597
+ ), children: r === "cover" ? /* @__PURE__ */ i(B, { children: [
598
+ /* @__PURE__ */ i(
599
+ "div",
600
+ {
601
+ className: s(
602
+ "tw:px-4 tw:py-3 tw:absolute tw:top-0 tw:left-0 tw:right-0",
603
+ "tw:flex tw:items-center tw:justify-between",
604
+ "tw:text-white tw:bg-linear-to-b tw:from-black/70 tw:to-black/10",
605
+ "tw:[text-shadow:_0_2px_4px_rgb(0_0_0/_0.8)]"
606
+ ),
607
+ children: [
608
+ /* @__PURE__ */ n("h5", { children: o }),
609
+ /* @__PURE__ */ n(H, { onClick: e, label: "Close dialog" })
610
+ ]
611
+ }
612
+ ),
613
+ /* @__PURE__ */ n("div", { children: d })
614
+ ] }) : /* @__PURE__ */ i(B, { children: [
615
+ /* @__PURE__ */ i(m.Header, { className: s(
616
+ "tw:sticky tw:top-0",
617
+ "tw:flex tw:items-center tw:justify-between tw:gap-x-2"
618
+ ), children: [
619
+ /* @__PURE__ */ n("h5", { className: s({ "tw:text-danger": r === "danger" }), children: o }),
620
+ /* @__PURE__ */ n(H, { onClick: e, label: "Close dialog" })
621
+ ] }),
622
+ /* @__PURE__ */ n(m.Body, { children: d }),
623
+ y && /* @__PURE__ */ i(
624
+ m.Footer,
625
+ {
626
+ "data-testid": "footer",
627
+ className: s(
628
+ "tw:flex tw:justify-end tw:items-center tw:gap-x-2",
629
+ "tw:[&]:px-3 tw:sticky tw:bottom-0"
630
+ ),
631
+ children: [
632
+ /* @__PURE__ */ n(wt, { onClick: e, children: "Cancel" }),
633
+ /* @__PURE__ */ n(
634
+ lt,
635
+ {
636
+ solid: !0,
637
+ variant: r === "danger" ? "danger" : "primary",
638
+ disabled: P,
639
+ onClick: y,
640
+ children: c
641
+ }
642
+ )
643
+ ]
644
+ }
645
+ )
646
+ ] }) })
647
+ }
648
+ )
649
+ }
650
+ );
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", {
652
+ "tw:text-gray-500 tw:dark:text-gray-400": o === "default",
653
+ "tw:text-danger": o === "error"
654
+ }), children: [
655
+ r && /* @__PURE__ */ i(B, { children: [
656
+ /* @__PURE__ */ n(b, { icon: Z, spin: !0 }),
657
+ /* @__PURE__ */ n("span", { className: "tw:ml-2", children: e ?? "Loading..." })
658
+ ] }),
659
+ !r && e
660
+ ] }) }), At = ({ variant: t, className: e, size: r = "md", children: o }) => /* @__PURE__ */ n(
661
+ "div",
662
+ {
663
+ className: f(
664
+ "tw:rounded-md tw:text-center",
665
+ {
666
+ "tw:p-2": r === "sm",
667
+ "tw:p-4": r === "md",
668
+ "tw:p-6": r === "lg",
669
+ "tw:[&]:text-white": t !== "warning",
670
+ "tw:bg-brand": t === "success",
671
+ "tw:bg-danger": t === "error",
672
+ "tw:bg-warning tw:text-black": t === "warning"
673
+ },
674
+ e
675
+ ),
676
+ children: o
677
+ }
678
+ );
471
679
  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,
485
- 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
680
+ lt as Button,
681
+ m as Card,
682
+ Ut as CardModal,
683
+ Et as Checkbox,
684
+ H as CloseButton,
685
+ I as ELLIPSIS,
686
+ A as Input,
687
+ 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,
699
+ Rt as Table,
700
+ Dt as ToggleSwitch,
701
+ ft as formatNumber,
702
+ Nt as keyForPage,
703
+ k as pageIsEllipsis,
704
+ kt as prettifyPageNumber,
705
+ yt as progressivePagination,
706
+ Ot as roundTen,
707
+ st as useTimeout
494
708
  };
@@ -89,6 +89,18 @@
89
89
  @layer base {
90
90
  :root {
91
91
  --header-height: 56px;
92
+
93
+ /* Chevron image for selects */
94
+ --chevron-down: url("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>");
95
+ /* Tick image for checkboxes */
96
+ --tick: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/></svg>");
97
+
98
+ /* Circle images for toggle switches */
99
+ --circle-grey-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='rgba%280, 0, 0, 0.25%29'/></svg>");
100
+ --circle-grey-light: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='rgba%28255, 255, 255, 0.25%29'/></svg>");
101
+ --circle-white: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='%23fff'/></svg>");
102
+ --circle-light-blue: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='%2386b7fe'/></svg>");
103
+
92
104
  @apply tw:scheme-normal tw:dark:scheme-dark tw:scroll-auto;
93
105
  }
94
106
 
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "test": "vitest run",
31
31
  "test:ci": "npm run test -- --coverage",
32
32
  "lint": "eslint dev src test",
33
- "lint:fix": "npm run lint:js -- --fix",
33
+ "lint:fix": "npm run lint -- --fix",
34
34
  "types": "tsc",
35
35
  "dev": "vite serve --host=0.0.0.0 --port 3001"
36
36
  },
@@ -53,9 +53,9 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
- "@shlinkio/eslint-config-js-coding-standard": "~3.4.0",
56
+ "@shlinkio/eslint-config-js-coding-standard": "~3.5.0",
57
57
  "@stylistic/eslint-plugin": "^4.2.0",
58
- "@tailwindcss/vite": "^4.0.16",
58
+ "@tailwindcss/vite": "^4.0.17",
59
59
  "@testing-library/jest-dom": "^6.6.3",
60
60
  "@testing-library/react": "^16.2.0",
61
61
  "@testing-library/user-event": "^14.6.1",
@@ -67,9 +67,10 @@
67
67
  "axe-core": "^4.10.3",
68
68
  "bootstrap": "5.2.3",
69
69
  "eslint": "^9.23.0",
70
+ "eslint-plugin-import": "^2.31.0",
70
71
  "eslint-plugin-jsx-a11y": "^6.10.2",
71
72
  "eslint-plugin-react": "^7.37.4",
72
- "eslint-plugin-react-compiler": "^19.0.0-beta-714736e-20250131",
73
+ "eslint-plugin-react-compiler": "^19.0.0-beta-aeaed83-20250323",
73
74
  "eslint-plugin-react-hooks": "^5.2.0",
74
75
  "eslint-plugin-simple-import-sort": "^12.1.1",
75
76
  "history": "^5.3.0",
@@ -78,7 +79,7 @@
78
79
  "sass": "^1.86.0",
79
80
  "typescript": "^5.8.2",
80
81
  "typescript-eslint": "^8.27.0",
81
- "vite": "^6.2.2",
82
+ "vite": "^6.2.3",
82
83
  "vite-plugin-dts": "^4.5.3",
83
84
  "vitest": "^3.0.2"
84
85
  },
@@ -88,5 +89,5 @@
88
89
  "not ie <= 11",
89
90
  "not op_mini all"
90
91
  ],
91
- "version": "0.8.1"
92
+ "version": "0.8.3"
92
93
  }