@draftbit/core 46.4.4-c18fe1.2 → 46.4.4-c96c31.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 +26 -1
- 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 +32 -4
- package/lib/commonjs/components/CardContainerRating.js +34 -6
- package/lib/commonjs/components/CardContainerShortImage.js +28 -4
- package/lib/commonjs/components/CardInline.js +14 -1
- package/lib/commonjs/components/Carousel.js +23 -5
- 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 +43 -5
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +47 -8
- package/lib/commonjs/components/Checkbox/context.js +5 -0
- package/lib/commonjs/components/Checkbox/index.js +4 -0
- package/lib/commonjs/components/CircleImage.js +10 -15
- package/lib/commonjs/components/CircularProgress.js +26 -8
- package/lib/commonjs/components/Config.js +13 -5
- package/lib/commonjs/components/Container.js +11 -0
- package/lib/commonjs/components/DatePicker/DatePicker.js +65 -23
- 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 +27 -1
- package/lib/commonjs/components/DeprecatedFAB.js +26 -0
- package/lib/commonjs/components/Divider.js +9 -0
- package/lib/commonjs/components/Elevation.js +25 -2
- 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 +43 -7
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +27 -8
- package/lib/commonjs/components/Picker/PickerComponent.web.js +43 -7
- 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 +45 -9
- 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 +44 -6
- 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 +36 -4
- package/lib/commonjs/components/Slider.js +21 -0
- package/lib/commonjs/components/StarRating.js +10 -0
- package/lib/commonjs/components/StepIndicator.js +71 -19
- package/lib/commonjs/components/Stepper.js +28 -8
- 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 +53 -8
- package/lib/commonjs/components/TextField.js +118 -35
- 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 -7
- 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 +17 -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/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 +9 -3
- 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 +28 -4
- 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 +33 -12
- package/lib/module/components/Button.js +41 -12
- package/lib/module/components/Card.js +2 -0
- package/lib/module/components/CardBlock.js +20 -4
- 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 +41 -11
- 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 +31 -5
- package/lib/module/components/Checkbox/CheckboxRow.js +34 -8
- package/lib/module/components/Checkbox/context.js +3 -1
- package/lib/module/components/CircleImage.js +3 -0
- package/lib/module/components/CircularProgress.js +22 -8
- package/lib/module/components/Config.js +11 -5
- package/lib/module/components/Container.js +3 -0
- package/lib/module/components/DatePicker/DatePicker.js +73 -30
- 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 +34 -3
- 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 +27 -2
- package/lib/module/components/Layout.js +42 -21
- package/lib/module/components/NumberInput.js +16 -8
- package/lib/module/components/Picker/Picker.js +34 -10
- 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 +14 -9
- package/lib/module/components/Portal/PortalHost.js +44 -15
- 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 +20 -2
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +3 -0
- package/lib/module/components/RadioButton/RadioButtonGroup.js +23 -2
- package/lib/module/components/RadioButton/RadioButtonRow.js +32 -6
- package/lib/module/components/RadioButton/context.js +3 -1
- 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 +18 -10
- package/lib/module/components/Surface.js +20 -1
- package/lib/module/components/Swiper/Swiper.js +4 -0
- package/lib/module/components/Swiper/SwiperItem.js +2 -0
- package/lib/module/components/Switch.js +27 -12
- package/lib/module/components/Text.js +10 -3
- package/lib/module/components/TextField.js +105 -35
- 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 +16 -5
- package/lib/module/mappings/Fetch.js +1 -0
- package/lib/module/mappings/FieldSearchBarFull.js +5 -3
- 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 +8 -3
- 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/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/components/Stepper.d.ts +1 -2
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/package.json +3 -5
- package/src/components/Carousel.js +2 -2
- package/src/components/Carousel.tsx +2 -2
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/components/Picker/Picker.js +1 -1
- package/src/components/Picker/Picker.tsx +2 -2
- package/src/components/Stepper.js +6 -3
- package/src/components/Stepper.tsx +6 -6
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/src/mappings/Stepper.js +5 -2
- package/src/mappings/Stepper.ts +5 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +0 -58
- package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +0 -83
- package/lib/commonjs/components/BottomSheet/index.js +0 -13
- package/lib/commonjs/components/BottomSheet/types.js +0 -5
- package/lib/commonjs/mappings/BottomSheet.js +0 -20
- package/lib/module/components/BottomSheet/BottomSheet.native.js +0 -49
- package/lib/module/components/BottomSheet/BottomSheet.web.js +0 -75
- package/lib/module/components/BottomSheet/index.js +0 -2
- package/lib/module/components/BottomSheet/types.js +0 -1
- package/lib/module/mappings/BottomSheet.js +0 -13
- package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +0 -4
- package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +0 -4
- package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -1
- package/lib/typescript/src/components/BottomSheet/types.d.ts +0 -8
- package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -19
- package/src/components/BottomSheet/BottomSheet.native.js +0 -37
- package/src/components/BottomSheet/BottomSheet.native.tsx +0 -60
- package/src/components/BottomSheet/BottomSheet.web.js +0 -56
- package/src/components/BottomSheet/BottomSheet.web.tsx +0 -90
- package/src/components/BottomSheet/index.js +0 -2
- package/src/components/BottomSheet/index.tsx +0 -2
- package/src/components/BottomSheet/types.js +0 -1
- package/src/components/BottomSheet/types.tsx +0 -8
- package/src/mappings/BottomSheet.js +0 -20
- package/src/mappings/BottomSheet.ts +0 -25
|
@@ -6,6 +6,7 @@ import { withTheme } from "../../theming";
|
|
|
6
6
|
import Portal from "../Portal/Portal";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
8
|
import DateTimePicker from "./DatePickerComponent";
|
|
9
|
+
import { extractStyles } from "../../utilities";
|
|
9
10
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
10
11
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
11
12
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -24,7 +25,7 @@ const MONTHS = [
|
|
|
24
25
|
"November",
|
|
25
26
|
"December",
|
|
26
27
|
];
|
|
27
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, placeholder, ...props }) => {
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
28
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
29
30
|
React.useEffect(() => {
|
|
30
31
|
if (defaultValue != null) {
|
|
@@ -36,6 +37,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
36
37
|
const [placeholder1, setPlaceholder1] = React.useState("");
|
|
37
38
|
const [focused, setFocused] = React.useState(false);
|
|
38
39
|
const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
|
|
40
|
+
const { textStyles } = extractStyles(style);
|
|
39
41
|
const getValidDate = () => {
|
|
40
42
|
if (!value) {
|
|
41
43
|
return new Date();
|
|
@@ -125,8 +127,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
125
127
|
};
|
|
126
128
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
127
129
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
128
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
129
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
130
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
131
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
132
|
+
? labelSize
|
|
133
|
+
: typography.caption.fontSize;
|
|
130
134
|
const hasActiveOutline = focused;
|
|
131
135
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
132
136
|
inputTextColor = colors.strong;
|
|
@@ -138,9 +142,9 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
138
142
|
backgroundColor = colors.divider;
|
|
139
143
|
}
|
|
140
144
|
else {
|
|
141
|
-
activeColor = colors.primary;
|
|
142
|
-
placeholderColor = borderColor = colors.light;
|
|
143
|
-
underlineColor = colors.light;
|
|
145
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
146
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
147
|
+
underlineColor = inputBorderColor || colors.light;
|
|
144
148
|
backgroundColor = colors.background;
|
|
145
149
|
}
|
|
146
150
|
const { lineHeight, ...subtitle1 } = typography.subtitle1;
|
|
@@ -202,6 +206,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
202
206
|
const labelStyle = {
|
|
203
207
|
...typography.subtitle1,
|
|
204
208
|
top: type === "solid" ? 16 : 0,
|
|
209
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
205
210
|
left: leftIconName && leftIconMode === "inset"
|
|
206
211
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
207
212
|
: 0,
|
|
@@ -245,6 +250,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
245
250
|
styles.input,
|
|
246
251
|
inputStyle,
|
|
247
252
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
253
|
+
textStyles,
|
|
248
254
|
];
|
|
249
255
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
250
256
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -282,7 +288,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
282
288
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
283
289
|
labelStyle,
|
|
284
290
|
{
|
|
285
|
-
color: colors.light,
|
|
291
|
+
color: labelColor || colors.light,
|
|
286
292
|
opacity: labeled.interpolate({
|
|
287
293
|
inputRange: [0, 1],
|
|
288
294
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -294,7 +300,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
294
300
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
295
301
|
labelStyle,
|
|
296
302
|
{
|
|
297
|
-
color:
|
|
303
|
+
color: labelColor || placeholder,
|
|
298
304
|
opacity: hasActiveOutline ? labeled : 1,
|
|
299
305
|
},
|
|
300
306
|
], numberOfLines: 1 }, label))) : null,
|
|
@@ -23,6 +23,7 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
+
import { extractStyles } from "../../utilities";
|
|
26
27
|
|
|
27
28
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
28
29
|
|
|
@@ -47,10 +48,14 @@ type Props = {
|
|
|
47
48
|
mode?: "date" | "time" | "datetime";
|
|
48
49
|
type?: "solid" | "underline";
|
|
49
50
|
label?: string;
|
|
51
|
+
labelSize?: number;
|
|
52
|
+
labelColor: string;
|
|
50
53
|
placeholder?: string;
|
|
51
54
|
leftIconName?: string;
|
|
52
55
|
leftIconMode?: "outset" | "inset";
|
|
53
56
|
rightIconName?: string;
|
|
57
|
+
borderColor?: string;
|
|
58
|
+
borderColorActive?: string;
|
|
54
59
|
} & IconSlot &
|
|
55
60
|
TextInputProps;
|
|
56
61
|
|
|
@@ -84,7 +89,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
84
89
|
rightIconName,
|
|
85
90
|
leftIconMode = "inset",
|
|
86
91
|
label,
|
|
92
|
+
labelSize,
|
|
93
|
+
labelColor,
|
|
87
94
|
placeholder,
|
|
95
|
+
borderColor: inputBorderColor,
|
|
96
|
+
borderColorActive: inputBorderColorActive,
|
|
88
97
|
...props
|
|
89
98
|
}) => {
|
|
90
99
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -106,6 +115,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
106
115
|
width: number;
|
|
107
116
|
}>({ measured: false, width: 0 });
|
|
108
117
|
|
|
118
|
+
const { textStyles } = extractStyles(style);
|
|
119
|
+
|
|
109
120
|
const getValidDate = (): Date => {
|
|
110
121
|
if (!value) {
|
|
111
122
|
return new Date();
|
|
@@ -211,8 +222,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
211
222
|
|
|
212
223
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
213
224
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
214
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
215
|
-
|
|
225
|
+
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
226
|
+
textStyles?.fontSize || typography.subtitle1.fontSize;
|
|
227
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
228
|
+
? labelSize
|
|
229
|
+
: typography.caption.fontSize;
|
|
216
230
|
|
|
217
231
|
const hasActiveOutline = focused;
|
|
218
232
|
|
|
@@ -233,9 +247,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
233
247
|
underlineColor = "transparent";
|
|
234
248
|
backgroundColor = colors.divider;
|
|
235
249
|
} else {
|
|
236
|
-
activeColor = colors.primary;
|
|
237
|
-
placeholderColor = borderColor = colors.light;
|
|
238
|
-
underlineColor = colors.light;
|
|
250
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
251
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
252
|
+
underlineColor = inputBorderColor || colors.light;
|
|
239
253
|
backgroundColor = colors.background;
|
|
240
254
|
}
|
|
241
255
|
|
|
@@ -306,6 +320,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
306
320
|
const labelStyle = {
|
|
307
321
|
...typography.subtitle1,
|
|
308
322
|
top: type === "solid" ? 16 : 0,
|
|
323
|
+
fontFamily: textStyles?.fontFamily,
|
|
309
324
|
left:
|
|
310
325
|
leftIconName && leftIconMode === "inset"
|
|
311
326
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
@@ -351,6 +366,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
351
366
|
styles.input,
|
|
352
367
|
inputStyle,
|
|
353
368
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
369
|
+
textStyles,
|
|
354
370
|
];
|
|
355
371
|
|
|
356
372
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -406,7 +422,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
406
422
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
407
423
|
labelStyle,
|
|
408
424
|
{
|
|
409
|
-
color: colors.light,
|
|
425
|
+
color: labelColor || colors.light,
|
|
410
426
|
opacity: labeled.interpolate({
|
|
411
427
|
inputRange: [0, 1],
|
|
412
428
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -423,7 +439,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
423
439
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
424
440
|
labelStyle,
|
|
425
441
|
{
|
|
426
|
-
color:
|
|
442
|
+
color: labelColor || placeholder,
|
|
427
443
|
opacity: hasActiveOutline ? labeled : 1,
|
|
428
444
|
},
|
|
429
445
|
]}
|
|
@@ -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,8 +34,9 @@ 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
|
};
|
|
41
|
+
//oh hello
|
|
39
42
|
export default withTheme(Stepper);
|
|
@@ -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}
|
|
@@ -97,5 +97,5 @@ const Stepper: FC<Props> = ({
|
|
|
97
97
|
</View>
|
|
98
98
|
);
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
//oh hello
|
|
101
101
|
export default withTheme(Stepper);
|
package/src/index.js
CHANGED
|
@@ -29,7 +29,6 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
33
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
34
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
35
34
|
/* Deprecated: Fix or Delete! */
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
group: GROUPS.data,
|
|
12
12
|
},
|
|
13
|
+
labelSize: createNumberProp({
|
|
14
|
+
label: "Label Size",
|
|
15
|
+
}),
|
|
16
|
+
labelColor: createColorProp({
|
|
17
|
+
label: "Label Color",
|
|
18
|
+
}),
|
|
13
19
|
mode: {
|
|
14
20
|
label: "Mode",
|
|
15
21
|
description: "Choose between date, time and datetime",
|
|
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
|
|
|
21
27
|
options: ["date", "time", "datetime"],
|
|
22
28
|
group: GROUPS.basic,
|
|
23
29
|
},
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color",
|
|
32
|
+
}),
|
|
33
|
+
borderColorActive: createColorProp({
|
|
34
|
+
label: "Border Color",
|
|
35
|
+
}),
|
|
24
36
|
format: {
|
|
25
37
|
label: "Format",
|
|
26
38
|
description: "Create an output format for the date.",
|
|
@@ -139,6 +151,14 @@ export const SEED_DATA = [
|
|
|
139
151
|
category: COMPONENT_TYPES.input,
|
|
140
152
|
layout: null,
|
|
141
153
|
triggers: [Triggers.OnDateChange],
|
|
154
|
+
StylesPanelSections: [
|
|
155
|
+
StylesPanelSections.Background,
|
|
156
|
+
StylesPanelSections.Borders,
|
|
157
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
158
|
+
StylesPanelSections.Position,
|
|
159
|
+
StylesPanelSections.Size,
|
|
160
|
+
StylesPanelSections.Typography,
|
|
161
|
+
],
|
|
142
162
|
props: {
|
|
143
163
|
...SEED_DATA_PROPS,
|
|
144
164
|
type: {
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
FIELD_NAME,
|
|
6
6
|
GROUPS,
|
|
7
7
|
Triggers,
|
|
8
|
+
StylesPanelSections,
|
|
9
|
+
createNumberProp,
|
|
10
|
+
createColorProp,
|
|
8
11
|
} from "@draftbit/types";
|
|
9
12
|
|
|
10
13
|
const SEED_DATA_PROPS = {
|
|
@@ -18,6 +21,12 @@ const SEED_DATA_PROPS = {
|
|
|
18
21
|
required: true,
|
|
19
22
|
group: GROUPS.data,
|
|
20
23
|
},
|
|
24
|
+
labelSize: createNumberProp({
|
|
25
|
+
label: "Label Size",
|
|
26
|
+
}),
|
|
27
|
+
labelColor: createColorProp({
|
|
28
|
+
label: "Label Color",
|
|
29
|
+
}),
|
|
21
30
|
mode: {
|
|
22
31
|
label: "Mode",
|
|
23
32
|
description: "Choose between date, time and datetime",
|
|
@@ -29,6 +38,12 @@ const SEED_DATA_PROPS = {
|
|
|
29
38
|
options: ["date", "time", "datetime"],
|
|
30
39
|
group: GROUPS.basic,
|
|
31
40
|
},
|
|
41
|
+
borderColor: createColorProp({
|
|
42
|
+
label: "Border Color",
|
|
43
|
+
}),
|
|
44
|
+
borderColorActive: createColorProp({
|
|
45
|
+
label: "Border Color",
|
|
46
|
+
}),
|
|
32
47
|
format: {
|
|
33
48
|
label: "Format",
|
|
34
49
|
description: "Create an output format for the date.",
|
|
@@ -150,6 +165,14 @@ export const SEED_DATA = [
|
|
|
150
165
|
category: COMPONENT_TYPES.input,
|
|
151
166
|
layout: null,
|
|
152
167
|
triggers: [Triggers.OnDateChange],
|
|
168
|
+
StylesPanelSections: [
|
|
169
|
+
StylesPanelSections.Background,
|
|
170
|
+
StylesPanelSections.Borders,
|
|
171
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
172
|
+
StylesPanelSections.Position,
|
|
173
|
+
StylesPanelSections.Size,
|
|
174
|
+
StylesPanelSections.Typography,
|
|
175
|
+
],
|
|
153
176
|
props: {
|
|
154
177
|
...SEED_DATA_PROPS,
|
|
155
178
|
type: {
|
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,58 +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 _reactNative = require("react-native");
|
|
9
|
-
var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
|
|
10
|
-
var _utilities = require("../../utilities");
|
|
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
|
-
const BottomSheetComponent = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
style,
|
|
16
|
-
children,
|
|
17
|
-
step
|
|
18
|
-
} = _ref;
|
|
19
|
-
const bottomSheetRef = (0, _react.useRef)(null);
|
|
20
|
-
const {
|
|
21
|
-
viewStyles
|
|
22
|
-
} = (0, _utilities.extractStyles)(style);
|
|
23
|
-
|
|
24
|
-
// variables
|
|
25
|
-
const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []);
|
|
26
|
-
|
|
27
|
-
// callbacks
|
|
28
|
-
const handleSheetChanges = (0, _react.useCallback)(index => {
|
|
29
|
-
console.log("handleSheetChanges", index);
|
|
30
|
-
}, []);
|
|
31
|
-
_react.default.useEffect(() => {
|
|
32
|
-
if (step === -1) {
|
|
33
|
-
var _bottomSheetRef$curre;
|
|
34
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
|
|
35
|
-
}
|
|
36
|
-
}, [step]);
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
38
|
-
style: [containerStyle.container, viewStyles, {
|
|
39
|
-
backgroundColor: step !== -1 ? "grey" : "transparent"
|
|
40
|
-
}]
|
|
41
|
-
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
|
|
42
|
-
ref: bottomSheetRef,
|
|
43
|
-
index: step,
|
|
44
|
-
snapPoints: snapPoints,
|
|
45
|
-
onChange: handleSheetChanges
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
|
|
47
|
-
};
|
|
48
|
-
var _default = BottomSheetComponent;
|
|
49
|
-
exports.default = _default;
|
|
50
|
-
const containerStyle = _reactNative.StyleSheet.create({
|
|
51
|
-
container: {
|
|
52
|
-
flex: 1
|
|
53
|
-
},
|
|
54
|
-
contentContainer: {
|
|
55
|
-
flex: 1,
|
|
56
|
-
alignItems: "center"
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
|
|
10
|
-
var _utilities = require("../../utilities");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const windowHeight = _reactNative.Dimensions.get("window").height;
|
|
13
|
-
const BottomSheetComponent = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
style,
|
|
16
|
-
children,
|
|
17
|
-
step
|
|
18
|
-
} = _ref;
|
|
19
|
-
const {
|
|
20
|
-
viewStyles
|
|
21
|
-
} = (0, _utilities.extractStyles)(style);
|
|
22
|
-
const bottomSheetRef = _react.default.useRef();
|
|
23
|
-
const webStep = _react.default.useMemo(() => step + 1, [step]);
|
|
24
|
-
const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
|
|
25
|
-
_react.default.useEffect(() => {
|
|
26
|
-
var _bottomSheetRef$curre;
|
|
27
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
|
|
28
|
-
// bottomSheetRef.current.snapTo(step);
|
|
29
|
-
}, [webStep, step, snapPoints]);
|
|
30
|
-
if (step === -1) {
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
34
|
-
style: styles.container
|
|
35
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
|
|
36
|
-
ref: bottomSheetRef,
|
|
37
|
-
componentType: "ScrollView",
|
|
38
|
-
snapPoints: snapPoints,
|
|
39
|
-
initialSnapIndex: 0,
|
|
40
|
-
renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
41
|
-
style: styles.header
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
43
|
-
style: styles.panelHandle
|
|
44
|
-
})),
|
|
45
|
-
contentContainerStyle: styles.contentContainerStyle
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
47
|
-
style: {
|
|
48
|
-
...styles.container,
|
|
49
|
-
...viewStyles,
|
|
50
|
-
backgroundColor: webStep !== -1 ? "grey" : "transparent"
|
|
51
|
-
}
|
|
52
|
-
}, children)));
|
|
53
|
-
};
|
|
54
|
-
var _default = BottomSheetComponent;
|
|
55
|
-
exports.default = _default;
|
|
56
|
-
const styles = _reactNative.StyleSheet.create({
|
|
57
|
-
container: {
|
|
58
|
-
flex: 1
|
|
59
|
-
},
|
|
60
|
-
contentContainerStyle: {
|
|
61
|
-
padding: 16
|
|
62
|
-
},
|
|
63
|
-
header: {
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
backgroundColor: "white",
|
|
66
|
-
paddingVertical: 20,
|
|
67
|
-
borderTopLeftRadius: 20,
|
|
68
|
-
borderTopRightRadius: 20
|
|
69
|
-
},
|
|
70
|
-
panelHandle: {
|
|
71
|
-
width: 40,
|
|
72
|
-
height: 2,
|
|
73
|
-
backgroundColor: "rgba(0,0,0,0.3)",
|
|
74
|
-
borderRadius: 4
|
|
75
|
-
},
|
|
76
|
-
item: {
|
|
77
|
-
padding: 20,
|
|
78
|
-
justifyContent: "center",
|
|
79
|
-
backgroundColor: "white",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
marginVertical: 10
|
|
82
|
-
}
|
|
83
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BottomSheet", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _BottomSheet.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,20 +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: "Bottom Sheet",
|
|
10
|
-
tag: "BottomSheet",
|
|
11
|
-
category: _types.COMPONENT_TYPES.container,
|
|
12
|
-
stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
13
|
-
props: {
|
|
14
|
-
step: (0, _types.createNumberProp)({
|
|
15
|
-
label: "Step",
|
|
16
|
-
description: "Step can be -1, 0, 1, or 2."
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.SEED_DATA = SEED_DATA;
|