@overdoser/react-toolkit 0.19.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 (279) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +47 -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 +41 -16
  123. package/components/Table/Table.js +383 -442
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/index.d.ts +1 -1
  126. package/components/Table/useTableSort.d.ts +1 -1
  127. package/components/Table/useTableSort.js +51 -42
  128. package/components/Tabs/Tabs.js +109 -161
  129. package/components/Tabs/Tabs.module.js +28 -0
  130. package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
  131. package/components/ThemeToggle/ThemeToggle.js +122 -97
  132. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  133. package/components/Timeline/GanttTimeline.js +357 -318
  134. package/components/Timeline/GanttTimeline.module.js +29 -0
  135. package/components/Timeline/HistoryTimeline.js +486 -450
  136. package/components/Timeline/HistoryTimeline.module.js +31 -0
  137. package/components/Timeline/Timeline.module.js +76 -0
  138. package/components/Timeline/TimelineShared.d.ts +7 -7
  139. package/components/Timeline/TimelineShared.js +288 -279
  140. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  141. package/components/Timeline/TraceEventDetails.js +245 -178
  142. package/components/Timeline/TraceTimeline.js +823 -783
  143. package/components/Timeline/TraceTimeline.module.js +98 -0
  144. package/components/Timeline/historyLayout.js +336 -263
  145. package/components/Timeline/timelineCore.js +208 -183
  146. package/components/Timeline/traceEvent.js +59 -61
  147. package/components/Timeline/traceLayout.js +101 -90
  148. package/components/Timeline/useTimeline.js +76 -79
  149. package/components/Timer/Timer.js +190 -156
  150. package/components/Timer/Timer.module.js +29 -0
  151. package/components/Toast/Toast.d.ts +1 -1
  152. package/components/Toast/Toast.js +128 -128
  153. package/components/Toast/Toast.module.js +37 -0
  154. package/components/Toast/toastStore.js +58 -62
  155. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  156. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  157. package/components/Tooltip/Tooltip.d.ts +1 -1
  158. package/components/Tooltip/Tooltip.js +76 -85
  159. package/components/Tooltip/Tooltip.module.js +17 -0
  160. package/components/Typography/Typography.js +11 -36
  161. package/components/Typography/Typography.module.js +30 -0
  162. package/components/inputs/Checkbox/Checkbox.js +27 -51
  163. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  164. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  165. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  166. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  167. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  168. package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
  169. package/components/inputs/DatePicker/DatePicker.js +115 -142
  170. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  171. package/components/inputs/DatePicker/dateUtils.js +32 -41
  172. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  173. package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
  174. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  175. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  176. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  177. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  178. package/components/inputs/Input/Input.js +98 -109
  179. package/components/inputs/Input/Input.module.js +15 -0
  180. package/components/inputs/NumberInput/NumberInput.js +112 -132
  181. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  182. package/components/inputs/Radio/Radio.js +50 -73
  183. package/components/inputs/Radio/Radio.module.js +9 -0
  184. package/components/inputs/SearchInput/SearchInput.js +98 -115
  185. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  186. package/components/inputs/Select/Select.js +555 -682
  187. package/components/inputs/Select/Select.module.js +38 -0
  188. package/components/inputs/Slider/Slider.js +97 -128
  189. package/components/inputs/Slider/Slider.module.js +9 -0
  190. package/components/inputs/Switch/Switch.js +11 -8
  191. package/components/inputs/Textarea/Textarea.js +42 -58
  192. package/components/inputs/Textarea/Textarea.module.js +14 -0
  193. package/hooks/useClickOutside.js +17 -14
  194. package/hooks/useDebouncedValue.js +13 -14
  195. package/hooks/useElementSize.js +27 -22
  196. package/hooks/useEscapeLayer.js +28 -29
  197. package/hooks/useFocusTrap.js +27 -38
  198. package/hooks/useKeyboard.js +76 -64
  199. package/hooks/useMediaQuery.js +10 -15
  200. package/hooks/useNow.js +28 -33
  201. package/hooks/usePersistedState.js +98 -91
  202. package/hooks/usePortalPosition.js +25 -19
  203. package/hooks/useResizable.js +106 -104
  204. package/hooks/useTheme.d.ts +2 -2
  205. package/hooks/useTheme.js +28 -25
  206. package/index.css +2 -1
  207. package/index.d.ts +1 -1
  208. package/index.js +97 -215
  209. package/index.layered.css +2 -3
  210. package/llms.txt +9 -6
  211. package/manifest.json +66 -10
  212. package/package.json +1 -1
  213. package/utils/formatBytes.js +29 -13
  214. package/utils/themeScript.d.ts +2 -0
  215. package/utils/themeScript.js +6 -8
  216. package/utils/timeAgo.js +59 -32
  217. package/components/Accordion/Accordion.module.scss.js +0 -36
  218. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  219. package/components/Alert/Alert.module.scss.js +0 -33
  220. package/components/Avatar/Avatar.module.scss.js +0 -43
  221. package/components/Badge/Badge.module.scss.js +0 -31
  222. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  223. package/components/Button/Button.module.scss.js +0 -47
  224. package/components/Card/Card.module.scss.js +0 -60
  225. package/components/Chart/Chart.module.scss.js +0 -61
  226. package/components/Chip/Chip.module.scss.js +0 -59
  227. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  228. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  229. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  230. package/components/Divider/Divider.module.scss.js +0 -31
  231. package/components/Draggable/Draggable.module.scss.js +0 -17
  232. package/components/Drawer/Drawer.module.scss.js +0 -119
  233. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  234. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  235. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  236. package/components/Form/Form.module.scss.js +0 -29
  237. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  238. package/components/Kbd/Kbd.module.scss.js +0 -17
  239. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  240. package/components/Link/Link.module.scss.js +0 -16
  241. package/components/List/List.module.scss.js +0 -21
  242. package/components/Loader/Loader.module.scss.js +0 -70
  243. package/components/Modal/Modal.module.scss.js +0 -33
  244. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  245. package/components/Pagination/Pagination.module.scss.js +0 -23
  246. package/components/Popover/Popover.module.scss.js +0 -21
  247. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  248. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  249. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  250. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  251. package/components/Spinner/Spinner.module.scss.js +0 -20
  252. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  253. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  254. package/components/StatCard/StatCard.module.scss.js +0 -72
  255. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  256. package/components/Table/Table.module.scss.js +0 -81
  257. package/components/Tabs/Tabs.module.scss.js +0 -53
  258. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  259. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  260. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  261. package/components/Timeline/Timeline.module.scss.js +0 -141
  262. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  263. package/components/Timer/Timer.module.scss.js +0 -55
  264. package/components/Toast/Toast.module.scss.js +0 -62
  265. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  266. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  267. package/components/Typography/Typography.module.scss.js +0 -53
  268. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  269. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  270. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  271. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  272. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  273. package/components/inputs/Input/Input.module.scss.js +0 -27
  274. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  275. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  276. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  277. package/components/inputs/Select/Select.module.scss.js +0 -73
  278. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  279. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
