@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,109 +1,98 @@
1
- import { jsx as n, jsxs as f } from "react/jsx-runtime";
2
- import { forwardRef as K, useRef as Q, useCallback as U, useState as E } from "react";
3
- import r from "clsx";
4
- import t from "./Input.module.scss.js";
5
- const X = /* @__PURE__ */ f("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", children: [
6
- /* @__PURE__ */ n("path", { d: "M1.5 10S4.5 4.5 10 4.5 18.5 10 18.5 10 15.5 15.5 10 15.5 1.5 10 1.5 10z", strokeLinejoin: "round" }),
7
- /* @__PURE__ */ n("circle", { cx: "10", cy: "10", r: "2.5" })
8
- ] }), Y = /* @__PURE__ */ f("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", children: [
9
- /* @__PURE__ */ n("path", { d: "M3 3l14 14", strokeLinecap: "round" }),
10
- /* @__PURE__ */ n("path", { d: "M8.2 5.1A8.6 8.6 0 0110 4.9c5.5 0 8.5 5.1 8.5 5.1a14.4 14.4 0 01-2.6 3.1M11.9 11.9a2.5 2.5 0 01-3.6-3.5M5.1 6.3C2.8 7.9 1.5 10 1.5 10S4.5 15.1 10 15.1c1.2 0 2.3-.2 3.3-.6", strokeLinecap: "round", strokeLinejoin: "round" })
11
- ] }), Z = /* @__PURE__ */ n("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.3 7.3a1 1 0 011.4 0L10 8.6l1.3-1.3a1 1 0 111.4 1.4L11.4 10l1.3 1.3a1 1 0 01-1.4 1.4L10 11.4l-1.3 1.3a1 1 0 01-1.4-1.4L8.6 10 7.3 8.7a1 1 0 010-1.4z" }) }), _ = K(
12
- ({
13
- inputSize: v = "md",
14
- error: w = !1,
15
- prefix: l,
16
- suffix: i,
17
- revealable: N = !1,
18
- revealed: m,
19
- onRevealedChange: S,
20
- revealLabels: j,
21
- clearable: c = !1,
22
- clearLabel: D = "Clear",
23
- onClear: O,
24
- classes: o,
25
- className: g,
26
- style: b,
27
- type: k,
28
- onChange: x,
29
- ...y
30
- }, a) => {
31
- const I = Q(null), V = U(
32
- (e) => {
33
- I.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
34
- },
35
- [a]
36
- ), d = N && k === "password", [H, W] = E(!1), s = m ?? H, z = () => {
37
- const e = !s;
38
- m === void 0 && W(e), S?.(e);
39
- }, P = d && s ? "text" : k, C = j ?? { show: "Show password", hide: "Hide password" }, { value: u, defaultValue: p, disabled: M, readOnly: T } = y, [A, L] = E(
40
- () => p != null && String(p).length > 0
41
- ), F = u != null ? String(u).length > 0 : A, q = c && F && !M && !T, G = c ? (e) => {
42
- L(e.target.value.length > 0), x?.(e);
43
- } : x, J = () => {
44
- const e = I.current;
45
- if (!e) return;
46
- Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), L(!1), O?.(), e.focus();
47
- }, R = (e) => e.preventDefault(), h = !!(l || i || d || c), B = /* @__PURE__ */ n(
48
- "input",
49
- {
50
- ref: V,
51
- type: P,
52
- className: r(
53
- t.root,
54
- t[v],
55
- w && t.error,
56
- (l || void 0) && t.hasPrefix,
57
- (i || d || c) && t.hasSuffix,
58
- o?.root,
59
- !h && g
60
- ),
61
- style: h ? void 0 : b,
62
- onChange: G,
63
- ...y
64
- }
65
- );
66
- return h ? /* @__PURE__ */ f(
67
- "div",
68
- {
69
- className: r(t.wrapper, t[v], w && t.error, o?.wrapper, g),
70
- style: b,
71
- children: [
72
- l && /* @__PURE__ */ n("span", { className: r(t.prefix, o?.prefix), children: l }),
73
- B,
74
- i && /* @__PURE__ */ n("span", { className: r(t.suffix, o?.suffix), children: i }),
75
- q && /* @__PURE__ */ n(
76
- "button",
77
- {
78
- type: "button",
79
- className: r(t.sideButton, t.clear, o?.clear),
80
- "aria-label": D,
81
- onMouseDown: R,
82
- onClick: J,
83
- tabIndex: -1,
84
- children: Z
85
- }
86
- ),
87
- d && /* @__PURE__ */ n(
88
- "button",
89
- {
90
- type: "button",
91
- className: r(t.sideButton, t.reveal, o?.reveal),
92
- "aria-label": s ? C.hide : C.show,
93
- "aria-pressed": s,
94
- onMouseDown: R,
95
- onClick: z,
96
- disabled: M,
97
- tabIndex: 0,
98
- children: s ? Y : X
99
- }
100
- )
101
- ]
102
- }
103
- ) : B;
104
- }
105
- );
106
- _.displayName = "Input";
107
- export {
108
- _ as Input
109
- };
1
+ import e from "./Input.module.js";
2
+ import { forwardRef as t, useCallback 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/inputs/Input/Input.tsx
6
+ var c = /* @__PURE__ */ s("svg", {
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeWidth: "1.6",
11
+ "aria-hidden": "true",
12
+ children: [/* @__PURE__ */ o("path", {
13
+ d: "M1.5 10S4.5 4.5 10 4.5 18.5 10 18.5 10 15.5 15.5 10 15.5 1.5 10 1.5 10z",
14
+ strokeLinejoin: "round"
15
+ }), /* @__PURE__ */ o("circle", {
16
+ cx: "10",
17
+ cy: "10",
18
+ r: "2.5"
19
+ })]
20
+ }), l = /* @__PURE__ */ s("svg", {
21
+ viewBox: "0 0 20 20",
22
+ fill: "none",
23
+ stroke: "currentColor",
24
+ strokeWidth: "1.6",
25
+ "aria-hidden": "true",
26
+ children: [/* @__PURE__ */ o("path", {
27
+ d: "M3 3l14 14",
28
+ strokeLinecap: "round"
29
+ }), /* @__PURE__ */ o("path", {
30
+ d: "M8.2 5.1A8.6 8.6 0 0110 4.9c5.5 0 8.5 5.1 8.5 5.1a14.4 14.4 0 01-2.6 3.1M11.9 11.9a2.5 2.5 0 01-3.6-3.5M5.1 6.3C2.8 7.9 1.5 10 1.5 10S4.5 15.1 10 15.1c1.2 0 2.3-.2 3.3-.6",
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round"
33
+ })]
34
+ }), u = /* @__PURE__ */ o("svg", {
35
+ viewBox: "0 0 20 20",
36
+ fill: "currentColor",
37
+ "aria-hidden": "true",
38
+ children: /* @__PURE__ */ o("path", { d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.3 7.3a1 1 0 011.4 0L10 8.6l1.3-1.3a1 1 0 111.4 1.4L11.4 10l1.3 1.3a1 1 0 01-1.4 1.4L10 11.4l-1.3 1.3a1 1 0 01-1.4-1.4L8.6 10 7.3 8.7a1 1 0 010-1.4z" })
39
+ }), d = t(({ inputSize: t = "md", error: d = !1, prefix: f, suffix: p, revealable: m = !1, revealed: h, onRevealedChange: g, revealLabels: _, clearable: v = !1, clearLabel: y = "Clear", onClear: b, classes: x, className: S, style: C, type: w, onChange: T, ...E }, D) => {
40
+ let O = r(null), k = n((e) => {
41
+ O.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
42
+ }, [D]), A = m && w === "password", [j, M] = i(!1), N = h ?? j, P = () => {
43
+ let e = !N;
44
+ h === void 0 && M(e), g?.(e);
45
+ }, F = A && N ? "text" : w, I = _ ?? {
46
+ show: "Show password",
47
+ hide: "Hide password"
48
+ }, { value: L, defaultValue: R, disabled: z, readOnly: B } = E, [V, H] = i(() => R != null && String(R).length > 0), U = L == null ? V : String(L).length > 0, W = v && U && !z && !B, G = v ? (e) => {
49
+ H(e.target.value.length > 0), T?.(e);
50
+ } : T, K = () => {
51
+ let e = O.current;
52
+ e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), H(!1), b?.(), e.focus());
53
+ }, q = (e) => e.preventDefault(), J = !!(f || p || A || v), Y = /* @__PURE__ */ o("input", {
54
+ ref: k,
55
+ type: F,
56
+ className: a(e.root, e[t], d && e.error, (f || void 0) && e.hasPrefix, (p || A || v) && e.hasSuffix, x?.root, !J && S),
57
+ style: J ? void 0 : C,
58
+ onChange: G,
59
+ ...E
60
+ });
61
+ return J ? /* @__PURE__ */ s("div", {
62
+ className: a(e.wrapper, e[t], d && e.error, x?.wrapper, S),
63
+ style: C,
64
+ children: [
65
+ f && /* @__PURE__ */ o("span", {
66
+ className: a(e.prefix, x?.prefix),
67
+ children: f
68
+ }),
69
+ Y,
70
+ p && /* @__PURE__ */ o("span", {
71
+ className: a(e.suffix, x?.suffix),
72
+ children: p
73
+ }),
74
+ W && /* @__PURE__ */ o("button", {
75
+ type: "button",
76
+ className: a(e.sideButton, e.clear, x?.clear),
77
+ "aria-label": y,
78
+ onMouseDown: q,
79
+ onClick: K,
80
+ tabIndex: -1,
81
+ children: u
82
+ }),
83
+ A && /* @__PURE__ */ o("button", {
84
+ type: "button",
85
+ className: a(e.sideButton, e.reveal, x?.reveal),
86
+ "aria-label": N ? I.hide : I.show,
87
+ "aria-pressed": N,
88
+ onMouseDown: q,
89
+ onClick: P,
90
+ disabled: z,
91
+ tabIndex: 0,
92
+ children: N ? l : c
93
+ })
94
+ ]
95
+ }) : Y;
96
+ });
97
+ d.displayName = "Input";
98
+ export { d as Input };
@@ -0,0 +1,15 @@
1
+ // src/components/inputs/Input/Input.module.scss
2
+ var e = "crk-root-rSgdy", t = "crk-wrapper-GHy8V", n = "crk-sm-DptM5", r = "crk-md-F4B0G", i = "crk-lg-pBxwX", a = "crk-error-fucxe", o = "crk-prefix-w53Md", s = "crk-suffix-fcNgR", c = "crk-hasPrefix--bqPD", l = "crk-hasSuffix-zO0nX", u = "crk-sideButton-H3GC-", d = {
3
+ root: e,
4
+ wrapper: t,
5
+ sm: n,
6
+ md: r,
7
+ lg: i,
8
+ error: a,
9
+ prefix: o,
10
+ suffix: s,
11
+ hasPrefix: c,
12
+ hasSuffix: l,
13
+ sideButton: u
14
+ };
15
+ export { d as default, a as error, c as hasPrefix, l as hasSuffix, i as lg, r as md, o as prefix, e as root, u as sideButton, n as sm, s as suffix, t as wrapper };
@@ -1,132 +1,112 @@
1
- import { jsxs as B, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as q, useState as z, useRef as L, useEffect as G, useCallback as S } from "react";
3
- import m from "clsx";
4
- import l from "./NumberInput.module.scss.js";
5
- const x = (n) => {
6
- if (n.trim() === "") return null;
7
- const h = Number(n);
8
- return Number.isNaN(h) ? null : h;
9
- }, H = q(
10
- ({
11
- value: n,
12
- defaultValue: h,
13
- onChange: v,
14
- min: u,
15
- max: a,
16
- step: D = 1,
17
- precision: N,
18
- inputSize: R = "md",
19
- error: C = !1,
20
- hideControls: A = !1,
21
- disabled: i,
22
- readOnly: f,
23
- classes: d,
24
- className: F,
25
- style: K,
26
- onKeyDown: W,
27
- onBlur: E,
28
- ...I
29
- }, P) => {
30
- const c = n !== void 0, j = (c ? n : h) ?? null, [g, p] = z(j != null ? String(j) : ""), w = L(!1), b = L(!1), r = c ? n ?? null : x(g);
31
- G(() => {
32
- c && (!w.current || b.current) && p(n != null ? String(n) : ""), b.current = !1;
33
- }, [c, n]);
34
- const M = S(
35
- (t) => {
36
- let e = t;
37
- if (u != null && (e = Math.max(u, e)), a != null && (e = Math.min(a, e)), N != null) {
38
- const o = 10 ** N;
39
- e = Math.round(e * o) / o;
40
- }
41
- return e;
42
- },
43
- [u, a, N]
44
- ), y = S(
45
- (t) => {
46
- c ? b.current = !0 : p(t != null ? String(t) : ""), v?.(t);
47
- },
48
- [c, v]
49
- ), k = S(
50
- (t) => {
51
- if (i || f) return;
52
- y(M((r ?? u ?? 0) + t * D));
53
- },
54
- [i, f, r, u, D, M, y]
55
- ), T = a != null && r != null && r >= a, U = u != null && r != null && r <= u, V = (t) => {
56
- W?.(t), !t.defaultPrevented && (t.key === "ArrowUp" ? (t.preventDefault(), k(1)) : t.key === "ArrowDown" && (t.preventDefault(), k(-1)));
57
- };
58
- return /* @__PURE__ */ B(
59
- "div",
60
- {
61
- className: m(
62
- l.root,
63
- l[R],
64
- C && l.error,
65
- i && l.disabled,
66
- d?.root,
67
- F
68
- ),
69
- style: K,
70
- "data-disabled": i || void 0,
71
- children: [
72
- /* @__PURE__ */ s(
73
- "input",
74
- {
75
- ref: P,
76
- type: "text",
77
- inputMode: "decimal",
78
- className: m(l.input, d?.input),
79
- value: g,
80
- disabled: i,
81
- readOnly: f,
82
- "aria-invalid": C || void 0,
83
- onChange: (t) => {
84
- b.current = !1, p(t.target.value), v?.(x(t.target.value));
85
- },
86
- onKeyDown: V,
87
- onFocus: (t) => {
88
- w.current = !0, I.onFocus?.(t);
89
- },
90
- onBlur: (t) => {
91
- w.current = !1;
92
- const e = x(g), o = e != null ? M(e) : null;
93
- o !== e && y(o), c ? p(r != null ? String(r) : "") : o != null && o === e && p(String(o)), E?.(t);
94
- },
95
- ...I
96
- }
97
- ),
98
- !A && /* @__PURE__ */ B("div", { className: m(l.controls, d?.controls), children: [
99
- /* @__PURE__ */ s(
100
- "button",
101
- {
102
- type: "button",
103
- tabIndex: -1,
104
- className: m(l.increment, d?.increment),
105
- onClick: () => k(1),
106
- disabled: i || f || T,
107
- "aria-label": "Increment",
108
- children: /* @__PURE__ */ s("svg", { viewBox: "0 0 10 6", "aria-hidden": "true", children: /* @__PURE__ */ s("path", { d: "M1 5l4-4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
109
- }
110
- ),
111
- /* @__PURE__ */ s(
112
- "button",
113
- {
114
- type: "button",
115
- tabIndex: -1,
116
- className: m(l.decrement, d?.decrement),
117
- onClick: () => k(-1),
118
- disabled: i || f || U,
119
- "aria-label": "Decrement",
120
- children: /* @__PURE__ */ s("svg", { viewBox: "0 0 10 6", "aria-hidden": "true", children: /* @__PURE__ */ s("path", { d: "M1 1l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
121
- }
122
- )
123
- ] })
124
- ]
125
- }
126
- );
127
- }
128
- );
129
- H.displayName = "NumberInput";
130
- export {
131
- H as NumberInput
132
- };
1
+ import e from "./NumberInput.module.js";
2
+ import { forwardRef as t, useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
3
+ import o from "clsx";
4
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ // src/components/inputs/NumberInput/NumberInput.tsx
6
+ var l = (e) => {
7
+ if (e.trim() === "") return null;
8
+ let t = Number(e);
9
+ return Number.isNaN(t) ? null : t;
10
+ }, u = t(({ value: t, defaultValue: u, onChange: d, min: f, max: p, step: m = 1, precision: h, inputSize: g = "md", error: _ = !1, hideControls: v = !1, disabled: y, readOnly: b, classes: x, className: S, style: C, onKeyDown: w, onBlur: T, ...E }, D) => {
11
+ let O = t !== void 0, k = (O ? t : u) ?? null, [A, j] = a(k == null ? "" : String(k)), M = i(!1), N = i(!1), P = O ? t ?? null : l(A);
12
+ r(() => {
13
+ O && (!M.current || N.current) && j(t == null ? "" : String(t)), N.current = !1;
14
+ }, [O, t]);
15
+ let F = n((e) => {
16
+ let t = e;
17
+ if (f != null && (t = Math.max(f, t)), p != null && (t = Math.min(p, t)), h != null) {
18
+ let e = 10 ** h;
19
+ t = Math.round(t * e) / e;
20
+ }
21
+ return t;
22
+ }, [
23
+ f,
24
+ p,
25
+ h
26
+ ]), I = n((e) => {
27
+ O ? N.current = !0 : j(e == null ? "" : String(e)), d?.(e);
28
+ }, [O, d]), L = n((e) => {
29
+ y || b || I(F((P ?? f ?? 0) + e * m));
30
+ }, [
31
+ y,
32
+ b,
33
+ P,
34
+ f,
35
+ m,
36
+ F,
37
+ I
38
+ ]), R = p != null && P != null && P >= p, z = f != null && P != null && P <= f;
39
+ return /* @__PURE__ */ c("div", {
40
+ className: o(e.root, e[g], _ && e.error, y && e.disabled, x?.root, S),
41
+ style: C,
42
+ "data-disabled": y || void 0,
43
+ children: [/* @__PURE__ */ s("input", {
44
+ ref: D,
45
+ type: "text",
46
+ inputMode: "decimal",
47
+ className: o(e.input, x?.input),
48
+ value: A,
49
+ disabled: y,
50
+ readOnly: b,
51
+ "aria-invalid": _ || void 0,
52
+ onChange: (e) => {
53
+ N.current = !1, j(e.target.value), d?.(l(e.target.value));
54
+ },
55
+ onKeyDown: (e) => {
56
+ w?.(e), e.defaultPrevented || (e.key === "ArrowUp" ? (e.preventDefault(), L(1)) : e.key === "ArrowDown" && (e.preventDefault(), L(-1)));
57
+ },
58
+ onFocus: (e) => {
59
+ M.current = !0, E.onFocus?.(e);
60
+ },
61
+ onBlur: (e) => {
62
+ M.current = !1;
63
+ let t = l(A), n = t == null ? null : F(t);
64
+ n !== t && I(n), O ? j(P == null ? "" : String(P)) : n != null && n === t && j(String(n)), T?.(e);
65
+ },
66
+ ...E
67
+ }), !v && /* @__PURE__ */ c("div", {
68
+ className: o(e.controls, x?.controls),
69
+ children: [/* @__PURE__ */ s("button", {
70
+ type: "button",
71
+ tabIndex: -1,
72
+ className: o(e.increment, x?.increment),
73
+ onClick: () => L(1),
74
+ disabled: y || b || R,
75
+ "aria-label": "Increment",
76
+ children: /* @__PURE__ */ s("svg", {
77
+ viewBox: "0 0 10 6",
78
+ "aria-hidden": "true",
79
+ children: /* @__PURE__ */ s("path", {
80
+ d: "M1 5l4-4 4 4",
81
+ fill: "none",
82
+ stroke: "currentColor",
83
+ strokeWidth: "1.5",
84
+ strokeLinecap: "round",
85
+ strokeLinejoin: "round"
86
+ })
87
+ })
88
+ }), /* @__PURE__ */ s("button", {
89
+ type: "button",
90
+ tabIndex: -1,
91
+ className: o(e.decrement, x?.decrement),
92
+ onClick: () => L(-1),
93
+ disabled: y || b || z,
94
+ "aria-label": "Decrement",
95
+ children: /* @__PURE__ */ s("svg", {
96
+ viewBox: "0 0 10 6",
97
+ "aria-hidden": "true",
98
+ children: /* @__PURE__ */ s("path", {
99
+ d: "M1 1l4 4 4-4",
100
+ fill: "none",
101
+ stroke: "currentColor",
102
+ strokeWidth: "1.5",
103
+ strokeLinecap: "round",
104
+ strokeLinejoin: "round"
105
+ })
106
+ })
107
+ })]
108
+ })]
109
+ });
110
+ });
111
+ u.displayName = "NumberInput";
112
+ export { u as NumberInput };
@@ -0,0 +1,14 @@
1
+ // src/components/inputs/NumberInput/NumberInput.module.scss
2
+ var e = "crk-root-aUI4c", t = "crk-sm-t2zR2", n = "crk-input-82UG6", r = "crk-md-v4bFw", i = "crk-lg-mr8pf", a = "crk-controls-0vTT8", o = "crk-increment-nc4uY", s = "crk-decrement-076EO", c = "crk-error-1BkEa", l = "crk-disabled-mk7uC", u = {
3
+ root: e,
4
+ sm: t,
5
+ input: n,
6
+ md: r,
7
+ lg: i,
8
+ controls: a,
9
+ increment: o,
10
+ decrement: s,
11
+ error: c,
12
+ disabled: l
13
+ };
14
+ export { a as controls, s as decrement, u as default, l as disabled, c as error, o as increment, n as input, i as lg, r as md, e as root, t as sm };
@@ -1,73 +1,50 @@
1
- import { jsxs as y, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as h, useContext as R, createContext as G } from "react";
3
- import n from "clsx";
4
- import a from "./Radio.module.scss.js";
5
- const f = G(null), j = h(
6
- ({
7
- name: l,
8
- value: r,
9
- onChange: o,
10
- className: i,
11
- style: d,
12
- children: s,
13
- id: c,
14
- "aria-label": p,
15
- "aria-labelledby": m,
16
- required: u,
17
- error: b = !1
18
- }, e) => /* @__PURE__ */ t(f.Provider, { value: { name: l, value: r, onChange: o, error: b }, children: /* @__PURE__ */ t(
19
- "div",
20
- {
21
- ref: e,
22
- id: c,
23
- className: n(a.group, i),
24
- style: d,
25
- role: "radiogroup",
26
- tabIndex: -1,
27
- "aria-label": p,
28
- "aria-labelledby": m,
29
- "aria-required": u || void 0,
30
- children: s
31
- }
32
- ) })
33
- );
34
- j.displayName = "RadioGroup";
35
- const k = h(
36
- ({
37
- label: l,
38
- value: r,
39
- classes: o,
40
- className: i,
41
- style: d,
42
- onChange: s,
43
- checked: c,
44
- name: p,
45
- error: m = !1,
46
- ...u
47
- }, b) => {
48
- const e = R(f), x = e?.name ?? p, C = e ? e.value === r : c, N = m || !!e?.error, g = (v) => {
49
- e?.onChange?.(r), s?.(v);
50
- };
51
- return /* @__PURE__ */ y("label", { className: n(a.root, o?.root, i), style: d, children: [
52
- /* @__PURE__ */ t(
53
- "input",
54
- {
55
- ref: b,
56
- type: "radio",
57
- className: n(a.input, N && a.error, o?.input),
58
- name: x,
59
- value: r,
60
- checked: C,
61
- onChange: g,
62
- ...u
63
- }
64
- ),
65
- l && /* @__PURE__ */ t("span", { className: n(a.label, o?.label), children: l })
66
- ] });
67
- }
68
- );
69
- k.displayName = "Radio";
70
- export {
71
- k as Radio,
72
- j as RadioGroup
73
- };
1
+ import e from "./Radio.module.js";
2
+ import { createContext as t, forwardRef as n, useContext as r } from "react";
3
+ import i from "clsx";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ // src/components/inputs/Radio/Radio.tsx
6
+ var s = t(null), c = n(({ name: t, value: n, onChange: r, className: o, style: c, children: l, id: u, "aria-label": d, "aria-labelledby": f, required: p, error: m = !1 }, h) => /* @__PURE__ */ a(s.Provider, {
7
+ value: {
8
+ name: t,
9
+ value: n,
10
+ onChange: r,
11
+ error: m
12
+ },
13
+ children: /* @__PURE__ */ a("div", {
14
+ ref: h,
15
+ id: u,
16
+ className: i(e.group, o),
17
+ style: c,
18
+ role: "radiogroup",
19
+ tabIndex: -1,
20
+ "aria-label": d,
21
+ "aria-labelledby": f,
22
+ "aria-required": p || void 0,
23
+ children: l
24
+ })
25
+ }));
26
+ c.displayName = "RadioGroup";
27
+ var l = n(({ label: t, value: n, classes: c, className: l, style: u, onChange: d, checked: f, name: p, error: m = !1, ...h }, g) => {
28
+ let _ = r(s), v = _?.name ?? p, y = _ ? _.value === n : f, b = m || !!_?.error;
29
+ return /* @__PURE__ */ o("label", {
30
+ className: i(e.root, c?.root, l),
31
+ style: u,
32
+ children: [/* @__PURE__ */ a("input", {
33
+ ref: g,
34
+ type: "radio",
35
+ className: i(e.input, b && e.error, c?.input),
36
+ name: v,
37
+ value: n,
38
+ checked: y,
39
+ onChange: (e) => {
40
+ _?.onChange?.(n), d?.(e);
41
+ },
42
+ ...h
43
+ }), t && /* @__PURE__ */ a("span", {
44
+ className: i(e.label, c?.label),
45
+ children: t
46
+ })]
47
+ });
48
+ });
49
+ l.displayName = "Radio";
50
+ export { l as Radio, c as RadioGroup };
@@ -0,0 +1,9 @@
1
+ // src/components/inputs/Radio/Radio.module.scss
2
+ var e = "crk-group-NNwCD", t = "crk-root-7fGik", n = "crk-input-43PQW", r = "crk-error-Xb8Jc", i = "crk-label-aW30x", a = {
3
+ group: e,
4
+ root: t,
5
+ input: n,
6
+ error: r,
7
+ label: i
8
+ };
9
+ export { a as default, r as error, e as group, n as input, i as label, t as root };