@mirai/ui 1.0.24 → 1.0.27
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/Calendar/Calendar.Month.js +2 -2
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.js +10 -6
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +7 -6
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +72 -72
- package/build/components/Menu/Menu.js +3 -1
- package/build/components/Menu/Menu.js.map +1 -1
- package/build/components/Menu/Menu.module.css +1 -1
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +2 -2
- package/build/components/Modal/Modal.js +23 -7
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.module.css +81 -31
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +135 -47
- package/build/components/Tooltip/Tooltip.js +3 -1
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/primitives/Layer/Layer.js +7 -4
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/Layer.module.css +5 -2
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +39 -4
- package/build/theme/default.theme.css +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ var _primitives = require("../../primitives");
|
|
|
17
17
|
|
|
18
18
|
var _ModalModule = _interopRequireDefault(require("./Modal.module.css"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["children", "visible", "onClose"];
|
|
20
|
+
var _excluded = ["children", "overflow", "title", "visible", "onBack", "onClose"];
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
@@ -29,7 +29,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
29
|
|
|
30
30
|
var Modal = function Modal(_ref) {
|
|
31
31
|
var children = _ref.children,
|
|
32
|
+
_ref$overflow = _ref.overflow,
|
|
33
|
+
overflow = _ref$overflow === void 0 ? true : _ref$overflow,
|
|
34
|
+
title = _ref.title,
|
|
32
35
|
visible = _ref.visible,
|
|
36
|
+
onBack = _ref.onBack,
|
|
33
37
|
onClose = _ref.onClose,
|
|
34
38
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
35
39
|
|
|
@@ -38,24 +42,36 @@ var Modal = function Modal(_ref) {
|
|
|
38
42
|
|
|
39
43
|
return /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
40
44
|
row: true,
|
|
41
|
-
className: (0, _helpers.styles)(_ModalModule.default.overflow, visible && _ModalModule.default.visible)
|
|
45
|
+
className: (0, _helpers.styles)(_ModalModule.default.container, overflow && _ModalModule.default.overflow, visible && _ModalModule.default.visible)
|
|
42
46
|
}, /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
|
|
43
47
|
fit: true,
|
|
44
48
|
className: (0, _helpers.styles)(_ModalModule.default.modal, visible && _ModalModule.default.visible, others.className)
|
|
45
|
-
}),
|
|
46
|
-
|
|
49
|
+
}), (title || onBack || onClose) && /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
50
|
+
row: true,
|
|
51
|
+
className: _ModalModule.default.header
|
|
52
|
+
}, onBack && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
53
|
+
onPress: onBack
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
55
|
+
name: "Left",
|
|
56
|
+
className: _ModalModule.default.icon
|
|
57
|
+
})), title && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
58
|
+
headline: true,
|
|
59
|
+
className: (0, _helpers.styles)(_ModalModule.default.title, !onBack && _ModalModule.default.left, !onClose && _ModalModule.default.right)
|
|
60
|
+
}, title), onClose && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
47
61
|
onPress: onClose
|
|
48
62
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
49
|
-
name: isDesktop ? 'Close' : 'CloseArrow',
|
|
63
|
+
name: isDesktop || title !== undefined ? 'Close' : 'CloseArrow',
|
|
50
64
|
className: _ModalModule.default.icon
|
|
51
|
-
})), children))
|
|
65
|
+
}))), children));
|
|
52
66
|
};
|
|
53
67
|
|
|
54
68
|
exports.Modal = Modal;
|
|
55
|
-
Modal.displayName = 'Component:Modal';
|
|
56
69
|
Modal.propTypes = {
|
|
57
70
|
children: _propTypes.default.node,
|
|
71
|
+
overflow: _propTypes.default.bool,
|
|
72
|
+
title: _propTypes.default.string,
|
|
58
73
|
visible: _propTypes.default.bool,
|
|
74
|
+
onBack: _propTypes.default.func,
|
|
59
75
|
onClose: _propTypes.default.func
|
|
60
76
|
};
|
|
61
77
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["Modal","children","visible","onClose","others","isDesktop","style","
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["Modal","children","overflow","title","visible","onBack","onClose","others","isDesktop","style","container","modal","className","header","icon","left","right","undefined","propTypes","PropTypes","node","bool","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport style from './Modal.module.css';\n\nconst Modal = ({ children, overflow = true, title, visible, onBack, onClose, ...others }) => {\n const { isDesktop } = useDevice();\n\n return (\n <View row className={styles(style.container, overflow && style.overflow, visible && style.visible)}>\n <View {...others} fit className={styles(style.modal, visible && style.visible, others.className)}>\n {(title || onBack || onClose) && (\n <View row className={style.header}>\n {onBack && (\n <Pressable onPress={onBack}>\n <Icon name=\"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 onPress={onClose}>\n <Icon name={isDesktop || title !== undefined ? 'Close' : 'CloseArrow'} className={style.icon} />\n </Pressable>\n )}\n </View>\n )}\n {children}\n </View>\n </View>\n );\n};\n\nModal.propTypes = {\n children: PropTypes.node,\n overflow: 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;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OAA+E;EAAA,IAA5EC,QAA4E,QAA5EA,QAA4E;EAAA,yBAAlEC,QAAkE;EAAA,IAAlEA,QAAkE,8BAAvD,IAAuD;EAAA,IAAjDC,KAAiD,QAAjDA,KAAiD;EAAA,IAA1CC,OAA0C,QAA1CA,OAA0C;EAAA,IAAjCC,MAAiC,QAAjCA,MAAiC;EAAA,IAAzBC,OAAyB,QAAzBA,OAAyB;EAAA,IAAbC,MAAa;;EAC3F,iBAAsB,uBAAtB;EAAA,IAAQC,SAAR,cAAQA,SAAR;;EAEA,oBACE,6BAAC,gBAAD;IAAM,GAAG,MAAT;IAAU,SAAS,EAAE,qBAAOC,qBAAMC,SAAb,EAAwBR,QAAQ,IAAIO,qBAAMP,QAA1C,EAAoDE,OAAO,IAAIK,qBAAML,OAArE;EAArB,gBACE,6BAAC,gBAAD,eAAUG,MAAV;IAAkB,GAAG,MAArB;IAAsB,SAAS,EAAE,qBAAOE,qBAAME,KAAb,EAAoBP,OAAO,IAAIK,qBAAML,OAArC,EAA8CG,MAAM,CAACK,SAArD;EAAjC,IACG,CAACT,KAAK,IAAIE,MAAT,IAAmBC,OAApB,kBACC,6BAAC,gBAAD;IAAM,GAAG,MAAT;IAAU,SAAS,EAAEG,qBAAMI;EAA3B,GACGR,MAAM,iBACL,6BAAC,qBAAD;IAAW,OAAO,EAAEA;EAApB,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC,MAAX;IAAkB,SAAS,EAAEI,qBAAMK;EAAnC,EADF,CAFJ,EAMGX,KAAK,iBACJ,6BAAC,gBAAD;IAAM,QAAQ,MAAd;IAAe,SAAS,EAAE,qBAAOM,qBAAMN,KAAb,EAAoB,CAACE,MAAD,IAAWI,qBAAMM,IAArC,EAA2C,CAACT,OAAD,IAAYG,qBAAMO,KAA7D;EAA1B,GACGb,KADH,CAPJ,EAWGG,OAAO,iBACN,6BAAC,qBAAD;IAAW,OAAO,EAAEA;EAApB,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAEE,SAAS,IAAIL,KAAK,KAAKc,SAAvB,GAAmC,OAAnC,GAA6C,YAAzD;IAAuE,SAAS,EAAER,qBAAMK;EAAxF,EADF,CAZJ,CAFJ,EAoBGb,QApBH,CADF,CADF;AA0BD,CA7BD;;;AA+BAD,KAAK,CAACkB,SAAN,GAAkB;EAChBjB,QAAQ,EAAEkB,mBAAUC,IADJ;EAEhBlB,QAAQ,EAAEiB,mBAAUE,IAFJ;EAGhBlB,KAAK,EAAEgB,mBAAUG,MAHD;EAIhBlB,OAAO,EAAEe,mBAAUE,IAJH;EAKhBhB,MAAM,EAAEc,mBAAUI,IALF;EAMhBjB,OAAO,EAAEa,mBAAUI;AANH,CAAlB"}
|
|
@@ -1,72 +1,122 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--mirai-ui-modal-background: var(--mirai-ui-base);
|
|
3
|
-
--mirai-ui-modal-overflow: rgba(0, 0, 0, 0.
|
|
3
|
+
--mirai-ui-modal-overflow: rgba(0, 0, 0, 0.1);
|
|
4
|
+
--mirai-ui-modal-header-padding: var(--mirai-ui-space-M);
|
|
4
5
|
--mirai-ui-modal-icon: var(--mirai-ui-space-L);
|
|
5
6
|
--mirai-ui-modal-layer: var(--mirai-ui-layer-L);
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
.container {
|
|
10
|
+
height: 100vh;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
left: 0;
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
position: fixed;
|
|
15
|
+
top: 0;
|
|
16
|
+
width: 100vw;
|
|
17
|
+
z-index: var(--mirai-ui-modal-layer);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.header {
|
|
21
|
+
align-items: center;
|
|
22
|
+
border-bottom: solid 1px var(--mirai-ui-content-border);
|
|
23
|
+
padding: var(--mirai-ui-modal-header-padding);
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.header .title {
|
|
28
|
+
flex: 1;
|
|
29
|
+
padding: 0 var(--mirai-ui-modal-header-padding);
|
|
30
|
+
text-align: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.header .title.left {
|
|
34
|
+
margin-left: var(--mirai-ui-modal-icon);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.header .title.right {
|
|
38
|
+
margin-right: var(--mirai-ui-modal-icon);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.header .icon {
|
|
42
|
+
font-size: var(--mirai-ui-modal-icon);
|
|
43
|
+
line-height: var(--mirai-ui-modal-icon);
|
|
44
|
+
height: var(--mirai-ui-modal-icon);
|
|
45
|
+
width: var(--mirai-ui-modal-icon);
|
|
46
|
+
}
|
|
47
|
+
|
|
8
48
|
.modal {
|
|
9
49
|
background-color: var(--mirai-ui-modal-background);
|
|
10
|
-
opacity: 0;
|
|
11
50
|
pointer-events: none;
|
|
12
|
-
transform: scale(1.1);
|
|
13
51
|
transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
14
|
-
transform var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing)
|
|
52
|
+
transform var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
53
|
+
box-shadow var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
15
54
|
}
|
|
16
55
|
|
|
17
56
|
.modal.visible {
|
|
18
|
-
|
|
57
|
+
box-shadow: var(--mirai-ui-shadow);
|
|
19
58
|
pointer-events: all;
|
|
20
|
-
transform: scale(1);
|
|
21
59
|
}
|
|
22
60
|
|
|
23
61
|
.overflow {
|
|
24
|
-
align-items: center;
|
|
25
62
|
background-color: var(--mirai-ui-modal-overflow);
|
|
26
|
-
height: 100vh;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
left: 0;
|
|
29
63
|
opacity: 0;
|
|
30
64
|
pointer-events: none;
|
|
31
|
-
position: absolute;
|
|
32
65
|
transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
33
|
-
top: 0;
|
|
34
|
-
width: 100vw;
|
|
35
|
-
z-index: var(--mirai-ui-modal-layer);
|
|
36
66
|
}
|
|
37
67
|
|
|
38
|
-
.
|
|
68
|
+
.container.visible {
|
|
39
69
|
opacity: 1;
|
|
40
70
|
}
|
|
41
71
|
|
|
42
|
-
.pressable {
|
|
43
|
-
align-self: flex-end;
|
|
44
|
-
padding: var(--mirai-ui-space-XS);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.icon {
|
|
48
|
-
font-size: var(--mirai-ui-modal-icon);
|
|
49
|
-
line-height: var(--mirai-ui-modal-icon);
|
|
50
|
-
height: var(--mirai-ui-modal-icon);
|
|
51
|
-
width: var(--mirai-ui-modal-icon);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
72
|
@media only screen and (max-width: 600px) {
|
|
55
|
-
.
|
|
73
|
+
.container {
|
|
56
74
|
align-items: flex-end;
|
|
57
75
|
align-content: flex-end;
|
|
58
76
|
}
|
|
59
77
|
|
|
78
|
+
.header {
|
|
79
|
+
justify-content: center;
|
|
80
|
+
}
|
|
81
|
+
|
|
60
82
|
.modal {
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
transform: translateY(100%);
|
|
84
|
+
width: 100%;
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
.modal.visible {
|
|
66
88
|
transform: translateY(0%);
|
|
67
89
|
}
|
|
68
90
|
|
|
91
|
+
.overflow {
|
|
92
|
+
transition-delay: calc(var(--mirai-ui-motion-expand) / 2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.overflow.visible {
|
|
96
|
+
transition-delay: 0s;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media only screen and (min-width: 600px) {
|
|
101
|
+
.container {
|
|
102
|
+
align-items: center;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.header {
|
|
106
|
+
justify-content: flex-end;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.modal {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
transform: scale(1.1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.modal.visible {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
transform: scale(1);
|
|
117
|
+
}
|
|
118
|
+
|
|
69
119
|
.pressable {
|
|
70
|
-
align-self:
|
|
120
|
+
align-self: flex-end;
|
|
71
121
|
}
|
|
72
122
|
}
|
|
@@ -3,34 +3,38 @@
|
|
|
3
3
|
exports[`component:<Modal> Mobile environment prop:onClose 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="view row overflow visible"
|
|
6
|
+
class="view row container overflow visible"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="view fit modal visible"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
class="
|
|
11
|
+
<div
|
|
12
|
+
class="view row header"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
15
|
-
class="
|
|
14
|
+
<button
|
|
15
|
+
class="pressable"
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
height="1em"
|
|
20
|
-
stroke="currentColor"
|
|
21
|
-
stroke-linecap="round"
|
|
22
|
-
stroke-linejoin="round"
|
|
23
|
-
stroke-width="2"
|
|
24
|
-
viewBox="0 0 24 24"
|
|
25
|
-
width="1em"
|
|
26
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
<span
|
|
18
|
+
class="icon icon"
|
|
27
19
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
<svg
|
|
21
|
+
fill="none"
|
|
22
|
+
height="1em"
|
|
23
|
+
stroke="currentColor"
|
|
24
|
+
stroke-linecap="round"
|
|
25
|
+
stroke-linejoin="round"
|
|
26
|
+
stroke-width="2"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
width="1em"
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
>
|
|
31
|
+
<polyline
|
|
32
|
+
points="6 9 12 15 18 9"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
</span>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
34
38
|
</div>
|
|
35
39
|
</div>
|
|
36
40
|
</DocumentFragment>
|
|
@@ -39,7 +43,7 @@ exports[`component:<Modal> Mobile environment prop:onClose 1`] = `
|
|
|
39
43
|
exports[`component:<Modal> Mobile environment prop:visible 1`] = `
|
|
40
44
|
<DocumentFragment>
|
|
41
45
|
<div
|
|
42
|
-
class="view row overflow visible"
|
|
46
|
+
class="view row container overflow visible"
|
|
43
47
|
>
|
|
44
48
|
<div
|
|
45
49
|
class="view fit modal visible"
|
|
@@ -51,7 +55,7 @@ exports[`component:<Modal> Mobile environment prop:visible 1`] = `
|
|
|
51
55
|
exports[`component:<Modal> inherit:className 1`] = `
|
|
52
56
|
<DocumentFragment>
|
|
53
57
|
<div
|
|
54
|
-
class="view row overflow"
|
|
58
|
+
class="view row container overflow"
|
|
55
59
|
>
|
|
56
60
|
<div
|
|
57
61
|
class="view fit modal mirai"
|
|
@@ -63,7 +67,7 @@ exports[`component:<Modal> inherit:className 1`] = `
|
|
|
63
67
|
exports[`component:<Modal> prop:children 1`] = `
|
|
64
68
|
<DocumentFragment>
|
|
65
69
|
<div
|
|
66
|
-
class="view row overflow"
|
|
70
|
+
class="view row container overflow"
|
|
67
71
|
>
|
|
68
72
|
<div
|
|
69
73
|
class="view fit modal"
|
|
@@ -76,46 +80,130 @@ exports[`component:<Modal> prop:children 1`] = `
|
|
|
76
80
|
</DocumentFragment>
|
|
77
81
|
`;
|
|
78
82
|
|
|
83
|
+
exports[`component:<Modal> prop:onBack 1`] = `
|
|
84
|
+
<DocumentFragment>
|
|
85
|
+
<div
|
|
86
|
+
class="view row container overflow visible"
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
class="view fit modal visible"
|
|
90
|
+
>
|
|
91
|
+
<div
|
|
92
|
+
class="view row header"
|
|
93
|
+
>
|
|
94
|
+
<button
|
|
95
|
+
class="pressable"
|
|
96
|
+
>
|
|
97
|
+
<span
|
|
98
|
+
class="icon icon"
|
|
99
|
+
>
|
|
100
|
+
<svg
|
|
101
|
+
fill="none"
|
|
102
|
+
height="1em"
|
|
103
|
+
stroke="currentColor"
|
|
104
|
+
stroke-linecap="round"
|
|
105
|
+
stroke-linejoin="round"
|
|
106
|
+
stroke-width="2"
|
|
107
|
+
viewBox="0 0 24 24"
|
|
108
|
+
width="1em"
|
|
109
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
110
|
+
>
|
|
111
|
+
<line
|
|
112
|
+
x1="19"
|
|
113
|
+
x2="5"
|
|
114
|
+
y1="12"
|
|
115
|
+
y2="12"
|
|
116
|
+
/>
|
|
117
|
+
<polyline
|
|
118
|
+
points="12 19 5 12 12 5"
|
|
119
|
+
/>
|
|
120
|
+
</svg>
|
|
121
|
+
</span>
|
|
122
|
+
</button>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</DocumentFragment>
|
|
127
|
+
`;
|
|
128
|
+
|
|
79
129
|
exports[`component:<Modal> prop:onClose 1`] = `
|
|
80
130
|
<DocumentFragment>
|
|
81
131
|
<div
|
|
82
|
-
class="view row overflow visible"
|
|
132
|
+
class="view row container overflow visible"
|
|
83
133
|
>
|
|
84
134
|
<div
|
|
85
135
|
class="view fit modal visible"
|
|
86
136
|
>
|
|
87
|
-
<
|
|
88
|
-
class="
|
|
137
|
+
<div
|
|
138
|
+
class="view row header"
|
|
89
139
|
>
|
|
90
|
-
<
|
|
91
|
-
class="
|
|
140
|
+
<button
|
|
141
|
+
class="pressable"
|
|
92
142
|
>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
height="1em"
|
|
96
|
-
stroke="currentColor"
|
|
97
|
-
stroke-linecap="round"
|
|
98
|
-
stroke-linejoin="round"
|
|
99
|
-
stroke-width="2"
|
|
100
|
-
viewBox="0 0 24 24"
|
|
101
|
-
width="1em"
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
143
|
+
<span
|
|
144
|
+
class="icon icon"
|
|
103
145
|
>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
146
|
+
<svg
|
|
147
|
+
fill="none"
|
|
148
|
+
height="1em"
|
|
149
|
+
stroke="currentColor"
|
|
150
|
+
stroke-linecap="round"
|
|
151
|
+
stroke-linejoin="round"
|
|
152
|
+
stroke-width="2"
|
|
153
|
+
viewBox="0 0 24 24"
|
|
154
|
+
width="1em"
|
|
155
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
156
|
+
>
|
|
157
|
+
<polyline
|
|
158
|
+
points="6 9 12 15 18 9"
|
|
159
|
+
/>
|
|
160
|
+
</svg>
|
|
161
|
+
</span>
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</DocumentFragment>
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
exports[`component:<Modal> prop:title 1`] = `
|
|
170
|
+
<DocumentFragment>
|
|
171
|
+
<div
|
|
172
|
+
class="view row container overflow"
|
|
173
|
+
>
|
|
174
|
+
<div
|
|
175
|
+
class="view fit modal"
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
class="view row header"
|
|
179
|
+
>
|
|
180
|
+
<span
|
|
181
|
+
class="text headline title left right"
|
|
182
|
+
>
|
|
183
|
+
Modal
|
|
108
184
|
</span>
|
|
109
|
-
</
|
|
185
|
+
</div>
|
|
110
186
|
</div>
|
|
111
187
|
</div>
|
|
112
188
|
</DocumentFragment>
|
|
113
189
|
`;
|
|
114
190
|
|
|
191
|
+
exports[`component:<Modal> prop:visible & prop:overflow (false) 1`] = `
|
|
192
|
+
<DocumentFragment>
|
|
193
|
+
<div
|
|
194
|
+
class="view row container visible"
|
|
195
|
+
>
|
|
196
|
+
<div
|
|
197
|
+
class="view fit modal visible"
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
</DocumentFragment>
|
|
201
|
+
`;
|
|
202
|
+
|
|
115
203
|
exports[`component:<Modal> prop:visible 1`] = `
|
|
116
204
|
<DocumentFragment>
|
|
117
205
|
<div
|
|
118
|
-
class="view row overflow visible"
|
|
206
|
+
class="view row container overflow visible"
|
|
119
207
|
>
|
|
120
208
|
<div
|
|
121
209
|
class="view fit modal visible"
|
|
@@ -127,7 +215,7 @@ exports[`component:<Modal> prop:visible 1`] = `
|
|
|
127
215
|
exports[`component:<Modal> renders 1`] = `
|
|
128
216
|
<DocumentFragment>
|
|
129
217
|
<div
|
|
130
|
-
class="view row overflow"
|
|
218
|
+
class="view row container overflow"
|
|
131
219
|
>
|
|
132
220
|
<div
|
|
133
221
|
class="view fit modal"
|
|
@@ -139,7 +227,7 @@ exports[`component:<Modal> renders 1`] = `
|
|
|
139
227
|
exports[`component:<Modal> testID 1`] = `
|
|
140
228
|
<DocumentFragment>
|
|
141
229
|
<div
|
|
142
|
-
class="view row overflow"
|
|
230
|
+
class="view row container overflow"
|
|
143
231
|
>
|
|
144
232
|
<div
|
|
145
233
|
class="view fit modal"
|
|
@@ -60,7 +60,9 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
60
60
|
visible = _useState2[0],
|
|
61
61
|
setVisible = _useState2[1];
|
|
62
62
|
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Layer, _extends({
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Layer, _extends({
|
|
64
|
+
forceRender: false
|
|
65
|
+
}, others, {
|
|
64
66
|
centered: true,
|
|
65
67
|
visible: visible
|
|
66
68
|
}), _react.default.Children.map(children, function (child, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["Tooltip","children","Template","text","others","visible","setVisible","React","Children","map","child","index","cloneElement","props","key","undefined","className","style","dispatcher","onMouseEnter","onMouseLeave","tooltip","displayName","propTypes","PropTypes","node","oneOfType","func","string","bool"],"sources":["../../../src/components/Tooltip/Tooltip.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Layer, LayerContent, Text, View } from '../../primitives';\nimport style from './Tooltip.module.css';\n\nconst Tooltip = ({ children, Template, text, ...others }) => {\n const [visible, setVisible] = useState(others.visible || false);\n\n return (\n <Layer {...others} centered visible={visible}>\n {React.Children.map(children, (child, index) =>\n React.cloneElement(child, {\n ...child.props,\n key: index,\n 'data-testid': others['data-testid'] ? `${others['data-testid']}-dispatcher` : undefined,\n className: styles(style.dispatcher, child.props.className),\n onMouseEnter: () => setVisible(true),\n onMouseLeave: () => setVisible(false),\n }),\n )}\n\n <LayerContent>\n <View className={style.tooltip}>\n {Template ? (\n <Template />\n ) : (\n <Text bold small className={style.text}>\n {text}\n </Text>\n )}\n </View>\n </LayerContent>\n </Layer>\n );\n};\n\nTooltip.displayName = 'Component:Tooltip';\n\nTooltip.propTypes = {\n children: PropTypes.node,\n Template: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n text: PropTypes.string,\n visible: PropTypes.bool,\n};\n\nexport { Tooltip };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,OAA6C;EAAA,IAA1CC,QAA0C,QAA1CA,QAA0C;EAAA,IAAhCC,QAAgC,QAAhCA,QAAgC;EAAA,IAAtBC,IAAsB,QAAtBA,IAAsB;EAAA,IAAbC,MAAa;;EAC3D,gBAA8B,qBAASA,MAAM,CAACC,OAAP,IAAkB,KAA3B,CAA9B;EAAA;EAAA,IAAOA,OAAP;EAAA,IAAgBC,UAAhB;;EAEA,oBACE,6BAAC,iBAAD,
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["Tooltip","children","Template","text","others","visible","setVisible","React","Children","map","child","index","cloneElement","props","key","undefined","className","style","dispatcher","onMouseEnter","onMouseLeave","tooltip","displayName","propTypes","PropTypes","node","oneOfType","func","string","bool"],"sources":["../../../src/components/Tooltip/Tooltip.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Layer, LayerContent, Text, View } from '../../primitives';\nimport style from './Tooltip.module.css';\n\nconst Tooltip = ({ children, Template, text, ...others }) => {\n const [visible, setVisible] = useState(others.visible || false);\n\n return (\n <Layer forceRender={false} {...others} centered visible={visible}>\n {React.Children.map(children, (child, index) =>\n React.cloneElement(child, {\n ...child.props,\n key: index,\n 'data-testid': others['data-testid'] ? `${others['data-testid']}-dispatcher` : undefined,\n className: styles(style.dispatcher, child.props.className),\n onMouseEnter: () => setVisible(true),\n onMouseLeave: () => setVisible(false),\n }),\n )}\n\n <LayerContent>\n <View className={style.tooltip}>\n {Template ? (\n <Template />\n ) : (\n <Text bold small className={style.text}>\n {text}\n </Text>\n )}\n </View>\n </LayerContent>\n </Layer>\n );\n};\n\nTooltip.displayName = 'Component:Tooltip';\n\nTooltip.propTypes = {\n children: PropTypes.node,\n Template: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n text: PropTypes.string,\n visible: PropTypes.bool,\n};\n\nexport { Tooltip };\n"],"mappings":";;;;;;;;;AAAA;;A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D,CA7BD;;;AA+BAH,OAAO,CAACsB,WAAR,GAAsB,mBAAtB;AAEAtB,OAAO,CAACuB,SAAR,GAAoB;EAClBtB,QAAQ,EAAEuB,mBAAUC,IADF;EAElBvB,QAAQ,EAAEsB,mBAAUE,SAAV,CAAoB,CAACF,mBAAUC,IAAX,EAAiBD,mBAAUG,IAA3B,CAApB,CAFQ;EAGlBxB,IAAI,EAAEqB,mBAAUI,MAHE;EAIlBvB,OAAO,EAAEmB,mBAAUK;AAJD,CAApB"}
|
|
@@ -21,7 +21,7 @@ var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
|
|
|
21
21
|
|
|
22
22
|
var _LayerContent = require("./LayerContent");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["centered", "visible"];
|
|
24
|
+
var _excluded = ["centered", "forceRender", "visible"];
|
|
25
25
|
|
|
26
26
|
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); }
|
|
27
27
|
|
|
@@ -53,6 +53,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
53
53
|
|
|
54
54
|
var Layer = function Layer(_ref) {
|
|
55
55
|
var centered = _ref.centered,
|
|
56
|
+
_ref$forceRender = _ref.forceRender,
|
|
57
|
+
forceRender = _ref$forceRender === void 0 ? true : _ref$forceRender,
|
|
56
58
|
visible = _ref.visible,
|
|
57
59
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
58
60
|
|
|
@@ -96,11 +98,11 @@ var Layer = function Layer(_ref) {
|
|
|
96
98
|
}, children.find(function (_ref2) {
|
|
97
99
|
var name = _ref2.type.name;
|
|
98
100
|
return name !== _LayerContent.LayerContent.name;
|
|
99
|
-
})), visible && /*#__PURE__*/_react.default.createElement("
|
|
101
|
+
})), (forceRender || visible) && /*#__PURE__*/_react.default.createElement("div", {
|
|
100
102
|
ref: contentRef,
|
|
101
|
-
className: (0, _helpers.styles)(_LayerModule.default.layer, others.className),
|
|
103
|
+
className: (0, _helpers.styles)(_LayerModule.default.layer, !visible && _LayerModule.default.hidden, others.className),
|
|
102
104
|
style: _objectSpread(_objectSpread({}, others.style), position)
|
|
103
|
-
}, children.find(function (_ref3) {
|
|
105
|
+
}, children === null || children === void 0 ? void 0 : children.find(function (_ref3) {
|
|
104
106
|
var name = _ref3.type.name;
|
|
105
107
|
return name === _LayerContent.LayerContent.name;
|
|
106
108
|
})));
|
|
@@ -108,6 +110,7 @@ var Layer = function Layer(_ref) {
|
|
|
108
110
|
|
|
109
111
|
exports.Layer = Layer;
|
|
110
112
|
Layer.propTypes = {
|
|
113
|
+
forceRender: _propTypes.default.bool,
|
|
111
114
|
children: _propTypes.default.node,
|
|
112
115
|
centered: _propTypes.default.bool,
|
|
113
116
|
visible: _propTypes.default.bool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["Layer","centered","visible","others","device","componentRef","contentRef","position","setPosition","current","componentEl","firstChild","contentEl","componentLayout","contentLayout","left","top","children","React","Children","map","child","find","name","type","LayerContent","style","layer","className","propTypes","PropTypes","
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["Layer","centered","forceRender","visible","others","device","componentRef","contentRef","position","setPosition","current","componentEl","firstChild","contentEl","componentLayout","contentLayout","left","top","children","React","Children","map","child","find","name","type","LayerContent","style","layer","hidden","className","propTypes","PropTypes","bool","node"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { getElementLayout, getLayerPosition } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({ centered, forceRender = true, visible, ...others }) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = getElementLayout(componentEl);\n const contentLayout = getElementLayout(contentEl);\n const { left = 0, top = 0 } = getLayerPosition(componentLayout, contentLayout, device, centered);\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n }, [centered, device, visible]);\n\n const children = React.Children.map(others.children || [], (child) => child);\n\n return (\n <>\n <span data-testid={others['data-testid']} ref={componentRef}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </span>\n\n {(forceRender || visible) && (\n <div\n ref={contentRef}\n className={styles(style.layer, !visible && style.hidden, others.className)}\n style={{ ...others.style, ...position }}\n >\n {children?.find(({ type: { name } }) => name === LayerContent.name)}\n </div>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n forceRender: PropTypes.bool,\n children: PropTypes.node,\n centered: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OAA0D;EAAA,IAAvDC,QAAuD,QAAvDA,QAAuD;EAAA,4BAA7CC,WAA6C;EAAA,IAA7CA,WAA6C,iCAA/B,IAA+B;EAAA,IAAzBC,OAAyB,QAAzBA,OAAyB;EAAA,IAAbC,MAAa;;EACtE,IAAMC,MAAM,GAAG,uBAAf;EACA,IAAMC,YAAY,GAAG,oBAArB;EACA,IAAMC,UAAU,GAAG,oBAAnB;;EAEA,gBAAgC,sBAAhC;EAAA;EAAA,IAAOC,QAAP;EAAA,IAAiBC,WAAjB;;EAEA,4BAAgB,YAAM;IACpB,4BAAsDH,YAAtD,CAAQI,OAAR;IAAA,2DAA+C,EAA/C;IAAA,IAA+BC,WAA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AHP,GAKGU,QALH,aAKGA,QALH,uBAKGA,QAAQ,CAAEK,IAAV,CAAe;IAAA,IAAWC,IAAX,SAAGC,IAAH,CAAWD,IAAX;IAAA,OAAwBA,IAAI,KAAKE,2BAAaF,IAA9C;EAAA,CAAf,CALH,CANJ,CADF;AAiBD,CAvCD;;;AAyCAxB,KAAK,CAAC+B,SAAN,GAAkB;EAChB7B,WAAW,EAAE8B,mBAAUC,IADP;EAEhBf,QAAQ,EAAEc,mBAAUE,IAFJ;EAGhBjC,QAAQ,EAAE+B,mBAAUC,IAHJ;EAIhB9B,OAAO,EAAE6B,mBAAUC;AAJH,CAAlB"}
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
.layer {
|
|
6
6
|
position: fixed;
|
|
7
|
-
transition: left var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
8
|
-
top var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
9
7
|
z-index: var(--mirai-ui-layer-content);
|
|
10
8
|
}
|
|
9
|
+
|
|
10
|
+
.layer.hidden {
|
|
11
|
+
display: none;
|
|
12
|
+
visibility: hidden;
|
|
13
|
+
}
|