@bysages/react 0.2.2 → 0.3.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 (293) hide show
  1. package/README.md +16 -2
  2. package/dist/ai-response-jZy-0Tvv.mjs +127 -0
  3. package/dist/chevron-BeHvt46K.mjs +17 -0
  4. package/dist/components/accordion/index.d.mts +7 -0
  5. package/dist/components/accordion/index.mjs +10 -0
  6. package/dist/components/affix/index.d.mts +20 -0
  7. package/dist/components/affix/index.mjs +18 -0
  8. package/dist/components/ai/index.d.mts +2 -0
  9. package/dist/components/ai/index.mjs +65 -0
  10. package/dist/components/ai-action/index.d.mts +14 -0
  11. package/dist/components/ai-action/index.mjs +18 -0
  12. package/dist/components/ai-attachments/index.d.mts +19 -0
  13. package/dist/components/ai-attachments/index.mjs +106 -0
  14. package/dist/components/ai-message/index.d.mts +11 -0
  15. package/dist/components/ai-message/index.mjs +15 -0
  16. package/dist/components/ai-prompt-input/index.d.mts +47 -0
  17. package/dist/components/ai-prompt-input/index.mjs +135 -0
  18. package/dist/components/ai-reasoning/index.d.mts +13 -0
  19. package/dist/components/ai-reasoning/index.mjs +19 -0
  20. package/dist/components/ai-response/index.d.mts +22 -0
  21. package/dist/components/ai-response/index.mjs +2 -0
  22. package/dist/components/ai-source/index.d.mts +17 -0
  23. package/dist/components/ai-source/index.mjs +27 -0
  24. package/dist/components/ai-suggestion/index.d.mts +13 -0
  25. package/dist/components/ai-suggestion/index.mjs +16 -0
  26. package/dist/components/ai-tool/index.d.mts +21 -0
  27. package/dist/components/ai-tool/index.mjs +36 -0
  28. package/dist/components/alert/index.d.mts +23 -0
  29. package/dist/components/alert/index.mjs +80 -0
  30. package/dist/components/angle-slider/index.d.mts +16 -0
  31. package/dist/components/angle-slider/index.mjs +21 -0
  32. package/dist/components/aspect-ratio/index.d.mts +10 -0
  33. package/dist/components/aspect-ratio/index.mjs +17 -0
  34. package/dist/components/autocomplete/index.d.mts +21 -0
  35. package/dist/components/autocomplete/index.mjs +35 -0
  36. package/dist/components/avatar/index.d.mts +23 -0
  37. package/dist/components/avatar/index.mjs +15 -0
  38. package/dist/components/avatar-group/index.d.mts +11 -0
  39. package/dist/components/avatar-group/index.mjs +15 -0
  40. package/dist/components/back-top/index.d.mts +29 -0
  41. package/dist/components/back-top/index.mjs +82 -0
  42. package/dist/components/badge/index.d.mts +10 -0
  43. package/dist/components/badge/index.mjs +15 -0
  44. package/dist/components/banner/index.d.mts +31 -0
  45. package/dist/components/banner/index.mjs +63 -0
  46. package/dist/components/bento/index.d.mts +26 -0
  47. package/dist/components/bento/index.mjs +41 -0
  48. package/dist/components/block-ui/index.d.mts +12 -0
  49. package/dist/components/block-ui/index.mjs +24 -0
  50. package/dist/components/breadcrumb/index.d.mts +32 -0
  51. package/dist/components/breadcrumb/index.mjs +35 -0
  52. package/dist/components/browser/index.d.mts +23 -0
  53. package/dist/components/browser/index.mjs +70 -0
  54. package/dist/components/button/index.d.mts +19 -0
  55. package/dist/components/button/index.mjs +29 -0
  56. package/dist/components/button-group/index.d.mts +24 -0
  57. package/dist/components/button-group/index.mjs +25 -0
  58. package/dist/components/calendar/index.d.mts +17 -0
  59. package/dist/components/calendar/index.mjs +96 -0
  60. package/dist/components/card/index.d.mts +46 -0
  61. package/dist/components/card/index.mjs +44 -0
  62. package/dist/components/carousel/index.d.mts +9 -0
  63. package/dist/components/carousel/index.mjs +12 -0
  64. package/dist/components/cascade-select/index.d.mts +31 -0
  65. package/dist/components/cascade-select/index.mjs +229 -0
  66. package/dist/components/checkbox/index.d.mts +16 -0
  67. package/dist/components/checkbox/index.mjs +21 -0
  68. package/dist/components/checkbox-group/index.d.mts +28 -0
  69. package/dist/components/checkbox-group/index.mjs +65 -0
  70. package/dist/components/chip/index.d.mts +12 -0
  71. package/dist/components/chip/index.mjs +17 -0
  72. package/dist/components/client-only/index.d.mts +2 -0
  73. package/dist/components/client-only/index.mjs +2 -0
  74. package/dist/components/clipboard/index.d.mts +17 -0
  75. package/dist/components/clipboard/index.mjs +17 -0
  76. package/dist/components/collapsible/index.d.mts +7 -0
  77. package/dist/components/collapsible/index.mjs +10 -0
  78. package/dist/components/collection/index.d.mts +2 -0
  79. package/dist/components/collection/index.mjs +2 -0
  80. package/dist/components/color-picker/index.d.mts +20 -0
  81. package/dist/components/color-picker/index.mjs +25 -0
  82. package/dist/components/combobox/index.d.mts +17 -0
  83. package/dist/components/combobox/index.mjs +18 -0
  84. package/dist/components/command/index.d.mts +43 -0
  85. package/dist/components/command/index.mjs +137 -0
  86. package/dist/components/comment/index.d.mts +17 -0
  87. package/dist/components/comment/index.mjs +47 -0
  88. package/dist/components/config-provider/index.d.mts +46 -0
  89. package/dist/components/config-provider/index.mjs +41 -0
  90. package/dist/components/container/index.d.mts +13 -0
  91. package/dist/components/container/index.mjs +15 -0
  92. package/dist/components/data-view/index.d.mts +18 -0
  93. package/dist/components/data-view/index.mjs +64 -0
  94. package/dist/components/date-input/index.d.mts +17 -0
  95. package/dist/components/date-input/index.mjs +21 -0
  96. package/dist/components/date-picker/index.d.mts +19 -0
  97. package/dist/components/date-picker/index.mjs +23 -0
  98. package/dist/components/deferred-content/index.d.mts +16 -0
  99. package/dist/components/deferred-content/index.mjs +34 -0
  100. package/dist/components/descriptions/index.d.mts +33 -0
  101. package/dist/components/descriptions/index.mjs +50 -0
  102. package/dist/components/dialog/index.d.mts +9 -0
  103. package/dist/components/dialog/index.mjs +11 -0
  104. package/dist/components/dock/index.d.mts +25 -0
  105. package/dist/components/dock/index.mjs +51 -0
  106. package/dist/components/download-trigger/index.d.mts +2 -0
  107. package/dist/components/download-trigger/index.mjs +2 -0
  108. package/dist/components/drawer/index.d.mts +9 -0
  109. package/dist/components/drawer/index.mjs +12 -0
  110. package/dist/components/dynamic-input/index.d.mts +28 -0
  111. package/dist/components/dynamic-input/index.mjs +83 -0
  112. package/dist/components/editable/index.d.mts +16 -0
  113. package/dist/components/editable/index.mjs +17 -0
  114. package/dist/components/ellipsis/index.d.mts +10 -0
  115. package/dist/components/ellipsis/index.mjs +19 -0
  116. package/dist/components/empty/index.d.mts +28 -0
  117. package/dist/components/empty/index.mjs +32 -0
  118. package/dist/components/field/index.d.mts +8 -0
  119. package/dist/components/field/index.mjs +11 -0
  120. package/dist/components/fieldset/index.d.mts +7 -0
  121. package/dist/components/fieldset/index.mjs +10 -0
  122. package/dist/components/file-upload/index.d.mts +18 -0
  123. package/dist/components/file-upload/index.mjs +23 -0
  124. package/dist/components/float-button/index.d.mts +59 -0
  125. package/dist/components/float-button/index.mjs +90 -0
  126. package/dist/components/floating-panel/index.d.mts +9 -0
  127. package/dist/components/floating-panel/index.mjs +12 -0
  128. package/dist/components/focus-trap/index.d.mts +2 -0
  129. package/dist/components/focus-trap/index.mjs +2 -0
  130. package/dist/components/form/index.d.mts +2 -0
  131. package/dist/components/form/index.mjs +67 -0
  132. package/dist/components/format/index.d.mts +9 -0
  133. package/dist/components/format/index.mjs +10 -0
  134. package/dist/components/frame/index.d.mts +10 -0
  135. package/dist/components/frame/index.mjs +12 -0
  136. package/dist/components/grid/index.d.mts +13 -0
  137. package/dist/components/grid/index.mjs +31 -0
  138. package/dist/components/highlight/index.d.mts +7 -0
  139. package/dist/components/highlight/index.mjs +11 -0
  140. package/dist/components/hover-card/index.d.mts +7 -0
  141. package/dist/components/hover-card/index.mjs +10 -0
  142. package/dist/components/icon/index.d.mts +24 -0
  143. package/dist/components/icon/index.mjs +26 -0
  144. package/dist/components/image/index.d.mts +17 -0
  145. package/dist/components/image/index.mjs +57 -0
  146. package/dist/components/image-cropper/index.d.mts +8 -0
  147. package/dist/components/image-cropper/index.mjs +11 -0
  148. package/dist/components/image-viewer/index.d.mts +18 -0
  149. package/dist/components/image-viewer/index.mjs +110 -0
  150. package/dist/components/input/index.d.mts +19 -0
  151. package/dist/components/input/index.mjs +2 -0
  152. package/dist/components/input-group/index.d.mts +17 -0
  153. package/dist/components/input-group/index.mjs +31 -0
  154. package/dist/components/json-tree-view/index.d.mts +7 -0
  155. package/dist/components/json-tree-view/index.mjs +10 -0
  156. package/dist/components/kbd/index.d.mts +6 -0
  157. package/dist/components/kbd/index.mjs +14 -0
  158. package/dist/components/layout/index.d.mts +63 -0
  159. package/dist/components/layout/index.mjs +133 -0
  160. package/dist/components/link/index.d.mts +10 -0
  161. package/dist/components/link/index.mjs +18 -0
  162. package/dist/components/list/index.d.mts +39 -0
  163. package/dist/components/list/index.mjs +66 -0
  164. package/dist/components/listbox/index.d.mts +18 -0
  165. package/dist/components/listbox/index.mjs +18 -0
  166. package/dist/components/marquee/index.d.mts +7 -0
  167. package/dist/components/marquee/index.mjs +10 -0
  168. package/dist/components/masonry/index.d.mts +11 -0
  169. package/dist/components/masonry/index.mjs +29 -0
  170. package/dist/components/mentions/index.d.mts +2 -0
  171. package/dist/components/mentions/index.mjs +2 -0
  172. package/dist/components/menu/index.d.mts +20 -0
  173. package/dist/components/menu/index.mjs +37 -0
  174. package/dist/components/menubar/index.d.mts +32 -0
  175. package/dist/components/menubar/index.mjs +35 -0
  176. package/dist/components/meter/index.d.mts +26 -0
  177. package/dist/components/meter/index.mjs +59 -0
  178. package/dist/components/navigation-menu/index.d.mts +8 -0
  179. package/dist/components/navigation-menu/index.mjs +11 -0
  180. package/dist/components/number-input/index.d.mts +16 -0
  181. package/dist/components/number-input/index.mjs +21 -0
  182. package/dist/components/order-list/index.d.mts +21 -0
  183. package/dist/components/order-list/index.mjs +162 -0
  184. package/dist/components/page-header/index.d.mts +32 -0
  185. package/dist/components/page-header/index.mjs +34 -0
  186. package/dist/components/pagination/index.d.mts +18 -0
  187. package/dist/components/pagination/index.mjs +23 -0
  188. package/dist/components/password-input/index.d.mts +16 -0
  189. package/dist/components/password-input/index.mjs +21 -0
  190. package/dist/components/pin-input/index.d.mts +15 -0
  191. package/dist/components/pin-input/index.mjs +20 -0
  192. package/dist/components/popconfirm/index.d.mts +20 -0
  193. package/dist/components/popconfirm/index.mjs +44 -0
  194. package/dist/components/popover/index.d.mts +8 -0
  195. package/dist/components/popover/index.mjs +11 -0
  196. package/dist/components/presence/index.d.mts +2 -0
  197. package/dist/components/presence/index.mjs +2 -0
  198. package/dist/components/progress/index.d.mts +16 -0
  199. package/dist/components/progress/index.mjs +21 -0
  200. package/dist/components/progress-group/index.d.mts +22 -0
  201. package/dist/components/progress-group/index.mjs +56 -0
  202. package/dist/components/qr-code/index.d.mts +8 -0
  203. package/dist/components/qr-code/index.mjs +11 -0
  204. package/dist/components/radio-group/index.d.mts +16 -0
  205. package/dist/components/radio-group/index.mjs +21 -0
  206. package/dist/components/rating-group/index.d.mts +16 -0
  207. package/dist/components/rating-group/index.mjs +21 -0
  208. package/dist/components/result/index.d.mts +31 -0
  209. package/dist/components/result/index.mjs +59 -0
  210. package/dist/components/scroll-area/index.d.mts +7 -0
  211. package/dist/components/scroll-area/index.mjs +10 -0
  212. package/dist/components/segment-group/index.d.mts +18 -0
  213. package/dist/components/segment-group/index.mjs +20 -0
  214. package/dist/components/select/index.d.mts +2 -0
  215. package/dist/components/select/index.mjs +2 -0
  216. package/dist/components/separator/index.d.mts +11 -0
  217. package/dist/components/separator/index.mjs +16 -0
  218. package/dist/components/signature-pad/index.d.mts +8 -0
  219. package/dist/components/signature-pad/index.mjs +11 -0
  220. package/dist/components/skeleton/index.d.mts +7 -0
  221. package/dist/components/skeleton/index.mjs +13 -0
  222. package/dist/components/slider/index.d.mts +16 -0
  223. package/dist/components/slider/index.mjs +21 -0
  224. package/dist/components/spinner/index.d.mts +9 -0
  225. package/dist/components/spinner/index.mjs +36 -0
  226. package/dist/components/split-button/index.d.mts +36 -0
  227. package/dist/components/split-button/index.mjs +71 -0
  228. package/dist/components/splitter/index.d.mts +7 -0
  229. package/dist/components/splitter/index.mjs +10 -0
  230. package/dist/components/spotlight/index.d.mts +12 -0
  231. package/dist/components/spotlight/index.mjs +33 -0
  232. package/dist/components/stack/index.d.mts +11 -0
  233. package/dist/components/stack/index.mjs +32 -0
  234. package/dist/components/stat/index.d.mts +29 -0
  235. package/dist/components/stat/index.mjs +37 -0
  236. package/dist/components/steps/index.d.mts +19 -0
  237. package/dist/components/steps/index.mjs +24 -0
  238. package/dist/components/swap/index.d.mts +8 -0
  239. package/dist/components/swap/index.mjs +11 -0
  240. package/dist/components/switch/index.d.mts +16 -0
  241. package/dist/components/switch/index.mjs +21 -0
  242. package/dist/components/table/index.d.mts +79 -0
  243. package/dist/components/table/index.mjs +688 -0
  244. package/dist/components/tabs/index.d.mts +20 -0
  245. package/dist/components/tabs/index.mjs +24 -0
  246. package/dist/components/tags-input/index.d.mts +17 -0
  247. package/dist/components/tags-input/index.mjs +22 -0
  248. package/dist/components/terminal/index.d.mts +17 -0
  249. package/dist/components/terminal/index.mjs +65 -0
  250. package/dist/components/textarea/index.d.mts +14 -0
  251. package/dist/components/textarea/index.mjs +20 -0
  252. package/dist/components/timeline/index.d.mts +26 -0
  253. package/dist/components/timeline/index.mjs +40 -0
  254. package/dist/components/timer/index.d.mts +8 -0
  255. package/dist/components/timer/index.mjs +11 -0
  256. package/dist/components/toast/index.d.mts +11 -0
  257. package/dist/components/toast/index.mjs +13 -0
  258. package/dist/components/toc/index.d.mts +7 -0
  259. package/dist/components/toc/index.mjs +10 -0
  260. package/dist/components/toggle/index.d.mts +7 -0
  261. package/dist/components/toggle/index.mjs +10 -0
  262. package/dist/components/toggle-group/index.d.mts +15 -0
  263. package/dist/components/toggle-group/index.mjs +20 -0
  264. package/dist/components/toolbar/index.d.mts +17 -0
  265. package/dist/components/toolbar/index.mjs +29 -0
  266. package/dist/components/tooltip/index.d.mts +7 -0
  267. package/dist/components/tooltip/index.mjs +10 -0
  268. package/dist/components/tour/index.d.mts +11 -0
  269. package/dist/components/tour/index.mjs +13 -0
  270. package/dist/components/transfer/index.d.mts +23 -0
  271. package/dist/components/transfer/index.mjs +154 -0
  272. package/dist/components/tree-select/index.d.mts +28 -0
  273. package/dist/components/tree-select/index.mjs +157 -0
  274. package/dist/components/tree-view/index.d.mts +19 -0
  275. package/dist/components/tree-view/index.mjs +18 -0
  276. package/dist/components/typography/index.d.mts +32 -0
  277. package/dist/components/typography/index.mjs +34 -0
  278. package/dist/components/user/index.d.mts +20 -0
  279. package/dist/components/user/index.mjs +42 -0
  280. package/dist/components/virtual-list/index.d.mts +17 -0
  281. package/dist/components/virtual-list/index.mjs +52 -0
  282. package/dist/components/watermark/index.d.mts +16 -0
  283. package/dist/components/watermark/index.mjs +80 -0
  284. package/dist/index-CsfxYv6J.d.mts +10383 -0
  285. package/dist/index-DFN9F5Zt.d.mts +42 -0
  286. package/dist/index-Uefyw7Im.d.mts +108 -0
  287. package/dist/index-uPyYiWaL.d.mts +1813 -0
  288. package/dist/index.d.mts +141 -15446
  289. package/dist/index.mjs +141 -4871
  290. package/dist/input-2oezH-dY.mjs +58 -0
  291. package/dist/mentions-DMIBCBOd.mjs +181 -0
  292. package/dist/select-D1xiT1oJ.mjs +68 -0
  293. package/package.json +103 -9
@@ -0,0 +1,688 @@
1
+ import { Pagination } from "../pagination/index.mjs";
2
+ import { t as Select$1 } from "../../select-D1xiT1oJ.mjs";
3
+ import { injectComponentStyle } from "@bysages/core";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useLayoutEffect, useMemo, useReducer, useRef } from "react";
6
+ import { createListCollection } from "@ark-ui/react/select";
7
+ import { FlexRender, cellSpanningFeature, columnFilteringFeature, columnOrderingFeature, columnPinningFeature, columnSizingFeature, columnVisibilityFeature, createColumnHelper, createExpandedRowModel, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_arrIncludes, filterFn_equals, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_weakEquals, globalFilteringFeature, rowExpandingFeature, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, tableFeatures, useTable } from "@tanstack/react-table";
8
+ import { useVirtualizer } from "@tanstack/react-virtual";
9
+ //#region src/components/table/index.tsx
10
+ /** The pagination bar's arrows — thin chevrons for the row of seals. */
11
+ function pageGlyph(direction) {
12
+ return /* @__PURE__ */ jsx("svg", {
13
+ viewBox: "0 0 24 24",
14
+ width: 14,
15
+ height: 14,
16
+ fill: "none",
17
+ stroke: "currentColor",
18
+ strokeWidth: 2,
19
+ strokeLinecap: "round",
20
+ strokeLinejoin: "round",
21
+ "aria-hidden": "true",
22
+ children: /* @__PURE__ */ jsx("path", { d: direction === "start" ? "m15 18-6-6 6-6" : "m9 18 6-6-6-6" })
23
+ });
24
+ }
25
+ /** The page-size select's pointing chevron. */
26
+ function chevronDownGlyph() {
27
+ return /* @__PURE__ */ jsx("svg", {
28
+ viewBox: "0 0 24 24",
29
+ width: 14,
30
+ height: 14,
31
+ fill: "none",
32
+ stroke: "currentColor",
33
+ strokeWidth: 2.5,
34
+ strokeLinecap: "round",
35
+ strokeLinejoin: "round",
36
+ "aria-hidden": "true",
37
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
38
+ });
39
+ }
40
+ const SELECT_COL_ID = "__select";
41
+ const SELECT_COL_WIDTH = 48;
42
+ /** The list holding `id` and the index inside it, or null when absent. */
43
+ function findNode(rows, id) {
44
+ for (let index = 0; index < rows.length; index++) {
45
+ const row = rows[index];
46
+ if (String(row.id) === id) return {
47
+ list: rows,
48
+ index
49
+ };
50
+ if (row.subRows) {
51
+ const hit = findNode(row.subRows, id);
52
+ if (hit) return hit;
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+ /** True when `id` sits anywhere in the node's subtree — dropping a node
58
+ * into its own descendants would orphan it. */
59
+ function containsNode(node, id) {
60
+ return !!node.subRows?.some((child) => String(child.id) === id || containsNode(child, id));
61
+ }
62
+ /** Rebuild every array along the path to `id`, leaving sibling branches
63
+ * untouched by reference (TanStack's memoization keeps their rows). */
64
+ function removeById(rows, id) {
65
+ const next = [];
66
+ for (const row of rows) {
67
+ if (String(row.id) === id) continue;
68
+ next.push(row.subRows ? {
69
+ ...row,
70
+ subRows: removeById(row.subRows, id)
71
+ } : row);
72
+ }
73
+ return next;
74
+ }
75
+ /** Rebuild the path to `id` and swap the node for `patch(node)`. */
76
+ function replaceById(rows, id, patch) {
77
+ return rows.map((row) => {
78
+ if (String(row.id) === id) return patch(row);
79
+ return row.subRows ? {
80
+ ...row,
81
+ subRows: replaceById(row.subRows, id, patch)
82
+ } : row;
83
+ });
84
+ }
85
+ /** Toggle one drop-indicator attribute without rewriting it every event. */
86
+ function mark(el, attr, on) {
87
+ if (on) el.setAttribute(attr, "");
88
+ else el.removeAttribute(attr);
89
+ }
90
+ function ChevronGlyph() {
91
+ return /* @__PURE__ */ jsx("svg", {
92
+ viewBox: "0 0 24 24",
93
+ fill: "none",
94
+ stroke: "currentColor",
95
+ strokeWidth: 2.5,
96
+ strokeLinecap: "round",
97
+ strokeLinejoin: "round",
98
+ "aria-hidden": true,
99
+ children: /* @__PURE__ */ jsx("path", { d: "m9 6 6 6-6 6" })
100
+ });
101
+ }
102
+ /** React keeps `indeterminate` off the JSX types; the DOM property is the
103
+ * only channel, so the checkbox owns its ref. */
104
+ function SelectBox(props) {
105
+ const box = useRef(null);
106
+ useLayoutEffect(() => {
107
+ if (box.current) box.current.indeterminate = props.indeterminate;
108
+ });
109
+ return /* @__PURE__ */ jsx("input", {
110
+ ref: box,
111
+ type: "checkbox",
112
+ checked: props.checked,
113
+ "aria-label": props.label,
114
+ onChange: props.onToggle
115
+ });
116
+ }
117
+ function DataTable(rawProps) {
118
+ injectComponentStyle("table");
119
+ const props = rawProps;
120
+ const { selectable = false, sortable = true, filterable = false, showToolbar = true, tree = false, virtual: virtualProp = false, rowHeight = 40, paginated = false, pageSize = 10, pageSizeOptions = [
121
+ 10,
122
+ 20,
123
+ 50
124
+ ], globalFilterPlaceholder = "Filter rows", emptyText = "No rows", reorderable = false } = props;
125
+ const merge = props.merge;
126
+ const virtual = virtualProp && !merge;
127
+ const mergeMode = !virtualProp && !!merge;
128
+ /** Features follow the construction-time switches: sorting, selection,
129
+ * expansion, pinning, and spanning are always part of the one-stop
130
+ * shape; filtering and pagination ride their own render paths. Memoized
131
+ * so the feature registry stays stable across renders. */
132
+ const features = useMemo(() => tableFeatures({
133
+ rowSortingFeature,
134
+ sortedRowModel: createSortedRowModel(),
135
+ sortFns: {
136
+ alphanumeric: sortFn_alphanumeric,
137
+ alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,
138
+ basic: sortFn_basic,
139
+ datetime: sortFn_datetime,
140
+ text: sortFn_text,
141
+ textCaseSensitive: sortFn_textCaseSensitive
142
+ },
143
+ rowSelectionFeature,
144
+ rowExpandingFeature,
145
+ expandedRowModel: createExpandedRowModel(),
146
+ columnPinningFeature,
147
+ columnOrderingFeature,
148
+ columnSizingFeature,
149
+ columnVisibilityFeature,
150
+ cellSpanningFeature,
151
+ ...filterable ? {
152
+ columnFilteringFeature,
153
+ globalFilteringFeature,
154
+ filteredRowModel: createFilteredRowModel(),
155
+ filterFns: {
156
+ arrIncludes: filterFn_arrIncludes,
157
+ equals: filterFn_equals,
158
+ includesString: filterFn_includesString,
159
+ inDateRange: filterFn_inDateRange,
160
+ inNumberRange: filterFn_inNumberRange,
161
+ weakEquals: filterFn_weakEquals
162
+ }
163
+ } : {},
164
+ ...paginated ? {
165
+ rowPaginationFeature,
166
+ paginatedRowModel: createPaginatedRowModel()
167
+ } : {}
168
+ }), [filterable, paginated]);
169
+ const columns = useMemo(() => {
170
+ if (virtualProp && merge) console.warn("[DataTable] `virtual` and `merge` are mutually exclusive; merge wins.");
171
+ const mergeIds = new Set(merge ?? []);
172
+ const defId = (def) => def.id ?? ("accessorKey" in def ? String(def.accessorKey) : "");
173
+ const narrowed = props.columns.map((def) => mergeIds.has(defId(def)) ? {
174
+ ...def,
175
+ spanRows: true
176
+ } : def);
177
+ if (selectable) narrowed.unshift({
178
+ id: SELECT_COL_ID,
179
+ size: SELECT_COL_WIDTH,
180
+ enableSorting: false,
181
+ header: () => "",
182
+ cell: () => ""
183
+ });
184
+ return narrowed;
185
+ }, [
186
+ props.columns,
187
+ merge,
188
+ selectable,
189
+ features
190
+ ]);
191
+ const table = useTable({
192
+ features,
193
+ columns,
194
+ data: props.data,
195
+ enableSorting: sortable,
196
+ getRowId: (row) => String(row.id),
197
+ getSubRows: (row) => row.subRows,
198
+ autoResetExpanded: false,
199
+ initialState: {
200
+ ...props.initialSorting ? { sorting: props.initialSorting } : {},
201
+ ...paginated ? { pagination: {
202
+ pageIndex: 0,
203
+ pageSize
204
+ } } : {},
205
+ ...props.pinStart || props.pinEnd ? { columnPinning: {
206
+ start: props.pinStart ?? [],
207
+ end: props.pinEnd ?? []
208
+ } } : {}
209
+ }
210
+ });
211
+ const viewport = useRef(null);
212
+ const rows = table.getRowModel().rows;
213
+ /** The declared row height is the density-scale baseline; the live
214
+ * scale comes off the document so the virtual window matches what CSS
215
+ * actually renders. It is read once and re-read only when the density
216
+ * or scene attribute moves — estimateSize runs on every scroll frame. */
217
+ let densityScale = 1;
218
+ const readDensityScale = () => {
219
+ const value = Number(getComputedStyle(document.documentElement).getPropertyValue("--bs-density-scale"));
220
+ densityScale = Number.isFinite(value) && value > 0 ? value : 1;
221
+ };
222
+ const virtualizer = useVirtualizer({
223
+ count: rows.length,
224
+ getScrollElement: () => viewport.current,
225
+ estimateSize: () => rowHeight * densityScale,
226
+ getItemKey: (index) => rows[index]?.id ?? index,
227
+ overscan: 8
228
+ });
229
+ const [, rerender] = useReducer((count) => count + 1, 0);
230
+ useEffect(() => {
231
+ if (!virtual) return;
232
+ readDensityScale();
233
+ const observer = new MutationObserver(rerender);
234
+ observer.observe(document.documentElement, {
235
+ attributes: true,
236
+ attributeFilter: ["data-density", "data-scene"]
237
+ });
238
+ return () => observer.disconnect();
239
+ }, [virtual]);
240
+ const virtualRows = virtualizer.getVirtualItems();
241
+ const totalSize = virtualizer.getTotalSize();
242
+ /** Column ids of the visible leaves, for pin-seam bookkeeping. */
243
+ const leafIds = table.getAllLeafColumns().map((c) => c.id);
244
+ const expandHostId = tree ? leafIds.find((id) => id !== SELECT_COL_ID) : void 0;
245
+ /** Track list for every grid in the table; explicit sizes pin to px,
246
+ * everything else flexes. */
247
+ const colsTemplate = table.getAllLeafColumns().map((column) => {
248
+ if (column.id === SELECT_COL_ID) return `${SELECT_COL_WIDTH}px`;
249
+ const def = props.columns.find((d) => d.id === column.id || "accessorKey" in d && String(d.accessorKey) === column.id);
250
+ return def?.size != null ? `${def.size}px` : def?.minSize != null ? `minmax(${def.minSize}px, 1fr)` : "1fr";
251
+ }).join(" ");
252
+ function pinAttrs(column) {
253
+ const pinned = column.getIsPinned();
254
+ const attrs = { "data-pinned": pinned || void 0 };
255
+ if (!pinned) return attrs;
256
+ const offset = pinned === "start" ? column.getStart("start") : column.getAfter("end");
257
+ const index = leafIds.indexOf(column.id);
258
+ const prev = index > 0 ? table.getColumn(leafIds[index - 1]) : void 0;
259
+ const next = index < leafIds.length - 1 ? table.getColumn(leafIds[index + 1]) : void 0;
260
+ attrs["data-last-pinned"] = pinned === "start" && next?.getIsPinned() !== "start" ? "" : void 0;
261
+ attrs["data-first-pinned"] = pinned === "end" && prev?.getIsPinned() !== "end" ? "" : void 0;
262
+ attrs.style = { "--pin-offset": `${offset}px` };
263
+ return attrs;
264
+ }
265
+ const drag = useRef({
266
+ col: null,
267
+ row: null,
268
+ lastColDrop: null,
269
+ lastRowDrop: null
270
+ });
271
+ function clearColDrop() {
272
+ const el = drag.current.lastColDrop;
273
+ if (el) {
274
+ el.removeAttribute("data-drop-before-col");
275
+ el.removeAttribute("data-drop-after-col");
276
+ drag.current.lastColDrop = null;
277
+ }
278
+ }
279
+ function clearRowDrop() {
280
+ const el = drag.current.lastRowDrop;
281
+ if (el) {
282
+ el.removeAttribute("data-drop-before");
283
+ el.removeAttribute("data-drop-inside");
284
+ el.removeAttribute("data-drop-after");
285
+ el.style.removeProperty("--bs-drop-indent");
286
+ drag.current.lastRowDrop = null;
287
+ }
288
+ }
289
+ function onColDragStart(e) {
290
+ drag.current.col = e.currentTarget.dataset.id;
291
+ e.dataTransfer.effectAllowed = "move";
292
+ e.dataTransfer.setData("text/plain", drag.current.col);
293
+ e.currentTarget.setAttribute("data-dragging", "");
294
+ }
295
+ /** Header cells answer drops on either side of their midpoint; pinned
296
+ * columns and the drag source themselves never light up. */
297
+ function onColDragOver(column, e) {
298
+ if (!drag.current.col || drag.current.col === column.id || column.getIsPinned()) return;
299
+ e.preventDefault();
300
+ e.dataTransfer.dropEffect = "move";
301
+ const el = e.currentTarget;
302
+ if (drag.current.lastColDrop !== el) clearColDrop();
303
+ const box = el.getBoundingClientRect();
304
+ const before = e.clientX < box.left + box.width / 2;
305
+ mark(el, "data-drop-before-col", before);
306
+ mark(el, "data-drop-after-col", !before);
307
+ drag.current.lastColDrop = el;
308
+ }
309
+ function onColDragLeave(e) {
310
+ if (e.currentTarget === drag.current.lastColDrop) clearColDrop();
311
+ }
312
+ function onColDrop(column, e) {
313
+ e.preventDefault();
314
+ if (!drag.current.col || drag.current.col === column.id) return;
315
+ const box = e.currentTarget.getBoundingClientRect();
316
+ const before = e.clientX < box.left + box.width / 2;
317
+ const moved = drag.current.col;
318
+ const state = table.atoms.columnOrder.get();
319
+ const order = (state.length ? [...state] : table.getAllLeafColumns().map((c) => c.id)).filter((id) => id !== moved);
320
+ const at = order.indexOf(column.id);
321
+ order.splice(before ? at : at + 1, 0, moved);
322
+ const selectAt = order.indexOf(SELECT_COL_ID);
323
+ if (selectAt > 0) {
324
+ order.splice(selectAt, 1);
325
+ order.unshift(SELECT_COL_ID);
326
+ }
327
+ table.setColumnOrder(order);
328
+ props.onColumnReorder?.(order);
329
+ clearColDrop();
330
+ }
331
+ function onColDragEnd(e) {
332
+ drag.current.col = null;
333
+ e.currentTarget.removeAttribute("data-dragging");
334
+ clearColDrop();
335
+ }
336
+ /** Row dragging rests while any view (sorting, filtering, pagination
337
+ * past the first page) stands between the display order and the data
338
+ * order — a drop there would lie about what it reordered. */
339
+ const rowDraggable = reorderable && !mergeMode && table.atoms.sorting.get().length === 0 && !(filterable && (table.atoms.columnFilters.get().length || table.atoms.globalFilter.get())) && !(paginated && table.atoms.pagination.get().pageIndex !== 0);
340
+ function onRowDragStart(row, e) {
341
+ drag.current.row = String(row.id);
342
+ e.dataTransfer.effectAllowed = "move";
343
+ e.dataTransfer.setData("text/plain", drag.current.row);
344
+ e.currentTarget.setAttribute("data-dragging", "");
345
+ }
346
+ /** Where a tree drop lands: the outer bands of the target row read as
347
+ * sibling slots (40% each, so the insertion line answers the hand
348
+ * everywhere and indents to the reference row's own depth — cross a
349
+ * boundary and the level flips from the row above's to the row
350
+ * below's); the narrow middle band reads as "make child". A node
351
+ * never drops into its own subtree. */
352
+ function rowZone(row, e) {
353
+ const box = e.currentTarget.getBoundingClientRect();
354
+ const pos = (e.clientY - box.top) / box.height;
355
+ return pos < .4 ? "before" : pos > .6 ? "after" : "inside";
356
+ }
357
+ function onRowDragOver(row, e) {
358
+ if (!drag.current.row || drag.current.row === String(row.id)) return;
359
+ const el = e.currentTarget;
360
+ let zone;
361
+ if (tree) {
362
+ const hit = findNode(props.data, drag.current.row);
363
+ const dragged = hit?.list[hit.index];
364
+ if (!dragged || containsNode(dragged, String(row.id))) return;
365
+ zone = rowZone(row, e);
366
+ } else {
367
+ const box = el.getBoundingClientRect();
368
+ zone = e.clientY - box.top < box.height / 2 ? "before" : "after";
369
+ }
370
+ e.preventDefault();
371
+ e.dataTransfer.dropEffect = "move";
372
+ if (drag.current.lastRowDrop !== el) clearRowDrop();
373
+ mark(el, "data-drop-before", zone === "before");
374
+ mark(el, "data-drop-inside", zone === "inside");
375
+ mark(el, "data-drop-after", zone === "after");
376
+ el.style.setProperty("--bs-drop-indent", String(tree ? row.depth : 0));
377
+ drag.current.lastRowDrop = el;
378
+ }
379
+ function onRowDragLeave(e) {
380
+ if (e.currentTarget === drag.current.lastRowDrop) clearRowDrop();
381
+ }
382
+ function onRowDrop(row, e) {
383
+ e.preventDefault();
384
+ if (!drag.current.row || drag.current.row === String(row.id)) return;
385
+ const box = e.currentTarget.getBoundingClientRect();
386
+ const targetId = String(row.id);
387
+ const movedId = drag.current.row;
388
+ if (tree) {
389
+ const zone = rowZone(row, e);
390
+ const hit = findNode(props.data, movedId);
391
+ const dragged = hit?.list[hit.index];
392
+ if (!dragged || containsNode(dragged, targetId)) return;
393
+ let next = removeById(props.data, movedId);
394
+ if (zone === "inside") next = replaceById(next, targetId, (node) => ({
395
+ ...node,
396
+ subRows: [...node.subRows ?? [], dragged]
397
+ }));
398
+ else {
399
+ const slot = findNode(next, targetId);
400
+ if (!slot) return;
401
+ slot.list.splice(slot.index + (zone === "after" ? 1 : 0), 0, dragged);
402
+ }
403
+ props.onRowReorder?.(next);
404
+ } else {
405
+ const pos = (e.clientY - box.top) / box.height;
406
+ const data = props.data;
407
+ const from = data.findIndex((r) => String(r.id) === movedId);
408
+ const to = data.findIndex((r) => String(r.id) === targetId);
409
+ if (from < 0 || to < 0) return;
410
+ const next = [...data];
411
+ const [movedRow] = next.splice(from, 1);
412
+ const slot = to > from ? to - 1 : to;
413
+ next.splice(pos < .5 ? slot : slot + 1, 0, movedRow);
414
+ props.onRowReorder?.(next);
415
+ }
416
+ clearRowDrop();
417
+ }
418
+ function onRowDragEnd(e) {
419
+ drag.current.row = null;
420
+ e.currentTarget.removeAttribute("data-dragging");
421
+ clearRowDrop();
422
+ }
423
+ function renderCell(cell, row) {
424
+ const column = cell.column;
425
+ if (cell.getIsCovered()) return null;
426
+ const isExpandHost = column.id === expandHostId;
427
+ const pin = pinAttrs(column);
428
+ const style = { ...pin.style };
429
+ delete pin.style;
430
+ const rowSpan = cell.getRowSpan();
431
+ if (rowSpan > 1) style.gridRow = `span ${rowSpan}`;
432
+ const spanned = rowSpan > 1 ? { "data-spanned": "" } : {};
433
+ let content;
434
+ if (column.id === SELECT_COL_ID) content = /* @__PURE__ */ jsx(SelectBox, {
435
+ checked: row.getIsSelected(),
436
+ indeterminate: false,
437
+ onToggle: () => row.toggleSelected(!row.getIsSelected()),
438
+ label: "Select row"
439
+ });
440
+ else if (isExpandHost) content = /* @__PURE__ */ jsxs("div", {
441
+ "data-scope": "table",
442
+ "data-part": "cell-main",
443
+ style: { "--bs-table-depth": String(row.depth) },
444
+ children: [/* @__PURE__ */ jsx("button", {
445
+ type: "button",
446
+ "data-scope": "table",
447
+ "data-part": "expander",
448
+ "data-expanded": row.getIsExpanded() || void 0,
449
+ "data-leaf": !row.getCanExpand() || void 0,
450
+ "aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
451
+ onClick: () => row.toggleExpanded(),
452
+ children: /* @__PURE__ */ jsx(ChevronGlyph, {})
453
+ }), /* @__PURE__ */ jsx(FlexRender, { cell })]
454
+ });
455
+ else content = /* @__PURE__ */ jsx(FlexRender, { cell });
456
+ return /* @__PURE__ */ jsx("div", {
457
+ role: "cell",
458
+ "data-scope": "table",
459
+ "data-part": "cell",
460
+ "data-numeric": column.columnDef.meta?.numeric ? "" : void 0,
461
+ ...spanned,
462
+ ...pin,
463
+ style,
464
+ children: content
465
+ }, column.id);
466
+ }
467
+ function renderHeaderCell(header) {
468
+ const column = header.column;
469
+ const sorted = column.getIsSorted();
470
+ const canSort = column.getCanSort();
471
+ const canFilter = filterable && column.getCanFilter();
472
+ const canDrag = !!reorderable && column.id !== SELECT_COL_ID && !column.getIsPinned();
473
+ return /* @__PURE__ */ jsxs("div", {
474
+ role: "columnheader",
475
+ "data-scope": "table",
476
+ "data-part": "header-cell",
477
+ "data-sortable": canSort || void 0,
478
+ "data-sort": sorted || void 0,
479
+ "data-numeric": column.columnDef.meta?.numeric ? "" : void 0,
480
+ "data-draggable": canDrag || void 0,
481
+ "data-id": column.id,
482
+ draggable: canDrag || void 0,
483
+ "aria-sort": sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : void 0,
484
+ ...pinAttrs(column),
485
+ onClick: canSort ? () => column.toggleSorting() : void 0,
486
+ onDragStart: canDrag ? onColDragStart : void 0,
487
+ onDragOver: canDrag ? (e) => onColDragOver(column, e) : void 0,
488
+ onDragLeave: canDrag ? onColDragLeave : void 0,
489
+ onDrop: canDrag ? (e) => onColDrop(column, e) : void 0,
490
+ onDragEnd: canDrag ? onColDragEnd : void 0,
491
+ children: [header.isPlaceholder || header.column.columnDef.header === "" ? null : /* @__PURE__ */ jsx(FlexRender, { header }), canFilter ? /* @__PURE__ */ jsx("input", {
492
+ type: "text",
493
+ "data-scope": "table",
494
+ "data-part": "header-filter",
495
+ "aria-label": `Filter ${column.id}`,
496
+ value: column.getFilterValue() ?? "",
497
+ placeholder: "Filter",
498
+ draggable: false,
499
+ onClick: (e) => e.stopPropagation(),
500
+ onDragStart: (e) => e.stopPropagation(),
501
+ onInput: (e) => column.setFilterValue(e.target.value)
502
+ }) : null]
503
+ }, column.id);
504
+ }
505
+ function renderRow(row, virtualIndex) {
506
+ const style = {};
507
+ if (virtual) {
508
+ const item = virtualRows[virtualIndex];
509
+ style.position = "absolute";
510
+ style.insetInlineStart = "0";
511
+ style.inlineSize = "100%";
512
+ style.transform = `translateY(${item.start}px)`;
513
+ style.blockSize = `${item.size}px`;
514
+ }
515
+ return /* @__PURE__ */ jsx("div", {
516
+ role: "row",
517
+ "data-scope": "table",
518
+ "data-part": "row",
519
+ "data-selected": row.getIsSelected() || void 0,
520
+ draggable: rowDraggable || void 0,
521
+ onDragStart: rowDraggable ? (e) => onRowDragStart(row, e) : void 0,
522
+ onDragOver: rowDraggable ? (e) => onRowDragOver(row, e) : void 0,
523
+ onDragLeave: rowDraggable ? onRowDragLeave : void 0,
524
+ onDrop: rowDraggable ? (e) => onRowDrop(row, e) : void 0,
525
+ onDragEnd: rowDraggable ? onRowDragEnd : void 0,
526
+ style,
527
+ children: row.getVisibleCells().map((cell) => renderCell(cell, row))
528
+ }, row.id);
529
+ }
530
+ const header = /* @__PURE__ */ jsx("div", {
531
+ role: "rowgroup",
532
+ "data-scope": "table",
533
+ "data-part": "header",
534
+ children: table.getHeaderGroups().map((group) => /* @__PURE__ */ jsx("div", {
535
+ role: "row",
536
+ "data-scope": "table",
537
+ "data-part": "row",
538
+ children: group.headers.map((header) => {
539
+ const column = header.column;
540
+ if (column.id === SELECT_COL_ID) {
541
+ const all = table.getIsAllRowsSelected();
542
+ return /* @__PURE__ */ jsx("div", {
543
+ role: "columnheader",
544
+ "data-scope": "table",
545
+ "data-part": "header-cell",
546
+ ...pinAttrs(column),
547
+ children: /* @__PURE__ */ jsx(SelectBox, {
548
+ checked: all,
549
+ indeterminate: table.getIsSomeRowsSelected() && !all,
550
+ onToggle: () => table.toggleAllRowsSelected(!all),
551
+ label: "Select all rows"
552
+ })
553
+ }, column.id);
554
+ }
555
+ return renderHeaderCell(header);
556
+ })
557
+ }, group.id))
558
+ });
559
+ const body = /* @__PURE__ */ jsxs("div", {
560
+ role: "rowgroup",
561
+ "data-scope": "table",
562
+ "data-part": "body",
563
+ "data-merge": mergeMode || void 0,
564
+ style: virtual ? {
565
+ position: "relative",
566
+ blockSize: `${totalSize}px`
567
+ } : void 0,
568
+ children: [virtual ? virtualRows.map((_, index) => renderRow(rows[index], index)) : rows.map((row) => renderRow(row, -1)), rows.length === 0 ? /* @__PURE__ */ jsx("div", {
569
+ "data-scope": "table",
570
+ "data-part": "empty",
571
+ children: emptyText
572
+ }) : null]
573
+ });
574
+ const hasFooters = table.getFooterGroups().some((group) => group.headers.some((header) => header.column.columnDef.footer));
575
+ const footer = props.stickyFooter && hasFooters ? /* @__PURE__ */ jsx("div", {
576
+ role: "rowgroup",
577
+ "data-scope": "table",
578
+ "data-part": "footer",
579
+ children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsx("div", {
580
+ role: "row",
581
+ "data-scope": "table",
582
+ "data-part": "row",
583
+ children: group.headers.map((header) => /* @__PURE__ */ jsx("div", {
584
+ role: "columnheader",
585
+ "data-scope": "table",
586
+ "data-part": "footer-cell",
587
+ "data-numeric": header.column.columnDef.meta?.numeric ? "" : void 0,
588
+ ...pinAttrs(header.column),
589
+ children: header.isPlaceholder ? null : /* @__PURE__ */ jsx(FlexRender, { footer: header })
590
+ }, header.column.id))
591
+ }, group.id))
592
+ }) : null;
593
+ /** The bar only exists when the pagination feature is registered; its
594
+ * state reads stay inside this branch. */
595
+ const paginationBar = paginated ? (() => {
596
+ const pagination = table.atoms.pagination.get();
597
+ const rowCount = table.getRowCount();
598
+ const sizeItems = createListCollection({ items: pageSizeOptions.map((size) => ({
599
+ label: `${size} / page`,
600
+ value: String(size)
601
+ })) });
602
+ const pageSize = /* @__PURE__ */ jsxs(Select$1.Root, {
603
+ collection: sizeItems,
604
+ value: [String(pagination.pageSize)],
605
+ onValueChange: (details) => table.setPageSize(Number(details.value[0])),
606
+ positioning: { placement: "top-start" },
607
+ children: [/* @__PURE__ */ jsx(Select$1.Control, { children: /* @__PURE__ */ jsxs(Select$1.Trigger, {
608
+ "aria-label": "Rows per page",
609
+ children: [/* @__PURE__ */ jsx(Select$1.ValueText, {}), /* @__PURE__ */ jsx(Select$1.Indicator, { children: chevronDownGlyph() })]
610
+ }) }), /* @__PURE__ */ jsx(Select$1.Positioner, { children: /* @__PURE__ */ jsx(Select$1.Content, { children: sizeItems.items.map((item) => /* @__PURE__ */ jsxs(Select$1.Item, {
611
+ item,
612
+ children: [/* @__PURE__ */ jsx(Select$1.ItemText, { children: item.label }), /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: "✓" })]
613
+ }, item.value)) }) })]
614
+ });
615
+ const pager = /* @__PURE__ */ jsxs(Pagination.Root, {
616
+ count: rowCount,
617
+ pageSize: pagination.pageSize,
618
+ page: pagination.pageIndex + 1,
619
+ onPageChange: (details) => table.setPageIndex(details.page - 1),
620
+ children: [
621
+ /* @__PURE__ */ jsx(Pagination.PrevTrigger, { children: pageGlyph("start") }),
622
+ /* @__PURE__ */ jsx(Pagination.Context, { children: (scope) => scope.pages.map((page, index) => page.type === "ellipsis" ? /* @__PURE__ */ jsx(Pagination.Ellipsis, { index }, `e${index}`) : /* @__PURE__ */ jsx(Pagination.Item, {
623
+ type: "page",
624
+ value: page.value,
625
+ children: String(page.value)
626
+ }, page.value)) }),
627
+ /* @__PURE__ */ jsx(Pagination.NextTrigger, { children: pageGlyph("end") })
628
+ ]
629
+ });
630
+ return /* @__PURE__ */ jsxs("div", {
631
+ "data-scope": "table",
632
+ "data-part": "pagination",
633
+ children: [/* @__PURE__ */ jsxs("span", {
634
+ "data-scope": "table",
635
+ "data-part": "page-status",
636
+ children: [rowCount, " rows"]
637
+ }), /* @__PURE__ */ jsxs("div", {
638
+ "data-scope": "table",
639
+ "data-part": "page-nav",
640
+ children: [pageSize, pager]
641
+ })]
642
+ });
643
+ })() : null;
644
+ const toolbar = filterable && showToolbar ? /* @__PURE__ */ jsx("div", {
645
+ "data-scope": "table",
646
+ "data-part": "toolbar",
647
+ children: /* @__PURE__ */ jsx("input", {
648
+ type: "search",
649
+ "data-scope": "table",
650
+ "data-part": "global-filter",
651
+ "aria-label": "Filter all columns",
652
+ placeholder: globalFilterPlaceholder,
653
+ value: table.atoms.globalFilter.get() ?? "",
654
+ onInput: (e) => table.setGlobalFilter(e.target.value)
655
+ })
656
+ }) : null;
657
+ return /* @__PURE__ */ jsxs("div", {
658
+ "data-scope": "table",
659
+ "data-part": "root",
660
+ "data-reorderable": reorderable || void 0,
661
+ style: {
662
+ "--bs-table-row-height": `calc(${rowHeight}px * var(--bs-density-scale, 1))`,
663
+ ...props.style
664
+ },
665
+ children: [
666
+ toolbar,
667
+ /* @__PURE__ */ jsx("div", {
668
+ "data-scope": "table",
669
+ "data-part": "viewport",
670
+ ref: viewport,
671
+ children: /* @__PURE__ */ jsxs("div", {
672
+ role: "table",
673
+ "data-scope": "table",
674
+ "data-part": "table",
675
+ style: { "--bs-table-cols": colsTemplate },
676
+ children: [
677
+ header,
678
+ body,
679
+ footer
680
+ ]
681
+ })
682
+ }),
683
+ paginationBar
684
+ ]
685
+ });
686
+ }
687
+ //#endregion
688
+ export { DataTable, FlexRender, createColumnHelper };