etendo-ui-library 1.0.44 → 1.0.46

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 (32) hide show
  1. package/assets/images/icons/calendar-secundary.png +0 -0
  2. package/components/statusbar/StatusBar.stories.tsx +76 -0
  3. package/components/statusbar/StatusBar.styles.tsx +114 -0
  4. package/components/statusbar/StatusBar.test.tsx +70 -0
  5. package/components/statusbar/StatusBar.tsx +23 -0
  6. package/components/statusbar/StatusBar.types.ts +45 -0
  7. package/components/statusbar/StepActive.tsx +32 -0
  8. package/components/statusbar/StepDisabled.tsx +14 -0
  9. package/components/statusbar/__snapshots__/StatusBar.test.tsx.snap +255 -0
  10. package/components/statusbar/index.ts +3 -0
  11. package/package.json +1 -1
  12. package/storybook-static/{0.1350e4a7.iframe.bundle.js → 0.5346b8ca.iframe.bundle.js} +1 -1
  13. package/storybook-static/{4.7a917f47.iframe.bundle.js → 4.8326e70a.iframe.bundle.js} +3 -3
  14. package/storybook-static/{4.7a917f47.iframe.bundle.js.LICENSE.txt → 4.8326e70a.iframe.bundle.js.LICENSE.txt} +0 -0
  15. package/storybook-static/4.8326e70a.iframe.bundle.js.map +1 -0
  16. package/storybook-static/{5.abca0041.iframe.bundle.js → 5.202de263.iframe.bundle.js} +1 -1
  17. package/storybook-static/{6.b577c2c6.iframe.bundle.js → 6.5eef00f7.iframe.bundle.js} +3 -3
  18. package/storybook-static/{6.b577c2c6.iframe.bundle.js.LICENSE.txt → 6.5eef00f7.iframe.bundle.js.LICENSE.txt} +0 -0
  19. package/storybook-static/6.5eef00f7.iframe.bundle.js.map +1 -0
  20. package/storybook-static/{7.8de0c89c.iframe.bundle.js → 7.8b7e56c0.iframe.bundle.js} +1 -1
  21. package/storybook-static/iframe.html +1 -1
  22. package/storybook-static/main.a4eb9d7d.iframe.bundle.js +1 -0
  23. package/storybook-static/{runtime~main.942fa453.iframe.bundle.js → runtime~main.e0cb5c77.iframe.bundle.js} +1 -1
  24. package/storybook-static/static/media/calendar-secundary.7ca7a406.png +0 -0
  25. package/storybook-static/vendors~main.bca36876.iframe.bundle.js +3 -0
  26. package/storybook-static/{vendors~main.ffe8a230.iframe.bundle.js.LICENSE.txt → vendors~main.bca36876.iframe.bundle.js.LICENSE.txt} +0 -0
  27. package/storybook-static/vendors~main.bca36876.iframe.bundle.js.map +1 -0
  28. package/storybook-static/4.7a917f47.iframe.bundle.js.map +0 -1
  29. package/storybook-static/6.b577c2c6.iframe.bundle.js.map +0 -1
  30. package/storybook-static/main.6ec576c3.iframe.bundle.js +0 -1
  31. package/storybook-static/vendors~main.ffe8a230.iframe.bundle.js +0 -3
  32. package/storybook-static/vendors~main.ffe8a230.iframe.bundle.js.map +0 -1
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import {Story, Meta} from '@storybook/react';
3
+
4
+ import {StatusBar} from './StatusBar';
5
+ import {Info, StatusBarProps} from './StatusBar.types';
6
+ import {Image, Text, View} from 'react-native';
7
+ import {StatusBarStyleVariant} from './StatusBar.styles';
8
+
9
+ export default {
10
+ title: 'Etendo/StatusBar',
11
+ component: StatusBar,
12
+ argTypes: {},
13
+ } as Meta<typeof StatusBar>;
14
+
15
+ // Active component declaration
16
+ const Component = () => {
17
+ return (
18
+ <>
19
+ <Image
20
+ source={require('../../assets/images/icons/calendar-secundary.png')}
21
+ style={StatusBarStyleVariant.primary.activeComponentImage}
22
+ />
23
+ <View style={StatusBarStyleVariant.primary.activeStepContentRightSection}>
24
+ <Text style={StatusBarStyleVariant.primary.textTopActiveStepContent}>
25
+ Current Plan date
26
+ </Text>
27
+ <Text style={StatusBarStyleVariant.primary.textBottomActiveStepContent}>
28
+ 03 January, 2022
29
+ </Text>
30
+ </View>
31
+ </>
32
+ );
33
+ };
34
+
35
+ // Information dataset
36
+ const dataset: Info[] = [
37
+ {
38
+ step: '1. Vehicles',
39
+ routeNav: '/vehicles',
40
+ key: 'vehicles',
41
+ componentActive: <Component />,
42
+ },
43
+ {
44
+ step: '2. Visits',
45
+ routeNav: '/visits',
46
+ key: 'visits',
47
+ componentActive: <Component />,
48
+ },
49
+ {
50
+ step: '3. Routes',
51
+ routeNav: '/routes',
52
+ key: 'routes',
53
+ componentActive: <Component />,
54
+ },
55
+ {
56
+ step: '4. Capacity',
57
+ routeNav: '/capacity',
58
+ key: 'capacity',
59
+ componentActive: <Component />,
60
+ },
61
+ {
62
+ step: '5. Settings',
63
+ routeNav: '/settings',
64
+ key: 'settings',
65
+ componentActive: <Component />,
66
+ },
67
+ ];
68
+
69
+ /* Templates */
70
+ const Template: Story<StatusBarProps> = args => (
71
+ <StatusBar data={dataset} step={args.step} />
72
+ );
73
+
74
+ /* Story exports */
75
+ export const StatusBarStep1 = Template.bind({});
76
+ StatusBarStep1.args = {};
@@ -0,0 +1,114 @@
1
+ /* Imports */
2
+ import {BLUE, YELLOW, WHITE} from '../../styles/colors';
3
+ import {StatusBarStyleRecord} from './StatusBar.types';
4
+
5
+ /* Export of different styles */
6
+ export const StatusBarStyleVariant: StatusBarStyleRecord = {
7
+ /* Primary style */
8
+ primary: {
9
+ // General container of the status bar
10
+ statusBarContainer: {
11
+ flex: 1,
12
+ width: '100%',
13
+ height: 45,
14
+ backgroundColor: BLUE,
15
+ flexDirection: 'row',
16
+ justifyContent: 'flex-end',
17
+ position: 'relative',
18
+ },
19
+
20
+ rectangleTopLeftYellow: {
21
+ width: 25,
22
+ height: '50%',
23
+ backgroundColor: YELLOW,
24
+ },
25
+
26
+ rectangleTopLeftBlue: {
27
+ width: 25,
28
+ height: '100%',
29
+ backgroundColor: BLUE,
30
+ borderTopEndRadius: 40,
31
+ },
32
+
33
+ activeStepContainer: {
34
+ flex: 0.4,
35
+ flexDirection: 'row',
36
+ backgroundColor: YELLOW,
37
+ borderBottomStartRadius: 31,
38
+ borderTopEndRadius: 31,
39
+ },
40
+
41
+ activeStepContent: {
42
+ marginLeft: '10%',
43
+ alignSelf: 'center',
44
+ flexDirection: 'row',
45
+ },
46
+
47
+ activeStepContentRightSection: {
48
+ marginLeft: '12%',
49
+ },
50
+
51
+ disabledStep: {
52
+ color: WHITE,
53
+ fontWeight: '600',
54
+ fontSize: 17,
55
+ alignSelf: 'center',
56
+ flex: 1,
57
+ justifyContent: 'center',
58
+ textAlign: 'center',
59
+ },
60
+
61
+ disabledStepContainer: {
62
+ flex: 0.15,
63
+ flexDirection: 'row',
64
+ backgroundColor: BLUE,
65
+ borderBottomStartRadius: 20,
66
+ borderTopEndRadius: 20,
67
+ },
68
+
69
+ activeStep: {
70
+ color: BLUE,
71
+ fontWeight: '600',
72
+ fontSize: 17,
73
+ alignSelf: 'center',
74
+ flex: 1,
75
+ textAlign: 'right',
76
+ marginRight: '10%',
77
+ },
78
+
79
+ rectangleBottomRightBlue: {
80
+ width: 25,
81
+ alignSelf: 'flex-end',
82
+ height: '100%',
83
+ backgroundColor: YELLOW,
84
+ transform: [{rotate: '180deg'}],
85
+ },
86
+
87
+ rectangleBottomRightYellow: {
88
+ width: 25,
89
+ height: '100%',
90
+ backgroundColor: BLUE,
91
+ borderTopEndRadius: 20,
92
+ borderColor: BLUE,
93
+ },
94
+
95
+ textTopActiveStepContent: {
96
+ fontSize: 14,
97
+ color: BLUE,
98
+ fontWeight: '600',
99
+ },
100
+
101
+ textBottomActiveStepContent: {
102
+ fontSize: 11,
103
+ color: BLUE,
104
+ fontWeight: '500',
105
+ marginTop: '2%',
106
+ },
107
+
108
+ activeComponentImage: {
109
+ alignSelf: 'center',
110
+ width: 27,
111
+ height: 27,
112
+ },
113
+ },
114
+ };
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import {Image, Text, View} from 'react-native';
3
+ import renderer from 'react-test-renderer';
4
+
5
+ import {StatusBar} from './StatusBar';
6
+ import {StatusBarStyleVariant} from './StatusBar.styles';
7
+ import {Info} from './StatusBar.types';
8
+
9
+ // Active component declaration
10
+ const Component = () => {
11
+ return (
12
+ <>
13
+ <Image
14
+ source={require('../../assets/images/icons/calendar-secundary.png')}
15
+ style={StatusBarStyleVariant.primary.activeComponentImage}
16
+ />
17
+ <View style={StatusBarStyleVariant.primary.activeStepContentRightSection}>
18
+ <Text style={StatusBarStyleVariant.primary.textTopActiveStepContent}>
19
+ Current Plan date
20
+ </Text>
21
+ <Text style={StatusBarStyleVariant.primary.textBottomActiveStepContent}>
22
+ 03 January, 2022
23
+ </Text>
24
+ </View>
25
+ </>
26
+ );
27
+ };
28
+
29
+ // Information dataset
30
+ const dataset: Info[] = [
31
+ {
32
+ step: '1. Vehicles',
33
+ routeNav: '/vehicles',
34
+ key: 'vehicles',
35
+ componentActive: <Component />,
36
+ },
37
+ {
38
+ step: '2. Visits',
39
+ routeNav: '/visits',
40
+ key: 'visits',
41
+ componentActive: <Component />,
42
+ },
43
+ {
44
+ step: '3. Routes',
45
+ routeNav: '/routes',
46
+ key: 'routes',
47
+ componentActive: <Component />,
48
+ },
49
+ {
50
+ step: '4. Capacity',
51
+ routeNav: '/capacity',
52
+ key: 'capacity',
53
+ componentActive: <Component />,
54
+ },
55
+ {
56
+ step: '5. Settings',
57
+ routeNav: '/settings',
58
+ key: 'settings',
59
+ componentActive: <Component />,
60
+ },
61
+ ];
62
+
63
+ describe('Running Test for StatusBar', () => {
64
+ it('Check StatusBar', () => {
65
+ const tree = renderer
66
+ .create(<StatusBar data={dataset} step={1} />)
67
+ .toJSON();
68
+ expect(tree).toMatchSnapshot();
69
+ });
70
+ });
@@ -0,0 +1,23 @@
1
+ /* Imports */
2
+ import React from 'react';
3
+
4
+ import {View} from 'react-native';
5
+ import {StatusBarStyleVariant} from './StatusBar.styles';
6
+
7
+ import {StatusBarProps} from './StatusBar.types';
8
+ import {StepActive} from './StepActive';
9
+ import {StepDisabled} from './StepDisabled';
10
+
11
+ export const StatusBar = ({data, step}: StatusBarProps) => {
12
+ return (
13
+ <View style={StatusBarStyleVariant.primary.statusBarContainer}>
14
+ {data.map((item, idx) => {
15
+ if (idx === step - 1) {
16
+ return <StepActive item={item} />;
17
+ } else {
18
+ return <StepDisabled item={item} />;
19
+ }
20
+ })}
21
+ </View>
22
+ );
23
+ };
@@ -0,0 +1,45 @@
1
+ /* Imports */
2
+ import {ImageStyle, TextStyle, ViewStyle} from 'react-native';
3
+
4
+ /* Type declaration */
5
+ export type Info = {
6
+ step: string;
7
+ routeNav: string;
8
+ key: string;
9
+ componentActive: any;
10
+ };
11
+
12
+ export interface StatusBarProps {
13
+ data: Info[];
14
+ step: number;
15
+ }
16
+
17
+ export type ItemProp = {
18
+ item: Info;
19
+ };
20
+
21
+ /* Declaration of style types */
22
+ export type StatusBarStyleType = 'primary';
23
+
24
+ export type StatusBarStyleRecord = Record<
25
+ StatusBarStyleType,
26
+ {
27
+ // General container of the status bar
28
+ statusBarContainer: ViewStyle;
29
+
30
+ activeStep: TextStyle;
31
+ activeStepContainer: ViewStyle;
32
+ rectangleTopLeftBlue: ViewStyle;
33
+ rectangleTopLeftYellow: ViewStyle;
34
+ rectangleBottomRightBlue: ViewStyle;
35
+ rectangleBottomRightYellow: ViewStyle;
36
+ disabledStep: TextStyle;
37
+ disabledStepContainer: ViewStyle;
38
+ activeStepContent: ViewStyle;
39
+ activeStepContentRightSection: ViewStyle;
40
+
41
+ activeComponentImage: ImageStyle;
42
+ textTopActiveStepContent: TextStyle;
43
+ textBottomActiveStepContent: TextStyle;
44
+ }
45
+ >;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import {Text, View} from 'react-native';
3
+ import {ItemProp} from './StatusBar.types';
4
+ import {StatusBarStyleVariant} from './StatusBar.styles';
5
+
6
+ export const StepActive = ({item}: ItemProp) => {
7
+ return (
8
+ <>
9
+ <View
10
+ style={StatusBarStyleVariant.primary.rectangleTopLeftYellow}
11
+ key={item.key}
12
+ >
13
+ <View style={StatusBarStyleVariant.primary.rectangleTopLeftBlue} />
14
+ </View>
15
+
16
+ <View style={StatusBarStyleVariant.primary.activeStepContainer}>
17
+ <View style={StatusBarStyleVariant.primary.activeStepContent}>
18
+ {item.componentActive}
19
+ </View>
20
+ <Text style={StatusBarStyleVariant.primary.activeStep}>
21
+ {item.step}
22
+ </Text>
23
+ </View>
24
+
25
+ <View style={StatusBarStyleVariant.primary.rectangleBottomRightBlue}>
26
+ <View
27
+ style={StatusBarStyleVariant.primary.rectangleBottomRightYellow}
28
+ />
29
+ </View>
30
+ </>
31
+ );
32
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import {Text, View} from 'react-native';
3
+ import {StatusBarStyleVariant} from './StatusBar.styles';
4
+ import {ItemProp} from './StatusBar.types';
5
+
6
+ export const StepDisabled = ({item}: ItemProp) => {
7
+ return (
8
+ <View style={StatusBarStyleVariant.primary.disabledStepContainer}>
9
+ <Text style={StatusBarStyleVariant.primary.disabledStep}>
10
+ {item.step}
11
+ </Text>
12
+ </View>
13
+ );
14
+ };
@@ -0,0 +1,255 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Running Test for StatusBar Check StatusBar 1`] = `
4
+ <View
5
+ style={
6
+ Object {
7
+ "backgroundColor": "#202452",
8
+ "flex": 1,
9
+ "flexDirection": "row",
10
+ "height": 45,
11
+ "justifyContent": "flex-end",
12
+ "position": "relative",
13
+ "width": "100%",
14
+ }
15
+ }
16
+ >
17
+ <View
18
+ style={
19
+ Object {
20
+ "backgroundColor": "#FAD614",
21
+ "height": "50%",
22
+ "width": 25,
23
+ }
24
+ }
25
+ >
26
+ <View
27
+ style={
28
+ Object {
29
+ "backgroundColor": "#202452",
30
+ "borderTopEndRadius": 40,
31
+ "height": "100%",
32
+ "width": 25,
33
+ }
34
+ }
35
+ />
36
+ </View>
37
+ <View
38
+ style={
39
+ Object {
40
+ "backgroundColor": "#FAD614",
41
+ "borderBottomStartRadius": 31,
42
+ "borderTopEndRadius": 31,
43
+ "flex": 0.4,
44
+ "flexDirection": "row",
45
+ }
46
+ }
47
+ >
48
+ <View
49
+ style={
50
+ Object {
51
+ "alignSelf": "center",
52
+ "flexDirection": "row",
53
+ "marginLeft": "10%",
54
+ }
55
+ }
56
+ >
57
+ <Image
58
+ source={
59
+ Object {
60
+ "testUri": "../../../assets/images/icons/calendar-secundary.png",
61
+ }
62
+ }
63
+ style={
64
+ Object {
65
+ "alignSelf": "center",
66
+ "height": 27,
67
+ "width": 27,
68
+ }
69
+ }
70
+ />
71
+ <View
72
+ style={
73
+ Object {
74
+ "marginLeft": "12%",
75
+ }
76
+ }
77
+ >
78
+ <Text
79
+ style={
80
+ Object {
81
+ "color": "#202452",
82
+ "fontSize": 14,
83
+ "fontWeight": "600",
84
+ }
85
+ }
86
+ >
87
+ Current Plan date
88
+ </Text>
89
+ <Text
90
+ style={
91
+ Object {
92
+ "color": "#202452",
93
+ "fontSize": 11,
94
+ "fontWeight": "500",
95
+ "marginTop": "2%",
96
+ }
97
+ }
98
+ >
99
+ 03 January, 2022
100
+ </Text>
101
+ </View>
102
+ </View>
103
+ <Text
104
+ style={
105
+ Object {
106
+ "alignSelf": "center",
107
+ "color": "#202452",
108
+ "flex": 1,
109
+ "fontSize": 17,
110
+ "fontWeight": "600",
111
+ "marginRight": "10%",
112
+ "textAlign": "right",
113
+ }
114
+ }
115
+ >
116
+ 1. Vehicles
117
+ </Text>
118
+ </View>
119
+ <View
120
+ style={
121
+ Object {
122
+ "alignSelf": "flex-end",
123
+ "backgroundColor": "#FAD614",
124
+ "height": "100%",
125
+ "transform": Array [
126
+ Object {
127
+ "rotate": "180deg",
128
+ },
129
+ ],
130
+ "width": 25,
131
+ }
132
+ }
133
+ >
134
+ <View
135
+ style={
136
+ Object {
137
+ "backgroundColor": "#202452",
138
+ "borderColor": "#202452",
139
+ "borderTopEndRadius": 20,
140
+ "height": "100%",
141
+ "width": 25,
142
+ }
143
+ }
144
+ />
145
+ </View>
146
+ <View
147
+ style={
148
+ Object {
149
+ "backgroundColor": "#202452",
150
+ "borderBottomStartRadius": 20,
151
+ "borderTopEndRadius": 20,
152
+ "flex": 0.15,
153
+ "flexDirection": "row",
154
+ }
155
+ }
156
+ >
157
+ <Text
158
+ style={
159
+ Object {
160
+ "alignSelf": "center",
161
+ "color": "#FFFFFF",
162
+ "flex": 1,
163
+ "fontSize": 17,
164
+ "fontWeight": "600",
165
+ "justifyContent": "center",
166
+ "textAlign": "center",
167
+ }
168
+ }
169
+ >
170
+ 2. Visits
171
+ </Text>
172
+ </View>
173
+ <View
174
+ style={
175
+ Object {
176
+ "backgroundColor": "#202452",
177
+ "borderBottomStartRadius": 20,
178
+ "borderTopEndRadius": 20,
179
+ "flex": 0.15,
180
+ "flexDirection": "row",
181
+ }
182
+ }
183
+ >
184
+ <Text
185
+ style={
186
+ Object {
187
+ "alignSelf": "center",
188
+ "color": "#FFFFFF",
189
+ "flex": 1,
190
+ "fontSize": 17,
191
+ "fontWeight": "600",
192
+ "justifyContent": "center",
193
+ "textAlign": "center",
194
+ }
195
+ }
196
+ >
197
+ 3. Routes
198
+ </Text>
199
+ </View>
200
+ <View
201
+ style={
202
+ Object {
203
+ "backgroundColor": "#202452",
204
+ "borderBottomStartRadius": 20,
205
+ "borderTopEndRadius": 20,
206
+ "flex": 0.15,
207
+ "flexDirection": "row",
208
+ }
209
+ }
210
+ >
211
+ <Text
212
+ style={
213
+ Object {
214
+ "alignSelf": "center",
215
+ "color": "#FFFFFF",
216
+ "flex": 1,
217
+ "fontSize": 17,
218
+ "fontWeight": "600",
219
+ "justifyContent": "center",
220
+ "textAlign": "center",
221
+ }
222
+ }
223
+ >
224
+ 4. Capacity
225
+ </Text>
226
+ </View>
227
+ <View
228
+ style={
229
+ Object {
230
+ "backgroundColor": "#202452",
231
+ "borderBottomStartRadius": 20,
232
+ "borderTopEndRadius": 20,
233
+ "flex": 0.15,
234
+ "flexDirection": "row",
235
+ }
236
+ }
237
+ >
238
+ <Text
239
+ style={
240
+ Object {
241
+ "alignSelf": "center",
242
+ "color": "#FFFFFF",
243
+ "flex": 1,
244
+ "fontSize": 17,
245
+ "fontWeight": "600",
246
+ "justifyContent": "center",
247
+ "textAlign": "center",
248
+ }
249
+ }
250
+ >
251
+ 5. Settings
252
+ </Text>
253
+ </View>
254
+ </View>
255
+ `;
@@ -0,0 +1,3 @@
1
+ import {StatusBar} from './StatusBar';
2
+
3
+ export {StatusBar};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etendo-ui-library",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "android": "react-native run-android",