@telia-ace/knowledge-widget-components-guide-category-dropdown 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 CHANGED
@@ -1,6 +1,6 @@
1
- Copyright © 2021, Telia Company AB. All rights reserved.
2
-
3
- THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
- THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
- AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
1
+ Copyright © 2021, Telia Company AB. All rights reserved.
2
+
3
+ THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
+ THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
+ AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
6
6
  http://www.humany.com/legal
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # `@telia-ace/knowledge-widget-components-guide-category-dropdown`
2
-
3
- Guide category dropdown component for ACE Knowledge Widgets.
1
+ # `@telia-ace/knowledge-widget-components-guide-category-dropdown`
2
+
3
+ Guide category dropdown component for ACE Knowledge Widgets.
@@ -1,16 +1,16 @@
1
- import { MatchFilterProperties } from '@telia-ace/knowledge-widget-component-utilities';
2
- import { Category } from '@telia-ace/knowledge-widget-core';
3
- import { Container } from '@webprovisions/platform';
4
- export declare type GuideCategoryDropdownComponentProps = {
5
- matchFilters?: Partial<MatchFilterProperties>;
6
- rootCategoryHeader: string;
7
- route?: string;
8
- categoryAriaLabel?: string;
9
- activeCategoryAriaLabel?: string;
10
- parent?: Category;
11
- categories?: Category[];
12
- showMatchCount?: boolean;
13
- fallbackOnInitialRoute?: boolean;
14
- };
15
- declare const _default: (container: Container) => Promise<void>;
16
- export default _default;
1
+ import { MatchFilterProperties } from '@telia-ace/knowledge-widget-component-utilities';
2
+ import { Category } from '@telia-ace/knowledge-widget-core';
3
+ import { Container } from '@webprovisions/platform';
4
+ export declare type GuideCategoryDropdownComponentProps = {
5
+ matchFilters?: Partial<MatchFilterProperties>;
6
+ rootCategoryHeader: string;
7
+ route?: string;
8
+ categoryAriaLabel?: string;
9
+ activeCategoryAriaLabel?: string;
10
+ parent?: Category;
11
+ categories?: Category[];
12
+ showMatchCount?: boolean;
13
+ fallbackOnInitialRoute?: boolean;
14
+ };
15
+ declare const _default: (container: Container) => Promise<void>;
16
+ export default _default;
@@ -1,8 +1,8 @@
1
- import { Category } from '@telia-ace/knowledge-widget-core';
2
- import React from 'react';
3
- declare type Props = {
4
- item: Category;
5
- guideCategory: string;
6
- };
7
- declare const GuideCategoryDropdownItem: React.FC<Props>;
8
- export default GuideCategoryDropdownItem;
1
+ import { Category } from '@telia-ace/knowledge-widget-core';
2
+ import React from 'react';
3
+ declare type Props = {
4
+ item: Category;
5
+ guideCategory: string;
6
+ };
7
+ declare const GuideCategoryDropdownItem: React.FC<Props>;
8
+ export default GuideCategoryDropdownItem;
@@ -1,4 +1,4 @@
1
- import { Category } from '@telia-ace/knowledge-widget-core';
2
- import React from 'react';
3
- declare const GuideCategoryDropdownMatchCount: React.FC<Category>;
4
- export default GuideCategoryDropdownMatchCount;
1
+ import { Category } from '@telia-ace/knowledge-widget-core';
2
+ import React from 'react';
3
+ declare const GuideCategoryDropdownMatchCount: React.FC<Category>;
4
+ export default GuideCategoryDropdownMatchCount;
@@ -0,0 +1,287 @@
1
+ var W = Object.defineProperty, H = Object.defineProperties;
2
+ var U = Object.getOwnPropertyDescriptors;
3
+ var b = Object.getOwnPropertySymbols;
4
+ var I = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
5
+ var L = (e, t, a) => t in e ? W(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, i = (e, t) => {
6
+ for (var a in t || (t = {}))
7
+ I.call(t, a) && L(e, a, t[a]);
8
+ if (b)
9
+ for (var a of b(t))
10
+ S.call(t, a) && L(e, a, t[a]);
11
+ return e;
12
+ }, w = (e, t) => H(e, U(t));
13
+ var F = (e, t) => {
14
+ var a = {};
15
+ for (var n in e)
16
+ I.call(e, n) && t.indexOf(n) < 0 && (a[n] = e[n]);
17
+ if (e != null && b)
18
+ for (var n of b(e))
19
+ t.indexOf(n) < 0 && S.call(e, n) && (a[n] = e[n]);
20
+ return a;
21
+ };
22
+ import { loadingOpacity as q, contentBox as J, borderTabStyle as K, Link as Q, linkTabStyle as V, List as X, list as Y, Text as E, useProperties as T, useHover as Z, SymbolBadge as u, useRouteData as _, useContainer as ee, useIsTabbing as te, createEmptyComponent as oe } from "@telia-ace/knowledge-widget-ui";
23
+ import { appendClassNames as D, createParams as ae, formatUrl as ne } from "@telia-ace/widget-utilities";
24
+ import o, { useState as B, useEffect as re } from "react";
25
+ import { initialRouteFallback as le } from "@telia-ace/knowledge-widget-component-utilities";
26
+ import c, { css as $ } from "styled-components";
27
+ const se = c.div`
28
+ ${q}
29
+ ${J}
30
+ overflow: hidden;
31
+ min-height: 50px;
32
+ ${(e) => e["data-toggler-in-focus"] && e.isTabbing && $`
33
+ && {
34
+ ${K}
35
+ }
36
+ `};
37
+ `, ie = c.button`
38
+ background: none;
39
+ border: 0;
40
+ outline: 0;
41
+ display: block;
42
+ cursor: pointer;
43
+ padding: 0;
44
+ font-size: ${(e) => {
45
+ var t;
46
+ return (t = e.theme.fonts) == null ? void 0 : t.normal;
47
+ }};
48
+ text-align: end;
49
+ flex: 1 0 auto;
50
+ svg {
51
+ path,
52
+ line {
53
+ stroke: ${(e) => {
54
+ var t;
55
+ return (t = e.theme.colors) == null ? void 0 : t.text;
56
+ }};
57
+ }
58
+ }
59
+ `, M = $`
60
+ font-size: ${(e) => {
61
+ var t;
62
+ return (t = e.theme.fonts) == null ? void 0 : t.normal;
63
+ }};
64
+ text-align: left;
65
+ text-align: left;
66
+ text-decoration: none;
67
+ font-weight: 300;
68
+ display: flex;
69
+ align-items: center;
70
+ padding: ${(e) => {
71
+ var t;
72
+ return (t = e.theme.sizes) == null ? void 0 : t.small;
73
+ }};
74
+ padding-left: ${(e) => {
75
+ var t;
76
+ return (t = e.theme.sizes) == null ? void 0 : t.large;
77
+ }};
78
+ cursor: pointer;
79
+ overflow: hidden;
80
+ ${(e) => {
81
+ var t, a, n;
82
+ return e.selected ? $`
83
+ border-left: 2px solid ${(t = e.theme.colors) == null ? void 0 : t.primary};
84
+ color: ${(a = e.theme.colors) == null ? void 0 : a.primary};
85
+ ` : $`
86
+ color: ${(n = e.theme.colors) == null ? void 0 : n.text};
87
+ `;
88
+ }};
89
+
90
+ span {
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ }
94
+
95
+ i {
96
+ margin-right: ${(e) => {
97
+ var t;
98
+ return (t = e.theme.sizes) == null ? void 0 : t.normal;
99
+ }};
100
+ font-size: ${(e) => {
101
+ var t;
102
+ return (t = e.theme.fonts) == null ? void 0 : t.medium;
103
+ }};
104
+ min-height: 1em;
105
+ min-width: 1em;
106
+ }
107
+ `, O = c.div`
108
+ ${M}
109
+ `, ce = c(Q)`
110
+ ${M}
111
+ &:focus {
112
+ outline: none;
113
+ }
114
+ &:focus-visible {
115
+ span {
116
+ ${V};
117
+ }
118
+ }
119
+ `, me = c.div`
120
+ display: flex;
121
+ justify-content: space-between;
122
+ padding-right: ${(e) => {
123
+ var t;
124
+ return (t = e.theme.sizes) == null ? void 0 : t.large;
125
+ }};
126
+ min-height: 52px;
127
+ white-space: nowrap;
128
+
129
+ && {
130
+ font-weight: normal;
131
+
132
+ a {
133
+ font-weight: normal;
134
+ }
135
+ }
136
+ ${O} {
137
+ font-weight: normal;
138
+ }
139
+ `, de = c(X)`
140
+ ${Y}
141
+ display: flex;
142
+ justify-content: center;
143
+ flex-direction: column;
144
+ margin-right: ${(e) => {
145
+ var t;
146
+ return (t = e.theme.sizes) == null ? void 0 : t.medium;
147
+ }};
148
+ margin-left: ${(e) => {
149
+ var t;
150
+ return (t = e.theme.sizes) == null ? void 0 : t.large;
151
+ }};
152
+ margin-bottom: 22px;
153
+ border-left: ${(e) => e.theme.border};
154
+ li {
155
+ margin: 0 0 ${(e) => {
156
+ var t;
157
+ return (t = e.theme.sizes) == null ? void 0 : t.normal;
158
+ }} -2px;
159
+ }
160
+ li:last-child {
161
+ margin: 0 0 0 -2px;
162
+ }
163
+ flex-basis: 100%;
164
+ border-width: 2px;
165
+ `, ge = c(E)`
166
+ margin: 0 0 0 ${(e) => {
167
+ var t;
168
+ return (t = e.theme.sizes) == null ? void 0 : t.small;
169
+ }};
170
+ `, s = {
171
+ Wrapper: se,
172
+ Toggler: ie,
173
+ List: de,
174
+ Item: O,
175
+ Link: ce,
176
+ TopItem: me,
177
+ MatchCount: ge
178
+ }, z = ({ matches: e }) => {
179
+ const { showMatchCount: t = !1 } = T();
180
+ return !t || typeof e == "undefined" ? null : /* @__PURE__ */ o.createElement(s.MatchCount, null, "(", e, ")");
181
+ }, ue = ({ item: e, guideCategory: t }) => {
182
+ const {
183
+ route: a = "browse",
184
+ categoryAriaLabel: n = "",
185
+ activeCategoryAriaLabel: x = "",
186
+ fallbackOnInitialRoute: k = !1
187
+ } = T(), [m, l] = Z(), { id: v, title: d, symbol: p, activeSymbol: f } = e, r = t === v;
188
+ return /* @__PURE__ */ o.createElement("li", {
189
+ ref: l
190
+ }, /* @__PURE__ */ o.createElement(s.Link, w(i({}, le(e, a, k, "category")), {
191
+ "aria-pressed": r,
192
+ "aria-label": (r ? x : n).replace(
193
+ "{{category}}",
194
+ d
195
+ ),
196
+ className: "humany-guide-category-dropdown-link",
197
+ "aria-current": r,
198
+ selected: r
199
+ }), (r || m) && f ? /* @__PURE__ */ o.createElement(u, {
200
+ symbol: f
201
+ }) : p && /* @__PURE__ */ o.createElement(u, {
202
+ symbol: p
203
+ }), /* @__PURE__ */ o.createElement(E, null, d), /* @__PURE__ */ o.createElement(z, i({}, e))));
204
+ }, $e = (a) => {
205
+ var n = a, { className: e } = n, t = F(n, ["className"]);
206
+ const x = _(), [k, m] = B(!1), {
207
+ parent: l,
208
+ route: v = "browse",
209
+ categories: d = [],
210
+ loading: p = !1
211
+ } = T(), f = ee(), [r, y] = B(!1), { params: R } = x, G = te(), { guideCategory: C, tag: j, phrase: A, sorting: P } = R;
212
+ if (re(() => {
213
+ r && y(!1);
214
+ }, [C]), p || !l || !d.length)
215
+ return oe(f, w(i({}, t), {
216
+ className: D(e, "humany-guide-category-dropdown")
217
+ }));
218
+ const g = d.find((h) => h.id === C) || l, N = g.activeSymbol || g.symbol;
219
+ return /* @__PURE__ */ o.createElement(s.Wrapper, w(i({}, t), {
220
+ "data-loading": !1,
221
+ "data-toggler-in-focus": k,
222
+ "aria-expanded": r,
223
+ isTabbing: G,
224
+ className: D(e, "humany-guide-category-dropdown")
225
+ }), r ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(s.TopItem, {
226
+ className: "humany-guide-category-dropdown-top-item"
227
+ }, /* @__PURE__ */ o.createElement(s.Link, {
228
+ className: "humany-guide-category-dropdown-link",
229
+ routeName: v,
230
+ params: ae({
231
+ tag: j,
232
+ phrase: A,
233
+ sorting: P,
234
+ guideCategory: l.id,
235
+ uriName: ne(l.title)
236
+ }),
237
+ selected: !1
238
+ }, l.symbol ? /* @__PURE__ */ o.createElement(u, {
239
+ symbol: l.symbol
240
+ }) : null, /* @__PURE__ */ o.createElement(E, null, l.title), /* @__PURE__ */ o.createElement(z, i({}, l))), /* @__PURE__ */ o.createElement(s.Toggler, {
241
+ onBlur: () => m(!1),
242
+ onFocus: () => m(!0),
243
+ className: "humany-guide-category-dropdown-toggler",
244
+ onClick: () => {
245
+ y(!r);
246
+ },
247
+ "aria-expanded": "true",
248
+ "aria-label": g.title
249
+ }, /* @__PURE__ */ o.createElement(u, {
250
+ size: 18,
251
+ symbol: { type: "Svg", content: "caret-up" }
252
+ }))), /* @__PURE__ */ o.createElement(s.List, {
253
+ className: "humany-guide-category-dropdown-open",
254
+ items: d,
255
+ renderItem: (h) => /* @__PURE__ */ o.createElement(ue, {
256
+ key: h.id,
257
+ item: h,
258
+ guideCategory: C
259
+ })
260
+ })) : /* @__PURE__ */ o.createElement(s.TopItem, {
261
+ className: "humany-guide-category-dropdown-top-item"
262
+ }, /* @__PURE__ */ o.createElement(s.Item, {
263
+ className: "humany-guide-category-dropdown-item",
264
+ onClick: () => {
265
+ y(!r);
266
+ },
267
+ selected: !1
268
+ }, N ? /* @__PURE__ */ o.createElement(u, {
269
+ symbol: N
270
+ }) : null, /* @__PURE__ */ o.createElement(E, null, g.title), /* @__PURE__ */ o.createElement(z, i({}, g))), /* @__PURE__ */ o.createElement(s.Toggler, {
271
+ onBlur: () => m(!1),
272
+ onFocus: () => m(!0),
273
+ className: "humany-guide-category-dropdown-toggler",
274
+ onClick: () => {
275
+ y(!r);
276
+ },
277
+ "aria-expanded": "false",
278
+ "aria-label": g.title
279
+ }, /* @__PURE__ */ o.createElement(u, {
280
+ size: 18,
281
+ symbol: { type: "Svg", content: "caret-down" }
282
+ }))));
283
+ };
284
+ export {
285
+ $e as default
286
+ };
287
+ //# sourceMappingURL=guide-category-dropdown.a0feefa0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guide-category-dropdown.a0feefa0.js","sources":["../src/guide-category-dropdown.styles.ts","../src/guide-category-dropdown-match-count.tsx","../src/guide-category-dropdown-item.tsx","../src/guide-category-dropdown.tsx"],"sourcesContent":["import {\r\n borderTabStyle,\r\n contentBox,\r\n Link as BaseLink,\r\n linkTabStyle,\r\n List as BaseList,\r\n list,\r\n loadingOpacity,\r\n Text,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport styled, { css } from 'styled-components';\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst Wrapper: any = styled.div<any>`\r\n ${loadingOpacity}\r\n ${contentBox}\r\n overflow: hidden;\r\n min-height: 50px;\r\n ${(p) =>\r\n p['data-toggler-in-focus'] &&\r\n p.isTabbing &&\r\n css`\r\n && {\r\n ${borderTabStyle}\r\n }\r\n `};\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst Toggler: any = styled.button`\r\n background: none;\r\n border: 0;\r\n outline: 0;\r\n display: block;\r\n cursor: pointer;\r\n padding: 0;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n text-align: end;\r\n flex: 1 0 auto;\r\n svg {\r\n path,\r\n line {\r\n stroke: ${(p) => p.theme.colors?.text};\r\n }\r\n }\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst styling = css<{ selected: boolean }>`\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n text-align: left;\r\n text-align: left;\r\n text-decoration: none;\r\n font-weight: 300;\r\n display: flex;\r\n align-items: center;\r\n padding: ${(p) => p.theme.sizes?.small};\r\n padding-left: ${(p) => p.theme.sizes?.large};\r\n cursor: pointer;\r\n overflow: hidden;\r\n ${(p) =>\r\n p.selected\r\n ? css`\r\n border-left: 2px solid ${p.theme.colors?.primary};\r\n color: ${p.theme.colors?.primary};\r\n `\r\n : css`\r\n color: ${p.theme.colors?.text};\r\n `};\r\n\r\n span {\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n\r\n i {\r\n margin-right: ${(p) => p.theme.sizes?.normal};\r\n font-size: ${(p) => p.theme.fonts?.medium};\r\n min-height: 1em;\r\n min-width: 1em;\r\n }\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst Item: any = styled.div`\r\n ${styling}\r\n`;\r\n\r\nconst Link: any = styled(BaseLink)<any>`\r\n ${styling}\r\n &:focus {\r\n outline: none;\r\n }\r\n &:focus-visible {\r\n span {\r\n ${linkTabStyle};\r\n }\r\n }\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst TopItem: any = styled.div`\r\n display: flex;\r\n justify-content: space-between;\r\n padding-right: ${(p) => p.theme.sizes?.large};\r\n min-height: 52px;\r\n white-space: nowrap;\r\n\r\n && {\r\n font-weight: normal;\r\n\r\n a {\r\n font-weight: normal;\r\n }\r\n }\r\n ${Item} {\r\n font-weight: normal;\r\n }\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst List: any = styled(BaseList)<any>`\r\n ${list}\r\n display: flex;\r\n justify-content: center;\r\n flex-direction: column;\r\n margin-right: ${(p) => p.theme.sizes?.medium};\r\n margin-left: ${(p) => p.theme.sizes?.large};\r\n margin-bottom: 22px;\r\n border-left: ${(p) => p.theme.border};\r\n li {\r\n margin: 0 0 ${(p) => p.theme.sizes?.normal} -2px;\r\n }\r\n li:last-child {\r\n margin: 0 0 0 -2px;\r\n }\r\n flex-basis: 100%;\r\n border-width: 2px;\r\n`;\r\n\r\n// FUTURE TODO: Look into the typescript error when removing \": any\".\r\nconst MatchCount: any = styled(Text)`\r\n margin: 0 0 0 ${(p) => p.theme.sizes?.small};\r\n`;\r\n\r\nexport default {\r\n Wrapper,\r\n Toggler,\r\n List,\r\n Item,\r\n Link,\r\n TopItem,\r\n MatchCount,\r\n};\r\n","import { Category } from '@telia-ace/knowledge-widget-core';\r\nimport { useProperties } from '@telia-ace/knowledge-widget-ui';\r\nimport React from 'react';\r\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\r\nimport Styled from './guide-category-dropdown.styles';\r\n\r\nconst GuideCategoryDropdownMatchCount: React.FC<Category> = ({ matches }) => {\r\n const { showMatchCount = false } = useProperties<GuideCategoryDropdownComponentProps>();\r\n\r\n if (!showMatchCount || typeof matches === 'undefined') {\r\n return null;\r\n }\r\n\r\n return <Styled.MatchCount>({matches})</Styled.MatchCount>;\r\n};\r\n\r\nexport default GuideCategoryDropdownMatchCount;\r\n","import { initialRouteFallback } from '@telia-ace/knowledge-widget-component-utilities';\r\nimport { Category } from '@telia-ace/knowledge-widget-core';\r\nimport { SymbolBadge, Text, useHover, useProperties } from '@telia-ace/knowledge-widget-ui';\r\nimport React from 'react';\r\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\r\nimport GuideCategoryDropdownMatchCount from './guide-category-dropdown-match-count';\r\nimport Styled from './guide-category-dropdown.styles';\r\n\r\ntype Props = {\r\n item: Category;\r\n guideCategory: string;\r\n};\r\n\r\nconst GuideCategoryDropdownItem: React.FC<Props> = ({ item, guideCategory }) => {\r\n const {\r\n route = 'browse',\r\n categoryAriaLabel = '',\r\n activeCategoryAriaLabel = '',\r\n fallbackOnInitialRoute = false,\r\n } = useProperties<GuideCategoryDropdownComponentProps>();\r\n const [hovering, elem] = useHover();\r\n const { id, title, symbol, activeSymbol } = item;\r\n\r\n const selected = guideCategory === id;\r\n return (\r\n <li ref={elem as any}>\r\n <Styled.Link\r\n {...initialRouteFallback(item, route, fallbackOnInitialRoute, 'category')}\r\n aria-pressed={selected}\r\n aria-label={(selected ? activeCategoryAriaLabel : categoryAriaLabel).replace(\r\n '{{category}}',\r\n title\r\n )}\r\n className=\"humany-guide-category-dropdown-link\"\r\n aria-current={selected}\r\n selected={selected}\r\n >\r\n {(selected || hovering) && activeSymbol ? (\r\n <SymbolBadge symbol={activeSymbol} />\r\n ) : (\r\n symbol && <SymbolBadge symbol={symbol} />\r\n )}\r\n <Text>{title}</Text>\r\n <GuideCategoryDropdownMatchCount {...item} />\r\n </Styled.Link>\r\n </li>\r\n );\r\n};\r\n\r\nexport default GuideCategoryDropdownItem;\r\n","import { Category } from '@telia-ace/knowledge-widget-core';\r\nimport {\r\n createEmptyComponent,\r\n SymbolBadge,\r\n Text,\r\n useContainer,\r\n useIsTabbing,\r\n useProperties,\r\n useRouteData,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames, createParams, formatUrl } from '@telia-ace/widget-utilities';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\r\nimport GuideCategoryDropdownItem from './guide-category-dropdown-item';\r\nimport GuideCategoryDropdownMatchCount from './guide-category-dropdown-match-count';\r\nimport Styled from './guide-category-dropdown.styles';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst GuideCategoryDropdown: React.SFC<Props> = ({ className, ...other }) => {\r\n const routeData = useRouteData();\r\n const [togglerFocus, setTogglerFocus] = useState(false);\r\n const {\r\n parent,\r\n route = 'browse',\r\n categories = [],\r\n loading = false,\r\n } = useProperties<GuideCategoryDropdownComponentProps>();\r\n const container = useContainer();\r\n const [isOpen, setIsOpen] = useState(false);\r\n const { params } = routeData;\r\n const isTabbing = useIsTabbing();\r\n const { guideCategory, tag, phrase, sorting } = params;\r\n\r\n useEffect(() => {\r\n if (isOpen) {\r\n setIsOpen(false);\r\n }\r\n }, [guideCategory]);\r\n\r\n if (loading || !parent || !categories.length) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-guide-category-dropdown'),\r\n });\r\n }\r\n\r\n const selected = categories.find((category) => category.id === guideCategory) || parent;\r\n const selectedSymbol = selected.activeSymbol || selected.symbol;\r\n\r\n return (\r\n <Styled.Wrapper\r\n {...other}\r\n data-loading={false}\r\n data-toggler-in-focus={togglerFocus}\r\n aria-expanded={isOpen}\r\n isTabbing={isTabbing}\r\n className={appendClassNames(className, 'humany-guide-category-dropdown')}\r\n >\r\n {isOpen ? (\r\n <>\r\n <Styled.TopItem className=\"humany-guide-category-dropdown-top-item\">\r\n <Styled.Link\r\n className=\"humany-guide-category-dropdown-link\"\r\n routeName={route}\r\n params={createParams({\r\n tag,\r\n phrase,\r\n sorting,\r\n guideCategory: parent.id,\r\n uriName: formatUrl(parent.title),\r\n })}\r\n selected={false}\r\n >\r\n {parent.symbol ? <SymbolBadge symbol={parent.symbol} /> : null}\r\n <Text>{parent.title}</Text>\r\n <GuideCategoryDropdownMatchCount {...parent} />\r\n </Styled.Link>\r\n <Styled.Toggler\r\n onBlur={() => setTogglerFocus(false)}\r\n onFocus={() => setTogglerFocus(true)}\r\n className=\"humany-guide-category-dropdown-toggler\"\r\n onClick={() => {\r\n setIsOpen(!isOpen);\r\n }}\r\n aria-expanded=\"true\"\r\n aria-label={selected.title}\r\n >\r\n <SymbolBadge size={18} symbol={{ type: 'Svg', content: 'caret-up' }} />\r\n </Styled.Toggler>\r\n </Styled.TopItem>\r\n <Styled.List\r\n className=\"humany-guide-category-dropdown-open\"\r\n items={categories}\r\n renderItem={(item: Category) => (\r\n <GuideCategoryDropdownItem\r\n key={item.id}\r\n item={item}\r\n guideCategory={guideCategory}\r\n />\r\n )}\r\n />\r\n </>\r\n ) : (\r\n <Styled.TopItem className=\"humany-guide-category-dropdown-top-item\">\r\n <Styled.Item\r\n className=\"humany-guide-category-dropdown-item\"\r\n onClick={() => {\r\n setIsOpen(!isOpen);\r\n }}\r\n selected={false}\r\n >\r\n {selectedSymbol ? <SymbolBadge symbol={selectedSymbol} /> : null}\r\n <Text>{selected.title}</Text>\r\n <GuideCategoryDropdownMatchCount {...selected} />\r\n </Styled.Item>\r\n <Styled.Toggler\r\n onBlur={() => setTogglerFocus(false)}\r\n onFocus={() => setTogglerFocus(true)}\r\n className=\"humany-guide-category-dropdown-toggler\"\r\n onClick={() => {\r\n setIsOpen(!isOpen);\r\n }}\r\n aria-expanded=\"false\"\r\n aria-label={selected.title}\r\n >\r\n <SymbolBadge size={18} symbol={{ type: 'Svg', content: 'caret-down' }} />\r\n </Styled.Toggler>\r\n </Styled.TopItem>\r\n )}\r\n </Styled.Wrapper>\r\n );\r\n};\r\n\r\nexport default GuideCategoryDropdown;\r\n"],"names":["Wrapper","styled","loadingOpacity","contentBox","p","css","borderTabStyle","Toggler","_a","styling","_b","_c","Item","Link","BaseLink","linkTabStyle","TopItem","List","BaseList","list","MatchCount","Text","Styled","GuideCategoryDropdownMatchCount","matches","showMatchCount","useProperties","GuideCategoryDropdownItem","item","guideCategory","route","categoryAriaLabel","activeCategoryAriaLabel","fallbackOnInitialRoute","hovering","elem","useHover","id","title","symbol","activeSymbol","selected","React","__spreadProps","__spreadValues","initialRouteFallback","SymbolBadge","GuideCategoryDropdown","className","other","__objRest","routeData","useRouteData","togglerFocus","setTogglerFocus","useState","parent","categories","loading","container","useContainer","isOpen","setIsOpen","params","isTabbing","useIsTabbing","tag","phrase","sorting","useEffect","createEmptyComponent","appendClassNames","category","selectedSymbol","createParams","formatUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,KAAeC,EAAO;AAAA,MACtBC;AAAA,MACAC;AAAA;AAAA;AAAA,MAGA,CAACC,MACCA,EAAE,4BACFA,EAAE,aACFC;AAAA;AAAA,kBAEUC;AAAA;AAAA;AAAA,GAMZC,KAAeN,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAOX,CAACG,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MAAM,UAAR,gBAAAI,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMjB,CAACJ,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MAAM,WAAR,gBAAAI,EAAgB;AAAA;AAAA;AAAA;AAAA,GAMvCC,IAAUJ;AAAA,iBACC,CAACD,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MAAM,UAAR,gBAAAI,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOxB,CAACJ,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MAAM,UAAR,gBAAAI,EAAe;AAAA;AAAA,oBACjB,CAACJ,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MAAM,UAAR,gBAAAI,EAAe;AAAA;AAAA;AAAA;AAAA,MAGpC,CAACJ,MACC;;AAAA,SAAAA,EAAE,WACIC;AAAA,4CAC6BG,IAAAJ,EAAE,MAAM,WAAR,gBAAAI,EAAgB;AAAA,4BAChCE,IAAAN,EAAE,MAAM,WAAR,gBAAAM,EAAgB;AAAA,kBAE7BL;AAAA,4BACaM,IAAAP,EAAE,MAAM,WAAR,gBAAAO,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASnB,CAACP,MAAM;;AAAA,UAAAI,IAAAJ,EAAE,MA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AAAA,EAAgB,CAAA,IAAK,MAC5D,gBAAA/B,EAAA,cAACrB,SAAMoB,EAAS,KAAM,GACrB,gBAAAC,EAAA,cAAAnB,GAAAqB,EAAA,IAAoCH,EAAU,CACnD,GACC,gBAAAC,EAAA,cAAApB,EAAO,SAAP;AAAA,IACG,QAAQ,MAAMgC,EAAgB,EAAK;AAAA,IACnC,SAAS,MAAMA,EAAgB,EAAI;AAAA,IACnC,WAAU;AAAA,IACV,SAAS,MAAM;AACX,MAAAQ,EAAU,CAACD,CAAM;AAAA,IACrB;AAAA,IACA,iBAAc;AAAA,IACd,cAAYpB,EAAS;AAAA,EAAA,GAEpB,gBAAAC,EAAA,cAAAI,GAAA;AAAA,IAAY,MAAM;AAAA,IAAI,QAAQ,EAAE,MAAM,OAAO,SAAS,aAAa;AAAA,EAAA,CAAG,CAC3E,CACJ,CAER;AAER;"}
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- declare type Props = {
3
- className: string;
4
- };
5
- declare const GuideCategoryDropdown: React.SFC<Props>;
6
- export default GuideCategoryDropdown;
1
+ import React from 'react';
2
+ declare type Props = {
3
+ className: string;
4
+ };
5
+ declare const GuideCategoryDropdown: React.SFC<Props>;
6
+ export default GuideCategoryDropdown;
@@ -1,10 +1,10 @@
1
- declare const _default: {
2
- Wrapper: any;
3
- Toggler: any;
4
- List: any;
5
- Item: any;
6
- Link: any;
7
- TopItem: any;
8
- MatchCount: any;
9
- };
10
- export default _default;
1
+ declare const _default: {
2
+ Wrapper: any;
3
+ Toggler: any;
4
+ List: any;
5
+ Item: any;
6
+ Link: any;
7
+ TopItem: any;
8
+ MatchCount: any;
9
+ };
10
+ export default _default;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import GuideCategoryDropdownComponent from './guide-category-dropdown-component';
2
- export default GuideCategoryDropdownComponent;
1
+ import GuideCategoryDropdownComponent from './guide-category-dropdown-component';
2
+ export default GuideCategoryDropdownComponent;
package/dist/index.js CHANGED
@@ -14,25 +14,30 @@ const P = (e, n, a) => !a || a.length < 1 ? n : h(e, n, null, a), h = (e, n, a,
14
14
  }
