@janiscommerce/ui-native 1.1.1 → 1.3.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.
Files changed (81) hide show
  1. package/dist/env.json +1 -0
  2. package/dist/{components → src/components}/Avatar/index.js +14 -8
  3. package/dist/src/components/BaseButton/index.d.ts +16 -0
  4. package/dist/src/components/BaseButton/index.js +58 -0
  5. package/dist/{components → src/components}/CheckBox/index.js +16 -9
  6. package/dist/{components → src/components}/Icon/index.d.ts +1 -0
  7. package/dist/{components → src/components}/Icon/index.js +3 -1
  8. package/dist/{components → src/components}/Input/index.js +15 -9
  9. package/dist/src/components/List/index.d.ts +20 -0
  10. package/dist/src/components/List/index.js +16 -0
  11. package/dist/{components → src/components}/Loading/index.js +7 -3
  12. package/dist/{components → src/components}/LoadingFullScreen/index.js +10 -4
  13. package/dist/src/components/ProgressBar/index.d.ts +11 -0
  14. package/dist/src/components/ProgressBar/index.js +58 -0
  15. package/dist/src/components/ProgressBar/utils/index.d.ts +20 -0
  16. package/dist/src/components/ProgressBar/utils/index.js +52 -0
  17. package/dist/{components → src/components}/RadioButton/index.js +9 -5
  18. package/dist/{components → src/components}/Select/Components/Dropdown/index.js +21 -9
  19. package/dist/{components → src/components}/Select/Components/Icons/Chevron/index.d.ts +0 -1
  20. package/dist/{components → src/components}/Select/Components/Icons/Chevron/index.js +4 -3
  21. package/dist/{components → src/components}/Select/Components/Icons/Delete/index.d.ts +0 -1
  22. package/dist/{components → src/components}/Select/Components/Icons/Delete/index.js +4 -3
  23. package/dist/{components → src/components}/Select/index.js +24 -13
  24. package/dist/{components → src/components}/StatusChip/index.js +14 -7
  25. package/dist/{components → src/components}/Svg/index.js +8 -1
  26. package/dist/{components → src/components}/Text/index.js +3 -1
  27. package/dist/{index.d.ts → src/index.d.ts} +5 -1
  28. package/dist/{index.js → src/index.js} +5 -1
  29. package/dist/src/scale/index.d.ts +8 -0
  30. package/dist/src/scale/index.js +13 -0
  31. package/dist/{theme → src/theme}/palette.js +2 -1
  32. package/dist/{ts → src/ts}/interfaces/colors.d.ts +3 -2
  33. package/package.json +8 -6
  34. /package/dist/{components → src/components}/Avatar/index.d.ts +0 -0
  35. /package/dist/{components → src/components}/Avatar/utils/formatPlaceholder/index.d.ts +0 -0
  36. /package/dist/{components → src/components}/Avatar/utils/formatPlaceholder/index.js +0 -0
  37. /package/dist/{components → src/components}/Carousel/index.d.ts +0 -0
  38. /package/dist/{components → src/components}/Carousel/index.js +0 -0
  39. /package/dist/{components → src/components}/Carousel/utils/index.d.ts +0 -0
  40. /package/dist/{components → src/components}/Carousel/utils/index.js +0 -0
  41. /package/dist/{components → src/components}/CheckBox/icon/CheckedIcon.d.ts +0 -0
  42. /package/dist/{components → src/components}/CheckBox/icon/CheckedIcon.js +0 -0
  43. /package/dist/{components → src/components}/CheckBox/index.d.ts +0 -0
  44. /package/dist/{components → src/components}/Icon/assets/fonts/selection.json +0 -0
  45. /package/dist/{components → src/components}/Image/index.d.ts +0 -0
  46. /package/dist/{components → src/components}/Image/index.js +0 -0
  47. /package/dist/{components → src/components}/Input/index.d.ts +0 -0
  48. /package/dist/{components → src/components}/Input/utils/index.d.ts +0 -0
  49. /package/dist/{components → src/components}/Input/utils/index.js +0 -0
  50. /package/dist/{components → src/components}/Loading/LoadingSvg/index.d.ts +0 -0
  51. /package/dist/{components → src/components}/Loading/LoadingSvg/index.js +0 -0
  52. /package/dist/{components → src/components}/Loading/index.d.ts +0 -0
  53. /package/dist/{components → src/components}/LoadingFullScreen/index.d.ts +0 -0
  54. /package/dist/{components → src/components}/RadioButton/index.d.ts +0 -0
  55. /package/dist/{components → src/components}/Select/Components/Dropdown/index.d.ts +0 -0
  56. /package/dist/{components → src/components}/Select/index.d.ts +0 -0
  57. /package/dist/{components → src/components}/Select/utils/index.d.ts +0 -0
  58. /package/dist/{components → src/components}/Select/utils/index.js +0 -0
  59. /package/dist/{components → src/components}/StatusChip/index.d.ts +0 -0
  60. /package/dist/{components → src/components}/Svg/index.d.ts +0 -0
  61. /package/dist/{components → src/components}/Svg/svgs/EmptyIllustration/index.d.ts +0 -0
  62. /package/dist/{components → src/components}/Svg/svgs/EmptyIllustration/index.js +0 -0
  63. /package/dist/{components → src/components}/Svg/svgs/EmptyListIllustration/index.d.ts +0 -0
  64. /package/dist/{components → src/components}/Svg/svgs/EmptyListIllustration/index.js +0 -0
  65. /package/dist/{components → src/components}/Svg/svgs/JanisLogo/index.d.ts +0 -0
  66. /package/dist/{components → src/components}/Svg/svgs/JanisLogo/index.js +0 -0
  67. /package/dist/{components → src/components}/Svg/svgs/JanisLogoColor/index.d.ts +0 -0
  68. /package/dist/{components → src/components}/Svg/svgs/JanisLogoColor/index.js +0 -0
  69. /package/dist/{components → src/components}/Svg/svgs/LoginIllustration/index.d.ts +0 -0
  70. /package/dist/{components → src/components}/Svg/svgs/LoginIllustration/index.js +0 -0
  71. /package/dist/{components → src/components}/Svg/svgs/NoNotifications/index.d.ts +0 -0
  72. /package/dist/{components → src/components}/Svg/svgs/NoNotifications/index.js +0 -0
  73. /package/dist/{components → src/components}/SwipeUp/childComponents/index.d.ts +0 -0
  74. /package/dist/{components → src/components}/SwipeUp/childComponents/index.js +0 -0
  75. /package/dist/{components → src/components}/SwipeUp/index.d.ts +0 -0
  76. /package/dist/{components → src/components}/SwipeUp/index.js +0 -0
  77. /package/dist/{components → src/components}/Text/index.d.ts +0 -0
  78. /package/dist/{theme → src/theme}/palette.d.ts +0 -0
  79. /package/dist/{ts → src/ts}/interfaces/colors.js +0 -0
  80. /package/dist/{ts → src/ts}/interfaces/svgs.d.ts +0 -0
  81. /package/dist/{ts → src/ts}/interfaces/svgs.js +0 -0
