@yuno-payments/dashboard-design-system 2.8.1 → 2.8.3
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/components/molecules/data-table-cells/data-table-amount-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-amount-cell.js +15 -14
- package/dist/components/molecules/data-table-cells/data-table-copy-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-copy-cell.js +21 -20
- package/dist/components/molecules/data-table-cells/data-table-country-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-country-cell.js +30 -20
- package/dist/components/molecules/data-table-cells/data-table-date-cell.d.ts +1 -1
- package/dist/components/molecules/data-table-cells/data-table-date-cell.js +5 -5
- package/dist/components/molecules/data-table-cells/data-table-icon-text-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-icon-text-cell.js +21 -21
- package/dist/components/molecules/data-table-cells/data-table-percentage-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-percentage-cell.js +32 -24
- package/dist/components/molecules/data-table-cells/data-table-status-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-status-cell.js +26 -18
- package/dist/components/molecules/data-table-cells/data-table-tags-cell.d.ts +3 -0
- package/dist/components/molecules/data-table-cells/data-table-tags-cell.js +24 -18
- package/dist/components/molecules/data-table-cells/data-table-text-cell.d.ts +1 -2
- package/dist/components/molecules/data-table-cells/data-table-text-cell.js +6 -6
- package/dist/index.esm.min.js +1756 -1722
- package/dist/index.umd.min.js +10 -10
- package/package.json +1 -1
- package/registry/components-registry.json +53 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* Props for the DataTableAmountCell component
|
|
3
4
|
*/
|
|
@@ -12,6 +13,8 @@ export interface DataTableAmountCellProps {
|
|
|
12
13
|
size?: "xs" | "sm" | "base";
|
|
13
14
|
/** Whether to show the currency code @default true */
|
|
14
15
|
showCurrencyCode?: boolean;
|
|
16
|
+
/** Content to render when value is empty/NaN @default "-" */
|
|
17
|
+
emptyState?: ReactNode;
|
|
15
18
|
/** Additional CSS classes */
|
|
16
19
|
className?: string;
|
|
17
20
|
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { CurrencyField as
|
|
5
|
-
const
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
4
|
+
import { CurrencyField as x } from "../../atoms/currency-field/currency-field.js";
|
|
5
|
+
const p = s(
|
|
6
6
|
({
|
|
7
|
-
value:
|
|
7
|
+
value: e,
|
|
8
8
|
currency: t = "USD",
|
|
9
9
|
locales: m,
|
|
10
10
|
size: o = "xs",
|
|
11
|
-
showCurrencyCode:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
showCurrencyCode: a = !0,
|
|
12
|
+
emptyState: i = "-",
|
|
13
|
+
className: l
|
|
14
|
+
}, n) => e == null || Number.isNaN(e) ? /* @__PURE__ */ r.jsx(r.Fragment, { children: i }) : /* @__PURE__ */ r.jsx("div", { ref: n, className: f("flex", l), children: /* @__PURE__ */ r.jsx(
|
|
15
|
+
x,
|
|
15
16
|
{
|
|
16
|
-
value:
|
|
17
|
+
value: e,
|
|
17
18
|
currency: t,
|
|
18
19
|
locales: m,
|
|
19
20
|
size: o,
|
|
20
|
-
showCurrencyCode:
|
|
21
|
+
showCurrencyCode: a
|
|
21
22
|
}
|
|
22
23
|
) })
|
|
23
24
|
);
|
|
24
|
-
|
|
25
|
+
p.displayName = "DataTableAmountCell";
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
p as DataTableAmountCell
|
|
27
28
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { IconName } from '../../atoms/icon';
|
|
2
3
|
/**
|
|
3
4
|
* Props for the DataTableCopyCell component
|
|
@@ -17,6 +18,8 @@ export interface DataTableCopyCellProps {
|
|
|
17
18
|
onCopySuccess?: () => void;
|
|
18
19
|
/** Custom callback on copy error */
|
|
19
20
|
onCopyError?: () => void;
|
|
21
|
+
/** Content to render when value is empty @default "-" */
|
|
22
|
+
emptyState?: ReactNode;
|
|
20
23
|
/** Additional CSS classes */
|
|
21
24
|
className?: string;
|
|
22
25
|
}
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Icon as
|
|
2
|
+
import { forwardRef as y } from "react";
|
|
3
|
+
import { cn as g } from "../../../lib/utils.js";
|
|
4
|
+
import { Icon as p } from "../../atoms/icon/icon.js";
|
|
5
5
|
import { TooltipProvider as i, Tooltip as o, TooltipTrigger as n, TooltipContent as l } from "../../../vendor/shadcn/tooltip.js";
|
|
6
|
-
import { useCopyToClipboard as
|
|
7
|
-
const
|
|
6
|
+
import { useCopyToClipboard as N } from "../../../hooks/use-copy-to-clipboard.js";
|
|
7
|
+
const b = y(
|
|
8
8
|
({
|
|
9
9
|
value: e,
|
|
10
10
|
linkTo: t,
|
|
11
11
|
startIcon: a,
|
|
12
|
-
startIconTooltip:
|
|
12
|
+
startIconTooltip: c,
|
|
13
13
|
copyTooltip: d = "Copy",
|
|
14
14
|
onCopySuccess: m,
|
|
15
15
|
onCopyError: h,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
emptyState: x = "-",
|
|
17
|
+
className: j
|
|
18
|
+
}, C) => {
|
|
19
|
+
const { copyToClipboard: f } = N({
|
|
19
20
|
onSuccess: m,
|
|
20
21
|
onError: h
|
|
21
22
|
});
|
|
22
|
-
if (!e) return
|
|
23
|
-
const
|
|
24
|
-
s.stopPropagation(),
|
|
23
|
+
if (!e) return /* @__PURE__ */ r.jsx(r.Fragment, { children: x });
|
|
24
|
+
const u = (s) => {
|
|
25
|
+
s.stopPropagation(), f(e);
|
|
25
26
|
};
|
|
26
27
|
return /* @__PURE__ */ r.jsxs(
|
|
27
28
|
"div",
|
|
28
29
|
{
|
|
29
|
-
ref:
|
|
30
|
-
className:
|
|
30
|
+
ref: C,
|
|
31
|
+
className: g("group flex items-center gap-2 w-full", j),
|
|
31
32
|
children: [
|
|
32
33
|
a && /* @__PURE__ */ r.jsx(i, { children: /* @__PURE__ */ r.jsxs(o, { children: [
|
|
33
34
|
/* @__PURE__ */ r.jsx(n, { asChild: !0, children: /* @__PURE__ */ r.jsx("span", { className: "shrink-0 inline-flex", children: /* @__PURE__ */ r.jsx(
|
|
34
|
-
|
|
35
|
+
p,
|
|
35
36
|
{
|
|
36
37
|
name: a,
|
|
37
38
|
weight: "fill",
|
|
@@ -39,7 +40,7 @@ const N = f(
|
|
|
39
40
|
className: "text-primary"
|
|
40
41
|
}
|
|
41
42
|
) }) }),
|
|
42
|
-
|
|
43
|
+
c && /* @__PURE__ */ r.jsx(l, { children: /* @__PURE__ */ r.jsx("p", { children: c }) })
|
|
43
44
|
] }) }),
|
|
44
45
|
/* @__PURE__ */ r.jsx(i, { children: /* @__PURE__ */ r.jsxs(o, { children: [
|
|
45
46
|
/* @__PURE__ */ r.jsx(n, { asChild: !0, children: /* @__PURE__ */ r.jsx("span", { className: "truncate text-sm", children: t ? /* @__PURE__ */ r.jsx(
|
|
@@ -59,9 +60,9 @@ const N = f(
|
|
|
59
60
|
{
|
|
60
61
|
type: "button",
|
|
61
62
|
className: "shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-muted rounded",
|
|
62
|
-
onClick:
|
|
63
|
+
onClick: u,
|
|
63
64
|
children: /* @__PURE__ */ r.jsx(
|
|
64
|
-
|
|
65
|
+
p,
|
|
65
66
|
{
|
|
66
67
|
name: "CopySimple",
|
|
67
68
|
size: "sm",
|
|
@@ -77,7 +78,7 @@ const N = f(
|
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
);
|
|
80
|
-
|
|
81
|
+
b.displayName = "DataTableCopyCell";
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
+
b as DataTableCopyCell
|
|
83
84
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface DataTableCountryCellProps {
|
|
2
3
|
/** ISO 3166-1 alpha-2 country code (e.g., "US", "CO", "BR") */
|
|
3
4
|
code: string | null | undefined;
|
|
@@ -7,6 +8,8 @@ export interface DataTableCountryCellProps {
|
|
|
7
8
|
showName?: boolean;
|
|
8
9
|
/** Custom function to resolve country name from code */
|
|
9
10
|
getCountryName?: (code: string) => string;
|
|
11
|
+
/** Content to render when code is empty/invalid @default "-" */
|
|
12
|
+
emptyState?: ReactNode;
|
|
10
13
|
/** Additional CSS classes */
|
|
11
14
|
className?: string;
|
|
12
15
|
}
|
|
@@ -1,37 +1,47 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as x } from "react";
|
|
3
3
|
import { cn as f } from "../../../lib/utils.js";
|
|
4
|
-
import { TooltipProvider as u, Tooltip as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { TooltipProvider as u, Tooltip as d, TooltipTrigger as h, TooltipContent as j } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
const T = (r) => {
|
|
6
|
+
if (typeof r != "string") return "";
|
|
7
|
+
const e = r.trim().toUpperCase();
|
|
8
|
+
return /^[A-Z]{2}$/.test(e) ? String.fromCodePoint(
|
|
9
|
+
...[...e].map((s) => s.charCodeAt(0) + 127397)
|
|
10
|
+
) : "";
|
|
11
|
+
}, C = x(
|
|
12
|
+
({
|
|
13
|
+
code: r,
|
|
14
|
+
showFlag: e = !0,
|
|
15
|
+
showName: s = !1,
|
|
16
|
+
getCountryName: l,
|
|
17
|
+
emptyState: i = "-",
|
|
18
|
+
className: a
|
|
19
|
+
}, p) => {
|
|
20
|
+
if (!r) return /* @__PURE__ */ t.jsx(t.Fragment, { children: i });
|
|
21
|
+
const n = e ? T(r) : null, o = l ? l(r) : null, c = s && o ? o : r.toUpperCase(), m = o ?? r.toUpperCase();
|
|
22
|
+
return /* @__PURE__ */ t.jsx(u, { children: /* @__PURE__ */ t.jsxs(d, { children: [
|
|
23
|
+
/* @__PURE__ */ t.jsx(h, { asChild: !0, children: /* @__PURE__ */ t.jsxs(
|
|
14
24
|
"div",
|
|
15
25
|
{
|
|
16
|
-
ref:
|
|
26
|
+
ref: p,
|
|
17
27
|
className: f(
|
|
18
28
|
"flex items-center gap-1 truncate text-sm",
|
|
19
29
|
a
|
|
20
30
|
),
|
|
21
31
|
children: [
|
|
22
|
-
|
|
23
|
-
/* @__PURE__ */
|
|
32
|
+
n && /* @__PURE__ */ t.jsx("span", { className: "shrink-0", children: n }),
|
|
33
|
+
/* @__PURE__ */ t.jsx("span", { className: "truncate", children: c })
|
|
24
34
|
]
|
|
25
35
|
}
|
|
26
36
|
) }),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
/* @__PURE__ */ t.jsx(j, { children: /* @__PURE__ */ t.jsxs("p", { children: [
|
|
38
|
+
n && `${n} `,
|
|
39
|
+
m
|
|
30
40
|
] }) })
|
|
31
41
|
] }) });
|
|
32
42
|
}
|
|
33
43
|
);
|
|
34
|
-
|
|
44
|
+
C.displayName = "DataTableCountryCell";
|
|
35
45
|
export {
|
|
36
|
-
|
|
46
|
+
C as DataTableCountryCell
|
|
37
47
|
};
|
|
@@ -3,7 +3,7 @@ export interface DataTableDateCellProps {
|
|
|
3
3
|
value: string | Date | null | undefined;
|
|
4
4
|
/** Custom date formatter. If not provided, uses Intl.DateTimeFormat with date and time */
|
|
5
5
|
formatFn?: (date: string | Date) => string;
|
|
6
|
-
/** Content to render when value is falsy @default
|
|
6
|
+
/** Content to render when value is falsy @default "-" */
|
|
7
7
|
emptyState?: React.ReactNode;
|
|
8
8
|
/** Additional CSS classes */
|
|
9
9
|
className?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { forwardRef as s } from "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { TooltipProvider as
|
|
3
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as l, Tooltip as c, TooltipTrigger as d, TooltipContent as f } from "../../../vendor/shadcn/tooltip.js";
|
|
5
5
|
const h = (r) => {
|
|
6
6
|
try {
|
|
7
7
|
const e = typeof r == "string" ? new Date(r) : r;
|
|
@@ -19,11 +19,11 @@ const h = (r) => {
|
|
|
19
19
|
return String(r);
|
|
20
20
|
}
|
|
21
21
|
}, p = s(
|
|
22
|
-
({ value: r, formatFn: e, emptyState: i =
|
|
22
|
+
({ value: r, formatFn: e, emptyState: i = "-", className: n }, a) => {
|
|
23
23
|
if (!r) return /* @__PURE__ */ t.jsx(t.Fragment, { children: i });
|
|
24
24
|
const o = (e ?? h)(r);
|
|
25
|
-
return /* @__PURE__ */ t.jsx(
|
|
26
|
-
/* @__PURE__ */ t.jsx(d, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { ref: a, className:
|
|
25
|
+
return /* @__PURE__ */ t.jsx(l, { children: /* @__PURE__ */ t.jsxs(c, { children: [
|
|
26
|
+
/* @__PURE__ */ t.jsx(d, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { ref: a, className: m("truncate text-sm", n), children: o }) }),
|
|
27
27
|
/* @__PURE__ */ t.jsx(f, { children: /* @__PURE__ */ t.jsx("p", { children: o }) })
|
|
28
28
|
] }) });
|
|
29
29
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface DataTableIconTextCellItem {
|
|
2
3
|
/** Item name/label */
|
|
3
4
|
name: string;
|
|
@@ -9,6 +10,8 @@ export interface DataTableIconTextCellProps {
|
|
|
9
10
|
items: DataTableIconTextCellItem[];
|
|
10
11
|
/** Maximum number of visible items @default 1 */
|
|
11
12
|
maxVisible?: number;
|
|
13
|
+
/** Content to render when items is empty @default "-" */
|
|
14
|
+
emptyState?: ReactNode;
|
|
12
15
|
/** Additional CSS classes */
|
|
13
16
|
className?: string;
|
|
14
17
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { TooltipProvider as
|
|
5
|
-
import { Badge as
|
|
6
|
-
const
|
|
7
|
-
if (!n || n.length === 0) return
|
|
8
|
-
const
|
|
9
|
-
if (s.length === 0) return
|
|
10
|
-
const
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { cn as g } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as i, Tooltip as d, TooltipTrigger as m, TooltipContent as x } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
import { Badge as u } from "../../atoms/badge/badge.js";
|
|
6
|
+
const N = f(({ items: n, maxVisible: c = 1, emptyState: t = "-", className: h }, p) => {
|
|
7
|
+
if (!n || n.length === 0) return /* @__PURE__ */ e.jsx(e.Fragment, { children: t });
|
|
8
|
+
const o = /* @__PURE__ */ new Set(), s = n.filter((r) => !r.name || o.has(r.name) ? !1 : (o.add(r.name), !0));
|
|
9
|
+
if (s.length === 0) return /* @__PURE__ */ e.jsx(e.Fragment, { children: t });
|
|
10
|
+
const j = s.slice(0, c), a = s.slice(c);
|
|
11
11
|
return /* @__PURE__ */ e.jsxs(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
ref:
|
|
15
|
-
className:
|
|
14
|
+
ref: p,
|
|
15
|
+
className: g("flex items-center gap-2", h),
|
|
16
16
|
children: [
|
|
17
|
-
|
|
17
|
+
j.map((r) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
18
18
|
r.icon && /* @__PURE__ */ e.jsx(
|
|
19
19
|
"img",
|
|
20
20
|
{
|
|
@@ -26,14 +26,14 @@ const g = j(({ items: n, maxVisible: c = 1, className: x }, h) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
/* @__PURE__ */ e.jsx(
|
|
30
|
-
/* @__PURE__ */ e.jsx(
|
|
31
|
-
/* @__PURE__ */ e.jsx(
|
|
29
|
+
/* @__PURE__ */ e.jsx(i, { children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(m, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "truncate text-sm", children: r.name }) }),
|
|
31
|
+
/* @__PURE__ */ e.jsx(x, { children: /* @__PURE__ */ e.jsx("p", { children: r.name }) })
|
|
32
32
|
] }) })
|
|
33
33
|
] }, r.name)),
|
|
34
|
-
a.length > 0 && /* @__PURE__ */ e.jsx(
|
|
35
|
-
/* @__PURE__ */ e.jsx(
|
|
36
|
-
|
|
34
|
+
a.length > 0 && /* @__PURE__ */ e.jsx(i, { delayDuration: 0, children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
35
|
+
/* @__PURE__ */ e.jsx(m, { className: "shrink-0", children: /* @__PURE__ */ e.jsxs(
|
|
36
|
+
u,
|
|
37
37
|
{
|
|
38
38
|
variant: "outline",
|
|
39
39
|
className: "text-xs cursor-pointer hover:border-primary hover:text-primary",
|
|
@@ -43,7 +43,7 @@ const g = j(({ items: n, maxVisible: c = 1, className: x }, h) => {
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
) }),
|
|
46
|
-
/* @__PURE__ */ e.jsx(
|
|
46
|
+
/* @__PURE__ */ e.jsx(x, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: a.map((r) => /* @__PURE__ */ e.jsxs(
|
|
47
47
|
"div",
|
|
48
48
|
{
|
|
49
49
|
className: "flex items-center gap-3",
|
|
@@ -69,7 +69,7 @@ const g = j(({ items: n, maxVisible: c = 1, className: x }, h) => {
|
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
N.displayName = "DataTableIconTextCell";
|
|
73
73
|
export {
|
|
74
|
-
|
|
74
|
+
N as DataTableIconTextCell
|
|
75
75
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface DataTablePercentageCellProps {
|
|
2
3
|
/** The decimal value (0-1 range, e.g. 0.85 for 85%) */
|
|
3
4
|
value: number | null | undefined;
|
|
@@ -5,6 +6,8 @@ export interface DataTablePercentageCellProps {
|
|
|
5
6
|
decimals?: number;
|
|
6
7
|
/** Whether to show a progress bar @default false */
|
|
7
8
|
showProgressBar?: boolean;
|
|
9
|
+
/** Content to render when value is empty @default "-" */
|
|
10
|
+
emptyState?: ReactNode;
|
|
8
11
|
/** Additional CSS classes */
|
|
9
12
|
className?: string;
|
|
10
13
|
}
|
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { cn as c } from "../../../lib/utils.js";
|
|
4
|
+
const d = o(
|
|
5
|
+
({
|
|
6
|
+
value: t,
|
|
7
|
+
decimals: r = 2,
|
|
8
|
+
showProgressBar: n = !1,
|
|
9
|
+
emptyState: i = "-",
|
|
10
|
+
className: s
|
|
11
|
+
}, l) => {
|
|
12
|
+
if (t == null) return /* @__PURE__ */ e.jsx(e.Fragment, { children: i });
|
|
13
|
+
const a = t * 100, m = new Intl.NumberFormat("en-US", {
|
|
14
|
+
minimumFractionDigits: 0,
|
|
15
|
+
maximumFractionDigits: r
|
|
16
|
+
}).format(a);
|
|
17
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: l, className: c("flex items-center gap-3", s), children: [
|
|
18
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "h-1.5 flex-1 min-w-[50px] rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ e.jsx(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
22
|
+
style: { width: `${Math.min(a, 100)}%` }
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ e.jsxs("span", { className: "text-sm whitespace-nowrap", children: [
|
|
26
|
+
m,
|
|
27
|
+
"%"
|
|
28
|
+
] })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
d.displayName = "DataTablePercentageCell";
|
|
25
33
|
export {
|
|
26
|
-
|
|
34
|
+
d as DataTablePercentageCell
|
|
27
35
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { IconName } from '../../atoms/icon';
|
|
2
3
|
/**
|
|
3
4
|
* Configuration entry for mapping a status key to a Badge visual.
|
|
@@ -23,6 +24,8 @@ export interface DataTableStatusCellProps {
|
|
|
23
24
|
* @default Capitalizes first letter, replaces underscores with spaces
|
|
24
25
|
*/
|
|
25
26
|
formatLabel?: (status: string) => string;
|
|
27
|
+
/** Content to render when status is empty @default "-" */
|
|
28
|
+
emptyState?: ReactNode;
|
|
26
29
|
/** Additional CSS classes */
|
|
27
30
|
className?: string;
|
|
28
31
|
}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
3
|
import { cn as i } from "../../../lib/utils.js";
|
|
4
4
|
import { Badge as l } from "../../atoms/badge/badge.js";
|
|
5
5
|
const p = (r) => {
|
|
6
6
|
if (!r) return r;
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const a = r.replace(/[_.]/g, " ").toLowerCase();
|
|
8
|
+
return a.charAt(0).toUpperCase() + a.slice(1);
|
|
9
|
+
}, f = d(
|
|
10
|
+
({
|
|
11
|
+
status: r,
|
|
12
|
+
statusMap: a,
|
|
13
|
+
formatLabel: c = p,
|
|
14
|
+
emptyState: m = "-",
|
|
15
|
+
className: o
|
|
16
|
+
}, t) => {
|
|
17
|
+
if (!r) return /* @__PURE__ */ e.jsx(e.Fragment, { children: m });
|
|
18
|
+
const n = a?.[r] ?? a?.[r.toUpperCase()];
|
|
19
|
+
return n ? /* @__PURE__ */ e.jsx("div", { ref: t, className: i(o), children: /* @__PURE__ */ e.jsx(
|
|
20
|
+
l,
|
|
21
|
+
{
|
|
22
|
+
startIcon: n.icon ?? "Info",
|
|
23
|
+
variant: n.variant,
|
|
24
|
+
children: n.label
|
|
25
|
+
}
|
|
26
|
+
) }) : /* @__PURE__ */ e.jsx("div", { ref: t, className: i(o), children: /* @__PURE__ */ e.jsx(l, { startIcon: "Info", variant: "info", children: c(r) }) });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
f.displayName = "DataTableStatusCell";
|
|
22
30
|
export {
|
|
23
|
-
|
|
31
|
+
f as DataTableStatusCell
|
|
24
32
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface DataTableTagsCellProps {
|
|
2
3
|
/** Array of tag labels to display */
|
|
3
4
|
tags: string[];
|
|
@@ -5,6 +6,8 @@ export interface DataTableTagsCellProps {
|
|
|
5
6
|
maxVisible?: number;
|
|
6
7
|
/** Badge variant for all tags @default "outline" */
|
|
7
8
|
variant?: "outline" | "secondary" | "info" | "success" | "error" | "warning" | "alert";
|
|
9
|
+
/** Content to render when tags is empty @default "-" */
|
|
10
|
+
emptyState?: ReactNode;
|
|
8
11
|
/** Additional CSS classes */
|
|
9
12
|
className?: string;
|
|
10
13
|
}
|
|
@@ -1,39 +1,45 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { TooltipProvider as
|
|
5
|
-
import { Badge as
|
|
6
|
-
const
|
|
7
|
-
({
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
import { cn as x } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as d, Tooltip as h, TooltipTrigger as j, TooltipContent as f } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
import { Badge as o } from "../../atoms/badge/badge.js";
|
|
6
|
+
const T = p(
|
|
7
|
+
({
|
|
8
|
+
tags: s,
|
|
9
|
+
maxVisible: i = 2,
|
|
10
|
+
variant: t = "outline",
|
|
11
|
+
emptyState: a = "-",
|
|
12
|
+
className: n
|
|
13
|
+
}, c) => {
|
|
14
|
+
if (!s || s.length === 0) return /* @__PURE__ */ e.jsx(e.Fragment, { children: a });
|
|
15
|
+
const m = s.slice(0, i), l = s.slice(i);
|
|
10
16
|
return /* @__PURE__ */ e.jsxs(
|
|
11
17
|
"div",
|
|
12
18
|
{
|
|
13
|
-
ref:
|
|
14
|
-
className:
|
|
19
|
+
ref: c,
|
|
20
|
+
className: x("flex items-center gap-1 flex-wrap", n),
|
|
15
21
|
children: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ e.jsx(
|
|
19
|
-
|
|
22
|
+
m.map((r) => /* @__PURE__ */ e.jsx(o, { variant: t, className: "text-xs", children: r }, r)),
|
|
23
|
+
l.length > 0 && /* @__PURE__ */ e.jsx(d, { delayDuration: 0, children: /* @__PURE__ */ e.jsxs(h, { children: [
|
|
24
|
+
/* @__PURE__ */ e.jsx(j, { children: /* @__PURE__ */ e.jsxs(
|
|
25
|
+
o,
|
|
20
26
|
{
|
|
21
27
|
variant: "outline",
|
|
22
28
|
className: "text-xs cursor-pointer hover:border-primary hover:text-primary",
|
|
23
29
|
children: [
|
|
24
30
|
"+",
|
|
25
|
-
|
|
31
|
+
l.length
|
|
26
32
|
]
|
|
27
33
|
}
|
|
28
34
|
) }),
|
|
29
|
-
/* @__PURE__ */ e.jsx(f, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-1", children:
|
|
35
|
+
/* @__PURE__ */ e.jsx(f, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-1", children: l.map((r) => /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: r }, r)) }) })
|
|
30
36
|
] }) })
|
|
31
37
|
]
|
|
32
38
|
}
|
|
33
39
|
);
|
|
34
40
|
}
|
|
35
41
|
);
|
|
36
|
-
|
|
42
|
+
T.displayName = "DataTableTagsCell";
|
|
37
43
|
export {
|
|
38
|
-
|
|
44
|
+
T as DataTableTagsCell
|
|
39
45
|
};
|
|
@@ -3,13 +3,13 @@ import { forwardRef as c } from "react";
|
|
|
3
3
|
import { cn as x } from "../../../lib/utils.js";
|
|
4
4
|
import { TooltipProvider as d, Tooltip as m, TooltipTrigger as p, TooltipContent as j } from "../../../vendor/shadcn/tooltip.js";
|
|
5
5
|
const T = c(
|
|
6
|
-
({ value: r, formatFn: i, tooltip:
|
|
6
|
+
({ value: r, formatFn: i, tooltip: o, emptyState: a = "-", className: l }, s) => {
|
|
7
7
|
if (!r) return /* @__PURE__ */ t.jsx(t.Fragment, { children: a });
|
|
8
|
-
const e = i ? i(r) : r,
|
|
9
|
-
return
|
|
10
|
-
/* @__PURE__ */ t.jsx(p, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { ref:
|
|
11
|
-
/* @__PURE__ */ t.jsx(j, { children: /* @__PURE__ */ t.jsx("p", { children:
|
|
12
|
-
] }) }) : /* @__PURE__ */ t.jsx("div", { ref:
|
|
8
|
+
const e = i ? i(r) : r, n = o === !1 ? null : o ?? e;
|
|
9
|
+
return n ? /* @__PURE__ */ t.jsx(d, { children: /* @__PURE__ */ t.jsxs(m, { children: [
|
|
10
|
+
/* @__PURE__ */ t.jsx(p, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { ref: s, className: x("truncate text-sm", l), children: e }) }),
|
|
11
|
+
/* @__PURE__ */ t.jsx(j, { children: /* @__PURE__ */ t.jsx("p", { children: n }) })
|
|
12
|
+
] }) }) : /* @__PURE__ */ t.jsx("div", { ref: s, className: x("truncate text-sm", l), children: e });
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
T.displayName = "DataTableTextCell";
|