15
15
  }, D = (e) => e.matches && e.matches > 0, E = (e) => {
16
16
  const { events: n } = e.get("$widget"), [a, o] = b(n);
17
- return C(e, "guide-category-dropdown", import("./guide-category-dropdown.e32ae53a.js"), (i) => {
18
- const s = (t) => {
19
- i.writeProperties({ loading: !0 }), i.actions.dispatch("fetch", { params: t }).then(() => {
20
- i.writeProperties({ loading: !1 });
21
- });
22
- };
23
- i.actions.create("fetch", ({ parent: t, categories: r }) => {
24
- i.writeProperties({
25
- parent: t,
26
- categories: r,
27
- loading: !1
17
+ return C(
18
+ e,
19
+ "guide-category-dropdown",
20
+ import("./guide-category-dropdown.a0feefa0.js"),
21
+ (i) => {
22
+ const s = (t) => {
23
+ i.writeProperties({ loading: !0 }), i.actions.dispatch("fetch", { params: t }).then(() => {
24
+ i.writeProperties({ loading: !1 });
25
+ });
26
+ };
27
+ i.actions.create("fetch", ({ parent: t, categories: r }) => {
28
+ i.writeProperties({
29
+ parent: t,
30
+ categories: r,
31
+ loading: !1
32
+ });
33
+ }), e.getAsync("router").then((t) => {
34
+ const { params: r } = t.getRouteData();
35
+ s(r);
36
+ }), a("router:changed", (t, { current: r }) => {
37
+ s(r.routeData.params);
28
38
  });
29
- }), e.getAsync("router").then((t) => {
30
- const { params: r } = t.getRouteData();
31
- s(r);
32
- }), a("router:changed", (t, { current: r }) => {
33
- s(r.routeData.params);
34
- });
35
- }).then(() => v(e, "guide-category-dropdown", (i) => {
39
+ }
40
+ ).then(() => v(e, "guide-category-dropdown", (i) => {
36
41
  i.actions.watch("guide-category-dropdown.fetch", (s, t) => {
37
42
  const {
38
43
  matchFilters: r = {
@@ -48,12 +53,16 @@ const P = (e, n, a) => !a || a.length < 1 ? n : h(e, n, null, a), h = (e, n, a,
48
53
  tagId: r.tag ? p : void 0
49
54
  }).then(({ categories: c, matches: w }) => {
50
55
  var f;
51
- const d = P(c, {
52
- matches: w,
53
- id: "0",
54
- title: u,
55
- items: c
56
- }, g);
56
+ const d = P(
57
+ c,
58
+ {
59
+ matches: w,
60
+ id: "0",
61
+ title: u,
62
+ items: c
63
+ },
64
+ g
65
+ );
57
66
  return t({
58
67
  parent: d,
59
68
  categories: (f = d == null ? void 0 : d.items) == null ? void 0 : f.filter(D)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/guide-category-dropdown-component.ts"],"sourcesContent":["import { MatchFilterProperties } from '@telia-ace/knowledge-widget-component-utilities';\nimport { Category, createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\nimport { CategoriesResult, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\nimport { Container } from '@webprovisions/platform';\n\nconst findParentAndSiblings = (\n categories: Category[],\n root: Category,\n currentCategoryId: string\n): Category | undefined => {\n if (!currentCategoryId || currentCategoryId.length < 1) {\n return root;\n }\n return findRecursive(categories, root, null, currentCategoryId);\n};\n\nconst findRecursive = (\n categories: Category[],\n root: Category,\n previous: Category | null,\n currentCategoryId: string\n): Category | undefined => {\n const filtered = categories.find((c) => c.id === currentCategoryId);\n if (filtered || !currentCategoryId) {\n if (!previous) {\n return root;\n }\n return previous;\n }\n\n for (let i = 0; i < categories.length; i += 1) {\n const cat = categories[i];\n if (cat.items) {\n const result = findRecursive(cat.items, root, cat, currentCategoryId);\n if (result) {\n return result;\n }\n }\n }\n};\n\nconst filterEmptyCategories = (category: Category) => category.matches && category.matches > 0;\n\nexport type GuideCategoryDropdownComponentProps = {\n matchFilters?: Partial<MatchFilterProperties>;\n rootCategoryHeader: string;\n route?: string;\n categoryAriaLabel?: string;\n activeCategoryAriaLabel?: string;\n parent?: Category; // internal\n categories?: Category[]; // internal\n showMatchCount?: boolean;\n fallbackOnInitialRoute?: boolean;\n};\n\nexport default (container: Container) => {\n const { events } = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n return createReactComponent(\n container,\n 'guide-category-dropdown',\n import('./guide-category-dropdown'),\n (component) => {\n const fetch = (params: { [key: string]: any }) => {\n component.writeProperties({ loading: true });\n component.actions.dispatch('fetch', { params }).then(() => {\n component.writeProperties({ loading: false });\n });\n };\n\n component.actions.create('fetch', ({ parent, categories }) => {\n component.writeProperties({\n parent,\n categories,\n loading: false,\n });\n });\n\n container.getAsync('router').then((router) => {\n const { params } = router.getRouteData();\n fetch(params);\n });\n\n subscribe('router:changed', (event: any, { current }: any) => {\n fetch(current.routeData.params);\n });\n }\n )\n .then(() => {\n return extendComponent(container, 'guide-category-dropdown', (component) => {\n component.actions.watch('guide-category-dropdown.fetch', (input, next) => {\n const {\n matchFilters = {\n search: false,\n tag: false,\n },\n rootCategoryHeader,\n } = component.properties<GuideCategoryDropdownComponentProps>();\n const {\n params: { phrase, guideCategory, tag },\n } = input;\n return container.getAsync('dataClient').then((dataClient) => {\n return dataClient\n .fetch(DataType.GuideCategories, {\n searchPhrase: matchFilters.search ? phrase : undefined,\n tagId: matchFilters.tag ? tag : undefined,\n })\n .then(({ categories, matches }: CategoriesResult) => {\n const parent = findParentAndSiblings(\n categories,\n {\n matches,\n id: '0',\n title: rootCategoryHeader,\n items: categories,\n },\n guideCategory\n );\n\n return next({\n parent,\n categories: parent?.items?.filter(filterEmptyCategories),\n });\n });\n });\n });\n });\n })\n .then(() => {\n unsubscribe();\n });\n};\n"],"names":[],"mappings":";;;AAMA,MAAM,IAAwB,CAC1B,GACA,GACA,MAEI,CAAC,KAAqB,EAAkB,SAAS,IAC1C,IAEJ,EAAc,GAAY,GAAM,MAAM,CAAiB,GAG5D,IAAgB,CAClB,GACA,GACA,GACA,MACuB;AAEnB,MAAA,AADa,EAAW,KAAK,CAAC,MAAM,EAAE,OAAO,CAAiB,KAClD,CAAC;AACb,WAAK,KACM;AAKf,WAAS,IAAI,GAAG,IAAI,EAAW,QAAQ,KAAK,GAAG;AAC3C,UAAM,IAAM,EAAW;AACvB,Q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EAAE,KAAK,CAAC,MACnC,EACF,MAAM,EAAS,iBAAiB;AAAA,QAC7B,cAAc,EAAa,SAAS,IAAS;AAAA,QAC7C,OAAO,EAAa,MAAM,IAAM;AAAA,MACnC,CAAA,EACA,KAAK,CAAC,EAAE,eAAY,iBAAgC;;AAC3C,cAAA,IAAS,EACX,GACA;AAAA,UACI;AAAA,UACA,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,OAAO;AAAA,WAEX,CACJ;AAEA,eAAO,EAAK;AAAA,UACR;AAAA,UACA,YAAY,4BAAQ,UAAR,kBAAe,OAAO;AAAA,QAAqB,CAC1D;AAAA,MAAA,CACJ,CACR;AAAA,IAAA,CACJ;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI;EAAA,CACf;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../src/guide-category-dropdown-component.ts"],"sourcesContent":["import { MatchFilterProperties } from '@telia-ace/knowledge-widget-component-utilities';\r\nimport { Category, createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\r\nimport { CategoriesResult, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nconst findParentAndSiblings = (\r\n categories: Category[],\r\n root: Category,\r\n currentCategoryId: string\r\n): Category | undefined => {\r\n if (!currentCategoryId || currentCategoryId.length < 1) {\r\n return root;\r\n }\r\n return findRecursive(categories, root, null, currentCategoryId);\r\n};\r\n\r\nconst findRecursive = (\r\n categories: Category[],\r\n root: Category,\r\n previous: Category | null,\r\n currentCategoryId: string\r\n): Category | undefined => {\r\n const filtered = categories.find((c) => c.id === currentCategoryId);\r\n if (filtered || !currentCategoryId) {\r\n if (!previous) {\r\n return root;\r\n }\r\n return previous;\r\n }\r\n\r\n for (let i = 0; i < categories.length; i += 1) {\r\n const cat = categories[i];\r\n if (cat.items) {\r\n const result = findRecursive(cat.items, root, cat, currentCategoryId);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n};\r\n\r\nconst filterEmptyCategories = (category: Category) => category.matches && category.matches > 0;\r\n\r\nexport type GuideCategoryDropdownComponentProps = {\r\n matchFilters?: Partial<MatchFilterProperties>;\r\n rootCategoryHeader: string;\r\n route?: string;\r\n categoryAriaLabel?: string;\r\n activeCategoryAriaLabel?: string;\r\n parent?: Category; // internal\r\n categories?: Category[]; // internal\r\n showMatchCount?: boolean;\r\n fallbackOnInitialRoute?: boolean;\r\n};\r\n\r\nexport default (container: Container) => {\r\n const { events } = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n return createReactComponent(\r\n container,\r\n 'guide-category-dropdown',\r\n import('./guide-category-dropdown'),\r\n (component) => {\r\n const fetch = (params: { [key: string]: any }) => {\r\n component.writeProperties({ loading: true });\r\n component.actions.dispatch('fetch', { params }).then(() => {\r\n component.writeProperties({ loading: false });\r\n });\r\n };\r\n\r\n component.actions.create('fetch', ({ parent, categories }) => {\r\n component.writeProperties({\r\n parent,\r\n categories,\r\n loading: false,\r\n });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n\r\n subscribe('router:changed', (event: any, { current }: any) => {\r\n fetch(current.routeData.params);\r\n });\r\n }\r\n )\r\n .then(() => {\r\n return extendComponent(container, 'guide-category-dropdown', (component) => {\r\n component.actions.watch('guide-category-dropdown.fetch', (input, next) => {\r\n const {\r\n matchFilters = {\r\n search: false,\r\n tag: false,\r\n },\r\n rootCategoryHeader,\r\n } = component.properties<GuideCategoryDropdownComponentProps>();\r\n const {\r\n params: { phrase, guideCategory, tag },\r\n } = input;\r\n return container.getAsync('dataClient').then((dataClient) => {\r\n return dataClient\r\n .fetch(DataType.GuideCategories, {\r\n searchPhrase: matchFilters.search ? phrase : undefined,\r\n tagId: matchFilters.tag ? tag : undefined,\r\n })\r\n .then(({ categories, matches }: CategoriesResult) => {\r\n const parent = findParentAndSiblings(\r\n categories,\r\n {\r\n matches,\r\n id: '0',\r\n title: rootCategoryHeader,\r\n items: categories,\r\n },\r\n guideCategory\r\n );\r\n\r\n return next({\r\n parent,\r\n categories: parent?.items?.filter(filterEmptyCategories),\r\n });\r\n });\r\n });\r\n });\r\n });\r\n })\r\n .then(() => {\r\n unsubscribe();\r\n });\r\n};\r\n"],"names":["findParentAndSiblings","categories","root","currentCategoryId","findRecursive","previous","c","i","cat","result","filterEmptyCategories","category","GuideCategoryDropdownComponent","container","events","subscribe","unsubscribe","createEventSubscriber","createReactComponent","component","fetch","params","parent","router","event","current","extendComponent","input","next","matchFilters","rootCategoryHeader","phrase","guideCategory","tag","dataClient","DataType","matches","_a"],"mappings":";;;AAMA,MAAMA,IAAwB,CAC1BC,GACAC,GACAC,MAEI,CAACA,KAAqBA,EAAkB,SAAS,IAC1CD,IAEJE,EAAcH,GAAYC,GAAM,MAAMC,CAAiB,GAG5DC,IAAgB,CAClBH,GACAC,GACAG,GACAF,MACuB;AAEnB,MADaF,EAAW,KAAK,CAACK,MAAMA,EAAE,OAAOH,CAAiB,KAClD,CAACA;AACb,WAAKE,KACMH;AAKf,WAASK,IAAI,GAAGA,IAAIN,EAAW,QAAQM,KAAK,GAAG;AAC3C,UAAMC,IAAMP,EAAWM;AACvB,QAAIC,EAAI,OAAO;AACX,YAAMC,IAASL,EAAcI,EAAI,OAAON,GAAMM,GAAKL,CAAiB;AACpE,UAAIM;AACO,eAAAA;AAAA,IAEf;AAAA,EACJ;AACJ,GAEMC,IAAwB,CAACC,MAAuBA,EAAS,WAAWA,EAAS,UAAU,GAc9EC,IAAA,CAACC,MAAyB;AACrC,QAAM,EAAE,QAAAC,EAAW,IAAAD,EAAU,IAAI,SAAS,GACpC,CAACE,GAAWC,CAAW,IAAIC,EAAsBH,CAAM;AAEtD,SAAAI;AAAA,IACHL;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,CAACM,MAAc;AACL,YAAAC,IAAQ,CAACC,MAAmC;AAC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Y,SAAAmC,QAAgC;;AACjD,cAAMd,IAAStB;AAAA,UACXC;AAAA,UACA;AAAA,YACI,SAAAmC;AAAA,YACA,IAAI;AAAA,YACJ,OAAON;AAAA,YACP,OAAO7B;AAAA,UACX;AAAA,UACA+B;AAAA,QAAA;AAGJ,eAAOJ,EAAK;AAAA,UACR,QAAAN;AAAA,UACA,aAAYe,IAAAf,KAAA,gBAAAA,EAAQ,UAAR,gBAAAe,EAAe,OAAO3B;AAAA,QAAqB,CAC1D;AAAA,MAAA,CACJ,CACR;AAAA,IAAA,CACJ;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI,IAAAM;EAAA,CACf;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-guide-category-dropdown",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Guide category dropdown component for ACE Knowledge Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -8,6 +8,7 @@
8
8
  "telia"
9
9
  ],
10
10
  "main": "dist/index.js",
11
+ "sourceMain": "src/index.ts",
11
12
  "type": "module",
12
13
  "types": "dist/index.d.ts",
13
14
  "files": [
@@ -25,11 +26,11 @@
25
26
  },
26
27
  "sideEffects": false,
27
28
  "dependencies": {
28
- "@telia-ace/knowledge-widget-component-utilities": "^1.0.21",
29
- "@telia-ace/knowledge-widget-core": "^1.0.17",
30
- "@telia-ace/knowledge-widget-types-grid": "^1.0.28",
31
- "@telia-ace/knowledge-widget-ui": "^1.0.23",
32
- "@telia-ace/widget-utilities": "^1.0.2",
29
+ "@telia-ace/knowledge-widget-component-utilities": "^1.0.23",
30
+ "@telia-ace/knowledge-widget-core": "^1.0.19",
31
+ "@telia-ace/knowledge-widget-types-grid": "^1.0.30",
32
+ "@telia-ace/knowledge-widget-ui": "^1.0.25",
33
+ "@telia-ace/widget-utilities": "^1.0.4",
33
34
  "@webprovisions/platform": "^1.1.2"
34
35
  },
35
36
  "peerDependencies": {
@@ -42,5 +43,5 @@
42
43
  "@types/react-dom": "^16.8.0",
43
44
  "@types/styled-components": "^5.1.7"
44
45
  },
45
- "gitHead": "038c3d0914f7298d2bb74a80c7a679c7450633f9"
46
+ "gitHead": "db190a67f912245c4145c037972fac2039bda698"
46
47
  }
@@ -1,287 +0,0 @@
1
- var P = Object.defineProperty, W = Object.defineProperties;
2
- var H = Object.getOwnPropertyDescriptors;
3
- var b = Object.getOwnPropertySymbols;
4
- var S = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
5
- var L = (t, e, a) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a, s = (t, e) => {
6
- for (var a in e || (e = {}))
7
- S.call(e, a) && L(t, a, e[a]);
8
- if (b)
9
- for (var a of b(e))
10
- I.call(e, a) && L(t, a, e[a]);
11
- return t;
12
- }, w = (t, e) => W(t, H(e));
13
- var F = (t, e) => {
14
- var a = {};
15
- for (var n in t)
16
- S.call(t, n) && e.indexOf(n) < 0 && (a[n] = t[n]);
17
- if (t != null && b)
18
- for (var n of b(t))
19
- e.indexOf(n) < 0 && I.call(t, n) && (a[n] = t[n]);
20
- return a;
21
- };
22
- import { loadingOpacity as U, contentBox as q, borderTabStyle as J, Link as K, linkTabStyle as Q, List as V, list as X, Text as E, useProperties as N, useHover as Y, SymbolBadge as u, useRouteData as Z, useContainer as _, createEmptyComponent as ee } from "@telia-ace/knowledge-widget-ui";
23
- import { appendClassNames as D, createParams as te, formatUrl as oe } from "@telia-ace/widget-utilities";
24
- import o, { useState as B, useEffect as ae } from "react";
25
- import { initialRouteFallback as ne } from "@telia-ace/knowledge-widget-component-utilities";
26
- import c, { css as $ } from "styled-components";
27
- const re = c.div`
28
- ${U}
29
- ${q}
30
- overflow: hidden;
31
- min-height: 50px;
32
- ${(t) => {
33
- var e;
34
- return t["data-toggler-in-focus"] && ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && $`
35
- && {
36
- ${J}
37
- }
38
- `;
39
- }};
40
- `, le = c.button`
41
- background: none;
42
- border: 0;
43
- outline: 0;
44
- display: block;
45
- cursor: pointer;
46
- padding: 0;
47
- font-size: ${(t) => {
48
- var e;
49
- return (e = t.theme.fonts) == null ? void 0 : e.normal;
50
- }};
51
- text-align: end;
52
- flex: 1 0 auto;
53
- svg {
54
- path,
55
- line {
56
- stroke: ${(t) => {
57
- var e;
58
- return (e = t.theme.colors) == null ? void 0 : e.text;
59
- }};
60
- }
61
- }
62
- `, M = $`
63
- font-size: ${(t) => {
64
- var e;
65
- return (e = t.theme.fonts) == null ? void 0 : e.normal;
66
- }};
67
- text-align: left;
68
- text-align: left;
69
- text-decoration: none;
70
- font-weight: 300;
71
- display: flex;
72
- align-items: center;
73
- padding: ${(t) => {
74
- var e;
75
- return (e = t.theme.sizes) == null ? void 0 : e.small;
76
- }};
77
- padding-left: ${(t) => {
78
- var e;
79
- return (e = t.theme.sizes) == null ? void 0 : e.large;
80
- }};
81
- cursor: pointer;
82
- overflow: hidden;
83
- ${(t) => {
84
- var e, a, n;
85
- return t.selected ? $`
86
- border-left: 2px solid ${(e = t.theme.colors) == null ? void 0 : e.primary};
87
- color: ${(a = t.theme.colors) == null ? void 0 : a.primary};
88
- ` : $`
89
- color: ${(n = t.theme.colors) == null ? void 0 : n.text};
90
- `;
91
- }};
92
-
93
- span {
94
- overflow: hidden;
95
- text-overflow: ellipsis;
96
- }
97
-
98
- i {
99
- margin-right: ${(t) => {
100
- var e;
101
- return (e = t.theme.sizes) == null ? void 0 : e.normal;
102
- }};
103
- font-size: ${(t) => {
104
- var e;
105
- return (e = t.theme.fonts) == null ? void 0 : e.medium;
106
- }};
107
- min-height: 1em;
108
- min-width: 1em;
109
- }
110
- `, O = c.div`
111
- ${M}
112
- `, ie = c(K)`
113
- ${M}
114
- &:focus {
115
- outline: none;
116
- span {
117
- ${(t) => {
118
- var e;
119
- return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && Q;
120
- }};
121
- }
122
- }
123
- `, se = c.div`
124
- display: flex;
125
- justify-content: space-between;
126
- padding-right: ${(t) => {
127
- var e;
128
- return (e = t.theme.sizes) == null ? void 0 : e.large;
129
- }};
130
- min-height: 52px;
131
- white-space: nowrap;
132
-
133
- && {
134
- font-weight: normal;
135
-
136
- a {
137
- font-weight: normal;
138
- }
139
- }
140
- ${O} {
141
- font-weight: normal;
142
- }
143
- `, ce = c(V)`
144
- ${X}
145
- display: flex;
146
- justify-content: center;
147
- flex-direction: column;
148
- margin-right: ${(t) => {
149
- var e;
150
- return (e = t.theme.sizes) == null ? void 0 : e.medium;
151
- }};
152
- margin-left: ${(t) => {
153
- var e;
154
- return (e = t.theme.sizes) == null ? void 0 : e.large;
155
- }};
156
- margin-bottom: 22px;
157
- border-left: ${(t) => t.theme.border};
158
- li {
159
- margin: 0 0 ${(t) => {
160
- var e;
161
- return (e = t.theme.sizes) == null ? void 0 : e.normal;
162
- }} -2px;
163
- }
164
- li:last-child {
165
- margin: 0 0 0 -2px;
166
- }
167
- flex-basis: 100%;
168
- border-width: 2px;
169
- `, me = c(E)`
170
- margin: 0 0 0 ${(t) => {
171
- var e;
172
- return (e = t.theme.sizes) == null ? void 0 : e.small;
173
- }};
174
- `, i = {
175
- Wrapper: re,
176
- Toggler: le,
177
- List: ce,
178
- Item: O,
179
- Link: ie,
180
- TopItem: se,
181
- MatchCount: me
182
- }, z = ({ matches: t }) => {
183
- const { showMatchCount: e = !1 } = N();
184
- return !e || typeof t == "undefined" ? null : /* @__PURE__ */ o.createElement(i.MatchCount, null, "(", t, ")");
185
- }, de = ({ item: t, guideCategory: e }) => {
186
- const {
187
- route: a = "browse",
188
- categoryAriaLabel: n = "",
189
- activeCategoryAriaLabel: x = "",
190
- fallbackOnInitialRoute: k = !1
191
- } = N(), [m, l] = Y(), { id: C, title: d, symbol: p, activeSymbol: y } = t, r = e === C;
192
- return /* @__PURE__ */ o.createElement("li", {
193
- ref: l
194
- }, /* @__PURE__ */ o.createElement(i.Link, w(s({}, ne(t, a, k, "category")), {
195
- "aria-pressed": r,
196
- "aria-label": (r ? x : n).replace("{{category}}", d),
197
- className: "humany-guide-category-dropdown-link",
198
- "aria-current": r,
199
- selected: r
200
- }), (r || m) && y ? /* @__PURE__ */ o.createElement(u, {
201
- symbol: y
202
- }) : p && /* @__PURE__ */ o.createElement(u, {
203
- symbol: p
204
- }), /* @__PURE__ */ o.createElement(E, null, d), /* @__PURE__ */ o.createElement(z, s({}, t))));
205
- }, be = (a) => {
206
- var n = a, { className: t } = n, e = F(n, ["className"]);
207
- const x = Z(), [k, m] = B(!1), {
208
- parent: l,
209
- route: C = "browse",
210
- categories: d = [],
211
- loading: p = !1
212
- } = N(), y = _(), [r, f] = B(!1), { params: R } = x, { guideCategory: v, tag: G, phrase: j, sorting: A } = R;
213
- if (ae(() => {
214
- r && f(!1);
215
- }, [v]), p || !l || !d.length)
216
- return ee(y, w(s({}, e), {
217
- className: D(t, "humany-guide-category-dropdown")
218
- }));
219
- const g = d.find((h) => h.id === v) || l, T = g.activeSymbol || g.symbol;
220
- return /* @__PURE__ */ o.createElement(i.Wrapper, w(s({}, e), {
221
- "data-loading": !1,
222
- "data-toggler-in-focus": k,
223
- "aria-expanded": r,
224
- className: D(t, "humany-guide-category-dropdown")
225
- }), r ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(i.TopItem, {
226
- className: "humany-guide-category-dropdown-top-item"
227
- }, /* @__PURE__ */ o.createElement(i.Link, {
228
- className: "humany-guide-category-dropdown-link",
229
- routeName: C,
230
- params: te({
231
- tag: G,
232
- phrase: j,
233
- sorting: A,
234
- guideCategory: l.id,
235
- uriName: oe(l.title)
236
- }),
237
- selected: !1
238
- }, l.symbol ? /* @__PURE__ */ o.createElement(u, {
239
- symbol: l.symbol
240
- }) : null, /* @__PURE__ */ o.createElement(E, null, l.title), /* @__PURE__ */ o.createElement(z, s({}, l))), /* @__PURE__ */ o.createElement(i.Toggler, {
241
- onBlur: () => m(!1),
242
- onFocus: () => m(!0),
243
- className: "humany-guide-category-dropdown-toggler",
244
- onClick: () => {
245
- f(!r);
246
- },
247
- "aria-expanded": "true",
248
- "aria-label": g.title
249
- }, /* @__PURE__ */ o.createElement(u, {
250
- size: 18,
251
- symbol: { type: "Svg", content: "caret-up" }
252
- }))), /* @__PURE__ */ o.createElement(i.List, {
253
- className: "humany-guide-category-dropdown-open",
254
- items: d,
255
- renderItem: (h) => /* @__PURE__ */ o.createElement(de, {
256
- key: h.id,
257
- item: h,
258
- guideCategory: v
259
- })
260
- })) : /* @__PURE__ */ o.createElement(i.TopItem, {
261
- className: "humany-guide-category-dropdown-top-item"
262
- }, /* @__PURE__ */ o.createElement(i.Item, {
263
- className: "humany-guide-category-dropdown-item",
264
- onClick: () => {
265
- f(!r);
266
- },
267
- selected: !1
268
- }, T ? /* @__PURE__ */ o.createElement(u, {
269
- symbol: T
270
- }) : null, /* @__PURE__ */ o.createElement(E, null, g.title), /* @__PURE__ */ o.createElement(z, s({}, g))), /* @__PURE__ */ o.createElement(i.Toggler, {
271
- onBlur: () => m(!1),
272
- onFocus: () => m(!0),
273
- className: "humany-guide-category-dropdown-toggler",
274
- onClick: () => {
275
- f(!r);
276
- },
277
- "aria-expanded": "false",
278
- "aria-label": g.title
279
- }, /* @__PURE__ */ o.createElement(u, {
280
- size: 18,
281
- symbol: { type: "Svg", content: "caret-down" }
282
- }))));
283
- };
284
- export {
285
- be as default
286
- };
287
- //# sourceMappingURL=guide-category-dropdown.e32ae53a.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guide-category-dropdown.e32ae53a.js","sources":["../src/guide-category-dropdown.styles.ts","../src/guide-category-dropdown-match-count.tsx","../src/guide-category-dropdown-item.tsx","../src/guide-category-dropdown.tsx"],"sourcesContent":["import {\n borderTabStyle,\n contentBox,\n Link as BaseLink,\n linkTabStyle,\n List as BaseList,\n list,\n loadingOpacity,\n Text,\n} from '@telia-ace/knowledge-widget-ui';\nimport styled, { css } from 'styled-components';\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst Wrapper: any = styled.div<any>`\n ${loadingOpacity}\n ${contentBox}\n overflow: hidden;\n min-height: 50px;\n ${(p) =>\n p['data-toggler-in-focus'] &&\n p.theme.accessibility?.isTabbing &&\n css`\n && {\n ${borderTabStyle}\n }\n `};\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst Toggler: any = styled.button`\n background: none;\n border: 0;\n outline: 0;\n display: block;\n cursor: pointer;\n padding: 0;\n font-size: ${(p) => p.theme.fonts?.normal};\n text-align: end;\n flex: 1 0 auto;\n svg {\n path,\n line {\n stroke: ${(p) => p.theme.colors?.text};\n }\n }\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst styling = css<{ selected: boolean }>`\n font-size: ${(p) => p.theme.fonts?.normal};\n text-align: left;\n text-align: left;\n text-decoration: none;\n font-weight: 300;\n display: flex;\n align-items: center;\n padding: ${(p) => p.theme.sizes?.small};\n padding-left: ${(p) => p.theme.sizes?.large};\n cursor: pointer;\n overflow: hidden;\n ${(p) =>\n p.selected\n ? css`\n border-left: 2px solid ${p.theme.colors?.primary};\n color: ${p.theme.colors?.primary};\n `\n : css`\n color: ${p.theme.colors?.text};\n `};\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n i {\n margin-right: ${(p) => p.theme.sizes?.normal};\n font-size: ${(p) => p.theme.fonts?.medium};\n min-height: 1em;\n min-width: 1em;\n }\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst Item: any = styled.div`\n ${styling}\n`;\n\nconst Link: any = styled(BaseLink)<any>`\n ${styling}\n &:focus {\n outline: none;\n span {\n ${(p) => p.theme.accessibility?.isTabbing && linkTabStyle};\n }\n }\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst TopItem: any = styled.div`\n display: flex;\n justify-content: space-between;\n padding-right: ${(p) => p.theme.sizes?.large};\n min-height: 52px;\n white-space: nowrap;\n\n && {\n font-weight: normal;\n\n a {\n font-weight: normal;\n }\n }\n ${Item} {\n font-weight: normal;\n }\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst List: any = styled(BaseList)<any>`\n ${list}\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin-right: ${(p) => p.theme.sizes?.medium};\n margin-left: ${(p) => p.theme.sizes?.large};\n margin-bottom: 22px;\n border-left: ${(p) => p.theme.border};\n li {\n margin: 0 0 ${(p) => p.theme.sizes?.normal} -2px;\n }\n li:last-child {\n margin: 0 0 0 -2px;\n }\n flex-basis: 100%;\n border-width: 2px;\n`;\n\n// FUTURE TODO: Look into the typescript error when removing \": any\".\nconst MatchCount: any = styled(Text)`\n margin: 0 0 0 ${(p) => p.theme.sizes?.small};\n`;\n\nexport default {\n Wrapper,\n Toggler,\n List,\n Item,\n Link,\n TopItem,\n MatchCount,\n};\n","import { Category } from '@telia-ace/knowledge-widget-core';\nimport { useProperties } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\nimport Styled from './guide-category-dropdown.styles';\n\nconst GuideCategoryDropdownMatchCount: React.FC<Category> = ({ matches }) => {\n const { showMatchCount = false } = useProperties<GuideCategoryDropdownComponentProps>();\n\n if (!showMatchCount || typeof matches === 'undefined') {\n return null;\n }\n\n return <Styled.MatchCount>({matches})</Styled.MatchCount>;\n};\n\nexport default GuideCategoryDropdownMatchCount;\n","import { initialRouteFallback } from '@telia-ace/knowledge-widget-component-utilities';\nimport { Category } from '@telia-ace/knowledge-widget-core';\nimport { SymbolBadge, Text, useHover, useProperties } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\nimport GuideCategoryDropdownMatchCount from './guide-category-dropdown-match-count';\nimport Styled from './guide-category-dropdown.styles';\n\ntype Props = {\n item: Category;\n guideCategory: string;\n};\n\nconst GuideCategoryDropdownItem: React.FC<Props> = ({ item, guideCategory }) => {\n const {\n route = 'browse',\n categoryAriaLabel = '',\n activeCategoryAriaLabel = '',\n fallbackOnInitialRoute = false,\n } = useProperties<GuideCategoryDropdownComponentProps>();\n const [hovering, elem] = useHover();\n const { id, title, symbol, activeSymbol } = item;\n\n const selected = guideCategory === id;\n return (\n <li ref={elem as any}>\n <Styled.Link\n {...initialRouteFallback(item, route, fallbackOnInitialRoute, 'category')}\n aria-pressed={selected}\n aria-label={(selected ? activeCategoryAriaLabel : categoryAriaLabel).replace(\n '{{category}}',\n title\n )}\n className=\"humany-guide-category-dropdown-link\"\n aria-current={selected}\n selected={selected}\n >\n {(selected || hovering) && activeSymbol ? (\n <SymbolBadge symbol={activeSymbol} />\n ) : (\n symbol && <SymbolBadge symbol={symbol} />\n )}\n <Text>{title}</Text>\n <GuideCategoryDropdownMatchCount {...item} />\n </Styled.Link>\n </li>\n );\n};\n\nexport default GuideCategoryDropdownItem;\n","import { Category } from '@telia-ace/knowledge-widget-core';\nimport {\n createEmptyComponent,\n SymbolBadge,\n Text,\n useContainer,\n useProperties,\n useRouteData,\n} from '@telia-ace/knowledge-widget-ui';\nimport { appendClassNames, createParams, formatUrl } from '@telia-ace/widget-utilities';\nimport React, { useEffect, useState } from 'react';\nimport { GuideCategoryDropdownComponentProps } from './guide-category-dropdown-component';\nimport GuideCategoryDropdownItem from './guide-category-dropdown-item';\nimport GuideCategoryDropdownMatchCount from './guide-category-dropdown-match-count';\nimport Styled from './guide-category-dropdown.styles';\n\ntype Props = {\n className: string;\n};\n\nconst GuideCategoryDropdown: React.SFC<Props> = ({ className, ...other }) => {\n const routeData = useRouteData();\n const [togglerFocus, setTogglerFocus] = useState(false);\n const {\n parent,\n route = 'browse',\n categories = [],\n loading = false,\n } = useProperties<GuideCategoryDropdownComponentProps>();\n const container = useContainer();\n const [isOpen, setIsOpen] = useState(false);\n const { params } = routeData;\n const { guideCategory, tag, phrase, sorting } = params;\n\n useEffect(() => {\n if (isOpen) {\n setIsOpen(false);\n }\n }, [guideCategory]);\n\n if (loading || !parent || !categories.length) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-guide-category-dropdown'),\n });\n }\n\n const selected = categories.find((category) => category.id === guideCategory) || parent;\n const selectedSymbol = selected.activeSymbol || selected.symbol;\n\n return (\n <Styled.Wrapper\n {...other}\n data-loading={false}\n data-toggler-in-focus={togglerFocus}\n aria-expanded={isOpen}\n className={appendClassNames(className, 'humany-guide-category-dropdown')}\n >\n {isOpen ? (\n <>\n <Styled.TopItem className=\"humany-guide-category-dropdown-top-item\">\n <Styled.Link\n className=\"humany-guide-category-dropdown-link\"\n routeName={route}\n params={createParams({\n tag,\n phrase,\n sorting,\n guideCategory: parent.id,\n uriName: formatUrl(parent.title),\n })}\n selected={false}\n >\n {parent.symbol ? <SymbolBadge symbol={parent.symbol} /> : null}\n <Text>{parent.title}</Text>\n <GuideCategoryDropdownMatchCount {...parent} />\n </Styled.Link>\n <Styled.Toggler\n onBlur={() => setTogglerFocus(false)}\n onFocus={() => setTogglerFocus(true)}\n className=\"humany-guide-category-dropdown-toggler\"\n onClick={() => {\n setIsOpen(!isOpen);\n }}\n aria-expanded=\"true\"\n aria-label={selected.title}\n >\n <SymbolBadge size={18} symbol={{ type: 'Svg', content: 'caret-up' }} />\n </Styled.Toggler>\n </Styled.TopItem>\n <Styled.List\n className=\"humany-guide-category-dropdown-open\"\n items={categories}\n renderItem={(item: Category) => (\n <GuideCategoryDropdownItem\n key={item.id}\n item={item}\n guideCategory={guideCategory}\n />\n )}\n />\n </>\n ) : (\n <Styled.TopItem className=\"humany-guide-category-dropdown-top-item\">\n <Styled.Item\n className=\"humany-guide-category-dropdown-item\"\n onClick={() => {\n setIsOpen(!isOpen);\n }}\n selected={false}\n >\n {selectedSymbol ? <SymbolBadge symbol={selectedSymbol} /> : null}\n <Text>{selected.title}</Text>\n <GuideCategoryDropdownMatchCount {...selected} />\n </Styled.Item>\n <Styled.Toggler\n onBlur={() => setTogglerFocus(false)}\n onFocus={() => setTogglerFocus(true)}\n className=\"humany-guide-category-dropdown-toggler\"\n onClick={() => {\n setIsOpen(!isOpen);\n }}\n aria-expanded=\"false\"\n aria-label={selected.title}\n >\n <SymbolBadge size={18} symbol={{ type: 'Svg', content: 'caret-down' }} />\n </Styled.Toggler>\n </Styled.TopItem>\n )}\n </Styled.Wrapper>\n );\n};\n\nexport default GuideCategoryDropdown;\n"],"names":["BaseLink","BaseList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,KAAe,EAAO;AAAA,MACtB;AAAA,MACA;AAAA;AAAA;AAAA,MAGA,CAAC;;AACC,WAAE,4BACF,QAAE,MAAM,kBAAR,kBAAuB,cACvB;AAAA;AAAA,kBAEU;AAAA;AAAA;AAAA;AAAA,GAMZ,KAAe,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAOX,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMjB,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA;AAAA,GAMvC,IAAU;AAAA,iBACC,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOxB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,oBACjB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA,MAGpC,CAAC,MACC;;AAAA,WAAE,WACI;AAAA,2CAC6B,OAAE,MAAM,WAAR,kBAAgB;AAAA,2BAChC,OAAE,MAAM,WAAR,kBAAgB;AAAA,kBAE7B;AAAA,2BACa,OAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wB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