@box/metadata-template-browser 2.1.34 → 2.1.36
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.
- package/dist/chunks/breadcrumb-navigation.js +1 -35
- package/dist/chunks/browser-row.js +1 -60
- package/dist/chunks/grid-list-load-more-sentinel.js +1 -31
- package/dist/chunks/load-more-error-row.js +1 -36
- package/dist/chunks/load-more-loading-row.js +1 -26
- package/dist/chunks/loader-skeleton.js +1 -16
- package/dist/chunks/metadata-template-browser-container.js +1 -42
- package/dist/chunks/metadata-template-browser-controller.js +1 -36
- package/dist/chunks/metadata-template-browser-list-box.js +1 -65
- package/dist/chunks/types.js +1 -4
- package/dist/chunks/virtualized-grid-list.js +1 -59
- package/dist/esm/index.js +1 -2
- package/dist/esm/lib/components/breadcrumb-navigation/breadcrumb-navigation.js +1 -2
- package/dist/esm/lib/components/breadcrumb-navigation/index.js +1 -2
- package/dist/esm/lib/components/breadcrumb-navigation/messages.js +1 -16
- package/dist/esm/lib/components/browse-list/browse-list.js +1 -60
- package/dist/esm/lib/components/browse-list/index.js +1 -2
- package/dist/esm/lib/components/browse-list/messages.js +1 -20
- package/dist/esm/lib/components/browser-row/browser-row.js +1 -2
- package/dist/esm/lib/components/browser-row/index.js +1 -2
- package/dist/esm/lib/components/error-state/error-state.js +1 -23
- package/dist/esm/lib/components/error-state/index.js +1 -2
- package/dist/esm/lib/components/error-state/messages.js +1 -6
- package/dist/esm/lib/components/index.js +1 -12
- package/dist/esm/lib/components/load-more-feedback/index.js +1 -3
- package/dist/esm/lib/components/load-more-feedback/load-more-error-row.js +1 -2
- package/dist/esm/lib/components/load-more-feedback/load-more-loading-row.js +1 -2
- package/dist/esm/lib/components/load-more-feedback/messages.js +1 -20
- package/dist/esm/lib/components/loader-skeleton/index.js +1 -2
- package/dist/esm/lib/components/loader-skeleton/loader-skeleton.js +1 -2
- package/dist/esm/lib/components/messages.js +1 -32
- package/dist/esm/lib/components/metadata-template-browser-container.js +1 -2
- package/dist/esm/lib/components/metadata-template-browser-controller.js +1 -2
- package/dist/esm/lib/components/metadata-template-browser-list-box/index.js +1 -2
- package/dist/esm/lib/components/metadata-template-browser-list-box/metadata-template-browser-list-box.js +1 -2
- package/dist/esm/lib/components/namespace-row/index.js +1 -2
- package/dist/esm/lib/components/namespace-row/messages.js +1 -6
- package/dist/esm/lib/components/namespace-row/namespace-row.js +1 -22
- package/dist/esm/lib/components/search-list/index.js +1 -2
- package/dist/esm/lib/components/search-list/messages.js +1 -20
- package/dist/esm/lib/components/search-list/search-list.js +1 -54
- package/dist/esm/lib/components/template-row/index.js +1 -2
- package/dist/esm/lib/components/template-row/messages.js +1 -12
- package/dist/esm/lib/components/template-row/template-row.js +1 -51
- package/dist/esm/lib/components/virtualized-grid-list/grid-list-load-more-sentinel.js +1 -2
- package/dist/esm/lib/components/virtualized-grid-list/index.js +1 -2
- package/dist/esm/lib/components/virtualized-grid-list/messages.js +1 -6
- package/dist/esm/lib/components/virtualized-grid-list/virtualized-grid-list.js +1 -2
- package/dist/esm/lib/constants.js +1 -2
- package/dist/esm/lib/contexts/contexts.js +1 -104
- package/dist/esm/lib/contexts/hooks.js +1 -33
- package/dist/esm/lib/contexts/index.js +1 -5
- package/dist/esm/lib/contexts/provider.js +1 -53
- package/dist/esm/lib/contexts/reducer.js +1 -156
- package/dist/esm/lib/contexts/use-template-browser-actions.js +1 -232
- package/dist/esm/lib/hooks/use-focus-first-row-after-navigation.js +1 -32
- package/dist/esm/lib/hooks/use-is-initial-browse-loading.js +1 -6
- package/dist/esm/lib/metadata-template-browser.js +1 -21
- package/package.json +7 -7
|
@@ -1,35 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{useBrowserActions,useConsumerState,useNavigationState,useSearchState}from"../esm/lib/contexts/hooks.js";import{messages}from"../esm/lib/components/breadcrumb-navigation/messages.js";import{Breadcrumb}from"@box/blueprint-web";import classNames from"clsx";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import '../styles/breadcrumb-navigation.css';var breadcrumb_navigation_module_default={breadcrumb:`_breadcrumb_a03s0_1`,disabled:`_disabled_a03s0_6`};function BreadcrumbNavigation(){let{formatMessage}=useIntl(),{isDisabled}=useConsumerState(),{path,namespaceFQN}=useNavigationState(),{searchValue}=useSearchState(),{navigateBack}=useBrowserActions();if(searchValue.length>0)return null;let firstPathEntry=path[0],rootFqn=firstPathEntry?firstPathEntry.fqn.split(`.`).slice(0,-1).join(`.`):namespaceFQN,currentFqn=path.at(-1)?.fqn??namespaceFQN,crumbs=[{id:rootFqn,name:formatMessage(messages.enterpriseCrumbLabel)},...path.map(entry=>({id:entry.fqn,name:entry.displayName}))],handleCrumbClick=id=>{isDisabled||id!==currentFqn&&navigateBack(id)};return jsx(`div`,{className:classNames(breadcrumb_navigation_module_default.breadcrumb,{[breadcrumb_navigation_module_default.disabled]:isDisabled}),children:jsx(Breadcrumb,{breadcrumbAriaLabel:formatMessage(messages.breadcrumbAriaLabel),crumbs,isInteractive:!isDisabled,onPageLinkClick:handleCrumbClick,size:`small`,truncatedLinksIconAriaLabel:formatMessage(messages.truncatedLinksIconAriaLabel)})})}export{BreadcrumbNavigation as t};
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EllipsizableText as t, Tooltip as n } from "@box/blueprint-web";
|
|
3
|
-
import r from "clsx";
|
|
4
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
-
import { GridListItem as o } from "react-aria-components";
|
|
6
|
-
import '../styles/browser-row.css';var s = {
|
|
7
|
-
row: "_row_1q43q_2",
|
|
8
|
-
leadingIcon: "_leadingIcon_1q43q_15",
|
|
9
|
-
content: "_content_1q43q_22",
|
|
10
|
-
trailingSlotHoverOnly: "_trailingSlotHoverOnly_1q43q_29",
|
|
11
|
-
item: "_item_1q43q_33",
|
|
12
|
-
disabled: "_disabled_1q43q_54",
|
|
13
|
-
applied: "_applied_1q43q_61",
|
|
14
|
-
trailingSlot: "_trailingSlot_1q43q_29",
|
|
15
|
-
subtitle: "_subtitle_1q43q_90"
|
|
16
|
-
};
|
|
17
|
-
function c({ id: c, leadingIcon: l, title: u, subtitle: d, trailingSlot: f, isTrailingSlotHoverOnly: p, isApplied: m, tooltipContent: h }) {
|
|
18
|
-
let { isDisabled: g } = e(), _ = r(s.trailingSlot, { [s.trailingSlotHoverOnly]: p }), v = /* @__PURE__ */ a("div", {
|
|
19
|
-
className: s.row,
|
|
20
|
-
children: [
|
|
21
|
-
l !== void 0 && /* @__PURE__ */ i("div", {
|
|
22
|
-
"aria-hidden": "true",
|
|
23
|
-
className: s.leadingIcon,
|
|
24
|
-
"data-testid": "leading-icon",
|
|
25
|
-
children: l
|
|
26
|
-
}),
|
|
27
|
-
/* @__PURE__ */ a("div", {
|
|
28
|
-
className: s.content,
|
|
29
|
-
children: [/* @__PURE__ */ i(t, {
|
|
30
|
-
as: "span",
|
|
31
|
-
lineClamp: 1,
|
|
32
|
-
variant: "bodyDefault",
|
|
33
|
-
children: u
|
|
34
|
-
}), d && /* @__PURE__ */ i("div", {
|
|
35
|
-
className: s.subtitle,
|
|
36
|
-
children: d
|
|
37
|
-
})]
|
|
38
|
-
}),
|
|
39
|
-
f !== void 0 && /* @__PURE__ */ i("div", {
|
|
40
|
-
className: _,
|
|
41
|
-
children: f
|
|
42
|
-
})
|
|
43
|
-
]
|
|
44
|
-
}), y = typeof h == "string" ? `${u}. ${h}` : u, b = /* @__PURE__ */ i(o, {
|
|
45
|
-
"aria-disabled": m && !g ? !0 : void 0,
|
|
46
|
-
className: r(s.item, {
|
|
47
|
-
[s.disabled]: g,
|
|
48
|
-
[s.applied]: m && !g
|
|
49
|
-
}),
|
|
50
|
-
id: c,
|
|
51
|
-
isDisabled: g,
|
|
52
|
-
textValue: y,
|
|
53
|
-
children: v
|
|
54
|
-
});
|
|
55
|
-
return h === void 0 ? b : /* @__PURE__ */ i(n, {
|
|
56
|
-
content: h,
|
|
57
|
-
children: b
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
export { c as t };
|
|
1
|
+
import{useConsumerState}from"../esm/lib/contexts/hooks.js";import{EllipsizableText,Tooltip}from"@box/blueprint-web";import classNames from"clsx";import{jsx,jsxs}from"react/jsx-runtime";import{GridListItem}from"react-aria-components";import '../styles/browser-row.css';var browser_row_module_default={row:`_row_1q43q_2`,leadingIcon:`_leadingIcon_1q43q_15`,content:`_content_1q43q_22`,trailingSlotHoverOnly:`_trailingSlotHoverOnly_1q43q_29`,item:`_item_1q43q_33`,disabled:`_disabled_1q43q_54`,applied:`_applied_1q43q_61`,trailingSlot:`_trailingSlot_1q43q_29`,subtitle:`_subtitle_1q43q_90`};function BrowserRow({id,leadingIcon,title,subtitle,trailingSlot,isTrailingSlotHoverOnly,isApplied,tooltipContent}){let{isDisabled}=useConsumerState(),trailingSlotClassName=classNames(browser_row_module_default.trailingSlot,{[browser_row_module_default.trailingSlotHoverOnly]:isTrailingSlotHoverOnly}),rowContent=jsxs(`div`,{className:browser_row_module_default.row,children:[leadingIcon!==void 0&&jsx(`div`,{"aria-hidden":`true`,className:browser_row_module_default.leadingIcon,"data-testid":`leading-icon`,children:leadingIcon}),jsxs(`div`,{className:browser_row_module_default.content,children:[jsx(EllipsizableText,{as:`span`,lineClamp:1,variant:`bodyDefault`,children:title}),subtitle&&jsx(`div`,{className:browser_row_module_default.subtitle,children:subtitle})]}),trailingSlot!==void 0&&jsx(`div`,{className:trailingSlotClassName,children:trailingSlot})]}),textValue=typeof tooltipContent==`string`?`${title}. ${tooltipContent}`:title,item=jsx(GridListItem,{"aria-disabled":isApplied&&!isDisabled?!0:void 0,className:classNames(browser_row_module_default.item,{[browser_row_module_default.disabled]:isDisabled,[browser_row_module_default.applied]:isApplied&&!isDisabled}),id,isDisabled,textValue,children:rowContent});return tooltipContent===void 0?item:jsx(Tooltip,{content:tooltipContent,children:item})}export{BrowserRow as t};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{LOAD_MORE_SENTINEL_ID}from"../esm/lib/constants.js";import{messages}from"../esm/lib/components/virtualized-grid-list/messages.js";import{useIntl}from"react-intl";import{useEffect,useRef}from"react";import{jsx}from"react/jsx-runtime";import{GridListItem}from"react-aria-components";import '../styles/grid-list-load-more-sentinel.css';var grid_list_load_more_sentinel_module_default={sentinel:`_sentinel_im31a_1`};function GridListLoadMoreSentinel({onLoadMore,scrollContainerRef}){let callbackRef=useRef(onLoadMore);callbackRef.current=onLoadMore;let{formatMessage}=useIntl(),label=formatMessage(messages.loadMoreSentinelAriaLabel);return useEffect(()=>{let scrollContainer=scrollContainerRef.current,rafId,hasCalledLoadMore=!1,checkAndLoad=()=>{if(!scrollContainer||hasCalledLoadMore)return;let{scrollTop,scrollHeight,clientHeight}=scrollContainer;scrollHeight-scrollTop-clientHeight<=clientHeight&&(hasCalledLoadMore=!0,callbackRef.current())},handleScroll=()=>{cancelAnimationFrame(rafId),rafId=requestAnimationFrame(checkAndLoad)};return scrollContainer?.addEventListener(`scroll`,handleScroll,{passive:!0}),rafId=requestAnimationFrame(checkAndLoad),()=>{scrollContainer?.removeEventListener(`scroll`,handleScroll),cancelAnimationFrame(rafId)}},[scrollContainerRef]),jsx(GridListItem,{"aria-hidden":`true`,className:grid_list_load_more_sentinel_module_default.sentinel,id:LOAD_MORE_SENTINEL_ID,isDisabled:!0,textValue:label})}export{GridListLoadMoreSentinel as t};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{LOAD_MORE_ERROR_ROW_ID}from"../esm/lib/constants.js";import{useConsumerState}from"../esm/lib/contexts/hooks.js";import{messages}from"../esm/lib/components/load-more-feedback/messages.js";import{InlineNotice,TextButton}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{GridListItem}from"react-aria-components";import{Loader}from"@box/blueprint-web-assets/icons/Fill";import '../styles/load-more-error-row.css';var load_more_error_row_module_default={container:`_container_1bidp_1`,item:`_item_1bidp_9`};function LoadMoreErrorRow({onRetry}){let{formatMessage}=useIntl(),{isDisabled}=useConsumerState();return jsx(GridListItem,{className:load_more_error_row_module_default.item,id:LOAD_MORE_ERROR_ROW_ID,textValue:formatMessage(messages.loadMoreErrorBody),children:jsxs(`div`,{className:load_more_error_row_module_default.container,children:[jsx(InlineNotice,{variant:`error`,variantIconAriaLabel:formatMessage(messages.errorIconAriaLabel),children:formatMessage(messages.loadMoreErrorBody)}),jsx(TextButton,{disabled:isDisabled,icon:Loader,onClick:event=>{event.stopPropagation(),!isDisabled&&onRetry()},children:formatMessage(messages.retryLabel)})]})})}export{LoadMoreErrorRow as t};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{LOAD_MORE_LOADING_ROW_ID}from"../esm/lib/constants.js";import{messages}from"../esm/lib/components/load-more-feedback/messages.js";import{Ghost}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{GridListItem}from"react-aria-components";import '../styles/load-more-loading-row.css';var load_more_loading_row_module_default={container:`_container_1rh3v_1`};function LoadMoreLoadingRow(){let{formatMessage}=useIntl(),label=formatMessage(messages.loadingRowAriaLabel);return jsx(GridListItem,{"aria-busy":`true`,"aria-label":label,id:LOAD_MORE_LOADING_ROW_ID,isDisabled:!0,textValue:label,children:jsxs(`div`,{className:load_more_loading_row_module_default.container,children:[jsx(Ghost,{height:16}),jsx(Ghost,{height:16}),jsx(Ghost,{height:16})]})})}export{LoadMoreLoadingRow as t};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{messages}from"../esm/lib/components/messages.js";import{Ghost}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import '../styles/loader-skeleton.css';var loader_skeleton_module_default={loaderSkeleton:`_loaderSkeleton_hxe4x_1`},ROW_HEIGHT=16,ROW_COUNT=20;function LoaderSkeleton(){let{formatMessage}=useIntl();return jsx(`div`,{"aria-busy":`true`,"aria-label":formatMessage(messages.loadingAriaLabel),className:loader_skeleton_module_default.loaderSkeleton,role:`status`,children:Array.from({length:ROW_COUNT},(_,index)=>jsx(Ghost,{height:ROW_HEIGHT},index))})}export{LoaderSkeleton as t};
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as a } from "./breadcrumb-navigation.js";
|
|
3
|
-
import { messages as o } from "../esm/lib/components/messages.js";
|
|
4
|
-
import { useIsInitialBrowseLoading as s } from "../esm/lib/hooks/use-is-initial-browse-loading.js";
|
|
5
|
-
import { t as c } from "./metadata-template-browser-list-box.js";
|
|
6
|
-
import { Button as l, SearchInput as u } from "@box/blueprint-web";
|
|
7
|
-
import { useIntl as d } from "react-intl";
|
|
8
|
-
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
-
import { Plus as m } from "@box/blueprint-web-assets/icons/Fill";
|
|
10
|
-
import '../styles/metadata-template-browser-container.css';var h = {
|
|
11
|
-
container: "_container_1dqk1_1",
|
|
12
|
-
searchInput: "_searchInput_1dqk1_9",
|
|
13
|
-
createTemplateButton: "_createTemplateButton_1dqk1_13"
|
|
14
|
-
};
|
|
15
|
-
function g() {
|
|
16
|
-
let { formatMessage: g } = d(), { isDisabled: _ } = n(), { setSearchValue: v, createTemplate: y } = t(), { namespaceFQN: b, canCreateInCurrentNamespace: x } = r(), { searchValue: S } = i(), { isFetching: C, namespaces: w, templates: T, isNamespacesExhausted: E } = e(), D = s(), O = !C && E && w.length === 0 && T.length === 0, k = x && !D && !C && !O && S.length === 0;
|
|
17
|
-
return /* @__PURE__ */ p("div", {
|
|
18
|
-
className: h.container,
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ f(u, {
|
|
21
|
-
className: h.searchInput,
|
|
22
|
-
disabled: _ || D,
|
|
23
|
-
onChange: v,
|
|
24
|
-
placeholder: g(o.searchInputPlaceholder),
|
|
25
|
-
searchInputAriaLabel: g(o.searchInputAriaLabel),
|
|
26
|
-
searchInputClearAriaLabel: g(o.searchInputClearAriaLabel)
|
|
27
|
-
}),
|
|
28
|
-
!D && /* @__PURE__ */ f(a, {}),
|
|
29
|
-
k && /* @__PURE__ */ f(l, {
|
|
30
|
-
className: h.createTemplateButton,
|
|
31
|
-
disabled: _,
|
|
32
|
-
startIcon: m,
|
|
33
|
-
onClick: () => y(b),
|
|
34
|
-
variant: "tertiary",
|
|
35
|
-
size: "large",
|
|
36
|
-
children: g(o.createTemplateButtonLabel)
|
|
37
|
-
}),
|
|
38
|
-
/* @__PURE__ */ f(c, {})
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export { g as t };
|
|
1
|
+
import{useBrowseState,useBrowserActions,useConsumerState,useNavigationState,useSearchState}from"../esm/lib/contexts/hooks.js";import{t as BreadcrumbNavigation}from"./breadcrumb-navigation.js";import{messages}from"../esm/lib/components/messages.js";import{useIsInitialBrowseLoading}from"../esm/lib/hooks/use-is-initial-browse-loading.js";import{t as MetadataTemplateBrowserListBox}from"./metadata-template-browser-list-box.js";import{Button,SearchInput}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{Plus}from"@box/blueprint-web-assets/icons/Fill";import '../styles/metadata-template-browser-container.css';var metadata_template_browser_container_module_default={container:`_container_1dqk1_1`,searchInput:`_searchInput_1dqk1_9`,createTemplateButton:`_createTemplateButton_1dqk1_13`};function MetadataTemplateBrowserContainer(){let{formatMessage}=useIntl(),{isDisabled}=useConsumerState(),{setSearchValue,createTemplate}=useBrowserActions(),{namespaceFQN,canCreateInCurrentNamespace}=useNavigationState(),{searchValue}=useSearchState(),{isFetching,namespaces,templates,isNamespacesExhausted}=useBrowseState(),isInitialBrowseLoading=useIsInitialBrowseLoading(),isBrowseListEmpty=!isFetching&&isNamespacesExhausted&&namespaces.length===0&&templates.length===0,showCreateButton=canCreateInCurrentNamespace&&!isInitialBrowseLoading&&!isFetching&&!isBrowseListEmpty&&searchValue.length===0;return jsxs(`div`,{className:metadata_template_browser_container_module_default.container,children:[jsx(SearchInput,{className:metadata_template_browser_container_module_default.searchInput,disabled:isDisabled||isInitialBrowseLoading,onChange:setSearchValue,placeholder:formatMessage(messages.searchInputPlaceholder),searchInputAriaLabel:formatMessage(messages.searchInputAriaLabel),searchInputClearAriaLabel:formatMessage(messages.searchInputClearAriaLabel)}),!isInitialBrowseLoading&&jsx(BreadcrumbNavigation,{}),showCreateButton&&jsx(Button,{className:metadata_template_browser_container_module_default.createTemplateButton,disabled:isDisabled,startIcon:Plus,onClick:()=>createTemplate(namespaceFQN),variant:`tertiary`,size:`large`,children:formatMessage(messages.createTemplateButtonLabel)}),jsx(MetadataTemplateBrowserListBox,{})]})}export{MetadataTemplateBrowserContainer as t};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import
|
|
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, canCreateInCurrentNamespace: x } = r(), { isFetching: S, initialLoadError: C, namespaces: w, templates: T } = e(), E = d(!1);
|
|
13
|
-
u(() => {
|
|
14
|
-
!g && !E.current && (E.current = !0, v());
|
|
15
|
-
}, [g, v]);
|
|
16
|
-
let D = w.length > 0 || T.length > 0, O = C !== null, k = b.length === 0, A = !S && !g && !D && !O && k && !x, j = !O && !A;
|
|
17
|
-
return /* @__PURE__ */ p("div", {
|
|
18
|
-
className: h.container,
|
|
19
|
-
children: [
|
|
20
|
-
O && /* @__PURE__ */ f(i, {
|
|
21
|
-
body: _(a.initialLoadErrorBody),
|
|
22
|
-
onRetry: y
|
|
23
|
-
}),
|
|
24
|
-
A && /* @__PURE__ */ f(s, {
|
|
25
|
-
body: /* @__PURE__ */ f(c, {
|
|
26
|
-
as: "p",
|
|
27
|
-
children: _(a.initialEmptyStateBody)
|
|
28
|
-
}),
|
|
29
|
-
illustration: m,
|
|
30
|
-
size: "small"
|
|
31
|
-
}),
|
|
32
|
-
j && /* @__PURE__ */ f(o, {})
|
|
33
|
-
]
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export { g as t };
|
|
1
|
+
import{useBrowseState,useBrowserActions,useConsumerState,useNavigationState}from"../esm/lib/contexts/hooks.js";import{ErrorState}from"../esm/lib/components/error-state/error-state.js";import{messages}from"../esm/lib/components/messages.js";import{t as MetadataTemplateBrowserContainer}from"./metadata-template-browser-container.js";import{EmptyState,Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{useEffect,useRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{NoTemplates}from"@box/blueprint-web-assets/illustrations/Medium";import '../styles/metadata-template-browser-controller.css';var metadata_template_browser_controller_module_default={container:`_container_14phx_1`};function MetadataTemplateBrowserController(){let{isLoading:isConsumerLoading}=useConsumerState(),{formatMessage}=useIntl(),{initialLoad,retry}=useBrowserActions(),{path,canCreateInCurrentNamespace}=useNavigationState(),{isFetching,initialLoadError,namespaces,templates}=useBrowseState(),hasInitiallyLoadedRef=useRef(!1);useEffect(()=>{!isConsumerLoading&&!hasInitiallyLoadedRef.current&&(hasInitiallyLoadedRef.current=!0,initialLoad())},[isConsumerLoading,initialLoad]);let hasItems=namespaces.length>0||templates.length>0,hasInitialLoadError=initialLoadError!==null,isAtRoot=path.length===0,isBrowseEmpty=!isFetching&&!isConsumerLoading&&!hasItems&&!hasInitialLoadError&&isAtRoot&&!canCreateInCurrentNamespace,showContainer=!hasInitialLoadError&&!isBrowseEmpty;return jsxs(`div`,{className:metadata_template_browser_controller_module_default.container,children:[hasInitialLoadError&&jsx(ErrorState,{body:formatMessage(messages.initialLoadErrorBody),onRetry:retry}),isBrowseEmpty&&jsx(EmptyState,{body:jsx(Text,{as:`p`,children:formatMessage(messages.initialEmptyStateBody)}),illustration:NoTemplates,size:`small`}),showContainer&&jsx(MetadataTemplateBrowserContainer,{})]})}export{MetadataTemplateBrowserController as t};
|
|
@@ -1,65 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as o } from "./loader-skeleton.js";
|
|
3
|
-
import { BrowseList as s } from "../esm/lib/components/browse-list/browse-list.js";
|
|
4
|
-
import { SearchList as c } from "../esm/lib/components/search-list/search-list.js";
|
|
5
|
-
import { useIsInitialBrowseLoading as l } from "../esm/lib/hooks/use-is-initial-browse-loading.js";
|
|
6
|
-
import { useFocusFirstRowAfterNavigation as u } from "../esm/lib/hooks/use-focus-first-row-after-navigation.js";
|
|
7
|
-
import d from "clsx";
|
|
8
|
-
import { useCallback as f, useMemo as p, useRef as m } from "react";
|
|
9
|
-
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
|
-
import '../styles/metadata-template-browser-list-box.css';var _ = {
|
|
11
|
-
listBox: "_listBox_1qbmg_1",
|
|
12
|
-
browseWrapper: "_browseWrapper_1qbmg_9",
|
|
13
|
-
hidden: "_hidden_1qbmg_16"
|
|
14
|
-
};
|
|
15
|
-
function v() {
|
|
16
|
-
let { isDisabled: v } = n(), y = l(), { searchValue: b, searchResults: x } = i(), { namespaces: S, templates: C, isFetching: w } = e(), { selectedTemplateId: T } = a(), { selectTemplate: E, navigateTo: D } = t(), { path: O } = r(), k = b.length > 0, A = m(null);
|
|
17
|
-
u({
|
|
18
|
-
containerRef: A,
|
|
19
|
-
path: O,
|
|
20
|
-
isFetching: w
|
|
21
|
-
});
|
|
22
|
-
let j = f((e) => {
|
|
23
|
-
if (v) return;
|
|
24
|
-
let t = String(e);
|
|
25
|
-
if (k) {
|
|
26
|
-
let e = x.find((e) => e.id === t);
|
|
27
|
-
e && E(e);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
let n = C.find((e) => e.id === t);
|
|
31
|
-
if (n) {
|
|
32
|
-
E(n);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
let r = S.find((e) => e.id === t);
|
|
36
|
-
r && D(r);
|
|
37
|
-
}, [
|
|
38
|
-
v,
|
|
39
|
-
k,
|
|
40
|
-
x,
|
|
41
|
-
C,
|
|
42
|
-
S,
|
|
43
|
-
E,
|
|
44
|
-
D
|
|
45
|
-
]), M = p(() => T ? new Set([T]) : /* @__PURE__ */ new Set(), [T]);
|
|
46
|
-
return y ? /* @__PURE__ */ h("div", {
|
|
47
|
-
className: _.listBox,
|
|
48
|
-
children: /* @__PURE__ */ h(o, {})
|
|
49
|
-
}) : /* @__PURE__ */ g("div", {
|
|
50
|
-
className: _.listBox,
|
|
51
|
-
children: [/* @__PURE__ */ h("div", {
|
|
52
|
-
ref: A,
|
|
53
|
-
"aria-hidden": k,
|
|
54
|
-
className: d(_.browseWrapper, k && _.hidden),
|
|
55
|
-
children: /* @__PURE__ */ h(s, {
|
|
56
|
-
onAction: j,
|
|
57
|
-
selectedKeys: M
|
|
58
|
-
})
|
|
59
|
-
}), k && /* @__PURE__ */ h(c, {
|
|
60
|
-
onAction: j,
|
|
61
|
-
selectedKeys: M
|
|
62
|
-
})]
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
export { v as t };
|
|
1
|
+
import{useBrowseState,useBrowserActions,useConsumerState,useNavigationState,useSearchState,useSelectionState}from"../esm/lib/contexts/hooks.js";import{t as LoaderSkeleton}from"./loader-skeleton.js";import{BrowseList}from"../esm/lib/components/browse-list/browse-list.js";import{SearchList}from"../esm/lib/components/search-list/search-list.js";import{useIsInitialBrowseLoading}from"../esm/lib/hooks/use-is-initial-browse-loading.js";import{useFocusFirstRowAfterNavigation}from"../esm/lib/hooks/use-focus-first-row-after-navigation.js";import classNames from"clsx";import{useCallback,useMemo,useRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/metadata-template-browser-list-box.css';var metadata_template_browser_list_box_module_default={listBox:`_listBox_1qbmg_1`,browseWrapper:`_browseWrapper_1qbmg_9`,hidden:`_hidden_1qbmg_16`};function MetadataTemplateBrowserListBox(){let{isDisabled}=useConsumerState(),isInitialBrowseLoading=useIsInitialBrowseLoading(),{searchValue,searchResults}=useSearchState(),{namespaces,templates,isFetching}=useBrowseState(),{selectedTemplateId}=useSelectionState(),{selectTemplate,navigateTo}=useBrowserActions(),{path}=useNavigationState(),isSearchActive=searchValue.length>0,browseContainerRef=useRef(null);useFocusFirstRowAfterNavigation({containerRef:browseContainerRef,path,isFetching});let handleRowAction=useCallback(key=>{if(isDisabled)return;let id=String(key);if(isSearchActive){let template=searchResults.find(t=>t.id===id);template&&selectTemplate(template);return}let template=templates.find(t=>t.id===id);if(template){selectTemplate(template);return}let namespace=namespaces.find(ns=>ns.id===id);namespace&&navigateTo(namespace)},[isDisabled,isSearchActive,searchResults,templates,namespaces,selectTemplate,navigateTo]),selectedKeys=useMemo(()=>selectedTemplateId?new Set([selectedTemplateId]):new Set,[selectedTemplateId]);return isInitialBrowseLoading?jsx(`div`,{className:metadata_template_browser_list_box_module_default.listBox,children:jsx(LoaderSkeleton,{})}):jsxs(`div`,{className:metadata_template_browser_list_box_module_default.listBox,children:[jsx(`div`,{ref:browseContainerRef,"aria-hidden":isSearchActive,className:classNames(metadata_template_browser_list_box_module_default.browseWrapper,isSearchActive&&metadata_template_browser_list_box_module_default.hidden),children:jsx(BrowseList,{onAction:handleRowAction,selectedKeys})}),isSearchActive&&jsx(SearchList,{onAction:handleRowAction,selectedKeys})]})}export{MetadataTemplateBrowserListBox as t};
|
package/dist/chunks/types.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
return e.Browse = "browse", e.Search = "search", e;
|
|
3
|
-
}({});
|
|
4
|
-
export { e as t };
|
|
1
|
+
var TemplateRowVariant=function(TemplateRowVariant){return TemplateRowVariant.Browse=`browse`,TemplateRowVariant.Search=`search`,TemplateRowVariant}({});export{TemplateRowVariant as t};
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
import
|
|
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, appliedTemplateIds: A } = e(), j = o(() => new f({
|
|
13
|
-
estimatedRowHeight: O === t.Browse ? h : g,
|
|
14
|
-
gap: _
|
|
15
|
-
}), [O]), M = s(null), N = 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
|
-
]), P = a((e) => {
|
|
26
|
-
if (e === "all") return;
|
|
27
|
-
let [t] = e;
|
|
28
|
-
t !== void 0 && !D.has(String(t)) && !A.has(String(t)) && N(t);
|
|
29
|
-
}, [
|
|
30
|
-
A,
|
|
31
|
-
N,
|
|
32
|
-
D
|
|
33
|
-
]), F = C && !w && T === null && !k;
|
|
34
|
-
return /* @__PURE__ */ c(p, {
|
|
35
|
-
layout: j,
|
|
36
|
-
children: /* @__PURE__ */ l(d, {
|
|
37
|
-
ref: M,
|
|
38
|
-
"aria-label": v,
|
|
39
|
-
className: m.list,
|
|
40
|
-
onSelectionChange: P,
|
|
41
|
-
selectedKeys: D,
|
|
42
|
-
selectionMode: "single",
|
|
43
|
-
shouldSelectOnPressUp: !0,
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ c(u, {
|
|
46
|
-
items: y,
|
|
47
|
-
children: x
|
|
48
|
-
}),
|
|
49
|
-
w && /* @__PURE__ */ c(r, {}),
|
|
50
|
-
T !== null && /* @__PURE__ */ c(n, { onRetry: E }),
|
|
51
|
-
F && /* @__PURE__ */ c(i, {
|
|
52
|
-
onLoadMore: S,
|
|
53
|
-
scrollContainerRef: M
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
export { v as t };
|
|
1
|
+
import"../esm/lib/constants.js";import{useConsumerState}from"../esm/lib/contexts/hooks.js";import{t as TemplateRowVariant}from"./types.js";import{t as LoadMoreErrorRow}from"./load-more-error-row.js";import{t as LoadMoreLoadingRow}from"./load-more-loading-row.js";import{t as GridListLoadMoreSentinel}from"./grid-list-load-more-sentinel.js";import{useCallback,useMemo,useRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{Collection,GridList,ListLayout,Virtualizer}from"react-aria-components";import '../styles/virtualized-grid-list.css';var virtualized_grid_list_module_default={list:`_list_dukvn_1`},BROWSE_ESTIMATED_ROW_HEIGHT=40,SEARCH_ESTIMATED_ROW_HEIGHT=58,ROW_GAP=2;function VirtualizedGridList({ariaLabel,items,onAction,children,onLoadMore,hasMoreItems,isFetchingMore,loadMoreError,onRetry,selectedKeys,listType}){let{isDisabled,appliedTemplateIds}=useConsumerState(),listLayout=useMemo(()=>new ListLayout({estimatedRowHeight:listType===TemplateRowVariant.Browse?BROWSE_ESTIMATED_ROW_HEIGHT:SEARCH_ESTIMATED_ROW_HEIGHT,gap:ROW_GAP}),[listType]),scrollContainerRef=useRef(null),handleAction=useCallback(key=>{if(key===`LOAD_MORE_ERROR_ROW_ID`){isDisabled||onRetry();return}onAction(key)},[isDisabled,onAction,onRetry]),handleSelectionChange=useCallback(selection=>{if(selection===`all`)return;let[key]=selection;key!==void 0&&!selectedKeys.has(String(key))&&!appliedTemplateIds.has(String(key))&&handleAction(key)},[appliedTemplateIds,handleAction,selectedKeys]),showLoadMoreTrigger=hasMoreItems&&!isFetchingMore&&loadMoreError===null&&!isDisabled;return jsx(Virtualizer,{layout:listLayout,children:jsxs(GridList,{ref:scrollContainerRef,"aria-label":ariaLabel,className:virtualized_grid_list_module_default.list,onSelectionChange:handleSelectionChange,selectedKeys,selectionMode:`single`,shouldSelectOnPressUp:!0,children:[jsx(Collection,{items,children}),isFetchingMore&&jsx(LoadMoreLoadingRow,{}),loadMoreError!==null&&jsx(LoadMoreErrorRow,{onRetry}),showLoadMoreTrigger&&jsx(GridListLoadMoreSentinel,{onLoadMore,scrollContainerRef})]})})}export{VirtualizedGridList as t};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as MetadataTemplateBrowser };
|
|
1
|
+
import{MetadataTemplateBrowser}from"./lib/metadata-template-browser.js";export{MetadataTemplateBrowser};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as BreadcrumbNavigation };
|
|
1
|
+
import{t as BreadcrumbNavigation}from"../../../../chunks/breadcrumb-navigation.js";export{BreadcrumbNavigation};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as BreadcrumbNavigation };
|
|
1
|
+
import{t as BreadcrumbNavigation}from"../../../../chunks/breadcrumb-navigation.js";export{BreadcrumbNavigation};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
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
|
-
});
|
|
16
|
-
export { t as messages };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({breadcrumbAriaLabel:{id:`groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.breadcrumbAriaLabel`,defaultMessage:`Navigation`},enterpriseCrumbLabel:{id:`groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.enterpriseCrumbLabel`,defaultMessage:`Enterprise`},truncatedLinksIconAriaLabel:{id:`groupSharedFeatures.metadataTemplateBrowser.breadcrumbNavigation.truncatedLinksIconAriaLabel`,defaultMessage:`Show more`}});export{messages};
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as i } from "../../../../chunks/types.js";
|
|
3
|
-
import { ErrorState as a } from "../error-state/error-state.js";
|
|
4
|
-
import { t as o } from "../../../../chunks/loader-skeleton.js";
|
|
5
|
-
import { NamespaceRow as s } from "../namespace-row/namespace-row.js";
|
|
6
|
-
import { TemplateRow as c } from "../template-row/template-row.js";
|
|
7
|
-
import { t as l } from "../../../../chunks/virtualized-grid-list.js";
|
|
8
|
-
import { messages as u } from "./messages.js";
|
|
9
|
-
import { EmptyState as d, Text as f } from "@box/blueprint-web";
|
|
10
|
-
import { useIntl as p } from "react-intl";
|
|
11
|
-
import { useCallback as m } from "react";
|
|
12
|
-
import { jsx as h } from "react/jsx-runtime";
|
|
13
|
-
import { NoTemplates as g } from "@box/blueprint-web-assets/illustrations/Medium";
|
|
14
|
-
function _({ onAction: _, selectedKeys: v }) {
|
|
15
|
-
let { formatMessage: y } = p(), { namespaces: b, templates: x, isNamespacesExhausted: S, namespaceNextMarker: C, templateNextMarker: w, isFetching: T, isFetchingMore: E, browseError: D, loadMoreError: O } = e(), { loadMore: k, retry: A, editTemplate: j, createTemplate: M } = t(), { namespaceFQN: N, canCreateInCurrentNamespace: P } = r(), { isDisabled: F } = n(), I = C !== void 0 || S && w !== void 0, L = m((e) => e.kind === "namespace" ? /* @__PURE__ */ h(s, { namespace: e.namespace }) : /* @__PURE__ */ h(c, {
|
|
16
|
-
onEdit: j,
|
|
17
|
-
template: e.template,
|
|
18
|
-
variant: i.Browse
|
|
19
|
-
}), [j]);
|
|
20
|
-
if (T) return /* @__PURE__ */ h(o, {});
|
|
21
|
-
if (D !== null) return /* @__PURE__ */ h(a, {
|
|
22
|
-
body: y(u.browseErrorBody),
|
|
23
|
-
onRetry: A
|
|
24
|
-
});
|
|
25
|
-
let R = S ? x : [], z = [...b.map((e) => ({
|
|
26
|
-
id: e.id,
|
|
27
|
-
kind: "namespace",
|
|
28
|
-
namespace: e
|
|
29
|
-
})), ...R.map((e) => ({
|
|
30
|
-
id: e.id,
|
|
31
|
-
kind: "template",
|
|
32
|
-
template: e
|
|
33
|
-
}))];
|
|
34
|
-
return z.length === 0 ? /* @__PURE__ */ h(d, {
|
|
35
|
-
body: /* @__PURE__ */ h(f, {
|
|
36
|
-
as: "p",
|
|
37
|
-
children: y(u.emptyStateBody)
|
|
38
|
-
}),
|
|
39
|
-
illustration: g,
|
|
40
|
-
size: "small",
|
|
41
|
-
children: P && /* @__PURE__ */ h(d.PrimaryAction, {
|
|
42
|
-
disabled: F,
|
|
43
|
-
onClick: () => M(N),
|
|
44
|
-
children: y(u.createFirstTemplateButtonLabel)
|
|
45
|
-
})
|
|
46
|
-
}) : /* @__PURE__ */ h(l, {
|
|
47
|
-
ariaLabel: y(u.listAriaLabel),
|
|
48
|
-
isFetchingMore: E,
|
|
49
|
-
items: z,
|
|
50
|
-
listType: i.Browse,
|
|
51
|
-
loadMoreError: O,
|
|
52
|
-
onAction: _,
|
|
53
|
-
hasMoreItems: I,
|
|
54
|
-
onLoadMore: k,
|
|
55
|
-
onRetry: k,
|
|
56
|
-
selectedKeys: v,
|
|
57
|
-
children: L
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
export { _ as BrowseList };
|
|
1
|
+
import{useBrowseState,useBrowserActions,useConsumerState,useNavigationState}from"../../contexts/hooks.js";import{t as TemplateRowVariant}from"../../../../chunks/types.js";import{ErrorState}from"../error-state/error-state.js";import{t as LoaderSkeleton}from"../../../../chunks/loader-skeleton.js";import{NamespaceRow}from"../namespace-row/namespace-row.js";import{TemplateRow}from"../template-row/template-row.js";import{t as VirtualizedGridList}from"../../../../chunks/virtualized-grid-list.js";import{messages}from"./messages.js";import{EmptyState,Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{useCallback}from"react";import{jsx}from"react/jsx-runtime";import{NoTemplates}from"@box/blueprint-web-assets/illustrations/Medium";function BrowseList({onAction,selectedKeys}){let{formatMessage}=useIntl(),{namespaces,templates,isNamespacesExhausted,namespaceNextMarker,templateNextMarker,isFetching,isFetchingMore,browseError,loadMoreError}=useBrowseState(),{loadMore,retry,editTemplate,createTemplate}=useBrowserActions(),{namespaceFQN,canCreateInCurrentNamespace}=useNavigationState(),{isDisabled}=useConsumerState(),hasMoreBrowseItems=namespaceNextMarker!==void 0||isNamespacesExhausted&&templateNextMarker!==void 0,renderItem=useCallback(item=>item.kind===`namespace`?jsx(NamespaceRow,{namespace:item.namespace}):jsx(TemplateRow,{onEdit:editTemplate,template:item.template,variant:TemplateRowVariant.Browse}),[editTemplate]);if(isFetching)return jsx(LoaderSkeleton,{});if(browseError!==null)return jsx(ErrorState,{body:formatMessage(messages.browseErrorBody),onRetry:retry});let visibleTemplates=isNamespacesExhausted?templates:[],items=[...namespaces.map(namespace=>({id:namespace.id,kind:`namespace`,namespace})),...visibleTemplates.map(template=>({id:template.id,kind:`template`,template}))];return items.length===0?jsx(EmptyState,{body:jsx(Text,{as:`p`,children:formatMessage(messages.emptyStateBody)}),illustration:NoTemplates,size:`small`,children:canCreateInCurrentNamespace&&jsx(EmptyState.PrimaryAction,{disabled:isDisabled,onClick:()=>createTemplate(namespaceFQN),children:formatMessage(messages.createFirstTemplateButtonLabel)})}):jsx(VirtualizedGridList,{ariaLabel:formatMessage(messages.listAriaLabel),isFetchingMore,items,listType:TemplateRowVariant.Browse,loadMoreError,onAction,hasMoreItems:hasMoreBrowseItems,onLoadMore:loadMore,onRetry:loadMore,selectedKeys,children:renderItem})}export{BrowseList};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as BrowseList };
|
|
1
|
+
import{BrowseList}from"./browse-list.js";export{BrowseList};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
listAriaLabel: {
|
|
4
|
-
id: "groupSharedFeatures.metadataTemplateBrowser.browseList.listAriaLabel",
|
|
5
|
-
defaultMessage: "Metadata templates"
|
|
6
|
-
},
|
|
7
|
-
browseErrorBody: {
|
|
8
|
-
id: "groupSharedFeatures.metadataTemplateBrowser.browseList.browseErrorBody",
|
|
9
|
-
defaultMessage: "Something went wrong while loading this namespace."
|
|
10
|
-
},
|
|
11
|
-
emptyStateBody: {
|
|
12
|
-
id: "groupSharedFeatures.metadataTemplateBrowser.browseList.emptyStateBody",
|
|
13
|
-
defaultMessage: "There are no templates or namespaces in this folder."
|
|
14
|
-
},
|
|
15
|
-
createFirstTemplateButtonLabel: {
|
|
16
|
-
id: "groupSharedFeatures.metadataTemplateBrowser.browseList.createFirstTemplateButtonLabel",
|
|
17
|
-
defaultMessage: "Create first template"
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
export { t as messages };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({listAriaLabel:{id:`groupSharedFeatures.metadataTemplateBrowser.browseList.listAriaLabel`,defaultMessage:`Metadata templates`},browseErrorBody:{id:`groupSharedFeatures.metadataTemplateBrowser.browseList.browseErrorBody`,defaultMessage:`Something went wrong while loading this namespace.`},emptyStateBody:{id:`groupSharedFeatures.metadataTemplateBrowser.browseList.emptyStateBody`,defaultMessage:`There are no templates or namespaces in this folder.`},createFirstTemplateButtonLabel:{id:`groupSharedFeatures.metadataTemplateBrowser.browseList.createFirstTemplateButtonLabel`,defaultMessage:`Create first template`}});export{messages};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as BrowserRow };
|
|
1
|
+
import{t as BrowserRow}from"../../../../chunks/browser-row.js";export{BrowserRow};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as BrowserRow };
|
|
1
|
+
import{t as BrowserRow}from"../../../../chunks/browser-row.js";export{BrowserRow};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { messages as t } from "./messages.js";
|
|
3
|
-
import { EmptyState as n, Text as r } from "@box/blueprint-web";
|
|
4
|
-
import { useIntl as i } from "react-intl";
|
|
5
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
-
import { CustomTemplate as o } from "@box/blueprint-web-assets/illustrations/Small";
|
|
7
|
-
function s({ body: s, onRetry: c }) {
|
|
8
|
-
let { formatMessage: l } = i(), { isDisabled: u } = e();
|
|
9
|
-
return /* @__PURE__ */ a(n, {
|
|
10
|
-
body: /* @__PURE__ */ a(r, {
|
|
11
|
-
as: "p",
|
|
12
|
-
children: s
|
|
13
|
-
}),
|
|
14
|
-
illustration: o,
|
|
15
|
-
size: "small",
|
|
16
|
-
children: /* @__PURE__ */ a(n.PrimaryAction, {
|
|
17
|
-
disabled: u,
|
|
18
|
-
onClick: c,
|
|
19
|
-
children: l(t.retryLabel)
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
export { s as ErrorState };
|
|
1
|
+
import{useConsumerState}from"../../contexts/hooks.js";import{messages}from"./messages.js";import{EmptyState,Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{CustomTemplate}from"@box/blueprint-web-assets/illustrations/Small";function ErrorState({body,onRetry}){let{formatMessage}=useIntl(),{isDisabled}=useConsumerState();return jsx(EmptyState,{body:jsx(Text,{as:`p`,children:body}),illustration:CustomTemplate,size:`small`,children:jsx(EmptyState.PrimaryAction,{disabled:isDisabled,onClick:onRetry,children:formatMessage(messages.retryLabel)})})}export{ErrorState};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ErrorState };
|
|
1
|
+
import{ErrorState}from"./error-state.js";export{ErrorState};
|