@ably/ui 14.1.0-dev.76621d8 → 14.1.0-dev.f3a3c90

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 (306) hide show
  1. package/core/styles/forms.css +15 -2
  2. package/package.json +1 -2
  3. package/src/.DS_Store +0 -0
  4. package/src/core/.DS_Store +0 -0
  5. package/src/core/Accordion/.DS_Store +0 -0
  6. package/src/core/Accordion/Accordion.stories.tsx +0 -39
  7. package/src/core/Accordion.tsx +0 -149
  8. package/src/core/Code/.DS_Store +0 -0
  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/.DS_Store +0 -0
  15. package/src/core/ContactFooter/ContactFooter.stories.tsx +0 -11
  16. package/src/core/ContactFooter/component.css +0 -11
  17. package/src/core/ContactFooter/component.js +0 -2
  18. package/src/core/ContactFooter.tsx +0 -91
  19. package/src/core/CookieMessage/.DS_Store +0 -0
  20. package/src/core/CookieMessage/CookieMessage.stories.tsx +0 -12
  21. package/src/core/CookieMessage/component.css +0 -15
  22. package/src/core/CookieMessage.tsx +0 -52
  23. package/src/core/CustomerLogos/.DS_Store +0 -0
  24. package/src/core/CustomerLogos/CustomerLogos.stories.tsx +0 -43
  25. package/src/core/CustomerLogos.tsx +0 -35
  26. package/src/core/DropdownMenu/.DS_Store +0 -0
  27. package/src/core/DropdownMenu/DropdownMenu.stories.tsx +0 -48
  28. package/src/core/DropdownMenu.tsx +0 -140
  29. package/src/core/Expander/Expander.stories.tsx +0 -132
  30. package/src/core/Expander.tsx +0 -63
  31. package/src/core/FeaturedLink/.DS_Store +0 -0
  32. package/src/core/FeaturedLink/FeaturedLink.stories.tsx +0 -43
  33. package/src/core/FeaturedLink.tsx +0 -93
  34. package/src/core/Flash/.DS_Store +0 -0
  35. package/src/core/Flash/Flash.stories.tsx +0 -37
  36. package/src/core/Flash/component.css +0 -28
  37. package/src/core/Flash.tsx +0 -233
  38. package/src/core/Footer/.DS_Store +0 -0
  39. package/src/core/Footer/Footer.stories.tsx +0 -26
  40. package/src/core/Footer/component.css +0 -33
  41. package/src/core/Footer.tsx +0 -535
  42. package/src/core/Icon/.DS_Store +0 -0
  43. package/src/core/Icon/Icon.stories.tsx +0 -151
  44. package/src/core/Icon.tsx +0 -26
  45. package/src/core/Loader/.DS_Store +0 -0
  46. package/src/core/Loader/Loader.stories.tsx +0 -21
  47. package/src/core/Loader.tsx +0 -52
  48. package/src/core/Logo/.DS_Store +0 -0
  49. package/src/core/Logo/Logo.stories.tsx +0 -12
  50. package/src/core/Logo.tsx +0 -29
  51. package/src/core/Meganav/.DS_Store +0 -0
  52. package/src/core/Meganav/Meganav.stories.tsx +0 -86
  53. package/src/core/Meganav/component.css +0 -114
  54. package/src/core/Meganav/component.js +0 -150
  55. package/src/core/Meganav/component.json +0 -37
  56. package/src/core/Meganav.tsx +0 -225
  57. package/src/core/MeganavBlogPostsList/.DS_Store +0 -0
  58. package/src/core/MeganavBlogPostsList/component.js +0 -43
  59. package/src/core/MeganavBlogPostsList.tsx +0 -41
  60. package/src/core/MeganavContentCompany.tsx +0 -166
  61. package/src/core/MeganavContentDevelopers.tsx +0 -210
  62. package/src/core/MeganavContentProducts.tsx +0 -163
  63. package/src/core/MeganavContentUseCases.tsx +0 -244
  64. package/src/core/MeganavControl/.DS_Store +0 -0
  65. package/src/core/MeganavControl/component.js +0 -117
  66. package/src/core/MeganavControl.tsx +0 -39
  67. package/src/core/MeganavControlMobileDropdown/.DS_Store +0 -0
  68. package/src/core/MeganavControlMobileDropdown/component.js +0 -46
  69. package/src/core/MeganavControlMobileDropdown.tsx +0 -31
  70. package/src/core/MeganavControlMobilePanelClose/.DS_Store +0 -0
  71. package/src/core/MeganavControlMobilePanelClose/component.js +0 -36
  72. package/src/core/MeganavControlMobilePanelClose.tsx +0 -34
  73. package/src/core/MeganavControlMobilePanelOpen/.DS_Store +0 -0
  74. package/src/core/MeganavControlMobilePanelOpen/component.js +0 -59
  75. package/src/core/MeganavControlMobilePanelOpen.tsx +0 -31
  76. package/src/core/MeganavItemsDesktop.tsx +0 -68
  77. package/src/core/MeganavItemsMobile.tsx +0 -197
  78. package/src/core/MeganavItemsSignedIn.tsx +0 -130
  79. package/src/core/MeganavSearch.tsx +0 -36
  80. package/src/core/MeganavSearchAutocomplete/.DS_Store +0 -0
  81. package/src/core/MeganavSearchAutocomplete/component.js +0 -177
  82. package/src/core/MeganavSearchAutocomplete.tsx +0 -12
  83. package/src/core/MeganavSearchPanel.tsx +0 -52
  84. package/src/core/MeganavSearchSuggestions/.DS_Store +0 -0
  85. package/src/core/MeganavSearchSuggestions/component.js +0 -133
  86. package/src/core/MeganavSearchSuggestions.tsx +0 -62
  87. package/src/core/Notice/.DS_Store +0 -0
  88. package/src/core/Notice/component.css +0 -7
  89. package/src/core/Notice/component.js +0 -154
  90. package/src/core/Notice.tsx +0 -102
  91. package/src/core/SignOutLink.tsx +0 -51
  92. package/src/core/Slider/.DS_Store +0 -0
  93. package/src/core/Slider/Slider.stories.tsx +0 -98
  94. package/src/core/Slider/component.css +0 -40
  95. package/src/core/Slider/component.js +0 -105
  96. package/src/core/Slider.tsx +0 -224
  97. package/src/core/Table/.DS_Store +0 -0
  98. package/src/core/Table/Table.stories.tsx +0 -12
  99. package/src/core/Table/Table.tsx +0 -58
  100. package/src/core/Table/TableCell.tsx +0 -71
  101. package/src/core/Table/TableRow.tsx +0 -25
  102. package/src/core/Table/data.tsx +0 -133
  103. package/src/core/Table.tsx +0 -15
  104. package/src/core/Tooltip/.DS_Store +0 -0
  105. package/src/core/Tooltip/Tooltip.stories.tsx +0 -27
  106. package/src/core/Tooltip.tsx +0 -88
  107. package/src/core/css.js +0 -3
  108. package/src/core/dom-query.js +0 -5
  109. package/src/core/fonts/NEXT-Book-Light-Italic.eot +0 -0
  110. package/src/core/fonts/NEXT-Book-Light-Italic.otf +0 -0
  111. package/src/core/fonts/NEXT-Book-Light-Italic.woff +0 -0
  112. package/src/core/fonts/NEXT-Book-Light-Italic.woff2 +0 -0
  113. package/src/core/fonts/NEXT-Book-Light.eot +0 -0
  114. package/src/core/fonts/NEXT-Book-Light.otf +0 -0
  115. package/src/core/fonts/NEXT-Book-Light.woff +0 -0
  116. package/src/core/fonts/NEXT-Book-Light.woff2 +0 -0
  117. package/src/core/fonts/NEXT-Book-Medium-Italic.eot +0 -0
  118. package/src/core/fonts/NEXT-Book-Medium-Italic.otf +0 -0
  119. package/src/core/fonts/NEXT-Book-Medium-Italic.woff +0 -0
  120. package/src/core/fonts/NEXT-Book-Medium-Italic.woff2 +0 -0
  121. package/src/core/fonts/NEXT-Book-Medium.eot +0 -0
  122. package/src/core/fonts/NEXT-Book-Medium.otf +0 -0
  123. package/src/core/fonts/NEXT-Book-Medium.woff +0 -0
  124. package/src/core/fonts/NEXT-Book-Medium.woff2 +0 -0
  125. package/src/core/fonts/jetBrains-mono.css +0 -3
  126. package/src/core/fonts/manrope.css +0 -3
  127. package/src/core/fonts/next.css +0 -63
  128. package/src/core/fonts/source-code-pro.css +0 -3
  129. package/src/core/hubspot-chat-toggle.js +0 -67
  130. package/src/core/icons/discord.svg +0 -10
  131. package/src/core/icons/facebook.svg +0 -4
  132. package/src/core/icons/github.svg +0 -3
  133. package/src/core/icons/glassdoor.svg +0 -3
  134. package/src/core/icons/google.svg +0 -3
  135. package/src/core/icons/icon-display-48hrs.svg +0 -3
  136. package/src/core/icons/icon-display-about-ably-col.svg +0 -4
  137. package/src/core/icons/icon-display-api-keys.svg +0 -3
  138. package/src/core/icons/icon-display-api.svg +0 -3
  139. package/src/core/icons/icon-display-asset-tracking-col.svg +0 -18
  140. package/src/core/icons/icon-display-browser.svg +0 -10
  141. package/src/core/icons/icon-display-calendar.svg +0 -3
  142. package/src/core/icons/icon-display-call-mobile.svg +0 -3
  143. package/src/core/icons/icon-display-careers-col.svg +0 -9
  144. package/src/core/icons/icon-display-case-studies-col.svg +0 -5
  145. package/src/core/icons/icon-display-chat-col.svg +0 -4
  146. package/src/core/icons/icon-display-chat-stack-col.svg +0 -4
  147. package/src/core/icons/icon-display-chat-stack.svg +0 -4
  148. package/src/core/icons/icon-display-cloud-servers.svg +0 -3
  149. package/src/core/icons/icon-display-compare-tech-col.svg +0 -9
  150. package/src/core/icons/icon-display-customers-col.svg +0 -15
  151. package/src/core/icons/icon-display-data-broadcast-col.svg +0 -26
  152. package/src/core/icons/icon-display-data-synchronization-col.svg +0 -14
  153. package/src/core/icons/icon-display-docs-col.svg +0 -7
  154. package/src/core/icons/icon-display-documentation.svg +0 -3
  155. package/src/core/icons/icon-display-events-col.svg +0 -13
  156. package/src/core/icons/icon-display-examples-col.svg +0 -11
  157. package/src/core/icons/icon-display-gdpr.svg +0 -3
  158. package/src/core/icons/icon-display-general-comms.svg +0 -3
  159. package/src/core/icons/icon-display-hipaa.svg +0 -10
  160. package/src/core/icons/icon-display-integrations-col.svg +0 -8
  161. package/src/core/icons/icon-display-it-support-access.svg +0 -3
  162. package/src/core/icons/icon-display-it-support-helpdesk.svg +0 -3
  163. package/src/core/icons/icon-display-kafka-at-the-edge-col.svg +0 -8
  164. package/src/core/icons/icon-display-laptop.svg +0 -10
  165. package/src/core/icons/icon-display-lightbulb-col.svg +0 -10
  166. package/src/core/icons/icon-display-live-chat.svg +0 -3
  167. package/src/core/icons/icon-display-map-pin.svg +0 -3
  168. package/src/core/icons/icon-display-message.svg +0 -3
  169. package/src/core/icons/icon-display-padlock-closed.svg +0 -3
  170. package/src/core/icons/icon-display-platform.svg +0 -22
  171. package/src/core/icons/icon-display-play.svg +0 -3
  172. package/src/core/icons/icon-display-privacy-shield-framework.svg +0 -7
  173. package/src/core/icons/icon-display-push-notifications-col.svg +0 -6
  174. package/src/core/icons/icon-display-quickstart-guides-col.svg +0 -8
  175. package/src/core/icons/icon-display-resources-col.svg +0 -21
  176. package/src/core/icons/icon-display-sdks-col.svg +0 -11
  177. package/src/core/icons/icon-display-servers.svg +0 -3
  178. package/src/core/icons/icon-display-shopping-cart.svg +0 -10
  179. package/src/core/icons/icon-display-sla.svg +0 -3
  180. package/src/core/icons/icon-display-soc2-type2.svg +0 -3
  181. package/src/core/icons/icon-display-tech-account-comms.svg +0 -3
  182. package/src/core/icons/icon-display-tutorials-demos-col.svg +0 -25
  183. package/src/core/icons/icon-display-virtual-events-col.svg +0 -12
  184. package/src/core/icons/icon-display-virtual-events.svg +0 -12
  185. package/src/core/icons/icon-gui-ably-badge.svg +0 -3
  186. package/src/core/icons/icon-gui-arrow-bidirectional-horizontal.svg +0 -3
  187. package/src/core/icons/icon-gui-arrow-bidirectional-vertical.svg +0 -3
  188. package/src/core/icons/icon-gui-arrow-down.svg +0 -3
  189. package/src/core/icons/icon-gui-arrow-left.svg +0 -3
  190. package/src/core/icons/icon-gui-arrow-right.svg +0 -3
  191. package/src/core/icons/icon-gui-arrow-up.svg +0 -3
  192. package/src/core/icons/icon-gui-burger-menu.svg +0 -5
  193. package/src/core/icons/icon-gui-check-circled-fill-black.svg +0 -4
  194. package/src/core/icons/icon-gui-check-circled-fill.svg +0 -4
  195. package/src/core/icons/icon-gui-check-circled.svg +0 -3
  196. package/src/core/icons/icon-gui-checklist-checked.svg +0 -3
  197. package/src/core/icons/icon-gui-clock.svg +0 -3
  198. package/src/core/icons/icon-gui-close.svg +0 -3
  199. package/src/core/icons/icon-gui-copy.svg +0 -10
  200. package/src/core/icons/icon-gui-cross-circled-fill.svg +0 -4
  201. package/src/core/icons/icon-gui-cross-circled.svg +0 -3
  202. package/src/core/icons/icon-gui-dash-circled.svg +0 -3
  203. package/src/core/icons/icon-gui-disclosure-arrow.svg +0 -3
  204. package/src/core/icons/icon-gui-document-generic.svg +0 -3
  205. package/src/core/icons/icon-gui-enlarge.svg +0 -3
  206. package/src/core/icons/icon-gui-external-link.svg +0 -3
  207. package/src/core/icons/icon-gui-filter-flow-step-1.svg +0 -5
  208. package/src/core/icons/icon-gui-filter-flow-step-2.svg +0 -5
  209. package/src/core/icons/icon-gui-filter-flow-step-3.svg +0 -5
  210. package/src/core/icons/icon-gui-history.svg +0 -3
  211. package/src/core/icons/icon-gui-info.svg +0 -3
  212. package/src/core/icons/icon-gui-link-arrow.svg +0 -3
  213. package/src/core/icons/icon-gui-link.svg +0 -4
  214. package/src/core/icons/icon-gui-live-chat.svg +0 -3
  215. package/src/core/icons/icon-gui-minus.svg +0 -3
  216. package/src/core/icons/icon-gui-partial.svg +0 -4
  217. package/src/core/icons/icon-gui-plus.svg +0 -3
  218. package/src/core/icons/icon-gui-quote-marks-solid.svg +0 -3
  219. package/src/core/icons/icon-gui-refresh.svg +0 -10
  220. package/src/core/icons/icon-gui-resources.svg +0 -3
  221. package/src/core/icons/icon-gui-search.svg +0 -3
  222. package/src/core/icons/icon-gui-tick.svg +0 -3
  223. package/src/core/icons/icon-gui-warning.svg +0 -5
  224. package/src/core/icons/icon-live-updates-results-metrics-col.svg +0 -26
  225. package/src/core/icons/icon-multi-user-spaces-col.svg +0 -13
  226. package/src/core/icons/icon-social-x.svg +0 -3
  227. package/src/core/icons/icon-tech-apachekafka.svg +0 -3
  228. package/src/core/icons/linkedin.svg +0 -3
  229. package/src/core/icons/quote.svg +0 -3
  230. package/src/core/icons/stackoverflow.svg +0 -3
  231. package/src/core/icons/twitter.svg +0 -3
  232. package/src/core/icons/youtube.svg +0 -11
  233. package/src/core/icons.js +0 -6
  234. package/src/core/images/ably-logo.png +0 -0
  235. package/src/core/images/ably-logo.svg +0 -15
  236. package/src/core/images/ably-stack.svg +0 -14
  237. package/src/core/images/best-support-2023.svg +0 -1
  238. package/src/core/images/cust-logo-ao-col-pos.png +0 -0
  239. package/src/core/images/cust-logo-ao-col-pos@2x.png +0 -0
  240. package/src/core/images/cust-logo-ausopen-col-pos.png +0 -0
  241. package/src/core/images/cust-logo-ausopen-col-pos@2x.png +0 -0
  242. package/src/core/images/cust-logo-ausopen-mono-pos.svg +0 -5
  243. package/src/core/images/cust-logo-bloomberg-mono-pos.svg +0 -11
  244. package/src/core/images/cust-logo-hopin-mono-pos.svg +0 -4
  245. package/src/core/images/cust-logo-hubspot-col-pos.png +0 -0
  246. package/src/core/images/cust-logo-hubspot-col-pos@2x.png +0 -0
  247. package/src/core/images/cust-logo-hubspot-mono-pos.svg +0 -4
  248. package/src/core/images/cust-logo-lightspeed-col-pos.png +0 -0
  249. package/src/core/images/cust-logo-lightspeed-col-pos@2x.png +0 -0
  250. package/src/core/images/cust-logo-lightspeed-syst-col-pos.png +0 -0
  251. package/src/core/images/cust-logo-lightspeed-syst-col-pos@2x.png +0 -0
  252. package/src/core/images/cust-logo-mentimeter-mono-pos.svg +0 -17
  253. package/src/core/images/cust-logo-split-col-pos.png +0 -0
  254. package/src/core/images/cust-logo-split-col-pos@2x.png +0 -0
  255. package/src/core/images/cust-logo-split-mono-pos.svg +0 -9
  256. package/src/core/images/cust-logo-toyota-mono-pos.svg +0 -18
  257. package/src/core/images/cust-logo-vitac-col-pos.png +0 -0
  258. package/src/core/images/cust-logo-vitac-col-pos@2x.png +0 -0
  259. package/src/core/images/cust-logo-webflow-col-pos.svg +0 -3
  260. package/src/core/images/cust-photo-hubspot-max-freiert.jpg +0 -0
  261. package/src/core/images/cust-photo-split-pato-echague.jpg +0 -0
  262. package/src/core/images/cust-photo-vitac-joe-antonio.jpg +0 -0
  263. package/src/core/images/fastest-implementation-2023.svg +0 -1
  264. package/src/core/images/flexible-companies.png +0 -0
  265. package/src/core/images/high-performer-2022.png +0 -0
  266. package/src/core/images/high-performer-2023.svg +0 -1
  267. package/src/core/images/highest-user-adoption-2022.png +0 -0
  268. package/src/core/images/highest-user-adoption-2023.svg +0 -1
  269. package/src/core/images/icon-tech-aws.svg +0 -4
  270. package/src/core/images/rocket-list-2021.png +0 -0
  271. package/src/core/images/scale-motif-open-empathetic.svg +0 -1
  272. package/src/core/images/technical-support-01-800x533.jpg +0 -0
  273. package/src/core/images/users-love-us-2022.png +0 -0
  274. package/src/core/load-sprites.js +0 -11
  275. package/src/core/react-renderer.tsx +0 -29
  276. package/src/core/remote-blogs-posts.js +0 -42
  277. package/src/core/remote-data-store.js +0 -34
  278. package/src/core/remote-data-util.js +0 -4
  279. package/src/core/remote-session-data.js +0 -58
  280. package/src/core/scripts.js +0 -10
  281. package/src/core/styles/Dropdown.stories.tsx +0 -49
  282. package/src/core/styles/Toggle.stories.tsx +0 -41
  283. package/src/core/styles/buttons.css +0 -124
  284. package/src/core/styles/forms.css +0 -83
  285. package/src/core/styles/layout.css +0 -21
  286. package/src/core/styles/properties.css +0 -278
  287. package/src/core/styles/text.css +0 -168
  288. package/src/core/styles/toggles.css +0 -38
  289. package/src/core/styles.base.css +0 -1
  290. package/src/core/styles.components.css +0 -44
  291. package/src/core/styles.css +0 -2
  292. package/src/core/url-base.js +0 -7
  293. package/src/core/utils/syntax-highlighter-registry.js +0 -63
  294. package/src/core/utils/syntax-highlighter.css +0 -71
  295. package/src/core/utils/syntax-highlighter.js +0 -103
  296. package/src/pages/Buttons.mdx +0 -121
  297. package/src/pages/Chips.mdx +0 -136
  298. package/src/pages/Colour.mdx +0 -23
  299. package/src/pages/Forms.mdx +0 -219
  300. package/src/pages/Layout.mdx +0 -58
  301. package/src/pages/Typography.mdx +0 -206
  302. package/src/pages/utils.ts +0 -80
  303. package/src/reset/scripts.js +0 -1
  304. package/src/reset/styles/normalize.css +0 -353
  305. package/src/reset/styles/reset.css +0 -139
  306. package/src/reset/styles.css +0 -2
