@widergy/mobile-ui 1.32.16 → 1.33.1

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.33.1](https://github.com/widergy/mobile-ui/compare/v1.33.0...v1.33.1) (2025-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [UGEE-72] nps surveys ([#402](https://github.com/widergy/mobile-ui/issues/402)) ([15d6993](https://github.com/widergy/mobile-ui/commit/15d69934f0d222c1698dc6175b4170894a5754a5))
7
+
8
+ # [1.33.0](https://github.com/widergy/mobile-ui/compare/v1.32.16...v1.33.0) (2025-01-07)
9
+
10
+
11
+ ### Features
12
+
13
+ * [UGENSA-973] tooltip adornment ([#403](https://github.com/widergy/mobile-ui/issues/403)) ([bf3ac33](https://github.com/widergy/mobile-ui/commit/bf3ac3381aafae7e04197878d3e872d284ebb89b))
14
+
1
15
  ## [1.32.16](https://github.com/widergy/mobile-ui/compare/v1.32.15...v1.32.16) (2025-01-03)
2
16
 
3
17
 
@@ -1,19 +1,29 @@
1
1
  import React from 'react';
2
- import { string } from 'prop-types';
2
+ import { object, shape, string } from 'prop-types';
3
3
 
4
4
  import UTTooltip from '../../../UTTooltip';
5
5
  import UTIcon from '../../../UTIcon';
6
6
  import UTLabel from '../../../UTLabel';
7
7
 
8
- const TooltipAdornment = ({ tooltip }) =>
9
- tooltip ? (
10
- <UTTooltip content={<UTLabel>{tooltip}</UTLabel>}>
8
+ const TooltipAdornment = ({ tooltip, tooltipProps }) => {
9
+ const { tooltip: tooltipStyles, arrowTouchable, labelProps } = tooltipProps || {};
10
+ return tooltip ? (
11
+ <UTTooltip
12
+ styles={{ tooltip: tooltipStyles, arrow: arrowTouchable }}
13
+ content={<UTLabel {...labelProps}>{tooltip}</UTLabel>}
14
+ >
11
15
  <UTIcon name="IconInfoCircle" colorTheme="gray" />
12
16
  </UTTooltip>
13
17
  ) : undefined;
18
+ };
14
19
 
15
20
  TooltipAdornment.propTypes = {
16
- tooltip: string
21
+ tooltip: string,
22
+ tooltipProps: shape({
23
+ tooltip: object,
24
+ arrowTouchable: object,
25
+ labelProps: object
26
+ })
17
27
  };
18
28
 
19
29
  export default TooltipAdornment;
@@ -6,26 +6,28 @@
6
6
 
7
7
  ## Props
8
8
 
9
- | Name | Type | Default | Description |
10
- | ------------------------- | -------- | ----------- | --------------------------------------------------------------------------- |
11
- | `buttonText` | `string` | | Text for the button that appears in the top right corner of the header. |
12
- | `description` | `string` | | Description that appears below the title in the header. |
13
- | `onClose` | `func` | | Function called when the bottom sheet is closed. |
14
- | `required` | `bool` | | Indicates if the field is required, showing an asterisk in the title. |
15
- | `title` | `string` | | Title that appears in the bottom sheet header. |
16
- | `visible` | `bool` | | Controls the visibility of the bottom sheet. |
17
- | `scrolleable` | `bool` | `false` | Determines if the content inside the bottom sheet should be scrollable. |
18
- | `actionAlignment` | `string` | | Aligns the actions. |
19
- | `onCloseProps` | `object` | | Additional props passed to the `onClose` function (optional). |
20
- | `primaryAction` | `func` | | Callback for the primary action button. |
21
- | `primaryActionProps` | `object` | | Props for the primary action button. |
22
- | `primaryActionText` | `string` | | Text for the primary action button. |
23
- | `secondaryAction` | `func` | | Callback for the secondary action button. |
24
- | `secondaryActionProps` | `object` | | Props for the secondary action button. |
25
- | `secondaryActionText` | `string` | | Text for the secondary action button. |
26
- | `tertiaryAction` | `func` | | Callback for the tertiary action button. |
27
- | `tertiaryActionProps` | `object` | | Props for the tertiary action button . |
28
- | `tertiaryActionText` | `string` | | Text for the tertiary action button. |
9
+ | Name | Type | Default | Description |
10
+ | ------------------------- | -------- | ----------- | --------------------------------------------------------------------------- |
11
+ | `adjustableHeight` | `bool` | `false` | If true the height of the component adjusts to the content. |
12
+ | `buttonText` | `string` | | Text for the button that appears in the top right corner of the header. |
13
+ | `description` | `string` | | Description that appears below the title in the header. |
14
+ | `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
+ | `onCloseProps` | `object` | | Additional props passed to the `onClose` function (optional). |
22
+ | `primaryAction` | `func` | | Callback for the primary action button. |
23
+ | `primaryActionProps` | `object` | | Props for the primary action button. |
24
+ | `primaryActionText` | `string` | | Text for the primary action button. |
25
+ | `secondaryAction` | `func` | | Callback for the secondary action button. |
26
+ | `secondaryActionProps` | `object` | | Props for the secondary action button. |
27
+ | `secondaryActionText` | `string` | | Text for the secondary action button. |
28
+ | `tertiaryAction` | `func` | | Callback for the tertiary action button. |
29
+ | `tertiaryActionProps` | `object` | | Props for the tertiary action button . |
30
+ | `tertiaryActionText` | `string` | | Text for the tertiary action button. |
29
31
 
30
32
  ### actionAlignment
31
33
 
@@ -1,5 +1,5 @@
1
- import React, { useRef, useState, useEffect, useCallback, useMemo } from 'react';
2
- import { SafeAreaView, View, PanResponder, Animated, Dimensions, ScrollView, Keyboard } from 'react-native';
1
+ import React, { useRef, useState, useEffect, useCallback } from 'react';
2
+ import { SafeAreaView, View, Animated, Dimensions, ScrollView, Keyboard } from 'react-native';
3
3
  import Modal from 'react-native-modal';
4
4
  import { bool, func, object, string } from 'prop-types';
5
5
 
@@ -14,6 +14,7 @@ import { ACTION_ALIGNMENTS } from './constants';
14
14
  const screenHeight = Dimensions.get('window').height;
15
15
 
16
16
  const UTBottomSheet = ({
17
+ adjustableHeight = false,
17
18
  actionAlignment: actionAlignment_,
18
19
  buttonText,
19
20
  children,
@@ -32,45 +33,22 @@ const UTBottomSheet = ({
32
33
  tertiaryActionProps = {},
33
34
  tertiaryActionText,
34
35
  title,
36
+ titleProps = {},
35
37
  visible
36
38
  }) => {
37
- const [isFullScreen, setIsFullScreen] = useState(false);
38
- const [modalHeight, setModalHeight] = useState('70%');
39
+ const [height, setHeight] = useState('70%');
40
+ const [modalHeight, setModalHeight] = useState(height);
39
41
  const pan = useRef(new Animated.ValueXY()).current;
40
42
 
41
43
  const theme = useTheme();
42
44
 
43
- const panResponder = useMemo(
44
- () =>
45
- PanResponder.create({
46
- onMoveShouldSetPanResponder: (_, gestureState) => gestureState.dy > 0,
47
- onPanResponderMove: (_, gestureState) => {
48
- if (gestureState.dy > 0) {
49
- pan.setValue({ x: 0, y: gestureState.dy });
50
- }
51
- },
52
- onPanResponderRelease: (_, gestureState) => {
53
- if (gestureState.dy > 50) {
54
- setIsFullScreen(true);
55
- pan.flattenOffset();
56
- } else {
57
- Animated.spring(pan, {
58
- toValue: { x: 0, y: 0 },
59
- useNativeDriver: false
60
- }).start();
61
- }
62
- }
63
- }),
64
- [pan]
65
- );
66
-
67
45
  const handleKeyboardDidShow = useCallback(e => {
68
46
  setModalHeight(screenHeight - e.endCoordinates.height);
69
47
  }, []);
70
48
 
71
49
  const handleKeyboardDidHide = useCallback(() => {
72
- setModalHeight(isFullScreen ? screenHeight : '70%');
73
- }, [isFullScreen]);
50
+ setModalHeight(height);
51
+ }, [height]);
74
52
 
75
53
  useEffect(() => {
76
54
  const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow);
@@ -82,9 +60,14 @@ const UTBottomSheet = ({
82
60
  };
83
61
  }, [handleKeyboardDidShow, handleKeyboardDidHide]);
84
62
 
63
+ const onLayout = useCallback(event => {
64
+ const { height: layoutHeight } = event.nativeEvent.layout;
65
+ if (adjustableHeight) setHeight(layoutHeight);
66
+ }, []);
67
+
85
68
  useEffect(() => {
86
- setModalHeight(isFullScreen ? screenHeight : '70%');
87
- }, [isFullScreen]);
69
+ setModalHeight(height);
70
+ }, [height]);
88
71
 
89
72
  const ChildrenContainer = scrolleable ? ScrollView : View;
90
73
 
@@ -107,14 +90,20 @@ const UTBottomSheet = ({
107
90
  swipeDirection="down"
108
91
  >
109
92
  <Animated.View style={[styles.animatedContainer, { height: modalHeight }, pan.getLayout()]}>
110
- <SafeAreaView style={styles.safeArea}>
111
- <View style={styles.dragHandle} {...panResponder.panHandlers}>
93
+ <SafeAreaView onLayout={onLayout}>
94
+ <View style={styles.dragHandle}>
112
95
  <View style={styles.handleIndicator(theme)} />
113
96
  </View>
114
97
  <View style={styles.content}>
115
98
  <View style={styles.header}>
116
99
  <View style={styles.headerTopRow}>
117
- <UTFieldLabel required={required} variant="subtitle1" weight="medium" style={styles.title}>
100
+ <UTFieldLabel
101
+ required={required}
102
+ style={styles.title}
103
+ variant="subtitle1"
104
+ weight="medium"
105
+ {...titleProps}
106
+ >
118
107
  {title}
119
108
  </UTFieldLabel>
120
109
  {buttonText && (
@@ -186,6 +175,7 @@ UTBottomSheet.defaultProps = {
186
175
  };
187
176
 
188
177
  UTBottomSheet.propTypes = {
178
+ adjustableHeight: bool,
189
179
  actionAlignment: string,
190
180
  buttonText: string,
191
181
  description: string,
@@ -203,6 +193,7 @@ UTBottomSheet.propTypes = {
203
193
  tertiaryActionProps: object,
204
194
  tertiaryActionText: string,
205
195
  title: string,
196
+ titleProps: object,
206
197
  visible: bool
207
198
  };
208
199
 
@@ -13,7 +13,6 @@ const styles = StyleSheet.create({
13
13
  flexShrink: 1
14
14
  },
15
15
  content: {
16
- flex: 1,
17
16
  padding: 16,
18
17
  rowGap: 16
19
18
  },
@@ -41,9 +40,6 @@ const styles = StyleSheet.create({
41
40
  justifyContent: 'flex-end',
42
41
  margin: 0
43
42
  },
44
- safeArea: {
45
- flex: 1
46
- },
47
43
  title: {
48
44
  flex: 1
49
45
  },
@@ -9,7 +9,7 @@ import styles from './styles';
9
9
 
10
10
  const UTFieldLabel = ({ children, colorTheme, required, style, variant, weight, withMarkdown }) => (
11
11
  <View style={[styles.label, style]}>
12
- <UTLabel colorTheme={colorTheme} variant={variant} withMarkdown={withMarkdown}>
12
+ <UTLabel colorTheme={colorTheme} variant={variant} weight={weight} withMarkdown={withMarkdown}>
13
13
  {children}
14
14
  </UTLabel>
15
15
  {required && (
@@ -26,7 +26,7 @@ export default StyleSheet.create({
26
26
  return {
27
27
  alignContent: 'center',
28
28
  display: 'flex',
29
- flexBasis: breakOptions ? (containerWidth - (topItems - 1) * 4) / topItems : 0,
29
+ flexBasis: breakOptions ? (containerWidth - topItems * 4) / topItems : 0,
30
30
  flexDirection: 'row',
31
31
  flexGrow: breakOptions ? 0 : 1,
32
32
  flexShrink: 0,
@@ -30,6 +30,7 @@ const TextInputField = ({
30
30
  style,
31
31
  suffix,
32
32
  tooltip,
33
+ tooltipProps,
33
34
  type,
34
35
  value
35
36
  }) => {
@@ -42,7 +43,7 @@ const TextInputField = ({
42
43
  { name: COMPONENT_KEYS.SUFFIX, props: { text: suffix } },
43
44
  { name: COMPONENT_KEYS.ICON, props: { Icon: RightIcon, changeOnError: true } },
44
45
  { name: COMPONENT_KEYS.ACTION, props: { action } },
45
- { name: COMPONENT_KEYS.TOOLTIP, props: { tooltip } }
46
+ { name: COMPONENT_KEYS.TOOLTIP, props: { tooltip, tooltipProps } }
46
47
  ];
47
48
 
48
49
  return (
@@ -106,6 +107,11 @@ TextInputField.propTypes = {
106
107
  }),
107
108
  suffix: string,
108
109
  tooltip: string,
110
+ tooltipProps: shape({
111
+ tooltip: object,
112
+ arrowTouchable: object,
113
+ labelProps: object
114
+ }),
109
115
  type: string,
110
116
  value: string
111
117
  };
@@ -41,6 +41,7 @@ const UTTextInput = ({
41
41
  title,
42
42
  titleVariant = 'large',
43
43
  tooltip,
44
+ tooltipProps,
44
45
  type,
45
46
  validations,
46
47
  value = null
@@ -85,6 +86,7 @@ const UTTextInput = ({
85
86
  style={style}
86
87
  suffix={suffix}
87
88
  tooltip={tooltip}
89
+ tooltipProps={tooltipProps}
88
90
  type={type}
89
91
  value={value}
90
92
  />
@@ -136,6 +138,11 @@ export const propTypes = {
136
138
  suffix: string,
137
139
  title: string,
138
140
  titleVariant: string,
141
+ tooltipProps: shape({
142
+ tooltip: object,
143
+ arrowTouchable: object,
144
+ labelProps: object
145
+ }),
139
146
  tooltip: string,
140
147
  type: string,
141
148
  validations: validationDataProptypes,
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.32.16",
5
+ "version": "1.33.1",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [