@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,38 @@
1
+ // src/components/inputs/Select/Select.module.scss
2
+ var e = "crk-wrapper-SP2JE", t = "crk-sm-DqshL", n = "crk-md-j4AKI", r = "crk-lg-24Xd3", i = "crk-root-Uu9Ah", a = "crk-error-9oRU6", o = "crk-arrow-WU8ZW", s = "crk-searchableWrapper-7AL4l", c = "crk-hiddenSelect-s3DEx", l = "crk-searchableTrigger-m-GWV", u = "crk-triggerOpen-Lo8-j", d = "crk-triggerLabel-5rETZ", f = "crk-placeholder-teBBh", p = "crk-arrowInline-m-roG", m = "crk-disabled-pcSeq", h = "crk-visuallyHidden-2tTD5", g = "crk-menu--i-je", _ = "crk-menuEnter-vJjLV", v = "crk-menuItems-VrZnE", y = "crk-item-fU3XI", b = "crk-itemHighlighted-MvR41", x = "crk-itemDisabled-KTUO8", S = "crk-itemSelected-42-BG", C = "crk-noResults-uicSW", w = "crk-match-Aej-J", T = "crk-spinner-I1ffm", E = "crk-multiTrigger-Pd3wJ", D = "crk-multiTriggerDisabled-9ajge", O = "crk-chip-TuYUB", k = "crk-chipLabel-H4JWu", A = "crk-chipRemove-Lfk0R", j = "crk-multiSearch-OrVeS", M = "crk-arrowMulti-Nh9Hr", N = "crk-itemCheck-DPB5A", P = {
3
+ wrapper: e,
4
+ sm: t,
5
+ md: n,
6
+ lg: r,
7
+ root: i,
8
+ error: a,
9
+ arrow: o,
10
+ searchableWrapper: s,
11
+ hiddenSelect: c,
12
+ searchableTrigger: l,
13
+ triggerOpen: u,
14
+ triggerLabel: d,
15
+ placeholder: f,
16
+ arrowInline: p,
17
+ disabled: m,
18
+ visuallyHidden: h,
19
+ menu: g,
20
+ menuEnter: _,
21
+ menuItems: v,
22
+ item: y,
23
+ itemHighlighted: b,
24
+ itemDisabled: x,
25
+ itemSelected: S,
26
+ noResults: C,
27
+ match: w,
28
+ spinner: T,
29
+ multiTrigger: E,
30
+ multiTriggerDisabled: D,
31
+ chip: O,
32
+ chipLabel: k,
33
+ chipRemove: A,
34
+ multiSearch: j,
35
+ arrowMulti: M,
36
+ itemCheck: N
37
+ };
38
+ export { o as arrow, p as arrowInline, M as arrowMulti, O as chip, k as chipLabel, A as chipRemove, P as default, m as disabled, a as error, c as hiddenSelect, y as item, N as itemCheck, x as itemDisabled, b as itemHighlighted, S as itemSelected, r as lg, w as match, n as md, g as menu, _ as menuEnter, v as menuItems, j as multiSearch, E as multiTrigger, D as multiTriggerDisabled, C as noResults, f as placeholder, i as root, l as searchableTrigger, s as searchableWrapper, t as sm, T as spinner, d as triggerLabel, u as triggerOpen, h as visuallyHidden, e as wrapper };
@@ -1,128 +1,97 @@
1
- import { jsx as P, jsxs as Z } from "react/jsx-runtime";
2
- import { forwardRef as _, useState as $, useRef as j, useCallback as u, useEffect as V } from "react";
3
- import k from "clsx";
4
- import v from "./Slider.module.scss.js";
5
- const T = (f) => Array.isArray(f) ? f : null, tt = _(
6
- ({
7
- value: f,
8
- defaultValue: I,
9
- onChange: A,
10
- onChangeEnd: E,
11
- min: n = 0,
12
- max: a = 100,
13
- step: l = 1,
14
- disabled: s = !1,
15
- formatValue: L,
16
- classes: y,
17
- className: K,
18
- style: x,
19
- "aria-label": z,
20
- "aria-labelledby": B
21
- }, C) => {
22
- const m = f !== void 0, F = f ?? I ?? 0, [H, q] = $(F), c = m ? f : H, N = j(null), d = j(0), [R, b] = $(!1), S = u((t) => Math.min(a, Math.max(n, t)), [n, a]), U = u(
23
- (t) => S(Math.round((t - n) / l) * l + n),
24
- [S, n, l]
25
- ), h = u((t) => (t - n) / (a - n) * 100, [n, a]), D = u(
26
- (t, e = !1) => {
27
- m || q(t), A?.(t), e && E?.(t);
28
- },
29
- [m, A, E]
30
- ), w = u(
31
- (t, e, r = !1) => {
32
- const o = U(e), M = T(c);
33
- if (M) {
34
- const i = [M[0], M[1]];
35
- i[t] = o, t === 0 ? i[0] = Math.min(i[0], i[1]) : i[1] = Math.max(i[1], i[0]), D(i, r);
36
- } else
37
- D(o, r);
38
- },
39
- [c, U, D]
40
- ), g = u(
41
- (t) => {
42
- const e = N.current;
43
- if (!e) return n;
44
- const r = e.getBoundingClientRect(), o = r.width > 0 ? (t - r.left) / r.width : 0;
45
- return n + o * (a - n);
46
- },
47
- [n, a]
48
- ), G = u(
49
- (t) => {
50
- const e = T(c);
51
- return e ? Math.abs(t - e[0]) <= Math.abs(t - e[1]) ? 0 : 1 : 0;
52
- },
53
- [c]
54
- );
55
- V(() => {
56
- if (!R) return;
57
- const t = (r) => {
58
- w(d.current, g(r.clientX));
59
- }, e = (r) => {
60
- b(!1), w(d.current, g(r.clientX), !0);
61
- };
62
- return window.addEventListener("pointermove", t), window.addEventListener("pointerup", e), () => {
63
- window.removeEventListener("pointermove", t), window.removeEventListener("pointerup", e);
64
- };
65
- }, [R, w, g]);
66
- const J = (t) => {
67
- if (s) return;
68
- const e = g(t.clientX);
69
- d.current = G(e), b(!0), w(d.current, e);
70
- }, O = (t) => (e) => {
71
- s || (e.stopPropagation(), d.current = t, b(!0));
72
- }, Q = (t, e) => (r) => {
73
- if (s) return;
74
- let o = null;
75
- r.key === "ArrowRight" || r.key === "ArrowUp" ? o = e + l : r.key === "ArrowLeft" || r.key === "ArrowDown" ? o = e - l : r.key === "Home" ? o = n : r.key === "End" ? o = a : r.key === "PageUp" ? o = e + l * 10 : r.key === "PageDown" && (o = e - l * 10), o !== null && (r.preventDefault(), w(t, o, !0));
76
- }, p = T(c), W = p ?? [c], X = p ? h(p[0]) : 0, Y = h(p ? p[1] : c);
77
- return /* @__PURE__ */ P(
78
- "div",
79
- {
80
- ref: C,
81
- className: k(v.root, s && v.disabled, y?.root, K),
82
- style: x,
83
- "data-disabled": s || void 0,
84
- children: /* @__PURE__ */ Z(
85
- "div",
86
- {
87
- ref: N,
88
- className: k(v.track, y?.track),
89
- onPointerDown: J,
90
- children: [
91
- /* @__PURE__ */ P(
92
- "div",
93
- {
94
- className: k(v.range, y?.range),
95
- style: { left: `${X}%`, width: `${Y - X}%` }
96
- }
97
- ),
98
- W.map((t, e) => /* @__PURE__ */ P(
99
- "div",
100
- {
101
- className: k(v.thumb, y?.thumb),
102
- style: { left: `${h(t)}%` },
103
- role: "slider",
104
- tabIndex: s ? -1 : 0,
105
- "aria-orientation": "horizontal",
106
- "aria-valuemin": n,
107
- "aria-valuemax": a,
108
- "aria-valuenow": t,
109
- "aria-valuetext": L ? L(t) : void 0,
110
- "aria-label": z,
111
- "aria-labelledby": B,
112
- "aria-disabled": s || void 0,
113
- onPointerDown: O(e),
114
- onKeyDown: Q(e, t)
115
- },
116
- e
117
- ))
118
- ]
119
- }
120
- )
121
- }
122
- );
123
- }
124
- );
125
- tt.displayName = "Slider";
126
- export {
127
- tt as Slider
128
- };
1
+ import e from "./Slider.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/Slider/Slider.tsx
6
+ var l = (e) => Array.isArray(e) ? e : null, u = t(({ value: t, defaultValue: u, onChange: d, onChangeEnd: f, min: p = 0, max: m = 100, step: h = 1, disabled: g = !1, formatValue: _, classes: v, className: y, style: b, "aria-label": x, "aria-labelledby": S }, C) => {
7
+ let w = t !== void 0, [T, E] = a(t ?? u ?? 0), D = w ? t : T, O = i(null), k = i(0), [A, j] = a(!1), M = n((e) => Math.min(m, Math.max(p, e)), [p, m]), N = n((e) => M(Math.round((e - p) / h) * h + p), [
8
+ M,
9
+ p,
10
+ h
11
+ ]), P = n((e) => (e - p) / (m - p) * 100, [p, m]), F = n((e, t = !1) => {
12
+ w || E(e), d?.(e), t && f?.(e);
13
+ }, [
14
+ w,
15
+ d,
16
+ f
17
+ ]), I = n((e, t, n = !1) => {
18
+ let r = N(t), i = l(D);
19
+ if (i) {
20
+ let t = [i[0], i[1]];
21
+ t[e] = r, e === 0 ? t[0] = Math.min(t[0], t[1]) : t[1] = Math.max(t[1], t[0]), F(t, n);
22
+ } else F(r, n);
23
+ }, [
24
+ D,
25
+ N,
26
+ F
27
+ ]), L = n((e) => {
28
+ let t = O.current;
29
+ if (!t) return p;
30
+ let n = t.getBoundingClientRect();
31
+ return p + (n.width > 0 ? (e - n.left) / n.width : 0) * (m - p);
32
+ }, [p, m]), R = n((e) => {
33
+ let t = l(D);
34
+ return t ? Math.abs(e - t[0]) <= Math.abs(e - t[1]) ? 0 : 1 : 0;
35
+ }, [D]);
36
+ r(() => {
37
+ if (!A) return;
38
+ let e = (e) => {
39
+ I(k.current, L(e.clientX));
40
+ }, t = (e) => {
41
+ j(!1), I(k.current, L(e.clientX), !0);
42
+ };
43
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
44
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
45
+ };
46
+ }, [
47
+ A,
48
+ I,
49
+ L
50
+ ]);
51
+ let z = (e) => {
52
+ if (g) return;
53
+ let t = L(e.clientX);
54
+ k.current = R(t), j(!0), I(k.current, t);
55
+ }, B = (e) => (t) => {
56
+ g || (t.stopPropagation(), k.current = e, j(!0));
57
+ }, V = (e, t) => (n) => {
58
+ if (g) return;
59
+ let r = null;
60
+ n.key === "ArrowRight" || n.key === "ArrowUp" ? r = t + h : n.key === "ArrowLeft" || n.key === "ArrowDown" ? r = t - h : n.key === "Home" ? r = p : n.key === "End" ? r = m : n.key === "PageUp" ? r = t + h * 10 : n.key === "PageDown" && (r = t - h * 10), r !== null && (n.preventDefault(), I(e, r, !0));
61
+ }, H = l(D), U = H ?? [D], W = H ? P(H[0]) : 0, G = P(H ? H[1] : D);
62
+ return /* @__PURE__ */ s("div", {
63
+ ref: C,
64
+ className: o(e.root, g && e.disabled, v?.root, y),
65
+ style: b,
66
+ "data-disabled": g || void 0,
67
+ children: /* @__PURE__ */ c("div", {
68
+ ref: O,
69
+ className: o(e.track, v?.track),
70
+ onPointerDown: z,
71
+ children: [/* @__PURE__ */ s("div", {
72
+ className: o(e.range, v?.range),
73
+ style: {
74
+ left: `${W}%`,
75
+ width: `${G - W}%`
76
+ }
77
+ }), U.map((t, n) => /* @__PURE__ */ s("div", {
78
+ className: o(e.thumb, v?.thumb),
79
+ style: { left: `${P(t)}%` },
80
+ role: "slider",
81
+ tabIndex: g ? -1 : 0,
82
+ "aria-orientation": "horizontal",
83
+ "aria-valuemin": p,
84
+ "aria-valuemax": m,
85
+ "aria-valuenow": t,
86
+ "aria-valuetext": _ ? _(t) : void 0,
87
+ "aria-label": x,
88
+ "aria-labelledby": S,
89
+ "aria-disabled": g || void 0,
90
+ onPointerDown: B(n),
91
+ onKeyDown: V(n, t)
92
+ }, n))]
93
+ })
94
+ });
95
+ });
96
+ u.displayName = "Slider";
97
+ export { u as Slider };
@@ -0,0 +1,9 @@
1
+ // src/components/inputs/Slider/Slider.module.scss
2
+ var e = "crk-root-fvpfd", t = "crk-track-MP1oP", n = "crk-range-fh4JV", r = "crk-thumb-LKxgd", i = "crk-disabled-n8jtF", a = {
3
+ root: e,
4
+ track: t,
5
+ range: n,
6
+ thumb: r,
7
+ disabled: i
8
+ };
9
+ export { a as default, i as disabled, n as range, e as root, r as thumb, t as track };
@@ -1,8 +1,11 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as i } from "react";
3
- import { Checkbox as m } from "../Checkbox/Checkbox.js";
4
- const a = i((o, r) => /* @__PURE__ */ t(m, { ref: r, variant: "switch", ...o }));
5
- a.displayName = "Switch";
6
- export {
7
- a as Switch
8
- };
1
+ import { Checkbox as e } from "../Checkbox/Checkbox.js";
2
+ import { forwardRef as t } from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ // src/components/inputs/Switch/Switch.tsx
5
+ var r = t((t, r) => /* @__PURE__ */ n(e, {
6
+ ref: r,
7
+ variant: "switch",
8
+ ...t
9
+ }));
10
+ r.displayName = "Switch";
11
+ export { r as Switch };
@@ -1,58 +1,42 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import { forwardRef as y, useRef as v, useCallback as c, useEffect as x } from "react";
3
- import w from "clsx";
4
- import t from "./Textarea.module.scss.js";
5
- const C = {
6
- none: "resizeNone",
7
- vertical: "resizeVertical",
8
- horizontal: "resizeHorizontal",
9
- both: "resizeBoth"
10
- }, H = y(
11
- ({
12
- inputSize: n = "md",
13
- error: f = !1,
14
- resize: u = "vertical",
15
- autoExpand: r = !0,
16
- className: h,
17
- style: m,
18
- onChange: l,
19
- ...i
20
- }, o) => {
21
- const a = v(null), s = c(() => {
22
- const e = a.current;
23
- e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
24
- }, []), z = i.value ?? "";
25
- x(() => {
26
- r && s();
27
- }, [r, s, z]);
28
- const p = c(
29
- (e) => {
30
- r && s(), l?.(e);
31
- },
32
- [r, s, l]
33
- );
34
- return /* @__PURE__ */ g(
35
- "textarea",
36
- {
37
- ref: (e) => {
38
- a.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
39
- },
40
- className: w(
41
- t.root,
42
- t[n],
43
- f && t.error,
44
- r ? t.autoExpand : t[C[u]],
45
- h
46
- ),
47
- style: m,
48
- onChange: p,
49
- rows: i.rows ?? 1,
50
- ...i
51
- }
52
- );
53
- }
54
- );
55
- H.displayName = "Textarea";
56
- export {
57
- H as Textarea
58
- };
1
+ import e from "./Textarea.module.js";
2
+ import { forwardRef as t, useCallback as n, useEffect as r, useRef as i } from "react";
3
+ import a from "clsx";
4
+ import { jsx as o } from "react/jsx-runtime";
5
+ // src/components/inputs/Textarea/Textarea.tsx
6
+ var s = {
7
+ none: "resizeNone",
8
+ vertical: "resizeVertical",
9
+ horizontal: "resizeHorizontal",
10
+ both: "resizeBoth"
11
+ }, c = t(({ inputSize: t = "md", error: c = !1, resize: l = "vertical", autoExpand: u = !0, className: d, style: f, onChange: p, ...m }, h) => {
12
+ let g = i(null), _ = n(() => {
13
+ let e = g.current;
14
+ e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
15
+ }, []), v = m.value ?? "";
16
+ r(() => {
17
+ u && _();
18
+ }, [
19
+ u,
20
+ _,
21
+ v
22
+ ]);
23
+ let y = n((e) => {
24
+ u && _(), p?.(e);
25
+ }, [
26
+ u,
27
+ _,
28
+ p
29
+ ]);
30
+ return /* @__PURE__ */ o("textarea", {
31
+ ref: (e) => {
32
+ g.current = e, typeof h == "function" ? h(e) : h && (h.current = e);
33
+ },
34
+ className: a(e.root, e[t], c && e.error, u ? e.autoExpand : e[s[l]], d),
35
+ style: f,
36
+ onChange: y,
37
+ rows: m.rows ?? 1,
38
+ ...m
39
+ });
40
+ });
41
+ c.displayName = "Textarea";
42
+ export { c as Textarea };
@@ -0,0 +1,14 @@
1
+ // src/components/inputs/Textarea/Textarea.module.scss
2
+ var e = "crk-root-IGgdn", t = "crk-sm-N-5I2", n = "crk-md-bbyFl", r = "crk-lg-Pd-Iq", i = "crk-error-fyu3i", a = "crk-resizeNone-SmNT4", o = "crk-resizeVertical-oi8vP", s = "crk-resizeHorizontal-riMLL", c = "crk-resizeBoth-NYSh4", l = "crk-autoExpand-JWone", u = {
3
+ root: e,
4
+ sm: t,
5
+ md: n,
6
+ lg: r,
7
+ error: i,
8
+ resizeNone: a,
9
+ resizeVertical: o,
10
+ resizeHorizontal: s,
11
+ resizeBoth: c,
12
+ autoExpand: l
13
+ };
14
+ export { l as autoExpand, u as default, i as error, r as lg, n as md, c as resizeBoth, s as resizeHorizontal, a as resizeNone, o as resizeVertical, e as root, t as sm };
@@ -1,15 +1,18 @@
1
- import { useEffect as o } from "react";
2
- function s(t, e, n = !0) {
3
- o(() => {
4
- if (!n) return;
5
- const r = (u) => {
6
- !t.current || t.current.contains(u.target) || e();
7
- };
8
- return document.addEventListener("mousedown", r), () => {
9
- document.removeEventListener("mousedown", r);
10
- };
11
- }, [t, e, n]);
1
+ import { useEffect as e } from "react";
2
+ // src/hooks/useClickOutside.ts
3
+ function t(t, n, r = !0) {
4
+ e(() => {
5
+ if (!r) return;
6
+ let e = (e) => {
7
+ t.current && !t.current.contains(e.target) && n();
8
+ };
9
+ return document.addEventListener("mousedown", e), () => {
10
+ document.removeEventListener("mousedown", e);
11
+ };
12
+ }, [
13
+ t,
14
+ n,
15
+ r
16
+ ]);
12
17
  }
13
- export {
14
- s as useClickOutside
15
- };
18
+ export { t as useClickOutside };
@@ -1,15 +1,14 @@
1
- import { useState as u, useEffect as c } from "react";
2
- function i(e, t = 300) {
3
- const [n, o] = u(e);
4
- return c(() => {
5
- if (t <= 0) {
6
- o(e);
7
- return;
8
- }
9
- const r = setTimeout(() => o(e), t);
10
- return () => clearTimeout(r);
11
- }, [e, t]), n;
1
+ import { useEffect as e, useState as t } from "react";
2
+ // src/hooks/useDebouncedValue.ts
3
+ function n(n, r = 300) {
4
+ let [i, a] = t(n);
5
+ return e(() => {
6
+ if (r <= 0) {
7
+ a(n);
8
+ return;
9
+ }
10
+ let e = setTimeout(() => a(n), r);
11
+ return () => clearTimeout(e);
12
+ }, [n, r]), i;
12
13
  }
13
- export {
14
- i as useDebouncedValue
15
- };
14
+ export { n as useDebouncedValue };
@@ -1,23 +1,28 @@
1
- import { useState as f, useEffect as z } from "react";
2
- function g(s, o = "content-box") {
3
- const [d, u] = f({ width: 0, height: 0 });
4
- return z(() => {
5
- const r = s.current;
6
- if (!r || typeof ResizeObserver > "u") return;
7
- const c = (i, e) => u((t) => t.width === i && t.height === e ? t : { width: i, height: e }), h = new ResizeObserver((i) => {
8
- const e = i[0];
9
- if (e)
10
- if (o === "border-box" && e.borderBoxSize?.length) {
11
- const t = e.borderBoxSize[0];
12
- c(t.inlineSize, t.blockSize);
13
- } else
14
- c(e.contentRect.width, e.contentRect.height);
15
- });
16
- h.observe(r, { box: o });
17
- const n = r.getBoundingClientRect();
18
- return (n.width || n.height) && c(n.width, n.height), () => h.disconnect();
19
- }, [s, o]), d;
1
+ import { useEffect as e, useState as t } from "react";
2
+ // src/hooks/useElementSize.ts
3
+ function n(n, r = "content-box") {
4
+ let [i, a] = t({
5
+ width: 0,
6
+ height: 0
7
+ });
8
+ return e(() => {
9
+ let e = n.current;
10
+ if (!e || typeof ResizeObserver > "u") return;
11
+ let t = (e, t) => a((n) => n.width === e && n.height === t ? n : {
12
+ width: e,
13
+ height: t
14
+ }), i = new ResizeObserver((e) => {
15
+ let n = e[0];
16
+ if (n) {
17
+ if (r === "border-box" && n.borderBoxSize?.length) {
18
+ let e = n.borderBoxSize[0];
19
+ t(e.inlineSize, e.blockSize);
20
+ } else t(n.contentRect.width, n.contentRect.height);
21
+ }
22
+ });
23
+ i.observe(e, { box: r });
24
+ let o = e.getBoundingClientRect();
25
+ return (o.width || o.height) && t(o.width, o.height), () => i.disconnect();
26
+ }, [n, r]), i;
20
27
  }
21
- export {
22
- g as useElementSize
23
- };
28
+ export { n as useElementSize };
@@ -1,33 +1,32 @@
1
- import { useRef as s, useContext as l, useEffect as a, createContext as d } from "react";
2
- const r = [], f = d(null), h = f.Provider;
3
- function i(e) {
4
- if (e.key !== "Escape" || e.defaultPrevented) return;
5
- const n = r[r.length - 1];
6
- n && n.handler.current(e);
1
+ import { createContext as e, useContext as t, useEffect as n, useRef as r } from "react";
2
+ // src/hooks/useEscapeLayer.ts
3
+ var i = [], a = e(null), o = a.Provider;
4
+ function s(e) {
5
+ if (e.key !== "Escape" || e.defaultPrevented) return;
6
+ let t = i[i.length - 1];
7
+ t && t.handler.current(e);
7
8
  }
8
- function p(e, n) {
9
- for (let t = e.parent; t; t = t.parent)
10
- if (t === n) return !0;
11
- return !1;
9
+ function c(e, t) {
10
+ for (let n = e.parent; n; n = n.parent) if (n === t) return !0;
11
+ return !1;
12
12
  }
13
- function y(e) {
14
- const n = r.findIndex((t) => p(t, e));
15
- return n === -1 ? r.length : n;
13
+ function l(e) {
14
+ let t = i.findIndex((t) => c(t, e));
15
+ return t === -1 ? i.length : t;
16
16
  }
17
- function m(e, n) {
18
- const t = s(e);
19
- t.current = e;
20
- const c = l(f), u = s(null);
21
- u.current === null && (u.current = { handler: t, parent: c });
22
- const o = u.current;
23
- return o.parent = c, a(() => {
24
- if (n)
25
- return r.length === 0 && document.addEventListener("keydown", i), r.splice(y(o), 0, o), () => {
26
- r.splice(r.indexOf(o), 1), r.length === 0 && document.removeEventListener("keydown", i);
27
- };
28
- }, [n, o]), o;
17
+ function u(e, o) {
18
+ let c = r(e);
19
+ c.current = e;
20
+ let u = t(a), d = r(null);
21
+ d.current === null && (d.current = {
22
+ handler: c,
23
+ parent: u
24
+ });
25
+ let f = d.current;
26
+ return f.parent = u, n(() => {
27
+ if (o) return i.length === 0 && document.addEventListener("keydown", s), i.splice(l(f), 0, f), () => {
28
+ i.splice(i.indexOf(f), 1), i.length === 0 && document.removeEventListener("keydown", s);
29
+ };
30
+ }, [o, f]), f;
29
31
  }
30
- export {
31
- h as EscapeLayerProvider,
32
- m as useEscapeLayer
33
- };
32
+ export { o as EscapeLayerProvider, u as useEscapeLayer };