@ably/ui 16.0.0-dev.84b469e1 → 16.0.0-dev.8f8c19e6

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,2 +1,2 @@
1
- import BestRequirementsWinter2025 from"../images/g2-best-meets-requirements-2025.svg";import BestSupportWinter2025 from"../images/g2-best-support-2025.svg";import HighPerformerWinter2025 from"../images/g2-high-performer-2025.svg";import UsersMostLikelyToRecommend from"../images/g2-users-most-likely-to-recommend-2025.svg";export const footerLinks=[{title:"Products",links:[{label:"Ably Pub/Sub",link:"/pubsub"},{label:"Ably LiveSync",link:"/livesync"},{label:"Ably Chat",link:"/chat"},{label:"Ably Spaces",link:"/spaces"},{label:"Ably Asset Tracking",link:"/docs/asset-tracking"},{label:"Compare our tech",link:"/compare"}]},{title:"Platform",links:[{label:"Infrastructure",link:"/four-pillars-of-dependability"},{label:"Integrations",link:"/integrations"},{label:"SDKs",link:"/docs/sdks"},{label:"Changelog",link:"https://changelog.ably.com/"},{label:"Security & Compliance",link:"/"}]},{title:"Get started",links:[{label:"Documentation",link:"/docs"},{label:"Examples",link:"/examples"},{label:"Pricing",link:"/pricing"},{label:"Realtime A-Z",link:"/topics"},{label:"Support",link:"/support"}]},{title:"Company",links:[{label:"About Ably",link:"/about"},{label:"Blog",link:"/blog"},{label:"Careers",link:"/careers",badge:"WE’RE HIRING"},{label:"Contact us",link:"/contact"}]}];export const bottomFooterLinks=[{label:"Data protection",link:"/data-protection"},{label:"Privacy",link:"/privacy"},{label:"Legals",link:"/legals"},{label:"Cookies",link:"/privacy"}];export const socialLinks=[{key:"x",colorIcon:"icon-social-x",monoIcon:"icon-social-x-mono",link:"https://x.com/ablyrealtime"},{key:"linkedin",colorIcon:"icon-social-linkedin",monoIcon:"icon-social-linkedin-mono",link:"https://www.linkedin.com/company/ably-realtime"},{key:"github",colorIcon:"icon-social-github",monoIcon:"icon-social-github-mono",link:"https://github.com/ably/"},{key:"discord",colorIcon:"icon-social-discord",monoIcon:"icon-social-discord-mono",link:"https://discord.gg/g8yqePUVDn"},{key:"youtube",colorIcon:"icon-social-youtube",monoIcon:"icon-social-youtube-mono",link:"https://www.youtube.com/c/AblyRealtime"}];export const ablyAwards=[{image:BestRequirementsWinter2025,desc:"G2 Best Requirements Winter 2025"},{image:BestSupportWinter2025,desc:"G2 Best Support Winter 2025"},{image:HighPerformerWinter2025,desc:"G2 High Performer Winter 2025"},{image:UsersMostLikelyToRecommend,desc:"G2 Users Most Likely to Recommend Winter 2025"}];
1
+ import BestRequirementsWinter2025 from"../images/g2-best-meets-requirements-2025.svg";import BestSupportWinter2025 from"../images/g2-best-support-2025.svg";import HighPerformerWinter2025 from"../images/g2-high-performer-2025.svg";import UsersMostLikelyToRecommend from"../images/g2-users-most-likely-to-recommend-2025.svg";export const footerLinks=[{title:"Products",links:[{label:"Ably Pub/Sub",link:"/pubsub"},{label:"Ably LiveSync",link:"/livesync"},{label:"Ably Chat",link:"/chat"},{label:"Ably Spaces",link:"/spaces"},{label:"Ably Asset Tracking",link:"/docs/asset-tracking"},{label:"Compare our tech",link:"/compare"}]},{title:"Platform",links:[{label:"Infrastructure",link:"/four-pillars-of-dependability"},{label:"Integrations",link:"/integrations"},{label:"SDKs",link:"/docs/sdks"},{label:"Changelog",link:"https://changelog.ably.com/"},{label:"Security & Compliance",link:"/security-and-compliance"}]},{title:"Get started",links:[{label:"Documentation",link:"/docs"},{label:"Examples",link:"/examples"},{label:"Pricing",link:"/pricing"},{label:"Realtime A-Z",link:"/topics"},{label:"Support",link:"/support"}]},{title:"Company",links:[{label:"About Ably",link:"/about"},{label:"Blog",link:"/blog"},{label:"Careers",link:"/careers",badge:"WE’RE HIRING"},{label:"Contact us",link:"/contact"}]}];export const bottomFooterLinks=[{label:"Data protection",link:"/data-protection"},{label:"Privacy",link:"/privacy"},{label:"Legals",link:"/legals"},{label:"Cookies",link:"/privacy"}];export const socialLinks=[{key:"x",colorIcon:"icon-social-x",monoIcon:"icon-social-x-mono",link:"https://x.com/ablyrealtime"},{key:"linkedin",colorIcon:"icon-social-linkedin",monoIcon:"icon-social-linkedin-mono",link:"https://www.linkedin.com/company/ably-realtime"},{key:"github",colorIcon:"icon-social-github",monoIcon:"icon-social-github-mono",link:"https://github.com/ably/"},{key:"discord",colorIcon:"icon-social-discord",monoIcon:"icon-social-discord-mono",link:"https://discord.gg/g8yqePUVDn"},{key:"youtube",colorIcon:"icon-social-youtube",monoIcon:"icon-social-youtube-mono",link:"https://www.youtube.com/c/AblyRealtime"}];export const ablyAwards=[{image:BestRequirementsWinter2025,desc:"G2 Best Requirements Winter 2025"},{image:BestSupportWinter2025,desc:"G2 Best Support Winter 2025"},{image:HighPerformerWinter2025,desc:"G2 High Performer Winter 2025"},{image:UsersMostLikelyToRecommend,desc:"G2 Users Most Likely to Recommend Winter 2025"}];
2
2
  //# sourceMappingURL=data.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/Footer/data.ts"],"sourcesContent":["import { IconName } from \"../Icon/types\";\nimport BestRequirementsWinter2025 from \"../images/g2-best-meets-requirements-2025.svg\";\nimport BestSupportWinter2025 from \"../images/g2-best-support-2025.svg\";\nimport HighPerformerWinter2025 from \"../images/g2-high-performer-2025.svg\";\nimport UsersMostLikelyToRecommend from \"../images/g2-users-most-likely-to-recommend-2025.svg\";\n\ntype FooterLinksProps = {\n title: string;\n links: {\n label: string;\n link: string;\n badge?: string;\n }[];\n};\n\nexport const footerLinks: FooterLinksProps[] = [\n {\n title: \"Products\",\n links: [\n { label: \"Ably Pub/Sub\", link: \"/pubsub\" },\n { label: \"Ably LiveSync\", link: \"/livesync\" },\n { label: \"Ably Chat\", link: \"/chat\" },\n { label: \"Ably Spaces\", link: \"/spaces\" },\n { label: \"Ably Asset Tracking\", link: \"/docs/asset-tracking\" },\n { label: \"Compare our tech\", link: \"/compare\" },\n ],\n },\n {\n title: \"Platform\",\n links: [\n { label: \"Infrastructure\", link: \"/four-pillars-of-dependability\" },\n { label: \"Integrations\", link: \"/integrations\" },\n { label: \"SDKs\", link: \"/docs/sdks\" },\n { label: \"Changelog\", link: \"https://changelog.ably.com/\" },\n { label: \"Security & Compliance\", link: \"/\" },\n ],\n },\n {\n title: \"Get started\",\n links: [\n { label: \"Documentation\", link: \"/docs\" },\n { label: \"Examples\", link: \"/examples\" },\n { label: \"Pricing\", link: \"/pricing\" },\n { label: \"Realtime A-Z\", link: \"/topics\" },\n { label: \"Support\", link: \"/support\" },\n ],\n },\n {\n title: \"Company\",\n links: [\n { label: \"About Ably\", link: \"/about\" },\n { label: \"Blog\", link: \"/blog\" },\n { label: \"Careers\", link: \"/careers\", badge: \"WE’RE HIRING\" },\n { label: \"Contact us\", link: \"/contact\" },\n ],\n },\n];\n\nexport const bottomFooterLinks = [\n { label: \"Data protection\", link: \"/data-protection\" },\n { label: \"Privacy\", link: \"/privacy\" },\n { label: \"Legals\", link: \"/legals\" },\n { label: \"Cookies\", link: \"/privacy\" },\n];\n\nexport const socialLinks: {\n key: string;\n colorIcon: IconName;\n monoIcon: IconName;\n link: string;\n}[] = [\n {\n key: \"x\",\n colorIcon: \"icon-social-x\",\n monoIcon: \"icon-social-x-mono\",\n link: \"https://x.com/ablyrealtime\",\n },\n {\n key: \"linkedin\",\n colorIcon: \"icon-social-linkedin\",\n monoIcon: \"icon-social-linkedin-mono\",\n link: \"https://www.linkedin.com/company/ably-realtime\",\n },\n {\n key: \"github\",\n colorIcon: \"icon-social-github\",\n monoIcon: \"icon-social-github-mono\",\n link: \"https://github.com/ably/\",\n },\n {\n key: \"discord\",\n colorIcon: \"icon-social-discord\",\n monoIcon: \"icon-social-discord-mono\",\n link: \"https://discord.gg/g8yqePUVDn\",\n },\n {\n key: \"youtube\",\n colorIcon: \"icon-social-youtube\",\n monoIcon: \"icon-social-youtube-mono\",\n link: \"https://www.youtube.com/c/AblyRealtime\",\n },\n];\n\nexport const ablyAwards = [\n {\n image: BestRequirementsWinter2025,\n desc: \"G2 Best Requirements Winter 2025\",\n },\n {\n image: BestSupportWinter2025,\n desc: \"G2 Best Support Winter 2025\",\n },\n {\n image: HighPerformerWinter2025,\n desc: \"G2 High Performer Winter 2025\",\n },\n {\n image: UsersMostLikelyToRecommend,\n desc: \"G2 Users Most Likely to Recommend Winter 2025\",\n },\n];\n"],"names":["BestRequirementsWinter2025","BestSupportWinter2025","HighPerformerWinter2025","UsersMostLikelyToRecommend","footerLinks","title","links","label","link","badge","bottomFooterLinks","socialLinks","key","colorIcon","monoIcon","ablyAwards","image","desc"],"mappings":"AACA,OAAOA,+BAAgC,+CAAgD,AACvF,QAAOC,0BAA2B,oCAAqC,AACvE,QAAOC,4BAA6B,sCAAuC,AAC3E,QAAOC,+BAAgC,sDAAuD,AAW9F,QAAO,MAAMC,YAAkC,CAC7C,CACEC,MAAO,WACPC,MAAO,CACL,CAAEC,MAAO,eAAgBC,KAAM,SAAU,EACzC,CAAED,MAAO,gBAAiBC,KAAM,WAAY,EAC5C,CAAED,MAAO,YAAaC,KAAM,OAAQ,EACpC,CAAED,MAAO,cAAeC,KAAM,SAAU,EACxC,CAAED,MAAO,sBAAuBC,KAAM,sBAAuB,EAC7D,CAAED,MAAO,mBAAoBC,KAAM,UAAW,EAC/C,AACH,EACA,CACEH,MAAO,WACPC,MAAO,CACL,CAAEC,MAAO,iBAAkBC,KAAM,gCAAiC,EAClE,CAAED,MAAO,eAAgBC,KAAM,eAAgB,EAC/C,CAAED,MAAO,OAAQC,KAAM,YAAa,EACpC,CAAED,MAAO,YAAaC,KAAM,6BAA8B,EAC1D,CAAED,MAAO,wBAAyBC,KAAM,GAAI,EAC7C,AACH,EACA,CACEH,MAAO,cACPC,MAAO,CACL,CAAEC,MAAO,gBAAiBC,KAAM,OAAQ,EACxC,CAAED,MAAO,WAAYC,KAAM,WAAY,EACvC,CAAED,MAAO,UAAWC,KAAM,UAAW,EACrC,CAAED,MAAO,eAAgBC,KAAM,SAAU,EACzC,CAAED,MAAO,UAAWC,KAAM,UAAW,EACtC,AACH,EACA,CACEH,MAAO,UACPC,MAAO,CACL,CAAEC,MAAO,aAAcC,KAAM,QAAS,EACtC,CAAED,MAAO,OAAQC,KAAM,OAAQ,EAC/B,CAAED,MAAO,UAAWC,KAAM,WAAYC,MAAO,cAAe,EAC5D,CAAEF,MAAO,aAAcC,KAAM,UAAW,EACzC,AACH,EACD,AAAC,AAEF,QAAO,MAAME,kBAAoB,CAC/B,CAAEH,MAAO,kBAAmBC,KAAM,kBAAmB,EACrD,CAAED,MAAO,UAAWC,KAAM,UAAW,EACrC,CAAED,MAAO,SAAUC,KAAM,SAAU,EACnC,CAAED,MAAO,UAAWC,KAAM,UAAW,EACtC,AAAC,AAEF,QAAO,MAAMG,YAKP,CACJ,CACEC,IAAK,IACLC,UAAW,gBACXC,SAAU,qBACVN,KAAM,4BACR,EACA,CACEI,IAAK,WACLC,UAAW,uBACXC,SAAU,4BACVN,KAAM,gDACR,EACA,CACEI,IAAK,SACLC,UAAW,qBACXC,SAAU,0BACVN,KAAM,0BACR,EACA,CACEI,IAAK,UACLC,UAAW,sBACXC,SAAU,2BACVN,KAAM,+BACR,EACA,CACEI,IAAK,UACLC,UAAW,sBACXC,SAAU,2BACVN,KAAM,wCACR,EACD,AAAC,AAEF,QAAO,MAAMO,WAAa,CACxB,CACEC,MAAOhB,2BACPiB,KAAM,kCACR,EACA,CACED,MAAOf,sBACPgB,KAAM,6BACR,EACA,CACED,MAAOd,wBACPe,KAAM,+BACR,EACA,CACED,MAAOb,2BACPc,KAAM,+CACR,EACD,AAAC"}
