@janiscommerce/ui-native 1.4.0 → 1.6.0
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/dist/components/FullScreenMessage/index.d.ts +21 -0
- package/dist/components/FullScreenMessage/index.js +66 -0
- package/dist/{src/components → components}/Input/utils/index.d.ts +3 -3
- package/dist/components/LayoutWithBottomButtons/index.d.ts +11 -0
- package/dist/components/LayoutWithBottomButtons/index.js +71 -0
- package/dist/components/LayoutWithBottomButtons/utils/index.d.ts +362 -0
- package/dist/components/LayoutWithBottomButtons/utils/index.js +135 -0
- package/dist/{src/index.d.ts → index.d.ts} +3 -1
- package/dist/{src/index.js → index.js} +3 -1
- package/dist/{src/scale → scale}/index.js +2 -2
- package/dist/{src/theme → theme}/palette.d.ts +2 -13
- package/dist/{src/ts → ts}/interfaces/colors.d.ts +17 -0
- package/package.json +4 -4
- package/dist/env.json +0 -1
- /package/dist/{src/components → components}/Avatar/index.d.ts +0 -0
- /package/dist/{src/components → components}/Avatar/index.js +0 -0
- /package/dist/{src/components → components}/Avatar/utils/formatPlaceholder/index.d.ts +0 -0
- /package/dist/{src/components → components}/Avatar/utils/formatPlaceholder/index.js +0 -0
- /package/dist/{src/components → components}/BaseButton/index.d.ts +0 -0
- /package/dist/{src/components → components}/BaseButton/index.js +0 -0
- /package/dist/{src/components → components}/Carousel/index.d.ts +0 -0
- /package/dist/{src/components → components}/Carousel/index.js +0 -0
- /package/dist/{src/components → components}/Carousel/utils/index.d.ts +0 -0
- /package/dist/{src/components → components}/Carousel/utils/index.js +0 -0
- /package/dist/{src/components → components}/CheckBox/icon/CheckedIcon.d.ts +0 -0
- /package/dist/{src/components → components}/CheckBox/icon/CheckedIcon.js +0 -0
- /package/dist/{src/components → components}/CheckBox/index.d.ts +0 -0
- /package/dist/{src/components → components}/CheckBox/index.js +0 -0
- /package/dist/{src/components → components}/Icon/assets/fonts/selection.json +0 -0
- /package/dist/{src/components → components}/Icon/index.d.ts +0 -0
- /package/dist/{src/components → components}/Icon/index.js +0 -0
- /package/dist/{src/components → components}/Image/index.d.ts +0 -0
- /package/dist/{src/components → components}/Image/index.js +0 -0
- /package/dist/{src/components → components}/Input/index.d.ts +0 -0
- /package/dist/{src/components → components}/Input/index.js +0 -0
- /package/dist/{src/components → components}/Input/utils/index.js +0 -0
- /package/dist/{src/components → components}/List/index.d.ts +0 -0
- /package/dist/{src/components → components}/List/index.js +0 -0
- /package/dist/{src/components → components}/Loading/LoadingSvg/index.d.ts +0 -0
- /package/dist/{src/components → components}/Loading/LoadingSvg/index.js +0 -0
- /package/dist/{src/components → components}/Loading/index.d.ts +0 -0
- /package/dist/{src/components → components}/Loading/index.js +0 -0
- /package/dist/{src/components → components}/LoadingFullScreen/index.d.ts +0 -0
- /package/dist/{src/components → components}/LoadingFullScreen/index.js +0 -0
- /package/dist/{src/components → components}/ProgressBar/index.d.ts +0 -0
- /package/dist/{src/components → components}/ProgressBar/index.js +0 -0
- /package/dist/{src/components → components}/ProgressBar/utils/index.d.ts +0 -0
- /package/dist/{src/components → components}/ProgressBar/utils/index.js +0 -0
- /package/dist/{src/components → components}/RadioButton/index.d.ts +0 -0
- /package/dist/{src/components → components}/RadioButton/index.js +0 -0
- /package/dist/{src/components → components}/Select/Components/Dropdown/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/Components/Dropdown/index.js +0 -0
- /package/dist/{src/components → components}/Select/Components/Modal/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/Components/Modal/index.js +0 -0
- /package/dist/{src/components → components}/Select/Components/Options/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/Components/Options/index.js +0 -0
- /package/dist/{src/components → components}/Select/Components/SwitcherComponent/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/Components/SwitcherComponent/index.js +0 -0
- /package/dist/{src/components → components}/Select/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/index.js +0 -0
- /package/dist/{src/components → components}/Select/utils/index.d.ts +0 -0
- /package/dist/{src/components → components}/Select/utils/index.js +0 -0
- /package/dist/{src/components → components}/StatusChip/index.d.ts +0 -0
- /package/dist/{src/components → components}/StatusChip/index.js +0 -0
- /package/dist/{src/components → components}/Svg/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/EmptyIllustration/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/EmptyIllustration/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/EmptyListIllustration/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/EmptyListIllustration/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/JanisLogo/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/JanisLogo/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/JanisLogoColor/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/JanisLogoColor/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/LoginIllustration/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/LoginIllustration/index.js +0 -0
- /package/dist/{src/components → components}/Svg/svgs/NoNotifications/index.d.ts +0 -0
- /package/dist/{src/components → components}/Svg/svgs/NoNotifications/index.js +0 -0
- /package/dist/{src/components → components}/SwipeUp/childComponents/index.d.ts +0 -0
- /package/dist/{src/components → components}/SwipeUp/childComponents/index.js +0 -0
- /package/dist/{src/components → components}/SwipeUp/index.d.ts +0 -0
- /package/dist/{src/components → components}/SwipeUp/index.js +0 -0
- /package/dist/{src/components → components}/Text/index.d.ts +0 -0
- /package/dist/{src/components → components}/Text/index.js +0 -0
- /package/dist/{src/scale → scale}/index.d.ts +0 -0
- /package/dist/{src/theme → theme}/palette.js +0 -0
- /package/dist/{src/ts → ts}/interfaces/colors.js +0 -0
- /package/dist/{src/ts → ts}/interfaces/svgs.d.ts +0 -0
- /package/dist/{src/ts → ts}/interfaces/svgs.js +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
|
+
export declare enum animationTypes {
|
|
3
|
+
Slide = "slide",
|
|
4
|
+
Fade = "fade",
|
|
5
|
+
None = "none"
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
isVisible?: boolean;
|
|
10
|
+
title?: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
iconName?: string;
|
|
13
|
+
textsColor?: string;
|
|
14
|
+
iconColor?: string;
|
|
15
|
+
animationType?: animationTypes;
|
|
16
|
+
duration?: number;
|
|
17
|
+
onEndDuration?: () => void;
|
|
18
|
+
children?: ReactElement | null;
|
|
19
|
+
}
|
|
20
|
+
declare const FullScreenMessage: FC<Props>;
|
|
21
|
+
export default FullScreenMessage;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Modal, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { moderateScale, scaledForDevice } from '../../scale';
|
|
4
|
+
import { base, primary } from '../../theme/palette';
|
|
5
|
+
import Icon from '../Icon';
|
|
6
|
+
import Text from '../Text';
|
|
7
|
+
export var animationTypes;
|
|
8
|
+
(function (animationTypes) {
|
|
9
|
+
animationTypes["Slide"] = "slide";
|
|
10
|
+
animationTypes["Fade"] = "fade";
|
|
11
|
+
animationTypes["None"] = "none";
|
|
12
|
+
})(animationTypes || (animationTypes = {}));
|
|
13
|
+
const FullScreenMessage = ({ backgroundColor = primary.main, title = '', isVisible = false, subtitle = '', iconName = '', textsColor = base.white, iconColor = base.white, animationType = animationTypes.Slide, duration = 3000, onEndDuration = () => { }, children = null, ...props }) => {
|
|
14
|
+
const validTitle = !!title && typeof title === 'string';
|
|
15
|
+
const validSubtitle = !!subtitle && typeof subtitle === 'string';
|
|
16
|
+
const validIconName = !!iconName && typeof iconName === 'string';
|
|
17
|
+
const validPaddingHorizontal = scaledForDevice(50, moderateScale);
|
|
18
|
+
const validMarginBottomTitle = scaledForDevice(30, moderateScale);
|
|
19
|
+
const validMarginBottomSubtitle = scaledForDevice(50, moderateScale);
|
|
20
|
+
const validFontTitle = scaledForDevice(32, moderateScale);
|
|
21
|
+
const validFontSubtitle = scaledForDevice(16, moderateScale);
|
|
22
|
+
const validLineHeightTitle = scaledForDevice(40, moderateScale);
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
container: {
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
width: '100%',
|
|
28
|
+
height: '100%',
|
|
29
|
+
backgroundColor: backgroundColor,
|
|
30
|
+
},
|
|
31
|
+
title: {
|
|
32
|
+
fontWeight: 'bold',
|
|
33
|
+
textAlign: 'center',
|
|
34
|
+
color: textsColor,
|
|
35
|
+
paddingHorizontal: validPaddingHorizontal,
|
|
36
|
+
marginBottom: validMarginBottomTitle,
|
|
37
|
+
fontSize: validFontTitle,
|
|
38
|
+
lineHeight: validLineHeightTitle,
|
|
39
|
+
},
|
|
40
|
+
subtitle: {
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
color: textsColor,
|
|
43
|
+
paddingHorizontal: validPaddingHorizontal,
|
|
44
|
+
marginBottom: validMarginBottomSubtitle,
|
|
45
|
+
fontSize: validFontSubtitle,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (isVisible) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
onEndDuration();
|
|
52
|
+
}, duration);
|
|
53
|
+
}
|
|
54
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
+
}, [isVisible]);
|
|
56
|
+
return (<Modal visible={isVisible} animationType={animationType} transparent {...props}>
|
|
57
|
+
<View style={styles.container}>
|
|
58
|
+
{children ?? (<>
|
|
59
|
+
{validTitle && <Text style={styles.title}>{title}</Text>}
|
|
60
|
+
{validSubtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
|
|
61
|
+
{validIconName && <Icon color={iconColor} size={130} name={iconName}/>}
|
|
62
|
+
</>)}
|
|
63
|
+
</View>
|
|
64
|
+
</Modal>);
|
|
65
|
+
};
|
|
66
|
+
export default FullScreenMessage;
|
|
@@ -20,9 +20,9 @@ interface raiseLabelProps {
|
|
|
20
20
|
inputState: string;
|
|
21
21
|
}
|
|
22
22
|
export declare const getInputInitialState: (value: string) => "incomplete" | "complete";
|
|
23
|
-
export declare const getBorderColor: ({ inputState, hasMessage, status, inputColor, }: getBorderColorProps) =>
|
|
24
|
-
export declare const getLabelColor: ({ disabled, readOnly, inputColor, inputState, statusMessage, status, }: getLabelColorProps) =>
|
|
23
|
+
export declare const getBorderColor: ({ inputState, hasMessage, status, inputColor, }: getBorderColorProps) => any;
|
|
24
|
+
export declare const getLabelColor: ({ disabled, readOnly, inputColor, inputState, statusMessage, status, }: getLabelColorProps) => any;
|
|
25
25
|
export declare const raiseLabel: ({ disabled, hasMessage, inputState }: raiseLabelProps) => boolean;
|
|
26
26
|
export declare const showStatusMessage: (hasMessage: boolean, inputState: string) => boolean;
|
|
27
|
-
export declare const getStatusMessageColor: (status: Status) =>
|
|
27
|
+
export declare const getStatusMessageColor: (status: Status) => any;
|
|
28
28
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
import type { IlayoutButtons } from './utils';
|
|
4
|
+
interface LayoutWithBottomButtonsProps extends ViewProps {
|
|
5
|
+
children: ReactElement | string;
|
|
6
|
+
buttons: Array<IlayoutButtons>;
|
|
7
|
+
variant?: string;
|
|
8
|
+
buttonBackgroundColor?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const LayoutWithBottomButtons: ({ children, buttons, variant, buttonBackgroundColor, ...props }: LayoutWithBottomButtonsProps) => React.JSX.Element | null;
|
|
11
|
+
export default LayoutWithBottomButtons;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import BaseButton from '../BaseButton';
|
|
4
|
+
import { palette } from '../../theme/palette';
|
|
5
|
+
import { moderateScale, scaledForDevice } from '../../scale';
|
|
6
|
+
import { validVariants, parseButtonsStyles, buttonWrapperVariantStyles } from './utils';
|
|
7
|
+
const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgroundColor, ...props }) => {
|
|
8
|
+
if (!children) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (!(buttons instanceof Array) || !buttons.length) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const selectedVariant = validVariants[variant] || validVariants.default;
|
|
15
|
+
const parsedButtons = parseButtonsStyles(buttons, selectedVariant);
|
|
16
|
+
const validBtnBgColor = buttonBackgroundColor || palette.base.white;
|
|
17
|
+
if (!(parsedButtons instanceof Array) || !parsedButtons.length) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
Container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
backgroundColor: 'transparent',
|
|
24
|
+
},
|
|
25
|
+
FullButtonsRoundedWrapper: {
|
|
26
|
+
...buttonWrapperVariantStyles(selectedVariant),
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
backgroundColor: validBtnBgColor,
|
|
30
|
+
marginTop: 'auto',
|
|
31
|
+
},
|
|
32
|
+
TwoButtonsWrapper: {
|
|
33
|
+
marginTop: scaledForDevice(8, moderateScale),
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
},
|
|
37
|
+
ButtonsWrapper: {
|
|
38
|
+
...buttonWrapperVariantStyles(selectedVariant),
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
justifyContent: 'space-between',
|
|
41
|
+
backgroundColor: validBtnBgColor,
|
|
42
|
+
marginTop: 'auto',
|
|
43
|
+
flexWrap: 'wrap',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const ThreeButtonsLayout = () => {
|
|
47
|
+
const newBtns = [...parsedButtons];
|
|
48
|
+
const fullWidthIdx = newBtns.findIndex((btn) => btn.style?.width === '100%');
|
|
49
|
+
const fullWidthButton = newBtns[fullWidthIdx];
|
|
50
|
+
newBtns.splice(fullWidthIdx, 1);
|
|
51
|
+
return (<View style={[styles.Container]} {...props}>
|
|
52
|
+
{children}
|
|
53
|
+
<View style={[styles.FullButtonsRoundedWrapper]}>
|
|
54
|
+
<BaseButton {...fullWidthButton}/>
|
|
55
|
+
<View style={[styles.TwoButtonsWrapper]}>
|
|
56
|
+
{newBtns.map(({ ...buttonData }, index) => (<BaseButton key={index.toString()} {...buttonData}/>))}
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
</View>);
|
|
60
|
+
};
|
|
61
|
+
if (parsedButtons.length === 3 && selectedVariant === validVariants.rounded) {
|
|
62
|
+
return ThreeButtonsLayout();
|
|
63
|
+
}
|
|
64
|
+
return (<View style={[styles.Container]} {...props}>
|
|
65
|
+
{children}
|
|
66
|
+
<View style={[styles.ButtonsWrapper]}>
|
|
67
|
+
{parsedButtons.map(({ ...buttonData }, index) => (<BaseButton key={index.toString()} {...buttonData}/>))}
|
|
68
|
+
</View>
|
|
69
|
+
</View>);
|
|
70
|
+
};
|
|
71
|
+
export default LayoutWithBottomButtons;
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
export interface IlayoutButtons extends PressableProps {
|
|
4
|
+
title?: string | null;
|
|
5
|
+
icon?: string;
|
|
6
|
+
iconRight?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
borderRadius?: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
pressedColor?: string;
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
iconStyle?: ViewStyle;
|
|
13
|
+
textStyle?: TextStyle;
|
|
14
|
+
width?: number | string;
|
|
15
|
+
flex?: number;
|
|
16
|
+
}
|
|
17
|
+
interface IvalidVariants {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
squared: string;
|
|
20
|
+
rounded: string;
|
|
21
|
+
default: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const validVariants: IvalidVariants;
|
|
24
|
+
export declare const buttonWrapperVariantStyles: (variant: string) => {
|
|
25
|
+
padding?: number | undefined;
|
|
26
|
+
};
|
|
27
|
+
export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, variant: string) => {
|
|
28
|
+
pressedColor: any;
|
|
29
|
+
style: {
|
|
30
|
+
borderRadius?: number | undefined;
|
|
31
|
+
height?: string | number | undefined;
|
|
32
|
+
backgroundColor: any;
|
|
33
|
+
width: string | number;
|
|
34
|
+
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
35
|
+
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
36
|
+
borderBottomEndRadius?: number | undefined;
|
|
37
|
+
borderBottomLeftRadius?: number | undefined;
|
|
38
|
+
borderBottomRightRadius?: number | undefined;
|
|
39
|
+
borderBottomStartRadius?: number | undefined;
|
|
40
|
+
borderBottomWidth?: number | undefined;
|
|
41
|
+
borderColor?: import("react-native").ColorValue | undefined;
|
|
42
|
+
borderEndColor?: import("react-native").ColorValue | undefined;
|
|
43
|
+
borderLeftColor?: import("react-native").ColorValue | undefined;
|
|
44
|
+
borderLeftWidth?: number | undefined;
|
|
45
|
+
borderRightColor?: import("react-native").ColorValue | undefined;
|
|
46
|
+
borderRightWidth?: number | undefined;
|
|
47
|
+
borderStartColor?: import("react-native").ColorValue | undefined;
|
|
48
|
+
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
49
|
+
borderTopColor?: import("react-native").ColorValue | undefined;
|
|
50
|
+
borderTopEndRadius?: number | undefined;
|
|
51
|
+
borderTopLeftRadius?: number | undefined;
|
|
52
|
+
borderTopRightRadius?: number | undefined;
|
|
53
|
+
borderTopStartRadius?: number | undefined;
|
|
54
|
+
borderTopWidth?: number | undefined;
|
|
55
|
+
borderWidth?: number | undefined;
|
|
56
|
+
opacity?: number | undefined;
|
|
57
|
+
testID?: string | undefined;
|
|
58
|
+
elevation?: number | undefined;
|
|
59
|
+
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
60
|
+
alignItems?: import("react-native").FlexAlignType | undefined;
|
|
61
|
+
alignSelf?: "auto" | import("react-native").FlexAlignType | undefined;
|
|
62
|
+
aspectRatio?: number | undefined;
|
|
63
|
+
borderEndWidth?: string | number | undefined;
|
|
64
|
+
borderStartWidth?: string | number | undefined;
|
|
65
|
+
bottom?: string | number | undefined;
|
|
66
|
+
display?: "none" | "flex" | undefined;
|
|
67
|
+
end?: string | number | undefined;
|
|
68
|
+
flex?: number | undefined;
|
|
69
|
+
flexBasis?: string | number | undefined;
|
|
70
|
+
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
71
|
+
flexGrow?: number | undefined;
|
|
72
|
+
flexShrink?: number | undefined;
|
|
73
|
+
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
74
|
+
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
75
|
+
left?: string | number | undefined;
|
|
76
|
+
margin?: string | number | undefined;
|
|
77
|
+
marginBottom?: string | number | undefined;
|
|
78
|
+
marginEnd?: string | number | undefined;
|
|
79
|
+
marginHorizontal?: string | number | undefined;
|
|
80
|
+
marginLeft?: string | number | undefined;
|
|
81
|
+
marginRight?: string | number | undefined;
|
|
82
|
+
marginStart?: string | number | undefined;
|
|
83
|
+
marginTop?: string | number | undefined;
|
|
84
|
+
marginVertical?: string | number | undefined;
|
|
85
|
+
maxHeight?: string | number | undefined;
|
|
86
|
+
maxWidth?: string | number | undefined;
|
|
87
|
+
minHeight?: string | number | undefined;
|
|
88
|
+
minWidth?: string | number | undefined;
|
|
89
|
+
overflow?: "visible" | "hidden" | "scroll" | undefined;
|
|
90
|
+
padding?: string | number | undefined;
|
|
91
|
+
paddingBottom?: string | number | undefined;
|
|
92
|
+
paddingEnd?: string | number | undefined;
|
|
93
|
+
paddingHorizontal?: string | number | undefined;
|
|
94
|
+
paddingLeft?: string | number | undefined;
|
|
95
|
+
paddingRight?: string | number | undefined;
|
|
96
|
+
paddingStart?: string | number | undefined;
|
|
97
|
+
paddingTop?: string | number | undefined;
|
|
98
|
+
paddingVertical?: string | number | undefined;
|
|
99
|
+
position?: "absolute" | "relative" | undefined;
|
|
100
|
+
right?: string | number | undefined;
|
|
101
|
+
start?: string | number | undefined;
|
|
102
|
+
top?: string | number | undefined;
|
|
103
|
+
zIndex?: number | undefined;
|
|
104
|
+
direction?: "ltr" | "rtl" | "inherit" | undefined;
|
|
105
|
+
shadowColor?: import("react-native").ColorValue | undefined;
|
|
106
|
+
shadowOffset?: {
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
} | undefined;
|
|
110
|
+
shadowOpacity?: number | undefined;
|
|
111
|
+
shadowRadius?: number | undefined;
|
|
112
|
+
transform?: (import("react-native").PerpectiveTransform | import("react-native").RotateTransform | import("react-native").RotateXTransform | import("react-native").RotateYTransform | import("react-native").RotateZTransform | import("react-native").ScaleTransform | import("react-native").ScaleXTransform | import("react-native").ScaleYTransform | import("react-native").TranslateXTransform | import("react-native").TranslateYTransform | import("react-native").SkewXTransform | import("react-native").SkewYTransform | import("react-native").MatrixTransform)[] | undefined;
|
|
113
|
+
transformMatrix?: number[] | undefined;
|
|
114
|
+
rotation?: number | undefined;
|
|
115
|
+
scaleX?: number | undefined;
|
|
116
|
+
scaleY?: number | undefined;
|
|
117
|
+
translateX?: number | undefined;
|
|
118
|
+
translateY?: number | undefined;
|
|
119
|
+
};
|
|
120
|
+
title?: string | null | undefined;
|
|
121
|
+
icon?: string | undefined;
|
|
122
|
+
iconRight?: boolean | undefined;
|
|
123
|
+
disabled?: boolean | undefined;
|
|
124
|
+
borderRadius?: number | undefined;
|
|
125
|
+
color?: string | undefined;
|
|
126
|
+
iconStyle?: ViewStyle | undefined;
|
|
127
|
+
textStyle?: TextStyle | undefined;
|
|
128
|
+
width?: string | number | undefined;
|
|
129
|
+
flex?: number | undefined;
|
|
130
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
131
|
+
onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
132
|
+
onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
133
|
+
onLongPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
134
|
+
children?: import("react").ReactNode | ((state: import("react-native").PressableStateCallbackType) => import("react").ReactNode);
|
|
135
|
+
delayLongPress?: number | null | undefined;
|
|
136
|
+
hitSlop?: number | import("react-native").Insets | null | undefined;
|
|
137
|
+
pressRetentionOffset?: number | import("react-native").Insets | null | undefined;
|
|
138
|
+
android_disableSound?: boolean | null | undefined;
|
|
139
|
+
android_ripple?: import("react-native").PressableAndroidRippleConfig | null | undefined;
|
|
140
|
+
testOnly_pressed?: boolean | null | undefined;
|
|
141
|
+
accessible?: boolean | undefined;
|
|
142
|
+
accessibilityActions?: readonly Readonly<{
|
|
143
|
+
name: string;
|
|
144
|
+
label?: string | undefined;
|
|
145
|
+
}>[] | undefined;
|
|
146
|
+
accessibilityLabel?: string | undefined;
|
|
147
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
148
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
149
|
+
accessibilityHint?: string | undefined;
|
|
150
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
151
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
152
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
153
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
154
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
155
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
156
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
157
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
158
|
+
onMagicTap?: (() => void) | undefined;
|
|
159
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
160
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
161
|
+
testID?: string | undefined;
|
|
162
|
+
nativeID?: string | undefined;
|
|
163
|
+
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
164
|
+
removeClippedSubviews?: boolean | undefined;
|
|
165
|
+
collapsable?: boolean | undefined;
|
|
166
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
167
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
168
|
+
focusable?: boolean | undefined;
|
|
169
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
170
|
+
isTVSelectable?: boolean | undefined;
|
|
171
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
172
|
+
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
173
|
+
tvParallaxShiftDistanceX?: number | undefined;
|
|
174
|
+
tvParallaxShiftDistanceY?: number | undefined;
|
|
175
|
+
tvParallaxTiltAngle?: number | undefined;
|
|
176
|
+
tvParallaxMagnification?: number | undefined;
|
|
177
|
+
onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
178
|
+
onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
179
|
+
onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
180
|
+
onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
181
|
+
onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
182
|
+
onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
183
|
+
onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
184
|
+
onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
185
|
+
onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
186
|
+
onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
187
|
+
onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
188
|
+
onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
189
|
+
onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
190
|
+
onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
191
|
+
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
192
|
+
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
193
|
+
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
194
|
+
}[] | {
|
|
195
|
+
flex: number;
|
|
196
|
+
pressedColor: any;
|
|
197
|
+
style: {
|
|
198
|
+
borderRadius?: number | undefined;
|
|
199
|
+
height?: string | number | undefined;
|
|
200
|
+
backgroundColor: any;
|
|
201
|
+
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
202
|
+
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
203
|
+
borderBottomEndRadius?: number | undefined;
|
|
204
|
+
borderBottomLeftRadius?: number | undefined;
|
|
205
|
+
borderBottomRightRadius?: number | undefined;
|
|
206
|
+
borderBottomStartRadius?: number | undefined;
|
|
207
|
+
borderBottomWidth?: number | undefined;
|
|
208
|
+
borderColor?: import("react-native").ColorValue | undefined;
|
|
209
|
+
borderEndColor?: import("react-native").ColorValue | undefined;
|
|
210
|
+
borderLeftColor?: import("react-native").ColorValue | undefined;
|
|
211
|
+
borderLeftWidth?: number | undefined;
|
|
212
|
+
borderRightColor?: import("react-native").ColorValue | undefined;
|
|
213
|
+
borderRightWidth?: number | undefined;
|
|
214
|
+
borderStartColor?: import("react-native").ColorValue | undefined;
|
|
215
|
+
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
216
|
+
borderTopColor?: import("react-native").ColorValue | undefined;
|
|
217
|
+
borderTopEndRadius?: number | undefined;
|
|
218
|
+
borderTopLeftRadius?: number | undefined;
|
|
219
|
+
borderTopRightRadius?: number | undefined;
|
|
220
|
+
borderTopStartRadius?: number | undefined;
|
|
221
|
+
borderTopWidth?: number | undefined;
|
|
222
|
+
borderWidth?: number | undefined;
|
|
223
|
+
opacity?: number | undefined;
|
|
224
|
+
testID?: string | undefined;
|
|
225
|
+
elevation?: number | undefined;
|
|
226
|
+
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
227
|
+
alignItems?: import("react-native").FlexAlignType | undefined;
|
|
228
|
+
alignSelf?: "auto" | import("react-native").FlexAlignType | undefined;
|
|
229
|
+
aspectRatio?: number | undefined;
|
|
230
|
+
borderEndWidth?: string | number | undefined;
|
|
231
|
+
borderStartWidth?: string | number | undefined;
|
|
232
|
+
bottom?: string | number | undefined;
|
|
233
|
+
display?: "none" | "flex" | undefined;
|
|
234
|
+
end?: string | number | undefined;
|
|
235
|
+
flex?: number | undefined;
|
|
236
|
+
flexBasis?: string | number | undefined;
|
|
237
|
+
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
238
|
+
flexGrow?: number | undefined;
|
|
239
|
+
flexShrink?: number | undefined;
|
|
240
|
+
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
241
|
+
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
242
|
+
left?: string | number | undefined;
|
|
243
|
+
margin?: string | number | undefined;
|
|
244
|
+
marginBottom?: string | number | undefined;
|
|
245
|
+
marginEnd?: string | number | undefined;
|
|
246
|
+
marginHorizontal?: string | number | undefined;
|
|
247
|
+
marginLeft?: string | number | undefined;
|
|
248
|
+
marginRight?: string | number | undefined;
|
|
249
|
+
marginStart?: string | number | undefined;
|
|
250
|
+
marginTop?: string | number | undefined;
|
|
251
|
+
marginVertical?: string | number | undefined;
|
|
252
|
+
maxHeight?: string | number | undefined;
|
|
253
|
+
maxWidth?: string | number | undefined;
|
|
254
|
+
minHeight?: string | number | undefined;
|
|
255
|
+
minWidth?: string | number | undefined;
|
|
256
|
+
overflow?: "visible" | "hidden" | "scroll" | undefined;
|
|
257
|
+
padding?: string | number | undefined;
|
|
258
|
+
paddingBottom?: string | number | undefined;
|
|
259
|
+
paddingEnd?: string | number | undefined;
|
|
260
|
+
paddingHorizontal?: string | number | undefined;
|
|
261
|
+
paddingLeft?: string | number | undefined;
|
|
262
|
+
paddingRight?: string | number | undefined;
|
|
263
|
+
paddingStart?: string | number | undefined;
|
|
264
|
+
paddingTop?: string | number | undefined;
|
|
265
|
+
paddingVertical?: string | number | undefined;
|
|
266
|
+
position?: "absolute" | "relative" | undefined;
|
|
267
|
+
right?: string | number | undefined;
|
|
268
|
+
start?: string | number | undefined;
|
|
269
|
+
top?: string | number | undefined;
|
|
270
|
+
width?: string | number | undefined;
|
|
271
|
+
zIndex?: number | undefined;
|
|
272
|
+
direction?: "ltr" | "rtl" | "inherit" | undefined;
|
|
273
|
+
shadowColor?: import("react-native").ColorValue | undefined;
|
|
274
|
+
shadowOffset?: {
|
|
275
|
+
width: number;
|
|
276
|
+
height: number;
|
|
277
|
+
} | undefined;
|
|
278
|
+
shadowOpacity?: number | undefined;
|
|
279
|
+
shadowRadius?: number | undefined;
|
|
280
|
+
transform?: (import("react-native").PerpectiveTransform | import("react-native").RotateTransform | import("react-native").RotateXTransform | import("react-native").RotateYTransform | import("react-native").RotateZTransform | import("react-native").ScaleTransform | import("react-native").ScaleXTransform | import("react-native").ScaleYTransform | import("react-native").TranslateXTransform | import("react-native").TranslateYTransform | import("react-native").SkewXTransform | import("react-native").SkewYTransform | import("react-native").MatrixTransform)[] | undefined;
|
|
281
|
+
transformMatrix?: number[] | undefined;
|
|
282
|
+
rotation?: number | undefined;
|
|
283
|
+
scaleX?: number | undefined;
|
|
284
|
+
scaleY?: number | undefined;
|
|
285
|
+
translateX?: number | undefined;
|
|
286
|
+
translateY?: number | undefined;
|
|
287
|
+
};
|
|
288
|
+
title?: string | null | undefined;
|
|
289
|
+
icon?: string | undefined;
|
|
290
|
+
iconRight?: boolean | undefined;
|
|
291
|
+
disabled?: boolean | undefined;
|
|
292
|
+
borderRadius?: number | undefined;
|
|
293
|
+
color?: string | undefined;
|
|
294
|
+
iconStyle?: ViewStyle | undefined;
|
|
295
|
+
textStyle?: TextStyle | undefined;
|
|
296
|
+
width?: string | number | undefined;
|
|
297
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
298
|
+
onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
299
|
+
onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
300
|
+
onLongPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
301
|
+
children?: import("react").ReactNode | ((state: import("react-native").PressableStateCallbackType) => import("react").ReactNode);
|
|
302
|
+
delayLongPress?: number | null | undefined;
|
|
303
|
+
hitSlop?: number | import("react-native").Insets | null | undefined;
|
|
304
|
+
pressRetentionOffset?: number | import("react-native").Insets | null | undefined;
|
|
305
|
+
android_disableSound?: boolean | null | undefined;
|
|
306
|
+
android_ripple?: import("react-native").PressableAndroidRippleConfig | null | undefined;
|
|
307
|
+
testOnly_pressed?: boolean | null | undefined;
|
|
308
|
+
accessible?: boolean | undefined;
|
|
309
|
+
accessibilityActions?: readonly Readonly<{
|
|
310
|
+
name: string;
|
|
311
|
+
label?: string | undefined;
|
|
312
|
+
}>[] | undefined;
|
|
313
|
+
accessibilityLabel?: string | undefined;
|
|
314
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
315
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
316
|
+
accessibilityHint?: string | undefined;
|
|
317
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
318
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
319
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
320
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
321
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
322
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
323
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
324
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
325
|
+
onMagicTap?: (() => void) | undefined;
|
|
326
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
327
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
328
|
+
testID?: string | undefined;
|
|
329
|
+
nativeID?: string | undefined;
|
|
330
|
+
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
331
|
+
removeClippedSubviews?: boolean | undefined;
|
|
332
|
+
collapsable?: boolean | undefined;
|
|
333
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
334
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
335
|
+
focusable?: boolean | undefined;
|
|
336
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
337
|
+
isTVSelectable?: boolean | undefined;
|
|
338
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
339
|
+
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
340
|
+
tvParallaxShiftDistanceX?: number | undefined;
|
|
341
|
+
tvParallaxShiftDistanceY?: number | undefined;
|
|
342
|
+
tvParallaxTiltAngle?: number | undefined;
|
|
343
|
+
tvParallaxMagnification?: number | undefined;
|
|
344
|
+
onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
345
|
+
onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
346
|
+
onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
347
|
+
onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
348
|
+
onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
349
|
+
onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
350
|
+
onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
351
|
+
onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
352
|
+
onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
353
|
+
onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
354
|
+
onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
355
|
+
onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
356
|
+
onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
357
|
+
onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
358
|
+
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
359
|
+
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
360
|
+
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
361
|
+
}[];
|
|
362
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { moderateScale, scaledForDevice } from '../../../scale';
|
|
2
|
+
import { palette } from '../../../theme/palette';
|
|
3
|
+
export const validVariants = {
|
|
4
|
+
squared: 'squared',
|
|
5
|
+
rounded: 'rounded',
|
|
6
|
+
default: 'squared',
|
|
7
|
+
};
|
|
8
|
+
const buttonVariantStyles = (variant) => ({
|
|
9
|
+
...(variant === 'rounded' && {
|
|
10
|
+
borderRadius: scaledForDevice(48, moderateScale),
|
|
11
|
+
height: scaledForDevice(48, moderateScale),
|
|
12
|
+
}),
|
|
13
|
+
...(variant === 'squared' && {
|
|
14
|
+
borderRadius: scaledForDevice(1, moderateScale),
|
|
15
|
+
height: scaledForDevice(60, moderateScale),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
const getBackgroundColor = ({ color, pressedColor: receivedPressedColor, disabled, }) => {
|
|
19
|
+
const validColor = typeof color === 'string' ? color : 'primary';
|
|
20
|
+
const validPressedColor = typeof receivedPressedColor === 'string' ? receivedPressedColor : validColor;
|
|
21
|
+
palette.grey[200];
|
|
22
|
+
const backgroundColor = disabled ? palette.grey[200] : palette[validColor]?.main || validColor;
|
|
23
|
+
const pressedColor = palette[validPressedColor]?.dark || validPressedColor;
|
|
24
|
+
return { backgroundColor, pressedColor };
|
|
25
|
+
};
|
|
26
|
+
export const buttonWrapperVariantStyles = (variant) => ({
|
|
27
|
+
...(variant === 'rounded' && {
|
|
28
|
+
padding: scaledForDevice(16, moderateScale),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
const validWidth = (width) => {
|
|
32
|
+
if (typeof width === 'number' && !Number.isNaN(width)) {
|
|
33
|
+
return width;
|
|
34
|
+
}
|
|
35
|
+
if (typeof width === 'string' && width.includes('%')) {
|
|
36
|
+
return width;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
export const parseButtonsStyles = (buttons, variant) => {
|
|
41
|
+
if (!buttons || !(buttons instanceof Array) || !buttons.length) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const currentVariant = validVariants[variant] || validVariants.default;
|
|
45
|
+
const newButtons = [...buttons].slice(0, 3);
|
|
46
|
+
const areButtonsRounded = currentVariant === validVariants.rounded;
|
|
47
|
+
if (newButtons.length === 3 && areButtonsRounded) {
|
|
48
|
+
const parsedButtons = newButtons.map((btn, idx) => {
|
|
49
|
+
const { backgroundColor, pressedColor } = getBackgroundColor(btn);
|
|
50
|
+
if (idx === 0) {
|
|
51
|
+
return {
|
|
52
|
+
...btn,
|
|
53
|
+
pressedColor,
|
|
54
|
+
style: {
|
|
55
|
+
...btn?.style,
|
|
56
|
+
backgroundColor,
|
|
57
|
+
width: '100%',
|
|
58
|
+
...buttonVariantStyles(currentVariant),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...btn,
|
|
64
|
+
pressedColor,
|
|
65
|
+
style: {
|
|
66
|
+
...btn?.style,
|
|
67
|
+
backgroundColor,
|
|
68
|
+
width: validWidth(btn.width) ?? '49%',
|
|
69
|
+
...buttonVariantStyles(currentVariant),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return parsedButtons;
|
|
74
|
+
}
|
|
75
|
+
if (newButtons.length === 2 && areButtonsRounded) {
|
|
76
|
+
const parsedButtons = newButtons.map((btn, idx) => {
|
|
77
|
+
const { backgroundColor, pressedColor } = getBackgroundColor(btn);
|
|
78
|
+
if (idx === 0 && btn.width === '100%') {
|
|
79
|
+
return {
|
|
80
|
+
...btn,
|
|
81
|
+
pressedColor,
|
|
82
|
+
style: {
|
|
83
|
+
...btn?.style,
|
|
84
|
+
backgroundColor,
|
|
85
|
+
width: btn.width,
|
|
86
|
+
marginBottom: scaledForDevice(10, moderateScale),
|
|
87
|
+
...buttonVariantStyles(currentVariant),
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...btn,
|
|
93
|
+
pressedColor,
|
|
94
|
+
style: {
|
|
95
|
+
...btn?.style,
|
|
96
|
+
backgroundColor,
|
|
97
|
+
width: validWidth(btn.width) ?? '49%',
|
|
98
|
+
...buttonVariantStyles(currentVariant),
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
return parsedButtons;
|
|
103
|
+
}
|
|
104
|
+
if (newButtons.length === 1 && areButtonsRounded) {
|
|
105
|
+
const parsedButtons = newButtons.map((btn) => {
|
|
106
|
+
const { backgroundColor, pressedColor } = getBackgroundColor(btn);
|
|
107
|
+
return {
|
|
108
|
+
...btn,
|
|
109
|
+
pressedColor,
|
|
110
|
+
style: {
|
|
111
|
+
...btn?.style,
|
|
112
|
+
backgroundColor,
|
|
113
|
+
width: '100%',
|
|
114
|
+
...buttonVariantStyles(currentVariant),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
return parsedButtons;
|
|
119
|
+
}
|
|
120
|
+
const flex = 1 / buttons.length;
|
|
121
|
+
const parsedButtons = newButtons.map((btn) => {
|
|
122
|
+
const { backgroundColor, pressedColor } = getBackgroundColor(btn);
|
|
123
|
+
return {
|
|
124
|
+
...btn,
|
|
125
|
+
flex,
|
|
126
|
+
pressedColor,
|
|
127
|
+
style: {
|
|
128
|
+
...btn?.style,
|
|
129
|
+
backgroundColor,
|
|
130
|
+
...buttonVariantStyles(currentVariant),
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return parsedButtons;
|
|
135
|
+
};
|
|
@@ -17,5 +17,7 @@ import Carousel from './components/Carousel';
|
|
|
17
17
|
import ProgressBar from './components/ProgressBar';
|
|
18
18
|
import List from './components/List';
|
|
19
19
|
import BaseButton from './components/BaseButton';
|
|
20
|
+
import FullScreenMessage from './components/FullScreenMessage';
|
|
21
|
+
import LayoutWithBottomButtons from './components/LayoutWithBottomButtons';
|
|
20
22
|
import * as getScale from './scale';
|
|
21
|
-
export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, };
|
|
23
|
+
export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, FullScreenMessage, };
|
|
@@ -17,5 +17,7 @@ import Carousel from './components/Carousel';
|
|
|
17
17
|
import ProgressBar from './components/ProgressBar';
|
|
18
18
|
import List from './components/List';
|
|
19
19
|
import BaseButton from './components/BaseButton';
|
|
20
|
+
import FullScreenMessage from './components/FullScreenMessage';
|
|
21
|
+
import LayoutWithBottomButtons from './components/LayoutWithBottomButtons';
|
|
20
22
|
import * as getScale from './scale';
|
|
21
|
-
export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, };
|
|
23
|
+
export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, FullScreenMessage, };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Dimensions, PixelRatio, Platform } from 'react-native';
|
|
2
|
-
import { WEB_MODE } from '../../env.json';
|
|
3
2
|
const guidelineBaseWidth = 360;
|
|
4
3
|
const guidelineBaseHeight = 720;
|
|
5
4
|
const isIOS = Platform.OS === 'ios';
|
|
5
|
+
const isWeb = Platform.OS === 'web';
|
|
6
6
|
const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
|
|
7
7
|
const isSmallDevice = (minWidth = 365) => viewportWidth <= minWidth;
|
|
8
8
|
const horizontalScale = (size) => PixelRatio.roundToNearestPixel((viewportWidth / guidelineBaseWidth) * size);
|
|
9
9
|
const verticalScale = (size) => PixelRatio.roundToNearestPixel((viewportHeight / guidelineBaseHeight) * size);
|
|
10
10
|
const moderateScale = (size, factor = 1) => size + (horizontalScale(size) - size) * factor;
|
|
11
11
|
/* istanbul ignore next */
|
|
12
|
-
const scaledForDevice = (size, scaleCallback) =>
|
|
12
|
+
const scaledForDevice = (size, scaleCallback) => isWeb ? size : scaleCallback(size);
|
|
13
13
|
export { isIOS, viewportWidth, viewportHeight, isSmallDevice, horizontalScale, verticalScale, moderateScale, scaledForDevice, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alert, Base, Black, Env, Error, GreyScale, Primary, Success, Warning, White } from '../ts/interfaces/colors';
|
|
1
|
+
import { Alert, Base, Black, Env, Error, GreyScale, Primary, Success, Warning, White, Palette } from '../ts/interfaces/colors';
|
|
2
2
|
declare const primary: Primary;
|
|
3
3
|
declare const black: Black;
|
|
4
4
|
declare const white: White;
|
|
@@ -9,16 +9,5 @@ declare const error: Error;
|
|
|
9
9
|
declare const warning: Warning;
|
|
10
10
|
declare const alert: Alert;
|
|
11
11
|
declare const environment: Env;
|
|
12
|
-
declare const palette:
|
|
13
|
-
primary: Primary;
|
|
14
|
-
black: Black;
|
|
15
|
-
white: White;
|
|
16
|
-
grey: GreyScale;
|
|
17
|
-
base: Base;
|
|
18
|
-
success: Success;
|
|
19
|
-
error: Error;
|
|
20
|
-
warning: Warning;
|
|
21
|
-
alert: Alert;
|
|
22
|
-
environment: Env;
|
|
23
|
-
};
|
|
12
|
+
declare const palette: Palette;
|
|
24
13
|
export { primary, black, white, grey, base, success, error, warning, alert, environment, palette };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export interface GreyScale {
|
|
2
|
+
[key: string]: string;
|
|
2
3
|
100: string;
|
|
3
4
|
200: string;
|
|
4
5
|
300: string;
|
|
@@ -8,14 +9,17 @@ export interface GreyScale {
|
|
|
8
9
|
700: string;
|
|
9
10
|
}
|
|
10
11
|
export interface Env {
|
|
12
|
+
[key: string]: string;
|
|
11
13
|
qa: string;
|
|
12
14
|
beta: string;
|
|
13
15
|
}
|
|
14
16
|
export interface Base {
|
|
17
|
+
[key: string]: string;
|
|
15
18
|
black: string;
|
|
16
19
|
white: string;
|
|
17
20
|
}
|
|
18
21
|
export interface gamaColor {
|
|
22
|
+
[key: string]: string;
|
|
19
23
|
main: string;
|
|
20
24
|
dark: string;
|
|
21
25
|
}
|
|
@@ -36,3 +40,16 @@ export interface White extends Primary {
|
|
|
36
40
|
export interface Black extends gamaColor {
|
|
37
41
|
semiTransparent: string;
|
|
38
42
|
}
|
|
43
|
+
export interface Palette {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
primary: Primary;
|
|
46
|
+
black: Black;
|
|
47
|
+
white: White;
|
|
48
|
+
grey: GreyScale;
|
|
49
|
+
base: Base;
|
|
50
|
+
success: Success;
|
|
51
|
+
error: Error;
|
|
52
|
+
warning: Warning;
|
|
53
|
+
alert: Alert;
|
|
54
|
+
environment: Env;
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janiscommerce/ui-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "components library for Janis app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/janis-commerce/ui-native#readme",
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"react": ">=17.0.2
|
|
47
|
-
"react-native": ">=0.67.5
|
|
48
|
-
"react-native-gesture-handler": ">=2.9.0
|
|
46
|
+
"react": ">=17.0.2",
|
|
47
|
+
"react-native": ">=0.67.5",
|
|
48
|
+
"react-native-gesture-handler": ">=2.9.0",
|
|
49
49
|
"react-native-reanimated": "2.17.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
package/dist/env.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "LOAD_STORYBOOK": true, "WEB_MODE": false }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|