@telus-uds/components-web 2.29.0 → 2.31.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,40 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Thu, 18 Jan 2024 22:43:26 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 07 Feb 2024 19:09:40 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.31.0
8
+
9
+ Wed, 07 Feb 2024 19:09:40 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - updating optimizeimage to support ssr (sergiy.andronov1@telus.com)
14
+ - migrate pricelockup to component-base (chris.tafts@telus.com)
15
+ - Bump @telus-uds/components-base to v1.76.0
16
+
17
+ ### Patches
18
+
19
+ - fix ordered-list component single child render (guillermo.peitzner@telus.com)
20
+
21
+ ## 2.30.0
22
+
23
+ Mon, 29 Jan 2024 18:41:50 GMT
24
+
25
+ ### Minor changes
26
+
27
+ - Add "use client" directive to Image (wlsdud194@hotmail.com)
28
+ - Bump @telus-uds/components-base to v1.75.0
29
+ - Bump @telus-uds/system-theme-tokens to v2.50.1
30
+
31
+ ### Patches
32
+
33
+ - fix termsAndCondition component visual states (guillermo.peitzner@telus.com)
34
+
7
35
  ## 2.29.0
8
36
 
9
- Thu, 18 Jan 2024 22:43:26 GMT
37
+ Thu, 18 Jan 2024 22:55:53 GMT
10
38
 
11
39
  ### Minor changes
12
40
 
@@ -87,6 +87,7 @@ const FootnoteLink = _ref2 => {
87
87
  "aria-label": getCopy('a11yLabel'),
88
88
  ref: refs[index],
89
89
  onClick: event => handleOnClick(event, index),
90
+ tabIndex: 0,
90
91
  ...selectProps(rest),
91
92
  ...themeTokens,
92
93
  fontSize: fontSize,
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
@@ -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,
@@ -52,12 +52,32 @@ const ExpandCollapseTitle = /*#__PURE__*/_styledComponents.default.h4.withConfig
52
52
  margin: `${tokens.expandTitleMarginX}px ${tokens.expandTitleMarginY}px`
53
53
  };
54
54
  });
55
- const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
55
+ const getIconButtonTokens = _ref3 => {
56
+ let {
57
+ icon,
58
+ iconBackgroundColor,
59
+ iconBorderColor,
60
+ iconColor,
61
+ iconOuterBorderColor,
62
+ iconOuterBorderGap,
63
+ iconOuterBorderWidth
64
+ } = _ref3;
65
+ return {
66
+ icon,
67
+ backgroundColor: iconBackgroundColor,
68
+ borderColor: iconBorderColor,
69
+ iconColor,
70
+ outerBorderColor: iconOuterBorderColor,
71
+ outerBorderGap: iconOuterBorderGap,
72
+ outerBorderWidth: iconOuterBorderWidth
73
+ };
74
+ };
75
+ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
56
76
  let {
57
77
  children,
58
78
  collapseTitle,
59
79
  expandTitle = collapseTitle
60
- } = _ref3;
80
+ } = _ref4;
61
81
  const getTokens = (0, _componentsBase.useThemeTokensCallback)('TermsAndConditions', {}, {});
62
82
  const {
63
83
  expandBaseBorderWidth,
@@ -94,20 +114,17 @@ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
94
114
  const {
95
115
  expanded
96
116
  } = pressableState || {};
97
- const {
98
- icon
99
- } = getTokens({
100
- expanded
101
- });
117
+ const iconTokens = getIconButtonTokens(getTokens(pressableState || {}));
102
118
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ExpandCollapseControl, {
103
119
  ref: ref,
104
120
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandCollapseIconContainer, {
105
121
  tokens: getTokens(),
106
122
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
107
- icon: icon,
108
123
  variant: {
109
124
  size: 'small'
110
- }
125
+ },
126
+ tokens: iconTokens,
127
+ focusable: false
111
128
  })
