@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,41 @@
|
|
|
1
|
+
function f(t) {
|
|
2
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
3
|
+
}
|
|
4
|
+
function s(t, e) {
|
|
5
|
+
return !t || !e ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
|
|
6
|
+
}
|
|
7
|
+
function i(t, e) {
|
|
8
|
+
return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
|
|
9
|
+
}
|
|
10
|
+
function a(t, e) {
|
|
11
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate() + e);
|
|
12
|
+
}
|
|
13
|
+
function D(t, e) {
|
|
14
|
+
return new Date(t.getFullYear(), t.getMonth() + e, 1);
|
|
15
|
+
}
|
|
16
|
+
function l(t) {
|
|
17
|
+
return new Date(t.getFullYear(), t.getMonth(), 1);
|
|
18
|
+
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
const e = (n) => String(n).padStart(2, "0");
|
|
21
|
+
return `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`;
|
|
22
|
+
}
|
|
23
|
+
function h(t, e) {
|
|
24
|
+
const n = l(t), r = (n.getDay() - e + 7) % 7, o = a(n, -r);
|
|
25
|
+
return Array.from({ length: 42 }, (u, g) => a(o, g));
|
|
26
|
+
}
|
|
27
|
+
function M(t, e) {
|
|
28
|
+
const n = new Intl.DateTimeFormat(t, { weekday: "short" }), r = new Date(2023, 0, 1);
|
|
29
|
+
return Array.from({ length: 7 }, (o, u) => n.format(a(r, (e + u) % 7)));
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
a as addDays,
|
|
33
|
+
D as addMonths,
|
|
34
|
+
h as buildCalendarDays,
|
|
35
|
+
s as isSameDay,
|
|
36
|
+
i as isSameMonth,
|
|
37
|
+
f as startOfDay,
|
|
38
|
+
l as startOfMonth,
|
|
39
|
+
c as toISODate,
|
|
40
|
+
M as weekdayLabels
|
|
41
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import r from "./Input.module.scss.js";
|
|
5
|
+
const u = N(
|
|
6
|
+
({
|
|
7
|
+
inputSize: e = "md",
|
|
8
|
+
error: p = !1,
|
|
9
|
+
prefix: o,
|
|
10
|
+
suffix: t,
|
|
11
|
+
classes: m,
|
|
12
|
+
className: d,
|
|
13
|
+
style: l,
|
|
14
|
+
...i
|
|
15
|
+
}, c) => {
|
|
16
|
+
const s = /* @__PURE__ */ n(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
ref: c,
|
|
20
|
+
className: a(
|
|
21
|
+
r.root,
|
|
22
|
+
r[e],
|
|
23
|
+
p && r.error,
|
|
24
|
+
o && r.hasPrefix,
|
|
25
|
+
t && r.hasSuffix,
|
|
26
|
+
m?.root,
|
|
27
|
+
!o && !t && d
|
|
28
|
+
),
|
|
29
|
+
style: !o && !t ? l : void 0,
|
|
30
|
+
...i
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
return o || t ? /* @__PURE__ */ h(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: a(r.wrapper, r[e], p && r.error, m?.wrapper, d),
|
|
37
|
+
style: l,
|
|
38
|
+
children: [
|
|
39
|
+
o && /* @__PURE__ */ n("span", { className: a(r.prefix, m?.prefix), children: o }),
|
|
40
|
+
s,
|
|
41
|
+
t && /* @__PURE__ */ n("span", { className: a(r.suffix, m?.suffix), children: t })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) : s;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
u.displayName = "Input";
|
|
48
|
+
export {
|
|
49
|
+
u as Input
|
|
50
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const r = "crk-root-rSgdy", s = "crk-wrapper-GHy8V", c = "crk-sm-DptM5", f = "crk-md-F4B0G", o = "crk-lg-pBxwX", t = "crk-error-fucxe", e = "crk-prefix-w53Md", x = "crk-suffix-fcNgR", i = "crk-hasPrefix--bqPD", n = "crk-hasSuffix-zO0nX", p = {
|
|
2
|
+
root: r,
|
|
3
|
+
wrapper: s,
|
|
4
|
+
sm: c,
|
|
5
|
+
md: f,
|
|
6
|
+
lg: o,
|
|
7
|
+
error: t,
|
|
8
|
+
prefix: e,
|
|
9
|
+
suffix: x,
|
|
10
|
+
hasPrefix: i,
|
|
11
|
+
hasSuffix: n
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
p as default,
|
|
15
|
+
t as error,
|
|
16
|
+
i as hasPrefix,
|
|
17
|
+
n as hasSuffix,
|
|
18
|
+
o as lg,
|
|
19
|
+
f as md,
|
|
20
|
+
e as prefix,
|
|
21
|
+
r as root,
|
|
22
|
+
c as sm,
|
|
23
|
+
x as suffix,
|
|
24
|
+
s as wrapper
|
|
25
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsxs as S, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as T, useState as U, useRef as V, useEffect as q, useCallback as M } from "react";
|
|
3
|
+
import f from "clsx";
|
|
4
|
+
import r from "./NumberInput.module.scss.js";
|
|
5
|
+
const g = (n) => {
|
|
6
|
+
if (n.trim() === "") return null;
|
|
7
|
+
const p = Number(n);
|
|
8
|
+
return Number.isNaN(p) ? null : p;
|
|
9
|
+
}, z = T(
|
|
10
|
+
({
|
|
11
|
+
value: n,
|
|
12
|
+
defaultValue: p,
|
|
13
|
+
onChange: b,
|
|
14
|
+
min: o,
|
|
15
|
+
max: s,
|
|
16
|
+
step: x = 1,
|
|
17
|
+
precision: k,
|
|
18
|
+
inputSize: j = "md",
|
|
19
|
+
error: D = !1,
|
|
20
|
+
hideControls: B = !1,
|
|
21
|
+
disabled: l,
|
|
22
|
+
classes: d,
|
|
23
|
+
className: L,
|
|
24
|
+
style: R,
|
|
25
|
+
onKeyDown: A,
|
|
26
|
+
onBlur: F,
|
|
27
|
+
...C
|
|
28
|
+
}, K) => {
|
|
29
|
+
const u = n !== void 0, I = (u ? n : p) ?? null, [v, m] = U(I != null ? String(I) : ""), N = V(!1), a = u ? n ?? null : g(v);
|
|
30
|
+
q(() => {
|
|
31
|
+
u && !N.current && m(n != null ? String(n) : "");
|
|
32
|
+
}, [u, n]);
|
|
33
|
+
const y = M(
|
|
34
|
+
(t) => {
|
|
35
|
+
let e = t;
|
|
36
|
+
if (o != null && (e = Math.max(o, e)), s != null && (e = Math.min(s, e)), k != null) {
|
|
37
|
+
const c = 10 ** k;
|
|
38
|
+
e = Math.round(e * c) / c;
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
},
|
|
42
|
+
[o, s, k]
|
|
43
|
+
), w = M(
|
|
44
|
+
(t) => {
|
|
45
|
+
u || m(t != null ? String(t) : ""), b?.(t);
|
|
46
|
+
},
|
|
47
|
+
[u, b]
|
|
48
|
+
), h = M(
|
|
49
|
+
(t) => {
|
|
50
|
+
if (l) return;
|
|
51
|
+
w(y((a ?? o ?? 0) + t * x));
|
|
52
|
+
},
|
|
53
|
+
[l, a, o, x, y, w]
|
|
54
|
+
), W = s != null && a != null && a >= s, E = o != null && a != null && a <= o, P = (t) => {
|
|
55
|
+
A?.(t), !t.defaultPrevented && (t.key === "ArrowUp" ? (t.preventDefault(), h(1)) : t.key === "ArrowDown" && (t.preventDefault(), h(-1)));
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ S(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: f(
|
|
61
|
+
r.root,
|
|
62
|
+
r[j],
|
|
63
|
+
D && r.error,
|
|
64
|
+
l && r.disabled,
|
|
65
|
+
d?.root,
|
|
66
|
+
L
|
|
67
|
+
),
|
|
68
|
+
style: R,
|
|
69
|
+
"data-disabled": l || void 0,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ i(
|
|
72
|
+
"input",
|
|
73
|
+
{
|
|
74
|
+
ref: K,
|
|
75
|
+
type: "text",
|
|
76
|
+
inputMode: "decimal",
|
|
77
|
+
className: f(r.input, d?.input),
|
|
78
|
+
value: v,
|
|
79
|
+
disabled: l,
|
|
80
|
+
"aria-invalid": D || void 0,
|
|
81
|
+
onChange: (t) => {
|
|
82
|
+
m(t.target.value), b?.(g(t.target.value));
|
|
83
|
+
},
|
|
84
|
+
onKeyDown: P,
|
|
85
|
+
onFocus: (t) => {
|
|
86
|
+
N.current = !0, C.onFocus?.(t);
|
|
87
|
+
},
|
|
88
|
+
onBlur: (t) => {
|
|
89
|
+
N.current = !1;
|
|
90
|
+
const e = g(v);
|
|
91
|
+
if (e != null) {
|
|
92
|
+
const c = y(e);
|
|
93
|
+
c !== e ? w(c) : m(String(c));
|
|
94
|
+
}
|
|
95
|
+
F?.(t);
|
|
96
|
+
},
|
|
97
|
+
...C
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
!B && /* @__PURE__ */ S("div", { className: f(r.controls, d?.controls), children: [
|
|
101
|
+
/* @__PURE__ */ i(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
tabIndex: -1,
|
|
106
|
+
className: f(r.increment, d?.increment),
|
|
107
|
+
onClick: () => h(1),
|
|
108
|
+
disabled: l || W,
|
|
109
|
+
"aria-label": "Increment",
|
|
110
|
+
children: /* @__PURE__ */ i("svg", { viewBox: "0 0 10 6", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M1 5l4-4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ i(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
type: "button",
|
|
117
|
+
tabIndex: -1,
|
|
118
|
+
className: f(r.decrement, d?.decrement),
|
|
119
|
+
onClick: () => h(-1),
|
|
120
|
+
disabled: l || E,
|
|
121
|
+
"aria-label": "Decrement",
|
|
122
|
+
children: /* @__PURE__ */ i("svg", { viewBox: "0 0 10 6", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M1 1l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
z.displayName = "NumberInput";
|
|
132
|
+
export {
|
|
133
|
+
z as NumberInput
|
|
134
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const r = "crk-root-aUI4c", c = "crk-sm-t2zR2", t = "crk-input-82UG6", n = "crk-md-v4bFw", o = "crk-lg-mr8pf", e = "crk-controls-0vTT8", s = "crk-increment-nc4uY", m = "crk-decrement-076EO", d = "crk-error-1BkEa", k = "crk-disabled-mk7uC", l = {
|
|
2
|
+
root: r,
|
|
3
|
+
sm: c,
|
|
4
|
+
input: t,
|
|
5
|
+
md: n,
|
|
6
|
+
lg: o,
|
|
7
|
+
controls: e,
|
|
8
|
+
increment: s,
|
|
9
|
+
decrement: m,
|
|
10
|
+
error: d,
|
|
11
|
+
disabled: k
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
e as controls,
|
|
15
|
+
m as decrement,
|
|
16
|
+
l as default,
|
|
17
|
+
k as disabled,
|
|
18
|
+
d as error,
|
|
19
|
+
s as increment,
|
|
20
|
+
t as input,
|
|
21
|
+
o as lg,
|
|
22
|
+
n as md,
|
|
23
|
+
r as root,
|
|
24
|
+
c as sm
|
|
25
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, useContext as y, createContext as R } from "react";
|
|
3
|
+
import l from "clsx";
|
|
4
|
+
import n from "./Radio.module.scss.js";
|
|
5
|
+
const b = R(null), v = ({
|
|
6
|
+
name: o,
|
|
7
|
+
value: e,
|
|
8
|
+
onChange: a,
|
|
9
|
+
className: i,
|
|
10
|
+
style: d,
|
|
11
|
+
children: s,
|
|
12
|
+
id: p,
|
|
13
|
+
"aria-label": c,
|
|
14
|
+
"aria-labelledby": m,
|
|
15
|
+
required: u
|
|
16
|
+
}) => /* @__PURE__ */ t(b.Provider, { value: { name: o, value: e, onChange: a }, children: /* @__PURE__ */ t(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
id: p,
|
|
20
|
+
className: l(n.group, i),
|
|
21
|
+
style: d,
|
|
22
|
+
role: "radiogroup",
|
|
23
|
+
tabIndex: -1,
|
|
24
|
+
"aria-label": c,
|
|
25
|
+
"aria-labelledby": m,
|
|
26
|
+
"aria-required": u || void 0,
|
|
27
|
+
children: s
|
|
28
|
+
}
|
|
29
|
+
) });
|
|
30
|
+
v.displayName = "RadioGroup";
|
|
31
|
+
const G = g(
|
|
32
|
+
({
|
|
33
|
+
label: o,
|
|
34
|
+
value: e,
|
|
35
|
+
classes: a,
|
|
36
|
+
className: i,
|
|
37
|
+
style: d,
|
|
38
|
+
onChange: s,
|
|
39
|
+
checked: p,
|
|
40
|
+
name: c,
|
|
41
|
+
...m
|
|
42
|
+
}, u) => {
|
|
43
|
+
const r = y(b), h = r?.name ?? c, x = r ? r.value === e : p, C = (N) => {
|
|
44
|
+
r?.onChange?.(e), s?.(N);
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ f("label", { className: l(n.root, a?.root, i), style: d, children: [
|
|
47
|
+
/* @__PURE__ */ t(
|
|
48
|
+
"input",
|
|
49
|
+
{
|
|
50
|
+
ref: u,
|
|
51
|
+
type: "radio",
|
|
52
|
+
className: l(n.input, a?.input),
|
|
53
|
+
name: h,
|
|
54
|
+
value: e,
|
|
55
|
+
checked: x,
|
|
56
|
+
onChange: C,
|
|
57
|
+
...m
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
o && /* @__PURE__ */ t("span", { className: l(n.label, a?.label), children: o })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
G.displayName = "Radio";
|
|
65
|
+
export {
|
|
66
|
+
G as Radio,
|
|
67
|
+
v as RadioGroup
|
|
68
|
+
};
|