@widergy/mobile-ui 1.6.0 → 1.8.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 (37) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/lib/components/MultipleFilePicker/components/Input/README.md +77 -0
  3. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/constants.js +2 -0
  4. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/index.js +27 -0
  5. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/propTypes.js +8 -0
  6. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/styles.js +15 -0
  7. package/lib/components/MultipleFilePicker/components/Input/components/Title/index.js +78 -0
  8. package/lib/components/MultipleFilePicker/components/Input/components/Title/propTypes.js +14 -0
  9. package/lib/components/MultipleFilePicker/components/Input/components/Title/styles.js +42 -0
  10. package/lib/components/MultipleFilePicker/components/Input/components/Underline/index.js +80 -0
  11. package/lib/components/MultipleFilePicker/components/Input/components/Underline/styles.js +39 -0
  12. package/lib/components/MultipleFilePicker/components/Input/constants.js +2 -0
  13. package/lib/components/MultipleFilePicker/components/Input/index.js +299 -0
  14. package/lib/components/MultipleFilePicker/components/Input/propTypes.js +43 -0
  15. package/lib/components/MultipleFilePicker/components/Input/styles.js +47 -0
  16. package/lib/components/MultipleFilePicker/components/Picker/index.js +95 -0
  17. package/lib/components/MultipleFilePicker/components/Picker/styles.js +47 -0
  18. package/lib/components/MultipleFilePicker/components/UploadedFiles/index.js +140 -0
  19. package/lib/components/MultipleFilePicker/components/UploadedFiles/styles.js +65 -0
  20. package/lib/components/MultipleFilePicker/components/UploadedFiles/utils.js +6 -0
  21. package/lib/components/MultipleFilePicker/constants.js +18 -0
  22. package/lib/components/MultipleFilePicker/index.js +162 -0
  23. package/lib/components/MultipleFilePicker/propTypes.js +17 -0
  24. package/lib/components/MultipleFilePicker/utils.js +41 -0
  25. package/lib/components/UTTracker/README.md +24 -0
  26. package/lib/components/UTTracker/components/Connectors/index.js +26 -0
  27. package/lib/components/UTTracker/components/Connectors/styles.js +20 -0
  28. package/lib/components/UTTracker/components/Step/index.js +114 -0
  29. package/lib/components/UTTracker/components/Step/styles.js +80 -0
  30. package/lib/components/UTTracker/components/SubStep/index.js +28 -0
  31. package/lib/components/UTTracker/components/SubStep/styles.js +10 -0
  32. package/lib/components/UTTracker/constants.js +4 -0
  33. package/lib/components/UTTracker/index.js +120 -0
  34. package/lib/components/UTTracker/propTypes.js +19 -0
  35. package/lib/components/UTTracker/styles.js +57 -0
  36. package/lib/index.js +2 -0
  37. package/package.json +3 -2
