@overdoser/react-toolkit 0.7.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/components/ActionButton/ActionButton.js +211 -0
  3. package/components/ActionButton/ActionButton.module.scss.js +47 -0
  4. package/components/ActionButton/CopyButton.js +66 -0
  5. package/components/Alert/Alert.js +82 -0
  6. package/components/Alert/Alert.module.scss.js +25 -0
  7. package/components/Avatar/Avatar.js +57 -0
  8. package/components/Avatar/Avatar.module.scss.js +43 -0
  9. package/components/Badge/Badge.js +38 -0
  10. package/components/Badge/Badge.module.scss.js +31 -0
  11. package/components/Breadcrumbs/Breadcrumbs.js +49 -0
  12. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +17 -0
  13. package/components/Button/Button.js +57 -0
  14. package/components/Button/Button.module.scss.js +47 -0
  15. package/components/Chart/AreaChart.js +244 -0
  16. package/components/Chart/Axis.js +45 -0
  17. package/components/Chart/BarChart.js +353 -0
  18. package/components/Chart/Chart.module.scss.js +61 -0
  19. package/components/Chart/ChartContainer.js +41 -0
  20. package/components/Chart/ChartLegend.js +31 -0
  21. package/components/Chart/ChartTooltip.js +42 -0
  22. package/components/Chart/LineChart.js +236 -0
  23. package/components/Chart/PieChart.js +248 -0
  24. package/components/Chart/RadarChart.js +221 -0
  25. package/components/Chart/Sparkline.js +69 -0
  26. package/components/Chart/TradingChart.js +732 -0
  27. package/components/Chart/scales.js +39 -0
  28. package/components/Chart/trading/indicators.js +68 -0
  29. package/components/Chart/trading/period.js +71 -0
  30. package/components/Chart/useChartDimensions.js +23 -0
  31. package/components/Divider/Divider.js +36 -0
  32. package/components/Divider/Divider.module.scss.js +31 -0
  33. package/components/Draggable/Draggable.js +155 -0
  34. package/components/Draggable/Draggable.module.scss.js +17 -0
  35. package/components/Drawer/Drawer.js +126 -0
  36. package/components/Drawer/Drawer.module.scss.js +117 -0
  37. package/components/Dropdown/Dropdown.js +142 -0
  38. package/components/Dropdown/Dropdown.module.scss.js +35 -0
  39. package/components/Dropdown/DropdownItem.js +31 -0
  40. package/components/Dropzone/Dropzone.js +107 -0
  41. package/components/Dropzone/Dropzone.module.scss.js +21 -0
  42. package/components/Form/Form.js +36 -0
  43. package/components/Form/Form.module.scss.js +29 -0
  44. package/components/Form/FormField.js +76 -0
  45. package/components/Form/FormRow.js +9 -0
  46. package/components/Form/formFieldDefaults.js +5 -0
  47. package/components/Link/Link.js +59 -0
  48. package/components/Link/Link.module.scss.js +16 -0
  49. package/components/List/List.js +46 -0
  50. package/components/List/List.module.scss.js +21 -0
  51. package/components/Modal/Modal.js +109 -0
  52. package/components/Modal/Modal.module.scss.js +31 -0
  53. package/components/Pagination/Pagination.js +84 -0
  54. package/components/Pagination/Pagination.module.scss.js +23 -0
  55. package/components/Pagination/paginationRange.js +24 -0
  56. package/components/Popover/Popover.js +138 -0
  57. package/components/Popover/Popover.module.scss.js +21 -0
  58. package/components/Skeleton/Skeleton.js +50 -0
  59. package/components/Skeleton/Skeleton.module.scss.js +25 -0
  60. package/components/Spinner/Spinner.js +25 -0
  61. package/components/Spinner/Spinner.module.scss.js +20 -0
  62. package/components/Table/Table.js +284 -0
  63. package/components/Table/Table.module.scss.js +59 -0
  64. package/components/Table/useTableSort.js +44 -0
  65. package/components/Tabs/Tabs.js +163 -0
  66. package/components/Tabs/Tabs.module.scss.js +53 -0
  67. package/components/Timer/Timer.js +159 -0
  68. package/components/Timer/Timer.module.scss.js +55 -0
  69. package/components/Toast/Toast.js +133 -0
  70. package/components/Toast/Toast.module.scss.js +62 -0
  71. package/components/Toast/toastStore.js +62 -0
  72. package/components/ToggleIconButton/ToggleIconButton.js +58 -0
  73. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +27 -0
  74. package/components/Tooltip/Tooltip.js +86 -0
  75. package/components/Tooltip/Tooltip.module.scss.js +30 -0
  76. package/components/Typography/Typography.js +37 -0
  77. package/components/Typography/Typography.module.scss.js +53 -0
  78. package/components/inputs/Checkbox/Checkbox.js +50 -0
  79. package/components/inputs/Checkbox/Checkbox.module.scss.js +15 -0
  80. package/components/inputs/Checkbox/CheckboxGroup.js +111 -0
  81. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +31 -0
  82. package/components/inputs/DatePicker/DatePicker.js +229 -0
  83. package/components/inputs/DatePicker/DatePicker.module.scss.js +45 -0
  84. package/components/inputs/DatePicker/dateUtils.js +41 -0
  85. package/components/inputs/Input/Input.js +50 -0
  86. package/components/inputs/Input/Input.module.scss.js +25 -0
  87. package/components/inputs/NumberInput/NumberInput.js +134 -0
  88. package/components/inputs/NumberInput/NumberInput.module.scss.js +25 -0
  89. package/components/inputs/Radio/Radio.js +68 -0
  90. package/components/inputs/Radio/Radio.module.scss.js +13 -0
  91. package/components/inputs/Select/Select.js +520 -0
  92. package/components/inputs/Select/Select.module.scss.js +69 -0
  93. package/components/inputs/Slider/Slider.js +128 -0
  94. package/components/inputs/Slider/Slider.module.scss.js +15 -0
  95. package/components/inputs/Textarea/Textarea.js +58 -0
  96. package/components/inputs/Textarea/Textarea.module.scss.js +25 -0
  97. package/hooks/useClickOutside.js +15 -0
  98. package/hooks/useFocusTrap.js +39 -0
  99. package/hooks/useKeyboard.js +19 -0
  100. package/hooks/usePortalPosition.js +20 -0
  101. package/index.css +1 -1
  102. package/index.js +119 -7000
  103. package/index.layered.css +1 -1
  104. package/package.json +3 -2
@@ -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
+ };
@@ -0,0 +1,13 @@
1
+ const o = "crk-group-NNwCD", t = "crk-root-7fGik", r = "crk-input-43PQW", c = "crk-label-aW30x", l = {
2
+ group: o,
3
+ root: t,
4
+ input: r,
5
+ label: c
6
+ };
7
+ export {
8
+ l as default,
9
+ o as group,
10
+ r as input,
11
+ c as label,
12
+ t as root
13
+ };