@box/tree 0.38.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.
Files changed (147) hide show
  1. package/LICENSE +379 -0
  2. package/chunks/node-icon.module.js +6 -0
  3. package/chunks/nodes.module.js +319 -0
  4. package/esm/index.js +23 -0
  5. package/esm/lib/components/content-node/content-node.js +132 -0
  6. package/esm/lib/components/content-node/index.js +4 -0
  7. package/esm/lib/components/content-node/messages.js +10 -0
  8. package/esm/lib/components/error/error.js +34 -0
  9. package/esm/lib/components/error/index.js +4 -0
  10. package/esm/lib/components/error/messages.js +18 -0
  11. package/esm/lib/components/expander/expander.js +33 -0
  12. package/esm/lib/components/expander/index.js +4 -0
  13. package/esm/lib/components/expander/messages.js +14 -0
  14. package/esm/lib/components/index.js +16 -0
  15. package/esm/lib/components/load-more-node/index.js +4 -0
  16. package/esm/lib/components/load-more-node/load-more-node.js +32 -0
  17. package/esm/lib/components/load-more-node/messages.js +14 -0
  18. package/esm/lib/components/loading-node/index.js +4 -0
  19. package/esm/lib/components/loading-node/loading-node.js +30 -0
  20. package/esm/lib/components/loading-node/messages.js +10 -0
  21. package/esm/lib/components/node-icon/index.js +6 -0
  22. package/esm/lib/components/node-icon/messages.js +10 -0
  23. package/esm/lib/components/node-icon/node-avatar.js +36 -0
  24. package/esm/lib/components/node-icon/node-item-icon.js +42 -0
  25. package/esm/lib/components/reload-node/index.js +4 -0
  26. package/esm/lib/components/reload-node/messages.js +22 -0
  27. package/esm/lib/components/reload-node/reload-node.js +52 -0
  28. package/esm/lib/components/service-node-wrapper/index.js +4 -0
  29. package/esm/lib/components/service-node-wrapper/service-node-wrapper.js +20 -0
  30. package/esm/lib/components/skeleton/index.js +4 -0
  31. package/esm/lib/components/skeleton/skeleton.js +22 -0
  32. package/esm/lib/components/truncated-tooltip-text/index.js +4 -0
  33. package/esm/lib/components/truncated-tooltip-text/truncated-tooltip-text.js +26 -0
  34. package/esm/lib/constants.js +9 -0
  35. package/esm/lib/hooks/index.js +6 -0
  36. package/esm/lib/hooks/useIntersectionObserver.js +18 -0
  37. package/esm/lib/hooks/useSelectionInheritance.js +21 -0
  38. package/esm/lib/tree.js +127 -0
  39. package/esm/lib/utils.js +53 -0
  40. package/i18n/bn-IN.js +16 -0
  41. package/i18n/bn-IN.properties +28 -0
  42. package/i18n/da-DK.js +16 -0
  43. package/i18n/da-DK.properties +28 -0
  44. package/i18n/de-DE.js +16 -0
  45. package/i18n/de-DE.properties +28 -0
  46. package/i18n/en-AU.js +16 -0
  47. package/i18n/en-AU.properties +28 -0
  48. package/i18n/en-CA.js +16 -0
  49. package/i18n/en-CA.properties +28 -0
  50. package/i18n/en-GB.js +16 -0
  51. package/i18n/en-GB.properties +28 -0
  52. package/i18n/en-US.js +16 -0
  53. package/i18n/en-US.properties +28 -0
  54. package/i18n/en-x-pseudo.js +16 -0
  55. package/i18n/en-x-pseudo.properties +28 -0
  56. package/i18n/es-419.js +16 -0
  57. package/i18n/es-419.properties +28 -0
  58. package/i18n/es-ES.js +16 -0
  59. package/i18n/es-ES.properties +28 -0
  60. package/i18n/fi-FI.js +16 -0
  61. package/i18n/fi-FI.properties +28 -0
  62. package/i18n/fr-CA.js +16 -0
  63. package/i18n/fr-CA.properties +28 -0
  64. package/i18n/fr-FR.js +16 -0
  65. package/i18n/fr-FR.properties +28 -0
  66. package/i18n/hi-IN.js +16 -0
  67. package/i18n/hi-IN.properties +28 -0
  68. package/i18n/it-IT.js +16 -0
  69. package/i18n/it-IT.properties +28 -0
  70. package/i18n/ja-JP.js +16 -0
  71. package/i18n/ja-JP.properties +28 -0
  72. package/i18n/json/src/lib/components/content-node/messages.json +1 -0
  73. package/i18n/json/src/lib/components/error/messages.json +1 -0
  74. package/i18n/json/src/lib/components/expander/messages.json +1 -0
  75. package/i18n/json/src/lib/components/load-more-node/messages.json +1 -0
  76. package/i18n/json/src/lib/components/loading-node/messages.json +1 -0
  77. package/i18n/json/src/lib/components/node-icon/messages.json +1 -0
  78. package/i18n/json/src/lib/components/reload-node/messages.json +1 -0
  79. package/i18n/ko-KR.js +16 -0
  80. package/i18n/ko-KR.properties +28 -0
  81. package/i18n/nb-NO.js +16 -0
  82. package/i18n/nb-NO.properties +28 -0
  83. package/i18n/nl-NL.js +16 -0
  84. package/i18n/nl-NL.properties +28 -0
  85. package/i18n/pl-PL.js +16 -0
  86. package/i18n/pl-PL.properties +28 -0
  87. package/i18n/pt-BR.js +16 -0
  88. package/i18n/pt-BR.properties +28 -0
  89. package/i18n/ru-RU.js +16 -0
  90. package/i18n/ru-RU.properties +28 -0
  91. package/i18n/sv-SE.js +16 -0
  92. package/i18n/sv-SE.properties +28 -0
  93. package/i18n/tr-TR.js +16 -0
  94. package/i18n/tr-TR.properties +28 -0
  95. package/i18n/zh-CN.js +16 -0
  96. package/i18n/zh-CN.properties +28 -0
  97. package/i18n/zh-TW.js +16 -0
  98. package/i18n/zh-TW.properties +28 -0
  99. package/package.json +55 -0
  100. package/styles/content-node.css +1 -0
  101. package/styles/error.css +1 -0
  102. package/styles/expander.css +1 -0
  103. package/styles/loading-node.css +1 -0
  104. package/styles/node-icon.css +1 -0
  105. package/styles/nodes.css +1 -0
  106. package/styles/reload-node.css +1 -0
  107. package/styles/skeleton.css +1 -0
  108. package/styles/tree.css +1 -0
  109. package/types/index.d.ts +3 -0
  110. package/types/lib/components/content-node/content-node.d.ts +2 -0
  111. package/types/lib/components/content-node/index.d.ts +1 -0
  112. package/types/lib/components/content-node/messages.d.ts +8 -0
  113. package/types/lib/components/error/error.d.ts +4 -0
  114. package/types/lib/components/error/index.d.ts +1 -0
  115. package/types/lib/components/error/messages.d.ts +18 -0
  116. package/types/lib/components/expander/expander.d.ts +11 -0
  117. package/types/lib/components/expander/index.d.ts +1 -0
  118. package/types/lib/components/expander/messages.d.ts +13 -0
  119. package/types/lib/components/index.d.ts +7 -0
  120. package/types/lib/components/load-more-node/index.d.ts +1 -0
  121. package/types/lib/components/load-more-node/load-more-node.d.ts +2 -0
  122. package/types/lib/components/load-more-node/messages.d.ts +13 -0
  123. package/types/lib/components/loading-node/index.d.ts +1 -0
  124. package/types/lib/components/loading-node/loading-node.d.ts +2 -0
  125. package/types/lib/components/loading-node/messages.d.ts +8 -0
  126. package/types/lib/components/node-icon/index.d.ts +2 -0
  127. package/types/lib/components/node-icon/messages.d.ts +8 -0
  128. package/types/lib/components/node-icon/node-avatar.d.ts +9 -0
  129. package/types/lib/components/node-icon/node-item-icon.d.ts +7 -0
  130. package/types/lib/components/reload-node/index.d.ts +1 -0
  131. package/types/lib/components/reload-node/messages.d.ts +23 -0
  132. package/types/lib/components/reload-node/reload-node.d.ts +2 -0
  133. package/types/lib/components/service-node-wrapper/index.d.ts +1 -0
  134. package/types/lib/components/service-node-wrapper/service-node-wrapper.d.ts +10 -0
  135. package/types/lib/components/skeleton/index.d.ts +1 -0
  136. package/types/lib/components/skeleton/skeleton.d.ts +4 -0
  137. package/types/lib/components/truncated-tooltip-text/index.d.ts +1 -0
  138. package/types/lib/components/truncated-tooltip-text/truncated-tooltip-text.d.ts +8 -0
  139. package/types/lib/constants.d.ts +6 -0
  140. package/types/lib/hooks/index.d.ts +2 -0
  141. package/types/lib/hooks/useIntersectionObserver.d.ts +1 -0
  142. package/types/lib/hooks/useSelectionInheritance.d.ts +6 -0
  143. package/types/lib/stories/dynamic-loading-shared.d.ts +30 -0
  144. package/types/lib/stories/shared.d.ts +17 -0
  145. package/types/lib/tree.d.ts +3 -0
  146. package/types/lib/types.d.ts +74 -0
  147. package/types/lib/utils.d.ts +5 -0
