@telia-ace/knowledge-widget-ui 1.2.8 → 1.2.9
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/index.js +2 -2
- package/index.mjs +15 -16
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
}
|
|
244
244
|
`,F=d(s.Text)`
|
|
245
245
|
font-style: italic;
|
|
246
|
-
`,Be=({tags:e})=>e.filter(t=>t.symbol).length?n.jsx(Ee,{className:"humany-guide-list-tags",items:e,renderItem:({id:t,symbol:a,title:i})=>a&&n.jsx("li",{"data-tag":t,children:n.jsx(Me,{size:18,symbol:a,title:i})},t)}):null,Fe=u.forwardRef(({title:e,id:t,route:a,symbolSize:i,collapseUri:o,children:r},l)=>{const{params:h}=s.useRouteData();return n.jsxs(Pe,{ref:l,"data-guide":t,children:[n.jsx(s.TextLink,{title:e,"aria-label":e,routeName:a,params:v.createParams({...h,uriName:o||void 0,id:void 0,guide:void 0,accordion:void 0}),text:e,children:n.jsx(s.SymbolBadge,{size:i,symbol:{type:"Svg",content:"caret-up"}})}),r]})}),Pe=d.li`
|
|
246
|
+
`,Be=({tags:e})=>e.filter(t=>t.symbol).length?n.jsx(Ee,{className:"humany-guide-list-tags",items:e,renderItem:({id:t,symbol:a,title:i})=>a&&n.jsx("li",{"data-tag":t,children:n.jsx(Me,{size:18,symbol:a,title:i})},t)}):null,Fe=u.forwardRef(({title:e,id:t,route:a,symbolSize:i,collapseUri:o,children:r},l)=>{const{params:h}=s.useRouteData();return n.jsxs(Pe,{ref:l,"data-guide":t,children:[n.jsx(s.TextLink,{"aria-expanded":!0,title:e,"aria-label":e,routeName:a,params:v.createParams({...h,uriName:o||void 0,id:void 0,guide:void 0,accordion:void 0}),text:e,children:n.jsx(s.SymbolBadge,{size:i,symbol:{type:"Svg",content:"caret-up"}})}),r]})}),Pe=d.li`
|
|
247
247
|
> a {
|
|
248
248
|
grid-column: 1/-1;
|
|
249
249
|
font-weight: bold;
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
> div {
|
|
254
254
|
grid-column: 1/-1;
|
|
255
255
|
}
|
|
256
|
-
`,Ae=u.forwardRef(({expandable:e=!1,routing:t={},paramMappers:a={},symbolSize:i=11,pageRole:o="link",pageCaret:r="down",showTags:l=!1,showFavoriteToggle:h=!1,localPaging:c=!1,onItemClick:m=()=>{},dispatch:p=()=>{},metadata:f={},pageLabel:g,className:w,children:b,items:$,renderItem:S,addFavoriteTooltip:J,removeFavoriteCancelLabel:Q,removeFavoriteConfirmLabel:X,removeFavoriteHeader:Z,removeFavoriteLabel:ee,removeFavoriteTooltip:te,searchResultsEmptyLabel:se,...A},ae)=>{const R=s.useIsTabbing(),L=u.useRef(),N=s.usePrevious($),{guide:ne="guide",page:ie="index"}=t,{guide:oe=({id:x})=>v.createParams({guide:x}),page:E=()=>v.createParams()}=a,[re,le]=K(),ce=s.useContainer(),{events:de}=ce.get("$widget");u.useImperativeHandle(ae,()=>L.current);const D=x=>{const{id:
|
|
256
|
+
`,Ae=u.forwardRef(({expandable:e=!1,routing:t={},paramMappers:a={},symbolSize:i=11,pageRole:o="link",pageCaret:r="down",showTags:l=!1,showFavoriteToggle:h=!1,localPaging:c=!1,onItemClick:m=()=>{},dispatch:p=()=>{},metadata:f={},pageLabel:g,className:w,children:b,items:$,renderItem:S,addFavoriteTooltip:J,removeFavoriteCancelLabel:Q,removeFavoriteConfirmLabel:X,removeFavoriteHeader:Z,removeFavoriteLabel:ee,removeFavoriteTooltip:te,searchResultsEmptyLabel:se,...A},ae)=>{const R=s.useIsTabbing(),L=u.useRef(),N=s.usePrevious($),{guide:ne="guide",page:ie="index"}=t,{guide:oe=({id:x})=>v.createParams({guide:x}),page:E=()=>v.createParams()}=a,[re,le]=K(),ce=s.useContainer(),{events:de}=ce.get("$widget");u.useImperativeHandle(ae,()=>L.current);const D=x=>{const{id:j,title:k,tags:z,published:T,modified:C,publishedBy:I,modifiedBy:B}=x;return n.jsxs("li",{"data-guide":j,"has-metadata":(!!(f!=null&&f.showPublished)&&!!T||!!(f!=null&&f.showModified)&&!!C).toString(),children:[n.jsx(s.TextLink,{className:"humany-guide-link",routeName:ne,onClick:fe=>{m(fe,x),de.dispatch("tracking:guide-list-item-clicked",{guide:x})},params:oe(x),text:k,children:n.jsx(s.SymbolBadge,{size:i,symbol:{type:"Svg",content:e?"caret-down":"caret-right"}})}),h&&n.jsx(_,{guideTitle:k,addFavoriteTooltip:J,removeFavoriteCancelLabel:Q,removeFavoriteConfirmLabel:X,removeFavoriteHeader:Z,removeFavoriteLabel:ee,removeFavoriteTooltip:te,isFavorite:re.indexOf(j)>-1,actions:le,id:j}),l&&n.jsx(Be,{tags:z}),n.jsx(Oe,{...f,indent:e?void 0:i,modified:C,published:T,publishedBy:I,modifiedBy:B})]},j)},me=u.useCallback((x,j,k)=>S?S(x,j,k,D):D(x),[S,D]),he=u.useCallback(x=>{c&&(x.preventDefault(),p("page",E()))},[p,c]);u.useEffect(()=>{if(N&&N.length<$.length&&L.current){const x=L.current.querySelectorAll(".humany-guide-list > ul > li"),j=x[N.length];if(x.length===$.length&&N.length){const k=x[N.length];if(k){const z=k.querySelector(".humany-guide-link");z&&z.focus()}}else j&&new MutationObserver((z,T)=>{z.forEach(C=>{if(C.addedNodes){const I=Array.from(C.addedNodes).find(B=>B.tagName==="A");I&&v.htmlParentContains(L.current,document.activeElement)&&(R&&I.focus(),T.disconnect())}})}).observe(j,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}});const ue=!!Object.keys(f).filter(x=>typeof f[x]<"u").length;return n.jsxs(Re,{className:v.appendClassNames(w,"humany-guide-list"),"data-item-count":$.length,items:$,renderItem:me,isTabbing:R,expandable:e?"true":"false","grid-items":l||h||ue?"true":"false",...s.convertToStringAttributes(A),ref:L,children:[g?n.jsx(s.TextLink,{text:g,title:g,"aria-label":g,routeName:ie,role:o,params:E(),onClick:he,children:n.jsx(s.SymbolBadge,{size:i,symbol:{type:"Svg",content:`caret-${r}`}})}):null,b,!A["data-loading"]&&$.length===0&&n.jsx("p",{children:se})]})}),Re=d(s.ItemList)`
|
|
257
257
|
${s.itemList}
|
|
258
258
|
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.large}};
|
|
259
259
|
overflow: auto;
|
package/index.mjs
CHANGED
|
@@ -662,6 +662,7 @@ const $e = ({
|
|
|
662
662
|
/* @__PURE__ */ o(
|
|
663
663
|
V,
|
|
664
664
|
{
|
|
665
|
+
"aria-expanded": !0,
|
|
665
666
|
title: t,
|
|
666
667
|
"aria-label": t,
|
|
667
668
|
routeName: n,
|
|
@@ -733,19 +734,17 @@ const $e = ({
|
|
|
733
734
|
} = n, [De, Fe] = rt(), Ce = fe(), { events: Ae } = Ce.get("$widget");
|
|
734
735
|
Ue(Ne, () => I.current);
|
|
735
736
|
const H = (g) => {
|
|
736
|
-
const { id:
|
|
737
|
+
const { id: b, title: w, tags: L, published: C, modified: D, publishedBy: A, modifiedBy: O } = g;
|
|
737
738
|
return /* @__PURE__ */ p(
|
|
738
739
|
"li",
|
|
739
740
|
{
|
|
740
|
-
"data-guide":
|
|
741
|
+
"data-guide": b,
|
|
741
742
|
"has-metadata": (!!(h != null && h.showPublished) && !!C || !!(h != null && h.showModified) && !!D).toString(),
|
|
742
743
|
children: [
|
|
743
744
|
/* @__PURE__ */ o(
|
|
744
745
|
V,
|
|
745
746
|
{
|
|
746
747
|
className: "humany-guide-link",
|
|
747
|
-
title: b,
|
|
748
|
-
"aria-label": b,
|
|
749
748
|
routeName: Le,
|
|
750
749
|
onClick: (je) => {
|
|
751
750
|
d(je, g), Ae.dispatch("tracking:guide-list-item-clicked", {
|
|
@@ -753,7 +752,7 @@ const $e = ({
|
|
|
753
752
|
});
|
|
754
753
|
},
|
|
755
754
|
params: Te(g),
|
|
756
|
-
text:
|
|
755
|
+
text: w,
|
|
757
756
|
children: /* @__PURE__ */ o(
|
|
758
757
|
S,
|
|
759
758
|
{
|
|
@@ -769,16 +768,16 @@ const $e = ({
|
|
|
769
768
|
m && /* @__PURE__ */ o(
|
|
770
769
|
ot,
|
|
771
770
|
{
|
|
772
|
-
guideTitle:
|
|
771
|
+
guideTitle: w,
|
|
773
772
|
addFavoriteTooltip: ve,
|
|
774
773
|
removeFavoriteCancelLabel: xe,
|
|
775
774
|
removeFavoriteConfirmLabel: be,
|
|
776
775
|
removeFavoriteHeader: we,
|
|
777
776
|
removeFavoriteLabel: ke,
|
|
778
777
|
removeFavoriteTooltip: ze,
|
|
779
|
-
isFavorite: De.indexOf(
|
|
778
|
+
isFavorite: De.indexOf(b) > -1,
|
|
780
779
|
actions: Fe,
|
|
781
|
-
id:
|
|
780
|
+
id: b
|
|
782
781
|
}
|
|
783
782
|
),
|
|
784
783
|
r && /* @__PURE__ */ o(ct, { tags: L }),
|
|
@@ -795,10 +794,10 @@ const $e = ({
|
|
|
795
794
|
)
|
|
796
795
|
]
|
|
797
796
|
},
|
|
798
|
-
|
|
797
|
+
b
|
|
799
798
|
);
|
|
800
799
|
}, Me = k(
|
|
801
|
-
(g,
|
|
800
|
+
(g, b, w) => N ? N(g, b, w, H) : H(g),
|
|
802
801
|
[N, H]
|
|
803
802
|
), Pe = k(
|
|
804
803
|
(g) => {
|
|
@@ -810,17 +809,17 @@ const $e = ({
|
|
|
810
809
|
if (T && T.length < $.length && I.current) {
|
|
811
810
|
const g = I.current.querySelectorAll(
|
|
812
811
|
".humany-guide-list > ul > li"
|
|
813
|
-
),
|
|
812
|
+
), b = g[T.length];
|
|
814
813
|
if (g.length === $.length && T.length) {
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
817
|
-
const L =
|
|
814
|
+
const w = g[T.length];
|
|
815
|
+
if (w) {
|
|
816
|
+
const L = w.querySelector(
|
|
818
817
|
".humany-guide-link"
|
|
819
818
|
);
|
|
820
819
|
L && L.focus();
|
|
821
820
|
}
|
|
822
821
|
} else
|
|
823
|
-
|
|
822
|
+
b && new MutationObserver((L, C) => {
|
|
824
823
|
L.forEach((D) => {
|
|
825
824
|
if (D.addedNodes) {
|
|
826
825
|
const A = Array.from(
|
|
@@ -829,7 +828,7 @@ const $e = ({
|
|
|
829
828
|
A && Ge(I.current, document.activeElement) && (Q && A.focus(), C.disconnect());
|
|
830
829
|
}
|
|
831
830
|
});
|
|
832
|
-
}).observe(
|
|
831
|
+
}).observe(b, {
|
|
833
832
|
attributes: !1,
|
|
834
833
|
characterData: !1,
|
|
835
834
|
childList: !0,
|