@telia-ace/knowledge-widget-components-guide-category-dropdown 1.1.1-rc.0 → 1.1.1-rc.2
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-6c4d5ab0.js +105 -0
- package/{guide-category-dropdown-6e87a729.mjs → guide-category-dropdown-e6fca50c.mjs} +32 -28
- package/index-77cc22b1.js +1724 -0
- package/index-a4f978a6.mjs +7241 -0
- package/index.js +1 -1
- package/index.mjs +6 -2
- package/package.json +6 -6
- package/guide-category-dropdown-e0c53e78.js +0 -105
- package/index-34f1725b.mjs +0 -11118
- package/index-b2a67e58.js +0 -1757
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./index-
|
|
1
|
+
"use strict";const e=require("./index-77cc22b1.js");require("react/jsx-runtime");require("@emotion/styled");require("@emotion/react");require("react");require("react-transition-group");require("react-dom");require("react-router-dom");module.exports=e.GuideCategoryDropdownComponent;
|
package/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { G as
|
|
1
|
+
import { G as d } from "./index-a4f978a6.mjs";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
|
+
import "@emotion/styled";
|
|
4
|
+
import "@emotion/react";
|
|
3
5
|
import "react";
|
|
6
|
+
import "react-transition-group";
|
|
4
7
|
import "react-dom";
|
|
8
|
+
import "react-router-dom";
|
|
5
9
|
export {
|
|
6
|
-
|
|
10
|
+
d as default
|
|
7
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-guide-category-dropdown",
|
|
3
|
-
"version": "1.1.1-rc.
|
|
3
|
+
"version": "1.1.1-rc.2",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@telia-ace/knowledge-widget-core": "^1.1.1-rc.
|
|
14
|
-
"@telia-ace/knowledge-widget-component-utilities": "^1.1.1-rc.
|
|
15
|
-
"@telia-ace/knowledge-widget-ui": "^1.1.1-rc.
|
|
16
|
-
"@telia-ace/widget-utilities": "^1.1.1-rc.
|
|
17
|
-
"@telia-ace/knowledge-data-client": "^1.1.1-rc.
|
|
13
|
+
"@telia-ace/knowledge-widget-core": "^1.1.1-rc.2",
|
|
14
|
+
"@telia-ace/knowledge-widget-component-utilities": "^1.1.1-rc.2",
|
|
15
|
+
"@telia-ace/knowledge-widget-ui": "^1.1.1-rc.2",
|
|
16
|
+
"@telia-ace/widget-utilities": "^1.1.1-rc.2",
|
|
17
|
+
"@telia-ace/knowledge-data-client": "^1.1.1-rc.2",
|
|
18
18
|
"@webprovisions/platform": "^1.1.4"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -1,105 +0,0 @@
|
|
|
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;
|