@customafk/lunas-ui 0.2.78 → 0.2.80
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/dist/{analysis-panel-CQZ0hmfN.cjs → analysis-panel-Bg0lCfWv.cjs} +2 -2
- package/dist/{analysis-panel-CQZ0hmfN.cjs.map → analysis-panel-Bg0lCfWv.cjs.map} +1 -1
- package/dist/{analysis-panel-BqZmOU58.mjs → analysis-panel-Cop-l4lx.mjs} +2 -2
- package/dist/{analysis-panel-BqZmOU58.mjs.map → analysis-panel-Cop-l4lx.mjs.map} +1 -1
- package/dist/{badge-display-RP5VTE10.mjs → badge-display-B0BKsU9T.mjs} +2 -2
- package/dist/{badge-display-RP5VTE10.mjs.map → badge-display-B0BKsU9T.mjs.map} +1 -1
- package/dist/{badge-display-DmCKpGk9.cjs → badge-display-Dv2UTvzp.cjs} +2 -2
- package/dist/{badge-display-DmCKpGk9.cjs.map → badge-display-Dv2UTvzp.cjs.map} +1 -1
- package/dist/{boolean-display-B9qxrF5f.mjs → boolean-display-CMX5AupA.mjs} +2 -2
- package/dist/{boolean-display-B9qxrF5f.mjs.map → boolean-display-CMX5AupA.mjs.map} +1 -1
- package/dist/{boolean-display-BwB-l9k0.cjs → boolean-display-CPX7H39m.cjs} +2 -2
- package/dist/{boolean-display-BwB-l9k0.cjs.map → boolean-display-CPX7H39m.cjs.map} +1 -1
- package/dist/{currency-display-CEg_HRYv.mjs → currency-display-CanjOswc.mjs} +2 -2
- package/dist/{currency-display-CEg_HRYv.mjs.map → currency-display-CanjOswc.mjs.map} +1 -1
- package/dist/{currency-display-Buxc6Ph5.cjs → currency-display-xxK62yo4.cjs} +2 -2
- package/dist/{currency-display-Buxc6Ph5.cjs.map → currency-display-xxK62yo4.cjs.map} +1 -1
- package/dist/data-display/statistic.cjs +1 -1
- package/dist/data-display/statistic.cjs.map +1 -1
- package/dist/data-display/statistic.mjs +1 -1
- package/dist/data-display/statistic.mjs.map +1 -1
- package/dist/date-display-DMPhFq8v.cjs +2 -0
- package/dist/date-display-DMPhFq8v.cjs.map +1 -0
- package/dist/date-display-YE8NIIrl.mjs +2 -0
- package/dist/date-display-YE8NIIrl.mjs.map +1 -0
- package/dist/{description-display-CW0g3aJa.mjs → description-display-B4KoH6ql.mjs} +2 -2
- package/dist/{description-display-CW0g3aJa.mjs.map → description-display-B4KoH6ql.mjs.map} +1 -1
- package/dist/{description-display-BR8nXqc_.cjs → description-display-jmAaeMBD.cjs} +2 -2
- package/dist/{description-display-BR8nXqc_.cjs.map → description-display-jmAaeMBD.cjs.map} +1 -1
- package/dist/detail-dialog-BCM0iEXQ.cjs +2 -0
- package/dist/detail-dialog-BCM0iEXQ.cjs.map +1 -0
- package/dist/detail-dialog-DwfTi9Fl.mjs +2 -0
- package/dist/detail-dialog-DwfTi9Fl.mjs.map +1 -0
- package/dist/dialogs/detail-dialog/index.cjs +1 -1
- package/dist/dialogs/detail-dialog/index.d.cts +1 -1
- package/dist/dialogs/detail-dialog/index.d.mts +1 -1
- package/dist/dialogs/detail-dialog/index.mjs +1 -1
- package/dist/{email-display-DqKYq0iM.cjs → email-display-CzvqQMhG.cjs} +2 -2
- package/dist/{email-display-DqKYq0iM.cjs.map → email-display-CzvqQMhG.cjs.map} +1 -1
- package/dist/{email-display-BKcoWmPK.mjs → email-display-D_k7AUmp.mjs} +2 -2
- package/dist/{email-display-BKcoWmPK.mjs.map → email-display-D_k7AUmp.mjs.map} +1 -1
- package/dist/features/descriptions/index.cjs +1 -1
- package/dist/features/descriptions/index.cjs.map +1 -1
- package/dist/features/descriptions/index.mjs +1 -1
- package/dist/features/descriptions/index.mjs.map +1 -1
- package/dist/features/file-icons/index.cjs +2 -0
- package/dist/features/file-icons/index.cjs.map +1 -0
- package/dist/features/file-icons/index.d.cts +34 -0
- package/dist/features/file-icons/index.d.mts +34 -0
- package/dist/features/file-icons/index.mjs +2 -0
- package/dist/features/file-icons/index.mjs.map +1 -0
- package/dist/features/tables/index.cjs +1 -1
- package/dist/features/tables/index.mjs +1 -1
- package/dist/{filter-DqedvThM.cjs → filter-B5EnnL9I.cjs} +2 -2
- package/dist/{filter-DqedvThM.cjs.map → filter-B5EnnL9I.cjs.map} +1 -1
- package/dist/{filter-CWuRGTl4.mjs → filter-BCNjqiBx.mjs} +2 -2
- package/dist/{filter-CWuRGTl4.mjs.map → filter-BCNjqiBx.mjs.map} +1 -1
- package/dist/{index-BOifmu0V.d.cts → index-BXqx1kOJ.d.cts} +4 -2
- package/dist/{index-BOifmu0V.d.mts → index-BXqx1kOJ.d.mts} +4 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/list-display-DPxZ_Jbf.cjs +2 -0
- package/dist/list-display-DPxZ_Jbf.cjs.map +1 -0
- package/dist/list-display-M43N3kle.mjs +2 -0
- package/dist/list-display-M43N3kle.mjs.map +1 -0
- package/dist/{name-display-B-FtblLL.cjs → name-display-BJ1wPUnS.cjs} +2 -2
- package/dist/{name-display-B-FtblLL.cjs.map → name-display-BJ1wPUnS.cjs.map} +1 -1
- package/dist/{name-display-CB9XAhXP.mjs → name-display-pWhLLS05.mjs} +2 -2
- package/dist/{name-display-CB9XAhXP.mjs.map → name-display-pWhLLS05.mjs.map} +1 -1
- package/dist/{permalink-I-INEarM.mjs → permalink-BaMvnKIz.mjs} +2 -2
- package/dist/{permalink-I-INEarM.mjs.map → permalink-BaMvnKIz.mjs.map} +1 -1
- package/dist/{permalink-CUIKG9VA.cjs → permalink-CMcI__V4.cjs} +2 -2
- package/dist/{permalink-CUIKG9VA.cjs.map → permalink-CMcI__V4.cjs.map} +1 -1
- package/dist/{phone-number-DJvfJg1b.cjs → phone-number-F9I9sNLK.cjs} +2 -2
- package/dist/{phone-number-DJvfJg1b.cjs.map → phone-number-F9I9sNLK.cjs.map} +1 -1
- package/dist/{phone-number-Cu7Mnl6J.mjs → phone-number-ao2oCmrO.mjs} +2 -2
- package/dist/{phone-number-Cu7Mnl6J.mjs.map → phone-number-ao2oCmrO.mjs.map} +1 -1
- package/dist/{progress-display-DbfN7U8m.cjs → progress-display-F8xXJ3T1.cjs} +2 -2
- package/dist/{progress-display-DbfN7U8m.cjs.map → progress-display-F8xXJ3T1.cjs.map} +1 -1
- package/dist/{progress-display-qgvclwy9.mjs → progress-display-atwRFD6e.mjs} +2 -2
- package/dist/{progress-display-qgvclwy9.mjs.map → progress-display-atwRFD6e.mjs.map} +1 -1
- package/dist/{statistic-LL4uHlRb.cjs → statistic-B9OqfhOl.cjs} +2 -2
- package/dist/{statistic-LL4uHlRb.cjs.map → statistic-B9OqfhOl.cjs.map} +1 -1
- package/dist/{statistic-ClkqqDfk.mjs → statistic-CJVc9sNs.mjs} +2 -2
- package/dist/{statistic-ClkqqDfk.mjs.map → statistic-CJVc9sNs.mjs.map} +1 -1
- package/dist/{status-display-BUphOF18.mjs → status-display-DInGGgiP.mjs} +2 -2
- package/dist/{status-display-BUphOF18.mjs.map → status-display-DInGGgiP.mjs.map} +1 -1
- package/dist/{status-display-o9inMVvb.cjs → status-display-DpKsYvZJ.cjs} +2 -2
- package/dist/{status-display-o9inMVvb.cjs.map → status-display-DpKsYvZJ.cjs.map} +1 -1
- package/dist/{summary-bar-Mb1B9Dnf.cjs → summary-bar-DKZh-VSB.cjs} +2 -2
- package/dist/{summary-bar-Mb1B9Dnf.cjs.map → summary-bar-DKZh-VSB.cjs.map} +1 -1
- package/dist/{summary-bar-CYfgdxrQ.mjs → summary-bar-DX_sOiuL.mjs} +2 -2
- package/dist/{summary-bar-CYfgdxrQ.mjs.map → summary-bar-DX_sOiuL.mjs.map} +1 -1
- package/dist/{tables-BGzwkdFO.mjs → tables-7_KgoyS-.mjs} +2 -2
- package/dist/{tables-BGzwkdFO.mjs.map → tables-7_KgoyS-.mjs.map} +1 -1
- package/dist/{tables-078i-X0d.cjs → tables-CS3NhgTc.cjs} +2 -2
- package/dist/{tables-078i-X0d.cjs.map → tables-CS3NhgTc.cjs.map} +1 -1
- package/dist/{tooltip-BcfELg8e.cjs → tooltip-BcQG6Zw9.cjs} +2 -2
- package/dist/{tooltip-BcfELg8e.cjs.map → tooltip-BcQG6Zw9.cjs.map} +1 -1
- package/dist/{tooltip-TGmzPdoR.mjs → tooltip-C6flMQgc.mjs} +2 -2
- package/dist/{tooltip-TGmzPdoR.mjs.map → tooltip-C6flMQgc.mjs.map} +1 -1
- package/dist/ui/file-uploader.cjs +2 -2
- package/dist/ui/file-uploader.cjs.map +1 -1
- package/dist/ui/file-uploader.mjs +2 -2
- package/dist/ui/file-uploader.mjs.map +1 -1
- package/package.json +5 -1
- package/dist/date-display-BgI7Wjqf.cjs +0 -2
- package/dist/date-display-BgI7Wjqf.cjs.map +0 -1
- package/dist/date-display-DGfHQhpu.mjs +0 -2
- package/dist/date-display-DGfHQhpu.mjs.map +0 -1
- package/dist/detail-dialog-Ct0vAjFe.mjs +0 -2
- package/dist/detail-dialog-Ct0vAjFe.mjs.map +0 -1
- package/dist/detail-dialog-uN5mrCa7.cjs +0 -2
- package/dist/detail-dialog-uN5mrCa7.cjs.map +0 -1
- package/dist/list-display-BRJVmji0.cjs +0 -2
- package/dist/list-display-BRJVmji0.cjs.map +0 -1
- package/dist/list-display-Co94sV4H.mjs +0 -2
- package/dist/list-display-Co94sV4H.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permalink-
|
|
1
|
+
{"version":3,"file":"permalink-CMcI__V4.cjs","names":["UITableEmpty","ExternalLinkIcon"],"sources":["../packages/components/features/tables/components/atoms/permalink.tsx"],"sourcesContent":["import { ExternalLinkIcon } from 'lucide-react';\n\nimport { UITableEmpty } from './empty';\n\n/**\n * Renders an external-link anchor with an icon for use in table cells, opening\n * the target URL in a new tab with safe `rel` attributes. Renders\n * {@link UITableEmpty} when `href` is absent.\n *\n * @example\n * import { UITablePermalink } from '@customafk/lunas-ui/features/tables';\n *\n * <UITablePermalink href=\"https://example.com/records/42\" label=\"View record\" />\n */\nexport const UITablePermalink: React.FC<{\n /** The destination URL the anchor navigates to; `null`/`undefined`/empty renders an empty state. */\n href: string | null | undefined;\n /** Optional display text; falls back to the raw `href` when omitted. */\n label?: string;\n}> = ({ href, label }) => {\n if (!href) return <UITableEmpty />;\n\n return (\n <a href={href} target=\"_blank\" className=\"inline-flex items-center gap-1 truncate text-primary text-sm underline\" rel=\"noopener noreferrer\">\n <span>{label || href}</span>\n <ExternalLinkIcon size={14} />\n </a>\n );\n};\n"],"mappings":"sGAcA,MAAa,GAKP,CAAE,OAAM,WACP,GAGH,EAAA,EAAA,KAAA,CAAC,IAAD,CAAS,OAAM,OAAO,SAAS,UAAU,yEAAyE,IAAI,sBAAtH,SAAA,EACE,EAAA,EAAA,IAAA,CAAC,OAAD,CAAA,SAAO,GAAS,CAAW,CAAA,GAC3B,EAAA,EAAA,IAAA,CAACC,EAAAA,iBAAD,CAAkB,KAAM,EAAK,CAAA,CAC5B,KANa,EAAA,EAAA,IAAA,CAACD,EAAAA,EAAD,CAAe,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./ui/tooltip.cjs"),t=require("./tables-
|
|
2
|
-
//# sourceMappingURL=phone-number-
|
|
1
|
+
const e=require("./ui/tooltip.cjs"),t=require("./tables-CS3NhgTc.cjs");let n=require("react/jsx-runtime");const r=({value:r})=>r?(0,n.jsxs)(e.Tooltip,{children:[(0,n.jsx)(e.TooltipTrigger,{asChild:!0,children:(0,n.jsx)(`p`,{className:`font-number text-text-positive text-sm tabular-nums`,children:r.replace(/(\d{3})(\d{3})(\d{4})/,`($1) $2-$3`)})}),(0,n.jsx)(e.TooltipContent,{align:`start`,children:(0,n.jsx)(`p`,{className:`tabular-nums`,children:r.slice(1).replace(/(\d{2})(\d{3})(\d{4})/,`+84 $1 $2 $3`)})})]}):(0,n.jsx)(t.Q,{});exports.UITablePhoneNumberDisplay=r;
|
|
2
|
+
//# sourceMappingURL=phone-number-F9I9sNLK.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-number-
|
|
1
|
+
{"version":3,"file":"phone-number-F9I9sNLK.cjs","names":["UITableEmpty","Tooltip","TooltipTrigger","TooltipContent"],"sources":["../packages/components/features/tables/components/atoms/phone-number.tsx"],"sourcesContent":["import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { UITableEmpty } from './empty';\n\n/**\n * Formats and displays a phone number string in a table cell using the\n * `(NXX) NXX-XXXX` pattern, with a tooltip that shows the full international\n * dialling representation. Renders {@link UITableEmpty} when `value` is absent.\n *\n * @example\n * import { UITablePhoneNumberDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITablePhoneNumberDisplay value=\"0843456789\" />\n */\nexport const UITablePhoneNumberDisplay: React.FC<{\n /** The raw phone number string to format and display; `null`/`undefined`/empty renders an empty state. */\n value: string | null | undefined;\n}> = ({ value }) => {\n if (!value) return <UITableEmpty />;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <p className=\"font-number text-text-positive text-sm tabular-nums\">{value.replace(/(\\d{3})(\\d{3})(\\d{4})/, '($1) $2-$3')}</p>\n </TooltipTrigger>\n <TooltipContent align=\"start\">\n <p className=\"tabular-nums\">{value.slice(1).replace(/(\\d{2})(\\d{3})(\\d{4})/, '+84 $1 $2 $3')}</p>\n </TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":"0GAcA,MAAa,GAGP,CAAE,WACD,GAGH,EAAA,EAAA,KAAA,CAACC,EAAAA,QAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,QAAA,GACd,UAAA,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,sDAAuD,SAAA,EAAM,QAAQ,wBAAyB,YAAY,CAAK,CAAA,CAC9G,CAAA,GAChB,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,MAAM,QACpB,UAAA,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,eAAgB,SAAA,EAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,wBAAyB,cAAc,CAAK,CAAA,CAClF,CAAA,CACT,CAAA,CAAA,GAVQ,EAAA,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAe,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Tooltip as e,TooltipContent as t,TooltipTrigger as n}from"./ui/tooltip.mjs";import{Q as r}from"./tables-
|
|
2
|
-
//# sourceMappingURL=phone-number-
|
|
1
|
+
import{Tooltip as e,TooltipContent as t,TooltipTrigger as n}from"./ui/tooltip.mjs";import{Q as r}from"./tables-7_KgoyS-.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=({value:o})=>o?a(e,{children:[i(n,{asChild:!0,children:i(`p`,{className:`font-number text-text-positive text-sm tabular-nums`,children:o.replace(/(\d{3})(\d{3})(\d{4})/,`($1) $2-$3`)})}),i(t,{align:`start`,children:i(`p`,{className:`tabular-nums`,children:o.slice(1).replace(/(\d{2})(\d{3})(\d{4})/,`+84 $1 $2 $3`)})})]}):i(r,{});export{o as UITablePhoneNumberDisplay};
|
|
2
|
+
//# sourceMappingURL=phone-number-ao2oCmrO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-number-
|
|
1
|
+
{"version":3,"file":"phone-number-ao2oCmrO.mjs","names":[],"sources":["../packages/components/features/tables/components/atoms/phone-number.tsx"],"sourcesContent":["import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { UITableEmpty } from './empty';\n\n/**\n * Formats and displays a phone number string in a table cell using the\n * `(NXX) NXX-XXXX` pattern, with a tooltip that shows the full international\n * dialling representation. Renders {@link UITableEmpty} when `value` is absent.\n *\n * @example\n * import { UITablePhoneNumberDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITablePhoneNumberDisplay value=\"0843456789\" />\n */\nexport const UITablePhoneNumberDisplay: React.FC<{\n /** The raw phone number string to format and display; `null`/`undefined`/empty renders an empty state. */\n value: string | null | undefined;\n}> = ({ value }) => {\n if (!value) return <UITableEmpty />;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <p className=\"font-number text-text-positive text-sm tabular-nums\">{value.replace(/(\\d{3})(\\d{3})(\\d{4})/, '($1) $2-$3')}</p>\n </TooltipTrigger>\n <TooltipContent align=\"start\">\n <p className=\"tabular-nums\">{value.slice(1).replace(/(\\d{2})(\\d{3})(\\d{4})/, '+84 $1 $2 $3')}</p>\n </TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":"+KAcA,MAAa,GAGP,CAAE,WACD,EAGH,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAgB,QAAA,GACd,SAAA,EAAC,IAAD,CAAG,UAAU,sDAAuD,SAAA,EAAM,QAAQ,wBAAyB,YAAY,CAAK,CAAA,CAC9G,CAAA,EAChB,EAAC,EAAD,CAAgB,MAAM,QACpB,SAAA,EAAC,IAAD,CAAG,UAAU,eAAgB,SAAA,EAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,wBAAyB,cAAc,CAAK,CAAA,CAClF,CAAA,CACT,CAAA,CAAA,EAVQ,EAAC,EAAD,CAAe,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./tables-
|
|
2
|
-
//# sourceMappingURL=progress-display-
|
|
1
|
+
const e=require("./tables-CS3NhgTc.cjs"),t=require("./ui/progress.cjs");let n=require("react"),r=require("@customafk/react-toolkit/utils"),i=require("react/jsx-runtime");const a=(0,n.memo)(({value:n,showLabel:a=!0,successThreshold:o=70,warningThreshold:s=40})=>{if(n==null)return(0,i.jsx)(e.Q,{});let c=Math.min(100,Math.max(0,n));return(0,i.jsxs)(`div`,{className:`flex w-full min-w-24 items-center gap-x-2`,children:[(0,i.jsx)(t.Progress,{value:c,className:(0,r.cn)(`flex-1`,c>=o?`[&>[data-slot=progress-indicator]]:bg-success`:c>=s?`[&>[data-slot=progress-indicator]]:bg-warning`:`[&>[data-slot=progress-indicator]]:bg-danger`)}),a&&(0,i.jsxs)(`span`,{className:`w-9 shrink-0 text-right font-number text-text-positive-weak text-xs tabular-nums`,children:[c,`%`]})]})});a.displayName=`UITableProgressDisplay`,exports.UITableProgressDisplay=a;
|
|
2
|
+
//# sourceMappingURL=progress-display-F8xXJ3T1.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-display-
|
|
1
|
+
{"version":3,"file":"progress-display-F8xXJ3T1.cjs","names":["UITableEmpty","Progress"],"sources":["../packages/components/features/tables/components/atoms/progress-display.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Progress } from '@/components/ui/progress';\nimport { UITableEmpty } from './empty';\n\n/** Props for the {@link UITableProgressDisplay} component. */\ntype Props = {\n /** Percentage value between 0 and 100; `null`/`undefined` renders an empty state. */\n value: number | null | undefined;\n /** When `true`, shows the numeric percentage next to the bar (default: `true`). */\n showLabel?: boolean;\n /**\n * Color thresholds applied to the progress indicator.\n * - `≥ successThreshold` → green\n * - `≥ warningThreshold` → yellow\n * - otherwise → red\n *\n * Defaults: `successThreshold = 70`, `warningThreshold = 40`.\n */\n successThreshold?: number;\n warningThreshold?: number;\n};\n\n/**\n * Renders a horizontal progress bar with an optional percentage label for a\n * table cell. The bar color shifts from red → yellow → green based on\n * configurable thresholds. Renders {@link UITableEmpty} when `value` is absent.\n *\n * @example\n * import { UITableProgressDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableProgressDisplay value={75} />\n */\nexport const UITableProgressDisplay = memo(({ value, showLabel = true, successThreshold = 70, warningThreshold = 40 }: Props) => {\n if (value === null || value === undefined) return <UITableEmpty />;\n\n const clamped = Math.min(100, Math.max(0, value));\n\n const indicatorClass =\n clamped >= successThreshold\n ? '[&>[data-slot=progress-indicator]]:bg-success'\n : clamped >= warningThreshold\n ? '[&>[data-slot=progress-indicator]]:bg-warning'\n : '[&>[data-slot=progress-indicator]]:bg-danger';\n\n return (\n <div className=\"flex w-full min-w-24 items-center gap-x-2\">\n <Progress value={clamped} className={cn('flex-1', indicatorClass)} />\n {showLabel && <span className=\"w-9 shrink-0 text-right font-number text-text-positive-weak text-xs tabular-nums\">{clamped}%</span>}\n </div>\n );\n});\nUITableProgressDisplay.displayName = 'UITableProgressDisplay';\n"],"mappings":"0KAqCA,MAAa,GAAA,EAAA,EAAA,KAAA,EAA+B,CAAE,QAAO,YAAY,GAAM,mBAAmB,GAAI,mBAAmB,MAAgB,CAC/H,GAAI,GAAU,KAA6B,OAAO,EAAA,EAAA,IAAA,CAACA,EAAAA,EAAD,CAAe,CAAA,EAEjE,IAAM,EAAU,KAAK,IAAI,IAAK,KAAK,IAAI,EAAG,CAAK,CAAC,EAShD,OACE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,4CAAf,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CAAU,MAAO,EAAS,WAAA,EAAA,EAAA,GAAA,CAAc,SAR1C,GAAW,EACP,gDACA,GAAW,EACT,gDACA,8CAI4D,CAAI,CAAA,EACnE,IAAa,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,mFAAhB,SAAA,CAAoG,EAAQ,GAAO,CAC9H,CAAA,CAAA,GAET,CAAC,EACD,EAAuB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Q as e}from"./tables-
|
|
2
|
-
//# sourceMappingURL=progress-display-
|
|
1
|
+
import{Q as e}from"./tables-7_KgoyS-.mjs";import{Progress as t}from"./ui/progress.mjs";import{memo as n}from"react";import{cn as r}from"@customafk/react-toolkit/utils";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=n(({value:n,showLabel:o=!0,successThreshold:s=70,warningThreshold:c=40})=>{if(n==null)return i(e,{});let l=Math.min(100,Math.max(0,n));return a(`div`,{className:`flex w-full min-w-24 items-center gap-x-2`,children:[i(t,{value:l,className:r(`flex-1`,l>=s?`[&>[data-slot=progress-indicator]]:bg-success`:l>=c?`[&>[data-slot=progress-indicator]]:bg-warning`:`[&>[data-slot=progress-indicator]]:bg-danger`)}),o&&a(`span`,{className:`w-9 shrink-0 text-right font-number text-text-positive-weak text-xs tabular-nums`,children:[l,`%`]})]})});o.displayName=`UITableProgressDisplay`;export{o as UITableProgressDisplay};
|
|
2
|
+
//# sourceMappingURL=progress-display-atwRFD6e.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-display-
|
|
1
|
+
{"version":3,"file":"progress-display-atwRFD6e.mjs","names":[],"sources":["../packages/components/features/tables/components/atoms/progress-display.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Progress } from '@/components/ui/progress';\nimport { UITableEmpty } from './empty';\n\n/** Props for the {@link UITableProgressDisplay} component. */\ntype Props = {\n /** Percentage value between 0 and 100; `null`/`undefined` renders an empty state. */\n value: number | null | undefined;\n /** When `true`, shows the numeric percentage next to the bar (default: `true`). */\n showLabel?: boolean;\n /**\n * Color thresholds applied to the progress indicator.\n * - `≥ successThreshold` → green\n * - `≥ warningThreshold` → yellow\n * - otherwise → red\n *\n * Defaults: `successThreshold = 70`, `warningThreshold = 40`.\n */\n successThreshold?: number;\n warningThreshold?: number;\n};\n\n/**\n * Renders a horizontal progress bar with an optional percentage label for a\n * table cell. The bar color shifts from red → yellow → green based on\n * configurable thresholds. Renders {@link UITableEmpty} when `value` is absent.\n *\n * @example\n * import { UITableProgressDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableProgressDisplay value={75} />\n */\nexport const UITableProgressDisplay = memo(({ value, showLabel = true, successThreshold = 70, warningThreshold = 40 }: Props) => {\n if (value === null || value === undefined) return <UITableEmpty />;\n\n const clamped = Math.min(100, Math.max(0, value));\n\n const indicatorClass =\n clamped >= successThreshold\n ? '[&>[data-slot=progress-indicator]]:bg-success'\n : clamped >= warningThreshold\n ? '[&>[data-slot=progress-indicator]]:bg-warning'\n : '[&>[data-slot=progress-indicator]]:bg-danger';\n\n return (\n <div className=\"flex w-full min-w-24 items-center gap-x-2\">\n <Progress value={clamped} className={cn('flex-1', indicatorClass)} />\n {showLabel && <span className=\"w-9 shrink-0 text-right font-number text-text-positive-weak text-xs tabular-nums\">{clamped}%</span>}\n </div>\n );\n});\nUITableProgressDisplay.displayName = 'UITableProgressDisplay';\n"],"mappings":"0NAqCA,MAAa,EAAyB,GAAM,CAAE,QAAO,YAAY,GAAM,mBAAmB,GAAI,mBAAmB,MAAgB,CAC/H,GAAI,GAAU,KAA6B,OAAO,EAAC,EAAD,CAAe,CAAA,EAEjE,IAAM,EAAU,KAAK,IAAI,IAAK,KAAK,IAAI,EAAG,CAAK,CAAC,EAShD,OACE,EAAC,MAAD,CAAK,UAAU,4CAAf,SAAA,CACE,EAAC,EAAD,CAAU,MAAO,EAAS,UAAW,EAAG,SAR1C,GAAW,EACP,gDACA,GAAW,EACT,gDACA,8CAI4D,CAAI,CAAA,EACnE,GAAa,EAAC,OAAD,CAAM,UAAU,mFAAhB,SAAA,CAAoG,EAAQ,GAAO,CAC9H,CAAA,CAAA,GAET,CAAC,EACD,EAAuB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./layouts/flex.cjs"),t=require("./tables-
|
|
2
|
-
//# sourceMappingURL=statistic-
|
|
1
|
+
const e=require("./layouts/flex.cjs"),t=require("./tables-CS3NhgTc.cjs");let n=require("react"),r=require("@customafk/react-toolkit/utils"),i=require("react/jsx-runtime");const a=(e,t,n)=>{let r=10**t;switch(n){case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:return Math.round(e*r)/r}},o=(0,n.memo)(({decimalSeparator:o=`.`,groupSeparator:s=`,`,prefix:c,suffix:l,precision:u,roundingMode:d=`round`,showTrailingZeros:f=!1,size:p=`lg`,value:m=0})=>{let h=(0,n.useMemo)(()=>{let e={};return typeof u==`number`&&u>=0&&f&&(e.minimumFractionDigits=u),e.maximumFractionDigits=u,e},[u,f]),g=(0,n.useCallback)(e=>{let t=e;return typeof u==`number`&&u>=0&&(t=a(e,u,d)),t.toLocaleString(`vi-VN`,h)},[d,h,u]),_=(0,n.useMemo)(()=>{if(typeof m==`number`)return Number.isNaN(m)||!Number.isFinite(m)?`N/A`:g(m);if(typeof m==`string`){let e=m.trim();if(!e)return`N/A`;let t=Number(e);return Number.isNaN(t)||!Number.isFinite(t)?`N/A`:g(t)}return`N/A`},[m,g]),v=(0,n.useMemo)(()=>o===`.`&&s===`,`?_:_.replace(/,/g,s).replace(/\./g,o),[_,o,s]);return v===`0`||v===`N/A`||!v?(0,i.jsx)(t.Q,{}):(0,i.jsxs)(e.Flex,{padding:`none`,className:(0,r.cn)(`font-number text-lg text-text-positive tabular-nums`,p===`xs`&&`text-xs`,p===`sm`&&`text-sm`,p===`md`&&`text-base`,p===`lg`&&`text-lg`,p===`xl`&&`text-xl`),children:[c,(0,i.jsx)(`p`,{children:v}),l]})});o.displayName=`UITableStatisticDisplay`,exports.UITableStatisticDisplay=o;
|
|
2
|
+
//# sourceMappingURL=statistic-B9OqfhOl.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistic-
|
|
1
|
+
{"version":3,"file":"statistic-B9OqfhOl.cjs","names":["UITableEmpty","Flex"],"sources":["../packages/components/features/tables/components/atoms/statistic.tsx"],"sourcesContent":["'use client';\nimport { memo, useCallback, useMemo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Flex } from '@/components/layouts/flex';\nimport { UITableEmpty } from './empty';\n\n/**\n * Applies the specified rounding mode to `num` at the given decimal precision.\n *\n * @param num - The number to round.\n * @param precisionValue - Number of decimal places to keep.\n * @param roundingMode - Rounding strategy: `'round'` (default), `'floor'`, or `'ceil'`.\n * @returns The rounded number.\n */\nconst applyRounding = (num: number, precisionValue: number, roundingMode?: 'round' | 'floor' | 'ceil') => {\n const multiplier = 10 ** precisionValue;\n\n switch (roundingMode) {\n case 'floor':\n return Math.floor(num * multiplier) / multiplier;\n case 'ceil':\n return Math.ceil(num * multiplier) / multiplier;\n default:\n return Math.round(num * multiplier) / multiplier;\n }\n};\n\n/** Props for the {@link UITableStatisticDisplay} component. */\ntype Props = {\n /** Character used to separate the integer and fractional parts (default: `'.'`). */\n decimalSeparator?: string;\n /** Character used to separate thousands groups (default: `','`). */\n groupSeparator?: string;\n /** Optional node rendered before the formatted number (e.g. a currency symbol). */\n prefix?: React.ReactNode;\n /** Optional node rendered after the formatted number (e.g. a unit label). */\n suffix?: React.ReactNode;\n /** Number of decimal digits to display. */\n precision?: number;\n /** Rounding strategy applied before formatting (default: `'round'`). */\n roundingMode?: 'round' | 'floor' | 'ceil';\n /** When `true`, pads the fractional part with trailing zeros up to `precision` digits. */\n showTrailingZeros?: boolean;\n /** Font-size variant for the displayed number (default: `'lg'`). */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** The numeric or string value to format; falsy / invalid values render an empty state. */\n value: number | string | null | undefined;\n};\n\n/**\n * A memoized table-cell component that formats a numeric value with configurable\n * separators, precision, rounding, and size; renders {@link UITableEmpty} when\n * the value is zero, invalid, or absent.\n *\n * @example\n * import { UITableStatisticDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableStatisticDisplay value={1234567.89} precision={2} prefix=\"$\" size=\"md\" />\n */\nexport const UITableStatisticDisplay = memo(\n ({\n decimalSeparator = '.',\n groupSeparator = ',',\n prefix: Prefix,\n suffix: Suffix,\n precision,\n roundingMode = 'round',\n showTrailingZeros = false,\n size = 'lg',\n value = 0,\n }: Props) => {\n // Memoize number formatting options\n const formatOptions = useMemo((): Intl.NumberFormatOptions => {\n const options: Intl.NumberFormatOptions = {};\n\n if (typeof precision === 'number' && precision >= 0 && showTrailingZeros) {\n options.minimumFractionDigits = precision;\n options.maximumFractionDigits = precision;\n } else {\n options.maximumFractionDigits = precision;\n }\n\n return options;\n }, [precision, showTrailingZeros]);\n\n const formatNumber = useCallback(\n (num: number): string => {\n let processedNum = num;\n\n // Áp dụng làm tròn nếu có precision\n if (typeof precision === 'number' && precision >= 0) {\n processedNum = applyRounding(num, precision, roundingMode);\n }\n\n return processedNum.toLocaleString('vi-VN', formatOptions);\n },\n [roundingMode, formatOptions, precision]\n );\n\n // Memoize value processing\n const processedValue = useMemo((): string => {\n // Xử lý giá trị number\n if (typeof value === 'number') {\n if (Number.isNaN(value) || !Number.isFinite(value)) {\n return 'N/A';\n }\n return formatNumber(value);\n }\n\n // Xử lý giá trị string\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n\n // Nếu là chuỗi rỗng\n if (!trimmedValue) {\n return 'N/A';\n }\n\n // Thử convert sang number\n const numValue = Number(trimmedValue);\n\n if (Number.isNaN(numValue) || !Number.isFinite(numValue)) {\n // Nếu không phải số, trả về string gốc\n return 'N/A';\n }\n\n return formatNumber(numValue);\n }\n\n return 'N/A';\n }, [value, formatNumber]);\n\n // Memoize separator replacement\n const finalFormattedValue = useMemo((): string => {\n // Chỉ thay thế separators nếu khác mặc định\n if (decimalSeparator === '.' && groupSeparator === ',') {\n return processedValue;\n }\n return processedValue.replace(/,/g, groupSeparator).replace(/\\./g, decimalSeparator);\n }, [processedValue, decimalSeparator, groupSeparator]);\n\n if (finalFormattedValue === '0' || finalFormattedValue === 'N/A' || !finalFormattedValue) {\n return <UITableEmpty />;\n }\n\n return (\n <Flex\n padding=\"none\"\n className={cn(\n 'font-number text-lg text-text-positive tabular-nums',\n size === 'xs' && 'text-xs',\n size === 'sm' && 'text-sm',\n size === 'md' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl'\n )}\n >\n {Prefix}\n <p>{finalFormattedValue}</p>\n {Suffix}\n </Flex>\n );\n }\n);\nUITableStatisticDisplay.displayName = 'UITableStatisticDisplay';\n"],"mappings":"2KAgBA,MAAM,GAAiB,EAAa,EAAwB,IAA8C,CACxG,IAAM,EAAa,IAAM,EAEzB,OAAQ,EAAR,CACE,IAAK,QACH,OAAO,KAAK,MAAM,EAAM,CAAU,EAAI,EACxC,IAAK,OACH,OAAO,KAAK,KAAK,EAAM,CAAU,EAAI,EACvC,QACE,OAAO,KAAK,MAAM,EAAM,CAAU,EAAI,CAC1C,CACF,EAkCa,GAAA,EAAA,EAAA,KAAA,EACV,CACC,mBAAmB,IACnB,iBAAiB,IACjB,OAAQ,EACR,OAAQ,EACR,YACA,eAAe,QACf,oBAAoB,GACpB,OAAO,KACP,QAAQ,KACG,CAEX,IAAM,GAAA,EAAA,EAAA,QAAA,KAAwD,CAC5D,IAAM,EAAoC,CAAC,EAS3C,OAPI,OAAO,GAAc,UAAY,GAAa,GAAK,IACrD,EAAQ,sBAAwB,GAGhC,EAAQ,sBAAwB,EAG3B,CACT,EAAG,CAAC,EAAW,CAAiB,CAAC,EAE3B,GAAA,EAAA,EAAA,YAAA,CACH,GAAwB,CACvB,IAAI,EAAe,EAOnB,OAJI,OAAO,GAAc,UAAY,GAAa,IAChD,EAAe,EAAc,EAAK,EAAW,CAAY,GAGpD,EAAa,eAAe,QAAS,CAAa,CAC3D,EACA,CAAC,EAAc,EAAe,CAAS,CACzC,EAGM,GAAA,EAAA,EAAA,QAAA,KAAuC,CAE3C,GAAI,OAAO,GAAU,SAInB,OAHI,OAAO,MAAM,CAAK,GAAK,CAAC,OAAO,SAAS,CAAK,EACxC,MAEF,EAAa,CAAK,EAI3B,GAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAe,EAAM,KAAK,EAGhC,GAAI,CAAC,EACH,MAAO,MAIT,IAAM,EAAW,OAAO,CAAY,EAOpC,OALI,OAAO,MAAM,CAAQ,GAAK,CAAC,OAAO,SAAS,CAAQ,EAE9C,MAGF,EAAa,CAAQ,CAC9B,CAEA,MAAO,KACT,EAAG,CAAC,EAAO,CAAY,CAAC,EAGlB,GAAA,EAAA,EAAA,QAAA,KAEA,IAAqB,KAAO,IAAmB,IAC1C,EAEF,EAAe,QAAQ,KAAM,CAAc,CAAC,CAAC,QAAQ,MAAO,CAAgB,EAClF,CAAC,EAAgB,EAAkB,CAAc,CAAC,EAMrD,OAJI,IAAwB,KAAO,IAAwB,OAAS,CAAC,GAC5D,EAAA,EAAA,IAAA,CAACA,EAAAA,EAAD,CAAe,CAAA,GAItB,EAAA,EAAA,KAAA,CAACC,EAAAA,KAAD,CACE,QAAQ,OACR,WAAA,EAAA,EAAA,GAAA,CACE,sDACA,IAAS,MAAQ,UACjB,IAAS,MAAQ,UACjB,IAAS,MAAQ,YACjB,IAAS,MAAQ,UACjB,IAAS,MAAQ,SACnB,EATF,SAAA,CAWG,GACD,EAAA,EAAA,IAAA,CAAC,IAAD,CAAA,SAAI,CAAuB,CAAA,EAC1B,CACG,GAEV,CACF,EACA,EAAwB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Flex as e}from"./layouts/flex.mjs";import{Q as t}from"./tables-
|
|
2
|
-
//# sourceMappingURL=statistic-
|
|
1
|
+
import{Flex as e}from"./layouts/flex.mjs";import{Q as t}from"./tables-7_KgoyS-.mjs";import{memo as n,useCallback as r,useMemo as i}from"react";import{cn as a}from"@customafk/react-toolkit/utils";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=(e,t,n)=>{let r=10**t;switch(n){case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:return Math.round(e*r)/r}},l=n(({decimalSeparator:n=`.`,groupSeparator:l=`,`,prefix:u,suffix:d,precision:f,roundingMode:p=`round`,showTrailingZeros:m=!1,size:h=`lg`,value:g=0})=>{let _=i(()=>{let e={};return typeof f==`number`&&f>=0&&m&&(e.minimumFractionDigits=f),e.maximumFractionDigits=f,e},[f,m]),v=r(e=>{let t=e;return typeof f==`number`&&f>=0&&(t=c(e,f,p)),t.toLocaleString(`vi-VN`,_)},[p,_,f]),y=i(()=>{if(typeof g==`number`)return Number.isNaN(g)||!Number.isFinite(g)?`N/A`:v(g);if(typeof g==`string`){let e=g.trim();if(!e)return`N/A`;let t=Number(e);return Number.isNaN(t)||!Number.isFinite(t)?`N/A`:v(t)}return`N/A`},[g,v]),b=i(()=>n===`.`&&l===`,`?y:y.replace(/,/g,l).replace(/\./g,n),[y,n,l]);return b===`0`||b===`N/A`||!b?o(t,{}):s(e,{padding:`none`,className:a(`font-number text-lg text-text-positive tabular-nums`,h===`xs`&&`text-xs`,h===`sm`&&`text-sm`,h===`md`&&`text-base`,h===`lg`&&`text-lg`,h===`xl`&&`text-xl`),children:[u,o(`p`,{children:b}),d]})});l.displayName=`UITableStatisticDisplay`;export{l as UITableStatisticDisplay};
|
|
2
|
+
//# sourceMappingURL=statistic-CJVc9sNs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistic-
|
|
1
|
+
{"version":3,"file":"statistic-CJVc9sNs.mjs","names":[],"sources":["../packages/components/features/tables/components/atoms/statistic.tsx"],"sourcesContent":["'use client';\nimport { memo, useCallback, useMemo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Flex } from '@/components/layouts/flex';\nimport { UITableEmpty } from './empty';\n\n/**\n * Applies the specified rounding mode to `num` at the given decimal precision.\n *\n * @param num - The number to round.\n * @param precisionValue - Number of decimal places to keep.\n * @param roundingMode - Rounding strategy: `'round'` (default), `'floor'`, or `'ceil'`.\n * @returns The rounded number.\n */\nconst applyRounding = (num: number, precisionValue: number, roundingMode?: 'round' | 'floor' | 'ceil') => {\n const multiplier = 10 ** precisionValue;\n\n switch (roundingMode) {\n case 'floor':\n return Math.floor(num * multiplier) / multiplier;\n case 'ceil':\n return Math.ceil(num * multiplier) / multiplier;\n default:\n return Math.round(num * multiplier) / multiplier;\n }\n};\n\n/** Props for the {@link UITableStatisticDisplay} component. */\ntype Props = {\n /** Character used to separate the integer and fractional parts (default: `'.'`). */\n decimalSeparator?: string;\n /** Character used to separate thousands groups (default: `','`). */\n groupSeparator?: string;\n /** Optional node rendered before the formatted number (e.g. a currency symbol). */\n prefix?: React.ReactNode;\n /** Optional node rendered after the formatted number (e.g. a unit label). */\n suffix?: React.ReactNode;\n /** Number of decimal digits to display. */\n precision?: number;\n /** Rounding strategy applied before formatting (default: `'round'`). */\n roundingMode?: 'round' | 'floor' | 'ceil';\n /** When `true`, pads the fractional part with trailing zeros up to `precision` digits. */\n showTrailingZeros?: boolean;\n /** Font-size variant for the displayed number (default: `'lg'`). */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** The numeric or string value to format; falsy / invalid values render an empty state. */\n value: number | string | null | undefined;\n};\n\n/**\n * A memoized table-cell component that formats a numeric value with configurable\n * separators, precision, rounding, and size; renders {@link UITableEmpty} when\n * the value is zero, invalid, or absent.\n *\n * @example\n * import { UITableStatisticDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableStatisticDisplay value={1234567.89} precision={2} prefix=\"$\" size=\"md\" />\n */\nexport const UITableStatisticDisplay = memo(\n ({\n decimalSeparator = '.',\n groupSeparator = ',',\n prefix: Prefix,\n suffix: Suffix,\n precision,\n roundingMode = 'round',\n showTrailingZeros = false,\n size = 'lg',\n value = 0,\n }: Props) => {\n // Memoize number formatting options\n const formatOptions = useMemo((): Intl.NumberFormatOptions => {\n const options: Intl.NumberFormatOptions = {};\n\n if (typeof precision === 'number' && precision >= 0 && showTrailingZeros) {\n options.minimumFractionDigits = precision;\n options.maximumFractionDigits = precision;\n } else {\n options.maximumFractionDigits = precision;\n }\n\n return options;\n }, [precision, showTrailingZeros]);\n\n const formatNumber = useCallback(\n (num: number): string => {\n let processedNum = num;\n\n // Áp dụng làm tròn nếu có precision\n if (typeof precision === 'number' && precision >= 0) {\n processedNum = applyRounding(num, precision, roundingMode);\n }\n\n return processedNum.toLocaleString('vi-VN', formatOptions);\n },\n [roundingMode, formatOptions, precision]\n );\n\n // Memoize value processing\n const processedValue = useMemo((): string => {\n // Xử lý giá trị number\n if (typeof value === 'number') {\n if (Number.isNaN(value) || !Number.isFinite(value)) {\n return 'N/A';\n }\n return formatNumber(value);\n }\n\n // Xử lý giá trị string\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n\n // Nếu là chuỗi rỗng\n if (!trimmedValue) {\n return 'N/A';\n }\n\n // Thử convert sang number\n const numValue = Number(trimmedValue);\n\n if (Number.isNaN(numValue) || !Number.isFinite(numValue)) {\n // Nếu không phải số, trả về string gốc\n return 'N/A';\n }\n\n return formatNumber(numValue);\n }\n\n return 'N/A';\n }, [value, formatNumber]);\n\n // Memoize separator replacement\n const finalFormattedValue = useMemo((): string => {\n // Chỉ thay thế separators nếu khác mặc định\n if (decimalSeparator === '.' && groupSeparator === ',') {\n return processedValue;\n }\n return processedValue.replace(/,/g, groupSeparator).replace(/\\./g, decimalSeparator);\n }, [processedValue, decimalSeparator, groupSeparator]);\n\n if (finalFormattedValue === '0' || finalFormattedValue === 'N/A' || !finalFormattedValue) {\n return <UITableEmpty />;\n }\n\n return (\n <Flex\n padding=\"none\"\n className={cn(\n 'font-number text-lg text-text-positive tabular-nums',\n size === 'xs' && 'text-xs',\n size === 'sm' && 'text-sm',\n size === 'md' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl'\n )}\n >\n {Prefix}\n <p>{finalFormattedValue}</p>\n {Suffix}\n </Flex>\n );\n }\n);\nUITableStatisticDisplay.displayName = 'UITableStatisticDisplay';\n"],"mappings":"qPAgBA,MAAM,GAAiB,EAAa,EAAwB,IAA8C,CACxG,IAAM,EAAa,IAAM,EAEzB,OAAQ,EAAR,CACE,IAAK,QACH,OAAO,KAAK,MAAM,EAAM,CAAU,EAAI,EACxC,IAAK,OACH,OAAO,KAAK,KAAK,EAAM,CAAU,EAAI,EACvC,QACE,OAAO,KAAK,MAAM,EAAM,CAAU,EAAI,CAC1C,CACF,EAkCa,EAA0B,GACpC,CACC,mBAAmB,IACnB,iBAAiB,IACjB,OAAQ,EACR,OAAQ,EACR,YACA,eAAe,QACf,oBAAoB,GACpB,OAAO,KACP,QAAQ,KACG,CAEX,IAAM,EAAgB,MAAwC,CAC5D,IAAM,EAAoC,CAAC,EAS3C,OAPI,OAAO,GAAc,UAAY,GAAa,GAAK,IACrD,EAAQ,sBAAwB,GAGhC,EAAQ,sBAAwB,EAG3B,CACT,EAAG,CAAC,EAAW,CAAiB,CAAC,EAE3B,EAAe,EAClB,GAAwB,CACvB,IAAI,EAAe,EAOnB,OAJI,OAAO,GAAc,UAAY,GAAa,IAChD,EAAe,EAAc,EAAK,EAAW,CAAY,GAGpD,EAAa,eAAe,QAAS,CAAa,CAC3D,EACA,CAAC,EAAc,EAAe,CAAS,CACzC,EAGM,EAAiB,MAAsB,CAE3C,GAAI,OAAO,GAAU,SAInB,OAHI,OAAO,MAAM,CAAK,GAAK,CAAC,OAAO,SAAS,CAAK,EACxC,MAEF,EAAa,CAAK,EAI3B,GAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAe,EAAM,KAAK,EAGhC,GAAI,CAAC,EACH,MAAO,MAIT,IAAM,EAAW,OAAO,CAAY,EAOpC,OALI,OAAO,MAAM,CAAQ,GAAK,CAAC,OAAO,SAAS,CAAQ,EAE9C,MAGF,EAAa,CAAQ,CAC9B,CAEA,MAAO,KACT,EAAG,CAAC,EAAO,CAAY,CAAC,EAGlB,EAAsB,MAEtB,IAAqB,KAAO,IAAmB,IAC1C,EAEF,EAAe,QAAQ,KAAM,CAAc,CAAC,CAAC,QAAQ,MAAO,CAAgB,EAClF,CAAC,EAAgB,EAAkB,CAAc,CAAC,EAMrD,OAJI,IAAwB,KAAO,IAAwB,OAAS,CAAC,EAC5D,EAAC,EAAD,CAAe,CAAA,EAItB,EAAC,EAAD,CACE,QAAQ,OACR,UAAW,EACT,sDACA,IAAS,MAAQ,UACjB,IAAS,MAAQ,UACjB,IAAS,MAAQ,YACjB,IAAS,MAAQ,UACjB,IAAS,MAAQ,SACnB,EATF,SAAA,CAWG,EACD,EAAC,IAAD,CAAA,SAAI,CAAuB,CAAA,EAC1B,CACG,GAEV,CACF,EACA,EAAwB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Badge as e}from"./ui/badge.mjs";import{Q as t}from"./tables-
|
|
2
|
-
//# sourceMappingURL=status-display-
|
|
1
|
+
import{Badge as e}from"./ui/badge.mjs";import{Q as t}from"./tables-7_KgoyS-.mjs";import{jsx as n}from"react/jsx-runtime";const r=({value:r,colorMap:i,defaultColor:a=`muted`,variant:o=`soft`})=>r==null||r===``?n(t,{}):n(e,{variant:o,color:(i&&i[r])??a,size:`sm`,className:`min-w-16 justify-center capitalize`,children:r.charAt(0).toUpperCase()+r.slice(1).replace(/_/g,` `)});export{r as UITableStatusDisplay};
|
|
2
|
+
//# sourceMappingURL=status-display-DInGGgiP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-display-
|
|
1
|
+
{"version":3,"file":"status-display-DInGGgiP.mjs","names":[],"sources":["../packages/components/features/tables/components/atoms/status-display.tsx"],"sourcesContent":["'use client';\n\nimport { Badge } from '@/components/ui/badge';\nimport { UITableEmpty } from './empty';\n\ntype BadgeColor = 'primary' | 'secondary' | 'muted' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n\n/** Props for the {@link UITableStatusDisplay} component. */\ntype Props = {\n /** The status string to display; `null`/`undefined` renders an empty state. */\n value: string | null | undefined;\n /**\n * Maps each status string to a badge color. Any key not present in the map\n * falls back to `defaultColor`.\n */\n colorMap?: Record<string, BadgeColor>;\n /** Color used when `value` is not found in `colorMap` (default: `'muted'`). */\n defaultColor?: BadgeColor;\n /** Badge variant forwarded to the underlying {@link Badge} (default: `'soft'`). */\n variant?: 'solid' | 'soft' | 'outline';\n};\n\n/**\n * Renders a color-coded status badge for a table cell. The mapping from status\n * string to badge color is fully configurable via `colorMap`; unknown statuses\n * fall back to `defaultColor`.\n *\n * @example\n * import { UITableStatusDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableStatusDisplay\n * value=\"active\"\n * colorMap={{ active: 'success', inactive: 'danger', pending: 'warning' }}\n * />\n */\nexport const UITableStatusDisplay: React.FC<Props> = ({ value, colorMap, defaultColor = 'muted', variant = 'soft' }) => {\n if (value === null || value === undefined || value === '') return <UITableEmpty />;\n\n const color: BadgeColor = (colorMap && colorMap[value]) ?? defaultColor;\n const label = value.charAt(0).toUpperCase() + value.slice(1).replace(/_/g, ' ');\n\n return (\n <Badge variant={variant} color={color} size=\"sm\" className=\"min-w-16 justify-center capitalize\">\n {label}\n </Badge>\n );\n};\n"],"mappings":"yHAmCA,MAAa,GAAyC,CAAE,QAAO,WAAU,eAAe,QAAS,UAAU,UACrG,GAAU,MAA+B,IAAU,GAAW,EAAC,EAAD,CAAe,CAAA,EAM/E,EAAC,EAAD,CAAgB,UAAS,OAJA,GAAY,EAAS,KAAW,EAIlB,KAAK,KAAK,UAAU,qCAH/C,SAAA,EAAM,OAAO,CAAC,CAAC,CAAC,YAAY,EAAI,EAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAM,GAAG,CAKrE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./ui/badge.cjs"),t=require("./tables-
|
|
2
|
-
//# sourceMappingURL=status-display-
|
|
1
|
+
const e=require("./ui/badge.cjs"),t=require("./tables-CS3NhgTc.cjs");let n=require("react/jsx-runtime");const r=({value:r,colorMap:i,defaultColor:a=`muted`,variant:o=`soft`})=>r==null||r===``?(0,n.jsx)(t.Q,{}):(0,n.jsx)(e.Badge,{variant:o,color:(i&&i[r])??a,size:`sm`,className:`min-w-16 justify-center capitalize`,children:r.charAt(0).toUpperCase()+r.slice(1).replace(/_/g,` `)});exports.UITableStatusDisplay=r;
|
|
2
|
+
//# sourceMappingURL=status-display-DpKsYvZJ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-display-
|
|
1
|
+
{"version":3,"file":"status-display-DpKsYvZJ.cjs","names":["UITableEmpty","Badge"],"sources":["../packages/components/features/tables/components/atoms/status-display.tsx"],"sourcesContent":["'use client';\n\nimport { Badge } from '@/components/ui/badge';\nimport { UITableEmpty } from './empty';\n\ntype BadgeColor = 'primary' | 'secondary' | 'muted' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n\n/** Props for the {@link UITableStatusDisplay} component. */\ntype Props = {\n /** The status string to display; `null`/`undefined` renders an empty state. */\n value: string | null | undefined;\n /**\n * Maps each status string to a badge color. Any key not present in the map\n * falls back to `defaultColor`.\n */\n colorMap?: Record<string, BadgeColor>;\n /** Color used when `value` is not found in `colorMap` (default: `'muted'`). */\n defaultColor?: BadgeColor;\n /** Badge variant forwarded to the underlying {@link Badge} (default: `'soft'`). */\n variant?: 'solid' | 'soft' | 'outline';\n};\n\n/**\n * Renders a color-coded status badge for a table cell. The mapping from status\n * string to badge color is fully configurable via `colorMap`; unknown statuses\n * fall back to `defaultColor`.\n *\n * @example\n * import { UITableStatusDisplay } from '@customafk/lunas-ui/features/tables';\n *\n * <UITableStatusDisplay\n * value=\"active\"\n * colorMap={{ active: 'success', inactive: 'danger', pending: 'warning' }}\n * />\n */\nexport const UITableStatusDisplay: React.FC<Props> = ({ value, colorMap, defaultColor = 'muted', variant = 'soft' }) => {\n if (value === null || value === undefined || value === '') return <UITableEmpty />;\n\n const color: BadgeColor = (colorMap && colorMap[value]) ?? defaultColor;\n const label = value.charAt(0).toUpperCase() + value.slice(1).replace(/_/g, ' ');\n\n return (\n <Badge variant={variant} color={color} size=\"sm\" className=\"min-w-16 justify-center capitalize\">\n {label}\n </Badge>\n );\n};\n"],"mappings":"wGAmCA,MAAa,GAAyC,CAAE,QAAO,WAAU,eAAe,QAAS,UAAU,UACrG,GAAU,MAA+B,IAAU,IAAW,EAAA,EAAA,IAAA,CAACA,EAAAA,EAAD,CAAe,CAAA,GAM/E,EAAA,EAAA,IAAA,CAACC,EAAAA,MAAD,CAAgB,UAAS,OAJA,GAAY,EAAS,KAAW,EAIlB,KAAK,KAAK,UAAU,qCAH/C,SAAA,EAAM,OAAO,CAAC,CAAC,CAAC,YAAY,EAAI,EAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAM,GAAG,CAKrE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./data-display/statistic.cjs"),t=require("./tables-
|
|
2
|
-
//# sourceMappingURL=summary-bar-
|
|
1
|
+
const e=require("./data-display/statistic.cjs"),t=require("./tables-CS3NhgTc.cjs");let n=require("react"),r=require("@customafk/react-toolkit/utils"),i=require("react/jsx-runtime");const a={up:`bg-success`,down:`bg-danger`,neutral:`bg-primary`},o=(0,n.memo)(()=>{let{summary:n,onSummaryItemClick:o}=t.Y(),{isOpen:s}=t.Z();return!s||!n||n.length===0?null:(0,i.jsx)(`div`,{"data-slot":`table-summary-bar`,className:`w-full overflow-x-auto px-2 pb-1`,children:(0,i.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(200px, 240px))`},children:n.map(t=>{let n=a[t.trend??`neutral`],s=!!o;return(0,i.jsxs)(`div`,{className:(0,r.cn)(`flex flex-col overflow-hidden rounded border border-border bg-card shadow-card`,s&&`cursor-pointer transition-shadow hover:shadow-md`),onClick:s?()=>o(t):void 0,role:s?`button`:void 0,tabIndex:s?0:void 0,onKeyDown:s?e=>{(e.key===`Enter`||e.key===` `)&&o(t)}:void 0,children:[(0,i.jsx)(`div`,{className:(0,r.cn)(`h-0.75 w-full shrink-0`,n)}),(0,i.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-5 py-4`,children:[(0,i.jsx)(`span`,{className:`font-semibold text-[11px] text-text-positive-weak uppercase tracking-widest`,children:t.label}),t.value!==null&&t.value!==void 0?(0,i.jsx)(e.Statistic,{value:t.value,prefix:t.prefix,suffix:t.suffix,precision:t.precision,trend:t.trend,size:`xl`,className:`font-bold`}):(0,i.jsx)(`span`,{className:`font-bold text-text-positive-strong text-xl tabular-nums`,children:`—`}),!!t.description&&(0,i.jsx)(`span`,{className:`text-text-positive-weak text-xs`,children:t.description})]})]},t.label)})})})});o.displayName=`UITableSummaryBar`,exports.UITableSummaryBar=o;
|
|
2
|
+
//# sourceMappingURL=summary-bar-DKZh-VSB.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary-bar-
|
|
1
|
+
{"version":3,"file":"summary-bar-DKZh-VSB.cjs","names":["useUITableContext","useUITableSummaryContext","Statistic"],"sources":["../packages/components/features/tables/components/table/summary-bar.tsx"],"sourcesContent":["'use client';\nimport { memo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Statistic } from '@/components/data-display/statistic';\nimport { useUITableContext, useUITableSummaryContext } from '../../hooks/use-context';\nimport type { SummaryItem } from '../../types';\n\nconst trendAccent: Record<NonNullable<SummaryItem['trend']>, string> = {\n up: 'bg-success',\n down: 'bg-danger',\n neutral: 'bg-primary',\n};\n\nexport const UITableSummaryBar = memo(() => {\n const { summary, onSummaryItemClick } = useUITableContext();\n const { isOpen } = useUITableSummaryContext();\n\n if (!isOpen || !summary || summary.length === 0) return null;\n\n return (\n <div data-slot=\"table-summary-bar\" className=\"w-full overflow-x-auto px-2 pb-1\">\n <div className=\"grid gap-3\" style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 240px))' }}>\n {summary.map(item => {\n const accent = trendAccent[item.trend ?? 'neutral'];\n const isClickable = !!onSummaryItemClick;\n\n return (\n <div\n key={item.label}\n className={cn(\n 'flex flex-col overflow-hidden rounded border border-border bg-card shadow-card',\n isClickable && 'cursor-pointer transition-shadow hover:shadow-md'\n )}\n onClick={isClickable ? () => onSummaryItemClick(item) : undefined}\n role={isClickable ? 'button' : undefined}\n tabIndex={isClickable ? 0 : undefined}\n onKeyDown={\n isClickable\n ? e => {\n if (e.key === 'Enter' || e.key === ' ') onSummaryItemClick(item);\n }\n : undefined\n }\n >\n {/* Coloured accent strip */}\n <div className={cn('h-0.75 w-full shrink-0', accent)} />\n\n <div className=\"flex flex-1 flex-col gap-2 px-5 py-4\">\n {/* Label */}\n <span className=\"font-semibold text-[11px] text-text-positive-weak uppercase tracking-widest\">{item.label}</span>\n\n {/* Value */}\n {item.value !== null && item.value !== undefined ? (\n <Statistic\n value={item.value}\n prefix={item.prefix}\n suffix={item.suffix}\n precision={item.precision}\n trend={item.trend}\n size=\"xl\"\n className=\"font-bold\"\n />\n ) : (\n <span className=\"font-bold text-text-positive-strong text-xl tabular-nums\">—</span>\n )}\n\n {/* Description */}\n {!!item.description && <span className=\"text-text-positive-weak text-xs\">{item.description}</span>}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n});\nUITableSummaryBar.displayName = 'UITableSummaryBar';\n"],"mappings":"qLASA,MAAM,EAAiE,CACrE,GAAI,aACJ,KAAM,YACN,QAAS,YACX,EAEa,GAAA,EAAA,EAAA,KAAA,KAA+B,CAC1C,GAAM,CAAE,UAAS,sBAAuBA,EAAAA,EAAkB,EACpD,CAAE,UAAWC,EAAAA,EAAyB,EAI5C,MAFI,CAAC,GAAU,CAAC,GAAW,EAAQ,SAAW,EAAU,MAGtD,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,YAAU,oBAAoB,UAAU,mCAC3C,UAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,aAAa,MAAO,CAAE,oBAAqB,yCAA0C,EACjG,SAAA,EAAQ,IAAI,GAAQ,CACnB,IAAM,EAAS,EAAY,EAAK,OAAS,WACnC,EAAc,CAAC,CAAC,EAEtB,OACE,EAAA,EAAA,KAAA,CAAC,MAAD,CAEE,WAAA,EAAA,EAAA,GAAA,CACE,iFACA,GAAe,kDACjB,EACA,QAAS,MAAoB,EAAmB,CAAI,EAAI,IAAA,GACxD,KAAM,EAAc,SAAW,IAAA,GAC/B,SAAU,EAAc,EAAI,IAAA,GAC5B,UACE,EACI,GAAK,EACC,EAAE,MAAQ,SAAW,EAAE,MAAQ,MAAK,EAAmB,CAAI,CACjE,EACA,IAAA,GAdR,SAAA,EAkBE,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,WAAA,EAAA,EAAA,GAAA,CAAc,yBAA0B,CAAM,CAAI,CAAA,GAEvD,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,uCAAf,SAAA,EAEE,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,8EAA+E,SAAA,EAAK,KAAY,CAAA,EAG/G,EAAK,QAAU,MAAQ,EAAK,QAAU,IAAA,IACrC,EAAA,EAAA,IAAA,CAACC,EAAAA,UAAD,CACE,MAAO,EAAK,MACZ,OAAQ,EAAK,OACb,OAAQ,EAAK,OACb,UAAW,EAAK,UAChB,MAAO,EAAK,MACZ,KAAK,KACL,UAAU,WACX,CAAA,GAED,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2DAA2D,SAAA,GAAO,CAAA,EAInF,CAAC,CAAC,EAAK,cAAe,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,kCAAmC,SAAA,EAAK,WAAkB,CAAA,CAC9F,CACF,CAAA,CAAA,CAzCE,EAAA,EAAK,KAyCP,CAET,CAAC,CACE,CAAA,CACF,CAAA,CAET,CAAC,EACD,EAAkB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Statistic as e}from"./data-display/statistic.mjs";import{Y as t,Z as n}from"./tables-
|
|
2
|
-
//# sourceMappingURL=summary-bar-
|
|
1
|
+
import{Statistic as e}from"./data-display/statistic.mjs";import{Y as t,Z as n}from"./tables-7_KgoyS-.mjs";import{memo as r}from"react";import{cn as i}from"@customafk/react-toolkit/utils";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s={up:`bg-success`,down:`bg-danger`,neutral:`bg-primary`},c=r(()=>{let{summary:r,onSummaryItemClick:c}=t(),{isOpen:l}=n();return!l||!r||r.length===0?null:a(`div`,{"data-slot":`table-summary-bar`,className:`w-full overflow-x-auto px-2 pb-1`,children:a(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(200px, 240px))`},children:r.map(t=>{let n=s[t.trend??`neutral`],r=!!c;return o(`div`,{className:i(`flex flex-col overflow-hidden rounded border border-border bg-card shadow-card`,r&&`cursor-pointer transition-shadow hover:shadow-md`),onClick:r?()=>c(t):void 0,role:r?`button`:void 0,tabIndex:r?0:void 0,onKeyDown:r?e=>{(e.key===`Enter`||e.key===` `)&&c(t)}:void 0,children:[a(`div`,{className:i(`h-0.75 w-full shrink-0`,n)}),o(`div`,{className:`flex flex-1 flex-col gap-2 px-5 py-4`,children:[a(`span`,{className:`font-semibold text-[11px] text-text-positive-weak uppercase tracking-widest`,children:t.label}),t.value!==null&&t.value!==void 0?a(e,{value:t.value,prefix:t.prefix,suffix:t.suffix,precision:t.precision,trend:t.trend,size:`xl`,className:`font-bold`}):a(`span`,{className:`font-bold text-text-positive-strong text-xl tabular-nums`,children:`—`}),!!t.description&&a(`span`,{className:`text-text-positive-weak text-xs`,children:t.description})]})]},t.label)})})})});c.displayName=`UITableSummaryBar`;export{c as UITableSummaryBar};
|
|
2
|
+
//# sourceMappingURL=summary-bar-DX_sOiuL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary-bar-
|
|
1
|
+
{"version":3,"file":"summary-bar-DX_sOiuL.mjs","names":[],"sources":["../packages/components/features/tables/components/table/summary-bar.tsx"],"sourcesContent":["'use client';\nimport { memo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Statistic } from '@/components/data-display/statistic';\nimport { useUITableContext, useUITableSummaryContext } from '../../hooks/use-context';\nimport type { SummaryItem } from '../../types';\n\nconst trendAccent: Record<NonNullable<SummaryItem['trend']>, string> = {\n up: 'bg-success',\n down: 'bg-danger',\n neutral: 'bg-primary',\n};\n\nexport const UITableSummaryBar = memo(() => {\n const { summary, onSummaryItemClick } = useUITableContext();\n const { isOpen } = useUITableSummaryContext();\n\n if (!isOpen || !summary || summary.length === 0) return null;\n\n return (\n <div data-slot=\"table-summary-bar\" className=\"w-full overflow-x-auto px-2 pb-1\">\n <div className=\"grid gap-3\" style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 240px))' }}>\n {summary.map(item => {\n const accent = trendAccent[item.trend ?? 'neutral'];\n const isClickable = !!onSummaryItemClick;\n\n return (\n <div\n key={item.label}\n className={cn(\n 'flex flex-col overflow-hidden rounded border border-border bg-card shadow-card',\n isClickable && 'cursor-pointer transition-shadow hover:shadow-md'\n )}\n onClick={isClickable ? () => onSummaryItemClick(item) : undefined}\n role={isClickable ? 'button' : undefined}\n tabIndex={isClickable ? 0 : undefined}\n onKeyDown={\n isClickable\n ? e => {\n if (e.key === 'Enter' || e.key === ' ') onSummaryItemClick(item);\n }\n : undefined\n }\n >\n {/* Coloured accent strip */}\n <div className={cn('h-0.75 w-full shrink-0', accent)} />\n\n <div className=\"flex flex-1 flex-col gap-2 px-5 py-4\">\n {/* Label */}\n <span className=\"font-semibold text-[11px] text-text-positive-weak uppercase tracking-widest\">{item.label}</span>\n\n {/* Value */}\n {item.value !== null && item.value !== undefined ? (\n <Statistic\n value={item.value}\n prefix={item.prefix}\n suffix={item.suffix}\n precision={item.precision}\n trend={item.trend}\n size=\"xl\"\n className=\"font-bold\"\n />\n ) : (\n <span className=\"font-bold text-text-positive-strong text-xl tabular-nums\">—</span>\n )}\n\n {/* Description */}\n {!!item.description && <span className=\"text-text-positive-weak text-xs\">{item.description}</span>}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n});\nUITableSummaryBar.displayName = 'UITableSummaryBar';\n"],"mappings":"6OASA,MAAM,EAAiE,CACrE,GAAI,aACJ,KAAM,YACN,QAAS,YACX,EAEa,EAAoB,MAAW,CAC1C,GAAM,CAAE,UAAS,sBAAuB,EAAkB,EACpD,CAAE,UAAW,EAAyB,EAI5C,MAFI,CAAC,GAAU,CAAC,GAAW,EAAQ,SAAW,EAAU,KAGtD,EAAC,MAAD,CAAK,YAAU,oBAAoB,UAAU,mCAC3C,SAAA,EAAC,MAAD,CAAK,UAAU,aAAa,MAAO,CAAE,oBAAqB,yCAA0C,EACjG,SAAA,EAAQ,IAAI,GAAQ,CACnB,IAAM,EAAS,EAAY,EAAK,OAAS,WACnC,EAAc,CAAC,CAAC,EAEtB,OACE,EAAC,MAAD,CAEE,UAAW,EACT,iFACA,GAAe,kDACjB,EACA,QAAS,MAAoB,EAAmB,CAAI,EAAI,IAAA,GACxD,KAAM,EAAc,SAAW,IAAA,GAC/B,SAAU,EAAc,EAAI,IAAA,GAC5B,UACE,EACI,GAAK,EACC,EAAE,MAAQ,SAAW,EAAE,MAAQ,MAAK,EAAmB,CAAI,CACjE,EACA,IAAA,GAdR,SAAA,CAkBE,EAAC,MAAD,CAAK,UAAW,EAAG,yBAA0B,CAAM,CAAI,CAAA,EAEvD,EAAC,MAAD,CAAK,UAAU,uCAAf,SAAA,CAEE,EAAC,OAAD,CAAM,UAAU,8EAA+E,SAAA,EAAK,KAAY,CAAA,EAG/G,EAAK,QAAU,MAAQ,EAAK,QAAU,IAAA,GACrC,EAAC,EAAD,CACE,MAAO,EAAK,MACZ,OAAQ,EAAK,OACb,OAAQ,EAAK,OACb,UAAW,EAAK,UAChB,MAAO,EAAK,MACZ,KAAK,KACL,UAAU,WACX,CAAA,EAED,EAAC,OAAD,CAAM,UAAU,2DAA2D,SAAA,GAAO,CAAA,EAInF,CAAC,CAAC,EAAK,aAAe,EAAC,OAAD,CAAM,UAAU,kCAAmC,SAAA,EAAK,WAAkB,CAAA,CAC9F,CACF,CAAA,CAAA,CAzCE,EAAA,EAAK,KAyCP,CAET,CAAC,CACE,CAAA,CACF,CAAA,CAET,CAAC,EACD,EAAkB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Statistic as e}from"./data-display/statistic.mjs";import{Checkbox as t}from"./ui/checkbox.mjs";import{DropdownMenu as n,DropdownMenuContent as r,DropdownMenuGroup as i,DropdownMenuItem as a,DropdownMenuShortcut as o,DropdownMenuTrigger as s}from"./ui/dropdown-menu.mjs";import{Spinner as c}from"./ui/spinner.mjs";import{ResizableHandle as l,ResizablePanel as u,ResizablePanelGroup as d}from"./ui/resizable.mjs";import{AlertTriangle as f,BoxIcon as p,ChevronDown as m,EllipsisVerticalIcon as h,MinusIcon as g,MoveLeftIcon as _,MoveRightIcon as v,PinOffIcon as y}from"lucide-react";import{Activity as b,Suspense as x,createContext as S,lazy as ee,memo as C,use as w,useCallback as T,useEffect as E,useId as te,useMemo as D,useRef as ne,useState as O}from"react";import{cn as k}from"@customafk/react-toolkit/utils";import{cva as A}from"class-variance-authority";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{flexRender as P,getCoreRowModel as re,getExpandedRowModel as ie,getGroupedRowModel as ae,useReactTable as oe}from"@tanstack/react-table";const se=()=>N(`div`,{className:`flex gap-0 text-text-positive-weak`,children:[M(g,{size:16}),M(g,{size:16})]}),F=S(null),I=()=>{let e=w(F);if(!e)throw Error(`useTableInnerWrapperContext must be used within a TableInnerWrapperProvider`);return e},L=S(null),ce=()=>{let e=w(L);if(!e)throw Error(`useTableInnerTableContext must be used within a TableInnerTableProvider`);return e},R=S(null),le=()=>{let e=w(R);if(!e)throw Error(`useTableHeaderRowContext must be used within a TableHeaderRowProvider`);return e},z=S(null),B=()=>{let e=w(z);if(!e)throw Error(`useTableBodyContext must be used within a TableBodyProvider`);return e},ue=S(null),de=()=>{let e=w(ue);if(!e)throw Error(`useTableRowContext must be used within a TableRowProvider`);return e},fe=S(null),V=()=>{let e=w(fe);if(!e)throw Error(`useTableContext must be used within a TableProvider`);return e},pe=S(null),me=()=>{let e=w(pe);if(!e)throw Error(`useUITableFilterContext must be used within a UITableProvider`);return e},he=S(null),ge=()=>{let e=w(he);if(!e)throw Error(`useUITableAnalysisContext must be used within a UITableProvider`);return e},_e=S(null),ve=()=>{let e=w(_e);if(!e)throw Error(`useUITableSummaryContext must be used within a UITableProvider`);return e},H=`border-r! !border-r-border-strong/30`,U=`border-l! !border-l-border-strong/30`,W=A([`absolute right-2 z-10 p-0.5 opacity-0 bg-card`,`cursor-pointer rounded-full transition-all`,`text-text-positive-weak`,`[&>svg]:size-4`,`group-hover:opacity-100`,`hover:bg-muted-muted hover:text-text-positive`]),ye=A([`sticky left-0 flex flex-1 items-center justify-center bg-transparent text-text-positive-weak opacity-100`]),G=A([`relative m-0 flex size-full flex-col flex-nowrap items-start justify-start gap-2`]),K=A([`relative w-full flex-1 min-h-0 overflow-auto border-b border-b-border border-l border-l-border`]),be=A([`grid w-full table-fixed caption-bottom border-collapse border-spacing-0 flex-col content-start`]),q=A([`sticky top-0 z-40 h-9 w-full`,`grid select-none bg-white`,`border-b border-b-border shadow`,`font-medium text-[13px] text-text-positive-weak`,`[&_tr:not(:last-child)_td]:border-b`,`[&_th]:inline-flex`,`[&_th]:bg-card`,`[&_th]:items-center`,`[&_th]:transition-all`,`[&_th]:duration-300`,`[&_th]:whitespace-nowrap`,`[&_th]:border-border`,`[&_th]:border-r`,`[&_th]:first:border-l-0`,`[&_tr_th:not([data-pinned=false])]:bg-card`]),J=A([`flex`]),Y=A([`group flex`],{variants:{isPinned:{left:`sticky`,right:`sticky`,false:`relative`},isActions:{true:`border-r-0!`,false:``},isLastCell:{true:``,false:``},isFirstCell:{true:``,false:``},position:{start:`justify-start`,center:`justify-center`,end:`justify-end`}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H},{isPinned:`right`,isFirstCell:!0,className:U}]}),xe=A([`relative w-full`,`[&_tr]:flex`,`[&_tr]:flex-none`,`[&_tr]:w-full`,`[&_tr]:cursor-pointer [&_tr]:focus:outline-none`,`[&_tr]:border-b [&_tr]:border-b-border`,`[&_td]:z-10`,`[&_td]:transition-all`,`[&_td]:flex`,`[&_td]:flex-none`,`[&_td]:overflow-hidden`,`[&_td]:whitespace-nowrap`,`[&_td]:px-4`,`[&_td]:py-2.5`,`[&_td]:align-middle`,`[&_td]:border-border`,`[&_td]:data-[selected=true]:bg-muted-muted!`,`[&_td]:data-[selected=true]:hover:bg-muted-muted!`,`[&_td>div]:inline-flex`,`[&_td>div]:items-center`,`[&_td>div]:w-full`,`[&_td:not([data-pinned=false])]:z-20`,`[&_td:not([data-pinned=false])]:sticky`,`[&_td:not([data-pinned=false])]:bg-muted-bg-subtle`]),X=A([`group transition-colors hover:bg-muted-muted hover:[&_td]:bg-muted-muted! [&_td]:border-r [&_td]:border-r-border`]),Z=A([`group-hover:bg-muted-muted!`],{variants:{isPinned:{left:`sticky`,right:`sticky`,false:`relative`},isLastCell:{true:``,false:``}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H}],defaultVariants:{isPinned:void 0}}),Q=A([`sticky border-r-0! inset-y-0 right-0 z-30 flex items-center pr-4 group-hover:bg-muted-muted!`]),Se=A([`group-hover:bg-muted-muted!`],{variants:{isPinned:{left:``,right:``,false:``},isLastCell:{true:``,false:``},isFirstCell:{true:``,false:``}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H},{isPinned:`right`,isFirstCell:!0,className:U}]}),Ce=A([`overflow-x-hidden`],{variants:{position:{start:`justify-start`,center:`justify-center`,end:`justify-end`}},defaultVariants:{position:`start`}}),we=A([`shrink-0 flex w-full justify-center border-t border-border-weak font-medium`]),Te=A([`flex w-full`,`text-[13px] font-medium text-text-positive-weak`]),Ee=A([`flex flex-none items-center overflow-hidden whitespace-nowrap px-4 py-2`,`border-r border-r-border`],{variants:{isPinned:{left:`sticky z-20 bg-white`,right:`sticky z-20 bg-white`,false:`relative`},isFirstCell:{true:`border-l border-l-border`,false:``},isLastCell:{true:`border-r border-r-border`,false:``}}}),De=A([`flex cursor-pointer gap-x-0.5`],{variants:{state:{idle:`text-text-positive-weak hover:text-text-positive`,fetching:`cursor-not-allowed`,error:`text-danger hover:text-danger-strong`}},defaultVariants:{state:`idle`}}),Oe=C(({className:e,children:t,...n})=>{let{isFetching:r,isRefetching:i,isEmpty:a}=B();return a||r||i?null:M(`tbody`,{slot:`table-body`,className:k(xe(),e),...n,children:t})});Oe.displayName=`UITableBody`;const ke=C(({isPinned:e=!1,isFirstCell:t=!1,isLastCell:n=!1,colId:r,position:i=`start`,column:a,getContext:o,className:s,...c})=>{let{table:l,tableRef:u}=ce(),d=ne(null),f=D(()=>{let t=a?.getStart(`left`);return e===`left`&&typeof t==`number`?`${t}px`:void 0},[e,a]),p=D(()=>{let t=a?.getAfter(`right`);return e===`right`&&typeof t==`number`?`${t}px`:void 0},[e,a]),m=D(()=>`calc(var(--col-${r}-size) * 1px)`,[r]),h=D(()=>a?.columnDef.minSize?`calc(var(--col-${r}-minSize) * 1px)`:void 0,[r,a]),g=D(()=>a?.columnDef.maxSize?`calc(var(--col-${r}-maxSize) * 1px)`:void 0,[r,a]),_=D(()=>P(a?.columnDef.cell,o()),[a,o]);return E(()=>{if(!d.current)return;let e=d.current.scrollWidth,t=a?.getSize();t!=null&&e>t&&u.current instanceof HTMLTableElement&&typeof r==`string`&&a?.columnDef.meta?.fitContent&&l.setColumnSizing(t=>({...t,[r]:e+32}))},[r,a,l]),M(`td`,{slot:`table-body-cell`,"data-pinned":e,"data-lastcell":n||void 0,"data-firstcell":t||void 0,style:{left:f,right:p,width:m,minWidth:h,maxWidth:g},className:k(Se({isPinned:e||void 0,isLastCell:n,isFirstCell:t}),s),...c,children:M(`div`,{ref:d,slot:`table-body-cell-inner`,className:Ce({position:i}),children:_})})});ke.displayName=`UITableCell`;const Ae=C(({column:e,getContext:t,className:n,...r})=>{let i=D(()=>P(e?.columnDef.cell,t()),[e,t]);return M(`td`,{"data-col":`actions`,className:Q(),...r,children:i})});Ae.displayName=`UITableCellActions`;const je=C(({isPinned:e,isLastCell:n,isSelected:r=!1,className:i,onToggleRowSelected:a,...o})=>{let s=T(e=>{a?.(!!e)},[a]);return M(`td`,{slot:`table-body-cell`,"data-pinned":!0,style:{left:0,zIndex:20,width:60,maxWidth:60},className:k(Z({isPinned:e,isLastCell:n}),i),...o,children:M(`div`,{"data-slot":`table-cell-inner`,className:`flex! w-full! items-center justify-center bg-transparent text-center align-middle`,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:M(t,{"aria-label":`Select Row`,checked:r,onCheckedChange:s})})})});je.displayName=`UITableCellSelect`;const Me=C(()=>{let{table:e,isFetching:t,isRefetching:n,loadingDisplayRow:r=3}=V();return!t&&!n?null:M(`tbody`,{className:k(xe(),`pointer-events-none`),children:Array.from({length:r}).map((t,n)=>M(`tr`,{"data-slot":`table-row`,"data-index":n,className:k(X(),`animate-pulse relative!`),children:e.getAllColumns().map((t,r)=>{let i=t.getIsPinned(),a=t.getStart(`left`),o=t.getAfter(`right`);return t.id===`actions`?M(`td`,{"data-slot":`table-body-cell`,"data-col":t.id,"data-cell":r,style:{width:60},className:Q(),children:M(`div`,{className:`w-full h-4 bg-muted-muted rounded-full`})},`${t.id}-${r}`):t.id===`select`?M(`td`,{"data-slot":`table-body-cell`,"data-col":t.id,"data-cell":r,"data-pinned":!0,style:{left:0,zIndex:20,width:60,maxWidth:60},className:Z({isPinned:`left`}),children:M(`div`,{className:`w-full flex justify-center`,children:M(`div`,{className:`size-4 bg-muted-muted rounded-full`})})},`${t.id}-${n}`):M(`td`,{"data-col":t.id,"data-cell":r,"data-selected":void 0,"data-lastcell":t.id===e.getAllColumns()[e.getAllColumns().length-1].id||void 0,"data-firstcell":t.id===e.getAllColumns()[0].id||void 0,style:{zIndex:i?20:0,left:i===`left`&&typeof a==`number`?`${a}px`:void 0,right:i===`right`&&typeof o==`number`?`${o}px`:void 0,width:`calc(var(--col-${t.id}-size) * 1px)`,minWidth:t.columnDef.minSize?`calc(var(--col-${t.id}-minSize) * 1px)`:void 0,maxWidth:t.columnDef.maxSize?`calc(var(--col-${t.id}-maxSize) * 1px)`:void 0},className:Se({isPinned:t.getIsPinned(),isFirstCell:t.id===e.getRightHeaderGroups()[0]?.headers[0]?.id,isLastCell:t.id===e.getLeftHeaderGroups()[0]?.headers[e.getLeftHeaderGroups()[0].headers.length-1]?.id}),children:M(`div`,{className:Ce({position:t.columnDef.meta?.position??`start`}),children:M(`div`,{className:`w-full h-4 bg-muted-muted rounded-full`})})},`${t.id}-${r}`)})},n))})}),Ne=C(()=>{let{isEmpty:e,emptyDisplayHeight:t}=V();return e?M(j,{children:e&&M(`div`,{className:ye(),style:{minHeight:t??`24rem`},children:N(`div`,{className:`flex flex-col items-center gap-1`,children:[M(p,{strokeWidth:1,size:48}),M(`p`,{children:`Không có dữ liệu`})]})})}):null});Ne.displayName=`UITableEmptyDisplay`;const Pe=C(({className:e,children:t,...n})=>M(`div`,{slot:`table-footer`,className:k(we(),e),...n,children:t}));Pe.displayName=`UITableFooter`;function Fe(e,t,n){switch(n){case`count`:return e;case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.length===0?0:t.reduce((e,t)=>e+t,0)/t.length;case`min`:return t.length===0?0:Math.min(...t);case`max`:return t.length===0?0:Math.max(...t)}}function Ie(e,t){return e.map(e=>{let n=e.getValue(t);return typeof n==`string`?Number(n):typeof n==`number`?n:NaN}).filter(e=>!Number.isNaN(e))}const Le=C(()=>{let{table:t}=V(),{rowSelectionState:n}=B(),r=D(()=>t.getHeaderGroups()[0]?.headers??[],[t.getHeaderGroups()]),i=D(()=>r.some(e=>e.column.columnDef.meta?.aggregation),[r]),a=D(()=>t.getSelectedRowModel().flatRows,[t,n]),o=D(()=>t.getRowModel().rows,[t]),s=a.length>0?a:o,c=D(()=>{let e={};for(let t of r){let n=t.column.columnDef.meta?.aggregation;if(!n)continue;let r=Ie(s,t.id);e[t.id]=Fe(s.length,r,n.type)}return e},[r,s]),l=t.getState().columnPinning,u=l.left??[],d=l.right??[],f=r.find(e=>d.includes(e.id))?.id,p=[...r].reverse().find(e=>u.includes(e.id))?.id;if(!i)return null;let m=a.length>0?`${a.length}`:`${o.length}`;return M(`div`,{slot:`table-footer-row`,className:Te(),children:r.map(t=>{let n=t.id,r=u.includes(n)?`left`:d.includes(n)?`right`:!1,i=n===f,a=n===p,o=r===`left`?`${t.column.getStart(`left`)}px`:void 0,s=r===`right`?`${t.column.getAfter(`right`)}px`:void 0;if(n===`select`)return M(`div`,{slot:`table-footer-select`,"data-pinned":`left`,style:{left:`0px`,width:`60px`},className:k(Ee({isPinned:`left`,isFirstCell:!1,isLastCell:!1}),`justify-center`),children:M(`span`,{className:`truncate text-[11px] items-center text-text-positive-weak`,children:m})},n);if(n===`actions`)return M(`div`,{slot:`table-footer-actions`,style:{width:`calc(var(--col-${n}-size) * 1px)`,right:`0px`},className:Ee({isPinned:!1,isFirstCell:!1,isLastCell:!1})},n);let l=t.column.columnDef.meta?.aggregation,h=c[n]??null;return M(`div`,{slot:`table-footer-cell`,"data-pinned":r,style:{left:o,right:s,width:`calc(var(--col-${n}-size) * 1px)`},className:Ee({isPinned:r||`left`,isFirstCell:i,isLastCell:a}),children:l&&h!==null?M(e,{value:h,prefix:l.prefix,suffix:l.suffix,precision:l.precision,size:`sm`}):M(`span`,{className:`text-text-positive-weak`,children:`—`})},n)})})});Le.displayName=`UITableFooterRow`;const Re=C(({className:e,children:t,...n})=>M(`thead`,{slot:`table-head`,className:k(q(),e),...n,children:t}));Re.displayName=`UITableHead`;const ze=C(({isPinned:e,onLeftPin:t,onRightPin:c,onUnpin:l,className:u})=>{let d=T(()=>{t?.(`left`)},[t]),f=T(()=>{c?.(`right`)},[c]),p=T(()=>{l?.(!1)},[l]);return N(n,{children:[M(s,{asChild:!0,children:M(`button`,{type:`button`,className:k(W(),u),children:M(h,{})})}),M(r,{align:`end`,className:`w-64 p-4`,children:N(i,{className:`*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2`,children:[M(b,{mode:e?`visible`:`hidden`,children:N(a,{onClick:p,children:[!!e&&`Bỏ ghim`,M(o,{children:M(y,{className:`size-4`})})]})}),N(b,{mode:e?`hidden`:`visible`,children:[N(a,{onClick:d,children:[e?`Bỏ ghim`:`Ghim trái`,M(o,{children:M(_,{className:`size-4`})})]}),N(a,{onClick:f,children:[e?`Bỏ ghim`:`Ghim phải`,M(o,{children:M(v,{className:`size-4`})})]})]})]})})]})});ze.displayName=`UITableHeadCellOption`;const Be=C(({isVisible:e=!0,isPinned:t=!1,isFirstCell:n=!1,isLastCell:r=!1,isOptionsVisible:i=!0,headerId:a,headerColumn:o,className:s,children:c,onColumnPin:l,onToggleVisibility:u,...d})=>{let f=o?.columnDef.meta?.position;return N(`th`,{slot:`table-head-cell`,"data-pinned":t,"data-header":a,style:{zIndex:D(()=>t?20:void 0,[t]),left:D(()=>{let e=o?.getStart?.(`left`);return t===`left`&&typeof e==`number`?`${e}px`:void 0},[t,o]),right:D(()=>{let e=o?.getAfter?.(`right`);return t===`right`&&typeof e==`number`?`${e}px`:void 0},[t,o]),width:D(()=>`calc(var(--header-${a}-size) * 1px)`,[a]),minWidth:D(()=>o?.columnDef.minSize?`calc(var(--col-${a}-minSize) * 1px)`:void 0,[a,o]),maxWidth:D(()=>o?.columnDef.maxSize?`calc(var(--col-${a}-maxSize) * 1px)`:void 0,[a,o])},className:k(Y({isPinned:t||`false`,isActions:a===`actions`,isLastCell:r,isFirstCell:n,position:f}),s),...d,children:[M(`div`,{className:`truncate px-4`,children:c}),i&&M(ze,{isPinned:t,isVisible:e,onLeftPin:l,onRightPin:l,onUnpin:l})]})});Be.displayName=`UITableHeadCell`;const Ve=C(({isPinned:e,isLastCell:n,isAllRowsSelected:r,style:i,className:a,onToggleAllRowsSelected:o,...s})=>{let c=T(e=>{o?.(!!e)},[o]);return M(`th`,{slot:`table-header-cell`,"data-pinned":!0,style:{left:0,zIndex:40,width:60,maxWidth:60},className:k(Z({isPinned:e,isLastCell:n}),a),...s,children:M(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:M(t,{"aria-label":`Select All Rows`,checked:r,onCheckedChange:c})})})});Ve.displayName=`UITableHeadCellSelect`;const He=C(({headerGroup:e,className:t,...n})=>{let{isAllRowsSelected:r,columnPinningState:i,leftPinnedHeaders:a,rightPinnedHeaders:o,onToggleAllRowsSelected:s}=le(),c=o[0]?.id,l=a[a.length-1]?.id;return M(`tr`,{slot:`table-head-row`,className:k(J(),t),...n,children:e.headers.map((e,t)=>{let n=e.column.getIsVisible(),a=i.left?.includes(e.id)?`left`:i.right?.includes(e.id)?`right`:!1;return e.id===`select`?M(Ve,{isPinned:a,isLastCell:e.id===l,isAllRowsSelected:r,onToggleAllRowsSelected:s},e.id):M(Be,{isVisible:n,isPinned:a,isFirstCell:e.id===c,isLastCell:e.id===l,isOptionsVisible:![`select`,`actions`].includes(e.id),headerId:e.id,headerColumn:e.column,colSpan:e.colSpan,onColumnPin:e.column.pin,onToggleVisibility:e.column.toggleVisibility,children:P(e.column.columnDef.header,e.getContext())},`${e.id}-${t}`)})})});He.displayName=`UITableHeadRow`;const Ue=C(({children:e,...t})=>{let{table:n,innerTableId:r,totalSize:i,tableRef:a}=ce();return E(()=>{if(!a.current)return;let e=n.getFlatHeaders(),t,r=new ResizeObserver(r=>{t!==void 0&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{let t=r[0];if(!t)return;let i=t.target;if(!(i instanceof HTMLTableElement))return;let a=t.contentRect.width,{left:o=[],right:s=[]}=n.getState().columnPinning,c=0,l=0,u=0,d=e.map(e=>{let{id:t}=e,n=t===`select`||t===`actions`,r=o.includes(t)||s.includes(t),i=e.getSize(),a=e.column.columnDef.maxSize;return n?(c+=60,{id:t,isFlex:!1,width:60}):r?(c+=i,{id:t,isFlex:!1,width:i}):e.column.columnDef.size||i!==150?(u+=i,{id:t,isFlex:!1,width:i}):(l++,{id:t,isFlex:!0,maxSize:a})}),f=a-c-u,p=l>0?Math.max(0,Math.floor(f/l)):0,m=i.closest(`[data-slot="table-scroll-host"]`);d.forEach(e=>{if(e.isFlex){let t=e.maxSize?Math.min(p,e.maxSize):p;i.style.setProperty(`--header-${e.id}-size`,`${t}`),i.style.setProperty(`--col-${e.id}-size`,`${t}`),m?.style.setProperty(`--col-${e.id}-size`,`${t}`),e.maxSize&&i.style.setProperty(`--col-${e.id}-maxSize`,`${e.maxSize}`)}else i.style.setProperty(`--header-${e.id}-size`,`${e.width}`),i.style.setProperty(`--col-${e.id}-size`,`${e.width}`),m?.style.setProperty(`--col-${e.id}-size`,`${e.width}`)})})});return r.observe(a.current),()=>{t!==void 0&&cancelAnimationFrame(t),r.disconnect()}},[n.getState().columnSizingInfo,n.getState().columnSizing,n.getState().columnPinning]),M(`table`,{id:r,ref:a,slot:`table-inner-table`,className:be(),style:{minWidth:i},...t,children:e})});Ue.displayName=`UITableInnerTable`;const We=C(({children:e,...t})=>{let{innerWrapperId:n}=I();return M(`div`,{id:n,slot:`table-inner-wrapper`,className:K(),...t,children:e})});We.displayName=`UITableInnerWrapper`;const Ge=C(({fetchMoreData:e})=>{let{innerWrapperId:t}=I(),[n,r]=O(`idle`),[i,a]=O(0),o=T(async()=>{try{r(`fetching`),await e?.(),r(`idle`)}catch(e){console.error(`Error fetching more data:`,e),r(`error`)}},[e]);return E(()=>{let e=document.querySelector(`div[id="${t}"]`);if(!e)return;let n=new ResizeObserver(e=>{a(e[0].contentRect.width)});return n.observe(e),()=>n.disconnect()},[t]),e?M(`tr`,{className:`sticky! left-0 h-10`,style:{width:i},children:M(`td`,{className:`absolute left-0 flex w-full items-center justify-center text-xs`,children:N(`button`,{type:`button`,disabled:n===`fetching`,className:De({state:n}),onClick:o,children:[n===`idle`&&M(m,{className:`size-4`}),n===`fetching`&&M(c,{className:`size-4 animate-spin`}),n===`error`&&M(f,{className:`size-4 text-danger`}),n===`idle`&&`Tải thêm`,n===`fetching`&&`Đang tải...`,n===`error`&&`Lỗi! Thử lại?`]})})}):null});Ge.displayName=`UITableLoadMore`;const Ke=C(({row:e,isSelected:t,rowIndex:n,children:r,...i})=>{let{keyOfClickRow:a,isAllRowsSelected:o,columnPinningState:s,leftPinnedHeaders:c,rightPinnedHeaders:l,onClickRow:u}=de(),d=D(()=>s.left??[],[s]),f=D(()=>s.right??[],[s]),p=D(()=>l?.[0]?.id,[l]),m=D(()=>c?.[c.length-1]?.id,[c]),h=D(()=>e.getVisibleCells().some(e=>e.column.id===`select`),[e]),g=T(t=>{if(u){let t=a?e.original?.[a]:void 0;u(n,typeof t==`string`||typeof t==`number`?t:void 0)}else h&&e.toggleSelected();t.preventDefault(),t.stopPropagation()},[a,u,e,n,h]);return M(`tr`,{slot:`table-row`,"data-index":n,className:X(),onClick:g,...i,children:e.getVisibleCells().map((e,r)=>{let i=d.includes(e.column.id),a=f.includes(e.column.id),s=i?`left`:a?`right`:!1;return e.column.id===`actions`?M(Ae,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,column:e.column,getContext:e.getContext},`${e.id}-${r}`):e.column.id===`select`?M(je,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,isPinned:s,isLastCell:e.column.id===m,isSelected:o||t,onToggleRowSelected:e.row.toggleSelected},`${e.id}-${r}`):M(ke,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,isPinned:s,isFirstCell:e.column.id===p,isLastCell:e.column.id===m,colId:e.column.id,position:e.column.columnDef.meta?.position??`start`,column:e.column,getContext:e.getContext},`${e.id}-${r}`)})})});Ke.displayName=`UITableRow`;const qe=C(({className:e,children:t,...n})=>M(`div`,{slot:`table-wrapper`,className:k(G(),e),...n,children:t}));qe.displayName=`UITableWrapper`;const Je=({children:e})=>{let{table:t,fetchMoreData:n}=V(),{rowSelectionState:r}=B(),{rows:i}=t.getRowModel();return N(d,{direction:`horizontal`,style:{direction:t.options.columnResizeDirection},className:`relative flex w-full max-w-full flex-1 gap-1 overflow-auto border-t border-t-border border-r border-r-border p-0 text-sm`,children:[M(u,{"data-slot":`table-scroll-host`,className:`relative flex flex-col`,children:N(We,{children:[N(Ue,{children:[M(Re,{children:t.getHeaderGroups().map(e=>M(He,{headerGroup:e},e.id))}),N(Oe,{children:[i.map((e,t)=>M(Ke,{row:e,isSelected:r[e.id]===!0,rowIndex:t},e.id)),n&&M(Ge,{fetchMoreData:n})]}),M(Me,{})]}),M(Ne,{})]})}),e&&N(j,{children:[M(l,{}),e]})]})};function Ye(e){switch(e){case`tag`:return{type:`tag`,values:[]};case`single-tag`:return{type:`single-tag`,value:null};case`date-range`:return{type:`date-range`};case`number`:return{type:`number`,operator:`eq`};case`text`:return{type:`text`,operator:`contains`,value:``};case`boolean`:return{type:`boolean`,value:null}}}const Xe=C(({innerWrapperId:e,children:t})=>{let n=D(()=>({innerWrapperId:e}),[e]);return M(F.Provider,{value:n,children:t})});Xe.displayName=`UITableInnerWrapperProvider`;const Ze=C(({table:e,innerTableId:t,totalSize:n,tableRef:r,children:i})=>{let a=D(()=>({table:e,innerTableId:t,totalSize:n,tableRef:r}),[e,t,n,r]);return M(L.Provider,{value:a,children:i})});Ze.displayName=`UITableInnerTableProvider`;const Qe=C(({isAllRowsSelected:e,columnPinningState:t,leftPinnedHeaders:n,rightPinnedHeaders:r,onToggleAllRowsSelected:i,children:a})=>{let o=D(()=>({isAllRowsSelected:e,columnPinningState:t,leftPinnedHeaders:n,rightPinnedHeaders:r,onToggleAllRowsSelected:i}),[e,t,n,r,i]);return M(R.Provider,{value:o,children:a})});Qe.displayName=`UITableHeadRowProvider`;const $e=C(({isFetching:e,isRefetching:t,isEmpty:n,rowSelectionState:r,children:i})=>{let a=D(()=>({isFetching:e,isRefetching:t,isEmpty:n,rowSelectionState:r}),[e,t,n,r]);return M(z.Provider,{value:a,children:i})});$e.displayName=`UITableBodyProvider`;const et=C(({keyOfClickRow:e,isAllRowsSelected:t,columnPinningState:n,leftPinnedHeaders:r,rightPinnedHeaders:i,onClickRow:a,children:o})=>{let s=D(()=>({keyOfClickRow:e,isAllRowsSelected:t,columnPinningState:n,leftPinnedHeaders:r,rightPinnedHeaders:i,onClickRow:a}),[e,t,n,r,i,a]);return M(ue.Provider,{value:s,children:o})});et.displayName=`UITableRowProvider`;const tt=({title:e,isFetching:t=!1,isRefetching:n=!1,isLoading:r=!1,loadingDisplayRow:i=3,data:a,columns:o,totalRows:s,leftPinnedColumns:c=[],rightPinnedColumns:l=[],keyOfClickRow:u,onClickRow:d,onRowSelection:f,onColumnPinning:p,fetchMoreData:m,emptyDisplayHeight:h,csvData:g,csvFileName:_,filterDefinitions:v=[],onFilterChange:y,summary:b=[],onSummaryItemClick:x,showAnalysisPanel:S=!1,description:ee,headerActions:C,children:w})=>{let E=te(),k=te(),A=ne(null),[j,N]=O(!1),[P,se]=O(!0),[F,I]=O({}),[L,ce]=O({right:l,left:[`select`,...c]}),[R,le]=O({}),[z,B]=O([]),ue=T(e=>(I(e),f?.(e instanceof Function?e(F):e),e),[F,f]),de=T(e=>{ce(e),p?.(e instanceof Function?e(L):e)},[L,p]),V=T(e=>{let t=v.find(t=>t.id===e);if(!t)return;let n={id:`${e}-${crypto.randomUUID()}`,definitionId:e,value:Ye(t.type)};B(e=>{let t=[...e,n];return y?.(t),t})},[v,y]),me=T(e=>{B(t=>{let n=t.filter(t=>t.id!==e);return y?.(n),n})},[y]),ge=T((e,t)=>{B(n=>{let r=n.map(n=>n.id===e?{...n,value:t}:n);return y?.(r),r})},[y]),ve=D(()=>({filterDefinitions:v,activeFilters:z,addFilter:V,removeFilter:me,updateFilter:ge}),[v,z,V,me,ge]),H=oe({data:a,columns:o,state:{rowSelection:F,columnPinning:L,expanded:R},defaultColumn:{enableResizing:!1,size:void 0,minSize:void 0,maxSize:void 0},columnResizeMode:`onChange`,columnResizeDirection:`ltr`,enableColumnPinning:!0,enableRowSelection:!0,enableColumnResizing:!0,enableMultiRowSelection:!0,autoResetAll:!1,autoResetExpanded:!1,autoResetPageIndex:!1,getSubRows:e=>e.subRows,getCoreRowModel:re(),getGroupedRowModel:ae(),getExpandedRowModel:ie(),onRowSelectionChange:ue,onColumnPinningChange:de,onExpandedChange:le}),U=D(()=>{let{rows:e}=H.getRowModel();return e},[H.getRowModel().rows,H.getState().columnPinning]),W=D(()=>!t&&!n&&U.length===0,[U,t,n]),ye=D(()=>({title:e,table:H,isEmpty:W,isFetching:t,isRefetching:n,isLoading:r,loadingDisplayRow:i,totalRows:s,fetchMoreData:m,emptyDisplayHeight:h,csvData:g,csvFileName:_,summary:b,onSummaryItemClick:x,showAnalysisPanel:S,description:ee,headerActions:C}),[e,H,W,n,t,r,i,s,m,h,H.getState().columnPinning,H.getState().expanded,g,_,b,x,S,ee,C]),G=D(()=>H.getState(),[H.getState()]),K=D(()=>H.getIsAllRowsSelected(),[H.getIsAllRowsSelected()]),be=D(()=>G.rowSelection,[G.rowSelection]),q=D(()=>G.columnPinning,[G.columnPinning]),J=D(()=>H.getLeftHeaderGroups()[0]?.headers||[],[H.getState().columnPinning]),Y=D(()=>H.getRightHeaderGroups()[0]?.headers||[],[H.getState().columnPinning]),xe=D(()=>H.getTotalSize(),[H.getTotalSize()]),X=T(()=>N(e=>!e),[]),Z=D(()=>({isOpen:j,toggle:X}),[j,X]),Q=T(()=>se(e=>!e),[]),Se=D(()=>({isOpen:P,toggle:Q}),[P,Q]);return M(he.Provider,{value:Z,children:M(_e.Provider,{value:Se,children:M(pe.Provider,{value:ve,children:M(fe.Provider,{value:ye,children:M(Xe,{innerWrapperId:E,children:M(Ze,{table:H,innerTableId:k,totalSize:xe,tableRef:A,children:M(Qe,{isAllRowsSelected:K,columnPinningState:q,leftPinnedHeaders:J,rightPinnedHeaders:Y,onToggleAllRowsSelected:H.toggleAllRowsSelected,children:M($e,{isFetching:t,isRefetching:n,isEmpty:W,rowSelectionState:be,children:M(et,{keyOfClickRow:u,isAllRowsSelected:K,columnPinningState:q,leftPinnedHeaders:J,rightPinnedHeaders:Y,onClickRow:d,children:w})})})})})})})})})};function $(e){let t=ee(e);return e=>M(x,{fallback:null,children:M(t,{...e})})}const nt=$(()=>import(`./avatar-name-display-BrpnTqa_.mjs`).then(e=>({default:e.UITableAvatarNameDisplay}))),rt=$(()=>import(`./badge-display-RP5VTE10.mjs`).then(e=>({default:e.UITableBadgeDisplay}))),it=$(()=>import(`./boolean-display-B9qxrF5f.mjs`).then(e=>({default:e.UITableBooleanDisplay}))),at=$(()=>import(`./currency-display-CEg_HRYv.mjs`).then(e=>({default:e.UITableCurrencyDisplay}))),ot=$(()=>import(`./date-display-DGfHQhpu.mjs`).then(e=>({default:e.UITableDateDisplay}))),st=$(()=>import(`./description-display-CW0g3aJa.mjs`).then(e=>({default:e.UITableDescriptionDisplay}))),ct=$(()=>import(`./edit-button-DmMFMzG0.mjs`).then(e=>({default:e.UITableEditButton}))),lt=$(()=>import(`./email-display-BKcoWmPK.mjs`).then(e=>({default:e.UITableEmailDisplay}))),ut=$(()=>import(`./list-display-Co94sV4H.mjs`).then(e=>({default:e.UITableListDisplay}))),dt=$(()=>import(`./more-button-BKBcXz6E.mjs`).then(e=>({default:e.UITableMoreButton}))),ft=$(()=>import(`./name-display-CB9XAhXP.mjs`).then(e=>({default:e.UITableNameDisplay}))),pt=$(()=>import(`./permalink-I-INEarM.mjs`).then(e=>({default:e.UITablePermalink}))),mt=$(()=>import(`./phone-number-Cu7Mnl6J.mjs`).then(e=>({default:e.UITablePhoneNumberDisplay}))),ht=$(()=>import(`./progress-display-qgvclwy9.mjs`).then(e=>({default:e.UITableProgressDisplay}))),gt=$(()=>import(`./remove-button-Db5oSj4h.mjs`).then(e=>({default:e.UITableRemoveButton}))),_t=$(()=>import(`./statistic-ClkqqDfk.mjs`).then(e=>({default:e.UITableStatisticDisplay}))),vt=$(()=>import(`./status-display-BUphOF18.mjs`).then(e=>({default:e.UITableStatusDisplay}))),yt=$(()=>import(`./toggle-button-DNLtfjJC.mjs`).then(e=>({default:e.UITableToggleButton}))),bt=$(()=>import(`./user-BymzvsYp.mjs`).then(e=>({default:e.UITableUserDataDisplay}))),xt=$(()=>import(`./filter-CWuRGTl4.mjs`).then(e=>({default:e.UITableFilter}))),St=$(()=>import(`./analysis-panel-BqZmOU58.mjs`).then(e=>({default:e.UITableAnalysisPanel}))),Ct=$(()=>import(`./summary-bar-CYfgdxrQ.mjs`).then(e=>({default:e.UITableSummaryBar}))),wt=$(()=>import(`./tooltip-TGmzPdoR.mjs`).then(e=>({default:e.UITableTooltip}))),Tt=$(()=>import(`./tooltip-TGmzPdoR.mjs`).then(e=>({default:e.UITableTooltipFilter}))),Et=$(()=>import(`./tooltip-TGmzPdoR.mjs`).then(e=>({default:e.UITableTooltipActions})));export{Ge as A,Ie as B,Et as C,Je as D,tt as E,Be as F,ke as G,Ne as H,ze as I,B as J,Oe as K,Re as L,Ue as M,He as N,qe as O,Ve as P,se as Q,Le as R,wt as S,bt as T,je as U,Pe as V,Ae as W,me as X,V as Y,ve as Z,gt as _,at as a,Ct as b,ct as c,ut as d,dt as f,ht as g,mt as h,it as i,We as j,Ke as k,lt as l,pt as m,nt as n,ot as o,ft as p,ge as q,rt as r,st as s,St as t,xt as u,_t as v,Tt as w,yt as x,vt as y,Fe as z};
|
|
2
|
-
//# sourceMappingURL=tables-
|
|
1
|
+
import{Statistic as e}from"./data-display/statistic.mjs";import{Checkbox as t}from"./ui/checkbox.mjs";import{DropdownMenu as n,DropdownMenuContent as r,DropdownMenuGroup as i,DropdownMenuItem as a,DropdownMenuShortcut as o,DropdownMenuTrigger as s}from"./ui/dropdown-menu.mjs";import{Spinner as c}from"./ui/spinner.mjs";import{ResizableHandle as l,ResizablePanel as u,ResizablePanelGroup as d}from"./ui/resizable.mjs";import{AlertTriangle as f,BoxIcon as p,ChevronDown as m,EllipsisVerticalIcon as h,MinusIcon as g,MoveLeftIcon as _,MoveRightIcon as v,PinOffIcon as y}from"lucide-react";import{Activity as b,Suspense as x,createContext as S,lazy as ee,memo as C,use as w,useCallback as T,useEffect as E,useId as te,useMemo as D,useRef as ne,useState as O}from"react";import{cn as k}from"@customafk/react-toolkit/utils";import{cva as A}from"class-variance-authority";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{flexRender as P,getCoreRowModel as re,getExpandedRowModel as ie,getGroupedRowModel as ae,useReactTable as oe}from"@tanstack/react-table";const se=()=>N(`div`,{className:`flex gap-0 text-text-positive-weak`,children:[M(g,{size:16}),M(g,{size:16})]}),F=S(null),I=()=>{let e=w(F);if(!e)throw Error(`useTableInnerWrapperContext must be used within a TableInnerWrapperProvider`);return e},L=S(null),ce=()=>{let e=w(L);if(!e)throw Error(`useTableInnerTableContext must be used within a TableInnerTableProvider`);return e},R=S(null),le=()=>{let e=w(R);if(!e)throw Error(`useTableHeaderRowContext must be used within a TableHeaderRowProvider`);return e},z=S(null),B=()=>{let e=w(z);if(!e)throw Error(`useTableBodyContext must be used within a TableBodyProvider`);return e},ue=S(null),de=()=>{let e=w(ue);if(!e)throw Error(`useTableRowContext must be used within a TableRowProvider`);return e},fe=S(null),V=()=>{let e=w(fe);if(!e)throw Error(`useTableContext must be used within a TableProvider`);return e},pe=S(null),me=()=>{let e=w(pe);if(!e)throw Error(`useUITableFilterContext must be used within a UITableProvider`);return e},he=S(null),ge=()=>{let e=w(he);if(!e)throw Error(`useUITableAnalysisContext must be used within a UITableProvider`);return e},_e=S(null),ve=()=>{let e=w(_e);if(!e)throw Error(`useUITableSummaryContext must be used within a UITableProvider`);return e},H=`border-r! !border-r-border-strong/30`,U=`border-l! !border-l-border-strong/30`,W=A([`absolute right-2 z-10 p-0.5 opacity-0 bg-card`,`cursor-pointer rounded-full transition-all`,`text-text-positive-weak`,`[&>svg]:size-4`,`group-hover:opacity-100`,`hover:bg-muted-muted hover:text-text-positive`]),ye=A([`sticky left-0 flex flex-1 items-center justify-center bg-transparent text-text-positive-weak opacity-100`]),G=A([`relative m-0 flex size-full flex-col flex-nowrap items-start justify-start gap-2`]),K=A([`relative w-full flex-1 min-h-0 overflow-auto border-b border-b-border border-l border-l-border`]),be=A([`grid w-full table-fixed caption-bottom border-collapse border-spacing-0 flex-col content-start`]),q=A([`sticky top-0 z-40 h-9 w-full`,`grid select-none bg-white`,`border-b border-b-border shadow`,`font-medium text-[13px] text-text-positive-weak`,`[&_tr:not(:last-child)_td]:border-b`,`[&_th]:inline-flex`,`[&_th]:bg-card`,`[&_th]:items-center`,`[&_th]:transition-all`,`[&_th]:duration-300`,`[&_th]:whitespace-nowrap`,`[&_th]:border-border`,`[&_th]:border-r`,`[&_th]:first:border-l-0`,`[&_tr_th:not([data-pinned=false])]:bg-card`]),J=A([`flex`]),Y=A([`group flex`],{variants:{isPinned:{left:`sticky`,right:`sticky`,false:`relative`},isActions:{true:`border-r-0!`,false:``},isLastCell:{true:``,false:``},isFirstCell:{true:``,false:``},position:{start:`justify-start`,center:`justify-center`,end:`justify-end`}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H},{isPinned:`right`,isFirstCell:!0,className:U}]}),xe=A([`relative w-full`,`[&_tr]:flex`,`[&_tr]:flex-none`,`[&_tr]:w-full`,`[&_tr]:cursor-pointer [&_tr]:focus:outline-none`,`[&_tr]:border-b [&_tr]:border-b-border`,`[&_td]:z-10`,`[&_td]:transition-all`,`[&_td]:flex`,`[&_td]:flex-none`,`[&_td]:overflow-hidden`,`[&_td]:whitespace-nowrap`,`[&_td]:px-4`,`[&_td]:py-2.5`,`[&_td]:align-middle`,`[&_td]:border-border`,`[&_td]:data-[selected=true]:bg-muted-muted!`,`[&_td]:data-[selected=true]:hover:bg-muted-muted!`,`[&_td>div]:inline-flex`,`[&_td>div]:items-center`,`[&_td>div]:w-full`,`[&_td:not([data-pinned=false])]:z-20`,`[&_td:not([data-pinned=false])]:sticky`,`[&_td:not([data-pinned=false])]:bg-muted-bg-subtle`]),X=A([`group transition-colors hover:bg-muted-muted hover:[&_td]:bg-muted-muted! [&_td]:border-r [&_td]:border-r-border`]),Z=A([`group-hover:bg-muted-muted!`],{variants:{isPinned:{left:`sticky`,right:`sticky`,false:`relative`},isLastCell:{true:``,false:``}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H}],defaultVariants:{isPinned:void 0}}),Q=A([`sticky border-r-0! inset-y-0 right-0 z-30 flex items-center pr-4 group-hover:bg-muted-muted!`]),Se=A([`group-hover:bg-muted-muted!`],{variants:{isPinned:{left:``,right:``,false:``},isLastCell:{true:``,false:``},isFirstCell:{true:``,false:``}},compoundVariants:[{isPinned:`left`,isLastCell:!0,className:H},{isPinned:`right`,isFirstCell:!0,className:U}]}),Ce=A([`overflow-x-hidden`],{variants:{position:{start:`justify-start`,center:`justify-center`,end:`justify-end`}},defaultVariants:{position:`start`}}),we=A([`shrink-0 flex w-full justify-center border-t border-border-weak font-medium`]),Te=A([`flex w-full`,`text-[13px] font-medium text-text-positive-weak`]),Ee=A([`flex flex-none items-center overflow-hidden whitespace-nowrap px-4 py-2`,`border-r border-r-border`],{variants:{isPinned:{left:`sticky z-20 bg-white`,right:`sticky z-20 bg-white`,false:`relative`},isFirstCell:{true:`border-l border-l-border`,false:``},isLastCell:{true:`border-r border-r-border`,false:``}}}),De=A([`flex cursor-pointer gap-x-0.5`],{variants:{state:{idle:`text-text-positive-weak hover:text-text-positive`,fetching:`cursor-not-allowed`,error:`text-danger hover:text-danger-strong`}},defaultVariants:{state:`idle`}}),Oe=C(({className:e,children:t,...n})=>{let{isFetching:r,isRefetching:i,isEmpty:a}=B();return a||r||i?null:M(`tbody`,{slot:`table-body`,className:k(xe(),e),...n,children:t})});Oe.displayName=`UITableBody`;const ke=C(({isPinned:e=!1,isFirstCell:t=!1,isLastCell:n=!1,colId:r,position:i=`start`,column:a,getContext:o,className:s,...c})=>{let{table:l,tableRef:u}=ce(),d=ne(null),f=D(()=>{let t=a?.getStart(`left`);return e===`left`&&typeof t==`number`?`${t}px`:void 0},[e,a]),p=D(()=>{let t=a?.getAfter(`right`);return e===`right`&&typeof t==`number`?`${t}px`:void 0},[e,a]),m=D(()=>`calc(var(--col-${r}-size) * 1px)`,[r]),h=D(()=>a?.columnDef.minSize?`calc(var(--col-${r}-minSize) * 1px)`:void 0,[r,a]),g=D(()=>a?.columnDef.maxSize?`calc(var(--col-${r}-maxSize) * 1px)`:void 0,[r,a]),_=D(()=>P(a?.columnDef.cell,o()),[a,o]);return E(()=>{if(!d.current)return;let e=d.current.scrollWidth,t=a?.getSize();t!=null&&e>t&&u.current instanceof HTMLTableElement&&typeof r==`string`&&a?.columnDef.meta?.fitContent&&l.setColumnSizing(t=>({...t,[r]:e+32}))},[r,a,l]),M(`td`,{slot:`table-body-cell`,"data-pinned":e,"data-lastcell":n||void 0,"data-firstcell":t||void 0,style:{left:f,right:p,width:m,minWidth:h,maxWidth:g},className:k(Se({isPinned:e||void 0,isLastCell:n,isFirstCell:t}),s),...c,children:M(`div`,{ref:d,slot:`table-body-cell-inner`,className:Ce({position:i}),children:_})})});ke.displayName=`UITableCell`;const Ae=C(({column:e,getContext:t,className:n,...r})=>{let i=D(()=>P(e?.columnDef.cell,t()),[e,t]);return M(`td`,{"data-col":`actions`,className:Q(),...r,children:i})});Ae.displayName=`UITableCellActions`;const je=C(({isPinned:e,isLastCell:n,isSelected:r=!1,className:i,onToggleRowSelected:a,...o})=>{let s=T(e=>{a?.(!!e)},[a]);return M(`td`,{slot:`table-body-cell`,"data-pinned":!0,style:{left:0,zIndex:20,width:60,maxWidth:60},className:k(Z({isPinned:e,isLastCell:n}),i),...o,children:M(`div`,{"data-slot":`table-cell-inner`,className:`flex! w-full! items-center justify-center bg-transparent text-center align-middle`,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:M(t,{"aria-label":`Select Row`,checked:r,onCheckedChange:s})})})});je.displayName=`UITableCellSelect`;const Me=C(()=>{let{table:e,isFetching:t,isRefetching:n,loadingDisplayRow:r=3}=V();return!t&&!n?null:M(`tbody`,{className:k(xe(),`pointer-events-none`),children:Array.from({length:r}).map((t,n)=>M(`tr`,{"data-slot":`table-row`,"data-index":n,className:k(X(),`animate-pulse relative!`),children:e.getAllColumns().map((t,r)=>{let i=t.getIsPinned(),a=t.getStart(`left`),o=t.getAfter(`right`);return t.id===`actions`?M(`td`,{"data-slot":`table-body-cell`,"data-col":t.id,"data-cell":r,style:{width:60},className:Q(),children:M(`div`,{className:`w-full h-4 bg-muted-muted rounded-full`})},`${t.id}-${r}`):t.id===`select`?M(`td`,{"data-slot":`table-body-cell`,"data-col":t.id,"data-cell":r,"data-pinned":!0,style:{left:0,zIndex:20,width:60,maxWidth:60},className:Z({isPinned:`left`}),children:M(`div`,{className:`w-full flex justify-center`,children:M(`div`,{className:`size-4 bg-muted-muted rounded-full`})})},`${t.id}-${n}`):M(`td`,{"data-col":t.id,"data-cell":r,"data-selected":void 0,"data-lastcell":t.id===e.getAllColumns()[e.getAllColumns().length-1].id||void 0,"data-firstcell":t.id===e.getAllColumns()[0].id||void 0,style:{zIndex:i?20:0,left:i===`left`&&typeof a==`number`?`${a}px`:void 0,right:i===`right`&&typeof o==`number`?`${o}px`:void 0,width:`calc(var(--col-${t.id}-size) * 1px)`,minWidth:t.columnDef.minSize?`calc(var(--col-${t.id}-minSize) * 1px)`:void 0,maxWidth:t.columnDef.maxSize?`calc(var(--col-${t.id}-maxSize) * 1px)`:void 0},className:Se({isPinned:t.getIsPinned(),isFirstCell:t.id===e.getRightHeaderGroups()[0]?.headers[0]?.id,isLastCell:t.id===e.getLeftHeaderGroups()[0]?.headers[e.getLeftHeaderGroups()[0].headers.length-1]?.id}),children:M(`div`,{className:Ce({position:t.columnDef.meta?.position??`start`}),children:M(`div`,{className:`w-full h-4 bg-muted-muted rounded-full`})})},`${t.id}-${r}`)})},n))})}),Ne=C(()=>{let{isEmpty:e,emptyDisplayHeight:t}=V();return e?M(j,{children:e&&M(`div`,{className:ye(),style:{minHeight:t??`24rem`},children:N(`div`,{className:`flex flex-col items-center gap-1`,children:[M(p,{strokeWidth:1,size:48}),M(`p`,{children:`Không có dữ liệu`})]})})}):null});Ne.displayName=`UITableEmptyDisplay`;const Pe=C(({className:e,children:t,...n})=>M(`div`,{slot:`table-footer`,className:k(we(),e),...n,children:t}));Pe.displayName=`UITableFooter`;function Fe(e,t,n){switch(n){case`count`:return e;case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.length===0?0:t.reduce((e,t)=>e+t,0)/t.length;case`min`:return t.length===0?0:Math.min(...t);case`max`:return t.length===0?0:Math.max(...t)}}function Ie(e,t){return e.map(e=>{let n=e.getValue(t);return typeof n==`string`?Number(n):typeof n==`number`?n:NaN}).filter(e=>!Number.isNaN(e))}const Le=C(()=>{let{table:t}=V(),{rowSelectionState:n}=B(),r=D(()=>t.getHeaderGroups()[0]?.headers??[],[t.getHeaderGroups()]),i=D(()=>r.some(e=>e.column.columnDef.meta?.aggregation),[r]),a=D(()=>t.getSelectedRowModel().flatRows,[t,n]),o=D(()=>t.getRowModel().rows,[t]),s=a.length>0?a:o,c=D(()=>{let e={};for(let t of r){let n=t.column.columnDef.meta?.aggregation;if(!n)continue;let r=Ie(s,t.id);e[t.id]=Fe(s.length,r,n.type)}return e},[r,s]),l=t.getState().columnPinning,u=l.left??[],d=l.right??[],f=r.find(e=>d.includes(e.id))?.id,p=[...r].reverse().find(e=>u.includes(e.id))?.id;if(!i)return null;let m=a.length>0?`${a.length}`:`${o.length}`;return M(`div`,{slot:`table-footer-row`,className:Te(),children:r.map(t=>{let n=t.id,r=u.includes(n)?`left`:d.includes(n)?`right`:!1,i=n===f,a=n===p,o=r===`left`?`${t.column.getStart(`left`)}px`:void 0,s=r===`right`?`${t.column.getAfter(`right`)}px`:void 0;if(n===`select`)return M(`div`,{slot:`table-footer-select`,"data-pinned":`left`,style:{left:`0px`,width:`60px`},className:k(Ee({isPinned:`left`,isFirstCell:!1,isLastCell:!1}),`justify-center`),children:M(`span`,{className:`truncate text-[11px] items-center text-text-positive-weak`,children:m})},n);if(n===`actions`)return M(`div`,{slot:`table-footer-actions`,style:{width:`calc(var(--col-${n}-size) * 1px)`,right:`0px`},className:Ee({isPinned:!1,isFirstCell:!1,isLastCell:!1})},n);let l=t.column.columnDef.meta?.aggregation,h=c[n]??null;return M(`div`,{slot:`table-footer-cell`,"data-pinned":r,style:{left:o,right:s,width:`calc(var(--col-${n}-size) * 1px)`},className:Ee({isPinned:r||`left`,isFirstCell:i,isLastCell:a}),children:l&&h!==null?M(e,{value:h,prefix:l.prefix,suffix:l.suffix,precision:l.precision,size:`sm`}):M(`span`,{className:`text-text-positive-weak`,children:`—`})},n)})})});Le.displayName=`UITableFooterRow`;const Re=C(({className:e,children:t,...n})=>M(`thead`,{slot:`table-head`,className:k(q(),e),...n,children:t}));Re.displayName=`UITableHead`;const ze=C(({isPinned:e,onLeftPin:t,onRightPin:c,onUnpin:l,className:u})=>{let d=T(()=>{t?.(`left`)},[t]),f=T(()=>{c?.(`right`)},[c]),p=T(()=>{l?.(!1)},[l]);return N(n,{children:[M(s,{asChild:!0,children:M(`button`,{type:`button`,className:k(W(),u),children:M(h,{})})}),M(r,{align:`end`,className:`w-64 p-4`,children:N(i,{className:`*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2`,children:[M(b,{mode:e?`visible`:`hidden`,children:N(a,{onClick:p,children:[!!e&&`Bỏ ghim`,M(o,{children:M(y,{className:`size-4`})})]})}),N(b,{mode:e?`hidden`:`visible`,children:[N(a,{onClick:d,children:[e?`Bỏ ghim`:`Ghim trái`,M(o,{children:M(_,{className:`size-4`})})]}),N(a,{onClick:f,children:[e?`Bỏ ghim`:`Ghim phải`,M(o,{children:M(v,{className:`size-4`})})]})]})]})})]})});ze.displayName=`UITableHeadCellOption`;const Be=C(({isVisible:e=!0,isPinned:t=!1,isFirstCell:n=!1,isLastCell:r=!1,isOptionsVisible:i=!0,headerId:a,headerColumn:o,className:s,children:c,onColumnPin:l,onToggleVisibility:u,...d})=>{let f=o?.columnDef.meta?.position;return N(`th`,{slot:`table-head-cell`,"data-pinned":t,"data-header":a,style:{zIndex:D(()=>t?20:void 0,[t]),left:D(()=>{let e=o?.getStart?.(`left`);return t===`left`&&typeof e==`number`?`${e}px`:void 0},[t,o]),right:D(()=>{let e=o?.getAfter?.(`right`);return t===`right`&&typeof e==`number`?`${e}px`:void 0},[t,o]),width:D(()=>`calc(var(--header-${a}-size) * 1px)`,[a]),minWidth:D(()=>o?.columnDef.minSize?`calc(var(--col-${a}-minSize) * 1px)`:void 0,[a,o]),maxWidth:D(()=>o?.columnDef.maxSize?`calc(var(--col-${a}-maxSize) * 1px)`:void 0,[a,o])},className:k(Y({isPinned:t||`false`,isActions:a===`actions`,isLastCell:r,isFirstCell:n,position:f}),s),...d,children:[M(`div`,{className:`truncate px-4`,children:c}),i&&M(ze,{isPinned:t,isVisible:e,onLeftPin:l,onRightPin:l,onUnpin:l})]})});Be.displayName=`UITableHeadCell`;const Ve=C(({isPinned:e,isLastCell:n,isAllRowsSelected:r,style:i,className:a,onToggleAllRowsSelected:o,...s})=>{let c=T(e=>{o?.(!!e)},[o]);return M(`th`,{slot:`table-header-cell`,"data-pinned":!0,style:{left:0,zIndex:40,width:60,maxWidth:60},className:k(Z({isPinned:e,isLastCell:n}),a),...s,children:M(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:M(t,{"aria-label":`Select All Rows`,checked:r,onCheckedChange:c})})})});Ve.displayName=`UITableHeadCellSelect`;const He=C(({headerGroup:e,className:t,...n})=>{let{isAllRowsSelected:r,columnPinningState:i,leftPinnedHeaders:a,rightPinnedHeaders:o,onToggleAllRowsSelected:s}=le(),c=o[0]?.id,l=a[a.length-1]?.id;return M(`tr`,{slot:`table-head-row`,className:k(J(),t),...n,children:e.headers.map((e,t)=>{let n=e.column.getIsVisible(),a=i.left?.includes(e.id)?`left`:i.right?.includes(e.id)?`right`:!1;return e.id===`select`?M(Ve,{isPinned:a,isLastCell:e.id===l,isAllRowsSelected:r,onToggleAllRowsSelected:s},e.id):M(Be,{isVisible:n,isPinned:a,isFirstCell:e.id===c,isLastCell:e.id===l,isOptionsVisible:![`select`,`actions`].includes(e.id),headerId:e.id,headerColumn:e.column,colSpan:e.colSpan,onColumnPin:e.column.pin,onToggleVisibility:e.column.toggleVisibility,children:P(e.column.columnDef.header,e.getContext())},`${e.id}-${t}`)})})});He.displayName=`UITableHeadRow`;const Ue=C(({children:e,...t})=>{let{table:n,innerTableId:r,totalSize:i,tableRef:a}=ce();return E(()=>{if(!a.current)return;let e=n.getFlatHeaders(),t,r=new ResizeObserver(r=>{t!==void 0&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{let t=r[0];if(!t)return;let i=t.target;if(!(i instanceof HTMLTableElement))return;let a=t.contentRect.width,{left:o=[],right:s=[]}=n.getState().columnPinning,c=0,l=0,u=0,d=e.map(e=>{let{id:t}=e,n=t===`select`||t===`actions`,r=o.includes(t)||s.includes(t),i=e.getSize(),a=e.column.columnDef.maxSize;return n?(c+=60,{id:t,isFlex:!1,width:60}):r?(c+=i,{id:t,isFlex:!1,width:i}):e.column.columnDef.size||i!==150?(u+=i,{id:t,isFlex:!1,width:i}):(l++,{id:t,isFlex:!0,maxSize:a})}),f=a-c-u,p=l>0?Math.max(0,Math.floor(f/l)):0,m=i.closest(`[data-slot="table-scroll-host"]`);d.forEach(e=>{if(e.isFlex){let t=e.maxSize?Math.min(p,e.maxSize):p;i.style.setProperty(`--header-${e.id}-size`,`${t}`),i.style.setProperty(`--col-${e.id}-size`,`${t}`),m?.style.setProperty(`--col-${e.id}-size`,`${t}`),e.maxSize&&i.style.setProperty(`--col-${e.id}-maxSize`,`${e.maxSize}`)}else i.style.setProperty(`--header-${e.id}-size`,`${e.width}`),i.style.setProperty(`--col-${e.id}-size`,`${e.width}`),m?.style.setProperty(`--col-${e.id}-size`,`${e.width}`)})})});return r.observe(a.current),()=>{t!==void 0&&cancelAnimationFrame(t),r.disconnect()}},[n.getState().columnSizingInfo,n.getState().columnSizing,n.getState().columnPinning]),M(`table`,{id:r,ref:a,slot:`table-inner-table`,className:be(),style:{minWidth:i},...t,children:e})});Ue.displayName=`UITableInnerTable`;const We=C(({children:e,...t})=>{let{innerWrapperId:n}=I();return M(`div`,{id:n,slot:`table-inner-wrapper`,className:K(),...t,children:e})});We.displayName=`UITableInnerWrapper`;const Ge=C(({fetchMoreData:e})=>{let{innerWrapperId:t}=I(),[n,r]=O(`idle`),[i,a]=O(0),o=T(async()=>{try{r(`fetching`),await e?.(),r(`idle`)}catch(e){console.error(`Error fetching more data:`,e),r(`error`)}},[e]);return E(()=>{let e=document.querySelector(`div[id="${t}"]`);if(!e)return;let n=new ResizeObserver(e=>{a(e[0].contentRect.width)});return n.observe(e),()=>n.disconnect()},[t]),e?M(`tr`,{className:`sticky! left-0 h-10`,style:{width:i},children:M(`td`,{className:`absolute left-0 flex w-full items-center justify-center text-xs`,children:N(`button`,{type:`button`,disabled:n===`fetching`,className:De({state:n}),onClick:o,children:[n===`idle`&&M(m,{className:`size-4`}),n===`fetching`&&M(c,{className:`size-4 animate-spin`}),n===`error`&&M(f,{className:`size-4 text-danger`}),n===`idle`&&`Tải thêm`,n===`fetching`&&`Đang tải...`,n===`error`&&`Lỗi! Thử lại?`]})})}):null});Ge.displayName=`UITableLoadMore`;const Ke=C(({row:e,isSelected:t,rowIndex:n,children:r,...i})=>{let{keyOfClickRow:a,isAllRowsSelected:o,columnPinningState:s,leftPinnedHeaders:c,rightPinnedHeaders:l,onClickRow:u}=de(),d=D(()=>s.left??[],[s]),f=D(()=>s.right??[],[s]),p=D(()=>l?.[0]?.id,[l]),m=D(()=>c?.[c.length-1]?.id,[c]),h=D(()=>e.getVisibleCells().some(e=>e.column.id===`select`),[e]),g=T(t=>{if(u){let t=a?e.original?.[a]:void 0;u(n,typeof t==`string`||typeof t==`number`?t:void 0)}else h&&e.toggleSelected();t.preventDefault(),t.stopPropagation()},[a,u,e,n,h]);return M(`tr`,{slot:`table-row`,"data-index":n,className:X(),onClick:g,...i,children:e.getVisibleCells().map((e,r)=>{let i=d.includes(e.column.id),a=f.includes(e.column.id),s=i?`left`:a?`right`:!1;return e.column.id===`actions`?M(Ae,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,column:e.column,getContext:e.getContext},`${e.id}-${r}`):e.column.id===`select`?M(je,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,isPinned:s,isLastCell:e.column.id===m,isSelected:o||t,onToggleRowSelected:e.row.toggleSelected},`${e.id}-${r}`):M(ke,{"data-col":e.column.id,"data-cell":n,"data-selected":t||void 0,isPinned:s,isFirstCell:e.column.id===p,isLastCell:e.column.id===m,colId:e.column.id,position:e.column.columnDef.meta?.position??`start`,column:e.column,getContext:e.getContext},`${e.id}-${r}`)})})});Ke.displayName=`UITableRow`;const qe=C(({className:e,children:t,...n})=>M(`div`,{slot:`table-wrapper`,className:k(G(),e),...n,children:t}));qe.displayName=`UITableWrapper`;const Je=({children:e})=>{let{table:t,fetchMoreData:n}=V(),{rowSelectionState:r}=B(),{rows:i}=t.getRowModel();return N(d,{direction:`horizontal`,style:{direction:t.options.columnResizeDirection},className:`relative flex w-full max-w-full flex-1 gap-1 overflow-auto border-t border-t-border border-r border-r-border p-0 text-sm`,children:[M(u,{"data-slot":`table-scroll-host`,className:`relative flex flex-col`,children:N(We,{children:[N(Ue,{children:[M(Re,{children:t.getHeaderGroups().map(e=>M(He,{headerGroup:e},e.id))}),N(Oe,{children:[i.map((e,t)=>M(Ke,{row:e,isSelected:r[e.id]===!0,rowIndex:t},e.id)),n&&M(Ge,{fetchMoreData:n})]}),M(Me,{})]}),M(Ne,{})]})}),e&&N(j,{children:[M(l,{}),e]})]})};function Ye(e){switch(e){case`tag`:return{type:`tag`,values:[]};case`single-tag`:return{type:`single-tag`,value:null};case`date-range`:return{type:`date-range`};case`number`:return{type:`number`,operator:`eq`};case`text`:return{type:`text`,operator:`contains`,value:``};case`boolean`:return{type:`boolean`,value:null}}}const Xe=C(({innerWrapperId:e,children:t})=>{let n=D(()=>({innerWrapperId:e}),[e]);return M(F.Provider,{value:n,children:t})});Xe.displayName=`UITableInnerWrapperProvider`;const Ze=C(({table:e,innerTableId:t,totalSize:n,tableRef:r,children:i})=>{let a=D(()=>({table:e,innerTableId:t,totalSize:n,tableRef:r}),[e,t,n,r]);return M(L.Provider,{value:a,children:i})});Ze.displayName=`UITableInnerTableProvider`;const Qe=C(({isAllRowsSelected:e,columnPinningState:t,leftPinnedHeaders:n,rightPinnedHeaders:r,onToggleAllRowsSelected:i,children:a})=>{let o=D(()=>({isAllRowsSelected:e,columnPinningState:t,leftPinnedHeaders:n,rightPinnedHeaders:r,onToggleAllRowsSelected:i}),[e,t,n,r,i]);return M(R.Provider,{value:o,children:a})});Qe.displayName=`UITableHeadRowProvider`;const $e=C(({isFetching:e,isRefetching:t,isEmpty:n,rowSelectionState:r,children:i})=>{let a=D(()=>({isFetching:e,isRefetching:t,isEmpty:n,rowSelectionState:r}),[e,t,n,r]);return M(z.Provider,{value:a,children:i})});$e.displayName=`UITableBodyProvider`;const et=C(({keyOfClickRow:e,isAllRowsSelected:t,columnPinningState:n,leftPinnedHeaders:r,rightPinnedHeaders:i,onClickRow:a,children:o})=>{let s=D(()=>({keyOfClickRow:e,isAllRowsSelected:t,columnPinningState:n,leftPinnedHeaders:r,rightPinnedHeaders:i,onClickRow:a}),[e,t,n,r,i,a]);return M(ue.Provider,{value:s,children:o})});et.displayName=`UITableRowProvider`;const tt=({title:e,isFetching:t=!1,isRefetching:n=!1,isLoading:r=!1,loadingDisplayRow:i=3,data:a,columns:o,totalRows:s,leftPinnedColumns:c=[],rightPinnedColumns:l=[],keyOfClickRow:u,onClickRow:d,onRowSelection:f,onColumnPinning:p,fetchMoreData:m,emptyDisplayHeight:h,csvData:g,csvFileName:_,filterDefinitions:v=[],onFilterChange:y,summary:b=[],onSummaryItemClick:x,showAnalysisPanel:S=!1,description:ee,headerActions:C,children:w})=>{let E=te(),k=te(),A=ne(null),[j,N]=O(!1),[P,se]=O(!0),[F,I]=O({}),[L,ce]=O({right:l,left:[`select`,...c]}),[R,le]=O({}),[z,B]=O([]),ue=T(e=>(I(e),f?.(e instanceof Function?e(F):e),e),[F,f]),de=T(e=>{ce(e),p?.(e instanceof Function?e(L):e)},[L,p]),V=T(e=>{let t=v.find(t=>t.id===e);if(!t)return;let n={id:`${e}-${crypto.randomUUID()}`,definitionId:e,value:Ye(t.type)};B(e=>{let t=[...e,n];return y?.(t),t})},[v,y]),me=T(e=>{B(t=>{let n=t.filter(t=>t.id!==e);return y?.(n),n})},[y]),ge=T((e,t)=>{B(n=>{let r=n.map(n=>n.id===e?{...n,value:t}:n);return y?.(r),r})},[y]),ve=D(()=>({filterDefinitions:v,activeFilters:z,addFilter:V,removeFilter:me,updateFilter:ge}),[v,z,V,me,ge]),H=oe({data:a,columns:o,state:{rowSelection:F,columnPinning:L,expanded:R},defaultColumn:{enableResizing:!1,size:void 0,minSize:void 0,maxSize:void 0},columnResizeMode:`onChange`,columnResizeDirection:`ltr`,enableColumnPinning:!0,enableRowSelection:!0,enableColumnResizing:!0,enableMultiRowSelection:!0,autoResetAll:!1,autoResetExpanded:!1,autoResetPageIndex:!1,getSubRows:e=>e.subRows,getCoreRowModel:re(),getGroupedRowModel:ae(),getExpandedRowModel:ie(),onRowSelectionChange:ue,onColumnPinningChange:de,onExpandedChange:le}),U=D(()=>{let{rows:e}=H.getRowModel();return e},[H.getRowModel().rows,H.getState().columnPinning]),W=D(()=>!t&&!n&&U.length===0,[U,t,n]),ye=D(()=>({title:e,table:H,isEmpty:W,isFetching:t,isRefetching:n,isLoading:r,loadingDisplayRow:i,totalRows:s,fetchMoreData:m,emptyDisplayHeight:h,csvData:g,csvFileName:_,summary:b,onSummaryItemClick:x,showAnalysisPanel:S,description:ee,headerActions:C}),[e,H,W,n,t,r,i,s,m,h,H.getState().columnPinning,H.getState().expanded,g,_,b,x,S,ee,C]),G=D(()=>H.getState(),[H.getState()]),K=D(()=>H.getIsAllRowsSelected(),[H.getIsAllRowsSelected()]),be=D(()=>G.rowSelection,[G.rowSelection]),q=D(()=>G.columnPinning,[G.columnPinning]),J=D(()=>H.getLeftHeaderGroups()[0]?.headers||[],[H.getState().columnPinning]),Y=D(()=>H.getRightHeaderGroups()[0]?.headers||[],[H.getState().columnPinning]),xe=D(()=>H.getTotalSize(),[H.getTotalSize()]),X=T(()=>N(e=>!e),[]),Z=D(()=>({isOpen:j,toggle:X}),[j,X]),Q=T(()=>se(e=>!e),[]),Se=D(()=>({isOpen:P,toggle:Q}),[P,Q]);return M(he.Provider,{value:Z,children:M(_e.Provider,{value:Se,children:M(pe.Provider,{value:ve,children:M(fe.Provider,{value:ye,children:M(Xe,{innerWrapperId:E,children:M(Ze,{table:H,innerTableId:k,totalSize:xe,tableRef:A,children:M(Qe,{isAllRowsSelected:K,columnPinningState:q,leftPinnedHeaders:J,rightPinnedHeaders:Y,onToggleAllRowsSelected:H.toggleAllRowsSelected,children:M($e,{isFetching:t,isRefetching:n,isEmpty:W,rowSelectionState:be,children:M(et,{keyOfClickRow:u,isAllRowsSelected:K,columnPinningState:q,leftPinnedHeaders:J,rightPinnedHeaders:Y,onClickRow:d,children:w})})})})})})})})})};function $(e){let t=ee(e);return e=>M(x,{fallback:null,children:M(t,{...e})})}const nt=$(()=>import(`./avatar-name-display-BrpnTqa_.mjs`).then(e=>({default:e.UITableAvatarNameDisplay}))),rt=$(()=>import(`./badge-display-B0BKsU9T.mjs`).then(e=>({default:e.UITableBadgeDisplay}))),it=$(()=>import(`./boolean-display-CMX5AupA.mjs`).then(e=>({default:e.UITableBooleanDisplay}))),at=$(()=>import(`./currency-display-CanjOswc.mjs`).then(e=>({default:e.UITableCurrencyDisplay}))),ot=$(()=>import(`./date-display-YE8NIIrl.mjs`).then(e=>({default:e.UITableDateDisplay}))),st=$(()=>import(`./description-display-B4KoH6ql.mjs`).then(e=>({default:e.UITableDescriptionDisplay}))),ct=$(()=>import(`./edit-button-DmMFMzG0.mjs`).then(e=>({default:e.UITableEditButton}))),lt=$(()=>import(`./email-display-D_k7AUmp.mjs`).then(e=>({default:e.UITableEmailDisplay}))),ut=$(()=>import(`./list-display-M43N3kle.mjs`).then(e=>({default:e.UITableListDisplay}))),dt=$(()=>import(`./more-button-BKBcXz6E.mjs`).then(e=>({default:e.UITableMoreButton}))),ft=$(()=>import(`./name-display-pWhLLS05.mjs`).then(e=>({default:e.UITableNameDisplay}))),pt=$(()=>import(`./permalink-BaMvnKIz.mjs`).then(e=>({default:e.UITablePermalink}))),mt=$(()=>import(`./phone-number-ao2oCmrO.mjs`).then(e=>({default:e.UITablePhoneNumberDisplay}))),ht=$(()=>import(`./progress-display-atwRFD6e.mjs`).then(e=>({default:e.UITableProgressDisplay}))),gt=$(()=>import(`./remove-button-Db5oSj4h.mjs`).then(e=>({default:e.UITableRemoveButton}))),_t=$(()=>import(`./statistic-CJVc9sNs.mjs`).then(e=>({default:e.UITableStatisticDisplay}))),vt=$(()=>import(`./status-display-DInGGgiP.mjs`).then(e=>({default:e.UITableStatusDisplay}))),yt=$(()=>import(`./toggle-button-DNLtfjJC.mjs`).then(e=>({default:e.UITableToggleButton}))),bt=$(()=>import(`./user-BymzvsYp.mjs`).then(e=>({default:e.UITableUserDataDisplay}))),xt=$(()=>import(`./filter-BCNjqiBx.mjs`).then(e=>({default:e.UITableFilter}))),St=$(()=>import(`./analysis-panel-Cop-l4lx.mjs`).then(e=>({default:e.UITableAnalysisPanel}))),Ct=$(()=>import(`./summary-bar-DX_sOiuL.mjs`).then(e=>({default:e.UITableSummaryBar}))),wt=$(()=>import(`./tooltip-C6flMQgc.mjs`).then(e=>({default:e.UITableTooltip}))),Tt=$(()=>import(`./tooltip-C6flMQgc.mjs`).then(e=>({default:e.UITableTooltipFilter}))),Et=$(()=>import(`./tooltip-C6flMQgc.mjs`).then(e=>({default:e.UITableTooltipActions})));export{Ge as A,Ie as B,Et as C,Je as D,tt as E,Be as F,ke as G,Ne as H,ze as I,B as J,Oe as K,Re as L,Ue as M,He as N,qe as O,Ve as P,se as Q,Le as R,wt as S,bt as T,je as U,Pe as V,Ae as W,me as X,V as Y,ve as Z,gt as _,at as a,Ct as b,ct as c,ut as d,dt as f,ht as g,mt as h,it as i,We as j,Ke as k,lt as l,pt as m,nt as n,ot as o,ft as p,ge as q,rt as r,st as s,St as t,xt as u,_t as v,Tt as w,yt as x,vt as y,Fe as z};
|
|
2
|
+
//# sourceMappingURL=tables-7_KgoyS-.mjs.map
|