@widergy/mobile-ui 1.14.2 → 1.14.4
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/UTAutocomplete/index.js +11 -8
- package/lib/components/UTHeader/index.js +29 -20
- package/lib/components/UTMenu/assets/google_on_white.png +0 -0
- package/lib/components/UTMenu/constants.js +1 -0
- package/lib/components/UTMenu/index.js +42 -22
- package/lib/components/UTMenu/styles.js +13 -7
- package/lib/components/UTModal/styles.js +6 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.14.4](https://github.com/widergy/mobile-ui/compare/v1.14.3...v1.14.4) (2024-07-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* utlabel in header and utmodal visual fixes ([#318](https://github.com/widergy/mobile-ui/issues/318)) ([38c70a9](https://github.com/widergy/mobile-ui/commit/38c70a955814d49ae7ef2e303d4cf351ca3be1fe))
|
|
7
|
+
|
|
8
|
+
## [1.14.3](https://github.com/widergy/mobile-ui/compare/v1.14.2...v1.14.3) (2024-07-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* utmenu google attribution ([#320](https://github.com/widergy/mobile-ui/issues/320)) ([ea104e7](https://github.com/widergy/mobile-ui/commit/ea104e7237006a5e3c7d2c2345c48e18d35bcd4e))
|
|
14
|
+
|
|
1
15
|
## [1.14.2](https://github.com/widergy/mobile-ui/compare/v1.14.1...v1.14.2) (2024-07-22)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -23,6 +23,7 @@ const UTAutocomplete = ({
|
|
|
23
23
|
options,
|
|
24
24
|
persistSelectedOption = false,
|
|
25
25
|
variant,
|
|
26
|
+
withGoogleAttribution,
|
|
26
27
|
styles: propStyles
|
|
27
28
|
}) => {
|
|
28
29
|
const [selectedOption, setSelectedOption] = useState();
|
|
@@ -55,8 +56,9 @@ const UTAutocomplete = ({
|
|
|
55
56
|
onQueryChange={input.onQueryChange}
|
|
56
57
|
options={options}
|
|
57
58
|
selectedOption={selectedOption?.id}
|
|
58
|
-
withAutocomplete
|
|
59
59
|
styles={propStyles?.UTMenu}
|
|
60
|
+
withAutocomplete
|
|
61
|
+
withGoogleAttribution={withGoogleAttribution}
|
|
60
62
|
>
|
|
61
63
|
<UTTextInput
|
|
62
64
|
disabled={disabled}
|
|
@@ -64,7 +66,7 @@ const UTAutocomplete = ({
|
|
|
64
66
|
label={label}
|
|
65
67
|
labelBackgroundColor={labelBackgroundColor}
|
|
66
68
|
onChange={() => {}}
|
|
67
|
-
RightIcon={{
|
|
69
|
+
RightIcon={{ name: 'caret-down', type: 'font-awesome' }}
|
|
68
70
|
value={selectedOption?.label || ''}
|
|
69
71
|
variant={variant}
|
|
70
72
|
/>
|
|
@@ -74,16 +76,16 @@ const UTAutocomplete = ({
|
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
UTAutocomplete.propTypes = {
|
|
77
|
-
avoidOverlappingAnchor: bool,
|
|
78
79
|
autoCompletePlaceholder: string,
|
|
80
|
+
avoidOverlappingAnchor: bool,
|
|
79
81
|
disabled: bool,
|
|
80
82
|
error: oneOf([bool, string]),
|
|
81
83
|
filterOptions: bool,
|
|
82
84
|
input: shape({
|
|
85
|
+
onBlur: func,
|
|
83
86
|
onChange: func.isRequired,
|
|
84
|
-
value: string.isRequired,
|
|
85
87
|
onFocus: func,
|
|
86
|
-
|
|
88
|
+
value: string.isRequired
|
|
87
89
|
}),
|
|
88
90
|
label: string,
|
|
89
91
|
labelBackgroundColor: string,
|
|
@@ -91,14 +93,15 @@ UTAutocomplete.propTypes = {
|
|
|
91
93
|
MenuOptionComponent: element,
|
|
92
94
|
options: arrayOf(
|
|
93
95
|
shape({
|
|
94
|
-
value: string,
|
|
95
96
|
id: string,
|
|
96
|
-
label: string
|
|
97
|
+
label: string,
|
|
98
|
+
value: string
|
|
97
99
|
})
|
|
98
100
|
),
|
|
99
101
|
persistSelectedOption: bool,
|
|
102
|
+
styles: ViewPropTypes.style,
|
|
100
103
|
variant: string,
|
|
101
|
-
|
|
104
|
+
withGoogleAttribution: bool
|
|
102
105
|
};
|
|
103
106
|
|
|
104
107
|
export default UTAutocomplete;
|
|
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { string, bool, shape } from 'prop-types';
|
|
4
4
|
import merge from 'lodash/merge';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import UTLabel from '../UTLabel';
|
|
7
7
|
import UTBanner from '../UTBanner';
|
|
8
8
|
import { useTheme } from '../../theming';
|
|
9
9
|
|
|
@@ -18,54 +18,63 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
18
18
|
|
|
19
19
|
const Tagline = renderComponent(
|
|
20
20
|
tagline,
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
<UTLabel
|
|
22
|
+
variant="small"
|
|
23
|
+
weight="medium"
|
|
24
|
+
colorTheme={themedStyles.taglineColor || 'gray'}
|
|
25
|
+
withMarkdown={useMarkdown}
|
|
25
26
|
style={[themedStyles.child, themedStyles.tagline]}
|
|
26
27
|
>
|
|
27
28
|
{tagline?.toUpperCase?.()}
|
|
28
|
-
</
|
|
29
|
+
</UTLabel>
|
|
29
30
|
);
|
|
30
31
|
|
|
31
32
|
const Title = renderComponent(
|
|
32
33
|
title,
|
|
33
|
-
<
|
|
34
|
+
<UTLabel
|
|
35
|
+
variant="title3"
|
|
36
|
+
weight="medium"
|
|
37
|
+
colorTheme={themedStyles.titleColor}
|
|
38
|
+
style={themedStyles.title}
|
|
39
|
+
withMarkdown={useMarkdown}
|
|
40
|
+
>
|
|
34
41
|
{title}
|
|
35
|
-
</
|
|
42
|
+
</UTLabel>
|
|
36
43
|
);
|
|
37
44
|
|
|
38
45
|
const Subtitle = renderComponent(
|
|
39
46
|
subtitle,
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
<UTLabel
|
|
48
|
+
colorTheme={themedStyles.subtitleColor || 'gray'}
|
|
49
|
+
withMarkdown={useMarkdown}
|
|
43
50
|
style={[themedStyles.child, themedStyles.subtitle]}
|
|
44
51
|
>
|
|
45
52
|
{subtitle}
|
|
46
|
-
</
|
|
53
|
+
</UTLabel>
|
|
47
54
|
);
|
|
48
55
|
|
|
49
56
|
const RequiredFieldInfo = renderComponent(
|
|
50
57
|
requiredFieldInfo,
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
<UTLabel
|
|
59
|
+
variant="small"
|
|
60
|
+
colorTheme={themedStyles.requiredFieldInfoColor || 'gray'}
|
|
61
|
+
withMarkdown={useMarkdown}
|
|
54
62
|
style={[themedStyles.child, themedStyles.requiredFieldInfo]}
|
|
55
63
|
>
|
|
56
64
|
{requiredFieldInfo}
|
|
57
|
-
</
|
|
65
|
+
</UTLabel>
|
|
58
66
|
);
|
|
59
67
|
|
|
60
68
|
const HelpText = renderComponent(
|
|
61
69
|
helpText,
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
<UTLabel
|
|
71
|
+
variant="small"
|
|
72
|
+
colorTheme={themedStyles.helpTextColor || theme.colors.disabled}
|
|
73
|
+
withMarkdown={useMarkdown}
|
|
65
74
|
style={[themedStyles.child, themedStyles.helpText]}
|
|
66
75
|
>
|
|
67
76
|
{helpText}
|
|
68
|
-
</
|
|
77
|
+
</UTLabel>
|
|
69
78
|
);
|
|
70
79
|
|
|
71
80
|
return (
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ATTRIBUTION = 'proporcionado por';
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import React, { Fragment, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Dimensions,
|
|
4
|
+
Keyboard,
|
|
5
|
+
KeyboardAvoidingView,
|
|
6
|
+
Modal,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
Image
|
|
10
|
+
} from 'react-native';
|
|
3
11
|
|
|
4
12
|
import useKeyboardHeight from '../../hooks/useKeyboardHeight';
|
|
5
13
|
import UTTextInput from '../UTTextInput';
|
|
14
|
+
import UTLabel from '../UTLabel';
|
|
6
15
|
import Surface from '../Surface';
|
|
7
16
|
|
|
8
17
|
import MenuOption from './components/MenuOption';
|
|
9
18
|
import ListView from './components/ListView';
|
|
10
19
|
import MenuTypes from './proptypes';
|
|
11
20
|
import styles from './styles';
|
|
21
|
+
import GoogleLogo from './assets/google_on_white.png';
|
|
22
|
+
import { ATTRIBUTION } from './constants';
|
|
12
23
|
|
|
13
24
|
const UTMenu = ({
|
|
14
25
|
autoCompletePlaceholder,
|
|
@@ -32,14 +43,15 @@ const UTMenu = ({
|
|
|
32
43
|
styles: propStyles,
|
|
33
44
|
verticalOffset = 0,
|
|
34
45
|
withAutocomplete,
|
|
35
|
-
withoutOpacity
|
|
46
|
+
withoutOpacity,
|
|
47
|
+
withGoogleAttribution = false
|
|
36
48
|
}) => {
|
|
37
49
|
const [isOpen, setIsOpen] = useState(false);
|
|
38
50
|
const anchorRef = useRef(null);
|
|
39
51
|
const menuRef = useRef(null);
|
|
40
|
-
const [position, setPosition] = useState({
|
|
41
|
-
const [anchorMeasure, setAnchorMeasure] = useState({
|
|
42
|
-
const [menuDimentions, setMenuDimentions] = useState({
|
|
52
|
+
const [position, setPosition] = useState({ right: 0, top: 0 });
|
|
53
|
+
const [anchorMeasure, setAnchorMeasure] = useState({ height: 0, width: 0, x: 0, y: 0 });
|
|
54
|
+
const [menuDimentions, setMenuDimentions] = useState({ height: 0, width: 0 });
|
|
43
55
|
const [query, setQuery] = useState('');
|
|
44
56
|
const searchTextInputRef = useRef();
|
|
45
57
|
const filteredOptions = useMemo(() => {
|
|
@@ -55,13 +67,13 @@ const UTMenu = ({
|
|
|
55
67
|
|
|
56
68
|
const handleAnchorLayout = () => {
|
|
57
69
|
anchorRef.current.measureInWindow((x, y, width, height) => {
|
|
58
|
-
setAnchorMeasure({
|
|
70
|
+
setAnchorMeasure({ height, width, x, y });
|
|
59
71
|
});
|
|
60
72
|
};
|
|
61
73
|
|
|
62
74
|
const handleMenuLayout = () =>
|
|
63
75
|
menuRef.current?.measureInWindow((x, y, width, height) => {
|
|
64
|
-
setMenuDimentions({
|
|
76
|
+
setMenuDimentions({ height, width });
|
|
65
77
|
});
|
|
66
78
|
|
|
67
79
|
useLayoutEffect(() => {
|
|
@@ -84,7 +96,7 @@ const UTMenu = ({
|
|
|
84
96
|
left = x - menuWidth + width - horizontalOffset;
|
|
85
97
|
}
|
|
86
98
|
|
|
87
|
-
setPosition({
|
|
99
|
+
setPosition({ left, top });
|
|
88
100
|
}, [
|
|
89
101
|
anchorMeasure,
|
|
90
102
|
avoidOverlappingAnchor,
|
|
@@ -123,60 +135,68 @@ const UTMenu = ({
|
|
|
123
135
|
return (
|
|
124
136
|
<Fragment>
|
|
125
137
|
<TouchableOpacity
|
|
138
|
+
activeOpacity={withoutOpacity && 1}
|
|
126
139
|
disabled={disabled}
|
|
127
140
|
onPress={isOpen ? closeMenu : openMenu}
|
|
128
|
-
activeOpacity={withoutOpacity && 1}
|
|
129
141
|
>
|
|
130
|
-
<View
|
|
142
|
+
<View onLayout={handleAnchorLayout} pointerEvents="box-only" ref={anchorRef}>
|
|
131
143
|
{children}
|
|
132
144
|
</View>
|
|
133
145
|
</TouchableOpacity>
|
|
134
146
|
<Modal
|
|
135
147
|
animationType="fade"
|
|
136
|
-
transparent
|
|
137
|
-
visible={isOpen}
|
|
138
148
|
onRequestClose={closeMenu}
|
|
139
149
|
onShow={focusSearchInput}
|
|
150
|
+
transparent
|
|
151
|
+
visible={isOpen}
|
|
140
152
|
>
|
|
141
153
|
<TouchableOpacity onPress={closeMenu} style={styles.overlayTouchable}>
|
|
142
154
|
<View style={styles.overlay} />
|
|
143
155
|
</TouchableOpacity>
|
|
144
156
|
<Surface
|
|
145
|
-
style={[styles.menu, position, fullWidth && { width: anchorMeasure?.width }, propStyles?.menu]}
|
|
146
|
-
ref={menuRef}
|
|
147
157
|
onLayout={handleMenuLayout}
|
|
158
|
+
ref={menuRef}
|
|
159
|
+
style={[styles.menu, position, fullWidth && { width: anchorMeasure?.width }, propStyles?.menu]}
|
|
148
160
|
>
|
|
149
161
|
<KeyboardAvoidingView behavior="height">
|
|
150
162
|
{withAutocomplete && (
|
|
151
163
|
<View style={[styles.searchContainer, propStyles?.searchContainer]}>
|
|
152
164
|
<UTTextInput
|
|
153
165
|
InputRef={searchTextInputRef}
|
|
154
|
-
value={query}
|
|
155
166
|
onChange={handleQueryChange}
|
|
156
|
-
placeholder={autoCompletePlaceholder}
|
|
157
167
|
onSubmitEditing={
|
|
158
168
|
query && filteredOptions[0]
|
|
159
169
|
? () => handleOptionPress(() => onPress(filteredOptions[0]))
|
|
160
170
|
: closeMenu
|
|
161
171
|
}
|
|
172
|
+
placeholder={autoCompletePlaceholder}
|
|
173
|
+
value={query}
|
|
162
174
|
/>
|
|
163
175
|
</View>
|
|
164
176
|
)}
|
|
165
177
|
<ListView
|
|
166
|
-
maxHeight={maxHeight}
|
|
167
|
-
windowHeight={windowHeight}
|
|
168
|
-
usableWindowHeight={usableWindowHeight}
|
|
169
178
|
filteredOptions={filteredOptions}
|
|
179
|
+
handleOptionPress={handleOptionPress}
|
|
180
|
+
isMultiple={isMultiple}
|
|
170
181
|
ItemSeparatorComponent={ItemSeparatorComponent}
|
|
171
182
|
ListEmptyComponent={ListEmptyComponent}
|
|
183
|
+
maxHeight={maxHeight}
|
|
172
184
|
MenuOptionComponent={MenuOptionComponent}
|
|
173
|
-
handleOptionPress={handleOptionPress}
|
|
174
185
|
onPress={onPress}
|
|
175
186
|
propStyles={propStyles}
|
|
176
|
-
selectedOption={selectedOption}
|
|
177
187
|
query={query}
|
|
178
|
-
|
|
188
|
+
selectedOption={selectedOption}
|
|
189
|
+
usableWindowHeight={usableWindowHeight}
|
|
190
|
+
windowHeight={windowHeight}
|
|
179
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
|
+
)}
|
|
180
200
|
</KeyboardAvoidingView>
|
|
181
201
|
</Surface>
|
|
182
202
|
</Modal>
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export default StyleSheet.create({
|
|
4
|
+
attribution: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
gap: 4,
|
|
7
|
+
justifyContent: 'flex-end',
|
|
8
|
+
paddingVertical: 8
|
|
9
|
+
},
|
|
4
10
|
menu: {
|
|
5
|
-
position: 'absolute',
|
|
6
|
-
zIndex: 1000,
|
|
7
|
-
left: 0,
|
|
8
11
|
backgroundColor: 'white',
|
|
9
12
|
borderRadius: 8,
|
|
10
|
-
|
|
13
|
+
left: 0,
|
|
14
|
+
paddingVertical: 4,
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
zIndex: 1000
|
|
11
17
|
},
|
|
12
18
|
overlay: {
|
|
13
|
-
|
|
14
|
-
top: 0,
|
|
19
|
+
backgroundColor: 'transparent',
|
|
15
20
|
bottom: 0,
|
|
16
21
|
left: 0,
|
|
22
|
+
position: 'absolute',
|
|
17
23
|
right: 0,
|
|
18
|
-
|
|
24
|
+
top: 0
|
|
19
25
|
},
|
|
20
26
|
overlayTouchable: {
|
|
21
27
|
flex: 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { verticalScale, moderateHorizontalScale,
|
|
3
|
+
import { verticalScale, moderateHorizontalScale, WINDOW_HEIGHT } from '../../utils/scaleUtils';
|
|
4
4
|
import { DEFAULT_ICON_SIZE } from '../Icon/constants';
|
|
5
5
|
import { ICON_MARGIN } from '../IconButton/styles';
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ export default StyleSheet.create({
|
|
|
9
9
|
flexDirection: 'row',
|
|
10
10
|
alignItems: 'center',
|
|
11
11
|
marginVertical: verticalScale(4),
|
|
12
|
-
width: '
|
|
12
|
+
width: '100%'
|
|
13
13
|
},
|
|
14
14
|
modalBackground: {
|
|
15
15
|
backgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
16
16
|
flex: 1,
|
|
17
17
|
justifyContent: 'center',
|
|
18
|
-
padding:
|
|
18
|
+
padding: 16
|
|
19
19
|
},
|
|
20
20
|
childView: {
|
|
21
21
|
flex: 1
|
|
@@ -25,14 +25,13 @@ export default StyleSheet.create({
|
|
|
25
25
|
borderRadius: 15,
|
|
26
26
|
alignItems: 'stretch',
|
|
27
27
|
alignSelf: 'center',
|
|
28
|
-
width:
|
|
28
|
+
width: '100%'
|
|
29
29
|
},
|
|
30
30
|
buttonsContainer: {
|
|
31
31
|
flexDirection: 'row',
|
|
32
32
|
justifyContent: 'flex-end',
|
|
33
33
|
alignItems: 'center',
|
|
34
|
-
|
|
35
|
-
paddingHorizontal: 15
|
|
34
|
+
padding: 16
|
|
36
35
|
},
|
|
37
36
|
viewContainer: {
|
|
38
37
|
flex: 1
|
|
@@ -55,7 +54,7 @@ export default StyleSheet.create({
|
|
|
55
54
|
margin: 0
|
|
56
55
|
},
|
|
57
56
|
content: {
|
|
58
|
-
padding:
|
|
57
|
+
padding: 16,
|
|
59
58
|
paddingBottom: 5
|
|
60
59
|
},
|
|
61
60
|
closeIcon: {
|
package/package.json
CHANGED