@dropi/react-native-design-system 0.3.10 → 0.3.12
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/molecules/InputField/Input.d.ts +28 -6
- package/lib/molecules/InputField/Input.js +6 -6
- package/lib/molecules/InputField/NumberInput.d.ts +19 -0
- package/lib/molecules/InputField/NumberInput.js +88 -0
- package/lib/molecules/InputField/TextInput.d.ts +15 -0
- package/lib/molecules/InputField/TextInput.js +49 -0
- package/lib/molecules/InputField/index.d.ts +2 -0
- package/lib/molecules/InputField/index.js +22 -0
- package/lib/molecules/RadioButtons/TitleDescription/TitleDescription.d.ts +1 -1
- package/lib/molecules/RadioButtons/TitleDescription/TitleDescription.js +50 -41
- package/lib/molecules/Select/Select.d.ts +2 -0
- package/lib/molecules/Select/Select.js +48 -34
- package/package.json +1 -1
|
@@ -2,25 +2,47 @@ type InputType = "text" | "number" | "email" | "password";
|
|
|
2
2
|
type InputFactoryProps = {
|
|
3
3
|
type: InputType;
|
|
4
4
|
};
|
|
5
|
-
export declare const Input: ({ type, ...props }: InputFactoryProps) =>
|
|
6
|
-
type?: import("react-native").KeyboardTypeOptions;
|
|
5
|
+
export declare const Input: ({ type, ...props }: InputFactoryProps) => (({ preIcon, helper, tooltip, value, onChange, hasError, errorMessage, readOnly, }: {
|
|
7
6
|
preIcon?: import("dropi-lib-icons").IconName;
|
|
7
|
+
helper?: string;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
readOnly: boolean;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element) | import("react").ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
15
|
+
preIcon?: import("dropi-lib-icons").IconName;
|
|
16
|
+
helper?: string;
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
value: string;
|
|
19
|
+
onChangeFunction: (value: string) => void;
|
|
20
|
+
hasError: boolean;
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
} & import("react").RefAttributes<import("react-native").TextInput>> | (({ label, preIcon, helper, tooltip, placeholder, value, onChange, hasError, errorMessage, readOnly, }: {
|
|
8
23
|
label?: string;
|
|
24
|
+
preIcon?: import("dropi-lib-icons").IconName;
|
|
9
25
|
helper?: string;
|
|
10
|
-
placeholder?: string;
|
|
11
26
|
tooltip?: string;
|
|
27
|
+
placeholder?: string;
|
|
12
28
|
value: string;
|
|
29
|
+
onChange: (value: string) => void;
|
|
13
30
|
hasError: boolean;
|
|
14
31
|
errorMessage?: string;
|
|
15
|
-
|
|
16
|
-
}
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
}) => import("react/jsx-runtime").JSX.Element) | (({ label, preIcon, helper, tooltip, placeholder, value, onChange, hasError, errorMessage, readOnly, allowDecimals, minValue, maxValue, }: {
|
|
34
|
+
label?: string;
|
|
17
35
|
preIcon?: import("dropi-lib-icons").IconName;
|
|
18
36
|
helper?: string;
|
|
19
37
|
tooltip?: string;
|
|
38
|
+
placeholder?: string;
|
|
20
39
|
value: string;
|
|
21
40
|
onChange: (value: string) => void;
|
|
22
41
|
hasError: boolean;
|
|
23
42
|
errorMessage?: string;
|
|
24
|
-
readOnly
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
allowDecimals?: boolean;
|
|
45
|
+
minValue?: number;
|
|
46
|
+
maxValue?: number;
|
|
25
47
|
}) => import("react/jsx-runtime").JSX.Element);
|
|
26
48
|
export {};
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Input = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _TextInput = require("./TextInput");
|
|
8
|
+
var _NumberInput = require("./NumberInput");
|
|
8
9
|
var _EmailInput = require("./EmailInput");
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var _PasswordInput = require("./PasswordInput");
|
|
11
11
|
const InputComponents = {
|
|
12
|
-
text:
|
|
13
|
-
number:
|
|
12
|
+
text: _TextInput.TextInput,
|
|
13
|
+
number: _NumberInput.NumberInput,
|
|
14
14
|
email: _EmailInput.EmailInput,
|
|
15
|
-
password:
|
|
15
|
+
password: _PasswordInput.PasswordInput
|
|
16
16
|
};
|
|
17
17
|
const Input = ({
|
|
18
18
|
type,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IconName } from "dropi-lib-icons";
|
|
2
|
+
type NumberInputProps = {
|
|
3
|
+
label?: string;
|
|
4
|
+
preIcon?: IconName;
|
|
5
|
+
helper?: string;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
hasError: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
allowDecimals?: boolean;
|
|
14
|
+
minValue?: number;
|
|
15
|
+
maxValue?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const validateNumber: (value: string, allowDecimals?: boolean, minValue?: number, maxValue?: number) => boolean;
|
|
18
|
+
export declare const NumberInput: ({ label, preIcon, helper, tooltip, placeholder, value, onChange, hasError, errorMessage, readOnly, allowDecimals, minValue, maxValue, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateNumber = exports.NumberInput = void 0;
|
|
7
|
+
var _BaseInput = require("./BaseInput");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const validateNumber = (value, allowDecimals = true, minValue, maxValue) => {
|
|
11
|
+
if (value === "" || value === "-") return true;
|
|
12
|
+
const numberRegex = allowDecimals ? /^-?\d+\.?\d*$/ : /^-?\d+$/;
|
|
13
|
+
if (!numberRegex.test(value)) return false;
|
|
14
|
+
const numValue = parseFloat(value);
|
|
15
|
+
if (minValue !== undefined && numValue < minValue) return false;
|
|
16
|
+
if (maxValue !== undefined && numValue > maxValue) return false;
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
exports.validateNumber = validateNumber;
|
|
20
|
+
const NumberInput = ({
|
|
21
|
+
label,
|
|
22
|
+
preIcon,
|
|
23
|
+
helper,
|
|
24
|
+
tooltip,
|
|
25
|
+
placeholder,
|
|
26
|
+
value,
|
|
27
|
+
onChange,
|
|
28
|
+
hasError,
|
|
29
|
+
errorMessage,
|
|
30
|
+
readOnly = false,
|
|
31
|
+
allowDecimals = true,
|
|
32
|
+
minValue,
|
|
33
|
+
maxValue
|
|
34
|
+
}) => {
|
|
35
|
+
const [focus, setFocus] = (0, _react.useState)(false);
|
|
36
|
+
const [invalidNumber, setInvalidNumber] = (0, _react.useState)(false);
|
|
37
|
+
const [wasVisited, setWasVisited] = (0, _react.useState)(false);
|
|
38
|
+
const onFocus = () => {
|
|
39
|
+
setFocus(true);
|
|
40
|
+
};
|
|
41
|
+
const onBlur = () => {
|
|
42
|
+
setFocus(false);
|
|
43
|
+
if (!wasVisited) {
|
|
44
|
+
setWasVisited(true);
|
|
45
|
+
if (value && !validateNumber(value, allowDecimals, minValue, maxValue)) {
|
|
46
|
+
setInvalidNumber(true);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getErrorMessage = () => {
|
|
51
|
+
if (hasError) {
|
|
52
|
+
return errorMessage;
|
|
53
|
+
}
|
|
54
|
+
if (invalidNumber) {
|
|
55
|
+
if (!allowDecimals) {
|
|
56
|
+
return "Ingresa un número entero válido";
|
|
57
|
+
}
|
|
58
|
+
return "Ingresa un número válido";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseInput.BaseInput, {
|
|
62
|
+
type: "decimal-pad",
|
|
63
|
+
label: label,
|
|
64
|
+
placeholder: placeholder || "Ingresa un número",
|
|
65
|
+
value: value,
|
|
66
|
+
preIcon: preIcon,
|
|
67
|
+
helper: helper,
|
|
68
|
+
tooltip: tooltip,
|
|
69
|
+
onChangeText: text => {
|
|
70
|
+
onChange(text);
|
|
71
|
+
if (wasVisited) {
|
|
72
|
+
if (text === "" || validateNumber(text, allowDecimals, minValue, maxValue)) {
|
|
73
|
+
setInvalidNumber(false);
|
|
74
|
+
} else {
|
|
75
|
+
setInvalidNumber(true);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
hasError: hasError || invalidNumber,
|
|
80
|
+
errorMessage: getErrorMessage(),
|
|
81
|
+
autoCorrect: false,
|
|
82
|
+
readOnly: readOnly,
|
|
83
|
+
onBlur: onBlur,
|
|
84
|
+
onFocus: onFocus,
|
|
85
|
+
isFocus: focus
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
exports.NumberInput = NumberInput;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconName } from "dropi-lib-icons";
|
|
2
|
+
type TextInputProps = {
|
|
3
|
+
label?: string;
|
|
4
|
+
preIcon?: IconName;
|
|
5
|
+
helper?: string;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
hasError: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const TextInput: ({ label, preIcon, helper, tooltip, placeholder, value, onChange, hasError, errorMessage, readOnly, }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TextInput = void 0;
|
|
7
|
+
var _BaseInput = require("./BaseInput");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const TextInput = ({
|
|
11
|
+
label,
|
|
12
|
+
preIcon,
|
|
13
|
+
helper,
|
|
14
|
+
tooltip,
|
|
15
|
+
placeholder,
|
|
16
|
+
value,
|
|
17
|
+
onChange,
|
|
18
|
+
hasError,
|
|
19
|
+
errorMessage,
|
|
20
|
+
readOnly = false
|
|
21
|
+
}) => {
|
|
22
|
+
const [focus, setFocus] = (0, _react.useState)(false);
|
|
23
|
+
const onFocus = () => {
|
|
24
|
+
setFocus(true);
|
|
25
|
+
};
|
|
26
|
+
const onBlur = () => {
|
|
27
|
+
setFocus(false);
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseInput.BaseInput, {
|
|
30
|
+
type: "default",
|
|
31
|
+
label: label,
|
|
32
|
+
placeholder: placeholder || "Ingresa texto",
|
|
33
|
+
value: value,
|
|
34
|
+
preIcon: preIcon,
|
|
35
|
+
helper: helper,
|
|
36
|
+
tooltip: tooltip,
|
|
37
|
+
onChangeText: text => {
|
|
38
|
+
onChange(text);
|
|
39
|
+
},
|
|
40
|
+
hasError: hasError,
|
|
41
|
+
errorMessage: errorMessage,
|
|
42
|
+
autoCorrect: false,
|
|
43
|
+
readOnly: readOnly,
|
|
44
|
+
onBlur: onBlur,
|
|
45
|
+
onFocus: onFocus,
|
|
46
|
+
isFocus: focus
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.TextInput = TextInput;
|
|
@@ -35,4 +35,26 @@ Object.keys(_BaseInput).forEach(function (key) {
|
|
|
35
35
|
return _BaseInput[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
});
|
|
39
|
+
var _TextInput = require("./TextInput");
|
|
40
|
+
Object.keys(_TextInput).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _TextInput[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _TextInput[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _NumberInput = require("./NumberInput");
|
|
51
|
+
Object.keys(_NumberInput).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _NumberInput[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _NumberInput[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
38
60
|
});
|
|
@@ -34,63 +34,72 @@ const TitleDescription = ({
|
|
|
34
34
|
}],
|
|
35
35
|
disabled: isActive || isDisabled,
|
|
36
36
|
...rest,
|
|
37
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
38
|
+
style: {
|
|
39
|
+
flexDirection: "row",
|
|
40
|
+
alignItems: "center"
|
|
41
|
+
},
|
|
42
|
+
children: [imageSource && /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
43
|
+
style: styles.image,
|
|
44
|
+
source: imageSource,
|
|
45
|
+
contentFit: "contain"
|
|
46
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
47
|
+
style: styles.textContainer,
|
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
49
|
+
type: "m-regular",
|
|
50
|
+
style: styles.titleText,
|
|
51
|
+
children: title
|
|
52
|
+
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
53
|
+
type: "s-regular",
|
|
54
|
+
style: styles.optionText,
|
|
55
|
+
children: label
|
|
56
|
+
})]
|
|
52
57
|
})]
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(OptionSelector, {
|
|
59
|
+
isActive: isActive
|
|
53
60
|
})]
|
|
54
61
|
});
|
|
55
62
|
};
|
|
56
63
|
exports.TitleDescription = TitleDescription;
|
|
57
64
|
const styles = _reactNative.StyleSheet.create({
|
|
58
65
|
option: {
|
|
59
|
-
padding: _constants.spacing[
|
|
60
|
-
borderRadius: _constants.radius[
|
|
66
|
+
padding: _constants.spacing["size-4"],
|
|
67
|
+
borderRadius: _constants.radius["border-2"],
|
|
61
68
|
borderWidth: 1,
|
|
62
|
-
borderColor: _constants.colors[
|
|
63
|
-
marginBottom: _constants.spacing[
|
|
64
|
-
flexDirection:
|
|
65
|
-
alignItems:
|
|
69
|
+
borderColor: _constants.colors["Gray-200"].light,
|
|
70
|
+
marginBottom: _constants.spacing["size-5"],
|
|
71
|
+
flexDirection: "row",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
justifyContent: "space-between"
|
|
66
74
|
},
|
|
67
75
|
selectedOption: {
|
|
68
|
-
padding: _constants.spacing[
|
|
69
|
-
borderRadius: _constants.radius[
|
|
76
|
+
padding: _constants.spacing["size-4"],
|
|
77
|
+
borderRadius: _constants.radius["border-2"],
|
|
70
78
|
borderWidth: 1,
|
|
71
79
|
borderColor: _constants.colors["Primary-500"].light,
|
|
72
|
-
marginBottom: _constants.spacing[
|
|
73
|
-
flexDirection:
|
|
74
|
-
alignItems:
|
|
75
|
-
backgroundColor: _constants.colors[
|
|
80
|
+
marginBottom: _constants.spacing["size-5"],
|
|
81
|
+
flexDirection: "row",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
backgroundColor: _constants.colors["Primary-50"].light,
|
|
84
|
+
justifyContent: "space-between"
|
|
76
85
|
},
|
|
77
86
|
optionSelector: {
|
|
78
87
|
width: !_utils.isTablet ? 20 : 20 * 1.5,
|
|
79
88
|
height: !_utils.isTablet ? 20 : 20 * 1.5,
|
|
80
89
|
borderRadius: _constants.radius.circle,
|
|
81
|
-
marginRight: _constants.spacing[
|
|
90
|
+
marginRight: _constants.spacing["size-3"],
|
|
82
91
|
borderWidth: 2,
|
|
83
|
-
borderColor: _constants.colors[
|
|
92
|
+
borderColor: _constants.colors["Gray-200"].light
|
|
84
93
|
},
|
|
85
94
|
selectedOptionSelector: {
|
|
86
95
|
width: !_utils.isTablet ? 20 : 20 * 1.5,
|
|
87
96
|
height: !_utils.isTablet ? 20 : 20 * 1.5,
|
|
88
97
|
borderRadius: _constants.radius.circle,
|
|
89
|
-
marginRight: _constants.spacing[
|
|
98
|
+
marginRight: _constants.spacing["size-3"],
|
|
90
99
|
borderWidth: 2,
|
|
91
100
|
borderColor: _constants.colors["Primary-500"].light,
|
|
92
|
-
justifyContent:
|
|
93
|
-
alignItems:
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
alignItems: "center"
|
|
94
103
|
},
|
|
95
104
|
innerSelector: {
|
|
96
105
|
width: !_utils.isTablet ? 12 : 12 * 1.5,
|
|
@@ -98,19 +107,19 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
98
107
|
borderRadius: _constants.radius.circle,
|
|
99
108
|
backgroundColor: _constants.colors["Primary-500"].light
|
|
100
109
|
},
|
|
101
|
-
image: {
|
|
102
|
-
width: !_utils.isTablet ? 32 : 32 * 1.5,
|
|
103
|
-
height: !_utils.isTablet ? 32 : 32 * 1.5,
|
|
104
|
-
marginRight: _constants.spacing['size-3'],
|
|
105
|
-
borderRadius: _constants.radius.circle
|
|
106
|
-
},
|
|
107
110
|
textContainer: {
|
|
108
|
-
flexDirection:
|
|
111
|
+
flexDirection: "column"
|
|
109
112
|
},
|
|
110
113
|
titleText: {
|
|
111
|
-
color: _constants.colors[
|
|
114
|
+
color: _constants.colors["Gray-700"].light
|
|
112
115
|
},
|
|
113
116
|
optionText: {
|
|
114
|
-
color: _constants.colors[
|
|
117
|
+
color: _constants.colors["Gray-600"].light
|
|
118
|
+
},
|
|
119
|
+
image: {
|
|
120
|
+
width: !_utils.isTablet ? 32 : 32 * 1.5,
|
|
121
|
+
height: !_utils.isTablet ? 32 : 32 * 1.5,
|
|
122
|
+
marginRight: _constants.spacing["size-3"],
|
|
123
|
+
borderRadius: _constants.radius.circle
|
|
115
124
|
}
|
|
116
125
|
});
|
|
@@ -7,10 +7,11 @@ exports.Select = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNative2 = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
10
|
-
var _atoms = require("../../atoms");
|
|
11
10
|
var _BottomSheet = require("../BottomSheet");
|
|
12
|
-
var
|
|
11
|
+
var _atoms = require("../../atoms");
|
|
12
|
+
var _constants = require("../../constants");
|
|
13
13
|
var _RadioButtons = require("../RadioButtons");
|
|
14
|
+
var _expoImage = require("expo-image");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
const Select = ({
|
|
@@ -18,7 +19,7 @@ const Select = ({
|
|
|
18
19
|
value = null,
|
|
19
20
|
onChange,
|
|
20
21
|
label,
|
|
21
|
-
placeholder =
|
|
22
|
+
placeholder = "Seleccionar",
|
|
22
23
|
helper,
|
|
23
24
|
hasError = false,
|
|
24
25
|
errorMessage,
|
|
@@ -31,9 +32,9 @@ const Select = ({
|
|
|
31
32
|
const [draftSelection, setDraftSelection] = (0, _react.useState)(null);
|
|
32
33
|
const currentValue = value;
|
|
33
34
|
const getBorderColor = () => {
|
|
34
|
-
if (hasError) return _constants.colors[
|
|
35
|
-
if (isFocus) return _constants.colors[
|
|
36
|
-
return _constants.colors[
|
|
35
|
+
if (hasError) return _constants.colors["Error-500"].light;
|
|
36
|
+
if (isFocus) return _constants.colors["Info-500"].light;
|
|
37
|
+
return _constants.colors["Gray-200"].light;
|
|
37
38
|
};
|
|
38
39
|
const hasChanges = (0, _react.useMemo)(() => {
|
|
39
40
|
if (!draftSelection) return false;
|
|
@@ -73,7 +74,9 @@ const Select = ({
|
|
|
73
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtons.TitleDescription, {
|
|
74
75
|
title: item.label,
|
|
75
76
|
isActive: isSelected,
|
|
76
|
-
onPress: () => handleDraftSelect(item)
|
|
77
|
+
onPress: () => handleDraftSelect(item),
|
|
78
|
+
imageSource: item.image,
|
|
79
|
+
label: item.message
|
|
77
80
|
});
|
|
78
81
|
}, [draftSelection, handleDraftSelect]);
|
|
79
82
|
const footer = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
@@ -98,7 +101,7 @@ const Select = ({
|
|
|
98
101
|
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
99
102
|
type: "m-regular",
|
|
100
103
|
style: {
|
|
101
|
-
color: _constants.colors[
|
|
104
|
+
color: _constants.colors["Gray-600"].light
|
|
102
105
|
},
|
|
103
106
|
children: label
|
|
104
107
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
@@ -107,10 +110,14 @@ const Select = ({
|
|
|
107
110
|
}, disabled && styles.disabled],
|
|
108
111
|
onPress: handleOpen,
|
|
109
112
|
activeOpacity: 0.7,
|
|
110
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
113
|
+
children: [currentValue?.image && /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
114
|
+
style: styles.image,
|
|
115
|
+
source: currentValue.image,
|
|
116
|
+
contentFit: "contain"
|
|
117
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
111
118
|
type: "m-regular",
|
|
112
119
|
style: {
|
|
113
|
-
color: currentValue ? _constants.colors[
|
|
120
|
+
color: currentValue ? _constants.colors["Gray-600"].light : _constants.colors["Gray-400"].light,
|
|
114
121
|
flex: 1
|
|
115
122
|
},
|
|
116
123
|
numberOfLines: 1,
|
|
@@ -119,16 +126,16 @@ const Select = ({
|
|
|
119
126
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
120
127
|
name: "dropdown-down",
|
|
121
128
|
size: _constants.sizes.xl,
|
|
122
|
-
color: _constants.colors[
|
|
129
|
+
color: _constants.colors["Gray-400"].light
|
|
123
130
|
})]
|
|
124
131
|
}), helper && !hasError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
125
132
|
style: {
|
|
126
|
-
marginTop: _constants.spacing[
|
|
133
|
+
marginTop: _constants.spacing["size-2"]
|
|
127
134
|
},
|
|
128
135
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
129
136
|
type: "s-regular",
|
|
130
137
|
style: {
|
|
131
|
-
color: _constants.colors[
|
|
138
|
+
color: _constants.colors["Gray-600"].light
|
|
132
139
|
},
|
|
133
140
|
children: helper
|
|
134
141
|
})
|
|
@@ -139,7 +146,7 @@ const Select = ({
|
|
|
139
146
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
140
147
|
name: "warning-circle",
|
|
141
148
|
size: _constants.sizes.s,
|
|
142
|
-
color: _constants.colors[
|
|
149
|
+
color: _constants.colors["Error-500"].light
|
|
143
150
|
})
|
|
144
151
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
145
152
|
type: "s-regular",
|
|
@@ -148,8 +155,8 @@ const Select = ({
|
|
|
148
155
|
})]
|
|
149
156
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomSheet.BottomSheetComponent, {
|
|
150
157
|
ref: bottomSheetRef,
|
|
151
|
-
title: title ?? label ??
|
|
152
|
-
snapPoints: [
|
|
158
|
+
title: title ?? label ?? "Seleccionar",
|
|
159
|
+
snapPoints: ["90%"],
|
|
153
160
|
onDismiss: handleDismiss,
|
|
154
161
|
footer: footer,
|
|
155
162
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
@@ -165,41 +172,48 @@ const Select = ({
|
|
|
165
172
|
exports.Select = Select;
|
|
166
173
|
const styles = _reactNative.StyleSheet.create({
|
|
167
174
|
fieldContainer: {
|
|
168
|
-
marginBottom: _constants.spacing[
|
|
169
|
-
width:
|
|
175
|
+
marginBottom: _constants.spacing["size-4"],
|
|
176
|
+
width: "100%"
|
|
170
177
|
},
|
|
171
178
|
selectButton: {
|
|
172
|
-
width:
|
|
173
|
-
borderRadius: _constants.radius[
|
|
179
|
+
width: "100%",
|
|
180
|
+
borderRadius: _constants.radius["border-2"],
|
|
174
181
|
borderWidth: 1,
|
|
175
|
-
flexDirection:
|
|
176
|
-
alignItems:
|
|
177
|
-
justifyContent:
|
|
178
|
-
marginTop: _constants.spacing[
|
|
182
|
+
flexDirection: "row",
|
|
183
|
+
alignItems: "center",
|
|
184
|
+
justifyContent: "space-between",
|
|
185
|
+
marginTop: _constants.spacing["size-2"],
|
|
179
186
|
height: 48,
|
|
180
|
-
paddingHorizontal: _constants.spacing[
|
|
187
|
+
paddingHorizontal: _constants.spacing["size-3"]
|
|
181
188
|
},
|
|
182
189
|
disabled: {
|
|
183
190
|
opacity: 0.5
|
|
184
191
|
},
|
|
185
192
|
errorContainer: {
|
|
186
|
-
marginTop: _constants.spacing[
|
|
187
|
-
flexDirection:
|
|
188
|
-
width:
|
|
193
|
+
marginTop: _constants.spacing["size-2"],
|
|
194
|
+
flexDirection: "row",
|
|
195
|
+
width: "100%"
|
|
189
196
|
},
|
|
190
197
|
errorIcon: {
|
|
191
|
-
alignItems:
|
|
192
|
-
paddingTop: _constants.spacing[
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
paddingTop: _constants.spacing["size-1"]
|
|
193
200
|
},
|
|
194
201
|
errorText: {
|
|
195
|
-
color: _constants.colors[
|
|
196
|
-
marginLeft: _constants.spacing[
|
|
202
|
+
color: _constants.colors["Error-500"].light,
|
|
203
|
+
marginLeft: _constants.spacing["size-1"],
|
|
197
204
|
flex: 1
|
|
198
205
|
},
|
|
199
206
|
optionsList: {
|
|
200
|
-
paddingHorizontal: _constants.spacing[
|
|
207
|
+
paddingHorizontal: _constants.spacing["size-5"],
|
|
208
|
+
paddingBottom: _constants.spacing["size-8"]
|
|
201
209
|
},
|
|
202
210
|
footerSecondaryButton: {
|
|
203
|
-
marginTop: _constants.spacing[
|
|
211
|
+
marginTop: _constants.spacing["size-4"]
|
|
212
|
+
},
|
|
213
|
+
image: {
|
|
214
|
+
width: _constants.sizes.l,
|
|
215
|
+
height: _constants.sizes.l,
|
|
216
|
+
marginRight: _constants.spacing["size-3"],
|
|
217
|
+
borderRadius: _constants.radius.circle
|
|
204
218
|
}
|
|
205
219
|
});
|