@draftbit/core 46.10.2-30afd1.2 → 46.10.2-b59d51.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/FAB.js +18 -4
- package/lib/commonjs/components/Picker/Picker.js +3 -13
- package/lib/module/components/Accordion/AccordionItem.js +4 -25
- package/lib/module/components/Picker/Picker.js +3 -13
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Picker/Picker.js +3 -12
- package/src/components/Picker/Picker.tsx +3 -12
|
@@ -9,7 +9,6 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _theming = require("../theming");
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
|
-
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); }
|
|
13
12
|
const FAB = _ref => {
|
|
14
13
|
let {
|
|
15
14
|
onPress,
|
|
@@ -33,7 +32,7 @@ const FAB = _ref => {
|
|
|
33
32
|
borderRadius: size / 2,
|
|
34
33
|
overflow: "hidden"
|
|
35
34
|
}, style]
|
|
36
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
35
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
37
36
|
onPress: onPress,
|
|
38
37
|
disabled: loading || disabled,
|
|
39
38
|
android_ripple: {
|
|
@@ -51,8 +50,9 @@ const FAB = _ref => {
|
|
|
51
50
|
borderRadius: size / 2,
|
|
52
51
|
backgroundColor
|
|
53
52
|
}];
|
|
54
|
-
}
|
|
55
|
-
|
|
53
|
+
},
|
|
54
|
+
...props
|
|
55
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, null, loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
56
56
|
style: size > 50 ? {
|
|
57
57
|
marginTop: 2,
|
|
58
58
|
marginLeft: 2
|
|
@@ -79,4 +79,18 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
var _default = (0, _theming.withTheme)(FAB);
|
|
82
|
+
exports.default = _default; styles = _reactNative.StyleSheet.create({
|
|
83
|
+
button: {
|
|
84
|
+
backgroundColor: "#5a45ff",
|
|
85
|
+
justifyContent: "center",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
..._reactNative.Platform.select({
|
|
88
|
+
web: {
|
|
89
|
+
cursor: "pointer",
|
|
90
|
+
userSelect: "none"
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
var _default = (0, _theming.withTheme)(FAB);
|
|
82
96
|
exports.default = _default;
|
|
@@ -58,7 +58,7 @@ const Picker = _ref => {
|
|
|
58
58
|
defaultValue,
|
|
59
59
|
Icon,
|
|
60
60
|
style,
|
|
61
|
-
placeholder
|
|
61
|
+
placeholder,
|
|
62
62
|
value,
|
|
63
63
|
disabled = false,
|
|
64
64
|
assistiveText,
|
|
@@ -99,14 +99,7 @@ const Picker = _ref => {
|
|
|
99
99
|
_reactNative.Keyboard.dismiss();
|
|
100
100
|
}
|
|
101
101
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
105
|
-
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
106
|
-
const pickerOptions = placeholder ? [{
|
|
107
|
-
label: placeholder,
|
|
108
|
-
value: placeholder
|
|
109
|
-
}, ...normalizedOptions] : normalizedOptions;
|
|
102
|
+
const pickerOptions = normalizeOptions(options);
|
|
110
103
|
const {
|
|
111
104
|
viewStyles,
|
|
112
105
|
textStyles
|
|
@@ -206,12 +199,9 @@ const Picker = _ref => {
|
|
|
206
199
|
} : {})
|
|
207
200
|
};
|
|
208
201
|
const handleValueChange = (newValue, itemIndex) => {
|
|
209
|
-
if (newValue !== ""
|
|
202
|
+
if (newValue !== "") {
|
|
210
203
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
211
204
|
setInternalValue(newValue);
|
|
212
|
-
} else if (newValue === placeholder) {
|
|
213
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
|
|
214
|
-
setInternalValue(undefined);
|
|
215
205
|
}
|
|
216
206
|
};
|
|
217
207
|
return (
|
|
@@ -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 { Pressable, StyleSheet, View } from "react-native";
|
|
3
4
|
import Text from "../Text";
|
|
@@ -17,10 +18,9 @@ const AccordionItem = _ref => {
|
|
|
17
18
|
textStyles,
|
|
18
19
|
viewStyles
|
|
19
20
|
} = extractStyles(style);
|
|
20
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
21
|
-
style: [styles.container, viewStyles]
|
|
22
|
-
|
|
23
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
21
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
22
|
+
style: [styles.container, viewStyles]
|
|
23
|
+
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
24
24
|
style: styles.row
|
|
25
25
|
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
26
26
|
name: icon,
|
|
@@ -51,25 +51,4 @@ const styles = StyleSheet.create({
|
|
|
51
51
|
justifyContent: "center"
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
export default withTheme(AccordionItem);xtStyles
|
|
55
|
-
}, label))));
|
|
56
|
-
};
|
|
57
|
-
const styles = StyleSheet.create({
|
|
58
|
-
container: {
|
|
59
|
-
padding: 8
|
|
60
|
-
},
|
|
61
|
-
row: {
|
|
62
|
-
flexDirection: "row",
|
|
63
|
-
alignItems: "center",
|
|
64
|
-
paddingLeft: 8
|
|
65
|
-
},
|
|
66
|
-
item: {
|
|
67
|
-
marginVertical: 6,
|
|
68
|
-
paddingLeft: 8
|
|
69
|
-
},
|
|
70
|
-
content: {
|
|
71
|
-
flex: 1,
|
|
72
|
-
justifyContent: "center"
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
54
|
export default withTheme(AccordionItem);
|
|
@@ -49,7 +49,7 @@ const Picker = _ref => {
|
|
|
49
49
|
defaultValue,
|
|
50
50
|
Icon,
|
|
51
51
|
style,
|
|
52
|
-
placeholder
|
|
52
|
+
placeholder,
|
|
53
53
|
value,
|
|
54
54
|
disabled = false,
|
|
55
55
|
assistiveText,
|
|
@@ -90,14 +90,7 @@ const Picker = _ref => {
|
|
|
90
90
|
Keyboard.dismiss();
|
|
91
91
|
}
|
|
92
92
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
96
|
-
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
97
|
-
const pickerOptions = placeholder ? [{
|
|
98
|
-
label: placeholder,
|
|
99
|
-
value: placeholder
|
|
100
|
-
}, ...normalizedOptions] : normalizedOptions;
|
|
93
|
+
const pickerOptions = normalizeOptions(options);
|
|
101
94
|
const {
|
|
102
95
|
viewStyles,
|
|
103
96
|
textStyles
|
|
@@ -197,12 +190,9 @@ const Picker = _ref => {
|
|
|
197
190
|
} : {})
|
|
198
191
|
};
|
|
199
192
|
const handleValueChange = (newValue, itemIndex) => {
|
|
200
|
-
if (newValue !== ""
|
|
193
|
+
if (newValue !== "") {
|
|
201
194
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
202
195
|
setInternalValue(newValue);
|
|
203
|
-
} else if (newValue === placeholder) {
|
|
204
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
|
|
205
|
-
setInternalValue(undefined);
|
|
206
196
|
}
|
|
207
197
|
};
|
|
208
198
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAA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K,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AAyaF,wBAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.10.2-
|
|
3
|
+
"version": "46.10.2-b59d51.2+b59d512",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.10.2-
|
|
44
|
+
"@draftbit/types": "^46.10.2-b59d51.2+b59d512",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
]
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "b59d512ac6d80b7afb4a89df601d77b5887b5218"
|
|
104
104
|
}
|
|
@@ -38,7 +38,7 @@ const disabledColor = "rgb(240, 240, 240)";
|
|
|
38
38
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
39
39
|
//Empty string for 'value' is treated as a non-value
|
|
40
40
|
//reason: Draftbit uses empty string as initial value for string state*/
|
|
41
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder
|
|
41
|
+
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
const androidPickerRef = React.useRef(undefined);
|
|
44
44
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -67,12 +67,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
67
67
|
Keyboard.dismiss();
|
|
68
68
|
}
|
|
69
69
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
70
|
-
const
|
|
71
|
-
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
72
|
-
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
73
|
-
const pickerOptions = placeholder
|
|
74
|
-
? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
|
|
75
|
-
: normalizedOptions;
|
|
70
|
+
const pickerOptions = normalizeOptions(options);
|
|
76
71
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
77
72
|
const additionalBorderStyles = ["backgroundColor"];
|
|
78
73
|
const additionalMarginStyles = [
|
|
@@ -167,14 +162,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
167
162
|
...(disabled ? { color: unstyledColor } : {}),
|
|
168
163
|
};
|
|
169
164
|
const handleValueChange = (newValue, itemIndex) => {
|
|
170
|
-
if (newValue !== ""
|
|
165
|
+
if (newValue !== "") {
|
|
171
166
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
172
167
|
setInternalValue(newValue);
|
|
173
168
|
}
|
|
174
|
-
else if (newValue === placeholder) {
|
|
175
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
|
|
176
|
-
setInternalValue(undefined);
|
|
177
|
-
}
|
|
178
169
|
};
|
|
179
170
|
return (
|
|
180
171
|
/* marginsContainer */
|
|
@@ -101,7 +101,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
101
101
|
defaultValue,
|
|
102
102
|
Icon,
|
|
103
103
|
style,
|
|
104
|
-
placeholder
|
|
104
|
+
placeholder,
|
|
105
105
|
value,
|
|
106
106
|
disabled = false,
|
|
107
107
|
assistiveText,
|
|
@@ -151,13 +151,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
151
151
|
}
|
|
152
152
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
153
153
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
157
|
-
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
158
|
-
const pickerOptions = placeholder
|
|
159
|
-
? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
|
|
160
|
-
: normalizedOptions;
|
|
154
|
+
const pickerOptions = normalizeOptions(options);
|
|
161
155
|
|
|
162
156
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
163
157
|
|
|
@@ -308,12 +302,9 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
308
302
|
};
|
|
309
303
|
|
|
310
304
|
const handleValueChange = (newValue: string, itemIndex: number) => {
|
|
311
|
-
if (newValue !== ""
|
|
305
|
+
if (newValue !== "") {
|
|
312
306
|
onValueChange?.(newValue, itemIndex);
|
|
313
307
|
setInternalValue(newValue);
|
|
314
|
-
} else if (newValue === placeholder) {
|
|
315
|
-
onValueChange?.("", 0);
|
|
316
|
-
setInternalValue(undefined);
|
|
317
308
|
}
|
|
318
309
|
};
|
|
319
310
|
|