@draftbit/core 44.1.8 → 44.1.9-222859.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.
Files changed (58) hide show
  1. package/lib/commonjs/components/ActionSheet/ActionSheetItem.js.map +1 -1
  2. package/lib/commonjs/components/Picker/Picker.js +254 -27
  3. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  4. package/lib/commonjs/components/StepIndicator.js.map +1 -1
  5. package/lib/commonjs/components/Stepper.js.map +1 -1
  6. package/lib/commonjs/hooks.js.map +1 -1
  7. package/lib/commonjs/mappings/AvatarEdit.js.map +1 -1
  8. package/lib/commonjs/mappings/Image.js.map +1 -1
  9. package/lib/commonjs/mappings/Picker.js +3 -1
  10. package/lib/commonjs/mappings/Picker.js.map +1 -1
  11. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  12. package/lib/commonjs/mappings/RowBodyIcon.js.map +1 -1
  13. package/lib/commonjs/mappings/RowHeadlineImageCaption.js.map +1 -1
  14. package/lib/commonjs/mappings/ScrollView.js.map +1 -1
  15. package/lib/commonjs/mappings/Swiper.js.map +1 -1
  16. package/lib/commonjs/mappings/WebView.js.map +1 -1
  17. package/lib/commonjs/styles/overlay.js.map +1 -1
  18. package/lib/commonjs/styles/shadow.js.map +1 -1
  19. package/lib/module/components/Picker/Picker.js +241 -29
  20. package/lib/module/components/Picker/Picker.js.map +1 -1
  21. package/lib/module/mappings/AudioPlayer.js.map +1 -1
  22. package/lib/module/mappings/Picker.js +4 -2
  23. package/lib/module/mappings/Picker.js.map +1 -1
  24. package/lib/typescript/src/components/Picker/Picker.d.ts +28 -4
  25. package/lib/typescript/src/mappings/Picker.d.ts +21 -0
  26. package/package.json +2 -2
  27. package/src/components/Picker/Picker.js +188 -18
  28. package/src/components/Picker/Picker.tsx +364 -35
  29. package/src/mappings/Picker.js +3 -1
  30. package/src/mappings/Picker.ts +4 -0
  31. package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -135
  32. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +0 -1
  33. package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -161
  34. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +0 -1
  35. package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -136
  36. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +0 -1
  37. package/lib/commonjs/components/Picker/PickerTypes.js +0 -6
  38. package/lib/commonjs/components/Picker/PickerTypes.js.map +0 -1
  39. package/lib/module/components/Picker/PickerComponent.android.js +0 -112
  40. package/lib/module/components/Picker/PickerComponent.android.js.map +0 -1
  41. package/lib/module/components/Picker/PickerComponent.ios.js +0 -135
  42. package/lib/module/components/Picker/PickerComponent.ios.js.map +0 -1
  43. package/lib/module/components/Picker/PickerComponent.web.js +0 -113
  44. package/lib/module/components/Picker/PickerComponent.web.js.map +0 -1
  45. package/lib/module/components/Picker/PickerTypes.js +0 -2
  46. package/lib/module/components/Picker/PickerTypes.js.map +0 -1
  47. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +0 -6
  48. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
  49. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
  50. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
  51. package/src/components/Picker/PickerComponent.android.js +0 -68
  52. package/src/components/Picker/PickerComponent.android.tsx +0 -116
  53. package/src/components/Picker/PickerComponent.ios.js +0 -78
  54. package/src/components/Picker/PickerComponent.ios.tsx +0 -142
  55. package/src/components/Picker/PickerComponent.web.js +0 -69
  56. package/src/components/Picker/PickerComponent.web.tsx +0 -117
  57. package/src/components/Picker/PickerTypes.js +0 -1
  58. package/src/components/Picker/PickerTypes.ts +0 -18
@@ -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,
@@ -131,6 +131,8 @@ export const SEED_DATA = [
131
131
  required: true,
132
132
  group: GROUPS.basic,
133
133
  },
134
+ iconSize: createIconSizeProp(),
135
+ iconColor: createColorProp(),
134
136
  },
135
137
  layout: {},
