quirk-ui 0.0.467 → 0.0.469

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index33.css');const e=require("react/jsx-runtime"),u=require("react"),j=require("react-dom"),s=require("../../utils/NoScroll/noScroll.cjs"),x=require("../../../x-Dft9NVe_.cjs"),S="_overlay_140ia_1",h="_modal_140ia_16",k="_closeButton_140ia_26",g="_content_140ia_37",t={overlay:S,modal:h,closeButton:k,content:g};function q({content:m,trigger:_,isOpen:i,onOpen:l,onClose:c,className:r}){const[o,f]=u.useState(!1),a=i!==void 0,d=a?i:o,n=()=>{a?o?c==null||c():l==null||l():f(!d)};u.useEffect(()=>{if(typeof document<"u")return o?s.lockScroll():s.unlockScroll(),()=>s.unlockScroll()},[o]);const v=d?e.jsx("div",{className:t.overlay,onClick:n,children:e.jsxs("div",{className:`${r??""} ${t.modal}`,onClick:y=>y.stopPropagation(),children:[e.jsx("button",{"aria-label":"Close",className:`${t.closeButton} modalClose`,onClick:n,children:e.jsx(x.X,{size:21})}),e.jsx("div",{className:`${t.content} modalContent`,children:m})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r??void 0,onClick:n,children:_}),typeof window<"u"&&j.createPortal(v,document.body)]})}exports.Modal=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index33.css');const e=require("react/jsx-runtime"),u=require("react"),j=require("react-dom"),s=require("../../utils/NoScroll/noScroll.cjs"),x=require("../../../x-Dft9NVe_.cjs"),S="_overlay_140ia_1",h="_modal_140ia_16",k="_closeButton_140ia_26",g="_content_140ia_37",t={overlay:S,modal:h,closeButton:k,content:g};function q({content:m,trigger:_,isOpen:i,onOpen:l,onClose:c,className:r}){const[a,f]=u.useState(!1),d=i!==void 0,o=d?i:a,n=()=>{d?a?c==null||c():l==null||l():f(!o)};u.useEffect(()=>{if(typeof document<"u")return o?s.lockScroll():s.unlockScroll(),()=>s.unlockScroll()},[o]);const v=o?e.jsx("div",{className:t.overlay,onClick:n,children:e.jsxs("div",{className:`${r??""} ${t.modal}`,onClick:y=>y.stopPropagation(),children:[e.jsx("button",{"aria-label":"Close",className:`${t.closeButton} modalClose`,onClick:n,children:e.jsx(x.X,{size:21})}),e.jsx("div",{className:`${t.content} modalContent`,children:m})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r??void 0,onClick:n,children:_}),typeof window<"u"&&j.createPortal(v,document.body)]})}exports.Modal=q;
@@ -17,14 +17,14 @@ function E({
17
17
  onClose: n,
18
18
  className: s
19
19
  }) {
20
- const [t, _] = h(!1), a = i !== void 0, r = a ? i : t, c = () => {
21
- a ? t ? n == null || n() : l == null || l() : _(!r);
20
+ const [a, _] = h(!1), r = i !== void 0, t = r ? i : a, c = () => {
21
+ r ? a ? n == null || n() : l == null || l() : _(!t);
22
22
  };
23
23
  k(() => {
24
24
  if (typeof document < "u")
25
25
  return t ? g() : m(), () => m();
26
26
  }, [t]);
27
- const v = r ? /* @__PURE__ */ o("div", { className: e.overlay, onClick: c, children: /* @__PURE__ */ d(
27
+ const v = t ? /* @__PURE__ */ o("div", { className: e.overlay, onClick: c, children: /* @__PURE__ */ d(
28
28
  "div",
29
29
  {
30
30
  className: `${s ?? ""} ${e.modal}`,
@@ -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 Se=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],_e=G.createLucideIcon("search",Se),Le={standard:e.styles.standard,transparent:e.styles.transparent},Me={left:e.styles.left,center:e.styles.center,right:e.styles.right},Ee=({spotlight:a,renderText:b})=>{var t,C,k,p,j,S,m,_,L,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((k=a.callToAction.linkOptions)==null?void 0:k.linkType)==="external"&&((p=a.callToAction.linkOptions)!=null&&p.externalUrl)?u=(j=a.callToAction.linkOptions)==null?void 0:j.externalUrl:((S=a.callToAction.linkOptions)==null?void 0:S.linkType)==="internal"&&((_=(m=a.callToAction.linkOptions)==null?void 0:m.internalUrl)!=null&&_.slug.current)&&(u=`/${(M=(L=a.callToAction.linkOptions)==null?void 0:L.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(O.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 Ae({renderText:a,title:b,logo:w,items:x,groups:u,utilityItems:t,isSticky:C=!1,showSearch:k=!0,showLocaleSelect:p=!0,alignment:j="right",variant:S="standard",navigationType:m="default",searchComponent:_,localeSelectComponent:L,className:M}){const[y,U]=r.useState(!1),[X,f]=r.useState(null),[ce,re]=r.useState(0),[oe,de]=r.useState(!1),[ye,ue]=r.useState(null),[o,N]=r.useState([]),[E,q]=r.useState(0),[he,H]=r.useState(null),[$,be]=r.useState(!1),[A,T]=r.useState("forward"),B=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} ${e.styles.searchWrapper}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(te.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(_e,{size:16})}),content:_})})}),V=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(te.Modal,{className:e.styles.localeModal,trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",role:"menuitem",className:e.styles.locale,children:s.jsx(ge,{size:16})}),content:L})})});r.useEffect(()=>{if(typeof window<"u"){const l=()=>{const n=window.innerWidth<768;be(n)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}},[]);const fe=()=>{N([])},xe=l=>{T("forward"),N([{title:l.title,primary:l.primaryItems??[],secondary:l.secondaryItems??[],description:""}])},J=l=>{T("forward"),N(n=>[...n,{title:l.label,primary:l.sublinks??[],secondary:[],description:l.description}])},me=()=>{T("backward"),N(l=>l.slice(0,-1))},F=r.useRef(null),g=r.useRef(null),W=r.useRef(new Map),ke=()=>{U(l=>{const n=!l;return n||(N([]),T("forward"),f(null)),n})},K=l=>{const n=W.current.get(l);if(n&&g.current){const d=n.getBoundingClientRect(),h=g.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;ue(c)}},je=l=>{f(n=>n===l?null:l)},Q=r.useCallback(l=>{F.current&&!F.current.contains(l.target)&&f(null)},[]),Y=r.useCallback(()=>{Z(),typeof window<"u"&&window.innerWidth>768&&(U(!1),f(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),Z=r.useCallback(()=>{if(g.current){const l=g.current.getBoundingClientRect().width;re(l),de(!0)}},[]);r.useEffect(()=>{const l=typeof window<"u",n=typeof document<"u";return l&&window.addEventListener("resize",Y),n&&document.addEventListener("click",Q),Z(),()=>{l&&window.removeEventListener("resize",Y),n&&document.removeEventListener("click",Q)}},[]),r.useEffect(()=>{if(typeof document<"u")return y?I.lockScroll():I.unlockScroll(),()=>I.unlockScroll()},[y]);const ve=l=>l.map((n,d)=>{var P,ee,se,le,ne;const h=`group-${d}`,z=he===d,c=(P=n.primaryItems)==null?void 0:P[E??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{H(d),f(h),K(h)},onMouseLeave:()=>{H(null),q(0),f(null)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:i=>{W.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:[n.title,s.jsx(Ne.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":`${n.title} submenu`,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}),(ee=n.primaryItems)==null?void 0:ee.map((i,v)=>i.href?s.jsxs("a",{href:i.href,className:`${e.styles.link} ${E===v?e.styles.open:""}`,target:i.isExternal?"_blank":"_self",rel:i.isExternal?"noopener noreferrer":void 0,onClick:()=>{var ae;f(null),(ae=i.onClick)==null||ae.call(i)},onMouseEnter:()=>i.sublinks?q(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} ${E===v?e.styles.open:""}`,onMouseEnter:()=>q(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)&&((se=c==null?void 0:c.sublinks)==null?void 0:se.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}-${E}`)]},`${c.label}-${(le=c==null?void 0:c.sublinks)==null?void 0:le.length}`),(n==null?void 0:n.secondaryItems)&&((ne=n==null?void 0:n.secondaryItems)==null?void 0:ne.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:n.secondaryItems&&n.secondaryItems.length>0&&R(n.secondaryItems,`${h}-secondary`)}),n.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Ee,{spotlight:n.spotlight,renderText:a??(i=>String(i))})})]})})})]},n._key??`group-${d}`)}),R=(l,n="")=>l.map(d=>{const h=`${n}/${d.label}`;return s.jsx(e.NavLink,{link:d,path:h,parentPath:n,openPath:X,togglePath:je,updateTriangleIndicator:K,setOpenPath:f,renderLinks:R,buttonRefs:W},d._key??h)});return s.jsx("header",{ref:F,className:`${M??""} ${Me[j]} ${Le[S]} ${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)&&j!=="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:j==="center"?`calc(50% - ${ce/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${oe?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:`${ye}px`},className:`${e.styles.triangle} ${X?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),k&&!$&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(V,{})]}),!$&&m==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&ve(u),k&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(V,{})]}),$&&m==="advanced"&&y&&o.length===0&&u&&s.jsx("div",{className:`${e.styles.mobileMenu}`,children:u.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>xe(l),children:l.title})},l._key??n))}),$&&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?fe:me,children:s.jsx(O.ChevronLeft,{size:18,"aria-hidden":"true",focusable:"false"})}),o[o.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:a==null?void 0:a(o[o.length-1].description)}),o[o.length-1].primary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>J(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(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},l._key??`primary-${n}`)),o[o.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),o[o.length-1].secondary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>J(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(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},l._key??`secondary-${n}`))]},`stack-${o.length}`)]})}),t&&t.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(ie.ButtonGroup,{children:t.map((l,n)=>s.jsx(O.CallToAction,{as:"a",href:l.href??"/",variant:l.variant??"primary",displayType:l.displayType??"text",imageSrc:l.imageSrc,imageAlt:l.imageAlt,"aria-label":l.ariaLabel??l.label,icon:l.icon,iconAlignment:l.iconAlignment,children:l.imageSrc?s.jsx("img",{src:l.imageSrc,alt:l.imageAlt??l.ariaLabel??l.label}):l.label},l._key||n))})}),t&&t.length>0&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${y?e.styles.open:""}`,children:s.jsx(ie.ButtonGroup,{alignment:"center",children:s.jsx(O.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:[$&&k&&s.jsx(B,{}),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(pe.X,{size:24}):s.jsx(Ce,{size:24})})]})]})})}exports.Navbar=Ae;
16
+ */const Se=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],_e=G.createLucideIcon("search",Se),Le={standard:e.styles.standard,transparent:e.styles.transparent},Me={left:e.styles.left,center:e.styles.center,right:e.styles.right},Ee=({spotlight:a,renderText:b})=>{var t,C,k,p,j,S,m,_,L,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((k=a.callToAction.linkOptions)==null?void 0:k.linkType)==="external"&&((p=a.callToAction.linkOptions)!=null&&p.externalUrl)?u=(j=a.callToAction.linkOptions)==null?void 0:j.externalUrl:((S=a.callToAction.linkOptions)==null?void 0:S.linkType)==="internal"&&((_=(m=a.callToAction.linkOptions)==null?void 0:m.internalUrl)!=null&&_.slug.current)&&(u=`/${(M=(L=a.callToAction.linkOptions)==null?void 0:L.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(O.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 Ae({renderText:a,title:b,logo:w,items:x,groups:u,utilityItems:t,isSticky:C=!1,showSearch:k=!0,showLocaleSelect:p=!0,alignment:j="right",variant:S="standard",navigationType:m="default",searchComponent:_,localeSelectComponent:L,className:M}){const[y,U]=r.useState(!1),[X,f]=r.useState(null),[ce,re]=r.useState(0),[oe,de]=r.useState(!1),[ye,ue]=r.useState(null),[o,N]=r.useState([]),[E,q]=r.useState(0),[he,H]=r.useState(null),[$,be]=r.useState(!1),[A,T]=r.useState("forward"),B=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} ${e.styles.searchWrapper}`,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(te.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",className:e.styles.search,children:s.jsx(_e,{size:16})}),content:_})})}),V=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(te.Modal,{className:e.styles.localeModal,trigger:s.jsx("button",{title:"Locale Select","aria-label":"Locale Select",role:"menuitem",className:e.styles.locale,children:s.jsx(ge,{size:16})}),content:L})})});r.useEffect(()=>{if(typeof window<"u"){const l=()=>{const n=window.innerWidth<768;be(n)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}},[]);const fe=()=>{N([])},xe=l=>{T("forward"),N([{title:l.title,primary:l.primaryItems??[],secondary:l.secondaryItems??[],description:""}])},J=l=>{T("forward"),N(n=>[...n,{title:l.label,primary:l.sublinks??[],secondary:[],description:l.description}])},me=()=>{T("backward"),N(l=>l.slice(0,-1))},F=r.useRef(null),g=r.useRef(null),W=r.useRef(new Map),ke=()=>{U(l=>{const n=!l;return n||(N([]),T("forward"),f(null)),n})},K=l=>{const n=W.current.get(l);if(n&&g.current){const d=n.getBoundingClientRect(),h=g.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;ue(c)}},je=l=>{f(n=>n===l?null:l)},Q=r.useCallback(l=>{F.current&&!F.current.contains(l.target)&&f(null)},[]),Y=r.useCallback(()=>{Z(),typeof window<"u"&&window.innerWidth>768&&(U(!1),f(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),Z=r.useCallback(()=>{if(g.current){const l=g.current.getBoundingClientRect().width;re(l),de(!0)}},[]);r.useEffect(()=>{const l=typeof window<"u",n=typeof document<"u";return l&&window.addEventListener("resize",Y),n&&document.addEventListener("click",Q),Z(),()=>{l&&window.removeEventListener("resize",Y),n&&document.removeEventListener("click",Q)}},[]),r.useEffect(()=>{if(typeof document<"u")return y?setTimeout(()=>{I.lockScroll()},0):I.unlockScroll(),()=>I.unlockScroll()},[y]);const ve=l=>l.map((n,d)=>{var P,ee,se,le,ne;const h=`group-${d}`,z=he===d,c=(P=n.primaryItems)==null?void 0:P[E??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{H(d),f(h),K(h)},onMouseLeave:()=>{H(null),q(0),f(null)},children:[s.jsx("div",{className:e.styles.linkItem,children:s.jsxs("button",{ref:i=>{W.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:[n.title,s.jsx(Ne.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":`${n.title} submenu`,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}),(ee=n.primaryItems)==null?void 0:ee.map((i,v)=>i.href?s.jsxs("a",{href:i.href,className:`${e.styles.link} ${E===v?e.styles.open:""}`,target:i.isExternal?"_blank":"_self",rel:i.isExternal?"noopener noreferrer":void 0,onClick:()=>{var ae;f(null),(ae=i.onClick)==null||ae.call(i)},onMouseEnter:()=>i.sublinks?q(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} ${E===v?e.styles.open:""}`,onMouseEnter:()=>q(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)&&((se=c==null?void 0:c.sublinks)==null?void 0:se.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}-${E}`)]},`${c.label}-${(le=c==null?void 0:c.sublinks)==null?void 0:le.length}`),(n==null?void 0:n.secondaryItems)&&((ne=n==null?void 0:n.secondaryItems)==null?void 0:ne.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:n.secondaryItems&&n.secondaryItems.length>0&&R(n.secondaryItems,`${h}-secondary`)}),n.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Ee,{spotlight:n.spotlight,renderText:a??(i=>String(i))})})]})})})]},n._key??`group-${d}`)}),R=(l,n="")=>l.map(d=>{const h=`${n}/${d.label}`;return s.jsx(e.NavLink,{link:d,path:h,parentPath:n,openPath:X,togglePath:je,updateTriangleIndicator:K,setOpenPath:f,renderLinks:R,buttonRefs:W},d._key??h)});return s.jsx("header",{ref:F,className:`${M??""} ${Me[j]} ${Le[S]} ${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)&&j!=="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:j==="center"?`calc(50% - ${ce/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${oe?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:`${ye}px`},className:`${e.styles.triangle} ${X?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),k&&!$&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(V,{})]}),!$&&m==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&ve(u),k&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(V,{})]}),$&&m==="advanced"&&y&&o.length===0&&u&&s.jsx("div",{className:`${e.styles.mobileMenu}`,children:u.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>xe(l),children:l.title})},l._key??n))}),$&&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?fe:me,children:s.jsx(O.ChevronLeft,{size:18,"aria-hidden":"true",focusable:"false"})}),o[o.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:a==null?void 0:a(o[o.length-1].description)}),o[o.length-1].primary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>J(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(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},l._key??`primary-${n}`)),o[o.length-1].secondary.length>0&&s.jsx("hr",{className:e.styles.groupDivider}),o[o.length-1].secondary.map((l,n)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:l.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>J(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(D.ExternalLink,{className:e.styles.newTabIcon,size:16})]})},l._key??`secondary-${n}`))]},`stack-${o.length}`)]})}),t&&t.length>0&&s.jsx("nav",{className:e.styles.utility,"aria-label":"Utility navigation",children:s.jsx(ie.ButtonGroup,{children:t.map((l,n)=>s.jsx(O.CallToAction,{as:"a",href:l.href??"/",variant:l.variant??"primary",displayType:l.displayType??"text",imageSrc:l.imageSrc,imageAlt:l.imageAlt,"aria-label":l.ariaLabel??l.label,icon:l.icon,iconAlignment:l.iconAlignment,children:l.imageSrc?s.jsx("img",{src:l.imageSrc,alt:l.imageAlt??l.ariaLabel??l.label}):l.label},l._key||n))})}),t&&t.length>0&&s.jsx("nav",{"aria-label":"Utility navigation",className:`${e.styles.utilityMobile} ${y?e.styles.open:""}`,children:s.jsx(ie.ButtonGroup,{alignment:"center",children:s.jsx(O.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:[$&&k&&s.jsx(B,{}),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(pe.X,{size:24}):s.jsx(Ce,{size:24})})]})]})})}exports.Navbar=Ae;
@@ -26,18 +26,18 @@ const ze = [
26
26
  ],
27
27
  ["path", { d: "M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05", key: "14pb5j" }],
28
28
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
29
- ], xe = V("earth", ze);
29
+ ], Te = V("earth", ze);
30
30
  /**
31
31
  * @license lucide-react v0.488.0 - ISC
32
32
  *
33
33
  * This source code is licensed under the ISC license.
34
34
  * See the LICENSE file in the root directory of this source tree.
35
35
  */
36
- const Re = [
36
+ const xe = [
37
37
  ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
38
38
  ["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
39
39
  ["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
40
- ], Te = V("menu", Re);
40
+ ], Re = V("menu", xe);
41
41
  /**
42
42
  * @license lucide-react v0.488.0 - ISC
43
43
  *
@@ -106,9 +106,9 @@ function Ye({
106
106
  localeSelectComponent: _,
107
107
  className: z
108
108
  }) {
109
- const [h, q] = b(!1), [J, k] = b(null), [me, fe] = b(0), [be, ue] = b(!1), [ke, ve] = b(null), [t, y] = b([]), [x, F] = b(
109
+ const [h, q] = b(!1), [J, k] = b(null), [me, fe] = b(0), [be, ue] = b(!1), [ke, ve] = b(null), [t, y] = b([]), [T, F] = b(
110
110
  0
111
- ), [pe, K] = b(null), [C, Ne] = b(!1), [R, T] = b("forward"), B = () => /* @__PURE__ */ a(
111
+ ), [pe, K] = b(null), [C, Ne] = b(!1), [x, R] = b("forward"), B = () => /* @__PURE__ */ a(
112
112
  "div",
113
113
  {
114
114
  className: `${e.linkWrapper} ${e.parent} ${e.searchWrapper}`,
@@ -140,7 +140,7 @@ function Ye({
140
140
  "aria-label": "Locale Select",
141
141
  role: "menuitem",
142
142
  className: e.locale,
143
- children: /* @__PURE__ */ a(xe, { size: 16 })
143
+ children: /* @__PURE__ */ a(Te, { size: 16 })
144
144
  }
145
145
  ),
146
146
  content: _
@@ -158,7 +158,7 @@ function Ye({
158
158
  const $e = () => {
159
159
  y([]);
160
160
  }, ge = (n) => {
161
- T("forward"), y([
161
+ R("forward"), y([
162
162
  {
163
163
  title: n.title,
164
164
  primary: n.primaryItems ?? [],
@@ -167,7 +167,7 @@ function Ye({
167
167
  }
168
168
  ]);
169
169
  }, Y = (n) => {
170
- T("forward"), y((l) => [
170
+ R("forward"), y((l) => [
171
171
  ...l,
172
172
  {
173
173
  title: n.label,
@@ -177,11 +177,11 @@ function Ye({
177
177
  }
178
178
  ]);
179
179
  }, we = () => {
180
- T("backward"), y((n) => n.slice(0, -1));
180
+ R("backward"), y((n) => n.slice(0, -1));
181
181
  }, j = I(null), L = I(null), D = I(/* @__PURE__ */ new Map()), ye = () => {
182
182
  q((n) => {
183
183
  const l = !n;
184
- return l || (y([]), T("forward"), k(null)), l;
184
+ return l || (y([]), R("forward"), k(null)), l;
185
185
  });
186
186
  }, Z = (n) => {
187
187
  const l = D.current.get(n);
@@ -208,11 +208,13 @@ function Ye({
208
208
  };
209
209
  }, []), U(() => {
210
210
  if (typeof document < "u")
211
- return h ? Ae() : he(), () => he();
211
+ return h ? setTimeout(() => {
212
+ Ae();
213
+ }, 0) : he(), () => he();
212
214
  }, [h]);
213
215
  const Le = (n) => n.map((l, d) => {
214
216
  var ae, le, se, ie, ce;
215
- const f = `group-${d}`, W = pe === d, o = (ae = l.primaryItems) == null ? void 0 : ae[x ?? 0];
217
+ const f = `group-${d}`, W = pe === d, o = (ae = l.primaryItems) == null ? void 0 : ae[T ?? 0];
216
218
  return /* @__PURE__ */ c(
217
219
  "div",
218
220
  {
@@ -264,7 +266,7 @@ function Ye({
264
266
  "a",
265
267
  {
266
268
  href: r.href,
267
- className: `${e.link} ${x === g ? e.open : ""}`,
269
+ className: `${e.link} ${T === g ? e.open : ""}`,
268
270
  target: r.isExternal ? "_blank" : "_self",
269
271
  rel: r.isExternal ? "noopener noreferrer" : void 0,
270
272
  onClick: () => {
@@ -291,7 +293,7 @@ function Ye({
291
293
  ) : /* @__PURE__ */ a(
292
294
  "button",
293
295
  {
294
- className: `${e.sublinkToggle} ${x === g ? e.open : ""}`,
296
+ className: `${e.sublinkToggle} ${T === g ? e.open : ""}`,
295
297
  onMouseEnter: () => F(g),
296
298
  children: /* @__PURE__ */ c("span", { className: e.linkContent, children: [
297
299
  r.label,
@@ -315,7 +317,7 @@ function Ye({
315
317
  ] }),
316
318
  (o == null ? void 0 : o.sublinks) && O(
317
319
  o.sublinks,
318
- `${f}-${x}`
320
+ `${f}-${T}`
319
321
  )
320
322
  ]
321
323
  },
@@ -431,7 +433,7 @@ function Ye({
431
433
  C && p === "advanced" && h && t.length === 0 && m && /* @__PURE__ */ a("div", { className: `${e.mobileMenu}`, children: m.map((n, l) => /* @__PURE__ */ a(
432
434
  "div",
433
435
  {
434
- className: `${e.mobileMenuItem} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
436
+ className: `${e.mobileMenuItem} ${x === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
435
437
  children: /* @__PURE__ */ a(
436
438
  "button",
437
439
  {
@@ -466,7 +468,7 @@ function Ye({
466
468
  t[t.length - 1].description && /* @__PURE__ */ a(
467
469
  "div",
468
470
  {
469
- className: `${e.sublinksDescription} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
471
+ className: `${e.sublinksDescription} ${x === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
470
472
  children: s == null ? void 0 : s(
471
473
  t[t.length - 1].description
472
474
  )
@@ -475,7 +477,7 @@ function Ye({
475
477
  t[t.length - 1].primary.map((n, l) => /* @__PURE__ */ a(
476
478
  "div",
477
479
  {
478
- className: `${e.mobileMenuItem} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
480
+ className: `${e.mobileMenuItem} ${x === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
479
481
  children: n.sublinks ? /* @__PURE__ */ a(
480
482
  "button",
481
483
  {
@@ -517,7 +519,7 @@ function Ye({
517
519
  (n, l) => /* @__PURE__ */ a(
518
520
  "div",
519
521
  {
520
- className: `${e.mobileMenuItem} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
522
+ className: `${e.mobileMenuItem} ${x === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
521
523
  children: n.sublinks ? /* @__PURE__ */ a(
522
524
  "button",
523
525
  {
@@ -616,7 +618,7 @@ function Ye({
616
618
  "aria-label": h ? "Close menu" : "Open menu",
617
619
  "aria-expanded": h,
618
620
  "aria-controls": "main-menu",
619
- children: h ? /* @__PURE__ */ a(Se, { size: 24 }) : /* @__PURE__ */ a(Te, { size: 24 })
621
+ children: h ? /* @__PURE__ */ a(Se, { size: 24 }) : /* @__PURE__ */ a(Re, { size: 24 })
620
622
  }
621
623
  )
622
624
  ] })
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let o=0;function c(){const l=document.documentElement;o++,l.classList.add("no-scroll")}function t(){const l=document.documentElement;o=Math.max(o-1,0),o===0&&l.classList.remove("no-scroll")}exports.lockScroll=c;exports.unlockScroll=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let o=0;function t(){if(typeof document>"u")return;const e=document.documentElement;o===0&&e.classList.add("no-scroll"),o++}function n(){if(typeof document>"u")return;const e=document.documentElement;o--,o===0&&e.classList.remove("no-scroll"),o<0&&(o=0)}exports.lockScroll=t;exports.unlockScroll=n;
@@ -1,13 +1,15 @@
1
1
  let o = 0;
2
2
  function t() {
3
- const c = document.documentElement;
4
- o++, c.classList.add("no-scroll");
3
+ if (typeof document > "u") return;
4
+ const n = document.documentElement;
5
+ o === 0 && n.classList.add("no-scroll"), o++;
5
6
  }
6
- function l() {
7
- const c = document.documentElement;
8
- o = Math.max(o - 1, 0), o === 0 && c.classList.remove("no-scroll");
7
+ function e() {
8
+ if (typeof document > "u") return;
9
+ const n = document.documentElement;
10
+ o--, o === 0 && n.classList.remove("no-scroll"), o < 0 && (o = 0);
9
11
  }
10
12
  export {
11
13
  t as lockScroll,
12
- l as unlockScroll
14
+ e as unlockScroll
13
15
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.467",
4
+ "version": "0.0.469",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {