@dropi/react-native-design-system 0.2.12 → 0.2.14
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/Chip/Chip.d.ts +11 -0
- package/lib/molecules/Chip/Chip.js +49 -0
- package/lib/molecules/Chip/index.d.ts +1 -0
- package/lib/molecules/Chip/index.js +16 -0
- package/lib/molecules/Chip/styles.d.ts +29 -0
- package/lib/molecules/Chip/styles.js +36 -0
- package/lib/molecules/InputField/index.d.ts +1 -0
- package/lib/molecules/InputField/index.js +11 -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 +3 -0
- package/lib/molecules/index.js +33 -0
- package/package.json +8 -2
|
@@ -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,11 @@
|
|
|
1
|
+
import { IconName } from "dropi-lib-icons";
|
|
2
|
+
type ChipVariant = "primary" | "tertiary";
|
|
3
|
+
type ChipProps = {
|
|
4
|
+
variant?: ChipVariant;
|
|
5
|
+
preIcon?: IconName;
|
|
6
|
+
label: string;
|
|
7
|
+
isDismissable?: boolean;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const Chip: ({ variant, preIcon, label, isDismissable, onDismiss, }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Chip = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _reactNative2 = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const Chip = ({
|
|
14
|
+
variant = "tertiary",
|
|
15
|
+
preIcon,
|
|
16
|
+
label,
|
|
17
|
+
isDismissable = false,
|
|
18
|
+
onDismiss
|
|
19
|
+
}) => {
|
|
20
|
+
const containerStyle = variant === "primary" ? _styles.default.primaryContainer : _styles.default.tertiaryContainer;
|
|
21
|
+
const textStyle = variant === "primary" ? _styles.default.primaryText : _styles.default.tertiaryText;
|
|
22
|
+
const iconColor = variant === "primary" ? _constants.colors["Primary-500"].light : _constants.colors["Gray-600"].light;
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
24
|
+
style: [_styles.default.container, containerStyle],
|
|
25
|
+
children: [preIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
26
|
+
name: preIcon,
|
|
27
|
+
size: _constants.sizes.s,
|
|
28
|
+
color: iconColor
|
|
29
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
30
|
+
style: [_styles.default.text, textStyle],
|
|
31
|
+
children: label
|
|
32
|
+
}), isDismissable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
33
|
+
onPress: onDismiss,
|
|
34
|
+
hitSlop: {
|
|
35
|
+
top: 8,
|
|
36
|
+
bottom: 8,
|
|
37
|
+
left: 8,
|
|
38
|
+
right: 8
|
|
39
|
+
},
|
|
40
|
+
activeOpacity: 0.7,
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
42
|
+
name: "cross-circle",
|
|
43
|
+
size: _constants.sizes.s,
|
|
44
|
+
color: iconColor
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.Chip = Chip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Chip";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Chip = require("./Chip");
|
|
7
|
+
Object.keys(_Chip).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Chip[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Chip[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
container: {
|
|
3
|
+
flexDirection: "row";
|
|
4
|
+
alignItems: "center";
|
|
5
|
+
alignSelf: "flex-start";
|
|
6
|
+
paddingHorizontal: number;
|
|
7
|
+
paddingVertical: number;
|
|
8
|
+
borderRadius: number;
|
|
9
|
+
gap: number;
|
|
10
|
+
};
|
|
11
|
+
primaryContainer: {
|
|
12
|
+
backgroundColor: "#FEF8F1";
|
|
13
|
+
};
|
|
14
|
+
tertiaryContainer: {
|
|
15
|
+
backgroundColor: "#E6EAF2";
|
|
16
|
+
};
|
|
17
|
+
text: {
|
|
18
|
+
fontSize: number;
|
|
19
|
+
fontWeight: "700";
|
|
20
|
+
lineHeight: number;
|
|
21
|
+
};
|
|
22
|
+
primaryText: {
|
|
23
|
+
color: "#F49A3D";
|
|
24
|
+
};
|
|
25
|
+
tertiaryText: {
|
|
26
|
+
color: "#475066";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _constants = require("../../constants");
|
|
9
|
+
var _default = exports.default = _reactNative.StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
flexDirection: "row",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
alignSelf: "flex-start",
|
|
14
|
+
paddingHorizontal: _constants.spacing["size-2"],
|
|
15
|
+
paddingVertical: _constants.spacing["size-1"],
|
|
16
|
+
borderRadius: _constants.radius["border-1"],
|
|
17
|
+
gap: _constants.spacing["size-1"]
|
|
18
|
+
},
|
|
19
|
+
primaryContainer: {
|
|
20
|
+
backgroundColor: _constants.colors["Primary-50"].light
|
|
21
|
+
},
|
|
22
|
+
tertiaryContainer: {
|
|
23
|
+
backgroundColor: _constants.colors["Gray-100"].light
|
|
24
|
+
},
|
|
25
|
+
text: {
|
|
26
|
+
fontSize: _constants.sizes.xs,
|
|
27
|
+
fontWeight: _constants.weights.bold,
|
|
28
|
+
lineHeight: 14
|
|
29
|
+
},
|
|
30
|
+
primaryText: {
|
|
31
|
+
color: _constants.colors["Primary-500"].light
|
|
32
|
+
},
|
|
33
|
+
tertiaryText: {
|
|
34
|
+
color: _constants.colors["Gray-600"].light
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -24,4 +24,15 @@ Object.keys(_PasswordInput).forEach(function (key) {
|
|
|
24
24
|
return _PasswordInput[key];
|
|
25
25
|
}
|
|
26
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
|
+
});
|
|
27
38
|
});
|
|
@@ -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
1
|
export * from "./Alert";
|
|
2
|
+
export * from "./BottomSheet";
|
|
3
|
+
export * from "./Chip";
|
|
2
4
|
export * from "./EmptyState";
|
|
3
5
|
export * from "./RadioButtons";
|
|
4
6
|
export * from "./Search";
|
|
7
|
+
export * from "./Select";
|
|
5
8
|
export * from "./Tooltip";
|
|
6
9
|
export * from "./Toasts";
|
|
7
10
|
export * from "./Tags";
|
package/lib/molecules/index.js
CHANGED
|
@@ -14,6 +14,28 @@ 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
|
+
});
|
|
28
|
+
var _Chip = require("./Chip");
|
|
29
|
+
Object.keys(_Chip).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _Chip[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _Chip[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
17
39
|
var _EmptyState = require("./EmptyState");
|
|
18
40
|
Object.keys(_EmptyState).forEach(function (key) {
|
|
19
41
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -47,6 +69,17 @@ Object.keys(_Search).forEach(function (key) {
|
|
|
47
69
|
}
|
|
48
70
|
});
|
|
49
71
|
});
|
|
72
|
+
var _Select = require("./Select");
|
|
73
|
+
Object.keys(_Select).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _Select[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _Select[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
50
83
|
var _Tooltip = require("./Tooltip");
|
|
51
84
|
Object.keys(_Tooltip).forEach(function (key) {
|
|
52
85
|
if (key === "default" || key === "__esModule") return;
|
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.14",
|
|
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
|
+
"@gorhom/bottom-sheet": ">=5.2.6",
|
|
23
24
|
"dropi-lib-icons": ">=1.3.4",
|
|
24
25
|
"expo-constants": ">=17.1.7",
|
|
25
26
|
"expo-image": ">=2.4.0",
|
|
26
27
|
"lottie-react-native": ">=7.2.2",
|
|
27
28
|
"react": ">=19.0.0",
|
|
28
|
-
"react-native": ">=0.79.5"
|
|
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,6 +36,7 @@
|
|
|
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
41
|
"dropi-lib-icons": "^1.3.4",
|
|
38
42
|
"expo-constants": ">=17.1.7",
|
|
@@ -40,6 +44,8 @@
|
|
|
40
44
|
"lottie-react-native": ">=7.2.2",
|
|
41
45
|
"react": "^19.2.0",
|
|
42
46
|
"react-native": "^0.82.1",
|
|
47
|
+
"react-native-gesture-handler": "^2.24.0",
|
|
48
|
+
"react-native-reanimated": "^3.19.1",
|
|
43
49
|
"typescript": "^5.6.0"
|
|
44
50
|
}
|
|
45
51
|
}
|