@widergy/mobile-ui 1.24.0 → 1.25.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.
- package/CHANGELOG.md +14 -0
- package/lib/components/ActionButton/index.js +6 -1
- package/lib/components/ActionButton/propTypes.js +2 -2
- package/lib/components/Capture/index.js +4 -4
- package/lib/components/CheckList/index.js +2 -2
- package/lib/components/Icon/propTypes.js +1 -1
- package/lib/components/IconBadge/index.js +3 -3
- package/lib/components/ImagePicker/ModalSelectionOption/index.js +20 -27
- package/lib/components/ImagePicker/ModalSelectionOption/styles.js +2 -11
- package/lib/components/ImagePicker/layout.js +7 -5
- package/lib/components/ImageRadio/index.js +10 -10
- package/lib/components/Input/components/ShowPassword/index.js +3 -11
- package/lib/components/Input/components/ShowPassword/styles.js +0 -4
- package/lib/components/Loading/index.js +2 -2
- package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/index.js +3 -11
- package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/styles.js +0 -4
- package/lib/components/PhotoAlbum/index.js +6 -6
- package/lib/components/Portal/README.md +10 -13
- package/lib/components/RadioGroup/components/RadioButton/index.js +17 -9
- package/lib/components/RateChart/components/CategoryButton/index.js +8 -11
- package/lib/components/RateChart/components/RateStagesGraph/components/Bars/components/Stage/index.js +3 -3
- package/lib/components/RateChart/components/RateStagesGraph/components/Indicator/index.js +4 -7
- package/lib/components/Snackbar/index.js +21 -12
- package/lib/components/Snackbar/styles.js +10 -0
- package/lib/components/Touchable/README.md +11 -10
- package/lib/components/TransformView/README.md +12 -12
- package/lib/components/TransitionView/README.md +14 -12
- package/lib/components/UTButton/constants.js +17 -1
- package/lib/components/UTButton/theme.js +18 -3
- package/lib/components/UTDetailDrawer/README.md +2 -2
- package/lib/components/UTDetailDrawer/index.js +15 -5
- package/lib/components/UTDetailDrawer/styles.js +12 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconArrowBack.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconCamera.svg +5 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconCheckCircle.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconDelete.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconDeleteOutline.svg +4 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconDeleteVariant.svg +7 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconEdit.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconEditVariant.svg +4 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconMoreVertical.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconMyLocation.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconSettings.svg +1 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconShare.svg +1 -0
- package/lib/components/UTIcon/constants.js +24 -0
- package/lib/components/UTIcon/index.js +2 -2
- package/lib/components/UTLabel/README.md +13 -11
- package/lib/components/UTLabel/constants.js +0 -11
- package/lib/components/UTLabel/index.js +12 -5
- package/lib/components/UTLabel/proptypes.js +14 -5
- package/lib/components/UTLabel/theme.js +2 -1
- package/lib/components/UTLoading/README.md +1 -1
- package/lib/components/UTModal/index.js +28 -47
- package/lib/components/UTModal/proptypes.js +1 -1
- package/lib/components/UTModal/styles.js +11 -37
- package/lib/components/UTOnBoarding/components/CardContent/index.js +12 -13
- package/lib/components/UTProgressBar/index.js +2 -2
- package/lib/components/UTStepFeedback/index.js +6 -8
- package/lib/components/UTStepFeedback/proptypes.js +0 -1
- package/lib/components/UTStepFeedback/styles.js +8 -2
- package/lib/components/UTTextInput/versions/V0/flavors/OutlinedInput/index.js +2 -2
- package/lib/components/UTTopbar/index.js +4 -0
- package/lib/theming/README.md +1 -1
- package/lib/utils/styleUtils/index.js +2 -2
- package/package.json +1 -1
- package/lib/components/RateChart/components/CategoryButton/styles.js +0 -16
|
@@ -3,7 +3,7 @@ import { number, string, arrayOf, shape, any } from 'prop-types';
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import Magnitude from '../../../Magnitude';
|
|
6
|
-
import
|
|
6
|
+
import UTLabel from '../../../../../UTLabel';
|
|
7
7
|
|
|
8
8
|
import IndicatorIcon from './components/IndicatorIcon';
|
|
9
9
|
import styles, { ICON_SIZE } from './styles';
|
|
@@ -74,11 +74,10 @@ const Indicator = ({
|
|
|
74
74
|
withLeftUnit
|
|
75
75
|
/>
|
|
76
76
|
)}
|
|
77
|
-
<
|
|
77
|
+
<UTLabel weight="bold" colorTheme="accent" style={styles.label}>
|
|
78
78
|
{!!indicatorLabel && indicatorLabel}
|
|
79
|
-
</
|
|
79
|
+
</UTLabel>
|
|
80
80
|
</View>
|
|
81
|
-
|
|
82
81
|
{consumptionLimit && (
|
|
83
82
|
<Fragment>
|
|
84
83
|
<View
|
|
@@ -93,9 +92,7 @@ const Indicator = ({
|
|
|
93
92
|
unity={consumptionUnit}
|
|
94
93
|
iconProps={{ height: ICON_SIZE, width: ICON_SIZE }}
|
|
95
94
|
/>
|
|
96
|
-
<
|
|
97
|
-
Limite a subsidiar
|
|
98
|
-
</Label>
|
|
95
|
+
<UTLabel colorTheme="light">Limite a subsidiar</UTLabel>
|
|
99
96
|
</View>
|
|
100
97
|
<IndicatorIcon position={limitIndicatorPosition} inverted />
|
|
101
98
|
</Fragment>
|
|
@@ -3,11 +3,11 @@ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
|
3
3
|
import { SafeAreaView, Animated } from 'react-native';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import { withTheme, themeType } from '../../theming';
|
|
7
|
-
import IconButton from '../IconButton';
|
|
8
|
-
import Label from '../Label';
|
|
9
6
|
import { IS_ANDROID } from '../../utils/platformUtils/constants';
|
|
10
7
|
import { SHADOW_OPACITY } from '../../utils/styleUtils';
|
|
8
|
+
import { withTheme, themeType } from '../../theming';
|
|
9
|
+
import UTButton from '../UTButton';
|
|
10
|
+
import UTLabel from '../UTLabel';
|
|
11
11
|
|
|
12
12
|
import styles, { alertStyleMapper } from './styles';
|
|
13
13
|
import { INFO, DURATION } from './constants';
|
|
@@ -67,13 +67,15 @@ class Snackbar extends Component {
|
|
|
67
67
|
Animated.parallel([
|
|
68
68
|
Animated.timing(opacity, {
|
|
69
69
|
toValue: 1,
|
|
70
|
-
duration: DURATION
|
|
70
|
+
duration: DURATION,
|
|
71
|
+
useNativeDriver: true
|
|
71
72
|
}),
|
|
72
73
|
Animated.sequence([
|
|
73
74
|
Animated.delay(100),
|
|
74
75
|
Animated.timing(textOpacity, {
|
|
75
76
|
toValue: 1,
|
|
76
|
-
duration: DURATION
|
|
77
|
+
duration: DURATION,
|
|
78
|
+
useNativeDriver: true
|
|
77
79
|
})
|
|
78
80
|
])
|
|
79
81
|
]).start(() => {
|
|
@@ -90,7 +92,8 @@ class Snackbar extends Component {
|
|
|
90
92
|
|
|
91
93
|
Animated.timing(opacity, {
|
|
92
94
|
toValue: 0,
|
|
93
|
-
duration: DURATION
|
|
95
|
+
duration: DURATION,
|
|
96
|
+
useNativeDriver: true
|
|
94
97
|
}).start(() => {
|
|
95
98
|
textOpacity.setValue(0);
|
|
96
99
|
this.setState({
|
|
@@ -110,7 +113,8 @@ class Snackbar extends Component {
|
|
|
110
113
|
|
|
111
114
|
Animated.timing(textOpacity, {
|
|
112
115
|
toValue: 1,
|
|
113
|
-
duration: DURATION
|
|
116
|
+
duration: DURATION,
|
|
117
|
+
useNativeDriver: true
|
|
114
118
|
}).start(() => {
|
|
115
119
|
this.resetTimeout();
|
|
116
120
|
});
|
|
@@ -174,8 +178,6 @@ class Snackbar extends Component {
|
|
|
174
178
|
const { message, style, alert, theme, textStyle } = this.props;
|
|
175
179
|
const { visible } = this.state;
|
|
176
180
|
|
|
177
|
-
const buttonColor = (textStyle && textStyle.color) || 'white';
|
|
178
|
-
|
|
179
181
|
if (!visible) return null;
|
|
180
182
|
|
|
181
183
|
const extraStyles = this.getExtraStyles();
|
|
@@ -186,11 +188,18 @@ class Snackbar extends Component {
|
|
|
186
188
|
<SafeAreaView style={styles.container}>
|
|
187
189
|
<Animated.View style={[styles.surface, alertStyles, style, extraStyles]}>
|
|
188
190
|
<Animated.View style={[styles.labelContainer, extraLabelStyles]}>
|
|
189
|
-
<
|
|
191
|
+
<UTLabel colorTheme="light" style={textStyle}>
|
|
190
192
|
{message}
|
|
191
|
-
</
|
|
193
|
+
</UTLabel>
|
|
192
194
|
</Animated.View>
|
|
193
|
-
<
|
|
195
|
+
<UTButton
|
|
196
|
+
Icon="IconX"
|
|
197
|
+
colorTheme="negative"
|
|
198
|
+
onPress={this.handleDismiss}
|
|
199
|
+
size="small"
|
|
200
|
+
style={{ root: styles.button, icon: styles.icon }}
|
|
201
|
+
variant="text"
|
|
202
|
+
/>
|
|
194
203
|
</Animated.View>
|
|
195
204
|
</SafeAreaView>
|
|
196
205
|
);
|
|
@@ -37,5 +37,15 @@ export default StyleSheet.create({
|
|
|
37
37
|
labelContainer: {
|
|
38
38
|
alignItems: 'flex-start',
|
|
39
39
|
flex: 1
|
|
40
|
+
},
|
|
41
|
+
button: {
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
borderRadius: 32,
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
maxWidth: 32
|
|
46
|
+
},
|
|
47
|
+
icon: {
|
|
48
|
+
maxHeight: 20,
|
|
49
|
+
maxWidth: 20
|
|
40
50
|
}
|
|
41
51
|
});
|
|
@@ -6,19 +6,20 @@ A component that provides the capability to capture tapping gestures and display
|
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
|
|
9
|
-
| NAME
|
|
10
|
-
|
|
11
|
-
| borderless
|
|
12
|
-
| disabled
|
|
13
|
-
| onPress
|
|
14
|
-
| effectColor
|
|
15
|
-
| style
|
|
9
|
+
| NAME | TYPE | REQUIRED | DESCRIPTION |
|
|
10
|
+
| ----------- | --------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
11
|
+
| borderless | bool | No | If property `borderless` evaluates to true the ripple will render outside of the view bounds. |
|
|
12
|
+
| disabled | bool | No | If true, disable all gesture interactions. |
|
|
13
|
+
| onPress | function | Yes | Callback called when the touch is released. |
|
|
14
|
+
| effectColor | string | No | The ripple effect color (For Android API >= 21) and highlight color (iOS). |
|
|
15
|
+
| style | ViewStyle | No | custom style appzlied to container. |
|
|
16
16
|
|
|
17
17
|
#### Example
|
|
18
|
+
|
|
18
19
|
```js
|
|
19
|
-
import { Touchable,
|
|
20
|
+
import { Touchable, UTLabel } from '@widergy/mobile-ui';
|
|
20
21
|
|
|
21
22
|
<Touchable style={styles.container} onPress={this.handlePress} rippleColor={color} underlayColor={color}>
|
|
22
|
-
<
|
|
23
|
-
</Touchable
|
|
23
|
+
<UTLabel>PRESS ME</UTLabel>
|
|
24
|
+
</Touchable>;
|
|
24
25
|
```
|
|
@@ -6,18 +6,18 @@ This view applies transforms via `setNativeProps` with a transform Matrix. It ca
|
|
|
6
6
|
|
|
7
7
|
### Props
|
|
8
8
|
|
|
9
|
-
| NAME | TYPE
|
|
10
|
-
|
|
|
11
|
-
| animation | `Animated.value
|
|
12
|
-
| composeRefs | oneOf([function, ref**])
|
|
13
|
-
| endValue | oneOf([number, string])
|
|
14
|
-
| origin | oneOf([`"bottom"`, `"bottom_left"`, `"bottom_right"`, `"center"`, `"left"`, `"right"`, `top"`, `"top_left"`, `"top_right"`])
|
|
15
|
-
| startValue | oneOf([number, string])
|
|
16
|
-
| transform | string
|
|
9
|
+
| NAME | TYPE | REQUIRED | DESCRIPTION | DEFAULT VALUE |
|
|
10
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------- | ------------- |
|
|
11
|
+
| animation | `Animated.value`\* | No | Pass an `Animated.Value` to control transform animation. | - |
|
|
12
|
+
| composeRefs | oneOf([function, ref**]) | No | Pass a ref object or callback in this prop. | - |
|
|
13
|
+
| endValue | oneOf([number, string]) | No | Final value for the animation. | - |
|
|
14
|
+
| origin | oneOf([`"bottom"`, `"bottom_left"`, `"bottom_right"`, `"center"`, `"left"`, `"right"`, `top"`, `"top_left"`, `"top_right"`])\*\*\* | Yes | Origin for the transformation to be applied. | - |
|
|
15
|
+
| startValue | oneOf([number, string]) | Yes | Initial value for the transformation. | - |
|
|
16
|
+
| transform | string | Yes | Transformation to apply. | - |
|
|
17
17
|
|
|
18
18
|
1. \* [React Native's `Animated.Value`](https://facebook.github.io/react-native/docs/animatedvalue).
|
|
19
|
-
2. \*\* [ref object](https://reactjs.org/docs/react-api.html#reactcreateref).
|
|
20
|
-
|
|
19
|
+
2. \*\* [ref object](https://reactjs.org/docs/react-api.html#reactcreateref).
|
|
20
|
+
3. \*\*\* You can access these origins via the exposed `static` property: `TransformOrigins`.
|
|
21
21
|
|
|
22
22
|
It also accepts any `View` props as it's a view.
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ It also accepts any `View` props as it's a view.
|
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
import React, { Component } from 'react-native`
|
|
28
|
-
import {
|
|
28
|
+
import { UTLabel, TransformView } from '@widergy/mobile-ui`
|
|
29
29
|
|
|
30
30
|
class Example extends Component {
|
|
31
31
|
constructor(props) {
|
|
@@ -46,7 +46,7 @@ class Example extends Component {
|
|
|
46
46
|
endValue={1}
|
|
47
47
|
transform="rotateX"
|
|
48
48
|
>
|
|
49
|
-
<
|
|
49
|
+
<UTLabel>Test</UTLabel>
|
|
50
50
|
</TransformView>
|
|
51
51
|
);
|
|
52
52
|
}
|
|
@@ -6,9 +6,9 @@ This component manages transitions whenever the values inside the `compare` prop
|
|
|
6
6
|
|
|
7
7
|
### Props
|
|
8
8
|
|
|
9
|
-
| NAME
|
|
10
|
-
|
|
|
11
|
-
| compare
|
|
9
|
+
| NAME | TYPE | REQUIRED | DESCRIPTION | DEFAULT VALUE |
|
|
10
|
+
| ------- | ----------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
11
|
+
| compare | arrayOf(bool, number, string) | Yes | Array of comparable values\* that triggers a transition whenever a previous value is different from the current one. | - |
|
|
12
12
|
|
|
13
13
|
\* The array should never change in length, but, in case it does, it will not trigger any transitions until it changes again.
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ This component manages transitions whenever the values inside the `compare` prop
|
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
import React, { Component, Fragment } from 'react';
|
|
19
|
-
import { Button,
|
|
19
|
+
import { Button, UTLabel, TransitionView } from '@widergy/mobile-ui';
|
|
20
20
|
|
|
21
21
|
class Counter extends Component {
|
|
22
22
|
state = {
|
|
@@ -30,7 +30,7 @@ class Counter extends Component {
|
|
|
30
30
|
return (
|
|
31
31
|
<Fragment>
|
|
32
32
|
<TransitionView compare={[count]} visible>
|
|
33
|
-
<
|
|
33
|
+
<UTLabel>{count}</UTLabel>
|
|
34
34
|
</TransitionView>
|
|
35
35
|
<Button onPress={this.count} title="Add to count" />
|
|
36
36
|
</Fragment>
|
|
@@ -39,7 +39,6 @@ class Counter extends Component {
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
## TransitionView.TransitionViewComponent
|
|
44
43
|
|
|
45
44
|
A component designed to use for different transitions across the board. Whenever the `transition` prop is `true`, it will trigger an opacity transition for the `View`'s `children`.
|
|
@@ -47,7 +46,7 @@ A component designed to use for different transitions across the board. Whenever
|
|
|
47
46
|
### Props
|
|
48
47
|
|
|
49
48
|
| NAME | TYPE | REQUIRED | DESCRIPTION | DEFAULT VALUE |
|
|
50
|
-
|
|
|
49
|
+
| --------------- | ----------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------- | --------------------------- |
|
|
51
50
|
| delay | number | No | Delay for each transition animation. | `0` |
|
|
52
51
|
| duration | number | No | Duration for each transition animation. | `500` |
|
|
53
52
|
| easing | [EasingFunc](https://facebook.github.io/react-native/docs/easing) | No | Easing for each transition animation. | `Easing.inOut(Easing.ease)` |
|
|
@@ -57,12 +56,11 @@ A component designed to use for different transitions across the board. Whenever
|
|
|
57
56
|
| useNativeDriver | bool | No | Should the animation run on the native driver or in js?. | `false` |
|
|
58
57
|
| visible | bool | No | Is the component visible? | - |
|
|
59
58
|
|
|
60
|
-
|
|
61
59
|
#### Example
|
|
62
60
|
|
|
63
61
|
```js
|
|
64
62
|
import React, { Component } from 'react';
|
|
65
|
-
import {
|
|
63
|
+
import { UTLabel, TransitionView } from '@widergy/mobile-ui';
|
|
66
64
|
import { View } from 'react-native';
|
|
67
65
|
|
|
68
66
|
const { TransitionViewComponent } = TransitionView;
|
|
@@ -73,14 +71,18 @@ class Example extends Component {
|
|
|
73
71
|
transition: false
|
|
74
72
|
};
|
|
75
73
|
|
|
76
|
-
onTransitionEnd = () => this.setState(({ transition }) => ({ transition: false }))
|
|
74
|
+
onTransitionEnd = () => this.setState(({ transition }) => ({ transition: false }));
|
|
77
75
|
|
|
78
76
|
render() {
|
|
79
77
|
const { transition, visible } = this.state;
|
|
80
78
|
return (
|
|
81
79
|
<View>
|
|
82
|
-
<TransitionViewComponent
|
|
83
|
-
|
|
80
|
+
<TransitionViewComponent
|
|
81
|
+
transition={transition}
|
|
82
|
+
onTransitionEnd={this.onTransitionEnd}
|
|
83
|
+
visible={visible}
|
|
84
|
+
>
|
|
85
|
+
<UTLabel>Test</UTLabel>
|
|
84
86
|
</TransitionViewComponent>
|
|
85
87
|
</View>
|
|
86
88
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const ELEVATION =
|
|
1
|
+
export const ELEVATION = 1;
|
|
2
2
|
export const PRESSED_ELEVATION = 2;
|
|
3
3
|
|
|
4
4
|
export const VARIANTS_NAMES = {
|
|
@@ -27,3 +27,19 @@ export const COLORS_MAPPER = {
|
|
|
27
27
|
secondary: 'neutral',
|
|
28
28
|
success: 'success'
|
|
29
29
|
};
|
|
30
|
+
|
|
31
|
+
export const SHADOW_MAPPER = {
|
|
32
|
+
[COLORS_MAPPER.error]: 'error',
|
|
33
|
+
[COLORS_MAPPER.negative]: 'neutral',
|
|
34
|
+
[COLORS_MAPPER.primary]: 'accent',
|
|
35
|
+
[COLORS_MAPPER.secondary]: 'dark',
|
|
36
|
+
[COLORS_MAPPER.success]: 'success'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const PRESSED_SHADOW_MAPPER = {
|
|
40
|
+
[COLORS_MAPPER.error]: 'error',
|
|
41
|
+
[COLORS_MAPPER.negative]: 'dark',
|
|
42
|
+
[COLORS_MAPPER.primary]: 'accent',
|
|
43
|
+
[COLORS_MAPPER.secondary]: 'dark',
|
|
44
|
+
[COLORS_MAPPER.success]: 'success'
|
|
45
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { COLOR_THEMES } from '../../constants/Palette';
|
|
2
2
|
import { getShadow } from '../../utils/styleUtils';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
COLORS_MAPPER,
|
|
6
|
+
ELEVATION,
|
|
7
|
+
PRESSED_ELEVATION,
|
|
8
|
+
PRESSED_SHADOW_MAPPER,
|
|
9
|
+
SHADOW_MAPPER
|
|
10
|
+
} from './constants';
|
|
5
11
|
import { defaultProps } from './proptypes';
|
|
6
12
|
|
|
7
13
|
const baseButtonTheme = () => ({
|
|
@@ -40,8 +46,16 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
40
46
|
const actionTheme = theme.Palette[colorName];
|
|
41
47
|
const negativeTheme = theme.Palette[COLORS_MAPPER.negative];
|
|
42
48
|
const neutralTheme = theme.Palette[COLORS_MAPPER.secondary];
|
|
43
|
-
const shadow = getShadow({
|
|
44
|
-
|
|
49
|
+
const shadow = getShadow({
|
|
50
|
+
color: theme.Palette[SHADOW_MAPPER[colorName]]['04'],
|
|
51
|
+
level: ELEVATION,
|
|
52
|
+
theme
|
|
53
|
+
});
|
|
54
|
+
const pressedShadow = getShadow({
|
|
55
|
+
color: theme.Palette[PRESSED_SHADOW_MAPPER[colorName]]['04'],
|
|
56
|
+
level: PRESSED_ELEVATION,
|
|
57
|
+
theme
|
|
58
|
+
});
|
|
45
59
|
|
|
46
60
|
const definition = {
|
|
47
61
|
filled: {
|
|
@@ -51,6 +65,7 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
51
65
|
borderWidth: 1,
|
|
52
66
|
fill: colorTheme === COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05'],
|
|
53
67
|
pressed: {
|
|
68
|
+
...pressedShadow,
|
|
54
69
|
backgroundColor: actionTheme['05']
|
|
55
70
|
}
|
|
56
71
|
},
|
|
@@ -43,12 +43,12 @@ const UTDetailDrawerExample = () => {
|
|
|
43
43
|
return (
|
|
44
44
|
<Layout>
|
|
45
45
|
<View>
|
|
46
|
-
<
|
|
46
|
+
<UTLabel big>This is a drawer example</UTLabel>
|
|
47
47
|
<Button title="Open default" onPress={() => openDrawer('default')} />
|
|
48
48
|
</View>
|
|
49
49
|
<UTDetailDrawer onClose={closeDrawer} visible={open === 'default'}>
|
|
50
50
|
<View>
|
|
51
|
-
<
|
|
51
|
+
<UTLabel>This is the default</UTLabel>
|
|
52
52
|
</View>
|
|
53
53
|
</UTDetailDrawer>
|
|
54
54
|
</Layout>
|
|
@@ -4,7 +4,7 @@ import { SafeAreaView, View, ScrollView } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import Label from '../Label';
|
|
6
6
|
import { withTheme } from '../../theming';
|
|
7
|
-
import
|
|
7
|
+
import UTButton from '../UTButton';
|
|
8
8
|
|
|
9
9
|
import propTypes, { UTDetailDrawerDefaultProps } from './propTypes';
|
|
10
10
|
import mergeStyles from './styles';
|
|
@@ -63,11 +63,21 @@ const UTDetailDrawer = ({
|
|
|
63
63
|
</Label>
|
|
64
64
|
)}
|
|
65
65
|
{iconButton && (
|
|
66
|
-
<
|
|
66
|
+
<UTButton
|
|
67
67
|
onPress={onClose}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
68
|
+
Icon="IconX"
|
|
69
|
+
variant={CloseButtonProps.variant || 'text'}
|
|
70
|
+
colorTheme={CloseButtonProps.colorTheme || null}
|
|
71
|
+
style={{
|
|
72
|
+
root: {
|
|
73
|
+
...mergedStyles.closeButton,
|
|
74
|
+
...(CloseButtonProps.root ? CloseButtonProps.root : null)
|
|
75
|
+
},
|
|
76
|
+
icon: {
|
|
77
|
+
...mergedStyles.icon,
|
|
78
|
+
...(CloseButtonProps.icon ? CloseButtonProps.icon : null)
|
|
79
|
+
}
|
|
80
|
+
}}
|
|
71
81
|
/>
|
|
72
82
|
)}
|
|
73
83
|
</View>
|
|
@@ -29,9 +29,20 @@ const styles = (propStyles = {}, propWidth) =>
|
|
|
29
29
|
...(propStyles.contentContainer || {})
|
|
30
30
|
},
|
|
31
31
|
closeButton: {
|
|
32
|
+
maxWidth: 40,
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
JustifySelf: 'flex-end',
|
|
36
|
+
borderRadius: 32,
|
|
32
37
|
marginLeft: 'auto',
|
|
33
38
|
...(propStyles.closeButton || {})
|
|
34
39
|
},
|
|
40
|
+
icon: {
|
|
41
|
+
maxWidth: 20,
|
|
42
|
+
maxHeight: 20,
|
|
43
|
+
marginHorizontal: 0,
|
|
44
|
+
...(propStyles.closeButton || {})
|
|
45
|
+
},
|
|
35
46
|
container: {
|
|
36
47
|
flex: 1,
|
|
37
48
|
...(propStyles.container || {})
|
|
@@ -42,6 +53,7 @@ const styles = (propStyles = {}, propWidth) =>
|
|
|
42
53
|
},
|
|
43
54
|
headerContainer: {
|
|
44
55
|
flexDirection: 'row',
|
|
56
|
+
justifyContent: 'space-between',
|
|
45
57
|
borderTopLeftRadius: 40,
|
|
46
58
|
padding: 10,
|
|
47
59
|
...(propStyles.headerContainer || {})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11z"/></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke="currentColor" d="M4 4h3l2-2h6l2 2h3a2 2 0 0 1 2
|
|
3
|
+
2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m8 3a5 5 0 0 0-5 5a5 5 0 0 0 5 5a5 5 0 0 0 5-5a5 5 0 0 0-5-5m0 2a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0
|
|
4
|
+
1-3-3a3 3 0 0 1 3-3" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M20 12a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1 8-8c.76 0 1.5.11 2.2.31l1.57-1.57A9.8 9.8 0 0 0 12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10M7.91 10.08L6.5 11.5L11 16L21 6l-1.41-1.42L11 13.17z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6z"/></svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke="currentColor" d="M21 6h-5V4.33A2.42 2.42 0 0 0 13.5 2h-3A2.42 2.42 0 0 0 8 4.33V6H3a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2zM10
|
|
3
|
+
4.33c0-.16.21-.33.5-.33h3c.29 0 .5.17.5.33V6h-4zM18 19a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8h12z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke="currentColor" d="M21 6h-5V4.33A2.42 2.42 0 0 0 13.5 2h-3A2.42 2.42 0 0 0 8 4.33V6H3a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2zM10
|
|
3
|
+
4.33c0-.16.21-.33.5-.33h3c.29 0 .5.17.5.33V6h-4zM18 19a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8h12z"/>
|
|
4
|
+
<path stroke="currentColor" d="M9 17a1 1 0 0 0 1-1v-4a1 1 0 0 0-2 0v4a1 1 0 0 0
|
|
5
|
+
1 1z"/>
|
|
6
|
+
<path stroke="currentColor" d="M15 17a1 1 0 0 0 1-1v-4a1 1 0 0 0-2 0v4a1 1 0 0 0 1 1z"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z"/></svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke="currentColor" d="M19.4 7.34L16.66 4.6A2 2 0 0 0 14 4.53l-9 9a2 2 0 0 0-.57 1.21L4 18.91a1 1 0 0 0 .29.8A1 1 0 0 0 5 20h.09l4.17-.38a2 2 0 0 0
|
|
3
|
+
1.21-.57l9-9a1.92 1.92 0 0 0-.07-2.71zM9.08 17.62l-3 .28.27-3L12 9.32l2.7 2.7zM16 10.68L13.32 8l1.95-2L18 8.73z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m-8.95 5H1v-2h2.05C3.5 6.83 6.83 3.5 11 3.05V1h2v2.05c4.17.45 7.5 3.78 7.95 7.95H23v2h-2.05c-.45 4.17-3.78 7.5-7.95 7.95V23h-2v-2.05C6.83 20.5 3.5 17.17 3.05 13M12 5a7 7 0 0 0-7 7a7 7 0 0 0 7 7a7 7 0 0 0 7-7a7 7 0 0 0-7-7"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97s-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1s.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path stroke="currentColor" d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 0 0 3-3a3 3 0 0 0-3-3a3 3 0 0 0-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9a3 3 0 0 0-3 3a3 3 0 0 0 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.15c-.05.21-.08.43-.08.66c0 1.61 1.31 2.91 2.92 2.91s2.92-1.3 2.92-2.91A2.92 2.92 0 0 0 18 16.08"/></svg>
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { COLOR_SHADES, COLOR_THEMES } from '../../constants/Palette';
|
|
2
2
|
|
|
3
|
+
import EnergyIconArrowBack from './components/EnergyIcons/EnergyIconArrowBack.svg';
|
|
4
|
+
import EnergyIconCamera from './components/EnergyIcons/EnergyIconCamera.svg';
|
|
3
5
|
import EnergyIconCar from './components/EnergyIcons/EnergyIconCar.svg';
|
|
4
6
|
import EnergyIconCart from './components/EnergyIcons/EnergyIconCart.svg';
|
|
5
7
|
import EnergyIconChartPie from './components/EnergyIcons/EnergyIconChartPie.svg';
|
|
8
|
+
import EnergyIconCheckCircle from './components/EnergyIcons/EnergyIconCheckCircle.svg';
|
|
9
|
+
import EnergyIconDelete from './components/EnergyIcons/EnergyIconDelete.svg';
|
|
10
|
+
import EnergyIconDeleteOutline from './components/EnergyIcons/EnergyIconDeleteOutline.svg';
|
|
11
|
+
import EnergyIconDeleteVariant from './components/EnergyIcons/EnergyIconDeleteVariant.svg';
|
|
12
|
+
import EnergyIconEdit from './components/EnergyIcons/EnergyIconEdit.svg';
|
|
13
|
+
import EnergyIconEditVariant from './components/EnergyIcons/EnergyIconEditVariant.svg';
|
|
6
14
|
import EnergyIconGraphicCircle from './components/EnergyIcons/EnergyIconGraphicCircle.svg';
|
|
7
15
|
import EnergyIconHome from './components/EnergyIcons/EnergyIconHome.svg';
|
|
8
16
|
import EnergyIconHome2 from './components/EnergyIcons/EnergyIconHome2.svg';
|
|
9
17
|
import EnergyIconHome3 from './components/EnergyIcons/EnergyIconHome3.svg';
|
|
18
|
+
import EnergyIconMoreVertical from './components/EnergyIcons/EnergyIconMoreVertical.svg';
|
|
19
|
+
import EnergyIconMyLocation from './components/EnergyIcons/EnergyIconMyLocation.svg';
|
|
20
|
+
import EnergyIconSettings from './components/EnergyIcons/EnergyIconSettings.svg';
|
|
21
|
+
import EnergyIconShare from './components/EnergyIcons/EnergyIconShare.svg';
|
|
10
22
|
import EnergyIconTruck from './components/EnergyIcons/EnergyIconTruck.svg';
|
|
11
23
|
import BrandIconAmex from './components/EnergyIcons/BrandIconAmex.svg';
|
|
12
24
|
import BrandIconBancoEstado from './components/EnergyIcons/BrandIconBancoEstado.svg';
|
|
@@ -29,13 +41,25 @@ export const DEFAULT_PROPS = {
|
|
|
29
41
|
export const DEFAULT_INTERNAL_SHADE = COLOR_SHADES.shade02;
|
|
30
42
|
|
|
31
43
|
export const ENERGY_ICONS = {
|
|
44
|
+
EnergyIconArrowBack,
|
|
45
|
+
EnergyIconCamera,
|
|
32
46
|
EnergyIconCar,
|
|
33
47
|
EnergyIconCart,
|
|
34
48
|
EnergyIconChartPie,
|
|
49
|
+
EnergyIconCheckCircle,
|
|
50
|
+
EnergyIconDelete,
|
|
51
|
+
EnergyIconDeleteOutline,
|
|
52
|
+
EnergyIconDeleteVariant,
|
|
53
|
+
EnergyIconEdit,
|
|
54
|
+
EnergyIconEditVariant,
|
|
35
55
|
EnergyIconGraphicCircle,
|
|
36
56
|
EnergyIconHome,
|
|
37
57
|
EnergyIconHome2,
|
|
38
58
|
EnergyIconHome3,
|
|
59
|
+
EnergyIconMoreVertical,
|
|
60
|
+
EnergyIconMyLocation,
|
|
61
|
+
EnergyIconSettings,
|
|
62
|
+
EnergyIconShare,
|
|
39
63
|
EnergyIconTruck,
|
|
40
64
|
BrandIconAmex,
|
|
41
65
|
BrandIconBancoEstado,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { number, object, string } from 'prop-types';
|
|
2
|
+
import { number, object, oneOfType, string } from 'prop-types';
|
|
3
3
|
import * as TablerIcons from '@tabler/icons-react-native';
|
|
4
4
|
|
|
5
5
|
import { useTheme } from '../../theming';
|
|
@@ -38,7 +38,7 @@ UTIcon.propTypes = {
|
|
|
38
38
|
fillTheme: string,
|
|
39
39
|
name: string,
|
|
40
40
|
shade: string,
|
|
41
|
-
size: number,
|
|
41
|
+
size: oneOfType([number, string]),
|
|
42
42
|
style: object
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
|
|
9
|
-
| Name
|
|
10
|
-
|
|
|
11
|
-
| colorTheme
|
|
12
|
-
| field
|
|
13
|
-
|
|
|
14
|
-
| numberOfLines
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| -------------- | ------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| colorTheme | string | 'dark' | Color theme to style the `UTLabel`. It must be defined in the project theme. [Example](#colortheme). |
|
|
12
|
+
| field | any | {} | Field configuration for advanced customization. |
|
|
13
|
+
| markdownStyles | object | {} | Custom styles for rendering markdown content. This allows overriding default markdown styles like lists, links, etc. |
|
|
14
|
+
| numberOfLines | number | | Limits the number of lines displayed in the label. When set, `ellipsizeMode` is automatically set to 'tail'. |
|
|
15
|
+
| onLinkPress | func | | Callback function to handle link presses in markdown content. It is only used when `withMarkdown` is true. |
|
|
16
|
+
| onTextLayout | func | | Callback function that is triggered when the text layout changes. Useful for getting information about the text rendering (like the number of lines). |
|
|
17
|
+
| shade | string | | The color theme shade. |
|
|
18
|
+
| style | object | {} | Additional style. |
|
|
19
|
+
| variant | string | 'body' | Defines the font size and component to use. For a list of available variants, check [here](#variants). Font sizes can be overwritten (⚠️ for the entire project) through the project's theme. |
|
|
20
|
+
| weight | string | 'regular' | Defines the font weight to be used. For a list of available options, check [here](#weights). |
|
|
21
|
+
| withMarkdown | bool | false | Indicates whether or not to render text inside as markdown. |
|
|
20
22
|
|
|
21
23
|
## Color Themes
|
|
22
24
|
|