@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,186 @@
|
|
|
1
|
+
import { jsxs as V, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D, useRef as P, useLayoutEffect as Y, useEffect as _, useState as $ } from "react";
|
|
3
|
+
import { createPortal as q } from "react-dom";
|
|
4
|
+
import c from "clsx";
|
|
5
|
+
import t from "./Loader.module.scss.js";
|
|
6
|
+
const G = {
|
|
7
|
+
dots: 3,
|
|
8
|
+
pulse: 3,
|
|
9
|
+
spinner: 1,
|
|
10
|
+
grid: 9,
|
|
11
|
+
morph: 2
|
|
12
|
+
};
|
|
13
|
+
function I(l) {
|
|
14
|
+
const o = l.getBoundingClientRect();
|
|
15
|
+
let e = Math.max(o.top, 0), r = Math.min(o.bottom, window.innerHeight);
|
|
16
|
+
for (let n = l.parentElement; n && n !== document.body; n = n.parentElement) {
|
|
17
|
+
const u = getComputedStyle(n).overflowY;
|
|
18
|
+
if (u === "visible" || u === "") continue;
|
|
19
|
+
const v = n.getBoundingClientRect();
|
|
20
|
+
e = Math.max(e, v.top), r = Math.min(r, v.bottom);
|
|
21
|
+
}
|
|
22
|
+
return { top: e, bottom: r };
|
|
23
|
+
}
|
|
24
|
+
function z(l, o) {
|
|
25
|
+
Y(() => {
|
|
26
|
+
const e = l.current;
|
|
27
|
+
if (!o || !e) return;
|
|
28
|
+
let r = 0;
|
|
29
|
+
const n = () => {
|
|
30
|
+
r = 0;
|
|
31
|
+
const f = e.getBoundingClientRect(), b = e.firstElementChild, { top: h, bottom: g } = I(e);
|
|
32
|
+
let d = 0;
|
|
33
|
+
if (g > h && f.height > 0) {
|
|
34
|
+
d = (h + g) / 2 - (f.top + f.bottom) / 2;
|
|
35
|
+
const i = Math.max(0, f.height / 2 - (b?.offsetHeight ?? 0) / 2 - 8);
|
|
36
|
+
d = Math.max(-i, Math.min(i, d));
|
|
37
|
+
}
|
|
38
|
+
e.style.setProperty("--_shift-y", `${Math.round(d)}px`);
|
|
39
|
+
}, u = () => {
|
|
40
|
+
r || (r = requestAnimationFrame(n));
|
|
41
|
+
};
|
|
42
|
+
n(), window.addEventListener("scroll", u, { capture: !0, passive: !0 }), window.addEventListener("resize", u);
|
|
43
|
+
const v = new ResizeObserver(u);
|
|
44
|
+
return v.observe(e), () => {
|
|
45
|
+
r && cancelAnimationFrame(r), window.removeEventListener("scroll", u, { capture: !0 }), window.removeEventListener("resize", u), v.disconnect();
|
|
46
|
+
};
|
|
47
|
+
}, [l, o]);
|
|
48
|
+
}
|
|
49
|
+
function J(l, o) {
|
|
50
|
+
const [e, r] = $(l && o <= 0);
|
|
51
|
+
return _(() => {
|
|
52
|
+
if (!l) {
|
|
53
|
+
r(!1);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (o <= 0) {
|
|
57
|
+
r(!0);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const n = setTimeout(() => r(!0), o);
|
|
61
|
+
return () => clearTimeout(n);
|
|
62
|
+
}, [l, o]), l && e;
|
|
63
|
+
}
|
|
64
|
+
const K = D(
|
|
65
|
+
({
|
|
66
|
+
variant: l = "dots",
|
|
67
|
+
size: o = "md",
|
|
68
|
+
mode: e = "inline",
|
|
69
|
+
loading: r = !0,
|
|
70
|
+
children: n,
|
|
71
|
+
delay: u = 0,
|
|
72
|
+
backdrop: v = "dim",
|
|
73
|
+
interactive: f = !1,
|
|
74
|
+
color: b,
|
|
75
|
+
label: h = "Loading",
|
|
76
|
+
showLabel: g = !1,
|
|
77
|
+
minHeight: d,
|
|
78
|
+
classes: i,
|
|
79
|
+
className: w,
|
|
80
|
+
style: x,
|
|
81
|
+
...E
|
|
82
|
+
}, L) => {
|
|
83
|
+
const a = J(r, u), p = n != null, N = P(null), S = P(null), k = P(null), R = (s) => {
|
|
84
|
+
N.current = s, typeof L == "function" ? L(s) : L && (L.current = s);
|
|
85
|
+
}, H = !p && e === "overlay" && a;
|
|
86
|
+
Y(() => {
|
|
87
|
+
if (!H) return;
|
|
88
|
+
const s = N.current?.parentElement;
|
|
89
|
+
if (!s) return;
|
|
90
|
+
const M = s.getAttribute("aria-busy");
|
|
91
|
+
s.setAttribute("aria-busy", "true");
|
|
92
|
+
const F = getComputedStyle(s).position, O = F === "static" || F === "", j = s.style.position;
|
|
93
|
+
return O && (s.style.position = "relative"), () => {
|
|
94
|
+
O && (s.style.position = j), M === null ? s.removeAttribute("aria-busy") : s.setAttribute("aria-busy", M);
|
|
95
|
+
};
|
|
96
|
+
}, [H]), z(p ? k : N, a && e !== "fullscreen" && (p || e === "overlay")), _(() => {
|
|
97
|
+
S.current?.toggleAttribute("inert", a && !f);
|
|
98
|
+
}, [a, f]);
|
|
99
|
+
const y = b ? { "--crk-loader-color": b } : void 0, A = typeof d == "number" ? `${d}px` : d, C = /* @__PURE__ */ V(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
role: "status",
|
|
103
|
+
"aria-live": "polite",
|
|
104
|
+
className: c(t.indicator, i?.indicator),
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ m("span", { className: c(t.glyph, t[l], i?.glyph), "aria-hidden": "true", children: Array.from({ length: G[l] }, (s, M) => /* @__PURE__ */ m("span", {}, M)) }),
|
|
107
|
+
h ? /* @__PURE__ */ m("span", { className: c(g ? t.label : t.srLabel, i?.label), children: h }) : null
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
), B = {
|
|
111
|
+
dim: t.backdropDim,
|
|
112
|
+
blur: t.backdropBlur,
|
|
113
|
+
none: void 0
|
|
114
|
+
}[v], T = a && e === "fullscreen" && typeof document < "u" ? q(
|
|
115
|
+
/* @__PURE__ */ m(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: p ? void 0 : R,
|
|
119
|
+
className: c(
|
|
120
|
+
// Portaled out of the wrapper, so it carries the tokens itself.
|
|
121
|
+
t.root,
|
|
122
|
+
t[o],
|
|
123
|
+
t.overlay,
|
|
124
|
+
t.fullscreen,
|
|
125
|
+
B,
|
|
126
|
+
i?.overlay,
|
|
127
|
+
!p && [i?.root, w]
|
|
128
|
+
),
|
|
129
|
+
style: p ? y : { ...y, ...x },
|
|
130
|
+
...p ? {} : E,
|
|
131
|
+
children: C
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
document.body
|
|
135
|
+
) : null;
|
|
136
|
+
return p ? /* @__PURE__ */ V(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
ref: R,
|
|
140
|
+
className: c(t.root, t[o], t.wrap, a && t.wrapBusy, i?.root, w),
|
|
141
|
+
style: { ...y, ...a && A ? { minHeight: A } : null, ...x },
|
|
142
|
+
"aria-busy": r || void 0,
|
|
143
|
+
...E,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ m("div", { ref: S, className: c(t.content, i?.content), children: n }),
|
|
146
|
+
a && e !== "fullscreen" && /* @__PURE__ */ m(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: k,
|
|
150
|
+
className: c(
|
|
151
|
+
t.overlay,
|
|
152
|
+
B,
|
|
153
|
+
f && t.passThrough,
|
|
154
|
+
i?.overlay
|
|
155
|
+
),
|
|
156
|
+
children: C
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
T
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
) : a ? e === "fullscreen" ? T : e === "overlay" ? /* @__PURE__ */ m(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
ref: R,
|
|
166
|
+
className: c(t.root, t[o], t.overlay, B, i?.root, i?.overlay, w),
|
|
167
|
+
style: { ...y, ...x },
|
|
168
|
+
...E,
|
|
169
|
+
children: C
|
|
170
|
+
}
|
|
171
|
+
) : /* @__PURE__ */ m(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
ref: R,
|
|
175
|
+
className: c(t.root, t[o], t.inline, i?.root, w),
|
|
176
|
+
style: { ...y, ...A ? { minHeight: A } : null, ...x },
|
|
177
|
+
...E,
|
|
178
|
+
children: C
|
|
179
|
+
}
|
|
180
|
+
) : null;
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
K.displayName = "Loader";
|
|
184
|
+
export {
|
|
185
|
+
K as Loader
|
|
186
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const r = "crk-root-u1D7u", o = "crk-sm-M6Sb3", c = "crk-md-5c9sz", e = "crk-lg-PaoKK", t = "crk-inline-neVjU", a = "crk-wrap-BaBNd", k = "crk-wrapBusy-a4D7Z", l = "crk-content-bw8zV", n = "crk-overlay-B-AIp", s = "crk-crk-loader-enter-VxXmo", d = "crk-indicator-LqmYc", p = "crk-fullscreen-BXAhh", h = "crk-backdropDim-JqArB", u = "crk-backdropBlur-wV2vo", i = "crk-passThrough-NCa9b", b = "crk-glyph-L8nf5", L = "crk-label-yMjMY", m = "crk-srLabel-PDGoC", B = "crk-dots-KfhUo", g = "crk-pulse-wPxve", y = "crk-crk-loader-dot-bounce-NtrLY", D = "crk-crk-loader-dot-pulse-AolCU", w = "crk-spinner-xG6h2", C = "crk-crk-loader-rotate-yVTPr", A = "crk-grid-5nFwV", V = "crk-crk-loader-cell-A7li4", v = "crk-morph-DAgji", x = "crk-crk-loader-morph-1hxzv", P = "crk-crk-loader-breathe-RCpGC", f = {
|
|
2
|
+
root: r,
|
|
3
|
+
sm: o,
|
|
4
|
+
md: c,
|
|
5
|
+
lg: e,
|
|
6
|
+
inline: t,
|
|
7
|
+
wrap: a,
|
|
8
|
+
wrapBusy: k,
|
|
9
|
+
content: l,
|
|
10
|
+
overlay: n,
|
|
11
|
+
"crk-loader-enter": "crk-crk-loader-enter-VxXmo",
|
|
12
|
+
crkLoaderEnter: s,
|
|
13
|
+
indicator: d,
|
|
14
|
+
fullscreen: p,
|
|
15
|
+
backdropDim: h,
|
|
16
|
+
backdropBlur: u,
|
|
17
|
+
passThrough: i,
|
|
18
|
+
glyph: b,
|
|
19
|
+
label: L,
|
|
20
|
+
srLabel: m,
|
|
21
|
+
dots: B,
|
|
22
|
+
pulse: g,
|
|
23
|
+
"crk-loader-dot-bounce": "crk-crk-loader-dot-bounce-NtrLY",
|
|
24
|
+
crkLoaderDotBounce: y,
|
|
25
|
+
"crk-loader-dot-pulse": "crk-crk-loader-dot-pulse-AolCU",
|
|
26
|
+
crkLoaderDotPulse: D,
|
|
27
|
+
spinner: w,
|
|
28
|
+
"crk-loader-rotate": "crk-crk-loader-rotate-yVTPr",
|
|
29
|
+
crkLoaderRotate: C,
|
|
30
|
+
grid: A,
|
|
31
|
+
"crk-loader-cell": "crk-crk-loader-cell-A7li4",
|
|
32
|
+
crkLoaderCell: V,
|
|
33
|
+
morph: v,
|
|
34
|
+
"crk-loader-morph": "crk-crk-loader-morph-1hxzv",
|
|
35
|
+
crkLoaderMorph: x,
|
|
36
|
+
"crk-loader-breathe": "crk-crk-loader-breathe-RCpGC",
|
|
37
|
+
crkLoaderBreathe: P
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
u as backdropBlur,
|
|
41
|
+
h as backdropDim,
|
|
42
|
+
l as content,
|
|
43
|
+
P as crkLoaderBreathe,
|
|
44
|
+
V as crkLoaderCell,
|
|
45
|
+
y as crkLoaderDotBounce,
|
|
46
|
+
D as crkLoaderDotPulse,
|
|
47
|
+
s as crkLoaderEnter,
|
|
48
|
+
x as crkLoaderMorph,
|
|
49
|
+
C as crkLoaderRotate,
|
|
50
|
+
f as default,
|
|
51
|
+
B as dots,
|
|
52
|
+
p as fullscreen,
|
|
53
|
+
b as glyph,
|
|
54
|
+
A as grid,
|
|
55
|
+
d as indicator,
|
|
56
|
+
t as inline,
|
|
57
|
+
L as label,
|
|
58
|
+
e as lg,
|
|
59
|
+
c as md,
|
|
60
|
+
v as morph,
|
|
61
|
+
n as overlay,
|
|
62
|
+
i as passThrough,
|
|
63
|
+
g as pulse,
|
|
64
|
+
r as root,
|
|
65
|
+
o as sm,
|
|
66
|
+
w as spinner,
|
|
67
|
+
m as srLabel,
|
|
68
|
+
a as wrap,
|
|
69
|
+
k as wrapBusy
|
|
70
|
+
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as H, useRef as
|
|
1
|
+
import { jsx as s, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H, useRef as v, useId as P, useEffect as j, createContext as D, useContext as p } from "react";
|
|
3
3
|
import { createPortal as L } from "react-dom";
|
|
4
4
|
import d from "clsx";
|
|
5
5
|
import { useFocusTrap as O } from "../../hooks/useFocusTrap.js";
|
|
6
6
|
import { useEscapeLayer as U, EscapeLayerProvider as S } from "../../hooks/useEscapeLayer.js";
|
|
7
|
-
import
|
|
8
|
-
const u = D({ classes: {}, titleId: "" }),
|
|
9
|
-
const { classes:
|
|
7
|
+
import t from "./Modal.module.scss.js";
|
|
8
|
+
const u = D({ classes: {}, titleId: "" }), N = ({ children: e, className: a, style: l, onClose: r }) => {
|
|
9
|
+
const { classes: c, titleId: i } = p(u);
|
|
10
10
|
return /* @__PURE__ */ E(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
style: s,
|
|
13
|
+
className: d(t.header, r && t.headerWithClose, c.header, a),
|
|
14
|
+
style: l,
|
|
16
15
|
children: [
|
|
17
|
-
e,
|
|
18
|
-
r && /* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ s("div", { id: i, className: d(t.headerTitle, c.headerTitle), children: e }),
|
|
17
|
+
r && /* @__PURE__ */ s(
|
|
19
18
|
"button",
|
|
20
19
|
{
|
|
21
20
|
type: "button",
|
|
22
|
-
className: d(
|
|
21
|
+
className: d(t.closeButton, c.closeButton),
|
|
23
22
|
onClick: r,
|
|
24
23
|
"aria-label": "Close",
|
|
25
24
|
children: "×"
|
|
@@ -29,37 +28,37 @@ const u = D({ classes: {}, titleId: "" }), M = ({ children: e, className: t, sty
|
|
|
29
28
|
}
|
|
30
29
|
);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
|
-
const
|
|
31
|
+
N.displayName = "Modal.Header";
|
|
32
|
+
const M = ({ children: e, className: a, style: l }) => {
|
|
34
33
|
const { classes: r } = p(u);
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ s("div", { className: d(t.body, r.body, a), style: l, children: e });
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
const B = ({ children: e, className:
|
|
36
|
+
M.displayName = "Modal.Body";
|
|
37
|
+
const B = ({ children: e, className: a, style: l }) => {
|
|
39
38
|
const { classes: r } = p(u);
|
|
40
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ s("div", { className: d(t.footer, r.footer, a), style: l, children: e });
|
|
41
40
|
};
|
|
42
41
|
B.displayName = "Modal.Footer";
|
|
43
42
|
const m = H(
|
|
44
43
|
({
|
|
45
44
|
open: e,
|
|
46
|
-
onClose:
|
|
47
|
-
closeOnBackdrop:
|
|
45
|
+
onClose: a,
|
|
46
|
+
closeOnBackdrop: l = !0,
|
|
48
47
|
closeOnEscape: r = !0,
|
|
49
|
-
size:
|
|
50
|
-
classes:
|
|
48
|
+
size: c = "md",
|
|
49
|
+
classes: i,
|
|
51
50
|
className: w,
|
|
52
51
|
style: x,
|
|
53
52
|
children: k,
|
|
54
53
|
"aria-label": y,
|
|
55
54
|
"aria-labelledby": C
|
|
56
|
-
},
|
|
57
|
-
const b =
|
|
58
|
-
b.current = o, typeof
|
|
59
|
-
},
|
|
55
|
+
}, n) => {
|
|
56
|
+
const b = v(null), T = (o) => {
|
|
57
|
+
b.current = o, typeof n == "function" ? n(o) : n && (n.current = o);
|
|
58
|
+
}, g = P(), h = C ?? `${g}-title`;
|
|
60
59
|
O(b, e);
|
|
61
|
-
const
|
|
62
|
-
r &&
|
|
60
|
+
const I = U(() => {
|
|
61
|
+
r && a();
|
|
63
62
|
}, e);
|
|
64
63
|
j(() => {
|
|
65
64
|
if (!e) return;
|
|
@@ -68,30 +67,30 @@ const m = H(
|
|
|
68
67
|
document.body.style.overflow = o;
|
|
69
68
|
};
|
|
70
69
|
}, [e]);
|
|
71
|
-
const f =
|
|
70
|
+
const f = v(!1), F = (o) => {
|
|
72
71
|
f.current = o.target === o.currentTarget;
|
|
73
|
-
},
|
|
74
|
-
|
|
72
|
+
}, R = (o) => {
|
|
73
|
+
l && f.current && o.target === o.currentTarget && a(), f.current = !1;
|
|
75
74
|
};
|
|
76
75
|
return e ? L(
|
|
77
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ s(
|
|
78
77
|
"div",
|
|
79
78
|
{
|
|
80
|
-
className: d(
|
|
81
|
-
onMouseDown:
|
|
82
|
-
onMouseUp:
|
|
79
|
+
className: d(t.backdrop, i?.backdrop),
|
|
80
|
+
onMouseDown: F,
|
|
81
|
+
onMouseUp: R,
|
|
83
82
|
role: "presentation",
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ s(
|
|
85
84
|
"div",
|
|
86
85
|
{
|
|
87
|
-
ref:
|
|
88
|
-
className: d(
|
|
86
|
+
ref: T,
|
|
87
|
+
className: d(t.modal, t[c], i?.modal, w),
|
|
89
88
|
style: x,
|
|
90
89
|
role: "dialog",
|
|
91
90
|
"aria-modal": "true",
|
|
92
91
|
"aria-label": y,
|
|
93
|
-
"aria-labelledby": y ? void 0 :
|
|
94
|
-
children: /* @__PURE__ */
|
|
92
|
+
"aria-labelledby": y ? void 0 : h,
|
|
93
|
+
children: /* @__PURE__ */ s(u.Provider, { value: { classes: i ?? {}, titleId: h }, children: /* @__PURE__ */ s(S, { value: I, children: k }) })
|
|
95
94
|
}
|
|
96
95
|
)
|
|
97
96
|
}
|
|
@@ -101,8 +100,8 @@ const m = H(
|
|
|
101
100
|
}
|
|
102
101
|
);
|
|
103
102
|
m.displayName = "Modal";
|
|
104
|
-
m.Header =
|
|
105
|
-
m.Body =
|
|
103
|
+
m.Header = N;
|
|
104
|
+
m.Body = M;
|
|
106
105
|
m.Footer = B;
|
|
107
106
|
export {
|
|
108
107
|
m as Modal
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A",
|
|
1
|
+
const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A", e = "crk-modal-yNG-7", r = "crk-modalIn-xFUwm", t = "crk-sm--xyY9", s = "crk-md-ETTfh", d = "crk-lg-5DBb7", n = "crk-fullscreen-b4jQ-", l = "crk-header-NS30G", a = "crk-headerTitle-tJ2Qv", k = "crk-headerWithClose-4davm", m = "crk-closeButton-JX-aq", h = "crk-body-3zIj9", b = "crk-footer-Oyz-R", f = {
|
|
2
2
|
backdrop: o,
|
|
3
3
|
backdropIn: c,
|
|
4
|
-
modal:
|
|
5
|
-
modalIn:
|
|
6
|
-
sm:
|
|
7
|
-
md:
|
|
4
|
+
modal: e,
|
|
5
|
+
modalIn: r,
|
|
6
|
+
sm: t,
|
|
7
|
+
md: s,
|
|
8
8
|
lg: d,
|
|
9
9
|
fullscreen: n,
|
|
10
10
|
header: l,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
headerTitle: a,
|
|
12
|
+
headerWithClose: k,
|
|
13
|
+
closeButton: m,
|
|
14
|
+
body: h,
|
|
14
15
|
footer: b
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
18
|
o as backdrop,
|
|
18
19
|
c as backdropIn,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
h as body,
|
|
21
|
+
m as closeButton,
|
|
22
|
+
f as default,
|
|
22
23
|
b as footer,
|
|
23
24
|
n as fullscreen,
|
|
24
25
|
l as header,
|
|
25
|
-
a as
|
|
26
|
+
a as headerTitle,
|
|
27
|
+
k as headerWithClose,
|
|
26
28
|
d as lg,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
s as md,
|
|
30
|
+
e as modal,
|
|
31
|
+
r as modalIn,
|
|
32
|
+
t as sm
|
|
31
33
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface PageHeaderClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
breadcrumbs: string;
|
|
5
|
+
back: string;
|
|
6
|
+
titleRow: string;
|
|
7
|
+
title: string;
|
|
8
|
+
badge: string;
|
|
9
|
+
subtitle: string;
|
|
10
|
+
description: string;
|
|
11
|
+
meta: string;
|
|
12
|
+
actions: string;
|
|
13
|
+
tabs: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PageHeaderProps extends Omit<ComponentPropsWithRef<'header'>, 'title'> {
|
|
16
|
+
/** Page title. */
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
/** Element used for the title. @default 'h1' */
|
|
19
|
+
as?: 'h1' | 'h2' | 'h3' | 'div';
|
|
20
|
+
/** Muted line under the title. */
|
|
21
|
+
subtitle?: ReactNode;
|
|
22
|
+
/** Longer paragraph under the subtitle (text-secondary, max-width 70ch). */
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
/** Right-aligned slot for buttons; wraps under the title on narrow widths. */
|
|
25
|
+
actions?: ReactNode;
|
|
26
|
+
/** Slot above the title — pass a `<Breadcrumbs>`. */
|
|
27
|
+
breadcrumbs?: ReactNode;
|
|
28
|
+
/** Renders a "← Back" link before the title block. */
|
|
29
|
+
backHref?: string;
|
|
30
|
+
/** Renders a "← Back" button before the title block (ignored when `backHref` is set). */
|
|
31
|
+
onBack?: () => void;
|
|
32
|
+
/** Text of the back link/button. @default 'Back' */
|
|
33
|
+
backLabel?: string;
|
|
34
|
+
/** Inline slot after the title (a `<Badge>` or `<StatusDot>`). */
|
|
35
|
+
badge?: ReactNode;
|
|
36
|
+
/** Row of small muted metadata under the title ("Updated 3 min ago · 12 members"). */
|
|
37
|
+
meta?: ReactNode;
|
|
38
|
+
/** Slot at the bottom, flush with the bottom border — for a `<Tabs.List>`. */
|
|
39
|
+
tabs?: ReactNode;
|
|
40
|
+
/** Bottom hairline. @default true */
|
|
41
|
+
divider?: boolean;
|
|
42
|
+
/** Title size: xl / 2xl / 3xl. @default 'md' */
|
|
43
|
+
size?: 'sm' | 'md' | 'lg';
|
|
44
|
+
/** Stick to the top of the scroll container. @default false */
|
|
45
|
+
sticky?: boolean;
|
|
46
|
+
/** Override class names on internal elements. */
|
|
47
|
+
classes?: Partial<PageHeaderClasses>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Top-of-page header: breadcrumbs, back link, title with badge, subtitle,
|
|
51
|
+
* description, metadata row, right-aligned actions and an optional tab strip.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* <PageHeader
|
|
55
|
+
* title="Projects"
|
|
56
|
+
* subtitle="Everything your team is working on"
|
|
57
|
+
* actions={<Button>New project</Button>}
|
|
58
|
+
* breadcrumbs={<Breadcrumbs>…</Breadcrumbs>}
|
|
59
|
+
* />
|
|
60
|
+
*/
|
|
61
|
+
export declare const PageHeader: import('react').ForwardRefExoticComponent<Omit<PageHeaderProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as R, createElement as C } from "react";
|
|
3
|
+
import r from "clsx";
|
|
4
|
+
import e from "./PageHeader.module.scss.js";
|
|
5
|
+
const k = /* @__PURE__ */ t("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", width: "1em", height: "1em", children: /* @__PURE__ */ t("path", { d: "M12 4l-6 6 6 6", strokeLinecap: "round", strokeLinejoin: "round" }) }), L = R(
|
|
6
|
+
({
|
|
7
|
+
title: u,
|
|
8
|
+
as: v = "h1",
|
|
9
|
+
subtitle: o,
|
|
10
|
+
description: l,
|
|
11
|
+
actions: n,
|
|
12
|
+
breadcrumbs: c,
|
|
13
|
+
backHref: m,
|
|
14
|
+
onBack: h,
|
|
15
|
+
backLabel: s = "Back",
|
|
16
|
+
badge: N,
|
|
17
|
+
meta: p,
|
|
18
|
+
tabs: d,
|
|
19
|
+
divider: b = !0,
|
|
20
|
+
size: f = "md",
|
|
21
|
+
sticky: w = !1,
|
|
22
|
+
classes: i,
|
|
23
|
+
className: g,
|
|
24
|
+
children: x,
|
|
25
|
+
...y
|
|
26
|
+
}, j) => {
|
|
27
|
+
const B = m !== void 0 ? /* @__PURE__ */ a("a", { href: m, className: r(e.back, i?.back), children: [
|
|
28
|
+
k,
|
|
29
|
+
s
|
|
30
|
+
] }) : h ? /* @__PURE__ */ a("button", { type: "button", onClick: h, className: r(e.back, i?.back), children: [
|
|
31
|
+
k,
|
|
32
|
+
s
|
|
33
|
+
] }) : null;
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
|
+
"header",
|
|
36
|
+
{
|
|
37
|
+
ref: j,
|
|
38
|
+
className: r(
|
|
39
|
+
e.root,
|
|
40
|
+
e[f],
|
|
41
|
+
b && e.divider,
|
|
42
|
+
w && e.sticky,
|
|
43
|
+
d && e.hasTabs,
|
|
44
|
+
i?.root,
|
|
45
|
+
g
|
|
46
|
+
),
|
|
47
|
+
...y,
|
|
48
|
+
children: [
|
|
49
|
+
c && /* @__PURE__ */ t("div", { className: r(e.breadcrumbs, i?.breadcrumbs), children: c }),
|
|
50
|
+
B,
|
|
51
|
+
/* @__PURE__ */ a("div", { className: r(e.titleRow, i?.titleRow), children: [
|
|
52
|
+
/* @__PURE__ */ a("div", { className: e.titleBlock, children: [
|
|
53
|
+
/* @__PURE__ */ a("div", { className: e.titleLine, children: [
|
|
54
|
+
C(v, { className: r(e.title, i?.title) }, u),
|
|
55
|
+
N && /* @__PURE__ */ t("span", { className: r(e.badge, i?.badge), children: N })
|
|
56
|
+
] }),
|
|
57
|
+
o && /* @__PURE__ */ t("p", { className: r(e.subtitle, i?.subtitle), children: o }),
|
|
58
|
+
l && /* @__PURE__ */ t("p", { className: r(e.description, i?.description), children: l }),
|
|
59
|
+
p && /* @__PURE__ */ t("div", { className: r(e.meta, i?.meta), children: p })
|
|
60
|
+
] }),
|
|
61
|
+
n && /* @__PURE__ */ t("div", { className: r(e.actions, i?.actions), children: n })
|
|
62
|
+
] }),
|
|
63
|
+
x,
|
|
64
|
+
d && /* @__PURE__ */ t("div", { className: r(e.tabs, i?.tabs), children: d })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
L.displayName = "PageHeader";
|
|
71
|
+
export {
|
|
72
|
+
L as PageHeader
|
|
73
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const t = "crk-root-K-SAd", c = "crk-sm-XJoTL", s = "crk-md-obtrZ", o = "crk-lg--8FAx", e = "crk-divider-q-A5e", i = "crk-hasTabs-YLYqx", r = "crk-sticky-e3pQP", n = "crk-breadcrumbs-rTXxK", k = "crk-back-R4Oq3", a = "crk-titleRow-4-MEi", l = "crk-titleBlock-37A6l", b = "crk-titleLine-oWB7d", d = "crk-title-1nY9v", m = "crk-badge-Uesjc", u = "crk-subtitle-BREZj", g = "crk-description--PNl0", T = "crk-meta-fkWcX", p = "crk-actions-EYOW1", B = "crk-tabs-qDTiN", L = {
|
|
2
|
+
root: t,
|
|
3
|
+
sm: c,
|
|
4
|
+
md: s,
|
|
5
|
+
lg: o,
|
|
6
|
+
divider: e,
|
|
7
|
+
hasTabs: i,
|
|
8
|
+
sticky: r,
|
|
9
|
+
breadcrumbs: n,
|
|
10
|
+
back: k,
|
|
11
|
+
titleRow: a,
|
|
12
|
+
titleBlock: l,
|
|
13
|
+
titleLine: b,
|
|
14
|
+
title: d,
|
|
15
|
+
badge: m,
|
|
16
|
+
subtitle: u,
|
|
17
|
+
description: g,
|
|
18
|
+
meta: T,
|
|
19
|
+
actions: p,
|
|
20
|
+
tabs: B
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
p as actions,
|
|
24
|
+
k as back,
|
|
25
|
+
m as badge,
|
|
26
|
+
n as breadcrumbs,
|
|
27
|
+
L as default,
|
|
28
|
+
g as description,
|
|
29
|
+
e as divider,
|
|
30
|
+
i as hasTabs,
|
|
31
|
+
o as lg,
|
|
32
|
+
s as md,
|
|
33
|
+
T as meta,
|
|
34
|
+
t as root,
|
|
35
|
+
c as sm,
|
|
36
|
+
r as sticky,
|
|
37
|
+
u as subtitle,
|
|
38
|
+
B as tabs,
|
|
39
|
+
d as title,
|
|
40
|
+
l as titleBlock,
|
|
41
|
+
b as titleLine,
|
|
42
|
+
a as titleRow
|
|
43
|
+
};
|