@draftbit/core 44.1.9-222859.1 → 44.1.9-ce3e7b.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ActionSheet/ActionSheetCancel.js.map +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheetItem.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +11 -23
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js.map +1 -1
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/mappings/ScrollView.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +12 -18
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/mappings/AudioPlayer.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Picker/Picker.js +25 -18
- package/src/components/Picker/Picker.tsx +24 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActionSheetCancel.
|
|
1
|
+
{"version":3,"sources":["ActionSheetCancel.js"],"names":["ActionSheetCancel","label","color","style","onPress","React","createElement","ActionSheetItem"],"mappings":";;;;;;;AAAA;;AACA;;;;AACA,MAAMA,iBAAiB,GAAG,QAAkD;AAAA,MAAjD;AAAEC,IAAAA,KAAK,GAAG,QAAV;AAAoBC,IAAAA,KAApB;AAA2BC,IAAAA,KAA3B;AAAkCC,IAAAA;AAAlC,GAAiD;AACxE,sBAAQC,eAAMC,aAAN,CAAoBC,wBAApB,EAAqC;AAAEN,IAAAA,KAAK,EAAEA,KAAT;AAAgBC,IAAAA,KAAK,EAAEA,KAAK,IAAI,SAAhC;AAA2CC,IAAAA,KAAK,EAAE,CAACA,KAAD,CAAlD;AAA2DC,IAAAA,OAAO,EAAEA;AAApE,GAArC,CAAR;AACH,CAFD;;eAGeJ,iB","sourcesContent":["import React from \"react\";\nimport ActionSheetItem from \"./ActionSheetItem\";\nconst ActionSheetCancel = ({ label = \"Cancel\", color, style, onPress, }) => {\n return (React.createElement(ActionSheetItem, { label: label, color: color || \"#FF453A\", style: [style], onPress: onPress }));\n};\nexport default ActionSheetCancel;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActionSheetItem.
|
|
1
|
+
{"version":3,"sources":["ActionSheetItem.tsx"],"names":["ActionSheetItem","label","style","color","onPress","textStyles","viewStyles","styles","wrapper","StyleSheet","create","borderBottomWidth","hairlineWidth","borderBottomColor","backgroundColor","minHeight","overflow","display","justifyContent","fontSize","textAlign","fontWeight","paddingHorizontal","paddingVertical","alignSelf"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;;;AASA,MAAMA,eAAgC,GAAG,QAAsC;AAAA,MAArC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,KAAT;AAAgBC,IAAAA,KAAhB;AAAuBC,IAAAA;AAAvB,GAAqC;AAC7E,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA6B,8BAAcJ,KAAd,CAAnC;AACA,sBACE,6BAAC,6BAAD;AACE,IAAA,aAAa,EAAE,GADjB;AAEE,IAAA,KAAK,EAAE,CAACK,MAAM,CAACC,OAAR,EAAiBF,UAAjB,CAFT;AAGE,IAAA,OAAO,EAAEF;AAHX,kBAKE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAACG,MAAM,CAACN,KAAR,EAAeI,UAAf,EAA2B;AAAEF,MAAAA;AAAF,KAA3B;AAAb,KAAqDF,KAArD,CALF,CADF;AASD,CAXD;;AAaA,MAAMM,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,OAAO,EAAE;AACPG,IAAAA,iBAAiB,EAAEF,wBAAWG,aADvB;AAEPC,IAAAA,iBAAiB,EAAE,SAFZ;AAGPC,IAAAA,eAAe,EAAE,SAHV;AAIPC,IAAAA,SAAS,EAAE,EAJJ;AAKPC,IAAAA,QAAQ,EAAE,QALH;AAMPC,IAAAA,OAAO,EAAE,MANF;AAOPC,IAAAA,cAAc,EAAE;AAPT,GADsB;AAU/BjB,EAAAA,KAAK,EAAE;AACLkB,IAAAA,QAAQ,EAAE,EADL;AAELC,IAAAA,SAAS,EAAE,QAFN;AAGLjB,IAAAA,KAAK,EAAE,SAHF;AAILkB,IAAAA,UAAU,EAAE,KAJP;AAKLL,IAAAA,QAAQ,EAAE,QALL;AAMLM,IAAAA,iBAAiB,EAAE,EANd;AAOLC,IAAAA,eAAe,EAAE,EAPZ;AAQLC,IAAAA,SAAS,EAAE;AARN;AAVwB,CAAlB,CAAf;;eAsBexB,e","sourcesContent":["import React from \"react\";\nimport {\n Text,\n StyleSheet,\n StyleProp,\n TouchableOpacity,\n ViewStyle,\n TextStyle,\n} from \"react-native\";\nimport { extractStyles } from \"../../utilities\";\n\ntype Props = {\n label: string;\n color: string;\n style?: StyleProp<ViewStyle | TextStyle>;\n onPress?: () => void;\n};\n\nconst ActionSheetItem: React.FC<Props> = ({ label, style, color, onPress }) => {\n const { textStyles, viewStyles } = extractStyles(style);\n return (\n <TouchableOpacity\n activeOpacity={0.7}\n style={[styles.wrapper, viewStyles]}\n onPress={onPress}\n >\n <Text style={[styles.label, textStyles, { color }]}>{label}</Text>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n wrapper: {\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderBottomColor: \"#CCCCCC\",\n backgroundColor: \"#F1F1F1\",\n minHeight: 50,\n overflow: \"hidden\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n label: {\n fontSize: 16,\n textAlign: \"center\",\n color: \"#0A84FF\",\n fontWeight: \"500\",\n overflow: \"hidden\",\n paddingHorizontal: 20,\n paddingVertical: 10,\n alignSelf: \"center\",\n },\n});\n\nexport default ActionSheetItem;\n"]}
|
|
@@ -60,7 +60,7 @@ const disabledColor = "rgb(240, 240, 240)";
|
|
|
60
60
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
61
61
|
|
|
62
62
|
const Picker = _ref => {
|
|
63
|
-
var _find$label, _find
|
|
63
|
+
var _find$label, _find;
|
|
64
64
|
|
|
65
65
|
let {
|
|
66
66
|
error,
|
|
@@ -81,7 +81,7 @@ const Picker = _ref => {
|
|
|
81
81
|
leftIconName,
|
|
82
82
|
placeholderTextColor = unstyledColor,
|
|
83
83
|
rightIconName,
|
|
84
|
-
type = "
|
|
84
|
+
type = "underline"
|
|
85
85
|
} = _ref;
|
|
86
86
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
87
87
|
const [pickerVisible, togglePickerVisible] = React.useReducer(state => !state, false);
|
|
@@ -132,15 +132,13 @@ const Picker = _ref => {
|
|
|
132
132
|
};
|
|
133
133
|
const margins = ["marginLeft", "marginRight", "marginTop", "marginBottom"];
|
|
134
134
|
const marginStyles = (0, _lodash.pick)(viewStyles, margins);
|
|
135
|
-
const
|
|
135
|
+
const platform = _reactNative.Platform.OS;
|
|
136
136
|
const stylesWithoutBordersAndMargins = { ...{
|
|
137
137
|
height: 60,
|
|
138
|
-
width: "100%"
|
|
138
|
+
width: "100%",
|
|
139
|
+
flex: platform === "web" ? undefined : 1
|
|
139
140
|
},
|
|
140
|
-
...(0, _lodash.omit)(viewStyles, [...borders, ...margins])
|
|
141
|
-
...{
|
|
142
|
-
maxHeight
|
|
143
|
-
}
|
|
141
|
+
...(0, _lodash.omit)(viewStyles, [...borders, ...margins])
|
|
144
142
|
};
|
|
145
143
|
const selectedLabel = internalValue && ((_find$label = (_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) !== null && _find$label !== void 0 ? _find$label : internalValue);
|
|
146
144
|
const labelText = label ? /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
@@ -170,7 +168,7 @@ const Picker = _ref => {
|
|
|
170
168
|
marginLeft: 8
|
|
171
169
|
}
|
|
172
170
|
}) : null;
|
|
173
|
-
const width =
|
|
171
|
+
const width = stylesWithoutBordersAndMargins === null || stylesWithoutBordersAndMargins === void 0 ? void 0 : stylesWithoutBordersAndMargins.width;
|
|
174
172
|
const textAlign = textStyles === null || textStyles === void 0 ? void 0 : textStyles.textAlign;
|
|
175
173
|
const paddingLeft = leftIconOutset && (!textAlign || textAlign === "left" || textAlign === "justify") ? iconSize + 4 : 0;
|
|
176
174
|
const assistiveTextLabel = assistiveText ? /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
@@ -215,18 +213,14 @@ const Picker = _ref => {
|
|
|
215
213
|
style: styles.touchableContainer
|
|
216
214
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
217
215
|
pointerEvents: "none",
|
|
218
|
-
style: [styles.outsetContainer, stylesWithoutBordersAndMargins,
|
|
219
|
-
!leftIconOutset && borderStyles // set border if Icon is inset
|
|
220
|
-
]
|
|
216
|
+
style: [styles.outsetContainer, stylesWithoutBordersAndMargins, !leftIconOutset ? borderStyles : {}]
|
|
221
217
|
}, leftIcon, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
222
|
-
style: [styles.insetContainer,
|
|
223
|
-
leftIconOutset && borderStyles // set border if Icon is outset
|
|
224
|
-
]
|
|
218
|
+
style: [styles.insetContainer, leftIconOutset ? borderStyles : {}]
|
|
225
219
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
226
220
|
style: styles.primaryTextContainer
|
|
227
221
|
}, labelText, /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
228
222
|
style: primaryTextStyle
|
|
229
|
-
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel),
|
|
223
|
+
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), platform === "ios" && pickerVisible ? /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
230
224
|
style: [styles.iosPicker, {
|
|
231
225
|
backgroundColor: colors.divider
|
|
232
226
|
}]
|
|
@@ -245,7 +239,7 @@ const Picker = _ref => {
|
|
|
245
239
|
label: option.label,
|
|
246
240
|
value: option.value,
|
|
247
241
|
key: option.value
|
|
248
|
-
})))))) : null,
|
|
242
|
+
})))))) : null, platform !== "ios" ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
249
243
|
enabled: !disabled,
|
|
250
244
|
selectedValue: internalValue,
|
|
251
245
|
onValueChange: handleValueChange,
|
|
@@ -316,10 +310,4 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
316
310
|
width: "100%"
|
|
317
311
|
}
|
|
318
312
|
});
|
|
319
|
-
//# sourceMappingURL=Picker.js.mapft: 0,
|
|
320
|
-
right: 0,
|
|
321
|
-
bottom: 0,
|
|
322
|
-
width: "100%"
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
313
|
//# sourceMappingURL=Picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Picker.tsx"],"names":["normalizeOptions","options","length","map","option","label","String","value","Error","unstyledColor","disabledColor","errorColor","Picker","error","onValueChange","defaultValue","Icon","style","placeholder","disabled","theme","assistiveText","iconColor","iconSize","leftIconMode","leftIconName","placeholderTextColor","rightIconName","type","internalValue","setInternalValue","React","useState","pickerVisible","togglePickerVisible","useReducer","state","useEffect","normalizedOptions","pickerOptions","viewStyles","textStyles","colors","borders","borderStyles","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","borderTopWidth","borderRightWidth","borderLeftWidth","borderBottomWidth","borderColor","borderStyle","backgroundColor","margins","marginStyles","maxHeight","Dimensions","get","height","stylesWithoutBordersAndMargins","width","selectedLabel","find","labelText","textAlign","color","fontSize","paddingBottom","leftIconOutset","leftIcon","marginRight","marginLeft","rightIcon","undefined","paddingLeft","assistiveTextLabel","paddingTop","primaryTextStyle","identity","handleValueChange","newValue","itemIndex","styles","marginsContainer","touchableContainer","outsetContainer","insetContainer","primaryTextContainer","Platform","OS","iosPicker","divider","iosSafeArea","iosButton","iosNativePicker","nonIosPicker","StyleSheet","create","alignSelf","alignItems","flexDirection","justifyContent","flex","paddingRight","position","bottom","left","right","opacity","top"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAGA;;;;;;;;AA6BA,SAASA,gBAAT,CAA0BC,OAA1B,EAA2E;AACzE,MAAIA,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;AACxB,WAAO,EAAP;AACD;;AAED,MAAI,OAAOD,OAAO,CAAC,CAAD,CAAd,MAAuB,YAAY,QAAnC,CAAJ,EAAkD;AAChD,WAAQA,OAAD,CAAsBE,GAAtB,CAA2BC,MAAD,KAAa;AAC5CC,MAAAA,KAAK,EAAEC,MAAM,CAACF,MAAD,CAD+B;AAE5CG,MAAAA,KAAK,EAAED,MAAM,CAACF,MAAD;AAF+B,KAAb,CAA1B,CAAP;AAID;;AAED,MACE,OAAOH,OAAO,CAAC,CAAD,CAAd,KAAsB,QAAtB,IACAA,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,KAAqB,IADrB,IAEAN,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,KAAqB,IAHvB,EAIE;AACA,WAAQJ,OAAD,CAA4BE,GAA5B,CAAiCC,MAAD,IAAY;AACjD,aAAO;AACLC,QAAAA,KAAK,EAAEC,MAAM,CAACF,MAAM,CAACC,KAAR,CADR;AAELE,QAAAA,KAAK,EAAED,MAAM,CAACF,MAAM,CAACG,KAAR;AAFR,OAAP;AAID,KALM,CAAP;AAMD;;AAED,QAAM,IAAIC,KAAJ,CACJ,8GADI,CAAN;AAGD;;AAED,MAAMC,aAAa,GAAG,wBAAtB;AACA,MAAMC,aAAa,GAAG,oBAAtB;AACA,MAAMC,UAAU,GAAG,uBAAnB;;AAEA,MAAMC,MAA6B,GAAG,QAoBhC;AAAA;;AAAA,MApBiC;AACrCC,IAAA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AY,EAAE;AACZa,IAAAA,OAAO,EAAE,CADG;AAEZJ,IAAAA,QAAQ,EAAE,UAFE;AAGZK,IAAAA,GAAG,EAAE,CAHO;AAIZH,IAAAA,IAAI,EAAE,CAJM;AAKZC,IAAAA,KAAK,EAAE,CALK;AAMZF,IAAAA,MAAM,EAAE,CANI;AAOZ7C,IAAAA,KAAK,EAAE;AAPK;AAjCiB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n Text,\n Platform,\n ViewStyle,\n StyleProp,\n Dimensions,\n} from \"react-native\";\nimport { omit, pick, pickBy, identity } from \"lodash\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport Touchable from \"../Touchable\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { extractStyles } from \"../../utilities\";\n\nexport interface PickerOption {\n value: string;\n label: string;\n}\n\nexport type PickerProps = {\n error?: any;\n placeholder?: string;\n disabled?: boolean;\n style?: StyleProp<ViewStyle> & { height?: number };\n value?: string;\n options: PickerOption[] | string[];\n onValueChange: (value: string, index: number) => void;\n defaultValue?: string;\n assistiveText?: string;\n label?: string;\n iconColor?: string;\n iconSize?: number;\n leftIconMode?: \"inset\" | \"outset\";\n leftIconName?: string;\n placeholderTextColor?: string;\n rightIconName?: string;\n type?: \"solid\" | \"underline\";\n theme: Theme;\n Icon: IconSlot[\"Icon\"];\n};\n\nfunction normalizeOptions(options: PickerProps[\"options\"]): PickerOption[] {\n if (options.length === 0) {\n return [];\n }\n\n if (typeof options[0] === (\"string\" || \"number\")) {\n return (options as string[]).map((option) => ({\n label: String(option),\n value: String(option),\n }));\n }\n\n if (\n typeof options[0] === \"object\" &&\n options[0].value !== null &&\n options[0].label !== null\n ) {\n return (options as PickerOption[]).map((option) => {\n return {\n label: String(option.label),\n value: String(option.value),\n };\n });\n }\n\n throw new Error(\n 'Picker options must be either an array of strings or array of { \"label\": string; \"value\": string; } objects.'\n );\n}\n\nconst unstyledColor = \"rgba(165, 173, 183, 1)\";\nconst disabledColor = \"rgb(240, 240, 240)\";\nconst errorColor = \"rgba(255, 69, 100, 1)\";\n\nconst Picker: React.FC<PickerProps> = ({\n error,\n options = [],\n onValueChange,\n defaultValue,\n Icon,\n style,\n placeholder,\n value,\n disabled = false,\n theme,\n assistiveText,\n label,\n iconColor = unstyledColor,\n iconSize = 24,\n leftIconMode = \"inset\",\n leftIconName,\n placeholderTextColor = unstyledColor,\n rightIconName,\n type = \"solid\",\n}) => {\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n const [pickerVisible, togglePickerVisible] = React.useReducer(\n (state) => !state,\n false\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const normalizedOptions = normalizeOptions(options);\n\n const pickerOptions = placeholder\n ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]\n : normalizedOptions;\n\n const { viewStyles, textStyles } = extractStyles(style);\n\n const { colors } = theme;\n\n const borders = [\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderColor\",\n \"borderStyle\",\n \"backgroundColor\",\n ];\n\n const borderStyles = {\n ...{\n ...(type === \"solid\"\n ? {\n borderTopLeftRadius: 5,\n borderTopRightRadius: 5,\n borderBottomRightRadius: 5,\n borderBottomLeftRadius: 5,\n borderTopWidth: 1,\n borderRightWidth: 1,\n borderLeftWidth: 1,\n }\n : {}),\n borderBottomWidth: 1,\n borderColor: unstyledColor,\n borderStyle: \"solid\",\n },\n ...pick(viewStyles, borders),\n ...(error ? { borderColor: errorColor } : {}),\n ...(disabled\n ? { borderColor: \"transparent\", backgroundColor: disabledColor }\n : {}),\n };\n\n const margins = [\"marginLeft\", \"marginRight\", \"marginTop\", \"marginBottom\"];\n\n const marginStyles = pick(viewStyles, margins);\n\n const maxHeight =\n viewStyles?.maxHeight && viewStyles.maxHeight !== \"100%\"\n ? viewStyles.maxHeight\n : Dimensions.get(\"window\").height;\n\n const stylesWithoutBordersAndMargins = {\n ...{\n height: 60,\n width: \"100%\",\n },\n ...omit(viewStyles, [...borders, ...margins]),\n ...{ maxHeight },\n };\n\n const selectedLabel =\n internalValue &&\n ((pickerOptions as unknown as PickerOption[]).find(\n (option) => option.value === internalValue\n )?.label ??\n internalValue);\n\n const labelText = label ? (\n <Text\n style={{\n textAlign: textStyles.textAlign,\n color: unstyledColor,\n fontSize: 12,\n paddingBottom: 4,\n }}\n >\n {label}\n </Text>\n ) : null;\n\n const leftIconOutset = leftIconMode === \"outset\";\n\n const leftIcon = leftIconName ? (\n <Icon\n name={leftIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: 4,\n marginLeft: 4,\n }}\n />\n ) : null;\n\n const rightIcon = rightIconName ? (\n <Icon\n name={rightIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: -10,\n marginLeft: 8,\n }}\n />\n ) : null;\n\n const width = stylesWithoutBordersAndMargins?.width ?? undefined;\n\n const textAlign = textStyles?.textAlign;\n\n const paddingLeft =\n leftIconOutset &&\n (!textAlign || textAlign === \"left\" || textAlign === \"justify\")\n ? iconSize + 4\n : 0;\n\n const assistiveTextLabel = assistiveText ? (\n <Text\n style={{\n textAlign,\n width,\n paddingLeft,\n color: unstyledColor,\n fontSize: 12,\n paddingTop: 4,\n }}\n >\n {assistiveText}\n </Text>\n ) : null;\n\n const primaryTextStyle = {\n color: unstyledColor,\n fontSize: 14,\n ...pickBy(textStyles, identity),\n ...(placeholder === internalValue ? { color: placeholderTextColor } : {}),\n ...(disabled ? { color: unstyledColor } : {}),\n };\n\n const handleValueChange = (newValue: string, itemIndex: number) => {\n if (!placeholder || itemIndex > 0) {\n onValueChange?.(newValue, itemIndex);\n }\n setInternalValue(newValue);\n };\n\n return (\n /* marginsContainer */\n <View style={[styles.marginsContainer, marginStyles]}>\n {/* touchableContainer */}\n <Touchable\n disabled={disabled}\n onPress={togglePickerVisible}\n style={styles.touchableContainer}\n >\n {/* outsetContainer */}\n <View\n pointerEvents=\"none\"\n style={[\n styles.outsetContainer,\n stylesWithoutBordersAndMargins,\n // @ts-expect-error ... rejects border-related { key: undefined }\n !leftIconOutset && borderStyles, // set border if Icon is inset\n ]}\n >\n {leftIcon}\n\n {/* insetContainer */}\n <View\n style={[\n styles.insetContainer,\n // @ts-expect-error ... rejects border-related { key: undefined }\n leftIconOutset && borderStyles, // set border if Icon is outset\n ]}\n >\n {/* primaryTextContainer */}\n <View style={styles.primaryTextContainer}>\n {labelText}\n\n <Text style={primaryTextStyle}>\n {String(selectedLabel ?? placeholder)}\n </Text>\n </View>\n\n {rightIcon}\n </View>\n </View>\n {assistiveTextLabel}\n </Touchable>\n\n {/* iosPicker */}\n {Platform.OS === \"ios\" && pickerVisible ? (\n <Portal>\n <View\n style={[\n styles.iosPicker,\n {\n backgroundColor: colors.divider,\n },\n ]}\n >\n <SafeAreaView style={styles.iosSafeArea}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={togglePickerVisible}\n style={styles.iosButton}\n >\n {\"Close\"}\n </Button>\n\n <NativePicker\n style={styles.iosNativePicker}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n ) : null}\n\n {/* nonIosPicker */}\n {Platform.OS !== \"ios\" ? (\n <NativePicker\n enabled={!disabled}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n ) : null}\n </View>\n );\n};\n\nexport default withTheme(Picker);\n\nconst styles = StyleSheet.create({\n marginsContainer: { alignSelf: \"stretch\" },\n touchableContainer: { alignSelf: \"stretch\", alignItems: \"center\" },\n outsetContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n insetContainer: {\n flex: 1,\n height: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingLeft: 12,\n paddingRight: 12,\n },\n primaryTextContainer: { flex: 1 },\n iosPicker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n iosSafeArea: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n iosButton: { alignSelf: \"flex-end\" },\n iosNativePicker: { backgroundColor: \"white\" },\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["Picker.tsx"],"names":["normalizeOptions","options","length","map","option","label","String","value","Error","unstyledColor","disabledColor","errorColor","Picker","error","onValueChange","defaultValue","Icon","style","placeholder","disabled","theme","assistiveText","iconColor","iconSize","leftIconMode","leftIconName","placeholderTextColor","rightIconName","type","internalValue","setInternalValue","React","useState","pickerVisible","togglePickerVisible","useReducer","state","useEffect","normalizedOptions","pickerOptions","viewStyles","textStyles","colors","borders","borderStyles","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","borderTopWidth","borderRightWidth","borderLeftWidth","borderBottomWidth","borderColor","borderStyle","backgroundColor","margins","marginStyles","platform","Platform","OS","stylesWithoutBordersAndMargins","height","width","flex","undefined","selectedLabel","find","labelText","textAlign","color","fontSize","paddingBottom","leftIconOutset","leftIcon","marginRight","marginLeft","rightIcon","paddingLeft","assistiveTextLabel","paddingTop","primaryTextStyle","identity","handleValueChange","newValue","itemIndex","styles","marginsContainer","touchableContainer","outsetContainer","insetContainer","primaryTextContainer","iosPicker","divider","iosSafeArea","iosButton","iosNativePicker","nonIosPicker","StyleSheet","create","alignSelf","alignItems","flexDirection","justifyContent","paddingRight","position","bottom","left","right","opacity","top"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAGA;;;;;;;;AA6BA,SAASA,gBAAT,CAA0BC,OAA1B,EAA2E;AACzE,MAAIA,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;AACxB,WAAO,EAAP;AACD;;AAED,MAAI,OAAOD,OAAO,CAAC,CAAD,CAAd,MAAuB,YAAY,QAAnC,CAAJ,EAAkD;AAChD,WAAQA,OAAD,CAAsBE,GAAtB,CAA2BC,MAAD,KAAa;AAC5CC,MAAAA,KAAK,EAAEC,MAAM,CAACF,MAAD,CAD+B;AAE5CG,MAAAA,KAAK,EAAED,MAAM,CAACF,MAAD;AAF+B,KAAb,CAA1B,CAAP;AAID;;AAED,MACE,OAAOH,OAAO,CAAC,CAAD,CAAd,KAAsB,QAAtB,IACAA,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,KAAqB,IADrB,IAEAN,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,KAAqB,IAHvB,EAIE;AACA,WAAQJ,OAAD,CAA4BE,GAA5B,CAAiCC,MAAD,IAAY;AACjD,aAAO;AACLC,QAAAA,KAAK,EAAEC,MAAM,CAACF,MAAM,CAACC,KAAR,CADR;AAELE,QAAAA,KAAK,EAAED,MAAM,CAACF,MAAM,CAACG,KAAR;AAFR,OAAP;AAID,KALM,CAAP;AAMD;;AAED,QAAM,IAAIC,KAAJ,CACJ,8GADI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ZY,IAAAA,OAAO,EAAE,CADG;AAEZJ,IAAAA,QAAQ,EAAE,UAFE;AAGZK,IAAAA,GAAG,EAAE,CAHO;AAIZH,IAAAA,IAAI,EAAE,CAJM;AAKZC,IAAAA,KAAK,EAAE,CALK;AAMZF,IAAAA,MAAM,EAAE,CANI;AAOZ3C,IAAAA,KAAK,EAAE;AAPK;AA5CiB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n Text,\n Platform,\n ViewStyle,\n StyleProp,\n} from \"react-native\";\nimport { omit, pick, pickBy, identity } from \"lodash\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport Touchable from \"../Touchable\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { extractStyles } from \"../../utilities\";\n\nexport interface PickerOption {\n value: string;\n label: string;\n}\n\nexport type PickerProps = {\n error?: any;\n placeholder?: string;\n disabled?: boolean;\n style?: StyleProp<ViewStyle> & { height?: number };\n value?: string;\n options: PickerOption[] | string[];\n onValueChange: (value: string, index: number) => void;\n defaultValue?: string;\n assistiveText?: string;\n label?: string;\n iconColor?: string;\n iconSize?: number;\n leftIconMode?: \"inset\" | \"outset\";\n leftIconName?: string;\n placeholderTextColor?: string;\n rightIconName?: string;\n type?: \"solid\" | \"underline\";\n theme: Theme;\n Icon: IconSlot[\"Icon\"];\n};\n\nfunction normalizeOptions(options: PickerProps[\"options\"]): PickerOption[] {\n if (options.length === 0) {\n return [];\n }\n\n if (typeof options[0] === (\"string\" || \"number\")) {\n return (options as string[]).map((option) => ({\n label: String(option),\n value: String(option),\n }));\n }\n\n if (\n typeof options[0] === \"object\" &&\n options[0].value !== null &&\n options[0].label !== null\n ) {\n return (options as PickerOption[]).map((option) => {\n return {\n label: String(option.label),\n value: String(option.value),\n };\n });\n }\n\n throw new Error(\n 'Picker options must be either an array of strings or array of { \"label\": string; \"value\": string; } objects.'\n );\n}\n\nconst unstyledColor = \"rgba(165, 173, 183, 1)\";\nconst disabledColor = \"rgb(240, 240, 240)\";\nconst errorColor = \"rgba(255, 69, 100, 1)\";\n\nconst Picker: React.FC<PickerProps> = ({\n error,\n options = [],\n onValueChange,\n defaultValue,\n Icon,\n style,\n placeholder,\n value,\n disabled = false,\n theme,\n assistiveText,\n label,\n iconColor = unstyledColor,\n iconSize = 24,\n leftIconMode = \"inset\",\n leftIconName,\n placeholderTextColor = unstyledColor,\n rightIconName,\n type = \"underline\",\n}) => {\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n const [pickerVisible, togglePickerVisible] = React.useReducer(\n (state) => !state,\n false\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const normalizedOptions = normalizeOptions(options);\n\n const pickerOptions = placeholder\n ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]\n : normalizedOptions;\n\n const { viewStyles, textStyles } = extractStyles(style);\n\n const { colors } = theme;\n\n const borders = [\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderColor\",\n \"borderStyle\",\n \"backgroundColor\",\n ];\n\n const borderStyles = {\n ...{\n ...(type === \"solid\"\n ? {\n borderTopLeftRadius: 5,\n borderTopRightRadius: 5,\n borderBottomRightRadius: 5,\n borderBottomLeftRadius: 5,\n borderTopWidth: 1,\n borderRightWidth: 1,\n borderLeftWidth: 1,\n }\n : {}),\n borderBottomWidth: 1,\n borderColor: unstyledColor,\n borderStyle: \"solid\",\n },\n ...pick(viewStyles, borders),\n ...(error ? { borderColor: errorColor } : {}),\n ...(disabled\n ? { borderColor: \"transparent\", backgroundColor: disabledColor }\n : {}),\n };\n\n const margins = [\"marginLeft\", \"marginRight\", \"marginTop\", \"marginBottom\"];\n\n const marginStyles = pick(viewStyles, margins);\n\n const platform = Platform.OS;\n\n const stylesWithoutBordersAndMargins = {\n ...{\n height: 60,\n width: \"100%\",\n flex: platform === \"web\" ? undefined : 1,\n },\n ...omit(viewStyles, [...borders, ...margins]),\n };\n\n const selectedLabel =\n internalValue &&\n ((pickerOptions as unknown as PickerOption[]).find(\n (option) => option.value === internalValue\n )?.label ??\n internalValue);\n\n const labelText = label ? (\n <Text\n style={{\n textAlign: textStyles.textAlign,\n color: unstyledColor,\n fontSize: 12,\n paddingBottom: 4,\n }}\n >\n {label}\n </Text>\n ) : null;\n\n const leftIconOutset = leftIconMode === \"outset\";\n\n const leftIcon = leftIconName ? (\n <Icon\n name={leftIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: 4,\n marginLeft: 4,\n }}\n />\n ) : null;\n\n const rightIcon = rightIconName ? (\n <Icon\n name={rightIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: -10,\n marginLeft: 8,\n }}\n />\n ) : null;\n\n const width = stylesWithoutBordersAndMargins?.width;\n\n const textAlign = textStyles?.textAlign;\n\n const paddingLeft =\n leftIconOutset &&\n (!textAlign || textAlign === \"left\" || textAlign === \"justify\")\n ? iconSize + 4\n : 0;\n\n const assistiveTextLabel = assistiveText ? (\n <Text\n style={{\n textAlign,\n width,\n paddingLeft,\n color: unstyledColor,\n fontSize: 12,\n paddingTop: 4,\n }}\n >\n {assistiveText}\n </Text>\n ) : null;\n\n const primaryTextStyle = {\n color: unstyledColor,\n fontSize: 14,\n ...pickBy(textStyles, identity),\n ...(placeholder === internalValue ? { color: placeholderTextColor } : {}),\n ...(disabled ? { color: unstyledColor } : {}),\n };\n\n const handleValueChange = (newValue: string, itemIndex: number) => {\n if (!placeholder || itemIndex > 0) {\n onValueChange?.(newValue, itemIndex);\n }\n setInternalValue(newValue);\n };\n\n return (\n /* marginsContainer */\n <View style={[styles.marginsContainer, marginStyles]}>\n {/* touchableContainer */}\n <Touchable\n disabled={disabled}\n onPress={togglePickerVisible}\n style={styles.touchableContainer}\n >\n {/* outsetContainer */}\n <View\n pointerEvents=\"none\"\n style={[\n styles.outsetContainer,\n stylesWithoutBordersAndMargins,\n !leftIconOutset ? (borderStyles as PickerProps[\"style\"]) : {},\n ]}\n >\n {leftIcon}\n\n {/* insetContainer */}\n <View\n style={[\n styles.insetContainer,\n leftIconOutset ? (borderStyles as PickerProps[\"style\"]) : {},\n ]}\n >\n {/* primaryTextContainer */}\n <View style={styles.primaryTextContainer}>\n {labelText}\n\n <Text style={primaryTextStyle}>\n {String(selectedLabel ?? placeholder)}\n </Text>\n </View>\n\n {rightIcon}\n </View>\n </View>\n {assistiveTextLabel}\n </Touchable>\n\n {/* iosPicker */}\n {platform === \"ios\" && pickerVisible ? (\n <Portal>\n <View\n style={[\n styles.iosPicker,\n {\n backgroundColor: colors.divider,\n },\n ]}\n >\n <SafeAreaView style={styles.iosSafeArea}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={togglePickerVisible}\n style={styles.iosButton}\n >\n {\"Close\"}\n </Button>\n\n <NativePicker\n style={styles.iosNativePicker}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n ) : null}\n\n {/* nonIosPicker */}\n {platform !== \"ios\" ? (\n <NativePicker\n enabled={!disabled}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n ) : null}\n </View>\n );\n};\n\nexport default withTheme(Picker);\n\nconst styles = StyleSheet.create({\n marginsContainer: {\n alignSelf: \"stretch\",\n },\n touchableContainer: {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n },\n outsetContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n insetContainer: {\n flex: 1,\n height: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingLeft: 12,\n paddingRight: 12,\n },\n primaryTextContainer: {\n flex: 1,\n },\n iosPicker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n iosSafeArea: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n iosButton: {\n alignSelf: \"flex-end\",\n },\n iosNativePicker: {\n backgroundColor: \"white\",\n },\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["StepIndicator.js"],"names":["STEP_STATUS","CURRENT","FINISHED","UNFINISHED","StepIndicator","Component","constructor","props","stepCount","direction","progressBarBackgroundStyle","backgroundColor","state","customStyles","separatorUnFinishedColor","position","left","width","separatorStrokeWidth","top","height","bottom","separatorStrokeUnfinishedWidth","right","React","createElement","View","onLayout","event","setState","progressBarSize","nativeEvent","layout","onCurrentPositionChanged","currentPosition","style","progressBarStyle","separatorFinishedColor","separatorStrokeFinishedWidth","progressAnim","Animated","steps","push","TouchableWithoutFeedback","key","onPress","stepPressed","styles","stepContainer","flexDirection","renderStep","stepIndicatorContainer","currentStepIndicatorSize","labels","renderLabel","labelViews","map","label","index","selectedStepLabelStyle","color","currentStepLabelColor","labelColor","stepLabelItem","stepStatus","getStepStatus","Text","stepLabel","fontSize","labelSize","fontFamily","labelFontFamily","stepLabelsContainer","paddingHorizontal","paddingVertical","alignItems","labelAlign","renderStepIndicator","stepStyle","indicatorLabelStyle","stepIndicatorCurrentColor","borderWidth","currentStepStrokeWidth","borderColor","stepStrokeCurrentColor","sizeAnim","borderRadius","borderRadiusAnim","currentStepIndicatorLabelFontSize","stepIndicatorLabelCurrentColor","stepIndicatorFinishedColor","stepStrokeWidth","stepStrokeFinishedColor","stepIndicatorSize","stepIndicatorLabelFontSize","stepIndicatorLabelFinishedColor","stepIndicatorUnFinishedColor","stepStrokeUnFinishedColor","overflow","stepIndicatorLabelUnFinishedColor","step","stepPosition","animateToPosition","setValue","sequence","timing","toValue","duration","parallel","start","defaultStyles","Object","assign","Value","render","container","flex","renderProgressBarBackground","renderProgressBar","renderStepLabels","componentDidUpdate","prevProps","StyleSheet","create","justifyContent","zIndex","textAlign","fontWeight","defaultProps"],"mappings":";;;;;;;AACA;;AACA;;;;;;;;AACA,MAAMA,WAAW,GAAG;AAChBC,EAAAA,OAAO,EAAE,SADO;AAEhBC,EAAAA,QAAQ,EAAE,UAFM;AAGhBC,EAAAA,UAAU,EAAE;AAHI,CAApB;;AAKe,MAAMC,aAAN,SAA4BC,gBAA5B,CAAsC;AACjDC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACf,UAAMA,KAAN;;AADe,yDAsEW,MAAM;AAChC,YAAM;AAAEC,QAAAA,SAAF;AAAaC,QAAAA;AAAb,UAA2B,KAAKF,KAAtC;AACA,UAAIG,0BAAJ;;AACA,UAAID,SAAS,KAAK,UAAlB,EAA8B;AAC1BC,QAAAA,0BAA0B,GAAG;AACzBC,UAAAA,eAAe,EAAE,KAAKC,KAAL,CAAWC,YAAX,CAAwBC,wBADhB;AAEzBC,UAAAA,QAAQ,EAAE,UAFe;AAGzBC,UAAAA,IAAI,EAAE,CAAC,KAAKJ,KAAL,CAAWK,KAAX,GAAmB,KAAKL,KAAL,CAAWC,YAAX,CAAwBK,oBAA5C,IAAoE,CAHjD;AAIzBC,UA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ACPC,IAAAA,QAAQ,EAAE,EADH;AAEP0D,IAAAA,SAAS,EAAE,QAFJ;AAGPC,IAAAA,UAAU,EAAE;AAHL,GAxBkB;AA6B7BhE,EAAAA,aAAa,EAAE;AACXqD,IAAAA,IAAI,EAAE,CADK;AAEXzC,IAAAA,UAAU,EAAE,QAFD;AAGXiD,IAAAA,cAAc,EAAE;AAHL;AA7Bc,CAAlB,CAAf;;AAmCAxH,aAAa,CAAC4H,YAAd,GAA6B;AACzB9F,EAAAA,eAAe,EAAE,CADQ;AAEzB1B,EAAAA,SAAS,EAAE,CAFc;AAGzBK,EAAAA,YAAY,EAAE,EAHW;AAIzBJ,EAAAA,SAAS,EAAE;AAJc,CAA7B","sourcesContent":["// @ts-nocheck\nimport React, { Component } from \"react\";\nimport { View, Text, StyleSheet, Animated, TouchableWithoutFeedback, } from \"react-native\";\nconst STEP_STATUS = {\n CURRENT: \"current\",\n FINISHED: \"finished\",\n UNFINISHED: \"unfinished\",\n};\nexport default class StepIndicator extends Component {\n constructor(props) {\n super(props);\n const defaultStyles = {\n stepIndicatorSize: 30,\n currentStepIndicatorSize: 40,\n separatorStrokeWidth: 3,\n separatorStrokeUnfinishedWidth: 0,\n separatorStrokeFinishedWidth: 0,\n currentStepStrokeWidth: 5,\n stepStrokeWidth: 0,\n stepStrokeCurrentColor: \"#4aae4f\",\n stepStrokeFinishedColor: \"#4aae4f\",\n stepStrokeUnFinishedColor: \"#4aae4f\",\n separatorFinishedColor: \"#4aae4f\",\n separatorUnFinishedColor: \"#a4d4a5\",\n stepIndicatorFinishedColor: \"#4aae4f\",\n stepIndicatorUnFinishedColor: \"#a4d4a5\",\n stepIndicatorCurrentColor: \"#ffffff\",\n stepIndicatorLabelFontSize: 15,\n currentStepIndicatorLabelFontSize: 15,\n stepIndicatorLabelCurrentColor: \"#000000\",\n stepIndicatorLabelFinishedColor: \"#ffffff\",\n stepIndicatorLabelUnFinishedColor: \"rgba(255,255,255,0.5)\",\n labelColor: \"#000000\",\n labelSize: 13,\n labelAlign: \"center\",\n currentStepLabelColor: \"#4aae4f\",\n };\n const customStyles = Object.assign(defaultStyles, props.customStyles);\n this.state = {\n width: 0,\n height: 1,\n progressBarSize: -2,\n customStyles,\n };\n this.progressAnim = new Animated.Value(0);\n this.sizeAnim = new Animated.Value(this.state.customStyles.stepIndicatorSize);\n this.borderRadiusAnim = new Animated.Value(this.state.customStyles.stepIndicatorSize / 2);\n }\n stepPressed(position) {\n if (this.props.onPress) {\n this.props.onPress(position);\n }\n }\n render() {\n const { labels, direction } = this.props;\n return (React.createElement(View, { style: [\n styles.container,\n direction === \"vertical\"\n ? { flexDirection: \"row\", flex: 1 }\n : { flexDirection: \"column\" },\n ] },\n this.state.width !== 0 && this.renderProgressBarBackground(),\n this.state.width !== 0 && this.renderProgressBar(),\n this.renderStepIndicator(),\n labels && this.renderStepLabels()));\n }\n componentDidUpdate(prevProps) {\n // if (prevProps.customStyles !== this.props.customStyles) {\n // this.setState((state) => ({\n // customStyles: Object.assign(\n // state.customStyles,\n // this.props.customStyles\n // ),\n // }));\n // }\n if (prevProps.currentPosition !== this.props.currentPosition) {\n this.onCurrentPositionChanged(this.props.currentPosition);\n }\n }\n renderProgressBarBackground = () => {\n const { stepCount, direction } = this.props;\n let progressBarBackgroundStyle;\n if (direction === \"vertical\") {\n progressBarBackgroundStyle = {\n backgroundColor: this.state.customStyles.separatorUnFinishedColor,\n position: \"absolute\",\n left: (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,\n top: this.state.height / (2 * stepCount),\n bottom: this.state.height / (2 * stepCount),\n width: this.state.customStyles.separatorStrokeUnfinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeUnfinishedWidth,\n };\n }\n else {\n progressBarBackgroundStyle = {\n backgroundColor: this.state.customStyles.separatorUnFinishedColor,\n position: \"absolute\",\n top: (this.state.height - this.state.customStyles.separatorStrokeWidth) /\n 2,\n left: this.state.width / (2 * stepCount),\n right: this.state.width / (2 * stepCount),\n height: this.state.customStyles.separatorStrokeUnfinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeUnfinishedWidth,\n };\n }\n return (React.createElement(View, { onLayout: (event) => {\n if (direction === \"vertical\") {\n this.setState({ progressBarSize: event.nativeEvent.layout.height }, () => {\n this.onCurrentPositionChanged(this.props.currentPosition);\n });\n }\n else {\n this.setState({ progressBarSize: event.nativeEvent.layout.width }, () => {\n this.onCurrentPositionChanged(this.props.currentPosition);\n });\n }\n }, style: progressBarBackgroundStyle }));\n };\n renderProgressBar = () => {\n const { stepCount, direction } = this.props;\n let progressBarStyle;\n if (direction === \"vertical\") {\n progressBarStyle = {\n backgroundColor: this.state.customStyles.separatorFinishedColor,\n position: \"absolute\",\n left: (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,\n top: this.state.height / (2 * stepCount),\n bottom: this.state.height / (2 * stepCount),\n width: this.state.customStyles.separatorStrokeFinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeFinishedWidth,\n height: this.progressAnim,\n };\n }\n else {\n progressBarStyle = {\n backgroundColor: this.state.customStyles.separatorFinishedColor,\n position: \"absolute\",\n top: (this.state.height - this.state.customStyles.separatorStrokeWidth) /\n 2,\n left: this.state.width / (2 * stepCount),\n right: this.state.width / (2 * stepCount),\n height: this.state.customStyles.separatorStrokeFinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeFinishedWidth,\n width: this.progressAnim,\n };\n }\n return React.createElement(Animated.View, { style: progressBarStyle });\n };\n renderStepIndicator = () => {\n let steps = [];\n const { stepCount, direction } = this.props;\n for (let position = 0; position < stepCount; position++) {\n steps.push(React.createElement(TouchableWithoutFeedback, { key: position, onPress: () => this.stepPressed(position) },\n React.createElement(View, { style: [\n styles.stepContainer,\n direction === \"vertical\"\n ? { flexDirection: \"column\" }\n : { flexDirection: \"row\" },\n ] }, this.renderStep(position))));\n }\n return (React.createElement(View, { onLayout: (event) => this.setState({\n width: event.nativeEvent.layout.width,\n height: event.nativeEvent.layout.height,\n }), style: [\n styles.stepIndicatorContainer,\n direction === \"vertical\"\n ? {\n flexDirection: \"column\",\n width: this.state.customStyles.currentStepIndicatorSize,\n }\n : {\n flexDirection: \"row\",\n height: this.state.customStyles.currentStepIndicatorSize,\n },\n ] }, steps));\n };\n renderStepLabels = () => {\n const { labels, direction, currentPosition, renderLabel } = this.props;\n var labelViews = labels.map((label, index) => {\n const selectedStepLabelStyle = index === currentPosition\n ? { color: this.state.customStyles.currentStepLabelColor }\n : { color: this.state.customStyles.labelColor };\n return (React.createElement(TouchableWithoutFeedback, { style: styles.stepLabelItem, key: index, onPress: () => this.stepPressed(index) },\n React.createElement(View, { style: styles.stepLabelItem }, renderLabel ? (renderLabel({\n position: index,\n stepStatus: this.getStepStatus(index),\n label,\n currentPosition,\n })) : (React.createElement(Text, { style: [\n styles.stepLabel,\n selectedStepLabelStyle,\n {\n fontSize: this.state.customStyles.labelSize,\n fontFamily: this.state.customStyles.labelFontFamily,\n },\n ] }, label)))));\n });\n return (React.createElement(View, { style: [\n styles.stepLabelsContainer,\n direction === \"vertical\"\n ? { flexDirection: \"column\", paddingHorizontal: 4 }\n : { flexDirection: \"row\", paddingVertical: 4 },\n { alignItems: this.state.customStyles.labelAlign },\n ] }, labelViews));\n };\n renderStep = (position) => {\n const { renderStepIndicator } = this.props;\n let stepStyle;\n let indicatorLabelStyle;\n switch (this.getStepStatus(position)) {\n case STEP_STATUS.CURRENT: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorCurrentColor,\n borderWidth: this.state.customStyles.currentStepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeCurrentColor,\n height: this.sizeAnim,\n width: this.sizeAnim,\n borderRadius: this.borderRadiusAnim,\n };\n indicatorLabelStyle = {\n fontSize: this.state.customStyles.currentStepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelCurrentColor,\n };\n break;\n }\n case STEP_STATUS.FINISHED: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorFinishedColor,\n borderWidth: this.state.customStyles.stepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeFinishedColor,\n height: this.state.customStyles.stepIndicatorSize,\n width: this.state.customStyles.stepIndicatorSize,\n borderRadius: this.state.customStyles.stepIndicatorSize / 2,\n };\n indicatorLabelStyle = {\n fontSize: this.state.customStyles.stepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelFinishedColor,\n };\n break;\n }\n case STEP_STATUS.UNFINISHED: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorUnFinishedColor,\n borderWidth: this.state.customStyles.stepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeUnFinishedColor,\n height: this.state.customStyles.stepIndicatorSize,\n width: this.state.customStyles.stepIndicatorSize,\n borderRadius: this.state.customStyles.stepIndicatorSize / 2,\n };\n indicatorLabelStyle = {\n overflow: \"hidden\",\n fontSize: this.state.customStyles.stepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelUnFinishedColor,\n };\n break;\n }\n default:\n }\n return (React.createElement(Animated.View, { key: \"step-indicator\", style: [styles.step, stepStyle] }, renderStepIndicator ? (renderStepIndicator({\n position,\n stepStatus: this.getStepStatus(position),\n })) : (React.createElement(Text, { style: indicatorLabelStyle }, `${position + 1}`))));\n };\n getStepStatus = (stepPosition) => {\n const { currentPosition } = this.props;\n if (stepPosition === currentPosition) {\n return STEP_STATUS.CURRENT;\n }\n else if (stepPosition < currentPosition) {\n return STEP_STATUS.FINISHED;\n }\n else {\n return STEP_STATUS.UNFINISHED;\n }\n };\n onCurrentPositionChanged = (position) => {\n let { stepCount } = this.props;\n if (position > stepCount - 1) {\n position = stepCount - 1;\n }\n const animateToPosition = (this.state.progressBarSize / (stepCount - 1)) * position;\n this.sizeAnim.setValue(this.state.customStyles.stepIndicatorSize);\n this.borderRadiusAnim.setValue(this.state.customStyles.stepIndicatorSize / 2);\n Animated.sequence([\n Animated.timing(this.progressAnim, {\n toValue: animateToPosition,\n duration: 200,\n }),\n Animated.parallel([\n Animated.timing(this.sizeAnim, {\n toValue: this.state.customStyles.currentStepIndicatorSize,\n duration: 100,\n }),\n Animated.timing(this.borderRadiusAnim, {\n toValue: this.state.customStyles.currentStepIndicatorSize / 2,\n duration: 100,\n }),\n ]),\n ]).start();\n };\n}\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"transparent\",\n },\n stepIndicatorContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-around\",\n backgroundColor: \"transparent\",\n },\n stepLabelsContainer: {\n justifyContent: \"space-around\",\n },\n step: {\n alignItems: \"center\",\n justifyContent: \"center\",\n zIndex: 2,\n },\n stepContainer: {\n flex: 1,\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n stepLabel: {\n fontSize: 12,\n textAlign: \"center\",\n fontWeight: \"500\",\n },\n stepLabelItem: {\n flex: 1,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n});\nStepIndicator.defaultProps = {\n currentPosition: 0,\n stepCount: 5,\n customStyles: {},\n direction: \"horizontal\",\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["StepIndicator.tsx"],"names":["STEP_STATUS","CURRENT","FINISHED","UNFINISHED","StepIndicator","Component","constructor","props","stepCount","direction","progressBarBackgroundStyle","backgroundColor","state","customStyles","separatorUnFinishedColor","position","left","width","separatorStrokeWidth","top","height","bottom","separatorStrokeUnfinishedWidth","right","event","setState","progressBarSize","nativeEvent","layout","onCurrentPositionChanged","currentPosition","progressBarStyle","separatorFinishedColor","separatorStrokeFinishedWidth","progressAnim","steps","push","stepPressed","styles","stepContainer","flexDirection","renderStep","stepIndicatorContainer","currentStepIndicatorSize","labels","renderLabel","labelViews","map","label","index","selectedStepLabelStyle","color","currentStepLabelColor","labelColor","stepLabelItem","stepStatus","getStepStatus","stepLabel","fontSize","labelSize","fontFamily","labelFontFamily","stepLabelsContainer","paddingHorizontal","paddingVertical","alignItems","labelAlign","renderStepIndicator","stepStyle","indicatorLabelStyle","stepIndicatorCurrentColor","borderWidth","currentStepStrokeWidth","borderColor","stepStrokeCurrentColor","sizeAnim","borderRadius","borderRadiusAnim","currentStepIndicatorLabelFontSize","stepIndicatorLabelCurrentColor","stepIndicatorFinishedColor","stepStrokeWidth","stepStrokeFinishedColor","stepIndicatorSize","stepIndicatorLabelFontSize","stepIndicatorLabelFinishedColor","stepIndicatorUnFinishedColor","stepStrokeUnFinishedColor","overflow","stepIndicatorLabelUnFinishedColor","step","stepPosition","animateToPosition","setValue","Animated","sequence","timing","toValue","duration","parallel","start","defaultStyles","Object","assign","Value","onPress","render","container","flex","renderProgressBarBackground","renderProgressBar","renderStepLabels","componentDidUpdate","prevProps","StyleSheet","create","justifyContent","zIndex","textAlign","fontWeight","defaultProps"],"mappings":";;;;;;;AACA;;AACA;;;;;;;;AAQA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,OAAO,EAAE,SADS;AAElBC,EAAAA,QAAQ,EAAE,UAFQ;AAGlBC,EAAAA,UAAU,EAAE;AAHM,CAApB;;AA+Ce,MAAMC,aAAN,SAA4BC,gBAA5B,CAAoD;AACjEC,EAAAA,WAAW,CAACC,KAAD,EAAe;AACxB,UAAMA,KAAN;;AADwB,yDAwFI,MAAM;AAClC,YAAM;AAAEC,QAAAA,SAAF;AAAaC,QAAAA;AAAb,UAA2B,KAAKF,KAAtC;AACA,UAAIG,0BAAJ;;AACA,UAAID,SAAS,KAAK,UAAlB,EAA8B;AAC5BC,QAAAA,0BAA0B,GAAG;AAC3BC,UAAAA,eAAe,EAAE,KAAKC,KAAL,CAAWC,YAAX,CAAwBC,wBADd;AAE3BC,UAAAA,QAAQ,EAAE,UAFiB;AAG3BC,UAAAA,IAAI,EACF,CAAC,KAAKJ,KAAL,CAAWK,KAAX,GAAmB,KAAKL,KAAL,CAAWC,YAAX,CAAwBK,oBAA5C,IAAoE,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heck\nimport React, { Component } from \"react\";\nimport {\n View,\n Text,\n StyleSheet,\n Animated,\n TouchableWithoutFeedback,\n} from \"react-native\";\n\nconst STEP_STATUS = {\n CURRENT: \"current\",\n FINISHED: \"finished\",\n UNFINISHED: \"unfinished\",\n};\n\ninterface CustomStyles {\n stepIndicatorSize?: number;\n currentStepIndicatorSize?: number;\n separatorStrokeWidth?: number;\n separatorStrokeUnfinishedWidth?: number;\n separatorStrokeFinishedWidth?: number;\n currentStepStrokeWidth: number;\n stepStrokeWidth?: number;\n stepStrokeCurrentColor?: string;\n stepStrokeFinishedColor: string;\n stepStrokeUnFinishedColor: string;\n separatorFinishedColor: string;\n separatorUnFinishedColor: string;\n stepIndicatorFinishedColor: string;\n stepIndicatorUnFinishedColor: string;\n stepIndicatorCurrentColor: string;\n stepIndicatorLabelFontSize: number;\n currentStepIndicatorLabelFontSize?: number;\n stepIndicatorLabelCurrentColor: string;\n stepIndicatorLabelFinishedColor: string;\n stepIndicatorLabelUnFinishedColor: string;\n labelColor?: string;\n labelSize?: number;\n labelAlign?: string;\n currentStepLabelColor?: string;\n labelFontFamily?: string;\n}\n\ntype Props = {\n stepCount: number;\n currentPosition: number;\n customStyles: CustomStyles;\n};\n\ntype State = {\n width: number;\n height: number;\n progressBarSize: number;\n customStyles: CustomStyles;\n};\n\nexport default class StepIndicator extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n\n const defaultStyles = {\n stepIndicatorSize: 30,\n currentStepIndicatorSize: 40,\n separatorStrokeWidth: 3,\n separatorStrokeUnfinishedWidth: 0,\n separatorStrokeFinishedWidth: 0,\n currentStepStrokeWidth: 5,\n stepStrokeWidth: 0,\n stepStrokeCurrentColor: \"#4aae4f\",\n stepStrokeFinishedColor: \"#4aae4f\",\n stepStrokeUnFinishedColor: \"#4aae4f\",\n separatorFinishedColor: \"#4aae4f\",\n separatorUnFinishedColor: \"#a4d4a5\",\n stepIndicatorFinishedColor: \"#4aae4f\",\n stepIndicatorUnFinishedColor: \"#a4d4a5\",\n stepIndicatorCurrentColor: \"#ffffff\",\n stepIndicatorLabelFontSize: 15,\n currentStepIndicatorLabelFontSize: 15,\n stepIndicatorLabelCurrentColor: \"#000000\",\n stepIndicatorLabelFinishedColor: \"#ffffff\",\n stepIndicatorLabelUnFinishedColor: \"rgba(255,255,255,0.5)\",\n labelColor: \"#000000\",\n labelSize: 13,\n labelAlign: \"center\",\n currentStepLabelColor: \"#4aae4f\",\n };\n\n const customStyles = Object.assign(defaultStyles, props.customStyles);\n\n this.state = {\n width: 0,\n height: 1,\n progressBarSize: -2,\n customStyles,\n };\n\n this.progressAnim = new Animated.Value(0);\n this.sizeAnim = new Animated.Value(\n this.state.customStyles.stepIndicatorSize\n );\n this.borderRadiusAnim = new Animated.Value(\n this.state.customStyles.stepIndicatorSize / 2\n );\n }\n\n stepPressed(position) {\n if (this.props.onPress) {\n this.props.onPress(position);\n }\n }\n\n render() {\n const { labels, direction } = this.props;\n return (\n <View\n style={[\n styles.container,\n direction === \"vertical\"\n ? { flexDirection: \"row\", flex: 1 }\n : { flexDirection: \"column\" },\n ]}\n >\n {this.state.width !== 0 && this.renderProgressBarBackground()}\n {this.state.width !== 0 && this.renderProgressBar()}\n {this.renderStepIndicator()}\n {labels && this.renderStepLabels()}\n </View>\n );\n }\n\n componentDidUpdate(prevProps) {\n // if (prevProps.customStyles !== this.props.customStyles) {\n // this.setState((state) => ({\n // customStyles: Object.assign(\n // state.customStyles,\n // this.props.customStyles\n // ),\n // }));\n // }\n\n if (prevProps.currentPosition !== this.props.currentPosition) {\n this.onCurrentPositionChanged(this.props.currentPosition);\n }\n }\n\n renderProgressBarBackground = () => {\n const { stepCount, direction } = this.props;\n let progressBarBackgroundStyle;\n if (direction === \"vertical\") {\n progressBarBackgroundStyle = {\n backgroundColor: this.state.customStyles.separatorUnFinishedColor,\n position: \"absolute\",\n left:\n (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,\n top: this.state.height / (2 * stepCount),\n bottom: this.state.height / (2 * stepCount),\n width:\n this.state.customStyles.separatorStrokeUnfinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeUnfinishedWidth,\n };\n } else {\n progressBarBackgroundStyle = {\n backgroundColor: this.state.customStyles.separatorUnFinishedColor,\n position: \"absolute\",\n top:\n (this.state.height - this.state.customStyles.separatorStrokeWidth) /\n 2,\n left: this.state.width / (2 * stepCount),\n right: this.state.width / (2 * stepCount),\n height:\n this.state.customStyles.separatorStrokeUnfinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeUnfinishedWidth,\n };\n }\n return (\n <View\n onLayout={(event) => {\n if (direction === \"vertical\") {\n this.setState(\n { progressBarSize: event.nativeEvent.layout.height },\n () => {\n this.onCurrentPositionChanged(this.props.currentPosition);\n }\n );\n } else {\n this.setState(\n { progressBarSize: event.nativeEvent.layout.width },\n () => {\n this.onCurrentPositionChanged(this.props.currentPosition);\n }\n );\n }\n }}\n style={progressBarBackgroundStyle}\n />\n );\n };\n\n renderProgressBar = () => {\n const { stepCount, direction } = this.props;\n let progressBarStyle;\n if (direction === \"vertical\") {\n progressBarStyle = {\n backgroundColor: this.state.customStyles.separatorFinishedColor,\n position: \"absolute\",\n left:\n (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,\n top: this.state.height / (2 * stepCount),\n bottom: this.state.height / (2 * stepCount),\n width:\n this.state.customStyles.separatorStrokeFinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeFinishedWidth,\n height: this.progressAnim,\n };\n } else {\n progressBarStyle = {\n backgroundColor: this.state.customStyles.separatorFinishedColor,\n position: \"absolute\",\n top:\n (this.state.height - this.state.customStyles.separatorStrokeWidth) /\n 2,\n left: this.state.width / (2 * stepCount),\n right: this.state.width / (2 * stepCount),\n height:\n this.state.customStyles.separatorStrokeFinishedWidth === 0\n ? this.state.customStyles.separatorStrokeWidth\n : this.state.customStyles.separatorStrokeFinishedWidth,\n width: this.progressAnim,\n };\n }\n return <Animated.View style={progressBarStyle} />;\n };\n\n renderStepIndicator = () => {\n let steps = [];\n const { stepCount, direction } = this.props;\n for (let position = 0; position < stepCount; position++) {\n steps.push(\n <TouchableWithoutFeedback\n key={position}\n onPress={() => this.stepPressed(position)}\n >\n <View\n style={[\n styles.stepContainer,\n direction === \"vertical\"\n ? { flexDirection: \"column\" }\n : { flexDirection: \"row\" },\n ]}\n >\n {this.renderStep(position)}\n </View>\n </TouchableWithoutFeedback>\n );\n }\n return (\n <View\n onLayout={(event) =>\n this.setState({\n width: event.nativeEvent.layout.width,\n height: event.nativeEvent.layout.height,\n })\n }\n style={[\n styles.stepIndicatorContainer,\n direction === \"vertical\"\n ? {\n flexDirection: \"column\",\n width: this.state.customStyles.currentStepIndicatorSize,\n }\n : {\n flexDirection: \"row\",\n height: this.state.customStyles.currentStepIndicatorSize,\n },\n ]}\n >\n {steps}\n </View>\n );\n };\n\n renderStepLabels = () => {\n const { labels, direction, currentPosition, renderLabel } = this.props;\n var labelViews = labels.map((label, index) => {\n const selectedStepLabelStyle =\n index === currentPosition\n ? { color: this.state.customStyles.currentStepLabelColor }\n : { color: this.state.customStyles.labelColor };\n return (\n <TouchableWithoutFeedback\n style={styles.stepLabelItem}\n key={index}\n onPress={() => this.stepPressed(index)}\n >\n <View style={styles.stepLabelItem}>\n {renderLabel ? (\n renderLabel({\n position: index,\n stepStatus: this.getStepStatus(index),\n label,\n currentPosition,\n })\n ) : (\n <Text\n style={[\n styles.stepLabel,\n selectedStepLabelStyle,\n {\n fontSize: this.state.customStyles.labelSize,\n fontFamily: this.state.customStyles.labelFontFamily,\n },\n ]}\n >\n {label}\n </Text>\n )}\n </View>\n </TouchableWithoutFeedback>\n );\n });\n\n return (\n <View\n style={[\n styles.stepLabelsContainer,\n direction === \"vertical\"\n ? { flexDirection: \"column\", paddingHorizontal: 4 }\n : { flexDirection: \"row\", paddingVertical: 4 },\n { alignItems: this.state.customStyles.labelAlign },\n ]}\n >\n {labelViews}\n </View>\n );\n };\n\n renderStep = (position) => {\n const { renderStepIndicator } = this.props;\n let stepStyle;\n let indicatorLabelStyle;\n\n switch (this.getStepStatus(position)) {\n case STEP_STATUS.CURRENT: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorCurrentColor,\n borderWidth: this.state.customStyles.currentStepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeCurrentColor,\n height: this.sizeAnim,\n width: this.sizeAnim,\n borderRadius: this.borderRadiusAnim,\n };\n indicatorLabelStyle = {\n fontSize: this.state.customStyles.currentStepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelCurrentColor,\n };\n\n break;\n }\n case STEP_STATUS.FINISHED: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorFinishedColor,\n borderWidth: this.state.customStyles.stepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeFinishedColor,\n height: this.state.customStyles.stepIndicatorSize,\n width: this.state.customStyles.stepIndicatorSize,\n borderRadius: this.state.customStyles.stepIndicatorSize / 2,\n };\n indicatorLabelStyle = {\n fontSize: this.state.customStyles.stepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelFinishedColor,\n };\n break;\n }\n\n case STEP_STATUS.UNFINISHED: {\n stepStyle = {\n backgroundColor: this.state.customStyles.stepIndicatorUnFinishedColor,\n borderWidth: this.state.customStyles.stepStrokeWidth,\n borderColor: this.state.customStyles.stepStrokeUnFinishedColor,\n height: this.state.customStyles.stepIndicatorSize,\n width: this.state.customStyles.stepIndicatorSize,\n borderRadius: this.state.customStyles.stepIndicatorSize / 2,\n };\n indicatorLabelStyle = {\n overflow: \"hidden\",\n fontSize: this.state.customStyles.stepIndicatorLabelFontSize,\n color: this.state.customStyles.stepIndicatorLabelUnFinishedColor,\n };\n break;\n }\n default:\n }\n\n return (\n <Animated.View key={\"step-indicator\"} style={[styles.step, stepStyle]}>\n {renderStepIndicator ? (\n renderStepIndicator({\n position,\n stepStatus: this.getStepStatus(position),\n })\n ) : (\n <Text style={indicatorLabelStyle}>{`${position + 1}`}</Text>\n )}\n </Animated.View>\n );\n };\n\n getStepStatus = (stepPosition) => {\n const { currentPosition } = this.props;\n if (stepPosition === currentPosition) {\n return STEP_STATUS.CURRENT;\n } else if (stepPosition < currentPosition) {\n return STEP_STATUS.FINISHED;\n } else {\n return STEP_STATUS.UNFINISHED;\n }\n };\n\n onCurrentPositionChanged = (position) => {\n let { stepCount } = this.props;\n if (position > stepCount - 1) {\n position = stepCount - 1;\n }\n const animateToPosition =\n (this.state.progressBarSize / (stepCount - 1)) * position;\n this.sizeAnim.setValue(this.state.customStyles.stepIndicatorSize);\n this.borderRadiusAnim.setValue(\n this.state.customStyles.stepIndicatorSize / 2\n );\n Animated.sequence([\n Animated.timing(this.progressAnim, {\n toValue: animateToPosition,\n duration: 200,\n }),\n Animated.parallel([\n Animated.timing(this.sizeAnim, {\n toValue: this.state.customStyles.currentStepIndicatorSize,\n duration: 100,\n }),\n Animated.timing(this.borderRadiusAnim, {\n toValue: this.state.customStyles.currentStepIndicatorSize / 2,\n duration: 100,\n }),\n ]),\n ]).start();\n };\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"transparent\",\n },\n stepIndicatorContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-around\",\n backgroundColor: \"transparent\",\n },\n stepLabelsContainer: {\n justifyContent: \"space-around\",\n },\n step: {\n alignItems: \"center\",\n justifyContent: \"center\",\n zIndex: 2,\n },\n stepContainer: {\n flex: 1,\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n stepLabel: {\n fontSize: 12,\n textAlign: \"center\",\n fontWeight: \"500\",\n },\n stepLabelItem: {\n flex: 1,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n});\n\nStepIndicator.defaultProps = {\n currentPosition: 0,\n stepCount: 5,\n customStyles: {},\n direction: \"horizontal\",\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Stepper.
|
|
1
|
+
{"version":3,"sources":["Stepper.tsx"],"names":["Stepper","min","Infinity","max","value","valueProp","defaultValue","style","typeStyle","iconSize","iconColor","onChange","theme","colors","typography","Icon","setValue","isValidValue","valueArg","handlePlusOrMinus","type","newValue","flexDirection","opacity","body1","textAlign","alignSelf","color","medium","marginHorizontal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAGA;;;;;;;;AAeA,MAAMA,OAAkB,GAAG,QAYrB;AAAA,MAZsB;AAC1BC,IAAAA,GAAG,GAAG,CAACC,QADmB;AAE1BC,IAAAA,GAAG,GAAGD,QAFoB;AAG1BE,IAAAA,KAAK,EAAEC,SAHmB;AAI1BC,IAAAA,YAJ0B;AAK1BC,IAAAA,KAL0B;AAM1BC,IAAAA,SAN0B;AAO1BC,IAAAA,QAAQ,GAAG,EAPe;AAQ1BC,IAAAA,SAR0B;AAS1BC,IAAAA,QAT0B;AAU1BC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KAVmB;AAW1BC,IAAAA;AAX0B,GAYtB;AACJ,QAAM,CAACX,KAAD,EAAQY,QAAR,IAAoB,qBAASV,YAAT,aAASA,YAAT,cAASA,YAAT,GAAyB,CAAzB,CAA1B;;AAEA,QAAMW,YAAY,GAAIC,QAAD,IAAsBA,QAAQ,IAAIjB,GAAZ,IAAmBiB,QAAQ,IAAIf,GAA1E;;AAEA,QAAMgB,iBAAiB,GAAIC,IAAD,IAA4B;AACpD,UAAMC,QAAQ,GAAGD,IAAI,KAAK,MAAT,GAAkBhB,KAAK,GAAG,CAA1B,GAA8BA,KAAK,GAAG,CAAvD;;AAEA,QAAIa,YAAY,CAACI,QAAD,CAAhB,EAA4B;AAC1BL,MAAAA,QAAQ,CAACK,QAAD,CAAR;AACAV,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGU,QAAH,CAAR;AACD;AAC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AA,KAAK,EAAE;AAAEoB,MAAAA,OAAO,EAAEnB,KAAK,KAAKD,GAAV,GAAgB,GAAhB,GAAsB;AAAjC;AAPT,IA1BF,CADF;AAsCD,CA5ED;;eA8Ee,wBAAUH,OAAV,C","sourcesContent":["import React, { FC, useEffect, useState } from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { isNumber } from \"lodash\";\n\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport IconButton from \"./IconButton\";\n\ntype Props = {\n min: number;\n max: number;\n value?: number;\n defaultValue?: number;\n style?: StyleProp<ViewStyle>;\n typeStyle?: StyleProp<TextStyle>;\n iconSize: number;\n iconColor?: string;\n onChange?: (value: number) => void;\n theme: Theme;\n} & IconSlot;\n\nconst Stepper: FC<Props> = ({\n min = -Infinity,\n max = Infinity,\n value: valueProp,\n defaultValue,\n style,\n typeStyle,\n iconSize = 24,\n iconColor,\n onChange,\n theme: { colors, typography },\n Icon,\n}) => {\n const [value, setValue] = useState(defaultValue ?? 0);\n\n const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;\n\n const handlePlusOrMinus = (type: \"plus\" | \"minus\") => {\n const newValue = type === \"plus\" ? value + 1 : value - 1;\n\n if (isValidValue(newValue)) {\n setValue(newValue);\n onChange?.(newValue);\n }\n };\n\n useEffect(() => {\n if (\n valueProp != null &&\n isNumber(valueProp) &&\n valueProp !== value &&\n isValidValue(valueProp)\n ) {\n setValue(valueProp);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [valueProp]);\n\n return (\n <View style={[{ flexDirection: \"row\" }, style]}>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={() => handlePlusOrMinus(\"minus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === min}\n style={{ opacity: value === min ? 0.5 : 1 }}\n />\n\n <Text\n style={[\n typography.body1,\n {\n textAlign: \"center\",\n alignSelf: \"center\",\n color: colors.medium,\n marginHorizontal: 8,\n },\n typeStyle,\n ]}\n >\n {value}\n </Text>\n\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={() => handlePlusOrMinus(\"plus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === max}\n style={{ opacity: value === max ? 0.5 : 1 }}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks.
|
|
1
|
+
{"version":3,"sources":["hooks.ts"],"names":["usePrevious","value","ref","React","useRef","useEffect","current"],"mappings":";;;;;;;AAAA;;;;AAEO,SAASA,WAAT,CAAqBC,KAArB,EAAiC;AACtC;AACA;AACA,QAAMC,GAAG,GAAGC,eAAMC,MAAN,EAAZ,CAHsC,CAKtC;;;AACAD,iBAAME,SAAN,CAAgB,MAAM;AACpBH,IAAAA,GAAG,CAACI,OAAJ,GAAcL,KAAd;AACD,GAFD,EAEG,CAACA,KAAD,CAFH,EANsC,CAUtC;;;AACA,SAAOC,GAAG,CAACI,OAAX;AACD","sourcesContent":["import React from \"react\";\n\nexport function usePrevious(value: any) {\n // The ref object is a generic container whose current property is mutable\n // and can hold any value, similar to an instance property on a class\n const ref = React.useRef();\n\n // Store current value in ref\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n\n // Return previous value (happens before update in useEffect above)\n return ref.current;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonRow.
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.ts"],"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","props","label","description","required","defaultValue","direction","options","value","color","group","GROUPS","basic","unselectedColor"],"mappings":";;;;;;;AAAA;;AAQO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,kBADiB;AAEvBC,EAAAA,GAAG,EAAE,gBAFkB;AAGvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAHH;AAIvBC,EAAAA,MAAM,EAAE,EAJe;AAKvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,2BAAe;AACpBA,MAAAA,KAAK,EAAE,OADa;AAEpBC,MAAAA,WAAW,EAAE,qCAFO;AAGpBC,MAAAA,QAAQ,EAAE,IAHU;AAIpBC,MAAAA,YAAY,EAAE;AAJM,KAAf,CADF;AAOLC,IAAAA,SAAS,EAAE,+BAAmB;AAC5BJ,MAAAA,KAAK,EAAE,WADqB;AAE5BC,MAAAA,WAAW,EACT,8DAH0B;AAI5BI,MAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,aAAR;AAJmB,KAAnB,CAPN;AAaLC,IAAAA,KAAK,EAAE,2BAAe;AACpBN,MAAAA,KAAK,EAAE,OADa;AAEpBC,MAAAA,WAAW,EAAE,2BAFO;AAGpBE,MAAAA,YAAY,EAAE,IAHM;AAIpBD,MAAAA,QAAQ,EAAE;AAJU,KAAf,CAbF;AAmBLK,IAAAA,KAAK,EAAE,4BAAgB;AACrBC,MAAAA,KAAK,EAAEC,cAAOC,KADO;AAErBT,MAAAA,WAAW,EAAE,sBAFQ;AAGrBE,MAAAA,YAAY,EAAE;AAHO,KAAhB,CAnBF;AAwBLQ,IAAAA,eAAe,EAAE,4BAAgB;AAC/BH,MAAAA,KAAK,EAAEC,cAAOC,KADiB;AAE/BV,MAAAA,KAAK,EAAE,kBAFwB;AAG/BC,MAAAA,WAAW,EAAE,iCAHkB;AAI/BE,MAAAA,YAAY,EAAE;AAJiB,KAAhB;AAxBZ;AALgB,CAAlB","sourcesContent":["import {\n createTextProp,\n createTextEnumProp,\n COMPONENT_TYPES,\n createColorProp,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Radio Button Row\",\n tag: \"RadioButtonRow\",\n category: COMPONENT_TYPES.input,\n layout: {},\n props: {\n label: createTextProp({\n label: \"Label\",\n description: \"Label to show with the radio button\",\n required: true,\n defaultValue: \"First Option\",\n }),\n direction: createTextEnumProp({\n label: \"Direction\",\n description:\n \"Whether the checkbox will appear on the left or on the right\",\n options: [\"row\", \"row-reverse\"],\n }),\n value: createTextProp({\n label: \"Value\",\n description: \"Value of the radio button\",\n defaultValue: null,\n required: true,\n }),\n color: createColorProp({\n group: GROUPS.basic,\n description: \"Color for the button\",\n defaultValue: \"primary\",\n }),\n unselectedColor: createColorProp({\n group: GROUPS.basic,\n label: \"Unselected Color\",\n description: \"Unselected Color for the button\",\n defaultValue: \"primary\",\n }),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ScrollView.
|
|
1
|
+
{"version":3,"sources":["ScrollView.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","layout","props","horizontal","label","defaultValue","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","bounces"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,aADiB;AAEvBC,EAAAA,GAAG,EAAE,YAFkB;AAGvBC,EAAAA,WAAW,EAAE,8BAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,MAJH;AAKvBA,EAAAA,MAAM,EAAE,EALe;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,iCAAqB;AAC/BC,MAAAA,KAAK,EAAE,YADwB;AAE/BN,MAAAA,WAAW,EAAE,+BAFkB;AAG/BO,MAAAA,YAAY,EAAE;AAHiB,KAArB,CADP;AAMLC,IAAAA,8BAA8B,EAAE,iCAAqB;AACnDF,MAAAA,KAAK,EAAE,kCAD4C;AAEnDN,MAAAA,WAAW,EACT,4EAHiD;AAInDO,MAAAA,YAAY,EAAE;AAJqC,KAArB,CAN3B;AAYLE,IAAAA,4BAA4B,EAAE,iCAAqB;AACjDH,MAAAA,KAAK,EAAE,gCAD0C;AAEjDN,MAAAA,WAAW,EACT,0EAH+C;AAIjDO,MAAAA,YAAY,EAAE;AAJmC,KAArB,CAZzB;AAkBLG,IAAAA,OAAO,EAAE,iCAAqB;AAC5BJ,MAAAA,KAAK,EAAE,QADqB;AAE5BN,MAAAA,WAAW,EACT,iKAH0B;AAI5BO,MAAAA,YAAY,EAAE;AAJc,KAArB;AAlBJ;AANgB,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createStaticBoolProp } from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Scroll View\",\n tag: \"ScrollView\",\n description: \"A basic ScrollView component\",\n category: COMPONENT_TYPES.layout,\n layout: {},\n props: {\n horizontal: createStaticBoolProp({\n label: \"Horizontal\",\n description: \"Render your list horizontally\",\n defaultValue: false,\n }),\n showsHorizontalScrollIndicator: createStaticBoolProp({\n label: \"Show Horizontal Scroll Indicator\",\n description:\n \"When true, shows a horizontal scroll indicator. The default value is true.\",\n defaultValue: false,\n }),\n showsVerticalScrollIndicator: createStaticBoolProp({\n label: \"Show Vertical Scroll Indicator\",\n description:\n \"When true, shows a vertical scroll indicator. The default value is true.\",\n defaultValue: true,\n }),\n bounces: createStaticBoolProp({\n label: \"Bounce\",\n description:\n \"When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.\",\n defaultValue: true,\n }),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["WebView.
|
|
1
|
+
{"version":3,"sources":["WebView.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","media","layout","flex","props","source","defaultValue","optimizeVideoChat","label"],"mappings":";;;;;;;AAAA;;AAMO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,UADiB;AAEvBC,EAAAA,GAAG,EAAE,SAFkB;AAGvBC,EAAAA,WAAW,EAAE,kCAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAJH;AAKvBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GALe;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,6BAAiB;AACvBC,MAAAA,YAAY,EAAE;AADS,KAAjB,CADH;AAILC,IAAAA,iBAAiB,EAAE,iCAAqB;AACtCD,MAAAA,YAAY,EAAE,KADwB;AAEtCE,MAAAA,KAAK,EAAE,qBAF+B;AAGtCV,MAAAA,WAAW,EACT;AAJoC,KAArB;AAJd;AANgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createSourceProp,\n createStaticBoolProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Web View\",\n tag: \"WebView\",\n description: \"Render web content inside a view\",\n category: COMPONENT_TYPES.media,\n layout: { flex: 1 },\n props: {\n source: createSourceProp({\n defaultValue: \"https://reactnative.dev\",\n }),\n optimizeVideoChat: createStaticBoolProp({\n defaultValue: false,\n label: \"Optimize Video Chat\",\n description:\n \"Allows for a better experience from web hosted video chat services\",\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform
|
|
2
|
+
import { View, StyleSheet, Text, Platform } from "react-native";
|
|
3
3
|
import { omit, pick, pickBy, identity } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -38,7 +38,7 @@ const disabledColor = "rgb(240, 240, 240)";
|
|
|
38
38
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
39
39
|
|
|
40
40
|
const Picker = _ref => {
|
|
41
|
-
var _find$label, _find
|
|
41
|
+
var _find$label, _find;
|
|
42
42
|
|
|
43
43
|
let {
|
|
44
44
|
error,
|
|
@@ -59,7 +59,7 @@ const Picker = _ref => {
|
|
|
59
59
|
leftIconName,
|
|
60
60
|
placeholderTextColor = unstyledColor,
|
|
61
61
|
rightIconName,
|
|
62
|
-
type = "
|
|
62
|
+
type = "underline"
|
|
63
63
|
} = _ref;
|
|
64
64
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
65
65
|
const [pickerVisible, togglePickerVisible] = React.useReducer(state => !state, false);
|
|
@@ -110,15 +110,13 @@ const Picker = _ref => {
|
|
|
110
110
|
};
|
|
111
111
|
const margins = ["marginLeft", "marginRight", "marginTop", "marginBottom"];
|
|
112
112
|
const marginStyles = pick(viewStyles, margins);
|
|
113
|
-
const
|
|
113
|
+
const platform = Platform.OS;
|
|
114
114
|
const stylesWithoutBordersAndMargins = { ...{
|
|
115
115
|
height: 60,
|
|
116
|
-
width: "100%"
|
|
116
|
+
width: "100%",
|
|
117
|
+
flex: platform === "web" ? undefined : 1
|
|
117
118
|
},
|
|
118
|
-
...omit(viewStyles, [...borders, ...margins])
|
|
119
|
-
...{
|
|
120
|
-
maxHeight
|
|
121
|
-
}
|
|
119
|
+
...omit(viewStyles, [...borders, ...margins])
|
|
122
120
|
};
|
|
123
121
|
const selectedLabel = internalValue && ((_find$label = (_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) !== null && _find$label !== void 0 ? _find$label : internalValue);
|
|
124
122
|
const labelText = label ? /*#__PURE__*/React.createElement(Text, {
|
|
@@ -148,7 +146,7 @@ const Picker = _ref => {
|
|
|
148
146
|
marginLeft: 8
|
|
149
147
|
}
|
|
150
148
|
}) : null;
|
|
151
|
-
const width =
|
|
149
|
+
const width = stylesWithoutBordersAndMargins === null || stylesWithoutBordersAndMargins === void 0 ? void 0 : stylesWithoutBordersAndMargins.width;
|
|
152
150
|
const textAlign = textStyles === null || textStyles === void 0 ? void 0 : textStyles.textAlign;
|
|
153
151
|
const paddingLeft = leftIconOutset && (!textAlign || textAlign === "left" || textAlign === "justify") ? iconSize + 4 : 0;
|
|
154
152
|
const assistiveTextLabel = assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
@@ -193,18 +191,14 @@ const Picker = _ref => {
|
|
|
193
191
|
style: styles.touchableContainer
|
|
194
192
|
}, /*#__PURE__*/React.createElement(View, {
|
|
195
193
|
pointerEvents: "none",
|
|
196
|
-
style: [styles.outsetContainer, stylesWithoutBordersAndMargins,
|
|
197
|
-
!leftIconOutset && borderStyles // set border if Icon is inset
|
|
198
|
-
]
|
|
194
|
+
style: [styles.outsetContainer, stylesWithoutBordersAndMargins, !leftIconOutset ? borderStyles : {}]
|
|
199
195
|
}, leftIcon, /*#__PURE__*/React.createElement(View, {
|
|
200
|
-
style: [styles.insetContainer,
|
|
201
|
-
leftIconOutset && borderStyles // set border if Icon is outset
|
|
202
|
-
]
|
|
196
|
+
style: [styles.insetContainer, leftIconOutset ? borderStyles : {}]
|
|
203
197
|
}, /*#__PURE__*/React.createElement(View, {
|
|
204
198
|
style: styles.primaryTextContainer
|
|
205
199
|
}, labelText, /*#__PURE__*/React.createElement(Text, {
|
|
206
200
|
style: primaryTextStyle
|
|
207
|
-
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel),
|
|
201
|
+
}, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), platform === "ios" && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
208
202
|
style: [styles.iosPicker, {
|
|
209
203
|
backgroundColor: colors.divider
|
|
210
204
|
}]
|
|
@@ -223,7 +217,7 @@ const Picker = _ref => {
|
|
|
223
217
|
label: option.label,
|
|
224
218
|
value: option.value,
|
|
225
219
|
key: option.value
|
|
226
|
-
})))))) : null,
|
|
220
|
+
})))))) : null, platform !== "ios" ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
227
221
|
enabled: !disabled,
|
|
228
222
|
selectedValue: internalValue,
|
|
229
223
|
onValueChange: handleValueChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Picker.tsx"],"names":["React","View","StyleSheet","Text","Platform","Dimensions","omit","pick","pickBy","identity","SafeAreaView","Picker","NativePicker","withTheme","Portal","Button","Touchable","extractStyles","normalizeOptions","options","length","map","option","label","String","value","Error","unstyledColor","disabledColor","errorColor","error","onValueChange","defaultValue","Icon","style","placeholder","disabled","theme","assistiveText","iconColor","iconSize","leftIconMode","leftIconName","placeholderTextColor","rightIconName","type","internalValue","setInternalValue","useState","pickerVisible","togglePickerVisible","useReducer","state","useEffect","normalizedOptions","pickerOptions","viewStyles","textStyles","colors","borders","borderStyles","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","borderTopWidth","borderRightWidth","borderLeftWidth","borderBottomWidth","borderColor","borderStyle","backgroundColor","margins","marginStyles","maxHeight","get","height","stylesWithoutBordersAndMargins","width","selectedLabel","find","labelText","textAlign","color","fontSize","paddingBottom","leftIconOutset","leftIcon","marginRight","marginLeft","rightIcon","undefined","paddingLeft","assistiveTextLabel","paddingTop","primaryTextStyle","handleValueChange","newValue","itemIndex","styles","marginsContainer","touchableContainer","outsetContainer","insetContainer","primaryTextContainer","OS","iosPicker","divider","iosSafeArea","iosButton","iosNativePicker","nonIosPicker","create","alignSelf","alignItems","flexDirection","justifyContent","flex","paddingRight","position","bottom","left","right","opacity","top"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,IADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,EAOEC,UAPF,QAQO,cARP;AASA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,MAArB,EAA6BC,QAA7B,QAA6C,QAA7C;AACA,SAASC,YAAT,QAA6B,gCAA7B;AACA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AAEA,SAASC,SAAT,QAA0B,eAA1B;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAGA,SAASC,aAAT,QAA8B,iBAA9B;;AA6BA,SAASC,gBAAT,CAA0BC,OAA1B,EAA2E;AACzE,MAAIA,OAAO,CAAC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Content":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n Text,\n Platform,\n ViewStyle,\n StyleProp,\n Dimensions,\n} from \"react-native\";\nimport { omit, pick, pickBy, identity } from \"lodash\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport Touchable from \"../Touchable\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { extractStyles } from \"../../utilities\";\n\nexport interface PickerOption {\n value: string;\n label: string;\n}\n\nexport type PickerProps = {\n error?: any;\n placeholder?: string;\n disabled?: boolean;\n style?: StyleProp<ViewStyle> & { height?: number };\n value?: string;\n options: PickerOption[] | string[];\n onValueChange: (value: string, index: number) => void;\n defaultValue?: string;\n assistiveText?: string;\n label?: string;\n iconColor?: string;\n iconSize?: number;\n leftIconMode?: \"inset\" | \"outset\";\n leftIconName?: string;\n placeholderTextColor?: string;\n rightIconName?: string;\n type?: \"solid\" | \"underline\";\n theme: Theme;\n Icon: IconSlot[\"Icon\"];\n};\n\nfunction normalizeOptions(options: PickerProps[\"options\"]): PickerOption[] {\n if (options.length === 0) {\n return [];\n }\n\n if (typeof options[0] === (\"string\" || \"number\")) {\n return (options as string[]).map((option) => ({\n label: String(option),\n value: String(option),\n }));\n }\n\n if (\n typeof options[0] === \"object\" &&\n options[0].value !== null &&\n options[0].label !== null\n ) {\n return (options as PickerOption[]).map((option) => {\n return {\n label: String(option.label),\n value: String(option.value),\n };\n });\n }\n\n throw new Error(\n 'Picker options must be either an array of strings or array of { \"label\": string; \"value\": string; } objects.'\n );\n}\n\nconst unstyledColor = \"rgba(165, 173, 183, 1)\";\nconst disabledColor = \"rgb(240, 240, 240)\";\nconst errorColor = \"rgba(255, 69, 100, 1)\";\n\nconst Picker: React.FC<PickerProps> = ({\n error,\n options = [],\n onValueChange,\n defaultValue,\n Icon,\n style,\n placeholder,\n value,\n disabled = false,\n theme,\n assistiveText,\n label,\n iconColor = unstyledColor,\n iconSize = 24,\n leftIconMode = \"inset\",\n leftIconName,\n placeholderTextColor = unstyledColor,\n rightIconName,\n type = \"solid\",\n}) => {\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n const [pickerVisible, togglePickerVisible] = React.useReducer(\n (state) => !state,\n false\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const normalizedOptions = normalizeOptions(options);\n\n const pickerOptions = placeholder\n ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]\n : normalizedOptions;\n\n const { viewStyles, textStyles } = extractStyles(style);\n\n const { colors } = theme;\n\n const borders = [\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderColor\",\n \"borderStyle\",\n \"backgroundColor\",\n ];\n\n const borderStyles = {\n ...{\n ...(type === \"solid\"\n ? {\n borderTopLeftRadius: 5,\n borderTopRightRadius: 5,\n borderBottomRightRadius: 5,\n borderBottomLeftRadius: 5,\n borderTopWidth: 1,\n borderRightWidth: 1,\n borderLeftWidth: 1,\n }\n : {}),\n borderBottomWidth: 1,\n borderColor: unstyledColor,\n borderStyle: \"solid\",\n },\n ...pick(viewStyles, borders),\n ...(error ? { borderColor: errorColor } : {}),\n ...(disabled\n ? { borderColor: \"transparent\", backgroundColor: disabledColor }\n : {}),\n };\n\n const margins = [\"marginLeft\", \"marginRight\", \"marginTop\", \"marginBottom\"];\n\n const marginStyles = pick(viewStyles, margins);\n\n const maxHeight =\n viewStyles?.maxHeight && viewStyles.maxHeight !== \"100%\"\n ? viewStyles.maxHeight\n : Dimensions.get(\"window\").height;\n\n const stylesWithoutBordersAndMargins = {\n ...{\n height: 60,\n width: \"100%\",\n },\n ...omit(viewStyles, [...borders, ...margins]),\n ...{ maxHeight },\n };\n\n const selectedLabel =\n internalValue &&\n ((pickerOptions as unknown as PickerOption[]).find(\n (option) => option.value === internalValue\n )?.label ??\n internalValue);\n\n const labelText = label ? (\n <Text\n style={{\n textAlign: textStyles.textAlign,\n color: unstyledColor,\n fontSize: 12,\n paddingBottom: 4,\n }}\n >\n {label}\n </Text>\n ) : null;\n\n const leftIconOutset = leftIconMode === \"outset\";\n\n const leftIcon = leftIconName ? (\n <Icon\n name={leftIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: 4,\n marginLeft: 4,\n }}\n />\n ) : null;\n\n const rightIcon = rightIconName ? (\n <Icon\n name={rightIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: -10,\n marginLeft: 8,\n }}\n />\n ) : null;\n\n const width = stylesWithoutBordersAndMargins?.width ?? undefined;\n\n const textAlign = textStyles?.textAlign;\n\n const paddingLeft =\n leftIconOutset &&\n (!textAlign || textAlign === \"left\" || textAlign === \"justify\")\n ? iconSize + 4\n : 0;\n\n const assistiveTextLabel = assistiveText ? (\n <Text\n style={{\n textAlign,\n width,\n paddingLeft,\n color: unstyledColor,\n fontSize: 12,\n paddingTop: 4,\n }}\n >\n {assistiveText}\n </Text>\n ) : null;\n\n const primaryTextStyle = {\n color: unstyledColor,\n fontSize: 14,\n ...pickBy(textStyles, identity),\n ...(placeholder === internalValue ? { color: placeholderTextColor } : {}),\n ...(disabled ? { color: unstyledColor } : {}),\n };\n\n const handleValueChange = (newValue: string, itemIndex: number) => {\n if (!placeholder || itemIndex > 0) {\n onValueChange?.(newValue, itemIndex);\n }\n setInternalValue(newValue);\n };\n\n return (\n /* marginsContainer */\n <View style={[styles.marginsContainer, marginStyles]}>\n {/* touchableContainer */}\n <Touchable\n disabled={disabled}\n onPress={togglePickerVisible}\n style={styles.touchableContainer}\n >\n {/* outsetContainer */}\n <View\n pointerEvents=\"none\"\n style={[\n styles.outsetContainer,\n stylesWithoutBordersAndMargins,\n // @ts-expect-error ... rejects border-related { key: undefined }\n !leftIconOutset && borderStyles, // set border if Icon is inset\n ]}\n >\n {leftIcon}\n\n {/* insetContainer */}\n <View\n style={[\n styles.insetContainer,\n // @ts-expect-error ... rejects border-related { key: undefined }\n leftIconOutset && borderStyles, // set border if Icon is outset\n ]}\n >\n {/* primaryTextContainer */}\n <View style={styles.primaryTextContainer}>\n {labelText}\n\n <Text style={primaryTextStyle}>\n {String(selectedLabel ?? placeholder)}\n </Text>\n </View>\n\n {rightIcon}\n </View>\n </View>\n {assistiveTextLabel}\n </Touchable>\n\n {/* iosPicker */}\n {Platform.OS === \"ios\" && pickerVisible ? (\n <Portal>\n <View\n style={[\n styles.iosPicker,\n {\n backgroundColor: colors.divider,\n },\n ]}\n >\n <SafeAreaView style={styles.iosSafeArea}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={togglePickerVisible}\n style={styles.iosButton}\n >\n {\"Close\"}\n </Button>\n\n <NativePicker\n style={styles.iosNativePicker}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n ) : null}\n\n {/* nonIosPicker */}\n {Platform.OS !== \"ios\" ? (\n <NativePicker\n enabled={!disabled}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n ) : null}\n </View>\n );\n};\n\nexport default withTheme(Picker);\n\nconst styles = StyleSheet.create({\n marginsContainer: { alignSelf: \"stretch\" },\n touchableContainer: { alignSelf: \"stretch\", alignItems: \"center\" },\n outsetContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n insetContainer: {\n flex: 1,\n height: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingLeft: 12,\n paddingRight: 12,\n },\n primaryTextContainer: { flex: 1 },\n iosPicker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n iosSafeArea: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n iosButton: { alignSelf: \"flex-end\" },\n iosNativePicker: { backgroundColor: \"white\" },\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["Picker.tsx"],"names":["React","View","StyleSheet","Text","Platform","omit","pick","pickBy","identity","SafeAreaView","Picker","NativePicker","withTheme","Portal","Button","Touchable","extractStyles","normalizeOptions","options","length","map","option","label","String","value","Error","unstyledColor","disabledColor","errorColor","error","onValueChange","defaultValue","Icon","style","placeholder","disabled","theme","assistiveText","iconColor","iconSize","leftIconMode","leftIconName","placeholderTextColor","rightIconName","type","internalValue","setInternalValue","useState","pickerVisible","togglePickerVisible","useReducer","state","useEffect","normalizedOptions","pickerOptions","viewStyles","textStyles","colors","borders","borderStyles","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","borderTopWidth","borderRightWidth","borderLeftWidth","borderBottomWidth","borderColor","borderStyle","backgroundColor","margins","marginStyles","platform","OS","stylesWithoutBordersAndMargins","height","width","flex","undefined","selectedLabel","find","labelText","textAlign","color","fontSize","paddingBottom","leftIconOutset","leftIcon","marginRight","marginLeft","rightIcon","paddingLeft","assistiveTextLabel","paddingTop","primaryTextStyle","handleValueChange","newValue","itemIndex","styles","marginsContainer","touchableContainer","outsetContainer","insetContainer","primaryTextContainer","iosPicker","divider","iosSafeArea","iosButton","iosNativePicker","nonIosPicker","create","alignSelf","alignItems","flexDirection","justifyContent","paddingRight","position","bottom","left","right","opacity","top"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,IADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,QAOO,cAPP;AAQA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,MAArB,EAA6BC,QAA7B,QAA6C,QAA7C;AACA,SAASC,YAAT,QAA6B,gCAA7B;AACA,SAASC,MAAM,IAAIC,YAAnB,QAAuC,6BAAvC;AAEA,SAASC,SAAT,QAA0B,eAA1B;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAGA,SAASC,aAAT,QAA8B,iBAA9B;;AA6BA,SAASC,gBAAT,CAA0BC,OAA1B,EAA2E;AACzE,MAAIA,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;AACxB,WAAO,EAAP;AACD;;AAED,MAAI,OAAOD,OAAO,CAAC,CAAD,CAAd,MAAuB,YAAY,QAAnC,CAAJ,EAAkD;AAChD,WAAQA,OAAD,CAAsBE,GAAtB,CAA2BC,MAAD,KAAa;AAC5CC,MAAAA,KAAK,EAAEC,MAAM,CAACF,MAAD,CAD+B;AAE5CG,MAAAA,KAAK,EAAED,MAAM,CAACF,MAAD;AAF+B,KAAb,CAA1B,CAAP;AAID;;AAED,MACE,OAAOH,OAAO,CAAC,CAAD,CAAd,KAAsB,QAAtB,IACAA,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,KAAqB,IADrB,IAEAN,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,KAAqB,IAHvB,EAIE;AACA,WAAQJ,OAAD,CAA4BE,GAA5B,CAAiCC,MAAD,IAAY;AACjD,aAAO;AACLC,QAAAA,KAAK,EAAEC,MAAM,CAAC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K,EAAE;AAHI,GAjCkB;AAsC/B+B,EAAAA,SAAS,EAAE;AACTI,IAAAA,SAAS,EAAE;AADF,GAtCoB;AAyC/BH,EAAAA,eAAe,EAAE;AACfvC,IAAAA,eAAe,EAAE;AADF,GAzCc;AA4C/BwC,EAAAA,YAAY,EAAE;AACZW,IAAAA,OAAO,EAAE,CADG;AAEZJ,IAAAA,QAAQ,EAAE,UAFE;AAGZK,IAAAA,GAAG,EAAE,CAHO;AAIZH,IAAAA,IAAI,EAAE,CAJM;AAKZC,IAAAA,KAAK,EAAE,CALK;AAMZF,IAAAA,MAAM,EAAE,CANI;AAOZzC,IAAAA,KAAK,EAAE;AAPK;AA5CiB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n Text,\n Platform,\n ViewStyle,\n StyleProp,\n} from \"react-native\";\nimport { omit, pick, pickBy, identity } from \"lodash\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport Touchable from \"../Touchable\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { extractStyles } from \"../../utilities\";\n\nexport interface PickerOption {\n value: string;\n label: string;\n}\n\nexport type PickerProps = {\n error?: any;\n placeholder?: string;\n disabled?: boolean;\n style?: StyleProp<ViewStyle> & { height?: number };\n value?: string;\n options: PickerOption[] | string[];\n onValueChange: (value: string, index: number) => void;\n defaultValue?: string;\n assistiveText?: string;\n label?: string;\n iconColor?: string;\n iconSize?: number;\n leftIconMode?: \"inset\" | \"outset\";\n leftIconName?: string;\n placeholderTextColor?: string;\n rightIconName?: string;\n type?: \"solid\" | \"underline\";\n theme: Theme;\n Icon: IconSlot[\"Icon\"];\n};\n\nfunction normalizeOptions(options: PickerProps[\"options\"]): PickerOption[] {\n if (options.length === 0) {\n return [];\n }\n\n if (typeof options[0] === (\"string\" || \"number\")) {\n return (options as string[]).map((option) => ({\n label: String(option),\n value: String(option),\n }));\n }\n\n if (\n typeof options[0] === \"object\" &&\n options[0].value !== null &&\n options[0].label !== null\n ) {\n return (options as PickerOption[]).map((option) => {\n return {\n label: String(option.label),\n value: String(option.value),\n };\n });\n }\n\n throw new Error(\n 'Picker options must be either an array of strings or array of { \"label\": string; \"value\": string; } objects.'\n );\n}\n\nconst unstyledColor = \"rgba(165, 173, 183, 1)\";\nconst disabledColor = \"rgb(240, 240, 240)\";\nconst errorColor = \"rgba(255, 69, 100, 1)\";\n\nconst Picker: React.FC<PickerProps> = ({\n error,\n options = [],\n onValueChange,\n defaultValue,\n Icon,\n style,\n placeholder,\n value,\n disabled = false,\n theme,\n assistiveText,\n label,\n iconColor = unstyledColor,\n iconSize = 24,\n leftIconMode = \"inset\",\n leftIconName,\n placeholderTextColor = unstyledColor,\n rightIconName,\n type = \"underline\",\n}) => {\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n const [pickerVisible, togglePickerVisible] = React.useReducer(\n (state) => !state,\n false\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const normalizedOptions = normalizeOptions(options);\n\n const pickerOptions = placeholder\n ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]\n : normalizedOptions;\n\n const { viewStyles, textStyles } = extractStyles(style);\n\n const { colors } = theme;\n\n const borders = [\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderColor\",\n \"borderStyle\",\n \"backgroundColor\",\n ];\n\n const borderStyles = {\n ...{\n ...(type === \"solid\"\n ? {\n borderTopLeftRadius: 5,\n borderTopRightRadius: 5,\n borderBottomRightRadius: 5,\n borderBottomLeftRadius: 5,\n borderTopWidth: 1,\n borderRightWidth: 1,\n borderLeftWidth: 1,\n }\n : {}),\n borderBottomWidth: 1,\n borderColor: unstyledColor,\n borderStyle: \"solid\",\n },\n ...pick(viewStyles, borders),\n ...(error ? { borderColor: errorColor } : {}),\n ...(disabled\n ? { borderColor: \"transparent\", backgroundColor: disabledColor }\n : {}),\n };\n\n const margins = [\"marginLeft\", \"marginRight\", \"marginTop\", \"marginBottom\"];\n\n const marginStyles = pick(viewStyles, margins);\n\n const platform = Platform.OS;\n\n const stylesWithoutBordersAndMargins = {\n ...{\n height: 60,\n width: \"100%\",\n flex: platform === \"web\" ? undefined : 1,\n },\n ...omit(viewStyles, [...borders, ...margins]),\n };\n\n const selectedLabel =\n internalValue &&\n ((pickerOptions as unknown as PickerOption[]).find(\n (option) => option.value === internalValue\n )?.label ??\n internalValue);\n\n const labelText = label ? (\n <Text\n style={{\n textAlign: textStyles.textAlign,\n color: unstyledColor,\n fontSize: 12,\n paddingBottom: 4,\n }}\n >\n {label}\n </Text>\n ) : null;\n\n const leftIconOutset = leftIconMode === \"outset\";\n\n const leftIcon = leftIconName ? (\n <Icon\n name={leftIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: 4,\n marginLeft: 4,\n }}\n />\n ) : null;\n\n const rightIcon = rightIconName ? (\n <Icon\n name={rightIconName}\n color={disabled ? unstyledColor : iconColor}\n size={iconSize}\n style={{\n marginRight: -10,\n marginLeft: 8,\n }}\n />\n ) : null;\n\n const width = stylesWithoutBordersAndMargins?.width;\n\n const textAlign = textStyles?.textAlign;\n\n const paddingLeft =\n leftIconOutset &&\n (!textAlign || textAlign === \"left\" || textAlign === \"justify\")\n ? iconSize + 4\n : 0;\n\n const assistiveTextLabel = assistiveText ? (\n <Text\n style={{\n textAlign,\n width,\n paddingLeft,\n color: unstyledColor,\n fontSize: 12,\n paddingTop: 4,\n }}\n >\n {assistiveText}\n </Text>\n ) : null;\n\n const primaryTextStyle = {\n color: unstyledColor,\n fontSize: 14,\n ...pickBy(textStyles, identity),\n ...(placeholder === internalValue ? { color: placeholderTextColor } : {}),\n ...(disabled ? { color: unstyledColor } : {}),\n };\n\n const handleValueChange = (newValue: string, itemIndex: number) => {\n if (!placeholder || itemIndex > 0) {\n onValueChange?.(newValue, itemIndex);\n }\n setInternalValue(newValue);\n };\n\n return (\n /* marginsContainer */\n <View style={[styles.marginsContainer, marginStyles]}>\n {/* touchableContainer */}\n <Touchable\n disabled={disabled}\n onPress={togglePickerVisible}\n style={styles.touchableContainer}\n >\n {/* outsetContainer */}\n <View\n pointerEvents=\"none\"\n style={[\n styles.outsetContainer,\n stylesWithoutBordersAndMargins,\n !leftIconOutset ? (borderStyles as PickerProps[\"style\"]) : {},\n ]}\n >\n {leftIcon}\n\n {/* insetContainer */}\n <View\n style={[\n styles.insetContainer,\n leftIconOutset ? (borderStyles as PickerProps[\"style\"]) : {},\n ]}\n >\n {/* primaryTextContainer */}\n <View style={styles.primaryTextContainer}>\n {labelText}\n\n <Text style={primaryTextStyle}>\n {String(selectedLabel ?? placeholder)}\n </Text>\n </View>\n\n {rightIcon}\n </View>\n </View>\n {assistiveTextLabel}\n </Touchable>\n\n {/* iosPicker */}\n {platform === \"ios\" && pickerVisible ? (\n <Portal>\n <View\n style={[\n styles.iosPicker,\n {\n backgroundColor: colors.divider,\n },\n ]}\n >\n <SafeAreaView style={styles.iosSafeArea}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={togglePickerVisible}\n style={styles.iosButton}\n >\n {\"Close\"}\n </Button>\n\n <NativePicker\n style={styles.iosNativePicker}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n ) : null}\n\n {/* nonIosPicker */}\n {platform !== \"ios\" ? (\n <NativePicker\n enabled={!disabled}\n selectedValue={internalValue}\n onValueChange={handleValueChange}\n style={styles.nonIosPicker}\n >\n {(pickerOptions as unknown as PickerOption[]).map((option) => (\n <NativePicker.Item\n label={option.label}\n value={option.value}\n key={option.value}\n />\n ))}\n </NativePicker>\n ) : null}\n </View>\n );\n};\n\nexport default withTheme(Picker);\n\nconst styles = StyleSheet.create({\n marginsContainer: {\n alignSelf: \"stretch\",\n },\n touchableContainer: {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n },\n outsetContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n insetContainer: {\n flex: 1,\n height: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingLeft: 12,\n paddingRight: 12,\n },\n primaryTextContainer: {\n flex: 1,\n },\n iosPicker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n iosSafeArea: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n iosButton: {\n alignSelf: \"flex-end\",\n },\n iosNativePicker: {\n backgroundColor: \"white\",\n },\n nonIosPicker: {\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AudioPlayer.
|
|
1
|
+
{"version":3,"sources":["AudioPlayer.ts"],"names":["GROUPS","COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","SEED_DATA","name","tag","description","category","media","layout","props","source","group","data","label","editable","required","defaultValue","formType","sourceUrl","propType","OBJECT"],"mappings":"AAAA,SACEA,MADF,EAEEC,eAFF,EAGEC,UAHF,EAIEC,UAJF,QAKO,iBALP;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,cADiB;AAEvBC,EAAAA,GAAG,EAAE,aAFkB;AAGvBC,EAAAA,WAAW,EAAE,2CAHU;AAIvBC,EAAAA,QAAQ,EAAEP,eAAe,CAACQ,KAJH;AAKvBC,EAAAA,MAAM,EAAE,EALe;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAEb,MAAM,CAACc,IADR;AAENC,MAAAA,KAAK,EAAE,QAFD;AAGNR,MAAAA,WAAW,EAAE,oCAHP;AAINS,MAAAA,QAAQ,EAAE,IAJJ;AAKNC,MAAAA,QAAQ,EAAE,IALJ;AAMNC,MAAAA,YAAY,EACV,+DAPI;AAQNC,MAAAA,QAAQ,EAAEjB,UAAU,CAACkB,SARf;AASNC,MAAAA,QAAQ,EAAElB,UAAU,CAACmB;AATf;AADH;AANgB,CAAlB","sourcesContent":["import {\n GROUPS,\n COMPONENT_TYPES,\n FORM_TYPES,\n PROP_TYPES,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Audio Player\",\n tag: \"AudioPlayer\",\n description: \"Given a source URL, plays sounds & audio!\",\n category: COMPONENT_TYPES.media,\n layout: {},\n props: {\n source: {\n group: GROUPS.data,\n label: \"Source\",\n description: \"The source URL for the audio file.\",\n editable: true,\n required: true,\n defaultValue:\n \"https://static.draftbit.com/audio/intro-to-draftbit-audio.mp3\",\n formType: FORM_TYPES.sourceUrl,\n propType: PROP_TYPES.OBJECT,\n },\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "44.1.9-
|
|
3
|
+
"version": "44.1.9-ce3e7b.1+ce3e7bba",
|
|
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": "
|
|
82
|
+
"gitHead": "ce3e7bbaa979deaf030f25507d6375c1c3f18442"
|
|
83
83
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform,
|
|
2
|
+
import { View, StyleSheet, Text, Platform, } from "react-native";
|
|
3
3
|
import { omit, pick, pickBy, identity } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -33,7 +33,7 @@ function normalizeOptions(options) {
|
|
|
33
33
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
34
34
|
const disabledColor = "rgb(240, 240, 240)";
|
|
35
35
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
36
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, theme, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "
|
|
36
|
+
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, theme, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "underline", }) => {
|
|
37
37
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
38
38
|
const [pickerVisible, togglePickerVisible] = React.useReducer((state) => !state, false);
|
|
39
39
|
React.useEffect(() => {
|
|
@@ -91,16 +91,14 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
91
91
|
};
|
|
92
92
|
const margins = ["marginLeft", "marginRight", "marginTop", "marginBottom"];
|
|
93
93
|
const marginStyles = pick(viewStyles, margins);
|
|
94
|
-
const
|
|
95
|
-
? viewStyles.maxHeight
|
|
96
|
-
: Dimensions.get("window").height;
|
|
94
|
+
const platform = Platform.OS;
|
|
97
95
|
const stylesWithoutBordersAndMargins = {
|
|
98
96
|
...{
|
|
99
97
|
height: 60,
|
|
100
98
|
width: "100%",
|
|
99
|
+
flex: platform === "web" ? undefined : 1,
|
|
101
100
|
},
|
|
102
101
|
...omit(viewStyles, [...borders, ...margins]),
|
|
103
|
-
...{ maxHeight },
|
|
104
102
|
};
|
|
105
103
|
const selectedLabel = internalValue &&
|
|
106
104
|
(pickerOptions.find((option) => option.value === internalValue)?.label ??
|
|
@@ -120,7 +118,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
120
118
|
marginRight: -10,
|
|
121
119
|
marginLeft: 8,
|
|
122
120
|
} })) : null;
|
|
123
|
-
const width = stylesWithoutBordersAndMargins?.width
|
|
121
|
+
const width = stylesWithoutBordersAndMargins?.width;
|
|
124
122
|
const textAlign = textStyles?.textAlign;
|
|
125
123
|
const paddingLeft = leftIconOutset &&
|
|
126
124
|
(!textAlign || textAlign === "left" || textAlign === "justify")
|
|
@@ -154,21 +152,19 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
154
152
|
React.createElement(View, { pointerEvents: "none", style: [
|
|
155
153
|
styles.outsetContainer,
|
|
156
154
|
stylesWithoutBordersAndMargins,
|
|
157
|
-
|
|
158
|
-
!leftIconOutset && borderStyles, // set border if Icon is inset
|
|
155
|
+
!leftIconOutset ? borderStyles : {},
|
|
159
156
|
] },
|
|
160
157
|
leftIcon,
|
|
161
158
|
React.createElement(View, { style: [
|
|
162
159
|
styles.insetContainer,
|
|
163
|
-
|
|
164
|
-
leftIconOutset && borderStyles, // set border if Icon is outset
|
|
160
|
+
leftIconOutset ? borderStyles : {},
|
|
165
161
|
] },
|
|
166
162
|
React.createElement(View, { style: styles.primaryTextContainer },
|
|
167
163
|
labelText,
|
|
168
164
|
React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel ?? placeholder))),
|
|
169
165
|
rightIcon)),
|
|
170
166
|
assistiveTextLabel),
|
|
171
|
-
|
|
167
|
+
platform === "ios" && pickerVisible ? (React.createElement(Portal, null,
|
|
172
168
|
React.createElement(View, { style: [
|
|
173
169
|
styles.iosPicker,
|
|
174
170
|
{
|
|
@@ -178,12 +174,17 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
178
174
|
React.createElement(SafeAreaView, { style: styles.iosSafeArea },
|
|
179
175
|
React.createElement(Button, { Icon: Icon, type: "text", onPress: togglePickerVisible, style: styles.iosButton }, "Close"),
|
|
180
176
|
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
181
|
-
|
|
177
|
+
platform !== "ios" ? (React.createElement(NativePicker, { enabled: !disabled, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
182
178
|
};
|
|
183
179
|
export default withTheme(Picker);
|
|
184
180
|
const styles = StyleSheet.create({
|
|
185
|
-
marginsContainer: {
|
|
186
|
-
|
|
181
|
+
marginsContainer: {
|
|
182
|
+
alignSelf: "stretch",
|
|
183
|
+
},
|
|
184
|
+
touchableContainer: {
|
|
185
|
+
alignSelf: "stretch",
|
|
186
|
+
alignItems: "center",
|
|
187
|
+
},
|
|
187
188
|
outsetContainer: {
|
|
188
189
|
flexDirection: "row",
|
|
189
190
|
alignItems: "center",
|
|
@@ -198,7 +199,9 @@ const styles = StyleSheet.create({
|
|
|
198
199
|
paddingLeft: 12,
|
|
199
200
|
paddingRight: 12,
|
|
200
201
|
},
|
|
201
|
-
primaryTextContainer: {
|
|
202
|
+
primaryTextContainer: {
|
|
203
|
+
flex: 1,
|
|
204
|
+
},
|
|
202
205
|
iosPicker: {
|
|
203
206
|
position: "absolute",
|
|
204
207
|
bottom: 0,
|
|
@@ -212,8 +215,12 @@ const styles = StyleSheet.create({
|
|
|
212
215
|
flexDirection: "column",
|
|
213
216
|
width: "100%",
|
|
214
217
|
},
|
|
215
|
-
iosButton: {
|
|
216
|
-
|
|
218
|
+
iosButton: {
|
|
219
|
+
alignSelf: "flex-end",
|
|
220
|
+
},
|
|
221
|
+
iosNativePicker: {
|
|
222
|
+
backgroundColor: "white",
|
|
223
|
+
},
|
|
217
224
|
nonIosPicker: {
|
|
218
225
|
opacity: 0,
|
|
219
226
|
position: "absolute",
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
ViewStyle,
|
|
8
8
|
StyleProp,
|
|
9
|
-
Dimensions,
|
|
10
9
|
} from "react-native";
|
|
11
10
|
import { omit, pick, pickBy, identity } from "lodash";
|
|
12
11
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -100,7 +99,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
100
99
|
leftIconName,
|
|
101
100
|
placeholderTextColor = unstyledColor,
|
|
102
101
|
rightIconName,
|
|
103
|
-
type = "
|
|
102
|
+
type = "underline",
|
|
104
103
|
}) => {
|
|
105
104
|
const [internalValue, setInternalValue] = React.useState<string | undefined>(
|
|
106
105
|
value || defaultValue
|
|
@@ -176,18 +175,15 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
176
175
|
|
|
177
176
|
const marginStyles = pick(viewStyles, margins);
|
|
178
177
|
|
|
179
|
-
const
|
|
180
|
-
viewStyles?.maxHeight && viewStyles.maxHeight !== "100%"
|
|
181
|
-
? viewStyles.maxHeight
|
|
182
|
-
: Dimensions.get("window").height;
|
|
178
|
+
const platform = Platform.OS;
|
|
183
179
|
|
|
184
180
|
const stylesWithoutBordersAndMargins = {
|
|
185
181
|
...{
|
|
186
182
|
height: 60,
|
|
187
183
|
width: "100%",
|
|
184
|
+
flex: platform === "web" ? undefined : 1,
|
|
188
185
|
},
|
|
189
186
|
...omit(viewStyles, [...borders, ...margins]),
|
|
190
|
-
...{ maxHeight },
|
|
191
187
|
};
|
|
192
188
|
|
|
193
189
|
const selectedLabel =
|
|
@@ -236,7 +232,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
236
232
|
/>
|
|
237
233
|
) : null;
|
|
238
234
|
|
|
239
|
-
const width = stylesWithoutBordersAndMargins?.width
|
|
235
|
+
const width = stylesWithoutBordersAndMargins?.width;
|
|
240
236
|
|
|
241
237
|
const textAlign = textStyles?.textAlign;
|
|
242
238
|
|
|
@@ -291,8 +287,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
291
287
|
style={[
|
|
292
288
|
styles.outsetContainer,
|
|
293
289
|
stylesWithoutBordersAndMargins,
|
|
294
|
-
|
|
295
|
-
!leftIconOutset && borderStyles, // set border if Icon is inset
|
|
290
|
+
!leftIconOutset ? (borderStyles as PickerProps["style"]) : {},
|
|
296
291
|
]}
|
|
297
292
|
>
|
|
298
293
|
{leftIcon}
|
|
@@ -301,8 +296,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
301
296
|
<View
|
|
302
297
|
style={[
|
|
303
298
|
styles.insetContainer,
|
|
304
|
-
|
|
305
|
-
leftIconOutset && borderStyles, // set border if Icon is outset
|
|
299
|
+
leftIconOutset ? (borderStyles as PickerProps["style"]) : {},
|
|
306
300
|
]}
|
|
307
301
|
>
|
|
308
302
|
{/* primaryTextContainer */}
|
|
@@ -321,7 +315,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
321
315
|
</Touchable>
|
|
322
316
|
|
|
323
317
|
{/* iosPicker */}
|
|
324
|
-
{
|
|
318
|
+
{platform === "ios" && pickerVisible ? (
|
|
325
319
|
<Portal>
|
|
326
320
|
<View
|
|
327
321
|
style={[
|
|
@@ -360,7 +354,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
360
354
|
) : null}
|
|
361
355
|
|
|
362
356
|
{/* nonIosPicker */}
|
|
363
|
-
{
|
|
357
|
+
{platform !== "ios" ? (
|
|
364
358
|
<NativePicker
|
|
365
359
|
enabled={!disabled}
|
|
366
360
|
selectedValue={internalValue}
|
|
@@ -383,8 +377,13 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
383
377
|
export default withTheme(Picker);
|
|
384
378
|
|
|
385
379
|
const styles = StyleSheet.create({
|
|
386
|
-
marginsContainer: {
|
|
387
|
-
|
|
380
|
+
marginsContainer: {
|
|
381
|
+
alignSelf: "stretch",
|
|
382
|
+
},
|
|
383
|
+
touchableContainer: {
|
|
384
|
+
alignSelf: "stretch",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
},
|
|
388
387
|
outsetContainer: {
|
|
389
388
|
flexDirection: "row",
|
|
390
389
|
alignItems: "center",
|
|
@@ -399,7 +398,9 @@ const styles = StyleSheet.create({
|
|
|
399
398
|
paddingLeft: 12,
|
|
400
399
|
paddingRight: 12,
|
|
401
400
|
},
|
|
402
|
-
primaryTextContainer: {
|
|
401
|
+
primaryTextContainer: {
|
|
402
|
+
flex: 1,
|
|
403
|
+
},
|
|
403
404
|
iosPicker: {
|
|
404
405
|
position: "absolute",
|
|
405
406
|
bottom: 0,
|
|
@@ -413,8 +414,12 @@ const styles = StyleSheet.create({
|
|
|
413
414
|
flexDirection: "column",
|
|
414
415
|
width: "100%",
|
|
415
416
|
},
|
|
416
|
-
iosButton: {
|
|
417
|
-
|
|
417
|
+
iosButton: {
|
|
418
|
+
alignSelf: "flex-end",
|
|
419
|
+
},
|
|
420
|
+
iosNativePicker: {
|
|
421
|
+
backgroundColor: "white",
|
|
422
|
+
},
|
|
418
423
|
nonIosPicker: {
|
|
419
424
|
opacity: 0,
|
|
420
425
|
position: "absolute",
|