@mirai/ui 1.0.80 → 1.0.81-beta
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 +8 -1
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +3 -3
- package/build/components/Calendar/Calendar.Month.js +1 -0
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.Week.js +21 -4
- package/build/components/Calendar/Calendar.Week.js.map +1 -1
- package/build/components/Calendar/Calendar.js +11 -3
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +4 -2
- package/build/components/Calendar/Calendar.stories.js +77 -23
- package/build/components/Calendar/Calendar.stories.js.map +1 -1
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +2650 -2650
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +9 -9
- package/build/components/Tooltip/Tooltip.js +27 -7
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/Tooltip.module.css +32 -0
- package/build/components/Tooltip/Tooltip.stories.js +62 -35
- package/build/components/Tooltip/Tooltip.stories.js.map +1 -1
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +79 -22
- package/build/primitives/Layer/Layer.js +9 -3
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/helpers/getLayerPosition.js +43 -5
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +1 -1
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/Pressable.module.css +1 -0
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +1 -1
- package/build/theme/theme.stories.js +60 -0
- package/build/theme/theme.stories.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
|
|
|
9
9
|
class="view texts"
|
|
10
10
|
/>
|
|
11
11
|
<button
|
|
12
|
-
class="pressable button rounded squared secondary disabled"
|
|
12
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
13
13
|
disabled=""
|
|
14
14
|
>
|
|
15
15
|
<span
|
|
@@ -77,7 +77,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
|
|
|
77
77
|
class="view texts"
|
|
78
78
|
/>
|
|
79
79
|
<button
|
|
80
|
-
class="pressable button rounded squared secondary disabled"
|
|
80
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
81
81
|
disabled=""
|
|
82
82
|
>
|
|
83
83
|
<span
|
|
@@ -108,7 +108,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
|
|
|
108
108
|
0
|
|
109
109
|
</h3>
|
|
110
110
|
<button
|
|
111
|
-
class="pressable button rounded squared secondary disabled"
|
|
111
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
112
112
|
disabled=""
|
|
113
113
|
>
|
|
114
114
|
<span
|
|
@@ -152,7 +152,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
|
|
|
152
152
|
</span>
|
|
153
153
|
</div>
|
|
154
154
|
<button
|
|
155
|
-
class="pressable button rounded squared secondary disabled"
|
|
155
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
156
156
|
disabled=""
|
|
157
157
|
>
|
|
158
158
|
<span
|
|
@@ -226,7 +226,7 @@ exports[`component:<InputNumber> prop:label 1`] = `
|
|
|
226
226
|
</h4>
|
|
227
227
|
</div>
|
|
228
228
|
<button
|
|
229
|
-
class="pressable button rounded squared secondary disabled"
|
|
229
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
230
230
|
disabled=""
|
|
231
231
|
>
|
|
232
232
|
<span
|
|
@@ -324,7 +324,7 @@ exports[`component:<InputNumber> prop:max 1`] = `
|
|
|
324
324
|
10
|
|
325
325
|
</h3>
|
|
326
326
|
<button
|
|
327
|
-
class="pressable button rounded squared secondary disabled"
|
|
327
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
328
328
|
disabled=""
|
|
329
329
|
>
|
|
330
330
|
<span
|
|
@@ -362,7 +362,7 @@ exports[`component:<InputNumber> prop:min 1`] = `
|
|
|
362
362
|
class="view texts"
|
|
363
363
|
/>
|
|
364
364
|
<button
|
|
365
|
-
class="pressable button rounded squared secondary disabled"
|
|
365
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
366
366
|
disabled=""
|
|
367
367
|
>
|
|
368
368
|
<span
|
|
@@ -564,7 +564,7 @@ exports[`component:<InputNumber> renders 1`] = `
|
|
|
564
564
|
class="view texts"
|
|
565
565
|
/>
|
|
566
566
|
<button
|
|
567
|
-
class="pressable button rounded squared secondary disabled"
|
|
567
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
568
568
|
disabled=""
|
|
569
569
|
>
|
|
570
570
|
<span
|
|
@@ -633,7 +633,7 @@ exports[`component:<InputNumber> testID 1`] = `
|
|
|
633
633
|
class="view texts"
|
|
634
634
|
/>
|
|
635
635
|
<button
|
|
636
|
-
class="pressable button rounded squared secondary disabled"
|
|
636
|
+
class="pressable disabled button rounded squared secondary disabled"
|
|
637
637
|
disabled=""
|
|
638
638
|
>
|
|
639
639
|
<span
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _helpers = require("../../helpers");
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
12
|
var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
|
|
13
|
-
var _excluded = ["children", "Template", "text", "visible"],
|
|
13
|
+
var _excluded = ["children", "pressable", "Template", "text", "top", "visible"],
|
|
14
14
|
_excluded2 = ["data-testid"];
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
@@ -31,8 +31,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
31
31
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
32
|
var Tooltip = function Tooltip(_ref) {
|
|
33
33
|
var children = _ref.children,
|
|
34
|
+
_ref$pressable = _ref.pressable,
|
|
35
|
+
pressable = _ref$pressable === void 0 ? false : _ref$pressable,
|
|
34
36
|
Template = _ref.Template,
|
|
35
37
|
text = _ref.text,
|
|
38
|
+
propTop = _ref.top,
|
|
36
39
|
_ref$visible = _ref.visible,
|
|
37
40
|
propVisible = _ref$visible === void 0 ? false : _ref$visible,
|
|
38
41
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -40,19 +43,35 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
40
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
44
|
visible = _useState2[0],
|
|
42
45
|
setVisible = _useState2[1];
|
|
46
|
+
var _useState3 = (0, _react.useState)({}),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
position = _useState4[0],
|
|
49
|
+
setPosition = _useState4[1];
|
|
43
50
|
var testId = others['data-testid'],
|
|
44
51
|
rest = _objectWithoutProperties(others, _excluded2);
|
|
52
|
+
var left = position.left,
|
|
53
|
+
right = position.right,
|
|
54
|
+
_position$top = position.top,
|
|
55
|
+
top = _position$top === void 0 ? propTop : _position$top;
|
|
45
56
|
return /*#__PURE__*/_react.default.createElement(_primitives.Layer, {
|
|
46
57
|
centered: true,
|
|
47
58
|
forceRender: false,
|
|
48
59
|
visible: visible,
|
|
60
|
+
top: top,
|
|
61
|
+
onPosition: setPosition,
|
|
49
62
|
"data-testid": testId
|
|
50
63
|
}, _react.default.Children.map(children, function (child, index) {
|
|
51
|
-
return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
52
|
-
key: index
|
|
64
|
+
return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread(_objectSpread({}, child.props), {}, {
|
|
65
|
+
key: index
|
|
66
|
+
}, pressable ? {
|
|
67
|
+
onClick: function onClick() {
|
|
68
|
+
return setVisible(!visible);
|
|
69
|
+
}
|
|
70
|
+
} : {
|
|
53
71
|
onMouseEnter: function onMouseEnter() {
|
|
54
72
|
return setVisible(true);
|
|
55
|
-
}
|
|
73
|
+
}
|
|
74
|
+
}), {}, {
|
|
56
75
|
onMouseLeave: function onMouseLeave() {
|
|
57
76
|
return setVisible(false);
|
|
58
77
|
},
|
|
@@ -60,7 +79,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
60
79
|
'data-testid': testId ? "".concat(testId, "-dispatcher") : undefined
|
|
61
80
|
}));
|
|
62
81
|
}), /*#__PURE__*/_react.default.createElement(_primitives.LayerContent, null, /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, rest, {
|
|
63
|
-
className: (0, _helpers.styles)(_TooltipModule.default.tooltip, rest.className)
|
|
82
|
+
className: (0, _helpers.styles)(_TooltipModule.default.tooltip, left && _TooltipModule.default.left, right && _TooltipModule.default.right, top ? _TooltipModule.default.top : _TooltipModule.default.bottom, rest.className)
|
|
64
83
|
}), Template ? /*#__PURE__*/_react.default.createElement(Template, null) : /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
65
84
|
bold: true,
|
|
66
85
|
small: true,
|
|
@@ -68,11 +87,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
68
87
|
}, text))));
|
|
69
88
|
};
|
|
70
89
|
exports.Tooltip = Tooltip;
|
|
71
|
-
Tooltip.displayName = 'Component:Tooltip';
|
|
72
90
|
Tooltip.propTypes = {
|
|
73
|
-
children: _propTypes.default.node,
|
|
91
|
+
children: _propTypes.default.node.isRequired,
|
|
92
|
+
pressable: _propTypes.default.bool,
|
|
74
93
|
Template: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
75
94
|
text: _propTypes.default.string,
|
|
95
|
+
top: _propTypes.default.bool,
|
|
76
96
|
visible: _propTypes.default.bool
|
|
77
97
|
};
|
|
78
98
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["Tooltip","children","Template","text","visible","propVisible","others","useState","setVisible","testId","rest","React","Children","map","child","index","cloneElement","props","key","onMouseEnter","onMouseLeave","className","styles","style","dispatcher","undefined","tooltip","
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["Tooltip","children","pressable","Template","text","propTop","top","visible","propVisible","others","useState","setVisible","position","setPosition","testId","rest","left","right","React","Children","map","child","index","cloneElement","props","key","onClick","onMouseEnter","onMouseLeave","className","styles","style","dispatcher","undefined","tooltip","bottom","propTypes","PropTypes","node","isRequired","bool","oneOfType","func","string"],"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 = ({\n children,\n pressable = false,\n Template,\n text,\n top: propTop,\n visible: propVisible = false,\n ...others\n}) => {\n const [visible, setVisible] = useState(propVisible);\n const [position, setPosition] = useState({});\n\n const { ['data-testid']: testId, ...rest } = others;\n\n const { left, right, top = propTop } = position;\n\n return (\n <Layer centered forceRender={false} visible={visible} top={top} onPosition={setPosition} data-testid={testId}>\n {React.Children.map(children, (child, index) =>\n React.cloneElement(child, {\n ...child.props,\n key: index,\n ...(pressable ? { onClick: () => setVisible(!visible) } : { onMouseEnter: () => setVisible(true) }),\n onMouseLeave: () => setVisible(false),\n className: styles(style.dispatcher, child.props.className),\n 'data-testid': testId ? `${testId}-dispatcher` : undefined,\n }),\n )}\n\n <LayerContent>\n <View\n {...rest}\n className={styles(\n style.tooltip,\n left && style.left,\n right && style.right,\n top ? style.top : style.bottom,\n rest.className,\n )}\n >\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.propTypes = {\n children: PropTypes.node.isRequired,\n pressable: PropTypes.bool,\n Template: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n text: PropTypes.string,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Tooltip };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAyC;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEzC,IAAMA,OAAO,GAAG,SAAVA,OAAO,OAQP;EAAA,IAPJC,QAAQ,QAARA,QAAQ;IAAA,sBACRC,SAAS;IAATA,SAAS,+BAAG,KAAK;IACjBC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACCC,OAAO,QAAZC,GAAG;IAAA,oBACHC,OAAO;IAAEC,WAAW,6BAAG,KAAK;IACzBC,M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R,SAAS,EAAE,IAAAe,eAAM,EACfC,sBAAK,CAACG,OAAO,EACblB,IAAI,IAAIe,sBAAK,CAACf,IAAI,EAClBC,KAAK,IAAIc,sBAAK,CAACd,KAAK,EACpBX,GAAG,GAAGyB,sBAAK,CAACzB,GAAG,GAAGyB,sBAAK,CAACI,MAAM,EAC9BpB,IAAI,CAACc,SAAS;EACd,IAED1B,QAAQ,gBACP,6BAAC,QAAQ,OAAG,gBAEZ,6BAAC,gBAAI;IAAC,IAAI;IAAC,KAAK;IAAC,SAAS,EAAE4B,sBAAK,CAAC3B;EAAK,GACpCA,IAAI,CAER,CACI,CACM,CACT;AAEZ,CAAC;AAAC;AAEFJ,OAAO,CAACoC,SAAS,GAAG;EAClBnC,QAAQ,EAAEoC,kBAAS,CAACC,IAAI,CAACC,UAAU;EACnCrC,SAAS,EAAEmC,kBAAS,CAACG,IAAI;EACzBrC,QAAQ,EAAEkC,kBAAS,CAACI,SAAS,CAAC,CAACJ,kBAAS,CAACC,IAAI,EAAED,kBAAS,CAACK,IAAI,CAAC,CAAC;EAC/DtC,IAAI,EAAEiC,kBAAS,CAACM,MAAM;EACtBrC,GAAG,EAAE+B,kBAAS,CAACG,IAAI;EACnBjC,OAAO,EAAE8B,kBAAS,CAACG;AACrB,CAAC"}
|
|
@@ -12,6 +12,38 @@
|
|
|
12
12
|
pointer-events: none;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.tooltip:before {
|
|
16
|
+
border-style: solid;
|
|
17
|
+
border-width: calc(var(--mirai-ui-tooltip-space) / 2);
|
|
18
|
+
content: '';
|
|
19
|
+
display: block;
|
|
20
|
+
height: 0;
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tooltip:not(.left):not(.right):before {
|
|
26
|
+
left: calc(50% - calc(var(--mirai-ui-tooltip-space) / 2));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tooltip.top:before {
|
|
30
|
+
border-color: var(--mirai-ui-tooltip-background) transparent transparent transparent;
|
|
31
|
+
bottom: calc(calc(var(--mirai-ui-tooltip-space) / 2) * -1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tooltip.bottom:before {
|
|
35
|
+
border-color: transparent transparent var(--mirai-ui-tooltip-background) transparent;
|
|
36
|
+
top: calc(calc(var(--mirai-ui-tooltip-space) / 2) * -1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tooltip.left:before {
|
|
40
|
+
left: calc(var(--mirai-ui-tooltip-space) * 2);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tooltip.right:before {
|
|
44
|
+
right: calc(var(--mirai-ui-tooltip-space) * 2);
|
|
45
|
+
}
|
|
46
|
+
|
|
15
47
|
.tooltip .text {
|
|
16
48
|
color: var(--mirai-ui-tooltip-color);
|
|
17
49
|
}
|
|
@@ -18,48 +18,75 @@ var _default = {
|
|
|
18
18
|
title: 'Components'
|
|
19
19
|
};
|
|
20
20
|
exports.default = _default;
|
|
21
|
+
var INSTANCES = Array.from(Array(3).keys());
|
|
22
|
+
var Template = function Template() {
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_.View, {
|
|
24
|
+
row: true,
|
|
25
|
+
style: {
|
|
26
|
+
padding: 4
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
29
|
+
style: {
|
|
30
|
+
marginRight: 12,
|
|
31
|
+
height: 32,
|
|
32
|
+
width: 32,
|
|
33
|
+
borderRadius: '50%',
|
|
34
|
+
backgroundColor: 'grey',
|
|
35
|
+
backgroundImage: 'url(https://raw.githubusercontent.com/soyjavi/site/master/public/soyjavi.jpg)',
|
|
36
|
+
backgroundSize: 'cover',
|
|
37
|
+
border: 'none'
|
|
38
|
+
}
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement(_.View, null, /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
40
|
+
bold: true,
|
|
41
|
+
action: true,
|
|
42
|
+
style: {
|
|
43
|
+
color: 'white'
|
|
44
|
+
}
|
|
45
|
+
}, "Javi Jimenez Villar"), /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
46
|
+
small: true,
|
|
47
|
+
style: {
|
|
48
|
+
color: 'white'
|
|
49
|
+
}
|
|
50
|
+
}, "@soyjavi")));
|
|
51
|
+
};
|
|
21
52
|
var Story = function Story(props) {
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
border: 'none'
|
|
41
|
-
}
|
|
42
|
-
}), /*#__PURE__*/_react.default.createElement(_.View, null, /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
43
|
-
bold: true,
|
|
44
|
-
action: true,
|
|
45
|
-
style: {
|
|
46
|
-
color: 'white'
|
|
47
|
-
}
|
|
48
|
-
}, "Javi Jimenez"), /*#__PURE__*/_react.default.createElement(_.Text, {
|
|
49
|
-
small: true,
|
|
50
|
-
style: {
|
|
51
|
-
color: 'white'
|
|
52
|
-
}
|
|
53
|
-
}, "@soyjavi")));
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.View, {
|
|
54
|
+
row: true,
|
|
55
|
+
style: {
|
|
56
|
+
justifyContent: 'space-between'
|
|
57
|
+
}
|
|
58
|
+
}, INSTANCES.map(function (number) {
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, _extends({}, props, {
|
|
60
|
+
key: number
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
62
|
+
className: "children",
|
|
63
|
+
style: {
|
|
64
|
+
margin: 'var(--mirai-ui-space-XS)'
|
|
65
|
+
}
|
|
66
|
+
}, "hover:text"));
|
|
67
|
+
})), /*#__PURE__*/_react.default.createElement(_.View, {
|
|
68
|
+
row: true,
|
|
69
|
+
style: {
|
|
70
|
+
justifyContent: 'space-between'
|
|
54
71
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
}, INSTANCES.map(function (number) {
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, _extends({}, props, {
|
|
74
|
+
key: number,
|
|
75
|
+
Template: Template
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
77
|
+
className: "children",
|
|
78
|
+
style: {
|
|
79
|
+
margin: 'var(--mirai-ui-space-XS)'
|
|
80
|
+
}
|
|
81
|
+
}, "hover:node"));
|
|
82
|
+
})));
|
|
58
83
|
};
|
|
59
84
|
exports.Story = Story;
|
|
60
85
|
Story.storyName = 'Tooltip';
|
|
61
86
|
Story.args = (_Story$args = {
|
|
87
|
+
pressable: false,
|
|
62
88
|
text: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus',
|
|
89
|
+
top: true,
|
|
63
90
|
visible: false
|
|
64
91
|
}, _defineProperty(_Story$args, 'data-testid', 'test-story'), _defineProperty(_Story$args, "style", {}), _Story$args);
|
|
65
92
|
Story.argTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.stories.js","names":["title","
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.js","names":["title","INSTANCES","Array","from","keys","Template","padding","marginRight","height","width","borderRadius","backgroundColor","backgroundImage","backgroundSize","border","color","Story","props","justifyContent","map","number","margin","storyName","args","pressable","text","top","visible","argTypes","onClose","action"],"sources":["../../../src/components/Tooltip/Tooltip.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { Text, View } from '../../';\nimport { Tooltip } from './Tooltip';\n\nexport default { title: 'Components' };\n\nconst INSTANCES = Array.from(Array(3).keys());\n\nconst Template = () => (\n <View row style={{ padding: 4 }}>\n <img\n style={{\n marginRight: 12,\n height: 32,\n width: 32,\n borderRadius: '50%',\n backgroundColor: 'grey',\n backgroundImage: 'url(https://raw.githubusercontent.com/soyjavi/site/master/public/soyjavi.jpg)',\n backgroundSize: 'cover',\n border: 'none',\n }}\n />\n <View>\n <Text bold action style={{ color: 'white' }}>\n Javi Jimenez Villar\n </Text>\n <Text small style={{ color: 'white' }}>\n @soyjavi\n </Text>\n </View>\n </View>\n);\n\nexport const Story = (props) => (\n <>\n <View row style={{ justifyContent: 'space-between' }}>\n {INSTANCES.map((number) => (\n <Tooltip {...props} key={number}>\n <span className=\"children\" style={{ margin: 'var(--mirai-ui-space-XS)' }}>\n hover:text\n </span>\n </Tooltip>\n ))}\n </View>\n\n <View row style={{ justifyContent: 'space-between' }}>\n {INSTANCES.map((number) => (\n <Tooltip {...props} key={number} Template={Template}>\n <span className=\"children\" style={{ margin: 'var(--mirai-ui-space-XS)' }}>\n hover:node\n </span>\n </Tooltip>\n ))}\n </View>\n </>\n);\n\nStory.storyName = 'Tooltip';\n\nStory.args = {\n pressable: false,\n text: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi nemo adipisci consequatur et tenetur natus',\n top: true,\n visible: false,\n // inherited properties\n ['data-testid']: 'test-story',\n style: {},\n};\n\nStory.argTypes = {\n onClose: { action: 'onClose' },\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAErB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAEtC,IAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAACD,KAAK,CAAC,CAAC,CAAC,CAACE,IAAI,EAAE,CAAC;AAE7C,IAAMC,QAAQ,GAAG,SAAXA,QAAQ;EAAA,oBACZ,6BAAC,MAAI;IAAC,GAAG;IAAC,KAAK,EAAE;MAAEC,OAAO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M,SAAS,GAAG,SAAS;AAE3BN,KAAK,CAACO,IAAI;EACRC,SAAS,EAAE,KAAK;EAChBC,IAAI,EAAE,2GAA2G;EACjHC,GAAG,EAAE,IAAI;EACTC,OAAO,EAAE;AAAK,gCAEb,aAAa,EAAG,YAAY,yCACtB,CAAC,CAAC,eACV;AAEDX,KAAK,CAACY,QAAQ,GAAG;EACfC,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU;AAC/B,CAAC"}
|
|
@@ -30,26 +30,41 @@ exports[` 2`] = `
|
|
|
30
30
|
</DocumentFragment>
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
|
-
exports[`
|
|
33
|
+
exports[` 3`] = `
|
|
34
34
|
<DocumentFragment>
|
|
35
|
-
<span
|
|
35
|
+
<span
|
|
36
|
+
data-testid="onPress"
|
|
37
|
+
>
|
|
38
|
+
<button
|
|
39
|
+
class="pressable button dispatcher"
|
|
40
|
+
data-testid="onPress-dispatcher"
|
|
41
|
+
>
|
|
42
|
+
Action
|
|
43
|
+
</button>
|
|
44
|
+
</span>
|
|
36
45
|
</DocumentFragment>
|
|
37
46
|
`;
|
|
38
47
|
|
|
39
|
-
exports[`
|
|
48
|
+
exports[` 4`] = `
|
|
40
49
|
<DocumentFragment>
|
|
41
|
-
<span
|
|
50
|
+
<span
|
|
51
|
+
data-testid="onPress"
|
|
52
|
+
>
|
|
53
|
+
<button
|
|
54
|
+
class="pressable button dispatcher"
|
|
55
|
+
data-testid="onPress-dispatcher"
|
|
56
|
+
>
|
|
57
|
+
Action
|
|
58
|
+
</button>
|
|
59
|
+
</span>
|
|
42
60
|
</DocumentFragment>
|
|
43
61
|
`;
|
|
44
62
|
|
|
45
|
-
exports[`component:<Tooltip>
|
|
63
|
+
exports[`component:<Tooltip> inherit:className 1`] = `
|
|
46
64
|
<DocumentFragment>
|
|
47
|
-
<span
|
|
48
|
-
data-testid="onEnter"
|
|
49
|
-
>
|
|
65
|
+
<span>
|
|
50
66
|
<button
|
|
51
67
|
class="pressable button dispatcher"
|
|
52
|
-
data-testid="onEnter-dispatcher"
|
|
53
68
|
>
|
|
54
69
|
Action
|
|
55
70
|
</button>
|
|
@@ -57,30 +72,57 @@ exports[`component:<Tooltip> simulate behavior: onEnter & onLeave w/ Template 1`
|
|
|
57
72
|
</DocumentFragment>
|
|
58
73
|
`;
|
|
59
74
|
|
|
60
|
-
exports[`component:<Tooltip>
|
|
75
|
+
exports[`component:<Tooltip> prop:Template 1`] = `
|
|
61
76
|
<DocumentFragment>
|
|
62
|
-
<span
|
|
63
|
-
data-testid="onEnter"
|
|
64
|
-
>
|
|
77
|
+
<span>
|
|
65
78
|
<button
|
|
66
79
|
class="pressable button dispatcher"
|
|
67
|
-
data-testid="onEnter-dispatcher"
|
|
68
80
|
>
|
|
69
81
|
Action
|
|
70
82
|
</button>
|
|
71
83
|
</span>
|
|
84
|
+
<div
|
|
85
|
+
class="layer"
|
|
86
|
+
style="left: 0px; top: 0px;"
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
class="view tooltip left bottom"
|
|
90
|
+
>
|
|
91
|
+
<strong>
|
|
92
|
+
mirai
|
|
93
|
+
</strong>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
72
96
|
</DocumentFragment>
|
|
73
97
|
`;
|
|
74
98
|
|
|
75
|
-
exports[`component:<Tooltip>
|
|
99
|
+
exports[`component:<Tooltip> prop:text 1`] = `
|
|
76
100
|
<DocumentFragment>
|
|
77
|
-
<span
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
<span>
|
|
102
|
+
<button
|
|
103
|
+
class="pressable button dispatcher"
|
|
104
|
+
>
|
|
105
|
+
Action
|
|
106
|
+
</button>
|
|
107
|
+
</span>
|
|
108
|
+
<div
|
|
109
|
+
class="layer"
|
|
110
|
+
style="left: 0px; top: 0px;"
|
|
111
|
+
>
|
|
112
|
+
<div
|
|
113
|
+
class="view tooltip left bottom"
|
|
114
|
+
>
|
|
115
|
+
<span
|
|
116
|
+
class="text bold small text"
|
|
117
|
+
>
|
|
118
|
+
mirai
|
|
119
|
+
</span>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
80
122
|
</DocumentFragment>
|
|
81
123
|
`;
|
|
82
124
|
|
|
83
|
-
exports[`component:<Tooltip>
|
|
125
|
+
exports[`component:<Tooltip> prop:top 1`] = `
|
|
84
126
|
<DocumentFragment>
|
|
85
127
|
<span>
|
|
86
128
|
<button
|
|
@@ -89,10 +131,22 @@ exports[`component:<Tooltip> w/ children + Template 1`] = `
|
|
|
89
131
|
Action
|
|
90
132
|
</button>
|
|
91
133
|
</span>
|
|
134
|
+
<div
|
|
135
|
+
class="layer"
|
|
136
|
+
style="left: 0px; top: 0px;"
|
|
137
|
+
>
|
|
138
|
+
<div
|
|
139
|
+
class="view tooltip left top"
|
|
140
|
+
>
|
|
141
|
+
<span
|
|
142
|
+
class="text bold small text"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
92
146
|
</DocumentFragment>
|
|
93
147
|
`;
|
|
94
148
|
|
|
95
|
-
exports[`component:<Tooltip>
|
|
149
|
+
exports[`component:<Tooltip> renders 1`] = `
|
|
96
150
|
<DocumentFragment>
|
|
97
151
|
<span>
|
|
98
152
|
<button
|
|
@@ -104,11 +158,14 @@ exports[`component:<Tooltip> w/ children + text 1`] = `
|
|
|
104
158
|
</DocumentFragment>
|
|
105
159
|
`;
|
|
106
160
|
|
|
107
|
-
exports[`component:<Tooltip>
|
|
161
|
+
exports[`component:<Tooltip> testID 1`] = `
|
|
108
162
|
<DocumentFragment>
|
|
109
|
-
<span
|
|
163
|
+
<span
|
|
164
|
+
data-testid="mirai"
|
|
165
|
+
>
|
|
110
166
|
<button
|
|
111
167
|
class="pressable button dispatcher"
|
|
168
|
+
data-testid="mirai-dispatcher"
|
|
112
169
|
>
|
|
113
170
|
Action
|
|
114
171
|
</button>
|
|
@@ -12,7 +12,7 @@ var _hooks = require("../../hooks");
|
|
|
12
12
|
var _helpers2 = require("./helpers");
|
|
13
13
|
var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
|
|
14
14
|
var _LayerContent = require("./LayerContent");
|
|
15
|
-
var _excluded = ["bottom", "centered", "forceRender", "left", "right", "top", "visible"];
|
|
15
|
+
var _excluded = ["bottom", "centered", "forceRender", "left", "right", "top", "visible", "onPosition"];
|
|
16
16
|
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); }
|
|
17
17
|
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; }
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -38,6 +38,8 @@ var Layer = function Layer(_ref) {
|
|
|
38
38
|
forceRight = _ref.right,
|
|
39
39
|
forceTop = _ref.top,
|
|
40
40
|
visible = _ref.visible,
|
|
41
|
+
_ref$onPosition = _ref.onPosition,
|
|
42
|
+
onPosition = _ref$onPosition === void 0 ? function () {} : _ref$onPosition,
|
|
41
43
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
42
44
|
var device = (0, _hooks.useDevice)();
|
|
43
45
|
var componentRef = (0, _react.useRef)();
|
|
@@ -64,11 +66,14 @@ var Layer = function Layer(_ref) {
|
|
|
64
66
|
_getLayerPosition$lef = _getLayerPosition.left,
|
|
65
67
|
left = _getLayerPosition$lef === void 0 ? 0 : _getLayerPosition$lef,
|
|
66
68
|
_getLayerPosition$top = _getLayerPosition.top,
|
|
67
|
-
top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top
|
|
69
|
+
top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top,
|
|
70
|
+
_getLayerPosition$ori = _getLayerPosition.orientation,
|
|
71
|
+
orientation = _getLayerPosition$ori === void 0 ? {} : _getLayerPosition$ori;
|
|
68
72
|
setPosition({
|
|
69
73
|
left: "".concat(left, "px"),
|
|
70
74
|
top: "".concat(top, "px")
|
|
71
75
|
});
|
|
76
|
+
onPosition(orientation);
|
|
72
77
|
}, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);
|
|
73
78
|
var children = _react.default.Children.map(others.children || [], function (child) {
|
|
74
79
|
return child;
|
|
@@ -97,6 +102,7 @@ Layer.propTypes = {
|
|
|
97
102
|
left: _propTypes.default.bool,
|
|
98
103
|
right: _propTypes.default.bool,
|
|
99
104
|
top: _propTypes.default.bool,
|
|
100
|
-
visible: _propTypes.default.bool
|
|
105
|
+
visible: _propTypes.default.bool,
|
|
106
|
+
onPosition: _propTypes.default.func
|
|
101
107
|
};
|
|
102
108
|
//# sourceMappingURL=Layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","forceRender","forceLeft","left","forceRight","right","forceTop","top","visible","others","device","useDevice","componentRef","useRef","contentRef","useState","position","setPosition","useLayoutEffect","current","componentEl","firstChild","contentEl","componentLayout","getElementLayout","contentLayout","getLayerPosition","children","React","Children","map","child","find","name","type","LayerContent","styles","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 = ({\n bottom: forceBottom,\n centered,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n ...others\n}) => {\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 {
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","forceRender","forceLeft","left","forceRight","right","forceTop","top","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","position","setPosition","useLayoutEffect","current","componentEl","firstChild","contentEl","componentLayout","getElementLayout","contentLayout","getLayerPosition","orientation","children","React","Children","map","child","find","name","type","LayerContent","styles","style","layer","hidden","className","propTypes","PropTypes","bool","node","func"],"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 = ({\n bottom: forceBottom,\n centered,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n onPosition = () => {},\n ...others\n}) => {\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 {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n }, [centered, device, forceBottom, forceLeft, forceRight, forceTop, 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 bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,GAAG,SAARA,KAAK,OAUL;EAAA,IATIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;IAAA,wBACRC,WAAW;IAAXA,WAAW,iCAAG,IAAI;IACZC,SAAS,QAAfC,IAAI;IACGC,UAAU,QAAjBC,KAAK;IACAC,QAAQ,QAAbC,GAAG;IACHC,OAAO,QAAPA,OAAO;IAAA,uBACPC,UAAU;IAAVA,UAAU,gCAAG,YAAM,CAAC,CAAC;IAClBC,MAAM;EAET,IAAMC,MAAM,GAAG,IAAAC,gBAAS,GAAE;EAC1B,IAAMC,YA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