@telus-uds/components-base 1.54.0 → 1.55.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.
@@ -22,27 +22,71 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
22
22
 
23
23
  const selectOuterStyle = ({
24
24
  backgroundColor,
25
- borderRadius,
26
25
  outerBorderWidth,
27
26
  outerBorderColor,
28
27
  outerBorderGap,
28
+ borderRadius,
29
+ borderTopLeftRadius,
30
+ borderTopRightRadius,
31
+ borderBottomLeftRadius,
32
+ borderBottomRightRadius,
29
33
  shadow
30
34
  }) => [
31
35
  {
32
36
  backgroundColor,
33
37
  ...applyShadowToken(shadow),
34
- ...applyOuterBorder({ borderRadius, outerBorderWidth, outerBorderColor, outerBorderGap }),
38
+ ...applyOuterBorder({
39
+ borderRadius,
40
+ borderTopLeftRadius,
41
+ borderTopRightRadius,
42
+ borderBottomLeftRadius,
43
+ borderBottomRightRadius,
44
+ outerBorderWidth,
45
+ outerBorderColor,
46
+ outerBorderGap
47
+ }),
35
48
  ...Platform.select({ web: { outline: 'none', display: 'inline-flex' } })
36
49
  },
37
50
  staticStyles.outer
38
51
  ]
39
52
 
40
- const selectInnerStyle = ({ borderColor, borderWidth = 0, borderRadius, padding = 0 }) => ({
53
+ const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth) // Stable size as border changes
54
+
55
+ const selectInnerStyle = ({
56
+ borderColor,
57
+ borderWidth,
58
+ borderTopLeftRadius,
59
+ borderTopRightRadius,
60
+ borderBottomLeftRadius,
61
+ borderBottomRightRadius,
62
+ borderRadius,
63
+ padding = 0,
64
+ borderTopWidth,
65
+ borderRightWidth,
66
+ borderBottomWidth,
67
+ borderLeftWidth,
68
+ paddingLeft,
69
+ paddingRight,
70
+ paddingTop,
71
+ paddingBottom
72
+ }) => ({
41
73
  // Inner borders animate with the icon and should be treated like a themable feature of the icon
42
74
  borderColor,
43
75
  borderRadius,
44
76
  borderWidth,
45
- padding: Math.max(0, padding - borderWidth) // Stable size as border changes
77
+ borderTopLeftRadius,
78
+ borderTopRightRadius,
79
+ borderBottomLeftRadius,
80
+ borderBottomRightRadius,
81
+ borderTopWidth,
82
+ borderRightWidth,
83
+ borderBottomWidth,
84
+ borderLeftWidth,
85
+ padding: calculatePadding(padding, borderWidth),
86
+ paddingLeft: calculatePadding(paddingLeft, borderLeftWidth),
87
+ paddingRight: calculatePadding(paddingRight, borderRightWidth),
88
+ paddingTop: calculatePadding(paddingTop, borderTopWidth),
89
+ paddingBottom: calculatePadding(paddingBottom, borderBottomWidth)
46
90
  })
47
91
 
48
92
  /**
@@ -90,7 +134,7 @@ const IconButton = forwardRef(
90
134
  return (
91
135
  <View style={selectInnerStyle(themeTokens)}>
92
136
  <Icon
93
- icon={IconComponent}
137
+ icon={IconComponent || themeTokens.icon}
94
138
  title={selectedProps.accessibilityLabel}
95
139
  tokens={selectTokens('Icon', themeTokens, 'icon')}
96
140
  variant={variant}
@@ -111,7 +155,7 @@ IconButton.propTypes = {
111
155
  /**
112
156
  * Defines the icon to be rendered
113
157
  */
114
- icon: PropTypes.elementType.isRequired,
158
+ icon: PropTypes.elementType,
115
159
  /**
116
160
  * URL to navigate to when the `Iconbutton` is pressed
117
161
  */
@@ -147,6 +147,13 @@ export function verticalAlignRow(verticalAlign, reverse = false) {
147
147
  }
148
148
  }
149
149
 
150
+ const calculateBorderRadius = (borderRadius, outerBorderGap, outerBorderWidth) => {
151
+ if (borderRadius) {
152
+ return borderRadius + outerBorderGap + outerBorderWidth
153
+ }
154
+
155
+ return null
156
+ }
150
157
  /**
151
158
  * Use on an outer container to create an outer border with an optional gap around it
152
159
  * that matches the border radius of any inner border.
@@ -155,11 +162,31 @@ export const applyOuterBorder = ({
155
162
  outerBorderColor,
156
163
  outerBorderWidth = 0,
157
164
  outerBorderGap = 0,
158
- borderRadius = 0
165
+ borderRadius,
166
+ borderTopLeftRadius,
167
+ borderTopRightRadius,
168
+ borderBottomLeftRadius,
169
+ borderBottomRightRadius
159
170
  }) => ({
160
171
  margin: 0 - outerBorderWidth - outerBorderGap,
161
172
  padding: outerBorderGap,
162
- borderRadius: borderRadius + outerBorderGap + outerBorderWidth,
173
+ borderRadius: calculateBorderRadius(borderRadius, outerBorderGap, outerBorderWidth),
174
+ borderTopLeftRadius: calculateBorderRadius(borderTopLeftRadius, outerBorderGap, outerBorderWidth),
175
+ borderTopRightRadius: calculateBorderRadius(
176
+ borderTopRightRadius,
177
+ outerBorderGap,
178
+ outerBorderWidth
179
+ ),
180
+ borderBottomLeftRadius: calculateBorderRadius(
181
+ borderBottomLeftRadius,
182
+ outerBorderGap,
183
+ outerBorderWidth
184
+ ),
185
+ borderBottomRightRadius: calculateBorderRadius(
186
+ borderBottomRightRadius,
187
+ outerBorderGap,
188
+ outerBorderWidth
189
+ ),
163
190
  borderWidth: outerBorderWidth,
164
191
  borderColor: outerBorderColor
165
192
  })
@@ -7,7 +7,11 @@ import Icon from '../Icon'
7
7
 
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
9
9
 
10
- const selectInnerContainerStyles = ({ borderRadius, width }) => ({ borderRadius, width })
10
+ const selectInnerContainerStyles = ({ borderRadius, width, backgroundColor }) => ({
11
+ borderRadius,
12
+ width,
13
+ backgroundColor
14
+ })
11
15
 
12
16
  const selectIconTokens = ({ iconSize, iconColor, iconScale = 1 }) => ({
13
17
  size: iconSize,