@overdoser/react-toolkit 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.js +20 -0
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.js +25 -0
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +92 -95
  9. package/components/Alert/Alert.module.js +18 -0
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.js +23 -0
  12. package/components/Badge/Badge.js +16 -38
  13. package/components/Badge/Badge.module.js +17 -0
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.js +25 -0
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.js +35 -0
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.js +32 -0
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +46 -41
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.js +32 -0
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.js +23 -0
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.js +28 -0
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.js +17 -0
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.js +10 -0
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.js +66 -0
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.js +29 -0
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +12 -10
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.js +12 -0
  71. package/components/EmptyState/EmptyState.js +58 -55
  72. package/components/EmptyState/EmptyState.module.js +14 -0
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +32 -35
  75. package/components/Form/Form.module.js +16 -0
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.js +26 -0
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +25 -22
  85. package/components/Kbd/Kbd.module.js +10 -0
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.js +23 -0
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.js +10 -0
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.js +12 -0
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.js +40 -0
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.js +18 -0
  96. package/components/PageHeader/PageHeader.js +78 -72
  97. package/components/PageHeader/PageHeader.module.js +23 -0
  98. package/components/Pagination/Pagination.js +63 -84
  99. package/components/Pagination/Pagination.module.js +13 -0
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.js +12 -0
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +57 -90
  105. package/components/ProgressBar/ProgressBar.module.js +29 -0
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.js +3 -0
  108. package/components/SegmentedControl/SegmentedControl.js +94 -130
  109. package/components/SegmentedControl/SegmentedControl.module.js +21 -0
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.js +15 -0
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.js +12 -0
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.js +31 -0
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.js +14 -0
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.js +42 -0
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.js +18 -0
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.js +28 -0
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.js +29 -0
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.js +31 -0
  134. package/components/Timeline/Timeline.module.js +76 -0
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +245 -178
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.js +98 -0
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.js +29 -0
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.js +37 -0
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  153. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.js +17 -0
  157. package/components/Typography/Typography.js +11 -36
  158. package/components/Typography/Typography.module.js +30 -0
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.js +15 -0
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.js +9 -0
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  183. package/components/inputs/Select/Select.js +555 -682
  184. package/components/inputs/Select/Select.module.js +38 -0
  185. package/components/inputs/Slider/Slider.js +97 -128
  186. package/components/inputs/Slider/Slider.module.js +9 -0
  187. package/components/inputs/Switch/Switch.js +11 -8
  188. package/components/inputs/Textarea/Textarea.js +42 -58
  189. package/components/inputs/Textarea/Textarea.module.js +14 -0
  190. package/hooks/useClickOutside.js +17 -14
  191. package/hooks/useDebouncedValue.js +13 -14
  192. package/hooks/useElementSize.js +27 -22
  193. package/hooks/useEscapeLayer.js +28 -29
  194. package/hooks/useFocusTrap.js +27 -38
  195. package/hooks/useKeyboard.js +76 -64
  196. package/hooks/useMediaQuery.js +10 -15
  197. package/hooks/useNow.js +28 -33
  198. package/hooks/usePersistedState.js +98 -94
  199. package/hooks/usePortalPosition.js +25 -19
  200. package/hooks/useResizable.js +106 -104
  201. package/hooks/useTheme.js +28 -23
  202. package/index.css +2 -1
  203. package/index.js +97 -215
  204. package/index.layered.css +2 -3
  205. package/llms.txt +3 -0
  206. package/manifest.json +8 -0
  207. package/package.json +1 -1
  208. package/utils/formatBytes.js +29 -13
  209. package/utils/themeScript.js +6 -8
  210. package/utils/timeAgo.js +59 -32
  211. package/components/Accordion/Accordion.module.scss.js +0 -36
  212. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  213. package/components/Alert/Alert.module.scss.js +0 -33
  214. package/components/Avatar/Avatar.module.scss.js +0 -43
  215. package/components/Badge/Badge.module.scss.js +0 -31
  216. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  217. package/components/Button/Button.module.scss.js +0 -47
  218. package/components/Card/Card.module.scss.js +0 -60
  219. package/components/Chart/Chart.module.scss.js +0 -61
  220. package/components/Chip/Chip.module.scss.js +0 -59
  221. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  222. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  223. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  224. package/components/Divider/Divider.module.scss.js +0 -31
  225. package/components/Draggable/Draggable.module.scss.js +0 -17
  226. package/components/Drawer/Drawer.module.scss.js +0 -119
  227. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  228. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  229. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  230. package/components/Form/Form.module.scss.js +0 -29
  231. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  232. package/components/Kbd/Kbd.module.scss.js +0 -17
  233. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  234. package/components/Link/Link.module.scss.js +0 -16
  235. package/components/List/List.module.scss.js +0 -21
  236. package/components/Loader/Loader.module.scss.js +0 -70
  237. package/components/Modal/Modal.module.scss.js +0 -33
  238. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  239. package/components/Pagination/Pagination.module.scss.js +0 -23
  240. package/components/Popover/Popover.module.scss.js +0 -21
  241. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  242. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  243. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  244. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  245. package/components/Spinner/Spinner.module.scss.js +0 -20
  246. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  247. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  248. package/components/StatCard/StatCard.module.scss.js +0 -72
  249. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  250. package/components/Table/Table.module.scss.js +0 -81
  251. package/components/Tabs/Tabs.module.scss.js +0 -53
  252. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  253. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  254. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  255. package/components/Timeline/Timeline.module.scss.js +0 -141
  256. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  257. package/components/Timer/Timer.module.scss.js +0 -55
  258. package/components/Toast/Toast.module.scss.js +0 -62
  259. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  260. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  261. package/components/Typography/Typography.module.scss.js +0 -53
  262. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  263. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  264. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  265. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  266. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  267. package/components/inputs/Input/Input.module.scss.js +0 -27
  268. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  269. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  270. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  271. package/components/inputs/Select/Select.module.scss.js +0 -73
  272. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  273. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