@@ -0,0 +1,28 @@
1
+ // src/components/CommandPalette/CommandPalette.module.scss
2
+ var e = "crk-backdrop-85I58", t = "crk-paletteBackdropIn-OuahC", n = "crk-panel-RBr7A", r = "crk-paletteIn-K7Qg9", i = "crk-header-WpV0d", a = "crk-breadcrumb-yrjqZ", o = "crk-input-1yX4p", s = "crk-headerSpinner-vWtoV", c = "crk-list-Z8b3Q", l = "crk-group-hKsgv", u = "crk-groupLabel-S-h3h", d = "crk-item-TULJl", f = "crk-itemActive-T5Hpv", p = "crk-itemDisabled-A-ped", m = "crk-itemIcon-Ruqhi", h = "crk-itemText-nEkyw", g = "crk-itemLabel-03iZM", _ = "crk-itemDescription-ehmYh", v = "crk-itemChevron-234PX", y = "crk-itemShortcut-OHXBv", b = "crk-match--l5e2", x = "crk-message-TgWpQ", S = "crk-loading-fcSft", C = "crk-footer-bwQFJ", w = {
3
+ backdrop: e,
4
+ paletteBackdropIn: t,
5
+ panel: n,
6
+ paletteIn: r,
7
+ header: i,
8
+ breadcrumb: a,
9
+ input: o,
10
+ headerSpinner: s,
11
+ list: c,
12
+ group: l,
13
+ groupLabel: u,
14
+ item: d,
15
+ itemActive: f,
16
+ itemDisabled: p,
17
+ itemIcon: m,
18
+ itemText: h,
19
+ itemLabel: g,
20
+ itemDescription: _,
21
+ itemChevron: v,
22
+ itemShortcut: y,
23
+ match: b,
24
+ message: x,
25
+ loading: S,
26
+ footer: C
27
+ };
28
+ export { e as backdrop, a as breadcrumb, w as default, C as footer, l as group, u as groupLabel, i as header, s as headerSpinner, o as input, d as item, f as itemActive, v as itemChevron, _ as itemDescription, p as itemDisabled, m as itemIcon, g as itemLabel, y as itemShortcut, h as itemText, c as list, S as loading, b as match, x as message, t as paletteBackdropIn, r as paletteIn, n as panel };
@@ -101,7 +101,7 @@ export interface ConfirmProviderProps {
101
101
  * <App />
102
102
  * </ConfirmProvider>
103
103
  */
104
- export declare function ConfirmProvider({ children, defaults }: ConfirmProviderProps): import("react/jsx-runtime").JSX.Element;
104
+ export declare function ConfirmProvider({ children, defaults }: ConfirmProviderProps): import("react").JSX.Element;
105
105
  export declare namespace ConfirmProvider {
106
106
  var displayName: string;
107
107
  }
@@ -1,201 +1,186 @@
1
- import { jsxs as m, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as $, useState as k, useRef as y, useId as T, useEffect as j, useCallback as v, useMemo as q, useContext as ee, createContext as ne } from "react";
3
- import f from "clsx";
4
- import { Modal as w } from "../Modal/Modal.js";
5
- import { Button as G } from "../Button/Button.js";
6
- import { Input as re } from "../inputs/Input/Input.js";
7
- import t from "./ConfirmDialog.module.scss.js";
8
- const oe = /* @__PURE__ */ r("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r(
9
- "path",
10
- {
11
- fillRule: "evenodd",
12
- d: "M8.26 3.1c.77-1.33 2.71-1.33 3.48 0l5.58 9.67c.77 1.33-.19 3-1.74 3H4.42c-1.55 0-2.51-1.67-1.74-3L8.26 3.1zM10 7a1 1 0 011 1v3a1 1 0 11-2 0V8a1 1 0 011-1zm0 7a1 1 0 100-2 1 1 0 000 2z",
13
- clipRule: "evenodd"
14
- }
15
- ) }), te = (e) => String(e?.message ?? e), J = $(
16
- ({
17
- open: e,
18
- onConfirm: C,
19
- onCancel: u,
20
- title: s = "Are you sure?",
21
- description: i,
22
- children: x,
23
- confirmLabel: h = "Confirm",
24
- cancelLabel: P = "Cancel",
25
- danger: p = !1,
26
- requireText: d,
27
- icon: g,
28
- autoFocus: E,
29
- closeOnBackdrop: n = !0,
30
- errorMessage: c = te,
31
- "aria-label": b,
32
- classes: o,
33
- className: U,
34
- style: X
35
- }, Y) => {
36
- const [a, I] = k(!1), [F, N] = k(void 0), [M, H] = k(""), L = y(null), S = y(null), A = y(null), R = y(!0), K = T();
37
- j(() => (R.current = !0, () => {
38
- R.current = !1;
39
- }), []), j(() => {
40
- e || (I(!1), N(void 0), H(""));
41
- }, [e]);
42
- const V = E ?? (p ? "cancel" : "confirm");
43
- j(() => {
44
- if (!e) return;
45
- (d ? A.current : V === "cancel" ? S.current : L.current)?.focus();
46
- }, [e, V, d]);
47
- const z = d === void 0 || M === d, B = z && !a, W = v(async () => {
48
- if (!B) return;
49
- N(void 0);
50
- let l;
51
- try {
52
- l = C();
53
- } catch (O) {
54
- N(O);
55
- return;
56
- }
57
- if (l && typeof l.then == "function") {
58
- I(!0);
59
- try {
60
- await l;
61
- } catch (O) {
62
- R.current && N(O);
63
- } finally {
64
- R.current && I(!1);
65
- }
66
- }
67
- }, [B, C]), D = v(() => {
68
- a || u();
69
- }, [a, u]), _ = g === !1 ? null : g !== void 0 ? g : p ? oe : null, Z = q(
70
- () => ({ modal: o?.modal, header: o?.header, body: o?.body, footer: o?.footer }),
71
- [o]
72
- );
73
- return /* @__PURE__ */ m(
74
- w,
75
- {
76
- ref: Y,
77
- open: e,
78
- onClose: D,
79
- size: "sm",
80
- closeOnBackdrop: n && !a,
81
- closeOnEscape: !a,
82
- classes: Z,
83
- className: f(t.root, p && t.danger, U),
84
- style: X,
85
- "aria-label": typeof s == "string" ? s : s ? void 0 : b,
86
- children: [
87
- s ? /* @__PURE__ */ r(w.Header, { onClose: a ? void 0 : D, children: /* @__PURE__ */ m("span", { className: t.titleRow, children: [
88
- _ && /* @__PURE__ */ r("span", { className: f(t.icon, o?.icon), "aria-hidden": "true", children: _ }),
89
- /* @__PURE__ */ r("span", { className: t.title, children: s })
90
- ] }) }) : null,
91
- /* @__PURE__ */ m(w.Body, { children: [
92
- i && /* @__PURE__ */ r("div", { className: f(t.description, o?.description), children: i }),
93
- x,
94
- d !== void 0 && /* @__PURE__ */ m("div", { className: f(t.input, o?.input), children: [
95
- /* @__PURE__ */ m("label", { htmlFor: K, className: t.inputLabel, children: [
96
- "Type ",
97
- /* @__PURE__ */ r("b", { children: d }),
98
- " to confirm"
99
- ] }),
100
- /* @__PURE__ */ r(
101
- re,
102
- {
103
- ref: A,
104
- id: K,
105
- value: M,
106
- onChange: (l) => H(l.target.value),
107
- onKeyDown: (l) => {
108
- l.key === "Enter" && B && (l.preventDefault(), W());
109
- },
110
- autoComplete: "off",
111
- spellCheck: !1,
112
- disabled: a,
113
- "aria-invalid": M.length > 0 && !z ? !0 : void 0
114
- }
115
- )
116
- ] }),
117
- F !== void 0 && /* @__PURE__ */ r("div", { role: "alert", className: f(t.error, o?.error), children: c(F) })
118
- ] }),
119
- /* @__PURE__ */ m(w.Footer, { children: [
120
- /* @__PURE__ */ r(
121
- G,
122
- {
123
- ref: S,
124
- variant: "ghost",
125
- onClick: D,
126
- disabled: a,
127
- className: f(t.cancel, o?.cancel),
128
- children: P
129
- }
130
- ),
131
- /* @__PURE__ */ r(
132
- G,
133
- {
134
- ref: L,
135
- variant: p ? "danger" : "primary",
136
- onClick: () => {
137
- W();
138
- },
139
- loading: a,
140
- disabled: !z,
141
- className: f(t.confirm, o?.confirm),
142
- children: h
143
- }
144
- )
145
- ] })
146
- ]
147
- }
148
- );
149
- }
150
- );
151
- J.displayName = "ConfirmDialog";
152
- const Q = ne(null);
153
- let ie = 0;
154
- function le({ children: e, defaults: C }) {
155
- const [u, s] = k(null), i = y(null);
156
- i.current = u;
157
- const x = v(
158
- (n = {}) => new Promise((c) => {
159
- i.current?.resolve(!1);
160
- const b = { id: ++ie, options: { ...C, ...n }, resolve: c };
161
- i.current = b, s(b);
162
- }),
163
- [C]
164
- ), h = v((n, c) => {
165
- i.current === n && (i.current = null, s(null), n.resolve(c));
166
- }, []), P = v(async () => {
167
- const n = i.current;
168
- if (!n) return;
169
- const c = n.options.onConfirm?.();
170
- c && typeof c.then == "function" && await c, h(n, !0);
171
- }, [h]), p = v(() => {
172
- const n = i.current;
173
- n && h(n, !1);
174
- }, [h]), { body: d, onConfirm: g, ...E } = u?.options ?? {};
175
- return /* @__PURE__ */ m(Q.Provider, { value: x, children: [
176
- e,
177
- /* @__PURE__ */ r(
178
- J,
179
- {
180
- ...E,
181
- open: u !== null,
182
- onConfirm: P,
183
- onCancel: p,
184
- children: d
185
- },
186
- u?.id ?? "idle"
187
- )
188
- ] });
1
+ import { Modal as e } from "../Modal/Modal.js";
2
+ import { Button as t } from "../Button/Button.js";
3
+ import { Input as n } from "../inputs/Input/Input.js";
4
+ import r from "./ConfirmDialog.module.js";
5
+ import { createContext as i, forwardRef as a, useCallback as o, useContext as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
6
+ import p from "clsx";
7
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
+ // src/components/ConfirmDialog/ConfirmDialog.tsx
9
+ var g = /* @__PURE__ */ m("svg", {
10
+ viewBox: "0 0 20 20",
11
+ fill: "currentColor",
12
+ "aria-hidden": "true",
13
+ children: /* @__PURE__ */ m("path", {
14
+ fillRule: "evenodd",
15
+ d: "M8.26 3.1c.77-1.33 2.71-1.33 3.48 0l5.58 9.67c.77 1.33-.19 3-1.74 3H4.42c-1.55 0-2.51-1.67-1.74-3L8.26 3.1zM10 7a1 1 0 011 1v3a1 1 0 11-2 0V8a1 1 0 011-1zm0 7a1 1 0 100-2 1 1 0 000 2z",
16
+ clipRule: "evenodd"
17
+ })
18
+ }), _ = (e) => String(e?.message ?? e), v = a(({ open: i, onConfirm: a, onCancel: s, title: v = "Are you sure?", description: y, children: b, confirmLabel: x = "Confirm", cancelLabel: S = "Cancel", danger: C = !1, requireText: w, icon: T, autoFocus: E, closeOnBackdrop: D = !0, errorMessage: O = _, "aria-label": k, classes: A, className: j, style: M }, N) => {
19
+ let [P, F] = f(!1), [I, L] = f(void 0), [R, z] = f(""), B = d(null), V = d(null), H = d(null), U = d(!0), W = l();
20
+ c(() => (U.current = !0, () => {
21
+ U.current = !1;
22
+ }), []), c(() => {
23
+ i || (F(!1), L(void 0), z(""));
24
+ }, [i]);
25
+ let G = E ?? (C ? "cancel" : "confirm");
26
+ c(() => {
27
+ i && (w ? H.current : G === "cancel" ? V.current : B.current)?.focus();
28
+ }, [
29
+ i,
30
+ G,
31
+ w
32
+ ]);
33
+ let K = w === void 0 || R === w, q = K && !P, J = o(async () => {
34
+ if (!q) return;
35
+ L(void 0);
36
+ let e;
37
+ try {
38
+ e = a();
39
+ } catch (e) {
40
+ L(e);
41
+ return;
42
+ }
43
+ if (e && typeof e.then == "function") {
44
+ F(!0);
45
+ try {
46
+ await e;
47
+ } catch (e) {
48
+ U.current && L(e);
49
+ } finally {
50
+ U.current && F(!1);
51
+ }
52
+ }
53
+ }, [q, a]), Y = o(() => {
54
+ P || s();
55
+ }, [P, s]), X = T === !1 ? null : T === void 0 ? C ? g : null : T, Z = u(() => ({
56
+ modal: A?.modal,
57
+ header: A?.header,
58
+ body: A?.body,
59
+ footer: A?.footer
60
+ }), [A]);
61
+ return /* @__PURE__ */ h(e, {
62
+ ref: N,
63
+ open: i,
64
+ onClose: Y,
65
+ size: "sm",
66
+ closeOnBackdrop: D && !P,
67
+ closeOnEscape: !P,
68
+ classes: Z,
69
+ className: p(r.root, C && r.danger, j),
70
+ style: M,
71
+ "aria-label": typeof v == "string" ? v : v ? void 0 : k,
72
+ children: [
73
+ v ? /* @__PURE__ */ m(e.Header, {
74
+ onClose: P ? void 0 : Y,
75
+ children: /* @__PURE__ */ h("span", {
76
+ className: r.titleRow,
77
+ children: [X && /* @__PURE__ */ m("span", {
78
+ className: p(r.icon, A?.icon),
79
+ "aria-hidden": "true",
80
+ children: X
81
+ }), /* @__PURE__ */ m("span", {
82
+ className: r.title,
83
+ children: v
84
+ })]
85
+ })
86
+ }) : null,
87
+ /* @__PURE__ */ h(e.Body, { children: [
88
+ y && /* @__PURE__ */ m("div", {
89
+ className: p(r.description, A?.description),
90
+ children: y
91
+ }),
92
+ b,
93
+ w !== void 0 && /* @__PURE__ */ h("div", {
94
+ className: p(r.input, A?.input),
95
+ children: [/* @__PURE__ */ h("label", {
96
+ htmlFor: W,
97
+ className: r.inputLabel,
98
+ children: [
99
+ "Type ",
100
+ /* @__PURE__ */ m("b", { children: w }),
101
+ " to confirm"
102
+ ]
103
+ }), /* @__PURE__ */ m(n, {
104
+ ref: H,
105
+ id: W,
106
+ value: R,
107
+ onChange: (e) => z(e.target.value),
108
+ onKeyDown: (e) => {
109
+ e.key === "Enter" && q && (e.preventDefault(), J());
110
+ },
111
+ autoComplete: "off",
112
+ spellCheck: !1,
113
+ disabled: P,
114
+ "aria-invalid": R.length > 0 && !K || void 0
115
+ })]
116
+ }),
117
+ I !== void 0 && /* @__PURE__ */ m("div", {
118
+ role: "alert",
119
+ className: p(r.error, A?.error),
120
+ children: O(I)
121
+ })
122
+ ] }),
123
+ /* @__PURE__ */ h(e.Footer, { children: [/* @__PURE__ */ m(t, {
124
+ ref: V,
125
+ variant: "ghost",
126
+ onClick: Y,
127
+ disabled: P,
128
+ className: p(r.cancel, A?.cancel),
129
+ children: S
130
+ }), /* @__PURE__ */ m(t, {
131
+ ref: B,
132
+ variant: C ? "danger" : "primary",
133
+ onClick: () => void J(),
134
+ loading: P,
135
+ disabled: !K,
136
+ className: p(r.confirm, A?.confirm),
137
+ children: x
138
+ })] })
139
+ ]
140
+ });
141
+ });
142
+ v.displayName = "ConfirmDialog";
143
+ var y = i(null), b = 0;
144
+ function x({ children: e, defaults: t }) {
145
+ let [n, r] = f(null), i = d(null);
146
+ i.current = n;
147
+ let a = o((e = {}) => new Promise((n) => {
148
+ i.current?.resolve(!1);
149
+ let a = {
150
+ id: ++b,
151
+ options: {
152
+ ...t,
153
+ ...e
154
+ },
155
+ resolve: n
156
+ };
157
+ i.current = a, r(a);
158
+ }), [t]), s = o((e, t) => {
159
+ i.current === e && (i.current = null, r(null), e.resolve(t));
160
+ }, []), c = o(async () => {
161
+ let e = i.current;
162
+ if (!e) return;
163
+ let t = e.options.onConfirm?.();
164
+ t && typeof t.then == "function" && await t, s(e, !0);
165
+ }, [s]), l = o(() => {
166
+ let e = i.current;
167
+ e && s(e, !1);
168
+ }, [s]), { body: u, onConfirm: p, ...g } = n?.options ?? {};
169
+ return /* @__PURE__ */ h(y.Provider, {
170
+ value: a,
171
+ children: [e, /* @__PURE__ */ m(v, {
172
+ ...g,
173
+ open: n !== null,
174
+ onConfirm: c,
175
+ onCancel: l,
176
+ children: u
177
+ }, n?.id ?? "idle")]
178
+ });
189
179
  }
190
- le.displayName = "ConfirmProvider";
191
- function he() {
192
- const e = ee(Q);
193
- if (!e)
194
- throw new Error("useConfirm() must be used inside a <ConfirmProvider>.");
195
- return e;
180
+ x.displayName = "ConfirmProvider";
181
+ function S() {
182
+ let e = s(y);
183
+ if (!e) throw Error("useConfirm() must be used inside a <ConfirmProvider>.");
184
+ return e;
196
185
  }
197
- export {
198
- J as ConfirmDialog,
199
- le as ConfirmProvider,
200
- he as useConfirm
201
- };
186
+ export { v as ConfirmDialog, x as ConfirmProvider, S as useConfirm };
@@ -0,0 +1,12 @@
1
+ // src/components/ConfirmDialog/ConfirmDialog.module.scss
2
+ var e = "crk-titleRow-45dc7", t = "crk-title-Y07Q8", n = "crk-icon-8MwQK", r = "crk-danger-yQ2Yd", i = "crk-description-KCKQ-", a = "crk-input--R-KC", o = "crk-inputLabel-mD7a2", s = "crk-error-f81j6", c = {
3
+ titleRow: e,
4
+ title: t,
5
+ icon: n,
6
+ danger: r,
7
+ description: i,
8
+ input: a,
9
+ inputLabel: o,
10
+ error: s
11
+ };
12
+ export { r as danger, c as default, i as description, s as error, n as icon, a as input, o as inputLabel, t as title, e as titleRow };
@@ -1,36 +1,25 @@
1
- import { jsx as e, jsxs as c, Fragment as h } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import a from "clsx";
4
- import r from "./Divider.module.scss.js";
5
- const N = f(
6
- ({ orientation: o = "horizontal", variant: t = "solid", label: n, labelPosition: m = "center", classes: l, className: s, ...p }, d) => {
7
- const i = n != null && o === "horizontal";
8
- return /* @__PURE__ */ e(
9
- "div",
10
- {
11
- ref: d,
12
- role: "separator",
13
- "aria-orientation": o,
14
- className: a(
15
- r.root,
16
- r[o],
17
- r[t],
18
- i && r.withLabel,
19
- i && r[`label_${m}`],
20
- l?.root,
21
- s
22
- ),
23
- ...p,
24
- children: i ? /* @__PURE__ */ c(h, { children: [
25
- /* @__PURE__ */ e("span", { className: a(r.line, l?.line) }),
26
- /* @__PURE__ */ e("span", { className: a(r.label, l?.label), children: n }),
27
- /* @__PURE__ */ e("span", { className: a(r.line, l?.line) })
28
- ] }) : null
29
- }
30
- );
31
- }
32
- );
33
- N.displayName = "Divider";
34
- export {
35
- N as Divider
36
- };
1
+ import e from "./Divider.module.js";
2
+ import { forwardRef as t } from "react";
3
+ import n from "clsx";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ // src/components/Divider/Divider.tsx
6
+ var o = t(({ orientation: t = "horizontal", variant: o = "solid", label: s, labelPosition: c = "center", classes: l, className: u, ...d }, f) => {
7
+ let p = s != null && t === "horizontal";
8
+ return /* @__PURE__ */ i("div", {
9
+ ref: f,
10
+ role: "separator",
11
+ "aria-orientation": t,
12
+ className: n(e.root, e[t], e[o], p && e.withLabel, p && e[`label_${c}`], l?.root, u),
13
+ ...d,
14
+ children: p ? /* @__PURE__ */ a(r, { children: [
15
+ /* @__PURE__ */ i("span", { className: n(e.line, l?.line) }),
16
+ /* @__PURE__ */ i("span", {
17
+ className: n(e.label, l?.label),
18
+ children: s
19
+ }),
20
+ /* @__PURE__ */ i("span", { className: n(e.line, l?.line) })
21
+ ] }) : null
22
+ });
23
+ });
24
+ o.displayName = "Divider";
25
+ export { o as Divider };
@@ -0,0 +1,17 @@
1
+ // src/components/Divider/Divider.module.scss
2
+ var e = "crk-root-NGCl-", t = "crk-horizontal-X75Kv", n = "crk-vertical-RMtD4", r = "crk-solid-TBm4T", i = "crk-dashed-SegXI", a = "crk-dotted--Swoe", o = "crk-withLabel-Eu-NF", s = "crk-line-27unV", c = "crk-label-cjRGC", l = "crk-label_start-KQBPQ", u = "crk-label_start-KQBPQ", d = "crk-label_end-i4XW3", f = "crk-label_end-i4XW3", p = {
3
+ root: e,
4
+ horizontal: t,
5
+ vertical: n,
6
+ solid: r,
7
+ dashed: i,
8
+ dotted: a,
9
+ withLabel: o,
10
+ line: s,
11
+ label: c,
12
+ label_start: l,
13
+ labelStart: u,
14
+ label_end: d,
15
+ labelEnd: f
16
+ };
17
+ export { i as dashed, p as default, a as dotted, t as horizontal, c as label, f as labelEnd, u as labelStart, d as label_end, l as label_start, s as line, e as root, r as solid, n as vertical, o as withLabel };
@@ -42,7 +42,7 @@ export interface DraggableHandleProps extends ComponentPropsWithoutRef<'div'> {
42
42
  * Grab area for a `<Draggable>`. Place it inside the container; only this element
43
43
  * initiates dragging, and it's keyboard-movable (arrow keys) when focused.
44
44
  */
45
- declare function DraggableHandle({ children, className, style, ...rest }: DraggableHandleProps): import("react/jsx-runtime").JSX.Element;
45
+ declare function DraggableHandle({ children, className, style, ...rest }: DraggableHandleProps): import("react").JSX.Element;
46
46
  declare namespace DraggableHandle {
47
47
  var displayName: string;
48
48
  }