@telia-ace/knowledge-widget-components-guide-category-dropdown 1.1.2-rc.0 → 1.1.2-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.
@@ -102,4 +102,4 @@
102
102
  border-width: 2px;
103
103
  `,O=g(s.Text)`
104
104
  margin: 0 0 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}};
105
- `,a={Wrapper:B,Toggler:L,List:M,Item:q,Link:F,TopItem:D,MatchCount:O},C=({matches:e})=>{const{showMatchCount:t=!1}=s.useProperties();return!t||typeof e>"u"?null:o.jsxs(a.MatchCount,{children:["(",e,")"]})},P=({item:e,guideCategory:t})=>{const{route:m="browse",categoryAriaLabel:u="",activeCategoryAriaLabel:i="",fallbackOnInitialRoute:n=!1}=s.useProperties(),[y,l]=s.useHover(),{id:h,title:f,symbol:r,activeSymbol:d}=e,c=t===h;return o.jsx("li",{ref:l,children:o.jsxs(a.Link,{...I.initialRouteFallback(e,m,n,"category"),"aria-pressed":c,"aria-label":(c?i:u).replace("{{category}}",f),className:"humany-guide-category-dropdown-link","aria-current":c,selected:c,children:[(c||y)&&d?o.jsx(s.SymbolBadge,{symbol:d}):r&&o.jsx(s.SymbolBadge,{symbol:r}),o.jsx(s.Text,{children:f}),o.jsx(C,{...e})]})})},R=({className:e,...t})=>{const m=s.useRouteData(),[u,i]=$.useState(!1),{parent:n,route:y="browse",categories:l=[],loading:h=!1}=s.useProperties(),f=s.useContainer(),[r,d]=$.useState(!1),{params:c}=m,v=s.useIsTabbing(),{guideCategory:j,tag:T,phrase:z,sorting:N}=c;if($.useEffect(()=>{r&&d(!1)},[j]),h||!n||!l.length)return s.createEmptyComponent(f,{...t,className:b.appendClassNames(e,"humany-guide-category-dropdown")});const p=l.find(x=>x.id===j)||n,S=p.activeSymbol||p.symbol;return o.jsx(a.Wrapper,{...t,"data-loading":!1,"data-toggler-in-focus":u,"aria-expanded":r,isTabbing:v,className:b.appendClassNames(e,"humany-guide-category-dropdown"),children:r?o.jsxs(o.Fragment,{children:[o.jsxs(a.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[o.jsxs(a.Link,{className:"humany-guide-category-dropdown-link",routeName:y,params:b.createParams({tag:T,phrase:z,sorting:N,guideCategory:n.id,uriName:b.formatUrl(n.title)}),selected:!1,children:[n.symbol?o.jsx(s.SymbolBadge,{symbol:n.symbol}):null,o.jsx(s.Text,{children:n.title}),o.jsx(C,{...n})]}),o.jsx(a.Toggler,{onBlur:()=>i(!1),onFocus:()=>i(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{d(!r)},"aria-expanded":"true","aria-label":p.title,children:o.jsx(s.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-up"}})})]}),o.jsx(a.List,{className:"humany-guide-category-dropdown-open",items:l,renderItem:x=>o.jsx(P,{item:x,guideCategory:j},x.id)})]}):o.jsxs(a.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[o.jsxs(a.Item,{className:"humany-guide-category-dropdown-item",onClick:()=>{d(!r)},selected:!1,children:[S?o.jsx(s.SymbolBadge,{symbol:S}):null,o.jsx(s.Text,{children:p.title}),o.jsx(C,{...p})]}),o.jsx(a.Toggler,{onBlur:()=>i(!1),onFocus:()=>i(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{d(!r)},"aria-expanded":"false","aria-label":p.title,children:o.jsx(s.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-down"}})})]})})};exports.default=R;
105
+ `,a={Wrapper:B,Toggler:L,List:M,Item:q,Link:F,TopItem:D,MatchCount:O},C=({matches:e})=>{const{showMatchCount:t=!1}=s.useProperties();return!t||typeof e>"u"?null:o.jsxs(a.MatchCount,{children:["(",e,")"]})},P=({item:e,guideCategory:t})=>{const{route:m="browse",categoryAriaLabel:u="",activeCategoryAriaLabel:i="",fallbackOnInitialRoute:n=!1}=s.useProperties(),[y,l]=s.useHover(),{id:h,title:f,symbol:r,activeSymbol:d}=e,c=t===h;return o.jsx("li",{ref:l,children:o.jsxs(a.Link,{...I.initialRouteFallback(e,m,n,"category"),"aria-pressed":c,"aria-label":(c?i:u).replace("{{category}}",f),className:"humany-guide-category-dropdown-link","aria-current":c,selected:c,children:[(c||y)&&d?o.jsx(s.SymbolBadge,{symbol:d}):r&&o.jsx(s.SymbolBadge,{symbol:r}),o.jsx(s.Text,{children:f}),o.jsx(C,{...e})]})})},R=({className:e,...t})=>{const m=s.useRouteData(),[u,i]=$.useState(!1),{parent:n,route:y="browse",categories:l=[],loading:h=!1}=s.useProperties(),f=s.useContainer(),[r,d]=$.useState(!1),{params:c}=m,v=s.useIsTabbing(),{guideCategory:j,tag:T,phrase:z,sorting:N}=c;if($.useEffect(()=>{r&&d(!1)},[j]),h||!n||!l.length)return s.createEmptyComponent(f,{...t,className:b.appendClassNames(e,"humany-guide-category-dropdown")});const p=l.find(x=>x.id===j)||n,S=p.activeSymbol||p.symbol;return o.jsx(a.Wrapper,{...t,"data-loading":!1,"data-toggler-in-focus":u,"aria-expanded":r,isTabbing:v,className:b.appendClassNames(e,"humany-guide-category-dropdown"),children:r?o.jsxs(o.Fragment,{children:[o.jsxs(a.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[o.jsxs(a.Link,{className:"humany-guide-category-dropdown-link",routeName:y,params:b.createParams({tag:T,phrase:z,sorting:N,guideCategory:n.id,uriName:b.formatUrl(n.title)}),selected:!1,children:[n.symbol?o.jsx(s.SymbolBadge,{symbol:n.symbol}):null,o.jsx(s.Text,{children:n.title}),o.jsx(C,{...n})]}),o.jsx(a.Toggler,{onBlur:()=>i(!1),onFocus:()=>i(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{d(!r)},"aria-expanded":"true","aria-label":n.title,children:o.jsx(s.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-up"}})})]}),o.jsx(a.List,{className:"humany-guide-category-dropdown-open",items:l,renderItem:x=>o.jsx(P,{item:x,guideCategory:j},x.id)})]}):o.jsxs(a.TopItem,{className:"humany-guide-category-dropdown-top-item",children:[o.jsxs(a.Item,{className:"humany-guide-category-dropdown-item",onClick:()=>{d(!r)},selected:!1,children:[S?o.jsx(s.SymbolBadge,{symbol:S}):null,o.jsx(s.Text,{children:p.title}),o.jsx(C,{...p})]}),o.jsx(a.Toggler,{onBlur:()=>i(!1),onFocus:()=>i(!0),className:"humany-guide-category-dropdown-toggler",onClick:()=>{d(!r)},"aria-expanded":"false","aria-label":p.title,children:o.jsx(s.SymbolBadge,{size:18,symbol:{type:"Svg",content:"caret-down"}})})]})})};exports.default=R;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as c, jsx as o, Fragment as j } from "react/jsx-runtime";
2
- import { loadingOpacity as B, contentBox as M, borderTabStyle as O, Link as G, linkTabStyle as R, List as A, list as E, Text as $, useProperties as C, useHover as P, SymbolBadge as y, useRouteData as W, useContainer as H, useIsTabbing as U, createEmptyComponent as q } from "@telia-ace/knowledge-widget-ui";
2
+ import { loadingOpacity as B, contentBox as M, borderTabStyle as O, Link as G, linkTabStyle as R, List as A, list as E, Text as $, useProperties as C, useHover as P, SymbolBadge as f, useRouteData as W, useContainer as H, useIsTabbing as U, createEmptyComponent as q } from "@telia-ace/knowledge-widget-ui";
3
3
  import { appendClassNames as T, createParams as J, formatUrl as K } from "@telia-ace/widget-utilities";
4
4
  import { useState as N, useEffect as Q } from "react";
5
5
  import { initialRouteFallback as V } from "@telia-ace/knowledge-widget-component-utilities";
@@ -168,7 +168,7 @@ const X = m.div`
168
168
  "aria-current": d,
169
169
  selected: d,
170
170
  children: [
171
- (d || p) && l ? /* @__PURE__ */ o(y, { symbol: l }) : i && /* @__PURE__ */ o(y, { symbol: i }),
171
+ (d || p) && l ? /* @__PURE__ */ o(f, { symbol: l }) : i && /* @__PURE__ */ o(f, { symbol: i }),
172
172
  /* @__PURE__ */ o($, { children: b }),
173
173
  /* @__PURE__ */ o(v, { ...e })
174
174
  ]
@@ -188,7 +188,7 @@ const X = m.div`
188
188
  ...t,
189
189
  className: T(e, "humany-guide-category-dropdown")
190
190
  });
191
- const f = s.find((w) => w.id === k) || n, z = f.activeSymbol || f.symbol;
191
+ const y = s.find((w) => w.id === k) || n, z = y.activeSymbol || y.symbol;
192
192
  return /* @__PURE__ */ o(
193
193
  a.Wrapper,
194
194
  {
@@ -214,7 +214,7 @@ const X = m.div`
214
214
  }),
215
215
  selected: !1,
216
216
  children: [
217
- n.symbol ? /* @__PURE__ */ o(y, { symbol: n.symbol }) : null,
217
+ n.symbol ? /* @__PURE__ */ o(f, { symbol: n.symbol }) : null,
218
218
  /* @__PURE__ */ o($, { children: n.title }),
219
219
  /* @__PURE__ */ o(v, { ...n })
220
220
  ]
@@ -230,9 +230,9 @@ const X = m.div`
230
230
  l(!i);
231
231
  },
232
232
  "aria-expanded": "true",
233
- "aria-label": f.title,
233
+ "aria-label": n.title,
234
234
  children: /* @__PURE__ */ o(
235
- y,
235
+ f,
236
236
  {
237
237
  size: 18,
238
238
  symbol: { type: "Svg", content: "caret-up" }
@@ -266,9 +266,9 @@ const X = m.div`
266
266
  },
267
267
  selected: !1,
268
268
  children: [
269
- z ? /* @__PURE__ */ o(y, { symbol: z }) : null,
270
- /* @__PURE__ */ o($, { children: f.title }),
271
- /* @__PURE__ */ o(v, { ...f })
269
+ z ? /* @__PURE__ */ o(f, { symbol: z }) : null,
270
+ /* @__PURE__ */ o($, { children: y.title }),
271
+ /* @__PURE__ */ o(v, { ...y })
272
272
  ]
273
273
  }
274
274
  ),
@@ -282,9 +282,9 @@ const X = m.div`
282
282
  l(!i);
283
283
  },
284
284
  "aria-expanded": "false",
285
- "aria-label": f.title,
285
+ "aria-label": y.title,
286
286
  children: /* @__PURE__ */ o(
287
- y,
287
+ f,
288
288
  {
289
289
  size: 18,
290
290
  symbol: { type: "Svg", content: "caret-down" }
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const g=require("@telia-ace/knowledge-data-client"),l=require("@telia-ace/knowledge-widget-core"),v=require("@telia-ace/knowledge-widget-ui"),D=(e,a,n)=>!n||n.length<1?a:h(e,a,null,n),h=(e,a,n,o)=>{if(e.find(s=>s.id===o)||!o)return n||a;for(let s=0;s<e.length;s+=1){const t=e[s];if(t.items){const r=h(t.items,a,t,o);if(r)return r}}},P=e=>e.matches&&e.matches>0,q=e=>{const{events:a}=e.get("$widget"),[n,o]=l.createEventSubscriber(a);return v.createReactComponent(e,"guide-category-dropdown",Promise.resolve().then(()=>require("./guide-category-dropdown-2cb0c652.js")),i=>{const s=t=>{i.writeProperties({loading:!0}),i.actions.dispatch("fetch",{params:t}).then(()=>{i.writeProperties({loading:!1})})};i.actions.create("fetch",({parent:t,categories:r})=>{i.writeProperties({parent:t,categories:r,loading:!1})}),e.getAsync("router").then(t=>{const{params:r}=t.getRouteData();s(r)}),n("router:changed",(t,{current:r})=>{s(r.routeData.params)})}).then(()=>l.extendComponent(e,"guide-category-dropdown",i=>{i.actions.watch("guide-category-dropdown.fetch",(s,t)=>{const{matchFilters:r={search:!1,tag:!1},rootCategoryHeader:f}=i.properties(),{params:{phrase:p,guideCategory:w,tag:m}}=s;return g.DataClient.getInstance(e).then(b=>b.fetch(g.DataType.GuideCategories,{searchPhrase:r.search?p:void 0,tagId:r.tag?m:void 0}).then(({categories:d,matches:C})=>{var u;const c=D(d,{matches:C,id:"0",title:f,items:d},w);return t({parent:c,categories:(u=c==null?void 0:c.items)==null?void 0:u.filter(P)})}))})})).then(()=>{o()})};module.exports=q;
1
+ "use strict";const g=require("@telia-ace/knowledge-data-client"),l=require("@telia-ace/knowledge-widget-core"),v=require("@telia-ace/knowledge-widget-ui"),D=(e,a,n)=>!n||n.length<1?a:h(e,a,null,n),h=(e,a,n,o)=>{if(e.find(s=>s.id===o)||!o)return n||a;for(let s=0;s<e.length;s+=1){const t=e[s];if(t.items){const r=h(t.items,a,t,o);if(r)return r}}},P=e=>e.matches&&e.matches>0,q=e=>{const{events:a}=e.get("$widget"),[n,o]=l.createEventSubscriber(a);return v.createReactComponent(e,"guide-category-dropdown",Promise.resolve().then(()=>require("./guide-category-dropdown-2073f5fc.js")),i=>{const s=t=>{i.writeProperties({loading:!0}),i.actions.dispatch("fetch",{params:t}).then(()=>{i.writeProperties({loading:!1})})};i.actions.create("fetch",({parent:t,categories:r})=>{i.writeProperties({parent:t,categories:r,loading:!1})}),e.getAsync("router").then(t=>{const{params:r}=t.getRouteData();s(r)}),n("router:changed",(t,{current:r})=>{s(r.routeData.params)})}).then(()=>l.extendComponent(e,"guide-category-dropdown",i=>{i.actions.watch("guide-category-dropdown.fetch",(s,t)=>{const{matchFilters:r={search:!1,tag:!1},rootCategoryHeader:f}=i.properties(),{params:{phrase:p,guideCategory:w,tag:m}}=s;return g.DataClient.getInstance(e).then(b=>b.fetch(g.DataType.GuideCategories,{searchPhrase:r.search?p:void 0,tagId:r.tag?m:void 0}).then(({categories:d,matches:C})=>{var u;const c=D(d,{matches:C,id:"0",title:f,items:d},w);return t({parent:c,categories:(u=c==null?void 0:c.items)==null?void 0:u.filter(P)})}))})})).then(()=>{o()})};module.exports=q;
package/index.mjs CHANGED
@@ -17,7 +17,7 @@ const y = (e, n, a) => !a || a.length < 1 ? n : h(e, n, null, a), h = (e, n, a,
17
17
  return P(
18
18
  e,
19
19
  "guide-category-dropdown",
20
- import("./guide-category-dropdown-db6f2b55.mjs"),
20
+ import("./guide-category-dropdown-8bed1331.mjs"),
21
21
  (i) => {
22
22
  const s = (t) => {
23
23
  i.writeProperties({ loading: !0 }), i.actions.dispatch("fetch", { params: t }).then(() => {
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.2-rc.0",
3
+ "version": "1.1.2-rc.1",
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.2-rc.0",
14
- "@telia-ace/knowledge-widget-component-utilities": "^1.1.2-rc.0",
15
- "@telia-ace/knowledge-widget-ui": "^1.1.2-rc.0",
16
- "@telia-ace/widget-utilities": "^1.1.2-rc.0",
17
- "@telia-ace/knowledge-data-client": "^1.1.2-rc.0",
13
+ "@telia-ace/knowledge-widget-core": "^1.1.2-rc.1",
14
+ "@telia-ace/knowledge-widget-component-utilities": "^1.1.2-rc.1",
15
+ "@telia-ace/knowledge-widget-ui": "^1.1.2-rc.1",
16
+ "@telia-ace/widget-utilities": "^1.1.2-rc.1",
17
+ "@telia-ace/knowledge-data-client": "^1.1.2-rc.1",
18
18
  "@webprovisions/platform": "^1.1.4"
19
19
  },
20
20
  "peerDependencies": {