@telia-ace/knowledge-widget-components-search 1.0.43 → 1.0.44-next.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.
- package/dist/index.js +138 -118
- package/dist/index.js.map +1 -1
- package/dist/search-component.d.ts +2 -1
- package/dist/search.9c0e8397.js +938 -0
- package/dist/search.9c0e8397.js.map +1 -0
- package/package.json +7 -7
- package/dist/search.9f859d14.js +0 -887
- package/dist/search.9f859d14.js.map +0 -1
package/dist/search.9f859d14.js
DELETED
|
@@ -1,887 +0,0 @@
|
|
|
1
|
-
var Ae = Object.defineProperty, Ie = Object.defineProperties;
|
|
2
|
-
var qe = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var Q = Object.getOwnPropertySymbols;
|
|
4
|
-
var re = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var ne = (e, t, o) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, B = (e, t) => {
|
|
6
|
-
for (var o in t || (t = {}))
|
|
7
|
-
re.call(t, o) && ne(e, o, t[o]);
|
|
8
|
-
if (Q)
|
|
9
|
-
for (var o of Q(t))
|
|
10
|
-
se.call(t, o) && ne(e, o, t[o]);
|
|
11
|
-
return e;
|
|
12
|
-
}, D = (e, t) => Ie(e, qe(t));
|
|
13
|
-
var G = (e, t) => {
|
|
14
|
-
var o = {};
|
|
15
|
-
for (var r in e)
|
|
16
|
-
re.call(e, r) && t.indexOf(r) < 0 && (o[r] = e[r]);
|
|
17
|
-
if (e != null && Q)
|
|
18
|
-
for (var r of Q(e))
|
|
19
|
-
t.indexOf(r) < 0 && se.call(e, r) && (o[r] = e[r]);
|
|
20
|
-
return o;
|
|
21
|
-
};
|
|
22
|
-
import { css as O } from "@emotion/react";
|
|
23
|
-
import F from "@emotion/styled";
|
|
24
|
-
import { useProperties as P, useDispatch as U, useRouteData as de, useEventListener as J, useKeyPress as H, Tooltip as Fe, borderTabStyle as M, Text as fe, Link as ge, SymbolBadge as Y, ItemTree as ze, useScroll as Be, useContainer as me, Loader as Le, contentBox as he, useDebounce as De, usePrevious as ae, useChildren as Ne, useWidgetEvent as Te, useTransitionEnd as Oe, convertToStringAttributes as Ke, Input as Pe, Button as pe } from "@telia-ace/knowledge-widget-ui";
|
|
25
|
-
import { Component as We } from "@telia-ace/widget-types-grid";
|
|
26
|
-
import { appendClassNames as R, deepClone as je, categoryTrail as Qe } from "@telia-ace/widget-utilities";
|
|
27
|
-
import f, { useState as T, useCallback as I, useRef as V, useEffect as K } from "react";
|
|
28
|
-
const Xe = (v) => {
|
|
29
|
-
var b = v, {
|
|
30
|
-
text: e,
|
|
31
|
-
className: t,
|
|
32
|
-
forceFocusStyle: o,
|
|
33
|
-
filterType: r,
|
|
34
|
-
handleClick: l,
|
|
35
|
-
deleteAriaLabel: c = ""
|
|
36
|
-
} = b, s = G(b, [
|
|
37
|
-
"text",
|
|
38
|
-
"className",
|
|
39
|
-
"forceFocusStyle",
|
|
40
|
-
"filterType",
|
|
41
|
-
"handleClick",
|
|
42
|
-
"deleteAriaLabel"
|
|
43
|
-
]);
|
|
44
|
-
const k = V();
|
|
45
|
-
return /* @__PURE__ */ f.createElement(
|
|
46
|
-
fe,
|
|
47
|
-
{
|
|
48
|
-
className: R(t, "humany-filter-badge"),
|
|
49
|
-
onKeyDown: (y) => {
|
|
50
|
-
y.key === "Enter" && l(y, r);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
e,
|
|
54
|
-
/* @__PURE__ */ f.createElement(
|
|
55
|
-
ge,
|
|
56
|
-
D(B({}, s), {
|
|
57
|
-
ref: k,
|
|
58
|
-
tabIndex: 0,
|
|
59
|
-
role: "button",
|
|
60
|
-
"aria-label": c.replace("{{item}}", e),
|
|
61
|
-
onClick: (y) => l(y, r)
|
|
62
|
-
}),
|
|
63
|
-
/* @__PURE__ */ f.createElement(Y, { size: 13, symbol: { type: "Svg", content: "close" } })
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
|
-
}, Me = ({
|
|
67
|
-
inputHasFocus: e,
|
|
68
|
-
searchContainerRef: t,
|
|
69
|
-
showTag: o,
|
|
70
|
-
showGuideCategory: r,
|
|
71
|
-
position: l
|
|
72
|
-
}) => {
|
|
73
|
-
const { activeFilterBadges: c = {}, deleteFilterBadgeAriaLabel: s = "" } = P(), v = U(), { name: b, params: k } = de(), [y, u] = T(!1), x = I((m) => {
|
|
74
|
-
const { key: a } = m;
|
|
75
|
-
["ArrowLeft", "ArrowRight"].indexOf(a) === -1 && u(!1);
|
|
76
|
-
}, []);
|
|
77
|
-
J("keydown", x, window), J("click", x, window);
|
|
78
|
-
const { guideCategory: S, tag: $, tooltip: A } = c, d = (m) => {
|
|
79
|
-
const a = m.querySelectorAll(
|
|
80
|
-
".humany-filter-badge"
|
|
81
|
-
);
|
|
82
|
-
return {
|
|
83
|
-
badges: a,
|
|
84
|
-
index: Array.from(a).findIndex((h) => document.activeElement === h)
|
|
85
|
-
};
|
|
86
|
-
}, n = (m, a) => {
|
|
87
|
-
m.preventDefault(), v("quick-filter:remove", { types: [a] });
|
|
88
|
-
}, i = (m, a) => {
|
|
89
|
-
if (!t)
|
|
90
|
-
return;
|
|
91
|
-
const { badges: h, index: p } = d(t);
|
|
92
|
-
if (h.length) {
|
|
93
|
-
let q = null;
|
|
94
|
-
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));
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
H(
|
|
98
|
-
"ArrowLeft",
|
|
99
|
-
I(() => {
|
|
100
|
-
if (!t)
|
|
101
|
-
return;
|
|
102
|
-
const { index: m } = d(t);
|
|
103
|
-
if (e || m > -1) {
|
|
104
|
-
const a = t.querySelector('[data-type="search"]'), h = a && a.selectionStart !== null && a.selectionStart <= 0, p = m > -1;
|
|
105
|
-
(h || p) && i("left", a);
|
|
106
|
-
}
|
|
107
|
-
}, [e, t])
|
|
108
|
-
), H(
|
|
109
|
-
"ArrowRight",
|
|
110
|
-
I(() => {
|
|
111
|
-
if (!t)
|
|
112
|
-
return;
|
|
113
|
-
const { index: m } = d(t);
|
|
114
|
-
if (m > -1) {
|
|
115
|
-
const a = t.querySelector('[data-type="search"]');
|
|
116
|
-
m > -1 && i("right", a);
|
|
117
|
-
}
|
|
118
|
-
}, [t])
|
|
119
|
-
), H(
|
|
120
|
-
"Backspace",
|
|
121
|
-
I(
|
|
122
|
-
(m) => {
|
|
123
|
-
if (!t)
|
|
124
|
-
return;
|
|
125
|
-
let a = [];
|
|
126
|
-
const { index: h } = d(t), p = t.querySelector('[data-type="search"]');
|
|
127
|
-
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 }));
|
|
128
|
-
},
|
|
129
|
-
[t, c, o, r]
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
const g = I(
|
|
133
|
-
(m) => m === "guideCategory" && S && r ? /* @__PURE__ */ f.createElement(
|
|
134
|
-
ie,
|
|
135
|
-
{
|
|
136
|
-
text: `@${S.title}`,
|
|
137
|
-
routeName: b,
|
|
138
|
-
filterType: "guideCategory",
|
|
139
|
-
handleClick: n,
|
|
140
|
-
forceFocusStyle: y,
|
|
141
|
-
deleteAriaLabel: s,
|
|
142
|
-
params: D(B({}, k), {
|
|
143
|
-
guideCategory: void 0
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
) : m === "tag" && $ && o ? /* @__PURE__ */ f.createElement(
|
|
147
|
-
ie,
|
|
148
|
-
{
|
|
149
|
-
className: "humany-filter-badge",
|
|
150
|
-
text: `#${$.title}`,
|
|
151
|
-
routeName: b,
|
|
152
|
-
filterType: "tag",
|
|
153
|
-
handleClick: n,
|
|
154
|
-
forceFocusStyle: y,
|
|
155
|
-
deleteAriaLabel: s,
|
|
156
|
-
params: D(B({}, k), {
|
|
157
|
-
tag: void 0
|
|
158
|
-
})
|
|
159
|
-
}
|
|
160
|
-
) : null,
|
|
161
|
-
[S, $, b, k, r, o, y]
|
|
162
|
-
);
|
|
163
|
-
return !S && !$ ? null : /* @__PURE__ */ f.createElement(Ge, { className: "humany-filter-badges", position: l }, S && A ? /* @__PURE__ */ f.createElement(Fe, { content: /* @__PURE__ */ f.createElement(f.Fragment, null, A), sticky: !1 }, g("guideCategory")) : g("guideCategory"), $ && g("tag"));
|
|
164
|
-
}, Ue = Me, Ge = F.div`
|
|
165
|
-
display: flex;
|
|
166
|
-
align-items: center;
|
|
167
|
-
flex-wrap: wrap;
|
|
168
|
-
|
|
169
|
-
${(e) => {
|
|
170
|
-
var t, o;
|
|
171
|
-
return e.position === "inside" ? O`
|
|
172
|
-
&:not(:first-child) {
|
|
173
|
-
margin: 0 0 0 ${(t = e.theme.sizes) == null ? void 0 : t.normal};
|
|
174
|
-
}
|
|
175
|
-
` : O`
|
|
176
|
-
margin: ${(o = e.theme.sizes) == null ? void 0 : o.small} 0 0 0;
|
|
177
|
-
span:first-child {
|
|
178
|
-
margin-left: 0;
|
|
179
|
-
}
|
|
180
|
-
`;
|
|
181
|
-
}}
|
|
182
|
-
`, ie = F(Xe)`
|
|
183
|
-
display: flex;
|
|
184
|
-
align-items: center;
|
|
185
|
-
padding: ${(e) => {
|
|
186
|
-
var t, o;
|
|
187
|
-
return `${(t = e.theme.sizes) == null ? void 0 : t.small} calc(${(o = e.theme.sizes) == null ? void 0 : o.normal}/2) `;
|
|
188
|
-
}};
|
|
189
|
-
background-color: ${(e) => {
|
|
190
|
-
var t;
|
|
191
|
-
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
192
|
-
}};
|
|
193
|
-
border-radius: ${(e) => e.theme.borderRadius};
|
|
194
|
-
font-weight: 300;
|
|
195
|
-
font-size: ${(e) => {
|
|
196
|
-
var t;
|
|
197
|
-
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
198
|
-
}};
|
|
199
|
-
font-style: italic;
|
|
200
|
-
color: #ffffff;
|
|
201
|
-
text-decoration: none;
|
|
202
|
-
white-space: nowrap;
|
|
203
|
-
|
|
204
|
-
margin: calc(${(e) => {
|
|
205
|
-
var t;
|
|
206
|
-
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
207
|
-
}} / 2);
|
|
208
|
-
|
|
209
|
-
&:focus-within {
|
|
210
|
-
${M}
|
|
211
|
-
background-color: transparent;
|
|
212
|
-
|
|
213
|
-
svg {
|
|
214
|
-
path {
|
|
215
|
-
stroke: ${(e) => {
|
|
216
|
-
var t;
|
|
217
|
-
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
218
|
-
}};
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
a {
|
|
222
|
-
outline: none;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
${(e) => {
|
|
227
|
-
var t;
|
|
228
|
-
return e.forceFocusStyle && O`
|
|
229
|
-
${M(e)}
|
|
230
|
-
background-color: transparent;
|
|
231
|
-
|
|
232
|
-
svg {
|
|
233
|
-
path {
|
|
234
|
-
stroke: ${(t = e.theme.colors) == null ? void 0 : t.primary};
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
`;
|
|
238
|
-
}}
|
|
239
|
-
|
|
240
|
-
svg {
|
|
241
|
-
width: 17px;
|
|
242
|
-
height: 11px;
|
|
243
|
-
margin: 1px 0 0 ${(e) => {
|
|
244
|
-
var t;
|
|
245
|
-
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
246
|
-
}};
|
|
247
|
-
path {
|
|
248
|
-
stroke: #ffffff;
|
|
249
|
-
stroke-width: 2px;
|
|
250
|
-
}
|
|
251
|
-
order: 1;
|
|
252
|
-
}
|
|
253
|
-
`, N = (e, t) => !t || !e ? !0 : e.toLowerCase().indexOf(t.toLowerCase()) > -1, He = (e = [], t, o) => {
|
|
254
|
-
if (!o)
|
|
255
|
-
return e;
|
|
256
|
-
const r = je(e);
|
|
257
|
-
if (t === "tag")
|
|
258
|
-
return r.filter((s) => N(s.title, o));
|
|
259
|
-
const l = Je(r, o);
|
|
260
|
-
return ye(r, (s) => l.indexOf(s.id) > -1);
|
|
261
|
-
}, ye = (e, t) => e.filter((o) => (o.items && o.items.length && (o.items = ye(o.items, t)), t(o))), Je = (e, t) => {
|
|
262
|
-
const r = be(e).filter((c) => N(c.title, t)).map((c) => c.id);
|
|
263
|
-
let l = [];
|
|
264
|
-
return r.forEach((c) => {
|
|
265
|
-
const s = Qe(c, e);
|
|
266
|
-
l = l.concat(s);
|
|
267
|
-
}), l;
|
|
268
|
-
}, be = (e) => {
|
|
269
|
-
let t = [];
|
|
270
|
-
return e.forEach((o) => {
|
|
271
|
-
t.push(o), Array.isArray(o.items) && (t = t.concat(be(o.items)));
|
|
272
|
-
}), t;
|
|
273
|
-
}, Z = (e) => {
|
|
274
|
-
const t = Array.from((e == null ? void 0 : e.getElementsByTagName("A")) || []).filter(
|
|
275
|
-
(o) => o.getAttribute("disabled") === null
|
|
276
|
-
);
|
|
277
|
-
return {
|
|
278
|
-
anchors: t,
|
|
279
|
-
focusedIndex: t.findIndex((o) => document.activeElement === o)
|
|
280
|
-
};
|
|
281
|
-
}, Ye = (e) => e ? e.querySelector(
|
|
282
|
-
'[data-type="search"], input[type="search"]'
|
|
283
|
-
) : null, _ = (e) => {
|
|
284
|
-
if (!e)
|
|
285
|
-
return;
|
|
286
|
-
const t = Ye(e);
|
|
287
|
-
t && t.focus();
|
|
288
|
-
}, Ze = ({
|
|
289
|
-
filterPhrase: e,
|
|
290
|
-
items: t,
|
|
291
|
-
filterType: o,
|
|
292
|
-
filterContainer: r,
|
|
293
|
-
searchContainer: l,
|
|
294
|
-
inputHasFocus: c
|
|
295
|
-
}) => {
|
|
296
|
-
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;
|
|
297
|
-
K(() => {
|
|
298
|
-
v(He(t, o, e));
|
|
299
|
-
}, [e, o, t]), K(() => {
|
|
300
|
-
var d;
|
|
301
|
-
if (r) {
|
|
302
|
-
const { anchors: n } = Z(r), i = (d = n[0]) == null ? void 0 : d.getAttribute("data-id");
|
|
303
|
-
i && k(i);
|
|
304
|
-
}
|
|
305
|
-
}, [s, r]);
|
|
306
|
-
const $ = I(
|
|
307
|
-
(d, n) => {
|
|
308
|
-
const i = {
|
|
309
|
-
category: u != null && u.guideCategory ? u.guideCategory.id : void 0,
|
|
310
|
-
tag: u != null && u.tag ? u.tag.id : void 0
|
|
311
|
-
};
|
|
312
|
-
n === "guideCategory" ? i.category = d.id : n === "tag" && (i.tag = d.id), y("quick-filter:add", i);
|
|
313
|
-
},
|
|
314
|
-
[u, y]
|
|
315
|
-
), A = (d) => d === "guideCategory" ? {
|
|
316
|
-
renderItem: (n, i) => /* @__PURE__ */ f.createElement(
|
|
317
|
-
ue,
|
|
318
|
-
{
|
|
319
|
-
autoSelect: S && c && n.id === b,
|
|
320
|
-
disabled: !N(n.title, e),
|
|
321
|
-
tabIndex: N(n.title, e) ? 0 : -1,
|
|
322
|
-
onKeyDown: (g) => {
|
|
323
|
-
g.key === "Enter" && $(n, d);
|
|
324
|
-
},
|
|
325
|
-
"data-level": i,
|
|
326
|
-
onClick: () => {
|
|
327
|
-
$(n, d);
|
|
328
|
-
},
|
|
329
|
-
"data-id": n.id
|
|
330
|
-
},
|
|
331
|
-
/* @__PURE__ */ f.createElement(
|
|
332
|
-
ce,
|
|
333
|
-
{
|
|
334
|
-
title: n.title,
|
|
335
|
-
phrase: e,
|
|
336
|
-
matches: N(n.title, e)
|
|
337
|
-
}
|
|
338
|
-
)
|
|
339
|
-
)
|
|
340
|
-
} : {
|
|
341
|
-
renderLi: !0,
|
|
342
|
-
renderItem: (n) => /* @__PURE__ */ f.createElement(
|
|
343
|
-
ue,
|
|
344
|
-
{
|
|
345
|
-
autoSelect: S && c && n.id === b,
|
|
346
|
-
onKeyDown: (i) => {
|
|
347
|
-
i.key === "Enter" && $(n, d);
|
|
348
|
-
},
|
|
349
|
-
onClick: () => {
|
|
350
|
-
$(n, d);
|
|
351
|
-
},
|
|
352
|
-
"data-id": n.id
|
|
353
|
-
},
|
|
354
|
-
/* @__PURE__ */ f.createElement(
|
|
355
|
-
ce,
|
|
356
|
-
{
|
|
357
|
-
symbol: "#",
|
|
358
|
-
title: n.title,
|
|
359
|
-
phrase: e,
|
|
360
|
-
matches: N(n.title, e)
|
|
361
|
-
}
|
|
362
|
-
)
|
|
363
|
-
)
|
|
364
|
-
};
|
|
365
|
-
return J(
|
|
366
|
-
"keydown",
|
|
367
|
-
(d) => {
|
|
368
|
-
var q;
|
|
369
|
-
const { key: n } = d;
|
|
370
|
-
if (!r || !(n === "ArrowDown" || n === "ArrowUp" || n === "Enter"))
|
|
371
|
-
return;
|
|
372
|
-
const { anchors: i, focusedIndex: g } = Z(r);
|
|
373
|
-
if (n === "Enter") {
|
|
374
|
-
if (c && S) {
|
|
375
|
-
const w = (q = i[0]) == null ? void 0 : q.getAttribute("data-id");
|
|
376
|
-
w && $({ id: w }, o);
|
|
377
|
-
}
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
const m = () => {
|
|
381
|
-
var w;
|
|
382
|
-
return (w = i[0]) == null ? void 0 : w.focus();
|
|
383
|
-
}, a = () => {
|
|
384
|
-
var w;
|
|
385
|
-
return (w = i[i.length - 1]) == null ? void 0 : w.focus();
|
|
386
|
-
}, h = () => {
|
|
387
|
-
var w;
|
|
388
|
-
return (w = i[g + 1]) == null ? void 0 : w.focus();
|
|
389
|
-
}, p = () => {
|
|
390
|
-
var w;
|
|
391
|
-
return (w = i[g - 1]) == null ? void 0 : w.focus();
|
|
392
|
-
};
|
|
393
|
-
c ? (d.preventDefault(), n === "ArrowDown" ? m() : a()) : g > -1 && (d.preventDefault(), n === "ArrowDown" ? i.length > g + 1 ? h() : _(l) : g - 1 < 0 ? _(l) : p());
|
|
394
|
-
},
|
|
395
|
-
window
|
|
396
|
-
), /* @__PURE__ */ f.createElement(
|
|
397
|
-
ze,
|
|
398
|
-
B({
|
|
399
|
-
tree: s,
|
|
400
|
-
renderEmpty: !1,
|
|
401
|
-
ulProps: { role: "listbox" },
|
|
402
|
-
liProps: { role: "option" }
|
|
403
|
-
}, A(o))
|
|
404
|
-
);
|
|
405
|
-
}, _e = Ze, ce = ({ title: e, phrase: t, matches: o, symbol: r = "" }) => {
|
|
406
|
-
const l = () => {
|
|
407
|
-
if (!o || !t)
|
|
408
|
-
return [e];
|
|
409
|
-
const b = e.toLowerCase().indexOf(t.toLowerCase()), k = e.substr(0, b), y = e.slice(b, b + t.length), u = e.substr(b + t.length);
|
|
410
|
-
return [k, y, u];
|
|
411
|
-
}, [c, s, v] = l();
|
|
412
|
-
return /* @__PURE__ */ f.createElement(fe, null, r, c, s ? /* @__PURE__ */ f.createElement("strong", null, s) : null, v || null);
|
|
413
|
-
}, Re = O`
|
|
414
|
-
opacity: 0.5;
|
|
415
|
-
pointer-events: none;
|
|
416
|
-
`, le = (e) => {
|
|
417
|
-
var t, o;
|
|
418
|
-
return O`
|
|
419
|
-
background-color: ${(t = e.theme.colors) == null ? void 0 : t.text};
|
|
420
|
-
color: #ffffff;
|
|
421
|
-
outline: none;
|
|
422
|
-
|
|
423
|
-
span:first-child {
|
|
424
|
-
border-color: ${(o = e.theme.colors) == null ? void 0 : o.text};
|
|
425
|
-
}
|
|
426
|
-
`;
|
|
427
|
-
}, ue = F(ge)`
|
|
428
|
-
display: block;
|
|
429
|
-
text-decoration: none;
|
|
430
|
-
font-size: ${(e) => {
|
|
431
|
-
var t;
|
|
432
|
-
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
433
|
-
}};
|
|
434
|
-
|
|
435
|
-
${(e) => e.disabled && Re}
|
|
436
|
-
color: ${(e) => {
|
|
437
|
-
var t;
|
|
438
|
-
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
439
|
-
}};
|
|
440
|
-
background-color: transparent;
|
|
441
|
-
|
|
442
|
-
span {
|
|
443
|
-
display: block;
|
|
444
|
-
${(e) => {
|
|
445
|
-
var t, o, r, l;
|
|
446
|
-
return e["data-level"] ? `padding: calc(${(t = e.theme.sizes) == null ? void 0 : t.normal} / 2) ${(o = e.theme.sizes) == null ? void 0 : o.normal};` : `padding: calc(${(r = e.theme.sizes) == null ? void 0 : r.normal} / 2) ${(l = e.theme.sizes) == null ? void 0 : l.medium}; `;
|
|
447
|
-
}}
|
|
448
|
-
${(e) => e["data-level"] && "border-left: 2px solid"}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
span:first-child {
|
|
452
|
-
border-color: #e7e7e7;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
${(e) => {
|
|
456
|
-
var t;
|
|
457
|
-
return e["data-level"] && `padding: 0 calc(${(t = e.theme.sizes) == null ? void 0 : t.medium} * ${e["data-level"]});`;
|
|
458
|
-
}}
|
|
459
|
-
|
|
460
|
-
${(e) => e.autoSelect && le}
|
|
461
|
-
|
|
462
|
-
&:hover,
|
|
463
|
-
&:focus {
|
|
464
|
-
${le}
|
|
465
|
-
}
|
|
466
|
-
`, Ve = ({ phrase: e = "", inputHasFocus: t, searchContainerRef: o }) => {
|
|
467
|
-
const {
|
|
468
|
-
quickFilter: r = {
|
|
469
|
-
open: !1,
|
|
470
|
-
loading: !1,
|
|
471
|
-
symbol: "",
|
|
472
|
-
type: "",
|
|
473
|
-
items: []
|
|
474
|
-
}
|
|
475
|
-
} = P(), [l, c] = Be(!0), s = me(), { events: v } = s.get("$widget"), b = V(), k = I(
|
|
476
|
-
(d) => (d && d.addEventListener(
|
|
477
|
-
"keydown",
|
|
478
|
-
() => {
|
|
479
|
-
Z(d).focusedIndex > -1 && v.subscribeOnce("router:changed", () => {
|
|
480
|
-
_(o);
|
|
481
|
-
});
|
|
482
|
-
},
|
|
483
|
-
!0
|
|
484
|
-
), b.current = d, d),
|
|
485
|
-
[o]
|
|
486
|
-
), { items: y = [], symbol: u, type: x, open: S, loading: $ } = r;
|
|
487
|
-
if (!S || !u)
|
|
488
|
-
return null;
|
|
489
|
-
const A = e.slice(e.indexOf(u) + 1);
|
|
490
|
-
return /* @__PURE__ */ f.createElement(
|
|
491
|
-
et,
|
|
492
|
-
{
|
|
493
|
-
ref: k,
|
|
494
|
-
"data-loading": $,
|
|
495
|
-
className: R(
|
|
496
|
-
"humany-quick-filter-dropdown",
|
|
497
|
-
[x === "guideCategory", "humany-quick-filter-guide-categories"],
|
|
498
|
-
[x === "tag", "humany-quick-filter-tags"]
|
|
499
|
-
)
|
|
500
|
-
},
|
|
501
|
-
/* @__PURE__ */ f.createElement(tt, { className: "humany-quick-filter-dropdown-inner", css: l, ref: c }, /* @__PURE__ */ f.createElement(
|
|
502
|
-
_e,
|
|
503
|
-
{
|
|
504
|
-
filterType: x,
|
|
505
|
-
items: y,
|
|
506
|
-
filterPhrase: A,
|
|
507
|
-
filterContainer: c.current,
|
|
508
|
-
searchContainer: o,
|
|
509
|
-
inputHasFocus: t
|
|
510
|
-
}
|
|
511
|
-
)),
|
|
512
|
-
/* @__PURE__ */ f.createElement(Le, { loading: $ })
|
|
513
|
-
);
|
|
514
|
-
}, et = F.div`
|
|
515
|
-
${(e) => he(e)};
|
|
516
|
-
position: absolute;
|
|
517
|
-
top: calc(100% + ${(e) => {
|
|
518
|
-
var t;
|
|
519
|
-
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
520
|
-
}});
|
|
521
|
-
left: 0;
|
|
522
|
-
right: 0;
|
|
523
|
-
z-index: 1;
|
|
524
|
-
overflow: hidden;
|
|
525
|
-
`, tt = F.div`
|
|
526
|
-
max-height: 300px;
|
|
527
|
-
overflow: auto;
|
|
528
|
-
padding: ${(e) => {
|
|
529
|
-
var t;
|
|
530
|
-
return (t = e.theme.sizes) == null ? void 0 : t.medium;
|
|
531
|
-
}} 0;
|
|
532
|
-
${(e) => e.css}
|
|
533
|
-
ul {
|
|
534
|
-
list-style: none;
|
|
535
|
-
padding: 0;
|
|
536
|
-
margin: 0;
|
|
537
|
-
}
|
|
538
|
-
li div {
|
|
539
|
-
${(e) => {
|
|
540
|
-
var t;
|
|
541
|
-
return `margin: ${(t = e.theme.sizes) == null ? void 0 : t.normal} 0;`;
|
|
542
|
-
}}
|
|
543
|
-
}
|
|
544
|
-
`, X = (e, t) => !!(e && !t || !e && t || e && t && e.id !== t.id), ot = (e, t = {}, o = !0) => {
|
|
545
|
-
const r = U(), {
|
|
546
|
-
quickFilters: l = !1,
|
|
547
|
-
quickFilter: c = { open: !1 },
|
|
548
|
-
activeFilterBadges: s,
|
|
549
|
-
filterBadges: v = !1,
|
|
550
|
-
incremental: b = 600
|
|
551
|
-
} = P(), k = De(
|
|
552
|
-
e,
|
|
553
|
-
typeof b == "boolean" ? 600 : b
|
|
554
|
-
), y = ae(k), u = ae(s), x = V(null), S = I(
|
|
555
|
-
(n = "") => {
|
|
556
|
-
if (v) {
|
|
557
|
-
const i = X(
|
|
558
|
-
s == null ? void 0 : s.guideCategory,
|
|
559
|
-
u == null ? void 0 : u.guideCategory
|
|
560
|
-
) || X(s == null ? void 0 : s.tag, u == null ? void 0 : u.tag);
|
|
561
|
-
return r("search", { value: n, filtersChanged: i, filters: s });
|
|
562
|
-
}
|
|
563
|
-
return r("search", { value: n });
|
|
564
|
-
},
|
|
565
|
-
[r, s]
|
|
566
|
-
), $ = I(
|
|
567
|
-
(n) => {
|
|
568
|
-
r("clear", { navigateToHome: n });
|
|
569
|
-
},
|
|
570
|
-
[r]
|
|
571
|
-
), A = (n) => l ? n.replace(/([@#].*)/g, "") : n, d = I(
|
|
572
|
-
(n) => {
|
|
573
|
-
if (c.open && n.preventDefault) {
|
|
574
|
-
n.preventDefault();
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
const i = document.activeElement, g = x.current && typeof x.current.contains == "function" ? x.current.contains(i) : !1, m = A(e);
|
|
578
|
-
typeof n == "boolean" && n || m.length && g || (s == null ? void 0 : s.guideCategory) || (s == null ? void 0 : s.tag) && g ? S(m) : $(g);
|
|
579
|
-
},
|
|
580
|
-
[x, e, c, $, s, S]
|
|
581
|
-
);
|
|
582
|
-
return K(() => {
|
|
583
|
-
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);
|
|
584
|
-
(typeof g != "undefined" && g !== i && i !== t.phrase && o && !c.open || n && !(s != null && s.initial)) && d(n);
|
|
585
|
-
}, [k, c.open, s, d]), K(() => {
|
|
586
|
-
if (e && l) {
|
|
587
|
-
const n = typeof l == "boolean" && !!l || typeof l == "object" && !!l.guideCategory, i = typeof l == "boolean" && !!l || typeof l == "object" && !!l.tag;
|
|
588
|
-
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: "#" });
|
|
589
|
-
}
|
|
590
|
-
c.open && e.indexOf("@") === -1 && e.indexOf("#") === -1 && r("quick-filter:close");
|
|
591
|
-
}, [e]), [d, $, x];
|
|
592
|
-
}, mt = (o) => {
|
|
593
|
-
var r = o, { className: e } = r, t = G(r, ["className"]);
|
|
594
|
-
const {
|
|
595
|
-
showSearchButton: l,
|
|
596
|
-
showClearButton: c,
|
|
597
|
-
role: s = "search",
|
|
598
|
-
autoFocus: v,
|
|
599
|
-
placeholder: b,
|
|
600
|
-
searchButtonLabel: k,
|
|
601
|
-
clearButtonLabel: y,
|
|
602
|
-
ariaLabel: u,
|
|
603
|
-
route: x = "search",
|
|
604
|
-
incremental: S = !0,
|
|
605
|
-
showChildren: $ = !1,
|
|
606
|
-
quickFilter: A,
|
|
607
|
-
quickFilters: d,
|
|
608
|
-
filterBadges: n
|
|
609
|
-
} = P(), { params: i } = de(), [g, m] = T(!1), [a, h] = T(i.phrase || ""), [p, q] = T({
|
|
610
|
-
guideCategory: !1,
|
|
611
|
-
tag: !1
|
|
612
|
-
}), w = me(), ke = Ne(), W = U(), { position: $e = "inside" } = typeof n == "object" ? n : {};
|
|
613
|
-
K(() => {
|
|
614
|
-
const { guideCategory: E, tag: C } = i, z = typeof n == "object" ? !!n.guideCategory : !!n, ve = typeof n == "object" ? !!n.tag : !!n;
|
|
615
|
-
q({
|
|
616
|
-
guideCategory: z && !!E,
|
|
617
|
-
tag: ve && !!C
|
|
618
|
-
});
|
|
619
|
-
}, [n, i]), Te(
|
|
620
|
-
"router:changed",
|
|
621
|
-
() => {
|
|
622
|
-
if (A) {
|
|
623
|
-
const { open: E, symbol: C } = A;
|
|
624
|
-
if (E) {
|
|
625
|
-
if (C) {
|
|
626
|
-
const z = a.replace(a.slice(a.indexOf(C)), "");
|
|
627
|
-
h(z);
|
|
628
|
-
}
|
|
629
|
-
W("quick-filter:close");
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
[A, a, h, W]
|
|
634
|
-
);
|
|
635
|
-
const [ee, j, L] = ot(a, i, !!S);
|
|
636
|
-
K(() => {
|
|
637
|
-
h(i.phrase || "");
|
|
638
|
-
}, [i.phrase]);
|
|
639
|
-
const xe = I(
|
|
640
|
-
(E) => {
|
|
641
|
-
h(E);
|
|
642
|
-
},
|
|
643
|
-
[h]
|
|
644
|
-
), Ee = I(() => {
|
|
645
|
-
W("quick-filter:close").then(() => j(!0));
|
|
646
|
-
}, [W, j]), we = I(() => {
|
|
647
|
-
var E, C;
|
|
648
|
-
v && !g && ((C = (E = L.current) == null ? void 0 : E.getElementsByTagName("input")[0]) == null || C.focus());
|
|
649
|
-
}, [v, g, L]), Ce = I(() => {
|
|
650
|
-
w.getAsync("router").then((E) => {
|
|
651
|
-
const C = E.getInitialRoute(), z = E.getRouteData();
|
|
652
|
-
(C == null ? void 0 : C.name) === z.name && (C == null ? void 0 : C.name) !== x ? h("") : j(!0);
|
|
653
|
-
});
|
|
654
|
-
}, [w, h, j]), te = (E) => {
|
|
655
|
-
if (E !== $e)
|
|
656
|
-
return null;
|
|
657
|
-
if (!!p.guideCategory || !!p.tag)
|
|
658
|
-
return /* @__PURE__ */ f.createElement(
|
|
659
|
-
Ue,
|
|
660
|
-
{
|
|
661
|
-
position: E,
|
|
662
|
-
inputHasFocus: g,
|
|
663
|
-
showGuideCategory: p.guideCategory,
|
|
664
|
-
showTag: p.tag,
|
|
665
|
-
searchContainerRef: L.current
|
|
666
|
-
}
|
|
667
|
-
);
|
|
668
|
-
};
|
|
669
|
-
Oe(we);
|
|
670
|
-
const oe = c && (p.guideCategory || p.tag || a), Se = d ? Ke({
|
|
671
|
-
role: "combobox",
|
|
672
|
-
"aria-autocomplete": "list",
|
|
673
|
-
autoComplete: "off",
|
|
674
|
-
"aria-haspopup": "listbox"
|
|
675
|
-
}) : {};
|
|
676
|
-
return /* @__PURE__ */ f.createElement(
|
|
677
|
-
nt,
|
|
678
|
-
D(B({}, t), {
|
|
679
|
-
ref: L,
|
|
680
|
-
role: s,
|
|
681
|
-
className: R(e, "humany-search"),
|
|
682
|
-
"data-has-phrase": !!a,
|
|
683
|
-
"data-has-focus": g,
|
|
684
|
-
"data-has-search-symbol": l ? "true" : "false"
|
|
685
|
-
}),
|
|
686
|
-
/* @__PURE__ */ f.createElement(
|
|
687
|
-
rt,
|
|
688
|
-
{
|
|
689
|
-
action: ".",
|
|
690
|
-
onSubmit: (E) => {
|
|
691
|
-
var C, z;
|
|
692
|
-
E.preventDefault(), (z = (C = L.current) == null ? void 0 : C.getElementsByTagName("input")[0]) == null || z.blur();
|
|
693
|
-
},
|
|
694
|
-
"data-has-focus": g
|
|
695
|
-
},
|
|
696
|
-
l && /* @__PURE__ */ f.createElement(
|
|
697
|
-
st,
|
|
698
|
-
{
|
|
699
|
-
"aria-label": k,
|
|
700
|
-
type: "submit",
|
|
701
|
-
title: k,
|
|
702
|
-
disabled: !a,
|
|
703
|
-
onClick: ee,
|
|
704
|
-
"data-has-phrase": !!a,
|
|
705
|
-
"data-has-focus": g
|
|
706
|
-
},
|
|
707
|
-
/* @__PURE__ */ f.createElement(Y, { size: 32, symbol: { type: "Svg", content: "search" } })
|
|
708
|
-
),
|
|
709
|
-
te("inside"),
|
|
710
|
-
/* @__PURE__ */ f.createElement(
|
|
711
|
-
Pe,
|
|
712
|
-
D(B({
|
|
713
|
-
type: "search",
|
|
714
|
-
"aria-label": u
|
|
715
|
-
}, Se), {
|
|
716
|
-
placeholder: p.guideCategory || p.tag ? "" : b,
|
|
717
|
-
onFocusChange: m,
|
|
718
|
-
onEscape: Ee,
|
|
719
|
-
onEnter: ee,
|
|
720
|
-
onChange: xe,
|
|
721
|
-
value: a
|
|
722
|
-
})
|
|
723
|
-
),
|
|
724
|
-
oe && /* @__PURE__ */ f.createElement(
|
|
725
|
-
at,
|
|
726
|
-
{
|
|
727
|
-
"aria-label": y,
|
|
728
|
-
type: "reset",
|
|
729
|
-
hasFocus: g,
|
|
730
|
-
title: y,
|
|
731
|
-
onClick: Ce
|
|
732
|
-
},
|
|
733
|
-
/* @__PURE__ */ f.createElement(Y, { size: 27, symbol: { type: "Svg", content: "clear" } })
|
|
734
|
-
),
|
|
735
|
-
$ && !oe && ke.map((E) => /* @__PURE__ */ f.createElement(We, { key: E.id, id: E.id, branch: "default" })),
|
|
736
|
-
/* @__PURE__ */ f.createElement(
|
|
737
|
-
Ve,
|
|
738
|
-
{
|
|
739
|
-
inputHasFocus: g,
|
|
740
|
-
phrase: a,
|
|
741
|
-
searchContainerRef: L.current
|
|
742
|
-
}
|
|
743
|
-
)
|
|
744
|
-
),
|
|
745
|
-
te("below")
|
|
746
|
-
);
|
|
747
|
-
}, nt = F.div`
|
|
748
|
-
${he};
|
|
749
|
-
width: 100%;
|
|
750
|
-
padding: ${(e) => {
|
|
751
|
-
var t;
|
|
752
|
-
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
753
|
-
}};
|
|
754
|
-
|
|
755
|
-
input {
|
|
756
|
-
background-color: transparent;
|
|
757
|
-
border: none;
|
|
758
|
-
outline: none;
|
|
759
|
-
min-width: 25%;
|
|
760
|
-
flex: 1;
|
|
761
|
-
font-size: ${(e) => {
|
|
762
|
-
var t;
|
|
763
|
-
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
764
|
-
}};
|
|
765
|
-
font-weight: 300;
|
|
766
|
-
font-style: italic;
|
|
767
|
-
padding: 1em 0;
|
|
768
|
-
color: ${(e) => {
|
|
769
|
-
var t;
|
|
770
|
-
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
771
|
-
}};
|
|
772
|
-
-webkit-appearance: none;
|
|
773
|
-
|
|
774
|
-
${(e) => {
|
|
775
|
-
var t;
|
|
776
|
-
return e["data-has-search-symbol"] === "true" && `text-indent: ${(t = e.theme.sizes) == null ? void 0 : t.normal};`;
|
|
777
|
-
}}
|
|
778
|
-
|
|
779
|
-
::placeholder {
|
|
780
|
-
color: ${(e) => {
|
|
781
|
-
var t;
|
|
782
|
-
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
783
|
-
}};
|
|
784
|
-
}
|
|
785
|
-
/* removes the 'X' from IE */
|
|
786
|
-
&[type='search']::-ms-clear {
|
|
787
|
-
display: none;
|
|
788
|
-
width: 0;
|
|
789
|
-
height: 0;
|
|
790
|
-
}
|
|
791
|
-
&[type='search']::-ms-reveal {
|
|
792
|
-
display: none;
|
|
793
|
-
width: 0;
|
|
794
|
-
height: 0;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
/* removes the 'X' from Chrome */
|
|
798
|
-
&[type='search']::-webkit-search-decoration,
|
|
799
|
-
&[type='search']::-webkit-search-cancel-button,
|
|
800
|
-
&[type='search']::-webkit-search-results-button,
|
|
801
|
-
&[type='search']::-webkit-search-results-decoration {
|
|
802
|
-
display: none;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
&:focus {
|
|
806
|
-
outline: none;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
button {
|
|
811
|
-
background: transparent;
|
|
812
|
-
border: none;
|
|
813
|
-
padding: 0;
|
|
814
|
-
font-size: ${(e) => {
|
|
815
|
-
var t;
|
|
816
|
-
return (t = e.theme.fonts) == null ? void 0 : t.large;
|
|
817
|
-
}};
|
|
818
|
-
transition: color 200ms ease-out;
|
|
819
|
-
color: ${(e) => {
|
|
820
|
-
var t;
|
|
821
|
-
return e["data-has-focus"] || e["data-has-phrase"] ? (t = e.theme.colors) == null ? void 0 : t.primary : "#000000";
|
|
822
|
-
}};
|
|
823
|
-
cursor: pointer;
|
|
824
|
-
> svg {
|
|
825
|
-
height: 100%;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
`, rt = F.form`
|
|
829
|
-
display: flex;
|
|
830
|
-
flex-wrap: nowrap;
|
|
831
|
-
align-items: center;
|
|
832
|
-
border: ${(e) => e.theme.inputBorder};
|
|
833
|
-
border-radius: ${(e) => e.theme.borderRadius};
|
|
834
|
-
background-color: #ffffff;
|
|
835
|
-
position: relative;
|
|
836
|
-
padding: 0 ${(e) => {
|
|
837
|
-
var t;
|
|
838
|
-
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
839
|
-
}};
|
|
840
|
-
|
|
841
|
-
${(e) => {
|
|
842
|
-
var t, o;
|
|
843
|
-
return e["data-has-focus"] && O`
|
|
844
|
-
${(t = e.theme.accessibility) != null && t.isTabbing ? M(e) : `
|
|
845
|
-
border-color: ${(o = e.theme.colors) == null ? void 0 : o.primary};
|
|
846
|
-
outline: none;
|
|
847
|
-
input {
|
|
848
|
-
outline: none;
|
|
849
|
-
}
|
|
850
|
-
`}
|
|
851
|
-
`;
|
|
852
|
-
}};
|
|
853
|
-
`, st = F(pe)`
|
|
854
|
-
padding: 0;
|
|
855
|
-
height: 2em;
|
|
856
|
-
|
|
857
|
-
svg {
|
|
858
|
-
circle,
|
|
859
|
-
line {
|
|
860
|
-
stroke: ${(e) => {
|
|
861
|
-
var t;
|
|
862
|
-
return e["data-has-focus"] ? (t = e.theme.colors) == null ? void 0 : t.primary : "#000000";
|
|
863
|
-
}};
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
`, at = F(pe)`
|
|
867
|
-
&:focus-visible svg {
|
|
868
|
-
${M}
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
svg {
|
|
872
|
-
vertical-align: top;
|
|
873
|
-
|
|
874
|
-
circle,
|
|
875
|
-
line,
|
|
876
|
-
path {
|
|
877
|
-
stroke: ${(e) => {
|
|
878
|
-
var t, o;
|
|
879
|
-
return e.hasFocus ? (t = e.theme.colors) == null ? void 0 : t.primary : (o = e.theme.colors) == null ? void 0 : o.text;
|
|
880
|
-
}};
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
`;
|
|
884
|
-
export {
|
|
885
|
-
mt as default
|
|
886
|
-
};
|
|
887
|
-
//# sourceMappingURL=search.9f859d14.js.map
|