@@ -1,456 +1,386 @@
1
- import { jsxs as v, jsx as a } from "react/jsx-runtime";
2
- import { useMemo as H, useCallback as y, useEffect as Je, useState as Se, useRef as V } from "react";
3
- import c from "clsx";
4
- import n from "./Table.module.scss.js";
5
- import { useTableSort as Qe } from "./useTableSort.js";
6
- import { Loader as Ye } from "../Loader/Loader.js";
7
- import { Skeleton as Ze } from "../Skeleton/Skeleton.js";
8
- import { Checkbox as ke } from "../inputs/Checkbox/Checkbox.js";
9
- function _(s) {
10
- return typeof s.key == "string";
1
+ import e from "./Table.module.js";
2
+ import { useTableSort as t } from "./useTableSort.js";
3
+ import { Loader as n } from "../Loader/Loader.js";
4
+ import { Skeleton as r } from "../Skeleton/Skeleton.js";
5
+ import { Checkbox as i } from "../inputs/Checkbox/Checkbox.js";
6
+ import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
7
+ import u from "clsx";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ // src/components/Table/Table.tsx
10
+ function p(e) {
11
+ return typeof e.key == "string";
11
12
  }
12
- function P(s) {
13
- return _(s) ? s.key : s.id;
13
+ function m(e) {
14
+ return p(e) ? e.key : e.id;
14
15
  }
15
- const ze = 'button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="menuitem"], [contenteditable]';
16
- function et({ direction: s, sortIndex: u }) {
17
- return /* @__PURE__ */ v("span", { className: n.sortIndicator, "aria-hidden": "true", children: [
18
- /* @__PURE__ */ a("span", { className: c(n.sortArrow, s === "asc" && n.sortArrowActive), children: "▲" }),
19
- /* @__PURE__ */ a("span", { className: c(n.sortArrow, s === "desc" && n.sortArrowActive), children: "▼" }),
20
- u !== void 0 && u >= 0 && /* @__PURE__ */ a("span", { className: n.sortIndex, children: u + 1 })
21
- ] });
16
+ var ee = "button, a, input, select, textarea, label, [role=\"button\"], [role=\"checkbox\"], [role=\"menuitem\"], [contenteditable]";
17
+ function te({ direction: t, sortIndex: n }) {
18
+ return /* @__PURE__ */ f("span", {
19
+ className: e.sortIndicator,
20
+ "aria-hidden": "true",
21
+ children: [
22
+ /* @__PURE__ */ d("span", {
23
+ className: u(e.sortArrow, t === "asc" && e.sortArrowActive),
24
+ children: "▲"
25
+ }),
26
+ /* @__PURE__ */ d("span", {
27
+ className: u(e.sortArrow, t === "desc" && e.sortArrowActive),
28
+ children: "▼"
29
+ }),
30
+ n !== void 0 && n >= 0 && /* @__PURE__ */ d("span", {
31
+ className: e.sortIndex,
32
+ children: n + 1
33
+ })
34
+ ]
35
+ });
22
36
  }
23
- function tt({
24
- page: s,
25
- pageSize: u,
26
- totalRows: K,
27
- pageSizeOptions: D = [10, 25, 50, 100],
28
- onPageChange: L,
29
- paginatorClasses: q
30
- }) {
31
- const p = Math.max(1, Math.ceil(K / u)), Z = (s - 1) * u + 1, z = Math.min(s * u, K), ee = H(() => {
32
- const i = [];
33
- if (p <= 7)
34
- for (let C = 1; C <= p; C++) i.push(C);
35
- else {
36
- i.push(1), s > 3 && i.push("ellipsis");
37
- for (let C = Math.max(2, s - 1); C <= Math.min(p - 1, s + 1); C++)
38
- i.push(C);
39
- s < p - 2 && i.push("ellipsis"), i.push(p);
40
- }
41
- return i;
42
- }, [s, p]);
43
- return /* @__PURE__ */ v("nav", { className: c(n.paginator, q?.paginator), "aria-label": "Table pagination", children: [
44
- /* @__PURE__ */ v("div", { className: n.paginatorInfo, children: [
45
- /* @__PURE__ */ a("span", { className: n.paginatorText, children: K > 0 ? `${Z}–${z} of ${K}` : "No results" }),
46
- D.length > 1 && /* @__PURE__ */ a(
47
- "select",
48
- {
49
- className: n.pageSizeSelect,
50
- value: u,
51
- onChange: (i) => L(1, Number(i.target.value)),
52
- "aria-label": "Rows per page",
53
- children: D.map((i) => /* @__PURE__ */ v("option", { value: i, children: [
54
- i,
55
- " / page"
56
- ] }, i))
57
- }
58
- )
59
- ] }),
60
- /* @__PURE__ */ v("div", { className: n.paginatorNav, children: [
61
- /* @__PURE__ */ a(
62
- "button",
63
- {
64
- type: "button",
65
- className: c(n.pageButton, q?.pageButton),
66
- disabled: s <= 1,
67
- onClick: () => L(s - 1, u),
68
- "aria-label": "Previous page",
69
- children: "‹"
70
- }
71
- ),
72
- ee.map(
73
- (i, C) => i === "ellipsis" ? /* @__PURE__ */ a("span", { className: n.pageEllipsis, children: "…" }, `ellipsis-${C}`) : /* @__PURE__ */ a(
74
- "button",
75
- {
76
- type: "button",
77
- className: c(n.pageButton, i === s && n.pageButtonActive, q?.pageButton),
78
- onClick: () => L(i, u),
79
- "aria-label": `Page ${i}`,
80
- "aria-current": i === s ? "page" : void 0,
81
- children: i
82
- },
83
- i
84
- )
85
- ),
86
- /* @__PURE__ */ a(
87
- "button",
88
- {
89
- type: "button",
90
- className: c(n.pageButton, q?.pageButton),
91
- disabled: s >= p,
92
- onClick: () => L(s + 1, u),
93
- "aria-label": "Next page",
94
- children: "›"
95
- }
96
- )
97
- ] })
98
- ] });
37
+ function ne({ page: t, pageSize: n, totalRows: r, pageSizeOptions: i = [
38
+ 10,
39
+ 25,
40
+ 50,
41
+ 100
42
+ ], onPageChange: a, paginatorClasses: o }) {
43
+ let c = Math.max(1, Math.ceil(r / n)), l = (t - 1) * n + 1, p = Math.min(t * n, r), m = s(() => {
44
+ let e = [];
45
+ if (c <= 7) for (let t = 1; t <= c; t++) e.push(t);
46
+ else {
47
+ e.push(1), t > 3 && e.push("ellipsis");
48
+ for (let n = Math.max(2, t - 1); n <= Math.min(c - 1, t + 1); n++) e.push(n);
49
+ t < c - 2 && e.push("ellipsis"), e.push(c);
50
+ }
51
+ return e;
52
+ }, [t, c]);
53
+ return /* @__PURE__ */ f("nav", {
54
+ className: u(e.paginator, o?.paginator),
55
+ "aria-label": "Table pagination",
56
+ children: [/* @__PURE__ */ f("div", {
57
+ className: e.paginatorInfo,
58
+ children: [/* @__PURE__ */ d("span", {
59
+ className: e.paginatorText,
60
+ children: r > 0 ? `${l}–${p} of ${r}` : "No results"
61
+ }), i.length > 1 && /* @__PURE__ */ d("select", {
62
+ className: e.pageSizeSelect,
63
+ value: n,
64
+ onChange: (e) => a(1, Number(e.target.value)),
65
+ "aria-label": "Rows per page",
66
+ children: i.map((e) => /* @__PURE__ */ f("option", {
67
+ value: e,
68
+ children: [e, " / page"]
69
+ }, e))
70
+ })]
71
+ }), /* @__PURE__ */ f("div", {
72
+ className: e.paginatorNav,
73
+ children: [
74
+ /* @__PURE__ */ d("button", {
75
+ type: "button",
76
+ className: u(e.pageButton, o?.pageButton),
77
+ disabled: t <= 1,
78
+ onClick: () => a(t - 1, n),
79
+ "aria-label": "Previous page",
80
+ children: "‹"
81
+ }),
82
+ m.map((r, i) => r === "ellipsis" ? /* @__PURE__ */ d("span", {
83
+ className: e.pageEllipsis,
84
+ children: "…"
85
+ }, `ellipsis-${i}`) : /* @__PURE__ */ d("button", {
86
+ type: "button",
87
+ className: u(e.pageButton, r === t && e.pageButtonActive, o?.pageButton),
88
+ onClick: () => a(r, n),
89
+ "aria-label": `Page ${r}`,
90
+ "aria-current": r === t ? "page" : void 0,
91
+ children: r
92
+ }, r)),
93
+ /* @__PURE__ */ d("button", {
94
+ type: "button",
95
+ className: u(e.pageButton, o?.pageButton),
96
+ disabled: t >= c,
97
+ onClick: () => a(t + 1, n),
98
+ "aria-label": "Next page",
99
+ children: "›"
100
+ })
101
+ ]
102
+ })]
103
+ });
99
104
  }
100
- function nt({
101
- data: s,
102
- columns: u,
103
- sortConfig: K,
104
- onSort: D,
105
- multiSort: L = !0,
106
- scrollable: q = !1,
107
- dragScroll: p = !1,
108
- striped: Z = !1,
109
- hoverable: z = !1,
110
- compact: ee = !1,
111
- className: i,
112
- style: C,
113
- rowKey: R,
114
- rowClassName: te,
115
- rowStyle: ne,
116
- emptyMessage: xe = "No data",
117
- pagination: A,
118
- loading: O = !1,
119
- loadingRows: Ie = 3,
120
- onRowClick: N,
121
- selectable: m = !1,
122
- selectedKeys: ue,
123
- defaultSelectedKeys: Me,
124
- onSelectionChange: re,
125
- isRowSelectable: le,
126
- bulkActions: F,
127
- selectionLabel: fe,
128
- columnVisibility: ae,
129
- layout: De = "auto",
130
- classes: o
131
- }) {
132
- const W = D !== void 0, Te = q || p, U = H(
133
- () => ae ? u.filter((e) => ae[P(e)] !== !1) : u,
134
- [u, ae]
135
- ), {
136
- sortedData: Ae,
137
- sortConfig: Be,
138
- requestSort: he,
139
- requestMultiSort: pe
140
- } = Qe(s, K), I = W ? K ?? [] : Be, T = W ? s : Ae, B = H(() => {
141
- if (!A || W) return T;
142
- const e = (A.page - 1) * A.pageSize;
143
- return T.slice(e, e + A.pageSize);
144
- }, [T, A, W]), we = A?.totalRows ?? T.length, M = y(
145
- (e, t) => {
146
- if (!R) return t;
147
- const r = e[R];
148
- return typeof r == "number" ? r : String(r);
149
- },
150
- [R]
151
- );
152
- Je(() => {
153
- m && !R && console.error(
154
- "Table: `selectable` needs `rowKey` so selections survive sorting and paging; falling back to the row index."
155
- );
156
- }, [m, R]);
157
- const [Ee, Pe] = Se(
158
- () => Me ?? []
159
- ), se = ue !== void 0, d = se ? ue : Ee, G = H(() => new Set(d), [d]), ie = V(null), w = y(
160
- (e) => {
161
- if (se || Pe(e), re) {
162
- const t = new Set(e);
163
- re(
164
- e,
165
- T.filter((r, f) => t.has(M(r, f)))
166
- );
167
- }
168
- },
169
- [se, re, T, M]
170
- ), j = y(
171
- (e) => le ? le(e) !== !1 : !0,
172
- [le]
173
- ), $ = H(
174
- () => {
175
- if (!m) return [];
176
- const e = [];
177
- return B.forEach((t, r) => {
178
- j(t) && e.push(M(t, r));
179
- }), e;
180
- },
181
- [m, B, j, M]
182
- ), me = $.filter((e) => G.has(e)).length, J = $.length > 0 && me === $.length, Ke = me > 0 && !J, Le = y(() => {
183
- if (J) {
184
- const e = new Set($);
185
- w(d.filter((t) => !e.has(t)));
186
- } else {
187
- const e = [...d], t = new Set(d);
188
- for (const r of $) t.has(r) || e.push(r);
189
- w(e);
190
- }
191
- }, [J, $, d, w]), Re = y(
192
- (e, t, r) => {
193
- const f = M(e, t), g = r.target.checked, S = r.nativeEvent.shiftKey === !0;
194
- let b = [f];
195
- if (S && ie.current !== null) {
196
- const h = B.map((E, de) => M(E, de)), k = h.indexOf(ie.current), x = h.indexOf(f);
197
- if (k >= 0 && x >= 0) {
198
- const [E, de] = k < x ? [k, x] : [x, k];
199
- b = [];
200
- for (let Y = E; Y <= de; Y++)
201
- j(B[Y]) && b.push(h[Y]);
202
- }
203
- }
204
- ie.current = f;
205
- const l = new Set(b);
206
- if (g) {
207
- const h = new Set(d), k = [...d];
208
- for (const x of b) h.has(x) || k.push(x);
209
- w(k);
210
- } else
211
- w(d.filter((h) => !l.has(h)));
212
- },
213
- [M, B, j, d, w]
214
- ), ge = y(() => w([]), [w]), $e = H(
215
- () => m && d.length ? T.filter((e, t) => G.has(M(e, t))) : [],
216
- [m, d.length, T, G, M]
217
- ), qe = y(
218
- (e, t, r) => {
219
- if (!N) return;
220
- const g = r.target?.closest?.(ze);
221
- g && g !== r.currentTarget && r.currentTarget.contains(g) || N(e, t, r);
222
- },
223
- [N]
224
- ), Oe = y(
225
- (e, t, r) => {
226
- !N || r.target !== r.currentTarget || (r.key === "Enter" || r.key === " ") && (r.preventDefault(), N(e, t, r));
227
- },
228
- [N]
229
- ), We = y(
230
- (e, t, r) => {
231
- const f = L && (t.ctrlKey || t.metaKey || t.shiftKey), g = r === "asc" ? "desc" : "asc";
232
- if (W)
233
- if (f) {
234
- const S = I.findIndex((l) => l.key === e);
235
- let b;
236
- S === -1 ? b = [...I, { key: e, direction: r }] : I[S].direction === r ? b = I.map(
237
- (l, h) => h === S ? { key: e, direction: g } : l
238
- ) : b = I.filter((l, h) => h !== S), D(b);
239
- } else {
240
- const S = I.find((b) => b.key === e);
241
- S ? S.direction === r ? D([{ key: e, direction: g }]) : D([]) : D([{ key: e, direction: r }]);
242
- }
243
- else
244
- f ? pe(e, r) : he(e, r);
245
- },
246
- [
247
- W,
248
- L,
249
- I,
250
- D,
251
- he,
252
- pe
253
- ]
254
- ), oe = V(null), X = V(null), Q = V(!1), [Xe, be] = Se(!1), He = y((e) => {
255
- const t = oe.current;
256
- t && (Q.current = !1, !(e.button !== 1 && e.button !== 2) && (t.scrollWidth <= t.clientWidth || (e.button === 1 && e.preventDefault(), X.current = {
257
- pointerId: e.pointerId,
258
- button: e.button,
259
- startX: e.clientX,
260
- startScrollLeft: t.scrollLeft,
261
- downAt: performance.now(),
262
- dragging: !1
263
- })));
264
- }, []), _e = y((e) => {
265
- const t = X.current, r = oe.current;
266
- if (!t || !r || e.pointerId !== t.pointerId) return;
267
- const f = e.clientX - t.startX;
268
- if (!t.dragging) {
269
- if (t.button === 2 && performance.now() - t.downAt > 200) {
270
- X.current = null;
271
- return;
272
- }
273
- if (Math.abs(f) < 5) return;
274
- t.dragging = !0, be(!0);
275
- try {
276
- r.setPointerCapture(t.pointerId);
277
- } catch {
278
- }
279
- }
280
- r.scrollLeft = t.startScrollLeft - f;
281
- }, []), ye = y((e) => {
282
- const t = X.current;
283
- !t || e.pointerId !== t.pointerId || (X.current = null, t.dragging && (t.button === 2 && (Q.current = !0), be(!1)));
284
- }, []), je = y((e) => {
285
- (X.current?.dragging || Q.current) && (Q.current = !1, e.preventDefault());
286
- }, []), ce = (e) => I.find((r) => r.key === e)?.direction, Ve = (e) => {
287
- if (I.length <= 1) return;
288
- const t = I.findIndex((r) => r.key === e);
289
- return t >= 0 ? t : void 0;
290
- }, ve = V(!1);
291
- O && (ve.current = !0);
292
- const Fe = U.length + (m ? 1 : 0), Ce = O && B.length === 0, Ue = m && d.length > 0, Ne = /* @__PURE__ */ v(
293
- "table",
294
- {
295
- className: c(
296
- n.root,
297
- Z && n.striped,
298
- z && n.hoverable,
299
- ee && n.compact,
300
- De === "fixed" && n.layoutFixed,
301
- o?.root,
302
- i
303
- ),
304
- style: C,
305
- "aria-busy": O || void 0,
306
- children: [
307
- /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ v("tr", { children: [
308
- m && /* @__PURE__ */ a(
309
- "th",
310
- {
311
- className: c(n.headerCell, n.selectHeaderCell, o?.headerCell, o?.selectHeaderCell),
312
- children: /* @__PURE__ */ a(
313
- ke,
314
- {
315
- "aria-label": "Select all",
316
- checked: J,
317
- indeterminate: Ke,
318
- disabled: $.length === 0,
319
- onChange: Le
320
- }
321
- )
322
- }
323
- ),
324
- U.map((e) => /* @__PURE__ */ v(
325
- "th",
326
- {
327
- className: c(
328
- n.headerCell,
329
- _(e) && e.sortable && n.headerCellSortable,
330
- e.sticky && n.headerCellSticky,
331
- o?.headerCell
332
- ),
333
- style: {
334
- width: e.width,
335
- textAlign: e.align
336
- },
337
- onClick: _(e) && e.sortable ? (t) => We(e.key, t, e.defaultSortDirection ?? "asc") : void 0,
338
- "aria-sort": _(e) && e.sortable ? ce(P(e)) === "asc" ? "ascending" : ce(P(e)) === "desc" ? "descending" : "none" : void 0,
339
- children: [
340
- e.header,
341
- _(e) && e.sortable && /* @__PURE__ */ a(
342
- et,
343
- {
344
- direction: ce(P(e)),
345
- sortIndex: Ve(P(e))
346
- }
347
- )
348
- ]
349
- },
350
- P(e)
351
- ))
352
- ] }) }),
353
- /* @__PURE__ */ a("tbody", { children: Ce ? Array.from({ length: Math.max(1, Ie) }, (e, t) => /* @__PURE__ */ v("tr", { className: c(n.row, n.loadingRow, o?.row, o?.loadingRow), "aria-hidden": "true", children: [
354
- m && /* @__PURE__ */ a("td", { className: c(n.cell, n.selectCell, o?.cell) }),
355
- U.map((r) => /* @__PURE__ */ a("td", { className: c(n.cell, o?.cell), children: /* @__PURE__ */ a(Ze, { variant: "text" }) }, P(r)))
356
- ] }, `loading-${t}`)) : B.length === 0 ? /* @__PURE__ */ a("tr", { className: n.emptyRow, children: /* @__PURE__ */ a("td", { className: c(n.emptyCell, o?.emptyCell), colSpan: Fe, children: xe }) }) : B.map((e, t) => {
357
- const r = R ? String(e[R]) : t, f = m ? M(e, t) : null, g = f !== null && G.has(f), S = typeof te == "function" ? te(e, t) : te, b = typeof ne == "function" ? ne(e, t) : ne;
358
- return /* @__PURE__ */ v(
359
- "tr",
360
- {
361
- className: c(
362
- n.row,
363
- N && n.rowClickable,
364
- g && n.rowSelected,
365
- o?.row,
366
- N && o?.rowClickable,
367
- g && o?.rowSelected,
368
- S
369
- ),
370
- style: b,
371
- tabIndex: N ? 0 : void 0,
372
- onClick: N ? (l) => qe(e, t, l) : void 0,
373
- onKeyDown: N ? (l) => Oe(e, t, l) : void 0,
374
- "aria-selected": m ? g : void 0,
375
- children: [
376
- m && /* @__PURE__ */ a("td", { className: c(n.cell, n.selectCell, o?.cell, o?.selectCell), children: /* @__PURE__ */ a(
377
- ke,
378
- {
379
- "aria-label": "Select row",
380
- checked: g,
381
- disabled: !j(e),
382
- onChange: (l) => Re(e, t, l)
383
- }
384
- ) }),
385
- U.map((l) => {
386
- let h, k, x;
387
- if (_(l)) {
388
- const E = e[l.key];
389
- k = typeof l.cellClassName == "function" ? l.cellClassName(E, e, t) : l.cellClassName, x = typeof l.cellStyle == "function" ? l.cellStyle(E, e, t) : l.cellStyle, h = l.render ? l.render(E, e, t) : E;
390
- } else
391
- k = typeof l.cellClassName == "function" ? l.cellClassName(e, t) : l.cellClassName, x = typeof l.cellStyle == "function" ? l.cellStyle(e, t) : l.cellStyle, h = l.render(e, t);
392
- return /* @__PURE__ */ a(
393
- "td",
394
- {
395
- className: c(
396
- n.cell,
397
- l.sticky && n.cellSticky,
398
- o?.cell,
399
- k
400
- ),
401
- style: { textAlign: l.align, ...x },
402
- children: h
403
- },
404
- P(l)
405
- );
406
- })
407
- ]
408
- },
409
- r
410
- );
411
- }) })
412
- ]
413
- }
414
- ), Ge = { selectedKeys: d, selectedRows: $e, clear: ge };
415
- return /* @__PURE__ */ v(
416
- "div",
417
- {
418
- ref: oe,
419
- className: c(
420
- n.wrapper,
421
- Te && n.scrollable,
422
- Xe && n.dragging,
423
- o?.wrapper
424
- ),
425
- onPointerDown: p ? He : void 0,
426
- onPointerMove: p ? _e : void 0,
427
- onPointerUp: p ? ye : void 0,
428
- onPointerCancel: p ? ye : void 0,
429
- onContextMenu: p ? je : void 0,
430
- children: [
431
- Ue && /* @__PURE__ */ v("div", { className: c(n.bulkBar, o?.bulkBar), role: "region", "aria-label": "Selected rows", children: [
432
- /* @__PURE__ */ a("span", { className: c(n.bulkLabel, o?.bulkLabel), children: fe ? fe(d.length) : `${d.length} selected` }),
433
- /* @__PURE__ */ a("button", { type: "button", className: c(n.bulkClear, o?.bulkClear), onClick: ge, children: "Clear" }),
434
- F !== void 0 && /* @__PURE__ */ a("div", { className: c(n.bulkActions, o?.bulkActions), children: typeof F == "function" ? F(Ge) : F })
435
- ] }),
436
- O !== void 0 && (O || ve.current) ? (
437
- // Once a consumer has used `loading`, keep the wrapper so toggling it
438
- // doesn't remount the table (focus, scroll position).
439
- /* @__PURE__ */ a(Ye, { loading: O && !Ce, delay: 150, backdrop: "dim", classes: { root: n.loaderWrap }, children: Ne })
440
- ) : Ne,
441
- A && /* @__PURE__ */ a(
442
- tt,
443
- {
444
- ...A,
445
- totalRows: we,
446
- paginatorClasses: { paginator: o?.paginator, pageButton: o?.pageButton }
447
- }
448
- )
449
- ]
450
- }
451
- );
105
+ function h({ data: h, columns: g, sortConfig: _, onSort: v, multiSort: y = !0, scrollable: re = !1, dragScroll: b = !1, striped: ie = !1, hoverable: ae = !1, compact: oe = !1, className: se, style: ce, rowKey: x, rowClassName: S, rowStyle: C, emptyMessage: le = "No data", pagination: w, loading: T = !1, loadingRows: ue = 3, onRowClick: E, selectable: D = !1, selectedKeys: O, defaultSelectedKeys: de, onSelectionChange: k, isRowSelectable: A, bulkActions: j, selectionLabel: fe, columnVisibility: M, layout: pe = "auto", classes: N }) {
106
+ let P = v !== void 0, me = re || b, F = s(() => M ? g.filter((e) => M[m(e)] !== !1) : g, [g, M]), { sortedData: he, sortConfig: ge, requestSort: _e, requestMultiSort: ve } = t(h, _), I = P ? _ ?? [] : ge, L = P ? h : he, R = s(() => {
107
+ if (!w || P) return L;
108
+ let e = (w.page - 1) * w.pageSize;
109
+ return L.slice(e, e + w.pageSize);
110
+ }, [
111
+ L,
112
+ w,
113
+ P
114
+ ]), ye = w?.totalRows ?? L.length, z = a((e, t) => {
115
+ if (!x) return t;
116
+ let n = e[x];
117
+ return typeof n == "number" ? n : String(n);
118
+ }, [x]);
119
+ o(() => {
120
+ D && !x && console.error("Table: `selectable` needs `rowKey` so selections survive sorting and paging; falling back to the row index.");
121
+ }, [D, x]);
122
+ let [be, xe] = l(() => de ?? []), B = O !== void 0, V = B ? O : be, H = s(() => new Set(V), [V]), U = c(null), W = a((e) => {
123
+ if (B || xe(e), k) {
124
+ let t = new Set(e);
125
+ k(e, L.filter((e, n) => t.has(z(e, n))));
126
+ }
127
+ }, [
128
+ B,
129
+ k,
130
+ L,
131
+ z
132
+ ]), G = a((e) => !A || A(e) !== !1, [A]), K = s(() => {
133
+ if (!D) return [];
134
+ let e = [];
135
+ return R.forEach((t, n) => {
136
+ G(t) && e.push(z(t, n));
137
+ }), e;
138
+ }, [
139
+ D,
140
+ R,
141
+ G,
142
+ z
143
+ ]), q = K.filter((e) => H.has(e)).length, J = K.length > 0 && q === K.length, Se = q > 0 && !J, Ce = a(() => {
144
+ if (J) {
145
+ let e = new Set(K);
146
+ W(V.filter((t) => !e.has(t)));
147
+ } else {
148
+ let e = [...V], t = new Set(V);
149
+ for (let n of K) t.has(n) || e.push(n);
150
+ W(e);
151
+ }
152
+ }, [
153
+ J,
154
+ K,
155
+ V,
156
+ W
157
+ ]), we = a((e, t, n) => {
158
+ let r = z(e, t), i = n.target.checked, a = n.nativeEvent.shiftKey === !0, o = [r];
159
+ if (a && U.current !== null) {
160
+ let e = R.map((e, t) => z(e, t)), t = e.indexOf(U.current), n = e.indexOf(r);
161
+ if (t >= 0 && n >= 0) {
162
+ let [r, i] = t < n ? [t, n] : [n, t];
163
+ o = [];
164
+ for (let t = r; t <= i; t++) G(R[t]) && o.push(e[t]);
165
+ }
166
+ }
167
+ U.current = r;
168
+ let s = new Set(o);
169
+ if (i) {
170
+ let e = new Set(V), t = [...V];
171
+ for (let n of o) e.has(n) || t.push(n);
172
+ W(t);
173
+ } else W(V.filter((e) => !s.has(e)));
174
+ }, [
175
+ z,
176
+ R,
177
+ G,
178
+ V,
179
+ W
180
+ ]), Y = a(() => W([]), [W]), Te = s(() => D && V.length ? L.filter((e, t) => H.has(z(e, t))) : [], [
181
+ D,
182
+ V.length,
183
+ L,
184
+ H,
185
+ z
186
+ ]), Ee = a((e, t, n) => {
187
+ if (!E) return;
188
+ let r = n.target?.closest?.(ee);
189
+ r && r !== n.currentTarget && n.currentTarget.contains(r) || E(e, t, n);
190
+ }, [E]), De = a((e, t, n) => {
191
+ E && n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), E(e, t, n));
192
+ }, [E]), Oe = a((e, t, n) => {
193
+ let r = y && (t.ctrlKey || t.metaKey || t.shiftKey), i = n === "asc" ? "desc" : "asc";
194
+ if (P) {
195
+ if (r) {
196
+ let t = I.findIndex((t) => t.key === e), r;
197
+ r = t === -1 ? [...I, {
198
+ key: e,
199
+ direction: n
200
+ }] : I[t].direction === n ? I.map((n, r) => r === t ? {
201
+ key: e,
202
+ direction: i
203
+ } : n) : I.filter((e, n) => n !== t), v(r);
204
+ } else {
205
+ let t = I.find((t) => t.key === e);
206
+ t ? t.direction === n ? v([{
207
+ key: e,
208
+ direction: i
209
+ }]) : v([]) : v([{
210
+ key: e,
211
+ direction: n
212
+ }]);
213
+ }
214
+ } else r ? ve(e, n) : _e(e, n);
215
+ }, [
216
+ P,
217
+ y,
218
+ I,
219
+ v,
220
+ _e,
221
+ ve
222
+ ]), X = c(null), Z = c(null), Q = c(!1), [ke, Ae] = l(!1), je = a((e) => {
223
+ let t = X.current;
224
+ t && (Q.current = !1, e.button !== 1 && e.button !== 2 || t.scrollWidth <= t.clientWidth || (e.button === 1 && e.preventDefault(), Z.current = {
225
+ pointerId: e.pointerId,
226
+ button: e.button,
227
+ startX: e.clientX,
228
+ startScrollLeft: t.scrollLeft,
229
+ downAt: performance.now(),
230
+ dragging: !1
231
+ }));
232
+ }, []), Me = a((e) => {
233
+ let t = Z.current, n = X.current;
234
+ if (!t || !n || e.pointerId !== t.pointerId) return;
235
+ let r = e.clientX - t.startX;
236
+ if (!t.dragging) {
237
+ if (t.button === 2 && performance.now() - t.downAt > 200) {
238
+ Z.current = null;
239
+ return;
240
+ }
241
+ if (Math.abs(r) < 5) return;
242
+ t.dragging = !0, Ae(!0);
243
+ try {
244
+ n.setPointerCapture(t.pointerId);
245
+ } catch {}
246
+ }
247
+ n.scrollLeft = t.startScrollLeft - r;
248
+ }, []), Ne = a((e) => {
249
+ let t = Z.current;
250
+ t && e.pointerId === t.pointerId && (Z.current = null, t.dragging && (t.button === 2 && (Q.current = !0), Ae(!1)));
251
+ }, []), Pe = a((e) => {
252
+ (Z.current?.dragging || Q.current) && (Q.current = !1, e.preventDefault());
253
+ }, []), $ = (e) => I.find((t) => t.key === e)?.direction, Fe = (e) => {
254
+ if (I.length <= 1) return;
255
+ let t = I.findIndex((t) => t.key === e);
256
+ return t >= 0 ? t : void 0;
257
+ }, Ie = c(!1);
258
+ T && (Ie.current = !0);
259
+ let Le = F.length + +!!D, Re = T && R.length === 0, ze = D && V.length > 0, Be = /* @__PURE__ */ f("table", {
260
+ className: u(e.root, ie && e.striped, ae && e.hoverable, oe && e.compact, pe === "fixed" && e.layoutFixed, N?.root, se),
261
+ style: ce,
262
+ "aria-busy": T || void 0,
263
+ children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [D && /* @__PURE__ */ d("th", {
264
+ className: u(e.headerCell, e.selectHeaderCell, N?.headerCell, N?.selectHeaderCell),
265
+ children: /* @__PURE__ */ d(i, {
266
+ "aria-label": "Select all",
267
+ checked: J,
268
+ indeterminate: Se,
269
+ disabled: K.length === 0,
270
+ onChange: Ce
271
+ })
272
+ }), F.map((t) => /* @__PURE__ */ f("th", {
273
+ className: u(e.headerCell, p(t) && t.sortable && e.headerCellSortable, t.sticky && e.headerCellSticky, N?.headerCell),
274
+ style: {
275
+ width: t.width,
276
+ textAlign: t.align
277
+ },
278
+ onClick: p(t) && t.sortable ? (e) => Oe(t.key, e, t.defaultSortDirection ?? "asc") : void 0,
279
+ "aria-sort": p(t) && t.sortable ? $(m(t)) === "asc" ? "ascending" : $(m(t)) === "desc" ? "descending" : "none" : void 0,
280
+ children: [t.header, p(t) && t.sortable && /* @__PURE__ */ d(te, {
281
+ direction: $(m(t)),
282
+ sortIndex: Fe(m(t))
283
+ })]
284
+ }, m(t)))] }) }), /* @__PURE__ */ d("tbody", { children: Re ? Array.from({ length: Math.max(1, ue) }, (t, n) => /* @__PURE__ */ f("tr", {
285
+ className: u(e.row, e.loadingRow, N?.row, N?.loadingRow),
286
+ "aria-hidden": "true",
287
+ children: [D && /* @__PURE__ */ d("td", { className: u(e.cell, e.selectCell, N?.cell) }), F.map((t) => /* @__PURE__ */ d("td", {
288
+ className: u(e.cell, N?.cell),
289
+ children: /* @__PURE__ */ d(r, { variant: "text" })
290
+ }, m(t)))]
291
+ }, `loading-${n}`)) : R.length === 0 ? /* @__PURE__ */ d("tr", {
292
+ className: e.emptyRow,
293
+ children: /* @__PURE__ */ d("td", {
294
+ className: u(e.emptyCell, N?.emptyCell),
295
+ colSpan: Le,
296
+ children: le
297
+ })
298
+ }) : R.map((t, n) => {
299
+ let r = x ? String(t[x]) : n, a = D ? z(t, n) : null, o = a !== null && H.has(a), s = typeof S == "function" ? S(t, n) : S, c = typeof C == "function" ? C(t, n) : C;
300
+ return /* @__PURE__ */ f("tr", {
301
+ className: u(e.row, E && e.rowClickable, o && e.rowSelected, N?.row, E && N?.rowClickable, o && N?.rowSelected, s),
302
+ style: c,
303
+ tabIndex: E ? 0 : void 0,
304
+ onClick: E ? (e) => Ee(t, n, e) : void 0,
305
+ onKeyDown: E ? (e) => De(t, n, e) : void 0,
306
+ "aria-selected": D ? o : void 0,
307
+ children: [D && /* @__PURE__ */ d("td", {
308
+ className: u(e.cell, e.selectCell, N?.cell, N?.selectCell),
309
+ children: /* @__PURE__ */ d(i, {
310
+ "aria-label": "Select row",
311
+ checked: o,
312
+ disabled: !G(t),
313
+ onChange: (e) => we(t, n, e)
314
+ })
315
+ }), F.map((r) => {
316
+ let i, a, o;
317
+ if (p(r)) {
318
+ let e = t[r.key];
319
+ a = typeof r.cellClassName == "function" ? r.cellClassName(e, t, n) : r.cellClassName, o = typeof r.cellStyle == "function" ? r.cellStyle(e, t, n) : r.cellStyle, i = r.render ? r.render(e, t, n) : e;
320
+ } else a = typeof r.cellClassName == "function" ? r.cellClassName(t, n) : r.cellClassName, o = typeof r.cellStyle == "function" ? r.cellStyle(t, n) : r.cellStyle, i = r.render(t, n);
321
+ return /* @__PURE__ */ d("td", {
322
+ className: u(e.cell, r.sticky && e.cellSticky, N?.cell, a),
323
+ style: {
324
+ textAlign: r.align,
325
+ ...o
326
+ },
327
+ children: i
328
+ }, m(r));
329
+ })]
330
+ }, r);
331
+ }) })]
332
+ }), Ve = {
333
+ selectedKeys: V,
334
+ selectedRows: Te,
335
+ clear: Y
336
+ };
337
+ return /* @__PURE__ */ f("div", {
338
+ ref: X,
339
+ className: u(e.wrapper, me && e.scrollable, ke && e.dragging, N?.wrapper),
340
+ onPointerDown: b ? je : void 0,
341
+ onPointerMove: b ? Me : void 0,
342
+ onPointerUp: b ? Ne : void 0,
343
+ onPointerCancel: b ? Ne : void 0,
344
+ onContextMenu: b ? Pe : void 0,
345
+ children: [
346
+ ze && /* @__PURE__ */ f("div", {
347
+ className: u(e.bulkBar, N?.bulkBar),
348
+ role: "region",
349
+ "aria-label": "Selected rows",
350
+ children: [
351
+ /* @__PURE__ */ d("span", {
352
+ className: u(e.bulkLabel, N?.bulkLabel),
353
+ children: fe ? fe(V.length) : `${V.length} selected`
354
+ }),
355
+ /* @__PURE__ */ d("button", {
356
+ type: "button",
357
+ className: u(e.bulkClear, N?.bulkClear),
358
+ onClick: Y,
359
+ children: "Clear"
360
+ }),
361
+ j !== void 0 && /* @__PURE__ */ d("div", {
362
+ className: u(e.bulkActions, N?.bulkActions),
363
+ children: typeof j == "function" ? j(Ve) : j
364
+ })
365
+ ]
366
+ }),
367
+ T !== void 0 && (T || Ie.current) ? /* @__PURE__ */ d(n, {
368
+ loading: T && !Re,
369
+ delay: 150,
370
+ backdrop: "dim",
371
+ classes: { root: e.loaderWrap },
372
+ children: Be
373
+ }) : Be,
374
+ w && /* @__PURE__ */ d(ne, {
375
+ ...w,
376
+ totalRows: ye,
377
+ paginatorClasses: {
378
+ paginator: N?.paginator,
379
+ pageButton: N?.pageButton
380
+ }
381
+ })
382
+ ]
383
+ });
452
384
  }
453
- const ut = nt;
454
- export {
455
- ut as Table
456
- };
385
+ var g = h;
386
+ export { g as Table };