@overdoser/react-toolkit 0.20.0 → 0.21.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 (273) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.js +20 -0
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.js +25 -0
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +92 -95
  9. package/components/Alert/Alert.module.js +18 -0
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.js +23 -0
  12. package/components/Badge/Badge.js +16 -38
  13. package/components/Badge/Badge.module.js +17 -0
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.js +25 -0
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.js +35 -0
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.js +32 -0
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +46 -41
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.js +32 -0
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.js +23 -0
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.js +28 -0
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.js +17 -0
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.js +10 -0
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.js +66 -0
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.js +29 -0
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +12 -10
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.js +12 -0
  71. package/components/EmptyState/EmptyState.js +58 -55
  72. package/components/EmptyState/EmptyState.module.js +14 -0
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +32 -35
  75. package/components/Form/Form.module.js +16 -0
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.js +26 -0
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +25 -22
  85. package/components/Kbd/Kbd.module.js +10 -0
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.js +23 -0
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.js +10 -0
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.js +12 -0
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.js +40 -0
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.js +18 -0
  96. package/components/PageHeader/PageHeader.js +78 -72
  97. package/components/PageHeader/PageHeader.module.js +23 -0
  98. package/components/Pagination/Pagination.js +63 -84
  99. package/components/Pagination/Pagination.module.js +13 -0
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.js +12 -0
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +57 -90
  105. package/components/ProgressBar/ProgressBar.module.js +29 -0
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.js +3 -0
  108. package/components/SegmentedControl/SegmentedControl.js +94 -130
  109. package/components/SegmentedControl/SegmentedControl.module.js +21 -0
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.js +15 -0
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.js +12 -0
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.js +31 -0
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.js +14 -0
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.js +42 -0
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.js +18 -0
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.js +28 -0
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.js +29 -0
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.js +31 -0
  134. package/components/Timeline/Timeline.module.js +76 -0
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +245 -178
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.js +98 -0
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.js +29 -0
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.js +37 -0
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  153. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.js +17 -0
  157. package/components/Typography/Typography.js +11 -36
  158. package/components/Typography/Typography.module.js +30 -0
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.js +15 -0
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.js +9 -0
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  183. package/components/inputs/Select/Select.js +555 -682
  184. package/components/inputs/Select/Select.module.js +38 -0
  185. package/components/inputs/Slider/Slider.js +97 -128
  186. package/components/inputs/Slider/Slider.module.js +9 -0
  187. package/components/inputs/Switch/Switch.js +11 -8
  188. package/components/inputs/Textarea/Textarea.js +42 -58
  189. package/components/inputs/Textarea/Textarea.module.js +14 -0
  190. package/hooks/useClickOutside.js +17 -14
  191. package/hooks/useDebouncedValue.js +13 -14
  192. package/hooks/useElementSize.js +27 -22
  193. package/hooks/useEscapeLayer.js +28 -29
  194. package/hooks/useFocusTrap.js +27 -38
  195. package/hooks/useKeyboard.js +76 -64
  196. package/hooks/useMediaQuery.js +10 -15
  197. package/hooks/useNow.js +28 -33
  198. package/hooks/usePersistedState.js +98 -94
  199. package/hooks/usePortalPosition.js +25 -19
  200. package/hooks/useResizable.js +106 -104
  201. package/hooks/useTheme.js +28 -23
  202. package/index.css +2 -1
  203. package/index.js +97 -215
  204. package/index.layered.css +2 -3
  205. package/llms.txt +3 -0
  206. package/manifest.json +8 -0
  207. package/package.json +1 -1
  208. package/utils/formatBytes.js +29 -13
  209. package/utils/themeScript.js +6 -8
  210. package/utils/timeAgo.js +59 -32
  211. package/components/Accordion/Accordion.module.scss.js +0 -36
  212. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  213. package/components/Alert/Alert.module.scss.js +0 -33
  214. package/components/Avatar/Avatar.module.scss.js +0 -43
  215. package/components/Badge/Badge.module.scss.js +0 -31
  216. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  217. package/components/Button/Button.module.scss.js +0 -47
  218. package/components/Card/Card.module.scss.js +0 -60
  219. package/components/Chart/Chart.module.scss.js +0 -61
  220. package/components/Chip/Chip.module.scss.js +0 -59
  221. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  222. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  223. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  224. package/components/Divider/Divider.module.scss.js +0 -31
  225. package/components/Draggable/Draggable.module.scss.js +0 -17
  226. package/components/Drawer/Drawer.module.scss.js +0 -119
  227. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  228. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  229. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  230. package/components/Form/Form.module.scss.js +0 -29
  231. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  232. package/components/Kbd/Kbd.module.scss.js +0 -17
  233. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  234. package/components/Link/Link.module.scss.js +0 -16
  235. package/components/List/List.module.scss.js +0 -21
  236. package/components/Loader/Loader.module.scss.js +0 -70
  237. package/components/Modal/Modal.module.scss.js +0 -33
  238. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  239. package/components/Pagination/Pagination.module.scss.js +0 -23
  240. package/components/Popover/Popover.module.scss.js +0 -21
  241. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  242. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  243. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  244. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  245. package/components/Spinner/Spinner.module.scss.js +0 -20
  246. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  247. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  248. package/components/StatCard/StatCard.module.scss.js +0 -72
  249. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  250. package/components/Table/Table.module.scss.js +0 -81
  251. package/components/Tabs/Tabs.module.scss.js +0 -53
  252. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  253. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  254. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  255. package/components/Timeline/Timeline.module.scss.js +0 -141
  256. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  257. package/components/Timer/Timer.module.scss.js +0 -55
  258. package/components/Toast/Toast.module.scss.js +0 -62
  259. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  260. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  261. package/components/Typography/Typography.module.scss.js +0 -53
  262. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  263. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  264. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  265. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  266. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  267. package/components/inputs/Input/Input.module.scss.js +0 -27
  268. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  269. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  270. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  271. package/components/inputs/Select/Select.module.scss.js +0 -73
  272. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  273. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