@@ -0,0 +1,32 @@
1
+ import { TextButton as i } from "@box/blueprint-web";
2
+ import c from "clsx";
3
+ import { useIntl as f } from "react-intl";
4
+ import n from "./messages.js";
5
+ import { s as e } from "../../../../chunks/nodes.module.js";
6
+ import { jsx as s } from "react/jsx-runtime";
7
+ function g({
8
+ level: a,
9
+ size: o,
10
+ isDisabled: d,
11
+ getNodeProps: m,
12
+ element: l
13
+ }) {
14
+ const r = f(), t = m();
15
+ return /* @__PURE__ */ s("div", {
16
+ ...t,
17
+ className: c("node", e.node, e[`node-${o}-level${a - 1}`], e[`node--${o}`], {
18
+ [e["node--focused"]]: t.className.includes("tree-node--focused"),
19
+ [e["node--disabled"]]: d
20
+ }),
21
+ children: /* @__PURE__ */ s(i, {
22
+ "aria-label": r.formatMessage(n.loadMoreButtonAriaLabel, {
23
+ nodeName: l.name
24
+ }),
25
+ tabIndex: -1,
26
+ children: r.formatMessage(n.loadMoreButtonTitle)
27
+ })
28
+ });
29
+ }
30
+ export {
31
+ g as LoadMoreNode
32
+ };
@@ -0,0 +1,14 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const o = e({
3
+ loadMoreButtonTitle: {
4
+ id: "groupSharedFeatures.tree.branch.loadMoreButtonTitle",
5
+ defaultMessage: "Load More"
6
+ },
7
+ loadMoreButtonAriaLabel: {
8
+ id: "groupSharedFeatures.tree.branch.loadMoreButtonAriaLabel",
9
+ defaultMessage: "Load More for {nodeName}"
10
+ }
11
+ });
12
+ export {
13
+ o as default
14
+ };
@@ -0,0 +1,4 @@
1
+ import { LoadingNode as e } from "./loading-node.js";
2
+ export {
3
+ e as LoadingNode
4
+ };
@@ -0,0 +1,30 @@
1
+ import { LoadingIndicator as n } from "@box/blueprint-web";
2
+ import m from "clsx";
3
+ import { useIntl as t } from "react-intl";
4
+ import i from "./messages.js";
5
+ import { s as o } from "../../../../chunks/nodes.module.js";
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ import '../../../../styles/loading-node.css';const c = "_loader_1d12s_1", f = {
8
+ loader: c
9
+ };
10
+ function L({
11
+ level: r,
12
+ size: e,
13
+ getNodeProps: d
14
+ }) {
15
+ const l = t(), s = d();
16
+ return /* @__PURE__ */ a("div", {
17
+ ...s,
18
+ className: m("node", o.node, o[`node-${e}-level${r - 1}`], o[`node--${e}`], {
19
+ [o["node--focused"]]: s.className.includes("tree-node--focused")
20
+ }),
21
+ children: /* @__PURE__ */ a(n, {
22
+ "aria-label": l.formatMessage(i.loadingIndicatorAriaLabel),
23
+ className: f.loader,
24
+ size: e === "small" ? "small" : "medium"
25
+ })
26
+ });
27
+ }
28
+ export {
29
+ L as LoadingNode
30
+ };
@@ -0,0 +1,10 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const o = e({
3
+ loadingIndicatorAriaLabel: {
4
+ id: "groupSharedFeatures.tree.branch.loadMore",
5
+ defaultMessage: "Loading more content"
6
+ }
7
+ });
8
+ export {
9
+ o as default
10
+ };
@@ -0,0 +1,6 @@
1
+ import { NodeAvatar as r } from "./node-avatar.js";
2
+ import { NodeItemIcon as m } from "./node-item-icon.js";
3
+ export {
4
+ r as NodeAvatar,
5
+ m as NodeItemIcon
6
+ };
@@ -0,0 +1,10 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const s = e({
3
+ iconLabel: {
4
+ id: "groupSharedFeatures.tree.node.conLabel",
5
+ defaultMessage: "Icon for {iconType}"
6
+ }
7
+ });
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,36 @@
1
+ import { IconBadge as e, Avatar as d } from "@box/blueprint-web";
2
+ import { useMemo as p } from "react";
3
+ import { s as t } from "../../../../chunks/node-icon.module.js";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ const i = {
6
+ admin: "collaborator-admin",
7
+ coadmin: "collaborator-coadmin"
8
+ };
9
+ function A({
10
+ avatarSrc: s,
11
+ badge: a,
12
+ size: m,
13
+ nodeTitle: o
14
+ }) {
15
+ const c = p(() => o.split(" ").map((n) => n[0]).join(""), [o]), l = /* @__PURE__ */ r(d, {
16
+ alt: o,
17
+ color: "BoxBlue50",
18
+ size: m === "small" ? "small" : "large",
19
+ src: s,
20
+ text: c
21
+ });
22
+ return a && i[a] ? /* @__PURE__ */ r("div", {
23
+ className: t.icon,
24
+ children: /* @__PURE__ */ r(e, {
25
+ size: m === "small" ? "small" : "medium",
26
+ variant: i[a],
27
+ children: l
28
+ })
29
+ }) : /* @__PURE__ */ r("div", {
30
+ className: t.icon,
31
+ children: l
32
+ });
33
+ }
34
+ export {
35
+ A as NodeAvatar
36
+ };
@@ -0,0 +1,42 @@
1
+ import { Trash as c } from "@box/blueprint-web-assets/icons/Fill";
2
+ import { Size6 as f, Size8 as I } from "@box/blueprint-web-assets/tokens/px-tokens";
3
+ import { itemIconTable as b, ItemIcon as r } from "@box/item-icon";
4
+ import { useIntl as d } from "react-intl";
5
+ import a from "./messages.js";
6
+ import { s as e } from "../../../../chunks/node-icon.module.js";
7
+ import { jsx as s } from "react/jsx-runtime";
8
+ const i = {
9
+ trash: c
10
+ };
11
+ function S({
12
+ size: n,
13
+ iconType: o
14
+ }) {
15
+ const m = d(), t = n === "small" ? f : I;
16
+ if (o && i[o]) {
17
+ const l = i[o];
18
+ return /* @__PURE__ */ s(l, {
19
+ ariaLabel: m.formatMessage(a.iconLabel, {
20
+ iconType: o
21
+ }),
22
+ className: e.icon,
23
+ height: t,
24
+ width: t
25
+ });
26
+ }
27
+ return o && b[o] ? /* @__PURE__ */ s(r, {
28
+ ariaLabel: m.formatMessage(a.iconLabel, {
29
+ iconType: o
30
+ }),
31
+ className: e.icon,
32
+ dimension: t,
33
+ iconType: o
34
+ }) : /* @__PURE__ */ s(r, {
35
+ className: e.icon,
36
+ dimension: t,
37
+ iconType: "default"
38
+ });
39
+ }
40
+ export {
41
+ S as NodeItemIcon
42
+ };
@@ -0,0 +1,4 @@
1
+ import { ReloadNode as d } from "./reload-node.js";
2
+ export {
3
+ d as ReloadNode
4
+ };
@@ -0,0 +1,22 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const a = e({
3
+ reloadButtonTitle: {
4
+ id: "groupSharedFeatures.tree.branch.reloadButtonTitle",
5
+ defaultMessage: "Reload"
6
+ },
7
+ reloadButtonAriaLabel: {
8
+ id: "groupSharedFeatures.tree.branch.reloadButtonAriaLabel",
9
+ defaultMessage: "Reload content for {nodeName}"
10
+ },
11
+ loadingError: {
12
+ id: "groupSharedFeatures.tree.branch.loadingError",
13
+ defaultMessage: "Loading Error"
14
+ },
15
+ iconAriaLabel: {
16
+ id: "groupSharedFeatures.tree.branch.loadingErrorIconAriaLabel",
17
+ defaultMessage: "Error"
18
+ }
19
+ });
20
+ export {
21
+ a as default
22
+ };
@@ -0,0 +1,52 @@
1
+ import { InlineNotice as m, TextButton as N } from "@box/blueprint-web";
2
+ import { ArrowsRotating as f } from "@box/blueprint-web-assets/icons/Line";
3
+ import x from "clsx";
4
+ import { useIntl as g } from "react-intl";
5
+ import t from "./messages.js";
6
+ import { s as e } from "../../../../chunks/nodes.module.js";
7
+ import { jsxs as p, Fragment as u, jsx as r } from "react/jsx-runtime";
8
+ import '../../../../styles/reload-node.css';const _ = "_errorNotice_a2ys7_1", l = {
9
+ errorNotice: _,
10
+ "errorNoticeText--large": "_errorNoticeText--large_a2ys7_6",
11
+ "errorNoticeText--small": "_errorNoticeText--small_a2ys7_16"
12
+ };
13
+ function I({
14
+ level: s,
15
+ size: o,
16
+ isDisabled: c,
17
+ getNodeProps: d,
18
+ element: n
19
+ }) {
20
+ const a = g(), i = d();
21
+ return /* @__PURE__ */ p(u, {
22
+ children: [/* @__PURE__ */ r("div", {
23
+ className: e[`node-${o}-level${s - 1}`],
24
+ children: /* @__PURE__ */ r(m, {
25
+ className: l.errorNotice,
26
+ variant: "error",
27
+ variantIconAriaLabel: a.formatMessage(t.iconAriaLabel),
28
+ children: /* @__PURE__ */ r("span", {
29
+ className: l[`errorNoticeText--${o}`],
30
+ children: n.metadata.error || a.formatMessage(t.loadingError)
31
+ })
32
+ })
33
+ }), /* @__PURE__ */ r("div", {
34
+ ...i,
35
+ className: x("node", e.node, e[`node-${o}-level${s - 1}`], e[`node--${o}`], {
36
+ [e["node--focused"]]: i.className.includes("tree-node--focused"),
37
+ [e["node--disabled"]]: c
38
+ }),
39
+ children: /* @__PURE__ */ r(N, {
40
+ "aria-label": a.formatMessage(t.reloadButtonAriaLabel, {
41
+ nodeName: n.name
42
+ }),
43
+ icon: f,
44
+ tabIndex: -1,
45
+ children: a.formatMessage(t.reloadButtonTitle)
46
+ })
47
+ })]
48
+ });
49
+ }
50
+ export {
51
+ I as ReloadNode
52
+ };
@@ -0,0 +1,4 @@
1
+ import { ServiceNodeWrapper as o } from "./service-node-wrapper.js";
2
+ export {
3
+ o as ServiceNodeWrapper
4
+ };
@@ -0,0 +1,20 @@
1
+ import { SERVICE_NODE_DATA_ATTRIBUTE as o, RELOAD_NODE_DATA_ATTRIBUTE as d, BRANCH_ID_DATA_ATTRIBUTE as A, LOAD_MORE_NODE_DATA_ATTRIBUTE as e } from "../../constants.js";
2
+ import { jsx as E } from "react/jsx-runtime";
3
+ function R({
4
+ isDisabled: t,
5
+ parentId: a,
6
+ variant: r,
7
+ children: _
8
+ }) {
9
+ const T = {
10
+ [`data-${o}`]: !0
11
+ };
12
+ return r === "reload" && (T[`data-${d}`] = !0, T[`data-${A}`] = a), r === "loadMore" && (T[`data-${e}`] = !0, T[`data-${A}`] = a), /* @__PURE__ */ E("div", {
13
+ "aria-disabled": t,
14
+ ...T,
15
+ children: _
16
+ });
17
+ }
18
+ export {
19
+ R as ServiceNodeWrapper
20
+ };
@@ -0,0 +1,4 @@
1
+ import { Skeleton as r } from "./skeleton.js";
2
+ export {
3
+ r as Skeleton
4
+ };
@@ -0,0 +1,22 @@
1
+ import { Ghost as r } from "@box/blueprint-web";
2
+ import { Size5 as n } from "@box/blueprint-web-assets/tokens/px-tokens";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ import '../../../../styles/skeleton.css';const s = "_skeleton_10rap_1", l = {
5
+ skeleton: s
6
+ }, i = 5;
7
+ function f({
8
+ rows: e = i
9
+ }) {
10
+ return /* @__PURE__ */ t("div", {
11
+ className: l.skeleton,
12
+ children: Array.from({
13
+ length: e
14
+ }, (m, o) => /* @__PURE__ */ t(r, {
15
+ height: n,
16
+ variant: "pill"
17
+ }, o))
18
+ });
19
+ }
20
+ export {
21
+ f as Skeleton
22
+ };
@@ -0,0 +1,4 @@
1
+ import { TruncatedTooltipText as e } from "./truncated-tooltip-text.js";
2
+ export {
3
+ e as TruncatedTooltipText
4
+ };
@@ -0,0 +1,26 @@
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({
5
+ textElementRef: e,
6
+ subtitleElementRef: o,
7
+ tooltipContent: s,
8
+ children: n
9
+ }) {
10
+ const [c, i] = a(!1);
11
+ return f(() => {
12
+ const t = () => {
13
+ const u = [e.current, o.current].some((r) => r && r.scrollWidth > r.offsetWidth);
14
+ i(u);
15
+ };
16
+ return t(), window.addEventListener("resize", t), () => {
17
+ window.removeEventListener("resize", t);
18
+ };
19
+ }, [e, o]), c ? /* @__PURE__ */ T(d, {
20
+ content: s,
21
+ children: n
22
+ }) : n;
23
+ }
24
+ export {
25
+ L as TruncatedTooltipText
26
+ };
@@ -0,0 +1,9 @@
1
+ const T = "servicenode", o = "loadmorenode", n = "reloadnode", A = "branchid", _ = "contentnode", E = "contentnodeloading";
2
+ export {
3
+ A as BRANCH_ID_DATA_ATTRIBUTE,
4
+ _ as CONTENT_NODE,
5
+ E as CONTENT_NODE_LOADING,
6
+ o as LOAD_MORE_NODE_DATA_ATTRIBUTE,
7
+ n as RELOAD_NODE_DATA_ATTRIBUTE,
8
+ T as SERVICE_NODE_DATA_ATTRIBUTE
9
+ };
@@ -0,0 +1,6 @@
1
+ import { useIntersectionObserver as o } from "./useIntersectionObserver.js";
2
+ import { useSelectionInheritance as n } from "./useSelectionInheritance.js";
3
+ export {
4
+ o as useIntersectionObserver,
5
+ n as useSelectionInheritance
6
+ };
@@ -0,0 +1,18 @@
1
+ import { useState as i, useEffect as c } from "react";
2
+ const u = {
3
+ rootMargin: "100px 0px"
4
+ };
5
+ function f(t) {
6
+ const [n, s] = i(!1), o = (e) => {
7
+ e[0].isIntersecting ? s(!1) : s(!0);
8
+ };
9
+ return c(() => {
10
+ const e = new IntersectionObserver(o, u), r = t.current;
11
+ return r && e.observe(r), () => {
12
+ r && e.unobserve(r);
13
+ };
14
+ }, [t]), n;
15
+ }
16
+ export {
17
+ f as useIntersectionObserver
18
+ };
@@ -0,0 +1,21 @@
1
+ import { useState as a, useCallback as u, useMemo as d } from "react";
2
+ const I = () => {
3
+ const [n, i] = a([]), o = u((s, l = []) => {
4
+ const r = [];
5
+ let e = l[0];
6
+ for (; e != null; ) {
7
+ const t = s.find((c) => c.id === e);
8
+ if (!t || t.parent == null || t.parent === void 0)
9
+ break;
10
+ e = t.parent, r.push(e);
11
+ }
12
+ i(r);
13
+ }, []);
14
+ return d(() => ({
15
+ selectionInheritors: n,
16
+ getSelectionInheritors: o
17
+ }), [n, o]);
18
+ };
19
+ export {
20
+ I as useSelectionInheritance
21
+ };
@@ -0,0 +1,127 @@
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";
4
+ import S from "react-accessible-treeview";
5
+ import { ContentNode as D } from "./components/content-node/content-node.js";
6
+ import "react-intl";
7
+ import "@box/blueprint-web-assets/icons/Fill";
8
+ import "@box/blueprint-web-assets/illustrations/Medium";
9
+ import "./components/error/messages.js";
10
+ import { jsx as t } from "react/jsx-runtime";
11
+ import { LoadMoreNode as x } from "./components/load-more-node/load-more-node.js";
12
+ import { LoadingNode as C } from "./components/loading-node/loading-node.js";
13
+ import { ReloadNode as M } from "./components/reload-node/reload-node.js";
14
+ import { ServiceNodeWrapper as m } from "./components/service-node-wrapper/service-node-wrapper.js";
15
+ import "@box/blueprint-web-assets/tokens/px-tokens";
16
+ import { useSelectionInheritance as R } from "./hooks/useSelectionInheritance.js";
17
+ import { preventDisabledNodeExpanding as p, preventLoadingContentNodeExpanding as v, serviceNodeKeyboardHandler as H, serviceNodeClickHandler as T } from "./utils.js";
18
+ import '../../styles/tree.css';const _ = "_tree_17956_1", K = {
19
+ tree: _
20
+ };
21
+ function z({
22
+ "aria-label": u,
23
+ size: o = "small",
24
+ data: i,
25
+ withIcons: b = !1,
26
+ onExpand: N,
27
+ onSelect: l,
28
+ onLoadData: f,
29
+ className: k,
30
+ multiSelect: E = !1,
31
+ ...a
32
+ }) {
33
+ const s = h(null), {
34
+ selectionInheritors: y,
35
+ getSelectionInheritors: d
36
+ } = R();
37
+ c(() => {
38
+ const e = s.current;
39
+ return e && (e.addEventListener("keydown", p), e.addEventListener("keydown", v)), () => {
40
+ e && (e.removeEventListener("keydown", p), e.removeEventListener("keydown", v));
41
+ };
42
+ }), c(() => {
43
+ const e = s.current, n = H(f), r = T(f);
44
+ return e && (e.addEventListener("keydown", n), e.addEventListener("click", r)), () => {
45
+ e && (e.removeEventListener("keydown", n), e.removeEventListener("click", r));
46
+ };
47
+ }), c(() => {
48
+ d(i, a.selectedIds || a.defaultSelectedIds);
49
+ }, []);
50
+ const I = w((e) => {
51
+ d(i, Array.from(e.treeState.selectedIds)), l && l(e);
52
+ }, [l, i, d]);
53
+ return /* @__PURE__ */ t(L, {
54
+ children: /* @__PURE__ */ t(S, {
55
+ ref: s,
56
+ "aria-label": u,
57
+ className: g(K.tree, k),
58
+ data: i,
59
+ multiSelect: E,
60
+ nodeRenderer: (e) => {
61
+ const {
62
+ variant: n
63
+ } = e.element.metadata;
64
+ if (n === "content" || n === "user") {
65
+ const r = {
66
+ ...e,
67
+ size: o,
68
+ withIcon: b
69
+ };
70
+ return /* @__PURE__ */ t(D, {
71
+ ...r,
72
+ containsSelection: y.includes(e.element.id)
73
+ });
74
+ }
75
+ if (n === "loadMore") {
76
+ const r = {
77
+ ...e,
78
+ size: o
79
+ };
80
+ return /* @__PURE__ */ t(m, {
81
+ isDisabled: e.isDisabled,
82
+ parentId: e.element.parent,
83
+ variant: "loadMore",
84
+ children: /* @__PURE__ */ t(x, {
85
+ ...r
86
+ })
87
+ });
88
+ }
89
+ if (n === "reload") {
90
+ const r = {
91
+ ...e,
92
+ size: o
93
+ };
94
+ return /* @__PURE__ */ t(m, {
95
+ isDisabled: e.isDisabled,
96
+ parentId: e.element.parent,
97
+ variant: "reload",
98
+ children: /* @__PURE__ */ t(M, {
99
+ ...r
100
+ })
101
+ });
102
+ }
103
+ if (n === "loading") {
104
+ const r = {
105
+ ...e,
106
+ size: o
107
+ };
108
+ return /* @__PURE__ */ t(m, {
109
+ isDisabled: e.isDisabled,
110
+ variant: "loading",
111
+ children: /* @__PURE__ */ t(C, {
112
+ ...r
113
+ })
114
+ });
115
+ }
116
+ return null;
117
+ },
118
+ onExpand: N,
119
+ onSelect: I,
120
+ ...a
121
+ })
122
+ });
123
+ }
124
+ export {
125
+ z as Tree,
126
+ z as default
127
+ };
@@ -0,0 +1,53 @@
1
+ import { CONTENT_NODE as s, SERVICE_NODE_DATA_ATTRIBUTE as i, CONTENT_NODE_LOADING as a, BRANCH_ID_DATA_ATTRIBUTE as u, LOAD_MORE_NODE_DATA_ATTRIBUTE as f, RELOAD_NODE_DATA_ATTRIBUTE as A } from "./constants.js";
2
+ const C = (t) => {
3
+ t.code === "ArrowRight" && t.target.getAttribute("aria-disabled") === "true" && t.stopPropagation();
4
+ }, l = (t) => {
5
+ var r;
6
+ return t.closest(`[data-${s}="true"]`) || ((r = t.firstChild) != null && r.dataset && t.firstChild.dataset[s] === "true" ? t.firstChild : null);
7
+ }, d = (t) => {
8
+ var r;
9
+ return t.closest(`[data-${i}="true"]`) || ((r = t.firstChild) != null && r.dataset && t.firstChild.dataset[i] === "true" ? t.firstChild : null);
10
+ }, N = (t) => t.dataset[f] === "true", T = (t) => t.dataset[A] === "true", E = (t) => t.dataset[a] === "true", n = (t) => {
11
+ t.dispatchEvent(new KeyboardEvent("keydown", {
12
+ code: "ArrowUp",
13
+ key: "ArrowUp",
14
+ bubbles: !0
15
+ }));
16
+ }, p = (t) => {
17
+ const r = document.querySelector('[role="tree"] [tabindex="0"]');
18
+ if (r) {
19
+ if (r === t || t.contains(r)) {
20
+ n(t);
21
+ return;
22
+ }
23
+ r.focus();
24
+ }
25
+ }, c = (t, r) => {
26
+ if (t.getAttribute("aria-disabled") === "true" || !N(t) && !T(t))
27
+ return;
28
+ const o = t.dataset[u];
29
+ o && r(o);
30
+ }, D = (t) => (r) => {
31
+ if (r.code !== "Enter" && r.code !== "Space" && r.code !== "ArrowRight" && r.code !== "ArrowLeft")
32
+ return;
33
+ const o = d(r.target);
34
+ o && (r.stopPropagation(), !(r.code === "ArrowRight" || r.code === "ArrowLeft") && t && c(o, (e) => {
35
+ n(o), t(e);
36
+ }));
37
+ }, R = (t) => (r) => {
38
+ const o = d(r.target);
39
+ o && (r.stopPropagation(), t && c(o, (e) => {
40
+ p(o), t(e);
41
+ }));
42
+ }, b = (t) => {
43
+ if (t.code !== "ArrowRight")
44
+ return;
45
+ const r = l(t.target);
46
+ r && E(r) && t.stopPropagation();
47
+ };
48
+ export {
49
+ C as preventDisabledNodeExpanding,
50
+ b as preventLoadingContentNodeExpanding,
51
+ R as serviceNodeClickHandler,
52
+ D as serviceNodeKeyboardHandler
53
+ };
package/i18n/bn-IN.js ADDED
@@ -0,0 +1,16 @@
1
+ export default {
2
+ "groupSharedFeatures.tree.branch.loadMore": "আরও বিষয়বস্তু লোড করা হচ্ছে",
3
+ "groupSharedFeatures.tree.branch.loadMoreButtonAriaLabel": "{nodeName} এর জন্য আরও লোড করুন",
4
+ "groupSharedFeatures.tree.branch.loadMoreButtonTitle": "আরও লোড করুন",
5
+ "groupSharedFeatures.tree.branch.loaderLabel": "শাখার জন্য বিষয়বস্তু লোড করা হচ্ছে",
6
+ "groupSharedFeatures.tree.branch.loadingError": "ত্রুটি লোড করা হচ্ছে",
7
+ "groupSharedFeatures.tree.branch.loadingErrorIconAriaLabel": "ত্রুটি",
8
+ "groupSharedFeatures.tree.branch.reloadButtonAriaLabel": "{nodeName} এর জন্য বিষয়বস্তু রিলোড করুন",
9
+ "groupSharedFeatures.tree.branch.reloadButtonTitle": "রিলোড করুন",
10
+ "groupSharedFeatures.tree.error.body": "আবার চেষ্টা করার জন্য পুনরায় লোড করুন।",
11
+ "groupSharedFeatures.tree.error.reload": "রিলোড করুন",
12
+ "groupSharedFeatures.tree.error.title": "ট্রি লোড করা যাচ্ছে না",
13
+ "groupSharedFeatures.tree.expander.collapse": "শাখা সংকুচিত করুন",
14
+ "groupSharedFeatures.tree.expander.expand": "শাখা সম্প্রসারণ করুন",
15
+ "groupSharedFeatures.tree.node.conLabel": "{iconType} এর জন্য আইকন"
16
+ }
@@ -0,0 +1,28 @@
1
+ # Aria label for the loading indicator that appears when the user clicks the 'Load more' or 'Reload' button
2
+ groupSharedFeatures.tree.branch.loadMore = আরও বিষয়বস্তু লোড করা হচ্ছে
3
+ # Aria label for the 'Load More' button
4
+ groupSharedFeatures.tree.branch.loadMoreButtonAriaLabel = {nodeName} এর জন্য আরও লোড করুন
5
+ # Title for the 'Load More' button
6
+ groupSharedFeatures.tree.branch.loadMoreButtonTitle = আরও লোড করুন
7
+ # Aria label for the loading indicator when a branch's content is loading
8
+ groupSharedFeatures.tree.branch.loaderLabel = শাখার জন্য বিষয়বস্তু লোড করা হচ্ছে
9
+ # Message displayed in an inline notice when loading failed
10
+ groupSharedFeatures.tree.branch.loadingError = ত্রুটি লোড করা হচ্ছে
11
+ # Aria label for the error icon in the error inline notice
12
+ groupSharedFeatures.tree.branch.loadingErrorIconAriaLabel = ত্রুটি
13
+ # Aria label for the 'Reload' button
14
+ groupSharedFeatures.tree.branch.reloadButtonAriaLabel = {nodeName} এর জন্য বিষয়বস্তু রিলোড করুন
15
+ # Title for the 'Reload' button
16
+ groupSharedFeatures.tree.branch.reloadButtonTitle = রিলোড করুন
17
+ # Body for the error message when the tree fails to load
18
+ groupSharedFeatures.tree.error.body = আবার চেষ্টা করার জন্য পুনরায় লোড করুন।
19
+ # Button text to reload tree
20
+ groupSharedFeatures.tree.error.reload = রিলোড করুন
21
+ # Title for the error message when the tree fails to load
22
+ groupSharedFeatures.tree.error.title = ট্রি লোড করা যাচ্ছে না
23
+ # Aria label for the collapse button
24
+ groupSharedFeatures.tree.expander.collapse = শাখা সংকুচিত করুন
25
+ # Aria label for the expand button
26
+ groupSharedFeatures.tree.expander.expand = শাখা সম্প্রসারণ করুন
27
+ # Aria label for the icon in a node
28
+ groupSharedFeatures.tree.node.conLabel = {iconType} এর জন্য আইকন