@overdoser/react-toolkit 0.6.0 → 0.8.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 +6 -0
- package/CHANGELOG.md +82 -0
- package/components/ActionButton/ActionButton.d.ts +105 -0
- package/components/ActionButton/ActionButton.js +211 -0
- package/components/ActionButton/ActionButton.module.scss.js +47 -0
- package/components/ActionButton/CopyButton.d.ts +31 -0
- package/components/ActionButton/CopyButton.js +66 -0
- package/components/ActionButton/index.d.ts +4 -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 +109 -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.d.ts +61 -6
- package/components/Table/Table.js +284 -0
- package/components/Table/Table.module.scss.js +59 -0
- package/components/Table/useTableSort.d.ts +7 -5
- 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.d.ts +62 -0
- package/components/ToggleIconButton/ToggleIconButton.js +58 -0
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +27 -0
- package/components/ToggleIconButton/index.d.ts +2 -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.d.ts +4 -0
- package/index.js +119 -6575
- package/index.layered.css +1 -1
- package/llms.txt +123 -5
- package/manifest.json +230 -2
- package/package.json +3 -2
- package/recipes/comparison-table.tsx +123 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as G, useState as H, useRef as b, useId as J, useEffect as S, useCallback as v } from "react";
|
|
3
|
+
import { createPortal as Q } from "react-dom";
|
|
4
|
+
import i from "clsx";
|
|
5
|
+
import t from "./Dropdown.module.scss.js";
|
|
6
|
+
import { useKeyboard as T } from "../../hooks/useKeyboard.js";
|
|
7
|
+
import { usePortalPosition as U } from "../../hooks/usePortalPosition.js";
|
|
8
|
+
const V = G(
|
|
9
|
+
({
|
|
10
|
+
trigger: k,
|
|
11
|
+
children: D,
|
|
12
|
+
align: g = "left",
|
|
13
|
+
className: j,
|
|
14
|
+
style: z,
|
|
15
|
+
id: O,
|
|
16
|
+
onOpen: w,
|
|
17
|
+
onClose: c,
|
|
18
|
+
options: o,
|
|
19
|
+
placeholder: W = "Select...",
|
|
20
|
+
value: y,
|
|
21
|
+
onChange: x,
|
|
22
|
+
error: q = !1,
|
|
23
|
+
fullWidth: s = !0,
|
|
24
|
+
portal: a = !0,
|
|
25
|
+
classes: n
|
|
26
|
+
}, K) => {
|
|
27
|
+
const [r, N] = H(!1), I = b(null), u = b(null), h = b(null), L = J();
|
|
28
|
+
S(() => {
|
|
29
|
+
r && u.current && u.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
|
|
30
|
+
}, [r]);
|
|
31
|
+
const d = v(() => {
|
|
32
|
+
N(!1), c?.(), h.current?.focus();
|
|
33
|
+
}, [c]), M = v(() => {
|
|
34
|
+
N((e) => {
|
|
35
|
+
const m = !e;
|
|
36
|
+
return m ? w?.() : c?.(), m;
|
|
37
|
+
});
|
|
38
|
+
}, [w, c]), A = v(
|
|
39
|
+
(e) => {
|
|
40
|
+
x?.(e), d();
|
|
41
|
+
},
|
|
42
|
+
[x, d]
|
|
43
|
+
);
|
|
44
|
+
S(() => {
|
|
45
|
+
if (!r) return;
|
|
46
|
+
const e = (m) => {
|
|
47
|
+
const P = m.target;
|
|
48
|
+
I.current?.contains(P) || u.current?.contains(P) || d();
|
|
49
|
+
};
|
|
50
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
51
|
+
}, [r, d]), T(
|
|
52
|
+
{
|
|
53
|
+
Escape: () => d()
|
|
54
|
+
},
|
|
55
|
+
r
|
|
56
|
+
);
|
|
57
|
+
const l = U(h, r && a), R = o?.find((e) => e.value === y)?.label, B = o ? R || W : k, C = o && !R, F = o ? o.map((e) => /* @__PURE__ */ f(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
role: "menuitem",
|
|
62
|
+
className: i(
|
|
63
|
+
t.item,
|
|
64
|
+
e.disabled && t.itemDisabled,
|
|
65
|
+
e.value === y && t.itemSelected,
|
|
66
|
+
n?.item
|
|
67
|
+
),
|
|
68
|
+
disabled: e.disabled,
|
|
69
|
+
onClick: () => A(e.value),
|
|
70
|
+
children: e.label
|
|
71
|
+
},
|
|
72
|
+
e.value
|
|
73
|
+
)) : D, E = (e) => /* @__PURE__ */ f(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
ref: u,
|
|
77
|
+
id: L,
|
|
78
|
+
className: i(
|
|
79
|
+
t.menu,
|
|
80
|
+
r && t.menuOpen,
|
|
81
|
+
g === "left" ? t.alignLeft : t.alignRight,
|
|
82
|
+
!a && s && t.fullWidth,
|
|
83
|
+
n?.menu
|
|
84
|
+
),
|
|
85
|
+
style: e,
|
|
86
|
+
role: "menu",
|
|
87
|
+
children: F
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ p(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
ref: K,
|
|
94
|
+
className: i(t.root, s && t.fullWidth, n?.root, j),
|
|
95
|
+
style: z,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ p("div", { ref: I, style: s ? { width: "100%" } : void 0, children: [
|
|
98
|
+
/* @__PURE__ */ p(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
ref: h,
|
|
102
|
+
id: O,
|
|
103
|
+
type: "button",
|
|
104
|
+
className: i(
|
|
105
|
+
t.trigger,
|
|
106
|
+
r && t.triggerOpen,
|
|
107
|
+
q && t.triggerError,
|
|
108
|
+
s && t.fullWidth,
|
|
109
|
+
n?.trigger
|
|
110
|
+
),
|
|
111
|
+
onClick: M,
|
|
112
|
+
"aria-expanded": r,
|
|
113
|
+
"aria-haspopup": "menu",
|
|
114
|
+
"aria-controls": r ? L : void 0,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ f("span", { className: i(t.triggerLabel, C && t.placeholder, n?.triggerLabel), children: B }),
|
|
117
|
+
/* @__PURE__ */ f("span", { className: i(t.chevron, n?.chevron), "aria-hidden": "true" })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
!a && E()
|
|
122
|
+
] }),
|
|
123
|
+
a && r && typeof document < "u" && Q(
|
|
124
|
+
E({
|
|
125
|
+
position: "fixed",
|
|
126
|
+
top: l.top + 4,
|
|
127
|
+
left: g === "right" ? void 0 : l.left,
|
|
128
|
+
right: g === "right" ? window.innerWidth - (l.left + l.width) : void 0,
|
|
129
|
+
minWidth: l.width,
|
|
130
|
+
zIndex: "var(--crk-z-floating)"
|
|
131
|
+
}),
|
|
132
|
+
document.body
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
V.displayName = "Dropdown";
|
|
140
|
+
export {
|
|
141
|
+
V as Dropdown
|
|
142
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const e = "crk-root-an8Cf", r = "crk-fullWidth-S-uVk", t = "crk-trigger-LwPaD", c = "crk-triggerOpen-U4pa9", n = "crk-triggerLabel-QLITs", i = "crk-triggerError-3jlu1", g = "crk-placeholder-fWdch", o = "crk-chevron-jmDNe", l = "crk-menu-fxnKL", s = "crk-menuOpen-HF-Y1", a = "crk-alignLeft-buCDJ", m = "crk-alignRight-05P9w", k = "crk-item-f-Rhh", d = "crk-itemDisabled-L-d6i", h = "crk-itemSelected-Fwmuo", u = {
|
|
2
|
+
root: e,
|
|
3
|
+
fullWidth: r,
|
|
4
|
+
trigger: t,
|
|
5
|
+
triggerOpen: c,
|
|
6
|
+
triggerLabel: n,
|
|
7
|
+
triggerError: i,
|
|
8
|
+
placeholder: g,
|
|
9
|
+
chevron: o,
|
|
10
|
+
menu: l,
|
|
11
|
+
menuOpen: s,
|
|
12
|
+
alignLeft: a,
|
|
13
|
+
alignRight: m,
|
|
14
|
+
item: k,
|
|
15
|
+
itemDisabled: d,
|
|
16
|
+
itemSelected: h
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
a as alignLeft,
|
|
20
|
+
m as alignRight,
|
|
21
|
+
o as chevron,
|
|
22
|
+
u as default,
|
|
23
|
+
r as fullWidth,
|
|
24
|
+
k as item,
|
|
25
|
+
d as itemDisabled,
|
|
26
|
+
h as itemSelected,
|
|
27
|
+
l as menu,
|
|
28
|
+
s as menuOpen,
|
|
29
|
+
g as placeholder,
|
|
30
|
+
e as root,
|
|
31
|
+
t as trigger,
|
|
32
|
+
i as triggerError,
|
|
33
|
+
n as triggerLabel,
|
|
34
|
+
c as triggerOpen
|
|
35
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
import f from "clsx";
|
|
4
|
+
import t from "./Dropdown.module.scss.js";
|
|
5
|
+
const n = i(
|
|
6
|
+
({
|
|
7
|
+
disabled: o = !1,
|
|
8
|
+
className: m,
|
|
9
|
+
children: r,
|
|
10
|
+
...e
|
|
11
|
+
}, p) => /* @__PURE__ */ s(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
ref: p,
|
|
15
|
+
type: "button",
|
|
16
|
+
role: "menuitem",
|
|
17
|
+
className: f(
|
|
18
|
+
t.item,
|
|
19
|
+
o && t.itemDisabled,
|
|
20
|
+
m
|
|
21
|
+
),
|
|
22
|
+
disabled: o,
|
|
23
|
+
...e,
|
|
24
|
+
children: r
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
n.displayName = "DropdownItem";
|
|
29
|
+
export {
|
|
30
|
+
n as DropdownItem
|
|
31
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsxs as y, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as B, useRef as W, useState as K, useId as O } from "react";
|
|
3
|
+
import c from "clsx";
|
|
4
|
+
import n from "./Dropzone.module.scss.js";
|
|
5
|
+
function U(o, s) {
|
|
6
|
+
const t = s.trim().toLowerCase();
|
|
7
|
+
return t ? t.startsWith(".") ? o.name.toLowerCase().endsWith(t) : t.endsWith("/*") ? o.type.toLowerCase().startsWith(t.slice(0, -1)) : o.type.toLowerCase() === t : !0;
|
|
8
|
+
}
|
|
9
|
+
function V(o, s) {
|
|
10
|
+
return s ? s.split(",").some((t) => U(o, t)) : !0;
|
|
11
|
+
}
|
|
12
|
+
const q = B(
|
|
13
|
+
({
|
|
14
|
+
onFiles: o,
|
|
15
|
+
onReject: s,
|
|
16
|
+
accept: t,
|
|
17
|
+
multiple: k = !1,
|
|
18
|
+
maxSize: w,
|
|
19
|
+
disabled: r = !1,
|
|
20
|
+
label: b = "Drag & drop files here, or click to browse",
|
|
21
|
+
hint: m,
|
|
22
|
+
children: h,
|
|
23
|
+
classes: a,
|
|
24
|
+
className: j,
|
|
25
|
+
style: I,
|
|
26
|
+
"aria-label": R = "Upload files"
|
|
27
|
+
}, g) => {
|
|
28
|
+
const C = W(null), [L, d] = K(!1), u = W(0), D = O(), z = (e) => {
|
|
29
|
+
C.current = e, typeof g == "function" ? g(e) : g && (g.current = e);
|
|
30
|
+
}, N = (e) => {
|
|
31
|
+
if (!e || r) return;
|
|
32
|
+
let f = Array.from(e);
|
|
33
|
+
const p = [];
|
|
34
|
+
!k && f.length > 1 && (f.slice(1).forEach((i) => p.push({ file: i, reason: "multiple" })), f = f.slice(0, 1));
|
|
35
|
+
const v = [];
|
|
36
|
+
for (const i of f)
|
|
37
|
+
V(i, t) ? w != null && i.size > w ? p.push({ file: i, reason: "size" }) : v.push(i) : p.push({ file: i, reason: "type" });
|
|
38
|
+
v.length && o?.(v), p.length && s?.(p);
|
|
39
|
+
}, x = () => {
|
|
40
|
+
r || C.current?.click();
|
|
41
|
+
}, E = (e) => {
|
|
42
|
+
r || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), x());
|
|
43
|
+
}, A = (e) => {
|
|
44
|
+
e.preventDefault(), !r && (u.current += 1, d(!0));
|
|
45
|
+
}, M = (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
}, T = (e) => {
|
|
48
|
+
e.preventDefault(), u.current -= 1, u.current <= 0 && (u.current = 0, d(!1));
|
|
49
|
+
}, $ = (e) => {
|
|
50
|
+
e.preventDefault(), u.current = 0, d(!1), r || N(e.dataTransfer?.files ?? null);
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ y(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
role: "button",
|
|
56
|
+
tabIndex: r ? -1 : 0,
|
|
57
|
+
"aria-label": R,
|
|
58
|
+
"aria-disabled": r || void 0,
|
|
59
|
+
"aria-describedby": m ? `${D}-hint` : void 0,
|
|
60
|
+
className: c(
|
|
61
|
+
n.root,
|
|
62
|
+
L && n.dragging,
|
|
63
|
+
r && n.disabled,
|
|
64
|
+
a?.root,
|
|
65
|
+
j
|
|
66
|
+
),
|
|
67
|
+
style: I,
|
|
68
|
+
onClick: x,
|
|
69
|
+
onKeyDown: E,
|
|
70
|
+
onDragEnter: A,
|
|
71
|
+
onDragOver: M,
|
|
72
|
+
onDragLeave: T,
|
|
73
|
+
onDrop: $,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ l(
|
|
76
|
+
"input",
|
|
77
|
+
{
|
|
78
|
+
ref: z,
|
|
79
|
+
id: D,
|
|
80
|
+
type: "file",
|
|
81
|
+
className: c(n.input, a?.input),
|
|
82
|
+
accept: t,
|
|
83
|
+
multiple: k,
|
|
84
|
+
disabled: r,
|
|
85
|
+
tabIndex: -1,
|
|
86
|
+
onChange: (e) => {
|
|
87
|
+
N(e.target.files), e.target.value = "";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
typeof h == "function" ? h({ isDragging: L }) : h ?? /* @__PURE__ */ y("div", { className: c(n.content, a?.content), children: [
|
|
92
|
+
/* @__PURE__ */ l("span", { className: c(n.icon, a?.icon), "aria-hidden": "true", children: /* @__PURE__ */ y("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
93
|
+
/* @__PURE__ */ l("path", { d: "M12 16V4m0 0L8 8m4-4l4 4" }),
|
|
94
|
+
/* @__PURE__ */ l("path", { d: "M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2" })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ l("span", { className: c(n.label, a?.label), children: b }),
|
|
97
|
+
m != null && /* @__PURE__ */ l("span", { id: `${D}-hint`, className: c(n.hint, a?.hint), children: m })
|
|
98
|
+
] })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
q.displayName = "Dropzone";
|
|
105
|
+
export {
|
|
106
|
+
q as Dropzone
|
|
107
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const t = "crk-root-YXMcJ", c = "crk-dragging-wtsfx", n = "crk-disabled-9u5TX", o = "crk-input-1u82w", s = "crk-content-y4GQe", i = "crk-icon--ScxV", r = "crk-label-8as4c", e = "crk-hint-c-HhG", a = {
|
|
2
|
+
root: t,
|
|
3
|
+
dragging: c,
|
|
4
|
+
disabled: n,
|
|
5
|
+
input: o,
|
|
6
|
+
content: s,
|
|
7
|
+
icon: i,
|
|
8
|
+
label: r,
|
|
9
|
+
hint: e
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
s as content,
|
|
13
|
+
a as default,
|
|
14
|
+
n as disabled,
|
|
15
|
+
c as dragging,
|
|
16
|
+
e as hint,
|
|
17
|
+
i as icon,
|
|
18
|
+
o as input,
|
|
19
|
+
r as label,
|
|
20
|
+
t as root
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { FormProvider as x } from "react-hook-form";
|
|
4
|
+
import F from "clsx";
|
|
5
|
+
import r from "./Form.module.scss.js";
|
|
6
|
+
import { FormFieldDefaultsContext as N } from "./formFieldDefaults.js";
|
|
7
|
+
function y({
|
|
8
|
+
form: l,
|
|
9
|
+
onSubmit: s,
|
|
10
|
+
errors: m,
|
|
11
|
+
reserveErrorSpace: t,
|
|
12
|
+
fieldClasses: i,
|
|
13
|
+
className: e,
|
|
14
|
+
style: n,
|
|
15
|
+
children: a
|
|
16
|
+
}) {
|
|
17
|
+
const f = m && m.length > 0, c = p(
|
|
18
|
+
() => ({ reserveErrorSpace: t, classes: i }),
|
|
19
|
+
[t, i]
|
|
20
|
+
);
|
|
21
|
+
return /* @__PURE__ */ o(x, { ...l, children: /* @__PURE__ */ o(N.Provider, { value: c, children: /* @__PURE__ */ h(
|
|
22
|
+
"form",
|
|
23
|
+
{
|
|
24
|
+
onSubmit: l.handleSubmit(s),
|
|
25
|
+
className: F(r.root, t === !1 && r.rootLooseGap, e),
|
|
26
|
+
style: n,
|
|
27
|
+
children: [
|
|
28
|
+
f && /* @__PURE__ */ o("ul", { className: r.formErrors, role: "alert", children: m.map((d, u) => /* @__PURE__ */ o("li", { className: r.formError, children: d }, u)) }),
|
|
29
|
+
a
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
) }) });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
y as Form
|
|
36
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const r = "crk-root-jHIIP", o = "crk-rootLooseGap-NaOGK", e = "crk-formErrors-eh-OP", s = "crk-formError-XEuWv", c = "crk-field-OUlYz", t = "crk-label-udkR7", l = "crk-labelError-LOgKi", a = "crk-required-IYiA2", n = "crk-messageReserve-vTOdL", k = "crk-error-yFZXm", m = "crk-helperText-Dm-rb", f = "crk-row-nNbx-", E = {
|
|
2
|
+
root: r,
|
|
3
|
+
rootLooseGap: o,
|
|
4
|
+
formErrors: e,
|
|
5
|
+
formError: s,
|
|
6
|
+
field: c,
|
|
7
|
+
label: t,
|
|
8
|
+
labelError: l,
|
|
9
|
+
required: a,
|
|
10
|
+
messageReserve: n,
|
|
11
|
+
error: k,
|
|
12
|
+
helperText: m,
|
|
13
|
+
row: f
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
E as default,
|
|
17
|
+
k as error,
|
|
18
|
+
c as field,
|
|
19
|
+
s as formError,
|
|
20
|
+
e as formErrors,
|
|
21
|
+
m as helperText,
|
|
22
|
+
t as label,
|
|
23
|
+
l as labelError,
|
|
24
|
+
n as messageReserve,
|
|
25
|
+
a as required,
|
|
26
|
+
r as root,
|
|
27
|
+
o as rootLooseGap,
|
|
28
|
+
f as row
|
|
29
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as g, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as V, useRef as j, useCallback as B, cloneElement as T } from "react";
|
|
3
|
+
import { useFormContext as k, useController as q } from "react-hook-form";
|
|
4
|
+
import n from "clsx";
|
|
5
|
+
import t from "./Form.module.scss.js";
|
|
6
|
+
import { FormFieldDefaultsContext as w } from "./formFieldDefaults.js";
|
|
7
|
+
const H = /* @__PURE__ */ new Set([
|
|
8
|
+
"Select",
|
|
9
|
+
"NativeSelect",
|
|
10
|
+
"SearchableSelect",
|
|
11
|
+
"MultiSelect",
|
|
12
|
+
"Dropdown"
|
|
13
|
+
]);
|
|
14
|
+
function L({
|
|
15
|
+
name: e,
|
|
16
|
+
label: f,
|
|
17
|
+
helperText: d,
|
|
18
|
+
required: v,
|
|
19
|
+
rules: x,
|
|
20
|
+
reserveErrorSpace: y,
|
|
21
|
+
classes: o,
|
|
22
|
+
className: S,
|
|
23
|
+
style: N,
|
|
24
|
+
children: p
|
|
25
|
+
}) {
|
|
26
|
+
const { control: C } = k(), { field: R, fieldState: r } = q({ name: e, control: C, rules: x }), h = V(w), l = y ?? h?.reserveErrorSpace ?? !0, s = h?.classes, m = p.type, E = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", F = H.has(E), { ref: b, ...a } = R, u = j(b);
|
|
27
|
+
u.current = b;
|
|
28
|
+
const $ = B(
|
|
29
|
+
(i) => {
|
|
30
|
+
if (i) {
|
|
31
|
+
const D = i.matches("input, select, textarea, button, [tabindex]") ? i : i.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
|
|
32
|
+
u.current(D ?? i);
|
|
33
|
+
} else
|
|
34
|
+
u.current(null);
|
|
35
|
+
},
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ g("div", { className: n(t.field, s?.field, o?.field, S), style: N, children: [
|
|
40
|
+
f && /* @__PURE__ */ g("label", { className: n(t.label, r.error && t.labelError, s?.label, o?.label), htmlFor: e, children: [
|
|
41
|
+
f,
|
|
42
|
+
v && /* @__PURE__ */ c("span", { className: t.required, children: "*" })
|
|
43
|
+
] }),
|
|
44
|
+
T(p, {
|
|
45
|
+
...a,
|
|
46
|
+
ref: $,
|
|
47
|
+
id: e,
|
|
48
|
+
error: !!r.error,
|
|
49
|
+
"aria-invalid": r.error ? !0 : void 0,
|
|
50
|
+
// Error and helper text can both be present now — describe by whichever exist.
|
|
51
|
+
"aria-describedby": [r.error?.message ? `${e}-error` : null, d ? `${e}-helper` : null].filter(Boolean).join(" ") || void 0,
|
|
52
|
+
// Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
|
|
53
|
+
// Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
|
|
54
|
+
// handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
|
|
55
|
+
...F && {
|
|
56
|
+
onValueChange: a.onChange,
|
|
57
|
+
onValuesChange: a.onChange
|
|
58
|
+
},
|
|
59
|
+
// Bridge for Checkbox (expects checked, not value)
|
|
60
|
+
checked: typeof a.value == "boolean" ? a.value : void 0
|
|
61
|
+
}),
|
|
62
|
+
r.error?.message && /* @__PURE__ */ c("span", { id: `${e}-error`, className: n(t.error, s?.error, o?.error), role: "alert", children: r.error.message }),
|
|
63
|
+
d && /* @__PURE__ */ c("span", { id: `${e}-helper`, className: n(t.helperText, s?.helperText, o?.helperText), children: d }),
|
|
64
|
+
l !== !1 && !r.error?.message && /* @__PURE__ */ c(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
className: n(t.messageReserve, s?.message, o?.message),
|
|
69
|
+
style: typeof l == "number" ? { minHeight: `${l}px` } : typeof l == "string" ? { minHeight: l } : void 0
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
L as FormField
|
|
76
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import s from "clsx";
|
|
3
|
+
import i from "./Form.module.scss.js";
|
|
4
|
+
function c({ children: o, className: r, style: m }) {
|
|
5
|
+
return /* @__PURE__ */ t("div", { className: s(i.row, r), style: m, children: o });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
c as FormRow
|
|
9
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import f from "clsx";
|
|
4
|
+
import r from "./Link.module.scss.js";
|
|
5
|
+
const h = c(
|
|
6
|
+
({
|
|
7
|
+
variant: t = "default",
|
|
8
|
+
external: a = !1,
|
|
9
|
+
hideExternalIcon: l = !1,
|
|
10
|
+
className: i,
|
|
11
|
+
style: d,
|
|
12
|
+
children: m,
|
|
13
|
+
...o
|
|
14
|
+
}, p) => {
|
|
15
|
+
const n = a || o.target === "_blank";
|
|
16
|
+
return /* @__PURE__ */ s(
|
|
17
|
+
"a",
|
|
18
|
+
{
|
|
19
|
+
ref: p,
|
|
20
|
+
className: f(r.root, r[t], i),
|
|
21
|
+
style: d,
|
|
22
|
+
...a && {
|
|
23
|
+
target: "_blank",
|
|
24
|
+
rel: "noopener noreferrer"
|
|
25
|
+
},
|
|
26
|
+
...o,
|
|
27
|
+
children: [
|
|
28
|
+
m,
|
|
29
|
+
n && !l && /* @__PURE__ */ s(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
className: r.externalIcon,
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
width: "1em",
|
|
35
|
+
height: "1em",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
strokeWidth: "2",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
focusable: "false",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ e("path", { d: "M14 3h7v7" }),
|
|
45
|
+
/* @__PURE__ */ e("path", { d: "M21 3l-9 9" }),
|
|
46
|
+
/* @__PURE__ */ e("path", { d: "M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5" })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
n && /* @__PURE__ */ e("span", { className: r.srOnly, children: " (opens in a new tab)" })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
h.displayName = "Link";
|
|
57
|
+
export {
|
|
58
|
+
h as Link
|
|
59
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const r = "crk-root-2j4Vp", t = "crk-muted-vReNc", n = "crk-danger-ugf9r", e = "crk-externalIcon-nNu5J", c = "crk-srOnly-LGQgs", o = {
|
|
2
|
+
root: r,
|
|
3
|
+
default: "crk-default-3TBlr",
|
|
4
|
+
muted: t,
|
|
5
|
+
danger: n,
|
|
6
|
+
externalIcon: e,
|
|
7
|
+
srOnly: c
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
n as danger,
|
|
11
|
+
o as default,
|
|
12
|
+
e as externalIcon,
|
|
13
|
+
t as muted,
|
|
14
|
+
r as root,
|
|
15
|
+
c as srOnly
|
|
16
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as a } from "react";
|
|
3
|
+
import l from "clsx";
|
|
4
|
+
import o from "./List.module.scss.js";
|
|
5
|
+
const c = a(
|
|
6
|
+
({
|
|
7
|
+
variant: r = "unordered",
|
|
8
|
+
spacing: t = "md",
|
|
9
|
+
className: s,
|
|
10
|
+
style: e,
|
|
11
|
+
children: m,
|
|
12
|
+
...d
|
|
13
|
+
}, p) => /* @__PURE__ */ i(
|
|
14
|
+
r === "ordered" ? "ol" : "ul",
|
|
15
|
+
{
|
|
16
|
+
ref: p,
|
|
17
|
+
className: l(
|
|
18
|
+
o.root,
|
|
19
|
+
o[r],
|
|
20
|
+
o[t],
|
|
21
|
+
s
|
|
22
|
+
),
|
|
23
|
+
style: e,
|
|
24
|
+
...d,
|
|
25
|
+
children: m
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
c.displayName = "List";
|
|
30
|
+
const f = a(
|
|
31
|
+
({ className: r, style: t, children: s, ...e }, m) => /* @__PURE__ */ i(
|
|
32
|
+
"li",
|
|
33
|
+
{
|
|
34
|
+
ref: m,
|
|
35
|
+
className: l(o.item, r),
|
|
36
|
+
style: t,
|
|
37
|
+
...e,
|
|
38
|
+
children: s
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
f.displayName = "ListItem";
|
|
43
|
+
export {
|
|
44
|
+
c as List,
|
|
45
|
+
f as ListItem
|
|
46
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const o = "crk-root-PVrgx", r = "crk-unordered-FhCWT", e = "crk-item-TfW82", c = "crk-ordered-8x4YC", n = "crk-none-f03Kx", t = "crk-sm-Rg4Mv", d = "crk-md-X4Icb", s = "crk-lg-JjNKZ", m = {
|
|
2
|
+
root: o,
|
|
3
|
+
unordered: r,
|
|
4
|
+
item: e,
|
|
5
|
+
ordered: c,
|
|
6
|
+
none: n,
|
|
7
|
+
sm: t,
|
|
8
|
+
md: d,
|
|
9
|
+
lg: s
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
m as default,
|
|
13
|
+
e as item,
|
|
14
|
+
s as lg,
|
|
15
|
+
d as md,
|
|
16
|
+
n as none,
|
|
17
|
+
c as ordered,
|
|
18
|
+
o as root,
|
|
19
|
+
t as sm,
|
|
20
|
+
r as unordered
|
|
21
|
+
};
|