@overdoser/react-toolkit 0.7.0 → 0.8.1
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/CHANGELOG.md +32 -0
- package/components/ActionButton/ActionButton.js +211 -0
- package/components/ActionButton/ActionButton.module.scss.js +47 -0
- package/components/ActionButton/CopyButton.js +66 -0
- package/components/Alert/Alert.js +82 -0
- package/components/Alert/Alert.module.scss.js +25 -0
- package/components/Avatar/Avatar.js +57 -0
- package/components/Avatar/Avatar.module.scss.js +43 -0
- package/components/Badge/Badge.js +38 -0
- package/components/Badge/Badge.module.scss.js +31 -0
- package/components/Breadcrumbs/Breadcrumbs.js +49 -0
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +17 -0
- package/components/Button/Button.js +57 -0
- package/components/Button/Button.module.scss.js +47 -0
- package/components/Chart/AreaChart.js +244 -0
- package/components/Chart/Axis.js +45 -0
- package/components/Chart/BarChart.js +353 -0
- package/components/Chart/Chart.module.scss.js +61 -0
- package/components/Chart/ChartContainer.js +41 -0
- package/components/Chart/ChartLegend.js +31 -0
- package/components/Chart/ChartTooltip.js +42 -0
- package/components/Chart/LineChart.js +236 -0
- package/components/Chart/PieChart.js +248 -0
- package/components/Chart/RadarChart.js +221 -0
- package/components/Chart/Sparkline.js +69 -0
- package/components/Chart/TradingChart.js +732 -0
- package/components/Chart/scales.js +39 -0
- package/components/Chart/trading/indicators.js +68 -0
- package/components/Chart/trading/period.js +71 -0
- package/components/Chart/useChartDimensions.js +23 -0
- package/components/Divider/Divider.js +36 -0
- package/components/Divider/Divider.module.scss.js +31 -0
- package/components/Draggable/Draggable.js +155 -0
- package/components/Draggable/Draggable.module.scss.js +17 -0
- package/components/Drawer/Drawer.js +126 -0
- package/components/Drawer/Drawer.module.scss.js +117 -0
- package/components/Dropdown/Dropdown.js +142 -0
- package/components/Dropdown/Dropdown.module.scss.js +35 -0
- package/components/Dropdown/DropdownItem.js +31 -0
- package/components/Dropzone/Dropzone.js +107 -0
- package/components/Dropzone/Dropzone.module.scss.js +21 -0
- package/components/Form/Form.js +36 -0
- package/components/Form/Form.module.scss.js +29 -0
- package/components/Form/FormField.js +76 -0
- package/components/Form/FormRow.js +9 -0
- package/components/Form/formFieldDefaults.js +5 -0
- package/components/Link/Link.js +59 -0
- package/components/Link/Link.module.scss.js +16 -0
- package/components/List/List.js +46 -0
- package/components/List/List.module.scss.js +21 -0
- package/components/Modal/Modal.js +114 -0
- package/components/Modal/Modal.module.scss.js +31 -0
- package/components/Pagination/Pagination.js +84 -0
- package/components/Pagination/Pagination.module.scss.js +23 -0
- package/components/Pagination/paginationRange.js +24 -0
- package/components/Popover/Popover.js +138 -0
- package/components/Popover/Popover.module.scss.js +21 -0
- package/components/Skeleton/Skeleton.js +50 -0
- package/components/Skeleton/Skeleton.module.scss.js +25 -0
- package/components/Spinner/Spinner.js +25 -0
- package/components/Spinner/Spinner.module.scss.js +20 -0
- package/components/Table/Table.js +284 -0
- package/components/Table/Table.module.scss.js +59 -0
- package/components/Table/useTableSort.js +44 -0
- package/components/Tabs/Tabs.js +163 -0
- package/components/Tabs/Tabs.module.scss.js +53 -0
- package/components/Timer/Timer.js +159 -0
- package/components/Timer/Timer.module.scss.js +55 -0
- package/components/Toast/Toast.js +133 -0
- package/components/Toast/Toast.module.scss.js +62 -0
- package/components/Toast/toastStore.js +62 -0
- package/components/ToggleIconButton/ToggleIconButton.js +58 -0
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +27 -0
- package/components/Tooltip/Tooltip.js +86 -0
- package/components/Tooltip/Tooltip.module.scss.js +30 -0
- package/components/Typography/Typography.js +37 -0
- package/components/Typography/Typography.module.scss.js +53 -0
- package/components/inputs/Checkbox/Checkbox.js +50 -0
- package/components/inputs/Checkbox/Checkbox.module.scss.js +15 -0
- package/components/inputs/Checkbox/CheckboxGroup.js +111 -0
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +31 -0
- package/components/inputs/DatePicker/DatePicker.js +229 -0
- package/components/inputs/DatePicker/DatePicker.module.scss.js +45 -0
- package/components/inputs/DatePicker/dateUtils.js +41 -0
- package/components/inputs/Input/Input.js +50 -0
- package/components/inputs/Input/Input.module.scss.js +25 -0
- package/components/inputs/NumberInput/NumberInput.js +134 -0
- package/components/inputs/NumberInput/NumberInput.module.scss.js +25 -0
- package/components/inputs/Radio/Radio.js +68 -0
- package/components/inputs/Radio/Radio.module.scss.js +13 -0
- package/components/inputs/Select/Select.js +520 -0
- package/components/inputs/Select/Select.module.scss.js +69 -0
- package/components/inputs/Slider/Slider.js +128 -0
- package/components/inputs/Slider/Slider.module.scss.js +15 -0
- package/components/inputs/Textarea/Textarea.js +58 -0
- package/components/inputs/Textarea/Textarea.module.scss.js +25 -0
- package/hooks/useClickOutside.js +15 -0
- package/hooks/useFocusTrap.js +39 -0
- package/hooks/useKeyboard.js +19 -0
- package/hooks/usePortalPosition.js +20 -0
- package/index.css +1 -1
- package/index.js +119 -7000
- package/index.layered.css +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,38 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.8.0]
|
|
8
|
+
|
|
9
|
+
Bundle-size release: the package now tree-shakes properly. No API changes.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **Per-module build (`preserveModules`).** The library used to ship as a
|
|
14
|
+
single ES module, so consumer bundlers had to prove top-level
|
|
15
|
+
`forwardRef()`/`Object.assign()` calls side-effect-free to drop unused
|
|
16
|
+
components — they can't, and importing a lone `Button` bundled ~28K gzip
|
|
17
|
+
(about half the library). `dist/` now mirrors the source module graph (one
|
|
18
|
+
JS file per module, with the root entry re-exporting them), and bundlers
|
|
19
|
+
skip unimported files entirely via the `sideEffects` field. Measured with
|
|
20
|
+
an esbuild consumer: `import { Button }` → **0.9K gzip** (was 28.0K),
|
|
21
|
+
`import { CopyButton }` → 2.4K; importing everything is unchanged
|
|
22
|
+
(~51K gzip). The public API, `exports` map, and `theme.css` /
|
|
23
|
+
`theme.layered.css` are untouched — no consumer changes needed.
|
|
24
|
+
- **`clsx` is no longer inlined** into the build; it resolves from the
|
|
25
|
+
package's own declared dependency instead (deduplicates when your app also
|
|
26
|
+
uses it).
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **`react-hook-form` is now a declared (optional) peer dependency.** `Form`
|
|
31
|
+
imports it, but the package never declared it, so package managers could
|
|
32
|
+
not warn on version mismatches and plain-Node/SSR imports of the package
|
|
33
|
+
root failed with an unresolvable bare specifier unless it happened to be
|
|
34
|
+
installed. It was already marked optional in `peerDependenciesMeta`; the
|
|
35
|
+
missing `peerDependencies` range (`^7.0.0`) is now declared. You only need
|
|
36
|
+
to install it if you use `Form`/`FormField` — bundlers don't touch it
|
|
37
|
+
otherwise now that unimported files are skipped (see above).
|
|
38
|
+
|
|
7
39
|
## [0.7.0]
|
|
8
40
|
|
|
9
41
|
A new family of stateful action buttons, and wide-table / comparison-matrix
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { jsxs as Y, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Z, useState as M, useRef as b, useEffect as _ } from "react";
|
|
3
|
+
import o from "clsx";
|
|
4
|
+
import i from "./ActionButton.module.scss.js";
|
|
5
|
+
function ee() {
|
|
6
|
+
return /* @__PURE__ */ t(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
width: "1em",
|
|
10
|
+
height: "1em",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeWidth: "2.4",
|
|
15
|
+
strokeLinecap: "round",
|
|
16
|
+
strokeLinejoin: "round",
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
children: /* @__PURE__ */ t("path", { d: "M4 12l5 5L20 6" })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function ne() {
|
|
23
|
+
return /* @__PURE__ */ t(
|
|
24
|
+
"svg",
|
|
25
|
+
{
|
|
26
|
+
width: "1em",
|
|
27
|
+
height: "1em",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
fill: "none",
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: "2.4",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
children: /* @__PURE__ */ t("path", { d: "M21 12a9 9 0 1 1-9-9" })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const ie = Z(
|
|
39
|
+
({
|
|
40
|
+
icon: R,
|
|
41
|
+
label: j,
|
|
42
|
+
pendingIcon: v,
|
|
43
|
+
pendingLabel: T,
|
|
44
|
+
successIcon: A,
|
|
45
|
+
successLabel: k,
|
|
46
|
+
confirmLabel: p,
|
|
47
|
+
confirmTimeout: F = 2600,
|
|
48
|
+
onAction: V,
|
|
49
|
+
progressLabel: O,
|
|
50
|
+
onError: g,
|
|
51
|
+
onPhaseChange: W,
|
|
52
|
+
resetAfter: y = 1800,
|
|
53
|
+
speed: h = 1,
|
|
54
|
+
variant: $ = "secondary",
|
|
55
|
+
size: E = "md",
|
|
56
|
+
iconOnly: L = !1,
|
|
57
|
+
classes: s,
|
|
58
|
+
className: I,
|
|
59
|
+
style: N,
|
|
60
|
+
disabled: w,
|
|
61
|
+
onClick: q,
|
|
62
|
+
...z
|
|
63
|
+
}, D) => {
|
|
64
|
+
const [n, G] = M("idle"), [a, m] = M(null), f = b("idle"), l = b(!0), u = b({});
|
|
65
|
+
_(() => {
|
|
66
|
+
l.current = !0;
|
|
67
|
+
const e = u.current;
|
|
68
|
+
return () => {
|
|
69
|
+
l.current = !1, Object.values(e).forEach(clearTimeout);
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
const r = (e) => {
|
|
73
|
+
f.current = e, G(e), W?.(e);
|
|
74
|
+
}, S = (e, d, X) => {
|
|
75
|
+
clearTimeout(u.current[e]), u.current[e] = setTimeout(d, X / h);
|
|
76
|
+
}, x = () => {
|
|
77
|
+
m(null), r("success"), y > 0 && S("reset", () => {
|
|
78
|
+
f.current === "success" && r("idle");
|
|
79
|
+
}, y);
|
|
80
|
+
}, H = {
|
|
81
|
+
setProgress: (e) => {
|
|
82
|
+
l.current && m(e == null ? null : Math.max(0, Math.min(100, e)));
|
|
83
|
+
}
|
|
84
|
+
}, J = () => {
|
|
85
|
+
clearTimeout(u.current.disarm);
|
|
86
|
+
let e;
|
|
87
|
+
try {
|
|
88
|
+
e = V?.(H);
|
|
89
|
+
} catch (d) {
|
|
90
|
+
r("idle"), g?.(d);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
e && typeof e.then == "function" ? (r("pending"), e.then(
|
|
94
|
+
() => {
|
|
95
|
+
l.current && x();
|
|
96
|
+
},
|
|
97
|
+
(d) => {
|
|
98
|
+
l.current && (m(null), r("idle"), g?.(d));
|
|
99
|
+
}
|
|
100
|
+
)) : x();
|
|
101
|
+
}, K = (e) => {
|
|
102
|
+
if (q?.(e), !(w || e.defaultPrevented) && !(n === "pending" || n === "success")) {
|
|
103
|
+
if (p != null && n === "idle") {
|
|
104
|
+
r("armed"), S("disarm", () => {
|
|
105
|
+
f.current === "armed" && r("idle");
|
|
106
|
+
}, F);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
J();
|
|
110
|
+
}
|
|
111
|
+
}, c = n === "pending" && a != null, Q = [
|
|
112
|
+
// During determinate progress the idle icon returns (the fill bar and
|
|
113
|
+
// % label carry the "working" signal); the spinner is for the
|
|
114
|
+
// indeterminate wait only.
|
|
115
|
+
{ key: "idle", node: R, visible: n === "idle" || n === "armed" || c },
|
|
116
|
+
{
|
|
117
|
+
key: "pending",
|
|
118
|
+
node: v ?? /* @__PURE__ */ t(ne, {}),
|
|
119
|
+
visible: n === "pending" && !c,
|
|
120
|
+
spin: v === void 0
|
|
121
|
+
},
|
|
122
|
+
{ key: "success", node: A ?? /* @__PURE__ */ t(ee, {}), visible: n === "success" }
|
|
123
|
+
], C = c ? O?.(a) ?? `${Math.round(a)}%` : T, U = n === "idle" || n === "armed" && p == null || n === "pending" && C == null || n === "success" && k == null, P = {
|
|
124
|
+
idle: 0,
|
|
125
|
+
armed: 1,
|
|
126
|
+
pending: 2,
|
|
127
|
+
success: 3
|
|
128
|
+
}, B = [
|
|
129
|
+
{ key: "idle", node: j, visible: U },
|
|
130
|
+
{ key: "armed", node: p, visible: n === "armed" },
|
|
131
|
+
{ key: "pending", node: C, visible: n === "pending" },
|
|
132
|
+
{ key: "success", node: k, visible: n === "success" }
|
|
133
|
+
].filter((e) => e.node != null).map((e) => ({
|
|
134
|
+
...e,
|
|
135
|
+
position: e.visible ? void 0 : P[e.key] < P[n] ? i.labelAbove : i.labelBelow
|
|
136
|
+
}));
|
|
137
|
+
return /* @__PURE__ */ Y(
|
|
138
|
+
"button",
|
|
139
|
+
{
|
|
140
|
+
ref: D,
|
|
141
|
+
type: "button",
|
|
142
|
+
className: o(
|
|
143
|
+
i.root,
|
|
144
|
+
i[$],
|
|
145
|
+
i[E],
|
|
146
|
+
L && i.iconOnly,
|
|
147
|
+
s?.root,
|
|
148
|
+
I
|
|
149
|
+
),
|
|
150
|
+
style: h !== 1 ? { ...N, "--crk-action-speed": h } : N,
|
|
151
|
+
"data-phase": n,
|
|
152
|
+
disabled: w,
|
|
153
|
+
"aria-busy": n === "pending" || void 0,
|
|
154
|
+
onClick: K,
|
|
155
|
+
...z,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ t(
|
|
158
|
+
"span",
|
|
159
|
+
{
|
|
160
|
+
className: o(
|
|
161
|
+
i.progressFill,
|
|
162
|
+
c && i.progressFillActive,
|
|
163
|
+
s?.progressFill
|
|
164
|
+
),
|
|
165
|
+
style: { width: `${a ?? 0}%` },
|
|
166
|
+
"aria-hidden": "true"
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ t("span", { className: o(i.iconStack, s?.iconStack), "aria-hidden": "true", children: Q.map((e) => /* @__PURE__ */ t(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
className: o(
|
|
173
|
+
i.iconLayer,
|
|
174
|
+
e.visible && i.layerVisible,
|
|
175
|
+
e.visible && e.spin && i.iconSpin,
|
|
176
|
+
s?.iconLayer
|
|
177
|
+
),
|
|
178
|
+
children: e.node
|
|
179
|
+
},
|
|
180
|
+
e.key
|
|
181
|
+
)) }),
|
|
182
|
+
!L && B.length > 0 && /* @__PURE__ */ t(
|
|
183
|
+
"span",
|
|
184
|
+
{
|
|
185
|
+
className: o(i.labelStack, s?.labelStack),
|
|
186
|
+
"aria-live": c ? "off" : "polite",
|
|
187
|
+
children: B.map((e) => /* @__PURE__ */ t(
|
|
188
|
+
"span",
|
|
189
|
+
{
|
|
190
|
+
"aria-hidden": e.visible ? void 0 : !0,
|
|
191
|
+
className: o(
|
|
192
|
+
i.labelLayer,
|
|
193
|
+
e.visible && i.layerVisible,
|
|
194
|
+
e.position,
|
|
195
|
+
s?.labelLayer
|
|
196
|
+
),
|
|
197
|
+
children: e.node
|
|
198
|
+
},
|
|
199
|
+
e.key
|
|
200
|
+
))
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
ie.displayName = "ActionButton";
|
|
209
|
+
export {
|
|
210
|
+
ie as ActionButton
|
|
211
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const c = "crk-root--5DQa", o = "crk-primary-8sEXz", r = "crk-secondary-gchUR", n = "crk-danger-3Rwvr", l = "crk-ghost-NA6NO", e = "crk-sm-8Gx7n", s = "crk-md-1Aojo", t = "crk-lg-G-QeV", a = "crk-iconOnly-RXD7w", i = "crk-progressFill-fQBjO", k = "crk-progressFillActive-UUIFs", y = "crk-iconStack-cDz8K", b = "crk-iconLayer--8ZB0", g = "crk-iconSpin-P42Mx", p = "crk-crkActionSpin-hNXj5", S = "crk-labelStack-IdCBl", A = "crk-labelLayer-42FKW", d = "crk-labelAbove-GC0xj", m = "crk-labelBelow-ozPt1", h = "crk-layerVisible-zoVoM", F = "crk-crkActionShake-IQ6fK", v = {
|
|
2
|
+
root: c,
|
|
3
|
+
primary: o,
|
|
4
|
+
secondary: r,
|
|
5
|
+
danger: n,
|
|
6
|
+
ghost: l,
|
|
7
|
+
sm: e,
|
|
8
|
+
md: s,
|
|
9
|
+
lg: t,
|
|
10
|
+
iconOnly: a,
|
|
11
|
+
progressFill: i,
|
|
12
|
+
progressFillActive: k,
|
|
13
|
+
iconStack: y,
|
|
14
|
+
iconLayer: b,
|
|
15
|
+
iconSpin: g,
|
|
16
|
+
crkActionSpin: p,
|
|
17
|
+
labelStack: S,
|
|
18
|
+
labelLayer: A,
|
|
19
|
+
labelAbove: d,
|
|
20
|
+
labelBelow: m,
|
|
21
|
+
layerVisible: h,
|
|
22
|
+
crkActionShake: F
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
F as crkActionShake,
|
|
26
|
+
p as crkActionSpin,
|
|
27
|
+
n as danger,
|
|
28
|
+
v as default,
|
|
29
|
+
l as ghost,
|
|
30
|
+
b as iconLayer,
|
|
31
|
+
a as iconOnly,
|
|
32
|
+
g as iconSpin,
|
|
33
|
+
y as iconStack,
|
|
34
|
+
d as labelAbove,
|
|
35
|
+
m as labelBelow,
|
|
36
|
+
A as labelLayer,
|
|
37
|
+
S as labelStack,
|
|
38
|
+
h as layerVisible,
|
|
39
|
+
t as lg,
|
|
40
|
+
s as md,
|
|
41
|
+
o as primary,
|
|
42
|
+
i as progressFill,
|
|
43
|
+
k as progressFillActive,
|
|
44
|
+
c as root,
|
|
45
|
+
r as secondary,
|
|
46
|
+
e as sm
|
|
47
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { ActionButton as y } from "./ActionButton.js";
|
|
4
|
+
function f() {
|
|
5
|
+
return /* @__PURE__ */ l(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "2",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ e("rect", { x: "9", y: "9", width: "12", height: "12", rx: "2" }),
|
|
19
|
+
/* @__PURE__ */ e("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
async function m(o) {
|
|
25
|
+
if (typeof navigator < "u" && navigator.clipboard?.writeText) {
|
|
26
|
+
await navigator.clipboard.writeText(o);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const t = document.createElement("textarea");
|
|
30
|
+
t.value = o, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
|
|
31
|
+
try {
|
|
32
|
+
if (!document.execCommand("copy"))
|
|
33
|
+
throw new Error("Copy to clipboard failed");
|
|
34
|
+
} finally {
|
|
35
|
+
t.remove();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const u = s(
|
|
39
|
+
({
|
|
40
|
+
value: o,
|
|
41
|
+
icon: t = /* @__PURE__ */ e(f, {}),
|
|
42
|
+
label: n = "Copy",
|
|
43
|
+
successLabel: r = "Copied",
|
|
44
|
+
onCopied: a,
|
|
45
|
+
style: c,
|
|
46
|
+
...d
|
|
47
|
+
}, p) => /* @__PURE__ */ e(
|
|
48
|
+
y,
|
|
49
|
+
{
|
|
50
|
+
ref: p,
|
|
51
|
+
icon: t,
|
|
52
|
+
label: n,
|
|
53
|
+
successLabel: r,
|
|
54
|
+
onAction: async () => {
|
|
55
|
+
const i = typeof o == "function" ? await o() : o;
|
|
56
|
+
await m(i), a?.(i);
|
|
57
|
+
},
|
|
58
|
+
style: { "--crk-action-icon-exit": "scale(0.4) rotate(-40deg)", ...c },
|
|
59
|
+
...d
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
u.displayName = "CopyButton";
|
|
64
|
+
export {
|
|
65
|
+
u as CopyButton
|
|
66
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import l from "./Alert.module.scss.js";
|
|
5
|
+
const p = {
|
|
6
|
+
info: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
7
|
+
"path",
|
|
8
|
+
{
|
|
9
|
+
fillRule: "evenodd",
|
|
10
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM9 9a1 1 0 012 0v4a1 1 0 11-2 0V9zm1-4a1 1 0 100 2 1 1 0 000-2z",
|
|
11
|
+
clipRule: "evenodd"
|
|
12
|
+
}
|
|
13
|
+
) }),
|
|
14
|
+
success: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
15
|
+
"path",
|
|
16
|
+
{
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.7-9.3a1 1 0 00-1.4-1.4L9 10.6 7.7 9.3a1 1 0 00-1.4 1.4l2 2a1 1 0 001.4 0l4-4z",
|
|
19
|
+
clipRule: "evenodd"
|
|
20
|
+
}
|
|
21
|
+
) }),
|
|
22
|
+
warning: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
23
|
+
"path",
|
|
24
|
+
{
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
d: "M8.26 3.1c.77-1.33 2.71-1.33 3.48 0l5.58 9.67c.77 1.33-.19 3-1.74 3H4.42c-1.55 0-2.51-1.67-1.74-3L8.26 3.1zM10 7a1 1 0 011 1v3a1 1 0 11-2 0V8a1 1 0 011-1zm0 7a1 1 0 100-2 1 1 0 000 2z",
|
|
27
|
+
clipRule: "evenodd"
|
|
28
|
+
}
|
|
29
|
+
) }),
|
|
30
|
+
danger: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
31
|
+
"path",
|
|
32
|
+
{
|
|
33
|
+
fillRule: "evenodd",
|
|
34
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.7 7.3a1 1 0 00-1.4 1.4L8.6 10l-1.3 1.3a1 1 0 101.4 1.4L10 11.4l1.3 1.3a1 1 0 001.4-1.4L11.4 10l1.3-1.3a1 1 0 00-1.4-1.4L10 8.6 8.7 7.3z",
|
|
35
|
+
clipRule: "evenodd"
|
|
36
|
+
}
|
|
37
|
+
) })
|
|
38
|
+
}, z = f(
|
|
39
|
+
({
|
|
40
|
+
variant: d = "info",
|
|
41
|
+
title: o,
|
|
42
|
+
icon: i = !0,
|
|
43
|
+
onClose: n,
|
|
44
|
+
closeLabel: s = "Dismiss",
|
|
45
|
+
classes: r,
|
|
46
|
+
className: v,
|
|
47
|
+
children: t,
|
|
48
|
+
...m
|
|
49
|
+
}, h) => {
|
|
50
|
+
const c = i === !0 ? p[d] : i === !1 ? null : i;
|
|
51
|
+
return /* @__PURE__ */ u(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: h,
|
|
55
|
+
role: "alert",
|
|
56
|
+
className: a(l.root, l[d], r?.root, v),
|
|
57
|
+
...m,
|
|
58
|
+
children: [
|
|
59
|
+
c != null && /* @__PURE__ */ e("span", { className: a(l.icon, r?.icon), "aria-hidden": "true", children: c }),
|
|
60
|
+
/* @__PURE__ */ u("div", { className: a(l.content, r?.content), children: [
|
|
61
|
+
o != null && /* @__PURE__ */ e("div", { className: a(l.title, r?.title), children: o }),
|
|
62
|
+
t != null && /* @__PURE__ */ e("div", { className: a(l.message, r?.message), children: t })
|
|
63
|
+
] }),
|
|
64
|
+
n && /* @__PURE__ */ e(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: a(l.close, r?.close),
|
|
69
|
+
onClick: n,
|
|
70
|
+
"aria-label": s,
|
|
71
|
+
children: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M6.3 6.3a1 1 0 011.4 0L10 8.6l2.3-2.3a1 1 0 111.4 1.4L11.4 10l2.3 2.3a1 1 0 01-1.4 1.4L10 11.4l-2.3 2.3a1 1 0 01-1.4-1.4L8.6 10 6.3 7.7a1 1 0 010-1.4z" }) })
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
z.displayName = "Alert";
|
|
80
|
+
export {
|
|
81
|
+
z as Alert
|
|
82
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const c = "crk-root-KIhSk", s = "crk-info--J-F1", n = "crk-success-lftZT", o = "crk-warning-uOpos", t = "crk-danger-53-01", e = "crk-icon-RUu7X", r = "crk-content-9Fty2", i = "crk-title-QHuwO", a = "crk-message-Wd9FZ", k = "crk-close-yMuK-", g = {
|
|
2
|
+
root: c,
|
|
3
|
+
info: s,
|
|
4
|
+
success: n,
|
|
5
|
+
warning: o,
|
|
6
|
+
danger: t,
|
|
7
|
+
icon: e,
|
|
8
|
+
content: r,
|
|
9
|
+
title: i,
|
|
10
|
+
message: a,
|
|
11
|
+
close: k
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
k as close,
|
|
15
|
+
r as content,
|
|
16
|
+
t as danger,
|
|
17
|
+
g as default,
|
|
18
|
+
e as icon,
|
|
19
|
+
s as info,
|
|
20
|
+
a as message,
|
|
21
|
+
c as root,
|
|
22
|
+
n as success,
|
|
23
|
+
i as title,
|
|
24
|
+
o as warning
|
|
25
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useState as w, useEffect as b } from "react";
|
|
3
|
+
import l from "clsx";
|
|
4
|
+
import r from "./Avatar.module.scss.js";
|
|
5
|
+
function A(e) {
|
|
6
|
+
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
7
|
+
return t.length === 0 ? "" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
|
|
8
|
+
}
|
|
9
|
+
const C = N(
|
|
10
|
+
({ src: e, alt: t, name: i, fallback: c, size: f = "md", shape: m = "circle", status: s, classes: o, className: p, ...u }, d) => {
|
|
11
|
+
const [h, n] = w(!1);
|
|
12
|
+
b(() => n(!1), [e]);
|
|
13
|
+
const g = e && !h, v = i ? A(i) : "";
|
|
14
|
+
return /* @__PURE__ */ x(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
ref: d,
|
|
18
|
+
className: l(r.root, r[f], r[m], o?.root, p),
|
|
19
|
+
...u,
|
|
20
|
+
children: [
|
|
21
|
+
g ? /* @__PURE__ */ a(
|
|
22
|
+
"img",
|
|
23
|
+
{
|
|
24
|
+
className: l(r.image, o?.image),
|
|
25
|
+
src: e,
|
|
26
|
+
alt: t ?? i ?? "",
|
|
27
|
+
onError: () => n(!0)
|
|
28
|
+
}
|
|
29
|
+
) : /* @__PURE__ */ a(
|
|
30
|
+
"span",
|
|
31
|
+
{
|
|
32
|
+
className: l(r.fallback, o?.fallback),
|
|
33
|
+
role: "img",
|
|
34
|
+
"aria-label": t ?? i ?? "Avatar",
|
|
35
|
+
children: c ?? (v || /* @__PURE__ */ a(U, {}))
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
s && /* @__PURE__ */ a(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
className: l(r.status, r[`status_${s}`], o?.status),
|
|
42
|
+
"data-status": s,
|
|
43
|
+
"aria-hidden": "true"
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
C.displayName = "Avatar";
|
|
52
|
+
function U() {
|
|
53
|
+
return /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", width: "60%", height: "60%", children: /* @__PURE__ */ a("path", { d: "M12 12a5 5 0 100-10 5 5 0 000 10zm0 2c-4.4 0-8 2.7-8 6v1h16v-1c0-3.3-3.6-6-8-6z" }) });
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
C as Avatar
|
|
57
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const s = "crk-root-1YbL5", t = "crk-xs-1SMBv", a = "crk-sm-8TB22", c = "crk-md-zeW0d", n = "crk-lg-MWKN-", o = "crk-xl-KCqIL", u = "crk-circle-nzLby", l = "crk-square-JrlyG", r = "crk-image-HFFlp", e = "crk-fallback-R4J-V", k = "crk-status-e4HnT", i = "crk-status_online-bny3b", y = "crk-status_online-bny3b", f = "crk-status_offline-xxp2c", _ = "crk-status_offline-xxp2c", b = "crk-status_away-coReU", x = "crk-status_away-coReU", m = "crk-status_busy-aOHjE", g = "crk-status_busy-aOHjE", w = {
|
|
2
|
+
root: s,
|
|
3
|
+
xs: t,
|
|
4
|
+
sm: a,
|
|
5
|
+
md: c,
|
|
6
|
+
lg: n,
|
|
7
|
+
xl: o,
|
|
8
|
+
circle: u,
|
|
9
|
+
square: l,
|
|
10
|
+
image: r,
|
|
11
|
+
fallback: e,
|
|
12
|
+
status: k,
|
|
13
|
+
status_online: i,
|
|
14
|
+
statusOnline: y,
|
|
15
|
+
status_offline: f,
|
|
16
|
+
statusOffline: _,
|
|
17
|
+
status_away: b,
|
|
18
|
+
statusAway: x,
|
|
19
|
+
status_busy: m,
|
|
20
|
+
statusBusy: g
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
u as circle,
|
|
24
|
+
w as default,
|
|
25
|
+
e as fallback,
|
|
26
|
+
r as image,
|
|
27
|
+
n as lg,
|
|
28
|
+
c as md,
|
|
29
|
+
s as root,
|
|
30
|
+
a as sm,
|
|
31
|
+
l as square,
|
|
32
|
+
k as status,
|
|
33
|
+
x as statusAway,
|
|
34
|
+
g as statusBusy,
|
|
35
|
+
_ as statusOffline,
|
|
36
|
+
y as statusOnline,
|
|
37
|
+
b as status_away,
|
|
38
|
+
m as status_busy,
|
|
39
|
+
f as status_offline,
|
|
40
|
+
i as status_online,
|
|
41
|
+
o as xl,
|
|
42
|
+
t as xs
|
|
43
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import t from "clsx";
|
|
4
|
+
import r from "./Badge.module.scss.js";
|
|
5
|
+
const x = c(
|
|
6
|
+
({
|
|
7
|
+
variant: a = "neutral",
|
|
8
|
+
appearance: e = "soft",
|
|
9
|
+
size: s = "md",
|
|
10
|
+
dot: m = !1,
|
|
11
|
+
classes: o,
|
|
12
|
+
className: d,
|
|
13
|
+
children: f,
|
|
14
|
+
...i
|
|
15
|
+
}, p) => /* @__PURE__ */ l(
|
|
16
|
+
"span",
|
|
17
|
+
{
|
|
18
|
+
ref: p,
|
|
19
|
+
className: t(
|
|
20
|
+
r.root,
|
|
21
|
+
r[a],
|
|
22
|
+
r[e],
|
|
23
|
+
r[s],
|
|
24
|
+
o?.root,
|
|
25
|
+
d
|
|
26
|
+
),
|
|
27
|
+
...i,
|
|
28
|
+
children: [
|
|
29
|
+
m && /* @__PURE__ */ n("span", { className: t(r.dot, o?.dot), "aria-hidden": "true" }),
|
|
30
|
+
f
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
x.displayName = "Badge";
|
|
36
|
+
export {
|
|
37
|
+
x as Badge
|
|
38
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const s = "crk-root-KSuIQ", c = "crk-sm--vFVn", o = "crk-md-zmWkB", n = "crk-lg-vhZlR", r = "crk-neutral-RdrgV", t = "crk-primary-wn6-R", e = "crk-success-DMnu3", k = "crk-warning-4IHkk", l = "crk-danger-nwbtA", a = "crk-soft-D7eFo", d = "crk-solid-OAgyP", i = "crk-outline-2IwcH", u = "crk-dot-KeAKh", g = {
|
|
2
|
+
root: s,
|
|
3
|
+
sm: c,
|
|
4
|
+
md: o,
|
|
5
|
+
lg: n,
|
|
6
|
+
neutral: r,
|
|
7
|
+
primary: t,
|
|
8
|
+
success: e,
|
|
9
|
+
warning: k,
|
|
10
|
+
danger: l,
|
|
11
|
+
soft: a,
|
|
12
|
+
solid: d,
|
|
13
|
+
outline: i,
|
|
14
|
+
dot: u
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
l as danger,
|
|
18
|
+
g as default,
|
|
19
|
+
u as dot,
|
|
20
|
+
n as lg,
|
|
21
|
+
o as md,
|
|
22
|
+
r as neutral,
|
|
23
|
+
i as outline,
|
|
24
|
+
t as primary,
|
|
25
|
+
s as root,
|
|
26
|
+
c as sm,
|
|
27
|
+
a as soft,
|
|
28
|
+
d as solid,
|
|
29
|
+
e as success,
|
|
30
|
+
k as warning
|
|
31
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as e, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, Children as v, isValidElement as C } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import t from "./Breadcrumbs.module.scss.js";
|
|
5
|
+
function f({ href: n, current: s = !1, children: i, className: r, ...m }) {
|
|
6
|
+
return /* @__PURE__ */ e("li", { className: r, ...m, children: s || !n ? /* @__PURE__ */ e("span", { "aria-current": s ? "page" : void 0, children: i }) : /* @__PURE__ */ e("a", { href: n, children: i }) });
|
|
7
|
+
}
|
|
8
|
+
f.displayName = "Breadcrumbs.Item";
|
|
9
|
+
const h = k(
|
|
10
|
+
({ children: n, separator: s = "/", label: i = "Breadcrumb", classes: r, className: m, ...b }, B) => {
|
|
11
|
+
const o = v.toArray(n).filter(C);
|
|
12
|
+
return /* @__PURE__ */ e(
|
|
13
|
+
"nav",
|
|
14
|
+
{
|
|
15
|
+
ref: B,
|
|
16
|
+
"aria-label": i,
|
|
17
|
+
className: a(t.root, r?.root, m),
|
|
18
|
+
...b,
|
|
19
|
+
children: /* @__PURE__ */ e("ol", { className: a(t.list, r?.list), children: o.map((c, l) => {
|
|
20
|
+
const d = l === o.length - 1, y = c.props ?? {}, { href: p, current: g, children: u, className: x } = y, N = g ?? d;
|
|
21
|
+
return /* @__PURE__ */ j(
|
|
22
|
+
"li",
|
|
23
|
+
{
|
|
24
|
+
className: a(t.item, r?.item, x),
|
|
25
|
+
children: [
|
|
26
|
+
N || !p ? /* @__PURE__ */ e(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: a(t.current, r?.current),
|
|
30
|
+
"aria-current": N ? "page" : void 0,
|
|
31
|
+
children: u
|
|
32
|
+
}
|
|
33
|
+
) : /* @__PURE__ */ e("a", { className: a(t.link, r?.link), href: p, children: u }),
|
|
34
|
+
!d && /* @__PURE__ */ e("span", { className: a(t.separator, r?.separator), "aria-hidden": "true", children: s })
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
c.key ?? l
|
|
38
|
+
);
|
|
39
|
+
}) })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
h.displayName = "Breadcrumbs";
|
|
45
|
+
const E = Object.assign(h, { Item: f });
|
|
46
|
+
export {
|
|
47
|
+
f as BreadcrumbItem,
|
|
48
|
+
E as Breadcrumbs
|
|
49
|
+
};
|