@draftbit/core 46.1.4-e6469c.0 → 46.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +4 -20
- package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Justification.js +0 -3
- package/lib/commonjs/components/Picker/PickerComponent.android.js +135 -0
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +161 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js +136 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerTypes.js +6 -0
- package/lib/commonjs/components/Picker/PickerTypes.js.map +1 -0
- package/lib/commonjs/components/ResizeMode.js +0 -3
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/module/components/Justification.js +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +112 -0
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.ios.js +135 -0
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.web.js +113 -0
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/module/components/Picker/PickerTypes.js +2 -0
- package/lib/module/components/Picker/PickerTypes.js.map +1 -0
- package/lib/module/components/ResizeMode.js +1 -1
- package/lib/module/components/Touchable.js +2 -16
- package/lib/module/components/Touchable.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +7 -0
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerTypes.d.ts +18 -0
- package/package.json +3 -3
- package/src/components/Picker/PickerComponent.android.tsx +116 -0
- package/src/components/Picker/PickerComponent.ios.tsx +142 -0
- package/src/components/Picker/PickerComponent.web.tsx +117 -0
- package/src/components/Picker/PickerTypes.ts +18 -0
- package/src/Provider.js +0 -9
- package/src/components/Accordion/AccordionGroup.js +0 -44
- package/src/components/Accordion/AccordionItem.js +0 -32
- package/src/components/Accordion/index.js +0 -2
- package/src/components/ActionSheet/ActionSheet.js +0 -45
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
- package/src/components/ActionSheet/ActionSheetItem.js +0 -30
- package/src/components/ActionSheet/index.js +0 -3
- package/src/components/AnimatedCircularProgress.js +0 -43
- package/src/components/AspectRatio.js +0 -18
- package/src/components/AvatarEdit.js +0 -30
- package/src/components/Banner.js +0 -109
- package/src/components/Button.js +0 -112
- package/src/components/Card.js +0 -57
- package/src/components/CardBlock.js +0 -54
- package/src/components/CardContainer.js +0 -69
- package/src/components/CardContainerRating.js +0 -79
- package/src/components/CardContainerShortImage.js +0 -33
- package/src/components/CardInline.js +0 -36
- package/src/components/Carousel.js +0 -66
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/CheckboxGroup.js +0 -21
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxRow.js +0 -78
- package/src/components/Checkbox/context.js +0 -14
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/CircleImage.js +0 -8
- package/src/components/CircularProgress.js +0 -78
- package/src/components/Config.js +0 -63
- package/src/components/Container.js +0 -43
- package/src/components/DatePicker/DatePicker.js +0 -368
- package/src/components/DatePicker/DatePickerComponent.js +0 -13
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
- package/src/components/DatePicker/DatePickerComponentType.js +0 -1
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedFAB.js +0 -115
- package/src/components/Divider.js +0 -13
- package/src/components/Elevation.js +0 -20
- package/src/components/FAB.js +0 -46
- package/src/components/FieldSearchBarFull.js +0 -53
- package/src/components/FormRow.js +0 -19
- package/src/components/Header.js +0 -44
- package/src/components/HeaderLarge.js +0 -7
- package/src/components/HeaderMedium.js +0 -7
- package/src/components/HeaderOverline.js +0 -7
- package/src/components/IconButton.js +0 -35
- package/src/components/Image.js +0 -47
- package/src/components/Justification.js +0 -1
- package/src/components/Layout.js +0 -50
- package/src/components/NumberInput.js +0 -49
- package/src/components/Picker/Picker.js +0 -267
- package/src/components/Portal/Portal.js +0 -35
- package/src/components/Portal/PortalConsumer.js +0 -28
- package/src/components/Portal/PortalHost.js +0 -105
- package/src/components/Portal/PortalManager.js +0 -29
- package/src/components/ProgressBar.js +0 -118
- package/src/components/ProgressCircle.js +0 -13
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/RadioButton/RadioButton.js +0 -17
- package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
- package/src/components/RadioButton/RadioButtonGroup.js +0 -43
- package/src/components/RadioButton/RadioButtonRow.js +0 -76
- package/src/components/RadioButton/context.js +0 -14
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/ResizeMode.js +0 -1
- package/src/components/Row.js +0 -48
- package/src/components/RowBodyIcon.js +0 -8
- package/src/components/RowHeadlineImageCaption.js +0 -12
- package/src/components/RowHeadlineImageIcon.js +0 -14
- package/src/components/ScreenContainer.js +0 -34
- package/src/components/Slider.js +0 -63
- package/src/components/StarRating.js +0 -50
- package/src/components/StepIndicator.js +0 -346
- package/src/components/Stepper.js +0 -39
- package/src/components/Surface.js +0 -32
- package/src/components/Swiper/Swiper.js +0 -29
- package/src/components/Swiper/SwiperItem.js +0 -9
- package/src/components/Swiper/index.js +0 -2
- package/src/components/Switch.js +0 -56
- package/src/components/Text.js +0 -28
- package/src/components/TextField.js +0 -420
- package/src/components/ToggleButton.js +0 -39
- package/src/components/Touchable.js +0 -12
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Typography.js +0 -36
- package/src/components/useAuthState.js +0 -31
- package/src/constants.js +0 -10
- package/src/hooks.js +0 -12
- package/src/index.js +0 -52
- package/src/interfaces/Icon.js +0 -8
- package/src/mappings/Accordion.js +0 -41
- package/src/mappings/AccordionItem.js +0 -16
- package/src/mappings/ActionSheet.js +0 -13
- package/src/mappings/ActionSheetCancel.js +0 -19
- package/src/mappings/ActionSheetItem.js +0 -23
- package/src/mappings/ActivityIndicator.js +0 -53
- package/src/mappings/AudioPlayer.js +0 -20
- package/src/mappings/AvatarEdit.js +0 -37
- package/src/mappings/Banner.js +0 -32
- package/src/mappings/BlurView.js +0 -41
- package/src/mappings/Button.js +0 -56
- package/src/mappings/Card.js +0 -52
- package/src/mappings/CardBlock.js +0 -122
- package/src/mappings/CardContainer.js +0 -102
- package/src/mappings/CardContainerRating.js +0 -124
- package/src/mappings/CardContainerShortImage.js +0 -118
- package/src/mappings/CardInline.js +0 -51
- package/src/mappings/Carousel.js +0 -18
- package/src/mappings/Checkbox.js +0 -45
- package/src/mappings/CheckboxGroup.js +0 -25
- package/src/mappings/CheckboxRow.js +0 -56
- package/src/mappings/CircleImage.js +0 -24
- package/src/mappings/Container.js +0 -29
- package/src/mappings/CustomCode.js +0 -8
- package/src/mappings/DatePicker.js +0 -147
- package/src/mappings/Divider.js +0 -26
- package/src/mappings/FAB.js +0 -36
- package/src/mappings/Fetch.js +0 -12
- package/src/mappings/FieldSearchBarFull.js +0 -49
- package/src/mappings/FlatList.js +0 -19
- package/src/mappings/HeaderLarge.js +0 -28
- package/src/mappings/HeaderMedium.js +0 -54
- package/src/mappings/HeaderOverline.js +0 -54
- package/src/mappings/Icon.js +0 -25
- package/src/mappings/IconButton.js +0 -30
- package/src/mappings/Image.js +0 -15
- package/src/mappings/ImageBackground.js +0 -28
- package/src/mappings/KeyboardAvoidingView.js +0 -40
- package/src/mappings/KeyboardAwareScrollView.js +0 -49
- package/src/mappings/Layout.js +0 -195
- package/src/mappings/LinearGradient.js +0 -77
- package/src/mappings/MapCallout.js +0 -21
- package/src/mappings/MapMarker.js +0 -47
- package/src/mappings/MapView.js +0 -138
- package/src/mappings/Modal.js +0 -41
- package/src/mappings/Picker.js +0 -139
- package/src/mappings/ProgressBar.js +0 -100
- package/src/mappings/ProgressCircle.js +0 -108
- package/src/mappings/ProgressIndicator.js +0 -180
- package/src/mappings/RadioButton.js +0 -50
- package/src/mappings/RadioButtonGroup.js +0 -16
- package/src/mappings/RadioButtonRow.js +0 -37
- package/src/mappings/RowBodyIcon.js +0 -75
- package/src/mappings/RowHeadlineImageCaption.js +0 -167
- package/src/mappings/RowHeadlineImageIcon.js +0 -99
- package/src/mappings/SafeAreaView.js +0 -33
- package/src/mappings/ScrollView.js +0 -30
- package/src/mappings/Slider.js +0 -59
- package/src/mappings/StarRating.js +0 -42
- package/src/mappings/Stepper.js +0 -28
- package/src/mappings/Surface.js +0 -13
- package/src/mappings/Swiper.js +0 -60
- package/src/mappings/SwiperItem.js +0 -8
- package/src/mappings/Switch.js +0 -75
- package/src/mappings/Text.js +0 -232
- package/src/mappings/TextArea.js +0 -52
- package/src/mappings/TextField.js +0 -158
- package/src/mappings/TextInput.js +0 -208
- package/src/mappings/ToggleButton.js +0 -45
- package/src/mappings/Touchable.js +0 -12
- package/src/mappings/Video.js +0 -74
- package/src/mappings/View.js +0 -206
- package/src/mappings/WebView.js +0 -18
- package/src/styles/DarkTheme.js +0 -26
- package/src/styles/DefaultTheme.js +0 -111
- package/src/styles/fonts.js +0 -62
- package/src/styles/overlay.js +0 -60
- package/src/styles/shadow.js +0 -51
- package/src/theming.js +0 -3
- package/src/utilities.js +0 -102
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.
|
|
1
|
+
{"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["export { default as ActionSheet } from \"./ActionSheet\";\nexport { default as ActionSheetItem } from \"./ActionSheetItem\";\nexport { default as ActionSheetCancel } from \"./ActionSheetCancel\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA"}
|
|
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
+
|
|
28
30
|
const Button = _ref => {
|
|
29
31
|
let {
|
|
30
32
|
Icon,
|
|
@@ -126,7 +128,7 @@ const Button = _ref => {
|
|
|
126
128
|
alignSelf: "stretch",
|
|
127
129
|
...margins
|
|
128
130
|
}
|
|
129
|
-
}, /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
131
|
+
}, /*#__PURE__*/React.createElement(_Touchable.default, _extends({}, rest, {
|
|
130
132
|
onPress: onPress,
|
|
131
133
|
accessibilityState: {
|
|
132
134
|
disabled
|
|
@@ -134,7 +136,7 @@ const Button = _ref => {
|
|
|
134
136
|
accessibilityRole: "button",
|
|
135
137
|
disabled: disabled || loading,
|
|
136
138
|
style: [styles.button, buttonStyle, innerStyles]
|
|
137
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
139
|
+
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
138
140
|
style: styles.content
|
|
139
141
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
140
142
|
style: iconStyle
|
|
@@ -169,23 +171,5 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
169
171
|
|
|
170
172
|
var _default = (0, _theming.withTheme)(Button);
|
|
171
173
|
|
|
172
|
-
exports.default = _default;
|
|
173
|
-
//# sourceMappingURL=DeprecatedButton.js.mapt.create({
|
|
174
|
-
button: {
|
|
175
|
-
minWidth: 64,
|
|
176
|
-
borderStyle: "solid"
|
|
177
|
-
},
|
|
178
|
-
content: {
|
|
179
|
-
flexDirection: "row",
|
|
180
|
-
alignItems: "center",
|
|
181
|
-
justifyContent: "center"
|
|
182
|
-
},
|
|
183
|
-
icon: {
|
|
184
|
-
width: _Config.default.buttonIconSize
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
var _default = (0, _theming.withTheme)(Button);
|
|
189
|
-
|
|
190
174
|
exports.default = _default;
|
|
191
175
|
//# sourceMappingURL=DeprecatedButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Icon","icon","disabled","type","loading","labelColor","color","colorOverride","children","onPress","elevation","style","theme","colors","disabledOpacity","roundness","typography","rest","backgroundColor","borderColor","textColor","borderWidth","buttonColor","primary","surface","alpha","rgb","string","StyleSheet","hairlineWidth","buttonStyle","borderRadius","textStyle","textAlign","marginVertical","marginHorizontal","iconStyle","styles","marginLeft","marginRight","width","Config","buttonIconSize","margin","marginEnd","marginTop","marginBottom","innerStyles","flatten","margins","
|
|
1
|
+
{"version":3,"names":["Button","Icon","icon","disabled","type","loading","labelColor","color","colorOverride","children","onPress","elevation","style","theme","colors","disabledOpacity","roundness","typography","rest","backgroundColor","borderColor","textColor","borderWidth","buttonColor","primary","surface","alpha","rgb","string","StyleSheet","hairlineWidth","buttonStyle","borderRadius","textStyle","textAlign","marginVertical","marginHorizontal","iconStyle","styles","marginLeft","marginRight","width","Config","buttonIconSize","margin","marginEnd","marginTop","marginBottom","innerStyles","flatten","margins","alignSelf","button","content","create","minWidth","borderStyle","flexDirection","alignItems","justifyContent","withTheme"],"sources":["DeprecatedButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n ActivityIndicator,\n View,\n Text,\n StyleSheet,\n TouchableHighlightProps,\n StyleProp,\n ViewStyle,\n TextStyle,\n} from \"react-native\";\nimport color from \"color\";\nimport Config from \"./Config\";\nimport Touchable from \"./Touchable\";\nimport Elevation from \"./Elevation\";\nimport { withTheme } from \"../theming\";\n\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\n/**\n * A button is component that the user can press to trigger an action.\n *\n * <div class=\"screenshots\">\n * <figure>\n * <img src=\"screenshots/button-1.png\" />\n * <figcaption>Text button</figcaption>\n * </figure>\n * <figure>\n * <img src=\"screenshots/button-2.png\" />\n * <figcaption>Outlined button</figcaption>\n * </figure>\n * <figure>\n * <img src=\"screenshots/button-3.png\" />\n * <figcaption>Contained button</figcaption>\n * </figure>\n * </div>\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Button } from '@draftbit/ui';\n *\n * const MyComponent = () => (\n * <Button icon=\"add-a-photo\" type=\"solid\" onPress={() => console.log('Pressed')}>\n * Press me\n * </Button>\n * );\n *\n * export default MyComponent;\n * ```\n */\n\ntype Props = {\n disabled?: boolean;\n type?: \"solid\" | \"outline\" | \"text\";\n loading?: boolean;\n icon?: string;\n labelColor?: string;\n color?: string;\n children?: React.ReactNode;\n onPress: () => void;\n elevation?: number;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & TouchableHighlightProps &\n IconSlot;\n\nconst Button: React.FC<React.PropsWithChildren<Props>> = ({\n Icon,\n icon,\n disabled = false,\n type = \"solid\",\n loading = false,\n labelColor,\n color: colorOverride,\n children,\n onPress,\n elevation = 0,\n style,\n theme: { colors, disabledOpacity, roundness, typography },\n ...rest\n}) => {\n let backgroundColor, borderColor, textColor, borderWidth;\n const buttonColor = colorOverride || colors.primary;\n\n if (type === \"solid\") {\n backgroundColor = buttonColor;\n\n if (disabled) {\n textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();\n } else {\n textColor = labelColor || colors.surface;\n }\n } else {\n backgroundColor = \"transparent\";\n\n if (disabled) {\n textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n } else {\n textColor = labelColor || buttonColor;\n }\n }\n\n if (type === \"outline\") {\n if (disabled) {\n borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n } else {\n borderColor = buttonColor;\n }\n borderWidth = StyleSheet.hairlineWidth;\n } else {\n borderColor = \"transparent\";\n borderWidth = 0;\n }\n\n const buttonStyle = {\n backgroundColor,\n borderColor,\n borderWidth,\n borderRadius: roundness,\n };\n\n const textStyle: StyleProp<TextStyle> = {\n textAlign: \"center\",\n color: textColor,\n marginVertical: 16,\n marginHorizontal: 16,\n };\n\n const iconStyle = [\n styles.icon,\n {\n marginLeft: 16,\n marginRight: -8,\n width: Config.buttonIconSize,\n },\n ];\n\n const {\n margin,\n marginEnd,\n marginTop,\n marginLeft,\n marginRight,\n marginBottom,\n marginHorizontal,\n marginVertical,\n ...innerStyles\n } = StyleSheet.flatten(style || {});\n\n const margins = {\n margin,\n marginEnd,\n marginTop,\n marginLeft,\n marginRight,\n marginBottom,\n marginHorizontal,\n marginVertical,\n };\n\n return (\n <Elevation style={{ elevation, alignSelf: \"stretch\", ...margins }}>\n <Touchable\n {...rest}\n onPress={onPress}\n accessibilityState={{ disabled }}\n accessibilityRole=\"button\"\n disabled={disabled || loading}\n style={[styles.button, buttonStyle, innerStyles]}\n >\n <View style={styles.content}>\n {icon && loading !== true ? (\n <View style={iconStyle}>\n <Icon\n name={icon}\n size={Config.buttonIconSize}\n color={textColor}\n />\n </View>\n ) : null}\n {loading ? (\n <ActivityIndicator\n size=\"small\"\n color={textColor}\n style={iconStyle}\n />\n ) : null}\n <Text numberOfLines={1} style={[textStyle, typography.button]}>\n {children}\n </Text>\n </View>\n </Touchable>\n </Elevation>\n );\n};\n\nconst styles = StyleSheet.create({\n button: {\n minWidth: 64,\n borderStyle: \"solid\",\n },\n content: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n icon: {\n width: Config.buttonIconSize,\n },\n});\n\nexport default withTheme(Button);\n"],"mappings":";;;;;;;AAAA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAqDA,MAAMA,MAAgD,GAAG,QAcnD;EAAA,IAdoD;IACxDC,IADwD;IAExDC,IAFwD;IAGxDC,QAAQ,GAAG,KAH6C;IAIxDC,IAAI,GAAG,OAJiD;IAKxDC,OAAO,GAAG,KAL8C;IAMxDC,UANwD;IAOxDC,KAAK,EAAEC,aAPiD;IAQxDC,QARwD;IASxDC,OATwD;IAUxDC,SAAS,GAAG,CAV4C;IAWxDC,KAXwD;IAYxDC,KAAK,EAAE;MAAEC,MAAF;MAAUC,eAAV;MAA2BC,SAA3B;MAAsCC;IAAtC,CAZiD;IAaxD,GAAGC;EAbqD,CAcpD;EACJ,IAAIC,eAAJ,EAAqBC,WAArB,EAAkCC,SAAlC,EAA6CC,WAA7C;EACA,MAAMC,WAAW,GAAGf,aAAa,IAAIM,MAAM,CAACU,OAA5C;;EAEA,IAAIpB,IAAI,KAAK,OAAb,EAAsB;IACpBe,eAAe,GAAGI,WAAlB;;IAEA,IAAIpB,QAAJ,EAAc;MACZkB,SAAS,GAAG,IAAAd,cAAA,EAAMO,MAAM,CAACW,OAAb,EAAsBC,KAAtB,CAA4BX,eAA5B,EAA6CY,GAA7C,GAAmDC,MAAnD,EAAZ;IACD,CAFD,MAEO;MACLP,SAAS,GAAGf,UAAU,IAAIQ,MAAM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KADR;IAEPC,UAAU,EAAE,QAFL;IAGPC,cAAc,EAAE;EAHT,CALsB;EAU/BzD,IAAI,EAAE;IACJuC,KAAK,EAAEC,eAAA,CAAOC;EADV;AAVyB,CAAlB,CAAf;;eAee,IAAAiB,kBAAA,EAAU5D,MAAV,C"}
|
|
@@ -13,6 +13,8 @@ var _Touchable = _interopRequireDefault(require("./Touchable"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
|
|
16
18
|
const getWidth = numColumns => {
|
|
17
19
|
switch (numColumns) {
|
|
18
20
|
case 1:
|
|
@@ -35,20 +37,6 @@ const Card = _ref => {
|
|
|
35
37
|
...rest
|
|
36
38
|
} = _ref;
|
|
37
39
|
const width = getWidth(numColumns);
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(_Touchable.default, {
|
|
39
|
-
disabled: !onPress,
|
|
40
|
-
onPress: onPress,
|
|
41
|
-
style: [style, {
|
|
42
|
-
width
|
|
43
|
-
}],
|
|
44
|
-
...rest
|
|
45
|
-
}, children);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var _default = (0, _theming.withTheme)(Card);
|
|
49
|
-
|
|
50
|
-
exports.default = _default;
|
|
51
|
-
//# sourceMappingURL=DeprecatedCardWrapper.js.map = getWidth(numColumns);
|
|
52
40
|
return /*#__PURE__*/_react.default.createElement(_Touchable.default, _extends({
|
|
53
41
|
disabled: !onPress,
|
|
54
42
|
onPress: onPress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getWidth","numColumns","Card","children","onPress","style","rest","width","
|
|
1
|
+
{"version":3,"names":["getWidth","numColumns","Card","children","onPress","style","rest","width","withTheme"],"sources":["DeprecatedCardWrapper.tsx"],"sourcesContent":["import React from \"react\";\nimport { withTheme } from \"../theming\";\nimport Touchable from \"./Touchable\";\nimport { StyleProp, ViewStyle } from \"react-native\";\nimport theme from \"../styles/DefaultTheme\";\n\ntype Props = {\n numColumns?: number;\n children?: React.ReactNode;\n onPress?: () => void;\n style?: StyleProp<ViewStyle>;\n theme: typeof theme;\n};\n\nconst getWidth = (numColumns: number) => {\n switch (numColumns) {\n case 1:\n return \"33%\";\n case 2:\n return \"50%\";\n default:\n return \"100%\";\n }\n};\n\nconst Card: React.FC<React.PropsWithChildren<Props>> = ({\n numColumns = 3,\n children,\n onPress,\n style,\n ...rest\n}) => {\n const width = getWidth(numColumns);\n return (\n <Touchable\n disabled={!onPress}\n onPress={onPress}\n style={[style, { width }]}\n {...rest}\n >\n {children}\n </Touchable>\n );\n};\n\nexport default withTheme(Card);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAYA,MAAMA,QAAQ,GAAIC,UAAD,IAAwB;EACvC,QAAQA,UAAR;IACE,KAAK,CAAL;MACE,OAAO,KAAP;;IACF,KAAK,CAAL;MACE,OAAO,KAAP;;IACF;MACE,OAAO,MAAP;EANJ;AAQD,CATD;;AAWA,MAAMC,IAA8C,GAAG,QAMjD;EAAA,IANkD;IACtDD,UAAU,GAAG,CADyC;IAEtDE,QAFsD;IAGtDC,OAHsD;IAItDC,KAJsD;IAKtD,GAAGC;EALmD,CAMlD;EACJ,MAAMC,KAAK,GAAGP,QAAQ,CAACC,UAAD,CAAtB;EACA,oBACE,6BAAC,kBAAD;IACE,QAAQ,EAAE,CAACG,OADb;IAEE,OAAO,EAAEA,OAFX;IAGE,KAAK,EAAE,CAACC,KAAD,EAAQ;MAAEE;IAAF,CAAR;EAHT,GAIMD,IAJN,GAMGH,QANH,CADF;AAUD,CAlBD;;eAoBe,IAAAK,kBAAA,EAAUN,IAAV,C"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash.omit"));
|
|
13
|
+
|
|
14
|
+
var _theming = require("../../theming");
|
|
15
|
+
|
|
16
|
+
var _picker = require("@react-native-picker/picker");
|
|
17
|
+
|
|
18
|
+
var _utilities = require("../../utilities");
|
|
19
|
+
|
|
20
|
+
var _TextField = _interopRequireDefault(require("../TextField"));
|
|
21
|
+
|
|
22
|
+
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
|
+
|
|
32
|
+
const Picker = _ref => {
|
|
33
|
+
var _options$find;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
style,
|
|
37
|
+
options,
|
|
38
|
+
placeholder,
|
|
39
|
+
selectedValue,
|
|
40
|
+
disabled = false,
|
|
41
|
+
onValueChange: onValueChangeOverride = () => {},
|
|
42
|
+
...props
|
|
43
|
+
} = _ref;
|
|
44
|
+
const {
|
|
45
|
+
viewStyles: {
|
|
46
|
+
borderRadius,
|
|
47
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
48
|
+
borderWidth,
|
|
49
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
50
|
+
borderTopWidth,
|
|
51
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
52
|
+
borderRightWidth,
|
|
53
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
54
|
+
borderBottomWidth,
|
|
55
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
56
|
+
borderLeftWidth,
|
|
57
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
58
|
+
borderColor,
|
|
59
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
60
|
+
backgroundColor,
|
|
61
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
62
|
+
padding,
|
|
63
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
64
|
+
paddingTop,
|
|
65
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
66
|
+
paddingRight,
|
|
67
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
68
|
+
paddingBottom,
|
|
69
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
70
|
+
paddingLeft,
|
|
71
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
72
|
+
...viewStyles
|
|
73
|
+
}
|
|
74
|
+
} = (0, _utilities.extractStyles)(style);
|
|
75
|
+
const textField = React.useRef(undefined);
|
|
76
|
+
|
|
77
|
+
const onValueChange = (itemValue, itemIndex) => {
|
|
78
|
+
toggleFocus();
|
|
79
|
+
onValueChangeOverride(itemValue, itemIndex);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const toggleFocus = () => {
|
|
83
|
+
if (!disabled) {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
90
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
91
|
+
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
92
|
+
disabled: disabled,
|
|
93
|
+
onPress: toggleFocus,
|
|
94
|
+
style: [styles.container, viewStyles]
|
|
95
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, null, /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
96
|
+
enabled: !disabled,
|
|
97
|
+
selectedValue: selectedValue,
|
|
98
|
+
onValueChange: onValueChange,
|
|
99
|
+
style: {
|
|
100
|
+
opacity: 0,
|
|
101
|
+
position: "absolute",
|
|
102
|
+
top: 0,
|
|
103
|
+
left: 0,
|
|
104
|
+
right: 0,
|
|
105
|
+
bottom: 0,
|
|
106
|
+
width: "100%"
|
|
107
|
+
}
|
|
108
|
+
}, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
|
|
109
|
+
label: o.label,
|
|
110
|
+
value: o.value,
|
|
111
|
+
key: o.value
|
|
112
|
+
}))), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
113
|
+
pointerEvents: "none"
|
|
114
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
|
|
115
|
+
value: selectedLabel,
|
|
116
|
+
placeholder: placeholder // @ts-ignore
|
|
117
|
+
,
|
|
118
|
+
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
119
|
+
,
|
|
120
|
+
disabled: disabled // @ts-expect-error
|
|
121
|
+
,
|
|
122
|
+
style: stylesWithoutMargin
|
|
123
|
+
})))));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const styles = _reactNative.StyleSheet.create({
|
|
127
|
+
container: {
|
|
128
|
+
alignSelf: "stretch"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
133
|
+
|
|
134
|
+
exports.default = _default;
|
|
135
|
+
//# sourceMappingURL=PickerComponent.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","opacity","position","top","left","right","bottom","width","map","create","alignSelf","withTheme"],"sources":["PickerComponent.android.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;EAAA;;EAAA,IAR0C;IAC9CC,KAD8C;IAE9CC,OAF8C;IAG9CC,WAH8C;IAI9CC,aAJ8C;IAK9CC,QAAQ,GAAG,KALmC;IAM9CC,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;IAO9C,GAAGC;EAP2C,CAQ1C;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAActB,KAAd,CAjBJ;EAmBA,MAAMuB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;EAEA,MAAMrB,aAAa,GAAG,CAACsB,SAAD,EAAoBC,SAApB,KAA0C;IAC9DC,WAAW;IACXvB,qBAAqB,CAACqB,SAAD,EAAYC,SA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EAApB,gBACE,oBAAC,kBAAD,eACM/B,KADN;IAEE,KAAK,EAAE4B,aAFT;IAGE,WAAW,EAAEjC,WAHf,CAIE;IAJF;IAKE,GAAG,EAAEqB,SALP,CAKkB;IALlB;IAME,QAAQ,EAAEnB,QANZ,CAOE;IAPF;IAQE,KAAK,EAAE2B;EART,GADF,CAnBF,CALF,CADF;AAwCD,CAhGD;;AAkGA,MAAMS,MAAM,GAAGP,uBAAA,CAAWiB,MAAX,CAAkB;EAC/BT,SAAS,EAAE;IACTU,SAAS,EAAE;EADF;AADoB,CAAlB,CAAf;;eAMe,IAAAC,kBAAA,EAAUrD,MAAV,C"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
13
|
+
|
|
14
|
+
var _lodash = _interopRequireDefault(require("lodash.omit"));
|
|
15
|
+
|
|
16
|
+
var _picker = require("@react-native-picker/picker");
|
|
17
|
+
|
|
18
|
+
var _theming = require("../../theming");
|
|
19
|
+
|
|
20
|
+
var _Portal = _interopRequireDefault(require("../Portal/Portal"));
|
|
21
|
+
|
|
22
|
+
var _DeprecatedButton = _interopRequireDefault(require("../DeprecatedButton"));
|
|
23
|
+
|
|
24
|
+
var _TextField = _interopRequireDefault(require("../TextField"));
|
|
25
|
+
|
|
26
|
+
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
27
|
+
|
|
28
|
+
var _utilities = require("../../utilities");
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
36
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
37
|
+
|
|
38
|
+
const Picker = _ref => {
|
|
39
|
+
var _options$find;
|
|
40
|
+
|
|
41
|
+
let {
|
|
42
|
+
Icon,
|
|
43
|
+
style,
|
|
44
|
+
options,
|
|
45
|
+
placeholder,
|
|
46
|
+
selectedValue,
|
|
47
|
+
disabled = false,
|
|
48
|
+
onValueChange = () => {},
|
|
49
|
+
theme: {
|
|
50
|
+
colors
|
|
51
|
+
},
|
|
52
|
+
...props
|
|
53
|
+
} = _ref;
|
|
54
|
+
const {
|
|
55
|
+
viewStyles: {
|
|
56
|
+
borderRadius,
|
|
57
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
58
|
+
borderWidth,
|
|
59
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
60
|
+
borderTopWidth,
|
|
61
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
62
|
+
borderRightWidth,
|
|
63
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
64
|
+
borderBottomWidth,
|
|
65
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
66
|
+
borderLeftWidth,
|
|
67
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
68
|
+
borderColor,
|
|
69
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
70
|
+
backgroundColor,
|
|
71
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
72
|
+
padding,
|
|
73
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
74
|
+
paddingTop,
|
|
75
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
76
|
+
paddingRight,
|
|
77
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
78
|
+
paddingBottom,
|
|
79
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
80
|
+
paddingLeft,
|
|
81
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
82
|
+
...viewStyles
|
|
83
|
+
}
|
|
84
|
+
} = (0, _utilities.extractStyles)(style);
|
|
85
|
+
const textField = React.useRef(undefined);
|
|
86
|
+
const [pickerVisible, setIsPickerVisible] = React.useState(false);
|
|
87
|
+
|
|
88
|
+
const toggleVisibility = () => {
|
|
89
|
+
setIsPickerVisible(!pickerVisible); // @ts-ignore
|
|
90
|
+
|
|
91
|
+
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
95
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
96
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
97
|
+
style: [styles.container, viewStyles]
|
|
98
|
+
}, /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
99
|
+
disabled: disabled,
|
|
100
|
+
onPress: toggleVisibility
|
|
101
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
|
|
102
|
+
value: String(selectedLabel),
|
|
103
|
+
placeholder: placeholder // @ts-ignore
|
|
104
|
+
,
|
|
105
|
+
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
106
|
+
,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
pointerEvents: "none" // @ts-expect-error
|
|
109
|
+
,
|
|
110
|
+
style: stylesWithoutMargin,
|
|
111
|
+
Icon: Icon
|
|
112
|
+
}))), pickerVisible && /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
113
|
+
style: [styles.picker, {
|
|
114
|
+
backgroundColor: colors.divider
|
|
115
|
+
}]
|
|
116
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
|
|
117
|
+
style: styles.pickerContainer
|
|
118
|
+
}, /*#__PURE__*/React.createElement(_DeprecatedButton.default, {
|
|
119
|
+
Icon: Icon,
|
|
120
|
+
type: "text",
|
|
121
|
+
onPress: toggleVisibility,
|
|
122
|
+
style: styles.closeButton
|
|
123
|
+
}, "Close"), /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
124
|
+
style: {
|
|
125
|
+
backgroundColor: "white"
|
|
126
|
+
},
|
|
127
|
+
selectedValue: selectedValue,
|
|
128
|
+
onValueChange: onValueChange
|
|
129
|
+
}, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
|
|
130
|
+
label: o.label,
|
|
131
|
+
value: o.value,
|
|
132
|
+
key: o.value
|
|
133
|
+
})))))));
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const styles = _reactNative.StyleSheet.create({
|
|
137
|
+
container: {
|
|
138
|
+
alignSelf: "stretch"
|
|
139
|
+
},
|
|
140
|
+
picker: {
|
|
141
|
+
position: "absolute",
|
|
142
|
+
bottom: 0,
|
|
143
|
+
left: 0,
|
|
144
|
+
right: 0,
|
|
145
|
+
flexDirection: "row",
|
|
146
|
+
justifyContent: "center"
|
|
147
|
+
},
|
|
148
|
+
pickerContainer: {
|
|
149
|
+
backgroundColor: "white",
|
|
150
|
+
flexDirection: "column",
|
|
151
|
+
width: "100%"
|
|
152
|
+
},
|
|
153
|
+
closeButton: {
|
|
154
|
+
alignSelf: "flex-end"
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
159
|
+
|
|
160
|
+
exports.default = _default;
|
|
161
|
+
//# sourceMappingURL=PickerComponent.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Picker","Icon","style","options","placeholder","selectedValue","disabled","onValueChange","theme","colors","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","pickerVisible","setIsPickerVisible","useState","toggleVisibility","current","toggleFocus","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","String","picker","divider","pickerContainer","closeButton","map","create","alignSelf","position","bottom","left","right","flexDirection","justifyContent","width","withTheme"],"sources":["PickerComponent.ios.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport omit from \"lodash.omit\";\n\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\n\nimport { withTheme } from \"../../theming\";\n\nimport Portal from \"../Portal/Portal\";\nimport Button from \"../DeprecatedButton\";\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\nimport { extractStyles } from \"../../utilities\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nconst Picker: React.FC<PickerComponentProps & IconSlot> = ({\n Icon,\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange = () => {},\n theme: { colors },\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n const [pickerVisible, setIsPickerVisible] = React.useState(false);\n\n const toggleVisibility = () => {\n setIsPickerVisible(!pickerVisible);\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <View style={[styles.container, viewStyles]}>\n <Touchable disabled={disabled} onPress={toggleVisibility}>\n <TextField\n {...props}\n value={String(selectedLabel)}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n pointerEvents=\"none\"\n // @ts-expect-error\n style={stylesWithoutMargin}\n Icon={Icon}\n />\n </Touchable>\n {pickerVisible && (\n <Portal>\n <View style={[styles.picker, { backgroundColor: colors.divider }]}>\n <SafeAreaView style={styles.pickerContainer}>\n <Button\n Icon={Icon}\n type=\"text\"\n onPress={toggleVisibility}\n style={styles.closeButton}\n >\n Close\n </Button>\n <NativePicker\n style={{ backgroundColor: \"white\" }}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n >\n {options.map((o: any) => (\n <NativePicker.Item\n label={o.label}\n value={o.value}\n key={o.value}\n />\n ))}\n </NativePicker>\n </SafeAreaView>\n </View>\n </Portal>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n picker: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n },\n pickerContainer: {\n backgroundColor: \"white\",\n flexDirection: \"column\",\n width: \"100%\",\n },\n closeButton: {\n alignSelf: \"flex-end\",\n },\n});\n\nexport default withTheme(Picker);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAGA,MAAMA,MAAiD,GAAG,QAUpD;EAAA;;EAAA,IAVqD;IACzDC,IADyD;IAEzDC,KAFyD;IAGzDC,OAHyD;IAIzDC,WAJyD;IAKzDC,aALyD;IAMzDC,QAAQ,GAAG,KAN8C;IAOzDC,aAAa,GAAG,MAAM,CAAE,CAPiC;IAQzDC,KAAK,EAAE;MAAEC;IAAF,CARkD;IASzD,GAAGC;EATsD,CAUrD;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACb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AK,EAAE;EAHQ,CAZc;EAiB/BV,WAAW,EAAE;IACXG,SAAS,EAAE;EADA;AAjBkB,CAAlB,CAAf;;eAsBe,IAAAQ,kBAAA,EAAU9D,MAAV,C"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _picker = require("@react-native-picker/picker");
|
|
13
|
+
|
|
14
|
+
var _lodash = _interopRequireDefault(require("lodash.omit"));
|
|
15
|
+
|
|
16
|
+
var _theming = require("../../theming");
|
|
17
|
+
|
|
18
|
+
var _utilities = require("../../utilities");
|
|
19
|
+
|
|
20
|
+
var _TextField = _interopRequireDefault(require("../TextField"));
|
|
21
|
+
|
|
22
|
+
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
|
+
|
|
32
|
+
const Picker = _ref => {
|
|
33
|
+
var _options$find;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
style,
|
|
37
|
+
options,
|
|
38
|
+
placeholder,
|
|
39
|
+
selectedValue,
|
|
40
|
+
disabled = false,
|
|
41
|
+
onValueChange: onValueChangeOverride = () => {},
|
|
42
|
+
...props
|
|
43
|
+
} = _ref;
|
|
44
|
+
const {
|
|
45
|
+
viewStyles: {
|
|
46
|
+
borderRadius,
|
|
47
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
48
|
+
borderWidth,
|
|
49
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
50
|
+
borderTopWidth,
|
|
51
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
52
|
+
borderRightWidth,
|
|
53
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
54
|
+
borderBottomWidth,
|
|
55
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
56
|
+
borderLeftWidth,
|
|
57
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
58
|
+
borderColor,
|
|
59
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
60
|
+
backgroundColor,
|
|
61
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
62
|
+
padding,
|
|
63
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
64
|
+
paddingTop,
|
|
65
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
66
|
+
paddingRight,
|
|
67
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
68
|
+
paddingBottom,
|
|
69
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
70
|
+
paddingLeft,
|
|
71
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
72
|
+
...viewStyles
|
|
73
|
+
}
|
|
74
|
+
} = (0, _utilities.extractStyles)(style);
|
|
75
|
+
const textField = React.useRef(undefined);
|
|
76
|
+
|
|
77
|
+
const onValueChange = (itemValue, itemIndex) => {
|
|
78
|
+
toggleFocus();
|
|
79
|
+
onValueChangeOverride(itemValue, itemIndex);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const toggleFocus = () => {
|
|
83
|
+
if (!disabled) {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
90
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
91
|
+
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
92
|
+
disabled: disabled,
|
|
93
|
+
onPress: toggleFocus,
|
|
94
|
+
style: [styles.container, viewStyles]
|
|
95
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, null, /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
96
|
+
enabled: !disabled,
|
|
97
|
+
selectedValue: selectedValue,
|
|
98
|
+
onValueChange: onValueChange,
|
|
99
|
+
style: {
|
|
100
|
+
flex: 1,
|
|
101
|
+
opacity: 0,
|
|
102
|
+
position: "absolute",
|
|
103
|
+
top: 0,
|
|
104
|
+
left: 0,
|
|
105
|
+
right: 0,
|
|
106
|
+
bottom: 0,
|
|
107
|
+
width: "100%"
|
|
108
|
+
}
|
|
109
|
+
}, options.map(o => /*#__PURE__*/React.createElement(_picker.Picker.Item, {
|
|
110
|
+
label: o.label,
|
|
111
|
+
value: o.value,
|
|
112
|
+
key: o.value
|
|
113
|
+
}))), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
114
|
+
pointerEvents: "none"
|
|
115
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
|
|
116
|
+
value: selectedLabel,
|
|
117
|
+
placeholder: placeholder // @ts-ignore
|
|
118
|
+
,
|
|
119
|
+
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
120
|
+
,
|
|
121
|
+
disabled: disabled // @ts-expect-error
|
|
122
|
+
,
|
|
123
|
+
style: stylesWithoutMargin
|
|
124
|
+
})))));
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const styles = _reactNative.StyleSheet.create({
|
|
128
|
+
container: {
|
|
129
|
+
alignSelf: "stretch"
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
134
|
+
|
|
135
|
+
exports.default = _default;
|
|
136
|
+
//# sourceMappingURL=PickerComponent.web.js.map
|