@mirai/ui 1.0.250 → 1.0.251
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.
- package/README.md +1 -0
- package/build/components/Modal/Modal.js +5 -2
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.module.css +18 -4
- package/build/components/Modal/Modal.stories.js +1 -0
- package/build/components/Modal/Modal.stories.js.map +1 -1
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -965,6 +965,7 @@ A modal component receiving the following props:
|
|
|
965
965
|
- `blur:bool` if you want use a _glashmorphism_ effect in the overflow
|
|
966
966
|
- `children:node`
|
|
967
967
|
- `fit:bool` if you want use fit width with the content
|
|
968
|
+
- `mobileBehavior:bool` if you want use mobile behavior
|
|
968
969
|
- `overflow:bool` wraps all modal in a semi-transparent layer
|
|
969
970
|
- `portal:bool` if you want use _portal feature_ of React API
|
|
970
971
|
- `preventDefault:bool` if you want stop the event tunneling (default true)
|
|
@@ -13,7 +13,7 @@ var _helpers = require("../../helpers");
|
|
|
13
13
|
var _hooks = require("../../hooks");
|
|
14
14
|
var _primitives = require("../../primitives");
|
|
15
15
|
var _ModalModule = _interopRequireDefault(require("./Modal.module.css"));
|
|
16
|
-
var _excluded = ["blur", "children", "fit", "overflow", "portal", "preventDefault", "title", "visible", "onBack", "onClose", "onOverflow"];
|
|
16
|
+
var _excluded = ["blur", "children", "fit", "mobileBehavior", "overflow", "portal", "preventDefault", "title", "visible", "onBack", "onClose", "onOverflow"];
|
|
17
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -37,6 +37,8 @@ var Modal = function Modal(_ref) {
|
|
|
37
37
|
children = _ref.children,
|
|
38
38
|
_ref$fit = _ref.fit,
|
|
39
39
|
fit = _ref$fit === void 0 ? false : _ref$fit,
|
|
40
|
+
_ref$mobileBehavior = _ref.mobileBehavior,
|
|
41
|
+
mobileBehavior = _ref$mobileBehavior === void 0 ? false : _ref$mobileBehavior,
|
|
40
42
|
_ref$overflow = _ref.overflow,
|
|
41
43
|
overflow = _ref$overflow === void 0 ? true : _ref$overflow,
|
|
42
44
|
_ref$portal = _ref.portal,
|
|
@@ -93,7 +95,7 @@ var Modal = function Modal(_ref) {
|
|
|
93
95
|
preventDefault: preventDefault,
|
|
94
96
|
role: others.role ? "".concat(others.role, "-overflow") : 'modal-overflow',
|
|
95
97
|
onPress: visible && overflow ? handleOverflow : undefined,
|
|
96
|
-
className: (0, _helpers.styles)(_ModalModule.default.container, overflow && _ModalModule.default.overflow, overflow && blur && _ModalModule.default.blur, visible && _ModalModule.default.visible, onOverflow && _ModalModule.default.onOverflow),
|
|
98
|
+
className: (0, _helpers.styles)(_ModalModule.default.container, isDesktop && mobileBehavior && _ModalModule.default.mobileBehavior, overflow && _ModalModule.default.overflow, overflow && blur && _ModalModule.default.blur, visible && _ModalModule.default.visible, onOverflow && _ModalModule.default.onOverflow),
|
|
97
99
|
style: {
|
|
98
100
|
height: height
|
|
99
101
|
},
|
|
@@ -142,6 +144,7 @@ Modal.propTypes = {
|
|
|
142
144
|
blur: _propTypes.default.bool,
|
|
143
145
|
children: _propTypes.default.node,
|
|
144
146
|
fit: _propTypes.default.bool,
|
|
147
|
+
mobileBehavior: _propTypes.default.bool,
|
|
145
148
|
overflow: _propTypes.default.bool,
|
|
146
149
|
portal: _propTypes.default.bool,
|
|
147
150
|
preventDefault: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","height","ref","useRef","useState","dataset","setDataset","useEffect","handleKeydown","event","key","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","displayName","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n fit = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n if (!visible || !onClose) return;\n\n const handleKeydown = (event) => event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n onOverflow && !ref.current?.contains(target) && onOverflow(event);\n };\n\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View forceRow className={style.header}>\n {onBack && (\n <Button transparent small squared onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n transparent\n small\n squared\n onPress={onClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.displayName = 'Component:Modal';\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","mobileBehavior","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","height","ref","useRef","useState","dataset","setDataset","useEffect","handleKeydown","event","key","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","displayName","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n fit = false,\n mobileBehavior = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n if (!visible || !onClose) return;\n\n const handleKeydown = (event) => event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n onOverflow && !ref.current?.contains(target) && onOverflow(event);\n };\n\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n isDesktop && mobileBehavior && style.mobileBehavior,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View forceRow className={style.header}>\n {onBack && (\n <Button transparent small squared onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n transparent\n small\n squared\n onPress={onClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.displayName = 'Component:Modal';\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n mobileBehavior: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAcL;EAAA,qBAbJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IAAA,gBACRC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,2BACXC,cAAc;IAAdA,cAAc,oCAAG,KAAK;IAAA,qBACtBC,QAAQ;IAARA,QAAQ,8BAAG,IAAI;IAAA,mBACfC,MAAM;IAANA,MAAM,4BAAG,KAAK;IAAA,2BACdC,cAAc;IAAdA,cAAc,oCAAG,IAAI;IACrBC,KAAK,QAALA,KAAK;IACLC,OAAO,QAAPA,OAAO;IACPC,MAAM,QAANA,MAAM;IACNC,OAAO,QAAPA,OAAO;IACPC,UAAU,QAAVA,UAAU;IACPC,MAAM;EAET,iBAA8B,IAAAC,gBAAS,GAAE;IAAjCC,SAAS,cAATA,SAAS;IAAEC,MAAM,cAANA,MAAM;EACzB,IAAMC,GAAG,GAAG,IAAAC,aAAM,GAAE;EAEpB,gBAA8B,IAAAC,eAAQ,GAAE;IAAA;IAAjCC,OAAO;IAAEC,UAAU;EAE1B,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAI,CAACb,OAAO,IAAI,CAACE,OAAO,EAAE;I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S,CAACC,IAAI;EACxB9D,MAAM,EAAE6D,kBAAS,CAACC,IAAI;EACtB7D,cAAc,EAAE4D,kBAAS,CAACC,IAAI;EAC9B5D,KAAK,EAAE2D,kBAAS,CAACG,MAAM;EACvB7D,OAAO,EAAE0D,kBAAS,CAACC,IAAI;EACvB1D,MAAM,EAAEyD,kBAAS,CAACI,IAAI;EACtB5D,OAAO,EAAEwD,kBAAS,CAACI,IAAI;EACvB3D,UAAU,EAAEuD,kBAAS,CAACI;AACxB,CAAC"}
|
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
.container {
|
|
6
6
|
display: flex;
|
|
7
|
-
height:
|
|
7
|
+
height: 100svh;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
left: 0;
|
|
10
10
|
pointer-events: none;
|
|
11
11
|
position: fixed;
|
|
12
|
-
width:
|
|
12
|
+
width: 100svw;
|
|
13
13
|
z-index: var(--mirai-ui-modal-layer);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
.container.mobileBehavior {
|
|
17
|
+
align-items: flex-end;
|
|
18
|
+
align-content: flex-end;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
.container.visible {
|
|
17
23
|
pointer-events: all;
|
|
18
24
|
}
|
|
@@ -54,11 +60,19 @@
|
|
|
54
60
|
box-shadow var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
.container.mobileBehavior .modal {
|
|
64
|
+
transform: translateY(100%);
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
.modal.visible {
|
|
58
68
|
box-shadow: var(--mirai-ui-modal-shadow);
|
|
59
69
|
pointer-events: all;
|
|
60
70
|
}
|
|
61
71
|
|
|
72
|
+
.container.mobileBehavior .modal.visible {
|
|
73
|
+
transform: translateY(0%);
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
.overflow {
|
|
63
77
|
background-color: var(--mirai-ui-modal-overflow);
|
|
64
78
|
opacity: 0;
|
|
@@ -124,7 +138,7 @@
|
|
|
124
138
|
justify-content: flex-end;
|
|
125
139
|
}
|
|
126
140
|
|
|
127
|
-
.modal {
|
|
141
|
+
.modal:not(.mobileMode) {
|
|
128
142
|
border-radius: var(--mirai-ui-modal-border-radius);
|
|
129
143
|
opacity: 0;
|
|
130
144
|
transform: scale(1.1);
|
|
@@ -134,7 +148,7 @@
|
|
|
134
148
|
width: calc(var(--mirai-ui-breakpoint-content) / 3);
|
|
135
149
|
}
|
|
136
150
|
|
|
137
|
-
.modal.visible {
|
|
151
|
+
.modal.visible:not(.mobileMode) {
|
|
138
152
|
opacity: 1;
|
|
139
153
|
transform: scale(1);
|
|
140
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.stories.js","names":["title","Story","props","useState","visible","setVisible","visibleSecond","setVisibleSecond","handleBack","others","console","log","handleClose","handleOverflow","padding","storyName","args","blur","fit","overflow","portal","testId","style","argTypes"],"sources":["../../../src/components/Modal/Modal.stories.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Button, Text, View } from '../../';\nimport { Modal } from './Modal';\n\nexport default {\n title: 'Components',\n};\n\nexport const Story = (props) => {\n const [visible, setVisible] = useState(true);\n const [visibleSecond, setVisibleSecond] = useState(false);\n\n const handleBack = (...others) => {\n console.log('<Modal>::onBack', ...others);\n setVisibleSecond(false);\n };\n\n const handleClose = (...others) => {\n console.log('<Modal>::onClose', ...others);\n setVisible(false);\n };\n\n const handleOverflow = (...others) => {\n console.log('<Modal>::onOverflow', ...others);\n handleClose(others);\n };\n\n return (\n <>\n <Text bold headline>\n What is Lorem Ipsum?\n </Text>\n <Text>\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's\n standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make\n a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,\n remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing\n Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions\n of Lorem Ipsum.\n </Text>\n\n <Button onPress={() => setVisible(true)}>Show modal</Button>\n\n <Text bold headline>\n Where does it come from?\n </Text>\n <Text>\n Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin\n literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney\n College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and\n going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum\n comes from sections 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of Good and Evil) by\n Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance.\n The first line of Lorem Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n </Text>\n\n <Modal {...props} onClose={handleClose} onOverflow={handleOverflow} visible={visible}>\n <View style={{ padding: 'var(--mirai-ui-space-L)' }}>\n <Text>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus\n dolore, facere facilis placeat nostrum unde cumque. Voluptas enim rerum voluptatum, deserunt fugiat\n aspernatur excepturi.\n </Text>\n <Button onPress={() => setVisibleSecond(true)}>Show another Modal</Button>\n </View>\n </Modal>\n\n <Modal {...props} onBack={handleBack} onOverflow={handleOverflow} visible={visibleSecond}>\n <View style={{ padding: 'var(--mirai-ui-space-L)' }}>\n <Text>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus\n dolore, facere facilis placeat nostrum unde cumque. Voluptas enim rerum voluptatum, deserunt fugiat\n aspernatur excepturi.\n </Text>\n </View>\n </Modal>\n </>\n );\n};\nStory.storyName = 'Modal';\n\nStory.args = {\n blur: false,\n fit: false,\n overflow: true,\n portal: false,\n title: 'title',\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"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,MAAI,0wBAQE,eAEP,6BAAC,YAAK,eAAKH,KAAK;IAAE,OAAO,EAAEU,WAAY;IAAC,UAAU,EAAEC,cAAe;IAAC,OAAO,EAAET;EAAQ,iBACnF,6BAAC,MAAI;IAAC,KAAK,EAAE;MAAEU,OAAO,EAAE;IAA0B;EAAE,gBAClD,6BAAC,MAAI,8OAIE,eACP,6BAAC,QAAM;IAAC,OAAO,EAAE;MAAA,OAAMP,gBAAgB,CAAC,IAAI,CAAC;IAAA;EAAC,wBAA4B,CACrE,CACD,eAER,6BAAC,YAAK,eAAKL,KAAK;IAAE,MAAM,EAAEM,UAAW;IAAC,UAAU,EAAEK,cAAe;IAAC,OAAO,EAAEP;EAAc,iBACvF,6BAAC,MAAI;IAAC,KAAK,EAAE;MAAEQ,OAAO,EAAE;IAA0B;EAAE,gBAClD,6BAAC,MAAI,8OAIE,CACF,CACD,CACP;AAEP,CAAC;AAAC;AACFb,KAAK,CAACc,SAAS,GAAG,OAAO;AAEzBd,KAAK,CAACe,IAAI,GAAG;EACXC,IAAI,EAAE,KAAK;EACXC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"Modal.stories.js","names":["title","Story","props","useState","visible","setVisible","visibleSecond","setVisibleSecond","handleBack","others","console","log","handleClose","handleOverflow","padding","storyName","args","blur","fit","mobileBehavior","overflow","portal","testId","style","argTypes"],"sources":["../../../src/components/Modal/Modal.stories.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Button, Text, View } from '../../';\nimport { Modal } from './Modal';\n\nexport default {\n title: 'Components',\n};\n\nexport const Story = (props) => {\n const [visible, setVisible] = useState(true);\n const [visibleSecond, setVisibleSecond] = useState(false);\n\n const handleBack = (...others) => {\n console.log('<Modal>::onBack', ...others);\n setVisibleSecond(false);\n };\n\n const handleClose = (...others) => {\n console.log('<Modal>::onClose', ...others);\n setVisible(false);\n };\n\n const handleOverflow = (...others) => {\n console.log('<Modal>::onOverflow', ...others);\n handleClose(others);\n };\n\n return (\n <>\n <Text bold headline>\n What is Lorem Ipsum?\n </Text>\n <Text>\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's\n standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make\n a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,\n remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing\n Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions\n of Lorem Ipsum.\n </Text>\n\n <Button onPress={() => setVisible(true)}>Show modal</Button>\n\n <Text bold headline>\n Where does it come from?\n </Text>\n <Text>\n Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin\n literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney\n College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and\n going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum\n comes from sections 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of Good and Evil) by\n Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance.\n The first line of Lorem Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n </Text>\n\n <Modal {...props} onClose={handleClose} onOverflow={handleOverflow} visible={visible}>\n <View style={{ padding: 'var(--mirai-ui-space-L)' }}>\n <Text>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus\n dolore, facere facilis placeat nostrum unde cumque. Voluptas enim rerum voluptatum, deserunt fugiat\n aspernatur excepturi.\n </Text>\n <Button onPress={() => setVisibleSecond(true)}>Show another Modal</Button>\n </View>\n </Modal>\n\n <Modal {...props} onBack={handleBack} onOverflow={handleOverflow} visible={visibleSecond}>\n <View style={{ padding: 'var(--mirai-ui-space-L)' }}>\n <Text>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus\n dolore, facere facilis placeat nostrum unde cumque. Voluptas enim rerum voluptatum, deserunt fugiat\n aspernatur excepturi.\n </Text>\n </View>\n </Modal>\n </>\n );\n};\nStory.storyName = 'Modal';\n\nStory.args = {\n blur: false,\n fit: false,\n mobileBehavior: true,\n overflow: true,\n portal: false,\n title: 'title',\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEjB;EACbA,KAAK,EAAE;AACT,CAAC;AAAA;AAEM,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK,EAAK;EAC9B,gBAA8B,IAAAC,eAAQ,EAAC,IAAI,CAAC;IAAA;IAArCC,OAAO;IAAEC,UAAU;EAC1B,iBAA0C,IAAAF,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAlDG,aAAa;IAAEC,gBAAgB;EAEtC,IAAMC,UAAU,GAAG,SAAbA,UAAU,GAAkB;IAAA;IAAA,kCAAXC,MAAM;MAANA,MAAM;IAAA;IAC3B,YAAAC,OAAO,EAACC,GAAG,kBAAC,iBAAiB,SAAKF,MAAM,EAAC;IACzCF,gBAAgB,CAAC,KAAK,CAAC;EACzB,CAAC;EAED,IAAMK,WAAW,GAAG,SAAdA,WAAW,GAAkB;IAAA;IAAA,mCAAXH,MAAM;MAANA,MAAM;IAAA;IAC5B,aAAAC,OAAO,EAACC,GAAG,mBAAC,kBAAkB,SAAKF,MAAM,EAAC;IAC1CJ,UAAU,CAAC,KAAK,CAAC;EACnB,CAAC;EAED,IAAMQ,cAAc,GAAG,SAAjBA,cAAc,GAAkB;IAAA;IAAA,mCAAXJ,MAAM;MAANA,MAAM;IAAA;IAC/B,aAAAC,OAAO,EAACC,GAAG,mBAAC,qBAAqB,SAAKF,MAAM,EAAC;IAC7CG,WAAW,CAACH,MAAM,CAA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
|
|
105
105
|
</DocumentFragment>
|
|
106
106
|
`;
|
|
107
107
|
|
|
108
|
+
exports[`component:<Modal> prop:mobileBehavior 1`] = `
|
|
109
|
+
<DocumentFragment>
|
|
110
|
+
<div
|
|
111
|
+
class="pressable container overflow"
|
|
112
|
+
style="height: 768px;"
|
|
113
|
+
>
|
|
114
|
+
<div
|
|
115
|
+
class="view fit modal calcWidth"
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</DocumentFragment>
|
|
119
|
+
`;
|
|
120
|
+
|
|
108
121
|
exports[`component:<Modal> prop:onBack 1`] = `
|
|
109
122
|
<DocumentFragment>
|
|
110
123
|
<div
|