@widergy/mobile-ui 1.33.3 → 1.34.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
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.34.0](https://github.com/widergy/mobile-ui/compare/v1.33.4...v1.34.0) (2025-01-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [EVENSA-66] selectable card children ([#408](https://github.com/widergy/mobile-ui/issues/408)) ([427cf76](https://github.com/widergy/mobile-ui/commit/427cf761a98979cfcdf11528ad15d89717004394))
|
|
7
|
+
|
|
8
|
+
## [1.33.4](https://github.com/widergy/mobile-ui/compare/v1.33.3...v1.33.4) (2025-01-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [UGC-1141] ios bottomsheet height ([#407](https://github.com/widergy/mobile-ui/issues/407)) ([f0f78a3](https://github.com/widergy/mobile-ui/commit/f0f78a3425b64ca75d32c061d1653a03e881926b))
|
|
14
|
+
|
|
1
15
|
## [1.33.3](https://github.com/widergy/mobile-ui/compare/v1.33.2...v1.33.3) (2025-01-16)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -8,26 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
| Name | Type | Default | Description |
|
|
10
10
|
| ------------------------- | -------- | ----------- | --------------------------------------------------------------------------- |
|
|
11
|
-
| `
|
|
11
|
+
| `actionAlignment` | `string` | | Aligns the actions. |
|
|
12
|
+
| `adjustableHeight` | `bool` | `false` | If true the height of the component adjusts to the content. |
|
|
12
13
|
| `buttonText` | `string` | | Text for the button that appears in the top right corner of the header. |
|
|
13
14
|
| `description` | `string` | | Description that appears below the title in the header. |
|
|
14
15
|
| `onClose` | `func` | | Function called when the bottom sheet is closed. |
|
|
15
|
-
| `required` | `bool` | | Indicates if the field is required, showing an asterisk in the title. |
|
|
16
|
-
| `title` | `string` | | Title that appears in the bottom sheet header. |
|
|
17
|
-
| `titleProps` | `object` | | Props for the title label |
|
|
18
|
-
| `visible` | `bool` | | Controls the visibility of the bottom sheet. |
|
|
19
|
-
| `scrolleable` | `bool` | `false` | Determines if the content inside the bottom sheet should be scrollable. |
|
|
20
|
-
| `actionAlignment` | `string` | | Aligns the actions. |
|
|
21
16
|
| `onCloseProps` | `object` | | Additional props passed to the `onClose` function (optional). |
|
|
22
17
|
| `primaryAction` | `func` | | Callback for the primary action button. |
|
|
23
18
|
| `primaryActionProps` | `object` | | Props for the primary action button. |
|
|
24
19
|
| `primaryActionText` | `string` | | Text for the primary action button. |
|
|
20
|
+
| `required` | `bool` | | Indicates if the field is required, showing an asterisk in the title. |
|
|
21
|
+
| `scrolleable` | `bool` | `false` | Determines if the content inside the bottom sheet should be scrollable. |
|
|
25
22
|
| `secondaryAction` | `func` | | Callback for the secondary action button. |
|
|
26
23
|
| `secondaryActionProps` | `object` | | Props for the secondary action button. |
|
|
27
24
|
| `secondaryActionText` | `string` | | Text for the secondary action button. |
|
|
28
25
|
| `tertiaryAction` | `func` | | Callback for the tertiary action button. |
|
|
29
26
|
| `tertiaryActionProps` | `object` | | Props for the tertiary action button . |
|
|
30
27
|
| `tertiaryActionText` | `string` | | Text for the tertiary action button. |
|
|
28
|
+
| `title` | `string` | | Title that appears in the bottom sheet header. |
|
|
29
|
+
| `titleProps` | `object` | | Props for the title label |
|
|
30
|
+
| `visible` | `bool` | | Controls the visibility of the bottom sheet. |
|
|
31
|
+
| `withBodyPadding` | `bool` | `true` | Controls the visibility of the bottom sheet. |
|
|
31
32
|
|
|
32
33
|
### actionAlignment
|
|
33
34
|
|
|
@@ -7,6 +7,7 @@ import { useTheme } from '../../theming';
|
|
|
7
7
|
import UTButton from '../UTButton';
|
|
8
8
|
import UTFieldLabel from '../UTFieldLabel';
|
|
9
9
|
import UTLabel from '../UTLabel';
|
|
10
|
+
import { IS_IOS } from '../../utils/platformUtils/constants';
|
|
10
11
|
|
|
11
12
|
import styles from './styles';
|
|
12
13
|
import { ACTION_ALIGNMENTS } from './constants';
|
|
@@ -14,8 +15,8 @@ import { ACTION_ALIGNMENTS } from './constants';
|
|
|
14
15
|
const screenHeight = Dimensions.get('window').height;
|
|
15
16
|
|
|
16
17
|
const UTBottomSheet = ({
|
|
17
|
-
adjustableHeight = false,
|
|
18
18
|
actionAlignment: actionAlignment_,
|
|
19
|
+
adjustableHeight = false,
|
|
19
20
|
buttonText,
|
|
20
21
|
children,
|
|
21
22
|
description,
|
|
@@ -34,7 +35,8 @@ const UTBottomSheet = ({
|
|
|
34
35
|
tertiaryActionText,
|
|
35
36
|
title,
|
|
36
37
|
titleProps = {},
|
|
37
|
-
visible
|
|
38
|
+
visible,
|
|
39
|
+
withBodyPadding = true
|
|
38
40
|
}) => {
|
|
39
41
|
const [height, setHeight] = useState('70%');
|
|
40
42
|
const [modalHeight, setModalHeight] = useState(height);
|
|
@@ -43,7 +45,11 @@ const UTBottomSheet = ({
|
|
|
43
45
|
const theme = useTheme();
|
|
44
46
|
|
|
45
47
|
const handleKeyboardDidShow = useCallback(e => {
|
|
46
|
-
|
|
48
|
+
if (IS_IOS) {
|
|
49
|
+
setModalHeight(screenHeight);
|
|
50
|
+
} else {
|
|
51
|
+
setModalHeight(screenHeight - e.endCoordinates.height);
|
|
52
|
+
}
|
|
47
53
|
}, []);
|
|
48
54
|
|
|
49
55
|
const handleKeyboardDidHide = useCallback(() => {
|
|
@@ -89,12 +95,12 @@ const UTBottomSheet = ({
|
|
|
89
95
|
style={styles.modal}
|
|
90
96
|
swipeDirection="down"
|
|
91
97
|
>
|
|
92
|
-
<Animated.View style={[styles.animatedContainer, { height: modalHeight }, pan.getLayout()]}>
|
|
93
|
-
<SafeAreaView onLayout={onLayout}>
|
|
98
|
+
<Animated.View style={[styles.animatedContainer(theme), { height: modalHeight }, pan.getLayout()]}>
|
|
99
|
+
<SafeAreaView onLayout={onLayout} style={styles.content(adjustableHeight)}>
|
|
94
100
|
<View style={styles.dragHandle}>
|
|
95
101
|
<View style={styles.handleIndicator(theme)} />
|
|
96
102
|
</View>
|
|
97
|
-
<View style={styles.content}>
|
|
103
|
+
<View style={styles.content(adjustableHeight)}>
|
|
98
104
|
<View style={styles.header}>
|
|
99
105
|
<View style={styles.headerTopRow}>
|
|
100
106
|
<UTFieldLabel
|
|
@@ -123,46 +129,49 @@ const UTBottomSheet = ({
|
|
|
123
129
|
</UTLabel>
|
|
124
130
|
)}
|
|
125
131
|
</View>
|
|
126
|
-
<ChildrenContainer
|
|
132
|
+
<ChildrenContainer
|
|
133
|
+
keyboardShouldPersistTaps="handled"
|
|
134
|
+
style={styles.childrenContainer(adjustableHeight, withBodyPadding)}
|
|
135
|
+
>
|
|
127
136
|
{children}
|
|
128
137
|
</ChildrenContainer>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
138
|
+
<View style={styles.actions(actionAlignment)}>
|
|
139
|
+
{[
|
|
140
|
+
{
|
|
141
|
+
key: 'primaryAction',
|
|
142
|
+
variant: 'semitransparent',
|
|
143
|
+
onPress: primaryAction,
|
|
144
|
+
text: primaryActionText,
|
|
145
|
+
...primaryActionProps
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: 'secondaryAction',
|
|
149
|
+
onPress: secondaryAction,
|
|
150
|
+
text: secondaryActionText,
|
|
151
|
+
...secondaryActionProps
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
key: 'tertiaryAction',
|
|
155
|
+
onPress: tertiaryAction,
|
|
156
|
+
text: tertiaryActionText,
|
|
157
|
+
variant: 'text',
|
|
158
|
+
...tertiaryActionProps
|
|
159
|
+
}
|
|
160
|
+
].map(
|
|
161
|
+
({ text, key, onPress, ...actionProps }) =>
|
|
162
|
+
onPress && (
|
|
163
|
+
<UTButton
|
|
164
|
+
key={key}
|
|
165
|
+
onPress={onPress}
|
|
166
|
+
size="large"
|
|
167
|
+
style={styles.action(actionAlignment)}
|
|
168
|
+
{...actionProps}
|
|
169
|
+
>
|
|
170
|
+
{text}
|
|
171
|
+
</UTButton>
|
|
172
|
+
)
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
166
175
|
</View>
|
|
167
176
|
</SafeAreaView>
|
|
168
177
|
</Animated.View>
|
|
@@ -175,8 +184,8 @@ UTBottomSheet.defaultProps = {
|
|
|
175
184
|
};
|
|
176
185
|
|
|
177
186
|
UTBottomSheet.propTypes = {
|
|
178
|
-
adjustableHeight: bool,
|
|
179
187
|
actionAlignment: string,
|
|
188
|
+
adjustableHeight: bool,
|
|
180
189
|
buttonText: string,
|
|
181
190
|
description: string,
|
|
182
191
|
onClose: func,
|
|
@@ -194,7 +203,8 @@ UTBottomSheet.propTypes = {
|
|
|
194
203
|
tertiaryActionText: string,
|
|
195
204
|
title: string,
|
|
196
205
|
titleProps: object,
|
|
197
|
-
visible: bool
|
|
206
|
+
visible: bool,
|
|
207
|
+
withBodyPadding: bool
|
|
198
208
|
};
|
|
199
209
|
|
|
200
210
|
export default UTBottomSheet;
|
|
@@ -3,31 +3,59 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
import { ACTION_ALIGNMENTS } from './constants';
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
action: actionAlignment => ({
|
|
7
|
+
root: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
flex: 1,
|
|
11
|
+
flexGrow: 1,
|
|
12
|
+
borderRadius: {
|
|
13
|
+
[ACTION_ALIGNMENTS.VERTICAL]: 4,
|
|
14
|
+
[ACTION_ALIGNMENTS.HORIZONTAL]: 0
|
|
15
|
+
}[actionAlignment]
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
actions: actionAlignment => ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
...{
|
|
21
|
+
[ACTION_ALIGNMENTS.VERTICAL]: {
|
|
22
|
+
flexDirection: 'coloumn',
|
|
23
|
+
paddingHorizontal: 16,
|
|
24
|
+
gap: 8,
|
|
25
|
+
paddingBottom: 16
|
|
26
|
+
},
|
|
27
|
+
[ACTION_ALIGNMENTS.HORIZONTAL]: {
|
|
28
|
+
flexDirection: 'row'
|
|
29
|
+
}
|
|
30
|
+
}[actionAlignment]
|
|
31
|
+
}),
|
|
32
|
+
animatedContainer: theme => ({
|
|
33
|
+
backgroundColor: theme.Palette.light['01'],
|
|
8
34
|
borderTopLeftRadius: 20,
|
|
9
35
|
borderTopRightRadius: 20,
|
|
10
36
|
overflow: 'hidden'
|
|
11
|
-
},
|
|
12
|
-
childrenContainer: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
37
|
+
}),
|
|
38
|
+
childrenContainer: (adjustableHeight, withBodyPadding) => ({
|
|
39
|
+
flex: adjustableHeight ? 0 : 1,
|
|
40
|
+
paddingHorizontal: withBodyPadding ? 16 : 0
|
|
41
|
+
}),
|
|
42
|
+
content: adjustableHeight => ({
|
|
43
|
+
flexGrow: adjustableHeight ? 0 : 1
|
|
44
|
+
}),
|
|
19
45
|
dragHandle: {
|
|
20
46
|
alignItems: 'center',
|
|
21
47
|
backgroundColor: 'transparent',
|
|
22
48
|
padding: 16
|
|
23
49
|
},
|
|
24
50
|
handleIndicator: theme => ({
|
|
25
|
-
backgroundColor: theme.Palette.light['04'],
|
|
51
|
+
backgroundColor: theme.Palette.light['04'],
|
|
26
52
|
borderRadius: 2.5,
|
|
27
53
|
height: 5,
|
|
28
54
|
width: 40
|
|
29
55
|
}),
|
|
30
56
|
header: {
|
|
57
|
+
paddingBottom: 16,
|
|
58
|
+
paddingHorizontal: 16,
|
|
31
59
|
rowGap: 8
|
|
32
60
|
},
|
|
33
61
|
headerTopRow: {
|
|
@@ -42,32 +70,7 @@ const styles = StyleSheet.create({
|
|
|
42
70
|
},
|
|
43
71
|
title: {
|
|
44
72
|
flex: 1
|
|
45
|
-
}
|
|
46
|
-
action: actionAlignment => ({
|
|
47
|
-
root: {
|
|
48
|
-
display: 'flex',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
flexGrow: 1,
|
|
51
|
-
borderRadius: {
|
|
52
|
-
[ACTION_ALIGNMENTS.VERTICAL]: 4,
|
|
53
|
-
[ACTION_ALIGNMENTS.HORIZONTAL]: 0
|
|
54
|
-
}[actionAlignment]
|
|
55
|
-
}
|
|
56
|
-
}),
|
|
57
|
-
actions: actionAlignment => ({
|
|
58
|
-
display: 'flex',
|
|
59
|
-
...{
|
|
60
|
-
[ACTION_ALIGNMENTS.VERTICAL]: {
|
|
61
|
-
flexDirection: 'coloumn',
|
|
62
|
-
paddingHorizontal: 16,
|
|
63
|
-
gap: 8,
|
|
64
|
-
paddingBottom: 16
|
|
65
|
-
},
|
|
66
|
-
[ACTION_ALIGNMENTS.HORIZONTAL]: {
|
|
67
|
-
flexDirection: 'row'
|
|
68
|
-
}
|
|
69
|
-
}[actionAlignment]
|
|
70
|
-
})
|
|
73
|
+
}
|
|
71
74
|
});
|
|
72
75
|
|
|
73
76
|
export default styles;
|
|
@@ -17,6 +17,7 @@ const UTSelectableCard = ({
|
|
|
17
17
|
additionalInfo = {},
|
|
18
18
|
appearance = 'white',
|
|
19
19
|
checkIcon = true,
|
|
20
|
+
children,
|
|
20
21
|
description,
|
|
21
22
|
disabled = false,
|
|
22
23
|
Icon,
|
|
@@ -117,6 +118,7 @@ const UTSelectableCard = ({
|
|
|
117
118
|
</View>
|
|
118
119
|
)}
|
|
119
120
|
</View>
|
|
121
|
+
{children}
|
|
120
122
|
{checkIcon && selected && (
|
|
121
123
|
<UTIcon colorTheme="accent" name="IconCheck" style={themedStyles.checkIcon} />
|
|
122
124
|
)}
|
package/package.json
CHANGED