@simplybusiness/mobius 4.2.8 → 4.3.0

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 (68) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/components/Drawer/Drawer.js +1 -1
  3. package/dist/cjs/components/Drawer/Drawer.js.map +1 -1
  4. package/dist/cjs/components/Modal/Content.js +3 -13
  5. package/dist/cjs/components/Modal/Content.js.map +1 -1
  6. package/dist/cjs/components/Modal/Header.js +4 -14
  7. package/dist/cjs/components/Modal/Header.js.map +1 -1
  8. package/dist/cjs/components/Modal/Modal.js +35 -22
  9. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  10. package/dist/cjs/components/Modal/index.js.map +1 -1
  11. package/dist/cjs/components/Modal/types.js +6 -0
  12. package/dist/cjs/components/Modal/types.js.map +1 -0
  13. package/dist/cjs/hooks/useTextField/useTextField.js +1 -1
  14. package/dist/cjs/hooks/useTextField/useTextField.js.map +1 -1
  15. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  16. package/dist/cjs/utils/index.js +0 -1
  17. package/dist/cjs/utils/index.js.map +1 -1
  18. package/dist/cjs/utils/jestMockMatchMedia.js +28 -0
  19. package/dist/cjs/utils/jestMockMatchMedia.js.map +1 -0
  20. package/dist/esm/components/Drawer/Drawer.js +1 -1
  21. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  22. package/dist/esm/components/Modal/Content.js +3 -8
  23. package/dist/esm/components/Modal/Content.js.map +1 -1
  24. package/dist/esm/components/Modal/Header.js +4 -9
  25. package/dist/esm/components/Modal/Header.js.map +1 -1
  26. package/dist/esm/components/Modal/Modal.js +36 -24
  27. package/dist/esm/components/Modal/Modal.js.map +1 -1
  28. package/dist/esm/components/Modal/index.js.map +1 -1
  29. package/dist/esm/components/Modal/types.js +3 -0
  30. package/dist/esm/components/Modal/types.js.map +1 -0
  31. package/dist/esm/hooks/useTextField/useTextField.js +1 -1
  32. package/dist/esm/hooks/useTextField/useTextField.js.map +1 -1
  33. package/dist/esm/utils/index.js +0 -1
  34. package/dist/esm/utils/index.js.map +1 -1
  35. package/dist/esm/utils/jestMockMatchMedia.js +18 -0
  36. package/dist/esm/utils/jestMockMatchMedia.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/components/Accordion/Accordion.test.tsx +3 -19
  39. package/src/components/Checkbox/Checkbox.stories.tsx +2 -1
  40. package/src/components/Checkbox/CheckboxGroup.stories.tsx +3 -2
  41. package/src/components/Divider/Divider.stories.tsx +1 -1
  42. package/src/components/Drawer/Drawer.test.tsx +13 -47
  43. package/src/components/Drawer/Drawer.tsx +1 -1
  44. package/src/components/DropdownMenu/DropdownMenu.stories.tsx +4 -3
  45. package/src/components/Fieldset/Fieldset.stories.tsx +3 -2
  46. package/src/components/Modal/Content.tsx +18 -22
  47. package/src/components/Modal/Header.tsx +16 -22
  48. package/src/components/Modal/Modal.stories.tsx +6 -28
  49. package/src/components/Modal/Modal.test.tsx +82 -101
  50. package/src/components/Modal/Modal.tsx +62 -75
  51. package/src/components/Modal/index.tsx +2 -1
  52. package/src/components/Modal/types.ts +32 -0
  53. package/src/components/NumberField/NumberField.stories.tsx +2 -1
  54. package/src/components/PasswordField/PasswordField.stories.tsx +2 -1
  55. package/src/components/Progress/Progress.stories.tsx +2 -1
  56. package/src/components/Radio/Radio.stories.tsx +4 -3
  57. package/src/components/Radio/RadioButton.stories.tsx +4 -3
  58. package/src/components/Select/Select.stories.tsx +2 -2
  59. package/src/components/Slider/Slider.stories.tsx +2 -1
  60. package/src/components/TextArea/TextArea.stories.tsx +2 -1
  61. package/src/components/TextField/TextField.stories.tsx +6 -5
  62. package/src/hooks/useTextField/useTextField.tsx +3 -3
  63. package/src/utils/index.ts +0 -1
  64. package/src/utils/jestMockMatchMedia.ts +16 -0
  65. package/dist/cjs/utils/StoryContainer.js +0 -39
  66. package/dist/cjs/utils/StoryContainer.js.map +0 -1
  67. package/dist/esm/utils/StoryContainer.js +0 -29
  68. package/dist/esm/utils/StoryContainer.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1aed87a: Modal: add `onOpen` prop and wrap component with `forwardRef`. This is to bring parity between Modal and Drawer which share similar implementation details
8
+
9
+ ### Patch Changes
10
+
11
+ - 66ac8be: Change Storybook url and upload folder
12
+
3
13
  ## 4.2.8
4
14
 
5
15
  ### Patch Changes
@@ -82,7 +82,7 @@ const Drawer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
82
82
  event.stopPropagation();
83
83
  }
