@mirai/ui 1.0.10 → 1.0.11
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 +79 -16
- package/build/components/InputSelect/InputSelect.js +1 -1
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +46 -46
- package/build/components/InputText/InputText.module.css +2 -1
- package/build/components/Menu/Menu.Option.js +42 -0
- package/build/components/Menu/Menu.Option.js.map +1 -0
- package/build/components/Menu/Menu.js +52 -0
- package/build/components/Menu/Menu.js.map +1 -0
- package/build/components/Menu/Menu.module.css +50 -0
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +178 -0
- package/build/components/Menu/index.js +19 -0
- package/build/components/Menu/index.js.map +1 -0
- package/build/components/Tooltip/Tooltip.js +65 -0
- package/build/components/Tooltip/Tooltip.js.map +1 -0
- package/build/components/Tooltip/Tooltip.module.css +26 -0
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +117 -0
- package/build/components/Tooltip/index.js +19 -0
- package/build/components/Tooltip/index.js.map +1 -0
- package/build/components/index.js +26 -0
- package/build/components/index.js.map +1 -1
- package/build/primitives/Icon/Icon.constants.js +1 -0
- package/build/primitives/Icon/Icon.constants.js.map +1 -1
- package/build/primitives/Layer/Layer.js +32 -34
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/Layer.module.css +1 -1
- package/build/primitives/Layer/LayerContent.js +1 -1
- package/build/primitives/Layer/LayerContent.js.map +1 -1
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +51 -17
- package/build/primitives/Layer/helpers/getLayerPosition.js +2 -0
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
- package/build/primitives/Select/Select.js +1 -1
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +25 -25
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--mirai-ui-menu-base: var(--mirai-ui-base);
|
|
3
|
+
--mirai-ui-menu-border-radius: var(--mirai-ui-border-radius);
|
|
4
|
+
--mirai-ui-menu-min-width: 200px;
|
|
5
|
+
--mirai-ui-menu-shadow: 0 1px calc(var(--mirai-ui-space-XS) / 2) var(--mirai-ui-lighten);
|
|
6
|
+
--mirai-ui-menu-option-padding: var(--mirai-ui-space-M);
|
|
7
|
+
--mirai-ui-menu-option-disabled: var(--mirai-ui-disabled);
|
|
8
|
+
--mirai-ui-menu-option-hover: var(--mirai-ui-accent-lighten);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.menu {
|
|
12
|
+
background-color: var(--mirai-ui-menu-base);
|
|
13
|
+
border-radius: var(--mirai-ui-menu-border-radius);
|
|
14
|
+
box-shadow: var(--mirai-ui-menu-shadow);
|
|
15
|
+
min-width: var(--mirai-ui-menu-min-width);
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.menu .option {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
padding: var(--mirai-ui-menu-option-padding);
|
|
24
|
+
align-items: center;
|
|
25
|
+
flex: 1;
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.menu .option:hover:not(.disabled) {
|
|
30
|
+
background-color: var(--mirai-ui-menu-option-hover);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.menu .icon {
|
|
34
|
+
margin-right: var(--mirai-ui-menu-option-padding);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.menu .label {
|
|
38
|
+
flex: 1;
|
|
39
|
+
text-align: left;
|
|
40
|
+
padding-right: var(--mirai-ui-menu-option-padding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.menu .divider {
|
|
44
|
+
box-shadow: inset 0 -1px var(--mirai-ui-menu-option-disabled);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.menu .disabled {
|
|
48
|
+
color: var(--mirai-ui-menu-option-disabled);
|
|
49
|
+
cursor: default;
|
|
50
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`component:<Menu> inherit:className 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<span />
|
|
6
|
+
</DocumentFragment>
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`component:<Menu> renders 1`] = `
|
|
10
|
+
<DocumentFragment>
|
|
11
|
+
<span />
|
|
12
|
+
</DocumentFragment>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`component:<Menu> testID 1`] = `
|
|
16
|
+
<DocumentFragment>
|
|
17
|
+
<span
|
|
18
|
+
data-testid="mirai"
|
|
19
|
+
/>
|
|
20
|
+
</DocumentFragment>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
exports[`component:<Menu> w/ Template 1`] = `
|
|
24
|
+
<DocumentFragment>
|
|
25
|
+
<span>
|
|
26
|
+
<button
|
|
27
|
+
class="pressable button"
|
|
28
|
+
>
|
|
29
|
+
Action
|
|
30
|
+
</button>
|
|
31
|
+
</span>
|
|
32
|
+
</DocumentFragment>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
exports[`component:<Menu> w/ children 1`] = `
|
|
36
|
+
<DocumentFragment>
|
|
37
|
+
<span>
|
|
38
|
+
<button
|
|
39
|
+
class="pressable button"
|
|
40
|
+
>
|
|
41
|
+
Action
|
|
42
|
+
</button>
|
|
43
|
+
</span>
|
|
44
|
+
</DocumentFragment>
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`component:<Menu> w/ options & visible 1`] = `
|
|
48
|
+
<DocumentFragment>
|
|
49
|
+
<span>
|
|
50
|
+
<button
|
|
51
|
+
class="pressable button"
|
|
52
|
+
>
|
|
53
|
+
Action
|
|
54
|
+
</button>
|
|
55
|
+
</span>
|
|
56
|
+
<span
|
|
57
|
+
class="layer menu visible"
|
|
58
|
+
style="left: 0px; top: 0px;"
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
class="pressable option"
|
|
62
|
+
value="one"
|
|
63
|
+
>
|
|
64
|
+
<span
|
|
65
|
+
class="icon icon"
|
|
66
|
+
>
|
|
67
|
+
<svg
|
|
68
|
+
fill="none"
|
|
69
|
+
height="1em"
|
|
70
|
+
stroke="currentColor"
|
|
71
|
+
stroke-linecap="round"
|
|
72
|
+
stroke-linejoin="round"
|
|
73
|
+
stroke-width="2"
|
|
74
|
+
viewBox="0 0 24 24"
|
|
75
|
+
width="1em"
|
|
76
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
77
|
+
>
|
|
78
|
+
<line
|
|
79
|
+
x1="12"
|
|
80
|
+
x2="12"
|
|
81
|
+
y1="5"
|
|
82
|
+
y2="19"
|
|
83
|
+
/>
|
|
84
|
+
<line
|
|
85
|
+
x1="5"
|
|
86
|
+
x2="19"
|
|
87
|
+
y1="12"
|
|
88
|
+
y2="12"
|
|
89
|
+
/>
|
|
90
|
+
</svg>
|
|
91
|
+
</span>
|
|
92
|
+
<span
|
|
93
|
+
class="text paragraph label"
|
|
94
|
+
>
|
|
95
|
+
Item 1
|
|
96
|
+
</span>
|
|
97
|
+
</div>
|
|
98
|
+
<div
|
|
99
|
+
class="pressable option disabled"
|
|
100
|
+
value="two"
|
|
101
|
+
>
|
|
102
|
+
<span
|
|
103
|
+
class="icon icon disabled"
|
|
104
|
+
>
|
|
105
|
+
<svg
|
|
106
|
+
fill="none"
|
|
107
|
+
height="1em"
|
|
108
|
+
stroke="currentColor"
|
|
109
|
+
stroke-linecap="round"
|
|
110
|
+
stroke-linejoin="round"
|
|
111
|
+
stroke-width="2"
|
|
112
|
+
viewBox="0 0 24 24"
|
|
113
|
+
width="1em"
|
|
114
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
115
|
+
>
|
|
116
|
+
<line
|
|
117
|
+
x1="12"
|
|
118
|
+
x2="12"
|
|
119
|
+
y1="5"
|
|
120
|
+
y2="19"
|
|
121
|
+
/>
|
|
122
|
+
<line
|
|
123
|
+
x1="5"
|
|
124
|
+
x2="19"
|
|
125
|
+
y1="12"
|
|
126
|
+
y2="12"
|
|
127
|
+
/>
|
|
128
|
+
</svg>
|
|
129
|
+
</span>
|
|
130
|
+
<span
|
|
131
|
+
class="text paragraph label disabled"
|
|
132
|
+
>
|
|
133
|
+
Item 2
|
|
134
|
+
</span>
|
|
135
|
+
</div>
|
|
136
|
+
<div
|
|
137
|
+
class="pressable option divider"
|
|
138
|
+
value="three"
|
|
139
|
+
>
|
|
140
|
+
<span
|
|
141
|
+
class="icon icon"
|
|
142
|
+
/>
|
|
143
|
+
<span
|
|
144
|
+
class="text paragraph label"
|
|
145
|
+
>
|
|
146
|
+
Item 3
|
|
147
|
+
</span>
|
|
148
|
+
</div>
|
|
149
|
+
<div
|
|
150
|
+
class="pressable option"
|
|
151
|
+
value="four"
|
|
152
|
+
>
|
|
153
|
+
<span
|
|
154
|
+
class="text paragraph label"
|
|
155
|
+
>
|
|
156
|
+
Item 4
|
|
157
|
+
</span>
|
|
158
|
+
<button
|
|
159
|
+
class="pressable button small"
|
|
160
|
+
>
|
|
161
|
+
Add
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
</span>
|
|
165
|
+
</DocumentFragment>
|
|
166
|
+
`;
|
|
167
|
+
|
|
168
|
+
exports[`component:<Menu> w/ options 1`] = `
|
|
169
|
+
<DocumentFragment>
|
|
170
|
+
<span>
|
|
171
|
+
<button
|
|
172
|
+
class="pressable button"
|
|
173
|
+
>
|
|
174
|
+
Action
|
|
175
|
+
</button>
|
|
176
|
+
</span>
|
|
177
|
+
</DocumentFragment>
|
|
178
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _Menu = require("./Menu");
|
|
8
|
+
|
|
9
|
+
Object.keys(_Menu).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _Menu[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Menu[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Menu/index.js"],"sourcesContent":["export * from './Menu';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.Tooltip = void 0;
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _helpers = require("../../helpers");
|
|
21
|
+
|
|
22
|
+
var _primitives = require("../../primitives");
|
|
23
|
+
|
|
24
|
+
var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
|
|
25
|
+
|
|
26
|
+
var _excluded = ["children", "Template", "text"];
|
|
27
|
+
|
|
28
|
+
var Tooltip = function Tooltip(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
Template = _ref.Template,
|
|
31
|
+
text = _ref.text,
|
|
32
|
+
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
|
+
|
|
34
|
+
var _useState = (0, _react.useState)(others.visible || false),
|
|
35
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
36
|
+
visible = _useState2[0],
|
|
37
|
+
setVisible = _useState2[1];
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Layer, Object.assign({}, others, {
|
|
40
|
+
centered: true,
|
|
41
|
+
visible: visible
|
|
42
|
+
}), _react.default.Children.map(children, function (child, index) {
|
|
43
|
+
return /*#__PURE__*/_react.default.cloneElement(child, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, child.props), {}, {
|
|
44
|
+
key: index,
|
|
45
|
+
'data-testid': others['data-testid'] ? "".concat(others['data-testid'], "-dispatcher") : undefined,
|
|
46
|
+
className: (0, _helpers.styles)(_TooltipModule.default.dispatcher, child.props.className),
|
|
47
|
+
onMouseEnter: function onMouseEnter() {
|
|
48
|
+
return setVisible(true);
|
|
49
|
+
},
|
|
50
|
+
onMouseLeave: function onMouseLeave() {
|
|
51
|
+
return setVisible(false);
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
}), /*#__PURE__*/_react.default.createElement(_primitives.LayerContent, null, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
55
|
+
className: _TooltipModule.default.tooltip
|
|
56
|
+
}, Template ? /*#__PURE__*/_react.default.createElement(Template, null) : /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
57
|
+
bold: true,
|
|
58
|
+
small: true,
|
|
59
|
+
className: _TooltipModule.default.text
|
|
60
|
+
}, text))));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.Tooltip = Tooltip;
|
|
64
|
+
Tooltip.displayName = 'Component:Tooltip';
|
|
65
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +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"],"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":";;;;;;;;;;;;;;;;;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,oBAAWF,MAAX;IAAmB,QAAQ,MAA3B;IAA4B,OAAO,EAAEC;EAArC,IACGE,eAAMC,QAAN,CAAeC,GAAf,CAAmBR,QAAnB,EAA6B,UAACS,KAAD,EAAQC,KAAR;IAAA,oBAC5BJ,eAAMK,YAAN,CAAmBF,KAAnB,8DACKA,KAAK,CAACG,KADX;MAEEC,GAAG,EAAEH,KAFP;MAGE,eAAeP,MAAM,CAAC,aAAD,CAAN,aAA2BA,MAAM,CAAC,aAAD,CAAjC,mBAAgEW,SAHjF;MAIEC,SAAS,EAAE,qBAAOC,uBAAMC,UAAb,EAAyBR,KAAK,CAACG,KAAN,CAAYG,SAArC,CAJb;MAKEG,YAAY,EAAE;QAAA,OAAMb,UAAU,CAAC,IAAD,CAAhB;MAAA,CALhB;MAMEc,YAAY,EAAE;QAAA,OAAMd,UAAU,CAAC,KAAD,CAAhB;MAAA;IANhB,GAD4B;EAAA,CAA7B,CADH,eAYE,6BAAC,wBAAD,qBACE,6BAAC,gBAAD;IAAM,SAAS,EAAEW,uBAAMI;EAAvB,GACGnB,QAAQ,gBACP,6BAAC,QAAD,OADO,gBAGP,6BAAC,gBAAD;IAAM,IAAI,MAAV;IAAW,KAAK,MAAhB;IAAiB,SAAS,EAAEe,uBAAMd;EAAlC,GACGA,IADH,CAJJ,CADF,CAZF,CADF;AA0BD,CA7BD;;;AA+BAH,OAAO,CAACsB,WAAR,GAAsB,mBAAtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--mirai-ui-tooltip-background: rgba(0, 0, 0, 0.8);
|
|
3
|
+
--mirai-ui-tooltip-border-radius: var(--mirai-ui-border-radius);
|
|
4
|
+
--mirai-ui-tooltip-color: var(--mirai-ui-base);
|
|
5
|
+
--mirai-ui-tooltip-space: var(--mirai-ui-space-XS);
|
|
6
|
+
--mirai-ui-tooltip-max-width: calc(var(--mirai-ui-space-XXL) * 4);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dispatcher {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tooltip {
|
|
14
|
+
background-color: var(--mirai-ui-tooltip-background);
|
|
15
|
+
border-radius: var(--mirai-ui-tooltip-border-radius);
|
|
16
|
+
margin-bottom: calc(var(--mirai-ui-tooltip-space) / 2);
|
|
17
|
+
margin-top: calc(var(--mirai-ui-tooltip-space) / 2);
|
|
18
|
+
max-width: var(--mirai-ui-tooltip-max-width);
|
|
19
|
+
padding: var(--mirai-ui-tooltip-space);
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tooltip .text {
|
|
24
|
+
color: var(--mirai-ui-tooltip-color);
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[` 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<span
|
|
6
|
+
data-testid="onEnter"
|
|
7
|
+
>
|
|
8
|
+
<button
|
|
9
|
+
class="pressable button dispatcher"
|
|
10
|
+
data-testid="onEnter-dispatcher"
|
|
11
|
+
>
|
|
12
|
+
Action
|
|
13
|
+
</button>
|
|
14
|
+
</span>
|
|
15
|
+
</DocumentFragment>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[` 2`] = `
|
|
19
|
+
<DocumentFragment>
|
|
20
|
+
<span
|
|
21
|
+
data-testid="onEnter"
|
|
22
|
+
>
|
|
23
|
+
<button
|
|
24
|
+
class="pressable button dispatcher"
|
|
25
|
+
data-testid="onEnter-dispatcher"
|
|
26
|
+
>
|
|
27
|
+
Action
|
|
28
|
+
</button>
|
|
29
|
+
</span>
|
|
30
|
+
</DocumentFragment>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`component:<Tooltip> inherit:className 1`] = `
|
|
34
|
+
<DocumentFragment>
|
|
35
|
+
<span />
|
|
36
|
+
</DocumentFragment>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`component:<Tooltip> renders 1`] = `
|
|
40
|
+
<DocumentFragment>
|
|
41
|
+
<span />
|
|
42
|
+
</DocumentFragment>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`component:<Tooltip> simulate behavior: onEnter & onLeave w/ Template 1`] = `
|
|
46
|
+
<DocumentFragment>
|
|
47
|
+
<span
|
|
48
|
+
data-testid="onEnter"
|
|
49
|
+
>
|
|
50
|
+
<button
|
|
51
|
+
class="pressable button dispatcher"
|
|
52
|
+
data-testid="onEnter-dispatcher"
|
|
53
|
+
>
|
|
54
|
+
Action
|
|
55
|
+
</button>
|
|
56
|
+
</span>
|
|
57
|
+
</DocumentFragment>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`component:<Tooltip> simulate behavior: onEnter & onLeave w/ Template 2`] = `
|
|
61
|
+
<DocumentFragment>
|
|
62
|
+
<span
|
|
63
|
+
data-testid="onEnter"
|
|
64
|
+
>
|
|
65
|
+
<button
|
|
66
|
+
class="pressable button dispatcher"
|
|
67
|
+
data-testid="onEnter-dispatcher"
|
|
68
|
+
>
|
|
69
|
+
Action
|
|
70
|
+
</button>
|
|
71
|
+
</span>
|
|
72
|
+
</DocumentFragment>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`component:<Tooltip> testID 1`] = `
|
|
76
|
+
<DocumentFragment>
|
|
77
|
+
<span
|
|
78
|
+
data-testid="mirai"
|
|
79
|
+
/>
|
|
80
|
+
</DocumentFragment>
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
exports[`component:<Tooltip> w/ children + Template 1`] = `
|
|
84
|
+
<DocumentFragment>
|
|
85
|
+
<span>
|
|
86
|
+
<button
|
|
87
|
+
class="pressable button dispatcher"
|
|
88
|
+
>
|
|
89
|
+
Action
|
|
90
|
+
</button>
|
|
91
|
+
</span>
|
|
92
|
+
</DocumentFragment>
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
exports[`component:<Tooltip> w/ children + text 1`] = `
|
|
96
|
+
<DocumentFragment>
|
|
97
|
+
<span>
|
|
98
|
+
<button
|
|
99
|
+
class="pressable button dispatcher"
|
|
100
|
+
>
|
|
101
|
+
Action
|
|
102
|
+
</button>
|
|
103
|
+
</span>
|
|
104
|
+
</DocumentFragment>
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
exports[`component:<Tooltip> w/ children 1`] = `
|
|
108
|
+
<DocumentFragment>
|
|
109
|
+
<span>
|
|
110
|
+
<button
|
|
111
|
+
class="pressable button dispatcher"
|
|
112
|
+
>
|
|
113
|
+
Action
|
|
114
|
+
</button>
|
|
115
|
+
</span>
|
|
116
|
+
</DocumentFragment>
|
|
117
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _Tooltip = require("./Tooltip");
|
|
8
|
+
|
|
9
|
+
Object.keys(_Tooltip).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _Tooltip[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Tooltip[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tooltip/index.js"],"sourcesContent":["export * from './Tooltip';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -95,6 +95,19 @@ Object.keys(_InputText).forEach(function (key) {
|
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
+
var _Menu = require("./Menu");
|
|
99
|
+
|
|
100
|
+
Object.keys(_Menu).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (key in exports && exports[key] === _Menu[key]) return;
|
|
103
|
+
Object.defineProperty(exports, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function get() {
|
|
106
|
+
return _Menu[key];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
98
111
|
var _Modal = require("./Modal");
|
|
99
112
|
|
|
100
113
|
Object.keys(_Modal).forEach(function (key) {
|
|
@@ -120,4 +133,17 @@ Object.keys(_Table).forEach(function (key) {
|
|
|
120
133
|
}
|
|
121
134
|
});
|
|
122
135
|
});
|
|
136
|
+
|
|
137
|
+
var _Tooltip = require("./Tooltip");
|
|
138
|
+
|
|
139
|
+
Object.keys(_Tooltip).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _Tooltip[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function get() {
|
|
145
|
+
return _Tooltip[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
123
149
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.js"],"sourcesContent":["export * from './Button';\nexport * from './Calendar';\nexport * from './Form';\nexport * from './InputNumber';\nexport * from './InputOption';\nexport * from './InputSelect';\nexport * from './InputText';\nexport * from './Modal';\nexport * from './Table';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.js"],"sourcesContent":["export * from './Button';\nexport * from './Calendar';\nexport * from './Form';\nexport * from './InputNumber';\nexport * from './InputOption';\nexport * from './InputSelect';\nexport * from './InputText';\nexport * from './Menu';\nexport * from './Modal';\nexport * from './Table';\nexport * from './Tooltip';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.constants.js","names":["ICONS","Left","Right","Up","Down","Close","CloseArrow","Plus","Minus","EyeOpen","EyeClose","Check"],"sources":["../../../src/primitives/Icon/Icon.constants.js"],"sourcesContent":["import {\n FiArrowUp as Up,\n FiArrowDown as Down,\n FiArrowLeft as Left,\n FiArrowRight as Right,\n FiChevronDown as CloseArrow,\n FiX as Close,\n FiEye as EyeOpen,\n FiEyeOff as EyeClose,\n FiPlus as Plus,\n FiMinus as Minus,\n FiCheck as Check,\n} from 'react-icons/fi';\n\nconst ICONS = {\n // directions\n Left,\n Right,\n Up,\n Down,\n // Close\n Close,\n CloseArrow,\n // Calc\n Plus,\n Minus,\n // Eye\n EyeOpen,\n EyeClose,\n // Check\n Check,\n};\n\nexport { ICONS };\n"],"mappings":";;;;;;;AAAA;;AAcA,IAAMA,KAAK,GAAG;
|
|
1
|
+
{"version":3,"file":"Icon.constants.js","names":["ICONS","Empty","undefined","Left","Right","Up","Down","Close","CloseArrow","Plus","Minus","EyeOpen","EyeClose","Check"],"sources":["../../../src/primitives/Icon/Icon.constants.js"],"sourcesContent":["import {\n FiArrowUp as Up,\n FiArrowDown as Down,\n FiArrowLeft as Left,\n FiArrowRight as Right,\n FiChevronDown as CloseArrow,\n FiX as Close,\n FiEye as EyeOpen,\n FiEyeOff as EyeClose,\n FiPlus as Plus,\n FiMinus as Minus,\n FiCheck as Check,\n} from 'react-icons/fi';\n\nconst ICONS = {\n Empty: undefined,\n // directions\n Left,\n Right,\n Up,\n Down,\n // Close\n Close,\n CloseArrow,\n // Calc\n Plus,\n Minus,\n // Eye\n EyeOpen,\n EyeClose,\n // Check\n Check,\n};\n\nexport { ICONS };\n"],"mappings":";;;;;;;AAAA;;AAcA,IAAMA,KAAK,GAAG;EACZC,KAAK,EAAEC,SADK;EAEZ;EACAC,IAAI,EAAJA,eAHY;EAIZC,KAAK,EAALA,gBAJY;EAKZC,EAAE,EAAFA,aALY;EAMZC,IAAI,EAAJA,eANY;EAOZ;EACAC,KAAK,EAALA,OARY;EASZC,UAAU,EAAVA,iBATY;EAUZ;EACAC,IAAI,EAAJA,UAXY;EAYZC,KAAK,EAALA,WAZY;EAaZ;EACAC,OAAO,EAAPA,SAdY;EAeZC,QAAQ,EAARA,YAfY;EAgBZ;EACAC,KAAK,EAALA;AAjBY,CAAd"}
|
|
@@ -27,63 +27,61 @@ var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
|
|
|
27
27
|
|
|
28
28
|
var _LayerContent = require("./LayerContent");
|
|
29
29
|
|
|
30
|
-
var _excluded = ["visible"];
|
|
30
|
+
var _excluded = ["centered", "visible"];
|
|
31
31
|
|
|
32
32
|
var Layer = function Layer(_ref) {
|
|
33
|
-
var
|
|
33
|
+
var centered = _ref.centered,
|
|
34
|
+
visible = _ref.visible,
|
|
34
35
|
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
35
36
|
var device = (0, _hooks.useDevice)();
|
|
36
|
-
var componentRef = (0, _react.useRef)(
|
|
37
|
-
var contentRef = (0, _react.useRef)(
|
|
37
|
+
var componentRef = (0, _react.useRef)();
|
|
38
|
+
var contentRef = (0, _react.useRef)();
|
|
38
39
|
|
|
39
|
-
var _useState = (0, _react.useState)(
|
|
40
|
+
var _useState = (0, _react.useState)(),
|
|
40
41
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
41
42
|
position = _useState2[0],
|
|
42
43
|
setPosition = _useState2[1];
|
|
43
44
|
|
|
44
|
-
(0, _react.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}, [device, visible]);
|
|
45
|
+
(0, _react.useLayoutEffect)(function () {
|
|
46
|
+
var _componentRef$current = componentRef.current;
|
|
47
|
+
_componentRef$current = _componentRef$current === void 0 ? {} : _componentRef$current;
|
|
48
|
+
var componentEl = _componentRef$current.firstChild;
|
|
49
|
+
var contentEl = contentRef.current;
|
|
50
|
+
if (!componentEl || !contentEl) return setPosition();
|
|
51
|
+
var componentLayout = (0, _helpers2.getElementLayout)(componentEl);
|
|
52
|
+
var contentLayout = (0, _helpers2.getElementLayout)(contentEl);
|
|
53
|
+
|
|
54
|
+
var _getLayerPosition = (0, _helpers2.getLayerPosition)(componentLayout, contentLayout, device, centered),
|
|
55
|
+
_getLayerPosition$lef = _getLayerPosition.left,
|
|
56
|
+
left = _getLayerPosition$lef === void 0 ? 0 : _getLayerPosition$lef,
|
|
57
|
+
_getLayerPosition$top = _getLayerPosition.top,
|
|
58
|
+
top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top;
|
|
59
|
+
|
|
60
|
+
setPosition({
|
|
61
|
+
left: "".concat(left, "px"),
|
|
62
|
+
top: "".concat(top, "px")
|
|
63
|
+
});
|
|
64
|
+
}, [centered, device, visible]);
|
|
66
65
|
|
|
67
66
|
var children = _react.default.Children.map(others.children || [], function (child) {
|
|
68
67
|
return child;
|
|
69
68
|
});
|
|
70
69
|
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
71
|
+
"data-testid": others['data-testid'],
|
|
72
72
|
ref: componentRef
|
|
73
73
|
}, children.find(function (_ref2) {
|
|
74
74
|
var name = _ref2.type.name;
|
|
75
75
|
return name !== _LayerContent.LayerContent.name;
|
|
76
|
-
})), visible && /*#__PURE__*/_react.default.createElement("
|
|
77
|
-
|
|
76
|
+
})), visible && /*#__PURE__*/_react.default.createElement("span", {
|
|
77
|
+
ref: contentRef,
|
|
78
|
+
className: (0, _helpers.styles)(_LayerModule.default.layer, others.className),
|
|
78
79
|
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, others.style), position)
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
ref: contentRef
|
|
81
80
|
}, children.find(function (_ref3) {
|
|
82
81
|
var name = _ref3.type.name;
|
|
83
82
|
return name === _LayerContent.LayerContent.name;
|
|
84
|
-
})))
|
|
83
|
+
})));
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
exports.Layer = Layer;
|
|
88
|
-
Layer.displayName = 'Primitive:Layer';
|
|
89
87
|
//# sourceMappingURL=Layer.js.map
|