@parto-system-design/ui 1.1.5 → 1.1.8

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 (301) hide show
  1. package/AGENTS.md +233 -0
  2. package/LICENSE +21 -0
  3. package/README.md +96 -43
  4. package/dist/chunk-2ACKKPWA.cjs +112 -0
  5. package/dist/chunk-2ACKKPWA.cjs.map +1 -0
  6. package/dist/chunk-2UD3LGVX.cjs +316 -0
  7. package/dist/chunk-2UD3LGVX.cjs.map +1 -0
  8. package/dist/chunk-3QYYPPFJ.js +269 -0
  9. package/dist/chunk-3QYYPPFJ.js.map +1 -0
  10. package/dist/chunk-4SVQNEVH.js +173 -0
  11. package/dist/chunk-4SVQNEVH.js.map +1 -0
  12. package/dist/chunk-4WONHORR.cjs +152 -0
  13. package/dist/chunk-4WONHORR.cjs.map +1 -0
  14. package/dist/chunk-5HCXH6GS.js +409 -0
  15. package/dist/chunk-5HCXH6GS.js.map +1 -0
  16. package/dist/chunk-5JJSRGJD.js +31 -0
  17. package/dist/chunk-5JJSRGJD.js.map +1 -0
  18. package/dist/chunk-5K6E4ZSW.cjs +77 -0
  19. package/dist/chunk-5K6E4ZSW.cjs.map +1 -0
  20. package/dist/chunk-5NY26ULO.js +89 -0
  21. package/dist/chunk-5NY26ULO.js.map +1 -0
  22. package/dist/chunk-7RVPG3LE.cjs +231 -0
  23. package/dist/chunk-7RVPG3LE.cjs.map +1 -0
  24. package/dist/chunk-AYEK3WOM.js +207 -0
  25. package/dist/chunk-AYEK3WOM.js.map +1 -0
  26. package/dist/chunk-BRMBLIQG.js +53 -0
  27. package/dist/chunk-BRMBLIQG.js.map +1 -0
  28. package/dist/chunk-CAJKSTXX.cjs +54 -0
  29. package/dist/chunk-CAJKSTXX.cjs.map +1 -0
  30. package/dist/chunk-CKFWMHQU.js +401 -0
  31. package/dist/chunk-CKFWMHQU.js.map +1 -0
  32. package/dist/chunk-CV3N3HVK.js +672 -0
  33. package/dist/chunk-CV3N3HVK.js.map +1 -0
  34. package/dist/chunk-D2EBLE2B.cjs +220 -0
  35. package/dist/chunk-D2EBLE2B.cjs.map +1 -0
  36. package/dist/chunk-GCZ6YATL.js +940 -0
  37. package/dist/chunk-GCZ6YATL.js.map +1 -0
  38. package/dist/chunk-GKRAZGDI.cjs +84 -0
  39. package/dist/chunk-GKRAZGDI.cjs.map +1 -0
  40. package/dist/chunk-GPYJ66CG.js +45 -0
  41. package/dist/chunk-GPYJ66CG.js.map +1 -0
  42. package/dist/chunk-HF6XU5NI.js +84 -0
  43. package/dist/chunk-HF6XU5NI.js.map +1 -0
  44. package/dist/chunk-HJPDZOMJ.cjs +87 -0
  45. package/dist/chunk-HJPDZOMJ.cjs.map +1 -0
  46. package/dist/chunk-HS3XI3CC.cjs +69 -0
  47. package/dist/chunk-HS3XI3CC.cjs.map +1 -0
  48. package/dist/chunk-HUCC3QH5.cjs +53 -0
  49. package/dist/chunk-HUCC3QH5.cjs.map +1 -0
  50. package/dist/chunk-HYZ6BQPS.cjs +425 -0
  51. package/dist/chunk-HYZ6BQPS.cjs.map +1 -0
  52. package/dist/chunk-ISCSZMYW.cjs +106 -0
  53. package/dist/chunk-ISCSZMYW.cjs.map +1 -0
  54. package/dist/chunk-IXFEFIDO.js +82 -0
  55. package/dist/chunk-IXFEFIDO.js.map +1 -0
  56. package/dist/chunk-JCJLN437.js +108 -0
  57. package/dist/chunk-JCJLN437.js.map +1 -0
  58. package/dist/chunk-JMKNNH63.cjs +982 -0
  59. package/dist/chunk-JMKNNH63.cjs.map +1 -0
  60. package/dist/chunk-JUBHQAA2.js +53 -0
  61. package/dist/chunk-JUBHQAA2.js.map +1 -0
  62. package/dist/chunk-K6G63EED.cjs +41 -0
  63. package/dist/chunk-K6G63EED.cjs.map +1 -0
  64. package/dist/chunk-KCWRCSI7.js +62 -0
  65. package/dist/chunk-KCWRCSI7.js.map +1 -0
  66. package/dist/chunk-KYM7NIJO.cjs +433 -0
  67. package/dist/chunk-KYM7NIJO.cjs.map +1 -0
  68. package/dist/chunk-L2L5CKC2.js +291 -0
  69. package/dist/chunk-L2L5CKC2.js.map +1 -0
  70. package/dist/chunk-M5CHZ5BA.js +124 -0
  71. package/dist/chunk-M5CHZ5BA.js.map +1 -0
  72. package/dist/chunk-MEK4RSGC.js +65 -0
  73. package/dist/chunk-MEK4RSGC.js.map +1 -0
  74. package/dist/chunk-MEKWH3GS.js +89 -0
  75. package/dist/chunk-MEKWH3GS.js.map +1 -0
  76. package/dist/chunk-MFTX2DDQ.js +27 -0
  77. package/dist/chunk-MFTX2DDQ.js.map +1 -0
  78. package/dist/chunk-MMC6M35Q.cjs +272 -0
  79. package/dist/chunk-MMC6M35Q.cjs.map +1 -0
  80. package/dist/chunk-NMH43BDC.js +130 -0
  81. package/dist/chunk-NMH43BDC.js.map +1 -0
  82. package/dist/chunk-NORDUD2T.cjs +135 -0
  83. package/dist/chunk-NORDUD2T.cjs.map +1 -0
  84. package/dist/chunk-NV4JOKWL.cjs +197 -0
  85. package/dist/chunk-NV4JOKWL.cjs.map +1 -0
  86. package/dist/chunk-O2JG7WY5.cjs +121 -0
  87. package/dist/chunk-O2JG7WY5.cjs.map +1 -0
  88. package/dist/chunk-ONO2FTV4.cjs +68 -0
  89. package/dist/chunk-ONO2FTV4.cjs.map +1 -0
  90. package/dist/chunk-OQB6HIUL.cjs +108 -0
  91. package/dist/chunk-OQB6HIUL.cjs.map +1 -0
  92. package/dist/chunk-OS6CMYAS.cjs +79 -0
  93. package/dist/chunk-OS6CMYAS.cjs.map +1 -0
  94. package/dist/chunk-PYURPUTV.js +402 -0
  95. package/dist/chunk-PYURPUTV.js.map +1 -0
  96. package/dist/chunk-RJ3HYZ7S.js +44 -0
  97. package/dist/chunk-RJ3HYZ7S.js.map +1 -0
  98. package/dist/chunk-RZNRIOLT.js +128 -0
  99. package/dist/chunk-RZNRIOLT.js.map +1 -0
  100. package/dist/chunk-S3T2L6NA.js +38 -0
  101. package/dist/chunk-S3T2L6NA.js.map +1 -0
  102. package/dist/chunk-S5IPJQZ3.cjs +161 -0
  103. package/dist/chunk-S5IPJQZ3.cjs.map +1 -0
  104. package/dist/chunk-SB5DSYR5.js +211 -0
  105. package/dist/chunk-SB5DSYR5.js.map +1 -0
  106. package/dist/chunk-SFXV2DUH.js +106 -0
  107. package/dist/chunk-SFXV2DUH.js.map +1 -0
  108. package/dist/chunk-SXEPGD4Z.cjs +152 -0
  109. package/dist/chunk-SXEPGD4Z.cjs.map +1 -0
  110. package/dist/chunk-SXWSOU3Y.js +89 -0
  111. package/dist/chunk-SXWSOU3Y.js.map +1 -0
  112. package/dist/chunk-SZMVOHT7.cjs +107 -0
  113. package/dist/chunk-SZMVOHT7.cjs.map +1 -0
  114. package/dist/chunk-TWJXOV4C.js +145 -0
  115. package/dist/chunk-TWJXOV4C.js.map +1 -0
  116. package/dist/chunk-U3ADRIVO.cjs +434 -0
  117. package/dist/chunk-U3ADRIVO.cjs.map +1 -0
  118. package/dist/chunk-U5FLLCGC.cjs +151 -0
  119. package/dist/chunk-U5FLLCGC.cjs.map +1 -0
  120. package/dist/chunk-UOZN45G4.cjs +130 -0
  121. package/dist/chunk-UOZN45G4.cjs.map +1 -0
  122. package/dist/chunk-VHLDOG74.cjs +167 -0
  123. package/dist/chunk-VHLDOG74.cjs.map +1 -0
  124. package/dist/chunk-YC5KLN6I.js +139 -0
  125. package/dist/chunk-YC5KLN6I.js.map +1 -0
  126. package/dist/chunk-YENXXYUV.cjs +111 -0
  127. package/dist/chunk-YENXXYUV.cjs.map +1 -0
  128. package/dist/chunk-YFQWC2PW.js +113 -0
  129. package/dist/chunk-YFQWC2PW.js.map +1 -0
  130. package/dist/chunk-Z2TY4A75.cjs +700 -0
  131. package/dist/chunk-Z2TY4A75.cjs.map +1 -0
  132. package/dist/chunk-Z56O7UEU.cjs +136 -0
  133. package/dist/chunk-Z56O7UEU.cjs.map +1 -0
  134. package/dist/chunk-ZBZDR4ZC.js +106 -0
  135. package/dist/chunk-ZBZDR4ZC.js.map +1 -0
  136. package/dist/components/charts/PartoAreaChart.cjs +15 -0
  137. package/dist/components/charts/PartoAreaChart.cjs.map +1 -0
  138. package/dist/components/charts/PartoAreaChart.d.cts +53 -0
  139. package/dist/components/charts/PartoAreaChart.d.ts +53 -0
  140. package/dist/components/charts/PartoAreaChart.js +6 -0
  141. package/dist/components/charts/PartoAreaChart.js.map +1 -0
  142. package/dist/components/charts/PartoBarChart.cjs +15 -0
  143. package/dist/components/charts/PartoBarChart.cjs.map +1 -0
  144. package/dist/components/charts/PartoBarChart.d.cts +61 -0
  145. package/dist/components/charts/PartoBarChart.d.ts +61 -0
  146. package/dist/components/charts/PartoBarChart.js +6 -0
  147. package/dist/components/charts/PartoBarChart.js.map +1 -0
  148. package/dist/components/charts/PartoLineChart.cjs +15 -0
  149. package/dist/components/charts/PartoLineChart.cjs.map +1 -0
  150. package/dist/components/charts/PartoLineChart.d.cts +57 -0
  151. package/dist/components/charts/PartoLineChart.d.ts +57 -0
  152. package/dist/components/charts/PartoLineChart.js +6 -0
  153. package/dist/components/charts/PartoLineChart.js.map +1 -0
  154. package/dist/components/charts/PartoPieChart.cjs +15 -0
  155. package/dist/components/charts/PartoPieChart.cjs.map +1 -0
  156. package/dist/components/charts/PartoPieChart.d.cts +52 -0
  157. package/dist/components/charts/PartoPieChart.d.ts +52 -0
  158. package/dist/components/charts/PartoPieChart.js +6 -0
  159. package/dist/components/charts/PartoPieChart.js.map +1 -0
  160. package/dist/components/ui/alert-rule-card.cjs +15 -0
  161. package/dist/components/ui/alert-rule-card.cjs.map +1 -0
  162. package/dist/components/ui/alert-rule-card.d.cts +38 -0
  163. package/dist/components/ui/alert-rule-card.d.ts +38 -0
  164. package/dist/components/ui/alert-rule-card.js +6 -0
  165. package/dist/components/ui/alert-rule-card.js.map +1 -0
  166. package/dist/components/ui/avatar.cjs +21 -0
  167. package/dist/components/ui/avatar.cjs.map +1 -0
  168. package/dist/components/ui/avatar.d.cts +18 -0
  169. package/dist/components/ui/avatar.d.ts +18 -0
  170. package/dist/components/ui/avatar.js +4 -0
  171. package/dist/components/ui/avatar.js.map +1 -0
  172. package/dist/components/ui/badge.cjs +17 -0
  173. package/dist/components/ui/badge.cjs.map +1 -0
  174. package/dist/components/ui/badge.d.cts +16 -0
  175. package/dist/components/ui/badge.d.ts +16 -0
  176. package/dist/components/ui/badge.js +4 -0
  177. package/dist/components/ui/badge.js.map +1 -0
  178. package/dist/components/ui/button.cjs +18 -0
  179. package/dist/components/ui/button.cjs.map +1 -0
  180. package/dist/components/ui/button.d.cts +37 -0
  181. package/dist/components/ui/button.d.ts +37 -0
  182. package/dist/components/ui/button.js +5 -0
  183. package/dist/components/ui/button.js.map +1 -0
  184. package/dist/components/ui/calendar.cjs +15 -0
  185. package/dist/components/ui/calendar.cjs.map +1 -0
  186. package/dist/components/ui/calendar.d.cts +17 -0
  187. package/dist/components/ui/calendar.d.ts +17 -0
  188. package/dist/components/ui/calendar.js +6 -0
  189. package/dist/components/ui/calendar.js.map +1 -0
  190. package/dist/components/ui/card.cjs +37 -0
  191. package/dist/components/ui/card.cjs.map +1 -0
  192. package/dist/components/ui/card.d.cts +18 -0
  193. package/dist/components/ui/card.d.ts +18 -0
  194. package/dist/components/ui/card.js +4 -0
  195. package/dist/components/ui/card.js.map +1 -0
  196. package/dist/components/ui/concept-card.cjs +18 -0
  197. package/dist/components/ui/concept-card.cjs.map +1 -0
  198. package/dist/components/ui/concept-card.d.cts +5 -0
  199. package/dist/components/ui/concept-card.d.ts +5 -0
  200. package/dist/components/ui/concept-card.js +9 -0
  201. package/dist/components/ui/concept-card.js.map +1 -0
  202. package/dist/components/ui/data-table.cjs +18 -0
  203. package/dist/components/ui/data-table.cjs.map +1 -0
  204. package/dist/components/ui/data-table.d.cts +181 -0
  205. package/dist/components/ui/data-table.d.ts +181 -0
  206. package/dist/components/ui/data-table.js +9 -0
  207. package/dist/components/ui/data-table.js.map +1 -0
  208. package/dist/components/ui/dialog.cjs +49 -0
  209. package/dist/components/ui/dialog.cjs.map +1 -0
  210. package/dist/components/ui/dialog.d.cts +22 -0
  211. package/dist/components/ui/dialog.d.ts +22 -0
  212. package/dist/components/ui/dialog.js +4 -0
  213. package/dist/components/ui/dialog.js.map +1 -0
  214. package/dist/components/ui/filter-provider.cjs +20 -0
  215. package/dist/components/ui/filter-provider.cjs.map +1 -0
  216. package/dist/components/ui/filter-provider.d.cts +49 -0
  217. package/dist/components/ui/filter-provider.d.ts +49 -0
  218. package/dist/components/ui/filter-provider.js +3 -0
  219. package/dist/components/ui/filter-provider.js.map +1 -0
  220. package/dist/components/ui/input.cjs +22 -0
  221. package/dist/components/ui/input.cjs.map +1 -0
  222. package/dist/components/ui/input.d.cts +16 -0
  223. package/dist/components/ui/input.d.ts +16 -0
  224. package/dist/components/ui/input.js +5 -0
  225. package/dist/components/ui/input.js.map +1 -0
  226. package/dist/components/ui/iran-province-heat.cjs +13 -0
  227. package/dist/components/ui/iran-province-heat.cjs.map +1 -0
  228. package/dist/components/ui/iran-province-heat.d.cts +64 -0
  229. package/dist/components/ui/iran-province-heat.d.ts +64 -0
  230. package/dist/components/ui/iran-province-heat.js +4 -0
  231. package/dist/components/ui/iran-province-heat.js.map +1 -0
  232. package/dist/components/ui/page-card.cjs +16 -0
  233. package/dist/components/ui/page-card.cjs.map +1 -0
  234. package/dist/components/ui/page-card.d.cts +6 -0
  235. package/dist/components/ui/page-card.d.ts +6 -0
  236. package/dist/components/ui/page-card.js +7 -0
  237. package/dist/components/ui/page-card.js.map +1 -0
  238. package/dist/components/ui/popover.cjs +25 -0
  239. package/dist/components/ui/popover.cjs.map +1 -0
  240. package/dist/components/ui/popover.d.cts +9 -0
  241. package/dist/components/ui/popover.d.ts +9 -0
  242. package/dist/components/ui/popover.js +4 -0
  243. package/dist/components/ui/popover.js.map +1 -0
  244. package/dist/components/ui/saved-query-card.cjs +15 -0
  245. package/dist/components/ui/saved-query-card.cjs.map +1 -0
  246. package/dist/components/ui/saved-query-card.d.cts +41 -0
  247. package/dist/components/ui/saved-query-card.d.ts +41 -0
  248. package/dist/components/ui/saved-query-card.js +6 -0
  249. package/dist/components/ui/saved-query-card.js.map +1 -0
  250. package/dist/components/ui/separator.cjs +13 -0
  251. package/dist/components/ui/separator.cjs.map +1 -0
  252. package/dist/components/ui/separator.d.cts +9 -0
  253. package/dist/components/ui/separator.d.ts +9 -0
  254. package/dist/components/ui/separator.js +4 -0
  255. package/dist/components/ui/separator.js.map +1 -0
  256. package/dist/components/ui/sheet.cjs +45 -0
  257. package/dist/components/ui/sheet.cjs.map +1 -0
  258. package/dist/components/ui/sheet.d.cts +44 -0
  259. package/dist/components/ui/sheet.d.ts +44 -0
  260. package/dist/components/ui/sheet.js +4 -0
  261. package/dist/components/ui/sheet.js.map +1 -0
  262. package/dist/components/ui/sparkline.cjs +13 -0
  263. package/dist/components/ui/sparkline.cjs.map +1 -0
  264. package/dist/components/ui/sparkline.d.cts +36 -0
  265. package/dist/components/ui/sparkline.d.ts +36 -0
  266. package/dist/components/ui/sparkline.js +4 -0
  267. package/dist/components/ui/sparkline.js.map +1 -0
  268. package/dist/components/ui/tooltip.cjs +25 -0
  269. package/dist/components/ui/tooltip.cjs.map +1 -0
  270. package/dist/components/ui/tooltip.d.cts +17 -0
  271. package/dist/components/ui/tooltip.d.ts +17 -0
  272. package/dist/components/ui/tooltip.js +4 -0
  273. package/dist/components/ui/tooltip.js.map +1 -0
  274. package/dist/concept-card-CcOBb2Nz.d.ts +83 -0
  275. package/dist/concept-card-RwPbqJ06.d.cts +83 -0
  276. package/dist/hooks/use-hotkey-registry.cjs +21 -0
  277. package/dist/hooks/use-hotkey-registry.cjs.map +1 -0
  278. package/dist/hooks/use-hotkey-registry.d.cts +65 -0
  279. package/dist/hooks/use-hotkey-registry.d.ts +65 -0
  280. package/dist/hooks/use-hotkey-registry.js +4 -0
  281. package/dist/hooks/use-hotkey-registry.js.map +1 -0
  282. package/dist/hooks/use-hotkeys.cjs +16 -0
  283. package/dist/hooks/use-hotkeys.cjs.map +1 -0
  284. package/dist/hooks/use-hotkeys.d.cts +66 -0
  285. package/dist/hooks/use-hotkeys.d.ts +66 -0
  286. package/dist/hooks/use-hotkeys.js +3 -0
  287. package/dist/hooks/use-hotkeys.js.map +1 -0
  288. package/dist/i18n-ArS3mqj0.d.ts +344 -0
  289. package/dist/i18n-CAd9wGOr.d.cts +344 -0
  290. package/dist/index.cjs +12195 -13224
  291. package/dist/index.cjs.map +1 -1
  292. package/dist/index.css +490 -34
  293. package/dist/index.d.cts +1635 -1263
  294. package/dist/index.d.ts +1635 -1263
  295. package/dist/index.js +10693 -12364
  296. package/dist/index.js.map +1 -1
  297. package/dist/page-card-CmShVqG-.d.cts +100 -0
  298. package/dist/page-card-HBn-cy4J.d.ts +100 -0
  299. package/dist/utils-DlXWmDZ-.d.cts +35 -0
  300. package/dist/utils-DlXWmDZ-.d.ts +35 -0
  301. package/package.json +160 -4
