@widergy/mobile-ui 1.11.1 → 1.11.3

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.11.3](https://github.com/widergy/mobile-ui/compare/v1.11.2...v1.11.3) (2024-06-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * integrate utlabel in utbutton ([#293](https://github.com/widergy/mobile-ui/issues/293)) ([519119b](https://github.com/widergy/mobile-ui/commit/519119be6c9dc7f1daf1b0e8beb6019df66a9a71))
7
+
8
+ ## [1.11.2](https://github.com/widergy/mobile-ui/compare/v1.11.1...v1.11.2) (2024-06-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * selectable card border and workflow shadow ([#291](https://github.com/widergy/mobile-ui/issues/291)) ([da9996d](https://github.com/widergy/mobile-ui/commit/da9996d01b0cb67dd855ba019f600339c2bfce02))
14
+
1
15
  ## [1.11.1](https://github.com/widergy/mobile-ui/compare/v1.11.0...v1.11.1) (2024-06-03)
2
16
 
3
17
 
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { bool, func, elementType, string } from 'prop-types';
3
- import { Pressable, Text, View } from 'react-native';
3
+ import { Pressable, View } from 'react-native';
4
4
  import { ViewPropTypes } from 'deprecated-react-native-prop-types';
5
5
 
6
6
  import { themeType, withTheme } from '../../theming';
7
7
  import UTIcon from '../UTIcon';
8
+ import UTLabel from '../UTLabel';
8
9
  import UTLoading from '../UTLoading';
9
10
 
10
11
  import { DEFAULT_PROPS, ICON_PLACEMENTS } from './constants';
@@ -29,7 +30,7 @@ const UTButton = ({
29
30
  childrenContainerStyles: themeChildrenContainerStyles,
30
31
  disabledStyles,
31
32
  iconStyles: themeIconStyles,
32
- textStyles: themeTextStyles
33
+ textStyles
33
34
  } = retrieveStyle({
34
35
  style,
35
36
  colorTheme,
@@ -39,7 +40,7 @@ const UTButton = ({
39
40
  variant
40
41
  });
41
42
 
42
- const iconStyle = children ? themeIconStyles.icon : themeIconStyles.iconOnly;
43
+ const iconStyles = children ? themeIconStyles.icon : themeIconStyles.iconOnly;
43
44
 
44
45
  const buttonStyles = ({ pressed }) => [
45
46
  themeButtonStyles,
@@ -47,27 +48,29 @@ const UTButton = ({
47
48
  pressed ? themeButtonStyles.pressed : themeButtonStyles.notPressed
48
49
  ];
49
50
 
50
- const textStyles = themeTextStyles;
51
-
52
51
  const IconToShow =
53
52
  Icon &&
54
53
  (isUTIcon(Icon) ? (
55
- <UTIcon color={themeTextStyles.color} style={iconStyle} size={iconStyle.fontSize} name={Icon} />
54
+ <UTIcon color={iconStyles.color} style={iconStyles} size={iconStyles.fontSize} name={Icon} />
56
55
  ) : (
57
- <Icon style={iconStyle} fill={themeTextStyles.color} />
56
+ <Icon style={iconStyles} fill={iconStyles.color} />
58
57
  ));
59
58
 
60
59
  const RenderedChildren = (
61
60
  <View style={themeChildrenContainerStyles}>
62
61
  {iconPlacement === ICON_PLACEMENTS.left && IconToShow}
63
- {children && <Text style={textStyles}>{children}</Text>}
62
+ {children && (
63
+ <UTLabel colorTheme={textStyles.colorTheme} variant={textStyles.variant} weight={textStyles.weight}>
64
+ {children}
65
+ </UTLabel>
66
+ )}
64
67
  {iconPlacement !== ICON_PLACEMENTS.left && IconToShow}
65
68
  </View>
66
69
  );
67
70
 
68
71
  return (
69
72
  <Pressable disabled={disabled || loading} onPress={onPress} style={buttonStyles}>
70
- <UTLoading color={themeTextStyles.color} loading={loading} size={24} thickness={2}>
73
+ <UTLoading color={iconStyles.color} loading={loading} size={24} thickness={2}>
71
74
  {RenderedChildren}
72
75
  </UTLoading>
73
76
  </Pressable>
@@ -1,14 +1,12 @@
1
1
  import { getShadow } from '../../utils/styleUtils';
2
+ import { COLOR_THEMES } from '../UTLabel/constants';
2
3
 
3
4
  import { COLORS_MAPPER, DEFAULT_PROPS, ELEVATION, PRESSED_ELEVATION } from './constants';
4
5
 
5
- const baseButtonTheme = theme => ({
6
+ const baseButtonTheme = () => ({
6
7
  text: {
7
- fontFamily: theme.fonts.fontFamily,
8
- fontSize: 16,
9
- fontWeight: '500',
10
- lineHeight: 22,
11
- textTransform: 'none'
8
+ variant: 'body',
9
+ weight: 'medium'
12
10
  },
13
11
  button: {
14
12
  borderRadius: 4,
@@ -37,8 +35,8 @@ const baseButtonTheme = theme => ({
37
35
  });
38
36
 
39
37
  const variantsColorTheme = (theme, colorTheme, variant) => {
40
- const actionColorName = COLORS_MAPPER[colorTheme] || COLORS_MAPPER[DEFAULT_PROPS.colorTheme];
41
- const actionTheme = theme.Palette[actionColorName];
38
+ const colorName = COLORS_MAPPER[colorTheme] || COLORS_MAPPER[DEFAULT_PROPS.colorTheme];
39
+ const actionTheme = theme.Palette[colorName];
42
40
  const negativeTheme = theme.Palette[COLORS_MAPPER.negative];
43
41
  const neutralTheme = theme.Palette[COLORS_MAPPER.secondary];
44
42
  const shadow = getShadow(ELEVATION);
@@ -56,12 +54,10 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
56
54
  }
57
55
  },
58
56
  text: {
59
- color: colorTheme === COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05']
57
+ colorTheme: colorTheme === COLORS_MAPPER.negative ? COLOR_THEMES.neutral : COLOR_THEMES.negative
60
58
  },
61
- disabled: {
62
- backgroundColor: actionTheme['04'],
63
- color: colorTheme === COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05'],
64
- opacity: 0.5
59
+ icon: {
60
+ color: colorTheme === COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05']
65
61
  }
66
62
  },
67
63
  semitransparent: {
@@ -75,12 +71,10 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
75
71
  }
76
72
  },
77
73
  text: {
78
- color: actionTheme['05']
74
+ colorTheme: colorName
79
75
  },
80
- disabled: {
81
- backgroundColor: actionTheme['01'],
82
- color: actionTheme['05'],
83
- opacity: 0.5
76
+ icon: {
77
+ color: actionTheme['05']
84
78
  }
85
79
  },
86
80
  outlined: {
@@ -93,13 +87,10 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
93
87
  }
94
88
  },
95
89
  text: {
96
- color: actionTheme['05']
90
+ colorTheme: colorName
97
91
  },
98
- disabled: {
99
- borderWidth: 1,
100
- borderColor: actionTheme['05'],
101
- color: actionTheme['05'],
102
- opacity: 0.5
92
+ icon: {
93
+ color: actionTheme['05']
103
94
  }
104
95
  },
105
96
  text: {
@@ -112,11 +103,10 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
112
103
  }
113
104
  },
114
105
  text: {
115
- color: actionTheme['05']
106
+ colorTheme: colorName
116
107
  },
117
- disabled: {
118
- color: actionTheme['05'],
119
- opacity: 0.5
108
+ icon: {
109
+ color: actionTheme['05']
120
110
  }
121
111
  },
122
112
  shadow: {
@@ -132,11 +122,10 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
132
122
  notPressed: shadow
133
123
  },
134
124
  text: {
135
- color: actionTheme['05']
125
+ colorTheme: colorName
136
126
  },
137
- disabled: {
138
- color: actionTheme['05'],
139
- opacity: 0.5
127
+ icon: {
128
+ color: actionTheme['05']
140
129
  }
141
130
  }
142
131
  };
@@ -152,8 +141,8 @@ const sizeButtonTheme = size => {
152
141
  paddingVertical: 12
153
142
  },
154
143
  text: {
155
- fontSize: 16,
156
- fontWeight: '500'
144
+ variant: 'body',
145
+ weight: 'medium'
157
146
  },
158
147
  icon: {
159
148
  fontSize: 20
@@ -168,8 +157,8 @@ const sizeButtonTheme = size => {
168
157
  paddingVertical: 4
169
158
  },
170
159
  text: {
171
- fontSize: 14,
172
- fontWeight: '500'
160
+ weight: 'medium',
161
+ variant: 'small'
173
162
  },
174
163
  icon: {
175
164
  fontSize: 20
@@ -196,7 +185,7 @@ const iconButtonPlacementTheme = iconPlacement => {
196
185
  };
197
186
 
198
187
  export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, iconPlacement }) => {
199
- const baseTheme = baseButtonTheme(theme);
188
+ const baseTheme = baseButtonTheme();
200
189
  const variantTheme = variantsColorTheme(theme, colorTheme, variant);
201
190
  const sizeTheme = sizeButtonTheme(size);
202
191
  const iconPlacementTheme = iconButtonPlacementTheme(iconPlacement);
@@ -209,19 +198,32 @@ export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, ic
209
198
  };
210
199
 
211
200
  const textStyles = {
212
- ...baseTheme.text,
213
- ...variantTheme.text,
214
- ...sizeTheme.text
201
+ colorTheme: variantTheme.text.colorTheme,
202
+ variant: sizeTheme.text?.variant || baseTheme.text?.variant,
203
+ weight: sizeTheme.text?.weight || baseTheme.text?.weight
215
204
  };
216
205
 
217
206
  const iconStyles = {
218
- icon: { ...baseTheme.icon, ...sizeTheme.icon, ...iconPlacementTheme, ...style.icon },
219
- iconOnly: { ...baseTheme.iconOnly, ...sizeTheme.iconOnly, ...style.icon }
207
+ icon: {
208
+ ...baseTheme.icon,
209
+ ...sizeTheme.icon,
210
+ ...variantTheme.icon,
211
+ ...iconPlacementTheme,
212
+ ...style.icon
213
+ },
214
+ iconOnly: {
215
+ ...baseTheme.iconOnly,
216
+ ...sizeTheme.iconOnly,
217
+ ...variantTheme.icon,
218
+ ...style.icon
219
+ }
220
220
  };
221
221
 
222
222
  const childrenContainerStyles = { ...baseTheme.childrenContainer, ...style.childrenContainer };
223
223
 
224
- const { disabled } = variantTheme;
224
+ const disabledStyles = {
225
+ opacity: 0.5
226
+ };
225
227
 
226
- return { buttonStyles, textStyles, disabledStyles: disabled, iconStyles, childrenContainerStyles };
228
+ return { buttonStyles, textStyles, disabledStyles, iconStyles, childrenContainerStyles };
227
229
  };
@@ -32,13 +32,16 @@ export const WEIGHTS = {
32
32
  };
33
33
 
34
34
  export const COLOR_THEMES = {
35
+ accent: 'accent',
35
36
  dark: 'dark',
37
+ error: 'error',
36
38
  gray: 'gray',
39
+ information: 'information',
37
40
  light: 'light',
41
+ negative: 'negative',
42
+ neutral: 'neutral',
38
43
  success: 'success',
39
- error: 'error',
40
- warning: 'warning',
41
- information: 'information'
44
+ warning: 'warning'
42
45
  };
43
46
 
44
47
  export const DEFAULT_PROPS = {
@@ -53,10 +53,14 @@ export const getUTSelectableCardStyles = (theme = {}) =>
53
53
  // White
54
54
  whiteAppearance: {
55
55
  backgroundColor: theme.whiteBackground || 'white',
56
+ borderWidth: 2,
57
+ borderColor: 'transparent',
56
58
  elevation: 4
57
59
  },
58
60
  whiteDisabledContainer: {
59
61
  backgroundColor: theme.whiteDisabledBackground || 'lightgray',
62
+ borderWidth: 2,
63
+ borderColor: 'transparent',
60
64
  elevation: 0
61
65
  },
62
66
  whiteSelectedContainer: {
@@ -16,7 +16,11 @@ export default StyleSheet.create({
16
16
  },
17
17
  bottomNav: {
18
18
  backgroundColor: 'white',
19
- elevation: 10
19
+ shadowColor: 'black',
20
+ shadowOffset: { width: 0, height: -3 },
21
+ shadowOpacity: 0.1,
22
+ shadowRadius: 4,
23
+ elevation: 2
20
24
  },
21
25
  message: {
22
26
  alignItems: 'center',
@@ -44,7 +48,6 @@ export default StyleSheet.create({
44
48
  borderTopLeftRadius: 20,
45
49
  borderTopRightRadius: 20,
46
50
  display: 'flex',
47
- elevation: 1,
48
51
  flexDirection: 'row',
49
52
  justifyContent: 'space-between',
50
53
  padding: 16
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.11.1",
5
+ "version": "1.11.3",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [