@draftbit/core 44.1.8-8983ea.1 → 44.1.9-ce3e7b.1
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/ActionSheet/ActionSheetCancel.js.map +1 -1
- package/lib/commonjs/components/AspectRatio.js +3 -16
- package/lib/commonjs/components/AspectRatio.js.map +1 -1
- package/lib/commonjs/components/CardContainer.js +5 -16
- package/lib/commonjs/components/CardContainer.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +14 -2
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +242 -27
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalManager.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +3 -15
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +1 -2
- package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
- package/lib/commonjs/components/Swiper/index.js.map +1 -1
- package/lib/commonjs/components/ToggleButton.js +3 -17
- package/lib/commonjs/components/ToggleButton.js.map +1 -1
- package/lib/commonjs/components/Touchable.js +3 -16
- package/lib/commonjs/components/Touchable.js.map +1 -1
- package/lib/commonjs/components/Typography.js.map +1 -1
- package/lib/commonjs/mappings/ActionSheet.js.map +1 -1
- package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
- package/lib/commonjs/mappings/AvatarEdit.js.map +1 -1
- package/lib/commonjs/mappings/BlurView.js.map +1 -1
- package/lib/commonjs/mappings/MapCallout.js.map +1 -1
- package/lib/commonjs/mappings/Modal.js.map +1 -1
- package/lib/commonjs/mappings/Picker.js +3 -1
- package/lib/commonjs/mappings/Picker.js.map +1 -1
- package/lib/commonjs/mappings/RadioButton.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/mappings/Surface.js.map +1 -1
- package/lib/commonjs/mappings/Text.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/module/components/ActionSheet/ActionSheetCancel.js.map +1 -1
- package/lib/module/components/Banner.js +4 -21
- package/lib/module/components/Banner.js.map +1 -1
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/CardContainer.js +5 -14
- package/lib/module/components/CardContainer.js.map +1 -1
- package/lib/module/components/Carousel.js +5 -20
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/FormRow.js +4 -17
- package/lib/module/components/FormRow.js.map +1 -1
- package/lib/module/components/Image.js +3 -18
- package/lib/module/components/Image.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +235 -29
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/ScreenContainer.js +5 -21
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/components/Surface.js +2 -15
- package/lib/module/components/Surface.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/CardInline.js.map +1 -1
- package/lib/module/mappings/CheckboxGroup.js.map +1 -1
- package/lib/module/mappings/Container.js.map +1 -1
- package/lib/module/mappings/DatePicker.js.map +1 -1
- package/lib/module/mappings/Divider.js.map +1 -1
- package/lib/module/mappings/FieldSearchBarFull.js +1 -1
- package/lib/module/mappings/FieldSearchBarFull.js.map +1 -1
- package/lib/module/mappings/ImageBackground.js.map +1 -1
- package/lib/module/mappings/KeyboardAwareScrollView.js.map +1 -1
- package/lib/module/mappings/MapMarker.js.map +1 -1
- package/lib/module/mappings/Picker.js +4 -2
- package/lib/module/mappings/Picker.js.map +1 -1
- package/lib/module/mappings/RowHeadlineImageIcon.js.map +1 -1
- package/lib/module/mappings/Text.js.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +28 -4
- package/lib/typescript/src/mappings/Picker.d.ts +21 -0
- package/package.json +2 -2
- package/src/components/Picker/Picker.js +195 -18
- package/src/components/Picker/Picker.tsx +369 -35
- package/src/mappings/Picker.js +3 -1
- package/src/mappings/Picker.ts +4 -0
- package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -135
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +0 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -161
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +0 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -136
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +0 -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/PickerComponent.android.js +0 -112
- package/lib/module/components/Picker/PickerComponent.android.js.map +0 -1
- package/lib/module/components/Picker/PickerComponent.ios.js +0 -154
- package/lib/module/components/Picker/PickerComponent.ios.js.map +0 -1
- package/lib/module/components/Picker/PickerComponent.web.js +0 -113
- package/lib/module/components/Picker/PickerComponent.web.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/PickerComponent.android.d.ts +0 -6
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
- package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
- package/src/components/Picker/PickerComponent.android.js +0 -68
- package/src/components/Picker/PickerComponent.android.tsx +0 -116
- package/src/components/Picker/PickerComponent.ios.js +0 -78
- package/src/components/Picker/PickerComponent.ios.tsx +0 -142
- package/src/components/Picker/PickerComponent.web.js +0 -69
- package/src/components/Picker/PickerComponent.web.tsx +0 -117
- package/src/components/Picker/PickerTypes.js +0 -1
- package/src/components/Picker/PickerTypes.ts +0 -18
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.android.tsx"],"names":["React","View","StyleSheet","omit","withTheme","Picker","NativePicker","extractStyles","TextField","Touchable","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","flatten","selectedLabel","find","o","value","label","styles","container","opacity","position","top","left","right","bottom","width","map","create","alignSelf"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AACA,OAAOC,IAAP,MAAiB,aAAjB;AACA,SAASC,SAAT,QAA0B,eAA1B;AACA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,SAAP,MAAsB,cAAtB;;AAGA,MAAMJ,MAAsC,GAAG,QAQzC;AAAA;;AAAA,MAR0C;AAC9CK,IAAAA,KAD8C;AAE9CC,IAAAA,OAF8C;AAG9CC,IAAAA,WAH8C;AAI9CC,IAAAA,aAJ8C;AAK9CC,IAAAA,QAAQ,GAAG,KALmC;AAM9CC,IAAAA,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;AAO9C,OAAGC;AAP2C,GAQ1C;AACJ,QAAM;AACJC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YADU;AACI;AACdC,MAAAA,WAFU;AAEG;AACbC,MAAAA,cAHU;AAGM;AAChBC,MAAAA,gBAJU;AAIQ;AAClBC,MAAAA,iBALU;AAKS;AACnBC,MAAAA,eANU;AAMO;AACjBC,MAAAA,WAPU;AAOG;AACbC,MAAAA,eARU;AAQO;AACjBC,MAAAA,OATU;AASD;AACTC,MAAAA,UAVU;AAUE;AACZC,MAAAA,YAXU;AAWI;AACdC,MAAAA,aAZU;AAYK;AACfC,MAAAA,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AAI,EAAE,CAJD;AAKLC,MAAAA,KAAK,EAAE,CALF;AAMLC,MAAAA,MAAM,EAAE,CANH;AAOLC,MAAAA,KAAK,EAAE;AAPF;AAJT,KAcG3C,OAAO,CAAC4C,GAAR,CAAaZ,CAAD,iBACX,oBAAC,YAAD,CAAc,IAAd;AAAmB,IAAA,KAAK,EAAEA,CAAC,CAACE,KAA5B;AAAmC,IAAA,KAAK,EAAEF,CAAC,CAACC,KAA5C;AAAmD,IAAA,GAAG,EAAED,CAAC,CAACC;AAA1D,IADD,CAdH,CADF,eAmBE,oBAAC,IAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,oBAAC,SAAD,eACM3B,KADN;AAEE,IAAA,KAAK,EAAEwB,aAFT;AAGE,IAAA,WAAW,EAAE7B,WAHf,CAIE;AAJF;AAKE,IAAA,GAAG,EAAEoB,SALP,CAKkB;AALlB;AAME,IAAA,QAAQ,EAAElB,QANZ,CAOE;AAPF;AAQE,IAAA,KAAK,EAAEyB;AART,KADF,CAnBF,CALF,CADF;AAwCD,CAhGD;;AAkGA,MAAMO,MAAM,GAAG5C,UAAU,CAACsD,MAAX,CAAkB;AAC/BT,EAAAA,SAAS,EAAE;AACTU,IAAAA,SAAS,EAAE;AADF;AADoB,CAAlB,CAAf;AAMA,eAAerD,SAAS,CAACC,MAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"]}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
|
-
import omit from "lodash.omit";
|
|
5
|
-
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import { withTheme } from "../../theming";
|
|
7
|
-
import Portal from "../Portal/Portal";
|
|
8
|
-
import Button from "../DeprecatedButton";
|
|
9
|
-
import TextField from "../TextField";
|
|
10
|
-
import Touchable from "../Touchable";
|
|
11
|
-
import { extractStyles } from "../../utilities";
|
|
12
|
-
|
|
13
|
-
const Picker = _ref => {
|
|
14
|
-
var _options$find$label, _options$find;
|
|
15
|
-
|
|
16
|
-
let {
|
|
17
|
-
Icon,
|
|
18
|
-
style,
|
|
19
|
-
options,
|
|
20
|
-
placeholder,
|
|
21
|
-
selectedValue,
|
|
22
|
-
disabled = false,
|
|
23
|
-
onValueChange = () => {},
|
|
24
|
-
theme: {
|
|
25
|
-
colors
|
|
26
|
-
},
|
|
27
|
-
...props
|
|
28
|
-
} = _ref;
|
|
29
|
-
const {
|
|
30
|
-
viewStyles: {
|
|
31
|
-
borderRadius,
|
|
32
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
33
|
-
borderWidth,
|
|
34
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
35
|
-
borderTopWidth,
|
|
36
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
37
|
-
borderRightWidth,
|
|
38
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
39
|
-
borderBottomWidth,
|
|
40
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
41
|
-
borderLeftWidth,
|
|
42
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
43
|
-
borderColor,
|
|
44
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
45
|
-
backgroundColor,
|
|
46
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
47
|
-
padding,
|
|
48
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
49
|
-
paddingTop,
|
|
50
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
51
|
-
paddingRight,
|
|
52
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
53
|
-
paddingBottom,
|
|
54
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
55
|
-
paddingLeft,
|
|
56
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
57
|
-
...viewStyles
|
|
58
|
-
}
|
|
59
|
-
} = extractStyles(style);
|
|
60
|
-
const textField = React.useRef(undefined);
|
|
61
|
-
const [pickerVisible, setIsPickerVisible] = React.useState(false);
|
|
62
|
-
|
|
63
|
-
const toggleVisibility = () => {
|
|
64
|
-
setIsPickerVisible(!pickerVisible); // @ts-ignore
|
|
65
|
-
|
|
66
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
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(View, {
|
|
72
|
-
style: [styles.container, viewStyles]
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
74
|
-
disabled: disabled,
|
|
75
|
-
onPress: toggleVisibility
|
|
76
|
-
}, /*#__PURE__*/React.createElement(TextField, { ...props,
|
|
77
|
-
value: String(selectedLabel),
|
|
78
|
-
placeholder: placeholder,
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
ref: textField,
|
|
81
|
-
disabled: disabled,
|
|
82
|
-
pointerEvents: "none",
|
|
83
|
-
// @ts-expect-error
|
|
84
|
-
style: stylesWithoutMargin,
|
|
85
|
-
Icon: Icon
|
|
86
|
-
})), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
87
|
-
style: [styles.picker, {
|
|
88
|
-
backgroundColor: colors.divider
|
|
89
|
-
}]
|
|
90
|
-
}, /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
91
|
-
style: styles.pickerContainer
|
|
92
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
93
|
-
Icon: Icon,
|
|
94
|
-
type: "text",
|
|
95
|
-
onPress: toggleVisibility,
|
|
96
|
-
style: styles.closeButton
|
|
97
|
-
}, "Close"), /*#__PURE__*/React.createElement(NativePicker, {
|
|
98
|
-
style: {
|
|
99
|
-
backgroundColor: "white"
|
|
100
|
-
},
|
|
101
|
-
selectedValue: selectedValue,
|
|
102
|
-
onValueChange: onValueChange
|
|
103
|
-
}, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
104
|
-
label: o.label,
|
|
105
|
-
value: o.value,
|
|
106
|
-
key: o.value
|
|
107
|
-
})))))));
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const styles = StyleSheet.create({
|
|
111
|
-
container: {
|
|
112
|
-
alignSelf: "stretch"
|
|
113
|
-
},
|
|
114
|
-
picker: {
|
|
115
|
-
position: "absolute",
|
|
116
|
-
bottom: 0,
|
|
117
|
-
left: 0,
|
|
118
|
-
right: 0,
|
|
119
|
-
flexDirection: "row",
|
|
120
|
-
justifyContent: "center"
|
|
121
|
-
},
|
|
122
|
-
pickerContainer: {
|
|
123
|
-
backgroundColor: "white",
|
|
124
|
-
flexDirection: "column",
|
|
125
|
-
width: "100%"
|
|
126
|
-
},
|
|
127
|
-
closeButton: {
|
|
128
|
-
alignSelf: "flex-end"
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
export default withTheme(Picker);
|
|
132
|
-
//# sourceMappingURL=PickerComponent.ios.js.mapt.create({
|
|
133
|
-
container: {
|
|
134
|
-
alignSelf: "stretch"
|
|
135
|
-
},
|
|
136
|
-
picker: {
|
|
137
|
-
position: "absolute",
|
|
138
|
-
bottom: 0,
|
|
139
|
-
left: 0,
|
|
140
|
-
right: 0,
|
|
141
|
-
flexDirection: "row",
|
|
142
|
-
justifyContent: "center"
|
|
143
|
-
},
|
|
144
|
-
pickerContainer: {
|
|
145
|
-
backgroundColor: "white",
|
|
146
|
-
flexDirection: "column",
|
|
147
|
-
width: "100%"
|
|
148
|
-
},
|
|
149
|
-
closeButton: {
|
|
150
|
-
alignSelf: "flex-end"
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
export default withTheme(Picker);
|
|
154
|
-
//# sourceMappingURL=PickerComponent.ios.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.ios.js"],"names":["React","View","StyleSheet","SafeAreaView","omit","Picker","NativePicker","withTheme","Portal","Button","TextField","Touchable","extractStyles","Icon","style","options","placeholder","selectedValue","disabled","onValueChange","theme","colors","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","useRef","undefined","pickerVisible","setIsPickerVisible","useState","toggleVisibility","current","toggleFocus","stylesWithoutMargin","flatten","selectedLabel","find","o","value","label","createElement","styles","container","onPress","String","ref","pointerEvents","picker","divider","pickerContainer","type","closeButton","map","Item","key","create","alignSelf","position","bottom","left","right","flexDirection","justifyContent","width"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAu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,EAAAA,MAAM,EAAE;AACJU,IAAAA,QAAQ,EAAE,UADN;AAEJC,IAAAA,MAAM,EAAE,CAFJ;AAGJC,IAAAA,IAAI,EAAE,CAHF;AAIJC,IAAAA,KAAK,EAAE,CAJH;AAKJC,IAAAA,aAAa,EAAE,KALX;AAMJC,IAAAA,cAAc,EAAE;AANZ,GAJqB;AAY7Bb,EAAAA,eAAe,EAAE;AACb/B,IAAAA,eAAe,EAAE,OADJ;AAEb2C,IAAAA,aAAa,EAAE,QAFF;AAGbE,IAAAA,KAAK,EAAE;AAHM,GAZY;AAiB7BZ,EAAAA,WAAW,EAAE;AACTK,IAAAA,SAAS,EAAE;AADF;AAjBgB,CAAlB,CAAf;AAqBA,eAAe9D,SAAS,CAACF,MAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport omit from \"lodash.omit\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport { withTheme } from \"../../theming\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles } from \"../../utilities\";\nconst Picker = ({ Icon, style, options, placeholder, selectedValue, disabled = false, onValueChange = () => { }, theme: { colors }, ...props }) => {\n const { viewStyles: { borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles }, } = extractStyles(style);\n const textField = React.useRef(undefined);\n const [pickerVisible, setIsPickerVisible] = React.useState(false);\n const toggleVisibility = () => {\n setIsPickerVisible(!pickerVisible);\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n };\n const stylesWithoutMargin = style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n const selectedLabel = selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n return (React.createElement(View, { style: [styles.container, viewStyles] },\n React.createElement(Touchable, { disabled: disabled, onPress: toggleVisibility },\n React.createElement(TextField, { ...props, value: String(selectedLabel), placeholder: placeholder, \n // @ts-ignore\n ref: textField, disabled: disabled, pointerEvents: \"none\", \n // @ts-expect-error\n style: stylesWithoutMargin, Icon: Icon })),\n pickerVisible && (React.createElement(Portal, null,\n React.createElement(View, { style: [styles.picker, { backgroundColor: colors.divider }] },\n React.createElement(SafeAreaView, { style: styles.pickerContainer },\n React.createElement(Button, { Icon: Icon, type: \"text\", onPress: toggleVisibility, style: styles.closeButton }, \"Close\"),\n React.createElement(NativePicker, { style: { backgroundColor: \"white\" }, selectedValue: selectedValue, onValueChange: onValueChange }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value }))))))))));\n};\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n picker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n pickerContainer: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n closeButton: {\n alignSelf: \"flex-end\",\n },\n});\nexport default withTheme(Picker);\n"]}
|
|
@@ -1,113 +0,0 @@
|
|
|
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
|
-
import * as React from "react";
|
|
4
|
-
import { View, StyleSheet } from "react-native";
|
|
5
|
-
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import omit from "lodash.omit";
|
|
7
|
-
import { withTheme } from "../../theming";
|
|
8
|
-
import { extractStyles } from "../../utilities";
|
|
9
|
-
import TextField from "../TextField";
|
|
10
|
-
import Touchable from "../Touchable";
|
|
11
|
-
|
|
12
|
-
const Picker = _ref => {
|
|
13
|
-
var _options$find$label, _options$find;
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
style,
|
|
17
|
-
options,
|
|
18
|
-
placeholder,
|
|
19
|
-
selectedValue,
|
|
20
|
-
disabled = false,
|
|
21
|
-
onValueChange: onValueChangeOverride = () => {},
|
|
22
|
-
...props
|
|
23
|
-
} = _ref;
|
|
24
|
-
const {
|
|
25
|
-
viewStyles: {
|
|
26
|
-
borderRadius,
|
|
27
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
-
borderWidth,
|
|
29
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
30
|
-
borderTopWidth,
|
|
31
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
32
|
-
borderRightWidth,
|
|
33
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
34
|
-
borderBottomWidth,
|
|
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
|
-
})))));
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const styles = StyleSheet.create({
|
|
108
|
-
container: {
|
|
109
|
-
alignSelf: "stretch"
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
export default withTheme(Picker);
|
|
113
|
-
//# sourceMappingURL=PickerComponent.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.web.tsx"],"names":["React","View","StyleSheet","Picker","NativePicker","omit","withTheme","extractStyles","TextField","Touchable","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","flatten","selectedLabel","find","o","value","label","styles","container","flex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B;AAAmC,IAAA,KAAK,EAAEF,CAAC,CAACC,KAA5C;AAAmD,IAAA,GAAG,EAAED,CAAC,CAACC;AAA1D,IADD,CAfH,CADF,eAoBE,oBAAC,IAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,oBAAC,SAAD,eACM3B,KADN;AAEE,IAAA,KAAK,EAAEwB,aAFT;AAGE,IAAA,WAAW,EAAE7B,WAHf,CAIE;AAJF;AAKE,IAAA,GAAG,EAAEoB,SALP,CAKkB;AALlB;AAME,IAAA,QAAQ,EAAElB,QANZ,CAOE;AAPF;AAQE,IAAA,KAAK,EAAEyB;AART,KADF,CApBF,CALF,CADF;AAyCD,CAjGD;;AAmGA,MAAMO,MAAM,GAAG5C,UAAU,CAACuD,MAAX,CAAkB;AAC/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,SAAS,EAAE;AADF;AADoB,CAAlB,CAAf;AAMA,eAAepD,SAAS,CAACH,MAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n flex: 1,\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PickerComponentProps } from "./PickerTypes";
|
|
3
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<PickerComponentProps, "theme"> & {
|
|
4
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
5
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<PickerComponentProps> & React.FC<PickerComponentProps>, {}>;
|
|
6
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PickerComponentProps } from "./PickerTypes";
|
|
3
|
-
import type { IconSlot } from "../../interfaces/Icon";
|
|
4
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<PickerComponentProps & IconSlot, "theme"> & {
|
|
5
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
6
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<PickerComponentProps & IconSlot> & React.FC<PickerComponentProps & IconSlot>, {}>;
|
|
7
|
-
export default _default;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PickerComponentProps } from "./PickerTypes";
|
|
3
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<PickerComponentProps, "theme"> & {
|
|
4
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
5
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<PickerComponentProps> & React.FC<PickerComponentProps>, {}>;
|
|
6
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ViewStyle } from "react-native";
|
|
2
|
-
import { StyleProp } from "react-native";
|
|
3
|
-
import { Props as TextFieldProps } from "../TextField";
|
|
4
|
-
export interface PickerOption {
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
}
|
|
8
|
-
export interface PickerComponentProps extends TextFieldProps {
|
|
9
|
-
style?: StyleProp<ViewStyle> & {
|
|
10
|
-
height?: number;
|
|
11
|
-
};
|
|
12
|
-
options: PickerOption[];
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
selectedValue: string;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
onValueChange?: (value: string, index: number) => void;
|
|
17
|
-
defaultValue?: string;
|
|
18
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import omit from "lodash.omit";
|
|
4
|
-
import { withTheme } from "../../theming";
|
|
5
|
-
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import { extractStyles } from "../../utilities";
|
|
7
|
-
import TextField from "../TextField";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
|
-
const Picker = ({ style, options, placeholder, selectedValue, disabled = false, onValueChange: onValueChangeOverride = () => { }, ...props }) => {
|
|
10
|
-
const { viewStyles: { borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
11
|
-
borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
12
|
-
borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
13
|
-
borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
-
borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
-
borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
16
|
-
borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
17
|
-
backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18
|
-
padding, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
19
|
-
paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
20
|
-
paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
21
|
-
paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
22
|
-
paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
23
|
-
...viewStyles }, } = extractStyles(style);
|
|
24
|
-
const textField = React.useRef(undefined);
|
|
25
|
-
const onValueChange = (itemValue, itemIndex) => {
|
|
26
|
-
toggleFocus();
|
|
27
|
-
onValueChangeOverride(itemValue, itemIndex);
|
|
28
|
-
};
|
|
29
|
-
const toggleFocus = () => {
|
|
30
|
-
if (!disabled) {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const stylesWithoutMargin = style &&
|
|
36
|
-
omit(StyleSheet.flatten(style), [
|
|
37
|
-
"margin",
|
|
38
|
-
"marginTop",
|
|
39
|
-
"marginRight",
|
|
40
|
-
"marginBottom",
|
|
41
|
-
"marginLeft",
|
|
42
|
-
]);
|
|
43
|
-
const selectedLabel = selectedValue &&
|
|
44
|
-
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
45
|
-
return (React.createElement(Touchable, { disabled: disabled, onPress: toggleFocus, style: [styles.container, viewStyles] },
|
|
46
|
-
React.createElement(View, null,
|
|
47
|
-
React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange: onValueChange, style: {
|
|
48
|
-
opacity: 0,
|
|
49
|
-
position: "absolute",
|
|
50
|
-
top: 0,
|
|
51
|
-
left: 0,
|
|
52
|
-
right: 0,
|
|
53
|
-
bottom: 0,
|
|
54
|
-
width: "100%",
|
|
55
|
-
} }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value })))),
|
|
56
|
-
React.createElement(View, { pointerEvents: "none" },
|
|
57
|
-
React.createElement(TextField, { ...props, value: selectedLabel, placeholder: placeholder,
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
ref: textField, disabled: disabled,
|
|
60
|
-
// @ts-expect-error
|
|
61
|
-
style: stylesWithoutMargin })))));
|
|
62
|
-
};
|
|
63
|
-
const styles = StyleSheet.create({
|
|
64
|
-
container: {
|
|
65
|
-
alignSelf: "stretch",
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
export default withTheme(Picker);
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import omit from "lodash.omit";
|
|
4
|
-
import { withTheme } from "../../theming";
|
|
5
|
-
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import { extractStyles } from "../../utilities";
|
|
7
|
-
|
|
8
|
-
import TextField from "../TextField";
|
|
9
|
-
import Touchable from "../Touchable";
|
|
10
|
-
import { PickerComponentProps } from "./PickerTypes";
|
|
11
|
-
|
|
12
|
-
const Picker: React.FC<PickerComponentProps> = ({
|
|
13
|
-
style,
|
|
14
|
-
options,
|
|
15
|
-
placeholder,
|
|
16
|
-
selectedValue,
|
|
17
|
-
disabled = false,
|
|
18
|
-
onValueChange: onValueChangeOverride = () => {},
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
viewStyles: {
|
|
23
|
-
borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
24
|
-
borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
25
|
-
borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
26
|
-
borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
27
|
-
borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
-
borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
29
|
-
borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
30
|
-
backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
31
|
-
padding, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
32
|
-
paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
33
|
-
paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
34
|
-
paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
35
|
-
paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
36
|
-
...viewStyles
|
|
37
|
-
},
|
|
38
|
-
} = extractStyles(style);
|
|
39
|
-
|
|
40
|
-
const textField = React.useRef<typeof TextField | undefined>(undefined);
|
|
41
|
-
|
|
42
|
-
const onValueChange = (itemValue: string, itemIndex: number) => {
|
|
43
|
-
toggleFocus();
|
|
44
|
-
onValueChangeOverride(itemValue, itemIndex);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const toggleFocus = () => {
|
|
48
|
-
if (!disabled) {
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const stylesWithoutMargin =
|
|
55
|
-
style &&
|
|
56
|
-
omit(StyleSheet.flatten(style), [
|
|
57
|
-
"margin",
|
|
58
|
-
"marginTop",
|
|
59
|
-
"marginRight",
|
|
60
|
-
"marginBottom",
|
|
61
|
-
"marginLeft",
|
|
62
|
-
]);
|
|
63
|
-
|
|
64
|
-
const selectedLabel =
|
|
65
|
-
selectedValue &&
|
|
66
|
-
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Touchable
|
|
70
|
-
disabled={disabled}
|
|
71
|
-
onPress={toggleFocus}
|
|
72
|
-
style={[styles.container, viewStyles]}
|
|
73
|
-
>
|
|
74
|
-
<View>
|
|
75
|
-
<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
|
-
>
|
|
89
|
-
{options.map((o) => (
|
|
90
|
-
<NativePicker.Item label={o.label} value={o.value} key={o.value} />
|
|
91
|
-
))}
|
|
92
|
-
</NativePicker>
|
|
93
|
-
<View pointerEvents="none">
|
|
94
|
-
<TextField
|
|
95
|
-
{...props}
|
|
96
|
-
value={selectedLabel}
|
|
97
|
-
placeholder={placeholder}
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
100
|
-
disabled={disabled}
|
|
101
|
-
// @ts-expect-error
|
|
102
|
-
style={stylesWithoutMargin}
|
|
103
|
-
/>
|
|
104
|
-
</View>
|
|
105
|
-
</View>
|
|
106
|
-
</Touchable>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const styles = StyleSheet.create({
|
|
111
|
-
container: {
|
|
112
|
-
alignSelf: "stretch",
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
export default withTheme(Picker);
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
|
-
import omit from "lodash.omit";
|
|
5
|
-
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import { withTheme } from "../../theming";
|
|
7
|
-
import Portal from "../Portal/Portal";
|
|
8
|
-
import Button from "../DeprecatedButton";
|
|
9
|
-
import TextField from "../TextField";
|
|
10
|
-
import Touchable from "../Touchable";
|
|
11
|
-
import { extractStyles } from "../../utilities";
|
|
12
|
-
const Picker = ({ Icon, style, options, placeholder, selectedValue, disabled = false, onValueChange = () => { }, theme: { colors }, ...props }) => {
|
|
13
|
-
const { viewStyles: { borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
-
borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
-
borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
16
|
-
borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
17
|
-
borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18
|
-
borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
19
|
-
borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
20
|
-
backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
21
|
-
padding, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
22
|
-
paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
23
|
-
paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
24
|
-
paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
25
|
-
paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
26
|
-
...viewStyles }, } = extractStyles(style);
|
|
27
|
-
const textField = React.useRef(undefined);
|
|
28
|
-
const [pickerVisible, setIsPickerVisible] = React.useState(false);
|
|
29
|
-
const toggleVisibility = () => {
|
|
30
|
-
setIsPickerVisible(!pickerVisible);
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
33
|
-
};
|
|
34
|
-
const stylesWithoutMargin = style &&
|
|
35
|
-
omit(StyleSheet.flatten(style), [
|
|
36
|
-
"margin",
|
|
37
|
-
"marginTop",
|
|
38
|
-
"marginRight",
|
|
39
|
-
"marginBottom",
|
|
40
|
-
"marginLeft",
|
|
41
|
-
]);
|
|
42
|
-
const selectedLabel = selectedValue &&
|
|
43
|
-
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
44
|
-
return (React.createElement(View, { style: [styles.container, viewStyles] },
|
|
45
|
-
React.createElement(Touchable, { disabled: disabled, onPress: toggleVisibility },
|
|
46
|
-
React.createElement(TextField, { ...props, value: String(selectedLabel), placeholder: placeholder,
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
ref: textField, disabled: disabled, pointerEvents: "none",
|
|
49
|
-
// @ts-expect-error
|
|
50
|
-
style: stylesWithoutMargin, Icon: Icon })),
|
|
51
|
-
pickerVisible && (React.createElement(Portal, null,
|
|
52
|
-
React.createElement(View, { style: [styles.picker, { backgroundColor: colors.divider }] },
|
|
53
|
-
React.createElement(SafeAreaView, { style: styles.pickerContainer },
|
|
54
|
-
React.createElement(Button, { Icon: Icon, type: "text", onPress: toggleVisibility, style: styles.closeButton }, "Close"),
|
|
55
|
-
React.createElement(NativePicker, { style: { backgroundColor: "white" }, selectedValue: selectedValue, onValueChange: onValueChange }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value }))))))))));
|
|
56
|
-
};
|
|
57
|
-
const styles = StyleSheet.create({
|
|
58
|
-
container: {
|
|
59
|
-
alignSelf: "stretch",
|
|
60
|
-
},
|
|
61
|
-
picker: {
|
|
62
|
-
position: "absolute",
|
|
63
|
-
bottom: 0,
|
|
64
|
-
left: 0,
|
|
65
|
-
right: 0,
|
|
66
|
-
flexDirection: "row",
|
|
67
|
-
justifyContent: "center",
|
|
68
|
-
},
|
|
69
|
-
pickerContainer: {
|
|
70
|
-
backgroundColor: "white",
|
|
71
|
-
flexDirection: "column",
|
|
72
|
-
width: "100%",
|
|
73
|
-
},
|
|
74
|
-
closeButton: {
|
|
75
|
-
alignSelf: "flex-end",
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
export default withTheme(Picker);
|