@popsure/dirty-swan 0.56.0 → 0.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/cjs/index.js +13 -24
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/modal/bottomModal/index.d.ts +1 -1
  4. package/dist/cjs/lib/components/modal/fullScreenModal/index.d.ts +2 -2
  5. package/dist/cjs/lib/components/modal/genericModal/index.d.ts +16 -14
  6. package/dist/cjs/lib/components/modal/index.d.ts +2 -0
  7. package/dist/cjs/lib/components/modal/index.stories.d.ts +15 -1
  8. package/dist/cjs/lib/components/modal/regularModal/index.d.ts +1 -1
  9. package/dist/esm/components/modal/bottomModal/index.js +4 -8
  10. package/dist/esm/components/modal/bottomModal/index.js.map +1 -1
  11. package/dist/esm/components/modal/fullScreenModal/index.js +4 -8
  12. package/dist/esm/components/modal/fullScreenModal/index.js.map +1 -1
  13. package/dist/esm/components/modal/genericModal/index.js +1 -1
  14. package/dist/esm/components/modal/genericModal/index.js.map +1 -1
  15. package/dist/esm/components/modal/index.stories.js +31 -17
  16. package/dist/esm/components/modal/index.stories.js.map +1 -1
  17. package/dist/esm/components/modal/regularModal/index.js +4 -7
  18. package/dist/esm/components/modal/regularModal/index.js.map +1 -1
  19. package/dist/esm/lib/components/modal/bottomModal/index.d.ts +1 -1
  20. package/dist/esm/lib/components/modal/fullScreenModal/index.d.ts +2 -2
  21. package/dist/esm/lib/components/modal/genericModal/index.d.ts +16 -14
  22. package/dist/esm/lib/components/modal/index.d.ts +2 -0
  23. package/dist/esm/lib/components/modal/index.stories.d.ts +15 -1
  24. package/dist/esm/lib/components/modal/regularModal/index.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/src/lib/components/modal/bottomModal/index.tsx +17 -13
  27. package/src/lib/components/modal/fullScreenModal/index.tsx +19 -15
  28. package/src/lib/components/modal/genericModal/index.tsx +18 -11
  29. package/src/lib/components/modal/index.stories.tsx +92 -87
  30. package/src/lib/components/modal/index.ts +2 -0
  31. package/src/lib/components/modal/regularModal/index.tsx +17 -12
@@ -19,54 +19,68 @@ var story = {
19
19
  component: BottomOrRegularModal,
20
20
  argTypes: {
21
21
  title: {
22
- description: "The title that needs to be displayed on the modal",
22
+ description: 'The title that needs to be displayed on the modal',
23
23
  },
24
24
  isOpen: {
25
- description: "When set to `true`, the modal is displayed. When set to `false` the modal gets removed",
25
+ description: 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',
26
26
  },
27
27
  dismissible: {
28
- description: "The content that gets displayed on the modal",
28
+ description: 'The content that gets displayed on the modal',
29
29
  },
30
30
  className: {
31
31
  description: 'Any additional className',
32
32
  },
33
+ classNames: {
34
+ description: 'Class names for the Modal component and its children elements',
35
+ },
33
36
  size: {
34
37
  description: 'The size of the modal, either large or default.',
35
38
  control: 'radio',
36
39
  options: {
37
40
  default: 'default',
38
41
  large: 'large',
39
- }
42
+ },
40
43
  },
41
44
  children: {
42
45
  description: 'The content that gets displayed on the modal',
43
46
  type: 'text',
44
47
  table: {
45
48
  type: {
46
- summary: 'ReactNode'
47
- }
48
- }
49
+ summary: 'ReactNode',
50
+ },
51
+ },
49
52
  },
50
53
  onClose: {
51
54
  description: 'Callback when the user close the modal',
52
55
  action: true,
53
56
  table: {
54
- category: "Callbacks",
57
+ category: 'Callbacks',
55
58
  },
56
59
  },
