@draftbit/core 46.1.1 → 46.1.4-e6469c.0

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 (48) hide show
  1. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  2. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +2 -4
  3. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  4. package/lib/commonjs/components/Picker/Picker.js +5 -7
  5. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  6. package/lib/commonjs/mappings/CheckboxGroup.js.map +1 -1
  7. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  8. package/lib/commonjs/mappings/RowHeadlineImageCaption.js.map +1 -1
  9. package/lib/commonjs/mappings/Swiper.js.map +1 -1
  10. package/lib/module/components/DatePicker/DatePickerComponent.web.js +2 -4
  11. package/lib/module/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  12. package/lib/module/components/Picker/Picker.js +5 -4
  13. package/lib/module/components/Picker/Picker.js.map +1 -1
  14. package/lib/module/components/Touchable.js +16 -2
  15. package/lib/module/components/Touchable.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/components/DatePicker/DatePickerComponent.web.js +2 -2
  18. package/src/components/DatePicker/DatePickerComponent.web.tsx +2 -2
  19. package/src/components/Picker/Picker.js +5 -4
  20. package/src/components/Picker/Picker.tsx +6 -8
  21. package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -135
  22. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +0 -1
  23. package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -161
  24. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +0 -1
  25. package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -136
  26. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +0 -1
  27. package/lib/commonjs/components/Picker/PickerTypes.js +0 -6
  28. package/lib/commonjs/components/Picker/PickerTypes.js.map +0 -1
  29. package/lib/module/components/Picker/PickerComponent.android.js +0 -112
  30. package/lib/module/components/Picker/PickerComponent.android.js.map +0 -1
  31. package/lib/module/components/Picker/PickerComponent.ios.js +0 -135
  32. package/lib/module/components/Picker/PickerComponent.ios.js.map +0 -1
  33. package/lib/module/components/Picker/PickerComponent.web.js +0 -113
  34. package/lib/module/components/Picker/PickerComponent.web.js.map +0 -1
  35. package/lib/module/components/Picker/PickerTypes.js +0 -2
  36. package/lib/module/components/Picker/PickerTypes.js.map +0 -1
  37. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +0 -6
  38. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
  39. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
  40. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
  41. package/src/components/Picker/PickerComponent.android.js +0 -68
  42. package/src/components/Picker/PickerComponent.android.tsx +0 -116
  43. package/src/components/Picker/PickerComponent.ios.js +0 -78
  44. package/src/components/Picker/PickerComponent.ios.tsx +0 -142
  45. package/src/components/Picker/PickerComponent.web.js +0 -69
  46. package/src/components/Picker/PickerComponent.web.tsx +0 -117
  47. package/src/components/Picker/PickerTypes.js +0 -1
  48. package/src/components/Picker/PickerTypes.ts +0 -18
@@ -113,9 +113,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
113
113
  ...additionalBorderStyles,
114
114
  ...additionalMarginStyles,
115
115
  ]);
116
- const selectedLabel = internalValue &&
117
- (pickerOptions.find((option) => option.value === internalValue)?.label ??
118
- internalValue);
116
+ const optionExists = internalValue
117
+ ? pickerOptions.find((option) => option.value === internalValue)
118
+ : { label: null };
119
+ const selectedLabel = optionExists && optionExists.label ? optionExists.label : placeholder;
119
120
  const labelText = label ? (React.createElement(Text, { style: {
120
121
  textAlign: textStyles.textAlign,
121
122
  color: unstyledColor,
@@ -178,7 +179,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
178
179
  ] },
179
180
  React.createElement(View, { style: styles.primaryTextContainer },
180
181
  labelText,
181
- React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel ?? placeholder))),
182
+ React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel))),
182
183
  rightIcon)),
183
184
  assistiveTextLabel),
