@telia-ace/knowledge-widget-components-guide-category-dropdown 1.0.47 → 1.1.1-rc.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/guide-category-dropdown-6e87a729.mjs +358 -0
- package/guide-category-dropdown-e0c53e78.js +105 -0
- package/index-34f1725b.mjs +11118 -0
- package/index-373df3a5.js +6 -0
- package/index-5c9c2abf.mjs +883 -0
- package/index-b2a67e58.js +1757 -0
- package/index.js +1 -0
- package/index.mjs +7 -0
- package/package.json +16 -40
- package/LICENSE.txt +0 -6
- package/README.md +0 -3
- package/dist/guide-category-dropdown.f83881bc.js +0 -289
- package/dist/guide-category-dropdown.f83881bc.js.map +0 -1
- package/dist/index.js +0 -79
- package/dist/index.js.map +0 -1
- /package/{dist/guide-category-dropdown-component.d.ts → guide-category-dropdown-component.d.ts} +0 -0
- /package/{dist/guide-category-dropdown-item.d.ts → guide-category-dropdown-item.d.ts} +0 -0
- /package/{dist/guide-category-dropdown-match-count.d.ts → guide-category-dropdown-match-count.d.ts} +0 -0
- /package/{dist/guide-category-dropdown.d.ts → guide-category-dropdown.d.ts} +0 -0
- /package/{dist/guide-category-dropdown.styles.d.ts → guide-category-dropdown.styles.d.ts} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { jsx as n, jsxs as b, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { E as O, C as G, u as R, a as A, c as C, f as $, n as x, l as H, b as P, d as k, e as W, B as K, g as U, h as q, i as J, T as I, S as v, j as Q, k as V, m as X, o as B } from "./index-34f1725b.mjs";
|
|
3
|
+
import { useContext as Y, useState as T, useRef as Z, useCallback as M, useEffect as _ } from "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const ee = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(O, { ...t }) : null, S = () => Y(G), te = () => {
|
|
6
|
+
const [e, t] = T(!1), d = Z(), u = M(() => t(!0), [t]), s = M(() => t(!1), [t]);
|
|
7
|
+
return R("mouseenter", u, d.current), R("mouseleave", s, d.current), [e, d];
|
|
8
|
+
}, oe = (e, t, d, u, s, o) => {
|
|
9
|
+
const f = A();
|
|
10
|
+
if (!f)
|
|
11
|
+
return {
|
|
12
|
+
routeName: t,
|
|
13
|
+
params: {}
|
|
14
|
+
};
|
|
15
|
+
const { params: g } = f.getRouteData();
|
|
16
|
+
let r = {}, c = [];
|
|
17
|
+
if (u === "tag") {
|
|
18
|
+
const { tag: i, ...h } = g;
|
|
19
|
+
c = i ? i.split(",") : [], r = h;
|
|
20
|
+
} else {
|
|
21
|
+
const { guideCategory: i, uriName: h, ...y } = g;
|
|
22
|
+
c = [i], r = y;
|
|
23
|
+
}
|
|
24
|
+
if (d && (e.id === "0" || c.includes(e.id)) && c.length === 1 && (!s || s.id === "0") && Object.keys(r).length === 0) {
|
|
25
|
+
const i = f.getInitialRoute();
|
|
26
|
+
return {
|
|
27
|
+
routeName: (i == null ? void 0 : i.name) || t,
|
|
28
|
+
params: {}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
let a = {};
|
|
32
|
+
const m = o ? o.findIndex((i) => i.id === e.id) : -1, l = c.includes(e.id);
|
|
33
|
+
if (u === "tag") {
|
|
34
|
+
const i = c.filter((y) => y !== e.id);
|
|
35
|
+
let h = [];
|
|
36
|
+
e.id === "0" ? h = [] : h = l ? i : [...c, e.id].filter((y) => y !== "0"), a = C({
|
|
37
|
+
...r,
|
|
38
|
+
tag: h
|
|
39
|
+
});
|
|
40
|
+
} else
|
|
41
|
+
o && m > 0 ? a = C({
|
|
42
|
+
...r,
|
|
43
|
+
guideCategory: o[m - 1].id,
|
|
44
|
+
uriName: $(o[m - 1].title)
|
|
45
|
+
}) : s ? a = C({
|
|
46
|
+
...r,
|
|
47
|
+
guideCategory: l ? s.id : e.id,
|
|
48
|
+
uriName: l ? $(s.title) : $(e.title)
|
|
49
|
+
}) : a = C({
|
|
50
|
+
...r,
|
|
51
|
+
uriName: l ? void 0 : $(e.title),
|
|
52
|
+
guideCategory: l ? void 0 : e.id
|
|
53
|
+
});
|
|
54
|
+
return typeof a.tag == "string" && (a.tag = a.tag.split(",")), {
|
|
55
|
+
routeName: t,
|
|
56
|
+
params: {
|
|
57
|
+
...a,
|
|
58
|
+
id: void 0,
|
|
59
|
+
guide: void 0,
|
|
60
|
+
contactMethod: void 0,
|
|
61
|
+
connectionKey: void 0,
|
|
62
|
+
connection: void 0
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}, ne = x.div`
|
|
66
|
+
${H}
|
|
67
|
+
${P}
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
min-height: 50px;
|
|
70
|
+
${(e) => e["data-toggler-in-focus"] && e.isTabbing && k`
|
|
71
|
+
&& {
|
|
72
|
+
${W(e)}
|
|
73
|
+
}
|
|
74
|
+
`};
|
|
75
|
+
`, ae = x.button`
|
|
76
|
+
background: none;
|
|
77
|
+
border: 0;
|
|
78
|
+
outline: 0;
|
|
79
|
+
display: block;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
padding: 0;
|
|
82
|
+
font-size: ${(e) => {
|
|
83
|
+
var t;
|
|
84
|
+
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
85
|
+
}};
|
|
86
|
+
text-align: end;
|
|
87
|
+
flex: 1 0 auto;
|
|
88
|
+
svg {
|
|
89
|
+
path,
|
|
90
|
+
line {
|
|
91
|
+
stroke: ${(e) => {
|
|
92
|
+
var t;
|
|
93
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
94
|
+
}};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`, j = (e) => {
|
|
98
|
+
var t, d, u, s, o, f, g, r;
|
|
99
|
+
return k`
|
|
100
|
+
font-size: ${(t = e.theme.fonts) == null ? void 0 : t.normal};
|
|
101
|
+
text-align: left;
|
|
102
|
+
text-align: left;
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
font-weight: 300;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
padding: ${(d = e.theme.sizes) == null ? void 0 : d.small};
|
|
108
|
+
padding-left: ${(u = e.theme.sizes) == null ? void 0 : u.large};
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
${e.selected ? k`
|
|
112
|
+
border-left: 2px solid ${(s = e.theme.colors) == null ? void 0 : s.primary};
|
|
113
|
+
color: ${(o = e.theme.colors) == null ? void 0 : o.primary};
|
|
114
|
+
` : k`
|
|
115
|
+
color: ${(f = e.theme.colors) == null ? void 0 : f.text};
|
|
116
|
+
`};
|
|
117
|
+
|
|
118
|
+
span {
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
text-overflow: ellipsis;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
i {
|
|
124
|
+
margin-right: ${(g = e.theme.sizes) == null ? void 0 : g.normal};
|
|
125
|
+
font-size: ${(r = e.theme.fonts) == null ? void 0 : r.medium};
|
|
126
|
+
min-height: 1em;
|
|
127
|
+
min-width: 1em;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
}, se = x.div`
|
|
131
|
+
${j}
|
|
132
|
+
`, re = x(K)`
|
|
133
|
+
${j}
|
|
134
|
+
&:focus {
|
|
135
|
+
outline: none;
|
|
136
|
+
}
|
|
137
|
+
&:focus-visible {
|
|
138
|
+
span {
|
|
139
|
+
${U};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`, ie = x.div`
|
|
143
|
+
display: flex;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
padding-right: ${(e) => {
|
|
146
|
+
var t;
|
|
147
|
+
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
148
|
+
}};
|
|
149
|
+
min-height: 52px;
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
|
|
152
|
+
&& {
|
|
153
|
+
font-weight: normal;
|
|
154
|
+
|
|
155
|
+
a {
|
|
156
|
+
font-weight: normal;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
.humany-guide-category-dropdown-item {
|
|
160
|
+
font-weight: normal;
|
|
161
|
+
}
|
|
162
|
+
`, le = x(q)`
|
|
163
|
+
${J}
|
|
164
|
+
display: flex;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
margin-right: ${(e) => {
|
|
168
|
+
var t;
|
|
169
|
+
return (t = e.theme.sizes) == null ? void 0 : t.medium;
|
|
170
|
+
}};
|
|
171
|
+
margin-left: ${(e) => {
|
|
172
|
+
var t;
|
|
173
|
+
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
174
|
+
}};
|
|
175
|
+
margin-bottom: 22px;
|
|
176
|
+
border-left: ${(e) => e.theme.border};
|
|
177
|
+
li {
|
|
178
|
+
margin: 0 0 ${(e) => {
|
|
179
|
+
var t;
|
|
180
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
181
|
+
}} -2px;
|
|
182
|
+
}
|
|
183
|
+
li:last-child {
|
|
184
|
+
margin: 0 0 0 -2px;
|
|
185
|
+
}
|
|
186
|
+
flex-basis: 100%;
|
|
187
|
+
border-width: 2px;
|
|
188
|
+
`, de = x(I)`
|
|
189
|
+
margin: 0 0 0 ${(e) => {
|
|
190
|
+
var t;
|
|
191
|
+
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
192
|
+
}};
|
|
193
|
+
`, p = {
|
|
194
|
+
Wrapper: ne,
|
|
195
|
+
Toggler: ae,
|
|
196
|
+
List: le,
|
|
197
|
+
Item: se,
|
|
198
|
+
Link: re,
|
|
199
|
+
TopItem: ie,
|
|
200
|
+
MatchCount: de
|
|
201
|
+
}, z = ({ matches: e }) => {
|
|
202
|
+
const { showMatchCount: t = !1 } = S();
|
|
203
|
+
return !t || typeof e > "u" ? null : /* @__PURE__ */ b(p.MatchCount, { children: [
|
|
204
|
+
"(",
|
|
205
|
+
e,
|
|
206
|
+
")"
|
|
207
|
+
] });
|
|
208
|
+
}, ce = ({ item: e, guideCategory: t }) => {
|
|
209
|
+
const {
|
|
210
|
+
route: d = "browse",
|
|
211
|
+
categoryAriaLabel: u = "",
|
|
212
|
+
activeCategoryAriaLabel: s = "",
|
|
213
|
+
fallbackOnInitialRoute: o = !1
|
|
214
|
+
} = S(), [f, g] = te(), { id: r, title: c, symbol: a, activeSymbol: m } = e, l = t === r;
|
|
215
|
+
return /* @__PURE__ */ n("li", { ref: g, children: /* @__PURE__ */ b(
|
|
216
|
+
p.Link,
|
|
217
|
+
{
|
|
218
|
+
...oe(e, d, o, "category"),
|
|
219
|
+
"aria-pressed": l,
|
|
220
|
+
"aria-label": (l ? s : u).replace(
|
|
221
|
+
"{{category}}",
|
|
222
|
+
c
|
|
223
|
+
),
|
|
224
|
+
className: "humany-guide-category-dropdown-link",
|
|
225
|
+
"aria-current": l,
|
|
226
|
+
selected: l,
|
|
227
|
+
children: [
|
|
228
|
+
(l || f) && m ? /* @__PURE__ */ n(v, { symbol: m }) : a && /* @__PURE__ */ n(v, { symbol: a }),
|
|
229
|
+
/* @__PURE__ */ n(I, { children: c }),
|
|
230
|
+
/* @__PURE__ */ n(z, { ...e })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
) });
|
|
234
|
+
}, he = ({ className: e, ...t }) => {
|
|
235
|
+
const d = Q(), [u, s] = T(!1), {
|
|
236
|
+
parent: o,
|
|
237
|
+
route: f = "browse",
|
|
238
|
+
categories: g = [],
|
|
239
|
+
loading: r = !1
|
|
240
|
+
} = S(), c = V(), [a, m] = T(!1), { params: l } = d, i = X(), { guideCategory: h, tag: y, phrase: D, sorting: E } = l;
|
|
241
|
+
if (_(() => {
|
|
242
|
+
a && m(!1);
|
|
243
|
+
}, [h]), r || !o || !g.length)
|
|
244
|
+
return ee(c, {
|
|
245
|
+
...t,
|
|
246
|
+
className: B(e, "humany-guide-category-dropdown")
|
|
247
|
+
});
|
|
248
|
+
const w = g.find((N) => N.id === h) || o, L = w.activeSymbol || w.symbol;
|
|
249
|
+
return /* @__PURE__ */ n(
|
|
250
|
+
p.Wrapper,
|
|
251
|
+
{
|
|
252
|
+
...t,
|
|
253
|
+
"data-loading": !1,
|
|
254
|
+
"data-toggler-in-focus": u,
|
|
255
|
+
"aria-expanded": a,
|
|
256
|
+
isTabbing: i,
|
|
257
|
+
className: B(e, "humany-guide-category-dropdown"),
|
|
258
|
+
children: a ? /* @__PURE__ */ b(F, { children: [
|
|
259
|
+
/* @__PURE__ */ b(p.TopItem, { className: "humany-guide-category-dropdown-top-item", children: [
|
|
260
|
+
/* @__PURE__ */ b(
|
|
261
|
+
p.Link,
|
|
262
|
+
{
|
|
263
|
+
className: "humany-guide-category-dropdown-link",
|
|
264
|
+
routeName: f,
|
|
265
|
+
params: C({
|
|
266
|
+
tag: y,
|
|
267
|
+
phrase: D,
|
|
268
|
+
sorting: E,
|
|
269
|
+
guideCategory: o.id,
|
|
270
|
+
uriName: $(o.title)
|
|
271
|
+
}),
|
|
272
|
+
selected: !1,
|
|
273
|
+
children: [
|
|
274
|
+
o.symbol ? /* @__PURE__ */ n(v, { symbol: o.symbol }) : null,
|
|
275
|
+
/* @__PURE__ */ n(I, { children: o.title }),
|
|
276
|
+
/* @__PURE__ */ n(z, { ...o })
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ n(
|
|
281
|
+
p.Toggler,
|
|
282
|
+
{
|
|
283
|
+
onBlur: () => s(!1),
|
|
284
|
+
onFocus: () => s(!0),
|
|
285
|
+
className: "humany-guide-category-dropdown-toggler",
|
|
286
|
+
onClick: () => {
|
|
287
|
+
m(!a);
|
|
288
|
+
},
|
|
289
|
+
"aria-expanded": "true",
|
|
290
|
+
"aria-label": w.title,
|
|
291
|
+
children: /* @__PURE__ */ n(
|
|
292
|
+
v,
|
|
293
|
+
{
|
|
294
|
+
size: 18,
|
|
295
|
+
symbol: { type: "Svg", content: "caret-up" }
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
] }),
|
|
301
|
+
/* @__PURE__ */ n(
|
|
302
|
+
p.List,
|
|
303
|
+
{
|
|
304
|
+
className: "humany-guide-category-dropdown-open",
|
|
305
|
+
items: g,
|
|
306
|
+
renderItem: (N) => /* @__PURE__ */ n(
|
|
307
|
+
ce,
|
|
308
|
+
{
|
|
309
|
+
item: N,
|
|
310
|
+
guideCategory: h
|
|
311
|
+
},
|
|
312
|
+
N.id
|
|
313
|
+
)
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
] }) : /* @__PURE__ */ b(p.TopItem, { className: "humany-guide-category-dropdown-top-item", children: [
|
|
317
|
+
/* @__PURE__ */ b(
|
|
318
|
+
p.Item,
|
|
319
|
+
{
|
|
320
|
+
className: "humany-guide-category-dropdown-item",
|
|
321
|
+
onClick: () => {
|
|
322
|
+
m(!a);
|
|
323
|
+
},
|
|
324
|
+
selected: !1,
|
|
325
|
+
children: [
|
|
326
|
+
L ? /* @__PURE__ */ n(v, { symbol: L }) : null,
|
|
327
|
+
/* @__PURE__ */ n(I, { children: w.title }),
|
|
328
|
+
/* @__PURE__ */ n(z, { ...w })
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ n(
|
|
333
|
+
p.Toggler,
|
|
334
|
+
{
|
|
335
|
+
onBlur: () => s(!1),
|
|
336
|
+
onFocus: () => s(!0),
|
|
337
|
+
className: "humany-guide-category-dropdown-toggler",
|
|
338
|
+
onClick: () => {
|
|
339
|
+
m(!a);
|
|
340
|
+
},
|
|
341
|
+
"aria-expanded": "false",
|
|
342
|
+
"aria-label": w.title,
|
|
343
|
+
children: /* @__PURE__ */ n(
|
|
344
|
+
v,
|
|
345
|
+
{
|
|
346
|
+
size: 18,
|
|
347
|
+
symbol: { type: "Svg", content: "caret-down" }
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] })
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
};
|
|
356
|
+
export {
|
|
357
|
+
he as default
|
|
358
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./index-b2a67e58.js"),x=require("react");require("react-dom");const T=(e,o)=>e.get("seoConfiguration")?s.jsx(t.Empty,{...o}):null,C=()=>x.useContext(t.ComponentPropertyContext),I=()=>{const[e,o]=x.useState(!1),c=x.useRef(),g=x.useCallback(()=>o(!0),[o]),r=x.useCallback(()=>o(!1),[o]);return t.useEventListener("mouseenter",g,c.current),t.useEventListener("mouseleave",r,c.current),[e,c]},z=(e,o,c,g,r,n)=>{const f=t.useRouter();if(!f)return{routeName:o,params:{}};const{params:m}=f.getRouteData();let i={},u=[];if(g==="tag"){const{tag:l,...h}=m;u=l?l.split(","):[],i=h}else{const{guideCategory:l,uriName:h,...b}=m;u=[l],i=b}if(c&&(e.id==="0"||u.includes(e.id))&&u.length===1&&(!r||r.id==="0")&&Object.keys(i).length===0){const l=f.getInitialRoute();return{routeName:(l==null?void 0:l.name)||o,params:{}}}let a={};const y=n?n.findIndex(l=>l.id===e.id):-1,d=u.includes(e.id);if(g==="tag"){const l=u.filter(b=>b!==e.id);let h=[];e.id==="0"?h=[]:h=d?l:[...u,e.id].filter(b=>b!=="0"),a=t.createParams({...i,tag:h})}else n&&y>0?a=t.createParams({...i,guideCategory:n[y-1].id,uriName:t.formatUrl(n[y-1].title)}):r?a=t.createParams({...i,guideCategory:d?r.id:e.id,uriName:d?t.formatUrl(r.title):t.formatUrl(e.title)}):a=t.createParams({...i,uriName:d?void 0:t.formatUrl(e.title),guideCategory:d?void 0:e.id});return typeof a.tag=="string"&&(a.tag=a.tag.split(",")),{routeName:o,params:{...a,id:void 0,guide:void 0,contactMethod:void 0,connectionKey:void 0,connection:void 0}}},L=t.newStyled.div`
|
|
2
|
+
${t.loadingOpacity}
|
|
3
|
+
${t.contentBox}
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
min-height: 50px;
|
|
6
|
+
${e=>e["data-toggler-in-focus"]&&e.isTabbing&&t.css`
|
|
7
|
+
&& {
|
|
8
|
+
${t.borderTabStyle(e)}
|
|
9
|
+
}
|
|
10
|
+
`};
|
|
11
|
+
`,B=t.newStyled.button`
|
|
12
|
+
background: none;
|
|
13
|
+
border: 0;
|
|
14
|
+
outline: 0;
|
|
15
|
+
display: block;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
padding: 0;
|
|
18
|
+
font-size: ${e=>{var o;return(o=e.theme.fonts)==null?void 0:o.normal}};
|
|
19
|
+
text-align: end;
|
|
20
|
+
flex: 1 0 auto;
|
|
21
|
+
svg {
|
|
22
|
+
path,
|
|
23
|
+
line {
|
|
24
|
+
stroke: ${e=>{var o;return(o=e.theme.colors)==null?void 0:o.text}};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`,$=e=>{var o,c,g,r,n,f,m,i;return t.css`
|
|
28
|
+
font-size: ${(o=e.theme.fonts)==null?void 0:o.normal};
|
|
29
|
+
text-align: left;
|
|
30
|
+
text-align: left;
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
font-weight: 300;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: ${(c=e.theme.sizes)==null?void 0:c.small};
|
|
36
|
+
padding-left: ${(g=e.theme.sizes)==null?void 0:g.large};
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
${e.selected?t.css`
|
|
40
|
+
border-left: 2px solid ${(r=e.theme.colors)==null?void 0:r.primary};
|
|
41
|
+
color: ${(n=e.theme.colors)==null?void 0:n.primary};
|
|
42
|
+
`:t.css`
|
|
43
|
+
color: ${(f=e.theme.colors)==null?void 0:f.text};
|
|
44
|
+
`};
|
|
45
|
+
|
|
46
|
+
span {
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
i {
|
|
52
|
+
margin-right: ${(m=e.theme.sizes)==null?void 0:m.normal};
|
|
53
|
+
font-size: ${(i=e.theme.fonts)==null?void 0:i.medium};
|
|
54
|
+
min-height: 1em;
|
|
55
|
+
min-width: 1em;
|
|
56
|
+
}
|
|
57
|
+
`},R=t.newStyled.div`
|
|
58
|
+
${$}
|
|
59
|
+
`,M=t.newStyled(t.BaseLink)`
|
|
60
|
+
${$}
|
|
61
|
+
&:focus {
|
|
62
|
+
outline: none;
|
|
63
|
+
}
|
|
64
|
+
&:focus-visible {
|
|
65
|
+
span {
|
|
66
|
+
${t.linkTabStyle};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`,P=t.newStyled.div`
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
padding-right: ${e=>{var o;return(o=e.theme.sizes)==null?void 0:o.large}};
|
|
73
|
+
min-height: 52px;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
|
|
76
|
+
&& {
|
|
77
|
+
font-weight: normal;
|
|
78
|
+
|
|
79
|
+
a {
|
|
80
|
+
font-weight: normal;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.humany-guide-category-dropdown-item {
|
|
84
|
+
font-weight: normal;
|
|
85
|
+
}
|
|
86
|
+
`,D=t.newStyled(t.BaseList)`
|
|
87
|
+
${t.list}
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
margin-right: ${e=>{var o;return(o=e.theme.sizes)==null?void 0:o.medium}};
|
|
92
|
+
margin-left: ${e=>{var o;return(o=e.theme.sizes)==null?void 0:o.large}};
|
|
93
|
+
margin-bottom: 22px;
|
|
94
|
+
border-left: ${e=>e.theme.border};
|
|
95
|
+
li {
|
|
96
|
+
margin: 0 0 ${e=>{var o;return(o=e.theme.sizes)==null?void 0:o.normal}} -2px;
|
|
97
|
+
}
|
|
98
|
+
li:last-child {
|
|
99
|
+
margin: 0 0 0 -2px;
|
|
100
|
+
}
|
|
101
|
+
flex-basis: 100%;
|
|
102
|
+
border-width: 2px;
|
|
103
|
+
`,E=t.newStyled(t.Text)`
|
|
104
|
+
margin: 0 0 0 ${e=>{var o;return(o=e.theme.sizes)==null?void 0:o.small}};
|
|
105
|
+
`,p={Wrapper:L,Toggler:B,List:D,Item:R,Link:M,TopItem:P,MatchCount:E},v=({matches:e})=>{const{showMatchCount:o=!1}=C();return!o||typeof e>"u"?null:s.jsxs(p.MatchCount,{children:["(",e,")"]})},F=({item:e,guideCategory:o})=>{const{route:c="browse",categoryAriaLabel:g="",activeCategoryAriaLabel:r="",fallbackOnInitialRoute:n=!1}=C(),[f,m]=I(),{id:i,title:u,symbol:a,activeSymbol:y}=e,d=o===i;return s.jsx("li",{ref:m,children:s.jsxs(p.Link,{...z(e,c,n,"category"),"aria-pressed":d,"aria-label":(d?r:g).replace("{{category}}",u),className:"humany-guide-category-dropdown-link","aria-current":d,selected:d,children:[(d||f)&&y?s.jsx(t.SymbolBadge,{symbol:y}):a&&s.jsx(t.SymbolBadge,{symbol:a}),s.jsx(t.Text,{children:u}),s.jsx(v,{...e})]})})},O=({className:e,...o})=>{const c=t.useRouteData(),[g,r]=x.useState(!1),{parent:n,route:f="browse",categories:m=[],loading:i=!1}=C(),u=t.useContainer(),[a,y]=x.useState(!1),{params:d}=c,l=t.useIsTabbing(),{guideCategory:h,tag:b,phrase:N,sorting:k}=d;if(x.useEffect(()=>{a&&y(!1)},[h]),i||!n||!m.length)return T(u,{...o,className:t.appendClassNames(e,"humany-guide-category-dropdown")});const w=m.find(j=>j.id===h)||n,S=w.activeSymbol||w.symbol;return s.jsx(p.Wrapper,{...o,"data-loading":!1,"data-toggler-in-focus":g,"aria-expanded":a,isTabbing:l,className:t.appendClassNames(e,"humany-guide-category-dropdown"),children:a?s.jsxs(s.Fragment,{children:[s.jsxs(p.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[s.jsxs(p.Link,{className:"humany-guide-category-dropdown-link",routeName:f,params:t.createParams({tag:b,phrase:N,sorting:k,guideCategory:n.id,uriName:t.formatUrl(n.title)}),selected:!1,children:[n.symbol?s.jsx(t.SymbolBadge,{symbol:n.symbol}):null,s.jsx(t.Text,{children:n.title}),s.jsx(v,{...n})]}),s.jsx(p.Toggler,{onBlur:()=>r(!1),onFocus:()=>r(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{y(!a)},"aria-expanded":"true","aria-label":w.title,children:s.jsx(t.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-up"}})})]}),s.jsx(p.List,{className:"humany-guide-category-dropdown-open",items:m,renderItem:j=>s.jsx(F,{item:j,guideCategory:h},j.id)})]}):s.jsxs(p.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[s.jsxs(p.Item,{className:"humany-guide-category-dropdown-item",onClick:()=>{y(!a)},selected:!1,children:[S?s.jsx(t.SymbolBadge,{symbol:S}):null,s.jsx(t.Text,{children:w.title}),s.jsx(v,{...w})]}),s.jsx(p.Toggler,{onBlur:()=>r(!1),onFocus:()=>r(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{y(!a)},"aria-expanded":"false","aria-label":w.title,children:s.jsx(t.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-down"}})})]})})};exports.default=O;
|