@dmsi/wedgekit-react 3.0.1 → 3.1.0

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
3
- import m, { useState as v, useLayoutEffect as k } from "react";
4
- import { clsx as c } from "../node_modules/clsx/dist/clsx.js";
2
+ import { jsx as t, jsxs as d } from "react/jsx-runtime";
3
+ import m, { useState as g, useLayoutEffect as k } from "react";
4
+ import { clsx as l } from "../node_modules/clsx/dist/clsx.js";
5
5
  import { Link as x } from "./Link.js";
6
6
  import { Icon as b } from "./Icon.js";
7
7
  function y({
@@ -9,23 +9,23 @@ function y({
9
9
  children: o,
10
10
  onClick: r,
11
11
  id: n,
12
- testid: t
12
+ testid: e
13
13
  }) {
14
- const i = c(
14
+ const i = l(
15
15
  "!text-text-link-normal whitespace-nowrap",
16
16
  "py-mobile-component-padding",
17
17
  "desktop:py-desktop-layout-group-padding",
18
18
  "compact:py-desktop-compact-component-padding"
19
19
  );
20
- return /* @__PURE__ */ e("li", { id: n, "data-testid": t, className: "flex items-center", children: /* @__PURE__ */ e(
20
+ return /* @__PURE__ */ t("li", { id: n, "data-testid": e, className: "flex items-center", children: /* @__PURE__ */ t(
21
21
  x,
22
22
  {
23
23
  id: n ? `${n}-link` : void 0,
24
- "data-testid": t ? `${t}-link` : void 0,
25
- className: c(
24
+ "data-testid": e ? `${e}-link` : void 0,
25
+ className: l(
26
26
  i,
27
27
  "!text-caption-desktop",
28
- "!decoration-transparent"
28
+ "!decoration-transparent hover:!decoration-current"
29
29
  ),
30
30
  href: a,
31
31
  typographyStyle: "caption",
@@ -34,23 +34,23 @@ function y({
34
34
  }
35
35
  ) }, a);
36
36
  }
37
- const w = () => /* @__PURE__ */ e("li", { className: "flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ e(b, { name: "chevron_right", size: 16 }) });
37
+ const w = () => /* @__PURE__ */ t("li", { className: "flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ t(b, { name: "chevron_right", size: 16 }) });
38
38
  function O({
39
39
  asCardStyle: a,
40
40
  id: o,
41
41
  testid: r,
42
42
  crumbs: n
43
43
  }) {
44
- const t = m.useRef(null), [i, u] = v(!1);
44
+ const e = m.useRef(null), [i, u] = g(!1);
45
45
  k(() => {
46
- t.current?.scrollTo({
47
- left: t.current?.scrollWidth ?? 0,
46
+ e.current?.scrollTo({
47
+ left: e.current?.scrollWidth ?? 0,
48
48
  behavior: "instant"
49
49
  }), p();
50
- }, [t, n]);
50
+ }, [e, n]);
51
51
  const p = () => {
52
- t.current && u(
53
- t.current.scrollWidth !== t.current.clientWidth && t.current.scrollLeft > 0
52
+ e.current && u(
53
+ e.current.scrollWidth !== e.current.clientWidth && e.current.scrollLeft > 0
54
54
  );
55
55
  };
56
56
  return /* @__PURE__ */ d(
@@ -58,7 +58,7 @@ function O({
58
58
  {
59
59
  id: o,
60
60
  "data-testid": r,
61
- className: c(
61
+ className: l(
62
62
  "relative select-none flex items-center max-w-full w-full",
63
63
  {
64
64
  "bg-white rounded-base shadow-4 px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding": a,
@@ -67,16 +67,16 @@ function O({
67
67
  ),
68
68
  "aria-label": "Breadcrumb",
69
69
  children: [
70
- /* @__PURE__ */ e(
70
+ /* @__PURE__ */ t(
71
71
  "div",
72
72
  {
73
- className: c(
73
+ className: l(
74
74
  i ? "opacity-100" : "opacity-0",
75
75
  "absolute left-6 top-0 h-full w-12 bg-gradient-to-r from-white to-transparent pointer-events-none z-10 transition"
76
76
  )
77
77
  }
78
78
  ),
79
- /* @__PURE__ */ e(
79
+ /* @__PURE__ */ t(
80
80
  "ol",
81
81
  {
82
82
  id: o ? `${o}-list` : void 0,
@@ -85,23 +85,23 @@ function O({
85
85
  style: { scrollbarWidth: "none" },
86
86
  onScroll: p,
87
87
  ref: (s) => {
88
- t.current = s;
88
+ e.current = s;
89
89
  },
90
- children: n.map((s, l) => {
91
- const { href: f, children: h, onClick: g } = s;
90
+ children: n.map((s, c) => {
91
+ const { href: f, children: h, onClick: v } = s;
92
92
  return /* @__PURE__ */ d(m.Fragment, { children: [
93
- l > 0 && /* @__PURE__ */ e(w, {}),
94
- /* @__PURE__ */ e(
93
+ c > 0 && /* @__PURE__ */ t(w, {}),
94
+ /* @__PURE__ */ t(
95
95
  y,
96
96
  {
97
97
  href: f,
98
- onClick: g,
99
- id: o ? `${o}-crumb-${l}` : void 0,
100
- testid: r ? `${r}-crumb-${l}` : void 0,
98
+ onClick: v,
99
+ id: o ? `${o}-crumb-${c}` : void 0,
100
+ testid: r ? `${r}-crumb-${c}` : void 0,
101
101
  children: h
102
102
  }
103
103
  )
104
- ] }, l);
104
+ ] }, c);
105
105
  })
106
106
  }
107
107
  )
@@ -1 +1 @@
1
- {"version":3,"file":"TableBodyRow.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGrid/TableBody/TableBodyRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAwCnE,UAAU,iBAAiB,CAAC,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,WAAW,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC;IACtE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,cAAc,EAAE,WAAW,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;IACjE,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OA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,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,EAAE,EACF,MAAM,EACN,iBAAiB,EACjB,GAAG,EAEH,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,aAAa,EAEb,MAAM,EACN,YAAY,EACZ,kBAA0B,EAC1B,QAAQ,EACR,YAAY,EACZ,eAAe,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CA0JtB"}
@@ -1,9 +1,9 @@
1
- import { jsxs as z, jsx as l } from "react/jsx-runtime";
1
+ import { jsxs as k, jsx as l } from "react/jsx-runtime";
2
2
  import { clsx as y } from "../../../node_modules/clsx/dist/clsx.js";
3
- import { DataGridCell as A, DragAlongCell as E } from "../../DataGridCell.js";
4
- import { Paragraph as F } from "../../Paragraph.js";
5
- import { Tooltip as K } from "../../Tooltip.js";
6
- import { formatDate as T } from "../../../utils/date.js";
3
+ import { DataGridCell as A, DragAlongCell as E, GridColumnSizeContext as F } from "../../DataGridCell.js";
4
+ import { Paragraph as K } from "../../Paragraph.js";
5
+ import { Tooltip as T } from "../../Tooltip.js";
6
+ import { formatDate as G } from "../../../utils/date.js";
7
7
  import { formatCurrencyDisplay as I } from "../../../utils/formatting.js";
8
8
  import { handleRowArrowKeyDown as M } from "../utils.js";
9
9
  function h({
@@ -13,13 +13,13 @@ function h({
13
13
  return n == null ? null : typeof n == "function" ? n(o.getContext()) : n;
14
14
  }
15
15
  const b = {
16
- date: (o) => typeof o == "string" ? T(o) : "",
16
+ date: (o) => typeof o == "string" ? G(o) : "",
17
17
  currency: (o) => I(o)
18
18
  };
19
19
  function N(o) {
20
20
  return typeof o == "string" && o in b;
21
21
  }
22
- function J({
22
+ function P({
23
23
  id: o,
24
24
  testid: n,
25
25
  columnVirtualizer: x,
@@ -31,25 +31,25 @@ function J({
31
31
  showFilterRow: C,
32
32
  // enableColumnSelector = false,
33
33
  locked: r,
34
- pinDirection: D,
35
- groupSelectionMode: v = "row",
34
+ pinDirection: v,
35
+ groupSelectionMode: D = "row",
36
36
  disabled: i,
37
- hoveredRowId: V,
37
+ hoveredRowId: S,
38
38
  setHoveredRowId: g
39
39
  }) {
40
40
  let c;
41
- r ? c = D === "left" ? t.getLeftVisibleCells() : t.getRightVisibleCells() : c = t.getCenterVisibleCells();
42
- const S = x?.getVirtualItems() ?? [], j = r ? c : S, w = typeof t.original == "object" && t.original !== null && "rowState" in t.original && t.original.rowState === "error", m = r ? A : E, k = V === t.id;
43
- return /* @__PURE__ */ z(
41
+ r ? c = v === "left" ? t.getLeftVisibleCells() : t.getRightVisibleCells() : c = t.getCenterVisibleCells();
42
+ const V = x?.getVirtualItems() ?? [], j = r ? c : V, z = typeof t.original == "object" && t.original !== null && "rowState" in t.original && t.original.rowState === "error", m = r ? A : E, w = S === t.id;
43
+ return /* @__PURE__ */ k(
44
44
  "tr",
45
45
  {
46
46
  className: y(
47
47
  "min-h-10",
48
48
  "transition-colors",
49
49
  !i && (a.index % 2 === 0 ? "bg-background-grouped-primary-normal" : "bg-background-grouped-secondary-normal"),
50
- !i && k && "!bg-background-action-secondary-hover",
50
+ !i && w && "!bg-background-action-secondary-hover",
51
51
  t.getIsSelected() && !i && "!bg-background-action-secondary-hover",
52
- w && !i && "!bg-background-action-critical-secondary-hover"
52
+ z && !i && "!bg-background-action-critical-secondary-hover"
53
53
  ),
54
54
  onMouseEnter: () => g?.(t.id),
55
55
  onMouseLeave: () => g?.(null),
@@ -73,7 +73,7 @@ function J({
73
73
  const e = r ? p : c[p.index];
74
74
  if (!e)
75
75
  return;
76
- if (e.column.columnDef.meta?.checkbox && v === "group")
76
+ if (e.column.columnDef.meta?.checkbox && D === "group")
77
77
  return /* @__PURE__ */ l(
78
78
  m,
79
79
  {
@@ -84,7 +84,7 @@ function J({
84
84
  },
85
85
  e.id
86
86
  );
87
- const s = e.column.columnDef.meta?.format, u = s && N(s) ? b[s](e.getValue()) : e.getValue(), $ = e.column.columnDef.meta?.align ?? (typeof u == "number" ? "right" : "left");
87
+ const u = e.column.columnDef.meta?.format, s = u && N(u) ? b[u](e.getValue()) : e.getValue(), $ = e.column.columnDef.meta?.align ?? (typeof s == "number" ? "right" : "left");
88
88
  return e.column.columnDef.meta?.useCustomRenderer && e.column.columnDef.meta?.checkbox ? /* @__PURE__ */ l(
89
89
  m,
90
90
  {
@@ -96,7 +96,14 @@ function J({
96
96
  children: /* @__PURE__ */ l(h, { cell: e })
97
97
  },
98
98
  e.id
99
- ) : e.column.columnDef.meta?.useCustomRenderer ? /* @__PURE__ */ l(h, { cell: e }, e.id) : /* @__PURE__ */ l(
99
+ ) : e.column.columnDef.meta?.useCustomRenderer ? /* @__PURE__ */ l(
100
+ F.Provider,
101
+ {
102
+ value: e.column.getSize(),
103
+ children: /* @__PURE__ */ l(h, { cell: e })
104
+ },
105
+ e.id
106
+ ) : /* @__PURE__ */ l(
100
107
  m,
101
108
  {
102
109
  id: o ? `${o}-row-${t.id}-cell-${e.id}` : void 0,
@@ -108,14 +115,14 @@ function J({
108
115
  "justify-end": $ === "right"
109
116
  }),
110
117
  children: /* @__PURE__ */ l(
111
- K,
118
+ T,
112
119
  {
113
120
  id: o ? `${o}-tooltip-${e.id}` : void 0,
114
121
  testid: n ? `${n}-tooltip-${e.id}` : void 0,
115
122
  showOnTruncation: !0,
116
- message: u,
123
+ message: s,
117
124
  position: "bottom",
118
- children: /* @__PURE__ */ l(F, { addOverflow: !0, tall: !0, children: u })
125
+ children: /* @__PURE__ */ l(K, { addOverflow: !0, tall: !0, children: s })
119
126
  }
120
127
  )
121
128
  },
@@ -132,5 +139,5 @@ function J({
132
139
  );
133
140
  }
134
141
  export {
135
- J as TableBodyRow
142
+ P as TableBodyRow
136
143
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DataGrid/index.tsx"],"names":[],"mappings":"AAsDA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgBxC,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC1D,EAAE,EACF,aAAa,EACb,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAM,EACN,aAAqB,EACrB,UAAU,EACV,UAAU,EACV,aAAqB,EACrB,OAAe,EACf,OAAO,EAAE,eAAe,EACxB,eAAe,EACf,aAAa,EAAE,qBAAqB,EACpC,qBAAqB,EACrB,YAAY,EAAE,oBAAoB,EAClC,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,qBAA0B,EAC1B,sBAA2B,EAC3B,sBAAsB,EACtB,WAAW,EACX,mBAAmB,EACnB,SAAiB,EACjB,cAAkC,EAClC,kBAAkB,EAClB,SAAS,EACT,UAAkB,EAClB,eAAuB,EACvB,aAAa,EACb,UAAU,EACV,OAAO,EACP,YAAyB,EACzB,kBAA2B,EAC3B,iBAAiB,EACjB,kBAA0B,EAC1B,kBAAkB,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,gBAAgB,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,gBAAgB,EAChB,GAAG,GACJ,EAAE,aAAa,CAAC,CAAC,CAAC,2CAw+BlB;AAeD,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":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