@mirai/ui 1.0.95 → 1.0.97
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/build/components/InputText/InputText.js +0 -1
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +2 -2
- package/build/components/Modal/Modal.js +1 -1
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.module.css +5 -0
- package/build/components/Modal/Modal.stories.js +0 -1
- package/build/components/Modal/Modal.stories.js.map +1 -1
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +13 -1
- package/build/primitives/ScrollView/ScrollView.js +1 -1
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/package.json +1 -1
|
@@ -99,7 +99,6 @@ var InputText = function InputText(_ref) {
|
|
|
99
99
|
className: _InputTextModule.default.icons
|
|
100
100
|
}, (is.password || is.search) && !disabled && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
101
101
|
tabIndex: -1,
|
|
102
|
-
tag: "button",
|
|
103
102
|
onPress: handlePress
|
|
104
103
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
105
104
|
value: is.password ? password ? _primitives.ICON.EYE_CLOSE : _primitives.ICON.EYE_OPEN : _primitives.ICON.CLOSE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputText.js","names":["InputText","disabled","error","hint","icon","label","showState","success","type","warning","onChange","onEnter","onLeave","others","useState","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","handlePress","is","search","undefined","has","length","stateIcon","styles","style","inputContainer","className","inputBorder","text","withIcon","withValue","ICON","SEARCH","left","input","withLabel","iconLeft","icons","EYE_CLOSE","EYE_OPEN","CLOSE","pressable","getIconState","displayName","propTypes","PropTypes","bool","string","func","multiLine","name","isRequired"],"sources":["../../../src/components/InputText/InputText.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { getIconState, styles } from '../../helpers';\nimport { ICON, Icon, Input, Pressable, Text, View } from '../../primitives';\nimport style from './InputText.module.css';\n\nconst InputText = ({\n disabled,\n error,\n hint,\n icon,\n label,\n showState = true,\n success,\n type,\n warning,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n const [password, setPassword] = useState(true);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = () => {\n setFocus(false);\n onLeave(event);\n };\n\n const handlePress = (event) => {\n if (is.password) setPassword(!password);\n else if (is.search) onChange(undefined, event);\n };\n\n const is = {\n password: type === 'password',\n search: type === 'search',\n };\n\n const has = {\n icon: !!icon || is.search,\n label: !!label,\n value: others.value !== undefined && others.value?.length > 0,\n stateIcon: showState && (error || success || warning),\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n error && style.error,\n focus && !error && style.focus,\n )}\n >\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n focus && style.focus,\n error && style.error,\n has.icon && style.withIcon,\n (focus || error || has.value) && style.withValue,\n )}\n >\n {label}\n </Text>\n )}\n\n {has.icon && (\n <Icon\n value={icon || ICON.SEARCH}\n className={styles(style.icon, style.left, disabled && style.disabled, error && style.error)}\n />\n )}\n\n <Input\n {...others}\n disabled={disabled}\n type={!is.password || password ? type : 'text'}\n value={others.value || ''}\n className={styles(style.input, has.label && style.withLabel, has.icon && style.iconLeft)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n\n {(((is.password || is.search) && !disabled) || has.stateIcon) && (\n <View row className={style.icons}>\n {(is.password || is.search) && !disabled && (\n <Pressable tabIndex={-1}
|
|
1
|
+
{"version":3,"file":"InputText.js","names":["InputText","disabled","error","hint","icon","label","showState","success","type","warning","onChange","onEnter","onLeave","others","useState","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","handlePress","is","search","undefined","has","length","stateIcon","styles","style","inputContainer","className","inputBorder","text","withIcon","withValue","ICON","SEARCH","left","input","withLabel","iconLeft","icons","EYE_CLOSE","EYE_OPEN","CLOSE","pressable","getIconState","displayName","propTypes","PropTypes","bool","string","func","multiLine","name","isRequired"],"sources":["../../../src/components/InputText/InputText.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { getIconState, styles } from '../../helpers';\nimport { ICON, Icon, Input, Pressable, Text, View } from '../../primitives';\nimport style from './InputText.module.css';\n\nconst InputText = ({\n disabled,\n error,\n hint,\n icon,\n label,\n showState = true,\n success,\n type,\n warning,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n const [password, setPassword] = useState(true);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = () => {\n setFocus(false);\n onLeave(event);\n };\n\n const handlePress = (event) => {\n if (is.password) setPassword(!password);\n else if (is.search) onChange(undefined, event);\n };\n\n const is = {\n password: type === 'password',\n search: type === 'search',\n };\n\n const has = {\n icon: !!icon || is.search,\n label: !!label,\n value: others.value !== undefined && others.value?.length > 0,\n stateIcon: showState && (error || success || warning),\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n error && style.error,\n focus && !error && style.focus,\n )}\n >\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n focus && style.focus,\n error && style.error,\n has.icon && style.withIcon,\n (focus || error || has.value) && style.withValue,\n )}\n >\n {label}\n </Text>\n )}\n\n {has.icon && (\n <Icon\n value={icon || ICON.SEARCH}\n className={styles(style.icon, style.left, disabled && style.disabled, error && style.error)}\n />\n )}\n\n <Input\n {...others}\n disabled={disabled}\n type={!is.password || password ? type : 'text'}\n value={others.value || ''}\n className={styles(style.input, has.label && style.withLabel, has.icon && style.iconLeft)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n\n {(((is.password || is.search) && !disabled) || has.stateIcon) && (\n <View row className={style.icons}>\n {(is.password || is.search) && !disabled && (\n <Pressable tabIndex={-1} onPress={handlePress}>\n <Icon\n value={is.password ? (password ? ICON.EYE_CLOSE : ICON.EYE_OPEN) : ICON.CLOSE}\n className={styles(style.icon, style.pressable)}\n />\n </Pressable>\n )}\n\n {has.stateIcon && (\n <Icon\n value={getIconState({ error, success, warning })}\n className={styles(\n style.icon,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n )}\n />\n )}\n </View>\n )}\n </View>\n\n {hint && (\n <Text small className={styles(style.text, style.hint, disabled && style.disabled, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputText.displayName = 'Component:InputText';\n\nInputText.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n icon: PropTypes.func,\n label: PropTypes.string,\n multiLine: PropTypes.bool,\n name: PropTypes.string.isRequired,\n showState: PropTypes.bool,\n success: PropTypes.bool,\n type: PropTypes.string,\n warning: PropTypes.bool,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputText };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3C,IAAMA,SAAS,GAAG,SAAZA,SAAS,OAcT;EAAA;EAAA,IAbJC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,IAAI,QAAJA,IAAI;IACJC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IAA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B5C,QAAQ,EAAE2C,kBAAS,CAACG,IAAI;EACxB7C,OAAO,EAAE0C,kBAAS,CAACG,IAAI;EACvB5C,OAAO,EAAEyC,kBAAS,CAACG;AACrB,CAAC"}
|
|
@@ -294,7 +294,7 @@ exports[`component:<InputText> prop:type 1`] = `
|
|
|
294
294
|
<div
|
|
295
295
|
class="view row icons"
|
|
296
296
|
>
|
|
297
|
-
<
|
|
297
|
+
<div
|
|
298
298
|
class="pressable"
|
|
299
299
|
tabindex="-1"
|
|
300
300
|
>
|
|
@@ -319,7 +319,7 @@ exports[`component:<InputText> prop:type 1`] = `
|
|
|
319
319
|
/>
|
|
320
320
|
</svg>
|
|
321
321
|
</span>
|
|
322
|
-
</
|
|
322
|
+
</div>
|
|
323
323
|
</div>
|
|
324
324
|
</div>
|
|
325
325
|
</div>
|
|
@@ -64,7 +64,7 @@ var Modal = function Modal(_ref) {
|
|
|
64
64
|
} : _reactDom.default.createPortal;
|
|
65
65
|
var testId = others['data-testid'];
|
|
66
66
|
return renderer( /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
67
|
-
className: (0, _helpers.styles)(_ModalModule.default.container, overflow && _ModalModule.default.overflow, overflow && blur && _ModalModule.default.blur, visible && _ModalModule.default.visible),
|
|
67
|
+
className: (0, _helpers.styles)(_ModalModule.default.container, overflow && _ModalModule.default.overflow, overflow && blur && _ModalModule.default.blur, visible && _ModalModule.default.visible, onOverflow && _ModalModule.default.onOverflow),
|
|
68
68
|
onPress: visible && overflow ? onOverflow : undefined,
|
|
69
69
|
"data-testid": testId ? "".concat(testId, "-overflow") : undefined
|
|
70
70
|
}, /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","overflow","portal","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","useState","dataset","setDataset","useEffect","document","body","miraiModal","undefined","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","CLOSE","EXPAND_MORE","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\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 title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop } = useDevice();\n\n const [dataset, setDataset] = useState();\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 renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { ['data-testid']: testId } = others;\n\n return renderer(\n <Pressable\n className={styles(\n style.container,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n )}\n onPress={visible && overflow ? onOverflow : undefined}\n data-testid={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View row className={style.header}>\n {onBack && (\n <Pressable tag=\"button\" onPress={onBack} data-testid={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Pressable>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Pressable tag=\"button\" onPress={onClose} data-testid={testId ? `${testId}-button-close` : undefined}>\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Pressable>\n )}\n </View>\n )}\n {children}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,qBAXJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IAAA,gBACRC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,qBACXC,QAAQ;IAARA,QAAQ,8BAAG,IAAI;IAAA,mBACfC,MAAM;IAANA,MAAM,4BAAG,KAAK;IACdC,KAAK,QAALA,KAAK;IACLC,OAAO,QAAPA,OAAO;IACPC,MAAM,QAANA,MAAM;IACNC,OAAO,QAAPA,OAAO;IACPC,UAAU,QAAVA,UAAU;IACPC,MAAM;EAET,iBAAsB,IAAAC,gBAAS,GAAE;IAAzBC,SAAS,cAATA,SAAS;EAEjB,gBAA8B,IAAAC,eAAQ,GAAE;IAAA;IAAjCC,OAAO;IAAEC,UAAU;EAE1B,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIV,OAAO,IAAI,CAACQ,OAAO,EAAE;MACvBC,UAAU,CAAC,IAAI,CAAC;MAChBE,QAAQ,CAACC,IAAI,CAACJ,OAAO,CAACK,UAAU,GAAG,IAAI;IACzC;IAEA,OAAO,YAAM;MACX,IAAIb,OAAO,IAAIQ,OAAO,EAAE;QACtBC,UAAU,CAACK,SAAS,CAAC;QACrB,OAAOH,QAAQ,CAACC,IAAI,CAACJ,OAAO,CAACK,UAAU;MACzC;IACF,CAAC;EACH,CAAC,EAAE,CAACL,OAAO,EAAER,OAAO,CAAC,CAAC;EAEtB,IAAMe,QAAQ,GAAGC,gBAAO,IAAI,CAAClB,MAAM,GAAG,UAACmB,GAAG;IAAA,OAAKA,GAAG;EAAA,IAAGC,iBAAQ,CAACC,YAAY;EAE1E,IAAyBC,MAAM,GAAKhB,MAAM,CAAjC,aAAa;EAEtB,OAAOW,QAAQ,eACb,6BAAC,qBAAS;IACR,SAAS,EAAE,IAAAM,eAAM,EACfC,oBAAK,CAACC,SAAS,EACf1B,QAAQ,IAAIyB,oBAAK,CAACzB,QAAQ,EAC1BA,QAAQ,IAAIH,IAAI,IAAI4B,oBAAK,CAAC5B,IAAI,EAC9BM,OAAO,IAAIsB,oBAAK,CAACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","overflow","portal","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","useState","dataset","setDataset","useEffect","document","body","miraiModal","undefined","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","CLOSE","EXPAND_MORE","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\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 title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop } = useDevice();\n\n const [dataset, setDataset] = useState();\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 renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { ['data-testid']: testId } = others;\n\n return renderer(\n <Pressable\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 onPress={visible && overflow ? onOverflow : undefined}\n data-testid={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View row className={style.header}>\n {onBack && (\n <Pressable tag=\"button\" onPress={onBack} data-testid={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Pressable>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Pressable tag=\"button\" onPress={onClose} data-testid={testId ? `${testId}-button-close` : undefined}>\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Pressable>\n )}\n </View>\n )}\n {children}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,qBAXJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IAAA,gBACRC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,qBACXC,QAAQ;IAARA,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J,CACG,EACZgB,QAAQ,CAACC,IAAI,CACd;AACH,CAAC;AAAC;AAEFnB,KAAK,CAAC0C,SAAS,GAAG;EAChBzC,IAAI,EAAE0C,kBAAS,CAACC,IAAI;EACpB1C,QAAQ,EAAEyC,kBAAS,CAACE,IAAI;EACxB1C,GAAG,EAAEwC,kBAAS,CAACC,IAAI;EACnBxC,QAAQ,EAAEuC,kBAAS,CAACC,IAAI;EACxBvC,MAAM,EAAEsC,kBAAS,CAACC,IAAI;EACtBtC,KAAK,EAAEqC,kBAAS,CAACG,MAAM;EACvBvC,OAAO,EAAEoC,kBAAS,CAACC,IAAI;EACvBpC,MAAM,EAAEmC,kBAAS,CAACI,IAAI;EACtBtC,OAAO,EAAEkC,kBAAS,CAACI;AACrB,CAAC"}
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
opacity: 0;
|
|
66
66
|
transition: backdrop-filter var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
67
67
|
opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
68
|
+
cursor: none;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
.overflow.visible {
|
|
@@ -75,6 +76,10 @@
|
|
|
75
76
|
backdrop-filter: blur(4px);
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
.onOverflow.visible {
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
/* S */
|
|
79
84
|
@media only screen and (max-width: 430px) {
|
|
80
85
|
.container {
|
|
@@ -69,7 +69,6 @@ var Story = function Story(props) {
|
|
|
69
69
|
headline: true
|
|
70
70
|
}, "Where does it come from?"), /*#__PURE__*/_react.default.createElement(_.Text, null, "Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32."), /*#__PURE__*/_react.default.createElement(_Modal.Modal, _extends({}, props, {
|
|
71
71
|
onClose: handleClose,
|
|
72
|
-
onOverflow: handleOverflow,
|
|
73
72
|
visible: visible
|
|
74
73
|
}), /*#__PURE__*/_react.default.createElement(_.View, {
|
|
75
74
|
style: {
|
|
@@ -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","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) => console.log('<Modal>::onOverflow', ...others);\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}
|
|
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","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) => console.log('<Modal>::onOverflow', ...others);\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} 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 ['data-testid']: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAAgC;AAAA;AAAA;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,WAAY;IAAC,OAAO,EAAER;EAAQ,iBACvD,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;EACRC,IAAI,EAAE,KAAK;EACXC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,KAAK;EACbpB,KAAK,EAAE;AAAO,gCAEb,aAAa,EAAG,YAAY,yCACtB,CAAC,CAAC,eACV;AAEDC,KAAK,CAACoB,QAAQ,GAAG,CAAC,CAAC"}
|
|
@@ -190,7 +190,7 @@ exports[`component:<Modal> prop:onClose 1`] = `
|
|
|
190
190
|
exports[`component:<Modal> prop:onOverflow 1`] = `
|
|
191
191
|
<DocumentFragment>
|
|
192
192
|
<div
|
|
193
|
-
class="pressable container overflow visible"
|
|
193
|
+
class="pressable container overflow visible onOverflow"
|
|
194
194
|
data-testid="mirai-onOverflow-overflow"
|
|
195
195
|
>
|
|
196
196
|
<div
|
|
@@ -247,6 +247,18 @@ exports[`component:<Modal> prop:visible & prop:blur 1`] = `
|
|
|
247
247
|
</DocumentFragment>
|
|
248
248
|
`;
|
|
249
249
|
|
|
250
|
+
exports[`component:<Modal> prop:visible & prop:onOverflow 1`] = `
|
|
251
|
+
<DocumentFragment>
|
|
252
|
+
<div
|
|
253
|
+
class="pressable container overflow visible onOverflow"
|
|
254
|
+
>
|
|
255
|
+
<div
|
|
256
|
+
class="view fit modal calcWidth visible"
|
|
257
|
+
/>
|
|
258
|
+
</div>
|
|
259
|
+
</DocumentFragment>
|
|
260
|
+
`;
|
|
261
|
+
|
|
250
262
|
exports[`component:<Modal> prop:visible & prop:overflow (false) 1`] = `
|
|
251
263
|
<DocumentFragment>
|
|
252
264
|
<div
|
|
@@ -44,7 +44,7 @@ var ScrollView = function ScrollView(_ref) {
|
|
|
44
44
|
var _ref2 = ref || {},
|
|
45
45
|
_ref2$current = _ref2.current,
|
|
46
46
|
current = _ref2$current === void 0 ? {} : _ref2$current;
|
|
47
|
-
if (!current.scrollTo ||
|
|
47
|
+
if (!current.scrollTo || scrollTo === undefined) return;
|
|
48
48
|
current.scrollTo((_current$scrollTo = {}, _defineProperty(_current$scrollTo, horizontal ? 'left' : 'top', scrollTo), _defineProperty(_current$scrollTo, "behavior", behavior), _current$scrollTo));
|
|
49
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
50
|
}, [scrollTo]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.js","names":["ScrollView","behavior","children","height","horizontal","scrollEventThrottle","scrollIndicator","scrollTo","snap","tag","width","onScroll","others","ref","useRef","timeout","useEffect","current","handleScroll","target","clientHeight","clientWidth","scrollHeight","scrollWidth","scrollTop","scrollLeft","x","parseInt","y","offsetX","offsetY","clearTimeout","setTimeout","percentX","percentY","React","createElement","className","styles","style","scrollview","indicator","
|
|
1
|
+
{"version":3,"file":"ScrollView.js","names":["ScrollView","behavior","children","height","horizontal","scrollEventThrottle","scrollIndicator","scrollTo","snap","tag","width","onScroll","others","ref","useRef","timeout","useEffect","current","undefined","handleScroll","target","clientHeight","clientWidth","scrollHeight","scrollWidth","scrollTop","scrollLeft","x","parseInt","y","offsetX","offsetY","clearTimeout","setTimeout","percentX","percentY","React","createElement","className","styles","style","scrollview","indicator","displayName","propTypes","PropTypes","string","node","isRequired","number","bool","func"],"sources":["../../../src/primitives/ScrollView/ScrollView.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef } from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './ScrollView.module.css';\n\nconst ScrollView = ({\n behavior = 'smooth',\n children,\n height,\n horizontal,\n scrollEventThrottle = 16, // * 60fps\n scrollIndicator,\n scrollTo,\n snap = true,\n tag = 'div',\n width,\n onScroll,\n ...others\n}) => {\n const ref = useRef();\n\n let timeout = null;\n\n useEffect(() => {\n const { current = {} } = ref || {};\n if (!current.scrollTo || scrollTo === undefined) return;\n\n current.scrollTo({ [horizontal ? 'left' : 'top']: scrollTo, behavior });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [scrollTo]);\n\n const handleScroll = ({\n target: { clientHeight, clientWidth, scrollHeight, scrollWidth, scrollTop, scrollLeft } = {},\n }) => {\n const x = parseInt(scrollLeft, 10);\n const y = parseInt(scrollTop, 10);\n const offsetX = scrollWidth - clientWidth;\n const offsetY = scrollHeight - clientHeight;\n\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n onScroll({\n x,\n y,\n percentX: offsetX ? parseInt((x * 100) / offsetX, 10) : 0,\n percentY: offsetY ? parseInt((y * 100) / offsetY, 10) : 0,\n });\n }, scrollEventThrottle);\n };\n\n return React.createElement(\n tag,\n {\n ...others,\n ref,\n className: styles(\n style.scrollview,\n snap && style.snap,\n horizontal && style.horizontal,\n scrollIndicator && style.indicator,\n others.className,\n ),\n style: { ...others.style, height, width },\n onScroll: onScroll ? handleScroll : undefined,\n },\n children,\n );\n};\n\nScrollView.displayName = 'Primitive:ScrollView';\n\nScrollView.propTypes = {\n behavior: PropTypes.string,\n children: PropTypes.node.isRequired,\n height: PropTypes.number,\n horizontal: PropTypes.bool,\n scrollEventThrottle: PropTypes.number,\n scrollIndicator: PropTypes.bool,\n scrollTo: PropTypes.number,\n snap: PropTypes.bool,\n tag: PropTypes.string,\n width: P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