@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,69 @@
|
|
|
1
|
+
import { jsxs as B, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as C, useMemo as H } from "react";
|
|
3
|
+
import R from "clsx";
|
|
4
|
+
import { extent as Z, linearScale as j } from "./scales.js";
|
|
5
|
+
import d from "./Chart.module.scss.js";
|
|
6
|
+
function q(n, o) {
|
|
7
|
+
if (n.length === 0) return "";
|
|
8
|
+
if (n.length === 1 || o === "linear")
|
|
9
|
+
return n.map((e, a) => `${a === 0 ? "M" : "L"} ${e.x} ${e.y}`).join(" ");
|
|
10
|
+
let t = `M ${n[0].x} ${n[0].y}`;
|
|
11
|
+
for (let e = 0; e < n.length - 1; e++) {
|
|
12
|
+
const a = n[e - 1] ?? n[e], c = n[e], r = n[e + 1], x = n[e + 2] ?? r, m = c.x + (r.x - a.x) / 6, i = c.y + (r.y - a.y) / 6, y = r.x - (x.x - c.x) / 6, $ = r.y - (x.y - c.y) / 6;
|
|
13
|
+
t += ` C ${m} ${i}, ${y} ${$}, ${r.x} ${r.y}`;
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
const z = C(
|
|
18
|
+
({
|
|
19
|
+
data: n,
|
|
20
|
+
width: o = 80,
|
|
21
|
+
height: t = 24,
|
|
22
|
+
color: e = "var(--crk-chart-1)",
|
|
23
|
+
strokeWidth: a = 1.5,
|
|
24
|
+
curve: c = "monotone",
|
|
25
|
+
fill: r = !1,
|
|
26
|
+
showLastPoint: x = !1,
|
|
27
|
+
"aria-label": m,
|
|
28
|
+
className: i,
|
|
29
|
+
style: y
|
|
30
|
+
}, $) => {
|
|
31
|
+
const { line: g, area: M, last: f } = H(() => {
|
|
32
|
+
if (n.length === 0) return { line: "", area: "", last: null };
|
|
33
|
+
const l = a, k = Math.max(1, o - l * 2), p = Math.max(1, t - l * 2), [h, D] = Z(n), S = j([0, Math.max(1, n.length - 1)], [l, l + k]), b = j([h, D], [l + p, l]), s = n.map((N, V) => ({ x: S(V), y: b(N) })), L = q(s, c), v = r ? `${L} L ${s[s.length - 1].x} ${l + p} L ${s[0].x} ${l + p} Z` : "";
|
|
34
|
+
return { line: L, area: v, last: s[s.length - 1] };
|
|
35
|
+
}, [n, o, t, a, c, r]);
|
|
36
|
+
return /* @__PURE__ */ B(
|
|
37
|
+
"svg",
|
|
38
|
+
{
|
|
39
|
+
ref: $,
|
|
40
|
+
className: R(d.sparkline, i),
|
|
41
|
+
style: y,
|
|
42
|
+
width: o,
|
|
43
|
+
height: t,
|
|
44
|
+
viewBox: `0 0 ${o} ${t}`,
|
|
45
|
+
role: "img",
|
|
46
|
+
"aria-label": m,
|
|
47
|
+
children: [
|
|
48
|
+
r && M && /* @__PURE__ */ u("path", { d: M, fill: e, opacity: 0.18 }),
|
|
49
|
+
g && /* @__PURE__ */ u(
|
|
50
|
+
"path",
|
|
51
|
+
{
|
|
52
|
+
d: g,
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: e,
|
|
55
|
+
strokeWidth: a,
|
|
56
|
+
strokeLinejoin: "round",
|
|
57
|
+
strokeLinecap: "round"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
x && f && /* @__PURE__ */ u("circle", { cx: f.x, cy: f.y, r: a + 1, fill: e })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
z.displayName = "Sparkline";
|
|
67
|
+
export {
|
|
68
|
+
z as Sparkline
|
|
69
|
+
};
|