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

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,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,C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H,MAAM,WAAW,mBAAmB;IAChC,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;4EACwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5D,IAAI,EAAE,CAAC,EAAE,EACT,MAAM,EAAE,mBAAmB,EAC3B,UAAU,GAAE,MAAW,GACxB,YAAY,EAAE,CAwChB;AAqBD,eAAO,MAAM,QAAQ;wJAWlB,aAAa;;CAuDf,CAAC"}
@@ -1,33 +1,34 @@
1
- import { jsxs as A, jsx as r, Fragment as j } from "react/jsx-runtime";
1
+ import { jsxs as A, jsx as r, Fragment as E } from "react/jsx-runtime";
2
2
  import { useState as $ } from "react";
3
3
  import { SearchSm as T, ChevronDown as K, ChevronRight as V } from "@untitledui/icons";
4
4
  import { cn as k } from "../../utils/cn.js";
5
5
  import { Input as _ } from "../../primitives/input/input.js";
6
6
  const N = 10;
7
- function C(e, t, s = "") {
7
+ function C(e, l, s = "") {
8
8
  const {
9
- labelKey: p,
9
+ labelKey: m,
10
10
  childrenKey: n,
11
- dataKey: u = "metadata",
12
- typeKey: y = "type",
13
- idKey: o,
14
- maxDepth: i
15
- } = t, f = s ? s.split(".").length : 0;
16
- return i != null && f >= i ? [] : (Array.isArray(e) ? e : Object.values(e)).map((l, v) => {
17
- const w = o != null ? l[o] : void 0, c = String(w ?? v), h = s ? `${s}.${c}` : c, a = l[n], d = Array.isArray(a) ? a : a != null ? Object.values(a) : [];
11
+ dataKey: f = "metadata",
12
+ typeKey: x = "type",
13
+ idKey: h,
14
+ maxDepth: i,
15
+ defaultExpanded: g
16
+ } = l, v = s ? s.split(".").length : 0;
17
+ return i != null && v >= i ? [] : (Array.isArray(e) ? e : Object.values(e)).map((t, w) => {
18
+ const b = h != null ? t[h] : void 0, a = String(b ?? w), d = s ? `${s}.${a}` : a, c = t[n], o = Array.isArray(c) ? c : c != null ? Object.values(c) : [];
18
19
  return {
19
- id: h,
20
- label: l[p] ?? "Untitled",
21
- type: l[y] ?? "Untitled",
22
- isOpen: !1,
23
- children: d.length > 0 ? C(d, t, h) : [],
24
- [u]: l
20
+ id: d,
21
+ label: t[m] ?? "Untitled",
22
+ type: t[x] ?? "Untitled",
23
+ isOpen: t.isOpen ?? g ?? !1,
24
+ children: o.length > 0 ? C(o, l, d) : [],
25
+ [f]: t
25
26
  };
26
27
  });
27
28
  }
28
- function O(e, t) {
29
- const s = e.label ?? "", p = Array.isArray(e.children) ? e.children : [];
30
- return s.toLowerCase().includes(t.toLowerCase()) ? !0 : p.some((n) => O(n, t));
29
+ function O(e, l) {
30
+ const s = e.label ?? "", m = Array.isArray(e.children) ? e.children : [];
31
+ return s.toLowerCase().includes(l.toLowerCase()) ? !0 : m.some((n) => O(n, l));
31
32
  }
32
33
  const D = () => /* @__PURE__ */ r("div", { className: "flex h-[28px] items-center px-[13px] shrink-0", children: /* @__PURE__ */ r("div", { className: "relative h-full w-0 shrink-0", children: /* @__PURE__ */ r(
33
34
  "div",
@@ -35,83 +36,89 @@ const D = () => /* @__PURE__ */ r("div", { className: "flex h-[28px] items-cente
35
36
  className: "absolute inset-y-0 bg-(--color-border-secondary)",
36
37
  style: { left: "-0.5px", width: 1 }
37
38
  }
38
- ) }) }), E = ({
39
+ ) }) }), I = ({
39
40
  data: e,
40
- config: t,
41
+ config: l,
41
42
  CustomNode: s,
42
- onNodeClick: p,
43
+ onNodeClick: m,
43
44
  selectedNodeId: n,
44
- showSearch: u = !1,
45
- searchPlaceholder: y = "Search...",
46
- searchClassName: o,
47
- searchInputClassName: i
45
+ showSearch: f = !1,
46
+ searchPlaceholder: x = "Search...",
47
+ searchClassName: h,
48
+ searchInputClassName: i,
49
+ defaultExpanded: g
48
50
  }) => {
49
- const [f, b] = $(() => C(e, t)), [l, v] = $("");
50
- function w(c, h) {
51
- const a = structuredClone(f), d = h.split("-"), g = Number(d[0]);
52
- d.shift();
53
- let m = a[g];
54
- d.length > 0 && (m = d.reduce((x, L) => x.children[Number(L)], a[g])), m.isOpen = !m.isOpen, b(a);
51
+ const [v, y] = $(
52
+ () => C(e, {
53
+ ...l,
54
+ defaultExpanded: g ?? l.defaultExpanded
55
+ })
56
+ ), [t, w] = $("");
57
+ function b(a, d) {
58
+ const c = structuredClone(v), o = d.split("-"), p = Number(o[0]);
59
+ o.shift();
60
+ let u = c[p];
61
+ o.length > 0 && (u = o.reduce((L, j) => L.children[Number(j)], c[p])), u.isOpen = !u.isOpen, y(c);
55
62
  }
56
63
  return /* @__PURE__ */ A("div", { className: "min-w-max", children: [
57
- u && /* @__PURE__ */ r("div", { className: k("mb-2", o), children: /* @__PURE__ */ r(
64
+ f && /* @__PURE__ */ r("div", { className: k("mb-2", h), children: /* @__PURE__ */ r(
58
65
  _,
59
66
  {
60
67
  type: "search",
61
- placeholder: y,
62
- value: l,
63
- onChange: (c) => v(c),
68
+ placeholder: x,
69
+ value: t,
70
+ onChange: (a) => w(a),
64
71
  size: "sm",
65
72
  className: i,
66
73
  icon: T
67
74
  }
68
75
  ) }),
69
- /* @__PURE__ */ r("div", { className: "flex flex-col", children: f.map((c, h) => /* @__PURE__ */ r(
76
+ /* @__PURE__ */ r("div", { className: "flex flex-col", children: v.map((a, d) => /* @__PURE__ */ r(
70
77
  S,
71
78
  {
72
- node: c,
73
- parentId: String(h),
79
+ node: a,
80
+ parentId: String(d),
74
81
  depth: 0,
75
- handleToggle: w,
76
- onNodeClick: p,
82
+ handleToggle: b,
83
+ onNodeClick: m,
77
84
  selectedNodeId: n,
78
85
  CustomNode: s,
79
- query: l
86
+ query: t
80
87
  },
81
- c.id || h
88
+ a.id || d
82
89
  )) })
83
90
  ] });
84
91
  };
85
- E.displayName = "TreeView";
92
+ I.displayName = "TreeView";
86
93
  const S = ({
87
94
  node: e,
88
- parentId: t,
95
+ parentId: l,
89
96
  depth: s = 0,
90
- handleToggle: p,
97
+ handleToggle: m,
91
98
  onNodeClick: n,
92
- selectedNodeId: u,
93
- CustomNode: y,
94
- query: o
99
+ selectedNodeId: f,
100
+ CustomNode: x,
101
+ query: h
95
102
  }) => {
96
- const i = o.length > 0, f = Array.isArray(e.children) ? e.children : [], b = e.label ?? "";
97
- if (i && !O(e, o))
103
+ const i = h.length > 0, g = Array.isArray(e.children) ? e.children : [], v = e.label ?? "";
104
+ if (i && !O(e, h))
98
105
  return null;
99
- const l = f.length > 0, v = u != null && e.id === u, w = l && (i || (e.isOpen ?? !1)), c = (m) => {
100
- m.stopPropagation(), l && (i || p(e, t), n == null || n(e));
101
- }, h = s === 0 ? "pl-[6px]" : "", a = s === 0 ? "pl-[2px]" : "pl-[8px]", d = i && b.toLowerCase().includes(o.toLowerCase()), g = i ? !0 : e.isOpen;
106
+ const y = g.length > 0, t = f != null && e.id === f, w = y && (i || (e.isOpen ?? !1)), b = (p) => {
107
+ p.stopPropagation(), y && (i || m(e, l), n == null || n(e));
108
+ }, a = s === 0 ? "pl-[6px]" : "", d = s === 0 ? "pl-[2px]" : "pl-[8px]", c = i && v.toLowerCase().includes(h.toLowerCase()), o = i ? !0 : e.isOpen;
102
109
  return /* @__PURE__ */ A("div", { className: "relative", children: [
103
110
  /* @__PURE__ */ A(
104
111
  "div",
105
112
  {
106
- className: `flex h-[28px] w-full items-center pr-[8px] rounded-sm ${h} ${d ? "bg-(--color-bg-secondary)" : ""} ${l ? "cursor-pointer hover:bg-(--color-bg-secondary)" : ""}`,
107
- onClick: c,
113
+ className: `flex h-[28px] w-full items-center pr-[8px] rounded-sm ${a} ${c ? "bg-(--color-bg-secondary)" : ""} ${y ? "cursor-pointer hover:bg-(--color-bg-secondary)" : ""}`,
114
+ onClick: b,
108
115
  children: [
109
- s > 0 && Array.from({ length: s }).map((m, x) => /* @__PURE__ */ r(D, {}, x)),
110
- l ? /* @__PURE__ */ r(
116
+ s > 0 && Array.from({ length: s }).map((p, u) => /* @__PURE__ */ r(D, {}, u)),
117
+ y ? /* @__PURE__ */ r(
111
118
  "div",
112
119
  {
113
- className: `flex flex-col h-full items-center shrink-0 ${a} ${g ? "justify-end" : "justify-center"}`,
114
- children: g ? /* @__PURE__ */ A(j, { children: [
120
+ className: `flex flex-col h-full items-center shrink-0 ${d} ${o ? "justify-end" : "justify-center"}`,
121
+ children: o ? /* @__PURE__ */ A(E, { children: [
115
122
  /* @__PURE__ */ r(
116
123
  K,
117
124
  {
@@ -135,27 +142,27 @@ const S = ({
135
142
  )
136
143
  }
137
144
  ) : s > 0 ? /* @__PURE__ */ r("div", { className: "h-full w-[6px] shrink-0" }) : null,
138
- /* @__PURE__ */ r("div", { className: "flex flex-1 h-full items-center min-w-0 pl-[2px]", children: /* @__PURE__ */ r(y, { node: e, isSelected: v }) })
145
+ /* @__PURE__ */ r("div", { className: "flex flex-1 h-full items-center min-w-0 pl-[2px]", children: /* @__PURE__ */ r(x, { node: e, isSelected: t }) })
139
146
  ]
140
147
  }
141
148
  ),
142
- w && /* @__PURE__ */ r("div", { className: "relative", children: f.map((m, x) => /* @__PURE__ */ r(
149
+ w && /* @__PURE__ */ r("div", { className: "relative", children: g.map((p, u) => /* @__PURE__ */ r(
143
150
  S,
144
151
  {
145
- node: m,
146
- parentId: `${t}-${x}`,
152
+ node: p,
153
+ parentId: `${l}-${u}`,
147
154
  depth: s + 1,
148
- handleToggle: p,
155
+ handleToggle: m,
149
156
  onNodeClick: n,
150
- selectedNodeId: u,
151
- CustomNode: y,
152
- query: o
157
+ selectedNodeId: f,
158
+ CustomNode: x,
159
+ query: h
153
160
  },
154
- m.id || `${t}-${x}`
161
+ p.id || `${l}-${u}`
155
162
  )) })
156
163
  ] });
157
164
  };
158
165
  export {
159
- E as TreeView,
166
+ I as TreeView,
160
167
  C as buildTreeViewNodes
161
168
  };
@@ -1,8 +1,8 @@
1
1
  import { jsxs as x, jsx as d } from "react/jsx-runtime";
2
2
  import { isValidElement as m } from "react";
3
- import { Link as p, Button as h } from "react-aria-components";
4
- import { Tooltip as y } from "../tooltip/tooltip.js";
5
- import { cx as b } from "../../utils/cn.js";
3
+ import { Link as p, Button as y } from "react-aria-components";
4
+ import { Tooltip as b } from "../tooltip/tooltip.js";
5
+ import { cx as h } from "../../utils/cn.js";
6
6
  import { isReactComponent as v } from "../../utils/is-react-component.js";
7
7
  const g = {
8
8
  secondary: "bg-primary text-fg-quaternary shadow-xs-skeumorphic ring-1 ring-secondary ring-inset hover:bg-primary_hover hover:text-fg-quaternary_hover disabled:shadow-xs disabled:ring-disabled_subtle",
@@ -27,7 +27,7 @@ const g = {
27
27
  tooltipPlacement: u = "top",
28
28
  ...e
29
29
  }) => {
30
- const o = "href" in e ? e.href : void 0, f = o ? p : h;
30
+ const o = "href" in e ? e.href : void 0, f = o ? p : y;
31
31
  let a = {};
32
32
  o ? a = {
33
33
  ...e,
@@ -46,8 +46,8 @@ const g = {
46
46
  {
47
47
  "aria-label": i,
48
48
  ...a,
49
- className: b(
50
- "group relative inline-flex h-max cursor-pointer items-center justify-center rounded-md outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:text-fg-disabled_subtle",
49
+ className: h(
50
+ "group relative inline-flex h-max cursor-pointer items-center justify-center rounded-md outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:text-fg-disabled_subtle",
51
51
  g[l],
52
52
  _[n],
53
53
  // Icon styles
@@ -62,7 +62,7 @@ const g = {
62
62
  }
63
63
  );
64
64
  return i ? /* @__PURE__ */ d(
65
- y,
65
+ b,
66
66
  {
67
67
  title: i,
68
68
  placement: u,
@@ -10,7 +10,7 @@ const t = q({
10
10
  // When button is used within `InputGroup`
11
11
  "in-data-input-wrapper:focus:!z-50 in-data-input-wrapper:in-data-leading:-mr-px in-data-input-wrapper:in-data-leading:rounded-r-none in-data-input-wrapper:in-data-leading:before:rounded-r-none in-data-input-wrapper:in-data-trailing:-ml-px in-data-input-wrapper:in-data-trailing:rounded-l-none in-data-input-wrapper:in-data-trailing:before:rounded-l-none",
12
12
  // Disabled styles
13
- "disabled:cursor-not-allowed disabled:text-fg-disabled",
13
+ "disabled:cursor-not-allowed disabled:opacity-50 disabled:text-fg-disabled",
14
14
  // Icon styles
15
15
  "disabled:*:data-icon:text-fg-disabled_subtle",
16
16
  // Same as `icon` but for SSR icons that cannot be passed to the client as functions.
@@ -63,7 +63,7 @@ const t = q({
63
63
  root: [
64
64
  "bg-primary text-secondary ring-1 ring-secondary ring-inset hover:bg-primary_hover hover:text-secondary_hover data-loading:bg-primary_hover",
65
65
  // Disabled styles
66
- "disabled:ring-disabled_subtle",
66
+ "disabled:bg-disabled_subtle disabled:ring-disabled_subtle",
67
67
  // Icon styles
68
68
  "*:data-icon:text-fg-quaternary hover:*:data-icon:text-fg-quaternary_hover"
69
69
  ].join(" ")