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.
@@ -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
- width: size => {
30
- if (!size) return;
31
- return {
32
- width: size
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 [checked, setChecked] = (0, _react.useState)(false);
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: () => toggleCheckbox()
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","_utils","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","onPress","iconProps","rest","setChecked","useState","toggleCheckbox","createElement","name","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\nimport { isValidColor, isValidNumber, isValidString } from '../utils'\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 width: size => {\r\n if (!size) return\r\n return { width: size }\r\n },\r\n height: size => {\r\n if (!size) return\r\n return { height: size }\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\tonPress,\r\n\tdisabled = false,\r\n\tcheckedColor,\r\n\ticonProps,\r\n\t...rest\r\n}) => {\r\n const [checked, setChecked] = useState(false)\r\n\r\n const toggleCheckbox = () => {\r\n setChecked(!checked)\r\n onPress && onPress(!checked)\r\n }\r\n\r\n return (\r\n <RadioButton\r\n disabled={disabled}\r\n checked={checked}\r\n checkedColor={checked && checkedColor && checkedColor}\r\n onPress={() => toggleCheckbox()}\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;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAqE,SAAAI,uBAAAG,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,SAAAR,wBAAAQ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MC,cAAc,GAAGA,CAAA,KAAM;IAC3BF,UAAU,CAAC,CAACP,OAAO,CAAC;IACpBI,OAAO,IAAIA,OAAO,CAAC,CAACJ,OAAO,CAAC;EAC9B,CAAC;EAED,oBACEvD,MAAA,CAAAW,OAAA,CAAAsD,aAAA,CAAC9B,WAAW,EAAAN,QAAA;IACVuB,QAAQ,EAAEA,QAAS;IACnBG,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAED,OAAO,IAAIC,YAAY,IAAIA,YAAa;IACtDG,OAAO,EAAEA,CAAA,KAAMK,cAAc,CAAC;EAAE,GAC5BH,IAAI,GAEPN,OAAO,iBACRvD,MAAA,CAAAW,OAAA,CAAAsD,aAAA,CAAC5D,cAAA,CAAAM,OAAI,EAAAkB,QAAA;IACHqC,IAAI,EAAC,QAAQ;IACbT,KAAK,EAAEb,YAAK,CAACC,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;IAC9BK,IAAI,EAAE;EAAG,GACLS,SAAS,CAChB,CACY,CAAC;AAElB,CAAC;AAAAO,OAAA,CAAAT,iBAAA,GAAAA,iBAAA","ignoreList":[]}
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,YAA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GAAGM,QAAQ,KAAKF,IAAI;EACjC,oBACE1D,MAAA,CAAAU,OAAA,CAAAqD,aAAA,CAAC7B,WAAW,EAAAN,QAAA;IACVuB,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,iBACRtD,MAAA,CAAAU,OAAA,CAAAqD,aAAA,CAAC1D,cAAA,CAAAK,OAAI,EAAAkB,QAAA;IACH8B,IAAI,EAAC,QAAQ;IACbF,KAAK,EAAEb,YAAK,CAACC,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;IAC9BK,IAAI,EAAE;EAAG,GACLW,SAAS,CAChB,CACY,CAAC;AAElB,CAAC;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,MAAME,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,CAACC,YAAY,CAACD,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":[]}
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,MAAME,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,CAACC,YAAY,CAACD,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":[]}
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
- width: size => {
21
- if (!size) return;
22
- return {
23
- width: size
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 [checked, setChecked] = useState(false);
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: () => toggleCheckbox()
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","isValidColor","isValidNumber","isValidString","RadioButton","base","width","height","borderWidth","borderRadius","borderColor","colors","gray","justifyContent","alignItems","flexDirection","variants","size","disabled","true","backgroundColor","checked","checkedColor","color","StyledRadioButton","onPress","iconProps","rest","setChecked","toggleCheckbox","createElement","_extends","name"],"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\nimport { isValidColor, isValidNumber, isValidString } from '../utils'\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 width: size => {\r\n if (!size) return\r\n return { width: size }\r\n },\r\n height: size => {\r\n if (!size) return\r\n return { height: size }\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\tonPress,\r\n\tdisabled = false,\r\n\tcheckedColor,\r\n\ticonProps,\r\n\t...rest\r\n}) => {\r\n const [checked, setChecked] = useState(false)\r\n\r\n const toggleCheckbox = () => {\r\n setChecked(!checked)\r\n onPress && onPress(!checked)\r\n }\r\n\r\n return (\r\n <RadioButton\r\n disabled={disabled}\r\n checked={checked}\r\n checkedColor={checked && checkedColor && checkedColor}\r\n onPress={() => toggleCheckbox()}\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;AAChC,SAASC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AAc,GAAGA,CAAA,KAAM;IAC3BD,UAAU,CAAC,CAACP,OAAO,CAAC;IACpBI,OAAO,IAAIA,OAAO,CAAC,CAACJ,OAAO,CAAC;EAC9B,CAAC;EAED,oBACE1B,KAAA,CAAAmC,aAAA,CAAC1B,WAAW,EAAA2B,QAAA;IACVb,QAAQ,EAAEA,QAAS;IACnBG,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAED,OAAO,IAAIC,YAAY,IAAIA,YAAa;IACtDG,OAAO,EAAEA,CAAA,KAAMI,cAAc,CAAC;EAAE,GAC5BF,IAAI,GAEPN,OAAO,iBACR1B,KAAA,CAAAmC,aAAA,CAAC/B,IAAI,EAAAgC,QAAA;IACHC,IAAI,EAAC,QAAQ;IACbT,KAAK,EAAEvB,KAAK,CAACW,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;IAC9BK,IAAI,EAAE;EAAG,GACLS,SAAS,CAChB,CACY,CAAC;AAElB,CAAC;AAED,SAASF,iBAAiB","ignoreList":[]}
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;MACd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../styled';
3
+ import { isValidColor } from '../utils';
3
4
  const StyledSafeAreaView = styled(SafeAreaView, {
4
5
  base: {
5
6
  flex: 1
@@ -1 +1 @@
1
- {"version":3,"names":["SafeAreaView","styled","StyledSafeAreaView","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,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,kBAAkB,GAAGD,MAAM,CAACD,YAAY,EAAE;EAC9CG,IAAI,EAAE;IACJC,IAAI,EAAE;EACR,CAAC;EACDC,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAACC,YAAY,CAACD,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIE,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEH,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC;AAEF,SAASL,kBAAkB","ignoreList":[]}
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,5 +1,6 @@
1
1
  import { ScrollView } from 'react-native';
2
2
  import { styled } from '../styled';
3
+ import { isValidColor } from '../utils';
3
4
  const StyledScrollView = styled(ScrollView, {
4
5
  variants: {
5
6
  backgroundColor: color => {
@@ -1 +1 @@
1
- {"version":3,"names":["ScrollView","styled","StyledScrollView","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,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,gBAAgB,GAAGD,MAAM,CAACD,UAAU,EAAE;EAC1CG,QAAQ,EAAE;IACRC,eAAe,EAAEC,KAAK,IAAI;MACxB,IAAI,CAACA,KAAK,EAAE;MACZ,IAAI,CAACC,YAAY,CAACD,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIE,KAAK,CAAC,+BAA+B,CAAC;MAClD;MACA,OAAO;QAAEH,eAAe,EAAEC;MAAM,CAAC;IACnC;EACF;AACF,CAAC,CAAC;AAEF,SAASH,gBAAgB","ignoreList":[]}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluent-styles",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Develop different styled versions of UI components.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -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
- width: size => {
21
- if (!size) return
22
- return { width: size }
23
- },
24
- height: size => {
25
- if (!size) return
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 [checked, setChecked] = useState(false)
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={() => toggleCheckbox()}
60
+ onPress={() => onPress && onPress(name)}
68
61
  {...rest}
69
62
  >
70
63
  {checked &&
@@ -1,5 +1,6 @@
1
1
  import { SafeAreaView } from 'react-native'
2
2
  import { styled } from '../styled'
3
+ import { isValidColor } from '../utils'
3
4
 
4
5
  const StyledSafeAreaView = styled(SafeAreaView, {
5
6
  base: {
@@ -1,5 +1,6 @@
1
1
  import { ScrollView } from 'react-native'
2
2
  import { styled } from '../styled'
3
+ import { isValidColor } from '../utils'
3
4
 
4
5
  const StyledScrollView = styled(ScrollView, {
5
6
  variants: {