@ably/ui 14.0.4 → 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.
Files changed (281) hide show
  1. package/core/Flash.js +1 -1
  2. package/core/styles/forms.css +4 -4
  3. package/core/styles/toggles.css +38 -0
  4. package/core/styles.components.css +1 -0
  5. package/package.json +15 -18
  6. package/tailwind.config.js +3 -0
  7. package/src/core/Accordion/Accordion.stories.tsx +0 -39
  8. package/src/core/Accordion.tsx +0 -149
  9. package/src/core/Code/Code.stories.tsx +0 -71
  10. package/src/core/Code/component.css +0 -1
  11. package/src/core/Code/component.js +0 -27
  12. package/src/core/Code.tsx +0 -44
  13. package/src/core/ConnectStateWrapper.tsx +0 -43
  14. package/src/core/ContactFooter/ContactFooter.stories.tsx +0 -11
  15. package/src/core/ContactFooter/component.css +0 -11
  16. package/src/core/ContactFooter/component.js +0 -2
  17. package/src/core/ContactFooter.tsx +0 -91
  18. package/src/core/CookieMessage/CookieMessage.stories.tsx +0 -12
  19. package/src/core/CookieMessage/component.css +0 -15
  20. package/src/core/CookieMessage.tsx +0 -52
  21. package/src/core/CustomerLogos/CustomerLogos.stories.tsx +0 -43
  22. package/src/core/CustomerLogos.tsx +0 -35
  23. package/src/core/DropdownMenu/DropdownMenu.stories.tsx +0 -48
  24. package/src/core/DropdownMenu.tsx +0 -140
  25. package/src/core/Expander/Expander.stories.tsx +0 -132
  26. package/src/core/Expander.tsx +0 -63
  27. package/src/core/FeaturedLink/FeaturedLink.stories.tsx +0 -43
  28. package/src/core/FeaturedLink.tsx +0 -93
  29. package/src/core/Flash/Flash.stories.tsx +0 -37
  30. package/src/core/Flash/component.css +0 -28
  31. package/src/core/Flash.tsx +0 -233
  32. package/src/core/Footer/Footer.stories.tsx +0 -26
  33. package/src/core/Footer/component.css +0 -33
  34. package/src/core/Footer.tsx +0 -535
  35. package/src/core/Icon/Icon.stories.tsx +0 -151
  36. package/src/core/Icon.tsx +0 -26
  37. package/src/core/Loader/Loader.stories.tsx +0 -21
  38. package/src/core/Loader.tsx +0 -52
  39. package/src/core/Logo/Logo.stories.tsx +0 -12
  40. package/src/core/Logo.tsx +0 -29
  41. package/src/core/Meganav/Meganav.stories.tsx +0 -86
  42. package/src/core/Meganav/component.css +0 -114
  43. package/src/core/Meganav/component.js +0 -150
  44. package/src/core/Meganav/component.json +0 -37
  45. package/src/core/Meganav.tsx +0 -225
  46. package/src/core/MeganavBlogPostsList/component.js +0 -43
  47. package/src/core/MeganavBlogPostsList.tsx +0 -41
  48. package/src/core/MeganavContentCompany.tsx +0 -166
  49. package/src/core/MeganavContentDevelopers.tsx +0 -210
  50. package/src/core/MeganavContentProducts.tsx +0 -163
  51. package/src/core/MeganavContentUseCases.tsx +0 -244
  52. package/src/core/MeganavControl/component.js +0 -117
  53. package/src/core/MeganavControl.tsx +0 -39
  54. package/src/core/MeganavControlMobileDropdown/component.js +0 -46
  55. package/src/core/MeganavControlMobileDropdown.tsx +0 -31
  56. package/src/core/MeganavControlMobilePanelClose/component.js +0 -36
  57. package/src/core/MeganavControlMobilePanelClose.tsx +0 -34
  58. package/src/core/MeganavControlMobilePanelOpen/component.js +0 -59
  59. package/src/core/MeganavControlMobilePanelOpen.tsx +0 -31
  60. package/src/core/MeganavItemsDesktop.tsx +0 -68
  61. package/src/core/MeganavItemsMobile.tsx +0 -197
  62. package/src/core/MeganavItemsSignedIn.tsx +0 -130
  63. package/src/core/MeganavSearch.tsx +0 -36
  64. package/src/core/MeganavSearchAutocomplete/component.js +0 -177
  65. package/src/core/MeganavSearchAutocomplete.tsx +0 -12
  66. package/src/core/MeganavSearchPanel.tsx +0 -52
  67. package/src/core/MeganavSearchSuggestions/component.js +0 -133
  68. package/src/core/MeganavSearchSuggestions.tsx +0 -62
  69. package/src/core/Notice/component.css +0 -7
  70. package/src/core/Notice/component.js +0 -154
  71. package/src/core/Notice.tsx +0 -102
  72. package/src/core/SignOutLink.tsx +0 -51
  73. package/src/core/Slider/Slider.stories.tsx +0 -98
  74. package/src/core/Slider/component.css +0 -40
  75. package/src/core/Slider/component.js +0 -105
  76. package/src/core/Slider.tsx +0 -224
  77. package/src/core/Table/Table.stories.tsx +0 -12
  78. package/src/core/Table/Table.tsx +0 -58
  79. package/src/core/Table/TableCell.tsx +0 -71
  80. package/src/core/Table/TableRow.tsx +0 -25
  81. package/src/core/Table/data.tsx +0 -133
  82. package/src/core/Table.tsx +0 -15
  83. package/src/core/Tooltip/Tooltip.stories.tsx +0 -27
  84. package/src/core/Tooltip.tsx +0 -88
  85. package/src/core/css.js +0 -3
  86. package/src/core/dom-query.js +0 -5
  87. package/src/core/fonts/NEXT-Book-Light-Italic.eot +0 -0
  88. package/src/core/fonts/NEXT-Book-Light-Italic.otf +0 -0
  89. package/src/core/fonts/NEXT-Book-Light-Italic.woff +0 -0
  90. package/src/core/fonts/NEXT-Book-Light-Italic.woff2 +0 -0
  91. package/src/core/fonts/NEXT-Book-Light.eot +0 -0
  92. package/src/core/fonts/NEXT-Book-Light.otf +0 -0
  93. package/src/core/fonts/NEXT-Book-Light.woff +0 -0
  94. package/src/core/fonts/NEXT-Book-Light.woff2 +0 -0
  95. package/src/core/fonts/NEXT-Book-Medium-Italic.eot +0 -0
  96. package/src/core/fonts/NEXT-Book-Medium-Italic.otf +0 -0
  97. package/src/core/fonts/NEXT-Book-Medium-Italic.woff +0 -0
  98. package/src/core/fonts/NEXT-Book-Medium-Italic.woff2 +0 -0
  99. package/src/core/fonts/NEXT-Book-Medium.eot +0 -0
  100. package/src/core/fonts/NEXT-Book-Medium.otf +0 -0
  101. package/src/core/fonts/NEXT-Book-Medium.woff +0 -0
  102. package/src/core/fonts/NEXT-Book-Medium.woff2 +0 -0
  103. package/src/core/fonts/jetBrains-mono.css +0 -3
  104. package/src/core/fonts/manrope.css +0 -3
  105. package/src/core/fonts/next.css +0 -63
  106. package/src/core/fonts/source-code-pro.css +0 -3
  107. package/src/core/hubspot-chat-toggle.js +0 -67
  108. package/src/core/icons/discord.svg +0 -10
  109. package/src/core/icons/facebook.svg +0 -4
  110. package/src/core/icons/github.svg +0 -3
  111. package/src/core/icons/glassdoor.svg +0 -3
  112. package/src/core/icons/google.svg +0 -3
  113. package/src/core/icons/icon-display-48hrs.svg +0 -3
  114. package/src/core/icons/icon-display-about-ably-col.svg +0 -4
  115. package/src/core/icons/icon-display-api-keys.svg +0 -3
  116. package/src/core/icons/icon-display-api.svg +0 -3
  117. package/src/core/icons/icon-display-asset-tracking-col.svg +0 -18
  118. package/src/core/icons/icon-display-browser.svg +0 -10
  119. package/src/core/icons/icon-display-calendar.svg +0 -3
  120. package/src/core/icons/icon-display-call-mobile.svg +0 -3
  121. package/src/core/icons/icon-display-careers-col.svg +0 -9
  122. package/src/core/icons/icon-display-case-studies-col.svg +0 -5
  123. package/src/core/icons/icon-display-chat-col.svg +0 -4
  124. package/src/core/icons/icon-display-chat-stack-col.svg +0 -4
  125. package/src/core/icons/icon-display-chat-stack.svg +0 -4
  126. package/src/core/icons/icon-display-cloud-servers.svg +0 -3
  127. package/src/core/icons/icon-display-compare-tech-col.svg +0 -9
  128. package/src/core/icons/icon-display-customers-col.svg +0 -15
  129. package/src/core/icons/icon-display-data-broadcast-col.svg +0 -26
  130. package/src/core/icons/icon-display-data-synchronization-col.svg +0 -14
  131. package/src/core/icons/icon-display-docs-col.svg +0 -7
  132. package/src/core/icons/icon-display-documentation.svg +0 -3
  133. package/src/core/icons/icon-display-events-col.svg +0 -13
  134. package/src/core/icons/icon-display-examples-col.svg +0 -11
  135. package/src/core/icons/icon-display-gdpr.svg +0 -3
  136. package/src/core/icons/icon-display-general-comms.svg +0 -3
  137. package/src/core/icons/icon-display-hipaa.svg +0 -10
  138. package/src/core/icons/icon-display-integrations-col.svg +0 -8
  139. package/src/core/icons/icon-display-it-support-access.svg +0 -3
  140. package/src/core/icons/icon-display-it-support-helpdesk.svg +0 -3
  141. package/src/core/icons/icon-display-kafka-at-the-edge-col.svg +0 -8
  142. package/src/core/icons/icon-display-laptop.svg +0 -10
  143. package/src/core/icons/icon-display-lightbulb-col.svg +0 -10
  144. package/src/core/icons/icon-display-live-chat.svg +0 -3
  145. package/src/core/icons/icon-display-map-pin.svg +0 -3
  146. package/src/core/icons/icon-display-message.svg +0 -3
  147. package/src/core/icons/icon-display-padlock-closed.svg +0 -3
  148. package/src/core/icons/icon-display-platform.svg +0 -22
  149. package/src/core/icons/icon-display-play.svg +0 -3
  150. package/src/core/icons/icon-display-privacy-shield-framework.svg +0 -7
  151. package/src/core/icons/icon-display-push-notifications-col.svg +0 -6
  152. package/src/core/icons/icon-display-quickstart-guides-col.svg +0 -8
  153. package/src/core/icons/icon-display-resources-col.svg +0 -21
  154. package/src/core/icons/icon-display-sdks-col.svg +0 -11
  155. package/src/core/icons/icon-display-servers.svg +0 -3
  156. package/src/core/icons/icon-display-shopping-cart.svg +0 -10
  157. package/src/core/icons/icon-display-sla.svg +0 -3
  158. package/src/core/icons/icon-display-soc2-type2.svg +0 -3
  159. package/src/core/icons/icon-display-tech-account-comms.svg +0 -3
  160. package/src/core/icons/icon-display-tutorials-demos-col.svg +0 -25
  161. package/src/core/icons/icon-display-virtual-events-col.svg +0 -12
  162. package/src/core/icons/icon-display-virtual-events.svg +0 -12
  163. package/src/core/icons/icon-gui-ably-badge.svg +0 -3
  164. package/src/core/icons/icon-gui-arrow-bidirectional-horizontal.svg +0 -3
  165. package/src/core/icons/icon-gui-arrow-bidirectional-vertical.svg +0 -3
  166. package/src/core/icons/icon-gui-arrow-down.svg +0 -3
  167. package/src/core/icons/icon-gui-arrow-left.svg +0 -3
  168. package/src/core/icons/icon-gui-arrow-right.svg +0 -3
  169. package/src/core/icons/icon-gui-arrow-up.svg +0 -3
  170. package/src/core/icons/icon-gui-burger-menu.svg +0 -5
  171. package/src/core/icons/icon-gui-check-circled-fill-black.svg +0 -4
  172. package/src/core/icons/icon-gui-check-circled-fill.svg +0 -4
  173. package/src/core/icons/icon-gui-check-circled.svg +0 -3
  174. package/src/core/icons/icon-gui-checklist-checked.svg +0 -3
  175. package/src/core/icons/icon-gui-clock.svg +0 -3
  176. package/src/core/icons/icon-gui-close.svg +0 -3
  177. package/src/core/icons/icon-gui-copy.svg +0 -10
  178. package/src/core/icons/icon-gui-cross-circled-fill.svg +0 -4
  179. package/src/core/icons/icon-gui-cross-circled.svg +0 -3
  180. package/src/core/icons/icon-gui-dash-circled.svg +0 -3
  181. package/src/core/icons/icon-gui-disclosure-arrow.svg +0 -3
  182. package/src/core/icons/icon-gui-document-generic.svg +0 -3
  183. package/src/core/icons/icon-gui-enlarge.svg +0 -3
  184. package/src/core/icons/icon-gui-external-link.svg +0 -3
  185. package/src/core/icons/icon-gui-filter-flow-step-1.svg +0 -5
  186. package/src/core/icons/icon-gui-filter-flow-step-2.svg +0 -5
  187. package/src/core/icons/icon-gui-filter-flow-step-3.svg +0 -5
  188. package/src/core/icons/icon-gui-history.svg +0 -3
  189. package/src/core/icons/icon-gui-info.svg +0 -3
  190. package/src/core/icons/icon-gui-link-arrow.svg +0 -3
  191. package/src/core/icons/icon-gui-link.svg +0 -4
  192. package/src/core/icons/icon-gui-live-chat.svg +0 -3
  193. package/src/core/icons/icon-gui-minus.svg +0 -3
  194. package/src/core/icons/icon-gui-partial.svg +0 -4
  195. package/src/core/icons/icon-gui-plus.svg +0 -3
  196. package/src/core/icons/icon-gui-quote-marks-solid.svg +0 -3
  197. package/src/core/icons/icon-gui-refresh.svg +0 -10
  198. package/src/core/icons/icon-gui-resources.svg +0 -3
  199. package/src/core/icons/icon-gui-search.svg +0 -3
  200. package/src/core/icons/icon-gui-tick.svg +0 -3
  201. package/src/core/icons/icon-gui-warning.svg +0 -5
  202. package/src/core/icons/icon-live-updates-results-metrics-col.svg +0 -26
  203. package/src/core/icons/icon-multi-user-spaces-col.svg +0 -13
  204. package/src/core/icons/icon-social-x.svg +0 -3
  205. package/src/core/icons/icon-tech-apachekafka.svg +0 -3
  206. package/src/core/icons/linkedin.svg +0 -3
  207. package/src/core/icons/quote.svg +0 -3
  208. package/src/core/icons/stackoverflow.svg +0 -3
  209. package/src/core/icons/twitter.svg +0 -3
  210. package/src/core/icons/youtube.svg +0 -11
  211. package/src/core/icons.js +0 -6
  212. package/src/core/images/ably-logo.png +0 -0
  213. package/src/core/images/ably-logo.svg +0 -15
  214. package/src/core/images/ably-stack.svg +0 -14
  215. package/src/core/images/best-support-2023.svg +0 -1
  216. package/src/core/images/cust-logo-ao-col-pos.png +0 -0
  217. package/src/core/images/cust-logo-ao-col-pos@2x.png +0 -0
  218. package/src/core/images/cust-logo-ausopen-col-pos.png +0 -0
  219. package/src/core/images/cust-logo-ausopen-col-pos@2x.png +0 -0
  220. package/src/core/images/cust-logo-ausopen-mono-pos.svg +0 -5
  221. package/src/core/images/cust-logo-bloomberg-mono-pos.svg +0 -11
  222. package/src/core/images/cust-logo-hopin-mono-pos.svg +0 -4
  223. package/src/core/images/cust-logo-hubspot-col-pos.png +0 -0
  224. package/src/core/images/cust-logo-hubspot-col-pos@2x.png +0 -0
  225. package/src/core/images/cust-logo-hubspot-mono-pos.svg +0 -4
  226. package/src/core/images/cust-logo-lightspeed-col-pos.png +0 -0
  227. package/src/core/images/cust-logo-lightspeed-col-pos@2x.png +0 -0
  228. package/src/core/images/cust-logo-lightspeed-syst-col-pos.png +0 -0
  229. package/src/core/images/cust-logo-lightspeed-syst-col-pos@2x.png +0 -0
  230. package/src/core/images/cust-logo-mentimeter-mono-pos.svg +0 -17
  231. package/src/core/images/cust-logo-split-col-pos.png +0 -0
  232. package/src/core/images/cust-logo-split-col-pos@2x.png +0 -0
  233. package/src/core/images/cust-logo-split-mono-pos.svg +0 -9
  234. package/src/core/images/cust-logo-toyota-mono-pos.svg +0 -18
  235. package/src/core/images/cust-logo-vitac-col-pos.png +0 -0
  236. package/src/core/images/cust-logo-vitac-col-pos@2x.png +0 -0
  237. package/src/core/images/cust-logo-webflow-col-pos.svg +0 -3
  238. package/src/core/images/cust-photo-hubspot-max-freiert.jpg +0 -0
  239. package/src/core/images/cust-photo-split-pato-echague.jpg +0 -0
  240. package/src/core/images/cust-photo-vitac-joe-antonio.jpg +0 -0
  241. package/src/core/images/fastest-implementation-2023.svg +0 -1
  242. package/src/core/images/flexible-companies.png +0 -0
  243. package/src/core/images/high-performer-2022.png +0 -0
  244. package/src/core/images/high-performer-2023.svg +0 -1
  245. package/src/core/images/highest-user-adoption-2022.png +0 -0
  246. package/src/core/images/highest-user-adoption-2023.svg +0 -1
  247. package/src/core/images/icon-tech-aws.svg +0 -4
  248. package/src/core/images/rocket-list-2021.png +0 -0
  249. package/src/core/images/scale-motif-open-empathetic.svg +0 -1
  250. package/src/core/images/technical-support-01-800x533.jpg +0 -0
  251. package/src/core/images/users-love-us-2022.png +0 -0
  252. package/src/core/load-sprites.js +0 -11
  253. package/src/core/react-renderer.tsx +0 -29
  254. package/src/core/remote-blogs-posts.js +0 -42
  255. package/src/core/remote-data-store.js +0 -34
  256. package/src/core/remote-data-util.js +0 -4
  257. package/src/core/remote-session-data.js +0 -58
  258. package/src/core/scripts.js +0 -10
  259. package/src/core/styles/buttons.css +0 -124
  260. package/src/core/styles/forms.css +0 -64
  261. package/src/core/styles/layout.css +0 -21
  262. package/src/core/styles/properties.css +0 -278
  263. package/src/core/styles/text.css +0 -168
  264. package/src/core/styles.base.css +0 -1
  265. package/src/core/styles.components.css +0 -43
  266. package/src/core/styles.css +0 -2
  267. package/src/core/url-base.js +0 -7
  268. package/src/core/utils/syntax-highlighter-registry.js +0 -63
  269. package/src/core/utils/syntax-highlighter.css +0 -71
  270. package/src/core/utils/syntax-highlighter.js +0 -103
  271. package/src/pages/Buttons.mdx +0 -121
  272. package/src/pages/Chips.mdx +0 -136
  273. package/src/pages/Colour.mdx +0 -23
  274. package/src/pages/Forms.mdx +0 -173
  275. package/src/pages/Layout.mdx +0 -58
  276. package/src/pages/Typography.mdx +0 -206
  277. package/src/pages/utils.ts +0 -70
  278. package/src/reset/scripts.js +0 -1
  279. package/src/reset/styles/normalize.css +0 -353
  280. package/src/reset/styles/reset.css +0 -139
  281. package/src/reset/styles.css +0 -2
@@ -1,37 +0,0 @@
1
- import React from "react";
2
- import Flash, { reducerFlashes } from "../Flash";
3
-
4
- import {
5
- attachStoreToWindow,
6
- createRemoteDataStore,
7
- } from "../remote-data-store.js";
8
- import { reducerBlogPosts } from "../remote-blogs-posts.js";
9
- import { reducerSessionData } from "../remote-session-data.js";
10
-
11
- export default {
12
- title: "Components/Flash",
13
- component: Flash,
14
- args: {
15
- flashes: [
16
- ["success", "Congratulations! You've won the Oscar"],
17
- ["notice", "This is a notice"],
18
- ["error", "This is an error, very bad"],
19
- ["alert", "This is an alert"],
20
- ["info", "Some useful information, you are welcome"],
21
- ],
22
- },
23
- };
24
-
25
- export const Default = {
26
- render: (args) => {
27
- const store = createRemoteDataStore({
28
- ...reducerBlogPosts,
29
- ...reducerSessionData,
30
- ...reducerFlashes,
31
- });
32
-
33
- attachStoreToWindow(store);
34
-
35
- return <Flash {...args} />;
36
- },
37
- };
@@ -1,28 +0,0 @@
1
- @layer components {
2
- .ui-flash {
3
- @apply w-full fixed;
4
- top: 5.5rem;
5
- z-index: calc(var(--stacking-context-page-meganav) - 10);
6
- transition: margin-top 200ms;
7
- }
8
-
9
- .ui-flash-message {
10
- @apply font-sans font-light antialiased max-w-screen-xl mx-auto mt-8 opacity-0 relative;
11
- transition:
12
- opacity 200ms,
13
- transform 200ms,
14
- height 200ms 200ms,
15
- margin-top 200ms 200ms;
16
- transform: translateY(-200%) rotateX(-90deg);
17
- }
18
-
19
- /* dynamic content inside flash, can't add classes */
20
- .ui-flash-text a {
21
- @apply underline;
22
- }
23
-
24
- .ui-flash-message-enter {
25
- @apply opacity-100;
26
- transform: translateY(0) rotateX(0);
27
- }
28
- }
@@ -1,233 +0,0 @@
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;
@@ -1,26 +0,0 @@
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: "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 = {};
@@ -1,33 +0,0 @@
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
- }