quirk-ui 0.0.435 → 0.0.436
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.
- package/dist/core/components/NavBar/index.cjs +1 -1
- package/dist/core/components/NavBar/index.mjs +38 -35
- package/dist/next/blocks/DocumentListBlock/index.cjs +1 -1
- package/dist/next/blocks/DocumentListBlock/index.mjs +32 -33
- package/dist/next/ui/LocaleLink/index.cjs +3 -3
- package/dist/next/ui/LocaleLink/index.mjs +231 -233
- package/package.json +1 -1
|
@@ -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 Ce=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Le=D.createLucideIcon("search",Ce),_e={standard:e.styles.standard,transparent:e.styles.transparent},Se={left:e.styles.left,center:e.styles.center,right:e.styles.right},Me=({spotlight:a,renderText:b})=>{var t,w,v,p,j,C,f,L,_,S,y;const g=(t=a.image)==null?void 0:t.asset.altText,m=((w=a.callToAction.linkOptions)==null?void 0:w.linkType)==="external";let u="#";return((v=a.callToAction.linkOptions)==null?void 0:v.linkType)==="external"&&((p=a.callToAction.linkOptions)!=null&&p.externalUrl)?u=(j=a.callToAction.linkOptions)==null?void 0:j.externalUrl:((C=a.callToAction.linkOptions)==null?void 0:C.linkType)==="internal"&&((L=(f=a.callToAction.linkOptions)==null?void 0:f.internalUrl)!=null&&L.slug.current)&&(u=`/${(S=(_=a.callToAction.linkOptions)==null?void 0:_.internalUrl)==null?void 0:S.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:g||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(z.CallToAction,{as:"a",variant:a.callToAction.variant??"primary",href:u,target:m?"_blank":"_self",rel:m?"noopener noreferrer":"","aria-label":a.callToAction.ariaLabel||a.callToAction.label,children:a.callToAction.label})})]})};function Ae({renderText:a,title:b,logo:g,items:m,groups:u,utilityItems:t,isSticky:w=!1,showSearch:v=!0,showLocaleSelect:p=!0,alignment:j="right",variant:C="standard",navigationType:f="default",searchComponent:L,localeSelectComponent:_,className:S}){const[y,G]=r.useState(!1),[U,x]=r.useState(null),[ie,ce]=r.useState(0),[re,oe]=r.useState(!1),[de,ye]=r.useState(null),[o,M]=r.useState([]),[A,O]=r.useState(0),[ue,V]=r.useState(null),[N,he]=r.useState(!1),[E,q]=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(ae.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",role:"menuitem",className:e.styles.search,children:s.jsx(Le,{size:16})}),content:L})})}),X=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ae.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($e,{size:16})}),content:_})})});r.useEffect(()=>{if(typeof window<"u"){const n=()=>{const l=window.innerWidth<768;he(l)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}},[]);const be=()=>{M([])},me=n=>{q("forward"),M([{title:n.title,primary:n.primaryItems??[],secondary:n.secondaryItems??[],description:""}])},H=n=>{q("forward"),M(l=>[...l,{title:n.label,primary:n.sublinks??[],secondary:[],description:n.description}])},fe=()=>{q("backward"),M(n=>n.slice(0,-1))},F=r.useRef(null),$=r.useRef(null),W=r.useRef(new Map),xe=()=>{G(n=>!n)},J=n=>{const l=W.current.get(n);if(l&&$.current){const d=l.getBoundingClientRect(),h=$.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;ye(c)}},ve=n=>{x(l=>l===n?null:n)},K=r.useCallback(n=>{F.current&&!F.current.contains(n.target)&&x(null)},[]),Q=r.useCallback(()=>{Y(),typeof window<"u"&&window.innerWidth>768&&(G(!1),x(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),Y=r.useCallback(()=>{if($.current){const n=$.current.getBoundingClientRect().width;ce(n),oe(!0)}},[]);r.useEffect(()=>{const n=typeof window<"u",l=typeof document<"u";return n&&window.addEventListener("resize",Q),l&&document.addEventListener("click",K),Y(),()=>{n&&window.removeEventListener("resize",Q),l&&document.removeEventListener("click",K)}},[]),r.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=y?"hidden":"",()=>{document.body.style.overflow=""}},[y]);const je=n=>n.map((l,d)=>{var Z,P,ee,se,ne;const h=`group-${d}`,T=ue===d,c=(Z=l.primaryItems)==null?void 0:Z[A??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{V(d),x(h),J(h)},onMouseLeave:()=>{V(null),O(0),x(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":T,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${T?e.styles.open:""} `,children:[l.title,s.jsx(pe.ChevronDown,{size:18,className:e.styles.chevron})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${T?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}),(P=l.primaryItems)==null?void 0:P.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 le;x(null),(le=i.onClick)==null||le.call(i)},onMouseEnter:()=>i.sublinks?O(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(I.ExternalLink,{className:e.styles.newTabIcon,size:16})]},i._key??k):s.jsx("button",{className:`${e.styles.sublinkToggle} ${A===k?e.styles.open:""}`,onMouseEnter:()=>O(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)&&((ee=c==null?void 0:c.sublinks)==null?void 0:ee.length)>0&&s.jsxs("div",{className:`${e.styles.sublinksColumn} ${e.styles.fadeInFromLeft}`,children:[(c==null?void 0:c.description)&&s.jsx("div",{className:e.styles.sublinksDescription,children:a==null?void 0:a(c.description)}),(c==null?void 0:c.sublinks)&&R(c.sublinks,`${h}-${A}`)]},`${c.label}-${(se=c==null?void 0:c.sublinks)==null?void 0:se.length}`),(l==null?void 0:l.secondaryItems)&&((ne=l==null?void 0:l.secondaryItems)==null?void 0:ne.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(Me,{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:U,togglePath:ve,updateTriangleIndicator:J,setOpenPath:x,renderLinks:R,buttonRefs:W},d._key??h)});return s.jsx("header",{ref:F,className:`${S??""} ${Se[j]} ${_e[C]} ${e.styles.navbar} ${w?e.styles.sticky:""} ${u&&u.length?e.styles.advanced:e.styles.default}`,role:"navigation","aria-label":"Main navigation",children:s.jsxs("div",{className:`${e.styles.container} ${(!t||t.length===0)&&j!=="center"?e.styles.twoColumn:""}`,children:[g?s.jsx("div",{className:e.styles.logo,children:g}):s.jsx("div",{className:e.styles.title,children:b}),s.jsx("nav",{ref:$,style:{left:j==="center"?`calc(50% - ${ie/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${re?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:`${de}px`},className:`${e.styles.triangle} ${U?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"})}),f==="default"&&m&&s.jsxs("div",{className:e.styles.grid,children:[m&&m.length>0&&R(m),v&&!N&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(X,{})]}),!N&&f==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&je(u),v&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(X,{})]}),N&&f==="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} ${E==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>me(n),children:n.title})},n._key??l))}),N&&f==="advanced"&&y&&o.length>0&&s.jsxs("div",{className:`${e.styles.mobileMenuSlide} `,children:[s.jsx("button",{className:e.styles.back,onClick:o.length===1?be:fe,children:s.jsx(z.ChevronLeft,{size:18,"aria-hidden":"true",focusable:"false"})}),o[o.length-1].description&&s.jsx("div",{className:`${e.styles.sublinksDescription} ${E==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:o[o.length-1].description&&(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} ${E==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>H(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(I.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} ${E==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>H(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(I.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(te.ButtonGroup,{children:t.map((n,l)=>s.jsx(z.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(te.ButtonGroup,{alignment:"center",children:s.jsx(z.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:[N&&v&&s.jsx(B,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:xe,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,"aria-controls":"main-menu",children:y?s.jsx(ke.X,{size:24}):s.jsx(we,{size:24})})]})]})})}exports.Navbar=Ae;
|
|
16
|
+
*/const Ce=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Le=D.createLucideIcon("search",Ce),_e={standard:e.styles.standard,transparent:e.styles.transparent},Se={left:e.styles.left,center:e.styles.center,right:e.styles.right},Me=({spotlight:a,renderText:b})=>{var t,w,j,p,v,C,x,L,_,S,y;const g=(t=a.image)==null?void 0:t.asset.altText,m=((w=a.callToAction.linkOptions)==null?void 0:w.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:((C=a.callToAction.linkOptions)==null?void 0:C.linkType)==="internal"&&((L=(x=a.callToAction.linkOptions)==null?void 0:x.internalUrl)!=null&&L.slug.current)&&(u=`/${(S=(_=a.callToAction.linkOptions)==null?void 0:_.internalUrl)==null?void 0:S.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:g||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(z.CallToAction,{as:"a",variant:a.callToAction.variant??"primary",href:u,target:m?"_blank":"_self",rel:m?"noopener noreferrer":"","aria-label":a.callToAction.ariaLabel||a.callToAction.label,children:a.callToAction.label})})]})};function Ee({renderText:a,title:b,logo:g,items:m,groups:u,utilityItems:t,isSticky:w=!1,showSearch:j=!0,showLocaleSelect:p=!0,alignment:v="right",variant:C="standard",navigationType:x="default",searchComponent:L,localeSelectComponent:_,className:S}){const[y,G]=r.useState(!1),[U,f]=r.useState(null),[ie,ce]=r.useState(0),[re,oe]=r.useState(!1),[de,ye]=r.useState(null),[o,M]=r.useState([]),[E,O]=r.useState(0),[ue,X]=r.useState(null),[N,he]=r.useState(!1),[A,q]=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(ae.Modal,{className:e.styles.searchModal,trigger:s.jsx("button",{title:"Search","aria-label":"Search",role:"menuitem",className:e.styles.search,children:s.jsx(Le,{size:16})}),content:L})})}),H=()=>s.jsx("div",{className:`${e.styles.linkWrapper} ${e.styles.parent} `,children:s.jsx("div",{className:e.styles.linkItem,children:s.jsx(ae.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($e,{size:16})}),content:_})})});r.useEffect(()=>{if(typeof window<"u"){const n=()=>{const l=window.innerWidth<768;he(l)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}},[]);const be=()=>{M([])},me=n=>{q("forward"),M([{title:n.title,primary:n.primaryItems??[],secondary:n.secondaryItems??[],description:""}])},V=n=>{q("forward"),M(l=>[...l,{title:n.label,primary:n.sublinks??[],secondary:[],description:n.description}])},xe=()=>{q("backward"),M(n=>n.slice(0,-1))},F=r.useRef(null),$=r.useRef(null),W=r.useRef(new Map),fe=()=>{G(n=>!n)},J=n=>{const l=W.current.get(n);if(l&&$.current){const d=l.getBoundingClientRect(),h=$.current.getBoundingClientRect(),c=d.left-h.left+d.width/2;ye(c)}},je=n=>{f(l=>l===n?null:n)},K=r.useCallback(n=>{F.current&&!F.current.contains(n.target)&&f(null)},[]),Q=r.useCallback(()=>{Y(),typeof window<"u"&&window.innerWidth>768&&(G(!1),f(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),Y=r.useCallback(()=>{if($.current){const n=$.current.getBoundingClientRect().width;ce(n),oe(!0)}},[]);r.useEffect(()=>{const n=typeof window<"u",l=typeof document<"u";return n&&window.addEventListener("resize",Q),l&&document.addEventListener("click",K),Y(),()=>{n&&window.removeEventListener("resize",Q),l&&document.removeEventListener("click",K)}},[]),r.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=y?"hidden":"",()=>{document.body.style.overflow=""}},[y]);const ve=n=>n.map((l,d)=>{var Z,P,ee,se,ne;const h=`group-${d}`,R=ue===d,c=(Z=l.primaryItems)==null?void 0:Z[E??0];return s.jsxs("div",{className:`${e.styles.linkWrapper} ${e.styles.parent}`,onMouseEnter:()=>{X(d),f(h),J(h)},onMouseLeave:()=>{X(null),O(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":R,"aria-controls":`submenu-${d}`,className:`${e.styles.sublinkToggle} ${R?e.styles.open:""} `,children:[l.title,s.jsx(pe.ChevronDown,{size:18,className:e.styles.chevron})]})}),s.jsx("div",{id:`submenu-${d}`,className:`${e.styles.sublinks} ${R?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}),(P=l.primaryItems)==null?void 0:P.map((i,k)=>i.href?s.jsxs("a",{href:i.href,className:`${e.styles.link} ${E===k?e.styles.open:""}`,target:i.isExternal?"_blank":"_self",rel:i.isExternal?"noopener noreferrer":void 0,onClick:()=>{var le;f(null),(le=i.onClick)==null||le.call(i)},onMouseEnter:()=>i.sublinks?O(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(I.ExternalLink,{className:e.styles.newTabIcon,size:16})]},i._key??k):s.jsx("button",{className:`${e.styles.sublinkToggle} ${E===k?e.styles.open:""}`,onMouseEnter:()=>O(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)&&((ee=c==null?void 0:c.sublinks)==null?void 0:ee.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)&&T(c.sublinks,`${h}-${E}`)]},`${c.label}-${(se=c==null?void 0:c.sublinks)==null?void 0:se.length}`),(l==null?void 0:l.secondaryItems)&&((ne=l==null?void 0:l.secondaryItems)==null?void 0:ne.length)>0&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.secondaryColumn}`,children:l.secondaryItems&&l.secondaryItems.length>0&&T(l.secondaryItems,`${h}-secondary`)}),l.spotlight&&s.jsx("div",{className:`${e.styles.sublinksColumn} ${e.styles.spotlightColumn}`,children:s.jsx(Me,{spotlight:l.spotlight,renderText:a??(i=>String(i))})})]})})})]},l._key??`group-${d}`)}),T=(n,l="")=>n.map(d=>{const h=`${l}/${d.label}`;return s.jsx(e.NavLink,{link:d,path:h,parentPath:l,openPath:U,togglePath:je,updateTriangleIndicator:J,setOpenPath:f,renderLinks:T,buttonRefs:W},d._key??h)});return s.jsx("header",{ref:F,className:`${S??""} ${Se[v]} ${_e[C]} ${e.styles.navbar} ${w?e.styles.sticky:""} ${u&&u.length?e.styles.advanced:e.styles.default}`,role:"navigation","aria-label":"Main navigation",children:s.jsxs("div",{className:`${e.styles.container} ${(!t||t.length===0)&&v!=="center"?e.styles.twoColumn:""}`,children:[g?s.jsx("div",{className:e.styles.logo,children:g}):s.jsx("div",{className:e.styles.title,children:b}),s.jsx("nav",{ref:$,style:{left:v==="center"?`calc(50% - ${ie/2}px)`:"0"},className:`${e.styles.nav} ${y?e.styles.open:""} ${re?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:`${de}px`},className:`${e.styles.triangle} ${U?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"})}),x==="default"&&m&&s.jsxs("div",{className:e.styles.grid,children:[m&&m.length>0&&T(m),j&&!N&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(H,{})]}),!N&&x==="advanced"&&u&&s.jsxs("div",{className:e.styles.grid,children:[u.length>0&&ve(u),j&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:e.styles.separator}),s.jsx(B,{})]}),p&&s.jsx(H,{})]}),N&&x==="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} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>me(n),children:n.title})},n._key??l))}),N&&x==="advanced"&&y&&o.length>0&&s.jsxs("div",{className:`${e.styles.mobileMenuSlide} `,children:[s.jsx("button",{className:e.styles.back,onClick:o.length===1?be:xe,children:s.jsx(z.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((n,l)=>s.jsx("div",{className:`${e.styles.mobileMenuItem} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>V(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(I.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} ${A==="forward"?e.styles.fadeInFromLeft:e.styles.fadeInFromRight}`,children:n.sublinks?s.jsx("button",{className:e.styles.sublinkToggle,onClick:()=>V(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(I.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(te.ButtonGroup,{children:t.map((n,l)=>s.jsx(z.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(te.ButtonGroup,{alignment:"center",children:s.jsx(z.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:[N&&j&&s.jsx(B,{}),s.jsx("button",{className:e.styles.menuToggle,onClick:fe,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,"aria-controls":"main-menu",children:y?s.jsx(ke.X,{size:24}):s.jsx(we,{size:24})})]})]})})}exports.Navbar=Ee;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as a, jsxs as c, Fragment as oe } from "react/jsx-runtime";
|
|
2
2
|
import { useState as f, useEffect as U, useRef as I, useCallback as G } from "react";
|
|
3
3
|
import { Modal as te } from "../Modal/index.mjs";
|
|
4
|
-
import { a as Le, C as
|
|
4
|
+
import { a as Le, C as H } from "../../../index-FuTQRxMN.js";
|
|
5
5
|
import { ButtonGroup as de } from "../ButtonGroup/index.mjs";
|
|
6
6
|
import { s as e, N as Me } from "../../../NavLink-Dk1p55ah.js";
|
|
7
|
-
import { E as
|
|
8
|
-
import { X as
|
|
9
|
-
import { c as
|
|
10
|
-
import { C as
|
|
7
|
+
import { E as X } from "../../../external-link-BOPobeQJ.js";
|
|
8
|
+
import { X as Ee } from "../../../x-CnsEH4Ox.js";
|
|
9
|
+
import { c as V } from "../../../createLucideIcon-C8GTh_Qx.js";
|
|
10
|
+
import { C as Ae } from "../../../chevron-down-DSUzBz9F.js";
|
|
11
11
|
/**
|
|
12
12
|
* @license lucide-react v0.488.0 - ISC
|
|
13
13
|
*
|
|
@@ -25,7 +25,7 @@ const _e = [
|
|
|
25
25
|
],
|
|
26
26
|
["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" }],
|
|
27
27
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
28
|
-
], Se =
|
|
28
|
+
], Se = V("earth", _e);
|
|
29
29
|
/**
|
|
30
30
|
* @license lucide-react v0.488.0 - ISC
|
|
31
31
|
*
|
|
@@ -36,7 +36,7 @@ const ze = [
|
|
|
36
36
|
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
37
37
|
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
38
38
|
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
39
|
-
], xe =
|
|
39
|
+
], xe = V("menu", ze);
|
|
40
40
|
/**
|
|
41
41
|
* @license lucide-react v0.488.0 - ISC
|
|
42
42
|
*
|
|
@@ -46,7 +46,7 @@ const ze = [
|
|
|
46
46
|
const Re = [
|
|
47
47
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
48
48
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
49
|
-
],
|
|
49
|
+
], Te = V("search", Re), Oe = {
|
|
50
50
|
standard: e.standard,
|
|
51
51
|
transparent: e.transparent
|
|
52
52
|
}, We = {
|
|
@@ -57,10 +57,10 @@ const Re = [
|
|
|
57
57
|
spotlight: s,
|
|
58
58
|
renderText: u
|
|
59
59
|
}) => {
|
|
60
|
-
var i, M, N, y, $,
|
|
60
|
+
var i, M, N, y, $, E, k, A, _, S, h;
|
|
61
61
|
const L = (i = s.image) == null ? void 0 : i.asset.altText, v = ((M = s.callToAction.linkOptions) == null ? void 0 : M.linkType) === "external";
|
|
62
62
|
let m = "#";
|
|
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 : ((
|
|
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 : ((E = s.callToAction.linkOptions) == null ? void 0 : E.linkType) === "internal" && ((A = (k = s.callToAction.linkOptions) == null ? void 0 : k.internalUrl) != null && A.slug.current) && (m = `/${(S = (_ = s.callToAction.linkOptions) == null ? void 0 : _.internalUrl) == null ? void 0 : S.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
|
{
|
|
@@ -75,7 +75,7 @@ const Re = [
|
|
|
75
75
|
s.description && /* @__PURE__ */ a("div", { className: e.description, children: u == null ? void 0 : u(s.description, e.description) })
|
|
76
76
|
] }),
|
|
77
77
|
((h = s.callToAction) == null ? void 0 : h.linkOptions) && /* @__PURE__ */ a("div", { className: e.actions, children: /* @__PURE__ */ a(
|
|
78
|
-
|
|
78
|
+
H,
|
|
79
79
|
{
|
|
80
80
|
as: "a",
|
|
81
81
|
variant: s.callToAction.variant ?? "primary",
|
|
@@ -99,9 +99,9 @@ function Je({
|
|
|
99
99
|
showSearch: N = !0,
|
|
100
100
|
showLocaleSelect: y = !0,
|
|
101
101
|
alignment: $ = "right",
|
|
102
|
-
variant:
|
|
102
|
+
variant: E = "standard",
|
|
103
103
|
navigationType: k = "default",
|
|
104
|
-
searchComponent:
|
|
104
|
+
searchComponent: A,
|
|
105
105
|
localeSelectComponent: _,
|
|
106
106
|
className: S
|
|
107
107
|
}) {
|
|
@@ -122,10 +122,10 @@ function Je({
|
|
|
122
122
|
"aria-label": "Search",
|
|
123
123
|
role: "menuitem",
|
|
124
124
|
className: e.search,
|
|
125
|
-
children: /* @__PURE__ */ a(
|
|
125
|
+
children: /* @__PURE__ */ a(Te, { size: 16 })
|
|
126
126
|
}
|
|
127
127
|
),
|
|
128
|
-
content:
|
|
128
|
+
content: A
|
|
129
129
|
}
|
|
130
130
|
) })
|
|
131
131
|
}
|
|
@@ -211,7 +211,7 @@ function Je({
|
|
|
211
211
|
}, [h]);
|
|
212
212
|
const Ce = (n) => n.map((l, d) => {
|
|
213
213
|
var ae, le, se, ie, ce;
|
|
214
|
-
const b = `group-${d}`,
|
|
214
|
+
const b = `group-${d}`, O = ke === d, o = (ae = l.primaryItems) == null ? void 0 : ae[x ?? 0];
|
|
215
215
|
return /* @__PURE__ */ c(
|
|
216
216
|
"div",
|
|
217
217
|
{
|
|
@@ -231,12 +231,12 @@ function Je({
|
|
|
231
231
|
},
|
|
232
232
|
role: "menuitem",
|
|
233
233
|
"aria-haspopup": "true",
|
|
234
|
-
"aria-expanded":
|
|
234
|
+
"aria-expanded": O,
|
|
235
235
|
"aria-controls": `submenu-${d}`,
|
|
236
|
-
className: `${e.sublinkToggle} ${
|
|
236
|
+
className: `${e.sublinkToggle} ${O ? e.open : ""} `,
|
|
237
237
|
children: [
|
|
238
238
|
l.title,
|
|
239
|
-
/* @__PURE__ */ a(
|
|
239
|
+
/* @__PURE__ */ a(Ae, { size: 18, className: e.chevron })
|
|
240
240
|
]
|
|
241
241
|
}
|
|
242
242
|
) }),
|
|
@@ -244,7 +244,7 @@ function Je({
|
|
|
244
244
|
"div",
|
|
245
245
|
{
|
|
246
246
|
id: `submenu-${d}`,
|
|
247
|
-
className: `${e.sublinks} ${
|
|
247
|
+
className: `${e.sublinks} ${O ? e.show : ""}`,
|
|
248
248
|
role: "menu",
|
|
249
249
|
"aria-label": `${l.title} submenu`,
|
|
250
250
|
children: /* @__PURE__ */ a("div", { children: /* @__PURE__ */ c(
|
|
@@ -278,7 +278,7 @@ function Je({
|
|
|
278
278
|
r.subtitle && /* @__PURE__ */ a("span", { className: e.subtitle, children: r.subtitle })
|
|
279
279
|
] }),
|
|
280
280
|
r.isExternal && /* @__PURE__ */ a(
|
|
281
|
-
|
|
281
|
+
X,
|
|
282
282
|
{
|
|
283
283
|
className: e.newTabIcon,
|
|
284
284
|
size: 16
|
|
@@ -308,8 +308,11 @@ function Je({
|
|
|
308
308
|
{
|
|
309
309
|
className: `${e.sublinksColumn} ${e.fadeInFromLeft}`,
|
|
310
310
|
children: [
|
|
311
|
-
(o == null ? void 0 : o.description) && /* @__PURE__ */
|
|
312
|
-
|
|
311
|
+
(o == null ? void 0 : o.description) && /* @__PURE__ */ c("div", { className: e.sublinksDescription, children: [
|
|
312
|
+
/* @__PURE__ */ a("p", { children: "TEXT HERE" }),
|
|
313
|
+
s == null ? void 0 : s(o.description)
|
|
314
|
+
] }),
|
|
315
|
+
(o == null ? void 0 : o.sublinks) && T(
|
|
313
316
|
o.sublinks,
|
|
314
317
|
`${b}-${x}`
|
|
315
318
|
)
|
|
@@ -321,7 +324,7 @@ function Je({
|
|
|
321
324
|
"div",
|
|
322
325
|
{
|
|
323
326
|
className: `${e.sublinksColumn} ${e.secondaryColumn}`,
|
|
324
|
-
children: l.secondaryItems && l.secondaryItems.length > 0 &&
|
|
327
|
+
children: l.secondaryItems && l.secondaryItems.length > 0 && T(l.secondaryItems, `${b}-secondary`)
|
|
325
328
|
}
|
|
326
329
|
),
|
|
327
330
|
l.spotlight && /* @__PURE__ */ a(
|
|
@@ -346,7 +349,7 @@ function Je({
|
|
|
346
349
|
},
|
|
347
350
|
l._key ?? `group-${d}`
|
|
348
351
|
);
|
|
349
|
-
}),
|
|
352
|
+
}), T = (n, l = "") => n.map((d) => {
|
|
350
353
|
const b = `${l}/${d.label}`;
|
|
351
354
|
return /* @__PURE__ */ a(
|
|
352
355
|
Me,
|
|
@@ -358,7 +361,7 @@ function Je({
|
|
|
358
361
|
togglePath: we,
|
|
359
362
|
updateTriangleIndicator: Z,
|
|
360
363
|
setOpenPath: p,
|
|
361
|
-
renderLinks:
|
|
364
|
+
renderLinks: T,
|
|
362
365
|
buttonRefs: D
|
|
363
366
|
},
|
|
364
367
|
d._key ?? b
|
|
@@ -368,7 +371,7 @@ function Je({
|
|
|
368
371
|
"header",
|
|
369
372
|
{
|
|
370
373
|
ref: j,
|
|
371
|
-
className: `${S ?? ""} ${We[$]} ${
|
|
374
|
+
className: `${S ?? ""} ${We[$]} ${Oe[E]} ${e.navbar} ${M ? e.sticky : ""} ${m && m.length ? e.advanced : e.default}`,
|
|
372
375
|
role: "navigation",
|
|
373
376
|
"aria-label": "Main navigation",
|
|
374
377
|
children: /* @__PURE__ */ c(
|
|
@@ -410,7 +413,7 @@ function Je({
|
|
|
410
413
|
}
|
|
411
414
|
),
|
|
412
415
|
k === "default" && v && /* @__PURE__ */ c("div", { className: e.grid, children: [
|
|
413
|
-
v && v.length > 0 &&
|
|
416
|
+
v && v.length > 0 && T(v),
|
|
414
417
|
N && !w && /* @__PURE__ */ c(oe, { children: [
|
|
415
418
|
/* @__PURE__ */ a("span", { className: e.separator }),
|
|
416
419
|
/* @__PURE__ */ a(B, {})
|
|
@@ -464,9 +467,9 @@ function Je({
|
|
|
464
467
|
"div",
|
|
465
468
|
{
|
|
466
469
|
className: `${e.sublinksDescription} ${R === "forward" ? e.fadeInFromLeft : e.fadeInFromRight}`,
|
|
467
|
-
children:
|
|
470
|
+
children: s == null ? void 0 : s(
|
|
468
471
|
t[t.length - 1].description
|
|
469
|
-
)
|
|
472
|
+
)
|
|
470
473
|
}
|
|
471
474
|
),
|
|
472
475
|
t[t.length - 1].primary.map((n, l) => /* @__PURE__ */ a(
|
|
@@ -497,7 +500,7 @@ function Je({
|
|
|
497
500
|
n.subtitle && /* @__PURE__ */ a("span", { className: e.subtitle, children: n.subtitle })
|
|
498
501
|
] }),
|
|
499
502
|
n.isExternal && /* @__PURE__ */ a(
|
|
500
|
-
|
|
503
|
+
X,
|
|
501
504
|
{
|
|
502
505
|
className: e.newTabIcon,
|
|
503
506
|
size: 16
|
|
@@ -533,7 +536,7 @@ function Je({
|
|
|
533
536
|
children: [
|
|
534
537
|
n.label,
|
|
535
538
|
n.isExternal && /* @__PURE__ */ a(
|
|
536
|
-
|
|
539
|
+
X,
|
|
537
540
|
{
|
|
538
541
|
className: e.newTabIcon,
|
|
539
542
|
size: 16
|
|
@@ -554,7 +557,7 @@ function Je({
|
|
|
554
557
|
}
|
|
555
558
|
),
|
|
556
559
|
i && i.length > 0 && /* @__PURE__ */ a("nav", { className: e.utility, "aria-label": "Utility navigation", children: /* @__PURE__ */ a(de, { children: i.map((n, l) => /* @__PURE__ */ a(
|
|
557
|
-
|
|
560
|
+
H,
|
|
558
561
|
{
|
|
559
562
|
as: "a",
|
|
560
563
|
href: n.href ?? "/",
|
|
@@ -581,7 +584,7 @@ function Je({
|
|
|
581
584
|
"aria-label": "Utility navigation",
|
|
582
585
|
className: `${e.utilityMobile} ${h ? e.open : ""}`,
|
|
583
586
|
children: /* @__PURE__ */ a(de, { alignment: "center", children: /* @__PURE__ */ a(
|
|
584
|
-
|
|
587
|
+
H,
|
|
585
588
|
{
|
|
586
589
|
as: "a",
|
|
587
590
|
href: i[1].href ?? "/",
|
|
@@ -613,7 +616,7 @@ function Je({
|
|
|
613
616
|
"aria-label": h ? "Close menu" : "Open menu",
|
|
614
617
|
"aria-expanded": h,
|
|
615
618
|
"aria-controls": "main-menu",
|
|
616
|
-
children: h ? /* @__PURE__ */ a(
|
|
619
|
+
children: h ? /* @__PURE__ */ a(Ee, { size: 24 }) : /* @__PURE__ */ a(xe, { size: 24 })
|
|
617
620
|
}
|
|
618
621
|
)
|
|
619
622
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/colors.css');require('../../../assets/index.css');const e=require("react/jsx-runtime"),l=require("react"),R=require("../../ui/PortableTextRenderer/index.cjs"),G=require("../../hooks/useStyleClasses.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/colors.css');require('../../../assets/index.css');const e=require("react/jsx-runtime"),l=require("react"),R=require("../../ui/PortableTextRenderer/index.cjs"),G=require("../../hooks/useStyleClasses.cjs");;/* empty css */const b=require("../../../index-CF-7InbH.cjs"),U=require("../../../core/components/Input/index.cjs");require("react-dom");const X=require("../../../core/components/Select/index.cjs");require("../../../core/components/Tabs/index.cjs");;/* empty css */const J=require("../../cards/BlogArticleCard/index.cjs"),t=require("../../../CategoryFilters-CNNdqidd.cjs"),K=require("../../../x-Dft9NVe_.cjs"),Q=[{label:"Newest",value:"date-desc"},{label:"Oldest",value:"date-asc"},{label:"Title A-Z",value:"title-asc"},{label:"Title Z-A",value:"title-desc"},{label:"Most Popular",value:"popular-desc"}];function V({heading:o,layout:$="grid",includeFilters:y,excludeFilters:p,limit:C=3,categoryFilters:d,documentType:_,styleOptions:B}){const[w,c]=l.useState([]),[M,P]=l.useState(null),[N,z]=l.useState("date-desc"),[f,q]=l.useState([]),[T,i]=l.useState(0),[r,k]=l.useState(!1),[m,h]=l.useState(!1),[A,a]=l.useState(!0),[u,S]=l.useState(""),[v,D]=l.useState(""),I="en-us",H=G.useStyleClasses(B),O={list:t.styles.list}[$??"grid"],W=s=>{z(s.target.value),c([]),i(0),a(!0)},L=()=>{h(!m)},Z=()=>{c([]),i(0),a(!0),q([]),S(""),h(!1)},g=async()=>{if(r||!A)return;k(!0);const s=new URLSearchParams({start:String(T),limit:String(C),sort:N,documentType:_,locale:I});v&&s.append("search",v),f.forEach(n=>s.append("categories",n)),y==null||y.forEach(n=>s.append("include",n._id)),p==null||p.forEach(n=>s.append("exclude",n._id));try{const x=await(await fetch(`/api/articles?${s.toString()}`,{method:"GET"})).json();c(j=>[...j,...x.articles]),i(j=>j+C),P(x.totalCount),T+x.articles.length>=x.totalCount&&a(!1)}catch(n){console.error("Failed to load articles:",n),a(!1)}finally{k(!1)}},E=l.useCallback(()=>{typeof window<"u"&&window.innerWidth>768&&(h(!1),typeof document<"u"&&(document.body.style.overflow=""))},[]);return l.useEffect(()=>{const s=typeof window<"u";return s&&window.addEventListener("resize",E),()=>{s&&window.removeEventListener("resize",E)}},[]),l.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=m?"hidden":"",()=>{document.body.style.overflow=""}},[m]),l.useEffect(()=>{const s=setTimeout(()=>{D(u)},1e3);return()=>clearTimeout(s)},[u]),l.useEffect(()=>{g()},[v,N,f.join(",")]),e.jsx("section",{className:`${t.styles.documentList} ${H}`,children:e.jsxs("article",{className:t.styles.container,children:[e.jsxs("div",{className:t.styles.heading,children:[(o==null?void 0:o.title)&&e.jsx(R.RichText,{blocks:o==null?void 0:o.title}),(o==null?void 0:o.description)&&e.jsx(R.RichText,{blocks:o==null?void 0:o.description})]}),e.jsxs("div",{className:t.styles.listContainer,children:[(d==null?void 0:d.length)&&e.jsxs("div",{className:t.styles.filterToggle,children:[e.jsx(b.CallToAction,{as:"button",variant:"secondary",onClick:L,disabled:r,icon:"settings",iconAlignment:"left",children:"Filters"}),e.jsx(b.CallToAction,{as:"button",variant:"link",onClick:Z,disabled:r||f.length===0&&u.length===0,children:"Reset"})]}),d&&e.jsx(t.CategoryFilters,{categoryFilters:d,selectedCategories:f,setSelectedCategories:q,setArticles:c,setStart:i,setHasMore:a,showFilters:m,toggleFilters:L,isLoading:r}),e.jsxs("div",{className:t.styles.listWrapper,children:[e.jsxs("div",{className:t.styles.listHeader,children:[e.jsxs("div",{className:t.styles.listResults,children:["Results: ",e.jsx("span",{children:M})]}),e.jsxs("div",{className:t.styles.listHeaderFilters,children:[e.jsxs("div",{className:t.styles.listSearch,children:[e.jsx(U.Input,{type:"text",name:"list-search",placeholder:"Search articles",value:u,onChange:s=>{S(s.target.value),c([]),i(0),a(!0)}}),u&&e.jsx("button",{className:t.styles.clearSearch,onClick:()=>{S(""),c([]),i(0),a(!0)},children:e.jsx(K.X,{size:21})})]}),e.jsx("div",{className:t.styles.listSort,children:e.jsx(X.Select,{id:"list-sort",name:"list-sort",options:Q,onChange:W})})]})]}),e.jsx("div",{className:`${t.styles.list} ${O}`,children:w&&w.map(s=>_=="blog"&&e.jsx(J.BlogArticleCard,{article:s},s._id))}),A&&e.jsx("div",{className:t.styles.loadMore,children:e.jsx(b.CallToAction,{as:"button",variant:"primary",onClick:g,disabled:r,icon:"refresh",iconAlignment:"left",className:r?t.styles.buttonIsLoading:"",children:r?"Loading...":"Load more"})})]})]})]})})}exports.DocumentListBlock=V;
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as l, useCallback as X, useEffect as b } from "react";
|
|
3
|
-
import { RichText as
|
|
3
|
+
import { RichText as I } from "../../ui/PortableTextRenderer/index.mjs";
|
|
4
4
|
import { useStyleClasses as J } from "../../hooks/useStyleClasses.mjs";
|
|
5
|
-
import { useLocaleBridge as K } from "../../contexts/LocaleBridge.mjs";
|
|
6
5
|
import '../../../assets/colors.css';import '../../../assets/index.css';/* empty css */
|
|
7
6
|
import { C as L } from "../../../index-FuTQRxMN.js";
|
|
8
|
-
import { Input as
|
|
7
|
+
import { Input as K } from "../../../core/components/Input/index.mjs";
|
|
9
8
|
import "react-dom";
|
|
10
|
-
import { Select as
|
|
9
|
+
import { Select as Q } from "../../../core/components/Select/index.mjs";
|
|
11
10
|
import "../../../core/components/Tabs/index.mjs";
|
|
12
11
|
/* empty css */
|
|
13
|
-
import { BlogArticleCard as
|
|
14
|
-
import { s, C as
|
|
15
|
-
import { X as
|
|
16
|
-
const
|
|
12
|
+
import { BlogArticleCard as V } from "../../cards/BlogArticleCard/index.mjs";
|
|
13
|
+
import { s, C as Y } from "../../../CategoryFilters-DYRUC4Cx.js";
|
|
14
|
+
import { X as F } from "../../../x-CnsEH4Ox.js";
|
|
15
|
+
const ee = [
|
|
17
16
|
{ label: "Newest", value: "date-desc" },
|
|
18
17
|
{ label: "Oldest", value: "date-asc" },
|
|
19
18
|
{ label: "Title A-Z", value: "title-asc" },
|
|
20
19
|
{ label: "Title Z-A", value: "title-desc" },
|
|
21
20
|
{ label: "Most Popular", value: "popular-desc" }
|
|
22
21
|
];
|
|
23
|
-
function
|
|
22
|
+
function he({
|
|
24
23
|
heading: o,
|
|
25
|
-
layout:
|
|
24
|
+
layout: P = "grid",
|
|
26
25
|
includeFilters: C,
|
|
27
26
|
excludeFilters: w,
|
|
28
27
|
limit: k = 3,
|
|
29
28
|
categoryFilters: m,
|
|
30
|
-
documentType:
|
|
29
|
+
documentType: A,
|
|
31
30
|
// filterMode,
|
|
32
|
-
styleOptions:
|
|
31
|
+
styleOptions: W
|
|
33
32
|
}) {
|
|
34
|
-
const [
|
|
33
|
+
const [T, c] = l([]), [_, x] = l(null), [g, B] = l("date-desc"), [u, E] = l([]), [R, d] = l(0), [i, $] = l(!1), [p, h] = l(!1), [j, n] = l(!0), [f, S] = l(""), [N, D] = l(""), O = "en-us", Z = J(W), q = {
|
|
35
34
|
//grid: styles.grid,
|
|
36
35
|
list: s.list
|
|
37
|
-
}[
|
|
38
|
-
|
|
36
|
+
}[P ?? "grid"], G = (e) => {
|
|
37
|
+
B(e.target.value), c([]), d(0), n(!0);
|
|
39
38
|
}, z = () => {
|
|
40
39
|
h(!p);
|
|
41
40
|
}, U = () => {
|
|
@@ -46,8 +45,8 @@ function be({
|
|
|
46
45
|
const e = new URLSearchParams({
|
|
47
46
|
start: String(R),
|
|
48
47
|
limit: String(k),
|
|
49
|
-
sort:
|
|
50
|
-
documentType:
|
|
48
|
+
sort: g,
|
|
49
|
+
documentType: A,
|
|
51
50
|
locale: O
|
|
52
51
|
});
|
|
53
52
|
N && e.append("search", N), u.forEach(
|
|
@@ -61,19 +60,19 @@ function be({
|
|
|
61
60
|
const v = await (await fetch(`/api/articles?${e.toString()}`, {
|
|
62
61
|
method: "GET"
|
|
63
62
|
})).json();
|
|
64
|
-
c((y) => [...y, ...v.articles]), d((y) => y + k),
|
|
63
|
+
c((y) => [...y, ...v.articles]), d((y) => y + k), x(v.totalCount), R + v.articles.length >= v.totalCount && n(!1);
|
|
65
64
|
} catch (r) {
|
|
66
65
|
console.error("Failed to load articles:", r), n(!1);
|
|
67
66
|
} finally {
|
|
68
67
|
$(!1);
|
|
69
68
|
}
|
|
70
|
-
},
|
|
69
|
+
}, H = X(() => {
|
|
71
70
|
typeof window < "u" && window.innerWidth > 768 && (h(!1), typeof document < "u" && (document.body.style.overflow = ""));
|
|
72
71
|
}, []);
|
|
73
72
|
return b(() => {
|
|
74
73
|
const e = typeof window < "u";
|
|
75
|
-
return e && window.addEventListener("resize",
|
|
76
|
-
e && window.removeEventListener("resize",
|
|
74
|
+
return e && window.addEventListener("resize", H), () => {
|
|
75
|
+
e && window.removeEventListener("resize", H);
|
|
77
76
|
};
|
|
78
77
|
}, []), b(() => {
|
|
79
78
|
if (typeof document < "u")
|
|
@@ -87,10 +86,10 @@ function be({
|
|
|
87
86
|
return () => clearTimeout(e);
|
|
88
87
|
}, [f]), b(() => {
|
|
89
88
|
M();
|
|
90
|
-
}, [N,
|
|
89
|
+
}, [N, g, u.join(",")]), /* @__PURE__ */ t("section", { className: `${s.documentList} ${Z}`, children: /* @__PURE__ */ a("article", { className: s.container, children: [
|
|
91
90
|
/* @__PURE__ */ a("div", { className: s.heading, children: [
|
|
92
|
-
(o == null ? void 0 : o.title) && /* @__PURE__ */ t(
|
|
93
|
-
(o == null ? void 0 : o.description) && /* @__PURE__ */ t(
|
|
91
|
+
(o == null ? void 0 : o.title) && /* @__PURE__ */ t(I, { blocks: o == null ? void 0 : o.title }),
|
|
92
|
+
(o == null ? void 0 : o.description) && /* @__PURE__ */ t(I, { blocks: o == null ? void 0 : o.description })
|
|
94
93
|
] }),
|
|
95
94
|
/* @__PURE__ */ a("div", { className: s.listContainer, children: [
|
|
96
95
|
(m == null ? void 0 : m.length) && /* @__PURE__ */ a("div", { className: s.filterToggle, children: [
|
|
@@ -118,7 +117,7 @@ function be({
|
|
|
118
117
|
)
|
|
119
118
|
] }),
|
|
120
119
|
m && /* @__PURE__ */ t(
|
|
121
|
-
|
|
120
|
+
Y,
|
|
122
121
|
{
|
|
123
122
|
categoryFilters: m,
|
|
124
123
|
selectedCategories: u,
|
|
@@ -135,12 +134,12 @@ function be({
|
|
|
135
134
|
/* @__PURE__ */ a("div", { className: s.listHeader, children: [
|
|
136
135
|
/* @__PURE__ */ a("div", { className: s.listResults, children: [
|
|
137
136
|
"Results: ",
|
|
138
|
-
/* @__PURE__ */ t("span", { children:
|
|
137
|
+
/* @__PURE__ */ t("span", { children: _ })
|
|
139
138
|
] }),
|
|
140
139
|
/* @__PURE__ */ a("div", { className: s.listHeaderFilters, children: [
|
|
141
140
|
/* @__PURE__ */ a("div", { className: s.listSearch, children: [
|
|
142
141
|
/* @__PURE__ */ t(
|
|
143
|
-
|
|
142
|
+
K,
|
|
144
143
|
{
|
|
145
144
|
type: "text",
|
|
146
145
|
name: "list-search",
|
|
@@ -158,23 +157,23 @@ function be({
|
|
|
158
157
|
onClick: () => {
|
|
159
158
|
S(""), c([]), d(0), n(!0);
|
|
160
159
|
},
|
|
161
|
-
children: /* @__PURE__ */ t(
|
|
160
|
+
children: /* @__PURE__ */ t(F, { size: 21 })
|
|
162
161
|
}
|
|
163
162
|
)
|
|
164
163
|
] }),
|
|
165
164
|
/* @__PURE__ */ t("div", { className: s.listSort, children: /* @__PURE__ */ t(
|
|
166
|
-
|
|
165
|
+
Q,
|
|
167
166
|
{
|
|
168
167
|
id: "list-sort",
|
|
169
168
|
name: "list-sort",
|
|
170
|
-
options:
|
|
169
|
+
options: ee,
|
|
171
170
|
onChange: G
|
|
172
171
|
}
|
|
173
172
|
) })
|
|
174
173
|
] })
|
|
175
174
|
] }),
|
|
176
|
-
/* @__PURE__ */ t("div", { className: `${s.list} ${q}`, children:
|
|
177
|
-
(e) =>
|
|
175
|
+
/* @__PURE__ */ t("div", { className: `${s.list} ${q}`, children: T && T.map(
|
|
176
|
+
(e) => A == "blog" && /* @__PURE__ */ t(V, { article: e }, e._id)
|
|
178
177
|
) }),
|
|
179
178
|
j && /* @__PURE__ */ t("div", { className: s.loadMore, children: /* @__PURE__ */ t(
|
|
180
179
|
L,
|
|
@@ -194,5 +193,5 @@ function be({
|
|
|
194
193
|
] }) });
|
|
195
194
|
}
|
|
196
195
|
export {
|
|
197
|
-
|
|
196
|
+
he as DocumentListBlock
|
|
198
197
|
};
|