@ably/ui 13.3.0 → 14.0.0-dev.1939f45

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 (501) hide show
  1. package/README.md +26 -155
  2. package/core/.DS_Store +0 -0
  3. package/core/Accordion/.DS_Store +0 -0
  4. package/core/Accordion.js +1 -0
  5. package/core/Code/.DS_Store +0 -0
  6. package/core/Code/component.css +1 -72
  7. package/core/Code/component.js +1 -1
  8. package/core/Code.js +1 -0
  9. package/core/ConnectStateWrapper.js +1 -0
  10. package/core/ContactFooter/.DS_Store +0 -0
  11. package/core/ContactFooter/component.css +0 -1
  12. package/core/ContactFooter/component.js +1 -1
  13. package/core/ContactFooter.js +1 -0
  14. package/core/CookieMessage/.DS_Store +0 -0
  15. package/core/CookieMessage/component.css +0 -1
  16. package/core/CookieMessage.js +1 -0
  17. package/core/CustomerLogos/.DS_Store +0 -0
  18. package/core/CustomerLogos.js +1 -0
  19. package/core/DropdownMenu/.DS_Store +0 -0
  20. package/core/DropdownMenu.js +1 -0
  21. package/core/Expander.js +1 -0
  22. package/core/FeaturedLink/.DS_Store +0 -0
  23. package/core/FeaturedLink.js +1 -0
  24. package/core/Flash/.DS_Store +0 -0
  25. package/core/Flash/component.css +0 -1
  26. package/core/Flash.js +1 -0
  27. package/core/Footer/.DS_Store +0 -0
  28. package/core/Footer/component.css +0 -1
  29. package/core/Footer.js +1 -0
  30. package/core/Icon/.DS_Store +0 -0
  31. package/core/Icon.js +1 -0
  32. package/core/Loader/.DS_Store +0 -0
  33. package/core/Loader.js +13 -0
  34. package/core/Logo/.DS_Store +0 -0
  35. package/core/Logo.js +1 -0
  36. package/core/Meganav/.DS_Store +0 -0
  37. package/core/Meganav/component.css +2 -3
  38. package/core/Meganav/component.js +1 -1
  39. package/core/Meganav.js +1 -0
  40. package/core/MeganavBlogPostsList/.DS_Store +0 -0
  41. package/core/MeganavBlogPostsList/component.js +1 -2
  42. package/core/MeganavBlogPostsList.js +1 -0
  43. package/core/MeganavContentCompany.js +1 -0
  44. package/core/MeganavContentDevelopers.js +1 -0
  45. package/core/MeganavContentProducts.js +1 -0
  46. package/core/MeganavContentUseCases.js +1 -0
  47. package/core/MeganavControl/.DS_Store +0 -0
  48. package/core/MeganavControl/component.js +1 -1
  49. package/core/MeganavControl.js +1 -0
  50. package/core/MeganavControlMobileDropdown/.DS_Store +0 -0
  51. package/core/MeganavControlMobileDropdown/component.js +1 -1
  52. package/core/MeganavControlMobileDropdown.js +1 -0
  53. package/core/MeganavControlMobilePanelClose/.DS_Store +0 -0
  54. package/core/MeganavControlMobilePanelClose/component.js +1 -1
  55. package/core/MeganavControlMobilePanelClose.js +1 -0
  56. package/core/MeganavControlMobilePanelOpen/.DS_Store +0 -0
  57. package/core/MeganavControlMobilePanelOpen/component.js +1 -1
  58. package/core/MeganavControlMobilePanelOpen.js +1 -0
  59. package/core/MeganavItemsDesktop.js +1 -0
  60. package/core/MeganavItemsMobile.js +1 -0
  61. package/core/MeganavItemsSignedIn.js +1 -0
  62. package/core/MeganavSearch.js +1 -0
  63. package/core/MeganavSearchAutocomplete/.DS_Store +0 -0
  64. package/core/MeganavSearchAutocomplete/component.js +1 -1
  65. package/core/MeganavSearchAutocomplete.js +1 -0
  66. package/core/MeganavSearchPanel.js +1 -0
  67. package/core/MeganavSearchSuggestions/.DS_Store +0 -0
  68. package/core/MeganavSearchSuggestions/component.js +1 -1
  69. package/core/MeganavSearchSuggestions.js +1 -0
  70. package/core/Notice/.DS_Store +0 -0
  71. package/core/Notice/component.css +0 -1
  72. package/core/Notice/component.js +1 -1
  73. package/core/Notice.js +1 -0
  74. package/core/SignOutLink.js +1 -0
  75. package/core/Slider/.DS_Store +0 -0
  76. package/core/Slider/component.css +32 -1
  77. package/core/Slider/component.js +1 -1
  78. package/core/Slider.js +1 -0
  79. package/core/Table/.DS_Store +0 -0
  80. package/core/Table/Table.js +1 -0
  81. package/core/Table/TableCell.js +7 -0
  82. package/core/Table/TableRow.js +1 -0
  83. package/core/Table/data.js +1 -0
  84. package/core/Table.js +1 -0
  85. package/core/Tooltip/.DS_Store +0 -0
  86. package/core/Tooltip.js +1 -0
  87. package/core/css.js +1 -0
  88. package/core/dom-query.js +1 -0
  89. package/core/hubspot-chat-toggle.js +1 -0
  90. package/core/icons/discord.svg +10 -0
  91. package/core/icons/facebook.svg +4 -0
  92. package/core/icons/github.svg +3 -0
  93. package/core/icons/glassdoor.svg +3 -0
  94. package/core/icons/google.svg +3 -0
  95. package/core/icons/icon-display-48hrs.svg +3 -0
  96. package/core/icons/icon-display-about-ably-col.svg +4 -0
  97. package/core/icons/icon-display-api-keys.svg +3 -0
  98. package/core/icons/icon-display-api.svg +3 -0
  99. package/core/icons/icon-display-asset-tracking-col.svg +18 -0
  100. package/core/icons/icon-display-browser.svg +10 -0
  101. package/core/icons/icon-display-calendar.svg +3 -0
  102. package/core/icons/icon-display-call-mobile.svg +3 -0
  103. package/core/icons/icon-display-careers-col.svg +9 -0
  104. package/core/icons/icon-display-case-studies-col.svg +5 -0
  105. package/core/icons/icon-display-chat-col.svg +4 -0
  106. package/core/icons/icon-display-chat-stack-col.svg +4 -0
  107. package/core/icons/icon-display-chat-stack.svg +4 -0
  108. package/core/icons/icon-display-cloud-servers.svg +3 -0
  109. package/core/icons/icon-display-compare-tech-col.svg +9 -0
  110. package/core/icons/icon-display-customers-col.svg +15 -0
  111. package/core/icons/icon-display-data-broadcast-col.svg +26 -0
  112. package/core/icons/icon-display-data-synchronization-col.svg +14 -0
  113. package/core/icons/icon-display-docs-col.svg +7 -0
  114. package/core/icons/icon-display-documentation.svg +3 -0
  115. package/core/icons/icon-display-events-col.svg +13 -0
  116. package/core/icons/icon-display-examples-col.svg +11 -0
  117. package/core/icons/icon-display-gdpr.svg +3 -0
  118. package/core/icons/icon-display-general-comms.svg +3 -0
  119. package/core/icons/icon-display-hipaa.svg +10 -0
  120. package/core/icons/icon-display-integrations-col.svg +8 -0
  121. package/core/icons/icon-display-it-support-access.svg +3 -0
  122. package/core/icons/icon-display-it-support-helpdesk.svg +3 -0
  123. package/core/icons/icon-display-kafka-at-the-edge-col.svg +8 -0
  124. package/core/icons/icon-display-laptop.svg +10 -0
  125. package/core/icons/icon-display-lightbulb-col.svg +10 -0
  126. package/core/icons/icon-display-live-chat.svg +3 -0
  127. package/core/icons/icon-display-map-pin.svg +3 -0
  128. package/core/icons/icon-display-message.svg +3 -0
  129. package/core/icons/icon-display-padlock-closed.svg +3 -0
  130. package/core/icons/icon-display-platform.svg +22 -0
  131. package/core/icons/icon-display-play.svg +3 -0
  132. package/core/icons/icon-display-privacy-shield-framework.svg +7 -0
  133. package/core/icons/icon-display-push-notifications-col.svg +6 -0
  134. package/core/icons/icon-display-quickstart-guides-col.svg +8 -0
  135. package/core/icons/icon-display-resources-col.svg +21 -0
  136. package/core/icons/icon-display-sdks-col.svg +11 -0
  137. package/core/icons/icon-display-servers.svg +3 -0
  138. package/core/icons/icon-display-shopping-cart.svg +10 -0
  139. package/core/icons/icon-display-sla.svg +3 -0
  140. package/core/icons/icon-display-soc2-type2.svg +3 -0
  141. package/core/icons/icon-display-tech-account-comms.svg +3 -0
  142. package/core/icons/icon-display-tutorials-demos-col.svg +25 -0
  143. package/core/icons/icon-display-virtual-events-col.svg +12 -0
  144. package/core/icons/icon-display-virtual-events.svg +12 -0
  145. package/core/icons/icon-gui-ably-badge.svg +3 -0
  146. package/core/icons/icon-gui-arrow-bidirectional-horizontal.svg +3 -0
  147. package/core/icons/icon-gui-arrow-bidirectional-vertical.svg +3 -0
  148. package/core/icons/icon-gui-arrow-down.svg +3 -0
  149. package/core/icons/icon-gui-arrow-left.svg +3 -0
  150. package/core/icons/icon-gui-arrow-right.svg +3 -0
  151. package/core/icons/icon-gui-arrow-up.svg +3 -0
  152. package/core/icons/icon-gui-burger-menu.svg +5 -0
  153. package/core/icons/icon-gui-check-circled-fill-black.svg +4 -0
  154. package/core/icons/icon-gui-check-circled-fill.svg +4 -0
  155. package/core/icons/icon-gui-check-circled.svg +3 -0
  156. package/core/icons/icon-gui-checklist-checked.svg +3 -0
  157. package/core/icons/icon-gui-clock.svg +3 -0
  158. package/core/icons/icon-gui-close.svg +3 -0
  159. package/core/icons/icon-gui-copy.svg +10 -0
  160. package/core/icons/icon-gui-cross-circled-fill.svg +4 -0
  161. package/core/icons/icon-gui-cross-circled.svg +3 -0
  162. package/core/icons/icon-gui-dash-circled.svg +3 -0
  163. package/core/icons/icon-gui-disclosure-arrow.svg +3 -0
  164. package/core/icons/icon-gui-document-generic.svg +3 -0
  165. package/core/icons/icon-gui-enlarge.svg +3 -0
  166. package/core/icons/icon-gui-external-link.svg +3 -0
  167. package/core/icons/icon-gui-filter-flow-step-1.svg +5 -0
  168. package/core/icons/icon-gui-filter-flow-step-2.svg +5 -0
  169. package/core/icons/icon-gui-filter-flow-step-3.svg +5 -0
  170. package/core/icons/icon-gui-history.svg +3 -0
  171. package/core/icons/icon-gui-info.svg +3 -0
  172. package/core/icons/icon-gui-link-arrow.svg +3 -0
  173. package/core/icons/icon-gui-link.svg +4 -0
  174. package/core/icons/icon-gui-live-chat.svg +3 -0
  175. package/core/icons/icon-gui-minus.svg +3 -0
  176. package/core/icons/icon-gui-partial.svg +4 -0
  177. package/core/icons/icon-gui-plus.svg +3 -0
  178. package/core/icons/icon-gui-quote-marks-solid.svg +3 -0
  179. package/core/icons/icon-gui-refresh.svg +10 -0
  180. package/core/icons/icon-gui-resources.svg +3 -0
  181. package/core/icons/icon-gui-search.svg +3 -0
  182. package/core/icons/icon-gui-tick.svg +3 -0
  183. package/core/icons/icon-gui-warning.svg +5 -0
  184. package/core/icons/icon-live-updates-results-metrics-col.svg +26 -0
  185. package/core/icons/icon-multi-user-spaces-col.svg +13 -0
  186. package/core/icons/icon-social-x.svg +3 -0
  187. package/core/icons/icon-tech-apachekafka.svg +3 -0
  188. package/core/icons/linkedin.svg +3 -0
  189. package/core/icons/quote.svg +3 -0
  190. package/core/icons/stackoverflow.svg +3 -0
  191. package/core/icons/twitter.svg +3 -0
  192. package/core/icons/youtube.svg +11 -0
  193. package/core/icons.js +1 -0
  194. package/core/load-sprites.js +1 -0
  195. package/core/react-renderer.js +1 -0
  196. package/core/remote-blogs-posts.js +1 -0
  197. package/core/remote-data-store.js +1 -0
  198. package/core/remote-data-util.js +1 -0
  199. package/core/remote-session-data.js +1 -0
  200. package/core/scripts.js +1 -2
  201. package/core/sprites.svg +1 -525
  202. package/core/styles/buttons.css +124 -0
  203. package/core/styles/forms.css +64 -0
  204. package/core/styles/layout.css +21 -0
  205. package/core/styles/properties.css +278 -0
  206. package/core/styles/text.css +168 -0
  207. package/core/styles.base.css +1 -0
  208. package/core/styles.components.css +35 -0
  209. package/core/styles.css +2 -699
  210. package/core/url-base.js +1 -0
  211. package/core/utils/syntax-highlighter-registry.js +1 -0
  212. package/core/utils/syntax-highlighter.css +74 -0
  213. package/core/utils/syntax-highlighter.js +1 -0
  214. package/package.json +39 -35
  215. package/reset/scripts.js +1 -1
  216. package/reset/styles/normalize.css +353 -0
  217. package/reset/styles/reset.css +129 -0
  218. package/reset/styles.css +2 -477
  219. package/src/.DS_Store +0 -0
  220. package/src/core/.DS_Store +0 -0
  221. package/src/core/Accordion/.DS_Store +0 -0
  222. package/src/core/Accordion/Accordion.stories.tsx +39 -0
  223. package/src/core/Accordion.tsx +147 -0
  224. package/src/core/Code/.DS_Store +0 -0
  225. package/src/core/Code/Code.stories.tsx +71 -0
  226. package/src/core/Code.tsx +45 -0
  227. package/src/core/{ConnectStateWrapper/component.jsx → ConnectStateWrapper.tsx} +8 -4
  228. package/src/core/ContactFooter/.DS_Store +0 -0
  229. package/src/core/ContactFooter/ContactFooter.stories.tsx +11 -0
  230. package/src/core/{ContactFooter/component.jsx → ContactFooter.tsx} +44 -19
  231. package/src/core/CookieMessage/.DS_Store +0 -0
  232. package/src/core/CookieMessage/CookieMessage.stories.tsx +12 -0
  233. package/src/core/{CookieMessage/component.jsx → CookieMessage.tsx} +15 -11
  234. package/src/core/CustomerLogos/.DS_Store +0 -0
  235. package/src/core/CustomerLogos/CustomerLogos.stories.tsx +43 -0
  236. package/src/core/CustomerLogos.tsx +35 -0
  237. package/src/core/DropdownMenu/.DS_Store +0 -0
  238. package/src/core/DropdownMenu/DropdownMenu.stories.tsx +48 -0
  239. package/src/core/{DropdownMenu/component.jsx → DropdownMenu.tsx} +64 -36
  240. package/src/core/Expander/Expander.stories.tsx +132 -0
  241. package/src/core/Expander.tsx +54 -0
  242. package/src/core/FeaturedLink/.DS_Store +0 -0
  243. package/src/core/FeaturedLink/FeaturedLink.stories.tsx +43 -0
  244. package/src/core/{FeaturedLink/component.jsx → FeaturedLink.tsx} +26 -18
  245. package/src/core/Flash/.DS_Store +0 -0
  246. package/src/core/Flash/Flash.stories.tsx +37 -0
  247. package/src/core/{Flash/component.jsx → Flash.tsx} +77 -39
  248. package/src/core/Footer/.DS_Store +0 -0
  249. package/src/core/Footer/Footer.stories.tsx +26 -0
  250. package/src/core/{Footer/component.jsx → Footer.tsx} +236 -70
  251. package/src/core/Icon/.DS_Store +0 -0
  252. package/src/core/Icon/Icon.stories.tsx +151 -0
  253. package/src/core/Icon.tsx +26 -0
  254. package/src/core/Loader/.DS_Store +0 -0
  255. package/src/core/Loader/Loader.stories.tsx +21 -0
  256. package/src/core/{Loader/component.jsx → Loader.tsx} +11 -8
  257. package/src/core/Logo/.DS_Store +0 -0
  258. package/src/core/Logo/Logo.stories.tsx +12 -0
  259. package/src/core/Logo.tsx +29 -0
  260. package/src/core/Meganav/.DS_Store +0 -0
  261. package/src/core/Meganav/Meganav.stories.tsx +86 -0
  262. package/src/core/Meganav/component.css +2 -2
  263. package/src/core/Meganav/component.js +6 -9
  264. package/src/core/Meganav.tsx +225 -0
  265. package/src/core/MeganavBlogPostsList/.DS_Store +0 -0
  266. package/src/core/{MeganavBlogPostsList/component.jsx → MeganavBlogPostsList.tsx} +15 -14
  267. package/src/core/{MeganavContentCompany/component.jsx → MeganavContentCompany.tsx} +82 -33
  268. package/src/core/{MeganavContentDevelopers/component.jsx → MeganavContentDevelopers.tsx} +98 -34
  269. package/src/core/MeganavContentProducts.tsx +165 -0
  270. package/src/core/MeganavContentUseCases.tsx +244 -0
  271. package/src/core/MeganavControl/.DS_Store +0 -0
  272. package/src/core/{MeganavControl/component.jsx → MeganavControl.tsx} +18 -12
  273. package/src/core/MeganavControlMobileDropdown/.DS_Store +0 -0
  274. package/src/core/{MeganavControlMobileDropdown/component.jsx → MeganavControlMobileDropdown.tsx} +3 -7
  275. package/src/core/MeganavControlMobilePanelClose/.DS_Store +0 -0
  276. package/src/core/{MeganavControlMobilePanelClose/component.jsx → MeganavControlMobilePanelClose.tsx} +15 -9
  277. package/src/core/MeganavControlMobilePanelOpen/.DS_Store +0 -0
  278. package/src/core/MeganavControlMobilePanelOpen.tsx +31 -0
  279. package/src/core/MeganavItemsDesktop.tsx +68 -0
  280. package/src/core/MeganavItemsMobile.tsx +197 -0
  281. package/src/core/{MeganavItemsSignedIn/component.jsx → MeganavItemsSignedIn.tsx} +55 -23
  282. package/src/core/MeganavSearch.tsx +36 -0
  283. package/src/core/MeganavSearchAutocomplete/.DS_Store +0 -0
  284. package/src/core/MeganavSearchAutocomplete.tsx +12 -0
  285. package/src/core/MeganavSearchPanel.tsx +52 -0
  286. package/src/core/MeganavSearchSuggestions/.DS_Store +0 -0
  287. package/src/core/MeganavSearchSuggestions.tsx +62 -0
  288. package/src/core/Notice/.DS_Store +0 -0
  289. package/src/core/Notice/component.js +1 -2
  290. package/src/core/Notice.tsx +102 -0
  291. package/src/core/SignOutLink.tsx +51 -0
  292. package/src/core/Slider/.DS_Store +0 -0
  293. package/src/core/Slider/Slider.stories.tsx +98 -0
  294. package/src/core/Slider/component.css +32 -0
  295. package/src/core/Slider/component.js +0 -2
  296. package/src/core/Slider.tsx +192 -0
  297. package/src/core/Table/.DS_Store +0 -0
  298. package/src/core/Table/Table.stories.tsx +12 -0
  299. package/src/core/Table/Table.tsx +59 -0
  300. package/src/core/Table/TableCell.tsx +109 -0
  301. package/src/core/Table/TableRow.tsx +25 -0
  302. package/src/core/Table/data.tsx +113 -0
  303. package/src/core/Table.tsx +26 -0
  304. package/src/core/Tooltip/.DS_Store +0 -0
  305. package/src/core/Tooltip/Tooltip.stories.tsx +27 -0
  306. package/src/core/Tooltip.tsx +88 -0
  307. package/src/core/icons/icon-gui-partial.svg +4 -0
  308. package/src/core/icons.js +6 -0
  309. package/src/core/{react-renderer.js → react-renderer.tsx} +9 -7
  310. package/src/core/scripts.js +0 -2
  311. package/src/core/styles/properties.css +0 -7
  312. package/src/core/utils/syntax-highlighter.css +3 -0
  313. package/src/pages/Buttons.mdx +121 -0
  314. package/src/pages/Chips.mdx +136 -0
  315. package/src/pages/Colour.mdx +23 -0
  316. package/src/pages/Forms.mdx +173 -0
  317. package/src/pages/Layout.mdx +58 -0
  318. package/src/pages/Typography.mdx +206 -0
  319. package/src/pages/utils.ts +70 -0
  320. package/tailwind.config.js +1 -7
  321. package/tailwind.extend.js +1 -1
  322. package/core/.gitignore +0 -1
  323. package/core/Code.jsx +0 -684
  324. package/core/CompanyAutocomplete/component.css +0 -46
  325. package/core/CompanyAutocomplete/component.js +0 -2
  326. package/core/CompanyAutocomplete/component.js.LICENSE.txt +0 -1
  327. package/core/ConnectStateWrapper/component.js +0 -1
  328. package/core/ConnectStateWrapper.jsx +0 -222
  329. package/core/ContactFooter.jsx +0 -342
  330. package/core/CookieMessage/component.js +0 -1
  331. package/core/CookieMessage.jsx +0 -204
  332. package/core/CustomerLogos/component.js +0 -1
  333. package/core/CustomerLogos.jsx +0 -144
  334. package/core/DropdownMenu/component.js +0 -1
  335. package/core/DropdownMenu.jsx +0 -313
  336. package/core/FeatureFooter/component.css +0 -13
  337. package/core/FeatureFooter/component.js +0 -1
  338. package/core/FeaturedLink/component.js +0 -1
  339. package/core/FeaturedLink.jsx +0 -241
  340. package/core/Flash/component.js +0 -1
  341. package/core/Flash.jsx +0 -622
  342. package/core/Footer/component.js +0 -1
  343. package/core/Footer.jsx +0 -587
  344. package/core/Icon/component.js +0 -1
  345. package/core/Icon.jsx +0 -152
  346. package/core/Loader/component.js +0 -1
  347. package/core/Loader.jsx +0 -154
  348. package/core/Logo/component.js +0 -1
  349. package/core/Logo.jsx +0 -147
  350. package/core/Meganav.jsx +0 -4151
  351. package/core/MeganavBlogPostsList/component.js.LICENSE.txt +0 -1
  352. package/core/MeganavBlogPostsList.jsx +0 -296
  353. package/core/MeganavContentCompany/component.js +0 -1
  354. package/core/MeganavContentCompany.jsx +0 -1058
  355. package/core/MeganavContentDevelopers/component.js +0 -1
  356. package/core/MeganavContentDevelopers.jsx +0 -334
  357. package/core/MeganavContentProducts/component.js +0 -1
  358. package/core/MeganavContentProducts.jsx +0 -373
  359. package/core/MeganavContentUseCases/component.js +0 -1
  360. package/core/MeganavContentUseCases.jsx +0 -341
  361. package/core/MeganavControl.jsx +0 -199
  362. package/core/MeganavControlMobileDropdown.jsx +0 -197
  363. package/core/MeganavControlMobilePanelClose.jsx +0 -198
  364. package/core/MeganavControlMobilePanelOpen.jsx +0 -193
  365. package/core/MeganavItemsDesktop/component.js +0 -1
  366. package/core/MeganavItemsDesktop.jsx +0 -279
  367. package/core/MeganavItemsMobile/component.js +0 -1
  368. package/core/MeganavItemsMobile.jsx +0 -689
  369. package/core/MeganavItemsSignedIn/component.js +0 -1
  370. package/core/MeganavItemsSignedIn.jsx +0 -643
  371. package/core/MeganavSearch/component.js +0 -1
  372. package/core/MeganavSearch.jsx +0 -434
  373. package/core/MeganavSearchAutocomplete.jsx +0 -117
  374. package/core/MeganavSearchPanel/component.js +0 -1
  375. package/core/MeganavSearchPanel.jsx +0 -386
  376. package/core/MeganavSearchSuggestions.jsx +0 -299
  377. package/core/Notice.jsx +0 -914
  378. package/core/Showcase/component.css +0 -31
  379. package/core/Showcase/component.js +0 -1
  380. package/core/Showcase.jsx +0 -17
  381. package/core/SignOutLink/component.js +0 -1
  382. package/core/SignOutLink.jsx +0 -157
  383. package/core/Slider.jsx +0 -400
  384. package/core/Uptime/component.css +0 -128
  385. package/core/Uptime/component.js +0 -1
  386. package/core/Uptime.jsx +0 -895
  387. package/core/scripts.js.LICENSE.txt +0 -1
  388. package/preview/log/.keep +0 -0
  389. package/preview/tmp/.keep +0 -0
  390. package/preview/tmp/pids/.keep +0 -0
  391. package/reset/.gitignore +0 -1
  392. package/src/core/Code/component.html.erb +0 -3
  393. package/src/core/Code/component.jsx +0 -31
  394. package/src/core/Code/component.rb +0 -12
  395. package/src/core/CompanyAutocomplete/component.css +0 -45
  396. package/src/core/CompanyAutocomplete/component.js +0 -204
  397. package/src/core/ConnectStateWrapper/component.js +0 -0
  398. package/src/core/ContactFooter/component.html.erb +0 -32
  399. package/src/core/ContactFooter/component.rb +0 -13
  400. package/src/core/CookieMessage/component.js +0 -1
  401. package/src/core/CustomerLogos/component.html.erb +0 -9
  402. package/src/core/CustomerLogos/component.js +0 -0
  403. package/src/core/CustomerLogos/component.jsx +0 -28
  404. package/src/core/CustomerLogos/component.rb +0 -14
  405. package/src/core/DropdownMenu/component.js +0 -0
  406. package/src/core/FeatureFooter/component.css +0 -12
  407. package/src/core/FeatureFooter/component.html.erb +0 -54
  408. package/src/core/FeatureFooter/component.js +0 -7
  409. package/src/core/FeatureFooter/component.rb +0 -30
  410. package/src/core/FeaturedLink/component.html.erb +0 -15
  411. package/src/core/FeaturedLink/component.js +0 -0
  412. package/src/core/FeaturedLink/component.rb +0 -21
  413. package/src/core/Flash/component.js +0 -1
  414. package/src/core/Footer/component.html.erb +0 -256
  415. package/src/core/Footer/component.js +0 -1
  416. package/src/core/Footer/component.rb +0 -14
  417. package/src/core/Icon/component.html.erb +0 -3
  418. package/src/core/Icon/component.js +0 -0
  419. package/src/core/Icon/component.jsx +0 -19
  420. package/src/core/Icon/component.rb +0 -25
  421. package/src/core/Loader/component.html.erb +0 -18
  422. package/src/core/Loader/component.js +0 -0
  423. package/src/core/Loader/component.rb +0 -19
  424. package/src/core/Logo/component.html.erb +0 -3
  425. package/src/core/Logo/component.js +0 -0
  426. package/src/core/Logo/component.jsx +0 -20
  427. package/src/core/Logo/component.rb +0 -31
  428. package/src/core/Meganav/component.html.erb +0 -31
  429. package/src/core/Meganav/component.jsx +0 -123
  430. package/src/core/Meganav/component.rb +0 -60
  431. package/src/core/MeganavBlogPostsList/component.html.erb +0 -5
  432. package/src/core/MeganavBlogPostsList/component.rb +0 -13
  433. package/src/core/MeganavContentCompany/component.html.erb +0 -90
  434. package/src/core/MeganavContentCompany/component.js +0 -0
  435. package/src/core/MeganavContentCompany/component.rb +0 -14
  436. package/src/core/MeganavContentDevelopers/component.html.erb +0 -129
  437. package/src/core/MeganavContentDevelopers/component.js +0 -0
  438. package/src/core/MeganavContentDevelopers/component.rb +0 -13
  439. package/src/core/MeganavContentProducts/component.html.erb +0 -83
  440. package/src/core/MeganavContentProducts/component.js +0 -0
  441. package/src/core/MeganavContentProducts/component.jsx +0 -105
  442. package/src/core/MeganavContentProducts/component.rb +0 -14
  443. package/src/core/MeganavContentUseCases/component.html.erb +0 -135
  444. package/src/core/MeganavContentUseCases/component.js +0 -1
  445. package/src/core/MeganavContentUseCases/component.jsx +0 -147
  446. package/src/core/MeganavContentUseCases/component.rb +0 -13
  447. package/src/core/MeganavControl/component.html.erb +0 -6
  448. package/src/core/MeganavControl/component.rb +0 -20
  449. package/src/core/MeganavControlMobileDropdown/component.html.erb +0 -7
  450. package/src/core/MeganavControlMobileDropdown/component.rb +0 -11
  451. package/src/core/MeganavControlMobilePanelClose/component.html.erb +0 -12
  452. package/src/core/MeganavControlMobilePanelClose/component.rb +0 -12
  453. package/src/core/MeganavControlMobilePanelOpen/component.html.erb +0 -7
  454. package/src/core/MeganavControlMobilePanelOpen/component.jsx +0 -25
  455. package/src/core/MeganavControlMobilePanelOpen/component.rb +0 -9
  456. package/src/core/MeganavItemsDesktop/component.html.erb +0 -17
  457. package/src/core/MeganavItemsDesktop/component.js +0 -0
  458. package/src/core/MeganavItemsDesktop/component.jsx +0 -49
  459. package/src/core/MeganavItemsDesktop/component.rb +0 -23
  460. package/src/core/MeganavItemsMobile/component.html.erb +0 -75
  461. package/src/core/MeganavItemsMobile/component.js +0 -0
  462. package/src/core/MeganavItemsMobile/component.jsx +0 -137
  463. package/src/core/MeganavItemsMobile/component.rb +0 -21
  464. package/src/core/MeganavItemsSignedIn/component.html.erb +0 -53
  465. package/src/core/MeganavItemsSignedIn/component.js +0 -0
  466. package/src/core/MeganavItemsSignedIn/component.rb +0 -33
  467. package/src/core/MeganavSearch/component.html.erb +0 -15
  468. package/src/core/MeganavSearch/component.js +0 -0
  469. package/src/core/MeganavSearch/component.jsx +0 -33
  470. package/src/core/MeganavSearch/component.rb +0 -13
  471. package/src/core/MeganavSearchAutocomplete/component.html.erb +0 -6
  472. package/src/core/MeganavSearchAutocomplete/component.jsx +0 -14
  473. package/src/core/MeganavSearchAutocomplete/component.rb +0 -6
  474. package/src/core/MeganavSearchPanel/component.html.erb +0 -22
  475. package/src/core/MeganavSearchPanel/component.js +0 -0
  476. package/src/core/MeganavSearchPanel/component.jsx +0 -39
  477. package/src/core/MeganavSearchPanel/component.rb +0 -13
  478. package/src/core/MeganavSearchSuggestions/component.html.erb +0 -22
  479. package/src/core/MeganavSearchSuggestions/component.jsx +0 -49
  480. package/src/core/MeganavSearchSuggestions/component.rb +0 -18
  481. package/src/core/Notice/component.html.erb +0 -16
  482. package/src/core/Notice/component.jsx +0 -71
  483. package/src/core/Notice/component.rb +0 -29
  484. package/src/core/Showcase/component.css +0 -30
  485. package/src/core/Showcase/component.html.erb +0 -76
  486. package/src/core/Showcase/component.js +0 -180
  487. package/src/core/Showcase/component.jsx +0 -0
  488. package/src/core/Showcase/component.rb +0 -190
  489. package/src/core/SignOutLink/component.html.erb +0 -1
  490. package/src/core/SignOutLink/component.js +0 -0
  491. package/src/core/SignOutLink/component.jsx +0 -32
  492. package/src/core/SignOutLink/component.rb +0 -17
  493. package/src/core/Slider/component.html.erb +0 -28
  494. package/src/core/Slider/component.jsx +0 -86
  495. package/src/core/Slider/component.rb +0 -38
  496. package/src/core/Uptime/component.css +0 -127
  497. package/src/core/Uptime/component.html.erb +0 -0
  498. package/src/core/Uptime/component.js +0 -1
  499. package/src/core/Uptime/component.jsx +0 -183
  500. package/src/core/Uptime/component.rb +0 -7
  501. package/src/core/core.rb +0 -81
@@ -0,0 +1,71 @@
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
+ };
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+
3
+ import "./utils/syntax-highlighter.css";
4
+ import {
5
+ highlightSnippet,
6
+ registerDefaultLanguages,
7
+ } from "./utils/syntax-highlighter";
8
+ import languagesRegistry from "./utils/syntax-highlighter-registry";
9
+
10
+ registerDefaultLanguages(languagesRegistry);
11
+
12
+ type CodeProps = {
13
+ language: string;
14
+ snippet: string;
15
+ textSize?: string;
16
+ padding?: string;
17
+ additionalCSS?: string;
18
+ };
19
+
20
+ const Code = ({
21
+ language,
22
+ snippet,
23
+ textSize = "ui-text-code",
24
+ padding = "p-32",
25
+ additionalCSS = "",
26
+ }: CodeProps) => {
27
+ const HTMLraw = highlightSnippet(language, `${snippet}`.trim()) ?? "";
28
+ const className = `language-${language} ${textSize}`;
29
+
30
+ return (
31
+ <div
32
+ className={`hljs overflow-auto ${padding} ${additionalCSS}`}
33
+ data-id="code"
34
+ >
35
+ <pre lang={language}>
36
+ <code
37
+ className={className}
38
+ dangerouslySetInnerHTML={{ __html: HTMLraw }}
39
+ />
40
+ </pre>
41
+ </div>
42
+ );
43
+ };
44
+
45
+ export default Code;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
 