136
138
  },
@@ -5,6 +5,8 @@ import {
5
5
  FORM_TYPES,
6
6
  PROP_TYPES,
7
7
  FIELD_NAME,
8
+ createIconSizeProp,
9
+ createColorProp,
8
10
  } from "@draftbit/types";
9
11
 
10
12
  const SEED_DATA_PROPS = {
@@ -143,6 +145,8 @@ export const SEED_DATA = [
143
145
  required: true,
144
146
  group: GROUPS.basic,
145
147
  },
148
+ iconSize: createIconSizeProp(),
149
+ iconColor: createColorProp(),
146
150
  },
147
151
  layout: {},
148
152
  },
@@ -1,135 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _lodash = _interopRequireDefault(require("lodash.omit"));
13
-
14
- var _theming = require("../../theming");
15
-
16
- var _picker = require("@react-native-picker/picker");
17
-
18
- var _utilities = require("../../utilities");
19
-
20
- var _TextField = _interopRequireDefault(require("../TextField"));
21
-
22
- var _Touchable = _interopRequireDefault(require("../Touchable"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
- 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); }
31
-
32
- const Picker = _ref => {
33
- var _options$find$label, _options$find;
34
-
35
- let {
36
- style,
37
- options,
38
- placeholder,
39
- selectedValue,
40
- disabled = false,
41
- onValueChange: onValueChangeOverride = () => {},
42
- ...props
43
- } = _ref;
44
- const {
45
- viewStyles: {
46
- borderRadius,
47
- // eslint-disable-line @typescript-eslint/no-unused-vars
48
- borderWidth,
49
- // eslint-disable-line @typescript-eslint/no-unused-vars
50
- borderTopWidth,
51
- // eslint-disable-line @typescript-eslint/no-unused-vars
52
- borderRightWidth,
53
- // eslint-disable-line @typescript-eslint/no-unused-vars
54
- borderBottomWidth,
55
- // eslint-disable-line @typescript-eslint/no-unused-vars
56
- borderLeftWidth,
57
- // eslint-disable-line @typescript-eslint/no-unused-vars
58
- borderColor,
59
- // eslint-disable-line @typescript-eslint/no-unused-vars
60
- backgroundColor,
61
- // eslint-disable-line @typescript-eslint/no-unused-vars
62
- padding,
63
- // eslint-disable-line @typescript-eslint/no-unused-vars
64
- paddingTop,
65
- // eslint-disable-line @typescript-eslint/no-unused-vars
66
- paddingRight,
67
- // eslint-disable-line @typescript-eslint/no-unused-vars
68
- paddingBottom,
69
- // eslint-disable-line @typescript-eslint/no-unused-vars
70
- paddingLeft,
71
- // eslint-disable-line @typescript-eslint/no-unused-vars
72
- ...viewStyles
73
- }
74
- } = (0, _utilities.extractStyles)(style);
75
- const textField = React.useRef(undefined);
76
-
77
- const onValueChange = (itemValue, itemIndex) => {
78
- toggleFocus();
79
- onValueChangeOverride(itemValue, itemIndex);
80
- };
81
-
82
- const toggleFocus = () => {
83
- if (!disabled) {
84
- // @ts-ignore
85
- textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
86
- }
87
- };
88
-
89
- const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
90
- 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);
91
- return /*#__PURE__*/React.createElement(_Touchable.default, {
92
- disabled: disabled,
93
- onPress: toggleFocus,
94
- style: [styles.container, viewStyles]
95
- }, /*#__PURE__*/React.createElement(_reactNative.View, null, /*#__PURE__*/React.createElement(_picker.Picker, {
96
- enabled: !disabled,
97
- selectedValue: selectedValue,
98
- onValueChange: onValueChange,
99
- style: {
100
- opacity: 0,
101
- position: "absolute",
102
- top: 0,
103
- left: 0,
104
- right: 0,
105
- bottom: 0,
106
- width: "100%"
107
- }
108
- }, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
109
- label: o.label,
110
- value: o.value,
111
- key: o.value
112
- }))), /*#__PURE__*/React.createElement(_reactNative.View, {
113
- pointerEvents: "none"
114
- }, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
115
- value: selectedLabel,
116
- placeholder: placeholder // @ts-ignore
117
- ,
118
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
119
- ,
120
- disabled: disabled // @ts-expect-error
121
- ,
122
- style: stylesWithoutMargin
123
- })))));
124
- };
125
-
126
- const styles = _reactNative.StyleSheet.create({
127
- container: {
128
- alignSelf: "stretch"
129
- }
130
- });
131
-
132
- var _default = (0, _theming.withTheme)(Picker);
133
-
134
- exports.default = _default;
135
- //# sourceMappingURL=PickerComponent.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["PickerComponent.android.tsx"],"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","opacity","position","top","left","right","bottom","width","map","create","alignSelf"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;AAAA;;AAAA,MAR0C;AAC9CC,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,WAbU;AAaG;AACb,SAAGb;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AAE,CALF;AAMLC,MAAAA,MAAM,EAAE,CANH;AAOLC,MAAAA,KAAK,EAAE;AAPF;AAJT,KAcG7C,OAAO,CAAC8C,GAAR,CAAaZ,CAAD,iBACX,oBAAC,cAAD,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,iBAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,oBAAC,kBAAD,eACM7B,KADN;AAEE,IAAA,KAAK,EAAE0B,aAFT;AAGE,IAAA,WAAW,EAAE/B,WAHf,CAIE;AAJF;AAKE,IAAA,GAAG,EAAEoB,SALP,CAKkB;AALlB;AAME,IAAA,QAAQ,EAAElB,QANZ,CAOE;AAPF;AAQE,IAAA,KAAK,EAAE0B;AART,KADF,CAnBF,CALF,CADF;AAwCD,CAhGD;;AAkGA,MAAMQ,MAAM,GAAGP,wBAAWiB,MAAX,CAAkB;AAC/BT,EAAAA,SAAS,EAAE;AACTU,IAAAA,SAAS,EAAE;AADF;AADoB,CAAlB,CAAf;;eAMe,wBAAUlD,MAAV,C","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,161 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
13
-
14
- var _lodash = _interopRequireDefault(require("lodash.omit"));
15
-
16
- var _picker = require("@react-native-picker/picker");
17
-
18
- var _theming = require("../../theming");
19
-
20
- var _Portal = _interopRequireDefault(require("../Portal/Portal"));
21
-
22
- var _DeprecatedButton = _interopRequireDefault(require("../DeprecatedButton"));
23
-
24
- var _TextField = _interopRequireDefault(require("../TextField"));
25
-
26
- var _Touchable = _interopRequireDefault(require("../Touchable"));
27
-
28
- var _utilities = require("../../utilities");
29
-
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
-
34
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
36
- 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); }
37
-
38
- const Picker = _ref => {
39
- var _options$find$label, _options$find;
40
-
41
- let {
42
- Icon,
43
- style,
44
- options,
45
- placeholder,
46
- selectedValue,
47
- disabled = false,
48
- onValueChange = () => {},
49
- theme: {
50
- colors
51
- },
52
- ...props
53
- } = _ref;
54
- const {
55
- viewStyles: {
56
- borderRadius,
57
- // eslint-disable-line @typescript-eslint/no-unused-vars
58
- borderWidth,
59
- // eslint-disable-line @typescript-eslint/no-unused-vars
60
- borderTopWidth,
61
- // eslint-disable-line @typescript-eslint/no-unused-vars
62
- borderRightWidth,
63
- // eslint-disable-line @typescript-eslint/no-unused-vars
64
- borderBottomWidth,
65
- // eslint-disable-line @typescript-eslint/no-unused-vars
66
- borderLeftWidth,
67
- // eslint-disable-line @typescript-eslint/no-unused-vars
68
- borderColor,
69
- // eslint-disable-line @typescript-eslint/no-unused-vars
70
- backgroundColor,
71
- // eslint-disable-line @typescript-eslint/no-unused-vars
72
- padding,
73
- // eslint-disable-line @typescript-eslint/no-unused-vars
74
- paddingTop,
75
- // eslint-disable-line @typescript-eslint/no-unused-vars
76
- paddingRight,
77
- // eslint-disable-line @typescript-eslint/no-unused-vars
78
- paddingBottom,
79
- // eslint-disable-line @typescript-eslint/no-unused-vars
80
- paddingLeft,
81
- // eslint-disable-line @typescript-eslint/no-unused-vars
82
- ...viewStyles
83
- }
84
- } = (0, _utilities.extractStyles)(style);
85
- const textField = React.useRef(undefined);
86
- const [pickerVisible, setIsPickerVisible] = React.useState(false);
87
-
88
- const toggleVisibility = () => {
89
- setIsPickerVisible(!pickerVisible); // @ts-ignore
90
-
91
- textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
92
- };
93
-
94
- const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
95
- 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);
96
- return /*#__PURE__*/React.createElement(_reactNative.View, {
97
- style: [styles.container, viewStyles]
98
- }, /*#__PURE__*/React.createElement(_Touchable.default, {
99
- disabled: disabled,
100
- onPress: toggleVisibility
101
- }, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
102
- value: String(selectedLabel),
103
- placeholder: placeholder // @ts-ignore
104
- ,
105
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
106
- ,
107
- disabled: disabled,
108
- pointerEvents: "none" // @ts-expect-error
109
- ,
110
- style: stylesWithoutMargin,
111
- Icon: Icon
112
- }))), pickerVisible && /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
113
- style: [styles.picker, {
114
- backgroundColor: colors.divider
115
- }]
116
- }, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
117
- style: styles.pickerContainer
118
- }, /*#__PURE__*/React.createElement(_DeprecatedButton.default, {
119
- Icon: Icon,
120
- type: "text",
121
- onPress: toggleVisibility,
122
- style: styles.closeButton
123
- }, "Close"), /*#__PURE__*/React.createElement(_picker.Picker, {
124
- style: {
125
- backgroundColor: "white"
126
- },
127
- selectedValue: selectedValue,
128
- onValueChange: onValueChange
129
- }, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
130
- label: o.label,
131
- value: o.value,
132
- key: o.value
133
- })))))));
134
- };
135
-
136
- const styles = _reactNative.StyleSheet.create({
137
- container: {
138
- alignSelf: "stretch"
139
- },
140
- picker: {
141
- position: "absolute",
142
- bottom: 0,
143
- left: 0,
144
- right: 0,
145
- flexDirection: "row",
146
- justifyContent: "center"
147
- },
148
- pickerContainer: {
149
- backgroundColor: "white",
150
- flexDirection: "column",
151
- width: "100%"
152
- },
153
- closeButton: {
154
- alignSelf: "flex-end"
155
- }
156
- });
157
-
158
- var _default = (0, _theming.withTheme)(Picker);
159
-
160
- exports.default = _default;
161
- //# sourceMappingURL=PickerComponent.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["PickerComponent.ios.tsx"],"names":["Picker","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","React","useRef","undefined","pickerVisible","setIsPickerVisible","useState","toggleVisibility","current","toggleFocus","stylesWithoutMargin","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","String","picker","divider","pickerContainer","closeButton","map","create","alignSelf","position","bottom","left","right","flexDirection","justifyContent","width"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAGA,MAAMA,MAAiD,GAAG,QAUpD;AAAA;;AAAA,MAVqD;AACzDC,IAAAA,IADyD;AAEzDC,IAAAA,KAFyD;AAGzDC,IAAAA,OAHyD;AAIzDC,IAAAA,WAJyD;AAKzDC,IAAAA,aALyD;AAMzDC,IAAAA,QAAQ,GAAG,KAN8C;AAOzDC,IAAAA,aAAa,GAAG,MAAM,CAAE,CAPiC;AAQzDC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KARkD;AASzD,OAAGC;AATsD,GAUrD;AACJ,QAAM;AACJC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YADU;AACI;AACdC,MAAAA,WAFU;AAEG;AACbC,MAAAA,cAHU;AAGM;AAChBC,MAAAA,gBAJU;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EAAE,CAFF;AAGNC,IAAAA,IAAI,EAAE,CAHA;AAINC,IAAAA,KAAK,EAAE,CAJD;AAKNC,IAAAA,aAAa,EAAE,KALT;AAMNC,IAAAA,cAAc,EAAE;AANV,GAJuB;AAY/BV,EAAAA,eAAe,EAAE;AACf7B,IAAAA,eAAe,EAAE,OADF;AAEfsC,IAAAA,aAAa,EAAE,QAFA;AAGfE,IAAAA,KAAK,EAAE;AAHQ,GAZc;AAiB/BV,EAAAA,WAAW,EAAE;AACXG,IAAAA,SAAS,EAAE;AADA;AAjBkB,CAAlB,CAAf;;eAsBe,wBAAUpD,MAAV,C","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\";\n\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\n\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\nimport { extractStyles } from \"../../utilities\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nconst Picker: React.FC<PickerComponentProps & IconSlot> = ({\n Icon,\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange = () => {},\n theme: { colors },\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 const [pickerVisible, setIsPickerVisible] = React.useState(false);\n\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\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 <View style={[styles.container, viewStyles]}>\n <Touchable disabled={disabled} onPress={toggleVisibility}>\n <TextField\n {...props}\n value={String(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 pointerEvents=\"none\"\n // @ts-expect-error\n style={stylesWithoutMargin}\n Icon={Icon}\n />\n </Touchable>\n {pickerVisible && (\n <Portal>\n <View style={[styles.picker, { backgroundColor: colors.divider }]}>\n <SafeAreaView style={styles.pickerContainer}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={toggleVisibility}\n style={styles.closeButton}\n >\n Close\n </Button>\n <NativePicker\n style={{ backgroundColor: \"white\" }}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n >\n {options.map((o: any) => (\n <NativePicker.Item\n label={o.label}\n value={o.value}\n key={o.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n )}\n </View>\n );\n};\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});\n\nexport default withTheme(Picker);\n"]}
@@ -1,136 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _picker = require("@react-native-picker/picker");
13
-
14
- var _lodash = _interopRequireDefault(require("lodash.omit"));
15
-
16
- var _theming = require("../../theming");
17
-
18
- var _utilities = require("../../utilities");
19
-
20
- var _TextField = _interopRequireDefault(require("../TextField"));
21
-
22
- var _Touchable = _interopRequireDefault(require("../Touchable"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
- 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); }
31
-
32
- const Picker = _ref => {
33
- var _options$find$label, _options$find;
34
-
35
- let {
36
- style,
37
- options,
38
- placeholder,
39
- selectedValue,
40
- disabled = false,
41
- onValueChange: onValueChangeOverride = () => {},
42
- ...props
43
- } = _ref;
44
- const {
45
- viewStyles: {
46
- borderRadius,
47
- // eslint-disable-line @typescript-eslint/no-unused-vars
48
- borderWidth,
49
- // eslint-disable-line @typescript-eslint/no-unused-vars
50
- borderTopWidth,
51
- // eslint-disable-line @typescript-eslint/no-unused-vars
52
- borderRightWidth,
53
- // eslint-disable-line @typescript-eslint/no-unused-vars
54
- borderBottomWidth,
55
- // eslint-disable-line @typescript-eslint/no-unused-vars
56
- borderLeftWidth,
57
- // eslint-disable-line @typescript-eslint/no-unused-vars
58
- borderColor,
59
- // eslint-disable-line @typescript-eslint/no-unused-vars
60
- backgroundColor,
61
- // eslint-disable-line @typescript-eslint/no-unused-vars
62
- padding,
63
- // eslint-disable-line @typescript-eslint/no-unused-vars
64
- paddingTop,
65
- // eslint-disable-line @typescript-eslint/no-unused-vars
66
- paddingRight,
67
- // eslint-disable-line @typescript-eslint/no-unused-vars
68
- paddingBottom,
69
- // eslint-disable-line @typescript-eslint/no-unused-vars
70
- paddingLeft,
71
- // eslint-disable-line @typescript-eslint/no-unused-vars
72
- ...viewStyles
73
- }
74
- } = (0, _utilities.extractStyles)(style);
75
- const textField = React.useRef(undefined);
76
-
77
- const onValueChange = (itemValue, itemIndex) => {
78
- toggleFocus();
79
- onValueChangeOverride(itemValue, itemIndex);
80
- };
81
-
82
- const toggleFocus = () => {
83
- if (!disabled) {
84
- // @ts-ignore
85
- textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
86
- }
87
- };
88
-
89
- const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
90
- 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);
91
- return /*#__PURE__*/React.createElement(_Touchable.default, {
92
- disabled: disabled,
93
- onPress: toggleFocus,
94
- style: [styles.container, viewStyles]
95
- }, /*#__PURE__*/React.createElement(_reactNative.View, null, /*#__PURE__*/React.createElement(_picker.Picker, {
96
- enabled: !disabled,
97
- selectedValue: selectedValue,
98
- onValueChange: onValueChange,
99
- style: {
100
- flex: 1,
101
- opacity: 0,
102
- position: "absolute",
103
- top: 0,
104
- left: 0,
105
- right: 0,
106
- bottom: 0,
107
- width: "100%"
108
- }
109
- }, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
110
- label: o.label,
111
- value: o.value,
112
- key: o.value
113
- }))), /*#__PURE__*/React.createElement(_reactNative.View, {
114
- pointerEvents: "none"
115
- }, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
116
- value: selectedLabel,
117
- placeholder: placeholder // @ts-ignore
118
- ,
119
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
120
- ,
121
- disabled: disabled // @ts-expect-error
122
- ,
123
- style: stylesWithoutMargin
124
- })))));
125
- };
126
-
127
- const styles = _reactNative.StyleSheet.create({
128
- container: {
129
- alignSelf: "stretch"
130
- }
131
- });
132
-
133
- var _default = (0, _theming.withTheme)(Picker);
134
-
135
- exports.default = _default;
136
- //# sourceMappingURL=PickerComponent.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["PickerComponent.web.tsx"],"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","flex","opacity","position","top","left","right","bottom","width","map","create","alignSelf"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;AAAA;;AAAA,MAR0C;AAC9CC,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,WAbU;AAaG;AACb,SAAGb;AAdO;AADR,MAiBF,8BAAcR,KAAd,CAjBJ;AAmBA,QAAMsB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;AAEA,QAAMpB,aAAa,GAAG,CAACqB,SAAD,EAAoBC,SAApB,KAA0C;AAC9DC,IAAAA,WAAW;AACXtB,IAAAA,qBAAqB,CAACoB,SAAD,EAAYC,SAAZ,CAArB;AACD,GAHD;;AAKA,QAAMC,WAAW,GAAG,MAAM;AACxB,QAAI,CAACxB,QAAL,EAAe;AACb;AACAkB,MAAAA,SAAS,CAACO,OAAV,CAAkBD,WA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EAAC;AAApB,kBACE,oBAAC,kBAAD,eACM7B,KADN;AAEE,IAAA,KAAK,EAAE0B,aAFT;AAGE,IAAA,WAAW,EAAE/B,WAHf,CAIE;AAJF;AAKE,IAAA,GAAG,EAAEoB,SALP,CAKkB;AALlB;AAME,IAAA,QAAQ,EAAElB,QANZ,CAOE;AAPF;AAQE,IAAA,KAAK,EAAE0B;AART,KADF,CApBF,CALF,CADF;AAyCD,CAjGD;;AAmGA,MAAMQ,MAAM,GAAGP,wBAAWkB,MAAX,CAAkB;AAC/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,SAAS,EAAE;AADF;AADoB,CAAlB,CAAf;;eAMe,wBAAUnD,MAAV,C","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,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=PickerTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,112 +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 omit from "lodash.omit";
6
- import { withTheme } from "../../theming";
7
- import { Picker as NativePicker } from "@react-native-picker/picker";
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
- 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
- })))));
104
- };
105
-
106
- const styles = StyleSheet.create({
107
- container: {
108
- alignSelf: "stretch"
109
- }
110
- });
111
- export default withTheme(Picker);
112
- //# sourceMappingURL=PickerComponent.android.js.map