@box/metadata-template-browser 1.17.32 → 1.19.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.
- package/dist/chunks/metadata-template-browser-list-box.js +48 -40
- package/dist/esm/lib/contexts/use-template-browser-actions.js +102 -100
- package/dist/esm/lib/hooks/use-focus-first-row-after-navigation.js +32 -0
- package/dist/types/lib/hooks/use-focus-first-row-after-navigation.d.ts +28 -0
- package/package.json +6 -6
|
@@ -1,57 +1,65 @@
|
|
|
1
|
-
import { useBrowseState as e, useBrowserActions as t, useConsumerState as n,
|
|
2
|
-
import { t as
|
|
3
|
-
import { BrowseList as
|
|
4
|
-
import { SearchList as
|
|
5
|
-
import { useIsInitialBrowseLoading as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
1
|
+
import { useBrowseState as e, useBrowserActions as t, useConsumerState as n, useNavigationState as r, useSearchState as i, useSelectionState as a } from "../esm/lib/contexts/hooks.js";
|
|
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 _ = {
|
|
10
11
|
listBox: "_listBox_1qbmg_1",
|
|
11
12
|
browseWrapper: "_browseWrapper_1qbmg_9",
|
|
12
13
|
hidden: "_hidden_1qbmg_16"
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
-
let { isDisabled:
|
|
16
|
-
|
|
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;
|
|
17
24
|
let t = String(e);
|
|
18
|
-
if (
|
|
19
|
-
let e =
|
|
20
|
-
e &&
|
|
25
|
+
if (k) {
|
|
26
|
+
let e = x.find((e) => e.id === t);
|
|
27
|
+
e && E(e);
|
|
21
28
|
return;
|
|
22
29
|
}
|
|
23
|
-
let n =
|
|
30
|
+
let n = C.find((e) => e.id === t);
|
|
24
31
|
if (n) {
|
|
25
|
-
|
|
32
|
+
E(n);
|
|
26
33
|
return;
|
|
27
34
|
}
|
|
28
|
-
let r =
|
|
29
|
-
r &&
|
|
35
|
+
let r = S.find((e) => e.id === t);
|
|
36
|
+
r && D(r);
|
|
30
37
|
}, [
|
|
31
|
-
h,
|
|
32
|
-
w,
|
|
33
38
|
v,
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
k,
|
|
40
|
+
x,
|
|
41
|
+
C,
|
|
36
42
|
S,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
50
58
|
})
|
|
51
|
-
}),
|
|
52
|
-
onAction:
|
|
53
|
-
selectedKeys:
|
|
59
|
+
}), k && /* @__PURE__ */ h(c, {
|
|
60
|
+
onAction: j,
|
|
61
|
+
selectedKeys: M
|
|
54
62
|
})]
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
|
-
export {
|
|
65
|
+
export { v as t };
|
|
@@ -13,7 +13,7 @@ var o = (e) => new Promise((t, n) => {
|
|
|
13
13
|
let t = e();
|
|
14
14
|
t instanceof Promise && t.catch(() => void 0);
|
|
15
15
|
} catch {}
|
|
16
|
-
}, c = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "An unknown error occurred",
|
|
16
|
+
}, c = (e) => e.trim().replaceAll(/\s+/g, " "), l = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "An unknown error occurred", u = async (e, t, n, r) => {
|
|
17
17
|
try {
|
|
18
18
|
let r = await t();
|
|
19
19
|
e.aborted || n(r);
|
|
@@ -21,139 +21,141 @@ var o = (e) => new Promise((t, n) => {
|
|
|
21
21
|
e.aborted || r(t);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
|
|
24
|
+
function d(d, f, p, m, h) {
|
|
25
|
+
let g = i(null), _ = i(null), v = i(a(async (t) => {
|
|
26
|
+
_.current?.abort();
|
|
27
27
|
let n = new AbortController();
|
|
28
|
-
|
|
28
|
+
_.current = n;
|
|
29
29
|
let { signal: r } = n;
|
|
30
|
-
s(() =>
|
|
30
|
+
s(() => f.current.onSearchChange?.(t)), s(() => f.current.onNewViewLoading?.(!0)), await u(r, () => T(t, r), (t) => m({
|
|
31
31
|
type: e.SearchLoaded,
|
|
32
32
|
results: t.entries,
|
|
33
33
|
nextMarker: t.next_marker
|
|
34
|
-
}), (t) =>
|
|
34
|
+
}), (t) => m({
|
|
35
35
|
type: e.SearchError,
|
|
36
|
-
error:
|
|
37
|
-
})), r.aborted || s(() =>
|
|
38
|
-
}, 500)),
|
|
39
|
-
h.current?.abort();
|
|
40
|
-
let e = new AbortController();
|
|
41
|
-
return h.current = e, e.signal;
|
|
42
|
-
}, y = () => {
|
|
43
|
-
h.current?.abort(), h.current = null;
|
|
44
|
-
}, b = () => {
|
|
36
|
+
error: l(t)
|
|
37
|
+
})), r.aborted || s(() => f.current.onNewViewLoading?.(!1));
|
|
38
|
+
}, 500)), y = () => {
|
|
45
39
|
g.current?.abort();
|
|
46
40
|
let e = new AbortController();
|
|
47
41
|
return g.current = e, e.signal;
|
|
48
|
-
},
|
|
42
|
+
}, b = () => {
|
|
49
43
|
g.current?.abort(), g.current = null;
|
|
50
|
-
},
|
|
51
|
-
|
|
44
|
+
}, x = () => {
|
|
45
|
+
_.current?.abort();
|
|
46
|
+
let e = new AbortController();
|
|
47
|
+
return _.current = e, e.signal;
|
|
48
|
+
}, S = () => {
|
|
49
|
+
_.current?.abort(), _.current = null;
|
|
50
|
+
}, C = (e, n, r) => {
|
|
51
|
+
let i = d.current.getNamespaces;
|
|
52
52
|
return i ? Promise.race([i(e, {
|
|
53
53
|
limit: 200,
|
|
54
54
|
marker: r,
|
|
55
55
|
signal: n
|
|
56
56
|
}), o(n)]) : Promise.resolve(t);
|
|
57
|
-
},
|
|
58
|
-
let i =
|
|
57
|
+
}, w = (e, t, r) => {
|
|
58
|
+
let i = d.current.getTemplates;
|
|
59
59
|
return i ? Promise.race([i(e, {
|
|
60
60
|
limit: 200,
|
|
61
61
|
marker: r,
|
|
62
62
|
signal: t
|
|
63
63
|
}), o(t)]) : Promise.resolve(n);
|
|
64
|
-
},
|
|
65
|
-
let i =
|
|
64
|
+
}, T = (e, t, r) => {
|
|
65
|
+
let i = d.current.getSearchResults;
|
|
66
66
|
return i ? Promise.race([i(e, {
|
|
67
67
|
limit: 200,
|
|
68
68
|
marker: r,
|
|
69
69
|
signal: t
|
|
70
70
|
}), o(t)]) : Promise.resolve(n);
|
|
71
|
-
},
|
|
72
|
-
|
|
71
|
+
}, E = (e, t) => {
|
|
72
|
+
m({
|
|
73
73
|
type: e,
|
|
74
|
-
error:
|
|
74
|
+
error: l(t)
|
|
75
75
|
});
|
|
76
|
-
},
|
|
76
|
+
}, D = async (t, r, i) => {
|
|
77
77
|
let a = !1;
|
|
78
|
-
return await
|
|
79
|
-
let e = await
|
|
80
|
-
return [e, e.next_marker ? n : await
|
|
78
|
+
return await u(r, async () => {
|
|
79
|
+
let e = await C(t, r);
|
|
80
|
+
return [e, e.next_marker ? n : await w(t, r)];
|
|
81
81
|
}, ([t, n]) => {
|
|
82
|
-
|
|
82
|
+
m({
|
|
83
83
|
type: e.BrowseLoaded,
|
|
84
84
|
namespaces: t.entries,
|
|
85
85
|
namespaceNextMarker: t.next_marker,
|
|
86
86
|
templates: n.entries,
|
|
87
87
|
templateNextMarker: n.next_marker
|
|
88
88
|
}), a = !0;
|
|
89
|
-
}, (e) =>
|
|
90
|
-
},
|
|
91
|
-
let t =
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
let n =
|
|
95
|
-
|
|
89
|
+
}, (e) => E(i, e)), a;
|
|
90
|
+
}, O = async () => {
|
|
91
|
+
let t = y(), { namespaceFQN: n } = p.current;
|
|
92
|
+
m({ type: e.BrowseFetchStart }), s(() => f.current.onNewViewLoading?.(!0)), await D(n, t, e.InitialLoadError), t.aborted || s(() => f.current.onNewViewLoading?.(!1));
|
|
93
|
+
}, k = async (t) => {
|
|
94
|
+
let n = y(), r = p.current;
|
|
95
|
+
h.current.set(r.namespaceFQN, {
|
|
96
96
|
namespaces: r.namespaces,
|
|
97
97
|
templates: r.templates,
|
|
98
98
|
namespaceNextMarker: r.namespaceNextMarker,
|
|
99
99
|
templateNextMarker: r.templateNextMarker,
|
|
100
100
|
isNamespacesExhausted: r.isNamespacesExhausted
|
|
101
|
-
}),
|
|
101
|
+
}), m({
|
|
102
102
|
type: e.NavigateTo,
|
|
103
103
|
namespace: t
|
|
104
|
-
}),
|
|
105
|
-
let i = await
|
|
106
|
-
n.aborted || (s(() =>
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
let n =
|
|
110
|
-
n && (
|
|
104
|
+
}), m({ type: e.BrowseFetchStart }), s(() => f.current.onNewViewLoading?.(!0));
|
|
105
|
+
let i = await D(t.id, n, e.BrowseError);
|
|
106
|
+
n.aborted || (s(() => f.current.onNewViewLoading?.(!1)), i && s(() => f.current.onNamespaceChange?.(t.id)));
|
|
107
|
+
}, A = (t) => {
|
|
108
|
+
b();
|
|
109
|
+
let n = h.current.get(t);
|
|
110
|
+
n && (m({
|
|
111
111
|
type: e.NavigateBack,
|
|
112
112
|
fqn: t,
|
|
113
113
|
cached: n
|
|
114
|
-
}), s(() =>
|
|
115
|
-
},
|
|
116
|
-
|
|
114
|
+
}), s(() => f.current.onNamespaceChange?.(t)));
|
|
115
|
+
}, j = (t) => {
|
|
116
|
+
m({
|
|
117
117
|
type: e.SearchValueChange,
|
|
118
118
|
value: t
|
|
119
|
-
})
|
|
120
|
-
|
|
119
|
+
});
|
|
120
|
+
let n = c(t);
|
|
121
|
+
if (n === "") {
|
|
122
|
+
v.current.cancel(), S(), m({ type: e.SearchClear }), s(() => f.current.onSearchChange?.("")), s(() => f.current.onNewViewLoading?.(!1));
|
|
121
123
|
return;
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
m({
|
|
124
126
|
type: e.SearchFetchStart,
|
|
125
|
-
query:
|
|
126
|
-
}),
|
|
127
|
-
},
|
|
128
|
-
let { namespaceFQN: t, searchQuery: r, searchNextMarker: i, namespaceNextMarker: a, templateNextMarker: o, isNamespacesExhausted: s } =
|
|
129
|
-
if (!(d ||
|
|
130
|
-
|
|
127
|
+
query: n
|
|
128
|
+
}), v.current(n);
|
|
129
|
+
}, M = async () => {
|
|
130
|
+
let { namespaceFQN: t, searchQuery: r, searchNextMarker: i, namespaceNextMarker: a, templateNextMarker: o, isNamespacesExhausted: s } = p.current, c = !!r, d = c && !!i, f = !c && !s && !!a, g = !c && !!o;
|
|
131
|
+
if (!(d || f || g)) return;
|
|
132
|
+
m({ type: e.LoadMoreStart });
|
|
131
133
|
let _ = (t) => {
|
|
132
|
-
|
|
134
|
+
m({
|
|
133
135
|
type: e.LoadMoreError,
|
|
134
|
-
error:
|
|
136
|
+
error: l(t)
|
|
135
137
|
});
|
|
136
|
-
},
|
|
137
|
-
let n =
|
|
138
|
+
}, v = (e) => {
|
|
139
|
+
let n = h.current.get(t);
|
|
138
140
|
n && e(n);
|
|
139
141
|
};
|
|
140
142
|
if (d) {
|
|
141
|
-
let t =
|
|
142
|
-
await
|
|
143
|
+
let t = x();
|
|
144
|
+
await u(t, () => T(r, t, i), (t) => m({
|
|
143
145
|
type: e.LoadMoreSearchLoaded,
|
|
144
146
|
entries: t.entries,
|
|
145
147
|
nextMarker: t.next_marker
|
|
146
148
|
}), _);
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
149
|
-
if (
|
|
150
|
-
let r =
|
|
151
|
-
await
|
|
152
|
-
let e = await
|
|
153
|
-
return [e, e.next_marker ? n : await
|
|
151
|
+
if (f) {
|
|
152
|
+
let r = y();
|
|
153
|
+
await u(r, async () => {
|
|
154
|
+
let e = await C(t, r, a);
|
|
155
|
+
return [e, e.next_marker ? n : await w(t, r)];
|
|
154
156
|
}, ([t, n]) => {
|
|
155
157
|
let r = !t.next_marker;
|
|
156
|
-
|
|
158
|
+
m({
|
|
157
159
|
type: e.LoadMoreNamespacesLoaded,
|
|
158
160
|
entries: t.entries,
|
|
159
161
|
nextMarker: t.next_marker,
|
|
@@ -161,66 +163,66 @@ function u(u, d, f, p, m) {
|
|
|
161
163
|
templates: n.entries,
|
|
162
164
|
templateNextMarker: n.next_marker
|
|
163
165
|
}
|
|
164
|
-
}),
|
|
166
|
+
}), v((e) => {
|
|
165
167
|
e.namespaces = [...e.namespaces, ...t.entries], e.namespaceNextMarker = t.next_marker, e.isNamespacesExhausted = r, r && (e.templates = n.entries, e.templateNextMarker = n.next_marker);
|
|
166
168
|
});
|
|
167
169
|
}, _);
|
|
168
170
|
return;
|
|
169
171
|
}
|
|
170
172
|
if (g) {
|
|
171
|
-
let n =
|
|
172
|
-
await
|
|
173
|
-
|
|
173
|
+
let n = y();
|
|
174
|
+
await u(n, () => w(t, n, o), (t) => {
|
|
175
|
+
m({
|
|
174
176
|
type: e.LoadMoreTemplatesLoaded,
|
|
175
177
|
entries: t.entries,
|
|
176
178
|
nextMarker: t.next_marker
|
|
177
|
-
}),
|
|
179
|
+
}), v((e) => {
|
|
178
180
|
e.templates = [...e.templates, ...t.entries], e.templateNextMarker = t.next_marker;
|
|
179
181
|
});
|
|
180
182
|
}, _);
|
|
181
183
|
}
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
+
}, N = async (t) => {
|
|
185
|
+
p.current.selectedTemplateId !== t.id && (m({
|
|
184
186
|
type: e.TemplateSelect,
|
|
185
187
|
template: t
|
|
186
|
-
}), s(() =>
|
|
187
|
-
},
|
|
188
|
-
s(() =>
|
|
189
|
-
},
|
|
190
|
-
let { searchError: t, searchQuery: n, loadMoreError: r, initialLoadError: i, browseError: a, namespaceFQN: o } =
|
|
188
|
+
}), s(() => f.current.onTemplateSelect?.(t)));
|
|
189
|
+
}, P = (e) => {
|
|
190
|
+
s(() => f.current.onTemplateEdit?.(e));
|
|
191
|
+
}, F = async () => {
|
|
192
|
+
let { searchError: t, searchQuery: n, loadMoreError: r, initialLoadError: i, browseError: a, namespaceFQN: o } = p.current;
|
|
191
193
|
if (t) {
|
|
192
|
-
let t =
|
|
193
|
-
|
|
194
|
+
let t = x();
|
|
195
|
+
m({
|
|
194
196
|
type: e.SearchFetchStart,
|
|
195
197
|
query: n
|
|
196
|
-
}), s(() =>
|
|
198
|
+
}), s(() => f.current.onNewViewLoading?.(!0)), await u(t, () => T(n, t), (t) => m({
|
|
197
199
|
type: e.SearchLoaded,
|
|
198
200
|
results: t.entries,
|
|
199
201
|
nextMarker: t.next_marker
|
|
200
|
-
}), (t) =>
|
|
202
|
+
}), (t) => m({
|
|
201
203
|
type: e.SearchError,
|
|
202
|
-
error:
|
|
203
|
-
})), t.aborted || s(() =>
|
|
204
|
+
error: l(t)
|
|
205
|
+
})), t.aborted || s(() => f.current.onNewViewLoading?.(!1));
|
|
204
206
|
return;
|
|
205
207
|
}
|
|
206
208
|
if (r) {
|
|
207
|
-
await
|
|
209
|
+
await M();
|
|
208
210
|
return;
|
|
209
211
|
}
|
|
210
212
|
if (i || a) {
|
|
211
|
-
let t =
|
|
212
|
-
|
|
213
|
+
let t = y(), n = i ? e.InitialLoadError : e.BrowseError;
|
|
214
|
+
m({ type: e.BrowseFetchStart }), s(() => f.current.onNewViewLoading?.(!0)), await D(o, t, n), t.aborted || s(() => f.current.onNewViewLoading?.(!1));
|
|
213
215
|
}
|
|
214
216
|
};
|
|
215
217
|
return r(() => ({
|
|
216
|
-
initialLoad:
|
|
217
|
-
navigateTo:
|
|
218
|
-
navigateBack:
|
|
219
|
-
setSearchValue:
|
|
220
|
-
loadMore:
|
|
221
|
-
selectTemplate:
|
|
222
|
-
editTemplate:
|
|
223
|
-
retry:
|
|
218
|
+
initialLoad: O,
|
|
219
|
+
navigateTo: k,
|
|
220
|
+
navigateBack: A,
|
|
221
|
+
setSearchValue: j,
|
|
222
|
+
loadMore: M,
|
|
223
|
+
selectTemplate: N,
|
|
224
|
+
editTemplate: P,
|
|
225
|
+
retry: F
|
|
224
226
|
}), []);
|
|
225
227
|
}
|
|
226
|
-
export {
|
|
228
|
+
export { d as useTemplateBrowserActions };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t } from "react";
|
|
2
|
+
var n = "[role=\"row\"]";
|
|
3
|
+
function r({ containerRef: r, path: i, isFetching: a }) {
|
|
4
|
+
let o = t(i), s = t(!1);
|
|
5
|
+
e(() => {
|
|
6
|
+
i !== o.current && (o.current = i, s.current = !0);
|
|
7
|
+
let e = r.current;
|
|
8
|
+
if (!s.current || a || !e) return;
|
|
9
|
+
s.current = !1;
|
|
10
|
+
let t = () => {
|
|
11
|
+
let { activeElement: t, body: r } = e.ownerDocument;
|
|
12
|
+
if (!(t === null || t === r || e.contains(t))) return !0;
|
|
13
|
+
let i = e.querySelector(n);
|
|
14
|
+
return i ? (i.focus(), !0) : !1;
|
|
15
|
+
};
|
|
16
|
+
if (t()) return;
|
|
17
|
+
let c = new MutationObserver(() => {
|
|
18
|
+
t() && c.disconnect();
|
|
19
|
+
});
|
|
20
|
+
return c.observe(e, {
|
|
21
|
+
childList: !0,
|
|
22
|
+
subtree: !0
|
|
23
|
+
}), () => {
|
|
24
|
+
c.disconnect();
|
|
25
|
+
};
|
|
26
|
+
}, [
|
|
27
|
+
i,
|
|
28
|
+
a,
|
|
29
|
+
r
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
export { r as useFocusFirstRowAfterNavigation };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { BreadcrumbEntry } from '../types';
|
|
3
|
+
interface UseFocusFirstRowAfterNavigationParams {
|
|
4
|
+
/** Container holding the browse list. The first descendant `[role="row"]` is focused. */
|
|
5
|
+
readonly containerRef: RefObject<HTMLElement | null>;
|
|
6
|
+
/** Current navigation path. A change in reference is treated as a user navigation. */
|
|
7
|
+
readonly path: readonly BreadcrumbEntry[];
|
|
8
|
+
/** True while the post-navigation fetch is in flight. Focus is deferred until it settles. */
|
|
9
|
+
readonly isFetching: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Restores keyboard focus to the first row of the browse list after a namespace
|
|
13
|
+
* navigation. Without this, the user-activated `NamespaceRow` unmounts during the
|
|
14
|
+
* in-flight fetch (the list is replaced by a loading skeleton), DOM focus drops
|
|
15
|
+
* to `<body>`, and arrow-key navigation appears broken until the user re-tabs in.
|
|
16
|
+
*
|
|
17
|
+
* No-op on initial render — `path` hasn't changed yet, so focus stays wherever
|
|
18
|
+
* the host page placed it. Only user-initiated path transitions trigger the restore.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const containerRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
* const { path } = useNavigationState();
|
|
23
|
+
* const { isFetching } = useBrowseState();
|
|
24
|
+
* useFocusFirstRowAfterNavigation({ containerRef, path, isFetching });
|
|
25
|
+
* return <div ref={containerRef}><BrowseList ... /></div>;
|
|
26
|
+
*/
|
|
27
|
+
export declare function useFocusFirstRowAfterNavigation({ containerRef, path, isFetching, }: UseFocusFirstRowAfterNavigationParams): void;
|
|
28
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-template-browser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^14.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.
|
|
6
|
+
"@box/blueprint-web": "^14.16.0",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.115.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": "^14.
|
|
16
|
-
"@box/blueprint-web-assets": "^4.
|
|
15
|
+
"@box/blueprint-web": "^14.16.0",
|
|
16
|
+
"@box/blueprint-web-assets": "^4.115.0",
|
|
17
17
|
"@box/eslint-plugin-blueprint": "1.1.17",
|
|
18
|
-
"@box/storybook-utils": "0.
|
|
18
|
+
"@box/storybook-utils": "0.18.0",
|
|
19
19
|
"react-intl": "^6.4.2"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|