@pibit.ai/cure-design-system 0.3.15 → 0.3.17

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,159 +1,81 @@
1
- import { jsx as r, jsxs as N, Fragment as E } from "react/jsx-runtime";
2
- import { forwardRef as C, useState as k, useRef as v, useEffect as O } from "react";
3
- import { createPortal as R } from "react-dom";
4
- import { TableCard as $, Table as c } from "./table.js";
5
- import { cx as g } from "../../utils/cn.js";
6
- const A = C(
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { forwardRef as O } from "react";
3
+ import { TableCard as T, Table as a } from "./table.js";
4
+ import { cx as j } from "../../utils/cn.js";
5
+ const B = O(
7
6
  function({
8
- data: h,
9
- columns: n,
10
- renderRowCell: t,
11
- onRowClick: a,
12
- arialabel: x,
13
- size: l = "sm",
14
- allowDefaultRowClass: w = !1,
15
- centeredHeaders: o = [],
16
- rootClassName: u,
17
- removeBorders: p,
18
- headerClassName: m,
7
+ data: x,
8
+ columns: i,
9
+ renderRowCell: f,
10
+ onRowClick: s,
11
+ arialabel: p,
12
+ size: h = "sm",
13
+ allowDefaultRowClass: W = !1,
14
+ centeredHeaders: k = [],
15
+ rootClassName: n,
16
+ removeBorders: b,
17
+ headerClassName: c,
19
18
  isRowExpandable: y,
20
- renderExpandedContent: d
21
- }, b) {
22
- return /* @__PURE__ */ r(
23
- $.Root,
24
- {
25
- ref: b,
26
- className: g("overflow-x-auto", u),
27
- size: l,
28
- children: /* @__PURE__ */ N(c, { "aria-label": x, size: l, children: [
29
- /* @__PURE__ */ r(c.Header, { className: g("sticky top-0", m), children: n.map((e, f) => /* @__PURE__ */ r(
30
- c.Head,
31
- {
32
- sticky: e.sticky,
33
- stickyOffset: e.stickyOffset,
34
- id: e.key,
35
- label: e.label,
36
- isRowHeader: !0,
37
- allowsSorting: e.allowsSorting,
38
- headerCellClass: o.includes(e.key) ? "justify-center" : "",
39
- style: {
40
- maxWidth: e.maxWidth,
41
- minWidth: e.maxWidth,
42
- width: e.maxWidth
43
- },
44
- className: "overflow-hidde"
45
- },
46
- f
47
- )) }),
48
- /* @__PURE__ */ r(c.Body, { items: h, children: (e) => {
49
- const f = y ? y(e) : !1, W = e.id || e.rule_id || String(e);
50
- return /* @__PURE__ */ r(
51
- c.Row,
52
- {
53
- onAction: () => a == null ? void 0 : a(e),
54
- id: W,
55
- isExpandable: f,
56
- renderExpandedContent: f ? d : void 0,
57
- columns: n,
58
- className: g(
59
- a && "cursor-pointer",
60
- w ? "prose" : "",
61
- p && "[&>td]:after:hidden"
62
- // Remove row borders
63
- ),
64
- children: n.map((i, T) => /* @__PURE__ */ r(
65
- c.Cell,
66
- {
67
- sticky: i.sticky,
68
- stickyOffset: i.stickyOffset,
69
- style: {
70
- maxWidth: i.maxWidth,
71
- minWidth: i.maxWidth,
72
- width: i.maxWidth
73
- },
74
- className: "overflow-x-hidden text-left",
75
- children: T === 0 && f ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: t(i.key, e[i.key], e) }) : t(i.key, e[i.key], e)
76
- },
77
- i.key
78
- ))
79
- },
80
- W
81
- );
82
- } })
83
- ] })
84
- }
85
- );
86
- }
87
- ), j = ({
88
- content: s,
89
- className: h = "",
90
- link: n = !1,
91
- tooltipPosition: t = "center",
92
- tooltipSide: a = "above",
93
- textClassName: x = ""
94
- }) => {
95
- const [l, w] = k(!1), [o, u] = k({ top: 0, left: 0, right: 0 }), p = v(null), m = v(null);
96
- return O(() => {
97
- var y;
98
- if (l && p.current) {
99
- const d = p.current.getBoundingClientRect(), b = 8, e = typeof window < "u" ? window.innerWidth : document.documentElement.clientWidth, f = (y = m.current) == null ? void 0 : y.getBoundingClientRect(), W = t === "end" && f ? Math.min(d.right, f.right) : d.right;
100
- u({
101
- top: a === "below" ? d.bottom + b : d.top - b,
102
- left: t === "start" ? d.left : t === "center" ? d.left + d.width / 2 : 0,
103
- // `right` is offset from the viewport's right edge; rects are viewport-relative.
104
- right: t === "end" ? e - W : 0
105
- });
106
- }
107
- }, [l, t, a]), /* @__PURE__ */ N(E, { children: [
108
- /* @__PURE__ */ r(
109
- "span",
110
- {
111
- ref: p,
112
- className: g(
113
- "whitespace-nowrap overflow-hidden text-ellipsis w-full block",
114
- x,
115
- h,
116
- n ? "!text-[var(--color-brand-600)]" : ""
117
- ),
118
- onMouseEnter: () => w(!0),
119
- onMouseLeave: () => w(!1),
120
- children: /* @__PURE__ */ r("span", { ref: m, className: "inline", children: n ? /* @__PURE__ */ r("a", { href: s, target: "_blank", children: s }) : s })
121
- }
122
- ),
123
- l && R(
124
- /* @__PURE__ */ r(
125
- "div",
19
+ renderExpandedContent: N
20
+ }, g) {
21
+ return /* @__PURE__ */ r(T.Root, { ref: g, className: n, size: h, children: /* @__PURE__ */ v(a, { "aria-label": p, size: h, children: [
22
+ /* @__PURE__ */ r(a.Header, { className: c, children: i.map((e, d) => /* @__PURE__ */ r(
23
+ a.Head,
126
24
  {
127
- className: g(
128
- "fixed px-3 py-2 text-xs font-semibold text-white bg-primary-solid rounded-lg shadow-lg pointer-events-none z-999 max-w-2xs lg:max-w-xs xl:max-w-sm break-words whitespace-normal",
129
- a === "above" && "-translate-y-full",
130
- t === "center" && "-translate-x-1/2",
131
- h
132
- ),
25
+ sticky: e.sticky,
26
+ stickyOffset: e.stickyOffset,
27
+ id: e.key,
28
+ label: e.label,
29
+ isRowHeader: !0,
30
+ allowsSorting: e.allowsSorting,
31
+ headerCellClass: k.includes(e.key) ? "justify-center" : "",
133
32
  style: {
134
- top: `${o.top}px`,
135
- ...(t === "start" || t === "center") && { left: `${o.left}px` },
136
- ...t === "end" && { right: `${o.right}px` }
33
+ maxWidth: e.maxWidth,
34
+ minWidth: e.maxWidth,
35
+ width: e.maxWidth
36
+ },
37
+ className: "overflow-hidden"
38
+ },
39
+ d
40
+ )) }),
41
+ /* @__PURE__ */ r(a.Body, { items: x, children: (e) => {
42
+ const d = y ? y(e) : !1, l = e.id || e.rule_id || String(e);
43
+ return /* @__PURE__ */ r(
44
+ a.Row,
45
+ {
46
+ onAction: () => s == null ? void 0 : s(e),
47
+ id: l,
48
+ isExpandable: d,
49
+ renderExpandedContent: d ? N : void 0,
50
+ columns: i,
51
+ className: j(
52
+ s && "cursor-pointer",
53
+ W ? "prose" : "",
54
+ b && "[&>td]:after:hidden"
55
+ // Remove row borders
56
+ ),
57
+ children: i.map((t, o) => /* @__PURE__ */ r(
58
+ a.Cell,
59
+ {
60
+ sticky: t.sticky,
61
+ stickyOffset: t.stickyOffset,
62
+ style: {
63
+ maxWidth: t.maxWidth,
64
+ minWidth: t.maxWidth,
65
+ width: t.maxWidth
66
+ },
67
+ className: "overflow-x-hidden text-left",
68
+ children: o === 0 && d ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: f(t.key, e[t.key], e) }) : f(t.key, e[t.key], e)
69
+ },
70
+ t.key
71
+ ))
137
72
  },
138
- children: s
139
- }
140
- ),
141
- document.body
142
- )
143
- ] });
144
- }, F = (s, h = "", n, t = "start", a, x, l) => s === "" || s === "-" ? /* @__PURE__ */ r("span", { className: `text-left ${h}`, children: s || x || "-" }) : /* @__PURE__ */ r(
145
- j,
146
- {
147
- content: s,
148
- className: h,
149
- link: n,
150
- tooltipPosition: t,
151
- tooltipSide: a,
152
- textClassName: l
73
+ l
74
+ );
75
+ } })
76
+ ] }) });
153
77
  }
