@draftbit/core 46.1.4-e6469c.0 → 46.2.1-435444.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
- package/lib/commonjs/components/CardContainer.js +16 -5
- package/lib/commonjs/components/CardContainer.js.map +1 -1
- package/lib/commonjs/components/Carousel.js +3 -1
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Config.js +3 -3
- package/lib/commonjs/components/Config.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +3 -3
- package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -5
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +135 -0
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +161 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js +136 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerTypes.js +6 -0
- package/lib/commonjs/components/Picker/PickerTypes.js.map +1 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js +1 -1
- package/lib/commonjs/components/StepIndicator.js.map +1 -1
- package/lib/commonjs/components/Stepper.js +1 -1
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/mappings/NumberInput.js +241 -0
- package/lib/commonjs/mappings/NumberInput.js.map +1 -0
- package/lib/commonjs/mappings/RadioButton.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/mappings/Text.js +33 -26
- package/lib/commonjs/mappings/Text.js.map +1 -1
- package/lib/commonjs/mappings/TextArea.js +181 -2
- package/lib/commonjs/mappings/TextArea.js.map +1 -1
- package/lib/commonjs/mappings/TextField.js +191 -2
- package/lib/commonjs/mappings/TextField.js.map +1 -1
- package/lib/commonjs/mappings/TextInput.js +180 -29
- package/lib/commonjs/mappings/TextInput.js.map +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Carousel.js +3 -1
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/Config.js +3 -3
- package/lib/module/components/Config.js.map +1 -1
- package/lib/module/components/Container.js +17 -5
- package/lib/module/components/Container.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +3 -3
- package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/components/HeaderLarge.js.map +1 -1
- package/lib/module/components/HeaderMedium.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +4 -5
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +112 -0
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.ios.js +135 -0
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.web.js +113 -0
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/module/components/Picker/PickerTypes.js +2 -0
- package/lib/module/components/Picker/PickerTypes.js.map +1 -0
- package/lib/module/components/RadioButton/RadioButton.js +1 -1
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/StepIndicator.js +1 -1
- package/lib/module/components/StepIndicator.js.map +1 -1
- package/lib/module/components/Stepper.js +1 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/components/Touchable.js +2 -16
- package/lib/module/components/Touchable.js.map +1 -1
- package/lib/module/mappings/NumberInput.js +231 -0
- package/lib/module/mappings/NumberInput.js.map +1 -0
- package/lib/module/mappings/Text.js +33 -26
- package/lib/module/mappings/Text.js.map +1 -1
- package/lib/module/mappings/TextArea.js +182 -3
- package/lib/module/mappings/TextArea.js.map +1 -1
- package/lib/module/mappings/TextField.js +192 -3
- package/lib/module/mappings/TextField.js.map +1 -1
- package/lib/module/mappings/TextInput.js +180 -29
- package/lib/module/mappings/TextInput.js.map +1 -1
- package/lib/module/utilities.js +1 -1
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +7 -0
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerTypes.d.ts +18 -0
- package/lib/typescript/src/mappings/NumberInput.d.ts +297 -0
- package/lib/typescript/src/mappings/Text.d.ts +24 -10
- package/lib/typescript/src/mappings/TextArea.d.ts +1 -11
- package/lib/typescript/src/mappings/TextField.d.ts +4 -4
- package/lib/typescript/src/mappings/TextInput.d.ts +3 -254
- package/package.json +3 -3
- package/src/components/ActionSheet/ActionSheet.js +1 -1
- package/src/components/Carousel.js +4 -2
- package/src/components/Checkbox/Checkbox.js +3 -3
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -2
- package/src/components/Checkbox/CheckboxRow.js +3 -3
- package/src/components/CircularProgress.js +29 -26
- package/src/components/DatePicker/DatePicker.js +1 -1
- package/src/components/NumberInput.js +1 -1
- package/src/components/Picker/Picker.js +8 -8
- package/src/components/Picker/Picker.tsx +8 -6
- package/src/components/Picker/PickerComponent.android.js +69 -0
- package/src/components/Picker/PickerComponent.android.tsx +116 -0
- package/src/components/Picker/PickerComponent.ios.js +79 -0
- package/src/components/Picker/PickerComponent.ios.tsx +142 -0
- package/src/components/Picker/PickerComponent.web.js +70 -0
- package/src/components/Picker/PickerComponent.web.tsx +117 -0
- package/src/components/Picker/PickerTypes.js +1 -0
- package/src/components/Picker/PickerTypes.ts +18 -0
- package/src/components/Portal/Portal.js +2 -2
- package/src/components/Portal/PortalConsumer.js +0 -1
- package/src/components/Portal/PortalHost.js +43 -41
- package/src/components/Portal/PortalManager.js +21 -18
- package/src/components/ProgressBar.js +9 -9
- package/src/components/RadioButton/RadioButton.js +3 -3
- package/src/components/RadioButton/RadioButtonGroup.js +1 -1
- package/src/components/RadioButton/RadioButtonRow.js +3 -3
- package/src/components/StepIndicator.js +225 -225
- package/src/components/Stepper.js +2 -2
- package/src/components/Text.js +0 -1
- package/src/components/TextField.js +62 -59
- package/src/constants.js +1 -1
- package/src/mappings/NumberInput.js +248 -0
- package/src/mappings/NumberInput.ts +267 -0
- package/src/mappings/Text.js +33 -26
- package/src/mappings/Text.ts +34 -27
- package/src/mappings/TextArea.js +210 -3
- package/src/mappings/TextArea.ts +216 -3
- package/src/mappings/TextField.js +220 -3
- package/src/mappings/TextField.ts +227 -3
- package/src/mappings/TextInput.js +208 -31
- package/src/mappings/TextInput.ts +214 -34
|
@@ -0,0 +1,135 @@
|
|
|
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$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
|
|
@@ -0,0 +1 @@
|
|
|
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,K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AAMS,MAAM,GAAGP,uBAAA,CAAWiB,MAAX,CAAkB;EAC/BT,SAAS,EAAE;IACTU,SAAS,EAAE;EADF;AADoB,CAAlB,CAAf;;eAMe,IAAAC,kBAAA,EAAUrD,MAAV,C"}
|
|
@@ -0,0 +1,161 @@
|
|
|
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$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
|
|
@@ -0,0 +1 @@
|
|
|
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,GA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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$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
|
|
@@ -0,0 +1 @@
|
|
|
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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D,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"}
|
|
@@ -0,0 +1 @@
|
|
|
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":""}
|
|
@@ -44,7 +44,7 @@ const RadioButton = _ref => {
|
|
|
44
44
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
45
45
|
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
46
46
|
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
47
|
-
const isSelected = selected
|
|
47
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
|
|
48
48
|
|
|
49
49
|
const handlePress = () => {
|
|
50
50
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string | number;\n unselectedColor?: string;\n onPress?: (value?: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value = \"\",\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGC,eAAA,CAAOC,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAEV,KAAK,EAAEW,YAAT;IAAuBC;EAAvB,IAAyC,IAAAC,mCAAA,GAA/C;EAEA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBf,KAAvB,CAAlB;EACA,MAAMgB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGhB,
|
|
1
|
+
{"version":3,"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string | number;\n unselectedColor?: string;\n onPress?: (value?: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value = \"\",\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGC,eAAA,CAAOC,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAEV,KAAK,EAAEW,YAAT;IAAuBC;EAAvB,IAAyC,IAAAC,mCAAA,GAA/C;EAEA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBf,KAAvB,CAAlB;EACA,MAAMgB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGhB,QAAH,aAAGA,QAAH,cAAGA,QAAH,GAAee,gBAAgB,KAAKF,SAApD;;EAEA,MAAMI,WAAW,GAAG,MAAM;IACxBf,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGW,SAAH,CAAP;IACAF,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGE,SAAH,CAAb;EACD,CAHD;;EAKA,oBACE,oBAAC,mBAAD;IACE,IAAI,EAAEjB,IADR;IAEE,IAAI,EAAEoB,UAAU,GAAGV,YAAH,GAAkBC,cAFpC;IAGE,KAAK,EAAES,UAAU,GAAGlB,KAAH,GAAWG,eAH9B;IAIE,QAAQ,EAAEJ,QAJZ;IAKE,OAAO,EAAEoB,WALX;IAME,IAAI,EAAEd,IANR;IAOE,KAAK,EAAEK;EAPT,GAQMC,IARN,EADF;AAYD,CArCD;;eAuCed,W"}
|
|
@@ -79,7 +79,7 @@ const RadioButtonRow = _ref => {
|
|
|
79
79
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
80
80
|
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
81
81
|
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
82
|
-
const isSelected = selected
|
|
82
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
|
|
83
83
|
|
|
84
84
|
const handlePress = () => {
|
|
85
85
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress","textStyles","viewStyles","extractStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","display","Platform","select","web","cursor","userSelect"],"sources":["RadioButtonRow.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getValueForRadioButton } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string | number; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n display: \"flex\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;EACH,IAAID,eAAe,KAAKE,kBAAA,CAAeC,UAAvC,EAAmD;IACjD,OAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;EACD,CAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;IAC7C,OAAO,YAAP;EACD,CAFM,MAEA;IACL,OAAO,UAAP;EACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;EACH,IAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;IAC7B,oBAAO,oBAAC,aAAD;MAAM,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;IAAb,GAAuCF,KAAvC,CAAP;EACD,CAFD,MAEO;IACL,oBAAO,0CAAGA,KAAH,CAAP;EACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;EAAA,IAf4D;IAChEC,IADgE;IAEhEC,KAFgE;IAGhEL,KAAK,GAAG,EAHwD;IAIhEM,KAJgE;IAKhEC,eALgE;IAMhEC,OANgE;IAOhEC,mBAPgE;IAQhER,UARgE;IAShES,gBATgE;IAUhEhB,SAAS,GAAGH,SAAS,CAACM,GAV0C;IAWhEc,QAXgE;IAYhEC,QAZgE;IAahEC,KAbgE;IAchE,GAAGC;EAd6D,CAe5D;EACJ,MAAM;IACJd,KAAK,EAAEe,YADH;IAEJC,aAFI;IAGJtB,SAAS,EAAED;EAHP,IAIF,IAAAwB,mCAAA,GAJJ;EAMA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBnB,KAAvB,CAAlB;EACA,MAAMoB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGV,
|
|
1
|
+
{"version":3,"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress","textStyles","viewStyles","extractStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","display","Platform","select","web","cursor","userSelect"],"sources":["RadioButtonRow.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getValueForRadioButton } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string | number; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n display: \"flex\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;EACH,IAAID,eAAe,KAAKE,kBAAA,CAAeC,UAAvC,EAAmD;IACjD,OAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;EACD,CAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;IAC7C,OAAO,YAAP;EACD,CAFM,MAEA;IACL,OAAO,UAAP;EACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;EACH,IAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;IAC7B,oBAAO,oBAAC,aAAD;MAAM,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;IAAb,GAAuCF,KAAvC,CAAP;EACD,CAFD,MAEO;IACL,oBAAO,0CAAGA,KAAH,CAAP;EACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;EAAA,IAf4D;IAChEC,IADgE;IAEhEC,KAFgE;IAGh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UAApB,CATd,CANF,eAiBE,oBAAC,iBAAD;IACE,KAAK,EAAE;MACLO,IAAI,EAAE,CADD;MAELD,UAAU,EAAErC,uBAAuB,CAACC,eAAD,EAAkBC,SAAlB;IAF9B;EADT,gBAME,oBAAC,oBAAD;IACE,IAAI,EAAEU,IADR;IAEE,QAAQ,EAAEiB,UAFZ;IAGE,KAAK,EAAEH,SAHT;IAIE,KAAK,EAAEZ,KAJT;IAKE,eAAe,EAAEC,eALnB;IAME,KAAK,EAAEG;EANT,EANF,CAjBF,CADF;AAmCD,CApED;;AAsEA,MAAMgB,MAAM,GAAGK,uBAAA,CAAWC,MAAX,CAAkB;EAC/BL,UAAU,EAAE;IACVE,UAAU,EAAE,QADF;IAEVI,cAAc,EAAE,cAFN;IAGVC,YAAY,EAAE,EAHJ;IAIVC,SAAS,EAAE,EAJD;IAKVC,UAAU,EAAE,EALF;IAMVC,OAAO,EAAE,MANC;IAOV,GAAGC,qBAAA,CAASC,MAAT,CAAgB;MACjBC,GAAG,EAAE;QACHC,MAAM,EAAE,SADL;QAEHC,UAAU,EAAE;MAFT;IADY,CAAhB;EAPO,CADmB;EAe/BrC,KAAK,EAAE;IACLyB,IAAI,EAAE;EADD;AAfwB,CAAlB,CAAf;;eAoBe3B,c"}
|
|
@@ -256,7 +256,7 @@ class StepIndicator extends _react.Component {
|
|
|
256
256
|
stepStatus: this.getStepStatus(position)
|
|
257
257
|
}) : /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
258
258
|
style: indicatorLabelStyle
|
|
259
|
-
},
|
|
259
|
+
}, "".concat(position + 1)));
|
|
260
260
|
});
|
|
261
261
|
|
|
262
262
|
_defineProperty(this, "getStepStatus", stepPosition => {
|