@telus-uds/components-web 2.30.0 → 2.31.1

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,37 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Mon, 29 Jan 2024 18:26:01 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 14 Feb 2024 02:21:15 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.31.1
8
+
9
+ Wed, 14 Feb 2024 02:21:15 GMT
10
+
11
+ ### Patches
12
+
13
+ - `Card` added in `FlexGrid` should become clickable when grown to take entire height (shahzaibkhalidmalik@outlook.com)
14
+ - updated text on the component-web story (chris.tafts@telus.com)
15
+ - Bump @telus-uds/components-base to v1.77.0
16
+ - Bump @telus-uds/system-theme-tokens to v2.51.0
17
+
18
+ ## 2.31.0
19
+
20
+ Wed, 07 Feb 2024 19:14:08 GMT
21
+
22
+ ### Minor changes
23
+
24
+ - updating optimizeimage to support ssr (sergiy.andronov1@telus.com)
25
+ - migrate pricelockup to component-base (chris.tafts@telus.com)
26
+ - Bump @telus-uds/components-base to v1.76.0
27
+
28
+ ### Patches
29
+
30
+ - fix ordered-list component single child render (guillermo.peitzner@telus.com)
31
+
7
32
  ## 2.30.0
8
33
 
9
- Mon, 29 Jan 2024 18:26:01 GMT
34
+ Mon, 29 Jan 2024 18:41:50 GMT
10
35
 
11
36
  ### Minor changes
12
37
 
package/lib/Card/Card.js CHANGED
@@ -84,10 +84,8 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
84
84
  });
85
85
  const hasFooter = Boolean(footer);
86
86
  const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius, fullBleedContentPosition, hasFooter);
87
-
88
- // Make multiple cards in a row have equal heights with even space between content items
89
87
  const columnFlex = {
90
- flexGrow: 1,
88
+ flexGrow: 0,
91
89
  flexShrink: 1,
92
90
  justifyContent: 'space-between'
93
91
  };
@@ -100,7 +98,7 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
100
98
  paddingRight,
101
99
  ...restOfTokens
102
100
  } = tokens;
103
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Card, {
101
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Card, {
104
102
  ref: ref,
105
103
  variant: {
106
104
  ...variant,
@@ -108,39 +106,35 @@ const Card = /*#__PURE__*/(0, _react.forwardRef)(function () {
108
106
  },
109
107
  tokens: restOfTokens,
110
108
  ...selectProps(rest),
111
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
109
+ children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
110
+ ref: ref,
111
+ tokens: getThemeTokens,
112
+ dataSet: dataSet,
113
+ onPress: onPress,
114
+ ...selectProps(rest),
115
+ children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
116
+ }) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
117
+ direction: contentStackDirection,
118
+ tokens: {
119
+ ...columnFlex,
120
+ alignItems: contentStackAlign
121
+ },
112
122
  space: 0,
113
- tokens: columnFlex,
114
- children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
115
- ref: ref,
116
- tokens: getThemeTokens,
117
- dataSet: dataSet,
118
- onPress: onPress,
119
- ...selectProps(rest),
120
- children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
121
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
122
- direction: contentStackDirection,
123
- tokens: {
124
- ...columnFlex,
125
- alignItems: contentStackAlign
126
- },
127
- space: 0,
128
- children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContent.default, {
129
- tokens: tokens,
130
- variant: variant,
131
- withFooter: hasFooter,
132
- children: children
133
- }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
134
- borderRadius: fullBleedBorderRadius,
135
- ...fullBleedContentProps
136
- })]
137
- }), footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardFooter.default, {
138
- padding: footerPadding,
123
+ children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContent.default, {
139
124
  tokens: tokens,
140
125
  variant: variant,
141
- children: footer
126
+ withFooter: hasFooter,
127
+ children: children
128
+ }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
129
+ borderRadius: fullBleedBorderRadius,
130
+ ...fullBleedContentProps
142
131
  })]