package/dist/env.json ADDED
@@ -0,0 +1 @@
1
+ { "LOAD_STORYBOOK": true, "WEB_MODE": false }
@@ -3,6 +3,7 @@ import { StyleSheet, View } from 'react-native';
3
3
  import Image from '../Image';
4
4
  import Text from '../Text';
5
5
  import { formatPlaceholder } from './utils/formatPlaceholder/index';
6
+ import { horizontalScale, moderateScale, scaledForDevice } from '../../scale';
6
7
  export const sizeValues = {
7
8
  sm: 24,
8
9
  md: 36,
@@ -25,6 +26,13 @@ const Avatar = ({ size = 'sm', textColor = '#FFFFFF', bgColor = '#E8EAF6', image
25
26
  return null;
26
27
  }
27
28
  const initials = formatPlaceholder(String(placeholder));
29
+ const calculateBorderRadius = getSize(size, customSize) / 2;
30
+ const calculateSize = getSize(size, customSize);
31
+ const calculateFontSize = getSize(size, customSize) * 0.4;
32
+ const validBorderRadius = scaledForDevice(calculateBorderRadius, moderateScale);
33
+ const validWidth = scaledForDevice(calculateSize, horizontalScale);
34
+ const validHeight = scaledForDevice(calculateSize, moderateScale);
35
+ const validFontSize = scaledForDevice(calculateFontSize, moderateScale);
28
36
  const handleOnErrorImage = () => {
29
37
  setShowInitials(true);
30
38
  if (onErrorImg) {
@@ -35,22 +43,20 @@ const Avatar = ({ size = 'sm', textColor = '#FFFFFF', bgColor = '#E8EAF6', image
35
43
  styles.container,
36
44
  {
37
45
  backgroundColor: bgColor,
38
- borderRadius: getSize(size, customSize) / 2,
39
- height: getSize(size, customSize),
40
- width: getSize(size, customSize),
46
+ borderRadius: validBorderRadius,
47
+ height: validHeight,
48
+ width: validWidth,
41
49
  },
42
50
  style,
43
51
  ]} {...props}>
44
52
  {!!imageUrl && !showInitials && (<Image accessibilityRole="image" onError={handleOnErrorImage} onLoad={() => setShowInitials(false)} source={{
45
53
  uri: imageUrl,
46
54
  }} style={{
47
- height: getSize(size, customSize),
48
- width: getSize(size, customSize),
55
+ height: validHeight,
56
+ width: validWidth,
49
57
  }}/>)}
50
58
 
51
- {(showInitials || !imageUrl) && !!initials.length && (<Text style={[styles.text, { color: textColor, fontSize: getSize(size, customSize) * 0.4 }]}>
52
- {initials}
53
- </Text>)}
59
+ {(showInitials || !imageUrl) && !!initials.length && (<Text style={[styles.text, { color: textColor, fontSize: validFontSize }]}>{initials}</Text>)}
54
60
  </View>);
55
61
  };
56
62
  export default Avatar;
@@ -0,0 +1,16 @@
1
+ import React, { FC } from 'react';
2
+ import { PressableProps, ViewStyle } from 'react-native';
3
+ interface BaseButtonProps extends PressableProps {
4
+ title?: string | null;
5
+ icon?: string;
6
+ iconRight?: boolean;
7
+ disabled?: boolean;
8
+ borderRadius?: number;
9
+ pressedColor?: string;
10
+ style?: ViewStyle;
11
+ iconStyle?: ViewStyle;
12
+ textStyle?: ViewStyle;
13
+ children?: React.ReactNode;
14
+ }
15
+ declare const BaseButton: FC<BaseButtonProps>;
16
+ export default BaseButton;
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { Pressable, StyleSheet } from 'react-native';
3
+ import { moderateScale, horizontalScale, scaledForDevice } from '../../scale';
4
+ import { palette } from '../../theme/palette';
5
+ import Text from '../Text';
6
+ import Icon from '../Icon';
7
+ const BaseButton = ({ title = null, icon = null, iconRight = false, disabled = false, borderRadius = 0, pressedColor, style, iconStyle, textStyle, children = null, ...props }) => {
8
+ if (!title && !icon && !children) {
9
+ return null;
10
+ }
11
+ const bgColor = !disabled ? palette.primary.main : palette.grey[200];
12
+ const iconPaddingLeft = iconRight && title ? 8 : 0;
13
+ const iconPaddingRight = !iconRight && title ? 8 : 0;
14
+ const validatePaddingVertical = scaledForDevice(10, moderateScale);
15
+ const validatePaddingHorizontal = scaledForDevice(16, horizontalScale);
16
+ const validateFontSize = scaledForDevice(14, moderateScale);
17
+ const validateBorderRadius = scaledForDevice(borderRadius, moderateScale);
18
+ const validatePaddingRightIcon = scaledForDevice(iconPaddingRight, horizontalScale);
19
+ const validatePaddingLeftIcon = scaledForDevice(iconPaddingLeft, horizontalScale);
20
+ const styles = StyleSheet.create({
21
+ container: {
22
+ display: 'flex',
23
+ flexDirection: 'row',
24
+ alignItems: 'center',
25
+ justifyContent: 'center',
26
+ paddingHorizontal: validatePaddingHorizontal,
27
+ paddingVertical: validatePaddingVertical,
28
+ borderRadius: validateBorderRadius,
29
+ backgroundColor: bgColor,
30
+ },
31
+ icon: {
32
+ color: palette.base.white,
33
+ paddingRight: validatePaddingRightIcon,
34
+ paddingLeft: validatePaddingLeftIcon,
35
+ },
36
+ title: {
37
+ fontSize: validateFontSize,
38
+ fontWeight: '500',
39
+ textAlign: 'center',
40
+ color: palette.base.white,
41
+ },
42
+ });
43
+ const noChildren = () => (<>
44
+ {icon && !iconRight && <Icon name={icon} style={[styles.icon, iconStyle]} size={24}/>}
45
+ {title && <Text style={[styles.title, textStyle]}>{title}</Text>}
46
+ {icon && iconRight && <Icon name={icon} style={[styles.icon, iconStyle]} size={24}/>}
47
+ </>);
48
+ /* istanbul ignore next */
49
+ const PressableStyle = ({ pressed }) => {
50
+ const backgroundColor = pressedColor ?? palette.primary.dark;
51
+ const pressedBgColor = pressed ? [{ backgroundColor }] : [];
52
+ return [styles.container, style, ...pressedBgColor];
53
+ };
54
+ return (<Pressable style={PressableStyle} disabled={disabled} {...props}>
55
+ {children ?? noChildren}
56
+ </Pressable>);
57
+ };
58
+ export default BaseButton;
@@ -1,36 +1,43 @@
1
1
  import React from 'react';
2
2
  import { View, TouchableOpacity, StyleSheet } from 'react-native';
3
3
  import { base, grey, primary } from '../../theme/palette';
4
+ import { moderateScale, horizontalScale, scaledForDevice } from '../../scale';
4
5
  import Icon from './icon/CheckedIcon';
5
6
  const getCheckBoxScale = (size, divisor) => size / divisor;
6
7
  const CheckBox = ({ checked, customSize = 16, checkOnColor = primary.main, checkOffColor = grey[500], iconCheckColor = base.white, borderRadius, disabled = false, style, ...props }) => {
7
8
  const hasBorderRadius = !borderRadius ? getCheckBoxScale(customSize, 4) : borderRadius;
9
+ const validateIconSize = scaledForDevice(customSize, moderateScale);
10
+ const validWidth = scaledForDevice(customSize, horizontalScale);
11
+ const validHeight = scaledForDevice(customSize, moderateScale);
12
+ const validBorderRadius = scaledForDevice(hasBorderRadius, moderateScale);
8
13
  const styles = StyleSheet.create({
9
14
  touchableOpacity: {
10
- width: customSize,
11
- height: customSize,
12
- borderRadius: hasBorderRadius,
15
+ width: validWidth,
16
+ height: validHeight,
17
+ borderRadius: validBorderRadius,
13
18
  },
14
19
  checkOn: {
15
20
  display: 'flex',
16
21
  justifyContent: 'center',
17
22
  alignItems: 'center',
18
23
  backgroundColor: !disabled ? checkOnColor : grey[200],
19
- width: customSize,
20
- height: customSize,
21
- borderRadius: hasBorderRadius,
24
+ width: validWidth,
25
+ height: validHeight,
26
+ borderRadius: validBorderRadius,
22
27
  },
23
28
  checkOff: {
24
29
  borderWidth: getCheckBoxScale(customSize, 16),
25
30
  borderColor: !disabled ? checkOffColor : grey[200],
26
- width: customSize,
27
- height: customSize,
31
+ width: validWidth,
32
+ height: validHeight,
28
33
  borderRadius: hasBorderRadius,
29
34
  },
30
35
  });
31
36
  const isChecked = checked ? styles.checkOn : styles.checkOff;
32
37
  return (<TouchableOpacity disabled={disabled} activeOpacity={0.6} style={[styles.touchableOpacity, style]} {...props}>
33
- <View style={isChecked}>{checked && <Icon color={iconCheckColor} size={customSize}/>}</View>
38
+ <View style={isChecked}>
39
+ {checked && <Icon color={iconCheckColor} size={validateIconSize}/>}
40
+ </View>
34
41
  </TouchableOpacity>);
35
42
  };
36
43
  export default CheckBox;
@@ -3,6 +3,7 @@ interface Props {
3
3
  name: string;
4
4
  color?: string;
5
5
  size?: number;
6
+ style?: any;
6
7
  }
7
8
  declare const Icon: FC<Props>;
8
9
  export default Icon;
@@ -2,11 +2,13 @@ import React from 'react';
2
2
  import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
3
3
  import icoMoonConfig from './assets/fonts/selection.json';
4
4
  import { primary } from '../../theme/palette';
5
+ import { moderateScale, scaledForDevice } from '../../scale';
5
6
  const IconComponent = createIconSetFromIcoMoon(icoMoonConfig, 'janis-font-icon', 'janis-font-icon.ttf');
6
7
  const Icon = ({ name, color = primary.main, size = 16, ...props }) => {
7
8
  if (!name) {
8
9
  return null;
9
10
  }
10
- return <IconComponent name={name} color={color} size={size} {...props}/>;
11
+ const validateSize = scaledForDevice(size, moderateScale);
12
+ return <IconComponent name={name} color={color} size={validateSize} {...props}/>;
11
13
  };
12
14
  export default Icon;
@@ -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
- // eslint-disable-next-line no-shadow
4
+ import { moderateScale, horizontalScale, scaledForDevice } from '../../scale';
5
5
  export var keyboardTypes;
6
6
  (function (keyboardTypes) {
7
7
  keyboardTypes["default"] = "default";
@@ -45,34 +45,40 @@ const Input = React.forwardRef(({ disabled = false, readOnly = false, label, pla
45
45
  status,
46
46
  });
47
47
  const validStatusMessageColor = getStatusMessageColor(status);
48
+ const validBottom = scaledForDevice(25, moderateScale);
49
+ const validHeight = scaledForDevice(50, moderateScale);
50
+ const validBorderBottomWidth = scaledForDevice(1, horizontalScale);
51
+ const validLineHeight = scaledForDevice(19, moderateScale);
52
+ const validFontSize = scaledForDevice(16, moderateScale);
53
+ const validateMarginTop = scaledForDevice(5, moderateScale);
48
54
  const styles = StyleSheet.create({
49
55
  container: {
50
56
  width: '100%',
51
57
  },
52
58
  inputWrapper: {
53
- height: 50,
59
+ height: validHeight,
54
60
  borderBottomColor: validBorderColor,
55
- borderBottomWidth: 1,
61
+ borderBottomWidth: validBorderBottomWidth,
56
62
  justifyContent: 'flex-end',
57
63
  },
58
64
  label: {
59
65
  color: validLabelColor,
60
- fontSize: 16,
66
+ fontSize: validFontSize,
61
67
  letterSpacing: 0,
62
- lineHeight: 19,
68
+ lineHeight: validLineHeight,
63
69
  position: 'absolute',
64
- bottom: raiseLabel({ disabled, hasMessage, inputState }) ? 25 : 0,
70
+ bottom: raiseLabel({ disabled, hasMessage, inputState }) ? validBottom : 0,
65
71
  },
66
72
  input: {
67
73
  color: valueColor,
68
- fontSize: 16,
74
+ fontSize: validFontSize,
69
75
  letterSpacing: 0,
70
- lineHeight: 19,
76
+ lineHeight: validLineHeight,
71
77
  padding: 0,
72
78
  },
73
79
  statusMessage: {
74
80
  color: validStatusMessageColor,
75
- marginTop: 5,
81
+ marginTop: validateMarginTop,
76
82
  },
77
83
  });
78
84
  return (<View style={styles.container}>
@@ -0,0 +1,20 @@
1
+ import React, { FC } from 'react';
2
+ import { FlatListProps, ScrollViewProps } from 'react-native';
3
+ type TypeData = string | number | object | [] | React.ReactElement;
4
+ type RCProps = {
5
+ item: TypeData;
6
+ index: number;
7
+ };
8
+ type TypeRenderComponent = ({ item, index }: RCProps) => React.ReactElement;
9
+ export declare enum TypeList {
10
+ FlatList = "flatList",
11
+ ScrollView = "scrollView"
12
+ }
13
+ interface ListProps {
14
+ data: TypeData[] | undefined;
15
+ renderComponent: TypeRenderComponent;
16
+ type?: TypeList;
17
+ }
18
+ type MergedProps = ListProps & (FlatListProps<TypeData> | ScrollViewProps);
19
+ declare const List: FC<MergedProps>;
20
+ export default List;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { FlatList, ScrollView } from 'react-native';
3
+ export var TypeList;
4
+ (function (TypeList) {
5
+ TypeList["FlatList"] = "flatList";
6
+ TypeList["ScrollView"] = "scrollView";
7
+ })(TypeList || (TypeList = {}));
8
+ const List = ({ data, renderComponent, type = TypeList.FlatList, ...props }) => {
9
+ if (!data?.length) {
10
+ return null;
11
+ }
12
+ const FlatListComponent = () => <FlatList data={data} renderItem={renderComponent} {...props}/>;
13
+ const ScrollViewComponent = () => (<ScrollView {...props}>{data.map((item, index) => renderComponent({ item, index }))}</ScrollView>);
14
+ return type === TypeList.FlatList ? <FlatListComponent /> : <ScrollViewComponent />;
15
+ };
16
+ export default List;
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from 'react';
2
2
  import { StyleSheet, View, Animated, Easing } from 'react-native';
3
3
  import LoadingSvg from './LoadingSvg';
4
4
  import { primary } from '../../theme/palette';
5
+ import { horizontalScale, moderateScale, scaledForDevice } from '../../scale';
5
6
  const startRotationAnimation = ({ duration, rotationDegree, timingAnimation }) => Animated.loop(Animated.timing(rotationDegree, {
6
7
  duration,
7
8
  toValue: 360,
@@ -10,13 +11,16 @@ const startRotationAnimation = ({ duration, rotationDegree, timingAnimation }) =
10
11
  })).start();
11
12
  const Loading = ({ isLoading, color = primary.main, size = 64, duration = 1000, children = null, style, ...props }) => {
12
13
  const rotationDegree = useRef(new Animated.Value(0)).current;
14
+ const validWidth = scaledForDevice(size, horizontalScale);
15
+ const validHeight = scaledForDevice(size, moderateScale);
16
+ const validSize = scaledForDevice(size, moderateScale);
13
17
  const styles = StyleSheet.create({
14
18
  container: {
15
19
  position: 'relative',
16
20
  justifyContent: 'center',
17
21
  alignItems: 'center',
18
- width: size,
19
- height: size,
22
+ width: validWidth,
23
+ height: validHeight,
20
24
  },
21
25
  spinner: {
22
26
  position: 'absolute',
@@ -49,7 +53,7 @@ const Loading = ({ isLoading, color = primary.main, size = 64, duration = 1000,
49
53
  return <></>;
50
54
  }
51
55
  return (<View style={[styles.container, style]} {...props}>
52
- <LoadingSvg style={[styles.spinner, { ...animationSpinnerStyle }]} size={size} color={color}/>
56
+ <LoadingSvg style={[styles.spinner, { ...animationSpinnerStyle }]} size={validSize} color={color}/>
53
57
  {children}
54
58
  </View>);
55
59
  };
@@ -3,6 +3,12 @@ import { StyleSheet, Modal, Text, View } from 'react-native';
3
3
  import Loading from '../Loading';
4
4
  import Svg from '../Svg';
5
5
  import { grey, white } from '../../theme/palette';
6
+ import { moderateScale, horizontalScale, scaledForDevice } from '../../scale';
7
+ const validFontSize = scaledForDevice(16, moderateScale);
8
+ const validLineHeight = scaledForDevice(24, moderateScale);
9
+ const validMarginTop = scaledForDevice(25, moderateScale);
10
+ const validWidth = scaledForDevice(36, horizontalScale);
11
+ const validHeight = scaledForDevice(25, moderateScale);
6
12
  const styles = StyleSheet.create({
7
13
  ContainerStyles: {
8
14
  flex: 1,
@@ -11,14 +17,14 @@ const styles = StyleSheet.create({
11
17
  backgroundColor: white.semiTransparent,
12
18
  },
13
19
  TextStyles: {
14
- fontSize: 16,
15
- lineHeight: 24,
20
+ fontSize: validFontSize,
21
+ lineHeight: validLineHeight,
16
22
  fontFamily: 'Roboto',
17
23
  color: grey[700],
18
24
  textAlign: 'center',
19
25
  fontWeight: '500',
20
26
  width: '50%',
21
- marginTop: 25,
27
+ marginTop: validMarginTop,
22
28
  },
23
29
  });
24
30
  const LoadingFullScreen = ({ text, isLoading, svgName = 'janis-logo', spinnerDuration = 2000, style, ...props }) => {
@@ -26,7 +32,7 @@ const LoadingFullScreen = ({ text, isLoading, svgName = 'janis-logo', spinnerDur
26
32
  return (<Modal visible={isLoading} transparent animationType="fade" testID="loading modal" {...props}>
27
33
  <View style={[styles.ContainerStyles, style]}>
28
34
  <Loading isLoading={isLoading} duration={spinnerDuration}>
29
- <Svg name={svgName} width={36} height={25}/>
35
+ <Svg name={svgName} width={validWidth} height={validHeight}/>
30
36
  </Loading>
31
37
  {hasTextPassed && <Text style={styles.TextStyles}>{text}</Text>}
32
38
  </View>
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ interface ProgressBarProps {
4
+ value: number;
5
+ totalValue: number;
6
+ isAnimated?: boolean;
7
+ duration?: number;
8
+ style?: ViewStyle;
9
+ }
10
+ declare const ProgressBar: FC<ProgressBarProps>;
11
+ export default ProgressBar;
@@ -0,0 +1,58 @@
1
+ /* istanbul ignore file */
2
+ import React, { useEffect, useRef } from 'react';
3
+ import { View, StyleSheet, Animated, Easing } from 'react-native';
4
+ import { palette } from '../../theme/palette';
5
+ import { getBarColor, getPercentage } from './utils';
6
+ import { moderateScale, scaledForDevice } from '../../scale';
7
+ const ProgressBar = ({ value, totalValue, isAnimated = false, duration = 300, style, ...props }) => {
8
+ const { white } = palette;
9
+ const widthAnimation = useRef(new Animated.Value(0)).current;
10
+ const availableTimeDuration = isAnimated && typeof duration === 'number';
11
+ const timeDuration = availableTimeDuration ? duration : 0;
12
+ const percentValue = getPercentage(value, totalValue);
13
+ const colorValue = getBarColor(percentValue);
14
+ useEffect(() => {
15
+ if (isAnimated) {
16
+ Animated.timing(widthAnimation, {
17
+ toValue: percentValue,
18
+ duration: timeDuration,
19
+ easing: Easing.linear,
20
+ useNativeDriver: false,
21
+ }).start();
22
+ }
23
+ else {
24
+ widthAnimation.setValue(percentValue);
25
+ }
26
+ }, [isAnimated, percentValue, timeDuration, widthAnimation]);
27
+ const validHeight = scaledForDevice(4, moderateScale);
28
+ const validBorderRadius = scaledForDevice(2, moderateScale);
29
+ const validMarginTop = scaledForDevice(12, moderateScale);
30
+ const styles = StyleSheet.create({
31
+ container: {
32
+ position: 'relative',
33
+ width: '100%',
34
+ height: validHeight,
35
+ marginTop: validMarginTop,
36
+ borderRadius: validBorderRadius,
37
+ backgroundColor: white.main,
38
+ },
39
+ fill: {
40
+ position: 'absolute',
41
+ left: 0,
42
+ height: validHeight,
43
+ borderRadius: validBorderRadius,
44
+ zIndex: 10,
45
+ backgroundColor: colorValue,
46
+ },
47
+ });
48
+ const animationProgress = {
49
+ width: widthAnimation.interpolate({
50
+ inputRange: [0, 100],
51
+ outputRange: ['0%', '100%'],
52
+ }),
53
+ };
54
+ return (<View style={[styles.container, style]} {...props}>
55
+ <Animated.View style={[styles.fill, animationProgress]}/>
56
+ </View>);
57
+ };
58
+ export default ProgressBar;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @name getPercentage
3
+ * @description return the percentage form a partial value and a total value,
4
+ * rounded to the nearest integer
5
+ * @param {number} value the partial value
6
+ * @param {number} totalValue the total value
7
+ * @returns {number|null} the percentage in the range 0-100, or null if receives an invalid param
8
+ * @example getPercentage(45,100) // 45
9
+ * @example getPercentage(22,150) // 15
10
+ */
11
+ export declare const getPercentage: (value: number, totalValue: number) => number;
12
+ /**
13
+ * @name getBarColor
14
+ * @description Devuelve una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto
15
+ * considerando los diferentes umbrales (25, 50 y 75).
16
+ * @returns {Function} - Una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto.
17
+ * @example getBarColor(30) // '#FF8D10' (naranja)
18
+ * @example getBarColor(90) // '#1DB779' (verde)
19
+ */
20
+ export declare const getBarColor: (percentage: number) => string;
@@ -0,0 +1,52 @@
1
+ import { palette } from '../../../theme/palette';
2
+ const THRESHOLD = {
3
+ warning: 25,
4
+ alert: 50,
5
+ success: 75,
6
+ };
7
+ /**
8
+ * @name getPercentage
9
+ * @description return the percentage form a partial value and a total value,
10
+ * rounded to the nearest integer
11
+ * @param {number} value the partial value
12
+ * @param {number} totalValue the total value
13
+ * @returns {number|null} the percentage in the range 0-100, or null if receives an invalid param
14
+ * @example getPercentage(45,100) // 45
15
+ * @example getPercentage(22,150) // 15
16
+ */
17
+ export const getPercentage = (value, totalValue) => {
18
+ if (typeof totalValue !== 'number' || typeof value !== 'number' || totalValue < 0 || value < 0) {
19
+ return 0;
20
+ }
21
+ if (value >= totalValue) {
22
+ return totalValue;
23
+ }
24
+ return Math.round(100 * (value / totalValue));
25
+ };
26
+ /**
27
+ * @name getBarColor
28
+ * @description Devuelve una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto
29
+ * considerando los diferentes umbrales (25, 50 y 75).
30
+ * @returns {Function} - Una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto.
31
+ * @example getBarColor(30) // '#FF8D10' (naranja)
32
+ * @example getBarColor(90) // '#1DB779' (verde)
33
+ */
34
+ export const getBarColor = (percentage) => {
35
+ if (typeof percentage !== 'number') {
36
+ return palette.white.main;
37
+ }
38
+ let barColor = '';
39
+ if (percentage >= THRESHOLD.success) {
40
+ barColor = palette.success.main;
41
+ }
42
+ else if (percentage >= THRESHOLD.alert) {
43
+ barColor = palette.alert.main;
44
+ }
45
+ else if (percentage >= THRESHOLD.warning) {
46
+ barColor = palette.warning.main;
47
+ }
48
+ else {
49
+ barColor = palette.error.main;
50
+ }
51
+ return barColor;
52
+ };
@@ -2,17 +2,21 @@ 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 '../../scale';
5
6
  const checkLocation = ['left', 'right'];
6
7
  const CheckSizeValues = {
7
8
  sm: 16,
8
9
  md: 24,
9
10
  lg: 32,
10
11
  };
12
+ const validPaddingHorizontal = scaledForDevice(16, horizontalScale);
13
+ const validMarginVertical = scaledForDevice(10, moderateScale);
14
+ const validMarginHorizontal = scaledForDevice(15, horizontalScale);
11
15
  const styles = StyleSheet.create({
12
16
  container: {
13
17
  alignItems: 'center',
14
- paddingHorizontal: 16,
15
- marginVertical: 10,
18
+ paddingHorizontal: validPaddingHorizontal,
19
+ marginVertical: validMarginVertical,
16
20
  height: 'auto',
17
21
  },
18
22
  row: {
@@ -24,10 +28,10 @@ const styles = StyleSheet.create({
24
28
  justifyContent: 'space-between',
25
29
  },
26
30
  checkToLeft: {
27
- marginLeft: 15,
31
+ marginLeft: validMarginHorizontal,
28
32
  },
29
33
  checkToRight: {
30
- marginRight: 15,
34
+ marginRight: validMarginHorizontal,
31
35
  },
32
36
  });
33
37
  const RadioButton = ({ children, onPress, selected = false, checkPosition = 'left', checkSize = 'sm', disabled = false, style, ...props }) => {
@@ -39,7 +43,7 @@ const RadioButton = ({ children, onPress, selected = false, checkPosition = 'lef
39
43
  const checkLeft = checkPosition === 'left';
40
44
  const customSize = CheckSizeValues[checkSize];
41
45
  return (<TouchableOpacity style={[container, checkLeft ? row : reverseRow, style]} disabled={disabled} onPress={onPress} {...props}>
42
- <CheckBox checked={selected} disabled={disabled} customSize={customSize} borderRadius={customSize / 2}/>
46
+ <CheckBox checked={selected} disabled={disabled} customSize={customSize} borderRadius={customSize / 2} onPress={onPress}/>
43
47
  <View style={checkLeft ? checkToLeft : checkToRight}>
44
48
  {isStringChild ? <Text>{children}</Text> : children}
45
49
  </View>
@@ -1,45 +1,57 @@
1
1
  import React from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity, ScrollView, Text } from 'react-native';
3
3
  import { base, black, grey, primary, white } from '../../../../theme/palette';
4
+ import { horizontalScale, moderateScale, scaledForDevice } from '../../../../scale';
4
5
  const Dropdown = (props) => {
5
6
  const { isShowedDropdown, filteredOptions, callbackOption, selectedOptions, noOptionsMessage, optionStyles, customOptionComponent = null, } = props;
6
7
  if (!isShowedDropdown) {
7
8
  return null;
8
9
  }
9
10
  const handleSelectedOption = (option) => callbackOption(option);
11
+ const validPadding = scaledForDevice(8, moderateScale);
12
+ const validMaxHeight = scaledForDevice(168, moderateScale);
13
+ const validTop = scaledForDevice(60, moderateScale);
14
+ const validMarginBottom = scaledForDevice(20, moderateScale);
15
+ const validElevation = scaledForDevice(5, moderateScale);
16
+ const validHeight = scaledForDevice(42, moderateScale);
17
+ const validLeft = scaledForDevice(8, horizontalScale);
18
+ const validFontSize = scaledForDevice(14, moderateScale);
19
+ const validPaddingVertical = scaledForDevice(10, moderateScale);
10
20
  const styles = StyleSheet.create({
11
21
  container: {
12
22
  width: '100%',
13
- padding: 8,
23
+ padding: validPadding,
14
24
  },
15
25
  optionWrapper: {
16
26
  position: 'absolute',
17
- maxHeight: 168,
27
+ maxHeight: validMaxHeight,
18
28
  borderColor: grey[200],
19
29
  backgroundColor: base.white,
20
30
  width: '100%',
21
- top: 60,
22
- marginBottom: 20,
23
- elevation: 5,
31
+ top: validTop,
32
+ marginBottom: validMarginBottom,
33
+ elevation: validElevation,
24
34
  zIndex: 10,
25
35
  flex: 1,
26
36
  },
27
37
  option: {
28
38
  width: '100%',
29
- height: 42,
39
+ height: validHeight,
30
40
  justifyContent: 'center',
31
41
  alignItems: 'stretch',
32
- paddingLeft: 8,
42
+ paddingLeft: validLeft,
33
43
  },
34
44
  optionText: {
45
+ fontSize: validFontSize,
35
46
  color: black.main,
36
47
  fontWeight: '400',
37
48
  },
38
49
  noOptionText: {
50
+ fontSize: validFontSize,
39
51
  color: grey[500],
40
52
  fontWeight: '400',
41
- paddingLeft: 8,
42
- paddingVertical: 10,
53
+ paddingLeft: validLeft,
54
+ paddingVertical: validPaddingVertical,
43
55
  },
44
56
  });
45
57
  const renderOptions = filteredOptions?.length &&
@@ -11,7 +11,6 @@ declare const Chevron: {
11
11
  ({ style, color, size, onPress, ...props }: IconProps): React.JSX.Element;
12
12
  defaultProps: {
13
13
  color: string;
14
- size: number;
15
14
  onPress: () => void;
16
15
  };
17
16
  };
@@ -2,10 +2,12 @@ import React from 'react';
2
2
  import { Pressable, View } from 'react-native';
3
3
  import { primary } from '../../../../../theme/palette';
4
4
  import Svg, { Path } from 'react-native-svg';
5
- const Chevron = ({ style, color, size, onPress, ...props }) => {
5
+ import { moderateScale, scaledForDevice } from '../../../../../scale';
6
+ const Chevron = ({ style, color, size = 21, onPress, ...props }) => {
7
+ const validSize = scaledForDevice(size, moderateScale);
6
8
  return (<Pressable onPress={onPress} style={style} {...props}>
7
9
  <View>
8
- <Svg width={size} height={size} viewBox="0 0 16 16">
10
+ <Svg width={validSize} height={validSize} viewBox="0 0 16 16">
9
11
  <Path d="M8.17432 11.1055L3 6.49316L4.33106 5L8.17627 8.42773L12.0132 5.01904L13.3413 6.51416L8.17432 11.1055Z" fill={color}/>
10
12
  </Svg>
11
13
  </View>
@@ -13,7 +15,6 @@ const Chevron = ({ style, color, size, onPress, ...props }) => {
13
15
  };
14
16
  Chevron.defaultProps = {
15
17
  color: primary.main,
16
- size: 21,
17
18
  onPress: () => { },
18
19
  };
19
20
  export default Chevron;
@@ -11,7 +11,6 @@ declare const Delete: {
11
11
  ({ style, color, size, onPress, ...props }: IconProps): React.JSX.Element;
12
12
  defaultProps: {
13
13
  color: string;
14
- size: number;
15
14
  onPress: () => void;
16
15
  };
17
16
  };
@@ -2,10 +2,12 @@ import React from 'react';
2
2
  import { Pressable, View } from 'react-native';
3
3
  import { black } from '../../../../../theme/palette';
4
4
  import Svg, { Path } from 'react-native-svg';
5
- const Delete = ({ style, color, size, onPress, ...props }) => {
5
+ import { moderateScale, scaledForDevice } from '../../../../../scale';
6
+ const Delete = ({ style, color, size = 21, onPress, ...props }) => {
7
+ const validSize = scaledForDevice(size, moderateScale);
6
8
  return (<Pressable onPress={onPress} style={style} {...props}>
7
9
  <View>
8
- <Svg width={size} height={size} viewBox="0 0 16 16">
10
+ <Svg width={validSize} height={validSize} viewBox="0 0 16 16">
9
11
  <Path fill-rule="evenodd" clip-rule="evenodd" d="M1 8C1 4.13403 4.13397 1 8 1C11.866 1 15 4.13403 15 8C15 11.866 11.866 15 8 15C4.13397 15 1 11.866 1 8ZM10.03 11.4441L11.4441 10.03L9.41406 8L11.4441 5.96997L10.03 4.55591L8 6.58594L5.96997 4.55591L4.55591 5.96997L6.58594 8L4.55591 10.03L5.96997 11.4441L8 9.41406L10.03 11.4441Z" fill={color}/>
10
12
  </Svg>
11
13
  </View>
@@ -13,7 +15,6 @@ const Delete = ({ style, color, size, onPress, ...props }) => {
13
15
  };
14
16
  Delete.defaultProps = {
15
17
  color: black.main,
16
- size: 21,
17
18
  onPress: () => { },
18
19
  };
19
20
  export default Delete;
@@ -1,3 +1,4 @@
1
+ /* istanbul ignore file */
1
2
  import React, { useState, useEffect, useRef, useCallback } from 'react';
2
3
  import { Keyboard, StyleSheet, Text, TextInput, View } from 'react-native';
3
4
  import { black, grey, primary } from '../../theme/palette';
@@ -5,7 +6,7 @@ import { formatPlaceholderMulti } from './utils';
5
6
  import ChevronIcon from './Components/Icons/Chevron';
6
7
  import DeleteIcon from './Components/Icons/Delete';
7
8
  import Dropdown from './Components/Dropdown';
8
- // eslint-disable-next-line no-shadow
9
+ import { horizontalScale, moderateScale, scaledForDevice } from '../../scale';
9
10
  var KeyboardTypes;
10
11
  (function (KeyboardTypes) {
11
12
  KeyboardTypes["Default"] = "default";
@@ -84,10 +85,20 @@ const Select = ({ options, label, value = null, placeholder = '', optionStyles =
84
85
  setInputValue(value);
85
86
  }
86
87
  }, [hasDefaultValue, value]);
88
+ const moveLabel = isMoveLabel ? 38 : 10;
89
+ const validFontSize = scaledForDevice(16, moderateScale);
90
+ const validMarginBottom = scaledForDevice(10, moderateScale);
91
+ const validMarginTop = scaledForDevice(18, moderateScale);
92
+ const validHeightLabel = scaledForDevice(19, moderateScale);
93
+ const validPadding = scaledForDevice(8, moderateScale);
94
+ const validBottomLabel = scaledForDevice(moveLabel, moderateScale);
95
+ const validHeightInput = scaledForDevice(38, moderateScale);
96
+ const validRight = scaledForDevice(30, horizontalScale);
97
+ const validBorderBottomWidth = scaledForDevice(1, moderateScale);
87
98
  const styles = StyleSheet.create({
88
99
  wrapper: {
89
100
  width: '100%',
90
- marginBottom: 10,
101
+ marginBottom: validMarginBottom,
91
102
  position: 'relative',
92
103
  zIndex: isShowedDropdown ? 10 : 0,
93
104
  },
@@ -95,32 +106,32 @@ const Select = ({ options, label, value = null, placeholder = '', optionStyles =
95
106
  position: 'relative',
96
107
  width: '100%',
97
108
  marginBottom: 0,
98
- marginTop: 18,
109
+ marginTop: validMarginTop,
99
110
  },
100
111
  label: {
101
112
  position: 'absolute',
102
113
  color: isMoveLabel && !isDisabled ? primary.main : black.main,
103
- fontSize: 16,
104
- lineHeight: 19,
114
+ fontSize: validFontSize,
115
+ lineHeight: validHeightLabel,
105
116
  letterSpacing: 0,
106
117
  left: 0,
107
118
  fontWeight: isMoveLabel ? '600' : '400',
108
- bottom: isMoveLabel ? 38 : 10,
119
+ bottom: validBottomLabel,
109
120
  },
110
121
  input: {
111
122
  width: '100%',
112
- height: 38,
123
+ height: validHeightInput,
113
124
  padding: 0,
114
- fontSize: 16,
115
- lineHeight: 19,
125
+ fontSize: validFontSize,
126
+ lineHeight: validHeightLabel,
116
127
  letterSpacing: 0,
117
- borderBottomWidth: 1,
128
+ borderBottomWidth: validBorderBottomWidth,
118
129
  color: black.main,
119
130
  borderBottomColor: isShowedDropdown ? primary.main : grey[200],
120
131
  },
121
132
  arrowIcon: {
122
133
  position: 'absolute',
123
- padding: 8,
134
+ padding: validPadding,
124
135
  right: 0,
125
136
  bottom: 0,
126
137
  zIndex: 1,
@@ -128,8 +139,8 @@ const Select = ({ options, label, value = null, placeholder = '', optionStyles =
128
139
  },
129
140
  deleteIcon: {
130
141
  position: 'absolute',
131
- padding: 8,
132
- right: 30,
142
+ padding: validPadding,
143
+ right: validRight,
133
144
  bottom: 0,
134
145
  zIndex: 1,
135
146
  },
@@ -2,21 +2,28 @@ import React, { isValidElement } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import { base, grey, primary } from '../../theme/palette';
4
4
  import Text from '../Text';
5
+ import { horizontalScale, moderateScale, scaledForDevice } from '../../scale';
6
+ const validHeight = scaledForDevice(24, moderateScale);
7
+ const validPadding = scaledForDevice(12, horizontalScale);
8
+ const validBorderRadius = scaledForDevice(12, moderateScale);
9
+ const validBorderWidth = scaledForDevice(1, moderateScale);
10
+ const validFontSize = scaledForDevice(13, moderateScale);
11
+ const validLineHeight = scaledForDevice(18, moderateScale);
5
12
  const styles = ({ background }) => StyleSheet.create({
6
13
  ViewStyles: {
7
- height: 24,
14
+ height: validHeight,
8
15
  flexDirection: 'row',
9
16
  alignItems: 'center',
10
- paddingLeft: 12,
11
- paddingRight: 12,
12
- borderRadius: 12,
17
+ paddingLeft: validPadding,
18
+ paddingRight: validPadding,
19
+ borderRadius: validBorderRadius,
13
20
  backgroundColor: background ?? base.white,
14
- borderWidth: 1,
21
+ borderWidth: validBorderWidth,
15
22
  borderColor: background ?? grey['300'],
16
23
  },
17
24
  TextStyles: {
18
- fontSize: 13,
19
- lineHeight: 18,
25
+ fontSize: validFontSize,
26
+ lineHeight: validLineHeight,
20
27
  fontFamily: 'Roboto',
21
28
  fontWeight: '900',
22
29
  textAlign: 'center',
@@ -7,6 +7,7 @@ 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 '../../scale';
10
11
  const svgs = {
11
12
  'empty-illustration': EmptyIllustration,
12
13
  'empty-list-illustration': EmptyListIllustration,
@@ -20,8 +21,14 @@ const Svg = ({ name, width, height, size, ...props }) => {
20
21
  return null;
21
22
  }
22
23
  const SvgSelected = svgs[name];
24
+ const selectedWidth = size ?? width;
25
+ const selectedHeight = size ?? height;
26
+ const parseSelectedWidth = selectedWidth || 0;
27
+ const parseSelectedHeight = selectedHeight || 0;
28
+ const validateWidth = scaledForDevice(parseSelectedWidth, horizontalScale);
29
+ const validateHeight = scaledForDevice(parseSelectedHeight, moderateScale);
23
30
  return (<View {...props}>
24
- <SvgSelected width={size ?? width} height={size ?? height} {...props}/>
31
+ <SvgSelected width={validateWidth} height={validateHeight} {...props}/>
25
32
  </View>);
26
33
  };
27
34
  export default Svg;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, Text as TextComponent, } from 'react-native';
3
+ import { moderateScale, scaledForDevice } from '../../scale';
3
4
  const Text = ({ children, style, ...props }) => {
4
5
  if (!children) {
5
6
  return null;
6
7
  }
8
+ const validFontSize = scaledForDevice(13, moderateScale);
7
9
  const styles = StyleSheet.create({
8
10
  TextStyles: {
9
- fontSize: 13,
11
+ fontSize: validFontSize,
10
12
  fontFamily: 'Roboto',
11
13
  },
12
14
  });
@@ -14,4 +14,8 @@ import RadioButton from './components/RadioButton';
14
14
  import SwipeUp from './components/SwipeUp';
15
15
  import { SwipeUpFlatList, SwipeUpScrollView, SwipeUpView } from './components/SwipeUp/childComponents';
16
16
  import Carousel from './components/Carousel';
17
- export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, };
17
+ import ProgressBar from './components/ProgressBar';
18
+ import List from './components/List';
19
+ import BaseButton from './components/BaseButton';
20
+ 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, };
@@ -14,4 +14,8 @@ import RadioButton from './components/RadioButton';
14
14
  import SwipeUp from './components/SwipeUp';
15
15
  import { SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, } from './components/SwipeUp/childComponents';
16
16
  import Carousel from './components/Carousel';
17
- export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, };
17
+ import ProgressBar from './components/ProgressBar';
18
+ import List from './components/List';
19
+ import BaseButton from './components/BaseButton';
20
+ 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, };
@@ -0,0 +1,8 @@
1
+ declare const isIOS: boolean;
2
+ declare const viewportWidth: number, viewportHeight: number;
3
+ declare const isSmallDevice: (minWidth?: number) => boolean;
4
+ declare const horizontalScale: (size: number) => number;
5
+ declare const verticalScale: (size: number) => number;
6
+ declare const moderateScale: (size: number, factor?: number) => number;
7
+ declare const scaledForDevice: (size: number, scaleCallback: (size: number) => number) => number;
8
+ export { isIOS, viewportWidth, viewportHeight, isSmallDevice, horizontalScale, verticalScale, moderateScale, scaledForDevice, };
@@ -0,0 +1,13 @@
1
+ import { Dimensions, PixelRatio, Platform } from 'react-native';
2
+ import { WEB_MODE } from '../../env.json';
3
+ const guidelineBaseWidth = 360;
4
+ const guidelineBaseHeight = 720;
5
+ const isIOS = Platform.OS === 'ios';
6
+ const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
7
+ const isSmallDevice = (minWidth = 365) => viewportWidth <= minWidth;
8
+ const horizontalScale = (size) => PixelRatio.roundToNearestPixel((viewportWidth / guidelineBaseWidth) * size);
9
+ const verticalScale = (size) => PixelRatio.roundToNearestPixel((viewportHeight / guidelineBaseHeight) * size);
10
+ const moderateScale = (size, factor = 1) => size + (horizontalScale(size) - size) * factor;
11
+ /* istanbul ignore next */
12
+ const scaledForDevice = (size, scaleCallback) => WEB_MODE ? size : scaleCallback(size);
13
+ export { isIOS, viewportWidth, viewportHeight, isSmallDevice, horizontalScale, verticalScale, moderateScale, scaledForDevice, };
@@ -6,12 +6,13 @@ const primary = {
6
6
  const black = {
7
7
  main: '#2F2F2F',
8
8
  dark: '#050505',
9
+ semiTransparent: '#0000001a',
9
10
  };
10
11
  const white = {
11
12
  main: '#E8EAF6',
12
13
  dark: '#D0D3E3',
13
14
  light: '#F4F5FB',
14
- semiTransparent: 'rgba(255, 255, 255, 0.75)',
15
+ semiTransparent: '#ffffffbf',
15
16
  };
16
17
  const grey = {
17
18
  100: '#DDDFE2',
@@ -19,8 +19,6 @@ export interface gamaColor {
19
19
  main: string;
20
20
  dark: string;
21
21
  }
22
- export interface Black extends gamaColor {
23
- }
24
22
  export interface Success extends gamaColor {
25
23
  }
26
24
  export interface Error extends gamaColor {
@@ -35,3 +33,6 @@ export interface Primary extends gamaColor {
35
33
  export interface White extends Primary {
36
34
  semiTransparent: string;
37
35
  }
36
+ export interface Black extends gamaColor {
37
+ semiTransparent: string;
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janiscommerce/ui-native",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "components library for Janis app",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,8 +8,10 @@
8
8
  "dist"
9
9
  ],
10
10
  "scripts": {
11
- "android": "sb-rn-get-stories --config-path .ondevice && react-native run-android",
12
- "ios": "sb-rn-get-stories --config-path .ondevice && react-native run-ios",
11
+ "android": "node scripts/set-app-mode.js app && react-native run-android",
12
+ "ios": "node scripts/set-app-mode.js app && react-native run-ios",
13
+ "storybook:android": "node scripts/set-app-mode.js storybook && sb-rn-get-stories --config-path .ondevice && react-native run-android",
14
+ "storybook:ios": "node scripts/set-app-mode.js storybook && sb-rn-get-stories --config-path .ondevice && react-native run-ios",
13
15
  "start": "react-native start",
14
16
  "test": "jest",
15
17
  "lint": "eslint .",
@@ -18,11 +20,11 @@
18
20
  "test:commit": "jest --colors --bail --findRelatedTests",
19
21
  "test:coverage": "tsc --noEmit && jest --collectCoverage --detectOpenHandles",
20
22
  "build": "rm -rf dist && tsc && cp -r android ios dist",
21
- "storybook": "react-native-storybook-server",
23
+ "storybook-server": "react-native-storybook-server",
22
24
  "storybook-watcher": "sb-rn-watcher --config-path .ondevice",
23
25
  "update-stories": "sb-rn-get-stories --config-path .ondevice",
24
- "storybook-web": " npm run storybook-web-build && start-storybook -p 6006 --config-dir ./.storybook",
25
- "storybook-web-build": "build-storybook --config-dir ./.storybook --output-dir ./.storybook_static",
26
+ "storybook-web": "node scripts/set-app-mode.js web && npm run storybook-web-build && start-storybook -p 6006 --config-dir ./.storybook",
27
+ "storybook-web-build": "node scripts/set-app-mode.js web && build-storybook --config-dir ./.storybook --output-dir ./.storybook_static",
26
28
  "storybook-web-docs": "build-storybook --config-dir ./.storybook --output-dir ./docs"
27
29
  },
28
30
  "repository": {
File without changes
File without changes
File without changes
File without changes