@@ -1,35 +0,0 @@
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
@@ -1,48 +0,0 @@
1
- import React from "react";
2
- import Icon from "../Icon";
3
- import DropdownMenu from "../DropdownMenu";
4
-
5
- export default {
6
- title: "JS 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,140 +0,0 @@
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
- };
34
-
35
- type LinkProps = {
36
- url: string;
37
- title: string;
38
- subtitle: string;
39
- iconName: string;
40
- children: ReactNode;
41
- };
42
-
43
- const DropdownMenu = ({ children }: DropdownMenuProps) => {
44
- const [isOpen, setOpen] = useState(false);
45
- const ref = useRef<HTMLDivElement>(null);
46
-
47
- useEffect(() => {
48
- const clickHandler = (e) => {
49
- if (ref.current?.contains(e.target)) return;
50
- setOpen(false);
51
- };
52
-
53
- document.addEventListener("click", clickHandler);
54
-
55
- return () => {
56
- document.removeEventListener("click", clickHandler);
57
- };
58
- }, []);
59
-
60
- return (
61
- <DropdownMenuContext.Provider value={{ isOpen, setOpen }}>
62
- <div id="dropdown-menu" className="relative" ref={ref}>
63
- {children}
64
- </div>
65
- </DropdownMenuContext.Provider>
66
- );
67
- };
68
-
69
- const Trigger = ({ children, additionalTriggerCSS = "" }: TriggerProps) => {
70
- const { isOpen, setOpen } = useContext(DropdownMenuContext);
71
-
72
- return (
73
- <button
74
- id="menu-trigger"
75
- onClick={() => setOpen(!isOpen)}
76
- className={`${additionalTriggerCSS} flex items-center p-8 ml-8 group hover:text-gui-hover hover:bg-light-grey active:text-gui-active focus:text-gui-focus focus:outline-none rounded-lg`}
77
- >
78
- <span className="leading-normal">{children}</span>
79
- <Icon
80
- name="icon-gui-disclosure-arrow"
81
- color="text-cool-black"
82
- size="1.25rem"
83
- additionalCSS="transform rotate-90 group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus"
84
- />
85
- </button>
86
- );
87
- };
88
-
89
- const Content = ({
90
- children,
91
- anchorPosition = "right",
92
- additionalContentCSS,
93
- }: ContentProps) => {
94
- const { isOpen } = useContext(DropdownMenuContext);
95
-
96
- if (!isOpen) {
97
- return null;
98
- }
99
-
100
- const anchorPositionClasses =
101
- anchorPosition === "right" ? "right-0" : "left-0";
102
-
103
- return (
104
- <div
105
- id="menu-content"
106
- className={`${additionalContentCSS} absolute p-8 z-10 border border-mid-grey bg-white rounded shadow-container ${anchorPositionClasses}`}
107
- style={{ minWidth: 275, top: 44 }}
108
- >
109
- {children}
110
- </div>
111
- );
112
- };
113
-
114
- const Link = ({ url, title, subtitle, iconName, children }: LinkProps) => {
115
- return (
116
- <a
117
- href={url}
118
- className="menu-link group block p-8 hover:bg-light-grey hover:text-cool-black rounded"
119
- >
120
- <p className="mb-4">
121
- {title}
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}
130
- </p>
131
- {subtitle ? <p className="ui-text-p3 mb-16">{subtitle}</p> : null}
132
- {children}
133
- </a>
134
- );
135
- };
136
-
137
- DropdownMenu.Trigger = Trigger;
138
- DropdownMenu.Content = Content;
139
- DropdownMenu.Link = Link;
140
- export default DropdownMenu;
@@ -1,132 +0,0 @@
1
- import React from "react";
2
- import Expander from "../Expander";
3
-
4
- export default {
5
- title: "JS Components/Expander",
6
- component: Expander,
7
- tags: ["autodocs"],
8
- args: {
9
- height: 200,
10
- },
11
- argTypes: {
12
- height: {
13
- control: {
14
- type: "number",
15
- },
16
- },
17
- },
18
- };
19
-
20
- const longContentInner = (
21
- <div>
22
- <p>Ipsum</p>
23
- <ul className="mb-16 list-inside list-disc">
24
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
25
- <li>Sed convallis ex pharetra, tristique tellus vel, rhoncus velit.</li>
26
- <li>Mauris molestie felis et scelerisque ullamcorper.</li>
27
- <li>Maecenas congue ligula ut commodo tristique.</li>
28
- <li>
29
- Pellentesque venenatis elit vitae urna condimentum, in mollis arcu
30
- venenatis.
31
- </li>
32
- <li>Donec nec turpis vel urna egestas fringilla.</li>
33
- </ul>
34
- <p>Ipsum</p>
35
- <ul className="mb-16 list-inside list-disc">
36
- <li>Mauris ut nibh vel metus cursus semper.</li>
37
- <li>Ut mattis tortor eu urna accumsan gravida.</li>
38
- <li>Nunc pellentesque neque at elit pretium tempor.</li>
39
- <li>Curabitur finibus magna vitae nunc varius fermentum.</li>
40
- </ul>
41
- <ul className="mb-16 list-inside list-disc">
42
- <li>Curabitur vehicula mi iaculis, luctus augue eu, venenatis quam.</li>
43
- <li>Praesent in eros efficitur, consequat ante eu, faucibus arcu.</li>
44
- <li>Nulla laoreet nibh a odio interdum, non molestie diam auctor.</li>
45
- </ul>
46
- <p>Ipsum</p>
47
- <ul className="mb-16 list-inside list-disc">
48
- <li>
49
- Praesent aliquam diam tincidunt, sollicitudin tortor eget, vulputate
50
- lacus.
51
- </li>
52
- <li>Quisque in mi sed ex vulputate varius in a leo.</li>
53
- <li>Etiam posuere dolor at tortor aliquam imperdiet.</li>
54
- <li>
55
- Maecenas quis neque consequat, ultricies est sit amet, congue est.
56
- </li>
57
- <li>Aenean a elit sed nibh pretium lacinia sed convallis sapien.</li>
58
- </ul>
59
- <p>Ipsum</p>
60
- <ul className="mb-16 list-inside list-disc">
61
- <li>
62
- Nulla malesuada libero id dolor aliquam, non sagittis mi scelerisque.
63
- </li>
64
- <li>
65
- Etiam tincidunt lacus eu diam laoreet consectetur sit amet non est.
66
- </li>
67
- <li>In porta arcu nec purus tincidunt vulputate.</li>
68
- </ul>
69
- </div>
70
- );
71
-
72
- export const LongContent = {
73
- render: () => <Expander>{longContentInner}</Expander>,
74
- parameters: {
75
- docs: {
76
- description: {
77
- story:
78
- "A larger amount of content that exceeds the height cut-off, controls shown.",
79
- },
80
- },
81
- },
82
- };
83
-
84
- export const ShortContent = {
85
- render: () => (
86
- <Expander>
87
- <div>
88
- <p>Ipsum</p>
89
- <ul className="mb-16 list-inside list-disc">
90
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
91
- <li>
92
- Sed convallis ex pharetra, tristique tellus vel, rhoncus velit.
93
- </li>
94
- <li>Mauris molestie felis et scelerisque ullamcorper.</li>
95
- <li>Maecenas congue ligula ut commodo tristique.</li>
96
- <li>
97
- Pellentesque venenatis elit vitae urna condimentum, in mollis arcu
98
- venenatis.
99
- </li>
100
- <li>Donec nec turpis vel urna egestas fringilla.</li>
101
- </ul>
102
- </div>
103
- </Expander>
104
- ),
105
- parameters: {
106
- docs: {
107
- description: {
108
- story:
109
- "A smaller amount of content that doesn't exceed the height cut-off, therefore no controls shown.",
110
- },
111
- },
112
- },
113
- };
114
-
115
- export const OverriddenStyles = {
116
- render: () => (
117
- <Expander
118
- className="bg-neutral-400 p-16 rounded-lg"
119
- fadeClassName="from-neutral-800"
120
- >
121
- {longContentInner}
122
- </Expander>
123
- ),
124
- parameters: {
125
- docs: {
126
- description: {
127
- story:
128
- "A larger amount of content, with overridden styles for the content wrapper and fader.",
129
- },
130
- },
131
- },
132
- };
@@ -1,63 +0,0 @@
1
- import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
2
-
3
- type ExpanderProps = {
4
- heightThreshold?: number;
5
- className?: string;
6
- fadeClassName?: string;
7
- };
8
-
9
- const Expander = ({
10
- heightThreshold = 200,
11
- className,
12
- fadeClassName,
13
- children,
14
- }: PropsWithChildren<ExpanderProps>) => {
15
- const innerRef = useRef<HTMLDivElement>(null);
16
- const [showControls, setShowControls] = useState(false);
17
- const [height, setHeight] = useState<number | "auto">(heightThreshold);
18
- const [expanded, setExpanded] = useState(false);
19
-
20
- useEffect(() => {
21
- const contentHeight = innerRef.current?.clientHeight ?? heightThreshold;
22
-
23
- if (contentHeight < heightThreshold) {
24
- setHeight("auto");
25
- } else if (expanded) {
26
- setHeight(contentHeight);
27
- } else {
28
- setHeight(heightThreshold);
29
- }
30
-
31
- setShowControls(contentHeight >= heightThreshold);
32
- }, [heightThreshold, expanded]);
33
-
34
- return (
35
- <>
36
- <div
37
- style={{ height }}
38
- className={`overflow-hidden transition-all relative ${className ?? ""}`}
39
- >
40
- {showControls && !expanded && (
41
- <div
42
- className={`h-64 w-full bg-gradient-to-t from-white to-transparent absolute bottom-0 left-0 right-0 ${
43
- fadeClassName ?? ""
44
- }`}
45
- ></div>
46
- )}
47
- <div ref={innerRef}>{children}</div>
48
- </div>
49
- {showControls && (
50
- <div
51
- onClick={() => setExpanded(!expanded)}
52
- onKeyDown={(e) => e.key === "Enter" && setExpanded(!expanded)}
53
- tabIndex={0}
54
- className="mt-16 cursor-pointer font-bold text-gui-blue-default-light hover:text-gui-blue-hover-light"
55
- >
56
- {expanded ? "View less -" : "View all +"}
57
- </div>
58
- )}
59
- </>
60
- );
61
- };
62
-
63
- export default Expander;
Binary file
@@ -1,43 +0,0 @@
1
- import FeaturedLink from "../FeaturedLink";
2
-
3
- export default {
4
- title: "JS Components/Featured Link",
5
- component: FeaturedLink,
6
- parameters: {
7
- layout: "centered",
8
- },
9
- tags: ["autodocs"],
10
- args: {
11
- url: "#",
12
- children: "Featured link",
13
- },
14
- };
15
-
16
- export const Default = {
17
- args: {},
18
- };
19
-
20
- export const Reverse = {
21
- args: {
22
- reverse: true,
23
- },
24
- };
25
-
26
- export const Large = {
27
- args: {
28
- textSize: "text-p1",
29
- },
30
- };
31
-
32
- export const Small = {
33
- args: {
34
- textSize: "text-p3",
35
- },
36
- };
37
-
38
- export const Pink = {
39
- args: {
40
- iconColor: "text-pink-500",
41
- additionalCSS: "text-pink-800",
42
- },
43
- };
@@ -1,93 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from "react";
2
-
3
- import Icon from "./Icon";
4
-
5
- type FeaturedLinkProps = {
6
- url: string;
7
- children: ReactNode;
8
- textSize?: string;
9
- iconColor?: string;
10
- flush?: boolean;
11
- reverse?: boolean;
12
- additionalCSS?: string;
13
- newWindow?: boolean;
14
- onClick?: () => void;
15
- };
16
-
17
- type TargetProps = { target?: string; rel?: string };
18
-
19
- // When generating links with target=_blank, we only add `noreferrer` to
20
- // links that don't start with `/`, so we can continue tracking referrers
21
- // across our own domains
22
- const buildTargetAndRel = (url, newWindow) => {
23
- const props: TargetProps = {};
24
-
25
- if (newWindow) {
26
- props.target = "_blank";
27
-
28
- if (url.startsWith("/") && !url.startsWith("//")) {
29
- props.rel = "noopener";
30
- } else {
31
- props.rel = "noopenner noreferrer";
32
- }
33
- }
34
-
35
- return props;
36
- };
37
-
38
- const FeaturedLink = ({
39
- url,
40
- textSize = "text-p2",
41
- iconColor = "text-cool-black",
42
- flush = false,
43
- reverse = false,
44
- additionalCSS = "",
45
- newWindow = false,
46
- onClick = undefined,
47
- children,
48
- }: FeaturedLinkProps) => {
49
- const targetAndRel = buildTargetAndRel(url, newWindow);
50
-
51
- return (
52
- <a
53
- href={url}
54
- className={`font-sans font-bold block text-gui-default hover:text-gui-hover focus:text-gui-focus focus:outline-gui-focus group ui-${textSize} ${
55
- flush ? "" : "py-8"
56
- } ${additionalCSS}`}
57
- style={
58
- {
59
- "--featured-link-icon-size": `var(${textSize.replace(
60
- "text",
61
- "--fs",
62
- )})`,
63
- } as CSSProperties
64
- }
65
- {...targetAndRel}
66
- onClick={onClick}
67
- >
68
- {reverse ? (
69
- <>
70
- <Icon
71
- name="icon-gui-link-arrow"
72
- size={`calc(var(--featured-link-icon-size) * 1.25)`}
73
- color={iconColor}
74
- additionalCSS="align-middle mr-8 relative -top-1 -right-4 transition-all group-hover:right-0 transform rotate-180"
75
- />
76
- {children}
77
- </>
78
- ) : (
79
- <>
80
- {children}
81
- <Icon
82
- name="icon-gui-link-arrow"
83
- size={`calc(var(--featured-link-icon-size) * 1.25)`}
84
- color={iconColor}
85
- additionalCSS="align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
86
- />
87
- </>
88
- )}
89
- </a>
90
- );
91
- };
92
-
93
- export default FeaturedLink;
Binary file
@@ -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: "JS 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
- }