84
84
  const doClose = ()=>{
85
- dialog.close();
85
+ dialog === null || dialog === void 0 ? void 0 : dialog.close();
86
86
  onClose === null || onClose === void 0 ? void 0 : onClose();
87
87
  };
88
88
  // Delay close to allow exit animation
@@ -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 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);\n const dialog = modalRef.current as HTMLDialogElement;\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 dialog.close();\n onClose?.();\n };\n\n // Delay close to allow exit animation\n dialog?.classList.add(\"close\");\n dialog?.addEventListener(\n \"animationend\",\n () => {\n dialog.classList.remove(\"close\");\n doClose();\n },\n { once: true },\n );\n },\n [onClose, dialog],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (!supportsDialog() && typeof window !== \"undefined\") {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current as HTMLDialogElement);\n }\n\n if (isOpen) {\n modalRef.current?.showModal();\n onOpen?.();\n } else if (modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose]);\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","forwardRef","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","useRef","modalRef","dialog","current","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","add","addEventListener","remove","once","modalClasses","classNames","useEffect","toggleModal","supportsDialog","window","default","dialogPolyfill","registerDialog","showModal","open","mergeRefs","onCancel","aria-describedby","VisuallyHidden","div","id","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BA6HSA;;;eAAAA;;;;+DA3Hc;uBAWhB;mCAC2B;+BACH;gCACA;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMA,uBAASC,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,EAAoB;IAC3C,MAAME,SAASD,SAASE,OAAO;IAE/B,mBAAmB;IACnB,IAAIP,UAAU,CAACG,UAAUI,OAAO,EAAE;QAChCP;QACAG,UAAUI,OAAO,GAAG;IACtB;IAEAC,IAAAA,oCAAiB,EAAC;QAAEC,SAASd;IAAO;IAEpC,kDAAkD;IAClD,MAAMe,cAAcC,IAAAA,kBAAW,EAC7B,CAACC;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAAME,eAAe;QACvB;QAEA,MAAMC,UAAU;YACdT,OAAOU,KAAK;YACZf,oBAAAA,8BAAAA;QACF;QAEA,sCAAsC;QACtCK,mBAAAA,6BAAAA,OAAQW,SAAS,CAACC,GAAG,CAAC;QACtBZ,mBAAAA,6BAAAA,OAAQa,gBAAgB,CACtB,gBACA;YACEb,OAAOW,SAAS,CAACG,MAAM,CAAC;YACxBL;QACF,GACA;YAAEM,MAAM;QAAK;IAEjB,GACA;QAACpB;QAASK;KAAO;IAGnB,MAAMgB,eAAeC,IAAAA,eAAU,EAC7B,UACA,iBACA,CAAC,EAAE,EAAEzB,UAAU,CAAC,EAChBF;IAGF,+CAA+C;IAC/C4B,IAAAA,gBAAS,EAAC;QACR,eAAeC;gBAUFpB;YATX,IAAI,CAACqB,IAAAA,6BAAc,OAAM,OAAOC,WAAW,aAAa;gBACtD,6DAA6D;gBAC7D,MAAM,EAAEC,SAASC,cAAc,EAAE,GAAG,MAAM,mEAAA,QAAO;gBACjDA,eAAeC,cAAc,CAACzB,SAASE,OAAO;YAChD;YAEA,IAAIZ,QAAQ;oBACVU;iBAAAA,qBAAAA,SAASE,OAAO,cAAhBF,yCAAAA,mBAAkB0B,SAAS;gBAC3B/B,mBAAAA,6BAAAA;YACF,OAAO,KAAIK,oBAAAA,SAASE,OAAO,cAAhBF,wCAAAA,kBAAkB2B,IAAI,EAAE;gBACjCtB;YACF;QACF;QAEAe;IACF,GAAG;QAAC9B;QAAQK;QAAQU;KAAY;IAEhC,qBACE,sBAACJ;QACCZ,KAAKuC,IAAAA,gBAAS,EAAC;YAAC5B;YAAUX;SAAI;QAC9BwC,UAAUxB;QACVd,WAAW0B;QACXa,oBAAiB;;0BAEjB,qBAACC,8BAAc;0BACb,cAAA,qBAACC;oBAAIC,IAAG;8BAA0BvC;;;YAEnCwC,eAAQ,CAACC,GAAG,CAACtC,UAAUuC,CAAAA;gBACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;oBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;wBACzBxC,SAASS;wBACTb;oBACF;gBACF;gBAEA,OAAO4C;YACT;;;AAGN;AAEAlD,OAAOqD,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 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);\n const dialog = modalRef.current as HTMLDialogElement;\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 dialog?.close();\n onClose?.();\n };\n\n // Delay close to allow exit animation\n dialog?.classList.add(\"close\");\n dialog?.addEventListener(\n \"animationend\",\n () => {\n dialog.classList.remove(\"close\");\n doClose();\n },\n { once: true },\n );\n },\n [onClose, dialog],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Drawer\",\n `--${direction}`,\n className,\n );\n\n // Add polyfill for HTML Dialog in old browsers\n useEffect(() => {\n async function toggleModal() {\n if (!supportsDialog() && typeof window !== \"undefined\") {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current as HTMLDialogElement);\n }\n\n if (isOpen) {\n modalRef.current?.showModal();\n onOpen?.();\n } else if (modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose]);\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","forwardRef","props","ref","isOpen","className","closeLabel","direction","announce","onOpen","onClose","children","hasOpened","useRef","modalRef","dialog","current","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","add","addEventListener","remove","once","modalClasses","classNames","useEffect","toggleModal","supportsDialog","window","default","dialogPolyfill","registerDialog","showModal","open","mergeRefs","onCancel","aria-describedby","VisuallyHidden","div","id","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BA6HSA;;;eAAAA;;;;+DA3Hc;uBAWhB;mCAC2B;+BACH;gCACA;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMA,uBAASC,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,EAAoB;IAC3C,MAAME,SAASD,SAASE,OAAO;IAE/B,mBAAmB;IACnB,IAAIP,UAAU,CAACG,UAAUI,OAAO,EAAE;QAChCP;QACAG,UAAUI,OAAO,GAAG;IACtB;IAEAC,IAAAA,oCAAiB,EAAC;QAAEC,SAASd;IAAO;IAEpC,kDAAkD;IAClD,MAAMe,cAAcC,IAAAA,kBAAW,EAC7B,CAACC;QACC,IAAIA,OAAO;YACTA,MAAMC,cAAc;YACpBD,MAAME,eAAe;QACvB;QAEA,MAAMC,UAAU;YACdT,mBAAAA,6BAAAA,OAAQU,KAAK;YACbf,oBAAAA,8BAAAA;QACF;QAEA,sCAAsC;QACtCK,mBAAAA,6BAAAA,OAAQW,SAAS,CAAC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.defineProperty(exports, "Content", {
9
9
  }
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
- const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedupe"));
13
12
  const _react = require("react");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- const Content = /*#__PURE__*/ (0, _react.forwardRef)((// eslint-disable-next-line @typescript-eslint/no-unused-vars
20
- { children, onClose, closeLabel, ...otherProps }, ref)=>{
21
- const classes = (0, _dedupe.default)("mobius/ModalContent");
22
- return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
13
+ const Content = /*#__PURE__*/ (0, _react.forwardRef)(({ children, onClose, closeLabel: _, ...otherProps }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
23
14
  ref: ref,
24
15
  ...otherProps,
25
- className: classes,
16
+ className: "mobius/ModalContent",
26
17
  children: _react.Children.map(children, (child)=>{
27
18
  if (/*#__PURE__*/ (0, _react.isValidElement)(child)) {
28
19
  return /*#__PURE__*/ (0, _react.cloneElement)(child, {
@@ -31,8 +22,7 @@ const Content = /*#__PURE__*/ (0, _react.forwardRef)((// eslint-disable-next-lin
31
22
  }
32
23
  return child;
33
24
  })
34
- });
35
- });
25
+ }));
36
26
  Content.displayName = "Content";
37
27
 
38
28
  //# sourceMappingURL=Content.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Content.tsx"],"sourcesContent":["import classNames from \"classnames/dedupe\";\nimport {\n Children,\n ReactNode,\n Ref,\n RefAttributes,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { DOMProps } from \"../../types/dom\";\n\nexport type DivRef = Ref<HTMLDivElement>;\nexport type DivElementType = HTMLDivElement;\nexport interface ContentProps extends DOMProps, RefAttributes<DivElementType> {\n children?: ReactNode;\n onClose?: () => void;\n closeLabel?: string;\n}\n\nconst Content = forwardRef(\n (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { children, onClose, closeLabel, ...otherProps }: ContentProps,\n ref: DivRef,\n ) => {\n const classes = classNames(\"mobius/ModalContent\");\n\n return (\n <div ref={ref} {...otherProps} className={classes}>\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose,\n } as any);\n }\n\n return child;\n })}\n </div>\n );\n },\n);\n\nContent.displayName = \"Content\";\nexport { Content };\n"],"names":["Content","forwardRef","children","onClose","closeLabel","otherProps","ref","classes","classNames","div","className","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":";;;;+BA6CSA;;;eAAAA;;;;+DA7Cc;uBAShB;;;;;;AAWP,MAAMA,wBAAUC,IAAAA,iBAAU,EACxB,CACE,6DAA6D;AAC7D,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGC,YAA0B,EAC9DC;IAEA,MAAMC,UAAUC,IAAAA,eAAU,EAAC;IAE3B,qBACE,qBAACC;QAAIH,KAAKA;QAAM,GAAGD,UAAU;QAAEK,WAAWH;kBACvCI,eAAQ,CAACC,GAAG,CAACV,UAAUW,CAAAA;YACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;gBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;oBACzBV;gBACF;YACF;YAEA,OAAOU;QACT;;AAGN;AAGFb,QAAQgB,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/Content.tsx"],"sourcesContent":["import {\n Children,\n PropsWithChildren,\n Ref,\n RefAttributes,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { DOMProps } from \"../../types/dom\";\n\nexport type DivRef = Ref<HTMLDivElement>;\nexport type DivElementType = HTMLDivElement;\nexport interface ContentProps\n extends DOMProps,\n RefAttributes<DivElementType>,\n PropsWithChildren {\n onClose?: () => void;\n closeLabel?: string;\n}\n\nconst Content = forwardRef(\n (\n { children, onClose, closeLabel: _, ...otherProps }: ContentProps,\n ref: DivRef,\n ) => (\n <div ref={ref} {...otherProps} className=\"mobius/ModalContent\">\n {Children.map(children, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onClose,\n } as any);\n }\n\n return child;\n })}\n </div>\n ),\n);\n\nContent.displayName = \"Content\";\nexport { Content };\n"],"names":["Content","forwardRef","children","onClose","closeLabel","_","otherProps","ref","div","className","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":";;;;+BAyCSA;;;eAAAA;;;;uBAjCF;AAaP,MAAMA,wBAAUC,IAAAA,iBAAU,EACxB,CACE,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,YAAYC,CAAC,EAAE,GAAGC,YAA0B,EACjEC,oBAEA,qBAACC;QAAID,KAAKA;QAAM,GAAGD,UAAU;QAAEG,WAAU;kBACtCC,eAAQ,CAACC,GAAG,CAACT,UAAUU,CAAAA;YACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;gBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;oBACzBT;gBACF;YACF;YAEA,OAAOS;QACT;;AAKNZ,QAAQe,WAAW,GAAG"}
@@ -10,29 +10,20 @@ Object.defineProperty(exports, "Header", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _react = require("react");
13
- const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedupe"));
14
13
  const _icons = require("@simplybusiness/icons");
15
14
  const _Button = require("../Button");
16
15
  const _Icon = require("../Icon");
17
- function _interop_require_default(obj) {
18
- return obj && obj.__esModule ? obj : {
19
- default: obj
20
- };
21
- }
22
- const Header = /*#__PURE__*/ (0, _react.forwardRef)(({ children, onClose, closeLabel, ...otherProps }, ref)=>{
23
- const classes = (0, _dedupe.default)("mobius/ModalHeader");
24
- const closeClasses = (0, _dedupe.default)("mobius/ModalClose");
25
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)("header", {
16
+ const Header = /*#__PURE__*/ (0, _react.forwardRef)(({ children, onClose, closeLabel, ...otherProps }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)("header", {
26
17
  ref: ref,
27
18
  ...otherProps,
28
- className: classes,
19
+ className: "mobius/ModalHeader",
29
20
  children: [
30
21
  children,
31
22
  /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Button.Button, {
32
23
  "aria-label": "Close",
33
24
  variant: "basic",
34
25
  onPress: onClose,
35
- className: closeClasses,
26
+ className: "mobius/ModalClose",
36
27
  children: [
37
28
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_Icon.Icon, {
38
29
  icon: _icons.cross
@@ -42,8 +33,7 @@ const Header = /*#__PURE__*/ (0, _react.forwardRef)(({ children, onClose, closeL
42
33
  ]
43
34
  })
44
35
  ]
45
- });
46
- });
36
+ }));
47
37
  Header.displayName = "Header";
48
38
 
49
39
  //# sourceMappingURL=Header.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Header.tsx"],"sourcesContent":["import { ReactNode, Ref, RefAttributes, forwardRef } from \"react\";\nimport classNames from \"classnames/dedupe\";\n\nimport { cross } from \"@simplybusiness/icons\";\nimport { DOMProps } from \"../../types/dom\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\n\nexport type HeaderElementType = HTMLDivElement;\nexport type HeaderRef = Ref<HTMLElement>;\n\nexport interface HeaderProps\n extends DOMProps,\n RefAttributes<HeaderElementType> {\n children?: ReactNode;\n onClose?: () => void;\n closeLabel?: string;\n}\n\nconst Header = forwardRef(\n (\n { children, onClose, closeLabel, ...otherProps }: HeaderProps,\n ref: HeaderRef,\n ) => {\n const classes = classNames(\"mobius/ModalHeader\");\n const closeClasses = classNames(\"mobius/ModalClose\");\n\n return (\n <header ref={ref} {...otherProps} className={classes}>\n {children}\n <Button\n aria-label=\"Close\"\n variant=\"basic\"\n onPress={onClose}\n className={closeClasses}\n >\n <Icon icon={cross} /> {closeLabel}\n </Button>\n </header>\n );\n },\n);\n\nHeader.displayName = \"Header\";\nexport { Header };\n"],"names":["Header","forwardRef","children","onClose","closeLabel","otherProps","ref","classes","classNames","closeClasses","header","className","Button","aria-label","variant","onPress","Icon","icon","cross","displayName"],"mappings":";;;;+BA4CSA;;;eAAAA;;;;uBA5CiD;+DACnC;uBAED;wBAEC;sBACF;;;;;;AAarB,MAAMA,uBAASC,IAAAA,iBAAU,EACvB,CACE,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGC,YAAyB,EAC7DC;IAEA,MAAMC,UAAUC,IAAAA,eAAU,EAAC;IAC3B,MAAMC,eAAeD,IAAAA,eAAU,EAAC;IAEhC,qBACE,sBAACE;QAAOJ,KAAKA;QAAM,GAAGD,UAAU;QAAEM,WAAWJ;;YAC1CL;0BACD,sBAACU,cAAM;gBACLC,cAAW;gBACXC,SAAQ;gBACRC,SAASZ;gBACTQ,WAAWF;;kCAEX,qBAACO,UAAI;wBAACC,MAAMC,YAAK;;oBAAI;oBAAEd;;;;;AAI/B;AAGFJ,OAAOmB,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/Header.tsx"],"sourcesContent":["import { PropsWithChildren, Ref, RefAttributes, forwardRef } from \"react\";\n\nimport { cross } from \"@simplybusiness/icons\";\nimport { DOMProps } from \"../../types/dom\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\n\nexport type HeaderElementType = HTMLDivElement;\nexport type HeaderRef = Ref<HTMLElement>;\n\nexport interface HeaderProps\n extends DOMProps,\n RefAttributes<HeaderElementType>,\n PropsWithChildren {\n onClose?: () => void;\n closeLabel?: string;\n}\n\nconst Header = forwardRef(\n (\n { children, onClose, closeLabel, ...otherProps }: HeaderProps,\n ref: HeaderRef,\n ) => (\n <header ref={ref} {...otherProps} className=\"mobius/ModalHeader\">\n {children}\n <Button\n aria-label=\"Close\"\n variant=\"basic\"\n onPress={onClose}\n className=\"mobius/ModalClose\"\n >\n <Icon icon={cross} /> {closeLabel}\n </Button>\n </header>\n ),\n);\n\nHeader.displayName = \"Header\";\nexport { Header };\n"],"names":["Header","forwardRef","children","onClose","closeLabel","otherProps","ref","header","className","Button","aria-label","variant","onPress","Icon","icon","cross","displayName"],"mappings":";;;;+BAsCSA;;;eAAAA;;;;uBAtCyD;uBAE5C;wBAEC;sBACF;AAarB,MAAMA,uBAASC,IAAAA,iBAAU,EACvB,CACE,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGC,YAAyB,EAC7DC,oBAEA,sBAACC;QAAOD,KAAKA;QAAM,GAAGD,UAAU;QAAEG,WAAU;;YACzCN;0BACD,sBAACO,cAAM;gBACLC,cAAW;gBACXC,SAAQ;gBACRC,SAAST;gBACTK,WAAU;;kCAEV,qBAACK,UAAI;wBAACC,MAAMC,YAAK;;oBAAI;oBAAEX;;;;;AAM/BJ,OAAOgB,WAAW,GAAG"}
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-console */ "use client";
1
+ "use client";
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
@@ -14,6 +14,7 @@ const _dedupe = /*#__PURE__*/ _interop_require_default(require("classnames/dedup
14
14
  const _react = require("react");
15
15
  const _useBodyScrollLock = require("../../hooks/useBodyScrollLock");
16
16
  const _polyfilltests = require("../../utils/polyfill-tests");
17
+ const _utils = require("../../utils");
17
18
  function _interop_require_default(obj) {
18
19
  return obj && obj.__esModule ? obj : {
19
20
  default: obj
@@ -60,9 +61,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
60
61
  }
61
62
  return newObj;
62
63
  }
63
- const Modal = ({ isOpen, onClose, children, className, closeLabel, isFullScreen, animation, // Deprecated props below
64
- size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector })=>{
64
+ const Modal = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
65
65
  var _window;
66
+ const { isOpen, onClose, onOpen, children, className, closeLabel, isFullScreen, animation, // Deprecated props below
67
+ size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector } = props;
66
68
  const hasWarnedAboutMissingLabels = (0, _react.useRef)(false);
67
69
  // Handle deprecated props
68
70
  if (!hasWarnedAboutMissingLabels.current) {
@@ -71,9 +73,15 @@ size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector })=>
71
73
  hasWarnedAboutMissingLabels.current = true;
72
74
  }
73
75
  }
76
+ const hasOpened = (0, _react.useRef)(false);
74
77
  const modalRef = (0, _react.useRef)(null);
75
78
  const dialog = modalRef.current;
76
79
  const noPreference = (_window = window) === null || _window === void 0 ? void 0 : _window.matchMedia("(prefers-reduced-motion: no-preference)");
80
+ // Fire onOpen once
81
+ if (onOpen && !hasOpened.current) {
82
+ onOpen();
83
+ hasOpened.current = true;
84
+ }
77
85
  (0, _useBodyScrollLock.useBodyScrollLock)({
78
86
  enabled: isOpen
79
87
  });
@@ -82,21 +90,21 @@ size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector })=>
82
90
  if (event) {
83
91
  event.preventDefault();
84
92
  event.stopPropagation();
85
- const doClose = ()=>{
86
- dialog.close();
87
- onClose === null || onClose === void 0 ? void 0 : onClose();
88
- };
89
- if (animation) {
90
- dialog.classList.add("close");
91
- dialog.addEventListener("animationend", ()=>{
92
- dialog.classList.remove("close");
93
- doClose();
94
- }, {
95
- once: true
96
- });
97
- } else {
93
+ }
94
+ const doClose = ()=>{
95
+ dialog === null || dialog === void 0 ? void 0 : dialog.close();
96
+ onClose === null || onClose === void 0 ? void 0 : onClose();
97
+ };
98
+ if (animation) {
99
+ dialog === null || dialog === void 0 ? void 0 : dialog.classList.add("close");
100
+ dialog === null || dialog === void 0 ? void 0 : dialog.addEventListener("animationend", ()=>{
101
+ dialog.classList.remove("close");
98
102
  doClose();
99
- }
103
+ }, {
104
+ once: true
105
+ });
106
+ } else {
107
+ doClose();
100
108
  }
101
109
  }, [
102
110
  animation,
@@ -122,17 +130,22 @@ size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector })=>
122
130
  if (isOpen) {
123
131
  var _modalRef_current1;
124
132
  (_modalRef_current1 = modalRef.current) === null || _modalRef_current1 === void 0 ? void 0 : _modalRef_current1.showModal();
133
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
125
134
  } else if ((_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : _modalRef_current.open) {
126
- var _modalRef_current2;
127
- (_modalRef_current2 = modalRef.current) === null || _modalRef_current2 === void 0 ? void 0 : _modalRef_current2.close();
135
+ handleClose();
128
136
  }
129
137
  }
