@telus-uds/components-web 4.11.3 → 4.12.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,16 +1,18 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Wed, 10 Sep 2025 05:55:44 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 12 Sep 2025 04:42:14 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 4.11.3
7
+ ## 4.12.0
8
8
 
9
- Wed, 10 Sep 2025 05:55:44 GMT
9
+ Fri, 12 Sep 2025 04:42:14 GMT
10
10
 
11
- ### Patches
11
+ ### Minor changes
12
12
 
13
- - Bump @telus-uds/components-base to v3.15.0
13
+ - `PriceLockup`: add price baseline story (guillermo.peitzner@telus.com)
14
+ - Bump @telus-uds/components-base to v3.17.0
15
+ - Bump @telus-uds/system-theme-tokens to v4.14.0
14
16
 
15
17
  ## 4.10.0
16
18
 
@@ -14,6 +14,7 @@ var _utils = require("../utils");
14
14
  var _dictionary = _interopRequireDefault(require("./dictionary"));
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ const PRICE_BASELINE_VARIANT = 'baseline';
17
18
  const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs, _componentsBase.a11yProps]);
18
19
  const PriceLockupContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
19
20
  displayName: "PriceLockup__PriceLockupContainer",
@@ -199,6 +200,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref16, ref) => {
199
200
  viewport,
200
201
  strikeThrough
201
202
  });
203
+ const isPriceBaseline = variant?.price === PRICE_BASELINE_VARIANT;
202
204
  const typographyTokens = (0, _tokens.default)(themeTokens);
203
205
  const priceString = String(price);
204
206
  const lastDotPosition = priceString.lastIndexOf('.');
@@ -328,14 +330,23 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref16, ref) => {
328
330
  const {
329
331
  price: dictionaryPrice,
330
332
  priceWithCents,
331
- rate
333
+ priceLeft,
334
+ priceWithCentsLeft,
335
+ rate,
336
+ rateOnly
332
337
  } = dictionary[copy];
333
- let ariaLabel = hasCents ? priceWithCents.replace('%{amount}', amount).replace('%{cents}', cents).replace('%{currency}', currencySymbol) : dictionaryPrice.replace('%{amount}', amount).replace('%{currency}', currencySymbol);
334
- if (!ariaLabel.includes(currencySymbol)) {
338
+ const priceTemplate = isPriceBaseline ? priceLeft : dictionaryPrice;
339
+ const priceWithCentsTemplate = isPriceBaseline ? priceWithCentsLeft : priceWithCents;
340
+ let ariaLabel = hasCents ? priceWithCentsTemplate?.replace('%{amount}', amount).replace('%{separator}', separator).replace('%{cents}', cents).replace('%{currency}', currencySymbol) : priceTemplate?.replace('%{amount}', amount).replace('%{currency}', currencySymbol);
341
+ if (!ariaLabel?.includes(currencySymbol)) {
335
342
  ariaLabel = `${ariaLabel} ${currencySymbol}`;
336
343
  }
337
344
  if (rateText) {
338
- ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
345
+ if (isPriceBaseline) {
346
+ ariaLabel += ` ${rateOnly.replace('%{rateText}', getRateText(rateText))}`;
347
+ } else {
348
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
349
+ }
339
350
  }
340
351
  return ariaLabel;
341
352
  };
@@ -364,7 +375,10 @@ PriceLockup.displayName = 'PriceLockup';
364
375
  const dictionaryContentShape = _propTypes.default.shape({
365
376
  price: _propTypes.default.string.isRequired,
366
377
  priceWithCents: _propTypes.default.string.isRequired,
367
- rate: _propTypes.default.string.isRequired
378
+ priceLeft: _propTypes.default.string.isRequired,
379
+ priceWithCentsLeft: _propTypes.default.string.isRequired,
380
+ rate: _propTypes.default.string.isRequired,
381
+ rateOnly: _propTypes.default.string.isRequired
368
382
  });
369
383
  PriceLockup.propTypes = {
370
384
  ...selectedSystemPropTypes,
@@ -8,11 +8,17 @@ var _default = exports.default = {
8
8
  en: {
9
9
  price: '%{amount} %{currency}',
10
10
  priceWithCents: '%{amount} %{currency} and %{cents} cents',
11
- rate: 'per %{rateText}'
11
+ priceLeft: '%{currency} %{amount}',
12
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
13
+ rate: 'per %{rateText}',
14
+ rateOnly: ' %{rateText}'
12
15
  },
13
16
  fr: {
14
17
  price: '%{amount} %{currency}',
15
18
  priceWithCents: '%{amount} %{currency} et %{cents} centimes',
16
- rate: 'par %{rateText}'
19
+ priceLeft: '%{currency} %{amount}',
20
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
21
+ rate: 'par %{rateText}',
22
+ rateOnly: ' %{rateText}'
17
23
  }
18
24
  };
@@ -7,6 +7,7 @@ import getTypographyTokens from './tokens';
7
7
  import { htmlAttrs, warn } from '../utils';
8
8
  import defaultDictionary from './dictionary';
9
9
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const PRICE_BASELINE_VARIANT = 'baseline';
10
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, a11yProps]);
11
12
  const PriceLockupContainer = /*#__PURE__*/styled.div.withConfig({
12
13
  displayName: "PriceLockup__PriceLockupContainer",
@@ -192,6 +193,7 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref16, ref) => {
192
193
  viewport,
193
194
  strikeThrough
194
195
  });
