@widergy/mobile-ui 1.31.0 → 1.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.31.2](https://github.com/widergy/mobile-ui/compare/v1.31.1...v1.31.2) (2024-11-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [EVE-4331] UTStatusMessage ([#383](https://github.com/widergy/mobile-ui/issues/383)) ([8e35027](https://github.com/widergy/mobile-ui/commit/8e350272bb402c2a80ed649a66d6654c52dc35d8))
7
+
8
+ ## [1.31.1](https://github.com/widergy/mobile-ui/compare/v1.31.0...v1.31.1) (2024-11-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * utmenu fixes ([#374](https://github.com/widergy/mobile-ui/issues/374)) ([44258cb](https://github.com/widergy/mobile-ui/commit/44258cb1bb0ac7c837741f43ec4cbbc280e2d2a8))
14
+
1
15
  # [1.31.0](https://github.com/widergy/mobile-ui/compare/v1.30.2...v1.31.0) (2024-11-04)
2
16
 
3
17
 
@@ -154,50 +154,50 @@ const UTMenu = ({
154
154
  <View style={styles.overlay} />
155
155
  </TouchableOpacity>
156
156
  <Surface
157
- onLayout={handleMenuLayout}
158
- ref={menuRef}
159
157
  style={[styles.menu, position, fullWidth && { width: anchorMeasure?.width }, propStyles?.menu]}
160
158
  >
161
- <KeyboardAvoidingView behavior="height">
162
- {withAutocomplete && (
163
- <View style={[styles.searchContainer, propStyles?.searchContainer]}>
164
- <UTTextInput
165
- inputRef={searchTextInputRef}
166
- onChange={handleQueryChange}
167
- onSubmitEditing={
168
- query && filteredOptions[0]
169
- ? () => handleOptionPress(() => onPress(filteredOptions[0]))
170
- : closeMenu
171
- }
172
- placeholder={autoCompletePlaceholder}
173
- value={query}
174
- />
175
- </View>
176
- )}
177
- <ListView
178
- filteredOptions={filteredOptions}
179
- handleOptionPress={handleOptionPress}
180
- isMultiple={isMultiple}
181
- ItemSeparatorComponent={ItemSeparatorComponent}
182
- ListEmptyComponent={ListEmptyComponent}
183
- maxHeight={maxHeight}
184
- MenuOptionComponent={MenuOptionComponent}
185
- onPress={onPress}
186
- propStyles={propStyles}
187
- query={query}
188
- selectedOption={selectedOption}
189
- usableWindowHeight={usableWindowHeight}
190
- windowHeight={windowHeight}
191
- />
192
- {withGoogleAttribution && (
193
- <View style={styles.attribution}>
194
- <UTLabel colorTheme="gray" variant="small">
195
- {ATTRIBUTION}
196
- </UTLabel>
197
- <Image source={GoogleLogo} />
198
- </View>
199
- )}
200
- </KeyboardAvoidingView>
159
+ <View onLayout={handleMenuLayout} ref={menuRef}>
160
+ <KeyboardAvoidingView behavior="height">
161
+ {withAutocomplete && (
162
+ <View style={[styles.searchContainer, propStyles?.searchContainer]}>
163
+ <UTTextInput
164
+ inputRef={searchTextInputRef}
165
+ onChange={handleQueryChange}
166
+ onSubmitEditing={
167
+ query && filteredOptions[0]
168
+ ? () => handleOptionPress(() => onPress(filteredOptions[0]))
169
+ : closeMenu
170
+ }
171
+ placeholder={autoCompletePlaceholder}
172
+ value={query}
173
+ />
174
+ </View>
175
+ )}
176
+ <ListView
177
+ filteredOptions={filteredOptions}
178
+ handleOptionPress={handleOptionPress}
179
+ isMultiple={isMultiple}
180
+ ItemSeparatorComponent={ItemSeparatorComponent}
181
+ ListEmptyComponent={ListEmptyComponent}
182
+ maxHeight={maxHeight}
183
+ MenuOptionComponent={MenuOptionComponent}
184
+ onPress={onPress}
185
+ propStyles={propStyles}
186
+ query={query}
187
+ selectedOption={selectedOption}
188
+ usableWindowHeight={usableWindowHeight}
189
+ windowHeight={windowHeight}
190
+ />
191
+ {withGoogleAttribution && (
192
+ <View style={styles.attribution}>
193
+ <UTLabel colorTheme="gray" variant="small">
194
+ {ATTRIBUTION}
195
+ </UTLabel>
196
+ <Image source={GoogleLogo} />
197
+ </View>
198
+ )}
199
+ </KeyboardAvoidingView>
200
+ </View>
201
201
  </Surface>
202
202
  </Modal>
203
203
  </Fragment>
@@ -11,7 +11,6 @@ export default StyleSheet.create({
11
11
  backgroundColor: 'white',
12
12
  borderRadius: 8,
13
13
  left: 0,
14
- paddingVertical: 4,
15
14
  position: 'absolute',
16
15
  zIndex: 1000
17
16
  },
@@ -0,0 +1,46 @@
1
+ # UTStatusMessage
2
+
3
+ The purpose of this component, as its name indicates, is to communicate a message about the status of the view or component in which it is contextually situated.
4
+
5
+ ## Props
6
+
7
+ | Name | Type | Default | Description |
8
+ | --------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
9
+ | children | element | | The content to be rendered inside the component. |
10
+ | style | object | | Custom styles for styling the component. |
11
+ | colorTheme | string | default | Defines the color theme for the component. |
12
+ | description | string | | Description text providing additional context or information. |
13
+ | descriptionProps | object | | Props to be applied to the description UTLabel. |
14
+ | helpText | string | | Help text displayed to guide the user. |
15
+ | helpTextProps | object | | Props to be applied to the help text UTLabel. |
16
+ | icon | string | | Icon to be displayed in the header. |
17
+ | iconProps | object | | Props to be applied to the UTIcon |
18
+ | image | string | | URL of an image to be displayed in the header, replacing the icon. |
19
+ | loading | bool | false | Indicates whether the component is in a loading state. Replaces the header. |
20
+ | primaryAction | func | | Callback function for the primary action. |
21
+ | primaryActionProps | object | | Props to be applied to the primary action UTButton. |
22
+ | primaryActionText | string | | Text for the primary action UTButton. |
23
+ | secondaryAction | func | | Callback function for the secondary action. |
24
+ | secondaryActionProps | object | | Props to be applied to the secondary action UTButton. |
25
+ | secondaryActionText | string | | Text for the secondary action UTButton. |
26
+ | showHeader | bool | true | Indicates whether to display the header section of the component. |
27
+ | title | string | | Title for the component, providing context to the user. |
28
+ | titleProps | object | | Props to be applied to the title UTLabel. |
29
+
30
+ ### colorTheme
31
+
32
+ The value of `colorTheme` must be one of the following:
33
+
34
+ - `accent`
35
+ - `default`
36
+ - `error`
37
+ - `gradient`
38
+ - `gray`
39
+ - `identity1`
40
+ - `identity2`
41
+ - `identity3`
42
+ - `identity4`
43
+ - `info`
44
+ - `negative`
45
+ - `success`
46
+ - `warning`
@@ -0,0 +1,31 @@
1
+ export const COLOR_THEMES = {
2
+ ACCENT: 'accent',
3
+ DEFAULT: 'default',
4
+ ERROR: 'error',
5
+ GRADIENT: 'gradient',
6
+ GRAY: 'gray',
7
+ IDENTITY_1: 'identity1',
8
+ IDENTITY_2: 'identity2',
9
+ IDENTITY_3: 'identity3',
10
+ IDENTITY_4: 'identity4',
11
+ INFO: 'info',
12
+ NEGATIVE: 'negative',
13
+ SUCCESS: 'success',
14
+ WARNING: 'warning'
15
+ };
16
+
17
+ export const ICON_COLOR_THEMES = {
18
+ [COLOR_THEMES.ACCENT]: 'accent',
19
+ [COLOR_THEMES.DEFAULT]: 'dark',
20
+ [COLOR_THEMES.ERROR]: 'error',
21
+ [COLOR_THEMES.GRADIENT]: 'light',
22
+ [COLOR_THEMES.GRAY]: 'gray',
23
+ [COLOR_THEMES.IDENTITY_1]: 'light',
24
+ [COLOR_THEMES.IDENTITY_2]: 'light',
25
+ [COLOR_THEMES.IDENTITY_3]: 'light',
26
+ [COLOR_THEMES.IDENTITY_4]: 'light',
27
+ [COLOR_THEMES.INFO]: 'information',
28
+ [COLOR_THEMES.NEGATIVE]: 'dark',
29
+ [COLOR_THEMES.SUCCESS]: 'success',
30
+ [COLOR_THEMES.WARNING]: 'warning'
31
+ };
@@ -0,0 +1,133 @@
1
+ import { bool, element, func, object, string } from 'prop-types';
2
+ import React from 'react';
3
+ import { View } from 'react-native';
4
+ import { LinearGradient } from 'react-native-linear-gradient';
5
+
6
+ import UTButton from '../UTButton';
7
+ import UTIcon from '../UTIcon';
8
+ import UTLabel from '../UTLabel';
9
+ import UTLoading from '../UTLoading';
10
+ import UTImage from '../UTImage';
11
+ import { withTheme } from '../../theming';
12
+
13
+ import { ICON_COLOR_THEMES, COLOR_THEMES } from './constants';
14
+ import ownStyles from './styles';
15
+
16
+ const UTStatusMessage = ({
17
+ children,
18
+ colorTheme = COLOR_THEMES.DEFAULT,
19
+ description,
20
+ descriptionProps,
21
+ helpText,
22
+ helpTextProps,
23
+ icon = 'IconInfoCircle',
24
+ iconProps = {},
25
+ image,
26
+ loading,
27
+ primaryAction,
28
+ primaryActionProps,
29
+ primaryActionText,
30
+ secondaryAction,
31
+ secondaryActionProps,
32
+ secondaryActionText,
33
+ showBanner = true,
34
+ showHeader = true,
35
+ style = {},
36
+ theme,
37
+ title,
38
+ titleProps
39
+ }) => {
40
+ const Banner = colorTheme === COLOR_THEMES.GRADIENT && showBanner ? LinearGradient : View;
41
+ const IconContainer = colorTheme === COLOR_THEMES.GRADIENT && !showBanner ? LinearGradient : View;
42
+ return (
43
+ <View style={[ownStyles.container, style.container]}>
44
+ {loading ? (
45
+ <UTLoading loading text={null} />
46
+ ) : showHeader ? (
47
+ <Banner
48
+ angle={45}
49
+ colors={[theme.Palette?.identityGradient?.['01'], theme.Palette?.identityGradient?.['02']]}
50
+ end={{ x: 1, y: 0.5 }}
51
+ start={{ x: 0, y: 0.5 }}
52
+ style={[ownStyles.banner(theme, colorTheme, showBanner), style.banner]}
53
+ useAngle
54
+ >
55
+ {image ? (
56
+ <UTImage source={image} style={{ ...style.image }} />
57
+ ) : (
58
+ <IconContainer
59
+ angle={45}
60
+ colors={[theme.Palette?.identityGradient?.['01'], theme.Palette?.identityGradient?.['02']]}
61
+ end={{ x: 1, y: 0.5 }}
62
+ start={{ x: 0, y: 0.5 }}
63
+ style={ownStyles.iconContainer(theme, colorTheme)}
64
+ useAngle
65
+ >
66
+ <UTIcon colorTheme={ICON_COLOR_THEMES[colorTheme]} name={icon} {...iconProps} />
67
+ </IconContainer>
68
+ )}
69
+ </Banner>
70
+ ) : null}
71
+ {(title || description || helpText) && (
72
+ <View style={ownStyles.section}>
73
+ {title && (
74
+ <UTLabel style={ownStyles.label} variant="title3" weight="medium" {...titleProps}>
75
+ {title}
76
+ </UTLabel>
77
+ )}
78
+ {description && (
79
+ <UTLabel style={ownStyles.label} colorTheme="gray" variant="body" {...descriptionProps}>
80
+ {description}
81
+ </UTLabel>
82
+ )}
83
+ {helpText && (
84
+ <UTLabel style={ownStyles.label} colorTheme="gray" variant="small" {...helpTextProps}>
85
+ {helpText}
86
+ </UTLabel>
87
+ )}
88
+ </View>
89
+ )}
90
+ {children}
91
+ {(primaryAction || secondaryAction) && (
92
+ <View style={ownStyles.section}>
93
+ {primaryAction && (
94
+ <UTButton onClick={primaryAction} {...primaryActionProps}>
95
+ {primaryActionText}
96
+ </UTButton>
97
+ )}
98
+ {secondaryAction && (
99
+ <UTButton onClick={secondaryAction} variant="text" {...secondaryActionProps}>
100
+ {secondaryActionText}
101
+ </UTButton>
102
+ )}
103
+ </View>
104
+ )}
105
+ </View>
106
+ );
107
+ };
108
+
109
+ UTStatusMessage.propTypes = {
110
+ children: element,
111
+ colorTheme: string,
112
+ description: string,
113
+ descriptionProps: object,
114
+ helpText: string,
115
+ helpTextProps: object,
116
+ icon: string,
117
+ iconProps: object,
118
+ image: string,
119
+ loading: bool,
120
+ primaryAction: func,
121
+ primaryActionProps: object,
122
+ primaryActionText: string,
123
+ secondaryAction: func,
124
+ secondaryActionProps: object,
125
+ secondaryActionText: string,
126
+ showBanner: bool,
127
+ showHeader: bool,
128
+ style: object,
129
+ title: string,
130
+ titleProps: object
131
+ };
132
+
133
+ export default withTheme(UTStatusMessage);
@@ -0,0 +1,68 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ import { COLOR_THEMES } from './constants';
4
+
5
+ const getIconBackgroundColor = (colorTheme, theme) =>
6
+ ({
7
+ [COLOR_THEMES.ACCENT]: theme.Palette?.accent['01'],
8
+ [COLOR_THEMES.DEFAULT]: theme.Palette?.light['03'],
9
+ [COLOR_THEMES.ERROR]: theme.Palette?.error['01'],
10
+ [COLOR_THEMES.GRADIENT]: 'light',
11
+ [COLOR_THEMES.GRAY]: theme.Palette?.light['03'],
12
+ [COLOR_THEMES.IDENTITY_1]: theme.Palette?.identitySolid?.['01'],
13
+ [COLOR_THEMES.IDENTITY_2]: theme.Palette?.identitySolid?.['02'],
14
+ [COLOR_THEMES.IDENTITY_3]: theme.Palette?.identitySolid?.['03'],
15
+ [COLOR_THEMES.IDENTITY_4]: theme.Palette?.identitySolid?.['04'],
16
+ [COLOR_THEMES.INFO]: theme.Palette?.information['01'],
17
+ [COLOR_THEMES.NEGATIVE]: theme.Palette?.light['01'],
18
+ [COLOR_THEMES.SUCCESS]: theme.Palette?.success['01'],
19
+ [COLOR_THEMES.WARNING]: theme.Palette?.warning['01']
20
+ })[colorTheme];
21
+
22
+ const getBannerBackgroundColor = (colorTheme, theme) =>
23
+ ({
24
+ [COLOR_THEMES.ACCENT]: theme.Palette?.accent['03'],
25
+ [COLOR_THEMES.DEFAULT]: theme.Palette?.gray['05'],
26
+ [COLOR_THEMES.ERROR]: theme.Palette?.error['03'],
27
+ [COLOR_THEMES.GRADIENT]: null,
28
+ [COLOR_THEMES.GRAY]: theme.Palette?.gray['03'],
29
+ [COLOR_THEMES.IDENTITY_1]: theme.Palette?.identitySolid?.['01'],
30
+ [COLOR_THEMES.IDENTITY_2]: theme.Palette?.identitySolid?.['02'],
31
+ [COLOR_THEMES.IDENTITY_3]: theme.Palette?.identitySolid?.['03'],
32
+ [COLOR_THEMES.IDENTITY_4]: theme.Palette?.identitySolid?.['04'],
33
+ [COLOR_THEMES.INFO]: theme.Palette?.information['03'],
34
+ [COLOR_THEMES.NEGATIVE]: theme.Palette?.light['01'],
35
+ [COLOR_THEMES.SUCCESS]: theme.Palette?.success['03'],
36
+ [COLOR_THEMES.WARNING]: theme.Palette?.warning['03']
37
+ })[colorTheme];
38
+
39
+ export default StyleSheet.create({
40
+ container: {
41
+ alignItems: 'center',
42
+ display: 'flex',
43
+ gap: 24,
44
+ width: '100%'
45
+ },
46
+ section: {
47
+ alignItems: 'center',
48
+ display: 'flex',
49
+ gap: 8
50
+ },
51
+ iconContainer: (theme, colorTheme) => ({
52
+ alignItems: 'center',
53
+ backgroundColor: getIconBackgroundColor(colorTheme, theme),
54
+ borderRadius: 100,
55
+ display: 'flex',
56
+ height: 56,
57
+ justifyContent: 'center',
58
+ width: 56
59
+ }),
60
+ banner: (theme, colorTheme, showBanner) => ({
61
+ alignItems: 'center',
62
+ backgroundColor: showBanner ? getBannerBackgroundColor(colorTheme, theme) : 'transparent',
63
+ display: 'flex',
64
+ justifyContent: 'center',
65
+ padding: 12,
66
+ width: '100%'
67
+ })
68
+ });
package/lib/index.js CHANGED
@@ -38,6 +38,7 @@ export { default as TransitionView } from './components/TransitionView';
38
38
  export { default as UTActionCard } from './components/UTActionCard';
39
39
  export { default as UTAutocomplete } from './components/UTAutocomplete';
40
40
  export { default as UTBadge } from './components/UTBadge';
41
+ export { default as UTBanner } from './components/UTBanner';
41
42
  export { default as UTBottomSheet } from './components/UTBottomSheet';
42
43
  export { default as UTButton } from './components/UTButton';
43
44
  export { default as UTButtonGroup } from './components/UTButtonGroup';
@@ -60,6 +61,7 @@ export { default as UTRoundView } from './components/UTRoundView';
60
61
  export { default as UTSearchField } from './components/UTSearchField';
61
62
  export { default as UTSelect } from './components/UTSelect';
62
63
  export { default as UTSelectableCard } from './components/UTSelectableCard';
64
+ export { default as UTStatusMessage } from './components/UTStatusMessage';
63
65
  export { default as UTStepFeedback } from './components/UTStepFeedback';
64
66
  export { default as UTSwitch } from './components/UTSwitch';
65
67
  export { default as UTTextArea } from './components/UTTextArea';
@@ -68,7 +70,6 @@ export { default as UTTooltip } from './components/UTTooltip';
68
70
  export { default as UTTracker } from './components/UTTracker';
69
71
  export { default as UTValidation } from './components/UTValidation';
70
72
  export { default as UTWorkflowContainer } from './components/UTWorkflowContainer';
71
- export { default as UTBanner } from './components/UTBanner';
72
73
 
73
74
  // Theming
74
75
  export * from './theming';
@@ -216,6 +216,17 @@ const DefaultTheme = {
216
216
  '03': colors.actionNegative03,
217
217
  '04': colors.actionNegative04,
218
218
  '05': colors.actionNegative05
219
+ },
220
+ identitySolid: {
221
+ '01': '#5E3BEB',
222
+ '02': '#20BBFC',
223
+ '03': '#25E0A6',
224
+ '04': '#A9FA5C',
225
+ '05': '#285AFF'
226
+ },
227
+ identityGradient: {
228
+ '01': '#25E0A6',
229
+ '02': '#20BBFC'
219
230
  }
220
231
  }
221
232
  };
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.31.0",
5
+ "version": "1.31.2",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [
@@ -29,6 +29,7 @@
29
29
  "react-native": "*",
30
30
  "react-native-document-picker": "^9.0.1",
31
31
  "react-native-image-picker": "^5.0.0",
32
+ "react-native-linear-gradient": "^2.8.3",
32
33
  "react-native-pager-view": "^6.2.0",
33
34
  "react-native-svg": "^13.0.0",
34
35
  "react-native-vector-icons": "^10.0.0"
@@ -43,11 +44,12 @@
43
44
  "numeral": "^2.0.6",
44
45
  "pdf-lib": "^1.17.1",
45
46
  "react-native-collapsible": "^1.6.1",
47
+ "react-native-linear-gradient": "^2.8.3",
46
48
  "react-native-markdown-display": "^7.0.0-alpha.2",
47
49
  "react-native-modal": "^13.0.1",
48
50
  "react-native-pager-view": "^6.2.1",
49
- "react-native-svg": "^13.13.0",
50
- "react-native-safe-area-context": "^4.5.0"
51
+ "react-native-safe-area-context": "^4.5.0",
52
+ "react-native-svg": "^13.13.0"
51
53
  },
52
54
  "devDependencies": {
53
55
  "@babel/cli": "^7.22.10",