@yuno-payments/dashboard-design-system 2.8.8 → 2.8.10

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.
@@ -0,0 +1,36 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { Badge } from '../../atoms/badge';
3
+ import { IconName } from '../../atoms/icon';
4
+ type BadgeVariant = NonNullable<ComponentProps<typeof Badge>["variant"]>;
5
+ /**
6
+ * Props for the DataTableBadgeCell component
7
+ */
8
+ export interface DataTableBadgeCellProps {
9
+ /** Label rendered inside the badge */
10
+ value: string | null | undefined;
11
+ /** Badge visual variant */
12
+ variant?: BadgeVariant;
13
+ /** Optional icon rendered at the start of the badge */
14
+ startIcon?: IconName;
15
+ /** Content to render when value is empty @default "-" */
16
+ emptyState?: ReactNode;
17
+ /** Additional CSS classes */
18
+ className?: string;
19
+ }
20
+ /**
21
+ * A table cell that renders a single `Badge` with a pre-computed variant.
22
+ * Use it when the caller already knows the visual variant (no lookup map needed)
23
+ * — for example: ternary results, range-based status colors, or one-off
24
+ * labelled badges.
25
+ *
26
+ * For data-driven lookups (status key → variant via a map), prefer
27
+ * `DataTableStatusCell`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <DataTableBadgeCell value={method} variant={getColorMethod(method)} />
32
+ * <DataTableBadgeCell value="Active" variant="success" startIcon="CheckCircle" />
33
+ * ```
34
+ */
35
+ declare const DataTableBadgeCell: import('react').ForwardRefExoticComponent<DataTableBadgeCellProps & import('react').RefAttributes<HTMLSpanElement>>;
36
+ export { DataTableBadgeCell };
@@ -0,0 +1,19 @@
1
+ import { j as r } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as l } from "react";
3
+ import { Badge as n } from "../../atoms/badge/badge.js";
4
+ const d = l(
5
+ ({ value: e, variant: a = "info", startIcon: t, emptyState: o = "-", className: i }, m) => e ? /* @__PURE__ */ r.jsx(
6
+ n,
7
+ {
8
+ ref: m,
9
+ variant: a,
10
+ startIcon: t,
11
+ className: i,
12
+ children: e
13
+ }
14
+ ) : /* @__PURE__ */ r.jsx(r.Fragment, { children: o })
15
+ );
16
+ d.displayName = "DataTableBadgeCell";
17
+ export {
18
+ d as DataTableBadgeCell
19
+ };
@@ -1,9 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
+ import { IconName } from '../../atoms/icon';
2
3
  export interface DataTableIconTextCellItem {
3
4
  /** Item name/label */
4
5
  name: string;
5
6
  /** URL to the icon image */
6
- icon?: string;
7
+ src?: string;
8
+ /** Phosphor icon name (used when no `src` URL is provided) */
9
+ iconName?: IconName;
7
10
  }