112
129
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandCollapseTitle, {
113
130
  tokens: getTokens(),
@@ -81,6 +81,7 @@ const FootnoteLink = _ref2 => {
81
81
  "aria-label": getCopy('a11yLabel'),
82
82
  ref: refs[index],
83
83
  onClick: event => handleOnClick(event, index),
84
+ tabIndex: 0,
84
85
  ...selectProps(rest),
85
86
  ...themeTokens,
86
87
  fontSize: fontSize,
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import Image from './Image';
2
4
  import withClientTheme from '../utils/theming/with-client-theme';
3
5
 
@@ -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,
@@ -44,12 +44,32 @@ const ExpandCollapseTitle = /*#__PURE__*/styled.h4.withConfig({
44
44
  margin: `${tokens.expandTitleMarginX}px ${tokens.expandTitleMarginY}px`
45
45
  };
46
46
  });
47
- const ExpandCollapse = /*#__PURE__*/forwardRef((_ref3, ref) => {
47
+ const getIconButtonTokens = _ref3 => {
48
+ let {
49
+ icon,
50
+ iconBackgroundColor,
51
+ iconBorderColor,
52
+ iconColor,
53
+ iconOuterBorderColor,
54
+ iconOuterBorderGap,
55
+ iconOuterBorderWidth
56
+ } = _ref3;
57
+ return {
58
+ icon,
59
+ backgroundColor: iconBackgroundColor,
60
+ borderColor: iconBorderColor,
61
+ iconColor,
62
+ outerBorderColor: iconOuterBorderColor,
63
+ outerBorderGap: iconOuterBorderGap,
64
+ outerBorderWidth: iconOuterBorderWidth
65
+ };
66
+ };
67
+ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref4, ref) => {
48
68
  let {
49
69
  children,
50
70
  collapseTitle,
51
71
  expandTitle = collapseTitle
52
- } = _ref3;
72
+ } = _ref4;
53
73
  const getTokens = useThemeTokensCallback('TermsAndConditions', {}, {});
54
74
  const {
55
75
  expandBaseBorderWidth,
@@ -86,20 +106,17 @@ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref3, ref) => {
86
106
  const {
87
107
  expanded
88
108
  } = pressableState || {};
89
- const {
90
- icon
91
- } = getTokens({
92
- expanded
93
- });
109
+ const iconTokens = getIconButtonTokens(getTokens(pressableState || {}));
94
110
  return /*#__PURE__*/_jsxs(ExpandCollapseControl, {
95
111
  ref: ref,
96
112
  children: [/*#__PURE__*/_jsx(ExpandCollapseIconContainer, {
97
113
  tokens: getTokens(),
98
114
  children: /*#__PURE__*/_jsx(IconButton, {
99
- icon: icon,
100
115
  variant: {
101
116
  size: 'small'
102
- }
117
+ },
118
+ tokens: iconTokens,
119
+ focusable: false
103
120
  })
104
121
  }), /*#__PURE__*/_jsx(ExpandCollapseTitle, {
105
122
  tokens: getTokens(),
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.74.0",
8
+ "@telus-uds/components-base": "1.76.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.0",
16
+ "@telus-uds/system-theme-tokens": "^2.50.1",
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.29.0"
86
+ "version": "2.31.0"
87
87
  }
@@ -80,6 +80,7 @@ const FootnoteLink = ({
80
80
  key={num}
81
81
  ref={refs[index]}
82
82
  onClick={(event) => handleOnClick(event, index)}
83
+ tabIndex={0}
83
84
  {...selectProps(rest)}
84
85
  {...themeTokens}
85
86
  fontSize={fontSize}
@@ -1,3 +1,5 @@
1
+ 'use client'
2
+
1
3
  import Image from './Image'
2
4
  import withClientTheme from '../utils/theming/with-client-theme'
3
5
 
@@ -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}
@@ -31,6 +31,24 @@ const ExpandCollapseTitle = styled.h4(({ tokens }) => ({
31
31
  margin: `${tokens.expandTitleMarginX}px ${tokens.expandTitleMarginY}px`
32
32
  }))
33
33
 
34
+ const getIconButtonTokens = ({
35
+ icon,
36
+ iconBackgroundColor,
37
+ iconBorderColor,
38
+ iconColor,
39
+ iconOuterBorderColor,
40
+ iconOuterBorderGap,
41
+ iconOuterBorderWidth
42
+ }) => ({
43
+ icon,
44
+ backgroundColor: iconBackgroundColor,
45
+ borderColor: iconBorderColor,
46
+ iconColor,
47
+ outerBorderColor: iconOuterBorderColor,
48
+ outerBorderGap: iconOuterBorderGap,
49
+ outerBorderWidth: iconOuterBorderWidth
50
+ })
51
+
34
52
  const ExpandCollapse = forwardRef(
35
53
  ({ children, collapseTitle, expandTitle = collapseTitle }, ref) => {
36
54
  const getTokens = useThemeTokensCallback('TermsAndConditions', {}, {})
@@ -69,13 +87,13 @@ const ExpandCollapse = forwardRef(
69
87
  // eslint-disable-next-line react/no-unstable-nested-components
70
88
  control={(pressableState) => {
71
89
  const { expanded } = pressableState || {}
72
- const { icon } = getTokens({ expanded })
90
+ const iconTokens = getIconButtonTokens(getTokens(pressableState || {}))
73
91
 
74
92
  return (
75
93
  <ExpandCollapseControl ref={ref}>
76
94
  <ExpandCollapseIconContainer tokens={getTokens()}>
77
95
  {/* Can use `Icon` instead of `IconButton` but `Icon` does not have required stylistic variants */}
78
- <IconButton icon={icon} variant={{ size: 'small' }} />
96
+ <IconButton variant={{ size: 'small' }} tokens={iconTokens} focusable={false} />
79
97
  </ExpandCollapseIconContainer>
80
98
  <ExpandCollapseTitle tokens={getTokens()}>
81
99
  {expanded ? expandTitle : collapseTitle}