@box/metadata-template-browser 1.24.13 → 2.1.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.
@@ -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
- var _ = /* @__PURE__ */ function(e) {
15
- return e.Namespace = "namespace", e.Template = "template", e;
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
- }), [M]);
23
- if (E) return /* @__PURE__ */ h(o, {});
24
- if (O !== null) return /* @__PURE__ */ h(a, {
25
- body: b(u.browseErrorBody),
26
- onRetry: j
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 z = C ? S : [], B = [...x.map((e) => ({
25
+ let R = S ? x : [], z = [...b.map((e) => ({
29
26
  id: e.id,
30
- kind: _.Namespace,
27
+ kind: "namespace",
31
28
  namespace: e
32
- })), ...z.map((e) => ({
29
+ })), ...R.map((e) => ({
33
30
  id: e.id,
34
- kind: _.Template,
31
+ kind: "template",
35
32
  template: e
36
33
  }))];
37
- return B.length === 0 ? /* @__PURE__ */ h(d, {
34
+ return z.length === 0 ? /* @__PURE__ */ h(d, {
38
35
  body: /* @__PURE__ */ h(f, {
39
36
  as: "p",
40
- children: b(u.emptyStateBody)
37
+ children: y(u.emptyStateBody)
41
38
  }),
42
39
  illustration: g,
43
40
  size: "small",
44
- children: F && /* @__PURE__ */ h(d.PrimaryAction, {
45
- disabled: I,
46
- onClick: () => N(P),
47
- children: b(u.createFirstTemplateButtonLabel)
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: b(u.listAriaLabel),
51
- isFetchingMore: D,
52
- items: B,
47
+ ariaLabel: y(u.listAriaLabel),
48
+ isFetchingMore: E,
49
+ items: z,
53
50
  listType: i.Browse,
54
- loadMoreError: k,
55
- onAction: v,
56
- hasMoreItems: L,
57
- onLoadMore: A,
58
- onRetry: A,
59
- selectedKeys: y,
60
- children: R
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 { v as BrowseList };
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 = /* @__PURE__ */ t(null);
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 = /* @__PURE__ */ t(null);
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 = /* @__PURE__ */ t(null);
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 = /* @__PURE__ */ t(null);
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 = /* @__PURE__ */ t(null), p = /* @__PURE__ */ new Set();
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 = /* @__PURE__ */ t(null);
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(t, n) {
26
- switch (n.type) {
27
- case e.NavigateTo: return {
28
- ...t,
29
- namespaceFQN: n.namespace.id,
30
- path: [...t.path, {
31
- fqn: n.namespace.id,
32
- displayName: n.namespace.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: n.namespace.canCreate ?? !1,
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 e.NavigateBack: return {
45
- ...t,
46
- namespaceFQN: n.fqn,
47
- path: t.path.filter((e) => n.fqn === e.fqn || n.fqn.startsWith(`${e.fqn}.`)),
48
- canCreateInCurrentNamespace: n.cached.canCreate,
49
- namespaces: n.cached.namespaces,
50
- templates: n.cached.templates,
51
- namespaceNextMarker: n.cached.namespaceNextMarker,
52
- templateNextMarker: n.cached.templateNextMarker,
53
- isNamespacesExhausted: n.cached.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 e.BrowseFetchStart: return {
60
- ...t,
59
+ case "BROWSE_FETCH_START": return {
60
+ ...e,
61
61
  isFetching: !0,
62
62
  initialLoadError: null,
63
63
  browseError: null
64
64
  };
65
- case e.BrowseLoaded: return {
66
- ...t,
65
+ case "BROWSE_LOADED": return {
66
+ ...e,
67
67
  isFetching: !1,
68
- namespaces: n.namespaces,
69
- namespaceNextMarker: n.namespaceNextMarker,
70
- isNamespacesExhausted: !n.namespaceNextMarker,
71
- templates: n.templates,
72
- templateNextMarker: n.templateNextMarker
73
- };
74
- case e.InitialLoadError: return {
75
- ...t,
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: n.error
77
+ initialLoadError: t.error
78
78
  };
79
- case e.BrowseError: return {
80
- ...t,
79
+ case "BROWSE_ERROR": return {
80
+ ...e,
81
81
  isFetching: !1,
82
- browseError: n.error
82
+ browseError: t.error
83
83
  };
84
- case e.LoadMoreStart: return {
85
- ...t,
84
+ case "LOAD_MORE_START": return {
85
+ ...e,
86
86
  isFetchingMore: !0,
87
87
  loadMoreError: null
88
88
  };
89
- case e.LoadMoreNamespacesLoaded: return {
90
- ...t,
89
+ case "LOAD_MORE_NAMESPACES_LOADED": return {
90
+ ...e,
91
91
  isFetchingMore: !1,
92
- namespaces: [...t.namespaces, ...n.entries],
93
- namespaceNextMarker: n.nextMarker,
94
- isNamespacesExhausted: !n.nextMarker,
95
- ...n.templates !== void 0 && {
96
- templates: n.templates,
97
- templateNextMarker: n.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 e.LoadMoreTemplatesLoaded: return {
101
- ...t,
100
+ case "LOAD_MORE_TEMPLATES_LOADED": return {
101
+ ...e,
102
102
  isFetchingMore: !1,
103
- templates: [...t.templates, ...n.entries],
104
- templateNextMarker: n.nextMarker
103
+ templates: [...e.templates, ...t.entries],
104
+ templateNextMarker: t.nextMarker
105
105
  };
106
- case e.LoadMoreError: return {
107
- ...t,
106
+ case "LOAD_MORE_ERROR": return {
107
+ ...e,
108
108
  isFetchingMore: !1,
109
- loadMoreError: n.error
109
+ loadMoreError: t.error
110
110
  };
111
- case e.SearchValueChange: return {
112
- ...t,
113
- searchValue: n.value
111
+ case "SEARCH_VALUE_CHANGE": return {
112
+ ...e,
113
+ searchValue: t.value
114
114
  };
115
- case e.SearchFetchStart: return {
116
- ...t,
115
+ case "SEARCH_FETCH_START": return {
116
+ ...e,
117
117
  isFetchingSearch: !0,
118
- searchQuery: n.query,
118
+ searchQuery: t.query,
119
119
  searchResults: [],
120
120
  searchNextMarker: void 0,
121
121
  searchError: null
122
122
  };
123
- case e.SearchLoaded: return {
124
- ...t,
123
+ case "SEARCH_LOADED": return {
124
+ ...e,
125
125
  isFetchingSearch: !1,
126
- searchResults: n.results,
127
- searchNextMarker: n.nextMarker
126
+ searchResults: t.results,
127
+ searchNextMarker: t.nextMarker
128
128
  };
129
- case e.SearchError: return {
130
- ...t,
129
+ case "SEARCH_ERROR": return {
130
+ ...e,
131
131
  isFetchingSearch: !1,
132
- searchError: n.error
132
+ searchError: t.error
133
133
  };
134
- case e.SearchClear: return {
135
- ...t,
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 e.LoadMoreSearchLoaded: return {
144
- ...t,
143
+ case "LOAD_MORE_SEARCH_LOADED": return {
144
+ ...e,
145
145
  isFetchingMore: !1,
146
- searchResults: [...t.searchResults, ...n.entries],
147
- searchNextMarker: n.nextMarker
146
+ searchResults: [...e.searchResults, ...t.entries],
147
+ searchNextMarker: t.nextMarker
148
148
  };
149
- case e.TemplateSelect: return {
150
- ...t,
151
- selectedTemplateId: n.template.id
149
+ case "TEMPLATE_SELECT": return {
150
+ ...e,
151
+ selectedTemplateId: t.template.id
152
152
  };
153
- default: return t;
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": "1.24.13",
3
+ "version": "2.1.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^15.10.0",
7
- "@box/blueprint-web-assets": "^4.131.1",
6
+ "@box/blueprint-web": "^16.1.0",
7
+ "@box/blueprint-web-assets": "^5.1.0",
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": "^15.10.0",
16
- "@box/blueprint-web-assets": "^4.131.1",
17
- "@box/eslint-plugin-blueprint": "1.2.7",
18
- "@box/storybook-utils": "0.21.13",
15
+ "@box/blueprint-web": "^16.1.0",
16
+ "@box/blueprint-web-assets": "^5.1.0",
17
+ "@box/eslint-plugin-blueprint": "2.1.0",
18
+ "@box/storybook-utils": "1.1.0",
19
19
  "react-intl": "^6.4.2"
20
20
  },
21
21
  "publishConfig": {