@draftbit/core 46.1.3 → 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 (33) hide show
  1. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  2. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  3. package/lib/module/components/Touchable.js +16 -2
  4. package/lib/module/components/Touchable.js.map +1 -1
  5. package/package.json +2 -2
  6. package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -135
  7. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +0 -1
  8. package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -161
  9. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +0 -1
  10. package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -136
  11. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +0 -1
  12. package/lib/commonjs/components/Picker/PickerTypes.js +0 -6
  13. package/lib/commonjs/components/Picker/PickerTypes.js.map +0 -1
  14. package/lib/module/components/Picker/PickerComponent.android.js +0 -112
  15. package/lib/module/components/Picker/PickerComponent.android.js.map +0 -1
  16. package/lib/module/components/Picker/PickerComponent.ios.js +0 -135
  17. package/lib/module/components/Picker/PickerComponent.ios.js.map +0 -1
  18. package/lib/module/components/Picker/PickerComponent.web.js +0 -113
  19. package/lib/module/components/Picker/PickerComponent.web.js.map +0 -1
  20. package/lib/module/components/Picker/PickerTypes.js +0 -2
  21. package/lib/module/components/Picker/PickerTypes.js.map +0 -1
  22. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +0 -6
  23. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
  24. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
  25. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
  26. package/src/components/Picker/PickerComponent.android.js +0 -68
  27. package/src/components/Picker/PickerComponent.android.tsx +0 -116
  28. package/src/components/Picker/PickerComponent.ios.js +0 -78
  29. package/src/components/Picker/PickerComponent.ios.tsx +0 -142
  30. package/src/components/Picker/PickerComponent.web.js +0 -69
  31. package/src/components/Picker/PickerComponent.web.tsx +0 -117
  32. package/src/components/Picker/PickerTypes.js +0 -1
  33. package/src/components/Picker/PickerTypes.ts +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["export { default as ActionSheet } from \"./ActionSheet\";\nexport { default as ActionSheetItem } from \"./ActionSheetItem\";\nexport { default as ActionSheetCancel } from \"./ActionSheetCancel\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA"}
