@telus-uds/components-base 1.35.0 → 1.36.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,12 +1,25 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Wed, 19 Apr 2023 18:43:18 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 20 Apr 2023 19:05:54 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.36.0
8
+
9
+ Thu, 20 Apr 2023 19:05:54 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - added adjustments to IconText (kyle.king2@telus.com)
14
+ - Bump @telus-uds/system-theme-tokens to v2.21.0
15
+
16
+ ### Patches
17
+
18
+ - dependency version fix (srikanthkhari@gmail.com)
19
+
7
20
  ## 1.35.0
8
21
 
9
- Wed, 19 Apr 2023 18:43:18 GMT
22
+ Wed, 19 Apr 2023 18:49:51 GMT
10
23
 
11
24
  ### Minor changes
12
25
 
@@ -36,6 +36,11 @@
36
36
  "Image": {
37
37
  "borderRadius": "radius"
38
38
  },
39
+ "Spinner": {
40
+ "fullScreenOverLayBackground": "color",
41
+ "size": "size",
42
+ "thickness": "border"
43
+ },
39
44
  "Callout": {
40
45
  "background": "color",
41
46
  "gap": "size",
@@ -319,6 +324,8 @@
319
324
  "labelMarginLeft": "size"
320
325
  },
321
326
  "ChevronLink": {
327
+ "height": "size",
328
+ "textLineHeight": "lineHeight",
322
329
  "color": "color",
323
330
  "outerBorderColor": "color",
324
331
  "leftIcon": "icon",
@@ -12440,6 +12447,8 @@
12440
12447
  "type": {
12441
12448
  "name": "custom",
12442
12449
  "raw": {
12450
+ "height": "size",
12451
+ "textLineHeight": "lineHeight",
12443
12452
  "color": "color",
12444
12453
  "outerBorderColor": "color",
12445
12454
  "leftIcon": "icon",
@@ -12521,6 +12530,39 @@
12521
12530
  "required": false,
12522
12531
  "description": "When `icon` is provided, use `iconPosition` to place the Icon to the left or right side of Link."
12523
12532
  },
12533
+ "iconProps": {
12534
+ "defaultValue": {
12535
+ "value": "{}",
12536
+ "computed": false
12537
+ },
12538
+ "type": {
12539
+ "name": "exact",
12540
+ "value": {
12541
+ "variant": {
12542
+ "name": "custom",
12543
+ "raw": "variantProp.propType",
12544
+ "required": false
12545
+ },
12546
+ "tokens": {
12547
+ "name": "custom",
12548
+ "raw": "getTokensPropType('Icon')",
12549
+ "required": false
12550
+ },
12551
+ "accessibilityLabel": {
12552
+ "name": "string",
12553
+ "description": "Descriptive label used in web SVG title tag for accessibility",
12554
+ "required": false
12555
+ },
12556
+ "scalesWithText": {
12557
+ "name": "bool",
12558
+ "description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
12559
+ "required": false
12560
+ }
12561
+ }
12562
+ },
12563
+ "required": false,
12564
+ "description": "Optional variant that may be passed down to the link's icon if there is one"
12565
+ },
12524
12566
  "tokens": {
12525
12567
  "defaultValue": {
12526
12568
  "value": "{}",
@@ -12580,35 +12622,6 @@
12580
12622
  "required": false,
12581
12623
  "description": ""
12582
12624
  },
12583
- "iconProps": {
12584
- "type": {
12585
- "name": "exact",
12586
- "value": {
12587
- "variant": {
12588
- "name": "custom",
12589
- "raw": "variantProp.propType",
12590
- "required": false
12591
- },
12592
- "tokens": {
12593
- "name": "custom",
12594
- "raw": "getTokensPropType('Icon')",
12595
- "required": false
12596
- },
12597
- "accessibilityLabel": {
12598
- "name": "string",
12599
- "description": "Descriptive label used in web SVG title tag for accessibility",
12600
- "required": false
12601
- },
12602
- "scalesWithText": {
12603
- "name": "bool",
12604
- "description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
12605
- "required": false
12606
- }
12607
- }
12608
- },
12609
- "required": false,
12610
- "description": "Optional variant that may be passed down to the link's icon if there is one"
12611
- },
12612
12625
  "icon": {
12613
12626
  "type": {
12614
12627
  "name": "elementType"
@@ -54,15 +54,25 @@ const IconText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
54
54
  // See abandoned issue https://github.com/facebook/react-native/issues/6529
55
55
 
56
56
  const size = iconProps === null || iconProps === void 0 ? void 0 : (_iconProps$tokens = iconProps.tokens) === null || _iconProps$tokens === void 0 ? void 0 : _iconProps$tokens.size;
57
- const iconAdjusted = _Platform.default.OS === 'android' && iconContent && size ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
57
+ const iconAdjustedAndriod = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
58
58
  style: {
59
59
  transform: [{
60
60
  translateY: size * 0.2
61
61
  }]
62
62
  },
63
63
  children: iconContent
64
- }) : iconContent;
65
- return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [iconAdjusted, children] : [children, iconAdjusted], {
64
+ });
65
+ const iconAdjustedIOS = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
66
+ style: {
67
+ transform: [{
68
+ translateY: size * 0.01
69
+ }]
70
+ },
71
+ children: iconContent
72
+ });
73
+ const mobile = _Platform.default.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS;
74
+ const adjustedContainer = _Platform.default.OS === 'web' ? iconContent : mobile;
75
+ return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer], {
66
76
  space,
67
77
  direction: 'row'
68
78
  });
