@holper/react-native-holper-storybook 0.6.102 → 0.7.1

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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/{readme.md → README.md} +19 -20
  3. package/index.js +3 -2
  4. package/lib/components/Button/index.tsx +66 -0
  5. package/lib/components/Button/{style.js → style.ts} +8 -7
  6. package/lib/components/Card/index.tsx +33 -0
  7. package/lib/components/Card/{style.js → style.ts} +5 -4
  8. package/lib/components/ConfirmationModal/{index.js → index.tsx} +25 -79
  9. package/lib/components/ConfirmationModal/{style.js → style.tsx} +14 -13
  10. package/lib/components/Container/{index.js → index.tsx} +7 -28
  11. package/lib/components/Container/{style.js → style.ts} +6 -5
  12. package/lib/components/CustomChatView/{index.js → index.tsx} +22 -30
  13. package/lib/components/CustomChatView/{style.js → style.ts} +1 -1
  14. package/lib/components/DeckSwiper/index.tsx +90 -0
  15. package/lib/components/DeckSwiper/{style.js → style.ts} +13 -12
  16. package/lib/components/DonutCountdown/index.tsx +86 -0
  17. package/lib/components/DonutCountdown/style.ts +8 -0
  18. package/lib/components/FloatingContainer/index.tsx +35 -0
  19. package/lib/components/FloatingContainer/{style.js → style.ts} +7 -6
  20. package/lib/components/Footer/index.tsx +35 -0
  21. package/lib/components/Footer/{style.js → style.ts} +4 -3
  22. package/lib/components/Header/index.tsx +21 -0
  23. package/lib/components/Header/{style.js → style.ts} +4 -3
  24. package/lib/components/ImagePicker/{index.js → index.tsx} +3 -12
  25. package/lib/components/ImageResponsive/index.tsx +24 -0
  26. package/lib/components/ImageResponsive/style.ts +9 -0
  27. package/lib/components/ImageViewer/index.tsx +36 -0
  28. package/lib/components/ImageViewer/{style.js → style.ts} +4 -3
  29. package/lib/components/Input/{index.js → index.tsx} +6 -33
  30. package/lib/components/Input/{style.js → style.ts} +7 -18
  31. package/lib/components/InputPin/{index.js → index.tsx} +6 -13
  32. package/lib/components/InputPin/{style.js → style.ts} +7 -6
  33. package/lib/components/MenuItem/index.tsx +25 -0
  34. package/lib/components/MenuItem/{style.js → style.ts} +9 -7
  35. package/lib/components/NavigationTitle/{index.js → index.tsx} +9 -30
  36. package/lib/components/NavigationTitle/{style.js → style.ts} +12 -11
  37. package/lib/components/Notification/index.tsx +44 -0
  38. package/lib/components/Notification/{style.js → style.ts} +13 -11
  39. package/lib/components/PreventDoubleClick/index.tsx +28 -0
  40. package/lib/components/Select/index.tsx +51 -0
  41. package/lib/components/Select/style.ts +64 -0
  42. package/lib/components/SwipeablePanel/{index.js → index.tsx} +58 -85
  43. package/lib/components/SwipeablePanel/{style.js → style.ts} +15 -14
  44. package/lib/components/Switch/index.tsx +30 -0
  45. package/lib/components/TakePicture/{confirmPictureModal.js → confirmPictureModal.tsx} +9 -33
  46. package/lib/components/TakePicture/index.tsx +148 -0
  47. package/lib/components/TakePicture/{style.js → style.ts} +4 -4
  48. package/lib/components/Text/index.tsx +33 -0
  49. package/lib/components/Text/{style.js → style.ts} +4 -2
  50. package/lib/components/Textarea/{index.js → index.tsx} +5 -24
  51. package/lib/components/Textarea/{style.js → style.ts} +5 -4
  52. package/lib/components/TimeOutButton/index.tsx +67 -0
  53. package/lib/components/TimeOutButton/{style.js → style.ts} +4 -3
  54. package/lib/components/Toast/index.tsx +34 -0
  55. package/lib/components/Toast/style.ts +12 -0
  56. package/lib/components/UploadDocument/{index.js → index.tsx} +49 -105
  57. package/lib/components/UploadDocument/{style.js → style.ts} +16 -15
  58. package/lib/components/VirtualKeyboard/index.tsx +75 -0
  59. package/lib/components/VirtualKeyboard/{style.js → style.ts} +9 -8
  60. package/lib/components/index.ts +29 -0
  61. package/lib/configs/{constants.js → constants.ts} +50 -48
  62. package/lib/configs/types.ts +326 -0
  63. package/lib/hooks/index.ts +2 -0
  64. package/lib/hooks/{useDebounce.js → useDebounce.tsx} +6 -4
  65. package/lib/hooks/useLoadFonts.tsx +13 -0
  66. package/lib/index.js +3 -2
  67. package/package.json +72 -59
  68. package/lib/components/Button/index.js +0 -104
  69. package/lib/components/Card/index.js +0 -49
  70. package/lib/components/DeckSwiper/index.js +0 -118
  71. package/lib/components/FlashMessage/index.js +0 -81
  72. package/lib/components/FloatingContainer/index.js +0 -69
  73. package/lib/components/Footer/index.js +0 -61
  74. package/lib/components/Header/index.js +0 -45
  75. package/lib/components/ImageResponsive/index.js +0 -39
  76. package/lib/components/ImageResponsive/style.js +0 -7
  77. package/lib/components/ImageViewer/index.js +0 -62
  78. package/lib/components/MenuItem/index.js +0 -44
  79. package/lib/components/Notification/index.js +0 -80
  80. package/lib/components/PreventDoubleClick/index.js +0 -21
  81. package/lib/components/Select/index.js +0 -89
  82. package/lib/components/Select/style.js +0 -81
  83. package/lib/components/Switch/index.js +0 -57
  84. package/lib/components/TakePicture/index.js +0 -198
  85. package/lib/components/Text/index.js +0 -75
  86. package/lib/components/TimeOutButton/index.js +0 -104
  87. package/lib/components/VirtualKeyboard/index.js +0 -86
  88. package/lib/components/index.js +0 -28
  89. package/lib/configs/loadFonts.js +0 -11
  90. package/lib/hooks/index.js +0 -1
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, TouchableOpacity, Image } from 'react-native';
4
- import Ionicons from 'react-native-vector-icons/Ionicons';
5
- import { Colors } from '../../configs/constants';
6
- import style from './style';
7
-
8
- const Header = ({ inverted, logo, right, onMenuPress }) => (
9
- <View
10
- style={[style.headerContainer, style[inverted ? 'inverted' : 'default']]}
11
- >
12
- <TouchableOpacity onPress={onMenuPress}>
13
- <Ionicons
14
- name='menu-outline'
15
- size={30}
16
- color={inverted ? Colors.white : Colors.darkblue}
17
- />
18
- </TouchableOpacity>
19
- <View style={style.imageContainer}>
20
- <Image
21
- style={style.imageResponsive}
22
- source={logo}
23
- progressiveRenderingEnabled
24
- resizeMode='contain'
25
- />
26
- </View>
27
- {right}
28
- </View>
29
- );
30
-
31
- Header.defaultProps = {
32
- inverted: false,
33
- logo: null,
34
- right: null,
35
- onMenuPress: () => {},
36
- };
37
-
38
- Header.propTypes = {
39
- inverted: PropTypes.bool,
40
- logo: PropTypes.any.isRequired,
41
- right: PropTypes.node,
42
- onMenuPress: PropTypes.func,
43
- };
44
-
45
- export default Header;
@@ -1,39 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Image, View } from 'react-native';
4
- import style from './style';
5
-
6
- const ImageResponsive = ({ source, style: customStyle, avatar, ...props }) => {
7
- const [width, setWidth] = useState(100);
8
-
9
- return (
10
- <View
11
- style={[
12
- customStyle,
13
- avatar ? { borderRadius: width / 2, overflow: 'hidden' } : {},
14
- ]}
15
- >
16
- <Image
17
- style={style.responsiveImage}
18
- source={source}
19
- resizeMode={avatar ? 'cover' : 'contain'}
20
- onLayout={({ nativeEvent }) => setWidth(nativeEvent.layout.width)}
21
- {...props}
22
- />
23
- </View>
24
- );
25
- };
26
-
27
- ImageResponsive.defaultProps = {
28
- style: {},
29
- source: null,
30
- avatar: false,
31
- };
32
-
33
- ImageResponsive.propTypes = {
34
- style: PropTypes.any,
35
- source: PropTypes.any.isRequired,
36
- avatar: PropTypes.bool,
37
- };
38
-
39
- export default ImageResponsive;
@@ -1,7 +0,0 @@
1
- export default {
2
- responsiveImage: {
3
- height: undefined,
4
- width: undefined,
5
- flex: 1
6
- }
7
- };
@@ -1,62 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- View,
4
- Modal,
5
- TouchableOpacity,
6
- ActivityIndicator,
7
- Image,
8
- } from 'react-native';
9
- import Ionicons from 'react-native-vector-icons/Ionicons';
10
- import ImageResponsive from '../ImageResponsive';
11
- import { Colors } from '../../configs/constants';
12
- import style from './style';
13
- import PropTypes from 'prop-types';
14
-
15
- const ImageViewer = ({ source, style: imageStyle, ...props }) => {
16
- const [loading, setLoading] = useState(true);
17
- const [visible, setVisible] = useState(false);
18
-
19
- return (
20
- <>
21
- <TouchableOpacity onPress={() => setVisible(true)}>
22
- <ImageResponsive source={source} style={imageStyle} {...props} />
23
- </TouchableOpacity>
24
-
25
- <Modal
26
- animationType='slide'
27
- transparent={true}
28
- visible={visible}
29
- onRequestClose={() => {}}
30
- >
31
- <View style={style.container}>
32
- <TouchableOpacity
33
- onPress={() => setVisible(false)}
34
- style={style.closeIcon}
35
- >
36
- <Ionicons name='close-outline' size={24} color={Colors.darkblue} />
37
- </TouchableOpacity>
38
-
39
- <ImageResponsive
40
- source={source}
41
- style={style.body}
42
- onLoadEnd={() => setLoading(false)}
43
- />
44
-
45
- {loading && <ActivityIndicator style={style.activityIndicator} />}
46
- </View>
47
- </Modal>
48
- </>
49
- );
50
- };
51
-
52
- ImageViewer.defaultProps = {
53
- source: null,
54
- style: {},
55
- };
56
-
57
- ImageViewer.propTypes = {
58
- source: PropTypes.any.isRequired,
59
- style: PropTypes.any,
60
- };
61
-
62
- export default ImageViewer;
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TouchableOpacity, View } from 'react-native';
4
- import Feather from 'react-native-vector-icons/Feather';
5
- import Text from '../Text';
6
- import { Colors } from '../../configs/constants';
7
- import style from './style';
8
-
9
- const MenuItem = ({icon, text, disabled, onPress, last}) => (
10
- <TouchableOpacity
11
- style={[
12
- style.menuItem,
13
- last ? style.last : {},
14
- disabled ? style.disabled : {}
15
- ]}
16
- onPress={onPress}
17
- disabled={disabled}
18
- >
19
- <View style={style.left}>
20
- {icon}
21
- <Text size='large' style={style.text}>{text}</Text>
22
- </View>
23
-
24
- <Feather name='chevron-right' size={15} color={Colors.darkblue} style={style.rightIcon} />
25
- </TouchableOpacity>
26
- );
27
-
28
- MenuItem.defaultProps = {
29
- icon: null,
30
- text: '',
31
- last: false,
32
- disabled: false,
33
- onPress: () => {}
34
- };
35
-
36
- MenuItem.propTypes = {
37
- icon: PropTypes.node,
38
- text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
39
- last: PropTypes.bool,
40
- disabled: PropTypes.bool,
41
- onPress: PropTypes.func
42
- };
43
-
44
- export default MenuItem;
@@ -1,80 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TouchableOpacity, View } from 'react-native';
4
- import Text from '../Text';
5
- import ImageResponsive from '../ImageResponsive';
6
- import { Colors } from '../../configs/constants';
7
- import Ionicons from 'react-native-vector-icons/Ionicons';
8
- import moment from 'moment';
9
- import style from './style';
10
-
11
- const Notification = ({
12
- first,
13
- active,
14
- hideAvatar,
15
- avatar,
16
- title,
17
- description,
18
- date = moment().fromNow(),
19
- onPress,
20
- }) => {
21
- return (
22
- <TouchableOpacity
23
- style={[
24
- style.container,
25
- first ? style.first : {},
26
- active ? style.active : {},
27
- ]}
28
- onPress={onPress}
29
- >
30
- {!hideAvatar && (
31
- <ImageResponsive source={avatar} avatar style={style.avatar} />
32
- )}
33
- <View style={style.textContainer}>
34
- <View style={style.text}>
35
- <View style={style.textInner}>
36
- <Text weight='semiBold'>{title}</Text>
37
- {active && (
38
- <Ionicons
39
- name='ellipse'
40
- color={Colors.green}
41
- size={12}
42
- style={style.icon}
43
- />
44
- )}
45
- </View>
46
- <Text color='light' size='tiny' style={style.time}>
47
- {moment(date).fromNow()}
48
- </Text>
49
- </View>
50
- <Text color='light' size='small' ellipsizeMode='tail' numberOfLines={3}>
51
- {description}
52
- </Text>
53
- </View>
54
- </TouchableOpacity>
55
- );
56
- };
57
-
58
- Notification.defaultProps = {
59
- first: false,
60
- active: false,
61
- hideAvatar: false,
62
- avatar: null,
63
- title: '',
64
- description: '',
65
- date: moment().fromNow(),
66
- onPress: () => {},
67
- };
68
-
69
- Notification.propTypes = {
70
- first: PropTypes.bool,
71
- active: PropTypes.bool,
72
- hideAvatar: PropTypes.bool,
73
- avatar: PropTypes.any,
74
- title: PropTypes.string,
75
- description: PropTypes.string,
76
- date: PropTypes.instanceOf(moment),
77
- onPress: PropTypes.func,
78
- };
79
-
80
- export default Notification;
@@ -1,21 +0,0 @@
1
- import React, { PureComponent } from 'react';
2
- import { debounce } from 'lodash';
3
-
4
- const withPreventDoubleClick = (WrappedComponent) => {
5
- class PreventDoubleClick extends PureComponent {
6
- debouncedOnPress = () => {
7
- this.props.onPress && this.props.onPress();
8
- }
9
-
10
- onPress = debounce(this.debouncedOnPress, 300, { leading: true, trailing: false });
11
-
12
- render() {
13
- return <WrappedComponent {...this.props} onPress={this.onPress} />;
14
- }
15
- }
16
-
17
- PreventDoubleClick.displayName = `withPreventDoubleClick(${WrappedComponent.displayName ||WrappedComponent.name})`
18
- return PreventDoubleClick;
19
- }
20
-
21
- export default withPreventDoubleClick;
@@ -1,89 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { View } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import DropDownPicker from 'react-native-dropdown-picker';
5
- import style, {
6
- includesSelect,
7
- placeholderStyle,
8
- listItemLabelStyle,
9
- listItemContainerStyle,
10
- selectedItemLabelStyle,
11
- textStyle,
12
- } from './style';
13
- import { useEffect } from 'react';
14
-
15
- const Select = ({
16
- value,
17
- onValueChange,
18
- items = [],
19
- variant = 'default',
20
- disabled,
21
- fitToContainer,
22
- placeholder,
23
- }) => {
24
- const [open, setOpen] = useState(false);
25
- const [val, setVal] = useState(value);
26
-
27
- useEffect(() => {
28
- setVal(value);
29
- }, [value]);
30
-
31
- return (
32
- <View
33
- style={[
34
- style.container,
35
- disabled ? style.disabled : {},
36
- fitToContainer ? style.fit : {},
37
- ]}
38
- >
39
- <DropDownPicker
40
- style={includesSelect[variant]}
41
- open={open}
42
- value={val}
43
- items={items}
44
- setOpen={setOpen}
45
- setValue={setVal}
46
- onSelectItem={(selected) => onValueChange(selected.value)}
47
- disabled={disabled}
48
- placeholder={placeholder}
49
- placeholderStyle={placeholderStyle}
50
- listItemLabelStyle={listItemLabelStyle}
51
- listItemContainerStyle={listItemContainerStyle}
52
- selectedItemLabelStyle={selectedItemLabelStyle}
53
- listMode='MODAL'
54
- textStyle={textStyle}
55
- dropDownContainerStyle={{
56
- ...includesSelect[variant],
57
- height: 'auto',
58
- }}
59
- />
60
- </View>
61
- );
62
- };
63
-
64
- Select.defaultProps = {
65
- variant: 'default',
66
- placeholder: ' ',
67
- disabled: false,
68
- fitToContainer: false,
69
- onValueChange: () => {},
70
- value: null,
71
- items: [],
72
- };
73
-
74
- Select.propTypes = {
75
- variant: PropTypes.oneOf(['default', 'completed', 'error']),
76
- placeholder: PropTypes.string.isRequired,
77
- disabled: PropTypes.bool,
78
- fitToContainer: PropTypes.bool,
79
- onValueChange: PropTypes.func,
80
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
81
- items: PropTypes.arrayOf(
82
- PropTypes.shape({
83
- label: PropTypes.string,
84
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
85
- })
86
- ),
87
- };
88
-
89
- export default Select;
@@ -1,81 +0,0 @@
1
- import { Dimensions } from 'react-native';
2
- import { Colors, borderRadius } from '../../configs/constants';
3
-
4
- const { width } = Dimensions.get('window');
5
-
6
- export default {
7
- container: {
8
- width: width - 60,
9
- position: 'relative',
10
- },
11
- fit: {
12
- width: '100%',
13
- position: 'relative',
14
- },
15
- selectIcon: {
16
- marginTop: 20,
17
- marginRight: 15,
18
- },
19
- disabled: {
20
- opacity: 0.5,
21
- },
22
- };
23
-
24
- const fontStyle = {
25
- color: Colors.darkblue,
26
- fontFamily: 'poppins_regular',
27
- };
28
-
29
- const basicStyle = {
30
- height: 50,
31
- width: '100%',
32
- borderRadius,
33
- borderWidth: 1,
34
- paddingHorizontal: 10,
35
- backgroundColor: Colors.white,
36
- marginVertical: 6,
37
- ...fontStyle,
38
- };
39
-
40
- export const includesSelect = {
41
- default: {
42
- ...basicStyle,
43
- borderColor: Colors.midblue,
44
- },
45
- completed: {
46
- ...basicStyle,
47
- borderColor: Colors.green,
48
- },
49
- error: {
50
- ...basicStyle,
51
- borderColor: Colors.red,
52
- color: Colors.red,
53
- },
54
- };
55
-
56
- export const placeholderStyle = {
57
- fontSize: 16,
58
- ...fontStyle,
59
- color: Colors.midblue,
60
- };
61
-
62
- export const listItemLabelStyle = {
63
- ...fontStyle,
64
- fontSize: 18,
65
- paddingHorizontal: 20,
66
- };
67
-
68
- export const listItemContainerStyle = {
69
- height: 55,
70
- borderBottomWidth: 1,
71
- borderBottomColor: Colors.gray,
72
- };
73
-
74
- export const selectedItemLabelStyle = {
75
- fontFamily: 'poppins_semiBold',
76
- };
77
-
78
- export const textStyle = {
79
- ...fontStyle,
80
- fontSize: 16,
81
- };
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Switch as RNSwitch, Platform } from 'react-native';
4
- import { Colors } from '../../configs/constants';
5
-
6
- const Switch = ({ value, size = 'medium', ...props }) => (
7
- <RNSwitch
8
- trackColor={{
9
- false: Colors.lightblue,
10
- true: Colors.lightblue,
11
- }}
12
- thumbColor={value ? Colors.green : Colors.midblue}
13
- ios_backgroundColor={Colors.white}
14
- value={value}
15
- style={{
16
- transform: [
17
- {
18
- scaleX:
19
- size === 'small'
20
- ? Platform.OS === 'ios'
21
- ? 0.5
22
- : 0.7
23
- : Platform.OS === 'ios'
24
- ? 0.7
25
- : 0.9,
26
- },
27
- {
28
- scaleY:
29
- size === 'small'
30
- ? Platform.OS === 'ios'
31
- ? 0.5
32
- : 0.7
33
- : Platform.OS === 'ios'
34
- ? 0.7
35
- : 0.9,
36
- },
37
- ],
38
- }}
39
- {...props}
40
- />
41
- );
42
-
43
- Switch.defaultProps = {
44
- onValueChange: () => {},
45
- value: false,
46
- disabled: false,
47
- size: 'medium',
48
- };
49
-
50
- Switch.propTypes = {
51
- onValueChange: PropTypes.func,
52
- value: PropTypes.bool,
53
- disabled: PropTypes.bool,
54
- size: PropTypes.oneOf(['medium', 'small']),
55
- };
56
-
57
- export default Switch;