@widergy/mobile-ui 1.33.4 → 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,10 @@
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
+
1
8
  ## [1.33.4](https://github.com/widergy/mobile-ui/compare/v1.33.3...v1.33.4) (2025-01-20)
2
9
 
3
10
 
@@ -8,26 +8,27 @@
8
8
 
9
9
  | Name | Type | Default | Description |
10
10
  | ------------------------- | -------- | ----------- | --------------------------------------------------------------------------- |
11
- | `adjustableHeight` | `bool` | `false` | If true the height of the component adjusts to the content. |
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
 
@@ -15,8 +15,8 @@ import { ACTION_ALIGNMENTS } from './constants';
15
15
  const screenHeight = Dimensions.get('window').height;
16
16
 
17
17
  const UTBottomSheet = ({
18
- adjustableHeight = false,
19
18
  actionAlignment: actionAlignment_,
19
+ adjustableHeight = false,
20
20
  buttonText,
21
21
  children,
22
22
  description,
@@ -35,7 +35,8 @@ const UTBottomSheet = ({
35
35
  tertiaryActionText,
36
36
  title,
37
37
  titleProps = {},
38
- visible
38
+ visible,
39
+ withBodyPadding = true
39
40
  }) => {
40
41
  const [height, setHeight] = useState('70%');
41
42
  const [modalHeight, setModalHeight] = useState(height);
@@ -94,12 +95,12 @@ const UTBottomSheet = ({
94
95
  style={styles.modal}
95
96
  swipeDirection="down"
96
97
  >
97
- <Animated.View style={[styles.animatedContainer, { height: modalHeight }, pan.getLayout()]}>
98
- <SafeAreaView onLayout={onLayout}>
98
+ <Animated.View style={[styles.animatedContainer(theme), { height: modalHeight }, pan.getLayout()]}>
99
+ <SafeAreaView onLayout={onLayout} style={styles.content(adjustableHeight)}>
99
100
  <View style={styles.dragHandle}>
100
101
  <View style={styles.handleIndicator(theme)} />
101
102
  </View>
102
- <View style={styles.content}>
103
+ <View style={styles.content(adjustableHeight)}>
103
104
  <View style={styles.header}>
104
105
  <View style={styles.headerTopRow}>
105
106
  <UTFieldLabel
@@ -128,46 +129,49 @@ const UTBottomSheet = ({
128
129
  </UTLabel>
129
130
  )}
130
131
  </View>
131
- <ChildrenContainer keyboardShouldPersistTaps="handled" style={styles.childrenContainer}>
132
+ <ChildrenContainer
133
+ keyboardShouldPersistTaps="handled"
134
+ style={styles.childrenContainer(adjustableHeight, withBodyPadding)}
135
+ >
132
136
  {children}
133
137
  </ChildrenContainer>
134
- </View>
135
- <View style={styles.actions(actionAlignment)}>
136
- {[
137
- {
138
- key: 'primaryAction',
139
- onPress: primaryAction,
140
- text: primaryActionText,
141
- ...primaryActionProps
142
- },
143
- {
144
- key: 'secondaryAction',
145
- onPress: secondaryAction,
146
- text: secondaryActionText,
147
- variant: 'semitransparent',
148
- ...secondaryActionProps
149
- },
150
- {
151
- key: 'tertiaryAction',
152
- onPress: tertiaryAction,
153
- text: tertiaryActionText,
154
- variant: 'text',
155
- ...tertiaryActionProps
156
- }
157
- ].map(
158
- ({ text, key, onPress, ...actionProps }) =>
159
- onPress && (
160
- <UTButton
161
- key={key}
162
- onPress={onPress}
163
- size="large"
164
- style={styles.action(actionAlignment)}
165
- {...actionProps}
166
- >
167
- {text}
168
- </UTButton>
169
- )
170
- )}
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>
171
175
  </View>
172
176
  </SafeAreaView>
173
177
  </Animated.View>
@@ -180,8 +184,8 @@ UTBottomSheet.defaultProps = {
180
184
  };
181
185
 
182
186
  UTBottomSheet.propTypes = {
183
- adjustableHeight: bool,
184
187
  actionAlignment: string,
188
+ adjustableHeight: bool,
185
189
  buttonText: string,
186
190
  description: string,
187
191
  onClose: func,
@@ -199,7 +203,8 @@ UTBottomSheet.propTypes = {
199
203
  tertiaryActionText: string,
200
204
  title: string,
201
205
  titleProps: object,
202
- visible: bool
206
+ visible: bool,
207
+ withBodyPadding: bool
203
208
  };
204
209
 
205
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
- animatedContainer: {
7
- backgroundColor: 'white', // When the component is standardized, should change to palette color
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
- flexShrink: 1
14
- },
15
- content: {
16
- padding: 16,
17
- rowGap: 16
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'], // When the component is standardized, should change to palette color: 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
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.33.4",
5
+ "version": "1.34.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [