@box/metadata-template-browser 1.17.7 → 1.17.9

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 (68) hide show
  1. package/dist/chunks/breadcrumb-navigation.js +35 -0
  2. package/dist/chunks/browser-row.js +52 -0
  3. package/dist/chunks/grid-list-load-more-sentinel.js +31 -0
  4. package/dist/chunks/load-more-error-row.js +36 -0
  5. package/dist/chunks/load-more-loading-row.js +26 -0
  6. package/dist/chunks/loader-skeleton.js +16 -0
  7. package/dist/chunks/metadata-template-browser-container.js +31 -0
  8. package/dist/chunks/metadata-template-browser-controller.js +36 -0
  9. package/dist/chunks/metadata-template-browser-list-box.js +57 -0
  10. package/dist/chunks/types.js +4 -6
  11. package/dist/chunks/virtualized-grid-list.js +54 -0
  12. package/dist/esm/index.js +2 -4
  13. package/dist/esm/lib/components/breadcrumb-navigation/breadcrumb-navigation.js +2 -51
  14. package/dist/esm/lib/components/breadcrumb-navigation/index.js +2 -4
  15. package/dist/esm/lib/components/breadcrumb-navigation/messages.js +14 -16
  16. package/dist/esm/lib/components/browse-list/browse-list.js +57 -82
  17. package/dist/esm/lib/components/browse-list/index.js +1 -3
  18. package/dist/esm/lib/components/browse-list/messages.js +14 -16
  19. package/dist/esm/lib/components/browser-row/browser-row.js +2 -63
  20. package/dist/esm/lib/components/browser-row/index.js +2 -4
  21. package/dist/esm/lib/components/error-state/error-state.js +22 -31
  22. package/dist/esm/lib/components/error-state/index.js +2 -4
  23. package/dist/esm/lib/components/error-state/messages.js +5 -9
  24. package/dist/esm/lib/components/index.js +12 -24
  25. package/dist/esm/lib/components/load-more-feedback/index.js +3 -6
  26. package/dist/esm/lib/components/load-more-feedback/load-more-error-row.js +2 -44
  27. package/dist/esm/lib/components/load-more-feedback/load-more-loading-row.js +2 -34
  28. package/dist/esm/lib/components/load-more-feedback/messages.js +18 -20
  29. package/dist/esm/lib/components/loader-skeleton/index.js +2 -4
  30. package/dist/esm/lib/components/loader-skeleton/loader-skeleton.js +2 -26
  31. package/dist/esm/lib/components/messages.js +26 -28
  32. package/dist/esm/lib/components/metadata-template-browser-container.js +2 -35
  33. package/dist/esm/lib/components/metadata-template-browser-controller.js +2 -58
  34. package/dist/esm/lib/components/metadata-template-browser-list-box/index.js +2 -4
  35. package/dist/esm/lib/components/metadata-template-browser-list-box/metadata-template-browser-list-box.js +2 -65
  36. package/dist/esm/lib/components/namespace-row/index.js +2 -4
  37. package/dist/esm/lib/components/namespace-row/messages.js +5 -9
  38. package/dist/esm/lib/components/namespace-row/namespace-row.js +21 -31
  39. package/dist/esm/lib/components/search-list/index.js +2 -4
  40. package/dist/esm/lib/components/search-list/messages.js +18 -20
  41. package/dist/esm/lib/components/search-list/search-list.js +53 -75
  42. package/dist/esm/lib/components/template-row/index.js +2 -4
  43. package/dist/esm/lib/components/template-row/messages.js +5 -9
  44. package/dist/esm/lib/components/template-row/template-row.js +47 -68
  45. package/dist/esm/lib/components/virtualized-grid-list/grid-list-load-more-sentinel.js +2 -49
  46. package/dist/esm/lib/components/virtualized-grid-list/index.js +2 -4
  47. package/dist/esm/lib/components/virtualized-grid-list/messages.js +5 -9
  48. package/dist/esm/lib/components/virtualized-grid-list/virtualized-grid-list.js +2 -66
  49. package/dist/esm/lib/constants.js +2 -14
  50. package/dist/esm/lib/contexts/contexts.js +88 -123
  51. package/dist/esm/lib/contexts/hooks.js +25 -38
  52. package/dist/esm/lib/contexts/index.js +4 -16
  53. package/dist/esm/lib/contexts/provider.js +50 -58
  54. package/dist/esm/lib/contexts/reducer.js +151 -178
  55. package/dist/esm/lib/contexts/use-template-browser-actions.js +224 -263
  56. package/dist/esm/lib/hooks/use-is-initial-browse-loading.js +5 -15
  57. package/dist/esm/lib/metadata-template-browser.js +16 -25
  58. package/dist/styles/breadcrumb-navigation.css +1 -1
  59. package/dist/styles/browser-row.css +1 -1
  60. package/dist/styles/grid-list-load-more-sentinel.css +1 -1
  61. package/dist/styles/load-more-error-row.css +1 -1
  62. package/dist/styles/load-more-loading-row.css +1 -1
  63. package/dist/styles/loader-skeleton.css +1 -1
  64. package/dist/styles/metadata-template-browser-container.css +1 -1
  65. package/dist/styles/metadata-template-browser-controller.css +1 -1
  66. package/dist/styles/metadata-template-browser-list-box.css +1 -1
  67. package/dist/styles/virtualized-grid-list.css +1 -1
  68. package/package.json +7 -7