@@ -1,18 +1,28 @@
1
- import { useState as a, useCallback as t, useMemo as f } from "react";
2
- function x() {
3
- const [s, p] = a(null), [c, o] = a(!1), n = t((e) => {
4
- p(e), o(!0);
5
- }, []), u = t(
6
- (e) => {
7
- e.preventDefault(), n({ x: e.clientX, y: e.clientY });
8
- },
9
- [n]
10
- ), l = t(() => o(!1), []), r = t((e) => o(e), []);
11
- return f(
12
- () => ({ anchor: s, open: c, onOpenChange: r, onContextMenu: u, openAt: n, close: l }),
13
- [s, c, r, u, n, l]
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 { jsxs as y, jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as B, useRef as W, useState as K, useId as O } from "react";
3
- import c from "clsx";
4
- import n from "./Dropzone.module.scss.js";
5
- function U(o, s) {
6
- const t = s.trim().toLowerCase();
7
- return t ? t.startsWith(".") ? o.name.toLowerCase().endsWith(t) : t.endsWith("/*") ? o.type.toLowerCase().startsWith(t.slice(0, -1)) : o.type.toLowerCase() === t : !0;
1
+ import e from "./Dropzone.module.js";
2
+ import { forwardRef as t, useId as n, useRef as r, useState as i } from "react";
3
+ import a from "clsx";
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 V(o, s) {
10
- return s ? s.split(",").some((t) => U(o, t)) : !0;
10
+ function l(e, t) {
11
+ return !t || t.split(",").some((t) => c(e, t));
11
12
  }
12
- const q = B(
13
- ({
14
- onFiles: o,
15
- onReject: s,
16
- accept: t,
17
- multiple: k = !1,
18
- maxSize: w,
19
- disabled: r = !1,
20
- label: b = "Drag & drop files here, or click to browse",
21
- hint: m,
22
- children: h,
23
- classes: a,
24
- className: j,
25
- style: I,
26
- "aria-label": R = "Upload files"
27
- }, g) => {
28
- const C = W(null), [L, d] = K(!1), u = W(0), D = O(), z = (e) => {
29
- C.current = e, typeof g == "function" ? g(e) : g && (g.current = e);
30
- }, N = (e) => {
31
- if (!e || r) return;
32
- let f = Array.from(e);
33
- const p = [];
34
- !k && f.length > 1 && (f.slice(1).forEach((i) => p.push({ file: i, reason: "multiple" })), f = f.slice(0, 1));
35
- const v = [];
36
- for (const i of f)
37
- V(i, t) ? w != null && i.size > w ? p.push({ file: i, reason: "size" }) : v.push(i) : p.push({ file: i, reason: "type" });
38
- v.length && o?.(v), p.length && s?.(p);
39
- }, x = () => {
40
- r || C.current?.click();
41
- }, E = (e) => {
42
- r || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), x());
43
- }, A = (e) => {
44
- e.preventDefault(), !r && (u.current += 1, d(!0));
45
- }, M = (e) => {
46
- e.preventDefault();
47
- }, T = (e) => {
48
- e.preventDefault(), u.current -= 1, u.current <= 0 && (u.current = 0, d(!1));
49
- }, $ = (e) => {
50
- e.preventDefault(), u.current = 0, d(!1), r || N(e.dataTransfer?.files ?? null);
51
- };
52
- return /* @__PURE__ */ y(
53
- "div",
54
- {
55
- role: "button",
56
- tabIndex: r ? -1 : 0,
57
- "aria-label": R,
58
- "aria-disabled": r || void 0,
59
- "aria-describedby": m ? `${D}-hint` : void 0,
60
- className: c(
61
- n.root,
62
- L && n.dragging,
63
- r && n.disabled,
64
- a?.root,
65
- j
66
- ),
67
- style: I,
68
- onClick: x,
69
- onKeyDown: E,
70
- onDragEnter: A,
71
- onDragOver: M,
72
- onDragLeave: T,
73
- onDrop: $,
74
- children: [
75
- /* @__PURE__ */ l(
76
- "input",
77
- {
78
- ref: z,
79
- id: D,
80
- type: "file",
81
- className: c(n.input, a?.input),
82
- accept: t,
83
- multiple: k,
84
- disabled: r,
85
- tabIndex: -1,
86
- onChange: (e) => {
87
- N(e.target.files), e.target.value = "";
88
- }
89
- }
90
- ),
91
- typeof h == "function" ? h({ isDragging: L }) : h ?? /* @__PURE__ */ y("div", { className: c(n.content, a?.content), children: [
92
- /* @__PURE__ */ l("span", { className: c(n.icon, a?.icon), "aria-hidden": "true", children: /* @__PURE__ */ y("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
93
- /* @__PURE__ */ l("path", { d: "M12 16V4m0 0L8 8m4-4l4 4" }),
94
- /* @__PURE__ */ l("path", { d: "M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2" })
95
- ] }) }),
96
- /* @__PURE__ */ l("span", { className: c(n.label, a?.label), children: b }),
97
- m != null && /* @__PURE__ */ l("span", { id: `${D}-hint`, className: c(n.hint, a?.hint), children: m })
98
- ] })
99
- ]
100
- }
101
- );
102
- }
103
- );
104
- q.displayName = "Dropzone";
105
- export {
106
- q as Dropzone
107
- };
13
+ var u = t(({ onFiles: t, 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 = r(null), [C, w] = i(!1), T = r(0), E = n(), D = (e) => {
15
+ S.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
16
+ }, O = (e) => {
17
+ if (!e || p) return;
18
+ let n = Array.from(e), 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 && t?.(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: a(e.root, C && e.dragging, p && e.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: a(e.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: a(e.content, _?.content),
73
+ children: [
74
+ /* @__PURE__ */ o("span", {
75
+ className: a(e.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: a(e.label, _?.label),
89
+ children: m
90
+ }),
91
+ h != null && /* @__PURE__ */ o("span", {
92
+ id: `${E}-hint`,
93
+ className: a(e.hint, _?.hint),
94
+ children: h
95
+ })
96
+ ]
97
+ })]
98
+ });
99
+ });
100
+ u.displayName = "Dropzone";
101
+ export { u as Dropzone };
@@ -0,0 +1,12 @@
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
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 };
@@ -1,55 +1,58 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as k } from "react";
3
- import t from "clsx";
4
- import o from "./EmptyState.module.scss.js";
5
- const x = () => /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
6
- /* @__PURE__ */ r("path", { d: "M3 13h4l2 3h6l2-3h4" }),
7
- /* @__PURE__ */ r("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" })
8
- ] }), y = () => /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
9
- /* @__PURE__ */ r("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" }),
10
- /* @__PURE__ */ r("path", { d: "M12 9v4" }),
11
- /* @__PURE__ */ r("path", { d: "M12 17h.01" })
12
- ] }), N = k(
13
- ({
14
- variant: i = "empty",
15
- icon: a,
16
- title: l,
17
- description: c,
18
- action: h,
19
- children: s,
20
- size: m = "md",
21
- bordered: p = !1,
22
- classes: e,
23
- className: v,
24
- ...u
25
- }, f) => {
26
- const d = a === void 0 ? i === "error" ? /* @__PURE__ */ r(y, {}) : /* @__PURE__ */ r(x, {}) : a;
27
- return /* @__PURE__ */ n(
28
- "div",
29
- {
30
- ref: f,
31
- role: i === "error" ? "alert" : void 0,
32
- className: t(
33
- o.root,
34
- o[i],
35
- o[m],
36
- p && o.bordered,
37
- e?.root,
38
- v
39
- ),
40
- ...u,
41
- children: [
42
- d !== !1 && d != null && /* @__PURE__ */ r("div", { className: t(o.icon, e?.icon), "aria-hidden": "true", children: d }),
43
- l && /* @__PURE__ */ r("div", { className: t(o.title, e?.title), children: l }),
44
- c && /* @__PURE__ */ r("div", { className: t(o.description, e?.description), children: c }),
45
- s,
46
- h && /* @__PURE__ */ r("div", { className: t(o.action, e?.action), children: h })
47
- ]
48
- }
49
- );
50
- }
51
- );
52
- N.displayName = "EmptyState";
53
- export {
54
- N as EmptyState
55
- };
1
+ import e from "./EmptyState.module.js";
2
+ import { forwardRef as t } from "react";
3
+ import n from "clsx";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ // src/components/EmptyState/EmptyState.tsx
6
+ var a = () => /* @__PURE__ */ i("svg", {
7
+ viewBox: "0 0 24 24",
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeWidth: "1.5",
11
+ strokeLinecap: "round",
12
+ strokeLinejoin: "round",
13
+ "aria-hidden": "true",
14
+ children: [/* @__PURE__ */ r("path", { d: "M3 13h4l2 3h6l2-3h4" }), /* @__PURE__ */ r("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" })]
15
+ }), o = () => /* @__PURE__ */ i("svg", {
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ stroke: "currentColor",
19
+ strokeWidth: "1.5",
20
+ strokeLinecap: "round",
21
+ strokeLinejoin: "round",
22
+ "aria-hidden": "true",
23
+ children: [
24
+ /* @__PURE__ */ r("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" }),
25
+ /* @__PURE__ */ r("path", { d: "M12 9v4" }),
26
+ /* @__PURE__ */ r("path", { d: "M12 17h.01" })
27
+ ]
28
+ }), s = t(({ variant: t = "empty", icon: s, title: c, description: l, action: u, children: d, size: f = "md", bordered: p = !1, classes: m, className: h, ...g }, _) => {
29
+ let v = s === void 0 ? r(t === "error" ? o : a, {}) : s;
30
+ return /* @__PURE__ */ i("div", {
31
+ ref: _,
32
+ role: t === "error" ? "alert" : void 0,
33
+ className: n(e.root, e[t], e[f], p && e.bordered, m?.root, h),
34
+ ...g,
35
+ children: [
36
+ v !== !1 && v != null && /* @__PURE__ */ r("div", {
37
+ className: n(e.icon, m?.icon),
38
+ "aria-hidden": "true",
39
+ children: v
40
+ }),
41
+ c && /* @__PURE__ */ r("div", {
42
+ className: n(e.title, m?.title),
43
+ children: c
44
+ }),
45
+ l && /* @__PURE__ */ r("div", {
46
+ className: n(e.description, m?.description),
47
+ children: l
48
+ }),
49
+ d,
50
+ u && /* @__PURE__ */ r("div", {
51
+ className: n(e.action, m?.action),
52
+ children: u
53
+ })
54
+ ]
55
+ });
56
+ });
57
+ s.displayName = "EmptyState";
58
+ export { s as EmptyState };
@@ -0,0 +1,14 @@
1
+ // src/components/EmptyState/EmptyState.module.scss
2
+ var e = "crk-root--QSMy", t = "crk-sm-X3NZF", n = "crk-title-AfRVx", r = "crk-md-redWw", i = "crk-lg-Lnt1u", a = "crk-error-Y09vt", o = "crk-bordered-aCCLu", s = "crk-icon-ABwaI", c = "crk-description--LJrG", l = "crk-action-7ICV2", u = {
3
+ root: e,
4
+ sm: t,
5
+ title: n,
6
+ md: r,
7
+ lg: i,
8
+ error: a,
9
+ bordered: o,
10
+ icon: s,
11
+ description: c,
12
+ action: l
13
+ };
14
+ export { l as action, o as bordered, u as default, c as description, a as error, s as icon, i as lg, r as md, e as root, t as sm, n as title };
@@ -38,4 +38,4 @@ export interface FormProps<T extends FieldValues> {
38
38
  * <Button type="submit">Save</Button>
39
39
  * </Form>
40
40
  */
41
- export declare function Form<T extends FieldValues>({ form, onSubmit, errors, reserveErrorSpace, fieldClasses, className, style, children, }: FormProps<T>): import("react/jsx-runtime").JSX.Element;
41
+ export declare function Form<T extends FieldValues>({ form, onSubmit, errors, reserveErrorSpace, fieldClasses, className, style, children, }: FormProps<T>): import("react").JSX.Element;
@@ -1,36 +1,33 @@
1
- import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
- import { useMemo as p } from "react";
3
- import { FormProvider as x } from "react-hook-form";
4
- import F from "clsx";
5
- import r from "./Form.module.scss.js";
6
- import { FormFieldDefaultsContext as N } from "./formFieldDefaults.js";
7
- function y({
8
- form: l,
9
- onSubmit: s,
10
- errors: m,
11
- reserveErrorSpace: t,
12
- fieldClasses: i,
13
- className: e,
14
- style: n,
15
- children: a
16
- }) {
17
- const f = m && m.length > 0, c = p(
18
- () => ({ reserveErrorSpace: t, classes: i }),
19
- [t, i]
20
- );
21
- return /* @__PURE__ */ o(x, { ...l, children: /* @__PURE__ */ o(N.Provider, { value: c, children: /* @__PURE__ */ h(
22
- "form",
23
- {
24
- onSubmit: l.handleSubmit(s),
25
- className: F(r.root, t === !1 && r.rootLooseGap, e),
26
- style: n,
27
- children: [
28
- f && /* @__PURE__ */ o("ul", { className: r.formErrors, role: "alert", children: m.map((d, u) => /* @__PURE__ */ o("li", { className: r.formError, children: d }, u)) }),
29
- a
30
- ]
31
- }
32
- ) }) });
1
+ import e from "./Form.module.js";
2
+ import { FormFieldDefaultsContext as t } from "./formFieldDefaults.js";
3
+ import { useMemo as n } from "react";
4
+ import r from "clsx";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { FormProvider as o } from "react-hook-form";
7
+ // src/components/Form/Form.tsx
8
+ function s({ form: s, onSubmit: c, errors: l, reserveErrorSpace: u, fieldClasses: d, className: f, style: p, children: m }) {
9
+ let h = l && l.length > 0, g = n(() => ({
10
+ reserveErrorSpace: u,
11
+ classes: d
12
+ }), [u, d]);
13
+ return /* @__PURE__ */ i(o, {
14
+ ...s,
15
+ children: /* @__PURE__ */ i(t.Provider, {
16
+ value: g,
17
+ children: /* @__PURE__ */ a("form", {
18
+ onSubmit: s.handleSubmit(c),
19
+ className: r(e.root, u === !1 && e.rootLooseGap, f),
20
+ style: p,
21
+ children: [h && /* @__PURE__ */ i("ul", {
22
+ className: e.formErrors,
23
+ role: "alert",
24
+ children: l.map((t, n) => /* @__PURE__ */ i("li", {
25
+ className: e.formError,
26
+ children: t
27
+ }, n))
28
+ }), m]
29
+ })
30
+ })
31
+ });
33
32
  }
34
- export {
35
- y as Form
36
- };
33
+ export { s as Form };
@@ -0,0 +1,16 @@
1
+ // src/components/Form/Form.module.scss
2
+ var e = "crk-root-jHIIP", t = "crk-rootLooseGap-NaOGK", n = "crk-formErrors-eh-OP", r = "crk-formError-XEuWv", i = "crk-field-OUlYz", a = "crk-label-udkR7", o = "crk-labelError-LOgKi", s = "crk-required-IYiA2", c = "crk-messageReserve-vTOdL", l = "crk-error-yFZXm", u = "crk-helperText-Dm-rb", d = "crk-row-nNbx-", f = {
3
+ root: e,
4
+ rootLooseGap: t,
5
+ formErrors: n,
6
+ formError: r,
7
+ field: i,
8
+ label: a,
9
+ labelError: o,
10
+ required: s,
11
+ messageReserve: c,
12
+ error: l,
13
+ helperText: u,
14
+ row: d
15
+ };
16
+ export { f as default, l as error, i as field, r as formError, n as formErrors, u as helperText, a as label, o as labelError, c as messageReserve, s as required, e as root, t as rootLooseGap, d as row };
@@ -56,4 +56,4 @@ export interface FormFieldProps {
56
56
  * <Input type="email" />
57
57
  * </FormField>
58
58
  */
59
- export declare function FormField({ name, label, helperText, required, rules, reserveErrorSpace, classes, className, style, children, }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
59
+ export declare function FormField({ name, label, helperText, required, rules, reserveErrorSpace, classes, className, style, children, }: FormFieldProps): import("react").JSX.Element;