@ably/ui 14.1.0-dev.30520a8 → 14.1.0-dev.708de27

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.
Files changed (309) hide show
  1. package/core/icons/icon-gui-dropdown-arrow.svg +3 -0
  2. package/core/sprites.svg +1 -1
  3. package/core/styles/forms.css +3 -8
  4. package/package.json +2 -1
  5. package/src/.DS_Store +0 -0
  6. package/src/core/.DS_Store +0 -0
  7. package/src/core/Accordion/.DS_Store +0 -0
  8. package/src/core/Accordion/Accordion.stories.tsx +39 -0
  9. package/src/core/Accordion.tsx +149 -0
  10. package/src/core/Code/.DS_Store +0 -0
  11. package/src/core/Code/Code.stories.tsx +71 -0
  12. package/src/core/Code/component.css +1 -0
  13. package/src/core/Code/component.js +27 -0
  14. package/src/core/Code.tsx +44 -0
  15. package/src/core/ConnectStateWrapper.tsx +43 -0
  16. package/src/core/ContactFooter/.DS_Store +0 -0
  17. package/src/core/ContactFooter/ContactFooter.stories.tsx +11 -0
  18. package/src/core/ContactFooter/component.css +11 -0
  19. package/src/core/ContactFooter/component.js +2 -0
  20. package/src/core/ContactFooter.tsx +91 -0
  21. package/src/core/CookieMessage/.DS_Store +0 -0
  22. package/src/core/CookieMessage/CookieMessage.stories.tsx +12 -0
  23. package/src/core/CookieMessage/component.css +15 -0
  24. package/src/core/CookieMessage.tsx +52 -0
  25. package/src/core/CustomerLogos/.DS_Store +0 -0
  26. package/src/core/CustomerLogos/CustomerLogos.stories.tsx +43 -0
  27. package/src/core/CustomerLogos.tsx +35 -0
  28. package/src/core/DropdownMenu/.DS_Store +0 -0
  29. package/src/core/DropdownMenu/DropdownMenu.stories.tsx +48 -0
  30. package/src/core/DropdownMenu.tsx +140 -0
  31. package/src/core/Expander/Expander.stories.tsx +132 -0
  32. package/src/core/Expander.tsx +63 -0
  33. package/src/core/FeaturedLink/.DS_Store +0 -0
  34. package/src/core/FeaturedLink/FeaturedLink.stories.tsx +43 -0
  35. package/src/core/FeaturedLink.tsx +93 -0
  36. package/src/core/Flash/.DS_Store +0 -0
  37. package/src/core/Flash/Flash.stories.tsx +37 -0
  38. package/src/core/Flash/component.css +28 -0
  39. package/src/core/Flash.tsx +233 -0
  40. package/src/core/Footer/.DS_Store +0 -0
  41. package/src/core/Footer/Footer.stories.tsx +26 -0
  42. package/src/core/Footer/component.css +33 -0
  43. package/src/core/Footer.tsx +535 -0
  44. package/src/core/Icon/.DS_Store +0 -0
  45. package/src/core/Icon/Icon.stories.tsx +151 -0
  46. package/src/core/Icon.tsx +26 -0
  47. package/src/core/Loader/.DS_Store +0 -0
  48. package/src/core/Loader/Loader.stories.tsx +21 -0
  49. package/src/core/Loader.tsx +52 -0
  50. package/src/core/Logo/.DS_Store +0 -0
  51. package/src/core/Logo/Logo.stories.tsx +12 -0
  52. package/src/core/Logo.tsx +29 -0
  53. package/src/core/Meganav/.DS_Store +0 -0
  54. package/src/core/Meganav/Meganav.stories.tsx +86 -0
  55. package/src/core/Meganav/component.css +114 -0
  56. package/src/core/Meganav/component.js +150 -0
  57. package/src/core/Meganav/component.json +37 -0
  58. package/src/core/Meganav.tsx +225 -0
  59. package/src/core/MeganavBlogPostsList/.DS_Store +0 -0
  60. package/src/core/MeganavBlogPostsList/component.js +43 -0
  61. package/src/core/MeganavBlogPostsList.tsx +41 -0
  62. package/src/core/MeganavContentCompany.tsx +166 -0
  63. package/src/core/MeganavContentDevelopers.tsx +210 -0
  64. package/src/core/MeganavContentProducts.tsx +163 -0
  65. package/src/core/MeganavContentUseCases.tsx +244 -0
  66. package/src/core/MeganavControl/.DS_Store +0 -0
  67. package/src/core/MeganavControl/component.js +117 -0
  68. package/src/core/MeganavControl.tsx +39 -0
  69. package/src/core/MeganavControlMobileDropdown/.DS_Store +0 -0
  70. package/src/core/MeganavControlMobileDropdown/component.js +46 -0
  71. package/src/core/MeganavControlMobileDropdown.tsx +31 -0
  72. package/src/core/MeganavControlMobilePanelClose/.DS_Store +0 -0
  73. package/src/core/MeganavControlMobilePanelClose/component.js +36 -0
  74. package/src/core/MeganavControlMobilePanelClose.tsx +34 -0
  75. package/src/core/MeganavControlMobilePanelOpen/.DS_Store +0 -0
  76. package/src/core/MeganavControlMobilePanelOpen/component.js +59 -0
  77. package/src/core/MeganavControlMobilePanelOpen.tsx +31 -0
  78. package/src/core/MeganavItemsDesktop.tsx +68 -0
  79. package/src/core/MeganavItemsMobile.tsx +197 -0
  80. package/src/core/MeganavItemsSignedIn.tsx +130 -0
  81. package/src/core/MeganavSearch.tsx +36 -0
  82. package/src/core/MeganavSearchAutocomplete/.DS_Store +0 -0
  83. package/src/core/MeganavSearchAutocomplete/component.js +177 -0
  84. package/src/core/MeganavSearchAutocomplete.tsx +12 -0
  85. package/src/core/MeganavSearchPanel.tsx +52 -0
  86. package/src/core/MeganavSearchSuggestions/.DS_Store +0 -0
  87. package/src/core/MeganavSearchSuggestions/component.js +133 -0
  88. package/src/core/MeganavSearchSuggestions.tsx +62 -0
  89. package/src/core/Notice/.DS_Store +0 -0
  90. package/src/core/Notice/component.css +7 -0
  91. package/src/core/Notice/component.js +154 -0
  92. package/src/core/Notice.tsx +102 -0
  93. package/src/core/SignOutLink.tsx +51 -0
  94. package/src/core/Slider/.DS_Store +0 -0
  95. package/src/core/Slider/Slider.stories.tsx +98 -0
  96. package/src/core/Slider/component.css +40 -0
  97. package/src/core/Slider/component.js +105 -0
  98. package/src/core/Slider.tsx +224 -0
  99. package/src/core/Table/.DS_Store +0 -0
  100. package/src/core/Table/Table.stories.tsx +12 -0
  101. package/src/core/Table/Table.tsx +58 -0
  102. package/src/core/Table/TableCell.tsx +71 -0
  103. package/src/core/Table/TableRow.tsx +25 -0
  104. package/src/core/Table/data.tsx +133 -0
  105. package/src/core/Table.tsx +15 -0
  106. package/src/core/Tooltip/.DS_Store +0 -0
  107. package/src/core/Tooltip/Tooltip.stories.tsx +27 -0
  108. package/src/core/Tooltip.tsx +88 -0
  109. package/src/core/css.js +3 -0
  110. package/src/core/dom-query.js +5 -0
  111. package/src/core/fonts/NEXT-Book-Light-Italic.eot +0 -0
  112. package/src/core/fonts/NEXT-Book-Light-Italic.otf +0 -0
  113. package/src/core/fonts/NEXT-Book-Light-Italic.woff +0 -0
  114. package/src/core/fonts/NEXT-Book-Light-Italic.woff2 +0 -0
  115. package/src/core/fonts/NEXT-Book-Light.eot +0 -0
  116. package/src/core/fonts/NEXT-Book-Light.otf +0 -0
  117. package/src/core/fonts/NEXT-Book-Light.woff +0 -0
  118. package/src/core/fonts/NEXT-Book-Light.woff2 +0 -0
  119. package/src/core/fonts/NEXT-Book-Medium-Italic.eot +0 -0
  120. package/src/core/fonts/NEXT-Book-Medium-Italic.otf +0 -0
  121. package/src/core/fonts/NEXT-Book-Medium-Italic.woff +0 -0
  122. package/src/core/fonts/NEXT-Book-Medium-Italic.woff2 +0 -0
  123. package/src/core/fonts/NEXT-Book-Medium.eot +0 -0
  124. package/src/core/fonts/NEXT-Book-Medium.otf +0 -0
  125. package/src/core/fonts/NEXT-Book-Medium.woff +0 -0
  126. package/src/core/fonts/NEXT-Book-Medium.woff2 +0 -0
  127. package/src/core/fonts/jetBrains-mono.css +3 -0
  128. package/src/core/fonts/manrope.css +3 -0
  129. package/src/core/fonts/next.css +63 -0
  130. package/src/core/fonts/source-code-pro.css +3 -0
  131. package/src/core/hubspot-chat-toggle.js +67 -0
  132. package/src/core/icons/discord.svg +10 -0
  133. package/src/core/icons/facebook.svg +4 -0
  134. package/src/core/icons/github.svg +3 -0
  135. package/src/core/icons/glassdoor.svg +3 -0
  136. package/src/core/icons/google.svg +3 -0
  137. package/src/core/icons/icon-display-48hrs.svg +3 -0
  138. package/src/core/icons/icon-display-about-ably-col.svg +4 -0
  139. package/src/core/icons/icon-display-api-keys.svg +3 -0
  140. package/src/core/icons/icon-display-api.svg +3 -0
  141. package/src/core/icons/icon-display-asset-tracking-col.svg +18 -0
  142. package/src/core/icons/icon-display-browser.svg +10 -0
  143. package/src/core/icons/icon-display-calendar.svg +3 -0
  144. package/src/core/icons/icon-display-call-mobile.svg +3 -0
  145. package/src/core/icons/icon-display-careers-col.svg +9 -0
  146. package/src/core/icons/icon-display-case-studies-col.svg +5 -0
  147. package/src/core/icons/icon-display-chat-col.svg +4 -0
  148. package/src/core/icons/icon-display-chat-stack-col.svg +4 -0
  149. package/src/core/icons/icon-display-chat-stack.svg +4 -0
  150. package/src/core/icons/icon-display-cloud-servers.svg +3 -0
  151. package/src/core/icons/icon-display-compare-tech-col.svg +9 -0
  152. package/src/core/icons/icon-display-customers-col.svg +15 -0
  153. package/src/core/icons/icon-display-data-broadcast-col.svg +26 -0
  154. package/src/core/icons/icon-display-data-synchronization-col.svg +14 -0
  155. package/src/core/icons/icon-display-docs-col.svg +7 -0
  156. package/src/core/icons/icon-display-documentation.svg +3 -0
  157. package/src/core/icons/icon-display-events-col.svg +13 -0
  158. package/src/core/icons/icon-display-examples-col.svg +11 -0
  159. package/src/core/icons/icon-display-gdpr.svg +3 -0
  160. package/src/core/icons/icon-display-general-comms.svg +3 -0
  161. package/src/core/icons/icon-display-hipaa.svg +10 -0
  162. package/src/core/icons/icon-display-integrations-col.svg +8 -0
  163. package/src/core/icons/icon-display-it-support-access.svg +3 -0
  164. package/src/core/icons/icon-display-it-support-helpdesk.svg +3 -0
  165. package/src/core/icons/icon-display-kafka-at-the-edge-col.svg +8 -0
  166. package/src/core/icons/icon-display-laptop.svg +10 -0
  167. package/src/core/icons/icon-display-lightbulb-col.svg +10 -0
  168. package/src/core/icons/icon-display-live-chat.svg +3 -0
  169. package/src/core/icons/icon-display-map-pin.svg +3 -0
  170. package/src/core/icons/icon-display-message.svg +3 -0
  171. package/src/core/icons/icon-display-padlock-closed.svg +3 -0
  172. package/src/core/icons/icon-display-platform.svg +22 -0
  173. package/src/core/icons/icon-display-play.svg +3 -0
  174. package/src/core/icons/icon-display-privacy-shield-framework.svg +7 -0
  175. package/src/core/icons/icon-display-push-notifications-col.svg +6 -0
  176. package/src/core/icons/icon-display-quickstart-guides-col.svg +8 -0
  177. package/src/core/icons/icon-display-resources-col.svg +21 -0
  178. package/src/core/icons/icon-display-sdks-col.svg +11 -0
  179. package/src/core/icons/icon-display-servers.svg +3 -0
  180. package/src/core/icons/icon-display-shopping-cart.svg +10 -0
  181. package/src/core/icons/icon-display-sla.svg +3 -0
  182. package/src/core/icons/icon-display-soc2-type2.svg +3 -0
  183. package/src/core/icons/icon-display-tech-account-comms.svg +3 -0
  184. package/src/core/icons/icon-display-tutorials-demos-col.svg +25 -0
  185. package/src/core/icons/icon-display-virtual-events-col.svg +12 -0
  186. package/src/core/icons/icon-display-virtual-events.svg +12 -0
  187. package/src/core/icons/icon-gui-ably-badge.svg +3 -0
  188. package/src/core/icons/icon-gui-arrow-bidirectional-horizontal.svg +3 -0
  189. package/src/core/icons/icon-gui-arrow-bidirectional-vertical.svg +3 -0
  190. package/src/core/icons/icon-gui-arrow-down.svg +3 -0
  191. package/src/core/icons/icon-gui-arrow-left.svg +3 -0
  192. package/src/core/icons/icon-gui-arrow-right.svg +3 -0
  193. package/src/core/icons/icon-gui-arrow-up.svg +3 -0
  194. package/src/core/icons/icon-gui-burger-menu.svg +5 -0
  195. package/src/core/icons/icon-gui-check-circled-fill-black.svg +4 -0
  196. package/src/core/icons/icon-gui-check-circled-fill.svg +4 -0
  197. package/src/core/icons/icon-gui-check-circled.svg +3 -0
  198. package/src/core/icons/icon-gui-checklist-checked.svg +3 -0
  199. package/src/core/icons/icon-gui-clock.svg +3 -0
  200. package/src/core/icons/icon-gui-close.svg +3 -0
  201. package/src/core/icons/icon-gui-copy.svg +10 -0
  202. package/src/core/icons/icon-gui-cross-circled-fill.svg +4 -0
  203. package/src/core/icons/icon-gui-cross-circled.svg +3 -0
  204. package/src/core/icons/icon-gui-dash-circled.svg +3 -0
  205. package/src/core/icons/icon-gui-disclosure-arrow.svg +3 -0
  206. package/src/core/icons/icon-gui-document-generic.svg +3 -0
  207. package/src/core/icons/icon-gui-dropdown-arrow.svg +3 -0
  208. package/src/core/icons/icon-gui-enlarge.svg +3 -0
  209. package/src/core/icons/icon-gui-external-link.svg +3 -0
  210. package/src/core/icons/icon-gui-filter-flow-step-1.svg +5 -0
  211. package/src/core/icons/icon-gui-filter-flow-step-2.svg +5 -0
  212. package/src/core/icons/icon-gui-filter-flow-step-3.svg +5 -0
  213. package/src/core/icons/icon-gui-history.svg +3 -0
  214. package/src/core/icons/icon-gui-info.svg +3 -0
  215. package/src/core/icons/icon-gui-link-arrow.svg +3 -0
  216. package/src/core/icons/icon-gui-link.svg +4 -0
  217. package/src/core/icons/icon-gui-live-chat.svg +3 -0
  218. package/src/core/icons/icon-gui-minus.svg +3 -0
  219. package/src/core/icons/icon-gui-partial.svg +4 -0
  220. package/src/core/icons/icon-gui-plus.svg +3 -0
  221. package/src/core/icons/icon-gui-quote-marks-solid.svg +3 -0
  222. package/src/core/icons/icon-gui-refresh.svg +10 -0
  223. package/src/core/icons/icon-gui-resources.svg +3 -0
  224. package/src/core/icons/icon-gui-search.svg +3 -0
  225. package/src/core/icons/icon-gui-tick.svg +3 -0
  226. package/src/core/icons/icon-gui-warning.svg +5 -0
  227. package/src/core/icons/icon-live-updates-results-metrics-col.svg +26 -0
  228. package/src/core/icons/icon-multi-user-spaces-col.svg +13 -0
  229. package/src/core/icons/icon-social-x.svg +3 -0
  230. package/src/core/icons/icon-tech-apachekafka.svg +3 -0
  231. package/src/core/icons/linkedin.svg +3 -0
  232. package/src/core/icons/quote.svg +3 -0
  233. package/src/core/icons/stackoverflow.svg +3 -0
  234. package/src/core/icons/twitter.svg +3 -0
  235. package/src/core/icons/youtube.svg +11 -0
  236. package/src/core/icons.js +6 -0
  237. package/src/core/images/ably-logo.png +0 -0
  238. package/src/core/images/ably-logo.svg +15 -0
  239. package/src/core/images/ably-stack.svg +14 -0
  240. package/src/core/images/best-support-2023.svg +1 -0
  241. package/src/core/images/cust-logo-ao-col-pos.png +0 -0
  242. package/src/core/images/cust-logo-ao-col-pos@2x.png +0 -0
  243. package/src/core/images/cust-logo-ausopen-col-pos.png +0 -0
  244. package/src/core/images/cust-logo-ausopen-col-pos@2x.png +0 -0
  245. package/src/core/images/cust-logo-ausopen-mono-pos.svg +5 -0
  246. package/src/core/images/cust-logo-bloomberg-mono-pos.svg +11 -0
  247. package/src/core/images/cust-logo-hopin-mono-pos.svg +4 -0
  248. package/src/core/images/cust-logo-hubspot-col-pos.png +0 -0
  249. package/src/core/images/cust-logo-hubspot-col-pos@2x.png +0 -0
  250. package/src/core/images/cust-logo-hubspot-mono-pos.svg +4 -0
  251. package/src/core/images/cust-logo-lightspeed-col-pos.png +0 -0
  252. package/src/core/images/cust-logo-lightspeed-col-pos@2x.png +0 -0
  253. package/src/core/images/cust-logo-lightspeed-syst-col-pos.png +0 -0
  254. package/src/core/images/cust-logo-lightspeed-syst-col-pos@2x.png +0 -0
  255. package/src/core/images/cust-logo-mentimeter-mono-pos.svg +17 -0
  256. package/src/core/images/cust-logo-split-col-pos.png +0 -0
  257. package/src/core/images/cust-logo-split-col-pos@2x.png +0 -0
  258. package/src/core/images/cust-logo-split-mono-pos.svg +9 -0
  259. package/src/core/images/cust-logo-toyota-mono-pos.svg +18 -0
  260. package/src/core/images/cust-logo-vitac-col-pos.png +0 -0
  261. package/src/core/images/cust-logo-vitac-col-pos@2x.png +0 -0
  262. package/src/core/images/cust-logo-webflow-col-pos.svg +3 -0
  263. package/src/core/images/cust-photo-hubspot-max-freiert.jpg +0 -0
  264. package/src/core/images/cust-photo-split-pato-echague.jpg +0 -0
  265. package/src/core/images/cust-photo-vitac-joe-antonio.jpg +0 -0
  266. package/src/core/images/fastest-implementation-2023.svg +1 -0
  267. package/src/core/images/flexible-companies.png +0 -0
  268. package/src/core/images/high-performer-2022.png +0 -0
  269. package/src/core/images/high-performer-2023.svg +1 -0
  270. package/src/core/images/highest-user-adoption-2022.png +0 -0
  271. package/src/core/images/highest-user-adoption-2023.svg +1 -0
  272. package/src/core/images/icon-tech-aws.svg +4 -0
  273. package/src/core/images/rocket-list-2021.png +0 -0
  274. package/src/core/images/scale-motif-open-empathetic.svg +1 -0
  275. package/src/core/images/technical-support-01-800x533.jpg +0 -0
  276. package/src/core/images/users-love-us-2022.png +0 -0
  277. package/src/core/load-sprites.js +11 -0
  278. package/src/core/react-renderer.tsx +29 -0
  279. package/src/core/remote-blogs-posts.js +42 -0
  280. package/src/core/remote-data-store.js +34 -0
  281. package/src/core/remote-data-util.js +4 -0
  282. package/src/core/remote-session-data.js +58 -0
  283. package/src/core/scripts.js +10 -0
  284. package/src/core/styles/Dropdown.stories.tsx +49 -0
  285. package/src/core/styles/Toggle.stories.tsx +41 -0
  286. package/src/core/styles/buttons.css +124 -0
  287. package/src/core/styles/forms.css +83 -0
  288. package/src/core/styles/layout.css +21 -0
  289. package/src/core/styles/properties.css +278 -0
  290. package/src/core/styles/text.css +168 -0
  291. package/src/core/styles/toggles.css +38 -0
  292. package/src/core/styles.base.css +1 -0
  293. package/src/core/styles.components.css +44 -0
  294. package/src/core/styles.css +2 -0
  295. package/src/core/url-base.js +7 -0
  296. package/src/core/utils/syntax-highlighter-registry.js +63 -0
  297. package/src/core/utils/syntax-highlighter.css +71 -0
  298. package/src/core/utils/syntax-highlighter.js +103 -0
  299. package/src/pages/Buttons.mdx +121 -0
  300. package/src/pages/Chips.mdx +136 -0
  301. package/src/pages/Colour.mdx +23 -0
  302. package/src/pages/Forms.mdx +219 -0
  303. package/src/pages/Layout.mdx +58 -0
  304. package/src/pages/Typography.mdx +206 -0
  305. package/src/pages/utils.ts +80 -0
  306. package/src/reset/scripts.js +1 -0
  307. package/src/reset/styles/normalize.css +353 -0
  308. package/src/reset/styles/reset.css +139 -0
  309. package/src/reset/styles.css +2 -0
