@ably/ui 15.4.1 → 15.5.0-dev.4b8dd74
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/README.md +23 -2
- package/core/Accordion/types.js +2 -1
- package/core/Accordion/types.js.map +1 -0
- package/core/Accordion/utils.js +2 -1
- package/core/Accordion/utils.js.map +1 -0
- package/core/Accordion.js +2 -1
- package/core/Accordion.js.map +1 -0
- package/core/Badge.js +2 -1
- package/core/Badge.js.map +1 -0
- package/core/Button.js +2 -1
- package/core/Button.js.map +1 -0
- package/core/Code/component.js +2 -1
- package/core/Code/component.js.map +1 -0
- package/core/Code.js +2 -1
- package/core/Code.js.map +1 -0
- package/core/ConnectStateWrapper.js +2 -1
- package/core/ConnectStateWrapper.js.map +1 -0
- package/core/ContactFooter/component.js +2 -1
- package/core/ContactFooter/component.js.map +1 -0
- package/core/ContactFooter.js +2 -1
- package/core/ContactFooter.js.map +1 -0
- package/core/CookieMessage.js +2 -1
- package/core/CookieMessage.js.map +1 -0
- package/core/CustomerLogos.js +2 -1
- package/core/CustomerLogos.js.map +1 -0
- package/core/DropdownMenu.js +2 -1
- package/core/DropdownMenu.js.map +1 -0
- package/core/Expander.js +2 -1
- package/core/Expander.js.map +1 -0
- package/core/FeaturedLink.js +2 -1
- package/core/FeaturedLink.js.map +1 -0
- package/core/Flash.js +2 -1
- package/core/Flash.js.map +1 -0
- package/core/Flyout.js +2 -1
- package/core/Flyout.js.map +1 -0
- package/core/Footer.js +2 -1
- package/core/Footer.js.map +1 -0
- package/core/Header/HeaderLinks.js +2 -1
- package/core/Header/HeaderLinks.js.map +1 -0
- package/core/Header.js +2 -1
- package/core/Header.js.map +1 -0
- package/core/Icon/computed-icons.js +2 -1
- package/core/Icon/computed-icons.js.map +1 -0
- package/core/Icon/types.js +2 -1
- package/core/Icon/types.js.map +1 -0
- package/core/Icon/utils.js +2 -1
- package/core/Icon/utils.js.map +1 -0
- package/core/Icon.js +2 -1
- package/core/Icon.js.map +1 -0
- package/core/LinkButton.js +2 -1
- package/core/LinkButton.js.map +1 -0
- package/core/Loader.js +2 -1
- package/core/Loader.js.map +1 -0
- package/core/Logo.js +2 -1
- package/core/Logo.js.map +1 -0
- package/core/Meganav/component.js +2 -1
- package/core/Meganav/component.js.map +1 -0
- package/core/Meganav.js +2 -1
- package/core/Meganav.js.map +1 -0
- package/core/MeganavBlogPostsList/component.js +2 -1
- package/core/MeganavBlogPostsList/component.js.map +1 -0
- package/core/MeganavBlogPostsList.js +2 -1
- package/core/MeganavBlogPostsList.js.map +1 -0
- package/core/MeganavContentCompany.js +2 -1
- package/core/MeganavContentCompany.js.map +1 -0
- package/core/MeganavContentDevelopers.js +2 -1
- package/core/MeganavContentDevelopers.js.map +1 -0
- package/core/MeganavContentProducts.js +2 -1
- package/core/MeganavContentProducts.js.map +1 -0
- package/core/MeganavContentUseCases.js +2 -1
- package/core/MeganavContentUseCases.js.map +1 -0
- package/core/MeganavControl/component.js +2 -1
- package/core/MeganavControl/component.js.map +1 -0
- package/core/MeganavControl.js +2 -1
- package/core/MeganavControl.js.map +1 -0
- package/core/MeganavControlMobileDropdown/component.js +2 -1
- package/core/MeganavControlMobileDropdown/component.js.map +1 -0
- package/core/MeganavControlMobileDropdown.js +2 -1
- package/core/MeganavControlMobileDropdown.js.map +1 -0
- package/core/MeganavControlMobilePanelClose/component.js +2 -1
- package/core/MeganavControlMobilePanelClose/component.js.map +1 -0
- package/core/MeganavControlMobilePanelClose.js +2 -1
- package/core/MeganavControlMobilePanelClose.js.map +1 -0
- package/core/MeganavControlMobilePanelOpen/component.js +2 -1
- package/core/MeganavControlMobilePanelOpen/component.js.map +1 -0
- package/core/MeganavControlMobilePanelOpen.js +2 -1
- package/core/MeganavControlMobilePanelOpen.js.map +1 -0
- package/core/MeganavItemsDesktop.js +2 -1
- package/core/MeganavItemsDesktop.js.map +1 -0
- package/core/MeganavItemsMobile.js +2 -1
- package/core/MeganavItemsMobile.js.map +1 -0
- package/core/MeganavItemsSignedIn.js +2 -1
- package/core/MeganavItemsSignedIn.js.map +1 -0
- package/core/MeganavSearch.js +2 -1
- package/core/MeganavSearch.js.map +1 -0
- package/core/MeganavSearchAutocomplete/component.js +2 -1
- package/core/MeganavSearchAutocomplete/component.js.map +1 -0
- package/core/MeganavSearchAutocomplete.js +2 -1
- package/core/MeganavSearchAutocomplete.js.map +1 -0
- package/core/MeganavSearchPanel.js +2 -1
- package/core/MeganavSearchPanel.js.map +1 -0
- package/core/MeganavSearchSuggestions/component.js +2 -1
- package/core/MeganavSearchSuggestions/component.js.map +1 -0
- package/core/MeganavSearchSuggestions.js +2 -1
- package/core/MeganavSearchSuggestions.js.map +1 -0
- package/core/Notice/component.js +2 -1
- package/core/Notice/component.js.map +1 -0
- package/core/Notice.js +2 -1
- package/core/Notice.js.map +1 -0
- package/core/Pricing/PricingCards.js +2 -1
- package/core/Pricing/PricingCards.js.map +1 -0
- package/core/Pricing/data.js +2 -1
- package/core/Pricing/data.js.map +1 -0
- package/core/Pricing/types.js +2 -1
- package/core/Pricing/types.js.map +1 -0
- package/core/ProductTile/ProductDescription.js +2 -1
- package/core/ProductTile/ProductDescription.js.map +1 -0
- package/core/ProductTile/ProductIcon.js +2 -1
- package/core/ProductTile/ProductIcon.js.map +1 -0
- package/core/ProductTile/ProductLabel.js +2 -1
- package/core/ProductTile/ProductLabel.js.map +1 -0
- package/core/ProductTile/data.js +2 -1
- package/core/ProductTile/data.js.map +1 -0
- package/core/ProductTile.js +2 -1
- package/core/ProductTile.js.map +1 -0
- package/core/SignOutLink.js +2 -1
- package/core/SignOutLink.js.map +1 -0
- package/core/Slider/component.js +2 -1
- package/core/Slider/component.js.map +1 -0
- package/core/Slider.js +2 -1
- package/core/Slider.js.map +1 -0
- package/core/Status.js +2 -1
- package/core/Status.js.map +1 -0
- package/core/TabMenu.js +2 -1
- package/core/TabMenu.js.map +1 -0
- package/core/Table/Table.js +2 -1
- package/core/Table/Table.js.map +1 -0
- package/core/Table/TableCell.js +2 -1
- package/core/Table/TableCell.js.map +1 -0
- package/core/Table/TableRow.js +2 -1
- package/core/Table/TableRow.js.map +1 -0
- package/core/Table/data.js +2 -1
- package/core/Table/data.js.map +1 -0
- package/core/Table.js +2 -1
- package/core/Table.js.map +1 -0
- package/core/Toggle.js +2 -1
- package/core/Toggle.js.map +1 -0
- package/core/Tooltip.js +2 -1
- package/core/Tooltip.js.map +1 -0
- package/core/css.js +2 -1
- package/core/css.js.map +1 -0
- package/core/dom-query.js +2 -1
- package/core/dom-query.js.map +1 -0
- package/core/hubspot-chat-toggle.js +2 -1
- package/core/hubspot-chat-toggle.js.map +1 -0
- package/core/icons.js +2 -1
- package/core/icons.js.map +1 -0
- package/core/insights/index.js +2 -0
- package/core/insights/index.js.map +1 -0
- package/core/insights/mixpanel.js +2 -0
- package/core/insights/mixpanel.js.map +1 -0
- package/core/insights/posthog.js +2 -0
- package/core/insights/posthog.js.map +1 -0
- package/core/load-sprites.js +2 -1
- package/core/load-sprites.js.map +1 -0
- package/core/react-renderer.js +2 -1
- package/core/react-renderer.js.map +1 -0
- package/core/remote-blogs-posts.js +2 -1
- package/core/remote-blogs-posts.js.map +1 -0
- package/core/remote-data-store.js +2 -1
- package/core/remote-data-store.js.map +1 -0
- package/core/remote-data-util.js +2 -1
- package/core/remote-data-util.js.map +1 -0
- package/core/remote-session-data.js +2 -1
- package/core/remote-session-data.js.map +1 -0
- package/core/scripts.js +2 -1
- package/core/scripts.js.map +1 -0
- package/core/styles/colors/computed-colors.json +1 -0
- package/core/styles/colors/types.js +2 -1
- package/core/styles/colors/types.js.map +1 -0
- package/core/styles/colors/utils.js +2 -1
- package/core/styles/colors/utils.js.map +1 -0
- package/core/styles/forms/story-components.js +2 -1
- package/core/styles/forms/story-components.js.map +1 -0
- package/core/url-base.js +2 -1
- package/core/url-base.js.map +1 -0
- package/core/utils/cn.js +2 -1
- package/core/utils/cn.js.map +1 -0
- package/core/utils/heights.js +2 -1
- package/core/utils/heights.js.map +1 -0
- package/core/utils/syntax-highlighter-registry.js +2 -1
- package/core/utils/syntax-highlighter-registry.js.map +1 -0
- package/core/utils/syntax-highlighter.js +2 -1
- package/core/utils/syntax-highlighter.js.map +1 -0
- package/package.json +8 -2
- package/reset/scripts.js +2 -1
- package/reset/scripts.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/MeganavSearchSuggestions/component.js"],"sourcesContent":["import { queryId } from \"../dom-query\";\n\nconst DRAG_BUFFER = 5;\n\nconst getTranslateX = (node) =>\n new DOMMatrix(window.getComputedStyle(node).transform).e;\n\nconst updateTranslateX = (node, value) =>\n (node.style.transform = `translateX(${value}px)`);\n\nconst dragLeftBoundary = (translateX, threshold) => translateX >= threshold;\n\nconst dragRightBoundary = (translateX, itemsWidth, windowWidth, threshold) =>\n Math.abs(translateX - windowWidth + threshold) > itemsWidth;\n\nconst getDistance = (e, touchStartX) =>\n e.changedTouches[0]?.clientX - touchStartX;\n\nconst withinBuffer = (distance) => Math.abs(distance) < DRAG_BUFFER;\n\nconst getItemsTotalWidth = (nodes) =>\n nodes\n .map((item) => item.getBoundingClientRect().width)\n .reduce((acc, val) => acc + val, 0);\n\nconst MeganavSearchSuggestions = () => {\n const suggestionsToggle = queryId(\"meganav-mobile-search-input\");\n const suggestions = queryId(\"meganav-mobile-search-suggestions\");\n const list = suggestions.querySelector(\"ul\");\n const listItems = Array.from(list.querySelectorAll(\"li\"));\n\n const dragLeft = (distance, threshold) => {\n const currentTranslateX = getTranslateX(list);\n const translateX = Math.round(currentTranslateX + distance);\n if (dragLeftBoundary(translateX, threshold)) return;\n updateTranslateX(list, translateX);\n };\n\n const dragLeftEnd = (distance, threshold) => {\n const currentTranslateX = getTranslateX(list);\n let translateX = Math.round(currentTranslateX + distance);\n\n if (dragLeftBoundary(translateX, threshold)) {\n translateX = 0;\n }\n\n updateTranslateX(list, translateX);\n };\n\n const dragRight = (distance, threshold) => {\n const listWidth = list.getBoundingClientRect().width;\n const currentTranslateX = getTranslateX(list);\n const translateX = Math.round(currentTranslateX + distance);\n const itemsTotalWidth = getItemsTotalWidth(listItems);\n\n if (dragRightBoundary(translateX, itemsTotalWidth, listWidth, threshold)) {\n return;\n }\n\n updateTranslateX(list, translateX);\n };\n\n const dragRightEnd = (distance, threshold) => {\n const listWidth = list.getBoundingClientRect().width;\n const currentTranslateX = getTranslateX(list);\n const itemsTotalWidth = getItemsTotalWidth(listItems);\n let translateX = Math.round(currentTranslateX + distance);\n\n if (dragRightBoundary(translateX, itemsTotalWidth, listWidth, threshold)) {\n translateX = -(itemsTotalWidth - listWidth + threshold);\n }\n\n updateTranslateX(list, translateX);\n };\n\n let touchStartX;\n\n const touchstartHandler = (e) => {\n touchStartX = e.touches[0]?.clientX;\n };\n\n const touchmoveHandler = (e) => {\n const distance = getDistance(e, touchStartX);\n if (withinBuffer(distance)) return;\n distance > 0 ? dragLeft(distance, 24) : dragRight(distance, 96);\n };\n\n const touchendHandler = (e) => {\n const distance = getDistance(e, touchStartX);\n if (withinBuffer(distance)) return;\n distance > 0 ? dragLeftEnd(distance, 24) : dragRightEnd(distance, 48);\n };\n\n const focusSuggestionsHandler = () => {\n suggestions.classList.add(\"max-h-96\");\n };\n\n const blurSuggestionsHandler = (e) => {\n if (e.relatedTarget === suggestions.querySelectorAll(\"a\")[0]) {\n return;\n }\n suggestions.classList.remove(\"max-h-96\");\n };\n\n const wheelHandler = (e) => {\n const distance = e.deltaY * 4;\n if (withinBuffer(distance)) return;\n distance > 0 ? dragLeftEnd(distance, 24) : dragRightEnd(distance, 48);\n };\n\n suggestionsToggle?.addEventListener(\"focus\", focusSuggestionsHandler);\n suggestionsToggle?.addEventListener(\"blur\", blurSuggestionsHandler);\n suggestions.addEventListener(\"touchstart\", touchstartHandler);\n suggestions.addEventListener(\"touchmove\", touchmoveHandler);\n suggestions.addEventListener(\"touchend\", touchendHandler);\n suggestions.addEventListener(\"wheel\", wheelHandler);\n\n return {\n teardown: () => {\n suggestionsToggle?.removeEventListener(\"focus\", focusSuggestionsHandler);\n suggestionsToggle?.removeEventListener(\"blur\", blurSuggestionsHandler);\n suggestions.removeEventListener(\"touchstart\", touchstartHandler);\n suggestions.removeEventListener(\"touchmove\", touchmoveHandler);\n suggestions.removeEventListener(\"touchend\", touchendHandler);\n },\n clear: () => {\n suggestions.classList.remove(\"max-h-96\");\n list.style.transform = `translateX(0px)`;\n },\n };\n};\n\nexport default MeganavSearchSuggestions;\n"],"names":["queryId","DRAG_BUFFER","getTranslateX","node","DOMMatrix","window","getComputedStyle","transform","e","updateTranslateX","value","style","dragLeftBoundary","translateX","threshold","dragRightBoundary","itemsWidth","windowWidth","Math","abs","getDistance","touchStartX","changedTouches","clientX","withinBuffer","distance","getItemsTotalWidth","nodes","map","item","getBoundingClientRect","width","reduce","acc","val","MeganavSearchSuggestions","suggestionsToggle","suggestions","list","querySelector","listItems","Array","from","querySelectorAll","dragLeft","currentTranslateX","round","dragLeftEnd","dragRight","listWidth","itemsTotalWidth","dragRightEnd","touchstartHandler","touches","touchmoveHandler","touchendHandler","focusSuggestionsHandler","classList","add","blurSuggestionsHandler","relatedTarget","remove","wheelHandler","deltaY","addEventListener","teardown","removeEventListener","clear"],"mappings":"AAAA,OAASA,OAAO,KAAQ,cAAe,CAEvC,MAAMC,YAAc,EAEpB,MAAMC,cAAgB,AAACC,MACrB,IAAIC,UAAUC,OAAOC,gBAAgB,CAACH,MAAMI,SAAS,EAAEC,CAAC,CAE1D,MAAMC,iBAAmB,CAACN,KAAMO,QAC7BP,KAAKQ,KAAK,CAACJ,SAAS,CAAG,CAAC,WAAW,EAAEG,MAAM,GAAG,CAAC,CAElD,MAAME,iBAAmB,CAACC,WAAYC,YAAcD,YAAcC,UAElE,MAAMC,kBAAoB,CAACF,WAAYG,WAAYC,YAAaH,YAC9DI,KAAKC,GAAG,CAACN,WAAaI,YAAcH,WAAaE,WAEnD,MAAMI,YAAc,CAACZ,EAAGa,cACtBb,EAAEc,cAAc,CAAC,EAAE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AAY2B,gBAAgB,CAAC,YAAaV,kBAC1CjB,YAAY2B,gBAAgB,CAAC,WAAYT,iBACzClB,YAAY2B,gBAAgB,CAAC,QAASF,cAEtC,MAAO,CACLG,SAAU,KACR7B,mBAAmB8B,oBAAoB,QAASV,yBAChDpB,mBAAmB8B,oBAAoB,OAAQP,wBAC/CtB,YAAY6B,mBAAmB,CAAC,aAAcd,mBAC9Cf,YAAY6B,mBAAmB,CAAC,YAAaZ,kBAC7CjB,YAAY6B,mBAAmB,CAAC,WAAYX,gBAC9C,EACAY,MAAO,KACL9B,YAAYoB,SAAS,CAACI,MAAM,CAAC,WAC7BvB,CAAAA,KAAK3B,KAAK,CAACJ,SAAS,CAAG,CAAC,eAAe,CAAC,AAC1C,CACF,CACF,CAEA,gBAAe4B,wBAAyB"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import FeaturedLink from"./FeaturedLink";const MeganavSearchSuggestions=({absUrl,displaySupportLink})=>React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-overline2 text-cool-black py-12"},"Popular pages"),React.createElement("div",{className:"flex justify-between items-center overflow-hidden"},React.createElement("ul",{className:"flex transition-transform"},React.createElement("li",{className:"py-12 pr-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/how-ably-works"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"How does Ably work?")),React.createElement("li",{className:"py-12 px-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/quick-start-guide"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Quickstart guide")),React.createElement("li",{className:"py-12 px-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/core-features/pubsub"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Publish/Subscribe Messaging")),React.createElement("li",{className:"py-12 pl-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/platform"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Platform"))),displaySupportLink?React.createElement(FeaturedLink,{url:absUrl("/support"),textSize:"text-p2"},"Support"):null));export default MeganavSearchSuggestions;
|
|
1
|
+
import React from"react";import FeaturedLink from"./FeaturedLink";const MeganavSearchSuggestions=({absUrl,displaySupportLink})=>React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-overline2 text-cool-black py-12"},"Popular pages"),React.createElement("div",{className:"flex justify-between items-center overflow-hidden"},React.createElement("ul",{className:"flex transition-transform"},React.createElement("li",{className:"py-12 pr-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/how-ably-works"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"How does Ably work?")),React.createElement("li",{className:"py-12 px-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/quick-start-guide"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Quickstart guide")),React.createElement("li",{className:"py-12 px-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/docs/core-features/pubsub"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Publish/Subscribe Messaging")),React.createElement("li",{className:"py-12 pl-8 flex-shrink-0"},React.createElement("a",{href:absUrl("/platform"),className:"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus"},"Platform"))),displaySupportLink?React.createElement(FeaturedLink,{url:absUrl("/support"),textSize:"text-p2"},"Support"):null));export default MeganavSearchSuggestions;
|
|
2
|
+
//# sourceMappingURL=MeganavSearchSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/MeganavSearchSuggestions.tsx"],"sourcesContent":["import React from \"react\";\n\nimport FeaturedLink from \"./FeaturedLink\";\nimport { AbsUrl } from \"./Meganav\";\n\ntype MeganavSearchSuggestionsProps = {\n absUrl: AbsUrl;\n displaySupportLink: boolean;\n};\n\nconst MeganavSearchSuggestions = ({\n absUrl,\n displaySupportLink,\n}: MeganavSearchSuggestionsProps) => (\n <>\n <p className=\"ui-text-overline2 text-cool-black py-12\">Popular pages</p>\n\n <div className=\"flex justify-between items-center overflow-hidden\">\n <ul className=\"flex transition-transform\">\n <li className=\"py-12 pr-8 flex-shrink-0\">\n <a\n href={absUrl(\"/docs/how-ably-works\")}\n className=\"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus\"\n >\n How does Ably work?\n </a>\n </li>\n <li className=\"py-12 px-8 flex-shrink-0\">\n <a\n href={absUrl(\"/docs/quick-start-guide\")}\n className=\"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus\"\n >\n Quickstart guide\n </a>\n </li>\n <li className=\"py-12 px-8 flex-shrink-0\">\n <a\n href={absUrl(\"/docs/core-features/pubsub\")}\n className=\"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus\"\n >\n Publish/Subscribe Messaging\n </a>\n </li>\n <li className=\"py-12 pl-8 flex-shrink-0\">\n <a\n href={absUrl(\"/platform\")}\n className=\"ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus\"\n >\n Platform\n </a>\n </li>\n </ul>\n {displaySupportLink ? (\n <FeaturedLink url={absUrl(\"/support\")} textSize=\"text-p2\">\n Support\n </FeaturedLink>\n ) : null}\n </div>\n </>\n);\n\nexport default MeganavSearchSuggestions;\n"],"names":["React","FeaturedLink","MeganavSearchSuggestions","absUrl","displaySupportLink","p","className","div","ul","li","a","href","url","textSize"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAE1B,QAAOC,iBAAkB,gBAAiB,CAQ1C,MAAMC,yBAA2B,CAAC,CAChCC,MAAM,CACNC,kBAAkB,CACY,GAC9B,wCACE,oBAACC,KAAEC,UAAU,2CAA0C,iBAEvD,oBAACC,OAAID,UAAU,qDACb,oBAACE,MAAGF,UAAU,6BACZ,oBAACG,MAAGH,UAAU,4BACZ,oBAACI,KACCC,KAAMR,OAAO,wBACbG,UAAU,+EACX,wBAIH,oBAACG,MAAGH,UAAU,4BACZ,oBAACI,KACCC,KAAMR,OAAO,2BACbG,UAAU,+EACX,qBAIH,oBAACG,MAAGH,UAAU,4BACZ,oBAACI,KACCC,KAAMR,OAAO,8BACbG,UAAU,+EACX,gCAIH,oBAACG,MAAGH,UAAU,4BACZ,oBAACI,KACCC,KAAMR,OAAO,aACbG,UAAU,+EACX,cAKJF,mBACC,oBAACH,cAAaW,IAAKT,OAAO,YAAaU,SAAS,WAAU,WAGxD,MAKV,gBAAeX,wBAAyB"}
|
package/core/Notice/component.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import Cookie from"js-cookie";import throttle from"lodash.throttle";import{queryId}from"../dom-query";import{FLASH_DATA_ID}from"../Flash";const COOKIE_EXPIRY=90;const COLLAPSE_TRIGGER_DISTANCE=5;const SCROLL_LISTENER_THROTTLE=100;const RESIZE_LISTENER_THROTTLE=100;const isMdViewport=()=>!window.matchMedia(`(min-width: 65rem)`).matches;const adjustFlashMargin=open=>{const flash=queryId(FLASH_DATA_ID);if(flash){flash.style.marginTop=open?`4rem`:null}};const hideOnMobile=bannerContainer=>{if(isMdViewport()){bannerContainer.style.display="none"}else{bannerContainer.style.display=null}};const hideNotice=bannerContainer=>{bannerContainer.style.maxHeight=0;bannerContainer.style.overflow="hidden";adjustFlashMargin(false)};const showNotice=bannerContainer=>{bannerContainer.style.maxHeight=null;bannerContainer.style.overflow=null;adjustFlashMargin(true)};const setupRememberClosed=(cookieId,noticeId)=>{const cookie=Cookie.get(cookieId)||"";Cookie.set(cookieId,`${cookie.replace(`${noticeId},`,"")+noticeId},`,{expires:COOKIE_EXPIRY})};const hasBeenClosedBefore=(cookieId,noticeId)=>(Cookie.get(cookieId)||"").includes(noticeId);const setupNoticeCollapse=bannerContainer=>{const scrollTop=window.scrollY;if(scrollTop>COLLAPSE_TRIGGER_DISTANCE){hideNotice(bannerContainer)}const listener=throttle(()=>{const scrollTop=window.scrollY;if(scrollTop>COLLAPSE_TRIGGER_DISTANCE){hideNotice(bannerContainer)}else if(bannerContainer.style.overflow){showNotice(bannerContainer)}},SCROLL_LISTENER_THROTTLE);document.addEventListener("scroll",listener);return()=>document.removeEventListener("scroll",listener)};const setupCloseBtn=(bannerContainer,cookieId,noticeId,collapseUnmountListeners)=>{const closeBtn=bannerContainer.querySelector("button");if(!closeBtn)return()=>{};const listener=()=>{if(cookieId&¬iceId)setupRememberClosed(cookieId,noticeId);hideNotice(bannerContainer);collapseUnmountListeners()};closeBtn.addEventListener("click",listener);return()=>document.removeEventListener("click",listener)};const resizeHandler=bannerContainer=>{const handler=throttle(()=>{hideOnMobile(bannerContainer)},RESIZE_LISTENER_THROTTLE);window.addEventListener("resize",handler);return()=>window.removeEventListener("resize",handler)};const Notice=({bannerContainer,cookieId,noticeId,options})=>{if(typeof window==="undefined")return()=>{};if(!bannerContainer){console.warn("A Notice component was initited but no notice container was found.");return()=>{}}if(hasBeenClosedBefore(cookieId,noticeId))return()=>{};hideOnMobile(bannerContainer);showNotice(bannerContainer);const opts={collapse:true,...options};const collapseUnmountListeners=opts.collapse?setupNoticeCollapse(bannerContainer):()=>{};const closeBtnUnmountListeners=setupCloseBtn(bannerContainer,cookieId,noticeId,collapseUnmountListeners);const resizeUnmountListener=resizeHandler(bannerContainer);return()=>{[closeBtnUnmountListeners,collapseUnmountListeners,resizeUnmountListener].forEach(unmount=>unmount())}};export default Notice;
|
|
1
|
+
import Cookie from"js-cookie";import throttle from"lodash.throttle";import{queryId}from"../dom-query";import{FLASH_DATA_ID}from"../Flash";const COOKIE_EXPIRY=90;const COLLAPSE_TRIGGER_DISTANCE=5;const SCROLL_LISTENER_THROTTLE=100;const RESIZE_LISTENER_THROTTLE=100;const isMdViewport=()=>!window.matchMedia(`(min-width: 65rem)`).matches;const adjustFlashMargin=open=>{const flash=queryId(FLASH_DATA_ID);if(flash){flash.style.marginTop=open?`4rem`:null}};const hideOnMobile=bannerContainer=>{if(isMdViewport()){bannerContainer.style.display="none"}else{bannerContainer.style.display=null}};const hideNotice=bannerContainer=>{bannerContainer.style.maxHeight=0;bannerContainer.style.overflow="hidden";adjustFlashMargin(false)};const showNotice=bannerContainer=>{bannerContainer.style.maxHeight=null;bannerContainer.style.overflow=null;adjustFlashMargin(true)};const setupRememberClosed=(cookieId,noticeId)=>{const cookie=Cookie.get(cookieId)||"";Cookie.set(cookieId,`${cookie.replace(`${noticeId},`,"")+noticeId},`,{expires:COOKIE_EXPIRY})};const hasBeenClosedBefore=(cookieId,noticeId)=>(Cookie.get(cookieId)||"").includes(noticeId);const setupNoticeCollapse=bannerContainer=>{const scrollTop=window.scrollY;if(scrollTop>COLLAPSE_TRIGGER_DISTANCE){hideNotice(bannerContainer)}const listener=throttle(()=>{const scrollTop=window.scrollY;if(scrollTop>COLLAPSE_TRIGGER_DISTANCE){hideNotice(bannerContainer)}else if(bannerContainer.style.overflow){showNotice(bannerContainer)}},SCROLL_LISTENER_THROTTLE);document.addEventListener("scroll",listener);return()=>document.removeEventListener("scroll",listener)};const setupCloseBtn=(bannerContainer,cookieId,noticeId,collapseUnmountListeners)=>{const closeBtn=bannerContainer.querySelector("button");if(!closeBtn)return()=>{};const listener=()=>{if(cookieId&¬iceId)setupRememberClosed(cookieId,noticeId);hideNotice(bannerContainer);collapseUnmountListeners()};closeBtn.addEventListener("click",listener);return()=>document.removeEventListener("click",listener)};const resizeHandler=bannerContainer=>{const handler=throttle(()=>{hideOnMobile(bannerContainer)},RESIZE_LISTENER_THROTTLE);window.addEventListener("resize",handler);return()=>window.removeEventListener("resize",handler)};const Notice=({bannerContainer,cookieId,noticeId,options})=>{if(typeof window==="undefined")return()=>{};if(!bannerContainer){console.warn("A Notice component was initited but no notice container was found.");return()=>{}}if(hasBeenClosedBefore(cookieId,noticeId))return()=>{};hideOnMobile(bannerContainer);showNotice(bannerContainer);const opts={collapse:true,...options};const collapseUnmountListeners=opts.collapse?setupNoticeCollapse(bannerContainer):()=>{};const closeBtnUnmountListeners=setupCloseBtn(bannerContainer,cookieId,noticeId,collapseUnmountListeners);const resizeUnmountListener=resizeHandler(bannerContainer);return()=>{[closeBtnUnmountListeners,collapseUnmountListeners,resizeUnmountListener].forEach(unmount=>unmount())}};export default Notice;
|
|
2
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/Notice/component.js"],"sourcesContent":["import Cookie from \"js-cookie\";\nimport throttle from \"lodash.throttle\";\n\nimport { queryId } from \"../dom-query\";\nimport { FLASH_DATA_ID } from \"../Flash\";\n\nconst COOKIE_EXPIRY = 90;\nconst COLLAPSE_TRIGGER_DISTANCE = 5;\nconst SCROLL_LISTENER_THROTTLE = 100;\nconst RESIZE_LISTENER_THROTTLE = 100;\n\nconst isMdViewport = () => !window.matchMedia(`(min-width: 65rem)`).matches;\n\nconst adjustFlashMargin = (open) => {\n // HACK ALERT\n // Add margin to flashes when opening the notice.\n // Flashes are react components and this notice needs to work as a view-component and react component.\n // We could do this with redux but then we potentially update state on every scroll event, which\n // even with debounce will deplate our frame budget.\n\n const flash = queryId(FLASH_DATA_ID);\n\n if (flash) {\n flash.style.marginTop = open ? `4rem` : null;\n }\n};\n\nconst hideOnMobile = (bannerContainer) => {\n if (isMdViewport()) {\n bannerContainer.style.display = \"none\";\n } else {\n bannerContainer.style.display = null;\n }\n};\n\nconst hideNotice = (bannerContainer) => {\n bannerContainer.style.maxHeight = 0;\n bannerContainer.style.overflow = \"hidden\";\n\n adjustFlashMargin(false);\n};\n\nconst showNotice = (bannerContainer) => {\n bannerContainer.style.maxHeight = null;\n bannerContainer.style.overflow = null;\n\n adjustFlashMargin(true);\n};\n\nconst setupRememberClosed = (cookieId, noticeId) => {\n const cookie = Cookie.get(cookieId) || \"\";\n\n Cookie.set(cookieId, `${cookie.replace(`${noticeId},`, \"\") + noticeId},`, {\n expires: COOKIE_EXPIRY,\n });\n};\n\nconst hasBeenClosedBefore = (cookieId, noticeId) =>\n (Cookie.get(cookieId) || \"\").includes(noticeId);\n\nconst setupNoticeCollapse = (bannerContainer) => {\n const scrollTop = window.scrollY;\n\n if (scrollTop > COLLAPSE_TRIGGER_DISTANCE) {\n hideNotice(bannerContainer);\n }\n\n const listener = throttle(() => {\n const scrollTop = window.scrollY;\n\n if (scrollTop > COLLAPSE_TRIGGER_DISTANCE) {\n hideNotice(bannerContainer);\n } else if (bannerContainer.style.overflow) {\n showNotice(bannerContainer);\n }\n }, SCROLL_LISTENER_THROTTLE);\n\n document.addEventListener(\"scroll\", listener);\n\n return () => document.removeEventListener(\"scroll\", listener);\n};\n\nconst setupCloseBtn = (\n bannerContainer,\n cookieId,\n noticeId,\n collapseUnmountListeners,\n) => {\n const closeBtn = bannerContainer.querySelector(\"button\");\n\n if (!closeBtn) return () => {};\n\n const listener = () => {\n if (cookieId && noticeId) setupRememberClosed(cookieId, noticeId);\n\n hideNotice(bannerContainer);\n collapseUnmountListeners();\n };\n\n closeBtn.addEventListener(\"click\", listener);\n\n return () => document.removeEventListener(\"click\", listener);\n};\n\nconst resizeHandler = (bannerContainer) => {\n const handler = throttle(() => {\n hideOnMobile(bannerContainer);\n }, RESIZE_LISTENER_THROTTLE);\n\n window.addEventListener(\"resize\", handler);\n\n return () => window.removeEventListener(\"resize\", handler);\n};\n\nconst Notice = ({ bannerContainer, cookieId, noticeId, options }) => {\n if (typeof window === \"undefined\") return () => {};\n\n if (!bannerContainer) {\n console.warn(\n \"A Notice component was initited but no notice container was found.\",\n );\n return () => {};\n }\n\n if (hasBeenClosedBefore(cookieId, noticeId)) return () => {};\n\n hideOnMobile(bannerContainer);\n showNotice(bannerContainer);\n\n const opts = { collapse: true, ...options };\n\n const collapseUnmountListeners = opts.collapse\n ? setupNoticeCollapse(bannerContainer)\n : () => {};\n\n const closeBtnUnmountListeners = setupCloseBtn(\n bannerContainer,\n cookieId,\n noticeId,\n collapseUnmountListeners,\n );\n\n const resizeUnmountListener = resizeHandler(bannerContainer);\n\n return () => {\n [\n closeBtnUnmountListeners,\n collapseUnmountListeners,\n resizeUnmountListener,\n ].forEach((unmount) => unmount());\n };\n};\n\nexport default Notice;\n"],"names":["Cookie","throttle","queryId","FLASH_DATA_ID","COOKIE_EXPIRY","COLLAPSE_TRIGGER_DISTANCE","SCROLL_LISTENER_THROTTLE","RESIZE_LISTENER_THROTTLE","isMdViewport","window","matchMedia","matches","adjustFlashMargin","open","flash","style","marginTop","hideOnMobile","bannerContainer","display","hideNotice","maxHeight","overflow","showNotice","setupRememberClosed","cookieId","noticeId","cookie","get","set","replace","expires","hasBeenClosedBefore","includes","setupNoticeCollapse","scrollTop","scrollY","listener","document","addEventListener","removeEventListener","setupCloseBtn","collapseUnmountListeners","closeBtn","querySelector","resizeHandler","handler","Notice","options","console","warn","opts","collapse","closeBtnUnmountListeners","resizeUnmountListener","forEach","unmount"],"mappings":"AAAA,OAAOA,WAAY,WAAY,AAC/B,QAAOC,aAAc,iBAAkB,AAEvC,QAASC,OAAO,KAAQ,cAAe,AACvC,QAASC,aAAa,KAAQ,UAAW,CAEzC,MAAMC,cAAgB,GACtB,MAAMC,0BAA4B,EAClC,MAAMC,yBAA2B,IACjC,MAAMC,yBAA2B,IAEjC,MAAMC,aAAe,IAAM,CAACC,OAAOC,UAAU,CAAC,CAAC,kBAAkB,CAAC,EAAEC,OAAO,CAE3E,MAAMC,kBAAoB,AAACC,OAOzB,MAAMC,MAAQZ,QAAQC,eAEtB,GAAIW,MAAO,CACTA,MAAMC,KAAK,CAACC,SAAS,CAAGH,KAAO,CAAC,IAAI,CAAC,CAAG,IAC1C,CACF,EAEA,MAAMI,aAAe,AAACC,kBACpB,GAAIV,eAAgB,CAClBU,gBAAgBH,KAAK,CAACI,OAAO,CAAG,MAClC,KAAO,CACLD,gBAAgBH,KAAK,CAACI,OAAO,CAAG,IAClC,CACF,EAEA,MAAMC,WAAa,AAACF,kBAClBA,gBAAgBH,KAAK,CAACM,SAAS,CAAG,CAClCH,CAAAA,gBAAgBH,KAAK,CAACO,QAAQ,CAAG,SAEjCV,kBAAkB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AEA,MAAMQ,cAAgB,AAAC3B,kBACrB,MAAM4B,QAAU7C,SAAS,KACvBgB,aAAaC,gBACf,EAAGX,0BAEHE,OAAO8B,gBAAgB,CAAC,SAAUO,SAElC,MAAO,IAAMrC,OAAO+B,mBAAmB,CAAC,SAAUM,QACpD,EAEA,MAAMC,OAAS,CAAC,CAAE7B,eAAe,CAAEO,QAAQ,CAAEC,QAAQ,CAAEsB,OAAO,CAAE,IAC9D,GAAI,OAAOvC,SAAW,YAAa,MAAO,KAAO,EAEjD,GAAI,CAACS,gBAAiB,CACpB+B,QAAQC,IAAI,CACV,sEAEF,MAAO,KAAO,CAChB,CAEA,GAAIlB,oBAAoBP,SAAUC,UAAW,MAAO,KAAO,EAE3DT,aAAaC,iBACbK,WAAWL,iBAEX,MAAMiC,KAAO,CAAEC,SAAU,KAAM,GAAGJ,OAAO,AAAC,EAE1C,MAAMN,yBAA2BS,KAAKC,QAAQ,CAC1ClB,oBAAoBhB,iBACpB,KAAO,EAEX,MAAMmC,yBAA2BZ,cAC/BvB,gBACAO,SACAC,SACAgB,0BAGF,MAAMY,sBAAwBT,cAAc3B,iBAE5C,MAAO,KACL,CACEmC,yBACAX,yBACAY,sBACD,CAACC,OAAO,CAAC,AAACC,SAAYA,UACzB,CACF,CAEA,gBAAeT,MAAO"}
|
package/core/Notice.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React,{useEffect}from"react";import NoticeScripts from"./Notice/component.js";import Icon from"./Icon";const contentWrapperClasses="w-full pr-8 ui-text-p3 self-center";const ContentWrapper=({buttonLink,children})=>buttonLink?React.createElement("a",{href:buttonLink,className:contentWrapperClasses},children):React.createElement("div",{className:contentWrapperClasses},children);const Notice=({buttonLink,buttonLabel,bodyText,title,config,closeBtn,bgColor="bg-gradient-active-orange",textColor="text-white"})=>{useEffect(()=>{NoticeScripts({bannerContainer:document.querySelector('[data-id="ui-notice"]'),cookieId:config?.cookieId,noticeId:config?.noticeId,options:{collapse:config?.collapse||false}})},[]);const wrapperClasses=["ui-announcement",bgColor,textColor].join(" ");return React.createElement("div",{className:wrapperClasses,"data-id":"ui-notice",style:{maxHeight:0,overflow:"hidden"}},React.createElement("div",{className:"ui-grid-px py-16 max-w-screen-xl mx-auto flex items-start"},React.createElement(ContentWrapper,{buttonLink:buttonLink??"#"},React.createElement("strong",{className:"font-bold whitespace-nowrap pr-4"},title),React.createElement("span",{className:"pr-4"},bodyText),buttonLabel&&React.createElement("span",{className:"underline cursor-pointer whitespace-nowrap"},buttonLabel)),closeBtn&&React.createElement("button",{type:"button",className:"ml-auto h-20 w-20 border-none bg-none self-baseline"},React.createElement(Icon,{name:"icon-gui-x-mark-outline",size:"1.25rem",color:"text-cool-black"}))))};export default Notice;
|
|
1
|
+
import React,{useEffect}from"react";import NoticeScripts from"./Notice/component.js";import Icon from"./Icon";const contentWrapperClasses="w-full pr-8 ui-text-p3 self-center";const ContentWrapper=({buttonLink,children})=>buttonLink?React.createElement("a",{href:buttonLink,className:contentWrapperClasses},children):React.createElement("div",{className:contentWrapperClasses},children);const Notice=({buttonLink,buttonLabel,bodyText,title,config,closeBtn,bgColor="bg-gradient-active-orange",textColor="text-white"})=>{useEffect(()=>{NoticeScripts({bannerContainer:document.querySelector('[data-id="ui-notice"]'),cookieId:config?.cookieId,noticeId:config?.noticeId,options:{collapse:config?.collapse||false}})},[]);const wrapperClasses=["ui-announcement",bgColor,textColor].join(" ");return React.createElement("div",{className:wrapperClasses,"data-id":"ui-notice",style:{maxHeight:0,overflow:"hidden"}},React.createElement("div",{className:"ui-grid-px py-16 max-w-screen-xl mx-auto flex items-start"},React.createElement(ContentWrapper,{buttonLink:buttonLink??"#"},React.createElement("strong",{className:"font-bold whitespace-nowrap pr-4"},title),React.createElement("span",{className:"pr-4"},bodyText),buttonLabel&&React.createElement("span",{className:"underline cursor-pointer whitespace-nowrap"},buttonLabel)),closeBtn&&React.createElement("button",{type:"button",className:"ml-auto h-20 w-20 border-none bg-none self-baseline"},React.createElement(Icon,{name:"icon-gui-x-mark-outline",size:"1.25rem",color:"text-cool-black"}))))};export default Notice;
|
|
2
|
+
//# sourceMappingURL=Notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Notice.tsx"],"sourcesContent":["import React, { ReactNode, useEffect } from \"react\";\n\nimport NoticeScripts from \"./Notice/component.js\";\nimport Icon from \"./Icon\";\ntype ContentWrapperProps = {\n buttonLink: string;\n children: ReactNode;\n};\n\n// TODO(jamiehenson):\n// This type is a bit messed up currently due to the NoticeScripts import being interpreted as NoticeProps.\n// Plan is to TS-ify the JS assets too, so this can be rectified then. The NoticeScripts-oriented props are\n// the ones after the line break.\ntype NoticeProps = {\n buttonLink?: string;\n buttonLabel?: string;\n bodyText?: string;\n title?: string;\n closeBtn?: boolean;\n config?: {\n collapse: boolean;\n noticeId: string;\n cookieId: string;\n };\n bgColor?: string;\n textColor?: string;\n\n bannerContainer?: Element | null;\n cookieId?: string;\n noticeId?: string;\n options?: { collapse: boolean };\n};\n\nconst contentWrapperClasses = \"w-full pr-8 ui-text-p3 self-center\";\n\nconst ContentWrapper = ({ buttonLink, children }: ContentWrapperProps) =>\n buttonLink ? (\n <a href={buttonLink} className={contentWrapperClasses}>\n {children}\n </a>\n ) : (\n <div className={contentWrapperClasses}>{children}</div>\n );\n\nconst Notice = ({\n buttonLink,\n buttonLabel,\n bodyText,\n title,\n config,\n closeBtn,\n bgColor = \"bg-gradient-active-orange\",\n textColor = \"text-white\",\n}: NoticeProps) => {\n useEffect(() => {\n NoticeScripts({\n bannerContainer: document.querySelector('[data-id=\"ui-notice\"]'),\n cookieId: config?.cookieId,\n noticeId: config?.noticeId,\n options: {\n collapse: config?.collapse || false,\n },\n });\n }, []);\n\n const wrapperClasses = [\"ui-announcement\", bgColor, textColor].join(\" \");\n\n return (\n <div\n className={wrapperClasses}\n data-id=\"ui-notice\"\n style={{ maxHeight: 0, overflow: \"hidden\" }}\n >\n <div className=\"ui-grid-px py-16 max-w-screen-xl mx-auto flex items-start\">\n <ContentWrapper buttonLink={buttonLink ?? \"#\"}>\n <strong className=\"font-bold whitespace-nowrap pr-4\">{title}</strong>\n <span className=\"pr-4\">{bodyText}</span>\n {buttonLabel && (\n <span className=\"underline cursor-pointer whitespace-nowrap\">\n {buttonLabel}\n </span>\n )}\n </ContentWrapper>\n\n {closeBtn && (\n <button\n type=\"button\"\n className=\"ml-auto h-20 w-20 border-none bg-none self-baseline\"\n >\n <Icon\n name=\"icon-gui-x-mark-outline\"\n size=\"1.25rem\"\n color=\"text-cool-black\"\n />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default Notice;\n"],"names":["React","useEffect","NoticeScripts","Icon","contentWrapperClasses","ContentWrapper","buttonLink","children","a","href","className","div","Notice","buttonLabel","bodyText","title","config","closeBtn","bgColor","textColor","bannerContainer","document","querySelector","cookieId","noticeId","options","collapse","wrapperClasses","join","data-id","style","maxHeight","overflow","strong","span","button","type","name","size","color"],"mappings":"AAAA,OAAOA,OAAoBC,SAAS,KAAQ,OAAQ,AAEpD,QAAOC,kBAAmB,uBAAwB,AAClD,QAAOC,SAAU,QAAS,CA8B1B,MAAMC,sBAAwB,qCAE9B,MAAMC,eAAiB,CAAC,CAAEC,UAAU,CAAEC,QAAQ,CAAuB,GACnED,WACE,oBAACE,KAAEC,KAAMH,WAAYI,UAAWN,uBAC7BG,UAGH,oBAACI,OAAID,UAAWN,uBAAwBG,UAG5C,MAAMK,OAAS,CAAC,CACdN,UAAU,CACVO,WAAW,CACXC,QAAQ,CACRC,KAAK,CACLC,MAAM,CACNC,QAAQ,CACRC,QAAU,2BAA2B,CACrCC,UAAY,YAAY,CACZ,IACZlB,UAAU,KACRC,cAAc,CACZkB,gBAAiBC,SAASC,aAAa,CAAC,yBACxCC,SAAUP,QAAQO,SAClBC,SAAUR,QAAQQ,SAClBC,QAAS,CACPC,SAAUV,QAAQU,UAAY,KAChC,CACF,EACF,EAAG,EAAE,EAEL,MAAMC,eAAiB,CAAC,kBAAmBT,QAASC,UAAU,CAACS,IAAI,CAAC,KAEpE,OACE,oBAACjB,OACCD,UAAWiB,eACXE,UAAQ,YACRC,MAAO,CAAEC,UAAW,EAAGC,SAAU,QAAS,GAE1C,oBAACrB,OAAID,UAAU,6DACb,oBAACL,gBAAeC,WAAYA,YAAc,KACxC,oBAAC2B,UAAOvB,UAAU,oCAAoCK,OACtD,oBAACmB,QAAKxB,UAAU,QAAQI,UACvBD,aACC,oBAACqB,QAAKxB,UAAU,8CACbG,cAKNI,UACC,oBAACkB,UACCC,KAAK,SACL1B,UAAU,uDAEV,oBAACP,MACCkC,KAAK,0BACLC,KAAK,UACLC,MAAM,sBAOpB,CAEA,gBAAe3B,MAAO"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React,{Fragment,useEffect,useRef,useState}from"react";import throttle from"lodash.throttle";import Icon from"../Icon";import FeaturedLink from"../FeaturedLink";import LinkButton from"../LinkButton";import Tooltip from"../Tooltip";import cn from"../utils/cn";const PricingCards=({data,delimiter})=>{const descriptionsRef=useRef([]);const[descriptionHeight,setDescriptionHeight]=useState(0);const determineMaxDescriptionHeight=throttle(()=>{if(descriptionsRef.current.length){setDescriptionHeight(Math.max(...descriptionsRef.current.map(description=>description?.getBoundingClientRect().height??0)))}},100);useEffect(()=>{determineMaxDescriptionHeight();window.addEventListener("resize",determineMaxDescriptionHeight);return()=>{window.removeEventListener("resize",determineMaxDescriptionHeight);determineMaxDescriptionHeight.cancel()}},[]);const delimiterColumn=index=>delimiter&&index%2===1?React.createElement("div",{className:cn("flex items-center justify-center w-full @[920px]:w-20",{"m-8":delimiter!=="blank"})},delimiter!=="blank"?React.createElement(Icon,{name:delimiter,size:"20px",additionalCSS:"text-neutral-800 dark:text-neutral-500"}):null):null;const gridRules={nonDelimited:"grid @[552px]:grid-cols-2 @[1104px]:grid-cols-4",delimited:"flex flex-col items-center @[920px]:flex-row"};const borderClasses=color=>{const classes={neutral:{border:"border-neutral-600 dark:border-neutral-700",bg:"bg-neutral-600 dark:bg-neutral-700"},blue:{border:"border-blue-400 dark:border-blue-600",bg:"bg-blue-400 dark:bg-blue-600"},orange:{border:"border-orange-600 dark:border-orange-600",bg:"bg-orange-600 dark:bg-orange-600"}};if(color&&classes[color]){return classes[color]}};return React.createElement("div",{className:"@container flex justify-center","data-testid":delimiter?"delimited-pricing-card-group":"pricing-card-group"},React.createElement("div",{className:cn("gap-8",delimiter?gridRules.delimited:gridRules.nonDelimited)},data.map(({title,description,price,cta,sections,border},index)=>React.createElement(Fragment,{key:title.content},delimiterColumn(index),React.createElement("div",{className:cn("relative border flex-1 px-24 py-32 flex flex-col gap-24 rounded-2xl group min-w-[272px] backdrop-blur",borderClasses(border?.color)?.border??"border-neutral-200 dark:border-neutral-1100",border?.style,{"@[520px]:flex-row @[920px]:flex-col":delimiter}),"data-testid":delimiter?"delimited-pricing-card":"pricing-card"},border?React.createElement("div",{className:cn("flex items-center absolute z-10 -top-12 self-center font-semibold uppercase text-neutral-000 font-sans h-24 text-[11px] px-[10px] py-2 rounded-2xl select-none tracking-widen-0.1",borderClasses(border?.color)?.border,borderClasses(border?.color)?.bg)},border.text):null,React.createElement("div",{className:cn("absolute z-0 top-0 left-0 w-full h-full rounded-2xl bg-neutral-000 dark:bg-neutral-1300 transition-[colors,opacity] opacity-25",{"group-hover:bg-neutral-100 dark:group-hover:bg-neutral-1200 group-hover:opacity-100":!delimiter})}),React.createElement("div",{className:cn(`relative z-10 flex flex-col gap-24`,{"@[520px]:flex-1 @[920px]:flex-none":delimiter})},React.createElement("div",null,React.createElement("div",{className:"flex items-center mb-12"},React.createElement("p",{className:cn(title.className,title.color)},title.content),title.tooltip?React.createElement(Tooltip,{interactive:typeof title.tooltip!=="string"},title.tooltip):null),React.createElement("p",{className:cn("ui-text-p1 min-h-[20px]",description.className,description.color),style:{height:descriptionHeight}},React.createElement("span",{ref:el=>descriptionsRef.current[index]=el},description.content))),React.createElement("div",{className:cn("flex items-end gap-8",{"@[520px]:flex-col @[520px]:items-start @[920px]:flex-row @[920px]:items-end":delimiter})},React.createElement("p",{className:"ui-text-title font-medium tracking-tight leading-none text-neutral-1300 dark:text-neutral-000"},price.amount),React.createElement("div",{className:"ui-text-p3 text-neutral-1300 dark:text-neutral-000"},price.content)),cta?React.createElement("div",{className:"group"},React.createElement(LinkButton,{className:cn("w-full",cta.className),variant:cta.url==="/contact"?"priority":"primary",href:cta.url,onClick:cta.onClick,disabled:cta.disabled,rightIcon:"icon-gui-arrow-long-right-outline",iconColor:cta.iconColor},cta.text)):delimiter?null:React.createElement("div",{className:"flex items-center justify-center h-48 w-full"},React.createElement("hr",{className:"border-neutral-500 dark:border-neutral-800 w-64"}))),React.createElement("div",{className:"flex-1 flex flex-col gap-24 relative z-10"},sections.map(({title,items,listItemColors,cta})=>React.createElement("div",{key:title,className:"flex flex-col gap-12"},React.createElement("p",{className:"text-neutral-800 dark:text-neutral-500 font-mono uppercase text-overline2 tracking-[0.16em]"},title),React.createElement("div",{className:cn({"flex flex-col gap-4":!delimiter})},items.map((item,index)=>Array.isArray(item)?React.createElement("div",{key:item[0],className:cn("flex justify-between gap-16 px-8 -mx-8",index===0?"py-8":"py-4",index>0&&index%2===0?"bg-blue-100 dark:bg-blue-900 rounded-md":"")},item.map((subItem,subIndex)=>React.createElement("span",{key:subItem,className:cn("ui-text-p3",index===0?"font-bold":"font-medium","text-neutral-1000 dark:text-neutral-300",subIndex%2===1?"text-right":"")},subItem))):React.createElement("div",{key:item,className:"flex gap-8 items-start"},listItemColors?React.createElement(Icon,{name:"icon-gui-check-circled-fill",color:listItemColors.background,secondaryColor:listItemColors.foreground,size:"16px",additionalCSS:"mt-2"}):null,React.createElement("div",{className:cn(`flex-1 font-medium text-neutral-1000 dark:text-neutral-300`,listItemColors?"ui-text-p3":"ui-text-p2")},item)))),cta?React.createElement("div",{className:"relative -mx-24 flex items-center h-40 overflow-x-hidden"},React.createElement(FeaturedLink,{url:cta.url,additionalCSS:"absolute translate-x-24 sm:-translate-x-[120px] sm:opacity-0 sm:group-hover:translate-x-24 duration-300 delay-0 sm:group-hover:delay-100 sm:group-hover:opacity-100 transition-[transform,opacity] font-medium ui-text-p3 dark:text-neutral-500 dark:hover:text-neutral-000 cursor-pointer",onClick:cta.onClick,iconColor:listItemColors?.foreground},cta.text),React.createElement("div",{className:"absolute hidden sm:block sm:translate-x-24 sm:opacity-100 sm:group-hover:translate-x-[120px] sm:group-hover:opacity-0 duration-200 delay-100 sm:group-hover:delay-0 transition-[transform,opacity] leading-6 tracking-widen-0.15 font-light text-p3 text-neutral-500 dark:text-neutral-800"},"•••")):null)))),delimiterColumn(index)))))};export default PricingCards;
|
|
1
|
+
import React,{Fragment,useEffect,useRef,useState}from"react";import throttle from"lodash.throttle";import Icon from"../Icon";import FeaturedLink from"../FeaturedLink";import LinkButton from"../LinkButton";import Tooltip from"../Tooltip";import cn from"../utils/cn";const PricingCards=({data,delimiter})=>{const descriptionsRef=useRef([]);const[descriptionHeight,setDescriptionHeight]=useState(0);const determineMaxDescriptionHeight=throttle(()=>{if(descriptionsRef.current.length){setDescriptionHeight(Math.max(...descriptionsRef.current.map(description=>description?.getBoundingClientRect().height??0)))}},100);useEffect(()=>{determineMaxDescriptionHeight();window.addEventListener("resize",determineMaxDescriptionHeight);return()=>{window.removeEventListener("resize",determineMaxDescriptionHeight);determineMaxDescriptionHeight.cancel()}},[]);const delimiterColumn=index=>delimiter&&index%2===1?React.createElement("div",{className:cn("flex items-center justify-center w-full @[920px]:w-20",{"m-8":delimiter!=="blank"})},delimiter!=="blank"?React.createElement(Icon,{name:delimiter,size:"20px",additionalCSS:"text-neutral-800 dark:text-neutral-500"}):null):null;const gridRules={nonDelimited:"grid @[552px]:grid-cols-2 @[1104px]:grid-cols-4",delimited:"flex flex-col items-center @[920px]:flex-row"};const borderClasses=color=>{const classes={neutral:{border:"border-neutral-600 dark:border-neutral-700",bg:"bg-neutral-600 dark:bg-neutral-700"},blue:{border:"border-blue-400 dark:border-blue-600",bg:"bg-blue-400 dark:bg-blue-600"},orange:{border:"border-orange-600 dark:border-orange-600",bg:"bg-orange-600 dark:bg-orange-600"}};if(color&&classes[color]){return classes[color]}};return React.createElement("div",{className:"@container flex justify-center","data-testid":delimiter?"delimited-pricing-card-group":"pricing-card-group"},React.createElement("div",{className:cn("gap-8",delimiter?gridRules.delimited:gridRules.nonDelimited)},data.map(({title,description,price,cta,sections,border},index)=>React.createElement(Fragment,{key:title.content},delimiterColumn(index),React.createElement("div",{className:cn("relative border flex-1 px-24 py-32 flex flex-col gap-24 rounded-2xl group min-w-[272px] backdrop-blur",borderClasses(border?.color)?.border??"border-neutral-200 dark:border-neutral-1100",border?.style,{"@[520px]:flex-row @[920px]:flex-col":delimiter}),"data-testid":delimiter?"delimited-pricing-card":"pricing-card"},border?React.createElement("div",{className:cn("flex items-center absolute z-10 -top-12 self-center font-semibold uppercase text-neutral-000 font-sans h-24 text-[11px] px-[10px] py-2 rounded-2xl select-none tracking-widen-0.1",borderClasses(border?.color)?.border,borderClasses(border?.color)?.bg)},border.text):null,React.createElement("div",{className:cn("absolute z-0 top-0 left-0 w-full h-full rounded-2xl bg-neutral-000 dark:bg-neutral-1300 transition-[colors,opacity] opacity-25",{"group-hover:bg-neutral-100 dark:group-hover:bg-neutral-1200 group-hover:opacity-100":!delimiter})}),React.createElement("div",{className:cn(`relative z-10 flex flex-col gap-24`,{"@[520px]:flex-1 @[920px]:flex-none":delimiter})},React.createElement("div",null,React.createElement("div",{className:"flex items-center mb-12"},React.createElement("p",{className:cn(title.className,title.color)},title.content),title.tooltip?React.createElement(Tooltip,{interactive:typeof title.tooltip!=="string"},title.tooltip):null),React.createElement("p",{className:cn("ui-text-p1 min-h-[20px]",description.className,description.color),style:{height:descriptionHeight}},React.createElement("span",{ref:el=>descriptionsRef.current[index]=el},description.content))),React.createElement("div",{className:cn("flex items-end gap-8",{"@[520px]:flex-col @[520px]:items-start @[920px]:flex-row @[920px]:items-end":delimiter})},React.createElement("p",{className:"ui-text-title font-medium tracking-tight leading-none text-neutral-1300 dark:text-neutral-000"},price.amount),React.createElement("div",{className:"ui-text-p3 text-neutral-1300 dark:text-neutral-000"},price.content)),cta?React.createElement("div",{className:"group"},React.createElement(LinkButton,{className:cn("w-full",cta.className),variant:cta.url==="/contact"?"priority":"primary",href:cta.url,onClick:cta.onClick,disabled:cta.disabled,rightIcon:"icon-gui-arrow-long-right-outline",iconColor:cta.iconColor},cta.text)):delimiter?null:React.createElement("div",{className:"flex items-center justify-center h-48 w-full"},React.createElement("hr",{className:"border-neutral-500 dark:border-neutral-800 w-64"}))),React.createElement("div",{className:"flex-1 flex flex-col gap-24 relative z-10"},sections.map(({title,items,listItemColors,cta})=>React.createElement("div",{key:title,className:"flex flex-col gap-12"},React.createElement("p",{className:"text-neutral-800 dark:text-neutral-500 font-mono uppercase text-overline2 tracking-[0.16em]"},title),React.createElement("div",{className:cn({"flex flex-col gap-4":!delimiter})},items.map((item,index)=>Array.isArray(item)?React.createElement("div",{key:item[0],className:cn("flex justify-between gap-16 px-8 -mx-8",index===0?"py-8":"py-4",index>0&&index%2===0?"bg-blue-100 dark:bg-blue-900 rounded-md":"")},item.map((subItem,subIndex)=>React.createElement("span",{key:subItem,className:cn("ui-text-p3",index===0?"font-bold":"font-medium","text-neutral-1000 dark:text-neutral-300",subIndex%2===1?"text-right":"")},subItem))):React.createElement("div",{key:item,className:"flex gap-8 items-start"},listItemColors?React.createElement(Icon,{name:"icon-gui-check-circled-fill",color:listItemColors.background,secondaryColor:listItemColors.foreground,size:"16px",additionalCSS:"mt-2"}):null,React.createElement("div",{className:cn(`flex-1 font-medium text-neutral-1000 dark:text-neutral-300`,listItemColors?"ui-text-p3":"ui-text-p2")},item)))),cta?React.createElement("div",{className:"relative -mx-24 flex items-center h-40 overflow-x-hidden"},React.createElement(FeaturedLink,{url:cta.url,additionalCSS:"absolute translate-x-24 sm:-translate-x-[120px] sm:opacity-0 sm:group-hover:translate-x-24 duration-300 delay-0 sm:group-hover:delay-100 sm:group-hover:opacity-100 transition-[transform,opacity] font-medium ui-text-p3 dark:text-neutral-500 dark:hover:text-neutral-000 cursor-pointer",onClick:cta.onClick,iconColor:listItemColors?.foreground},cta.text),React.createElement("div",{className:"absolute hidden sm:block sm:translate-x-24 sm:opacity-100 sm:group-hover:translate-x-[120px] sm:group-hover:opacity-0 duration-200 delay-100 sm:group-hover:delay-0 transition-[transform,opacity] leading-6 tracking-widen-0.15 font-light text-p3 text-neutral-500 dark:text-neutral-800"},"•••")):null)))),delimiterColumn(index)))))};export default PricingCards;
|
|
2
|
+
//# sourceMappingURL=PricingCards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/Pricing/PricingCards.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useState } from \"react\";\nimport throttle from \"lodash.throttle\";\nimport type { PricingDataFeature } from \"./types\";\nimport Icon from \"../Icon\";\nimport FeaturedLink from \"../FeaturedLink\";\nimport LinkButton from \"../LinkButton\";\nimport { IconName } from \"../Icon/types\";\nimport Tooltip from \"../Tooltip\";\nimport cn from \"../utils/cn\";\n\nexport type PricingCardsProps = {\n data: PricingDataFeature[];\n delimiter?: IconName | \"blank\";\n};\n\nconst PricingCards = ({ data, delimiter }: PricingCardsProps) => {\n const descriptionsRef = useRef<(HTMLSpanElement | null)[]>([]);\n const [descriptionHeight, setDescriptionHeight] = useState<number>(0);\n\n const determineMaxDescriptionHeight = throttle(() => {\n if (descriptionsRef.current.length) {\n setDescriptionHeight(\n Math.max(\n ...descriptionsRef.current.map(\n (description) => description?.getBoundingClientRect().height ?? 0,\n ),\n ),\n );\n }\n }, 100);\n\n useEffect(() => {\n determineMaxDescriptionHeight();\n\n window.addEventListener(\"resize\", determineMaxDescriptionHeight);\n\n return () => {\n window.removeEventListener(\"resize\", determineMaxDescriptionHeight);\n determineMaxDescriptionHeight.cancel();\n };\n }, []);\n\n const delimiterColumn = (index: number) =>\n delimiter && index % 2 === 1 ? (\n <div\n className={cn(\"flex items-center justify-center w-full @[920px]:w-20\", {\n \"m-8\": delimiter !== \"blank\",\n })}\n >\n {delimiter !== \"blank\" ? (\n <Icon\n name={delimiter}\n size=\"20px\"\n additionalCSS={\"text-neutral-800 dark:text-neutral-500\"}\n />\n ) : null}\n </div>\n ) : null;\n\n const gridRules = {\n nonDelimited: \"grid @[552px]:grid-cols-2 @[1104px]:grid-cols-4\",\n delimited: \"flex flex-col items-center @[920px]:flex-row\",\n };\n\n const borderClasses = (color?: \"neutral\" | \"blue\" | \"orange\") => {\n const classes: Record<\n string,\n {\n border: string;\n bg: string;\n }\n > = {\n neutral: {\n border: \"border-neutral-600 dark:border-neutral-700\",\n bg: \"bg-neutral-600 dark:bg-neutral-700\",\n },\n blue: {\n border: \"border-blue-400 dark:border-blue-600\",\n bg: \"bg-blue-400 dark:bg-blue-600\",\n },\n orange: {\n border: \"border-orange-600 dark:border-orange-600\",\n bg: \"bg-orange-600 dark:bg-orange-600\",\n },\n };\n\n if (color && classes[color]) {\n return classes[color];\n }\n };\n\n return (\n <div\n className=\"@container flex justify-center\"\n data-testid={\n delimiter ? \"delimited-pricing-card-group\" : \"pricing-card-group\"\n }\n >\n <div\n className={cn(\n \"gap-8\",\n delimiter ? gridRules.delimited : gridRules.nonDelimited,\n )}\n >\n {data.map(\n ({ title, description, price, cta, sections, border }, index) => (\n <Fragment key={title.content}>\n {delimiterColumn(index)}\n <div\n className={cn(\n \"relative border flex-1 px-24 py-32 flex flex-col gap-24 rounded-2xl group min-w-[272px] backdrop-blur\",\n borderClasses(border?.color)?.border ??\n \"border-neutral-200 dark:border-neutral-1100\",\n border?.style,\n { \"@[520px]:flex-row @[920px]:flex-col\": delimiter },\n )}\n data-testid={\n delimiter ? \"delimited-pricing-card\" : \"pricing-card\"\n }\n >\n {border ? (\n <div\n className={cn(\n \"flex items-center absolute z-10 -top-12 self-center font-semibold uppercase text-neutral-000 font-sans h-24 text-[11px] px-[10px] py-2 rounded-2xl select-none tracking-widen-0.1\",\n borderClasses(border?.color)?.border,\n borderClasses(border?.color)?.bg,\n )}\n >\n {border.text}\n </div>\n ) : null}\n <div\n className={cn(\n \"absolute z-0 top-0 left-0 w-full h-full rounded-2xl bg-neutral-000 dark:bg-neutral-1300 transition-[colors,opacity] opacity-25\",\n {\n \"group-hover:bg-neutral-100 dark:group-hover:bg-neutral-1200 group-hover:opacity-100\":\n !delimiter,\n },\n )}\n ></div>\n <div\n className={cn(`relative z-10 flex flex-col gap-24`, {\n \"@[520px]:flex-1 @[920px]:flex-none\": delimiter,\n })}\n >\n <div>\n <div className=\"flex items-center mb-12\">\n <p className={cn(title.className, title.color)}>\n {title.content}\n </p>\n {title.tooltip ? (\n <Tooltip\n interactive={typeof title.tooltip !== \"string\"}\n >\n {title.tooltip}\n </Tooltip>\n ) : null}\n </div>\n <p\n className={cn(\n \"ui-text-p1 min-h-[20px]\",\n description.className,\n description.color,\n )}\n style={{ height: descriptionHeight }}\n >\n <span ref={(el) => (descriptionsRef.current[index] = el)}>\n {description.content}\n </span>\n </p>\n </div>\n <div\n className={cn(\"flex items-end gap-8\", {\n \"@[520px]:flex-col @[520px]:items-start @[920px]:flex-row @[920px]:items-end\":\n delimiter,\n })}\n >\n <p className=\"ui-text-title font-medium tracking-tight leading-none text-neutral-1300 dark:text-neutral-000\">\n {price.amount}\n </p>\n <div className=\"ui-text-p3 text-neutral-1300 dark:text-neutral-000\">\n {price.content}\n </div>\n </div>\n {cta ? (\n <div className=\"group\">\n <LinkButton\n className={cn(\"w-full\", cta.className)}\n variant={\n cta.url === \"/contact\" ? \"priority\" : \"primary\"\n }\n href={cta.url}\n onClick={cta.onClick}\n disabled={cta.disabled}\n rightIcon=\"icon-gui-arrow-long-right-outline\"\n iconColor={cta.iconColor}\n >\n {cta.text}\n </LinkButton>\n </div>\n ) : delimiter ? null : (\n <div className=\"flex items-center justify-center h-48 w-full\">\n <hr className=\"border-neutral-500 dark:border-neutral-800 w-64\" />\n </div>\n )}\n </div>\n <div className=\"flex-1 flex flex-col gap-24 relative z-10\">\n {sections.map(({ title, items, listItemColors, cta }) => (\n <div key={title} className=\"flex flex-col gap-12\">\n <p className=\"text-neutral-800 dark:text-neutral-500 font-mono uppercase text-overline2 tracking-[0.16em]\">\n {title}\n </p>\n <div\n className={cn({ \"flex flex-col gap-4\": !delimiter })}\n >\n {items.map((item, index) =>\n Array.isArray(item) ? (\n <div\n key={item[0]}\n className={cn(\n \"flex justify-between gap-16 px-8 -mx-8\",\n index === 0 ? \"py-8\" : \"py-4\",\n index > 0 && index % 2 === 0\n ? \"bg-blue-100 dark:bg-blue-900 rounded-md\"\n : \"\",\n )}\n >\n {item.map((subItem, subIndex) => (\n <span\n key={subItem}\n className={cn(\n \"ui-text-p3\",\n index === 0 ? \"font-bold\" : \"font-medium\",\n \"text-neutral-1000 dark:text-neutral-300\",\n subIndex % 2 === 1 ? \"text-right\" : \"\",\n )}\n >\n {subItem}\n </span>\n ))}\n </div>\n ) : (\n <div key={item} className=\"flex gap-8 items-start\">\n {listItemColors ? (\n <Icon\n name=\"icon-gui-check-circled-fill\"\n color={listItemColors.background}\n secondaryColor={listItemColors.foreground}\n size=\"16px\"\n additionalCSS=\"mt-2\"\n />\n ) : null}\n <div\n className={cn(\n `flex-1 font-medium text-neutral-1000 dark:text-neutral-300`,\n listItemColors ? \"ui-text-p3\" : \"ui-text-p2\",\n )}\n >\n {item}\n </div>\n </div>\n ),\n )}\n </div>\n {cta ? (\n <div className=\"relative -mx-24 flex items-center h-40 overflow-x-hidden\">\n <FeaturedLink\n url={cta.url}\n additionalCSS=\"absolute translate-x-24 sm:-translate-x-[120px] sm:opacity-0 sm:group-hover:translate-x-24 duration-300 delay-0 sm:group-hover:delay-100 sm:group-hover:opacity-100 transition-[transform,opacity] font-medium ui-text-p3 dark:text-neutral-500 dark:hover:text-neutral-000 cursor-pointer\"\n onClick={cta.onClick}\n iconColor={listItemColors?.foreground}\n >\n {cta.text}\n </FeaturedLink>\n <div className=\"absolute hidden sm:block sm:translate-x-24 sm:opacity-100 sm:group-hover:translate-x-[120px] sm:group-hover:opacity-0 duration-200 delay-100 sm:group-hover:delay-0 transition-[transform,opacity] leading-6 tracking-widen-0.15 font-light text-p3 text-neutral-500 dark:text-neutral-800\">\n •••\n </div>\n </div>\n ) : null}\n </div>\n ))}\n </div>\n </div>\n {delimiterColumn(index)}\n </Fragment>\n ),\n )}\n </div>\n </div>\n );\n};\n\nexport default PricingCards;\n"],"names":["React","Fragment","useEffect","useRef","useState","throttle","Icon","FeaturedLink","LinkButton","Tooltip","cn","PricingCards","data","delimiter","descriptionsRef","descriptionHeight","setDescriptionHeight","determineMaxDescriptionHeight","current","length","Math","max","map","description","getBoundingClientRect","height","window","addEventListener","removeEventListener","cancel","delimiterColumn","index","div","className","name","size","additionalCSS","gridRules","nonDelimited","delimited","borderClasses","color","classes","neutral","border","bg","blue","orange","data-testid","title","price","cta","sections","key","content","style","text","p","tooltip","interactive","span","ref","el","amount","variant","url","href","onClick","disabled","rightIcon","iconColor","hr","items","listItemColors","item","Array","isArray","subItem","subIndex","background","secondaryColor","foreground"],"mappings":"AAAA,OAAOA,OAASC,QAAQ,CAAEC,SAAS,CAAEC,MAAM,CAAEC,QAAQ,KAAQ,OAAQ,AACrE,QAAOC,aAAc,iBAAkB,AAEvC,QAAOC,SAAU,SAAU,AAC3B,QAAOC,iBAAkB,iBAAkB,AAC3C,QAAOC,eAAgB,eAAgB,AAEvC,QAAOC,YAAa,YAAa,AACjC,QAAOC,OAAQ,aAAc,CAO7B,MAAMC,aAAe,CAAC,CAAEC,IAAI,CAAEC,SAAS,CAAqB,IAC1D,MAAMC,gBAAkBX,OAAmC,EAAE,EAC7D,KAAM,CAACY,kBAAmBC,qBAAqB,CAAGZ,SAAiB,GAEnE,MAAMa,8BAAgCZ,SAAS,KAC7C,GAAIS,gBAAgBI,OAAO,CAACC,MAAM,CAAE,CAClCH,qBACEI,KAAKC,GAAG,IACHP,gBAAgBI,OAAO,CAACI,GAAG,CAC5B,AAACC,aAAgBA,aAAaC,wB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title:{content:"Free",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-600 dark:text-neutral-700"},description:{content:"Build a proof of concept.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$0"},cta:{text:"Start for free",url:"/sign-up",iconColor:"text-neutral-600 dark:text-neutral-700"},sections:[{title:"Limits",items:["200 concurrent channels","200 concurrent connections","500 messages / second","6M messages / month"]},{title:"Includes",items:["Community & email support (best effort)","No commitment"],listItemColors:{foreground:"text-neutral-700 dark:text-neutral-600",background:"text-neutral-300 dark:text-neutral-1000"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Standard",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Roll-out into production.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$29",content:React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-p3 font-medium",style:{color:"currentColor"}},"/ month"),React.createElement("p",{className:"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6"},"+ consumption"))},cta:{text:"Get started",url:"/users/paid_sign_up?package=standard",iconColor:"text-gui-blue-default-dark dark:text-gui-blue-default-light"},sections:[{title:"Limits",items:["10k concurrent channels","10k concurrent connections","2.5k messages / second"]},{title:"Includes",items:["1 day email support SLA","Uptime SLO"],listItemColors:{foreground:"text-blue-600 dark:text-blue-400",background:"text-blue-200 dark:text-blue-800"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Pro",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Scale with confidence.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$399",content:React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-p3 font-medium",style:{color:"currentColor"}},"/ month"),React.createElement("p",{className:"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6"},"+ consumption"))},cta:{text:"Get started",url:"/users/paid_sign_up?package=pro",iconColor:"text-gui-blue-default-dark dark:text-gui-blue-default-light"},sections:[{title:"Limits",items:["50k concurrent channels","50k concurrent connections","10k messages / second"]},{title:"Includes",items:["2 hour support SLA","Datadog (lite)","Uptime SLO"],listItemColors:{foreground:"text-blue-600 dark:text-blue-400",background:"text-blue-200 dark:text-blue-800"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Enterprise",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-orange-600"},description:{content:"Deliver without limits.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"Custom"},cta:{text:"Contact us",url:"/contact"},sections:[{title:"Unlimited",items:["Concurrent channels","Concurrent connections","Messages / second"]},{title:"Includes",items:["24/7 mission critical support","99.999% uptime SLAs","Committed use discounts","Datadog","CNAME, SSO, & more"],listItemColors:{foreground:"text-orange-600 dark:text-orange-600",background:"text-orange-200 dark:text-orange-1000"},cta:{text:"See all features",url:"#pricing-table"}}]}];export const consumptionData=[{title:{content:"Messages",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Messages contain the data that a client is communicating, such as the contents of a chat message.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$2.50",content:"/ million"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million msgs"],["First 50 million msgs","$2.50"],["Next 450 million msgs","$2.25"],["Next 4.5 billion msgs","$1.95"],["Next 15 billion msgs","$1.65"],["Next 30 billion msgs","$1.40"],["Over 50 billion msgs","$1.25"]]}]},{title:{content:"Channels",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000",tooltip:React.createElement("p",null,"We charge you for the amount of time a channel is active in our network by the minute. For example, if ten channels are in use for 45 minutes, you will be charged a total of 450 channel minutes.")},description:{content:"Channels are used to route messages from publishers to subscribers. Channels are billed by the minute when actively being used by a connected client.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$1.00",content:"/ million mins"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million mins"],["First 10 million mins","$1.00"],["Next 90 million mins","$0.95"],["Next 900 million mins","$0.85"],["Next 4 billion mins","$0.75"],["Next 10 billion mins","$0.65"],["Over 15 billion mins","$0.60"]]}]},{title:{content:"Connections",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000",tooltip:React.createElement("p",null,"We charge you for the amount of time devices are connected to our network by the minute. For example, if ten devices are each connected for 45 minutes, you will be charged a total of 450 connection minutes.")},description:{content:"Clients establish and maintain a connection to the Ably service, typically over WebSockets.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$1.00",content:"/ million mins"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million mins"],["First 10 million mins","$1.00"],["Next 90 million mins","$0.95"],["Next 900 million mins","$0.85"],["Next 4 billion mins","$0.75"],["Next 10 billion mins","$0.65"],["Over 15 billion mins","$0.60"]]}]}];
|
|
1
|
+
import React from"react";export const planData=[{title:{content:"Free",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-600 dark:text-neutral-700"},description:{content:"Build a proof of concept.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$0"},cta:{text:"Start for free",url:"/sign-up",iconColor:"text-neutral-600 dark:text-neutral-700"},sections:[{title:"Limits",items:["200 concurrent channels","200 concurrent connections","500 messages / second","6M messages / month"]},{title:"Includes",items:["Community & email support (best effort)","No commitment"],listItemColors:{foreground:"text-neutral-700 dark:text-neutral-600",background:"text-neutral-300 dark:text-neutral-1000"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Standard",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Roll-out into production.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$29",content:React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-p3 font-medium",style:{color:"currentColor"}},"/ month"),React.createElement("p",{className:"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6"},"+ consumption"))},cta:{text:"Get started",url:"/users/paid_sign_up?package=standard",iconColor:"text-gui-blue-default-dark dark:text-gui-blue-default-light"},sections:[{title:"Limits",items:["10k concurrent channels","10k concurrent connections","2.5k messages / second"]},{title:"Includes",items:["1 day email support SLA","Uptime SLO"],listItemColors:{foreground:"text-blue-600 dark:text-blue-400",background:"text-blue-200 dark:text-blue-800"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Pro",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Scale with confidence.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"$399",content:React.createElement(React.Fragment,null,React.createElement("p",{className:"ui-text-p3 font-medium",style:{color:"currentColor"}},"/ month"),React.createElement("p",{className:"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6"},"+ consumption"))},cta:{text:"Get started",url:"/users/paid_sign_up?package=pro",iconColor:"text-gui-blue-default-dark dark:text-gui-blue-default-light"},sections:[{title:"Limits",items:["50k concurrent channels","50k concurrent connections","10k messages / second"]},{title:"Includes",items:["2 hour support SLA","Datadog (lite)","Uptime SLO"],listItemColors:{foreground:"text-blue-600 dark:text-blue-400",background:"text-blue-200 dark:text-blue-800"},cta:{text:"See all features",url:"#pricing-table"}}]},{title:{content:"Enterprise",className:"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]",color:"text-orange-600"},description:{content:"Deliver without limits.",className:"ui-text-p1",color:"text-neutral-800 dark:text-neutral-500"},price:{amount:"Custom"},cta:{text:"Contact us",url:"/contact"},sections:[{title:"Unlimited",items:["Concurrent channels","Concurrent connections","Messages / second"]},{title:"Includes",items:["24/7 mission critical support","99.999% uptime SLAs","Committed use discounts","Datadog","CNAME, SSO, & more"],listItemColors:{foreground:"text-orange-600 dark:text-orange-600",background:"text-orange-200 dark:text-orange-1000"},cta:{text:"See all features",url:"#pricing-table"}}]}];export const consumptionData=[{title:{content:"Messages",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000"},description:{content:"Messages contain the data that a client is communicating, such as the contents of a chat message.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$2.50",content:"/ million"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million msgs"],["First 50 million msgs","$2.50"],["Next 450 million msgs","$2.25"],["Next 4.5 billion msgs","$1.95"],["Next 15 billion msgs","$1.65"],["Next 30 billion msgs","$1.40"],["Over 50 billion msgs","$1.25"]]}]},{title:{content:"Channels",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000",tooltip:React.createElement("p",null,"We charge you for the amount of time a channel is active in our network by the minute. For example, if ten channels are in use for 45 minutes, you will be charged a total of 450 channel minutes.")},description:{content:"Channels are used to route messages from publishers to subscribers. Channels are billed by the minute when actively being used by a connected client.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$1.00",content:"/ million mins"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million mins"],["First 10 million mins","$1.00"],["Next 90 million mins","$0.95"],["Next 900 million mins","$0.85"],["Next 4 billion mins","$0.75"],["Next 10 billion mins","$0.65"],["Over 15 billion mins","$0.60"]]}]},{title:{content:"Connections",className:"ui-text-h3",color:"text-neutral-1300 dark:text-neutral-000",tooltip:React.createElement("p",null,"We charge you for the amount of time devices are connected to our network by the minute. For example, if ten devices are each connected for 45 minutes, you will be charged a total of 450 connection minutes.")},description:{content:"Clients establish and maintain a connection to the Ably service, typically over WebSockets.",className:"ui-text-p3",color:"text-neutral-700 dark:text-neutral-600"},price:{amount:"$1.00",content:"/ million mins"},sections:[{title:"Volume discounts",items:[["Consumption","$ / million mins"],["First 10 million mins","$1.00"],["Next 90 million mins","$0.95"],["Next 900 million mins","$0.85"],["Next 4 billion mins","$0.75"],["Next 10 billion mins","$0.65"],["Over 15 billion mins","$0.60"]]}]}];
|
|
2
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/Pricing/data.tsx"],"sourcesContent":["import React from \"react\";\nimport { PricingDataFeature } from \"./types\";\n\nexport const planData: PricingDataFeature[] = [\n {\n title: {\n content: \"Free\",\n className: \"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]\",\n color: \"text-neutral-600 dark:text-neutral-700\",\n },\n description: {\n content: \"Build a proof of concept.\",\n className: \"ui-text-p1\",\n color: \"text-neutral-800 dark:text-neutral-500\",\n },\n price: { amount: \"$0\" },\n cta: {\n text: \"Start for free\",\n url: \"/sign-up\",\n iconColor: \"text-neutral-600 dark:text-neutral-700\",\n },\n sections: [\n {\n title: \"Limits\",\n items: [\n \"200 concurrent channels\",\n \"200 concurrent connections\",\n \"500 messages / second\",\n \"6M messages / month\",\n ],\n },\n {\n title: \"Includes\",\n items: [\"Community & email support (best effort)\", \"No commitment\"],\n listItemColors: {\n foreground: \"text-neutral-700 dark:text-neutral-600\",\n background: \"text-neutral-300 dark:text-neutral-1000\",\n },\n cta: {\n text: \"See all features\",\n url: \"#pricing-table\",\n },\n },\n ],\n },\n {\n title: {\n content: \"Standard\",\n className: \"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]\",\n color: \"text-neutral-1300 dark:text-neutral-000\",\n },\n description: {\n content: \"Roll-out into production.\",\n className: \"ui-text-p1\",\n color: \"text-neutral-800 dark:text-neutral-500\",\n },\n price: {\n amount: \"$29\",\n content: (\n <>\n <p\n className=\"ui-text-p3 font-medium\"\n style={{ color: \"currentColor\" }}\n >\n / month\n </p>\n <p className=\"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6\">\n + consumption\n </p>\n </>\n ),\n },\n cta: {\n text: \"Get started\",\n url: \"/users/paid_sign_up?package=standard\",\n iconColor: \"text-gui-blue-default-dark dark:text-gui-blue-default-light\",\n },\n sections: [\n {\n title: \"Limits\",\n items: [\n \"10k concurrent channels\",\n \"10k concurrent connections\",\n \"2.5k messages / second\",\n ],\n },\n {\n title: \"Includes\",\n items: [\"1 day email support SLA\", \"Uptime SLO\"],\n listItemColors: {\n foreground: \"text-blue-600 dark:text-blue-400\",\n background: \"text-blue-200 dark:text-blue-800\",\n },\n cta: {\n text: \"See all features\",\n url: \"#pricing-table\",\n },\n },\n ],\n },\n {\n title: {\n content: \"Pro\",\n className: \"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]\",\n color: \"text-neutral-1300 dark:text-neutral-000\",\n },\n description: {\n content: \"Scale with confidence.\",\n className: \"ui-text-p1\",\n color: \"text-neutral-800 dark:text-neutral-500\",\n },\n price: {\n amount: \"$399\",\n content: (\n <>\n <p\n className=\"ui-text-p3 font-medium\"\n style={{ color: \"currentColor\" }}\n >\n / month\n </p>\n <p className=\"ui-text-p2 font-bold text-gui-blue-default-dark -mt-6\">\n + consumption\n </p>\n </>\n ),\n },\n cta: {\n text: \"Get started\",\n url: \"/users/paid_sign_up?package=pro\",\n iconColor: \"text-gui-blue-default-dark dark:text-gui-blue-default-light\",\n },\n sections: [\n {\n title: \"Limits\",\n items: [\n \"50k concurrent channels\",\n \"50k concurrent connections\",\n \"10k messages / second\",\n ],\n },\n {\n title: \"Includes\",\n items: [\"2 hour support SLA\", \"Datadog (lite)\", \"Uptime SLO\"],\n listItemColors: {\n foreground: \"text-blue-600 dark:text-blue-400\",\n background: \"text-blue-200 dark:text-blue-800\",\n },\n cta: {\n text: \"See all features\",\n url: \"#pricing-table\",\n },\n },\n ],\n },\n\n {\n title: {\n content: \"Enterprise\",\n className: \"font-mono text-p3 uppercase font-extrabold tracking-[0.16em]\",\n color: \"text-orange-600\",\n },\n description: {\n content: \"Deliver without limits.\",\n className: \"ui-text-p1\",\n color: \"text-neutral-800 dark:text-neutral-500\",\n },\n price: { amount: \"Custom\" },\n cta: {\n text: \"Contact us\",\n url: \"/contact\",\n },\n sections: [\n {\n title: \"Unlimited\",\n items: [\n \"Concurrent channels\",\n \"Concurrent connections\",\n \"Messages / second\",\n ],\n },\n {\n title: \"Includes\",\n items: [\n \"24/7 mission critical support\",\n \"99.999% uptime SLAs\",\n \"Committed use discounts\",\n \"Datadog\",\n \"CNAME, SSO, & more\",\n ],\n listItemColors: {\n foreground: \"text-orange-600 dark:text-orange-600\",\n background: \"text-orange-200 dark:text-orange-1000\",\n },\n cta: {\n text: \"See all features\",\n url: \"#pricing-table\",\n },\n },\n ],\n },\n];\n\nexport const consumptionData: PricingDataFeature[] = [\n {\n title: {\n content: \"Messages\",\n className: \"ui-text-h3\",\n color: \"text-neutral-1300 dark:text-neutral-000\",\n },\n description: {\n content:\n \"Messages contain the data that a client is communicating, such as the contents of a chat message.\",\n className: \"ui-text-p3\",\n color: \"text-neutral-700 dark:text-neutral-600\",\n },\n price: { amount: \"$2.50\", content: \"/ million\" },\n sections: [\n {\n title: \"Volume discounts\",\n items: [\n [\"Consumption\", \"$ / million msgs\"],\n [\"First 50 million msgs\", \"$2.50\"],\n [\"Next 450 million msgs\", \"$2.25\"],\n [\"Next 4.5 billion msgs\", \"$1.95\"],\n [\"Next 15 billion msgs\", \"$1.65\"],\n [\"Next 30 billion msgs\", \"$1.40\"],\n [\"Over 50 billion msgs\", \"$1.25\"],\n ],\n },\n ],\n },\n {\n title: {\n content: \"Channels\",\n className: \"ui-text-h3\",\n color: \"text-neutral-1300 dark:text-neutral-000\",\n tooltip: (\n <p>\n We charge you for the amount of time a channel is active in our\n network by the minute. For example, if ten channels are in use for 45\n minutes, you will be charged a total of 450 channel minutes.\n </p>\n ),\n },\n description: {\n content:\n \"Channels are used to route messages from publishers to subscribers. Channels are billed by the minute when actively being used by a connected client.\",\n className: \"ui-text-p3\",\n color: \"text-neutral-700 dark:text-neutral-600\",\n },\n price: { amount: \"$1.00\", content: \"/ million mins\" },\n sections: [\n {\n title: \"Volume discounts\",\n items: [\n [\"Consumption\", \"$ / million mins\"],\n [\"First 10 million mins\", \"$1.00\"],\n [\"Next 90 million mins\", \"$0.95\"],\n [\"Next 900 million mins\", \"$0.85\"],\n [\"Next 4 billion mins\", \"$0.75\"],\n [\"Next 10 billion mins\", \"$0.65\"],\n [\"Over 15 billion mins\", \"$0.60\"],\n ],\n },\n ],\n },\n {\n title: {\n content: \"Connections\",\n className: \"ui-text-h3\",\n color: \"text-neutral-1300 dark:text-neutral-000\",\n tooltip: (\n <p>\n We charge you for the amount of time devices are connected to our\n network by the minute. For example, if ten devices are each connected\n for 45 minutes, you will be charged a total of 450 connection minutes.\n </p>\n ),\n },\n description: {\n content:\n \"Clients establish and maintain a connection to the Ably service, typically over WebSockets.\",\n className: \"ui-text-p3\",\n color: \"text-neutral-700 dark:text-neutral-600\",\n },\n price: { amount: \"$1.00\", content: \"/ million mins\" },\n sections: [\n {\n title: \"Volume discounts\",\n items: [\n [\"Consumption\", \"$ / million mins\"],\n [\"First 10 million mins\", \"$1.00\"],\n [\"Next 90 million mins\", \"$0.95\"],\n [\"Next 900 million mins\", \"$0.85\"],\n [\"Next 4 billion mins\", \"$0.75\"],\n [\"Next 10 billion mins\", \"$0.65\"],\n [\"Over 15 billion mins\", \"$0.60\"],\n ],\n },\n ],\n },\n];\n"],"names":["React","planData","title","content","className","color","description","price","amount","cta","text","url","iconColor","sections","items","listItemColors","foreground","background","p","style","consumptionData","tooltip"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAG1B,QAAO,MAAMC,SAAiC,CAC5C,CACEC,MAAO,CACLC,QAAS,OACTC,UAAW,+DACXC,MAAO,wCACT,EACAC,YAAa,CACXH,QAAS,4BACTC,UAAW,aACXC,MAAO,wCACT,EACAE,MAAO,CAAEC,OAAQ,IAAK,EACtBC,IAAK,CACHC,KAAM,iBACNC,IAAK,WACLC,UAAW,wCACb,EACAC,SAAU,CACR,CACEX,MAAO,SACPY,MAAO,CACL,0BACA,6BACA,wBACA,sBACD,AACH,EACA,CACEZ,MAAO,WACPY,MAAO,CAAC,0CAA2C,gBAAgB,CACnEC,eAAgB,CACdC,WAAY,yCACZC,WAAY,yCACd,EACAR,IAAK,CACHC,KAAM,mBACNC,IAAK,gBACP,CACF,EACD,AACH,EACA,CACET,MAAO,CACLC,QAAS,WACTC,UAAW,+DACXC,MAAO,yCACT,EACAC,YAAa,CACXH,QAAS,4BACTC,UAAW,aACXC,MAAO,wCACT,EACAE,MAAO,CACLC,OAAQ,MACRL,QACE,wCACE,oBAACe,KACCd,UAAU,yBACVe,MAAO,CAAEd,MAAO,cAAe,GAChC,WAGD,oBAACa,KAAEd,UAAU,yDAAwD,iBAK3E,EACAK,IAAK,CACHC,KAAM,cACNC,IAAK,uCACLC,UAAW,6DACb,EACAC,SAAU,CACR,CACEX,MAAO,SACPY,MAAO,CACL,0BACA,6BACA,yBACD,AACH,EACA,CACEZ,MAAO,WACPY,MAAO,CAAC,0BAA2B,aAAa,CAChDC,eAAgB,CACdC,WAAY,mCACZC,WAAY,kCACd,EACAR,IAAK,CACHC,KAAM,mBACNC,IAAK,gBACP,CACF,EACD,AACH,EACA,CACET,MAAO,CACLC,QAAS,MACTC,UAAW,+DACXC,MAAO,yCACT,EACAC,YAAa,CACXH,QAAS,yBACTC,UAAW,aACXC,MAAO,wCACT,EACAE,MAAO,CACLC,OAAQ,OACRL,QACE,wCACE,oBAACe,KACCd,UAAU,yBACVe,MAAO,CAAEd,MAAO,cAAe,GAChC,WAGD,oBAACa,KAAEd,UAAU,yDAAwD,iBAK3E,EACAK,IAAK,CACHC,KAAM,cACNC,IAAK,kCACLC,UAAW,6DACb,EACAC,SAAU,CACR,CACEX,MAAO,SACPY,MAAO,CACL,0BACA,6BACA,wBACD,AACH,EACA,CACEZ,MAAO,WACPY,MAAO,CAAC,qBAAsB,iBAAkB,aAAa,CAC7DC,eAAgB,CACdC,WAAY,mCACZC,WAAY,kCACd,EACAR,IAAK,CACHC,KAAM,mBACNC,IAAK,gBACP,CACF,EACD,AACH,EAEA,CACET,MAAO,CACLC,QAAS,aACTC,UAAW,+DACXC,MAAO,iBACT,EACAC,YAAa,CACXH,Q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ACH,EACD,AACH,EACA,CACEZ,MAAO,CACLC,QAAS,cACTC,UAAW,aACXC,MAAO,0CACPgB,QACE,oBAACH,SAAE,iNAMP,EACAZ,YAAa,CACXH,QACE,8FACFC,UAAW,aACXC,MAAO,wCACT,EACAE,MAAO,CAAEC,OAAQ,QAASL,QAAS,gBAAiB,EACpDU,SAAU,CACR,CACEX,MAAO,mBACPY,MAAO,CACL,CAAC,cAAe,mBAAmB,CACnC,CAAC,wBAAyB,QAAQ,CAClC,CAAC,uBAAwB,QAAQ,CACjC,CAAC,wBAAyB,QAAQ,CAClC,CAAC,sBAAuB,QAAQ,CAChC,CAAC,uBAAwB,QAAQ,CACjC,CAAC,uBAAwB,QAAQ,CAClC,AACH,EACD,AACH,EACD,AAAC"}
|
package/core/Pricing/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export{};
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/Pricing/types.ts"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { ColorClass, ColorThemeSet } from \"../styles/colors/types\";\n\ntype PricingDataHeader = {\n content: string;\n className?: string;\n color?: ColorClass | ColorThemeSet;\n tooltip?: string | ReactNode;\n};\n\ntype PricingDataFeatureCta = {\n text: string;\n url: string;\n className?: string;\n disabled?: boolean;\n onClick?: () => void;\n iconColor?: ColorClass | ColorThemeSet;\n};\n\nexport type PricingDataFeatureSection = {\n title: string;\n items: string[] | string[][];\n listItemColors?: { foreground: ColorThemeSet; background: ColorThemeSet };\n cta?: PricingDataFeatureCta;\n};\n\nexport type PricingDataFeatureBorder = {\n text: string;\n style: \"border-solid\" | \"border-dashed\" | \"border-dotted\";\n color: \"neutral\" | \"blue\" | \"orange\";\n};\n\nexport type PricingDataFeature = {\n title: PricingDataHeader;\n description: PricingDataHeader;\n price: { amount: string; content?: ReactNode };\n cta?: PricingDataFeatureCta;\n sections: PricingDataFeatureSection[];\n border?: PricingDataFeatureBorder;\n};\n"],"names":[],"mappings":"AAgCA,QAOE"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import cn from"../utils/cn";const ProductDescription=({description,selected,unavailable,showDescription=true})=>{if(!description||!showDescription){return null}return React.createElement("p",{className:cn("ui-text-p3 font-medium leading-snug",{"text-neutral-300 dark:text-neutral-1000":selected&&!unavailable},{"text-neutral-700 dark:text-neutral-600":!selected})},description)};export default ProductDescription;
|
|
1
|
+
import React from"react";import cn from"../utils/cn";const ProductDescription=({description,selected,unavailable,showDescription=true})=>{if(!description||!showDescription){return null}return React.createElement("p",{className:cn("ui-text-p3 font-medium leading-snug",{"text-neutral-300 dark:text-neutral-1000":selected&&!unavailable},{"text-neutral-700 dark:text-neutral-600":!selected})},description)};export default ProductDescription;
|
|
2
|
+
//# sourceMappingURL=ProductDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/ProductTile/ProductDescription.tsx"],"sourcesContent":["import React from \"react\";\nimport cn from \"../utils/cn\";\n\ntype ProductDescriptionProps = {\n description: string;\n selected?: boolean;\n unavailable: boolean;\n showDescription?: boolean;\n};\n\nconst ProductDescription = ({\n description,\n selected,\n unavailable,\n showDescription = true,\n}: ProductDescriptionProps) => {\n if (!description || !showDescription) {\n return null;\n }\n\n return (\n <p\n className={cn(\n \"ui-text-p3 font-medium leading-snug\",\n {\n \"text-neutral-300 dark:text-neutral-1000\": selected && !unavailable,\n },\n { \"text-neutral-700 dark:text-neutral-600\": !selected },\n )}\n >\n {description}\n </p>\n );\n};\n\nexport default ProductDescription;\n"],"names":["React","cn","ProductDescription","description","selected","unavailable","showDescription","p","className"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,OAAQ,aAAc,CAS7B,MAAMC,mBAAqB,CAAC,CAC1BC,WAAW,CACXC,QAAQ,CACRC,WAAW,CACXC,gBAAkB,IAAI,CACE,IACxB,GAAI,CAACH,aAAe,CAACG,gBAAiB,CACpC,OAAO,IACT,CAEA,OACE,oBAACC,KACCC,UAAWP,GACT,sCACA,CACE,0CAA2CG,UAAY,CAACC,WAC1D,EACA,CAAE,yCAA0C,CAACD,QAAS,IAGvDD,YAGP,CAEA,gBAAeD,kBAAmB"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import Icon from"../Icon";import cn from"../utils/cn";const ProductIcon=({name,hoverName,selected,size,unavailable})=>{if(!name){return null}const innerSize=size-2;const iconSize=size/6*4;return React.createElement("div",{className:cn("p-1 bg-gradient-to-b",{"from-neutral-1000 to-neutral-1300 dark:from-neutral-000 dark:to-neutral-300":selected,"from-neutral-000 to-neutral-300 dark:from-neutral-1000 dark:to-neutral-1300":!selected}),style:{width:size,height:size,borderRadius:size/4}},React.createElement("div",{className:cn("flex items-center justify-center",{"bg-neutral-1200 dark:bg-neutral-100":selected,"bg-neutral-100 dark:bg-neutral-1200":!selected,"group-hover/product-tile:bg-neutral-000 dark:group-hover/product-tile:bg-neutral-1300":selected===false&&!unavailable}),style:{height:innerSize,borderRadius:size/4}},hoverName?React.createElement(Icon,{name:hoverName,size:`${iconSize}px`,additionalCSS:cn({"hidden group-hover/product-tile:flex":!selected,flex:selected})}):null,React.createElement(Icon,{name:name,size:`${iconSize}px`,additionalCSS:cn({"text-neutral-000 dark:text-neutral-1300":selected&&!unavailable,"text-neutral-1300 dark:text-neutral-000":!selected&&!unavailable,"text-neutral-700 dark:text-neutral-600":selected&&unavailable,"text-neutral-600 dark:text-neutral-700":!selected&&unavailable,"flex group-hover/product-tile:hidden":hoverName&&!selected,hidden:hoverName&&selected})})))};export default ProductIcon;
|
|
1
|
+
import React from"react";import Icon from"../Icon";import cn from"../utils/cn";const ProductIcon=({name,hoverName,selected,size,unavailable})=>{if(!name){return null}const innerSize=size-2;const iconSize=size/6*4;return React.createElement("div",{className:cn("p-1 bg-gradient-to-b",{"from-neutral-1000 to-neutral-1300 dark:from-neutral-000 dark:to-neutral-300":selected,"from-neutral-000 to-neutral-300 dark:from-neutral-1000 dark:to-neutral-1300":!selected}),style:{width:size,height:size,borderRadius:size/4}},React.createElement("div",{className:cn("flex items-center justify-center",{"bg-neutral-1200 dark:bg-neutral-100":selected,"bg-neutral-100 dark:bg-neutral-1200":!selected,"group-hover/product-tile:bg-neutral-000 dark:group-hover/product-tile:bg-neutral-1300":selected===false&&!unavailable}),style:{height:innerSize,borderRadius:size/4}},hoverName?React.createElement(Icon,{name:hoverName,size:`${iconSize}px`,additionalCSS:cn({"hidden group-hover/product-tile:flex":!selected,flex:selected})}):null,React.createElement(Icon,{name:name,size:`${iconSize}px`,additionalCSS:cn({"text-neutral-000 dark:text-neutral-1300":selected&&!unavailable,"text-neutral-1300 dark:text-neutral-000":!selected&&!unavailable,"text-neutral-700 dark:text-neutral-600":selected&&unavailable,"text-neutral-600 dark:text-neutral-700":!selected&&unavailable,"flex group-hover/product-tile:hidden":hoverName&&!selected,hidden:hoverName&&selected})})))};export default ProductIcon;
|
|
2
|
+
//# sourceMappingURL=ProductIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/ProductTile/ProductIcon.tsx"],"sourcesContent":["import React from \"react\";\nimport Icon from \"../Icon\";\nimport { IconName } from \"../Icon/types\";\nimport cn from \"../utils/cn\";\n\ntype ProductIconProps = {\n name?: IconName;\n hoverName?: IconName;\n selected?: boolean;\n size: number;\n unavailable: boolean;\n};\n\nconst ProductIcon = ({\n name,\n hoverName,\n selected,\n size,\n unavailable,\n}: ProductIconProps) => {\n if (!name) {\n return null;\n }\n\n // Inner container is 2px smaller to account for 1px padding on each side\n const innerSize = size - 2;\n\n // Padding around the icon is 1/4 the icon's size, so the icon is 4 of 6 parts\n const iconSize = (size / 6) * 4;\n\n return (\n // Outer container, contains the gradient stroke (since we can't natively have CSS gradient strokes)\n <div\n className={cn(\"p-1 bg-gradient-to-b\", {\n \"from-neutral-1000 to-neutral-1300 dark:from-neutral-000 dark:to-neutral-300\":\n selected,\n \"from-neutral-000 to-neutral-300 dark:from-neutral-1000 dark:to-neutral-1300\":\n !selected,\n })}\n style={{ width: size, height: size, borderRadius: size / 4 }}\n >\n {/* Inner container, contains the foreground container element */}\n <div\n className={cn(\"flex items-center justify-center\", {\n \"bg-neutral-1200 dark:bg-neutral-100\": selected,\n \"bg-neutral-100 dark:bg-neutral-1200\": !selected,\n \"group-hover/product-tile:bg-neutral-000 dark:group-hover/product-tile:bg-neutral-1300\":\n selected === false && !unavailable,\n })}\n style={{ height: innerSize, borderRadius: size / 4 }}\n >\n {/* The product icons themselves */}\n {hoverName ? (\n <Icon\n name={hoverName}\n size={`${iconSize}px`}\n additionalCSS={cn({\n \"hidden group-hover/product-tile:flex\": !selected,\n flex: selected,\n })}\n />\n ) : null}\n <Icon\n name={name}\n size={`${iconSize}px`}\n additionalCSS={cn({\n \"text-neutral-000 dark:text-neutral-1300\": selected && !unavailable,\n \"text-neutral-1300 dark:text-neutral-000\":\n !selected && !unavailable,\n \"text-neutral-700 dark:text-neutral-600\": selected && unavailable,\n \"text-neutral-600 dark:text-neutral-700\": !selected && unavailable,\n \"flex group-hover/product-tile:hidden\": hoverName && !selected,\n hidden: hoverName && selected,\n })}\n />\n </div>\n </div>\n );\n};\n\nexport default ProductIcon;\n"],"names":["React","Icon","cn","ProductIcon","name","hoverName","selected","size","unavailable","innerSize","iconSize","div","className","style","width","height","borderRadius","additionalCSS","flex","hidden"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,SAAU,SAAU,AAE3B,QAAOC,OAAQ,aAAc,CAU7B,MAAMC,YAAc,CAAC,CACnBC,IAAI,CACJC,SAAS,CACTC,QAAQ,CACRC,IAAI,CACJC,WAAW,CACM,IACjB,GAAI,CAACJ,KAAM,CACT,OAAO,IACT,CAGA,MAAMK,UAAYF,KAAO,EAGzB,MAAMG,SAAW,AAACH,KAAO,EAAK,EAE9B,OAEE,oBAACI,OACCC,UAAWV,GAAG,uBAAwB,CACpC,8EACEI,SACF,8EACE,CAACA,QACL,GACAO,MAAO,CAAEC,MAAOP,KAAMQ,OAAQR,KAAMS,aAAcT,KAAO,CAAE,GAG3D,oBAACI,OACCC,UAAWV,GAAG,mCAAoC,CAChD,sCAAuCI,SACvC,sCAAuC,CAACA,SACxC,wFACEA,WAAa,OAAS,CAACE,WAC3B,GACAK,MAAO,CAAEE,OAAQN,UAAWO,aAAcT,KAAO,CAAE,GAGlDF,UACC,oBAACJ,MACCG,KAAMC,UACNE,KAAM,CAAC,EAAEG,SAAS,EAAE,CAAC,CACrBO,cAAef,GAAG,CAChB,uCAAwC,CAACI,SACzCY,KAAMZ,QACR,KAEA,KACJ,oBAACL,MACCG,KAAMA,KACNG,KAAM,CAAC,EAAEG,SAAS,EAAE,CAAC,CACrBO,cAAef,GAAG,CAChB,0CAA2CI,UAAY,CAACE,YACxD,0CACE,CAACF,UAAY,CAACE,YAChB,yCAA0CF,UAAYE,YACtD,yCAA0C,CAACF,UAAYE,YACvD,uCAAwCH,WAAa,CAACC,SACtDa,OAAQd,WAAaC,QACvB,MAKV,CAEA,gBAAeH,WAAY"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import cn from"../utils/cn";const LABEL_FONT_SIZE_RATIO=4;const DESCRIPTION_FONT_SIZE_RATIO=2.6;const ProductLabel=({label,unavailable,selected,numericalSize,showLabel})=>{if(!label||!showLabel){return null}const dynamicFontSize=numericalSize/LABEL_FONT_SIZE_RATIO;return React.createElement("div",{className:"flex flex-col justify-center"},unavailable?React.createElement("div",null,React.createElement("div",{className:"table-cell font-sans bg-neutral-300 dark:bg-neutral-1000 rounded-full text-gui-unavailable tracking-widen-0.04 font-bold leading-snug",style:{fontSize:dynamicFontSize*.6,padding:`${dynamicFontSize*.25}px ${dynamicFontSize*.5}px`}},"COMING SOON")):React.createElement("p",{className:cn("font-bold uppercase ui-text-p2 leading-snug",{"text-neutral-500 dark:text-neutral-700":selected},{"text-neutral-700 dark:text-neutral-500":!selected}),style:{fontSize:dynamicFontSize,letterSpacing:"0.06em"}},"Ably"),React.createElement("p",{className:cn("ui-text-p2 font-bold",{"text-neutral-000 dark:text-neutral-1300":selected===true&&!unavailable},{"text-neutral-1000 dark:text-neutral-300":selected===false&&!unavailable},{"text-neutral-1300 dark:text-neutral-000":selected===undefined&&!unavailable},{"text-neutral-700 dark:text-neutral-600":unavailable},{"mt-[-3px]":!unavailable}),style:{fontSize:numericalSize/DESCRIPTION_FONT_SIZE_RATIO}},label))};export default ProductLabel;
|
|
1
|
+
import React from"react";import cn from"../utils/cn";const LABEL_FONT_SIZE_RATIO=4;const DESCRIPTION_FONT_SIZE_RATIO=2.6;const ProductLabel=({label,unavailable,selected,numericalSize,showLabel})=>{if(!label||!showLabel){return null}const dynamicFontSize=numericalSize/LABEL_FONT_SIZE_RATIO;return React.createElement("div",{className:"flex flex-col justify-center"},unavailable?React.createElement("div",null,React.createElement("div",{className:"table-cell font-sans bg-neutral-300 dark:bg-neutral-1000 rounded-full text-gui-unavailable tracking-widen-0.04 font-bold leading-snug",style:{fontSize:dynamicFontSize*.6,padding:`${dynamicFontSize*.25}px ${dynamicFontSize*.5}px`}},"COMING SOON")):React.createElement("p",{className:cn("font-bold uppercase ui-text-p2 leading-snug",{"text-neutral-500 dark:text-neutral-700":selected},{"text-neutral-700 dark:text-neutral-500":!selected}),style:{fontSize:dynamicFontSize,letterSpacing:"0.06em"}},"Ably"),React.createElement("p",{className:cn("ui-text-p2 font-bold",{"text-neutral-000 dark:text-neutral-1300":selected===true&&!unavailable},{"text-neutral-1000 dark:text-neutral-300":selected===false&&!unavailable},{"text-neutral-1300 dark:text-neutral-000":selected===undefined&&!unavailable},{"text-neutral-700 dark:text-neutral-600":unavailable},{"mt-[-3px]":!unavailable}),style:{fontSize:numericalSize/DESCRIPTION_FONT_SIZE_RATIO}},label))};export default ProductLabel;
|
|
2
|
+
//# sourceMappingURL=ProductLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/ProductTile/ProductLabel.tsx"],"sourcesContent":["import React from \"react\";\nimport cn from \"../utils/cn\";\n\ntype ProductLabelProps = {\n label: string;\n unavailable: boolean;\n selected?: boolean;\n numericalSize: number;\n showLabel?: boolean;\n};\n\nconst LABEL_FONT_SIZE_RATIO = 4;\nconst DESCRIPTION_FONT_SIZE_RATIO = 2.6;\n\nconst ProductLabel = ({\n label,\n unavailable,\n selected,\n numericalSize,\n showLabel,\n}: ProductLabelProps) => {\n if (!label || !showLabel) {\n return null;\n }\n\n const dynamicFontSize = numericalSize / LABEL_FONT_SIZE_RATIO;\n\n return (\n <div className=\"flex flex-col justify-center\">\n {unavailable ? (\n <div>\n <div\n className=\"table-cell font-sans bg-neutral-300 dark:bg-neutral-1000 rounded-full text-gui-unavailable tracking-widen-0.04 font-bold leading-snug\"\n style={{\n fontSize: dynamicFontSize * 0.6,\n padding: `${dynamicFontSize * 0.25}px ${dynamicFontSize * 0.5}px`,\n }}\n >\n COMING SOON\n </div>\n </div>\n ) : (\n <p\n className={cn(\n \"font-bold uppercase ui-text-p2 leading-snug\",\n { \"text-neutral-500 dark:text-neutral-700\": selected },\n { \"text-neutral-700 dark:text-neutral-500\": !selected },\n )}\n style={{\n fontSize: dynamicFontSize,\n letterSpacing: \"0.06em\",\n }}\n >\n Ably\n </p>\n )}\n <p\n className={cn(\n \"ui-text-p2 font-bold\",\n {\n \"text-neutral-000 dark:text-neutral-1300\":\n selected === true && !unavailable,\n },\n {\n \"text-neutral-1000 dark:text-neutral-300\":\n selected === false && !unavailable,\n },\n {\n \"text-neutral-1300 dark:text-neutral-000\":\n selected === undefined && !unavailable,\n },\n {\n \"text-neutral-700 dark:text-neutral-600\": unavailable,\n },\n { \"mt-[-3px]\": !unavailable },\n )}\n style={{ fontSize: numericalSize / DESCRIPTION_FONT_SIZE_RATIO }}\n >\n {label}\n </p>\n </div>\n );\n};\n\nexport default ProductLabel;\n"],"names":["React","cn","LABEL_FONT_SIZE_RATIO","DESCRIPTION_FONT_SIZE_RATIO","ProductLabel","label","unavailable","selected","numericalSize","showLabel","dynamicFontSize","div","className","style","fontSize","padding","p","letterSpacing","undefined"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,OAAQ,aAAc,CAU7B,MAAMC,sBAAwB,EAC9B,MAAMC,4BAA8B,IAEpC,MAAMC,aAAe,CAAC,CACpBC,KAAK,CACLC,WAAW,CACXC,QAAQ,CACRC,aAAa,CACbC,SAAS,CACS,IAClB,GAAI,CAACJ,OAAS,CAACI,UAAW,CACxB,OAAO,IACT,CAEA,MAAMC,gBAAkBF,cAAgBN,sBAExC,OACE,oBAACS,OAAIC,UAAU,gCACZN,YACC,oBAACK,WACC,oBAACA,OACCC,UAAU,wIACVC,MAAO,CACLC,SAAUJ,gBAAkB,GAC5BK,QAAS,CAAC,EAAEL,gBAAkB,IAAK,GAAG,EAAEA,gBAAkB,GAAI,EAAE,CAAC,AACnE,GACD,gBAKH,oBAACM,KACCJ,UAAWX,GACT,8CACA,CAAE,yCAA0CM,QAAS,EACrD,CAAE,yCAA0C,CAACA,QAAS,GAExDM,MAAO,CACLC,SAAUJ,gBACVO,cAAe,QACjB,GACD,QAIH,oBAACD,KACCJ,UAAWX,GACT,uBACA,CACE,0CACEM,WAAa,MAAQ,CAACD,WAC1B,EACA,CACE,0CACEC,WAAa,OAAS,CAACD,WAC3B,EACA,CACE,0CACEC,WAAaW,WAAa,CAACZ,WAC/B,EACA,CACE,yCAA0CA,WAC5C,EACA,CAAE,YAAa,CAACA,WAAY,GAE9BO,MAAO,CAAEC,SAAUN,cAAgBL,2BAA4B,GAE9DE,OAIT,CAEA,gBAAeD,YAAa"}
|
package/core/ProductTile/data.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export const products={pubsub:{label:"Pub/Sub",description:"Low-level APIs to build any realtime experience",icon:"icon-product-pubsub-mono",hoverIcon:"icon-product-pubsub",link:"/docs/products/channels"},chat:{label:"Chat",description:"Rapidly build chat features and roll-out at scale",icon:"icon-product-chat-mono",hoverIcon:"icon-product-chat",link:"/docs/products/chat"},spaces:{label:"Spaces",description:"Create collaborative environments in a few lines of code",icon:"icon-product-spaces-mono",hoverIcon:"icon-product-spaces",link:"/docs/products/spaces"},liveSync:{label:"LiveSync",description:"Sync database changes with frontend clients",icon:"icon-product-livesync-mono",hoverIcon:"icon-product-livesync",link:"/docs/products/livesync"},assetTracking:{label:"Asset Tracking",description:"Simple APIs to build realtime tracking applications",icon:"icon-product-asset-tracking-mono",hoverIcon:"icon-product-asset-tracking",link:"/docs/products/asset-tracking"},liveObjects:{label:"LiveObjects",description:"Sync application state across multiple devices",icon:"icon-product-liveobjects-mono",hoverIcon:"icon-product-liveobjects",link:"/docs/products/asset-tracking",unavailable:true}};
|
|
1
|
+
export const products={pubsub:{label:"Pub/Sub",description:"Low-level APIs to build any realtime experience",icon:"icon-product-pubsub-mono",hoverIcon:"icon-product-pubsub",link:"/docs/products/channels"},chat:{label:"Chat",description:"Rapidly build chat features and roll-out at scale",icon:"icon-product-chat-mono",hoverIcon:"icon-product-chat",link:"/docs/products/chat"},spaces:{label:"Spaces",description:"Create collaborative environments in a few lines of code",icon:"icon-product-spaces-mono",hoverIcon:"icon-product-spaces",link:"/docs/products/spaces"},liveSync:{label:"LiveSync",description:"Sync database changes with frontend clients",icon:"icon-product-livesync-mono",hoverIcon:"icon-product-livesync",link:"/docs/products/livesync"},assetTracking:{label:"Asset Tracking",description:"Simple APIs to build realtime tracking applications",icon:"icon-product-asset-tracking-mono",hoverIcon:"icon-product-asset-tracking",link:"/docs/products/asset-tracking"},liveObjects:{label:"LiveObjects",description:"Sync application state across multiple devices",icon:"icon-product-liveobjects-mono",hoverIcon:"icon-product-liveobjects",link:"/docs/products/asset-tracking",unavailable:true}};
|
|
2
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/ProductTile/data.ts"],"sourcesContent":["import { IconName } from \"../Icon/types\";\n\nexport type ProductName =\n | \"pubsub\"\n | \"chat\"\n | \"spaces\"\n | \"liveSync\"\n | \"assetTracking\"\n | \"liveObjects\";\n\ntype Products = Record<\n ProductName,\n {\n label: string;\n description: string;\n link?: string;\n icon?: IconName;\n hoverIcon?: IconName;\n unavailable?: boolean;\n }\n>;\n\nexport const products: Products = {\n pubsub: {\n label: \"Pub/Sub\",\n description: \"Low-level APIs to build any realtime experience\",\n icon: \"icon-product-pubsub-mono\",\n hoverIcon: \"icon-product-pubsub\",\n link: \"/docs/products/channels\",\n },\n chat: {\n label: \"Chat\",\n description: \"Rapidly build chat features and roll-out at scale\",\n icon: \"icon-product-chat-mono\",\n hoverIcon: \"icon-product-chat\",\n link: \"/docs/products/chat\",\n },\n spaces: {\n label: \"Spaces\",\n description: \"Create collaborative environments in a few lines of code\",\n icon: \"icon-product-spaces-mono\",\n hoverIcon: \"icon-product-spaces\",\n link: \"/docs/products/spaces\",\n },\n liveSync: {\n label: \"LiveSync\",\n description: \"Sync database changes with frontend clients\",\n icon: \"icon-product-livesync-mono\",\n hoverIcon: \"icon-product-livesync\",\n link: \"/docs/products/livesync\",\n },\n assetTracking: {\n label: \"Asset Tracking\",\n description: \"Simple APIs to build realtime tracking applications\",\n icon: \"icon-product-asset-tracking-mono\",\n hoverIcon: \"icon-product-asset-tracking\",\n link: \"/docs/products/asset-tracking\",\n },\n liveObjects: {\n label: \"LiveObjects\",\n description: \"Sync application state across multiple devices\",\n icon: \"icon-product-liveobjects-mono\",\n hoverIcon: \"icon-product-liveobjects\",\n link: \"/docs/products/asset-tracking\",\n unavailable: true,\n },\n};\n"],"names":["products","pubsub","label","description","icon","hoverIcon","link","chat","spaces","liveSync","assetTracking","liveObjects","unavailable"],"mappings":"AAsBA,OAAO,MAAMA,SAAqB,CAChCC,OAAQ,CACNC,MAAO,UACPC,YAAa,kDACbC,KAAM,2BACNC,UAAW,sBACXC,KAAM,yBACR,EACAC,KAAM,CACJL,MAAO,OACPC,YAAa,oDACbC,KAAM,yBACNC,UAAW,oBACXC,KAAM,qBACR,EACAE,OAAQ,CACNN,MAAO,SACPC,YAAa,2DACbC,KAAM,2BACNC,UAAW,sBACXC,KAAM,uBACR,EACAG,SAAU,CACRP,MAAO,WACPC,YAAa,8CACbC,KAAM,6BACNC,UAAW,wBACXC,KAAM,yBACR,EACAI,cAAe,CACbR,MAAO,iBACPC,YAAa,sDACbC,KAAM,mCACNC,UAAW,8BACXC,KAAM,+BACR,EACAK,YAAa,CACXT,MAAO,cACPC,YAAa,iDACbC,KAAM,gCACNC,UAAW,2BACXC,KAAM,gCACNM,YAAa,IACf,CACF,CAAE"}
|
package/core/ProductTile.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import cn from"./utils/cn";import LinkButton from"./LinkButton";import{products}from"./ProductTile/data";import ProductIcon from"./ProductTile/ProductIcon";import ProductLabel from"./ProductTile/ProductLabel";import ProductDescription from"./ProductTile/ProductDescription";const CONTAINER_GAP_RATIO=3;const ProductTile=({name,selected,currentPage,className,onClick,showDescription=true,showLabel=true,size="40px",animateIcons=false})=>{const{icon,hoverIcon,label,description,link,unavailable}=products[name]??{};const numericalSize=parseInt(size,10);const containerPresent=showDescription||showLabel;return React.createElement("div",{className:cn("transition-colors group/product-tile",{"flex flex-col p-12 rounded-lg gap-8":containerPresent},{"bg-neutral-1300 dark:bg-neutral-000":selected},{"bg-neutral-000 dark:bg-neutral-1300":!selected},{"hover:bg-neutral-100 dark:hover:bg-neutral-1200":selected===false&&!unavailable},{"cursor-pointer":selected!==undefined&&!unavailable},{"pointer-events-none":unavailable},{[`${className}`]:className}),"aria-hidden":unavailable,onClick:onClick},React.createElement("div",{className:cn("items-center",{flex:containerPresent},{"inline-flex":!containerPresent}),style:{gap:containerPresent?numericalSize/CONTAINER_GAP_RATIO:0}},React.createElement(ProductIcon,{size:numericalSize,name:icon,hoverName:animateIcons?hoverIcon:undefined,selected:selected,unavailable:!!unavailable}),React.createElement(ProductLabel,{label:label,selected:selected,unavailable:!!unavailable,numericalSize:numericalSize,showLabel:showLabel})),React.createElement(ProductDescription,{description:description,selected:selected,unavailable:!!unavailable,showDescription:showDescription}),selected&&link?React.createElement(LinkButton,{variant:"secondary",size:"xs",className:"mt-8 !text-neutral-000 dark:!text-neutral-1300",rightIcon:"icon-gui-arrow-right-micro",iconColor:"text-orange-600",href:link},currentPage?"View docs":"Explore"):null)};export default ProductTile;
|
|
1
|
+
import React from"react";import cn from"./utils/cn";import LinkButton from"./LinkButton";import{products}from"./ProductTile/data";import ProductIcon from"./ProductTile/ProductIcon";import ProductLabel from"./ProductTile/ProductLabel";import ProductDescription from"./ProductTile/ProductDescription";const CONTAINER_GAP_RATIO=3;const ProductTile=({name,selected,currentPage,className,onClick,showDescription=true,showLabel=true,size="40px",animateIcons=false})=>{const{icon,hoverIcon,label,description,link,unavailable}=products[name]??{};const numericalSize=parseInt(size,10);const containerPresent=showDescription||showLabel;return React.createElement("div",{className:cn("transition-colors group/product-tile",{"flex flex-col p-12 rounded-lg gap-8":containerPresent},{"bg-neutral-1300 dark:bg-neutral-000":selected},{"bg-neutral-000 dark:bg-neutral-1300":!selected},{"hover:bg-neutral-100 dark:hover:bg-neutral-1200":selected===false&&!unavailable},{"cursor-pointer":selected!==undefined&&!unavailable},{"pointer-events-none":unavailable},{[`${className}`]:className}),"aria-hidden":unavailable,onClick:onClick},React.createElement("div",{className:cn("items-center",{flex:containerPresent},{"inline-flex":!containerPresent}),style:{gap:containerPresent?numericalSize/CONTAINER_GAP_RATIO:0}},React.createElement(ProductIcon,{size:numericalSize,name:icon,hoverName:animateIcons?hoverIcon:undefined,selected:selected,unavailable:!!unavailable}),React.createElement(ProductLabel,{label:label,selected:selected,unavailable:!!unavailable,numericalSize:numericalSize,showLabel:showLabel})),React.createElement(ProductDescription,{description:description,selected:selected,unavailable:!!unavailable,showDescription:showDescription}),selected&&link?React.createElement(LinkButton,{variant:"secondary",size:"xs",className:"mt-8 !text-neutral-000 dark:!text-neutral-1300",rightIcon:"icon-gui-arrow-right-micro",iconColor:"text-orange-600",href:link},currentPage?"View docs":"Explore"):null)};export default ProductTile;
|
|
2
|
+
//# sourceMappingURL=ProductTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/ProductTile.tsx"],"sourcesContent":["import React from \"react\";\nimport cn from \"./utils/cn\";\nimport { IconSize } from \"./Icon/types\";\nimport LinkButton from \"./LinkButton\";\nimport { ProductName, products } from \"./ProductTile/data\";\nimport ProductIcon from \"./ProductTile/ProductIcon\";\nimport ProductLabel from \"./ProductTile/ProductLabel\";\nimport ProductDescription from \"./ProductTile/ProductDescription\";\n\n/**\n * Props for the ProductTile component.\n */\nexport type ProductTileProps = {\n /**\n * The name of the product.\n */\n name: ProductName;\n\n /**\n * Indicates if the product tile is selected. If `undefined`, the product tile is not selectable.\n * @default false\n */\n selected?: boolean;\n\n /**\n * Indicates if the product tile is on the \"current\" page. Changes CTA copy.\n * @default false\n */\n currentPage?: boolean;\n\n /**\n * Additional CSS class names to apply to the product tile outer container.\n */\n className?: string;\n\n /**\n * Callback function to handle click events on the product tile.\n */\n onClick?: () => void;\n\n /**\n * Indicates if the product description should be shown.\n * @default true\n */\n showDescription?: boolean;\n\n /**\n * Indicates if the product label should be shown.\n * @default true\n */\n showLabel?: boolean;\n\n /**\n * The size of the product icon.\n * @default \"40px\"\n */\n size?: IconSize;\n\n /**\n * Indicates if the product icons should be animated.\n * @default false\n */\n animateIcons?: boolean;\n};\n\nconst CONTAINER_GAP_RATIO = 3;\n\nconst ProductTile = ({\n name,\n selected,\n currentPage,\n className,\n onClick,\n showDescription = true,\n showLabel = true,\n size = \"40px\",\n animateIcons = false,\n}: ProductTileProps) => {\n const { icon, hoverIcon, label, description, link, unavailable } =\n products[name] ?? {};\n const numericalSize = parseInt(size, 10);\n const containerPresent = showDescription || showLabel;\n\n return (\n <div\n className={cn(\n \"transition-colors group/product-tile\",\n { \"flex flex-col p-12 rounded-lg gap-8\": containerPresent },\n { \"bg-neutral-1300 dark:bg-neutral-000\": selected },\n {\n \"bg-neutral-000 dark:bg-neutral-1300\": !selected,\n },\n {\n \"hover:bg-neutral-100 dark:hover:bg-neutral-1200\":\n selected === false && !unavailable,\n },\n { \"cursor-pointer\": selected !== undefined && !unavailable },\n { \"pointer-events-none\": unavailable },\n { [`${className}`]: className },\n )}\n aria-hidden={unavailable}\n onClick={onClick}\n >\n <div\n className={cn(\n \"items-center\",\n { flex: containerPresent },\n { \"inline-flex\": !containerPresent },\n )}\n style={{\n gap: containerPresent ? numericalSize / CONTAINER_GAP_RATIO : 0,\n }}\n >\n <ProductIcon\n size={numericalSize}\n name={icon}\n hoverName={animateIcons ? hoverIcon : undefined}\n selected={selected}\n unavailable={!!unavailable}\n />\n <ProductLabel\n label={label}\n selected={selected}\n unavailable={!!unavailable}\n numericalSize={numericalSize}\n showLabel={showLabel}\n />\n </div>\n <ProductDescription\n description={description}\n selected={selected}\n unavailable={!!unavailable}\n showDescription={showDescription}\n />\n {selected && link ? (\n <LinkButton\n variant=\"secondary\"\n size=\"xs\"\n className=\"mt-8 !text-neutral-000 dark:!text-neutral-1300\"\n rightIcon=\"icon-gui-arrow-right-micro\"\n iconColor=\"text-orange-600\"\n href={link}\n >\n {currentPage ? \"View docs\" : \"Explore\"}\n </LinkButton>\n ) : null}\n </div>\n );\n};\n\nexport default ProductTile;\n"],"names":["React","cn","LinkButton","products","ProductIcon","ProductLabel","ProductDescription","CONTAINER_GAP_RATIO","ProductTile","name","selected","currentPage","className","onClick","showDescription","showLabel","size","animateIcons","icon","hoverIcon","label","description","link","unavailable","numericalSize","parseInt","containerPresent","div","undefined","aria-hidden","flex","style","gap","hoverName","variant","rightIcon","iconColor","href"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,OAAQ,YAAa,AAE5B,QAAOC,eAAgB,cAAe,AACtC,QAAsBC,QAAQ,KAAQ,oBAAqB,AAC3D,QAA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CAACA,YACfT,gBAAiBA,kBAElBJ,UAAYY,KACX,oBAACpB,YACCgC,QAAQ,YACRlB,KAAK,KACLJ,UAAU,iDACVuB,UAAU,6BACVC,UAAU,kBACVC,KAAMf,MAELX,YAAc,YAAc,WAE7B,KAGV,CAEA,gBAAeH,WAAY"}
|
package/core/SignOutLink.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React,{useRef}from"react";const SignOutLink=({token,href,text,children,absUrl})=>{const formRef=useRef(null);const onClick=e=>{formRef.current?.submit();e.preventDefault()};return React.createElement(React.Fragment,null,React.createElement("form",{ref:formRef,method:"post",action:absUrl(href),className:"hidden"},React.createElement("input",{name:"_method",value:"delete",type:"hidden"}),React.createElement("input",{name:"authenticity_token",value:token,type:"hidden"})),children({href,text,onClick}))};export default SignOutLink;
|
|
1
|
+
import React,{useRef}from"react";const SignOutLink=({token,href,text,children,absUrl})=>{const formRef=useRef(null);const onClick=e=>{formRef.current?.submit();e.preventDefault()};return React.createElement(React.Fragment,null,React.createElement("form",{ref:formRef,method:"post",action:absUrl(href),className:"hidden"},React.createElement("input",{name:"_method",value:"delete",type:"hidden"}),React.createElement("input",{name:"authenticity_token",value:token,type:"hidden"})),children({href,text,onClick}))};export default SignOutLink;
|
|
2
|
+
//# sourceMappingURL=SignOutLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/SignOutLink.tsx"],"sourcesContent":["import React, { MouseEvent, MouseEventHandler, ReactNode, useRef } from \"react\";\nimport { AbsUrl } from \"./Meganav\";\n\ntype SignOutLinkProps = {\n token: string;\n href: string;\n text: string;\n children: ({\n href,\n text,\n onClick,\n }: {\n href: string;\n text: string;\n onClick: MouseEventHandler<HTMLAnchorElement>;\n }) => ReactNode;\n absUrl: AbsUrl;\n};\n\nconst SignOutLink = ({\n token,\n href,\n text,\n children,\n absUrl,\n}: SignOutLinkProps) => {\n const formRef = useRef<HTMLFormElement>(null);\n\n const onClick = (e: MouseEvent) => {\n formRef.current?.submit();\n e.preventDefault();\n };\n\n return (\n <>\n <form\n ref={formRef}\n method=\"post\"\n action={absUrl(href)}\n className=\"hidden\"\n >\n <input name=\"_method\" value=\"delete\" type=\"hidden\" />\n <input name=\"authenticity_token\" value={token} type=\"hidden\" />\n </form>\n\n {children({ href, text, onClick })}\n </>\n );\n};\n\nexport default SignOutLink;\n"],"names":["React","useRef","SignOutLink","token","href","text","children","absUrl","formRef","onClick","e","current","submit","preventDefault","form","ref","method","action","className","input","name","value","type"],"mappings":"AAAA,OAAOA,OAAmDC,MAAM,KAAQ,OAAQ,CAmBhF,MAAMC,YAAc,CAAC,CACnBC,KAAK,CACLC,IAAI,CACJC,IAAI,CACJC,QAAQ,CACRC,MAAM,CACW,IACjB,MAAMC,QAAUP,OAAwB,MAExC,MAAMQ,QAAU,AAACC,IACfF,QAAQG,OAAO,EAAEC,SACjBF,EAAEG,cAAc,EAClB,EAEA,OACE,wCACE,oBAACC,QACCC,IAAKP,QACLQ,OAAO,OACPC,OAAQV,OAAOH,MACfc,UAAU,UAEV,oBAACC,SAAMC,KAAK,UAAUC,MAAM,SAASC,KAAK,WAC1C,oBAACH,SAAMC,KAAK,qBAAqBC,MAAOlB,MAAOmB,KAAK,YAGrDhB,SAAS,CAAEF,KAAMC,KAAMI,OAAQ,GAGtC,CAEA,gBAAeP,WAAY"}
|
package/core/Slider/component.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import throttle from"lodash.throttle";import{queryId,queryIdAll}from"../dom-query";const mdBreakpoint=()=>window.matchMedia("(min-width: 48rem)").matches;const DRAG_BUFFER=20;const init=slidesContainer=>{const transformContainer=queryId("slider-strip",slidesContainer);const slides=Array.from(queryIdAll("slider-slide",slidesContainer));const slideLeftChevron=queryId("slider-previous",slidesContainer);const slideRightChevron=queryId("slider-next",slidesContainer);const slideMarkers=Array.from(queryIdAll("slider-marker",slidesContainer));const sliderControls=queryId("slider-controls",slidesContainer);sliderControls.classList.replace("hidden","flex");const slidesLength=slides.length;const slidesWidth=slidesContainer.getBoundingClientRect().width;const{width:slideWidth,left:slideLeftDistance}=slides[0].getBoundingClientRect();const{left:slideLeftDistanceSecond}=slides[1].getBoundingClientRect();const slideGap=slideLeftDistanceSecond-slideLeftDistance-slideWidth;const adjustment=(slidesWidth-slideWidth)/2;let currentIndex=0;let touchStartX=0;const calculateTransform=index=>index*-slideWidth+adjustment+index*-slideGap;const updateSlide=index=>transformContainer.style.transform=`translateX(${calculateTransform(index)}px)`;const updateMarkers=index=>{slideMarkers.forEach(marker=>marker.classList.remove("text-active-orange"));slideMarkers[index].classList.remove("text-cool-black");slideMarkers[index].classList.add("text-active-orange")};const slideLeft=()=>{currentIndex=currentIndex-1<=0?0:currentIndex-1;updateSlide(currentIndex);updateMarkers(currentIndex)};const slideRight=()=>{currentIndex=currentIndex+1>=slidesLength?currentIndex:currentIndex+1;updateSlide(currentIndex);updateMarkers(currentIndex)};updateSlide(0);updateMarkers(0);slideLeftChevron.addEventListener("click",slideLeft);transformContainer.addEventListener("touchstart",e=>{touchStartX=e.touches[0]?.clientX});transformContainer.addEventListener("touchend",e=>{const distance=e.changedTouches[0]?.clientX-touchStartX;if(Math.abs(distance)<DRAG_BUFFER)return;const direction=distance>0?slideLeft:slideRight;direction()});slideRightChevron.addEventListener("click",slideRight);return()=>{transformContainer.style.transform=null;sliderControls.classList.replace("flex","hidden")}};const Slider=({container,mqEnableThreshold})=>{if(!container)return;const breakpointCheck=mqEnableThreshold||(()=>!mdBreakpoint());let unmount=()=>{};if(breakpointCheck())unmount=init(container);window.addEventListener("resize",throttle(()=>{if(breakpointCheck()){unmount=init(container)}else{unmount()}},100))};export default Slider;
|
|
1
|
+
import throttle from"lodash.throttle";import{queryId,queryIdAll}from"../dom-query";const mdBreakpoint=()=>window.matchMedia("(min-width: 48rem)").matches;const DRAG_BUFFER=20;const init=slidesContainer=>{const transformContainer=queryId("slider-strip",slidesContainer);const slides=Array.from(queryIdAll("slider-slide",slidesContainer));const slideLeftChevron=queryId("slider-previous",slidesContainer);const slideRightChevron=queryId("slider-next",slidesContainer);const slideMarkers=Array.from(queryIdAll("slider-marker",slidesContainer));const sliderControls=queryId("slider-controls",slidesContainer);sliderControls.classList.replace("hidden","flex");const slidesLength=slides.length;const slidesWidth=slidesContainer.getBoundingClientRect().width;const{width:slideWidth,left:slideLeftDistance}=slides[0].getBoundingClientRect();const{left:slideLeftDistanceSecond}=slides[1].getBoundingClientRect();const slideGap=slideLeftDistanceSecond-slideLeftDistance-slideWidth;const adjustment=(slidesWidth-slideWidth)/2;let currentIndex=0;let touchStartX=0;const calculateTransform=index=>index*-slideWidth+adjustment+index*-slideGap;const updateSlide=index=>transformContainer.style.transform=`translateX(${calculateTransform(index)}px)`;const updateMarkers=index=>{slideMarkers.forEach(marker=>marker.classList.remove("text-active-orange"));slideMarkers[index].classList.remove("text-cool-black");slideMarkers[index].classList.add("text-active-orange")};const slideLeft=()=>{currentIndex=currentIndex-1<=0?0:currentIndex-1;updateSlide(currentIndex);updateMarkers(currentIndex)};const slideRight=()=>{currentIndex=currentIndex+1>=slidesLength?currentIndex:currentIndex+1;updateSlide(currentIndex);updateMarkers(currentIndex)};updateSlide(0);updateMarkers(0);slideLeftChevron.addEventListener("click",slideLeft);transformContainer.addEventListener("touchstart",e=>{touchStartX=e.touches[0]?.clientX});transformContainer.addEventListener("touchend",e=>{const distance=e.changedTouches[0]?.clientX-touchStartX;if(Math.abs(distance)<DRAG_BUFFER)return;const direction=distance>0?slideLeft:slideRight;direction()});slideRightChevron.addEventListener("click",slideRight);return()=>{transformContainer.style.transform=null;sliderControls.classList.replace("flex","hidden")}};const Slider=({container,mqEnableThreshold})=>{if(!container)return;const breakpointCheck=mqEnableThreshold||(()=>!mdBreakpoint());let unmount=()=>{};if(breakpointCheck())unmount=init(container);window.addEventListener("resize",throttle(()=>{if(breakpointCheck()){unmount=init(container)}else{unmount()}},100))};export default Slider;
|
|
2
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/Slider/component.js"],"sourcesContent":["import throttle from \"lodash.throttle\";\n\nimport { queryId, queryIdAll } from \"../dom-query\";\n\nconst mdBreakpoint = () => window.matchMedia(\"(min-width: 48rem)\").matches;\nconst DRAG_BUFFER = 20;\n\nconst init = (slidesContainer) => {\n const transformContainer = queryId(\"slider-strip\", slidesContainer);\n const slides = Array.from(queryIdAll(\"slider-slide\", slidesContainer));\n const slideLeftChevron = queryId(\"slider-previous\", slidesContainer);\n const slideRightChevron = queryId(\"slider-next\", slidesContainer);\n const slideMarkers = Array.from(queryIdAll(\"slider-marker\", slidesContainer));\n const sliderControls = queryId(\"slider-controls\", slidesContainer);\n\n sliderControls.classList.replace(\"hidden\", \"flex\");\n const slidesLength = slides.length;\n\n const slidesWidth = slidesContainer.getBoundingClientRect().width;\n const { width: slideWidth, left: slideLeftDistance } =\n slides[0].getBoundingClientRect();\n const { left: slideLeftDistanceSecond } = slides[1].getBoundingClientRect();\n const slideGap = slideLeftDistanceSecond - slideLeftDistance - slideWidth;\n const adjustment = (slidesWidth - slideWidth) / 2;\n\n let currentIndex = 0;\n let touchStartX = 0;\n\n const calculateTransform = (index) =>\n index * -slideWidth + adjustment + index * -slideGap;\n\n const updateSlide = (index) =>\n (transformContainer.style.transform = `translateX(${calculateTransform(\n index,\n )}px)`);\n\n const updateMarkers = (index) => {\n slideMarkers.forEach((marker) =>\n marker.classList.remove(\"text-active-orange\"),\n );\n slideMarkers[index].classList.remove(\"text-cool-black\");\n slideMarkers[index].classList.add(\"text-active-orange\");\n };\n\n const slideLeft = () => {\n currentIndex = currentIndex - 1 <= 0 ? 0 : currentIndex - 1;\n updateSlide(currentIndex);\n updateMarkers(currentIndex);\n };\n\n const slideRight = () => {\n currentIndex =\n currentIndex + 1 >= slidesLength ? currentIndex : currentIndex + 1;\n updateSlide(currentIndex);\n updateMarkers(currentIndex);\n };\n\n updateSlide(0);\n updateMarkers(0);\n\n slideLeftChevron.addEventListener(\"click\", slideLeft);\n\n transformContainer.addEventListener(\"touchstart\", (e) => {\n touchStartX = e.touches[0]?.clientX;\n });\n\n transformContainer.addEventListener(\"touchend\", (e) => {\n const distance = e.changedTouches[0]?.clientX - touchStartX;\n\n // Prevent sliding on clicks\n if (Math.abs(distance) < DRAG_BUFFER) return;\n\n const direction = distance > 0 ? slideLeft : slideRight;\n direction();\n });\n\n slideRightChevron.addEventListener(\"click\", slideRight);\n\n return () => {\n transformContainer.style.transform = null;\n sliderControls.classList.replace(\"flex\", \"hidden\");\n };\n};\n\nconst Slider = ({ container, mqEnableThreshold }) => {\n if (!container) return;\n\n const breakpointCheck = mqEnableThreshold || (() => !mdBreakpoint());\n\n let unmount = () => {};\n if (breakpointCheck()) unmount = init(container);\n\n window.addEventListener(\n \"resize\",\n throttle(() => {\n if (breakpointCheck()) {\n unmount = init(container);\n } else {\n unmount();\n }\n }, 100),\n );\n};\n\nexport default Slider;\n"],"names":["throttle","queryId","queryIdAll","mdBreakpoint","window","matchMedia","matches","DRAG_BUFFER","init","slidesContainer","transformContainer","slides","Array","from","slideLeftChevron","slideRightChevron","slideMarkers","sliderControls","classList","replace","slidesLength","length","slidesWidth","getBoundingClientRect","width","slideWidth","left","slideLeftDistance","slideLeftDistanceSecond","slideGap","adjustment","currentIndex","touchStartX","calculateTransform","index","updateSlide","style","transform","updateMarkers","forEach","marker","remove","add","slideLeft","slideRight","addEventListener","e","touches","clientX","distance","changedTouches","Math","abs","direction","Slider","container","mqEnableThreshold","breakpointCheck","unmount"],"mappings":"AAAA,OAAOA,aAAc,iBAAkB,AAEvC,QAASC,OAAO,CAAEC,UAAU,KAAQ,cAAe,CAEnD,MAAMC,aAAe,IAAMC,OAAOC,UAAU,CAAC,sBAAsBC,OAAO,CAC1E,MAAMC,YAAc,GAEpB,MAAMC,KAAO,AAACC,kBACZ,MAAMC,mBAAqBT,QAAQ,eAAgBQ,iBACnD,MAAME,OAASC,MAAMC,IAAI,CAACX,WAAW,e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,EACnEI,YAAYJ,cACZO,cAAcP,aAChB,EAEAI,YAAY,GACZG,cAAc,GAEdxB,iBAAiB+B,gBAAgB,CAAC,QAASF,WAE3CjC,mBAAmBmC,gBAAgB,CAAC,aAAc,AAACC,IACjDd,YAAcc,EAAEC,OAAO,CAAC,EAAE,EAAEC,OAC9B,GAEAtC,mBAAmBmC,gBAAgB,CAAC,WAAY,AAACC,IAC/C,MAAMG,SAAWH,EAAEI,cAAc,CAAC,EAAE,EAAEF,QAAUhB,YAGhD,GAAImB,KAAKC,GAAG,CAACH,UAAY1C,YAAa,OAEtC,MAAM8C,UAAYJ,SAAW,EAAIN,UAAYC,WAC7CS,WACF,GAEAtC,kBAAkB8B,gBAAgB,CAAC,QAASD,YAE5C,MAAO,KACLlC,mBAAmB0B,KAAK,CAACC,SAAS,CAAG,KACrCpB,eAAeC,SAAS,CAACC,OAAO,CAAC,OAAQ,SAC3C,CACF,EAEA,MAAMmC,OAAS,CAAC,CAAEC,SAAS,CAAEC,iBAAiB,CAAE,IAC9C,GAAI,CAACD,UAAW,OAEhB,MAAME,gBAAkBD,mBAAsB,CAAA,IAAM,CAACrD,cAAa,EAElE,IAAIuD,QAAU,KAAO,EACrB,GAAID,kBAAmBC,QAAUlD,KAAK+C,WAEtCnD,OAAOyC,gBAAgB,CACrB,SACA7C,SAAS,KACP,GAAIyD,kBAAmB,CACrBC,QAAUlD,KAAK+C,UACjB,KAAO,CACLG,SACF,CACF,EAAG,KAEP,CAEA,gBAAeJ,MAAO"}
|
package/core/Slider.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React,{useState,useEffect,useRef}from"react";import Icon from"./Icon";const SLIDE_TRANSITION_LENGTH=300;const SlideIndicator=({numSlides,activeIndex,interval,intervalIndicator,isInline})=>{return React.createElement("ul",{className:`flex gap-4 left-1/2 ${isInline?"bottom-0":"absolute bottom-0 transform -translate-x-1/2"}`},Array.from({length:numSlides},(_,i)=>intervalIndicator?React.createElement("li",{key:i,className:"relative w-40 h-4 mx-1 rounded-full bg-neutral-500"},i===activeIndex&&React.createElement("span",{className:"absolute inset-0 rounded-full bg-active-orange",style:{animation:`fillAnimation ${interval}ms linear`}})):React.createElement("li",{key:i},React.createElement("span",{className:`ui-slider-marker ${i===activeIndex?"text-active-orange":"text-cool-black"}`,"data-id":"slider-marker"},"⬤"))))};const setupSlides=(children,activeIndex)=>[children[activeIndex===0?children.length-1:activeIndex-1],children[activeIndex],children[activeIndex===children.length-1?0:activeIndex+1]];const Slider=({children,options})=>{const[activeIndex,setActiveIndex]=useState(0);const[touchStartX,setTouchStartX]=useState(0);const[touchEndX,setTouchEndX]=useState(0);const[slides,setSlides]=useState(setupSlides(children,activeIndex));const[translationCoefficient,setTranslationCoefficient]=useState(0);const timerRef=useRef(null);const[slideLock,setSlideLock]=useState(false);const isInline=options?.controlPosition==="inline";const next=()=>{if(!slideLock){setActiveIndex(prevIndex=>(prevIndex+1)%children.length);setTranslationCoefficient(1);resetInterval();setSlideLock(true)}};const prev=()=>{if(!slideLock){setActiveIndex(prevIndex=>prevIndex>0?prevIndex-1:children.length-1);setTranslationCoefficient(-1);resetInterval();setSlideLock(true)}};const resetInterval=()=>{if(timerRef.current)clearInterval(timerRef.current);timerRef.current=setInterval(next,options?.interval??1e4)};const handleTouchStart=e=>{setTouchStartX(e.touches[0].clientX)};const handleTouchMove=e=>{setTouchEndX(e.touches[0].clientX)};const handleTouchEnd=()=>{if(touchStartX-touchEndX>50){next()}if(touchStartX-touchEndX<-50){prev()}};useEffect(()=>{resetInterval();return()=>{if(timerRef.current)clearInterval(timerRef.current)}},[children.length,options?.interval]);useEffect(()=>{setTimeout(()=>{setSlides(setupSlides(children,activeIndex));setTranslationCoefficient(0);setSlideLock(false)},SLIDE_TRANSITION_LENGTH)},[activeIndex]);return React.createElement("div",{className:"relative",onTouchStart:handleTouchStart,onTouchMove:handleTouchMove,onTouchEnd:handleTouchEnd},React.createElement("div",{className:"overflow-y-visible overflow-x-clip w-full py-40"},React.createElement("div",{className:`flex items-center ${translationCoefficient!==0?`transition-transform ease-in-out duration-${SLIDE_TRANSITION_LENGTH}`:""} `,style:{transform:`translateX(-${(translationCoefficient+1)*100}%)`}},slides.map((child,index)=>React.createElement("div",{key:index,className:"w-full flex-shrink-0 flex justify-center sm:px-60"},child)))),React.createElement("div",{className:`flex items-center pointer-events-none ${isInline?"ui-standard-container justify-center gap-24 -mt-16":"sm:flex sm:absolute inset-0 justify-between"}`},React.createElement("button",{className:`${isInline?"w-32 h-32":"hidden sm:flex w-48 h-48"} pointer-events-auto rounded border border-mid-grey hover:border-active-orange flex justify-center items-center ui-icon-cta ui-icon-cta-left`,onClick:prev},React.createElement("div",{className:"ui-icon-cta-holder flex w-48"},React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-left-outline",size:"1.5rem"})),React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-left-outline",size:"1.5rem"})))),React.createElement(SlideIndicator,{numSlides:children.length,activeIndex:activeIndex,interval:options?.interval??1e4,intervalIndicator:options?.intervalIndicator,isInline:isInline}),React.createElement("button",{className:`${isInline?"w-32 h-32":"hidden sm:flex w-48 h-48"} pointer-events-auto rounded border border-mid-grey hover:border-active-orange justify-center items-center ui-icon-cta ui-icon-cta-right`,onClick:next},React.createElement("div",{className:"ui-icon-cta-holder flex w-48"},React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-right-outline",size:"1.5rem"})),React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-right-outline",size:"1.5rem"}))))))};export default Slider;
|
|
1
|
+
import React,{useState,useEffect,useRef}from"react";import Icon from"./Icon";const SLIDE_TRANSITION_LENGTH=300;const SlideIndicator=({numSlides,activeIndex,interval,intervalIndicator,isInline})=>{return React.createElement("ul",{className:`flex gap-4 left-1/2 ${isInline?"bottom-0":"absolute bottom-0 transform -translate-x-1/2"}`},Array.from({length:numSlides},(_,i)=>intervalIndicator?React.createElement("li",{key:i,className:"relative w-40 h-4 mx-1 rounded-full bg-neutral-500"},i===activeIndex&&React.createElement("span",{className:"absolute inset-0 rounded-full bg-active-orange",style:{animation:`fillAnimation ${interval}ms linear`}})):React.createElement("li",{key:i},React.createElement("span",{className:`ui-slider-marker ${i===activeIndex?"text-active-orange":"text-cool-black"}`,"data-id":"slider-marker"},"⬤"))))};const setupSlides=(children,activeIndex)=>[children[activeIndex===0?children.length-1:activeIndex-1],children[activeIndex],children[activeIndex===children.length-1?0:activeIndex+1]];const Slider=({children,options})=>{const[activeIndex,setActiveIndex]=useState(0);const[touchStartX,setTouchStartX]=useState(0);const[touchEndX,setTouchEndX]=useState(0);const[slides,setSlides]=useState(setupSlides(children,activeIndex));const[translationCoefficient,setTranslationCoefficient]=useState(0);const timerRef=useRef(null);const[slideLock,setSlideLock]=useState(false);const isInline=options?.controlPosition==="inline";const next=()=>{if(!slideLock){setActiveIndex(prevIndex=>(prevIndex+1)%children.length);setTranslationCoefficient(1);resetInterval();setSlideLock(true)}};const prev=()=>{if(!slideLock){setActiveIndex(prevIndex=>prevIndex>0?prevIndex-1:children.length-1);setTranslationCoefficient(-1);resetInterval();setSlideLock(true)}};const resetInterval=()=>{if(timerRef.current)clearInterval(timerRef.current);timerRef.current=setInterval(next,options?.interval??1e4)};const handleTouchStart=e=>{setTouchStartX(e.touches[0].clientX)};const handleTouchMove=e=>{setTouchEndX(e.touches[0].clientX)};const handleTouchEnd=()=>{if(touchStartX-touchEndX>50){next()}if(touchStartX-touchEndX<-50){prev()}};useEffect(()=>{resetInterval();return()=>{if(timerRef.current)clearInterval(timerRef.current)}},[children.length,options?.interval]);useEffect(()=>{setTimeout(()=>{setSlides(setupSlides(children,activeIndex));setTranslationCoefficient(0);setSlideLock(false)},SLIDE_TRANSITION_LENGTH)},[activeIndex]);return React.createElement("div",{className:"relative",onTouchStart:handleTouchStart,onTouchMove:handleTouchMove,onTouchEnd:handleTouchEnd},React.createElement("div",{className:"overflow-y-visible overflow-x-clip w-full py-40"},React.createElement("div",{className:`flex items-center ${translationCoefficient!==0?`transition-transform ease-in-out duration-${SLIDE_TRANSITION_LENGTH}`:""} `,style:{transform:`translateX(-${(translationCoefficient+1)*100}%)`}},slides.map((child,index)=>React.createElement("div",{key:index,className:"w-full flex-shrink-0 flex justify-center sm:px-60"},child)))),React.createElement("div",{className:`flex items-center pointer-events-none ${isInline?"ui-standard-container justify-center gap-24 -mt-16":"sm:flex sm:absolute inset-0 justify-between"}`},React.createElement("button",{className:`${isInline?"w-32 h-32":"hidden sm:flex w-48 h-48"} pointer-events-auto rounded border border-mid-grey hover:border-active-orange flex justify-center items-center ui-icon-cta ui-icon-cta-left`,onClick:prev},React.createElement("div",{className:"ui-icon-cta-holder flex w-48"},React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-left-outline",size:"1.5rem"})),React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-left-outline",size:"1.5rem"})))),React.createElement(SlideIndicator,{numSlides:children.length,activeIndex:activeIndex,interval:options?.interval??1e4,intervalIndicator:options?.intervalIndicator,isInline:isInline}),React.createElement("button",{className:`${isInline?"w-32 h-32":"hidden sm:flex w-48 h-48"} pointer-events-auto rounded border border-mid-grey hover:border-active-orange justify-center items-center ui-icon-cta ui-icon-cta-right`,onClick:next},React.createElement("div",{className:"ui-icon-cta-holder flex w-48"},React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-right-outline",size:"1.5rem"})),React.createElement("div",{className:"w-full h-full flex-shrink-0 flex items-center justify-center"},React.createElement(Icon,{name:"icon-gui-arrow-long-right-outline",size:"1.5rem"}))))))};export default Slider;
|
|
2
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Slider.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n useRef,\n ReactNode,\n TouchEvent,\n} from \"react\";\nimport Icon from \"./Icon\";\n\ninterface SliderProps {\n children: ReactNode[];\n options?: {\n interval?: number;\n controlPosition?: \"inline\" | \"floating\";\n intervalIndicator?: boolean;\n };\n}\n\ninterface SliderIndicatorProps {\n numSlides: number;\n activeIndex: number;\n interval: number;\n intervalIndicator?: boolean;\n isInline?: boolean;\n}\n\nconst SLIDE_TRANSITION_LENGTH = 300;\n\nconst SlideIndicator = ({\n numSlides,\n activeIndex,\n interval,\n intervalIndicator,\n isInline,\n}: SliderIndicatorProps) => {\n return (\n <ul\n className={`flex gap-4 left-1/2 ${\n isInline ? \"bottom-0\" : \"absolute bottom-0 transform -translate-x-1/2\"\n }`}\n >\n {Array.from({ length: numSlides }, (_, i) =>\n intervalIndicator ? (\n <li\n key={i}\n className=\"relative w-40 h-4 mx-1 rounded-full bg-neutral-500\"\n >\n {i === activeIndex && (\n <span\n className=\"absolute inset-0 rounded-full bg-active-orange\"\n style={{\n animation: `fillAnimation ${interval}ms linear`,\n }}\n ></span>\n )}\n </li>\n ) : (\n <li key={i}>\n <span\n className={`ui-slider-marker ${\n i === activeIndex ? \"text-active-orange\" : \"text-cool-black\"\n }`}\n data-id=\"slider-marker\"\n >\n ⬤\n </span>\n </li>\n ),\n )}\n </ul>\n );\n};\n\nconst setupSlides = (children: ReactNode[], activeIndex: number) => [\n children[activeIndex === 0 ? children.length - 1 : activeIndex - 1],\n children[activeIndex],\n children[activeIndex === children.length - 1 ? 0 : activeIndex + 1],\n];\n\nconst Slider = ({ children, options }: SliderProps) => {\n const [activeIndex, setActiveIndex] = useState(0);\n const [touchStartX, setTouchStartX] = useState(0);\n const [touchEndX, setTouchEndX] = useState(0);\n const [slides, setSlides] = useState<ReactNode[]>(\n setupSlides(children, activeIndex),\n );\n const [translationCoefficient, setTranslationCoefficient] = useState(0);\n const timerRef = useRef<NodeJS.Timeout | null>(null);\n const [slideLock, setSlideLock] = useState(false);\n\n const isInline = options?.controlPosition === \"inline\";\n\n const next = () => {\n if (!slideLock) {\n setActiveIndex((prevIndex) => (prevIndex + 1) % children.length);\n setTranslationCoefficient(1);\n resetInterval();\n setSlideLock(true);\n }\n };\n\n const prev = () => {\n if (!slideLock) {\n setActiveIndex((prevIndex) =>\n prevIndex > 0 ? prevIndex - 1 : children.length - 1,\n );\n setTranslationCoefficient(-1);\n resetInterval();\n setSlideLock(true);\n }\n };\n\n const resetInterval = () => {\n if (timerRef.current) clearInterval(timerRef.current);\n timerRef.current = setInterval(next, options?.interval ?? 10000);\n };\n\n const handleTouchStart = (e: TouchEvent) => {\n setTouchStartX(e.touches[0].clientX);\n };\n\n const handleTouchMove = (e: TouchEvent) => {\n setTouchEndX(e.touches[0].clientX);\n };\n\n const handleTouchEnd = () => {\n if (touchStartX - touchEndX > 50) {\n next();\n }\n if (touchStartX - touchEndX < -50) {\n prev();\n }\n };\n\n useEffect(() => {\n resetInterval();\n return () => {\n if (timerRef.current) clearInterval(timerRef.current);\n };\n }, [children.length, options?.interval]);\n\n useEffect(() => {\n setTimeout(() => {\n setSlides(setupSlides(children, activeIndex));\n setTranslationCoefficient(0);\n setSlideLock(false);\n }, SLIDE_TRANSITION_LENGTH);\n }, [activeIndex]);\n\n return (\n <div\n className=\"relative\"\n onTouchStart={handleTouchStart}\n onTouchMove={handleTouchMove}\n onTouchEnd={handleTouchEnd}\n >\n <div className=\"overflow-y-visible overflow-x-clip w-full py-40\">\n <div\n className={`flex items-center ${\n translationCoefficient !== 0\n ? `transition-transform ease-in-out duration-${SLIDE_TRANSITION_LENGTH}`\n : \"\"\n } `}\n style={{\n transform: `translateX(-${(translationCoefficient + 1) * 100}%)`,\n }}\n >\n {slides.map((child, index) => (\n <div\n key={index}\n className=\"w-full flex-shrink-0 flex justify-center sm:px-60\"\n >\n {child}\n </div>\n ))}\n </div>\n </div>\n\n <div\n className={`flex items-center pointer-events-none ${\n isInline\n ? \"ui-standard-container justify-center gap-24 -mt-16\"\n : \"sm:flex sm:absolute inset-0 justify-between\"\n }`}\n >\n <button\n className={`${\n isInline ? \"w-32 h-32\" : \"hidden sm:flex w-48 h-48\"\n } pointer-events-auto rounded border border-mid-grey hover:border-active-orange flex justify-center items-center ui-icon-cta ui-icon-cta-left`}\n onClick={prev}\n >\n <div className=\"ui-icon-cta-holder flex w-48\">\n <div className=\"w-full h-full flex-shrink-0 flex items-center justify-center\">\n <Icon name=\"icon-gui-arrow-long-left-outline\" size=\"1.5rem\" />\n </div>\n <div className=\"w-full h-full flex-shrink-0 flex items-center justify-center\">\n <Icon name=\"icon-gui-arrow-long-left-outline\" size=\"1.5rem\" />\n </div>\n </div>\n </button>\n\n <SlideIndicator\n numSlides={children.length}\n activeIndex={activeIndex}\n interval={options?.interval ?? 10000}\n intervalIndicator={options?.intervalIndicator}\n isInline={isInline}\n />\n\n <button\n className={`${\n isInline ? \"w-32 h-32\" : \"hidden sm:flex w-48 h-48\"\n } pointer-events-auto rounded border border-mid-grey hover:border-active-orange justify-center items-center ui-icon-cta ui-icon-cta-right`}\n onClick={next}\n >\n <div className=\"ui-icon-cta-holder flex w-48\">\n <div className=\"w-full h-full flex-shrink-0 flex items-center justify-center\">\n <Icon name=\"icon-gui-arrow-long-right-outline\" size=\"1.5rem\" />\n </div>\n <div className=\"w-full h-full flex-shrink-0 flex items-center justify-center\">\n <Icon name=\"icon-gui-arrow-long-right-outline\" size=\"1.5rem\" />\n </div>\n </div>\n </button>\n </div>\n </div>\n );\n};\n\nexport default Slider;\n"],"names":["React","useState","useEffect","useRef","Icon","SLIDE_TRANSITION_LENGTH","SlideIndicator","numSlides","activeIndex","interval","intervalIndicator","isInline","ul","className","Array","from","length","_","i","li","key","span","style","animation","data-id","setupSlides","children","Slider","options","setActiveIndex","touchStartX","setTouchStartX","touchEndX","setTouchEndX","slides","setSlides","translationCoefficient","setTranslationCoefficient","timerRef","slideLock","setSlideLock","controlPosition","next","prevIndex","resetInterval","prev","current","clearInterval","setInterval","handleTouchStart","e","touches","clientX","handleTouchMove","handleTouchEnd","setTimeout","div","onTouchStart","onTouchMove","onTouchEnd","transform","map","child","index","button","onClick","name","size"],"mappings":"AAAA,OAAOA,OACLC,QAAQ,CACRC,SAAS,CACTC,MAAM,KAGD,OAAQ,AACf,QAAOC,SAAU,QAAS,CAmB1B,MAAMC,wBAA0B,IAEhC,MAAMC,eAAiB,CAAC,CACtBC,SAAS,CACTC,WAAW,CACXC,QAAQ,CACRC,iBAAiB,CACjBC,QAAQ,CACa,IACrB,OACE,oBAACC,MACCC,UAAW,CAAC,oBAAoB,EAC9BF,SAAW,WAAa,+CACzB,CAAC,EAEDG,MAAMC,IAAI,CAAC,CAAEC,OAAQT,SAAU,EAAG,CAACU,EAAGC,IACrCR,kBACE,oBAACS,MACCC,IAAKF,EACLL,UAAU,sDAETK,IAAMV,aACL,oBAACa,QACCR,UAAU,iDACVS,MAAO,CACLC,UAAW,CAAC,cAAc,EAAEd,SAAS,SAAS,CAAC,AACjD,KAKN,oBAACU,MAAGC,IAAKF,GACP,oBAACG,QACCR,UAAW,CAAC,iBAAiB,EAC3BK,IAAMV,YAAc,qBAAuB,kBAC5C,CAAC,CACFgB,UAAQ,iBACT,OAQb,EAEA,MAAMC,YAAc,CAACC,SAAuBlB,cAAwB,CAClEkB,QAAQ,CAAClB,cAAgB,EAAIkB,SAASV,MAAM,CAAG,EAAIR,YAAc,EAAE,CACnEkB,QAAQ,CAAClB,YAAY,CACrBkB,QAAQ,CAAClB,cAAgBkB,SAASV,MAAM,CAAG,EAAI,EAAIR,YAAc,EAAE,CACpE,CAED,MAAMmB,OAAS,CAAC,CAAED,QAAQ,CAAEE,OAAO,CAAe,IAChD,KAAM,CAACpB,YAAaqB,eAAe,CAAG5B,SAAS,GAC/C,KAAM,CAAC6B,YAAaC,eAAe,CAAG9B,SAA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,KAAK,oCAAoCC,KAAK,eAOlE,CAEA,gBAAexC,MAAO"}
|
package/core/Status.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React from"react";import useSWR from"swr";import cn from"./utils/cn";import Icon from"./Icon";export const statusTypes=["none","operational","minor","major","critical","unknown"];export const StatusUrl="https://ntqy1wz94gjv.statuspage.io/api/v2/status.json";const fetcher=url=>fetch(url).then(res=>res.json());const indicatorClass=indicator=>{switch(indicator){case"none":case"operational":return"bg-gui-success-green";case"minor":return"bg-yellow-500";case"major":return"bg-orange-500";case"critical":return"bg-gui-error-red";default:return"bg-neutral-500"}};export const StatusIcon=({statusUrl,refreshInterval=1e3*60})=>{const{data,error,isLoading}=useSWR(statusUrl,fetcher,{refreshInterval});return React.createElement("span",{className:cn("inline-flex h-8 aspect-square rounded-full",indicatorClass(data?.status?.indicator),{"animate-pulse":isLoading||error})})};const Status=({statusUrl=StatusUrl,additionalCSS,refreshInterval=1e3*60,showDescription=false})=>{const{data}=useSWR(statusUrl,fetcher,{refreshInterval});return React.createElement("a",{href:"https://status.ably.com",className:cn("inline-flex group/status items-center gap-8",additionalCSS),target:"_blank",rel:"noreferrer"},React.createElement(StatusIcon,{statusUrl:statusUrl,refreshInterval:refreshInterval??1e3*60}),showDescription&&data?.status?.description&&React.createElement("div",{className:"flex gap-8 ui-text-menu4 font-medium text-neutral-900 group-hover/status:text-neutral-1300 dark:text-neutral-400 dark:group-hover/status:text-neutral-000 transition-colors"},React.createElement("span",null,data.status.description.charAt(0).toUpperCase()+data.status.description.slice(1).toLowerCase()),React.createElement(Icon,{name:"icon-gui-arrow-top-right-on-square-outline",size:"16px"})))};export default Status;
|
|
1
|
+
import React from"react";import useSWR from"swr";import cn from"./utils/cn";import Icon from"./Icon";export const statusTypes=["none","operational","minor","major","critical","unknown"];export const StatusUrl="https://ntqy1wz94gjv.statuspage.io/api/v2/status.json";const fetcher=url=>fetch(url).then(res=>res.json());const indicatorClass=indicator=>{switch(indicator){case"none":case"operational":return"bg-gui-success-green";case"minor":return"bg-yellow-500";case"major":return"bg-orange-500";case"critical":return"bg-gui-error-red";default:return"bg-neutral-500"}};export const StatusIcon=({statusUrl,refreshInterval=1e3*60})=>{const{data,error,isLoading}=useSWR(statusUrl,fetcher,{refreshInterval});return React.createElement("span",{className:cn("inline-flex h-8 aspect-square rounded-full",indicatorClass(data?.status?.indicator),{"animate-pulse":isLoading||error})})};const Status=({statusUrl=StatusUrl,additionalCSS,refreshInterval=1e3*60,showDescription=false})=>{const{data}=useSWR(statusUrl,fetcher,{refreshInterval});return React.createElement("a",{href:"https://status.ably.com",className:cn("inline-flex group/status items-center gap-8",additionalCSS),target:"_blank",rel:"noreferrer"},React.createElement(StatusIcon,{statusUrl:statusUrl,refreshInterval:refreshInterval??1e3*60}),showDescription&&data?.status?.description&&React.createElement("div",{className:"flex gap-8 ui-text-menu4 font-medium text-neutral-900 group-hover/status:text-neutral-1300 dark:text-neutral-400 dark:group-hover/status:text-neutral-000 transition-colors"},React.createElement("span",null,data.status.description.charAt(0).toUpperCase()+data.status.description.slice(1).toLowerCase()),React.createElement(Icon,{name:"icon-gui-arrow-top-right-on-square-outline",size:"16px"})))};export default Status;
|
|
2
|
+
//# sourceMappingURL=Status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Status.tsx"],"sourcesContent":["import React from \"react\";\nimport useSWR from \"swr\";\nimport cn from \"./utils/cn\";\nimport Icon from \"./Icon\";\n\ntype StatusProps = {\n statusUrl: string;\n additionalCSS?: string;\n refreshInterval?: number;\n showDescription?: boolean;\n};\n\nexport const statusTypes = [\n \"none\",\n \"operational\",\n \"minor\",\n \"major\",\n \"critical\",\n \"unknown\",\n] as const;\n\nexport type StatusType = (typeof statusTypes)[number];\n\nexport const StatusUrl =\n \"https://ntqy1wz94gjv.statuspage.io/api/v2/status.json\";\n\n// Our SWR fetcher function\nconst fetcher = (url: string) => fetch(url).then((res) => res.json());\n\nconst indicatorClass = (indicator?: StatusType) => {\n switch (indicator) {\n case \"none\":\n case \"operational\":\n return \"bg-gui-success-green\";\n case \"minor\":\n return \"bg-yellow-500\";\n case \"major\":\n return \"bg-orange-500\";\n case \"critical\":\n return \"bg-gui-error-red\";\n default:\n return \"bg-neutral-500\";\n }\n};\n\nexport const StatusIcon = ({\n statusUrl,\n refreshInterval = 1000 * 60,\n}: StatusProps) => {\n const { data, error, isLoading } = useSWR(statusUrl, fetcher, {\n refreshInterval,\n });\n\n return (\n <span\n className={cn(\n \"inline-flex h-8 aspect-square rounded-full\",\n indicatorClass(data?.status?.indicator),\n { \"animate-pulse\": isLoading || error },\n )}\n ></span>\n );\n};\n\nconst Status = ({\n statusUrl = StatusUrl,\n additionalCSS,\n refreshInterval = 1000 * 60,\n showDescription = false,\n}: StatusProps) => {\n const { data } = useSWR(statusUrl, fetcher, {\n refreshInterval,\n });\n\n return (\n <a\n href=\"https://status.ably.com\"\n className={cn(\n \"inline-flex group/status items-center gap-8\",\n additionalCSS,\n )}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n <StatusIcon\n statusUrl={statusUrl}\n refreshInterval={refreshInterval ?? 1000 * 60}\n />\n {showDescription && data?.status?.description && (\n <div className=\"flex gap-8 ui-text-menu4 font-medium text-neutral-900 group-hover/status:text-neutral-1300 dark:text-neutral-400 dark:group-hover/status:text-neutral-000 transition-colors\">\n <span>\n {data.status.description.charAt(0).toUpperCase() +\n data.status.description.slice(1).toLowerCase()}\n </span>\n <Icon name=\"icon-gui-arrow-top-right-on-square-outline\" size=\"16px\" />\n </div>\n )}\n </a>\n );\n};\n\nexport default Status;\n"],"names":["React","useSWR","cn","Icon","statusTypes","StatusUrl","fetcher","url","fetch","then","res","json","indicatorClass","indicator","StatusIcon","statusUrl","refreshInterval","data","error","isLoading","span","className","status","Status","additionalCSS","showDescription","a","href","target","rel","description","div","charAt","toUpperCase","slice","toLowerCase","name","size"],"mappings":"AAAA,OAAOA,UAAW,OAAQ,AAC1B,QAAOC,WAA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WAAW,IAEhD,oBAAChC,MAAKiC,KAAK,6CAA6CC,KAAK,UAKvE,CAEA,gBAAed,MAAO"}
|
package/core/TabMenu.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import React,{useEffect}from"react";import*as Tabs from"@radix-ui/react-tabs";import throttle from"lodash.throttle";import cn from"./utils/cn";const DEFAULT_TAILWIND_ANIMATION_DURATION=150;const TabMenu=({tabs=[],contents=[],tabOnClick,tabClassName,rootClassName,contentClassName,options})=>{const{defaultTabIndex=0,underline=true,animated:animatedOption=true,flexibleTabWidth=false,flexibleTabHeight=false}=options??{};const listRef=React.useRef(null);const[animated,setAnimated]=React.useState(false);const[highlight,setHighlight]=React.useState({offset:0,width:0});useEffect(()=>{if(animatedOption&&highlight.width>0){setTimeout(()=>{setAnimated(true)},DEFAULT_TAILWIND_ANIMATION_DURATION)}},[animatedOption,highlight.width]);useEffect(()=>{const handleResize=throttle(()=>{const activeTabElement=listRef.current?.querySelector(`[data-state="active"]`);if(activeTabElement){updateHighlightDimensions(activeTabElement)}},100);handleResize();window.addEventListener("resize",handleResize);return()=>{window.removeEventListener("resize",handleResize)}},[]);const updateHighlightDimensions=element=>{const{left:parentLeft}=listRef.current?.getBoundingClientRect()??{};const{left,width}=element.getBoundingClientRect()??{};setHighlight({offset:(left??0)-(parentLeft??0),width:width??0})};const handleTabClick=(event,index)=>{tabOnClick?.(index);updateHighlightDimensions(event.currentTarget)};return React.createElement(Tabs.Root,{defaultValue:`tab-${defaultTabIndex}`,className:cn({"h-full":flexibleTabHeight},rootClassName)},React.createElement(Tabs.List,{ref:listRef,className:cn("relative",{"flex border-b border-neutral-300 dark:border-neutral-1000":underline},{"h-full":flexibleTabHeight})},tabs.map((tab,index)=>React.createElement(Tabs.Trigger,{key:`tab-${index}`,className:cn("lg:px-24 md:px-20 px-16 py-16 ui-text-menu1 font-bold data-[state=active]:text-neutral-1300 text-neutral-1000 dark:data-[state=active]:text-neutral-000 dark:text-neutral-300 focus:outline-none focus-visible:outline-gui-focus transition-colors hover:text-neutral-1300 dark:hover:text-neutral-000 active:text-neutral-900 dark:active:text-neutral-400 disabled:text-gui-unavailable dark:disabled:text-gui-unavailable-dark disabled:cursor-not-allowed",{"flex-1":flexibleTabWidth},{"h-full":flexibleTabHeight},tabClassName),value:`tab-${index}`,onClick:event=>handleTabClick(event,index),disabled:typeof tab==="object"?tab.disabled:false},typeof tab==="object"?tab.label:tab)),React.createElement("div",{className:cn("absolute bottom-0 bg-neutral-1300 dark:bg-neutral-000 h-[3px] w-24",{"transition-[transform,width]":animated}),style:{transform:`translateX(${highlight.offset}px)`,width:`${highlight.width}px`}})),contents.map((content,index)=>React.createElement(Tabs.Content,{key:`tab-${index}`,value:`tab-${index}`,className:contentClassName},content)))};export default TabMenu;
|
|
1
|
+
import React,{useEffect}from"react";import*as Tabs from"@radix-ui/react-tabs";import throttle from"lodash.throttle";import cn from"./utils/cn";const DEFAULT_TAILWIND_ANIMATION_DURATION=150;const TabMenu=({tabs=[],contents=[],tabOnClick,tabClassName,rootClassName,contentClassName,options})=>{const{defaultTabIndex=0,underline=true,animated:animatedOption=true,flexibleTabWidth=false,flexibleTabHeight=false}=options??{};const listRef=React.useRef(null);const[animated,setAnimated]=React.useState(false);const[highlight,setHighlight]=React.useState({offset:0,width:0});useEffect(()=>{if(animatedOption&&highlight.width>0){setTimeout(()=>{setAnimated(true)},DEFAULT_TAILWIND_ANIMATION_DURATION)}},[animatedOption,highlight.width]);useEffect(()=>{const handleResize=throttle(()=>{const activeTabElement=listRef.current?.querySelector(`[data-state="active"]`);if(activeTabElement){updateHighlightDimensions(activeTabElement)}},100);handleResize();window.addEventListener("resize",handleResize);return()=>{window.removeEventListener("resize",handleResize)}},[]);const updateHighlightDimensions=element=>{const{left:parentLeft}=listRef.current?.getBoundingClientRect()??{};const{left,width}=element.getBoundingClientRect()??{};setHighlight({offset:(left??0)-(parentLeft??0),width:width??0})};const handleTabClick=(event,index)=>{tabOnClick?.(index);updateHighlightDimensions(event.currentTarget)};return React.createElement(Tabs.Root,{defaultValue:`tab-${defaultTabIndex}`,className:cn({"h-full":flexibleTabHeight},rootClassName)},React.createElement(Tabs.List,{ref:listRef,className:cn("relative",{"flex border-b border-neutral-300 dark:border-neutral-1000":underline},{"h-full":flexibleTabHeight})},tabs.map((tab,index)=>React.createElement(Tabs.Trigger,{key:`tab-${index}`,className:cn("lg:px-24 md:px-20 px-16 py-16 ui-text-menu1 font-bold data-[state=active]:text-neutral-1300 text-neutral-1000 dark:data-[state=active]:text-neutral-000 dark:text-neutral-300 focus:outline-none focus-visible:outline-gui-focus transition-colors hover:text-neutral-1300 dark:hover:text-neutral-000 active:text-neutral-900 dark:active:text-neutral-400 disabled:text-gui-unavailable dark:disabled:text-gui-unavailable-dark disabled:cursor-not-allowed",{"flex-1":flexibleTabWidth},{"h-full":flexibleTabHeight},tabClassName),value:`tab-${index}`,onClick:event=>handleTabClick(event,index),disabled:typeof tab==="object"?tab.disabled:false},typeof tab==="object"?tab.label:tab)),React.createElement("div",{className:cn("absolute bottom-0 bg-neutral-1300 dark:bg-neutral-000 h-[3px] w-24",{"transition-[transform,width]":animated}),style:{transform:`translateX(${highlight.offset}px)`,width:`${highlight.width}px`}})),contents.map((content,index)=>React.createElement(Tabs.Content,{key:`tab-${index}`,value:`tab-${index}`,className:contentClassName},content)))};export default TabMenu;
|
|
2
|
+
//# sourceMappingURL=TabMenu.js.map
|