130
138
  toggleModal();
131
139
  }, [
132
- isOpen
140
+ isOpen,
141
+ onOpen,
142
+ handleClose
133
143
  ]);
134
144
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("dialog", {
135
- ref: modalRef,
145
+ ref: (0, _utils.mergeRefs)([
146
+ modalRef,
147
+ ref
148
+ ]),
136
149
  onCancel: handleClose,
137
150
  className: modalClasses,
138
151
  children: _react.Children.map(children, (child)=>{
@@ -145,7 +158,7 @@ size, appElement, preventCloseOnEsc, shouldFocusAfterRender, parentSelector })=>
145
158
  return child;
146
159
  })
147
160
  });
148
- };
161
+ });
149
162
  Modal.displayName = "Modal";
150
163
 
151
164
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* eslint-disable no-console */\n\n\"use client\";\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport classNames from \"classnames/dedupe\";\nimport {\n Children,\n ReactEventHandler,\n ReactNode,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { useBodyScrollLock } from \"../../hooks/useBodyScrollLock\";\nimport { supportsDialog } from \"../../utils/polyfill-tests\";\n\nexport interface ModalProps {\n isOpen: boolean;\n onClose?: () => void;\n children?: ReactNode;\n className?: string;\n closeLabel?: string;\n animation?: \"slideUp\" | \"fade\";\n isFullScreen?: boolean;\n /**\n * **Deprecated:** No longer needed\n */\n size?: string;\n /**\n * **Deprecated:** No longer needed\n */\n appElement?: string;\n /**\n * **Deprecated:** No longer needed\n */\n preventCloseOnEsc?: boolean;\n /**\n * **Deprecated:** No longer needed\n */\n shouldFocusAfterRender?: boolean;\n /**\n * **Deprecated:** No longer needed\n */\n parentSelector?: () => HTMLElement;\n}\n\nconst Modal = ({\n isOpen,\n onClose,\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}: ModalProps) => {\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 modalRef = useRef<HTMLDialogElement>(null);\n const dialog = modalRef.current as HTMLDialogElement;\n const noPreference = window?.matchMedia(\n \"(prefers-reduced-motion: no-preference)\",\n );\n\n useBodyScrollLock({ enabled: isOpen });\n\n // Add close handler, to enable closing animations\n const handleClose: ReactEventHandler<HTMLDialogElement> = useCallback(\n event => {\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n\n const doClose = () => {\n dialog.close();\n onClose?.();\n };\n\n if (animation) {\n dialog.classList.add(\"close\");\n dialog.addEventListener(\n \"animationend\",\n () => {\n dialog.classList.remove(\"close\");\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n }\n },\n [animation, dialog, onClose],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--has-reduced-motion\": !noPreference.matches,\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 (!supportsDialog() && typeof window !== \"undefined\") {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current as HTMLDialogElement);\n }\n\n if (isOpen) {\n modalRef.current?.showModal();\n } else if (modalRef.current?.open) {\n modalRef.current?.close();\n }\n }\n\n toggleModal();\n }, [isOpen]);\n\n return (\n <dialog ref={modalRef} onCancel={handleClose} className={modalClasses}>\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","isOpen","onClose","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","window","hasWarnedAboutMissingLabels","useRef","current","console","warn","modalRef","dialog","noPreference","matchMedia","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","add","addEventListener","remove","once","modalClasses","classNames","matches","useEffect","toggleModal","supportsDialog","default","dialogPolyfill","registerDialog","showModal","open","ref","onCancel","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA,6BAA6B,GAE7B;;;;;+BAsKSA;;;eAAAA;;;;+DAnKc;uBAUhB;mCAC2B;+BACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgC/B,MAAMA,QAAQ,CAAC,EACbC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,SAAS,EACT,yBAAyB;AACzBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,sBAAsB,EACtBC,cAAc,EACH;QAoBUC;IAnBrB,MAAMC,8BAA8BC,IAAAA,aAAM,EAAU;IACpD,0BAA0B;IAC1B,IAAI,CAACD,4BAA4BE,OAAO,EAAE;QACxC,IACER,QACAC,cACAC,qBACAC,0BACAC,gBACA;YACAK,QA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I3B,oBAAAA,SAASH,OAAO,cAAhBG,wCAAAA,kBAAkB4B,IAAI,EAAE;oBACjC5B;iBAAAA,qBAAAA,SAASH,OAAO,cAAhBG,yCAAAA,mBAAkBY,KAAK;YACzB;QACF;QAEAU;IACF,GAAG;QAACxC;KAAO;IAEX,qBACE,qBAACmB;QAAO4B,KAAK7B;QAAU8B,UAAUxB;QAAarB,WAAWiC;kBACtDa,eAAQ,CAACC,GAAG,CAAChD,UAAUiD,CAAAA;YACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;gBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;oBACzBlD,SAASuB;oBACTpB;gBACF;YACF;YAEA,OAAO+C;QACT;;AAGN;AAEApD,MAAMuD,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 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);\n const dialog = modalRef.current as HTMLDialogElement;\n const noPreference = window?.matchMedia(\n \"(prefers-reduced-motion: no-preference)\",\n );\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 dialog?.close();\n onClose?.();\n };\n\n if (animation) {\n dialog?.classList.add(\"close\");\n dialog?.addEventListener(\n \"animationend\",\n () => {\n dialog.classList.remove(\"close\");\n doClose();\n },\n { once: true },\n );\n } else {\n doClose();\n }\n },\n [animation, dialog, onClose],\n );\n\n const modalClasses = classNames(\n \"mobius\",\n \"mobius/Modal\",\n {\n animation,\n \"--slide-up\": animation === \"slideUp\",\n \"--fade\": animation === \"fade\",\n \"--has-reduced-motion\": !noPreference.matches,\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 (!supportsDialog() && typeof window !== \"undefined\") {\n // eslint-disable-next-line import/no-extraneous-dependencies\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n dialogPolyfill.registerDialog(modalRef.current as HTMLDialogElement);\n }\n\n if (isOpen) {\n modalRef.current?.showModal();\n onOpen?.();\n } else if (modalRef.current?.open) {\n handleClose();\n }\n }\n\n toggleModal();\n }, [isOpen, onOpen, handleClose]);\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","forwardRef","props","ref","window","isOpen","onClose","onOpen","children","className","closeLabel","isFullScreen","animation","size","appElement","preventCloseOnEsc","shouldFocusAfterRender","parentSelector","hasWarnedAboutMissingLabels","useRef","current","console","warn","hasOpened","modalRef","dialog","noPreference","matchMedia","useBodyScrollLock","enabled","handleClose","useCallback","event","preventDefault","stopPropagation","doClose","close","classList","add","addEventListener","remove","once","modalClasses","classNames","matches","useEffect","toggleModal","supportsDialog","default","dialogPolyfill","registerDialog","showModal","open","mergeRefs","onCancel","Children","map","child","isValidElement","cloneElement","displayName"],"mappings":"AAAA;;;;;+BA2JSA;;;eAAAA;;;;+DAzJc;uBAWhB;mCAC2B;+BACH;uBAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1B,MAAMA,sBAAQC,IAAAA,iBAAU,EAAC,CAACC,OAAmBC;QAqCtBC;IApCrB,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,GAAGf;IACJ,MAAMgB,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,EAAoB;IAC3C,MAAMM,SAASD,SAASJ,OAAO;IAC/B,MAAMM,gBAAetB,UAAAA,oBAAAA,8BAAAA,QAAQuB,UAAU,CACrC;IAGF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IAAI,EAAE;gBACjCtB;YACF;QACF;QAEAgB;IACF,GAAG;QAACzC;QAAQE;QAAQuB;KAAY;IAEhC,qBACE,qBAACL;QACCtB,KAAKkD,IAAAA,gBAAS,EAAC;YAAC7B;YAAUrB;SAAI;QAC9BmD,UAAUxB;QACVrB,WAAWiC;kBAEVa,eAAQ,CAACC,GAAG,CAAChD,UAAUiD,CAAAA;YACtB,kBAAIC,IAAAA,qBAAc,EAACD,QAAQ;gBACzB,qBAAOE,IAAAA,mBAAY,EAACF,OAAO;oBACzBnD,SAASwB;oBACTpB;gBACF;YACF;YAEA,OAAO+C;QACT;;AAGN;AAEAzD,MAAM4D,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import {\n Content,\n DivElementType as ModalContentDivElementType,\n ContentProps as ModalContentProps,\n} from \"./Content\";\nimport {\n Header,\n HeaderElementType as ModalHeaderElementType,\n HeaderProps as ModalHeaderProps,\n} from \"./Header\";\nimport { Modal as ModalComponent, ModalProps } from \"./Modal\";\n\nconst Modal = Object.assign(ModalComponent, {\n Header,\n Content,\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n\nexport type {\n ModalContentDivElementType,\n ModalContentProps,\n ModalHeaderElementType,\n ModalHeaderProps,\n ModalProps,\n};\n"],"names":["Modal","Object","assign","ModalComponent","Header","Content","displayName"],"mappings":";;;;+BAkBSA;;;eAAAA;;;yBAdF;wBAKA;uBAC6C;AAEpD,MAAMA,QAAQC,OAAOC,MAAM,CAACC,YAAc,EAAE;IAC1CC,QAAAA,cAAM;IACNC,SAAAA,gBAAO;AACT;AAEAL,MAAMM,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import {\n Content,\n DivElementType as ModalContentDivElementType,\n ContentProps as ModalContentProps,\n} from \"./Content\";\nimport {\n Header,\n HeaderElementType as ModalHeaderElementType,\n HeaderProps as ModalHeaderProps,\n} from \"./Header\";\nimport { Modal as ModalComponent } from \"./Modal\";\nimport { ModalProps } from \"./types\";\n\nconst Modal = Object.assign(ModalComponent, {\n Header,\n Content,\n});\n\nModal.displayName = \"Modal\";\nexport { Modal };\n\nexport type {\n ModalContentDivElementType,\n ModalContentProps,\n ModalHeaderElementType,\n ModalHeaderProps,\n ModalProps,\n};\n"],"names":["Modal","Object","assign","ModalComponent","Header","Content","displayName"],"mappings":";;;;+BAmBSA;;;eAAAA;;;yBAfF;wBAKA;uBACiC;AAGxC,MAAMA,QAAQC,OAAOC,MAAM,CAACC,YAAc,EAAE;IAC1CC,QAAAA,cAAM;IACNC,SAAAA,gBAAO;AACT;AAEAL,MAAMM,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Modal/types.ts"],"names":[],"mappings":""}
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "useTextField", {
9
9
  }
