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