fluent-styles 1.7.0 → 1.9.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.
- package/lib/commonjs/package/radioButton/index.js +10 -19
- package/lib/commonjs/package/radioButton/index.js.map +1 -1
- package/lib/commonjs/package/safeAreaView/index.js +2 -1
- package/lib/commonjs/package/safeAreaView/index.js.map +1 -1
- package/lib/commonjs/package/scrollView/index.js +2 -1
- package/lib/commonjs/package/scrollView/index.js.map +1 -1
- package/lib/module/package/radioButton/index.js +10 -19
- package/lib/module/package/radioButton/index.js.map +1 -1
- package/lib/module/package/safeAreaView/index.js +1 -0
- package/lib/module/package/safeAreaView/index.js.map +1 -1
- package/lib/module/package/scrollView/index.js +1 -0
- package/lib/module/package/scrollView/index.js.map +1 -1
- package/package.json +1 -1
- package/src/package/radioButton/index.jsx +10 -17
- package/src/package/safeAreaView/index.jsx +1 -0
- package/src/package/scrollView/index.jsx +1 -0
|
@@ -9,7 +9,6 @@ var _styled = require("../styled");
|
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _MaterialIcons = _interopRequireDefault(require("react-native-vector-icons/MaterialIcons"));
|
|
11
11
|
var _theme = require("../theme");
|
|
12
|
-
var _utils = require("../utils");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -26,18 +25,12 @@ const RadioButton = (0, _styled.styled)(_reactNative.TouchableOpacity, {
|
|
|
26
25
|
flexDirection: 'column'
|
|
27
26
|
},
|
|
28
27
|
variants: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
height: size => {
|
|
36
|
-
if (!size) return;
|
|
37
|
-
return {
|
|
38
|
-
height: size
|
|
39
|
-
};
|
|
40
|
-
},
|
|
28
|
+
height: size => ({
|
|
29
|
+
height: size || 24
|
|
30
|
+
}),
|
|
31
|
+
width: size => ({
|
|
32
|
+
width: size || 24
|
|
33
|
+
}),
|
|
41
34
|
disabled: {
|
|
42
35
|
true: {
|
|
43
36
|
backgroundColor: _theme.theme.colors.gray[500]
|
|
@@ -58,22 +51,20 @@ const RadioButton = (0, _styled.styled)(_reactNative.TouchableOpacity, {
|
|
|
58
51
|
}
|
|
59
52
|
});
|
|
60
53
|
const StyledRadioButton = ({
|
|
54
|
+
name = "",
|
|
61
55
|
onPress,
|
|
62
56
|
disabled = false,
|
|
57
|
+
selected,
|
|
63
58
|
checkedColor,
|
|
64
59
|
iconProps,
|
|
65
60
|
...rest
|
|
66
61
|
}) => {
|
|
67
|
-
const
|
|
68
|
-
const toggleCheckbox = () => {
|
|
69
|
-
setChecked(!checked);
|
|
70
|
-
onPress && onPress(!checked);
|
|
71
|
-
};
|
|
62
|
+
const checked = selected === name;
|
|
72
63
|
return /*#__PURE__*/_react.default.createElement(RadioButton, _extends({
|
|
73
64
|
disabled: disabled,
|
|
74
65
|
checked: checked,
|
|
75
66
|
checkedColor: checked && checkedColor && checkedColor,
|
|
76
|
-
onPress: () =>
|
|
67
|
+
onPress: () => onPress && onPress(name)
|
|
77
68
|
}, rest), checked && /*#__PURE__*/_react.default.createElement(_MaterialIcons.default, _extends({
|
|
78
69
|
name: "circle",
|
|
79
70
|
color: _theme.theme.colors.gray[700],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_styled","_reactNative","_MaterialIcons","_interopRequireDefault","_theme","
|
|
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","RadioButton","styled","TouchableOpacity","base","width","height","borderWidth","borderRadius","borderColor","theme","colors","gray","justifyContent","alignItems","flexDirection","variants","size","disabled","true","backgroundColor","checked","checkedColor","color","StyledRadioButton","name","onPress","selected","iconProps","rest","createElement","exports"],"sources":["index.jsx"],"sourcesContent":["import React, { useState } 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 RadioButton = styled(TouchableOpacity, {\r\n base: {\r\n width: 24,\r\n height: 24,\r\n borderWidth: 2,\r\n borderRadius: 100,\r\n borderColor: theme.colors.gray[500],\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[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 StyledRadioButton = ({\r\n\tname= \"\",\r\n\tonPress,\r\n\tdisabled = false,\r\n\tselected,\r\n\tcheckedColor,\r\n\ticonProps,\r\n\t...rest\r\n}) => {\r\n const checked = selected === name \r\n return (\r\n <RadioButton\r\n disabled={disabled}\r\n checked={checked}\r\n checkedColor={checked && checkedColor && checkedColor}\r\n onPress={() => onPress && onPress(name)}\r\n {...rest}\r\n\t\t>\r\n {checked &&\r\n <Icon\r\n name='circle'\r\n color={theme.colors.gray[700]}\r\n size={15}\r\n {...iconProps}\r\n\t\t\t\t/>}\r\n </RadioButton>\r\n )\r\n}\r\n\r\nexport { StyledRadioButton }\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAgC,SAAAI,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAAC,IAAA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AAAAG,OAAA,CAAAP,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledSafeAreaView = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _styled = require("../styled");
|
|
9
|
+
var _utils = require("../utils");
|
|
9
10
|
const StyledSafeAreaView = exports.StyledSafeAreaView = (0, _styled.styled)(_reactNative.SafeAreaView, {
|
|
10
11
|
base: {
|
|
11
12
|
flex: 1
|
|
@@ -13,7 +14,7 @@ const StyledSafeAreaView = exports.StyledSafeAreaView = (0, _styled.styled)(_rea
|
|
|
13
14
|
variants: {
|
|
14
15
|
backgroundColor: color => {
|
|
15
16
|
if (!color) return;
|
|
16
|
-
if (!isValidColor(color)) {
|
|
17
|
+
if (!(0, _utils.isValidColor)(color)) {
|
|
17
18
|
throw new Error('Invalid backgroundColor value');
|
|
18
19
|
}
|
|
19
20
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_styled","StyledSafeAreaView","exports","styled","SafeAreaView","base","flex","variants","backgroundColor","color","isValidColor","Error"],"sources":["index.jsx"],"sourcesContent":["import { SafeAreaView } from 'react-native'\r\nimport { styled } from '../styled'\r\n\r\nconst StyledSafeAreaView = styled(SafeAreaView, {\r\n base: {\r\n flex: 1\r\n },\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledSafeAreaView }\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_styled","_utils","StyledSafeAreaView","exports","styled","SafeAreaView","base","flex","variants","backgroundColor","color","isValidColor","Error"],"sources":["index.jsx"],"sourcesContent":["import { SafeAreaView } from 'react-native'\r\nimport { styled } from '../styled'\r\nimport { isValidColor } from '../utils'\r\n\r\nconst StyledSafeAreaView = styled(SafeAreaView, {\r\n base: {\r\n flex: 1\r\n },\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledSafeAreaView }\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAAE,cAAM,EAACC,yBAAY,EAAE;EAC9CC,IAAI,EAAE;IACJC,IAAI,EAAE;EACR,CAAC;EACDC,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAAC,IAAAC,mBAAY,EAACD,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIE,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEH,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledScrollView = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _styled = require("../styled");
|
|
9
|
+
var _utils = require("../utils");
|
|
9
10
|
const StyledScrollView = exports.StyledScrollView = (0, _styled.styled)(_reactNative.ScrollView, {
|
|
10
11
|
variants: {
|
|
11
12
|
backgroundColor: color => {
|
|
12
13
|
if (!color) return;
|
|
13
|
-
if (!isValidColor(color)) {
|
|
14
|
+
if (!(0, _utils.isValidColor)(color)) {
|
|
14
15
|
throw new Error('Invalid backgroundColor value');
|
|
15
16
|
}
|
|
16
17
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_styled","StyledScrollView","exports","styled","ScrollView","variants","backgroundColor","color","isValidColor","Error"],"sources":["index.jsx"],"sourcesContent":["import { ScrollView } from 'react-native'\r\nimport { styled } from '../styled'\r\n\r\nconst StyledScrollView = styled(ScrollView, {\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledScrollView }\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_styled","_utils","StyledScrollView","exports","styled","ScrollView","variants","backgroundColor","color","isValidColor","Error"],"sources":["index.jsx"],"sourcesContent":["import { ScrollView } from 'react-native'\r\nimport { styled } from '../styled'\r\nimport { isValidColor } from '../utils'\r\n\r\nconst StyledScrollView = styled(ScrollView, {\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledScrollView }\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,cAAM,EAACC,uBAAU,EAAE;EAC1CC,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAAC,IAAAC,mBAAY,EAACD,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIE,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEH,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,6 @@ import { styled } from '../styled';
|
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
5
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
6
6
|
import { theme } from '../theme';
|
|
7
|
-
import { isValidColor, isValidNumber, isValidString } from '../utils';
|
|
8
7
|
const RadioButton = styled(TouchableOpacity, {
|
|
9
8
|
base: {
|
|
10
9
|
width: 24,
|
|
@@ -17,18 +16,12 @@ const RadioButton = styled(TouchableOpacity, {
|
|
|
17
16
|
flexDirection: 'column'
|
|
18
17
|
},
|
|
19
18
|
variants: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
height: size => {
|
|
27
|
-
if (!size) return;
|
|
28
|
-
return {
|
|
29
|
-
height: size
|
|
30
|
-
};
|
|
31
|
-
},
|
|
19
|
+
height: size => ({
|
|
20
|
+
height: size || 24
|
|
21
|
+
}),
|
|
22
|
+
width: size => ({
|
|
23
|
+
width: size || 24
|
|
24
|
+
}),
|
|
32
25
|
disabled: {
|
|
33
26
|
true: {
|
|
34
27
|
backgroundColor: theme.colors.gray[500]
|
|
@@ -49,22 +42,20 @@ const RadioButton = styled(TouchableOpacity, {
|
|
|
49
42
|
}
|
|
50
43
|
});
|
|
51
44
|
const StyledRadioButton = ({
|
|
45
|
+
name = "",
|
|
52
46
|
onPress,
|
|
53
47
|
disabled = false,
|
|
48
|
+
selected,
|
|
54
49
|
checkedColor,
|
|
55
50
|
iconProps,
|
|
56
51
|
...rest
|
|
57
52
|
}) => {
|
|
58
|
-
const
|
|
59
|
-
const toggleCheckbox = () => {
|
|
60
|
-
setChecked(!checked);
|
|
61
|
-
onPress && onPress(!checked);
|
|
62
|
-
};
|
|
53
|
+
const checked = selected === name;
|
|
63
54
|
return /*#__PURE__*/React.createElement(RadioButton, _extends({
|
|
64
55
|
disabled: disabled,
|
|
65
56
|
checked: checked,
|
|
66
57
|
checkedColor: checked && checkedColor && checkedColor,
|
|
67
|
-
onPress: () =>
|
|
58
|
+
onPress: () => onPress && onPress(name)
|
|
68
59
|
}, rest), checked && /*#__PURE__*/React.createElement(Icon, _extends({
|
|
69
60
|
name: "circle",
|
|
70
61
|
color: theme.colors.gray[700],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","styled","TouchableOpacity","Icon","theme","
|
|
1
|
+
{"version":3,"names":["React","useState","styled","TouchableOpacity","Icon","theme","RadioButton","base","width","height","borderWidth","borderRadius","borderColor","colors","gray","justifyContent","alignItems","flexDirection","variants","size","disabled","true","backgroundColor","checked","checkedColor","color","StyledRadioButton","name","onPress","selected","iconProps","rest","createElement","_extends"],"sources":["index.jsx"],"sourcesContent":["import React, { useState } 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 RadioButton = styled(TouchableOpacity, {\r\n base: {\r\n width: 24,\r\n height: 24,\r\n borderWidth: 2,\r\n borderRadius: 100,\r\n borderColor: theme.colors.gray[500],\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[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 StyledRadioButton = ({\r\n\tname= \"\",\r\n\tonPress,\r\n\tdisabled = false,\r\n\tselected,\r\n\tcheckedColor,\r\n\ticonProps,\r\n\t...rest\r\n}) => {\r\n const checked = selected === name \r\n return (\r\n <RadioButton\r\n disabled={disabled}\r\n checked={checked}\r\n checkedColor={checked && checkedColor && checkedColor}\r\n onPress={() => onPress && onPress(name)}\r\n {...rest}\r\n\t\t>\r\n {checked &&\r\n <Icon\r\n name='circle'\r\n color={theme.colors.gray[700]}\r\n size={15}\r\n {...iconProps}\r\n\t\t\t\t/>}\r\n </RadioButton>\r\n )\r\n}\r\n\r\nexport { StyledRadioButton }\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,OAAOC,IAAI,MAAM,yCAAyC;AAC1D,SAASC,KAAK,QAAQ,UAAU;AAEhC,MAAMC,WAAW,GAAGJ,MAAM,CAACC,gBAAgB,EAAE;EAC3CI,IAAI,EAAE;IACJC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,GAAG;IACjBC,WAAW,EAAEP,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,GAAG,CAAC;IACnCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,aAAa,EAAE;EACjB,CAAC;EACDC,QAAQ,EAAE;IACRT,MAAM,EAAEU,IAAI,KAAK;MACfV,MAAM,EAAEU,IAAI,IAAI;IAClB,CAAC,CAAC;IACFX,KAAK,EAAEW,IAAI,KAAK;MACdX,KAAK,EAAEW,IAAI,IAAI;IACjB,CAAC,CAAC;IACFC,QAAQ,EAAE;MACRC,IAAI,EAAE;QACJC,eAAe,EAAEjB,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,GAAG;MACxC;IACF,CAAC;IACDS,OAAO,EAAE;MACPF,IAAI,EAAE;QACJC,eAAe,EAAEjB,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,CAAC;MACtC;IACF,CAAC;IACDU,YAAY,EAAEC,KAAK,IAAI;MACrB,IAAI,CAACA,KAAK,EAAE;MACZ,OAAO;QACLH,eAAe,EAAEG,KAAK;QACtBb,WAAW,EAAEa;MACf,CAAC;IACH;EACF;AACF,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAGA,CAAC;EAC1BC,IAAI,GAAE,EAAE;EACRC,OAAO;EACPR,QAAQ,GAAG,KAAK;EAChBS,QAAQ;EACRL,YAAY;EACZM,SAAS;EACT,GAAGC;AACJ,CAAC,KAAK;EACJ,MAAMR,OAAO,GAAGM,QAAQ,KAAKF,IAAI;EACjC,oBACE3B,KAAA,CAAAgC,aAAA,CAAC1B,WAAW,EAAA2B,QAAA;IACVb,QAAQ,EAAEA,QAAS;IACnBG,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAED,OAAO,IAAIC,YAAY,IAAIA,YAAa;IACtDI,OAAO,EAAEA,CAAA,KAAMA,OAAO,IAAIA,OAAO,CAACD,IAAI;EAAE,GACpCI,IAAI,GAEPR,OAAO,iBACRvB,KAAA,CAAAgC,aAAA,CAAC5B,IAAI,EAAA6B,QAAA;IACHN,IAAI,EAAC,QAAQ;IACbF,KAAK,EAAEpB,KAAK,CAACQ,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;IAC9BK,IAAI,EAAE;EAAG,GACLW,SAAS,CAChB,CACY,CAAC;AAElB,CAAC;AAED,SAASJ,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SafeAreaView","styled","StyledSafeAreaView","base","flex","variants","backgroundColor","color","
|
|
1
|
+
{"version":3,"names":["SafeAreaView","styled","isValidColor","StyledSafeAreaView","base","flex","variants","backgroundColor","color","Error"],"sources":["index.jsx"],"sourcesContent":["import { SafeAreaView } from 'react-native'\r\nimport { styled } from '../styled'\r\nimport { isValidColor } from '../utils'\r\n\r\nconst StyledSafeAreaView = styled(SafeAreaView, {\r\n base: {\r\n flex: 1\r\n },\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledSafeAreaView }\r\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,UAAU;AAEvC,MAAMC,kBAAkB,GAAGF,MAAM,CAACD,YAAY,EAAE;EAC9CI,IAAI,EAAE;IACJC,IAAI,EAAE;EACR,CAAC;EACDC,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAACN,YAAY,CAACM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEF,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC;AAEF,SAASL,kBAAkB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScrollView","styled","StyledScrollView","variants","backgroundColor","color","
|
|
1
|
+
{"version":3,"names":["ScrollView","styled","isValidColor","StyledScrollView","variants","backgroundColor","color","Error"],"sources":["index.jsx"],"sourcesContent":["import { ScrollView } from 'react-native'\r\nimport { styled } from '../styled'\r\nimport { isValidColor } from '../utils'\r\n\r\nconst StyledScrollView = styled(ScrollView, {\r\n variants: {\r\n backgroundColor: color => {\r\n if (!color) return\r\n if (!isValidColor(color)) {\r\n throw new Error('Invalid backgroundColor value')\r\n }\r\n return { backgroundColor: color }\r\n }\r\n }\r\n})\r\n\r\nexport { StyledScrollView }\r\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,UAAU;AAEvC,MAAMC,gBAAgB,GAAGF,MAAM,CAACD,UAAU,EAAE;EAC1CI,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAACJ,YAAY,CAACI,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEF,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC;AAEF,SAASH,gBAAgB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@ import { styled } from '../styled'
|
|
|
3
3
|
import { TouchableOpacity } from 'react-native'
|
|
4
4
|
import Icon from 'react-native-vector-icons/MaterialIcons'
|
|
5
5
|
import { theme } from '../theme'
|
|
6
|
-
import { isValidColor, isValidNumber, isValidString } from '../utils'
|
|
7
6
|
|
|
8
7
|
const RadioButton = styled(TouchableOpacity, {
|
|
9
8
|
base: {
|
|
@@ -17,14 +16,12 @@ const RadioButton = styled(TouchableOpacity, {
|
|
|
17
16
|
flexDirection: 'column'
|
|
18
17
|
},
|
|
19
18
|
variants: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return { height: size }
|
|
27
|
-
},
|
|
19
|
+
height: size => ({
|
|
20
|
+
height: size || 24
|
|
21
|
+
}),
|
|
22
|
+
width: size => ({
|
|
23
|
+
width: size || 24
|
|
24
|
+
}),
|
|
28
25
|
disabled: {
|
|
29
26
|
true: {
|
|
30
27
|
backgroundColor: theme.colors.gray[500]
|
|
@@ -46,25 +43,21 @@ const RadioButton = styled(TouchableOpacity, {
|
|
|
46
43
|
})
|
|
47
44
|
|
|
48
45
|
const StyledRadioButton = ({
|
|
46
|
+
name= "",
|
|
49
47
|
onPress,
|
|
50
48
|
disabled = false,
|
|
49
|
+
selected,
|
|
51
50
|
checkedColor,
|
|
52
51
|
iconProps,
|
|
53
52
|
...rest
|
|
54
53
|
}) => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const toggleCheckbox = () => {
|
|
58
|
-
setChecked(!checked)
|
|
59
|
-
onPress && onPress(!checked)
|
|
60
|
-
}
|
|
61
|
-
|
|
54
|
+
const checked = selected === name
|
|
62
55
|
return (
|
|
63
56
|
<RadioButton
|
|
64
57
|
disabled={disabled}
|
|
65
58
|
checked={checked}
|
|
66
59
|
checkedColor={checked && checkedColor && checkedColor}
|
|
67
|
-
onPress={() =>
|
|
60
|
+
onPress={() => onPress && onPress(name)}
|
|
68
61
|
{...rest}
|
|
69
62
|
>
|
|
70
63
|
{checked &&
|