@mirai/ui 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/Button/Button.js +11 -5
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/Button.module.css +44 -8
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +28 -0
- package/build/components/Form/helpers/getChildrenValues.js +7 -2
- package/build/components/Form/helpers/getChildrenValues.js.map +1 -1
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +9 -9
- package/build/components/InputOption/InputOption.js +1 -2
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/index.js +13 -0
- package/build/components/InputOption/index.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.js +3 -5
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var _primitives = require("../../primitives");
|
|
|
15
15
|
|
|
16
16
|
var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["children", "disabled", "large", "outlined", "rounded", "small", "squared", "tag"];
|
|
18
|
+
var _excluded = ["busy", "children", "disabled", "large", "outlined", "rounded", "small", "squared", "tag", "onPress"];
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -30,7 +30,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
32
|
var Button = function Button(_ref) {
|
|
33
|
-
var
|
|
33
|
+
var busy = _ref.busy,
|
|
34
|
+
children = _ref.children,
|
|
34
35
|
disabled = _ref.disabled,
|
|
35
36
|
large = _ref.large,
|
|
36
37
|
outlined = _ref.outlined,
|
|
@@ -40,18 +41,23 @@ var Button = function Button(_ref) {
|
|
|
40
41
|
squared = _ref$squared === void 0 ? false : _ref$squared,
|
|
41
42
|
_ref$tag = _ref.tag,
|
|
42
43
|
tag = _ref$tag === void 0 ? 'button' : _ref$tag,
|
|
44
|
+
onPress = _ref.onPress,
|
|
43
45
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
44
46
|
|
|
45
47
|
return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _objectSpread(_objectSpread({}, others), {}, {
|
|
46
|
-
disabled: disabled,
|
|
48
|
+
disabled: disabled || busy,
|
|
47
49
|
tag: tag,
|
|
48
|
-
className: (0, _helpers.styles)(_ButtonModule.default.button, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, outlined &&
|
|
49
|
-
|
|
50
|
+
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, outlined && _ButtonModule.default.outlined, outlined && (disabled || busy) && _ButtonModule.default.disabled, others.className),
|
|
51
|
+
onPress: !disabled && !busy ? onPress : undefined
|
|
52
|
+
}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, busy !== undefined && /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
53
|
+
className: (0, _helpers.styles)(_ButtonModule.default.busyProgress, busy && _ButtonModule.default.active)
|
|
54
|
+
}), children));
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
exports.Button = Button;
|
|
53
58
|
Button.displayName = 'Component:Button';
|
|
54
59
|
Button.propTypes = {
|
|
60
|
+
busy: _propTypes.default.bool,
|
|
55
61
|
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
56
62
|
disabled: _propTypes.default.bool,
|
|
57
63
|
large: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["Button","children","disabled","large","outlined","rounded","small","squared","tag","others","React","createElement","Pressable","className","style","button","displayName","propTypes","PropTypes","oneOfType","string","node","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","outlined","rounded","small","squared","tag","onPress","others","React","createElement","Pressable","className","style","button","undefined","busyProgress","active","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 outlined,\n rounded,\n small,\n squared = false,\n tag = 'button',\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 && style.busy,\n large && style.large,\n small && style.small,\n rounded && style.rounded,\n squared && style.squared,\n outlined && style.outlined,\n outlined && (disabled || busy) && style.disabled,\n others.className,\n ),\n onPress: !disabled && !busy ? onPress : undefined,\n },\n <>\n {busy !== undefined && <View className={styles(style.busyProgress, busy && style.active)} />}\n {children}\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 outlined: PropTypes.bool,\n rounded: PropTypes.bool,\n small: PropTypes.bool,\n squared: PropTypes.bool,\n tag: PropTypes.string,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Button };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IACbC,IAD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AAEqB,mBAAUE,SAAV,CAAoB,CAACF,mBAAUG,MAAX,EAAmBH,mBAAUI,IAA7B,CAApB,CAFO;EAGjBxB,QAAQ,EAAEoB,mBAAUC,IAHH;EAIjBpB,KAAK,EAAEmB,mBAAUC,IAJA;EAKjBnB,QAAQ,EAAEkB,mBAAUC,IALH;EAMjBlB,OAAO,EAAEiB,mBAAUC,IANF;EAOjBjB,KAAK,EAAEgB,mBAAUC,IAPA;EAQjBhB,OAAO,EAAEe,mBAAUC,IARF;EASjBf,GAAG,EAAEc,mBAAUG,MATE;EAUjBE,OAAO,EAAEL,mBAAUM,IAVF;EAWjBC,OAAO,EAAEP,mBAAUM,IAXF;EAYjBnB,OAAO,EAAEa,mBAAUM;AAZF,CAAnB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--mirai-ui-button-background: var(--mirai-ui-accent);
|
|
3
|
+
--mirai-ui-button-busy-width: 0%;
|
|
4
|
+
--mirai-ui-button-busy-motion: calc(var(--mirai-ui-motion-expand) * 10);
|
|
3
5
|
--mirai-ui-button-color: var(--mirai-ui-base);
|
|
4
6
|
--mirai-ui-button-color-active: rgba(255, 255, 255, 0.2);
|
|
5
7
|
--mirai-ui-button-color-focus: var(--mirai-ui-content);
|
|
@@ -25,21 +27,45 @@
|
|
|
25
27
|
font-weight: var(--mirai-ui-button-font-weight);
|
|
26
28
|
justify-content: center;
|
|
27
29
|
padding: var(--mirai-ui-button-padding-y) var(--mirai-ui-button-padding-x);
|
|
30
|
+
position: relative;
|
|
28
31
|
transition: background-color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
29
32
|
box-shadow var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
30
33
|
color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
31
34
|
width: fit-content;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
.button:disabled {
|
|
37
|
+
.button:disabled:not(.busy) {
|
|
35
38
|
background-color: var(--mirai-ui-button-disabled-background);
|
|
36
39
|
color: var(--mirai-ui-button-disabled-color);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
@keyframes mirai-button-busy {
|
|
43
|
+
from {
|
|
44
|
+
width: var(--mirai-ui-button-busy-width);
|
|
45
|
+
}
|
|
46
|
+
to {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.outlined .busyProgress {
|
|
52
|
+
background-color: var(--mirai-ui-button-background);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.busyProgress {
|
|
56
|
+
background-color: var(--mirai-ui-button-color);
|
|
57
|
+
opacity: 0.2;
|
|
58
|
+
height: 100%;
|
|
59
|
+
left: 0;
|
|
60
|
+
position: absolute;
|
|
61
|
+
width: 0%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.busyProgress.active {
|
|
65
|
+
animation-duration: var(--mirai-ui-button-busy-motion);
|
|
66
|
+
animation-iteration-count: infinite;
|
|
67
|
+
animation-name: mirai-button-busy;
|
|
68
|
+
animation-timing-function: var(--mirai-ui-motion-easing);
|
|
43
69
|
}
|
|
44
70
|
|
|
45
71
|
.button:not(:disabled):active {
|
|
@@ -52,15 +78,25 @@
|
|
|
52
78
|
calc(var(--mirai-ui-button-padding-x) + calc(var(--mirai-ui-button-padding-y) / 2));
|
|
53
79
|
}
|
|
54
80
|
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
81
|
+
.outlined {
|
|
82
|
+
background-color: var(--mirai-ui-button-outlined-background);
|
|
83
|
+
border: solid 1px var(--mirai-ui-button-background);
|
|
84
|
+
color: var(--mirai-ui-button-background);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.outlined.disabled:not(.busy) {
|
|
88
|
+
border-color: var(--mirai-ui-button-disabled-background);
|
|
58
89
|
}
|
|
59
90
|
|
|
60
91
|
.rounded {
|
|
61
92
|
border-radius: 50%;
|
|
62
93
|
}
|
|
63
94
|
|
|
95
|
+
.small:not(.squared) {
|
|
96
|
+
font-size: var(--mirai-ui-font-size-small);
|
|
97
|
+
padding: var(--mirai-ui-button-padding-y) calc(var(--mirai-ui-button-padding-x) / 2);
|
|
98
|
+
}
|
|
99
|
+
|
|
64
100
|
.squared {
|
|
65
101
|
height: var(--mirai-ui-button-squared);
|
|
66
102
|
padding: 0;
|
|
@@ -10,6 +10,20 @@ exports[`component:<Button> inherit:className 1`] = `
|
|
|
10
10
|
</DocumentFragment>
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
+
exports[`component:<Button> prop:busy 1`] = `
|
|
14
|
+
<DocumentFragment>
|
|
15
|
+
<button
|
|
16
|
+
class="pressable button busy"
|
|
17
|
+
disabled=""
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="view busyProgress active"
|
|
21
|
+
/>
|
|
22
|
+
children
|
|
23
|
+
</button>
|
|
24
|
+
</DocumentFragment>
|
|
25
|
+
`;
|
|
26
|
+
|
|
13
27
|
exports[`component:<Button> prop:disabled 1`] = `
|
|
14
28
|
<DocumentFragment>
|
|
15
29
|
<button
|
|
@@ -31,6 +45,20 @@ exports[`component:<Button> prop:large 1`] = `
|
|
|
31
45
|
</DocumentFragment>
|
|
32
46
|
`;
|
|
33
47
|
|
|
48
|
+
exports[`component:<Button> prop:outlined && prop:busy 1`] = `
|
|
49
|
+
<DocumentFragment>
|
|
50
|
+
<button
|
|
51
|
+
class="pressable button busy outlined disabled"
|
|
52
|
+
disabled=""
|
|
53
|
+
>
|
|
54
|
+
<div
|
|
55
|
+
class="view busyProgress active"
|
|
56
|
+
/>
|
|
57
|
+
children
|
|
58
|
+
</button>
|
|
59
|
+
</DocumentFragment>
|
|
60
|
+
`;
|
|
61
|
+
|
|
34
62
|
exports[`component:<Button> prop:outlined 1`] = `
|
|
35
63
|
<DocumentFragment>
|
|
36
64
|
<button
|
|
@@ -7,6 +7,8 @@ exports.getChildrenValues = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
+
var _InputOption = require("../../InputOption");
|
|
11
|
+
|
|
10
12
|
var _getField = require("./getField");
|
|
11
13
|
|
|
12
14
|
var _excluded = ["checked", "defaultChecked", "defaultValue", "type", "value"];
|
|
@@ -17,7 +19,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
17
19
|
|
|
18
20
|
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
21
|
|
|
20
|
-
var BOOLEAN_TYPES = [
|
|
22
|
+
var BOOLEAN_TYPES = [_InputOption.CHECKBOX, _InputOption.RADIO, _InputOption.SWITCH];
|
|
21
23
|
|
|
22
24
|
var getChildrenValues = function getChildrenValues(children) {
|
|
23
25
|
var values = {};
|
|
@@ -37,7 +39,10 @@ var getChildrenValues = function getChildrenValues(children) {
|
|
|
37
39
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
38
40
|
|
|
39
41
|
var field = (0, _getField.getField)(props);
|
|
40
|
-
|
|
42
|
+
|
|
43
|
+
if (field) {
|
|
44
|
+
values[field] = BOOLEAN_TYPES.includes(type) ? type !== _InputOption.RADIO ? checked || defaultChecked : checked ? value : values[field] : value || defaultValue;
|
|
45
|
+
}
|
|
41
46
|
});
|
|
42
47
|
|
|
43
48
|
return values;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChildrenValues.js","names":["BOOLEAN_TYPES","getChildrenValues","children","values","React","Children","forEach","child","props","checked","defaultChecked","defaultValue","undefined","type","value","field","includes"],"sources":["../../../../src/components/Form/helpers/getChildrenValues.js"],"sourcesContent":["import React from 'react';\n\nimport { getField } from './getField';\n\nconst BOOLEAN_TYPES = [
|
|
1
|
+
{"version":3,"file":"getChildrenValues.js","names":["BOOLEAN_TYPES","CHECKBOX","RADIO","SWITCH","getChildrenValues","children","values","React","Children","forEach","child","props","checked","defaultChecked","defaultValue","undefined","type","value","field","includes"],"sources":["../../../../src/components/Form/helpers/getChildrenValues.js"],"sourcesContent":["import React from 'react';\n\nimport { CHECKBOX, RADIO, SWITCH } from '../../InputOption';\nimport { getField } from './getField';\n\nconst BOOLEAN_TYPES = [CHECKBOX, RADIO, SWITCH];\n\nexport const getChildrenValues = (children) => {\n const values = {};\n\n React.Children.forEach(children, (child) => {\n const {\n checked = false,\n defaultChecked = false,\n defaultValue = undefined,\n type = undefined,\n value = undefined,\n ...props\n } = child?.props || {};\n\n const field = getField(props);\n\n if (field) {\n values[field] = BOOLEAN_TYPES.includes(type)\n ? type !== RADIO\n ? checked || defaultChecked\n : checked\n ? value\n : values[field]\n : value || defaultValue;\n }\n });\n\n return values;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAG,CAACC,qBAAD,EAAWC,kBAAX,EAAkBC,mBAAlB,CAAtB;;AAEO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAc;EAC7C,IAAMC,MAAM,GAAG,EAAf;;EAEAC,eAAMC,QAAN,CAAeC,OAAf,CAAuBJ,QAAvB,EAAiC,UAACK,KAAD,EAAW;IAC1C,WAOI,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEC,KAAP,KAAgB,EAPpB;IAAA,wBACEC,OADF;IAAA,IACEA,OADF,6BACY,KADZ;IAAA,+BAEEC,cAFF;IAAA,IAEEA,cAFF,oCAEmB,KAFnB;IAAA,6BAGEC,YAHF;IAAA,IAGEA,YAHF,kCAGiBC,SAHjB;IAAA,qBAIEC,IAJF;IAAA,IAIEA,IAJF,0BAISD,SAJT;IAAA,sBAKEE,KALF;IAAA,IAKEA,KALF,2BAKUF,SALV;IAAA,IAMKJ,KANL;;IASA,IAAMO,KAAK,GAAG,wBAASP,KAAT,CAAd;;IAEA,IAAIO,KAAJ,EAAW;MACTZ,MAAM,CAACY,KAAD,CAAN,GAAgBlB,aAAa,CAACmB,QAAd,CAAuBH,IAAvB,IACZA,IAAI,KAAKd,kBAAT,GACEU,OAAO,IAAIC,cADb,GAEED,OAAO,GACPK,KADO,GAEPX,MAAM,CAACY,KAAD,CALI,GAMZD,KAAK,IAAIH,YANb;IAOD;EACF,CArBD;;EAuBA,OAAOR,MAAP;AACD,CA3BM"}
|
|
@@ -9,7 +9,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
|
|
|
9
9
|
class="view texts"
|
|
10
10
|
/>
|
|
11
11
|
<button
|
|
12
|
-
class="pressable button rounded squared"
|
|
12
|
+
class="pressable button rounded squared outlined disabled"
|
|
13
13
|
disabled=""
|
|
14
14
|
>
|
|
15
15
|
<span
|
|
@@ -85,7 +85,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
|
|
|
85
85
|
class="view texts"
|
|
86
86
|
/>
|
|
87
87
|
<button
|
|
88
|
-
class="pressable button rounded squared"
|
|
88
|
+
class="pressable button rounded squared outlined disabled"
|
|
89
89
|
disabled=""
|
|
90
90
|
>
|
|
91
91
|
<span
|
|
@@ -117,7 +117,7 @@ exports[`component:<InputNumber> prop:disabled 1`] = `
|
|
|
117
117
|
0
|
|
118
118
|
</span>
|
|
119
119
|
<button
|
|
120
|
-
class="pressable button rounded squared"
|
|
120
|
+
class="pressable button rounded squared outlined disabled"
|
|
121
121
|
disabled=""
|
|
122
122
|
>
|
|
123
123
|
<span
|
|
@@ -168,7 +168,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
|
|
|
168
168
|
</span>
|
|
169
169
|
</div>
|
|
170
170
|
<button
|
|
171
|
-
class="pressable button rounded squared"
|
|
171
|
+
class="pressable button rounded squared outlined disabled"
|
|
172
172
|
disabled=""
|
|
173
173
|
>
|
|
174
174
|
<span
|
|
@@ -250,7 +250,7 @@ exports[`component:<InputNumber> prop:label 1`] = `
|
|
|
250
250
|
</span>
|
|
251
251
|
</div>
|
|
252
252
|
<button
|
|
253
|
-
class="pressable button rounded squared"
|
|
253
|
+
class="pressable button rounded squared outlined disabled"
|
|
254
254
|
disabled=""
|
|
255
255
|
>
|
|
256
256
|
<span
|
|
@@ -357,7 +357,7 @@ exports[`component:<InputNumber> prop:max 1`] = `
|
|
|
357
357
|
10
|
|
358
358
|
</span>
|
|
359
359
|
<button
|
|
360
|
-
class="pressable button rounded squared"
|
|
360
|
+
class="pressable button rounded squared outlined disabled"
|
|
361
361
|
disabled=""
|
|
362
362
|
>
|
|
363
363
|
<span
|
|
@@ -402,7 +402,7 @@ exports[`component:<InputNumber> prop:min 1`] = `
|
|
|
402
402
|
class="view texts"
|
|
403
403
|
/>
|
|
404
404
|
<button
|
|
405
|
-
class="pressable button rounded squared"
|
|
405
|
+
class="pressable button rounded squared outlined disabled"
|
|
406
406
|
disabled=""
|
|
407
407
|
>
|
|
408
408
|
<span
|
|
@@ -628,7 +628,7 @@ exports[`component:<InputNumber> renders 1`] = `
|
|
|
628
628
|
class="view texts"
|
|
629
629
|
/>
|
|
630
630
|
<button
|
|
631
|
-
class="pressable button rounded squared"
|
|
631
|
+
class="pressable button rounded squared outlined disabled"
|
|
632
632
|
disabled=""
|
|
633
633
|
>
|
|
634
634
|
<span
|
|
@@ -705,7 +705,7 @@ exports[`component:<InputNumber> testID 1`] = `
|
|
|
705
705
|
class="view texts"
|
|
706
706
|
/>
|
|
707
707
|
<button
|
|
708
|
-
class="pressable button rounded squared"
|
|
708
|
+
class="pressable button rounded squared outlined disabled"
|
|
709
709
|
disabled=""
|
|
710
710
|
>
|
|
711
711
|
<span
|
|
@@ -44,11 +44,10 @@ var InputOption = function InputOption(_ref) {
|
|
|
44
44
|
var Primitive = type === _InputOption.CHECKBOX ? _primitives.Checkbox : type === _InputOption.RADIO ? _primitives.Radio : _primitives.Switch;
|
|
45
45
|
|
|
46
46
|
var handleChange = function handleChange(event) {
|
|
47
|
-
onChange(
|
|
47
|
+
onChange([_InputOption.CHECKBOX, _InputOption.SWITCH].includes(type) ? !checked : value, event);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _extends({}, others, {
|
|
51
|
-
style: others.style,
|
|
52
51
|
type: "button",
|
|
53
52
|
className: (0, _helpers.styles)(_InputOptionModule.default.inputOption, reverse && _InputOptionModule.default.reverse, others.className),
|
|
54
53
|
onPress: handleChange
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputOption.js","names":["InputOption","checked","disabled","label","name","reverse","type","CHECKBOX","value","onChange","others","Primitive","Checkbox","RADIO","Radio","Switch","handleChange","event","style","inputOption","className","icon","undefined","displayName","propTypes","PropTypes","bool","string","isRequired","oneOf","
|
|
1
|
+
{"version":3,"file":"InputOption.js","names":["InputOption","checked","disabled","label","name","reverse","type","CHECKBOX","value","onChange","others","Primitive","Checkbox","RADIO","Radio","Switch","handleChange","event","SWITCH","includes","style","inputOption","className","icon","undefined","displayName","propTypes","PropTypes","bool","string","isRequired","oneOf","func"],"sources":["../../../src/components/InputOption/InputOption.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Checkbox, Icon, Pressable, Radio, Switch, Text } from '../../primitives';\nimport { CHECKBOX, RADIO, SWITCH } from './InputOption.constants';\nimport style from './InputOption.module.css';\n\nconst InputOption = ({\n checked,\n disabled,\n label,\n name,\n reverse,\n type = CHECKBOX,\n value = '',\n onChange = () => {},\n ...others\n}) => {\n const Primitive = type === CHECKBOX ? Checkbox : type === RADIO ? Radio : Switch;\n\n const handleChange = (event) => {\n onChange([CHECKBOX, SWITCH].includes(type) ? !checked : value, event);\n };\n\n return (\n <Pressable\n {...others}\n type=\"button\"\n className={styles(style.inputOption, reverse && style.reverse, others.className)}\n onPress={handleChange}\n >\n <Primitive checked={checked} disabled={disabled} name={name} type={type} value={value}>\n {type === CHECKBOX && checked ? <Icon name=\"Check\" className={styles(style.icon)} /> : undefined}\n </Primitive>\n {label && <Text className={styles(style.label, disabled && style.disabled)}>{label}</Text>}\n </Pressable>\n );\n};\n\nInputOption.displayName = 'Component:InputOption';\n\nInputOption.propTypes = {\n checked: PropTypes.bool,\n disabled: PropTypes.bool,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n reverse: PropTypes.bool,\n type: PropTypes.oneOf([CHECKBOX, RADIO, SWITCH]),\n value: PropTypes.string,\n onChange: PropTypes.func,\n};\n\nexport { InputOption };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OAUd;EAAA,IATJC,OASI,QATJA,OASI;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,IAMI,QANJA,IAMI;EAAA,IALJC,OAKI,QALJA,OAKI;EAAA,qBAJJC,IAII;EAAA,IAJJA,IAII,0BAJGC,qBAIH;EAAA,sBAHJC,KAGI;EAAA,IAHJA,KAGI,2BAHI,EAGJ;EAAA,yBAFJC,QAEI;EAAA,IAFJA,QAEI,8BAFO,YAAM,CAAE,CAEf;EAAA,IADDC,MACC;;EACJ,IAAMC,SAAS,GAAGL,IAAI,KAAKC,qBAAT,GAAoBK,oBAApB,GAA+BN,IAAI,KAAKO,kBAAT,GAAiBC,iBAAjB,GAAyBC,kBAA1E;;EAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAW;IAC9BR,QAAQ,CAAC,CAACF,qBAAD,EAAWW,mBAAX,EAAmBC,QAAnB,CAA4Bb,IAA5B,IAAoC,CAACL,OAArC,GAA+CO,KAAhD,EAAuDS,KAAvD,CAAR;EACD,CAFD;;EAIA,oBACE,6BAAC,qBAAD,eACMP,MADN;IAEE,IAAI,EAAC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_InputOption2 = require("./InputOption.constants");
|
|
21
|
+
|
|
22
|
+
Object.keys(_InputOption2).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _InputOption2[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _InputOption2[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
19
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/InputOption/index.js"],"sourcesContent":["export * from './InputOption';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/InputOption/index.js"],"sourcesContent":["export * from './InputOption';\nexport * from './InputOption.constants';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -32,10 +32,8 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
32
32
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
33
33
|
|
|
34
34
|
var handleChange = function handleChange(event) {
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
checked = _event$target.checked;
|
|
38
|
-
onChange && onChange(value, checked, event);
|
|
35
|
+
var checked = event.target.checked;
|
|
36
|
+
onChange(checked, event);
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -49,7 +47,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
49
47
|
type: "checkbox",
|
|
50
48
|
value: value,
|
|
51
49
|
className: (0, _helpers.styles)(checked && _CheckboxModule.default.checked),
|
|
52
|
-
onChange: !disabled ? handleChange : undefined
|
|
50
|
+
onChange: !disabled && onChange ? handleChange : undefined
|
|
53
51
|
}), children);
|
|
54
52
|
};
|
|
55
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["Checkbox","checked","children","disabled","name","value","onChange","others","handleChange","event","target","style","checkbox","className","undefined","displayName","propTypes","PropTypes","bool","node","string","isRequired","func"],"sources":["../../../src/primitives/Checkbox/Checkbox.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './Checkbox.module.css';\n\nconst Checkbox = ({ checked, children, disabled, name, value = '', onChange, ...others }) => {\n const handleChange = (event) => {\n const {\n target: {
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["Checkbox","checked","children","disabled","name","value","onChange","others","handleChange","event","target","style","checkbox","className","undefined","displayName","propTypes","PropTypes","bool","node","string","isRequired","func"],"sources":["../../../src/primitives/Checkbox/Checkbox.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './Checkbox.module.css';\n\nconst Checkbox = ({ checked, children, disabled, name, value = '', onChange, ...others }) => {\n const handleChange = (event) => {\n const {\n target: { checked },\n } = event;\n onChange(checked, event);\n };\n\n return (\n <div className={styles(style.checkbox, others.className)} style={others.style}>\n <input\n checked={checked}\n data-testid={others['data-testid']}\n disabled={disabled}\n name={name}\n type=\"checkbox\"\n value={value}\n className={styles(checked && style.checked)}\n onChange={!disabled && onChange ? handleChange : undefined}\n />\n {children}\n </div>\n );\n};\n\nCheckbox.displayName = 'Primitive:Checkbox';\n\nCheckbox.propTypes = {\n checked: PropTypes.bool,\n children: PropTypes.node,\n disabled: PropTypes.bool,\n name: PropTypes.string.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n};\n\nexport { Checkbox };\n"],"mappings":";;;;;;;AAAA;;AACA;;A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