@draftbit/core 46.7.8-9c448b.2 → 46.7.9-437259.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/Picker/Picker.js +7 -13
- package/lib/module/components/IconButton.js +21 -4
- package/lib/module/components/Picker/Picker.js +7 -13
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Picker/Picker.js +5 -11
- package/src/components/Picker/Picker.tsx +6 -16
|
@@ -57,7 +57,6 @@ const Picker = _ref => {
|
|
|
57
57
|
placeholder,
|
|
58
58
|
value,
|
|
59
59
|
disabled = false,
|
|
60
|
-
theme,
|
|
61
60
|
assistiveText,
|
|
62
61
|
label,
|
|
63
62
|
iconColor = unstyledColor,
|
|
@@ -95,9 +94,6 @@ const Picker = _ref => {
|
|
|
95
94
|
value: placeholder,
|
|
96
95
|
label: placeholder
|
|
97
96
|
}, ...normalizedOptions] : normalizedOptions;
|
|
98
|
-
const {
|
|
99
|
-
colors
|
|
100
|
-
} = theme;
|
|
101
97
|
const {
|
|
102
98
|
viewStyles,
|
|
103
99
|
textStyles
|
|
@@ -220,12 +216,10 @@ const Picker = _ref => {
|
|
|
220
216
|
style: styles.primaryTextContainer
|
|
221
217
|
}, labelText, /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
222
218
|
style: primaryTextStyle
|
|
223
|
-
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(
|
|
224
|
-
style:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
|
|
228
|
-
style: styles.iosSafeArea
|
|
219
|
+
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
|
|
220
|
+
style: styles.iosPicker
|
|
221
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
222
|
+
style: styles.iosPickerContent
|
|
229
223
|
}, /*#__PURE__*/React.createElement(_DeprecatedButton.default, {
|
|
230
224
|
Icon: Icon,
|
|
231
225
|
type: "text",
|
|
@@ -297,10 +291,10 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
297
291
|
justifyContent: "center",
|
|
298
292
|
width: "100%",
|
|
299
293
|
maxWidth: deviceWidth,
|
|
300
|
-
maxHeight: deviceHeight
|
|
294
|
+
maxHeight: deviceHeight,
|
|
295
|
+
backgroundColor: "white"
|
|
301
296
|
},
|
|
302
|
-
|
|
303
|
-
backgroundColor: "white",
|
|
297
|
+
iosPickerContent: {
|
|
304
298
|
flexDirection: "column",
|
|
305
299
|
width: "100%",
|
|
306
300
|
maxWidth: deviceWidth
|
|
@@ -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 { View, StyleSheet, ActivityIndicator, Pressable, Platform } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -18,7 +17,7 @@ const IconButton = _ref => {
|
|
|
18
17
|
...props
|
|
19
18
|
} = _ref;
|
|
20
19
|
const iconColor = customColor || theme.colors.primary;
|
|
21
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
20
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
22
21
|
onPress: onPress,
|
|
23
22
|
disabled: disabled || loading,
|
|
24
23
|
style: _ref2 => {
|
|
@@ -32,8 +31,9 @@ const IconButton = _ref => {
|
|
|
32
31
|
alignItems: "center",
|
|
33
32
|
justifyContent: "center"
|
|
34
33
|
}, style];
|
|
35
|
-
}
|
|
36
|
-
|
|
34
|
+
},
|
|
35
|
+
...props
|
|
36
|
+
}, /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
|
|
37
37
|
name: icon,
|
|
38
38
|
size: size - 2,
|
|
39
39
|
color: iconColor
|
|
@@ -54,4 +54,21 @@ const styles = StyleSheet.create({
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
+
export default withTheme(IconButton);ement(ActivityIndicator, {
|
|
58
|
+
size: "small",
|
|
59
|
+
color: iconColor
|
|
60
|
+
}) : null));
|
|
61
|
+
};
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
container: {
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "center",
|
|
66
|
+
...Platform.select({
|
|
67
|
+
web: {
|
|
68
|
+
cursor: "pointer",
|
|
69
|
+
userSelect: "none"
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
});
|
|
57
74
|
export default withTheme(IconButton);
|
|
@@ -48,7 +48,6 @@ const Picker = _ref => {
|
|
|
48
48
|
placeholder,
|
|
49
49
|
value,
|
|
50
50
|
disabled = false,
|
|
51
|
-
theme,
|
|
52
51
|
assistiveText,
|
|
53
52
|
label,
|
|
54
53
|
iconColor = unstyledColor,
|
|
@@ -86,9 +85,6 @@ const Picker = _ref => {
|
|
|
86
85
|
value: placeholder,
|
|
87
86
|
label: placeholder
|
|
88
87
|
}, ...normalizedOptions] : normalizedOptions;
|
|
89
|
-
const {
|
|
90
|
-
colors
|
|
91
|
-
} = theme;
|
|
92
88
|
const {
|
|
93
89
|
viewStyles,
|
|
94
90
|
textStyles
|
|
@@ -211,12 +207,10 @@ const Picker = _ref => {
|
|
|
211
207
|
style: styles.primaryTextContainer
|
|
212
208
|
}, labelText, /*#__PURE__*/React.createElement(Text, {
|
|
213
209
|
style: primaryTextStyle
|
|
214
|
-
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(
|
|
215
|
-
style:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}, /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
219
|
-
style: styles.iosSafeArea
|
|
210
|
+
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
211
|
+
style: styles.iosPicker
|
|
212
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
213
|
+
style: styles.iosPickerContent
|
|
220
214
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
221
215
|
Icon: Icon,
|
|
222
216
|
type: "text",
|
|
@@ -288,10 +282,10 @@ const styles = StyleSheet.create({
|
|
|
288
282
|
justifyContent: "center",
|
|
289
283
|
width: "100%",
|
|
290
284
|
maxWidth: deviceWidth,
|
|
291
|
-
maxHeight: deviceHeight
|
|
285
|
+
maxHeight: deviceHeight,
|
|
286
|
+
backgroundColor: "white"
|
|
292
287
|
},
|
|
293
|
-
|
|
294
|
-
backgroundColor: "white",
|
|
288
|
+
iosPickerContent: {
|
|
295
289
|
flexDirection: "column",
|
|
296
290
|
width: "100%",
|
|
297
291
|
maxWidth: deviceWidth
|
|
@@ -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,EAEV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2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"46.7.
|
|
3
|
+
"version": "46.7.9-437259.2+437259f",
|
|
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.7.
|
|
44
|
+
"@draftbit/types": "^46.7.9-437259.2+437259f",
|
|
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",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
]
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "437259f8dc889b1b26cadfda9f0a30caa2788d25"
|
|
96
96
|
}
|
|
@@ -35,7 +35,7 @@ const isIos = Platform.OS === "ios";
|
|
|
35
35
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
36
36
|
const disabledColor = "rgb(240, 240, 240)";
|
|
37
37
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
38
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false,
|
|
38
|
+
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", }) => {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
const androidPickerRef = React.useRef(undefined);
|
|
41
41
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -63,7 +63,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
63
63
|
const pickerOptions = placeholder
|
|
64
64
|
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
65
65
|
: normalizedOptions;
|
|
66
|
-
const { colors } = theme;
|
|
67
66
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
68
67
|
const additionalBorderStyles = ["backgroundColor"];
|
|
69
68
|
const additionalMarginStyles = [
|
|
@@ -183,13 +182,8 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
183
182
|
rightIcon)),
|
|
184
183
|
assistiveTextLabel),
|
|
185
184
|
isIos && pickerVisible ? (React.createElement(Portal, null,
|
|
186
|
-
React.createElement(
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
backgroundColor: colors.divider,
|
|
190
|
-
},
|
|
191
|
-
] },
|
|
192
|
-
React.createElement(SafeAreaView, { style: styles.iosSafeArea },
|
|
185
|
+
React.createElement(SafeAreaView, { style: styles.iosPicker },
|
|
186
|
+
React.createElement(View, { style: styles.iosPickerContent },
|
|
193
187
|
React.createElement(Button, { Icon: Icon, type: "text", onPress: togglePickerVisible, style: styles.iosButton }, "Close"),
|
|
194
188
|
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
195
189
|
!isIos && pickerVisible ? (React.createElement(NativePicker, { enabled: pickerVisible, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
@@ -239,9 +233,9 @@ const styles = StyleSheet.create({
|
|
|
239
233
|
width: "100%",
|
|
240
234
|
maxWidth: deviceWidth,
|
|
241
235
|
maxHeight: deviceHeight,
|
|
242
|
-
},
|
|
243
|
-
iosSafeArea: {
|
|
244
236
|
backgroundColor: "white",
|
|
237
|
+
},
|
|
238
|
+
iosPickerContent: {
|
|
245
239
|
flexDirection: "column",
|
|
246
240
|
width: "100%",
|
|
247
241
|
maxWidth: deviceWidth,
|
|
@@ -98,7 +98,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
98
98
|
placeholder,
|
|
99
99
|
value,
|
|
100
100
|
disabled = false,
|
|
101
|
-
theme,
|
|
102
101
|
assistiveText,
|
|
103
102
|
label,
|
|
104
103
|
iconColor = unstyledColor,
|
|
@@ -145,8 +144,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
145
144
|
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
146
145
|
: normalizedOptions;
|
|
147
146
|
|
|
148
|
-
const { colors } = theme;
|
|
149
|
-
|
|
150
147
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
151
148
|
|
|
152
149
|
const additionalBorderStyles = ["backgroundColor"];
|
|
@@ -347,15 +344,8 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
347
344
|
{/* iosPicker */}
|
|
348
345
|
{isIos && pickerVisible ? (
|
|
349
346
|
<Portal>
|
|
350
|
-
<
|
|
351
|
-
style={
|
|
352
|
-
styles.iosPicker,
|
|
353
|
-
{
|
|
354
|
-
backgroundColor: colors.divider,
|
|
355
|
-
},
|
|
356
|
-
]}
|
|
357
|
-
>
|
|
358
|
-
<SafeAreaView style={styles.iosSafeArea}>
|
|
347
|
+
<SafeAreaView style={styles.iosPicker}>
|
|
348
|
+
<View style={styles.iosPickerContent}>
|
|
359
349
|
<Button
|
|
360
350
|
Icon={Icon}
|
|
361
351
|
type="text"
|
|
@@ -378,8 +368,8 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
378
368
|
/>
|
|
379
369
|
))}
|
|
380
370
|
</NativePicker>
|
|
381
|
-
</
|
|
382
|
-
</
|
|
371
|
+
</View>
|
|
372
|
+
</SafeAreaView>
|
|
383
373
|
</Portal>
|
|
384
374
|
) : null}
|
|
385
375
|
|
|
@@ -451,9 +441,9 @@ const styles = StyleSheet.create({
|
|
|
451
441
|
width: "100%",
|
|
452
442
|
maxWidth: deviceWidth,
|
|
453
443
|
maxHeight: deviceHeight,
|
|
454
|
-
},
|
|
455
|
-
iosSafeArea: {
|
|
456
444
|
backgroundColor: "white",
|
|
445
|
+
},
|
|
446
|
+
iosPickerContent: {
|
|
457
447
|
flexDirection: "column",
|
|
458
448
|
width: "100%",
|
|
459
449
|
maxWidth: deviceWidth,
|