@widergy/mobile-ui 1.31.1 → 1.31.3
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 +14 -0
- package/lib/components/UTRating/README.md +44 -0
- package/lib/components/UTRating/components/Option/index.js +32 -0
- package/lib/components/UTRating/components/Option/utils.js +17 -0
- package/lib/components/UTRating/constants.js +5 -0
- package/lib/components/UTRating/index.js +101 -0
- package/lib/components/UTRating/styles.js +38 -0
- package/lib/components/UTStatusMessage/README.md +46 -0
- package/lib/components/UTStatusMessage/constants.js +31 -0
- package/lib/components/UTStatusMessage/index.js +133 -0
- package/lib/components/UTStatusMessage/styles.js +68 -0
- package/lib/index.js +3 -1
- package/lib/theming/DefaultTheme.js +11 -0
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.31.3](https://github.com/widergy/mobile-ui/compare/v1.31.2...v1.31.3) (2024-11-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [EVE-4328] UTRating ([#384](https://github.com/widergy/mobile-ui/issues/384)) ([6485384](https://github.com/widergy/mobile-ui/commit/6485384e2fed5cef0c2c68b88b1cbf8e45d4f3c7))
|
|
7
|
+
|
|
8
|
+
## [1.31.2](https://github.com/widergy/mobile-ui/compare/v1.31.1...v1.31.2) (2024-11-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [EVE-4331] UTStatusMessage ([#383](https://github.com/widergy/mobile-ui/issues/383)) ([8e35027](https://github.com/widergy/mobile-ui/commit/8e350272bb402c2a80ed649a66d6654c52dc35d8))
|
|
14
|
+
|
|
1
15
|
## [1.31.1](https://github.com/widergy/mobile-ui/compare/v1.31.0...v1.31.1) (2024-11-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# UTRating
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
`UTRating` is a configurable rating input component that enables users to easily provide feedback through visual indicators.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| ------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| classNames | object | | Custom CSS class names for styling the component. |
|
|
12
|
+
| dataTestId | string | | Unique identifier for testing purposes. |
|
|
13
|
+
| disabled | bool | | Indicates whether the input is disabled and cannot be interacted with. |
|
|
14
|
+
| error | string | | Error message to display when validation fails or an issue occurs. |
|
|
15
|
+
| helpTextEnd | string | | Additional help text displayed at the end of the input for user guidance. |
|
|
16
|
+
| helpTextStart | string | | Additional help text displayed at the beginning of the input for user guidance. |
|
|
17
|
+
| onChange | func | | Callback function invoked when the input value changes. |
|
|
18
|
+
| options | array | | Array of options available for selection. |
|
|
19
|
+
| required | bool | | Indicates whether the input is mandatory for form submission. |
|
|
20
|
+
| title | string | | Title for the input, providing context to the user. |
|
|
21
|
+
| validations | array | | Array of validation rules to be applied to the input value. |
|
|
22
|
+
| value | string | | The current value of the input. |
|
|
23
|
+
| variant | string | `star` | Defines the visual style component. |
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### options
|
|
27
|
+
|
|
28
|
+
`options` is an array of objects with a `value` and a `name` key. The values should be in the range of 0-10, except for the `faces` variant. In desktop view, all options are displayed in one row; in responsive view, they are broken into 2 rows if there are more than 5 options.
|
|
29
|
+
|
|
30
|
+
### variant
|
|
31
|
+
|
|
32
|
+
The value of `variant` must be one of the following:
|
|
33
|
+
|
|
34
|
+
- `faces`: the options are represented as face icons. Option values should exclusively be between 1 and 5, values outside this range are not supported.
|
|
35
|
+
- `star`: the options are represented as star icons.
|
|
36
|
+
- `text`: the options are represented as the option's `text`.
|
|
37
|
+
|
|
38
|
+
### Structure of Validations
|
|
39
|
+
|
|
40
|
+
For detailed information about the structure of validations, please refer to the UTValidation component documentation.
|
|
41
|
+
|
|
42
|
+
### Handling Errors
|
|
43
|
+
|
|
44
|
+
Errors can be displayed below the text input using either the `error` prop or the `validations` prop.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { bool, func, object, string } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { RATING_VARIANTS } from '../../constants';
|
|
5
|
+
import UTButton from '../../../UTButton';
|
|
6
|
+
|
|
7
|
+
import { getIcon, getVariant } from './utils';
|
|
8
|
+
|
|
9
|
+
const Option = ({ disabled, isSelected, name, onChange, value, variant, wrapperStyle }) => (
|
|
10
|
+
<UTButton
|
|
11
|
+
colorTheme={isSelected ? 'primary' : 'secondary'}
|
|
12
|
+
disabled={disabled}
|
|
13
|
+
Icon={getIcon(variant, value, isSelected)}
|
|
14
|
+
onPress={() => onChange(value)}
|
|
15
|
+
style={{ root: wrapperStyle }}
|
|
16
|
+
variant={getVariant(variant, isSelected)}
|
|
17
|
+
>
|
|
18
|
+
{RATING_VARIANTS.TEXT === variant ? name : null}
|
|
19
|
+
</UTButton>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
Option.propTypes = {
|
|
23
|
+
disabled: bool,
|
|
24
|
+
isSelected: bool,
|
|
25
|
+
name: string,
|
|
26
|
+
onChange: func,
|
|
27
|
+
value: string,
|
|
28
|
+
variant: string,
|
|
29
|
+
wrapperStyle: object
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default Option;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RATING_VARIANTS } from '../../constants';
|
|
2
|
+
|
|
3
|
+
export const getIcon = (variant, value, isSelected) =>
|
|
4
|
+
({
|
|
5
|
+
[RATING_VARIANTS.TEXT]: null,
|
|
6
|
+
[RATING_VARIANTS.FACES]: {
|
|
7
|
+
1: 'IconMoodSad',
|
|
8
|
+
2: 'IconMoodConfuzed',
|
|
9
|
+
3: 'IconMoodEmpty',
|
|
10
|
+
4: 'IconMoodSmile',
|
|
11
|
+
5: 'IconMoodHappy'
|
|
12
|
+
}[value],
|
|
13
|
+
[RATING_VARIANTS.STAR]: isSelected ? 'IconStarFilled' : 'IconStar'
|
|
14
|
+
})[variant];
|
|
15
|
+
|
|
16
|
+
export const getVariant = (variant, isSelected) =>
|
|
17
|
+
!isSelected || variant === RATING_VARIANTS.STAR ? 'shadow' : 'outlined';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { func, string, bool, object, array } from 'prop-types';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { formatErrorToValidation } from '../UTValidation/utils';
|
|
6
|
+
import { withTheme } from '../../theming';
|
|
7
|
+
import UTFieldLabel from '../UTFieldLabel';
|
|
8
|
+
import UTLabel from '../UTLabel';
|
|
9
|
+
import UTValidation from '../UTValidation';
|
|
10
|
+
|
|
11
|
+
import { RATING_VARIANTS } from './constants';
|
|
12
|
+
import Option from './components/Option';
|
|
13
|
+
import styles from './styles';
|
|
14
|
+
|
|
15
|
+
const UTRating = ({
|
|
16
|
+
classNames = {},
|
|
17
|
+
dataTestId,
|
|
18
|
+
disabled,
|
|
19
|
+
error,
|
|
20
|
+
helpTextEnd,
|
|
21
|
+
helpTextStart,
|
|
22
|
+
onChange,
|
|
23
|
+
options = [],
|
|
24
|
+
required,
|
|
25
|
+
theme,
|
|
26
|
+
title,
|
|
27
|
+
validations,
|
|
28
|
+
value,
|
|
29
|
+
variant = RATING_VARIANTS.STAR
|
|
30
|
+
}) => {
|
|
31
|
+
const validationData = useMemo(
|
|
32
|
+
() => validations || (error && formatErrorToValidation(error)),
|
|
33
|
+
[error, validations]
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const valueIndex = options.map(({ value: optionValue }) => optionValue).indexOf(value);
|
|
37
|
+
const isSelected = index =>
|
|
38
|
+
valueIndex !== -1 && variant === RATING_VARIANTS.STAR ? index <= valueIndex : index === valueIndex;
|
|
39
|
+
|
|
40
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
41
|
+
|
|
42
|
+
const onLayout = useCallback(event => {
|
|
43
|
+
const { width } = event.nativeEvent.layout;
|
|
44
|
+
setContainerWidth(width);
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={[styles.container, classNames.container]} data-testid={dataTestId}>
|
|
49
|
+
{title && (
|
|
50
|
+
<UTFieldLabel colorTheme="dark" required={required}>
|
|
51
|
+
{title}
|
|
52
|
+
</UTFieldLabel>
|
|
53
|
+
)}
|
|
54
|
+
<View style={styles.optionsContainer} onLayout={onLayout}>
|
|
55
|
+
{options.map((option, index) => (
|
|
56
|
+
<Option
|
|
57
|
+
{...option}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
error={error}
|
|
60
|
+
isSelected={isSelected(index)}
|
|
61
|
+
key={option.value}
|
|
62
|
+
onChange={onChange}
|
|
63
|
+
variant={variant}
|
|
64
|
+
wrapperStyle={styles.option(containerWidth, error, options, theme)}
|
|
65
|
+
/>
|
|
66
|
+
))}
|
|
67
|
+
</View>
|
|
68
|
+
{helpTextStart && (
|
|
69
|
+
<View style={styles.helpTextContainer}>
|
|
70
|
+
<UTLabel colorTheme="gray" variant="small">
|
|
71
|
+
{helpTextStart}
|
|
72
|
+
</UTLabel>
|
|
73
|
+
{helpTextEnd && (
|
|
74
|
+
<UTLabel colorTheme="gray" variant="small">
|
|
75
|
+
{helpTextEnd}
|
|
76
|
+
</UTLabel>
|
|
77
|
+
)}
|
|
78
|
+
</View>
|
|
79
|
+
)}
|
|
80
|
+
{validationData && <UTValidation validationData={validationData} />}
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
UTRating.propTypes = {
|
|
86
|
+
classNames: object,
|
|
87
|
+
dataTestId: string,
|
|
88
|
+
disabled: bool,
|
|
89
|
+
error: string,
|
|
90
|
+
helpTextEnd: string,
|
|
91
|
+
helpTextStart: string,
|
|
92
|
+
onChange: func,
|
|
93
|
+
options: array,
|
|
94
|
+
required: bool,
|
|
95
|
+
title: string,
|
|
96
|
+
validations: array,
|
|
97
|
+
value: string,
|
|
98
|
+
variant: string
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default withTheme(UTRating);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export default StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
gap: 8,
|
|
8
|
+
width: '100%'
|
|
9
|
+
},
|
|
10
|
+
optionsContainer: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
flexWrap: 'wrap',
|
|
14
|
+
gap: 4,
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
width: '100%'
|
|
17
|
+
},
|
|
18
|
+
helpTextContainer: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
justifyContent: 'space-between'
|
|
22
|
+
},
|
|
23
|
+
option: (containerWidth, error, options, theme) => {
|
|
24
|
+
const topItems = Math.ceil(options.length / 2);
|
|
25
|
+
const breakOptions = options.length > 5;
|
|
26
|
+
return {
|
|
27
|
+
alignContent: 'center',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexBasis: breakOptions ? (containerWidth - (topItems - 1) * 4) / topItems : 0,
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
flexGrow: breakOptions ? 0 : 1,
|
|
32
|
+
flexShrink: 0,
|
|
33
|
+
height: 48,
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
...(error ? { borderColor: theme.Palette.error['05'], borderWidth: 2 } : {})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -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';
|
|
@@ -56,10 +57,12 @@ export { default as UTPasswordField } from './components/UTPasswordField';
|
|
|
56
57
|
export { default as UTPhoneInput } from './components/UTPhoneInput';
|
|
57
58
|
export { default as UTProductItem } from './components/UTProductItem';
|
|
58
59
|
export { default as UTProgressBar } from './components/UTProgressBar';
|
|
60
|
+
export { default as UTRating } from './components/UTRating';
|
|
59
61
|
export { default as UTRoundView } from './components/UTRoundView';
|
|
60
62
|
export { default as UTSearchField } from './components/UTSearchField';
|
|
61
63
|
export { default as UTSelect } from './components/UTSelect';
|
|
62
64
|
export { default as UTSelectableCard } from './components/UTSelectableCard';
|
|
65
|
+
export { default as UTStatusMessage } from './components/UTStatusMessage';
|
|
63
66
|
export { default as UTStepFeedback } from './components/UTStepFeedback';
|
|
64
67
|
export { default as UTSwitch } from './components/UTSwitch';
|
|
65
68
|
export { default as UTTextArea } from './components/UTTextArea';
|
|
@@ -68,7 +71,6 @@ export { default as UTTooltip } from './components/UTTooltip';
|
|
|
68
71
|
export { default as UTTracker } from './components/UTTracker';
|
|
69
72
|
export { default as UTValidation } from './components/UTValidation';
|
|
70
73
|
export { default as UTWorkflowContainer } from './components/UTWorkflowContainer';
|
|
71
|
-
export { default as UTBanner } from './components/UTBanner';
|
|
72
74
|
|
|
73
75
|
// Theming
|
|
74
76
|
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.
|
|
5
|
+
"version": "1.31.3",
|
|
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-
|
|
50
|
-
"react-native-
|
|
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",
|