@overdoser/react-toolkit 0.20.0 → 0.22.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 +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,109 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
) : B;
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
_.displayName = "Input";
|
|
107
|
-
export {
|
|
108
|
-
_ as Input
|
|
109
|
-
};
|
|
1
|
+
import { forwardRef as e, useCallback as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./Input.module.scss.js";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
// src/components/inputs/Input/Input.tsx
|
|
6
|
+
var c = /* @__PURE__ */ s("svg", {
|
|
7
|
+
viewBox: "0 0 20 20",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "1.6",
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
children: [/* @__PURE__ */ o("path", {
|
|
13
|
+
d: "M1.5 10S4.5 4.5 10 4.5 18.5 10 18.5 10 15.5 15.5 10 15.5 1.5 10 1.5 10z",
|
|
14
|
+
strokeLinejoin: "round"
|
|
15
|
+
}), /* @__PURE__ */ o("circle", {
|
|
16
|
+
cx: "10",
|
|
17
|
+
cy: "10",
|
|
18
|
+
r: "2.5"
|
|
19
|
+
})]
|
|
20
|
+
}), l = /* @__PURE__ */ s("svg", {
|
|
21
|
+
viewBox: "0 0 20 20",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: "1.6",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
children: [/* @__PURE__ */ o("path", {
|
|
27
|
+
d: "M3 3l14 14",
|
|
28
|
+
strokeLinecap: "round"
|
|
29
|
+
}), /* @__PURE__ */ o("path", {
|
|
30
|
+
d: "M8.2 5.1A8.6 8.6 0 0110 4.9c5.5 0 8.5 5.1 8.5 5.1a14.4 14.4 0 01-2.6 3.1M11.9 11.9a2.5 2.5 0 01-3.6-3.5M5.1 6.3C2.8 7.9 1.5 10 1.5 10S4.5 15.1 10 15.1c1.2 0 2.3-.2 3.3-.6",
|
|
31
|
+
strokeLinecap: "round",
|
|
32
|
+
strokeLinejoin: "round"
|
|
33
|
+
})]
|
|
34
|
+
}), u = /* @__PURE__ */ o("svg", {
|
|
35
|
+
viewBox: "0 0 20 20",
|
|
36
|
+
fill: "currentColor",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: /* @__PURE__ */ o("path", { d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.3 7.3a1 1 0 011.4 0L10 8.6l1.3-1.3a1 1 0 111.4 1.4L11.4 10l1.3 1.3a1 1 0 01-1.4 1.4L10 11.4l-1.3 1.3a1 1 0 01-1.4-1.4L8.6 10 7.3 8.7a1 1 0 010-1.4z" })
|
|
39
|
+
}), d = e(({ inputSize: e = "md", error: d = !1, prefix: f, suffix: p, revealable: m = !1, revealed: h, onRevealedChange: g, revealLabels: _, clearable: v = !1, clearLabel: y = "Clear", onClear: b, classes: x, className: S, style: C, type: w, onChange: T, ...E }, D) => {
|
|
40
|
+
let O = n(null), k = t((e) => {
|
|
41
|
+
O.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
|
|
42
|
+
}, [D]), A = m && w === "password", [j, M] = r(!1), N = h ?? j, P = () => {
|
|
43
|
+
let e = !N;
|
|
44
|
+
h === void 0 && M(e), g?.(e);
|
|
45
|
+
}, F = A && N ? "text" : w, I = _ ?? {
|
|
46
|
+
show: "Show password",
|
|
47
|
+
hide: "Hide password"
|
|
48
|
+
}, { value: L, defaultValue: R, disabled: z, readOnly: B } = E, [V, H] = r(() => R != null && String(R).length > 0), U = L == null ? V : String(L).length > 0, W = v && U && !z && !B, G = v ? (e) => {
|
|
49
|
+
H(e.target.value.length > 0), T?.(e);
|
|
50
|
+
} : T, K = () => {
|
|
51
|
+
let e = O.current;
|
|
52
|
+
e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), H(!1), b?.(), e.focus());
|
|
53
|
+
}, q = (e) => e.preventDefault(), J = !!(f || p || A || v), Y = /* @__PURE__ */ o("input", {
|
|
54
|
+
ref: k,
|
|
55
|
+
type: F,
|
|
56
|
+
className: i(a.root, a[e], d && a.error, (f || void 0) && a.hasPrefix, (p || A || v) && a.hasSuffix, x?.root, !J && S),
|
|
57
|
+
style: J ? void 0 : C,
|
|
58
|
+
onChange: G,
|
|
59
|
+
...E
|
|
60
|
+
});
|
|
61
|
+
return J ? /* @__PURE__ */ s("div", {
|
|
62
|
+
className: i(a.wrapper, a[e], d && a.error, x?.wrapper, S),
|
|
63
|
+
style: C,
|
|
64
|
+
children: [
|
|
65
|
+
f && /* @__PURE__ */ o("span", {
|
|
66
|
+
className: i(a.prefix, x?.prefix),
|
|
67
|
+
children: f
|
|
68
|
+
}),
|
|
69
|
+
Y,
|
|
70
|
+
p && /* @__PURE__ */ o("span", {
|
|
71
|
+
className: i(a.suffix, x?.suffix),
|
|
72
|
+
children: p
|
|
73
|
+
}),
|
|
74
|
+
W && /* @__PURE__ */ o("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
className: i(a.sideButton, a.clear, x?.clear),
|
|
77
|
+
"aria-label": y,
|
|
78
|
+
onMouseDown: q,
|
|
79
|
+
onClick: K,
|
|
80
|
+
tabIndex: -1,
|
|
81
|
+
children: u
|
|
82
|
+
}),
|
|
83
|
+
A && /* @__PURE__ */ o("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
className: i(a.sideButton, a.reveal, x?.reveal),
|
|
86
|
+
"aria-label": N ? I.hide : I.show,
|
|
87
|
+
"aria-pressed": N,
|
|
88
|
+
onMouseDown: q,
|
|
89
|
+
onClick: P,
|
|
90
|
+
disabled: z,
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
children: N ? l : c
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}) : Y;
|
|
96
|
+
});
|
|
97
|
+
d.displayName = "Input";
|
|
98
|
+
export { d as Input };
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
a as default,
|
|
16
|
-
f as error,
|
|
17
|
-
i as hasPrefix,
|
|
18
|
-
x as hasSuffix,
|
|
19
|
-
t as lg,
|
|
20
|
-
o as md,
|
|
21
|
-
e as prefix,
|
|
22
|
-
r as root,
|
|
23
|
-
p as sideButton,
|
|
24
|
-
c as sm,
|
|
25
|
-
n as suffix,
|
|
26
|
-
s as wrapper
|
|
1
|
+
// src/components/inputs/Input/Input.module.scss
|
|
2
|
+
var e = "crk-root-rSgdy", t = "crk-wrapper-GHy8V", n = "crk-sm-DptM5", r = "crk-md-F4B0G", i = "crk-lg-pBxwX", a = "crk-error-fucxe", o = "crk-prefix-w53Md", s = "crk-suffix-fcNgR", c = "crk-hasPrefix--bqPD", l = "crk-hasSuffix-zO0nX", u = "crk-sideButton-H3GC-", d = {
|
|
3
|
+
root: e,
|
|
4
|
+
wrapper: t,
|
|
5
|
+
sm: n,
|
|
6
|
+
md: r,
|
|
7
|
+
lg: i,
|
|
8
|
+
error: a,
|
|
9
|
+
prefix: o,
|
|
10
|
+
suffix: s,
|
|
11
|
+
hasPrefix: c,
|
|
12
|
+
hasSuffix: l,
|
|
13
|
+
sideButton: u
|
|
27
14
|
};
|
|
15
|
+
export { d as default, a as error, c as hasPrefix, l as hasSuffix, i as lg, r as md, o as prefix, e as root, u as sideButton, n as sm, s as suffix, t as wrapper };
|
|
@@ -1,132 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
type: "button",
|
|
115
|
-
tabIndex: -1,
|
|
116
|
-
className: m(l.decrement, d?.decrement),
|
|
117
|
-
onClick: () => k(-1),
|
|
118
|
-
disabled: i || f || U,
|
|
119
|
-
"aria-label": "Decrement",
|
|
120
|
-
children: /* @__PURE__ */ s("svg", { viewBox: "0 0 10 6", "aria-hidden": "true", children: /* @__PURE__ */ s("path", { d: "M1 1l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
] })
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
H.displayName = "NumberInput";
|
|
130
|
-
export {
|
|
131
|
-
H as NumberInput
|
|
132
|
-
};
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import a from "clsx";
|
|
3
|
+
import o from "./NumberInput.module.scss.js";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
// src/components/inputs/NumberInput/NumberInput.tsx
|
|
6
|
+
var l = (e) => {
|
|
7
|
+
if (e.trim() === "") return null;
|
|
8
|
+
let t = Number(e);
|
|
9
|
+
return Number.isNaN(t) ? null : t;
|
|
10
|
+
}, u = e(({ value: e, defaultValue: u, onChange: d, min: f, max: p, step: m = 1, precision: h, inputSize: g = "md", error: _ = !1, hideControls: v = !1, disabled: y, readOnly: b, classes: x, className: S, style: C, onKeyDown: w, onBlur: T, ...E }, D) => {
|
|
11
|
+
let O = e !== void 0, k = (O ? e : u) ?? null, [A, j] = i(k == null ? "" : String(k)), M = r(!1), N = r(!1), P = O ? e ?? null : l(A);
|
|
12
|
+
n(() => {
|
|
13
|
+
O && (!M.current || N.current) && j(e == null ? "" : String(e)), N.current = !1;
|
|
14
|
+
}, [O, e]);
|
|
15
|
+
let F = t((e) => {
|
|
16
|
+
let t = e;
|
|
17
|
+
if (f != null && (t = Math.max(f, t)), p != null && (t = Math.min(p, t)), h != null) {
|
|
18
|
+
let e = 10 ** h;
|
|
19
|
+
t = Math.round(t * e) / e;
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
}, [
|
|
23
|
+
f,
|
|
24
|
+
p,
|
|
25
|
+
h
|
|
26
|
+
]), I = t((e) => {
|
|
27
|
+
O ? N.current = !0 : j(e == null ? "" : String(e)), d?.(e);
|
|
28
|
+
}, [O, d]), L = t((e) => {
|
|
29
|
+
y || b || I(F((P ?? f ?? 0) + e * m));
|
|
30
|
+
}, [
|
|
31
|
+
y,
|
|
32
|
+
b,
|
|
33
|
+
P,
|
|
34
|
+
f,
|
|
35
|
+
m,
|
|
36
|
+
F,
|
|
37
|
+
I
|
|
38
|
+
]), R = p != null && P != null && P >= p, z = f != null && P != null && P <= f;
|
|
39
|
+
return /* @__PURE__ */ c("div", {
|
|
40
|
+
className: a(o.root, o[g], _ && o.error, y && o.disabled, x?.root, S),
|
|
41
|
+
style: C,
|
|
42
|
+
"data-disabled": y || void 0,
|
|
43
|
+
children: [/* @__PURE__ */ s("input", {
|
|
44
|
+
ref: D,
|
|
45
|
+
type: "text",
|
|
46
|
+
inputMode: "decimal",
|
|
47
|
+
className: a(o.input, x?.input),
|
|
48
|
+
value: A,
|
|
49
|
+
disabled: y,
|
|
50
|
+
readOnly: b,
|
|
51
|
+
"aria-invalid": _ || void 0,
|
|
52
|
+
onChange: (e) => {
|
|
53
|
+
N.current = !1, j(e.target.value), d?.(l(e.target.value));
|
|
54
|
+
},
|
|
55
|
+
onKeyDown: (e) => {
|
|
56
|
+
w?.(e), e.defaultPrevented || (e.key === "ArrowUp" ? (e.preventDefault(), L(1)) : e.key === "ArrowDown" && (e.preventDefault(), L(-1)));
|
|
57
|
+
},
|
|
58
|
+
onFocus: (e) => {
|
|
59
|
+
M.current = !0, E.onFocus?.(e);
|
|
60
|
+
},
|
|
61
|
+
onBlur: (e) => {
|
|
62
|
+
M.current = !1;
|
|
63
|
+
let t = l(A), n = t == null ? null : F(t);
|
|
64
|
+
n !== t && I(n), O ? j(P == null ? "" : String(P)) : n != null && n === t && j(String(n)), T?.(e);
|
|
65
|
+
},
|
|
66
|
+
...E
|
|
67
|
+
}), !v && /* @__PURE__ */ c("div", {
|
|
68
|
+
className: a(o.controls, x?.controls),
|
|
69
|
+
children: [/* @__PURE__ */ s("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
tabIndex: -1,
|
|
72
|
+
className: a(o.increment, x?.increment),
|
|
73
|
+
onClick: () => L(1),
|
|
74
|
+
disabled: y || b || R,
|
|
75
|
+
"aria-label": "Increment",
|
|
76
|
+
children: /* @__PURE__ */ s("svg", {
|
|
77
|
+
viewBox: "0 0 10 6",
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
children: /* @__PURE__ */ s("path", {
|
|
80
|
+
d: "M1 5l4-4 4 4",
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke: "currentColor",
|
|
83
|
+
strokeWidth: "1.5",
|
|
84
|
+
strokeLinecap: "round",
|
|
85
|
+
strokeLinejoin: "round"
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}), /* @__PURE__ */ s("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
className: a(o.decrement, x?.decrement),
|
|
92
|
+
onClick: () => L(-1),
|
|
93
|
+
disabled: y || b || z,
|
|
94
|
+
"aria-label": "Decrement",
|
|
95
|
+
children: /* @__PURE__ */ s("svg", {
|
|
96
|
+
viewBox: "0 0 10 6",
|
|
97
|
+
"aria-hidden": "true",
|
|
98
|
+
children: /* @__PURE__ */ s("path", {
|
|
99
|
+
d: "M1 1l4 4 4-4",
|
|
100
|
+
fill: "none",
|
|
101
|
+
stroke: "currentColor",
|
|
102
|
+
strokeWidth: "1.5",
|
|
103
|
+
strokeLinecap: "round",
|
|
104
|
+
strokeLinejoin: "round"
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
u.displayName = "NumberInput";
|
|
112
|
+
export { u as NumberInput };
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
1
|
+
// src/components/inputs/NumberInput/NumberInput.module.scss
|
|
2
|
+
var e = "crk-root-aUI4c", t = "crk-sm-t2zR2", n = "crk-input-82UG6", r = "crk-md-v4bFw", i = "crk-lg-mr8pf", a = "crk-controls-0vTT8", o = "crk-increment-nc4uY", s = "crk-decrement-076EO", c = "crk-error-1BkEa", l = "crk-disabled-mk7uC", u = {
|
|
3
|
+
root: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
input: n,
|
|
6
|
+
md: r,
|
|
7
|
+
lg: i,
|
|
8
|
+
controls: a,
|
|
9
|
+
increment: o,
|
|
10
|
+
decrement: s,
|
|
11
|
+
error: c,
|
|
12
|
+
disabled: l
|
|
25
13
|
};
|
|
14
|
+
export { a as controls, s as decrement, u as default, l as disabled, c as error, o as increment, n as input, i as lg, r as md, e as root, t as sm };
|