@vector-im/compound-web 8.1.2 → 8.2.1

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 (251) hide show
  1. package/dist/components/ActivityMarker/Pill.cjs.map +1 -1
  2. package/dist/components/ActivityMarker/Pill.d.ts.map +1 -1
  3. package/dist/components/ActivityMarker/Pill.js.map +1 -1
  4. package/dist/components/ActivityMarker/Unread.cjs.map +1 -1
  5. package/dist/components/ActivityMarker/Unread.d.ts.map +1 -1
  6. package/dist/components/ActivityMarker/Unread.js.map +1 -1
  7. package/dist/components/ActivityMarker/UnreadCounter.cjs.map +1 -1
  8. package/dist/components/ActivityMarker/UnreadCounter.d.ts.map +1 -1
  9. package/dist/components/ActivityMarker/UnreadCounter.js.map +1 -1
  10. package/dist/components/Alert/Alert.cjs.map +1 -1
  11. package/dist/components/Alert/Alert.d.ts.map +1 -1
  12. package/dist/components/Alert/Alert.js.map +1 -1
  13. package/dist/components/Avatar/Avatar.cjs.map +1 -1
  14. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  15. package/dist/components/Avatar/Avatar.js.map +1 -1
  16. package/dist/components/Avatar/AvatarStack.cjs.map +1 -1
  17. package/dist/components/Avatar/AvatarStack.js.map +1 -1
  18. package/dist/components/Avatar/avatar-clip.mask.svg.cjs.map +1 -1
  19. package/dist/components/Avatar/avatar-clip.mask.svg.js.map +1 -1
  20. package/dist/components/Avatar/useIdColorHash.cjs.map +1 -1
  21. package/dist/components/Avatar/useIdColorHash.js.map +1 -1
  22. package/dist/components/Badge/Badge.cjs.map +1 -1
  23. package/dist/components/Badge/Badge.d.ts.map +1 -1
  24. package/dist/components/Badge/Badge.js.map +1 -1
  25. package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
  26. package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  27. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  28. package/dist/components/Button/Button.cjs.map +1 -1
  29. package/dist/components/Button/Button.d.ts.map +1 -1
  30. package/dist/components/Button/Button.js.map +1 -1
  31. package/dist/components/Button/IconButton/IconButton.cjs.map +1 -1
  32. package/dist/components/Button/IconButton/IconButton.d.ts.map +1 -1
  33. package/dist/components/Button/IconButton/IconButton.js.map +1 -1
  34. package/dist/components/Button/UnstyledButton.cjs.map +1 -1
  35. package/dist/components/Button/UnstyledButton.d.ts.map +1 -1
  36. package/dist/components/Button/UnstyledButton.js.map +1 -1
  37. package/dist/components/ChatFilter/ChatFilter.cjs.map +1 -1
  38. package/dist/components/ChatFilter/ChatFilter.d.ts.map +1 -1
  39. package/dist/components/ChatFilter/ChatFilter.js.map +1 -1
  40. package/dist/components/Dropdown/Dropdown.cjs.map +1 -1
  41. package/dist/components/Dropdown/Dropdown.js.map +1 -1
  42. package/dist/components/Form/Controls/Action/Action.cjs.map +1 -1
  43. package/dist/components/Form/Controls/Action/Action.d.ts.map +1 -1
  44. package/dist/components/Form/Controls/Action/Action.js.map +1 -1
  45. package/dist/components/Form/Controls/Checkbox/Checkbox.cjs.map +1 -1
  46. package/dist/components/Form/Controls/Checkbox/Checkbox.d.ts.map +1 -1
  47. package/dist/components/Form/Controls/Checkbox/Checkbox.js.map +1 -1
  48. package/dist/components/Form/Controls/EditInPlace/EditInPlace.cjs.map +1 -1
  49. package/dist/components/Form/Controls/EditInPlace/EditInPlace.js.map +1 -1
  50. package/dist/components/Form/Controls/MFA/MFA.cjs.map +1 -1
  51. package/dist/components/Form/Controls/MFA/MFA.js.map +1 -1
  52. package/dist/components/Form/Controls/Password/Password.cjs.map +1 -1
  53. package/dist/components/Form/Controls/Password/Password.d.ts.map +1 -1
  54. package/dist/components/Form/Controls/Password/Password.js.map +1 -1
  55. package/dist/components/Form/Controls/Radio/Radio.cjs.map +1 -1
  56. package/dist/components/Form/Controls/Radio/Radio.js.map +1 -1
  57. package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.cjs +4 -2
  58. package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.cjs.map +1 -1
  59. package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.d.ts.map +1 -1
  60. package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.js +5 -3
  61. package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.js.map +1 -1
  62. package/dist/components/Form/Controls/Text/Text.cjs.map +1 -1
  63. package/dist/components/Form/Controls/Text/Text.d.ts.map +1 -1
  64. package/dist/components/Form/Controls/Text/Text.js.map +1 -1
  65. package/dist/components/Form/Controls/Toggle/Toggle.cjs +10 -1
  66. package/dist/components/Form/Controls/Toggle/Toggle.cjs.map +1 -1
  67. package/dist/components/Form/Controls/Toggle/Toggle.d.ts.map +1 -1
  68. package/dist/components/Form/Controls/Toggle/Toggle.js +10 -1
  69. package/dist/components/Form/Controls/Toggle/Toggle.js.map +1 -1
  70. package/dist/components/Form/Field.cjs.map +1 -1
  71. package/dist/components/Form/Field.d.ts.map +1 -1
  72. package/dist/components/Form/Field.js.map +1 -1
  73. package/dist/components/Form/InlineField.cjs.map +1 -1
  74. package/dist/components/Form/InlineField.d.ts.map +1 -1
  75. package/dist/components/Form/InlineField.js.map +1 -1
  76. package/dist/components/Form/Label.cjs.map +1 -1
  77. package/dist/components/Form/Label.d.ts.map +1 -1
  78. package/dist/components/Form/Label.js.map +1 -1
  79. package/dist/components/Form/Message.cjs.map +1 -1
  80. package/dist/components/Form/Message.d.ts.map +1 -1
  81. package/dist/components/Form/Message.js.map +1 -1
  82. package/dist/components/Form/Root.cjs.map +1 -1
  83. package/dist/components/Form/Root.d.ts.map +1 -1
  84. package/dist/components/Form/Root.js.map +1 -1
  85. package/dist/components/Form/Submit.cjs.map +1 -1
  86. package/dist/components/Form/Submit.d.ts.map +1 -1
  87. package/dist/components/Form/Submit.js.map +1 -1
  88. package/dist/components/Glass/Glass.cjs.map +1 -1
  89. package/dist/components/Glass/Glass.d.ts.map +1 -1
  90. package/dist/components/Glass/Glass.js.map +1 -1
  91. package/dist/components/Icon/BigIcon/BigIcon.cjs.map +1 -1
  92. package/dist/components/Icon/BigIcon/BigIcon.d.ts.map +1 -1
  93. package/dist/components/Icon/BigIcon/BigIcon.js.map +1 -1
  94. package/dist/components/Icon/IndicatorIcon/IndicatorIcon.cjs.map +1 -1
  95. package/dist/components/Icon/IndicatorIcon/IndicatorIcon.d.ts.map +1 -1
  96. package/dist/components/Icon/IndicatorIcon/IndicatorIcon.js.map +1 -1
  97. package/dist/components/InlineSpinner/InlineSpinner.cjs.map +1 -1
  98. package/dist/components/InlineSpinner/InlineSpinner.d.ts.map +1 -1
  99. package/dist/components/InlineSpinner/InlineSpinner.js.map +1 -1
  100. package/dist/components/Link/Link.cjs.map +1 -1
  101. package/dist/components/Link/Link.d.ts.map +1 -1
  102. package/dist/components/Link/Link.js.map +1 -1
  103. package/dist/components/Menu/CheckboxMenuItem.cjs.map +1 -1
  104. package/dist/components/Menu/CheckboxMenuItem.d.ts.map +1 -1
  105. package/dist/components/Menu/CheckboxMenuItem.js.map +1 -1
  106. package/dist/components/Menu/ContextMenu.cjs.map +1 -1
  107. package/dist/components/Menu/ContextMenu.d.ts.map +1 -1
  108. package/dist/components/Menu/ContextMenu.js.map +1 -1
  109. package/dist/components/Menu/DrawerMenu.cjs.map +1 -1
  110. package/dist/components/Menu/DrawerMenu.d.ts.map +1 -1
  111. package/dist/components/Menu/DrawerMenu.js.map +1 -1
  112. package/dist/components/Menu/DrawerMenu.module.css.cjs +3 -3
  113. package/dist/components/Menu/DrawerMenu.module.css.js +3 -3
  114. package/dist/components/Menu/FloatingMenu.cjs.map +1 -1
  115. package/dist/components/Menu/FloatingMenu.d.ts.map +1 -1
  116. package/dist/components/Menu/FloatingMenu.js.map +1 -1
  117. package/dist/components/Menu/FloatingMenu.module.css.cjs +2 -2
  118. package/dist/components/Menu/FloatingMenu.module.css.js +2 -2
  119. package/dist/components/Menu/Menu.cjs.map +1 -1
  120. package/dist/components/Menu/Menu.d.ts.map +1 -1
  121. package/dist/components/Menu/Menu.js.map +1 -1
  122. package/dist/components/Menu/MenuContext.cjs.map +1 -1
  123. package/dist/components/Menu/MenuContext.d.ts.map +1 -1
  124. package/dist/components/Menu/MenuContext.js.map +1 -1
  125. package/dist/components/Menu/MenuItem.cjs.map +1 -1
  126. package/dist/components/Menu/MenuItem.d.ts.map +1 -1
  127. package/dist/components/Menu/MenuItem.js.map +1 -1
  128. package/dist/components/Menu/MenuTitle.cjs.map +1 -1
  129. package/dist/components/Menu/MenuTitle.js.map +1 -1
  130. package/dist/components/Menu/RadioMenuItem.cjs.map +1 -1
  131. package/dist/components/Menu/RadioMenuItem.d.ts.map +1 -1
  132. package/dist/components/Menu/RadioMenuItem.js.map +1 -1
  133. package/dist/components/Menu/ToggleMenuItem.cjs.map +1 -1
  134. package/dist/components/Menu/ToggleMenuItem.d.ts.map +1 -1
  135. package/dist/components/Menu/ToggleMenuItem.js.map +1 -1
  136. package/dist/components/Nav/NavBar.cjs.map +1 -1
  137. package/dist/components/Nav/NavBar.d.ts.map +1 -1
  138. package/dist/components/Nav/NavBar.js.map +1 -1
  139. package/dist/components/Nav/NavItem.cjs.map +1 -1
  140. package/dist/components/Nav/NavItem.d.ts.map +1 -1
  141. package/dist/components/Nav/NavItem.js.map +1 -1
  142. package/dist/components/Progress/Progress.cjs.map +1 -1
  143. package/dist/components/Progress/Progress.js.map +1 -1
  144. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncement.cjs.map +1 -1
  145. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncement.d.ts.map +1 -1
  146. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncement.js.map +1 -1
  147. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncementContext.cjs.map +1 -1
  148. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncementContext.d.ts.map +1 -1
  149. package/dist/components/ReleaseAnnouncement/ReleaseAnnouncementContext.js.map +1 -1
  150. package/dist/components/ReleaseAnnouncement/useReleaseAnnouncement.cjs.map +1 -1
  151. package/dist/components/ReleaseAnnouncement/useReleaseAnnouncement.d.ts.map +1 -1
  152. package/dist/components/ReleaseAnnouncement/useReleaseAnnouncement.js.map +1 -1
  153. package/dist/components/Search/Search.cjs.map +1 -1
  154. package/dist/components/Search/Search.d.ts.map +1 -1
  155. package/dist/components/Search/Search.js.map +1 -1
  156. package/dist/components/Separator/Separator.cjs.map +1 -1
  157. package/dist/components/Separator/Separator.d.ts.map +1 -1
  158. package/dist/components/Separator/Separator.js.map +1 -1
  159. package/dist/components/Toast/Toast.cjs.map +1 -1
  160. package/dist/components/Toast/Toast.d.ts.map +1 -1
  161. package/dist/components/Toast/Toast.js.map +1 -1
  162. package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
  163. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  164. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  165. package/dist/components/Tooltip/TooltipContext.cjs.map +1 -1
  166. package/dist/components/Tooltip/TooltipContext.d.ts.map +1 -1
  167. package/dist/components/Tooltip/TooltipContext.js.map +1 -1
  168. package/dist/components/Tooltip/TooltipProvider.cjs.map +1 -1
  169. package/dist/components/Tooltip/TooltipProvider.d.ts.map +1 -1
  170. package/dist/components/Tooltip/TooltipProvider.js.map +1 -1
  171. package/dist/components/Tooltip/useTooltip.cjs.map +1 -1
  172. package/dist/components/Tooltip/useTooltip.d.ts.map +1 -1
  173. package/dist/components/Tooltip/useTooltip.js.map +1 -1
  174. package/dist/components/Typography/Body.cjs.map +1 -1
  175. package/dist/components/Typography/Body.js.map +1 -1
  176. package/dist/components/Typography/Heading.cjs.map +1 -1
  177. package/dist/components/Typography/Heading.js.map +1 -1
  178. package/dist/components/Typography/Text.cjs.map +1 -1
  179. package/dist/components/Typography/Text.js.map +1 -1
  180. package/dist/components/Typography/Typography.cjs.map +1 -1
  181. package/dist/components/Typography/Typography.d.ts.map +1 -1
  182. package/dist/components/Typography/Typography.js.map +1 -1
  183. package/dist/components/VisualList/VisualList.cjs.map +1 -1
  184. package/dist/components/VisualList/VisualList.d.ts.map +1 -1
  185. package/dist/components/VisualList/VisualList.js.map +1 -1
  186. package/dist/components/VisualList/VisualListItem.cjs.map +1 -1
  187. package/dist/components/VisualList/VisualListItem.d.ts.map +1 -1
  188. package/dist/components/VisualList/VisualListItem.js.map +1 -1
  189. package/dist/{style.css.css → style.css} +21 -21
  190. package/dist/utils/__ComponentTemplate__/__ComponentTemplate__.d.ts.map +1 -1
  191. package/dist/utils/platform.cjs.map +1 -1
  192. package/dist/utils/platform.js.map +1 -1
  193. package/dist/utils/string.cjs.map +1 -1
  194. package/dist/utils/string.js.map +1 -1
  195. package/package.json +30 -32
  196. package/src/components/ActivityMarker/Pill.tsx +1 -1
  197. package/src/components/ActivityMarker/Unread.tsx +1 -1
  198. package/src/components/ActivityMarker/UnreadCounter.tsx +1 -1
  199. package/src/components/Alert/Alert.tsx +1 -1
  200. package/src/components/Avatar/Avatar.tsx +1 -1
  201. package/src/components/Badge/Badge.tsx +1 -1
  202. package/src/components/Breadcrumb/Breadcrumb.tsx +6 -1
  203. package/src/components/Button/Button.tsx +5 -5
  204. package/src/components/Button/IconButton/IconButton.tsx +2 -2
  205. package/src/components/Button/UnstyledButton.tsx +6 -1
  206. package/src/components/ChatFilter/ChatFilter.tsx +2 -2
  207. package/src/components/Dropdown/Dropdown.tsx +5 -5
  208. package/src/components/Form/Controls/Action/Action.tsx +6 -1
  209. package/src/components/Form/Controls/Checkbox/Checkbox.tsx +5 -1
  210. package/src/components/Form/Controls/MFA/MFA.tsx +3 -3
  211. package/src/components/Form/Controls/Password/Password.tsx +2 -2
  212. package/src/components/Form/Controls/Radio/Radio.tsx +3 -3
  213. package/src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx +8 -5
  214. package/src/components/Form/Controls/Text/Text.tsx +5 -1
  215. package/src/components/Form/Controls/Toggle/Toggle.tsx +10 -4
  216. package/src/components/Form/Field.tsx +1 -1
  217. package/src/components/Form/InlineField.tsx +1 -1
  218. package/src/components/Form/Label.tsx +1 -1
  219. package/src/components/Form/Message.tsx +1 -1
  220. package/src/components/Form/Root.tsx +1 -1
  221. package/src/components/Form/Submit.tsx +1 -1
  222. package/src/components/Glass/Glass.tsx +2 -2
  223. package/src/components/Icon/BigIcon/BigIcon.tsx +1 -1
  224. package/src/components/Icon/IndicatorIcon/IndicatorIcon.tsx +1 -1
  225. package/src/components/InlineSpinner/InlineSpinner.tsx +1 -1
  226. package/src/components/Link/Link.tsx +1 -1
  227. package/src/components/Menu/CheckboxMenuItem.tsx +6 -1
  228. package/src/components/Menu/ContextMenu.tsx +12 -2
  229. package/src/components/Menu/DrawerMenu.module.css +1 -1
  230. package/src/components/Menu/DrawerMenu.tsx +5 -1
  231. package/src/components/Menu/FloatingMenu.module.css +1 -1
  232. package/src/components/Menu/FloatingMenu.tsx +2 -2
  233. package/src/components/Menu/Menu.tsx +6 -2
  234. package/src/components/Menu/MenuContext.tsx +1 -1
  235. package/src/components/Menu/MenuItem.tsx +6 -6
  236. package/src/components/Menu/RadioMenuItem.tsx +6 -1
  237. package/src/components/Menu/ToggleMenuItem.tsx +6 -1
  238. package/src/components/Nav/NavItem.tsx +4 -4
  239. package/src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx +4 -4
  240. package/src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx +2 -2
  241. package/src/components/Search/Search.tsx +1 -1
  242. package/src/components/Separator/Separator.tsx +3 -3
  243. package/src/components/Toast/Toast.tsx +1 -1
  244. package/src/components/Tooltip/Tooltip.tsx +9 -9
  245. package/src/components/Tooltip/TooltipProvider.tsx +1 -1
  246. package/src/components/Tooltip/useTooltip.ts +4 -4
  247. package/src/components/Typography/Typography.tsx +1 -1
  248. package/src/components/VisualList/VisualList.tsx +1 -1
  249. package/src/components/VisualList/VisualListItem.tsx +5 -1
  250. package/src/utils/__ComponentTemplate__/__ComponentTemplate__.tsx +1 -1
  251. package/tsconfig.json +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"NavItem.cjs","sources":["../../../src/components/Nav/NavItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ForwardedRef,\n MouseEventHandler,\n forwardRef,\n} from \"react\";\n\nimport styles from \"./Nav.module.css\";\n\ntype NavItemProps = {\n active?: boolean;\n \"aria-controls\"?: string;\n};\n\ntype NavItemLinkProps = Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"style\" | \"className\"\n> & {\n href: string;\n} & NavItemProps;\n\ntype NavItemButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"style\" | \"className\"\n> & {\n onClick: MouseEventHandler<HTMLButtonElement>;\n} & NavItemProps;\n\nconst NavItemLink = forwardRef(function NavItemLink(\n {\n children,\n href,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemLinkProps>,\n ref: ForwardedRef<HTMLAnchorElement>,\n) {\n return (\n <a\n href={href}\n onClick={onClick}\n className={styles[\"nav-item\"]}\n {...rest}\n ref={ref}\n >\n {children}\n </a>\n );\n});\n\nconst NavItemButton = forwardRef(function NavItemButton(\n {\n children,\n disabled,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemButtonProps>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <button\n onClick={onClick}\n className={styles[\"nav-item\"]}\n disabled={disabled}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nconst renderAsLink = (\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n): props is React.PropsWithChildren<NavItemLinkProps> =>\n \"href\" in props && !!props.href;\n\n/**\n * A navigation item component to be used with a navigation bar.\n * Will render an anchor when href is provided, otherwise a button element.\n */\nexport const NavItem = forwardRef(function NavItem(\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n ref:\n | ForwardedRef<HTMLButtonElement | null>\n | ForwardedRef<HTMLAnchorElement | null>,\n) {\n /**\n * For accessibility rules related to tabs,\n * see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/#wai-ariaroles,states,andproperties\n *\n * For accessibility rules related to navigation,\n * see https://www.digitala11y.com/navigation-role/\n */\n const ariaControls = props[\"aria-controls\"];\n const isUsedAsTabs = !!ariaControls;\n const a11yAttributes = isUsedAsTabs\n ? {\n // when used as tabs\n \"aria-controls\": ariaControls,\n role: \"tab\",\n \"aria-selected\": props.active,\n }\n : {\n // when used as navigation elements\n \"aria-current\": props.active ? true : undefined,\n };\n\n // All the attributes except `active` can be passed to the button/a element.\n const propsForChild = { ...props };\n delete propsForChild[\"active\"];\n\n // Depending on whether `href` is in props, we render link/button\n let navItem: React.ReactNode;\n if (renderAsLink(propsForChild)) {\n const buttonRef = ref as ForwardedRef<HTMLAnchorElement | null>;\n navItem = (\n <NavItemLink {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n } else {\n const buttonRef = ref as ForwardedRef<HTMLButtonElement | null>;\n navItem = (\n <NavItemButton {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n }\n\n return (\n <li\n className={styles[\"nav-tab\"]}\n data-current={props.active ? true : undefined}\n role=\"presentation\"\n >\n {navItem}\n </li>\n );\n});\n"],"names":["forwardRef","NavItemLink","jsx","styles","NavItemButton","NavItem"],"mappings":";;;;;AAqCA,MAAM,cAAcA,MAAAA,WAAW,SAASC,aACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AAEE,SAAAC,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAWC,mBAAO,UAAU;AAAA,MAC3B,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,MAAM,gBAAgBH,MAAAA,WAAW,SAASI,eACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AAEE,SAAAF,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAWC,mBAAO,UAAU;AAAA,MAC5B;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,MAAM,eAAe,CACnB,UAEA,UAAU,SAAS,CAAC,CAAC,MAAM;AAMtB,MAAM,UAAUH,MAAAA,WAAW,SAASK,SACzC,OACA,KAGA;AAQM,QAAA,eAAe,MAAM,eAAe;AACpC,QAAA,eAAe,CAAC,CAAC;AACvB,QAAM,iBAAiB,eACnB;AAAA;AAAA,IAEE,iBAAiB;AAAA,IACjB,MAAM;AAAA,IACN,iBAAiB,MAAM;AAAA,EAAA,IAEzB;AAAA;AAAA,IAEE,gBAAgB,MAAM,SAAS,OAAO;AAAA,EACxC;AAGE,QAAA,gBAAgB,EAAE,GAAG,MAAM;AACjC,SAAO,cAAc,QAAQ;AAGzB,MAAA;AACA,MAAA,aAAa,aAAa,GAAG;AAC/B,UAAM,YAAY;AAClB,6CACG,aAAa,EAAA,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAAA,OAEjE;AACL,UAAM,YAAY;AAClB,6CACG,eAAe,EAAA,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAAA;AAKxE,SAAAH,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,mBAAO,SAAS;AAAA,MAC3B,gBAAc,MAAM,SAAS,OAAO;AAAA,MACpC,MAAK;AAAA,MAEJ,UAAA;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;;"}
