@telus-uds/components-web 4.1.0 → 4.2.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,28 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Mon, 10 Feb 2025 17:30:58 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 14 Feb 2025 18:59:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 4.2.0
8
+
9
+ Fri, 14 Feb 2025 18:59:39 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `PriceLockup`: ability to receive jsx elements in rateText prop added (35577399+JoshHC@users.noreply.github.com)
14
+ - Bump @telus-uds/components-base to v3.2.0
15
+ - Bump @telus-uds/system-theme-tokens to v4.2.0
16
+
17
+ ### Patches
18
+
19
+ - `DatePicker`: remove warnings when opening the component (Mauricio.BatresMontejo@telus.com)
20
+ - `Test`: Update snapshots (sergio.ramirez@telus.com)
21
+ - `Spinner`: fix positioning when overlying a button (guillermo.peitzner@telus.com)
22
+
7
23
  ## 4.1.0
8
24
 
9
- Mon, 10 Feb 2025 17:30:58 GMT
25
+ Mon, 10 Feb 2025 17:36:47 GMT
10
26
 
11
27
  ### Minor changes
12
28
 
@@ -73,6 +73,10 @@ const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
73
73
  }
74
74
  return () => (0, _moment.default)(initialVisibleMonth);
75
75
  };
76
+ const HiddenInputFieldContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
77
+ displayName: "DatePicker__HiddenInputFieldContainer",
78
+ componentId: "components-web__sc-mz8fi3-3"
79
+ })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
76
80
 
77
81
  /**
78
82
  * Use DatePicker to select a date on a calendar.
@@ -258,10 +262,6 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
258
262
  const viewport = (0, _componentsBase.useViewport)();
259
263
  const daySize = getResponsiveDaySize(inline, viewport);
260
264
  const circleSize = getResponsiveCircleSize(inline, viewport);
261
- const HiddenInputFieldContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
262
- displayName: "DatePicker__HiddenInputFieldContainer",
263
- componentId: "components-web__sc-mz8fi3-3"
264
- })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
265
265
  const {
266
266
  hiddenInputFieldContainerHeight,
267
267
  hiddenInputFieldContainerWidth,
@@ -284,9 +284,29 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref16, ref) => {
284
284
  if (strikeThrough && !a11yText) {
285
285
  (0, _utils.warn)('PriceLockup', 'a11yText must be provided with strikethrough pricing');
286
286
  }
287
+
288
+ /**
289
+ * Converts rateText to string if rateText is an JSX.
290
+ */
291
+ function getRateText(rateTextValue) {
292
+ if (!rateTextValue) return '';
293
+ switch (typeof rateTextValue) {
294
+ case 'string':
295
+ return rateTextValue.replace('/', '');
296
+ case 'object':
297
+ if (/*#__PURE__*/_react.default.isValidElement(rateTextValue)) {
298
+ return _react.default.Children.toArray(rateTextValue.props.children).map(getRateText).join('');
299
+ }
300
+ // If it's an object but not a React element, return empty string
301
+ break;
302
+ default:
303
+ break;
304
+ }
305
+ return '';
306
+ }
287
307
  const getAriaContent = () => {
288
308
  const {
289
- dictionaryPrice = price,
309
+ price: dictionaryPrice,
290
310
  priceWithCents,
291
311
  rate
292
312
  } = dictionary[copy];
@@ -295,7 +315,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref16, ref) => {
295
315
  ariaLabel = `${ariaLabel} ${currencySymbol}`;
296
316
  }
297
317
  if (rateText) {
298
- ariaLabel += ` ${rate.replace('%{rateText}', rateText.replace('/', ''))}`;
318
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
299
319
  }
300
320
  return ariaLabel;
301
321
  };
@@ -349,7 +369,7 @@ PriceLockup.propTypes = {
349
369
  /**
350
370
  * Shows month/year unit
351
371
  */
352
- rateText: _propTypes.default.string,
372
+ rateText: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
353
373
  /**
354
374
  * Shows additional info below the price with a `Divider`
355
375
  */
@@ -21,12 +21,13 @@ const SpinnerContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
21
21
  })(_ref => {
22
22
  let {
23
23
  inline,
24
- fullScreen
24
+ fullScreen,
25
+ overlay
25
26
  } = _ref;
26
27
  return {
27
28
  position: 'relative',
28
29
  ...(inline && {
29
- display: 'block',
30
+ display: overlay ? 'inline-block' : 'block',
30
31
  ...(0, _utils.media)().from('md').css({
31
32
  display: 'inline-block'
32
33
  })
@@ -139,6 +140,7 @@ const Spinner = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
139
140
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(SpinnerContainer, {
140
141
  inline: inline,
141
142
  "aria-live": "assertive",
143
+ overlay: true,
142
144
  ...selectProps(rest),
143
145
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpinnerContent.default, {
144
146
  label: label,
@@ -66,6 +66,10 @@ const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
66
66
  }
67
67
  return () => moment(initialVisibleMonth);
68
68
  };
69
+ const HiddenInputFieldContainer = /*#__PURE__*/styled.div.withConfig({
70
+ displayName: "DatePicker__HiddenInputFieldContainer",
71
+ componentId: "components-web__sc-mz8fi3-3"
72
+ })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
69
73
 
70
74
  /**
71
75
  * Use DatePicker to select a date on a calendar.
@@ -251,10 +255,6 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
251
255
  const viewport = useViewport();
252
256
  const daySize = getResponsiveDaySize(inline, viewport);
253
257
  const circleSize = getResponsiveCircleSize(inline, viewport);
254
- const HiddenInputFieldContainer = /*#__PURE__*/styled.div.withConfig({
255
- displayName: "DatePicker__HiddenInputFieldContainer",
256
- componentId: "components-web__sc-mz8fi3-3"
257
- })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
258
258
  const {
259
259
  hiddenInputFieldContainerHeight,
260
260
  hiddenInputFieldContainerWidth,
@@ -277,9 +277,29 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref16, ref) => {
277
277
  if (strikeThrough && !a11yText) {
278
278
  warn('PriceLockup', 'a11yText must be provided with strikethrough pricing');
279
279
  }
280
+
281
+ /**
282
+ * Converts rateText to string if rateText is an JSX.
283
+ */
284
+ function getRateText(rateTextValue) {
285
+ if (!rateTextValue) return '';
286
+ switch (typeof rateTextValue) {
287
+ case 'string':
288
+ return rateTextValue.replace('/', '');
289
+ case 'object':
290
+ if (/*#__PURE__*/React.isValidElement(rateTextValue)) {
291
+ return React.Children.toArray(rateTextValue.props.children).map(getRateText).join('');
292
+ }
293
+ // If it's an object but not a React element, return empty string
294
+ break;
295
+ default:
296
+ break;
297
+ }
298
+ return '';
299
+ }
280
300
  const getAriaContent = () => {
281
301
  const {
282
- dictionaryPrice = price,
302
+ price: dictionaryPrice,
283
303
  priceWithCents,
284
304
  rate
285
305
  } = dictionary[copy];
@@ -288,7 +308,7 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref16, ref) => {
288
308
  ariaLabel = `${ariaLabel} ${currencySymbol}`;
289
309
  }
290
310
  if (rateText) {
291
- ariaLabel += ` ${rate.replace('%{rateText}', rateText.replace('/', ''))}`;
311
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
292
312
  }
293
313
  return ariaLabel;
294
314
  };
@@ -342,7 +362,7 @@ PriceLockup.propTypes = {
342
362
  /**
343
363
  * Shows month/year unit
344
364
  */
345
- rateText: PropTypes.string,
365
+ rateText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
346
366
  /**
347
367
  * Shows additional info below the price with a `Divider`
348
368
  */
@@ -14,12 +14,13 @@ const SpinnerContainer = /*#__PURE__*/styled.div.withConfig({
14
14
  })(_ref => {
15
15
  let {
16
16
  inline,
17
- fullScreen
17
+ fullScreen,
18
+ overlay
18
19
  } = _ref;
19
20
  return {
20
21
  position: 'relative',
21
22
  ...(inline && {
22
- display: 'block',
23
+ display: overlay ? 'inline-block' : 'block',
23
24
  ...media().from('md').css({
24
25
  display: 'inline-block'
25
26
  })
@@ -132,6 +133,7 @@ const Spinner = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
132
133
  return /*#__PURE__*/_jsxs(SpinnerContainer, {
133
134
  inline: inline,
134
135
  "aria-live": "assertive",
136
+ overlay: true,
135
137
  ...selectProps(rest),
136
138
  children: [/*#__PURE__*/_jsx(SpinnerContent, {
137
139
  label: label,
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": "^3.1.0",
8
+ "@telus-uds/components-base": "^3.2.0",
9
9
  "@telus-uds/system-constants": "^3.0.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": "^4.1.0",
16
+ "@telus-uds/system-theme-tokens": "^4.2.0",
17
17
  "prop-types": "^15.7.2",
18
18
  "lodash.throttle": "^4.1.1",
19
19
  "react-youtube": "^10.1.0",
@@ -82,5 +82,5 @@
82
82
  "skip": true
83
83
  },
84
84
  "types": "types/index.d.ts",
85
- "version": "4.1.0"
85
+ "version": "4.2.0"
86
86
  }
@@ -61,6 +61,12 @@ const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
61
61
  return () => moment(initialVisibleMonth)
62
62
  }
63
63
 
64
+ const HiddenInputFieldContainer = styled.div`
65
+ height: ${(props) => props.height};
66
+ width: ${(props) => props.width};
67
+ overflow: hidden;
68
+ `
69
+
64
70
  /**
65
71
  * Use DatePicker to select a date on a calendar.
66
72
  *
@@ -260,12 +266,6 @@ const DatePicker = React.forwardRef(
260
266
  const daySize = getResponsiveDaySize(inline, viewport)
261
267
  const circleSize = getResponsiveCircleSize(inline, viewport)
262
268
 
263
- const HiddenInputFieldContainer = styled.div`
264
- height: ${(props) => props.height};
265
- width: ${(props) => props.width};
266
- overflow: hidden;
267
- `
268
-
269
269
  const {
270
270
  hiddenInputFieldContainerHeight,
271
271
  hiddenInputFieldContainerWidth,
@@ -251,8 +251,32 @@ const PriceLockup = React.forwardRef(
251
251
  warn('PriceLockup', 'a11yText must be provided with strikethrough pricing')
252
252
  }
253
253
 
254
+ /**
255
+ * Converts rateText to string if rateText is an JSX.
256
+ */
257
+ function getRateText(rateTextValue) {
258
+ if (!rateTextValue) return ''
259
+
260
+ switch (typeof rateTextValue) {
261
+ case 'string':
262
+ return rateTextValue.replace('/', '')
263
+
264
+ case 'object':
265
+ if (React.isValidElement(rateTextValue)) {
266
+ return React.Children.toArray(rateTextValue.props.children).map(getRateText).join('')
267
+ }
268
+ // If it's an object but not a React element, return empty string
269
+ break
270
+
271
+ default:
272
+ break
273
+ }
274
+
275
+ return ''
276
+ }
277
+
254
278
  const getAriaContent = () => {
255
- const { dictionaryPrice = price, priceWithCents, rate } = dictionary[copy]
279
+ const { price: dictionaryPrice, priceWithCents, rate } = dictionary[copy]
256
280
  let ariaLabel = hasCents
257
281
  ? priceWithCents
258
282
  .replace('%{amount}', amount)
@@ -265,7 +289,7 @@ const PriceLockup = React.forwardRef(
265
289
  }
266
290
 
267
291
  if (rateText) {
268
- ariaLabel += ` ${rate.replace('%{rateText}', rateText.replace('/', ''))}`
292
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`
269
293
  }
270
294
  return ariaLabel
271
295
  }
@@ -331,7 +355,7 @@ PriceLockup.propTypes = {
331
355
  /**
332
356
  * Shows month/year unit
333
357
  */
334
- rateText: PropTypes.string,
358
+ rateText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
335
359
  /**
336
360
  * Shows additional info below the price with a `Divider`
337
361
  */
@@ -14,10 +14,10 @@ import { BACKDROP_OPACITY, BACKDROP_Z_INDEX } from './constants'
14
14
 
15
15
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
16
16
 
17
- const SpinnerContainer = styled.div(({ inline, fullScreen }) => ({
17
+ const SpinnerContainer = styled.div(({ inline, fullScreen, overlay }) => ({
18
18
  position: 'relative',
19
19
  ...(inline && {
20
- display: 'block',
20
+ display: overlay ? 'inline-block' : 'block',
21
21
  ...media().from('md').css({
22
22
  display: 'inline-block'
23
23
  })
@@ -123,7 +123,7 @@ const Spinner = React.forwardRef(
123
123
  // Overlay spinner
124
124
  if (children) {
125
125
  return (
126
- <SpinnerContainer inline={inline} aria-live="assertive" {...selectProps(rest)}>
126
+ <SpinnerContainer inline={inline} aria-live="assertive" overlay {...selectProps(rest)}>
127
127
  <SpinnerContent
128
128
  label={label}
129
129
  labelPosition={labelPosition}