@dropi/react-native-design-system 0.3.6 → 0.3.7
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/DialogModal/DialogModal.d.ts +13 -0
- package/lib/molecules/DialogModal/DialogModal.js +135 -0
- package/lib/molecules/DialogModal/index.d.ts +1 -0
- package/lib/molecules/DialogModal/index.js +16 -0
- package/lib/molecules/index.d.ts +1 -0
- package/lib/molecules/index.js +11 -0
- package/lib/utils/DeviceInfo.d.ts +1 -0
- package/lib/utils/DeviceInfo.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export type DialogModalTypes = 'success' | 'error' | 'warning' | 'info';
|
|
3
|
+
export type DialogModalConfig = {
|
|
4
|
+
variant: DialogModalTypes;
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
buttonText?: string;
|
|
8
|
+
secondButtonText?: string;
|
|
9
|
+
setShowAlert: (flag: boolean) => void;
|
|
10
|
+
handlePrimaryBtn?: () => void;
|
|
11
|
+
handleSecundaryBtn?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const DialogModal: FC<DialogModalConfig>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DialogModal = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _lottieReactNative = _interopRequireDefault(require("lottie-react-native"));
|
|
10
|
+
var _reactNative2 = _interopRequireDefault(require("dropi-lib-icons/react-native"));
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _constants = require("../../constants");
|
|
13
|
+
var _atoms = require("../../atoms");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const DialogModal = ({
|
|
17
|
+
variant,
|
|
18
|
+
title,
|
|
19
|
+
message,
|
|
20
|
+
buttonText = 'Aceptar',
|
|
21
|
+
secondButtonText,
|
|
22
|
+
handlePrimaryBtn,
|
|
23
|
+
handleSecundaryBtn,
|
|
24
|
+
setShowAlert
|
|
25
|
+
}) => {
|
|
26
|
+
const animation = (0, _react.useRef)(null);
|
|
27
|
+
const lottieFile = variant === 'success' ? require('../../../assets/lottie/afirmacion.json') : variant === 'error' ? require('../../../assets/lottie/buscando.json') : variant === 'warning' ? require('../../../assets/lottie/alerta.json') : require('../../../assets/lottie/pregunta.json');
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
29
|
+
style: styles.backgroundContainer,
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
31
|
+
style: styles.dialogContainer,
|
|
32
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
33
|
+
style: styles.closeButtonContainer,
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
35
|
+
onPress: () => setShowAlert(false),
|
|
36
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
37
|
+
name: "close-large",
|
|
38
|
+
size: 20,
|
|
39
|
+
color: _constants.colors["Gray-800"].light
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_lottieReactNative.default, {
|
|
43
|
+
autoPlay: true,
|
|
44
|
+
ref: animation,
|
|
45
|
+
style: styles.lottieAnimation,
|
|
46
|
+
source: lottieFile
|
|
47
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
48
|
+
style: styles.titleContainer,
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Heading, {
|
|
50
|
+
type: "h4",
|
|
51
|
+
style: styles.titleText,
|
|
52
|
+
children: title
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
55
|
+
style: styles.messageContainer,
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
57
|
+
type: "m-regular",
|
|
58
|
+
style: styles.descriptionText,
|
|
59
|
+
children: message
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
62
|
+
style: styles.btnsContainer,
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
|
|
64
|
+
variant: "primary",
|
|
65
|
+
size: "normal",
|
|
66
|
+
label: buttonText,
|
|
67
|
+
onPress: () => {
|
|
68
|
+
handlePrimaryBtn?.();
|
|
69
|
+
setShowAlert(false);
|
|
70
|
+
}
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
72
|
+
style: styles.buttonSpacer
|
|
73
|
+
}), secondButtonText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
|
|
74
|
+
variant: "secondary",
|
|
75
|
+
size: "normal",
|
|
76
|
+
label: secondButtonText,
|
|
77
|
+
onPress: () => {
|
|
78
|
+
handleSecundaryBtn?.();
|
|
79
|
+
setShowAlert(false);
|
|
80
|
+
}
|
|
81
|
+
})]
|
|
82
|
+
})]
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
exports.DialogModal = DialogModal;
|
|
87
|
+
const styles = _reactNative.StyleSheet.create({
|
|
88
|
+
backgroundContainer: {
|
|
89
|
+
backgroundColor: "rgba(0,0,0,0.25)",
|
|
90
|
+
position: "absolute",
|
|
91
|
+
width: _utils.windowWidth,
|
|
92
|
+
height: _utils.windowHeight,
|
|
93
|
+
zIndex: 99,
|
|
94
|
+
justifyContent: "center",
|
|
95
|
+
alignItems: "center"
|
|
96
|
+
},
|
|
97
|
+
dialogContainer: {
|
|
98
|
+
padding: _constants.spacing['size-5'],
|
|
99
|
+
backgroundColor: "white",
|
|
100
|
+
borderRadius: _constants.radius["border-3"],
|
|
101
|
+
width: "90%",
|
|
102
|
+
maxWidth: 600,
|
|
103
|
+
alignItems: 'center'
|
|
104
|
+
},
|
|
105
|
+
titleContainer: {
|
|
106
|
+
marginTop: _constants.spacing['size-6']
|
|
107
|
+
},
|
|
108
|
+
titleText: {
|
|
109
|
+
textAlign: 'center'
|
|
110
|
+
},
|
|
111
|
+
messageContainer: {
|
|
112
|
+
marginTop: _constants.spacing['size-3']
|
|
113
|
+
},
|
|
114
|
+
descriptionText: {
|
|
115
|
+
color: _constants.colors["Gray-400"].light,
|
|
116
|
+
textAlign: 'center'
|
|
117
|
+
},
|
|
118
|
+
closeButtonContainer: {
|
|
119
|
+
width: '100%',
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
justifyContent: 'flex-end'
|
|
122
|
+
},
|
|
123
|
+
lottieAnimation: {
|
|
124
|
+
width: 100,
|
|
125
|
+
height: 100,
|
|
126
|
+
backgroundColor: '#fff'
|
|
127
|
+
},
|
|
128
|
+
btnsContainer: {
|
|
129
|
+
width: '100%',
|
|
130
|
+
marginTop: _constants.spacing['size-6']
|
|
131
|
+
},
|
|
132
|
+
buttonSpacer: {
|
|
133
|
+
height: _constants.spacing['size-3']
|
|
134
|
+
}
|
|
135
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DialogModal';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _DialogModal = require("./DialogModal");
|
|
7
|
+
Object.keys(_DialogModal).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _DialogModal[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _DialogModal[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/lib/molecules/index.d.ts
CHANGED
package/lib/molecules/index.js
CHANGED
|
@@ -123,4 +123,15 @@ Object.keys(_InputField).forEach(function (key) {
|
|
|
123
123
|
return _InputField[key];
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
+
});
|
|
127
|
+
var _DialogModal = require("./DialogModal");
|
|
128
|
+
Object.keys(_DialogModal).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _DialogModal[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _DialogModal[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
126
137
|
});
|
package/lib/utils/DeviceInfo.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.windowWidth = exports.statusBarHeight = exports.isTablet = void 0;
|
|
6
|
+
exports.windowWidth = exports.windowHeight = exports.statusBarHeight = exports.isTablet = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _expoConstants = _interopRequireDefault(require("expo-constants"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const windowWidth = exports.windowWidth = _reactNative.Dimensions.get("window").width;
|
|
11
|
+
const windowHeight = exports.windowHeight = _reactNative.Dimensions.get("window").height;
|
|
11
12
|
const isTablet = exports.isTablet = windowWidth >= 768;
|
|
12
13
|
const statusBarHeight = exports.statusBarHeight = _expoConstants.default.statusBarHeight;
|