154
78
  );
155
79
  export {
156
- j as EllipsisContentWithTooltip,
157
- A as TableWrapper,
158
- F as createEllipsisContent
80
+ B as TableWrapper
159
81
  };
@@ -1,3 +1,4 @@
1
1
  export { Table, TableCard, TableCell } from './table';
2
- export { TableWrapper, EllipsisContentWithTooltip, createEllipsisContent, type TableWrapperProps } from './TableWrapper';
2
+ export { TableWrapper, type TableWrapperProps } from './TableWrapper';
3
+ export { EllipsisContentWithTooltip, createEllipsisContent, type EllipsisContentWithTooltipProps, } from '../../primitives/tooltip';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,+BAA+B,GACrC,MAAM,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,qBAAqB,EAErB,SAAS,EACT,GAAG,EACH,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACxB,gBAAgB,IAAI,oBAAoB,EACxC,UAAU,IAAI,cAAc,EAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAOL,SAAS,IAAI,aAAa,EAG3B,MAAM,uBAAuB,CAAC;AAgF/B,UAAU,oBAAoB;IAC5B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,eAAe,CAAC,EAAE,SAAS,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C;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,SAAS;8DAMZ,cAAc;;CA0ChB,CAAC;AAGF,QAAA,MAAM,SAAS;;eA/lB6B,IAAI,GAAG,IAAI,GAAG,IAAI;;;qEAoF3D,oBAAoB;;;CA8gBtB,CAAC;AAEF,QAAA,MAAM,KAAK,EAAgB,OAAO,SAAS,GAAG;IAC5C,IAAI,EAAE,OAAO,aAAa,CAAC;IAC3B,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,MAAM,EAAE,OAAO,WAAW,CAAC;IAC3B,GAAG,EAAE,OAAO,QAAQ,CAAC;CACtB,CAAC;AAOF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
@@ -1,16 +1,16 @@
1
- import { jsx as o, jsxs as m, Fragment as V } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as h, Fragment as V } from "react/jsx-runtime";
2
2
  import { forwardRef as W, useContext as g, createContext as F, useState as T, isValidElement as A, useRef as G, useEffect as L, Children as M, cloneElement as I } from "react";
