quirk-ui 0.1.25 → 0.1.26

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.
@@ -8,4 +8,4 @@
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Le=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Me=ne.createLucideIcon("search",Le),Ee={standard:e.styles.standard,transparent:e.styles.transparent},Be={left:e.styles.left,center:e.styles.center,right:e.styles.right},Re=({spotlight:i,renderText:h})=>{var y,_,p,k,v,S;const r=i.callToAction;if(!r)return null;const j=((y=r.linkOptions)==null?void 0:y.linkType)==="external";let u="#";return j&&((_=r.linkOptions)!=null&&_.externalUrl)?u=r.linkOptions.externalUrl:((p=r.linkOptions)==null?void 0:p.linkType)==="internal"&&((v=(k=r.linkOptions)==null?void 0:k.internalUrl)!=null&&v.slug.current)&&(u=`/${r.linkOptions.internalUrl.slug.current}`),s.jsxs("div",{className:e.styles.spotlight,children:[i.image&&s.jsx("div",{className:e.styles.imageWrapper,children:s.jsx("img",{src:((S=i.image.imageUrls)==null?void 0:S.medium)??"",alt:i.image.asset.altText||i.image.asset.description||"Content image",width:600,height:400})}),s.jsxs("div",{className:e.styles.content,children:[i.title&&s.jsx("div",{className:e.styles.title,children:h==null?void 0:h(i.title,e.styles.title)}),i.description&&s.jsx("div",{className:e.styles.description,children:h==null?void 0:h(i.description,e.styles.description)})]}),r.linkOptions&&s.jsx("div",{className:e.styles.actions,children:s.jsx(q.Button,{as:"a",variant:r.variant??"primary",href:u,target:j?"_blank":"_self",rel:j?"noopener noreferrer":void 0,"aria-label":r.ariaLabel||r.label,children:r.label})})]})};function qe({renderText:i,title:h,logo:r,items:j,groups:u,utilityItems:y,isSticky:_=!1,showSearch:p=!0,showLocaleSelect:k=!0,showThemeToggle:v=!0,themeToggleComponent:S,alignment:z="right",variant:ae="standard",navigationType:I="default",searchComponent:te,localeSelectComponent:ie,className:re,style:ce,...oe}){const[m,V]=a.useState(!1),[H,f]=a.useState(null),[de,ue]=a.useState(0),[ye,he]=a.useState(!1),[me,be]=a.useState(null),[c,$]=a.useState([]),[L,O]=a.useState(0),[xe,X]=a.useState(null),[w,pe]=a.useState(!1),[M,E]=a.useState("forward"),A=a.useRef(null),C=a.useRef(null),W=a.useRef(new Map),J=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,children:s.jsx("div",{className:`${e.styles.linkItem} ${e.styles.themeToggle}`,children:S})}),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(se.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(Me,{size:16,"aria-hidden":"true"})}),content:te})})}),K=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(se.Modal,{className:e.styles.localeModal,trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",className:e.styles.locale,children:s.jsx(Ie,{size:16,"aria-hidden":"true"})}),content:ie})})}),B=a.useCallback(()=>{C.current&&ue(C.current.getBoundingClientRect().width)},[]),fe=()=>{V(l=>{const n=!l;return n||($([]),E("forward"),f(null)),n})},Q=a.useCallback(l=>{const n=W.current.get(l);if(n&&C.current){const d=n.getBoundingClientRect(),b=C.current.getBoundingClientRect();be(d.left-b.left+d.width/2)}},[]),je=a.useCallback(l=>{f(n=>n===l?null:l)},[]),G=a.useCallback(l=>{A.current&&!A.current.contains(l.target)&&f(null)},[]),D=a.useCallback(()=>{B(),typeof window<"u"&&window.innerWidth>768&&(V(!1),f(null))},[B]),ke=()=>$([]),ve=l=>{E("forward"),$([{title:l.title,primary:l.primaryItems??[],secondary:l.secondaryItems??[],description:""}])},Y=l=>{E("forward"),$(n=>[...n,{title:l.label,primary:l.sublinks??[],secondary:[],description:l.description}])},ge=()=>{E("backward"),$(l=>l.slice(0,-1))};a.useEffect(()=>{if(typeof window>"u")return;const l=()=>pe(window.innerWidth<768);return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),a.useEffect(()=>{const l=typeof window<"u",n=typeof document<"u";return l&&window.addEventListener("resize",D),n&&document.addEventListener("click",G),B(),he(!0),()=>{l&&window.removeEventListener("resize",D),n&&document.removeEventListener("click",G)}},[D,G,B]),a.useEffect(()=>{if(!(typeof document>"u"))return m?setTimeout(()=>U.lockScroll(),0):U.unlockScroll(),()=>U.unlockScroll()},[m]);const R=(l,n="")=>l.map((d,b)=>{const g=`${n}/${d._key??d.label}-${b}`;return s.jsx(e.NavLink,{link:d,path:g,parentPath:n,openPath:H,togglePath:je,updateTriangleIndicator:Q,setOpenPath:f,renderLinks:R,buttonRefs:W},g)}),Ne=l=>l.map((n,d)=>{var Z,T;const b=`group-${d}`,g=xe===d,x=(Z=n.primaryItems)==null?void 0:Z[L??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{X(d),f(b),Q(b)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:t=>{W.current.set(b,t)},"aria-haspopup":!0,"aria-expanded":g,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${g?e.styles.open:""}`,children:[n.title,s.jsx(_e.ChevronDown,{size:18,className:e.styles.chevron,"aria-hidden":"true"})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${g?e.styles.show:""}`,role:"menu","aria-label":`${n.title} submenu`,onMouseLeave:()=>{X(null),O(0),f(null)},children:s.jsx("div",{children:s.jsxs("div",{className:`${e.styles.sublinksInner} ${n.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}),(T=n.primaryItems)==null?void 0:T.map((t,N)=>t.href?s.jsxs("a",{href:t.href,className:`${e.styles.link} ${L===N?e.styles.open:""}`,target:t.isExternal?"_blank":"_self",rel:t.isExternal?"noopener noreferrer":void 0,onClick:()=>{var ee;f(null),(ee=t.onClick)==null||ee.call(t)},onMouseEnter:()=>O(N),role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[t.label,t.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:t.subtitle})]}),t.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]},t._key??N):s.jsx("button",{className:`${e.styles.sublinkToggle} ${L===N?e.styles.open:""}`,onMouseEnter:()=>O(N),children:s.jsxs("span",{className:e.styles.linkContent,children:[t.label,t.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:t.subtitle})]})},t._key??N))]}),(x==null?void 0:x.sublinks)&&x.sublinks.length>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[x.description&&s.jsx("div",{className:e.styles.sublinksDescription,children:i==null?void 0:i(x.description)}),R(x.sublinks,`${b}-${L}`)]},`${x.label}-${x.sublinks.length}`),n.secondaryItems&&n.secondaryItems.length>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:R(n.secondaryItems,`${b}-secondary`)}),n.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Re,{spotlight:n.spotlight,renderText:i})})]})})})]},n._key??`group-${d}`)}),$e=[e.styles.navbar,Be[z],Ee[ae],_?e.styles.sticky:"",u!=null&&u.length?e.styles.advanced:e.styles.default,re??""].filter(Boolean).join(" "),o=y&&y.length>0?y[Math.min(1,y.length-1)]:null;return s.jsx("header",{ref:A,className:$e,style:ce,"aria-label":"Site header",...oe,children:s.jsxs("div",{className:`${e.styles.container} ${(!y||y.length===0)&&z!=="center"?e.styles.twoColumn:""}`,children:[r?s.jsx("div",{className:e.styles.logo,children:r}):h?s.jsx("div",{className:e.styles.title,children:h}):null,s.jsx("nav",{ref:C,style:{left:z==="center"?`calc(50% - ${de/2}px)`:"0"},className:`${e.styles.nav} ${m?e.styles.open:""} ${ye?e.styles.visible:e.styles.hidden}`,id:"main-menu","aria-label":"Primary navigation",children:s.jsxs("div",{className:e.styles.navInner,children:[s.jsx("svg",{style:{left:`${me}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","aria-hidden":"true",children:s.jsx("polygon",{points:"50,5 95,70 5,70",strokeLinejoin:"round",fill:"white",stroke:"white"})}),I==="default"&&j&&s.jsxs("div",{className:e.styles.grid,children:[j.length>0&&R(j),(p||k||v)&&s.jsx("span",{className:e.styles.separator,"aria-hidden":"true"}),v&&s.jsx(J,{}),p&&!w&&s.jsx(F,{}),k&&s.jsx(K,{})]}),!w&&I==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&Ne(u),(p||k||v)&&s.jsx("span",{className:e.styles.separator,"aria-hidden":"true"}),v&&s.jsx(J,{}),p&&s.jsx(F,{}),k&&s.jsx(K,{})]}),w&&I==="advanced"&&m&&c.length===0&&u&&s.jsx("div",{className:e.styles.mobileMenu,children:u.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>ve(l),children:l.title})},l._key??n))}),w&&I==="advanced"&&m&&c.length>0&&s.jsxs("div",{className:e.styles.mobileMenuSlide,children:[s.jsx("button",{className:e.styles.back,"aria-label":"Go back",onClick:c.length===1?ke:ge,children:s.jsx(we.ChevronLeft,{size:18,"aria-hidden":"true"})}),c[c.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:i==null?void 0:i(c[c.length-1].description)}),c[c.length-1].primary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>Y(l),children:s.jsxs("span",{className:e.styles.linkContent,children:[l.label,l.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:l.subtitle})]})}):s.jsxs("a",{href:l.href,className:e.styles.link,target:l.isExternal?"_blank":"_self",rel:l.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[l.label,l.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:l.subtitle})]}),l.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]})},l._key??`primary-${n}`)),c[c.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),c[c.length-1].secondary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>Y(l),children:l.label}):s.jsxs("a",{href:l.href,className:e.styles.link,target:l.isExternal?"_blank":"_self",rel:l.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[l.label,l.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]})},l._key??`secondary-${n}`))]},`stack-${c.length}`)]})}),y&&y.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(le.ButtonGroup,{children:y.map((l,n)=>s.jsx(q.Button,{as:"a",href:l.href??"/",variant:l.variant??"primary",displayType:l.displayType??"text",imageSrc:l.imageSrc,imageAlt:l.imageAlt,"aria-label":l.ariaLabel,icon:l.icon,iconAlignment:l.iconAlignment,children:l.imageSrc?s.jsx("img",{src:l.imageSrc,alt:l.imageAlt??l.ariaLabel}):l.label},l._key??n))})}),o&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${m?e.styles.open:""}`,children:s.jsx(le.ButtonGroup,{alignment:"center",children:s.jsx(q.Button,{as:"a",href:o.href??"/",variant:o.variant??"primary",displayType:o.displayType??"text",imageSrc:o.imageSrc,imageAlt:o.imageAlt,"aria-label":o.ariaLabel,icon:o.icon,iconAlignment:o.iconAlignment,children:o.imageSrc?s.jsx("img",{src:o.imageSrc,alt:o.imageAlt??o.ariaLabel}):o.label})})}),s.jsxs("div",{className:e.styles.mobileButtons,children:[w&&p&&s.jsx(F,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:fe,"aria-label":m?"Close menu":"Open menu","aria-expanded":m,"aria-controls":"main-menu",children:m?s.jsx(Ce.X,{size:24,"aria-hidden":"true"}):s.jsx(q.Menu,{size:24,"aria-hidden":"true"})})]})]})})}exports.Navbar=qe;
11
+ */const Le=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Me=ne.createLucideIcon("search",Le),Ee={standard:e.styles.standard,transparent:e.styles.transparent},Be={left:e.styles.left,center:e.styles.center,right:e.styles.right},Re=({spotlight:i,renderText:h})=>{var y,_,p,k,v,S;const r=i.callToAction;if(!r)return null;const j=((y=r.linkOptions)==null?void 0:y.linkType)==="external";let u="#";return j&&((_=r.linkOptions)!=null&&_.externalUrl)?u=r.linkOptions.externalUrl:((p=r.linkOptions)==null?void 0:p.linkType)==="internal"&&((v=(k=r.linkOptions)==null?void 0:k.internalUrl)!=null&&v.slug.current)&&(u=`/${r.linkOptions.internalUrl.slug.current}`),s.jsxs("div",{className:e.styles.spotlight,children:[i.image&&s.jsx("div",{className:e.styles.imageWrapper,children:s.jsx("img",{src:((S=i.image.imageUrls)==null?void 0:S.medium)??"",alt:i.image.asset.altText||i.image.asset.description||"Content image",width:600,height:400})}),s.jsxs("div",{className:e.styles.content,children:[i.title&&s.jsx("div",{className:e.styles.title,children:h==null?void 0:h(i.title,e.styles.title)}),i.description&&s.jsx("div",{className:e.styles.description,children:h==null?void 0:h(i.description,e.styles.description)})]}),r.linkOptions&&s.jsx("div",{className:e.styles.actions,children:s.jsx(q.Button,{as:"a",variant:r.variant??"primary",href:u,target:j?"_blank":"_self",rel:j?"noopener noreferrer":void 0,"aria-label":r.ariaLabel||r.label,children:r.label})})]})};function qe({renderText:i,title:h,logo:r,items:j,groups:u,utilityItems:y,isSticky:_=!1,showSearch:p=!0,showLocaleSelect:k=!0,showThemeToggle:v=!0,themeToggleComponent:S,alignment:z="right",variant:ae="standard",navigationType:I="default",searchComponent:te,localeSelectComponent:ie,className:re,style:ce,...oe}){const[m,V]=a.useState(!1),[H,f]=a.useState(null),[de,ue]=a.useState(0),[ye,he]=a.useState(!1),[me,be]=a.useState(null),[c,$]=a.useState([]),[L,O]=a.useState(0),[xe,X]=a.useState(null),[w,pe]=a.useState(!1),[M,E]=a.useState("forward"),A=a.useRef(null),C=a.useRef(null),W=a.useRef(new Map),J=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,children:s.jsx("div",{className:`${e.styles.linkItem} ${e.styles.themeToggle}`,children:S})}),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(se.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(Me,{size:16,"aria-hidden":"true"})}),content:te})})}),K=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(se.Modal,{className:e.styles.localeModal,trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",className:e.styles.locale,children:s.jsx(Ie,{size:16,"aria-hidden":"true"})}),content:ie})})}),B=a.useCallback(()=>{C.current&&ue(C.current.getBoundingClientRect().width)},[]),fe=()=>{V(l=>{const n=!l;return n||($([]),E("forward"),f(null)),n})},Q=a.useCallback(l=>{const n=W.current.get(l);if(n&&C.current){const d=n.getBoundingClientRect(),b=C.current.getBoundingClientRect();be(d.left-b.left+d.width/2)}},[]),je=a.useCallback(l=>{f(n=>n===l?null:l)},[]),G=a.useCallback(l=>{A.current&&!A.current.contains(l.target)&&f(null)},[]),D=a.useCallback(()=>{B(),typeof window<"u"&&window.innerWidth>768&&(V(!1),f(null))},[B]),ke=()=>$([]),ve=l=>{E("forward"),$([{title:l.title,primary:l.primaryItems??[],secondary:l.secondaryItems??[],description:""}])},Y=l=>{E("forward"),$(n=>[...n,{title:l.label,primary:l.sublinks??[],secondary:[],description:l.description}])},ge=()=>{E("backward"),$(l=>l.slice(0,-1))};a.useEffect(()=>{if(typeof window>"u")return;const l=()=>pe(window.innerWidth<768);return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),a.useEffect(()=>{const l=typeof window<"u",n=typeof document<"u";return l&&window.addEventListener("resize",D),n&&document.addEventListener("click",G),B(),he(!0),()=>{l&&window.removeEventListener("resize",D),n&&document.removeEventListener("click",G)}},[D,G,B]),a.useEffect(()=>{if(!(typeof document>"u"))return m?setTimeout(()=>U.lockScroll(),0):U.unlockScroll(),()=>U.unlockScroll()},[m]);const R=(l,n="")=>l.map((d,b)=>{const g=`${n}/${d._key??d.label}-${b}`;return s.jsx(e.NavLink,{link:d,path:g,parentPath:n,openPath:H,togglePath:je,updateTriangleIndicator:Q,setOpenPath:f,renderLinks:R,buttonRefs:W},g)}),Ne=l=>l.map((n,d)=>{var Z,T;const b=`group-${d}`,g=xe===d,x=(Z=n.primaryItems)==null?void 0:Z[L??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{X(d),f(b),Q(b)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:t=>{W.current.set(b,t)},"aria-haspopup":!0,"aria-expanded":g,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${g?e.styles.open:""}`,children:[n.title,s.jsx(_e.ChevronDown,{size:18,className:e.styles.chevron,"aria-hidden":"true"})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${g?e.styles.show:""}`,role:"menu","aria-label":`${n.title} submenu`,onMouseLeave:()=>{X(null),O(0),f(null)},children:s.jsx("div",{children:s.jsxs("div",{className:`${e.styles.sublinksInner} ${n.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}),(T=n.primaryItems)==null?void 0:T.map((t,N)=>t.href?s.jsxs("a",{href:t.href,className:`${e.styles.link} ${L===N?e.styles.open:""}`,target:t.isExternal?"_blank":"_self",rel:t.isExternal?"noopener noreferrer":void 0,onClick:()=>{var ee;f(null),(ee=t.onClick)==null||ee.call(t)},onMouseEnter:()=>O(N),role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[t.label,t.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:t.subtitle})]}),t.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]},t._key??N):s.jsx("button",{className:`${e.styles.sublinkToggle} ${L===N?e.styles.open:""}`,onMouseEnter:()=>O(N),children:s.jsxs("span",{className:e.styles.linkContent,children:[t.label,t.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:t.subtitle})]})},t._key??N))]}),(x==null?void 0:x.sublinks)&&x.sublinks.length>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[x.description&&s.jsx("div",{className:e.styles.sublinksDescription,children:i==null?void 0:i(x.description)}),R(x.sublinks,`${b}-${L}`)]},`${x.label}-${x.sublinks.length}`),n.secondaryItems&&n.secondaryItems.length>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:R(n.secondaryItems,`${b}-secondary`)}),n.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Re,{spotlight:n.spotlight,renderText:i})})]})})})]},n._key??`group-${d}`)}),$e=[e.styles.navbar,Be[z],Ee[ae],_?e.styles.sticky:"",u!=null&&u.length?e.styles.advanced:e.styles.default,re??""].filter(Boolean).join(" "),o=y&&y.length>0?y[Math.min(1,y.length-1)]:null;return s.jsx("header",{ref:A,className:$e,style:ce,"aria-label":"Site header",...oe,children:s.jsxs("div",{className:`${e.styles.container} ${(!y||y.length===0)&&z!=="center"?e.styles.twoColumn:""}`,children:[r?s.jsx("div",{className:e.styles.logo,children:r}):h?s.jsx("div",{className:e.styles.title,children:h}):null,s.jsx("nav",{ref:C,style:{left:z==="center"?`calc(50% - ${de/2}px)`:"0"},className:`${e.styles.nav} ${m?e.styles.open:""} ${ye?e.styles.visible:e.styles.hidden}`,id:"main-menu","aria-label":"Primary navigation",children:s.jsxs("div",{className:e.styles.navInner,children:[s.jsx("svg",{style:{left:`${me}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","aria-hidden":"true",children:s.jsx("polygon",{points:"50,5 95,70 5,70",strokeLinejoin:"round",fill:"white",stroke:"white"})}),I==="default"&&j&&s.jsxs("div",{className:e.styles.grid,role:"menubar",children:[j.length>0&&R(j),(p||k||v)&&s.jsx("span",{className:e.styles.separator,"aria-hidden":"true"}),v&&s.jsx(J,{}),p&&!w&&s.jsx(F,{}),k&&s.jsx(K,{})]}),!w&&I==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&Ne(u),(p||k||v)&&s.jsx("span",{className:e.styles.separator,"aria-hidden":"true"}),v&&s.jsx(J,{}),p&&s.jsx(F,{}),k&&s.jsx(K,{})]}),w&&I==="advanced"&&m&&c.length===0&&u&&s.jsx("div",{className:e.styles.mobileMenu,children:u.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>ve(l),children:l.title})},l._key??n))}),w&&I==="advanced"&&m&&c.length>0&&s.jsxs("div",{className:e.styles.mobileMenuSlide,children:[s.jsx("button",{className:e.styles.back,"aria-label":"Go back",onClick:c.length===1?ke:ge,children:s.jsx(we.ChevronLeft,{size:18,"aria-hidden":"true"})}),c[c.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:i==null?void 0:i(c[c.length-1].description)}),c[c.length-1].primary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>Y(l),children:s.jsxs("span",{className:e.styles.linkContent,children:[l.label,l.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:l.subtitle})]})}):s.jsxs("a",{href:l.href,className:e.styles.link,target:l.isExternal?"_blank":"_self",rel:l.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[s.jsxs("span",{className:e.styles.linkContent,children:[l.label,l.subtitle&&s.jsx("span",{className:e.styles.subtitle,children:l.subtitle})]}),l.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]})},l._key??`primary-${n}`)),c[c.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),c[c.length-1].secondary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${M==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>Y(l),children:l.label}):s.jsxs("a",{href:l.href,className:e.styles.link,target:l.isExternal?"_blank":"_self",rel:l.isExternal?"noopener noreferrer":void 0,role:"menuitem",children:[l.label,l.isExternal&&s.jsx(P.ExternalLink,{className:e.styles.newTabIcon,size:16,"aria-hidden":"true"})]})},l._key??`secondary-${n}`))]},`stack-${c.length}`)]})}),y&&y.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(le.ButtonGroup,{children:y.map((l,n)=>s.jsx(q.Button,{as:"a",href:l.href??"/",variant:l.variant??"primary",displayType:l.displayType??"text",imageSrc:l.imageSrc,imageAlt:l.imageAlt,"aria-label":l.ariaLabel,icon:l.icon,iconAlignment:l.iconAlignment,children:l.imageSrc?s.jsx("img",{src:l.imageSrc,alt:l.imageAlt??l.ariaLabel}):l.label},l._key??n))})}),o&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${m?e.styles.open:""}`,children:s.jsx(le.ButtonGroup,{alignment:"center",children:s.jsx(q.Button,{as:"a",href:o.href??"/",variant:o.variant??"primary",displayType:o.displayType??"text",imageSrc:o.imageSrc,imageAlt:o.imageAlt,"aria-label":o.ariaLabel,icon:o.icon,iconAlignment:o.iconAlignment,children:o.imageSrc?s.jsx("img",{src:o.imageSrc,alt:o.imageAlt??o.ariaLabel}):o.label})})}),s.jsxs("div",{className:e.styles.mobileButtons,children:[w&&p&&s.jsx(F,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:fe,"aria-label":m?"Close menu":"Open menu","aria-expanded":m,"aria-controls":"main-menu",children:m?s.jsx(Ce.X,{size:24,"aria-hidden":"true"}):s.jsx(q.Menu,{size:24,"aria-hidden":"true"})})]})]})})}exports.Navbar=qe;
@@ -48,12 +48,12 @@ const xe = [
48
48
  spotlight: r,
49
49
  renderText: p
50
50
  }) => {
51
- var m, _, k, $, y, S;
51
+ var h, _, k, $, y, S;
52
52
  const t = r.callToAction;
53
53
  if (!t) return null;
54
- const N = ((m = t.linkOptions) == null ? void 0 : m.linkType) === "external";
55
- let h = "#";
56
- return N && ((_ = t.linkOptions) != null && _.externalUrl) ? h = t.linkOptions.externalUrl : ((k = t.linkOptions) == null ? void 0 : k.linkType) === "internal" && ((y = ($ = t.linkOptions) == null ? void 0 : $.internalUrl) != null && y.slug.current) && (h = `/${t.linkOptions.internalUrl.slug.current}`), /* @__PURE__ */ i("div", { className: e.spotlight, children: [
54
+ const N = ((h = t.linkOptions) == null ? void 0 : h.linkType) === "external";
55
+ let m = "#";
56
+ return N && ((_ = t.linkOptions) != null && _.externalUrl) ? m = t.linkOptions.externalUrl : ((k = t.linkOptions) == null ? void 0 : k.linkType) === "internal" && ((y = ($ = t.linkOptions) == null ? void 0 : $.internalUrl) != null && y.slug.current) && (m = `/${t.linkOptions.internalUrl.slug.current}`), /* @__PURE__ */ i("div", { className: e.spotlight, children: [
57
57
  r.image && /* @__PURE__ */ n("div", { className: e.imageWrapper, children: /* @__PURE__ */ n(
58
58
  "img",
59
59
  {
@@ -72,7 +72,7 @@ const xe = [
72
72
  {
73
73
  as: "a",
74
74
  variant: t.variant ?? "primary",
75
- href: h,
75
+ href: m,
76
76
  target: N ? "_blank" : "_self",
77
77
  rel: N ? "noopener noreferrer" : void 0,
78
78
  "aria-label": t.ariaLabel || t.label,
@@ -86,8 +86,8 @@ function en({
86
86
  title: p,
87
87
  logo: t,
88
88
  items: N,
89
- groups: h,
90
- utilityItems: m,
89
+ groups: m,
90
+ utilityItems: h,
91
91
  isSticky: _ = !1,
92
92
  showSearch: k = !0,
93
93
  showLocaleSelect: $ = !0,
@@ -98,11 +98,11 @@ function en({
98
98
  navigationType: z = "default",
99
99
  searchComponent: oe,
100
100
  localeSelectComponent: de,
101
- className: he,
102
- style: me,
101
+ className: me,
102
+ style: he,
103
103
  ...ue
104
104
  }) {
105
- const [f, J] = u(!1), [K, g] = u(null), [pe, fe] = u(0), [be, ve] = u(!1), [ke, ge] = u(null), [c, I] = u([]), [R, F] = u(
105
+ const [b, J] = u(!1), [K, g] = u(null), [pe, be] = u(0), [fe, ve] = u(!1), [ke, ge] = u(null), [c, I] = u([]), [R, F] = u(
106
106
  0
107
107
  ), [Ne, Q] = u(null), [M, $e] = u(!1), [A, B] = u("forward"), U = V(null), E = V(null), j = V(/* @__PURE__ */ new Map()), Y = () => /* @__PURE__ */ n("div", { className: `${e.linkWrapper} ${e.parent}`, children: /* @__PURE__ */ n("div", { className: `${e.linkItem} ${e.themeToggle}`, children: S }) }), D = () => /* @__PURE__ */ n(
108
108
  "div",
@@ -141,7 +141,7 @@ function en({
141
141
  content: de
142
142
  }
143
143
  ) }) }), O = L(() => {
144
- E.current && fe(E.current.getBoundingClientRect().width);
144
+ E.current && be(E.current.getBoundingClientRect().width);
145
145
  }, []), ye = () => {
146
146
  J((a) => {
147
147
  const l = !a;
@@ -150,8 +150,8 @@ function en({
150
150
  }, T = L((a) => {
151
151
  const l = j.current.get(a);
152
152
  if (l && E.current) {
153
- const d = l.getBoundingClientRect(), b = E.current.getBoundingClientRect();
154
- ge(d.left - b.left + d.width / 2);
153
+ const d = l.getBoundingClientRect(), f = E.current.getBoundingClientRect();
154
+ ge(d.left - f.left + d.width / 2);
155
155
  }
156
156
  }, []), we = L((a) => {
157
157
  g((l) => l === a ? null : a);
@@ -192,10 +192,10 @@ function en({
192
192
  };
193
193
  }, [P, G, O]), H(() => {
194
194
  if (!(typeof document > "u"))
195
- return f ? setTimeout(() => ze(), 0) : re(), () => re();
196
- }, [f]);
197
- const W = (a, l = "") => a.map((d, b) => {
198
- const w = `${l}/${d._key ?? d.label}-${b}`;
195
+ return b ? setTimeout(() => ze(), 0) : re(), () => re();
196
+ }, [b]);
197
+ const W = (a, l = "") => a.map((d, f) => {
198
+ const w = `${l}/${d._key ?? d.label}-${f}`;
199
199
  return /* @__PURE__ */ n(
200
200
  Se,
201
201
  {
@@ -213,20 +213,20 @@ function en({
213
213
  );
214
214
  }), Ee = (a) => a.map((l, d) => {
215
215
  var ne, ae;
216
- const b = `group-${d}`, w = Ne === d, v = (ne = l.primaryItems) == null ? void 0 : ne[R ?? 0];
216
+ const f = `group-${d}`, w = Ne === d, v = (ne = l.primaryItems) == null ? void 0 : ne[R ?? 0];
217
217
  return /* @__PURE__ */ i(
218
218
  "div",
219
219
  {
220
220
  className: `${e.linkWrapper} ${e.parent}`,
221
221
  onMouseEnter: () => {
222
- Q(d), g(b), T(b);
222
+ Q(d), g(f), T(f);
223
223
  },
224
224
  children: [
225
225
  /* @__PURE__ */ n("div", { className: e.linkItem, children: /* @__PURE__ */ i(
226
226
  "button",
227
227
  {
228
228
  ref: (s) => {
229
- j.current.set(b, s);
229
+ j.current.set(f, s);
230
230
  },
231
231
  "aria-haspopup": !0,
232
232
  "aria-expanded": w,
@@ -320,7 +320,7 @@ function en({
320
320
  v.description && /* @__PURE__ */ n("div", { className: e.sublinksDescription, children: r == null ? void 0 : r(v.description) }),
321
321
  W(
322
322
  v.sublinks,
323
- `${b}-${R}`
323
+ `${f}-${R}`
324
324
  )
325
325
  ]
326
326
  },
@@ -330,7 +330,7 @@ function en({
330
330
  "div",
331
331
  {
332
332
  className: `${e.sublinksColumn} ${e.secondaryColumn}`,
333
- children: W(l.secondaryItems, `${b}-secondary`)
333
+ children: W(l.secondaryItems, `${f}-secondary`)
334
334
  }
335
335
  ),
336
336
  l.spotlight && /* @__PURE__ */ n(
@@ -360,21 +360,21 @@ function en({
360
360
  je[x],
361
361
  Ue[ce],
362
362
  _ ? e.sticky : "",
363
- h != null && h.length ? e.advanced : e.default,
364
- he ?? ""
365
- ].filter(Boolean).join(" "), o = m && m.length > 0 ? m[Math.min(1, m.length - 1)] : null;
363
+ m != null && m.length ? e.advanced : e.default,
364
+ me ?? ""
365
+ ].filter(Boolean).join(" "), o = h && h.length > 0 ? h[Math.min(1, h.length - 1)] : null;
366
366
  return /* @__PURE__ */ n(
367
367
  "header",
368
368
  {
369
369
  ref: U,
370
370
  className: Le,
371
- style: me,
371
+ style: he,
372
372
  "aria-label": "Site header",
373
373
  ...ue,
374
374
  children: /* @__PURE__ */ i(
375
375
  "div",
376
376
  {
377
- className: `${e.container} ${(!m || m.length === 0) && x !== "center" ? e.twoColumn : ""}`,
377
+ className: `${e.container} ${(!h || h.length === 0) && x !== "center" ? e.twoColumn : ""}`,
378
378
  children: [
379
379
  t ? /* @__PURE__ */ n("div", { className: e.logo, children: t }) : p ? /* @__PURE__ */ n("div", { className: e.title, children: p }) : null,
380
380
  /* @__PURE__ */ n(
@@ -384,7 +384,7 @@ function en({
384
384
  style: {
385
385
  left: x === "center" ? `calc(50% - ${pe / 2}px)` : "0"
386
386
  },
387
- className: `${e.nav} ${f ? e.open : ""} ${be ? e.visible : e.hidden}`,
387
+ className: `${e.nav} ${b ? e.open : ""} ${fe ? e.visible : e.hidden}`,
388
388
  id: "main-menu",
389
389
  "aria-label": "Primary navigation",
390
390
  children: /* @__PURE__ */ i("div", { className: e.navInner, children: [
@@ -409,21 +409,21 @@ function en({
409
409
  )
410
410
  }
411
411
  ),
412
- z === "default" && N && /* @__PURE__ */ i("div", { className: e.grid, children: [
412
+ z === "default" && N && /* @__PURE__ */ i("div", { className: e.grid, role: "menubar", children: [
413
413
  N.length > 0 && W(N),
414
414
  (k || $ || y) && /* @__PURE__ */ n("span", { className: e.separator, "aria-hidden": "true" }),
415
415
  y && /* @__PURE__ */ n(Y, {}),
416
416
  k && !M && /* @__PURE__ */ n(D, {}),
417
417
  $ && /* @__PURE__ */ n(Z, {})
418
418
  ] }),
419
- !M && z === "advanced" && h && /* @__PURE__ */ i("div", { className: e.grid, children: [
420
- h.length > 0 && Ee(h),
419
+ !M && z === "advanced" && m && /* @__PURE__ */ i("div", { className: e.grid, children: [
420
+ m.length > 0 && Ee(m),
421
421
  (k || $ || y) && /* @__PURE__ */ n("span", { className: e.separator, "aria-hidden": "true" }),
422
422
  y && /* @__PURE__ */ n(Y, {}),
423
423
  k && /* @__PURE__ */ n(D, {}),
424
424
  $ && /* @__PURE__ */ n(Z, {})
425
425
  ] }),
426
- M && z === "advanced" && f && c.length === 0 && h && /* @__PURE__ */ n("div", { className: e.mobileMenu, children: h.map((a, l) => /* @__PURE__ */ n(
426
+ M && z === "advanced" && b && c.length === 0 && m && /* @__PURE__ */ n("div", { className: e.mobileMenu, children: m.map((a, l) => /* @__PURE__ */ n(
427
427
  "div",
428
428
  {
429
429
  className: `${e.mobileMenuItem} ${A === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
@@ -438,7 +438,7 @@ function en({
438
438
  },
439
439
  a._key ?? l
440
440
  )) }),
441
- M && z === "advanced" && f && c.length > 0 && /* @__PURE__ */ i(
441
+ M && z === "advanced" && b && c.length > 0 && /* @__PURE__ */ i(
442
442
  "div",
443
443
  {
444
444
  className: e.mobileMenuSlide,
@@ -547,7 +547,7 @@ function en({
547
547
  ] })
548
548
  }
549
549
  ),
550
- m && m.length > 0 && /* @__PURE__ */ n("nav", { className: e.utility, "aria-label": "Utility navigation", children: /* @__PURE__ */ n(se, { children: m.map((a, l) => /* @__PURE__ */ n(
550
+ h && h.length > 0 && /* @__PURE__ */ n("nav", { className: e.utility, "aria-label": "Utility navigation", children: /* @__PURE__ */ n(se, { children: h.map((a, l) => /* @__PURE__ */ n(
551
551
  q,
552
552
  {
553
553
  as: "a",
@@ -573,7 +573,7 @@ function en({
573
573
  "nav",
574
574
  {
575
575
  "aria-label": "Utility navigation",
576
- className: `${e.utilityMobile} ${f ? e.open : ""}`,
576
+ className: `${e.utilityMobile} ${b ? e.open : ""}`,
577
577
  children: /* @__PURE__ */ n(se, { alignment: "center", children: /* @__PURE__ */ n(
578
578
  q,
579
579
  {
@@ -604,10 +604,10 @@ function en({
604
604
  {
605
605
  className: e.menuToggle,
606
606
  onClick: ye,
607
- "aria-label": f ? "Close menu" : "Open menu",
608
- "aria-expanded": f,
607
+ "aria-label": b ? "Close menu" : "Open menu",
608
+ "aria-expanded": b,
609
609
  "aria-controls": "main-menu",
610
- children: f ? /* @__PURE__ */ n(Ae, { size: 24, "aria-hidden": "true" }) : /* @__PURE__ */ n(_e, { size: 24, "aria-hidden": "true" })
610
+ children: b ? /* @__PURE__ */ n(Ae, { size: 24, "aria-hidden": "true" }) : /* @__PURE__ */ n(_e, { size: 24, "aria-hidden": "true" })
611
611
  }
612
612
  )
613
613
  ] })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.1.25",
4
+ "version": "0.1.26",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {