@draftbit/core 46.4.4-cbd3a5.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 +19 -13
- 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 +11 -0
- 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 +29 -21
- 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 +5 -1
- package/lib/commonjs/hooks.js +7 -4
- package/lib/commonjs/index.js +52 -0
- 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 -4
- 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/mappings/HtmlElements.d.ts +49 -0
- package/package.json +4 -3
- 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/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/module/utilities.js
CHANGED
|
@@ -44,7 +44,6 @@ export function extractBorderAndMarginStyles(style, additionalBorderStyles, addi
|
|
|
44
44
|
marginStyles
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
|
|
48
47
|
/**
|
|
49
48
|
* Merges a style object on top of another style object. In React Native,
|
|
50
49
|
* keys with undefined values in a style object will still override styles
|
|
@@ -57,16 +56,20 @@ export function extractBorderAndMarginStyles(style, additionalBorderStyles, addi
|
|
|
57
56
|
* `const mergedStyles = StyleSheet.compose({ color: "red" }, { color: undefined })`
|
|
58
57
|
* `const mergedStyles = StyleSheet.flatten([{ color: "red" }, { color: undefined }])`
|
|
59
58
|
*/
|
|
59
|
+
|
|
60
60
|
export function applyStyles(baseStyles, stylesToApply) {
|
|
61
61
|
if (!stylesToApply) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
+
|
|
64
65
|
const flattenedStyles = StyleSheet.flatten(baseStyles);
|
|
66
|
+
|
|
65
67
|
for (const [key, value] of Object.entries(stylesToApply)) {
|
|
66
68
|
if (value != null) {
|
|
67
69
|
flattenedStyles[key] = value;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
|
|
70
73
|
return flattenedStyles;
|
|
71
74
|
}
|
|
72
75
|
export function getValueForRadioButton(value) {
|
|
@@ -75,6 +78,6 @@ export function getValueForRadioButton(value) {
|
|
|
75
78
|
} else if (isNumber(value)) {
|
|
76
79
|
return String(value);
|
|
77
80
|
} else {
|
|
78
|
-
throw new Error(
|
|
81
|
+
throw new Error("Invalid value: ".concat(value));
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -7,8 +7,7 @@ declare type Props = {
|
|
|
7
7
|
max: number;
|
|
8
8
|
value?: number;
|
|
9
9
|
defaultValue?: number;
|
|
10
|
-
style?: StyleProp<ViewStyle>;
|
|
11
|
-
typeStyle?: StyleProp<TextStyle>;
|
|
10
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
12
11
|
iconSize: number;
|
|
13
12
|
iconColor?: string;
|
|
14
13
|
onChange?: (value: number) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
category: string;
|
|
3
|
+
doc_link: string;
|
|
4
|
+
code_link: string;
|
|
5
|
+
stylesPanelSections: string[];
|
|
6
|
+
layout: {
|
|
7
|
+
margin: number;
|
|
8
|
+
};
|
|
9
|
+
triggers: string[];
|
|
10
|
+
name: string;
|
|
11
|
+
tag: string;
|
|
12
|
+
} | {
|
|
13
|
+
props: {
|
|
14
|
+
href: any;
|
|
15
|
+
target: {
|
|
16
|
+
group: string;
|
|
17
|
+
label: string;
|
|
18
|
+
description: string;
|
|
19
|
+
formType: string;
|
|
20
|
+
defaultValue: string;
|
|
21
|
+
options: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
category: string;
|
|
25
|
+
doc_link: string;
|
|
26
|
+
code_link: string;
|
|
27
|
+
stylesPanelSections: string[];
|
|
28
|
+
layout: {
|
|
29
|
+
margin: number;
|
|
30
|
+
};
|
|
31
|
+
triggers: string[];
|
|
32
|
+
name: string;
|
|
33
|
+
tag: string;
|
|
34
|
+
} | {
|
|
35
|
+
props: {
|
|
36
|
+
href?: undefined;
|
|
37
|
+
target?: undefined;
|
|
38
|
+
};
|
|
39
|
+
category: string;
|
|
40
|
+
doc_link: string;
|
|
41
|
+
code_link: string;
|
|
42
|
+
stylesPanelSections: string[];
|
|
43
|
+
layout: {
|
|
44
|
+
margin: number;
|
|
45
|
+
};
|
|
46
|
+
triggers: string[];
|
|
47
|
+
name: string;
|
|
48
|
+
tag: string;
|
|
49
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-d5b88a.2+d5b88a7",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-d5b88a.2+d5b88a7",
|
|
45
|
+
"@expo/html-elements": "^0.2.2",
|
|
45
46
|
"@material-ui/core": "^4.11.0",
|
|
46
47
|
"@material-ui/pickers": "^3.2.10",
|
|
47
48
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
]
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "d5b88a73c85fdcb68bf75b649c2b36373b9673ae"
|
|
85
86
|
}
|
|
@@ -194,7 +194,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
194
194
|
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
195
195
|
!isIos && pickerVisible ? (React.createElement(NativePicker, { enabled: pickerVisible, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
196
196
|
};
|
|
197
|
-
export default withTheme(Picker);
|
|
198
197
|
const styles = StyleSheet.create({
|
|
199
198
|
marginsContainer: {
|
|
200
199
|
alignSelf: "stretch",
|
|
@@ -265,3 +264,4 @@ const styles = StyleSheet.create({
|
|
|
265
264
|
maxHeight: deviceHeight,
|
|
266
265
|
},
|
|
267
266
|
});
|
|
267
|
+
export default withTheme(Picker);
|
|
@@ -406,8 +406,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
406
406
|
);
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
export default withTheme(Picker);
|
|
410
|
-
|
|
411
409
|
const styles = StyleSheet.create({
|
|
412
410
|
marginsContainer: {
|
|
413
411
|
alignSelf: "stretch",
|
|
@@ -478,3 +476,5 @@ const styles = StyleSheet.create({
|
|
|
478
476
|
maxHeight: deviceHeight,
|
|
479
477
|
},
|
|
480
478
|
});
|
|
479
|
+
|
|
480
|
+
export default withTheme(Picker);
|
|
@@ -3,7 +3,9 @@ import { View, Text } from "react-native";
|
|
|
3
3
|
import { isNumber } from "lodash";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
import IconButton from "./IconButton";
|
|
6
|
-
|
|
6
|
+
import { extractStyles } from "../utilities";
|
|
7
|
+
const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultValue, style, iconSize = 24, iconColor, onChange, theme: { colors, typography }, Icon, }) => {
|
|
8
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
7
9
|
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
|
|
8
10
|
const isValidValue = (valueArg) => valueArg >= min && valueArg <= max;
|
|
9
11
|
const handlePlusOrMinus = (type) => {
|
|
@@ -22,7 +24,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
|
|
|
22
24
|
}
|
|
23
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
26
|
}, [valueProp]);
|
|
25
|
-
return (React.createElement(View, { style: [{ flexDirection: "row" },
|
|
27
|
+
return (React.createElement(View, { style: [{ flexDirection: "row" }, viewStyles] },
|
|
26
28
|
React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/remove", onPress: () => handlePlusOrMinus("minus"), size: iconSize, color: iconColor, disabled: value === min, style: { opacity: value === min ? 0.5 : 1 } }),
|
|
27
29
|
React.createElement(Text, { style: [
|
|
28
30
|
typography.body1,
|
|
@@ -32,7 +34,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
|
|
|
32
34
|
color: colors.medium,
|
|
33
35
|
marginHorizontal: 8,
|
|
34
36
|
},
|
|
35
|
-
|
|
37
|
+
textStyles,
|
|
36
38
|
] }, value),
|
|
37
39
|
React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/add", onPress: () => handlePlusOrMinus("plus"), size: iconSize, color: iconColor, disabled: value === max, style: { opacity: value === max ? 0.5 : 1 } })));
|
|
38
40
|
};
|
|
@@ -6,14 +6,14 @@ import { withTheme } from "../theming";
|
|
|
6
6
|
import type { Theme } from "../styles/DefaultTheme";
|
|
7
7
|
import type { IconSlot } from "../interfaces/Icon";
|
|
8
8
|
import IconButton from "./IconButton";
|
|
9
|
+
import { extractStyles } from "../utilities";
|
|
9
10
|
|
|
10
11
|
type Props = {
|
|
11
12
|
min: number;
|
|
12
13
|
max: number;
|
|
13
14
|
value?: number;
|
|
14
15
|
defaultValue?: number;
|
|
15
|
-
style?: StyleProp<ViewStyle>;
|
|
16
|
-
typeStyle?: StyleProp<TextStyle>;
|
|
16
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
17
17
|
iconSize: number;
|
|
18
18
|
iconColor?: string;
|
|
19
19
|
onChange?: (value: number) => void;
|
|
@@ -26,13 +26,13 @@ const Stepper: FC<Props> = ({
|
|
|
26
26
|
value: valueProp,
|
|
27
27
|
defaultValue,
|
|
28
28
|
style,
|
|
29
|
-
typeStyle,
|
|
30
29
|
iconSize = 24,
|
|
31
30
|
iconColor,
|
|
32
31
|
onChange,
|
|
33
32
|
theme: { colors, typography },
|
|
34
33
|
Icon,
|
|
35
34
|
}) => {
|
|
35
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
36
36
|
const [value, setValue] = useState(defaultValue ?? 0);
|
|
37
37
|
|
|
38
38
|
const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;
|
|
@@ -59,7 +59,7 @@ const Stepper: FC<Props> = ({
|
|
|
59
59
|
}, [valueProp]);
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<View style={[{ flexDirection: "row" },
|
|
62
|
+
<View style={[{ flexDirection: "row" }, viewStyles]}>
|
|
63
63
|
<IconButton
|
|
64
64
|
Icon={Icon}
|
|
65
65
|
icon="MaterialIcons/remove"
|
|
@@ -79,7 +79,7 @@ const Stepper: FC<Props> = ({
|
|
|
79
79
|
color: colors.medium,
|
|
80
80
|
marginHorizontal: 8,
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
textStyles,
|
|
83
83
|
]}
|
|
84
84
|
>
|
|
85
85
|
{value}
|
|
@@ -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: {
|