@overdoser/react-toolkit 0.21.0 → 0.22.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/AGENTS.md +1 -0
- package/CHANGELOG.md +35 -0
- package/components/Accordion/Accordion.js +48 -48
- package/components/ActionButton/ActionButton.js +23 -23
- package/components/ActionButton/CopyButton.js +5 -5
- package/components/Alert/Alert.js +13 -13
- package/components/Avatar/Avatar.js +12 -12
- package/components/Badge/Badge.js +6 -6
- package/components/Breadcrumbs/Breadcrumbs.js +15 -15
- package/components/Button/Button.js +14 -14
- package/components/Card/Card.js +26 -26
- package/components/Chart/AreaChart.js +103 -103
- package/components/Chart/Axis.js +7 -7
- package/components/Chart/BarChart.js +62 -62
- package/components/Chart/ChartContainer.js +11 -11
- package/components/Chart/ChartLegend.js +7 -7
- package/components/Chart/ChartTooltip.js +13 -13
- package/components/Chart/LineChart.js +88 -88
- package/components/Chart/PieChart.js +25 -25
- package/components/Chart/RadarChart.js +42 -42
- package/components/Chart/Sparkline.js +11 -11
- package/components/Chart/TradingChart.js +126 -126
- package/components/Chart/trading/period.js +3 -3
- package/components/Chip/Chip.js +24 -24
- package/components/CodeBlock/CodeBlock.js +31 -31
- package/components/CommandPalette/CommandPalette.js +166 -166
- package/components/ConfirmDialog/ConfirmDialog.js +60 -60
- package/components/Divider/Divider.js +10 -10
- package/components/Draggable/Draggable.js +29 -29
- package/components/Drawer/Drawer.js +53 -53
- package/components/Dropdown/Dropdown.js +66 -66
- package/components/Dropdown/DropdownItem.js +13 -13
- package/components/Dropdown/DropdownLabel.js +5 -5
- package/components/Dropdown/DropdownSeparator.js +5 -5
- package/components/Dropzone/Dropzone.js +15 -15
- package/components/EmptyState/EmptyState.js +11 -11
- package/components/Form/Form.js +17 -17
- package/components/Form/FormField.js +21 -21
- package/components/Form/FormRow.js +3 -3
- package/components/ImageViewer/ImageViewer.js +118 -118
- package/components/Kbd/Kbd.js +11 -11
- package/components/KeyValueList/KeyValueList.js +32 -32
- package/components/Link/Link.js +7 -7
- package/components/List/List.js +7 -7
- package/components/Loader/Loader.js +39 -39
- package/components/Modal/Modal.js +48 -48
- package/components/PageHeader/PageHeader.js +18 -18
- package/components/Pagination/Pagination.js +23 -23
- package/components/Popover/Popover.js +25 -25
- package/components/ProgressBar/ProgressBar.js +17 -17
- package/components/RelativeTime/RelativeTime.js +10 -10
- package/components/SegmentedControl/SegmentedControl.js +38 -38
- package/components/Skeleton/Skeleton.js +10 -10
- package/components/Spinner/Spinner.js +7 -7
- package/components/SplitButton/SplitButton.js +63 -63
- package/components/SplitPane/SplitPane.js +50 -50
- package/components/StatCard/StatCard.js +32 -32
- package/components/StatusDot/StatusDot.js +7 -7
- package/components/Table/Table.js +174 -174
- package/components/Tabs/Tabs.js +47 -47
- package/components/ThemeToggle/ThemeToggle.js +31 -31
- package/components/Timeline/GanttTimeline.js +213 -213
- package/components/Timeline/HistoryTimeline.js +306 -306
- package/components/Timeline/TimelineShared.js +103 -103
- package/components/Timeline/TraceEventDetails.js +103 -103
- package/components/Timeline/TraceTimeline.js +546 -546
- package/components/Timeline/historyLayout.js +2 -2
- package/components/Timer/Timer.js +39 -39
- package/components/Toast/Toast.js +59 -59
- package/components/ToggleIconButton/ToggleIconButton.js +9 -9
- package/components/Tooltip/Tooltip.js +16 -16
- package/components/Typography/Typography.js +5 -5
- package/components/inputs/Checkbox/Checkbox.js +11 -11
- package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
- package/components/inputs/DatePicker/CalendarPanel.js +113 -113
- package/components/inputs/DatePicker/DatePicker.js +39 -39
- package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
- package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
- package/components/inputs/DateTimePicker/TimeField.js +34 -34
- package/components/inputs/Input/Input.js +13 -13
- package/components/inputs/NumberInput/NumberInput.js +16 -16
- package/components/inputs/Radio/Radio.js +17 -17
- package/components/inputs/SearchInput/SearchInput.js +25 -25
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +485 -344
- package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
- package/components/inputs/Slider/Slider.js +21 -21
- package/components/inputs/Switch/Switch.js +4 -4
- package/components/inputs/Textarea/Textarea.js +8 -8
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +6 -3
- package/hooks/useResizable.js +1 -1
- package/hooks/useTheme.js +7 -7
- package/index.css +1 -1
- package/index.js +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +25 -4
- package/manifest.json +33 -4
- package/package.json +1 -1
- /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
- /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
- /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
- /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
- /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
- /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
- /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
- /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
- /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
- /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
- /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
- /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
- /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
- /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
- /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
- /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
- /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
- /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
- /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
- /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
- /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
- /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
- /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
- /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
- /package/components/List/{List.module.js → List.module.scss.js} +0 -0
- /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
- /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
- /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
- /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
- /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
- /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
- /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
- /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
- /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
- /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
- /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
- /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
- /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
- /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
- /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
- /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
- /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
- /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
- /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
- /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
- /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
- /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
- /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
- /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
- /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
- /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
- /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
- /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
- /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
- /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
- /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/inputs/Select/Select.module.scss
|
|
2
|
-
var e = "crk-wrapper-SP2JE", t = "crk-sm-DqshL", n = "crk-md-j4AKI", r = "crk-lg-24Xd3", i = "crk-root-Uu9Ah", a = "crk-error-9oRU6", o = "crk-arrow-WU8ZW", s = "crk-searchableWrapper-7AL4l", c = "crk-hiddenSelect-s3DEx", l = "crk-searchableTrigger-m-GWV", u = "crk-triggerOpen-Lo8-j", d = "crk-triggerLabel-5rETZ", f = "crk-placeholder-teBBh", p = "crk-arrowInline-m-roG", m = "crk-disabled-pcSeq", h = "crk-visuallyHidden-2tTD5", g = "crk-menu--i-je", _ = "crk-menuEnter-vJjLV", v = "crk-menuItems-VrZnE", y = "crk-item-fU3XI", b = "crk-itemHighlighted-MvR41", x = "crk-itemDisabled-KTUO8", S = "crk-itemSelected-42-BG", C = "crk-noResults-uicSW", w = "crk-match-Aej-J", T = "crk-spinner-I1ffm", E = "crk-multiTrigger-Pd3wJ", D = "crk-multiTriggerDisabled-9ajge", O = "crk-chip-TuYUB", k = "crk-chipLabel-H4JWu", A = "crk-chipRemove-Lfk0R", j = "crk-multiSearch-OrVeS", M = "crk-arrowMulti-Nh9Hr", N = "crk-itemCheck-DPB5A", P = {
|
|
2
|
+
var e = "crk-wrapper-SP2JE", t = "crk-sm-DqshL", n = "crk-md-j4AKI", r = "crk-lg-24Xd3", i = "crk-root-Uu9Ah", a = "crk-error-9oRU6", o = "crk-arrow-WU8ZW", s = "crk-searchableWrapper-7AL4l", c = "crk-hiddenSelect-s3DEx", l = "crk-searchableTrigger-m-GWV", u = "crk-triggerOpen-Lo8-j", d = "crk-triggerLabel-5rETZ", f = "crk-placeholder-teBBh", p = "crk-arrowInline-m-roG", m = "crk-disabled-pcSeq", h = "crk-visuallyHidden-2tTD5", g = "crk-menu--i-je", _ = "crk-menuEnter-vJjLV", v = "crk-menuItems-VrZnE", y = "crk-item-fU3XI", b = "crk-itemHighlighted-MvR41", x = "crk-itemDisabled-KTUO8", S = "crk-itemSelected-42-BG", C = "crk-noResults-uicSW", w = "crk-match-Aej-J", T = "crk-spinner-I1ffm", E = "crk-multiTrigger-Pd3wJ", D = "crk-multiTriggerDisabled-9ajge", O = "crk-chip-TuYUB", k = "crk-chipLabel-H4JWu", A = "crk-chipRemove-Lfk0R", j = "crk-multiSearch-OrVeS", M = "crk-arrowMulti-Nh9Hr", N = "crk-itemCheck-DPB5A", P = "crk-moreChip-Rlrb8", F = "crk-checklistTrigger-3mDgS", I = "crk-checklistButton-Jvh3L", L = "crk-menuChecklist-MxLWj", R = "crk-menuSearchRow-LuCyU", z = "crk-menuSearchIcon-drN6W", B = "crk-menuSearch-SjM96", V = "crk-menuHeader-VpZN1", H = "crk-menuAction-t1izk", U = "crk-checkbox-xFpYO", W = "crk-checkboxChecked-PATgQ", G = "crk-itemBody--PcX2", K = {
|
|
3
3
|
wrapper: e,
|
|
4
4
|
sm: t,
|
|
5
5
|
md: n,
|
|
@@ -33,6 +33,18 @@ var e = "crk-wrapper-SP2JE", t = "crk-sm-DqshL", n = "crk-md-j4AKI", r = "crk-lg
|
|
|
33
33
|
chipRemove: A,
|
|
34
34
|
multiSearch: j,
|
|
35
35
|
arrowMulti: M,
|
|
36
|
-
itemCheck: N
|
|
36
|
+
itemCheck: N,
|
|
37
|
+
moreChip: P,
|
|
38
|
+
checklistTrigger: F,
|
|
39
|
+
checklistButton: I,
|
|
40
|
+
menuChecklist: L,
|
|
41
|
+
menuSearchRow: R,
|
|
42
|
+
menuSearchIcon: z,
|
|
43
|
+
menuSearch: B,
|
|
44
|
+
menuHeader: V,
|
|
45
|
+
menuAction: H,
|
|
46
|
+
checkbox: U,
|
|
47
|
+
checkboxChecked: W,
|
|
48
|
+
itemBody: G
|
|
37
49
|
};
|
|
38
|
-
export { o as arrow, p as arrowInline, M as arrowMulti, O as chip, k as chipLabel, A as chipRemove,
|
|
50
|
+
export { o as arrow, p as arrowInline, M as arrowMulti, U as checkbox, W as checkboxChecked, I as checklistButton, F as checklistTrigger, O as chip, k as chipLabel, A as chipRemove, K as default, m as disabled, a as error, c as hiddenSelect, y as item, G as itemBody, N as itemCheck, x as itemDisabled, b as itemHighlighted, S as itemSelected, r as lg, w as match, n as md, g as menu, H as menuAction, L as menuChecklist, _ as menuEnter, V as menuHeader, v as menuItems, B as menuSearch, z as menuSearchIcon, R as menuSearchRow, P as moreChip, j as multiSearch, E as multiTrigger, D as multiTriggerDisabled, C as noResults, f as placeholder, i as root, l as searchableTrigger, s as searchableWrapper, t as sm, T as spinner, d as triggerLabel, u as triggerOpen, h as visuallyHidden, e as wrapper };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import o from "
|
|
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 "./Slider.module.scss.js";
|
|
4
4
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
5
|
// src/components/inputs/Slider/Slider.tsx
|
|
6
|
-
var l = (e) => Array.isArray(e) ? e : null, u =
|
|
7
|
-
let w =
|
|
6
|
+
var l = (e) => Array.isArray(e) ? e : null, u = e(({ value: e, defaultValue: u, onChange: d, onChangeEnd: f, min: p = 0, max: m = 100, step: h = 1, disabled: g = !1, formatValue: _, classes: v, className: y, style: b, "aria-label": x, "aria-labelledby": S }, C) => {
|
|
7
|
+
let w = e !== void 0, [T, E] = i(e ?? u ?? 0), D = w ? e : T, O = r(null), k = r(0), [A, j] = i(!1), M = t((e) => Math.min(m, Math.max(p, e)), [p, m]), N = t((e) => M(Math.round((e - p) / h) * h + p), [
|
|
8
8
|
M,
|
|
9
9
|
p,
|
|
10
10
|
h
|
|
11
|
-
]), P =
|
|
11
|
+
]), P = t((e) => (e - p) / (m - p) * 100, [p, m]), F = t((e, t = !1) => {
|
|
12
12
|
w || E(e), d?.(e), t && f?.(e);
|
|
13
13
|
}, [
|
|
14
14
|
w,
|
|
15
15
|
d,
|
|
16
16
|
f
|
|
17
|
-
]), I =
|
|
17
|
+
]), I = t((e, t, n = !1) => {
|
|
18
18
|
let r = N(t), i = l(D);
|
|
19
19
|
if (i) {
|
|
20
20
|
let t = [i[0], i[1]];
|
|
@@ -24,16 +24,16 @@ var l = (e) => Array.isArray(e) ? e : null, u = t(({ value: t, defaultValue: u,
|
|
|
24
24
|
D,
|
|
25
25
|
N,
|
|
26
26
|
F
|
|
27
|
-
]), L =
|
|
27
|
+
]), L = t((e) => {
|
|
28
28
|
let t = O.current;
|
|
29
29
|
if (!t) return p;
|
|
30
30
|
let n = t.getBoundingClientRect();
|
|
31
31
|
return p + (n.width > 0 ? (e - n.left) / n.width : 0) * (m - p);
|
|
32
|
-
}, [p, m]), R =
|
|
32
|
+
}, [p, m]), R = t((e) => {
|
|
33
33
|
let t = l(D);
|
|
34
34
|
return t ? Math.abs(e - t[0]) <= Math.abs(e - t[1]) ? 0 : 1 : 0;
|
|
35
35
|
}, [D]);
|
|
36
|
-
|
|
36
|
+
n(() => {
|
|
37
37
|
if (!A) return;
|
|
38
38
|
let e = (e) => {
|
|
39
39
|
I(k.current, L(e.clientX));
|
|
@@ -61,35 +61,35 @@ var l = (e) => Array.isArray(e) ? e : null, u = t(({ value: t, defaultValue: u,
|
|
|
61
61
|
}, H = l(D), U = H ?? [D], W = H ? P(H[0]) : 0, G = P(H ? H[1] : D);
|
|
62
62
|
return /* @__PURE__ */ s("div", {
|
|
63
63
|
ref: C,
|
|
64
|
-
className: o
|
|
64
|
+
className: a(o.root, g && o.disabled, v?.root, y),
|
|
65
65
|
style: b,
|
|
66
66
|
"data-disabled": g || void 0,
|
|
67
67
|
children: /* @__PURE__ */ c("div", {
|
|
68
68
|
ref: O,
|
|
69
|
-
className: o
|
|
69
|
+
className: a(o.track, v?.track),
|
|
70
70
|
onPointerDown: z,
|
|
71
71
|
children: [/* @__PURE__ */ s("div", {
|
|
72
|
-
className: o
|
|
72
|
+
className: a(o.range, v?.range),
|
|
73
73
|
style: {
|
|
74
74
|
left: `${W}%`,
|
|
75
75
|
width: `${G - W}%`
|
|
76
76
|
}
|
|
77
|
-
}), U.map((
|
|
78
|
-
className: o
|
|
79
|
-
style: { left: `${P(
|
|
77
|
+
}), U.map((e, t) => /* @__PURE__ */ s("div", {
|
|
78
|
+
className: a(o.thumb, v?.thumb),
|
|
79
|
+
style: { left: `${P(e)}%` },
|
|
80
80
|
role: "slider",
|
|
81
81
|
tabIndex: g ? -1 : 0,
|
|
82
82
|
"aria-orientation": "horizontal",
|
|
83
83
|
"aria-valuemin": p,
|
|
84
84
|
"aria-valuemax": m,
|
|
85
|
-
"aria-valuenow":
|
|
86
|
-
"aria-valuetext": _ ? _(
|
|
85
|
+
"aria-valuenow": e,
|
|
86
|
+
"aria-valuetext": _ ? _(e) : void 0,
|
|
87
87
|
"aria-label": x,
|
|
88
88
|
"aria-labelledby": S,
|
|
89
89
|
"aria-disabled": g || void 0,
|
|
90
|
-
onPointerDown: B(
|
|
91
|
-
onKeyDown: V(
|
|
92
|
-
},
|
|
90
|
+
onPointerDown: B(t),
|
|
91
|
+
onKeyDown: V(t, e)
|
|
92
|
+
}, t))]
|
|
93
93
|
})
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import { Checkbox as t } from "../Checkbox/Checkbox.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
// src/components/inputs/Switch/Switch.tsx
|
|
5
|
-
var r =
|
|
5
|
+
var r = e((e, r) => /* @__PURE__ */ n(t, {
|
|
6
6
|
ref: r,
|
|
7
7
|
variant: "switch",
|
|
8
|
-
...
|
|
8
|
+
...e
|
|
9
9
|
}));
|
|
10
10
|
r.displayName = "Switch";
|
|
11
11
|
export { r as Switch };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import a from "
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useRef as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./Textarea.module.scss.js";
|
|
4
4
|
import { jsx as o } from "react/jsx-runtime";
|
|
5
5
|
// src/components/inputs/Textarea/Textarea.tsx
|
|
6
6
|
var s = {
|
|
@@ -8,19 +8,19 @@ var s = {
|
|
|
8
8
|
vertical: "resizeVertical",
|
|
9
9
|
horizontal: "resizeHorizontal",
|
|
10
10
|
both: "resizeBoth"
|
|
11
|
-
}, c =
|
|
12
|
-
let g =
|
|
11
|
+
}, c = e(({ inputSize: e = "md", error: c = !1, resize: l = "vertical", autoExpand: u = !0, className: d, style: f, onChange: p, ...m }, h) => {
|
|
12
|
+
let g = r(null), _ = t(() => {
|
|
13
13
|
let e = g.current;
|
|
14
14
|
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
15
15
|
}, []), v = m.value ?? "";
|
|
16
|
-
|
|
16
|
+
n(() => {
|
|
17
17
|
u && _();
|
|
18
18
|
}, [
|
|
19
19
|
u,
|
|
20
20
|
_,
|
|
21
21
|
v
|
|
22
22
|
]);
|
|
23
|
-
let y =
|
|
23
|
+
let y = t((e) => {
|
|
24
24
|
u && _(), p?.(e);
|
|
25
25
|
}, [
|
|
26
26
|
u,
|
|
@@ -31,7 +31,7 @@ var s = {
|
|
|
31
31
|
ref: (e) => {
|
|
32
32
|
g.current = e, typeof h == "function" ? h(e) : h && (h.current = e);
|
|
33
33
|
},
|
|
34
|
-
className: a
|
|
34
|
+
className: i(a.root, a[e], c && a.error, u ? a.autoExpand : a[s[l]], d),
|
|
35
35
|
style: f,
|
|
36
36
|
onChange: y,
|
|
37
37
|
rows: m.rows ?? 1,
|
|
@@ -10,7 +10,8 @@ export interface PortalPosition {
|
|
|
10
10
|
/**
|
|
11
11
|
* Tracks the trigger's bounding rect for a portaled popover-style menu.
|
|
12
12
|
* Recomputes on scroll (capture phase, so nested scroll containers like a
|
|
13
|
-
* Modal body are caught too)
|
|
13
|
+
* Modal body are caught too), on window resize, and when the trigger itself
|
|
14
|
+
* resizes.
|
|
14
15
|
*
|
|
15
16
|
* Returns viewport-relative coordinates intended for use with
|
|
16
17
|
* `position: fixed` on the portaled menu.
|
|
@@ -12,14 +12,17 @@ function n(n, r) {
|
|
|
12
12
|
let e = n.current;
|
|
13
13
|
if (!e) return;
|
|
14
14
|
let t = e.getBoundingClientRect();
|
|
15
|
-
a({
|
|
15
|
+
a((e) => e.top === t.bottom && e.left === t.left && e.width === t.width ? e : {
|
|
16
16
|
top: t.bottom,
|
|
17
17
|
left: t.left,
|
|
18
18
|
width: t.width
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
if (e(), typeof window
|
|
22
|
-
|
|
21
|
+
if (e(), typeof window > "u") return;
|
|
22
|
+
window.addEventListener("scroll", e, !0), window.addEventListener("resize", e);
|
|
23
|
+
let t = n.current, i = t && typeof ResizeObserver < "u" ? new ResizeObserver(e) : null;
|
|
24
|
+
return t && i?.observe(t), () => {
|
|
25
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), i?.disconnect();
|
|
23
26
|
};
|
|
24
27
|
}, [r, n]), i;
|
|
25
28
|
}
|
package/hooks/useResizable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
2
|
// src/hooks/useResizable.ts
|
|
3
|
-
var i = (e) => typeof e == "function" ? e() : e ??
|
|
3
|
+
var i = (e) => typeof e == "function" ? e() : e ?? 1e400;
|
|
4
4
|
function a(a = {}) {
|
|
5
5
|
let { size: o, defaultSize: s = 0, min: c = 0, max: l, axis: u = "x", invert: d = !1, step: f = 16, onResize: p, onResizeStart: m, onResizeEnd: h, disabled: g = !1 } = a, [_, v] = r(s), [y, b] = r(!1), x = o ?? _, S = n(x);
|
|
6
6
|
S.current = x;
|
package/hooks/useTheme.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useCallback as e, useEffect as t } from "react";
|
|
2
|
+
import { usePersistedState as n } from "./usePersistedState.js";
|
|
3
|
+
import { useMediaQuery as r } from "./useMediaQuery.js";
|
|
4
4
|
// src/hooks/useTheme.ts
|
|
5
5
|
var i = [
|
|
6
6
|
"light",
|
|
@@ -11,18 +11,18 @@ function a(e, t) {
|
|
|
11
11
|
typeof document < "u" && document.documentElement.setAttribute(e, t);
|
|
12
12
|
}
|
|
13
13
|
function o(o = {}) {
|
|
14
|
-
let { storageKey: s = "crk-theme", attribute: c = "data-theme", defaultTheme: l = "system" } = o, [u, d] =
|
|
15
|
-
|
|
14
|
+
let { storageKey: s = "crk-theme", attribute: c = "data-theme", defaultTheme: l = "system" } = o, [u, d] = n(s, l), f = i.includes(u) ? u : l, p = r("(prefers-color-scheme: dark)"), m = f === "system" ? p ? "dark" : "light" : f;
|
|
15
|
+
t(() => {
|
|
16
16
|
a(c, f);
|
|
17
17
|
}, [c, f]);
|
|
18
|
-
let h =
|
|
18
|
+
let h = e((e) => {
|
|
19
19
|
d(e), a(c, e);
|
|
20
20
|
}, [d, c]);
|
|
21
21
|
return {
|
|
22
22
|
theme: f,
|
|
23
23
|
resolved: m,
|
|
24
24
|
setTheme: h,
|
|
25
|
-
toggle:
|
|
25
|
+
toggle: e(() => {
|
|
26
26
|
h(i[(i.indexOf(f) + 1) % i.length]);
|
|
27
27
|
}, [f, h])
|
|
28
28
|
};
|