1
+ {"version":3,"names":[],"sources":["index.js"],"sourcesContent":["export { default as ActionSheet } from \"./ActionSheet\";\nexport { default as ActionSheetItem } from \"./ActionSheetItem\";\nexport { default as ActionSheetCancel } from \"./ActionSheetCancel\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA"}
@@ -1 +1 @@
1
- {"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","triggers","Triggers","OnValueChange","props","direction","createDirectionProp","fieldName","createFieldNameProp","handlerPropName","valuePropName","defaultValue"],"sources":["RadioButtonGroup.js"],"sourcesContent":["import { COMPONENT_TYPES, createFieldNameProp, createDirectionProp, Triggers, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Radio Button Group\",\n tag: \"RadioButtonGroup\",\n category: COMPONENT_TYPES.input,\n layout: {},\n triggers: [Triggers.OnValueChange],\n props: {\n direction: createDirectionProp(),\n fieldName: createFieldNameProp({\n handlerPropName: \"onValueChange\",\n valuePropName: \"value\",\n defaultValue: \"radioButtonGroupValue\",\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;;AACO,MAAMA,SAAS,GAAG;EACrBC,IAAI,EAAE,oBADe;EAErBC,GAAG,EAAE,kBAFgB;EAGrBC,QAAQ,EAAEC,sBAAA,CAAgBC,KAHL;EAIrBC,MAAM,EAAE,EAJa;EAKrBC,QAAQ,EAAE,CAACC,eAAA,CAASC,aAAV,CALW;EAMrBC,KAAK,EAAE;IACHC,SAAS,EAAE,IAAAC,0BAAA,GADR;IAEHC,SAAS,EAAE,IAAAC,0BAAA,EAAoB;MAC3BC,eAAe,EAAE,eADU;MAE3BC,aAAa,EAAE,OAFY;MAG3BC,YAAY,EAAE;IAHa,CAApB;EAFR;AANc,CAAlB"}
1
+ {"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","triggers","Triggers","OnValueChange","props","direction","createDirectionProp","fieldName","createFieldNameProp","handlerPropName","valuePropName","defaultValue"],"sources":["RadioButtonGroup.ts"],"sourcesContent":["import {\n COMPONENT_TYPES,\n createFieldNameProp,\n createDirectionProp,\n Triggers,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Radio Button Group\",\n tag: \"RadioButtonGroup\",\n category: COMPONENT_TYPES.input,\n layout: {},\n triggers: [Triggers.OnValueChange],\n props: {\n direction: createDirectionProp(),\n fieldName: createFieldNameProp({\n handlerPropName: \"onValueChange\",\n valuePropName: \"value\",\n defaultValue: \"radioButtonGroupValue\",\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,oBADiB;EAEvBC,GAAG,EAAE,kBAFkB;EAGvBC,QAAQ,EAAEC,sBAAA,CAAgBC,KAHH;EAIvBC,MAAM,EAAE,EAJe;EAKvBC,QAAQ,EAAE,CAACC,eAAA,CAASC,aAAV,CALa;EAMvBC,KAAK,EAAE;IACLC,SAAS,EAAE,IAAAC,0BAAA,GADN;IAELC,SAAS,EAAE,IAAAC,0BAAA,EAAoB;MAC7BC,eAAe,EAAE,eADY;MAE7BC,aAAa,EAAE,OAFc;MAG7BC,YAAY,EAAE;IAHe,CAApB;EAFN;AANgB,CAAlB"}
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import React from "react";
4
2
  import { Pressable } from "react-native";
5
3
  export default function Touchable(_ref) {
@@ -10,6 +8,22 @@ export default function Touchable(_ref) {
10
8
  style,
11
9
  ...props
12
10
  } = _ref;
11
+ return /*#__PURE__*/React.createElement(Pressable, {
12
+ onPress: onPress,
13
+ disabled: disabled,
14
+ hitSlop: 8,
15
+ style: _ref2 => {
16
+ let {
17
+ pressed
18
+ } = _ref2;
19
+ return [{
20
+ opacity: pressed || disabled ? 0.75 : 1
21
+ }, style];
22
+ },
23
+ ...props
24
+ }, children);
25
+ }
26
+ //# sourceMappingURL=Touchable.js.map
13
27
  return /*#__PURE__*/React.createElement(Pressable, _extends({
14
28
  onPress: onPress,
15
29
  disabled: disabled,
@@ -1 +1 @@
1
- {"version":3,"names":["React","Pressable","Touchable","children","disabled","onPress","style","props","pressed","opacity"],"sources":["Touchable.tsx"],"sourcesContent":["import React from \"react\";\nimport { Pressable, ViewStyle, PressableProps } from \"react-native\";\n\ntype Props = {\n disabled?: boolean;\n children: React.ReactNode;\n style?: ViewStyle;\n onPress?: () => void;\n} & PressableProps;\n\nexport default function Touchable({\n children,\n disabled,\n onPress,\n style,\n ...props\n}: Props) {\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={8}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed || disabled ? 0.75 : 1,\n },\n style,\n ];\n }}\n {...props}\n >\n {children}\n </Pressable>\n );\n}\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAAqD,cAArD;AASA,eAAe,SAASC,SAAT,OAML;EAAA,IANwB;IAChCC,QADgC;IAEhCC,QAFgC;IAGhCC,OAHgC;IAIhCC,KAJgC;IAKhC,GAAGC;EAL6B,CAMxB;EACR,oBACE,oBAAC,SAAD;IACE,OAAO,EAAEF,OADX;IAEE,QAAQ,EAAED,QAFZ;IAGE,OAAO,EAAE,CAHX;IAIE,KAAK,EAAE,SAAiB;MAAA,IAAhB;QAAEI;MAAF,CAAgB;MACtB,OAAO,CACL;QACEC,OAAO,EAAED,OAAO,IAAIJ,QAAX,GAAsB,IAAtB,GAA6B;MADxC,CADK,EAILE,KAJK,CAAP;IAMD;EAXH,GAYMC,KAZN,GAcGJ,QAdH,CADF;AAkBD"}
1
+ {"version":3,"names":["React","Pressable","Touchable","children","disabled","onPress","style","props","createElement","hitSlop","pressed","opacity"],"sources":["Touchable.js"],"sourcesContent":["import React from \"react\";\nimport { Pressable } from \"react-native\";\nexport default function Touchable({ children, disabled, onPress, style, ...props }) {\n return (React.createElement(Pressable, { onPress: onPress, disabled: disabled, hitSlop: 8, style: ({ pressed }) => {\n return [\n {\n opacity: pressed || disabled ? 0.75 : 1,\n },\n style,\n ];\n }, ...props }, children));\n}\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,eAAe,SAASC,SAAT,OAAqE;EAAA,IAAlD;IAAEC,QAAF;IAAYC,QAAZ;IAAsBC,OAAtB;IAA+BC,KAA/B;IAAsC,GAAGC;EAAzC,CAAkD;EAChF,oBAAQP,KAAK,CAACQ,aAAN,CAAoBP,SAApB,EAA+B;IAAEI,OAAO,EAAEA,OAAX;IAAoBD,QAAQ,EAAEA,QAA9B;IAAwCK,OAAO,EAAE,CAAjD;IAAoDH,KAAK,EAAE,SAAiB;MAAA,IAAhB;QAAEI;MAAF,CAAgB;MAC3G,OAAO,CACH;QACIC,OAAO,EAAED,OAAO,IAAIN,QAAX,GAAsB,IAAtB,GAA6B;MAD1C,CADG,EAIHE,KAJG,CAAP;IAMH,CAPkC;IAOhC,GAAGC;EAP6B,CAA/B,EAOWJ,QAPX,CAAR;AAQH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.1.3",
3
+ "version": "46.1.4-e6469c.0+e6469ca2",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -79,5 +79,5 @@
79
79
  ]
80
80
  ]
81
81
  },
82
- "gitHead": "50d88e23c89fdd426db0b3948b0a36643c18ccb8"
82
+ "gitHead": "e6469ca2737c7bb1742ee5f5897d212003e00cdd"
83
83
  }
@@ -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;MAI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AO,EAAE,CADJ;MAELC,QAAQ,EAAE,UAFL;MAGLC,GAAG,EAAE,CAHA;MAILC,IAAI,EAAE,CAJD;MAKLC,KAAK,EAAE,CALF;MAMLC,MAAM,EAAE,CANH;MAOLC,KAAK,EAAE;IAPF;EAJT,GAcG/C,OAAO,CAACgD,GAAR,CAAaZ,CAAD,iBACX,oBAAC,cAAD,CAAc,IAAd;IAAmB,KAAK,EAAEA,CAAC,CAACE,KAA5B;IAAmC,KAAK,EAAEF,CAAC,CAACC,KAA5C;IAAmD,GAAG,EAAED,CAAC,CAACC;EAA1D,EADD,CAdH,CADF,eAmBE,oBAAC,iBAAD;IAAM,aAAa,EAAC;EAApB,gBACE,oBAAC,kBAAD,eACM/B,KADN;IAEE,KAAK,EAAE4B,aAFT;IAGE,WAAW,EAAEjC,WAHf,CAIE;IAJF;IAKE,GAAG,EAAEqB,SALP,CAKkB;IALlB;IAME,QAAQ,EAAEnB,QANZ,CAOE;IAPF;IAQE,KAAK,EAAE2B;EART,GADF,CAnBF,CALF,CADF;AAwCD,CAhGD;;AAkGA,MAAMS,MAAM,GAAGP,uBAAA,CAAWiB,MAAX,CAAkB;EAC/BT,SAAS,EAAE;IACTU,SAAS,EAAE;EADF;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,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AC/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,a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EAAmBjC,UAAnB;EAHT,gBAKE,oBAAC,iBAAD,qBACE,oBAAC,cAAD;IACE,OAAO,EAAE,CAACJ,QADZ;IAEE,aAAa,EAAED,aAFjB;IAGE,aAAa,EAAEE,aAHjB;IAIE,KAAK,EAAE;MACLqC,IAAI,EAAE,CADD;MAELC,OAAO,EAAE,CAFJ;MAGLC,QAAQ,EAAE,UAHL;MAILC,GAAG,EAAE,CAJA;MAKLC,IAAI,EAAE,CALD;MAMLC,KAAK,EAAE,CANF;MAOLC,MAAM,EAAE,CAPH;MAQLC,KAAK,EAAE;IARF;EAJT,GAeGhD,OAAO,CAACiD,GAAR,CAAab,CAAD,iBACX,oBAAC,cAAD,CAAc,IAAd;IAAmB,KAAK,EAAEA,CAAC,CAACE,KAA5B;IAAmC,KAAK,EAAEF,CAAC,CAACC,KAA5C;IAAmD,GAAG,EAAED,CAAC,CAACC;EAA1D,EADD,CAfH,CADF,eAoBE,oBAAC,iBAAD;IAAM,aAAa,EAAC;EAApB,gBACE,oBAAC,kBAAD,eACM/B,KADN;IAEE,KAAK,EAAE4B,aAFT;IAGE,WAAW,EAAEjC,WAHf,CAIE;IAJF;IAKE,GAAG,EAAEqB,SALP,CAKkB;IALlB;IAME,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":""}