@lax-wp/design-system 0.14.34 → 0.14.36

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.
Files changed (36) hide show
  1. package/dist/components/data-display/infinite-table/CellContextMenuPortal.cjs.js +2 -0
  2. package/dist/components/data-display/infinite-table/CellContextMenuPortal.cjs.js.map +1 -0
  3. package/dist/components/data-display/infinite-table/CellContextMenuPortal.d.ts +13 -0
  4. package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js +174 -0
  5. package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js.map +1 -0
  6. package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js +1 -1
  7. package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js.map +1 -1
  8. package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js +183 -164
  9. package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js.map +1 -1
  10. package/dist/components/data-display/infinite-table/constants.cjs.js +1 -1
  11. package/dist/components/data-display/infinite-table/constants.cjs.js.map +1 -1
  12. package/dist/components/data-display/infinite-table/constants.d.ts +8 -0
  13. package/dist/components/data-display/infinite-table/constants.es.js +24 -20
  14. package/dist/components/data-display/infinite-table/constants.es.js.map +1 -1
  15. package/dist/components/data-display/infinite-table/context.cjs.js +1 -1
  16. package/dist/components/data-display/infinite-table/context.cjs.js.map +1 -1
  17. package/dist/components/data-display/infinite-table/context.d.ts +5 -1
  18. package/dist/components/data-display/infinite-table/context.es.js +5 -2
  19. package/dist/components/data-display/infinite-table/context.es.js.map +1 -1
  20. package/dist/components/data-display/infinite-table/head/cell/index.cjs.js +1 -1
  21. package/dist/components/data-display/infinite-table/head/cell/index.cjs.js.map +1 -1
  22. package/dist/components/data-display/infinite-table/head/cell/index.es.js +39 -39
  23. package/dist/components/data-display/infinite-table/head/cell/index.es.js.map +1 -1
  24. package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
  25. package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
  26. package/dist/components/data-display/infinite-table/index.d.ts +1 -1
  27. package/dist/components/data-display/infinite-table/index.es.js +433 -418
  28. package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
  29. package/dist/components/data-display/infinite-table/types.d.ts +65 -0
  30. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
  31. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
  32. package/dist/components/forms/currency-input/CurrencyInputField.es.js +24 -24
  33. package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/providers/design-system-provider/types.d.ts +1 -0
  36. package/package.json +1 -1
@@ -1,235 +1,254 @@
1
- import { jsxs as $, jsx as t, Fragment as Fe } from "react/jsx-runtime";
2
- import { useTheme as Ke } from "../../../../../hooks/useTheme.es.js";
3
- import { formatDate as G, formatCurrency as ce } from "../../../../../utils/formatters.es.js";
4
- import { getTableRowBgClassNamesByStatus as je } from "../../../../../constants/table.es.js";
5
- import { useTableConfig as We } from "../../../../../providers/design-system-provider/hooks.es.js";
6
- import H from "../../../../tooltip/Tooltip.es.js";
7
- import { Typography as Ue } from "../../../typography/Typography.es.js";
8
- import { OpenInNewRounded as Ye } from "@mui/icons-material";
1
+ import { jsxs as $, jsx as r, Fragment as We } from "react/jsx-runtime";
2
+ import { useTheme as Ue } from "../../../../../hooks/useTheme.es.js";
3
+ import { formatDate as J, formatCurrency as fe } from "../../../../../utils/formatters.es.js";
4
+ import { getTableRowBgClassNamesByStatus as Ye } from "../../../../../constants/table.es.js";
5
+ import { useTableConfig as Be } from "../../../../../providers/design-system-provider/hooks.es.js";
6
+ import Q from "../../../../tooltip/Tooltip.es.js";
7
+ import { Typography as Ge } from "../../../typography/Typography.es.js";
8
+ import { OpenInNewRounded as He } from "@mui/icons-material";
9
9
  import x from "../../../../../_virtual/index.es.js";
