@mirai/ui 1.1.15 → 2.0.1
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 +5 -4
- package/build/components/Action/Action.js +7 -10
- package/build/components/Action/Action.js.map +1 -1
- package/build/components/Action/Action.module.css +3 -11
- package/build/components/Action/Action.stories.js +3 -3
- package/build/components/Action/Action.stories.js.map +1 -1
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +46 -54
- package/build/components/Button/Button.js +4 -6
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/Button.module.css +29 -12
- package/build/components/Button/Button.stories.js +17 -9
- package/build/components/Button/Button.stories.js.map +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +38 -27
- package/build/components/Calendar/Calendar.js +1 -1
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +5 -5
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +15576 -15544
- package/build/components/Form/Form.js +2 -5
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +14 -12
- package/build/components/InputDate/InputDate.js +1 -0
- package/build/components/InputDate/InputDate.js.map +1 -1
- package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +67 -42
- package/build/components/InputNumber/InputNumber.js +19 -4
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +222 -138
- package/build/components/InputOption/InputOption.js +6 -2
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +114 -75
- package/build/components/InputPhone/InputPhone.js +8 -1
- package/build/components/InputPhone/InputPhone.js.map +1 -1
- package/build/components/InputPhone/InputPhone.module.css +1 -1
- package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +448 -354
- package/build/components/InputSelect/InputSelect.js +10 -1
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +118 -112
- package/build/components/InputText/InputText.js +6 -2
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +160 -130
- package/build/components/InputText/partials/InputText.Label.js +1 -0
- package/build/components/InputText/partials/InputText.Label.js.map +1 -1
- package/build/components/Menu/Menu.js +1 -0
- package/build/components/Menu/Menu.js.map +1 -1
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +76 -55
- package/build/components/Modal/Modal.js +20 -6
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +106 -72
- package/build/components/Notification/Notification.js +1 -0
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +328 -288
- package/build/components/Progress/Progress.js +1 -0
- package/build/components/Progress/Progress.js.map +1 -1
- package/build/components/Progress/__tests__/__snapshots__/Progress.test.jsx.snap +31 -18
- package/build/components/Slider/Slider.js +3 -2
- package/build/components/Slider/Slider.js.map +1 -1
- package/build/components/Slider/Slider.module.css +4 -4
- package/build/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +475 -339
- package/build/components/Table/Table.js +2 -4
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/Table/__tests__/__snapshots__/Table.ColumnFilter.test.js.snap +222 -192
- package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +878 -432
- package/build/components/Tooltip/Tooltip.js +3 -4
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +38 -28
- package/build/primitives/Checkbox/Checkbox.js +1 -0
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +35 -20
- package/build/primitives/Icon/Icon.js +1 -1
- package/build/primitives/Icon/Icon.js.map +1 -1
- package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +108 -82
- package/build/primitives/Input/Input.js +3 -5
- package/build/primitives/Input/Input.js.map +1 -1
- package/build/primitives/Input/__tests__/__snapshots__/Input.test.js.snap +2 -0
- package/build/primitives/Layer/Layer.js +2 -1
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +60 -42
- package/build/primitives/Pressable/Pressable.constants.js +1 -1
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +7 -6
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +16 -12
- package/build/primitives/Primitive/Primitive.constants.js +1 -1
- package/build/primitives/Primitive/Primitive.constants.js.map +1 -1
- package/build/primitives/Primitive/Primitive.js +2 -2
- package/build/primitives/Primitive/Primitive.js.map +1 -1
- package/build/primitives/Primitive/__tests__/__snapshots__/Primitive.test.js.snap +12 -12
- package/build/primitives/Primitive/helpers/getTag.js +35 -0
- package/build/primitives/Primitive/helpers/getTag.js.map +1 -0
- package/build/primitives/Primitive/helpers/index.js +11 -0
- package/build/primitives/Primitive/helpers/index.js.map +1 -1
- package/build/primitives/Radio/Radio.js +1 -1
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +39 -21
- package/build/primitives/ScrollView/ScrollView.js +2 -5
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.stories.js +6 -5
- package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
- package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +24 -24
- package/build/primitives/Select/Select.js +7 -4
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +35 -0
- package/build/primitives/Switch/Switch.js +1 -1
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +60 -40
- package/build/primitives/Text/Text.js +4 -3
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +68 -68
- package/build/primitives/Text/helpers/parseMarkdown.js +3 -1
- package/build/primitives/Text/helpers/parseMarkdown.js.map +1 -1
- package/build/primitives/View/View.js +2 -5
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +15 -15
- package/build/theme/default.theme.css +10 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -486,16 +486,17 @@ const MyComponent = (props) => {
|
|
|
486
486
|
--mirai-ui-button-disabled-background: var(--mirai-ui-content-border);
|
|
487
487
|
--mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
|
|
488
488
|
--mirai-ui-button-focus-color: var(--mirai-ui-focus-color);
|
|
489
|
-
--mirai-ui-button-
|
|
490
|
-
--mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
|
|
489
|
+
--mirai-ui-button-font-weight: var(--mirai-ui-font-medium-weight);
|
|
491
490
|
--mirai-ui-button-padding-x: var(--mirai-ui-space-L);
|
|
492
|
-
--mirai-ui-button-
|
|
491
|
+
--mirai-ui-button-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-XXS));
|
|
492
|
+
--mirai-ui-button-large-height: var(--mirai-ui-space-XL);
|
|
493
|
+
--mirai-ui-button-small-height: calc(var(--mirai-ui-space-XL) - var(--mirai-ui-space-M));
|
|
493
494
|
--mirai-ui-button-radius: var(--mirai-ui-border-radius);
|
|
494
495
|
--mirai-ui-button-secondary-background: var(--mirai-ui-base);
|
|
496
|
+
--mirai-ui-button-secondary-background-active: var(--mirai-ui-accent-background);
|
|
495
497
|
--mirai-ui-button-secondary-color: var(--mirai-ui-button-background);
|
|
496
498
|
--mirai-ui-button-secondary-focus-color: var(--mirai-ui-button-focus-color);
|
|
497
499
|
--mirai-ui-button-secondary-focus-color-shadow: var(--mirai-ui-focus-color-shadow);
|
|
498
|
-
--mirai-ui-button-squared: calc(var(--mirai-ui-space-M) * 2);
|
|
499
500
|
--mirai-ui-button-transparent-background-active: var(--mirai-ui-accent-background);
|
|
500
501
|
--mirai-ui-button-transparent-color: var(--mirai-ui-content);
|
|
501
502
|
```
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _helpers = require("../../helpers");
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
12
|
var _ActionModule = _interopRequireDefault(require("./Action.module.css"));
|
|
13
|
-
var _excluded = ["bold", "children", "disabled", "href", "
|
|
13
|
+
var _excluded = ["bold", "children", "disabled", "href", "paragraph", "small", "target", "tiny", "underline", "wide", "onPress"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
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
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; }
|
|
@@ -24,12 +24,10 @@ var Action = function Action(_ref) {
|
|
|
24
24
|
children = _ref.children,
|
|
25
25
|
disabled = _ref.disabled,
|
|
26
26
|
href = _ref.href,
|
|
27
|
-
|
|
28
|
-
large = _ref.large,
|
|
27
|
+
paragraph = _ref.paragraph,
|
|
29
28
|
small = _ref.small,
|
|
30
|
-
_ref$tag = _ref.tag,
|
|
31
|
-
tag = _ref$tag === void 0 ? 'button' : _ref$tag,
|
|
32
29
|
target = _ref.target,
|
|
30
|
+
tiny = _ref.tiny,
|
|
33
31
|
underline = _ref.underline,
|
|
34
32
|
wide = _ref.wide,
|
|
35
33
|
_onPress = _ref.onPress,
|
|
@@ -38,12 +36,12 @@ var Action = function Action(_ref) {
|
|
|
38
36
|
disabled: disabled,
|
|
39
37
|
href: href,
|
|
40
38
|
role: others.role || 'action',
|
|
41
|
-
tag: href ? 'a' : tag,
|
|
39
|
+
tag: href ? 'a' : others.tag || 'action',
|
|
42
40
|
onPress: function onPress(event) {
|
|
43
41
|
_onPress && _onPress(event);
|
|
44
42
|
if (href && target) window.open(href, target);else if (href) window.location = href;
|
|
45
43
|
},
|
|
46
|
-
className: (0, _helpers.styles)(_ActionModule.default.action, bold && _ActionModule.default.bold, disabled && _ActionModule.default.disabled,
|
|
44
|
+
className: (0, _helpers.styles)(_ActionModule.default.action, bold && _ActionModule.default.bold, disabled && _ActionModule.default.disabled, paragraph ? _ActionModule.default.paragraph : small ? _ActionModule.default.small : tiny ? _ActionModule.default.tiny : undefined, underline && _ActionModule.default.underline, wide && _ActionModule.default.wide, others.className)
|
|
47
45
|
}), children);
|
|
48
46
|
};
|
|
49
47
|
exports.Action = Action;
|
|
@@ -53,11 +51,10 @@ Action.propTypes = {
|
|
|
53
51
|
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
54
52
|
disabled: _propTypes.default.bool,
|
|
55
53
|
href: _propTypes.default.string,
|
|
56
|
-
|
|
57
|
-
large: _propTypes.default.bool,
|
|
54
|
+
paragraph: _propTypes.default.bool,
|
|
58
55
|
small: _propTypes.default.bool,
|
|
59
|
-
tag: _propTypes.default.string,
|
|
60
56
|
target: _propTypes.default.string,
|
|
57
|
+
tiny: _propTypes.default.bool,
|
|
61
58
|
underline: _propTypes.default.bool,
|
|
62
59
|
wide: _propTypes.default.bool,
|
|
63
60
|
onEnter: _propTypes.default.func,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","names":["Action","bold","children","disabled","href","
|
|
1
|
+
{"version":3,"file":"Action.js","names":["Action","bold","children","disabled","href","paragraph","small","target","tiny","underline","wide","onPress","others","React","createElement","Pressable","role","tag","event","window","open","location","className","styles","style","action","undefined","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Action/Action.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable } from '../../primitives';\nimport style from './Action.module.css';\n\nconst Action = ({\n bold,\n children,\n disabled,\n href,\n paragraph,\n small,\n target,\n tiny,\n underline,\n wide,\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled,\n href,\n role: others.role || 'action',\n tag: href ? 'a' : others.tag || 'action',\n onPress: (event) => {\n onPress && onPress(event);\n if (href && target) window.open(href, target);\n else if (href) window.location = href;\n },\n className: styles(\n style.action,\n bold && style.bold,\n disabled && style.disabled,\n paragraph ? style.paragraph : small ? style.small : tiny ? style.tiny : undefined,\n underline && style.underline,\n wide && style.wide,\n others.className,\n ),\n },\n children,\n );\n\nAction.displayName = 'Component:Action';\n\nAction.propTypes = {\n bold: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n href: PropTypes.string,\n paragraph: PropTypes.bool,\n small: PropTypes.bool,\n target: PropTypes.string,\n tiny: PropTypes.bool,\n underline: PropTypes.bool,\n wide: PropTypes.bool,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Action };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAExC,IAAMA,MAAM,G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AC;AAEJF,MAAM,CAAC2B,WAAW,GAAG,kBAAkB;AAEvC3B,MAAM,CAAC4B,SAAS,GAAG;EACjB3B,IAAI,EAAE4B,kBAAS,CAACC,IAAI;EACpB5B,QAAQ,EAAE2B,kBAAS,CAACE,SAAS,CAAC,CAACF,kBAAS,CAACG,MAAM,EAAEH,kBAAS,CAACI,IAAI,CAAC,CAAC;EACjE9B,QAAQ,EAAE0B,kBAAS,CAACC,IAAI;EACxB1B,IAAI,EAAEyB,kBAAS,CAACG,MAAM;EACtB3B,SAAS,EAAEwB,kBAAS,CAACC,IAAI;EACzBxB,KAAK,EAAEuB,kBAAS,CAACC,IAAI;EACrBvB,MAAM,EAAEsB,kBAAS,CAACG,MAAM;EACxBxB,IAAI,EAAEqB,kBAAS,CAACC,IAAI;EACpBrB,SAAS,EAAEoB,kBAAS,CAACC,IAAI;EACzBpB,IAAI,EAAEmB,kBAAS,CAACC,IAAI;EACpBI,OAAO,EAAEL,kBAAS,CAACM,IAAI;EACvBC,OAAO,EAAEP,kBAAS,CAACM,IAAI;EACvBxB,OAAO,EAAEkB,kBAAS,CAACM;AACrB,CAAC"}
|
|
@@ -25,24 +25,16 @@
|
|
|
25
25
|
color: var(--mirai-ui-focus-color);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
29
|
-
padding: var(--mirai-ui-button-padding-y) 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.large {
|
|
28
|
+
.paragraph {
|
|
33
29
|
font-size: var(--mirai-ui-font-size-paragraph);
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
.large:not(.inline) {
|
|
37
|
-
padding: var(--mirai-ui-button-padding-y) 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
32
|
.small {
|
|
41
33
|
font-size: var(--mirai-ui-font-size-small);
|
|
42
34
|
}
|
|
43
35
|
|
|
44
|
-
.
|
|
45
|
-
|
|
36
|
+
.tiny {
|
|
37
|
+
font-size: var(--mirai-ui-font-size-tiny);
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
.underline,
|
|
@@ -24,11 +24,11 @@ Story.args = {
|
|
|
24
24
|
disabled: false,
|
|
25
25
|
href: '',
|
|
26
26
|
icon: '',
|
|
27
|
-
|
|
28
|
-
large: false,
|
|
27
|
+
paragraph: false,
|
|
29
28
|
small: false,
|
|
30
|
-
tag: '
|
|
29
|
+
tag: 'action',
|
|
31
30
|
target: '',
|
|
31
|
+
tiny: false,
|
|
32
32
|
underline: false,
|
|
33
33
|
wide: false,
|
|
34
34
|
// inherited properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.stories.js","names":["title","Story","props","storyName","args","children","ICON","INFO","disabled","href","icon","
|
|
1
|
+
{"version":3,"file":"Action.stories.js","names":["title","Story","props","storyName","args","children","ICON","INFO","disabled","href","icon","paragraph","small","tag","target","tiny","underline","wide","testId","style","argTypes","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Action/Action.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { Action } from './Action';\nimport { Icon, ICON } from '../../primitives/Icon';\n\nexport default { title: 'Components' };\n\nexport const Story = (props) => <Action {...props} />;\n\nStory.storyName = 'Action';\n\nStory.args = {\n children: (\n <>\n <Icon value={ICON.INFO} />\n children\n </>\n ),\n disabled: false,\n href: '',\n icon: '',\n paragraph: false,\n small: false,\n tag: 'action',\n target: '',\n tiny: false,\n underline: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAmD;AAAA,eAEpC;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBAAK,6BAAC,cAAM,EAAKA,KAAK,CAAI;AAAA;AAAC;AAEtDD,KAAK,CAACE,SAAS,GAAG,QAAQ;AAE1BF,KAAK,CAACG,IAAI,GAAG;EACXC,QAAQ,eACN,yEACE,6BAAC,UAAI;IAAC,KAAK,EAAEC,UAAI,CAACC;EAAK,EAAG,aAG7B;EACDC,QAAQ,EAAE,KAAK;EACfC,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,QAAQ;EACbC,MAAM,EAAE,EAAE;EACVC,IAAI,EAAE,KAAK;EACXC,SAAS,EAAE,KAAK;EAChBC,IAAI,EAAE,KAAK;EACX;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE,CAAC;AACV,CAAC;AAEDlB,KAAK,CAACmB,QAAQ,GAAG;EACfC,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
|
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`component:<Action> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<ui_action
|
|
6
6
|
class="pressable action mirai"
|
|
7
|
+
tabindex="0"
|
|
7
8
|
>
|
|
8
9
|
children
|
|
9
|
-
</
|
|
10
|
+
</ui_action>
|
|
10
11
|
</DocumentFragment>
|
|
11
12
|
`;
|
|
12
13
|
|
|
13
14
|
exports[`component:<Action> prop:bold 1`] = `
|
|
14
15
|
<DocumentFragment>
|
|
15
|
-
<
|
|
16
|
+
<ui_action
|
|
16
17
|
class="pressable action bold"
|
|
18
|
+
tabindex="0"
|
|
17
19
|
>
|
|
18
20
|
children
|
|
19
|
-
</
|
|
21
|
+
</ui_action>
|
|
20
22
|
</DocumentFragment>
|
|
21
23
|
`;
|
|
22
24
|
|
|
23
25
|
exports[`component:<Action> prop:disabled 1`] = `
|
|
24
26
|
<DocumentFragment>
|
|
25
|
-
<
|
|
27
|
+
<ui_action
|
|
26
28
|
class="pressable disabled action disabled"
|
|
27
29
|
disabled=""
|
|
28
30
|
>
|
|
29
31
|
children
|
|
30
|
-
</
|
|
32
|
+
</ui_action>
|
|
31
33
|
</DocumentFragment>
|
|
32
34
|
`;
|
|
33
35
|
|
|
@@ -36,6 +38,7 @@ exports[`component:<Action> prop:href + prop:target 1`] = `
|
|
|
36
38
|
<a
|
|
37
39
|
class="pressable action"
|
|
38
40
|
href="soyjavi.com"
|
|
41
|
+
tabindex="0"
|
|
39
42
|
>
|
|
40
43
|
children
|
|
41
44
|
</a>
|
|
@@ -47,109 +50,98 @@ exports[`component:<Action> prop:href 1`] = `
|
|
|
47
50
|
<a
|
|
48
51
|
class="pressable action"
|
|
49
52
|
href="soyjavi.com"
|
|
53
|
+
tabindex="0"
|
|
50
54
|
>
|
|
51
55
|
children
|
|
52
56
|
</a>
|
|
53
57
|
</DocumentFragment>
|
|
54
58
|
`;
|
|
55
59
|
|
|
56
|
-
exports[`component:<Action> prop:
|
|
60
|
+
exports[`component:<Action> prop:paragraph 1`] = `
|
|
57
61
|
<DocumentFragment>
|
|
58
|
-
<
|
|
59
|
-
class="pressable action
|
|
62
|
+
<ui_action
|
|
63
|
+
class="pressable action paragraph"
|
|
64
|
+
tabindex="0"
|
|
60
65
|
>
|
|
61
66
|
children
|
|
62
|
-
</
|
|
63
|
-
</DocumentFragment>
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
exports[`component:<Action> prop:inline & prop:small 1`] = `
|
|
67
|
-
<DocumentFragment>
|
|
68
|
-
<button
|
|
69
|
-
class="pressable action inline small"
|
|
70
|
-
>
|
|
71
|
-
children
|
|
72
|
-
</button>
|
|
73
|
-
</DocumentFragment>
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
exports[`component:<Action> prop:inline default 1`] = `
|
|
77
|
-
<DocumentFragment>
|
|
78
|
-
<button
|
|
79
|
-
class="pressable action inline"
|
|
80
|
-
>
|
|
81
|
-
children
|
|
82
|
-
</button>
|
|
83
|
-
</DocumentFragment>
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
exports[`component:<Action> prop:large 1`] = `
|
|
87
|
-
<DocumentFragment>
|
|
88
|
-
<button
|
|
89
|
-
class="pressable action large"
|
|
90
|
-
>
|
|
91
|
-
children
|
|
92
|
-
</button>
|
|
67
|
+
</ui_action>
|
|
93
68
|
</DocumentFragment>
|
|
94
69
|
`;
|
|
95
70
|
|
|
96
71
|
exports[`component:<Action> prop:small 1`] = `
|
|
97
72
|
<DocumentFragment>
|
|
98
|
-
<
|
|
73
|
+
<ui_action
|
|
99
74
|
class="pressable action small"
|
|
75
|
+
tabindex="0"
|
|
100
76
|
>
|
|
101
77
|
children
|
|
102
|
-
</
|
|
78
|
+
</ui_action>
|
|
103
79
|
</DocumentFragment>
|
|
104
80
|
`;
|
|
105
81
|
|
|
106
|
-
exports[`component:<Action> prop:
|
|
82
|
+
exports[`component:<Action> prop:tiny 1`] = `
|
|
107
83
|
<DocumentFragment>
|
|
108
|
-
<
|
|
109
|
-
class="pressable action"
|
|
84
|
+
<ui_action
|
|
85
|
+
class="pressable action tiny"
|
|
86
|
+
tabindex="0"
|
|
110
87
|
>
|
|
111
88
|
children
|
|
112
|
-
</
|
|
89
|
+
</ui_action>
|
|
113
90
|
</DocumentFragment>
|
|
114
91
|
`;
|
|
115
92
|
|
|
116
93
|
exports[`component:<Action> prop:underline 1`] = `
|
|
117
94
|
<DocumentFragment>
|
|
118
|
-
<
|
|
95
|
+
<ui_action
|
|
119
96
|
class="pressable action underline"
|
|
97
|
+
tabindex="0"
|
|
120
98
|
>
|
|
121
99
|
children
|
|
122
|
-
</
|
|
100
|
+
</ui_action>
|
|
123
101
|
</DocumentFragment>
|
|
124
102
|
`;
|
|
125
103
|
|
|
126
104
|
exports[`component:<Action> prop:wide 1`] = `
|
|
127
105
|
<DocumentFragment>
|
|
128
|
-
<
|
|
106
|
+
<ui_action
|
|
129
107
|
class="pressable action wide"
|
|
108
|
+
tabindex="0"
|
|
130
109
|
>
|
|
131
110
|
children
|
|
132
|
-
</
|
|
111
|
+
</ui_action>
|
|
133
112
|
</DocumentFragment>
|
|
134
113
|
`;
|
|
135
114
|
|
|
136
115
|
exports[`component:<Action> renders 1`] = `
|
|
137
116
|
<DocumentFragment>
|
|
138
|
-
<
|
|
117
|
+
<ui_action
|
|
139
118
|
class="pressable action"
|
|
119
|
+
tabindex="0"
|
|
140
120
|
>
|
|
141
121
|
children
|
|
142
|
-
</
|
|
122
|
+
</ui_action>
|
|
123
|
+
</DocumentFragment>
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
exports[`component:<Action> tag 1`] = `
|
|
127
|
+
<DocumentFragment>
|
|
128
|
+
<a
|
|
129
|
+
class="pressable action"
|
|
130
|
+
tabindex="0"
|
|
131
|
+
>
|
|
132
|
+
children
|
|
133
|
+
</a>
|
|
143
134
|
</DocumentFragment>
|
|
144
135
|
`;
|
|
145
136
|
|
|
146
137
|
exports[`component:<Action> testId 1`] = `
|
|
147
138
|
<DocumentFragment>
|
|
148
|
-
<
|
|
139
|
+
<ui_action
|
|
149
140
|
class="pressable action"
|
|
150
141
|
data-testid="mirai"
|
|
142
|
+
tabindex="0"
|
|
151
143
|
>
|
|
152
144
|
children
|
|
153
|
-
</
|
|
145
|
+
</ui_action>
|
|
154
146
|
</DocumentFragment>
|
|
155
147
|
`;
|
|
@@ -11,7 +11,7 @@ var _helpers = require("../../helpers");
|
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
12
|
var _Tooltip = require("../Tooltip");
|
|
13
13
|
var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
|
|
14
|
-
var _excluded = ["busy", "children", "disabled", "large", "rounded", "secondary", "small", "squared", "
|
|
14
|
+
var _excluded = ["busy", "children", "disabled", "large", "rounded", "secondary", "small", "squared", "transparent", "tooltip", "wide", "onPress"],
|
|
15
15
|
_excluded2 = ["fixed", "left", "right", "top"];
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
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; }
|
|
@@ -31,8 +31,6 @@ var Button = function Button(_ref) {
|
|
|
31
31
|
small = _ref.small,
|
|
32
32
|
_ref$squared = _ref.squared,
|
|
33
33
|
squared = _ref$squared === void 0 ? false : _ref$squared,
|
|
34
|
-
_ref$tag = _ref.tag,
|
|
35
|
-
tag = _ref$tag === void 0 ? 'button' : _ref$tag,
|
|
36
34
|
_ref$transparent = _ref.transparent,
|
|
37
35
|
transparent = _ref$transparent === void 0 ? false : _ref$transparent,
|
|
38
36
|
tooltip = _ref.tooltip,
|
|
@@ -53,9 +51,10 @@ var Button = function Button(_ref) {
|
|
|
53
51
|
} : undefined, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _objectSpread(_objectSpread({}, others), {}, {
|
|
54
52
|
disabled: disabled || busy,
|
|
55
53
|
role: others.role || 'button',
|
|
56
|
-
tag: tag,
|
|
54
|
+
tag: others.tag || 'button',
|
|
57
55
|
onPress: onPress,
|
|
58
|
-
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 && !transparent && !disabled && _ButtonModule.default.secondary, transparent && _ButtonModule.default.transparent, (disabled || busy) && _ButtonModule.default.disabled, wide && _ButtonModule.default.wide, others.className)
|
|
56
|
+
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 && !transparent && !disabled && _ButtonModule.default.secondary, transparent && _ButtonModule.default.transparent, (disabled || busy) && _ButtonModule.default.disabled, wide && _ButtonModule.default.wide, others.className),
|
|
57
|
+
'aria-label': inherit['aria-label'] || (typeof tooltip === 'string' ? tooltip : undefined)
|
|
59
58
|
}), busy === undefined ? children : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
60
59
|
className: (0, _helpers.styles)(_ButtonModule.default.busyContainer, busy && _ButtonModule.default.active)
|
|
61
60
|
}, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
@@ -76,7 +75,6 @@ Button.propTypes = {
|
|
|
76
75
|
secondary: _propTypes.default.bool,
|
|
77
76
|
small: _propTypes.default.bool,
|
|
78
77
|
squared: _propTypes.default.bool,
|
|
79
|
-
tag: _propTypes.default.string,
|
|
80
78
|
tooltip: _propTypes.default.string,
|
|
81
79
|
transparent: _propTypes.default.bool,
|
|
82
80
|
wide: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","rounded","secondary","small","squared","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","rounded","secondary","small","squared","transparent","tooltip","wide","onPress","inherit","fixed","left","right","top","others","React","createElement","Tooltip","Fragment","text","undefined","Pressable","role","tag","className","styles","style","button","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 { Tooltip } from '../Tooltip';\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 transparent = false,\n tooltip,\n wide,\n onPress,\n ...inherit\n}) => {\n const { fixed, left, right, top, ...others } = inherit;\n\n return React.createElement(\n tooltip ? Tooltip : React.Fragment,\n tooltip ? { fixed, left, right, text: tooltip, top } : undefined,\n React.createElement(\n Pressable,\n {\n ...others,\n disabled: disabled || busy,\n role: others.role || 'button',\n tag: others.tag || 'button',\n onPress,\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 && !transparent && !disabled && style.secondary,\n transparent && style.transparent,\n (disabled || busy) && style.disabled,\n wide && style.wide,\n others.className,\n ),\n 'aria-label': inherit['aria-label'] || (typeof tooltip === 'string' ? tooltip : undefined),\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 );\n};\n\nButton.displayName = 'Component:Button';\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 tooltip: PropTypes.string,\n transparent: PropTypes.bool,\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;AACA;AAAwC;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAExC,IAAMA,MAAM,GAAG,SAATA,MAAM,OAcN;EAAA,IAbJC,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,w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I;EACpBI,OAAO,EAAEL,kBAAS,CAACM,IAAI;EACvBC,OAAO,EAAEP,kBAAS,CAACM,IAAI;EACvB/B,OAAO,EAAEyB,kBAAS,CAACM;AACrB,CAAC"}
|
|
@@ -8,9 +8,11 @@ button.button {
|
|
|
8
8
|
font-size: var(--mirai-ui-font-size-action);
|
|
9
9
|
font-weight: var(--mirai-ui-button-font-weight);
|
|
10
10
|
justify-content: center;
|
|
11
|
+
max-height: var(--mirai-ui-button-height);
|
|
12
|
+
min-height: var(--mirai-ui-button-height);
|
|
11
13
|
outline: none;
|
|
12
14
|
overflow: hidden;
|
|
13
|
-
padding:
|
|
15
|
+
padding: 0 var(--mirai-ui-button-padding-x);
|
|
14
16
|
position: relative;
|
|
15
17
|
transition: background-color var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
|
|
16
18
|
box-shadow var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
|
|
@@ -18,6 +20,11 @@ button.button {
|
|
|
18
20
|
width: fit-content;
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
button.button,
|
|
24
|
+
button.button .children {
|
|
25
|
+
gap: var(--mirai-ui-space-XXS);
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
/* -- variants */
|
|
22
29
|
button.button:disabled:not(.busy) {
|
|
23
30
|
background-color: var(--mirai-ui-button-disabled-background);
|
|
@@ -32,8 +39,8 @@ button.secondary {
|
|
|
32
39
|
|
|
33
40
|
button.button:not(:disabled).secondary:active,
|
|
34
41
|
button.button:not(:disabled).secondary:hover {
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
background-color: var(--mirai-ui-button-secondary-background-active);
|
|
43
|
+
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-secondary-focus-color);
|
|
37
44
|
color: var(--mirai-ui-button-secondary-focus-color);
|
|
38
45
|
}
|
|
39
46
|
|
|
@@ -50,31 +57,41 @@ button.transparent:not(:disabled):hover {
|
|
|
50
57
|
|
|
51
58
|
button.button:not(:disabled):not(.secondary):not(.transparent):active,
|
|
52
59
|
button.button:not(:disabled):not(.secondary):not(.transparent):hover {
|
|
53
|
-
box-shadow: 0 0 0 var(--mirai-ui-focus-width) var(--mirai-ui-button-focus-color-shadow);
|
|
54
60
|
background-color: var(--mirai-ui-button-focus-color);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
/* -- sizing */
|
|
58
|
-
button.large
|
|
64
|
+
button.large {
|
|
59
65
|
font-size: var(--mirai-ui-font-size-paragraph);
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
max-height: var(--mirai-ui-button-large-height);
|
|
67
|
+
min-height: var(--mirai-ui-button-large-height);
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
button.rounded {
|
|
65
71
|
border-radius: var(--mirai-ui-space-XXL);
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
button.small
|
|
74
|
+
button.small {
|
|
69
75
|
font-size: var(--mirai-ui-font-size-small);
|
|
70
|
-
|
|
76
|
+
max-height: var(--mirai-ui-button-small-height);
|
|
77
|
+
min-height: var(--mirai-ui-button-small-height);
|
|
78
|
+
padding: 0 calc(var(--mirai-ui-button-padding-x) / 2);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
button.squared {
|
|
74
|
-
height: var(--mirai-ui-button-squared);
|
|
75
82
|
padding: 0;
|
|
76
|
-
min-width: var(--mirai-ui-button-
|
|
77
|
-
width: var(--mirai-ui-button-
|
|
83
|
+
min-width: var(--mirai-ui-button-height);
|
|
84
|
+
max-width: var(--mirai-ui-button-height);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
button.large.squared {
|
|
88
|
+
min-width: var(--mirai-ui-button-large-height);
|
|
89
|
+
max-width: var(--mirai-ui-button-large-height);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button.small.squared {
|
|
93
|
+
min-width: var(--mirai-ui-button-small-height);
|
|
94
|
+
max-width: var(--mirai-ui-button-small-height);
|
|
78
95
|
}
|
|
79
96
|
|
|
80
97
|
button.wide {
|
|
@@ -8,9 +8,13 @@ exports.default = exports.Story = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _ = require("../../");
|
|
10
10
|
var _Button = require("./Button");
|
|
11
|
-
var _excluded = ["busy"
|
|
11
|
+
var _excluded = ["busy"];
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
18
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
19
|
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
20
|
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; }
|
|
@@ -31,27 +35,31 @@ var _default = {
|
|
|
31
35
|
exports.default = _default;
|
|
32
36
|
var Story = function Story(_ref) {
|
|
33
37
|
var busyProp = _ref.busy,
|
|
34
|
-
icon = _ref.icon,
|
|
35
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
39
|
var _useState = (0, _react.useState)(busyProp),
|
|
37
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
41
|
busy = _useState2[0],
|
|
39
42
|
setBusy = _useState2[1];
|
|
43
|
+
var renderChildren = function renderChildren(_ref2) {
|
|
44
|
+
var children = _ref2.children,
|
|
45
|
+
icon = _ref2.icon;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement(_.Icon, {
|
|
47
|
+
value: _.ICON[icon]
|
|
48
|
+
}), children);
|
|
49
|
+
};
|
|
40
50
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
41
51
|
busy: busy
|
|
42
|
-
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
52
|
+
}), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
53
|
busy: busy
|
|
44
54
|
}), {
|
|
45
55
|
secondary: true
|
|
46
|
-
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
56
|
+
}), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
47
57
|
busy: busy
|
|
48
58
|
}), {
|
|
49
59
|
transparent: true
|
|
50
|
-
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
60
|
+
}), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
51
61
|
busy: busy
|
|
52
|
-
}), /*#__PURE__*/_react.default.createElement(_.
|
|
53
|
-
value: _.ICON[icon]
|
|
54
|
-
})), /*#__PURE__*/_react.default.createElement(_.View, {
|
|
62
|
+
}), renderChildren(props)), /*#__PURE__*/_react.default.createElement(_.View, {
|
|
55
63
|
onClick: function onClick() {
|
|
56
64
|
return setBusy(!busy);
|
|
57
65
|
}
|
|
@@ -81,7 +89,7 @@ Story.args = {
|
|
|
81
89
|
};
|
|
82
90
|
Story.argTypes = {
|
|
83
91
|
icon: {
|
|
84
|
-
options: Object.keys(_.ICON),
|
|
92
|
+
options: [undefined].concat(_toConsumableArray(Object.keys(_.ICON))),
|
|
85
93
|
control: {
|
|
86
94
|
type: 'select'
|
|
87
95
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","
|
|
1
|
+
{"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","props","useState","setBusy","renderChildren","children","icon","ICON","storyName","args","disabled","undefined","large","rounded","secondary","small","squared","tag","tooltip","transparent","wide","testId","style","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, View } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n const renderChildren = ({ children, icon }) => (\n <>\n {icon && <Icon value={ICON[icon]} />}\n {children}\n </>\n );\n\n return (\n <>\n <Button {...{ ...props, busy }}>{renderChildren(props)}</Button>\n <Button {...{ ...props, busy }} secondary>\n {renderChildren(props)}\n </Button>\n <Button {...{ ...props, busy }} transparent>\n {renderChildren(props)}\n </Button>\n <Button {...{ ...props, busy }}>{renderChildren(props)}</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 tooltip: 'tooltip',\n transparent: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: [undefined, ...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;AAAA;AAAA;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