@box/metadata-template-browser 2.0.0 → 2.1.1
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.
|
@@ -11,53 +11,50 @@ import { useIntl as p } from "react-intl";
|
|
|
11
11
|
import { useCallback as m } from "react";
|
|
12
12
|
import { jsx as h } from "react/jsx-runtime";
|
|
13
13
|
import { NoTemplates as g } from "@box/blueprint-web-assets/illustrations/Medium";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function v({ onAction: v, selectedKeys: y }) {
|
|
18
|
-
let { formatMessage: b } = p(), { namespaces: x, templates: S, isNamespacesExhausted: C, namespaceNextMarker: w, templateNextMarker: T, isFetching: E, isFetchingMore: D, browseError: O, loadMoreError: k } = e(), { loadMore: A, retry: j, editTemplate: M, createTemplate: N } = t(), { namespaceFQN: P, canCreateInCurrentNamespace: F } = r(), { isDisabled: I } = n(), L = w !== void 0 || C && T !== void 0, R = m((e) => e.kind === _.Namespace ? /* @__PURE__ */ h(s, { namespace: e.namespace }) : /* @__PURE__ */ h(c, {
|
|
19
|
-
onEdit: M,
|
|
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,
|
|
20
17
|
template: e.template,
|
|
21
18
|
variant: i.Browse
|
|
22
|
-
}), [
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
body:
|
|
26
|
-
onRetry:
|
|
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
|
|
27
24
|
});
|
|
28
|
-
let
|
|
25
|
+
let R = S ? x : [], z = [...b.map((e) => ({
|
|
29
26
|
id: e.id,
|
|
30
|
-
kind:
|
|
27
|
+
kind: "namespace",
|
|
31
28
|
namespace: e
|
|
32
|
-
})), ...
|
|
29
|
+
})), ...R.map((e) => ({
|
|
33
30
|
id: e.id,
|
|
34
|
-
kind:
|
|
31
|
+
kind: "template",
|
|
35
32
|
template: e
|
|
36
33
|
}))];
|
|
37
|
-
return
|
|
34
|
+
return z.length === 0 ? /* @__PURE__ */ h(d, {
|
|
38
35
|
body: /* @__PURE__ */ h(f, {
|
|
39
36
|
as: "p",
|
|
40
|
-
children:
|
|
37
|
+
children: y(u.emptyStateBody)
|
|
41
38
|
}),
|
|
42
39
|
illustration: g,
|
|
43
40
|
size: "small",
|
|
44
|
-
children:
|
|
45
|
-
disabled:
|
|
46
|
-
onClick: () => N
|
|
47
|
-
children:
|
|
41
|
+
children: P && /* @__PURE__ */ h(d.PrimaryAction, {
|
|
42
|
+
disabled: F,
|
|
43
|
+
onClick: () => M(N),
|
|
44
|
+
children: y(u.createFirstTemplateButtonLabel)
|
|
48
45
|
})
|
|
49
46
|
}) : /* @__PURE__ */ h(l, {
|
|
50
|
-
ariaLabel:
|
|
51
|
-
isFetchingMore:
|
|
52
|
-
items:
|
|
47
|
+
ariaLabel: y(u.listAriaLabel),
|
|
48
|
+
isFetchingMore: E,
|
|
49
|
+
items: z,
|
|
53
50
|
listType: i.Browse,
|
|
54
|
-
loadMoreError:
|
|
55
|
-
onAction:
|
|
56
|
-
hasMoreItems:
|
|
57
|
-
onLoadMore:
|
|
58
|
-
onRetry:
|
|
59
|
-
selectedKeys:
|
|
60
|
-
children:
|
|
51
|
+
loadMoreError: O,
|
|
52
|
+
onAction: _,
|
|
53
|
+
hasMoreItems: I,
|
|
54
|
+
onLoadMore: k,
|
|
55
|
+
onRetry: k,
|
|
56
|
+
selectedKeys: v,
|
|
57
|
+
children: L
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
|
-
export {
|
|
60
|
+
export { _ as BrowseList };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTemplateBrowserActions as e } from "./use-template-browser-actions.js";
|
|
2
2
|
import { createContext as t, useMemo as n } from "react";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
-
var i =
|
|
4
|
+
var i = /*#__PURE__*/ t(null);
|
|
5
5
|
function a({ children: e, namespaceFQN: t, path: a, canCreateInCurrentNamespace: o }) {
|
|
6
6
|
let s = n(() => ({
|
|
7
7
|
namespaceFQN: t,
|
|
@@ -17,7 +17,7 @@ function a({ children: e, namespaceFQN: t, path: a, canCreateInCurrentNamespace:
|
|
|
17
17
|
children: e
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
var o =
|
|
20
|
+
var o = /*#__PURE__*/ t(null);
|
|
21
21
|
function s({ children: e, namespaces: t, templates: i, isNamespacesExhausted: a, namespaceNextMarker: s, templateNextMarker: c, isFetching: l, isFetchingMore: u, initialLoadError: d, browseError: f, loadMoreError: p }) {
|
|
22
22
|
let m = n(() => ({
|
|
23
23
|
namespaces: t,
|
|
@@ -47,7 +47,7 @@ function s({ children: e, namespaces: t, templates: i, isNamespacesExhausted: a,
|
|
|
47
47
|
children: e
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
var c =
|
|
50
|
+
var c = /*#__PURE__*/ t(null);
|
|
51
51
|
function l({ children: e, searchValue: t, searchQuery: i, searchResults: a, searchNextMarker: o, isFetchingSearch: s, searchError: l }) {
|
|
52
52
|
let u = n(() => ({
|
|
53
53
|
searchValue: t,
|
|
@@ -69,7 +69,7 @@ function l({ children: e, searchValue: t, searchQuery: i, searchResults: a, sear
|
|
|
69
69
|
children: e
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
var u =
|
|
72
|
+
var u = /*#__PURE__*/ t(null);
|
|
73
73
|
function d({ children: e, selectedTemplateId: t }) {
|
|
74
74
|
let i = n(() => ({ selectedTemplateId: t }), [t]);
|
|
75
75
|
return /* @__PURE__ */ r(u.Provider, {
|
|
@@ -77,7 +77,7 @@ function d({ children: e, selectedTemplateId: t }) {
|
|
|
77
77
|
children: e
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
var f =
|
|
80
|
+
var f = /*#__PURE__*/ t(null), p = /* @__PURE__ */ new Set();
|
|
81
81
|
function m({ children: e, isLoading: t = !1, isDisabled: i = !1, appliedTemplateIds: a = p }) {
|
|
82
82
|
let o = n(() => ({
|
|
83
83
|
isLoading: t,
|
|
@@ -93,7 +93,7 @@ function m({ children: e, isLoading: t = !1, isDisabled: i = !1, appliedTemplate
|
|
|
93
93
|
children: e
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
var h =
|
|
96
|
+
var h = /*#__PURE__*/ t(null);
|
|
97
97
|
function g({ children: t, itemsServiceRef: n, eventServiceRef: i, stateRef: a, dispatch: o, levelCache: s }) {
|
|
98
98
|
let c = e(n, i, a, o, s);
|
|
99
99
|
return /* @__PURE__ */ r(h.Provider, {
|
|
@@ -22,16 +22,16 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
22
22
|
searchError: null,
|
|
23
23
|
selectedTemplateId: null
|
|
24
24
|
};
|
|
25
|
-
function n(
|
|
26
|
-
switch (
|
|
27
|
-
case
|
|
28
|
-
...
|
|
29
|
-
namespaceFQN:
|
|
30
|
-
path: [...
|
|
31
|
-
fqn:
|
|
32
|
-
displayName:
|
|
25
|
+
function n(e, t) {
|
|
26
|
+
switch (t.type) {
|
|
27
|
+
case "NAVIGATE_TO": return {
|
|
28
|
+
...e,
|
|
29
|
+
namespaceFQN: t.namespace.id,
|
|
30
|
+
path: [...e.path, {
|
|
31
|
+
fqn: t.namespace.id,
|
|
32
|
+
displayName: t.namespace.displayName
|
|
33
33
|
}],
|
|
34
|
-
canCreateInCurrentNamespace:
|
|
34
|
+
canCreateInCurrentNamespace: t.namespace.canCreate ?? !1,
|
|
35
35
|
namespaces: [],
|
|
36
36
|
templates: [],
|
|
37
37
|
namespaceNextMarker: void 0,
|
|
@@ -41,98 +41,98 @@ function n(t, n) {
|
|
|
41
41
|
browseError: null,
|
|
42
42
|
loadMoreError: null
|
|
43
43
|
};
|
|
44
|
-
case
|
|
45
|
-
...
|
|
46
|
-
namespaceFQN:
|
|
47
|
-
path:
|
|
48
|
-
canCreateInCurrentNamespace:
|
|
49
|
-
namespaces:
|
|
50
|
-
templates:
|
|
51
|
-
namespaceNextMarker:
|
|
52
|
-
templateNextMarker:
|
|
53
|
-
isNamespacesExhausted:
|
|
44
|
+
case "NAVIGATE_BACK": return {
|
|
45
|
+
...e,
|
|
46
|
+
namespaceFQN: t.fqn,
|
|
47
|
+
path: e.path.filter((e) => t.fqn === e.fqn || t.fqn.startsWith(`${e.fqn}.`)),
|
|
48
|
+
canCreateInCurrentNamespace: t.cached.canCreate,
|
|
49
|
+
namespaces: t.cached.namespaces,
|
|
50
|
+
templates: t.cached.templates,
|
|
51
|
+
namespaceNextMarker: t.cached.namespaceNextMarker,
|
|
52
|
+
templateNextMarker: t.cached.templateNextMarker,
|
|
53
|
+
isNamespacesExhausted: t.cached.isNamespacesExhausted,
|
|
54
54
|
isFetching: !1,
|
|
55
55
|
initialLoadError: null,
|
|
56
56
|
browseError: null,
|
|
57
57
|
loadMoreError: null
|
|
58
58
|
};
|
|
59
|
-
case
|
|
60
|
-
...
|
|
59
|
+
case "BROWSE_FETCH_START": return {
|
|
60
|
+
...e,
|
|
61
61
|
isFetching: !0,
|
|
62
62
|
initialLoadError: null,
|
|
63
63
|
browseError: null
|
|
64
64
|
};
|
|
65
|
-
case
|
|
66
|
-
...
|
|
65
|
+
case "BROWSE_LOADED": return {
|
|
66
|
+
...e,
|
|
67
67
|
isFetching: !1,
|
|
68
|
-
namespaces:
|
|
69
|
-
namespaceNextMarker:
|
|
70
|
-
isNamespacesExhausted: !
|
|
71
|
-
templates:
|
|
72
|
-
templateNextMarker:
|
|
73
|
-
};
|
|
74
|
-
case
|
|
75
|
-
...
|
|
68
|
+
namespaces: t.namespaces,
|
|
69
|
+
namespaceNextMarker: t.namespaceNextMarker,
|
|
70
|
+
isNamespacesExhausted: !t.namespaceNextMarker,
|
|
71
|
+
templates: t.templates,
|
|
72
|
+
templateNextMarker: t.templateNextMarker
|
|
73
|
+
};
|
|
74
|
+
case "INITIAL_LOAD_ERROR": return {
|
|
75
|
+
...e,
|
|
76
76
|
isFetching: !1,
|
|
77
|
-
initialLoadError:
|
|
77
|
+
initialLoadError: t.error
|
|
78
78
|
};
|
|
79
|
-
case
|
|
80
|
-
...
|
|
79
|
+
case "BROWSE_ERROR": return {
|
|
80
|
+
...e,
|
|
81
81
|
isFetching: !1,
|
|
82
|
-
browseError:
|
|
82
|
+
browseError: t.error
|
|
83
83
|
};
|
|
84
|
-
case
|
|
85
|
-
...
|
|
84
|
+
case "LOAD_MORE_START": return {
|
|
85
|
+
...e,
|
|
86
86
|
isFetchingMore: !0,
|
|
87
87
|
loadMoreError: null
|
|
88
88
|
};
|
|
89
|
-
case
|
|
90
|
-
...
|
|
89
|
+
case "LOAD_MORE_NAMESPACES_LOADED": return {
|
|
90
|
+
...e,
|
|
91
91
|
isFetchingMore: !1,
|
|
92
|
-
namespaces: [...
|
|
93
|
-
namespaceNextMarker:
|
|
94
|
-
isNamespacesExhausted: !
|
|
95
|
-
...
|
|
96
|
-
templates:
|
|
97
|
-
templateNextMarker:
|
|
92
|
+
namespaces: [...e.namespaces, ...t.entries],
|
|
93
|
+
namespaceNextMarker: t.nextMarker,
|
|
94
|
+
isNamespacesExhausted: !t.nextMarker,
|
|
95
|
+
...t.templates !== void 0 && {
|
|
96
|
+
templates: t.templates,
|
|
97
|
+
templateNextMarker: t.templateNextMarker
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
case
|
|
101
|
-
...
|
|
100
|
+
case "LOAD_MORE_TEMPLATES_LOADED": return {
|
|
101
|
+
...e,
|
|
102
102
|
isFetchingMore: !1,
|
|
103
|
-
templates: [...
|
|
104
|
-
templateNextMarker:
|
|
103
|
+
templates: [...e.templates, ...t.entries],
|
|
104
|
+
templateNextMarker: t.nextMarker
|
|
105
105
|
};
|
|
106
|
-
case
|
|
107
|
-
...
|
|
106
|
+
case "LOAD_MORE_ERROR": return {
|
|
107
|
+
...e,
|
|
108
108
|
isFetchingMore: !1,
|
|
109
|
-
loadMoreError:
|
|
109
|
+
loadMoreError: t.error
|
|
110
110
|
};
|
|
111
|
-
case
|
|
112
|
-
...
|
|
113
|
-
searchValue:
|
|
111
|
+
case "SEARCH_VALUE_CHANGE": return {
|
|
112
|
+
...e,
|
|
113
|
+
searchValue: t.value
|
|
114
114
|
};
|
|
115
|
-
case
|
|
116
|
-
...
|
|
115
|
+
case "SEARCH_FETCH_START": return {
|
|
116
|
+
...e,
|
|
117
117
|
isFetchingSearch: !0,
|
|
118
|
-
searchQuery:
|
|
118
|
+
searchQuery: t.query,
|
|
119
119
|
searchResults: [],
|
|
120
120
|
searchNextMarker: void 0,
|
|
121
121
|
searchError: null
|
|
122
122
|
};
|
|
123
|
-
case
|
|
124
|
-
...
|
|
123
|
+
case "SEARCH_LOADED": return {
|
|
124
|
+
...e,
|
|
125
125
|
isFetchingSearch: !1,
|
|
126
|
-
searchResults:
|
|
127
|
-
searchNextMarker:
|
|
126
|
+
searchResults: t.results,
|
|
127
|
+
searchNextMarker: t.nextMarker
|
|
128
128
|
};
|
|
129
|
-
case
|
|
130
|
-
...
|
|
129
|
+
case "SEARCH_ERROR": return {
|
|
130
|
+
...e,
|
|
131
131
|
isFetchingSearch: !1,
|
|
132
|
-
searchError:
|
|
132
|
+
searchError: t.error
|
|
133
133
|
};
|
|
134
|
-
case
|
|
135
|
-
...
|
|
134
|
+
case "SEARCH_CLEAR": return {
|
|
135
|
+
...e,
|
|
136
136
|
searchValue: "",
|
|
137
137
|
searchQuery: "",
|
|
138
138
|
searchResults: [],
|
|
@@ -140,17 +140,17 @@ function n(t, n) {
|
|
|
140
140
|
isFetchingSearch: !1,
|
|
141
141
|
searchError: null
|
|
142
142
|
};
|
|
143
|
-
case
|
|
144
|
-
...
|
|
143
|
+
case "LOAD_MORE_SEARCH_LOADED": return {
|
|
144
|
+
...e,
|
|
145
145
|
isFetchingMore: !1,
|
|
146
|
-
searchResults: [...
|
|
147
|
-
searchNextMarker:
|
|
146
|
+
searchResults: [...e.searchResults, ...t.entries],
|
|
147
|
+
searchNextMarker: t.nextMarker
|
|
148
148
|
};
|
|
149
|
-
case
|
|
150
|
-
...
|
|
151
|
-
selectedTemplateId:
|
|
149
|
+
case "TEMPLATE_SELECT": return {
|
|
150
|
+
...e,
|
|
151
|
+
selectedTemplateId: t.template.id
|
|
152
152
|
};
|
|
153
|
-
default: return
|
|
153
|
+
default: return e;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
export { e as BrowserActionType, n as browserReducer, t as initialState };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-template-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^16.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.
|
|
6
|
+
"@box/blueprint-web": "^16.1.1",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.1.1",
|
|
8
8
|
"lodash": "^4.17.15",
|
|
9
9
|
"react": "^18.0.0",
|
|
10
10
|
"react-aria-components": "1.16.0",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"react-intl": "^6.4.2"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@box/blueprint-web": "^16.
|
|
16
|
-
"@box/blueprint-web-assets": "^5.
|
|
17
|
-
"@box/eslint-plugin-blueprint": "2.
|
|
18
|
-
"@box/storybook-utils": "1.
|
|
15
|
+
"@box/blueprint-web": "^16.1.1",
|
|
16
|
+
"@box/blueprint-web-assets": "^5.1.1",
|
|
17
|
+
"@box/eslint-plugin-blueprint": "2.1.1",
|
|
18
|
+
"@box/storybook-utils": "1.1.1",
|
|
19
19
|
"react-intl": "^6.4.2"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|