@assaabloy/gw-group-nav-header
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,1 +0,1 @@ | ||
!function(e){function n(n){for(var r,o,l=n[0],c=n[1],s=n[2],d=0,p=[];d<l.length;d++)o=l[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(u&&u(n);p.length;)p.shift()();return i.push.apply(i,s||[]),t()}function t(){for(var e,n=0;n<i.length;n++){for(var t=i[n],r=!0,l=1;l<t.length;l++){var c=t[l];0!==a[c]&&(r=!1)}r&&(i.splice(n--,1),e=o(o.s=t[0]))}return e}var r={},a={12:0},i=[];function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=e,o.c=r,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,n){if(1&n&&(e=o(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)o.d(t,r,function(n){return e[n]}.bind(null,r));return t},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="/";var l=this["webpackJsonpgw-group-web-components"]=this["webpackJsonpgw-group-web-components"]||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var s=0;s<l.length;s++)n(l[s]);var u=c;i.push([144,0]),t()}({0:function(e,n){e.exports=React},119:function(e,n,t){"use strict";t.r(n);var r=t(20),a=t(44);n.default=r.a.create({component:a.a,configuration:{tagname:"gw-group-nav-header",useShadow:!1},plugins:[]})},26:function(e,n){e.exports=ReactDOM},4:function(e,n,t){"use strict";t.d(n,"a",(function(){return a})),t.d(n,"j",(function(){return i})),t.d(n,"c",(function(){return o})),t.d(n,"d",(function(){return l})),t.d(n,"g",(function(){return c})),t.d(n,"h",(function(){return s})),t.d(n,"f",(function(){return u})),t.d(n,"i",(function(){return d})),t.d(n,"b",(function(){return p})),t.d(n,"e",(function(){return m}));var r=t(2),a=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(n){return console.warn("Failed decoding Base64 -> UTF8. Base64 string: ",e),null}},i=function(e){return btoa(unescape(encodeURIComponent(e)))},o=function(e){return"Invalid Date"!==new Date(e).toString()?new Date(e).toISOString().slice(0,10):e},l=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},c=function(e){return e.sort((function(e,n){return e.created>n.created?-1:e.created<n.created?1:0}))},s=function(e){return e.sort((function(e,n){return e.created<n.created?-1:e.created>n.created?1:0}))},u=function(e){return e.sort((function(e,n){return e.title<n.title?-1:e.title>n.title?1:0}))},d=function(e){return e.sort((function(e,n){return e.title>n.title?-1:e.title<n.title?1:0}))};function p(e,n){var t,r=arguments,a=this;return function(i){clearTimeout(t),t=setTimeout((function(n){t=null,e.apply(a,r)}),n)}}var m=function(e,n){if(!n.length)return e;var t=Object(r.a)(n,1)[0];return/^\d+$/.test(e)?"".concat(e).concat(t):"string"===typeof e&&n.some((function(n){return e.endsWith(n)}))?e:"string"===typeof e&&"".concat(e.trim().replace(/\D/g,"")||"0").concat(t)}},44:function(e,n,t){"use strict";t.d(n,"a",(function(){return E}));var r=t(0),a=t.n(r),i=t(2),o=t(1),l=o.default.div.withConfig({displayName:"styles__View",componentId:"sc-1oiaj0n-0"})(["position:relative;background-color:transparent;height:100%;font-size:var(--font-size-3);a{text-decoration:none;font-weight:700;color:var(--grey);}ul{padding:0;li{list-style:none;}}"]),c=o.default.div.withConfig({displayName:"styles__Nav",componentId:"sc-1oiaj0n-1"})(["display:flex;align-items:center;height:100%;min-height:72px;display:flex;align-items:center;nav{display:none;ul{display:flex;align-items:flex-start;flex-wrap:wrap;height:24px;overflow:hidden;li{height:24px;}a{margin-right:var(--spacing-medium-1);transition:ease 0.3s;&:hover{text-decoration:underline;}}}}&.open{a{animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;}}&.closed{a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}@media only screen and (min-width:980px){nav{display:initial;}}"]),s=o.default.button.withConfig({displayName:"styles__Hamburger",componentId:"sc-1oiaj0n-2"})(["display:flex;align-items:center;flex-direction:column;cursor:pointer;border:none;background:none;position:relative;margin-left:var(--spacing-small-1);margin-right:var(--spacing-small-1);span{background-color:var(--grey);width:22px;height:2px;margin:2px 0;display:block;transition:all 0.4s ease;transform-origin:0 0;}&.open span:nth-child(1){transform:rotate(45deg) translate(1px,-2px);width:18px;}&.open span:nth-child(2){transform:scaleX(0);}&.open span:nth-child(3){transform:rotate(-45deg);width:19px;}&:hover{cursor:pointer;}@media only screen and (min-width:767px){margin-left:var(--spacing-medium-1);margin-right:var(--spacing-medium-1);}"]),u=o.default.div.withConfig({displayName:"styles__HamburgerNav",componentId:"sc-1oiaj0n-3"})(["display:flex;opacity:0;flex-direction:column;justify-content:space-between;position:absolute;top:68px;left:0;border-radius:0 0 var(--border-radius) var(--border-radius);width:100vw;min-height:550px;background-color:#fff;transition:ease 0.3s;box-shadow:0px 100px 80px rgba(0,0,0,0.02),0px 41.7776px 33.4221px rgba(0,0,0,0.0143771),0px 22.3363px 17.869px rgba(0,0,0,0.0119221),0px 12.5216px 10.0172px rgba(0,0,0,0.01),0px 6.6501px 5.32008px rgba(0,0,0,0.00807786),0px 2.76726px 2.21381px rgba(0,0,0,0.00562291);nav{display:flex;flex-direction:column;li{margin:var(--spacing-medium);a:hover{text-decoration:underline;}}}&.initial{pointer-events:none;}&.closed{animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;visibility:hidden;a{opacity:0;}}&.open{animation:fadeIn 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:unset;visibility:visible;a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}@media only screen and (min-width:480px){width:320px;}@media only screen and (min-width:767px){nav li{margin:var(--spacing-medium) var(--spacing-medium) var(--spacing-medium) var(--spacing-medium-1);}}"]),d=o.default.div.withConfig({displayName:"styles__Current",componentId:"sc-1oiaj0n-4"})(["background-color:var(--dark-tone-50);padding:var(--spacing-small);color:var(--white);p{font-weight:var(--font-weight-medium);margin:0;}span{font-weight:var(--font-weight-light);display:block;}"]),p=function(e){var n=e.menuItems,t=e.currentPage,o=e.languageSwitcher,p=t.name,m=Object(r.useState)(n),f=Object(i.a)(m,1)[0],g=Object(r.useState)("initial"),v=Object(i.a)(g,2),b=v[0],h=v[1];return a.a.createElement(l,{className:"aem-nav-bar__navigation"},a.a.createElement(c,{className:"".concat(b)},a.a.createElement(s,{onClick:function(){"initial"===b?h("open"):"open"===b?h("closed"):"closed"===b&&h("open")},className:"".concat(b)},a.a.createElement("span",null),a.a.createElement("span",null),a.a.createElement("span",null)),a.a.createElement("nav",null,a.a.createElement("ul",null,f.map((function(e,n){return a.a.createElement("li",{key:"menu-item-".concat(n)},a.a.createElement("a",{href:e.url},e.label))}))))),a.a.createElement(u,{className:"".concat(b)},a.a.createElement("nav",null,a.a.createElement("ul",{id:"m-menu"},f.map((function(e,n){return a.a.createElement("li",{key:"menu-item-".concat(n)},a.a.createElement("a",{href:e.url},e.label))})))),o,a.a.createElement(d,null,a.a.createElement("span",null,"You are visiting"),a.a.createElement("p",null,p))))};p.defaultProps={menuItems:[],currentPage:{name:""}};var m=p,f=t(12);var g=function(e){var n=e.color;return a.a.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.a.createElement("path",{d:"M6.15 8.981c-.046-.045.057.367.205.515.258.264.464.296.574.303.238.006.534-.058.708-.135.167-.071.464-.226.58-.445.025-.045.09-.128.045-.322-.033-.148-.13-.206-.245-.193-.116.007-.47.103-.644.155-.174.051-.522.16-.676.193-.155.026-.496-.02-.548-.071zM10.49 13.895a70.55 70.55 0 01-1.669-.702c-.16-.077-.56-.245-.747-.322.529-.818.863-1.43.908-1.527.084-.173.644-1.268.657-1.332.013-.071.026-.323.02-.38-.013-.058-.22.057-.496.148-.277.096-.812.438-1.011.483-.206.045-.863.29-1.198.405-.335.11-.973.303-1.237.374-.264.07-.49.077-.637.122 0 0 .02.206.058.264a.657.657 0 00.341.258c.161.045.425.026.547 0 .123-.026.335-.129.361-.174.026-.045-.013-.187.032-.225.052-.046.69-.194.928-.264.244-.078 1.165-.393 1.294-.374-.038.129-.786 1.604-1.024 2.048-.238.438-1.63 2.376-1.932 2.718-.225.257-.773.92-.96 1.069.046.013.387-.013.445-.052.386-.238 1.024-1.03 1.23-1.275a20.762 20.762 0 001.571-2.119c.084.032.754.58.928.702.174.123.863.509 1.017.573.148.065.728.329.747.239.02-.097-.11-.631-.174-.657z",fill:n}),a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.605 20.367l-1.86-.142.514.844c-.103.058-.212.135-.277.168a5.753 5.753 0 01-.38.206c-.148.077-.309.154-.438.218-.109.046-.231.097-.328.142-.122.045-.238.097-.348.136-.174.057-.347.122-.508.167-.168.051-.335.09-.503.129-.225.051-.457.09-.663.122-.264.039-.509.052-.767.077h-.67c-.135 0-.798-.083-.824-.083a12.368 12.368 0 01-.734-.136 10.346 10.346 0 01-1.256-.38 8.268 8.268 0 01-.908-.405 3.524 3.524 0 01-.405-.22c-.045-.019-.284-.193-.406-.193a.213.213 0 00-.219.22c0 .064.006.128.097.186a7.875 7.875 0 001.558.786c.283.11.573.219.876.296.174.052.367.103.547.142.232.051.477.097.709.135.264.039.534.064.798.09h.986c.219 0 .991-.122 1.069-.135.141-.02.283-.058.425-.09.373-.09.792-.225 1.172-.367.29-.11.599-.245.895-.406.148-.084.322-.154.464-.251.07-.052.186-.097.277-.155l.47.767.637-1.868z",fill:n}),a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.28 7.107l1.72.547v12.578l-9.042-2.885c-.006.013-.02.019-.026.019-.186.077-8.597 2.898-8.707 2.898-.09 0-.173-.058-.219-.154a.047.047 0 00-.003-.017.048.048 0 01-.003-.016V7.526l.009-.03a.2.2 0 01.043-.093c.05-.072.138-.096.203-.114l.028-.008.211-.07 1.535-.516v-4.47l6.53 2.306.193-.058c.45-.187 2.634-.914 3.548-1.217C15.572 3.159 18.94 2 19.043 2a.23.23 0 01.238.238v4.869zm-.45-.148V2.535L12.106 4.82l6.724 2.138zM3.45 19.71L11.592 17V4.995l-8.14 2.71V19.71zm12.102-7.168l.889-2.144.74 2.64-1.63-.496zm1.52-3.819l-1.166-.354-2.544 6.247 1.198.36.535-1.28 2.473.746.431 1.572 1.198.36-2.125-7.65z",fill:n}))},v=o.default.div.withConfig({displayName:"styles__View",componentId:"sc-1wm9rbq-0"})(["display:flex;margin-left:var(--spacing-medium);@media only screen and (min-width:1025px){margin-left:0;justify-content:flex-end;padding-right:var(--spacing-small);}.aem-nav-bar__navigation &{@media only screen and (min-width:1025px){display:none;}}.aem-nav-bar__options &{display:none;@media only screen and (min-width:1025px){display:flex;}}"]),b=o.default.div.withConfig({displayName:"styles__Dropdown",componentId:"sc-1wm9rbq-1"})(['position:relative;font-size:var(--font-size-3);@media only screen and (min-width:1025px){display:block;}.dropdown__button{display:flex;align-items:center;height:56px;background-color:var(--dropdown-background-light);color:var(--dropdown-color);position:relative;outline:none;min-width:200px;border:0;margin:0;padding:0.8rem 1rem 0.8rem 0.8rem;padding-right:calc(1.6rem + 0.5rem);border-radius:var(--border-radius);text-align:left;cursor:pointer;font-family:var(--font-family-body);font-weight:var(--font-weight-bold);&::after{content:"";position:absolute;width:8px;height:8px;right:22px;top:calc(50% - 3px);transform:rotate(45deg);border-right:2px solid #000;border-bottom:2px solid #000;border-radius:1px;transition:ease-in-out 0.16s;transform-origin:center center;}&__icon__wrapper{display:inline-block;width:24px;height:auto;margin-right:0.4rem;transform:translateY(2px);}&[aria-expanded="true"]{&::after{transform:rotate(-135deg);}}}']),h=o.default.div.withConfig({displayName:"styles__Menu",componentId:"sc-1wm9rbq-2"})(["display:none;border-radius:0 0 4px 4px;position:absolute;width:100%;z-index:1;box-shadow:0 100px 80px rgba(26,26,26,0.0168687),0 41.7776px 33.4221px rgba(26,26,26,0.0242336),0 22.3363px 17.869px rgba(26,26,26,0.03),0 12.5216px 10.0172px rgba(26,26,26,0.0357664),0 6.6501px 5.32008px rgba(26,26,26,0.0431313),0 2.76726px 2.21381px rgba(26,26,26,0.06);animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;a{opacity:0;}&.is-visible{display:block;animation:fadeIn 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:unset;a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}a{border-top:1px solid var(--dropdown-checkbox-border-color);min-height:56px;display:block;border-radius:0;background-color:var(--dropdown-background-white);color:var(--dropdown-color);position:relative;text-decoration:none;min-width:180px;margin:0;padding:0.8rem 1rem;padding-right:calc(1.6rem + 0.5rem);text-align:left;cursor:pointer;&.is-active{font-weight:var(--font-weight-semi-bold);}&:hover{background-color:var(--grey-5) !important;cursor:pointer;text-decoration:underline;}&:last-child{border-radius:0px 0px 0.25rem 0.25rem;}}"]),w=function(e){var n=e.languages,t=e.currentLanguage,o=function(e){var n=Object(r.useState)(!1),t=Object(i.a)(n,2),a=t[0],o=t[1],l=Object(r.useRef)(null),c=Object(r.useRef)(!0),s=Object(r.useRef)(!1),u=Object(r.useRef)(null),d=Object(r.useRef)([]);Object(r.useEffect)((function(){d.current=Object(f.a)(Array(e)).map((function(){return Object(r.createRef)()}))}),[e]);var p=function(e){var n;l.current=e,null===(n=d.current[e].current)||void 0===n||n.focus()};Object(r.useEffect)((function(){c.current?c.current=!1:a&&!s.current?p(0):a||(s.current=!1)}),[a]),Object(r.useEffect)((function(){if(a){var e=function(e){setTimeout((function(){e.target instanceof Element&&(e.target.closest('[role="menu"]')instanceof Element||o(!1))}),10)};return setTimeout((function(){document.addEventListener("click",e)}),1),function(){return document.removeEventListener("click",e)}}}),[a]),Object(r.useEffect)((function(){var e=function(e){!a||"ArrowDown"!==e.key&&"ArrowUp"!==e.key||e.preventDefault()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[a]);var m=function(e){if(function(e){return void 0!==e.key}(e)){var n=e.key;if(!["Enter"," ","Tab","ArrowDown"].includes(n))return;("Tab"===n||"ArrowDown"===n)&&s.current&&a?(e.preventDefault(),p(0)):"Tab"!==n&&(e.preventDefault(),o(!0))}else s.current=!a,o(!a)},g=function(e){var n=e.key;if(["Tab","Shift","Enter","Escape","ArrowUp","ArrowDown"].includes(n)){var t,r=l.current;if("Escape"===n)return o(!1),void(null===(t=u.current)||void 0===t||t.focus());if("Tab"!==n){if("Enter"===n)return e.currentTarget.href||e.currentTarget.click(),void o(!1);null!==r&&("ArrowUp"===n?r-=1:"ArrowDown"===n&&(r+=1),r>d.current.length-1?r=0:r<0&&(r=d.current.length-1)),null!==r&&p(r)}else o(!1)}};return{buttonProps:{onKeyDown:m,onClick:m,tabIndex:0,ref:u,role:"button","aria-haspopup":!0,"aria-expanded":a},itemProps:Object(f.a)(Array(e)).map((function(e,n){return{onKeyDown:g,tabIndex:-1,role:"menuitem",ref:d.current[n]}})),isOpen:a,setIsOpen:o}}(n.length),l=o.buttonProps,c=o.itemProps,s=o.isOpen,u=o.setIsOpen,d=Object(r.useState)(t),p=Object(i.a)(d,2),m=p[0],w=p[1],x=n.map((function(e,n){var t=e.label,r=e.url;return a.a.createElement("a",Object.assign({key:t},c[n],{className:m===t?"is-active":"",href:r,onClick:function(e){return w(t),void u(!1)}}),t)}));return a.a.createElement(v,{className:"aem-nav-bar__languages"},a.a.createElement(b,{className:"dropdown"},a.a.createElement("button",Object.assign({className:"dropdown__button"},l),a.a.createElement("span",{className:"dropdown__button__icon__wrapper"},a.a.createElement(g,{color:"#000"})),m),a.a.createElement(h,{className:s?"is-visible":"",role:"menu"},x)))};w.defaultProps={languages:[],currentLanguage:""};var x=w,y=t(4),E=function(e){var n=Object(y.a)(e.navHeaderData),t=n.navigationData,r=n.languageSwitcherData;return a.a.createElement(a.a.Fragment,null,a.a.createElement(m,Object.assign({},t,{languageSwitcher:a.a.createElement(x,r)})),a.a.createElement("div",{className:"aem-nav-bar__options"},a.a.createElement(x,r)))};E.defaultProps={headerData:""}}}); | ||
!function(e){function n(n){for(var r,o,l=n[0],c=n[1],s=n[2],d=0,p=[];d<l.length;d++)o=l[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(u&&u(n);p.length;)p.shift()();return i.push.apply(i,s||[]),t()}function t(){for(var e,n=0;n<i.length;n++){for(var t=i[n],r=!0,l=1;l<t.length;l++){var c=t[l];0!==a[c]&&(r=!1)}r&&(i.splice(n--,1),e=o(o.s=t[0]))}return e}var r={},a={12:0},i=[];function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=e,o.c=r,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,n){if(1&n&&(e=o(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)o.d(t,r,function(n){return e[n]}.bind(null,r));return t},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="/";var l=this["webpackJsonpgw-group-web-components"]=this["webpackJsonpgw-group-web-components"]||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var s=0;s<l.length;s++)n(l[s]);var u=c;i.push([144,0]),t()}({0:function(e,n){e.exports=React},119:function(e,n,t){"use strict";t.r(n);var r=t(20),a=t(44);n.default=r.a.create({component:a.a,configuration:{tagname:"gw-group-nav-header",useShadow:!1},plugins:[]})},26:function(e,n){e.exports=ReactDOM},4:function(e,n,t){"use strict";t.d(n,"a",(function(){return a})),t.d(n,"j",(function(){return i})),t.d(n,"c",(function(){return o})),t.d(n,"d",(function(){return l})),t.d(n,"g",(function(){return c})),t.d(n,"h",(function(){return s})),t.d(n,"f",(function(){return u})),t.d(n,"i",(function(){return d})),t.d(n,"b",(function(){return p})),t.d(n,"e",(function(){return m}));var r=t(2),a=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(n){return console.warn("Failed decoding Base64 -> UTF8. Base64 string: ",e),null}},i=function(e){return btoa(unescape(encodeURIComponent(e)))},o=function(e){return"Invalid Date"!==new Date(e).toString()?new Date(e).toISOString().slice(0,10):e},l=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},c=function(e){return e.sort((function(e,n){return e.created>n.created?-1:e.created<n.created?1:0}))},s=function(e){return e.sort((function(e,n){return e.created<n.created?-1:e.created>n.created?1:0}))},u=function(e){return e.sort((function(e,n){return e.title<n.title?-1:e.title>n.title?1:0}))},d=function(e){return e.sort((function(e,n){return e.title>n.title?-1:e.title<n.title?1:0}))};function p(e,n){var t,r=arguments,a=this;return function(i){clearTimeout(t),t=setTimeout((function(n){t=null,e.apply(a,r)}),n)}}var m=function(e,n){if(!n.length)return e;var t=Object(r.a)(n,1)[0];return/^\d+$/.test(e)?"".concat(e).concat(t):"string"===typeof e&&n.some((function(n){return e.endsWith(n)}))?e:"string"===typeof e&&"".concat(e.trim().replace(/\D/g,"")||"0").concat(t)}},44:function(e,n,t){"use strict";t.d(n,"a",(function(){return E}));var r=t(0),a=t.n(r),i=t(2),o=t(1),l=o.default.div.withConfig({displayName:"styles__View",componentId:"sc-1oiaj0n-0"})(["position:relative;background-color:transparent;height:100%;font-size:var(--font-size-3);a{text-decoration:none;font-weight:700;color:var(--grey);}ul{padding:0;li{list-style:none;}}"]),c=o.default.div.withConfig({displayName:"styles__Nav",componentId:"sc-1oiaj0n-1"})(["display:flex;align-items:center;height:100%;min-height:72px;display:flex;align-items:center;nav{display:none;ul{display:flex;align-items:flex-start;flex-wrap:wrap;height:24px;overflow:hidden;li{height:24px;}a{margin-right:var(--spacing-medium-1);transition:ease 0.3s;&:hover{text-decoration:underline;}}}}&.open{a{animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;}}&.closed{a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}@media only screen and (min-width:980px){nav{display:initial;}}"]),s=o.default.button.withConfig({displayName:"styles__Hamburger",componentId:"sc-1oiaj0n-2"})(["display:flex;align-items:center;flex-direction:column;cursor:pointer;border:none;background:none;position:relative;margin-left:var(--spacing-small-1);margin-right:var(--spacing-small-1);span{background-color:var(--grey);width:22px;height:2px;margin:2px 0;display:block;transition:all 0.4s ease;transform-origin:0 0;}&.open span:nth-child(1){transform:rotate(45deg) translate(1px,-2px);width:18px;}&.open span:nth-child(2){transform:scaleX(0);}&.open span:nth-child(3){transform:rotate(-45deg);width:19px;}&:hover{cursor:pointer;}@media only screen and (min-width:767px){margin-left:var(--spacing-medium-1);margin-right:var(--spacing-medium-1);}"]),u=o.default.div.withConfig({displayName:"styles__HamburgerNav",componentId:"sc-1oiaj0n-3"})(["display:flex;opacity:0;flex-direction:column;justify-content:space-between;position:absolute;top:68px;left:0;border-radius:0 0 var(--border-radius) var(--border-radius);width:100vw;min-height:550px;background-color:#fff;transition:ease 0.3s;box-shadow:0px 100px 80px rgba(0,0,0,0.02),0px 41.7776px 33.4221px rgba(0,0,0,0.0143771),0px 22.3363px 17.869px rgba(0,0,0,0.0119221),0px 12.5216px 10.0172px rgba(0,0,0,0.01),0px 6.6501px 5.32008px rgba(0,0,0,0.00807786),0px 2.76726px 2.21381px rgba(0,0,0,0.00562291);nav{display:flex;flex-direction:column;li{margin:var(--spacing-medium);a:hover{text-decoration:underline;}}}&.initial{pointer-events:none;}&.closed{animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;visibility:hidden;a{opacity:0;}}&.open{animation:fadeIn 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:unset;visibility:visible;a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}@media only screen and (min-width:480px){width:320px;}@media only screen and (min-width:767px){nav li{margin:var(--spacing-medium) var(--spacing-medium) var(--spacing-medium) var(--spacing-medium-1);}}"]),d=o.default.div.withConfig({displayName:"styles__Current",componentId:"sc-1oiaj0n-4"})(["background-color:var(--dark-tone-50);padding:var(--spacing-small);color:var(--white);p{font-weight:var(--font-weight-medium);margin:0;}span{font-weight:var(--font-weight-light);display:block;}"]),p=function(e){var n=e.menuItems,t=e.currentPage,o=e.languageSwitcher,p=t.name,m=Object(r.useState)(n),f=Object(i.a)(m,1)[0],g=Object(r.useState)("initial"),v=Object(i.a)(g,2),b=v[0],h=v[1];return a.a.createElement(l,{className:"aem-nav-bar__navigation"},a.a.createElement(c,{className:"".concat(b)},a.a.createElement(s,{onClick:function(){"initial"===b?h("open"):"open"===b?h("closed"):"closed"===b&&h("open")},className:"".concat(b)},a.a.createElement("span",null),a.a.createElement("span",null),a.a.createElement("span",null)),a.a.createElement("nav",null,a.a.createElement("ul",null,f.map((function(e,n){return a.a.createElement("li",{key:"menu-item-".concat(n)},a.a.createElement("a",{href:e.url},e.label))}))))),a.a.createElement(u,{className:"".concat(b)},a.a.createElement("nav",null,a.a.createElement("ul",{id:"m-menu"},f.map((function(e,n){return a.a.createElement("li",{key:"menu-item-".concat(n)},a.a.createElement("a",{href:e.url},e.label))})))),o,a.a.createElement(d,null,a.a.createElement("span",null,"You are visiting"),a.a.createElement("p",null,p))))};p.defaultProps={menuItems:[],currentPage:{name:""}};var m=p,f=t(12);var g=function(e){var n=e.color;return a.a.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.a.createElement("path",{d:"M6.15 8.981c-.046-.045.057.367.205.515.258.264.464.296.574.303.238.006.534-.058.708-.135.167-.071.464-.226.58-.445.025-.045.09-.128.045-.322-.033-.148-.13-.206-.245-.193-.116.007-.47.103-.644.155-.174.051-.522.16-.676.193-.155.026-.496-.02-.548-.071zM10.49 13.895a70.55 70.55 0 01-1.669-.702c-.16-.077-.56-.245-.747-.322.529-.818.863-1.43.908-1.527.084-.173.644-1.268.657-1.332.013-.071.026-.323.02-.38-.013-.058-.22.057-.496.148-.277.096-.812.438-1.011.483-.206.045-.863.29-1.198.405-.335.11-.973.303-1.237.374-.264.07-.49.077-.637.122 0 0 .02.206.058.264a.657.657 0 00.341.258c.161.045.425.026.547 0 .123-.026.335-.129.361-.174.026-.045-.013-.187.032-.225.052-.046.69-.194.928-.264.244-.078 1.165-.393 1.294-.374-.038.129-.786 1.604-1.024 2.048-.238.438-1.63 2.376-1.932 2.718-.225.257-.773.92-.96 1.069.046.013.387-.013.445-.052.386-.238 1.024-1.03 1.23-1.275a20.762 20.762 0 001.571-2.119c.084.032.754.58.928.702.174.123.863.509 1.017.573.148.065.728.329.747.239.02-.097-.11-.631-.174-.657z",fill:n}),a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.605 20.367l-1.86-.142.514.844c-.103.058-.212.135-.277.168a5.753 5.753 0 01-.38.206c-.148.077-.309.154-.438.218-.109.046-.231.097-.328.142-.122.045-.238.097-.348.136-.174.057-.347.122-.508.167-.168.051-.335.09-.503.129-.225.051-.457.09-.663.122-.264.039-.509.052-.767.077h-.67c-.135 0-.798-.083-.824-.083a12.368 12.368 0 01-.734-.136 10.346 10.346 0 01-1.256-.38 8.268 8.268 0 01-.908-.405 3.524 3.524 0 01-.405-.22c-.045-.019-.284-.193-.406-.193a.213.213 0 00-.219.22c0 .064.006.128.097.186a7.875 7.875 0 001.558.786c.283.11.573.219.876.296.174.052.367.103.547.142.232.051.477.097.709.135.264.039.534.064.798.09h.986c.219 0 .991-.122 1.069-.135.141-.02.283-.058.425-.09.373-.09.792-.225 1.172-.367.29-.11.599-.245.895-.406.148-.084.322-.154.464-.251.07-.052.186-.097.277-.155l.47.767.637-1.868z",fill:n}),a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.28 7.107l1.72.547v12.578l-9.042-2.885c-.006.013-.02.019-.026.019-.186.077-8.597 2.898-8.707 2.898-.09 0-.173-.058-.219-.154a.047.047 0 00-.003-.017.048.048 0 01-.003-.016V7.526l.009-.03a.2.2 0 01.043-.093c.05-.072.138-.096.203-.114l.028-.008.211-.07 1.535-.516v-4.47l6.53 2.306.193-.058c.45-.187 2.634-.914 3.548-1.217C15.572 3.159 18.94 2 19.043 2a.23.23 0 01.238.238v4.869zm-.45-.148V2.535L12.106 4.82l6.724 2.138zM3.45 19.71L11.592 17V4.995l-8.14 2.71V19.71zm12.102-7.168l.889-2.144.74 2.64-1.63-.496zm1.52-3.819l-1.166-.354-2.544 6.247 1.198.36.535-1.28 2.473.746.431 1.572 1.198.36-2.125-7.65z",fill:n}))},v=o.default.div.withConfig({displayName:"styles__View",componentId:"sc-1wm9rbq-0"})(["display:flex;margin-left:var(--spacing-medium);@media only screen and (min-width:1025px){margin-left:0;justify-content:flex-end;padding-right:var(--spacing-small);}.aem-nav-bar__navigation &{@media only screen and (min-width:1025px){display:none;}}.aem-nav-bar__options &{display:none;@media only screen and (min-width:1025px){display:flex;}}"]),b=o.default.div.withConfig({displayName:"styles__Dropdown",componentId:"sc-1wm9rbq-1"})(['position:relative;font-size:var(--font-size-3);@media only screen and (min-width:1025px){display:block;}.dropdown__button{display:flex;align-items:center;height:56px;background-color:var(--dropdown-background-light);color:var(--dropdown-color);position:relative;outline:none;min-width:200px;border:0;margin:0;padding:0.8rem 1rem 0.8rem 0.8rem;padding-right:calc(1.6rem + 0.5rem);border-radius:var(--border-radius);text-align:left;cursor:pointer;font-family:var(--font-family-body);font-weight:var(--font-weight-bold);&::after{content:"";position:absolute;width:8px;height:8px;right:22px;top:calc(50% - 3px);transform:rotate(45deg);border-right:2px solid #000;border-bottom:2px solid #000;border-radius:1px;transition:ease-in-out 0.16s;transform-origin:center center;}&__icon__wrapper{display:inline-block;width:24px;height:auto;margin-right:0.4rem;transform:translateY(2px);}&[aria-expanded="true"]{&::after{transform:rotate(-135deg);}}}']),h=o.default.div.withConfig({displayName:"styles__Menu",componentId:"sc-1wm9rbq-2"})(["display:none;border-radius:0 0 4px 4px;position:absolute;width:100%;z-index:1;box-shadow:0 100px 80px rgba(26,26,26,0.0168687),0 41.7776px 33.4221px rgba(26,26,26,0.0242336),0 22.3363px 17.869px rgba(26,26,26,0.03),0 12.5216px 10.0172px rgba(26,26,26,0.0357664),0 6.6501px 5.32008px rgba(26,26,26,0.0431313),0 2.76726px 2.21381px rgba(26,26,26,0.06);animation:fadeOut 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:none;a{opacity:0;}&.is-visible{display:block;animation:fadeIn 0.2s linear;animation-fill-mode:forwards;opacity:0;pointer-events:unset;a{animation:fadeIn 0.3s linear;animation-fill-mode:forwards;opacity:0;}}a{border-top:1px solid var(--dropdown-checkbox-border-color);min-height:56px;display:block;border-radius:0;background-color:var(--dropdown-background-white);color:var(--dropdown-color);position:relative;text-decoration:none;min-width:180px;margin:0;padding:0.8rem 1rem;padding-right:calc(1.6rem + 0.5rem);text-align:left;cursor:pointer;&.is-active{font-weight:var(--font-weight-semi-bold);}&:hover{background-color:var(--grey-5) !important;cursor:pointer;text-decoration:underline;}&:last-child{border-radius:0px 0px 0.25rem 0.25rem;}}"]),w=function(e){var n=e.languages,t=e.currentLanguage,o=function(e){var n=Object(r.useState)(!1),t=Object(i.a)(n,2),a=t[0],o=t[1],l=Object(r.useRef)(null),c=Object(r.useRef)(!0),s=Object(r.useRef)(!1),u=Object(r.useRef)(null),d=Object(r.useRef)([]);Object(r.useEffect)((function(){d.current=Object(f.a)(Array(e)).map((function(){return Object(r.createRef)()}))}),[e]);var p=function(e){var n;l.current=e,null===(n=d.current[e].current)||void 0===n||n.focus()};Object(r.useEffect)((function(){c.current?c.current=!1:a&&!s.current?p(0):a||(s.current=!1)}),[a]),Object(r.useEffect)((function(){if(a){var e=function(e){setTimeout((function(){e.target instanceof Element&&(e.target.closest('[role="menu"]')instanceof Element||o(!1))}),10)};return setTimeout((function(){document.addEventListener("click",e)}),1),function(){return document.removeEventListener("click",e)}}}),[a]),Object(r.useEffect)((function(){var e=function(e){!a||"ArrowDown"!==e.key&&"ArrowUp"!==e.key||e.preventDefault()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[a]);var m=function(e){if(function(e){return void 0!==e.key}(e)){var n=e.key;if(!["Enter"," ","Tab","ArrowDown"].includes(n))return;("Tab"===n||"ArrowDown"===n)&&s.current&&a?(e.preventDefault(),p(0)):"Tab"!==n&&(e.preventDefault(),o(!0))}else s.current=!a,o(!a)},g=function(e){var n=e.key;if(["Tab","Shift","Enter","Escape","ArrowUp","ArrowDown"].includes(n)){var t,r=l.current;if("Escape"===n)return o(!1),void(null===(t=u.current)||void 0===t||t.focus());if("Tab"!==n){if("Enter"===n)return e.currentTarget.href||e.currentTarget.click(),void o(!1);null!==r&&("ArrowUp"===n?r-=1:"ArrowDown"===n&&(r+=1),r>d.current.length-1?r=0:r<0&&(r=d.current.length-1)),null!==r&&p(r)}else o(!1)}};return{buttonProps:{onKeyDown:m,onClick:m,tabIndex:0,ref:u,role:"button","aria-haspopup":!0,"aria-expanded":a},itemProps:Object(f.a)(Array(e)).map((function(e,n){return{onKeyDown:g,tabIndex:-1,role:"menuitem",ref:d.current[n]}})),isOpen:a,setIsOpen:o}}(n.length),l=o.buttonProps,c=o.itemProps,s=o.isOpen,u=o.setIsOpen,d=Object(r.useState)(t),p=Object(i.a)(d,2),m=p[0],w=p[1],x=n.map((function(e,n){var t=e.label,r=e.url;return a.a.createElement("a",Object.assign({key:t},c[n],{className:m===t?"is-active":"",href:r,onClick:function(e){return w(t),void u(!1)}}),t)}));return a.a.createElement(v,{className:"aem-nav-bar__languages"},a.a.createElement(b,{className:"dropdown"},a.a.createElement("button",Object.assign({className:"dropdown__button"},l),a.a.createElement("span",{className:"dropdown__button__icon__wrapper"},a.a.createElement(g,{color:"#000"})),m),a.a.createElement(h,{className:s?"is-visible":"",role:"menu"},x)))};w.defaultProps={languages:[],currentLanguage:""};var x=w,y=t(4),E=function(e){var n=Object(y.a)(e.content),t=n.navigationData,r=n.languageSwitcherData;return a.a.createElement(a.a.Fragment,null,a.a.createElement(m,Object.assign({},t,{languageSwitcher:a.a.createElement(x,r)})),a.a.createElement("div",{className:"aem-nav-bar__options"},a.a.createElement(x,r)))};E.defaultProps={content:""}}}); |
{ | ||
"name": "@assaabloy/gw-group-nav-header", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Web component - Header navigation", | ||
@@ -17,3 +17,3 @@ "type": "module", | ||
}, | ||
"gitHead": "04da0c7dd142a6688c5c80219e4984661b421ad0" | ||
"gitHead": "82d908d2bc47a6127efe051a3806134426a37fae" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19230