@widergy/mobile-ui 1.10.3 → 1.11.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.11.0](https://github.com/widergy/mobile-ui/compare/v1.10.4...v1.11.0) (2024-06-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * quantity prop for utproductitem ([#288](https://github.com/widergy/mobile-ui/issues/288)) ([dc80116](https://github.com/widergy/mobile-ui/commit/dc80116a2f552b9086dde49ca358dc119a2fe09e))
7
+
8
+ ## [1.10.4](https://github.com/widergy/mobile-ui/compare/v1.10.3...v1.10.4) (2024-05-31)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * integrate uticon ([#289](https://github.com/widergy/mobile-ui/issues/289)) ([b7b058d](https://github.com/widergy/mobile-ui/commit/b7b058d129983a3c4eb658b89d84ab07bbda7dd3))
14
+
1
15
  ## [1.10.3](https://github.com/widergy/mobile-ui/compare/v1.10.2...v1.10.3) (2024-05-24)
2
16
 
3
17
 
@@ -8,7 +8,7 @@ import UTLoading from '../UTLoading';
8
8
 
9
9
  import { DEFAULT_PROPS, ICON_PLACEMENTS } from './constants';
10
10
  import { retrieveStyle } from './theme';
11
- import { isReactComponent } from './utils';
11
+ import { isUTIcon } from './utils';
12
12
 
13
13
  const UTButton = ({
14
14
  children,
@@ -50,10 +50,10 @@ const UTButton = ({
50
50
 
51
51
  const IconToShow =
52
52
  Icon &&
53
- (isReactComponent(Icon) ? (
54
- <Icon style={iconClassname} fill={themeTextStyles.color} />
53
+ (isUTIcon(Icon) ? (
54
+ <UTIcon color={themeTextStyles.color} style={iconClassname} size={iconClassname.fontSize} name={Icon} />
55
55
  ) : (
56
- <UTIcon color={themeTextStyles.color} style={iconClassname} size={iconClassname.fontSize} {...Icon} />
56
+ <Icon style={iconClassname} fill={themeTextStyles.color} />
57
57
  ));
58
58
 
59
59
  const RenderedChildren = (
@@ -1 +1 @@
1
- export const isReactComponent = icon => typeof icon === 'function';
1
+ export const isUTIcon = icon => typeof icon === 'string';
@@ -6,7 +6,7 @@ import isEmpty from 'lodash/isEmpty';
6
6
 
7
7
  import ImageIcon from '../ImageIcon';
8
8
  import { useTheme } from '../../theming';
9
- import Label from '../Label';
9
+ import UTLabel from '../UTLabel';
10
10
 
11
11
  import { leftSectionComponents } from './utils';
12
12
  import QuantitySelector from './components/QuantitySelector';
@@ -18,9 +18,12 @@ const UTProductItem = ({
18
18
  additionalInfo,
19
19
  amount,
20
20
  counter,
21
+ counterLabelProps = {},
21
22
  discount,
22
23
  imageProps,
23
24
  previousAmount,
25
+ quantity,
26
+ quantityLabelProps = {},
24
27
  secondaryAction,
25
28
  selectedQuantity,
26
29
  style,
@@ -50,9 +53,22 @@ const UTProductItem = ({
50
53
  </View>
51
54
  <View style={[themedStyles.rightSection, !isEmpty(counter) && themedStyles.spaceBetween]}>
52
55
  {!isEmpty(counter) && (
53
- <Label small style={themedStyles.counter}>{`${counter.current}/${counter.limit}`}</Label>
56
+ <UTLabel
57
+ variant="small"
58
+ className={themedStyles.counter}
59
+ {...counterLabelProps}
60
+ >{`${counter.current}/${counter.limit}`}</UTLabel>
54
61
  )}
55
- <QuantitySelector {...{ action, secondaryAction, selectedQuantity, themedStyles }} />
62
+ <View style={themedStyles.quantitiesContainer}>
63
+ {quantity && (
64
+ <View style={themedStyles.quantityContainer}>
65
+ <UTLabel colorTheme="light" variant="subtitle1" {...quantityLabelProps}>
66
+ {quantity}
67
+ </UTLabel>
68
+ </View>
69
+ )}
70
+ <QuantitySelector {...{ action, secondaryAction, selectedQuantity, themedStyles }} />
71
+ </View>
56
72
  </View>
57
73
  </View>
58
74
  );
@@ -63,9 +79,12 @@ UTProductItem.propTypes = {
63
79
  additionalInfo: string,
64
80
  amount: number,
65
81
  counter: shape({ current: number, limit: number }),
82
+ counterLabelProps: shape({}),
66
83
  discount: number,
67
84
  imageProps: shape({ image: oneOf([string, element]), withUri: bool }),
68
85
  previousAmount: number,
86
+ quantity: number,
87
+ quantityLabelProps: shape({}),
69
88
  secondaryAction: ActionPropTypes,
70
89
  selectedQuantity: number,
71
90
  title: string
@@ -27,6 +27,7 @@ export const getUTProductItemStyles = (theme = {}) =>
27
27
  },
28
28
  counter: {
29
29
  backgroundColor: theme.counterBackground || '#EBF8FD',
30
+ overflow: 'hidden',
30
31
  borderRadius: 4,
31
32
  color: theme.counterColor || '#035B83',
32
33
  paddingHorizontal: 8,
@@ -51,18 +52,29 @@ export const getUTProductItemStyles = (theme = {}) =>
51
52
  },
52
53
  leftSection: {
53
54
  alignItems: 'center',
54
- display: 'flex',
55
+ flexGrow: 1,
55
56
  flexDirection: 'row'
56
57
  },
57
58
  mainInfo: {
58
- display: 'flex',
59
- minWidth: 160
59
+ flexGrow: 1,
60
+ flexBasis: 160
60
61
  },
61
62
  previousAmount: {
62
63
  color: theme.previousAmountColor || 'gray',
63
64
  textDecorationLine: 'line-through',
64
65
  textDecorationStyle: 'solid'
65
66
  },
67
+ quantitiesContainer: {
68
+ flexDirection: 'row',
69
+ alignItems: 'center'
70
+ },
71
+ quantityContainer: {
72
+ backgroundColor: theme.quantityBackground || 'darkblue',
73
+ paddingHorizontal: 8,
74
+ paddingVertical: 4,
75
+ borderRadius: 4,
76
+ marginRight: 12
77
+ },
66
78
  rightSection: {
67
79
  alignItems: 'flex-end',
68
80
  display: 'flex',
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.10.3",
5
+ "version": "1.11.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [