@ably/ui 14.0.5 → 14.0.6
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/core/Flash.js +1 -1
- package/package.json +7 -9
- package/src/core/Accordion/Accordion.stories.tsx +0 -39
- package/src/core/Accordion.tsx +0 -149
- package/src/core/Code/Code.stories.tsx +0 -71
- package/src/core/Code/component.css +0 -1
- package/src/core/Code/component.js +0 -27
- package/src/core/Code.tsx +0 -44
- package/src/core/ConnectStateWrapper.tsx +0 -43
- package/src/core/ContactFooter/ContactFooter.stories.tsx +0 -11
- package/src/core/ContactFooter/component.css +0 -11
- package/src/core/ContactFooter/component.js +0 -2
- package/src/core/ContactFooter.tsx +0 -91
- package/src/core/CookieMessage/CookieMessage.stories.tsx +0 -12
- package/src/core/CookieMessage/component.css +0 -15
- package/src/core/CookieMessage.tsx +0 -52
- package/src/core/CustomerLogos/CustomerLogos.stories.tsx +0 -43
- package/src/core/CustomerLogos.tsx +0 -35
- package/src/core/DropdownMenu/DropdownMenu.stories.tsx +0 -48
- package/src/core/DropdownMenu.tsx +0 -140
- package/src/core/Expander/Expander.stories.tsx +0 -132
- package/src/core/Expander.tsx +0 -63
- package/src/core/FeaturedLink/FeaturedLink.stories.tsx +0 -43
- package/src/core/FeaturedLink.tsx +0 -93
- package/src/core/Flash/Flash.stories.tsx +0 -37
- package/src/core/Flash/component.css +0 -28
- package/src/core/Flash.tsx +0 -233
- package/src/core/Footer/Footer.stories.tsx +0 -26
- package/src/core/Footer/component.css +0 -33
- package/src/core/Footer.tsx +0 -535
- package/src/core/Icon/Icon.stories.tsx +0 -151
- package/src/core/Icon.tsx +0 -26
- package/src/core/Loader/Loader.stories.tsx +0 -21
- package/src/core/Loader.tsx +0 -52
- package/src/core/Logo/Logo.stories.tsx +0 -12
- package/src/core/Logo.tsx +0 -29
- package/src/core/Meganav/Meganav.stories.tsx +0 -86
- package/src/core/Meganav/component.css +0 -114
- package/src/core/Meganav/component.js +0 -150
- package/src/core/Meganav/component.json +0 -37
- package/src/core/Meganav.tsx +0 -225
- package/src/core/MeganavBlogPostsList/component.js +0 -43
- package/src/core/MeganavBlogPostsList.tsx +0 -41
- package/src/core/MeganavContentCompany.tsx +0 -166
- package/src/core/MeganavContentDevelopers.tsx +0 -210
- package/src/core/MeganavContentProducts.tsx +0 -163
- package/src/core/MeganavContentUseCases.tsx +0 -244
- package/src/core/MeganavControl/component.js +0 -117
- package/src/core/MeganavControl.tsx +0 -39
- package/src/core/MeganavControlMobileDropdown/component.js +0 -46
- package/src/core/MeganavControlMobileDropdown.tsx +0 -31
- package/src/core/MeganavControlMobilePanelClose/component.js +0 -36
- package/src/core/MeganavControlMobilePanelClose.tsx +0 -34
- package/src/core/MeganavControlMobilePanelOpen/component.js +0 -59
- package/src/core/MeganavControlMobilePanelOpen.tsx +0 -31
- package/src/core/MeganavItemsDesktop.tsx +0 -68
- package/src/core/MeganavItemsMobile.tsx +0 -197
- package/src/core/MeganavItemsSignedIn.tsx +0 -130
- package/src/core/MeganavSearch.tsx +0 -36
- package/src/core/MeganavSearchAutocomplete/component.js +0 -177
- package/src/core/MeganavSearchAutocomplete.tsx +0 -12
- package/src/core/MeganavSearchPanel.tsx +0 -52
- package/src/core/MeganavSearchSuggestions/component.js +0 -133
- package/src/core/MeganavSearchSuggestions.tsx +0 -62
- package/src/core/Notice/component.css +0 -7
- package/src/core/Notice/component.js +0 -154
- package/src/core/Notice.tsx +0 -102
- package/src/core/SignOutLink.tsx +0 -51
- package/src/core/Slider/Slider.stories.tsx +0 -98
- package/src/core/Slider/component.css +0 -40
- package/src/core/Slider/component.js +0 -105
- package/src/core/Slider.tsx +0 -224
- package/src/core/Table/Table.stories.tsx +0 -12
- package/src/core/Table/Table.tsx +0 -58
- package/src/core/Table/TableCell.tsx +0 -71
- package/src/core/Table/TableRow.tsx +0 -25
- package/src/core/Table/data.tsx +0 -133
- package/src/core/Table.tsx +0 -15
- package/src/core/Tooltip/Tooltip.stories.tsx +0 -27
- package/src/core/Tooltip.tsx +0 -88
- package/src/core/css.js +0 -3
- package/src/core/dom-query.js +0 -5
- package/src/core/fonts/NEXT-Book-Light-Italic.eot +0 -0
- package/src/core/fonts/NEXT-Book-Light-Italic.otf +0 -0
- package/src/core/fonts/NEXT-Book-Light-Italic.woff +0 -0
- package/src/core/fonts/NEXT-Book-Light-Italic.woff2 +0 -0
- package/src/core/fonts/NEXT-Book-Light.eot +0 -0
- package/src/core/fonts/NEXT-Book-Light.otf +0 -0
- package/src/core/fonts/NEXT-Book-Light.woff +0 -0
- package/src/core/fonts/NEXT-Book-Light.woff2 +0 -0
- package/src/core/fonts/NEXT-Book-Medium-Italic.eot +0 -0
- package/src/core/fonts/NEXT-Book-Medium-Italic.otf +0 -0
- package/src/core/fonts/NEXT-Book-Medium-Italic.woff +0 -0
- package/src/core/fonts/NEXT-Book-Medium-Italic.woff2 +0 -0
- package/src/core/fonts/NEXT-Book-Medium.eot +0 -0
- package/src/core/fonts/NEXT-Book-Medium.otf +0 -0
- package/src/core/fonts/NEXT-Book-Medium.woff +0 -0
- package/src/core/fonts/NEXT-Book-Medium.woff2 +0 -0
- package/src/core/fonts/jetBrains-mono.css +0 -3
- package/src/core/fonts/manrope.css +0 -3
- package/src/core/fonts/next.css +0 -63
- package/src/core/fonts/source-code-pro.css +0 -3
- package/src/core/hubspot-chat-toggle.js +0 -67
- package/src/core/icons/discord.svg +0 -10
- package/src/core/icons/facebook.svg +0 -4
- package/src/core/icons/github.svg +0 -3
- package/src/core/icons/glassdoor.svg +0 -3
- package/src/core/icons/google.svg +0 -3
- package/src/core/icons/icon-display-48hrs.svg +0 -3
- package/src/core/icons/icon-display-about-ably-col.svg +0 -4
- package/src/core/icons/icon-display-api-keys.svg +0 -3
- package/src/core/icons/icon-display-api.svg +0 -3
- package/src/core/icons/icon-display-asset-tracking-col.svg +0 -18
- package/src/core/icons/icon-display-browser.svg +0 -10
- package/src/core/icons/icon-display-calendar.svg +0 -3
- package/src/core/icons/icon-display-call-mobile.svg +0 -3
- package/src/core/icons/icon-display-careers-col.svg +0 -9
- package/src/core/icons/icon-display-case-studies-col.svg +0 -5
- package/src/core/icons/icon-display-chat-col.svg +0 -4
- package/src/core/icons/icon-display-chat-stack-col.svg +0 -4
- package/src/core/icons/icon-display-chat-stack.svg +0 -4
- package/src/core/icons/icon-display-cloud-servers.svg +0 -3
- package/src/core/icons/icon-display-compare-tech-col.svg +0 -9
- package/src/core/icons/icon-display-customers-col.svg +0 -15
- package/src/core/icons/icon-display-data-broadcast-col.svg +0 -26
- package/src/core/icons/icon-display-data-synchronization-col.svg +0 -14
- package/src/core/icons/icon-display-docs-col.svg +0 -7
- package/src/core/icons/icon-display-documentation.svg +0 -3
- package/src/core/icons/icon-display-events-col.svg +0 -13
- package/src/core/icons/icon-display-examples-col.svg +0 -11
- package/src/core/icons/icon-display-gdpr.svg +0 -3
- package/src/core/icons/icon-display-general-comms.svg +0 -3
- package/src/core/icons/icon-display-hipaa.svg +0 -10
- package/src/core/icons/icon-display-integrations-col.svg +0 -8
- package/src/core/icons/icon-display-it-support-access.svg +0 -3
- package/src/core/icons/icon-display-it-support-helpdesk.svg +0 -3
- package/src/core/icons/icon-display-kafka-at-the-edge-col.svg +0 -8
- package/src/core/icons/icon-display-laptop.svg +0 -10
- package/src/core/icons/icon-display-lightbulb-col.svg +0 -10
- package/src/core/icons/icon-display-live-chat.svg +0 -3
- package/src/core/icons/icon-display-map-pin.svg +0 -3
- package/src/core/icons/icon-display-message.svg +0 -3
- package/src/core/icons/icon-display-padlock-closed.svg +0 -3
- package/src/core/icons/icon-display-platform.svg +0 -22
- package/src/core/icons/icon-display-play.svg +0 -3
- package/src/core/icons/icon-display-privacy-shield-framework.svg +0 -7
- package/src/core/icons/icon-display-push-notifications-col.svg +0 -6
- package/src/core/icons/icon-display-quickstart-guides-col.svg +0 -8
- package/src/core/icons/icon-display-resources-col.svg +0 -21
- package/src/core/icons/icon-display-sdks-col.svg +0 -11
- package/src/core/icons/icon-display-servers.svg +0 -3
- package/src/core/icons/icon-display-shopping-cart.svg +0 -10
- package/src/core/icons/icon-display-sla.svg +0 -3
- package/src/core/icons/icon-display-soc2-type2.svg +0 -3
- package/src/core/icons/icon-display-tech-account-comms.svg +0 -3
- package/src/core/icons/icon-display-tutorials-demos-col.svg +0 -25
- package/src/core/icons/icon-display-virtual-events-col.svg +0 -12
- package/src/core/icons/icon-display-virtual-events.svg +0 -12
- package/src/core/icons/icon-gui-ably-badge.svg +0 -3
- package/src/core/icons/icon-gui-arrow-bidirectional-horizontal.svg +0 -3
- package/src/core/icons/icon-gui-arrow-bidirectional-vertical.svg +0 -3
- package/src/core/icons/icon-gui-arrow-down.svg +0 -3
- package/src/core/icons/icon-gui-arrow-left.svg +0 -3
- package/src/core/icons/icon-gui-arrow-right.svg +0 -3
- package/src/core/icons/icon-gui-arrow-up.svg +0 -3
- package/src/core/icons/icon-gui-burger-menu.svg +0 -5
- package/src/core/icons/icon-gui-check-circled-fill-black.svg +0 -4
- package/src/core/icons/icon-gui-check-circled-fill.svg +0 -4
- package/src/core/icons/icon-gui-check-circled.svg +0 -3
- package/src/core/icons/icon-gui-checklist-checked.svg +0 -3
- package/src/core/icons/icon-gui-clock.svg +0 -3
- package/src/core/icons/icon-gui-close.svg +0 -3
- package/src/core/icons/icon-gui-copy.svg +0 -10
- package/src/core/icons/icon-gui-cross-circled-fill.svg +0 -4
- package/src/core/icons/icon-gui-cross-circled.svg +0 -3
- package/src/core/icons/icon-gui-dash-circled.svg +0 -3
- package/src/core/icons/icon-gui-disclosure-arrow.svg +0 -3
- package/src/core/icons/icon-gui-document-generic.svg +0 -3
- package/src/core/icons/icon-gui-enlarge.svg +0 -3
- package/src/core/icons/icon-gui-external-link.svg +0 -3
- package/src/core/icons/icon-gui-filter-flow-step-1.svg +0 -5
- package/src/core/icons/icon-gui-filter-flow-step-2.svg +0 -5
- package/src/core/icons/icon-gui-filter-flow-step-3.svg +0 -5
- package/src/core/icons/icon-gui-history.svg +0 -3
- package/src/core/icons/icon-gui-info.svg +0 -3
- package/src/core/icons/icon-gui-link-arrow.svg +0 -3
- package/src/core/icons/icon-gui-link.svg +0 -4
- package/src/core/icons/icon-gui-live-chat.svg +0 -3
- package/src/core/icons/icon-gui-minus.svg +0 -3
- package/src/core/icons/icon-gui-partial.svg +0 -4
- package/src/core/icons/icon-gui-plus.svg +0 -3
- package/src/core/icons/icon-gui-quote-marks-solid.svg +0 -3
- package/src/core/icons/icon-gui-refresh.svg +0 -10
- package/src/core/icons/icon-gui-resources.svg +0 -3
- package/src/core/icons/icon-gui-search.svg +0 -3
- package/src/core/icons/icon-gui-tick.svg +0 -3
- package/src/core/icons/icon-gui-warning.svg +0 -5
- package/src/core/icons/icon-live-updates-results-metrics-col.svg +0 -26
- package/src/core/icons/icon-multi-user-spaces-col.svg +0 -13
- package/src/core/icons/icon-social-x.svg +0 -3
- package/src/core/icons/icon-tech-apachekafka.svg +0 -3
- package/src/core/icons/linkedin.svg +0 -3
- package/src/core/icons/quote.svg +0 -3
- package/src/core/icons/stackoverflow.svg +0 -3
- package/src/core/icons/twitter.svg +0 -3
- package/src/core/icons/youtube.svg +0 -11
- package/src/core/icons.js +0 -6
- package/src/core/images/ably-logo.png +0 -0
- package/src/core/images/ably-logo.svg +0 -15
- package/src/core/images/ably-stack.svg +0 -14
- package/src/core/images/best-support-2023.svg +0 -1
- package/src/core/images/cust-logo-ao-col-pos.png +0 -0
- package/src/core/images/cust-logo-ao-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-ausopen-col-pos.png +0 -0
- package/src/core/images/cust-logo-ausopen-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-ausopen-mono-pos.svg +0 -5
- package/src/core/images/cust-logo-bloomberg-mono-pos.svg +0 -11
- package/src/core/images/cust-logo-hopin-mono-pos.svg +0 -4
- package/src/core/images/cust-logo-hubspot-col-pos.png +0 -0
- package/src/core/images/cust-logo-hubspot-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-hubspot-mono-pos.svg +0 -4
- package/src/core/images/cust-logo-lightspeed-col-pos.png +0 -0
- package/src/core/images/cust-logo-lightspeed-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-lightspeed-syst-col-pos.png +0 -0
- package/src/core/images/cust-logo-lightspeed-syst-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-mentimeter-mono-pos.svg +0 -17
- package/src/core/images/cust-logo-split-col-pos.png +0 -0
- package/src/core/images/cust-logo-split-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-split-mono-pos.svg +0 -9
- package/src/core/images/cust-logo-toyota-mono-pos.svg +0 -18
- package/src/core/images/cust-logo-vitac-col-pos.png +0 -0
- package/src/core/images/cust-logo-vitac-col-pos@2x.png +0 -0
- package/src/core/images/cust-logo-webflow-col-pos.svg +0 -3
- package/src/core/images/cust-photo-hubspot-max-freiert.jpg +0 -0
- package/src/core/images/cust-photo-split-pato-echague.jpg +0 -0
- package/src/core/images/cust-photo-vitac-joe-antonio.jpg +0 -0
- package/src/core/images/fastest-implementation-2023.svg +0 -1
- package/src/core/images/flexible-companies.png +0 -0
- package/src/core/images/high-performer-2022.png +0 -0
- package/src/core/images/high-performer-2023.svg +0 -1
- package/src/core/images/highest-user-adoption-2022.png +0 -0
- package/src/core/images/highest-user-adoption-2023.svg +0 -1
- package/src/core/images/icon-tech-aws.svg +0 -4
- package/src/core/images/rocket-list-2021.png +0 -0
- package/src/core/images/scale-motif-open-empathetic.svg +0 -1
- package/src/core/images/technical-support-01-800x533.jpg +0 -0
- package/src/core/images/users-love-us-2022.png +0 -0
- package/src/core/load-sprites.js +0 -11
- package/src/core/react-renderer.tsx +0 -29
- package/src/core/remote-blogs-posts.js +0 -42
- package/src/core/remote-data-store.js +0 -34
- package/src/core/remote-data-util.js +0 -4
- package/src/core/remote-session-data.js +0 -58
- package/src/core/scripts.js +0 -10
- package/src/core/styles/buttons.css +0 -124
- package/src/core/styles/forms.css +0 -64
- package/src/core/styles/layout.css +0 -21
- package/src/core/styles/properties.css +0 -278
- package/src/core/styles/text.css +0 -168
- package/src/core/styles/toggles.css +0 -38
- package/src/core/styles.base.css +0 -1
- package/src/core/styles.components.css +0 -44
- package/src/core/styles.css +0 -2
- package/src/core/url-base.js +0 -7
- package/src/core/utils/syntax-highlighter-registry.js +0 -63
- package/src/core/utils/syntax-highlighter.css +0 -71
- package/src/core/utils/syntax-highlighter.js +0 -103
- package/src/pages/Buttons.mdx +0 -121
- package/src/pages/Chips.mdx +0 -136
- package/src/pages/Colour.mdx +0 -23
- package/src/pages/Forms.mdx +0 -219
- package/src/pages/Layout.mdx +0 -58
- package/src/pages/Toggles.mdx +0 -42
- package/src/pages/Typography.mdx +0 -206
- package/src/pages/utils.ts +0 -80
- package/src/reset/scripts.js +0 -1
- package/src/reset/styles/normalize.css +0 -353
- package/src/reset/styles/reset.css +0 -139
- package/src/reset/styles.css +0 -2
package/core/Flash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import React,{useEffect,useState,useRef}from"react";import DOMPurify from"dompurify";import{nanoid}from"nanoid/non-secure";import{getRemoteDataStore}from"./remote-data-store.js";import ConnectStateWrapper from"./ConnectStateWrapper";import Icon from"./Icon";const REDUCER_KEY="flashes";const FLASH_DATA_ID="ui-flashes";const initialState={items:[]};const reducerFlashes={[REDUCER_KEY]:(state=initialState,action)=>{switch(action.type){case"flash/push":{const flashes=Array.isArray(action.payload)?action.payload:[action.payload];return{items:[...state.items,...flashes]}}default:return state}}};const selectFlashes=store=>store.getState()[REDUCER_KEY];const FLASH_BG_COLOR={error:"bg-gui-error",success:"bg-zingy-green",notice:"bg-electric-cyan",info:"bg-electric-cyan",alert:"bg-active-orange"};const FLASH_TEXT_COLOR={error:"text-white",success:"text-cool-black",notice:"text-cool-black",info:"text-cool-black",alert:"text-white"};const AUTO_HIDE=["success","info","notice"];const AUTO_HIDE_TIME=8e3;const useAutoHide=(type,closeFlash)=>{const timeoutId=useRef(null);useEffect(()=>{if(AUTO_HIDE.includes(type)){timeoutId.current=setTimeout(()=>{closeFlash()},AUTO_HIDE_TIME)}return()=>{if(timeoutId.current){clearTimeout(timeoutId.current)}}},[])};const Flash=({id,type,content,removeFlash})=>{const ref=useRef(null);const[closed,setClosed]=useState(false);const[flashHeight,setFlashHeight]=useState(0);const[triggerEntryAnimation,setTriggerEntryAnimation]=useState(false);const closeFlash=()=>{if(ref.current){setFlashHeight(ref.current.getBoundingClientRect().height)}setClosed(true);setTimeout(()=>{id&&removeFlash(id)},100)};useEffect(()=>setTriggerEntryAnimation(true),[]);useAutoHide(type,closeFlash);const animateEntry=triggerEntryAnimation&&!closed;let style;if(flashHeight&&!closed){style={height:`${flashHeight}px`}}else if(closed){style={height:0,marginTop:0,zIndex:-1}}else{style={}}const safeContent=DOMPurify.sanitize(content,{ALLOWED_TAGS:["a"],ALLOWED_ATTR:["href","data-method","rel"]});const withIcons={notice:"icon-gui-ably-badge",success:"icon-gui-tick",error:"icon-gui-warning",alert:"icon-gui-warning"};const iconColor={notice:"text-cool-black",success:"text-cool-black",error:"text-white",alert:"text-white"};return React.createElement("div",{className:`ui-flash-message ui-grid-px ${animateEntry?"ui-flash-message-enter":""}`,style:style,ref:ref,"data-id":"ui-flash"},React.createElement("div",{className:`${FLASH_BG_COLOR[type]} p-32 flex align-center rounded shadow-container-subtle`},withIcons[type]&&React.createElement(Icon,{name:withIcons[type],color:iconColor[type],size:"1.5rem",additionalCSS:"mr-16 self-baseline"}),React.createElement("p",{className:`ui-text-p1 mr-16 ${FLASH_TEXT_COLOR[type]}`,dangerouslySetInnerHTML:{__html:safeContent}}),React.createElement("button",{type:"button",className:"p-0 ml-auto self-start focus:outline-none",onClick:closeFlash},React.createElement(Icon,{name:"icon-gui-close",color:iconColor[type],size:"1.5rem",additionalCSS:"transition-colors"}))))};const Flashes=({flashes})=>{const[flashesWithIds,setFlashesWithIds]=useState([]);const removeFlash=flashId=>setFlashesWithIds(items=>items.filter(item=>item.id!==flashId));useEffect(()=>{setFlashesWithIds(state=>{return[...state,...(flashes===null||flashes===void 0?void 0:flashes.items).map(flash=>({...flash,id:nanoid(),removed:false}))]})},[flashes]);return React.createElement("div",{className:"ui-flash","data-id":FLASH_DATA_ID},flashesWithIds.filter(item=>!item.removed).map(flash=>React.createElement(Flash,{key:flash.id,...flash,removeFlash:removeFlash})))};const BackendFlashes=({flashes})=>{useEffect(()=>{const transformedFlashes=flashes.map(flash=>{const[type,content]=flash;return{type,content}})||[];if(transformedFlashes.length>0){const store=getRemoteDataStore();store.dispatch({type:"flash/push",payload:transformedFlashes})}},[]);const WrappedFlashes=ConnectStateWrapper(Flashes,{flashes:selectFlashes});return React.createElement(WrappedFlashes,null)};export{reducerFlashes,FLASH_DATA_ID,Flashes};export default BackendFlashes;
|
|
1
|
+
import React,{useEffect,useState,useRef}from"react";import DOMPurify from"dompurify";import{nanoid}from"nanoid/non-secure";import{getRemoteDataStore}from"./remote-data-store.js";import ConnectStateWrapper from"./ConnectStateWrapper";import Icon from"./Icon";const REDUCER_KEY="flashes";const FLASH_DATA_ID="ui-flashes";const initialState={items:[]};const reducerFlashes={[REDUCER_KEY]:(state=initialState,action)=>{switch(action.type){case"flash/push":{const flashes=Array.isArray(action.payload)?action.payload:[action.payload];return{items:[...state.items,...flashes]}}default:return state}}};const selectFlashes=store=>store.getState()[REDUCER_KEY];const FLASH_BG_COLOR={error:"bg-gui-error",success:"bg-zingy-green",notice:"bg-electric-cyan",info:"bg-electric-cyan",alert:"bg-active-orange"};const FLASH_TEXT_COLOR={error:"text-white",success:"text-cool-black",notice:"text-cool-black",info:"text-cool-black",alert:"text-white"};const AUTO_HIDE=["success","info","notice"];const AUTO_HIDE_TIME=8e3;const useAutoHide=(type,closeFlash)=>{const timeoutId=useRef(null);useEffect(()=>{if(AUTO_HIDE.includes(type)){timeoutId.current=setTimeout(()=>{closeFlash()},AUTO_HIDE_TIME)}return()=>{if(timeoutId.current){clearTimeout(timeoutId.current)}}},[])};const Flash=({id,type,content,removeFlash})=>{const ref=useRef(null);const[closed,setClosed]=useState(false);const[flashHeight,setFlashHeight]=useState(0);const[triggerEntryAnimation,setTriggerEntryAnimation]=useState(false);const closeFlash=()=>{if(ref.current){setFlashHeight(ref.current.getBoundingClientRect().height)}setClosed(true);setTimeout(()=>{id&&removeFlash(id)},100)};useEffect(()=>setTriggerEntryAnimation(true),[]);useAutoHide(type,closeFlash);const animateEntry=triggerEntryAnimation&&!closed;let style;if(flashHeight&&!closed){style={height:`${flashHeight}px`}}else if(closed){style={height:0,marginTop:0,zIndex:-1}}else{style={}}const safeContent=DOMPurify.sanitize(content,{ALLOWED_TAGS:["a"],ALLOWED_ATTR:["href","data-method","rel"]});const withIcons={notice:"icon-gui-ably-badge",success:"icon-gui-tick",error:"icon-gui-warning",alert:"icon-gui-warning"};const iconColor={notice:"text-cool-black",success:"text-cool-black",error:"text-white",alert:"text-white"};return React.createElement("div",{className:`ui-flash-message ui-grid-px ${animateEntry?"ui-flash-message-enter":""}`,style:style,ref:ref,"data-id":"ui-flash"},React.createElement("div",{className:`${FLASH_BG_COLOR[type]} p-32 flex align-center rounded shadow-container-subtle`},withIcons[type]&&React.createElement(Icon,{name:withIcons[type],color:iconColor[type],size:"1.5rem",additionalCSS:"mr-16 self-baseline"}),React.createElement("p",{className:`ui-text-p1 mr-16 ${FLASH_TEXT_COLOR[type]}`,dangerouslySetInnerHTML:{__html:safeContent}}),React.createElement("button",{type:"button",className:"p-0 ml-auto self-start focus:outline-none",onClick:closeFlash},React.createElement(Icon,{name:"icon-gui-close",color:iconColor[type],size:"1.5rem",additionalCSS:"transition-colors"}))))};const Flashes=({flashes})=>{const[flashesWithIds,setFlashesWithIds]=useState([]);const removeFlash=flashId=>setFlashesWithIds(items=>items.filter(item=>item.id!==flashId));useEffect(()=>{setFlashesWithIds(state=>{var _flashes_items;return[...state,...((_flashes_items=flashes===null||flashes===void 0?void 0:flashes.items)!==null&&_flashes_items!==void 0?_flashes_items:[]).map(flash=>({...flash,id:nanoid(),removed:false}))]})},[flashes]);return React.createElement("div",{className:"ui-flash","data-id":FLASH_DATA_ID},flashesWithIds.filter(item=>!item.removed).map(flash=>React.createElement(Flash,{key:flash.id,...flash,removeFlash:removeFlash})))};const BackendFlashes=({flashes})=>{useEffect(()=>{const transformedFlashes=flashes.map(flash=>{const[type,content]=flash;return{type,content}})||[];if(transformedFlashes.length>0){const store=getRemoteDataStore();store.dispatch({type:"flash/push",payload:transformedFlashes})}},[]);const WrappedFlashes=ConnectStateWrapper(Flashes,{flashes:selectFlashes});return React.createElement(WrappedFlashes,null)};export{reducerFlashes,FLASH_DATA_ID,Flashes};export default BackendFlashes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ably/ui",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.6",
|
|
4
4
|
"description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"files": [
|
|
11
|
-
"src",
|
|
12
11
|
"core",
|
|
13
12
|
"reset",
|
|
14
13
|
"tailwind.config.js",
|
|
@@ -25,15 +24,14 @@
|
|
|
25
24
|
"@storybook/test": "^8.1.7",
|
|
26
25
|
"@swc/cli": "^0.3.10",
|
|
27
26
|
"@swc/core": "^1.4.11",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
29
28
|
"@typescript-eslint/parser": "^6.21.0",
|
|
30
29
|
"@vitejs/plugin-react": "^4.2.1",
|
|
31
30
|
"autoprefixer": "^10.0.2",
|
|
32
31
|
"cypress": "^13.3.1",
|
|
33
|
-
"eslint": "^
|
|
32
|
+
"eslint": "^8.57.0",
|
|
34
33
|
"eslint-config-prettier": "^9.1.0",
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"eslint-plugin-react": "^7.21.5",
|
|
34
|
+
"eslint-plugin-react": "^7.34.3",
|
|
37
35
|
"eslint-plugin-storybook": "^0.8.0",
|
|
38
36
|
"msw": "2.3.1",
|
|
39
37
|
"msw-storybook-addon": "^2.0.2",
|
|
@@ -51,9 +49,9 @@
|
|
|
51
49
|
"build:cleanup": "mv dist/* . && rm -r dist",
|
|
52
50
|
"build": "yarn build:prebuild && yarn build:swc && yarn build:sprites && yarn build:cleanup",
|
|
53
51
|
"watch": "yarn build:swc -w",
|
|
54
|
-
"format:check": "prettier -c *.{js,ts} src/**/*.{js,ts,tsx}
|
|
55
|
-
"format:write": "prettier -w *.{js,ts} src/**/*.{js,ts,tsx}
|
|
56
|
-
"lint": "eslint *.{js,ts} src/**/*.{js,ts,tsx}
|
|
52
|
+
"format:check": "prettier -c *.{js,ts} src/**/*.{js,ts,tsx}",
|
|
53
|
+
"format:write": "prettier -w *.{js,ts} src/**/*.{js,ts,tsx}",
|
|
54
|
+
"lint": "eslint *.{js,ts} src/**/*.{js,ts,tsx}",
|
|
57
55
|
"cy:open": "cypress open",
|
|
58
56
|
"cy:headless": "cypress run --quiet",
|
|
59
57
|
"update:all": "./scripts/update-dependents.sh",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Accordion, { AccordionProps } from "../Accordion";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Accordion",
|
|
6
|
-
component: Accordion,
|
|
7
|
-
args: {
|
|
8
|
-
data: [
|
|
9
|
-
{
|
|
10
|
-
name: "Item 1",
|
|
11
|
-
content: "Content 1",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "Item 2",
|
|
15
|
-
content: "Content 2",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "Item 3",
|
|
19
|
-
content: "Content 3",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "Item 4",
|
|
23
|
-
content: "Content 4",
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
autoClose: false,
|
|
27
|
-
topBorder: false,
|
|
28
|
-
bottomBorder: false,
|
|
29
|
-
arrowIcon: false,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Default = {};
|
|
34
|
-
|
|
35
|
-
export const AutoClose = {
|
|
36
|
-
render: (args: AccordionProps) => (
|
|
37
|
-
<Accordion data={args.data} autoClose={true} />
|
|
38
|
-
),
|
|
39
|
-
};
|
package/src/core/Accordion.tsx
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import React, { useState, ReactNode, JSX } from "react";
|
|
2
|
-
import Icon from "./Icon";
|
|
3
|
-
|
|
4
|
-
type AccordionData = {
|
|
5
|
-
name: string;
|
|
6
|
-
content: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type AccordionRowProps = {
|
|
10
|
-
bottomBorder?: boolean;
|
|
11
|
-
topBorder?: boolean;
|
|
12
|
-
active: boolean;
|
|
13
|
-
last: boolean;
|
|
14
|
-
name: string;
|
|
15
|
-
index;
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
arrowIcon?: boolean;
|
|
18
|
-
setActiveIndex: (index: number) => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type AccordionProps = {
|
|
22
|
-
data: AccordionData[];
|
|
23
|
-
arrowIcon?: boolean;
|
|
24
|
-
topBorder?: boolean;
|
|
25
|
-
bottomBorder?: boolean;
|
|
26
|
-
id?: string;
|
|
27
|
-
autoClose?: boolean;
|
|
28
|
-
className?: string;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const AccordionRow = ({
|
|
32
|
-
name,
|
|
33
|
-
children,
|
|
34
|
-
index,
|
|
35
|
-
setActiveIndex,
|
|
36
|
-
active,
|
|
37
|
-
topBorder,
|
|
38
|
-
bottomBorder,
|
|
39
|
-
last,
|
|
40
|
-
arrowIcon,
|
|
41
|
-
}: AccordionRowProps) => {
|
|
42
|
-
let iconActive: JSX.Element, iconInactive: JSX.Element;
|
|
43
|
-
const handleSetIndex = () => {
|
|
44
|
-
setActiveIndex(index);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
if (arrowIcon) {
|
|
48
|
-
iconActive = (
|
|
49
|
-
<Icon
|
|
50
|
-
name="icon-gui-disclosure-arrow"
|
|
51
|
-
color="text-dark-grey"
|
|
52
|
-
size="1.5rem"
|
|
53
|
-
additionalCSS="-rotate-90"
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
iconInactive = (
|
|
57
|
-
<Icon
|
|
58
|
-
name="icon-gui-disclosure-arrow"
|
|
59
|
-
color="text-dark-grey"
|
|
60
|
-
size="1.5rem"
|
|
61
|
-
additionalCSS="rotate-90"
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
} else {
|
|
65
|
-
iconActive = (
|
|
66
|
-
<Icon name="icon-gui-minus" color="text-dark-grey" size="1.5rem" />
|
|
67
|
-
);
|
|
68
|
-
iconInactive = (
|
|
69
|
-
<Icon name="icon-gui-plus" color="text-dark-grey" size="1.5rem" />
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
className={`border-mid-grey ${last && !bottomBorder ? "" : "border-b"} ${
|
|
76
|
-
topBorder ? "border-t" : ""
|
|
77
|
-
}`}
|
|
78
|
-
>
|
|
79
|
-
<button
|
|
80
|
-
type="button"
|
|
81
|
-
onClick={handleSetIndex}
|
|
82
|
-
className={`flex w-full px-0 focus:outline-none py-20`}
|
|
83
|
-
>
|
|
84
|
-
<span className="ui-text-p1 font-bold text-left mr-8">{name}</span>
|
|
85
|
-
<span className="ml-auto">{active ? iconActive : iconInactive}</span>
|
|
86
|
-
</button>
|
|
87
|
-
|
|
88
|
-
<section
|
|
89
|
-
className="ui-text-p2 transition-all overflow-hidden"
|
|
90
|
-
style={{
|
|
91
|
-
maxHeight: active ? "500px" : "0",
|
|
92
|
-
paddingBottom: active ? "1.5rem" : "0",
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{children}
|
|
96
|
-
</section>
|
|
97
|
-
</div>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const Accordion = ({
|
|
102
|
-
data,
|
|
103
|
-
id = "id-accordion",
|
|
104
|
-
topBorder,
|
|
105
|
-
bottomBorder,
|
|
106
|
-
arrowIcon,
|
|
107
|
-
autoClose,
|
|
108
|
-
className,
|
|
109
|
-
}: AccordionProps) => {
|
|
110
|
-
const [activeIndexes, setActiveIndexes] = useState<number[]>([]);
|
|
111
|
-
|
|
112
|
-
const handleSetIndex = (index: number) => {
|
|
113
|
-
const currentIndexIsActive = activeIndexes.includes(index);
|
|
114
|
-
|
|
115
|
-
if (autoClose) {
|
|
116
|
-
setActiveIndexes(currentIndexIsActive ? [] : [index]);
|
|
117
|
-
} else {
|
|
118
|
-
setActiveIndexes(
|
|
119
|
-
currentIndexIsActive
|
|
120
|
-
? activeIndexes.filter((i) => i !== index)
|
|
121
|
-
: [...activeIndexes, index],
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<div className={className} id={id}>
|
|
128
|
-
{data.map((item, currentIndex) => {
|
|
129
|
-
return (
|
|
130
|
-
<AccordionRow
|
|
131
|
-
key={item.name}
|
|
132
|
-
name={item.name}
|
|
133
|
-
arrowIcon={arrowIcon}
|
|
134
|
-
index={currentIndex}
|
|
135
|
-
last={data.length === currentIndex + 1}
|
|
136
|
-
topBorder={topBorder && currentIndex === 0}
|
|
137
|
-
bottomBorder={bottomBorder && data.length === currentIndex + 1}
|
|
138
|
-
active={activeIndexes.includes(currentIndex)}
|
|
139
|
-
setActiveIndex={handleSetIndex}
|
|
140
|
-
>
|
|
141
|
-
{item.content}
|
|
142
|
-
</AccordionRow>
|
|
143
|
-
);
|
|
144
|
-
})}
|
|
145
|
-
</div>
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export default Accordion;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import Code from "../Code";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/Code",
|
|
5
|
-
component: Code,
|
|
6
|
-
tags: ["autodocs"],
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const Javascript = {
|
|
10
|
-
args: {
|
|
11
|
-
language: "javascript",
|
|
12
|
-
snippet: `var ably = new Ably.Realtime('1WChTA.mc0Biw:kNfiYG4KiPgmHHgH');
|
|
13
|
-
var channel = ably.channels.get('web-pal');
|
|
14
|
-
|
|
15
|
-
// Subscribe to messages on channel
|
|
16
|
-
channel.subscribe('greeting', function(message) {
|
|
17
|
-
alert(message.data);
|
|
18
|
-
});`,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Swift = {
|
|
23
|
-
args: {
|
|
24
|
-
language: "swift",
|
|
25
|
-
snippet: `let ably = ARTRealtime(key: "1WChTA.mc0Biw:kNfiYG4KiPgmHHgH")
|
|
26
|
-
let channel = ably.channels.get("web-pal")
|
|
27
|
-
|
|
28
|
-
// Subscribe to messages on channel
|
|
29
|
-
channel.subscribe("greeting") { message in
|
|
30
|
-
print("\\(message.data)")
|
|
31
|
-
}`,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const Java = {
|
|
36
|
-
args: {
|
|
37
|
-
language: "java",
|
|
38
|
-
snippet: `AblyRealtime ably = new AblyRealtime("1WChTA.mc0Biw:kNfiYG4KiPgmHHgH");
|
|
39
|
-
Channel channel = ably.channels.get("web-pal");
|
|
40
|
-
|
|
41
|
-
/* Subscribe to messages on channel */
|
|
42
|
-
|
|
43
|
-
MessageListener listener;
|
|
44
|
-
listener = new MessageListener() {
|
|
45
|
-
@Override
|
|
46
|
-
public void onMessage(Message message) {
|
|
47
|
-
System.out.print(message.data);
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
channel.subscribe("greeting", listener);`,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Kotlin = {
|
|
55
|
-
args: {
|
|
56
|
-
language: "kotlin",
|
|
57
|
-
snippet: `var ably = new Ably.Realtime('1WChTA.mc0Biw:kNfiYG4KiPgmHHgH');
|
|
58
|
-
val exampleConstraints = DefaultResolutionConstraints(
|
|
59
|
-
DefaultResolutionSet( // this constructor provides one Resolution for all states
|
|
60
|
-
Resolution(
|
|
61
|
-
accuracy = Accuracy.BALANCED,
|
|
62
|
-
desiredInterval = 1000L,
|
|
63
|
-
minimumDisplacement = 1.0
|
|
64
|
-
)
|
|
65
|
-
),
|
|
66
|
-
proximityThreshold = DefaultProximity(spatial = 1.0),
|
|
67
|
-
batteryLevelThreshold = 10.0f,
|
|
68
|
-
lowBatteryMultiplier = 2.0f
|
|
69
|
-
)`,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "../utils/syntax-highlighter.css";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Note: importing syntax-highlighter here means the component.js file will include
|
|
2
|
-
// all the language dependecies, creating a large a bundle. Prefer using the highlighter serverside.
|
|
3
|
-
import {
|
|
4
|
-
highlightSnippet,
|
|
5
|
-
registerDefaultLanguages,
|
|
6
|
-
} from "../utils/syntax-highlighter";
|
|
7
|
-
|
|
8
|
-
import languagesRegistry from "../utils/syntax-highlighter-registry";
|
|
9
|
-
|
|
10
|
-
registerDefaultLanguages(languagesRegistry);
|
|
11
|
-
|
|
12
|
-
function highlightEl(el) {
|
|
13
|
-
if (!el) throw "Missing code element";
|
|
14
|
-
|
|
15
|
-
const pre = el.querySelector("pre");
|
|
16
|
-
const code = el.querySelector("code");
|
|
17
|
-
const language = pre.getAttribute("lang");
|
|
18
|
-
|
|
19
|
-
if (!code || !pre || !language) throw "Malformed code element";
|
|
20
|
-
|
|
21
|
-
const { innerHTML } = code;
|
|
22
|
-
const html = highlightSnippet(language, innerHTML);
|
|
23
|
-
|
|
24
|
-
code.innerHTML = html;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default highlightEl;
|
package/src/core/Code.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
highlightSnippet,
|
|
5
|
-
registerDefaultLanguages,
|
|
6
|
-
} from "./utils/syntax-highlighter";
|
|
7
|
-
import languagesRegistry from "./utils/syntax-highlighter-registry";
|
|
8
|
-
|
|
9
|
-
registerDefaultLanguages(languagesRegistry);
|
|
10
|
-
|
|
11
|
-
type CodeProps = {
|
|
12
|
-
language: string;
|
|
13
|
-
snippet: string;
|
|
14
|
-
textSize?: string;
|
|
15
|
-
padding?: string;
|
|
16
|
-
additionalCSS?: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Code = ({
|
|
20
|
-
language,
|
|
21
|
-
snippet,
|
|
22
|
-
textSize = "ui-text-code",
|
|
23
|
-
padding = "p-32",
|
|
24
|
-
additionalCSS = "",
|
|
25
|
-
}: CodeProps) => {
|
|
26
|
-
const HTMLraw = highlightSnippet(language, `${snippet}`.trim()) ?? "";
|
|
27
|
-
const className = `language-${language} ${textSize}`;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div
|
|
31
|
-
className={`hljs overflow-auto ${padding} ${additionalCSS}`}
|
|
32
|
-
data-id="code"
|
|
33
|
-
>
|
|
34
|
-
<pre lang={language}>
|
|
35
|
-
<code
|
|
36
|
-
className={className}
|
|
37
|
-
dangerouslySetInnerHTML={{ __html: HTMLraw }}
|
|
38
|
-
/>
|
|
39
|
-
</pre>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default Code;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { connectState, getRemoteDataStore } from "./remote-data-store";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Connect a react component to a global store.
|
|
7
|
-
This is similar to what react-redux does but uses our global store so
|
|
8
|
-
can share state with other React mount points or anything that uses the
|
|
9
|
-
store.
|
|
10
|
-
- selectors is an object where keys are your prop names and values are your select
|
|
11
|
-
functions that work on the store to retrieve the state you are interested in
|
|
12
|
-
- initial state is set in useEffect so the wrapped component needs to handle it's props set to undefined initially
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const ConnectStateWrapper = (Component, selectors) => {
|
|
16
|
-
const [state, setState] = useState({});
|
|
17
|
-
|
|
18
|
-
const setStateForKey = (key) => (storeState) =>
|
|
19
|
-
setState(() => ({ [key]: storeState }));
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const store = getRemoteDataStore();
|
|
23
|
-
const resolvedState = Object.keys(selectors).reduce(
|
|
24
|
-
(acc, key) => ({ ...acc, [key]: selectors[key](store) }),
|
|
25
|
-
{},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
// Set initial state
|
|
29
|
-
setState(resolvedState);
|
|
30
|
-
|
|
31
|
-
// Create a store subscription for each selector. Depending on your use case, this can be inefficient.
|
|
32
|
-
// When optimising for renders, look for wins with selectors better for your use and using connectState directly.
|
|
33
|
-
Object.keys(selectors).forEach((key) => {
|
|
34
|
-
connectState(selectors[key], setStateForKey(key));
|
|
35
|
-
});
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
const WrappedComponent = (props) => <Component {...props} {...state} />;
|
|
39
|
-
|
|
40
|
-
return WrappedComponent;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default ConnectStateWrapper;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
.ui-contact-footer {
|
|
3
|
-
background-size: 100% 100%;
|
|
4
|
-
background-position: right center;
|
|
5
|
-
@apply w-full bg-gradient-active-orange;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ui-contact-footer-box {
|
|
9
|
-
@apply p-24 sm:p-32 xl:p-40 bg-white flex flex-col justify-between rounded-sm;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
import Icon from "./Icon";
|
|
4
|
-
import _absUrl from "./url-base.js";
|
|
5
|
-
import toggleChatWidget from "./hubspot-chat-toggle";
|
|
6
|
-
|
|
7
|
-
type ContactFooterProps = {
|
|
8
|
-
urlBase: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const ContactFooter = ({ urlBase }: ContactFooterProps) => {
|
|
12
|
-
useEffect(() => toggleChatWidget({ dataId: "contact-footer" }), []);
|
|
13
|
-
const absUrl = (path) => _absUrl(path, urlBase);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
className="ui-contact-footer font-sans antialiased"
|
|
18
|
-
data-id="contact-footer"
|
|
19
|
-
>
|
|
20
|
-
<div className="w-full bp-lg max-w-screen-xl mx-auto py-64 grid grid-cols-1 md:grid-cols-3 ui-grid-gap ui-grid-px">
|
|
21
|
-
<div className="ui-contact-footer-box">
|
|
22
|
-
<Icon
|
|
23
|
-
name="icon-display-live-chat"
|
|
24
|
-
size="3rem"
|
|
25
|
-
additionalCSS="block mb-16"
|
|
26
|
-
/>
|
|
27
|
-
<div>
|
|
28
|
-
<div className="ui-text-h3 mb-24">Live Chat</div>
|
|
29
|
-
<p className="ui-text-p1">
|
|
30
|
-
Reach out team of experts over chat powered by Ably.
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
<button
|
|
34
|
-
type="button"
|
|
35
|
-
className="ui-btn-secondary self-start mt-16"
|
|
36
|
-
disabled
|
|
37
|
-
data-id="open-chat-widget"
|
|
38
|
-
data-enabled-label="Start a live chat"
|
|
39
|
-
data-disabled-label="Live chat unavailable"
|
|
40
|
-
>
|
|
41
|
-
Live chat unavailable
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div className="ui-contact-footer-box">
|
|
46
|
-
<Icon
|
|
47
|
-
name="icon-display-call-mobile"
|
|
48
|
-
size="3rem"
|
|
49
|
-
additionalCSS="block mb-16"
|
|
50
|
-
/>
|
|
51
|
-
<div className="flex-grow">
|
|
52
|
-
<div className="ui-text-h3 mb-24">Call us</div>
|
|
53
|
-
<p className="ui-text-p1">
|
|
54
|
-
<span className="block">
|
|
55
|
-
<strong className="font-bold">+1 877 434 5287</strong> (USA,
|
|
56
|
-
toll free)
|
|
57
|
-
</span>
|
|
58
|
-
<span className="block">
|
|
59
|
-
<strong className="font-bold">+44 20 3318 4689</strong> (UK)
|
|
60
|
-
</span>
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div className="ui-contact-footer-box">
|
|
66
|
-
<Icon
|
|
67
|
-
name="icon-display-tech-account-comms"
|
|
68
|
-
size="3rem"
|
|
69
|
-
additionalCSS="block mb-16"
|
|
70
|
-
/>
|
|
71
|
-
<div>
|
|
72
|
-
<div className="ui-text-h3 mb-24">
|
|
73
|
-
Technical and account support
|
|
74
|
-
</div>
|
|
75
|
-
<p className="ui-text-p1">
|
|
76
|
-
We're standing by to help with any questions or code.
|
|
77
|
-
</p>
|
|
78
|
-
</div>
|
|
79
|
-
<a
|
|
80
|
-
className="ui-btn-secondary self-start p-btn mt-16"
|
|
81
|
-
href={absUrl("/support")}
|
|
82
|
-
>
|
|
83
|
-
Get support now
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default ContactFooter;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
.ui-cookie-message {
|
|
3
|
-
@apply rounded-lg bg-white font-sans;
|
|
4
|
-
@apply justify-between items-center;
|
|
5
|
-
@apply opacity-100 z-50 bottom-0 fixed sm:flex;
|
|
6
|
-
@apply p-16 mb-16 ml-16;
|
|
7
|
-
max-width: 70vw;
|
|
8
|
-
box-shadow: 0px 24px 32px 0px #0000000d;
|
|
9
|
-
border: 1px solid var(--color-mid-grey);
|
|
10
|
-
border-left: 0.5rem solid var(--color-electric-cyan);
|
|
11
|
-
transition:
|
|
12
|
-
bottom 250ms ease-out,
|
|
13
|
-
opacity 150ms ease-out;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState } from "react";
|
|
2
|
-
import Cookie from "js-cookie";
|
|
3
|
-
|
|
4
|
-
import _absUrl from "./url-base";
|
|
5
|
-
|
|
6
|
-
const COOKIE_EXPIRY = 365;
|
|
7
|
-
|
|
8
|
-
type CookieMessageProps = {
|
|
9
|
-
cookieId: string;
|
|
10
|
-
urlBase: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const CookieMessage = ({ cookieId, urlBase }: CookieMessageProps) => {
|
|
14
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
15
|
-
const [hideCookieMessage, setHideCookieMessage] = useState(true);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const isCookieSet = Cookie.get(cookieId) ? true : false;
|
|
19
|
-
setHideCookieMessage(isCookieSet);
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
const handleClose = () => {
|
|
23
|
-
Cookie.set(cookieId, "1", { expires: COOKIE_EXPIRY });
|
|
24
|
-
|
|
25
|
-
ref.current?.classList.add("bottom-1", "opacity-0");
|
|
26
|
-
setTimeout(() => setHideCookieMessage(true), 500);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const absUrl = (path) => _absUrl(path, urlBase);
|
|
30
|
-
|
|
31
|
-
// Presume the message is hidden by default
|
|
32
|
-
if (hideCookieMessage) return null;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div className="ui-cookie-message" ref={ref}>
|
|
36
|
-
<p className="ui-text-p2 pr-32">
|
|
37
|
-
<a href={absUrl("/privacy")} className="underline">
|
|
38
|
-
How we use cookies
|
|
39
|
-
</a>{" "}
|
|
40
|
-
to improve your experience.
|
|
41
|
-
</p>
|
|
42
|
-
<button
|
|
43
|
-
className="ui-btn-secondary mt-12 sm:mt-0 whitespace-nowrap"
|
|
44
|
-
onClick={handleClose}
|
|
45
|
-
>
|
|
46
|
-
Accept and close
|
|
47
|
-
</button>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default CookieMessage;
|