@box/tree 0.45.0 → 0.45.2

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,135 +1,160 @@
1
- import { LoadingIndicator as k } from "@box/blueprint-web";
2
- import s from "clsx";
3
- import { useRef as x, useMemo as A } from "react";
4
- import { useIntl as M } from "react-intl";
5
- import { CONTENT_NODE as S, CONTENT_NODE_LOADING as G } from "../../constants.js";
1
+ import { LoadingIndicator as G } from "@box/blueprint-web";
2
+ import d from "clsx";
3
+ import { useRef as m, useMemo as P } from "react";
4
+ import { useIntl as q } from "react-intl";
5
+ import { CONTENT_NODE as B, CONTENT_NODE_LOADING as F } from "../../constants.js";
6
6
  import { s as e } from "../../../../chunks/nodes.module.js";
7
- import P from "./messages.js";
8
- import { jsxs as a, jsx as n } from "react/jsx-runtime";
9
- import { useIntersectionObserver as q } from "../../hooks/useIntersectionObserver.js";
10
- import { Expander as B } from "../expander/expander.js";
11
- import { NodeItemIcon as F } from "../node-icon/node-item-icon.js";
12
- import { NodeAvatar as H } from "../node-icon/node-avatar.js";
13
- import { TruncatedTooltipText as J } from "../truncated-tooltip-text/truncated-tooltip-text.js";
14
- import '../../../../styles/content-node.css';const K = "_loader_1xxrm_1", Q = "_content_1xxrm_9", U = "_title_1xxrm_15", V = "_subtitle_1xxrm_67", W = "_tooltip_1xxrm_83", l = {
15
- loader: K,
16
- content: Q,
7
+ import H from "./messages.js";
8
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
9
+ import { useIntersectionObserver as J } from "../../hooks/useIntersectionObserver.js";
10
+ import { Expander as K } from "../expander/expander.js";
11
+ import { NodeItemIcon as Q } from "../node-icon/node-item-icon.js";
12
+ import { NodeAvatar as U } from "../node-icon/node-avatar.js";
13
+ import { NodeLabel as L } from "../node-label/node-label.js";
14
+ import { TruncatedTooltipText as W } from "../truncated-tooltip-text/truncated-tooltip-text.js";
15
+ import '../../../../styles/content-node.css';const X = "_loader_1xxrm_1", Y = "_content_1xxrm_9", Z = "_title_1xxrm_15", z = "_subtitle_1xxrm_67", ee = "_tooltip_1xxrm_83", n = {
16
+ loader: X,
17
+ content: Y,
17
18
  "title-wrapper": "_title-wrapper_1xxrm_15",
18
- title: U,
19
+ title: Z,
19
20
  "title--small": "_title--small_1xxrm_29",
20
21
  "title--selected": "_title--selected_1xxrm_38",
21
22
  "title--large": "_title--large_1xxrm_48",
22
- subtitle: V,
23
- tooltip: W
23
+ subtitle: z,
24
+ tooltip: ee
24
25
  };
25
- function ce({
26
+ function be({
26
27
  element: {
27
- name: i,
28
- metadata: t
28
+ name: c,
29
+ metadata: l
29
30
  },
30
- level: m,
31
- getNodeProps: _,
32
- handleSelect: f,
33
- handleExpand: O,
34
- isBranch: w,
35
- isExpanded: p,
36
- isDisabled: c,
37
- isSelected: u,
31
+ level: u,
32
+ getNodeProps: x,
33
+ handleSelect: _,
34
+ handleExpand: R,
35
+ isBranch: y,
36
+ isExpanded: f,
37
+ isDisabled: a,
38
+ isSelected: N,
38
39
  size: o,
39
- withIcon: N,
40
- containsSelection: E
40
+ withIcon: v,
41
+ containsSelection: V
41
42
  }) {
42
- const L = M(), v = x(null), h = x(null), b = x(null), {
43
- subtitle: r,
44
- isLoading: T = !1,
45
- withDivider: $ = !1,
46
- variant: g,
47
- selectable: I = !0
48
- } = t, d = A(() => _({
49
- onClick: f
50
- }), [_, f]), y = q(v), C = !c && !p && E, R = {
51
- [`data-${S}`]: !0,
52
- [`data-${G}`]: T
53
- }, D = /* @__PURE__ */ a("div", {
54
- ...d,
55
- className: s("node", e.node, e[`node-${o}-level${m - 1}`], e[`node--${o}`], {
56
- [e[`node--${o}-extraData`]]: !!r,
57
- [e["node--focused"]]: d.className.includes("tree-node--focused"),
58
- [e["node--selected"]]: u || C,
59
- [e["node--disabled"]]: c,
43
+ const k = q(), h = m(null), T = m(null), $ = m(null), b = m(null), {
44
+ isLoading: g = !1,
45
+ selectable: I = !0,
46
+ variant: r
47
+ } = l, {
48
+ labelName: w,
49
+ labelValue: D,
50
+ subtitle: i,
51
+ withDivider: O
52
+ } = r === "labeled" ? {
53
+ labelName: l.labelName,
54
+ labelValue: l.labelValue,
55
+ subtitle: void 0,
56
+ withDivider: !1
57
+ } : {
58
+ labelName: void 0,
59
+ labelValue: void 0,
60
+ subtitle: l.subtitle,
61
+ withDivider: l.withDivider || !1
62
+ }, s = P(() => x({
63
+ onClick: _
64
+ }), [x, _]), j = J(h), C = !a && !f && V, A = {
65
+ [`data-${B}`]: !0,
66
+ [`data-${F}`]: g
67
+ }, E = !!i || r === "labeled", M = /* @__PURE__ */ p("div", {
68
+ ...s,
69
+ className: d("node", e.node, e[`node-${o}-level${u - 1}`], e[`node--${o}`], {
70
+ [e[`node--${o}-extraData`]]: E,
71
+ [e["node--focused"]]: s.className.includes("tree-node--focused"),
72
+ [e["node--selected"]]: N || C,
73
+ [e["node--disabled"]]: a,
60
74
  [e["node--nonselectable"]]: !I,
61
- "node--with-divider": $
75
+ "node--with-divider": O
62
76
  }),
63
- "data-target-id": t == null ? void 0 : t.dataTargetId,
64
- children: [w && /* @__PURE__ */ n("div", {
65
- className: s(e.expander, e[`expander-level${m - 1}`], e[`expander-${o}`]),
66
- children: T ? /* @__PURE__ */ n(k, {
67
- "aria-label": L.formatMessage(P.branchContentLoaderLabel),
68
- className: l.loader,
77
+ "data-target-id": l == null ? void 0 : l.dataTargetId,
78
+ children: [y && /* @__PURE__ */ t("div", {
79
+ className: d(e.expander, e[`expander-level${u - 1}`], e[`expander-${o}`]),
80
+ children: g ? /* @__PURE__ */ t(G, {
81
+ "aria-label": k.formatMessage(H.branchContentLoaderLabel),
82
+ className: n.loader,
69
83
  size: o === "small" ? "small" : "medium"
70
- }) : /* @__PURE__ */ n(B, {
71
- dataTargetId: t != null && t.dataTargetId ? `${t.dataTargetId}:${p ? "collapse" : "expand"}` : void 0,
72
- disabled: c,
73
- expanded: p,
74
- onClick: O,
84
+ }) : /* @__PURE__ */ t(K, {
85
+ dataTargetId: l != null && l.dataTargetId ? `${l.dataTargetId}:${f ? "collapse" : "expand"}` : void 0,
86
+ disabled: a,
87
+ expanded: f,
88
+ onClick: R,
75
89
  size: o
76
90
  })
77
- }), /* @__PURE__ */ a("div", {
78
- className: s(l.content),
79
- children: [N && g === "content" && /* @__PURE__ */ n(F, {
80
- iconType: t.iconType,
91
+ }), /* @__PURE__ */ p("div", {
92
+ className: d(n.content),
93
+ children: [v && r === "content" && /* @__PURE__ */ t(Q, {
94
+ iconType: l.iconType,
81
95
  size: o
82
- }), N && g === "user" && /* @__PURE__ */ n(H, {
83
- avatarSrc: t.avatarSrc,
84
- badge: t.badge,
85
- nodeTitle: i,
96
+ }), v && r === "user" && /* @__PURE__ */ t(U, {
97
+ avatarSrc: l.avatarSrc,
98
+ badge: l.badge,
99
+ nodeTitle: c,
86
100
  size: o
87
- }), /* @__PURE__ */ a("div", {
88
- className: l["title-wrapper"],
89
- children: [/* @__PURE__ */ n("span", {
90
- ref: h,
91
- className: s(l.title, l[`title--${o}`], {
92
- [l["title--selected"]]: u || C
101
+ }), /* @__PURE__ */ p("div", {
102
+ className: n["title-wrapper"],
103
+ children: [r === "labeled" && /* @__PURE__ */ t(L, {
104
+ ref: b,
105
+ labelName: w,
106
+ labelValue: D
107
+ }), /* @__PURE__ */ t("span", {
108
+ ref: T,
109
+ className: d(n.title, n[`title--${o}`], {
110
+ [n["title--selected"]]: N || C
93
111
  }),
112
+ children: c
113
+ }), i && /* @__PURE__ */ t("span", {
114
+ ref: $,
115
+ className: n.subtitle,
94
116
  children: i
95
- }), r && /* @__PURE__ */ n("span", {
96
- ref: b,
97
- className: l.subtitle,
98
- children: r
99
117
  })]
100
118
  })]
101
119
  })]
102
- }), j = /* @__PURE__ */ n("div", {
103
- ...d,
104
- className: s("node", e.node, e[`node-${o}-level${m - 1}`], e[`node--${o}`], {
105
- [e[`node--${o}-extraData`]]: !!r,
106
- [e["node--focused"]]: d.className.includes("tree-node--focused"),
107
- [e["node--selected"]]: d.className.includes("tree-node--selected"),
108
- [e["node--disabled"]]: c,
120
+ }), S = /* @__PURE__ */ t("div", {
121
+ ...s,
122
+ className: d("node", e.node, e[`node-${o}-level${u - 1}`], e[`node--${o}`], {
123
+ [e[`node--${o}-extraData`]]: E,
124
+ [e["node--focused"]]: s.className.includes("tree-node--focused"),
125
+ [e["node--selected"]]: s.className.includes("tree-node--selected"),
126
+ [e["node--disabled"]]: a,
109
127
  [e["node--nonselectable"]]: !I,
110
- "node--with-divider": $
128
+ "node--with-divider": O
111
129
  }),
112
- "data-target-id": t == null ? void 0 : t.dataTargetId,
113
- children: i
130
+ "data-target-id": l == null ? void 0 : l.dataTargetId,
131
+ children: c
114
132
  });
115
- return /* @__PURE__ */ n("div", {
116
- ref: v,
117
- ...R,
118
- children: y ? j : /* @__PURE__ */ n(J, {
119
- subtitleElementRef: b,
120
- textElementRef: h,
121
- tooltipContent: /* @__PURE__ */ a("div", {
122
- className: l.tooltip,
123
- children: [/* @__PURE__ */ n("span", {
133
+ return /* @__PURE__ */ t("div", {
134
+ ref: h,
135
+ ...A,
136
+ children: j ? S : /* @__PURE__ */ t(W, {
137
+ labelElementRef: b,
138
+ subtitleElementRef: $,
139
+ textElementRef: T,
140
+ tooltipContent: /* @__PURE__ */ p("div", {
141
+ className: n.tooltip,
142
+ children: [r === "labeled" && /* @__PURE__ */ t(L, {
143
+ ref: b,
144
+ color: "textOnDarkDefault",
145
+ isInTooltip: !0,
146
+ labelName: w,
147
+ labelValue: D
148
+ }), /* @__PURE__ */ t("span", {
149
+ children: c
150
+ }), i && /* @__PURE__ */ t("span", {
124
151
  children: i
125
- }), r && /* @__PURE__ */ n("span", {
126
- children: r
127
152
  })]
128
153
  }),
129
- children: D
154
+ children: M
130
155
  })
131
156
  });
132
157
  }
133
158
  export {
134
- ce as ContentNode
159
+ be as ContentNode
135
160
  };
@@ -0,0 +1,4 @@
1
+ import { NodeLabel as r } from "./node-label.js";
2
+ export {
3
+ r as NodeLabel
4
+ };
@@ -0,0 +1,34 @@
1
+ import { Text as l } from "@box/blueprint-web";
2
+ import i from "clsx";
3
+ import { forwardRef as p } from "react";
4
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
5
+ import '../../../../styles/node-label.css';const m = "_label_km4kd_1", b = {
6
+ label: m
7
+ }, v = /* @__PURE__ */ p((o, r) => {
8
+ const {
9
+ color: e = "textOnLightSecondary",
10
+ isInTooltip: s = !1,
11
+ labelName: t,
12
+ labelValue: n
13
+ } = o;
14
+ return /* @__PURE__ */ c("div", {
15
+ ref: r,
16
+ className: i({
17
+ [b.label]: !s
18
+ }),
19
+ children: [/* @__PURE__ */ a(l, {
20
+ as: "span",
21
+ color: e,
22
+ variant: "labelBold",
23
+ children: t.toUpperCase()
24
+ }), /* @__PURE__ */ a(l, {
25
+ as: "span",
26
+ color: e,
27
+ variant: "label",
28
+ children: ` / ${n.toUpperCase()}`
29
+ })]
30
+ });
31
+ });
32
+ export {
33
+ v as NodeLabel
34
+ };
@@ -1,26 +1,27 @@
1
- import { Tooltip as d } from "@box/blueprint-web";
2
- import { useState as a, useLayoutEffect as f } from "react";
3
- import { jsx as T } from "react/jsx-runtime";
4
- function L({
1
+ import { Tooltip as a } from "@box/blueprint-web";
2
+ import { useState as f, useLayoutEffect as T } from "react";
3
+ import { jsx as p } from "react/jsx-runtime";
4
+ function h({
5
+ labelElementRef: o,
5
6
  textElementRef: e,
6
- subtitleElementRef: o,
7
- tooltipContent: s,
8
- children: n
7
+ subtitleElementRef: n,
8
+ tooltipContent: c,
9
+ children: s
9
10
  }) {
10
- const [c, i] = a(!1);
11
- return f(() => {
11
+ const [i, u] = f(!1);
12
+ return T(() => {
12
13
  const t = () => {
13
- const u = [e.current, o.current].some((r) => r && r.scrollWidth > r.offsetWidth);
14
- i(u);
14
+ const d = [e.current, n.current, o.current].some((r) => r && r.scrollWidth > r.offsetWidth);
15
+ u(d);
15
16
  };
16
17
  return t(), window.addEventListener("resize", t), () => {
17
18
  window.removeEventListener("resize", t);
18
19
  };
19
- }, [e, o]), c ? /* @__PURE__ */ T(d, {
20
- content: s,
21
- children: n
22
- }) : n;
20
+ }, [e, n, o]), i ? /* @__PURE__ */ p(a, {
21
+ content: c,
22
+ children: s
23
+ }) : s;
23
24
  }
24
25
  export {
25
- L as TruncatedTooltipText
26
+ h as TruncatedTooltipText
26
27
  };
@@ -1,122 +1,129 @@
1
- import { TooltipProvider as L } from "@box/blueprint-web";
2
- import g from "clsx";
3
- import { useRef as h, useEffect as c, useCallback as w } from "react";
1
+ import { TooltipProvider as g } from "@box/blueprint-web";
2
+ import b from "clsx";
3
+ import { useRef as h, useEffect as u, useCallback as w } from "react";
4
4
  import S from "react-accessible-treeview";
5
- import { preventDisabledNodeExpanding as p, preventLoadingContentNodeExpanding as v, serviceNodeKeyboardHandler as D, serviceNodeClickHandler as x } from "./utils.js";
5
+ import { preventDisabledNodeExpanding as E, preventLoadingContentNodeExpanding as y, serviceNodeKeyboardHandler as x, serviceNodeClickHandler as C } from "./utils.js";
6
6
  import { jsx as t } from "react/jsx-runtime";
7
- import { useSelectionInheritance as C } from "./hooks/useSelectionInheritance.js";
7
+ import { useSelectionInheritance as R } from "./hooks/useSelectionInheritance.js";
8
8
  import { ContentNode as M } from "./components/content-node/content-node.js";
9
- import { ServiceNodeWrapper as m } from "./components/service-node-wrapper/service-node-wrapper.js";
10
- import { LoadMoreNode as R } from "./components/load-more-node/load-more-node.js";
11
- import { ReloadNode as H } from "./components/reload-node/reload-node.js";
12
- import { LoadingNode as T } from "./components/loading-node/loading-node.js";
13
- import '../../styles/tree.css';const _ = "_tree_17956_1", K = {
14
- tree: _
9
+ import { ServiceNodeWrapper as v } from "./components/service-node-wrapper/service-node-wrapper.js";
10
+ import { LoadMoreNode as H } from "./components/load-more-node/load-more-node.js";
11
+ import { ReloadNode as T } from "./components/reload-node/reload-node.js";
12
+ import { LoadingNode as _ } from "./components/loading-node/loading-node.js";
13
+ import '../../styles/tree.css';const K = "_tree_17956_1", P = {
14
+ tree: K
15
+ }, j = (d, s, a) => (o) => {
16
+ const {
17
+ element: m,
18
+ isDisabled: i
19
+ } = o, {
20
+ id: c,
21
+ metadata: f,
22
+ parent: l
23
+ } = m, {
24
+ variant: n
25
+ } = f;
26
+ if (n === "content" || n === "user" || n === "labeled") {
27
+ const r = {
28
+ ...o,
29
+ size: d,
30
+ withIcon: s
31
+ };
32
+ return /* @__PURE__ */ t(M, {
33
+ ...r,
34
+ containsSelection: a.includes(c)
35
+ });
36
+ }
37
+ if (n === "loadMore") {
38
+ const r = {
39
+ ...o,
40
+ size: d
41
+ };
42
+ return /* @__PURE__ */ t(v, {
43
+ isDisabled: i,
44
+ parentId: l,
45
+ variant: "loadMore",
46
+ children: /* @__PURE__ */ t(H, {
47
+ ...r
48
+ })
49
+ });
50
+ }
51
+ if (n === "reload") {
52
+ const r = {
53
+ ...o,
54
+ size: d
55
+ };
56
+ return /* @__PURE__ */ t(v, {
57
+ isDisabled: i,
58
+ parentId: l,
59
+ variant: "reload",
60
+ children: /* @__PURE__ */ t(T, {
61
+ ...r
62
+ })
63
+ });
64
+ }
65
+ if (n === "loading") {
66
+ const r = {
67
+ ...o,
68
+ size: d
69
+ };
70
+ return /* @__PURE__ */ t(v, {
71
+ isDisabled: i,
72
+ variant: "loading",
73
+ children: /* @__PURE__ */ t(_, {
74
+ ...r
75
+ })
76
+ });
77
+ }
78
+ return null;
15
79
  };
16
- function U({
17
- "aria-label": u,
18
- size: o = "small",
19
- data: i,
20
- withIcons: b = !1,
21
- onExpand: N,
22
- onSelect: l,
23
- onLoadData: f,
24
- className: k,
25
- multiSelect: E = !1,
26
- ...a
80
+ function X({
81
+ "aria-label": d,
82
+ size: s = "small",
83
+ data: a,
84
+ withIcons: o = !1,
85
+ onExpand: m,
86
+ onSelect: i,
87
+ onLoadData: c,
88
+ className: f,
89
+ multiSelect: l = !1,
90
+ ...n
27
91
  }) {
28
- const s = h(null), {
29
- selectionInheritors: y,
30
- getSelectionInheritors: d
31
- } = C();
32
- c(() => {
33
- const e = s.current;
34
- return e && (e.addEventListener("keydown", p), e.addEventListener("keydown", v)), () => {
35
- e && (e.removeEventListener("keydown", p), e.removeEventListener("keydown", v));
92
+ const r = h(null), {
93
+ selectionInheritors: I,
94
+ getSelectionInheritors: p
95
+ } = R();
96
+ u(() => {
97
+ const e = r.current;
98
+ return e && (e.addEventListener("keydown", E), e.addEventListener("keydown", y)), () => {
99
+ e && (e.removeEventListener("keydown", E), e.removeEventListener("keydown", y));
36
100
  };
37
- }), c(() => {
38
- const e = s.current, n = D(f), r = x(f);
39
- return e && (e.addEventListener("keydown", n), e.addEventListener("click", r)), () => {
40
- e && (e.removeEventListener("keydown", n), e.removeEventListener("click", r));
101
+ }), u(() => {
102
+ const e = r.current, N = x(c), k = C(c);
103
+ return e && (e.addEventListener("keydown", N), e.addEventListener("click", k)), () => {
104
+ e && (e.removeEventListener("keydown", N), e.removeEventListener("click", k));
41
105
  };
42
- }), c(() => {
43
- d(i, a.selectedIds || a.defaultSelectedIds);
106
+ }), u(() => {
107
+ p(a, n.selectedIds || n.defaultSelectedIds);
44
108
  }, []);
45
- const I = w((e) => {
46
- d(i, Array.from(e.treeState.selectedIds)), l && l(e);
47
- }, [l, i, d]);
48
- return /* @__PURE__ */ t(L, {
109
+ const L = w((e) => {
110
+ p(a, Array.from(e.treeState.selectedIds)), i && i(e);
111
+ }, [i, a, p]);
112
+ return /* @__PURE__ */ t(g, {
49
113
  children: /* @__PURE__ */ t(S, {
50
- ref: s,
51
- "aria-label": u,
52
- className: g(K.tree, k),
53
- data: i,
54
- multiSelect: E,
55
- nodeRenderer: (e) => {
56
- const {
57
- variant: n
58
- } = e.element.metadata;
59
- if (n === "content" || n === "user") {
60
- const r = {
61
- ...e,
62
- size: o,
63
- withIcon: b
64
- };
65
- return /* @__PURE__ */ t(M, {
66
- ...r,
67
- containsSelection: y.includes(e.element.id)
68
- });
69
- }
70
- if (n === "loadMore") {
71
- const r = {
72
- ...e,
73
- size: o
74
- };
75
- return /* @__PURE__ */ t(m, {
76
- isDisabled: e.isDisabled,
77
- parentId: e.element.parent,
78
- variant: "loadMore",
79
- children: /* @__PURE__ */ t(R, {
80
- ...r
81
- })
82
- });
83
- }
84
- if (n === "reload") {
85
- const r = {
86
- ...e,
87
- size: o
88
- };
89
- return /* @__PURE__ */ t(m, {
90
- isDisabled: e.isDisabled,
91
- parentId: e.element.parent,
92
- variant: "reload",
93
- children: /* @__PURE__ */ t(H, {
94
- ...r
95
- })
96
- });
97
- }
98
- if (n === "loading") {
99
- const r = {
100
- ...e,
101
- size: o
102
- };
103
- return /* @__PURE__ */ t(m, {
104
- isDisabled: e.isDisabled,
105
- variant: "loading",
106
- children: /* @__PURE__ */ t(T, {
107
- ...r
108
- })
109
- });
110
- }
111
- return null;
112
- },
113
- onExpand: N,
114
- onSelect: I,
115
- ...a
114
+ ref: r,
115
+ "aria-label": d,
116
+ className: b(P.tree, f),
117
+ data: a,
118
+ multiSelect: l,
119
+ nodeRenderer: j(s, o, I),
120
+ onExpand: m,
121
+ onSelect: L,
122
+ ...n
116
123
  })
117
124
  });
118
125
  }
119
126
  export {
120
- U as Tree,
121
- U as default
127
+ X as Tree,
128
+ X as default
122
129
  };
@@ -0,0 +1 @@
1
+ ._label_km4kd_1{margin-bottom:.125rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;font-size:.625rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1rem;letter-spacing:.0375rem;text-transform:none;text-decoration:none}
@@ -0,0 +1 @@
1
+ export { NodeLabel } from './node-label';
@@ -0,0 +1,6 @@
1
+ import { TextProps } from '@box/blueprint-web';
2
+ export declare const NodeLabel: import('react').ForwardRefExoticComponent<Pick<TextProps, "color"> & {
3
+ isInTooltip?: boolean;
4
+ labelName: string;
5
+ labelValue: string;
6
+ } & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,9 @@
1
1
  type TruncatedTooltipTextProps = {
2
+ labelElementRef: React.MutableRefObject<HTMLElement>;
2
3
  textElementRef: React.MutableRefObject<HTMLElement>;
3
4
  subtitleElementRef: React.MutableRefObject<HTMLElement>;
4
5
  tooltipContent: string | React.ReactNode;
5
6
  children: React.ReactElement;
6
7
  };
7
- export declare function TruncatedTooltipText({ textElementRef, subtitleElementRef, tooltipContent, children, }: TruncatedTooltipTextProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function TruncatedTooltipText({ labelElementRef, textElementRef, subtitleElementRef, tooltipContent, children, }: TruncatedTooltipTextProps): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -1,6 +1,6 @@
1
1
  import { NodeId } from 'react-accessible-treeview';
2
- import { ContentNode, LoadMoreNode, LoadingNode, Node, ReloadNode } from '../types';
2
+ import { ContentNode, LoadMoreNode, LoadingNode, Node, LabeledNode, ReloadNode } from '../types';
3
3
  export declare const useSelectionInheritance: () => {
4
4
  selectionInheritors: NodeId[];
5
- getSelectionInheritors: (data: (Node | ContentNode | LoadMoreNode | LoadingNode | ReloadNode)[], selectedIds?: (string | NodeId)[]) => void;
5
+ getSelectionInheritors: (data: (Node | ContentNode | LabeledNode | LoadMoreNode | LoadingNode | ReloadNode)[], selectedIds?: (string | NodeId)[]) => void;
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { ComponentRecord } from '@box/storybook-utils';
2
- import { ContentNode, LoadingNode, LoadMoreNode, ReloadNode, TreeProps } from '../types';
2
+ import { ContentNode, LoadMoreNode, LoadingNode, ReloadNode, TreeProps } from '../types';
3
3
  declare const rootNode: ContentNode;
4
4
  declare const dataWithContentNodes: ContentNode[];
5
5
  declare const dataWithContentNodeWithTitle: ContentNode[];
@@ -1,7 +1,7 @@
1
1
  import { itemIconTable } from '@box/item-icon';
2
2
  import { INode, INodeRendererProps, ITreeViewOnSelectProps, ITreeViewProps, NodeId } from 'react-accessible-treeview';
3
3
  type Size = 'small' | 'large';
4
- type NodeVariant = 'user' | 'content' | 'loadMore' | 'loading' | 'reload';
4
+ type NodeVariant = 'user' | 'content' | 'labeled' | 'loadMore' | 'loading' | 'reload';
5
5
  type Badge = 'admin' | 'coadmin';
6
6
  type IconType = keyof typeof itemIconTable | 'trash';
7
7
  interface Node extends INode {
@@ -32,6 +32,16 @@ interface ContentNode extends INode {
32
32
  selectable?: boolean;
33
33
  };
34
34
  }
35
+ interface LabeledNode extends INode {
36
+ metadata: {
37
+ variant: 'labeled';
38
+ dataTargetId?: string;
39
+ isLoading?: boolean;
40
+ labelName: string;
41
+ labelValue: string;
42
+ selectable?: boolean;
43
+ };
44
+ }
35
45
  interface LoadMoreNode extends INode {
36
46
  metadata: {
37
47
  variant: 'loadMore';
@@ -50,7 +60,7 @@ interface LoadingNode extends INode {
50
60
  }
51
61
  interface TreeProps extends Omit<ITreeViewProps, 'nodeRenderer' | 'propagateSelectUpwards' | 'onLoadData'> {
52
62
  'aria-label': string;
53
- data: (Node | UserNode | ContentNode | LoadMoreNode | LoadingNode | ReloadNode)[];
63
+ data: (Node | UserNode | ContentNode | LabeledNode | LoadMoreNode | LoadingNode | ReloadNode)[];
54
64
  size?: Size;
55
65
  withIcons?: boolean;
56
66
  onLoadData?: (id: NodeId) => void;
@@ -58,10 +68,10 @@ interface TreeProps extends Omit<ITreeViewProps, 'nodeRenderer' | 'propagateSele
58
68
  interface NodeProps extends INodeRendererProps {
59
69
  size: Size;
60
70
  withIcon: boolean;
61
- element: Node | UserNode | ContentNode | LoadMoreNode | LoadingNode | ReloadNode;
71
+ element: Node | UserNode | ContentNode | LabeledNode | LoadMoreNode | LoadingNode | ReloadNode;
62
72
  }
63
73
  interface ContentNodeProps extends NodeProps {
64
- element: ContentNode | UserNode;
74
+ element: ContentNode | LabeledNode | UserNode;
65
75
  containsSelection: boolean;
66
76
  }
67
77
  interface LoadMoreNodeProps extends NodeProps {
@@ -73,4 +83,4 @@ interface ReloadNodeProps extends NodeProps {
73
83
  interface LoadingNodeProps extends NodeProps {
74
84
  element: LoadingNode;
75
85
  }
76
- export { ContentNode, ContentNodeProps, LoadingNode, LoadingNodeProps, LoadMoreNode, LoadMoreNodeProps, Node, NodeProps, ReloadNode, ReloadNodeProps, UserNode, type Badge, type IconType, type INode, type ITreeViewOnSelectProps, type NodeId, type NodeVariant, type Size, type TreeProps, };
86
+ export { ContentNode, ContentNodeProps, LoadingNode, LoadingNodeProps, LoadMoreNode, LoadMoreNodeProps, Node, NodeProps, LabeledNode, ReloadNode, ReloadNodeProps, UserNode, type Badge, type IconType, type INode, type ITreeViewOnSelectProps, type NodeId, type NodeVariant, type Size, type TreeProps, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/tree",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.11.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
@@ -11,9 +11,9 @@
11
11
  "react-intl": "^6.4.2"
12
12
  },
13
13
  "devDependencies": {
14
- "@box/blueprint-web": "^11.8.3",
14
+ "@box/blueprint-web": "^11.9.0",
15
15
  "@box/blueprint-web-assets": "^4.41.1",
16
- "@box/item-icon": "^0.9.129",
16
+ "@box/item-icon": "^0.9.131",
17
17
  "@box/storybook-utils": "^0.12.0",
18
18
  "@faker-js/faker": "^8.4.1",
19
19
  "react": "^18.3.0",