@overdoser/react-toolkit 0.17.0 → 0.19.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 +51 -7
- package/CHANGELOG.md +149 -0
- package/components/Accordion/Accordion.d.ts +94 -0
- package/components/Accordion/Accordion.js +180 -0
- package/components/Accordion/Accordion.module.scss.js +36 -0
- package/components/Accordion/index.d.ts +2 -0
- package/components/Alert/Alert.d.ts +29 -1
- package/components/Alert/Alert.js +44 -30
- package/components/Alert/Alert.module.scss.js +24 -16
- package/components/Alert/index.d.ts +1 -1
- package/components/Card/Card.d.ts +86 -0
- package/components/Card/Card.js +132 -0
- package/components/Card/Card.module.scss.js +60 -0
- package/components/Card/index.d.ts +2 -0
- package/components/Chip/Chip.d.ts +86 -0
- package/components/Chip/Chip.js +141 -0
- package/components/Chip/Chip.module.scss.js +59 -0
- package/components/Chip/index.d.ts +2 -0
- package/components/CodeBlock/CodeBlock.d.ts +78 -0
- package/components/CodeBlock/CodeBlock.js +120 -0
- package/components/CodeBlock/CodeBlock.module.scss.js +43 -0
- package/components/CodeBlock/index.d.ts +2 -0
- package/components/CommandPalette/CommandPalette.d.ts +141 -0
- package/components/CommandPalette/CommandPalette.js +397 -0
- package/components/CommandPalette/CommandPalette.module.scss.js +49 -0
- package/components/CommandPalette/index.d.ts +2 -0
- package/components/ConfirmDialog/ConfirmDialog.d.ts +119 -0
- package/components/ConfirmDialog/ConfirmDialog.js +201 -0
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +21 -0
- package/components/ConfirmDialog/index.d.ts +2 -0
- package/components/Drawer/Drawer.d.ts +1 -0
- package/components/Drawer/Drawer.js +35 -36
- package/components/Drawer/Drawer.module.scss.js +20 -18
- package/components/Dropdown/Dropdown.d.ts +47 -7
- package/components/Dropdown/Dropdown.js +174 -81
- package/components/Dropdown/Dropdown.module.scss.js +40 -22
- package/components/Dropdown/DropdownItem.d.ts +31 -2
- package/components/Dropdown/DropdownItem.js +54 -27
- package/components/Dropdown/DropdownLabel.d.ts +11 -0
- package/components/Dropdown/DropdownLabel.js +11 -0
- package/components/Dropdown/DropdownSeparator.d.ts +12 -0
- package/components/Dropdown/DropdownSeparator.js +11 -0
- package/components/Dropdown/dropdownContext.d.ts +6 -0
- package/components/Dropdown/dropdownContext.js +5 -0
- package/components/Dropdown/index.d.ts +8 -2
- package/components/Dropdown/useContextMenu.d.ts +32 -0
- package/components/Dropdown/useContextMenu.js +18 -0
- package/components/EmptyState/EmptyState.d.ts +53 -0
- package/components/EmptyState/EmptyState.js +55 -0
- package/components/EmptyState/EmptyState.module.scss.js +25 -0
- package/components/EmptyState/index.d.ts +2 -0
- package/components/Form/FormField.js +25 -24
- package/components/ImageViewer/ImageViewer.d.ts +105 -0
- package/components/ImageViewer/ImageViewer.js +201 -0
- package/components/ImageViewer/ImageViewer.module.scss.js +47 -0
- package/components/ImageViewer/index.d.ts +4 -0
- package/components/ImageViewer/useZoomPan.d.ts +94 -0
- package/components/ImageViewer/useZoomPan.js +141 -0
- package/components/Kbd/Kbd.d.ts +26 -0
- package/components/Kbd/Kbd.js +22 -0
- package/components/Kbd/Kbd.module.scss.js +17 -0
- package/components/Kbd/index.d.ts +2 -0
- package/components/KeyValueList/KeyValueList.d.ts +84 -0
- package/components/KeyValueList/KeyValueList.js +127 -0
- package/components/KeyValueList/KeyValueList.module.scss.js +43 -0
- package/components/KeyValueList/index.d.ts +2 -0
- 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.d.ts +1 -0
- package/components/Modal/Modal.js +40 -41
- package/components/Modal/Modal.module.scss.js +18 -16
- package/components/PageHeader/PageHeader.d.ts +61 -0
- package/components/PageHeader/PageHeader.js +73 -0
- package/components/PageHeader/PageHeader.module.scss.js +43 -0
- package/components/PageHeader/index.d.ts +2 -0
- package/components/ProgressBar/ProgressBar.d.ts +74 -0
- package/components/ProgressBar/ProgressBar.js +90 -0
- package/components/ProgressBar/ProgressBar.module.scss.js +51 -0
- package/components/ProgressBar/index.d.ts +2 -0
- package/components/RelativeTime/RelativeTime.d.ts +45 -0
- package/components/RelativeTime/RelativeTime.js +43 -0
- package/components/RelativeTime/RelativeTime.module.scss.js +7 -0
- package/components/RelativeTime/index.d.ts +2 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +84 -0
- package/components/SegmentedControl/SegmentedControl.js +131 -0
- package/components/SegmentedControl/SegmentedControl.module.scss.js +39 -0
- package/components/SegmentedControl/index.d.ts +2 -0
- package/components/SplitPane/SplitPane.d.ts +61 -0
- package/components/SplitPane/SplitPane.js +171 -0
- package/components/SplitPane/SplitPane.module.scss.js +25 -0
- package/components/SplitPane/index.d.ts +2 -0
- package/components/StatCard/StatCard.d.ts +105 -0
- package/components/StatCard/StatCard.js +127 -0
- package/components/StatCard/StatCard.module.scss.js +72 -0
- package/components/StatCard/index.d.ts +2 -0
- package/components/StatusDot/StatusDot.d.ts +33 -0
- package/components/StatusDot/StatusDot.js +39 -0
- package/components/StatusDot/StatusDot.module.scss.js +32 -0
- package/components/StatusDot/index.d.ts +2 -0
- package/components/Table/Table.d.ts +100 -2
- package/components/Table/Table.js +371 -210
- package/components/Table/Table.module.scss.js +68 -46
- package/components/Table/index.d.ts +1 -1
- package/components/ThemeToggle/ThemeToggle.d.ts +38 -0
- package/components/ThemeToggle/ThemeToggle.js +97 -0
- package/components/ThemeToggle/ThemeToggle.module.scss.js +23 -0
- package/components/ThemeToggle/index.d.ts +2 -0
- package/components/inputs/Checkbox/Checkbox.d.ts +2 -0
- package/components/inputs/Checkbox/Checkbox.js +29 -28
- package/components/inputs/Checkbox/Checkbox.module.scss.js +8 -6
- package/components/inputs/Input/Input.d.ts +33 -1
- package/components/inputs/Input/Input.js +94 -35
- package/components/inputs/Input/Input.module.scss.js +14 -12
- package/components/inputs/Radio/Radio.d.ts +5 -4
- package/components/inputs/Radio/Radio.js +55 -50
- package/components/inputs/Radio/Radio.module.scss.js +12 -10
- package/components/inputs/SearchInput/SearchInput.d.ts +57 -0
- package/components/inputs/SearchInput/SearchInput.js +116 -0
- package/components/inputs/SearchInput/SearchInput.module.scss.js +13 -0
- package/components/inputs/SearchInput/index.d.ts +2 -0
- package/components/inputs/Select/Select.d.ts +52 -0
- package/components/inputs/Select/Select.js +494 -385
- package/components/inputs/Select/Select.module.scss.js +34 -30
- package/components/inputs/Switch/Switch.d.ts +15 -0
- package/components/inputs/Switch/Switch.js +8 -0
- package/components/inputs/Switch/index.d.ts +2 -0
- package/hooks/useDebouncedValue.d.ts +15 -0
- package/hooks/useDebouncedValue.js +15 -0
- package/hooks/useElementSize.d.ts +20 -0
- package/hooks/useElementSize.js +23 -0
- package/hooks/useKeyboard.d.ts +49 -5
- package/hooks/useKeyboard.js +66 -16
- package/hooks/useMediaQuery.d.ts +14 -0
- package/hooks/useMediaQuery.js +16 -0
- package/hooks/useNow.d.ts +14 -0
- package/hooks/useNow.js +35 -0
- package/hooks/usePersistedState.d.ts +30 -0
- package/hooks/usePersistedState.js +96 -0
- package/hooks/useResizable.d.ts +66 -0
- package/hooks/useResizable.js +105 -0
- package/hooks/useTheme.d.ts +33 -0
- package/hooks/useTheme.js +27 -0
- package/index.css +1 -1
- package/index.d.ts +60 -4
- package/index.js +208 -130
- package/index.layered.css +1 -1
- package/llms.txt +659 -25
- package/manifest.json +1797 -76
- package/package.json +1 -1
- package/recipes/confirm-modal.tsx +65 -53
- package/recipes/floating-copy-button.tsx +32 -28
- package/utils/formatBytes.d.ts +21 -0
- package/utils/formatBytes.js +14 -0
- package/utils/index.d.ts +6 -0
- package/utils/themeScript.d.ts +17 -0
- package/utils/themeScript.js +9 -0
- package/utils/timeAgo.d.ts +33 -0
- package/utils/timeAgo.js +37 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CSSProperties, PointerEvent, RefObject, WheelEvent, MouseEvent } from 'react';
|
|
2
|
+
export interface ZoomPanState {
|
|
3
|
+
/** Current scale factor (1 = natural size). */
|
|
4
|
+
scale: number;
|
|
5
|
+
/** Horizontal offset in px, applied before scaling, relative to the content's centred position. */
|
|
6
|
+
x: number;
|
|
7
|
+
/** Vertical offset in px. */
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export interface UseZoomPanOptions {
|
|
11
|
+
/** Smallest allowed scale. @default 1 */
|
|
12
|
+
minScale?: number;
|
|
13
|
+
/** Largest allowed scale. @default 8 */
|
|
14
|
+
maxScale?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Zoom step as a multiplier delta: `zoomIn()` multiplies the scale by
|
|
17
|
+
* `1 + step`, `zoomOut()` divides by it. @default 0.5
|
|
18
|
+
*/
|
|
19
|
+
step?: number;
|
|
20
|
+
/** Zoom with the mouse wheel toward the cursor (trackpad pinch arrives as a `ctrlKey` wheel). @default true */
|
|
21
|
+
wheel?: boolean;
|
|
22
|
+
/** Double-click toggles between 1 and 2.5 at the click point. @default true */
|
|
23
|
+
doubleClickToggle?: boolean;
|
|
24
|
+
/** Called after every change. */
|
|
25
|
+
onChange?: (state: ZoomPanState) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface ZoomPanStageProps {
|
|
28
|
+
ref: (node: HTMLElement | null) => void;
|
|
29
|
+
onWheel: (e: WheelEvent<HTMLElement>) => void;
|
|
30
|
+
onPointerDown: (e: PointerEvent<HTMLElement>) => void;
|
|
31
|
+
onPointerMove: (e: PointerEvent<HTMLElement>) => void;
|
|
32
|
+
onPointerUp: (e: PointerEvent<HTMLElement>) => void;
|
|
33
|
+
onPointerCancel: (e: PointerEvent<HTMLElement>) => void;
|
|
34
|
+
onDoubleClick: (e: MouseEvent<HTMLElement>) => void;
|
|
35
|
+
style: CSSProperties;
|
|
36
|
+
}
|
|
37
|
+
export interface UseZoomPanResult extends ZoomPanState {
|
|
38
|
+
/** True while a pointer drag is panning the content. */
|
|
39
|
+
isPanning: boolean;
|
|
40
|
+
/** Spread onto the stage element (the viewport the content moves inside). */
|
|
41
|
+
stageProps: ZoomPanStageProps;
|
|
42
|
+
/** Attach to the element being zoomed; it must be centred in the stage at rest. */
|
|
43
|
+
contentRef: RefObject<HTMLElement | null>;
|
|
44
|
+
/** Style for the content element (`transform` + `transform-origin: 0 0`). */
|
|
45
|
+
contentStyle: CSSProperties;
|
|
46
|
+
zoomIn: () => void;
|
|
47
|
+
zoomOut: () => void;
|
|
48
|
+
/** Zoom to an absolute scale, keeping `origin` (stage-relative px; default: stage centre) fixed under the cursor. */
|
|
49
|
+
zoomTo: (scale: number, origin?: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}) => void;
|
|
53
|
+
/** Back to scale 1, centred. */
|
|
54
|
+
reset: () => void;
|
|
55
|
+
/** Scale so the content fills the stage on its tighter axis. */
|
|
56
|
+
fit: () => void;
|
|
57
|
+
}
|
|
58
|
+
interface Geometry {
|
|
59
|
+
/** Stage size. */
|
|
60
|
+
W: number;
|
|
61
|
+
H: number;
|
|
62
|
+
/** Content size at scale 1. */
|
|
63
|
+
w: number;
|
|
64
|
+
h: number;
|
|
65
|
+
/** Content top-left at rest (centred), in stage coordinates. */
|
|
66
|
+
cx0: number;
|
|
67
|
+
cy0: number;
|
|
68
|
+
}
|
|
69
|
+
/** Keep at least `MIN_VISIBLE` of the content inside the stage; centre when not zoomed. */
|
|
70
|
+
export declare function clampState(state: ZoomPanState, geom: Geometry | null): ZoomPanState;
|
|
71
|
+
/** Change scale while keeping the content point under `origin` (stage px) fixed. */
|
|
72
|
+
export declare function zoomAround(state: ZoomPanState, nextScale: number, origin: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
}, geom: Geometry | null): ZoomPanState;
|
|
76
|
+
/**
|
|
77
|
+
* Zero-dependency zoom + pan engine for an image/stage: wheel zoom toward the
|
|
78
|
+
* cursor, drag to pan (clamped so the content never leaves the stage), pinch
|
|
79
|
+
* on touch, double-click toggle, keyboard-friendly imperative API.
|
|
80
|
+
*
|
|
81
|
+
* Layout contract: the stage is `position: relative; overflow: hidden` and
|
|
82
|
+
* centres the content (flex) at rest; the content gets `contentStyle`.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* const zoom = useZoomPan({ maxScale: 6 });
|
|
87
|
+
* <div className={styles.stage} {...zoom.stageProps}>
|
|
88
|
+
* <img ref={zoom.contentRef} style={zoom.contentStyle} src={src} alt="" />
|
|
89
|
+
* </div>
|
|
90
|
+
* <button onClick={zoom.zoomIn}>+</button>
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function useZoomPan(options?: UseZoomPanOptions): UseZoomPanResult;
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useState as O, useRef as M, useCallback as i, useEffect as N, useMemo as k } from "react";
|
|
2
|
+
const v = { scale: 1, x: 0, y: 0 }, j = 2.5, Y = 0.2;
|
|
3
|
+
function R(c, n, o) {
|
|
4
|
+
return Math.min(o, Math.max(n, c));
|
|
5
|
+
}
|
|
6
|
+
function q(c, n) {
|
|
7
|
+
if (c.scale <= 1 || !n) return { scale: c.scale, x: 0, y: 0 };
|
|
8
|
+
const o = n.w * c.scale, s = n.h * c.scale, p = -n.cx0 - o * (1 - Y), h = n.W - n.cx0 - o * Y, P = -n.cy0 - s * (1 - Y), u = n.H - n.cy0 - s * Y;
|
|
9
|
+
return {
|
|
10
|
+
scale: c.scale,
|
|
11
|
+
x: R(c.x, Math.min(p, h), Math.max(p, h)),
|
|
12
|
+
y: R(c.y, Math.min(P, u), Math.max(P, u))
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function F(c, n, o, s) {
|
|
16
|
+
if (!s) return { ...c, scale: n };
|
|
17
|
+
const p = (o.x - s.cx0 - c.x) / c.scale, h = (o.y - s.cy0 - c.y) / c.scale;
|
|
18
|
+
return {
|
|
19
|
+
scale: n,
|
|
20
|
+
x: o.x - s.cx0 - p * n,
|
|
21
|
+
y: o.y - s.cy0 - h * n
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function J(c = {}) {
|
|
25
|
+
const { minScale: n = 1, maxScale: o = 8, step: s = 0.5, wheel: p = !0, doubleClickToggle: h = !0, onChange: P } = c, [u, _] = O(v), [g, S] = O(!1), X = M(null), H = M(null), f = M(u);
|
|
26
|
+
f.current = u;
|
|
27
|
+
const A = M(P);
|
|
28
|
+
A.current = P;
|
|
29
|
+
const C = i(() => {
|
|
30
|
+
const t = X.current, e = H.current;
|
|
31
|
+
if (!t || !e) return null;
|
|
32
|
+
const r = t.clientWidth || t.getBoundingClientRect().width, a = t.clientHeight || t.getBoundingClientRect().height, m = e.offsetWidth, W = e.offsetHeight;
|
|
33
|
+
return !r || !a || !m || !W ? null : { W: r, H: a, w: m, h: W, cx0: (r - m) / 2, cy0: (a - W) / 2 };
|
|
34
|
+
}, []), x = i(
|
|
35
|
+
(t) => {
|
|
36
|
+
const e = q(
|
|
37
|
+
{ ...t, scale: R(t.scale, n, o) },
|
|
38
|
+
C()
|
|
39
|
+
);
|
|
40
|
+
f.current = e, _(e), A.current?.(e);
|
|
41
|
+
},
|
|
42
|
+
[C, n, o]
|
|
43
|
+
), b = i((t, e) => {
|
|
44
|
+
const r = X.current;
|
|
45
|
+
if (!r) return { x: 0, y: 0 };
|
|
46
|
+
const a = r.getBoundingClientRect();
|
|
47
|
+
return { x: t - a.left, y: e - a.top };
|
|
48
|
+
}, []), l = i(
|
|
49
|
+
(t, e) => {
|
|
50
|
+
const r = C(), a = R(t, n, o), m = e ?? (r ? { x: r.W / 2, y: r.H / 2 } : { x: 0, y: 0 });
|
|
51
|
+
x(F(f.current, a, m, r));
|
|
52
|
+
},
|
|
53
|
+
[x, C, n, o]
|
|
54
|
+
), $ = i(() => l(f.current.scale * (1 + s)), [l, s]), K = i(() => l(f.current.scale / (1 + s)), [l, s]), w = i(() => x(v), [x]), U = i(() => {
|
|
55
|
+
const t = C();
|
|
56
|
+
if (!t) return x(v);
|
|
57
|
+
l(Math.min(t.W / t.w, t.H / t.h));
|
|
58
|
+
}, [C, x, l]), y = M(/* @__PURE__ */ new Map()), d = M(null), I = M(null), B = i((t) => {
|
|
59
|
+
if (t.button !== 0 && t.pointerType === "mouse") return;
|
|
60
|
+
if (y.current.set(t.pointerId, { x: t.clientX, y: t.clientY }), t.currentTarget.setPointerCapture?.(t.pointerId), y.current.size === 2) {
|
|
61
|
+
const [r, a] = Array.from(y.current.values());
|
|
62
|
+
I.current = { dist: Math.hypot(r.x - a.x, r.y - a.y), scale: f.current.scale }, d.current = null, S(!1);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
f.current.scale > 1 && (d.current = { startX: t.clientX, startY: t.clientY, originX: f.current.x, originY: f.current.y }, S(!0));
|
|
66
|
+
}, []), E = i(
|
|
67
|
+
(t) => {
|
|
68
|
+
if (y.current.has(t.pointerId)) {
|
|
69
|
+
if (y.current.set(t.pointerId, { x: t.clientX, y: t.clientY }), I.current && y.current.size >= 2) {
|
|
70
|
+
const [e, r] = Array.from(y.current.values()), a = Math.hypot(e.x - r.x, e.y - r.y);
|
|
71
|
+
if (I.current.dist > 0) {
|
|
72
|
+
const m = b((e.x + r.x) / 2, (e.y + r.y) / 2);
|
|
73
|
+
l(I.current.scale * (a / I.current.dist), m);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
d.current && x({
|
|
78
|
+
scale: f.current.scale,
|
|
79
|
+
x: d.current.originX + (t.clientX - d.current.startX),
|
|
80
|
+
y: d.current.originY + (t.clientY - d.current.startY)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[x, b, l]
|
|
85
|
+
), z = i((t) => {
|
|
86
|
+
y.current.delete(t.pointerId), t.currentTarget.releasePointerCapture?.(t.pointerId), y.current.size < 2 && (I.current = null), y.current.size === 0 && (d.current = null, S(!1));
|
|
87
|
+
}, []), T = i(
|
|
88
|
+
(t) => {
|
|
89
|
+
if (!p) return;
|
|
90
|
+
t.preventDefault();
|
|
91
|
+
const e = b(t.clientX, t.clientY), r = t.ctrlKey ? Math.exp(-t.deltaY * 0.01) : t.deltaY < 0 ? 1 + s : 1 / (1 + s);
|
|
92
|
+
l(f.current.scale * r, e);
|
|
93
|
+
},
|
|
94
|
+
[p, s, b, l]
|
|
95
|
+
), D = i(
|
|
96
|
+
(t) => {
|
|
97
|
+
if (!h) return;
|
|
98
|
+
const e = b(t.clientX, t.clientY);
|
|
99
|
+
f.current.scale > 1 ? w() : l(j, e);
|
|
100
|
+
},
|
|
101
|
+
[h, b, w, l]
|
|
102
|
+
), L = i((t) => {
|
|
103
|
+
X.current = t;
|
|
104
|
+
}, []);
|
|
105
|
+
N(() => {
|
|
106
|
+
if (!g) return;
|
|
107
|
+
const t = document.body.style.userSelect;
|
|
108
|
+
return document.body.style.userSelect = "none", () => {
|
|
109
|
+
document.body.style.userSelect = t;
|
|
110
|
+
};
|
|
111
|
+
}, [g]);
|
|
112
|
+
const V = k(
|
|
113
|
+
() => ({
|
|
114
|
+
ref: L,
|
|
115
|
+
onWheel: T,
|
|
116
|
+
onPointerDown: B,
|
|
117
|
+
onPointerMove: E,
|
|
118
|
+
onPointerUp: z,
|
|
119
|
+
onPointerCancel: z,
|
|
120
|
+
onDoubleClick: D,
|
|
121
|
+
style: {
|
|
122
|
+
cursor: u.scale > 1 ? g ? "grabbing" : "grab" : "default",
|
|
123
|
+
touchAction: "none"
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
[L, T, B, E, z, D, u.scale, g]
|
|
127
|
+
), Z = k(
|
|
128
|
+
() => ({
|
|
129
|
+
transform: `translate(${u.x}px, ${u.y}px) scale(${u.scale})`,
|
|
130
|
+
transformOrigin: "0 0",
|
|
131
|
+
transition: g ? "none" : void 0
|
|
132
|
+
}),
|
|
133
|
+
[u.x, u.y, u.scale, g]
|
|
134
|
+
);
|
|
135
|
+
return { ...u, isPanning: g, stageProps: V, contentRef: H, contentStyle: Z, zoomIn: $, zoomOut: K, zoomTo: l, reset: w, fit: U };
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
q as clampState,
|
|
139
|
+
J as useZoomPan,
|
|
140
|
+
F as zoomAround
|
|
141
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export interface KbdClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
key: string;
|
|
5
|
+
separator: string;
|
|
6
|
+
}
|
|
7
|
+
export interface KbdProps extends ComponentPropsWithRef<'kbd'> {
|
|
8
|
+
/** Key cap size. @default 'md' */
|
|
9
|
+
size?: 'sm' | 'md';
|
|
10
|
+
/**
|
|
11
|
+
* Render a key combination: each entry becomes its own key cap, joined by a
|
|
12
|
+
* `+` separator (hidden from assistive tech). When set, `children` is ignored
|
|
13
|
+
* and the root `<kbd>` wraps the individual caps.
|
|
14
|
+
*/
|
|
15
|
+
keys?: string[];
|
|
16
|
+
/** Override class names on internal elements. */
|
|
17
|
+
classes?: Partial<KbdClasses>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Keyboard key cap for shortcut hints (menus, help dialogs, tooltips).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <Kbd>Esc</Kbd>
|
|
24
|
+
* <Kbd keys={['⌘', 'K']} />
|
|
25
|
+
*/
|
|
26
|
+
export declare const Kbd: import('react').ForwardRefExoticComponent<Omit<KbdProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h, Fragment as b } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import r from "./Kbd.module.scss.js";
|
|
5
|
+
const s = h(
|
|
6
|
+
({ size: d = "md", keys: m, classes: o, className: e, children: c, ...n }, p) => m && m.length > 0 ? /* @__PURE__ */ t(
|
|
7
|
+
"kbd",
|
|
8
|
+
{
|
|
9
|
+
ref: p,
|
|
10
|
+
className: a(r.group, r[d], o?.root, e),
|
|
11
|
+
...n,
|
|
12
|
+
children: m.map((i, l) => /* @__PURE__ */ f(b, { children: [
|
|
13
|
+
l > 0 && /* @__PURE__ */ t("span", { className: a(r.separator, o?.separator), "aria-hidden": "true", children: "+" }),
|
|
14
|
+
/* @__PURE__ */ t("kbd", { className: a(r.root, r.key, o?.key), children: i })
|
|
15
|
+
] }, `${i}-${l}`))
|
|
16
|
+
}
|
|
17
|
+
) : /* @__PURE__ */ t("kbd", { ref: p, className: a(r.root, r[d], o?.root, e), ...n, children: c })
|
|
18
|
+
);
|
|
19
|
+
s.displayName = "Kbd";
|
|
20
|
+
export {
|
|
21
|
+
s as Kbd
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const o = "crk-root-fy7QV", r = "crk-sm-IGdQk", s = "crk-md-OswkR", t = "crk-group-a1GSn", c = "crk-key--OflV", k = "crk-separator-bVh1E", a = {
|
|
2
|
+
root: o,
|
|
3
|
+
sm: r,
|
|
4
|
+
md: s,
|
|
5
|
+
group: t,
|
|
6
|
+
key: c,
|
|
7
|
+
separator: k
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
a as default,
|
|
11
|
+
t as group,
|
|
12
|
+
c as key,
|
|
13
|
+
s as md,
|
|
14
|
+
o as root,
|
|
15
|
+
k as separator,
|
|
16
|
+
r as sm
|
|
17
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type KeyValueListLayout = 'rows' | 'grid' | 'inline';
|
|
3
|
+
export interface KeyValueItem {
|
|
4
|
+
/** React key; falls back to the index. */
|
|
5
|
+
key?: string;
|
|
6
|
+
/** Term shown in the `<dt>`. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** Definition shown in the `<dd>`. */
|
|
9
|
+
value: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Add a copy button. `true` copies the text of a string/number `value`;
|
|
12
|
+
* pass a string to copy that exact text (e.g. the raw value behind a
|
|
13
|
+
* formatted one). @default false
|
|
14
|
+
*/
|
|
15
|
+
copyable?: boolean | string;
|
|
16
|
+
/** Monospace value (ids, hashes, paths). @default false */
|
|
17
|
+
mono?: boolean;
|
|
18
|
+
/** Hide the value behind `••••••` with a reveal toggle (secrets, tokens). @default false */
|
|
19
|
+
masked?: boolean;
|
|
20
|
+
/** Render the value as a link to this URL. */
|
|
21
|
+
href?: string;
|
|
22
|
+
/** Muted second line under the value. */
|
|
23
|
+
hint?: ReactNode;
|
|
24
|
+
/** Shown when `value` is `null`/`undefined`/`''`. Defaults to the list's `emptyValue`. */
|
|
25
|
+
empty?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export interface KeyValueListClasses {
|
|
28
|
+
root: string;
|
|
29
|
+
item: string;
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
hint: string;
|
|
33
|
+
actions: string;
|
|
34
|
+
copy: string;
|
|
35
|
+
reveal: string;
|
|
36
|
+
mono: string;
|
|
37
|
+
masked: string;
|
|
38
|
+
}
|
|
39
|
+
export interface KeyValueListProps extends Omit<ComponentPropsWithRef<'dl'>, 'children'> {
|
|
40
|
+
/** Label/value pairs, in order. */
|
|
41
|
+
items: KeyValueItem[];
|
|
42
|
+
/**
|
|
43
|
+
* `'rows'`: label column left, value right, one line per item.
|
|
44
|
+
* `'grid'`: label above value, `columns` per row.
|
|
45
|
+
* `'inline'`: label and value side by side, items flow and wrap (metadata strips).
|
|
46
|
+
* @default 'rows'
|
|
47
|
+
*/
|
|
48
|
+
layout?: KeyValueListLayout;
|
|
49
|
+
/** Columns for the `grid` layout. @default 2 */
|
|
50
|
+
columns?: number;
|
|
51
|
+
/** Label column width for the `rows` layout (number → px). Sets `--crk-kv-label-width`. @default '10rem' */
|
|
52
|
+
labelWidth?: number | string;
|
|
53
|
+
/** Text scale. @default 'md' */
|
|
54
|
+
size?: 'sm' | 'md';
|
|
55
|
+
/** Hairline between rows (`rows` layout only). @default true */
|
|
56
|
+
dividers?: boolean;
|
|
57
|
+
/** Fallback for empty values. @default '—' */
|
|
58
|
+
emptyValue?: ReactNode;
|
|
59
|
+
/** Accessible label for the copy buttons. @default 'Copy' */
|
|
60
|
+
copyLabel?: string;
|
|
61
|
+
/** Accessible labels for the masked-value toggle. @default { show: 'Show', hide: 'Hide' } */
|
|
62
|
+
revealLabels?: {
|
|
63
|
+
show: string;
|
|
64
|
+
hide: string;
|
|
65
|
+
};
|
|
66
|
+
/** Override class names on internal elements. */
|
|
67
|
+
classes?: Partial<KeyValueListClasses>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Label/value rows for detail panels (profiles, request headers, config,
|
|
71
|
+
* record summaries) as a semantic `<dl>`. Values can be copyable, masked
|
|
72
|
+
* (secrets), monospace, links, and carry a hint line.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* <KeyValueList
|
|
76
|
+
* items={[
|
|
77
|
+
* { label: 'ID', value: user.id, mono: true, copyable: true },
|
|
78
|
+
* { label: 'Email', value: user.email, href: `mailto:${user.email}` },
|
|
79
|
+
* { label: 'API key', value: key, masked: true, copyable: true },
|
|
80
|
+
* { label: 'Plan', value: null }, // renders "—"
|
|
81
|
+
* ]}
|
|
82
|
+
* />
|
|
83
|
+
*/
|
|
84
|
+
export declare const KeyValueList: import('react').ForwardRefExoticComponent<Omit<KeyValueListProps, "ref"> & import('react').RefAttributes<HTMLDListElement>>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as b, useState as w } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import n from "./KeyValueList.module.scss.js";
|
|
5
|
+
import { CopyButton as g } from "../ActionButton/CopyButton.js";
|
|
6
|
+
const M = (e) => e == null || e === "", C = (e) => typeof e == "number" ? `${e}px` : e;
|
|
7
|
+
function L(e) {
|
|
8
|
+
return typeof e.copyable == "string" ? e.copyable : e.copyable && (typeof e.value == "string" || typeof e.value == "number") ? String(e.value) : null;
|
|
9
|
+
}
|
|
10
|
+
function S({ item: e, emptyValue: d, copyLabel: p, revealLabels: u, classes: o }) {
|
|
11
|
+
const [i, f] = w(!1), t = M(e.value), c = t ? null : L(e), h = e.masked && !i;
|
|
12
|
+
let l;
|
|
13
|
+
t ? l = e.empty ?? d : h ? l = /* @__PURE__ */ r("span", { className: a(n.maskedText, o?.masked), "aria-hidden": "true", children: "••••••••" }) : e.href ? l = /* @__PURE__ */ r("a", { className: n.link, href: e.href, children: e.value }) : l = e.value;
|
|
14
|
+
const m = e.masked && !t || c !== null;
|
|
15
|
+
return /* @__PURE__ */ s("div", { className: a(n.item, o?.item), children: [
|
|
16
|
+
/* @__PURE__ */ r("dt", { className: a(n.label, o?.label), children: e.label }),
|
|
17
|
+
/* @__PURE__ */ s(
|
|
18
|
+
"dd",
|
|
19
|
+
{
|
|
20
|
+
className: a(
|
|
21
|
+
n.value,
|
|
22
|
+
e.mono && n.mono,
|
|
23
|
+
e.mono && o?.mono,
|
|
24
|
+
t && n.empty,
|
|
25
|
+
o?.value
|
|
26
|
+
),
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ s("span", { className: n.valueMain, children: [
|
|
29
|
+
/* @__PURE__ */ r("span", { className: n.valueText, children: l }),
|
|
30
|
+
m && /* @__PURE__ */ s("span", { className: a(n.actions, o?.actions), children: [
|
|
31
|
+
e.masked && !t && /* @__PURE__ */ r(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
className: a(n.reveal, o?.reveal),
|
|
36
|
+
"aria-label": i ? u.hide : u.show,
|
|
37
|
+
"aria-pressed": i,
|
|
38
|
+
onClick: () => f((y) => !y),
|
|
39
|
+
children: i ? /* @__PURE__ */ r(T, {}) : /* @__PURE__ */ r(j, {})
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
c !== null && /* @__PURE__ */ r(
|
|
43
|
+
g,
|
|
44
|
+
{
|
|
45
|
+
value: c,
|
|
46
|
+
iconOnly: !0,
|
|
47
|
+
size: "sm",
|
|
48
|
+
variant: "ghost",
|
|
49
|
+
"aria-label": p,
|
|
50
|
+
className: a(n.copy, o?.copy)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
54
|
+
] }),
|
|
55
|
+
e.hint && /* @__PURE__ */ r("span", { className: a(n.hint, o?.hint), children: e.hint })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
function j() {
|
|
62
|
+
return /* @__PURE__ */ s("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
63
|
+
/* @__PURE__ */ r("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z" }),
|
|
64
|
+
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "3" })
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
function T() {
|
|
68
|
+
return /* @__PURE__ */ s("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
69
|
+
/* @__PURE__ */ r("path", { d: "M17.9 17.9A10.4 10.4 0 0 1 12 19c-6.5 0-10-7-10-7a17.6 17.6 0 0 1 4.1-4.9" }),
|
|
70
|
+
/* @__PURE__ */ r("path", { d: "M9.9 5.2A10 10 0 0 1 12 5c6.5 0 10 7 10 7a17.6 17.6 0 0 1-2.2 3.2" }),
|
|
71
|
+
/* @__PURE__ */ r("path", { d: "M14.1 14.1a3 3 0 1 1-4.2-4.2" }),
|
|
72
|
+
/* @__PURE__ */ r("path", { d: "M2 2l20 20" })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
const A = b(
|
|
76
|
+
({
|
|
77
|
+
items: e,
|
|
78
|
+
layout: d = "rows",
|
|
79
|
+
columns: p = 2,
|
|
80
|
+
labelWidth: u = "10rem",
|
|
81
|
+
size: o = "md",
|
|
82
|
+
dividers: i = !0,
|
|
83
|
+
emptyValue: f = "—",
|
|
84
|
+
copyLabel: t = "Copy",
|
|
85
|
+
revealLabels: c = { show: "Show", hide: "Hide" },
|
|
86
|
+
classes: h,
|
|
87
|
+
className: l,
|
|
88
|
+
style: m,
|
|
89
|
+
...y
|
|
90
|
+
}, k) => {
|
|
91
|
+
const x = {
|
|
92
|
+
"--crk-kv-label-width": C(u),
|
|
93
|
+
"--crk-kv-columns": d === "grid" ? String(Math.max(1, p)) : void 0
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ r(
|
|
96
|
+
"dl",
|
|
97
|
+
{
|
|
98
|
+
ref: k,
|
|
99
|
+
className: a(
|
|
100
|
+
n.root,
|
|
101
|
+
n[d],
|
|
102
|
+
n[o],
|
|
103
|
+
d === "rows" && i && n.dividers,
|
|
104
|
+
h?.root,
|
|
105
|
+
l
|
|
106
|
+
),
|
|
107
|
+
style: { ...x, ...m },
|
|
108
|
+
...y,
|
|
109
|
+
children: e.map((v, N) => /* @__PURE__ */ r(
|
|
110
|
+
S,
|
|
111
|
+
{
|
|
112
|
+
item: v,
|
|
113
|
+
emptyValue: f,
|
|
114
|
+
copyLabel: t,
|
|
115
|
+
revealLabels: c,
|
|
116
|
+
classes: h
|
|
117
|
+
},
|
|
118
|
+
v.key ?? N
|
|
119
|
+
))
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
A.displayName = "KeyValueList";
|
|
125
|
+
export {
|
|
126
|
+
A as KeyValueList
|
|
127
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const t = "crk-root-ZWRNt", c = "crk-sm-YAGty", e = "crk-item-LWtHy", o = "crk-label-HPXVP", n = "crk-value-qw6-d", s = "crk-valueMain-9SLKj", r = "crk-valueText-Ek1fy", i = "crk-hint-EjrMh", k = "crk-empty-rVkBt", a = "crk-mono-XmBla", l = "crk-maskedText-SS7Sh", m = "crk-link-iUQMV", v = "crk-actions-w-Zks", d = "crk-reveal-kvrVt", u = "crk-copy-s4XLe", y = "crk-rows-CFgtm", p = "crk-dividers-Z3aBx", x = "crk-grid-b872O", w = "crk-inline-pBbIw", T = {
|
|
2
|
+
root: t,
|
|
3
|
+
sm: c,
|
|
4
|
+
item: e,
|
|
5
|
+
label: o,
|
|
6
|
+
value: n,
|
|
7
|
+
valueMain: s,
|
|
8
|
+
valueText: r,
|
|
9
|
+
hint: i,
|
|
10
|
+
empty: k,
|
|
11
|
+
mono: a,
|
|
12
|
+
maskedText: l,
|
|
13
|
+
link: m,
|
|
14
|
+
actions: v,
|
|
15
|
+
reveal: d,
|
|
16
|
+
copy: u,
|
|
17
|
+
rows: y,
|
|
18
|
+
dividers: p,
|
|
19
|
+
grid: x,
|
|
20
|
+
inline: w
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
v as actions,
|
|
24
|
+
u as copy,
|
|
25
|
+
T as default,
|
|
26
|
+
p as dividers,
|
|
27
|
+
k as empty,
|
|
28
|
+
x as grid,
|
|
29
|
+
i as hint,
|
|
30
|
+
w as inline,
|
|
31
|
+
e as item,
|
|
32
|
+
o as label,
|
|
33
|
+
m as link,
|
|
34
|
+
l as maskedText,
|
|
35
|
+
a as mono,
|
|
36
|
+
d as reveal,
|
|
37
|
+
t as root,
|
|
38
|
+
y as rows,
|
|
39
|
+
c as sm,
|
|
40
|
+
n as value,
|
|
41
|
+
s as valueMain,
|
|
42
|
+
r as valueText
|
|
43
|
+
};
|
|
@@ -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>>;
|