1
+ {"version":3,"sources":["../../../src/core/Footer/data.ts"],"sourcesContent":["import { IconName } from \"../Icon/types\";\nimport BestRequirementsWinter2025 from \"../images/g2-best-meets-requirements-2025.svg\";\nimport BestSupportWinter2025 from \"../images/g2-best-support-2025.svg\";\nimport HighPerformerWinter2025 from \"../images/g2-high-performer-2025.svg\";\nimport UsersMostLikelyToRecommend from \"../images/g2-users-most-likely-to-recommend-2025.svg\";\n\ntype FooterLinksProps = {\n title: string;\n links: {\n label: string;\n link: string;\n badge?: string;\n }[];\n};\n\nexport const footerLinks: FooterLinksProps[] = [\n {\n title: \"Products\",\n links: [\n { label: \"Ably Pub/Sub\", link: \"/pubsub\" },\n { label: \"Ably LiveSync\", link: \"/livesync\" },\n { label: \"Ably Chat\", link: \"/chat\" },\n { label: \"Ably Spaces\", link: \"/spaces\" },\n { label: \"Ably Asset Tracking\", link: \"/docs/asset-tracking\" },\n { label: \"Compare our tech\", link: \"/compare\" },\n ],\n },\n {\n title: \"Platform\",\n links: [\n { label: \"Infrastructure\", link: \"/four-pillars-of-dependability\" },\n { label: \"Integrations\", link: \"/integrations\" },\n { label: \"SDKs\", link: \"/docs/sdks\" },\n { label: \"Changelog\", link: \"https://changelog.ably.com/\" },\n { label: \"Security & Compliance\", link: \"/security-and-compliance\" },\n ],\n },\n {\n title: \"Get started\",\n links: [\n { label: \"Documentation\", link: \"/docs\" },\n { label: \"Examples\", link: \"/examples\" },\n { label: \"Pricing\", link: \"/pricing\" },\n { label: \"Realtime A-Z\", link: \"/topics\" },\n { label: \"Support\", link: \"/support\" },\n ],\n },\n {\n title: \"Company\",\n links: [\n { label: \"About Ably\", link: \"/about\" },\n { label: \"Blog\", link: \"/blog\" },\n { label: \"Careers\", link: \"/careers\", badge: \"WE’RE HIRING\" },\n { label: \"Contact us\", link: \"/contact\" },\n ],\n },\n];\n\nexport const bottomFooterLinks = [\n { label: \"Data protection\", link: \"/data-protection\" },\n { label: \"Privacy\", link: \"/privacy\" },\n { label: \"Legals\", link: \"/legals\" },\n { label: \"Cookies\", link: \"/privacy\" },\n];\n\nexport const socialLinks: {\n key: string;\n colorIcon: IconName;\n monoIcon: IconName;\n link: string;\n}[] = [\n {\n key: \"x\",\n colorIcon: \"icon-social-x\",\n monoIcon: \"icon-social-x-mono\",\n link: \"https://x.com/ablyrealtime\",\n },\n {\n key: \"linkedin\",\n colorIcon: \"icon-social-linkedin\",\n monoIcon: \"icon-social-linkedin-mono\",\n link: \"https://www.linkedin.com/company/ably-realtime\",\n },\n {\n key: \"github\",\n colorIcon: \"icon-social-github\",\n monoIcon: \"icon-social-github-mono\",\n link: \"https://github.com/ably/\",\n },\n {\n key: \"discord\",\n colorIcon: \"icon-social-discord\",\n monoIcon: \"icon-social-discord-mono\",\n link: \"https://discord.gg/g8yqePUVDn\",\n },\n {\n key: \"youtube\",\n colorIcon: \"icon-social-youtube\",\n monoIcon: \"icon-social-youtube-mono\",\n link: \"https://www.youtube.com/c/AblyRealtime\",\n },\n];\n\nexport const ablyAwards = [\n {\n image: BestRequirementsWinter2025,\n desc: \"G2 Best Requirements Winter 2025\",\n },\n {\n image: BestSupportWinter2025,\n desc: \"G2 Best Support Winter 2025\",\n },\n {\n image: HighPerformerWinter2025,\n desc: \"G2 High Performer Winter 2025\",\n },\n {\n image: UsersMostLikelyToRecommend,\n desc: \"G2 Users Most Likely to Recommend Winter 2025\",\n },\n];\n"],"names":["BestRequirementsWinter2025","BestSupportWinter2025","HighPerformerWinter2025","UsersMostLikelyToRecommend","footerLinks","title","links","label","link","badge","bottomFooterLinks","socialLinks","key","colorIcon","monoIcon","ablyAwards","image","desc"],"mappings":"AACA,OAAOA,+BAAgC,+CAAgD,AACvF,QAAOC,0BAA2B,oCAAqC,AACvE,QAAOC,4BAA6B,sCAAuC,AAC3E,QAAOC,+BAAgC,sDAAuD,AAW9F,QAAO,MAAMC,YAAkC,CAC7C,CACEC,MAAO,WACPC,MAAO,CACL,CAAEC,MAAO,eAAgBC,KAAM,SAAU,EACzC,CAAED,MAAO,gBAAiBC,KAAM,WAAY,EAC5C,CAAED,MAAO,YAAaC,KAAM,OAAQ,EACpC,CAAED,MAAO,cAAeC,KAAM,SAAU,EACxC,CAAED,MAAO,sBAAuBC,KAAM,sBAAuB,EAC7D,CAAED,MAAO,mBAAoBC,KAAM,UAAW,EAC/C,AACH,EACA,CACEH,MAAO,WACPC,MAAO,CACL,CAAEC,MAAO,iBAAkBC,KAAM,gCAAiC,EAClE,CAAED,MAAO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B,KAAM,6BACR,EACA,CACED,MAAOd,wBACPe,KAAM,+BACR,EACA,CACED,MAAOb,2BACPc,KAAM,+CACR,EACD,AAAC"}
package/core/Footer.js CHANGED
@@ -1,2 +1,2 @@
1
- import React from"react";import cn from"./utils/cn";import Icon from"./Icon";import Status,{StatusUrl}from"./Status";import Logo from"./Logo";import Badge from"./Badge";import{ablyAwards,bottomFooterLinks,footerLinks,socialLinks}from"./Footer/data";const Footer=()=>{const textColorClassnames="ui-text-menu3 font-medium transition-colors text-neutral-1000 dark:text-neutral-300 hover:text-neutral-1300 hover:dark:text-neutral-000 active:text-neutral-800 active:dark:text-neutral-400 focus:outline focus:outline-gui-focus";return React.createElement("div",{className:"bg-neutral-000 dark:bg-neutral-1300","data-id":"footer"},React.createElement("footer",{className:"max-w-screen-xl mx-auto ui-grid-px pt-40 sm:pt-48 md:pt-64 pb-40"},React.createElement("div",{className:"flex flex-col sm:flex-row gap-x-24 gap-y-48 mb-64 justify-between"},React.createElement("div",{className:"flex-1 flex flex-col gap-24"},["light","dark"].map(theme=>React.createElement(Logo,{key:theme,href:"/",theme:theme,additionalLinkAttrs:{className:cn(" focus-base rounded w-[102px]",{"flex dark:hidden":theme==="light","hidden dark:flex":theme==="dark"})}})),React.createElement(Status,{statusUrl:StatusUrl,showDescription:true,additionalCSS:"border border-neutral-300 dark:border-neutral-1000 py-12 px-16 rounded-lg relative w-[fit-content]"}),React.createElement("div",{className:"flex gap-x-24"},socialLinks.map(link=>React.createElement("a",{key:link.key,href:link.link,target:"_blank",rel:"noreferrer noopener","aria-label":`Visit Ably on ${link.key}`,className:"w-20 h-20 group/social-icon"},React.createElement(Icon,{name:link.monoIcon,size:"20px",additionalCSS:"text-neutral-1000 dark:text-neutral-300 group-hover/social-icon:hidden"}),React.createElement(Icon,{name:link.colorIcon,size:"20px",additionalCSS:"hidden group-hover/social-icon:flex"})))),React.createElement("div",{className:"flex gap-8 mt-16"},ablyAwards.map(award=>React.createElement("img",{key:award.desc,src:award.image,alt:award.desc,width:"57",height:"64"})))),React.createElement("div",{className:"flex-1 md:flex-[2] flex flex-row flex-wrap gap-x-24 gap-y-48"},footerLinks.map(({title,links})=>React.createElement("div",{key:title,className:"flex-1 basis-1/3 md:basis-1"},React.createElement("h3",{className:"ui-text-overline2 text-neutral-700 dark:text-neutral-600 mb-16"},title),React.createElement("ul",{className:"flex flex-col gap-y-12"},links.map(({label,link,badge})=>React.createElement("li",{key:label,className:"flex gap-x-8"},React.createElement("a",{href:link,className:textColorClassnames,"aria-label":`Visit ${label}`},label),badge&&React.createElement(Badge,{size:"xs"},badge)))))))),React.createElement("div",{className:"pt-24 border-t border-neutral-300 dark:border-neutral-1000"},[bottomFooterLinks].map((links,index)=>React.createElement("div",{key:`link-set-${index}`,className:"flex gap-24"},links.map(link=>React.createElement("a",{key:link.label,href:link.link,className:textColorClassnames,"aria-label":`Visit ${link.label}`},link.label)))))))};export default Footer;
1
+ import React from"react";import cn from"./utils/cn";import Icon from"./Icon";import Status,{StatusUrl}from"./Status";import Logo from"./Logo";import Badge from"./Badge";import{ablyAwards,bottomFooterLinks,footerLinks,socialLinks}from"./Footer/data";const Footer=()=>{const textColorClassnames="ui-text-menu3 font-medium transition-colors text-neutral-1000 dark:text-neutral-300 hover:text-neutral-1300 hover:dark:text-neutral-000 active:text-neutral-800 active:dark:text-neutral-400 focus:outline focus:outline-gui-focus";return React.createElement("div",{className:"bg-neutral-100 dark:bg-neutral-1200 border-t border-neutral-300 dark:border-neutral-1000","data-id":"footer"},React.createElement("footer",{className:"max-w-screen-xl mx-auto ui-grid-px pt-40 sm:pt-48 md:pt-64 pb-40"},React.createElement("div",{className:"flex flex-col sm:flex-row gap-x-24 gap-y-48 mb-64 justify-between"},React.createElement("div",{className:"flex-1 flex flex-col gap-24"},["light","dark"].map(theme=>React.createElement(Logo,{key:theme,href:"/",theme:theme,additionalLinkAttrs:{className:cn(" focus-base rounded w-[102px]",{"flex dark:hidden":theme==="light","hidden dark:flex":theme==="dark"})}})),React.createElement(Status,{statusUrl:StatusUrl,showDescription:true}),React.createElement("div",{className:"flex gap-x-24"},socialLinks.map(link=>React.createElement("a",{key:link.key,href:link.link,target:"_blank",rel:"noreferrer noopener","aria-label":`Visit Ably on ${link.key}`,className:"w-20 h-20 group/social-icon"},React.createElement(Icon,{name:link.monoIcon,size:"20px",additionalCSS:"text-neutral-1000 dark:text-neutral-300 group-hover/social-icon:hidden"}),React.createElement(Icon,{name:link.colorIcon,size:"20px",additionalCSS:"hidden group-hover/social-icon:flex"})))),React.createElement("div",{className:"flex gap-8 mt-16"},ablyAwards.map(award=>React.createElement("img",{key:award.desc,src:award.image,alt:award.desc,width:"57",height:"64"})))),React.createElement("div",{className:"flex-1 md:flex-[2] flex flex-row flex-wrap gap-x-24 gap-y-48"},footerLinks.map(({title,links})=>React.createElement("div",{key:title,className:"flex-1 basis-1/3 md:basis-1"},React.createElement("h3",{className:"ui-text-overline2 text-neutral-700 dark:text-neutral-600 mb-16"},title),React.createElement("ul",{className:"flex flex-col gap-y-12"},links.map(({label,link,badge})=>React.createElement("li",{key:label,className:"flex gap-x-8"},React.createElement("a",{href:link,className:textColorClassnames,"aria-label":`Visit ${label}`},label),badge&&React.createElement(Badge,{size:"xs",className:"ui-text-p4 font-[10px]"},badge)))))))),React.createElement("div",{className:"pt-24 border-t border-neutral-300 dark:border-neutral-1000"},[bottomFooterLinks].map((links,index)=>React.createElement("div",{key:`link-set-${index}`,className:"flex gap-24"},links.map(link=>React.createElement("a",{key:link.label,href:link.link,className:textColorClassnames,"aria-label":`Visit ${link.label}`},link.label)))))))};export default Footer;
2
2
  //# sourceMappingURL=Footer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/Footer.tsx"],"sourcesContent":["import React from \"react\";\nimport cn from \"./utils/cn\";\nimport Icon from \"./Icon\";\nimport Status, { StatusUrl } from \"./Status\";\nimport { Theme } from \"./styles/colors/types\";\nimport Logo from \"./Logo\";\nimport Badge from \"./Badge\";\nimport {\n ablyAwards,\n bottomFooterLinks,\n footerLinks,\n socialLinks,\n} from \"./Footer/data\";\n\nconst Footer = () => {\n const textColorClassnames =\n \"ui-text-menu3 font-medium transition-colors text-neutral-1000 dark:text-neutral-300 hover:text-neutral-1300 hover:dark:text-neutral-000 active:text-neutral-800 active:dark:text-neutral-400 focus:outline focus:outline-gui-focus\";\n return (\n <div className=\"bg-neutral-000 dark:bg-neutral-1300\" data-id=\"footer\">\n <footer className=\"max-w-screen-xl mx-auto ui-grid-px pt-40 sm:pt-48 md:pt-64 pb-40\">\n <div className=\"flex flex-col sm:flex-row gap-x-24 gap-y-48 mb-64 justify-between\">\n <div className=\"flex-1 flex flex-col gap-24\">\n {([\"light\", \"dark\"] as Theme[]).map((theme) => (\n <Logo\n key={theme}\n href=\"/\"\n theme={theme}\n additionalLinkAttrs={{\n className: cn(\" focus-base rounded w-[102px]\", {\n \"flex dark:hidden\": theme === \"light\",\n \"hidden dark:flex\": theme === \"dark\",\n }),\n }}\n />\n ))}\n\n <Status\n statusUrl={StatusUrl}\n showDescription\n additionalCSS=\"border border-neutral-300 dark:border-neutral-1000 py-12 px-16 rounded-lg relative w-[fit-content]\"\n />\n\n <div className=\"flex gap-x-24\">\n {socialLinks.map((link) => (\n <a\n key={link.key}\n href={link.link}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n aria-label={`Visit Ably on ${link.key}`}\n className=\"w-20 h-20 group/social-icon\"\n >\n <Icon\n name={link.monoIcon}\n size=\"20px\"\n additionalCSS=\"text-neutral-1000 dark:text-neutral-300 group-hover/social-icon:hidden\"\n />\n <Icon\n name={link.colorIcon}\n size=\"20px\"\n additionalCSS=\"hidden group-hover/social-icon:flex\"\n />\n </a>\n ))}\n </div>\n <div className=\"flex gap-8 mt-16\">\n {ablyAwards.map((award) => (\n <img\n key={award.desc}\n src={award.image}\n alt={award.desc}\n width=\"57\"\n height=\"64\"\n />\n ))}\n </div>\n </div>\n <div className=\"flex-1 md:flex-[2] flex flex-row flex-wrap gap-x-24 gap-y-48\">\n {footerLinks.map(({ title, links }) => (\n <div key={title} className=\"flex-1 basis-1/3 md:basis-1\">\n <h3 className=\"ui-text-overline2 text-neutral-700 dark:text-neutral-600 mb-16\">\n {title}\n </h3>\n <ul className=\"flex flex-col gap-y-12\">\n {links.map(({ label, link, badge }) => (\n <li key={label} className=\"flex gap-x-8\">\n <a\n href={link}\n className={textColorClassnames}\n aria-label={`Visit ${label}`}\n >\n {label}\n </a>\n {badge && <Badge size=\"xs\">{badge}</Badge>}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n\n <div className=\"pt-24 border-t border-neutral-300 dark:border-neutral-1000\">\n {[bottomFooterLinks].map((links, index) => (\n <div key={`link-set-${index}`} className=\"flex gap-24\">\n {links.map((link) => (\n <a\n key={link.label}\n href={link.link}\n className={textColorClassnames}\n aria-label={`Visit ${link.label}`}\n >\n {link.label}\n </a>\n ))}\n </div>\n ))}\n </div>\n </footer>\n </div>\n );\n};\n\nexport default Footer;\n"],"names":["React","cn","Icon","Status","StatusUrl","Logo","Badge","ablyAwards","bottomFooterLinks","footerLinks","socialLinks","Footer","textColorClassnames","div","className","data-id","footer","map","theme","key","href","additionalLinkAttrs","statusUrl","showDescription","additionalCSS","link","a","target","rel","aria-label","name","monoIcon","size","colorIcon","award","img","desc","src","image","alt","width","height","title","links","h3","ul","label","badge","li","index"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,OAAQ,YAAa,AAC5B,QAAOC,SAAU,QAAS,AAC1B,QAAOC,QAAUC,SAAS,KAAQ,UAAW,AAE7C,QAAOC,SAAU,QAAS,AAC1B,QAAOC,UAAW,SAAU,AAC5B,QACEC,UAAU,CACVC,iBAAiB,CACjBC,WAAW,CACXC,WAAW,KACN,eAAgB,CAEvB,MAAMC,OAAS,KACb,MAAMC,oBACJ,qOACF,OACE,oBAACC,OAAIC,UAAU,sCAAsCC,UAAQ,UAC3D,oBAACC,UAAOF,UAAU,oEAChB,oBAACD,OAAIC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Y,CAAC,MAAM,EAAEiB,MAAM,CAAC,EAE3BA,OAEFC,OAAS,oBAACzC,OAAM0B,KAAK,MAAMe,cAS1C,oBAAClC,OAAIC,UAAU,8DACZ,CAACN,kBAAkB,CAACS,GAAG,CAAC,CAAC0B,MAAOM,QAC/B,oBAACpC,OAAIM,IAAK,CAAC,SAAS,EAAE8B,MAAM,CAAC,CAAEnC,UAAU,eACtC6B,MAAM1B,GAAG,CAAC,AAACQ,MACV,oBAACC,KACCP,IAAKM,KAAKqB,KAAK,CACf1B,KAAMK,KAAKA,IAAI,CACfX,UAAWF,oBACXiB,aAAY,CAAC,MAAM,EAAEJ,KAAKqB,KAAK,CAAC,CAAC,EAEhCrB,KAAKqB,KAAK,OAS7B,CAEA,gBAAenC,MAAO"}