143
- })
132
+ }) : null, footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardFooter.default, {
133
+ padding: footerPadding,
134
+ tokens: tokens,
135
+ variant: variant,
136
+ children: footer
137
+ })]
144
138
  });
145
139
  });
146
140
  const positionValues = ['none', 'bottom', 'left', 'right', 'top'];
@@ -29,21 +29,15 @@ const OptimizeImage = _ref => {
29
29
  disableRetina = false,
30
30
  ...rest
31
31
  } = _ref;
32
- const [imgUrls, setImgUrls] = (0, _react.useState)();
33
-
34
32
  // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
35
33
  const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w';
34
+ // by default assuming webP support for SSR
35
+ const [imgUrls, setImgUrls] = (0, _react.useState)((0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, true));
36
36
  (0, _react.useEffect)(() => {
37
- // Currently not all browsers support webP
37
+ // Checking for webP support for CSR
38
38
  (0, _utils.hasWebpSupport)().then(supportsWebp => {
39
- setImgUrls({
40
- xsSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
41
- smSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
42
- mdSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
43
- lgSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
44
- xlSrc: (0, _utils.getOptimizedUrl)(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
45
- fallbackSrc: (0, _utils.getFallbackUrl)(contentfulAssetUrl, dimension, xl, quality)
46
- });
39
+ const imageUrls = (0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp);
40
+ setImgUrls(imageUrls);
47
41
  });
48
42
  }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
49
43
  if (!imgUrls) return null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getImageUrls;
7
+ var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
8
+ var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp) {
11
+ return {
12
+ xsSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
13
+ smSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
14
+ mdSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
15
+ lgSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
16
+ xlSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
17
+ fallbackSrc: (0, _getFallbackUrl.default)(contentfulAssetUrl, dimension, xl, quality)
18
+ };
19
+ }
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "getFallbackUrl", {
9
9
  return _getFallbackUrl.default;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "getImageUrls", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _getImageUrls.default;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "getOptimizedUrl", {
13
19
  enumerable: true,
14
20
  get: function () {
@@ -24,4 +30,5 @@ Object.defineProperty(exports, "hasWebpSupport", {
24
30
  var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
25
31
  var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
26
32
  var _hasWebpSupport = _interopRequireDefault(require("./hasWebpSupport"));
33
+ var _getImageUrls = _interopRequireDefault(require("./getImageUrls"));
27
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -41,21 +41,29 @@ const OrderedList = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
41
41
  variant,
42
42
  ...rest
43
43
  } = _ref2;
44
+ // Check if children is an array
45
+ const isChildrenArray = Array.isArray(children);
46
+
44
47
  // Pass any variants "OrderedList" receives down to the individual list items.
45
- const childrenWithParentVariants = variant ? children.map(child => {
46
- var _child$props;
47
- const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
48
- return {
49
- ...child,
50
- props: {
51
- ...child.props,
48
+ const childrenWithParentVariants = (0, _react.useMemo)(() => {
49
+ const addVariantToProps = child => {
50
+ var _child$props;
51
+ const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
52
+ return /*#__PURE__*/_react.default.cloneElement(child, {
52
53
  variant: {
53
54
  ...existingChildVariants,
54
55
  ...variant
55
56
  }
56
- }
57
+ });
57
58
  };
58
- }) : children;
59
+ if (variant) {
60
+ if (isChildrenArray) {
61
+ return children.map(addVariantToProps);
62
+ }
63
+ return [addVariantToProps(children)];
64
+ }
65
+ return children;
66
+ }, [children, variant, isChildrenArray]);
59
67
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledOrderedListBase, {
60
68
  ...selectProps(rest),
61
69
  ref: ref,
@@ -76,10 +76,8 @@ const Card = /*#__PURE__*/forwardRef(function () {
76
76
  });
77
77
  const hasFooter = Boolean(footer);
78
78
  const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter);
79
-
80
- // Make multiple cards in a row have equal heights with even space between content items
81
79
  const columnFlex = {
82
- flexGrow: 1,
80
+ flexGrow: 0,
83
81
  flexShrink: 1,
84
82
  justifyContent: 'space-between'
85
83
  };
@@ -92,7 +90,7 @@ const Card = /*#__PURE__*/forwardRef(function () {
92
90
  paddingRight,
93
91
  ...restOfTokens
94
92
  } = tokens;
95
- return /*#__PURE__*/_jsx(CardBase, {
93
+ return /*#__PURE__*/_jsxs(CardBase, {
96
94
  ref: ref,
97
95
  variant: {
98
96
  ...variant,
@@ -100,39 +98,35 @@ const Card = /*#__PURE__*/forwardRef(function () {
100
98
  },
101
99
  tokens: restOfTokens,
102
100
  ...selectProps(rest),
103
- children: /*#__PURE__*/_jsxs(StackView, {
101
+ children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/_jsx(PressableCardBase, {
102
+ ref: ref,
103
+ tokens: getThemeTokens,
104
+ dataSet: dataSet,
105
+ onPress: onPress,
106
+ ...selectProps(rest),
107
+ children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
108
+ }) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/_jsxs(StackView, {
109
+ direction: contentStackDirection,
110
+ tokens: {
111
+ ...columnFlex,
112
+ alignItems: contentStackAlign
113
+ },
104
114
  space: 0,
105
- tokens: columnFlex,
106
- children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/_jsx(PressableCardBase, {
107
- ref: ref,
108
- tokens: getThemeTokens,
109
- dataSet: dataSet,
110
- onPress: onPress,
111
- ...selectProps(rest),
112
- children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
113
- }) : null, /*#__PURE__*/_jsxs(StackView, {
114
- direction: contentStackDirection,
115
- tokens: {
116
- ...columnFlex,
117
- alignItems: contentStackAlign
118
- },
119
- space: 0,
120
- children: [children ? /*#__PURE__*/_jsx(CardContent, {
121
- tokens: tokens,
122
- variant: variant,
123
- withFooter: hasFooter,
124
- children: children
125
- }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(FullBleedContent, {
126
- borderRadius: fullBleedBorderRadius,
127
- ...fullBleedContentProps
128
- })]
129
- }), footer && /*#__PURE__*/_jsx(CardFooter, {
130
- padding: footerPadding,
115
+ children: [children ? /*#__PURE__*/_jsx(CardContent, {
131
116
  tokens: tokens,
132
117
  variant: variant,
133
- children: footer
118
+ withFooter: hasFooter,
119
+ children: children
120
+ }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(FullBleedContent, {
121
+ borderRadius: fullBleedBorderRadius,
122
+ ...fullBleedContentProps
134
123
  })]
135
- })
124
+ }) : null, footer && /*#__PURE__*/_jsx(CardFooter, {
125
+ padding: footerPadding,
126
+ tokens: tokens,
127
+ variant: variant,
128
+ children: footer
129
+ })]
136
130
  });
137
131
  });
138
132
  const positionValues = ['none', 'bottom', 'left', 'right', 'top'];
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { selectSystemProps } from '@telus-uds/components-base';
4
4
  import ResponsiveImage from '../ResponsiveImage';
5
- import { hasWebpSupport, getOptimizedUrl, getFallbackUrl } from './utils';
5
+ import { hasWebpSupport, getImageUrls } from './utils';
6
6
  import { htmlAttrs } from '../utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
@@ -20,21 +20,15 @@ const OptimizeImage = _ref => {
20
20
  disableRetina = false,
21
21
  ...rest
22
22
  } = _ref;
23
- const [imgUrls, setImgUrls] = useState();
24
-
25
23
  // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
26
24
  const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w';
25
+ // by default assuming webP support for SSR
26
+ const [imgUrls, setImgUrls] = useState(getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, true));
27
27
  useEffect(() => {
28
- // Currently not all browsers support webP
28
+ // Checking for webP support for CSR
29
29
  hasWebpSupport().then(supportsWebp => {
30
- setImgUrls({
31
- xsSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
32
- smSrc: getOptimizedUrl(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
33
- mdSrc: getOptimizedUrl(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
34
- lgSrc: getOptimizedUrl(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
35
- xlSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
36
- fallbackSrc: getFallbackUrl(contentfulAssetUrl, dimension, xl, quality)
37
- });
30
+ const imageUrls = getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp);
31
+ setImgUrls(imageUrls);
38
32
  });
39
33
  }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
40
34
  if (!imgUrls) return null;
@@ -0,0 +1,12 @@
1
+ import getOptimizedUrl from './getOptimizedUrl';
2
+ import getFallbackUrl from './getFallbackUrl';
3
+ export default function getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp) {
4
+ return {
5
+ xsSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
6
+ smSrc: getOptimizedUrl(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
7
+ mdSrc: getOptimizedUrl(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
8
+ lgSrc: getOptimizedUrl(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
9
+ xlSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
10
+ fallbackSrc: getFallbackUrl(contentfulAssetUrl, dimension, xl, quality)
11
+ };
12
+ }
@@ -1,4 +1,5 @@
1
1
  import getOptimizedUrl from './getOptimizedUrl';
2
2
  import getFallbackUrl from './getFallbackUrl';
3
3
  import hasWebpSupport from './hasWebpSupport';
4
- export { getOptimizedUrl, getFallbackUrl, hasWebpSupport };
4
+ import getImageUrls from './getImageUrls';
5
+ export { getOptimizedUrl, getFallbackUrl, hasWebpSupport, getImageUrls };
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react';
1
+ import React, { forwardRef, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { selectSystemProps, getTokensPropType, variantProp } from '@telus-uds/components-base';
@@ -32,21 +32,29 @@ const OrderedList = /*#__PURE__*/forwardRef((_ref2, ref) => {
32
32
  variant,
33
33
  ...rest
34
34
  } = _ref2;
35
+ // Check if children is an array
36
+ const isChildrenArray = Array.isArray(children);
37
+
35
38
  // Pass any variants "OrderedList" receives down to the individual list items.
36
- const childrenWithParentVariants = variant ? children.map(child => {
37
- var _child$props;
38
- const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
39
- return {
40
- ...child,
41
- props: {
42
- ...child.props,
39
+ const childrenWithParentVariants = useMemo(() => {
40
+ const addVariantToProps = child => {
41
+ var _child$props;
42
+ const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
43
+ return /*#__PURE__*/React.cloneElement(child, {
43
44
  variant: {
44
45
  ...existingChildVariants,
45
46
  ...variant
46
47
  }
47
- }
48
+ });
48
49
  };
49
- }) : children;
50
+ if (variant) {
51
+ if (isChildrenArray) {
52
+ return children.map(addVariantToProps);
53
+ }
54
+ return [addVariantToProps(children)];
55
+ }
56
+ return children;
57
+ }, [children, variant, isChildrenArray]);
50
58
  return /*#__PURE__*/_jsx(StyledOrderedListBase, {
51
59
  ...selectProps(rest),
52
60
  ref: ref,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.75.0",
8
+ "@telus-uds/components-base": "1.77.0",
9
9
  "@telus-uds/system-constants": "^1.3.0",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
@@ -13,7 +13,7 @@
13
13
  "react-dates": "^21.8.0",
14
14
  "react-helmet-async": "^1.3.0",
15
15
  "react-moment-proptypes": "^1.8.1",
16
- "@telus-uds/system-theme-tokens": "^2.50.1",
16
+ "@telus-uds/system-theme-tokens": "^2.51.0",
17
17
  "prop-types": "^15.7.2",
18
18
  "lodash.throttle": "^4.1.1",
19
19
  "react-youtube": "^10.1.0",
@@ -83,5 +83,5 @@
83
83
  "skip": true
84
84
  },
85
85
  "types": "types/index.d.ts",
86
- "version": "2.30.0"
86
+ "version": "2.31.1"
87
87
  }
package/src/Card/Card.jsx CHANGED
@@ -93,9 +93,8 @@ const Card = forwardRef(
93
93
  hasFooter
94
94
  )
95
95
 
96
- // Make multiple cards in a row have equal heights with even space between content items
97
96
  const columnFlex = {
98
- flexGrow: 1,
97
+ flexGrow: 0,
99
98
  flexShrink: 1,
100
99
  justifyContent: 'space-between'
101
100
  }
@@ -110,18 +109,18 @@ const Card = forwardRef(
110
109
  tokens={restOfTokens}
111
110
  {...selectProps(rest)}
112
111
  >
113
- <StackView space={0} tokens={columnFlex}>
114
- {interactiveCard?.body ? (
115
- <PressableCardBase
116
- ref={ref}
117
- tokens={getThemeTokens}
118
- dataSet={dataSet}
119
- onPress={onPress}
120
- {...selectProps(rest)}
121
- >
122
- {interactiveCard?.body}
123
- </PressableCardBase>
124
- ) : null}
112
+ {interactiveCard?.body ? (
113
+ <PressableCardBase
114
+ ref={ref}
115
+ tokens={getThemeTokens}
116
+ dataSet={dataSet}
117
+ onPress={onPress}
118
+ {...selectProps(rest)}
119
+ >
120
+ {interactiveCard?.body}
121
+ </PressableCardBase>
122
+ ) : null}
123
+ {children || fullBleedContentPosition !== 'none' ? (
125
124
  <StackView
126
125
  direction={contentStackDirection}
127
126
  tokens={{ ...columnFlex, alignItems: contentStackAlign }}
@@ -136,12 +135,12 @@ const Card = forwardRef(
136
135
  <FullBleedContent borderRadius={fullBleedBorderRadius} {...fullBleedContentProps} />
137
136
  )}
138
137
  </StackView>
139
- {footer && (
140
- <CardFooter padding={footerPadding} tokens={tokens} variant={variant}>
141
- {footer}
142
- </CardFooter>
143
- )}
144
- </StackView>
138
+ ) : null}
139
+ {footer && (
140
+ <CardFooter padding={footerPadding} tokens={tokens} variant={variant}>
141
+ {footer}
142
+ </CardFooter>
143
+ )}
145
144
  </CardBase>
146
145
  )
147
146
  }
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import { selectSystemProps } from '@telus-uds/components-base'
4
4
  import ResponsiveImage from '../ResponsiveImage'
5
- import { hasWebpSupport, getOptimizedUrl, getFallbackUrl } from './utils'
5
+ import { hasWebpSupport, getImageUrls } from './utils'
6
6
  import { htmlAttrs } from '../utils'
7
7
 
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
@@ -20,57 +20,29 @@ const OptimizeImage = ({
20
20
  disableRetina = false,
21
21
  ...rest
22
22
  }) => {
23
- const [imgUrls, setImgUrls] = useState()
24
-
25
23
  // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
26
24
  const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w'
25
+ // by default assuming webP support for SSR
26
+ const [imgUrls, setImgUrls] = useState(
27
+ getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, true)
28
+ )
27
29
 
28
30
  useEffect(() => {
29
- // Currently not all browsers support webP
31
+ // Checking for webP support for CSR
30
32
  hasWebpSupport().then((supportsWebp) => {
31
- setImgUrls({
32
- xsSrc: getOptimizedUrl(
33
- contentfulAssetUrl,
34
- dimension,
35
- xs,
36
- quality,
37
- disableRetina,
38
- supportsWebp
39
- ),
40
- smSrc: getOptimizedUrl(
41
- contentfulAssetUrl,
42
- dimension,
43
- sm,
44
- quality,
45
- disableRetina,
46
- supportsWebp
47
- ),
48
- mdSrc: getOptimizedUrl(
49
- contentfulAssetUrl,
50
- dimension,
51
- md,
52
- quality,
53
- disableRetina,
54
- supportsWebp
55
- ),
56
- lgSrc: getOptimizedUrl(
57
- contentfulAssetUrl,
58
- dimension,
59
- lg,
60
- quality,
61
- disableRetina,
62
- supportsWebp
63
- ),
64
- xlSrc: getOptimizedUrl(
65
- contentfulAssetUrl,
66
- dimension,
67
- xl,
68
- quality,
69
- disableRetina,
70
- supportsWebp
71
- ),
72
- fallbackSrc: getFallbackUrl(contentfulAssetUrl, dimension, xl, quality)
73
- })
33
+ const imageUrls = getImageUrls(
34
+ contentfulAssetUrl,
35
+ dimension,
36
+ xs,
37
+ sm,
38
+ md,
39
+ lg,
40
+ xl,
41
+ quality,
42
+ disableRetina,
43
+ supportsWebp
44
+ )
45
+ setImgUrls(imageUrls)
74
46
  })
75
47
  }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs])
76
48
 
@@ -0,0 +1,24 @@
1
+ import getOptimizedUrl from './getOptimizedUrl'
2
+ import getFallbackUrl from './getFallbackUrl'
3
+
4
+ export default function getImageUrls(
5
+ contentfulAssetUrl,
6
+ dimension,
7
+ xs,
8
+ sm,
9
+ md,
10
+ lg,
11
+ xl,
12
+ quality,
13
+ disableRetina,
14
+ supportsWebp
15
+ ) {
16
+ return {
17
+ xsSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
18
+ smSrc: getOptimizedUrl(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
19
+ mdSrc: getOptimizedUrl(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
20
+ lgSrc: getOptimizedUrl(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
21
+ xlSrc: getOptimizedUrl(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
22
+ fallbackSrc: getFallbackUrl(contentfulAssetUrl, dimension, xl, quality)
23
+ }
24
+ }
@@ -1,5 +1,6 @@
1
1
  import getOptimizedUrl from './getOptimizedUrl'
2
2
  import getFallbackUrl from './getFallbackUrl'
3
3
  import hasWebpSupport from './hasWebpSupport'
4
+ import getImageUrls from './getImageUrls'
4
5
 
5
- export { getOptimizedUrl, getFallbackUrl, hasWebpSupport }
6
+ export { getOptimizedUrl, getFallbackUrl, hasWebpSupport, getImageUrls }
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react'
1
+ import React, { forwardRef, useMemo } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styled from 'styled-components'
4
4
  import { selectSystemProps, getTokensPropType, variantProp } from '@telus-uds/components-base'
@@ -19,22 +19,31 @@ const StyledOrderedListBase = styled(OrderedListBase)(({ start }) => ({
19
19
  * Themed semantic ordered list.
20
20
  */
21
21
  const OrderedList = forwardRef(({ children, start, variant, ...rest }, ref) => {
22
+ // Check if children is an array
23
+ const isChildrenArray = Array.isArray(children)
24
+
22
25
  // Pass any variants "OrderedList" receives down to the individual list items.
23
- const childrenWithParentVariants = variant
24
- ? children.map((child) => {
25
- const existingChildVariants = child.props?.variant ?? {}
26
- return {
27
- ...child,
28
- props: {
29
- ...child.props,
30
- variant: {
31
- ...existingChildVariants,
32
- ...variant
33
- }
34
- }
26
+ const childrenWithParentVariants = useMemo(() => {
27
+ const addVariantToProps = (child) => {
28
+ const existingChildVariants = child.props?.variant ?? {}
29
+ return React.cloneElement(child, {
30
+ variant: {
31
+ ...existingChildVariants,
32
+ ...variant
35
33
  }
36
34
  })
37
- : children
35
+ }
36
+
37
+ if (variant) {
38
+ if (isChildrenArray) {
39
+ return children.map(addVariantToProps)
40
+ }
41
+ return [addVariantToProps(children)]
42
+ }
43
+
44
+ return children
45
+ }, [children, variant, isChildrenArray])
46
+
38
47
  return (
39
48
  <StyledOrderedListBase {...selectProps(rest)} ref={ref} start={start}>
40
49
  {childrenWithParentVariants}