@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,81 +1,42 @@
1
- const e = "crk-wrapper-zxjMt", r = "crk-scrollable-Apjbs", t = "crk-root-Gf85-", o = "crk-paginator-UlYIY", c = "crk-dragging-dAaIR", l = "crk-headerCell-ePPZW", a = "crk-headerCellSticky-Qwz3q", s = "crk-cellSticky-LwmbD", n = "crk-headerCellSortable-NMybk", k = "crk-sortIndicator-WGD2S", i = "crk-sortArrow-1-ok4", p = "crk-sortArrowActive-yhWrO", d = "crk-sortIndex-HGoca", g = "crk-row-H0wL1", b = "crk-cell-ZfnbG", w = "crk-emptyRow-AoPfj", u = "crk-emptyCell-99-7C", C = "crk-loaderWrap-Bug3B", S = "crk-loadingRow-i25F2", y = "crk-rowClickable--9VTD", A = "crk-rowSelected-ucID4", h = "crk-hoverable-ljU9B", B = "crk-selectHeaderCell-sK1ej", m = "crk-selectCell-4A3ho", v = "crk-layoutFixed-PUK1R", I = "crk-bulkBar-OPem5", x = "crk-bulkLabel-Z5fZQ", f = "crk-bulkClear--wKbf", R = "crk-bulkActions-jm9bq", W = "crk-striped-6Qckq", j = "crk-compact-2-UWr", D = "crk-paginatorInfo-BVca4", P = "crk-paginatorText-sqWS0", q = "crk-pageSizeSelect-yhqJQ", z = "crk-paginatorNav-MDSui", H = "crk-pageButton-1PX-g", L = "crk-pageButtonActive--D7Q7", Q = "crk-pageEllipsis-en59J", F = {
2
- wrapper: e,
3
- scrollable: r,
4
- root: t,
5
- paginator: o,
6
- dragging: c,
7
- headerCell: l,
8
- headerCellSticky: a,
9
- cellSticky: s,
10
- headerCellSortable: n,
11
- sortIndicator: k,
12
- sortArrow: i,
13
- sortArrowActive: p,
14
- sortIndex: d,
15
- row: g,
16
- cell: b,
17
- emptyRow: w,
18
- emptyCell: u,
19
- loaderWrap: C,
20
- loadingRow: S,
21
- rowClickable: y,
22
- rowSelected: A,
23
- hoverable: h,
24
- selectHeaderCell: B,
25
- selectCell: m,
26
- layoutFixed: v,
27
- bulkBar: I,
28
- bulkLabel: x,
29
- bulkClear: f,
30
- bulkActions: R,
31
- striped: W,
32
- compact: j,
33
- paginatorInfo: D,
34
- paginatorText: P,
35
- pageSizeSelect: q,
36
- paginatorNav: z,
37
- pageButton: H,
38
- pageButtonActive: L,
39
- pageEllipsis: Q
40
- };
41
- export {
42
- R as bulkActions,
43
- I as bulkBar,
44
- f as bulkClear,
45
- x as bulkLabel,
46
- b as cell,
47
- s as cellSticky,
48
- j as compact,
49
- F as default,
50
- c as dragging,
51
- u as emptyCell,
52
- w as emptyRow,
53
- l as headerCell,
54
- n as headerCellSortable,
55
- a as headerCellSticky,
56
- h as hoverable,
57
- v as layoutFixed,
58
- C as loaderWrap,
59
- S as loadingRow,
60
- H as pageButton,
61
- L as pageButtonActive,
62
- Q as pageEllipsis,
63
- q as pageSizeSelect,
64
- o as paginator,
65
- D as paginatorInfo,
66
- z as paginatorNav,
67
- P as paginatorText,
68
- t as root,
69
- g as row,
70
- y as rowClickable,
71
- A as rowSelected,
72
- r as scrollable,
73
- m as selectCell,
74
- B as selectHeaderCell,
75
- i as sortArrow,
76
- p as sortArrowActive,
77
- d as sortIndex,
78
- k as sortIndicator,
79
- W as striped,
80
- e as wrapper
1
+ // src/components/Table/Table.module.scss
2
+ var e = "crk-wrapper-zxjMt", t = "crk-scrollable-Apjbs", n = "crk-root-Gf85-", r = "crk-paginator-UlYIY", i = "crk-dragging-dAaIR", a = "crk-headerCell-ePPZW", o = "crk-headerCellSticky-Qwz3q", s = "crk-cellSticky-LwmbD", c = "crk-headerCellSortable-NMybk", l = "crk-sortIndicator-WGD2S", u = "crk-sortArrow-1-ok4", d = "crk-sortArrowActive-yhWrO", f = "crk-sortIndex-HGoca", p = "crk-row-H0wL1", m = "crk-cell-ZfnbG", h = "crk-emptyRow-AoPfj", g = "crk-emptyCell-99-7C", _ = "crk-loaderWrap-Bug3B", v = "crk-loadingRow-i25F2", y = "crk-rowClickable--9VTD", b = "crk-rowSelected-ucID4", x = "crk-hoverable-ljU9B", S = "crk-selectHeaderCell-sK1ej", C = "crk-selectCell-4A3ho", w = "crk-layoutFixed-PUK1R", T = "crk-bulkBar-OPem5", E = "crk-bulkLabel-Z5fZQ", D = "crk-bulkClear--wKbf", O = "crk-bulkActions-jm9bq", k = "crk-striped-6Qckq", A = "crk-compact-2-UWr", j = "crk-paginatorInfo-BVca4", M = "crk-paginatorText-sqWS0", N = "crk-pageSizeSelect-yhqJQ", P = "crk-paginatorNav-MDSui", F = "crk-pageButton-1PX-g", I = "crk-pageButtonActive--D7Q7", L = "crk-pageEllipsis-en59J", R = {
3
+ wrapper: e,
4
+ scrollable: t,
5
+ root: n,
6
+ paginator: r,
7
+ dragging: i,
8
+ headerCell: a,
9
+ headerCellSticky: o,
10
+ cellSticky: s,
11
+ headerCellSortable: c,
12
+ sortIndicator: l,
13
+ sortArrow: u,
14
+ sortArrowActive: d,
15
+ sortIndex: f,
16
+ row: p,
17
+ cell: m,
18
+ emptyRow: h,
19
+ emptyCell: g,
20
+ loaderWrap: _,
21
+ loadingRow: v,
22
+ rowClickable: y,
23
+ rowSelected: b,
24
+ hoverable: x,
25
+ selectHeaderCell: S,
26
+ selectCell: C,
27
+ layoutFixed: w,
28
+ bulkBar: T,
29
+ bulkLabel: E,
30
+ bulkClear: D,
31
+ bulkActions: O,
32
+ striped: k,
33
+ compact: A,
34
+ paginatorInfo: j,
35
+ paginatorText: M,
36
+ pageSizeSelect: N,
37
+ paginatorNav: P,
38
+ pageButton: F,
39
+ pageButtonActive: I,
40
+ pageEllipsis: L
81
41
  };
42
+ export { O as bulkActions, T as bulkBar, D as bulkClear, E as bulkLabel, m as cell, s as cellSticky, A as compact, R as default, i as dragging, g as emptyCell, h as emptyRow, a as headerCell, c as headerCellSortable, o as headerCellSticky, x as hoverable, w as layoutFixed, _ as loaderWrap, v as loadingRow, F as pageButton, I as pageButtonActive, L as pageEllipsis, N as pageSizeSelect, r as paginator, j as paginatorInfo, P as paginatorNav, M as paginatorText, n as root, p as row, y as rowClickable, b as rowSelected, t as scrollable, C as selectCell, S as selectHeaderCell, u as sortArrow, d as sortArrowActive, f as sortIndex, l as sortIndicator, k as striped, e as wrapper };
@@ -1,44 +1,53 @@
1
- import { useState as m, useCallback as l, useMemo as p } from "react";
2
- function C(n, s) {
3
- return n == null && s == null ? 0 : n == null ? -1 : s == null ? 1 : typeof n == "number" && typeof s == "number" ? n - s : String(n).localeCompare(String(s));
1
+ import { useCallback as e, useMemo as t, useState as n } from "react";
2
+ // src/components/Table/useTableSort.ts
3
+ function r(e, t) {
4
+ return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
4
5
  }
5
- function M(n, s = []) {
6
- const [c, f] = m(s), g = l(
7
- (e, r = "asc") => {
8
- const i = r === "asc" ? "desc" : "asc";
9
- f((o) => {
10
- const t = o.find((d) => d.key === e);
11
- return t ? t.direction === r ? [{ key: e, direction: i }] : [] : [{ key: e, direction: r }];
12
- });
13
- },
14
- []
15
- ), x = l(
16
- (e, r = "asc") => {
17
- const i = r === "asc" ? "desc" : "asc";
18
- f((o) => {
19
- const t = o.findIndex((u) => u.key === e);
20
- if (t === -1)
21
- return [...o, { key: e, direction: r }];
22
- if (o[t].direction === r) {
23
- const u = [...o];
24
- return u[t] = { key: e, direction: i }, u;
25
- }
26
- return o.filter((u, a) => a !== t);
27
- });
28
- },
29
- []
30
- ), S = l(() => {
31
- f([]);
32
- }, []);
33
- return { sortedData: p(() => c.length === 0 ? n : [...n].sort((e, r) => {
34
- for (const { key: i, direction: o } of c) {
35
- const t = C(e[i], r[i]);
36
- if (t !== 0)
37
- return o === "asc" ? t : -t;
38
- }
39
- return 0;
40
- }), [n, c]), sortConfig: c, requestSort: g, requestMultiSort: x, resetSort: S };
6
+ function i(i, a = []) {
7
+ let [o, s] = n(a), c = e((e, t = "asc") => {
8
+ let n = t === "asc" ? "desc" : "asc";
9
+ s((r) => {
10
+ let i = r.find((t) => t.key === e);
11
+ return i ? i.direction === t ? [{
12
+ key: e,
13
+ direction: n
14
+ }] : [] : [{
15
+ key: e,
16
+ direction: t
17
+ }];
18
+ });
19
+ }, []), l = e((e, t = "asc") => {
20
+ let n = t === "asc" ? "desc" : "asc";
21
+ s((r) => {
22
+ let i = r.findIndex((t) => t.key === e);
23
+ if (i === -1) return [...r, {
24
+ key: e,
25
+ direction: t
26
+ }];
27
+ if (r[i].direction === t) {
28
+ let t = [...r];
29
+ return t[i] = {
30
+ key: e,
31
+ direction: n
32
+ }, t;
33
+ }
34
+ return r.filter((e, t) => t !== i);
35
+ });
36
+ }, []), u = e(() => {
37
+ s([]);
38
+ }, []);
39
+ return {
40
+ sortedData: t(() => o.length === 0 ? i : [...i].sort((e, t) => {
41
+ for (let { key: n, direction: i } of o) {
42
+ let a = r(e[n], t[n]);
43
+ if (a !== 0) return i === "asc" ? a : -a;
44
+ }
45
+ return 0;
46
+ }), [i, o]),
47
+ sortConfig: o,
48
+ requestSort: c,
49
+ requestMultiSort: l,
50
+ resetSort: u
51
+ };
41
52
  }
42
- export {
43
- M as useTableSort
44
- };
53
+ export { i as useTableSort };
@@ -1,163 +1,111 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as x, useId as R, useState as L, useCallback as g, useRef as V, createContext as D, useContext as S } from "react";
3
- import $ from "clsx";
4
- import d from "./Tabs.module.scss.js";
5
- const N = D(null);
6
- function I(e) {
7
- const n = S(N);
8
- if (!n) throw new Error(`${e} must be rendered inside a <Tabs>.`);
9
- return n;
1
+ import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useId as i, useRef as a, useState as o } from "react";
2
+ import s from "clsx";
3
+ import c from "./Tabs.module.scss.js";
4
+ import { jsx as l } from "react/jsx-runtime";
5
+ // src/components/Tabs/Tabs.tsx
6
+ var u = e(null);
7
+ function d(e) {
8
+ let t = r(u);
9
+ if (!t) throw Error(`${e} must be rendered inside a <Tabs>.`);
10
+ return t;
10
11
  }
11
- const k = x(
12
- ({
13
- value: e,
14
- defaultValue: n,
15
- onValueChange: b,
16
- orientation: o = "horizontal",
17
- variant: r = "line",
18
- size: s = "md",
19
- classes: i,
20
- className: a,
21
- children: l,
22
- ...t
23
- }, p) => {
24
- const c = R(), f = e !== void 0, [h, T] = L(n), u = f ? e : h, y = g(
25
- (w) => {
26
- f || T(w), b?.(w);
27
- },
28
- [f, b]
29
- ), v = {
30
- value: u,
31
- setValue: y,
32
- baseId: c,
33
- orientation: o,
34
- variant: r,
35
- size: s,
36
- classes: i
37
- };
38
- return /* @__PURE__ */ m(N.Provider, { value: v, children: /* @__PURE__ */ m(
39
- "div",
40
- {
41
- ref: p,
42
- className: $(
43
- d.root,
44
- o === "vertical" && d.vertical,
45
- i?.root,
46
- a
47
- ),
48
- ...t,
49
- children: l
50
- }
51
- ) });
52
- }
53
- );
54
- k.displayName = "Tabs";
55
- const A = x(
56
- ({ className: e, children: n, onKeyDown: b, ...o }, r) => {
57
- const s = I("Tabs.List"), i = V(null), a = g(
58
- (t) => {
59
- i.current = t, typeof r == "function" ? r(t) : r && (r.current = t);
60
- },
61
- [r]
62
- ), l = (t) => {
63
- if (b?.(t), t.defaultPrevented) return;
64
- const p = i.current;
65
- if (!p) return;
66
- const c = Array.from(
67
- p.querySelectorAll('[role="tab"]:not([aria-disabled="true"])')
68
- );
69
- if (c.length === 0) return;
70
- const f = s.orientation === "vertical" ? "ArrowDown" : "ArrowRight", h = s.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", T = c.indexOf(document.activeElement);
71
- let u = null;
72
- if (t.key === f ? u = (T + 1) % c.length : t.key === h ? u = (T - 1 + c.length) % c.length : t.key === "Home" ? u = 0 : t.key === "End" && (u = c.length - 1), u === null) return;
73
- t.preventDefault();
74
- const y = c[u];
75
- y.focus();
76
- const v = y.dataset.value;
77
- v !== void 0 && s.setValue(v);
78
- };
79
- return /* @__PURE__ */ m(
80
- "div",
81
- {
82
- ref: a,
83
- role: "tablist",
84
- "aria-orientation": s.orientation,
85
- className: $(
86
- d.list,
87
- d[`list_${s.variant}`],
88
- d[`list_${s.size}`],
89
- s.classes?.list,
90
- e
91
- ),
92
- onKeyDown: l,
93
- ...o,
94
- children: n
95
- }
96
- );
97
- }
98
- );
99
- A.displayName = "Tabs.List";
100
- const C = x(
101
- ({ value: e, disabled: n = !1, className: b, children: o, onClick: r, ...s }, i) => {
102
- const a = I("Tabs.Tab"), l = a.value === e;
103
- return /* @__PURE__ */ m(
104
- "button",
105
- {
106
- ref: i,
107
- type: "button",
108
- role: "tab",
109
- id: `${a.baseId}-tab-${e}`,
110
- "data-value": e,
111
- "aria-selected": l,
112
- "aria-controls": `${a.baseId}-panel-${e}`,
113
- "aria-disabled": n || void 0,
114
- tabIndex: l ? 0 : -1,
115
- disabled: n,
116
- className: $(
117
- d.tab,
118
- d[`tab_${a.variant}`],
119
- l && d.tabSelected,
120
- a.classes?.tab,
121
- b
122
- ),
123
- onClick: (t) => {
124
- r?.(t), n || a.setValue(e);
125
- },
126
- ...s,
127
- children: o
128
- }
129
- );
130
- }
131
- );
132
- C.displayName = "Tabs.Tab";
133
- const P = x(
134
- ({ value: e, keepMounted: n = !1, className: b, style: o, children: r, ...s }, i) => {
135
- const a = I("Tabs.Panel"), l = a.value === e;
136
- if (!l && !n) return null;
137
- const t = l ? o : { display: "none", ...o };
138
- return /* @__PURE__ */ m(
139
- "div",
140
- {
141
- ref: i,
142
- role: "tabpanel",
143
- id: `${a.baseId}-panel-${e}`,
144
- "aria-labelledby": `${a.baseId}-tab-${e}`,
145
- hidden: !l,
146
- tabIndex: 0,
147
- className: $(d.panel, a.classes?.panel, b),
148
- style: t,
149
- ...s,
150
- children: r
151
- }
152
- );
153
- }
154
- );
155
- P.displayName = "Tabs.Panel";
156
- const K = Object.assign(k, {
157
- List: A,
158
- Tab: C,
159
- Panel: P
12
+ var f = t(({ value: e, defaultValue: t, onValueChange: r, orientation: a = "horizontal", variant: d = "line", size: f = "md", classes: p, className: m, children: h, ...g }, _) => {
13
+ let v = i(), y = e !== void 0, [b, x] = o(t), S = {
14
+ value: y ? e : b,
15
+ setValue: n((e) => {
16
+ y || x(e), r?.(e);
17
+ }, [y, r]),
18
+ baseId: v,
19
+ orientation: a,
20
+ variant: d,
21
+ size: f,
22
+ classes: p
23
+ };
24
+ return /* @__PURE__ */ l(u.Provider, {
25
+ value: S,
26
+ children: /* @__PURE__ */ l("div", {
27
+ ref: _,
28
+ className: s(c.root, a === "vertical" && c.vertical, p?.root, m),
29
+ ...g,
30
+ children: h
31
+ })
32
+ });
160
33
  });
161
- export {
162
- K as Tabs
163
- };
34
+ f.displayName = "Tabs";
35
+ var p = t(({ className: e, children: t, onKeyDown: r, ...i }, o) => {
36
+ let u = d("Tabs.List"), f = a(null), p = n((e) => {
37
+ f.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
38
+ }, [o]);
39
+ return /* @__PURE__ */ l("div", {
40
+ ref: p,
41
+ role: "tablist",
42
+ "aria-orientation": u.orientation,
43
+ className: s(c.list, c[`list_${u.variant}`], c[`list_${u.size}`], u.classes?.list, e),
44
+ onKeyDown: (e) => {
45
+ if (r?.(e), e.defaultPrevented) return;
46
+ let t = f.current;
47
+ if (!t) return;
48
+ let n = Array.from(t.querySelectorAll("[role=\"tab\"]:not([aria-disabled=\"true\"])"));
49
+ if (n.length === 0) return;
50
+ let i = u.orientation === "vertical" ? "ArrowDown" : "ArrowRight", a = u.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", o = n.indexOf(document.activeElement), s = null;
51
+ if (e.key === i ? s = (o + 1) % n.length : e.key === a ? s = (o - 1 + n.length) % n.length : e.key === "Home" ? s = 0 : e.key === "End" && (s = n.length - 1), s === null) return;
52
+ e.preventDefault();
53
+ let c = n[s];
54
+ c.focus();
55
+ let l = c.dataset.value;
56
+ l !== void 0 && u.setValue(l);
57
+ },
58
+ ...i,
59
+ children: t
60
+ });
61
+ });
62
+ p.displayName = "Tabs.List";
63
+ var m = t(({ value: e, disabled: t = !1, className: n, children: r, onClick: i, ...a }, o) => {
64
+ let u = d("Tabs.Tab"), f = u.value === e;
65
+ return /* @__PURE__ */ l("button", {
66
+ ref: o,
67
+ type: "button",
68
+ role: "tab",
69
+ id: `${u.baseId}-tab-${e}`,
70
+ "data-value": e,
71
+ "aria-selected": f,
72
+ "aria-controls": `${u.baseId}-panel-${e}`,
73
+ "aria-disabled": t || void 0,
74
+ tabIndex: f ? 0 : -1,
75
+ disabled: t,
76
+ className: s(c.tab, c[`tab_${u.variant}`], f && c.tabSelected, u.classes?.tab, n),
77
+ onClick: (n) => {
78
+ i?.(n), t || u.setValue(e);
79
+ },
80
+ ...a,
81
+ children: r
82
+ });
83
+ });
84
+ m.displayName = "Tabs.Tab";
85
+ var h = t(({ value: e, keepMounted: t = !1, className: n, style: r, children: i, ...a }, o) => {
86
+ let u = d("Tabs.Panel"), f = u.value === e;
87
+ if (!f && !t) return null;
88
+ let p = f ? r : {
89
+ display: "none",
90
+ ...r
91
+ };
92
+ return /* @__PURE__ */ l("div", {
93
+ ref: o,
94
+ role: "tabpanel",
95
+ id: `${u.baseId}-panel-${e}`,
96
+ "aria-labelledby": `${u.baseId}-tab-${e}`,
97
+ hidden: !f,
98
+ tabIndex: 0,
99
+ className: s(c.panel, u.classes?.panel, n),
100
+ style: p,
101
+ ...a,
102
+ children: i
103
+ });
104
+ });
105
+ h.displayName = "Tabs.Panel";
106
+ var g = Object.assign(f, {
107
+ List: p,
108
+ Tab: m,
109
+ Panel: h
110
+ });
111
+ export { g as Tabs };
@@ -1,53 +1,28 @@
1
- const l = "crk-root-2x4fl", t = "crk-vertical-D93pf", i = "crk-list-6iAKX", s = "crk-list_line-ZazHL", c = "crk-list_line-ZazHL", o = "crk-list_solid-Lbmnx", n = "crk-list_solid-Lbmnx", a = "crk-list_pill-g90VV", _ = "crk-list_pill-g90VV", e = "crk-list_sm-U-pax", r = "crk-list_sm-U-pax", b = "crk-tab-LYqhc", k = "crk-list_md-0H3Fg", d = "crk-list_md-0H3Fg", p = "crk-list_lg-vxB6m", m = "crk-list_lg-vxB6m", L = "crk-tab_line-8v4fZ", g = "crk-tab_line-8v4fZ", x = "crk-tabSelected-lZne9", v = "crk-tab_solid-4RJvK", S = "crk-tab_solid-4RJvK", f = "crk-tab_pill-qGlBx", Z = "crk-tab_pill-qGlBx", B = "crk-panel-0OUR6", H = {
2
- root: l,
3
- vertical: t,
4
- list: i,
5
- list_line: s,
6
- listLine: c,
7
- list_solid: o,
8
- listSolid: n,
9
- list_pill: a,
10
- listPill: _,
11
- list_sm: e,
12
- listSm: r,
13
- tab: b,
14
- list_md: k,
15
- listMd: d,
16
- list_lg: p,
17
- listLg: m,
18
- tab_line: L,
19
- tabLine: g,
20
- tabSelected: x,
21
- tab_solid: v,
22
- tabSolid: S,
23
- tab_pill: f,
24
- tabPill: Z,
25
- panel: B
26
- };
27
- export {
28
- H as default,
29
- i as list,
30
- m as listLg,
31
- c as listLine,
32
- d as listMd,
33
- _ as listPill,
34
- r as listSm,
35
- n as listSolid,
36
- p as list_lg,
37
- s as list_line,
38
- k as list_md,
39
- a as list_pill,
40
- e as list_sm,
41
- o as list_solid,
42
- B as panel,
43
- l as root,
44
- b as tab,
45
- g as tabLine,
46
- Z as tabPill,
47
- x as tabSelected,
48
- S as tabSolid,
49
- L as tab_line,
50
- f as tab_pill,
51
- v as tab_solid,
52
- t as vertical
1
+ // src/components/Tabs/Tabs.module.scss
2
+ var e = "crk-root-2x4fl", t = "crk-vertical-D93pf", n = "crk-list-6iAKX", r = "crk-list_line-ZazHL", i = "crk-list_line-ZazHL", a = "crk-list_solid-Lbmnx", o = "crk-list_solid-Lbmnx", s = "crk-list_pill-g90VV", c = "crk-list_pill-g90VV", l = "crk-list_sm-U-pax", u = "crk-list_sm-U-pax", d = "crk-tab-LYqhc", f = "crk-list_md-0H3Fg", p = "crk-list_md-0H3Fg", m = "crk-list_lg-vxB6m", h = "crk-list_lg-vxB6m", g = "crk-tab_line-8v4fZ", _ = "crk-tab_line-8v4fZ", v = "crk-tabSelected-lZne9", y = "crk-tab_solid-4RJvK", b = "crk-tab_solid-4RJvK", x = "crk-tab_pill-qGlBx", S = "crk-tab_pill-qGlBx", C = "crk-panel-0OUR6", w = {
3
+ root: e,
4
+ vertical: t,
5
+ list: n,
6
+ list_line: r,
7
+ listLine: i,
8
+ list_solid: a,
9
+ listSolid: o,
10
+ list_pill: s,
11
+ listPill: c,
12
+ list_sm: l,
13
+ listSm: u,
14
+ tab: d,
15
+ list_md: f,
16
+ listMd: p,
17
+ list_lg: m,
18
+ listLg: h,
19
+ tab_line: g,
20
+ tabLine: _,
21
+ tabSelected: v,
22
+ tab_solid: y,
23
+ tabSolid: b,
24
+ tab_pill: x,
25
+ tabPill: S,
26
+ panel: C
53
27
  };
28
+ export { w as default, n as list, h as listLg, i as listLine, p as listMd, c as listPill, u as listSm, o as listSolid, m as list_lg, r as list_line, f as list_md, s as list_pill, l as list_sm, a as list_solid, C as panel, e as root, d as tab, _ as tabLine, S as tabPill, v as tabSelected, b as tabSolid, g as tab_line, x as tab_pill, y as tab_solid, t as vertical };