@@ -0,0 +1,120 @@
1
+ import React, { Fragment, useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import merge from 'lodash/merge';
4
+ import { number, string } from 'prop-types';
5
+ import Collapsible from 'react-native-collapsible';
6
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
7
+
8
+ import Icon from '../Icon';
9
+ import Touchable from '../Touchable';
10
+ import Label from '../Label';
11
+ import { useTheme } from '../../theming';
12
+
13
+ import ownStyles, { DETAILS_ICON_CARD_SIZE, DETAILS_ICON_FLAT_SIZE, ownModeStyles } from './styles';
14
+ import Step from './components/Step';
15
+ import Connectors from './components/Connectors';
16
+ import SubStep from './components/SubStep';
17
+ import { DetailsTabPropTypes, ModePropTypes, StepsPropTypes, VariantPropTypes } from './propTypes';
18
+ import { CARD, FLAT, STANDARD } from './constants';
19
+
20
+ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title, variant = STANDARD }) => {
21
+ const theme = useTheme();
22
+ const themedStyles = merge({}, ownStyles, ownModeStyles[mode], theme.UTTracker, style);
23
+
24
+ const [stepperHeight, setStepperHeight] = useState(0);
25
+ const [lastStepPosition, setLastStepPosition] = useState(0);
26
+ const [firstStepPosition, setFirstStepPosition] = useState(0);
27
+
28
+ const [isCollapsed, setIsCollapsed] = useState(true);
29
+
30
+ const isCompleted = stepNumber => stepNumber < currentStep;
31
+ const isActive = stepNumber => stepNumber === currentStep;
32
+
33
+ return (
34
+ <View style={themedStyles.outerContainer}>
35
+ <View style={[themedStyles.container, !detailsTab && ownStyles.roundedBorders]}>
36
+ {title && (
37
+ <Touchable
38
+ disabled={mode !== FLAT}
39
+ onPress={() => setIsCollapsed(!isCollapsed)}
40
+ style={themedStyles.titleTouchable}
41
+ >
42
+ <View style={themedStyles.titleContainer}>
43
+ <Label color={themedStyles.titleColor} style={themedStyles.title}>
44
+ {title}
45
+ </Label>
46
+ {detailsTab?.enabled && mode === FLAT && (
47
+ <Icon
48
+ color={themedStyles.detailsIconColor || 'black'}
49
+ height={DETAILS_ICON_FLAT_SIZE}
50
+ name={isCollapsed ? 'chevron-down' : 'chevron-up'}
51
+ size={DETAILS_ICON_FLAT_SIZE}
52
+ type="feather"
53
+ width={DETAILS_ICON_FLAT_SIZE}
54
+ />
55
+ )}
56
+ </View>
57
+ </Touchable>
58
+ )}
59
+ {steps && (
60
+ <View onLayout={e => setStepperHeight(e.nativeEvent.layout.height)}>
61
+ <Connectors
62
+ style={themedStyles.connectors}
63
+ {...{ firstStepPosition, lastStepPosition, stepperHeight }}
64
+ />
65
+ {steps.map((step, index) => (
66
+ <Fragment key={step.id}>
67
+ <Step
68
+ first={index === 0}
69
+ last={index === steps.length - 1}
70
+ style={themedStyles.step}
71
+ {...{
72
+ isActive,
73
+ isCompleted,
74
+ setFirstStepPosition,
75
+ setLastStepPosition,
76
+ step,
77
+ variant
78
+ }}
79
+ />
80
+ <Collapsible collapsed={isCollapsed}>
81
+ {step.subSteps &&
82
+ step.subSteps.map(subStep => (
83
+ <SubStep key={subStep.id} {...subStep} style={themedStyles.subStep} />
84
+ ))}
85
+ </Collapsible>
86
+ </Fragment>
87
+ ))}
88
+ </View>
89
+ )}
90
+ </View>
91
+ {detailsTab?.enabled && mode === CARD && (
92
+ <Touchable onPress={() => setIsCollapsed(!isCollapsed)} style={themedStyles.detailsTab}>
93
+ <Fragment>
94
+ <Label>{detailsTab.title}</Label>
95
+ <Icon
96
+ color={themedStyles.detailsIconColor || 'black'}
97
+ height={DETAILS_ICON_CARD_SIZE}
98
+ name={isCollapsed ? 'chevron-down' : 'chevron-up'}
99
+ size={DETAILS_ICON_CARD_SIZE}
100
+ type="feather"
101
+ width={DETAILS_ICON_CARD_SIZE}
102
+ />
103
+ </Fragment>
104
+ </Touchable>
105
+ )}
106
+ </View>
107
+ );
108
+ };
109
+
110
+ UTTracker.propTypes = {
111
+ currentStep: number,
112
+ detailsTab: DetailsTabPropTypes,
113
+ mode: ModePropTypes,
114
+ steps: StepsPropTypes,
115
+ style: ViewPropTypes.style,
116
+ title: string,
117
+ variant: VariantPropTypes
118
+ };
119
+
120
+ export default UTTracker;
@@ -0,0 +1,19 @@
1
+ import { arrayOf, bool, number, oneOf, shape, string } from 'prop-types';
2
+
3
+ import { CARD, ERROR, FLAT, STANDARD } from './constants';
4
+
5
+ export const SubStepsPropTypes = arrayOf(shape({ id: number, subtitle: string, title: string }));
6
+
7
+ export const StepPropTypes = shape({
8
+ id: number,
9
+ subSteps: arrayOf(SubStepsPropTypes),
10
+ subtitle: string,
11
+ title: string
12
+ });
13
+
14
+ export const StepsPropTypes = arrayOf(StepPropTypes);
15
+
16
+ export const DetailsTabPropTypes = shape({ enabled: bool, title: string });
17
+
18
+ export const ModePropTypes = oneOf([CARD, FLAT]);
19
+ export const VariantPropTypes = oneOf([STANDARD, ERROR]);
@@ -0,0 +1,57 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ import { CARD, FLAT } from './constants';
4
+
5
+ export const OVAL_SIZE = 20;
6
+ export const DETAILS_ICON_CARD_SIZE = 20;
7
+ export const DETAILS_ICON_FLAT_SIZE = 24;
8
+
9
+ export const ownModeStyles = {
10
+ [CARD]: {
11
+ container: {
12
+ backgroundColor: 'white',
13
+ elevation: 2,
14
+ shadowColor: 'black',
15
+ shadowOffset: {
16
+ height: 3,
17
+ width: 0
18
+ },
19
+ shadowOpacity: 0.1
20
+ }
21
+ },
22
+ [FLAT]: {
23
+ container: {
24
+ backgroundColor: 'transparent'
25
+ }
26
+ }
27
+ };
28
+
29
+ export default StyleSheet.create({
30
+ container: {
31
+ borderTopLeftRadius: 8,
32
+ borderTopRightRadius: 8,
33
+ padding: 16
34
+ },
35
+ detailsTab: {
36
+ backgroundColor: 'white',
37
+ borderBottomLeftRadius: 8,
38
+ borderBottomRightRadius: 8,
39
+ borderColor: 'lightgray',
40
+ borderTopWidth: 1,
41
+ flexDirection: 'row',
42
+ justifyContent: 'space-between',
43
+ paddingHorizontal: 16,
44
+ paddingVertical: 12
45
+ },
46
+ roundedBorders: {
47
+ borderBottomLeftRadius: 8,
48
+ borderBottomRightRadius: 8
49
+ },
50
+ titleContainer: {
51
+ flexDirection: 'row',
52
+ justifyContent: 'space-between'
53
+ },
54
+ titleTouchable: {
55
+ marginBottom: 24
56
+ }
57
+ });
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ export { default as RadioGroup } from './components/RadioGroup';
16
16
  export { default as Input } from './components/Input';
