@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.
Files changed (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  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.scss.js +31 -60
  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 +45 -40
  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.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  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.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  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.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  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 +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  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.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  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.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  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.scss.js +19 -36
  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.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,49 +1,28 @@
1
- const e = "crk-backdrop-85I58", t = "crk-panel-RBr7A", c = "crk-header-WpV0d", r = "crk-breadcrumb-yrjqZ", o = "crk-input-1yX4p", i = "crk-headerSpinner-vWtoV", n = "crk-list-Z8b3Q", s = "crk-group-hKsgv", m = "crk-groupLabel-S-h3h", a = "crk-item-TULJl", p = "crk-itemActive-T5Hpv", k = "crk-itemDisabled-A-ped", l = "crk-itemIcon-Ruqhi", d = "crk-itemText-nEkyw", h = "crk-itemLabel-03iZM", b = "crk-itemDescription-ehmYh", u = "crk-itemChevron-234PX", g = "crk-itemShortcut-OHXBv", v = "crk-match--l5e2", S = "crk-message-TgWpQ", L = "crk-loading-fcSft", f = "crk-footer-bwQFJ", D = {
2
- backdrop: e,
3
- panel: t,
4
- header: c,
5
- breadcrumb: r,
6
- input: o,
7
- headerSpinner: i,
8
- list: n,
9
- group: s,
10
- groupLabel: m,
11
- item: a,
12
- itemActive: p,
13
- itemDisabled: k,
14
- itemIcon: l,
15
- itemText: d,
16
- itemLabel: h,
17
- itemDescription: b,
18
- itemChevron: u,
19
- itemShortcut: g,
20
- match: v,
21
- message: S,
22
- loading: L,
23
- footer: f
24
- };
25
- export {
26
- e as backdrop,
27
- r as breadcrumb,
28
- D as default,
29
- f as footer,
30
- s as group,
31
- m as groupLabel,
32
- c as header,
33
- i as headerSpinner,
34
- o as input,
35
- a as item,
36
- p as itemActive,
37
- u as itemChevron,
38
- b as itemDescription,
39
- k as itemDisabled,
40
- l as itemIcon,
41
- h as itemLabel,
42
- g as itemShortcut,
43
- d as itemText,
44
- n as list,
45
- L as loading,
46
- v as match,
47
- S as message,
48
- t as panel
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
49
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 { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
2
+ import l from "clsx";
3
+ import { Modal as u } from "../Modal/Modal.js";
4
+ import { Button as d } from "../Button/Button.js";
5
+ import { Input as f } from "../inputs/Input/Input.js";
6
+ import p from "./ConfirmDialog.module.scss.js";
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 = t(({ open: e, onConfirm: t, onCancel: r, 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] = c(!1), [I, L] = c(void 0), [R, z] = c(""), B = s(null), V = s(null), H = s(null), U = s(!0), W = a();
20
+ i(() => (U.current = !0, () => {
21
+ U.current = !1;
22
+ }), []), i(() => {
23
+ e || (F(!1), L(void 0), z(""));
24
+ }, [e]);
25
+ let G = E ?? (C ? "cancel" : "confirm");
26
+ i(() => {
27
+ e && (w ? H.current : G === "cancel" ? V.current : B.current)?.focus();
28
+ }, [
29
+ e,
30
+ G,
31
+ w
32
+ ]);
33
+ let K = w === void 0 || R === w, q = K && !P, J = n(async () => {
34
+ if (!q) return;
35
+ L(void 0);
36
+ let e;
37
+ try {
38
+ e = t();
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, t]), Y = n(() => {
54
+ P || r();
55
+ }, [P, r]), X = T === !1 ? null : T === void 0 ? C ? g : null : T, Z = o(() => ({
56
+ modal: A?.modal,
57
+ header: A?.header,
58
+ body: A?.body,
59
+ footer: A?.footer
60
+ }), [A]);
61
+ return /* @__PURE__ */ h(u, {
62
+ ref: N,
63
+ open: e,
64
+ onClose: Y,
65
+ size: "sm",
66
+ closeOnBackdrop: D && !P,
67
+ closeOnEscape: !P,
68
+ classes: Z,
69
+ className: l(p.root, C && p.danger, j),
70
+ style: M,
71
+ "aria-label": typeof v == "string" ? v : v ? void 0 : k,
72
+ children: [
73
+ v ? /* @__PURE__ */ m(u.Header, {
74
+ onClose: P ? void 0 : Y,
75
+ children: /* @__PURE__ */ h("span", {
76
+ className: p.titleRow,
77
+ children: [X && /* @__PURE__ */ m("span", {
78
+ className: l(p.icon, A?.icon),
79
+ "aria-hidden": "true",
80
+ children: X
81
+ }), /* @__PURE__ */ m("span", {
82
+ className: p.title,
83
+ children: v
84
+ })]
85
+ })
86
+ }) : null,
87
+ /* @__PURE__ */ h(u.Body, { children: [
88
+ y && /* @__PURE__ */ m("div", {
89
+ className: l(p.description, A?.description),
90
+ children: y
91
+ }),
92
+ b,
93
+ w !== void 0 && /* @__PURE__ */ h("div", {
94
+ className: l(p.input, A?.input),
95
+ children: [/* @__PURE__ */ h("label", {
96
+ htmlFor: W,
97
+ className: p.inputLabel,
98
+ children: [
99
+ "Type ",
100
+ /* @__PURE__ */ m("b", { children: w }),
101
+ " to confirm"
102
+ ]
103
+ }), /* @__PURE__ */ m(f, {
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: l(p.error, A?.error),
120
+ children: O(I)
121
+ })
122
+ ] }),
123
+ /* @__PURE__ */ h(u.Footer, { children: [/* @__PURE__ */ m(d, {
124
+ ref: V,
125
+ variant: "ghost",
126
+ onClick: Y,
127
+ disabled: P,
128
+ className: l(p.cancel, A?.cancel),
129
+ children: S
130
+ }), /* @__PURE__ */ m(d, {
131
+ ref: B,
132
+ variant: C ? "danger" : "primary",
133
+ onClick: () => void J(),
134
+ loading: P,
135
+ disabled: !K,
136
+ className: l(p.confirm, A?.confirm),
137
+ children: x
138
+ })] })
139
+ ]
140
+ });
141
+ });
142
+ v.displayName = "ConfirmDialog";
143
+ var y = e(null), b = 0;
144
+ function x({ children: e, defaults: t }) {
145
+ let [r, i] = c(null), a = s(null);
146
+ a.current = r;
147
+ let o = n((e = {}) => new Promise((n) => {
148
+ a.current?.resolve(!1);
149
+ let r = {
150
+ id: ++b,
151
+ options: {
152
+ ...t,
153
+ ...e
154
+ },
155
+ resolve: n
156
+ };
157
+ a.current = r, i(r);
158
+ }), [t]), l = n((e, t) => {
159
+ a.current === e && (a.current = null, i(null), e.resolve(t));
160
+ }, []), u = n(async () => {
161
+ let e = a.current;
162
+ if (!e) return;
163
+ let t = e.options.onConfirm?.();
164
+ t && typeof t.then == "function" && await t, l(e, !0);
165
+ }, [l]), d = n(() => {
166
+ let e = a.current;
167
+ e && l(e, !1);
168
+ }, [l]), { body: f, onConfirm: p, ...g } = r?.options ?? {};
169
+ return /* @__PURE__ */ h(y.Provider, {
170
+ value: o,
171
+ children: [e, /* @__PURE__ */ m(v, {
172
+ ...g,
173
+ open: r !== null,
174
+ onConfirm: u,
175
+ onCancel: d,
176
+ children: f
177
+ }, r?.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 = r(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 };
@@ -1,21 +1,12 @@
1
- const t = "crk-titleRow-45dc7", c = "crk-title-Y07Q8", n = "crk-icon-8MwQK", r = "crk-danger-yQ2Yd", o = "crk-description-KCKQ-", e = "crk-input--R-KC", i = "crk-inputLabel-mD7a2", s = "crk-error-f81j6", l = {
2
- titleRow: t,
3
- title: c,
4
- icon: n,
5
- danger: r,
6
- description: o,
7
- input: e,
8
- inputLabel: i,
9
- error: s
10
- };
11
- export {
12
- r as danger,
13
- l as default,
14
- o as description,
15
- s as error,
16
- n as icon,
17
- e as input,
18
- i as inputLabel,
19
- c as title,
20
- t as titleRow
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
21
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 { forwardRef as e } from "react";
2
+ import t from "clsx";
3
+ import n from "./Divider.module.scss.js";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ // src/components/Divider/Divider.tsx
6
+ var o = e(({ orientation: e = "horizontal", variant: o = "solid", label: s, labelPosition: c = "center", classes: l, className: u, ...d }, f) => {
7
+ let p = s != null && e === "horizontal";
8
+ return /* @__PURE__ */ i("div", {
9
+ ref: f,
10
+ role: "separator",
11
+ "aria-orientation": e,
12
+ className: t(n.root, n[e], n[o], p && n.withLabel, p && n[`label_${c}`], l?.root, u),
13
+ ...d,
14
+ children: p ? /* @__PURE__ */ a(r, { children: [
15
+ /* @__PURE__ */ i("span", { className: t(n.line, l?.line) }),
16
+ /* @__PURE__ */ i("span", {
17
+ className: t(n.label, l?.label),
18
+ children: s
19
+ }),
20
+ /* @__PURE__ */ i("span", { className: t(n.line, l?.line) })
21
+ ] }) : null
22
+ });
23
+ });
24
+ o.displayName = "Divider";
25
+ export { o as Divider };
@@ -1,31 +1,17 @@
1
- const l = "crk-root-NGCl-", t = "crk-horizontal-X75Kv", e = "crk-vertical-RMtD4", a = "crk-solid-TBm4T", o = "crk-dashed-SegXI", c = "crk-dotted--Swoe", r = "crk-withLabel-Eu-NF", n = "crk-line-27unV", s = "crk-label-cjRGC", d = "crk-label_start-KQBPQ", b = "crk-label_start-KQBPQ", i = "crk-label_end-i4XW3", k = "crk-label_end-i4XW3", h = {
2
- root: l,
3
- horizontal: t,
4
- vertical: e,
5
- solid: a,
6
- dashed: o,
7
- dotted: c,
8
- withLabel: r,
9
- line: n,
10
- label: s,
11
- label_start: d,
12
- labelStart: b,
13
- label_end: i,
14
- labelEnd: k
15
- };
16
- export {
17
- o as dashed,
18
- h as default,
19
- c as dotted,
20
- t as horizontal,
21
- s as label,
22
- k as labelEnd,
23
- b as labelStart,
24
- i as label_end,
25
- d as label_start,
26
- n as line,
27
- l as root,
28
- a as solid,
29
- e as vertical,
30
- r as withLabel
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
31
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
  }