8
11
  export interface DataTableIconTextCellProps {
9
12
  /** Array of items to display (will be deduplicated by name) */
@@ -1,39 +1,40 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
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);
3
+ import { cn as N } from "../../../lib/utils.js";
4
+ import { Icon as t } from "../../atoms/icon/icon.js";
5
+ import { TooltipProvider as m, Tooltip as x, TooltipTrigger as d, TooltipContent as h } from "../../../vendor/shadcn/tooltip.js";
6
+ import { Badge as g } from "../../atoms/badge/badge.js";
7
+ const T = f(({ items: s, maxVisible: c = 1, emptyState: o = "-", className: p }, j) => {
8
+ if (!s || s.length === 0) return /* @__PURE__ */ e.jsx(e.Fragment, { children: o });
9
+ const i = /* @__PURE__ */ new Set(), n = s.filter((r) => !r.name || i.has(r.name) ? !1 : (i.add(r.name), !0));
10
+ if (n.length === 0) return /* @__PURE__ */ e.jsx(e.Fragment, { children: o });
11
+ const u = n.slice(0, c), a = n.slice(c);
11
12
  return /* @__PURE__ */ e.jsxs(
12
13
  "div",
13
14
  {
14
- ref: p,
15
- className: g("flex items-center gap-2", h),
15
+ ref: j,
16
+ className: N("flex items-center gap-2", p),
16
17
  children: [
17
- j.map((r) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
18
- r.icon && /* @__PURE__ */ e.jsx(
18
+ u.map((r) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
19
+ r.src ? /* @__PURE__ */ e.jsx(
19
20
  "img",
20
21
  {
21
- src: r.icon,
22
+ src: r.src,
22
23
  alt: r.name,
23
24
  className: "h-4 w-4 shrink-0 object-contain",
24
25
  onError: (l) => {
25
26
  l.currentTarget.style.display = "none";
26
27
  }
27
28
  }
28
- ),
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 }) })
29
+ ) : r.iconName ? /* @__PURE__ */ e.jsx(t, { name: r.iconName, size: "sm", className: "shrink-0" }) : null,
30
+ /* @__PURE__ */ e.jsx(m, { children: /* @__PURE__ */ e.jsxs(x, { children: [
31
+ /* @__PURE__ */ e.jsx(d, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "truncate text-sm", children: r.name }) }),
32
+ /* @__PURE__ */ e.jsx(h, { children: /* @__PURE__ */ e.jsx("p", { children: r.name }) })
32
33
  ] }) })
33
34
  ] }, r.name)),
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,
35
+ a.length > 0 && /* @__PURE__ */ e.jsx(m, { delayDuration: 0, children: /* @__PURE__ */ e.jsxs(x, { children: [
36
+ /* @__PURE__ */ e.jsx(d, { className: "shrink-0", children: /* @__PURE__ */ e.jsxs(
37
+ g,
37
38
  {
38
39
  variant: "outline",
39
40
  className: "text-xs cursor-pointer hover:border-primary hover:text-primary",
@@ -43,22 +44,22 @@ const N = f(({ items: n, maxVisible: c = 1, emptyState: t = "-", className: h },
43
44
  ]
44
45
  }
45
46
  ) }),
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
+ /* @__PURE__ */ e.jsx(h, { className: "p-2", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: a.map((r) => /* @__PURE__ */ e.jsxs(
47
48
  "div",
48
49
  {
49
50
  className: "flex items-center gap-3",
50
51
  children: [
51
- r.icon && /* @__PURE__ */ e.jsx(
52
+ r.src ? /* @__PURE__ */ e.jsx(
52
53
  "img",
53
54
  {
54
- src: r.icon,
55
+ src: r.src,
55
56
  alt: r.name,
56
57
  className: "h-4 w-4 object-contain",
57
58
  onError: (l) => {
58
59
  l.currentTarget.style.display = "none";
59
60
  }
60
61
  }
61
- ),
62
+ ) : r.iconName ? /* @__PURE__ */ e.jsx(t, { name: r.iconName, size: "sm" }) : null,
62
63
  /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: r.name })
63
64
  ]
64
65
  },
@@ -69,7 +70,7 @@ const N = f(({ items: n, maxVisible: c = 1, emptyState: t = "-", className: h },
69
70
  }
70
71
  );
71
72
  });
72
- N.displayName = "DataTableIconTextCell";
73
+ T.displayName = "DataTableIconTextCell";
73
74
  export {
74
- N as DataTableIconTextCell
75
+ T as DataTableIconTextCell
75
76
  };
@@ -1,3 +1,4 @@
1
+ export { DataTableBadgeCell, type DataTableBadgeCellProps, } from './data-table-badge-cell';
1
2
  export { DataTableCellWrapper, type DataTableCellWrapperProps, } from './data-table-cell-wrapper';
2
3
  export { DataTableTextCell, type DataTableTextCellProps, } from './data-table-text-cell';
3
4
  export { DataTableCopyCell, type DataTableCopyCellProps, } from './data-table-copy-cell';