@draftbit/core 44.1.13-c10e64.0 → 44.1.14
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/CircularProgress.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Justification.js +0 -3
- package/lib/commonjs/components/Picker/Picker.js +266 -27
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +34 -110
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +44 -113
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +34 -111
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +0 -3
- package/lib/commonjs/mappings/Picker.js +7 -1
- package/lib/commonjs/mappings/Picker.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/utilities.js +19 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Justification.js +1 -1
- package/lib/module/components/Picker/Picker.js +260 -28
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +32 -103
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.ios.js +42 -108
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +32 -104
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/module/components/ResizeMode.js +1 -1
- package/lib/module/mappings/Picker.js +8 -2
- package/lib/module/mappings/Picker.js.map +1 -1
- package/lib/module/utilities.js +12 -1
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +28 -4
- package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +12 -5
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +11 -5
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +12 -5
- package/lib/typescript/src/mappings/Picker.d.ts +21 -0
- package/lib/typescript/src/utilities.d.ts +7 -0
- package/package.json +2 -2
- package/src/components/Picker/Picker.tsx +434 -34
- package/src/components/Picker/PickerComponent.android.tsx +44 -101
- package/src/components/Picker/PickerComponent.ios.tsx +63 -116
- package/src/components/Picker/PickerComponent.web.tsx +44 -102
- package/src/mappings/Picker.ts +4 -0
- package/src/utilities.ts +65 -1
- package/lib/commonjs/components/Picker/PickerTypes.js +0 -6
- package/lib/commonjs/components/Picker/PickerTypes.js.map +0 -1
- package/lib/module/components/Picker/PickerTypes.js +0 -2
- package/lib/module/components/Picker/PickerTypes.js.map +0 -1
- package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
- package/src/Provider.js +0 -9
- package/src/components/Accordion/AccordionGroup.js +0 -44
- package/src/components/Accordion/AccordionItem.js +0 -32
- package/src/components/Accordion/index.js +0 -2
- package/src/components/ActionSheet/ActionSheet.js +0 -45
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
- package/src/components/ActionSheet/ActionSheetItem.js +0 -30
- package/src/components/ActionSheet/index.js +0 -3
- package/src/components/AnimatedCircularProgress.js +0 -43
- package/src/components/AspectRatio.js +0 -18
- package/src/components/AvatarEdit.js +0 -30
- package/src/components/Banner.js +0 -109
- package/src/components/Button.js +0 -112
- package/src/components/Card.js +0 -57
- package/src/components/CardBlock.js +0 -54
- package/src/components/CardContainer.js +0 -69
- package/src/components/CardContainerRating.js +0 -79
- package/src/components/CardContainerShortImage.js +0 -33
- package/src/components/CardInline.js +0 -36
- package/src/components/Carousel.js +0 -66
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/CheckboxGroup.js +0 -21
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxRow.js +0 -78
- package/src/components/Checkbox/context.js +0 -14
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/CircleImage.js +0 -8
- package/src/components/CircularProgress.js +0 -78
- package/src/components/Config.js +0 -63
- package/src/components/Container.js +0 -43
- package/src/components/DatePicker/DatePicker.js +0 -368
- package/src/components/DatePicker/DatePickerComponent.js +0 -13
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
- package/src/components/DatePicker/DatePickerComponentType.js +0 -1
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedFAB.js +0 -115
- package/src/components/Divider.js +0 -13
- package/src/components/Elevation.js +0 -20
- package/src/components/FAB.js +0 -46
- package/src/components/FieldSearchBarFull.js +0 -53
- package/src/components/FormRow.js +0 -19
- package/src/components/Header.js +0 -44
- package/src/components/HeaderLarge.js +0 -7
- package/src/components/HeaderMedium.js +0 -7
- package/src/components/HeaderOverline.js +0 -7
- package/src/components/IconButton.js +0 -35
- package/src/components/Image.js +0 -47
- package/src/components/Justification.js +0 -1
- package/src/components/Layout.js +0 -50
- package/src/components/NumberInput.js +0 -49
- package/src/components/Picker/Picker.js +0 -56
- package/src/components/Picker/PickerComponent.android.js +0 -68
- package/src/components/Picker/PickerComponent.ios.js +0 -78
- package/src/components/Picker/PickerComponent.web.js +0 -69
- package/src/components/Picker/PickerTypes.js +0 -1
- package/src/components/Picker/PickerTypes.ts +0 -18
- package/src/components/Portal/Portal.js +0 -35
- package/src/components/Portal/PortalConsumer.js +0 -28
- package/src/components/Portal/PortalHost.js +0 -105
- package/src/components/Portal/PortalManager.js +0 -29
- package/src/components/ProgressBar.js +0 -118
- package/src/components/ProgressCircle.js +0 -13
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/RadioButton/RadioButton.js +0 -17
- package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
- package/src/components/RadioButton/RadioButtonGroup.js +0 -43
- package/src/components/RadioButton/RadioButtonRow.js +0 -76
- package/src/components/RadioButton/context.js +0 -14
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/ResizeMode.js +0 -1
- package/src/components/Row.js +0 -48
- package/src/components/RowBodyIcon.js +0 -8
- package/src/components/RowHeadlineImageCaption.js +0 -12
- package/src/components/RowHeadlineImageIcon.js +0 -14
- package/src/components/ScreenContainer.js +0 -34
- package/src/components/Slider.js +0 -63
- package/src/components/StarRating.js +0 -50
- package/src/components/StepIndicator.js +0 -346
- package/src/components/Stepper.js +0 -39
- package/src/components/Surface.js +0 -32
- package/src/components/Swiper/Swiper.js +0 -29
- package/src/components/Swiper/SwiperItem.js +0 -9
- package/src/components/Swiper/index.js +0 -2
- package/src/components/Switch.js +0 -56
- package/src/components/Text.js +0 -28
- package/src/components/TextField.js +0 -420
- package/src/components/ToggleButton.js +0 -39
- package/src/components/Touchable.js +0 -12
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Typography.js +0 -36
- package/src/components/useAuthState.js +0 -31
- package/src/constants.js +0 -10
- package/src/hooks.js +0 -12
- package/src/index.js +0 -52
- package/src/interfaces/Icon.js +0 -8
- package/src/mappings/Accordion.js +0 -41
- package/src/mappings/AccordionItem.js +0 -16
- package/src/mappings/ActionSheet.js +0 -13
- package/src/mappings/ActionSheetCancel.js +0 -19
- package/src/mappings/ActionSheetItem.js +0 -23
- package/src/mappings/ActivityIndicator.js +0 -53
- package/src/mappings/AudioPlayer.js +0 -20
- package/src/mappings/AvatarEdit.js +0 -37
- package/src/mappings/Banner.js +0 -32
- package/src/mappings/BlurView.js +0 -41
- package/src/mappings/Button.js +0 -56
- package/src/mappings/Card.js +0 -52
- package/src/mappings/CardBlock.js +0 -122
- package/src/mappings/CardContainer.js +0 -102
- package/src/mappings/CardContainerRating.js +0 -124
- package/src/mappings/CardContainerShortImage.js +0 -118
- package/src/mappings/CardInline.js +0 -51
- package/src/mappings/Carousel.js +0 -18
- package/src/mappings/Checkbox.js +0 -45
- package/src/mappings/CheckboxGroup.js +0 -25
- package/src/mappings/CheckboxRow.js +0 -56
- package/src/mappings/CircleImage.js +0 -24
- package/src/mappings/Container.js +0 -29
- package/src/mappings/CustomCode.js +0 -8
- package/src/mappings/DatePicker.js +0 -146
- package/src/mappings/Divider.js +0 -26
- package/src/mappings/FAB.js +0 -36
- package/src/mappings/Fetch.js +0 -12
- package/src/mappings/FieldSearchBarFull.js +0 -49
- package/src/mappings/FlatList.js +0 -19
- package/src/mappings/HeaderLarge.js +0 -28
- package/src/mappings/HeaderMedium.js +0 -54
- package/src/mappings/HeaderOverline.js +0 -54
- package/src/mappings/Icon.js +0 -25
- package/src/mappings/IconButton.js +0 -30
- package/src/mappings/Image.js +0 -15
- package/src/mappings/ImageBackground.js +0 -28
- package/src/mappings/KeyboardAvoidingView.js +0 -40
- package/src/mappings/KeyboardAwareScrollView.js +0 -49
- package/src/mappings/Layout.js +0 -195
- package/src/mappings/LinearGradient.js +0 -77
- package/src/mappings/MapCallout.js +0 -21
- package/src/mappings/MapMarker.js +0 -47
- package/src/mappings/MapView.js +0 -138
- package/src/mappings/Modal.js +0 -41
- package/src/mappings/Picker.js +0 -137
- package/src/mappings/ProgressBar.js +0 -100
- package/src/mappings/ProgressCircle.js +0 -108
- package/src/mappings/ProgressIndicator.js +0 -180
- package/src/mappings/RadioButton.js +0 -50
- package/src/mappings/RadioButtonGroup.js +0 -16
- package/src/mappings/RadioButtonRow.js +0 -37
- package/src/mappings/RowBodyIcon.js +0 -75
- package/src/mappings/RowHeadlineImageCaption.js +0 -167
- package/src/mappings/RowHeadlineImageIcon.js +0 -99
- package/src/mappings/SafeAreaView.js +0 -33
- package/src/mappings/ScrollView.js +0 -30
- package/src/mappings/Slider.js +0 -59
- package/src/mappings/StarRating.js +0 -42
- package/src/mappings/Stepper.js +0 -28
- package/src/mappings/Surface.js +0 -13
- package/src/mappings/Swiper.js +0 -60
- package/src/mappings/SwiperItem.js +0 -8
- package/src/mappings/Switch.js +0 -75
- package/src/mappings/Text.js +0 -232
- package/src/mappings/TextArea.js +0 -52
- package/src/mappings/TextField.js +0 -158
- package/src/mappings/TextInput.js +0 -208
- package/src/mappings/ToggleButton.js +0 -45
- package/src/mappings/Touchable.js +0 -12
- package/src/mappings/Video.js +0 -74
- package/src/mappings/View.js +0 -206
- package/src/mappings/WebView.js +0 -18
- package/src/styles/DarkTheme.js +0 -26
- package/src/styles/DefaultTheme.js +0 -111
- package/src/styles/fonts.js +0 -62
- package/src/styles/overlay.js +0 -60
- package/src/styles/shadow.js +0 -51
- package/src/theming.js +0 -3
- package/src/utilities.js +0 -54
|
@@ -1,112 +1,41 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || 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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
|
-
import {
|
|
5
|
-
import omit from "lodash.omit";
|
|
6
|
-
import { withTheme } from "../../theming";
|
|
2
|
+
import { StyleSheet, Dimensions } from "react-native";
|
|
7
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
var _options$find$label, _options$find;
|
|
14
|
-
|
|
4
|
+
const {
|
|
5
|
+
width: deviceWidth,
|
|
6
|
+
height: deviceHeight
|
|
7
|
+
} = Dimensions.get("screen");
|
|
8
|
+
export const PickerComponent = _ref => {
|
|
15
9
|
let {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onValueChange: onValueChangeOverride = () => {},
|
|
22
|
-
...props
|
|
10
|
+
androidPickerRef,
|
|
11
|
+
togglePickerVisible,
|
|
12
|
+
pickerOptions,
|
|
13
|
+
internalValue,
|
|
14
|
+
handleValueChange
|
|
23
15
|
} = _ref;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
36
|
-
borderLeftWidth,
|
|
37
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
38
|
-
borderColor,
|
|
39
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
40
|
-
backgroundColor,
|
|
41
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
-
padding,
|
|
43
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
44
|
-
paddingTop,
|
|
45
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
46
|
-
paddingRight,
|
|
47
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
48
|
-
paddingBottom,
|
|
49
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
50
|
-
paddingLeft,
|
|
51
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
52
|
-
...viewStyles
|
|
53
|
-
}
|
|
54
|
-
} = extractStyles(style);
|
|
55
|
-
const textField = React.useRef(undefined);
|
|
56
|
-
|
|
57
|
-
const onValueChange = (itemValue, itemIndex) => {
|
|
58
|
-
toggleFocus();
|
|
59
|
-
onValueChangeOverride(itemValue, itemIndex);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const toggleFocus = () => {
|
|
63
|
-
if (!disabled) {
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
70
|
-
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);
|
|
71
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
72
|
-
disabled: disabled,
|
|
73
|
-
onPress: toggleFocus,
|
|
74
|
-
style: [styles.container, viewStyles]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(NativePicker, {
|
|
76
|
-
enabled: !disabled,
|
|
77
|
-
selectedValue: selectedValue,
|
|
78
|
-
onValueChange: onValueChange,
|
|
79
|
-
style: {
|
|
80
|
-
opacity: 0,
|
|
81
|
-
position: "absolute",
|
|
82
|
-
top: 0,
|
|
83
|
-
left: 0,
|
|
84
|
-
right: 0,
|
|
85
|
-
bottom: 0,
|
|
86
|
-
width: "100%"
|
|
87
|
-
}
|
|
88
|
-
}, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
89
|
-
label: o.label,
|
|
90
|
-
value: o.value,
|
|
91
|
-
key: o.value
|
|
92
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
93
|
-
pointerEvents: "none"
|
|
94
|
-
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
95
|
-
value: selectedLabel,
|
|
96
|
-
placeholder: placeholder // @ts-ignore
|
|
97
|
-
,
|
|
98
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
99
|
-
,
|
|
100
|
-
disabled: disabled // @ts-expect-error
|
|
101
|
-
,
|
|
102
|
-
style: stylesWithoutMargin
|
|
103
|
-
})))));
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativePicker, {
|
|
17
|
+
selectedValue: internalValue,
|
|
18
|
+
onValueChange: handleValueChange,
|
|
19
|
+
style: styles.nonIosPicker,
|
|
20
|
+
ref: androidPickerRef,
|
|
21
|
+
onBlur: togglePickerVisible
|
|
22
|
+
}, pickerOptions.map(option => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
23
|
+
label: option.label,
|
|
24
|
+
value: option.value,
|
|
25
|
+
key: option.value
|
|
26
|
+
})));
|
|
104
27
|
};
|
|
105
|
-
|
|
106
28
|
const styles = StyleSheet.create({
|
|
107
|
-
|
|
108
|
-
|
|
29
|
+
nonIosPicker: {
|
|
30
|
+
opacity: 0,
|
|
31
|
+
position: "absolute",
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
right: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
width: "100%",
|
|
37
|
+
maxWidth: deviceWidth,
|
|
38
|
+
maxHeight: deviceHeight
|
|
109
39
|
}
|
|
110
40
|
});
|
|
111
|
-
export default withTheme(Picker);
|
|
112
41
|
//# sourceMappingURL=PickerComponent.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.android.tsx"],"names":["React","
|
|
1
|
+
{"version":3,"sources":["PickerComponent.android.tsx"],"names":["React","StyleSheet","Dimensions","Picker","NativePicker","width","deviceWidth","height","deviceHeight","get","PickerComponent","androidPickerRef","togglePickerVisible","pickerOptions","internalValue","handleValueChange","styles","nonIosPicker","map","option","label","value","create","opacity","position","top","left","right","bottom","maxWidth","maxHeight"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,cAAvC;AAEA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AAMA,MAAM;AAAEC,EAAAA,KAAK,EAAEC,WAAT;AAAsBC,EAAAA,MAAM,EAAEC;AAA9B,IAA+CN,UAAU,CAACO,GAAX,CAAe,QAAf,CAArD;AAWA,OAAO,MAAMC,eAA+C,GAAG,QAMzD;AAAA,MAN0D;AAC9DC,IAAAA,gBAD8D;AAE9DC,IAAAA,mBAF8D;AAG9DC,IAAAA,aAH8D;AAI9DC,IAAAA,aAJ8D;AAK9DC,IAAAA;AAL8D,GAM1D;AACJ,sBACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,aAAa,EAAEC,iBAFjB;AAGE,IAAA,KAAK,EAAEC,MAAM,CAACC,YAHhB;AAIE,IAAA,GAAG,EAAEN,gBAJP;AAKE,IAAA,MAAM,EAAEC;AALV,KAOIC,aAAD,CAA6CK,GAA7C,CAAkDC,MAAD,iBAChD,oBAAC,YAAD,CAAc,IAAd;AACE,IAAA,KAAK,EAAEA,MAAM,CAACC,KADhB;AAEE,IAAA,KAAK,EAAED,MAAM,CAACE,KAFhB;AAGE,IAAA,GAAG,EAAEF,MAAM,CAACE;AAHd,IADD,CAPH,CADF;AAiBD,CAxBM;AA0BP,MAAML,MAAM,GAAGf,UAAU,CAACqB,MAAX,CAAkB;AAC/BL,EAAAA,YAAY,EAAE;AACZM,IAAAA,OAAO,EAAE,CADG;AAEZC,IAAAA,QAAQ,EAAE,UAFE;AAGZC,IAAAA,GAAG,EAAE,CAHO;AAIZC,IAAAA,IAAI,EAAE,CAJM;AAKZC,IAAAA,KAAK,EAAE,CALK;AAMZC,IAAAA,MAAM,EAAE,CANI;AAOZvB,IAAAA,KAAK,EAAE,MAPK;AAQZwB,IAAAA,QAAQ,EAAEvB,WARE;AASZwB,IAAAA,SAAS,EAAEtB;AATC;AADiB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport { StyleSheet, Dimensions } from \"react-native\";\n\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nimport { PickerOption } from \"./Picker\";\n\nconst { width: deviceWidth, height: deviceHeight } = Dimensions.get(\"screen\");\n\ninterface PickerComponentProps {\n Icon: IconSlot[\"Icon\"];\n androidPickerRef: React.RefObject<any>;\n togglePickerVisible: () => void;\n pickerOptions: PickerOption[];\n internalValue: string | undefined;\n handleValueChange: (newValue: string, itemIndex: number) => void;\n}\n\nexport const PickerComponent: React.FC<PickerComponentProps> = ({\n androidPickerRef,\n togglePickerVisible,\n pickerOptions,\n internalValue,\n handleValueChange,\n}) => {\n return (\n <NativePicker\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n ref={androidPickerRef}\n onBlur={togglePickerVisible}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n );\n};\n\nconst styles = StyleSheet.create({\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n maxWidth: deviceWidth,\n maxHeight: deviceHeight,\n },\n});\n"]}
|
|
@@ -1,135 +1,69 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || 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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
|
-
import { View, StyleSheet } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Dimensions } from "react-native";
|
|
5
3
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
6
|
-
import omit from "lodash.omit";
|
|
7
4
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
8
|
-
import { withTheme } from "../../theming";
|
|
9
5
|
import Portal from "../Portal/Portal";
|
|
10
6
|
import Button from "../DeprecatedButton";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
var _options$find$label, _options$find;
|
|
17
|
-
|
|
7
|
+
const {
|
|
8
|
+
width: deviceWidth,
|
|
9
|
+
height: deviceHeight
|
|
10
|
+
} = Dimensions.get("screen");
|
|
11
|
+
export const PickerComponent = _ref => {
|
|
18
12
|
let {
|
|
19
13
|
Icon,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
disabled = false,
|
|
25
|
-
onValueChange = () => {},
|
|
26
|
-
theme: {
|
|
27
|
-
colors
|
|
28
|
-
},
|
|
29
|
-
...props
|
|
14
|
+
togglePickerVisible,
|
|
15
|
+
pickerOptions,
|
|
16
|
+
internalValue,
|
|
17
|
+
handleValueChange
|
|
30
18
|
} = _ref;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
borderRadius,
|
|
34
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
35
|
-
borderWidth,
|
|
36
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
37
|
-
borderTopWidth,
|
|
38
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
39
|
-
borderRightWidth,
|
|
40
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
41
|
-
borderBottomWidth,
|
|
42
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
43
|
-
borderLeftWidth,
|
|
44
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
45
|
-
borderColor,
|
|
46
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
47
|
-
backgroundColor,
|
|
48
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
49
|
-
padding,
|
|
50
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
51
|
-
paddingTop,
|
|
52
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
53
|
-
paddingRight,
|
|
54
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
55
|
-
paddingBottom,
|
|
56
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
57
|
-
paddingLeft,
|
|
58
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
59
|
-
...viewStyles
|
|
60
|
-
}
|
|
61
|
-
} = extractStyles(style);
|
|
62
|
-
const textField = React.useRef(undefined);
|
|
63
|
-
const [pickerVisible, setIsPickerVisible] = React.useState(false);
|
|
64
|
-
|
|
65
|
-
const toggleVisibility = () => {
|
|
66
|
-
setIsPickerVisible(!pickerVisible); // @ts-ignore
|
|
67
|
-
|
|
68
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
72
|
-
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);
|
|
73
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
74
|
-
style: [styles.container, viewStyles]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
76
|
-
disabled: disabled,
|
|
77
|
-
onPress: toggleVisibility
|
|
78
|
-
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
79
|
-
value: String(selectedLabel),
|
|
80
|
-
placeholder: placeholder // @ts-ignore
|
|
81
|
-
,
|
|
82
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
83
|
-
,
|
|
84
|
-
disabled: disabled,
|
|
85
|
-
pointerEvents: "none" // @ts-expect-error
|
|
86
|
-
,
|
|
87
|
-
style: stylesWithoutMargin,
|
|
88
|
-
Icon: Icon
|
|
89
|
-
}))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
90
|
-
style: [styles.picker, {
|
|
91
|
-
backgroundColor: colors.divider
|
|
92
|
-
}]
|
|
19
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
20
|
+
style: styles.iosPicker
|
|
93
21
|
}, /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
94
|
-
style: styles.
|
|
22
|
+
style: styles.iosSafeArea
|
|
95
23
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
96
24
|
Icon: Icon,
|
|
97
25
|
type: "text",
|
|
98
|
-
onPress:
|
|
99
|
-
style: styles.
|
|
26
|
+
onPress: togglePickerVisible,
|
|
27
|
+
style: styles.iosButton
|
|
100
28
|
}, "Close"), /*#__PURE__*/React.createElement(NativePicker, {
|
|
101
|
-
style:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
key: o.value
|
|
110
|
-
})))))));
|
|
29
|
+
style: styles.iosNativePicker,
|
|
30
|
+
selectedValue: internalValue,
|
|
31
|
+
onValueChange: handleValueChange
|
|
32
|
+
}, pickerOptions.map(option => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
33
|
+
label: option.label,
|
|
34
|
+
value: option.value,
|
|
35
|
+
key: option.value
|
|
36
|
+
}))))));
|
|
111
37
|
};
|
|
112
|
-
|
|
113
38
|
const styles = StyleSheet.create({
|
|
114
|
-
|
|
115
|
-
alignSelf: "stretch"
|
|
116
|
-
},
|
|
117
|
-
picker: {
|
|
39
|
+
iosPicker: {
|
|
118
40
|
position: "absolute",
|
|
119
41
|
bottom: 0,
|
|
120
42
|
left: 0,
|
|
121
43
|
right: 0,
|
|
122
44
|
flexDirection: "row",
|
|
123
|
-
justifyContent: "center"
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
width: deviceWidth,
|
|
47
|
+
// TODO
|
|
48
|
+
maxWidth: deviceWidth,
|
|
49
|
+
maxHeight: deviceHeight,
|
|
50
|
+
backgroundColor: "green" // TODO
|
|
51
|
+
// backgroundColor: "rgba(255, 255, 255, 1)",
|
|
52
|
+
|
|
124
53
|
},
|
|
125
|
-
|
|
126
|
-
backgroundColor: "
|
|
54
|
+
iosSafeArea: {
|
|
55
|
+
backgroundColor: "yellow",
|
|
56
|
+
// backgroundColor: "white",// TODO
|
|
127
57
|
flexDirection: "column",
|
|
128
|
-
width:
|
|
58
|
+
width: deviceWidth,
|
|
59
|
+
maxWidth: deviceWidth
|
|
129
60
|
},
|
|
130
|
-
|
|
61
|
+
iosButton: {
|
|
131
62
|
alignSelf: "flex-end"
|
|
63
|
+
},
|
|
64
|
+
iosNativePicker: {
|
|
65
|
+
//backgroundColor: "white",// TODO
|
|
66
|
+
backgroundColor: "red"
|
|
132
67
|
}
|
|
133
68
|
});
|
|
134
|
-
export default withTheme(Picker);
|
|
135
69
|
//# sourceMappingURL=PickerComponent.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.ios.tsx"],"names":["React","View","StyleSheet","
|
|
1
|
+
{"version":3,"sources":["PickerComponent.ios.tsx"],"names":["React","View","StyleSheet","Dimensions","SafeAreaView","Picker","NativePicker","Portal","Button","width","deviceWidth","height","deviceHeight","get","PickerComponent","Icon","togglePickerVisible","pickerOptions","internalValue","handleValueChange","styles","iosPicker","iosSafeArea","iosButton","iosNativePicker","map","option","label","value","create","position","bottom","left","right","flexDirection","justifyContent","maxWidth","maxHeight","backgroundColor","alignSelf"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,UAAf,EAA2BC,UAA3B,QAA6C,cAA7C;AACA,SAASC,YAAT,QAA6B,gCAA7B;AACA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AAGA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AAGA,MAAM;AAAEC,EAAAA,KAAK,EAAEC,WAAT;AAAsBC,EAAAA,MAAM,EAAEC;AAA9B,IAA+CT,UAAU,CAACU,GAAX,CAAe,QAAf,CAArD;AAWA,OAAO,MAAMC,eAA+C,GAAG,QAMzD;AAAA,MAN0D;AAC9DC,IAAAA,IAD8D;AAE9DC,IAAAA,mBAF8D;AAG9DC,IAAAA,aAH8D;AAI9DC,IAAAA,aAJ8D;AAK9DC,IAAAA;AAL8D,GAM1D;AACJ,sBACE,oBAAC,MAAD,qBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,kBACE,oBAAC,YAAD;AAAc,IAAA,KAAK,EAAED,MAAM,CAACE;AAA5B,kBACE,oBAAC,MAAD;AACE,IAAA,IAAI,EAAEP,IADR;AAEE,IAAA,IAAI,EAAC,MAFP;AAGE,IAAA,OAAO,EAAEC,mBAHX;AAIE,IAAA,KAAK,EAAEI,MAAM,CAACG;AAJhB,KAMG,OANH,CADF,eAUE,oBAAC,YAAD;AACE,IAAA,KAAK,EAAEH,MAAM,CAACI,eADhB;AAEE,IAAA,aAAa,EAAEN,aAFjB;AAGE,IAAA,aAAa,EAAEC;AAHjB,KAKIF,aAAD,CAA6CQ,GAA7C,CAAkDC,MAAD,iBAChD,oBAAC,YAAD,CAAc,IAAd;AACE,IAAA,KAAK,EAAEA,MAAM,CAACC,KADhB;AAEE,IAAA,KAAK,EAAED,MAAM,CAACE,KAFhB;AAGE,IAAA,GAAG,EAAEF,MAAM,CAACE;AAHd,IADD,CALH,CAVF,CADF,CADF,CADF;AA8BD,CArCM;AAuCP,MAAMR,MAAM,GAAGlB,UAAU,CAAC2B,MAAX,CAAkB;AAC/BR,EAAAA,SAAS,EAAE;AACTS,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,MAAM,EAAE,CAFC;AAGTC,IAAAA,IAAI,EAAE,CAHG;AAITC,IAAAA,KAAK,EAAE,CAJE;AAKTC,IAAAA,aAAa,EAAE,KALN;AAMTC,IAAAA,cAAc,EAAE,QANP;AAOT1B,IAAAA,KAAK,EAAEC,WAPE;AAOW;AACpB0B,IAAAA,QAAQ,EAAE1B,WARD;AAST2B,IAAAA,SAAS,EAAEzB,YATF;AAUT0B,IAAAA,eAAe,EAAE,OAVR,CAUiB;AAC1B;;AAXS,GADoB;AAc/BhB,EAAAA,WAAW,EAAE;AACXgB,IAAAA,eAAe,EAAE,QADN;AAEX;AACAJ,IAAAA,aAAa,EAAE,QAHJ;AAIXzB,IAAAA,KAAK,EAAEC,WAJI;AAKX0B,IAAAA,QAAQ,EAAE1B;AALC,GAdkB;AAqB/Ba,EAAAA,SAAS,EAAE;AACTgB,IAAAA,SAAS,EAAE;AADF,GArBoB;AAwB/Bf,EAAAA,eAAe,EAAE;AACf;AACAc,IAAAA,eAAe,EAAE;AAFF;AAxBc,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet, Dimensions } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport { PickerOption } from \"./Picker\";\n\nconst { width: deviceWidth, height: deviceHeight } = Dimensions.get(\"screen\");\n\ninterface PickerComponentProps {\n Icon: IconSlot[\"Icon\"];\n androidPickerRef: React.RefObject<any>;\n togglePickerVisible: () => void;\n pickerOptions: PickerOption[];\n internalValue: string | undefined;\n handleValueChange: (newValue: string, itemIndex: number) => void;\n}\n\nexport const PickerComponent: React.FC<PickerComponentProps> = ({\n Icon,\n togglePickerVisible,\n pickerOptions,\n internalValue,\n handleValueChange,\n}) => {\n return (\n <Portal>\n <View style={styles.iosPicker}>\n <SafeAreaView style={styles.iosSafeArea}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={togglePickerVisible}\n style={styles.iosButton}\n >\n {\"Close\"}\n </Button>\n\n <NativePicker\n style={styles.iosNativePicker}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n );\n};\n\nconst styles = StyleSheet.create({\n iosPicker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n width: deviceWidth, // TODO\n maxWidth: deviceWidth,\n maxHeight: deviceHeight,\n backgroundColor: \"green\", // TODO\n // backgroundColor: \"rgba(255, 255, 255, 1)\",\n },\n iosSafeArea: {\n backgroundColor: \"yellow\",\n // backgroundColor: \"white\",// TODO\n flexDirection: \"column\",\n width: deviceWidth,\n maxWidth: deviceWidth,\n },\n iosButton: {\n alignSelf: \"flex-end\",\n },\n iosNativePicker: {\n //backgroundColor: \"white\",// TODO\n backgroundColor: \"red\",\n },\n});\n"]}
|
|
@@ -1,113 +1,41 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || 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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
|
-
import {
|
|
2
|
+
import { StyleSheet, Dimensions } from "react-native";
|
|
5
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const Picker = _ref => {
|
|
13
|
-
var _options$find$label, _options$find;
|
|
14
|
-
|
|
4
|
+
const {
|
|
5
|
+
width: deviceWidth,
|
|
6
|
+
height: deviceHeight
|
|
7
|
+
} = Dimensions.get("screen");
|
|
8
|
+
export const PickerComponent = _ref => {
|
|
15
9
|
let {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onValueChange: onValueChangeOverride = () => {},
|
|
22
|
-
...props
|
|
10
|
+
androidPickerRef,
|
|
11
|
+
togglePickerVisible,
|
|
12
|
+
pickerOptions,
|
|
13
|
+
internalValue,
|
|
14
|
+
handleValueChange
|
|
23
15
|
} = _ref;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
36
|
-
borderLeftWidth,
|
|
37
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
38
|
-
borderColor,
|
|
39
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
40
|
-
backgroundColor,
|
|
41
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
-
padding,
|
|
43
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
44
|
-
paddingTop,
|
|
45
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
46
|
-
paddingRight,
|
|
47
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
48
|
-
paddingBottom,
|
|
49
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
50
|
-
paddingLeft,
|
|
51
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
52
|
-
...viewStyles
|
|
53
|
-
}
|
|
54
|
-
} = extractStyles(style);
|
|
55
|
-
const textField = React.useRef(undefined);
|
|
56
|
-
|
|
57
|
-
const onValueChange = (itemValue, itemIndex) => {
|
|
58
|
-
toggleFocus();
|
|
59
|
-
onValueChangeOverride(itemValue, itemIndex);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const toggleFocus = () => {
|
|
63
|
-
if (!disabled) {
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
70
|
-
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);
|
|
71
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
72
|
-
disabled: disabled,
|
|
73
|
-
onPress: toggleFocus,
|
|
74
|
-
style: [styles.container, viewStyles]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(NativePicker, {
|
|
76
|
-
enabled: !disabled,
|
|
77
|
-
selectedValue: selectedValue,
|
|
78
|
-
onValueChange: onValueChange,
|
|
79
|
-
style: {
|
|
80
|
-
flex: 1,
|
|
81
|
-
opacity: 0,
|
|
82
|
-
position: "absolute",
|
|
83
|
-
top: 0,
|
|
84
|
-
left: 0,
|
|
85
|
-
right: 0,
|
|
86
|
-
bottom: 0,
|
|
87
|
-
width: "100%"
|
|
88
|
-
}
|
|
89
|
-
}, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
90
|
-
label: o.label,
|
|
91
|
-
value: o.value,
|
|
92
|
-
key: o.value
|
|
93
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
94
|
-
pointerEvents: "none"
|
|
95
|
-
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
96
|
-
value: selectedLabel,
|
|
97
|
-
placeholder: placeholder // @ts-ignore
|
|
98
|
-
,
|
|
99
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
100
|
-
,
|
|
101
|
-
disabled: disabled // @ts-expect-error
|
|
102
|
-
,
|
|
103
|
-
style: stylesWithoutMargin
|
|
104
|
-
})))));
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativePicker, {
|
|
17
|
+
selectedValue: internalValue,
|
|
18
|
+
onValueChange: handleValueChange,
|
|
19
|
+
style: styles.nonIosPicker,
|
|
20
|
+
ref: androidPickerRef,
|
|
21
|
+
onBlur: togglePickerVisible
|
|
22
|
+
}, pickerOptions.map(option => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
23
|
+
label: option.label,
|
|
24
|
+
value: option.value,
|
|
25
|
+
key: option.value
|
|
26
|
+
})));
|
|
105
27
|
};
|
|
106
|
-
|
|
107
28
|
const styles = StyleSheet.create({
|
|
108
|
-
|
|
109
|
-
|
|
29
|
+
nonIosPicker: {
|
|
30
|
+
opacity: 0,
|
|
31
|
+
position: "absolute",
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
right: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
width: "100%",
|
|
37
|
+
maxWidth: deviceWidth,
|
|
38
|
+
maxHeight: deviceHeight
|
|
110
39
|
}
|
|
111
40
|
});
|
|
112
|
-
export default withTheme(Picker);
|
|
113
41
|
//# sourceMappingURL=PickerComponent.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.web.tsx"],"names":["React","
|
|
1
|
+
{"version":3,"sources":["PickerComponent.web.tsx"],"names":["React","StyleSheet","Dimensions","Picker","NativePicker","width","deviceWidth","height","deviceHeight","get","PickerComponent","androidPickerRef","togglePickerVisible","pickerOptions","internalValue","handleValueChange","styles","nonIosPicker","map","option","label","value","create","opacity","position","top","left","right","bottom","maxWidth","maxHeight"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,cAAvC;AAEA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AAMA,MAAM;AAAEC,EAAAA,KAAK,EAAEC,WAAT;AAAsBC,EAAAA,MAAM,EAAEC;AAA9B,IAA+CN,UAAU,CAACO,GAAX,CAAe,QAAf,CAArD;AAWA,OAAO,MAAMC,eAA+C,GAAG,QAMzD;AAAA,MAN0D;AAC9DC,IAAAA,gBAD8D;AAE9DC,IAAAA,mBAF8D;AAG9DC,IAAAA,aAH8D;AAI9DC,IAAAA,aAJ8D;AAK9DC,IAAAA;AAL8D,GAM1D;AACJ,sBACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,aAAa,EAAEC,iBAFjB;AAGE,IAAA,KAAK,EAAEC,MAAM,CAACC,YAHhB;AAIE,IAAA,GAAG,EAAEN,gBAJP;AAKE,IAAA,MAAM,EAAEC;AALV,KAOIC,aAAD,CAA6CK,GAA7C,CAAkDC,MAAD,iBAChD,oBAAC,YAAD,CAAc,IAAd;AACE,IAAA,KAAK,EAAEA,MAAM,CAACC,KADhB;AAEE,IAAA,KAAK,EAAED,MAAM,CAACE,KAFhB;AAGE,IAAA,GAAG,EAAEF,MAAM,CAACE;AAHd,IADD,CAPH,CADF;AAiBD,CAxBM;AA0BP,MAAML,MAAM,GAAGf,UAAU,CAACqB,MAAX,CAAkB;AAC/BL,EAAAA,YAAY,EAAE;AACZM,IAAAA,OAAO,EAAE,CADG;AAEZC,IAAAA,QAAQ,EAAE,UAFE;AAGZC,IAAAA,GAAG,EAAE,CAHO;AAIZC,IAAAA,IAAI,EAAE,CAJM;AAKZC,IAAAA,KAAK,EAAE,CALK;AAMZC,IAAAA,MAAM,EAAE,CANI;AAOZvB,IAAAA,KAAK,EAAE,MAPK;AAQZwB,IAAAA,QAAQ,EAAEvB,WARE;AASZwB,IAAAA,SAAS,EAAEtB;AATC;AADiB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport { StyleSheet, Dimensions } from \"react-native\";\n\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nimport { PickerOption } from \"./Picker\";\n\nconst { width: deviceWidth, height: deviceHeight } = Dimensions.get(\"screen\");\n\ninterface PickerComponentProps {\n Icon: IconSlot[\"Icon\"];\n androidPickerRef: React.RefObject<any>;\n togglePickerVisible: () => void;\n pickerOptions: PickerOption[];\n internalValue: string | undefined;\n handleValueChange: (newValue: string, itemIndex: number) => void;\n}\n\nexport const PickerComponent: React.FC<PickerComponentProps> = ({\n androidPickerRef,\n togglePickerVisible,\n pickerOptions,\n internalValue,\n handleValueChange,\n}) => {\n return (\n <NativePicker\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n ref={androidPickerRef}\n onBlur={togglePickerVisible}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n );\n};\n\nconst styles = StyleSheet.create({\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n maxWidth: deviceWidth,\n maxHeight: deviceHeight,\n },\n});\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
//# sourceMappingURL=ResizeMode.js.
|
|
2
|
+
//# sourceMappingURL=ResizeMode.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
group: GROUPS.data,
|
|
@@ -127,7 +127,13 @@ export const SEED_DATA = [{
|
|
|
127
127
|
editable: true,
|
|
128
128
|
required: true,
|
|
129
129
|
group: GROUPS.basic
|
|
130
|
-
}
|
|
130
|
+
},
|
|
131
|
+
iconSize: createIconSizeProp({
|
|
132
|
+
defaultValue: 24
|
|
133
|
+
}),
|
|
134
|
+
iconColor: createColorProp({
|
|
135
|
+
label: "Icon Color"
|
|
136
|
+
})
|
|
131
137
|
},
|
|
132
138
|
layout: {}
|
|
133
139
|
}];
|