10
10
  });
11
11
  const _react = require("react");
12
- const _useLabel = require("../useLabel/useLabel");
13
12
  const _spaceDelimitedList = require("../../utils/spaceDelimitedList");
13
+ const _useLabel = require("../useLabel/useLabel");
14
14
  function useTextField(props) {
15
15
  const { isDisabled = false, isReadOnly = false, isRequired = false, inputElementType = "input" } = props;
16
16
  const { labelProps, fieldProps } = (0, _useLabel.useLabel)(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/hooks/useTextField/useTextField.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\":\n props.validationState === \"invalid\"\n ? true\n : props.validationState === \"valid\"\n ? false\n : undefined,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n"],"names":["useTextField","props","isDisabled","isReadOnly","isRequired","inputElementType","labelProps","fieldProps","useLabel","descriptionId","useId","descriptionProps","id","errorMessageId","errorMessageProps","ariaDescribedBy","spaceDelimitedList","description","errorMessage","inputProps","defaultValue","value","onChange","disabled","readOnly","undefined","validationState","type","pattern","autoComplete","maxLength","minLength","name","placeholder","inputMode","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onSelect","onBeforeInput","onInput","onFocus","onBlur"],"mappings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AOnC,MAAMmC,KAAK;YAClBC,SAASpC,MAAMoC,OAAO;YAEtB,qBAAqB;YACrBC,kBAAkBrC,MAAMqC,gBAAgB;YACxCC,oBAAoBtC,MAAMsC,kBAAkB;YAC5CC,qBAAqBvC,MAAMuC,mBAAmB;YAE9C,mBAAmB;YACnBC,UAAUxC,MAAMwC,QAAQ;YAExB,eAAe;YACfC,eAAezC,MAAMyC,aAAa;YAClCC,SAAS1C,MAAM0C,OAAO;YAEtB,eAAe;YACfC,SAAS3C,MAAM2C,OAAO;YACtBC,QAAQ5C,MAAM4C,MAAM;YAEpB,GAAGtC,UAAU;QACf;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/hooks/useTextField/useTextField.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\":\n props.validationState === \"invalid\"\n ? true\n : props.validationState === \"valid\"\n ? false\n : undefined,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n"],"names":["useTextField","props","isDisabled","isReadOnly","isRequired","inputElementType","labelProps","fieldProps","useLabel","descriptionId","useId","descriptionProps","id","errorMessageId","errorMessageProps","ariaDescribedBy","spaceDelimitedList","description","errorMessage","inputProps","defaultValue","value","onChange","disabled","readOnly","undefined","validationState","type","pattern","autoComplete","maxLength","minLength","name","placeholder","inputMode","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onSelect","onBeforeInput","onInput","onFocus","onBlur"],"mappings":";;;;+BAKgBA;;;eAAAA;;;uBALM;oCACa;0BACV;AAGlB,SAASA,aAAaC,KAAwB;IACnD,MAAM,EACJC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,mBAAmB,OAAO,EAC3B,GAAGJ;IACJ,MAAM,EAAEK,UAAU,EAAEC,UAAU,EAAE,GAAGC,IAAAA,kBAAQ,EAACP;IAE5C,MAAMQ,gBAAgBC,IAAAA,YAAK;IAC3B,MAAMC,mBAAmB;QAAEC,IAAIH;IAAc;IAE7C,MAAMI,iBAAiBH,IAAAA,YAAK;IAC5B,MAAMI,oBAAoB;QAAEF,IAAIC;IAAe;IAE/C,MAAME,kBAAkBC,IAAAA,sCAAkB,EAAC;QACzCf,MAAMgB,WAAW,IAAIR;QACrBR,MAAMiB,YAAY,IAAIL;QACtBZ,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