@telia-ace/knowledge-widget-components-search 1.0.21 → 1.0.23
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/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/filter-badges.d.ts +10 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -26
- package/dist/index.js.map +1 -1
- package/dist/quick-filter-item-list.d.ts +17 -17
- package/dist/quick-filter.d.ts +7 -7
- package/dist/search-component.d.ts +42 -42
- package/dist/{search.ffb2e6c2.js → search.ca38a836.js} +245 -178
- package/dist/search.ca38a836.js.map +1 -0
- package/dist/search.d.ts +7 -7
- package/dist/use-search.d.ts +10 -10
- package/dist/utils.d.ts +3 -3
- package/package.json +8 -7
- package/dist/search.ffb2e6c2.js.map +0 -1
|
@@ -10,7 +10,7 @@ var ne = (e, t, o) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
se.call(t, o) && ne(e, o, t[o]);
|
|
11
11
|
return e;
|
|
12
12
|
}, D = (e, t) => Ie(e, qe(t));
|
|
13
|
-
var
|
|
13
|
+
var G = (e, t) => {
|
|
14
14
|
var o = {};
|
|
15
15
|
for (var r in e)
|
|
16
16
|
re.call(e, r) && t.indexOf(r) < 0 && (o[r] = e[r]);
|
|
@@ -20,9 +20,9 @@ var U = (e, t) => {
|
|
|
20
20
|
return o;
|
|
21
21
|
};
|
|
22
22
|
import { Component as ze } from "@telia-ace/knowledge-widget-types-grid";
|
|
23
|
-
import { borderTabStyle as
|
|
23
|
+
import { borderTabStyle as M, Text as de, Link as fe, SymbolBadge as J, useProperties as P, useDispatch as U, useRouteData as ge, useEventListener as Y, useKeyPress as H, Tooltip as Fe, ItemTree as Be, contentBox as me, useScroll as Le, useContainer as he, Loader as De, useDebounce as Ne, usePrevious as ae, useChildren as Te, useWidgetEvent as Oe, useTransitionEnd as Ke, convertToStringAttributes as Pe, Input as We, Button as pe } from "@telia-ace/knowledge-widget-ui";
|
|
24
24
|
import { appendClassNames as R, deepClone as je, categoryTrail as Qe } from "@telia-ace/widget-utilities";
|
|
25
|
-
import f, { useRef as V, useState as
|
|
25
|
+
import f, { useRef as V, useState as T, useCallback as I, useEffect as O } from "react";
|
|
26
26
|
import z, { css as K } from "styled-components";
|
|
27
27
|
const Xe = (v) => {
|
|
28
28
|
var b = v, {
|
|
@@ -32,7 +32,7 @@ const Xe = (v) => {
|
|
|
32
32
|
filterType: r,
|
|
33
33
|
handleClick: l,
|
|
34
34
|
deleteAriaLabel: c = ""
|
|
35
|
-
} = b, s =
|
|
35
|
+
} = b, s = G(b, [
|
|
36
36
|
"text",
|
|
37
37
|
"className",
|
|
38
38
|
"forceFocusStyle",
|
|
@@ -52,7 +52,7 @@ const Xe = (v) => {
|
|
|
52
52
|
role: "button",
|
|
53
53
|
"aria-label": c.replace("{{item}}", e),
|
|
54
54
|
onClick: (y) => l(y, r)
|
|
55
|
-
}), /* @__PURE__ */ f.createElement(
|
|
55
|
+
}), /* @__PURE__ */ f.createElement(J, {
|
|
56
56
|
size: 13,
|
|
57
57
|
symbol: { type: "Svg", content: "close" }
|
|
58
58
|
})));
|
|
@@ -63,13 +63,15 @@ const Xe = (v) => {
|
|
|
63
63
|
showGuideCategory: r,
|
|
64
64
|
position: l
|
|
65
65
|
}) => {
|
|
66
|
-
const { activeFilterBadges: c = {}, deleteFilterBadgeAriaLabel: s = "" } = P(), v =
|
|
66
|
+
const { activeFilterBadges: c = {}, deleteFilterBadgeAriaLabel: s = "" } = P(), v = U(), { name: b, params: k } = ge(), [y, u] = T(!1), x = I((m) => {
|
|
67
67
|
const { key: a } = m;
|
|
68
68
|
["ArrowLeft", "ArrowRight"].indexOf(a) === -1 && u(!1);
|
|
69
69
|
}, []);
|
|
70
|
-
|
|
71
|
-
const { guideCategory: S, tag:
|
|
72
|
-
const a = m.querySelectorAll(
|
|
70
|
+
Y("keydown", x, window), Y("click", x, window);
|
|
71
|
+
const { guideCategory: S, tag: $, tooltip: A } = c, d = (m) => {
|
|
72
|
+
const a = m.querySelectorAll(
|
|
73
|
+
".humany-filter-badge"
|
|
74
|
+
);
|
|
73
75
|
return {
|
|
74
76
|
badges: a,
|
|
75
77
|
index: Array.from(a).findIndex((h) => document.activeElement === h)
|
|
@@ -85,58 +87,73 @@ const Xe = (v) => {
|
|
|
85
87
|
m === "left" ? p === -1 ? q = h.item(h.length - 1) : p > 0 && (q = h.item(p - 1)) : m === "right" && (p === h.length - 1 ? a && a.focus() : h.item(p + 1) && (q = h.item(p + 1))), q && (q.focus(), u(!0));
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
90
|
+
H(
|
|
91
|
+
"ArrowLeft",
|
|
92
|
+
I(() => {
|
|
93
|
+
if (!t)
|
|
94
|
+
return;
|
|
95
|
+
const { index: m } = d(t);
|
|
96
|
+
if (e || m > -1) {
|
|
97
|
+
const a = t.querySelector('[data-type="search"]'), h = a && a.selectionStart !== null && a.selectionStart <= 0, p = m > -1;
|
|
98
|
+
(h || p) && i("left", a);
|
|
99
|
+
}
|
|
100
|
+
}, [e, t])
|
|
101
|
+
), H(
|
|
102
|
+
"ArrowRight",
|
|
103
|
+
I(() => {
|
|
104
|
+
if (!t)
|
|
105
|
+
return;
|
|
106
|
+
const { index: m } = d(t);
|
|
107
|
+
if (m > -1) {
|
|
108
|
+
const a = t.querySelector('[data-type="search"]');
|
|
109
|
+
m > -1 && i("right", a);
|
|
110
|
+
}
|
|
111
|
+
}, [t])
|
|
112
|
+
), H(
|
|
113
|
+
"Backspace",
|
|
114
|
+
I(
|
|
115
|
+
(m) => {
|
|
116
|
+
if (!t)
|
|
117
|
+
return;
|
|
118
|
+
let a = [];
|
|
119
|
+
const { index: h } = d(t), p = t.querySelector('[data-type="search"]');
|
|
120
|
+
h > -1 ? h === 0 ? r ? a = ["guideCategory"] : o && (a = ["tag"]) : h === 1 && (a = ["tag"]) : p && p.selectionStart !== null && p.selectionStart <= 0 && (c != null && c.tag ? a = ["tag"] : c != null && c.guideCategory && (a = ["guideCategory"])), a.length > 0 && (m.preventDefault(), v("quick-filter:remove", { types: a }));
|
|
121
|
+
},
|
|
122
|
+
[t, c, o, r]
|
|
123
|
+
)
|
|
124
|
+
);
|
|
125
|
+
const g = I(
|
|
126
|
+
(m) => m === "guideCategory" && S && r ? /* @__PURE__ */ f.createElement(ie, {
|
|
127
|
+
text: `@${S.title}`,
|
|
128
|
+
routeName: b,
|
|
129
|
+
filterType: "guideCategory",
|
|
130
|
+
handleClick: n,
|
|
131
|
+
forceFocusStyle: y,
|
|
132
|
+
deleteAriaLabel: s,
|
|
133
|
+
params: D(B({}, k), {
|
|
134
|
+
guideCategory: void 0
|
|
135
|
+
})
|
|
136
|
+
}) : m === "tag" && $ && o ? /* @__PURE__ */ f.createElement(ie, {
|
|
137
|
+
className: "humany-filter-badge",
|
|
138
|
+
text: `#${$.title}`,
|
|
139
|
+
routeName: b,
|
|
140
|
+
filterType: "tag",
|
|
141
|
+
handleClick: n,
|
|
142
|
+
forceFocusStyle: y,
|
|
143
|
+
deleteAriaLabel: s,
|
|
144
|
+
params: D(B({}, k), {
|
|
145
|
+
tag: void 0
|
|
146
|
+
})
|
|
147
|
+
}) : null,
|
|
148
|
+
[S, $, b, k, r, o, y]
|
|
149
|
+
);
|
|
150
|
+
return !S && !$ ? null : /* @__PURE__ */ f.createElement(Ue, {
|
|
134
151
|
className: "humany-filter-badges",
|
|
135
152
|
position: l
|
|
136
153
|
}, S && A ? /* @__PURE__ */ f.createElement(Fe, {
|
|
137
154
|
content: /* @__PURE__ */ f.createElement(f.Fragment, null, A),
|
|
138
155
|
sticky: !1
|
|
139
|
-
}, g("guideCategory")) : g("guideCategory"),
|
|
156
|
+
}, g("guideCategory")) : g("guideCategory"), $ && g("tag"));
|
|
140
157
|
}, Ue = z.div`
|
|
141
158
|
display: flex;
|
|
142
159
|
align-items: center;
|
|
@@ -186,27 +203,36 @@ const Xe = (v) => {
|
|
|
186
203
|
}} / 2);
|
|
187
204
|
|
|
188
205
|
&:focus-within {
|
|
189
|
-
${
|
|
190
|
-
|
|
191
|
-
return (((t = e.theme.accessibility) == null ? void 0 : t.isTabbing) || e.forceFocusStyle) && K`
|
|
192
|
-
${_}
|
|
193
|
-
background-color: transparent;
|
|
206
|
+
${M}
|
|
207
|
+
background-color: transparent;
|
|
194
208
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}};
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
`;
|
|
209
|
+
svg {
|
|
210
|
+
path {
|
|
211
|
+
stroke: ${(e) => {
|
|
212
|
+
var t;
|
|
213
|
+
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
204
214
|
}};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
205
217
|
a {
|
|
206
218
|
outline: none;
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
|
|
222
|
+
${(e) => e.forceFocusStyle && K`
|
|
223
|
+
${M}
|
|
224
|
+
background-color: transparent;
|
|
225
|
+
|
|
226
|
+
svg {
|
|
227
|
+
path {
|
|
228
|
+
stroke: ${(t) => {
|
|
229
|
+
var o;
|
|
230
|
+
return (o = t.theme.colors) == null ? void 0 : o.primary;
|
|
231
|
+
}};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`}
|
|
235
|
+
|
|
210
236
|
svg {
|
|
211
237
|
width: 17px;
|
|
212
238
|
height: 11px;
|
|
@@ -220,16 +246,16 @@ const Xe = (v) => {
|
|
|
220
246
|
}
|
|
221
247
|
order: 1;
|
|
222
248
|
}
|
|
223
|
-
`,
|
|
249
|
+
`, N = (e, t) => !t || !e ? !0 : e.toLowerCase().indexOf(t.toLowerCase()) > -1, Ge = (e = [], t, o) => {
|
|
224
250
|
if (!o)
|
|
225
251
|
return e;
|
|
226
252
|
const r = je(e);
|
|
227
253
|
if (t === "tag")
|
|
228
|
-
return r.filter((s) =>
|
|
254
|
+
return r.filter((s) => N(s.title, o));
|
|
229
255
|
const l = He(r, o);
|
|
230
256
|
return ye(r, (s) => l.indexOf(s.id) > -1);
|
|
231
257
|
}, ye = (e, t) => e.filter((o) => (o.items && o.items.length && (o.items = ye(o.items, t)), t(o))), He = (e, t) => {
|
|
232
|
-
const r = be(e).filter((c) =>
|
|
258
|
+
const r = be(e).filter((c) => N(c.title, t)).map((c) => c.id);
|
|
233
259
|
let l = [];
|
|
234
260
|
return r.forEach((c) => {
|
|
235
261
|
const s = Qe(c, e);
|
|
@@ -240,13 +266,17 @@ const Xe = (v) => {
|
|
|
240
266
|
return e.forEach((o) => {
|
|
241
267
|
t.push(o), Array.isArray(o.items) && (t = t.concat(be(o.items)));
|
|
242
268
|
}), t;
|
|
243
|
-
},
|
|
244
|
-
const t = Array.from((e == null ? void 0 : e.getElementsByTagName("A")) || []).filter(
|
|
269
|
+
}, Z = (e) => {
|
|
270
|
+
const t = Array.from((e == null ? void 0 : e.getElementsByTagName("A")) || []).filter(
|
|
271
|
+
(o) => o.getAttribute("disabled") === null
|
|
272
|
+
);
|
|
245
273
|
return {
|
|
246
274
|
anchors: t,
|
|
247
275
|
focusedIndex: t.findIndex((o) => document.activeElement === o)
|
|
248
276
|
};
|
|
249
|
-
}, Je = (e) => e ? e.querySelector(
|
|
277
|
+
}, Je = (e) => e ? e.querySelector(
|
|
278
|
+
'[data-type="search"], input[type="search"]'
|
|
279
|
+
) : null, _ = (e) => {
|
|
250
280
|
if (!e)
|
|
251
281
|
return;
|
|
252
282
|
const t = Je(e);
|
|
@@ -259,86 +289,93 @@ const Xe = (v) => {
|
|
|
259
289
|
searchContainer: l,
|
|
260
290
|
inputHasFocus: c
|
|
261
291
|
}) => {
|
|
262
|
-
const [s, v] =
|
|
292
|
+
const [s, v] = T(t || []), [b, k] = T(null), y = U(), { activeFilterBadges: u, quickFilters: x } = P(), S = typeof x == "object" && !!x.autoSelect || typeof x == "boolean" && !!x;
|
|
263
293
|
O(() => {
|
|
264
294
|
v(Ge(t, o, e));
|
|
265
295
|
}, [e, o, t]), O(() => {
|
|
266
296
|
var d;
|
|
267
297
|
if (r) {
|
|
268
|
-
const { anchors: n } =
|
|
298
|
+
const { anchors: n } = Z(r), i = (d = n[0]) == null ? void 0 : d.getAttribute("data-id");
|
|
269
299
|
i && k(i);
|
|
270
300
|
}
|
|
271
301
|
}, [s, r]);
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
302
|
+
const $ = I(
|
|
303
|
+
(d, n) => {
|
|
304
|
+
const i = {
|
|
305
|
+
category: u != null && u.guideCategory ? u.guideCategory.id : void 0,
|
|
306
|
+
tag: u != null && u.tag ? u.tag.id : void 0
|
|
307
|
+
};
|
|
308
|
+
n === "guideCategory" ? i.category = d.id : n === "tag" && (i.tag = d.id), y("quick-filter:add", i);
|
|
309
|
+
},
|
|
310
|
+
[u, y]
|
|
311
|
+
), A = (d) => d === "guideCategory" ? {
|
|
279
312
|
renderItem: (n, i) => /* @__PURE__ */ f.createElement(ue, {
|
|
280
313
|
autoSelect: S && c && n.id === b,
|
|
281
|
-
disabled: !
|
|
282
|
-
tabIndex:
|
|
314
|
+
disabled: !N(n.title, e),
|
|
315
|
+
tabIndex: N(n.title, e) ? 0 : -1,
|
|
283
316
|
onKeyDown: (g) => {
|
|
284
|
-
g.key === "Enter" &&
|
|
317
|
+
g.key === "Enter" && $(n, d);
|
|
285
318
|
},
|
|
286
319
|
"data-level": i,
|
|
287
320
|
onClick: () => {
|
|
288
|
-
|
|
321
|
+
$(n, d);
|
|
289
322
|
},
|
|
290
323
|
"data-id": n.id
|
|
291
324
|
}, /* @__PURE__ */ f.createElement(ce, {
|
|
292
325
|
title: n.title,
|
|
293
326
|
phrase: e,
|
|
294
|
-
matches:
|
|
327
|
+
matches: N(n.title, e)
|
|
295
328
|
}))
|
|
296
329
|
} : {
|
|
297
330
|
renderLi: !0,
|
|
298
331
|
renderItem: (n) => /* @__PURE__ */ f.createElement(ue, {
|
|
299
332
|
autoSelect: S && c && n.id === b,
|
|
300
333
|
onKeyDown: (i) => {
|
|
301
|
-
i.key === "Enter" &&
|
|
334
|
+
i.key === "Enter" && $(n, d);
|
|
302
335
|
},
|
|
303
336
|
onClick: () => {
|
|
304
|
-
|
|
337
|
+
$(n, d);
|
|
305
338
|
},
|
|
306
339
|
"data-id": n.id
|
|
307
340
|
}, /* @__PURE__ */ f.createElement(ce, {
|
|
308
341
|
symbol: "#",
|
|
309
342
|
title: n.title,
|
|
310
343
|
phrase: e,
|
|
311
|
-
matches:
|
|
344
|
+
matches: N(n.title, e)
|
|
312
345
|
}))
|
|
313
346
|
};
|
|
314
|
-
return
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
347
|
+
return Y(
|
|
348
|
+
"keydown",
|
|
349
|
+
(d) => {
|
|
350
|
+
var q;
|
|
351
|
+
const { key: n } = d;
|
|
352
|
+
if (!r || !(n === "ArrowDown" || n === "ArrowUp" || n === "Enter"))
|
|
353
|
+
return;
|
|
354
|
+
const { anchors: i, focusedIndex: g } = Z(r);
|
|
355
|
+
if (n === "Enter") {
|
|
356
|
+
if (c && S) {
|
|
357
|
+
const w = (q = i[0]) == null ? void 0 : q.getAttribute("data-id");
|
|
358
|
+
w && $({ id: w }, o);
|
|
359
|
+
}
|
|
360
|
+
return;
|
|
324
361
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
362
|
+
const m = () => {
|
|
363
|
+
var w;
|
|
364
|
+
return (w = i[0]) == null ? void 0 : w.focus();
|
|
365
|
+
}, a = () => {
|
|
366
|
+
var w;
|
|
367
|
+
return (w = i[i.length - 1]) == null ? void 0 : w.focus();
|
|
368
|
+
}, h = () => {
|
|
369
|
+
var w;
|
|
370
|
+
return (w = i[g + 1]) == null ? void 0 : w.focus();
|
|
371
|
+
}, p = () => {
|
|
372
|
+
var w;
|
|
373
|
+
return (w = i[g - 1]) == null ? void 0 : w.focus();
|
|
374
|
+
};
|
|
375
|
+
c ? (d.preventDefault(), n === "ArrowDown" ? m() : a()) : g > -1 && (d.preventDefault(), n === "ArrowDown" ? i.length > g + 1 ? h() : _(l) : g - 1 < 0 ? _(l) : p());
|
|
376
|
+
},
|
|
377
|
+
window
|
|
378
|
+
), /* @__PURE__ */ f.createElement(Be, B({
|
|
342
379
|
tree: s,
|
|
343
380
|
renderEmpty: !1,
|
|
344
381
|
ulProps: { role: "listbox" },
|
|
@@ -417,31 +454,42 @@ const Xe = (v) => {
|
|
|
417
454
|
type: "",
|
|
418
455
|
items: []
|
|
419
456
|
}
|
|
420
|
-
} = P(), [l, c] = Le(!0), s = he(), { events: v } = s.get("$widget"), b = V(), k = I(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
457
|
+
} = P(), [l, c] = Le(!0), s = he(), { events: v } = s.get("$widget"), b = V(), k = I(
|
|
458
|
+
(d) => (d && d.addEventListener(
|
|
459
|
+
"keydown",
|
|
460
|
+
() => {
|
|
461
|
+
Z(d).focusedIndex > -1 && v.subscribeOnce("router:changed", () => {
|
|
462
|
+
_(o);
|
|
463
|
+
});
|
|
464
|
+
},
|
|
465
|
+
!0
|
|
466
|
+
), b.current = d, d),
|
|
467
|
+
[o]
|
|
468
|
+
), { items: y = [], symbol: u, type: x, open: S, loading: $ } = r;
|
|
425
469
|
if (!S || !u)
|
|
426
470
|
return null;
|
|
427
471
|
const A = e.slice(e.indexOf(u) + 1);
|
|
428
472
|
return /* @__PURE__ */ f.createElement(Re, {
|
|
429
473
|
ref: k,
|
|
430
|
-
"data-loading":
|
|
431
|
-
className: R(
|
|
474
|
+
"data-loading": $,
|
|
475
|
+
className: R(
|
|
476
|
+
"humany-quick-filter-dropdown",
|
|
477
|
+
[x === "guideCategory", "humany-quick-filter-guide-categories"],
|
|
478
|
+
[x === "tag", "humany-quick-filter-tags"]
|
|
479
|
+
)
|
|
432
480
|
}, /* @__PURE__ */ f.createElement(Ve, {
|
|
433
481
|
className: "humany-quick-filter-dropdown-inner",
|
|
434
482
|
css: l,
|
|
435
483
|
ref: c
|
|
436
484
|
}, /* @__PURE__ */ f.createElement(Ye, {
|
|
437
|
-
filterType:
|
|
485
|
+
filterType: x,
|
|
438
486
|
items: y,
|
|
439
487
|
filterPhrase: A,
|
|
440
488
|
filterContainer: c.current,
|
|
441
489
|
searchContainer: o,
|
|
442
490
|
inputHasFocus: t
|
|
443
491
|
})), /* @__PURE__ */ f.createElement(De, {
|
|
444
|
-
loading:
|
|
492
|
+
loading: $
|
|
445
493
|
}));
|
|
446
494
|
}, Re = z.div`
|
|
447
495
|
${me};
|
|
@@ -474,28 +522,43 @@ const Xe = (v) => {
|
|
|
474
522
|
}}
|
|
475
523
|
}
|
|
476
524
|
`, X = (e, t) => !!(e && !t || !e && t || e && t && e.id !== t.id), et = (e, t = {}, o = !0) => {
|
|
477
|
-
const r =
|
|
525
|
+
const r = U(), {
|
|
478
526
|
quickFilters: l = !1,
|
|
479
527
|
quickFilter: c = { open: !1 },
|
|
480
528
|
activeFilterBadges: s,
|
|
481
529
|
filterBadges: v = !1,
|
|
482
530
|
incremental: b = 600
|
|
483
|
-
} = P(), k =
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
531
|
+
} = P(), k = Ne(
|
|
532
|
+
e,
|
|
533
|
+
typeof b == "boolean" ? 600 : b
|
|
534
|
+
), y = ae(k), u = ae(s), x = V(null), S = I(
|
|
535
|
+
(n = "") => {
|
|
536
|
+
if (v) {
|
|
537
|
+
const i = X(
|
|
538
|
+
s == null ? void 0 : s.guideCategory,
|
|
539
|
+
u == null ? void 0 : u.guideCategory
|
|
540
|
+
) || X(s == null ? void 0 : s.tag, u == null ? void 0 : u.tag);
|
|
541
|
+
return r("search", { value: n, filtersChanged: i, filters: s });
|
|
542
|
+
}
|
|
543
|
+
return r("search", { value: n });
|
|
544
|
+
},
|
|
545
|
+
[r, s]
|
|
546
|
+
), $ = I(
|
|
547
|
+
(n) => {
|
|
548
|
+
r("clear", { navigateToHome: n });
|
|
549
|
+
},
|
|
550
|
+
[r]
|
|
551
|
+
), A = (n) => l ? n.replace(/([@#].*)/g, "") : n, d = I(
|
|
552
|
+
(n) => {
|
|
553
|
+
if (c.open && n.preventDefault) {
|
|
554
|
+
n.preventDefault();
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
const i = document.activeElement, g = x.current && typeof x.current.contains == "function" ? x.current.contains(i) : !1, m = A(e);
|
|
558
|
+
typeof n == "boolean" && n || m.length && g || (s == null ? void 0 : s.guideCategory) || (s == null ? void 0 : s.tag) && g ? S(m) : $(g);
|
|
559
|
+
},
|
|
560
|
+
[x, e, c, $, s, S]
|
|
561
|
+
);
|
|
499
562
|
return O(() => {
|
|
500
563
|
const n = X(s == null ? void 0 : s.guideCategory, u == null ? void 0 : u.guideCategory) || X(s == null ? void 0 : s.tag, u == null ? void 0 : u.tag), i = k && A(k), g = y && A(y);
|
|
501
564
|
(typeof g != "undefined" && g !== i && i !== t.phrase && o && !c.open || n && !(s != null && s.initial)) && d(n);
|
|
@@ -505,9 +568,9 @@ const Xe = (v) => {
|
|
|
505
568
|
n && e.indexOf("@") === e.length - 1 && r("quick-filter:open", { type: "guideCategory", symbol: "@" }), i && e.indexOf("#") === e.length - 1 && r("quick-filter:open", { type: "tag", symbol: "#" });
|
|
506
569
|
}
|
|
507
570
|
c.open && e.indexOf("@") === -1 && e.indexOf("#") === -1 && r("quick-filter:close");
|
|
508
|
-
}, [e]), [d, x
|
|
571
|
+
}, [e]), [d, $, x];
|
|
509
572
|
}, dt = (o) => {
|
|
510
|
-
var r = o, { className: e } = r, t =
|
|
573
|
+
var r = o, { className: e } = r, t = G(r, ["className"]);
|
|
511
574
|
const {
|
|
512
575
|
showSearchButton: l,
|
|
513
576
|
showClearButton: c,
|
|
@@ -517,41 +580,48 @@ const Xe = (v) => {
|
|
|
517
580
|
searchButtonLabel: k,
|
|
518
581
|
clearButtonLabel: y,
|
|
519
582
|
ariaLabel: u,
|
|
520
|
-
route:
|
|
583
|
+
route: x = "search",
|
|
521
584
|
incremental: S = !0,
|
|
522
|
-
showChildren:
|
|
585
|
+
showChildren: $ = !1,
|
|
523
586
|
quickFilter: A,
|
|
524
587
|
quickFilters: d,
|
|
525
588
|
filterBadges: n
|
|
526
|
-
} = P(), { params: i } = ge(), [g, m] =
|
|
589
|
+
} = P(), { params: i } = ge(), [g, m] = T(!1), [a, h] = T(i.phrase || ""), [p, q] = T({
|
|
527
590
|
guideCategory: !1,
|
|
528
591
|
tag: !1
|
|
529
|
-
}), w = he(), ke =
|
|
592
|
+
}), w = he(), ke = Te(), W = U(), { position: $e = "inside" } = typeof n == "object" ? n : {};
|
|
530
593
|
O(() => {
|
|
531
594
|
const { guideCategory: E, tag: C } = i, F = typeof n == "object" ? !!n.guideCategory : !!n, ve = typeof n == "object" ? !!n.tag : !!n;
|
|
532
595
|
q({
|
|
533
596
|
guideCategory: F && !!E,
|
|
534
597
|
tag: ve && !!C
|
|
535
598
|
});
|
|
536
|
-
}, [n, i]), Oe(
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
if (
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
599
|
+
}, [n, i]), Oe(
|
|
600
|
+
"router:changed",
|
|
601
|
+
() => {
|
|
602
|
+
if (A) {
|
|
603
|
+
const { open: E, symbol: C } = A;
|
|
604
|
+
if (E) {
|
|
605
|
+
if (C) {
|
|
606
|
+
const F = a.replace(a.slice(a.indexOf(C)), "");
|
|
607
|
+
h(F);
|
|
608
|
+
}
|
|
609
|
+
W("quick-filter:close");
|
|
543
610
|
}
|
|
544
|
-
W("quick-filter:close");
|
|
545
611
|
}
|
|
546
|
-
}
|
|
547
|
-
|
|
612
|
+
},
|
|
613
|
+
[A, a, h, W]
|
|
614
|
+
);
|
|
548
615
|
const [ee, j, L] = et(a, i, !!S);
|
|
549
616
|
O(() => {
|
|
550
617
|
h(i.phrase || "");
|
|
551
618
|
}, [i.phrase]);
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
619
|
+
const xe = I(
|
|
620
|
+
(E) => {
|
|
621
|
+
h(E);
|
|
622
|
+
},
|
|
623
|
+
[h]
|
|
624
|
+
), Ee = I(() => {
|
|
555
625
|
W("quick-filter:close").then(() => j(!0));
|
|
556
626
|
}, [W, j]), we = I(() => {
|
|
557
627
|
var E, C;
|
|
@@ -559,10 +629,10 @@ const Xe = (v) => {
|
|
|
559
629
|
}, [v, g, L]), Ce = I(() => {
|
|
560
630
|
w.getAsync("router").then((E) => {
|
|
561
631
|
const C = E.getInitialRoute(), F = E.getRouteData();
|
|
562
|
-
(C == null ? void 0 : C.name) === F.name && (C == null ? void 0 : C.name) !==
|
|
632
|
+
(C == null ? void 0 : C.name) === F.name && (C == null ? void 0 : C.name) !== x ? h("") : j(!0);
|
|
563
633
|
});
|
|
564
634
|
}, [w, h, j]), te = (E) => {
|
|
565
|
-
if (E !==
|
|
635
|
+
if (E !== $e)
|
|
566
636
|
return null;
|
|
567
637
|
if (!!p.guideCategory || !!p.tag)
|
|
568
638
|
return /* @__PURE__ */ f.createElement(Me, {
|
|
@@ -602,7 +672,7 @@ const Xe = (v) => {
|
|
|
602
672
|
onClick: ee,
|
|
603
673
|
"data-has-phrase": !!a,
|
|
604
674
|
"data-has-focus": g
|
|
605
|
-
}, /* @__PURE__ */ f.createElement(
|
|
675
|
+
}, /* @__PURE__ */ f.createElement(J, {
|
|
606
676
|
size: 32,
|
|
607
677
|
symbol: { type: "Svg", content: "search" }
|
|
608
678
|
})), te("inside"), /* @__PURE__ */ f.createElement(We, D(B({
|
|
@@ -613,7 +683,7 @@ const Xe = (v) => {
|
|
|
613
683
|
onFocusChange: m,
|
|
614
684
|
onEscape: Ee,
|
|
615
685
|
onEnter: ee,
|
|
616
|
-
onChange:
|
|
686
|
+
onChange: xe,
|
|
617
687
|
value: a
|
|
618
688
|
})), oe && /* @__PURE__ */ f.createElement(rt, {
|
|
619
689
|
"aria-label": y,
|
|
@@ -621,10 +691,10 @@ const Xe = (v) => {
|
|
|
621
691
|
hasFocus: g,
|
|
622
692
|
title: y,
|
|
623
693
|
onClick: Ce
|
|
624
|
-
}, /* @__PURE__ */ f.createElement(
|
|
694
|
+
}, /* @__PURE__ */ f.createElement(J, {
|
|
625
695
|
size: 27,
|
|
626
696
|
symbol: { type: "Svg", content: "clear" }
|
|
627
|
-
})),
|
|
697
|
+
})), $ && !oe && ke.map((E) => /* @__PURE__ */ f.createElement(ze, {
|
|
628
698
|
key: E.id,
|
|
629
699
|
id: E.id,
|
|
630
700
|
branch: "default"
|
|
@@ -730,7 +800,7 @@ const Xe = (v) => {
|
|
|
730
800
|
${(e) => e["data-has-focus"] && K`
|
|
731
801
|
${(t) => {
|
|
732
802
|
var o, r;
|
|
733
|
-
return (o = t.theme.accessibility) != null && o.isTabbing ?
|
|
803
|
+
return (o = t.theme.accessibility) != null && o.isTabbing ? M : `
|
|
734
804
|
border-color: ${(r = t.theme.colors) == null ? void 0 : r.primary};
|
|
735
805
|
outline: none;
|
|
736
806
|
input {
|
|
@@ -753,11 +823,8 @@ const Xe = (v) => {
|
|
|
753
823
|
}
|
|
754
824
|
}
|
|
755
825
|
`, rt = z(pe)`
|
|
756
|
-
&:focus svg {
|
|
757
|
-
${
|
|
758
|
-
var t;
|
|
759
|
-
return ((t = e.theme.accessibility) == null ? void 0 : t.isTabbing) && _;
|
|
760
|
-
}}
|
|
826
|
+
&:focus-visible svg {
|
|
827
|
+
${M}
|
|
761
828
|
}
|
|
762
829
|
|
|
763
830
|
svg {
|
|
@@ -776,4 +843,4 @@ const Xe = (v) => {
|
|
|
776
843
|
export {
|
|
777
844
|
dt as default
|
|
778
845
|
};
|
|
779
|
-
//# sourceMappingURL=search.
|
|
846
|
+
//# sourceMappingURL=search.ca38a836.js.map
|