1
+ {"version":3,"file":"NavItem.cjs","sources":["../../../src/components/Nav/NavItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ForwardedRef,\n type MouseEventHandler,\n forwardRef,\n} from \"react\";\n\nimport styles from \"./Nav.module.css\";\n\ntype NavItemProps = {\n active?: boolean;\n \"aria-controls\"?: string;\n};\n\ntype NavItemLinkProps = Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"style\" | \"className\"\n> & {\n href: string;\n} & NavItemProps;\n\ntype NavItemButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"style\" | \"className\"\n> & {\n onClick: MouseEventHandler<HTMLButtonElement>;\n} & NavItemProps;\n\nconst NavItemLink = forwardRef(function NavItemLink(\n {\n children,\n href,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemLinkProps>,\n ref: ForwardedRef<HTMLAnchorElement>,\n) {\n return (\n <a\n href={href}\n onClick={onClick}\n className={styles[\"nav-item\"]}\n {...rest}\n ref={ref}\n >\n {children}\n </a>\n );\n});\n\nconst NavItemButton = forwardRef(function NavItemButton(\n {\n children,\n disabled,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemButtonProps>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <button\n onClick={onClick}\n className={styles[\"nav-item\"]}\n disabled={disabled}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nconst renderAsLink = (\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n): props is React.PropsWithChildren<NavItemLinkProps> =>\n \"href\" in props && !!props.href;\n\n/**\n * A navigation item component to be used with a navigation bar.\n * Will render an anchor when href is provided, otherwise a button element.\n */\nexport const NavItem = forwardRef(function NavItem(\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n ref:\n | ForwardedRef<HTMLButtonElement | null>\n | ForwardedRef<HTMLAnchorElement | null>,\n) {\n /**\n * For accessibility rules related to tabs,\n * see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/#wai-ariaroles,states,andproperties\n *\n * For accessibility rules related to navigation,\n * see https://www.digitala11y.com/navigation-role/\n */\n const ariaControls = props[\"aria-controls\"];\n const isUsedAsTabs = !!ariaControls;\n const a11yAttributes = isUsedAsTabs\n ? {\n // when used as tabs\n \"aria-controls\": ariaControls,\n role: \"tab\",\n \"aria-selected\": props.active,\n }\n : {\n // when used as navigation elements\n \"aria-current\": props.active ? true : undefined,\n };\n\n // All the attributes except `active` can be passed to the button/a element.\n const propsForChild = { ...props };\n delete propsForChild[\"active\"];\n\n // Depending on whether `href` is in props, we render link/button\n let navItem: React.ReactNode;\n if (renderAsLink(propsForChild)) {\n const buttonRef = ref as ForwardedRef<HTMLAnchorElement | null>;\n navItem = (\n <NavItemLink {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n } else {\n const buttonRef = ref as ForwardedRef<HTMLButtonElement | null>;\n navItem = (\n <NavItemButton {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n }\n\n return (\n <li\n className={styles[\"nav-tab\"]}\n data-current={props.active ? true : undefined}\n role=\"presentation\"\n >\n {navItem}\n </li>\n );\n});\n"],"names":["forwardRef","NavItemLink","jsx","styles","NavItemButton","NavItem"],"mappings":";;;;;AAqCA,MAAM,cAAcA,MAAAA,WAAW,SAASC,aACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAWC,WAAAA,QAAO,UAAU;AAAA,MAC3B,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAED,MAAM,gBAAgBH,MAAAA,WAAW,SAASI,eACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACEF,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA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C;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAC1B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,WAAW,CACtB,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,YAAY,CAAC;AAEjB,KAAK,kBAAkB,GAAG,IAAI,CAC5B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,WAAW,CACtB,GAAG;IACF,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAC/C,GAAG,YAAY,CAAC;AAmDjB;;;GAGG;AACH,eAAO,MAAM,OAAO,0IAsDlB,CAAC"}
1
+ {"version":3,"file":"NavItem.d.ts","sourceRoot":"","sources":["../../../src/components/Nav/NavItem.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EACZ,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAEzB,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AAIf,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAC1B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,WAAW,CACtB,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,YAAY,CAAC;AAEjB,KAAK,kBAAkB,GAAG,IAAI,CAC5B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,WAAW,CACtB,GAAG;IACF,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAC/C,GAAG,YAAY,CAAC;AAmDjB;;;GAGG;AACH,eAAO,MAAM,OAAO,0IAsDlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavItem.js","sources":["../../../src/components/Nav/NavItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ForwardedRef,\n MouseEventHandler,\n forwardRef,\n} from \"react\";\n\nimport styles from \"./Nav.module.css\";\n\ntype NavItemProps = {\n active?: boolean;\n \"aria-controls\"?: string;\n};\n\ntype NavItemLinkProps = Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"style\" | \"className\"\n> & {\n href: string;\n} & NavItemProps;\n\ntype NavItemButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"style\" | \"className\"\n> & {\n onClick: MouseEventHandler<HTMLButtonElement>;\n} & NavItemProps;\n\nconst NavItemLink = forwardRef(function NavItemLink(\n {\n children,\n href,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemLinkProps>,\n ref: ForwardedRef<HTMLAnchorElement>,\n) {\n return (\n <a\n href={href}\n onClick={onClick}\n className={styles[\"nav-item\"]}\n {...rest}\n ref={ref}\n >\n {children}\n </a>\n );\n});\n\nconst NavItemButton = forwardRef(function NavItemButton(\n {\n children,\n disabled,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemButtonProps>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <button\n onClick={onClick}\n className={styles[\"nav-item\"]}\n disabled={disabled}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nconst renderAsLink = (\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n): props is React.PropsWithChildren<NavItemLinkProps> =>\n \"href\" in props && !!props.href;\n\n/**\n * A navigation item component to be used with a navigation bar.\n * Will render an anchor when href is provided, otherwise a button element.\n */\nexport const NavItem = forwardRef(function NavItem(\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n ref:\n | ForwardedRef<HTMLButtonElement | null>\n | ForwardedRef<HTMLAnchorElement | null>,\n) {\n /**\n * For accessibility rules related to tabs,\n * see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/#wai-ariaroles,states,andproperties\n *\n * For accessibility rules related to navigation,\n * see https://www.digitala11y.com/navigation-role/\n */\n const ariaControls = props[\"aria-controls\"];\n const isUsedAsTabs = !!ariaControls;\n const a11yAttributes = isUsedAsTabs\n ? {\n // when used as tabs\n \"aria-controls\": ariaControls,\n role: \"tab\",\n \"aria-selected\": props.active,\n }\n : {\n // when used as navigation elements\n \"aria-current\": props.active ? true : undefined,\n };\n\n // All the attributes except `active` can be passed to the button/a element.\n const propsForChild = { ...props };\n delete propsForChild[\"active\"];\n\n // Depending on whether `href` is in props, we render link/button\n let navItem: React.ReactNode;\n if (renderAsLink(propsForChild)) {\n const buttonRef = ref as ForwardedRef<HTMLAnchorElement | null>;\n navItem = (\n <NavItemLink {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n } else {\n const buttonRef = ref as ForwardedRef<HTMLButtonElement | null>;\n navItem = (\n <NavItemButton {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n }\n\n return (\n <li\n className={styles[\"nav-tab\"]}\n data-current={props.active ? true : undefined}\n role=\"presentation\"\n >\n {navItem}\n </li>\n );\n});\n"],"names":["NavItemLink","NavItemButton","NavItem"],"mappings":";;;AAqCA,MAAM,cAAc,WAAW,SAASA,aACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AAEE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,OAAO,UAAU;AAAA,MAC3B,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,MAAM,gBAAgB,WAAW,SAASC,eACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AAEE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,OAAO,UAAU;AAAA,MAC5B;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,MAAM,eAAe,CACnB,UAEA,UAAU,SAAS,CAAC,CAAC,MAAM;AAMtB,MAAM,UAAU,WAAW,SAASC,SACzC,OACA,KAGA;AAQM,QAAA,eAAe,MAAM,eAAe;AACpC,QAAA,eAAe,CAAC,CAAC;AACvB,QAAM,iBAAiB,eACnB;AAAA;AAAA,IAEE,iBAAiB;AAAA,IACjB,MAAM;AAAA,IACN,iBAAiB,MAAM;AAAA,EAAA,IAEzB;AAAA;AAAA,IAEE,gBAAgB,MAAM,SAAS,OAAO;AAAA,EACxC;AAGE,QAAA,gBAAgB,EAAE,GAAG,MAAM;AACjC,SAAO,cAAc,QAAQ;AAGzB,MAAA;AACA,MAAA,aAAa,aAAa,GAAG;AAC/B,UAAM,YAAY;AAClB,kCACG,aAAa,EAAA,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAAA,OAEjE;AACL,UAAM,YAAY;AAClB,kCACG,eAAe,EAAA,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAAA;AAKxE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,OAAO,SAAS;AAAA,MAC3B,gBAAc,MAAM,SAAS,OAAO;AAAA,MACpC,MAAK;AAAA,MAEJ,UAAA;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;"}
1
+ {"version":3,"file":"NavItem.js","sources":["../../../src/components/Nav/NavItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ForwardedRef,\n type MouseEventHandler,\n forwardRef,\n} from \"react\";\n\nimport styles from \"./Nav.module.css\";\n\ntype NavItemProps = {\n active?: boolean;\n \"aria-controls\"?: string;\n};\n\ntype NavItemLinkProps = Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"style\" | \"className\"\n> & {\n href: string;\n} & NavItemProps;\n\ntype NavItemButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"style\" | \"className\"\n> & {\n onClick: MouseEventHandler<HTMLButtonElement>;\n} & NavItemProps;\n\nconst NavItemLink = forwardRef(function NavItemLink(\n {\n children,\n href,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemLinkProps>,\n ref: ForwardedRef<HTMLAnchorElement>,\n) {\n return (\n <a\n href={href}\n onClick={onClick}\n className={styles[\"nav-item\"]}\n {...rest}\n ref={ref}\n >\n {children}\n </a>\n );\n});\n\nconst NavItemButton = forwardRef(function NavItemButton(\n {\n children,\n disabled,\n onClick,\n ...rest\n }: React.PropsWithChildren<NavItemButtonProps>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <button\n onClick={onClick}\n className={styles[\"nav-item\"]}\n disabled={disabled}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nconst renderAsLink = (\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n): props is React.PropsWithChildren<NavItemLinkProps> =>\n \"href\" in props && !!props.href;\n\n/**\n * A navigation item component to be used with a navigation bar.\n * Will render an anchor when href is provided, otherwise a button element.\n */\nexport const NavItem = forwardRef(function NavItem(\n props: React.PropsWithChildren<NavItemLinkProps | NavItemButtonProps>,\n ref:\n | ForwardedRef<HTMLButtonElement | null>\n | ForwardedRef<HTMLAnchorElement | null>,\n) {\n /**\n * For accessibility rules related to tabs,\n * see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/#wai-ariaroles,states,andproperties\n *\n * For accessibility rules related to navigation,\n * see https://www.digitala11y.com/navigation-role/\n */\n const ariaControls = props[\"aria-controls\"];\n const isUsedAsTabs = !!ariaControls;\n const a11yAttributes = isUsedAsTabs\n ? {\n // when used as tabs\n \"aria-controls\": ariaControls,\n role: \"tab\",\n \"aria-selected\": props.active,\n }\n : {\n // when used as navigation elements\n \"aria-current\": props.active ? true : undefined,\n };\n\n // All the attributes except `active` can be passed to the button/a element.\n const propsForChild = { ...props };\n delete propsForChild[\"active\"];\n\n // Depending on whether `href` is in props, we render link/button\n let navItem: React.ReactNode;\n if (renderAsLink(propsForChild)) {\n const buttonRef = ref as ForwardedRef<HTMLAnchorElement | null>;\n navItem = (\n <NavItemLink {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n } else {\n const buttonRef = ref as ForwardedRef<HTMLButtonElement | null>;\n navItem = (\n <NavItemButton {...propsForChild} {...a11yAttributes} ref={buttonRef} />\n );\n }\n\n return (\n <li\n className={styles[\"nav-tab\"]}\n data-current={props.active ? true : undefined}\n role=\"presentation\"\n >\n {navItem}\n </li>\n );\n});\n"],"names":["NavItemLink","NavItemButton","NavItem"],"mappings":";;;AAqCA,MAAM,cAAc,WAAW,SAASA,aACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,OAAO,UAAU;AAAA,MAC3B,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAED,MAAM,gBAAgB,WAAW,SAASC,eACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,OAAO,UAAU;AAAA,MAC5B;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAED,MAAM,eAAe,CACnB,UAEA,UAAU,SAAS,CAAC,CAAC,MAAM;AAMtB,MAAM,UAAU,WAAW,SAASC,SACzC,OACA,KAGA;AAQA,QAAM,eAAe,MAAM,eAAe;AAC1C,QAAM,eAAe,CAAC,CAAC;AACvB,QAAM,iBAAiB,eACnB;AAAA;AAAA,IAEE,iBAAiB;AAAA,IACjB,MAAM;AAAA,IACN,iBAAiB,MAAM;AAAA,EAAA,IAEzB;AAAA;AAAA,IAEE,gBAAgB,MAAM,SAAS,OAAO;AAAA,EAAA;AAI5C,QAAM,gBAAgB,EAAE,GAAG,MAAA;AAC3B,SAAO,cAAc,QAAQ;AAG7B,MAAI;AACJ,MAAI,aAAa,aAAa,GAAG;AAC/B,UAAM,YAAY;AAClB,kCACG,aAAA,EAAa,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAExE,OAAO;AACL,UAAM,YAAY;AAClB,kCACG,eAAA,EAAe,GAAG,eAAgB,GAAG,gBAAgB,KAAK,WAAW;AAAA,EAE1E;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,OAAO,SAAS;AAAA,MAC3B,gBAAc,MAAM,SAAS,OAAO;AAAA,MACpC,MAAK;AAAA,MAEJ,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.cjs","sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { forwardRef, useId } from \"react\";\nimport classNames from \"classnames\";\n\nimport styles from \"./Progress.module.css\";\n\nimport { Root, Indicator } from \"@radix-ui/react-progress\";\n\ntype ProgressProps = {\n /** The size variant of the progress bar */\n size: \"sm\" | \"lg\";\n\n /**\n * The colour variant to use for the progress bar indicator\n * If not set, the progress bar will be rendered with a gray tone, which should only be used when the progress bar is empty\n */\n tint?: \"red\" | \"orange\" | \"lime\" | \"green\";\n\n /** The CSS class name forwarded to the root element */\n className?: string;\n\n /** The value of the progress bar. Defaults to max if not provided */\n value?: number | null;\n\n /** The maximum value of the progress bar. Defaults to 1 if not provided */\n max?: number;\n\n /**\n * A function to get the text label to display in the progress bar.\n * If set, it will display a label on top of the progress bar\n */\n getValueLabel?: (value: number, max: number) => string;\n} & Omit<React.ComponentProps<\"div\">, \"children\">;\n\n/**\n * Displays an indicator showing the completion progress of a task, optionally with a label\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n function Progress(\n {\n size,\n tint,\n className,\n value: valueProp,\n max: maxProp,\n getValueLabel,\n ...props\n },\n ref,\n ) {\n const max = maxProp ?? 1;\n const value = valueProp ?? max;\n const labelId = useId();\n const label = getValueLabel ? getValueLabel(value, max) : null;\n\n return (\n <div\n className={classNames(styles[\"progress-bar-container\"], className)}\n data-tint={tint}\n {...props}\n >\n {label && (\n <div id={labelId} className={styles[\"progress-bar-label\"]}>\n {label}\n </div>\n )}\n\n <Root\n className={styles[\"progress-bar\"]}\n data-size={size}\n max={max}\n value={value}\n ref={ref}\n aria-labelledby={label ? labelId : undefined}\n getValueLabel={getValueLabel}\n >\n <Indicator\n className={styles[\"progress-bar-indicator\"]}\n style={{\n transform: `translateX(-${100 - (value / max) * 100}%)`,\n }}\n />\n </Root>\n </div>\n );\n },\n);\n"],"names":["forwardRef","Progress","useId","jsxs","styles","jsx","Root","Indicator"],"mappings":";;;;;;;AA2CO,MAAM,WAAWA,MAAA;AAAA,EACtB,SAASC,UACP;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,GAAG;AAAA,KAEL,KACA;AACA,UAAM,MAAM,WAAW;AACvB,UAAM,QAAQ,aAAa;AAC3B,UAAM,UAAUC,MAAAA,MAAM;AACtB,UAAM,QAAQ,gBAAgB,cAAc,OAAO,GAAG,IAAI;AAGxD,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAWC,gBAAAA,QAAO,wBAAwB,GAAG,SAAS;AAAA,QACjE,aAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAA;AAAA,UACC,SAAAC,2BAAA,IAAC,SAAI,IAAI,SAAS,WAAWD,gBAAAA,QAAO,oBAAoB,GACrD,UACH,MAAA,CAAA;AAAA,UAGFC,2BAAA;AAAA,YAACC,cAAA;AAAA,YAAA;AAAA,cACC,WAAWF,wBAAO,cAAc;AAAA,cAChC,aAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA,cACA,mBAAiB,QAAQ,UAAU;AAAA,cACnC;AAAA,cAEA,UAAAC,2BAAA;AAAA,gBAACE,cAAA;AAAA,gBAAA;AAAA,kBACC,WAAWH,wBAAO,wBAAwB;AAAA,kBAC1C,OAAO;AAAA,oBACL,WAAW,eAAe,MAAO,QAAQ,MAAO,GAAG;AAAA,kBAAA;AAAA,gBACrD;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"Progress.cjs","sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { forwardRef, useId } from \"react\";\nimport classNames from \"classnames\";\n\nimport styles from \"./Progress.module.css\";\n\nimport { Root, Indicator } from \"@radix-ui/react-progress\";\n\ntype ProgressProps = {\n /** The size variant of the progress bar */\n size: \"sm\" | \"lg\";\n\n /**\n * The colour variant to use for the progress bar indicator\n * If not set, the progress bar will be rendered with a gray tone, which should only be used when the progress bar is empty\n */\n tint?: \"red\" | \"orange\" | \"lime\" | \"green\";\n\n /** The CSS class name forwarded to the root element */\n className?: string;\n\n /** The value of the progress bar. Defaults to max if not provided */\n value?: number | null;\n\n /** The maximum value of the progress bar. Defaults to 1 if not provided */\n max?: number;\n\n /**\n * A function to get the text label to display in the progress bar.\n * If set, it will display a label on top of the progress bar\n */\n getValueLabel?: (value: number, max: number) => string;\n} & Omit<React.ComponentProps<\"div\">, \"children\">;\n\n/**\n * Displays an indicator showing the completion progress of a task, optionally with a label\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n function Progress(\n {\n size,\n tint,\n className,\n value: valueProp,\n max: maxProp,\n getValueLabel,\n ...props\n },\n ref,\n ) {\n const max = maxProp ?? 1;\n const value = valueProp ?? max;\n const labelId = useId();\n const label = getValueLabel ? getValueLabel(value, max) : null;\n\n return (\n <div\n className={classNames(styles[\"progress-bar-container\"], className)}\n data-tint={tint}\n {...props}\n >\n {label && (\n <div id={labelId} className={styles[\"progress-bar-label\"]}>\n {label}\n </div>\n )}\n\n <Root\n className={styles[\"progress-bar\"]}\n data-size={size}\n max={max}\n value={value}\n ref={ref}\n aria-labelledby={label ? labelId : undefined}\n getValueLabel={getValueLabel}\n >\n <Indicator\n className={styles[\"progress-bar-indicator\"]}\n style={{\n transform: `translateX(-${100 - (value / max) * 100}%)`,\n }}\n />\n </Root>\n </div>\n );\n },\n);\n"],"names":["forwardRef","Progress","useId","jsxs","styles","jsx","Root","Indicator"],"mappings":";;;;;;;AA2CO,MAAM,WAAWA,MAAAA;AAAAA,EACtB,SAASC,UACP;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,KACA;AACA,UAAM,MAAM,WAAW;AACvB,UAAM,QAAQ,aAAa;AAC3B,UAAM,UAAUC,MAAAA,MAAA;AAChB,UAAM,QAAQ,gBAAgB,cAAc,OAAO,GAAG,IAAI;AAE1D,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAWC,gBAAAA,QAAO,wBAAwB,GAAG,SAAS;AAAA,QACjE,aAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,SACCC,2BAAAA,IAAC,SAAI,IAAI,SAAS,WAAWD,gBAAAA,QAAO,oBAAoB,GACrD,UAAA,MAAA,CACH;AAAA,UAGFC,2BAAAA;AAAAA,YAACC,cAAAA;AAAAA,YAAA;AAAA,cACC,WAAWF,gBAAAA,QAAO,cAAc;AAAA,cAChC,aAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA,cACA,mBAAiB,QAAQ,UAAU;AAAA,cACnC;AAAA,cAEA,UAAAC,2BAAAA;AAAAA,gBAACE,cAAAA;AAAAA,gBAAA;AAAA,kBACC,WAAWH,gBAAAA,QAAO,wBAAwB;AAAA,kBAC1C,OAAO;AAAA,oBACL,WAAW,eAAe,MAAO,QAAQ,MAAO,GAAG;AAAA,kBAAA;AAAA,gBACrD;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.js","sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { forwardRef, useId } from \"react\";\nimport classNames from \"classnames\";\n\nimport styles from \"./Progress.module.css\";\n\nimport { Root, Indicator } from \"@radix-ui/react-progress\";\n\ntype ProgressProps = {\n /** The size variant of the progress bar */\n size: \"sm\" | \"lg\";\n\n /**\n * The colour variant to use for the progress bar indicator\n * If not set, the progress bar will be rendered with a gray tone, which should only be used when the progress bar is empty\n */\n tint?: \"red\" | \"orange\" | \"lime\" | \"green\";\n\n /** The CSS class name forwarded to the root element */\n className?: string;\n\n /** The value of the progress bar. Defaults to max if not provided */\n value?: number | null;\n\n /** The maximum value of the progress bar. Defaults to 1 if not provided */\n max?: number;\n\n /**\n * A function to get the text label to display in the progress bar.\n * If set, it will display a label on top of the progress bar\n */\n getValueLabel?: (value: number, max: number) => string;\n} & Omit<React.ComponentProps<\"div\">, \"children\">;\n\n/**\n * Displays an indicator showing the completion progress of a task, optionally with a label\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n function Progress(\n {\n size,\n tint,\n className,\n value: valueProp,\n max: maxProp,\n getValueLabel,\n ...props\n },\n ref,\n ) {\n const max = maxProp ?? 1;\n const value = valueProp ?? max;\n const labelId = useId();\n const label = getValueLabel ? getValueLabel(value, max) : null;\n\n return (\n <div\n className={classNames(styles[\"progress-bar-container\"], className)}\n data-tint={tint}\n {...props}\n >\n {label && (\n <div id={labelId} className={styles[\"progress-bar-label\"]}>\n {label}\n </div>\n )}\n\n <Root\n className={styles[\"progress-bar\"]}\n data-size={size}\n max={max}\n value={value}\n ref={ref}\n aria-labelledby={label ? labelId : undefined}\n getValueLabel={getValueLabel}\n >\n <Indicator\n className={styles[\"progress-bar-indicator\"]}\n style={{\n transform: `translateX(-${100 - (value / max) * 100}%)`,\n }}\n />\n </Root>\n </div>\n );\n },\n);\n"],"names":["Progress"],"mappings":";;;;;AA2CO,MAAM,WAAW;AAAA,EACtB,SAASA,UACP;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,GAAG;AAAA,KAEL,KACA;AACA,UAAM,MAAM,WAAW;AACvB,UAAM,QAAQ,aAAa;AAC3B,UAAM,UAAU,MAAM;AACtB,UAAM,QAAQ,gBAAgB,cAAc,OAAO,GAAG,IAAI;AAGxD,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAW,OAAO,wBAAwB,GAAG,SAAS;AAAA,QACjE,aAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAA;AAAA,UACC,SAAA,oBAAC,SAAI,IAAI,SAAS,WAAW,OAAO,oBAAoB,GACrD,UACH,MAAA,CAAA;AAAA,UAGF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,OAAO,cAAc;AAAA,cAChC,aAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA,cACA,mBAAiB,QAAQ,UAAU;AAAA,cACnC;AAAA,cAEA,UAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW,OAAO,wBAAwB;AAAA,kBAC1C,OAAO;AAAA,oBACL,WAAW,eAAe,MAAO,QAAQ,MAAO,GAAG;AAAA,kBAAA;AAAA,gBACrD;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"Progress.js","sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { forwardRef, useId } from \"react\";\nimport classNames from \"classnames\";\n\nimport styles from \"./Progress.module.css\";\n\nimport { Root, Indicator } from \"@radix-ui/react-progress\";\n\ntype ProgressProps = {\n /** The size variant of the progress bar */\n size: \"sm\" | \"lg\";\n\n /**\n * The colour variant to use for the progress bar indicator\n * If not set, the progress bar will be rendered with a gray tone, which should only be used when the progress bar is empty\n */\n tint?: \"red\" | \"orange\" | \"lime\" | \"green\";\n\n /** The CSS class name forwarded to the root element */\n className?: string;\n\n /** The value of the progress bar. Defaults to max if not provided */\n value?: number | null;\n\n /** The maximum value of the progress bar. Defaults to 1 if not provided */\n max?: number;\n\n /**\n * A function to get the text label to display in the progress bar.\n * If set, it will display a label on top of the progress bar\n */\n getValueLabel?: (value: number, max: number) => string;\n} & Omit<React.ComponentProps<\"div\">, \"children\">;\n\n/**\n * Displays an indicator showing the completion progress of a task, optionally with a label\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n function Progress(\n {\n size,\n tint,\n className,\n value: valueProp,\n max: maxProp,\n getValueLabel,\n ...props\n },\n ref,\n ) {\n const max = maxProp ?? 1;\n const value = valueProp ?? max;\n const labelId = useId();\n const label = getValueLabel ? getValueLabel(value, max) : null;\n\n return (\n <div\n className={classNames(styles[\"progress-bar-container\"], className)}\n data-tint={tint}\n {...props}\n >\n {label && (\n <div id={labelId} className={styles[\"progress-bar-label\"]}>\n {label}\n </div>\n )}\n\n <Root\n className={styles[\"progress-bar\"]}\n data-size={size}\n max={max}\n value={value}\n ref={ref}\n aria-labelledby={label ? labelId : undefined}\n getValueLabel={getValueLabel}\n >\n <Indicator\n className={styles[\"progress-bar-indicator\"]}\n style={{\n transform: `translateX(-${100 - (value / max) * 100}%)`,\n }}\n />\n </Root>\n </div>\n );\n },\n);\n"],"names":["Progress"],"mappings":";;;;;AA2CO,MAAM,WAAW;AAAA,EACtB,SAASA,UACP;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,KACA;AACA,UAAM,MAAM,WAAW;AACvB,UAAM,QAAQ,aAAa;AAC3B,UAAM,UAAU,MAAA;AAChB,UAAM,QAAQ,gBAAgB,cAAc,OAAO,GAAG,IAAI;AAE1D,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAW,OAAO,wBAAwB,GAAG,SAAS;AAAA,QACjE,aAAW;AAAA,QACV,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,SACC,oBAAC,SAAI,IAAI,SAAS,WAAW,OAAO,oBAAoB,GACrD,UAAA,MAAA,CACH;AAAA,UAGF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,OAAO,cAAc;AAAA,cAChC,aAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA,cACA,mBAAiB,QAAQ,UAAU;AAAA,cACnC;AAAA,cAEA,UAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW,OAAO,wBAAwB;AAAA,kBAC1C,OAAO;AAAA,oBACL,WAAW,eAAe,MAAO,QAAQ,MAAO,GAAG;AAAA,kBAAA;AAAA,gBACrD;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n cloneElement,\n isValidElement,\n JSX,\n PropsWithChildren,\n Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n }),\n );\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":["useReleaseAnnouncement","jsxs","ReleaseAnnouncementContext","jsx","useReleaseAnnouncementContext","useMergeRefs","isValidElement","cloneElement","FloatingPortal","FloatingFocusManager","styles","FloatingArrow","Fragment","Text","Button"],"mappings":";;;;;;;;;;AAoDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAUA,uBAAAA,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACGC,2BAAAA,KAAAC,2BAAAA,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAAC,+BAAC,6BAA2B,UAAS;AAAA,IACpCA,2BAAA,IAAA,8BAAA,EACC,UAACA,2BAAAA,IAAA,4BAAA,CAAA,CAA2B,EAC9B,CAAA;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAUC,2BAAAA,8BAA8B;AAI9C,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAMC,MAAAA,aAAa,CAAC,QAAQ,KAAK,cAAc,WAA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A;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAO,QAAA;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IACH;AAAA,IACAP,2BAAA;AAAA,MAACU,KAAA;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAO,QAAA;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IACH;AAAA,IACAP,2BAAA;AAAA,MAACW,OAAA;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAWJ,2BAAO,QAAA;AAAA,QAClB;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;;"}
1
+ {"version":3,"file":"ReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n }),\n );\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":["useReleaseAnnouncement","jsxs","ReleaseAnnouncementContext","jsx","useReleaseAnnouncementContext","useMergeRefs","isValidElement","cloneElement","FloatingPortal","FloatingFocusManager","styles","FloatingArrow","Fragment","Text","Button"],"mappings":";;;;;;;;;;AAoDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAUA,uBAAAA,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACEC,2BAAAA,KAACC,2BAAAA,2BAA2B,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AA,YACC,KAAK;AAAA,YACL,SAAS;AAAA,YAET,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAWD,2BAAAA,QAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGrB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL,EAAA,CACF;AAEJ;AAUA,SAAS,6BAA0C;AACjD,QAAM,EAAE,SAAS,eAAe,QAAQ,aAAa,YAAY,QAAA,IAC/DN,yDAAA;AAEF,SACEH,2BAAAA,KAAAW,qBAAA,EACE,UAAA;AAAA,IAAAT,2BAAAA;AAAAA,MAACU,KAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAAA,QAAO;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHP,2BAAAA;AAAAA,MAACU,KAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAAA,QAAO;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHP,2BAAAA;AAAAA,MAACW,OAAAA;AAAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAWJ,2BAAAA,QAAO;AAAA,QAClB;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAc,EAGZ,GAAG,EACH,iBAAiB,EAElB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF,UAAU,wBACR,SAAQ,IAAI,CAAC,2BAA2B,EAAE,WAAW,GAAG,cAAc,CAAC;IACvE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC;AAClC;;GAEG;AACH,QAAQ,EACR,SAAmB,EACnB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,GAAG,GAAG,CAAC,OAAO,CAW3D"}
1
+ {"version":3,"file":"ReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAc,EAGZ,KAAK,GAAG,EACR,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF,UAAU,wBACR,SAAQ,IAAI,CAAC,2BAA2B,EAAE,WAAW,GAAG,cAAc,CAAC;IACvE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC;AAClC;;GAEG;AACH,QAAQ,EACR,SAAmB,EACnB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,GAAG,GAAG,CAAC,OAAO,CAW3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.js","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n cloneElement,\n isValidElement,\n JSX,\n PropsWithChildren,\n Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n }),\n );\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAoDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAU,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACG,qBAAA,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAA,oBAAC,6BAA2B,UAAS;AAAA,IACpC,oBAAA,8BAAA,EACC,UAAC,oBAAA,4BAAA,CAAA,CAA2B,EAC9B,CAAA;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAU,8BAA8B;AAI9C,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAE7D,MAAA,CAAC,eAAe,QAAQ,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AAAA,IACL;AAAA,IACA,QAAQ,kBAAkB;AAAA,MACxB;AAAA;AAAA;AAAA,MAGA,GAAI,QAAQ,QAAQ;AAAA,QAClB,oBAAoB,QAAQ,mBAAmB;AAAA,MAAA;AAAA,IAElD,CAAA;AAAA,EACH;AACF;AAOA,SAAS,6BAA6B;AAAA,EACpC;AACF,GAA0C;AAClC,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,GAAG;AAAA,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["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n }),\n );\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAoDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAU,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACE,qBAAC,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAA,oBAAC,6BAA2B,UAAS;AAAA,IACrC,oBAAC,8BAAA,EACC,UAAA,oBAAC,4BAAA,CAAA,CAA2B,EAAA,CAC9B;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAU,8BAAA;AAIhB,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAEjE,MAAI,CAAC,eAAe,QAAQ,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,kBAAkB;AAAA,MACxB;AAAA;AAAA;AAAA,MAGA,GAAI,QAAQ,QAAQ;AAAA,QAClB,oBAAoB,QAAQ,mBAAmB;AAAA,MAAA;AAAA,IACjD,CACD;AAAA,EAAA;AAEL;AAOA,SAAS,6BAA6B;AAAA,EACpC;AACF,GAA0C;AACxC,QAAM;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EA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"file":"ReleaseAnnouncementContext.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { createContext, useContext } from \"react\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype ContextType = ReturnType<typeof useReleaseAnnouncement> | null;\n/**\n * The context for the ReleaseAnnouncement components.\n */\nexport const ReleaseAnnouncementContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the ReleaseAnnouncement components.\n */\nexport function useReleaseAnnouncementContext() {\n const context = useContext(ReleaseAnnouncementContext);\n\n if (context == null) {\n throw new Error(\n \"ReleaseAnnouncement components must be wrapped in <ReleaseAnnouncement />\",\n );\n }\n\n return context;\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAca,MAAA,6BAA6BA,oBAA2B,IAAI;AAKlE,SAAS,gCAAgC;AACxC,QAAA,UAAUC,iBAAW,0BAA0B;AAErD,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AACT;;;"}
1
+ {"version":3,"file":"ReleaseAnnouncementContext.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { createContext, useContext } from \"react\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype ContextType = ReturnType<typeof useReleaseAnnouncement> | null;\n/**\n * The context for the ReleaseAnnouncement components.\n */\nexport const ReleaseAnnouncementContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the ReleaseAnnouncement components.\n */\nexport function useReleaseAnnouncementContext() {\n const context = useContext(ReleaseAnnouncementContext);\n\n if (context == null) {\n throw new Error(\n \"ReleaseAnnouncement components must be wrapped in <ReleaseAnnouncement />\",\n );\n }\n\n return context;\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAcO,MAAM,6BAA6BA,MAAAA,cAA2B,IAAI;AAKlE,SAAS,gCAAgC;AAC9C,QAAM,UAAUC,MAAAA,WAAW,0BAA0B;AAErD,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncementContext.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,GAAG,IAAI,CAAC;AACpE;;GAEG;AACH,eAAO,MAAM,0BAA0B,sCAAmC,CAAC;AAE3E;;GAEG;AACH,wBAAgB,6BAA6B;;;;;;;;;iCAWilkC,CAAC,EAAC,MAAO,SAAS;gCAAwE,CAAC,EAAC,MAAO,SAAS;4BAAwE,CAAC,OAAO,MAAM,SAAS;;;;;;;;;;;oBAA320B,MAAO,aAAa;;;kBAAiV,MAAO,gBAAgB;;;;;;;;;;;;;;;;wBAA5X,MAAO,aAAa;;;;iBAA2rB,MAAO,gBAAgB;;;;;;;EADnsR"}
1
+ {"version":3,"file":"ReleaseAnnouncementContext.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,GAAG,IAAI,CAAC;AACpE;;GAEG;AACH,eAAO,MAAM,0BAA0B,sCAAmC,CAAC;AAE3E;;GAEG;AACH,wBAAgB,6BAA6B;;;;;;;;;iCAWuinC,CAAC;gCAAyF,CAAC;4BAAyF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EADxwnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncementContext.js","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { createContext, useContext } from \"react\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype ContextType = ReturnType<typeof useReleaseAnnouncement> | null;\n/**\n * The context for the ReleaseAnnouncement components.\n */\nexport const ReleaseAnnouncementContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the ReleaseAnnouncement components.\n */\nexport function useReleaseAnnouncementContext() {\n const context = useContext(ReleaseAnnouncementContext);\n\n if (context == null) {\n throw new Error(\n \"ReleaseAnnouncement components must be wrapped in <ReleaseAnnouncement />\",\n );\n }\n\n return context;\n}\n"],"names":[],"mappings":";AAca,MAAA,6BAA6B,cAA2B,IAAI;AAKlE,SAAS,gCAAgC;AACxC,QAAA,UAAU,WAAW,0BAA0B;AAErD,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AACT;"}
1
+ {"version":3,"file":"ReleaseAnnouncementContext.js","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncementContext.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { createContext, useContext } from \"react\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype ContextType = ReturnType<typeof useReleaseAnnouncement> | null;\n/**\n * The context for the ReleaseAnnouncement components.\n */\nexport const ReleaseAnnouncementContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the ReleaseAnnouncement components.\n */\nexport function useReleaseAnnouncementContext() {\n const context = useContext(ReleaseAnnouncementContext);\n\n if (context == null) {\n throw new Error(\n \"ReleaseAnnouncement components must be wrapped in <ReleaseAnnouncement />\",\n );\n }\n\n return context;\n}\n"],"names":[],"mappings":";AAcO,MAAM,6BAA6B,cAA2B,IAAI;AAKlE,SAAS,gCAAgC;AAC9C,QAAM,UAAU,WAAW,0BAA0B;AAErD,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport {\n arrow,\n autoUpdate,\n limitShift,\n offset,\n Placement,\n shift,\n useFloating,\n useId,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { MouseEventHandler, useMemo, useRef } from \"react\";\n\ninterface UseReleaseAnnouncementProps {\n /**\n * Whether the release announcement is open.\n */\n open: boolean;\n /**\n * The header of the release announcement.\n */\n header: string;\n /**\n * The description of the release announcement.\n */\n description: string;\n /**\n * The label of the close button.\n */\n closeLabel: string;\n /**\n * The placement of the release announcement.\n */\n placement: Placement;\n /**\n * The event handler for the close button.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether to display an arrow.\n */\n displayArrow?: boolean;\n}\n\n/**\n * This hook provides the necessary props to create a release announcement.\n */\nexport function useReleaseAnnouncement({\n open,\n header,\n description,\n closeLabel,\n placement,\n onClick,\n displayArrow,\n}: UseReleaseAnnouncementProps) {\n // Set on `aria-labelledby` attribute\n const labelId = useId();\n // Set on `aria-describedby` attribute\n const descriptionId = useId();\n const arrowRef = useRef(null);\n\n const data = useFloating({\n placement,\n open,\n whileElementsMounted: autoUpdate,\n middleware: [\n // arrow height 12px + 4px padding\n offset(16),\n shift({ limiter: limitShift({ offset: 50 }) }),\n // add the little arrow along with the floating content\n displayArrow &&\n arrow({\n element: arrowRef,\n }),\n ],\n });\n\n // The role is used to determine the correct aria role for the floating content.\n const role = useRole(data.context);\n const interactions = useInteractions([role]);\n\n // Put in the context all the useful data and interactions\n return useMemo(\n () => ({\n open,\n ...data,\n ...interactions,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n }),\n [\n open,\n role,\n interactions,\n data,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n ],\n );\n}\n"],"names":["useId","useRef","useFloating","autoUpdate","offset","shift","limitShift","arrow","useRole","useInteractions","useMemo"],"mappings":";;;;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,UAAUA,MAAAA,MAAM;AAEtB,QAAM,gBAAgBA,MAAAA,MAAM;AACtB,QAAA,WAAWC,aAAO,IAAI;AAE5B,QAAM,OAAOC,MAAAA,YAAY;AAAA,IACvB;AAAA,IACA;AAAA,IACA,sBAAsBC,MAAA;AAAA,IACtB,YAAY;AAAA;AAAA,MAEVC,MAAAA,OAAO,EAAE;AAAA,MACTC,MAAA,MAAM,EAAE,SAASC,MAAA,WAAW,EAAE,QAAQ,GAAI,CAAA,GAAG;AAAA;AAAA,MAE7C,gBACEC,MAAAA,MAAM;AAAA,QACJ,SAAS;AAAA,MACV,CAAA;AAAA,IAAA;AAAA,EACL,CACD;AAGK,QAAA,OAAOC,MAAAA,QAAQ,KAAK,OAAO;AACjC,QAAM,eAAeC,MAAAA,gBAAgB,CAAC,IAAI,CAAC;AAGpC,SAAAC,MAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACF;;"}
1
+ {"version":3,"file":"useReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport {\n arrow,\n autoUpdate,\n limitShift,\n offset,\n type Placement,\n shift,\n useFloating,\n useId,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { type MouseEventHandler, useMemo, useRef } from \"react\";\n\ninterface UseReleaseAnnouncementProps {\n /**\n * Whether the release announcement is open.\n */\n open: boolean;\n /**\n * The header of the release announcement.\n */\n header: string;\n /**\n * The description of the release announcement.\n */\n description: string;\n /**\n * The label of the close button.\n */\n closeLabel: string;\n /**\n * The placement of the release announcement.\n */\n placement: Placement;\n /**\n * The event handler for the close button.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether to display an arrow.\n */\n displayArrow?: boolean;\n}\n\n/**\n * This hook provides the necessary props to create a release announcement.\n */\nexport function useReleaseAnnouncement({\n open,\n header,\n description,\n closeLabel,\n placement,\n onClick,\n displayArrow,\n}: UseReleaseAnnouncementProps) {\n // Set on `aria-labelledby` attribute\n const labelId = useId();\n // Set on `aria-describedby` attribute\n const descriptionId = useId();\n const arrowRef = useRef(null);\n\n const data = useFloating({\n placement,\n open,\n whileElementsMounted: autoUpdate,\n middleware: [\n // arrow height 12px + 4px padding\n offset(16),\n shift({ limiter: limitShift({ offset: 50 }) }),\n // add the little arrow along with the floating content\n displayArrow &&\n arrow({\n element: arrowRef,\n }),\n ],\n });\n\n // The role is used to determine the correct aria role for the floating content.\n const role = useRole(data.context);\n const interactions = useInteractions([role]);\n\n // Put in the context all the useful data and interactions\n return useMemo(\n () => ({\n open,\n ...data,\n ...interactions,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n }),\n [\n open,\n role,\n interactions,\n data,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n ],\n );\n}\n"],"names":["useId","useRef","useFloating","autoUpdate","offset","shift","limitShift","arrow","useRole","useInteractions","useMemo"],"mappings":";;;;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,UAAUA,MAAAA,MAAA;AAEhB,QAAM,gBAAgBA,MAAAA,MAAA;AACtB,QAAM,WAAWC,MAAAA,OAAO,IAAI;AAE5B,QAAM,OAAOC,MAAAA,YAAY;AAAA,IACvB;AAAA,IACA;AAAA,IACA,sBAAsBC,MAAAA;AAAAA,IACtB,YAAY;AAAA;AAAA,MAEVC,MAAAA,OAAO,EAAE;AAAA,MACTC,MAAAA,MAAM,EAAE,SAASC,MAAAA,WAAW,EAAE,QAAQ,GAAA,CAAI,GAAG;AAAA;AAAA,MAE7C,gBACEC,MAAAA,MAAM;AAAA,QACJ,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EACL,CACD;AAGD,QAAM,OAAOC,MAAAA,QAAQ,KAAK,OAAO;AACjC,QAAM,eAAeC,MAAAA,gBAAgB,CAAC,IAAI,CAAC;AAG3C,SAAOC,MAAAA;AAAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAO,EAKL,SAAS,EAMV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAE3D,UAAU,2BAA2B;IACnC;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,2BAA2B;;;;;;;;;iCA0D8/gC,CAAC,EAAC,MAAO,SAAS;gCAAwE,CAAC,EAAC,MAAO,SAAS;4BAAwE,CAAC,OAAO,MAAM,SAAS;;;;;;;;;;;oBAA320B,MAAO,aAAa;;;kBAAiV,MAAO,gBAAgB;;;;;;;;;;;;;;;;wBAA5X,MAAO,aAAa;;;;iBAA2rB,MAAO,gBAAgB;;;;;;;EADjmO"}
1
+ {"version":3,"file":"useReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAO,EAKL,KAAK,SAAS,EAMf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAEhE,UAAU,2BAA2B;IACnC;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,2BAA2B;;;;;;;;;iCA0D08jC,CAAC;gCAAyF,CAAC;4BAAyF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAD5pkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseAnnouncement.js","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport {\n arrow,\n autoUpdate,\n limitShift,\n offset,\n Placement,\n shift,\n useFloating,\n useId,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { MouseEventHandler, useMemo, useRef } from \"react\";\n\ninterface UseReleaseAnnouncementProps {\n /**\n * Whether the release announcement is open.\n */\n open: boolean;\n /**\n * The header of the release announcement.\n */\n header: string;\n /**\n * The description of the release announcement.\n */\n description: string;\n /**\n * The label of the close button.\n */\n closeLabel: string;\n /**\n * The placement of the release announcement.\n */\n placement: Placement;\n /**\n * The event handler for the close button.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether to display an arrow.\n */\n displayArrow?: boolean;\n}\n\n/**\n * This hook provides the necessary props to create a release announcement.\n */\nexport function useReleaseAnnouncement({\n open,\n header,\n description,\n closeLabel,\n placement,\n onClick,\n displayArrow,\n}: UseReleaseAnnouncementProps) {\n // Set on `aria-labelledby` attribute\n const labelId = useId();\n // Set on `aria-describedby` attribute\n const descriptionId = useId();\n const arrowRef = useRef(null);\n\n const data = useFloating({\n placement,\n open,\n whileElementsMounted: autoUpdate,\n middleware: [\n // arrow height 12px + 4px padding\n offset(16),\n shift({ limiter: limitShift({ offset: 50 }) }),\n // add the little arrow along with the floating content\n displayArrow &&\n arrow({\n element: arrowRef,\n }),\n ],\n });\n\n // The role is used to determine the correct aria role for the floating content.\n const role = useRole(data.context);\n const interactions = useInteractions([role]);\n\n // Put in the context all the useful data and interactions\n return useMemo(\n () => ({\n open,\n ...data,\n ...interactions,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n }),\n [\n open,\n role,\n interactions,\n data,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n ],\n );\n}\n"],"names":[],"mappings":";;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,UAAU,MAAM;AAEtB,QAAM,gBAAgB,MAAM;AACtB,QAAA,WAAW,OAAO,IAAI;AAE5B,QAAM,OAAO,YAAY;AAAA,IACvB;AAAA,IACA;AAAA,IACA,sBAAsB;AAAA,IACtB,YAAY;AAAA;AAAA,MAEV,OAAO,EAAE;AAAA,MACT,MAAM,EAAE,SAAS,WAAW,EAAE,QAAQ,GAAI,CAAA,GAAG;AAAA;AAAA,MAE7C,gBACE,MAAM;AAAA,QACJ,SAAS;AAAA,MACV,CAAA;AAAA,IAAA;AAAA,EACL,CACD;AAGK,QAAA,OAAO,QAAQ,KAAK,OAAO;AACjC,QAAM,eAAe,gBAAgB,CAAC,IAAI,CAAC;AAGpC,SAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"useReleaseAnnouncement.js","sources":["../../../src/components/ReleaseAnnouncement/useReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport {\n arrow,\n autoUpdate,\n limitShift,\n offset,\n type Placement,\n shift,\n useFloating,\n useId,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { type MouseEventHandler, useMemo, useRef } from \"react\";\n\ninterface UseReleaseAnnouncementProps {\n /**\n * Whether the release announcement is open.\n */\n open: boolean;\n /**\n * The header of the release announcement.\n */\n header: string;\n /**\n * The description of the release announcement.\n */\n description: string;\n /**\n * The label of the close button.\n */\n closeLabel: string;\n /**\n * The placement of the release announcement.\n */\n placement: Placement;\n /**\n * The event handler for the close button.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether to display an arrow.\n */\n displayArrow?: boolean;\n}\n\n/**\n * This hook provides the necessary props to create a release announcement.\n */\nexport function useReleaseAnnouncement({\n open,\n header,\n description,\n closeLabel,\n placement,\n onClick,\n displayArrow,\n}: UseReleaseAnnouncementProps) {\n // Set on `aria-labelledby` attribute\n const labelId = useId();\n // Set on `aria-describedby` attribute\n const descriptionId = useId();\n const arrowRef = useRef(null);\n\n const data = useFloating({\n placement,\n open,\n whileElementsMounted: autoUpdate,\n middleware: [\n // arrow height 12px + 4px padding\n offset(16),\n shift({ limiter: limitShift({ offset: 50 }) }),\n // add the little arrow along with the floating content\n displayArrow &&\n arrow({\n element: arrowRef,\n }),\n ],\n });\n\n // The role is used to determine the correct aria role for the floating content.\n const role = useRole(data.context);\n const interactions = useInteractions([role]);\n\n // Put in the context all the useful data and interactions\n return useMemo(\n () => ({\n open,\n ...data,\n ...interactions,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n }),\n [\n open,\n role,\n interactions,\n data,\n labelId,\n descriptionId,\n header,\n description,\n closeLabel,\n onClick,\n displayArrow,\n arrowRef,\n ],\n );\n}\n"],"names":[],"mappings":";;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,UAAU,MAAA;AAEhB,QAAM,gBAAgB,MAAA;AACtB,QAAM,WAAW,OAAO,IAAI;AAE5B,QAAM,OAAO,YAAY;AAAA,IACvB;AAAA,IACA;AAAA,IACA,sBAAsB;AAAA,IACtB,YAAY;AAAA;AAAA,MAEV,OAAO,EAAE;AAAA,MACT,MAAM,EAAE,SAAS,WAAW,EAAE,QAAQ,GAAA,CAAI,GAAG;AAAA;AAAA,MAE7C,gBACE,MAAM;AAAA,QACJ,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EACL,CACD;AAGD,QAAM,OAAO,QAAQ,KAAK,OAAO;AACjC,QAAM,eAAe,gBAAgB,CAAC,IAAI,CAAC;AAG3C,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Search.cjs","sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { ComponentProps, forwardRef, useId } from \"react\";\nimport styles from \"./Search.module.css\";\nimport { Field, Label } from \"../Form\";\n\nimport SearchIcon from \"@vector-im/compound-design-tokens/assets/web/icons/search\";\n\ntype SearchProps = {\n /**\n * The CSS class name\n */\n className?: string;\n /**\n * The input placeholder.\n * @default \"Search…\"\n */\n placeholder?: string;\n /**\n * The field name.\n */\n name: React.ComponentProps<typeof Field>[\"name\"];\n} & Omit<ComponentProps<\"input\">, \"id\" | \"type\">;\n\n/**\n * A standalone search component\n */\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n className,\n onChange,\n // TODO: i18n needs to be setup\n placeholder = \"Search…\",\n name,\n ...props\n }: SearchProps,\n ref,\n) {\n const classes = classnames(styles.search, className);\n const id = useId();\n return (\n <Field name={name} asChild>\n <Label className={classes} htmlFor={id}>\n <SearchIcon className={styles.icon} width={20} height={20} />\n <input\n ref={ref}\n {...props}\n id={id}\n name={name}\n type=\"search\"\n placeholder={placeholder}\n onChange={onChange}\n className={styles.input}\n />\n </Label>\n </Field>\n );\n});\n"],"names":["forwardRef","Search","classnames","styles","useId","jsx","Field","Label"],"mappings":";;;;;;;;;AAiCa,MAAA,SAASA,MAAAA,WAA0C,SAASC,QACvE;AAAA,EACE;AAAA,EACA;AAAA;AAAA,EAEA,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAWC,sBAAO,QAAQ,SAAS;AACnD,QAAM,KAAKC,MAAAA,MAAM;AAEf,SAAAC,2BAAAA,IAACC,MAAAA,OAAM,EAAA,MAAY,SAAO,MACxB,0CAACC,MAAM,OAAA,EAAA,WAAW,SAAS,SAAS,IAClC,UAAA;AAAA,IAAAF,+BAAC,cAAW,WAAWF,cAAA,QAAO,MAAM,OAAO,IAAI,QAAQ,IAAI;AAAA,IAC3DE,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,WAAWF,cAAAA,QAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACpB,EAAA,CACF,EACF,CAAA;AAEJ,CAAC;;"}
1
+ {"version":3,"file":"Search.cjs","sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { type ComponentProps, forwardRef, useId } from \"react\";\nimport styles from \"./Search.module.css\";\nimport { Field, Label } from \"../Form\";\n\nimport SearchIcon from \"@vector-im/compound-design-tokens/assets/web/icons/search\";\n\ntype SearchProps = {\n /**\n * The CSS class name\n */\n className?: string;\n /**\n * The input placeholder.\n * @default \"Search…\"\n */\n placeholder?: string;\n /**\n * The field name.\n */\n name: React.ComponentProps<typeof Field>[\"name\"];\n} & Omit<ComponentProps<\"input\">, \"id\" | \"type\">;\n\n/**\n * A standalone search component\n */\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n className,\n onChange,\n // TODO: i18n needs to be setup\n placeholder = \"Search…\",\n name,\n ...props\n }: SearchProps,\n ref,\n) {\n const classes = classnames(styles.search, className);\n const id = useId();\n return (\n <Field name={name} asChild>\n <Label className={classes} htmlFor={id}>\n <SearchIcon className={styles.icon} width={20} height={20} />\n <input\n ref={ref}\n {...props}\n id={id}\n name={name}\n type=\"search\"\n placeholder={placeholder}\n onChange={onChange}\n className={styles.input}\n />\n </Label>\n </Field>\n );\n});\n"],"names":["forwardRef","Search","classnames","styles","useId","jsx","Field","Label"],"mappings":";;;;;;;;;AAiCO,MAAM,SAASA,MAAAA,WAA0C,SAASC,QACvE;AAAA,EACE;AAAA,EACA;AAAA;AAAA,EAEA,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAWC,sBAAO,QAAQ,SAAS;AACnD,QAAM,KAAKC,MAAAA,MAAA;AACX,SACEC,2BAAAA,IAACC,MAAAA,OAAA,EAAM,MAAY,SAAO,MACxB,0CAACC,MAAAA,OAAA,EAAM,WAAW,SAAS,SAAS,IAClC,UAAA;AAAA,IAAAF,+BAAC,cAAW,WAAWF,cAAAA,QAAO,MAAM,OAAO,IAAI,QAAQ,IAAI;AAAA,IAC3DE,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,WAAWF,cAAAA,QAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACpB,EAAA,CACF,EAAA,CACF;AAEJ,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/components/Search/Search.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAqB,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,KAAK,EAAS,MAAM,SAAS,CAAC;AAIvC,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;CAClD,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,MAAM,mGA8BjB,CAAC"}
1
+ {"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/components/Search/Search.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAS,MAAM,SAAS,CAAC;AAIvC,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;CAClD,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,MAAM,mGA8BjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { ComponentProps, forwardRef, useId } from \"react\";\nimport styles from \"./Search.module.css\";\nimport { Field, Label } from \"../Form\";\n\nimport SearchIcon from \"@vector-im/compound-design-tokens/assets/web/icons/search\";\n\ntype SearchProps = {\n /**\n * The CSS class name\n */\n className?: string;\n /**\n * The input placeholder.\n * @default \"Search…\"\n */\n placeholder?: string;\n /**\n * The field name.\n */\n name: React.ComponentProps<typeof Field>[\"name\"];\n} & Omit<ComponentProps<\"input\">, \"id\" | \"type\">;\n\n/**\n * A standalone search component\n */\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n className,\n onChange,\n // TODO: i18n needs to be setup\n placeholder = \"Search…\",\n name,\n ...props\n }: SearchProps,\n ref,\n) {\n const classes = classnames(styles.search, className);\n const id = useId();\n return (\n <Field name={name} asChild>\n <Label className={classes} htmlFor={id}>\n <SearchIcon className={styles.icon} width={20} height={20} />\n <input\n ref={ref}\n {...props}\n id={id}\n name={name}\n type=\"search\"\n placeholder={placeholder}\n onChange={onChange}\n className={styles.input}\n />\n </Label>\n </Field>\n );\n});\n"],"names":["Search","classnames"],"mappings":";;;;;;;AAiCa,MAAA,SAAS,WAA0C,SAASA,QACvE;AAAA,EACE;AAAA,EACA;AAAA;AAAA,EAEA,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAW,OAAO,QAAQ,SAAS;AACnD,QAAM,KAAK,MAAM;AAEf,SAAA,oBAAC,OAAM,EAAA,MAAY,SAAO,MACxB,+BAAC,OAAM,EAAA,WAAW,SAAS,SAAS,IAClC,UAAA;AAAA,IAAA,oBAAC,cAAW,WAAW,OAAO,MAAM,OAAO,IAAI,QAAQ,IAAI;AAAA,IAC3D;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,WAAW,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACpB,EAAA,CACF,EACF,CAAA;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Search.js","sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { type ComponentProps, forwardRef, useId } from \"react\";\nimport styles from \"./Search.module.css\";\nimport { Field, Label } from \"../Form\";\n\nimport SearchIcon from \"@vector-im/compound-design-tokens/assets/web/icons/search\";\n\ntype SearchProps = {\n /**\n * The CSS class name\n */\n className?: string;\n /**\n * The input placeholder.\n * @default \"Search…\"\n */\n placeholder?: string;\n /**\n * The field name.\n */\n name: React.ComponentProps<typeof Field>[\"name\"];\n} & Omit<ComponentProps<\"input\">, \"id\" | \"type\">;\n\n/**\n * A standalone search component\n */\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n className,\n onChange,\n // TODO: i18n needs to be setup\n placeholder = \"Search…\",\n name,\n ...props\n }: SearchProps,\n ref,\n) {\n const classes = classnames(styles.search, className);\n const id = useId();\n return (\n <Field name={name} asChild>\n <Label className={classes} htmlFor={id}>\n <SearchIcon className={styles.icon} width={20} height={20} />\n <input\n ref={ref}\n {...props}\n id={id}\n name={name}\n type=\"search\"\n placeholder={placeholder}\n onChange={onChange}\n className={styles.input}\n />\n </Label>\n </Field>\n );\n});\n"],"names":["Search","classnames"],"mappings":";;;;;;;AAiCO,MAAM,SAAS,WAA0C,SAASA,QACvE;AAAA,EACE;AAAA,EACA;AAAA;AAAA,EAEA,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAW,OAAO,QAAQ,SAAS;AACnD,QAAM,KAAK,MAAA;AACX,SACE,oBAAC,OAAA,EAAM,MAAY,SAAO,MACxB,+BAAC,OAAA,EAAM,WAAW,SAAS,SAAS,IAClC,UAAA;AAAA,IAAA,oBAAC,cAAW,WAAW,OAAO,MAAM,OAAO,IAAI,QAAQ,IAAI;AAAA,IAC3D;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,WAAW,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACpB,EAAA,CACF,EAAA,CACF;AAEJ,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Separator.cjs","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport * as RadixSeparator from \"@radix-ui/react-separator\";\nimport React, {\n ComponentProps,\n PropsWithoutRef,\n Ref,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport styles from \"./Separator.module.css\";\nimport { useMergeRefs } from \"@floating-ui/react\";\n\ntype SeparatorProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The spacing on either side of the separator.\n * @default var(--cpd-space-2x)\n */\n spacing?: string;\n /**\n * The style of separator.\n * @default primary\n */\n kind?: \"primary\" | \"secondary\" | \"section\";\n} & ComponentProps<typeof RadixSeparator.Root>;\n\nconst SPACING_CUSTOM_PROP = \"--cpd-separator-spacing\";\n\n/**\n * A separator component.\n */\nexport const Separator = forwardRef(\n (\n {\n className,\n spacing, // Default provided via global.css\n kind = \"primary\",\n ...props\n }: PropsWithoutRef<SeparatorProps>,\n theirRef?: Ref<HTMLDivElement>,\n ) => {\n const classes = classnames(styles.separator, className);\n const ourRef = useRef<HTMLDivElement | null>(null);\n const ref = useMergeRefs([ourRef, theirRef]);\n\n useEffect(() => {\n const style = ourRef.current?.style;\n if (spacing) {\n style?.setProperty(SPACING_CUSTOM_PROP, spacing);\n } else {\n style?.removeProperty(SPACING_CUSTOM_PROP);\n }\n }, [spacing]);\n\n return (\n <RadixSeparator.Root\n {...props}\n className={classes}\n ref={ref}\n data-kind={kind}\n />\n );\n },\n);\n\nSeparator.displayName = \"Separator\";\n"],"names":["forwardRef","classnames","styles","useRef","useMergeRefs","useEffect","jsx","RadixSeparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,sBAAsB;AAKrB,MAAM,YAAYA,MAAA;AAAA,EACvB,CACE;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,KAEL,aACG;AACH,UAAM,UAAUC,WAAWC,yBAAO,WAAW,SAAS;AAChD,UAAA,SAASC,aAA8B,IAAI;AACjD,UAAM,MAAMC,MAAA,aAAa,CAAC,QAAQ,QAAQ,CAAC;AAE3CC,UAAAA,UAAU,MAAM;AACR,YAAA,QAAQ,OAAO,SAAS;AAC9B,UAAI,SAAS;AACJ,eAAA,YAAY,qBAAqB,OAAO;AAAA,MAAA,OAC1C;AACL,eAAO,eAAe,mBAAmB;AAAA,MAAA;AAAA,IAC3C,GACC,CAAC,OAAO,CAAC;AAGV,WAAAC,2BAAA;AAAA,MAACC,0BAAe;AAAA,MAAf;AAAA,QACE,GAAG;AAAA,QACJ,WAAW;AAAA,QACX;AAAA,QACA,aAAW;AAAA,MAAA;AAAA,IACb;AAAA,EAAA;AAGN;AAEA,UAAU,cAAc;;"}
1
+ {"version":3,"file":"Separator.cjs","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport * as RadixSeparator from \"@radix-ui/react-separator\";\nimport React, {\n type ComponentProps,\n type PropsWithoutRef,\n type Ref,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport styles from \"./Separator.module.css\";\nimport { useMergeRefs } from \"@floating-ui/react\";\n\ntype SeparatorProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The spacing on either side of the separator.\n * @default var(--cpd-space-2x)\n */\n spacing?: string;\n /**\n * The style of separator.\n * @default primary\n */\n kind?: \"primary\" | \"secondary\" | \"section\";\n} & ComponentProps<typeof RadixSeparator.Root>;\n\nconst SPACING_CUSTOM_PROP = \"--cpd-separator-spacing\";\n\n/**\n * A separator component.\n */\nexport const Separator = forwardRef(\n (\n {\n className,\n spacing, // Default provided via global.css\n kind = \"primary\",\n ...props\n }: PropsWithoutRef<SeparatorProps>,\n theirRef?: Ref<HTMLDivElement>,\n ) => {\n const classes = classnames(styles.separator, className);\n const ourRef = useRef<HTMLDivElement | null>(null);\n const ref = useMergeRefs([ourRef, theirRef]);\n\n useEffect(() => {\n const style = ourRef.current?.style;\n if (spacing) {\n style?.setProperty(SPACING_CUSTOM_PROP, spacing);\n } else {\n style?.removeProperty(SPACING_CUSTOM_PROP);\n }\n }, [spacing]);\n\n return (\n <RadixSeparator.Root\n {...props}\n className={classes}\n ref={ref}\n data-kind={kind}\n />\n );\n },\n);\n\nSeparator.displayName = \"Separator\";\n"],"names":["forwardRef","classnames","styles","useRef","useMergeRefs","useEffect","jsx","RadixSeparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,sBAAsB;AAKrB,MAAM,YAAYA,MAAAA;AAAAA,EACvB,CACE;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,EAAA,GAEL,aACG;AACH,UAAM,UAAUC,WAAWC,yBAAO,WAAW,SAAS;AACtD,UAAM,SAASC,MAAAA,OAA8B,IAAI;AACjD,UAAM,MAAMC,MAAAA,aAAa,CAAC,QAAQ,QAAQ,CAAC;AAE3CC,UAAAA,UAAU,MAAM;AACd,YAAM,QAAQ,OAAO,SAAS;AAC9B,UAAI,SAAS;AACX,eAAO,YAAY,qBAAqB,OAAO;AAAA,MACjD,OAAO;AACL,eAAO,eAAe,mBAAmB;AAAA,MAC3C;AAAA,IACF,GAAG,CAAC,OAAO,CAAC;AAEZ,WACEC,2BAAAA;AAAAA,MAACC,0BAAe;AAAA,MAAf;AAAA,QACE,GAAG;AAAA,QACJ,WAAW;AAAA,QACX;AAAA,QACA,aAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AACF;AAEA,UAAU,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/components/Separator/Separator.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,EACZ,cAAc,EAMf,MAAM,OAAO,CAAC;AAIf,KAAK,cAAc,GAAG;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;CAC5C,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAI/C;;GAEG;AACH,eAAO,MAAM,SAAS,oGAgCrB,CAAC"}
1
+ {"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/components/Separator/Separator.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,EACZ,KAAK,cAAc,EAMpB,MAAM,OAAO,CAAC;AAIf,KAAK,cAAc,GAAG;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;CAC5C,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAI/C;;GAEG;AACH,eAAO,MAAM,SAAS,oGAgCrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Separator.js","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport * as RadixSeparator from \"@radix-ui/react-separator\";\nimport React, {\n ComponentProps,\n PropsWithoutRef,\n Ref,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport styles from \"./Separator.module.css\";\nimport { useMergeRefs } from \"@floating-ui/react\";\n\ntype SeparatorProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The spacing on either side of the separator.\n * @default var(--cpd-space-2x)\n */\n spacing?: string;\n /**\n * The style of separator.\n * @default primary\n */\n kind?: \"primary\" | \"secondary\" | \"section\";\n} & ComponentProps<typeof RadixSeparator.Root>;\n\nconst SPACING_CUSTOM_PROP = \"--cpd-separator-spacing\";\n\n/**\n * A separator component.\n */\nexport const Separator = forwardRef(\n (\n {\n className,\n spacing, // Default provided via global.css\n kind = \"primary\",\n ...props\n }: PropsWithoutRef<SeparatorProps>,\n theirRef?: Ref<HTMLDivElement>,\n ) => {\n const classes = classnames(styles.separator, className);\n const ourRef = useRef<HTMLDivElement | null>(null);\n const ref = useMergeRefs([ourRef, theirRef]);\n\n useEffect(() => {\n const style = ourRef.current?.style;\n if (spacing) {\n style?.setProperty(SPACING_CUSTOM_PROP, spacing);\n } else {\n style?.removeProperty(SPACING_CUSTOM_PROP);\n }\n }, [spacing]);\n\n return (\n <RadixSeparator.Root\n {...props}\n className={classes}\n ref={ref}\n data-kind={kind}\n />\n );\n },\n);\n\nSeparator.displayName = \"Separator\";\n"],"names":["classnames"],"mappings":";;;;;;AAqCA,MAAM,sBAAsB;AAKrB,MAAM,YAAY;AAAA,EACvB,CACE;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,KAEL,aACG;AACH,UAAM,UAAUA,WAAW,OAAO,WAAW,SAAS;AAChD,UAAA,SAAS,OAA8B,IAAI;AACjD,UAAM,MAAM,aAAa,CAAC,QAAQ,QAAQ,CAAC;AAE3C,cAAU,MAAM;AACR,YAAA,QAAQ,OAAO,SAAS;AAC9B,UAAI,SAAS;AACJ,eAAA,YAAY,qBAAqB,OAAO;AAAA,MAAA,OAC1C;AACL,eAAO,eAAe,mBAAmB;AAAA,MAAA;AAAA,IAC3C,GACC,CAAC,OAAO,CAAC;AAGV,WAAA;AAAA,MAAC,eAAe;AAAA,MAAf;AAAA,QACE,GAAG;AAAA,QACJ,WAAW;AAAA,QACX;AAAA,QACA,aAAW;AAAA,MAAA;AAAA,IACb;AAAA,EAAA;AAGN;AAEA,UAAU,cAAc;"}
1
+ {"version":3,"file":"Separator.js","sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport * as RadixSeparator from \"@radix-ui/react-separator\";\nimport React, {\n type ComponentProps,\n type PropsWithoutRef,\n type Ref,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport styles from \"./Separator.module.css\";\nimport { useMergeRefs } from \"@floating-ui/react\";\n\ntype SeparatorProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The spacing on either side of the separator.\n * @default var(--cpd-space-2x)\n */\n spacing?: string;\n /**\n * The style of separator.\n * @default primary\n */\n kind?: \"primary\" | \"secondary\" | \"section\";\n} & ComponentProps<typeof RadixSeparator.Root>;\n\nconst SPACING_CUSTOM_PROP = \"--cpd-separator-spacing\";\n\n/**\n * A separator component.\n */\nexport const Separator = forwardRef(\n (\n {\n className,\n spacing, // Default provided via global.css\n kind = \"primary\",\n ...props\n }: PropsWithoutRef<SeparatorProps>,\n theirRef?: Ref<HTMLDivElement>,\n ) => {\n const classes = classnames(styles.separator, className);\n const ourRef = useRef<HTMLDivElement | null>(null);\n const ref = useMergeRefs([ourRef, theirRef]);\n\n useEffect(() => {\n const style = ourRef.current?.style;\n if (spacing) {\n style?.setProperty(SPACING_CUSTOM_PROP, spacing);\n } else {\n style?.removeProperty(SPACING_CUSTOM_PROP);\n }\n }, [spacing]);\n\n return (\n <RadixSeparator.Root\n {...props}\n className={classes}\n ref={ref}\n data-kind={kind}\n />\n );\n },\n);\n\nSeparator.displayName = \"Separator\";\n"],"names":["classnames"],"mappings":";;;;;;AAqCA,MAAM,sBAAsB;AAKrB,MAAM,YAAY;AAAA,EACvB,CACE;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,EAAA,GAEL,aACG;AACH,UAAM,UAAUA,WAAW,OAAO,WAAW,SAAS;AACtD,UAAM,SAAS,OAA8B,IAAI;AACjD,UAAM,MAAM,aAAa,CAAC,QAAQ,QAAQ,CAAC;AAE3C,cAAU,MAAM;AACd,YAAM,QAAQ,OAAO,SAAS;AAC9B,UAAI,SAAS;AACX,eAAO,YAAY,qBAAqB,OAAO;AAAA,MACjD,OAAO;AACL,eAAO,eAAe,mBAAmB;AAAA,MAC3C;AAAA,IACF,GAAG,CAAC,OAAO,CAAC;AAEZ,WACE;AAAA,MAAC,eAAe;AAAA,MAAf;AAAA,QACE,GAAG;AAAA,QACJ,WAAW;AAAA,QACX;AAAA,QACA,aAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AACF;AAEA,UAAU,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { forwardRef, PropsWithChildren } from \"react\";\nimport styles from \"./Toast.module.css\";\n\ntype ToastProps = {\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { children, className, ...props }: PropsWithChildren<ToastProps>,\n ref,\n) {\n const classes = classnames(styles[\"toast-container\"], className);\n return (\n <div {...props} className={classes} ref={ref}>\n {children}\n </div>\n );\n});\n"],"names":["forwardRef","Toast","classnames","styles"],"mappings":";;;;;;AAea,MAAA,QAAQA,MAAAA,WAAuC,SAASC,OACnE,EAAE,UAAU,WAAW,GAAG,MAAM,GAChC,KACA;AACA,QAAM,UAAUC,WAAWC,aAAO,QAAA,iBAAiB,GAAG,SAAS;AAC/D,wCACG,OAAK,EAAA,GAAG,OAAO,WAAW,SAAS,KACjC,UACH;AAEJ,CAAC;;"}
1
+ {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { forwardRef, type PropsWithChildren } from \"react\";\nimport styles from \"./Toast.module.css\";\n\ntype ToastProps = {\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { children, className, ...props }: PropsWithChildren<ToastProps>,\n ref,\n) {\n const classes = classnames(styles[\"toast-container\"], className);\n return (\n <div {...props} className={classes} ref={ref}>\n {children}\n </div>\n );\n});\n"],"names":["forwardRef","Toast","classnames","styles"],"mappings":";;;;;;AAeO,MAAM,QAAQA,MAAAA,WAAuC,SAASC,OACnE,EAAE,UAAU,WAAW,GAAG,MAAA,GAC1B,KACA;AACA,QAAM,UAAUC,WAAWC,aAAAA,QAAO,iBAAiB,GAAG,SAAS;AAC/D,wCACG,OAAA,EAAK,GAAG,OAAO,WAAW,SAAS,KACjC,UACH;AAEJ,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAO7D,eAAO,MAAM,KAAK;gBAHJ,MAAM;+EAalB,CAAC"}
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAOlE,eAAO,MAAM,KAAK;gBAHJ,MAAM;+EAalB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { forwardRef, PropsWithChildren } from \"react\";\nimport styles from \"./Toast.module.css\";\n\ntype ToastProps = {\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { children, className, ...props }: PropsWithChildren<ToastProps>,\n ref,\n) {\n const classes = classnames(styles[\"toast-container\"], className);\n return (\n <div {...props} className={classes} ref={ref}>\n {children}\n </div>\n );\n});\n"],"names":["Toast","classnames"],"mappings":";;;;AAea,MAAA,QAAQ,WAAuC,SAASA,OACnE,EAAE,UAAU,WAAW,GAAG,MAAM,GAChC,KACA;AACA,QAAM,UAAUC,WAAW,OAAO,iBAAiB,GAAG,SAAS;AAC/D,6BACG,OAAK,EAAA,GAAG,OAAO,WAAW,SAAS,KACjC,UACH;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { forwardRef, type PropsWithChildren } from \"react\";\nimport styles from \"./Toast.module.css\";\n\ntype ToastProps = {\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { children, className, ...props }: PropsWithChildren<ToastProps>,\n ref,\n) {\n const classes = classnames(styles[\"toast-container\"], className);\n return (\n <div {...props} className={classes} ref={ref}>\n {children}\n </div>\n );\n});\n"],"names":["Toast","classnames"],"mappings":";;;;AAeO,MAAM,QAAQ,WAAuC,SAASA,OACnE,EAAE,UAAU,WAAW,GAAG,MAAA,GAC1B,KACA;AACA,QAAM,UAAUC,WAAW,OAAO,iBAAiB,GAAG,SAAS;AAC/D,6BACG,OAAA,EAAK,GAAG,OAAO,WAAW,SAAS,KACjC,UACH;AAEJ,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":["useTooltip","jsxs","TooltipContext","jsx","useTooltipContext","styles","FloatingPortal","FloatingArrow","useMergeRefs","useMemo","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAUA,WAAW,WAAA,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACGC,2BAAAA,KAAAC,eAAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,oCACC,gBACC,EAAA,UAAA;AAAA,MAACA,2BAAAA,IAAA,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YACzC,CAAA;AAAA,qCACC,SAAQ,CAAA,CAAA;AAAA,IAAA,EACX,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAU,IAAIC,iCAAkB;AAC7C,MAAA,CAAC,QAAgB,QAAA;AAEf,QAAA,kBAAkB,OAAO,YAAY;AACrC,QAAA,YAAY,kBAAkB,SAAS;AAS3C,SAAAD,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,MACJ,WAAW,WAAWE,uBAAO,SAAS,gBAAgB;AAAA,MAErD,UAAA;AAAA,IAAA;AAAA,EACH;AAEJ;AAMA,SAAS,eAAe;AAAA,EACtB;AACF,GAAoD;AAC5C,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,MACDD,iCAAkB;AA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AA,QACpB,GAAG;AAAA,MAAA,IACD;AACJ,4CACG,QAAK,EAAA,UAAU,+BAAgC,GAAG,WAChD,6BAAa,UAAmD;AAAA,QAC/D,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,MACrB,CAAA,GACH;AAAA,IAAA;AAAA,EAGH,GAAA,CAAC,SAAS,KAAK,QAAQ,CAAC;AAE3B,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,qDAAqD;AAAA,EAAA;AAGhE,SAAA;AACT;;"}
1
+ {"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n type PropsWithChildren,\n type Ref,\n type JSX,\n isValidElement,\n cloneElement,\n useMemo,\n type ReactNode,\n type FC,\n type ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n type CommonUseTooltipProps,\n type TooltipDescription,\n type TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":["useTooltip","jsxs","TooltipContext","jsx","useTooltipContext","styles","FloatingPortal","FloatingArrow","useMergeRefs","useMemo","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB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AS;AACZ,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAEA,SAAO;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAaA,OAAc,EACZ,iBAAiB,EAEjB,GAAG,EAOJ,MAAM,OAAO,CAAC;AAIf,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EAEb,MAAM,cAAc,CAAC;AAItB,KAAK,YAAY,GAAG,IAAI,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,GACrE,CAAC,YAAY,GAAG,kBAAkB,CAAC,GAAG;IACpC;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;CACxC,CAAC;AAMJ;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,oBAA2B,EAC3B,6BAAiC,EACjC,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,OAAO,CAmB/C"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAaA,OAAc,EACZ,KAAK,iBAAiB,EAEtB,KAAK,GAAG,EAOT,MAAM,OAAO,CAAC;AAIf,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AAItB,KAAK,YAAY,GAAG,IAAI,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,GACrE,CAAC,YAAY,GAAG,kBAAkB,CAAC,GAAG;IACpC;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;CACxC,CAAC;AAMJ;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,oBAA2B,EAC3B,6BAAiC,EACjC,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,OAAO,CAmB/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAU,WAAW,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACG,qBAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,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A,EAC7C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,UAAU,kBAAkB;AAIlC,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAE3D,QAAA,UAAU,QAAQ,MAAM;AACxB,QAAA,CAAC,eAAe,QAAQ,EAAG;AAE/B,QAAI,sBAAsB;AAClB,YAAA,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;AAAA,QAGtC,GAAI,OAAO,SAAS,UAAU,WAAW,SAAS,QAAQ,CAAC;AAAA,QAC3D;AAAA,MAAA,CACD;AACM,aAAA,aAAa,UAAU,KAAK;AAAA,IAAA,OAC9B;AAKC,YAAA,QAAQ,QAAQ,kBAAkB;AAAA,QACtC;AAAA,QACA,UAAU;AAAA,MAAA,CACX;AACK,YAAA;AAAA,QACJ,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,GAAG;AAAA,MAAA,IACD;AACJ,iCACG,QAAK,EAAA,UAAU,+BAAgC,GAAG,WAChD,uBAAa,UAAmD;AAAA,QAC/D,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,MACrB,CAAA,GACH;AAAA,IAAA;AAAA,EAGH,GAAA,CAAC,SAAS,KAAK,QAAQ,CAAC;AAE3B,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,qDAAqD;AAAA,EAAA;AAGhE,SAAA;AACT;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n type PropsWithChildren,\n type Ref,\n type JSX,\n isValidElement,\n cloneElement,\n useMemo,\n type ReactNode,\n type FC,\n type ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n type CommonUseTooltipProps,\n type TooltipDescription,\n type TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAU,WAAW,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACE,qBAAC,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IAAA;AAAA,yBAEF,gBAAA,EACC,UAAA;AAAA,MAAA,oBAAC,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YAAA,CACzC;AAAA,0BACC,SAAA,CAAA,CAAQ;AAAA,IAAA,EAAA,CACX;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAA,IAAc,kBAAA;AAC/B,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,kBAAkB,OAAO,YAAY;AAC3C,QAAM,YAAY,kBAAkB,SAAS;AAQ7C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,MACJ,WAAW,WAAW,OAAO,SAAS,gBAAgB;AAAA,MAErD,UAAA;AAAA,IAAA;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AU;AAAA,MAAA,CACX;AACD,YAAM;AAAA,QACJ,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,GAAG;AAAA,MAAA,IACD;AACJ,iCACG,QAAA,EAAK,UAAU,+BAAgC,GAAG,WAChD,uBAAa,UAAmD;AAAA,QAC/D,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,MAAA,CACrB,GACH;AAAA,IAEJ;AAAA,EACF,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC;AAE3B,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAEA,SAAO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContext.cjs","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"sourcesContent":["/*\n * Copyright 2024 New Vector Ltd.\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n/**\n * The context for the Tooltip components.\n */\nexport const TooltipContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the Tooltip components.\n */\nexport function useTooltipContext() {\n const context = useContext(TooltipContext);\n\n if (context == null) {\n throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n }\n\n return context;\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAca,MAAA,iBAAiBA,oBAA2B,IAAI;AAKtD,SAAS,oBAAoB;AAC5B,QAAA,UAAUC,iBAAW,cAAc;AAEzC,MAAI,WAAW,MAAM;AACb,UAAA,IAAI,MAAM,mDAAmD;AAAA,EAAA;AAG9D,SAAA;AACT;;;"}
1
+ {"version":3,"file":"TooltipContext.cjs","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"sourcesContent":["/*\n * Copyright 2024 New Vector Ltd.\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n/**\n * The context for the Tooltip components.\n */\nexport const TooltipContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the Tooltip components.\n */\nexport function useTooltipContext() {\n const context = useContext(TooltipContext);\n\n if (context == null) {\n throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n }\n\n return context;\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAcO,MAAM,iBAAiBA,MAAAA,cAA2B,IAAI;AAKtD,SAAS,oBAAoB;AAClC,QAAM,UAAUC,MAAAA,WAAW,cAAc;AAEzC,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AAEA,SAAO;AACT;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContext.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;AACxD;;GAEG;AACH,eAAO,MAAM,cAAc,sCAAmC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,iBAAiB;;;;;;;;;oBASsjQ,MAAO,aAAa;;;kBAAiV,MAAO,gBAAgB;;;;;;;;;;;;;;;;wBAA5X,MAAO,aAAa;;;;iBAA2rB,MAAO,gBAAgB;;;;;;iCAA07yB,CAAC,EAAC,MAAO,SAAS;gCAAwE,CAAC,EAAC,MAAO,SAAS;4BAAwE,CAAC,OAAO,MAAM,SAAS;;;;;;;;;;;;;;EADj8kC"}
1
+ {"version":3,"file":"TooltipContext.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;AACxD;;GAEG;AACH,eAAO,MAAM,cAAc,sCAAmC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAS4qnC,CAAC;gCAAyF,CAAC;4BAAyF,CAAC;;;;;;;;;;;;;;EADj4nC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContext.js","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"sourcesContent":["/*\n * Copyright 2024 New Vector Ltd.\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n/**\n * The context for the Tooltip components.\n */\nexport const TooltipContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the Tooltip components.\n */\nexport function useTooltipContext() {\n const context = useContext(TooltipContext);\n\n if (context == null) {\n throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n }\n\n return context;\n}\n"],"names":[],"mappings":";AAca,MAAA,iBAAiB,cAA2B,IAAI;AAKtD,SAAS,oBAAoB;AAC5B,QAAA,UAAU,WAAW,cAAc;AAEzC,MAAI,WAAW,MAAM;AACb,UAAA,IAAI,MAAM,mDAAmD;AAAA,EAAA;AAG9D,SAAA;AACT;"}
1
+ {"version":3,"file":"TooltipContext.js","sources":["../../../src/components/Tooltip/TooltipContext.ts"],"sourcesContent":["/*\n * Copyright 2024 New Vector Ltd.\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n/**\n * The context for the Tooltip components.\n */\nexport const TooltipContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the Tooltip components.\n */\nexport function useTooltipContext() {\n const context = useContext(TooltipContext);\n\n if (context == null) {\n throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n }\n\n return context;\n}\n"],"names":[],"mappings":";AAcO,MAAM,iBAAiB,cAA2B,IAAI;AAKtD,SAAS,oBAAoB;AAClC,QAAM,UAAU,WAAW,cAAc;AAEzC,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AAEA,SAAO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipProvider.cjs","sources":["../../../src/components/Tooltip/TooltipProvider.tsx"],"sourcesContent":["import { FloatingDelayGroup } from \"@floating-ui/react\";\nimport React, { FC } from \"react\";\n\nexport const hoverDelay = { open: 300, close: 0 };\n\ninterface Props {\n children: React.ReactNode;\n}\n\n/**\n * Enables tooltips to share a global \"warm-up\" period for their hover delay.\n * You must wrap your application in this component for tooltips to function.\n */\nexport const TooltipProvider: FC<Props> = ({ children }) => (\n <FloatingDelayGroup delay={hoverDelay} timeoutMs={300}>\n {children}\n </FloatingDelayGroup>\n);\n\nTooltipProvider.displayName = \"TooltipProvider\";\n"],"names":["jsx","FloatingDelayGroup"],"mappings":";;;;AAGO,MAAM,aAAa,EAAE,MAAM,KAAK,OAAO,EAAE;AAUnC,MAAA,kBAA6B,CAAC,EAAE,SAAS,MACnDA,+BAAAC,MAAAA,oBAAA,EAAmB,OAAO,YAAY,WAAW,KAC/C,SACH,CAAA;AAGF,gBAAgB,cAAc;;;"}
1
+ {"version":3,"file":"TooltipProvider.cjs","sources":["../../../src/components/Tooltip/TooltipProvider.tsx"],"sourcesContent":["import { FloatingDelayGroup } from \"@floating-ui/react\";\nimport React, { type FC } from \"react\";\n\nexport const hoverDelay = { open: 300, close: 0 };\n\ninterface Props {\n children: React.ReactNode;\n}\n\n/**\n * Enables tooltips to share a global \"warm-up\" period for their hover delay.\n * You must wrap your application in this component for tooltips to function.\n */\nexport const TooltipProvider: FC<Props> = ({ children }) => (\n <FloatingDelayGroup delay={hoverDelay} timeoutMs={300}>\n {children}\n </FloatingDelayGroup>\n);\n\nTooltipProvider.displayName = \"TooltipProvider\";\n"],"names":["jsx","FloatingDelayGroup"],"mappings":";;;;AAGO,MAAM,aAAa,EAAE,MAAM,KAAK,OAAO,EAAA;AAUvC,MAAM,kBAA6B,CAAC,EAAE,SAAA,MAC3CA,+BAACC,MAAAA,oBAAA,EAAmB,OAAO,YAAY,WAAW,KAC/C,SAAA,CACH;AAGF,gBAAgB,cAAc;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,eAAO,MAAM,UAAU;;;CAA0B,CAAC;AAElD,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CAIrC,CAAC"}
1
+ {"version":3,"file":"TooltipProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEvC,eAAO,MAAM,UAAU;;;CAA0B,CAAC;AAElD,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CAIrC,CAAC"}