@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,53 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
a as alignLeft,
|
|
29
|
-
g as alignRight,
|
|
30
|
-
l as chevron,
|
|
31
|
-
I as default,
|
|
32
|
-
t as fullWidth,
|
|
33
|
-
k as item,
|
|
34
|
-
b as itemCheck,
|
|
35
|
-
u as itemChecked,
|
|
36
|
-
p as itemDanger,
|
|
37
|
-
L as itemDescription,
|
|
38
|
-
h as itemDisabled,
|
|
39
|
-
f as itemIcon,
|
|
40
|
-
D as itemLabel,
|
|
41
|
-
d as itemSelected,
|
|
42
|
-
C as itemShortcut,
|
|
43
|
-
O as label,
|
|
44
|
-
m as menu,
|
|
45
|
-
s as menuOpen,
|
|
46
|
-
o as placeholder,
|
|
47
|
-
e as root,
|
|
48
|
-
S as separator,
|
|
49
|
-
r as trigger,
|
|
50
|
-
n as triggerError,
|
|
51
|
-
i as triggerLabel,
|
|
52
|
-
c as triggerOpen
|
|
1
|
+
// src/components/Dropdown/Dropdown.module.scss
|
|
2
|
+
var e = "crk-root-an8Cf", t = "crk-fullWidth-S-uVk", n = "crk-trigger-LwPaD", r = "crk-triggerOpen-U4pa9", i = "crk-triggerLabel-QLITs", a = "crk-triggerError-3jlu1", o = "crk-placeholder-fWdch", s = "crk-chevron-jmDNe", c = "crk-menu-fxnKL", l = "crk-menuOpen-HF-Y1", u = "crk-menuEnter-F0Yyt", d = "crk-alignLeft-buCDJ", f = "crk-alignRight-05P9w", p = "crk-item-f-Rhh", m = "crk-itemDisabled-L-d6i", h = "crk-itemSelected-Fwmuo", g = "crk-itemDanger-b1A4e", _ = "crk-itemChecked-xY5Cf", v = "crk-itemCheck-IZYaJ", y = "crk-itemIcon-3Gh8c", b = "crk-itemLabel-YdjzN", x = "crk-itemDescription-eM-fw", S = "crk-itemShortcut-33qnD", C = "crk-separator-C0jdb", w = "crk-label-Rd7NT", T = {
|
|
3
|
+
root: e,
|
|
4
|
+
fullWidth: t,
|
|
5
|
+
trigger: n,
|
|
6
|
+
triggerOpen: r,
|
|
7
|
+
triggerLabel: i,
|
|
8
|
+
triggerError: a,
|
|
9
|
+
placeholder: o,
|
|
10
|
+
chevron: s,
|
|
11
|
+
menu: c,
|
|
12
|
+
menuOpen: l,
|
|
13
|
+
menuEnter: u,
|
|
14
|
+
alignLeft: d,
|
|
15
|
+
alignRight: f,
|
|
16
|
+
item: p,
|
|
17
|
+
itemDisabled: m,
|
|
18
|
+
itemSelected: h,
|
|
19
|
+
itemDanger: g,
|
|
20
|
+
itemChecked: _,
|
|
21
|
+
itemCheck: v,
|
|
22
|
+
itemIcon: y,
|
|
23
|
+
itemLabel: b,
|
|
24
|
+
itemDescription: x,
|
|
25
|
+
itemShortcut: S,
|
|
26
|
+
separator: C,
|
|
27
|
+
label: w
|
|
53
28
|
};
|
|
29
|
+
export { d as alignLeft, f as alignRight, s as chevron, T as default, t as fullWidth, p as item, v as itemCheck, _ as itemChecked, g as itemDanger, x as itemDescription, m as itemDisabled, y as itemIcon, b as itemLabel, h as itemSelected, S as itemShortcut, w as label, c as menu, u as menuEnter, l as menuOpen, o as placeholder, e as root, C as separator, n as trigger, a as triggerError, i as triggerLabel, r as triggerOpen };
|
|
@@ -1,58 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
-
export {
|
|
57
|
-
I as DropdownItem
|
|
58
|
-
};
|
|
1
|
+
import { forwardRef as e, useContext as t } from "react";
|
|
2
|
+
import n from "clsx";
|
|
3
|
+
import r from "./Dropdown.module.scss.js";
|
|
4
|
+
import { DropdownMenuContext as i } from "./dropdownContext.js";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Dropdown/DropdownItem.tsx
|
|
7
|
+
var s = e(({ disabled: e = !1, danger: s = !1, icon: c, shortcut: l, checked: u, description: d, closeOnSelect: f, classes: p, className: m, children: h, onClick: g, ..._ }, v) => {
|
|
8
|
+
let y = t(i), b = u !== void 0, x = f ?? !b;
|
|
9
|
+
return /* @__PURE__ */ o("button", {
|
|
10
|
+
ref: v,
|
|
11
|
+
type: "button",
|
|
12
|
+
role: b ? "menuitemcheckbox" : "menuitem",
|
|
13
|
+
"aria-checked": b ? u : void 0,
|
|
14
|
+
className: n(r.item, e && r.itemDisabled, s && r.itemDanger, b && u && r.itemChecked, p?.item, m),
|
|
15
|
+
disabled: e,
|
|
16
|
+
onClick: (e) => {
|
|
17
|
+
g?.(e), x && !e.defaultPrevented && y?.close();
|
|
18
|
+
},
|
|
19
|
+
..._,
|
|
20
|
+
children: [
|
|
21
|
+
b && /* @__PURE__ */ a("span", {
|
|
22
|
+
className: n(r.itemCheck, p?.itemCheck),
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
children: u && /* @__PURE__ */ a("svg", {
|
|
25
|
+
viewBox: "0 0 16 16",
|
|
26
|
+
fill: "none",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeWidth: "2",
|
|
29
|
+
strokeLinecap: "round",
|
|
30
|
+
strokeLinejoin: "round",
|
|
31
|
+
children: /* @__PURE__ */ a("path", { d: "M3 8.5l3 3 7-7" })
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
c != null && /* @__PURE__ */ a("span", {
|
|
35
|
+
className: n(r.itemIcon, p?.itemIcon),
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
children: c
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ o("span", {
|
|
40
|
+
className: n(r.itemLabel, p?.itemLabel),
|
|
41
|
+
children: [h, d != null && /* @__PURE__ */ a("span", {
|
|
42
|
+
className: n(r.itemDescription, p?.itemDescription),
|
|
43
|
+
children: d
|
|
44
|
+
})]
|
|
45
|
+
}),
|
|
46
|
+
l != null && /* @__PURE__ */ a("span", {
|
|
47
|
+
className: n(r.itemShortcut, p?.itemShortcut),
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
children: l
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
s.displayName = "DropdownItem";
|
|
55
|
+
export { s as DropdownItem };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import n from "./Dropdown.module.scss.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Dropdown/DropdownLabel.tsx
|
|
6
|
+
var i = e(({ className: e, children: i, ...a }, o) => /* @__PURE__ */ r("div", {
|
|
7
|
+
ref: o,
|
|
8
|
+
role: "presentation",
|
|
9
|
+
className: t(n.label, e),
|
|
10
|
+
...a,
|
|
11
|
+
children: i
|
|
12
|
+
}));
|
|
13
|
+
i.displayName = "DropdownLabel";
|
|
14
|
+
export { i as DropdownLabel };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import n from "./Dropdown.module.scss.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Dropdown/DropdownSeparator.tsx
|
|
6
|
+
var i = e(({ className: e, ...i }, a) => /* @__PURE__ */ r("div", {
|
|
7
|
+
ref: a,
|
|
8
|
+
role: "separator",
|
|
9
|
+
className: t(n.separator, e),
|
|
10
|
+
...i
|
|
11
|
+
}));
|
|
12
|
+
i.displayName = "DropdownSeparator";
|
|
13
|
+
export { i as DropdownSeparator };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
// src/components/Dropdown/dropdownContext.ts
|
|
3
|
+
var t = e(null);
|
|
4
|
+
export { t as DropdownMenuContext };
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
2
|
+
// src/components/Dropdown/useContextMenu.ts
|
|
3
|
+
function r() {
|
|
4
|
+
let [r, i] = n(null), [a, o] = n(!1), s = e((e) => {
|
|
5
|
+
i(e), o(!0);
|
|
6
|
+
}, []), c = e((e) => {
|
|
7
|
+
e.preventDefault(), s({
|
|
8
|
+
x: e.clientX,
|
|
9
|
+
y: e.clientY
|
|
10
|
+
});
|
|
11
|
+
}, [s]), l = e(() => o(!1), []), u = e((e) => o(e), []);
|
|
12
|
+
return t(() => ({
|
|
13
|
+
anchor: r,
|
|
14
|
+
open: a,
|
|
15
|
+
onOpenChange: u,
|
|
16
|
+
onContextMenu: c,
|
|
17
|
+
openAt: s,
|
|
18
|
+
close: l
|
|
19
|
+
}), [
|
|
20
|
+
r,
|
|
21
|
+
a,
|
|
22
|
+
u,
|
|
23
|
+
c,
|
|
24
|
+
s,
|
|
25
|
+
l
|
|
26
|
+
]);
|
|
15
27
|
}
|
|
16
|
-
export {
|
|
17
|
-
x as useContextMenu
|
|
18
|
-
};
|
|
28
|
+
export { r as useContextMenu };
|
|
@@ -1,107 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { forwardRef as e, useId as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./Dropzone.module.scss.js";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Dropzone/Dropzone.tsx
|
|
6
|
+
function c(e, t) {
|
|
7
|
+
let n = t.trim().toLowerCase();
|
|
8
|
+
return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !0;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
10
|
+
function l(e, t) {
|
|
11
|
+
return !t || t.split(",").some((t) => c(e, t));
|
|
11
12
|
}
|
|
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
|
-
q.displayName = "Dropzone";
|
|
105
|
-
export {
|
|
106
|
-
q as Dropzone
|
|
107
|
-
};
|
|
13
|
+
var u = e(({ onFiles: e, onReject: c, accept: u, multiple: d = !1, maxSize: f, disabled: p = !1, label: m = "Drag & drop files here, or click to browse", hint: h, children: g, classes: _, className: v, style: y, "aria-label": b = "Upload files" }, x) => {
|
|
14
|
+
let S = n(null), [C, w] = r(!1), T = n(0), E = t(), D = (e) => {
|
|
15
|
+
S.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
|
|
16
|
+
}, O = (t) => {
|
|
17
|
+
if (!t || p) return;
|
|
18
|
+
let n = Array.from(t), r = [];
|
|
19
|
+
!d && n.length > 1 && (n.slice(1).forEach((e) => r.push({
|
|
20
|
+
file: e,
|
|
21
|
+
reason: "multiple"
|
|
22
|
+
})), n = n.slice(0, 1));
|
|
23
|
+
let i = [];
|
|
24
|
+
for (let e of n) l(e, u) ? f != null && e.size > f ? r.push({
|
|
25
|
+
file: e,
|
|
26
|
+
reason: "size"
|
|
27
|
+
}) : i.push(e) : r.push({
|
|
28
|
+
file: e,
|
|
29
|
+
reason: "type"
|
|
30
|
+
});
|
|
31
|
+
i.length && e?.(i), r.length && c?.(r);
|
|
32
|
+
}, k = () => {
|
|
33
|
+
p || S.current?.click();
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ s("div", {
|
|
36
|
+
role: "button",
|
|
37
|
+
tabIndex: p ? -1 : 0,
|
|
38
|
+
"aria-label": b,
|
|
39
|
+
"aria-disabled": p || void 0,
|
|
40
|
+
"aria-describedby": h ? `${E}-hint` : void 0,
|
|
41
|
+
className: i(a.root, C && a.dragging, p && a.disabled, _?.root, v),
|
|
42
|
+
style: y,
|
|
43
|
+
onClick: k,
|
|
44
|
+
onKeyDown: (e) => {
|
|
45
|
+
p || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), k());
|
|
46
|
+
},
|
|
47
|
+
onDragEnter: (e) => {
|
|
48
|
+
e.preventDefault(), p || (T.current += 1, w(!0));
|
|
49
|
+
},
|
|
50
|
+
onDragOver: (e) => {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
},
|
|
53
|
+
onDragLeave: (e) => {
|
|
54
|
+
e.preventDefault(), --T.current, T.current <= 0 && (T.current = 0, w(!1));
|
|
55
|
+
},
|
|
56
|
+
onDrop: (e) => {
|
|
57
|
+
e.preventDefault(), T.current = 0, w(!1), p || O(e.dataTransfer?.files ?? null);
|
|
58
|
+
},
|
|
59
|
+
children: [/* @__PURE__ */ o("input", {
|
|
60
|
+
ref: D,
|
|
61
|
+
id: E,
|
|
62
|
+
type: "file",
|
|
63
|
+
className: i(a.input, _?.input),
|
|
64
|
+
accept: u,
|
|
65
|
+
multiple: d,
|
|
66
|
+
disabled: p,
|
|
67
|
+
tabIndex: -1,
|
|
68
|
+
onChange: (e) => {
|
|
69
|
+
O(e.target.files), e.target.value = "";
|
|
70
|
+
}
|
|
71
|
+
}), typeof g == "function" ? g({ isDragging: C }) : g ?? /* @__PURE__ */ s("div", {
|
|
72
|
+
className: i(a.content, _?.content),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ o("span", {
|
|
75
|
+
className: i(a.icon, _?.icon),
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: /* @__PURE__ */ s("svg", {
|
|
78
|
+
viewBox: "0 0 24 24",
|
|
79
|
+
fill: "none",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
strokeWidth: "1.6",
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
strokeLinejoin: "round",
|
|
84
|
+
children: [/* @__PURE__ */ o("path", { d: "M12 16V4m0 0L8 8m4-4l4 4" }), /* @__PURE__ */ o("path", { d: "M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2" })]
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ o("span", {
|
|
88
|
+
className: i(a.label, _?.label),
|
|
89
|
+
children: m
|
|
90
|
+
}),
|
|
91
|
+
h != null && /* @__PURE__ */ o("span", {
|
|
92
|
+
id: `${E}-hint`,
|
|
93
|
+
className: i(a.hint, _?.hint),
|
|
94
|
+
children: h
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
u.displayName = "Dropzone";
|
|
101
|
+
export { u as Dropzone };
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
s as content,
|
|
13
|
-
a as default,
|
|
14
|
-
n as disabled,
|
|
15
|
-
c as dragging,
|
|
16
|
-
e as hint,
|
|
17
|
-
i as icon,
|
|
18
|
-
o as input,
|
|
19
|
-
r as label,
|
|
20
|
-
t as root
|
|
1
|
+
// src/components/Dropzone/Dropzone.module.scss
|
|
2
|
+
var e = "crk-root-YXMcJ", t = "crk-dragging-wtsfx", n = "crk-disabled-9u5TX", r = "crk-input-1u82w", i = "crk-content-y4GQe", a = "crk-icon--ScxV", o = "crk-label-8as4c", s = "crk-hint-c-HhG", c = {
|
|
3
|
+
root: e,
|
|
4
|
+
dragging: t,
|
|
5
|
+
disabled: n,
|
|
6
|
+
input: r,
|
|
7
|
+
content: i,
|
|
8
|
+
icon: a,
|
|
9
|
+
label: o,
|
|
10
|
+
hint: s
|
|
21
11
|
};
|
|
12
|
+
export { i as content, c as default, n as disabled, t as dragging, s as hint, a as icon, r as input, o as label, e as root };
|