@overdoser/react-toolkit 0.16.0 → 0.18.0
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/AGENTS.md +1 -1
- package/CHANGELOG.md +74 -0
- package/components/Chart/AreaChart.d.ts +5 -1
- package/components/Chart/AreaChart.js +155 -144
- package/components/Chart/BarChart.js +5 -5
- package/components/Chart/PieChart.js +2 -5
- package/components/Chart/RadarChart.js +2 -5
- package/components/Chart/TradingChart.js +258 -257
- package/components/Drawer/Drawer.js +69 -70
- package/components/Dropdown/Dropdown.js +51 -56
- package/components/Loader/Loader.d.ts +104 -0
- package/components/Loader/Loader.js +186 -0
- package/components/Loader/Loader.module.scss.js +70 -0
- package/components/Loader/index.d.ts +2 -0
- package/components/Modal/Modal.js +42 -47
- package/components/Popover/Popover.js +52 -55
- package/components/SplitButton/SplitButton.js +50 -55
- package/components/inputs/DatePicker/DatePicker.js +82 -76
- package/components/inputs/DateTimePicker/DateTimePicker.js +4 -2
- package/components/inputs/DateTimePicker/DateTimeSegments.d.ts +2 -1
- package/components/inputs/DateTimePicker/DateTimeSegments.js +1 -1
- package/components/inputs/NumberInput/NumberInput.js +79 -81
- package/components/inputs/Select/Select.d.ts +5 -0
- package/components/inputs/Select/Select.js +340 -285
- package/hooks/useEscapeLayer.d.ts +36 -0
- package/hooks/useEscapeLayer.js +33 -0
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +74 -72
- package/index.layered.css +1 -1
- package/llms.txt +43 -2
- package/manifest.json +73 -0
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as q, useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import { useFocusTrap as
|
|
6
|
-
import {
|
|
1
|
+
import { jsx as c, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as q, useRef as T, useId as G, useState as u, useEffect as w, createContext as J, useContext as h } from "react";
|
|
3
|
+
import { createPortal as K } from "react-dom";
|
|
4
|
+
import d from "clsx";
|
|
5
|
+
import { useFocusTrap as Q } from "../../hooks/useFocusTrap.js";
|
|
6
|
+
import { useEscapeLayer as V, EscapeLayerProvider as X } from "../../hooks/useEscapeLayer.js";
|
|
7
7
|
import t from "./Drawer.module.scss.js";
|
|
8
|
-
const m =
|
|
9
|
-
const { classes: i, titleId:
|
|
10
|
-
return /* @__PURE__ */
|
|
8
|
+
const m = J({ classes: {}, titleId: "" }), x = ({ children: e, className: s, style: a, onClose: o }) => {
|
|
9
|
+
const { classes: i, titleId: p } = h(m);
|
|
10
|
+
return /* @__PURE__ */ z(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
id:
|
|
14
|
-
className:
|
|
15
|
-
style:
|
|
13
|
+
id: p,
|
|
14
|
+
className: d(t.header, o && t.headerWithClose, i.header, s),
|
|
15
|
+
style: a,
|
|
16
16
|
children: [
|
|
17
17
|
e,
|
|
18
|
-
o && /* @__PURE__ */
|
|
18
|
+
o && /* @__PURE__ */ c(
|
|
19
19
|
"button",
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
|
-
className:
|
|
22
|
+
className: d(t.closeButton, i.closeButton),
|
|
23
23
|
onClick: o,
|
|
24
24
|
"aria-label": "Close",
|
|
25
25
|
children: "×"
|
|
@@ -29,91 +29,90 @@ const m = Q({ classes: {}, titleId: "" }), M = ({ children: e, className: a, sty
|
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
const R = ({ children: e, className:
|
|
32
|
+
x.displayName = "Drawer.Header";
|
|
33
|
+
const R = ({ children: e, className: s, style: a }) => {
|
|
34
34
|
const { classes: o } = h(m);
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ c("div", { className: d(t.body, o.body, s), style: a, children: e });
|
|
36
36
|
};
|
|
37
37
|
R.displayName = "Drawer.Body";
|
|
38
|
-
const
|
|
38
|
+
const M = ({ children: e, className: s, style: a }) => {
|
|
39
39
|
const { classes: o } = h(m);
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ c("div", { className: d(t.footer, o.footer, s), style: a, children: e });
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
const
|
|
42
|
+
M.displayName = "Drawer.Footer";
|
|
43
|
+
const Y = 340, f = q(
|
|
44
44
|
({
|
|
45
45
|
open: e,
|
|
46
|
-
onClose:
|
|
47
|
-
side:
|
|
46
|
+
onClose: s,
|
|
47
|
+
side: a = "right",
|
|
48
48
|
size: o = "md",
|
|
49
49
|
variant: i = "temporary",
|
|
50
|
-
closeOnBackdrop:
|
|
51
|
-
closeOnEscape:
|
|
52
|
-
classes:
|
|
53
|
-
className:
|
|
54
|
-
style:
|
|
55
|
-
children:
|
|
56
|
-
"aria-label":
|
|
57
|
-
"aria-labelledby":
|
|
50
|
+
closeOnBackdrop: p = !0,
|
|
51
|
+
closeOnEscape: C = !0,
|
|
52
|
+
classes: y,
|
|
53
|
+
className: _,
|
|
54
|
+
style: $,
|
|
55
|
+
children: A,
|
|
56
|
+
"aria-label": N,
|
|
57
|
+
"aria-labelledby": E
|
|
58
58
|
}, n) => {
|
|
59
|
-
const B =
|
|
59
|
+
const B = T(null), F = (r) => {
|
|
60
60
|
B.current = r, typeof n == "function" ? n(r) : n && (n.current = r);
|
|
61
|
-
}, O = G(), g =
|
|
61
|
+
}, O = G(), g = E ?? `${O}-title`, b = i === "temporary", [l, k] = u(e), [D, I] = u(!1), [S, H] = u(a), [P, j] = u(o);
|
|
62
62
|
w(() => {
|
|
63
|
-
e && (
|
|
64
|
-
}, [e,
|
|
65
|
-
if (e || !
|
|
66
|
-
|
|
67
|
-
const r = setTimeout(() =>
|
|
63
|
+
e && (k(!0), I(!1), H(a), j(o));
|
|
64
|
+
}, [e, a, o]), w(() => {
|
|
65
|
+
if (e || !l) return;
|
|
66
|
+
I(!0);
|
|
67
|
+
const r = setTimeout(() => k(!1), Y);
|
|
68
68
|
return () => clearTimeout(r);
|
|
69
|
-
}, [e,
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
if (!c) return;
|
|
69
|
+
}, [e, l]), Q(B, l && e && b);
|
|
70
|
+
const L = V(() => {
|
|
71
|
+
C && s();
|
|
72
|
+
}, e);
|
|
73
|
+
w(() => {
|
|
74
|
+
if (!l) return;
|
|
76
75
|
const r = document.body.style.overflow;
|
|
77
76
|
return document.body.style.overflow = "hidden", () => {
|
|
78
77
|
document.body.style.overflow = r;
|
|
79
78
|
};
|
|
80
|
-
}, [
|
|
81
|
-
const v =
|
|
79
|
+
}, [l]);
|
|
80
|
+
const v = T(!1), U = (r) => {
|
|
82
81
|
v.current = r.target === r.currentTarget;
|
|
83
|
-
},
|
|
84
|
-
|
|
82
|
+
}, W = (r) => {
|
|
83
|
+
p && v.current && r.target === r.currentTarget && s(), v.current = !1;
|
|
85
84
|
};
|
|
86
|
-
return
|
|
87
|
-
/* @__PURE__ */
|
|
85
|
+
return l ? K(
|
|
86
|
+
/* @__PURE__ */ c(
|
|
88
87
|
"div",
|
|
89
88
|
{
|
|
90
|
-
className:
|
|
89
|
+
className: d(
|
|
91
90
|
t.backdrop,
|
|
92
|
-
|
|
91
|
+
D && t.backdropClosing,
|
|
93
92
|
!b && t.backdropBare,
|
|
94
|
-
|
|
93
|
+
y?.backdrop
|
|
95
94
|
),
|
|
96
|
-
onMouseDown:
|
|
97
|
-
onMouseUp:
|
|
95
|
+
onMouseDown: U,
|
|
96
|
+
onMouseUp: W,
|
|
98
97
|
role: "presentation",
|
|
99
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ c(
|
|
100
99
|
"div",
|
|
101
100
|
{
|
|
102
|
-
ref:
|
|
103
|
-
className:
|
|
101
|
+
ref: F,
|
|
102
|
+
className: d(
|
|
104
103
|
t.drawer,
|
|
105
|
-
t[`side_${
|
|
106
|
-
t[`size_${
|
|
107
|
-
t[`${
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
t[`side_${S}`],
|
|
105
|
+
t[`size_${P}`],
|
|
106
|
+
t[`${D ? "slideOut" : "slideIn"}_${S}`],
|
|
107
|
+
y?.drawer,
|
|
108
|
+
_
|
|
110
109
|
),
|
|
111
|
-
style:
|
|
110
|
+
style: $,
|
|
112
111
|
role: "dialog",
|
|
113
112
|
"aria-modal": b ? "true" : void 0,
|
|
114
|
-
"aria-label":
|
|
115
|
-
"aria-labelledby":
|
|
116
|
-
children: /* @__PURE__ */
|
|
113
|
+
"aria-label": N,
|
|
114
|
+
"aria-labelledby": N ? void 0 : g,
|
|
115
|
+
children: /* @__PURE__ */ c(m.Provider, { value: { classes: y ?? {}, titleId: g }, children: /* @__PURE__ */ c(X, { value: L, children: A }) })
|
|
117
116
|
}
|
|
118
117
|
)
|
|
119
118
|
}
|
|
@@ -123,9 +122,9 @@ const Z = 340, f = q(
|
|
|
123
122
|
}
|
|
124
123
|
);
|
|
125
124
|
f.displayName = "Drawer";
|
|
126
|
-
f.Header =
|
|
125
|
+
f.Header = x;
|
|
127
126
|
f.Body = R;
|
|
128
|
-
f.Footer =
|
|
127
|
+
f.Footer = M;
|
|
129
128
|
export {
|
|
130
129
|
f as Drawer
|
|
131
130
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as d, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useState as K, useRef as v, useId as Q, useEffect as S, useCallback as b } from "react";
|
|
3
|
+
import { createPortal as T } from "react-dom";
|
|
4
4
|
import o from "clsx";
|
|
5
5
|
import t from "./Dropdown.module.scss.js";
|
|
6
|
-
import {
|
|
7
|
-
import { usePortalPosition as
|
|
8
|
-
const
|
|
6
|
+
import { useEscapeLayer as U, EscapeLayerProvider as V } from "../../hooks/useEscapeLayer.js";
|
|
7
|
+
import { usePortalPosition as X } from "../../hooks/usePortalPosition.js";
|
|
8
|
+
const Y = J(
|
|
9
9
|
({
|
|
10
10
|
trigger: k,
|
|
11
11
|
children: D,
|
|
@@ -14,47 +14,42 @@ const V = G(
|
|
|
14
14
|
style: z,
|
|
15
15
|
id: O,
|
|
16
16
|
onOpen: y,
|
|
17
|
-
onClose:
|
|
17
|
+
onClose: s,
|
|
18
18
|
options: i,
|
|
19
19
|
placeholder: W = "Select...",
|
|
20
|
-
value:
|
|
21
|
-
onChange:
|
|
20
|
+
value: L,
|
|
21
|
+
onChange: w,
|
|
22
22
|
error: q = !1,
|
|
23
|
-
fullWidth:
|
|
23
|
+
fullWidth: a = !0,
|
|
24
24
|
portal: u = !0,
|
|
25
25
|
classes: n
|
|
26
|
-
},
|
|
27
|
-
const [r,
|
|
26
|
+
}, M) => {
|
|
27
|
+
const [r, x] = K(!1), E = v(null), m = v(null), h = v(null), N = Q();
|
|
28
28
|
S(() => {
|
|
29
|
-
r &&
|
|
29
|
+
r && m.current && m.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
|
|
30
30
|
}, [r]);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
31
|
+
const c = b(() => {
|
|
32
|
+
x(!1), s?.(), h.current?.focus();
|
|
33
|
+
}, [s]), A = b(() => {
|
|
34
|
+
x((e) => {
|
|
35
|
+
const f = !e;
|
|
36
|
+
return f ? y?.() : s?.(), f;
|
|
37
37
|
});
|
|
38
|
-
}, [y,
|
|
38
|
+
}, [y, s]), B = b(
|
|
39
39
|
(e) => {
|
|
40
|
-
|
|
40
|
+
w?.(e), c();
|
|
41
41
|
},
|
|
42
|
-
[
|
|
42
|
+
[w, c]
|
|
43
43
|
);
|
|
44
44
|
S(() => {
|
|
45
45
|
if (!r) return;
|
|
46
|
-
const e = (
|
|
47
|
-
const
|
|
48
|
-
E.current?.contains(
|
|
46
|
+
const e = (f) => {
|
|
47
|
+
const R = f.target;
|
|
48
|
+
E.current?.contains(R) || m.current?.contains(R) || c();
|
|
49
49
|
};
|
|
50
50
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
51
|
-
}, [r,
|
|
52
|
-
|
|
53
|
-
Escape: () => l()
|
|
54
|
-
},
|
|
55
|
-
r
|
|
56
|
-
);
|
|
57
|
-
const d = U(h, r && u), L = i?.find((e) => e.value === w)?.label, B = i ? L || W : k, C = i && !L, F = i ? i.map((e) => /* @__PURE__ */ f(
|
|
51
|
+
}, [r, c]);
|
|
52
|
+
const C = U(c, r), l = X(h, r && u), I = i?.find((e) => e.value === L)?.label, F = i ? I || W : k, G = i && !I, H = i ? i.map((e) => /* @__PURE__ */ d(
|
|
58
53
|
"button",
|
|
59
54
|
{
|
|
60
55
|
type: "button",
|
|
@@ -62,39 +57,39 @@ const V = G(
|
|
|
62
57
|
className: o(
|
|
63
58
|
t.item,
|
|
64
59
|
e.disabled && t.itemDisabled,
|
|
65
|
-
e.value ===
|
|
60
|
+
e.value === L && t.itemSelected,
|
|
66
61
|
n?.item
|
|
67
62
|
),
|
|
68
63
|
disabled: e.disabled,
|
|
69
|
-
onClick: () =>
|
|
64
|
+
onClick: () => B(e.value),
|
|
70
65
|
children: e.label
|
|
71
66
|
},
|
|
72
67
|
e.value
|
|
73
|
-
)) : D,
|
|
68
|
+
)) : D, P = (e) => /* @__PURE__ */ d(
|
|
74
69
|
"div",
|
|
75
70
|
{
|
|
76
|
-
ref:
|
|
77
|
-
id:
|
|
71
|
+
ref: m,
|
|
72
|
+
id: N,
|
|
78
73
|
className: o(
|
|
79
74
|
t.menu,
|
|
80
75
|
r && t.menuOpen,
|
|
81
76
|
g === "left" ? t.alignLeft : t.alignRight,
|
|
82
|
-
!u &&
|
|
77
|
+
!u && a && t.fullWidth,
|
|
83
78
|
n?.menu
|
|
84
79
|
),
|
|
85
80
|
style: e,
|
|
86
81
|
role: "menu",
|
|
87
|
-
children:
|
|
82
|
+
children: /* @__PURE__ */ d(V, { value: C, children: H })
|
|
88
83
|
}
|
|
89
84
|
);
|
|
90
85
|
return /* @__PURE__ */ p(
|
|
91
86
|
"div",
|
|
92
87
|
{
|
|
93
|
-
ref:
|
|
94
|
-
className: o(t.root,
|
|
88
|
+
ref: M,
|
|
89
|
+
className: o(t.root, a && t.fullWidth, n?.root, j),
|
|
95
90
|
style: z,
|
|
96
91
|
children: [
|
|
97
|
-
/* @__PURE__ */ p("div", { ref: E, style:
|
|
92
|
+
/* @__PURE__ */ p("div", { ref: E, style: a ? { width: "100%" } : void 0, children: [
|
|
98
93
|
/* @__PURE__ */ p(
|
|
99
94
|
"button",
|
|
100
95
|
{
|
|
@@ -105,32 +100,32 @@ const V = G(
|
|
|
105
100
|
t.trigger,
|
|
106
101
|
r && t.triggerOpen,
|
|
107
102
|
q && t.triggerError,
|
|
108
|
-
|
|
103
|
+
a && t.fullWidth,
|
|
109
104
|
n?.trigger
|
|
110
105
|
),
|
|
111
|
-
onClick:
|
|
106
|
+
onClick: A,
|
|
112
107
|
"aria-expanded": r,
|
|
113
108
|
"aria-haspopup": "menu",
|
|
114
|
-
"aria-controls": r ?
|
|
109
|
+
"aria-controls": r ? N : void 0,
|
|
115
110
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ d("span", { className: o(t.triggerLabel, G && t.placeholder, n?.triggerLabel), children: F }),
|
|
112
|
+
/* @__PURE__ */ d("span", { className: o(t.chevron, n?.chevron), "aria-hidden": "true" })
|
|
118
113
|
]
|
|
119
114
|
}
|
|
120
115
|
),
|
|
121
|
-
!u &&
|
|
116
|
+
!u && P()
|
|
122
117
|
] }),
|
|
123
|
-
u && r && typeof document < "u" &&
|
|
124
|
-
|
|
118
|
+
u && r && typeof document < "u" && T(
|
|
119
|
+
P({
|
|
125
120
|
position: "fixed",
|
|
126
|
-
top:
|
|
127
|
-
left: g === "right" ? void 0 :
|
|
121
|
+
top: l.top + 4,
|
|
122
|
+
left: g === "right" ? void 0 : l.left,
|
|
128
123
|
// clientWidth, not innerWidth: `right` on a fixed element is
|
|
129
124
|
// measured from the viewport edge inside the scrollbar, while
|
|
130
125
|
// innerWidth includes it — the menu would shift left by the
|
|
131
126
|
// scrollbar width whenever the page scrolls.
|
|
132
|
-
right: g === "right" ? document.documentElement.clientWidth - (
|
|
133
|
-
minWidth:
|
|
127
|
+
right: g === "right" ? document.documentElement.clientWidth - (l.left + l.width) : void 0,
|
|
128
|
+
minWidth: l.width,
|
|
134
129
|
zIndex: "var(--crk-z-floating)"
|
|
135
130
|
}),
|
|
136
131
|
document.body
|
|
@@ -140,7 +135,7 @@ const V = G(
|
|
|
140
135
|
);
|
|
141
136
|
}
|
|
142
137
|
);
|
|
143
|
-
|
|
138
|
+
Y.displayName = "Dropdown";
|
|
144
139
|
export {
|
|
145
|
-
|
|
140
|
+
Y as Dropdown
|
|
146
141
|
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface LoaderClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
/** Wrapper around `children` (wrap mode only). */
|
|
5
|
+
content: string;
|
|
6
|
+
/** The layer covering the container / viewport. */
|
|
7
|
+
overlay: string;
|
|
8
|
+
/** The `role="status"` element holding the animation and label. */
|
|
9
|
+
indicator: string;
|
|
10
|
+
/** The animated shape itself. */
|
|
11
|
+
glyph: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export interface LoaderProps extends Omit<ComponentPropsWithRef<'div'>, 'color'> {
|
|
15
|
+
/**
|
|
16
|
+
* Animation style.
|
|
17
|
+
* - `'dots'`: three bouncing dots (the `Button` loading animation, scaled up).
|
|
18
|
+
* - `'pulse'`: the same three dots, swelling and fading in turn without moving.
|
|
19
|
+
* - `'spinner'`: arc turning on a faint track.
|
|
20
|
+
* - `'grid'`: 3×3 cells lighting up in a diagonal wave.
|
|
21
|
+
* - `'morph'`: a gradient shape that morphs and turns.
|
|
22
|
+
* @default 'dots'
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'dots' | 'pulse' | 'spinner' | 'grid' | 'morph';
|
|
25
|
+
/** Toolkit size scale. Fine-tune with `--crk-loader-size`. @default 'md' */
|
|
26
|
+
size?: 'sm' | 'md' | 'lg';
|
|
27
|
+
/**
|
|
28
|
+
* Where the loader goes when it has no `children`.
|
|
29
|
+
* - `'inline'`: a centered block in the normal flow (e.g. an empty page section).
|
|
30
|
+
* - `'overlay'`: covers the element it is rendered into. No CSS needed on
|
|
31
|
+
* that element: a statically positioned parent is made `position: relative`
|
|
32
|
+
* while the loader is shown, and restored afterwards.
|
|
33
|
+
* - `'fullscreen'`: covers the viewport (portaled to `document.body`).
|
|
34
|
+
*
|
|
35
|
+
* With `children`, the loader wraps them and overlays them instead
|
|
36
|
+
* (`'fullscreen'` still covers the viewport).
|
|
37
|
+
* @default 'inline'
|
|
38
|
+
*/
|
|
39
|
+
mode?: 'inline' | 'overlay' | 'fullscreen';
|
|
40
|
+
/**
|
|
41
|
+
* Whether the loader is shown. With `children`, the content stays mounted and
|
|
42
|
+
* keeps its size while this is `true`, so the layout doesn't jump. @default true
|
|
43
|
+
*/
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Content to cover while loading. The loader renders a wrapper around it and
|
|
47
|
+
* overlays it — the content keeps its height, nothing else to set up.
|
|
48
|
+
*/
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Wait this many milliseconds before showing, so fast responses never flash
|
|
52
|
+
* a loader. @default 0
|
|
53
|
+
*/
|
|
54
|
+
delay?: number;
|
|
55
|
+
/**
|
|
56
|
+
* What the overlay puts between the loader and the covered content.
|
|
57
|
+
* @default 'dim'
|
|
58
|
+
*/
|
|
59
|
+
backdrop?: 'dim' | 'blur' | 'none';
|
|
60
|
+
/**
|
|
61
|
+
* Keep the covered content usable (focusable, clickable) while loading. By
|
|
62
|
+
* default it is made `inert`; turn this on when the covered area contains
|
|
63
|
+
* the control that triggered the load, e.g. a filter-as-you-type input.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
interactive?: boolean;
|
|
67
|
+
/** Indicator color. Defaults to `--crk-color-primary`; also settable via `--crk-loader-color`. */
|
|
68
|
+
color?: string;
|
|
69
|
+
/** Accessible label; visually hidden unless `showLabel` is set. @default 'Loading' */
|
|
70
|
+
label?: string;
|
|
71
|
+
/** Render `label` as visible text under the animation. @default false */
|
|
72
|
+
showLabel?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Minimum height of the inline block, or of the wrapper while loading (so an
|
|
75
|
+
* empty container still has room for the loader). Number → px.
|
|
76
|
+
*/
|
|
77
|
+
minHeight?: number | string;
|
|
78
|
+
/** Override class names on internal elements. */
|
|
79
|
+
classes?: Partial<LoaderClasses>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Loading indicator for pages and containers. Drop it in as a centered block,
|
|
83
|
+
* wrap content to overlay it without changing its height, or cover the
|
|
84
|
+
* viewport — none of which needs CSS on the surrounding elements. Over a
|
|
85
|
+
* container taller than the screen, the indicator is centred in the part of
|
|
86
|
+
* it that is visible and follows scrolling.
|
|
87
|
+
*
|
|
88
|
+
* Sizing, colors and timing are CSS variables (`--crk-loader-size`,
|
|
89
|
+
* `--crk-loader-color`, `--crk-loader-speed`, `--crk-loader-dot-size`,
|
|
90
|
+
* `--crk-loader-dot-gap`, `--crk-loader-dot-bounce`, `--crk-loader-dot-pulse`,
|
|
91
|
+
* `--crk-loader-backdrop`,
|
|
92
|
+
* `--crk-loader-blur`).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* // Results keep their height while a new filter runs
|
|
96
|
+
* <Loader loading={isFetching} delay={150}>
|
|
97
|
+
* <ResultList items={results} />
|
|
98
|
+
* </Loader>
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Initial page load, nothing to show yet
|
|
102
|
+
* <Loader mode="fullscreen" variant="morph" label="Loading dashboard" showLabel />
|
|
103
|
+
*/
|
|
104
|
+
export declare const Loader: import('react').ForwardRefExoticComponent<Omit<LoaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|