@@ -0,0 +1,940 @@
1
+ import { buttonVariants } from './chunk-3QYYPPFJ.js';
2
+ import { Checkbox } from './chunk-5JJSRGJD.js';
3
+ import { Skeleton } from './chunk-SB5DSYR5.js';
4
+ import { getUIStrings, isRTL } from './chunk-CV3N3HVK.js';
5
+ import { cn, convertToLocalNumbers } from './chunk-4SVQNEVH.js';
6
+ import * as React5 from 'react';
7
+ import { Loader2, ChevronRightIcon, ChevronLeftIcon, MoreHorizontalIcon, ChevronDown, ChevronRight } from 'lucide-react';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+ import { cva } from 'class-variance-authority';
10
+
11
+ function Table({
12
+ className,
13
+ size = "md",
14
+ striped = false,
15
+ bordered = false,
16
+ stickyHeader = false,
17
+ ...props
18
+ }) {
19
+ return /* @__PURE__ */ jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: /* @__PURE__ */ jsx(
20
+ "table",
21
+ {
22
+ "data-slot": "table",
23
+ "data-size": size,
24
+ "data-striped": striped || void 0,
25
+ "data-bordered": bordered || void 0,
26
+ "data-sticky-header": stickyHeader || void 0,
27
+ className: cn("w-full caption-bottom", className),
28
+ ...props
29
+ }
30
+ ) });
31
+ }
32
+ function TableHeader({ className, ...props }) {
33
+ return /* @__PURE__ */ jsx(
34
+ "thead",
35
+ {
36
+ "data-slot": "table-header",
37
+ className: cn(
38
+ "[&_tr]:border-b bg-surface-75",
39
+ "[[data-sticky-header]_&]:sticky [[data-sticky-header]_&]:top-0 [[data-sticky-header]_&]:z-[9] [[data-sticky-header]_&]:bg-surface-75",
40
+ className
41
+ ),
42
+ ...props
43
+ }
44
+ );
45
+ }
46
+ function TableBody({ className, ...props }) {
47
+ return /* @__PURE__ */ jsx(
48
+ "tbody",
49
+ {
50
+ "data-slot": "table-body",
51
+ className: cn(
52
+ "[&_tr:last-child]:border-0",
53
+ "[[data-striped]_&_tr:nth-child(even)]:bg-surface-75 [[data-striped]_&_tr:nth-child(even):hover]:bg-surface-200",
54
+ className
55
+ ),
56
+ ...props
57
+ }
58
+ );
59
+ }
60
+ function TableFooter({ className, ...props }) {
61
+ return /* @__PURE__ */ jsx(
62
+ "tfoot",
63
+ {
64
+ "data-slot": "table-footer",
65
+ className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
66
+ ...props
67
+ }
68
+ );
69
+ }
70
+ function TableRow({ className, ...props }) {
71
+ return /* @__PURE__ */ jsx(
72
+ "tr",
73
+ {
74
+ "data-slot": "table-row",
75
+ className: cn("hover:bg-surface-200 data-[state=selected]:bg-selection border-b transition-colors", className),
76
+ ...props
77
+ }
78
+ );
79
+ }
80
+ function TableHead({ className, sortDirection, ...props }) {
81
+ const ariaSort = sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : sortDirection === "none" ? "none" : void 0;
82
+ return /* @__PURE__ */ jsx(
83
+ "th",
84
+ {
85
+ "data-slot": "table-head",
86
+ "aria-sort": ariaSort,
87
+ className: cn(
88
+ "text-foreground-lighter text-start align-middle font-semibold whitespace-nowrap [&:has([role=checkbox])]:pe-0 [&>[role=checkbox]]:translate-y-[2px]",
89
+ // Size variants (inherited from parent table)
90
+ "[[data-size=sm]_&]:h-8 [[data-size=sm]_&]:px-2 [[data-size=sm]_&]:text-xs",
91
+ "[[data-size=md]_&]:h-10 [[data-size=md]_&]:px-3 [[data-size=md]_&]:text-sm",
92
+ "[[data-size=lg]_&]:h-12 [[data-size=lg]_&]:px-4 [[data-size=lg]_&]:text-base",
93
+ // Bordered variant
94
+ "[[data-bordered]_&]:border [[data-bordered]_&]:border-border",
95
+ className
96
+ ),
97
+ ...props
98
+ }
99
+ );
100
+ }
101
+ function TableCell({ className, ...props }) {
102
+ return /* @__PURE__ */ jsx(
103
+ "td",
104
+ {
105
+ "data-slot": "table-cell",
106
+ className: cn(
107
+ "align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0 [&>[role=checkbox]]:translate-y-[2px]",
108
+ // Size variants (inherited from parent table)
109
+ "[[data-size=sm]_&]:px-2 [[data-size=sm]_&]:py-1.5 [[data-size=sm]_&]:text-xs",
110
+ "[[data-size=md]_&]:px-3 [[data-size=md]_&]:py-2 [[data-size=md]_&]:text-sm",
111
+ "[[data-size=lg]_&]:px-4 [[data-size=lg]_&]:py-3 [[data-size=lg]_&]:text-base",
112
+ // Bordered variant
113
+ "[[data-bordered]_&]:border [[data-bordered]_&]:border-border",
114
+ className
115
+ ),
116
+ ...props
117
+ }
118
+ );
119
+ }
120
+ function TableCaption({ className, ...props }) {
121
+ return /* @__PURE__ */ jsx("caption", { "data-slot": "table-caption", className: cn("text-foreground-muted mt-4 text-sm", className), ...props });
122
+ }
123
+ function TableSortHeader({ className, children, sorted, ...props }) {
124
+ return /* @__PURE__ */ jsxs(
125
+ "button",
126
+ {
127
+ "data-slot": "table-sort-header",
128
+ className: cn(
129
+ "inline-flex items-center gap-1.5 cursor-pointer select-none hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded-sm",
130
+ sorted && "text-foreground",
131
+ className
132
+ ),
133
+ ...props,
134
+ children: [
135
+ children,
136
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex flex-col -space-y-0.5", children: [
137
+ /* @__PURE__ */ jsx(
138
+ "svg",
139
+ {
140
+ width: "8",
141
+ height: "5",
142
+ viewBox: "0 0 8 5",
143
+ className: cn("transition-colors", sorted === "asc" ? "text-foreground" : "text-foreground-muted"),
144
+ children: /* @__PURE__ */ jsx("path", { d: "M4 0L8 5H0L4 0Z", fill: "currentColor" })
145
+ }
146
+ ),
147
+ /* @__PURE__ */ jsx(
148
+ "svg",
149
+ {
150
+ width: "8",
151
+ height: "5",
152
+ viewBox: "0 0 8 5",
153
+ className: cn("transition-colors", sorted === "desc" ? "text-foreground" : "text-foreground-muted"),
154
+ children: /* @__PURE__ */ jsx("path", { d: "M4 5L0 0H8L4 5Z", fill: "currentColor" })
155
+ }
156
+ )
157
+ ] })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ Table.displayName = "Table";
163
+ TableHeader.displayName = "TableHeader";
164
+ TableBody.displayName = "TableBody";
165
+ TableFooter.displayName = "TableFooter";
166
+ TableHead.displayName = "TableHead";
167
+ TableRow.displayName = "TableRow";
168
+ TableCell.displayName = "TableCell";
169
+ TableCaption.displayName = "TableCaption";
170
+ TableSortHeader.displayName = "TableSortHeader";
171
+ var PaginationDirectionContext = React5.createContext("rtl");
172
+ function usePaginationDirection() {
173
+ return React5.useContext(PaginationDirectionContext);
174
+ }
175
+ function Pagination({ className, dir, children, ...props }) {
176
+ const resolvedDir = dir ?? "rtl";
177
+ return /* @__PURE__ */ jsx(PaginationDirectionContext.Provider, { value: resolvedDir, children: /* @__PURE__ */ jsx(
178
+ "nav",
179
+ {
180
+ role: "navigation",
181
+ "aria-label": "pagination",
182
+ "data-slot": "pagination",
183
+ dir: resolvedDir,
184
+ className: cn("mx-auto flex w-full justify-center not-prose", className),
185
+ ...props,
186
+ children
187
+ }
188
+ ) });
189
+ }
190
+ function PaginationContent({ className, ...props }) {
191
+ const dir = usePaginationDirection();
192
+ return /* @__PURE__ */ jsx(
193
+ "ul",
194
+ {
195
+ "data-slot": "pagination-content",
196
+ dir,
197
+ className: cn("flex flex-row items-center gap-1 list-none", className),
198
+ ...props
199
+ }
200
+ );
201
+ }
202
+ function PaginationItem({ ...props }) {
203
+ return /* @__PURE__ */ jsx("li", { "data-slot": "pagination-item", ...props });
204
+ }
205
+ function PaginationLink({ className, isActive, size = "icon", dir, ...props }) {
206
+ const contextDir = usePaginationDirection();
207
+ const linkDir = dir ?? (contextDir === "rtl" ? "rtl" : "ltr");
208
+ return /* @__PURE__ */ jsx(
209
+ "a",
210
+ {
211
+ "aria-current": isActive ? "page" : void 0,
212
+ "data-slot": "pagination-link",
213
+ "data-active": isActive,
214
+ dir: linkDir,
215
+ className: cn(
216
+ buttonVariants({
217
+ variant: "outline",
218
+ size
219
+ }),
220
+ // Remove underline from links
221
+ "no-underline",
222
+ // Active state styling with green color
223
+ isActive && [
224
+ "border-brand-500 bg-brand/10 text-brand-600",
225
+ "dark:border-brand-600 dark:bg-brand/10 dark:text-brand-400",
226
+ "pointer-events-none"
227
+ ],
228
+ className
229
+ ),
230
+ ...props
231
+ }
232
+ );
233
+ }
234
+ function PaginationPrevious({ className, ...props }) {
235
+ const dir = usePaginationDirection();
236
+ const isRTL2 = dir === "rtl";
237
+ const strings = getUIStrings(isRTL2 ? "fa" : "en");
238
+ const Icon = isRTL2 ? ChevronRightIcon : ChevronLeftIcon;
239
+ return /* @__PURE__ */ jsxs(
240
+ PaginationLink,
241
+ {
242
+ "aria-label": strings.goToPreviousPage,
243
+ size: "default",
244
+ className: cn("gap-1 ps-2.5 pe-2.5 no-underline flex items-center", className),
245
+ dir: "ltr",
246
+ ...props,
247
+ children: [
248
+ /* @__PURE__ */ jsx(Icon, { className: "size-4" }),
249
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline no-underline", children: strings.previous })
250
+ ]
251
+ }
252
+ );
253
+ }
254
+ function PaginationNext({ className, ...props }) {
255
+ const dir = usePaginationDirection();
256
+ const isRTL2 = dir === "rtl";
257
+ const strings = getUIStrings(isRTL2 ? "fa" : "en");
258
+ const Icon = isRTL2 ? ChevronLeftIcon : ChevronRightIcon;
259
+ return /* @__PURE__ */ jsx(
260
+ PaginationLink,
261
+ {
262
+ "aria-label": strings.goToNextPage,
263
+ size: "default",
264
+ className: cn("gap-1 ps-2.5 pe-2.5 no-underline flex items-center", className),
265
+ dir: "ltr",
266
+ ...props,
267
+ children: isRTL2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
268
+ /* @__PURE__ */ jsx(Icon, { className: "size-4" }),
269
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline no-underline", children: strings.next })
270
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
271
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline no-underline", children: strings.next }),
272
+ /* @__PURE__ */ jsx(Icon, { className: "size-4" })
273
+ ] })
274
+ }
275
+ );
276
+ }
277
+ function PaginationEllipsis({ className, ...props }) {
278
+ return /* @__PURE__ */ jsxs(
279
+ "span",
280
+ {
281
+ "aria-hidden": true,
282
+ "data-slot": "pagination-ellipsis",
283
+ className: cn("flex size-9 items-center justify-center", className),
284
+ ...props,
285
+ children: [
286
+ /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }),
287
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "More pages" })
288
+ ]
289
+ }
290
+ );
291
+ }
292
+ Pagination.displayName = "Pagination";
293
+ PaginationContent.displayName = "PaginationContent";
294
+ PaginationItem.displayName = "PaginationItem";
295
+ PaginationLink.displayName = "PaginationLink";
296
+ PaginationPrevious.displayName = "PaginationPrevious";
297
+ PaginationNext.displayName = "PaginationNext";
298
+ PaginationEllipsis.displayName = "PaginationEllipsis";
299
+ var PaginationControlled = React5.forwardRef(
300
+ ({
301
+ currentPage,
302
+ totalPages,
303
+ onPageChange,
304
+ siblingCount = 1,
305
+ showFirstLast = false,
306
+ showPrevNext = true,
307
+ showEllipsis = true,
308
+ className,
309
+ locale = "fa"
310
+ }, ref) => {
311
+ const isRTL2 = locale === "fa" || locale === "ar";
312
+ const localizeNumber = (n) => convertToLocalNumbers(String(n), locale);
313
+ const handlePageChange = (page) => {
314
+ if (page >= 1 && page <= totalPages && page !== currentPage) {
315
+ onPageChange(page);
316
+ }
317
+ };
318
+ const generatePageNumbers = () => {
319
+ const pages = [];
320
+ const totalNumbers = siblingCount * 2 + 5;
321
+ const totalBlocks = totalNumbers + 2;
322
+ if (totalPages <= totalBlocks) {
323
+ for (let i = 1; i <= totalPages; i++) {
324
+ pages.push(i);
325
+ }
326
+ } else {
327
+ const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
328
+ const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
329
+ const shouldShowLeftEllipsis = leftSiblingIndex > 2;
330
+ const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
331
+ if (!shouldShowLeftEllipsis && shouldShowRightEllipsis) {
332
+ const leftItemCount = 3 + 2 * siblingCount;
333
+ const leftRange = [];
334
+ for (let i = 1; i <= leftItemCount; i++) {
335
+ leftRange.push(i);
336
+ }
337
+ pages.push(...leftRange);
338
+ if (showEllipsis) pages.push("ellipsis");
339
+ pages.push(totalPages);
340
+ } else if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) {
341
+ pages.push(1);
342
+ if (showEllipsis) pages.push("ellipsis");
343
+ const rightItemCount = 3 + 2 * siblingCount;
344
+ const rightRange = [];
345
+ for (let i = totalPages - rightItemCount + 1; i <= totalPages; i++) {
346
+ rightRange.push(i);
347
+ }
348
+ pages.push(...rightRange);
349
+ } else if (shouldShowLeftEllipsis && shouldShowRightEllipsis) {
350
+ pages.push(1);
351
+ if (showEllipsis) pages.push("ellipsis");
352
+ for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
353
+ pages.push(i);
354
+ }
355
+ if (showEllipsis) pages.push("ellipsis");
356
+ pages.push(totalPages);
357
+ }
358
+ }
359
+ return pages;
360
+ };
361
+ const pageNumbers = generatePageNumbers();
362
+ const showFirstButton = showFirstLast && !pageNumbers.includes(1) && currentPage > 1;
363
+ const showLastButton = showFirstLast && !pageNumbers.includes(totalPages) && currentPage < totalPages;
364
+ return /* @__PURE__ */ jsx(Pagination, { ref, "data-slot": "pagination-controlled", className: cn(className), dir: isRTL2 ? "rtl" : "ltr", children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
365
+ showFirstButton && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
366
+ PaginationLink,
367
+ {
368
+ href: "#",
369
+ onClick: (e) => {
370
+ e.preventDefault();
371
+ handlePageChange(1);
372
+ },
373
+ children: localizeNumber(1)
374
+ }
375
+ ) }),
376
+ showPrevNext && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
377
+ PaginationPrevious,
378
+ {
379
+ href: "#",
380
+ onClick: (e) => {
381
+ e.preventDefault();
382
+ handlePageChange(currentPage - 1);
383
+ },
384
+ className: currentPage === 1 ? "pointer-events-none opacity-50" : ""
385
+ }
386
+ ) }),
387
+ pageNumbers.map((page, index) => {
388
+ if (page === "ellipsis") {
389
+ return /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, `ellipsis-${index}`);
390
+ }
391
+ return /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
392
+ PaginationLink,
393
+ {
394
+ href: "#",
395
+ isActive: page === currentPage,
396
+ onClick: (e) => {
397
+ e.preventDefault();
398
+ handlePageChange(page);
399
+ },
400
+ children: localizeNumber(page)
401
+ }
402
+ ) }, page);
403
+ }),
404
+ showPrevNext && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
405
+ PaginationNext,
406
+ {
407
+ href: "#",
408
+ onClick: (e) => {
409
+ e.preventDefault();
410
+ handlePageChange(currentPage + 1);
411
+ },
412
+ className: currentPage === totalPages ? "pointer-events-none opacity-50" : ""
413
+ }
414
+ ) }),
415
+ showLastButton && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
416
+ PaginationLink,
417
+ {
418
+ href: "#",
419
+ onClick: (e) => {
420
+ e.preventDefault();
421
+ handlePageChange(totalPages);
422
+ },
423
+ children: localizeNumber(totalPages)
424
+ }
425
+ ) })
426
+ ] }) });
427
+ }
428
+ );
429
+ PaginationControlled.displayName = "PaginationControlled";
430
+ function useInfiniteScroll({
431
+ onLoadMore,
432
+ hasMore,
433
+ isLoading = false,
434
+ rootMargin = "200px",
435
+ threshold = 0
436
+ }) {
437
+ const observerRef = React5.useRef(null);
438
+ const callbackRef = React5.useRef(onLoadMore);
439
+ React5.useEffect(() => {
440
+ callbackRef.current = onLoadMore;
441
+ }, [onLoadMore]);
442
+ const hasMoreRef = React5.useRef(hasMore);
443
+ React5.useEffect(() => {
444
+ hasMoreRef.current = hasMore;
445
+ }, [hasMore]);
446
+ const isLoadingRef = React5.useRef(isLoading);
447
+ React5.useEffect(() => {
448
+ isLoadingRef.current = isLoading;
449
+ }, [isLoading]);
450
+ const sentinelRef = React5.useCallback(
451
+ (node) => {
452
+ if (observerRef.current) {
453
+ observerRef.current.disconnect();
454
+ observerRef.current = null;
455
+ }
456
+ if (!node) return;
457
+ observerRef.current = new IntersectionObserver(
458
+ (entries) => {
459
+ const entry = entries[0];
460
+ if (entry?.isIntersecting && hasMoreRef.current && !isLoadingRef.current) {
461
+ callbackRef.current();
462
+ }
463
+ },
464
+ { rootMargin, threshold }
465
+ );
466
+ observerRef.current.observe(node);
467
+ },
468
+ [rootMargin, threshold]
469
+ );
470
+ React5.useEffect(() => {
471
+ return () => {
472
+ observerRef.current?.disconnect();
473
+ };
474
+ }, []);
475
+ return { sentinelRef };
476
+ }
477
+ var spinnerVariants = cva("animate-spin text-muted-foreground", {
478
+ variants: {
479
+ size: {
480
+ xs: "size-3",
481
+ sm: "size-4",
482
+ md: "size-5",
483
+ lg: "size-6",
484
+ xl: "size-8"
485
+ }
486
+ },
487
+ defaultVariants: {
488
+ size: "sm"
489
+ }
490
+ });
491
+ var Spinner = React5.forwardRef(({ className, size, ...props }, ref) => /* @__PURE__ */ jsx(
492
+ "span",
493
+ {
494
+ ref,
495
+ "data-slot": "spinner",
496
+ role: "status",
497
+ "aria-label": "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...",
498
+ className: cn("inline-flex items-center justify-center", className),
499
+ ...props,
500
+ children: /* @__PURE__ */ jsx(Loader2, { className: spinnerVariants({ size }), "aria-hidden": "true" })
501
+ }
502
+ ));
503
+ Spinner.displayName = "Spinner";
504
+ var noop = () => {
505
+ };
506
+ function DataTableInner({
507
+ columns,
508
+ data,
509
+ size = "md",
510
+ isLoading = false,
511
+ loadingRows = 5,
512
+ emptyState,
513
+ pagination,
514
+ sort,
515
+ multiSort,
516
+ footer = false,
517
+ stickyFooter = true,
518
+ onColumnResize,
519
+ selection,
520
+ columnVisibility,
521
+ expansion,
522
+ infiniteScroll,
523
+ virtualize,
524
+ striped = false,
525
+ bordered = false,
526
+ stickyHeader = false,
527
+ className,
528
+ caption,
529
+ resultCount,
530
+ locale = "fa"
531
+ }, ref) {
532
+ const t = getUIStrings(locale);
533
+ const hasSelection = !!selection;
534
+ const hasExpansion = !!expansion;
535
+ const rtl = isRTL(locale);
536
+ const visibleColumns = React5.useMemo(() => {
537
+ return columns.filter((col) => {
538
+ const explicit = columnVisibility?.visible[col.id];
539
+ if (explicit !== void 0) return explicit;
540
+ return col.defaultVisible !== false;
541
+ });
542
+ }, [columns, columnVisibility]);
543
+ const allColumnCount = visibleColumns.length + (hasSelection ? 1 : 0) + (hasExpansion ? 1 : 0);
544
+ const getRowKey = React5.useMemo(
545
+ () => selection?.getRowKey ?? ((_, index) => index),
546
+ [selection?.getRowKey]
547
+ );
548
+ const allRowKeys = React5.useMemo(() => data.map((row, i) => getRowKey(row, i)), [data, getRowKey]);
549
+ const allSelected = hasSelection && data.length > 0 && allRowKeys.every((key) => selection.selectedRows.has(key));
550
+ const someSelected = hasSelection && !allSelected && allRowKeys.some((key) => selection.selectedRows.has(key));
551
+ const handleSelectAll = () => {
552
+ if (!selection) return;
553
+ if (allSelected) {
554
+ selection.onSelectionChange(/* @__PURE__ */ new Set());
555
+ } else {
556
+ selection.onSelectionChange(new Set(allRowKeys));
557
+ }
558
+ };
559
+ const handleSelectRow = (key) => {
560
+ if (!selection) return;
561
+ const next = new Set(selection.selectedRows);
562
+ if (next.has(key)) {
563
+ next.delete(key);
564
+ } else {
565
+ next.add(key);
566
+ }
567
+ selection.onSelectionChange(next);
568
+ };
569
+ const handleSort = (columnId, e) => {
570
+ if (multiSort) {
571
+ const isShift = !!e && "shiftKey" in e && e.shiftKey;
572
+ const existing = multiSort.rules.find((r) => r.column === columnId);
573
+ const maxRules = multiSort.maxRules ?? 3;
574
+ let next;
575
+ if (!isShift) {
576
+ if (existing) {
577
+ next = [{ column: columnId, direction: existing.direction === "asc" ? "desc" : "asc" }];
578
+ } else {
579
+ next = [{ column: columnId, direction: "asc" }];
580
+ }
581
+ } else {
582
+ if (existing) {
583
+ if (existing.direction === "asc") {
584
+ next = multiSort.rules.map((r) => r.column === columnId ? { ...r, direction: "desc" } : r);
585
+ } else {
586
+ next = multiSort.rules.filter((r) => r.column !== columnId);
587
+ }
588
+ } else {
589
+ next = [...multiSort.rules, { column: columnId, direction: "asc" }].slice(0, maxRules);
590
+ }
591
+ }
592
+ multiSort.onSortChange(next);
593
+ return;
594
+ }
595
+ if (!sort) return;
596
+ const nextDirection = sort.column === columnId && sort.direction === "asc" ? "desc" : "asc";
597
+ sort.onSort(columnId, nextDirection);
598
+ };
599
+ const getSortDir = (columnId) => {
600
+ if (multiSort) {
601
+ const rule = multiSort.rules.find((r) => r.column === columnId);
602
+ return rule ? rule.direction : "none";
603
+ }
604
+ if (!sort || sort.column !== columnId || !sort.direction) return "none";
605
+ return sort.direction;
606
+ };
607
+ const getSortPriority = (columnId) => {
608
+ if (!multiSort) return 0;
609
+ const idx = multiSort.rules.findIndex((r) => r.column === columnId);
610
+ return idx === -1 ? 0 : idx + 1;
611
+ };
612
+ const alignClass = (align) => {
613
+ if (align === "center") return "text-center";
614
+ if (align === "end") return "text-end";
615
+ return "text-start";
616
+ };
617
+ const pinClass = (pinned) => {
618
+ if (!pinned) return "";
619
+ const sideClass = pinned === "start" ? "sticky inset-inline-start-0 z-[1]" : "sticky inset-inline-end-0 z-[1]";
620
+ return `${sideClass} bg-background`;
621
+ };
622
+ const handleToggleExpand = (rowKey) => {
623
+ if (!expansion) return;
624
+ const next = new Set(expansion.expandedRows);
625
+ if (next.has(rowKey)) next.delete(rowKey);
626
+ else next.add(rowKey);
627
+ expansion.onExpandedRowsChange(next);
628
+ };
629
+ const [resizeWidths, setResizeWidths] = React5.useState({});
630
+ const dragRef = React5.useRef(null);
631
+ const startResize = React5.useCallback(
632
+ (columnId, e) => {
633
+ const col = columns.find((c) => c.id === columnId);
634
+ if (!col) return;
635
+ const headerCell = e.currentTarget.closest("th");
636
+ const measured = headerCell?.getBoundingClientRect().width || 0;
637
+ const startWidth = typeof col.width === "number" ? col.width : measured > 0 ? measured : 120;
638
+ dragRef.current = {
639
+ columnId,
640
+ startX: e.clientX,
641
+ startWidth,
642
+ currentWidth: startWidth,
643
+ minWidth: col.minWidth ?? 60,
644
+ maxWidth: col.maxWidth ?? 800
645
+ };
646
+ e.currentTarget.setPointerCapture?.(e.pointerId);
647
+ e.preventDefault();
648
+ e.stopPropagation();
649
+ },
650
+ [columns]
651
+ );
652
+ const onResizePointerMove = React5.useCallback(
653
+ (e) => {
654
+ const drag = dragRef.current;
655
+ if (!drag) return;
656
+ const dx = (rtl ? -1 : 1) * (e.clientX - drag.startX);
657
+ const next = Math.max(drag.minWidth, Math.min(drag.maxWidth, drag.startWidth + dx));
658
+ drag.currentWidth = next;
659
+ setResizeWidths((prev) => prev[drag.columnId] === next ? prev : { ...prev, [drag.columnId]: next });
660
+ },
661
+ [rtl]
662
+ );
663
+ const endResize = React5.useCallback(
664
+ (e) => {
665
+ const drag = dragRef.current;
666
+ if (!drag) return;
667
+ onColumnResize?.(drag.columnId, drag.currentWidth);
668
+ dragRef.current = null;
669
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
670
+ },
671
+ [onColumnResize]
672
+ );
673
+ const getColumnWidth = (col) => {
674
+ return resizeWidths[col.id] ?? col.width;
675
+ };
676
+ const handleResizeKeyDown = React5.useCallback(
677
+ (columnId, e) => {
678
+ const isArrowGrow = rtl ? e.key === "ArrowLeft" : e.key === "ArrowRight";
679
+ const isArrowShrink = rtl ? e.key === "ArrowRight" : e.key === "ArrowLeft";
680
+ if (!isArrowGrow && !isArrowShrink && e.key !== "Home" && e.key !== "End") return;
681
+ const col = columns.find((c) => c.id === columnId);
682
+ if (!col) return;
683
+ const headerCell = e.currentTarget.closest("th");
684
+ const measured = headerCell?.getBoundingClientRect().width || 0;
685
+ const minWidth = col.minWidth ?? 60;
686
+ const maxWidth = col.maxWidth ?? 800;
687
+ const current = resizeWidths[columnId] ?? (typeof col.width === "number" ? col.width : measured > 0 ? measured : 120);
688
+ const step = e.shiftKey ? 32 : 8;
689
+ let next;
690
+ if (e.key === "Home") next = minWidth;
691
+ else if (e.key === "End") next = maxWidth;
692
+ else if (isArrowGrow) next = Math.min(maxWidth, current + step);
693
+ else next = Math.max(minWidth, current - step);
694
+ e.preventDefault();
695
+ setResizeWidths((prev) => prev[columnId] === next ? prev : { ...prev, [columnId]: next });
696
+ onColumnResize?.(columnId, next);
697
+ },
698
+ [columns, resizeWidths, rtl, onColumnResize]
699
+ );
700
+ const { sentinelRef } = useInfiniteScroll({
701
+ onLoadMore: infiniteScroll?.onLoadMore ?? noop,
702
+ hasMore: !!infiniteScroll?.hasMore,
703
+ isLoading: !!infiniteScroll?.isLoadingMore,
704
+ rootMargin: infiniteScroll?.rootMargin ?? "200px"
705
+ });
706
+ const virtRowHeight = virtualize?.rowHeight ?? 0;
707
+ const virtViewportHeight = virtualize?.viewportHeight ?? 480;
708
+ const virtOverscan = virtualize?.overscan ?? 6;
709
+ const virtScrollRef = React5.useRef(null);
710
+ const [virtScrollTop, setVirtScrollTop] = React5.useState(0);
711
+ const handleVirtScroll = React5.useCallback((e) => {
712
+ setVirtScrollTop(e.currentTarget.scrollTop);
713
+ }, []);
714
+ const { virtStartIndex, virtEndIndex, virtTopSpacer, virtBottomSpacer } = React5.useMemo(() => {
715
+ if (!virtualize || data.length === 0) {
716
+ return { virtStartIndex: 0, virtEndIndex: data.length, virtTopSpacer: 0, virtBottomSpacer: 0 };
717
+ }
718
+ const start = Math.max(0, Math.floor(virtScrollTop / virtRowHeight) - virtOverscan);
719
+ const visibleCount = Math.ceil(virtViewportHeight / virtRowHeight) + virtOverscan * 2;
720
+ const end = Math.min(data.length, start + visibleCount);
721
+ return {
722
+ virtStartIndex: start,
723
+ virtEndIndex: end,
724
+ virtTopSpacer: start * virtRowHeight,
725
+ virtBottomSpacer: (data.length - end) * virtRowHeight
726
+ };
727
+ }, [virtualize, data.length, virtScrollTop, virtRowHeight, virtViewportHeight, virtOverscan]);
728
+ return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "data-table", className: cn("flex flex-col gap-4", className), children: [
729
+ resultCount && /* @__PURE__ */ jsx("div", { "data-slot": "data-table-result-count", className: "text-sm text-foreground-muted", children: resultCount }),
730
+ /* @__PURE__ */ jsx(
731
+ "div",
732
+ {
733
+ ref: virtualize ? virtScrollRef : void 0,
734
+ onScroll: virtualize ? handleVirtScroll : void 0,
735
+ style: virtualize ? { maxHeight: virtViewportHeight, overflowY: "auto" } : void 0,
736
+ "data-slot": virtualize ? "data-table-virtual-scroll" : void 0,
737
+ children: /* @__PURE__ */ jsxs(Table, { size, striped, bordered, stickyHeader: stickyHeader || !!virtualize, children: [
738
+ caption && /* @__PURE__ */ jsx("caption", { className: "text-foreground-muted mt-4 text-sm", children: caption }),
739
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
740
+ hasSelection && /* @__PURE__ */ jsx(TableHead, { className: cn("w-[40px]", pinClass("start")), children: /* @__PURE__ */ jsx(
741
+ Checkbox,
742
+ {
743
+ checked: allSelected ? true : someSelected ? "indeterminate" : false,
744
+ onCheckedChange: handleSelectAll,
745
+ "aria-label": t.selectAll
746
+ }
747
+ ) }),
748
+ hasExpansion && /* @__PURE__ */ jsx(TableHead, { className: cn("w-[36px]", pinClass("start")), "aria-hidden": "true" }),
749
+ visibleColumns.map((col) => {
750
+ const sortable = col.sortable && (sort || multiSort);
751
+ const dir = sortable ? getSortDir(col.id) : "none";
752
+ const priority = getSortPriority(col.id);
753
+ const liveWidth = getColumnWidth(col);
754
+ return /* @__PURE__ */ jsxs(
755
+ TableHead,
756
+ {
757
+ sortDirection: sortable ? dir : void 0,
758
+ className: cn("relative", alignClass(col.align), pinClass(col.pinned), col.className),
759
+ style: liveWidth ? { width: liveWidth } : void 0,
760
+ children: [
761
+ sortable ? /* @__PURE__ */ jsx(
762
+ TableSortHeader,
763
+ {
764
+ sorted: dir === "none" ? false : dir,
765
+ onClick: (e) => handleSort(col.id, e),
766
+ children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
767
+ col.header,
768
+ priority > 0 && multiSort && multiSort.rules.length > 1 && /* @__PURE__ */ jsx(
769
+ "span",
770
+ {
771
+ "data-slot": "data-table-sort-priority",
772
+ className: "inline-flex h-4 min-w-4 items-center justify-center rounded bg-overlay-active px-1 text-[10px] font-medium tabular-nums text-foreground-light",
773
+ "aria-label": `\u0627\u0648\u0644\u0648\u06CC\u062A \u0645\u0631\u062A\u0628\u200C\u0633\u0627\u0632\u06CC ${priority}`,
774
+ children: priority
775
+ }
776
+ )
777
+ ] })
778
+ }
779
+ ) : col.header,
780
+ col.resizable && // role="separator" + tabIndex + ArrowKey handler is the
781
+ // WAI-ARIA windowsplitter pattern (resizable separator).
782
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
783
+ /* @__PURE__ */ jsx(
784
+ "div",
785
+ {
786
+ "data-slot": "data-table-resize-handle",
787
+ role: "separator",
788
+ "aria-orientation": "vertical",
789
+ "aria-label": "\u062A\u063A\u06CC\u06CC\u0631 \u0627\u0646\u062F\u0627\u0632\u0647 \u0633\u062A\u0648\u0646",
790
+ tabIndex: 0,
791
+ "aria-valuenow": getColumnWidth(col),
792
+ "aria-valuemin": col.minWidth ?? 60,
793
+ "aria-valuemax": col.maxWidth ?? 800,
794
+ onKeyDown: (e) => handleResizeKeyDown(col.id, e),
795
+ onPointerDown: (e) => startResize(col.id, e),
796
+ onPointerMove: onResizePointerMove,
797
+ onPointerUp: endResize,
798
+ onPointerCancel: endResize,
799
+ className: cn(
800
+ "absolute inset-block-0 inset-inline-end-0 w-1.5 cursor-col-resize select-none touch-none",
801
+ "before:absolute before:inset-block-2 before:inset-inline-1/2 before:w-px before:-translate-x-1/2 before:bg-border-default before:opacity-0 before:transition-opacity",
802
+ "hover:before:opacity-100 focus:before:opacity-100 focus-visible:outline-none focus-visible:before:!bg-brand focus-visible:before:opacity-100",
803
+ dragRef.current?.columnId === col.id && "before:!bg-brand before:opacity-100"
804
+ )
805
+ }
806
+ )
807
+ ]
808
+ },
809
+ col.id
810
+ );
811
+ })
812
+ ] }) }),
813
+ /* @__PURE__ */ jsxs(TableBody, { children: [
814
+ virtualize && !isLoading && data.length > 0 && virtTopSpacer > 0 && /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", "data-slot": "data-table-virtual-spacer-top", children: /* @__PURE__ */ jsx("td", { colSpan: allColumnCount, style: { height: virtTopSpacer, padding: 0 } }) }),
815
+ isLoading ? Array.from({ length: loadingRows }).map((_, rowIdx) => /* @__PURE__ */ jsxs(TableRow, { children: [
816
+ hasSelection && /* @__PURE__ */ jsx(TableCell, { className: pinClass("start"), children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }) }),
817
+ hasExpansion && /* @__PURE__ */ jsx(TableCell, { className: pinClass("start"), children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }) }),
818
+ visibleColumns.map((col) => {
819
+ const liveWidth = getColumnWidth(col);
820
+ return /* @__PURE__ */ jsx(
821
+ TableCell,
822
+ {
823
+ className: cn(alignClass(col.align), pinClass(col.pinned), col.className),
824
+ style: liveWidth ? { width: liveWidth } : void 0,
825
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full max-w-[120px]" })
826
+ },
827
+ col.id
828
+ );
829
+ })
830
+ ] }, `skeleton-${rowIdx}`)) : data.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: allColumnCount, children: emptyState || /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-10 text-foreground-muted text-sm", children: t.noDataToDisplay }) }) }) : (virtualize ? data.slice(virtStartIndex, virtEndIndex) : data).map((row, sliceIdx) => {
831
+ const rowIdx = virtualize ? virtStartIndex + sliceIdx : sliceIdx;
832
+ const rowKey = getRowKey(row, rowIdx);
833
+ const isSelected = hasSelection && selection.selectedRows.has(rowKey);
834
+ const isExpanded = hasExpansion && expansion.expandedRows.has(rowKey);
835
+ const ChevronIcon = ChevronRight;
836
+ return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
837
+ /* @__PURE__ */ jsxs(TableRow, { "data-state": isSelected ? "selected" : void 0, children: [
838
+ hasSelection && /* @__PURE__ */ jsx(TableCell, { className: pinClass("start"), children: /* @__PURE__ */ jsx(
839
+ Checkbox,
840
+ {
841
+ checked: isSelected,
842
+ onCheckedChange: () => handleSelectRow(rowKey),
843
+ "aria-label": `${t.selectRow} ${(rowIdx + 1).toLocaleString(locale === "fa" ? "fa-IR" : locale === "ar" ? "ar-SA" : "en-US")}`
844
+ }
845
+ ) }),
846
+ hasExpansion && /* @__PURE__ */ jsx(TableCell, { className: pinClass("start"), children: /* @__PURE__ */ jsx(
847
+ "button",
848
+ {
849
+ type: "button",
850
+ "aria-label": isExpanded ? "collapse" : "expand",
851
+ "aria-expanded": isExpanded,
852
+ onClick: () => handleToggleExpand(rowKey),
853
+ className: "inline-flex size-6 items-center justify-center rounded text-foreground-lighter hover:bg-surface-100 hover:text-foreground transition-colors",
854
+ children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronIcon, { className: cn("size-4", rtl && "rotate-180"), "aria-hidden": "true" })
855
+ }
856
+ ) }),
857
+ visibleColumns.map((col) => {
858
+ const liveWidth = getColumnWidth(col);
859
+ return /* @__PURE__ */ jsx(
860
+ TableCell,
861
+ {
862
+ className: cn(alignClass(col.align), pinClass(col.pinned), col.className),
863
+ style: liveWidth ? { width: liveWidth } : void 0,
864
+ children: col.cell(row, rowIdx)
865
+ },
866
+ col.id
867
+ );
868
+ })
869
+ ] }),
870
+ hasExpansion && isExpanded && /* @__PURE__ */ jsx(TableRow, { "data-slot": "data-table-expanded-row", children: /* @__PURE__ */ jsx(TableCell, { colSpan: allColumnCount, className: "bg-surface-100/50 border-t-0", children: expansion.renderExpandedRow(row, rowIdx) }) })
871
+ ] }, rowKey);
872
+ }),
873
+ virtualize && !isLoading && data.length > 0 && virtBottomSpacer > 0 && /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", "data-slot": "data-table-virtual-spacer-bottom", children: /* @__PURE__ */ jsx("td", { colSpan: allColumnCount, style: { height: virtBottomSpacer, padding: 0 } }) }),
874
+ infiniteScroll && !isLoading && data.length > 0 && infiniteScroll.hasMore && /* @__PURE__ */ jsx("tr", { "data-slot": "data-table-infinite-sentinel", "aria-hidden": !infiniteScroll.isLoadingMore, children: /* @__PURE__ */ jsx(
875
+ "td",
876
+ {
877
+ ref: sentinelRef,
878
+ colSpan: allColumnCount,
879
+ className: "border-0",
880
+ children: infiniteScroll.isLoadingMore ? infiniteScroll.loadingMoreContent ?? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-sm text-foreground-lighter", children: [
881
+ /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
882
+ /* @__PURE__ */ jsx("span", { children: t.loading ?? "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC" })
883
+ ] }) : /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "h-px" })
884
+ }
885
+ ) }),
886
+ infiniteScroll && !isLoading && data.length > 0 && !infiniteScroll.hasMore && infiniteScroll.endContent && /* @__PURE__ */ jsx("tr", { "data-slot": "data-table-infinite-end", children: /* @__PURE__ */ jsx("td", { colSpan: allColumnCount, className: "border-0 py-3 text-center text-xs text-foreground-lighter", children: infiniteScroll.endContent }) })
887
+ ] }),
888
+ footer && visibleColumns.some((c) => !!c.footer) && !isLoading && data.length > 0 && /* @__PURE__ */ jsx(
889
+ "tfoot",
890
+ {
891
+ "data-slot": "data-table-footer",
892
+ "data-sticky": stickyFooter || void 0,
893
+ className: cn(
894
+ "bg-surface-75 border-t border-border-default font-medium",
895
+ stickyFooter && "[&>tr>td]:sticky [&>tr>td]:inset-block-end-0 [&>tr>td]:bg-surface-75 [&>tr>td]:z-[8]"
896
+ ),
897
+ children: /* @__PURE__ */ jsxs("tr", { children: [
898
+ hasSelection && /* @__PURE__ */ jsx("td", { className: pinClass("start"), "aria-hidden": "true" }),
899
+ hasExpansion && /* @__PURE__ */ jsx("td", { className: pinClass("start"), "aria-hidden": "true" }),
900
+ visibleColumns.map((col) => {
901
+ const liveWidth = getColumnWidth(col);
902
+ return /* @__PURE__ */ jsx(
903
+ "td",
904
+ {
905
+ className: cn(
906
+ alignClass(col.align),
907
+ pinClass(col.pinned),
908
+ col.className,
909
+ "[[data-size=sm]_&]:px-2 [[data-size=sm]_&]:py-1.5 [[data-size=sm]_&]:text-xs",
910
+ "[[data-size=md]_&]:px-3 [[data-size=md]_&]:py-2 [[data-size=md]_&]:text-sm",
911
+ "[[data-size=lg]_&]:px-4 [[data-size=lg]_&]:py-3 [[data-size=lg]_&]:text-base"
912
+ ),
913
+ style: liveWidth ? { width: liveWidth } : void 0,
914
+ children: col.footer ? col.footer() : null
915
+ },
916
+ col.id
917
+ );
918
+ })
919
+ ] })
920
+ }
921
+ )
922
+ ] })
923
+ }
924
+ ),
925
+ pagination && pagination.totalPages > 1 && /* @__PURE__ */ jsx("div", { "data-slot": "data-table-pagination", className: "flex justify-center", children: /* @__PURE__ */ jsx(
926
+ PaginationControlled,
927
+ {
928
+ currentPage: pagination.currentPage,
929
+ totalPages: pagination.totalPages,
930
+ onPageChange: pagination.onPageChange
931
+ }
932
+ ) })
933
+ ] });
934
+ }
935
+ var DataTable = React5.forwardRef(DataTableInner);
936
+ DataTable.displayName = "DataTable";
937
+
938
+ export { DataTable, Pagination, PaginationContent, PaginationControlled, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Spinner, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSortHeader, spinnerVariants, useInfiniteScroll };
939
+ //# sourceMappingURL=chunk-GCZ6YATL.js.map
940
+ //# sourceMappingURL=chunk-GCZ6YATL.js.map