@@ -0,0 +1,35 @@
1
+ import { useBrowserActions as e, useConsumerState as t, useNavigationState as n, useSearchState as r } from "../esm/lib/contexts/hooks.js";
2
+ import { messages as i } from "../esm/lib/components/breadcrumb-navigation/messages.js";
3
+ import { Breadcrumb as a } from "@box/blueprint-web";
4
+ import o from "clsx";
5
+ import { useIntl as s } from "react-intl";
6
+ import { jsx as c } from "react/jsx-runtime";
7
+ import '../styles/breadcrumb-navigation.css';var l = {
8
+ breadcrumb: "_breadcrumb_a03s0_1",
9
+ disabled: "_disabled_a03s0_6"
10
+ };
11
+ function u() {
12
+ let { formatMessage: u } = s(), { isDisabled: d } = t(), { path: f, namespaceFQN: p } = n(), { searchValue: m } = r(), { navigateBack: h } = e();
13
+ if (m.length > 0) return null;
14
+ let g = f[0], _ = g ? g.fqn.split(".").slice(0, -1).join(".") : p, v = f.at(-1)?.fqn ?? p, y = [{
15
+ id: _,
16
+ name: u(i.enterpriseCrumbLabel)
17
+ }, ...f.map((e) => ({
18
+ id: e.fqn,
19
+ name: e.displayName
20
+ }))], b = (e) => {
21
+ d || e !== v && h(e);
22
+ };
23
+ return /* @__PURE__ */ c("div", {
24
+ className: o(l.breadcrumb, { [l.disabled]: d }),
25
+ children: /* @__PURE__ */ c(a, {
26
+ breadcrumbAriaLabel: u(i.breadcrumbAriaLabel),
27
+ crumbs: y,
28
+ isInteractive: !d,
29
+ onPageLinkClick: b,
30
+ size: "small",
31
+ truncatedLinksIconAriaLabel: u(i.truncatedLinksIconAriaLabel)
32
+ })
33
+ });
34
+ }
35
+ export { u as t };
@@ -0,0 +1,52 @@
1
+ import { useConsumerState as e } from "../esm/lib/contexts/hooks.js";
2
+ import { EllipsizableText as t } from "@box/blueprint-web";
3
+ import n from "clsx";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { GridListItem as a } from "react-aria-components";
6
+ import '../styles/browser-row.css';var o = {
7
+ row: "_row_ybl3t_2",
8
+ trailingSlotHoverOnly: "_trailingSlotHoverOnly_ybl3t_15",
9
+ item: "_item_ybl3t_19",
10
+ disabled: "_disabled_ybl3t_40",
11
+ leadingIcon: "_leadingIcon_ybl3t_59",
12
+ content: "_content_ybl3t_66",
13
+ trailingSlot: "_trailingSlot_ybl3t_15",
14
+ subtitle: "_subtitle_ybl3t_77"
15
+ };
16
+ function s({ id: s, leadingIcon: c, title: l, subtitle: u, trailingSlot: d, isTrailingSlotHoverOnly: f }) {
17
+ let { isDisabled: p } = e(), m = n(o.trailingSlot, { [o.trailingSlotHoverOnly]: f });
18
+ return /* @__PURE__ */ r(a, {
19
+ className: n(o.item, { [o.disabled]: p }),
20
+ id: s,
21
+ isDisabled: p,
22
+ textValue: l,
23
+ children: /* @__PURE__ */ i("div", {
24
+ className: o.row,
25
+ children: [
26
+ c !== void 0 && /* @__PURE__ */ r("div", {
27
+ "aria-hidden": "true",
28
+ className: o.leadingIcon,
29
+ "data-testid": "leading-icon",
30
+ children: c
31
+ }),
32
+ /* @__PURE__ */ i("div", {
33
+ className: o.content,
34
+ children: [/* @__PURE__ */ r(t, {
35
+ as: "span",
36
+ lineClamp: 1,
37
+ variant: "bodyDefault",
38
+ children: l
39
+ }), u && /* @__PURE__ */ r("div", {
40
+ className: o.subtitle,
41
+ children: u
42
+ })]
43
+ }),
44
+ d !== void 0 && /* @__PURE__ */ r("div", {
45
+ className: m,
46
+ children: d
47
+ })
48
+ ]
49
+ })
50
+ });
51
+ }
52
+ export { s as t };
@@ -0,0 +1,31 @@
1
+ import { LOAD_MORE_SENTINEL_ID as e } from "../esm/lib/constants.js";
2
+ import { messages as t } from "../esm/lib/components/virtualized-grid-list/messages.js";
3
+ import { useIntl as n } from "react-intl";
4
+ import { useEffect as r, useRef as i } from "react";
5
+ import { jsx as a } from "react/jsx-runtime";
6
+ import { GridListItem as o } from "react-aria-components";
7
+ import '../styles/grid-list-load-more-sentinel.css';var s = { sentinel: "_sentinel_im31a_1" };
8
+ function c({ onLoadMore: c, scrollContainerRef: l }) {
9
+ let u = i(c);
10
+ u.current = c;
11
+ let { formatMessage: d } = n(), f = d(t.loadMoreSentinelAriaLabel);
12
+ return r(() => {
13
+ let e = l.current, t, n = !1, r = () => {
14
+ if (!e || n) return;
15
+ let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
16
+ r - t - i <= i && (n = !0, u.current());
17
+ }, i = () => {
18
+ cancelAnimationFrame(t), t = requestAnimationFrame(r);
19
+ };
20
+ return e?.addEventListener("scroll", i, { passive: !0 }), t = requestAnimationFrame(r), () => {
21
+ e?.removeEventListener("scroll", i), cancelAnimationFrame(t);
22
+ };
23
+ }, [l]), /* @__PURE__ */ a(o, {
24
+ "aria-hidden": "true",
25
+ className: s.sentinel,
26
+ id: e,
27
+ isDisabled: !0,
28
+ textValue: f
29
+ });
30
+ }
31
+ export { c as t };
@@ -0,0 +1,36 @@
1
+ import { LOAD_MORE_ERROR_ROW_ID as e } from "../esm/lib/constants.js";
2
+ import { useConsumerState as t } from "../esm/lib/contexts/hooks.js";
3
+ import { messages as n } from "../esm/lib/components/load-more-feedback/messages.js";
4
+ import { InlineNotice as r, TextButton as i } from "@box/blueprint-web";
5
+ import { useIntl as a } from "react-intl";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { GridListItem as c } from "react-aria-components";
8
+ import { Loader as l } from "@box/blueprint-web-assets/icons/Fill";
9
+ import '../styles/load-more-error-row.css';var u = {
10
+ container: "_container_1bidp_1",
11
+ item: "_item_1bidp_9"
12
+ };
13
+ function d({ onRetry: d }) {
14
+ let { formatMessage: f } = a(), { isDisabled: p } = t();
15
+ return /* @__PURE__ */ o(c, {
16
+ className: u.item,
17
+ id: e,
18
+ textValue: f(n.loadMoreErrorBody),
19
+ children: /* @__PURE__ */ s("div", {
20
+ className: u.container,
21
+ children: [/* @__PURE__ */ o(r, {
22
+ variant: "error",
23
+ variantIconAriaLabel: f(n.errorIconAriaLabel),
24
+ children: f(n.loadMoreErrorBody)
25
+ }), /* @__PURE__ */ o(i, {
26
+ disabled: p,
27
+ icon: l,
28
+ onClick: (e) => {
29
+ e.stopPropagation(), !p && d();
30
+ },
31
+ children: f(n.retryLabel)
32
+ })]
33
+ })
34
+ });
35
+ }
36
+ export { d as t };
@@ -0,0 +1,26 @@
1
+ import { LOAD_MORE_LOADING_ROW_ID as e } from "../esm/lib/constants.js";
2
+ import { messages as t } from "../esm/lib/components/load-more-feedback/messages.js";
3
+ import { Ghost as n } from "@box/blueprint-web";
4
+ import { useIntl as r } from "react-intl";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { GridListItem as o } from "react-aria-components";
7
+ import '../styles/load-more-loading-row.css';var s = { container: "_container_1rh3v_1" };
8
+ function c() {
9
+ let { formatMessage: c } = r(), l = c(t.loadingRowAriaLabel);
10
+ return /* @__PURE__ */ i(o, {
11
+ "aria-busy": "true",
12
+ "aria-label": l,
13
+ id: e,
14
+ isDisabled: !0,
15
+ textValue: l,
16
+ children: /* @__PURE__ */ a("div", {
17
+ className: s.container,
18
+ children: [
19
+ /* @__PURE__ */ i(n, { height: 16 }),
20
+ /* @__PURE__ */ i(n, { height: 16 }),
21
+ /* @__PURE__ */ i(n, { height: 16 })
22
+ ]
23
+ })
24
+ });
25
+ }
26
+ export { c as t };
@@ -0,0 +1,16 @@
1
+ import { messages as e } from "../esm/lib/components/messages.js";
2
+ import { Ghost as t } from "@box/blueprint-web";
3
+ import { useIntl as n } from "react-intl";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import '../styles/loader-skeleton.css';var i = { loaderSkeleton: "_loaderSkeleton_hxe4x_1" }, a = 16, o = 20;
6
+ function s() {
7
+ let { formatMessage: s } = n();
8
+ return /* @__PURE__ */ r("div", {
9
+ "aria-busy": "true",
10
+ "aria-label": s(e.loadingAriaLabel),
11
+ className: i.loaderSkeleton,
12
+ role: "status",
13
+ children: Array.from({ length: o }, (e, n) => /* @__PURE__ */ r(t, { height: a }, n))
14
+ });
15
+ }
16
+ export { s as t };
@@ -0,0 +1,31 @@
1
+ import { useBrowserActions as e, useConsumerState as t } from "../esm/lib/contexts/hooks.js";
2
+ import { t as n } from "./breadcrumb-navigation.js";
3
+ import { messages as r } from "../esm/lib/components/messages.js";
4
+ import { useIsInitialBrowseLoading as i } from "../esm/lib/hooks/use-is-initial-browse-loading.js";
5
+ import { t as a } from "./metadata-template-browser-list-box.js";
6
+ import { SearchInput as o } from "@box/blueprint-web";
7
+ import { useIntl as s } from "react-intl";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ import '../styles/metadata-template-browser-container.css';var u = {
10
+ container: "_container_qa97y_1",
11
+ searchInput: "_searchInput_qa97y_9"
12
+ };
13
+ function d() {
14
+ let { formatMessage: d } = s(), { isDisabled: f } = t(), { setSearchValue: p } = e(), m = i();
15
+ return /* @__PURE__ */ l("div", {
16
+ className: u.container,
17
+ children: [
18
+ /* @__PURE__ */ c(o, {
19
+ className: u.searchInput,
20
+ disabled: f || m,
21
+ onChange: p,
22
+ placeholder: d(r.searchInputPlaceholder),
23
+ searchInputAriaLabel: d(r.searchInputAriaLabel),
24
+ searchInputClearAriaLabel: d(r.searchInputClearAriaLabel)
25
+ }),
26
+ !m && /* @__PURE__ */ c(n, {}),
27
+ /* @__PURE__ */ c(a, {})
28
+ ]
29
+ });
30
+ }
31
+ export { d as t };
@@ -0,0 +1,36 @@
1
+ import { useBrowseState as e, useBrowserActions as t, useConsumerState as n, useNavigationState as r } from "../esm/lib/contexts/hooks.js";
2
+ import { ErrorState as i } from "../esm/lib/components/error-state/error-state.js";
3
+ import { messages as a } from "../esm/lib/components/messages.js";
4
+ import { t as o } from "./metadata-template-browser-container.js";
5
+ import { EmptyState as s, Text as c } from "@box/blueprint-web";
6
+ import { useIntl as l } from "react-intl";
7
+ import { useEffect as u, useRef as d } from "react";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import { NoTemplates as m } from "@box/blueprint-web-assets/illustrations/Medium";
10
+ import '../styles/metadata-template-browser-controller.css';var h = { container: "_container_14phx_1" };
11
+ function g() {
12
+ let { isLoading: g } = n(), { formatMessage: _ } = l(), { initialLoad: v, retry: y } = t(), { path: b } = r(), { isFetching: x, initialLoadError: S, namespaces: C, templates: w } = e(), T = d(!1);
13
+ u(() => {
14
+ !g && !T.current && (T.current = !0, v());
15
+ }, [g, v]);
16
+ let E = C.length > 0 || w.length > 0, D = S !== null, O = b.length === 0, k = !x && !g && !E && !D && O, A = !D && !k;
17
+ return /* @__PURE__ */ p("div", {
18
+ className: h.container,
19
+ children: [
20
+ D && /* @__PURE__ */ f(i, {
21
+ body: _(a.initialLoadErrorBody),
22
+ onRetry: y
23
+ }),
24
+ k && /* @__PURE__ */ f(s, {
25
+ body: /* @__PURE__ */ f(c, {
26
+ as: "p",
27
+ children: _(a.initialEmptyStateBody)
28
+ }),
29
+ illustration: m,
30
+ size: "small"
31
+ }),
32
+ A && /* @__PURE__ */ f(o, {})
33
+ ]
34
+ });
35
+ }
36
+ export { g as t };
@@ -0,0 +1,57 @@
1
+ import { useBrowseState as e, useBrowserActions as t, useConsumerState as n, useSearchState as r, useSelectionState as i } from "../esm/lib/contexts/hooks.js";
2
+ import { t as a } from "./loader-skeleton.js";
3
+ import { BrowseList as o } from "../esm/lib/components/browse-list/browse-list.js";
4
+ import { SearchList as s } from "../esm/lib/components/search-list/search-list.js";
5
+ import { useIsInitialBrowseLoading as c } from "../esm/lib/hooks/use-is-initial-browse-loading.js";
6
+ import l from "clsx";
7
+ import { useCallback as u, useMemo as d } from "react";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import '../styles/metadata-template-browser-list-box.css';var m = {
10
+ listBox: "_listBox_1qbmg_1",
11
+ browseWrapper: "_browseWrapper_1qbmg_9",
12
+ hidden: "_hidden_1qbmg_16"
13
+ };
14
+ function h() {
15
+ let { isDisabled: h } = n(), g = c(), { searchValue: _, searchResults: v } = r(), { namespaces: y, templates: b } = e(), { selectedTemplateId: x } = i(), { selectTemplate: S, navigateTo: C } = t(), w = _.length > 0, T = u((e) => {
16
+ if (h) return;
17
+ let t = String(e);
18
+ if (w) {
19
+ let e = v.find((e) => e.id === t);
20
+ e && S(e);
21
+ return;
22
+ }
23
+ let n = b.find((e) => e.id === t);
24
+ if (n) {
25
+ S(n);
26
+ return;
27
+ }
28
+ let r = y.find((e) => e.id === t);
29
+ r && C(r);
30
+ }, [
31
+ h,
32
+ w,
33
+ v,
34
+ b,
35
+ y,
36
+ S,
37
+ C
38
+ ]), E = d(() => x ? new Set([x]) : /* @__PURE__ */ new Set(), [x]);
39
+ return g ? /* @__PURE__ */ f("div", {
40
+ className: m.listBox,
41
+ children: /* @__PURE__ */ f(a, {})
42
+ }) : /* @__PURE__ */ p("div", {
43
+ className: m.listBox,
44
+ children: [/* @__PURE__ */ f("div", {
45
+ "aria-hidden": w,
46
+ className: l(m.browseWrapper, w && m.hidden),
47
+ children: /* @__PURE__ */ f(o, {
48
+ onAction: T,
49
+ selectedKeys: E
50
+ })
51
+ }), w && /* @__PURE__ */ f(s, {
52
+ onAction: T,
53
+ selectedKeys: E
54
+ })]
55
+ });
56
+ }
57
+ export { h as t };
@@ -1,6 +1,4 @@
1
- let e = /* @__PURE__ */ (function(r) {
2
- return r.Browse = "browse", r.Search = "search", r;
3
- })({});
4
- export {
5
- e as T
6
- };
1
+ var e = /* @__PURE__ */ function(e) {
2
+ return e.Browse = "browse", e.Search = "search", e;
3
+ }({});
4
+ export { e as t };
@@ -0,0 +1,54 @@
1
+ import "../esm/lib/constants.js";
2
+ import { useConsumerState as e } from "../esm/lib/contexts/hooks.js";
3
+ import { t } from "./types.js";
4
+ import { t as n } from "./load-more-error-row.js";
5
+ import { t as r } from "./load-more-loading-row.js";
6
+ import { t as i } from "./grid-list-load-more-sentinel.js";
7
+ import { useCallback as a, useMemo as o, useRef as s } from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ import { Collection as u, GridList as d, ListLayout as f, Virtualizer as p } from "react-aria-components";
10
+ import '../styles/virtualized-grid-list.css';var m = { list: "_list_dukvn_1" }, h = 40, g = 58, _ = 2;
11
+ function v({ ariaLabel: v, items: y, onAction: b, children: x, onLoadMore: S, hasMoreItems: C, isFetchingMore: w, loadMoreError: T, onRetry: E, selectedKeys: D, listType: O }) {
12
+ let { isDisabled: k } = e(), A = o(() => new f({
13
+ estimatedRowHeight: O === t.Browse ? h : g,
14
+ gap: _
15
+ }), [O]), j = s(null), M = a((e) => {
16
+ if (e === "LOAD_MORE_ERROR_ROW_ID") {
17
+ k || E();
18
+ return;
19
+ }
20
+ b(e);
21
+ }, [
22
+ k,
23
+ b,
24
+ E
25
+ ]), N = a((e) => {
26
+ if (e === "all") return;
27
+ let [t] = e;
28
+ t !== void 0 && !D.has(String(t)) && M(t);
29
+ }, [M, D]), P = C && !w && T === null && !k;
30
+ return /* @__PURE__ */ c(p, {
31
+ layout: A,
32
+ children: /* @__PURE__ */ l(d, {
33
+ ref: j,
34
+ "aria-label": v,
35
+ className: m.list,
36
+ onSelectionChange: N,
37
+ selectedKeys: D,
38
+ selectionMode: "single",
39
+ children: [
40
+ /* @__PURE__ */ c(u, {
41
+ items: y,
42
+ children: x
43
+ }),
44
+ w && /* @__PURE__ */ c(r, {}),
45
+ T !== null && /* @__PURE__ */ c(n, { onRetry: E }),
46
+ P && /* @__PURE__ */ c(i, {
47
+ onLoadMore: S,
48
+ scrollContainerRef: j
49
+ })
50
+ ]
51
+ })
52
+ });
53
+ }
54
+ export { v as t };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,2 @@
1
- import { MetadataTemplateBrowser as r } from "./lib/metadata-template-browser.js";
2
- export {
3
- r as MetadataTemplateBrowser
4
- };
1
+ import { MetadataTemplateBrowser as e } from "./lib/metadata-template-browser.js";
2
+ export { e as MetadataTemplateBrowser };
@@ -1,51 +1,2 @@
1
- import { Breadcrumb as L } from "@box/blueprint-web";
2
- import C from "clsx";
3
- import { useIntl as g } from "react-intl";
4
- import { messages as s } from "./messages.js";
5
- import { jsx as o } from "react/jsx-runtime";
6
- import { useConsumerState as v, useNavigationState as k, useSearchState as N, useBrowserActions as _ } from "../../contexts/hooks.js";
7
- import '../../../../styles/breadcrumb-navigation.css';const q = "_breadcrumb_a03s0_1", A = "_disabled_a03s0_6", c = {
8
- breadcrumb: q,
9
- disabled: A
10
- };
11
- function x() {
12
- const {
13
- formatMessage: e
14
- } = g(), {
15
- isDisabled: t
16
- } = v(), {
17
- path: a,
18
- namespaceFQN: n
19
- } = k(), {
20
- searchValue: m
21
- } = N(), {
22
- navigateBack: l
23
- } = _();
24
- if (m.length > 0)
25
- return null;
26
- const i = a[0], u = i ? i.fqn.split(".").slice(0, -1).join(".") : n, b = a.at(-1)?.fqn ?? n, d = {
27
- id: u,
28
- name: e(s.enterpriseCrumbLabel)
29
- }, f = a.map((r) => ({
30
- id: r.fqn,
31
- name: r.displayName
32
- })), p = [d, ...f], h = (r) => {
33
- t || r === b || l(r);
34
- };
35
- return /* @__PURE__ */ o("div", {
36
- className: C(c.breadcrumb, {
37
- [c.disabled]: t
38
- }),
39
- children: /* @__PURE__ */ o(L, {
40
- breadcrumbAriaLabel: e(s.breadcrumbAriaLabel),
41
- crumbs: p,
42
- isInteractive: !t,
43
- onPageLinkClick: h,
44
- size: "small",
45
- truncatedLinksIconAriaLabel: e(s.truncatedLinksIconAriaLabel)
46
- })
47
- });
48
- }
49
- export {
50
- x as BreadcrumbNavigation
51
- };
1
+ import { t as e } from "../../../../chunks/breadcrumb-navigation.js";
2
+ export { e as BreadcrumbNavigation };
@@ -1,4 +1,2 @@
1
- import { BreadcrumbNavigation as o } from "./breadcrumb-navigation.js";
2
- export {
3
- o as BreadcrumbNavigation
4
- };
1
+ import { t as e } from "../../../../chunks/breadcrumb-navigation.js";
2
+ export { e as BreadcrumbNavigation };
@@ -1,18 +1,16 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- const r = e({
3
- breadcrumbAriaLabel: {
4
- id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.breadcrumbAriaLabel",
5
- defaultMessage: "Navigation"
6
- },
7
- enterpriseCrumbLabel: {
8
- id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.enterpriseCrumbLabel",
9
- defaultMessage: "Enterprise"
10
- },
11
- truncatedLinksIconAriaLabel: {
12
- id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.truncatedLinksIconAriaLabel",
13
- defaultMessage: "Show more"
14
- }
2
+ var t = e({
3
+ breadcrumbAriaLabel: {
4
+ id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.breadcrumbAriaLabel",
5
+ defaultMessage: "Navigation"
6
+ },
7
+ enterpriseCrumbLabel: {
8
+ id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.enterpriseCrumbLabel",
9
+ defaultMessage: "Enterprise"
10
+ },
11
+ truncatedLinksIconAriaLabel: {
12
+ id: "groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.truncatedLinksIconAriaLabel",
13
+ defaultMessage: "Show more"
14
+ }
15
15
  });
16
- export {
17
- r as messages
18
- };
16
+ export { t as messages };
@@ -1,83 +1,58 @@
1
- import { EmptyState as E, Text as x } from "@box/blueprint-web";
2
- import { NoTemplates as L } from "@box/blueprint-web-assets/illustrations/Medium";
3
- import { useCallback as g } from "react";
4
- import { useIntl as v } from "react-intl";
5
- import { T as l } from "../../../../chunks/types.js";
6
- import { messages as s } from "./messages.js";
7
- import { jsx as r } from "react/jsx-runtime";
8
- import { useBrowseState as R, useBrowserActions as S } from "../../contexts/hooks.js";
9
- import { NamespaceRow as I } from "../namespace-row/namespace-row.js";
10
- import { TemplateRow as z } from "../template-row/template-row.js";
11
- import { LoaderSkeleton as A } from "../loader-skeleton/loader-skeleton.js";
12
- import { ErrorState as F } from "../error-state/error-state.js";
13
- import { VirtualizedGridList as V } from "../virtualized-grid-list/virtualized-grid-list.js";
14
- var o = /* @__PURE__ */ (function(t) {
15
- return t.Namespace = "namespace", t.Template = "template", t;
16
- })(o || {});
17
- function Y({
18
- onAction: t,
19
- selectedKeys: c
20
- }) {
21
- const {
22
- formatMessage: a
23
- } = v(), {
24
- namespaces: d,
25
- templates: f,
26
- isNamespacesExhausted: m,
27
- namespaceNextMarker: u,
28
- templateNextMarker: w,
29
- isFetching: y,
30
- isFetchingMore: T,
31
- browseError: M,
32
- loadMoreError: b
33
- } = R(), {
34
- loadMore: i,
35
- retry: h,
36
- editTemplate: n
37
- } = S(), N = u !== void 0 || m && w !== void 0, k = g((e) => e.kind === o.Namespace ? /* @__PURE__ */ r(I, {
38
- namespace: e.namespace
39
- }) : /* @__PURE__ */ r(z, {
40
- onEdit: n,
41
- template: e.template,
42
- variant: l.Browse
43
- }), [n]);
44
- if (y)
45
- return /* @__PURE__ */ r(A, {});
46
- if (M !== null)
47
- return /* @__PURE__ */ r(F, {
48
- body: a(s.browseErrorBody),
49
- onRetry: h
50
- });
51
- const B = m ? f : [], p = [...d.map((e) => ({
52
- id: e.id,
53
- kind: o.Namespace,
54
- namespace: e
55
- })), ...B.map((e) => ({
56
- id: e.id,
57
- kind: o.Template,
58
- template: e
59
- }))];
60
- return p.length === 0 ? /* @__PURE__ */ r(E, {
61
- body: /* @__PURE__ */ r(x, {
62
- as: "p",
63
- children: a(s.emptyStateBody)
64
- }),
65
- illustration: L,
66
- size: "small"
67
- }) : /* @__PURE__ */ r(V, {
68
- ariaLabel: a(s.listAriaLabel),
69
- isFetchingMore: T,
70
- items: p,
71
- listType: l.Browse,
72
- loadMoreError: b,
73
- onAction: t,
74
- hasMoreItems: N,
75
- onLoadMore: i,
76
- onRetry: i,
77
- selectedKeys: c,
78
- children: k
79
- });
1
+ import { useBrowseState as e, useBrowserActions as t } from "../../contexts/hooks.js";
2
+ import { t as n } from "../../../../chunks/types.js";
3
+ import { ErrorState as r } from "../error-state/error-state.js";
4
+ import { t as i } from "../../../../chunks/loader-skeleton.js";
5
+ import { NamespaceRow as a } from "../namespace-row/namespace-row.js";
6
+ import { TemplateRow as o } from "../template-row/template-row.js";
7
+ import { t as s } from "../../../../chunks/virtualized-grid-list.js";
8
+ import { messages as c } from "./messages.js";
9
+ import { EmptyState as l, Text as u } from "@box/blueprint-web";
10
+ import { useIntl as d } from "react-intl";
11
+ import { useCallback as f } from "react";
12
+ import { jsx as p } from "react/jsx-runtime";
13
+ import { NoTemplates as m } from "@box/blueprint-web-assets/illustrations/Medium";
14
+ var h = /* @__PURE__ */ function(e) {
15
+ return e.Namespace = "namespace", e.Template = "template", e;
16
+ }(h || {});
17
+ function g({ onAction: g, selectedKeys: _ }) {
18
+ let { formatMessage: v } = d(), { namespaces: y, templates: b, isNamespacesExhausted: x, namespaceNextMarker: S, templateNextMarker: C, isFetching: w, isFetchingMore: T, browseError: E, loadMoreError: D } = e(), { loadMore: O, retry: k, editTemplate: A } = t(), j = S !== void 0 || x && C !== void 0, M = f((e) => e.kind === h.Namespace ? /* @__PURE__ */ p(a, { namespace: e.namespace }) : /* @__PURE__ */ p(o, {
19
+ onEdit: A,
20
+ template: e.template,
21
+ variant: n.Browse
22
+ }), [A]);
23
+ if (w) return /* @__PURE__ */ p(i, {});
24
+ if (E !== null) return /* @__PURE__ */ p(r, {
25
+ body: v(c.browseErrorBody),
26
+ onRetry: k
27
+ });
28
+ let N = x ? b : [], P = [...y.map((e) => ({
29
+ id: e.id,
30
+ kind: h.Namespace,
31
+ namespace: e
32
+ })), ...N.map((e) => ({
33
+ id: e.id,
34
+ kind: h.Template,
35
+ template: e
36
+ }))];
37
+ return P.length === 0 ? /* @__PURE__ */ p(l, {
38
+ body: /* @__PURE__ */ p(u, {
39
+ as: "p",
40
+ children: v(c.emptyStateBody)
41
+ }),
42
+ illustration: m,
43
+ size: "small"
44
+ }) : /* @__PURE__ */ p(s, {
45
+ ariaLabel: v(c.listAriaLabel),
46
+ isFetchingMore: T,
47
+ items: P,
48
+ listType: n.Browse,
49
+ loadMoreError: D,
50
+ onAction: g,
51
+ hasMoreItems: j,
52
+ onLoadMore: O,
53
+ onRetry: O,
54
+ selectedKeys: _,
55
+ children: M
56
+ });
80
57
  }
81
- export {
82
- Y as BrowseList
83
- };
58
+ export { g as BrowseList };
@@ -1,4 +1,2 @@
1
1
  import { BrowseList as e } from "./browse-list.js";
2
- export {
3
- e as BrowseList
4
- };
2
+ export { e as BrowseList };