@draftbit/core 46.4.4-d55501.2 → 46.4.4-d5b88a.2
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/Provider.js +9 -0
- package/lib/commonjs/components/Accordion/AccordionGroup.js +14 -0
- package/lib/commonjs/components/Accordion/AccordionItem.js +13 -0
- package/lib/commonjs/components/Accordion/index.js +3 -0
- package/lib/commonjs/components/ActionSheet/ActionSheet.js +9 -0
- package/lib/commonjs/components/ActionSheet/ActionSheetCancel.js +5 -0
- package/lib/commonjs/components/ActionSheet/ActionSheetItem.js +7 -0
- package/lib/commonjs/components/ActionSheet/index.js +4 -0
- package/lib/commonjs/components/AnimatedCircularProgress.js +15 -0
- package/lib/commonjs/components/AspectRatio.js +10 -0
- package/lib/commonjs/components/AvatarEdit.js +12 -0
- package/lib/commonjs/components/Banner.js +23 -9
- package/lib/commonjs/components/Button.js +19 -2
- package/lib/commonjs/components/Card.js +14 -0
- package/lib/commonjs/components/CardBlock.js +15 -0
- package/lib/commonjs/components/CardContainer.js +18 -0
- package/lib/commonjs/components/CardContainerRating.js +20 -2
- package/lib/commonjs/components/CardContainerShortImage.js +12 -0
- package/lib/commonjs/components/CardInline.js +14 -1
- package/lib/commonjs/components/Carousel.js +21 -3
- package/lib/commonjs/components/Checkbox/Checkbox.js +18 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +11 -0
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +20 -0
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +24 -3
- package/lib/commonjs/components/Checkbox/context.js +5 -0
- package/lib/commonjs/components/Checkbox/index.js +4 -0
- package/lib/commonjs/components/CircleImage.js +9 -0
- package/lib/commonjs/components/CircularProgress.js +13 -3
- package/lib/commonjs/components/Config.js +13 -5
- package/lib/commonjs/components/Container.js +15 -15
- package/lib/commonjs/components/DatePicker/DatePicker.js +48 -16
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js +7 -0
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +10 -0
- package/lib/commonjs/components/DeprecatedButton.js +23 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +11 -0
- package/lib/commonjs/components/DeprecatedFAB.js +26 -0
- package/lib/commonjs/components/Divider.js +9 -0
- package/lib/commonjs/components/Elevation.js +11 -0
- package/lib/commonjs/components/FAB.js +10 -0
- package/lib/commonjs/components/FieldSearchBarFull.js +18 -0
- package/lib/commonjs/components/FormRow.js +10 -0
- package/lib/commonjs/components/Header.js +13 -0
- package/lib/commonjs/components/HeaderLarge.js +9 -0
- package/lib/commonjs/components/HeaderMedium.js +9 -0
- package/lib/commonjs/components/HeaderOverline.js +9 -0
- package/lib/commonjs/components/IconButton.js +10 -0
- package/lib/commonjs/components/Image.js +17 -0
- package/lib/commonjs/components/Layout.js +12 -2
- package/lib/commonjs/components/NumberInput.js +21 -8
- package/lib/commonjs/components/Picker/Picker.js +42 -9
- package/lib/commonjs/components/Picker/PickerComponent.android.js +23 -6
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +27 -8
- package/lib/commonjs/components/Picker/PickerComponent.web.js +23 -6
- package/lib/commonjs/components/Portal/Portal.js +14 -4
- package/lib/commonjs/components/Portal/PortalConsumer.js +15 -5
- package/lib/commonjs/components/Portal/PortalHost.js +31 -4
- package/lib/commonjs/components/Portal/PortalManager.js +19 -7
- package/lib/commonjs/components/ProgressBar.js +25 -5
- package/lib/commonjs/components/ProgressCircle.js +10 -0
- package/lib/commonjs/components/ProgressIndicator.js +9 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js +14 -1
- package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +10 -0
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +14 -0
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +21 -1
- package/lib/commonjs/components/RadioButton/context.js +5 -0
- package/lib/commonjs/components/RadioButton/index.js +5 -0
- package/lib/commonjs/components/Row.js +11 -0
- package/lib/commonjs/components/RowBodyIcon.js +10 -0
- package/lib/commonjs/components/RowHeadlineImageCaption.js +11 -2
- package/lib/commonjs/components/RowHeadlineImageIcon.js +10 -0
- package/lib/commonjs/components/SVG.js +9 -0
- package/lib/commonjs/components/ScreenContainer.js +14 -0
- package/lib/commonjs/components/Slider.js +21 -0
- package/lib/commonjs/components/StarRating.js +10 -0
- package/lib/commonjs/components/StepIndicator.js +39 -5
- package/lib/commonjs/components/Stepper.js +26 -7
- package/lib/commonjs/components/Surface.js +14 -0
- package/lib/commonjs/components/Swiper/Swiper.js +8 -0
- package/lib/commonjs/components/Swiper/SwiperItem.js +6 -0
- package/lib/commonjs/components/Swiper/index.js +3 -0
- package/lib/commonjs/components/Switch.js +18 -5
- package/lib/commonjs/components/Text.js +18 -3
- package/lib/commonjs/components/TextField.js +62 -12
- package/lib/commonjs/components/ToggleButton.js +14 -0
- package/lib/commonjs/components/Touchable.js +5 -0
- package/lib/commonjs/components/Touchable.web.js +2 -0
- package/lib/commonjs/components/Typography.js +5 -0
- package/lib/commonjs/components/useAuthState.js +9 -0
- package/lib/commonjs/constants.js +4 -0
- package/lib/commonjs/hooks.js +7 -4
- package/lib/commonjs/index.js +52 -13
- package/lib/commonjs/interfaces/Icon.js +5 -3
- package/lib/commonjs/mappings/Accordion.js +2 -0
- package/lib/commonjs/mappings/AccordionItem.js +2 -0
- package/lib/commonjs/mappings/ActionSheet.js +2 -0
- package/lib/commonjs/mappings/ActionSheetCancel.js +2 -0
- package/lib/commonjs/mappings/ActionSheetItem.js +2 -0
- package/lib/commonjs/mappings/ActivityIndicator.js +2 -0
- package/lib/commonjs/mappings/AudioPlayer.js +2 -0
- package/lib/commonjs/mappings/AvatarEdit.js +2 -0
- package/lib/commonjs/mappings/Banner.js +2 -0
- package/lib/commonjs/mappings/BlurView.js +2 -0
- package/lib/commonjs/mappings/Button.js +5 -6
- package/lib/commonjs/mappings/Card.js +4 -3
- package/lib/commonjs/mappings/CardBlock.js +5 -6
- package/lib/commonjs/mappings/CardContainer.js +7 -5
- package/lib/commonjs/mappings/CardContainerRating.js +4 -4
- package/lib/commonjs/mappings/CardContainerShortImage.js +2 -0
- package/lib/commonjs/mappings/CardInline.js +2 -0
- package/lib/commonjs/mappings/Carousel.js +2 -0
- package/lib/commonjs/mappings/Checkbox.js +2 -0
- package/lib/commonjs/mappings/CheckboxGroup.js +2 -0
- package/lib/commonjs/mappings/CheckboxRow.js +2 -0
- package/lib/commonjs/mappings/CircleImage.js +2 -0
- package/lib/commonjs/mappings/Container.js +2 -0
- package/lib/commonjs/mappings/CustomCode.js +2 -0
- package/lib/commonjs/mappings/DatePicker.js +4 -4
- package/lib/commonjs/mappings/Divider.js +2 -0
- package/lib/commonjs/mappings/FAB.js +2 -0
- package/lib/commonjs/mappings/Fetch.js +2 -0
- package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -2
- package/lib/commonjs/mappings/FlashList.js +2 -0
- package/lib/commonjs/mappings/FlatList.js +2 -0
- package/lib/commonjs/mappings/HeaderLarge.js +2 -0
- package/lib/commonjs/mappings/HeaderMedium.js +2 -0
- package/lib/commonjs/mappings/HeaderOverline.js +2 -0
- package/lib/commonjs/mappings/HtmlElements.js +125 -0
- package/lib/commonjs/mappings/Icon.js +3 -2
- package/lib/commonjs/mappings/IconButton.js +2 -0
- package/lib/commonjs/mappings/Image.js +2 -0
- package/lib/commonjs/mappings/ImageBackground.js +2 -0
- package/lib/commonjs/mappings/KeyboardAvoidingView.js +2 -0
- package/lib/commonjs/mappings/KeyboardAwareScrollView.js +2 -0
- package/lib/commonjs/mappings/Layout.js +2 -0
- package/lib/commonjs/mappings/LinearGradient.js +2 -0
- package/lib/commonjs/mappings/MapCallout.js +2 -0
- package/lib/commonjs/mappings/MapMarker.js +2 -0
- package/lib/commonjs/mappings/MapView.js +2 -0
- package/lib/commonjs/mappings/Modal.js +2 -0
- package/lib/commonjs/mappings/NumberInput.js +4 -4
- package/lib/commonjs/mappings/Picker.js +4 -4
- package/lib/commonjs/mappings/ProgressBar.js +2 -0
- package/lib/commonjs/mappings/ProgressCircle.js +2 -0
- package/lib/commonjs/mappings/ProgressIndicator.js +2 -0
- package/lib/commonjs/mappings/RadioButton.js +2 -0
- package/lib/commonjs/mappings/RadioButtonGroup.js +2 -0
- package/lib/commonjs/mappings/RadioButtonRow.js +2 -0
- package/lib/commonjs/mappings/RowBodyIcon.js +2 -0
- package/lib/commonjs/mappings/RowHeadlineImageCaption.js +2 -0
- package/lib/commonjs/mappings/RowHeadlineImageIcon.js +8 -12
- package/lib/commonjs/mappings/SVG.js +2 -0
- package/lib/commonjs/mappings/SafeAreaView.js +2 -0
- package/lib/commonjs/mappings/ScrollView.js +2 -0
- package/lib/commonjs/mappings/Slider.js +2 -0
- package/lib/commonjs/mappings/StarRating.js +3 -1
- package/lib/commonjs/mappings/Stepper.js +3 -1
- package/lib/commonjs/mappings/Surface.js +2 -0
- package/lib/commonjs/mappings/Swiper.js +2 -0
- package/lib/commonjs/mappings/SwiperItem.js +2 -0
- package/lib/commonjs/mappings/Switch.js +2 -0
- package/lib/commonjs/mappings/Text.js +5 -5
- package/lib/commonjs/mappings/TextArea.js +3 -2
- package/lib/commonjs/mappings/TextField.js +8 -7
- package/lib/commonjs/mappings/TextInput.js +3 -2
- package/lib/commonjs/mappings/ToggleButton.js +2 -0
- package/lib/commonjs/mappings/Touchable.js +2 -0
- package/lib/commonjs/mappings/Video.js +2 -0
- package/lib/commonjs/mappings/View.js +2 -0
- package/lib/commonjs/mappings/WebView.js +2 -0
- package/lib/commonjs/styles/DarkTheme.js +6 -5
- package/lib/commonjs/styles/DefaultTheme.js +17 -26
- package/lib/commonjs/styles/fonts.js +5 -3
- package/lib/commonjs/styles/overlay.js +14 -5
- package/lib/commonjs/styles/shadow.js +9 -0
- package/lib/commonjs/theming.js +4 -0
- package/lib/commonjs/utilities.js +14 -2
- package/lib/module/Provider.js +1 -0
- package/lib/module/components/Accordion/AccordionGroup.js +4 -0
- package/lib/module/components/Accordion/AccordionItem.js +3 -0
- package/lib/module/components/ActionSheet/ActionSheet.js +2 -0
- package/lib/module/components/ActionSheet/ActionSheetCancel.js +2 -0
- package/lib/module/components/ActionSheet/ActionSheetItem.js +2 -0
- package/lib/module/components/AnimatedCircularProgress.js +6 -0
- package/lib/module/components/AspectRatio.js +6 -0
- package/lib/module/components/AvatarEdit.js +3 -0
- package/lib/module/components/Banner.js +10 -9
- package/lib/module/components/Button.js +10 -2
- package/lib/module/components/Card.js +2 -0
- package/lib/module/components/CardBlock.js +6 -0
- package/lib/module/components/CardContainer.js +7 -0
- package/lib/module/components/CardContainerRating.js +8 -2
- package/lib/module/components/CardContainerShortImage.js +3 -0
- package/lib/module/components/CardInline.js +2 -0
- package/lib/module/components/Carousel.js +9 -3
- package/lib/module/components/Checkbox/Checkbox.js +9 -3
- package/lib/module/components/Checkbox/CheckboxGroup.js +5 -0
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +8 -0
- package/lib/module/components/Checkbox/CheckboxRow.js +11 -3
- package/lib/module/components/Checkbox/context.js +2 -0
- package/lib/module/components/CircleImage.js +3 -0
- package/lib/module/components/CircularProgress.js +9 -3
- package/lib/module/components/Config.js +11 -5
- package/lib/module/components/Container.js +3 -0
- package/lib/module/components/DatePicker/DatePicker.js +33 -16
- package/lib/module/components/DatePicker/DatePickerComponent.js +2 -0
- package/lib/module/components/DatePicker/DatePickerComponent.web.js +2 -0
- package/lib/module/components/DeprecatedButton.js +9 -0
- package/lib/module/components/DeprecatedCardWrapper.js +6 -0
- package/lib/module/components/DeprecatedFAB.js +13 -0
- package/lib/module/components/Divider.js +3 -0
- package/lib/module/components/Elevation.js +3 -0
- package/lib/module/components/FAB.js +3 -0
- package/lib/module/components/FieldSearchBarFull.js +9 -0
- package/lib/module/components/FormRow.js +1 -0
- package/lib/module/components/Header.js +2 -0
- package/lib/module/components/HeaderLarge.js +2 -0
- package/lib/module/components/HeaderMedium.js +2 -0
- package/lib/module/components/HeaderOverline.js +2 -0
- package/lib/module/components/IconButton.js +3 -0
- package/lib/module/components/Image.js +10 -0
- package/lib/module/components/Layout.js +3 -4
- package/lib/module/components/NumberInput.js +16 -8
- package/lib/module/components/Picker/Picker.js +25 -8
- package/lib/module/components/Picker/PickerComponent.android.js +10 -6
- package/lib/module/components/Picker/PickerComponent.ios.js +11 -8
- package/lib/module/components/Picker/PickerComponent.web.js +10 -6
- package/lib/module/components/Portal/Portal.js +6 -4
- package/lib/module/components/Portal/PortalConsumer.js +10 -5
- package/lib/module/components/Portal/PortalHost.js +22 -4
- package/lib/module/components/Portal/PortalManager.js +14 -7
- package/lib/module/components/ProgressBar.js +17 -5
- package/lib/module/components/ProgressCircle.js +2 -0
- package/lib/module/components/ProgressIndicator.js +2 -0
- package/lib/module/components/RadioButton/RadioButton.js +6 -1
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +3 -0
- package/lib/module/components/RadioButton/RadioButtonGroup.js +7 -0
- package/lib/module/components/RadioButton/RadioButtonRow.js +9 -1
- package/lib/module/components/RadioButton/context.js +2 -0
- package/lib/module/components/Row.js +2 -0
- package/lib/module/components/RowBodyIcon.js +2 -0
- package/lib/module/components/RowHeadlineImageCaption.js +3 -2
- package/lib/module/components/RowHeadlineImageIcon.js +2 -0
- package/lib/module/components/SVG.js +2 -0
- package/lib/module/components/ScreenContainer.js +6 -0
- package/lib/module/components/Slider.js +10 -0
- package/lib/module/components/StarRating.js +3 -0
- package/lib/module/components/StepIndicator.js +29 -5
- package/lib/module/components/Stepper.js +16 -9
- package/lib/module/components/Surface.js +5 -0
- package/lib/module/components/Swiper/Swiper.js +4 -0
- package/lib/module/components/Swiper/SwiperItem.js +2 -0
- package/lib/module/components/Switch.js +7 -5
- package/lib/module/components/Text.js +10 -3
- package/lib/module/components/TextField.js +50 -12
- package/lib/module/components/ToggleButton.js +5 -0
- package/lib/module/components/Touchable.js +1 -0
- package/lib/module/components/useAuthState.js +4 -0
- package/lib/module/constants.js +1 -2
- package/lib/module/hooks.js +2 -4
- package/lib/module/index.js +2 -5
- package/lib/module/interfaces/Icon.js +1 -2
- package/lib/module/mappings/Button.js +3 -6
- package/lib/module/mappings/Card.js +2 -3
- package/lib/module/mappings/CardBlock.js +3 -6
- package/lib/module/mappings/CardContainer.js +5 -5
- package/lib/module/mappings/CardContainerRating.js +2 -4
- package/lib/module/mappings/DatePicker.js +2 -4
- package/lib/module/mappings/Fetch.js +1 -0
- package/lib/module/mappings/FieldSearchBarFull.js +1 -2
- package/lib/module/mappings/HtmlElements.js +116 -0
- package/lib/module/mappings/Icon.js +1 -2
- package/lib/module/mappings/NumberInput.js +2 -4
- package/lib/module/mappings/Picker.js +2 -4
- package/lib/module/mappings/RowHeadlineImageIcon.js +6 -12
- package/lib/module/mappings/StarRating.js +1 -1
- package/lib/module/mappings/Stepper.js +2 -2
- package/lib/module/mappings/Text.js +3 -5
- package/lib/module/mappings/TextArea.js +1 -2
- package/lib/module/mappings/TextField.js +6 -7
- package/lib/module/mappings/TextInput.js +1 -2
- package/lib/module/styles/DarkTheme.js +2 -4
- package/lib/module/styles/DefaultTheme.js +13 -26
- package/lib/module/styles/fonts.js +1 -2
- package/lib/module/styles/overlay.js +10 -4
- package/lib/module/styles/shadow.js +6 -0
- package/lib/module/utilities.js +5 -2
- package/lib/typescript/src/components/Stepper.d.ts +1 -2
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/HtmlElements.d.ts +49 -0
- package/package.json +5 -6
- package/src/components/Picker/Picker.js +1 -1
- package/src/components/Picker/Picker.tsx +2 -2
- package/src/components/Stepper.js +5 -3
- package/src/components/Stepper.tsx +5 -5
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/HtmlElements.js +141 -0
- package/src/mappings/HtmlElements.ts +151 -0
- package/src/mappings/Stepper.js +5 -2
- package/src/mappings/Stepper.ts +5 -1
- package/lib/commonjs/components/TabView/TabView.js +0 -87
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -24
- package/lib/commonjs/components/TabView/index.js +0 -20
- package/lib/commonjs/mappings/TabView.js +0 -77
- package/lib/module/components/TabView/TabView.js +0 -79
- package/lib/module/components/TabView/TabViewItem.js +0 -17
- package/lib/module/components/TabView/index.js +0 -2
- package/lib/module/mappings/TabView.js +0 -70
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
- package/lib/typescript/src/components/TabView/index.d.ts +0 -2
- package/lib/typescript/src/mappings/TabView.d.ts +0 -111
- package/src/components/TabView/TabView.js +0 -34
- package/src/components/TabView/TabView.tsx +0 -97
- package/src/components/TabView/TabViewItem.js +0 -5
- package/src/components/TabView/TabViewItem.tsx +0 -21
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.tsx +0 -2
- package/src/mappings/TabView.js +0 -73
- package/src/mappings/TabView.ts +0 -80
package/src/index.tsx
CHANGED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp, FORM_TYPES, GROUPS, StylesPanelSections, Triggers, } from "@draftbit/types";
|
|
2
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
|
|
3
|
+
const ELEMENT_PROPS = {
|
|
4
|
+
category: COMPONENT_TYPES.deprecated,
|
|
5
|
+
doc_link: "https://www.npmjs.com/package/@expo/html-elements",
|
|
6
|
+
code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.Typography,
|
|
9
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
10
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
11
|
+
StylesPanelSections.Effects,
|
|
12
|
+
],
|
|
13
|
+
layout: {
|
|
14
|
+
margin: 0,
|
|
15
|
+
},
|
|
16
|
+
triggers: SEED_DATA_TRIGGERS,
|
|
17
|
+
};
|
|
18
|
+
const HEADING_PROPS = {
|
|
19
|
+
...ELEMENT_PROPS,
|
|
20
|
+
};
|
|
21
|
+
export const SEED_DATA = [
|
|
22
|
+
{
|
|
23
|
+
name: "H1",
|
|
24
|
+
tag: "H1",
|
|
25
|
+
...HEADING_PROPS,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "H2",
|
|
29
|
+
tag: "H2",
|
|
30
|
+
...HEADING_PROPS,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "H3",
|
|
34
|
+
tag: "H3",
|
|
35
|
+
...HEADING_PROPS,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "H4",
|
|
39
|
+
tag: "H4",
|
|
40
|
+
...HEADING_PROPS,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "H5",
|
|
44
|
+
tag: "H5",
|
|
45
|
+
...HEADING_PROPS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "H6",
|
|
49
|
+
tag: "H6",
|
|
50
|
+
...HEADING_PROPS,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "Anchor",
|
|
54
|
+
tag: "A",
|
|
55
|
+
...ELEMENT_PROPS,
|
|
56
|
+
props: {
|
|
57
|
+
href: createTextProp({
|
|
58
|
+
label: "href",
|
|
59
|
+
description: "Specify the URL",
|
|
60
|
+
defaultValue: "",
|
|
61
|
+
}),
|
|
62
|
+
target: {
|
|
63
|
+
group: GROUPS.basic,
|
|
64
|
+
label: "target",
|
|
65
|
+
description: "decide where link should open",
|
|
66
|
+
formType: FORM_TYPES.flatArray,
|
|
67
|
+
defaultValue: "_blank",
|
|
68
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "Paragraph",
|
|
74
|
+
tag: "P",
|
|
75
|
+
...ELEMENT_PROPS,
|
|
76
|
+
props: {
|
|
77
|
+
// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
78
|
+
// strong: createBoolProp({
|
|
79
|
+
// label: "Strong",
|
|
80
|
+
// description: "Strong",
|
|
81
|
+
// }),
|
|
82
|
+
// strike: createBoolProp({
|
|
83
|
+
// label: "Strike",
|
|
84
|
+
// description: "Strike through",
|
|
85
|
+
// }),
|
|
86
|
+
// italic: createBoolProp({
|
|
87
|
+
// label: "Italic",
|
|
88
|
+
// description: "Italic Fonts",
|
|
89
|
+
// }),
|
|
90
|
+
// bold: createBoolProp({
|
|
91
|
+
// label: "Bold",
|
|
92
|
+
// description: "Bold",
|
|
93
|
+
// }),
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "Code",
|
|
98
|
+
tag: "Code",
|
|
99
|
+
...ELEMENT_PROPS,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Pre",
|
|
103
|
+
tag: "Pre",
|
|
104
|
+
...ELEMENT_PROPS,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Mark",
|
|
108
|
+
tag: "Mark",
|
|
109
|
+
...ELEMENT_PROPS,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "BR",
|
|
113
|
+
tag: "BR",
|
|
114
|
+
...ELEMENT_PROPS,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "BlockQuote",
|
|
118
|
+
tag: "BlockQuote",
|
|
119
|
+
...ELEMENT_PROPS,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "Time",
|
|
123
|
+
tag: "Time",
|
|
124
|
+
...ELEMENT_PROPS,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "UL",
|
|
128
|
+
tag: "UL",
|
|
129
|
+
...ELEMENT_PROPS,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "LI",
|
|
133
|
+
tag: "LI",
|
|
134
|
+
...ELEMENT_PROPS,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "HR",
|
|
138
|
+
tag: "HR",
|
|
139
|
+
...ELEMENT_PROPS,
|
|
140
|
+
},
|
|
141
|
+
];
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createTextProp,
|
|
4
|
+
FORM_TYPES,
|
|
5
|
+
GROUPS,
|
|
6
|
+
StylesPanelSections,
|
|
7
|
+
Triggers,
|
|
8
|
+
} from "@draftbit/types";
|
|
9
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
|
|
10
|
+
|
|
11
|
+
const ELEMENT_PROPS = {
|
|
12
|
+
category: COMPONENT_TYPES.deprecated,
|
|
13
|
+
doc_link: "https://www.npmjs.com/package/@expo/html-elements",
|
|
14
|
+
code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
|
|
15
|
+
stylesPanelSections: [
|
|
16
|
+
StylesPanelSections.Typography,
|
|
17
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
18
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
19
|
+
StylesPanelSections.Effects,
|
|
20
|
+
],
|
|
21
|
+
layout: {
|
|
22
|
+
margin: 0,
|
|
23
|
+
},
|
|
24
|
+
triggers: SEED_DATA_TRIGGERS,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const HEADING_PROPS = {
|
|
28
|
+
...ELEMENT_PROPS,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const SEED_DATA = [
|
|
32
|
+
{
|
|
33
|
+
name: "H1",
|
|
34
|
+
tag: "H1",
|
|
35
|
+
...HEADING_PROPS,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "H2",
|
|
39
|
+
tag: "H2",
|
|
40
|
+
...HEADING_PROPS,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "H3",
|
|
44
|
+
tag: "H3",
|
|
45
|
+
...HEADING_PROPS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "H4",
|
|
49
|
+
tag: "H4",
|
|
50
|
+
...HEADING_PROPS,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "H5",
|
|
54
|
+
tag: "H5",
|
|
55
|
+
...HEADING_PROPS,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "H6",
|
|
59
|
+
tag: "H6",
|
|
60
|
+
...HEADING_PROPS,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "Anchor",
|
|
64
|
+
tag: "A",
|
|
65
|
+
...ELEMENT_PROPS,
|
|
66
|
+
props: {
|
|
67
|
+
href: createTextProp({
|
|
68
|
+
label: "href",
|
|
69
|
+
description: "Specify the URL",
|
|
70
|
+
defaultValue: "",
|
|
71
|
+
}),
|
|
72
|
+
target: {
|
|
73
|
+
group: GROUPS.basic,
|
|
74
|
+
label: "target",
|
|
75
|
+
description: "decide where link should open",
|
|
76
|
+
formType: FORM_TYPES.flatArray,
|
|
77
|
+
defaultValue: "_blank",
|
|
78
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "Paragraph",
|
|
84
|
+
tag: "P",
|
|
85
|
+
...ELEMENT_PROPS,
|
|
86
|
+
props: {
|
|
87
|
+
// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
88
|
+
// strong: createBoolProp({
|
|
89
|
+
// label: "Strong",
|
|
90
|
+
// description: "Strong",
|
|
91
|
+
// }),
|
|
92
|
+
// strike: createBoolProp({
|
|
93
|
+
// label: "Strike",
|
|
94
|
+
// description: "Strike through",
|
|
95
|
+
// }),
|
|
96
|
+
// italic: createBoolProp({
|
|
97
|
+
// label: "Italic",
|
|
98
|
+
// description: "Italic Fonts",
|
|
99
|
+
// }),
|
|
100
|
+
// bold: createBoolProp({
|
|
101
|
+
// label: "Bold",
|
|
102
|
+
// description: "Bold",
|
|
103
|
+
// }),
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Code",
|
|
108
|
+
tag: "Code",
|
|
109
|
+
...ELEMENT_PROPS,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "Pre",
|
|
113
|
+
tag: "Pre",
|
|
114
|
+
...ELEMENT_PROPS,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "Mark",
|
|
118
|
+
tag: "Mark",
|
|
119
|
+
...ELEMENT_PROPS,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "BR",
|
|
123
|
+
tag: "BR",
|
|
124
|
+
...ELEMENT_PROPS,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "BlockQuote",
|
|
128
|
+
tag: "BlockQuote",
|
|
129
|
+
...ELEMENT_PROPS,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "Time",
|
|
133
|
+
tag: "Time",
|
|
134
|
+
...ELEMENT_PROPS,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "UL",
|
|
138
|
+
tag: "UL",
|
|
139
|
+
...ELEMENT_PROPS,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "LI",
|
|
143
|
+
tag: "LI",
|
|
144
|
+
...ELEMENT_PROPS,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "HR",
|
|
148
|
+
tag: "HR",
|
|
149
|
+
...ELEMENT_PROPS,
|
|
150
|
+
},
|
|
151
|
+
];
|
package/src/mappings/Stepper.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [
|
|
3
3
|
{
|
|
4
4
|
name: "Stepper",
|
|
5
5
|
tag: "Stepper",
|
|
6
6
|
description: "A component used to control the quantity of something",
|
|
7
7
|
category: COMPONENT_TYPES.control,
|
|
8
|
-
stylesPanelSections:
|
|
8
|
+
stylesPanelSections: [
|
|
9
|
+
StylesPanelSections.Typography,
|
|
10
|
+
...BLOCK_STYLES_SECTIONS,
|
|
11
|
+
],
|
|
9
12
|
layout: {},
|
|
10
13
|
triggers: [Triggers.OnChange],
|
|
11
14
|
props: {
|
package/src/mappings/Stepper.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createStaticNumberProp,
|
|
7
7
|
Triggers,
|
|
8
8
|
BLOCK_STYLES_SECTIONS,
|
|
9
|
+
StylesPanelSections,
|
|
9
10
|
} from "@draftbit/types";
|
|
10
11
|
|
|
11
12
|
export const SEED_DATA = [
|
|
@@ -14,7 +15,10 @@ export const SEED_DATA = [
|
|
|
14
15
|
tag: "Stepper",
|
|
15
16
|
description: "A component used to control the quantity of something",
|
|
16
17
|
category: COMPONENT_TYPES.control,
|
|
17
|
-
stylesPanelSections:
|
|
18
|
+
stylesPanelSections: [
|
|
19
|
+
StylesPanelSections.Typography,
|
|
20
|
+
...BLOCK_STYLES_SECTIONS,
|
|
21
|
+
],
|
|
18
22
|
layout: {},
|
|
19
23
|
triggers: [Triggers.OnChange],
|
|
20
24
|
props: {
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNativeTabView = require("react-native-tab-view");
|
|
9
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
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); }
|
|
14
|
-
const TabViewComponent = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
Icon,
|
|
17
|
-
tabBarPosition,
|
|
18
|
-
keyboardDismissMode,
|
|
19
|
-
swipeEnabled,
|
|
20
|
-
scrollEnabled,
|
|
21
|
-
activeColor,
|
|
22
|
-
inactiveColor,
|
|
23
|
-
pressColor,
|
|
24
|
-
indicatorColor,
|
|
25
|
-
style,
|
|
26
|
-
children
|
|
27
|
-
} = _ref;
|
|
28
|
-
const [index, setIndex] = React.useState(0);
|
|
29
|
-
const [routes, setRoutes] = React.useState([]);
|
|
30
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
31
|
-
React.useEffect(() => {
|
|
32
|
-
const newRoutes = [];
|
|
33
|
-
const scenes = {};
|
|
34
|
-
React.Children.toArray(children).filter(child => child.type === _TabViewItem.default).forEach(child => {
|
|
35
|
-
var _child$props;
|
|
36
|
-
if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
|
|
37
|
-
var _child$props2, _child$props3;
|
|
38
|
-
newRoutes.push({
|
|
39
|
-
key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
|
|
40
|
-
...(child === null || child === void 0 ? void 0 : child.props)
|
|
41
|
-
});
|
|
42
|
-
scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
setRoutes(newRoutes);
|
|
46
|
-
setTabScenes(scenes);
|
|
47
|
-
}, [children]);
|
|
48
|
-
const indexChangeHandler = i => setIndex(i);
|
|
49
|
-
const renderTabBar = props => {
|
|
50
|
-
console.log(props);
|
|
51
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
|
|
52
|
-
activeColor: activeColor,
|
|
53
|
-
inactiveColor: inactiveColor,
|
|
54
|
-
pressColor: pressColor,
|
|
55
|
-
scrollEnabled: scrollEnabled,
|
|
56
|
-
indicatorStyle: {
|
|
57
|
-
backgroundColor: indicatorColor
|
|
58
|
-
},
|
|
59
|
-
renderIcon: _ref2 => {
|
|
60
|
-
let {
|
|
61
|
-
route,
|
|
62
|
-
color
|
|
63
|
-
} = _ref2;
|
|
64
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
65
|
-
name: route.icon,
|
|
66
|
-
color: color,
|
|
67
|
-
size: 36
|
|
68
|
-
}) : null;
|
|
69
|
-
},
|
|
70
|
-
style: style
|
|
71
|
-
}));
|
|
72
|
-
};
|
|
73
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
|
|
74
|
-
navigationState: {
|
|
75
|
-
index,
|
|
76
|
-
routes
|
|
77
|
-
},
|
|
78
|
-
renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
|
|
79
|
-
renderTabBar: renderTabBar,
|
|
80
|
-
onIndexChange: indexChangeHandler,
|
|
81
|
-
tabBarPosition: tabBarPosition,
|
|
82
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
83
|
-
swipeEnabled: swipeEnabled
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
var _default = TabViewComponent;
|
|
87
|
-
exports.default = _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
const TabViewItem = _ref => {
|
|
8
|
-
let {
|
|
9
|
-
title,
|
|
10
|
-
id,
|
|
11
|
-
icon,
|
|
12
|
-
children,
|
|
13
|
-
accessibilityLabel
|
|
14
|
-
} = _ref;
|
|
15
|
-
console.log({
|
|
16
|
-
title,
|
|
17
|
-
id,
|
|
18
|
-
icon,
|
|
19
|
-
accessibilityLabel
|
|
20
|
-
});
|
|
21
|
-
return children;
|
|
22
|
-
};
|
|
23
|
-
var _default = TabViewItem;
|
|
24
|
-
exports.default = _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "TabView", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _TabView.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "TabViewItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _TabViewItem.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _TabView = _interopRequireDefault(require("./TabView"));
|
|
19
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = [{
|
|
9
|
-
name: "Tab View",
|
|
10
|
-
tag: "TabView",
|
|
11
|
-
category: _types.COMPONENT_TYPES.container,
|
|
12
|
-
layout: {},
|
|
13
|
-
props: {
|
|
14
|
-
tabBarPosition: (0, _types.createTextEnumProp)({
|
|
15
|
-
label: "Tab Bar Position",
|
|
16
|
-
description: "Tab Bar Position",
|
|
17
|
-
options: ["top", "bottom"],
|
|
18
|
-
defaultValue: "top"
|
|
19
|
-
}),
|
|
20
|
-
keyboardDismissMode: (0, _types.createTextEnumProp)({
|
|
21
|
-
label: "Keyboard Dismiss Mode",
|
|
22
|
-
description: "Keyboard Dismiss Mode",
|
|
23
|
-
options: ["auto", "on-drag", "none"],
|
|
24
|
-
defaultValue: "auto"
|
|
25
|
-
}),
|
|
26
|
-
swipeEnabled: (0, _types.createBoolProp)({
|
|
27
|
-
label: "Swipe Enabled",
|
|
28
|
-
description: "Swipe Enabled",
|
|
29
|
-
defaultValue: true
|
|
30
|
-
}),
|
|
31
|
-
scrollEnabled: (0, _types.createBoolProp)({
|
|
32
|
-
label: "Scroll Enabled",
|
|
33
|
-
description: "Scroll Enabled",
|
|
34
|
-
defaultValue: true
|
|
35
|
-
}),
|
|
36
|
-
activeColor: (0, _types.createColorProp)({
|
|
37
|
-
label: "Active Color",
|
|
38
|
-
description: "Active Color",
|
|
39
|
-
defaultValue: "primary"
|
|
40
|
-
}),
|
|
41
|
-
inactiveColor: (0, _types.createColorProp)({
|
|
42
|
-
label: "Inactive Color",
|
|
43
|
-
description: "Inactive Color",
|
|
44
|
-
defaultValue: null
|
|
45
|
-
}),
|
|
46
|
-
pressColor: (0, _types.createColorProp)({
|
|
47
|
-
label: "Press Color",
|
|
48
|
-
description: "Press Color",
|
|
49
|
-
defaultValue: null
|
|
50
|
-
}),
|
|
51
|
-
indicatorColor: (0, _types.createColorProp)({
|
|
52
|
-
label: "Indicator Color",
|
|
53
|
-
description: "Indicator Color",
|
|
54
|
-
defaultValue: null
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
name: "Tab View Item",
|
|
59
|
-
tag: "TabViewItem",
|
|
60
|
-
category: _types.COMPONENT_TYPES.container,
|
|
61
|
-
layout: {},
|
|
62
|
-
props: {
|
|
63
|
-
title: (0, _types.createTextProp)({
|
|
64
|
-
label: "Title",
|
|
65
|
-
description: "Tab Title"
|
|
66
|
-
}),
|
|
67
|
-
id: (0, _types.createTextProp)({
|
|
68
|
-
label: "Id",
|
|
69
|
-
description: "Tab Id"
|
|
70
|
-
}),
|
|
71
|
-
accessibilityLabel: (0, _types.createTextProp)({
|
|
72
|
-
label: "Accessibility Label",
|
|
73
|
-
description: "Accessibility Label"
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
}];
|
|
77
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
|
|
4
|
-
|
|
5
|
-
// import { withTheme } from "../../theming";
|
|
6
|
-
import TabViewItem from "./TabViewItem";
|
|
7
|
-
const TabViewComponent = _ref => {
|
|
8
|
-
let {
|
|
9
|
-
Icon,
|
|
10
|
-
tabBarPosition,
|
|
11
|
-
keyboardDismissMode,
|
|
12
|
-
swipeEnabled,
|
|
13
|
-
scrollEnabled,
|
|
14
|
-
activeColor,
|
|
15
|
-
inactiveColor,
|
|
16
|
-
pressColor,
|
|
17
|
-
indicatorColor,
|
|
18
|
-
style,
|
|
19
|
-
children
|
|
20
|
-
} = _ref;
|
|
21
|
-
const [index, setIndex] = React.useState(0);
|
|
22
|
-
const [routes, setRoutes] = React.useState([]);
|
|
23
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
const newRoutes = [];
|
|
26
|
-
const scenes = {};
|
|
27
|
-
React.Children.toArray(children).filter(child => child.type === TabViewItem).forEach(child => {
|
|
28
|
-
var _child$props;
|
|
29
|
-
if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
|
|
30
|
-
var _child$props2, _child$props3;
|
|
31
|
-
newRoutes.push({
|
|
32
|
-
key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
|
|
33
|
-
...(child === null || child === void 0 ? void 0 : child.props)
|
|
34
|
-
});
|
|
35
|
-
scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
setRoutes(newRoutes);
|
|
39
|
-
setTabScenes(scenes);
|
|
40
|
-
}, [children]);
|
|
41
|
-
const indexChangeHandler = i => setIndex(i);
|
|
42
|
-
const renderTabBar = props => {
|
|
43
|
-
console.log(props);
|
|
44
|
-
return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
|
|
45
|
-
activeColor: activeColor,
|
|
46
|
-
inactiveColor: inactiveColor,
|
|
47
|
-
pressColor: pressColor,
|
|
48
|
-
scrollEnabled: scrollEnabled,
|
|
49
|
-
indicatorStyle: {
|
|
50
|
-
backgroundColor: indicatorColor
|
|
51
|
-
},
|
|
52
|
-
renderIcon: _ref2 => {
|
|
53
|
-
let {
|
|
54
|
-
route,
|
|
55
|
-
color
|
|
56
|
-
} = _ref2;
|
|
57
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
58
|
-
name: route.icon,
|
|
59
|
-
color: color,
|
|
60
|
-
size: 36
|
|
61
|
-
}) : null;
|
|
62
|
-
},
|
|
63
|
-
style: style
|
|
64
|
-
}));
|
|
65
|
-
};
|
|
66
|
-
return /*#__PURE__*/React.createElement(TabView, {
|
|
67
|
-
navigationState: {
|
|
68
|
-
index,
|
|
69
|
-
routes
|
|
70
|
-
},
|
|
71
|
-
renderScene: SceneMap(tabScenes),
|
|
72
|
-
renderTabBar: renderTabBar,
|
|
73
|
-
onIndexChange: indexChangeHandler,
|
|
74
|
-
tabBarPosition: tabBarPosition,
|
|
75
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
76
|
-
swipeEnabled: swipeEnabled
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
export default TabViewComponent;
|