1
+ {"version":3,"sources":["../../src/core/Footer.tsx"],"sourcesContent":["import React from \"react\";\nimport cn from \"./utils/cn\";\nimport Icon from \"./Icon\";\nimport Status, { StatusUrl } from \"./Status\";\nimport { Theme } from \"./styles/colors/types\";\nimport Logo from \"./Logo\";\nimport Badge from \"./Badge\";\nimport {\n ablyAwards,\n bottomFooterLinks,\n footerLinks,\n socialLinks,\n} from \"./Footer/data\";\n\nconst Footer = () => {\n const textColorClassnames =\n \"ui-text-menu3 font-medium transition-colors text-neutral-1000 dark:text-neutral-300 hover:text-neutral-1300 hover:dark:text-neutral-000 active:text-neutral-800 active:dark:text-neutral-400 focus:outline focus:outline-gui-focus\";\n\n return (\n <div\n className=\"bg-neutral-100 dark:bg-neutral-1200 border-t border-neutral-300 dark:border-neutral-1000\"\n data-id=\"footer\"\n >\n <footer className=\"max-w-screen-xl mx-auto ui-grid-px pt-40 sm:pt-48 md:pt-64 pb-40\">\n <div className=\"flex flex-col sm:flex-row gap-x-24 gap-y-48 mb-64 justify-between\">\n <div className=\"flex-1 flex flex-col gap-24\">\n {([\"light\", \"dark\"] as Theme[]).map((theme) => (\n <Logo\n key={theme}\n href=\"/\"\n theme={theme}\n additionalLinkAttrs={{\n className: cn(\" focus-base rounded w-[102px]\", {\n \"flex dark:hidden\": theme === \"light\",\n \"hidden dark:flex\": theme === \"dark\",\n }),\n }}\n />\n ))}\n\n <Status statusUrl={StatusUrl} showDescription />\n\n <div className=\"flex gap-x-24\">\n {socialLinks.map((link) => (\n <a\n key={link.key}\n href={link.link}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n aria-label={`Visit Ably on ${link.key}`}\n className=\"w-20 h-20 group/social-icon\"\n >\n <Icon\n name={link.monoIcon}\n size=\"20px\"\n additionalCSS=\"text-neutral-1000 dark:text-neutral-300 group-hover/social-icon:hidden\"\n />\n <Icon\n name={link.colorIcon}\n size=\"20px\"\n additionalCSS=\"hidden group-hover/social-icon:flex\"\n />\n </a>\n ))}\n </div>\n <div className=\"flex gap-8 mt-16\">\n {ablyAwards.map((award) => (\n <img\n key={award.desc}\n src={award.image}\n alt={award.desc}\n width=\"57\"\n height=\"64\"\n />\n ))}\n </div>\n </div>\n <div className=\"flex-1 md:flex-[2] flex flex-row flex-wrap gap-x-24 gap-y-48\">\n {footerLinks.map(({ title, links }) => (\n <div key={title} className=\"flex-1 basis-1/3 md:basis-1\">\n <h3 className=\"ui-text-overline2 text-neutral-700 dark:text-neutral-600 mb-16\">\n {title}\n </h3>\n <ul className=\"flex flex-col gap-y-12\">\n {links.map(({ label, link, badge }) => (\n <li key={label} className=\"flex gap-x-8\">\n <a\n href={link}\n className={textColorClassnames}\n aria-label={`Visit ${label}`}\n >\n {label}\n </a>\n {badge && (\n <Badge size=\"xs\" className=\"ui-text-p4 font-[10px]\">\n {badge}\n </Badge>\n )}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n\n <div className=\"pt-24 border-t border-neutral-300 dark:border-neutral-1000\">\n {[bottomFooterLinks].map((links, index) => (\n <div key={`link-set-${index}`} className=\"flex gap-24\">\n {links.map((link) => (\n <a\n key={link.label}\n href={link.link}\n className={textColorClassnames}\n aria-label={`Visit ${link.label}`}\n >\n {link.label}\n </a>\n ))}\n </div>\n ))}\n </div>\n </footer>\n </div>\n );\n};\n\nexport default Footer;\n"],"names":["React","cn","Icon","Status","StatusUrl","Logo","Badge","ablyAwards","bottomFooterLinks","footerLinks","socialLinks","Footer","textColorClassnames","div","className","data-id","footer","map","theme","key","href","additionalLinkAttrs","statusUrl","showDescription","link","a","target","rel","aria-label","name","monoIcon","size","additionalCSS","colorIcon","award","img","desc","src","image","alt","width","height","title","links","h3","ul","label","badge","li","index"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,OAAQ,YAAa,AAC5B,QAAOC,SAAU,QAAS,AAC1B,QAAOC,QAAUC,SAAS,KAAQ,UAAW,AAE7C,QAAOC,SAAU,QAAS,AAC1B,QAAOC,UAAW,SAAU,AAC5B,QACEC,UAAU,CACVC,iBAAiB,CACjBC,WAAW,CACXC,WAAW,KACN,eAAgB,CAEvB,MAAMC,OAAS,KACb,MAAMC,oBACJ,qOAEF,OACE,oBAACC,OACCC,UAAU,2FACVC,UAAQ,UAER,oBAACC,UAAOF,UAAU,oEAChB,oBAACD,OAAIC,UAAU,qEACb,oBAACD,OAAIC,UAAU,+BACZ,AAAC,CAAC,QAAS,OAAO,CAAaG,GAAG,CAAC,AAACC,OACnC,oBAACb,MACCc,IAAKD,MACLE,KAAK,IACLF,MAAOA,MACPG,oBAAqB,CACnBP,UAAWb,GAAG,gCAAiC,CAC7C,mBAAoBiB,QAAU,QAC9B,mBAAoBA,QAAU,MAChC,EACF,KAIJ,oBAACf,QAAOmB,UAAWlB,UAAWmB,gBAAAA,OAE9B,oBAACV,OAAIC,UAAU,iBACZJ,YAAYO,GAAG,CAAC,AAACO,MAChB,oBAACC,KACCN,IAAKK,KAAKL,GAAG,CACbC,KAAMI,KAAKA,IAAI,CACfE,OAAO,SACPC,IAAI,sBACJC,aAAY,CAAC,cAAc,EAAEJ,KAAKL,GAAG,CAAC,CAAC,CACvCL,UAAU,+BAEV,oBAACZ,MACC2B,KAAML,KAAKM,QAAQ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icon from"./Icon";import cn from"./utils/cn";import Logo from"./Logo";import{componentMaxHeight,HEADER_BOTTOM_MARGIN,HEADER_HEIGHT}from"./utils/heights";import{HeaderLinks}from"./Header/HeaderLinks";import throttle from"lodash.throttle";import{COLLAPSE_TRIGGER_DISTANCE}from"./Notice/component";import"./Header/Header.css";const FLEXIBLE_DESKTOP_CLASSES="hidden md:flex flex-1 items-center h-full";const MAX_MOBILE_MENU_WIDTH="560px";const Header=({className,isNoticeVisible=false,searchBar,searchButton,logoHref,headerLinks,nav,mobileNav,sessionState,themedScrollpoints=[],searchButtonVisibility="all"})=>{const[showMenu,setShowMenu]=useState(false);const[fadingOut,setFadingOut]=useState(false);const[scrollpointClasses,setScrollpointClasses]=useState("");const[bannerVisible,setBannerVisible]=useState(isNoticeVisible);const menuRef=useRef(null);const closeMenu=()=>{setFadingOut(true);setTimeout(()=>{setShowMenu(false);setFadingOut(false)},150)};useEffect(()=>{const handleResize=()=>{if(window.innerWidth>=1040){setShowMenu(false)}};window.addEventListener("resize",handleResize);return()=>window.removeEventListener("resize",handleResize)},[]);useEffect(()=>{if(showMenu){document.body.classList.add("overflow-hidden")}else{document.body.classList.remove("overflow-hidden")}return()=>{document.body.classList.remove("overflow-hidden")}},[showMenu]);useEffect(()=>{const handleScroll=()=>{setBannerVisible(window.scrollY<=COLLAPSE_TRIGGER_DISTANCE&&isNoticeVisible);for(const scrollpoint of themedScrollpoints){const element=document.getElementById(scrollpoint.id);if(element){const rect=element.getBoundingClientRect();if(rect.top<=HEADER_HEIGHT&&rect.bottom>=HEADER_HEIGHT){setScrollpointClasses(scrollpoint.className);return}}}};const throttledHandleScroll=throttle(handleScroll,150);handleScroll();window.addEventListener("scroll",throttledHandleScroll);return()=>window.removeEventListener("scroll",throttledHandleScroll)},[themedScrollpoints]);const wrappedSearchButton=useMemo(()=>searchButton?React.createElement("div",{className:"text-neutral-1300 dark:text-neutral-000 flex items-center"},searchButton):null,[searchButton]);return React.createElement(React.Fragment,null,React.createElement("header",{role:"banner",className:cn("fixed left-0 w-full z-10 top-0 bg-neutral-000 dark:bg-neutral-1300 border-b border-neutral-300 dark:border-neutral-1000 transition-colors px-24 md:px-64",scrollpointClasses,{"md:top-auto":bannerVisible}),style:{height:HEADER_HEIGHT}},React.createElement("div",{className:cn("flex items-center h-full",className)},React.createElement("nav",{className:"flex flex-1 h-full items-center"},["light","dark"].map(theme=>React.createElement(Logo,{key:theme,href:logoHref,theme:theme,additionalLinkAttrs:{className:cn("h-full focus-base rounded mr-32 w-[96px]",{"flex dark:hidden":theme==="light","hidden dark:flex":theme==="dark"})}})),React.createElement("div",{className:FLEXIBLE_DESKTOP_CLASSES},nav)),React.createElement("div",{className:"flex md:hidden flex-1 items-center justify-end gap-24 h-full"},searchButtonVisibility!=="desktop"?wrappedSearchButton:null,React.createElement("button",{className:"cursor-pointer focus-base rounded flex items-center",onClick:()=>setShowMenu(!showMenu),"aria-expanded":showMenu,"aria-controls":"mobile-menu","aria-label":"Toggle menu"},React.createElement(Icon,{name:showMenu?"icon-gui-x-mark-outline":"icon-gui-bars-3-outline",additionalCSS:"text-neutral-1300 dark:text-neutral-000",size:"1.5rem"}))),searchBar?React.createElement("div",{className:cn(FLEXIBLE_DESKTOP_CLASSES,"justify-center")},searchBar):null,React.createElement(HeaderLinks,{className:FLEXIBLE_DESKTOP_CLASSES,headerLinks:headerLinks,sessionState:sessionState,searchButton:wrappedSearchButton,searchButtonVisibility:searchButtonVisibility}))),showMenu?React.createElement(React.Fragment,null,React.createElement("div",{className:cn("fixed inset-0 bg-neutral-1300 dark:bg-neutral-1300",{"animate-[fade-in-ten-percent_150ms_ease-in-out_forwards]":!fadingOut,"animate-[fade-out-ten-percent_150ms_ease-in-out_forwards]":fadingOut}),onClick:closeMenu,onKeyDown:e=>e.key==="Escape"&&closeMenu(),role:"presentation"}),React.createElement("div",{id:"mobile-menu",className:"md:hidden fixed flex flex-col top-[76px] overflow-y-hidden mx-12 right-0 w-[calc(100%-24px)] bg-neutral-000 dark:bg-neutral-1300 rounded-2xl ui-shadow-lg-medium z-20 mobile-menu-container",style:{maxWidth:MAX_MOBILE_MENU_WIDTH,maxHeight:componentMaxHeight(HEADER_HEIGHT,HEADER_BOTTOM_MARGIN)},ref:menuRef,role:"navigation"},mobileNav,React.createElement(HeaderLinks,{headerLinks:headerLinks,sessionState:sessionState}))):null)};export default Header;
1
+ import React,{useState,useEffect,useRef,useMemo}from"react";import Icon from"./Icon";import cn from"./utils/cn";import Logo from"./Logo";import{componentMaxHeight,HEADER_BOTTOM_MARGIN,HEADER_HEIGHT}from"./utils/heights";import{HeaderLinks}from"./Header/HeaderLinks";import throttle from"lodash.throttle";import{COLLAPSE_TRIGGER_DISTANCE}from"./Notice/component";import"./Header/Header.css";const FLEXIBLE_DESKTOP_CLASSES="hidden md:flex flex-1 items-center h-full";const MAX_MOBILE_MENU_WIDTH="560px";const Header=({className,isNoticeVisible=false,searchBar,searchButton,logoHref,headerLinks,headerLinksClassName,nav,mobileNav,sessionState,themedScrollpoints=[],searchButtonVisibility="all"})=>{const[showMenu,setShowMenu]=useState(false);const[fadingOut,setFadingOut]=useState(false);const[scrollpointClasses,setScrollpointClasses]=useState("");const[bannerVisible,setBannerVisible]=useState(isNoticeVisible);const menuRef=useRef(null);const closeMenu=()=>{setFadingOut(true);setTimeout(()=>{setShowMenu(false);setFadingOut(false)},150)};useEffect(()=>{const handleResize=()=>{if(window.innerWidth>=1040){setShowMenu(false)}};window.addEventListener("resize",handleResize);return()=>window.removeEventListener("resize",handleResize)},[]);useEffect(()=>{if(showMenu){document.body.classList.add("overflow-hidden")}else{document.body.classList.remove("overflow-hidden")}return()=>{document.body.classList.remove("overflow-hidden")}},[showMenu]);useEffect(()=>{const handleScroll=()=>{setBannerVisible(window.scrollY<=COLLAPSE_TRIGGER_DISTANCE&&isNoticeVisible);for(const scrollpoint of themedScrollpoints){const element=document.getElementById(scrollpoint.id);if(element){const rect=element.getBoundingClientRect();if(rect.top<=HEADER_HEIGHT&&rect.bottom>=HEADER_HEIGHT){setScrollpointClasses(scrollpoint.className);return}}}};const throttledHandleScroll=throttle(handleScroll,150);handleScroll();window.addEventListener("scroll",throttledHandleScroll);return()=>window.removeEventListener("scroll",throttledHandleScroll)},[themedScrollpoints]);const wrappedSearchButton=useMemo(()=>searchButton?React.createElement("div",{className:"text-neutral-1300 dark:text-neutral-000 flex items-center"},searchButton):null,[searchButton]);return React.createElement(React.Fragment,null,React.createElement("header",{role:"banner",className:cn("fixed left-0 w-full z-10 top-0 bg-neutral-000 dark:bg-neutral-1300 border-b border-neutral-300 dark:border-neutral-1000 transition-colors px-24 md:px-64",scrollpointClasses,{"md:top-auto":bannerVisible}),style:{height:HEADER_HEIGHT}},React.createElement("div",{className:cn("flex items-center h-full",className)},React.createElement("nav",{className:"flex flex-1 h-full items-center"},["light","dark"].map(theme=>React.createElement(Logo,{key:theme,href:logoHref,theme:theme,additionalLinkAttrs:{className:cn("h-full focus-base rounded mr-32 w-[96px]",{"flex dark:hidden":theme==="light","hidden dark:flex":theme==="dark"})}})),React.createElement("div",{className:FLEXIBLE_DESKTOP_CLASSES},nav)),React.createElement("div",{className:"flex md:hidden flex-1 items-center justify-end gap-24 h-full"},searchButtonVisibility!=="desktop"?wrappedSearchButton:null,React.createElement("button",{className:"cursor-pointer focus-base rounded flex items-center",onClick:()=>setShowMenu(!showMenu),"aria-expanded":showMenu,"aria-controls":"mobile-menu","aria-label":"Toggle menu"},React.createElement(Icon,{name:showMenu?"icon-gui-x-mark-outline":"icon-gui-bars-3-outline",additionalCSS:"text-neutral-1300 dark:text-neutral-000",size:"1.5rem"}))),searchBar?React.createElement("div",{className:cn(FLEXIBLE_DESKTOP_CLASSES,"justify-center")},searchBar):null,React.createElement(HeaderLinks,{className:cn(FLEXIBLE_DESKTOP_CLASSES,headerLinksClassName),headerLinks:headerLinks,sessionState:sessionState,searchButton:wrappedSearchButton,searchButtonVisibility:searchButtonVisibility}))),showMenu?React.createElement(React.Fragment,null,React.createElement("div",{className:cn("fixed inset-0 bg-neutral-1300 dark:bg-neutral-1300",{"animate-[fade-in-ten-percent_150ms_ease-in-out_forwards]":!fadingOut,"animate-[fade-out-ten-percent_150ms_ease-in-out_forwards]":fadingOut}),onClick:closeMenu,onKeyDown:e=>e.key==="Escape"&&closeMenu(),role:"presentation"}),React.createElement("div",{id:"mobile-menu",className:"md:hidden fixed flex flex-col top-[76px] overflow-y-hidden mx-12 right-0 w-[calc(100%-24px)] bg-neutral-000 dark:bg-neutral-1300 rounded-2xl ui-shadow-lg-medium z-20 mobile-menu-container",style:{maxWidth:MAX_MOBILE_MENU_WIDTH,maxHeight:componentMaxHeight(HEADER_HEIGHT,HEADER_BOTTOM_MARGIN)},ref:menuRef,role:"navigation"},mobileNav,React.createElement(HeaderLinks,{headerLinks:headerLinks,sessionState:sessionState}))):null)};export default Header;
2
2
  //# sourceMappingURL=Header.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/Header.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, ReactNode, useMemo } from \"react\";\nimport Icon from \"./Icon\";\nimport cn from \"./utils/cn\";\nimport Logo from \"./Logo\";\nimport {\n componentMaxHeight,\n HEADER_BOTTOM_MARGIN,\n HEADER_HEIGHT,\n} from \"./utils/heights\";\nimport { HeaderLinks } from \"./Header/HeaderLinks\";\nimport throttle from \"lodash.throttle\";\nimport { Theme } from \"./styles/colors/types\";\nimport { COLLAPSE_TRIGGER_DISTANCE } from \"./Notice/component\";\nimport \"./Header/Header.css\";\n\nexport type ThemedScrollpoint = {\n id: string;\n className: string;\n};\n\n/**\n * Represents the state of the user session in the header.\n */\nexport type HeaderSessionState = {\n /**\n * Indicates if the user is signed in.\n */\n signedIn: boolean;\n\n /**\n * Information required to log out the user.\n */\n logOut: {\n /**\n * Token used for logging out.\n */\n token: string;\n\n /**\n * URL to log out the user.\n */\n href: string;\n };\n\n /**\n * Name of the user's account.\n */\n accountName: string;\n};\n\n/**\n * Props for the Header component.\n */\nexport type HeaderProps = {\n /**\n * Optional classnames to add to the header\n */\n className?: string;\n /**\n * Indicates if the notice banner is visible.\n */\n isNoticeVisible: boolean;\n /**\n * Optional search bar element.\n */\n searchBar?: ReactNode;\n\n /**\n * Optional search button element.\n */\n searchButton?: ReactNode;\n\n /**\n * URL for the logo link.\n */\n logoHref?: string;\n\n /**\n * Array of header links.\n */\n headerLinks?: {\n /**\n * URL for the link.\n */\n href: string;\n\n /**\n * Label for the link.\n */\n label: string;\n\n /**\n * Indicates if the link should open in a new tab.\n */\n external?: boolean;\n }[];\n\n /**\n * Optional desktop navigation element.\n */\n nav?: ReactNode;\n\n /**\n * Optional mobile navigation element.\n */\n mobileNav?: ReactNode;\n\n /**\n * State of the user session.\n */\n sessionState?: HeaderSessionState;\n\n /**\n * Array of themed scrollpoints. The header will change its appearance based on the scrollpoint in view.\n */\n themedScrollpoints?: ThemedScrollpoint[];\n\n /**\n * Visibility setting for the search button.\n * - \"all\": Visible on all devices.\n * - \"desktop\": Visible only on desktop devices.\n * - \"mobile\": Visible only on mobile devices.\n */\n searchButtonVisibility?: \"all\" | \"desktop\" | \"mobile\";\n};\n\nconst FLEXIBLE_DESKTOP_CLASSES = \"hidden md:flex flex-1 items-center h-full\";\n\n/**\n * Maximum width before the menu expanded into full width\n */\nconst MAX_MOBILE_MENU_WIDTH = \"560px\";\n\nconst Header: React.FC<HeaderProps> = ({\n className,\n isNoticeVisible = false,\n searchBar,\n searchButton,\n logoHref,\n headerLinks,\n nav,\n mobileNav,\n sessionState,\n themedScrollpoints = [],\n searchButtonVisibility = \"all\",\n}) => {\n const [showMenu, setShowMenu] = useState(false);\n const [fadingOut, setFadingOut] = useState(false);\n const [scrollpointClasses, setScrollpointClasses] = useState<string>(\"\");\n const [bannerVisible, setBannerVisible] = useState(isNoticeVisible);\n const menuRef = useRef<HTMLDivElement>(null);\n\n const closeMenu = () => {\n setFadingOut(true);\n\n setTimeout(() => {\n setShowMenu(false);\n setFadingOut(false);\n }, 150);\n };\n\n useEffect(() => {\n const handleResize = () => {\n if (window.innerWidth >= 1040) {\n setShowMenu(false);\n }\n };\n window.addEventListener(\"resize\", handleResize);\n return () => window.removeEventListener(\"resize\", handleResize);\n }, []);\n\n useEffect(() => {\n if (showMenu) {\n document.body.classList.add(\"overflow-hidden\");\n } else {\n document.body.classList.remove(\"overflow-hidden\");\n }\n\n // Cleanup on unmount\n return () => {\n document.body.classList.remove(\"overflow-hidden\");\n };\n }, [showMenu]);\n\n useEffect(() => {\n const handleScroll = () => {\n setBannerVisible(\n window.scrollY <= COLLAPSE_TRIGGER_DISTANCE && isNoticeVisible,\n );\n for (const scrollpoint of themedScrollpoints) {\n const element = document.getElementById(scrollpoint.id);\n if (element) {\n const rect = element.getBoundingClientRect();\n if (rect.top <= HEADER_HEIGHT && rect.bottom >= HEADER_HEIGHT) {\n setScrollpointClasses(scrollpoint.className);\n return;\n }\n }\n }\n };\n\n const throttledHandleScroll = throttle(handleScroll, 150);\n\n handleScroll();\n\n window.addEventListener(\"scroll\", throttledHandleScroll);\n return () => window.removeEventListener(\"scroll\", throttledHandleScroll);\n }, [themedScrollpoints]);\n\n const wrappedSearchButton = useMemo(\n () =>\n searchButton ? (\n <div className=\"text-neutral-1300 dark:text-neutral-000 flex items-center\">\n {searchButton}\n </div>\n ) : null,\n [searchButton],\n );\n\n return (\n <>\n <header\n role=\"banner\"\n className={cn(\n \"fixed left-0 w-full z-10 top-0 bg-neutral-000 dark:bg-neutral-1300 border-b border-neutral-300 dark:border-neutral-1000 transition-colors px-24 md:px-64\",\n scrollpointClasses,\n {\n \"md:top-auto\": bannerVisible,\n },\n )}\n style={{ height: HEADER_HEIGHT }}\n >\n <div className={cn(\"flex items-center h-full\", className)}>\n <nav className=\"flex flex-1 h-full items-center\">\n {([\"light\", \"dark\"] as Theme[]).map((theme) => (\n <Logo\n key={theme}\n href={logoHref}\n theme={theme}\n additionalLinkAttrs={{\n className: cn(\"h-full focus-base rounded mr-32 w-[96px]\", {\n \"flex dark:hidden\": theme === \"light\",\n \"hidden dark:flex\": theme === \"dark\",\n }),\n }}\n />\n ))}\n <div className={FLEXIBLE_DESKTOP_CLASSES}>{nav}</div>\n </nav>\n <div className=\"flex md:hidden flex-1 items-center justify-end gap-24 h-full\">\n {searchButtonVisibility !== \"desktop\" ? wrappedSearchButton : null}\n <button\n className=\"cursor-pointer focus-base rounded flex items-center\"\n onClick={() => setShowMenu(!showMenu)}\n aria-expanded={showMenu}\n aria-controls=\"mobile-menu\"\n aria-label=\"Toggle menu\"\n >\n <Icon\n name={\n showMenu\n ? \"icon-gui-x-mark-outline\"\n : \"icon-gui-bars-3-outline\"\n }\n additionalCSS=\"text-neutral-1300 dark:text-neutral-000\"\n size=\"1.5rem\"\n />\n </button>\n </div>\n {searchBar ? (\n <div className={cn(FLEXIBLE_DESKTOP_CLASSES, \"justify-center\")}>\n {searchBar}\n </div>\n ) : null}\n <HeaderLinks\n className={FLEXIBLE_DESKTOP_CLASSES}\n headerLinks={headerLinks}\n sessionState={sessionState}\n searchButton={wrappedSearchButton}\n searchButtonVisibility={searchButtonVisibility}\n />\n </div>\n </header>\n {showMenu ? (\n <>\n <div\n className={cn(\n \"fixed inset-0 bg-neutral-1300 dark:bg-neutral-1300\",\n {\n \"animate-[fade-in-ten-percent_150ms_ease-in-out_forwards]\":\n !fadingOut,\n \"animate-[fade-out-ten-percent_150ms_ease-in-out_forwards]\":\n fadingOut,\n },\n )}\n onClick={closeMenu}\n onKeyDown={(e) => e.key === \"Escape\" && closeMenu()}\n role=\"presentation\"\n />\n <div\n id=\"mobile-menu\"\n className=\"md:hidden fixed flex flex-col top-[76px] overflow-y-hidden mx-12 right-0 w-[calc(100%-24px)] bg-neutral-000 dark:bg-neutral-1300 rounded-2xl ui-shadow-lg-medium z-20 mobile-menu-container\"\n style={{\n maxWidth: MAX_MOBILE_MENU_WIDTH,\n maxHeight: componentMaxHeight(\n HEADER_HEIGHT,\n HEADER_BOTTOM_MARGIN,\n ),\n }}\n ref={menuRef}\n role=\"navigation\"\n >\n {mobileNav}\n <HeaderLinks\n headerLinks={headerLinks}\n sessionState={sessionState}\n />\n </div>\n </>\n ) : null}\n </>\n );\n};\n\nexport default Header;\n"],"names":["React","useState","useEffect","useRef","useMemo","Icon","cn","Logo","componentMaxHeight","HEADER_BOTTOM_MARGIN","HEADER_HEIGHT","HeaderLinks","throttle","COLLAPSE_TRIGGER_DISTANCE","FLEXIBLE_DESKTOP_CLASSES","MAX_MOBILE_MENU_WIDTH","Header","className","isNoticeVisible","searchBar","searchButton","logoHref","headerLinks","nav","mobileNav","sessionState","themedScrollpoints","searchButtonVisibility","showMenu","setShowMenu","fadingOut","setFadingOut","scrollpointClasses","setScrollpointClasses","bannerVisible","setBannerVisible","menuRef","closeMenu","setTimeout","handleResize","window","innerWidth","addEventListener","removeEventListener","document","body","classList","add","remove","handleScroll","scrollY","scrollpoint","element","getElementById","id","rect","getBoundingClientRect","top","bottom","throttledHandleScroll","wrappedSearchButton","div","header","role","style","height","map","theme","key","href","additionalLinkAttrs","button","onClick","aria-expanded","aria-controls","aria-label","name","additionalCSS","size","onKeyDown","e","maxWidth","maxHeight","ref"],"mappings":"AAAA,OAAOA,OAASC,QAAQ,CAAEC,SAAS,CAAEC,MAAM,CAAaC,OAAO,KAAQ,OAAQ,AAC/E,QAAOC,SAAU,QAAS,AAC1B,QAAOC,OAAQ,YAAa,AAC5B,QAAOC,SAAU,QAAS,AAC1B,QACEC,kBAAkB,CAClBC,oBAAoB,CACpBC,aAAa,KACR,iBAAkB,AACzB,QAASC,WAAW,KAAQ,sBAAuB,AACnD,QAAOC,aAAc,iBAAkB,AAEvC,QAASC,yBAAyB,KAAQ,oBAAqB,AAC/D,OAAO,qBAAsB,CAiH7B,MAAMC,yBAA2B,4CAKjC,MAAMC,sBAAwB,QAE9B,MAAMC,OAAgC,CAAC,CACrCC,SAAS,CACTC,gBAAkB,KAAK,CACvBC,SAAS,CACTC,YAAY,CACZC,QAAQ,CACRC,WAAW,CACXC,GAAG,CACHC,SAAS,CACT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,KAAK,iBAEP,oBAACF,OACCP,GAAG,cACHrC,UAAU,8LACV+C,MAAO,CACLiB,SAAUlE,sBACVmE,UAAW1E,mBACTE,cACAD,qBAEJ,EACA0E,IAAK/C,QACL2B,KAAK,cAEJvC,UACD,oBAACb,aACCW,YAAaA,YACbG,aAAcA,iBAIlB,KAGV,CAEA,gBAAeT,MAAO"}
1
+ {"version":3,"sources":["../../src/core/Header.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, ReactNode, useMemo } from \"react\";\nimport Icon from \"./Icon\";\nimport cn from \"./utils/cn\";\nimport Logo from \"./Logo\";\nimport {\n componentMaxHeight,\n HEADER_BOTTOM_MARGIN,\n HEADER_HEIGHT,\n} from \"./utils/heights\";\nimport { HeaderLinks } from \"./Header/HeaderLinks\";\nimport throttle from \"lodash.throttle\";\nimport { Theme } from \"./styles/colors/types\";\nimport { COLLAPSE_TRIGGER_DISTANCE } from \"./Notice/component\";\nimport \"./Header/Header.css\";\n\nexport type ThemedScrollpoint = {\n id: string;\n className: string;\n};\n\n/**\n * Represents the state of the user session in the header.\n */\nexport type HeaderSessionState = {\n /**\n * Indicates if the user is signed in.\n */\n signedIn: boolean;\n\n /**\n * Information required to log out the user.\n */\n logOut: {\n /**\n * Token used for logging out.\n */\n token: string;\n\n /**\n * URL to log out the user.\n */\n href: string;\n };\n\n /**\n * Name of the user's account.\n */\n accountName: string;\n};\n\n/**\n * Props for the Header component.\n */\nexport type HeaderProps = {\n /**\n * Optional classnames to add to the header\n */\n className?: string;\n /**\n * Indicates if the notice banner is visible.\n */\n isNoticeVisible: boolean;\n /**\n * Optional search bar element.\n */\n searchBar?: ReactNode;\n\n /**\n * Optional search button element.\n */\n searchButton?: ReactNode;\n\n /**\n * URL for the logo link.\n */\n logoHref?: string;\n\n /**\n * Array of header links.\n */\n headerLinks?: {\n /**\n * URL for the link.\n */\n href: string;\n\n /**\n * Label for the link.\n */\n label: string;\n\n /**\n * Indicates if the link should open in a new tab.\n */\n external?: boolean;\n }[];\n\n /**\n * Optional classname for styling the header links container.\n */\n headerLinksClassName?: string;\n\n /**\n * Optional desktop navigation element.\n */\n nav?: ReactNode;\n\n /**\n * Optional mobile navigation element.\n */\n mobileNav?: ReactNode;\n\n /**\n * State of the user session.\n */\n sessionState?: HeaderSessionState;\n\n /**\n * Array of themed scrollpoints. The header will change its appearance based on the scrollpoint in view.\n */\n themedScrollpoints?: ThemedScrollpoint[];\n\n /**\n * Visibility setting for the search button.\n * - \"all\": Visible on all devices.\n * - \"desktop\": Visible only on desktop devices.\n * - \"mobile\": Visible only on mobile devices.\n */\n searchButtonVisibility?: \"all\" | \"desktop\" | \"mobile\";\n};\n\nconst FLEXIBLE_DESKTOP_CLASSES = \"hidden md:flex flex-1 items-center h-full\";\n\n/**\n * Maximum width before the menu expanded into full width\n */\nconst MAX_MOBILE_MENU_WIDTH = \"560px\";\n\nconst Header: React.FC<HeaderProps> = ({\n className,\n isNoticeVisible = false,\n searchBar,\n searchButton,\n logoHref,\n headerLinks,\n headerLinksClassName,\n nav,\n mobileNav,\n sessionState,\n themedScrollpoints = [],\n searchButtonVisibility = \"all\",\n}) => {\n const [showMenu, setShowMenu] = useState(false);\n const [fadingOut, setFadingOut] = useState(false);\n const [scrollpointClasses, setScrollpointClasses] = useState<string>(\"\");\n const [bannerVisible, setBannerVisible] = useState(isNoticeVisible);\n const menuRef = useRef<HTMLDivElement>(null);\n\n const closeMenu = () => {\n setFadingOut(true);\n\n setTimeout(() => {\n setShowMenu(false);\n setFadingOut(false);\n }, 150);\n };\n\n useEffect(() => {\n const handleResize = () => {\n if (window.innerWidth >= 1040) {\n setShowMenu(false);\n }\n };\n window.addEventListener(\"resize\", handleResize);\n return () => window.removeEventListener(\"resize\", handleResize);\n }, []);\n\n useEffect(() => {\n if (showMenu) {\n document.body.classList.add(\"overflow-hidden\");\n } else {\n document.body.classList.remove(\"overflow-hidden\");\n }\n\n // Cleanup on unmount\n return () => {\n document.body.classList.remove(\"overflow-hidden\");\n };\n }, [showMenu]);\n\n useEffect(() => {\n const handleScroll = () => {\n setBannerVisible(\n window.scrollY <= COLLAPSE_TRIGGER_DISTANCE && isNoticeVisible,\n );\n for (const scrollpoint of themedScrollpoints) {\n const element = document.getElementById(scrollpoint.id);\n if (element) {\n const rect = element.getBoundingClientRect();\n if (rect.top <= HEADER_HEIGHT && rect.bottom >= HEADER_HEIGHT) {\n setScrollpointClasses(scrollpoint.className);\n return;\n }\n }\n }\n };\n\n const throttledHandleScroll = throttle(handleScroll, 150);\n\n handleScroll();\n\n window.addEventListener(\"scroll\", throttledHandleScroll);\n return () => window.removeEventListener(\"scroll\", throttledHandleScroll);\n }, [themedScrollpoints]);\n\n const wrappedSearchButton = useMemo(\n () =>\n searchButton ? (\n <div className=\"text-neutral-1300 dark:text-neutral-000 flex items-center\">\n {searchButton}\n </div>\n ) : null,\n [searchButton],\n );\n\n return (\n <>\n <header\n role=\"banner\"\n className={cn(\n \"fixed left-0 w-full z-10 top-0 bg-neutral-000 dark:bg-neutral-1300 border-b border-neutral-300 dark:border-neutral-1000 transition-colors px-24 md:px-64\",\n scrollpointClasses,\n {\n \"md:top-auto\": bannerVisible,\n },\n )}\n style={{ height: HEADER_HEIGHT }}\n >\n <div className={cn(\"flex items-center h-full\", className)}>\n <nav className=\"flex flex-1 h-full items-center\">\n {([\"light\", \"dark\"] as Theme[]).map((theme) => (\n <Logo\n key={theme}\n href={logoHref}\n theme={theme}\n additionalLinkAttrs={{\n className: cn(\"h-full focus-base rounded mr-32 w-[96px]\", {\n \"flex dark:hidden\": theme === \"light\",\n \"hidden dark:flex\": theme === \"dark\",\n }),\n }}\n />\n ))}\n <div className={FLEXIBLE_DESKTOP_CLASSES}>{nav}</div>\n </nav>\n <div className=\"flex md:hidden flex-1 items-center justify-end gap-24 h-full\">\n {searchButtonVisibility !== \"desktop\" ? wrappedSearchButton : null}\n <button\n className=\"cursor-pointer focus-base rounded flex items-center\"\n onClick={() => setShowMenu(!showMenu)}\n aria-expanded={showMenu}\n aria-controls=\"mobile-menu\"\n aria-label=\"Toggle menu\"\n >\n <Icon\n name={\n showMenu\n ? \"icon-gui-x-mark-outline\"\n : \"icon-gui-bars-3-outline\"\n }\n additionalCSS=\"text-neutral-1300 dark:text-neutral-000\"\n size=\"1.5rem\"\n />\n </button>\n </div>\n {searchBar ? (\n <div className={cn(FLEXIBLE_DESKTOP_CLASSES, \"justify-center\")}>\n {searchBar}\n </div>\n ) : null}\n <HeaderLinks\n className={cn(FLEXIBLE_DESKTOP_CLASSES, headerLinksClassName)}\n headerLinks={headerLinks}\n sessionState={sessionState}\n searchButton={wrappedSearchButton}\n searchButtonVisibility={searchButtonVisibility}\n />\n </div>\n </header>\n {showMenu ? (\n <>\n <div\n className={cn(\n \"fixed inset-0 bg-neutral-1300 dark:bg-neutral-1300\",\n {\n \"animate-[fade-in-ten-percent_150ms_ease-in-out_forwards]\":\n !fadingOut,\n \"animate-[fade-out-ten-percent_150ms_ease-in-out_forwards]\":\n fadingOut,\n },\n )}\n onClick={closeMenu}\n onKeyDown={(e) => e.key === \"Escape\" && closeMenu()}\n role=\"presentation\"\n />\n <div\n id=\"mobile-menu\"\n className=\"md:hidden fixed flex flex-col top-[76px] overflow-y-hidden mx-12 right-0 w-[calc(100%-24px)] bg-neutral-000 dark:bg-neutral-1300 rounded-2xl ui-shadow-lg-medium z-20 mobile-menu-container\"\n style={{\n maxWidth: MAX_MOBILE_MENU_WIDTH,\n maxHeight: componentMaxHeight(\n HEADER_HEIGHT,\n HEADER_BOTTOM_MARGIN,\n ),\n }}\n ref={menuRef}\n role=\"navigation\"\n >\n {mobileNav}\n <HeaderLinks\n headerLinks={headerLinks}\n sessionState={sessionState}\n />\n </div>\n </>\n ) : null}\n </>\n );\n};\n\nexport default Header;\n"],"names":["React","useState","useEffect","useRef","useMemo","Icon","cn","Logo","componentMaxHeight","HEADER_BOTTOM_MARGIN","HEADER_HEIGHT","HeaderLinks","throttle","COLLAPSE_TRIGGER_DISTANCE","FLEXIBLE_DESKTOP_CLASSES","MAX_MOBILE_MENU_WIDTH","Header","className","isNoticeVisible","searchBar","searchButton","logoHref","headerLinks","headerLinksClassName","nav","mobileNav","sessionState","themedScrollpoints","searchButtonVisibility","showMenu","setShowMenu","fadingOut","setFadingOut","scrollpointClasses","setScrollpointClasses","bannerVisible","setBannerVisible","menuRef","closeMenu","setTimeout","handleResize","window","innerWidth","addEventListener","removeEventListener","document","body","classList","add","remove","handleScroll","scrollY","scrollpoint","element","getElementById","id","rect","getBoundingClientRect","top","bottom","throttledHandleScroll","wrappedSearchButton","div","header","role","style","height","map","theme","key","href","additionalLinkAttrs","button","onClick","aria-expanded","aria-controls","aria-label","name","additionalCSS","size","onKeyDown","e","maxWidth","maxHeight","ref"],"mappings":"AAAA,OAAOA,OAASC,QAAQ,CAAEC,SAAS,CAAEC,MAAM,CAAaC,OAAO,KAAQ,OAAQ,AAC/E,QAAOC,SAAU,QAAS,AAC1B,QAAOC,OAAQ,YAAa,AAC5B,QAAOC,SAAU,QAAS,AAC1B,QACEC,kBAAkB,CAClBC,oBAAoB,CACpBC,aAAa,KACR,iBAAkB,AACzB,QAASC,WAAW,KAAQ,sBAAuB,AACnD,QAAOC,aAAc,iBAAkB,AAEvC,QAASC,yBAAyB,KAAQ,oBAAqB,AAC/D,OAAO,qBAAsB,CAsH7B,MAAMC,yBAA2B,4CAKjC,MAAMC,sBAAwB,QAE9B,MAAMC,OAAgC,CAAC,CACrCC,SAAS,CACTC,gBAAkB,KAAK,CACvBC,SAAS,CACTC,YAAY,CACZC,QAAQ,CACRC,WAAW,CACXC,oBAAoB,CACpBC,GAAG,CACHC,SAAS,CACTC,YAAY,CACZC,mBAAqB,EAAE,CACvBC,uBAAyB,KAAK,CAC/B,IACC,KAAM,CAACC,SAAUC,YAAY,CAAG7B,SAAS,OACzC,KAAM,CAAC8B,UAAWC,aAAa,CAAG/B,SAAS,OAC3C,KAAM,CAACgC,mBAAoBC,sBAAsB,CAAGjC,SAAiB,IACrE,KAAM,CAACkC,c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A,gBAAeV,MAAO"}
package/core/Meganav.js CHANGED
@@ -1,2 +1,2 @@
1
- import React,{useEffect,useMemo}from"react";import Header from"./Header";import Flyout from"./Flyout";import{menuItemsForHeader}from"./Meganav/data";import{MeganavMobile}from"./Meganav/MeganavMobile";import Notice from"./Notice";import{HEADER_HEIGHT}from"./utils/heights";const Meganav=({sessionState,notice,theme})=>{const[noticeHeight,setNoticeHeight]=React.useState(0);const mobileNavItems=useMemo(()=>menuItemsForHeader.filter(item=>!item.isHiddenMobile).map(({name,link,content})=>({name,link,content})),[]);useEffect(()=>{const observeNoticeResize=()=>{const noticeElement=document.querySelector('[data-id="ui-notice"]');if(noticeElement){setNoticeHeight(noticeElement.getBoundingClientRect().height)}};observeNoticeResize();window.addEventListener("resize",observeNoticeResize);return()=>window.removeEventListener("resize",observeNoticeResize)},[]);return React.createElement(React.Fragment,null,React.createElement("div",{className:"absolute inset-0 w-full z-50",id:theme==="dark"?"meganav-theme-dark":"meganav","data-testid":"meganav",style:{height:HEADER_HEIGHT+noticeHeight}},notice&&React.createElement(Notice,{...notice.props,config:notice.config}),React.createElement(Header,{className:"max-w-screen-xl mx-auto px-0 sm:px-32 md:px-40 lg:px-64",isNoticeVisible:!!notice,nav:React.createElement(Flyout,{menuItems:menuItemsForHeader,className:"justify-left z-40",flyOutClassName:"flex justify-left",viewPortClassName:"ui-shadow-lg-medium border border-neutral-000 dark:border-neutral-1300 rounded-2xl mt-8 bg-neutral-000 dark:bg-neutral-1300",hasAnimation:true}),mobileNav:React.createElement(MeganavMobile,{mobileNavItems:mobileNavItems}),headerLinks:[{href:"/contact",label:"Contact us"}],sessionState:sessionState,themedScrollpoints:[{id:"meganav",className:"ui-theme-light !bg-transparent !border-none"},{id:"meganav-theme-dark",className:"ui-theme-dark !bg-transparent !border-none"},{id:"main",className:"ui-theme-light"},{id:"main-theme-light",className:"ui-theme-light"},{id:"main-theme-dark",className:"ui-theme-dark"}]})))};export default Meganav;
1
+ import React,{useEffect,useMemo}from"react";import Header from"./Header";import Flyout from"./Flyout";import{menuItemsForHeader}from"./Meganav/data";import{MeganavMobile}from"./Meganav/MeganavMobile";import Notice from"./Notice";import{HEADER_HEIGHT}from"./utils/heights";const Meganav=({sessionState,notice,theme})=>{const[noticeHeight,setNoticeHeight]=React.useState(0);const mobileNavItems=useMemo(()=>menuItemsForHeader.filter(item=>!item.isHiddenMobile).map(({name,link,content})=>({name,link,content})),[]);useEffect(()=>{const observeNoticeResize=()=>{const noticeElement=document.querySelector('[data-id="ui-notice"]');if(noticeElement){setNoticeHeight(noticeElement.getBoundingClientRect().height)}};observeNoticeResize();window.addEventListener("resize",observeNoticeResize);return()=>window.removeEventListener("resize",observeNoticeResize)},[]);return React.createElement(React.Fragment,null,React.createElement("div",{className:"absolute inset-0 w-full z-50",id:theme==="dark"?"meganav-theme-dark":"meganav","data-testid":"meganav",style:{height:HEADER_HEIGHT+noticeHeight}},notice&&React.createElement(Notice,{...notice.props,config:notice.config}),React.createElement(Header,{className:"max-w-screen-xl mx-auto px-0 sm:px-32 md:px-40 lg:px-64",isNoticeVisible:!!notice,nav:React.createElement(Flyout,{menuItems:menuItemsForHeader,className:"justify-left z-40",flyOutClassName:"flex justify-left",viewPortClassName:"ui-shadow-lg-medium border border-neutral-000 dark:border-neutral-1300 rounded-2xl mt-8 bg-neutral-000 dark:bg-neutral-1300",hasAnimation:true}),mobileNav:React.createElement(MeganavMobile,{mobileNavItems:mobileNavItems}),headerLinks:[{href:"/contact",label:"Contact us"}],headerLinksClassName:"md:gap-x-24 ",sessionState:sessionState,themedScrollpoints:[{id:"meganav",className:"ui-theme-light !bg-transparent !border-none"},{id:"meganav-theme-dark",className:"ui-theme-dark !bg-transparent !border-none"},{id:"main",className:"ui-theme-light"},{id:"main-theme-light",className:"ui-theme-light"},{id:"main-theme-dark",className:"ui-theme-dark"}]})))};export default Meganav;
2
2
  //# sourceMappingURL=Meganav.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/Meganav.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport Header, { HeaderSessionState } from \"./Header\";\nimport Flyout from \"./Flyout\";\nimport { menuItemsForHeader } from \"./Meganav/data\";\nimport { MeganavMobile } from \"./Meganav/MeganavMobile\";\nimport Notice from \"./Notice\";\nimport { HEADER_HEIGHT } from \"./utils/heights\";\n\nexport type MeganavNoticeBannerProps = {\n props: {\n title: string;\n bodyText: string;\n buttonLink: string;\n buttonLabel: string;\n closeBtn: boolean;\n };\n config: {\n cookieId: string;\n noticeId: string | number;\n options: {\n collapse: boolean;\n };\n };\n};\n\nexport type MeganavProps = {\n sessionState: HeaderSessionState;\n notice?: MeganavNoticeBannerProps;\n theme?: string;\n};\n\nconst Meganav = ({ sessionState, notice, theme }: MeganavProps) => {\n const [noticeHeight, setNoticeHeight] = React.useState(0);\n const mobileNavItems = useMemo(\n () =>\n menuItemsForHeader\n .filter((item) => !item.isHiddenMobile)\n .map(({ name, link, content }) => ({ name, link, content })),\n [],\n );\n\n useEffect(() => {\n const observeNoticeResize = () => {\n const noticeElement = document.querySelector('[data-id=\"ui-notice\"]');\n if (noticeElement) {\n setNoticeHeight(noticeElement.getBoundingClientRect().height);\n }\n };\n observeNoticeResize();\n window.addEventListener(\"resize\", observeNoticeResize);\n return () => window.removeEventListener(\"resize\", observeNoticeResize);\n }, []);\n\n return (\n <>\n <div\n className=\"absolute inset-0 w-full z-50\"\n id={theme === \"dark\" ? \"meganav-theme-dark\" : \"meganav\"}\n data-testid=\"meganav\"\n style={{ height: HEADER_HEIGHT + noticeHeight }}\n >\n {notice && <Notice {...notice.props} config={notice.config} />}\n <Header\n className=\"max-w-screen-xl mx-auto px-0 sm:px-32 md:px-40 lg:px-64\"\n isNoticeVisible={!!notice}\n nav={\n <Flyout\n menuItems={menuItemsForHeader}\n className=\"justify-left z-40\"\n flyOutClassName=\"flex justify-left\"\n viewPortClassName=\"ui-shadow-lg-medium border border-neutral-000 dark:border-neutral-1300 rounded-2xl mt-8 bg-neutral-000 dark:bg-neutral-1300\"\n hasAnimation={true}\n />\n }\n mobileNav={<MeganavMobile mobileNavItems={mobileNavItems} />}\n headerLinks={[{ href: \"/contact\", label: \"Contact us\" }]}\n sessionState={sessionState}\n themedScrollpoints={[\n {\n id: \"meganav\",\n className: \"ui-theme-light !bg-transparent !border-none\",\n },\n {\n id: \"meganav-theme-dark\",\n className: \"ui-theme-dark !bg-transparent !border-none\",\n },\n {\n id: \"main\",\n className: \"ui-theme-light\",\n },\n {\n id: \"main-theme-light\",\n className: \"ui-theme-light\",\n },\n {\n id: \"main-theme-dark\",\n className: \"ui-theme-dark\",\n },\n ]}\n />\n </div>\n </>\n );\n};\n\nexport default Meganav;\n"],"names":["React","useEffect","useMemo","Header","Flyout","menuItemsForHeader","MeganavMobile","Notice","HEADER_HEIGHT","Meganav","sessionState","notice","theme","noticeHeight","setNoticeHeight","useState","mobileNavItems","filter","item","isHiddenMobile","map","name","link","content","observeNoticeResize","noticeElement","document","querySelector","getBoundingClientRect","height","window","addEventListener","removeEventListener","div","className","id","data-testid","style","props","config","isNoticeVisible","nav","menuItems","flyOutClassName","viewPortClassName","hasAnimation","mobileNav","headerLinks","href","label","themedScrollpoints"],"mappings":"AAAA,OAAOA,OAASC,SAAS,CAAEC,OAAO,KAAQ,OAAQ,AAClD,QAAOC,WAAoC,UAAW,AACtD,QAAOC,WAAY,UAAW,AAC9B,QAASC,kBAAkB,KAAQ,gBAAiB,AACpD,QAASC,aAAa,KAAQ,yBAA0B,AACxD,QAAOC,WAAY,UAAW,AAC9B,QAASC,aAAa,KAAQ,iBAAkB,CAyBhD,MAAMC,QAAU,CAAC,CAAEC,YAAY,CAAEC,MAAM,CAAEC,KAAK,CAAgB,IAC5D,KAAM,CAACC,aAAcC,gBAAgB,CAAGd,MAAMe,QAAQ,CAAC,GACvD,MAAMC,eAAiBd,QACrB,IACEG,mBACGY,MAAM,CAAC,AAACC,MAAS,CAACA,KAAKC,cAAc,EACrCC,GAAG,CAAC,CAAC,CAAEC,IAAI,CAAEC,IAAI,CAAEC,OAAO,CAAE,GAAM,CAAA,CAAEF,KAAMC,KAAMC,OAAQ,CAAA,GAC7D,EAAE,EAGJtB,UAAU,KACR,MAAMuB,oBAAsB,KAC1B,MAAMC,cAAgBC,SAASC,aAAa,CAAC,yBAC7C,GAAIF,cAAe,CACjBX,gBAAgBW,cAAcG,qBAAqB,GAAGC,MAAM,CAC9D,CACF,EACAL,sBACAM,OAAOC,gBAAgB,CAAC,SAAUP,qBAClC,MAAO,IAAMM,OAAOE,mBAAmB,CAAC,SAAUR,oBACpD,EAAG,EAAE,EAEL,OACE,wCACE,oBAACS,OACCC,UAAU,+BACVC,GAAIvB,QAAU,OAAS,qBAAuB,UAC9CwB,cAAY,UACZC,MAAO,CAAER,OAAQrB,cAAgBK,YAAa,GAE7CF,QAAU,oBAACJ,QAAQ,GAAGI,OAAO2B,KAAK,CAAEC,OAAQ5B,OAAO4B,MAAM,GAC1D,oBAACpC,QACC+B,UAAU,0DACVM,gBAAiB,CAAC,CAAC7B,OACnB8B,IACE,oBAACrC,QACCsC,UAAWrC,mBACX6B,UAAU,oBACVS,gBAAgB,oBAChBC,kBAAkB,8HAClBC,aAAc,OAGlBC,UAAW,oBAACxC,eAAcU,eAAgBA,iBAC1C+B,YAAa,CAAC,CAAEC,KAAM,WAAYC,MAAO,YAAa,EAAE,CACxDvC,aAAcA,aACdwC,mBAAoB,CAClB,CACEf,GAAI,UACJD,UAAW,6CACb,EACA,CACEC,GAAI,qBACJD,UAAW,4CACb,EACA,CACEC,GAAI,OACJD,UAAW,gBACb,EACA,CACEC,GAAI,mBACJD,UAAW,gBACb,EACA,CACEC,GAAI,kBACJD,UAAW,eACb,EACD,IAKX,CAEA,gBAAezB,OAAQ"}
1
+ {"version":3,"sources":["../../src/core/Meganav.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport Header, { HeaderSessionState } from \"./Header\";\nimport Flyout from \"./Flyout\";\nimport { menuItemsForHeader } from \"./Meganav/data\";\nimport { MeganavMobile } from \"./Meganav/MeganavMobile\";\nimport Notice from \"./Notice\";\nimport { HEADER_HEIGHT } from \"./utils/heights\";\n\nexport type MeganavNoticeBannerProps = {\n props: {\n title: string;\n bodyText: string;\n buttonLink: string;\n buttonLabel: string;\n closeBtn: boolean;\n };\n config: {\n cookieId: string;\n noticeId: string | number;\n options: {\n collapse: boolean;\n };\n };\n};\n\nexport type MeganavProps = {\n sessionState: HeaderSessionState;\n notice?: MeganavNoticeBannerProps;\n theme?: string;\n};\n\nconst Meganav = ({ sessionState, notice, theme }: MeganavProps) => {\n const [noticeHeight, setNoticeHeight] = React.useState(0);\n const mobileNavItems = useMemo(\n () =>\n menuItemsForHeader\n .filter((item) => !item.isHiddenMobile)\n .map(({ name, link, content }) => ({ name, link, content })),\n [],\n );\n\n useEffect(() => {\n const observeNoticeResize = () => {\n const noticeElement = document.querySelector('[data-id=\"ui-notice\"]');\n if (noticeElement) {\n setNoticeHeight(noticeElement.getBoundingClientRect().height);\n }\n };\n observeNoticeResize();\n window.addEventListener(\"resize\", observeNoticeResize);\n return () => window.removeEventListener(\"resize\", observeNoticeResize);\n }, []);\n\n return (\n <>\n <div\n className=\"absolute inset-0 w-full z-50\"\n id={theme === \"dark\" ? \"meganav-theme-dark\" : \"meganav\"}\n data-testid=\"meganav\"\n style={{ height: HEADER_HEIGHT + noticeHeight }}\n >\n {notice && <Notice {...notice.props} config={notice.config} />}\n <Header\n className=\"max-w-screen-xl mx-auto px-0 sm:px-32 md:px-40 lg:px-64\"\n isNoticeVisible={!!notice}\n nav={\n <Flyout\n menuItems={menuItemsForHeader}\n className=\"justify-left z-40\"\n flyOutClassName=\"flex justify-left\"\n viewPortClassName=\"ui-shadow-lg-medium border border-neutral-000 dark:border-neutral-1300 rounded-2xl mt-8 bg-neutral-000 dark:bg-neutral-1300\"\n hasAnimation={true}\n />\n }\n mobileNav={<MeganavMobile mobileNavItems={mobileNavItems} />}\n headerLinks={[{ href: \"/contact\", label: \"Contact us\" }]}\n headerLinksClassName=\"md:gap-x-24 \"\n sessionState={sessionState}\n themedScrollpoints={[\n {\n id: \"meganav\",\n className: \"ui-theme-light !bg-transparent !border-none\",\n },\n {\n id: \"meganav-theme-dark\",\n className: \"ui-theme-dark !bg-transparent !border-none\",\n },\n {\n id: \"main\",\n className: \"ui-theme-light\",\n },\n {\n id: \"main-theme-light\",\n className: \"ui-theme-light\",\n },\n {\n id: \"main-theme-dark\",\n className: \"ui-theme-dark\",\n },\n ]}\n />\n </div>\n </>\n );\n};\n\nexport default Meganav;\n"],"names":["React","useEffect","useMemo","Header","Flyout","menuItemsForHeader","MeganavMobile","Notice","HEADER_HEIGHT","Meganav","sessionState","notice","theme","noticeHeight","setNoticeHeight","useState","mobileNavItems","filter","item","isHiddenMobile","map","name","link","content","observeNoticeResize","noticeElement","document","querySelector","getBoundingClientRect","height","window","addEventListener","removeEventListener","div","className","id","data-testid","style","props","config","isNoticeVisible","nav","menuItems","flyOutClassName","viewPortClassName","hasAnimation","mobileNav","headerLinks","href","label","headerLinksClassName","themedScrollpoints"],"mappings":"AAAA,OAAOA,OAASC,SAAS,CAAEC,OAAO,KAAQ,OAAQ,AAClD,QAAOC,WAAoC,UAAW,AACtD,QAAOC,WAAY,UAAW,AAC9B,QAASC,kBAAkB,KAAQ,gBAAiB,AACpD,QAASC,aAAa,KAAQ,yBAA0B,AACxD,QAAOC,WAAY,UAAW,AAC9B,QAASC,aAAa,KAAQ,iBAAkB,CAyBhD,MAAMC,QAAU,CAAC,CAAEC,YAAY,CAAEC,MAAM,CAAEC,KAAK,CAAgB,IAC5D,KAAM,CAACC,aAAcC,gBAAgB,CAAGd,MAAMe,QAAQ,CAAC,GACvD,MAAMC,eAAiBd,QACrB,IACEG,mBACGY,MAAM,CAAC,AAACC,MAAS,CAACA,KAAKC,cAAc,EACrCC,GAAG,CAAC,CAAC,CAAEC,IAAI,CAAEC,IAAI,CAAEC,OAAO,CAAE,GAAM,CAAA,CAAEF,KAAMC,KAAMC,OAAQ,CAAA,GAC7D,EAAE,EAGJtB,UAAU,KACR,MAAMuB,oBAAsB,KAC1B,MAAMC,cAAgBC,SAASC,aAAa,CAAC,yBAC7C,GAAIF,cAAe,CACjBX,gBAAgBW,cAAcG,qBAAqB,GAAGC,MAAM,CAC9D,CACF,EACAL,sBACAM,OAAOC,gBAAgB,CAAC,SAAUP,qBAClC,MAAO,IAAMM,OAAOE,mBAAmB,CAAC,SAAUR,oBACpD,EAAG,EAAE,EAEL,OACE,wCACE,oBAACS,OACCC,UAAU,+BACVC,GAAIvB,QAAU,OAAS,qBAAuB,UAC9CwB,cAAY,UACZC,MAAO,CAAER,OAAQrB,cAAgBK,YAAa,GAE7CF,QAAU,oBAACJ,QAAQ,GAAGI,OAAO2B,KAAK,CAAEC,OAAQ5B,OAAO4B,MAAM,GAC1D,oBAACpC,QACC+B,UAAU,0DACVM,gBAAiB,CAAC,CAAC7B,OACnB8B,IACE,oBAACrC,QACCsC,UAAWrC,mBACX6B,UAAU,oBACVS,gBAAgB,oBAChBC,kBAAkB,8HAClBC,aAAc,OAGlBC,UAAW,oBAACxC,eAAcU,eAAgBA,iBAC1C+B,YAAa,CAAC,CAAEC,KAAM,WAAYC,MAAO,YAAa,EAAE,CACxDC,qBAAqB,eACrBxC,aAAcA,aACdyC,mBAAoB,CAClB,CACEhB,GAAI,UACJD,UAAW,6CACb,EACA,CACEC,GAAI,qBACJD,UAAW,4CACb,EACA,CACEC,GAAI,OACJD,UAAW,gBACb,EACA,CACEC,GAAI,mBACJD,UAAW,gBACb,EACA,CACEC,GAAI,kBACJD,UAAW,eACb,EACD,IAKX,CAEA,gBAAezB,OAAQ"}
package/index.d.ts CHANGED
@@ -628,6 +628,10 @@ export type HeaderProps = {
628
628
  */
629
629
  external?: boolean;
630
630
  }[];
631
+ /**
632
+ * Optional classname for styling the header links container.
633
+ */
634
+ headerLinksClassName?: string;
631
635
  /**
632
636
  * Optional desktop navigation element.
633
637
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "16.0.0-dev.84b469e1",
3
+ "version": "16.0.0-dev.8f8c19e6",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",