3
- import { connectState, getRemoteDataStore } from "../remote-data-store";
3
+ import { connectState, getRemoteDataStore } from "./remote-data-store";
4
4
 
5
5
  /*
6
6
  Connect a react component to a global store.
@@ -12,14 +12,18 @@ import { connectState, getRemoteDataStore } from "../remote-data-store";
12
12
  - initial state is set in useEffect so the wrapped component needs to handle it's props set to undefined initially
13
13
  */
14
14
 
15
- export const ConnectStateWrapper = (Component, selectors) => {
15
+ const ConnectStateWrapper = (Component, selectors) => {
16
16
  const [state, setState] = useState({});
17
17
 
18
- const setStateForKey = (key) => (storeState) => setState(() => ({ [key]: storeState }));
18
+ const setStateForKey = (key) => (storeState) =>
19
+ setState(() => ({ [key]: storeState }));
19
20
 
20
21
  useEffect(() => {
21
22
  const store = getRemoteDataStore();
22
- const resolvedState = Object.keys(selectors).reduce((acc, key) => ({ ...acc, [key]: selectors[key](store) }), {});
23
+ const resolvedState = Object.keys(selectors).reduce(
24
+ (acc, key) => ({ ...acc, [key]: selectors[key](store) }),
25
+ {}
26
+ );
23
27
 
24
28
  // Set initial state
25
29
  setState(resolvedState);
Binary file
@@ -0,0 +1,11 @@
1
+ import ContactFooter from "../ContactFooter";
2
+
3
+ export default {
4
+ title: "Components/Contact Footer",
5
+ component: ContactFooter,
6
+ parameters: {
7
+ layout: "fullscreen",
8
+ },
9
+ };
10
+
11
+ export const Default = {};
@@ -1,23 +1,34 @@
1
1
  import React, { useEffect } from "react";
2
- import T from "prop-types";
3
2
 
4
- import Icon from "../Icon/component.jsx";
5
- import _absUrl from "../url-base";
3
+ import Icon from "./Icon";
4
+ import _absUrl from "./url-base.js";
5
+ import toggleChatWidget from "./hubspot-chat-toggle";
6
6
 
7
- import toggleChatWidget from "./component.js";
7
+ type ContactFooterProps = {
8
+ urlBase: string;
9
+ };
8
10
 
9
- export default function ContactFooter({ urlBase }) {
10
- useEffect(() => toggleChatWidget(), []);
11
+ const ContactFooter = ({ urlBase }: ContactFooterProps) => {
12
+ useEffect(() => toggleChatWidget({ dataId: "contact-footer" }), []);
11
13
  const absUrl = (path) => _absUrl(path, urlBase);
12
14
 
13
15
  return (
14
- <div className="ui-contact-footer font-sans antialiased" data-id="contact-footer">
16
+ <div
17
+ className="ui-contact-footer font-sans antialiased"
18
+ data-id="contact-footer"
19
+ >
15
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">
16
21
  <div className="ui-contact-footer-box">
17
- <Icon name="icon-display-live-chat" size="3rem" additionalCSS="block mb-16" />
22
+ <Icon
23
+ name="icon-display-live-chat"
24
+ size="3rem"
25
+ additionalCSS="block mb-16"
26
+ />
18
27
  <div>
19
28
  <div className="ui-text-h3 mb-24">Live Chat</div>
20
- <p className="ui-text-p1">Reach out team of experts over chat powered by Ably.</p>
29
+ <p className="ui-text-p1">
30
+ Reach out team of experts over chat powered by Ably.
31
+ </p>
21
32
  </div>
22
33
  <button
23
34
  type="button"
@@ -32,12 +43,17 @@ export default function ContactFooter({ urlBase }) {
32
43
  </div>
33
44
 
34
45
  <div className="ui-contact-footer-box">
35
- <Icon name="icon-display-call-mobile" size="3rem" additionalCSS="block mb-16" />
46
+ <Icon
47
+ name="icon-display-call-mobile"
48
+ size="3rem"
49
+ additionalCSS="block mb-16"
50
+ />
36
51
  <div className="flex-grow">
37
52
  <div className="ui-text-h3 mb-24">Call us</div>
38
53
  <p className="ui-text-p1">
39
54
  <span className="block">
40
- <strong className="font-bold">+1 877 434 5287</strong> (USA, toll free)
55
+ <strong className="font-bold">+1 877 434 5287</strong> (USA,
56
+ toll free)
41
57
  </span>
42
58
  <span className="block">
43
59
  <strong className="font-bold">+44 20 3318 4689</strong> (UK)
@@ -47,20 +63,29 @@ export default function ContactFooter({ urlBase }) {
47
63
  </div>
48
64
 
49
65
  <div className="ui-contact-footer-box">
50
- <Icon name="icon-display-tech-account-comms" size="3rem" additionalCSS="block mb-16" />
66
+ <Icon
67
+ name="icon-display-tech-account-comms"
68
+ size="3rem"
69
+ additionalCSS="block mb-16"
70
+ />
51
71
  <div>
52
- <div className="ui-text-h3 mb-24">Technical and account support</div>
53
- <p className="ui-text-p1">We&apos;re standing by to help with any questions or code.</p>
72
+ <div className="ui-text-h3 mb-24">
73
+ Technical and account support
74
+ </div>
75
+ <p className="ui-text-p1">
76
+ We&apos;re standing by to help with any questions or code.
77
+ </p>
54
78
  </div>
55
- <a className="ui-btn-secondary self-start p-btn mt-16" href={absUrl("/support")}>
79
+ <a
80
+ className="ui-btn-secondary self-start p-btn mt-16"
81
+ href={absUrl("/support")}
82
+ >
56
83
  Get support now
57
84
  </a>
58
85
  </div>
59
86
  </div>
60
87
  </div>
61
88
  );
62
- }
63
-
64
- ContactFooter.propTypes = {
65
- urlBase: T.string,
66
89
  };
90
+
91
+ export default ContactFooter;
Binary file
@@ -0,0 +1,12 @@
1
+ import CookieMessage from "../CookieMessage";
2
+
3
+ export default {
4
+ title: "Components/Cookie Message",
5
+ component: CookieMessage,
6
+ args: {
7
+ cookieId: "cookie-namespace",
8
+ noticeId: "cookie-message",
9
+ },
10
+ };
11
+
12
+ export const Default = {};
@@ -1,13 +1,17 @@
1
1
  import React, { useRef, useEffect, useState } from "react";
2
- import T from "prop-types";
3
2
  import Cookie from "js-cookie";
4
3
 
5
- import _absUrl from "../url-base";
4
+ import _absUrl from "./url-base";
6
5
 
7
6
  const COOKIE_EXPIRY = 365;
8
7
 
9
- export default function CookieMessage({ cookieId, urlBase }) {
10
- const ref = useRef(null);
8
+ type CookieMessageProps = {
9
+ cookieId: string;
10
+ urlBase: string;
11
+ };
12
+
13
+ const CookieMessage = ({ cookieId, urlBase }: CookieMessageProps) => {
14
+ const ref = useRef<HTMLDivElement>(null);
11
15
  const [hideCookieMessage, setHideCookieMessage] = useState(true);
12
16
 
13
17
  useEffect(() => {
@@ -18,7 +22,7 @@ export default function CookieMessage({ cookieId, urlBase }) {
18
22
  const handleClose = () => {
19
23
  Cookie.set(cookieId, "1", { expires: COOKIE_EXPIRY });
20
24
 
21
- ref.current.classList.add("bottom-1", "opacity-0");
25
+ ref.current?.classList.add("bottom-1", "opacity-0");
22
26
  setTimeout(() => setHideCookieMessage(true), 500);
23
27
  };
24
28
 
@@ -35,14 +39,14 @@ export default function CookieMessage({ cookieId, urlBase }) {
35
39
  </a>{" "}
36
40
  to improve your experience.
37
41
  </p>
38
- <button className="ui-btn-secondary mt-12 sm:mt-0 whitespace-nowrap" onClick={handleClose}>
42
+ <button
43
+ className="ui-btn-secondary mt-12 sm:mt-0 whitespace-nowrap"
44
+ onClick={handleClose}
45
+ >
39
46
  Accept and close
40
47
  </button>
41
48
  </div>
42
49
  );
43
- }
44
-
45
- CookieMessage.propTypes = {
46
- cookieId: T.string,
47
- urlBase: T.string,
48
50
  };
51
+
52
+ export default CookieMessage;
Binary file
@@ -0,0 +1,43 @@
1
+ import CustomerLogos from "../CustomerLogos";
2
+
3
+ import hubspot from "../images/cust-logo-hubspot-mono-pos.svg";
4
+ import webflow from "../images/cust-logo-webflow-col-pos.svg";
5
+ import mentimeter from "../images/cust-logo-mentimeter-mono-pos.svg";
6
+ import toyota from "../images/cust-logo-toyota-mono-pos.svg";
7
+ import split from "../images/cust-logo-split-mono-pos.svg";
8
+ import australian from "../images/cust-logo-ausopen-mono-pos.svg";
9
+
10
+ export default {
11
+ title: "Components/Customer Logos",
12
+ component: CustomerLogos,
13
+ args: {
14
+ companies: [
15
+ {
16
+ label: "Hubspot",
17
+ logo: hubspot,
18
+ },
19
+ {
20
+ label: "Webflow",
21
+ logo: webflow,
22
+ },
23
+ {
24
+ label: "Mentimeter",
25
+ logo: mentimeter,
26
+ },
27
+ {
28
+ label: "Toyota",
29
+ logo: toyota,
30
+ },
31
+ {
32
+ label: "Split",
33
+ logo: split,
34
+ },
35
+ {
36
+ label: "Australian Open",
37
+ logo: australian,
38
+ },
39
+ ],
40
+ },
41
+ };
42
+
43
+ export const Default = {};
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+
3
+ type CompanyEntity = {
4
+ label: string;
5
+ logo: string;
6
+ };
7
+
8
+ type CustomerLogosProps = {
9
+ companies: CompanyEntity[];
10
+ additionalCss?: string;
11
+ };
12
+
13
+ const CustomerLogos = ({
14
+ companies,
15
+ additionalCss = "",
16
+ }: CustomerLogosProps) => {
17
+ return (
18
+ <section className="w-full bg-white">
19
+ <ul
20
+ className={`py-64 flex flex-row flex-wrap md:flex-nowrap content-between m-auto items-center ${additionalCss}`}
21
+ >
22
+ {companies.map((company) => (
23
+ <li
24
+ key={company.label}
25
+ className="flex-auto text-center sm:w-1/3 w-1/2"
26
+ >
27
+ <img alt={company.label} src={company.logo} className="mx-auto" />
28
+ </li>
29
+ ))}
30
+ </ul>
31
+ </section>
32
+ );
33
+ };
34
+
35
+ export default CustomerLogos;
Binary file
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import Icon from "../Icon";
3
+ import DropdownMenu from "../DropdownMenu";
4
+
5
+ export default {
6
+ title: "Components/Dropdown Menu",
7
+ component: DropdownMenu,
8
+ };
9
+
10
+ export const Default = {
11
+ render: () => (
12
+ <DropdownMenu>
13
+ <DropdownMenu.Trigger additionalTriggerCSS="ui-text-h3">
14
+ Dropdown Menu Trigger
15
+ </DropdownMenu.Trigger>
16
+ <DropdownMenu.Content anchorPosition="left">
17
+ <DropdownMenu.Link
18
+ url="https://ably.com/"
19
+ title="Using DropdownMenuLink Component"
20
+ subtitle="This is using the inbuilt component which takes props for title, subtitle, icon name & children."
21
+ iconName="icon-gui-link-arrow"
22
+ >
23
+ <p className="ui-text-p3">I am a child! 🐣</p>
24
+ </DropdownMenu.Link>
25
+ <DropdownMenu.Link
26
+ url="https://ably.com/"
27
+ title="Using DropdownMenuLink Component - no icon, subtitle or children"
28
+ />
29
+ <a
30
+ href="https://ably.com/docs"
31
+ target="_blank"
32
+ rel="noreferrer"
33
+ className="group block p-8 hover:bg-light-grey hover:text-cool-black rounded"
34
+ >
35
+ <p className="ui-featured-link group-hover:text-gui-hover font-light text-cool-black">
36
+ Using plain HTML
37
+ <Icon
38
+ name="icon-gui-link-arrow"
39
+ size="1rem"
40
+ color="text-cool-black"
41
+ additionalCSS="ui-featured-link-icon group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus"
42
+ />
43
+ </p>
44
+ </a>
45
+ </DropdownMenu.Content>
46
+ </DropdownMenu>
47
+ ),
48
+ };
@@ -1,16 +1,52 @@
1
- import React, { createContext, useContext, useState, useEffect, useRef } from "react";
2
- import T from "prop-types";
3
- import Icon from "../Icon/component.jsx";
1
+ import React, {
2
+ createContext,
3
+ useContext,
4
+ useState,
5
+ useEffect,
6
+ useRef,
7
+ ReactNode,
8
+ Dispatch,
9
+ } from "react";
10
+ import Icon from "./Icon";
11
+
12
+ const DropdownMenuContext = createContext<{
13
+ isOpen: boolean;
14
+ setOpen: Dispatch<React.SetStateAction<boolean>>;
15
+ }>({
16
+ isOpen: false,
17
+ setOpen: () => {},
18
+ });
19
+
20
+ type DropdownMenuProps = {
21
+ children: ReactNode;
22
+ };
23
+
24
+ type TriggerProps = {
25
+ children: ReactNode;
26
+ additionalTriggerCSS?: string;
27
+ };
28
+
29
+ type ContentProps = {
30
+ children: ReactNode;
31
+ anchorPosition?: string;
32
+ additionalContentCSS?: string;
33
+ };
4
34
 
5
- const DropdownMenuContext = createContext();
35
+ type LinkProps = {
36
+ url: string;
37
+ title: string;
38
+ subtitle: string;
39
+ iconName: string;
40
+ children: ReactNode;
41
+ };
6
42
 
7
- const DropdownMenu = ({ children }) => {
43
+ const DropdownMenu = ({ children }: DropdownMenuProps) => {
8
44
  const [isOpen, setOpen] = useState(false);
9
- const ref = useRef(null);
45
+ const ref = useRef<HTMLDivElement>(null);
10
46
 
11
47
  useEffect(() => {
12
48
  const clickHandler = (e) => {
13
- if (ref?.current?.contains(e.target)) return;
49
+ if (ref.current?.contains(e.target)) return;
14
50
  setOpen(false);
15
51
  };
16
52
 
@@ -30,11 +66,7 @@ const DropdownMenu = ({ children }) => {
30
66
  );
31
67
  };
32
68
 
33
- DropdownMenu.propTypes = {
34
- children: T.node,
35
- };
36
-
37
- const Trigger = ({ children, additionalTriggerCSS = "" }) => {
69
+ const Trigger = ({ children, additionalTriggerCSS = "" }: TriggerProps) => {
38
70
  const { isOpen, setOpen } = useContext(DropdownMenuContext);
39
71
 
40
72
  return (
@@ -54,19 +86,19 @@ const Trigger = ({ children, additionalTriggerCSS = "" }) => {
54
86
  );
55
87
  };
56
88
 
57
- Trigger.propTypes = {
58
- children: T.node,
59
- additionalTriggerCSS: T.string,
60
- };
61
-
62
- const Content = ({ children, anchorPosition = "right", additionalContentCSS }) => {
89
+ const Content = ({
90
+ children,
91
+ anchorPosition = "right",
92
+ additionalContentCSS,
93
+ }: ContentProps) => {
63
94
  const { isOpen } = useContext(DropdownMenuContext);
64
95
 
65
96
  if (!isOpen) {
66
97
  return null;
67
98
  }
68
99
 
69
- const anchorPositionClasses = anchorPosition === "right" ? "right-0" : "left-0";
100
+ const anchorPositionClasses =
101
+ anchorPosition === "right" ? "right-0" : "left-0";
70
102
 
71
103
  return (
72
104
  <div
@@ -79,18 +111,22 @@ const Content = ({ children, anchorPosition = "right", additionalContentCSS }) =
79
111
  );
80
112
  };
81
113
 
82
- Content.propTypes = {
83
- children: T.node,
84
- anchorPosition: T.string,
85
- additionalContentCSS: T.string,
86
- };
87
-
88
- const Link = ({ url, title, subtitle, iconName, children }) => {
114
+ const Link = ({ url, title, subtitle, iconName, children }: LinkProps) => {
89
115
  return (
90
- <a href={url} className="menu-link group block p-8 hover:bg-light-grey hover:text-cool-black rounded">
116
+ <a
117
+ href={url}
118
+ className="menu-link group block p-8 hover:bg-light-grey hover:text-cool-black rounded"
119
+ >
91
120
  <p className="mb-4">
92
121
  {title}
93
- {iconName ? <Icon name={iconName} size="1rem" color="text-cool-black" additionalCSS="align-middle ml-8 relative -top-1 -left-4" /> : null}
122
+ {iconName ? (
123
+ <Icon
124
+ name={iconName}
125
+ size="1rem"
126
+ color="text-cool-black"
127
+ additionalCSS="align-middle ml-8 relative -top-1 -left-4"
128
+ />
129
+ ) : null}
94
130
  </p>
95
131
  {subtitle ? <p className="ui-text-p3 mb-16">{subtitle}</p> : null}
96
132
  {children}
@@ -98,14 +134,6 @@ const Link = ({ url, title, subtitle, iconName, children }) => {
98
134
  );
99
135
  };
100
136
 
101
- Link.propTypes = {
102
- url: T.string,
103
- title: T.string,
104
- subtitle: T.string,
105
- iconName: T.string,
106
- children: T.node,
107
- };
108
-
109
137
  DropdownMenu.Trigger = Trigger;
110
138
  DropdownMenu.Content = Content;
111
139
  DropdownMenu.Link = Link;