@simplybusiness/mobius 4.3.1 → 4.3.3

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/CHANGELOG.md +15 -0
  2. package/dist/cjs/components/Drawer/Drawer.js +8 -1
  3. package/dist/cjs/components/Drawer/Drawer.js.map +1 -1
  4. package/dist/cjs/components/Icon/Icon.js +0 -2
  5. package/dist/cjs/components/Icon/Icon.js.map +1 -1
  6. package/dist/cjs/components/Modal/Modal.js +8 -1
  7. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  8. package/dist/esm/components/Drawer/Drawer.js +8 -1
  9. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  10. package/dist/esm/components/Icon/Icon.js +0 -2
  11. package/dist/esm/components/Icon/Icon.js.map +1 -1
  12. package/dist/esm/components/Modal/Modal.js +8 -1
  13. package/dist/esm/components/Modal/Modal.js.map +1 -1
  14. package/dist/types/components/Accordion/Accordion.d.ts +34 -0
  15. package/dist/types/components/Accordion/Accordion.stories.d.ts +10 -0
  16. package/dist/types/components/Accordion/Accordion.test.d.ts +1 -0
  17. package/dist/types/components/Accordion/index.d.ts +1 -0
  18. package/dist/types/components/Alert/Alert.d.ts +16 -0
  19. package/dist/types/components/Alert/Alert.stories.d.ts +7 -0
  20. package/dist/types/components/Alert/Alert.test.d.ts +1 -0
  21. package/dist/types/components/Alert/index.d.ts +1 -0
  22. package/dist/types/components/Box/Box.d.ts +15 -0
  23. package/dist/types/components/Box/Box.stories.d.ts +7 -0
  24. package/dist/types/components/Box/Box.test.d.ts +1 -0
  25. package/dist/types/components/Box/index.d.ts +1 -0
  26. package/dist/types/components/Breadcrumbs/BreadcrumbItem.d.ts +15 -0
  27. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +12 -0
  28. package/dist/types/components/Breadcrumbs/Breadcrumbs.stories.d.ts +7 -0
  29. package/dist/types/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  30. package/dist/types/components/Breadcrumbs/index.d.ts +2 -0
  31. package/dist/types/components/Button/Button.d.ts +31 -0
  32. package/dist/types/components/Button/Button.stories.d.ts +19 -0
  33. package/dist/types/components/Button/Button.test.d.ts +1 -0
  34. package/dist/types/components/Button/Loading.d.ts +2 -0
  35. package/dist/types/components/Button/index.d.ts +1 -0
  36. package/dist/types/components/Checkbox/Checkbox.d.ts +3 -0
  37. package/dist/types/components/Checkbox/Checkbox.stories.d.ts +10 -0
  38. package/dist/types/components/Checkbox/Checkbox.test.d.ts +1 -0
  39. package/dist/types/components/Checkbox/CheckboxGroup.d.ts +3 -0
  40. package/dist/types/components/Checkbox/CheckboxGroup.stories.d.ts +9 -0
  41. package/dist/types/components/Checkbox/CheckboxGroup.test.d.ts +1 -0
  42. package/dist/types/components/Checkbox/index.d.ts +3 -0
  43. package/dist/types/components/Checkbox/types.d.ts +56 -0
  44. package/dist/types/components/Container/Container.d.ts +15 -0
  45. package/dist/types/components/Container/Container.stories.d.ts +6 -0
  46. package/dist/types/components/Container/Container.test.d.ts +1 -0
  47. package/dist/types/components/Container/index.d.ts +1 -0
  48. package/dist/types/components/Divider/Divider.d.ts +11 -0
  49. package/dist/types/components/Divider/Divider.stories.d.ts +6 -0
  50. package/dist/types/components/Divider/Divider.test.d.ts +1 -0
  51. package/dist/types/components/Divider/index.d.ts +1 -0
  52. package/dist/types/components/Drawer/Content.d.ts +10 -0
  53. package/dist/types/components/Drawer/Drawer.d.ts +6 -0
  54. package/dist/types/components/Drawer/Drawer.stories.d.ts +8 -0
  55. package/dist/types/components/Drawer/Drawer.test.d.ts +1 -0
  56. package/dist/types/components/Drawer/Header.d.ts +10 -0
  57. package/dist/types/components/Drawer/index.d.ts +9 -0
  58. package/dist/types/components/Drawer/types.d.ts +17 -0
  59. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +15 -0
  60. package/dist/types/components/DropdownMenu/DropdownMenu.stories.d.ts +7 -0
  61. package/dist/types/components/DropdownMenu/DropdownMenu.test.d.ts +1 -0
  62. package/dist/types/components/DropdownMenu/Item.d.ts +15 -0
  63. package/dist/types/components/DropdownMenu/index.d.ts +10 -0
  64. package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +9 -0
  65. package/dist/types/components/ErrorMessage/ErrorMessage.stories.d.ts +7 -0
  66. package/dist/types/components/ErrorMessage/ErrorMessage.test.d.ts +1 -0
  67. package/dist/types/components/ErrorMessage/index.d.ts +1 -0
  68. package/dist/types/components/Fieldset/Fieldset.d.ts +17 -0
  69. package/dist/types/components/Fieldset/Fieldset.stories.d.ts +7 -0
  70. package/dist/types/components/Fieldset/Fieldset.test.d.ts +1 -0
  71. package/dist/types/components/Fieldset/index.d.ts +1 -0
  72. package/dist/types/components/Flex/Flex.d.ts +4 -0
  73. package/dist/types/components/Flex/Flex.stories.d.ts +7 -0
  74. package/dist/types/components/Flex/Flex.test.d.ts +1 -0
  75. package/dist/types/components/Flex/index.d.ts +2 -0
  76. package/dist/types/components/Flex/propUtils.d.ts +8 -0
  77. package/dist/types/components/Flex/propUtils.test.d.ts +1 -0
  78. package/dist/types/components/Flex/types.d.ts +33 -0
  79. package/dist/types/components/Grid/Grid.d.ts +28 -0
  80. package/dist/types/components/Grid/Grid.stories.d.ts +11 -0
  81. package/dist/types/components/Grid/Grid.test.d.ts +1 -0
  82. package/dist/types/components/Grid/Item.d.ts +30 -0
  83. package/dist/types/components/Grid/index.d.ts +9 -0
  84. package/dist/types/components/Icon/Icon.d.ts +2 -0
  85. package/dist/types/components/Icon/Icon.stories.d.ts +7 -0
  86. package/dist/types/components/Icon/Icon.test.d.ts +1 -0
  87. package/dist/types/components/Icon/IconStyle.d.ts +1 -0
  88. package/dist/types/components/Icon/index.d.ts +2 -0
  89. package/dist/types/components/Icon/types.d.ts +13 -0
  90. package/dist/types/components/Image/Image.d.ts +17 -0
  91. package/dist/types/components/Image/Image.stories.d.ts +6 -0
  92. package/dist/types/components/Image/Image.test.d.ts +1 -0
  93. package/dist/types/components/Image/index.d.ts +1 -0
  94. package/dist/types/components/Label/Label.d.ts +13 -0
  95. package/dist/types/components/Label/Label.stories.d.ts +6 -0
  96. package/dist/types/components/Label/Label.test.d.ts +1 -0
  97. package/dist/types/components/Label/index.d.ts +1 -0
  98. package/dist/types/components/Link/Link.d.ts +24 -0
  99. package/dist/types/components/Link/Link.stories.d.ts +7 -0
  100. package/dist/types/components/Link/Link.test.d.ts +1 -0
  101. package/dist/types/components/Link/index.d.ts +1 -0
  102. package/dist/types/components/LinkButton/LinkButton.d.ts +15 -0
  103. package/dist/types/components/LinkButton/LinkButton.stories.d.ts +6 -0
  104. package/dist/types/components/LinkButton/LinkButton.test.d.ts +1 -0
  105. package/dist/types/components/LinkButton/index.d.ts +1 -0
  106. package/dist/types/components/List/List.d.ts +17 -0
  107. package/dist/types/components/List/List.stories.d.ts +10 -0
  108. package/dist/types/components/List/List.test.d.ts +1 -0
  109. package/dist/types/components/List/ListItem.d.ts +14 -0
  110. package/dist/types/components/List/index.d.ts +2 -0
  111. package/dist/types/components/LoadingIndicator/LoadingIndicator.d.ts +8 -0
  112. package/dist/types/components/LoadingIndicator/LoadingIndicator.stories.d.ts +9 -0
  113. package/dist/types/components/LoadingIndicator/LoadingIndicator.test.d.ts +1 -0
  114. package/dist/types/components/LoadingIndicator/index.d.ts +1 -0
  115. package/dist/types/components/Logo/Logo.d.ts +14 -0
  116. package/dist/types/components/Logo/Logo.stories.d.ts +6 -0
  117. package/dist/types/components/Logo/Logo.test.d.ts +1 -0
  118. package/dist/types/components/Logo/index.d.ts +1 -0
  119. package/dist/types/components/Modal/Content.d.ts +10 -0
  120. package/dist/types/components/Modal/Header.d.ts +10 -0
  121. package/dist/types/components/Modal/Modal.d.ts +6 -0
  122. package/dist/types/components/Modal/Modal.stories.d.ts +10 -0
  123. package/dist/types/components/Modal/Modal.test.d.ts +1 -0
  124. package/dist/types/components/Modal/index.d.ts +9 -0
  125. package/dist/types/components/Modal/types.d.ts +31 -0
  126. package/dist/types/components/NumberField/NumberField.d.ts +35 -0
  127. package/dist/types/components/NumberField/NumberField.stories.d.ts +10 -0
  128. package/dist/types/components/NumberField/NumberField.test.d.ts +1 -0
  129. package/dist/types/components/NumberField/index.d.ts +1 -0
  130. package/dist/types/components/Option/Option.d.ts +10 -0
  131. package/dist/types/components/Option/index.d.ts +1 -0
  132. package/dist/types/components/PasswordField/PasswordField.d.ts +5 -0
  133. package/dist/types/components/PasswordField/PasswordField.stories.d.ts +6 -0
  134. package/dist/types/components/PasswordField/PasswordField.test.d.ts +1 -0
  135. package/dist/types/components/PasswordField/ShowHideButton.d.ts +5 -0
  136. package/dist/types/components/PasswordField/index.d.ts +1 -0
  137. package/dist/types/components/Popover/Popover.d.ts +15 -0
  138. package/dist/types/components/Popover/Popover.stories.d.ts +7 -0
  139. package/dist/types/components/Popover/Popover.test.d.ts +1 -0
  140. package/dist/types/components/Popover/index.d.ts +1 -0
  141. package/dist/types/components/Progress/Progress.d.ts +20 -0
  142. package/dist/types/components/Progress/Progress.stories.d.ts +9 -0
  143. package/dist/types/components/Progress/Progress.test.d.ts +1 -0
  144. package/dist/types/components/Progress/index.d.ts +1 -0
  145. package/dist/types/components/Radio/Radio.d.ts +53 -0
  146. package/dist/types/components/Radio/Radio.stories.d.ts +12 -0
  147. package/dist/types/components/Radio/Radio.test.d.ts +1 -0
  148. package/dist/types/components/Radio/RadioButton.d.ts +3 -0
  149. package/dist/types/components/Radio/RadioButton.stories.d.ts +11 -0
  150. package/dist/types/components/Radio/RadioButton.test.d.ts +1 -0
  151. package/dist/types/components/Radio/RadioGroup.d.ts +30 -0
  152. package/dist/types/components/Radio/index.d.ts +3 -0
  153. package/dist/types/components/SVG/SVG.d.ts +11 -0
  154. package/dist/types/components/SVG/SVG.stories.d.ts +6 -0
  155. package/dist/types/components/SVG/SVG.test.d.ts +1 -0
  156. package/dist/types/components/SVG/index.d.ts +1 -0
  157. package/dist/types/components/Segment/Segment.d.ts +16 -0
  158. package/dist/types/components/Segment/Segment.stories.d.ts +19 -0
  159. package/dist/types/components/Segment/SegmentGroup.d.ts +13 -0
  160. package/dist/types/components/Segment/index.d.ts +2 -0
  161. package/dist/types/components/Select/Select.d.ts +20 -0
  162. package/dist/types/components/Select/Select.stories.d.ts +10 -0
  163. package/dist/types/components/Select/Select.test.d.ts +1 -0
  164. package/dist/types/components/Select/index.d.ts +1 -0
  165. package/dist/types/components/Slider/Slider.d.ts +19 -0
  166. package/dist/types/components/Slider/Slider.stories.d.ts +10 -0
  167. package/dist/types/components/Slider/Slider.test.d.ts +1 -0
  168. package/dist/types/components/Slider/helpers.d.ts +5 -0
  169. package/dist/types/components/Slider/helpers.test.d.ts +1 -0
  170. package/dist/types/components/Slider/index.d.ts +1 -0
  171. package/dist/types/components/Table/Body.d.ts +9 -0
  172. package/dist/types/components/Table/Cell.d.ts +11 -0
  173. package/dist/types/components/Table/Foot.d.ts +9 -0
  174. package/dist/types/components/Table/Head.d.ts +9 -0
  175. package/dist/types/components/Table/HeaderCell.d.ts +9 -0
  176. package/dist/types/components/Table/Row.d.ts +9 -0
  177. package/dist/types/components/Table/Table.d.ts +11 -0
  178. package/dist/types/components/Table/Table.stories.d.ts +7 -0
  179. package/dist/types/components/Table/Table.test.d.ts +1 -0
  180. package/dist/types/components/Table/index.d.ts +20 -0
  181. package/dist/types/components/Text/Text.d.ts +21 -0
  182. package/dist/types/components/Text/Text.stories.d.ts +10 -0
  183. package/dist/types/components/Text/Text.test.d.ts +1 -0
  184. package/dist/types/components/Text/index.d.ts +1 -0
  185. package/dist/types/components/TextArea/TextArea.d.ts +13 -0
  186. package/dist/types/components/TextArea/TextArea.stories.d.ts +11 -0
  187. package/dist/types/components/TextArea/TextArea.test.d.ts +1 -0
  188. package/dist/types/components/TextArea/index.d.ts +1 -0
  189. package/dist/types/components/TextAreaInput/TextAreaInput.d.ts +14 -0
  190. package/dist/types/components/TextAreaInput/TextAreaInput.test.d.ts +1 -0
  191. package/dist/types/components/TextAreaInput/index.d.ts +1 -0
  192. package/dist/types/components/TextField/TextField.d.ts +19 -0
  193. package/dist/types/components/TextField/TextField.stories.d.ts +20 -0
  194. package/dist/types/components/TextField/TextField.test.d.ts +1 -0
  195. package/dist/types/components/TextField/adornmentWithClassName.d.ts +2 -0
  196. package/dist/types/components/TextField/index.d.ts +1 -0
  197. package/dist/types/components/Title/Title.d.ts +15 -0
  198. package/dist/types/components/Title/Title.stories.d.ts +6 -0
  199. package/dist/types/components/Title/Title.test.d.ts +1 -0
  200. package/dist/types/components/Title/index.d.ts +1 -0
  201. package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +11 -0
  202. package/dist/types/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
  203. package/dist/types/components/VisuallyHidden/index.d.ts +1 -0
  204. package/dist/types/components/index.d.ts +40 -0
  205. package/dist/types/hooks/index.d.ts +7 -0
  206. package/dist/types/hooks/useBodyScrollLock/index.d.ts +1 -0
  207. package/dist/types/hooks/useBodyScrollLock/useBodyScrollLock.d.ts +3 -0
  208. package/dist/types/hooks/useBodyScrollLock/useBodyScrollLock.test.d.ts +1 -0
  209. package/dist/types/hooks/useBreakpoint/index.d.ts +1 -0
  210. package/dist/types/hooks/useBreakpoint/useBreakpoint.d.ts +14 -0
  211. package/dist/types/hooks/useBreakpoint/useBreakpoint.stories.d.ts +7 -0
  212. package/dist/types/hooks/useBreakpoint/useBreakpoint.test.d.ts +1 -0
  213. package/dist/types/hooks/useButton/index.d.ts +1 -0
  214. package/dist/types/hooks/useButton/useButton.d.ts +35 -0
  215. package/dist/types/hooks/useButton/useButton.test.d.ts +1 -0
  216. package/dist/types/hooks/useLabel/index.d.ts +1 -0
  217. package/dist/types/hooks/useLabel/useLabel.d.ts +27 -0
  218. package/dist/types/hooks/useLabel/useLabel.test.d.ts +1 -0
  219. package/dist/types/hooks/useOnClickOutside/index.d.ts +1 -0
  220. package/dist/types/hooks/useOnClickOutside/useOnClickOutside.d.ts +2 -0
  221. package/dist/types/hooks/useTextField/index.d.ts +2 -0
  222. package/dist/types/hooks/useTextField/types.d.ts +26 -0
  223. package/dist/types/hooks/useTextField/useTextField.d.ts +2 -0
  224. package/dist/types/hooks/useTextField/useTextField.test.d.ts +1 -0
  225. package/dist/types/hooks/useWindowEvent/index.d.ts +1 -0
  226. package/dist/types/hooks/useWindowEvent/useWindowEvent.d.ts +1 -0
  227. package/dist/types/index.d.ts +3 -0
  228. package/dist/types/types/components.d.ts +2 -0
  229. package/dist/types/types/dom.d.ts +3 -0
  230. package/dist/types/types/events.d.ts +45 -0
  231. package/dist/types/types/icon.d.ts +9 -0
  232. package/dist/types/types/index.d.ts +5 -0
  233. package/dist/types/types/size.d.ts +1 -0
  234. package/dist/types/utils/StoryContainer.d.ts +1 -0
  235. package/dist/types/utils/changeCSS.d.ts +1 -0
  236. package/dist/types/utils/excludeControls.d.ts +1 -0
  237. package/dist/types/utils/excludeControls.test.d.ts +1 -0
  238. package/dist/types/utils/index.d.ts +7 -0
  239. package/dist/types/utils/jestHTMLDialogPolyfill.d.ts +1 -0
  240. package/dist/types/utils/jestMockMatchMedia.d.ts +1 -0
  241. package/dist/types/utils/mergeRefs.d.ts +2 -0
  242. package/dist/types/utils/polyfill-tests.d.ts +1 -0
  243. package/dist/types/utils/sizeClasses.d.ts +16 -0
  244. package/dist/types/utils/sizeClasses.test.d.ts +1 -0
  245. package/dist/types/utils/spaceDelimitedList.d.ts +1 -0
  246. package/dist/types/utils/spaceDelimitedList.test.d.ts +1 -0
  247. package/package.json +9 -11
  248. package/src/components/Drawer/Drawer.tsx +8 -1
  249. package/src/components/Icon/Icon.tsx +0 -3
  250. package/src/components/Modal/Modal.tsx +9 -1
  251. package/src/components/Icon/IconStyle.tsx +0 -404
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - a572d54: Fix `<Icon>` server-side rendering
8
+
9
+ ## 4.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 047db6d: Fix intermittent iOS <=15.2 issue when dialog-polyfill loads
14
+ - 424ba56: Fix exported types
15
+ - Updated dependencies [424ba56]
16
+ - @simplybusiness/icons@4.2.8
17
+
3
18
  ## 4.3.1
