@yuno-payments/dashboard-design-system 2.7.14 → 2.8.1
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 +30 -0
- package/dist/components/molecules/data-table-cells/data-table-amount-cell.js +27 -0
- package/dist/components/molecules/data-table-cells/data-table-copy-cell.d.ts +41 -0
- package/dist/components/molecules/data-table-cells/data-table-copy-cell.js +83 -0
- package/dist/components/molecules/data-table-cells/data-table-country-cell.d.ts +31 -0
- package/dist/components/molecules/data-table-cells/data-table-country-cell.js +37 -0
- package/dist/components/molecules/data-table-cells/data-table-date-cell.d.ts +29 -0
- package/dist/components/molecules/data-table-cells/data-table-date-cell.js +34 -0
- package/dist/components/molecules/data-table-cells/data-table-icon-text-cell.d.ts +21 -0
- package/dist/components/molecules/data-table-cells/data-table-icon-text-cell.js +75 -0
- package/dist/components/molecules/data-table-cells/data-table-percentage-cell.d.ts +28 -0
- package/dist/components/molecules/data-table-cells/data-table-percentage-cell.js +27 -0
- package/dist/components/molecules/data-table-cells/data-table-status-cell.d.ts +44 -0
- package/dist/components/molecules/data-table-cells/data-table-status-cell.js +24 -0
- package/dist/components/molecules/data-table-cells/data-table-tags-cell.d.ts +16 -0
- package/dist/components/molecules/data-table-cells/data-table-tags-cell.js +39 -0
- package/dist/components/molecules/data-table-cells/data-table-text-cell.d.ts +53 -0
- package/dist/components/molecules/data-table-cells/data-table-text-cell.js +18 -0
- package/dist/components/molecules/data-table-cells/index.d.ts +9 -0
- package/dist/components/molecules/index.d.ts +1 -0
- package/dist/dashboard-design-system.css +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +42 -0
- package/dist/hooks/use-copy-to-clipboard.js +26 -0
- package/dist/index.css +1 -1
- package/dist/index.esm.min.js +7821 -7493
- package/dist/index.js +210 -190
- package/dist/index.umd.min.js +32 -32
- package/package.json +1 -1
- package/registry/components-registry.json +593 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the DataTableAmountCell component
|
|
3
|
+
*/
|
|
4
|
+
export interface DataTableAmountCellProps {
|
|
5
|
+
/** The numeric amount value */
|
|
6
|
+
value: number | null | undefined;
|
|
7
|
+
/** ISO 4217 currency code @default "USD" */
|
|
8
|
+
currency?: string;
|
|
9
|
+
/** Override locale for formatting */
|
|
10
|
+
locales?: string | string[];
|
|
11
|
+
/** CurrencyField size variant @default "xs" */
|
|
12
|
+
size?: "xs" | "sm" | "base";
|
|
13
|
+
/** Whether to show the currency code @default true */
|
|
14
|
+
showCurrencyCode?: boolean;
|
|
15
|
+
/** Additional CSS classes */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A table cell for displaying formatted currency amounts.
|
|
20
|
+
* Wraps the CurrencyField atom with sensible defaults for table usage.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <DataTableAmountCell value={1234.56} currency="USD" />
|
|
25
|
+
* <DataTableAmountCell value={500} currency="PEN" locales="es-PE" />
|
|
26
|
+
* <DataTableAmountCell value={0} currency="BRL" locales="pt-BR" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const DataTableAmountCell: import('react').ForwardRefExoticComponent<DataTableAmountCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export { DataTableAmountCell };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
4
|
+
import { CurrencyField as f } from "../../atoms/currency-field/currency-field.js";
|
|
5
|
+
const u = n(
|
|
6
|
+
({
|
|
7
|
+
value: r,
|
|
8
|
+
currency: t = "USD",
|
|
9
|
+
locales: m,
|
|
10
|
+
size: o = "xs",
|
|
11
|
+
showCurrencyCode: l = !0,
|
|
12
|
+
className: a
|
|
13
|
+
}, i) => r == null || Number.isNaN(r) ? null : /* @__PURE__ */ e.jsx("div", { ref: i, className: s("flex", a), children: /* @__PURE__ */ e.jsx(
|
|
14
|
+
f,
|
|
15
|
+
{
|
|
16
|
+
value: r,
|
|
17
|
+
currency: t,
|
|
18
|
+
locales: m,
|
|
19
|
+
size: o,
|
|
20
|
+
showCurrencyCode: l
|
|
21
|
+
}
|
|
22
|
+
) })
|
|
23
|
+
);
|
|
24
|
+
u.displayName = "DataTableAmountCell";
|
|
25
|
+
export {
|
|
26
|
+
u as DataTableAmountCell
|
|
27
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IconName } from '../../atoms/icon';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DataTableCopyCell component
|
|
4
|
+
*/
|
|
5
|
+
export interface DataTableCopyCellProps {
|
|
6
|
+
/** The text value to display and copy */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Optional navigation link — renders value as an anchor */
|
|
9
|
+
linkTo?: string;
|
|
10
|
+
/** Optional icon before the text (e.g. "Key" for test credentials) */
|
|
11
|
+
startIcon?: IconName;
|
|
12
|
+
/** Tooltip for the start icon */
|
|
13
|
+
startIconTooltip?: string;
|
|
14
|
+
/** Tooltip for the copy button @default "Copy" */
|
|
15
|
+
copyTooltip?: string;
|
|
16
|
+
/** Custom callback on successful copy */
|
|
17
|
+
onCopySuccess?: () => void;
|
|
18
|
+
/** Custom callback on copy error */
|
|
19
|
+
onCopyError?: () => void;
|
|
20
|
+
/** Additional CSS classes */
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A table cell that displays a text value with a copy-to-clipboard button.
|
|
25
|
+
* The copy button appears on hover. Supports optional navigation links
|
|
26
|
+
* and start icons (e.g., test credential indicators).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Simple copy cell
|
|
31
|
+
* <DataTableCopyCell value="pay_abc123def456ghi789" />
|
|
32
|
+
*
|
|
33
|
+
* // With link
|
|
34
|
+
* <DataTableCopyCell value="pay_abc123" linkTo="/payments/details/pay_abc123" />
|
|
35
|
+
*
|
|
36
|
+
* // With start icon
|
|
37
|
+
* <DataTableCopyCell value="pay_test_123" startIcon="Key" startIconTooltip="Test credential" />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const DataTableCopyCell: import('react').ForwardRefExoticComponent<DataTableCopyCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
41
|
+
export { DataTableCopyCell };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
4
|
+
import { Icon as c } from "../../atoms/icon/icon.js";
|
|
5
|
+
import { TooltipProvider as i, Tooltip as o, TooltipTrigger as n, TooltipContent as l } from "../../../vendor/shadcn/tooltip.js";
|
|
6
|
+
import { useCopyToClipboard as g } from "../../../hooks/use-copy-to-clipboard.js";
|
|
7
|
+
const N = f(
|
|
8
|
+
({
|
|
9
|
+
value: e,
|
|
10
|
+
linkTo: t,
|
|
11
|
+
startIcon: a,
|
|
12
|
+
startIconTooltip: p,
|
|
13
|
+
copyTooltip: d = "Copy",
|
|
14
|
+
onCopySuccess: m,
|
|
15
|
+
onCopyError: h,
|
|
16
|
+
className: x
|
|
17
|
+
}, j) => {
|
|
18
|
+
const { copyToClipboard: u } = g({
|
|
19
|
+
onSuccess: m,
|
|
20
|
+
onError: h
|
|
21
|
+
});
|
|
22
|
+
if (!e) return null;
|
|
23
|
+
const C = (s) => {
|
|
24
|
+
s.stopPropagation(), u(e);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ r.jsxs(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
ref: j,
|
|
30
|
+
className: y("group flex items-center gap-2 w-full", x),
|
|
31
|
+
children: [
|
|
32
|
+
a && /* @__PURE__ */ r.jsx(i, { children: /* @__PURE__ */ r.jsxs(o, { children: [
|
|
33
|
+
/* @__PURE__ */ r.jsx(n, { asChild: !0, children: /* @__PURE__ */ r.jsx("span", { className: "shrink-0 inline-flex", children: /* @__PURE__ */ r.jsx(
|
|
34
|
+
c,
|
|
35
|
+
{
|
|
36
|
+
name: a,
|
|
37
|
+
weight: "fill",
|
|
38
|
+
size: "sm",
|
|
39
|
+
className: "text-primary"
|
|
40
|
+
}
|
|
41
|
+
) }) }),
|
|
42
|
+
p && /* @__PURE__ */ r.jsx(l, { children: /* @__PURE__ */ r.jsx("p", { children: p }) })
|
|
43
|
+
] }) }),
|
|
44
|
+
/* @__PURE__ */ r.jsx(i, { children: /* @__PURE__ */ r.jsxs(o, { children: [
|
|
45
|
+
/* @__PURE__ */ r.jsx(n, { asChild: !0, children: /* @__PURE__ */ r.jsx("span", { className: "truncate text-sm", children: t ? /* @__PURE__ */ r.jsx(
|
|
46
|
+
"a",
|
|
47
|
+
{
|
|
48
|
+
href: t,
|
|
49
|
+
className: "text-primary hover:underline",
|
|
50
|
+
onClick: (s) => s.stopPropagation(),
|
|
51
|
+
children: e
|
|
52
|
+
}
|
|
53
|
+
) : e }) }),
|
|
54
|
+
/* @__PURE__ */ r.jsx(l, { children: /* @__PURE__ */ r.jsx("p", { children: e }) })
|
|
55
|
+
] }) }),
|
|
56
|
+
/* @__PURE__ */ r.jsx(i, { children: /* @__PURE__ */ r.jsxs(o, { children: [
|
|
57
|
+
/* @__PURE__ */ r.jsx(n, { asChild: !0, children: /* @__PURE__ */ r.jsx(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
className: "shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-muted rounded",
|
|
62
|
+
onClick: C,
|
|
63
|
+
children: /* @__PURE__ */ r.jsx(
|
|
64
|
+
c,
|
|
65
|
+
{
|
|
66
|
+
name: "CopySimple",
|
|
67
|
+
size: "sm",
|
|
68
|
+
className: "text-muted-foreground"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
) }),
|
|
73
|
+
/* @__PURE__ */ r.jsx(l, { children: /* @__PURE__ */ r.jsx("p", { children: d }) })
|
|
74
|
+
] }) })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
N.displayName = "DataTableCopyCell";
|
|
81
|
+
export {
|
|
82
|
+
N as DataTableCopyCell
|
|
83
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface DataTableCountryCellProps {
|
|
2
|
+
/** ISO 3166-1 alpha-2 country code (e.g., "US", "CO", "BR") */
|
|
3
|
+
code: string | null | undefined;
|
|
4
|
+
/** Whether to show the flag emoji @default true */
|
|
5
|
+
showFlag?: boolean;
|
|
6
|
+
/** Whether to show the country name instead of just the code @default false */
|
|
7
|
+
showName?: boolean;
|
|
8
|
+
/** Custom function to resolve country name from code */
|
|
9
|
+
getCountryName?: (code: string) => string;
|
|
10
|
+
/** Additional CSS classes */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A table cell for displaying country codes with flag emojis.
|
|
15
|
+
* Supports showing just the code, or the full country name via
|
|
16
|
+
* a custom resolver function.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Code with flag
|
|
21
|
+
* <DataTableCountryCell code="US" />
|
|
22
|
+
*
|
|
23
|
+
* // With country name
|
|
24
|
+
* <DataTableCountryCell code="CO" showName getCountryName={countryNameFromCode} />
|
|
25
|
+
*
|
|
26
|
+
* // Without flag
|
|
27
|
+
* <DataTableCountryCell code="BR" showFlag={false} />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const DataTableCountryCell: import('react').ForwardRefExoticComponent<DataTableCountryCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export { DataTableCountryCell };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as u, Tooltip as x, TooltipTrigger as d, TooltipContent as h } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
const j = (t) => !t || typeof t != "string" ? t : typeof String.fromCodePoint < "u" ? t.toUpperCase().replace(
|
|
6
|
+
/./g,
|
|
7
|
+
(n) => String.fromCodePoint(n.charCodeAt(0) + 127397)
|
|
8
|
+
) : t, T = m(
|
|
9
|
+
({ code: t, showFlag: n = !0, showName: o = !1, getCountryName: s, className: a }, i) => {
|
|
10
|
+
if (!t) return null;
|
|
11
|
+
const e = n ? j(t) : null, l = s ? s(t) : null, p = o && l ? l : t.toUpperCase(), c = l ?? t.toUpperCase();
|
|
12
|
+
return /* @__PURE__ */ r.jsx(u, { children: /* @__PURE__ */ r.jsxs(x, { children: [
|
|
13
|
+
/* @__PURE__ */ r.jsx(d, { asChild: !0, children: /* @__PURE__ */ r.jsxs(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
ref: i,
|
|
17
|
+
className: f(
|
|
18
|
+
"flex items-center gap-1 truncate text-sm",
|
|
19
|
+
a
|
|
20
|
+
),
|
|
21
|
+
children: [
|
|
22
|
+
e && /* @__PURE__ */ r.jsx("span", { className: "shrink-0", children: e }),
|
|
23
|
+
/* @__PURE__ */ r.jsx("span", { className: "truncate", children: p })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ r.jsx(h, { children: /* @__PURE__ */ r.jsxs("p", { children: [
|
|
28
|
+
e && `${e} `,
|
|
29
|
+
c
|
|
30
|
+
] }) })
|
|
31
|
+
] }) });
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
T.displayName = "DataTableCountryCell";
|
|
35
|
+
export {
|
|
36
|
+
T as DataTableCountryCell
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface DataTableDateCellProps {
|
|
2
|
+
/** The date value — ISO string or Date object */
|
|
3
|
+
value: string | Date | null | undefined;
|
|
4
|
+
/** Custom date formatter. If not provided, uses Intl.DateTimeFormat with date and time */
|
|
5
|
+
formatFn?: (date: string | Date) => string;
|
|
6
|
+
/** Content to render when value is falsy @default null */
|
|
7
|
+
emptyState?: React.ReactNode;
|
|
8
|
+
/** Additional CSS classes */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A table cell for displaying formatted dates with truncation and tooltip.
|
|
13
|
+
* Accepts a custom formatting function or uses a sensible default
|
|
14
|
+
* (Intl.DateTimeFormat with date + time).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Simple date
|
|
19
|
+
* <DataTableDateCell value="2024-03-15T14:30:00Z" />
|
|
20
|
+
*
|
|
21
|
+
* // With custom formatter
|
|
22
|
+
* <DataTableDateCell value="2024-03-15T14:30:00Z" formatFn={defaultDateFormat} />
|
|
23
|
+
*
|
|
24
|
+
* // With empty state
|
|
25
|
+
* <DataTableDateCell value={null} emptyState="-" />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare const DataTableDateCell: import('react').ForwardRefExoticComponent<DataTableDateCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export { DataTableDateCell };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as m, Tooltip as c, TooltipTrigger as d, TooltipContent as f } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
const h = (r) => {
|
|
6
|
+
try {
|
|
7
|
+
const e = typeof r == "string" ? new Date(r) : r;
|
|
8
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
9
|
+
weekday: "short",
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "short",
|
|
12
|
+
day: "numeric",
|
|
13
|
+
hour: "2-digit",
|
|
14
|
+
minute: "2-digit",
|
|
15
|
+
second: "2-digit",
|
|
16
|
+
hour12: !1
|
|
17
|
+
}).format(e);
|
|
18
|
+
} catch {
|
|
19
|
+
return String(r);
|
|
20
|
+
}
|
|
21
|
+
}, p = s(
|
|
22
|
+
({ value: r, formatFn: e, emptyState: i = null, className: n }, a) => {
|
|
23
|
+
if (!r) return /* @__PURE__ */ t.jsx(t.Fragment, { children: i });
|
|
24
|
+
const o = (e ?? h)(r);
|
|
25
|
+
return /* @__PURE__ */ t.jsx(m, { children: /* @__PURE__ */ t.jsxs(c, { children: [
|
|
26
|
+
/* @__PURE__ */ t.jsx(d, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { ref: a, className: l("truncate text-sm", n), children: o }) }),
|
|
27
|
+
/* @__PURE__ */ t.jsx(f, { children: /* @__PURE__ */ t.jsx("p", { children: o }) })
|
|
28
|
+
] }) });
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
p.displayName = "DataTableDateCell";
|
|
32
|
+
export {
|
|
33
|
+
p as DataTableDateCell
|
|
34
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface DataTableIconTextCellItem {
|
|
2
|
+
/** Item name/label */
|
|
3
|
+
name: string;
|
|
4
|
+
/** URL to the icon image */
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DataTableIconTextCellProps {
|
|
8
|
+
/** Array of items to display (will be deduplicated by name) */
|
|
9
|
+
items: DataTableIconTextCellItem[];
|
|
10
|
+
/** Maximum number of visible items @default 1 */
|
|
11
|
+
maxVisible?: number;
|
|
12
|
+
/** Additional CSS classes */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A table cell for displaying items with icons and text, such as payment
|
|
17
|
+
* providers or payment methods. Shows the first item with its icon and name,
|
|
18
|
+
* plus a "+N" badge for additional items. Automatically deduplicates by name.
|
|
19
|
+
*/
|
|
20
|
+
declare const DataTableIconTextCell: import('react').ForwardRefExoticComponent<DataTableIconTextCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export { DataTableIconTextCell };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as j } from "react";
|
|
3
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as o, Tooltip as i, TooltipTrigger as d, TooltipContent as m } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
import { Badge as f } from "../../atoms/badge/badge.js";
|
|
6
|
+
const g = j(({ items: n, maxVisible: c = 1, className: x }, h) => {
|
|
7
|
+
if (!n || n.length === 0) return null;
|
|
8
|
+
const t = /* @__PURE__ */ new Set(), s = n.filter((r) => !r.name || t.has(r.name) ? !1 : (t.add(r.name), !0));
|
|
9
|
+
if (s.length === 0) return null;
|
|
10
|
+
const p = s.slice(0, c), a = s.slice(c);
|
|
11
|
+
return /* @__PURE__ */ e.jsxs(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
ref: h,
|
|
15
|
+
className: u("flex items-center gap-2", x),
|
|
16
|
+
children: [
|
|
17
|
+
p.map((r) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
18
|
+
r.icon && /* @__PURE__ */ e.jsx(
|
|
19
|
+
"img",
|
|
20
|
+
{
|
|
21
|
+
src: r.icon,
|
|
22
|
+
alt: r.name,
|
|
23
|
+
className: "h-4 w-4 shrink-0 object-contain",
|
|
24
|
+
onError: (l) => {
|
|
25
|
+
l.currentTarget.style.display = "none";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ e.jsx(o, { children: /* @__PURE__ */ e.jsxs(i, { children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(d, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "truncate text-sm", children: r.name }) }),
|
|
31
|
+
/* @__PURE__ */ e.jsx(m, { children: /* @__PURE__ */ e.jsx("p", { children: r.name }) })
|
|
32
|
+
] }) })
|
|
33
|
+
] }, r.name)),
|
|
34
|
+
a.length > 0 && /* @__PURE__ */ e.jsx(o, { delayDuration: 0, children: /* @__PURE__ */ e.jsxs(i, { children: [
|
|
35
|
+
/* @__PURE__ */ e.jsx(d, { className: "shrink-0", children: /* @__PURE__ */ e.jsxs(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
variant: "outline",
|
|
39
|
+
className: "text-xs cursor-pointer hover:border-primary hover:text-primary",
|
|
40
|
+
children: [
|
|
41
|
+
"+",
|
|
42
|
+
a.length
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) }),
|
|
46
|
+
/* @__PURE__ */ e.jsx(m, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: a.map((r) => /* @__PURE__ */ e.jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: "flex items-center gap-3",
|
|
50
|
+
children: [
|
|
51
|
+
r.icon && /* @__PURE__ */ e.jsx(
|
|
52
|
+
"img",
|
|
53
|
+
{
|
|
54
|
+
src: r.icon,
|
|
55
|
+
alt: r.name,
|
|
56
|
+
className: "h-4 w-4 object-contain",
|
|
57
|
+
onError: (l) => {
|
|
58
|
+
l.currentTarget.style.display = "none";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: r.name })
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
r.name
|
|
66
|
+
)) }) })
|
|
67
|
+
] }) })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
g.displayName = "DataTableIconTextCell";
|
|
73
|
+
export {
|
|
74
|
+
g as DataTableIconTextCell
|
|
75
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface DataTablePercentageCellProps {
|
|
2
|
+
/** The decimal value (0-1 range, e.g. 0.85 for 85%) */
|
|
3
|
+
value: number | null | undefined;
|
|
4
|
+
/** Number of decimal places @default 2 */
|
|
5
|
+
decimals?: number;
|
|
6
|
+
/** Whether to show a progress bar @default false */
|
|
7
|
+
showProgressBar?: boolean;
|
|
8
|
+
/** Additional CSS classes */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A table cell for displaying percentage values with optional progress bar
|
|
13
|
+
* visualization. Accepts values in 0-1 decimal range.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Simple percentage
|
|
18
|
+
* <DataTablePercentageCell value={0.8534} />
|
|
19
|
+
*
|
|
20
|
+
* // With progress bar
|
|
21
|
+
* <DataTablePercentageCell value={0.75} showProgressBar />
|
|
22
|
+
*
|
|
23
|
+
* // No decimals
|
|
24
|
+
* <DataTablePercentageCell value={0.856} decimals={0} />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare const DataTablePercentageCell: import('react').ForwardRefExoticComponent<DataTablePercentageCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export { DataTablePercentageCell };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { cn as o } from "../../../lib/utils.js";
|
|
4
|
+
const c = m(({ value: t, decimals: r = 2, showProgressBar: l = !1, className: n }, i) => {
|
|
5
|
+
if (t == null) return null;
|
|
6
|
+
const a = t * 100, s = new Intl.NumberFormat("en-US", {
|
|
7
|
+
minimumFractionDigits: 0,
|
|
8
|
+
maximumFractionDigits: r
|
|
9
|
+
}).format(a);
|
|
10
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: i, className: o("flex items-center gap-3", n), children: [
|
|
11
|
+
l && /* @__PURE__ */ e.jsx("div", { className: "h-1.5 flex-1 min-w-[50px] rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ e.jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
15
|
+
style: { width: `${Math.min(a, 100)}%` }
|
|
16
|
+
}
|
|
17
|
+
) }),
|
|
18
|
+
/* @__PURE__ */ e.jsxs("span", { className: "text-sm whitespace-nowrap", children: [
|
|
19
|
+
s,
|
|
20
|
+
"%"
|
|
21
|
+
] })
|
|
22
|
+
] });
|
|
23
|
+
});
|
|
24
|
+
c.displayName = "DataTablePercentageCell";
|
|
25
|
+
export {
|
|
26
|
+
c as DataTablePercentageCell
|
|
27
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconName } from '../../atoms/icon';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration entry for mapping a status key to a Badge visual.
|
|
4
|
+
*/
|
|
5
|
+
export interface StatusMapEntry {
|
|
6
|
+
/** Display label */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Badge variant */
|
|
9
|
+
variant: "success" | "error" | "warning" | "info" | "alert" | "outline" | "secondary";
|
|
10
|
+
/** Phosphor icon name @default "Info" */
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props for the DataTableStatusCell component
|
|
15
|
+
*/
|
|
16
|
+
export interface DataTableStatusCellProps {
|
|
17
|
+
/** The raw status key (e.g., "APPROVED", "DECLINED") */
|
|
18
|
+
status: string;
|
|
19
|
+
/** Map of status keys to display configuration */
|
|
20
|
+
statusMap?: Record<string, StatusMapEntry>;
|
|
21
|
+
/**
|
|
22
|
+
* Fallback label formatter when status is not in the map.
|
|
23
|
+
* @default Capitalizes first letter, replaces underscores with spaces
|
|
24
|
+
*/
|
|
25
|
+
formatLabel?: (status: string) => string;
|
|
26
|
+
/** Additional CSS classes */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A table cell that displays a status as a colored Badge with an icon.
|
|
31
|
+
* Accepts a status map for consistent status-to-visual mapping across the application.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const STATUS_MAP = {
|
|
36
|
+
* APPROVED: { label: "Approved", variant: "success", icon: "CheckCircle" },
|
|
37
|
+
* DECLINED: { label: "Declined", variant: "error", icon: "XCircle" },
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* <DataTableStatusCell status="APPROVED" statusMap={STATUS_MAP} />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const DataTableStatusCell: import('react').ForwardRefExoticComponent<DataTableStatusCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export { DataTableStatusCell };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { j as n } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { cn as i } from "../../../lib/utils.js";
|
|
4
|
+
import { Badge as l } from "../../atoms/badge/badge.js";
|
|
5
|
+
const p = (r) => {
|
|
6
|
+
if (!r) return r;
|
|
7
|
+
const e = r.replace(/[_.]/g, " ").toLowerCase();
|
|
8
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
9
|
+
}, d = m(({ status: r, statusMap: e, formatLabel: c = p, className: o }, t) => {
|
|
10
|
+
if (!r) return null;
|
|
11
|
+
const a = e?.[r] ?? e?.[r.toUpperCase()];
|
|
12
|
+
return a ? /* @__PURE__ */ n.jsx("div", { ref: t, className: i(o), children: /* @__PURE__ */ n.jsx(
|
|
13
|
+
l,
|
|
14
|
+
{
|
|
15
|
+
startIcon: a.icon ?? "Info",
|
|
16
|
+
variant: a.variant,
|
|
17
|
+
children: a.label
|
|
18
|
+
}
|
|
19
|
+
) }) : /* @__PURE__ */ n.jsx("div", { ref: t, className: i(o), children: /* @__PURE__ */ n.jsx(l, { startIcon: "Info", variant: "info", children: c(r) }) });
|
|
20
|
+
});
|
|
21
|
+
d.displayName = "DataTableStatusCell";
|
|
22
|
+
export {
|
|
23
|
+
d as DataTableStatusCell
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DataTableTagsCellProps {
|
|
2
|
+
/** Array of tag labels to display */
|
|
3
|
+
tags: string[];
|
|
4
|
+
/** Maximum number of visible tags before showing "+N" @default 2 */
|
|
5
|
+
maxVisible?: number;
|
|
6
|
+
/** Badge variant for all tags @default "outline" */
|
|
7
|
+
variant?: "outline" | "secondary" | "info" | "success" | "error" | "warning" | "alert";
|
|
8
|
+
/** Additional CSS classes */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A table cell for displaying a list of tags as Badges with overflow handling.
|
|
13
|
+
* Shows the first N tags and a "+X" badge with tooltip for the rest.
|
|
14
|
+
*/
|
|
15
|
+
declare const DataTableTagsCell: import('react').ForwardRefExoticComponent<DataTableTagsCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export { DataTableTagsCell };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { cn as p } from "../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as x, Tooltip as d, TooltipTrigger as h, TooltipContent as f } from "../../../vendor/shadcn/tooltip.js";
|
|
5
|
+
import { Badge as i } from "../../atoms/badge/badge.js";
|
|
6
|
+
const j = m(
|
|
7
|
+
({ tags: l, maxVisible: o = 2, variant: t = "outline", className: a }, n) => {
|
|
8
|
+
if (!l || l.length === 0) return null;
|
|
9
|
+
const c = l.slice(0, o), s = l.slice(o);
|
|
10
|
+
return /* @__PURE__ */ e.jsxs(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
ref: n,
|
|
14
|
+
className: p("flex items-center gap-1 flex-wrap", a),
|
|
15
|
+
children: [
|
|
16
|
+
c.map((r) => /* @__PURE__ */ e.jsx(i, { variant: t, className: "text-xs", children: r }, r)),
|
|
17
|
+
s.length > 0 && /* @__PURE__ */ e.jsx(x, { delayDuration: 0, children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
18
|
+
/* @__PURE__ */ e.jsx(h, { children: /* @__PURE__ */ e.jsxs(
|
|
19
|
+
i,
|
|
20
|
+
{
|
|
21
|
+
variant: "outline",
|
|
22
|
+
className: "text-xs cursor-pointer hover:border-primary hover:text-primary",
|
|
23
|
+
children: [
|
|
24
|
+
"+",
|
|
25
|
+
s.length
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
/* @__PURE__ */ e.jsx(f, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-1", children: s.map((r) => /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: r }, r)) }) })
|
|
30
|
+
] }) })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
j.displayName = "DataTableTagsCell";
|
|
37
|
+
export {
|
|
38
|
+
j as DataTableTagsCell
|
|
39
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DataTableTextCell component
|
|
4
|
+
*/
|
|
5
|
+
export interface DataTableTextCellProps {
|
|
6
|
+
/**
|
|
7
|
+
* The text value to display
|
|
8
|
+
*/
|
|
9
|
+
value: string | null | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Optional transform function applied to the value before display
|
|
12
|
+
* @example (value) => value.toUpperCase()
|
|
13
|
+
*/
|
|
14
|
+
formatFn?: (value: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom tooltip text, or false to disable the tooltip.
|
|
17
|
+
* Defaults to the formatted value.
|
|
18
|
+
*/
|
|
19
|
+
tooltip?: string | false;
|
|
20
|
+
/**
|
|
21
|
+
* Content to render when value is falsy.
|
|
22
|
+
* Defaults to null (renders nothing).
|
|
23
|
+
* @example "-" or "--"
|
|
24
|
+
*/
|
|
25
|
+
emptyState?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Additional CSS classes
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Base table cell component for displaying truncated text with a tooltip.
|
|
33
|
+
*
|
|
34
|
+
* This is the foundational cell component — other DataTable cells
|
|
35
|
+
* (DateCell, CopyCell, etc.) compose this internally.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Simple text
|
|
40
|
+
* <DataTableTextCell value="Some long text that will be truncated" />
|
|
41
|
+
*
|
|
42
|
+
* // With transform function
|
|
43
|
+
* <DataTableTextCell value="SCREAMING_SNAKE" formatFn={cleanText} />
|
|
44
|
+
*
|
|
45
|
+
* // With custom empty state
|
|
46
|
+
* <DataTableTextCell value={null} emptyState="-" />
|
|
47
|
+
*
|
|
48
|
+
* // Without tooltip
|
|
49
|
+
* <DataTableTextCell value="Short" tooltip={false} />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare const DataTableTextCell: import('react').ForwardRefExoticComponent<DataTableTextCellProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export { DataTableTextCell };
|