@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.
@@ -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 U = (e, t) => {
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 _, Text as de, Link as fe, SymbolBadge as H, useProperties as P, useDispatch as M, useRouteData as ge, useEventListener as J, useKeyPress as G, Tooltip as Fe, ItemTree as Be, contentBox as me, useScroll as Le, useContainer as he, Loader as De, useDebounce as Te, usePrevious as ae, useChildren as Ne, useWidgetEvent as Oe, useTransitionEnd as Ke, convertToStringAttributes as Pe, Input as We, Button as pe } from "@telia-ace/knowledge-widget-ui";
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 N, useCallback as I, useEffect as O } from "react";
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 = U(b, [
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(H, {
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 = M(), { name: b, params: k } = ge(), [y, u] = N(!1), $ = I((m) => {
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
- J("keydown", $, window), J("click", $, window);
71
- const { guideCategory: S, tag: x, tooltip: A } = c, d = (m) => {
72
- const a = m.querySelectorAll(".humany-filter-badge");
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
- G("ArrowLeft", I(() => {
89
- if (!t)
90
- return;
91
- const { index: m } = d(t);
92
- if (e || m > -1) {
93
- const a = t.querySelector('[data-type="search"]'), h = a && a.selectionStart !== null && a.selectionStart <= 0, p = m > -1;
94
- (h || p) && i("left", a);
95
- }
96
- }, [e, t])), G("ArrowRight", I(() => {
97
- if (!t)
98
- return;
99
- const { index: m } = d(t);
100
- if (m > -1) {
101
- const a = t.querySelector('[data-type="search"]');
102
- m > -1 && i("right", a);
103
- }
104
- }, [t])), G("Backspace", I((m) => {
105
- if (!t)
106
- return;
107
- let a = [];
108
- const { index: h } = d(t), p = t.querySelector('[data-type="search"]');
109
- 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 }));
110
- }, [t, c, o, r]));
111
- const g = I((m) => m === "guideCategory" && S && r ? /* @__PURE__ */ f.createElement(ie, {
112
- text: `@${S.title}`,
113
- routeName: b,
114
- filterType: "guideCategory",
115
- handleClick: n,
116
- forceFocusStyle: y,
117
- deleteAriaLabel: s,
118
- params: D(B({}, k), {
119
- guideCategory: void 0
120
- })
121
- }) : m === "tag" && x && o ? /* @__PURE__ */ f.createElement(ie, {
122
- className: "humany-filter-badge",
123
- text: `#${x.title}`,
124
- routeName: b,
125
- filterType: "tag",
126
- handleClick: n,
127
- forceFocusStyle: y,
128
- deleteAriaLabel: s,
129
- params: D(B({}, k), {
130
- tag: void 0
131
- })
132
- }) : null, [S, x, b, k, r, o, y]);
133
- return !S && !x ? null : /* @__PURE__ */ f.createElement(Ue, {
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"), x && g("tag"));
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
- ${(e) => {
190
- var t;
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
- svg {
196
- path {
197
- stroke: ${(o) => {
198
- var r;
199
- return (r = o.theme.colors) == null ? void 0 : r.primary;
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
- `, T = (e, t) => !t || !e ? !0 : e.toLowerCase().indexOf(t.toLowerCase()) > -1, Ge = (e = [], t, o) => {
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) => T(s.title, o));
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) => T(c.title, t)).map((c) => c.id);
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
- }, Y = (e) => {
244
- const t = Array.from((e == null ? void 0 : e.getElementsByTagName("A")) || []).filter((o) => o.getAttribute("disabled") === null);
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('[data-type="search"], input[type="search"]') : null, Z = (e) => {
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] = N(t || []), [b, k] = N(null), y = M(), { activeFilterBadges: u, quickFilters: $ } = P(), S = typeof $ == "object" && !!$.autoSelect || typeof $ == "boolean" && !!$;
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 } = Y(r), i = (d = n[0]) == null ? void 0 : d.getAttribute("data-id");
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 x = I((d, n) => {
273
- const i = {
274
- category: u != null && u.guideCategory ? u.guideCategory.id : void 0,
275
- tag: u != null && u.tag ? u.tag.id : void 0
276
- };
277
- n === "guideCategory" ? i.category = d.id : n === "tag" && (i.tag = d.id), y("quick-filter:add", i);
278
- }, [u, y]), A = (d) => d === "guideCategory" ? {
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: !T(n.title, e),
282
- tabIndex: T(n.title, e) ? 0 : -1,
314
+ disabled: !N(n.title, e),
315
+ tabIndex: N(n.title, e) ? 0 : -1,
283
316
  onKeyDown: (g) => {
284
- g.key === "Enter" && x(n, d);
317
+ g.key === "Enter" && $(n, d);
285
318
  },
286
319
  "data-level": i,
287
320
  onClick: () => {
288
- x(n, d);
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: T(n.title, e)
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" && x(n, d);
334
+ i.key === "Enter" && $(n, d);
302
335
  },
303
336
  onClick: () => {
304
- x(n, d);
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: T(n.title, e)
344
+ matches: N(n.title, e)
312
345
  }))
313
346
  };
314
- return J("keydown", (d) => {
315
- var q;
316
- const { key: n } = d;
317
- if (!r || !(n === "ArrowDown" || n === "ArrowUp" || n === "Enter"))
318
- return;
319
- const { anchors: i, focusedIndex: g } = Y(r);
320
- if (n === "Enter") {
321
- if (c && S) {
322
- const w = (q = i[0]) == null ? void 0 : q.getAttribute("data-id");
323
- w && x({ id: w }, o);
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
- return;
326
- }
327
- const m = () => {
328
- var w;
329
- return (w = i[0]) == null ? void 0 : w.focus();
330
- }, a = () => {
331
- var w;
332
- return (w = i[i.length - 1]) == null ? void 0 : w.focus();
333
- }, h = () => {
334
- var w;
335
- return (w = i[g + 1]) == null ? void 0 : w.focus();
336
- }, p = () => {
337
- var w;
338
- return (w = i[g - 1]) == null ? void 0 : w.focus();
339
- };
340
- c ? (d.preventDefault(), n === "ArrowDown" ? m() : a()) : g > -1 && (d.preventDefault(), n === "ArrowDown" ? i.length > g + 1 ? h() : Z(l) : g - 1 < 0 ? Z(l) : p());
341
- }, window), /* @__PURE__ */ f.createElement(Be, B({
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((d) => (d && d.addEventListener("keydown", () => {
421
- Y(d).focusedIndex > -1 && v.subscribeOnce("router:changed", () => {
422
- Z(o);
423
- });
424
- }, !0), b.current = d, d), [o]), { items: y = [], symbol: u, type: $, open: S, loading: x } = r;
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": x,
431
- className: R("humany-quick-filter-dropdown", [$ === "guideCategory", "humany-quick-filter-guide-categories"], [$ === "tag", "humany-quick-filter-tags"])
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: x
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 = M(), {
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 = Te(e, typeof b == "boolean" ? 600 : b), y = ae(k), u = ae(s), $ = V(null), S = I((n = "") => {
484
- if (v) {
485
- const i = 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);
486
- return r("search", { value: n, filtersChanged: i, filters: s });
487
- }
488
- return r("search", { value: n });
489
- }, [r, s]), x = I((n) => {
490
- r("clear", { navigateToHome: n });
491
- }, [r]), A = (n) => l ? n.replace(/([@#].*)/g, "") : n, d = I((n) => {
492
- if (c.open && n.preventDefault) {
493
- n.preventDefault();
494
- return;
495
- }
496
- const i = document.activeElement, g = $.current && typeof $.current.contains == "function" ? $.current.contains(i) : !1, m = A(e);
497
- typeof n == "boolean" && n || m.length && g || (s == null ? void 0 : s.guideCategory) || (s == null ? void 0 : s.tag) && g ? S(m) : x(g);
498
- }, [$, e, c, x, s, S]);
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 = U(r, ["className"]);
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: $ = "search",
583
+ route: x = "search",
521
584
  incremental: S = !0,
522
- showChildren: x = !1,
585
+ showChildren: $ = !1,
523
586
  quickFilter: A,
524
587
  quickFilters: d,
525
588
  filterBadges: n
526
- } = P(), { params: i } = ge(), [g, m] = N(!1), [a, h] = N(i.phrase || ""), [p, q] = N({
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 = Ne(), W = M(), { position: xe = "inside" } = typeof n == "object" ? n : {};
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("router:changed", () => {
537
- if (A) {
538
- const { open: E, symbol: C } = A;
539
- if (E) {
540
- if (C) {
541
- const F = a.replace(a.slice(a.indexOf(C)), "");
542
- h(F);
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
- }, [A, a, h, W]);
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 $e = I((E) => {
553
- h(E);
554
- }, [h]), Ee = I(() => {
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) !== $ ? h("") : j(!0);
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 !== xe)
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(H, {
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: $e,
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(H, {
694
+ }, /* @__PURE__ */ f.createElement(J, {
625
695
  size: 27,
626
696
  symbol: { type: "Svg", content: "clear" }
627
- })), x && !oe && ke.map((E) => /* @__PURE__ */ f.createElement(ze, {
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
- ${(e) => {
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.ffb2e6c2.js.map
846
+ //# sourceMappingURL=search.ca38a836.js.map