quirk-ui 0.0.461 → 0.0.462

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.
@@ -13,4 +13,4 @@
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const _e=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Se=G.createLucideIcon("search",_e),Me={standard:e.styles.standard,transparent:e.styles.transparent},Ee={left:e.styles.left,center:e.styles.center,right:e.styles.right},Ae=({spotlight:a,renderText:b})=>{var t,C,j,p,k,L,m,_,S,M,y;const w=(t=a.image)==null?void 0:t.asset.altText,x=((C=a.callToAction.linkOptions)==null?void 0:C.linkType)==="external";let u="#";return((j=a.callToAction.linkOptions)==null?void 0:j.linkType)==="external"&&((p=a.callToAction.linkOptions)!=null&&p.externalUrl)?u=(k=a.callToAction.linkOptions)==null?void 0:k.externalUrl:((L=a.callToAction.linkOptions)==null?void 0:L.linkType)==="internal"&&((_=(m=a.callToAction.linkOptions)==null?void 0:m.internalUrl)!=null&&_.slug.current)&&(u=`/${(M=(S=a.callToAction.linkOptions)==null?void 0:S.internalUrl)==null?void 0:M.slug.current}`),s.jsxs("div",{className:e.styles.spotlight,children:[a.image&&s.jsx("div",{className:e.styles.imageWrapper,children:s.jsx("img",{src:(a==null?void 0:a.image.imageUrl)??"",alt:w||a.image.asset.description||"Content image",width:600,height:400})}),s.jsxs("div",{className:e.styles.content,children:[a.title&&s.jsx("div",{className:e.styles.title,children:b==null?void 0:b(a.title,e.styles.title)}),a.description&&s.jsx("div",{className:e.styles.description,children:b==null?void 0:b(a.description,e.styles.description)})]}),((y=a.callToAction)==null?void 0:y.linkOptions)&&s.jsx("div",{className:e.styles.actions,children:s.jsx(q.CallToAction,{as:"a",variant:a.callToAction.variant??"primary",href:u,target:x?"_blank":"_self",rel:x?"noopener noreferrer":"","aria-label":a.callToAction.ariaLabel||a.callToAction.label,children:a.callToAction.label})})]})};function Te({renderText:a,title:b,logo:w,items:x,groups:u,utilityItems:t,isSticky:C=!1,showSearch:j=!0,showLocaleSelect:p=!0,alignment:k="right",variant:L="standard",navigationType:m="default",searchComponent:_,localeSelectComponent:S,className:M}){const[y,U]=r.useState(!1),[X,E]=r.useState(!1),[H,f]=r.useState(null),[re,oe]=r.useState(0),[de,ye]=r.useState(!1),[ue,he]=r.useState(null),[o,N]=r.useState([]),[A,B]=r.useState(0),[be,V]=r.useState(null),[$,fe]=r.useState(!1),[T,O]=r.useState("forward"),F=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} ${e.styles.searchWrapper}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ie.Modal,{className:e.styles.searchModal,onOpen:()=>E(!0),onClose:()=>E(!1),trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(Se,{size:16})}),content:_})})}),J=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ie.Modal,{className:e.styles.localeModal,onOpen:()=>E(!0),onClose:()=>E(!1),trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",role:"menuitem",className:e.styles.locale,children:s.jsx(we,{size:16})}),content:S})})});r.useEffect(()=>{if(typeof window<"u"){const n=()=>{const l=window.innerWidth<768;fe(l)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}},[]);const xe=()=>{N([])},me=n=>{O("forward"),N([{title:n.title,primary:n.primaryItems??[],secondary:n.secondaryItems??[],description:""}])},K=n=>{O("forward"),N(l=>[...l,{title:n.label,primary:n.sublinks??[],secondary:[],description:n.description}])},je=()=>{O("backward"),N(n=>n.slice(0,-1))},W=r.useRef(null),g=r.useRef(null),I=r.useRef(new Map),ke=()=>{U(n=>{const l=!n;return l||(N([]),O("forward"),f(null)),l})},Q=n=>{const l=I.current.get(n);if(l&&g.current){const d=l.getBoundingClientRect(),h=g.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;he(c)}},ve=n=>{f(l=>l===n?null:n)},Y=r.useCallback(n=>{W.current&&!W.current.contains(n.target)&&f(null)},[]),Z=r.useCallback(()=>{P(),typeof window<"u"&&window.innerWidth>768&&(U(!1),f(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),P=r.useCallback(()=>{if(g.current){const n=g.current.getBoundingClientRect().width;oe(n),ye(!0)}},[]);r.useEffect(()=>{const n=typeof window<"u",l=typeof document<"u";return n&&window.addEventListener("resize",Z),l&&document.addEventListener("click",Y),P(),()=>{n&&window.removeEventListener("resize",Z),l&&document.removeEventListener("click",Y)}},[]),r.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=y||X?"hidden":"",()=>{document.body.style.overflow=""}},[y,X]);const pe=n=>n.map((l,d)=>{var ee,se,ne,le,ae;const h=`group-${d}`,z=be===d,c=(ee=l.primaryItems)==null?void 0:ee[A??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{V(d),f(h),Q(h)},onMouseLeave:()=>{V(null),B(0),f(null)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:i=>{I.current.set(h,i)},role:"menuitem","aria-haspopup":"true","aria-expanded":z,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${z?e.styles.open:""} `,children:[l.title,s.jsx($e.ChevronDown,{size:18,className:e.styles.chevron})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${z?e.styles.show:""}`,role:"menu","aria-label":`${l.title} submenu`,children:s.jsx("div",{children:s.jsxs("div",{className:`${e.styles.sublinksInner} ${l.spotlight?e.styles.withSpotlight:e.styles.withoutSpotlight}`,children:[s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.primaryColumn}`,children:[s.jsx("div",{className:e.styles.linkItem}),(se=l.primaryItems)==null?void 0:se.map((i,v)=>i.href?s.jsxs("a",{href:i.href,className:`${e.styles.link} ${A===v?e.styles.open:""}`,target:i.isExternal?"_blank":"_self",rel:i.isExternal?"noopener noreferrer":void 0,onClick:()=>{var te;f(null),(te=i.onClick)==null||te.call(i)},onMouseEnter:()=>i.sublinks?B(v):null,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[i.label,i.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:i.subtitle})]}),i.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]},i._key??v):s.jsx("button",{className:`${e.styles.sublinkToggle} ${A===v?e.styles.open:""}`,onMouseEnter:()=>B(v),children:s.jsxs("span",{className:e.styles.linkContent,children:[i.label,i.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:i.subtitle})]})},i._key??v))]}),(c==null?void 0:c.sublinks)&&((ne=c==null?void 0:c.sublinks)==null?void 0:ne.length)>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[(c==null?void 0:c.description)&&s.jsxs("div",{className:e.styles.sublinksDescription,children:[s.jsx("p",{children:"TEXT HERE"}),a==null?void 0:a(c.description)]}),(c==null?void 0:c.sublinks)&&R(c.sublinks,`${h}-${A}`)]},`${c.label}-${(le=c==null?void 0:c.sublinks)==null?void 0:le.length}`),(l==null?void 0:l.secondaryItems)&&((ae=l==null?void 0:l.secondaryItems)==null?void 0:ae.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:l.secondaryItems&&l.secondaryItems.length>0&&R(l.secondaryItems,`${h}-secondary`)}),l.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Ae,{spotlight:l.spotlight,renderText:a??(i=>String(i))})})]})})})]},l._key??`group-${d}`)}),R=(n,l="")=>n.map(d=>{const h=`${l}/${d.label}`;return s.jsx(e.NavLink,{link:d,path:h,parentPath:l,openPath:H,togglePath:ve,updateTriangleIndicator:Q,setOpenPath:f,renderLinks:R,buttonRefs:I},d._key??h)});return s.jsx("header",{ref:W,className:`${M??""} ${Ee[k]} ${Me[L]} ${e.styles.navbar} ${C?e.styles.sticky:""} ${u&&u.length?e.styles.advanced:e.styles.default}`,"aria-label":"Main navigation",children:s.jsxs("div",{className:`${e.styles.container} ${(!t||t.length===0)&&k!=="center"?e.styles.twoColumn:""}`,children:[w?s.jsx("div",{className:e.styles.logo,children:w}):s.jsx("div",{className:e.styles.title,children:b}),s.jsx("nav",{ref:g,style:{left:k==="center"?`calc(50% - ${re/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${de?e.styles.visible:e.styles.hidden}`,id:"main-menu",role:"menubar","aria-label":"Main navigation",children:s.jsxs("div",{className:e.styles.navInner,children:[s.jsx("svg",{style:{left:`${ue}px`},className:`${e.styles.triangle} ${H?e.styles.show:""}`,width:16,height:12,viewBox:"0 0 100 75",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("polygon",{points:"50,5 95,70 5,70",strokeLinejoin:"round",fill:"white",stroke:"white"})}),m==="default"&&x&&s.jsxs("div",{className:e.styles.grid,children:[x&&x.length>0&&R(x),j&&!$&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(F,{})]}),p&&s.jsx(J,{})]}),!$&&m==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&pe(u),j&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(F,{})]}),p&&s.jsx(J,{})]}),$&&m==="advanced"&&y&&o.length===0&&u&&s.jsx("div",{className:`${e.styles.mobileMenu}`,children:u.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>me(n),children:n.title})},n._key??l))}),$&&m==="advanced"&&y&&o.length>0&&s.jsxs("div",{className:`${e.styles.mobileMenuSlide} `,children:[s.jsx("button",{className:e.styles.back,onClick:o.length===1?xe:je,children:s.jsx(q.ChevronLeft,{size:18,"aria-hidden":"true",focusable:"false"})}),o[o.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:a==null?void 0:a(o[o.length-1].description)}),o[o.length-1].primary.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>K(n),children:s.jsxs("span",{className:e.styles.linkContent,children:[n.label,n.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:n.subtitle})]})}):s.jsxs("a",{href:n.href,className:e.styles.link,target:n.isExternal?"_blank":"_self",rel:n.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[n.label,n.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:n.subtitle})]}),n.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},n._key??`primary-${l}`)),o[o.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),o[o.length-1].secondary.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>K(n),children:n.label}):s.jsxs("a",{href:n.href,className:e.styles.link,target:n.isExternal?"_blank":"_self",rel:n.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[n.label,n.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},n._key??`secondary-${l}`))]},`stack-${o.length}`)]})}),t&&t.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(ce.ButtonGroup,{children:t.map((n,l)=>s.jsx(q.CallToAction,{as:"a",href:n.href??"/",variant:n.variant??"primary",displayType:n.displayType??"text",imageSrc:n.imageSrc,imageAlt:n.imageAlt,"aria-label":n.ariaLabel??n.label,icon:n.icon,iconAlignment:n.iconAlignment,children:n.imageSrc?s.jsx("img",{src:n.imageSrc,alt:n.imageAlt??n.ariaLabel??n.label}):n.label},n._key||l))})}),t&&t.length>0&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${y?e.styles.open:""}`,children:s.jsx(ce.ButtonGroup,{alignment:"center",children:s.jsx(q.CallToAction,{as:"a",href:t[1].href??"/",variant:t[1].variant??"primary",displayType:t[1].displayType??"text",imageSrc:t[1].imageSrc,imageAlt:t[1].imageAlt,"aria-label":t[1].ariaLabel??t[1].label,icon:t[1].icon,iconAlignment:t[1].iconAlignment,children:t[1].imageSrc?s.jsx("img",{src:t[1].imageSrc,"aria-label":t[1].imageAlt??t[1].ariaLabel??t[1].label}):t[1].label})})}),s.jsxs("div",{className:e.styles.mobileButtons,children:[$&&j&&s.jsx(F,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:ke,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,"aria-controls":"main-menu",children:y?s.jsx(Ne.X,{size:24}):s.jsx(Le,{size:24})})]})]})})}exports.Navbar=Te;
16
+ */const _e=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Se=G.createLucideIcon("search",_e),Me={standard:e.styles.standard,transparent:e.styles.transparent},Ee={left:e.styles.left,center:e.styles.center,right:e.styles.right},Ae=({spotlight:a,renderText:b})=>{var t,C,j,p,v,L,m,_,S,M,y;const w=(t=a.image)==null?void 0:t.asset.altText,x=((C=a.callToAction.linkOptions)==null?void 0:C.linkType)==="external";let u="#";return((j=a.callToAction.linkOptions)==null?void 0:j.linkType)==="external"&&((p=a.callToAction.linkOptions)!=null&&p.externalUrl)?u=(v=a.callToAction.linkOptions)==null?void 0:v.externalUrl:((L=a.callToAction.linkOptions)==null?void 0:L.linkType)==="internal"&&((_=(m=a.callToAction.linkOptions)==null?void 0:m.internalUrl)!=null&&_.slug.current)&&(u=`/${(M=(S=a.callToAction.linkOptions)==null?void 0:S.internalUrl)==null?void 0:M.slug.current}`),s.jsxs("div",{className:e.styles.spotlight,children:[a.image&&s.jsx("div",{className:e.styles.imageWrapper,children:s.jsx("img",{src:(a==null?void 0:a.image.imageUrl)??"",alt:w||a.image.asset.description||"Content image",width:600,height:400})}),s.jsxs("div",{className:e.styles.content,children:[a.title&&s.jsx("div",{className:e.styles.title,children:b==null?void 0:b(a.title,e.styles.title)}),a.description&&s.jsx("div",{className:e.styles.description,children:b==null?void 0:b(a.description,e.styles.description)})]}),((y=a.callToAction)==null?void 0:y.linkOptions)&&s.jsx("div",{className:e.styles.actions,children:s.jsx(q.CallToAction,{as:"a",variant:a.callToAction.variant??"primary",href:u,target:x?"_blank":"_self",rel:x?"noopener noreferrer":"","aria-label":a.callToAction.ariaLabel||a.callToAction.label,children:a.callToAction.label})})]})};function Te({renderText:a,title:b,logo:w,items:x,groups:u,utilityItems:t,isSticky:C=!1,showSearch:j=!0,showLocaleSelect:p=!0,alignment:v="right",variant:L="standard",navigationType:m="default",searchComponent:_,localeSelectComponent:S,className:M}){const[y,U]=r.useState(!1),[X,E]=r.useState(!1),[H,f]=r.useState(null),[re,oe]=r.useState(0),[de,ye]=r.useState(!1),[ue,he]=r.useState(null),[o,N]=r.useState([]),[A,B]=r.useState(0),[be,V]=r.useState(null),[$,fe]=r.useState(!1),[T,O]=r.useState("forward"),F=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} ${e.styles.searchWrapper}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ie.Modal,{className:e.styles.searchModal,onOpen:()=>E(!0),onClose:()=>E(!1),trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(Se,{size:16})}),content:_})})}),J=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ie.Modal,{className:e.styles.localeModal,onOpen:()=>E(!0),onClose:()=>E(!1),trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",role:"menuitem",className:e.styles.locale,children:s.jsx(we,{size:16})}),content:S})})});r.useEffect(()=>{if(typeof window<"u"){const n=()=>{const l=window.innerWidth<768;fe(l)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}},[]);const xe=()=>{N([])},me=n=>{O("forward"),N([{title:n.title,primary:n.primaryItems??[],secondary:n.secondaryItems??[],description:""}])},K=n=>{O("forward"),N(l=>[...l,{title:n.label,primary:n.sublinks??[],secondary:[],description:n.description}])},je=()=>{O("backward"),N(n=>n.slice(0,-1))},W=r.useRef(null),g=r.useRef(null),I=r.useRef(new Map),ve=()=>{U(n=>{const l=!n;return l||(N([]),O("forward"),f(null)),l})},Q=n=>{const l=I.current.get(n);if(l&&g.current){const d=l.getBoundingClientRect(),h=g.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;he(c)}},ke=n=>{f(l=>l===n?null:n)},Y=r.useCallback(n=>{W.current&&!W.current.contains(n.target)&&f(null)},[]),Z=r.useCallback(()=>{P(),typeof window<"u"&&window.innerWidth>768&&(U(!1),f(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),P=r.useCallback(()=>{if(g.current){const n=g.current.getBoundingClientRect().width;oe(n),ye(!0)}},[]);r.useEffect(()=>{const n=typeof window<"u",l=typeof document<"u";return n&&window.addEventListener("resize",Z),l&&document.addEventListener("click",Y),P(),()=>{n&&window.removeEventListener("resize",Z),l&&document.removeEventListener("click",Y)}},[]),r.useEffect(()=>{if(typeof document<"u"){const n=document.documentElement;return y||X?(n.style.overflow="hidden",n.style.height="100%"):(n.style.overflow="",n.style.height=""),()=>{n.style.overflow="",n.style.height=""}}},[y,X]);const pe=n=>n.map((l,d)=>{var ee,se,ne,le,ae;const h=`group-${d}`,z=be===d,c=(ee=l.primaryItems)==null?void 0:ee[A??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{V(d),f(h),Q(h)},onMouseLeave:()=>{V(null),B(0),f(null)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:i=>{I.current.set(h,i)},role:"menuitem","aria-haspopup":"true","aria-expanded":z,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${z?e.styles.open:""} `,children:[l.title,s.jsx($e.ChevronDown,{size:18,className:e.styles.chevron})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${z?e.styles.show:""}`,role:"menu","aria-label":`${l.title} submenu`,children:s.jsx("div",{children:s.jsxs("div",{className:`${e.styles.sublinksInner} ${l.spotlight?e.styles.withSpotlight:e.styles.withoutSpotlight}`,children:[s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.primaryColumn}`,children:[s.jsx("div",{className:e.styles.linkItem}),(se=l.primaryItems)==null?void 0:se.map((i,k)=>i.href?s.jsxs("a",{href:i.href,className:`${e.styles.link} ${A===k?e.styles.open:""}`,target:i.isExternal?"_blank":"_self",rel:i.isExternal?"noopener noreferrer":void 0,onClick:()=>{var te;f(null),(te=i.onClick)==null||te.call(i)},onMouseEnter:()=>i.sublinks?B(k):null,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[i.label,i.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:i.subtitle})]}),i.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]},i._key??k):s.jsx("button",{className:`${e.styles.sublinkToggle} ${A===k?e.styles.open:""}`,onMouseEnter:()=>B(k),children:s.jsxs("span",{className:e.styles.linkContent,children:[i.label,i.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:i.subtitle})]})},i._key??k))]}),(c==null?void 0:c.sublinks)&&((ne=c==null?void 0:c.sublinks)==null?void 0:ne.length)>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[(c==null?void 0:c.description)&&s.jsxs("div",{className:e.styles.sublinksDescription,children:[s.jsx("p",{children:"TEXT HERE"}),a==null?void 0:a(c.description)]}),(c==null?void 0:c.sublinks)&&R(c.sublinks,`${h}-${A}`)]},`${c.label}-${(le=c==null?void 0:c.sublinks)==null?void 0:le.length}`),(l==null?void 0:l.secondaryItems)&&((ae=l==null?void 0:l.secondaryItems)==null?void 0:ae.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:l.secondaryItems&&l.secondaryItems.length>0&&R(l.secondaryItems,`${h}-secondary`)}),l.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Ae,{spotlight:l.spotlight,renderText:a??(i=>String(i))})})]})})})]},l._key??`group-${d}`)}),R=(n,l="")=>n.map(d=>{const h=`${l}/${d.label}`;return s.jsx(e.NavLink,{link:d,path:h,parentPath:l,openPath:H,togglePath:ke,updateTriangleIndicator:Q,setOpenPath:f,renderLinks:R,buttonRefs:I},d._key??h)});return s.jsx("header",{ref:W,className:`${M??""} ${Ee[v]} ${Me[L]} ${e.styles.navbar} ${C?e.styles.sticky:""} ${u&&u.length?e.styles.advanced:e.styles.default}`,"aria-label":"Main navigation",children:s.jsxs("div",{className:`${e.styles.container} ${(!t||t.length===0)&&v!=="center"?e.styles.twoColumn:""}`,children:[w?s.jsx("div",{className:e.styles.logo,children:w}):s.jsx("div",{className:e.styles.title,children:b}),s.jsx("nav",{ref:g,style:{left:v==="center"?`calc(50% - ${re/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${de?e.styles.visible:e.styles.hidden}`,id:"main-menu",role:"menubar","aria-label":"Main navigation",children:s.jsxs("div",{className:e.styles.navInner,children:[s.jsx("svg",{style:{left:`${ue}px`},className:`${e.styles.triangle} ${H?e.styles.show:""}`,width:16,height:12,viewBox:"0 0 100 75",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("polygon",{points:"50,5 95,70 5,70",strokeLinejoin:"round",fill:"white",stroke:"white"})}),m==="default"&&x&&s.jsxs("div",{className:e.styles.grid,children:[x&&x.length>0&&R(x),j&&!$&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(F,{})]}),p&&s.jsx(J,{})]}),!$&&m==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&pe(u),j&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(F,{})]}),p&&s.jsx(J,{})]}),$&&m==="advanced"&&y&&o.length===0&&u&&s.jsx("div",{className:`${e.styles.mobileMenu}`,children:u.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>me(n),children:n.title})},n._key??l))}),$&&m==="advanced"&&y&&o.length>0&&s.jsxs("div",{className:`${e.styles.mobileMenuSlide} `,children:[s.jsx("button",{className:e.styles.back,onClick:o.length===1?xe:je,children:s.jsx(q.ChevronLeft,{size:18,"aria-hidden":"true",focusable:"false"})}),o[o.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:a==null?void 0:a(o[o.length-1].description)}),o[o.length-1].primary.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>K(n),children:s.jsxs("span",{className:e.styles.linkContent,children:[n.label,n.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:n.subtitle})]})}):s.jsxs("a",{href:n.href,className:e.styles.link,target:n.isExternal?"_blank":"_self",rel:n.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[n.label,n.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:n.subtitle})]}),n.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},n._key??`primary-${l}`)),o[o.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),o[o.length-1].secondary.map((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${T==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>K(n),children:n.label}):s.jsxs("a",{href:n.href,className:e.styles.link,target:n.isExternal?"_blank":"_self",rel:n.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[n.label,n.isExternal&&s.jsx(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},n._key??`secondary-${l}`))]},`stack-${o.length}`)]})}),t&&t.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(ce.ButtonGroup,{children:t.map((n,l)=>s.jsx(q.CallToAction,{as:"a",href:n.href??"/",variant:n.variant??"primary",displayType:n.displayType??"text",imageSrc:n.imageSrc,imageAlt:n.imageAlt,"aria-label":n.ariaLabel??n.label,icon:n.icon,iconAlignment:n.iconAlignment,children:n.imageSrc?s.jsx("img",{src:n.imageSrc,alt:n.imageAlt??n.ariaLabel??n.label}):n.label},n._key||l))})}),t&&t.length>0&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${y?e.styles.open:""}`,children:s.jsx(ce.ButtonGroup,{alignment:"center",children:s.jsx(q.CallToAction,{as:"a",href:t[1].href??"/",variant:t[1].variant??"primary",displayType:t[1].displayType??"text",imageSrc:t[1].imageSrc,imageAlt:t[1].imageAlt,"aria-label":t[1].ariaLabel??t[1].label,icon:t[1].icon,iconAlignment:t[1].iconAlignment,children:t[1].imageSrc?s.jsx("img",{src:t[1].imageSrc,"aria-label":t[1].imageAlt??t[1].ariaLabel??t[1].label}):t[1].label})})}),s.jsxs("div",{className:e.styles.mobileButtons,children:[$&&j&&s.jsx(F,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:ve,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,"aria-controls":"main-menu",children:y?s.jsx(Ne.X,{size:24}):s.jsx(Le,{size:24})})]})]})})}exports.Navbar=Te;
@@ -1,7 +1,7 @@
1
1
  import { jsx as a, jsxs as c, Fragment as de } from "react/jsx-runtime";
2
2
  import { useState as f, useEffect as U, useRef as G, useCallback as X } from "react";
3
3
  import { Modal as he } from "../Modal/index.mjs";
4
- import { a as Ee, C as V } from "../../../index-CIb65n0z.js";
4
+ import { a as Le, C as V } from "../../../index-CIb65n0z.js";
5
5
  import { ButtonGroup as me } from "../ButtonGroup/index.mjs";
6
6
  import { s as e, N as Ae } from "../../../NavLink-CQpDLYjg.js";
7
7
  import { E as H } from "../../../external-link-BOPobeQJ.js";
@@ -57,15 +57,15 @@ const Te = [
57
57
  spotlight: s,
58
58
  renderText: u
59
59
  }) => {
60
- var i, E, N, w, $, A, p, _, S, O, h;
61
- const L = (i = s.image) == null ? void 0 : i.asset.altText, k = ((E = s.callToAction.linkOptions) == null ? void 0 : E.linkType) === "external";
60
+ var i, L, N, y, $, A, p, _, S, O, h;
61
+ const E = (i = s.image) == null ? void 0 : i.asset.altText, k = ((L = s.callToAction.linkOptions) == null ? void 0 : L.linkType) === "external";
62
62
  let m = "#";
63
- return ((N = s.callToAction.linkOptions) == null ? void 0 : N.linkType) === "external" && ((w = s.callToAction.linkOptions) != null && w.externalUrl) ? m = ($ = s.callToAction.linkOptions) == null ? void 0 : $.externalUrl : ((A = s.callToAction.linkOptions) == null ? void 0 : A.linkType) === "internal" && ((_ = (p = s.callToAction.linkOptions) == null ? void 0 : p.internalUrl) != null && _.slug.current) && (m = `/${(O = (S = s.callToAction.linkOptions) == null ? void 0 : S.internalUrl) == null ? void 0 : O.slug.current}`), /* @__PURE__ */ c("div", { className: e.spotlight, children: [
63
+ return ((N = s.callToAction.linkOptions) == null ? void 0 : N.linkType) === "external" && ((y = s.callToAction.linkOptions) != null && y.externalUrl) ? m = ($ = s.callToAction.linkOptions) == null ? void 0 : $.externalUrl : ((A = s.callToAction.linkOptions) == null ? void 0 : A.linkType) === "internal" && ((_ = (p = s.callToAction.linkOptions) == null ? void 0 : p.internalUrl) != null && _.slug.current) && (m = `/${(O = (S = s.callToAction.linkOptions) == null ? void 0 : S.internalUrl) == null ? void 0 : O.slug.current}`), /* @__PURE__ */ c("div", { className: e.spotlight, children: [
64
64
  s.image && /* @__PURE__ */ a("div", { className: e.imageWrapper, children: /* @__PURE__ */ a(
65
65
  "img",
66
66
  {
67
67
  src: (s == null ? void 0 : s.image.imageUrl) ?? "",
68
- alt: L || s.image.asset.description || "Content image",
68
+ alt: E || s.image.asset.description || "Content image",
69
69
  width: 600,
70
70
  height: 400
71
71
  }
@@ -91,13 +91,13 @@ const Te = [
91
91
  function Qe({
92
92
  renderText: s,
93
93
  title: u,
94
- logo: L,
94
+ logo: E,
95
95
  items: k,
96
96
  groups: m,
97
97
  utilityItems: i,
98
- isSticky: E = !1,
98
+ isSticky: L = !1,
99
99
  showSearch: N = !0,
100
- showLocaleSelect: w = !0,
100
+ showLocaleSelect: y = !0,
101
101
  alignment: $ = "right",
102
102
  variant: A = "standard",
103
103
  navigationType: p = "default",
@@ -105,7 +105,7 @@ function Qe({
105
105
  localeSelectComponent: S,
106
106
  className: O
107
107
  }) {
108
- const [h, J] = f(!1), [K, z] = f(!1), [Q, v] = f(null), [fe, be] = f(0), [ue, ve] = f(!1), [ke, pe] = f(null), [t, y] = f([]), [x, B] = f(
108
+ const [h, J] = f(!1), [K, z] = f(!1), [Q, v] = f(null), [fe, be] = f(0), [ue, ve] = f(!1), [ke, pe] = f(null), [o, w] = f([]), [x, B] = f(
109
109
  0
110
110
  ), [Ne, Y] = f(null), [C, $e] = f(!1), [R, T] = f("forward"), j = () => /* @__PURE__ */ a(
111
111
  "div",
@@ -159,9 +159,9 @@ function Qe({
159
159
  }
160
160
  }, []);
161
161
  const ge = () => {
162
- y([]);
163
- }, we = (n) => {
164
- T("forward"), y([
162
+ w([]);
163
+ }, ye = (n) => {
164
+ T("forward"), w([
165
165
  {
166
166
  title: n.title,
167
167
  primary: n.primaryItems ?? [],
@@ -170,7 +170,7 @@ function Qe({
170
170
  }
171
171
  ]);
172
172
  }, P = (n) => {
173
- T("forward"), y((l) => [
173
+ T("forward"), w((l) => [
174
174
  ...l,
175
175
  {
176
176
  title: n.label,
@@ -179,18 +179,18 @@ function Qe({
179
179
  description: n.description
180
180
  }
181
181
  ]);
182
- }, ye = () => {
183
- T("backward"), y((n) => n.slice(0, -1));
182
+ }, we = () => {
183
+ T("backward"), w((n) => n.slice(0, -1));
184
184
  }, D = G(null), M = G(null), I = G(/* @__PURE__ */ new Map()), Ce = () => {
185
185
  J((n) => {
186
186
  const l = !n;
187
- return l || (y([]), T("forward"), v(null)), l;
187
+ return l || (w([]), T("forward"), v(null)), l;
188
188
  });
189
189
  }, ee = (n) => {
190
190
  const l = I.current.get(n);
191
191
  if (l && M.current) {
192
- const d = l.getBoundingClientRect(), b = M.current.getBoundingClientRect(), o = d.left - b.left + d.width / 2;
193
- pe(o);
192
+ const d = l.getBoundingClientRect(), b = M.current.getBoundingClientRect(), t = d.left - b.left + d.width / 2;
193
+ pe(t);
194
194
  }
195
195
  }, Me = (n) => {
196
196
  v((l) => l === n ? null : n);
@@ -210,14 +210,16 @@ function Qe({
210
210
  n && window.removeEventListener("resize", ae), l && document.removeEventListener("click", ne);
211
211
  };
212
212
  }, []), U(() => {
213
- if (typeof document < "u")
214
- return document.body.style.overflow = h || K ? "hidden" : "", () => {
215
- document.body.style.overflow = "";
213
+ if (typeof document < "u") {
214
+ const n = document.documentElement;
215
+ return h || K ? (n.style.overflow = "hidden", n.style.height = "100%") : (n.style.overflow = "", n.style.height = ""), () => {
216
+ n.style.overflow = "", n.style.height = "";
216
217
  };
218
+ }
217
219
  }, [h, K]);
218
- const Le = (n) => n.map((l, d) => {
219
- var se, ie, ce, re, oe;
220
- const b = `group-${d}`, F = Ne === d, o = (se = l.primaryItems) == null ? void 0 : se[x ?? 0];
220
+ const Ee = (n) => n.map((l, d) => {
221
+ var se, ie, ce, re, te;
222
+ const b = `group-${d}`, F = Ne === d, t = (se = l.primaryItems) == null ? void 0 : se[x ?? 0];
221
223
  return /* @__PURE__ */ c(
222
224
  "div",
223
225
  {
@@ -273,8 +275,8 @@ function Qe({
273
275
  target: r.isExternal ? "_blank" : "_self",
274
276
  rel: r.isExternal ? "noopener noreferrer" : void 0,
275
277
  onClick: () => {
276
- var te;
277
- v(null), (te = r.onClick) == null || te.call(r);
278
+ var oe;
279
+ v(null), (oe = r.onClick) == null || oe.call(r);
278
280
  },
279
281
  onMouseEnter: () => r.sublinks ? B(g) : null,
280
282
  role: "menuitem",
@@ -309,24 +311,24 @@ function Qe({
309
311
  ]
310
312
  }
311
313
  ),
312
- (o == null ? void 0 : o.sublinks) && ((ce = o == null ? void 0 : o.sublinks) == null ? void 0 : ce.length) > 0 && /* @__PURE__ */ c(
314
+ (t == null ? void 0 : t.sublinks) && ((ce = t == null ? void 0 : t.sublinks) == null ? void 0 : ce.length) > 0 && /* @__PURE__ */ c(
313
315
  "div",
314
316
  {
315
317
  className: `${e.sublinksColumn} ${e.fadeInFromLeft}`,
316
318
  children: [
317
- (o == null ? void 0 : o.description) && /* @__PURE__ */ c("div", { className: e.sublinksDescription, children: [
319
+ (t == null ? void 0 : t.description) && /* @__PURE__ */ c("div", { className: e.sublinksDescription, children: [
318
320
  /* @__PURE__ */ a("p", { children: "TEXT HERE" }),
319
- s == null ? void 0 : s(o.description)
321
+ s == null ? void 0 : s(t.description)
320
322
  ] }),
321
- (o == null ? void 0 : o.sublinks) && W(
322
- o.sublinks,
323
+ (t == null ? void 0 : t.sublinks) && W(
324
+ t.sublinks,
323
325
  `${b}-${x}`
324
326
  )
325
327
  ]
326
328
  },
327
- `${o.label}-${(re = o == null ? void 0 : o.sublinks) == null ? void 0 : re.length}`
329
+ `${t.label}-${(re = t == null ? void 0 : t.sublinks) == null ? void 0 : re.length}`
328
330
  ),
329
- (l == null ? void 0 : l.secondaryItems) && ((oe = l == null ? void 0 : l.secondaryItems) == null ? void 0 : oe.length) > 0 && /* @__PURE__ */ a(
331
+ (l == null ? void 0 : l.secondaryItems) && ((te = l == null ? void 0 : l.secondaryItems) == null ? void 0 : te.length) > 0 && /* @__PURE__ */ a(
330
332
  "div",
331
333
  {
332
334
  className: `${e.sublinksColumn} ${e.secondaryColumn}`,
@@ -377,14 +379,14 @@ function Qe({
377
379
  "header",
378
380
  {
379
381
  ref: D,
380
- className: `${O ?? ""} ${Be[$]} ${Fe[A]} ${e.navbar} ${E ? e.sticky : ""} ${m && m.length ? e.advanced : e.default}`,
382
+ className: `${O ?? ""} ${Be[$]} ${Fe[A]} ${e.navbar} ${L ? e.sticky : ""} ${m && m.length ? e.advanced : e.default}`,
381
383
  "aria-label": "Main navigation",
382
384
  children: /* @__PURE__ */ c(
383
385
  "div",
384
386
  {
385
387
  className: `${e.container} ${(!i || i.length === 0) && $ !== "center" ? e.twoColumn : ""}`,
386
388
  children: [
387
- L ? /* @__PURE__ */ a("div", { className: e.logo, children: L }) : /* @__PURE__ */ a("div", { className: e.title, children: u }),
389
+ E ? /* @__PURE__ */ a("div", { className: e.logo, children: E }) : /* @__PURE__ */ a("div", { className: e.title, children: u }),
388
390
  /* @__PURE__ */ a(
389
391
  "nav",
390
392
  {
@@ -423,17 +425,17 @@ function Qe({
423
425
  /* @__PURE__ */ a("span", { className: e.separator }),
424
426
  /* @__PURE__ */ a(j, {})
425
427
  ] }),
426
- w && /* @__PURE__ */ a(Z, {})
428
+ y && /* @__PURE__ */ a(Z, {})
427
429
  ] }),
428
430
  !C && p === "advanced" && m && /* @__PURE__ */ c("div", { className: e.grid, children: [
429
- m.length > 0 && Le(m),
431
+ m.length > 0 && Ee(m),
430
432
  N && /* @__PURE__ */ c(de, { children: [
431
433
  /* @__PURE__ */ a("span", { className: e.separator }),
432
434
  /* @__PURE__ */ a(j, {})
433
435
  ] }),
434
- w && /* @__PURE__ */ a(Z, {})
436
+ y && /* @__PURE__ */ a(Z, {})
435
437
  ] }),
436
- C && p === "advanced" && h && t.length === 0 && m && /* @__PURE__ */ a("div", { className: `${e.mobileMenu}`, children: m.map((n, l) => /* @__PURE__ */ a(
438
+ C && p === "advanced" && h && o.length === 0 && m && /* @__PURE__ */ a("div", { className: `${e.mobileMenu}`, children: m.map((n, l) => /* @__PURE__ */ a(
437
439
  "div",
438
440
  {
439
441
  className: `${e.mobileMenuItem} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
@@ -441,14 +443,14 @@ function Qe({
441
443
  "button",
442
444
  {
443
445
  className: e.sublinkToggle,
444
- onClick: () => we(n),
446
+ onClick: () => ye(n),
445
447
  children: n.title
446
448
  }
447
449
  )
448
450
  },
449
451
  n._key ?? l
450
452
  )) }),
451
- C && p === "advanced" && h && t.length > 0 && /* @__PURE__ */ c(
453
+ C && p === "advanced" && h && o.length > 0 && /* @__PURE__ */ c(
452
454
  "div",
453
455
  {
454
456
  className: `${e.mobileMenuSlide} `,
@@ -457,9 +459,9 @@ function Qe({
457
459
  "button",
458
460
  {
459
461
  className: e.back,
460
- onClick: t.length === 1 ? ge : ye,
462
+ onClick: o.length === 1 ? ge : we,
461
463
  children: /* @__PURE__ */ a(
462
- Ee,
464
+ Le,
463
465
  {
464
466
  size: 18,
465
467
  "aria-hidden": "true",
@@ -468,16 +470,16 @@ function Qe({
468
470
  )
469
471
  }
470
472
  ),
471
- t[t.length - 1].description && /* @__PURE__ */ a(
473
+ o[o.length - 1].description && /* @__PURE__ */ a(
472
474
  "div",
473
475
  {
474
476
  className: `${e.sublinksDescription} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
475
477
  children: s == null ? void 0 : s(
476
- t[t.length - 1].description
478
+ o[o.length - 1].description
477
479
  )
478
480
  }
479
481
  ),
480
- t[t.length - 1].primary.map((n, l) => /* @__PURE__ */ a(
482
+ o[o.length - 1].primary.map((n, l) => /* @__PURE__ */ a(
481
483
  "div",
482
484
  {
483
485
  className: `${e.mobileMenuItem} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
@@ -517,8 +519,8 @@ function Qe({
517
519
  },
518
520
  n._key ?? `primary-${l}`
519
521
  )),
520
- t[t.length - 1].secondary.length > 0 && /* @__PURE__ */ a("hr", { className: e.groupDivider }),
521
- t[t.length - 1].secondary.map(
522
+ o[o.length - 1].secondary.length > 0 && /* @__PURE__ */ a("hr", { className: e.groupDivider }),
523
+ o[o.length - 1].secondary.map(
522
524
  (n, l) => /* @__PURE__ */ a(
523
525
  "div",
524
526
  {
@@ -556,7 +558,7 @@ function Qe({
556
558
  )
557
559
  ]
558
560
  },
559
- `stack-${t.length}`
561
+ `stack-${o.length}`
560
562
  )
561
563
  ] })
562
564
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.461",
4
+ "version": "0.0.462",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {