@janiscommerce/ui-native 1.8.1 → 1.10.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/{BaseButton → atoms/BaseButton}/index.js +1 -1
- package/dist/components/atoms/BaseCardList/index.d.ts +8 -0
- package/dist/components/atoms/BaseCardList/index.js +29 -0
- package/dist/components/{BaseToast → atoms/BaseToast}/index.js +1 -1
- package/dist/components/{CheckBox → atoms/CheckBox}/icon/CheckedIcon.js +1 -1
- package/dist/components/{CheckBox → atoms/CheckBox}/index.js +2 -2
- package/dist/components/{Icon → atoms/Icon}/index.js +2 -2
- package/dist/components/{Input → atoms/Input}/index.js +1 -1
- package/dist/components/{Input → atoms/Input}/utils/index.d.ts +1 -1
- package/dist/components/{Input → atoms/Input}/utils/index.js +1 -1
- package/dist/components/{Loading → atoms/Loading}/LoadingSvg/index.js +1 -1
- package/dist/components/{Loading → atoms/Loading}/index.js +2 -2
- package/dist/components/{RadioButton → atoms/RadioButton}/index.js +2 -2
- package/dist/components/{StatusChip → atoms/StatusChip}/index.js +2 -2
- package/dist/components/{Svg → atoms/Svg}/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/index.js +2 -2
- package/dist/components/{Svg → atoms/Svg}/svgs/EmptyIllustration/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/svgs/EmptyListIllustration/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/svgs/JanisLogo/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/svgs/JanisLogoColor/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/svgs/LoginIllustration/index.d.ts +1 -1
- package/dist/components/{Svg → atoms/Svg}/svgs/NoNotifications/index.d.ts +1 -1
- package/dist/components/{Text → atoms/Text}/index.js +1 -1
- package/dist/components/{Avatar → molecules/Avatar}/index.js +3 -3
- package/dist/components/{Button → molecules/Button}/index.d.ts +2 -2
- package/dist/components/{Button → molecules/Button}/index.js +11 -8
- package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/index.js +2 -2
- package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/styleConfigs/index.d.ts +2 -0
- package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/styleConfigs/index.js +4 -2
- package/dist/components/{Carousel → molecules/Carousel}/utils/index.d.ts +1 -1
- package/dist/components/molecules/ItemSelectionButton/index.d.ts +11 -0
- package/dist/components/molecules/ItemSelectionButton/index.js +66 -0
- package/dist/components/{LayoutWithBottomButtons → molecules/LayoutWithBottomButtons}/index.js +8 -7
- package/dist/components/{LayoutWithBottomButtons → molecules/LayoutWithBottomButtons}/utils/index.d.ts +18 -16
- package/dist/components/{LayoutWithBottomButtons → molecules/LayoutWithBottomButtons}/utils/index.js +21 -8
- package/dist/components/molecules/MainCardList/index.d.ts +14 -0
- package/dist/components/molecules/MainCardList/index.js +60 -0
- package/dist/components/{ProgressBar → molecules/ProgressBar}/index.js +2 -2
- package/dist/components/{ProgressBar → molecules/ProgressBar}/utils/index.js +1 -1
- package/dist/components/{Select → molecules/Select}/Components/Dropdown/index.d.ts +1 -1
- package/dist/components/{Select → molecules/Select}/Components/Modal/index.js +2 -2
- package/dist/components/{Select → molecules/Select}/Components/Options/index.d.ts +1 -1
- package/dist/components/{Select → molecules/Select}/Components/Options/index.js +1 -1
- package/dist/components/{Select → molecules/Select}/Components/SwitcherComponent/index.d.ts +1 -1
- package/dist/components/{Select → molecules/Select}/index.js +3 -3
- package/dist/components/{Select → molecules/Select}/utils/index.d.ts +1 -1
- package/dist/components/molecules/SwipeList/index.d.ts +11 -0
- package/dist/components/molecules/SwipeList/index.js +31 -0
- package/dist/components/molecules/Tabs/index.d.ts +23 -0
- package/dist/components/molecules/Tabs/index.js +112 -0
- package/dist/components/{Toast → molecules/Toast}/index.d.ts +1 -1
- package/dist/components/{Toast → molecules/Toast}/index.js +5 -5
- package/dist/components/{Toast → molecules/Toast}/utils/index.js +1 -1
- package/dist/components/{FullScreenMessage → organisms/FullScreenMessage}/index.js +4 -4
- package/dist/components/{LoadingFullScreen → organisms/LoadingFullScreen}/index.d.ts +1 -1
- package/dist/components/{LoadingFullScreen → organisms/LoadingFullScreen}/index.js +4 -4
- package/dist/components/organisms/SwipeItemSelectionList/index.d.ts +14 -0
- package/dist/components/organisms/SwipeItemSelectionList/index.js +37 -0
- package/dist/index.d.ts +28 -24
- package/dist/index.js +32 -24
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +11 -9
- /package/dist/components/{BaseButton → atoms/BaseButton}/index.d.ts +0 -0
- /package/dist/components/{BaseToast → atoms/BaseToast}/index.d.ts +0 -0
- /package/dist/components/{BaseToast → atoms/BaseToast}/utils/index.d.ts +0 -0
- /package/dist/components/{BaseToast → atoms/BaseToast}/utils/index.js +0 -0
- /package/dist/components/{CheckBox → atoms/CheckBox}/icon/CheckedIcon.d.ts +0 -0
- /package/dist/components/{CheckBox → atoms/CheckBox}/index.d.ts +0 -0
- /package/dist/components/{Icon → atoms/Icon}/assets/fonts/selection.json +0 -0
- /package/dist/components/{Icon → atoms/Icon}/index.d.ts +0 -0
- /package/dist/components/{Image → atoms/Image}/index.d.ts +0 -0
- /package/dist/components/{Image → atoms/Image}/index.js +0 -0
- /package/dist/components/{Input → atoms/Input}/index.d.ts +0 -0
- /package/dist/components/{List → atoms/List}/index.d.ts +0 -0
- /package/dist/components/{List → atoms/List}/index.js +0 -0
- /package/dist/components/{Loading → atoms/Loading}/LoadingSvg/index.d.ts +0 -0
- /package/dist/components/{Loading → atoms/Loading}/index.d.ts +0 -0
- /package/dist/components/{RadioButton → atoms/RadioButton}/index.d.ts +0 -0
- /package/dist/components/{StatusChip → atoms/StatusChip}/index.d.ts +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/EmptyIllustration/index.js +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/EmptyListIllustration/index.js +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/JanisLogo/index.js +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/JanisLogoColor/index.js +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/LoginIllustration/index.js +0 -0
- /package/dist/components/{Svg → atoms/Svg}/svgs/NoNotifications/index.js +0 -0
- /package/dist/components/{SwipeUp → atoms/SwipeUp}/childComponents/index.d.ts +0 -0
- /package/dist/components/{SwipeUp → atoms/SwipeUp}/childComponents/index.js +0 -0
- /package/dist/components/{SwipeUp → atoms/SwipeUp}/index.d.ts +0 -0
- /package/dist/components/{SwipeUp → atoms/SwipeUp}/index.js +0 -0
- /package/dist/components/{Text → atoms/Text}/index.d.ts +0 -0
- /package/dist/components/{Avatar → molecules/Avatar}/index.d.ts +0 -0
- /package/dist/components/{Avatar → molecules/Avatar}/utils/formatPlaceholder/index.d.ts +0 -0
- /package/dist/components/{Avatar → molecules/Avatar}/utils/formatPlaceholder/index.js +0 -0
- /package/dist/components/{Button → molecules/Button}/types/index.d.ts +0 -0
- /package/dist/components/{Button → molecules/Button}/types/index.js +0 -0
- /package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/index.d.ts +0 -0
- /package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/constants/index.d.ts +0 -0
- /package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/constants/index.js +0 -0
- /package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/defaultValues/index.d.ts +0 -0
- /package/dist/components/{Button → molecules/Button}/utils/getButtonStyles/utils/defaultValues/index.js +0 -0
- /package/dist/components/{Carousel → molecules/Carousel}/index.d.ts +0 -0
- /package/dist/components/{Carousel → molecules/Carousel}/index.js +0 -0
- /package/dist/components/{Carousel → molecules/Carousel}/utils/index.js +0 -0
- /package/dist/components/{LayoutWithBottomButtons → molecules/LayoutWithBottomButtons}/index.d.ts +0 -0
- /package/dist/components/{ProgressBar → molecules/ProgressBar}/index.d.ts +0 -0
- /package/dist/components/{ProgressBar → molecules/ProgressBar}/utils/index.d.ts +0 -0
- /package/dist/components/{Select → molecules/Select}/Components/Dropdown/index.js +0 -0
- /package/dist/components/{Select → molecules/Select}/Components/Modal/index.d.ts +0 -0
- /package/dist/components/{Select → molecules/Select}/Components/SwitcherComponent/index.js +0 -0
- /package/dist/components/{Select → molecules/Select}/index.d.ts +0 -0
- /package/dist/components/{Select → molecules/Select}/utils/index.js +0 -0
- /package/dist/components/{Toast → molecules/Toast}/utils/index.d.ts +0 -0
- /package/dist/components/{FullScreenMessage → organisms/FullScreenMessage}/index.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable, StyleSheet } from 'react-native';
|
|
3
|
-
import { moderateScale, scaledForDevice } from '
|
|
3
|
+
import { moderateScale, scaledForDevice } from '../../../scale';
|
|
4
4
|
const BaseButton = ({ borderRadius = 0, children = null, style, pressedStyle, ...props }) => {
|
|
5
5
|
if (!children) {
|
|
6
6
|
return null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
export interface BaseCardListProps extends ViewProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const BaseCardList: FC<BaseCardListProps>;
|
|
8
|
+
export default BaseCardList;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { palette } from '../../../theme/palette';
|
|
4
|
+
const BaseCardList = ({ children, isSelected = false, style, ...props }) => {
|
|
5
|
+
if (!children) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
backgroundColor: palette.base.white,
|
|
11
|
+
borderRadius: 20,
|
|
12
|
+
width: '100%',
|
|
13
|
+
padding: 16,
|
|
14
|
+
},
|
|
15
|
+
selectedContainer: {
|
|
16
|
+
borderWidth: 2,
|
|
17
|
+
borderColor: palette.primary.main,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const activeStyles = [
|
|
21
|
+
styles.container,
|
|
22
|
+
isSelected && styles.selectedContainer,
|
|
23
|
+
style && style,
|
|
24
|
+
].filter(Boolean);
|
|
25
|
+
return (<View style={activeStyles} {...props}>
|
|
26
|
+
{children}
|
|
27
|
+
</View>);
|
|
28
|
+
};
|
|
29
|
+
export default BaseCardList;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import { black, palette } from '
|
|
3
|
+
import { black, palette } from '../../../theme/palette';
|
|
4
4
|
import { parseType } from './utils';
|
|
5
5
|
export var Types;
|
|
6
6
|
(function (Types) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { base } from '
|
|
3
|
+
import { base } from '../../../../theme/palette';
|
|
4
4
|
import Svg, { Path } from 'react-native-svg';
|
|
5
5
|
const CheckedIcon = ({ color, size }) => (<View>
|
|
6
6
|
<Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
import { base, grey, primary } from '
|
|
4
|
-
import { moderateScale, horizontalScale, scaledForDevice } from '
|
|
3
|
+
import { base, grey, primary } from '../../../theme/palette';
|
|
4
|
+
import { moderateScale, horizontalScale, scaledForDevice } from '../../../scale';
|
|
5
5
|
import Icon from './icon/CheckedIcon';
|
|
6
6
|
const getCheckBoxScale = (size, divisor) => size / divisor;
|
|
7
7
|
const CheckBox = ({ checked, customSize = 16, checkOnColor = primary.main, checkOffColor = grey[500], iconCheckColor = base.white, borderRadius, disabled = false, style, ...props }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
|
|
3
3
|
import icoMoonConfig from './assets/fonts/selection.json';
|
|
4
|
-
import { primary } from '
|
|
5
|
-
import { moderateScale, scaledForDevice } from '
|
|
4
|
+
import { primary } from '../../../theme/palette';
|
|
5
|
+
import { moderateScale, scaledForDevice } from '../../../scale';
|
|
6
6
|
const IconComponent = createIconSetFromIcoMoon(icoMoonConfig, 'janis-font-icon', 'janis-font-icon.ttf');
|
|
7
7
|
const Icon = ({ name, color = primary.main, size = 16, ...props }) => {
|
|
8
8
|
if (!name) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { TextInput, StyleSheet, View, Text, } from 'react-native';
|
|
3
3
|
import { getBorderColor, getInputInitialState, getLabelColor, getStatusMessageColor, raiseLabel, showStatusMessage, } from './utils';
|
|
4
|
-
import { moderateScale, horizontalScale, scaledForDevice } from '
|
|
4
|
+
import { moderateScale, horizontalScale, scaledForDevice } from '../../../scale';
|
|
5
5
|
export var keyboardTypes;
|
|
6
6
|
(function (keyboardTypes) {
|
|
7
7
|
keyboardTypes["default"] = "default";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Svg, { Path } from 'react-native-svg';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Animated } from 'react-native';
|
|
4
|
-
import { white } from '
|
|
4
|
+
import { white } from '../../../../theme/palette';
|
|
5
5
|
const LoadingSvg = ({ size, color, ...props }) => {
|
|
6
6
|
return (<Animated.View {...props}>
|
|
7
7
|
<Svg x="0px" y="0px" width={size} height={size} viewBox="0 0 163 163">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { StyleSheet, View, Animated, Easing } from 'react-native';
|
|
3
3
|
import LoadingSvg from './LoadingSvg';
|
|
4
|
-
import { primary } from '
|
|
5
|
-
import { horizontalScale, moderateScale, scaledForDevice } from '
|
|
4
|
+
import { primary } from '../../../theme/palette';
|
|
5
|
+
import { horizontalScale, moderateScale, scaledForDevice } from '../../../scale';
|
|
6
6
|
const startRotationAnimation = ({ duration, rotationDegree, timingAnimation }) => Animated.loop(Animated.timing(rotationDegree, {
|
|
7
7
|
duration,
|
|
8
8
|
toValue: 360,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import CheckBox from '../CheckBox';
|
|
5
|
-
import { horizontalScale, moderateScale, scaledForDevice } from '
|
|
5
|
+
import { horizontalScale, moderateScale, scaledForDevice } from '../../../scale';
|
|
6
6
|
const checkLocation = ['left', 'right'];
|
|
7
7
|
const CheckSizeValues = {
|
|
8
8
|
sm: 16,
|
|
@@ -21,7 +21,7 @@ const styles = StyleSheet.create({
|
|
|
21
21
|
},
|
|
22
22
|
row: {
|
|
23
23
|
flexDirection: 'row',
|
|
24
|
-
justifyContent: '
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
25
|
},
|
|
26
26
|
reverseRow: {
|
|
27
27
|
flexDirection: 'row-reverse',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { isValidElement } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import { base, grey, primary } from '
|
|
3
|
+
import { base, grey, primary } from '../../../theme/palette';
|
|
4
4
|
import Text from '../Text';
|
|
5
|
-
import { horizontalScale, moderateScale, scaledForDevice } from '
|
|
5
|
+
import { horizontalScale, moderateScale, scaledForDevice } from '../../../scale';
|
|
6
6
|
const validHeight = scaledForDevice(24, moderateScale);
|
|
7
7
|
const validPadding = scaledForDevice(12, horizontalScale);
|
|
8
8
|
const validBorderRadius = scaledForDevice(12, moderateScale);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { svgsNames } from '
|
|
3
|
+
import { svgsNames } from '../../../ts/interfaces/svgs';
|
|
4
4
|
import EmptyIllustration from './svgs/EmptyIllustration';
|
|
5
5
|
import EmptyListIllustration from './svgs/EmptyListIllustration';
|
|
6
6
|
import JanisLogo from './svgs/JanisLogo';
|
|
7
7
|
import JanisLogoColor from './svgs/JanisLogoColor';
|
|
8
8
|
import LoginIllustration from './svgs/LoginIllustration';
|
|
9
9
|
import NoNotifications from './svgs/NoNotifications';
|
|
10
|
-
import { horizontalScale, moderateScale, scaledForDevice } from '
|
|
10
|
+
import { horizontalScale, moderateScale, scaledForDevice } from '../../../scale';
|
|
11
11
|
const svgs = {
|
|
12
12
|
'empty-illustration': EmptyIllustration,
|
|
13
13
|
'empty-list-illustration': EmptyListIllustration,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { Isvg } from '
|
|
2
|
+
import type { Isvg } from '../../../../../ts/interfaces/svgs';
|
|
3
3
|
declare const EmptyListIllustration: ({ ...props }: Isvg) => React.JSX.Element;
|
|
4
4
|
export default EmptyListIllustration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, Text as TextComponent, } from 'react-native';
|
|
3
|
-
import { moderateScale, scaledForDevice } from '
|
|
3
|
+
import { moderateScale, scaledForDevice } from '../../../scale';
|
|
4
4
|
const Text = ({ children, style, ...props }) => {
|
|
5
5
|
if (!children) {
|
|
6
6
|
return null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import Image from '
|
|
4
|
-
import Text from '
|
|
3
|
+
import Image from '../../atoms/Image';
|
|
4
|
+
import Text from '../../atoms/Text';
|
|
5
5
|
import { formatPlaceholder } from './utils/formatPlaceholder/index';
|
|
6
|
-
import { horizontalScale, moderateScale, scaledForDevice } from '
|
|
6
|
+
import { horizontalScale, moderateScale, scaledForDevice } from '../../../scale';
|
|
7
7
|
export const sizeValues = {
|
|
8
8
|
sm: 24,
|
|
9
9
|
md: 36,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { BaseButtonProps } from '
|
|
3
|
+
import { BaseButtonProps } from '../../atoms/BaseButton';
|
|
4
4
|
export declare const types: {
|
|
5
5
|
main: string;
|
|
6
6
|
secondary: string;
|
|
@@ -32,7 +32,7 @@ export type buttonColor = typeof color;
|
|
|
32
32
|
export type keyColor = keyof buttonColor;
|
|
33
33
|
export type buttonIconPosition = typeof iconPosition;
|
|
34
34
|
export type keyIconPosition = keyof buttonIconPosition;
|
|
35
|
-
interface ButtonProps extends BaseButtonProps {
|
|
35
|
+
export interface ButtonProps extends BaseButtonProps {
|
|
36
36
|
type?: keyType;
|
|
37
37
|
variant?: keyVariant;
|
|
38
38
|
color?: keyColor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import BaseButton from '
|
|
3
|
+
import BaseButton from '../../atoms/BaseButton';
|
|
4
4
|
import getButtonStyles from './utils/getButtonStyles';
|
|
5
|
-
import Loading from '
|
|
6
|
-
import Text from '
|
|
7
|
-
import Icon from '
|
|
5
|
+
import Loading from '../../atoms/Loading';
|
|
6
|
+
import Text from '../../atoms/Text';
|
|
7
|
+
import Icon from '../../atoms/Icon';
|
|
8
8
|
export const types = {
|
|
9
9
|
main: 'main',
|
|
10
10
|
secondary: 'secondary',
|
|
@@ -28,7 +28,10 @@ export const iconPosition = {
|
|
|
28
28
|
left: 'left',
|
|
29
29
|
right: 'right',
|
|
30
30
|
};
|
|
31
|
-
const Button = ({ type = 'main', variant = 'contained', color = 'primary', iconPosition = 'left', isLoading = false, value = '
|
|
31
|
+
const Button = ({ type = 'main', variant = 'contained', color = 'primary', iconPosition = 'left', isLoading = false, value = '', icon = null, disabled = false, style, iconStyle, textStyle, ...props }) => {
|
|
32
|
+
if (!value && !icon) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
32
35
|
const validDisabled = disabled || isLoading;
|
|
33
36
|
const hasIconAndText = !!icon && !!value;
|
|
34
37
|
const borderRadius = variant === 'text' ? 6 : 50;
|
|
@@ -42,13 +45,13 @@ const Button = ({ type = 'main', variant = 'contained', color = 'primary', iconP
|
|
|
42
45
|
hasIconAndText,
|
|
43
46
|
});
|
|
44
47
|
const styles = StyleSheet.create(buttonStyles);
|
|
45
|
-
const
|
|
48
|
+
const LoadingComponent = <Loading isLoading={isLoading} color={styles.loadingColor} size={24}/>;
|
|
46
49
|
const WrapperComponent = (<View style={styles.direction}>
|
|
47
50
|
{icon && <Icon name={icon} style={[styles.icon, iconStyle]} size={24}/>}
|
|
48
|
-
{value && <Text style={[styles.text, textStyle]}>{value}</Text>}
|
|
51
|
+
{!!value && <Text style={[styles.text, textStyle]}>{value}</Text>}
|
|
49
52
|
</View>);
|
|
50
53
|
return (<BaseButton style={[styles.container, style]} pressedStyle={!validDisabled && styles.pressed} borderRadius={borderRadius} disabled={validDisabled} {...props}>
|
|
51
|
-
{isLoading ?
|
|
54
|
+
{isLoading ? LoadingComponent : WrapperComponent}
|
|
52
55
|
</BaseButton>);
|
|
53
56
|
};
|
|
54
57
|
export default Button;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { moderateScale, scaledForDevice } from '
|
|
2
|
-
import { palette } from '
|
|
1
|
+
import { moderateScale, scaledForDevice } from '../../../../../scale';
|
|
2
|
+
import { palette } from '../../../../../theme/palette';
|
|
3
3
|
import { colorConfig, styleConfig } from './utils/styleConfigs';
|
|
4
4
|
import { validTypes, validVariants, validIconPositions, verticalHeights } from './utils/constants';
|
|
5
5
|
import { defaultColor, defaultIconPosition, defaultType, defaultVariant, } from './utils/defaultValues';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { moderateScale, scaledForDevice } from '
|
|
2
|
-
import { base, black, grey, white } from '
|
|
1
|
+
import { moderateScale, scaledForDevice } from '../../../../../../../scale';
|
|
2
|
+
import { base, black, grey, white } from '../../../../../../../theme/palette';
|
|
3
3
|
export const colorConfig = (selectedColor) => {
|
|
4
4
|
return {
|
|
5
5
|
main: {
|
|
@@ -105,6 +105,8 @@ export const styleConfig = {
|
|
|
105
105
|
text: {
|
|
106
106
|
fontWeight: '500',
|
|
107
107
|
textAlign: 'center',
|
|
108
|
+
fontFamily: 'Roboto-Medium',
|
|
109
|
+
letterSpacing: 0,
|
|
108
110
|
},
|
|
109
111
|
icon: {
|
|
110
112
|
margin: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeScrollEvent, NativeSyntheticEvent, ScrollView } from 'react-native';
|
|
3
|
-
import { CarouselProps } from '
|
|
3
|
+
import { CarouselProps } from '../';
|
|
4
4
|
declare const useCarouselControls: ({ pages, isLoop, autoplay, autoPlayReverse, intervalTime, customWidth, buttonsCallback, pagesCallback, }: CarouselProps) => {
|
|
5
5
|
activePage: number;
|
|
6
6
|
slider: import("react").MutableRefObject<ScrollView | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ItemSelectionButtonProps {
|
|
3
|
+
name: string;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
radioButton?: boolean;
|
|
6
|
+
leftSelection?: boolean;
|
|
7
|
+
rightSelection?: boolean;
|
|
8
|
+
onSelection?: () => {};
|
|
9
|
+
}
|
|
10
|
+
declare const ItemSelectionButton: React.FC<ItemSelectionButtonProps>;
|
|
11
|
+
export default ItemSelectionButton;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RadioButton from '../../atoms/RadioButton';
|
|
3
|
+
import CheckBox from '../../atoms/CheckBox';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import Text from '../../atoms/Text';
|
|
6
|
+
import { palette } from '../../../theme/palette';
|
|
7
|
+
import { horizontalScale, moderateScale, scaledForDevice, verticalScale } from '../../../scale';
|
|
8
|
+
const validPaddingHorizontal = scaledForDevice(16, horizontalScale);
|
|
9
|
+
const validMarginVertical = scaledForDevice(13, moderateScale);
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
container: {
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
},
|
|
14
|
+
radioButtonContainer: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
height: verticalScale(48),
|
|
17
|
+
borderRadius: verticalScale(4),
|
|
18
|
+
},
|
|
19
|
+
checkBoxContainer: {
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
justifyContent: 'space-between',
|
|
22
|
+
paddingHorizontal: validPaddingHorizontal,
|
|
23
|
+
marginVertical: validMarginVertical,
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
height: 'auto',
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
fontSize: 16,
|
|
29
|
+
fontWeight: '400',
|
|
30
|
+
color: palette.black.main,
|
|
31
|
+
textTransform: 'capitalize',
|
|
32
|
+
},
|
|
33
|
+
separator: {
|
|
34
|
+
alignSelf: 'center',
|
|
35
|
+
borderBottomColor: palette.grey[200],
|
|
36
|
+
borderBottomWidth: verticalScale(1),
|
|
37
|
+
width: '90%',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const ItemSelectionButton = ({ name, selected = false, radioButton = false, leftSelection = false, rightSelection = false, onSelection = () => { }, }) => {
|
|
41
|
+
if (!name) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const checkPosition = rightSelection || (!rightSelection && !leftSelection) ? 'right' : 'left';
|
|
45
|
+
const renderSelectionComponent = () => {
|
|
46
|
+
if (!radioButton) {
|
|
47
|
+
return <CheckBox onPress={onSelection} checked={selected} customSize={24}/>;
|
|
48
|
+
}
|
|
49
|
+
return (<RadioButton onPress={onSelection} selected={selected} checkPosition={checkPosition} checkSize="md">
|
|
50
|
+
<Text style={styles.text}>{name}</Text>
|
|
51
|
+
</RadioButton>);
|
|
52
|
+
};
|
|
53
|
+
return (<View style={styles.container}>
|
|
54
|
+
<TouchableOpacity style={[
|
|
55
|
+
radioButton && styles.radioButtonContainer,
|
|
56
|
+
!radioButton && styles.checkBoxContainer,
|
|
57
|
+
]} onPress={onSelection}>
|
|
58
|
+
{leftSelection && !rightSelection && renderSelectionComponent()}
|
|
59
|
+
{!radioButton && <Text style={styles.text}>{name}</Text>}
|
|
60
|
+
{((rightSelection && !leftSelection) || (!rightSelection && !leftSelection)) &&
|
|
61
|
+
renderSelectionComponent()}
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
<View style={styles.separator}/>
|
|
64
|
+
</View>);
|
|
65
|
+
};
|
|
66
|
+
export default ItemSelectionButton;
|
package/dist/components/{LayoutWithBottomButtons → molecules/LayoutWithBottomButtons}/index.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { moderateScale, scaledForDevice } from '../../scale';
|
|
3
|
+
import { palette } from '../../../theme/palette';
|
|
4
|
+
import { moderateScale, scaledForDevice } from '../../../scale';
|
|
6
5
|
import { validVariants, parseButtonsStyles, buttonWrapperVariantStyles } from './utils';
|
|
6
|
+
import Button from '../Button';
|
|
7
7
|
const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgroundColor, ...props }) => {
|
|
8
8
|
if (!children) {
|
|
9
9
|
return null;
|
|
@@ -17,6 +17,7 @@ const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgr
|
|
|
17
17
|
if (!(parsedButtons instanceof Array) || !parsedButtons.length) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
+
const isRoundedOnTopVariant = selectedVariant === validVariants.roundedOnTop;
|
|
20
21
|
const styles = StyleSheet.create({
|
|
21
22
|
Container: {
|
|
22
23
|
flex: 1,
|
|
@@ -36,7 +37,7 @@ const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgr
|
|
|
36
37
|
},
|
|
37
38
|
ButtonsWrapper: {
|
|
38
39
|
...buttonWrapperVariantStyles(selectedVariant),
|
|
39
|
-
flexDirection: 'row',
|
|
40
|
+
flexDirection: isRoundedOnTopVariant ? 'column' : 'row',
|
|
40
41
|
justifyContent: 'space-between',
|
|
41
42
|
backgroundColor: validBtnBgColor,
|
|
42
43
|
marginTop: 'auto',
|
|
@@ -51,9 +52,9 @@ const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgr
|
|
|
51
52
|
return (<View style={[styles.Container]} {...props}>
|
|
52
53
|
{children}
|
|
53
54
|
<View style={[styles.FullButtonsRoundedWrapper]}>
|
|
54
|
-
<
|
|
55
|
+
<Button {...fullWidthButton}/>
|
|
55
56
|
<View style={[styles.TwoButtonsWrapper]}>
|
|
56
|
-
{newBtns.map(({ ...buttonData }, index) => (<
|
|
57
|
+
{newBtns.map(({ ...buttonData }, index) => (<Button key={index.toString()} {...buttonData}/>))}
|
|
57
58
|
</View>
|
|
58
59
|
</View>
|
|
59
60
|
</View>);
|
|
@@ -64,7 +65,7 @@ const LayoutWithBottomButtons = ({ children, buttons, variant = '', buttonBackgr
|
|
|
64
65
|
return (<View style={[styles.Container]} {...props}>
|
|
65
66
|
{children}
|
|
66
67
|
<View style={[styles.ButtonsWrapper]}>
|
|
67
|
-
{parsedButtons.map(({ ...buttonData }, index) => (<
|
|
68
|
+
{parsedButtons.map(({ ...buttonData }, index) => (<Button key={index.toString()} {...buttonData}/>))}
|
|
68
69
|
</View>
|
|
69
70
|
</View>);
|
|
70
71
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { keyColor } from '../../Button';
|
|
2
3
|
import { PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
3
4
|
export interface IlayoutButtons extends PressableProps {
|
|
4
|
-
|
|
5
|
+
value?: string | null;
|
|
5
6
|
icon?: string;
|
|
6
7
|
iconRight?: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
borderRadius?: number;
|
|
9
|
-
color?:
|
|
10
|
+
color?: keyColor;
|
|
10
11
|
pressedColor?: string;
|
|
11
12
|
style?: ViewStyle;
|
|
12
13
|
iconStyle?: ViewStyle;
|
|
@@ -18,6 +19,7 @@ interface IvalidVariants {
|
|
|
18
19
|
[key: string]: string;
|
|
19
20
|
squared: string;
|
|
20
21
|
rounded: string;
|
|
22
|
+
roundedOnTop: string;
|
|
21
23
|
default: string;
|
|
22
24
|
}
|
|
23
25
|
export declare const validVariants: IvalidVariants;
|
|
@@ -29,7 +31,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
29
31
|
style: {
|
|
30
32
|
borderRadius?: number | undefined;
|
|
31
33
|
height?: string | number | undefined;
|
|
32
|
-
backgroundColor:
|
|
34
|
+
backgroundColor: string;
|
|
33
35
|
width: string | number;
|
|
34
36
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
35
37
|
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
@@ -58,7 +60,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
58
60
|
elevation?: number | undefined;
|
|
59
61
|
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
60
62
|
alignItems?: import("react-native").FlexAlignType | undefined;
|
|
61
|
-
alignSelf?:
|
|
63
|
+
alignSelf?: import("react-native").FlexAlignType | "auto" | undefined;
|
|
62
64
|
aspectRatio?: number | undefined;
|
|
63
65
|
borderEndWidth?: string | number | undefined;
|
|
64
66
|
borderStartWidth?: string | number | undefined;
|
|
@@ -101,7 +103,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
101
103
|
start?: string | number | undefined;
|
|
102
104
|
top?: string | number | undefined;
|
|
103
105
|
zIndex?: number | undefined;
|
|
104
|
-
direction?: "
|
|
106
|
+
direction?: "inherit" | "ltr" | "rtl" | undefined;
|
|
105
107
|
shadowColor?: import("react-native").ColorValue | undefined;
|
|
106
108
|
shadowOffset?: {
|
|
107
109
|
width: number;
|
|
@@ -117,12 +119,12 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
117
119
|
translateX?: number | undefined;
|
|
118
120
|
translateY?: number | undefined;
|
|
119
121
|
};
|
|
120
|
-
|
|
122
|
+
value?: string | null | undefined;
|
|
121
123
|
icon?: string | undefined;
|
|
122
124
|
iconRight?: boolean | undefined;
|
|
123
125
|
disabled?: boolean | undefined;
|
|
124
126
|
borderRadius?: number | undefined;
|
|
125
|
-
color?:
|
|
127
|
+
color?: "black" | "primary" | "success" | "error" | "warning" | "alert" | undefined;
|
|
126
128
|
iconStyle?: ViewStyle | undefined;
|
|
127
129
|
textStyle?: TextStyle | undefined;
|
|
128
130
|
width?: string | number | undefined;
|
|
@@ -158,10 +160,10 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
158
160
|
onMagicTap?: (() => void) | undefined;
|
|
159
161
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
160
162
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
161
|
-
testID?: string | undefined;
|
|
162
|
-
nativeID?: string | undefined;
|
|
163
163
|
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
164
164
|
removeClippedSubviews?: boolean | undefined;
|
|
165
|
+
testID?: string | undefined;
|
|
166
|
+
nativeID?: string | undefined;
|
|
165
167
|
collapsable?: boolean | undefined;
|
|
166
168
|
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
167
169
|
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
@@ -197,7 +199,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
197
199
|
style: {
|
|
198
200
|
borderRadius?: number | undefined;
|
|
199
201
|
height?: string | number | undefined;
|
|
200
|
-
backgroundColor:
|
|
202
|
+
backgroundColor: string;
|
|
201
203
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
202
204
|
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
203
205
|
borderBottomEndRadius?: number | undefined;
|
|
@@ -225,7 +227,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
225
227
|
elevation?: number | undefined;
|
|
226
228
|
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
227
229
|
alignItems?: import("react-native").FlexAlignType | undefined;
|
|
228
|
-
alignSelf?:
|
|
230
|
+
alignSelf?: import("react-native").FlexAlignType | "auto" | undefined;
|
|
229
231
|
aspectRatio?: number | undefined;
|
|
230
232
|
borderEndWidth?: string | number | undefined;
|
|
231
233
|
borderStartWidth?: string | number | undefined;
|
|
@@ -269,7 +271,7 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
269
271
|
top?: string | number | undefined;
|
|
270
272
|
width?: string | number | undefined;
|
|
271
273
|
zIndex?: number | undefined;
|
|
272
|
-
direction?: "
|
|
274
|
+
direction?: "inherit" | "ltr" | "rtl" | undefined;
|
|
273
275
|
shadowColor?: import("react-native").ColorValue | undefined;
|
|
274
276
|
shadowOffset?: {
|
|
275
277
|
width: number;
|
|
@@ -285,12 +287,12 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
285
287
|
translateX?: number | undefined;
|
|
286
288
|
translateY?: number | undefined;
|
|
287
289
|
};
|
|
288
|
-
|
|
290
|
+
value?: string | null | undefined;
|
|
289
291
|
icon?: string | undefined;
|
|
290
292
|
iconRight?: boolean | undefined;
|
|
291
293
|
disabled?: boolean | undefined;
|
|
292
294
|
borderRadius?: number | undefined;
|
|
293
|
-
color?:
|
|
295
|
+
color?: "black" | "primary" | "success" | "error" | "warning" | "alert" | undefined;
|
|
294
296
|
iconStyle?: ViewStyle | undefined;
|
|
295
297
|
textStyle?: TextStyle | undefined;
|
|
296
298
|
width?: string | number | undefined;
|
|
@@ -325,10 +327,10 @@ export declare const parseButtonsStyles: (buttons: Array<IlayoutButtons>, varian
|
|
|
325
327
|
onMagicTap?: (() => void) | undefined;
|
|
326
328
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
327
329
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
328
|
-
testID?: string | undefined;
|
|
329
|
-
nativeID?: string | undefined;
|
|
330
330
|
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
331
331
|
removeClippedSubviews?: boolean | undefined;
|
|
332
|
+
testID?: string | undefined;
|
|
333
|
+
nativeID?: string | undefined;
|
|
332
334
|
collapsable?: boolean | undefined;
|
|
333
335
|
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
334
336
|
renderToHardwareTextureAndroid?: boolean | undefined;
|