fluent-styles 1.20.0 → 1.21.0
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.
|
@@ -19,24 +19,19 @@ const CheckBox = (0, _styled.styled)(_reactNative.TouchableOpacity, {
|
|
|
19
19
|
height: 24,
|
|
20
20
|
borderWidth: 2,
|
|
21
21
|
borderRadius: 1,
|
|
22
|
+
backgroundColor: _theme.theme.colors.gray[1],
|
|
22
23
|
borderColor: _theme.theme.colors.gray[700],
|
|
23
24
|
justifyContent: 'center',
|
|
24
25
|
alignItems: 'center',
|
|
25
26
|
flexDirection: 'column'
|
|
26
27
|
},
|
|
27
28
|
variants: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
height: size => {
|
|
35
|
-
if (!size) return;
|
|
36
|
-
return {
|
|
37
|
-
height: size
|
|
38
|
-
};
|
|
39
|
-
},
|
|
29
|
+
height: size => ({
|
|
30
|
+
height: size || 24
|
|
31
|
+
}),
|
|
32
|
+
width: size => ({
|
|
33
|
+
width: size || 24
|
|
34
|
+
}),
|
|
40
35
|
disabled: {
|
|
41
36
|
true: {
|
|
42
37
|
backgroundColor: _theme.theme.colors.gray[500]
|
|
@@ -45,6 +40,9 @@ const CheckBox = (0, _styled.styled)(_reactNative.TouchableOpacity, {
|
|
|
45
40
|
checked: {
|
|
46
41
|
true: {
|
|
47
42
|
backgroundColor: _theme.theme.colors.gray[800]
|
|
43
|
+
},
|
|
44
|
+
false: {
|
|
45
|
+
backgroundColor: _theme.theme.colors.gray[1]
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
48
|
checkedColor: color => {
|
|
@@ -60,25 +58,28 @@ const StyledCheckBox = ({
|
|
|
60
58
|
onPress,
|
|
61
59
|
disabled = false,
|
|
62
60
|
checkedColor,
|
|
61
|
+
checked = false,
|
|
63
62
|
iconProps,
|
|
64
63
|
...rest
|
|
65
64
|
}) => {
|
|
66
|
-
const [
|
|
65
|
+
const [check, setCheck] = (0, _react.useState)(false);
|
|
66
|
+
(0, _react.useEffect)(() => {
|
|
67
|
+
setCheck(checked);
|
|
68
|
+
}, [checked]);
|
|
67
69
|
const toggleCheckbox = () => {
|
|
68
|
-
|
|
69
|
-
onPress && onPress(!
|
|
70
|
+
setCheck(!check);
|
|
71
|
+
onPress && onPress(!check);
|
|
70
72
|
};
|
|
71
73
|
return /*#__PURE__*/_react.default.createElement(CheckBox, _extends({
|
|
72
74
|
disabled: disabled,
|
|
73
|
-
checked:
|
|
74
|
-
checkedColor:
|
|
75
|
+
checked: check,
|
|
76
|
+
checkedColor: check && checkedColor && checkedColor,
|
|
75
77
|
onPress: () => toggleCheckbox()
|
|
76
|
-
}, rest),
|
|
77
|
-
name: "check"
|
|
78
|
-
}, iconProps, {
|
|
78
|
+
}, rest), check && /*#__PURE__*/_react.default.createElement(_MaterialIcons.default, _extends({
|
|
79
|
+
name: "check",
|
|
79
80
|
color: _theme.theme.colors.gray[1],
|
|
80
81
|
size: 20
|
|
81
|
-
})));
|
|
82
|
+
}, iconProps)));
|
|
82
83
|
};
|
|
83
84
|
exports.StyledCheckBox = StyledCheckBox;
|
|
84
85
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_styled","_reactNative","_MaterialIcons","_interopRequireDefault","_theme","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","CheckBox","styled","TouchableOpacity","base","width","height","borderWidth","borderRadius","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_styled","_reactNative","_MaterialIcons","_interopRequireDefault","_theme","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","CheckBox","styled","TouchableOpacity","base","width","height","borderWidth","borderRadius","backgroundColor","theme","colors","gray","borderColor","justifyContent","alignItems","flexDirection","variants","size","disabled","true","checked","false","checkedColor","color","StyledCheckBox","onPress","iconProps","rest","check","setCheck","useState","useEffect","toggleCheckbox","createElement","name","exports"],"sources":["index.jsx"],"sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { styled } from '../styled'\r\nimport { TouchableOpacity } from 'react-native'\r\nimport Icon from 'react-native-vector-icons/MaterialIcons'\r\nimport { theme } from '../theme'\r\n\r\nconst CheckBox = styled(TouchableOpacity, {\r\n base: {\r\n width: 24,\r\n height: 24,\r\n borderWidth: 2,\r\n borderRadius: 1,\r\n backgroundColor: theme.colors.gray[1],\r\n borderColor: theme.colors.gray[700],\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n flexDirection: 'column'\r\n },\r\n variants: {\r\n height: size => ({\r\n height: size || 24\r\n }),\r\n width: size => ({\r\n width: size || 24\r\n }),\r\n disabled: {\r\n true: {\r\n backgroundColor: theme.colors.gray[500]\r\n }\r\n },\r\n checked: {\r\n true: {\r\n backgroundColor: theme.colors.gray[800]\r\n },\r\n false: {\r\n backgroundColor: theme.colors.gray[1]\r\n }\r\n },\r\n checkedColor: color => {\r\n if (!color) return\r\n return {\r\n backgroundColor: color,\r\n borderColor: color\r\n }\r\n }\r\n }\r\n})\r\n\r\nconst StyledCheckBox = ({\r\n onPress,\r\n disabled = false,\r\n checkedColor,\r\n checked = false,\r\n iconProps,\r\n ...rest\r\n}) => {\r\n const [check, setCheck] = useState(false)\r\n\r\n useEffect(\r\n () => {\r\n setCheck(checked)\r\n },\r\n [checked]\r\n )\r\n\r\n const toggleCheckbox = () => {\r\n setCheck(!check)\r\n onPress && onPress(!check)\r\n }\r\n\r\n return (\r\n <CheckBox\r\n disabled={disabled}\r\n checked={check}\r\n checkedColor={check && checkedColor && checkedColor}\r\n onPress={() => toggleCheckbox()}\r\n {...rest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E,GAC5BL,IAAI,GAEPC,KAAK,iBACJ9D,MAAA,CAAAU,OAAA,CAAAyD,aAAA,CAAC9D,cAAA,CAAAK,OAAI,EAAAkB,QAAA;IACHwC,IAAI,EAAC,OAAO;IACZX,KAAK,EAAEd,YAAK,CAACC,MAAM,CAACC,IAAI,CAAC,CAAC,CAAE;IAC5BM,IAAI,EAAE;EAAG,GACLS,SAAS,CACd,CACK,CAAC;AAEf,CAAC;AAAAS,OAAA,CAAAX,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { styled } from '../styled';
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
5
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
@@ -10,24 +10,19 @@ const CheckBox = styled(TouchableOpacity, {
|
|
|
10
10
|
height: 24,
|
|
11
11
|
borderWidth: 2,
|
|
12
12
|
borderRadius: 1,
|
|
13
|
+
backgroundColor: theme.colors.gray[1],
|
|
13
14
|
borderColor: theme.colors.gray[700],
|
|
14
15
|
justifyContent: 'center',
|
|
15
16
|
alignItems: 'center',
|
|
16
17
|
flexDirection: 'column'
|
|
17
18
|
},
|
|
18
19
|
variants: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
height: size => {
|
|
26
|
-
if (!size) return;
|
|
27
|
-
return {
|
|
28
|
-
height: size
|
|
29
|
-
};
|
|
30
|
-
},
|
|
20
|
+
height: size => ({
|
|
21
|
+
height: size || 24
|
|
22
|
+
}),
|
|
23
|
+
width: size => ({
|
|
24
|
+
width: size || 24
|
|
25
|
+
}),
|
|
31
26
|
disabled: {
|
|
32
27
|
true: {
|
|
33
28
|
backgroundColor: theme.colors.gray[500]
|
|
@@ -36,6 +31,9 @@ const CheckBox = styled(TouchableOpacity, {
|
|
|
36
31
|
checked: {
|
|
37
32
|
true: {
|
|
38
33
|
backgroundColor: theme.colors.gray[800]
|
|
34
|
+
},
|
|
35
|
+
false: {
|
|
36
|
+
backgroundColor: theme.colors.gray[1]
|
|
39
37
|
}
|
|
40
38
|
},
|
|
41
39
|
checkedColor: color => {
|
|
@@ -51,25 +49,28 @@ const StyledCheckBox = ({
|
|
|
51
49
|
onPress,
|
|
52
50
|
disabled = false,
|
|
53
51
|
checkedColor,
|
|
52
|
+
checked = false,
|
|
54
53
|
iconProps,
|
|
55
54
|
...rest
|
|
56
55
|
}) => {
|
|
57
|
-
const [
|
|
56
|
+
const [check, setCheck] = useState(false);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setCheck(checked);
|
|
59
|
+
}, [checked]);
|
|
58
60
|
const toggleCheckbox = () => {
|
|
59
|
-
|
|
60
|
-
onPress && onPress(!
|
|
61
|
+
setCheck(!check);
|
|
62
|
+
onPress && onPress(!check);
|
|
61
63
|
};
|
|
62
64
|
return /*#__PURE__*/React.createElement(CheckBox, _extends({
|
|
63
65
|
disabled: disabled,
|
|
64
|
-
checked:
|
|
65
|
-
checkedColor:
|
|
66
|
+
checked: check,
|
|
67
|
+
checkedColor: check && checkedColor && checkedColor,
|
|
66
68
|
onPress: () => toggleCheckbox()
|
|
67
|
-
}, rest),
|
|
68
|
-
name: "check"
|
|
69
|
-
}, iconProps, {
|
|
69
|
+
}, rest), check && /*#__PURE__*/React.createElement(Icon, _extends({
|
|
70
|
+
name: "check",
|
|
70
71
|
color: theme.colors.gray[1],
|
|
71
72
|
size: 20
|
|
72
|
-
})));
|
|
73
|
+
}, iconProps)));
|
|
73
74
|
};
|
|
74
75
|
export { StyledCheckBox };
|
|
75
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","styled","TouchableOpacity","Icon","theme","CheckBox","base","width","height","borderWidth","borderRadius","
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","styled","TouchableOpacity","Icon","theme","CheckBox","base","width","height","borderWidth","borderRadius","backgroundColor","colors","gray","borderColor","justifyContent","alignItems","flexDirection","variants","size","disabled","true","checked","false","checkedColor","color","StyledCheckBox","onPress","iconProps","rest","check","setCheck","toggleCheckbox","createElement","_extends","name"],"sources":["index.jsx"],"sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { styled } from '../styled'\r\nimport { TouchableOpacity } from 'react-native'\r\nimport Icon from 'react-native-vector-icons/MaterialIcons'\r\nimport { theme } from '../theme'\r\n\r\nconst CheckBox = styled(TouchableOpacity, {\r\n base: {\r\n width: 24,\r\n height: 24,\r\n borderWidth: 2,\r\n borderRadius: 1,\r\n backgroundColor: theme.colors.gray[1],\r\n borderColor: theme.colors.gray[700],\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n flexDirection: 'column'\r\n },\r\n variants: {\r\n height: size => ({\r\n height: size || 24\r\n }),\r\n width: size => ({\r\n width: size || 24\r\n }),\r\n disabled: {\r\n true: {\r\n backgroundColor: theme.colors.gray[500]\r\n }\r\n },\r\n checked: {\r\n true: {\r\n backgroundColor: theme.colors.gray[800]\r\n },\r\n false: {\r\n backgroundColor: theme.colors.gray[1]\r\n }\r\n },\r\n checkedColor: color => {\r\n if (!color) return\r\n return {\r\n backgroundColor: color,\r\n borderColor: color\r\n }\r\n }\r\n }\r\n})\r\n\r\nconst StyledCheckBox = ({\r\n onPress,\r\n disabled = false,\r\n checkedColor,\r\n checked = false,\r\n iconProps,\r\n ...rest\r\n}) => {\r\n const [check, setCheck] = useState(false)\r\n\r\n useEffect(\r\n () => {\r\n setCheck(checked)\r\n },\r\n [checked]\r\n )\r\n\r\n const toggleCheckbox = () => {\r\n setCheck(!check)\r\n onPress && onPress(!check)\r\n }\r\n\r\n return (\r\n <CheckBox\r\n disabled={disabled}\r\n checked={check}\r\n checkedColor={check && checkedColor && checkedColor}\r\n onPress={() => toggleCheckbox()}\r\n {...rest}\r\n >\r\n {check &&\r\n <Icon\r\n name='check'\r\n color={theme.colors.gray[1]}\r\n size={20}\r\n {...iconProps}\r\n />}\r\n </CheckBox>\r\n )\r\n}\r\n\r\nexport { StyledCheckBox }\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,OAAOC,IAAI,MAAM,yCAAyC;AAC1D,SAASC,KAAK,QAAQ,UAAU;AAEhC,MAAMC,QAAQ,GAAGJ,MAAM,CAACC,gBAAgB,EAAE;EACxCI,IAAI,EAAE;IACJC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC;IACrCC,WAAW,EAAEV,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,GAAG,CAAC;IACnCE,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,aAAa,EAAE;EACjB,CAAC;EACDC,QAAQ,EAAE;IACRV,MAAM,EAAEW,IAAI,KAAK;MACfX,MAAM,EAAEW,IAAI,IAAI;IAClB,CAAC,CAAC;IACFZ,KAAK,EAAEY,IAAI,KAAK;MACdZ,KAAK,EAAEY,IAAI,IAAI;IACjB,CAAC,CAAC;IACFC,QAAQ,EAAE;MACRC,IAAI,EAAE;QACJV,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,GAAG;MACxC;IACF,CAAC;IACDS,OAAO,EAAE;MACPD,IAAI,EAAE;QACJV,eAAe,EAAEP,KAAK,CAACQ,MAA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AASF,cAAc","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { styled } from '../styled'
|
|
3
3
|
import { TouchableOpacity } from 'react-native'
|
|
4
4
|
import Icon from 'react-native-vector-icons/MaterialIcons'
|
|
@@ -10,20 +10,19 @@ const CheckBox = styled(TouchableOpacity, {
|
|
|
10
10
|
height: 24,
|
|
11
11
|
borderWidth: 2,
|
|
12
12
|
borderRadius: 1,
|
|
13
|
+
backgroundColor: theme.colors.gray[1],
|
|
13
14
|
borderColor: theme.colors.gray[700],
|
|
14
15
|
justifyContent: 'center',
|
|
15
16
|
alignItems: 'center',
|
|
16
17
|
flexDirection: 'column'
|
|
17
18
|
},
|
|
18
19
|
variants: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return { height: size }
|
|
26
|
-
},
|
|
20
|
+
height: size => ({
|
|
21
|
+
height: size || 24
|
|
22
|
+
}),
|
|
23
|
+
width: size => ({
|
|
24
|
+
width: size || 24
|
|
25
|
+
}),
|
|
27
26
|
disabled: {
|
|
28
27
|
true: {
|
|
29
28
|
backgroundColor: theme.colors.gray[500]
|
|
@@ -32,6 +31,9 @@ const CheckBox = styled(TouchableOpacity, {
|
|
|
32
31
|
checked: {
|
|
33
32
|
true: {
|
|
34
33
|
backgroundColor: theme.colors.gray[800]
|
|
34
|
+
},
|
|
35
|
+
false: {
|
|
36
|
+
backgroundColor: theme.colors.gray[1]
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
checkedColor: color => {
|
|
@@ -45,34 +47,42 @@ const CheckBox = styled(TouchableOpacity, {
|
|
|
45
47
|
})
|
|
46
48
|
|
|
47
49
|
const StyledCheckBox = ({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
onPress,
|
|
51
|
+
disabled = false,
|
|
52
|
+
checkedColor,
|
|
53
|
+
checked = false,
|
|
54
|
+
iconProps,
|
|
55
|
+
...rest
|
|
53
56
|
}) => {
|
|
54
|
-
const [
|
|
57
|
+
const [check, setCheck] = useState(false)
|
|
58
|
+
|
|
59
|
+
useEffect(
|
|
60
|
+
() => {
|
|
61
|
+
setCheck(checked)
|
|
62
|
+
},
|
|
63
|
+
[checked]
|
|
64
|
+
)
|
|
55
65
|
|
|
56
66
|
const toggleCheckbox = () => {
|
|
57
|
-
|
|
58
|
-
onPress && onPress(!
|
|
67
|
+
setCheck(!check)
|
|
68
|
+
onPress && onPress(!check)
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
return (
|
|
62
72
|
<CheckBox
|
|
63
73
|
disabled={disabled}
|
|
64
|
-
checked={
|
|
65
|
-
checkedColor={
|
|
74
|
+
checked={check}
|
|
75
|
+
checkedColor={check && checkedColor && checkedColor}
|
|
66
76
|
onPress={() => toggleCheckbox()}
|
|
67
77
|
{...rest}
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
>
|
|
79
|
+
{check &&
|
|
80
|
+
<Icon
|
|
81
|
+
name='check'
|
|
82
|
+
color={theme.colors.gray[1]}
|
|
83
|
+
size={20}
|
|
84
|
+
{...iconProps}
|
|
85
|
+
/>}
|
|
76
86
|
</CheckBox>
|
|
77
87
|
)
|
|
78
88
|
}
|