4
19
 
5
20
  ### Patch Changes
@@ -113,7 +113,14 @@ const Drawer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
113
113
  if (!hasDialogSupport && typeof window !== "undefined" && modalRef.current !== null) {
114
114
  // eslint-disable-next-line import/no-extraneous-dependencies
115
115
  const { default: dialogPolyfill } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("dialog-polyfill")));
116
- dialogPolyfill.registerDialog(modalRef.current);
116
+ try {
117
+ dialogPolyfill.registerDialog(modalRef.current);
118
+ } catch (error) {
119
+ // In iOS 15 <= 15.2 this intermittently fails with
120
+ // TypeError: null is not an object (evaluating 'element.showModal')
121
+ // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️
122
+ console.error("Failed to load dialog-polyfill", error);
123
+ }
117
124
  }
118
125
  if (isOpen && !((_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : _modalRef_current.open)) {
119
126
  var _modalRef_current2, _modalRef_current3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { VisuallyHidden } from \"../VisuallyHidden\";\nimport { DrawerProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type DialogElementType = HTMLDialogElement;\nexport type DialogRef = Ref<DialogElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Drawer = forwardRef((props: DrawerProps, ref: DialogRef) => {\n const {\n isOpen,\n className,\n closeLabel,\n direction,\n announce = \"Drawer opened on screen\",\n onOpen,\n onClose,\n children,\n } = props;\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n {\n \"--should-transition\": hasDialogSupport,\n },\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current);\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n aria-describedby=\"screen-reader-announce\"\n >\n <VisuallyHidden>\n <div id=\"screen-reader-announce\">{announce}</div>\n </VisuallyHidden>\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nDrawer.displayName = \"Drawer\";\nexport { Drawer };\n"],"names":["Drawer","TRANSITION_CLASS_NAME","forwardRef","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","useRef","modalRef","hasDialogSupport","supportsDialog","current","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","classNames","useEffect","toggleModal","window","default","dialogPolyfill","registerDialog","open","showModal","add","dialog","mergeRefs","onCancel","aria-describedby","VisuallyHidden","div","id","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BA0ISA;;;eAAAA;;;;+DAxIc;uBAWhB;mCAC2B;+BACH;gCACA;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMC,wBAAwB;AAE9B,MAAMD,uBAASE,IAAAA,iBAAU,EAAC,CAACC,OAAoBC;IAC7C,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,yBAAyB,EACpCC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACT,GAAGT;IACJ,MAAMU,YAAYC,IAAAA,aAAM,EAAU;IAClC,MAAMC,WAAWD,IAAAA,aAAM,EAA2B;IAClD,MAAME,mBAAmBC,IAAAA,6BAAc;IAEvC,mBAAmB;IACnB,IAAIP,UAAU,CAACG,UAAUK,OAAO,EAAE;QAChCR;QACAG,UAAUK,OAAO,GAAG;IACtB;IAEAC,IAAAA,oCAAiB,EAAC;QAAEC,SAASf;IAAO;IAEpC,mDAAmD;IACnD,MAAMgB,cAAcC,IAAAA,kBAAW,EAC7B,CAACC;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAA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K;QAAQW;QAAaL;KAAiB;IAElD,qBACE,sBAAC2B;QACCvC,KAAKwC,IAAAA,gBAAS,EAAC;YAAC7B;YAAUX;SAAI;QAC9ByC,UAAUxB;QACVf,WAAW0B;QACXc,oBAAiB;;0BAEjB,qBAACC,8BAAc;0BACb,cAAA,qBAACC;oBAAIC,IAAG;8BAA0BxC;;;YAEnCyC,eAAQ,CAACC,GAAG,CAACvC,UAAUwC,CAAAA;gBACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;oBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;wBACzBzC,SAASU;wBACTd;oBACF;gBACF;gBAEA,OAAO6C;YACT;;;AAGN;AAEApD,OAAOuD,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { VisuallyHidden } from \"../VisuallyHidden\";\nimport { DrawerProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type DialogElementType = HTMLDialogElement;\nexport type DialogRef = Ref<DialogElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Drawer = forwardRef((props: DrawerProps, ref: DialogRef) => {\n const {\n isOpen,\n className,\n closeLabel,\n direction,\n announce = \"Drawer opened on screen\",\n onOpen,\n onClose,\n children,\n } = props;\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n {\n \"--should-transition\": hasDialogSupport,\n },\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n try {\n dialogPolyfill.registerDialog(modalRef.current);\n } catch (error) {\n // In iOS 15 <= 15.2 this intermittently fails with\n // TypeError: null is not an object (evaluating 'element.showModal')\n // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n aria-describedby=\"screen-reader-announce\"\n >\n <VisuallyHidden>\n <div id=\"screen-reader-announce\">{announce}</div>\n </VisuallyHidden>\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nDrawer.displayName = \"Drawer\";\nexport { Drawer };\n"],"names":["Drawer","TRANSITION_CLASS_NAME","forwardRef","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","useRef","modalRef","hasDialogSupport","supportsDialog","current","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","classNames","useEffect","toggleModal","window","default","dialogPolyfill","registerDialog","error","console","open","showModal","add","dialog","mergeRefs","onCancel","aria-describedby","VisuallyHidden","div","id","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BAiJSA;;;eAAAA;;;;+DA/Ic;uBAWhB;mCAC2B;+BACH;gCACA;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMC,wBAAwB;AAE9B,MAAMD,uBAASE,IAAAA,iBAAU,EAAC,CAACC,OAAoBC;IAC7C,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,yBAAyB,EACpCC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACT,GAAGT;IACJ,MAAMU,YAAYC,IAAAA,aAAM,EAAU;IAClC,MAAMC,WAAWD,IAAAA,aAAM,EAA2B;IAClD,MAAME,mBAAmBC,IAAAA,6BAAc;IAEvC,mBAAmB;IACnB,IAAIP,UAAU,CAACG,UAAUK,OAAO,EAAE;QAChCR;QACAG,UAAUK,OAAO,GAAG;IACtB;IAEAC,IAAAA,oCAAiB,EAAC;QAAEC,SAASf;IAAO;IAEpC,mDAAmD;IACnD,MAAMgB,cAAcC,IAAAA,kBAAW,EAC7B,CAACC;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAAME,eAAe;QACvB;QAEA,MAAMC,UAAU;gBACdX;aAAAA,oBAAAA,SAASG,OAAO,cAAhBH,wCAAAA,kBAAkBY,KAAK;YACvBhB,oBAAAA,8BAAAA;QACF;QAEA,gDAAgD;Q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AaL;KAAiB;IAElD,qBACE,sBAAC6B;QACCzC,KAAK0C,IAAAA,gBAAS,EAAC;YAAC/B;YAAUX;SAAI;QAC9B2C,UAAU1B;QACVf,WAAW0B;QACXgB,oBAAiB;;0BAEjB,qBAACC,8BAAc;0BACb,cAAA,qBAACC;oBAAIC,IAAG;8BAA0B1C;;;YAEnC2C,eAAQ,CAACC,GAAG,CAACzC,UAAU0C,CAAAA;gBACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;oBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;wBACzB3C,SAASU;wBACTd;oBACF;gBACF;gBAEA,OAAO+C;YACT;;;AAGN;AAEAtD,OAAOyD,WAAW,GAAG"}
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "Icon", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedupe"));
13
- const _IconStyle = require("./IconStyle");
14
13
  function _interop_require_default(obj) {
15
14
  return obj && obj.__esModule ? obj : {
16
15
  default: obj
@@ -26,7 +25,6 @@ function Icon({ icon, className, size = "xs", color, fixedWidth, spin, spinRever
26
25
  [`${ICON_PREFIX}-spin`]: spin || spinReverse,
27
26
  [`${ICON_PREFIX}-spin-reverse`]: spinReverse
28
27
  });
29
- (0, _IconStyle.applyStyles)();
30
28
  const { iconName, width, height, svgPathData } = icon;
31
29
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("svg", {
32
30
  "aria-hidden": "true",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport { applyStyles } from \"./IconStyle\";\nimport { IconProps } from \"./types\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nexport function Icon({\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius/Icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n applyStyles();\n\n const { iconName, width, height, svgPathData } = icon;\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n"],"names":["Icon","ICON_PREFIX","icon","className","size","color","fixedWidth","spin","spinReverse","otherProps","Error","classes","classNames","applyStyles","iconName","width","height","svgPathData","svg","aria-hidden","focusable","data-icon","role","xmlns","viewBox","style","path","fill","d"],"mappings":";;;;+BAMgBA;;;eAAAA;;;;+DANO;2BACK;;;;;;AAG5B,MAAMC,cAAc;AAEb,SAASD,KAAK,EACnBE,IAAI,EACJC,SAAS,EACTC,OAAO,IAAI,EACXC,KAAK,EACLC,UAAU,EACVC,IAAI,EACJC,WAAW,EACX,GAAGC,YACO;IACV,IAAI,CAACP,MAAM;QACT,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAMC,UAAUC,IAAAA,eAAU,EACxB,UACA,eACA,CAAC,YAAY,EAAEX,YAAY,CAAC,EAC5B,CAAC,OAAO,EAAEG,KAAK,CAAC,EAChBD,WACA;QACE,CAAC,CAAC,EAAEF,YAAY,GAAG,CAAC,CAAC,EAAEK;QACvB,CAAC,CAAC,EAAEL,YAAY,KAAK,CAAC,CAAC,EAAEM,QAAQC;QACjC,CAAC,CAAC,EAAEP,YAAY,aAAa,CAAC,CAAC,EAAEO;IACnC;IAGFK,IAAAA,sBAAW;IAEX,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE,GAAGf;IAEjD,qBACE,qBAACgB;QACCC,eAAY;QACZC,WAAU;QACVC,aAAWP;QACXX,WAAWQ;QACXW,MAAK;QACLC,OAAM;QACNC,SAAS,CAAC,IAAI,EAAET,MAAM,CAAC,EAAEC,OAAO,CAAC;QACjCS,OAAO;YAAEpB;QAAM;QACd,GAAGI,UAAU;kBAEd,cAAA,qBAACiB;YAAKC,MAAK;YAAeC,GAAGX;;;AAGnC"}
1
+ {"version":3,"sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport { IconProps } from \"./types\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nexport function Icon({\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius/Icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n"],"names":["Icon","ICON_PREFIX","icon","className","size","color","fixedWidth","spin","spinReverse","otherProps","Error","classes","classNames","iconName","width","height","svgPathData","svg","aria-hidden","focusable","data-icon","role","xmlns","viewBox","style","path","fill","d"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;+DALO;;;;;;AAGvB,MAAMC,cAAc;AAEb,SAASD,KAAK,EACnBE,IAAI,EACJC,SAAS,EACTC,OAAO,IAAI,EACXC,KAAK,EACLC,UAAU,EACVC,IAAI,EACJC,WAAW,EACX,GAAGC,YACO;IACV,IAAI,CAACP,MAAM;QACT,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAMC,UAAUC,IAAAA,eAAU,EACxB,UACA,eACA,CAAC,YAAY,EAAEX,YAAY,CAAC,EAC5B,CAAC,OAAO,EAAEG,KAAK,CAAC,EAChBD,WACA;QACE,CAAC,CAAC,EAAEF,YAAY,GAAG,CAAC,CAAC,EAAEK;QACvB,CAAC,CAAC,EAAEL,YAAY,KAAK,CAAC,CAAC,EAAEM,QAAQC;QACjC,CAAC,CAAC,EAAEP,YAAY,aAAa,CAAC,CAAC,EAAEO;IACnC;IAGF,MAAM,EAAEK,QAAQ,EAAEC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE,GAAGd;IAEjD,qBACE,qBAACe;QACCC,eAAY;QACZC,WAAU;QACVC,aAAWP;QACXV,WAAWQ;QACXU,MAAK;QACLC,OAAM;QACNC,SAAS,CAAC,IAAI,EAAET,MAAM,CAAC,EAAEC,OAAO,CAAC;QACjCS,OAAO;YAAEnB;QAAM;QACd,GAAGI,UAAU;kBAEd,cAAA,qBAACgB;YAAKC,MAAK;YAAeC,GAAGX;;;AAGnC"}
@@ -126,7 +126,14 @@ const Modal = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
126
126
  if (!hasDialogSupport && typeof window !== "undefined" && modalRef.current !== null) {
127
127
  // eslint-disable-next-line import/no-extraneous-dependencies
128
128
  const { default: dialogPolyfill } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("dialog-polyfill")));
129
- dialogPolyfill.registerDialog(modalRef.current);
129
+ try {
130
+ dialogPolyfill.registerDialog(modalRef.current);
131
+ } catch (error) {
132
+ // In iOS 15 <= 15.2 this intermittently fails with
133
+ // TypeError: null is not an object (evaluating 'element.showModal')
134
+ // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️
135
+ console.error("Failed to load dialog-polyfill", error);
136
+ }
130
137
  }
131
138
  if (isOpen && !((_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : _modalRef_current.open)) {
132
139
  var _modalRef_current2, _modalRef_current3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { ModalProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type ModalElementType = HTMLDialogElement;\nexport type ModalRef = Ref<ModalElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Modal = forwardRef((props: ModalProps, ref: ModalRef) => {\n const {\n isOpen,\n onClose,\n onOpen,\n children,\n className,\n closeLabel,\n isFullScreen,\n animation,\n // Deprecated props below\n size,\n appElement,\n preventCloseOnEsc,\n shouldFocusAfterRender,\n parentSelector,\n } = props;\n const hasWarnedAboutMissingLabels = useRef<boolean>(false);\n // Handle deprecated props\n if (!hasWarnedAboutMissingLabels.current) {\n if (\n size ||\n appElement ||\n preventCloseOnEsc ||\n shouldFocusAfterRender ||\n parentSelector\n ) {\n console.warn(\n `Deprecation warning: Mobius Modal no longer supports the following props: size, appElement, preventCloseOnEsc, shouldFocusAfterRender and parentSelector.`,\n );\n hasWarnedAboutMissingLabels.current = true;\n }\n }\n\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing animations\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport && animation) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport, animation],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n \"--no-dialog-support\": !hasDialogSupport, // This class is used to correctly position modal in x/y middle on iOS <= 15.2\n \"--should-transition\": hasDialogSupport && animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--is-fullscreen\": isFullScreen,\n },\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current);\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n >\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n"],"names":["Modal","TRANSITION_CLASS_NAME","forwardRef","props","ref","isOpen","onClose","onOpen","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","hasWarnedAboutMissingLabels","useRef","current","console","warn","hasOpened","modalRef","hasDialogSupport","supportsDialog","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","classNames","useEffect","toggleModal","window","default","dialogPolyfill","registerDialog","open","showModal","add","dialog","mergeRefs","onCancel","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BA+JSA;;;eAAAA;;;;+DA7Jc;uBAWhB;mCAC2B;+BACH;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMC,wBAAwB;AAE9B,MAAMD,sBAAQE,IAAAA,iBAAU,EAAC,CAACC,OAAmBC;IAC3C,MAAM,EACJC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,SAAS,EACT,yBAAyB;IACzBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,sBAAsB,EACtBC,cAAc,EACf,GAAGd;IACJ,MAAMe,8BAA8BC,IAAAA,aAAM,EAAU;IACpD,0BAA0B;IAC1B,IAAI,CAACD,4BAA4BE,OAAO,EAAE;QACxC,IACEP,QACAC,cACAC,qBACAC,0BACAC,gBACA;YACAI,QAAQC,IAAI,CACV,CAAC,yJAAyJ,CAAC;YAE7JJ,4BAA4BE,OAAO,GAAG;QACxC;IACF;IAEA,MAAMG,YAAYJ,IAAAA,aAAM,EAAU;IAClC,MAAMK,WAAWL,IAAAA,aAAM,EAA2B;IAClD,MAAMM,mBAAmBC,IAAAA,6BAAc;IAEvC,mBAAmB;IACnB,IAAInB,UAAU,CAACgB,UAAUH,OAAO,EAAE;QAChCb;QACAgB,UAAUH,OAAO,GAAG;IACtB;IAEAO,IAAAA,oCAAiB,EAAC;QAAEC,SAASvB;IAAO;IAEpC,kDAAkD;IAClD,MAAMwB,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CM,mBAAAA,6BAAAA;YACF,OAAO,IAAI,CAACF,YAAUmB,qBAAAA,SAASJ,OAAO,cAAhBI,yCAAAA,mBAAkBwB,IAAI,GAAE;gBAC5CnB;YACF;QACF;QAEAc;IACF,GAAG;QAACtC;QAAQE;QAAQsB;QAAaJ;KAAiB;IAElD,qBACE,qBAAC0B;QACC/C,KAAKgD,IAAAA,gBAAS,EAAC;YAAC5B;YAAUpB;SAAI;QAC9BiD,UAAUxB;QACVpB,WAAW+B;kBAEVc,eAAQ,CAACC,GAAG,CAAC/C,UAAUgD,CAAAA;YACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;gBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;oBACzBlD,SAASuB;oBACTnB;gBACF;YACF;YAEA,OAAO8C;QACT;;AAGN;AAEAxD,MAAM2D,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { ModalProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type ModalElementType = HTMLDialogElement;\nexport type ModalRef = Ref<ModalElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Modal = forwardRef((props: ModalProps, ref: ModalRef) => {\n const {\n isOpen,\n onClose,\n onOpen,\n children,\n className,\n closeLabel,\n isFullScreen,\n animation,\n // Deprecated props below\n size,\n appElement,\n preventCloseOnEsc,\n shouldFocusAfterRender,\n parentSelector,\n } = props;\n const hasWarnedAboutMissingLabels = useRef<boolean>(false);\n // Handle deprecated props\n if (!hasWarnedAboutMissingLabels.current) {\n if (\n size ||\n appElement ||\n preventCloseOnEsc ||\n shouldFocusAfterRender ||\n parentSelector\n ) {\n console.warn(\n `Deprecation warning: Mobius Modal no longer supports the following props: size, appElement, preventCloseOnEsc, shouldFocusAfterRender and parentSelector.`,\n );\n hasWarnedAboutMissingLabels.current = true;\n }\n }\n\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing animations\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport && animation) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport, animation],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n \"--no-dialog-support\": !hasDialogSupport, // This class is used to correctly position modal in x/y middle on iOS <= 15.2\n \"--should-transition\": hasDialogSupport && animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--is-fullscreen\": isFullScreen,\n },\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n\n try {\n dialogPolyfill.registerDialog(modalRef.current);\n } catch (error) {\n // In iOS 15 <= 15.2 this intermittently fails with\n // TypeError: null is not an object (evaluating 'element.showModal')\n // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n >\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n"],"names":["Modal","TRANSITION_CLASS_NAME","forwardRef","props","ref","isOpen","onClose","onOpen","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","hasWarnedAboutMissingLabels","useRef","current","console","warn","hasOpened","modalRef","hasDialogSupport","supportsDialog","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","classNames","useEffect","toggleModal","window","default","dialogPolyfill","registerDialog","error","open","showModal","add","dialog","mergeRefs","onCancel","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BAuKSA;;;eAAAA;;;;+DArKc;uBAWhB;mCAC2B;+BACH;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMC,wBAAwB;AAE9B,MAAMD,sBAAQE,IAAAA,iBAAU,EAAC,CAACC,OAAmBC;IAC3C,MAAM,EACJC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,SAAS,EACT,yBAAyB;IACzBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,sBAAsB,EACtBC,cAAc,EACf,GAAGd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E__*/ forwardRef((props, ref)=>{
57
57
  if (!hasDialogSupport && typeof window !== "undefined" && modalRef.current !== null) {
58
58
  // eslint-disable-next-line import/no-extraneous-dependencies
59
59
  const { default: dialogPolyfill } = await import("dialog-polyfill");
60
- dialogPolyfill.registerDialog(modalRef.current);
60
+ try {
61
+ dialogPolyfill.registerDialog(modalRef.current);
62
+ } catch (error) {
63
+ // In iOS 15 <= 15.2 this intermittently fails with
64
+ // TypeError: null is not an object (evaluating 'element.showModal')
65
+ // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️
66
+ console.error("Failed to load dialog-polyfill", error);
67
+ }
61
68
  }
62
69
  if (isOpen && !((_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : _modalRef_current.open)) {
63
70
  var _modalRef_current2, _modalRef_current3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { VisuallyHidden } from \"../VisuallyHidden\";\nimport { DrawerProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type DialogElementType = HTMLDialogElement;\nexport type DialogRef = Ref<DialogElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Drawer = forwardRef((props: DrawerProps, ref: DialogRef) => {\n const {\n isOpen,\n className,\n closeLabel,\n direction,\n announce = \"Drawer opened on screen\",\n onOpen,\n onClose,\n children,\n } = props;\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n {\n \"--should-transition\": hasDialogSupport,\n },\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current);\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n aria-describedby=\"screen-reader-announce\"\n >\n <VisuallyHidden>\n <div id=\"screen-reader-announce\">{announce}</div>\n </VisuallyHidden>\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nDrawer.displayName = \"Drawer\";\nexport { Drawer };\n"],"names":["classNames","Children","cloneElement","forwardRef","isValidElement","useCallback","useEffect","useRef","useBodyScrollLock","supportsDialog","VisuallyHidden","mergeRefs","TRANSITION_CLASS_NAME","Drawer","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","modalRef","hasDialogSupport","current","enabled","handleClose","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","toggleModal","window","default","dialogPolyfill","registerDialog","open","showModal","add","dialog","onCancel","aria-describedby","div","id","map","child","displayName"],"mappings":"AAAA;;AAEA,OAAOA,gBAAgB,oBAAoB;AAC3C,SACEC,QAAQ,EAGRC,YAAY,EACZC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,QAAQ;AACf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,oBAAoB;AAEnD,SAASC,SAAS,QAAQ,cAAc;AAKxC,MAAMC,wBAAwB;AAE9B,MAAMC,uBAASV,WAAW,CAACW,OAAoBC;IAC7C,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,yBAAyB,EACpCC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACT,GAAGT;IACJ,MAAMU,YAAYjB,OAAgB;IAClC,MAAMkB,WAAWlB,OAAiC;IAClD,MAAMmB,mBAAmBjB;IAEzB,mBAAmB;IACnB,IAAIY,UAAU,CAACG,UAAUG,OAAO,EAAE;QAChCN;QACAG,UAAUG,OAAO,GAAG;IACtB;IAEAnB,kBAAkB;QAAEoB,SAASZ;IAAO;IAEpC,mDAAmD;IACnD,MAAMa,cAAcxB,YAClB,CAACyB;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAAME,eAAe;QACvB;QAEA,MAAMC,UAAU;gBACdR;aAAAA,oBAAAA,SAASE,OAAO,cAAhBF,wCAAAA,kBAAkBS,KAAK;YACvBZ,oBAAAA,8BAAAA;QACF;QAEA,gDAAgD;QAChD,IAAII,kBAAkB;gB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B,SAASoD,GAAG,CAAC9B,UAAU+B,CAAAA;gBACtB,kBAAIlD,eAAekD,QAAQ;oBACzB,qBAAOpD,aAAaoD,OAAO;wBACzBhC,SAASO;wBACTX;oBACF;gBACF;gBAEA,OAAOoC;YACT;;;AAGN;AAEAzC,OAAO0C,WAAW,GAAG;AACrB,SAAS1C,MAAM,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { VisuallyHidden } from \"../VisuallyHidden\";\nimport { DrawerProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type DialogElementType = HTMLDialogElement;\nexport type DialogRef = Ref<DialogElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Drawer = forwardRef((props: DrawerProps, ref: DialogRef) => {\n const {\n isOpen,\n className,\n closeLabel,\n direction,\n announce = \"Drawer opened on screen\",\n onOpen,\n onClose,\n children,\n } = props;\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n {\n \"--should-transition\": hasDialogSupport,\n },\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n try {\n dialogPolyfill.registerDialog(modalRef.current);\n } catch (error) {\n // In iOS 15 <= 15.2 this intermittently fails with\n // TypeError: null is not an object (evaluating 'element.showModal')\n // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n aria-describedby=\"screen-reader-announce\"\n >\n <VisuallyHidden>\n <div id=\"screen-reader-announce\">{announce}</div>\n </VisuallyHidden>\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nDrawer.displayName = \"Drawer\";\nexport { Drawer };\n"],"names":["classNames","Children","cloneElement","forwardRef","isValidElement","useCallback","useEffect","useRef","useBodyScrollLock","supportsDialog","VisuallyHidden","mergeRefs","TRANSITION_CLASS_NAME","Drawer","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","modalRef","hasDialogSupport","current","enabled","handleClose","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","toggleModal","window","default","dialogPolyfill","registerDialog","error","console","open","showModal","add","dialog","onCancel","aria-describedby","div","id","map","child","displayName"],"mappings":"AAAA;;AAEA,OAAOA,gBAAgB,oBAAoB;AAC3C,SACEC,QAAQ,EAGRC,YAAY,EACZC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,QAAQ;AACf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,oBAAoB;AAEnD,SAASC,SAAS,QAAQ,cAAc;AAKxC,MAAMC,wBAAwB;AAE9B,MAAMC,uBAASV,WAAW,CAACW,OAAoBC;IAC7C,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,yBAAyB,EACpCC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACT,GAAGT;IACJ,MAAMU,YAAYjB,OAAgB;IAClC,MAAMkB,WAAWlB,OAAiC;IAClD,MAAMmB,mBAAmBjB;IAEzB,mBAAmB;IACnB,IAAIY,UAAU,CAACG,UAAUG,OAAO,EAAE;QAChCN;QACAG,UAAUG,OAAO,GAAG;IACtB;IAEAnB,kBAAkB;QAAEoB,SAASZ;IAAO;IAEpC,mDAAmD;IACnD,MAAMa,cAAcxB,YAClB,CAACyB;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAAME,eAAe;QACvB;QAEA,MAAMC,UAAU;gBACdR;aAAAA,oBAAAA,SAASE,OAAO,cAAhBF,wCAAAA,kBAAkBS,KAAK;YACvBZ,oBAAAA,8BAAAA;QACF;QAEA,gDAAgD;QAChD,IAAII,kBAAkB;gBACpBD,mBACAA;aADAA,oBAAAA,SAASE,OAAO,cAAhBF,wCAAAA,kBAAkBU,SAAS,CAACC,MAAM,CAACxB;aACnCa,qBAAAA,SAASE,OAAO,cAAhBF,yCAAA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B,SAASsD,GAAG,CAAChC,UAAUiC,CAAAA;gBACtB,kBAAIpD,eAAeoD,QAAQ;oBACzB,qBAAOtD,aAAasD,OAAO;wBACzBlC,SAASO;wBACTX;oBACF;gBACF;gBAEA,OAAOsC;YACT;;;AAGN;AAEA3C,OAAO4C,WAAW,GAAG;AACrB,SAAS5C,MAAM,GAAG"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import classNames from "classnames/dedupe";
3
- import { applyStyles } from "./IconStyle";
4
3
  const ICON_PREFIX = "mobius-icon";
5
4
  export function Icon({ icon, className, size = "xs", color, fixedWidth, spin, spinReverse, ...otherProps }) {
6
5
  if (!icon) {
@@ -11,7 +10,6 @@ export function Icon({ icon, className, size = "xs", color, fixedWidth, spin, sp
11
10
  [`${ICON_PREFIX}-spin`]: spin || spinReverse,
12
11
  [`${ICON_PREFIX}-spin-reverse`]: spinReverse
13
12
  });
14
- applyStyles();
15
13
  const { iconName, width, height, svgPathData } = icon;
16
14
  return /*#__PURE__*/ _jsx("svg", {
17
15
  "aria-hidden": "true",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport { applyStyles } from \"./IconStyle\";\nimport { IconProps } from \"./types\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nexport function Icon({\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius/Icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n applyStyles();\n\n const { iconName, width, height, svgPathData } = icon;\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n"],"names":["classNames","applyStyles","ICON_PREFIX","Icon","icon","className","size","color","fixedWidth","spin","spinReverse","otherProps","Error","classes","iconName","width","height","svgPathData","svg","aria-hidden","focusable","data-icon","role","xmlns","viewBox","style","path","fill","d"],"mappings":";AAAA,OAAOA,gBAAgB,oBAAoB;AAC3C,SAASC,WAAW,QAAQ,cAAc;AAG1C,MAAMC,cAAc;AAEpB,OAAO,SAASC,KAAK,EACnBC,IAAI,EACJC,SAAS,EACTC,OAAO,IAAI,EACXC,KAAK,EACLC,UAAU,EACVC,IAAI,EACJC,WAAW,EACX,GAAGC,YACO;IACV,IAAI,CAACP,MAAM;QACT,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAMC,UAAUb,WACd,UACA,eACA,CAAC,YAAY,EAAEE,YAAY,CAAC,EAC5B,CAAC,OAAO,EAAEI,KAAK,CAAC,EAChBD,WACA;QACE,CAAC,CAAC,EAAEH,YAAY,GAAG,CAAC,CAAC,EAAEM;QACvB,CAAC,CAAC,EAAEN,YAAY,KAAK,CAAC,CAAC,EAAEO,QAAQC;QACjC,CAAC,CAAC,EAAER,YAAY,aAAa,CAAC,CAAC,EAAEQ;IACnC;IAGFT;IAEA,MAAM,EAAEa,QAAQ,EAAEC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE,GAAGb;IAEjD,qBACE,KAACc;QACCC,eAAY;QACZC,WAAU;QACVC,aAAWP;QACXT,WAAWQ;QACXS,MAAK;QACLC,OAAM;QACNC,SAAS,CAAC,IAAI,EAAET,MAAM,CAAC,EAAEC,OAAO,CAAC;QACjCS,OAAO;YAAElB;QAAM;QACd,GAAGI,UAAU;kBAEd,cAAA,KAACe;YAAKC,MAAK;YAAeC,GAAGX;;;AAGnC"}
1
+ {"version":3,"sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport { IconProps } from \"./types\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nexport function Icon({\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius/Icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n"],"names":["classNames","ICON_PREFIX","Icon","icon","className","size","color","fixedWidth","spin","spinReverse","otherProps","Error","classes","iconName","width","height","svgPathData","svg","aria-hidden","focusable","data-icon","role","xmlns","viewBox","style","path","fill","d"],"mappings":";AAAA,OAAOA,gBAAgB,oBAAoB;AAG3C,MAAMC,cAAc;AAEpB,OAAO,SAASC,KAAK,EACnBC,IAAI,EACJC,SAAS,EACTC,OAAO,IAAI,EACXC,KAAK,EACLC,UAAU,EACVC,IAAI,EACJC,WAAW,EACX,GAAGC,YACO;IACV,IAAI,CAACP,MAAM;QACT,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAMC,UAAUZ,WACd,UACA,eACA,CAAC,YAAY,EAAEC,YAAY,CAAC,EAC5B,CAAC,OAAO,EAAEI,KAAK,CAAC,EAChBD,WACA;QACE,CAAC,CAAC,EAAEH,YAAY,GAAG,CAAC,CAAC,EAAEM;QACvB,CAAC,CAAC,EAAEN,YAAY,KAAK,CAAC,CAAC,EAAEO,QAAQC;QACjC,CAAC,CAAC,EAAER,YAAY,aAAa,CAAC,CAAC,EAAEQ;IACnC;IAGF,MAAM,EAAEI,QAAQ,EAAEC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE,GAAGb;IAEjD,qBACE,KAACc;QACCC,eAAY;QACZC,WAAU;QACVC,aAAWP;QACXT,WAAWQ;QACXS,MAAK;QACLC,OAAM;QACNC,SAAS,CAAC,IAAI,EAAET,MAAM,CAAC,EAAEC,OAAO,CAAC;QACjCS,OAAO;YAAElB;QAAM;QACd,GAAGI,UAAU;kBAEd,cAAA,KAACe;YAAKC,MAAK;YAAeC,GAAGX;;;AAGnC"}
@@ -70,7 +70,14 @@ const Modal = /*#__PURE__*/ forwardRef((props, ref)=>{
70
70
  if (!hasDialogSupport && typeof window !== "undefined" && modalRef.current !== null) {
71
71
  // eslint-disable-next-line import/no-extraneous-dependencies
72
72
  const { default: dialogPolyfill } = await import("dialog-polyfill");
73
- dialogPolyfill.registerDialog(modalRef.current);
73
+ try {
74
+ dialogPolyfill.registerDialog(modalRef.current);
75
+ } catch (error) {
76
+ // In iOS 15 <= 15.2 this intermittently fails with
77
+ // TypeError: null is not an object (evaluating 'element.showModal')
78
+ // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️
79
+ console.error("Failed to load dialog-polyfill", error);
80
+ }
74
81
  }
75
82
  if (isOpen && !((_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : _modalRef_current.open)) {
76
83
  var _modalRef_current2, _modalRef_current3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { ModalProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type ModalElementType = HTMLDialogElement;\nexport type ModalRef = Ref<ModalElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Modal = forwardRef((props: ModalProps, ref: ModalRef) => {\n const {\n isOpen,\n onClose,\n onOpen,\n children,\n className,\n closeLabel,\n isFullScreen,\n animation,\n // Deprecated props below\n size,\n appElement,\n preventCloseOnEsc,\n shouldFocusAfterRender,\n parentSelector,\n } = props;\n const hasWarnedAboutMissingLabels = useRef<boolean>(false);\n // Handle deprecated props\n if (!hasWarnedAboutMissingLabels.current) {\n if (\n size ||\n appElement ||\n preventCloseOnEsc ||\n shouldFocusAfterRender ||\n parentSelector\n ) {\n console.warn(\n `Deprecation warning: Mobius Modal no longer supports the following props: size, appElement, preventCloseOnEsc, shouldFocusAfterRender and parentSelector.`,\n );\n hasWarnedAboutMissingLabels.current = true;\n }\n }\n\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing animations\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport && animation) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport, animation],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n \"--no-dialog-support\": !hasDialogSupport, // This class is used to correctly position modal in x/y middle on iOS <= 15.2\n \"--should-transition\": hasDialogSupport && animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--is-fullscreen\": isFullScreen,\n },\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current);\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n >\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n"],"names":["classNames","Children","cloneElement","forwardRef","isValidElement","useCallback","useEffect","useRef","useBodyScrollLock","supportsDialog","mergeRefs","TRANSITION_CLASS_NAME","Modal","props","ref","isOpen","onClose","onOpen","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","hasWarnedAboutMissingLabels","current","console","warn","hasOpened","modalRef","hasDialogSupport","enabled","handleClose","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","toggleModal","window","default","dialogPolyfill","registerDialog","open","showModal","add","dialog","onCancel","map","child","displayName"],"mappings":"AAAA;;AAEA,OAAOA,gBAAgB,oBAAoB;AAC3C,SACEC,Q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,kBAAItD,eAAesD,QAAQ;gBACzB,qBAAOxD,aAAawD,OAAO;oBACzB1C,SAASoB;oBACThB;gBACF;YACF;YAEA,OAAOsC;QACT;;AAGN;AAEA9C,MAAM+C,WAAW,GAAG;AACpB,SAAS/C,KAAK,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n Ref,\n SyntheticEvent,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\nimport { ModalProps } from \"./types\";\nimport { mergeRefs } from \"../../utils\";\n\nexport type ModalElementType = HTMLDialogElement;\nexport type ModalRef = Ref<ModalElementType>;\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\n\nconst Modal = forwardRef((props: ModalProps, ref: ModalRef) => {\n const {\n isOpen,\n onClose,\n onOpen,\n children,\n className,\n closeLabel,\n isFullScreen,\n animation,\n // Deprecated props below\n size,\n appElement,\n preventCloseOnEsc,\n shouldFocusAfterRender,\n parentSelector,\n } = props;\n const hasWarnedAboutMissingLabels = useRef<boolean>(false);\n // Handle deprecated props\n if (!hasWarnedAboutMissingLabels.current) {\n if (\n size ||\n appElement ||\n preventCloseOnEsc ||\n shouldFocusAfterRender ||\n parentSelector\n ) {\n console.warn(\n `Deprecation warning: Mobius Modal no longer supports the following props: size, appElement, preventCloseOnEsc, shouldFocusAfterRender and parentSelector.`,\n );\n hasWarnedAboutMissingLabels.current = true;\n }\n }\n\n const hasOpened = useRef<boolean>(false);\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const hasDialogSupport = supportsDialog();\n\n // Fire onOpen once\n if (onOpen && !hasOpened.current) {\n onOpen();\n hasOpened.current = true;\n }\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing animations\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n const doClose = () => {\n modalRef.current?.close();\n onClose?.();\n };\n\n // Delay close to allow backdrop exit transition\n if (hasDialogSupport && animation) {\n modalRef.current?.classList.remove(TRANSITION_CLASS_NAME);\n modalRef.current?.addEventListener(\n \"transitionend\",\n () => {\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [onClose, hasDialogSupport, animation],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n \"--no-dialog-support\": !hasDialogSupport, // This class is used to correctly position modal in x/y middle on iOS <= 15.2\n \"--should-transition\": hasDialogSupport && animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--is-fullscreen\": isFullScreen,\n },\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n modalRef.current !== null\n ) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n\n try {\n dialogPolyfill.registerDialog(modalRef.current);\n } catch (error) {\n // In iOS 15 <= 15.2 this intermittently fails with\n // TypeError: null is not an object (evaluating 'element.showModal')\n // Checking showModal presence through hasOwnProperty is falsy natively, truthy with polyfill 🤷🏼‍♂️\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n\n if (isOpen && !modalRef.current?.open) {\n modalRef.current?.showModal();\n modalRef.current?.classList.add(TRANSITION_CLASS_NAME);\n onOpen?.();\n } else if (!isOpen && modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose, hasDialogSupport]);\n\n return (\n <dialog\n ref={mergeRefs([modalRef, ref])}\n onCancel={handleClose}\n className={modalClasses}\n >\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose: handleClose,\n closeLabel,\n } as any);\n }\n\n return child;\n })}\n </dialog>\n );\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n"],"names":["classNames","Children","cloneElement","forwardRef","isValidElement","useCallback","useEffect","useRef","useBodyScrollLock","supportsDialog","mergeRefs","TRANSITION_CLASS_NAME","Modal","props","ref","isOpen","onClose","onOpen","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","hasWarnedAboutMissingLabels","current","console","warn","hasOpened","modalRef","hasDialogSupport","enabled","handleClose","event","preventDefault","stopPropagation","doClose","close","classList","remove","addEventListener","once","modalClasses","toggleModal","window","default","dialogPolyfill","registerDialog","error","open","showModal","add","dialog","onCancel","map","child","displayName"],"mappings":"AAAA;;AAEA,OAAOA,gBAAgB,oBAAoB;AAC3C,SACEC,QAAQ,EAGRC,YAAY,EACZC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,QAAQ;AACf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,cAAc,QAAQ,6BAA6B;AAE5D,SAASC,SAAS,QAAQ,cAAc;AAKxC,MAAMC,wBAAwB;AAE9B,MAAMC,sBAAQT,WAAW,CAACU,OAAmBC;IAC3C,MAAM,EACJC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,SAAS,EACT,yBAAyB;IACzBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,sBAAsB,EACtBC,cAAc,EACf,GAAGd;IACJ,MAAMe,8BAA8BrB,OAAgB;IACpD,0BAA0B;IAC1B,IAAI,CAACqB,4BAA4BC,OAAO,EAAE;QACxC,IACEN,QACAC,cACAC,qBACAC,0BACAC,gBACA;YACAG,QAAQC,IAAI,CACV,CAAC,yJAAyJ,CAAC;YAE7JH,4BAA4BC,OAAO,GAAG;QACxC;IACF;IAEA,MAAMG,YAAYzB,OAAgB;IAClC,MA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qG;oBACrGtB,QAAQsB,KAAK,CAAC,kCAAkCA;gBAClD;YACF;YAEA,IAAIrC,UAAU,GAACkB,oBAAAA,SAASJ,OAAO,cAAhBI,wCAAAA,kBAAkBoB,IAAI,GAAE;oBACrCpB,oBACAA;iBADAA,qBAAAA,SAASJ,OAAO,cAAhBI,yCAAAA,mBAAkBqB,SAAS;iBAC3BrB,qBAAAA,SAASJ,OAAO,cAAhBI,yCAAAA,mBAAkBS,SAAS,CAACa,GAAG,CAAC5C;gBAChCM,mBAAAA,6BAAAA;YACF,OAAO,IAAI,CAACF,YAAUkB,qBAAAA,SAASJ,OAAO,cAAhBI,yCAAAA,mBAAkBoB,IAAI,GAAE;gBAC5CjB;YACF;QACF;QAEAW;IACF,GAAG;QAAChC;QAAQE;QAAQmB;QAAaF;KAAiB;IAElD,qBACE,KAACsB;QACC1C,KAAKJ,UAAU;YAACuB;YAAUnB;SAAI;QAC9B2C,UAAUrB;QACVjB,WAAW2B;kBAEV7C,SAASyD,GAAG,CAACxC,UAAUyC,CAAAA;YACtB,kBAAIvD,eAAeuD,QAAQ;gBACzB,qBAAOzD,aAAayD,OAAO;oBACzB3C,SAASoB;oBACThB;gBACF;YACF;YAEA,OAAOuC;QACT;;AAGN;AAEA/C,MAAMgD,WAAW,GAAG;AACpB,SAAShD,KAAK,GAAG"}
@@ -0,0 +1,34 @@
1
+ import { ReactNode, Ref, RefAttributes } from "react";
2
+ import { ForwardedRefComponent } from "../../types/components";
3
+ import { DOMProps } from "../../types/dom";
4
+ export type AccordionElementType = HTMLDivElement;
5
+ export type AccordionRef = Ref<AccordionElementType>;
6
+ export interface AccordionLinkProps extends DOMProps {
7
+ /** Link text to show accordion content */
8
+ text?: string;
9
+ onClick?: () => void;
10
+ toggle: () => void;
11
+ headerChildren?: ReactNode;
12
+ ariaExpanded: boolean | undefined;
13
+ }
14
+ export interface AccordionProps extends DOMProps, RefAttributes<AccordionElementType> {
15
+ /** Custom class name for setting specific CSS */
16
+ className?: string;
17
+ /** Link text to show accordion content */
18
+ showText?: string;
19
+ /** Link text to hide accordion content */
20
+ hideText?: string;
21
+ /** Whether header is above or below content */
22
+ headerPosition?: "top" | "bottom";
23
+ /** Whether to expand the accordion initially */
24
+ startOpen?: boolean | undefined;
25
+ /** Callback that fires each time the accordion is opened */
26
+ onOpen?: () => void;
27
+ /** Callback that fires each time the accordion is closed */
28
+ onClose?: () => void;
29
+ /** Callback that fires each time the accordion state changes */
30
+ onChange?: (state: boolean) => void;
31
+ children?: ReactNode;
32
+ headerChildren?: ReactNode;
33
+ }
34
+ export declare const Accordion: ForwardedRefComponent<AccordionProps, AccordionElementType>;
@@ -0,0 +1,10 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Accordion } from "..";
3
+ type StoryType = StoryObj<typeof Accordion>;
4
+ declare const meta: Meta<typeof Accordion>;
5
+ export declare const Normal: StoryType;
6
+ export declare const StartExpanded: StoryType;
7
+ export declare const BottomHeader: StoryType;
8
+ export declare const WithChildren: StoryType;
9
+ export declare const ComplexContent: StoryType;
10
+ export default meta;
@@ -0,0 +1 @@
1
+ export * from "./Accordion";
@@ -0,0 +1,16 @@
1
+ import { Ref, RefAttributes, ReactNode } from "react";
2
+ import { DOMProps } from "../../types/dom";
3
+ import { ForwardedRefComponent } from "../../types/components";
4
+ export type AlertElementType = HTMLDivElement;
5
+ export interface AlertProps extends DOMProps, RefAttributes<AlertElementType> {
6
+ children?: ReactNode;
7
+ /** Custom class name for setting specific CSS */
8
+ className?: string;
9
+ elementType?: string | React.ElementType;
10
+ variant?: "info" | "success" | "warning" | "error";
11
+ show?: boolean;
12
+ header?: string;
13
+ }
14
+ export type AlertRef = Ref<AlertElementType>;
15
+ declare const Alert: ForwardedRefComponent<AlertProps, AlertElementType>;
16
+ export { Alert };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Alert } from "./Alert";
3
+ type StoryType = StoryObj<typeof Alert>;
4
+ declare const meta: Meta<typeof Alert>;
5
+ export declare const Normal: StoryType;
6
+ export declare const WithHeader: StoryType;
7
+ export default meta;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Alert";
@@ -0,0 +1,15 @@
1
+ import { Ref, RefAttributes, ReactNode } from "react";
2
+ import { DOMProps } from "../../types/dom";
3
+ import { ForwardedRefComponent } from "../../types/components";
4
+ export type BoxElementType = HTMLDivElement;
5
+ export interface BoxProps extends DOMProps, RefAttributes<BoxElementType> {
6
+ children?: ReactNode;
7
+ /** Custom class name for setting specific CSS */
8
+ className?: string;
9
+ /** HTML element for the Box */
10
+ elementType?: "div" | "span";
11
+ style?: React.CSSProperties;
12
+ }
13
+ export type BoxRef = Ref<BoxElementType>;
14
+ declare const Box: ForwardedRefComponent<BoxProps, BoxElementType>;
15
+ export { Box };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Box } from "./Box";
3
+ type StoryType = StoryObj<typeof Box>;
4
+ declare const meta: Meta<typeof Box>;
5
+ export declare const Normal: StoryType;
6
+ export declare const CustomElement: StoryType;
7
+ export default meta;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Box";
@@ -0,0 +1,15 @@
1
+ import { Ref, ReactNode } from "react";
2
+ import { DOMProps } from "../../types/dom";
3
+ import { ForwardedRefComponent } from "../../types/components";
4
+ export type BreadcrumbItemElementType = HTMLLIElement;
5
+ export interface BreadcrumbItemProps extends DOMProps {
6
+ "aria-current"?: "page" | "step" | "location" | "date" | "time" | boolean | "true" | "false";
7
+ isDisabled?: boolean;
8
+ isCurrent?: boolean;
9
+ separator?: ReactNode;
10
+ className?: string;
11
+ children: ReactNode;
12
+ }
13
+ export type BreadcrumbItemRef = Ref<BreadcrumbItemElementType>;
14
+ declare const BreadcrumbItem: ForwardedRefComponent<BreadcrumbItemProps, BreadcrumbItemElementType>;
15
+ export { BreadcrumbItem };
@@ -0,0 +1,12 @@
1
+ import { Ref, RefAttributes, ReactNode } from "react";
2
+ import { ForwardedRefComponent } from "../../types/components";
3
+ export type BreadcrumbsElementType = HTMLUListElement;
4
+ export interface BreadcrumbsProps extends RefAttributes<BreadcrumbsElementType> {
5
+ /** Custom class name for setting specific CSS */
6
+ className?: string;
7
+ children?: ReactNode;
8
+ "aria-label"?: string;
9
+ }
10
+ export type BreadcrumbsRef = Ref<BreadcrumbsElementType>;
11
+ declare const Breadcrumbs: ForwardedRefComponent<BreadcrumbsProps, BreadcrumbsElementType>;
12
+ export { Breadcrumbs };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Breadcrumbs } from "./Breadcrumbs";
3
+ type StoryType = StoryObj<typeof Breadcrumbs>;
4
+ declare const meta: Meta<typeof Breadcrumbs>;
5
+ export declare const Normal: StoryType;
6
+ export declare const WithLogo: StoryType;
7
+ export default meta;
@@ -0,0 +1,2 @@
1
+ export * from "./Breadcrumbs";
2
+ export * from "./BreadcrumbItem";
@@ -0,0 +1,31 @@
1
+ import { Ref, RefAttributes, ReactNode } from "react";
2
+ import { DOMProps } from "../../types/dom";
3
+ import { ForwardedRefComponent } from "../../types/components";
4
+ import { UseButtonProps } from "../../hooks/useButton";
5
+ export type ButtonElementType = HTMLButtonElement;
6
+ export type Variant = "primary" | "secondary" | "ghost" | "inverse" | "inverse-ghost" | "basic";
7
+ export type Size = "sm" | "md" | "lg";
8
+ export interface ButtonProps extends UseButtonProps, DOMProps, RefAttributes<ButtonElementType> {
9
+ /** Custom class name for setting specific CSS */
10
+ className?: string;
11
+ /** Shortlist of styles */
12
+ variant?: Variant;
13
+ size?: Size;
14
+ /** Display loading spinner */
15
+ isLoading?: boolean;
16
+ /** Display success style */
17
+ isSuccess?: boolean;
18
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
19
+ /**
20
+ * **Deprecated:** Please pass icon as part of component's children instead.
21
+ */
22
+ icon?: string;
23
+ /**
24
+ * **Deprecated:** Please pass icon as part of component's children instead.
25
+ */
26
+ iconPosition?: "left" | "right";
27
+ children?: ReactNode;
28
+ }
29
+ export type ButtonRef = Ref<ButtonElementType>;
30
+ declare const Button: ForwardedRefComponent<ButtonProps, ButtonElementType>;
31
+ export { Button };
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Button } from "./Button";
3
+ type StoryType = StoryObj<typeof Button>;
4
+ declare const meta: Meta<typeof Button>;
5
+ export declare const Normal: StoryType;
6
+ export declare const Secondary: StoryType;
7
+ export declare const Ghost: StoryType;
8
+ export declare const Basic: StoryType;
9
+ export declare const Large: StoryType;
10
+ export declare const Link: StoryType;
11
+ export declare const Loading: StoryType;
12
+ export declare const Success: StoryType;
13
+ export declare const Disabled: StoryType;
14
+ export declare const WithIconOnTheLeft: StoryType;
15
+ export declare const WithIconOnTheRight: StoryType;
16
+ export declare const Themed: StoryType;
17
+ export declare const Counter: () => import("react/jsx-runtime").JSX.Element;
18
+ export declare const PressButton: () => import("react/jsx-runtime").JSX.Element;
19
+ export default meta;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const Loading: () => import("react/jsx-runtime").JSX.Element;
2
+ export { Loading };
@@ -0,0 +1 @@
1
+ export * from "./Button";
@@ -0,0 +1,3 @@
1
+ import { ForwardedRefComponent } from "../../types/components";
2
+ import { CheckboxElementType, CheckboxProps } from "./types";
3
+ export declare const Checkbox: ForwardedRefComponent<CheckboxProps, CheckboxElementType>;
@@ -0,0 +1,10 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Checkbox } from ".";
3
+ type StoryType = StoryObj<typeof Checkbox>;
4
+ declare const meta: Meta<typeof Checkbox>;
5
+ export declare const Normal: StoryType;
6
+ export declare const Disabled: StoryType;
7
+ export declare const Valid: StoryType;
8
+ export declare const Invalid: StoryType;
9
+ export declare const LongLabel: StoryType;
10
+ export default meta;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ForwardedRefComponent } from "../../types/components";
2
+ import { CheckboxGroupElementType, CheckboxGroupProps } from "./types";
3
+ export declare const CheckboxGroup: ForwardedRefComponent<CheckboxGroupProps, CheckboxGroupElementType>;
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { CheckboxGroup } from ".";
3
+ type StoryType = StoryObj<typeof CheckboxGroup>;
4
+ declare const meta: Meta<typeof CheckboxGroup>;
5
+ export declare const Normal: StoryType;
6
+ export declare const Disabled: StoryType;
7
+ export declare const Valid: StoryType;
8
+ export declare const Invalid: StoryType;
9
+ export default meta;
@@ -0,0 +1,3 @@
1
+ export * from "./Checkbox";
2
+ export * from "./CheckboxGroup";
3
+ export * from "./types";