57
60
  onModalScroll: {
58
61
  description: 'Callback when the user scroll the modal',
59
62
  action: true,
60
63
  table: {
61
- category: "Callbacks",
62
- }
63
- }
64
+ category: 'Callbacks',
65
+ },
66
+ },
64
67
  },
65
68
  args: {
66
- title: "Modal title",
69
+ title: 'Modal title',
67
70
  isOpen: false,
68
71
  dismissible: true,
69
72
  className: '',
73
+ classNames: {
74
+ wrapper: '',
75
+ container: '',
76
+ overlay: '',
77
+ header: '',
78
+ closeButton: '',
79
+ closeButtonIcon: '',
80
+ title: '',
81
+ body: '',
82
+ footer: '',
83
+ },
70
84
  children: 'Modal content to be displayed',
71
85
  size: 'default',
72
86
  },
@@ -75,18 +89,18 @@ var story = {
75
89
  docs: {
76
90
  description: {
77
91
  component: 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',
78
- }
92
+ },
79
93
  },
80
94
  },
81
95
  };
82
96
  var BottomOrRegularModalStory = function (_a) {
83
- var children = _a.children, className = _a.className, dismissible = _a.dismissible, isOpen = _a.isOpen, onClose = _a.onClose, onModalScroll = _a.onModalScroll, size = _a.size, title = _a.title;
97
+ var children = _a.children, className = _a.className, classNames = _a.classNames, dismissible = _a.dismissible, isOpen = _a.isOpen, onClose = _a.onClose, onModalScroll = _a.onModalScroll, size = _a.size, title = _a.title;
84
98
  var _b = useState(isOpen), display = _b[0], setDisplay = _b[1];
85
99
  var handleOnClose = function () {
86
100
  onClose();
87
101
  setDisplay(false);
88
102
  };
89
- return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: dismissible, className: className, title: title, isOpen: display, size: size, onModalScroll: onModalScroll, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
103
+ return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: dismissible, className: className, classNames: classNames, title: title, isOpen: display, size: size, onModalScroll: onModalScroll, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
90
104
  };
91
105
  BottomOrRegularModalStory.storyName = 'BottomOrRegularModal';
92
106
  var RegularModalStory = function (_a) {
@@ -135,7 +149,7 @@ var ModalWithFooter = function (_a) {
135
149
  onClose();
136
150
  setDisplay(false);
137
151
  };
138
- return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: (jsxs("div", { className: 'd-flex fd-row gap8', children: [jsx(Button, { variant: 'textColor', className: 'w100', onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: 'w100', onClick: handleOnClose, children: "Continue" })] })), children: jsx("div", { className: 'p24', children: jsx("div", { children: children }) }) })] }));
152
+ return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textColor", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsx("div", { children: children }) }) })] }));
139
153
  };