3
- import { Table as B, useTableOptions as C, Cell as S, TableBody as J, Column as z, Group as Q, TableHeader as X, Collection as P, Row as O } from "react-aria-components";
3
+ import { Table as B, useTableOptions as C, Cell as z, TableBody as J, Column as S, Group as Q, TableHeader as X, Collection as P, Row as O } from "react-aria-components";
4
4
  import { cn as c } from "../../utils/cn.js";
5
5
  import { Badge as Y } from "../../primitives/badge/badge.js";
6
6
  import { Icon as w } from "../../primitives/icon/icon.js";
7
- import { Checkbox as D } from "../../primitives/checkbox/checkbox.js";
7
+ import { Checkbox as _ } from "../../primitives/checkbox/checkbox.js";
8
8
  const b = F({
9
9
  size: "md",
10
10
  expandedRows: /* @__PURE__ */ new Set(),
11
11
  toggleRow: () => {
12
12
  }
13
- }), E = W(({ children: r, className: n, size: i = "md", ...d }, e) => {
13
+ }), D = W(({ children: r, className: n, size: i = "md", ...d }, e) => {
14
14
  const s = G(null), [a, f] = T(!1), [p, l] = T(/* @__PURE__ */ new Set());
15
15
  L(() => {
16
16
  const t = s.current;
@@ -20,15 +20,15 @@ const b = F({
20
20
  f(R > N);
21
21
  };
22
22
  x();
23
- const h = new ResizeObserver(x);
24
- return h.observe(t), () => {
25
- h.disconnect();
23
+ const m = new ResizeObserver(x);
24
+ return m.observe(t), () => {
25
+ m.disconnect();
26
26
  };
27
27
  }, []);
28
28
  const u = (t) => {
29
29
  l((x) => {
30
- const h = new Set(x);
31
- return h.has(t) ? h.delete(t) : h.add(t), h;
30
+ const m = new Set(x);
31
+ return m.has(t) ? m.delete(t) : m.add(t), m;
32
32
  });
33
33
  };
34
34
  return /* @__PURE__ */ o(
@@ -42,15 +42,18 @@ const b = F({
42
42
  s.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
43
43
  },
44
44
  ...d,
45
- className: c("overflow-hidden rounded-lg bg-primary", n),
45
+ className: c(
46
+ "rounded-lg bg-primary overflow-x-auto overflow-y-clip",
47
+ n
48
+ ),
46
49
  children: r
47
50
  }
48
51
  )
49
52
  }
50
53
  );
51
54
  });