@@ -0,0 +1,233 @@
1
+ import React, { useEffect, useState, useRef } from "react";
2
+ import DOMPurify from "dompurify";
3
+ import { nanoid } from "nanoid/non-secure";
4
+
5
+ import { getRemoteDataStore } from "./remote-data-store.js";
6
+ import ConnectStateWrapper from "./ConnectStateWrapper";
7
+ import Icon from "./Icon";
8
+
9
+ type FlashProps = {
10
+ id: string;
11
+ removed: boolean;
12
+ type: "error" | "success" | "notice" | "info" | "alert";
13
+ content: string;
14
+ removeFlash: (id: string) => void;
15
+ };
16
+
17
+ type FlashesProps = {
18
+ flashes: { items: FlashProps[] };
19
+ };
20
+
21
+ type BackendFlashesProps = {
22
+ flashes: string[][];
23
+ };
24
+
25
+ const REDUCER_KEY = "flashes";
26
+ const FLASH_DATA_ID = "ui-flashes";
27
+
28
+ const initialState = { items: [] };
29
+
30
+ const reducerFlashes = {
31
+ [REDUCER_KEY]: (state = initialState, action) => {
32
+ switch (action.type) {
33
+ case "flash/push": {
34
+ const flashes = Array.isArray(action.payload)
35
+ ? action.payload
36
+ : [action.payload];
37
+ return { items: [...state.items, ...flashes] };
38
+ }
39
+ default:
40
+ return state;
41
+ }
42
+ },
43
+ };
44
+
45
+ const selectFlashes = (store) => store.getState()[REDUCER_KEY];
46
+
47
+ const FLASH_BG_COLOR = {
48
+ error: "bg-gui-error",
49
+ success: "bg-zingy-green",
50
+ notice: "bg-electric-cyan",
51
+ info: "bg-electric-cyan",
52
+ alert: "bg-active-orange",
53
+ };
54
+
55
+ const FLASH_TEXT_COLOR = {
56
+ error: "text-white",
57
+ success: "text-cool-black",
58
+ notice: "text-cool-black",
59
+ info: "text-cool-black",
60
+ alert: "text-white",
61
+ };
62
+
63
+ const AUTO_HIDE = ["success", "info", "notice"];
64
+ const AUTO_HIDE_TIME = 8000;
65
+
66
+ const useAutoHide = (type, closeFlash) => {
67
+ const timeoutId = useRef<ReturnType<typeof setTimeout> | null>(null);
68
+
69
+ useEffect(() => {
70
+ if (AUTO_HIDE.includes(type)) {
71
+ timeoutId.current = setTimeout(() => {
72
+ closeFlash();
73
+ }, AUTO_HIDE_TIME);
74
+ }
75
+
76
+ return () => {
77
+ if (timeoutId.current) {
78
+ clearTimeout(timeoutId.current);
79
+ }
80
+ };
81
+ }, []);
82
+ };
83
+
84
+ const Flash = ({ id, type, content, removeFlash }: FlashProps) => {
85
+ const ref = useRef<HTMLDivElement>(null);
86
+ const [closed, setClosed] = useState(false);
87
+ const [flashHeight, setFlashHeight] = useState(0);
88
+ const [triggerEntryAnimation, setTriggerEntryAnimation] = useState(false);
89
+
90
+ const closeFlash = () => {
91
+ if (ref.current) {
92
+ setFlashHeight(ref.current.getBoundingClientRect().height);
93
+ }
94
+
95
+ setClosed(true);
96
+
97
+ setTimeout(() => {
98
+ id && removeFlash(id);
99
+ }, 100);
100
+ };
101
+
102
+ useEffect(() => setTriggerEntryAnimation(true), []);
103
+ useAutoHide(type, closeFlash);
104
+
105
+ const animateEntry = triggerEntryAnimation && !closed;
106
+
107
+ let style;
108
+
109
+ if (flashHeight && !closed) {
110
+ style = { height: `${flashHeight}px` };
111
+ } else if (closed) {
112
+ style = { height: 0, marginTop: 0, zIndex: -1 };
113
+ } else {
114
+ style = {};
115
+ }
116
+
117
+ const safeContent = DOMPurify.sanitize(content, {
118
+ ALLOWED_TAGS: ["a"],
119
+ ALLOWED_ATTR: ["href", "data-method", "rel"],
120
+ });
121
+
122
+ const withIcons = {
123
+ notice: "icon-gui-ably-badge",
124
+ success: "icon-gui-tick",
125
+ error: "icon-gui-warning",
126
+ alert: "icon-gui-warning",
127
+ };
128
+
129
+ const iconColor = {
130
+ notice: "text-cool-black",
131
+ success: "text-cool-black",
132
+ error: "text-white",
133
+ alert: "text-white",
134
+ };
135
+
136
+ return (
137
+ <div
138
+ className={`ui-flash-message ui-grid-px ${
139
+ animateEntry ? "ui-flash-message-enter" : ""
140
+ }`}
141
+ style={style}
142
+ ref={ref}
143
+ data-id="ui-flash"
144
+ >
145
+ <div
146
+ className={`${FLASH_BG_COLOR[type]} p-32 flex align-center rounded shadow-container-subtle`}
147
+ >
148
+ {withIcons[type] && (
149
+ <Icon
150
+ name={withIcons[type]}
151
+ color={iconColor[type]}
152
+ size="1.5rem"
153
+ additionalCSS="mr-16 self-baseline"
154
+ />
155
+ )}
156
+ <p
157
+ className={`ui-text-p1 mr-16 ${FLASH_TEXT_COLOR[type]}`}
158
+ dangerouslySetInnerHTML={{ __html: safeContent }}
159
+ />
160
+ <button
161
+ type="button"
162
+ className="p-0 ml-auto self-start focus:outline-none"
163
+ onClick={closeFlash}
164
+ >
165
+ <Icon
166
+ name="icon-gui-close"
167
+ color={iconColor[type]}
168
+ size="1.5rem"
169
+ additionalCSS="transition-colors"
170
+ />
171
+ </button>
172
+ </div>
173
+ </div>
174
+ );
175
+ };
176
+
177
+ const Flashes = ({ flashes }: FlashesProps) => {
178
+ const [flashesWithIds, setFlashesWithIds] = useState<FlashProps[]>([]);
179
+
180
+ const removeFlash = (flashId) =>
181
+ setFlashesWithIds((items) => items.filter((item) => item.id !== flashId));
182
+
183
+ useEffect(() => {
184
+ setFlashesWithIds((state) => {
185
+ return [
186
+ ...state,
187
+ ...(flashes?.items ?? []).map((flash) => ({
188
+ ...flash,
189
+ id: nanoid(),
190
+ removed: false,
191
+ })),
192
+ ];
193
+ });
194
+ }, [flashes]);
195
+
196
+ return (
197
+ <div className="ui-flash" data-id={FLASH_DATA_ID}>
198
+ {flashesWithIds
199
+ .filter((item) => !item.removed)
200
+ .map((flash) => (
201
+ <Flash key={flash.id} {...flash} removeFlash={removeFlash} />
202
+ ))}
203
+ </div>
204
+ );
205
+ };
206
+
207
+ const BackendFlashes = ({ flashes }: BackendFlashesProps) => {
208
+ useEffect(() => {
209
+ const transformedFlashes =
210
+ flashes.map((flash) => {
211
+ const [type, content] = flash;
212
+ return { type, content };
213
+ }) || [];
214
+
215
+ if (transformedFlashes.length > 0) {
216
+ const store = getRemoteDataStore();
217
+
218
+ store.dispatch({
219
+ type: "flash/push",
220
+ payload: transformedFlashes,
221
+ });
222
+ }
223
+ }, []);
224
+
225
+ const WrappedFlashes = ConnectStateWrapper(Flashes, {
226
+ flashes: selectFlashes,
227
+ });
228
+
229
+ return <WrappedFlashes />;
230
+ };
231
+
232
+ export { reducerFlashes, FLASH_DATA_ID, Flashes };
233
+ export default BackendFlashes;
Binary file
@@ -0,0 +1,26 @@
1
+ import Footer from "../Footer";
2
+
3
+ import ablyStack from "../images/ably-stack.svg";
4
+ import highestPerformer from "../images/high-performer-2023.svg";
5
+ import bestSupport from "../images/best-support-2023.svg";
6
+ import fastestImplementation from "../images/fastest-implementation-2023.svg";
7
+ import highestUserAdoption from "../images/highest-user-adoption-2023.svg";
8
+
9
+ export default {
10
+ title: "JS Components/Footer",
11
+ component: Footer,
12
+ parameters: {
13
+ layout: "fullscreen",
14
+ },
15
+ args: {
16
+ paths: {
17
+ ablyStack,
18
+ highestPerformer,
19
+ bestSupport,
20
+ fastestImplementation,
21
+ highestUserAdoption,
22
+ },
23
+ },
24
+ };
25
+
26
+ export const Default = {};
@@ -0,0 +1,33 @@
1
+ @layer components {
2
+ .ui-footer-col-title {
3
+ @apply font-mono text-overline2 p-menu-row-title font-medium uppercase tracking-widen-0.16;
4
+ }
5
+
6
+ .ui-footer-menu-row-link {
7
+ @apply text-menu3 text-cool-black font-sans font-medium hover:text-gui-hover block;
8
+ }
9
+
10
+ .ui-footer-link {
11
+ @apply text-gui-default hover:text-gui-hover text-menu3 font-sans font-medium;
12
+ }
13
+
14
+ .ui-footer-compliance-text {
15
+ font-size: 12px;
16
+ }
17
+
18
+ .ui-footer-tick-icon {
19
+ min-width: 1.5rem;
20
+ }
21
+
22
+ @media (max-width: 1040px) {
23
+ .ui-footer-bottom-links {
24
+ @apply pb-40;
25
+ }
26
+ }
27
+
28
+ @media screen {
29
+ .ui-footer-glassdoor {
30
+ display: none;
31
+ }
32
+ }
33
+ }