10
- import C, { useContext as Be, useCallback as M, useState as S, useRef as X, useEffect as v } from "react";
11
- import { Link as Ge } from "react-router-dom";
12
- import { TableContext as He } from "../../context.es.js";
13
- import { InlineEditField as Xe } from "./InlineEditField.es.js";
14
- import { CELL_DEFAULT_RIGHT_OFFSET as qe, CELL_INDENT_PER_LEVEL_PX as q, CELL_STICKY_SHADOW_DARK as Je, CELL_STICKY_SHADOW_LIGHT as Qe } from "../../constants.es.js";
15
- import { LoadingSpinnerIcon as J, KeyboardArrowDownIcon as Ze, KeyboardArrowRightFilledIcon as Pe, LinkIcon as Ee } from "../../../../icon/icons.generated.es.js";
16
- let Q;
17
- const me = (e) => {
10
+ import g, { useContext as Xe, useCallback as C, useState as S, useRef as Z, useEffect as v } from "react";
11
+ import { Link as qe } from "react-router-dom";
12
+ import { TableContext as Je } from "../../context.es.js";
13
+ import { InlineEditField as Qe } from "./InlineEditField.es.js";
14
+ import { CELL_DEFAULT_RIGHT_OFFSET as Ze, CELL_INDENT_PER_LEVEL_PX as P, CELL_STICKY_SHADOW_DARK as Pe, CELL_STICKY_SHADOW_LIGHT as Ee } from "../../constants.es.js";
15
+ import { LoadingSpinnerIcon as E, KeyboardArrowDownIcon as eo, KeyboardArrowRightFilledIcon as oo, LinkIcon as to } from "../../../../icon/icons.generated.es.js";
16
+ let ee;
17
+ const pe = (e) => {
18
18
  const o = Number(e);
19
19
  if (Number.isNaN(o) || e === null || e === void 0)
20
20
  return "0ms";
21
21
  if (o >= 864e5) {
22
- const p = Math.floor(o / 864e5), d = Math.floor(o % 864e5 / 36e5), i = Math.floor(o % 36e5 / 6e4), h = Math.floor(o % 6e4 / 1e3);
23
- return `${p}d ${d}h ${i}m ${h}s`;
22
+ const l = Math.floor(o / 864e5), i = Math.floor(o % 864e5 / 36e5), u = Math.floor(o % 36e5 / 6e4), w = Math.floor(o % 6e4 / 1e3);
23
+ return `${l}d ${i}h ${u}m ${w}s`;
24
24
  }
25
25
  if (o >= 36e5) {
26
- const p = Math.floor(o / 36e5), d = Math.floor(o % 36e5 / 6e4), i = Math.floor(o % 6e4 / 1e3);
27
- return `${p}h ${d}m ${i}s`;
26
+ const l = Math.floor(o / 36e5), i = Math.floor(o % 36e5 / 6e4), u = Math.floor(o % 6e4 / 1e3);
27
+ return `${l}h ${i}m ${u}s`;
28
28
  }
29
29
  if (o >= 6e4) {
30
- const p = Math.floor(o / 6e4), d = Math.floor(o % 6e4 / 1e3);
31
- return `${p}m ${d}s`;
30
+ const l = Math.floor(o / 6e4), i = Math.floor(o % 6e4 / 1e3);
31
+ return `${l}m ${i}s`;
32
32
  }
33
33
  return o >= 1e3 ? `${(o / 1e3).toFixed(2)}s` : `${o}ms`;
34
- }, eo = ({ children: e, withLink: o, linkTo: p, rowData: d, disableRowClick: i }) => o && !i ? /* @__PURE__ */ t(Ge, { to: p?.(d?.id, d) || "", children: e }) : e, oo = ({
34
+ }, ro = (e, o, l) => {
35
+ const i = (V) => ["string", "number", "boolean"].includes(typeof V), u = i(e) ? e : o;
36
+ return i(u) ? String(u) : (l?.querySelector("[data-cell-content]") ?? l)?.innerText?.trim() || "";
37
+ }, ao = ({ children: e, withLink: o, linkTo: l, rowData: i, disableRowClick: u }) => o && !u ? /* @__PURE__ */ r(qe, { to: l?.(i?.id, i) || "", children: e }) : e, no = ({
35
38
  cell: e,
36
39
  id: o,
37
- nextWidthSum: p,
38
- isLastCell: d,
39
- rowHovering: i,
40
- index: h,
41
- isFirstStickyCell: de,
42
- handleCellClick: fe,
40
+ nextWidthSum: l,
41
+ isLastCell: i,
42
+ rowHovering: u,
43
+ index: w,
44
+ isFirstStickyCell: V,
45
+ handleCellClick: we,
43
46
  currentData: y,
44
47
  highlightSubstring: D,
45
- is_read: to,
46
- is_modified: Z,
47
- is_row_modified: P,
48
- is_deleted: R,
49
- is_added: I,
48
+ is_read: so,
49
+ is_modified: oe,
50
+ is_row_modified: te,
51
+ is_deleted: z,
52
+ is_added: F,
50
53
  level: b,
51
54
  inlineEditing: k,
52
- isInlineEditing: l,
55
+ isInlineEditing: m,
53
56
  setRowHovering: O,
54
- handleCellValueChange: pe,
55
- cellRef: we,
56
- handleUpdateCellData: he,
57
- registerValidation: ye,
58
- loadingExpand: be,
59
- toggleRowExpand: E,
60
- isDraggingOver: ve,
61
- isLoading: V,
62
- is_incomplete: ee,
63
- pendingEdit: a,
64
- hasPendingEdit: u,
65
- pendingValidationError: ke
57
+ handleCellValueChange: he,
58
+ cellRef: ye,
59
+ handleUpdateCellData: be,
60
+ registerValidation: ve,
61
+ loadingExpand: ke,
62
+ toggleRowExpand: re,
63
+ isDraggingOver: xe,
64
+ isLoading: I,
65
+ is_incomplete: ae,
66
+ pendingEdit: s,
67
+ hasPendingEdit: c,
68
+ pendingValidationError: Te
66
69
  }) => {
67
70
  const {
68
- cascadingTableConfig: oe,
69
- originalsOnly: xe,
70
- maxLevel: Te,
71
- showNewItem: ro,
72
- expandedRows: Ce,
73
- rowLinkConfig: z,
74
- multiSelectConfig: ge,
71
+ cascadingTableConfig: ne,
72
+ originalsOnly: Ce,
73
+ maxLevel: ge,
74
+ showNewItem: uo,
75
+ expandedRows: _e,
76
+ rowLinkConfig: K,
77
+ multiSelectConfig: Ne,
75
78
  cellEditing: A,
76
- cellEditingValue: F,
77
- allowInlineEdit: te,
78
- fieldOperationLoading: _e,
79
- pendingEdits: Ne,
80
- selectedRowId: K
81
- } = Be(He), Le = K != null && String(K) === String(o), $e = We(), j = (e?.column?.key ? e?.row?.original?.__cellMetadata?.[e.column.key] : void 0)?.is_locked ?? e?.column?.is_locked, W = (e?.column?.key ? Ne?.[o]?.[e.column.key]?.validationError : null) || ke || null, re = k === e.column.key && e?.column?.canEdit && !j && !e?.column?.is_disabled, Me = _e === `${o}-${e?.column?.id}`, { theme: Se } = Ke(), De = Se === "dark", Oe = M(() => O(o), [O, o]), Ve = M(() => O(null), [O]), g = $e?.formatDuration, [n, f] = S(
82
- e?.column?.dataType === "duration" && e?.value ? g ? g(e.value) : me(e.value) : e.value
83
- ), [w, ae] = S(null), [U, Re] = S(!1), [Ie, ne] = S(!1), [ze, se] = S(!1), _ = X(null), N = X(), L = X(), { selectedColumnIds: ie = [] } = ge || {}, ue = !Object.prototype.hasOwnProperty.call(e?.column?.meta ?? {}, "shouldHighlight") || e?.column?.meta?.shouldHighlight, le = M(() => {
84
- _.current && Re(_.current.scrollWidth > _.current.clientWidth);
85
- }, []), Y = M((r) => {
86
- N.current && clearTimeout(N.current), r ? ne(!0) : N.current = setTimeout(() => ne(!1), 200);
87
- }, []), B = M((r) => {
88
- L.current && clearTimeout(L.current), r ? se(!0) : L.current = setTimeout(() => se(!1), 200);
79
+ cellEditingValue: j,
80
+ allowInlineEdit: se,
81
+ fieldOperationLoading: Le,
82
+ pendingEdits: Me,
83
+ selectedRowId: W,
84
+ cellContextMenuConfig: U,
85
+ openCellContextMenu: Y
86
+ } = Xe(Je), $e = W != null && String(W) === String(o), Se = Be(), B = (e?.column?.key ? e?.row?.original?.__cellMetadata?.[e.column.key] : void 0)?.is_locked ?? e?.column?.is_locked, G = (e?.column?.key ? Me?.[o]?.[e.column.key]?.validationError : null) || Te || null, R = k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled, De = Le === `${o}-${e?.column?.id}`, { theme: Oe } = Ue(), Ie = Oe === "dark", Re = C(() => O(o), [O, o]), Ve = C(() => O(null), [O]), _ = Se?.formatDuration, [n, p] = S(
87
+ e?.column?.dataType === "duration" && e?.value ? _ ? _(e.value) : pe(e.value) : e.value
88
+ ), [h, ue] = S(null), [H, ze] = S(!1), [Fe, ie] = S(!1), [Ke, le] = S(!1), N = Z(null), L = Z(), M = Z(), { selectedColumnIds: ce = [] } = Ne || {}, me = !Object.prototype.hasOwnProperty.call(e?.column?.meta ?? {}, "shouldHighlight") || e?.column?.meta?.shouldHighlight, de = C(() => {
89
+ N.current && ze(N.current.scrollWidth > N.current.clientWidth);
90
+ }, []), X = C((t) => {
91
+ L.current && clearTimeout(L.current), t ? ie(!0) : L.current = setTimeout(() => ie(!1), 200);
92
+ }, []), q = C((t) => {
93
+ M.current && clearTimeout(M.current), t ? le(!0) : M.current = setTimeout(() => le(!1), 200);
89
94
  }, []), T = x({
90
- "bg-amber-100 dark:bg-amber-900/30": u,
91
- "bg-neutral-100 dark:bg-black-600": i === o && !l && !u && !(R || y?.is_deleted) && !(I || y?.is_added),
92
- "bg-error-200 dark:bg-error-900": i === o && !l && !u && (R || y?.is_deleted),
93
- "bg-success-100 dark:bg-success-800": i === o && !l && !u && (I || y?.is_added),
94
- "bg-warning-100 dark:bg-warning-950": i === o && !l && !u && (ee || Z || P || y?.is_row_modified),
95
+ "bg-amber-100 dark:bg-amber-900/30": c,
96
+ "bg-neutral-100 dark:bg-black-600": u === o && !m && !c && !(z || y?.is_deleted) && !(F || y?.is_added),
97
+ "bg-error-200 dark:bg-error-900": u === o && !m && !c && (z || y?.is_deleted),
98
+ "bg-success-100 dark:bg-success-800": u === o && !m && !c && (F || y?.is_added),
99
+ "bg-warning-100 dark:bg-warning-950": u === o && !m && !c && (ae || oe || te || y?.is_row_modified),
95
100
  // 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && !isLoading && rowHovering !== id && !isInlineEditing && !hasPendingEdit,
96
- "bg-warning-50 dark:bg-orange-900": (ee || Z || P || y?.is_row_modified) && !V && i !== o && !l && !u,
97
- "bg-error-100 dark:bg-error-975": (R || y?.is_deleted) && !V && i !== o && !l && !u,
98
- "bg-success-50 dark:bg-success-900": (I || y?.is_added) && !V && i !== o && !l && !u,
99
- "bg-primary-50 dark:bg-primary-900": (ve || l) && !u,
100
- "bg-primary-50 dark:bg-primary-800": ie?.includes(e.column.id) && !l && !u,
101
- "bg-primary-50 dark:bg-primary-700": Le && i !== o && !l && !u && !V,
102
- [je[e?.row?.original?.__rowBgStatus]]: e?.row?.original?.__rowBgStatus && !l && !u
103
- }), Ae = (r) => {
104
- e.column?.disableRowClick || fe(r);
105
- };
106
- v(() => (e?.row?.original?.status === "running" && e.column?.dataType === "duration" && (Q = setInterval(() => {
107
- const s = new Date(G(e?.row?.original?.created_at || e?.row?.original?.executed_on, { withTime: !0, format: "yyyy-MM-dd HH:mm:ss" })), m = Math.abs((/* @__PURE__ */ new Date()).getTime() - new Date(s).getTime());
108
- f(g ? g(m) : me(m));
101
+ "bg-warning-50 dark:bg-orange-900": (ae || oe || te || y?.is_row_modified) && !I && u !== o && !m && !c,
102
+ "bg-error-100 dark:bg-error-975": (z || y?.is_deleted) && !I && u !== o && !m && !c,
103
+ "bg-success-50 dark:bg-success-900": (F || y?.is_added) && !I && u !== o && !m && !c,
104
+ "bg-primary-50 dark:bg-primary-900": (xe || m) && !c,
105
+ "bg-primary-50 dark:bg-primary-800": ce?.includes(e.column.id) && !m && !c,
106
+ "bg-primary-50 dark:bg-primary-700": $e && u !== o && !m && !c && !I,
107
+ [Ye[e?.row?.original?.__rowBgStatus]]: e?.row?.original?.__rowBgStatus && !m && !c
108
+ }), Ae = (t) => {
109
+ e.column?.disableRowClick || we(t);
110
+ }, je = C((t) => {
111
+ if (U?.isEnabled === !1 || !Y || R) return;
112
+ const a = {
113
+ rowId: o,
114
+ rowData: e?.row?.original ?? {},
115
+ columnKey: e?.column?.key ?? "",
116
+ column: e.column,
117
+ value: e?.value,
118
+ text: ro(n, e?.value, t.currentTarget),
119
+ cell: e
120
+ };
121
+ U?.isDisabledForCell?.(a) || (t.preventDefault(), t.stopPropagation(), Y({ x: t.clientX, y: t.clientY, target: a }));
122
+ }, [U, Y, R, o, e, n]);
123
+ v(() => (e?.row?.original?.status === "running" && e.column?.dataType === "duration" && (ee = setInterval(() => {
124
+ const a = new Date(J(e?.row?.original?.created_at || e?.row?.original?.executed_on, { withTime: !0, format: "yyyy-MM-dd HH:mm:ss" })), f = Math.abs((/* @__PURE__ */ new Date()).getTime() - new Date(a).getTime());
125
+ p(_ ? _(f) : pe(f));
109
126
  }, 500)), () => {
110
- Q && clearInterval(Q);
111
- }), [n, e.value, e?.row?.original?.created_at, e?.row?.original?.executed_on, e?.row?.original?.status, e.column?.dataType, g]), v(() => {
112
- (e?.column?.tooltipCellKey || e?.column?.type?.toLowerCase() === "url") && (e?.column?.type?.toLowerCase() === "url" ? ae(e?.value) : ae(e?.row?.original?.[String(e?.column?.tooltipCellKey)]));
127
+ ee && clearInterval(ee);
128
+ }), [n, e.value, e?.row?.original?.created_at, e?.row?.original?.executed_on, e?.row?.original?.status, e.column?.dataType, _]), v(() => {
129
+ (e?.column?.tooltipCellKey || e?.column?.type?.toLowerCase() === "url") && (e?.column?.type?.toLowerCase() === "url" ? ue(e?.value) : ue(e?.row?.original?.[String(e?.column?.tooltipCellKey)]));
113
130
  }, [e?.column?.tooltipCellKey, e?.row?.original, e?.column?.type, e?.value]), v(() => {
114
131
  if (e?.column?.type?.toLowerCase() === "currency")
115
- if (a?.value !== void 0) {
116
- const r = e?.row?.original?.__rawData, s = e?.column?.Header, m = a?.meta?.currency_code || r?.[s]?.currency_code || "USD";
117
- f(ce(a.value, m));
132
+ if (s?.value !== void 0) {
133
+ const t = e?.row?.original?.__rawData, a = e?.column?.Header, f = s?.meta?.currency_code || t?.[a]?.currency_code || "USD";
134
+ p(fe(s.value, f));
118
135
  } else {
119
- const r = e?.row?.original?.__rawData, s = e?.column?.Header;
120
- f(ce(e?.value, r?.[s]?.currency_code || "USD"));
136
+ const t = e?.row?.original?.__rawData, a = e?.column?.Header;
137
+ p(fe(e?.value, t?.[a]?.currency_code || "USD"));
121
138
  }
122
- }, [e?.value, e?.column?.type, e?.column?.Header, e?.row?.original?.__rawData, a?.value, a?.meta?.currency_code]), v(() => {
123
- e?.column?.type?.toLowerCase() === "percentage" && (a?.value !== void 0 ? f(a.value?.toString() + "%" || "") : f(e?.value?.toString() + "%" || ""));
124
- }, [e?.value, e?.column?.type, a?.value]), v(() => {
125
- const r = e?.column?.type?.toLowerCase() || "";
126
- if (["date", "datetime"].includes(r))
127
- if (a?.value !== void 0) {
128
- const s = r === "datetime", m = G(a.value, { withTime: s, skipTimezone: !0 });
129
- f(m || a.value);
130
- } else f(e.value);
131
- }, [e?.value, e?.column?.type, a?.value]), v(() => {
132
- const r = e?.column?.type?.toLowerCase() || "";
133
- ["currency", "percentage", "duration", "boolean", "date", "datetime"].includes(r) || (a?.value !== void 0 ? f(a.value) : e?.column?.dataType !== "duration" && f(e.value));
134
- }, [e?.value, e?.column?.type, e?.column?.dataType, a?.value]), v(() => {
135
- if (e?.column?.type?.toLowerCase() === "boolean" && te) {
136
- const r = a?.value !== void 0 ? a.value : e?.value;
137
- f(r === !0 || r === "true" || r === "True" || r === "Yes" || r === 1 ? "Yes" : "No");
139
+ }, [e?.value, e?.column?.type, e?.column?.Header, e?.row?.original?.__rawData, s?.value, s?.meta?.currency_code]), v(() => {
140
+ e?.column?.type?.toLowerCase() === "percentage" && (s?.value !== void 0 ? p(s.value?.toString() + "%" || "") : p(e?.value?.toString() + "%" || ""));
141
+ }, [e?.value, e?.column?.type, s?.value]), v(() => {
142
+ const t = e?.column?.type?.toLowerCase() || "";
143
+ if (["date", "datetime"].includes(t))
144
+ if (s?.value !== void 0) {
145
+ const a = t === "datetime", f = J(s.value, { withTime: a, skipTimezone: !0 });
146
+ p(f || s.value);
147
+ } else p(e.value);
148
+ }, [e?.value, e?.column?.type, s?.value]), v(() => {
149
+ const t = e?.column?.type?.toLowerCase() || "";
150
+ ["currency", "percentage", "duration", "boolean", "date", "datetime"].includes(t) || (s?.value !== void 0 ? p(s.value) : e?.column?.dataType !== "duration" && p(e.value));
151
+ }, [e?.value, e?.column?.type, e?.column?.dataType, s?.value]), v(() => {
152
+ if (e?.column?.type?.toLowerCase() === "boolean" && se) {
153
+ const t = s?.value !== void 0 ? s.value : e?.value;
154
+ p(t === !0 || t === "true" || t === "True" || t === "Yes" || t === 1 ? "Yes" : "No");
138
155
  }
139
- }, [e?.value, e?.column?.type, te, a?.value]), v(() => () => {
140
- N.current && clearTimeout(N.current), L.current && clearTimeout(L.current);
156
+ }, [e?.value, e?.column?.type, se, s?.value]), v(() => () => {
157
+ L.current && clearTimeout(L.current), M.current && clearTimeout(M.current);
141
158
  }, []);
142
- const c = C.isValidElement(n);
159
+ const d = g.isValidElement(n);
143
160
  return /* @__PURE__ */ $(
144
161
  "td",
145
162
  {
146
163
  id: e.value,
147
164
  "data-column-key": e?.column?.key,
148
165
  ...e.getCellProps(),
149
- onClick: z?.isEnabled ? void 0 : Ae,
166
+ onClick: K?.isEnabled ? void 0 : Ae,
150
167
  className: x(
151
168
  "h-row",
152
169
  {
153
170
  "sticky left-0": e?.column?.sticky,
154
171
  relative: !e?.column?.sticky,
155
- "w-full": d,
172
+ "w-full": i,
156
173
  "overflow-visible": k === e.column.key,
157
174
  /** Chips/badges: avoid vertical clip from overflow-x-hidden + truncate (see isUiElementCell branch below) */
158
- "overflow-x-hidden overflow-y-visible": k !== e.column.key && c,
159
- "overflow-hidden": k !== e.column.key && !c
175
+ "overflow-x-hidden overflow-y-visible": k !== e.column.key && d,
176
+ "overflow-hidden": k !== e.column.key && !d
160
177
  },
161
- W && !re ? "outline outline-2 outline-error-500 -outline-offset-2 z-[5]" : "",
178
+ G && !R ? "outline outline-2 outline-error-500 -outline-offset-2 z-[5]" : "",
162
179
  `${T || "bg-white dark:bg-black-800"}`
163
180
  ),
164
- style: { minWidth: `${e.column.width}px`, maxWidth: `${e.column.width}px`, right: e?.column?.sticky ? `${p}px` : qe, paddingLeft: b > 0 && h === 0 ? `${b * q}px` : void 0 },
165
- onMouseEnter: Oe,
181
+ style: { minWidth: `${e.column.width}px`, maxWidth: `${e.column.width}px`, right: e?.column?.sticky ? `${l}px` : Ze, paddingLeft: b > 0 && w === 0 ? `${b * P}px` : void 0 },
182
+ onMouseEnter: Re,
166
183
  onMouseLeave: Ve,
184
+ onContextMenu: je,
167
185
  children: [
168
- /* @__PURE__ */ t(eo, { withLink: z?.isEnabled, linkTo: z?.linkTo || void 0, rowData: e?.row?.original, disableRowClick: e?.column?.disableRowClick, children: (Array.isArray(A) ? A.includes(`${o}-${e?.column?.id}`) : A === `${o}-${e?.column?.id}`) ? /* @__PURE__ */ $("div", { className: "h-row top-0 font-medium font-inter w-full absolute flex items-center px-4", children: [
169
- /* @__PURE__ */ t("span", { className: "text-neutral-400 dark:text-black-400 truncate", children: (() => {
170
- const r = `${o}-${e?.column?.id}`, s = typeof F == "object" ? F?.[r] : F, m = e?.column?.type?.toLowerCase();
171
- return m === "boolean" ? s === !0 || s === "true" || s === "True" ? "Yes" : "No" : (m === "date" || m === "datetime") && s ? G(s, { withTime: m === "datetime", skipTimezone: !0 }) || String(s) : s != null ? String(s) : n;
186
+ /* @__PURE__ */ r(ao, { withLink: K?.isEnabled, linkTo: K?.linkTo || void 0, rowData: e?.row?.original, disableRowClick: e?.column?.disableRowClick, children: (Array.isArray(A) ? A.includes(`${o}-${e?.column?.id}`) : A === `${o}-${e?.column?.id}`) ? /* @__PURE__ */ $("div", { className: "h-row top-0 font-medium font-inter w-full absolute flex items-center px-4", children: [
187
+ /* @__PURE__ */ r("span", { className: "text-neutral-400 dark:text-black-400 truncate", children: (() => {
188
+ const t = `${o}-${e?.column?.id}`, a = typeof j == "object" ? j?.[t] : j, f = e?.column?.type?.toLowerCase();
189
+ return f === "boolean" ? a === !0 || a === "true" || a === "True" ? "Yes" : "No" : (f === "date" || f === "datetime") && a ? J(a, { withTime: f === "datetime", skipTimezone: !0 }) || String(a) : a != null ? String(a) : n;
172
190
  })() }),
173
- /* @__PURE__ */ t("div", { className: "ml-2 flex items-center gap-1.5", children: /* @__PURE__ */ t(J, { className: "spinner text-neutral-600 dark:text-white", size: 12 }) })
174
- ] }) : k === e.column.key && e?.column?.canEdit && !j && !e?.column?.is_disabled ? /* @__PURE__ */ t("div", { className: "h-row w-full absolute top-0 left-0 flex items-center", style: { marginLeft: b > 0 && h === 0 ? `-${b * q}px` : void 0, width: b > 0 && h === 0 ? `calc(100% + ${b * q}px)` : "100%" }, children: /* @__PURE__ */ t(Xe, { cell: e, id: o, inlineEditing: k, cellRef: we, handleCellValueChange: pe, handleUpdateCellData: he, registerValidation: ye }) }) : /* @__PURE__ */ $(Fe, { children: [
175
- b > 0 && h === 0 && /* @__PURE__ */ t("div", { className: "h-row border-l border-neutral-300 dark:border-black-600 ml-2" }),
176
- /* @__PURE__ */ t("div", { className: "min-h-6", children: /* @__PURE__ */ t(
177
- H,
191
+ /* @__PURE__ */ r("div", { className: "ml-2 flex items-center gap-1.5", children: /* @__PURE__ */ r(E, { className: "spinner text-neutral-600 dark:text-white", size: 12 }) })
192
+ ] }) : k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled ? /* @__PURE__ */ r("div", { className: "h-row w-full absolute top-0 left-0 flex items-center", style: { marginLeft: b > 0 && w === 0 ? `-${b * P}px` : void 0, width: b > 0 && w === 0 ? `calc(100% + ${b * P}px)` : "100%" }, children: /* @__PURE__ */ r(Qe, { cell: e, id: o, inlineEditing: k, cellRef: ye, handleCellValueChange: he, handleUpdateCellData: be, registerValidation: ve }) }) : /* @__PURE__ */ $(We, { children: [
193
+ b > 0 && w === 0 && /* @__PURE__ */ r("div", { className: "h-row border-l border-neutral-300 dark:border-black-600 ml-2" }),
194
+ /* @__PURE__ */ r("div", { className: "min-h-6", children: /* @__PURE__ */ r(
195
+ Q,
178
196
  {
179
- title: w && e?.column?.type?.toLowerCase() !== "url" ? w : void 0,
180
- hideTooltip: !w || e?.column?.type?.toLowerCase() === "url",
197
+ title: h && e?.column?.type?.toLowerCase() !== "url" ? h : void 0,
198
+ hideTooltip: !h || e?.column?.type?.toLowerCase() === "url",
181
199
  delayShow: !0,
182
200
  placement: "top",
183
201
  children: /* @__PURE__ */ $(
184
202
  "div",
185
203
  {
186
- className: x(`h-row top-0 font-medium font-inter overflow-index-auto whitespace-nowrap text-ellipsis dark:text-black-200 w-full absolute flex items-center ${T || "bg-white dark:bg-black-800"}`, c ? "overflow-x-hidden overflow-y-visible" : "overflow-x-hidden", { "border border-b-0 border-t-0 border-primary-600 dark:border-blue-800": ie?.includes(e.column.id) }),
187
- style: e?.column?.sticky && de ? { boxShadow: De ? Je : Qe } : {},
204
+ className: x(`h-row top-0 font-medium font-inter overflow-index-auto whitespace-nowrap text-ellipsis dark:text-black-200 w-full absolute flex items-center ${T || "bg-white dark:bg-black-800"}`, d ? "overflow-x-hidden overflow-y-visible" : "overflow-x-hidden", { "border border-b-0 border-t-0 border-primary-600 dark:border-blue-800": ce?.includes(e.column.id) }),
205
+ style: e?.column?.sticky && V ? { boxShadow: Ie ? Pe : Ee } : {},
188
206
  children: [
189
- oe?.isCascading && !xe && h === 0 && /* @__PURE__ */ t("div", { className: x("w-[22px] h-row flex items-center px-4", `${T || "bg-white dark:bg-black-800"}`), id: "cascading", children: Te > b && (e?.row?.original?.__has_children || oe?.showAllDropdown) && /* @__PURE__ */ t("div", { children: be ? /* @__PURE__ */ t(J, { className: "text-neutral-600 dark:text-white", size: 8 }) : /* @__PURE__ */ t("div", { children: Ce?.[o]?.isOpen ? /* @__PURE__ */ t(Ze, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (r) => {
190
- E(), r.stopPropagation();
191
- } }) : /* @__PURE__ */ t(Pe, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (r) => {
192
- E(), r.stopPropagation();
207
+ ne?.isCascading && !Ce && w === 0 && /* @__PURE__ */ r("div", { className: x("w-[22px] h-row flex items-center px-4", `${T || "bg-white dark:bg-black-800"}`), id: "cascading", children: ge > b && (e?.row?.original?.__has_children || ne?.showAllDropdown) && /* @__PURE__ */ r("div", { children: ke ? /* @__PURE__ */ r(E, { className: "text-neutral-600 dark:text-white", size: 8 }) : /* @__PURE__ */ r("div", { children: _e?.[o]?.isOpen ? /* @__PURE__ */ r(eo, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (t) => {
208
+ re(), t.stopPropagation();
209
+ } }) : /* @__PURE__ */ r(oo, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (t) => {
210
+ re(), t.stopPropagation();
193
211
  } }) }) }) }),
194
- e?.column?.type?.toLowerCase() === "url" && w ? /* @__PURE__ */ t(
195
- H,
212
+ e?.column?.type?.toLowerCase() === "url" && h ? /* @__PURE__ */ r(
213
+ Q,
196
214
  {
197
- title: /* @__PURE__ */ t("div", { onMouseEnter: () => Y(!0), onMouseLeave: () => Y(!1), children: /* @__PURE__ */ t("a", { href: w, target: "_blank", rel: "noopener noreferrer", onClick: (r) => r.stopPropagation(), children: /* @__PURE__ */ $("div", { className: "flex gap-1 items-center w-full", children: [
198
- /* @__PURE__ */ t("div", { className: "w-4 h-4", children: /* @__PURE__ */ t(Ee, { height: 16, width: 16 }) }),
199
- /* @__PURE__ */ t(Ue, { variant: "medium", size: "small", className: "truncate", appearance: "custom", children: w }),
200
- /* @__PURE__ */ t(Ye, { sx: { height: "16px", width: "16px", color: "#016DCF" } })
215
+ title: /* @__PURE__ */ r("div", { onMouseEnter: () => X(!0), onMouseLeave: () => X(!1), children: /* @__PURE__ */ r("a", { href: h, target: "_blank", rel: "noopener noreferrer", onClick: (t) => t.stopPropagation(), children: /* @__PURE__ */ $("div", { className: "flex gap-1 items-center w-full", children: [
216
+ /* @__PURE__ */ r("div", { className: "w-4 h-4", children: /* @__PURE__ */ r(to, { height: 16, width: 16 }) }),
217
+ /* @__PURE__ */ r(Ge, { variant: "medium", size: "small", className: "truncate", appearance: "custom", children: h }),
218
+ /* @__PURE__ */ r(He, { sx: { height: "16px", width: "16px", color: "#016DCF" } })
201
219
  ] }) }) }),
202
220
  placement: "top",
203
- open: Ie,
204
- onOpenChange: Y,
221
+ open: Fe,
222
+ onOpenChange: X,
205
223
  className: "block w-full min-w-0 overflow-hidden",
206
- children: /* @__PURE__ */ t("div", { className: "w-full h-row flex items-center px-4 min-w-0 overflow-hidden text-primary-400", children: /* @__PURE__ */ t("span", { ref: _, onMouseEnter: le, className: "truncate w-full", children: D && ue && !C.isValidElement(n) && typeof n != "object" ? D(n) : n }) })
224
+ children: /* @__PURE__ */ r("div", { className: "w-full h-row flex items-center px-4 min-w-0 overflow-hidden text-primary-400", children: /* @__PURE__ */ r("span", { ref: N, "data-cell-content": !0, onMouseEnter: de, className: "truncate w-full", children: D && me && !g.isValidElement(n) && typeof n != "object" ? D(n) : n }) })
207
225
  }
208
- ) : /* @__PURE__ */ t(
209
- H,
226
+ ) : /* @__PURE__ */ r(
227
+ Q,
210
228
  {
211
- title: U && n && !c ? /* @__PURE__ */ t(
229
+ title: H && n && !d ? /* @__PURE__ */ r(
212
230
  "div",
213
231
  {
214
- onMouseEnter: () => B(!0),
215
- onMouseLeave: () => B(!1),
232
+ onMouseEnter: () => q(!0),
233
+ onMouseLeave: () => q(!1),
216
234
  className: "max-h-96 overflow-y-auto whitespace-pre-wrap break-words no-scroll",
217
235
  children: String(n)
218
236
  }
219
237
  ) : void 0,
220
238
  placement: "top",
221
239
  delayShow: !0,
222
- hideTooltip: !!w,
223
- open: U && !w && !c ? ze : void 0,
224
- onOpenChange: U && !w && !c ? B : void 0,
225
- className: x("block w-full min-w-0", c ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"),
226
- children: /* @__PURE__ */ t("div", { className: x("w-full h-row flex items-center px-4 min-w-0", c ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"), children: /* @__PURE__ */ t(
240
+ hideTooltip: !!h,
241
+ open: H && !h && !d ? Ke : void 0,
242
+ onOpenChange: H && !h && !d ? q : void 0,
243
+ className: x("block w-full min-w-0", d ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"),
244
+ children: /* @__PURE__ */ r("div", { className: x("w-full h-row flex items-center px-4 min-w-0", d ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"), children: /* @__PURE__ */ r(
227
245
  "span",
228
246
  {
229
- ref: c ? void 0 : _,
230
- onMouseEnter: c ? void 0 : le,
231
- className: x(c ? "flex min-w-0 max-w-full items-center justify-start gap-1" : "truncate w-full"),
232
- children: D && ue && !C.isValidElement(n) && typeof n != "object" ? D(n) : C.isValidElement(n) ? typeof n.type == "string" ? n : C.cloneElement(n, {
247
+ ref: d ? void 0 : N,
248
+ "data-cell-content": !0,
249
+ onMouseEnter: d ? void 0 : de,
250
+ className: x(d ? "flex min-w-0 max-w-full items-center justify-start gap-1" : "truncate w-full"),
251
+ children: D && me && !g.isValidElement(n) && typeof n != "object" ? D(n) : g.isValidElement(n) ? typeof n.type == "string" ? n : g.cloneElement(n, {
233
252
  ...n.props,
234
253
  containerWidth: e.column.width
235
254
  }) : n
@@ -243,14 +262,14 @@ const me = (e) => {
243
262
  }
244
263
  ) })
245
264
  ] }) }),
246
- W && !re && /* @__PURE__ */ t("div", { className: "absolute bottom-0 left-0 right-0 h-row flex items-end pointer-events-none z-[5]", children: /* @__PURE__ */ t("div", { className: "w-full bg-error-50 dark:bg-error-975 px-1.5 py-0.5 truncate", children: /* @__PURE__ */ t("span", { className: "text-error-600 text-2xs font-medium leading-none", children: W }) }) }),
247
- Me && !(k === e.column.key && e?.column?.canEdit && !j && !e?.column?.is_disabled) && /* @__PURE__ */ t("div", { className: "absolute top-0 right-0 bg-white dark:bg-black-800 rounded-full w-5 h-5 flex items-center justify-center border border-primary-300 dark:border-primary-600 shadow-sm z-10", children: /* @__PURE__ */ t(J, { className: "text-primary-600 dark:text-white", size: 8 }) })
265
+ G && !R && /* @__PURE__ */ r("div", { className: "absolute bottom-0 left-0 right-0 h-row flex items-end pointer-events-none z-[5]", children: /* @__PURE__ */ r("div", { className: "w-full bg-error-50 dark:bg-error-975 px-1.5 py-0.5 truncate", children: /* @__PURE__ */ r("span", { className: "text-error-600 text-2xs font-medium leading-none", children: G }) }) }),
266
+ De && !(k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled) && /* @__PURE__ */ r("div", { className: "absolute top-0 right-0 bg-white dark:bg-black-800 rounded-full w-5 h-5 flex items-center justify-center border border-primary-300 dark:border-primary-600 shadow-sm z-10", children: /* @__PURE__ */ r(E, { className: "text-primary-600 dark:text-white", size: 8 }) })
248
267
  ]
249
268
  },
250
- h
269
+ w
251
270
  );
252
- }, To = C.memo(oo);
271
+ }, No = g.memo(no);
253
272
  export {
254
- To as DataCell
273
+ No as DataCell
255
274
  };
256
275
  //# sourceMappingURL=DataCell.es.js.map