@dropi/react-native-design-system 0.2.11 → 0.2.13
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/BottomSheet/BottomSheet.d.ts +15 -0
- package/lib/molecules/BottomSheet/BottomSheet.js +106 -0
- package/lib/molecules/BottomSheet/index.d.ts +1 -0
- package/lib/molecules/BottomSheet/index.js +16 -0
- package/lib/molecules/InputField/BaseInput.d.ts +14 -0
- package/lib/molecules/InputField/BaseInput.js +67 -0
- package/lib/molecules/InputField/EmailInput.d.ts +14 -0
- package/lib/molecules/InputField/EmailInput.js +77 -0
- package/lib/molecules/InputField/Input.d.ts +26 -0
- package/lib/molecules/InputField/Input.js +23 -0
- package/lib/molecules/InputField/PasswordInput.d.ts +11 -0
- package/lib/molecules/InputField/PasswordInput.js +97 -0
- package/lib/molecules/InputField/index.d.ts +3 -0
- package/lib/molecules/InputField/index.js +38 -0
- package/lib/molecules/InputField/molecules/InputError.d.ts +5 -0
- package/lib/molecules/InputField/molecules/InputError.js +46 -0
- package/lib/molecules/InputField/molecules/InputHelper.d.ts +5 -0
- package/lib/molecules/InputField/molecules/InputHelper.js +25 -0
- package/lib/molecules/InputField/molecules/InputIcon.d.ts +7 -0
- package/lib/molecules/InputField/molecules/InputIcon.js +31 -0
- package/lib/molecules/InputField/molecules/InputLabel.d.ts +5 -0
- package/lib/molecules/InputField/molecules/InputLabel.js +19 -0
- package/lib/molecules/InputField/molecules/index.d.ts +4 -0
- package/lib/molecules/InputField/molecules/index.js +49 -0
- package/lib/molecules/InputField/styles.d.ts +27 -0
- package/lib/molecules/InputField/styles.js +34 -0
- package/lib/molecules/Select/Select.d.ts +18 -0
- package/lib/molecules/Select/Select.js +182 -0
- package/lib/molecules/Select/index.d.ts +1 -0
- package/lib/molecules/Select/index.js +16 -0
- package/lib/molecules/index.d.ts +10 -7
- package/lib/molecules/index.js +33 -0
- package/package.json +16 -10
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export type BottomSheetComponentRef = {
|
|
3
|
+
present: () => void;
|
|
4
|
+
close: () => void;
|
|
5
|
+
dismiss: () => void;
|
|
6
|
+
};
|
|
7
|
+
type BottomSheetComponentProps = {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
title?: string;
|
|
11
|
+
snapPoints?: string[];
|
|
12
|
+
onDismiss?: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const BottomSheetComponent: React.ForwardRefExoticComponent<BottomSheetComponentProps & React.RefAttributes<BottomSheetComponentRef>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BottomSheetComponent = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
var _Heading = require("../../atoms/Text/Heading");
|
|
12
|
+
var _TextButton = require("../../atoms/Buttons/TextButton");
|
|
13
|
+
var _spacing = require("../../constants/spacing");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
const BottomSheetComponent = exports.BottomSheetComponent = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
17
|
+
children,
|
|
18
|
+
footer,
|
|
19
|
+
title,
|
|
20
|
+
snapPoints,
|
|
21
|
+
onDismiss
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const bottomSheetModalRef = (0, _react.useRef)(null);
|
|
24
|
+
const memoizedSnapPoints = (0, _react.useMemo)(() => snapPoints ?? ['70%', '90%'], [snapPoints]);
|
|
25
|
+
const handlePresentModalPress = (0, _react.useCallback)(() => {
|
|
26
|
+
bottomSheetModalRef.current?.present();
|
|
27
|
+
}, []);
|
|
28
|
+
const handleCloseModalPress = (0, _react.useCallback)(() => {
|
|
29
|
+
bottomSheetModalRef.current?.close();
|
|
30
|
+
}, []);
|
|
31
|
+
const handleDismissModalPress = (0, _react.useCallback)(() => {
|
|
32
|
+
bottomSheetModalRef.current?.dismiss();
|
|
33
|
+
}, []);
|
|
34
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
35
|
+
present: handlePresentModalPress,
|
|
36
|
+
close: handleCloseModalPress,
|
|
37
|
+
dismiss: handleDismissModalPress
|
|
38
|
+
}));
|
|
39
|
+
const renderBackdrop = (0, _react.useCallback)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetBackdrop, {
|
|
40
|
+
...props,
|
|
41
|
+
appearsOnIndex: 0,
|
|
42
|
+
disappearsOnIndex: -1,
|
|
43
|
+
opacity: 0.5
|
|
44
|
+
}), []);
|
|
45
|
+
const renderFooter = (0, _react.useCallback)(props => footer ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetFooter, {
|
|
46
|
+
...props,
|
|
47
|
+
style: styles.footer,
|
|
48
|
+
children: footer
|
|
49
|
+
}) : null, [footer]);
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetModal, {
|
|
51
|
+
ref: bottomSheetModalRef,
|
|
52
|
+
snapPoints: memoizedSnapPoints,
|
|
53
|
+
backdropComponent: renderBackdrop,
|
|
54
|
+
enableDynamicSizing: false,
|
|
55
|
+
footerComponent: renderFooter,
|
|
56
|
+
onDismiss: onDismiss,
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetView, {
|
|
58
|
+
style: styles.contentContainer,
|
|
59
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
60
|
+
style: styles.innerContainer,
|
|
61
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
62
|
+
style: [styles.headerContainer, {
|
|
63
|
+
justifyContent: title ? 'space-between' : 'flex-end'
|
|
64
|
+
}],
|
|
65
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Heading.Heading, {
|
|
67
|
+
type: "h3",
|
|
68
|
+
style: {
|
|
69
|
+
color: 'black'
|
|
70
|
+
},
|
|
71
|
+
children: title
|
|
72
|
+
})
|
|
73
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextButton.TextButton, {
|
|
74
|
+
label: "",
|
|
75
|
+
size: "large",
|
|
76
|
+
variant: "secondary",
|
|
77
|
+
preIcon: 'close-large',
|
|
78
|
+
replaceColor: _constants.colors.Black.light,
|
|
79
|
+
onPress: () => bottomSheetModalRef.current?.dismiss()
|
|
80
|
+
})]
|
|
81
|
+
}), children]
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const styles = _reactNative.StyleSheet.create({
|
|
87
|
+
contentContainer: {
|
|
88
|
+
height: '100%',
|
|
89
|
+
paddingBottom: _spacing.spacing['size-10']
|
|
90
|
+
},
|
|
91
|
+
innerContainer: {
|
|
92
|
+
flex: 1
|
|
93
|
+
},
|
|
94
|
+
headerContainer: {
|
|
95
|
+
paddingHorizontal: _spacing.spacing['size-5'],
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
marginBottom: _spacing.spacing['size-4'],
|
|
99
|
+
marginTop: _spacing.spacing['size-2']
|
|
100
|
+
},
|
|
101
|
+
footer: {
|
|
102
|
+
backgroundColor: 'white',
|
|
103
|
+
padding: _spacing.spacing['size-4'],
|
|
104
|
+
paddingBottom: _spacing.spacing['size-10']
|
|
105
|
+
}
|
|
106
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BottomSheet';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _BottomSheet = require("./BottomSheet");
|
|
7
|
+
Object.keys(_BottomSheet).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _BottomSheet[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _BottomSheet[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextInput, KeyboardTypeOptions, TextInputProps } from "react-native";
|
|
2
|
+
import { IconName } from "dropi-lib-icons";
|
|
3
|
+
export declare const BaseInput: import("react").ForwardRefExoticComponent<TextInputProps & {
|
|
4
|
+
type?: KeyboardTypeOptions;
|
|
5
|
+
preIcon?: IconName;
|
|
6
|
+
label?: string;
|
|
7
|
+
helper?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
isFocus: boolean;
|
|
14
|
+
} & import("react").RefAttributes<TextInput>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BaseInput = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _molecules = require("./molecules");
|
|
9
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _constants = require("../../constants");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const BaseInput = exports.BaseInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
15
|
+
type = "default",
|
|
16
|
+
preIcon,
|
|
17
|
+
label,
|
|
18
|
+
helper,
|
|
19
|
+
placeholder,
|
|
20
|
+
tooltip,
|
|
21
|
+
value,
|
|
22
|
+
hasError,
|
|
23
|
+
errorMessage,
|
|
24
|
+
isFocus,
|
|
25
|
+
/** TextInput props */
|
|
26
|
+
...rest
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const getBorderColor = () => {
|
|
29
|
+
if (hasError) {
|
|
30
|
+
return _constants.colors["Error-500"].light;
|
|
31
|
+
}
|
|
32
|
+
if (isFocus) {
|
|
33
|
+
return _constants.colors["Info-500"].light;
|
|
34
|
+
}
|
|
35
|
+
return _constants.colors["Gray-200"].light;
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
38
|
+
style: _styles.default.fieldContainer,
|
|
39
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputLabel, {
|
|
40
|
+
text: label
|
|
41
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
42
|
+
style: [_styles.default.searchbarContainer, {
|
|
43
|
+
borderColor: getBorderColor()
|
|
44
|
+
}],
|
|
45
|
+
children: [preIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputIcon, {
|
|
46
|
+
icon: preIcon
|
|
47
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
48
|
+
style: [_styles.default.searchContainer, {
|
|
49
|
+
marginLeft: preIcon ? _constants.spacing["size-2"] : 0
|
|
50
|
+
}],
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
52
|
+
ref: ref,
|
|
53
|
+
style: _styles.default.usernameInput,
|
|
54
|
+
placeholder: placeholder,
|
|
55
|
+
placeholderTextColor: _constants.colors["Gray-500"].light,
|
|
56
|
+
value: value,
|
|
57
|
+
keyboardType: type,
|
|
58
|
+
...rest
|
|
59
|
+
})
|
|
60
|
+
})]
|
|
61
|
+
}), helper && !hasError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputHelper, {
|
|
62
|
+
helperText: helper
|
|
63
|
+
}), hasError && errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputError, {
|
|
64
|
+
errorMessage: errorMessage
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconName } from "dropi-lib-icons";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
preIcon?: IconName;
|
|
4
|
+
helper?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
readOnly: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const validateEmail: (value: string) => boolean;
|
|
13
|
+
export declare const EmailInput: ({ preIcon, helper, tooltip, value, onChange, hasError, errorMessage, readOnly, }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateEmail = exports.EmailInput = void 0;
|
|
7
|
+
var _BaseInput = require("./BaseInput");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const validateEmail = value => {
|
|
11
|
+
// Regular expression for validating email addresses
|
|
12
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
13
|
+
return emailRegex.test(value);
|
|
14
|
+
};
|
|
15
|
+
exports.validateEmail = validateEmail;
|
|
16
|
+
const EmailInput = ({
|
|
17
|
+
preIcon,
|
|
18
|
+
helper,
|
|
19
|
+
tooltip,
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
hasError,
|
|
23
|
+
errorMessage,
|
|
24
|
+
readOnly
|
|
25
|
+
}) => {
|
|
26
|
+
const [incorrectEmail, setIncorrectEmail] = (0, _react.useState)(false);
|
|
27
|
+
const [focus, setFocus] = (0, _react.useState)(false);
|
|
28
|
+
const [wasVisited, setWasVisited] = (0, _react.useState)(false);
|
|
29
|
+
const onFocus = () => {
|
|
30
|
+
setFocus(true);
|
|
31
|
+
};
|
|
32
|
+
const onBlur = () => {
|
|
33
|
+
setFocus(false);
|
|
34
|
+
if (!wasVisited) {
|
|
35
|
+
setWasVisited(true);
|
|
36
|
+
if (!validateEmail(value)) {
|
|
37
|
+
setIncorrectEmail(true);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getErrorMessage = () => {
|
|
42
|
+
if (hasError) {
|
|
43
|
+
return errorMessage;
|
|
44
|
+
}
|
|
45
|
+
if (incorrectEmail) {
|
|
46
|
+
return "Ingresa un correo electrónico válido";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseInput.BaseInput, {
|
|
50
|
+
type: "email-address",
|
|
51
|
+
label: "Correo electrónico",
|
|
52
|
+
placeholder: "Ingresa tu correo electrónico",
|
|
53
|
+
value: value,
|
|
54
|
+
preIcon: preIcon,
|
|
55
|
+
helper: helper,
|
|
56
|
+
tooltip: tooltip,
|
|
57
|
+
onChangeText: text => {
|
|
58
|
+
onChange(text);
|
|
59
|
+
if (wasVisited) {
|
|
60
|
+
if (validateEmail(value)) {
|
|
61
|
+
setIncorrectEmail(false);
|
|
62
|
+
} else {
|
|
63
|
+
setIncorrectEmail(true);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
hasError: hasError || incorrectEmail,
|
|
68
|
+
errorMessage: getErrorMessage(),
|
|
69
|
+
autoCorrect: false,
|
|
70
|
+
autoCapitalize: "none",
|
|
71
|
+
readOnly: readOnly,
|
|
72
|
+
onBlur: onBlur,
|
|
73
|
+
onFocus: onFocus,
|
|
74
|
+
isFocus: focus
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
exports.EmailInput = EmailInput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type InputType = "text" | "number" | "email" | "password";
|
|
2
|
+
type InputFactoryProps = {
|
|
3
|
+
type: InputType;
|
|
4
|
+
};
|
|
5
|
+
export declare const Input: ({ type, ...props }: InputFactoryProps) => import("react").ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
6
|
+
type?: import("react-native").KeyboardTypeOptions;
|
|
7
|
+
preIcon?: import("dropi-lib-icons").IconName;
|
|
8
|
+
label?: string;
|
|
9
|
+
helper?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
value: string;
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
isFocus: boolean;
|
|
16
|
+
} & import("react").RefAttributes<import("react-native").TextInput>> | (({ preIcon, helper, tooltip, value, onChange, hasError, errorMessage, readOnly, }: {
|
|
17
|
+
preIcon?: import("dropi-lib-icons").IconName;
|
|
18
|
+
helper?: string;
|
|
19
|
+
tooltip?: string;
|
|
20
|
+
value: string;
|
|
21
|
+
onChange: (value: string) => void;
|
|
22
|
+
hasError: boolean;
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
readOnly: boolean;
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element);
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _BaseInput = require("./BaseInput");
|
|
8
|
+
var _EmailInput = require("./EmailInput");
|
|
9
|
+
// import { PasswordInput } from "./PasswordInput"
|
|
10
|
+
|
|
11
|
+
const InputComponents = {
|
|
12
|
+
text: _BaseInput.BaseInput,
|
|
13
|
+
number: _BaseInput.BaseInput,
|
|
14
|
+
email: _EmailInput.EmailInput,
|
|
15
|
+
password: _EmailInput.EmailInput
|
|
16
|
+
};
|
|
17
|
+
const Input = ({
|
|
18
|
+
type,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
return InputComponents[type];
|
|
22
|
+
};
|
|
23
|
+
exports.Input = Input;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextInput, TextInputProps } from "react-native";
|
|
2
|
+
import { IconName } from "dropi-lib-icons";
|
|
3
|
+
export declare const PasswordInput: import("react").ForwardRefExoticComponent<TextInputProps & {
|
|
4
|
+
preIcon?: IconName;
|
|
5
|
+
helper?: string;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChangeFunction: (value: string) => void;
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
} & import("react").RefAttributes<TextInput>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PasswordInput = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _constants = require("./../../constants");
|
|
9
|
+
var _molecules = require("./molecules");
|
|
10
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const PasswordInput = exports.PasswordInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
15
|
+
preIcon,
|
|
16
|
+
helper,
|
|
17
|
+
tooltip,
|
|
18
|
+
value,
|
|
19
|
+
onChangeFunction,
|
|
20
|
+
hasError,
|
|
21
|
+
errorMessage,
|
|
22
|
+
/** TextInput props */
|
|
23
|
+
...rest
|
|
24
|
+
}, ref) => {
|
|
25
|
+
const [passwordVisibility, setPasswordVisibility] = (0, _react.useState)(false);
|
|
26
|
+
const [incorrectPasswordLength, setIncorrectPasswordLength] = (0, _react.useState)(false);
|
|
27
|
+
const [focus, setFocus] = (0, _react.useState)(false);
|
|
28
|
+
const [wasVisited, setWasVisited] = (0, _react.useState)(false);
|
|
29
|
+
const onFocus = () => {
|
|
30
|
+
setFocus(true);
|
|
31
|
+
};
|
|
32
|
+
const onBlur = () => {
|
|
33
|
+
setFocus(false);
|
|
34
|
+
if (!wasVisited) {
|
|
35
|
+
setWasVisited(true);
|
|
36
|
+
if (value.length < 4) {
|
|
37
|
+
setIncorrectPasswordLength(true);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getBorderColor = () => {
|
|
42
|
+
if (hasError || incorrectPasswordLength) {
|
|
43
|
+
return _constants.colors["Error-500"].light;
|
|
44
|
+
}
|
|
45
|
+
if (focus) {
|
|
46
|
+
return _constants.colors["Info-500"].light;
|
|
47
|
+
}
|
|
48
|
+
return _constants.colors["Gray-200"].light;
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
51
|
+
style: _styles.default.fieldContainer,
|
|
52
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputLabel, {
|
|
53
|
+
text: "Contraseña"
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
55
|
+
style: [_styles.default.searchbarContainer, {
|
|
56
|
+
borderColor: getBorderColor()
|
|
57
|
+
}],
|
|
58
|
+
children: [preIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputIcon, {
|
|
59
|
+
icon: preIcon
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
61
|
+
style: [_styles.default.searchContainer, {
|
|
62
|
+
marginLeft: preIcon ? _constants.spacing["size-2"] : 0
|
|
63
|
+
}],
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
65
|
+
ref: ref,
|
|
66
|
+
style: _styles.default.usernameInput,
|
|
67
|
+
placeholder: "Ingresa tu contraseña",
|
|
68
|
+
placeholderTextColor: _constants.colors["Gray-500"].light,
|
|
69
|
+
value: value,
|
|
70
|
+
secureTextEntry: !passwordVisibility,
|
|
71
|
+
onChangeText: text => {
|
|
72
|
+
onChangeFunction(text);
|
|
73
|
+
if (wasVisited) {
|
|
74
|
+
if (text.length < 4) {
|
|
75
|
+
setIncorrectPasswordLength(true);
|
|
76
|
+
} else {
|
|
77
|
+
setIncorrectPasswordLength(false);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onFocus: onFocus,
|
|
82
|
+
onBlur: onBlur,
|
|
83
|
+
...rest
|
|
84
|
+
})
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputIcon, {
|
|
86
|
+
icon: passwordVisibility ? "eye-crossed" : "eye",
|
|
87
|
+
onClick: () => setPasswordVisibility(!passwordVisibility)
|
|
88
|
+
})]
|
|
89
|
+
}), helper && !hasError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputHelper, {
|
|
90
|
+
helperText: helper
|
|
91
|
+
}), incorrectPasswordLength && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputError, {
|
|
92
|
+
errorMessage: "La contraseña debe tener al menos 4 caracteres"
|
|
93
|
+
}), hasError && errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_molecules.InputError, {
|
|
94
|
+
errorMessage: errorMessage
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _EmailInput = require("./EmailInput");
|
|
7
|
+
Object.keys(_EmailInput).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _EmailInput[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _EmailInput[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _PasswordInput = require("./PasswordInput");
|
|
18
|
+
Object.keys(_PasswordInput).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _PasswordInput[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _PasswordInput[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _BaseInput = require("./BaseInput");
|
|
29
|
+
Object.keys(_BaseInput).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _BaseInput[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _BaseInput[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InputError = void 0;
|
|
7
|
+
var _reactNative = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
8
|
+
var _reactNative2 = require("react-native");
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
var _atoms = require("../../../atoms");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const InputError = ({
|
|
14
|
+
errorMessage
|
|
15
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative2.View, {
|
|
16
|
+
style: styles.errorContainer,
|
|
17
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.View, {
|
|
18
|
+
style: styles.errorIcon,
|
|
19
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.default, {
|
|
20
|
+
name: "warning-circle-outline",
|
|
21
|
+
size: _constants.sizes["s"],
|
|
22
|
+
color: _constants.colors["Error-500"].light
|
|
23
|
+
})
|
|
24
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
25
|
+
type: "s-regular",
|
|
26
|
+
style: styles.errorText,
|
|
27
|
+
children: errorMessage
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
exports.InputError = InputError;
|
|
31
|
+
const styles = _reactNative2.StyleSheet.create({
|
|
32
|
+
errorContainer: {
|
|
33
|
+
marginTop: _constants.spacing["size-2"],
|
|
34
|
+
flexDirection: "row",
|
|
35
|
+
width: "100%"
|
|
36
|
+
},
|
|
37
|
+
errorIcon: {
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
paddingTop: _constants.spacing["size-1"]
|
|
40
|
+
},
|
|
41
|
+
errorText: {
|
|
42
|
+
color: _constants.colors["Error-500"].light,
|
|
43
|
+
marginLeft: _constants.spacing["size-1"],
|
|
44
|
+
flex: 1
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InputHelper = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _atoms = require("../../../atoms");
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
const InputHelper = ({
|
|
12
|
+
helperText
|
|
13
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
14
|
+
style: {
|
|
15
|
+
marginTop: _constants.spacing["size-2"]
|
|
16
|
+
},
|
|
17
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
18
|
+
type: "s-regular",
|
|
19
|
+
style: {
|
|
20
|
+
color: _constants.colors["Gray-600"].light
|
|
21
|
+
},
|
|
22
|
+
children: helperText
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
exports.InputHelper = InputHelper;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InputIcon = void 0;
|
|
7
|
+
var _reactNative = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
8
|
+
var _reactNative2 = require("react-native");
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const InputIcon = ({
|
|
13
|
+
icon,
|
|
14
|
+
onClick
|
|
15
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.TouchableOpacity, {
|
|
16
|
+
style: styles.userAvatarContainer,
|
|
17
|
+
onPress: onClick,
|
|
18
|
+
activeOpacity: onClick ? 0 : 1,
|
|
19
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.default, {
|
|
20
|
+
name: icon,
|
|
21
|
+
size: _constants.sizes["xl"],
|
|
22
|
+
color: _constants.colors["Gray-400"].light
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
exports.InputIcon = InputIcon;
|
|
26
|
+
const styles = _reactNative2.StyleSheet.create({
|
|
27
|
+
userAvatarContainer: {
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
alignItems: "center"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InputLabel = void 0;
|
|
7
|
+
var _atoms = require("../../../atoms");
|
|
8
|
+
var _constants = require("../../../constants");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const InputLabel = ({
|
|
11
|
+
text
|
|
12
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
13
|
+
type: "m-regular",
|
|
14
|
+
style: {
|
|
15
|
+
color: _constants.colors["Gray-600"].light
|
|
16
|
+
},
|
|
17
|
+
children: text
|
|
18
|
+
});
|
|
19
|
+
exports.InputLabel = InputLabel;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _InputLabel = require("./InputLabel");
|
|
7
|
+
Object.keys(_InputLabel).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _InputLabel[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _InputLabel[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _InputIcon = require("./InputIcon");
|
|
18
|
+
Object.keys(_InputIcon).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _InputIcon[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _InputIcon[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _InputHelper = require("./InputHelper");
|
|
29
|
+
Object.keys(_InputHelper).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _InputHelper[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _InputHelper[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _InputError = require("./InputError");
|
|
40
|
+
Object.keys(_InputError).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _InputError[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _InputError[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
fieldContainer: {
|
|
3
|
+
marginBottom: number;
|
|
4
|
+
width: "100%";
|
|
5
|
+
};
|
|
6
|
+
searchbarContainer: {
|
|
7
|
+
width: "100%";
|
|
8
|
+
borderRadius: number;
|
|
9
|
+
borderWidth: number;
|
|
10
|
+
justifyContent: "space-between";
|
|
11
|
+
flexDirection: "row";
|
|
12
|
+
marginTop: number;
|
|
13
|
+
height: number;
|
|
14
|
+
paddingHorizontal: number;
|
|
15
|
+
paddingVertical: number;
|
|
16
|
+
};
|
|
17
|
+
searchContainer: {
|
|
18
|
+
flex: number;
|
|
19
|
+
justifyContent: "center";
|
|
20
|
+
};
|
|
21
|
+
usernameInput: {
|
|
22
|
+
fontWeight: "400";
|
|
23
|
+
color: "#475066";
|
|
24
|
+
fontSize: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("./../../constants");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _default = exports.default = _reactNative.StyleSheet.create({
|
|
10
|
+
fieldContainer: {
|
|
11
|
+
marginBottom: _constants.spacing["size-4"],
|
|
12
|
+
width: "100%"
|
|
13
|
+
},
|
|
14
|
+
searchbarContainer: {
|
|
15
|
+
width: "100%",
|
|
16
|
+
borderRadius: _constants.radius["border-2"],
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
justifyContent: "space-between",
|
|
19
|
+
flexDirection: "row",
|
|
20
|
+
marginTop: _constants.spacing["size-2"],
|
|
21
|
+
height: 48,
|
|
22
|
+
paddingHorizontal: _constants.spacing["size-3"],
|
|
23
|
+
paddingVertical: _constants.spacing["size-2"]
|
|
24
|
+
},
|
|
25
|
+
searchContainer: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
justifyContent: "center"
|
|
28
|
+
},
|
|
29
|
+
usernameInput: {
|
|
30
|
+
fontWeight: _constants.weights.regular,
|
|
31
|
+
color: _constants.colors["Gray-600"].light,
|
|
32
|
+
fontSize: _constants.sizes.s
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SelectOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | number;
|
|
4
|
+
};
|
|
5
|
+
type SelectProps = {
|
|
6
|
+
options: SelectOption[];
|
|
7
|
+
value?: SelectOption | null;
|
|
8
|
+
onChange: (option: SelectOption) => void;
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
helper?: string;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const Select: ({ options, value, onChange, label, placeholder, helper, hasError, errorMessage, title, disabled, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Select = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNative2 = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
10
|
+
var _atoms = require("../../atoms");
|
|
11
|
+
var _BottomSheet = require("../BottomSheet");
|
|
12
|
+
var _constants = require("../../constants/");
|
|
13
|
+
var _RadioButtons = require("../RadioButtons");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const Select = ({
|
|
17
|
+
options,
|
|
18
|
+
value = null,
|
|
19
|
+
onChange,
|
|
20
|
+
label,
|
|
21
|
+
placeholder = 'Seleccionar',
|
|
22
|
+
helper,
|
|
23
|
+
hasError = false,
|
|
24
|
+
errorMessage,
|
|
25
|
+
title,
|
|
26
|
+
disabled = false
|
|
27
|
+
}) => {
|
|
28
|
+
const bottomSheetRef = (0, _react.useRef)(null);
|
|
29
|
+
const [isFocus, setIsFocus] = (0, _react.useState)(false);
|
|
30
|
+
const [draftSelection, setDraftSelection] = (0, _react.useState)(null);
|
|
31
|
+
const currentValue = value;
|
|
32
|
+
const getBorderColor = () => {
|
|
33
|
+
if (hasError) return _constants.colors['Error-500'].light;
|
|
34
|
+
if (isFocus) return _constants.colors['Info-500'].light;
|
|
35
|
+
return _constants.colors['Gray-200'].light;
|
|
36
|
+
};
|
|
37
|
+
const hasChanges = (0, _react.useMemo)(() => {
|
|
38
|
+
if (!draftSelection) return false;
|
|
39
|
+
return draftSelection.value !== currentValue?.value;
|
|
40
|
+
}, [draftSelection, currentValue]);
|
|
41
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
42
|
+
if (disabled) return;
|
|
43
|
+
setDraftSelection(currentValue);
|
|
44
|
+
setIsFocus(true);
|
|
45
|
+
bottomSheetRef.current?.present();
|
|
46
|
+
}, [disabled, currentValue]);
|
|
47
|
+
const handleDraftSelect = (0, _react.useCallback)(option => {
|
|
48
|
+
setDraftSelection(option);
|
|
49
|
+
}, []);
|
|
50
|
+
const handleSave = (0, _react.useCallback)(() => {
|
|
51
|
+
if (draftSelection) {
|
|
52
|
+
onChange(draftSelection);
|
|
53
|
+
}
|
|
54
|
+
bottomSheetRef.current?.dismiss();
|
|
55
|
+
setIsFocus(false);
|
|
56
|
+
}, [draftSelection, onChange]);
|
|
57
|
+
const handleDismiss = (0, _react.useCallback)(() => {
|
|
58
|
+
setIsFocus(false);
|
|
59
|
+
setDraftSelection(null);
|
|
60
|
+
}, []);
|
|
61
|
+
const renderOption = (0, _react.useCallback)(({
|
|
62
|
+
item
|
|
63
|
+
}) => {
|
|
64
|
+
const isSelected = draftSelection?.value === item.value;
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtons.TitleDescription, {
|
|
66
|
+
title: item.label,
|
|
67
|
+
isActive: isSelected,
|
|
68
|
+
onPress: () => handleDraftSelect(item)
|
|
69
|
+
});
|
|
70
|
+
}, [draftSelection, handleDraftSelect]);
|
|
71
|
+
const footer = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
|
|
72
|
+
label: "Guardar",
|
|
73
|
+
variant: "primary",
|
|
74
|
+
size: "large",
|
|
75
|
+
onPress: handleSave,
|
|
76
|
+
disabled: !hasChanges
|
|
77
|
+
}), [handleSave, hasChanges]);
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
79
|
+
style: styles.fieldContainer,
|
|
80
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
81
|
+
type: "m-regular",
|
|
82
|
+
style: {
|
|
83
|
+
color: _constants.colors['Gray-600'].light
|
|
84
|
+
},
|
|
85
|
+
children: label
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
87
|
+
style: [styles.selectButton, {
|
|
88
|
+
borderColor: getBorderColor()
|
|
89
|
+
}, disabled && styles.disabled],
|
|
90
|
+
onPress: handleOpen,
|
|
91
|
+
activeOpacity: 0.7,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
93
|
+
type: "s-regular",
|
|
94
|
+
style: {
|
|
95
|
+
color: currentValue ? _constants.colors['Gray-600'].light : _constants.colors['Gray-500'].light,
|
|
96
|
+
flex: 1
|
|
97
|
+
},
|
|
98
|
+
children: currentValue?.label ?? placeholder
|
|
99
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
100
|
+
name: "dropdown-down",
|
|
101
|
+
size: _constants.sizes.xl,
|
|
102
|
+
color: _constants.colors['Gray-400'].light
|
|
103
|
+
})]
|
|
104
|
+
}), helper && !hasError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
105
|
+
style: {
|
|
106
|
+
marginTop: _constants.spacing['size-2']
|
|
107
|
+
},
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
109
|
+
type: "s-regular",
|
|
110
|
+
style: {
|
|
111
|
+
color: _constants.colors['Gray-600'].light
|
|
112
|
+
},
|
|
113
|
+
children: helper
|
|
114
|
+
})
|
|
115
|
+
}), hasError && errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
116
|
+
style: styles.errorContainer,
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
118
|
+
style: styles.errorIcon,
|
|
119
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
120
|
+
name: "warning-circle",
|
|
121
|
+
size: _constants.sizes.s,
|
|
122
|
+
color: _constants.colors['Error-500'].light
|
|
123
|
+
})
|
|
124
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
125
|
+
type: "s-regular",
|
|
126
|
+
style: styles.errorText,
|
|
127
|
+
children: errorMessage
|
|
128
|
+
})]
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomSheet.BottomSheetComponent, {
|
|
130
|
+
ref: bottomSheetRef,
|
|
131
|
+
title: title ?? label ?? 'Seleccionar',
|
|
132
|
+
snapPoints: ['50%', '70%', '90%'],
|
|
133
|
+
onDismiss: handleDismiss,
|
|
134
|
+
footer: footer,
|
|
135
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
136
|
+
data: options,
|
|
137
|
+
keyExtractor: item => String(item.value),
|
|
138
|
+
renderItem: renderOption,
|
|
139
|
+
contentContainerStyle: styles.optionsList,
|
|
140
|
+
showsVerticalScrollIndicator: false
|
|
141
|
+
})
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
exports.Select = Select;
|
|
146
|
+
const styles = _reactNative.StyleSheet.create({
|
|
147
|
+
fieldContainer: {
|
|
148
|
+
marginBottom: _constants.spacing['size-4'],
|
|
149
|
+
width: '100%'
|
|
150
|
+
},
|
|
151
|
+
selectButton: {
|
|
152
|
+
width: '100%',
|
|
153
|
+
borderRadius: _constants.radius['border-2'],
|
|
154
|
+
borderWidth: 1,
|
|
155
|
+
flexDirection: 'row',
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
justifyContent: 'space-between',
|
|
158
|
+
marginTop: _constants.spacing['size-2'],
|
|
159
|
+
height: 48,
|
|
160
|
+
paddingHorizontal: _constants.spacing['size-3']
|
|
161
|
+
},
|
|
162
|
+
disabled: {
|
|
163
|
+
opacity: 0.5
|
|
164
|
+
},
|
|
165
|
+
errorContainer: {
|
|
166
|
+
marginTop: _constants.spacing['size-2'],
|
|
167
|
+
flexDirection: 'row',
|
|
168
|
+
width: '100%'
|
|
169
|
+
},
|
|
170
|
+
errorIcon: {
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
paddingTop: _constants.spacing['size-1']
|
|
173
|
+
},
|
|
174
|
+
errorText: {
|
|
175
|
+
color: _constants.colors['Error-500'].light,
|
|
176
|
+
marginLeft: _constants.spacing['size-1'],
|
|
177
|
+
flex: 1
|
|
178
|
+
},
|
|
179
|
+
optionsList: {
|
|
180
|
+
paddingHorizontal: _constants.spacing['size-5']
|
|
181
|
+
}
|
|
182
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Select';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Select = require("./Select");
|
|
7
|
+
Object.keys(_Select).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Select[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Select[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/lib/molecules/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from "./Alert";
|
|
2
|
+
export * from "./BottomSheet";
|
|
3
|
+
export * from "./EmptyState";
|
|
4
|
+
export * from "./RadioButtons";
|
|
5
|
+
export * from "./Search";
|
|
6
|
+
export * from "./Select";
|
|
7
|
+
export * from "./Tooltip";
|
|
8
|
+
export * from "./Toasts";
|
|
9
|
+
export * from "./Tags";
|
|
10
|
+
export * from "./InputField";
|
package/lib/molecules/index.js
CHANGED
|
@@ -14,6 +14,17 @@ Object.keys(_Alert).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _BottomSheet = require("./BottomSheet");
|
|
18
|
+
Object.keys(_BottomSheet).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _BottomSheet[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _BottomSheet[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
var _EmptyState = require("./EmptyState");
|
|
18
29
|
Object.keys(_EmptyState).forEach(function (key) {
|
|
19
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -47,6 +58,17 @@ Object.keys(_Search).forEach(function (key) {
|
|
|
47
58
|
}
|
|
48
59
|
});
|
|
49
60
|
});
|
|
61
|
+
var _Select = require("./Select");
|
|
62
|
+
Object.keys(_Select).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _Select[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _Select[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
50
72
|
var _Tooltip = require("./Tooltip");
|
|
51
73
|
Object.keys(_Tooltip).forEach(function (key) {
|
|
52
74
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -79,4 +101,15 @@ Object.keys(_Tags).forEach(function (key) {
|
|
|
79
101
|
return _Tags[key];
|
|
80
102
|
}
|
|
81
103
|
});
|
|
104
|
+
});
|
|
105
|
+
var _InputField = require("./InputField");
|
|
106
|
+
Object.keys(_InputField).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _InputField[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _InputField[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
82
115
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropi/react-native-design-system",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "A React Native package built from scratch",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -20,12 +20,15 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
23
|
+
"@gorhom/bottom-sheet": ">=5.2.6",
|
|
24
|
+
"dropi-lib-icons": ">=1.3.4",
|
|
25
|
+
"expo-constants": ">=17.1.7",
|
|
26
26
|
"expo-image": ">=2.4.0",
|
|
27
27
|
"lottie-react-native": ">=7.2.2",
|
|
28
|
-
"
|
|
28
|
+
"react": ">=19.0.0",
|
|
29
|
+
"react-native": ">=0.79.5",
|
|
30
|
+
"react-native-gesture-handler": ">=2.24.0",
|
|
31
|
+
"react-native-reanimated": ">=3.19.1"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@babel/cli": "^7.28.3",
|
|
@@ -33,13 +36,16 @@
|
|
|
33
36
|
"@babel/preset-env": "^7.28.5",
|
|
34
37
|
"@babel/preset-react": "^7.28.5",
|
|
35
38
|
"@babel/preset-typescript": "^7.28.5",
|
|
39
|
+
"@gorhom/bottom-sheet": "^5.2.6",
|
|
36
40
|
"@types/react": "^19.2.3",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^5.6.0",
|
|
40
|
-
"dropi-lib-icons": "^1.2.5",
|
|
41
|
+
"dropi-lib-icons": "^1.3.4",
|
|
42
|
+
"expo-constants": ">=17.1.7",
|
|
41
43
|
"expo-image": ">=2.4.0",
|
|
42
44
|
"lottie-react-native": ">=7.2.2",
|
|
43
|
-
"
|
|
45
|
+
"react": "^19.2.0",
|
|
46
|
+
"react-native": "^0.82.1",
|
|
47
|
+
"react-native-gesture-handler": "^2.24.0",
|
|
48
|
+
"react-native-reanimated": "^3.19.1",
|
|
49
|
+
"typescript": "^5.6.0"
|
|
44
50
|
}
|
|
45
51
|
}
|