@widergy/mobile-ui 1.16.2 → 1.17.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.17.0](https://github.com/widergy/mobile-ui/compare/v1.16.3...v1.17.0) (2024-08-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * badge for utworkflow summary ([#328](https://github.com/widergy/mobile-ui/issues/328)) ([3ba4b6f](https://github.com/widergy/mobile-ui/commit/3ba4b6fe85872f20d55de2a315c1632c185fe687))
7
+
8
+ ## [1.16.3](https://github.com/widergy/mobile-ui/compare/v1.16.2...v1.16.3) (2024-08-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * android highlight for markdown links ([#329](https://github.com/widergy/mobile-ui/issues/329)) ([0b712dc](https://github.com/widergy/mobile-ui/commit/0b712dc2bd364fcff8229766daf788ba2f4a2796))
14
+
1
15
  ## [1.16.2](https://github.com/widergy/mobile-ui/compare/v1.16.1...v1.16.2) (2024-08-08)
2
16
 
3
17
 
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Fragment } from 'react';
2
2
 
3
3
  import Label from '../Label';
4
4
  import PhotoAlbum from '../PhotoAlbum';
@@ -27,7 +27,7 @@ const Capture = ({
27
27
  const isItPossibleToAddAnotherPhoto = isOnlyOnePicture ? false : images.length <= maxImages;
28
28
 
29
29
  return (
30
- <>
30
+ <Fragment>
31
31
  {!!label && (
32
32
  <Label semiBold big style={styles.paddingText}>
33
33
  {label}
@@ -51,7 +51,7 @@ const Capture = ({
51
51
  onError={onError}
52
52
  />
53
53
  {!!helpText && <Label style={styles.paddingText}>{helpText}</Label>}
54
- </>
54
+ </Fragment>
55
55
  );
56
56
  };
57
57
  Capture.propTypes = propTypes;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/sort-comp */
2
2
  /* eslint-disable class-methods-use-this */
3
3
  // TODO implement horizontal repositioning.
4
- import React, { Component, createRef } from 'react';
4
+ import React, { Component, createRef, Fragment } from 'react';
5
5
  import { Animated, ScrollView, View } from 'react-native';
6
6
 
7
7
  import Overlay from '../Overlay';
@@ -246,7 +246,7 @@ class Dropdown extends Component {
246
246
  });
247
247
 
248
248
  return (
249
- <>
249
+ <Fragment>
250
250
  <View collapsable={false} ref={this.anchor}>
251
251
  {anchor}
252
252
  </View>
@@ -295,7 +295,7 @@ class Dropdown extends Component {
295
295
  </TransformView>
296
296
  </View>
297
297
  </Overlay>
298
- </>
298
+ </Fragment>
299
299
  );
300
300
  }
301
301
  }
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import { Text } from 'react-native';
3
3
  import Markdown from 'react-native-markdown-display';
4
4
 
@@ -25,29 +25,39 @@ const Label = ({
25
25
  const textVariants = Object.keys(textStyles);
26
26
  const customStyles = getCustomStyles(textVariants, props, textStyles);
27
27
 
28
+ const [pressed, setPressed] = useState(false);
29
+
28
30
  const styles = formatStyles(
29
31
  useMarkdown,
30
32
  [textStyles.base, textStyles.fontColor, customStyles, style],
31
- markdownStyles
33
+ markdownStyles,
34
+ pressed
32
35
  );
33
36
 
34
37
  const LabelRenderer = useMarkdown ? Markdown : Text;
35
38
 
36
- const propsByComponent = useMemo(
37
- () =>
38
- useMarkdown
39
- ? {
40
- mergeStyle: false,
41
- onLinkPress,
42
- children: markdownFormat(children)
43
- }
44
- : {
45
- allowFontScaling: allowFontScaling ?? theme.allowFontScaling,
46
- ...textProps,
47
- children
48
- },
49
- [allowFontScaling, children, onLinkPress, textProps, theme.allowFontScaling, useMarkdown]
50
- );
39
+ const propsByComponent = useMemo(() => {
40
+ const handleLinkPress = () => {
41
+ setPressed(true);
42
+ onLinkPress?.();
43
+ setTimeout(() => {
44
+ setPressed(false);
45
+ }, 200);
46
+ return true;
47
+ };
48
+
49
+ return useMarkdown
50
+ ? {
51
+ mergeStyle: false,
52
+ onLinkPress: handleLinkPress,
53
+ children: markdownFormat(children)
54
+ }
55
+ : {
56
+ allowFontScaling: allowFontScaling ?? theme.allowFontScaling,
57
+ ...textProps,
58
+ children
59
+ };
60
+ }, [allowFontScaling, children, onLinkPress, textProps, theme.allowFontScaling, useMarkdown]);
51
61
 
52
62
  return <LabelRenderer style={styles} {...propsByComponent} {...props} />;
53
63
  };
@@ -1,6 +1,7 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
3
  import { verticalScale, horizontalScale } from '../../utils/scaleUtils';
4
+ import { IS_ANDROID } from '../../utils/platformUtils/constants';
4
5
 
5
6
  export const getTextStyles = (theme, color) =>
6
7
  StyleSheet.create({
@@ -101,5 +102,9 @@ export const markdownStyles = StyleSheet.create({
101
102
  ordered_list_icon: {
102
103
  height: '100%',
103
104
  paddingBottom: verticalScale(10)
104
- }
105
+ },
106
+ link: pressed => ({
107
+ backgroundColor: IS_ANDROID && pressed ? 'lightgray' : 'transparent',
108
+ textDecorationLine: 'underline'
109
+ })
105
110
  });
@@ -15,7 +15,7 @@ const flattenStyles = (obj = {}, styles) => {
15
15
  return obj;
16
16
  };
17
17
 
18
- export const formatStyles = (useMarkdown, styles, newMarkdownStyles = {}) => {
18
+ export const formatStyles = (useMarkdown, styles, newMarkdownStyles = {}, pressed) => {
19
19
  const { paragraph } = newMarkdownStyles;
20
20
 
21
21
  const flattenedStyles = flattenStyles({}, styles);
@@ -27,7 +27,8 @@ export const formatStyles = (useMarkdown, styles, newMarkdownStyles = {}) => {
27
27
  bullet_list_icon,
28
28
  ordered_list,
29
29
  ordered_list_content,
30
- ordered_list_icon
30
+ ordered_list_icon,
31
+ link
31
32
  } = markdownStyles;
32
33
 
33
34
  const paragraphStyle = { ...flattenedStyles, ...paragraph };
@@ -41,6 +42,7 @@ export const formatStyles = (useMarkdown, styles, newMarkdownStyles = {}) => {
41
42
  ordered_list,
42
43
  ordered_list_content,
43
44
  ordered_list_icon,
45
+ link: link(pressed),
44
46
  ...newMarkdownStyles,
45
47
  paragraph: paragraphStyle
46
48
  }
@@ -26,7 +26,7 @@ const Picker = ({
26
26
  disabled = false,
27
27
  UploadIcon
28
28
  }) => (
29
- <>
29
+ <Fragment>
30
30
  {!!title && (
31
31
  <Label
32
32
  useMarkdown={withMarkdownTitle}
@@ -67,7 +67,7 @@ const Picker = ({
67
67
  <Text style={styles.pickerText}>{pickerText}</Text>
68
68
  </View>
69
69
  <Text style={styles.helpText}>{helpText}</Text>
70
- </>
70
+ </Fragment>
71
71
  );
72
72
 
73
73
  Picker.propTypes = {
@@ -27,7 +27,7 @@ const UploadedFiles = ({
27
27
  uploadedFiles,
28
28
  withMarkdownTitle
29
29
  }) => (
30
- <>
30
+ <Fragment>
31
31
  {!!title && (
32
32
  <Label
33
33
  useMarkdown={withMarkdownTitle}
@@ -113,7 +113,7 @@ const UploadedFiles = ({
113
113
  <Text style={styles.pickerText}>{pickerText}</Text>
114
114
  </View>
115
115
  <Text style={styles.helpText}>{helpText}</Text>
116
- </>
116
+ </Fragment>
117
117
  );
118
118
 
119
119
  UploadedFiles.propTypes = {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { Fragment, useEffect, useState } from 'react';
2
2
  // eslint-disable-next-line react-native/split-platform-components
3
3
  import { View, TouchableOpacity, PermissionsAndroid } from 'react-native';
4
4
  // eslint-disable-next-line import/no-unresolved
@@ -108,7 +108,7 @@ const PhotoAlbum = ({
108
108
  }, [selectedImages]);
109
109
 
110
110
  return (
111
- <>
111
+ <Fragment>
112
112
  {title && (
113
113
  <Label big semiBold color="#666666" style={styles.title}>
114
114
  {title}
@@ -163,7 +163,7 @@ const PhotoAlbum = ({
163
163
  </Portal>
164
164
  )}
165
165
  </View>
166
- </>
166
+ </Fragment>
167
167
  );
168
168
  };
169
169
 
@@ -24,7 +24,7 @@ const Picker = ({
24
24
  markdownStyles,
25
25
  disabled = false
26
26
  }) => (
27
- <>
27
+ <Fragment>
28
28
  {!!title && (
29
29
  <Label
30
30
  useMarkdown={withMarkdownTitle}
@@ -55,7 +55,7 @@ const Picker = ({
55
55
  />
56
56
  </Touchable>
57
57
  </View>
58
- </>
58
+ </Fragment>
59
59
  );
60
60
 
61
61
  Picker.propTypes = {
@@ -1,4 +1,4 @@
1
- import React, { Component } from 'react';
1
+ import React, { Component, Fragment } from 'react';
2
2
  import { ViewPropTypes } from 'deprecated-react-native-prop-types';
3
3
  import { View } from 'react-native';
4
4
  import PropTypes from 'prop-types';
@@ -33,7 +33,7 @@ class RadioButton extends Component {
33
33
  disabled
34
34
  } = this.props;
35
35
  return (
36
- <>
36
+ <Fragment>
37
37
  <Touchable onPress={this.handlePress} disabled={disabled}>
38
38
  <View style={[styles.container, style]}>
39
39
  {descriptionComponent ? (
@@ -47,7 +47,7 @@ class RadioButton extends Component {
47
47
  />
48
48
  </View>
49
49
  ) : (
50
- <>
50
+ <Fragment>
51
51
  <Icon
52
52
  name={status ? RADIO_CHECKED_ICON : RADIO_UNCHECKED_ICON}
53
53
  color={status ? theme.colors.primary : theme.colors.disabled}
@@ -73,12 +73,12 @@ class RadioButton extends Component {
73
73
  {labelValue}
74
74
  </Label>
75
75
  )}
76
- </>
76
+ </Fragment>
77
77
  )}
78
78
  </View>
79
79
  </Touchable>
80
80
  {showSeparatorBar && <SeparatorBar />}
81
- </>
81
+ </Fragment>
82
82
  );
83
83
  }
84
84
  }
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { Fragment, useState } from 'react';
2
2
  import { number, string, arrayOf, shape, any } from 'prop-types';
3
3
  import { View } from 'react-native';
4
4
 
@@ -80,7 +80,7 @@ const Indicator = ({
80
80
  </View>
81
81
 
82
82
  {consumptionLimit && (
83
- <>
83
+ <Fragment>
84
84
  <View
85
85
  style={[styles.limitLabel, { left: limitTextPosition, top: -limitDimensions.height - 33 - 15 }]}
86
86
  onLayout={handleLimitDimensions}
@@ -98,7 +98,7 @@ const Indicator = ({
98
98
  </Label>
99
99
  </View>
100
100
  <IndicatorIcon position={limitIndicatorPosition} inverted />
101
- </>
101
+ </Fragment>
102
102
  )}
103
103
  </View>
104
104
  );
@@ -7,7 +7,7 @@ import { withTheme, themeType } from '../../theming';
7
7
  import IconButton from '../IconButton';
8
8
  import Label from '../Label';
9
9
  import { IS_ANDROID } from '../../utils/platformUtils/constants';
10
- import { SHADOW_COLOR, SHADOW_OPACITY } from '../../utils/styleUtils';
10
+ import { SHADOW_OPACITY } from '../../utils/styleUtils';
11
11
 
12
12
  import styles, { alertStyleMapper } from './styles';
13
13
  import { INFO, DURATION } from './constants';
@@ -139,7 +139,7 @@ class Snackbar extends Component {
139
139
  }
140
140
  : {
141
141
  opacity,
142
- shadowColor: SHADOW_COLOR,
142
+ shadowColor: 'black',
143
143
  shadowOpacity: SHADOW_OPACITY,
144
144
  shadowRadius: 3,
145
145
  shadowOffset: {
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react-native/no-inline-styles */
2
- import React from 'react';
2
+ import React, { Fragment } from 'react';
3
3
  import { Animated } from 'react-native';
4
4
 
5
5
  import Label from '../../../Label';
@@ -9,7 +9,7 @@ import propTypes from './propTypes';
9
9
  import ownStyles from './styles';
10
10
 
11
11
  const CardContent = ({ onPress, currentPage, opacity, styles, buttonTitle = '', disabled }) => (
12
- <>
12
+ <Fragment>
13
13
  <Animated.View style={[styles?.textContainer, { opacity }]}>
14
14
  <Label big bold style={styles?.title}>
15
15
  {currentPage?.title || ''}
@@ -26,7 +26,7 @@ const CardContent = ({ onPress, currentPage, opacity, styles, buttonTitle = '',
26
26
  {...styles?.buttonProps}
27
27
  disabled={disabled}
28
28
  />
29
- </>
29
+ </Fragment>
30
30
  );
31
31
 
32
32
  CardContent.propTypes = propTypes;
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/prop-types */
2
- import React, { useEffect, useRef, useState } from 'react';
2
+ import React, { Fragment, useEffect, useRef, useState } from 'react';
3
3
  import { Animated, TouchableOpacity, View } from 'react-native';
4
4
  import _ from 'lodash';
5
5
 
@@ -115,7 +115,7 @@ const StepFeedback = ({
115
115
  };
116
116
 
117
117
  return (
118
- <>
118
+ <Fragment>
119
119
  <View style={styles.stepContainer}>
120
120
  <Wrapper onStepPress={onStepPress} status={status} step={step}>
121
121
  <View style={styles.centerStepContainer}>
@@ -133,7 +133,7 @@ const StepFeedback = ({
133
133
  {index < steps.length - 1 && (
134
134
  <View style={[styles.stepSeparator, status.isComplete && styles.stepSeparatorComplete]} />
135
135
  )}
136
- </>
136
+ </Fragment>
137
137
  );
138
138
  };
139
139
 
@@ -81,7 +81,7 @@ const OutlinedInput = ({
81
81
  : focused
82
82
  ? 2
83
83
  : disabled
84
- ? themeStyles?.inactive?.disabledBorderWidth ?? 1
84
+ ? (themeStyles?.inactive?.disabledBorderWidth ?? 1)
85
85
  : 1,
86
86
  borderColor: active ? activeColor : inactiveColor
87
87
  },
@@ -9,6 +9,7 @@ import Icon from '../../../../../Icon';
9
9
  import Checkbox from '../../../../../Checkbox';
10
10
  import { MessagePropTypes, SummaryPropTypes } from '../../types';
11
11
  import UTButton from '../../../../../UTButton';
12
+ import UTBadge from '../../../../../UTBadge';
12
13
 
13
14
  import ActionButton from './components/ActionButton';
14
15
  import ActionButtonPropTypes from './components/ActionButton/types';
@@ -40,24 +41,26 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
40
41
  )}
41
42
  {summary.actions && !checkboxProps && (
42
43
  <View style={themedStyles.summaryActions}>
43
- {summary.actions.map(({ Icon: actionIcon, title, onPress, disabled }, index) => (
44
- <UTButton
45
- disabled={disabled}
46
- Icon={actionIcon}
44
+ {summary.actions.map(({ Icon: actionIcon, title, onPress, badge, disabled }, index) => (
45
+ <View
47
46
  key={actionIcon}
48
- onPress={onPress}
49
- size="small"
50
- style={{
51
- root: {
52
- ...themedStyles.summaryActionContainer,
53
- ...(index !== summary.actions.length - 1 && themedStyles.summaryActionsChild)
54
- },
55
- childrenContainer: themedStyles.summaryActionButton
56
- }}
57
- variant="semitransparent"
47
+ style={index !== summary.actions.length - 1 && themedStyles.summaryActionsChild}
58
48
  >
59
- {title}
60
- </UTButton>
49
+ {badge && <UTBadge style={themedStyles.summaryActionBadge}>{badge}</UTBadge>}
50
+ <UTButton
51
+ disabled={disabled}
52
+ Icon={actionIcon}
53
+ onPress={onPress}
54
+ size="small"
55
+ style={{
56
+ root: themedStyles.summaryActionContainer,
57
+ childrenContainer: themedStyles.summaryActionButton
58
+ }}
59
+ variant="semitransparent"
60
+ >
61
+ {title}
62
+ </UTButton>
63
+ </View>
61
64
  ))}
62
65
  </View>
63
66
  )}
@@ -48,6 +48,12 @@ export default StyleSheet.create({
48
48
  justifyContent: 'space-between',
49
49
  padding: 16
50
50
  },
51
+ summaryActionBadge: {
52
+ position: 'absolute',
53
+ right: -6,
54
+ top: -6,
55
+ zIndex: 10
56
+ },
51
57
  summaryActionContainer: {
52
58
  paddingVertical: 8
53
59
  },
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { ScrollView, View } from 'react-native';
3
- import { number, func, shape, bool, string, element } from 'prop-types';
3
+ import { number, func, shape, bool, string, element, oneOfType } from 'prop-types';
4
4
  import { merge } from 'lodash';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
 
@@ -98,10 +98,10 @@ UTWorkflowContainer.propTypes = {
98
98
  scrollable: bool,
99
99
  stages: StagesPropTypes,
100
100
  stepsCount: number.isRequired,
101
- subtitle: string,
101
+ subtitle: oneOfType([string, element]),
102
102
  summary: SummaryPropTypes,
103
103
  tagline: string,
104
- title: string,
104
+ title: oneOfType([string, element]),
105
105
  topbar: TopbarPropTypes,
106
106
  useMarkdown: bool
107
107
  };
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.16.2",
5
+ "version": "1.17.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [