@telia-ace/widget-types-grid 1.1.8 → 1.2.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.
Files changed (3) hide show
  1. package/index.js +5 -5
  2. package/index.mjs +65 -61
  3. package/package.json +6 -6
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ne=Object.create;var G=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(t,n,e)=>n in t?G(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ce=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of se(n))!re.call(t,s)&&s!==e&&G(t,s,{get:()=>n[s],enumerable:!(i=ie(n,s))||i.enumerable});return t};var V=(t,n,e)=>(e=t!=null?ne(oe(t)):{},ce(n||!t||!t.__esModule?G(e,"default",{value:t,enumerable:!0}):e,t));var L=(t,n,e)=>(ae(t,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),q=require("@emotion/react"),b=require("@telia-ace/widget-core"),d=require("@telia-ace/widget-ui"),y=require("react"),P=require("@emotion/styled"),M=require("@telia-ace/widget-utilities"),K=require("react-transition-group"),_=require("react-router"),ue=require("@telia-ace/widget-routing"),l=require("@telia-ace/widget-services"),le=require("@webprovisions/bootstrapping"),Q=require("@webprovisions/platform");var U=(t=>(t.back="back",t.forth="forth",t))(U||{});const de=(t,n,e)=>typeof e[t]=="number"&&typeof e[n]=="number"&&e[t]>e[n]?"back":"forth",Z=({views:t,location:n,render:e})=>g.jsx(_.Switch,{location:n&&{...n,pathname:n.pathname.split("?")[0]},children:[...Object.keys(t).filter(i=>!!t[i].path),...Object.keys(t).filter(i=>!t[i].path)].map(i=>{const{path:s}=t[i];return s?Array.isArray(s)?s.map(o=>g.jsx(_.Route,{exact:!0,path:o,render:()=>e(i)},i)):g.jsx(_.Route,{exact:!0,path:s,render:()=>e(i)},i):g.jsx(_.Route,{render:()=>e(i)},i)})}),he=P.div`
1
+ "use strict";var ne=Object.create;var G=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(t,n,e)=>n in t?G(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ce=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of se(n))!re.call(t,s)&&s!==e&&G(t,s,{get:()=>n[s],enumerable:!(i=ie(n,s))||i.enumerable});return t};var V=(t,n,e)=>(e=t!=null?ne(oe(t)):{},ce(n||!t||!t.__esModule?G(e,"default",{value:t,enumerable:!0}):e,t));var L=(t,n,e)=>(ae(t,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),q=require("@emotion/react"),b=require("@telia-ace/widget-core"),d=require("@telia-ace/widget-ui"),y=require("react"),P=require("@emotion/styled"),M=require("@telia-ace/widget-utilities"),K=require("react-transition-group"),_=require("react-router"),ue=require("@telia-ace/widget-routing"),l=require("@telia-ace/widget-services"),le=require("@webprovisions/bootstrapping"),Q=require("@webprovisions/platform");var U=(t=>(t.back="back",t.forth="forth",t))(U||{});const de=(t,n,e)=>typeof e[t]=="number"&&typeof e[n]=="number"&&e[t]>e[n]?"back":"forth",Z=({views:t,location:n,render:e})=>f.jsx(_.Switch,{location:n&&{...n,pathname:n.pathname.split("?")[0]},children:[...Object.keys(t).filter(i=>!!t[i].path),...Object.keys(t).filter(i=>!t[i].path)].map(i=>{const{path:s}=t[i];return s?Array.isArray(s)?s.map(o=>f.jsx(_.Route,{exact:!0,path:o,render:()=>e(i)},i)):f.jsx(_.Route,{exact:!0,path:s,render:()=>e(i)},i):f.jsx(_.Route,{render:()=>e(i)},i)})}),he=P.div`
2
2
  position: relative;
3
3
  width: 100%;
4
4
  flex: 1;
@@ -8,9 +8,9 @@
8
8
  right: 0;
9
9
  ${t=>!!t.animationCss&&t.animationCss}
10
10
  ${t=>!!t.scrollableCss&&t.scrollableCss}
11
- `,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,i]=y.useState("index"),[s,o]=y.useState(U.forth),r=d.useRouteData(),a=d.useRouter(),c=d.useProperties(),f=d.useContext(),h=d.useContainer(),u=d.useComponentNode(),{gap:m="0"}=f,{columns:w=1,animation:S="none",scrollable:p=!1,...v}=c,[C,A]=d.useScroll(p);if(!u||!a)return null;const{location:k}=a;r.name!==e&&r.name!==""&&S&&(o(de(e,r.name,me)),i(r.name));const{views:N}=h.get("$settings");if(!Object.keys(N).length)return null;const x=(O,D,R)=>{const E=T(D,R),j=u.getChildren(O)[0];return g.jsx(pe,{...n,...v,scrollableCss:C,ref:A,columns:w,gap:m,...E,className:M.appendClassNames(t,"humany-view"),children:g.jsx(B,{id:j.id,branch:"default"})})},T=(O,D)=>{if(S==="slide"||S==="fade")return{animationCss:d.transitionComposer.composeViewTransition(O,S,D),"data-state":O}};return g.jsx(he,{className:"humany-animated-view",children:g.jsx(K.TransitionGroup,{component:null,childFactory:O=>y.cloneElement(O,{direction:s}),children:g.jsx(K.Transition,{timeout:{enter:500,exit:500},onEnter:O=>O==null?void 0:O.clientHeight,unmountOnExit:!0,direction:U.forth,children:(O,{direction:D})=>g.jsx(Z,{views:N,location:k,render:R=>x(R,O,D)})},e)})})},fe=P(d.Grid)`
11
+ `,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,i]=y.useState("index"),[s,o]=y.useState(U.forth),r=d.useRouteData(),a=d.useRouter(),c=d.useProperties(),g=d.useContext(),h=d.useContainer(),u=d.useComponentNode(),{gap:m="0"}=g,{columns:w=1,animation:S="none",scrollable:p=!1,...v}=c,[C,A]=d.useScroll(p);if(!u||!a)return null;const{location:k}=a;r.name!==e&&r.name!==""&&S&&(o(de(e,r.name,me)),i(r.name));const{views:D}=h.get("$settings");if(!Object.keys(D).length)return null;const x=(O,N,R)=>{const E=T(N,R),j=u.getChildren(O)[0];return f.jsx(pe,{...n,...v,scrollableCss:C,ref:A,columns:w,gap:m,...E,className:M.appendClassNames(t,"humany-view"),children:f.jsx(B,{id:j.id,branch:"default"})})},T=(O,N)=>{if(S==="slide"||S==="fade")return{animationCss:d.transitionComposer.composeViewTransition(O,S,N),"data-state":O}};return f.jsx(he,{className:"humany-animated-view",children:f.jsx(K.TransitionGroup,{component:null,childFactory:O=>y.cloneElement(O,{direction:s}),children:f.jsx(K.Transition,{timeout:{enter:500,exit:500},onEnter:O=>O==null?void 0:O.clientHeight,unmountOnExit:!0,direction:U.forth,children:(O,{direction:N})=>f.jsx(Z,{views:D,location:k,render:R=>x(R,O,N)})},e)})})},fe=P(d.Grid)`
12
12
  ${t=>!!t.scrollableCss&&t.scrollableCss}
13
- `,be=({className:t="",...n})=>{const e=d.useProperties(),i=d.useContext(),s=d.useContainer(),o=d.useComponentNode(),{views:r}=s.get("$settings"),{gap:a="0"}=i,{columns:c=1,animation:f="none",scrollable:h=!1,...u}=e,[m,w]=d.useScroll(h);return o?g.jsx(fe,{...n,...u,scrollableCss:m,ref:w,columns:c,gap:a,className:M.appendClassNames(t,"humany-view"),children:g.jsx(Z,{views:r,render:S=>{const p=o.getChildren(S)[0];return g.jsx(B,{id:p.id,node:p,branch:"default"})}})}):null},W=t=>{var n,e;return q.css`
13
+ `,be=({className:t="",...n})=>{const e=d.useProperties(),i=d.useContext(),s=d.useContainer(),o=d.useComponentNode(),{views:r}=s.get("$settings"),{gap:a="0"}=i,{columns:c=1,animation:g="none",scrollable:h=!1,...u}=e,[m,w]=d.useScroll(h);return o?f.jsx(fe,{...n,...u,scrollableCss:m,ref:w,columns:c,gap:a,className:M.appendClassNames(t,"humany-view"),children:f.jsx(Z,{views:r,render:S=>{const p=o.getChildren(S)[0];return f.jsx(B,{id:p.id,node:p,branch:"default"})}})}):null},W=t=>{var n,e;return q.css`
14
14
  outline: none;
15
15
  box-sizing: border-box;
16
16
  * {
@@ -50,7 +50,7 @@
50
50
  `,Se=y.forwardRef(({className:t="",children:n,...e},i)=>{const s=d.useComponent(),{name:o,type:r,id:a}=d.useComponentDescriptor(),c=y.useMemo(()=>s?P(s)`
51
51
  ${W}
52
52
  ${d.filterCssPropsStyle}
53
- `:null,[s]);return typeof s>"u"?null:s===null||c===null?process.env.NODE_ENV!=="production"?g.jsx(ve,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:M.appendClassNames(t,"humany-non-resolved-component"),children:g.jsx(d.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:g.jsx(y.Suspense,{fallback:null,children:g.jsx(c,{ref:i,...e,className:M.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),Ce=t=>{const n=d.useComponentNode(t),e=d.useComponentPlatform(),[i,s]=y.useState({}),o=d.useIsMounted();return y.useEffect(()=>{n&&o.current&&s(n.attributes.properties)},[n,t,o]),y.useEffect(()=>{if(e){const r=e.events.subscribe("components:properties-changed",(a,c)=>{n===c.node&&o.current&&s(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),i},Oe=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,B=y.forwardRef(({className:t="",id:n,branch:e,node:i,ariaLabel:s,tabIndex:o,context:r,...a},c)=>{const f=d.useComponentPlatform(),h=d.useContainer(),[u,m]=y.useState(),w=d.useColumns(),S=d.useContext(n),p=Ce(n),{size:v="none",indent:C=0}=d.useLayout(n),A=Oe(v,i);if(y.useEffect(()=>{if(f){if(n&&!i){const E=f.nodes.get(n);if(E&&(m(b.asDescriptor(E,e)),A)){const j=E.mount(h);return()=>{j()}}}else if(i){m(b.asDescriptor(i,e));const E=i.mount(h);return()=>{E()}}}},[f,n,i,A]),!u||!A)return null;const k={...S,...r||{}},{cardinal:N,fonts:x={},accessibility:T={},...O}=k,D={type:x.type,base:x.base||"16px",small:x.small||"0.8em",normal:x.normal||"1em",medium:x.medium||"1.2em",large:x.large||"1.6em",huge:x.huge||"2.5em"},R={...O,fonts:D,accessibility:{...T}};return typeof N=="number"&&(R.sizes={cardinal:N,small:`${N}px`,normal:`${N*3}px`,medium:`${N*5}px`,large:`${N*8}px`}),g.jsx(q.ThemeProvider,{theme:R,children:g.jsx(d.ComponentNodeContext.Provider,{value:u,children:g.jsx(d.ComponentPropertyContext.Provider,{value:p,children:(()=>{const E={"data-width":v==="full"?w:Math.min(v,w),"data-indent":C,"data-name":u.name,"data-node-id":u.id,"data-component-type":u.type,"aria-label":s,tabIndex:o,id:u.id,role:p.role?p&&p.role:null,...a};switch(u.type){case"view":return typeof p.animation=="string"&&p.animation!=="none"?g.jsx(we,{...E,className:t}):g.jsx(ye,{...E,className:t});default:{const j=d.filterCssProps(p);return g.jsx(Se,{ref:c,...E,...j,className:t})}}})()})})})}),J=({builder:t})=>{const n=d.useContainer(),[e,i]=y.useState(null);return y.useEffect(()=>{n.getAsync("components").then(s=>t(s).then(o=>{i(o)}))},[]),y.useEffect(()=>()=>{e&&n.getAsync("components").then(s=>{s.nodes.detached=s.nodes.detached.filter(o=>o.id!==e.id)})},[e]),e?g.jsx(B,{id:e.id,node:e,branch:"default"}):null},xe=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"})),Ee=y.lazy(()=>Promise.resolve().then(()=>xe)),Me=({showSearch:t=!1})=>{const n=q.useTheme(),e=d.useContainer();return g.jsx(y.Suspense,{fallback:null,children:g.jsx(Ee,{builder:i=>e.get("settings").then(s=>{var f;const{properties:o,context:r}=Object.keys(s.components).reduce((h,u)=>(s.components[u].type==="not-found"&&(h.properties=s.components[u].properties,h.context=s.components[u].context),h),{properties:{},context:{}});o.showSearch=t;const a=i.createNode("area",{detached:!0});if(a.name="not-found-area",a.writeLayout({size:"full"}),t){const h=Object.keys(s.components).reduce((m,w)=>s.components[w].type==="search"?s.components[w].properties:m,{}),u=i.createNode("search",{detached:!0});u.writeLayout({size:"full"}),u.writeProperties({"css-margin-bottom":((f=n==null?void 0:n.sizes)==null?void 0:f.normal)||"15px",...h}),a.appendChild(u)}const c=i.createNode("not-found",{detached:!0});return c.writeLayout({size:"full"}),c.writeProperties(o),c.writeContext(r),a.appendChild(c),a})})})},Ae=t=>{if(t){const{type:n,content:e}=t;switch(n){case"FontAwesome":return`<i class="humany-icon fa fa-${e}"></i>`;case"Uri":return`<i class="humany-icon humany-custom-icon" style="background: url(${e}) no-repeat center center;background-size: contain;"></i>`;default:return""}}},Ne=t=>{const n=(s,o)=>{s&&(o?s.classList.add("humany-tabbing"):s.classList.remove("humany-tabbing"))},e=s=>{s.key==="Tab"?n(t,!0):s.key==="Enter"&&document.activeElement&&document.activeElement.classList.contains("humany-trigger")||n(t,!1)},i=s=>{document.activeElement&&document.activeElement.classList.contains("humany-trigger")&&document.activeElement.classList.contains("humany-tabbing")||n(t,!1)};return document.addEventListener("keydown",e),document.addEventListener("click",i),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",i)}};function De(t,n){const{symbol:e,widgetName:i,label:s="",ariaLabel:o="",tooltip:r=""}=n;t.classList.add("humany-trigger"),t.classList.add(`humany_${i}`),s.length&&t.classList.add("humany-has-text"),o.length&&!t.getAttribute("aria-label")&&t.setAttribute("aria-label",o),o.length&&!t.getAttribute("tabindex")&&t.setAttribute("tabindex","0"),r.length&&!t.getAttribute("title")&&t.setAttribute("title",r);const a=Ae(e)||"";return t.innerHTML=`${a}
53
+ `:null,[s]);return typeof s>"u"?null:s===null||c===null?process.env.NODE_ENV!=="production"?f.jsx(ve,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:M.appendClassNames(t,"humany-non-resolved-component"),children:f.jsx(d.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:f.jsx(y.Suspense,{fallback:null,children:f.jsx(c,{ref:i,...e,className:M.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),Ce=t=>{const n=d.useComponentNode(t),e=d.useComponentPlatform(),[i,s]=y.useState({}),o=d.useIsMounted();return y.useEffect(()=>{n&&o.current&&s(n.attributes.properties)},[n,t,o]),y.useEffect(()=>{if(e){const r=e.events.subscribe("components:properties-changed",(a,c)=>{n===c.node&&o.current&&s(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),i},Oe=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,B=y.forwardRef(({className:t="",id:n,branch:e,node:i,ariaLabel:s,tabIndex:o,context:r,...a},c)=>{const g=d.useComponentPlatform(),h=d.useContainer(),[u,m]=y.useState(),w=d.useColumns(),S=d.useContext(n),p=Ce(n),{size:v="none",indent:C=0}=d.useLayout(n),A=Oe(v,i);if(y.useEffect(()=>{if(g){if(n&&!i){const E=g.nodes.get(n);if(E&&(m(b.asDescriptor(E,e)),A)){const j=E.mount(h);return()=>{j()}}}else if(i){m(b.asDescriptor(i,e));const E=i.mount(h);return()=>{E()}}}},[g,n,i,A]),!u||!A)return null;const k={...S,...r||{}},{cardinal:D,fonts:x={},accessibility:T={},...O}=k,N={type:x.type,base:x.base||"16px",small:x.small||"0.8em",normal:x.normal||"1em",medium:x.medium||"1.2em",large:x.large||"1.6em",huge:x.huge||"2.5em"},R={...O,fonts:N,accessibility:{...T}};return typeof D=="number"&&(R.sizes={cardinal:D,small:`${D}px`,normal:`${D*3}px`,medium:`${D*5}px`,large:`${D*8}px`}),f.jsx(q.ThemeProvider,{theme:R,children:f.jsx(d.ComponentNodeContext.Provider,{value:u,children:f.jsx(d.ComponentPropertyContext.Provider,{value:p,children:(()=>{const E={"data-width":v==="full"?w:Math.min(v,w),"data-indent":C,"data-name":u.name,"data-node-id":u.id,"data-component-type":u.type,"aria-label":s,tabIndex:o,id:u.id,role:p.role?p&&p.role:null,...a};switch(u.type){case"view":return typeof p.animation=="string"&&p.animation!=="none"?f.jsx(we,{...E,className:t}):f.jsx(ye,{...E,className:t});default:{const j=d.filterCssProps(p);return f.jsx(Se,{ref:c,...E,...j,className:t})}}})()})})})}),J=({builder:t})=>{const n=d.useContainer(),[e,i]=y.useState(null);return y.useEffect(()=>{n.getAsync("components").then(s=>t(s).then(o=>{i(o)}))},[]),y.useEffect(()=>()=>{e&&n.getAsync("components").then(s=>{s.nodes.detached=s.nodes.detached.filter(o=>o.id!==e.id)})},[e]),e?f.jsx(B,{id:e.id,node:e,branch:"default"}):null},xe=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"})),Ee=y.lazy(()=>Promise.resolve().then(()=>xe)),Me=({showSearch:t=!1})=>{const n=q.useTheme(),e=d.useContainer();return f.jsx(y.Suspense,{fallback:null,children:f.jsx(Ee,{builder:i=>e.get("settings").then(s=>{var g;const{properties:o,context:r}=Object.keys(s.components).reduce((h,u)=>(s.components[u].type==="not-found"&&(h.properties=s.components[u].properties,h.context=s.components[u].context),h),{properties:{},context:{}});o.showSearch=t;const a=i.createNode("area",{detached:!0});if(a.name="not-found-area",a.writeLayout({size:"full"}),t){const h=Object.keys(s.components).reduce((m,w)=>s.components[w].type==="search"?s.components[w].properties:m,{}),u=i.createNode("search",{detached:!0});u.writeLayout({size:"full"}),u.writeProperties({"css-margin-bottom":((g=n==null?void 0:n.sizes)==null?void 0:g.normal)||"15px",...h}),a.appendChild(u)}const c=i.createNode("not-found",{detached:!0});return c.writeLayout({size:"full"}),c.writeProperties(o),c.writeContext(r),a.appendChild(c),a})})})},Ae=t=>{if(t){const{type:n,content:e}=t;switch(n){case"FontAwesome":return`<i class="humany-icon fa fa-${e}"></i>`;case"Uri":return`<i class="humany-icon humany-custom-icon" style="background: url(${e}) no-repeat center center;background-size: contain;"></i>`;default:return""}}},De=t=>{const n=(s,o)=>{s&&(o?s.classList.add("humany-tabbing"):s.classList.remove("humany-tabbing"))},e=s=>{s.key==="Tab"?n(t,!0):s.key==="Enter"&&document.activeElement&&document.activeElement.classList.contains("humany-trigger")||n(t,!1)},i=s=>{document.activeElement&&document.activeElement.classList.contains("humany-trigger")&&document.activeElement.classList.contains("humany-tabbing")||n(t,!1)};return document.addEventListener("keydown",e),document.addEventListener("click",i),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",i)}};function Ne(t,n){const{symbol:e,widgetName:i,label:s="",ariaLabel:o="",tooltip:r=""}=n;t.classList.add("humany-trigger"),t.classList.add(`humany_${i}`),s.length&&t.classList.add("humany-has-text"),o.length&&!t.getAttribute("aria-label")&&t.setAttribute("aria-label",o),o.length&&!t.getAttribute("tabindex")&&t.setAttribute("tabindex","0"),r.length&&!t.getAttribute("title")&&t.setAttribute("title",r);const a=Ae(e)||"";return t.innerHTML=`${a}
54
54
  <span class="humany-close">
55
55
  <svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
56
56
  <path d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z" fill="white"/>
@@ -68,4 +68,4 @@
68
68
  stroke-miterlimit="10" />
69
69
  </svg>
70
70
  </span>
71
- ${s.length?`<span>${s}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),Ne(t)}function Le(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.remove("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.remove("humany-active"),e.classList.remove("humany-loading")})}function $e(t){t instanceof HTMLElement?(t.classList.remove("humany-active"),t.classList.add("humany-loading")):t instanceof Array&&t.forEach(n=>{n.classList.remove("humany-active"),n.classList.add("humany-loading")})}function X(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.add("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.add("humany-active"),e.classList.remove("humany-loading")})}var $=(t=>(t.Inline="inline",t.Link="link",t.Badge="badge",t.Unsupported="unsupported",t))($||{});const Pe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",ee=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",Re=(t,n,e,i,s=!1)=>{var f,h;const o=Pe(n,e),r=ee(i),a={widgetDOMElement:n?n.cloneNode(!0):void 0,triggerDOMElement:e?e.cloneNode(!0):void 0},c={triggerType:r,cachedOriginals:a,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=n||document.createElement("div"),r!=="inline"&&(c.triggerDOMElement=e);break}case"widgetDOM":{if(c.widgetDOMElement=n||document.createElement("div"),r!=="inline"){const u=document.body.appendChild(document.createElement("a"));r==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,r==="inline"?(u.id=(e==null?void 0:e.id)||"",s?(u.style.display="none",(f=e==null?void 0:e.parentNode)==null||f.appendChild(u),c.callback=()=>{var m;(m=e==null?void 0:e.parentNode)==null||m.replaceChild(u,e),u.style.display=(e==null?void 0:e.style.display)||"block"}):(h=e==null?void 0:e.parentNode)==null||h.replaceChild(u,e),c.cachedOriginals.widgetDOMElement=e,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=e);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,r!=="inline"){const m=document.body.appendChild(document.createElement("a"));r==="link"&&(m.innerText=t),c.triggerDOMElement=m}break}}return c},ke="modals";class je{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const i=this.container.get("$widget");this.options.widgetDOMElement.classList.add("humany-widget"),this.options.widgetDOMElement.classList.add(`humany_${i.name}`);const s=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...s,this.options.widgetDOMElement])}render(){const{widgetDOMElement:n,triggerDOMElement:e}=this.options,i=this.container.get("$widget");return n.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===$.Badge&&$e(e),Promise.resolve().then(()=>require("./render-ec465011.js")).then(s=>s.default(this.container,n)).then(()=>{if(n.setAttribute("data-rendered","true"),e&&this.options.triggerType===$.Badge){const o=this.options.triggerOptions.openTooltip;X(e,o)}M.notifyDataLoaded(this.container,n);const s=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{s.find(a=>a.name===r.name&&a.state==="activated")&&i.events.dispatch("widget:modal-opened",r)})})}))}renderBadge(n){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:i}=this.container.get("$widget"),{label:s,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,f={closedTooltip:a,openTooltip:c};this.options.triggerOptions=f;const h=De(e,{label:s,symbol:o,ariaLabel:r,widgetName:i,tooltip:a});this.unsubscribe.push(h)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.js")).then(n=>{var s,o,r,a;const{triggerDOMElement:e,widgetDOMElement:i}=this.options;n.default(i),this.options.cachedOriginals.widgetDOMElement&&i&&((s=i.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,i)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=i.parentNode)==null||r.removeChild(i),(a=e==null?void 0:e.parentNode)==null||a.removeChild(e)})}}const I="changesets",Ve=t=>{const n={tags:t.tags};return t.context&&typeof t.context!="function"&&(n.context=t.context),t.properties&&typeof t.properties!="function"&&(n.properties=t.properties),t.layout&&typeof t.layout!="function"&&(n.layout=t.layout),n};class F{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return l.createStorageWriter(n,I,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>new F(n,e))}write(n,e,i,s){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((o={})=>{const{keys:r=[],items:a={}}=o,c=r.indexOf(n);return c>-1&&r.splice(c,1),r.push(n),a[n]={options:s,attributes:Ve(i),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e,o=i.indexOf(n);if(o>-1)return i.splice(o,1),delete s[n],this.storageWriter(e)}))}load(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e;i.forEach(o=>{const r=s[o];if(r){const{rules:a,attributes:c,options:f}=r;n.write({attributes:c,options:f,target:new b.ComponentQuery(n,a)})}})}))}}const We=t=>{const{container:n}=t;return F.create(n).then(e=>{const i=n.get("$settings"),s={localStorage:e},o=new b.ComponentPlatform(t,s),r=b.createComponentModel(o,i);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===Q.WidgetState.Deactivating&&r()}),o})},_e=t=>import("@telia-ace/widget-routing").then(({RoutingService:n,HistoryMode:e})=>t.get("settings").then(i=>{const{routing:{initialPath:s="/",mode:o=e.scopedHash,basePath:r},views:a}=i;return new n(t,{initialPath:s,mode:o,routes:Object.keys(a).map(f=>({name:f,path:a[f].path})),basePath:r})})),Ie=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),ze=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),qe=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Be=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>We(t.get("$widget"))),H="$settings",z="open",Y="activeStickyWidget";class te extends Q.WidgetType{constructor(e){super(e);L(this,"outlets",new Map);L(this,"activated");L(this,"subs",[]);L(this,"handleBootstrapping",e=>{const i={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(s=>{const{activate:o}=s;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(i)))})});this.container.registerAsync("storage",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((i={})=>({...this.container.get("$settings"),...i}))),le.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>qe(this.container)),this.container.registerAsync("router",()=>_e(this.container)),this.container.registerAsync("actionResolver",()=>ze(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Be(this.container))}initialize(){const e=this.container.getManyAsync("actionResolver","router","components"),i=this.container.get("csp");return i&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=i.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:s,router:o,components:r},a])=>{var h;s.subscribe(this.widget.name,(u,m,w)=>this.onAction(m,w));const c=u=>{r.nodes.query({type:"view"}).forEach(m=>{r.setSwitch(m,u)})},f=((h=o.getInitialRoute())==null?void 0:h.name)||"index";return c(f),this.events.subscribe("widget:data-loaded",(u,{element:m})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:m})}),this.events.subscribe("router:change",(u,{previous:m={routeData:{}},next:w={routeData:{}}})=>{const{routeData:S}=m,{routeData:p}=w,v=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!p.name&&v?c(v):c(p.name),M.removeNullAndUndefinedValues(S&&S.params),M.removeNullAndUndefinedValues(p&&p.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:p,previous:S})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:i})=>{var w,S;const{widgetDOMElement:s,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,f=ee(i)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,h=Re(this.widget.name,s,r,i,f);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const p=()=>v.querySelectorAll("[data-loading=true]").length===0,[v]=this.widget.container.get("widgetDOMElements"),C=(N,x)=>{p()&&(h.callback&&h.callback(),x.disconnect())},A={attributes:!0,subtree:!0,childList:!0};p()&&h.callback&&h.callback(),new MutationObserver(C).observe(v,A)};f&&this.widget.container.getAsync("dataClient").then(({events:p})=>{p.subscribe("data-client:fetched",(v,C)=>{C.unresolvedQueries===0&&u()})});const m=this.getOrCreateViewOutlet(o,h);if(this.outlets.set(o,m),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),h.triggerType===$.Badge&&i&&((w=h.triggerDOMElement)==null||w.setAttribute("aria-expanded","false"),m==null||m.renderBadge(i)),h.triggerType!==$.Inline&&((S=h.triggerDOMElement)==null||S.addEventListener("click",p=>{p.preventDefault(),this.container.get("settings").then(({trigger:v})=>{m.render().then(()=>this.renderState()).then(C=>v&&v.action&&v.action==="hide"?C===b.WidgetRenderState.open?this.hide():this.open():C===b.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(p=>{this.triggerStateIfApplicable(p)});if(a)return a==="storage"?this.renderState().then(p=>{if(h.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(p)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const i=this.outlets.get(e);i==null||i.dispose(),this.outlets.delete(e);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${e}`);return}this.outlets.forEach(i=>{i.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(i=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),i.start();break;default:return}})}getOrCreateViewOutlet(e,i){return this.outlets.has(e)?this.outlets.get(e):new je(this.container,i)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const i={...e,withRenderState:"open"};return this.attach(i)}return this.attach(e)}activate(e){e!=null&&e.override&&this.setSettings(()=>e.override),e!=null&&e.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",e.apiNotificationPriorityBy)}setSettings(e){return Promise.all([this.container.get("settings"),l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local})]).then(([i,s])=>Promise.resolve(e(i)).then(o=>s(o).then(()=>{const r={...i,...o};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>e()).then(()=>this.container.get("settings")).then(e=>{this.widget.events.dispatch("widget:settings-updated",e)})}action({action:e,value:i}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,e,i)})}renderState(){if(ue.onWidgetUrl(this.container))return Promise.resolve(b.WidgetRenderState.open);const e=()=>l.readStorage(this.container,z,l.StorageMedium.Session).then((s=b.WidgetRenderState.closed)=>s),i=()=>l.readStorage(this.container,z,l.StorageMedium.Session).then((s=b.WidgetRenderState.closed)=>s);return this.container.getAsync("router").then(s=>s.isSticky()?i().then(o=>o===b.WidgetRenderState.open?o:e()):e())}hide(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>{this.widget.events.dispatch("tracking:widget-minimized",{}),this.onClose()})}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(e,i){switch(e){case"close":case"open":case"hide":const s=e==="open"?b.WidgetRenderState.open:e==="close"?b.WidgetRenderState.closed:b.WidgetRenderState.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===b.WidgetRenderState.open),s!==b.WidgetRenderState.hidden?s===b.WidgetRenderState.open?this.onOpen():this.onClose():this.outlets.forEach(o=>{var r;return(r=o.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(e){const{invoke:i,events:s}=this.container.get("$widget");return Promise.all([l.createStorageWriter(this.container,z,l.StorageCategory.Necessary,{medium:l.StorageMedium.Session}),l.createStorageWriter(this.container,z,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,duration:{minutes:5}}),this.container.getAsync("router"),i("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),s.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(i=>{var s,o;i.options.triggerDOMElement&&(i.options.triggerDOMElement.setAttribute("aria-expanded","true"),(s=i.options.widgetDOMElement)==null||s.setAttribute("tabindex","-1"),(o=i.options.widgetDOMElement)==null||o.focus())}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return(()=>this.container.get("settings").then(s=>{const{activate:o}=this.container.get("$settings");return s.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}))().then(()=>e).then(({router:s,components:o})=>{const r=o.nodes.visible;return this.outlets.forEach(a=>{var c;return(c=a.options.triggerDOMElement)==null?void 0:c.setAttribute("aria-expanded","false")}),r.filter(a=>a.attributes.properties.animation&&a.attributes.properties.animation!=="none").length?new Promise(a=>{setTimeout(()=>{a(s)},200)}):Promise.resolve(s)}).then(s=>s.stop())}setTriggerState(e){this.outlets.forEach(i=>{const{options:{triggerDOMElement:s,triggerOptions:o}}=i,{openTooltip:r,closedTooltip:a}=o||{};s&&(e?X(s,r):Le(s,a))})}deactivate(){this.subs.forEach(i=>i());const e=[];return this.outlets.forEach(i=>e.push(i.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(i=>i===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(s=>s()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=J;exports.GridWidget=te;exports.NotFound=Me;exports.Widget=te;exports.genericComponentStyling=W;
71
+ ${s.length?`<span>${s}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),De(t)}function Le(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.remove("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.remove("humany-active"),e.classList.remove("humany-loading")})}function $e(t){t instanceof HTMLElement?(t.classList.remove("humany-active"),t.classList.add("humany-loading")):t instanceof Array&&t.forEach(n=>{n.classList.remove("humany-active"),n.classList.add("humany-loading")})}function X(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.add("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.add("humany-active"),e.classList.remove("humany-loading")})}var $=(t=>(t.Inline="inline",t.Link="link",t.Badge="badge",t.Unsupported="unsupported",t))($||{});const Pe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",ee=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",Re=(t,n,e,i,s=!1)=>{var g,h;const o=Pe(n,e),r=ee(i),a={widgetDOMElement:n?n.cloneNode(!0):void 0,triggerDOMElement:e?e.cloneNode(!0):void 0},c={triggerType:r,cachedOriginals:a,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=n||document.createElement("div"),r!=="inline"&&(c.triggerDOMElement=e);break}case"widgetDOM":{if(c.widgetDOMElement=n||document.createElement("div"),r!=="inline"){const u=document.body.appendChild(document.createElement("a"));r==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,r==="inline"?(u.id=(e==null?void 0:e.id)||"",s?(u.style.display="none",(g=e==null?void 0:e.parentNode)==null||g.appendChild(u),c.callback=()=>{var m;(m=e==null?void 0:e.parentNode)==null||m.replaceChild(u,e),u.style.display=(e==null?void 0:e.style.display)||"block"}):(h=e==null?void 0:e.parentNode)==null||h.replaceChild(u,e),c.cachedOriginals.widgetDOMElement=e,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=e);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,r!=="inline"){const m=document.body.appendChild(document.createElement("a"));r==="link"&&(m.innerText=t),c.triggerDOMElement=m}break}}return c},ke="modals";class je{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);var o,r,a,c,g;this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const i=this.container.get("$widget");(o=this.options.widgetDOMElement)==null||o.classList.add("humany-widget"),(r=this.options.widgetDOMElement)==null||r.setAttribute("role","region"),(a=this.options.widgetDOMElement)==null||a.setAttribute("id",`humany_${i.name}`),(c=this.options.triggerDOMElement)==null||c.setAttribute("aria-controls",`humany_${i.name}`),(g=this.options.widgetDOMElement)==null||g.classList.add(`humany_${i.name}`);const s=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...s,this.options.widgetDOMElement])}render(){const{widgetDOMElement:n,triggerDOMElement:e}=this.options,i=this.container.get("$widget");return n.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===$.Badge&&$e(e),Promise.resolve().then(()=>require("./render-ec465011.js")).then(s=>s.default(this.container,n)).then(()=>{if(n.setAttribute("data-rendered","true"),e&&this.options.triggerType===$.Badge){const o=this.options.triggerOptions.openTooltip;X(e,o)}M.notifyDataLoaded(this.container,n);const s=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{s.find(a=>a.name===r.name&&a.state==="activated")&&i.events.dispatch("widget:modal-opened",r)})})}))}renderBadge(n){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:i}=this.container.get("$widget"),{label:s,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,g={closedTooltip:a,openTooltip:c};this.options.triggerOptions=g;const h=Ne(e,{label:s,symbol:o,ariaLabel:r,widgetName:i,tooltip:a});this.unsubscribe.push(h)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.js")).then(n=>{var s,o,r,a;const{triggerDOMElement:e,widgetDOMElement:i}=this.options;n.default(i),this.options.cachedOriginals.widgetDOMElement&&i&&((s=i.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,i)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=i.parentNode)==null||r.removeChild(i),(a=e==null?void 0:e.parentNode)==null||a.removeChild(e)})}}const I="changesets",Ve=t=>{const n={tags:t.tags};return t.context&&typeof t.context!="function"&&(n.context=t.context),t.properties&&typeof t.properties!="function"&&(n.properties=t.properties),t.layout&&typeof t.layout!="function"&&(n.layout=t.layout),n};class F{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return l.createStorageWriter(n,I,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>new F(n,e))}write(n,e,i,s){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((o={})=>{const{keys:r=[],items:a={}}=o,c=r.indexOf(n);return c>-1&&r.splice(c,1),r.push(n),a[n]={options:s,attributes:Ve(i),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e,o=i.indexOf(n);if(o>-1)return i.splice(o,1),delete s[n],this.storageWriter(e)}))}load(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e;i.forEach(o=>{const r=s[o];if(r){const{rules:a,attributes:c,options:g}=r;n.write({attributes:c,options:g,target:new b.ComponentQuery(n,a)})}})}))}}const We=t=>{const{container:n}=t;return F.create(n).then(e=>{const i=n.get("$settings"),s={localStorage:e},o=new b.ComponentPlatform(t,s),r=b.createComponentModel(o,i);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===Q.WidgetState.Deactivating&&r()}),o})},_e=t=>import("@telia-ace/widget-routing").then(({RoutingService:n,HistoryMode:e})=>t.get("settings").then(i=>{const{routing:{initialPath:s="/",mode:o=e.scopedHash,basePath:r},views:a}=i;return new n(t,{initialPath:s,mode:o,routes:Object.keys(a).map(g=>({name:g,path:a[g].path})),basePath:r})})),Ie=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),ze=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),qe=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Be=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>We(t.get("$widget"))),H="$settings",z="open",Y="activeStickyWidget";class te extends Q.WidgetType{constructor(e){super(e);L(this,"outlets",new Map);L(this,"activated");L(this,"subs",[]);L(this,"handleBootstrapping",e=>{const i={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(s=>{const{activate:o}=s;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(i)))})});this.container.registerAsync("storage",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((i={})=>({...this.container.get("$settings"),...i}))),le.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>qe(this.container)),this.container.registerAsync("router",()=>_e(this.container)),this.container.registerAsync("actionResolver",()=>ze(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Be(this.container))}initialize(){const e=this.container.getManyAsync("actionResolver","router","components"),i=this.container.get("csp");return i&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=i.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:s,router:o,components:r},a])=>{var h;s.subscribe(this.widget.name,(u,m,w)=>this.onAction(m,w));const c=u=>{r.nodes.query({type:"view"}).forEach(m=>{r.setSwitch(m,u)})},g=((h=o.getInitialRoute())==null?void 0:h.name)||"index";return c(g),this.events.subscribe("widget:data-loaded",(u,{element:m})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:m})}),this.events.subscribe("router:change",(u,{previous:m={routeData:{}},next:w={routeData:{}}})=>{const{routeData:S}=m,{routeData:p}=w,v=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!p.name&&v?c(v):c(p.name),M.removeNullAndUndefinedValues(S&&S.params),M.removeNullAndUndefinedValues(p&&p.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:p,previous:S})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:i})=>{var w,S;const{widgetDOMElement:s,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,g=ee(i)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,h=Re(this.widget.name,s,r,i,g);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const p=()=>v.querySelectorAll("[data-loading=true]").length===0,[v]=this.widget.container.get("widgetDOMElements"),C=(D,x)=>{p()&&(h.callback&&h.callback(),x.disconnect())},A={attributes:!0,subtree:!0,childList:!0};p()&&h.callback&&h.callback(),new MutationObserver(C).observe(v,A)};g&&this.widget.container.getAsync("dataClient").then(({events:p})=>{p.subscribe("data-client:fetched",(v,C)=>{C.unresolvedQueries===0&&u()})});const m=this.getOrCreateViewOutlet(o,h);if(this.outlets.set(o,m),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),h.triggerType===$.Badge&&i&&((w=h.triggerDOMElement)==null||w.setAttribute("aria-expanded","false"),m==null||m.renderBadge(i)),h.triggerType!==$.Inline&&((S=h.triggerDOMElement)==null||S.addEventListener("click",p=>{p.preventDefault(),this.container.get("settings").then(({trigger:v})=>{m.render().then(()=>this.renderState()).then(C=>v&&v.action&&v.action==="hide"?C===b.WidgetRenderState.open?this.hide():this.open():C===b.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(p=>{this.triggerStateIfApplicable(p)});if(a)return a==="storage"?this.renderState().then(p=>{if(h.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(p)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const i=this.outlets.get(e);i==null||i.dispose(),this.outlets.delete(e);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${e}`);return}this.outlets.forEach(i=>{i.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(i=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),i.start();break;default:return}})}getOrCreateViewOutlet(e,i){return this.outlets.has(e)?this.outlets.get(e):new je(this.container,i)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const i={...e,withRenderState:"open"};return this.attach(i)}return this.attach(e)}activate(e){e!=null&&e.override&&this.setSettings(()=>e.override),e!=null&&e.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",e.apiNotificationPriorityBy)}setSettings(e){return Promise.all([this.container.get("settings"),l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local})]).then(([i,s])=>Promise.resolve(e(i)).then(o=>s(o).then(()=>{const r={...i,...o};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>e()).then(()=>this.container.get("settings")).then(e=>{this.widget.events.dispatch("widget:settings-updated",e)})}action({action:e,value:i}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,e,i)})}renderState(){if(ue.onWidgetUrl(this.container))return Promise.resolve(b.WidgetRenderState.open);const e=()=>l.readStorage(this.container,z,l.StorageMedium.Session).then((s=b.WidgetRenderState.closed)=>s),i=()=>l.readStorage(this.container,z,l.StorageMedium.Session).then((s=b.WidgetRenderState.closed)=>s);return this.container.getAsync("router").then(s=>s.isSticky()?i().then(o=>o===b.WidgetRenderState.open?o:e()):e())}hide(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>{this.widget.events.dispatch("tracking:widget-minimized",{}),this.onClose()})}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(e,i){switch(e){case"close":case"open":case"hide":const s=e==="open"?b.WidgetRenderState.open:e==="close"?b.WidgetRenderState.closed:b.WidgetRenderState.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===b.WidgetRenderState.open),s!==b.WidgetRenderState.hidden?s===b.WidgetRenderState.open?this.onOpen():this.onClose():this.outlets.forEach(o=>{var r;return(r=o.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(e){const{invoke:i,events:s}=this.container.get("$widget");return Promise.all([l.createStorageWriter(this.container,z,l.StorageCategory.Necessary,{medium:l.StorageMedium.Session}),l.createStorageWriter(this.container,z,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,duration:{minutes:5}}),this.container.getAsync("router"),i("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),s.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(i=>{var s,o;i.options.triggerDOMElement&&(i.options.triggerDOMElement.setAttribute("aria-expanded","true"),(s=i.options.widgetDOMElement)==null||s.setAttribute("tabindex","-1"),(o=i.options.widgetDOMElement)==null||o.focus())}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return(()=>this.container.get("settings").then(s=>{const{activate:o}=this.container.get("$settings");return s.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}))().then(()=>e).then(({router:s,components:o})=>{const r=o.nodes.visible;return this.outlets.forEach(a=>{var c;return(c=a.options.triggerDOMElement)==null?void 0:c.setAttribute("aria-expanded","false")}),r.filter(a=>a.attributes.properties.animation&&a.attributes.properties.animation!=="none").length?new Promise(a=>{setTimeout(()=>{a(s)},200)}):Promise.resolve(s)}).then(s=>s.stop())}setTriggerState(e){this.outlets.forEach(i=>{const{options:{triggerDOMElement:s,triggerOptions:o}}=i,{openTooltip:r,closedTooltip:a}=o||{};s&&(e?X(s,r):Le(s,a))})}deactivate(){this.subs.forEach(i=>i());const e=[];return this.outlets.forEach(i=>e.push(i.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(i=>i===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(s=>s()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=J;exports.GridWidget=te;exports.NotFound=Me;exports.Widget=te;exports.genericComponentStyling=W;
package/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  var dt = Object.defineProperty;
2
2
  var ht = (e, n, t) => n in e ? dt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
3
  var x = (e, n, t) => (ht(e, typeof n != "symbol" ? n + "" : n, t), t);
4
- import { jsx as p } from "react/jsx-runtime";
4
+ import { jsx as m } from "react/jsx-runtime";
5
5
  import { css as nt, ThemeProvider as pt, useTheme as mt } from "@emotion/react";
6
6
  import { asDescriptor as X, ComponentPlatform as ft, createComponentModel as gt, ComponentQuery as bt, WidgetRenderState as O } from "@telia-ace/widget-core";
7
- import { Grid as it, useRouteData as yt, useRouter as wt, useProperties as st, useContext as Y, useContainer as z, useComponentNode as q, useScroll as ot, transitionComposer as vt, paddedBorderTabStyle as Ot, useComponent as Ct, useComponentDescriptor as Et, filterCssPropsStyle as St, Typography as At, useComponentPlatform as rt, useIsMounted as Dt, useColumns as Mt, useLayout as xt, ComponentNodeContext as Nt, ComponentPropertyContext as Lt, filterCssProps as $t } from "@telia-ace/widget-ui";
7
+ import { Grid as it, useRouteData as yt, useRouter as wt, useProperties as st, useContext as Y, useContainer as z, useComponentNode as q, useScroll as ot, transitionComposer as vt, paddedBorderTabStyle as Ot, useComponent as Ct, useComponentDescriptor as Et, filterCssPropsStyle as At, Typography as St, useComponentPlatform as rt, useIsMounted as Dt, useColumns as Mt, useLayout as xt, ComponentNodeContext as Nt, ComponentPropertyContext as Lt, filterCssProps as $t } from "@telia-ace/widget-ui";
8
8
  import Q, { useState as _, forwardRef as at, useMemo as Pt, Suspense as kt, useEffect as I } from "react";
9
9
  import L from "@emotion/styled";
10
10
  import { appendClassNames as j, notifyDataLoaded as Rt, lock as H, removeNullAndUndefinedValues as tt, uuid as Vt } from "@telia-ace/widget-utilities";
@@ -15,7 +15,7 @@ import { readStorage as D, StorageMedium as v, createStorageWriter as P, Storage
15
15
  import { supportBootstrapping as jt } from "@webprovisions/bootstrapping";
16
16
  import { WidgetState as Gt, WidgetType as Wt } from "@webprovisions/platform";
17
17
  var U = /* @__PURE__ */ ((e) => (e.back = "back", e.forth = "forth", e))(U || {});
18
- const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[e] > t[n] ? "back" : "forth", ct = ({ views: e, location: n, render: t }) => /* @__PURE__ */ p(
18
+ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[e] > t[n] ? "back" : "forth", ct = ({ views: e, location: n, render: t }) => /* @__PURE__ */ m(
19
19
  zt,
20
20
  {
21
21
  location: n && {
@@ -27,7 +27,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
27
27
  ...Object.keys(e).filter((i) => !e[i].path)
28
28
  ].map((i) => {
29
29
  const { path: s } = e[i];
30
- return s ? Array.isArray(s) ? s.map((o) => /* @__PURE__ */ p(F, { exact: !0, path: o, render: () => t(i) }, i)) : /* @__PURE__ */ p(F, { exact: !0, path: s, render: () => t(i) }, i) : /* @__PURE__ */ p(F, { render: () => t(i) }, i);
30
+ return s ? Array.isArray(s) ? s.map((o) => /* @__PURE__ */ m(F, { exact: !0, path: o, render: () => t(i) }, i)) : /* @__PURE__ */ m(F, { exact: !0, path: s, render: () => t(i) }, i) : /* @__PURE__ */ m(F, { render: () => t(i) }, i);
31
31
  })
32
32
  }
33
33
  ), Ft = L.div`
@@ -51,35 +51,35 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
51
51
  }, Yt = ({ className: e = "", ...n }) => {
52
52
  const [t, i] = _("index"), [s, o] = _(
53
53
  U.forth
54
- ), r = yt(), a = wt(), c = st(), m = Y(), u = z(), l = q(), { gap: h = "0" } = m, {
54
+ ), r = yt(), a = wt(), c = st(), p = Y(), u = z(), l = q(), { gap: h = "0" } = p, {
55
55
  columns: f = 1,
56
56
  animation: b = "none",
57
57
  scrollable: d = !1,
58
58
  ...g
59
- } = c, [y, S] = ot(d);
59
+ } = c, [y, A] = ot(d);
60
60
  if (!l || !a)
61
61
  return null;
62
62
  const { location: R } = a;
63
63
  r.name !== t && r.name !== "" && b && (o(
64
64
  Ht(t, r.name, Ut)
65
65
  ), i(r.name));
66
- const { views: A } = u.get("$settings");
67
- if (!Object.keys(A).length)
66
+ const { views: S } = u.get("$settings");
67
+ if (!Object.keys(S).length)
68
68
  return null;
69
69
  const C = (w, M, $) => {
70
70
  const E = W(M, $), V = l.getChildren(w)[0];
71
- return /* @__PURE__ */ p(
71
+ return /* @__PURE__ */ m(
72
72
  Kt,
73
73
  {
74
74
  ...n,
75
75
  ...g,
76
76
  scrollableCss: y,
77
- ref: S,
77
+ ref: A,
78
78
  columns: f,
79
79
  gap: h,
80
80
  ...E,
81
81
  className: j(e, "humany-view"),
82
- children: /* @__PURE__ */ p(Z, { id: V.id, branch: "default" })
82
+ children: /* @__PURE__ */ m(Z, { id: V.id, branch: "default" })
83
83
  }
84
84
  );
85
85
  }, W = (w, M) => {
@@ -93,22 +93,22 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
93
93
  "data-state": w
94
94
  };
95
95
  };
96
- return /* @__PURE__ */ p(Ft, { className: "humany-animated-view", children: /* @__PURE__ */ p(
96
+ return /* @__PURE__ */ m(Ft, { className: "humany-animated-view", children: /* @__PURE__ */ m(
97
97
  _t,
98
98
  {
99
99
  component: null,
100
100
  childFactory: (w) => Q.cloneElement(w, { direction: s }),
101
- children: /* @__PURE__ */ p(
101
+ children: /* @__PURE__ */ m(
102
102
  It,
103
103
  {
104
104
  timeout: { enter: 500, exit: 500 },
105
105
  onEnter: (w) => w == null ? void 0 : w.clientHeight,
106
106
  unmountOnExit: !0,
107
107
  direction: U.forth,
108
- children: (w, { direction: M }) => /* @__PURE__ */ p(
108
+ children: (w, { direction: M }) => /* @__PURE__ */ m(
109
109
  ct,
110
110
  {
111
- views: A,
111
+ views: S,
112
112
  location: R,
113
113
  render: ($) => C($, w, M)
114
114
  }
@@ -123,11 +123,11 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
123
123
  `, Qt = ({ className: e = "", ...n }) => {
124
124
  const t = st(), i = Y(), s = z(), o = q(), { views: r } = s.get("$settings"), { gap: a = "0" } = i, {
125
125
  columns: c = 1,
126
- animation: m = "none",
126
+ animation: p = "none",
127
127
  scrollable: u = !1,
128
128
  ...l
129
129
  } = t, [h, f] = ot(u);
130
- return o ? /* @__PURE__ */ p(
130
+ return o ? /* @__PURE__ */ m(
131
131
  qt,
132
132
  {
133
133
  ...n,
@@ -137,13 +137,13 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
137
137
  columns: c,
138
138
  gap: a,
139
139
  className: j(e, "humany-view"),
140
- children: /* @__PURE__ */ p(
140
+ children: /* @__PURE__ */ m(
141
141
  ct,
142
142
  {
143
143
  views: r,
144
144
  render: (b) => {
145
145
  const d = o.getChildren(b)[0];
146
- return /* @__PURE__ */ p(Z, { id: d.id, node: d, branch: "default" });
146
+ return /* @__PURE__ */ m(Z, { id: d.id, node: d, branch: "default" });
147
147
  }
148
148
  }
149
149
  )
@@ -196,9 +196,9 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
196
196
  ({ className: e = "", children: n, ...t }, i) => {
197
197
  const s = Ct(), { name: o, type: r, id: a } = Et(), c = Pt(() => s ? L(s)`
198
198
  ${G}
199
- ${St}
199
+ ${At}
200
200
  ` : null, [s]);
201
- return typeof s > "u" ? null : s === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ p(
201
+ return typeof s > "u" ? null : s === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ m(
202
202
  Xt,
203
203
  {
204
204
  ...t,
@@ -207,9 +207,9 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
207
207
  e,
208
208
  "humany-non-resolved-component"
209
209
  ),
210
- children: /* @__PURE__ */ p(At, { variant: "h5", children: "Non Resolved Component Type" })
210
+ children: /* @__PURE__ */ m(St, { variant: "h5", children: "Non Resolved Component Type" })
211
211
  }
212
- ) : null : /* @__PURE__ */ p(kt, { fallback: null, children: /* @__PURE__ */ p(
212
+ ) : null : /* @__PURE__ */ m(kt, { fallback: null, children: /* @__PURE__ */ m(
213
213
  c,
214
214
  {
215
215
  ref: i,
@@ -251,12 +251,12 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
251
251
  context: r,
252
252
  ...a
253
253
  }, c) => {
254
- const m = rt(), u = z(), [l, h] = _(), f = Mt(), b = Y(n), d = ee(n), { size: g = "none", indent: y = 0 } = xt(n), S = ne(g, i);
254
+ const p = rt(), u = z(), [l, h] = _(), f = Mt(), b = Y(n), d = ee(n), { size: g = "none", indent: y = 0 } = xt(n), A = ne(g, i);
255
255
  if (I(() => {
256
- if (m) {
256
+ if (p) {
257
257
  if (n && !i) {
258
- const E = m.nodes.get(n);
259
- if (E && (h(X(E, t)), S)) {
258
+ const E = p.nodes.get(n);
259
+ if (E && (h(X(E, t)), A)) {
260
260
  const V = E.mount(u);
261
261
  return () => {
262
262
  V();
@@ -270,10 +270,10 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
270
270
  };
271
271
  }
272
272
  }
273
- }, [m, n, i, S]), !l || !S)
273
+ }, [p, n, i, A]), !l || !A)
274
274
  return null;
275
275
  const R = { ...b, ...r || {} }, {
276
- cardinal: A,
276
+ cardinal: S,
277
277
  fonts: C = {},
278
278
  accessibility: W = {},
279
279
  ...w
@@ -292,13 +292,13 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
292
292
  ...W
293
293
  }
294
294
  };
295
- return typeof A == "number" && ($.sizes = {
296
- cardinal: A,
297
- small: `${A}px`,
298
- normal: `${A * 3}px`,
299
- medium: `${A * 5}px`,
300
- large: `${A * 8}px`
301
- }), /* @__PURE__ */ p(pt, { theme: $, children: /* @__PURE__ */ p(Nt.Provider, { value: l, children: /* @__PURE__ */ p(Lt.Provider, { value: d, children: (() => {
295
+ return typeof S == "number" && ($.sizes = {
296
+ cardinal: S,
297
+ small: `${S}px`,
298
+ normal: `${S * 3}px`,
299
+ medium: `${S * 5}px`,
300
+ large: `${S * 8}px`
301
+ }), /* @__PURE__ */ m(pt, { theme: $, children: /* @__PURE__ */ m(Nt.Provider, { value: l, children: /* @__PURE__ */ m(Lt.Provider, { value: d, children: (() => {
302
302
  const E = {
303
303
  "data-width": g === "full" ? f : Math.min(g, f),
304
304
  "data-indent": y,
@@ -313,10 +313,10 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
313
313
  };
314
314
  switch (l.type) {
315
315
  case "view":
316
- return typeof d.animation == "string" && d.animation !== "none" ? /* @__PURE__ */ p(Jt, { ...E, className: e }) : /* @__PURE__ */ p(Zt, { ...E, className: e });
316
+ return typeof d.animation == "string" && d.animation !== "none" ? /* @__PURE__ */ m(Jt, { ...E, className: e }) : /* @__PURE__ */ m(Zt, { ...E, className: e });
317
317
  default: {
318
318
  const V = $t(d);
319
- return /* @__PURE__ */ p(
319
+ return /* @__PURE__ */ m(
320
320
  te,
321
321
  {
322
322
  ref: c,
@@ -341,17 +341,17 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
341
341
  (o) => o.id !== t.id
342
342
  );
343
343
  });
344
- }, [t]), t ? /* @__PURE__ */ p(Z, { id: t.id, node: t, branch: "default" }) : null;
344
+ }, [t]), t ? /* @__PURE__ */ m(Z, { id: t.id, node: t, branch: "default" }) : null;
345
345
  }, se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
346
346
  __proto__: null,
347
347
  default: ie
348
348
  }, Symbol.toStringTag, { value: "Module" })), oe = Q.lazy(() => Promise.resolve().then(() => se)), _e = ({ showSearch: e = !1 }) => {
349
349
  const n = mt(), t = z();
350
- return /* @__PURE__ */ p(Q.Suspense, { fallback: null, children: /* @__PURE__ */ p(
350
+ return /* @__PURE__ */ m(Q.Suspense, { fallback: null, children: /* @__PURE__ */ m(
351
351
  oe,
352
352
  {
353
353
  builder: (i) => t.get("settings").then((s) => {
354
- var m;
354
+ var p;
355
355
  const { properties: o, context: r } = Object.keys(
356
356
  s.components
357
357
  ).reduce(
@@ -369,7 +369,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
369
369
  detached: !0
370
370
  });
371
371
  l.writeLayout({ size: "full" }), l.writeProperties({
372
- "css-margin-bottom": ((m = n == null ? void 0 : n.sizes) == null ? void 0 : m.normal) || "15px",
372
+ "css-margin-bottom": ((p = n == null ? void 0 : n.sizes) == null ? void 0 : p.normal) || "15px",
373
373
  ...u
374
374
  }), a.appendChild(l);
375
375
  }
@@ -453,7 +453,7 @@ function lt(e, n) {
453
453
  }
454
454
  var N = /* @__PURE__ */ ((e) => (e.Inline = "inline", e.Link = "link", e.Badge = "badge", e.Unsupported = "unsupported", e))(N || {});
455
455
  const de = (e, n) => e && n ? "both" : e ? "widgetDOM" : n ? "triggerDOM" : "none", ut = (e) => e ? typeof e == "boolean" && e ? "link" : typeof e == "object" && !Array.isArray(e) ? "badge" : "unsupported" : "inline", he = (e, n, t, i, s = !1) => {
456
- var m, u;
456
+ var p, u;
457
457
  const o = de(
458
458
  n,
459
459
  t
@@ -481,7 +481,7 @@ const de = (e, n) => e && n ? "both" : e ? "widgetDOM" : n ? "triggerDOM" : "non
481
481
  }
482
482
  case "triggerDOM": {
483
483
  const l = document.createElement("div");
484
- c.widgetDOMElement = l, r === "inline" ? (l.id = (t == null ? void 0 : t.id) || "", s ? (l.style.display = "none", (m = t == null ? void 0 : t.parentNode) == null || m.appendChild(l), c.callback = () => {
484
+ c.widgetDOMElement = l, r === "inline" ? (l.id = (t == null ? void 0 : t.id) || "", s ? (l.style.display = "none", (p = t == null ? void 0 : t.parentNode) == null || p.appendChild(l), c.callback = () => {
485
485
  var h;
486
486
  (h = t == null ? void 0 : t.parentNode) == null || h.replaceChild(
487
487
  l,
@@ -512,12 +512,16 @@ class me {
512
512
  constructor(n, t) {
513
513
  x(this, "container");
514
514
  x(this, "unsubscribe", []);
515
+ var o, r, a, c, p;
515
516
  this.options = t, this.container = n.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register(
516
517
  "triggerDOMElement",
517
518
  this.options.triggerDOMElement
518
519
  );
519
520
  const i = this.container.get("$widget");
520
- this.options.widgetDOMElement.classList.add("humany-widget"), this.options.widgetDOMElement.classList.add(`humany_${i.name}`);
521
+ (o = this.options.widgetDOMElement) == null || o.classList.add("humany-widget"), (r = this.options.widgetDOMElement) == null || r.setAttribute("role", "region"), (a = this.options.widgetDOMElement) == null || a.setAttribute("id", `humany_${i.name}`), (c = this.options.triggerDOMElement) == null || c.setAttribute(
522
+ "aria-controls",
523
+ `humany_${i.name}`
524
+ ), (p = this.options.widgetDOMElement) == null || p.classList.add(`humany_${i.name}`);
521
525
  const s = n.get("widgetDOMElements") || [];
522
526
  n.register("widgetDOMElements", [
523
527
  ...s,
@@ -554,8 +558,8 @@ class me {
554
558
  if (!t)
555
559
  return;
556
560
  t.getAttribute("role") || t.setAttribute("role", "button");
557
- const { name: i } = this.container.get("$widget"), { label: s, symbol: o, ariaLabel: r, closedTooltip: a, openTooltip: c } = n, m = { closedTooltip: a, openTooltip: c };
558
- this.options.triggerOptions = m;
561
+ const { name: i } = this.container.get("$widget"), { label: s, symbol: o, ariaLabel: r, closedTooltip: a, openTooltip: c } = n, p = { closedTooltip: a, openTooltip: c };
562
+ this.options.triggerOptions = p;
559
563
  const u = ce(t, {
560
564
  label: s,
561
565
  symbol: o,
@@ -636,10 +640,10 @@ class J {
636
640
  i.forEach((o) => {
637
641
  const r = s[o];
638
642
  if (r) {
639
- const { rules: a, attributes: c, options: m } = r;
643
+ const { rules: a, attributes: c, options: p } = r;
640
644
  n.write({
641
645
  attributes: c,
642
- options: m,
646
+ options: p,
643
647
  target: new bt(n, a)
644
648
  });
645
649
  }
@@ -673,9 +677,9 @@ const ge = (e) => {
673
677
  return new n(e, {
674
678
  initialPath: s,
675
679
  mode: o,
676
- routes: Object.keys(a).map((m) => ({
677
- name: m,
678
- path: a[m].path
680
+ routes: Object.keys(a).map((p) => ({
681
+ name: p,
682
+ path: a[p].path
679
683
  })),
680
684
  basePath: r
681
685
  });
@@ -743,8 +747,8 @@ class Ie extends Wt {
743
747
  r.nodes.query({ type: "view" }).forEach((h) => {
744
748
  r.setSwitch(h, l);
745
749
  });
746
- }, m = ((u = o.getInitialRoute()) == null ? void 0 : u.name) || "index";
747
- return c(m), this.events.subscribe("widget:data-loaded", (l, { element: h }) => {
750
+ }, p = ((u = o.getInitialRoute()) == null ? void 0 : u.name) || "index";
751
+ return c(p), this.events.subscribe("widget:data-loaded", (l, { element: h }) => {
748
752
  this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
749
753
  element: h
750
754
  });
@@ -752,7 +756,7 @@ class Ie extends Wt {
752
756
  "router:change",
753
757
  (l, { previous: h = { routeData: {} }, next: f = { routeData: {} } }) => {
754
758
  const { routeData: b } = h, { routeData: d } = f, g = Object.keys(a.views).reduce(
755
- (y, S) => typeof a.views[S].path > "u" ? S : y,
759
+ (y, A) => typeof a.views[A].path > "u" ? A : y,
756
760
  ""
757
761
  );
758
762
  !d.name && g ? c(g) : c(d.name), tt(b && b.params), tt(d && d.params), this.container.getAsync("actionResolver").then((y) => {
@@ -774,25 +778,25 @@ class Ie extends Wt {
774
778
  key: o = Vt(),
775
779
  triggerDOMElement: r,
776
780
  withRenderState: a
777
- } = t, m = ut(i) === N.Inline && ((r == null ? void 0 : r.childElementCount) || 0) > 0, u = he(
781
+ } = t, p = ut(i) === N.Inline && ((r == null ? void 0 : r.childElementCount) || 0) > 0, u = he(
778
782
  this.widget.name,
779
783
  s,
780
784
  r,
781
785
  i,
782
- m
786
+ p
783
787
  );
784
788
  this.outlets.size < 1 && !a && this.setRenderState("unset");
785
789
  const l = () => {
786
- const d = () => g.querySelectorAll("[data-loading=true]").length === 0, [g] = this.widget.container.get("widgetDOMElements"), y = (A, C) => {
790
+ const d = () => g.querySelectorAll("[data-loading=true]").length === 0, [g] = this.widget.container.get("widgetDOMElements"), y = (S, C) => {
787
791
  d() && (u.callback && u.callback(), C.disconnect());
788
- }, S = {
792
+ }, A = {
789
793
  attributes: !0,
790
794
  subtree: !0,
791
795
  childList: !0
792
796
  };
793
- d() && u.callback && u.callback(), new MutationObserver(y).observe(g, S);
797
+ d() && u.callback && u.callback(), new MutationObserver(y).observe(g, A);
794
798
  };
795
- m && this.widget.container.getAsync("dataClient").then(({ events: d }) => {
799
+ p && this.widget.container.getAsync("dataClient").then(({ events: d }) => {
796
800
  d.subscribe(
797
801
  "data-client:fetched",
798
802
  (g, y) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-types-grid",
3
- "version": "1.1.8",
3
+ "version": "1.2.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/widget-core": "^1.1.8",
14
- "@telia-ace/widget-routing": "^1.1.8",
15
- "@telia-ace/widget-services": "^1.1.8",
16
- "@telia-ace/widget-ui": "^1.1.8",
17
- "@telia-ace/widget-utilities": "^1.1.8",
13
+ "@telia-ace/widget-core": "^1.2.2",
14
+ "@telia-ace/widget-routing": "^1.2.2",
15
+ "@telia-ace/widget-services": "^1.2.2",
16
+ "@telia-ace/widget-ui": "^1.2.2",
17
+ "@telia-ace/widget-utilities": "^1.2.2",
18
18
  "@webprovisions/bootstrapping": "^1.0.14",
19
19
  "@webprovisions/platform": "^1.1.4"
20
20
  },