@mirai/ui 1.0.86 → 1.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build/components/Button/Button.js +10 -5
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/Button.module.css +130 -29
- package/build/components/Button/Button.stories.js +28 -6
- package/build/components/Button/Button.stories.js.map +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +24 -8
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +9 -9
- package/build/theme/default.theme.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -400,6 +400,7 @@ const MyComponent = (props) => {
|
|
|
400
400
|
--mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
|
|
401
401
|
--mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
|
|
402
402
|
--mirai-ui-button-secondary-background: var(--mirai-ui-base);
|
|
403
|
+
--mirai-ui-button-secondary-color-active: var(--mirai-ui-accent-border);
|
|
403
404
|
--mirai-ui-button-padding-y: var(--mirai-ui-space-S);
|
|
404
405
|
--mirai-ui-button-padding-x: var(--mirai-ui-space-L);
|
|
405
406
|
--mirai-ui-button-radius: var(--mirai-ui-border-radius);
|
|
@@ -37,11 +37,16 @@ var Button = function Button(_ref) {
|
|
|
37
37
|
return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _objectSpread(_objectSpread({}, others), {}, {
|
|
38
38
|
disabled: disabled || busy,
|
|
39
39
|
tag: tag,
|
|
40
|
-
className: (0, _helpers.styles)(_ButtonModule.default.button, busy && _ButtonModule.default.busy, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, secondary && _ButtonModule.default.secondary,
|
|
41
|
-
onPress:
|
|
42
|
-
}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
43
|
-
className: (0, _helpers.styles)(_ButtonModule.default.
|
|
44
|
-
}
|
|
40
|
+
className: (0, _helpers.styles)(_ButtonModule.default.button, busy && !disabled && _ButtonModule.default.busy, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, secondary && !disabled && _ButtonModule.default.secondary, (disabled || busy) && _ButtonModule.default.disabled, wide && _ButtonModule.default.wide, others.className),
|
|
41
|
+
onPress: onPress
|
|
42
|
+
}), busy === undefined ? children : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
43
|
+
className: (0, _helpers.styles)(_ButtonModule.default.busyContainer, busy && _ButtonModule.default.active)
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
45
|
+
className: _ButtonModule.default.spinner
|
|
46
|
+
})), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
47
|
+
row: true,
|
|
48
|
+
className: _ButtonModule.default.children
|
|
49
|
+
}, children)));
|
|
45
50
|
};
|
|
46
51
|
exports.Button = Button;
|
|
47
52
|
Button.displayName = 'Component:Button';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","rounded","secondary","small","squared","tag","wide","onPress","others","React","createElement","Pressable","className","styles","style","button","undefined","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","rounded","secondary","small","squared","tag","wide","onPress","others","React","createElement","Pressable","className","styles","style","button","undefined","busyContainer","active","spinner","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Button/Button.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable, View } from '../../primitives';\nimport style from './Button.module.css';\n\nconst Button = ({\n busy,\n children,\n disabled,\n large,\n rounded,\n secondary,\n small,\n squared = false,\n tag = 'button',\n wide,\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled: disabled || busy,\n tag,\n className: styles(\n style.button,\n busy && !disabled && style.busy,\n large && style.large,\n small && style.small,\n rounded && style.rounded,\n squared && style.squared,\n secondary && !disabled && style.secondary,\n (disabled || busy) && style.disabled,\n wide && style.wide,\n others.className,\n ),\n onPress,\n },\n busy === undefined ? (\n children\n ) : (\n <>\n <View className={styles(style.busyContainer, busy && style.active)}>\n <View className={style.spinner} />\n </View>\n <View row className={style.children}>\n {children}\n </View>\n </>\n ),\n );\n\nButton.displayName = 'Component:Button';\n\nButton.propTypes = {\n busy: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n large: PropTypes.bool,\n rounded: PropTypes.bool,\n secondary: PropTypes.bool,\n small: PropTypes.bool,\n squared: PropTypes.bool,\n tag: PropTypes.string,\n wide: PropTypes.bool,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Button };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAExC,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,IACVC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,OAAO,QAAPA,OAAO;IACPC,SAAS,QAATA,SAAS;IACTC,KAAK,QAALA,KAAK;IAAA,oBACLC,OAAO;IAAPA,OAAO,6BAAG,KAAK;IAAA,gBACfC,GAAG;IAAHA,GAAG,yBAAG,QAAQ;IACdC,IAAI,QAAJA,IAAI;IACJC,OAAO,QAAPA,OAAO;IACJC,MAAM;EAAA,oBAETC,cAAK,CAACC,aAAa,CACjBC,qBAAS,kCAEJH,MAAM;IACTT,QAAQ,EAAEA,QAAQ,IAAIF,IAAI;IAC1BQ,GAAG,EAAHA,GAAG;IACHO,SAAS,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AS,CAACC,IAAI;EACzBpB,KAAK,EAAEmB,kBAAS,CAACC,IAAI;EACrBnB,OAAO,EAAEkB,kBAAS,CAACC,IAAI;EACvBlB,GAAG,EAAEiB,kBAAS,CAACG,MAAM;EACrBnB,IAAI,EAAEgB,kBAAS,CAACC,IAAI;EACpBI,OAAO,EAAEL,kBAAS,CAACM,IAAI;EACvBC,OAAO,EAAEP,kBAAS,CAACM,IAAI;EACvBrB,OAAO,EAAEe,kBAAS,CAACM;AACrB,CAAC"}
|
|
@@ -18,35 +18,6 @@
|
|
|
18
18
|
color: var(--mirai-ui-button-disabled-color);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
@keyframes mirai-button-busy {
|
|
22
|
-
from {
|
|
23
|
-
width: var(--mirai-ui-button-busy-width);
|
|
24
|
-
}
|
|
25
|
-
to {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.secondary .busyProgress {
|
|
31
|
-
background-color: var(--mirai-ui-button-background);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.busyProgress {
|
|
35
|
-
background-color: var(--mirai-ui-button-color);
|
|
36
|
-
opacity: 0.2;
|
|
37
|
-
height: 100%;
|
|
38
|
-
left: 0;
|
|
39
|
-
position: absolute;
|
|
40
|
-
width: 0%;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.busyProgress.active {
|
|
44
|
-
animation-duration: var(--mirai-ui-button-busy-motion);
|
|
45
|
-
animation-iteration-count: infinite;
|
|
46
|
-
animation-name: mirai-button-busy;
|
|
47
|
-
animation-timing-function: var(--mirai-ui-motion-easing);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
21
|
.button:not(.secondary):not(:disabled):active {
|
|
51
22
|
box-shadow: inset 0 0 var(--mirai-ui-space-XL) var(--mirai-ui-space-XL) var(--mirai-ui-button-color-active);
|
|
52
23
|
}
|
|
@@ -93,6 +64,136 @@
|
|
|
93
64
|
width: 100%;
|
|
94
65
|
}
|
|
95
66
|
|
|
67
|
+
/* busy:bool */
|
|
68
|
+
|
|
69
|
+
.button .children,
|
|
70
|
+
.button .spinner {
|
|
71
|
+
transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
72
|
+
transform var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.button.busy .children {
|
|
76
|
+
opacity: 0;
|
|
77
|
+
transform: translateY(var(--mirai-ui-space-XL));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.button .spinner {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
transform: translateY(calc(var(--mirai-ui-space-XL) * -1));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.button.busy .spinner {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
transform: translateY(0%);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.busyContainer {
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
height: 100%;
|
|
94
|
+
left: 0;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
position: absolute;
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.busyContainer:before {
|
|
101
|
+
background-color: var(--mirai-ui-base);
|
|
102
|
+
content: '';
|
|
103
|
+
display: inline-block;
|
|
104
|
+
opacity: 0;
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 0;
|
|
107
|
+
left: 0;
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
display: block;
|
|
111
|
+
transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.secondary:not(:disabled) .busyContainer:before {
|
|
115
|
+
background-color: var(--mirai-ui-button-background);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.busyContainer.active:before {
|
|
119
|
+
opacity: 0.2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.spinner,
|
|
123
|
+
.spinner::before,
|
|
124
|
+
.spinner::after {
|
|
125
|
+
animation: mirai-button-busy calc(var(--mirai-ui-motion-expand) * 3) infinite var(--mirai-ui-motion-easing) alternate;
|
|
126
|
+
background-color: var(--mirai-ui-button-color-active);
|
|
127
|
+
border-radius: calc(var(--mirai-ui-space-XS) / 2);
|
|
128
|
+
height: var(--mirai-ui-space-XS);
|
|
129
|
+
width: var(--mirai-ui-space-XS);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.squared .spinner,
|
|
133
|
+
.squared .spinner::before,
|
|
134
|
+
.squared .spinner::after {
|
|
135
|
+
height: calc(var(--mirai-ui-space-XS) / 1.5);
|
|
136
|
+
width: calc(var(--mirai-ui-space-XS) / 1.5);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.secondary .spinner,
|
|
140
|
+
.secondary .spinner::before,
|
|
141
|
+
.secondary .spinner::after {
|
|
142
|
+
animation-name: mirai-button-secondary-busy;
|
|
143
|
+
background-color: var(--mirai-ui-button-secondary-color-active);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.spinner::before,
|
|
147
|
+
.spinner::after {
|
|
148
|
+
content: '';
|
|
149
|
+
display: inline-block;
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.spinner::before {
|
|
155
|
+
animation-delay: 0s;
|
|
156
|
+
left: calc(var(--mirai-ui-space-S) * -1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.squared .spinner::before {
|
|
160
|
+
left: calc(var(--mirai-ui-space-S) * -0.75);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.spinner {
|
|
164
|
+
animation-delay: calc(var(--mirai-ui-motion-expand) * 2);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.spinner::after {
|
|
168
|
+
animation-delay: calc(var(--mirai-ui-motion-expand) * 3);
|
|
169
|
+
left: var(--mirai-ui-space-S);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.squared .spinner::after {
|
|
173
|
+
left: calc(var(--mirai-ui-space-S) * 0.75);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@keyframes mirai-button-busy {
|
|
177
|
+
0% {
|
|
178
|
+
background-color: var(--mirai-ui-base);
|
|
179
|
+
}
|
|
180
|
+
50%,
|
|
181
|
+
100% {
|
|
182
|
+
background-color: var(--mirai-ui-button-color-active);
|
|
183
|
+
background-color: var();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@keyframes mirai-button-secondary-busy {
|
|
188
|
+
0% {
|
|
189
|
+
background-color: var(--mirai-ui-button-background);
|
|
190
|
+
}
|
|
191
|
+
50%,
|
|
192
|
+
100% {
|
|
193
|
+
background-color: var(--mirai-ui-button-secondary-color-active);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
96
197
|
@media only screen and (min-width: 600px) {
|
|
97
198
|
.button:not(:disabled).secondary:hover:not(:active) {
|
|
98
199
|
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-color-hover);
|
|
@@ -5,15 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Story = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _ = require("../../");
|
|
10
10
|
var _Button = require("./Button");
|
|
11
11
|
var _Story$args;
|
|
12
|
-
var _excluded = ["icon"];
|
|
13
|
-
function
|
|
12
|
+
var _excluded = ["busy", "icon"];
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
19
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
26
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
27
|
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; }
|
|
19
28
|
var _default = {
|
|
@@ -21,11 +30,24 @@ var _default = {
|
|
|
21
30
|
};
|
|
22
31
|
exports.default = _default;
|
|
23
32
|
var Story = function Story(_ref) {
|
|
24
|
-
var
|
|
33
|
+
var busyProp = _ref.busy,
|
|
34
|
+
icon = _ref.icon,
|
|
25
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
|
|
36
|
+
var _useState = (0, _react.useState)(busyProp),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
busy = _useState2[0],
|
|
39
|
+
setBusy = _useState2[1];
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
41
|
+
busy: busy
|
|
42
|
+
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
|
+
busy: busy
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement(_.Icon, {
|
|
27
45
|
value: _.ICON[icon]
|
|
28
|
-
}))
|
|
46
|
+
})), /*#__PURE__*/_react.default.createElement("view", {
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
return setBusy(!busy);
|
|
49
|
+
}
|
|
50
|
+
}, "Switch busy"));
|
|
29
51
|
};
|
|
30
52
|
exports.Story = Story;
|
|
31
53
|
Story.storyName = 'Button';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","names":["title","Story","icon","props","ICON","storyName","args","
|
|
1
|
+
{"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","icon","props","useState","setBusy","ICON","storyName","args","children","disabled","undefined","large","rounded","secondary","small","squared","tag","wide","marginBottom","argTypes","options","Object","keys","control","type","defaultValue","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Button/Button.stories.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\n\nimport { Icon, ICON } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, icon, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n return (\n <>\n <Button {...{ ...props, busy }} />\n <Button {...{ ...props, busy }}>\n <Icon value={ICON[icon]} />\n </Button>\n\n <view onClick={() => setBusy(!busy)}>Switch busy</view>\n </>\n );\n};\n\nStory.storyName = 'Button';\n\nStory.args = {\n busy: false,\n children: 'children',\n disabled: false,\n icon: undefined,\n large: false,\n rounded: false,\n secondary: false,\n small: false,\n squared: false,\n tag: 'button',\n wide: false,\n // inherited properties\n ['data-testid']: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: Object.keys(ICON),\n control: { type: 'select' },\n defaultValue: Object.keys(ICON)[0],\n },\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEnB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,OAA2C;EAAA,IAA/BC,QAAQ,QAAdC,IAAI;IAAYC,IAAI,QAAJA,IAAI;IAAKC,KAAK;EACpD,gBAAwB,IAAAC,eAAQ,EAACJ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button> inherit:className 1`] = `
|
|
|
13
13
|
exports[`component:<Button> prop:busy 1`] = `
|
|
14
14
|
<DocumentFragment>
|
|
15
15
|
<button
|
|
16
|
-
class="pressable disabled button busy"
|
|
16
|
+
class="pressable disabled button busy disabled"
|
|
17
17
|
disabled=""
|
|
18
18
|
>
|
|
19
19
|
<div
|
|
20
|
-
class="view
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
class="view busyContainer active"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="view spinner"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<div
|
|
27
|
+
class="view row children"
|
|
28
|
+
>
|
|
29
|
+
children
|
|
30
|
+
</div>
|
|
23
31
|
</button>
|
|
24
32
|
</DocumentFragment>
|
|
25
33
|
`;
|
|
@@ -27,7 +35,7 @@ exports[`component:<Button> prop:busy 1`] = `
|
|
|
27
35
|
exports[`component:<Button> prop:disabled 1`] = `
|
|
28
36
|
<DocumentFragment>
|
|
29
37
|
<button
|
|
30
|
-
class="pressable disabled button"
|
|
38
|
+
class="pressable disabled button disabled"
|
|
31
39
|
disabled=""
|
|
32
40
|
>
|
|
33
41
|
children
|
|
@@ -52,9 +60,17 @@ exports[`component:<Button> prop:secondary && prop:busy 1`] = `
|
|
|
52
60
|
disabled=""
|
|
53
61
|
>
|
|
54
62
|
<div
|
|
55
|
-
class="view
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
class="view busyContainer active"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="view spinner"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
<div
|
|
70
|
+
class="view row children"
|
|
71
|
+
>
|
|
72
|
+
children
|
|
73
|
+
</div>
|
|
58
74
|
</button>
|
|
59
75
|
</DocumentFragment>
|
|
60
76
|
`;
|
|
@@ -9,7 +9,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
|
|
|
9
9
|
class="view texts"
|
|
10
10
|
/>
|
|
11
11
|
<button
|
|
12
|
-
class="pressable disabled button rounded squared
|
|
12
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
80
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
111
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
155
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
229
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
327
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
365
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
567
|
+
class="pressable disabled button rounded squared 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 disabled button rounded squared
|
|
636
|
+
class="pressable disabled button rounded squared disabled"
|
|
637
637
|
disabled=""
|
|
638
638
|
>
|
|
639
639
|
<span
|
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
--mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
|
|
173
173
|
--mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
|
|
174
174
|
--mirai-ui-button-secondary-background: var(--mirai-ui-base);
|
|
175
|
+
--mirai-ui-button-secondary-color-active: var(--mirai-ui-accent-border);
|
|
175
176
|
--mirai-ui-button-padding-y: var(--mirai-ui-space-S);
|
|
176
177
|
--mirai-ui-button-padding-x: var(--mirai-ui-space-L);
|
|
177
178
|
--mirai-ui-button-radius: var(--mirai-ui-border-radius);
|
|
178
|
-
--mirai-ui-button-secondary-background: var(--mirai-ui-base);
|
|
179
179
|
--mirai-ui-button-squared: calc(var(--mirai-ui-space-M) * 2);
|
|
180
180
|
|
|
181
181
|
/* Calendar */
|