@@ -152,7 +152,7 @@ IconButton.propTypes = { ...selectedSystemPropTypes,
152
152
 
153
153
  const staticStyles = _StyleSheet.default.create({
154
154
  outer: {
155
- alignSelf: 'flex-start'
155
+ alignSelf: 'baseline'
156
156
  }
157
157
  });
158
158
 
@@ -45,9 +45,13 @@ const ChevronLink = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
45
45
  leftIcon,
46
46
  rightIcon,
47
47
  iconDisplace,
48
+ height,
49
+ textLineHeight,
48
50
  ...otherTokens
49
51
  } = getChevronTokens(linkState);
50
52
  return { ...(0, _utils.selectTokens)('Link', otherTokens),
53
+ height,
54
+ textLineHeight,
51
55
  icon: direction === 'right' ? rightIcon : leftIcon,
52
56
  iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
53
57
  };
@@ -62,10 +62,16 @@ const selectOuterBorderStyles = _ref => {
62
62
 
63
63
  const selectTextStyles = _ref2 => {
64
64
  let {
65
- color
65
+ color,
66
+ textLineHeight,
67
+ blockFontSize
66
68
  } = _ref2;
67
69
  return {
68
70
  color,
71
+ ...(0, _ThemeProvider.applyTextStyles)({
72
+ lineHeight: textLineHeight,
73
+ blockFontSize
74
+ }),
69
75
  ..._Platform.default.select({
70
76
  web: {
71
77
  // TODO: https://github.com/telus/universal-design-system/issues/487
@@ -83,9 +89,9 @@ const selectBlockStyles = (_ref3, themeOptions) => {
83
89
  blockFontName
84
90
  } = _ref3;
85
91
  return (0, _ThemeProvider.applyTextStyles)({
92
+ lineHeight: blockLineHeight,
86
93
  fontWeight: blockFontWeight,
87
94
  fontSize: blockFontSize,
88
- lineHeight: blockLineHeight,
89
95
  fontName: blockFontName,
90
96
  themeOptions
91
97
  });
@@ -153,7 +159,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
153
159
  href,
154
160
  icon,
155
161
  iconPosition = icon ? 'left' : undefined,
156
- iconProps,
162
+ iconProps = {},
157
163
  variant,
158
164
  tokens = {},
159
165
  children,
@@ -198,10 +204,15 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
198
204
  ,
199
205
  ref: ref,
200
206
  style: linkState => {
201
- const themeTokens = resolveLinkTokens(linkState);
207
+ const {
208
+ height,
209
+ ...themeTokens
210
+ } = resolveLinkTokens(linkState);
202
211
  const outerBorderStyles = selectOuterBorderStyles(themeTokens);
203
212
  const decorationStyles = selectDecorationStyles(themeTokens);
204
- return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
213
+ return [height ? {
214
+ height
215
+ } : {}, outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
205
216
  },
206
217
  children: linkState => {
207
218
  const themeTokens = resolveLinkTokens(linkState);
@@ -267,7 +278,7 @@ const staticStyles = _StyleSheet.default.create({
267
278
  justifyContent: 'flex-start'
268
279
  },
269
280
  baseline: {
270
- alignSelf: 'baseline'
281
+ alignSelf: 'center'
271
282
  }
272
283
  });
273
284
 
@@ -36,15 +36,28 @@ const IconText = /*#__PURE__*/forwardRef((_ref, ref) => {
36
36
 
37
37
 
38
38
  const size = iconProps === null || iconProps === void 0 ? void 0 : (_iconProps$tokens = iconProps.tokens) === null || _iconProps$tokens === void 0 ? void 0 : _iconProps$tokens.size;
39
- const iconAdjusted = Platform.OS === 'android' && iconContent && size ? /*#__PURE__*/_jsx(View, {
39
+
40
+ const iconAdjustedAndriod = /*#__PURE__*/_jsx(View, {
40
41
  style: {
41
42
  transform: [{
42
43
  translateY: size * 0.2
43
44
  }]
44
45
  },
45
46
  children: iconContent
46
- }) : iconContent;
47
- return getStackedContent(iconPosition === 'left' ? [iconAdjusted, children] : [children, iconAdjusted], {
47
+ });
48
+
49
+ const iconAdjustedIOS = /*#__PURE__*/_jsx(View, {
50
+ style: {
51
+ transform: [{
52
+ translateY: size * 0.01
53
+ }]
54
+ },
55
+ children: iconContent
56
+ });
57
+
58
+ const mobile = Platform.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS;
59
+ const adjustedContainer = Platform.OS === 'web' ? iconContent : mobile;
60
+ return getStackedContent(iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer], {
48
61
  space,
49
62
  direction: 'row'
50
63
  });
@@ -126,7 +126,7 @@ IconButton.propTypes = { ...selectedSystemPropTypes,
126
126
  };
127
127
  const staticStyles = StyleSheet.create({
128
128
  outer: {
129
- alignSelf: 'flex-start'
129
+ alignSelf: 'baseline'
130
130
  }
131
131
  });
132
132
  export default withLinkRouter(IconButton);
@@ -27,9 +27,13 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
27
27
  leftIcon,
28
28
  rightIcon,
29
29
  iconDisplace,
30
+ height,
31
+ textLineHeight,
30
32
  ...otherTokens
31
33
  } = getChevronTokens(linkState);
32
34
  return { ...selectTokens('Link', otherTokens),
35
+ height,
36
+ textLineHeight,
33
37
  icon: direction === 'right' ? rightIcon : leftIcon,
34
38
  iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
35
39
  };
@@ -37,10 +37,16 @@ const selectOuterBorderStyles = _ref => {
37
37
 
38
38
  const selectTextStyles = _ref2 => {
39
39
  let {
40
- color
40
+ color,
41
+ textLineHeight,
42
+ blockFontSize
41
43
  } = _ref2;
42
44
  return {
43
45
  color,
46
+ ...applyTextStyles({
47
+ lineHeight: textLineHeight,
48
+ blockFontSize
49
+ }),
44
50
  ...Platform.select({
45
51
  web: {
46
52
  // TODO: https://github.com/telus/universal-design-system/issues/487
@@ -58,9 +64,9 @@ const selectBlockStyles = (_ref3, themeOptions) => {
58
64
  blockFontName
59
65
  } = _ref3;
60
66
  return applyTextStyles({
67
+ lineHeight: blockLineHeight,
61
68
  fontWeight: blockFontWeight,
62
69
  fontSize: blockFontSize,
63
- lineHeight: blockLineHeight,
64
70
  fontName: blockFontName,
65
71
  themeOptions
66
72
  });
@@ -128,7 +134,7 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
128
134
  href,
129
135
  icon,
130
136
  iconPosition = icon ? 'left' : undefined,
131
- iconProps,
137
+ iconProps = {},
132
138
  variant,
133
139
  tokens = {},
134
140
  children,
@@ -170,10 +176,15 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
170
176
  ,
171
177
  ref: ref,
172
178
  style: linkState => {
173
- const themeTokens = resolveLinkTokens(linkState);
179
+ const {
180
+ height,
181
+ ...themeTokens
182
+ } = resolveLinkTokens(linkState);
174
183
  const outerBorderStyles = selectOuterBorderStyles(themeTokens);
175
184
  const decorationStyles = selectDecorationStyles(themeTokens);
176
- return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
185
+ return [height ? {
186
+ height
187
+ } : {}, outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
177
188
  },
178
189
  children: linkState => {
179
190
  const themeTokens = resolveLinkTokens(linkState);
@@ -238,7 +249,7 @@ const staticStyles = StyleSheet.create({
238
249
  justifyContent: 'flex-start'
239
250
  },
240
251
  baseline: {
241
- alignSelf: 'baseline'
252
+ alignSelf: 'center'
242
253
  }
243
254
  });
244
255
  export default withLinkRouter(LinkBase);
package/package.json CHANGED
@@ -11,13 +11,13 @@
11
11
  "@floating-ui/react-native": "^0.8.1",
12
12
  "@gorhom/portal": "^1.0.14",
13
13
  "@telus-uds/system-constants": "^1.2.0",
14
- "@telus-uds/system-theme-tokens": "^2.20.0",
14
+ "@telus-uds/system-theme-tokens": "^2.21.0",
15
15
  "airbnb-prop-types": "^2.16.0",
16
16
  "lodash.debounce": "^4.0.8",
17
17
  "lodash.merge": "^4.6.2",
18
18
  "prop-types": "^15.7.2",
19
19
  "react-native-picker-select": "^8.0.4",
20
- "semver": "^7.3.5"
20
+ "semver": "7.3.5"
21
21
  },
22
22
  "description": "Base components",
23
23
  "devDependencies": {
@@ -72,5 +72,5 @@
72
72
  "standard-engine": {
73
73
  "skip": true
74
74
  },
75
- "version": "1.35.0"
75
+ "version": "1.36.0"
76
76
  }
@@ -23,15 +23,19 @@ const IconText = forwardRef(
23
23
  // Inline images on Android are always baseline-aligned which makes them look misaligned - offset it.
24
24
  // See abandoned issue https://github.com/facebook/react-native/issues/6529
25
25
  const size = iconProps?.tokens?.size
26
- const iconAdjusted =
27
- Platform.OS === 'android' && iconContent && size ? (
28
- <View style={{ transform: [{ translateY: size * 0.2 }] }}>{iconContent}</View>
29
- ) : (
30
- iconContent
31
- )
26
+ const iconAdjustedAndriod = (
27
+ <View style={{ transform: [{ translateY: size * 0.2 }] }}>{iconContent}</View>
28
+ )
29
+
30
+ const iconAdjustedIOS = (
31
+ <View style={{ transform: [{ translateY: size * 0.01 }] }}>{iconContent}</View>
32
+ )
33
+
34
+ const mobile = Platform.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS
35
+ const adjustedContainer = Platform.OS === 'web' ? iconContent : mobile
32
36
 
33
37
  return getStackedContent(
34
- iconPosition === 'left' ? [iconAdjusted, children] : [children, iconAdjusted],
38
+ iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer],
35
39
  { space, direction: 'row' }
36
40
  )
37
41
  }
@@ -115,7 +115,7 @@ IconButton.propTypes = {
115
115
 
116
116
  const staticStyles = StyleSheet.create({
117
117
  outer: {
118
- alignSelf: 'flex-start'
118
+ alignSelf: 'baseline'
119
119
  }
120
120
  })
121
121
 
@@ -15,9 +15,12 @@ const ChevronLink = forwardRef(
15
15
  ({ direction = 'right', children, tokens, variant, dataSet, ...linkProps }, ref) => {
16
16
  const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant)
17
17
  const applyChevronTokens = (linkState) => {
18
- const { leftIcon, rightIcon, iconDisplace, ...otherTokens } = getChevronTokens(linkState)
18
+ const { leftIcon, rightIcon, iconDisplace, height, textLineHeight, ...otherTokens } =
19
+ getChevronTokens(linkState)
19
20
  return {
20
21
  ...selectTokens('Link', otherTokens),
22
+ height,
23
+ textLineHeight,
21
24
  icon: direction === 'right' ? rightIcon : leftIcon,
22
25
  iconTranslateX: iconDisplace * (direction === 'right' ? 1 : -1) || 0
23
26
  }
@@ -42,24 +42,27 @@ const selectOuterBorderStyles = ({
42
42
  }
43
43
  : {}
44
44
 
45
- const selectTextStyles = ({ color }) => ({
46
- color,
47
- ...Platform.select({
48
- web: {
49
- // TODO: https://github.com/telus/universal-design-system/issues/487
50
- transition: 'color 200ms'
51
- }
52
- })
53
- })
45
+ const selectTextStyles = ({ color, textLineHeight, blockFontSize }) => {
46
+ return {
47
+ color,
48
+ ...applyTextStyles({ lineHeight: textLineHeight, blockFontSize }),
49
+ ...Platform.select({
50
+ web: {
51
+ // TODO: https://github.com/telus/universal-design-system/issues/487
52
+ transition: 'color 200ms'
53
+ }
54
+ })
55
+ }
56
+ }
54
57
 
55
58
  const selectBlockStyles = (
56
59
  { blockFontWeight, blockFontSize, blockLineHeight, blockFontName },
57
60
  themeOptions
58
61
  ) =>
59
62
  applyTextStyles({
63
+ lineHeight: blockLineHeight,
60
64
  fontWeight: blockFontWeight,
61
65
  fontSize: blockFontSize,
62
- lineHeight: blockLineHeight,
63
66
  fontName: blockFontName,
64
67
  themeOptions
65
68
  })
@@ -111,7 +114,7 @@ const LinkBase = forwardRef(
111
114
  href,
112
115
  icon,
113
116
  iconPosition = icon ? 'left' : undefined,
114
- iconProps,
117
+ iconProps = {},
115
118
  variant,
116
119
  tokens = {},
117
120
  children,
@@ -147,11 +150,12 @@ const LinkBase = forwardRef(
147
150
  inlineFlex={hasIcon} // assuming links without icons should be inline (even if they are long)
148
151
  ref={ref}
149
152
  style={(linkState) => {
150
- const themeTokens = resolveLinkTokens(linkState)
153
+ const { height, ...themeTokens } = resolveLinkTokens(linkState)
151
154
  const outerBorderStyles = selectOuterBorderStyles(themeTokens)
152
155
  const decorationStyles = selectDecorationStyles(themeTokens)
153
156
 
154
157
  return [
158
+ height ? { height } : {},
155
159
  outerBorderStyles,
156
160
  blockLeftStyle,
157
161
  decorationStyles,
@@ -222,7 +226,7 @@ const staticStyles = StyleSheet.create({
222
226
  justifyContent: 'flex-start'
223
227
  },
224
228
  baseline: {
225
- alignSelf: 'baseline'
229
+ alignSelf: 'center'
226
230
  }
227
231
  })
228
232