17
17
  export { default as ImagePicker } from './components/ImagePicker';
18
18
  export { default as FilePicker } from './components/FilePicker';
19
+ export { default as MultipleFilePicker } from './components/MultipleFilePicker';
19
20
  export { default as Picker } from './components/Picker';
20
21
  export { default as ImageLabel } from './components/ImageLabel';
21
22
  export { default as CheckList } from './components/CheckList';
@@ -50,6 +51,7 @@ export { default as UTTextInput } from './components/UTTextInput';
50
51
  export { default as UTSelect } from './components/UTSelect';
51
52
  export { default as UTStepFeedback } from './components/UTStepFeedback';
52
53
  export { default as UTAutocomplete } from './components/UTAutocomplete';
54
+ export { default as UTTracker } from './components/UTTracker';
53
55
  export { default as ImageRadio } from './components/ImageRadio';
54
56
  // Loading
55
57
  export { default as Loading } from './components/Loading';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.6.0",
5
+ "version": "1.8.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [
@@ -43,7 +43,8 @@
43
43
  "pdf-lib": "^1.17.1",
44
44
  "react-native-markdown-display": "^7.0.0-alpha.2",
45
45
  "react-native-modal": "^13.0.1",
46
- "react-native-pager-view": "^6.2.1"
46
+ "react-native-pager-view": "^6.2.1",
47
+ "react-native-collapsible": "^1.6.1"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@babel/cli": "^7.22.10",