184
185
  isIos && pickerVisible ? (React.createElement(Portal, null,
@@ -212,12 +212,12 @@ const Picker: React.FC<PickerProps> = ({
212
212
  ...additionalMarginStyles,
213
213
  ]);
214
214
 
215
+ const optionExists = internalValue
216
+ ? pickerOptions.find((option) => option.value === internalValue)
217
+ : { label: null };
218
+
215
219
  const selectedLabel =
216
- internalValue &&
217
- ((pickerOptions as unknown as PickerOption[]).find(
218
- (option) => option.value === internalValue
219
- )?.label ??
220
- internalValue);
220
+ optionExists && optionExists.label ? optionExists.label : placeholder;
221
221
 
222
222
  const labelText = label ? (
223
223
  <Text
@@ -333,9 +333,7 @@ const Picker: React.FC<PickerProps> = ({
333
333
  <View style={styles.primaryTextContainer}>
334
334
  {labelText}
335
335
 
336
- <Text style={primaryTextStyle}>
337
- {String(selectedLabel ?? placeholder)}
338
- </Text>
336
+ <Text style={primaryTextStyle}>{String(selectedLabel)}</Text>
339
337
  </View>
340
338
 
341
339
  {rightIcon}
@@ -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 ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
-
32
- const Picker = _ref => {
33
- var _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 = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? 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,"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","opacity","position","top","left","right","bottom","width","map","create","alignSelf","withTheme"],"sources":["PickerComponent.android.tsx"],"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"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;EAAA;;EAAA,IAR0C;IAC9CC,KAD8C;IAE9CC,OAF8C;IAG9CC,WAH8C;IAI9CC,aAJ8C;IAK9CC,QAAQ,GAAG,KALmC;IAM9CC,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;IAO9C,GAAGC;EAP2C,CAQ1C;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAActB,KAAd,CAjBJ;EAmBA,MAAMuB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;EAEA,MAAMrB,aAAa,GAAG,CAACsB,SAAD,EAAoBC,SAApB,KAA0C;IAC9DC,WAAW;IACXvB,qBAAqB,CAACqB,SAAD,EAAYC,SAAZ,CAArB;EACD,CAHD;;EAKA,MAAMC,WAAW,GAAG,MAAM;IACxB,IAAI,CAACzB,QAAL,EAAe;MACb;MACAmB,SAAS,CAACO,OAAV,CAAkBD,WAAlB,GAFa,CAEoB;IAClC;EACF,CALD;;EAOA,MAAME,mBAAmB,GACvB/B,KAAK,IACL,IAAAgC,eAAA,EAAKC,uBAAA,CAAWC,OAAX,CAAmBlC,KAAnB,CAAL,EAAgC,CAC9B,QAD8B,EAE9B,WAF8B,EAG9B,aAH8B,EAI9B,cAJ8B,EAK9B,Y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;AADoB,CAAlB,CAAf;;eAMe,IAAAC,kBAAA,EAAUrD,MAAV,C"}
@@ -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 ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
-
38
- const Picker = _ref => {
39
- var _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 = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? 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,"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","extractStyles","textField","React","useRef","undefined","pickerVisible","setIsPickerVisible","useState","toggleVisibility","current","toggleFocus","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","String","picker","divider","pickerContainer","closeButton","map","create","alignSelf","position","bottom","left","right","flexDirection","justifyContent","width","withTheme"],"sources":["PickerComponent.ios.tsx"],"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"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAGA,MAAMA,MAAiD,GAAG,QAUpD;EAAA;;EAAA,IAVqD;IACzDC,IADyD;IAEzDC,KAFyD;IAGzDC,OAHyD;IAIzDC,WAJyD;IAKzDC,aALyD;IAMzDC,QAAQ,GAAG,KAN8C;IAOzDC,aAAa,GAAG,MAAM,CAAE,CAPiC;IAQzDC,KAAK,EAAE;MAAEC;IAAF,CARkD;IASzD,GAAGC;EATsD,CAUrD;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAAcvB,KAAd,CAjBJ;EAmBA,MAAMwB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;EACA,MAAM,CAACC,aAAD,EAAgBC,kBAAhB,IAAsCJ,KAAK,CAACK,QAAN,CAAe,KAAf,CAA5C;;EAEA,MAAMC,gBAAgB,GAAG,M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E,OAAO,EAAEgC,gBAHX;IAIE,KAAK,EAAEY,MAAM,CAACM;EAJhB,WADF,eASE,oBAAC,cAAD;IACE,KAAK,EAAE;MAAEhC,eAAe,EAAE;IAAnB,CADT;IAEE,aAAa,EAAEd,aAFjB;IAGE,aAAa,EAAEE;EAHjB,GAKGJ,OAAO,CAACiD,GAAR,CAAaV,CAAD,iBACX,oBAAC,cAAD,CAAc,IAAd;IACE,KAAK,EAAEA,CAAC,CAACE,KADX;IAEE,KAAK,EAAEF,CAAC,CAACC,KAFX;IAGE,GAAG,EAAED,CAAC,CAACC;EAHT,EADD,CALH,CATF,CADF,CADF,CAhBJ,CADF;AA+CD,CApGD;;AAsGA,MAAME,MAAM,GAAGP,uBAAA,CAAWe,MAAX,CAAkB;EAC/BP,SAAS,EAAE;IACTQ,SAAS,EAAE;EADF,CADoB;EAI/BN,MAAM,EAAE;IACNO,QAAQ,EAAE,UADJ;IAENC,MAAM,EAAE,CAFF;IAGNC,IAAI,EAAE,CAHA;IAINC,KAAK,EAAE,CAJD;IAKNC,aAAa,EAAE,KALT;IAMNC,cAAc,EAAE;EANV,CAJuB;EAY/BV,eAAe,EAAE;IACf/B,eAAe,EAAE,OADF;IAEfwC,aAAa,EAAE,QAFA;IAGfE,KAAK,EAAE;EAHQ,CAZc;EAiB/BV,WAAW,EAAE;IACXG,SAAS,EAAE;EADA;AAjBkB,CAAlB,CAAf;;eAsBe,IAAAQ,kBAAA,EAAU9D,MAAV,C"}
@@ -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 ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
-
32
- const Picker = _ref => {
33
- var _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 = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? 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,"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","flex","opacity","position","top","left","right","bottom","width","map","create","alignSelf","withTheme"],"sources":["PickerComponent.web.tsx"],"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"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;EAAA;;EAAA,IAR0C;IAC9CC,KAD8C;IAE9CC,OAF8C;IAG9CC,WAH8C;IAI9CC,aAJ8C;IAK9CC,QAAQ,GAAG,KALmC;IAM9CC,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;IAO9C,GAAGC;EAP2C,CAQ1C;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAActB,KAAd,CAjBJ;EAmBA,MAAMuB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;EAEA,MAAMrB,aAAa,GAAG,CAACsB,SAAD,EAAoBC,SAApB,KAA0C;IAC9DC,WAAW;IACXvB,qBAAqB,CAACqB,SAAD,EAAYC,SAAZ,CAArB;EACD,CAHD;;EAKA,MAAMC,WAAW,GAAG,MAAM;IACxB,IAAI,CAACzB,QAAL,EAAe;MACb;MACAmB,SAAS,CAACO,OAAV,CAAkBD,WAAlB,GAFa,CAEoB;IAClC;EACF,CALD;;EAOA,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,QAAQ,EAAEnB,QANZ,CAOE;IAPF;IAQE,KAAK,EAAE2B;EART,GADF,CApBF,CALF,CADF;AAyCD,CAjGD;;AAmGA,MAAMS,MAAM,GAAGP,uBAAA,CAAWkB,MAAX,CAAkB;EAC/BV,SAAS,EAAE;IACTW,SAAS,EAAE;EADF;AADoB,CAAlB,CAAf;;eAMe,IAAAC,kBAAA,EAAUtD,MAAV,C"}
@@ -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,"names":[],"sources":["PickerTypes.ts"],"sourcesContent":["import { ViewStyle } from \"react-native\";\nimport { StyleProp } from \"react-native\";\nimport { Props as TextFieldProps } from \"../TextField\";\n\nexport interface PickerOption {\n value: string;\n label: string;\n}\n\nexport interface PickerComponentProps extends TextFieldProps {\n style?: StyleProp<ViewStyle> & { height?: number };\n options: PickerOption[];\n placeholder?: string;\n selectedValue: string;\n disabled?: boolean;\n onValueChange?: (value: string, index: number) => void;\n defaultValue?: string;\n}\n"],"mappings":""}