@janiscommerce/ui-native 1.0.2 → 1.0.4
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/CheckBox/index.d.ts +1 -0
- package/dist/components/Loading/LoadingSvg/index.d.ts +8 -0
- package/dist/components/Loading/LoadingSvg/index.js +13 -0
- package/dist/components/Loading/index.d.ts +2 -2
- package/dist/components/Loading/index.js +5 -8
- package/dist/components/RadioButton/index.d.ts +22 -0
- package/dist/components/RadioButton/index.js +48 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ interface CheckBoxProps {
|
|
|
9
9
|
borderRadius?: number;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
style?: ViewStyle;
|
|
12
|
+
onPress?: () => {};
|
|
12
13
|
}
|
|
13
14
|
declare const CheckBox: ({ checked, customSize, checkOnColor, checkOffColor, iconCheckColor, borderRadius, disabled, style, ...props }: CheckBoxProps) => React.JSX.Element;
|
|
14
15
|
export default CheckBox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Animated, ViewProps } from 'react-native';
|
|
3
|
+
interface IanimatedView extends Animated.AnimatedProps<ViewProps> {
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const LoadingSvg: ({ size, color, ...props }: IanimatedView) => React.JSX.Element;
|
|
8
|
+
export default LoadingSvg;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Animated } from 'react-native';
|
|
4
|
+
import { white } from '../../../theme/palette';
|
|
5
|
+
const LoadingSvg = ({ size, color, ...props }) => {
|
|
6
|
+
return (<Animated.View {...props}>
|
|
7
|
+
<Svg x="0px" y="0px" width={size} height={size} viewBox="0 0 163 163">
|
|
8
|
+
<Path d="M134.1,136.4c-30.3,29.1-78.5,28-107.5-2.3c-29.1-30.3-28-78.5,2.3-107.5s78.5-28,107.5,2.3" fill="none" stroke={white.dark} strokeWidth="10.5546" strokeLinecap="round" strokeLinejoin="round"/>
|
|
9
|
+
<Path id="path-color" d="M78.4,5.5c42-1.7,77.4,30.9,79.1,72.9c1.7,42-30.9,77.4-72.9,79.1c-42,1.7-77.4-30.9-79.1-72.9" fill="none" stroke={color} strokeWidth="10.5546" strokeLinecap="round" strokeLinejoin="round"/>
|
|
10
|
+
</Svg>
|
|
11
|
+
</Animated.View>);
|
|
12
|
+
};
|
|
13
|
+
export default LoadingSvg;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
3
|
interface Props {
|
|
4
4
|
isLoading: boolean;
|
|
5
|
-
color?:
|
|
5
|
+
color?: string;
|
|
6
6
|
size?: number;
|
|
7
7
|
duration?: number;
|
|
8
8
|
children?: React.ReactNode | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { StyleSheet, View, Animated, Easing } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import LoadingSvg from './LoadingSvg';
|
|
4
|
+
import { primary } from '../../theme/palette';
|
|
4
5
|
const startRotationAnimation = ({ duration, rotationDegree, timingAnimation }) => Animated.loop(Animated.timing(rotationDegree, {
|
|
5
6
|
duration,
|
|
6
7
|
toValue: 360,
|
|
@@ -21,12 +22,8 @@ const Loading = ({ isLoading, color = primary.main, size = 64, duration = 1000,
|
|
|
21
22
|
position: 'absolute',
|
|
22
23
|
width: size,
|
|
23
24
|
height: size,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
borderRightColor: color,
|
|
27
|
-
borderBottomColor: color,
|
|
28
|
-
borderRadius: size / 2,
|
|
29
|
-
borderWidth: 3.5,
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
30
27
|
},
|
|
31
28
|
});
|
|
32
29
|
const animationSpinnerStyle = {
|
|
@@ -52,7 +49,7 @@ const Loading = ({ isLoading, color = primary.main, size = 64, duration = 1000,
|
|
|
52
49
|
return <></>;
|
|
53
50
|
}
|
|
54
51
|
return (<View style={[styles.container, style]} {...props}>
|
|
55
|
-
<
|
|
52
|
+
<LoadingSvg style={[styles.spinner, { ...animationSpinnerStyle }]} size={size} color={color}/>
|
|
56
53
|
{children}
|
|
57
54
|
</View>);
|
|
58
55
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
declare const checkLocation: readonly ["left", "right"];
|
|
4
|
+
type positions = (typeof checkLocation)[number];
|
|
5
|
+
declare const CheckSizeValues: {
|
|
6
|
+
sm: number;
|
|
7
|
+
md: number;
|
|
8
|
+
lg: number;
|
|
9
|
+
};
|
|
10
|
+
type sizeType = typeof CheckSizeValues;
|
|
11
|
+
type sizeKeys = keyof sizeType;
|
|
12
|
+
interface RadioButtonProps {
|
|
13
|
+
children: React.ReactNode | string;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
onPress?: () => {};
|
|
16
|
+
checkPosition?: positions;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
checkSize?: sizeKeys;
|
|
19
|
+
style?: ViewStyle;
|
|
20
|
+
}
|
|
21
|
+
declare const RadioButton: ({ children, onPress, selected, checkPosition, checkSize, disabled, style, ...props }: RadioButtonProps) => React.JSX.Element | null;
|
|
22
|
+
export default RadioButton;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
import Text from '../Text';
|
|
4
|
+
import CheckBox from '../CheckBox';
|
|
5
|
+
const checkLocation = ['left', 'right'];
|
|
6
|
+
const CheckSizeValues = {
|
|
7
|
+
sm: 16,
|
|
8
|
+
md: 24,
|
|
9
|
+
lg: 32,
|
|
10
|
+
};
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
paddingHorizontal: 16,
|
|
15
|
+
marginVertical: 10,
|
|
16
|
+
height: 'auto',
|
|
17
|
+
},
|
|
18
|
+
row: {
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
justifyContent: 'flex-start',
|
|
21
|
+
},
|
|
22
|
+
reverseRow: {
|
|
23
|
+
flexDirection: 'row-reverse',
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
},
|
|
26
|
+
checkToLeft: {
|
|
27
|
+
marginLeft: 15,
|
|
28
|
+
},
|
|
29
|
+
checkToRight: {
|
|
30
|
+
marginRight: 15,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const RadioButton = ({ children, onPress, selected = false, checkPosition = 'left', checkSize = 'sm', disabled = false, style, ...props }) => {
|
|
34
|
+
if (!children) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const { container, row, reverseRow, checkToLeft, checkToRight } = styles;
|
|
38
|
+
const isStringChild = typeof children === 'string';
|
|
39
|
+
const checkLeft = checkPosition === 'left';
|
|
40
|
+
const customSize = CheckSizeValues[checkSize];
|
|
41
|
+
return (<TouchableOpacity style={[container, checkLeft ? row : reverseRow, style]} disabled={disabled} onPress={onPress} {...props}>
|
|
42
|
+
<CheckBox checked={selected} disabled={disabled} customSize={customSize} borderRadius={customSize / 2}/>
|
|
43
|
+
<View style={checkLeft ? checkToLeft : checkToRight}>
|
|
44
|
+
{isStringChild ? <Text>{children}</Text> : children}
|
|
45
|
+
</View>
|
|
46
|
+
</TouchableOpacity>);
|
|
47
|
+
};
|
|
48
|
+
export default RadioButton;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ import StatusChip from './components/StatusChip';
|
|
|
8
8
|
import Input from './components/Input';
|
|
9
9
|
import LoadingFullScreen from './components/LoadingFullScreen';
|
|
10
10
|
import { palette } from './theme/palette';
|
|
11
|
-
|
|
11
|
+
import RadioButton from './components/RadioButton';
|
|
12
|
+
export { Text, Avatar, CheckBox, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, };
|
package/dist/index.js
CHANGED
|
@@ -8,4 +8,5 @@ import StatusChip from './components/StatusChip';
|
|
|
8
8
|
import Input from './components/Input';
|
|
9
9
|
import LoadingFullScreen from './components/LoadingFullScreen';
|
|
10
10
|
import { palette } from './theme/palette';
|
|
11
|
-
|
|
11
|
+
import RadioButton from './components/RadioButton';
|
|
12
|
+
export { Text, Avatar, CheckBox, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janiscommerce/ui-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "components library for Janis app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"npm run test:commit"
|
|
107
107
|
],
|
|
108
108
|
"*.{ts,tsx}": [
|
|
109
|
-
"tsc --noEmit"
|
|
109
|
+
"bash -c tsc --noEmit"
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|