140
154
  var ModalWithFooterAndScroll = function (_a) {
141
155
  var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
@@ -144,7 +158,7 @@ var ModalWithFooterAndScroll = function (_a) {
144
158
  onClose();
145
159
  setDisplay(false);
146
160
  };
147
- return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: (jsxs("div", { className: 'd-flex fd-row gap8', children: [jsx(Button, { variant: 'textColor', className: 'w100', onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: 'w100', onClick: handleOnClose, children: "Continue" })] })), children: jsx("div", { className: 'p24', children: jsxs("div", { children: ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.", jsx("div", { style: { height: '840px' } }), children] }) }) })] }));
161
+ return (jsxs(Fragment, { children: [jsx("button", { className: "d-flex p-btn--primary wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textColor", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsxs("div", { children: ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.", jsx("div", { style: { height: '840px' } }), children] }) }) })] }));
148
162
  };
149
163
 
150
164
  export default story;
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["\nimport { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: \"The title that needs to be displayed on the modal\",\n },\n isOpen: {\n description: \"When set to `true`, the modal is displayed. When set to `false` the modal gets removed\",\n },\n dismissible: {\n description: \"The content that gets displayed on the modal\",\n },\n className: {\n description: 'Any additional className',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n }\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode'\n }\n }\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: \"Callbacks\",\n }\n }\n },\n args: {\n title: \"Modal title\",\n isOpen: false,\n dismissible: true,\n className: '',\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle: 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component: 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n }\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>\n {children}\n </div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n}\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left \"X\" icon. \n If you want to use it for Mobile only, you should check BottomModal instead.\n Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.\n\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <RegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>\n {children}\n </div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n}\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left \"X\" icon.\n If you want to use it for Desktop only, you should check Regular modal instead.\n Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.\n\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>\n {children}\n </div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n}\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The modal will cover the entire screen and the user will be able to dismiss them using the top left \"X\" icon. \n\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <FullScreenModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>\n {children}\n </div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n}\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with the modal options.\n\n <strong>Warning:</strong> a modal with the dismissible prop can only be closed by changing the isOpen prop to false.\n\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>\n {children}\n </div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n}\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={(\n <div className='d-flex fd-row gap8'>\n <Button variant='textColor' className='w100' onClick={handleOnClose}>\n Skip\n </Button>\n <Button className='w100' onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n )}\n >\n <div className='p24'>\n <div>\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n}\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={(\n <div className='d-flex fd-row gap8'>\n <Button variant='textColor' className='w100' onClick={handleOnClose}>\n Skip\n </Button>\n <Button className='w100' onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n )}\n >\n <div className='p24'>\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n}\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAMM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE;YACN,WAAW,EAAE,wFAAwF;SACtG;QACD,WAAW,EAAE;YACX,WAAW,EAAE,8CAA8C;SAC5D;QACD,SAAS,EAAE;YACT,WAAW,EAAE,0BAA0B;SACxC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,OAAO;aACf;SACF;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,8CAA8C;YAC3D,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE;gBACL,IAAI,EAAE;oBACF,OAAO,EAAE,WAAW;iBACvB;aACF;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,wCAAwC;YACrD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;QACD,aAAa,EAAE;YACb,WAAW,EAAE,yCAAyC;YACtD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;KACF;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,KAAK;QACb,WAAW,EA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AQ,GACL,GACF,GACe,IACtB,EACH;AACJ,EAAC;IAEY,wBAAwB,GAAG,UAAC,EAKjC;QAJN,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,OAAO,aAAA,EACP,KAAK,WAAA;IAEC,IAAA,KAAwB,QAAQ,CAAC,MAAM,CAAC,EAAvC,OAAO,QAAA,EAAE,UAAU,QAAoB,CAAC;IAC/C,IAAM,aAAa,GAAG;QACpB,OAAO,EAAE,CAAC;QACV,UAAU,CAAC,KAAK,CAAC,CAAC;KACnB,CAAC;IAEF,QACED,4BACEC,gBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,GAAA,oCAGxB,EAETA,IAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,GACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,qBAE1D,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,CACP,YAEDA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
1
+ {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: 'The title that needs to be displayed on the modal',\n },\n isOpen: {\n description:\n 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',\n },\n dismissible: {\n description: 'The content that gets displayed on the modal',\n },\n className: {\n description: 'Any additional className',\n },\n classNames: {\n description:\n 'Class names for the Modal component and its children elements',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n },\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode',\n },\n },\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n },\n args: {\n title: 'Modal title',\n isOpen: false,\n dismissible: true,\n className: '',\n classNames: {\n wrapper: '',\n container: '',\n overlay: '',\n header: '',\n closeButton: '',\n closeButtonIcon: '',\n title: '',\n body: '',\n footer: '',\n },\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle:\n 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component:\n 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n },\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n classNames,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n classNames={classNames}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet\n environment. The modal will appear in the middle of the screen and the\n user will be able to dismiss them using the top left \"X\" icon. If you want\n to use it for Mobile only, you should check BottomModal instead. Want to\n use either Regular Modal or Bottom Modal based on the screen width? You\n can use Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <RegularModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n};\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The\n modal will appear from the bottom of the screen and the user will be able\n to dismiss them using the top left \"X\" icon. If you want to use it for\n Desktop only, you should check Regular modal instead. Want to use either\n Regular Modal or Bottom Modal based on the screen width? You can use\n Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n};\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The\n modal will cover the entire screen and the user will be able to dismiss\n them using the top left \"X\" icon.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <FullScreenModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n};\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and\n prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with\n the modal options.\n <strong>Warning:</strong> a modal with the dismissible prop can only be\n closed by changing the isOpen prop to false.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>{children}</div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE;YACN,WAAW,EACT,wFAAwF;SAC3F;QACD,WAAW,EAAE;YACX,WAAW,EAAE,8CAA8C;SAC5D;QACD,SAAS,EAAE;YACT,WAAW,EAAE,0BAA0B;SACxC;QACD,UAAU,EAAE;YACV,WAAW,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CAAC,CAAC;KACnB,CAAC;IAEF,QACED,4BACEC,gBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,GAAA,oCAGxB,EAETA,IAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,EACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,qBAGf,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,YAGRA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
@@ -15,17 +15,14 @@ var styles = {"wrapper":"style-module_wrapper__qQirD","appear-in":"style-module_
15
15
  styleInject(css_248z);
16
16
 
17
17
  var RegularModal = function (_a) {
18
- var _b = _a.className, className = _b === void 0 ? '' : _b, size = _a.size, rest = __rest(_a, ["className", "size"]);
19
- return (jsx(GenericModal, __assign({ classNames: {
20
- wrapper: function (_a) {
18
+ var _b = _a.className, className = _b === void 0 ? '' : _b, classNames$1 = _a.classNames, size = _a.size, rest = __rest(_a, ["className", "classNames", "size"]);
19
+ return (jsx(GenericModal, __assign({ classNames: __assign(__assign({}, classNames$1), { wrapper: function (_a) {
21
20
  var _b;
22
21
  var isClosing = _a.isClosing;
23
- return classNames('d-flex ai-center w90 mx-auto my0', className, styles.wrapper, (_b = {},
22
+ return classNames('d-flex ai-center w90 mx-auto my0', className, styles.wrapper, classNames$1 === null || classNames$1 === void 0 ? void 0 : classNames$1.wrapper, (_b = {},
24
23
  _b[styles.wrapperClose] = isClosing,
25
24
  _b));
26
- },
27
- container: classNames('bg-white br8 d-flex ai-center fd-column mx-auto my0', styles.container, size === 'large' ? 'wmx10' : 'wmx8')
28
- } }, rest)));
25
+ }, container: classNames('bg-white br8 d-flex ai-center fd-column mx-auto my0', styles.container, size === 'large' ? 'wmx10' : 'wmx8', classNames$1 === null || classNames$1 === void 0 ? void 0 : classNames$1.container) }) }, rest)));
29
26
  };
30
27
 
31
28
  export { RegularModal };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/modal/regularModal/index.tsx"],"sourcesContent":["import { Props } from '..';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\nimport { GenericModal } from '../genericModal';\n\nconst RegularModal = ({ className = '', size, ...rest }: Props) => (\n <GenericModal\n classNames={{\n wrapper: ({ isClosing }) => classNames(\n 'd-flex ai-center w90 mx-auto my0',\n className,\n styles.wrapper, {\n [styles.wrapperClose]: isClosing,\n }\n ),\n container: classNames(\n 'bg-white br8 d-flex ai-center fd-column mx-auto my0',\n styles.container,\n size === 'large' ? 'wmx10' : 'wmx8'\n )\n }}\n {...rest}\n />\n);\n\nexport { RegularModal };\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,YAAY,GAAG,UAAC,EAAwC;IAAtC,IAAA,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA,EAAE,IAAI,UAAA,EAAK,IAAI,cAA/B,qBAAiC,CAAF;IAAc,QACjEA,IAAC,YAAY,aACX,UAAU,EAAE;YACV,OAAO,EAAE,UAAC,EAAa;;oBAAX,SAAS,eAAA;gBAAO,OAAA,UAAU,CACpC,kCAAkC,EAClC,SAAS,EACT,MAAM,CAAC,OAAO;oBACZ,GAAC,MAAM,CAAC,YAAY,IAAG,SAAS;wBAEnC;aAAA;YACD,SAAS,EAAE,UAAU,CACnB,qDAAqD,EACrD,MAAM,CAAC,SAAS,EAChB,IAAI,KAAK,OAAO,GAAG,OAAO,GAAG,MAAM,CACpC;SACF,IACG,IAAI,EACR,EACH;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/modal/regularModal/index.tsx"],"sourcesContent":["import { Props } from '..';\nimport styles from './style.module.scss';\nimport classNamesUtil from 'classnames';\nimport { GenericModal } from '../genericModal';\n\nconst RegularModal = ({ className = '', classNames, size, ...rest }: Props) => (\n <GenericModal\n classNames={{\n ...classNames,\n wrapper: ({ isClosing }) =>\n classNamesUtil(\n 'd-flex ai-center w90 mx-auto my0',\n className,\n styles.wrapper,\n classNames?.wrapper,\n {\n [styles.wrapperClose]: isClosing,\n }\n ),\n container: classNamesUtil(\n 'bg-white br8 d-flex ai-center fd-column mx-auto my0',\n styles.container,\n size === 'large' ? 'wmx10' : 'wmx8',\n classNames?.container\n ),\n }}\n {...rest}\n />\n);\n\nexport { RegularModal };\n"],"names":["classNames","_jsx","classNamesUtil"],"mappings":";;;;;;;;;;;;;;;;IAKM,YAAY,GAAG,UAAC,EAAoD;IAAlD,IAAA,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA,EAAEA,YAAU,gBAAA,EAAE,IAAI,UAAA,EAAK,IAAI,cAA3C,mCAA6C,CAAF;IAAc,QAC7EC,IAAC,YAAY,aACX,UAAU,wBACLD,YAAU,KACb,OAAO,EAAE,UAAC,EAAa;;oBAAX,SAAS,eAAA;gBACnB,OAAAE,UAAc,CACZ,kCAAkC,EAClC,SAAS,EACT,MAAM,CAAC,OAAO,EACdF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,OAAO;oBAEjB,GAAC,MAAM,CAAC,YAAY,IAAG,SAAS;wBAEnC;aAAA,EACH,SAAS,EAAEE,UAAc,CACvB,qDAAqD,EACrD,MAAM,CAAC,SAAS,EAChB,IAAI,KAAK,OAAO,GAAG,OAAO,GAAG,MAAM,EACnCF,YAAU,aAAVA,YAAU,uBAAVA,YAAU,CAAE,SAAS,CACtB,OAEC,IAAI,EACR,EACH;;;;;"}
@@ -1,3 +1,3 @@
1
1
  import { Props } from '..';
2
- declare const BottomModal: ({ className, ...rest }: Props) => JSX.Element;
2
+ declare const BottomModal: ({ className, classNames, ...rest }: Props) => JSX.Element;
3
3
  export { BottomModal };
@@ -1,3 +1,3 @@
1
- import { Props } from "..";
2
- declare const FullScreenModal: ({ className, ...rest }: Props) => JSX.Element;
1
+ import { Props } from '..';
2
+ declare const FullScreenModal: ({ className, classNames, ...rest }: Props) => JSX.Element;
3
3
  export { FullScreenModal };
@@ -1,19 +1,21 @@
1
1
  import { Props } from '..';
2
+ export interface GenericModalClassNames {
3
+ wrapper?: string | (({ isClosing }: {
4
+ isClosing: boolean;
5
+ }) => string);
6
+ container?: string | (({ isClosing }: {
7
+ isClosing: boolean;
8
+ }) => string);
9
+ overlay?: string;
10
+ header?: string;
11
+ closeButton?: string;
12
+ closeButtonIcon?: string;
13
+ title?: string;
14
+ body?: string;
15
+ footer?: string;
16
+ }
2
17
  interface GenericModalProps extends Props {
3
- classNames?: {
4
- wrapper?: string | (({ isClosing }: {
5
- isClosing: boolean;
6
- }) => string);
7
- container?: string | (({ isClosing }: {
8
- isClosing: boolean;
9
- }) => string);
10
- overlay?: string;
11
- header?: string;
12
- closeButton?: string;
13
- title?: string;
14
- body?: string;
15
- footer?: string;
16
- };
18
+ classNames?: GenericModalClassNames;
17
19
  titleSize?: 'small' | 'default';
18
20
  }
19
21
  export declare const GenericModal: (props: GenericModalProps) => JSX.Element | null;
@@ -3,6 +3,7 @@ import { RegularModal } from './regularModal';
3
3
  import { BottomOrRegularModal } from './bottomOrRegularModal';
4
4
  import { FullScreenModal } from './fullScreenModal';
5
5
  import { ReactNode } from 'react';
6
+ import { GenericModalClassNames } from './genericModal';
6
7
  export interface Props {
7
8
  title?: ReactNode;
8
9
  isOpen: boolean;
@@ -10,6 +11,7 @@ export interface Props {
10
11
  onClose: () => void;
11
12
  onModalScroll?: (scrollTop: number, element: HTMLDivElement) => void;
12
13
  className?: string;
14
+ classNames?: GenericModalClassNames;
13
15
  dismissible?: boolean;
14
16
  size?: 'default' | 'large';
15
17
  footer?: ReactNode;
@@ -15,6 +15,9 @@ declare const story: {
15
15
  className: {
16
16
  description: string;
17
17
  };
18
+ classNames: {
19
+ description: string;
20
+ };
18
21
  size: {
19
22
  description: string;
20
23
  control: string;
@@ -52,6 +55,17 @@ declare const story: {
52
55
  isOpen: boolean;
53
56
  dismissible: boolean;
54
57
  className: string;
58
+ classNames: {
59
+ wrapper: string;
60
+ container: string;
61
+ overlay: string;
62
+ header: string;
63
+ closeButton: string;
64
+ closeButtonIcon: string;
65
+ title: string;
66
+ body: string;
67
+ footer: string;
68
+ };
55
69
  children: string;
56
70
  size: string;
57
71
  };
@@ -65,7 +79,7 @@ declare const story: {
65
79
  };
66
80
  };
67
81
  export declare const BottomOrRegularModalStory: {
68
- ({ children, className, dismissible, isOpen, onClose, onModalScroll, size, title, }: Props): JSX.Element;
82
+ ({ children, className, classNames, dismissible, isOpen, onClose, onModalScroll, size, title, }: Props): JSX.Element;
69
83
  storyName: string;
70
84
  };
71
85
  export declare const RegularModalStory: {
@@ -1,3 +1,3 @@
1
1
  import { Props } from '..';
2
- declare const RegularModal: ({ className, size, ...rest }: Props) => JSX.Element;
2
+ declare const RegularModal: ({ className, classNames, size, ...rest }: Props) => JSX.Element;
3
3
  export { RegularModal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.56.0",
3
+ "version": "0.56.1",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,24 +1,28 @@
1
1
  import { Props } from '..';
2
2
  import styles from './style.module.scss';
3
- import classNames from 'classnames';
3
+ import classNamesUtil from 'classnames';
4
4
  import { GenericModal } from '../genericModal';
5
5
 
6
- const BottomModal = ({ className, ...rest }: Props) => (
6
+ const BottomModal = ({ className, classNames, ...rest }: Props) => (
7
7
  <GenericModal
8
- titleSize='small'
8
+ titleSize="small"
9
9
  classNames={{
10
- wrapper: classNames('w100', styles.wrapper),
11
- container: ({ isClosing }) => classNames(
12
- 'bg-white d-flex fd-column w100',
13
- className,
14
- styles.container, {
15
- [styles.containerClose]: isClosing,
16
- }
17
- ),
18
- body: styles.body,
10
+ ...classNames,
11
+ wrapper: classNamesUtil('w100', styles.wrapper, classNames?.wrapper),
12
+ container: ({ isClosing }) =>
13
+ classNamesUtil(
14
+ 'bg-white d-flex fd-column w100',
15
+ className,
16
+ styles.container,
17
+ classNames?.container,
18
+ {
19
+ [styles.containerClose]: isClosing,
20
+ }
21
+ ),
22
+ body: classNamesUtil(styles.body, classNames?.body),
19
23
  }}
20
24
  {...rest}
21
25
  />
22
26
  );
23
27
 
24
- export { BottomModal };
28
+ export { BottomModal };
@@ -1,24 +1,28 @@
1
- import { Props } from "..";
2
- import styles from "./style.module.scss";
3
- import classNames from "classnames";
4
- import { GenericModal } from "../genericModal";
1
+ import { Props } from '..';
2
+ import styles from './style.module.scss';
3
+ import classNamesUtil from 'classnames';
4
+ import { GenericModal } from '../genericModal';
5
5
 
6
- const FullScreenModal = ({ className, ...rest }: Props) => (
6
+ const FullScreenModal = ({ className, classNames, ...rest }: Props) => (
7
7
  <GenericModal
8
8
  titleSize="small"
9
9
  classNames={{
10
- wrapper: "w100",
11
- container: ({ isClosing }) => classNames(
12
- "bg-white d-flex fd-column w100",
13
- className,
14
- styles.container, {
15
- [styles.containerClose]: isClosing,
16
- }
17
- ),
18
- body: styles.body,
10
+ ...classNames,
11
+ wrapper: classNamesUtil(classNames?.wrapper, 'w100'),
12
+ container: ({ isClosing }) =>
13
+ classNamesUtil(
14
+ 'bg-white d-flex fd-column w100',
15
+ className,
16
+ styles.container,
17
+ classNames?.container,
18
+ {
19
+ [styles.containerClose]: isClosing,
20
+ }
21
+ ),
22
+ body: classNamesUtil(styles.body, classNames?.body),
19
23
  }}
20
24
  {...rest}
21
25
  />
22
26
  );
23
27
 
24
- export { FullScreenModal };
28
+ export { FullScreenModal };
@@ -8,17 +8,19 @@ import { XIcon } from '../../icon';
8
8
  import { useRef, useEffect } from 'react';
9
9
  import FocusLock from 'react-focus-lock';
10
10
 
11
+ export interface GenericModalClassNames {
12
+ wrapper?: string | (({ isClosing }: { isClosing: boolean }) => string);
13
+ container?: string | (({ isClosing }: { isClosing: boolean }) => string);
14
+ overlay?: string;
15
+ header?: string;
16
+ closeButton?: string;
17
+ closeButtonIcon?: string;
18
+ title?: string;
19
+ body?: string;
20
+ footer?: string;
21
+ }
11
22
  interface GenericModalProps extends Props {
12
- classNames?: {
13
- wrapper?: string | (({ isClosing }: { isClosing: boolean }) => string);
14
- container?: string | (({ isClosing }: { isClosing: boolean }) => string);
15
- overlay?: string;
16
- header?: string;
17
- closeButton?: string;
18
- title?: string;
19
- body?: string;
20
- footer?: string;
21
- };
23
+ classNames?: GenericModalClassNames;
22
24
  titleSize?: 'small' | 'default';
23
25
  }
24
26
 
@@ -105,7 +107,12 @@ const InnerModal = ({
105
107
  {dismissible && (
106
108
  <Button
107
109
  hideLabel
108
- leftIcon={<XIcon color="grey-700" />}
110
+ leftIcon={
111
+ <XIcon
112
+ color="grey-700"
113
+ className={classNames?.closeButtonIcon}
114
+ />
115
+ }
109
116
  onClick={handleOnClose}
110
117
  type="button"
111
118
  variant="textColor"