52
- E.displayName = "TableCardRoot";
53
- const _ = ({
55
+ D.displayName = "TableCardRoot";
56
+ const E = ({
54
57
  title: r,
55
58
  badge: n,
56
59
  description: i,
@@ -58,7 +61,7 @@ const _ = ({
58
61
  className: e
59
62
  }) => {
60
63
  const { size: s } = g(b);
61
- return /* @__PURE__ */ m(
64
+ return /* @__PURE__ */ h(
62
65
  "div",
63
66
  {
64
67
  className: c(
@@ -67,8 +70,8 @@ const _ = ({
67
70
  e
68
71
  ),
69
72
  children: [
70
- /* @__PURE__ */ m("div", { className: "flex flex-1 flex-col gap-0.5", children: [
71
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
73
+ /* @__PURE__ */ h("div", { className: "flex flex-1 flex-col gap-0.5", children: [
74
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
72
75
  /* @__PURE__ */ o(
73
76
  "h2",
74
77
  {
@@ -97,7 +100,7 @@ const _ = ({
97
100
  }
98
101
  );
99
102
  };
100
- _.displayName = "TableCardHeader";
103
+ E.displayName = "TableCardHeader";
101
104
  const j = ({
102
105
  className: r,
103
106
  size: n = "md",
@@ -145,7 +148,7 @@ const j = ({
145
148
  B,
146
149
  {
147
150
  className: (l) => c(
148
- "w-full overflow-x-hidden",
151
+ "w-full",
149
152
  n === "xs" && "px-3 py-0",
150
153
  typeof r == "function" ? r(l) : r
151
154
  ),
@@ -157,7 +160,7 @@ const j = ({
157
160
  B,
158
161
  {
159
162
  className: (l) => c(
160
- "w-full overflow-x-hidden",
163
+ "w-full",
161
164
  n === "xs" && "px-3 py-0",
162
165
  typeof r == "function" ? r(l) : r
163
166
  ),
@@ -177,34 +180,34 @@ const q = ({
177
180
  ...s
178
181
  }) => {
179
182
  const { size: a } = g(b), { selectionBehavior: f, selectionMode: p } = C();
180
- return /* @__PURE__ */ m(
183
+ return /* @__PURE__ */ h(
181
184
  X,
182
185
  {
183
186
  ...s,
184
187
  className: (l) => c(
185
- "sticky top-0 z-30 bg-secondary_subtle rounded-lg h-9",
188
+ "sticky top-[-1px] z-30 bg-secondary_subtle rounded-lg h-9",
186
189
  // Row border—using an "after" pseudo-element to avoid the border taking up space.
187
190
  i && "[&>tr>th]:after:pointer-events-none [&>tr>th]:after:absolute [&>tr>th]:after:inset-x-0 [&>tr>th]:after:bottom-0 [&>tr>th]:after:h-px [&>tr>th]:after:bg-border-tertiary [&>tr>th]:focus-visible:after:bg-transparent",
188
191
  typeof e == "function" ? e(l) : e
189
192
  ),
190
193
  children: [
191
194
  d && /* @__PURE__ */ o(
192
- z,
195
+ S,
193
196
  {
194
197
  className: c(
195
- "relative p-0",
198
+ "sticky top-[-1px] z-30 bg-secondary_subtle p-0",
196
199
  a === "sm" || a === "xs" ? "w-9" : "w-11"
197
200
  )
198
201
  }
199
202
  ),
200
203
  f === "toggle" && /* @__PURE__ */ o(
201
- z,
204
+ S,
202
205
  {
203
206
  className: c(
204
- "relative p-0",
207
+ "sticky top-[-1px] z-30 bg-secondary_subtle p-0",
205
208
  a === "sm" || a === "xs" ? "w-9" : "w-11"
206
209
  ),
207
- children: p === "multiple" && /* @__PURE__ */ o("div", { className: "flex items-start", children: /* @__PURE__ */ o(D, { slot: "selection" }) })
210
+ children: p === "multiple" && /* @__PURE__ */ o("div", { className: "flex items-start", children: /* @__PURE__ */ o(_, { slot: "selection" }) })
208
211
  }
209
212
  ),
210
213
  /* @__PURE__ */ o(P, { items: r, children: n })
@@ -226,30 +229,33 @@ const K = ({
226
229
  }) => {
227
230
  const { selectionBehavior: l } = C(), { size: u } = g(b);
228
231
  return /* @__PURE__ */ o(
229
- z,
232
+ S,
230
233
  {
231
234
  ...p,
232
235
  style: (t) => {
233
- const x = e ? {
236
+ const x = {
234
237
  position: "sticky",
235
- [e]: s,
236
- zIndex: 30,
237
- boxShadow: e === "right" ? "inset 2px 0 0px 0px var(--color-border-tertiary)" : "inset -2px 0 0px 0px var(--color-border-tertiary)"
238
- } : {};
238
+ top: -1,
239
+ zIndex: e ? 40 : 30,
240
+ ...e ? {
241
+ [e]: s,
242
+ boxShadow: e === "right" ? "inset 2px 0 0px 0px var(--color-border-tertiary)" : "inset -2px 0 0px 0px var(--color-border-tertiary)"
243
+ } : {}
244
+ };
239
245
  return { ...typeof p.style == "function" ? p.style(t) : p.style || {}, ...x };
240
246
  },
241
247
  className: (t) => c(
242
- "relative p-0 outline-hidden focus-visible:z-1 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-bg-primary focus-visible:ring-inset",
248
+ "sticky top-[-1px] bg-secondary_subtle p-0 outline-hidden focus-visible:z-[41] focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-bg-primary focus-visible:ring-inset",
243
249
  u === "xs" && "px-3 py-0",
244
250
  u === "sm" && "px-4 py-2",
245
251
  u === "md" && "px-6 py-2",
246
252
  l === "toggle" && "nth-2:pl-3",
247
- e && "bg-secondary_subtle",
253
+ e ? "z-40" : "z-30",
248
254
  t.allowsSorting && "cursor-pointer",
249
255
  typeof r == "function" ? r(t) : r
250
256
  ),
251
- children: (t) => /* @__PURE__ */ m(Q, { className: c("flex items-center gap-1", a), children: [
252
- /* @__PURE__ */ m("div", { className: "flex items-center gap-1 overflow-hidden", children: [
257
+ children: (t) => /* @__PURE__ */ h(Q, { className: c("flex items-center gap-1", a), children: [
258
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-1 overflow-hidden", children: [
253
259
  i && /* @__PURE__ */ o("span", { className: "text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis text-secondary", children: i }),
254
260
  typeof d == "function" ? d(t) : d
255
261
  ] }),
@@ -307,7 +313,7 @@ const $ = ({
307
313
  return [
308
314
  I(H, {
309
315
  ...k,
310
- children: /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
316
+ children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
311
317
  R,
312
318
  k.children
313
319
  ] })
@@ -317,8 +323,8 @@ const $ = ({
317
323
  }
318
324
  return n;
319
325
  })() : n;
320
- return /* @__PURE__ */ m(V, { children: [
321
- /* @__PURE__ */ m(
326
+ return /* @__PURE__ */ h(V, { children: [
327
+ /* @__PURE__ */ h(
322
328
  O,
323
329
  {
324
330
  ...a,
@@ -332,13 +338,13 @@ const $ = ({
332
338
  ),
333
339
  children: [
334
340
  u === "toggle" && /* @__PURE__ */ o(
335
- S,
341
+ z,
336
342
  {
337
343
  className: c(
338
344
  "relative p-0",
339
345
  f === "sm" || f === "xs" ? "w-9" : "w-11"
340
346
  ),
341
- children: /* @__PURE__ */ o("div", { className: "flex items-end", children: /* @__PURE__ */ o(D, { className: "hidden", slot: "selection" }) })
347
+ children: /* @__PURE__ */ o("div", { className: "flex items-end", children: /* @__PURE__ */ o(_, { className: "hidden", slot: "selection" }) })
342
348
  }
343
349
  ),
344
350
  /* @__PURE__ */ o(P, { items: r, children: N })
@@ -351,7 +357,7 @@ const $ = ({
351
357
  id: `${t}-expanded`,
352
358
  className: "relative bg-secondary_subtle",
353
359
  children: /* @__PURE__ */ o(
354
- S,
360
+ z,
355
361
  {
356
362
  className: "p-0",
357
363
  colSpan: (r == null ? void 0 : r.length) || 0,
@@ -372,7 +378,7 @@ const U = ({
372
378
  }) => {
373
379
  const { size: s } = g(b), { selectionBehavior: a } = C();
374
380
  return /* @__PURE__ */ o(
375
- S,
381
+ z,
376
382
  {
377
383
  ...e,
378
384
  style: (f) => {
@@ -399,8 +405,8 @@ const U = ({
399
405
  };
400
406
  U.displayName = "TableCell";
401
407
  const le = {
402
- Root: E,
403
- Header: _
408
+ Root: D,
409
+ Header: E
404
410
  }, v = j;
405
411
  v.Body = J;
406
412
  v.Cell = U;
@@ -29,6 +29,9 @@ export interface TreeViewProps {
29
29
  searchClassName?: string;
30
30
  /** Class name(s) for the search input element */
31
31
  searchInputClassName?: string;
32
+ /** When true, every node starts expanded. Per-node `isOpen` on the
33
+ * source data, if present, still wins. Default false. */
34
+ defaultExpanded?: boolean;
32
35
  }
33
36
  /**
34
37
  * Config for building TreeViewNode[] from arbitrary data.
@@ -47,6 +50,9 @@ export interface TreeViewBuildConfig {
47
50
  idKey?: string;
48
51
  /** Optional max depth to traverse (default: no limit) */
49
52
  maxDepth?: number;
53
+ /** When true, every built node starts with `isOpen: true`. Per-node
54
+ * `isOpen` on source data overrides this (source data always wins). */
55
+ defaultExpanded?: boolean;
50
56
  }
51
57
  /**
52
58
  * Converts any array of items into TreeViewNode[] using the given config.
@@ -55,7 +61,7 @@ export interface TreeViewBuildConfig {
55
61
  */
56
62
  export declare function buildTreeViewNodes<T extends Record<string, any>>(data: T[], config: TreeViewBuildConfig, parentPath?: string): TreeViewNode[];
57
63
  export declare const TreeView: {
58
- ({ data, config, CustomNode, onNodeClick, selectedNodeId, showSearch, searchPlaceholder, searchClassName, searchInputClassName, }: TreeViewProps): import("react/jsx-runtime").JSX.Element;
64
+ ({ data, config, CustomNode, onNodeClick, selectedNodeId, showSearch, searchPlaceholder, searchClassName, searchInputClassName, defaultExpanded, }: TreeViewProps): import("react/jsx-runtime").JSX.Element;
59
65
  displayName: string;
60
66
  };
61
67
  //# sourceMappingURL=tree-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view.d.ts","sourceRoot":"","sources":["../../../src/patterns/tree-view/tree-view.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC1B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,iEAAiE;IACjE,MAAM,EAAE,mBAAmB,CAAC;IAC5B,2EAA2E;IAC3E,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClE,0DAA0D;IAC1D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,wCAAwC;IACxC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,wDAAwD;I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