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