@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,73 +1,50 @@
1
- const e = "crk-wrapper-SP2JE", r = "crk-sm-DqshL", c = "crk-md-j4AKI", t = "crk-lg-24Xd3", i = "crk-root-Uu9Ah", s = "crk-error-9oRU6", n = "crk-arrow-WU8ZW", l = "crk-searchableWrapper-7AL4l", o = "crk-hiddenSelect-s3DEx", a = "crk-searchableTrigger-m-GWV", m = "crk-triggerOpen-Lo8-j", g = "crk-triggerLabel-5rETZ", h = "crk-placeholder-teBBh", d = "crk-arrowInline-m-roG", k = "crk-disabled-pcSeq", p = "crk-visuallyHidden-2tTD5", u = "crk-menu--i-je", b = "crk-menuEnter-vJjLV", w = "crk-menuItems-VrZnE", S = "crk-item-fU3XI", T = "crk-itemHighlighted-MvR41", L = "crk-itemDisabled-KTUO8", D = "crk-itemSelected-42-BG", I = "crk-noResults-uicSW", R = "crk-match-Aej-J", v = "crk-spinner-I1ffm", H = "crk-multiTrigger-Pd3wJ", W = "crk-multiTriggerDisabled-9ajge", E = "crk-chip-TuYUB", j = "crk-chipLabel-H4JWu", U = "crk-chipRemove-Lfk0R", f = "crk-multiSearch-OrVeS", A = "crk-arrowMulti-Nh9Hr", B = "crk-itemCheck-DPB5A", J = {
2
- wrapper: e,
3
- sm: r,
4
- md: c,
5
- lg: t,
6
- root: i,
7
- error: s,
8
- arrow: n,
9
- searchableWrapper: l,
10
- hiddenSelect: o,
11
- searchableTrigger: a,
12
- triggerOpen: m,
13
- triggerLabel: g,
14
- placeholder: h,
15
- arrowInline: d,
16
- disabled: k,
17
- visuallyHidden: p,
18
- menu: u,
19
- menuEnter: b,
20
- menuItems: w,
21
- item: S,
22
- itemHighlighted: T,
23
- itemDisabled: L,
24
- itemSelected: D,
25
- noResults: I,
26
- match: R,
27
- spinner: v,
28
- multiTrigger: H,
29
- multiTriggerDisabled: W,
30
- chip: E,
31
- chipLabel: j,
32
- chipRemove: U,
33
- multiSearch: f,
34
- arrowMulti: A,
35
- itemCheck: B
36
- };
37
- export {
38
- n as arrow,
39
- d as arrowInline,
40
- A as arrowMulti,
41
- E as chip,
42
- j as chipLabel,
43
- U as chipRemove,
44
- J as default,
45
- k as disabled,
46
- s as error,
47
- o as hiddenSelect,
48
- S as item,
49
- B as itemCheck,
50
- L as itemDisabled,
51
- T as itemHighlighted,
52
- D as itemSelected,
53
- t as lg,
54
- R as match,
55
- c as md,
56
- u as menu,
57
- b as menuEnter,
58
- w as menuItems,
59
- f as multiSearch,
60
- H as multiTrigger,
61
- W as multiTriggerDisabled,
62
- I as noResults,
63
- h as placeholder,
64
- i as root,
65
- a as searchableTrigger,
66
- l as searchableWrapper,
67
- r as sm,
68
- v as spinner,
69
- g as triggerLabel,
70
- m as triggerOpen,
71
- p as visuallyHidden,
72
- e as wrapper
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 = "crk-moreChip-Rlrb8", F = "crk-checklistTrigger-3mDgS", I = "crk-checklistButton-Jvh3L", L = "crk-menuChecklist-MxLWj", R = "crk-menuSearchRow-LuCyU", z = "crk-menuSearchIcon-drN6W", B = "crk-menuSearch-SjM96", V = "crk-menuHeader-VpZN1", H = "crk-menuAction-t1izk", U = "crk-checkbox-xFpYO", W = "crk-checkboxChecked-PATgQ", G = "crk-itemBody--PcX2", K = {
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
+ moreChip: P,
38
+ checklistTrigger: F,
39
+ checklistButton: I,
40
+ menuChecklist: L,
41
+ menuSearchRow: R,
42
+ menuSearchIcon: z,
43
+ menuSearch: B,
44
+ menuHeader: V,
45
+ menuAction: H,
46
+ checkbox: U,
47
+ checkboxChecked: W,
48
+ itemBody: G
73
49
  };
50
+ export { o as arrow, p as arrowInline, M as arrowMulti, U as checkbox, W as checkboxChecked, I as checklistButton, F as checklistTrigger, O as chip, k as chipLabel, A as chipRemove, K as default, m as disabled, a as error, c as hiddenSelect, y as item, G as itemBody, N as itemCheck, x as itemDisabled, b as itemHighlighted, S as itemSelected, r as lg, w as match, n as md, g as menu, H as menuAction, L as menuChecklist, _ as menuEnter, V as menuHeader, v as menuItems, B as menuSearch, z as menuSearchIcon, R as menuSearchRow, P as moreChip, 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 { forwardRef as e, useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
2
+ import a from "clsx";
3
+ import o from "./Slider.module.scss.js";
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 = e(({ value: e, 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 = e !== void 0, [T, E] = i(e ?? u ?? 0), D = w ? e : T, O = r(null), k = r(0), [A, j] = i(!1), M = t((e) => Math.min(m, Math.max(p, e)), [p, m]), N = t((e) => M(Math.round((e - p) / h) * h + p), [
8
+ M,
9
+ p,
10
+ h
11
+ ]), P = t((e) => (e - p) / (m - p) * 100, [p, m]), F = t((e, t = !1) => {
12
+ w || E(e), d?.(e), t && f?.(e);
13
+ }, [
14
+ w,
15
+ d,
16
+ f
17
+ ]), I = t((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 = t((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 = t((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
+ n(() => {
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: a(o.root, g && o.disabled, v?.root, y),
65
+ style: b,
66
+ "data-disabled": g || void 0,
67
+ children: /* @__PURE__ */ c("div", {
68
+ ref: O,
69
+ className: a(o.track, v?.track),
70
+ onPointerDown: z,
71
+ children: [/* @__PURE__ */ s("div", {
72
+ className: a(o.range, v?.range),
73
+ style: {
74
+ left: `${W}%`,
75
+ width: `${G - W}%`
76
+ }
77
+ }), U.map((e, t) => /* @__PURE__ */ s("div", {
78
+ className: a(o.thumb, v?.thumb),
79
+ style: { left: `${P(e)}%` },
80
+ role: "slider",
81
+ tabIndex: g ? -1 : 0,
82
+ "aria-orientation": "horizontal",
83
+ "aria-valuemin": p,
84
+ "aria-valuemax": m,
85
+ "aria-valuenow": e,
86
+ "aria-valuetext": _ ? _(e) : void 0,
87
+ "aria-label": x,
88
+ "aria-labelledby": S,
89
+ "aria-disabled": g || void 0,
90
+ onPointerDown: B(t),
91
+ onKeyDown: V(t, e)
92
+ }, t))]
93
+ })
94
+ });
95
+ });
96
+ u.displayName = "Slider";
97
+ export { u as Slider };
@@ -1,15 +1,9 @@
1
- const t = "crk-root-fvpfd", r = "crk-track-MP1oP", c = "crk-range-fh4JV", o = "crk-thumb-LKxgd", s = "crk-disabled-n8jtF", a = {
2
- root: t,
3
- track: r,
4
- range: c,
5
- thumb: o,
6
- disabled: s
7
- };
8
- export {
9
- a as default,
10
- s as disabled,
11
- c as range,
12
- t as root,
13
- o as thumb,
14
- r as track
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
15
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 { forwardRef as e } from "react";
2
+ import { Checkbox as t } from "../Checkbox/Checkbox.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ // src/components/inputs/Switch/Switch.tsx
5
+ var r = e((e, r) => /* @__PURE__ */ n(t, {
6
+ ref: r,
7
+ variant: "switch",
8
+ ...e
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 { forwardRef as e, useCallback as t, useEffect as n, useRef as r } from "react";
2
+ import i from "clsx";
3
+ import a from "./Textarea.module.scss.js";
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 = e(({ inputSize: e = "md", error: c = !1, resize: l = "vertical", autoExpand: u = !0, className: d, style: f, onChange: p, ...m }, h) => {
12
+ let g = r(null), _ = t(() => {
13
+ let e = g.current;
14
+ e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
15
+ }, []), v = m.value ?? "";
16
+ n(() => {
17
+ u && _();
18
+ }, [
19
+ u,
20
+ _,
21
+ v
22
+ ]);
23
+ let y = t((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: i(a.root, a[e], c && a.error, u ? a.autoExpand : a[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 };
@@ -1,25 +1,14 @@
1
- const r = "crk-root-IGgdn", o = "crk-sm-N-5I2", e = "crk-md-bbyFl", s = "crk-lg-Pd-Iq", t = "crk-error-fyu3i", c = "crk-resizeNone-SmNT4", n = "crk-resizeVertical-oi8vP", i = "crk-resizeHorizontal-riMLL", z = "crk-resizeBoth-NYSh4", a = "crk-autoExpand-JWone", l = {
2
- root: r,
3
- sm: o,
4
- md: e,
5
- lg: s,
6
- error: t,
7
- resizeNone: c,
8
- resizeVertical: n,
9
- resizeHorizontal: i,
10
- resizeBoth: z,
11
- autoExpand: a
12
- };
13
- export {
14
- a as autoExpand,
15
- l as default,
16
- t as error,
17
- s as lg,
18
- e as md,
19
- z as resizeBoth,
20
- i as resizeHorizontal,
21
- c as resizeNone,
22
- n as resizeVertical,
23
- r as root,
24
- o as sm
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
25
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 };