196
+ const isPriceBaseline = variant?.price === PRICE_BASELINE_VARIANT;
195
197
  const typographyTokens = getTypographyTokens(themeTokens);
196
198
  const priceString = String(price);
197
199
  const lastDotPosition = priceString.lastIndexOf('.');
@@ -321,14 +323,23 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref16, ref) => {
321
323
  const {
322
324
  price: dictionaryPrice,
323
325
  priceWithCents,
324
- rate
326
+ priceLeft,
327
+ priceWithCentsLeft,
328
+ rate,
329
+ rateOnly
325
330
  } = dictionary[copy];
326
- let ariaLabel = hasCents ? priceWithCents.replace('%{amount}', amount).replace('%{cents}', cents).replace('%{currency}', currencySymbol) : dictionaryPrice.replace('%{amount}', amount).replace('%{currency}', currencySymbol);
327
- if (!ariaLabel.includes(currencySymbol)) {
331
+ const priceTemplate = isPriceBaseline ? priceLeft : dictionaryPrice;
332
+ const priceWithCentsTemplate = isPriceBaseline ? priceWithCentsLeft : priceWithCents;
333
+ let ariaLabel = hasCents ? priceWithCentsTemplate?.replace('%{amount}', amount).replace('%{separator}', separator).replace('%{cents}', cents).replace('%{currency}', currencySymbol) : priceTemplate?.replace('%{amount}', amount).replace('%{currency}', currencySymbol);
334
+ if (!ariaLabel?.includes(currencySymbol)) {
328
335
  ariaLabel = `${ariaLabel} ${currencySymbol}`;
329
336
  }
330
337
  if (rateText) {
331
- ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
338
+ if (isPriceBaseline) {
339
+ ariaLabel += ` ${rateOnly.replace('%{rateText}', getRateText(rateText))}`;
340
+ } else {
341
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`;
342
+ }
332
343
  }
333
344
  return ariaLabel;
334
345
  };
@@ -357,7 +368,10 @@ PriceLockup.displayName = 'PriceLockup';
357
368
  const dictionaryContentShape = PropTypes.shape({
358
369
  price: PropTypes.string.isRequired,
359
370
  priceWithCents: PropTypes.string.isRequired,
360
- rate: PropTypes.string.isRequired
371
+ priceLeft: PropTypes.string.isRequired,
372
+ priceWithCentsLeft: PropTypes.string.isRequired,
373
+ rate: PropTypes.string.isRequired,
374
+ rateOnly: PropTypes.string.isRequired
361
375
  });
362
376
  PriceLockup.propTypes = {
363
377
  ...selectedSystemPropTypes,
@@ -2,11 +2,17 @@ export default {
2
2
  en: {
3
3
  price: '%{amount} %{currency}',
4
4
  priceWithCents: '%{amount} %{currency} and %{cents} cents',
5
- rate: 'per %{rateText}'
5
+ priceLeft: '%{currency} %{amount}',
6
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
7
+ rate: 'per %{rateText}',
8
+ rateOnly: ' %{rateText}'
6
9
  },
7
10
  fr: {
8
11
  price: '%{amount} %{currency}',
9
12
  priceWithCents: '%{amount} %{currency} et %{cents} centimes',
10
- rate: 'par %{rateText}'
13
+ priceLeft: '%{currency} %{amount}',
14
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
15
+ rate: 'par %{rateText}',
16
+ rateOnly: ' %{rateText}'
11
17
  }
12
18
  };
package/package.json CHANGED
@@ -5,9 +5,9 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "^3.15.0",
8
+ "@telus-uds/components-base": "^3.17.0",
9
9
  "@telus-uds/system-constants": "^3.0.0",
10
- "@telus-uds/system-theme-tokens": "^4.13.0",
10
+ "@telus-uds/system-theme-tokens": "^4.14.0",
11
11
  "fscreen": "^1.2.0",
12
12
  "lodash.omit": "^4.5.0",
13
13
  "lodash.throttle": "^4.1.1",
@@ -83,5 +83,5 @@
83
83
  "skip": true
84
84
  },
85
85
  "types": "types/index.d.ts",
86
- "version": "4.11.3"
86
+ "version": "4.12.0"
87
87
  }
@@ -16,6 +16,8 @@ import getTypographyTokens from './tokens'
16
16
  import { htmlAttrs, warn } from '../utils'
17
17
  import defaultDictionary from './dictionary'
18
18
 
19
+ const PRICE_BASELINE_VARIANT = 'baseline'
20
+
19
21
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, a11yProps])
20
22
 
21
23
  const PriceLockupContainer = styled.div`
@@ -168,6 +170,8 @@ const PriceLockup = React.forwardRef(
168
170
  { viewport, strikeThrough }
169
171
  )
170
172
 
173
+ const isPriceBaseline = variant?.price === PRICE_BASELINE_VARIANT
174
+
171
175
  const typographyTokens = getTypographyTokens(themeTokens)
172
176
  const priceString = String(price)
173
177
  const lastDotPosition = priceString.lastIndexOf('.')
@@ -315,20 +319,36 @@ const PriceLockup = React.forwardRef(
315
319
  }
316
320
 
317
321
  const getAriaContent = () => {
318
- const { price: dictionaryPrice, priceWithCents, rate } = dictionary[copy]
322
+ const {
323
+ price: dictionaryPrice,
324
+ priceWithCents,
325
+ priceLeft,
326
+ priceWithCentsLeft,
327
+ rate,
328
+ rateOnly
329
+ } = dictionary[copy]
330
+
331
+ const priceTemplate = isPriceBaseline ? priceLeft : dictionaryPrice
332
+ const priceWithCentsTemplate = isPriceBaseline ? priceWithCentsLeft : priceWithCents
333
+
319
334
  let ariaLabel = hasCents
320
- ? priceWithCents
321
- .replace('%{amount}', amount)
335
+ ? priceWithCentsTemplate
336
+ ?.replace('%{amount}', amount)
337
+ .replace('%{separator}', separator)
322
338
  .replace('%{cents}', cents)
323
339
  .replace('%{currency}', currencySymbol)
324
- : dictionaryPrice.replace('%{amount}', amount).replace('%{currency}', currencySymbol)
340
+ : priceTemplate?.replace('%{amount}', amount).replace('%{currency}', currencySymbol)
325
341
 
326
- if (!ariaLabel.includes(currencySymbol)) {
342
+ if (!ariaLabel?.includes(currencySymbol)) {
327
343
  ariaLabel = `${ariaLabel} ${currencySymbol}`
328
344
  }
329
345
 
330
346
  if (rateText) {
331
- ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`
347
+ if (isPriceBaseline) {
348
+ ariaLabel += ` ${rateOnly.replace('%{rateText}', getRateText(rateText))}`
349
+ } else {
350
+ ariaLabel += ` ${rate.replace('%{rateText}', getRateText(rateText))}`
351
+ }
332
352
  }
333
353
  return ariaLabel
334
354
  }
@@ -368,7 +388,10 @@ PriceLockup.displayName = 'PriceLockup'
368
388
  const dictionaryContentShape = PropTypes.shape({
369
389
  price: PropTypes.string.isRequired,
370
390
  priceWithCents: PropTypes.string.isRequired,
371
- rate: PropTypes.string.isRequired
391
+ priceLeft: PropTypes.string.isRequired,
392
+ priceWithCentsLeft: PropTypes.string.isRequired,
393
+ rate: PropTypes.string.isRequired,
394
+ rateOnly: PropTypes.string.isRequired
372
395
  })
373
396
 
374
397
  PriceLockup.propTypes = {
@@ -2,11 +2,17 @@ export default {
2
2
  en: {
3
3
  price: '%{amount} %{currency}',
4
4
  priceWithCents: '%{amount} %{currency} and %{cents} cents',
5
- rate: 'per %{rateText}'
5
+ priceLeft: '%{currency} %{amount}',
6
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
7
+ rate: 'per %{rateText}',
8
+ rateOnly: ' %{rateText}'
6
9
  },
7
10
  fr: {
8
11
  price: '%{amount} %{currency}',
9
12
  priceWithCents: '%{amount} %{currency} et %{cents} centimes',
10
- rate: 'par %{rateText}'
13
+ priceLeft: '%{currency} %{amount}',
14
+ priceWithCentsLeft: '%{currency} %{amount}%{separator}%{cents}',
15
+ rate: 'par %{rateText}',
16
+ rateOnly: ' %{rateText}'
11
17
  }
12
18
  }