@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as j, useRef as v, useId as D, useMemo as P, useEffect as U, createContext as E, useContext as y } from "react";
|
|
3
|
+
import { createPortal as K } from "react-dom";
|
|
4
|
+
import d from "clsx";
|
|
5
|
+
import { useFocusTrap as O } from "../../hooks/useFocusTrap.js";
|
|
6
|
+
import { useKeyboard as S } from "../../hooks/useKeyboard.js";
|
|
7
|
+
import a from "./Modal.module.scss.js";
|
|
8
|
+
const u = E({ classes: {}, titleId: "" }), M = ({ children: e, className: r, style: s, onClose: t }) => {
|
|
9
|
+
const { classes: n, titleId: c } = y(u);
|
|
10
|
+
return /* @__PURE__ */ T(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
id: c,
|
|
14
|
+
className: d(a.header, t && a.headerWithClose, n.header, r),
|
|
15
|
+
style: s,
|
|
16
|
+
children: [
|
|
17
|
+
e,
|
|
18
|
+
t && /* @__PURE__ */ l(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
className: d(a.closeButton, n.closeButton),
|
|
23
|
+
onClick: t,
|
|
24
|
+
"aria-label": "Close",
|
|
25
|
+
children: "×"
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
M.displayName = "Modal.Header";
|
|
33
|
+
const N = ({ children: e, className: r, style: s }) => {
|
|
34
|
+
const { classes: t } = y(u);
|
|
35
|
+
return /* @__PURE__ */ l("div", { className: d(a.body, t.body, r), style: s, children: e });
|
|
36
|
+
};
|
|
37
|
+
N.displayName = "Modal.Body";
|
|
38
|
+
const B = ({ children: e, className: r, style: s }) => {
|
|
39
|
+
const { classes: t } = y(u);
|
|
40
|
+
return /* @__PURE__ */ l("div", { className: d(a.footer, t.footer, r), style: s, children: e });
|
|
41
|
+
};
|
|
42
|
+
B.displayName = "Modal.Footer";
|
|
43
|
+
const m = j(
|
|
44
|
+
({
|
|
45
|
+
open: e,
|
|
46
|
+
onClose: r,
|
|
47
|
+
closeOnBackdrop: s = !0,
|
|
48
|
+
closeOnEscape: t = !0,
|
|
49
|
+
size: n = "md",
|
|
50
|
+
classes: c,
|
|
51
|
+
className: k,
|
|
52
|
+
style: w,
|
|
53
|
+
children: x,
|
|
54
|
+
"aria-label": p,
|
|
55
|
+
"aria-labelledby": g
|
|
56
|
+
}, i) => {
|
|
57
|
+
const b = v(null), C = (o) => {
|
|
58
|
+
b.current = o, typeof i == "function" ? i(o) : i && (i.current = o);
|
|
59
|
+
}, I = D(), h = g ?? `${I}-title`;
|
|
60
|
+
O(b, e);
|
|
61
|
+
const F = P(
|
|
62
|
+
() => ({
|
|
63
|
+
Escape: () => {
|
|
64
|
+
t && r();
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
[t, r]
|
|
68
|
+
);
|
|
69
|
+
S(F, e), U(() => {
|
|
70
|
+
if (!e) return;
|
|
71
|
+
const o = document.body.style.overflow;
|
|
72
|
+
return document.body.style.overflow = "hidden", () => {
|
|
73
|
+
document.body.style.overflow = o;
|
|
74
|
+
};
|
|
75
|
+
}, [e]);
|
|
76
|
+
const f = v(!1), H = (o) => {
|
|
77
|
+
f.current = o.target === o.currentTarget;
|
|
78
|
+
}, R = (o) => {
|
|
79
|
+
s && f.current && o.target === o.currentTarget && r(), f.current = !1;
|
|
80
|
+
};
|
|
81
|
+
return e ? K(
|
|
82
|
+
/* @__PURE__ */ l(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: d(a.backdrop, c?.backdrop),
|
|
86
|
+
onMouseDown: H,
|
|
87
|
+
onMouseUp: R,
|
|
88
|
+
role: "presentation",
|
|
89
|
+
children: /* @__PURE__ */ l(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
ref: C,
|
|
93
|
+
className: d(a.modal, a[n], c?.modal, k),
|
|
94
|
+
style: w,
|
|
95
|
+
role: "dialog",
|
|
96
|
+
"aria-modal": "true",
|
|
97
|
+
"aria-label": p,
|
|
98
|
+
"aria-labelledby": p ? void 0 : h,
|
|
99
|
+
children: /* @__PURE__ */ l(u.Provider, { value: { classes: c ?? {}, titleId: h }, children: x })
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
document.body
|
|
105
|
+
) : null;
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
m.displayName = "Modal";
|
|
109
|
+
m.Header = M;
|
|
110
|
+
m.Body = N;
|
|
111
|
+
m.Footer = B;
|
|
112
|
+
export {
|
|
113
|
+
m as Modal
|
|
114
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A", r = "crk-modal-yNG-7", e = "crk-modalIn-xFUwm", s = "crk-sm--xyY9", t = "crk-md-ETTfh", d = "crk-lg-5DBb7", n = "crk-fullscreen-b4jQ-", l = "crk-header-NS30G", a = "crk-headerWithClose-4davm", k = "crk-closeButton-JX-aq", m = "crk-body-3zIj9", b = "crk-footer-Oyz-R", h = {
|
|
2
|
+
backdrop: o,
|
|
3
|
+
backdropIn: c,
|
|
4
|
+
modal: r,
|
|
5
|
+
modalIn: e,
|
|
6
|
+
sm: s,
|
|
7
|
+
md: t,
|
|
8
|
+
lg: d,
|
|
9
|
+
fullscreen: n,
|
|
10
|
+
header: l,
|
|
11
|
+
headerWithClose: a,
|
|
12
|
+
closeButton: k,
|
|
13
|
+
body: m,
|
|
14
|
+
footer: b
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
o as backdrop,
|
|
18
|
+
c as backdropIn,
|
|
19
|
+
m as body,
|
|
20
|
+
k as closeButton,
|
|
21
|
+
h as default,
|
|
22
|
+
b as footer,
|
|
23
|
+
n as fullscreen,
|
|
24
|
+
l as header,
|
|
25
|
+
a as headerWithClose,
|
|
26
|
+
d as lg,
|
|
27
|
+
t as md,
|
|
28
|
+
r as modal,
|
|
29
|
+
e as modalIn,
|
|
30
|
+
s as sm
|
|
31
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as T, useState as W } from "react";
|
|
3
|
+
import l from "clsx";
|
|
4
|
+
import r from "./Pagination.module.scss.js";
|
|
5
|
+
import { paginationRange as q } from "./paginationRange.js";
|
|
6
|
+
const w = ({ dir: c }) => /* @__PURE__ */ t("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: {
|
|
7
|
+
left: /* @__PURE__ */ t("path", { d: "M7 2L3 6l4 4" }),
|
|
8
|
+
right: /* @__PURE__ */ t("path", { d: "M5 2l4 4-4 4" }),
|
|
9
|
+
first: /* @__PURE__ */ d(x, { children: [
|
|
10
|
+
/* @__PURE__ */ t("path", { d: "M8 2L4 6l4 4" }),
|
|
11
|
+
/* @__PURE__ */ t("path", { d: "M4 2v8" })
|
|
12
|
+
] }),
|
|
13
|
+
last: /* @__PURE__ */ d(x, { children: [
|
|
14
|
+
/* @__PURE__ */ t("path", { d: "M4 2l4 4-4 4" }),
|
|
15
|
+
/* @__PURE__ */ t("path", { d: "M8 2v8" })
|
|
16
|
+
] })
|
|
17
|
+
}[c] }), z = T(
|
|
18
|
+
({
|
|
19
|
+
count: c,
|
|
20
|
+
total: p,
|
|
21
|
+
pageSize: b = 10,
|
|
22
|
+
page: h,
|
|
23
|
+
defaultPage: k = 1,
|
|
24
|
+
onChange: C,
|
|
25
|
+
boundaryCount: G = 1,
|
|
26
|
+
siblingCount: N = 2,
|
|
27
|
+
showPrevNext: m = !0,
|
|
28
|
+
showFirstLast: f = !1,
|
|
29
|
+
size: y = "md",
|
|
30
|
+
disabled: u = !1,
|
|
31
|
+
label: j = "Pagination",
|
|
32
|
+
classes: e,
|
|
33
|
+
className: L,
|
|
34
|
+
...P
|
|
35
|
+
}, R) => {
|
|
36
|
+
const i = c ?? (p != null ? Math.max(1, Math.ceil(p / b)) : 1), g = h !== void 0, [$, B] = W(k), n = Math.min(Math.max(g ? h : $, 1), i), v = (o) => {
|
|
37
|
+
const a = Math.min(Math.max(o, 1), i);
|
|
38
|
+
a !== n && (g || B(a), C?.(a));
|
|
39
|
+
}, I = q(n, i, G, N), s = (o, a, M, S) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
className: l(r.item, r.control, e?.item, e?.control),
|
|
44
|
+
onClick: () => v(M),
|
|
45
|
+
disabled: u || n === M || (a === "left" || a === "first" ? n === 1 : n === i),
|
|
46
|
+
"aria-label": S,
|
|
47
|
+
children: /* @__PURE__ */ t(w, { dir: a })
|
|
48
|
+
}
|
|
49
|
+
) }, o);
|
|
50
|
+
return /* @__PURE__ */ t(
|
|
51
|
+
"nav",
|
|
52
|
+
{
|
|
53
|
+
ref: R,
|
|
54
|
+
"aria-label": j,
|
|
55
|
+
className: l(r.root, r[y], e?.root, L),
|
|
56
|
+
...P,
|
|
57
|
+
children: /* @__PURE__ */ d("ul", { className: l(r.list, e?.list), children: [
|
|
58
|
+
f && s("first", "first", 1, "Go to first page"),
|
|
59
|
+
m && s("prev", "left", n - 1, "Go to previous page"),
|
|
60
|
+
I.map(
|
|
61
|
+
(o, a) => o === "ellipsis" ? /* @__PURE__ */ t("li", { "aria-hidden": "true", className: l(r.ellipsis, e?.ellipsis), children: "…" }, `e${a}`) : /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
className: l(r.item, o === n && r.active, e?.item, o === n && e?.active),
|
|
66
|
+
onClick: () => v(o),
|
|
67
|
+
disabled: u,
|
|
68
|
+
"aria-current": o === n ? "page" : void 0,
|
|
69
|
+
"aria-label": `Go to page ${o}`,
|
|
70
|
+
children: o
|
|
71
|
+
}
|
|
72
|
+
) }, o)
|
|
73
|
+
),
|
|
74
|
+
m && s("next", "right", n + 1, "Go to next page"),
|
|
75
|
+
f && s("last", "last", i, "Go to last page")
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
z.displayName = "Pagination";
|
|
82
|
+
export {
|
|
83
|
+
z as Pagination
|
|
84
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const t = "crk-root-IuiQ5", s = "crk-sm-tfMLg", c = "crk-md-MdjxU", o = "crk-lg-6-p8a", l = "crk-list-UN-OF", i = "crk-item-ZOauk", r = "crk-active-gs4QO", n = "crk-control-HnlrC", e = "crk-ellipsis-iAsGN", k = {
|
|
2
|
+
root: t,
|
|
3
|
+
sm: s,
|
|
4
|
+
md: c,
|
|
5
|
+
lg: o,
|
|
6
|
+
list: l,
|
|
7
|
+
item: i,
|
|
8
|
+
active: r,
|
|
9
|
+
control: n,
|
|
10
|
+
ellipsis: e
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
r as active,
|
|
14
|
+
n as control,
|
|
15
|
+
k as default,
|
|
16
|
+
e as ellipsis,
|
|
17
|
+
i as item,
|
|
18
|
+
o as lg,
|
|
19
|
+
l as list,
|
|
20
|
+
c as md,
|
|
21
|
+
t as root,
|
|
22
|
+
s as sm
|
|
23
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function l(i, s) {
|
|
2
|
+
const e = Math.max(s - i + 1, 0);
|
|
3
|
+
return Array.from({ length: e }, (h, m) => i + m);
|
|
4
|
+
}
|
|
5
|
+
function x(i, s, e = 1, h = 2) {
|
|
6
|
+
if (s <= 0) return [];
|
|
7
|
+
const m = l(1, Math.min(e, s)), M = l(Math.max(s - e + 1, e + 1), s), a = Math.max(
|
|
8
|
+
Math.min(i - h, s - e - h * 2 - 1),
|
|
9
|
+
e + 2
|
|
10
|
+
), g = Math.min(
|
|
11
|
+
Math.max(i + h, e + h * 2 + 2),
|
|
12
|
+
M.length > 0 ? M[0] - 2 : s - 1
|
|
13
|
+
);
|
|
14
|
+
return [
|
|
15
|
+
...m,
|
|
16
|
+
...a > e + 2 ? ["ellipsis"] : e + 1 < s - e ? [e + 1] : [],
|
|
17
|
+
...l(a, g),
|
|
18
|
+
...g < s - e - 1 ? ["ellipsis"] : s - e > e ? [s - e] : [],
|
|
19
|
+
...M
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
x as paginationRange
|
|
24
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as S, jsxs as G } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useState as E, useRef as B, useId as Q, useCallback as O, useLayoutEffect as U, useEffect as Z, isValidElement as _, cloneElement as ee } from "react";
|
|
3
|
+
import y from "clsx";
|
|
4
|
+
import R from "./Popover.module.scss.js";
|
|
5
|
+
import { useClickOutside as te } from "../../hooks/useClickOutside.js";
|
|
6
|
+
import { useKeyboard as oe } from "../../hooks/useKeyboard.js";
|
|
7
|
+
function re(...a) {
|
|
8
|
+
return (h) => {
|
|
9
|
+
for (const f of a)
|
|
10
|
+
f && (typeof f == "function" ? f(h) : f.current = h);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const ne = J(
|
|
14
|
+
({
|
|
15
|
+
trigger: a,
|
|
16
|
+
asChild: h = !1,
|
|
17
|
+
content: f,
|
|
18
|
+
position: n = "bottom",
|
|
19
|
+
autoPosition: m = !0,
|
|
20
|
+
open: j,
|
|
21
|
+
onOpenChange: z,
|
|
22
|
+
classes: g,
|
|
23
|
+
className: K,
|
|
24
|
+
style: P
|
|
25
|
+
}, T) => {
|
|
26
|
+
const [V, W] = E(!1), [A, M] = E(n), [D, X] = E(0), [F, Y] = E(0), $ = B(null), u = B(null), v = B(null), k = Q(), C = j !== void 0, o = C ? j : V, w = O(
|
|
27
|
+
(t) => {
|
|
28
|
+
C || W(t), z?.(t);
|
|
29
|
+
},
|
|
30
|
+
[C, z]
|
|
31
|
+
), q = O(() => {
|
|
32
|
+
w(!1), v.current?.focus();
|
|
33
|
+
}, [w]), H = O(() => {
|
|
34
|
+
w(!o);
|
|
35
|
+
}, [o, w]);
|
|
36
|
+
te($, q, o), oe(
|
|
37
|
+
{
|
|
38
|
+
Escape: () => q()
|
|
39
|
+
},
|
|
40
|
+
o
|
|
41
|
+
), U(() => {
|
|
42
|
+
if (!o || !m) {
|
|
43
|
+
M(n), X(0), Y(0);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (typeof window > "u") return;
|
|
47
|
+
const t = () => {
|
|
48
|
+
const b = v.current, x = u.current;
|
|
49
|
+
if (!b || !x) return;
|
|
50
|
+
const s = b.getBoundingClientRect(), i = x.getBoundingClientRect(), N = window.innerWidth, I = window.innerHeight, r = 8;
|
|
51
|
+
let c = n;
|
|
52
|
+
if (n === "bottom" || n === "top") {
|
|
53
|
+
const e = s.bottom + r + i.height <= I, p = s.top - r - i.height >= 0;
|
|
54
|
+
n === "bottom" && !e && p ? c = "top" : n === "top" && !p && e && (c = "bottom");
|
|
55
|
+
} else {
|
|
56
|
+
const e = s.right + r + i.width <= N, p = s.left - r - i.width >= 0;
|
|
57
|
+
n === "right" && !e && p ? c = "left" : n === "left" && !p && e && (c = "right");
|
|
58
|
+
}
|
|
59
|
+
let l = 0, d = 0;
|
|
60
|
+
if (c === "bottom" || c === "top") {
|
|
61
|
+
const e = s.left + s.width / 2 - i.width / 2;
|
|
62
|
+
e < r ? l = r - e : e + i.width > N - r && (l = N - r - (e + i.width));
|
|
63
|
+
} else {
|
|
64
|
+
const e = s.top + s.height / 2 - i.height / 2;
|
|
65
|
+
e < r ? d = r - e : e + i.height > I - r && (d = I - r - (e + i.height));
|
|
66
|
+
}
|
|
67
|
+
l = Math.round(l), d = Math.round(d), M((e) => e === c ? e : c), X((e) => e === l ? e : l), Y((e) => e === d ? e : d);
|
|
68
|
+
};
|
|
69
|
+
return t(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
|
|
70
|
+
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
|
|
71
|
+
};
|
|
72
|
+
}, [o, m, n]), Z(() => {
|
|
73
|
+
if (o && u.current) {
|
|
74
|
+
const t = u.current.querySelector(
|
|
75
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
76
|
+
);
|
|
77
|
+
t ? t.focus() : u.current.focus();
|
|
78
|
+
}
|
|
79
|
+
}, [o]);
|
|
80
|
+
let L;
|
|
81
|
+
if (h && _(a)) {
|
|
82
|
+
const t = a, b = t.ref;
|
|
83
|
+
L = ee(t, {
|
|
84
|
+
ref: re(v, b),
|
|
85
|
+
onClick: (x) => {
|
|
86
|
+
t.props.onClick?.(x), H();
|
|
87
|
+
},
|
|
88
|
+
className: y(t.props.className, g?.trigger),
|
|
89
|
+
"aria-expanded": o,
|
|
90
|
+
"aria-haspopup": "dialog",
|
|
91
|
+
"aria-controls": o ? k : void 0
|
|
92
|
+
});
|
|
93
|
+
} else
|
|
94
|
+
L = /* @__PURE__ */ S(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
ref: v,
|
|
98
|
+
type: "button",
|
|
99
|
+
className: y(R.trigger, g?.trigger),
|
|
100
|
+
onClick: H,
|
|
101
|
+
"aria-expanded": o,
|
|
102
|
+
"aria-haspopup": "dialog",
|
|
103
|
+
"aria-controls": o ? k : void 0,
|
|
104
|
+
children: a
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
return /* @__PURE__ */ S(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
ref: T,
|
|
111
|
+
className: y(R.root, g?.root, K),
|
|
112
|
+
style: P,
|
|
113
|
+
children: /* @__PURE__ */ G("div", { ref: $, children: [
|
|
114
|
+
L,
|
|
115
|
+
o && /* @__PURE__ */ S(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: u,
|
|
119
|
+
id: k,
|
|
120
|
+
role: "dialog",
|
|
121
|
+
tabIndex: -1,
|
|
122
|
+
className: y(R.popover, R[m ? A : n], g?.popover),
|
|
123
|
+
style: m ? {
|
|
124
|
+
"--crk-popover-shift-x": `${D}px`,
|
|
125
|
+
"--crk-popover-shift-y": `${F}px`
|
|
126
|
+
} : void 0,
|
|
127
|
+
children: f
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] })
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
ne.displayName = "Popover";
|
|
136
|
+
export {
|
|
137
|
+
ne as Popover
|
|
138
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const o = "crk-root-8H-L9", t = "crk-trigger-Zn1nQ", r = "crk-popover-rvS3X", e = "crk-popoverFade-hj41M", c = "crk-bottom-lawQw", p = "crk-top-rqvC6", s = "crk-left-J6exv", n = "crk-right-3y20l", g = {
|
|
2
|
+
root: o,
|
|
3
|
+
trigger: t,
|
|
4
|
+
popover: r,
|
|
5
|
+
popoverFade: e,
|
|
6
|
+
bottom: c,
|
|
7
|
+
top: p,
|
|
8
|
+
left: s,
|
|
9
|
+
right: n
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
c as bottom,
|
|
13
|
+
g as default,
|
|
14
|
+
s as left,
|
|
15
|
+
r as popover,
|
|
16
|
+
e as popoverFade,
|
|
17
|
+
n as right,
|
|
18
|
+
o as root,
|
|
19
|
+
p as top,
|
|
20
|
+
t as trigger
|
|
21
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import t from "./Skeleton.module.scss.js";
|
|
5
|
+
const o = (e) => typeof e == "number" ? `${e}px` : e, w = y(
|
|
6
|
+
({ variant: e = "text", width: m, height: s, animation: l = "pulse", lines: r = 1, classes: i, className: p, style: d, ...f }, c) => {
|
|
7
|
+
const h = l === "wave" ? t.wave : l === "none" ? void 0 : t.pulse;
|
|
8
|
+
if (e === "text" && r > 1)
|
|
9
|
+
return /* @__PURE__ */ n(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
ref: c,
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
className: a(t.stack, i?.root, p),
|
|
15
|
+
style: d,
|
|
16
|
+
...f,
|
|
17
|
+
children: Array.from({ length: r }).map((k, u) => /* @__PURE__ */ n(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
className: a(t.line, t.text, h, i?.line),
|
|
21
|
+
style: {
|
|
22
|
+
width: u === r - 1 ? "60%" : o(m) ?? "100%",
|
|
23
|
+
height: o(s)
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
u
|
|
27
|
+
))
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
const x = {
|
|
31
|
+
width: o(m),
|
|
32
|
+
height: o(s),
|
|
33
|
+
...d
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ n(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: c,
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
className: a(t.line, t[e], h, i?.root, p),
|
|
41
|
+
style: x,
|
|
42
|
+
...f
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
w.displayName = "Skeleton";
|
|
48
|
+
export {
|
|
49
|
+
w as Skeleton
|
|
50
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const e = "crk-line-8roAA", c = "crk-stack-8QHed", t = "crk-text-4oj9n", k = "crk-circle-o-WgD", r = "crk-rect-8lO4C", s = "crk-pulse-dX0ir", l = "crk-crk-skeleton-pulse-ZXPJJ", n = "crk-wave-S82D6", o = "crk-crk-skeleton-wave-rDp6Z", a = {
|
|
2
|
+
line: e,
|
|
3
|
+
stack: c,
|
|
4
|
+
text: t,
|
|
5
|
+
circle: k,
|
|
6
|
+
rect: r,
|
|
7
|
+
pulse: s,
|
|
8
|
+
"crk-skeleton-pulse": "crk-crk-skeleton-pulse-ZXPJJ",
|
|
9
|
+
crkSkeletonPulse: l,
|
|
10
|
+
wave: n,
|
|
11
|
+
"crk-skeleton-wave": "crk-crk-skeleton-wave-rDp6Z",
|
|
12
|
+
crkSkeletonWave: o
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
k as circle,
|
|
16
|
+
l as crkSkeletonPulse,
|
|
17
|
+
o as crkSkeletonWave,
|
|
18
|
+
a as default,
|
|
19
|
+
e as line,
|
|
20
|
+
s as pulse,
|
|
21
|
+
r as rect,
|
|
22
|
+
c as stack,
|
|
23
|
+
t as text,
|
|
24
|
+
n as wave
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import r from "./Spinner.module.scss.js";
|
|
5
|
+
const f = d(
|
|
6
|
+
({ size: t = "md", color: i, label: o = "Loading", classes: e, className: m, style: l, ...s }, p) => /* @__PURE__ */ c(
|
|
7
|
+
"span",
|
|
8
|
+
{
|
|
9
|
+
ref: p,
|
|
10
|
+
role: "status",
|
|
11
|
+
"aria-live": "polite",
|
|
12
|
+
className: a(r.root, r[t], e?.root, m),
|
|
13
|
+
style: i ? { ...l, color: i } : l,
|
|
14
|
+
...s,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ n("span", { className: a(r.circle, e?.circle), "aria-hidden": "true" }),
|
|
17
|
+
o ? /* @__PURE__ */ n("span", { className: a(r.label, e?.label), children: o }) : null
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
f.displayName = "Spinner";
|
|
23
|
+
export {
|
|
24
|
+
f as Spinner
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const r = "crk-root-wia8E", c = "crk-circle-8olrz", t = "crk-crk-spinner-rotate-vrMQr", o = "crk-sm-q2vog", e = "crk-md-kcEfs", n = "crk-lg-8yfDn", s = "crk-label-ahktK", k = {
|
|
2
|
+
root: r,
|
|
3
|
+
circle: c,
|
|
4
|
+
"crk-spinner-rotate": "crk-crk-spinner-rotate-vrMQr",
|
|
5
|
+
crkSpinnerRotate: t,
|
|
6
|
+
sm: o,
|
|
7
|
+
md: e,
|
|
8
|
+
lg: n,
|
|
9
|
+
label: s
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
c as circle,
|
|
13
|
+
t as crkSpinnerRotate,
|
|
14
|
+
k as default,
|
|
15
|
+
s as label,
|
|
16
|
+
n as lg,
|
|
17
|
+
e as md,
|
|
18
|
+
r as root,
|
|
19
|
+
o as sm
|
|
20
|
+
};
|