@dropi/react-native-design-system 0.3.23 → 0.3.24
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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
isChecked: boolean;
|
|
5
|
+
useCard?: boolean;
|
|
6
|
+
onToggle: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const Checkbox: ({ title, description, isChecked, useCard, onToggle }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Checkbox = 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 _atoms = require("../../atoms");
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const Checkbox = ({
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
isChecked,
|
|
18
|
+
useCard = true,
|
|
19
|
+
onToggle
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
22
|
+
style: [styles.container, useCard && styles.useCard, isChecked && useCard && styles.checkedContainer],
|
|
23
|
+
onPress: onToggle,
|
|
24
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
25
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
26
|
+
type: "m-regular",
|
|
27
|
+
children: title
|
|
28
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
|
|
29
|
+
type: "s-regular",
|
|
30
|
+
children: description
|
|
31
|
+
})]
|
|
32
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
33
|
+
style: [styles.checkbox, isChecked && styles.checkedCheckbox],
|
|
34
|
+
children: isChecked && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
|
|
35
|
+
name: "check",
|
|
36
|
+
size: 16,
|
|
37
|
+
color: _constants.colors.White.light
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
exports.Checkbox = Checkbox;
|
|
43
|
+
const styles = _reactNative.StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
padding: _constants.spacing['size-4'],
|
|
49
|
+
marginTop: _constants.spacing['size-4']
|
|
50
|
+
},
|
|
51
|
+
checkedContainer: {
|
|
52
|
+
backgroundColor: _constants.colors['Primary-50'].light,
|
|
53
|
+
borderColor: _constants.colors['Primary-500'].light,
|
|
54
|
+
borderWidth: 1
|
|
55
|
+
},
|
|
56
|
+
useCard: {
|
|
57
|
+
borderRadius: _constants.radius['border-2'],
|
|
58
|
+
borderWidth: 1,
|
|
59
|
+
borderColor: _constants.colors['Gray-200'].light
|
|
60
|
+
},
|
|
61
|
+
checkbox: {
|
|
62
|
+
width: !_utils.isTablet ? 24 : 32,
|
|
63
|
+
height: !_utils.isTablet ? 24 : 32,
|
|
64
|
+
borderRadius: _constants.radius['border-1'],
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
borderWidth: 1,
|
|
68
|
+
borderColor: _constants.colors['Gray-200'].light
|
|
69
|
+
},
|
|
70
|
+
checkedCheckbox: {
|
|
71
|
+
backgroundColor: _constants.colors['Primary-500'].light,
|
|
72
|
+
borderColor: _constants.colors['Primary-500'].light
|
|
73
|
+
}
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Checkbox";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Checkbox = require("./Checkbox");
|
|
7
|
+
Object.keys(_Checkbox).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Checkbox[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Checkbox[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/lib/molecules/index.d.ts
CHANGED
package/lib/molecules/index.js
CHANGED
|
@@ -134,4 +134,15 @@ Object.keys(_DialogModal).forEach(function (key) {
|
|
|
134
134
|
return _DialogModal[key];
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
+
});
|
|
138
|
+
var _Checkbox = require("./Checkbox");
|
|
139
|
+
Object.keys(_Checkbox).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _Checkbox[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _Checkbox[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
137
148
|
});
|