@yuno-payments/dashboard-design-system 2.8.6 → 2.8.9

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,32 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Props for the DataTableCellWrapper component
4
+ */
5
+ export interface DataTableCellWrapperProps {
6
+ /** The value to check for emptiness. Renders emptyState when null/undefined/'' or an empty array. */
7
+ value: unknown;
8
+ /** Content to render when value is non-empty */
9
+ children: ReactNode;
10
+ /** Content to render when value is empty @default "-" */
11
+ emptyState?: ReactNode;
12
+ }
13
+ /**
14
+ * Wraps a custom table cell to enforce the standard empty-state ("-")
15
+ * across the design system. Use this for cells that render custom JSX
16
+ * (Badges, icon+text combos, switches, etc.) that don't fit one of the
17
+ * specialized DataTable*Cell components.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <DataTableCellWrapper value={method}>
22
+ * <MethodTag method={method} />
23
+ * </DataTableCellWrapper>
24
+ *
25
+ * // Custom empty state
26
+ * <DataTableCellWrapper value={amount} emptyState="N/A">
27
+ * <CustomAmount value={amount} />
28
+ * </DataTableCellWrapper>
29
+ * ```
30
+ */
31
+ declare const DataTableCellWrapper: import('react').ForwardRefExoticComponent<DataTableCellWrapperProps & import('react').RefAttributes<HTMLSpanElement>>;
32
+ export { DataTableCellWrapper };
@@ -0,0 +1,7 @@
1
+ import { j as t } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as i } from "react";
3
+ const s = (r) => !!(r == null || typeof r == "string" && r.trim() === "" || Array.isArray(r) && r.length === 0), p = i(({ value: r, children: e, emptyState: n = "-" }, a) => s(r) ? /* @__PURE__ */ t.jsx("span", { ref: a, children: n }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: e }));
4
+ p.displayName = "DataTableCellWrapper";
5
+ export {
6
+ p as DataTableCellWrapper
7
+ };
@@ -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 { DataTableCellWrapper, type DataTableCellWrapperProps, } from './data-table-cell-wrapper';
1
2
  export { DataTableTextCell, type DataTableTextCellProps, } from './data-table-text-cell';
2
3
  export { DataTableCopyCell, type DataTableCopyCellProps, } from './data-table-copy-cell';
3
4
  export { DataTableStatusCell, type DataTableStatusCellProps, type StatusMapEntry, } from './data-table-status-cell';