@draftbit/core 46.7.9-9ce779.2 → 46.7.9-b07e7a.2
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/commonjs/components/DatePicker/DatePicker.js +14 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +6 -5
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +0 -1
- package/lib/commonjs/components/NumberInput.js +10 -10
- package/lib/commonjs/components/Picker/Picker.js +10 -3
- package/lib/commonjs/components/Portal/PortalManager.js +8 -34
- package/lib/commonjs/mappings/DatePicker.js +8 -2
- package/lib/commonjs/mappings/DeckSwiper.js +3 -0
- package/lib/commonjs/mappings/DeckSwiperCard.js +7 -0
- package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -1
- package/lib/commonjs/mappings/Picker.js +5 -0
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/Container.js +4 -17
- package/lib/module/components/DatePicker/DatePicker.js +15 -2
- package/lib/module/components/DeckSwiper/DeckSwiper.js +6 -5
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +0 -1
- package/lib/module/components/DeprecatedButton.js +21 -3
- package/lib/module/components/Divider.js +1 -18
- package/lib/module/components/NumberInput.js +10 -10
- package/lib/module/components/Picker/Picker.js +11 -4
- package/lib/module/components/Picker/PickerComponent.web.js +3 -21
- package/lib/module/components/Pressable.js +2 -15
- package/lib/module/components/Slider.js +4 -21
- package/lib/module/components/StarRating.js +4 -24
- package/lib/module/components/StepIndicator.js +18 -58
- package/lib/module/components/Switch.js +10 -21
- package/lib/module/constants.js +0 -1
- package/lib/module/hooks.js +2 -1
- package/lib/module/mappings/DatePicker.js +9 -3
- package/lib/module/mappings/DeckSwiper.js +3 -0
- package/lib/module/mappings/DeckSwiperCard.js +7 -0
- package/lib/module/mappings/Picker.js +6 -1
- package/lib/module/styles/overlay.js +3 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +1 -0
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +10 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +3 -0
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +7 -0
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Picker.d.ts +10 -0
- package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DatePicker/DatePicker.js +8 -3
- package/src/components/DatePicker/DatePicker.tsx +10 -1
- package/src/components/DeckSwiper/DeckSwiper.js +6 -5
- package/src/components/DeckSwiper/DeckSwiper.tsx +6 -5
- package/src/components/DeckSwiper/DeckSwiperCard.js +0 -1
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +0 -1
- package/src/components/NumberInput.js +9 -9
- package/src/components/NumberInput.tsx +11 -11
- package/src/components/Picker/Picker.js +9 -3
- package/src/components/Picker/Picker.tsx +14 -2
- package/src/mappings/DatePicker.js +8 -2
- package/src/mappings/DatePicker.ts +8 -1
- package/src/mappings/DeckSwiper.js +3 -0
- package/src/mappings/DeckSwiper.ts +3 -0
- package/src/mappings/DeckSwiperCard.js +7 -0
- package/src/mappings/DeckSwiperCard.ts +7 -0
- package/src/mappings/Picker.js +6 -1
- package/src/mappings/Picker.ts +6 -0
|
@@ -48,6 +48,7 @@ const DatePicker = _ref => {
|
|
|
48
48
|
placeholder,
|
|
49
49
|
borderColor: inputBorderColor,
|
|
50
50
|
borderColorActive: inputBorderColorActive,
|
|
51
|
+
autoDismissKeyboard = true,
|
|
51
52
|
...props
|
|
52
53
|
} = _ref;
|
|
53
54
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -143,6 +144,11 @@ const DatePicker = _ref => {
|
|
|
143
144
|
clearTimeout(_showPlaceholder());
|
|
144
145
|
};
|
|
145
146
|
}, [focused, label, placeholder]);
|
|
147
|
+
React.useEffect(() => {
|
|
148
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
149
|
+
_reactNative.Keyboard.dismiss();
|
|
150
|
+
}
|
|
151
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
146
152
|
const _handleFocus = () => {
|
|
147
153
|
if (disabled) {
|
|
148
154
|
return;
|
|
@@ -160,7 +166,14 @@ const DatePicker = _ref => {
|
|
|
160
166
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
161
167
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
162
168
|
const hasActiveOutline = focused;
|
|
163
|
-
let inputTextColor,
|
|
169
|
+
let inputTextColor,
|
|
170
|
+
activeColor,
|
|
171
|
+
underlineColor,
|
|
172
|
+
borderColor = inputBorderColor,
|
|
173
|
+
placeholderColor,
|
|
174
|
+
containerStyle,
|
|
175
|
+
backgroundColor,
|
|
176
|
+
inputStyle;
|
|
164
177
|
inputTextColor = colors.strong;
|
|
165
178
|
if (disabled) {
|
|
166
179
|
activeColor = colors.light;
|
|
@@ -26,12 +26,13 @@ const DeckSwiper = _ref => {
|
|
|
26
26
|
const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* By default react-native-deck-swiper positions everything with absolute position
|
|
30
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure
|
|
29
|
+
* By default react-native-deck-swiper positions everything with absolute position.
|
|
30
|
+
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
34
|
+
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
35
|
+
* This effectivley makes the default height of the container be the height of the first card.
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -17,7 +17,6 @@ const DeckSwiperCard = _ref => {
|
|
|
17
17
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
18
18
|
style: [styles.card, {
|
|
19
19
|
backgroundColor: theme.colors.background,
|
|
20
|
-
borderRadius: theme.borderRadius.global,
|
|
21
20
|
borderColor: theme.colors.divider
|
|
22
21
|
}, style]
|
|
23
22
|
}, children);
|
|
@@ -32,17 +32,8 @@ const NumberInput = _ref => {
|
|
|
32
32
|
return valueToFormat.toString();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
return "
|
|
35
|
+
return "";
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
39
|
-
(0, _react.useEffect)(() => {
|
|
40
|
-
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
41
|
-
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
42
|
-
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
43
|
-
}
|
|
44
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
-
}, []);
|
|
46
37
|
const handleChangeText = newValue => {
|
|
47
38
|
const newStringNumberValue = formatValueToStringNumber(newValue);
|
|
48
39
|
const number = parseFloat(newStringNumberValue);
|
|
@@ -58,6 +49,15 @@ const NumberInput = _ref => {
|
|
|
58
49
|
}
|
|
59
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
51
|
}, [value]);
|
|
52
|
+
|
|
53
|
+
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
54
|
+
(0, _react.useEffect)(() => {
|
|
55
|
+
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
56
|
+
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
57
|
+
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
}, []);
|
|
61
61
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
|
|
62
62
|
keyboardType: "numeric",
|
|
63
63
|
value: currentStringNumberValue,
|
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
height: deviceHeight
|
|
43
43
|
} = _reactNative.Dimensions.get("screen");
|
|
44
44
|
const isIos = _reactNative.Platform.OS === "ios";
|
|
45
|
+
const isWeb = _reactNative.Platform.OS === "web";
|
|
45
46
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
46
47
|
const disabledColor = "rgb(240, 240, 240)";
|
|
47
48
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -65,7 +66,8 @@ const Picker = _ref => {
|
|
|
65
66
|
leftIconName,
|
|
66
67
|
placeholderTextColor = unstyledColor,
|
|
67
68
|
rightIconName,
|
|
68
|
-
type = "solid"
|
|
69
|
+
type = "solid",
|
|
70
|
+
autoDismissKeyboard = true
|
|
69
71
|
} = _ref;
|
|
70
72
|
const androidPickerRef = React.useRef(undefined);
|
|
71
73
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -89,6 +91,11 @@ const Picker = _ref => {
|
|
|
89
91
|
androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
|
|
90
92
|
}
|
|
91
93
|
}, [pickerVisible, androidPickerRef]);
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
96
|
+
_reactNative.Keyboard.dismiss();
|
|
97
|
+
}
|
|
98
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
92
99
|
const normalizedOptions = normalizeOptions(options);
|
|
93
100
|
const pickerOptions = placeholder ? [{
|
|
94
101
|
value: placeholder,
|
|
@@ -233,8 +240,8 @@ const Picker = _ref => {
|
|
|
233
240
|
label: option.label,
|
|
234
241
|
value: option.value,
|
|
235
242
|
key: option.value
|
|
236
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
237
|
-
enabled:
|
|
243
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
244
|
+
enabled: !disabled,
|
|
238
245
|
selectedValue: internalValue,
|
|
239
246
|
onValueChange: handleValueChange,
|
|
240
247
|
style: styles.nonIosPicker,
|
|
@@ -8,54 +8,28 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
14
|
/**
|
|
12
15
|
* Portal host is the component which actually renders all Portals.
|
|
13
16
|
*/
|
|
14
17
|
class PortalManager extends React.PureComponent {
|
|
15
18
|
constructor() {
|
|
16
19
|
super(...arguments);
|
|
17
|
-
this
|
|
20
|
+
_defineProperty(this, "state", {
|
|
18
21
|
portals: []
|
|
19
|
-
};
|
|
20
|
-
this
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(this, "mount", (key, children) => {
|
|
21
24
|
this.setState(state => ({
|
|
22
25
|
portals: [...state.portals, {
|
|
23
26
|
key,
|
|
24
27
|
children
|
|
25
28
|
}]
|
|
26
29
|
}));
|
|
27
|
-
};
|
|
28
|
-
this.update = (key, children) => this.setState(state => ({
|
|
29
|
-
portals: state.portals.map(item => {
|
|
30
|
-
if (item.key === key) {
|
|
31
|
-
return {
|
|
32
|
-
...item,
|
|
33
|
-
children
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return item;
|
|
37
|
-
})
|
|
38
|
-
}));
|
|
39
|
-
this.unmount = key => this.setState(state => ({
|
|
40
|
-
portals: state.portals.filter(item => item.key !== key)
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
render() {
|
|
44
|
-
return this.state.portals.map(_ref => {
|
|
45
|
-
let {
|
|
46
|
-
key,
|
|
47
|
-
children
|
|
48
|
-
} = _ref;
|
|
49
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
50
|
-
key: key,
|
|
51
|
-
collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */,
|
|
52
|
-
pointerEvents: "box-none",
|
|
53
|
-
style: _reactNative.StyleSheet.absoluteFill
|
|
54
|
-
}, children);
|
|
55
30
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
exports.default = PortalManager;tate.portals.map(item => {
|
|
31
|
+
_defineProperty(this, "update", (key, children) => this.setState(state => ({
|
|
32
|
+
portals: state.portals.map(item => {
|
|
59
33
|
if (item.key === key) {
|
|
60
34
|
return {
|
|
61
35
|
...item,
|
|
@@ -37,7 +37,8 @@ const SEED_DATA_PROPS = {
|
|
|
37
37
|
label: "Border Color"
|
|
38
38
|
}),
|
|
39
39
|
borderColorActive: (0, _types.createColorProp)({
|
|
40
|
-
label: "Border Color"
|
|
40
|
+
label: "Active Border Color",
|
|
41
|
+
description: "Color of border when date picker is active"
|
|
41
42
|
}),
|
|
42
43
|
format: {
|
|
43
44
|
label: "Format",
|
|
@@ -169,7 +170,12 @@ const SEED_DATA = [{
|
|
|
169
170
|
editable: true,
|
|
170
171
|
required: true,
|
|
171
172
|
group: _types.GROUPS.basic
|
|
172
|
-
}
|
|
173
|
+
},
|
|
174
|
+
autoDismissKeyboard: (0, _types.createStaticBoolProp)({
|
|
175
|
+
label: "Auto dismiss keyboard",
|
|
176
|
+
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
177
|
+
defaultValue: true
|
|
178
|
+
})
|
|
173
179
|
}
|
|
174
180
|
}];
|
|
175
181
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -11,6 +11,9 @@ const SEED_DATA = {
|
|
|
11
11
|
description: "Deck swiper container",
|
|
12
12
|
category: _types.COMPONENT_TYPES.swiper,
|
|
13
13
|
stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
|
|
14
|
+
layout: {
|
|
15
|
+
width: "100%"
|
|
16
|
+
},
|
|
14
17
|
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
15
18
|
props: {
|
|
16
19
|
onIndexChanged: (0, _types.createActionProp)({
|
|
@@ -11,6 +11,13 @@ const SEED_DATA = {
|
|
|
11
11
|
description: "Single Deck Swiper Card item to be used in DeckSwiper",
|
|
12
12
|
category: _types.COMPONENT_TYPES.swiper,
|
|
13
13
|
stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
14
|
+
layout: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
padding: 20,
|
|
19
|
+
borderWidth: 2
|
|
20
|
+
},
|
|
14
21
|
props: {}
|
|
15
22
|
};
|
|
16
23
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -14,7 +14,6 @@ const SEED_DATA = [{
|
|
|
14
14
|
preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
|
|
15
15
|
supports_list_render: false,
|
|
16
16
|
triggers: [_types.Triggers.OnChange],
|
|
17
|
-
// TODO Triggers.OnSubmit for multiple triggers
|
|
18
17
|
props: {
|
|
19
18
|
icon: {
|
|
20
19
|
group: _types.GROUPS.basic,
|
|
@@ -53,4 +52,7 @@ const SEED_DATA = [{
|
|
|
53
52
|
},
|
|
54
53
|
layout: {}
|
|
55
54
|
}];
|
|
55
|
+
exports.SEED_DATA = SEED_DATA;},
|
|
56
|
+
layout: {}
|
|
57
|
+
}];
|
|
56
58
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -142,6 +142,11 @@ const SEED_DATA = [{
|
|
|
142
142
|
}),
|
|
143
143
|
iconColor: (0, _types.createColorProp)({
|
|
144
144
|
label: "Icon Color"
|
|
145
|
+
}),
|
|
146
|
+
autoDismissKeyboard: (0, _types.createStaticBoolProp)({
|
|
147
|
+
label: "Auto dismiss keyboard",
|
|
148
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
149
|
+
defaultValue: true
|
|
145
150
|
})
|
|
146
151
|
},
|
|
147
152
|
layout: {}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Animated, Easing } from "react-native";
|
|
3
4
|
import CircularProgress from "./CircularProgress";
|
|
@@ -45,19 +46,6 @@ const AnimatedCircularProgress = _ref => {
|
|
|
45
46
|
React.useEffect(() => {
|
|
46
47
|
animate();
|
|
47
48
|
}, [fill, animate]);
|
|
48
|
-
return /*#__PURE__*/React.createElement(AnimatedProgress, {
|
|
49
|
-
...other,
|
|
50
|
-
style: other.style,
|
|
51
|
-
childrenContainerStyle: other.childrenContainerStyle,
|
|
52
|
-
fill: fillAnimation,
|
|
53
|
-
tintColor: animateColor()
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
export default AnimatedCircularProgress;imation;
|
|
57
|
-
};
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
animate();
|
|
60
|
-
}, [fill, animate]);
|
|
61
49
|
return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
|
|
62
50
|
style: other.style,
|
|
63
51
|
childrenContainerStyle: other.childrenContainerStyle,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, ImageBackground, StyleSheet } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -63,10 +64,9 @@ const Container = _ref => {
|
|
|
63
64
|
};
|
|
64
65
|
const Wrap = elevation ? Elevation : View;
|
|
65
66
|
if (elevation) containerStyle.elevation = elevation;
|
|
66
|
-
return /*#__PURE__*/React.createElement(Wrap, {
|
|
67
|
-
style: [containerStyle, style]
|
|
68
|
-
|
|
69
|
-
}, backgroundImage ? /*#__PURE__*/React.createElement(ImageBackground, {
|
|
67
|
+
return /*#__PURE__*/React.createElement(Wrap, _extends({
|
|
68
|
+
style: [containerStyle, style]
|
|
69
|
+
}, rest), backgroundImage ? /*#__PURE__*/React.createElement(ImageBackground, {
|
|
70
70
|
source: typeof backgroundImage === "string" ? {
|
|
71
71
|
uri: backgroundImage
|
|
72
72
|
} : backgroundImage,
|
|
@@ -80,17 +80,4 @@ const Container = _ref => {
|
|
|
80
80
|
style: innerStyle
|
|
81
81
|
}, children));
|
|
82
82
|
};
|
|
83
|
-
export default withTheme(Container);ring" ? {
|
|
84
|
-
uri: backgroundImage
|
|
85
|
-
} : backgroundImage,
|
|
86
|
-
resizeMode: backgroundImageResizeMode,
|
|
87
|
-
style: {
|
|
88
|
-
flex: 1
|
|
89
|
-
}
|
|
90
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
91
|
-
style: innerStyle
|
|
92
|
-
}, children)) : /*#__PURE__*/React.createElement(View, {
|
|
93
|
-
style: innerStyle
|
|
94
|
-
}, children));
|
|
95
|
-
};
|
|
96
83
|
export default withTheme(Container);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput } from "react-native";
|
|
3
|
+
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, Keyboard } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import dateFormat from "dateformat";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
@@ -39,6 +39,7 @@ const DatePicker = _ref => {
|
|
|
39
39
|
placeholder,
|
|
40
40
|
borderColor: inputBorderColor,
|
|
41
41
|
borderColorActive: inputBorderColorActive,
|
|
42
|
+
autoDismissKeyboard = true,
|
|
42
43
|
...props
|
|
43
44
|
} = _ref;
|
|
44
45
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -134,6 +135,11 @@ const DatePicker = _ref => {
|
|
|
134
135
|
clearTimeout(_showPlaceholder());
|
|
135
136
|
};
|
|
136
137
|
}, [focused, label, placeholder]);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
140
|
+
Keyboard.dismiss();
|
|
141
|
+
}
|
|
142
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
137
143
|
const _handleFocus = () => {
|
|
138
144
|
if (disabled) {
|
|
139
145
|
return;
|
|
@@ -151,7 +157,14 @@ const DatePicker = _ref => {
|
|
|
151
157
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
152
158
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
153
159
|
const hasActiveOutline = focused;
|
|
154
|
-
let inputTextColor,
|
|
160
|
+
let inputTextColor,
|
|
161
|
+
activeColor,
|
|
162
|
+
underlineColor,
|
|
163
|
+
borderColor = inputBorderColor,
|
|
164
|
+
placeholderColor,
|
|
165
|
+
containerStyle,
|
|
166
|
+
backgroundColor,
|
|
167
|
+
inputStyle;
|
|
155
168
|
inputTextColor = colors.strong;
|
|
156
169
|
if (disabled) {
|
|
157
170
|
activeColor = colors.light;
|
|
@@ -19,12 +19,13 @@ const DeckSwiper = _ref => {
|
|
|
19
19
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* By default react-native-deck-swiper positions everything with absolute position
|
|
23
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure
|
|
22
|
+
* By default react-native-deck-swiper positions everything with absolute position.
|
|
23
|
+
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
27
|
+
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
28
|
+
* This effectivley makes the default height of the container be the height of the first card.
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
31
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
@@ -10,7 +10,6 @@ const DeckSwiperCard = _ref => {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement(View, {
|
|
11
11
|
style: [styles.card, {
|
|
12
12
|
backgroundColor: theme.colors.background,
|
|
13
|
-
borderRadius: theme.borderRadius.global,
|
|
14
13
|
borderColor: theme.colors.divider
|
|
15
14
|
}, style]
|
|
16
15
|
}, children);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
4
3
|
import color from "color";
|
|
@@ -75,7 +74,8 @@ const Button = _ref => {
|
|
|
75
74
|
elevation,
|
|
76
75
|
alignSelf: "stretch"
|
|
77
76
|
}
|
|
78
|
-
}, /*#__PURE__*/React.createElement(Pressable,
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
78
|
+
...rest,
|
|
79
79
|
onPress: onPress,
|
|
80
80
|
accessibilityState: {
|
|
81
81
|
disabled
|
|
@@ -83,7 +83,7 @@ const Button = _ref => {
|
|
|
83
83
|
accessibilityRole: "button",
|
|
84
84
|
disabled: disabled || loading,
|
|
85
85
|
style: [styles.button, buttonStyle]
|
|
86
|
-
}
|
|
86
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
87
87
|
style: styles.content
|
|
88
88
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
89
89
|
style: iconStyle
|
|
@@ -114,4 +114,22 @@ const styles = StyleSheet.create({
|
|
|
114
114
|
width: Config.buttonIconSize
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
+
export default withTheme(Button);: 1,
|
|
118
|
+
style: [textStyle, typography.button]
|
|
119
|
+
}, children))));
|
|
120
|
+
};
|
|
121
|
+
const styles = StyleSheet.create({
|
|
122
|
+
button: {
|
|
123
|
+
minWidth: 64,
|
|
124
|
+
borderStyle: "solid"
|
|
125
|
+
},
|
|
126
|
+
content: {
|
|
127
|
+
flexDirection: "row",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
justifyContent: "center"
|
|
130
|
+
},
|
|
131
|
+
icon: {
|
|
132
|
+
width: Config.buttonIconSize
|
|
133
|
+
}
|
|
134
|
+
});
|
|
117
135
|
export default withTheme(Button);
|
|
@@ -1,24 +1,7 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { StyleSheet, View } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
4
|
-
const Divider = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
style,
|
|
7
|
-
color,
|
|
8
|
-
theme: {
|
|
9
|
-
colors
|
|
10
|
-
},
|
|
11
|
-
...rest
|
|
12
|
-
} = _ref;
|
|
13
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
14
|
-
style: [{
|
|
15
|
-
backgroundColor: color || colors.divider,
|
|
16
|
-
height: StyleSheet.hairlineWidth
|
|
17
|
-
}, style],
|
|
18
|
-
...rest
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
export default withTheme(Divider);ing";
|
|
22
5
|
const Divider = _ref => {
|
|
23
6
|
let {
|
|
24
7
|
style,
|
|
@@ -24,17 +24,8 @@ const NumberInput = _ref => {
|
|
|
24
24
|
return valueToFormat.toString();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
return "
|
|
27
|
+
return "";
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
33
|
-
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
34
|
-
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
35
|
-
}
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
-
}, []);
|
|
38
29
|
const handleChangeText = newValue => {
|
|
39
30
|
const newStringNumberValue = formatValueToStringNumber(newValue);
|
|
40
31
|
const number = parseFloat(newStringNumberValue);
|
|
@@ -50,6 +41,15 @@ const NumberInput = _ref => {
|
|
|
50
41
|
}
|
|
51
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
43
|
}, [value]);
|
|
44
|
+
|
|
45
|
+
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
48
|
+
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
49
|
+
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
53
|
return /*#__PURE__*/React.createElement(TextInput, _extends({
|
|
54
54
|
keyboardType: "numeric",
|
|
55
55
|
value: currentStringNumberValue,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions, Keyboard } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
height: deviceHeight
|
|
34
34
|
} = Dimensions.get("screen");
|
|
35
35
|
const isIos = Platform.OS === "ios";
|
|
36
|
+
const isWeb = Platform.OS === "web";
|
|
36
37
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
37
38
|
const disabledColor = "rgb(240, 240, 240)";
|
|
38
39
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -56,7 +57,8 @@ const Picker = _ref => {
|
|
|
56
57
|
leftIconName,
|
|
57
58
|
placeholderTextColor = unstyledColor,
|
|
58
59
|
rightIconName,
|
|
59
|
-
type = "solid"
|
|
60
|
+
type = "solid",
|
|
61
|
+
autoDismissKeyboard = true
|
|
60
62
|
} = _ref;
|
|
61
63
|
const androidPickerRef = React.useRef(undefined);
|
|
62
64
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -80,6 +82,11 @@ const Picker = _ref => {
|
|
|
80
82
|
androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
|
|
81
83
|
}
|
|
82
84
|
}, [pickerVisible, androidPickerRef]);
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
87
|
+
Keyboard.dismiss();
|
|
88
|
+
}
|
|
89
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
83
90
|
const normalizedOptions = normalizeOptions(options);
|
|
84
91
|
const pickerOptions = placeholder ? [{
|
|
85
92
|
value: placeholder,
|
|
@@ -224,8 +231,8 @@ const Picker = _ref => {
|
|
|
224
231
|
label: option.label,
|
|
225
232
|
value: option.value,
|
|
226
233
|
key: option.value
|
|
227
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
228
|
-
enabled:
|
|
234
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
235
|
+
enabled: !disabled,
|
|
229
236
|
selectedValue: internalValue,
|
|
230
237
|
onValueChange: handleValueChange,
|
|
231
238
|
style: styles.nonIosPicker,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, StyleSheet } from "react-native";
|
|
3
4
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -7,6 +8,7 @@ import { extractStyles } from "../../utilities";
|
|
|
7
8
|
import TextField from "../TextField";
|
|
8
9
|
import Touchable from "../Touchable";
|
|
9
10
|
const Picker = _ref => {
|
|
11
|
+
var _options$find$label, _options$find;
|
|
10
12
|
let {
|
|
11
13
|
style,
|
|
12
14
|
options,
|
|
@@ -16,7 +18,6 @@ const Picker = _ref => {
|
|
|
16
18
|
onValueChange: onValueChangeOverride = () => {},
|
|
17
19
|
...props
|
|
18
20
|
} = _ref;
|
|
19
|
-
var _a, _b;
|
|
20
21
|
const {
|
|
21
22
|
viewStyles: {
|
|
22
23
|
borderRadius,
|
|
@@ -61,7 +62,7 @@ const Picker = _ref => {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
64
|
-
const selectedLabel = selectedValue && ((
|
|
65
|
+
const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
|
|
65
66
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
66
67
|
disabled: disabled,
|
|
67
68
|
onPress: toggleFocus,
|
|
@@ -84,25 +85,6 @@ const Picker = _ref => {
|
|
|
84
85
|
label: o.label,
|
|
85
86
|
value: o.value,
|
|
86
87
|
key: o.value
|
|
87
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
88
|
-
pointerEvents: "none"
|
|
89
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
90
|
-
...props,
|
|
91
|
-
value: selectedLabel,
|
|
92
|
-
placeholder: placeholder,
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
ref: textField,
|
|
95
|
-
disabled: disabled,
|
|
96
|
-
// @ts-expect-error
|
|
97
|
-
style: stylesWithoutMargin
|
|
98
|
-
}))));
|
|
99
|
-
};
|
|
100
|
-
const styles = StyleSheet.create({
|
|
101
|
-
container: {
|
|
102
|
-
alignSelf: "stretch"
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
export default withTheme(Picker);y: o.value
|
|
106
88
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
107
89
|
pointerEvents: "none"
|
|
108
90
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Pressable as NativePressable } from "react-native";
|
|
3
4
|
export default function Pressable(_ref) {
|
|
@@ -12,22 +13,8 @@ export default function Pressable(_ref) {
|
|
|
12
13
|
style,
|
|
13
14
|
...props
|
|
14
15
|
} = _ref;
|
|
15
|
-
return /*#__PURE__*/React.createElement(NativePressable, {
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
16
17
|
onPress: onPress,
|
|
17
|
-
disabled: disabled,
|
|
18
|
-
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
19
|
-
hitSlop: hitSlop ? hitSlop : 8,
|
|
20
|
-
style: _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
pressed
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return [{
|
|
25
|
-
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
26
|
-
}, style];
|
|
27
|
-
},
|
|
28
|
-
...props
|
|
29
|
-
}, children);
|
|
30
|
-
} onPress: onPress,
|
|
31
18
|
disabled: disabled,
|
|
32
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
33
20
|
hitSlop: hitSlop ? hitSlop : 8,
|