@shlinkio/shlink-frontend-kit 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -2
- package/dist/index.js +129 -127
- package/dist/tailwind.d.ts +49 -19
- package/dist/tailwind.js +417 -305
- package/dist/tailwind.preset.css +12 -0
- package/dist/use-timeout-mQ792qNj.js +17 -0
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare type BooleanControlProps = PropsWithChildren<{
|
|
|
16
16
|
inline?: boolean;
|
|
17
17
|
}>;
|
|
18
18
|
|
|
19
|
+
export declare type Callback = () => unknown;
|
|
20
|
+
|
|
19
21
|
export declare const changeThemeInMarkup: (theme: Theme) => void | undefined;
|
|
20
22
|
|
|
21
23
|
export declare const Checkbox: FC<BooleanControlProps>;
|
|
@@ -191,7 +193,7 @@ export declare type Theme = 'dark' | 'light';
|
|
|
191
193
|
|
|
192
194
|
export declare type TimeoutToggle = typeof useTimeoutToggle;
|
|
193
195
|
|
|
194
|
-
declare type ToggleResult = [boolean, () => void, () => void, () => void];
|
|
196
|
+
export declare type ToggleResult = [boolean, () => void, () => void, () => void];
|
|
195
197
|
|
|
196
198
|
export declare const ToggleSwitch: FC<BooleanControlProps>;
|
|
197
199
|
|
|
@@ -203,7 +205,23 @@ export declare const useParsedQuery: <T>() => T;
|
|
|
203
205
|
|
|
204
206
|
export declare const useTheme: (initialTheme?: Theme) => readonly [Theme, Dispatch<SetStateAction<Theme>>];
|
|
205
207
|
|
|
206
|
-
export declare
|
|
208
|
+
export declare function useTimeout(defaultDelay: number,
|
|
209
|
+
/** Test seam. Defaults to global setTimeout */
|
|
210
|
+
setTimeout_?: typeof globalThis.setTimeout,
|
|
211
|
+
/** Test seam. Defaults to global clearTimeout */
|
|
212
|
+
clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
|
|
213
|
+
|
|
214
|
+
export declare type UseTimeoutResult = {
|
|
215
|
+
/**
|
|
216
|
+
* Clears any in-progress timeout, and schedules a new callback.
|
|
217
|
+
* It optionally allows a delay to be provided, or falls back to the default delay otherwise.
|
|
218
|
+
*/
|
|
219
|
+
setTimeout: (callback: Callback, delay?: number) => void;
|
|
220
|
+
/** Clears any in-progress timeout */
|
|
221
|
+
clearCurrentTimeout: () => void;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export declare const useTimeoutToggle: (initialValue?: boolean, delay?: number, setTimeout_?: typeof setTimeout, clearTimeout_?: typeof clearTimeout) => [boolean, () => void];
|
|
207
225
|
|
|
208
226
|
export declare const useToggle: (initialValue?: boolean) => ToggleResult;
|
|
209
227
|
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s, jsxs as d, Fragment as N } from "react/jsx-runtime";
|
|
2
2
|
import { faCircleNotch as I, faSearch as A, faEllipsisV as E, faSortAmountUp as F, faSortAmountDown as P } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
-
import { FontAwesomeIcon as
|
|
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 O, DropdownMenu as k, NavItem as j, NavLink as G, Nav as U, UncontrolledDropdown as q, DropdownItem as w } from "reactstrap";
|
|
6
|
+
import { useId as v, useState as p, useRef as S, useMemo as Q, useCallback as f, Children as V, isValidElement as Y, useEffect as W } from "react";
|
|
7
7
|
import { useLocation as z, NavLink as J } from "react-router";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { u as X } from "./use-timeout-mQ792qNj.js";
|
|
9
|
+
const pe = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: o = !1 }) => /* @__PURE__ */ s(
|
|
10
|
+
C,
|
|
10
11
|
{
|
|
11
12
|
body: !0,
|
|
12
13
|
className: u(e, {
|
|
13
|
-
"w-100":
|
|
14
|
-
"w-75 mx-auto": !
|
|
14
|
+
"w-100": o,
|
|
15
|
+
"w-75 mx-auto": !o,
|
|
15
16
|
"border-danger": n === "error"
|
|
16
17
|
}),
|
|
17
18
|
children: /* @__PURE__ */ d(
|
|
@@ -22,18 +23,18 @@ const he = ({ className: e, children: r, loading: t = !1, type: n = "default", f
|
|
|
22
23
|
"text-danger": n === "error"
|
|
23
24
|
}),
|
|
24
25
|
children: [
|
|
25
|
-
t && /* @__PURE__ */
|
|
26
|
-
t && /* @__PURE__ */
|
|
26
|
+
t && /* @__PURE__ */ s(g, { icon: I, spin: !0 }),
|
|
27
|
+
t && /* @__PURE__ */ s("span", { className: "ms-2", children: r ?? "Loading..." }),
|
|
27
28
|
!t && r
|
|
28
29
|
]
|
|
29
30
|
}
|
|
30
31
|
)
|
|
31
32
|
}
|
|
32
|
-
),
|
|
33
|
-
e && /* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
] }),
|
|
36
|
-
|
|
33
|
+
), Z = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ d(C, { ...n, children: [
|
|
34
|
+
e && /* @__PURE__ */ s(H, { role: "heading", "aria-level": 4, children: e }),
|
|
35
|
+
/* @__PURE__ */ s(M, { className: t, children: r })
|
|
36
|
+
] }), be = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ s(
|
|
37
|
+
Z,
|
|
37
38
|
{
|
|
38
39
|
role: "document",
|
|
39
40
|
className: u("text-center", {
|
|
@@ -47,47 +48,47 @@ const he = ({ className: e, children: r, loading: t = !1, type: n = "default", f
|
|
|
47
48
|
bodyClassName: u({ "p-2": n }),
|
|
48
49
|
children: e
|
|
49
50
|
}
|
|
50
|
-
),
|
|
51
|
-
const l =
|
|
52
|
-
"form-switch":
|
|
53
|
-
"form-checkbox":
|
|
54
|
-
}, m =
|
|
51
|
+
), y = ({ checked: e = !1, onChange: r, className: t, children: n, type: o, inline: c = !1 }) => {
|
|
52
|
+
const l = v(), a = (h) => r == null ? void 0 : r(h.target.checked, h), i = {
|
|
53
|
+
"form-switch": o === "switch",
|
|
54
|
+
"form-checkbox": o === "checkbox"
|
|
55
|
+
}, m = c ? { display: "inline-block" } : {};
|
|
55
56
|
return /* @__PURE__ */ d("span", { className: u("form-check", i, t), style: m, children: [
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ s("input", { type: "checkbox", className: "form-check-input", id: l, checked: e, onChange: a }),
|
|
58
|
+
/* @__PURE__ */ s("label", { className: "form-check-label", htmlFor: l, children: n })
|
|
58
59
|
] });
|
|
59
|
-
},
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
}, ge = (e) => /* @__PURE__ */ s(y, { type: "checkbox", ...e }), we = (e) => /* @__PURE__ */ s(y, { type: "switch", ...e }), B = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: o = !1, id: c }) => /* @__PURE__ */ d("div", { className: `${t} ${o ? "" : "mb-3"}`, children: [
|
|
61
|
+
/* @__PURE__ */ s("label", { className: `form-label ${n}`, htmlFor: c, children: r }),
|
|
61
62
|
e
|
|
62
|
-
] }),
|
|
63
|
-
const i =
|
|
64
|
-
return /* @__PURE__ */
|
|
63
|
+
] }), Ne = ({ children: e, value: r, onChange: t, type: n, required: o, placeholder: c, className: l, labelClassName: a }) => {
|
|
64
|
+
const i = v();
|
|
65
|
+
return /* @__PURE__ */ s(B, { label: /* @__PURE__ */ d(N, { children: [
|
|
65
66
|
e,
|
|
66
67
|
":"
|
|
67
|
-
] }), className: l, labelClassName: a, id: i, children: /* @__PURE__ */
|
|
68
|
+
] }), className: l, labelClassName: a, id: i, children: /* @__PURE__ */ s(
|
|
68
69
|
"input",
|
|
69
70
|
{
|
|
70
71
|
id: i,
|
|
71
72
|
className: "form-control",
|
|
72
73
|
type: n ?? "text",
|
|
73
74
|
value: r,
|
|
74
|
-
required:
|
|
75
|
-
placeholder:
|
|
75
|
+
required: o ?? !0,
|
|
76
|
+
placeholder: c,
|
|
76
77
|
onChange: (m) => t(m.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 [l, a] = p(
|
|
85
|
-
a(m),
|
|
86
|
-
e(m),
|
|
84
|
+
}, Ce = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: o = "", setTimeout_: c = setTimeout }) => {
|
|
85
|
+
const [l, a] = p(o), i = (m, h = K) => {
|
|
86
|
+
a(m), _(), b = c(() => {
|
|
87
|
+
e(m), _();
|
|
87
88
|
}, h);
|
|
88
89
|
};
|
|
89
90
|
return /* @__PURE__ */ d("div", { className: u("search-field", r), children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ s(
|
|
91
92
|
"input",
|
|
92
93
|
{
|
|
93
94
|
type: "text",
|
|
@@ -100,8 +101,8 @@ const v = () => {
|
|
|
100
101
|
onChange: (m) => i(m.target.value)
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ s(g, { icon: A, className: "search-field__icon" }),
|
|
105
|
+
/* @__PURE__ */ s(
|
|
105
106
|
"button",
|
|
106
107
|
{
|
|
107
108
|
"aria-label": "Clear search",
|
|
@@ -113,56 +114,56 @@ const v = () => {
|
|
|
113
114
|
}
|
|
114
115
|
)
|
|
115
116
|
] });
|
|
116
|
-
},
|
|
117
|
+
}, Te = () => S(null), ee = (e) => {
|
|
117
118
|
const r = new URLSearchParams(e), t = {};
|
|
118
|
-
return r.forEach((n,
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
t[
|
|
119
|
+
return r.forEach((n, o) => {
|
|
120
|
+
if (o.endsWith("[]")) {
|
|
121
|
+
const c = o.slice(0, -2);
|
|
122
|
+
t[c] ?? (t[c] = []), t[c].push(n);
|
|
122
123
|
} else
|
|
123
|
-
t[
|
|
124
|
+
t[o] = n;
|
|
124
125
|
}), t;
|
|
125
|
-
},
|
|
126
|
+
}, _e = (e) => {
|
|
126
127
|
const r = new URLSearchParams();
|
|
127
128
|
for (const [t, n] of Object.entries(e))
|
|
128
|
-
n !== void 0 && (Array.isArray(n) ? n.forEach((
|
|
129
|
+
n !== void 0 && (Array.isArray(n) ? n.forEach((o) => r.append(`${t}[]`, `${o}`)) : r.append(t, `${n}`));
|
|
129
130
|
return r.toString();
|
|
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 = () => {
|
|
131
|
+
}, Oe = () => {
|
|
139
132
|
const { search: e } = z();
|
|
140
|
-
return Q(() =>
|
|
141
|
-
},
|
|
133
|
+
return Q(() => ee(e), [e]);
|
|
134
|
+
}, ke = (e = !1, r = 2e3, t = globalThis.setTimeout.bind(globalThis), n = globalThis.clearTimeout.bind(globalThis)) => {
|
|
135
|
+
const { setTimeout: o } = X(r, t, n), [c, l] = p(e), a = S(e), i = f(() => {
|
|
136
|
+
l(!a.current), o(() => l(a.current));
|
|
137
|
+
}, [o]);
|
|
138
|
+
return [c, i];
|
|
139
|
+
}, re = (e = !1) => {
|
|
140
|
+
const [r, t] = p(e), n = f(() => t((l) => !l), []), o = f(() => t(!0), []), c = f(() => t(!1), []);
|
|
141
|
+
return [r, n, o, c];
|
|
142
|
+
}, te = ({
|
|
142
143
|
text: e,
|
|
143
144
|
disabled: r = !1,
|
|
144
145
|
className: t,
|
|
145
146
|
children: n,
|
|
146
|
-
dropdownClassName:
|
|
147
|
-
noCaret:
|
|
147
|
+
dropdownClassName: o,
|
|
148
|
+
noCaret: c,
|
|
148
149
|
end: l = !1,
|
|
149
150
|
minWidth: a,
|
|
150
151
|
inline: i,
|
|
151
152
|
size: m,
|
|
152
153
|
...h
|
|
153
154
|
}) => {
|
|
154
|
-
const [
|
|
155
|
+
const [x, L] = re(), D = u("dropdown-btn__toggle", t, {
|
|
155
156
|
"btn-block": !i,
|
|
156
|
-
"dropdown-btn__toggle--with-caret": !
|
|
157
|
+
"dropdown-btn__toggle--with-caret": !c
|
|
157
158
|
}), R = { minWidth: a && `${a}px` };
|
|
158
|
-
return /* @__PURE__ */ d($, { isOpen:
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
159
|
+
return /* @__PURE__ */ d($, { isOpen: x, toggle: L, disabled: r, className: o, children: [
|
|
160
|
+
/* @__PURE__ */ s(O, { size: m, caret: !c, className: D, color: "primary", ...h, children: e }),
|
|
161
|
+
/* @__PURE__ */ s(k, { className: "w-100", end: l, style: R, children: n })
|
|
161
162
|
] });
|
|
162
|
-
}, ve = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */
|
|
163
|
-
|
|
163
|
+
}, ve = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ s(
|
|
164
|
+
te,
|
|
164
165
|
{
|
|
165
|
-
text: /* @__PURE__ */
|
|
166
|
+
text: /* @__PURE__ */ s(g, { className: "px-1", icon: E }),
|
|
166
167
|
"aria-label": t,
|
|
167
168
|
size: "sm",
|
|
168
169
|
minWidth: r,
|
|
@@ -171,41 +172,41 @@ const v = () => {
|
|
|
171
172
|
inline: !0,
|
|
172
173
|
children: e
|
|
173
174
|
}
|
|
174
|
-
),
|
|
175
|
-
if (!Y(n) || n.type !==
|
|
175
|
+
), ne = ({ children: e, ...r }) => /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s(G, { className: "nav-pills__nav-link", tag: J, ...r, children: e }) }), Se = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ s(C, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ s(U, { pills: !0, fill: r, children: V.map(e, (n) => {
|
|
176
|
+
if (!Y(n) || n.type !== ne)
|
|
176
177
|
throw new Error("Only NavPillItem children are allowed inside NavPills.");
|
|
177
178
|
return n;
|
|
178
179
|
}) }) });
|
|
179
|
-
function
|
|
180
|
-
return typeof e == "object" ?
|
|
180
|
+
function T(e, r, t) {
|
|
181
|
+
return typeof e == "object" ? T(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
|
|
181
182
|
ASC: "DESC",
|
|
182
183
|
DESC: void 0
|
|
183
184
|
}[t] : "ASC";
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
-
return typeof e == "object" ?
|
|
186
|
+
function se(e, r, t) {
|
|
187
|
+
return typeof e == "object" ? se(e.currentField, e.newField, e.currentOrderDir) : {
|
|
187
188
|
field: r,
|
|
188
|
-
dir:
|
|
189
|
+
dir: T(e, r, t)
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
return n[r] >
|
|
194
|
-
}),
|
|
192
|
+
const ye = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, o) => {
|
|
193
|
+
const c = t === "ASC" ? 1 : -1, l = t === "ASC" ? -1 : 1;
|
|
194
|
+
return n[r] > o[r] ? c : l;
|
|
195
|
+
}), xe = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, Le = (e) => {
|
|
195
196
|
const [r, t] = e.split("-");
|
|
196
197
|
return { field: r, dir: t };
|
|
197
|
-
},
|
|
198
|
-
const [r, t] = p(e), n = f((
|
|
198
|
+
}, De = (e) => {
|
|
199
|
+
const [r, t] = p(e), n = f((o, c) => t({ field: o, dir: c }), []);
|
|
199
200
|
return [r, n];
|
|
200
201
|
};
|
|
201
|
-
function
|
|
202
|
+
function Re({ items: e, order: r, onChange: t, isButton: n = !0, right: o = !1, prefixed: c = !0 }) {
|
|
202
203
|
const l = (a) => () => {
|
|
203
|
-
const i =
|
|
204
|
+
const i = T(a, r.field, r.dir);
|
|
204
205
|
t(i ? a : void 0, i);
|
|
205
206
|
};
|
|
206
207
|
return /* @__PURE__ */ d(q, { children: [
|
|
207
208
|
/* @__PURE__ */ d(
|
|
208
|
-
|
|
209
|
+
O,
|
|
209
210
|
{
|
|
210
211
|
caret: !0,
|
|
211
212
|
color: n ? "primary" : "link",
|
|
@@ -214,82 +215,83 @@ function Le({ items: e, order: r, onChange: t, isButton: n = !0, right: c = !1,
|
|
|
214
215
|
"btn-sm p-0": !n
|
|
215
216
|
}),
|
|
216
217
|
children: [
|
|
217
|
-
!n && /* @__PURE__ */
|
|
218
|
-
n && !r.field && /* @__PURE__ */
|
|
218
|
+
!n && /* @__PURE__ */ s(N, { children: "Order by" }),
|
|
219
|
+
n && !r.field && /* @__PURE__ */ s("i", { children: "Order by..." }),
|
|
219
220
|
n && r.field && /* @__PURE__ */ d(N, { children: [
|
|
220
|
-
|
|
221
|
+
c && "Order by: ",
|
|
221
222
|
e[r.field],
|
|
222
223
|
" - ",
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ s("small", { children: r.dir ?? "DESC" })
|
|
224
225
|
] })
|
|
225
226
|
]
|
|
226
227
|
}
|
|
227
228
|
),
|
|
228
|
-
/* @__PURE__ */ d(
|
|
229
|
+
/* @__PURE__ */ d(k, { end: o, className: "w-100", style: n ? void 0 : { minWidth: "11rem" }, children: [
|
|
229
230
|
Object.entries(e).map(([a, i]) => /* @__PURE__ */ d(
|
|
230
|
-
|
|
231
|
+
w,
|
|
231
232
|
{
|
|
232
233
|
active: r.field === a,
|
|
233
234
|
onClick: l(a),
|
|
234
235
|
className: "d-flex justify-content-between align-items-center",
|
|
235
236
|
children: [
|
|
236
237
|
i,
|
|
237
|
-
r.field === a && /* @__PURE__ */
|
|
238
|
+
r.field === a && /* @__PURE__ */ s(g, { icon: r.dir === "ASC" ? F : P })
|
|
238
239
|
]
|
|
239
240
|
},
|
|
240
241
|
a
|
|
241
242
|
)),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ s(w, { divider: !0 }),
|
|
244
|
+
/* @__PURE__ */ s(w, { disabled: !r.field, onClick: () => t(), children: /* @__PURE__ */ s("i", { children: "Clear selection" }) })
|
|
244
245
|
] })
|
|
245
246
|
] });
|
|
246
247
|
}
|
|
247
|
-
const
|
|
248
|
+
const Ie = "#4696e5", Ae = "rgba(70, 150, 229, 0.4)", Ee = "#f77f28", Fe = "rgba(247, 127, 40, 0.4)", Pe = "white", He = "#161b22", oe = (e) => {
|
|
248
249
|
var r;
|
|
249
250
|
return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", e);
|
|
250
|
-
},
|
|
251
|
+
}, Me = () => {
|
|
251
252
|
var e;
|
|
252
253
|
return ((e = document.querySelector("html")) == null ? void 0 : e.getAttribute("data-theme")) === "dark";
|
|
253
|
-
}, ce = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light",
|
|
254
|
+
}, ce = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", $e = (e) => {
|
|
254
255
|
const [r, t] = p(() => e ?? ce());
|
|
255
256
|
return W(() => {
|
|
256
257
|
oe(r);
|
|
257
258
|
}, [r]), [r, t];
|
|
258
259
|
};
|
|
259
260
|
export {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
261
|
+
ge as Checkbox,
|
|
262
|
+
te as DropdownBtn,
|
|
263
|
+
Ee as HIGHLIGHTED_COLOR,
|
|
264
|
+
Fe as HIGHLIGHTED_COLOR_ALPHA,
|
|
265
|
+
Ne as InputFormGroup,
|
|
266
|
+
B as LabeledFormGroup,
|
|
267
|
+
Ie as MAIN_COLOR,
|
|
268
|
+
Ae as MAIN_COLOR_ALPHA,
|
|
269
|
+
pe as Message,
|
|
270
|
+
ne as NavPillItem,
|
|
271
|
+
Se as NavPills,
|
|
272
|
+
Re as OrderingDropdown,
|
|
273
|
+
He as PRIMARY_DARK_COLOR,
|
|
274
|
+
Pe as PRIMARY_LIGHT_COLOR,
|
|
275
|
+
be as Result,
|
|
275
276
|
ve as RowDropdownBtn,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
Ce as SearchField,
|
|
278
|
+
Z as SimpleCard,
|
|
279
|
+
we as ToggleSwitch,
|
|
279
280
|
oe as changeThemeInMarkup,
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
se as determineOrder,
|
|
282
|
+
T as determineOrderDir,
|
|
282
283
|
ce as getSystemPreferredTheme,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
284
|
+
Me as isDarkThemeEnabled,
|
|
285
|
+
xe as orderToString,
|
|
286
|
+
ee as parseQueryString,
|
|
287
|
+
ye as sortList,
|
|
288
|
+
Le as stringToOrder,
|
|
289
|
+
_e as stringifyQueryParams,
|
|
290
|
+
Te as useElementRef,
|
|
291
|
+
De as useOrder,
|
|
291
292
|
Oe as useParsedQuery,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
$e as useTheme,
|
|
294
|
+
X as useTimeout,
|
|
295
|
+
ke as useTimeoutToggle,
|
|
296
|
+
re as useToggle
|
|
295
297
|
};
|
package/dist/tailwind.d.ts
CHANGED
|
@@ -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<{
|
|
@@ -21,8 +26,6 @@ export declare type ButtonProps = PropsWithChildren<{
|
|
|
21
26
|
solid?: boolean;
|
|
22
27
|
} & (RegularButtonProps | LinkButtonProps_2)>;
|
|
23
28
|
|
|
24
|
-
export declare type Callback = () => unknown;
|
|
25
|
-
|
|
26
29
|
export declare const Card: FC<CardProps> & {
|
|
27
30
|
Body: FC<CardProps>;
|
|
28
31
|
Header: FC<CardProps>;
|
|
@@ -51,6 +54,10 @@ export declare type CellProps = HTMLProps<HTMLTableCellElement> & {
|
|
|
51
54
|
type?: 'td' | 'th';
|
|
52
55
|
};
|
|
53
56
|
|
|
57
|
+
export declare const Checkbox: FC<CheckboxProps>;
|
|
58
|
+
|
|
59
|
+
export declare type CheckboxProps = BooleanControlProps;
|
|
60
|
+
|
|
54
61
|
export declare const CloseButton: FC<CloseButtonProps>;
|
|
55
62
|
|
|
56
63
|
export declare type CloseButtonProps = {
|
|
@@ -90,7 +97,7 @@ export declare const Label: FC<LabelProps>;
|
|
|
90
97
|
export declare const LabelledInput: FC<LabelledInputProps>;
|
|
91
98
|
|
|
92
99
|
export declare type LabelledInputProps = Omit<InputProps, 'className' | 'id' | 'feedback'> & {
|
|
93
|
-
label:
|
|
100
|
+
label: RequiredReactNode;
|
|
94
101
|
inputClassName?: string;
|
|
95
102
|
error?: string;
|
|
96
103
|
/** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
|
|
@@ -100,7 +107,7 @@ export declare type LabelledInputProps = Omit<InputProps, 'className' | 'id' | '
|
|
|
100
107
|
export declare const LabelledSelect: FC<LabelledSelectProps>;
|
|
101
108
|
|
|
102
109
|
export declare type LabelledSelectProps = Omit<SelectProps, 'className' | 'id'> & {
|
|
103
|
-
label:
|
|
110
|
+
label: RequiredReactNode;
|
|
104
111
|
selectClassName?: string;
|
|
105
112
|
/** Alternative to `required`. Causes the input to be required, without displaying an asterisk */
|
|
106
113
|
hiddenRequired?: boolean;
|
|
@@ -119,6 +126,17 @@ export declare type LinkButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'
|
|
|
119
126
|
|
|
120
127
|
declare type LinkButtonProps_2 = LinkProps;
|
|
121
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Component used to display a card with general information, about current page status, loading, etc.
|
|
131
|
+
*/
|
|
132
|
+
export declare const Message: FC<MessageProps>;
|
|
133
|
+
|
|
134
|
+
export declare type MessageProps = PropsWithChildren<{
|
|
135
|
+
className?: string;
|
|
136
|
+
loading?: boolean;
|
|
137
|
+
variant?: 'default' | 'error';
|
|
138
|
+
}>;
|
|
139
|
+
|
|
122
140
|
export declare const ModalDialog: FC<ModalDialogProps>;
|
|
123
141
|
|
|
124
142
|
export declare type ModalDialogProps = HTMLProps<HTMLDialogElement> & {
|
|
@@ -128,6 +146,15 @@ export declare type ModalDialogProps = HTMLProps<HTMLDialogElement> & {
|
|
|
128
146
|
onClose: () => void;
|
|
129
147
|
};
|
|
130
148
|
|
|
149
|
+
export declare const NavPills: FC<NavPillsProps> & {
|
|
150
|
+
Pill: FC<LinkProps>;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export declare type NavPillsProps = PropsWithChildren<{
|
|
154
|
+
fill?: boolean;
|
|
155
|
+
className?: string;
|
|
156
|
+
}>;
|
|
157
|
+
|
|
131
158
|
declare type NoTitleProps = {
|
|
132
159
|
title?: never;
|
|
133
160
|
titleSize?: never;
|
|
@@ -148,6 +175,8 @@ export declare type PaginatorProps = {
|
|
|
148
175
|
urlForPage: (pageNumber: number) => string;
|
|
149
176
|
});
|
|
150
177
|
|
|
178
|
+
export declare type PillProps = LinkProps;
|
|
179
|
+
|
|
151
180
|
export declare const prettifyPageNumber: (pageNumber: NumberOrEllipsis) => string;
|
|
152
181
|
|
|
153
182
|
export declare const progressivePagination: (currentPage: number, pageCount: number) => NumberOrEllipsis[];
|
|
@@ -170,6 +199,19 @@ declare type RegularCardModalProps = CommonCardModalProps & {
|
|
|
170
199
|
onConfirm?: () => void;
|
|
171
200
|
};
|
|
172
201
|
|
|
202
|
+
export declare type RequiredReactNode = Exclude<ReactNode, undefined | null>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Component used to display the result of an operation, which can be a success, failure or warning.
|
|
206
|
+
*/
|
|
207
|
+
export declare const Result: FC<ResultProps>;
|
|
208
|
+
|
|
209
|
+
export declare type ResultProps = PropsWithChildren<{
|
|
210
|
+
variant: 'success' | 'error' | 'warning';
|
|
211
|
+
className?: string;
|
|
212
|
+
size?: Size;
|
|
213
|
+
}>;
|
|
214
|
+
|
|
173
215
|
export declare const roundTen: (number: number) => number;
|
|
174
216
|
|
|
175
217
|
export declare const SearchInput: FC<SearchInputProps>;
|
|
@@ -194,7 +236,7 @@ export declare type SimpleCardProps = Omit<CardProps, 'title' | 'size'> & {
|
|
|
194
236
|
bodyClassName?: string;
|
|
195
237
|
} & (TitleProps | NoTitleProps);
|
|
196
238
|
|
|
197
|
-
declare type Size = 'sm' | 'md' | 'lg';
|
|
239
|
+
export declare type Size = 'sm' | 'md' | 'lg';
|
|
198
240
|
|
|
199
241
|
export declare const Table: FC<TableProps> & {
|
|
200
242
|
Row: FC<HTMLProps<HTMLTableRowElement>>;
|
|
@@ -220,20 +262,8 @@ declare type TitleProps = {
|
|
|
220
262
|
titleSize?: Size;
|
|
221
263
|
};
|
|
222
264
|
|
|
223
|
-
export declare
|
|
224
|
-
/** Test seam. Defaults to global setTimeout */
|
|
225
|
-
setTimeout_?: typeof globalThis.setTimeout,
|
|
226
|
-
/** Test seam. Defaults to global clearTimeout */
|
|
227
|
-
clearTimeout_?: typeof clearTimeout): UseTimeoutResult;
|
|
265
|
+
export declare const ToggleSwitch: FC<ToggleSwitchProps>;
|
|
228
266
|
|
|
229
|
-
export declare type
|
|
230
|
-
/**
|
|
231
|
-
* Clears any in-progress timeout, and schedules a new callback.
|
|
232
|
-
* It optionally allows a delay to be provided, or falls back to the default delay otherwise.
|
|
233
|
-
*/
|
|
234
|
-
setTimeout: (callback: Callback, delay?: number) => void;
|
|
235
|
-
/** Clears any in-progress timeout */
|
|
236
|
-
clearCurrentTimeout: () => void;
|
|
237
|
-
};
|
|
267
|
+
export declare type ToggleSwitchProps = BooleanControlProps;
|
|
238
268
|
|
|
239
269
|
export { }
|