@telus-uds/components-base 1.30.0 → 1.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/component-docs.json +17 -0
  3. package/lib/ActivityIndicator/Spinner.js +7 -7
  4. package/lib/ActivityIndicator/Spinner.native.js +2 -2
  5. package/lib/BaseProvider/HydrationContext.js +1 -1
  6. package/lib/Box/Box.js +1 -1
  7. package/lib/Button/ButtonBase.js +2 -2
  8. package/lib/Button/ButtonGroup.js +1 -1
  9. package/lib/Carousel/Carousel.js +2 -4
  10. package/lib/Carousel/CarouselContext.js +1 -1
  11. package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
  12. package/lib/Carousel/CarouselThumbnail.js +2 -2
  13. package/lib/Checkbox/Checkbox.js +1 -1
  14. package/lib/Checkbox/CheckboxGroup.js +2 -2
  15. package/lib/Divider/Divider.js +2 -2
  16. package/lib/FlexGrid/Col/Col.js +1 -1
  17. package/lib/Icon/Icon.js +1 -1
  18. package/lib/List/ListItemContent.js +5 -2
  19. package/lib/List/PressableListItemBase.js +2 -0
  20. package/lib/MultiSelectFilter/MultiSelectFilter.js +2 -2
  21. package/lib/Pagination/PageButton.js +2 -2
  22. package/lib/Pagination/Pagination.js +3 -5
  23. package/lib/Pagination/usePagination.js +2 -2
  24. package/lib/Progress/ProgressBar.js +3 -3
  25. package/lib/Progress/ProgressBarBackground.js +3 -3
  26. package/lib/Radio/Radio.js +2 -2
  27. package/lib/Radio/RadioGroup.js +2 -2
  28. package/lib/RadioCard/RadioCard.js +1 -1
  29. package/lib/RadioCard/RadioCardGroup.js +2 -2
  30. package/lib/Search/Search.js +1 -1
  31. package/lib/SideNav/SideNav.js +2 -2
  32. package/lib/Skeleton/Skeleton.js +1 -1
  33. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  34. package/lib/StackView/StackWrap.js +1 -3
  35. package/lib/StackView/getStackedContent.js +2 -2
  36. package/lib/Tabs/Tabs.js +2 -4
  37. package/lib/Tags/Tags.js +1 -1
  38. package/lib/TextInput/TextInputBase.js +1 -1
  39. package/lib/ThemeProvider/utils/styles.js +8 -3
  40. package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
  41. package/lib/Timeline/Timeline.js +1 -1
  42. package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
  43. package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
  44. package/lib/Tooltip/Backdrop.js +10 -2
  45. package/lib/Tooltip/Tooltip.js +2 -2
  46. package/lib/Validator/Validator.js +14 -15
  47. package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
  48. package/lib/utils/children.js +2 -2
  49. package/lib/utils/input.js +13 -7
  50. package/lib/utils/props/componentPropType.js +3 -3
  51. package/lib/utils/props/selectSystemProps.js +2 -2
  52. package/lib/utils/props/tokens.js +2 -2
  53. package/lib/utils/useSpacingScale.js +1 -3
  54. package/lib/utils/useUniqueId.js +1 -1
  55. package/lib-module/ActivityIndicator/Spinner.js +7 -7
  56. package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
  57. package/lib-module/BaseProvider/HydrationContext.js +1 -1
  58. package/lib-module/Box/Box.js +1 -1
  59. package/lib-module/Button/ButtonBase.js +2 -2
  60. package/lib-module/Button/ButtonGroup.js +1 -1
  61. package/lib-module/Carousel/Carousel.js +2 -4
  62. package/lib-module/Carousel/CarouselContext.js +1 -1
  63. package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
  64. package/lib-module/Carousel/CarouselThumbnail.js +2 -2
  65. package/lib-module/Checkbox/Checkbox.js +1 -1
  66. package/lib-module/Checkbox/CheckboxGroup.js +2 -2
  67. package/lib-module/Divider/Divider.js +2 -2
  68. package/lib-module/FlexGrid/Col/Col.js +1 -1
  69. package/lib-module/Icon/Icon.js +1 -1
  70. package/lib-module/List/ListItemContent.js +5 -2
  71. package/lib-module/List/PressableListItemBase.js +2 -0
  72. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +2 -2
  73. package/lib-module/Pagination/PageButton.js +2 -2
  74. package/lib-module/Pagination/Pagination.js +3 -5
  75. package/lib-module/Pagination/usePagination.js +2 -2
  76. package/lib-module/Progress/ProgressBar.js +3 -3
  77. package/lib-module/Progress/ProgressBarBackground.js +3 -3
  78. package/lib-module/Radio/Radio.js +2 -2
  79. package/lib-module/Radio/RadioGroup.js +2 -2
  80. package/lib-module/RadioCard/RadioCard.js +1 -1
  81. package/lib-module/RadioCard/RadioCardGroup.js +2 -2
  82. package/lib-module/Search/Search.js +1 -1
  83. package/lib-module/SideNav/SideNav.js +2 -2
  84. package/lib-module/Skeleton/Skeleton.js +1 -1
  85. package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
  86. package/lib-module/StackView/StackWrap.js +1 -3
  87. package/lib-module/StackView/getStackedContent.js +2 -2
  88. package/lib-module/Tabs/Tabs.js +2 -4
  89. package/lib-module/Tags/Tags.js +1 -1
  90. package/lib-module/TextInput/TextInputBase.js +1 -1
  91. package/lib-module/ThemeProvider/utils/styles.js +8 -3
  92. package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
  93. package/lib-module/Timeline/Timeline.js +1 -1
  94. package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
  95. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
  96. package/lib-module/Tooltip/Backdrop.js +10 -2
  97. package/lib-module/Tooltip/Tooltip.js +2 -2
  98. package/lib-module/Validator/Validator.js +14 -15
  99. package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
  100. package/lib-module/utils/children.js +2 -2
  101. package/lib-module/utils/input.js +13 -7
  102. package/lib-module/utils/props/componentPropType.js +3 -3
  103. package/lib-module/utils/props/selectSystemProps.js +2 -2
  104. package/lib-module/utils/props/tokens.js +2 -2
  105. package/lib-module/utils/useSpacingScale.js +1 -3
  106. package/lib-module/utils/useUniqueId.js +1 -1
  107. package/package.json +2 -2
  108. package/src/List/ListItemContent.jsx +4 -2
  109. package/src/List/PressableListItemBase.jsx +2 -0
  110. package/src/ThemeProvider/utils/styles.js +5 -0
  111. package/src/Validator/Validator.jsx +2 -1
@@ -128,8 +128,6 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
128
128
  */
129
129
 
130
130
  const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
131
- var _systemProps$accessib;
132
-
133
131
  let {
134
132
  tokens,
135
133
  variant,
@@ -403,7 +401,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
403
401
  const getCopyWithPlaceholders = React.useCallback(copyKey => {
404
402
  const copyText = getCopy(copyKey).replace(/%\{title\}/g, title).replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, activeIndex + 1).replace(/%\{stepCount\}/g, childrenArray.length); // First word might be a lowercase placeholder: capitalize the first letter
405
403
 
406
- return "".concat(copyText[0].toUpperCase()).concat(copyText.slice(1));
404
+ return `${copyText[0].toUpperCase()}${copyText.slice(1)}`;
407
405
  }, [activeIndex, childrenArray.length, itemLabel, getCopy, title]);
408
406
  const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/_jsx(CarouselTabsPanel, {
409
407
  items: tabs
@@ -426,7 +424,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
426
424
  // otherwise read the current position on focus
427
425
 
428
426
 
429
- const containerAccessibilityLabel = ((_systemProps$accessib = systemProps.accessibilityLabel) !== null && _systemProps$accessib !== void 0 ? _systemProps$accessib : isFirstFocusContainer) ? "".concat(title ? "".concat(title, " ") : '').concat(getCopyWithPlaceholders('stepTrackerLabel')) : title;
427
+ const containerAccessibilityLabel = systemProps.accessibilityLabel ?? isFirstFocusContainer ? `${title ? `${title} ` : ''}${getCopyWithPlaceholders('stepTrackerLabel')}` : title;
430
428
  const containerProps = {
431
429
  accessibilityLabel: containerAccessibilityLabel,
432
430
  // If used for focus, attach the ref and draw a focus box around the whole carousel
@@ -36,7 +36,7 @@ function useCarousel() {
36
36
  const context = React.useContext(CarouselContext);
37
37
 
38
38
  if (context === undefined) {
39
- throw new Error("'useCarousel' must be used within a 'CarouselProvider'");
39
+ throw new Error(`'useCarousel' must be used within a 'CarouselProvider'`);
40
40
  }
41
41
 
42
42
  return context;
@@ -21,7 +21,7 @@ const CarouselFirstFocus = /*#__PURE__*/forwardRef((_ref, ref) => {
21
21
  } = useCarousel(); // TODO: integrate skip link description if behaving as skip link.
22
22
  // Consider moving this content to aria-live area while only the skip link is focused.
23
23
 
24
- const accessibilityLabel = "".concat(title, ", ").concat(getCopyWithPlaceholders('stepTrackerLabel'));
24
+ const accessibilityLabel = `${title}, ${getCopyWithPlaceholders('stepTrackerLabel')}`;
25
25
  const accessibilityRole = Platform.select({
26
26
  web: 'link',
27
27
  // The focused item will ultimately be a skip link.
@@ -25,7 +25,7 @@ const CarouselThumbnail = _ref => {
25
25
  goTo,
26
26
  themeTokens
27
27
  } = useCarousel();
28
- const thumbnailTitle = alt !== null && alt !== void 0 ? alt : getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
28
+ const thumbnailTitle = alt ?? getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
29
29
 
30
30
  const handlePress = () => goTo(index);
31
31
 
@@ -68,7 +68,7 @@ const CarouselThumbnail = _ref => {
68
68
  style: [styles.pressable, index === activeIndex && styles.selected],
69
69
  children: /*#__PURE__*/_jsx(Image, {
70
70
  accessibilityIgnoresInvertColors: true,
71
- accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : alt,
71
+ accessibilityLabel: accessibilityLabel ?? alt,
72
72
  source: src,
73
73
  style: styles.image,
74
74
  title: thumbnailTitle
@@ -187,7 +187,7 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
187
187
  };
188
188
 
189
189
  const uniqueId = useUniqueId('checkbox');
190
- const inputId = id !== null && id !== void 0 ? id : uniqueId;
190
+ const inputId = id ?? uniqueId;
191
191
  const {
192
192
  themeOptions
193
193
  } = useTheme();
@@ -97,7 +97,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
97
97
  const uniqueFields = ['id', 'label'];
98
98
 
99
99
  if (!containUniqueFields(items, uniqueFields)) {
100
- throw new Error("CheckboxGroup items must have unique ".concat(uniqueFields.join(', ')));
100
+ throw new Error(`CheckboxGroup items must have unique ${uniqueFields.join(', ')}`);
101
101
  }
102
102
 
103
103
  const checkboxes = items.map((_ref2, index) => {
@@ -108,7 +108,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
108
108
  ref: itemRef,
109
109
  ...itemRest
110
110
  } = _ref2;
111
- const checkboxId = id || "Checkbox[".concat(index, "]");
111
+ const checkboxId = id || `Checkbox[${index}]`;
112
112
 
113
113
  const handleChange = (newCheckedState, event) => {
114
114
  if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
@@ -101,9 +101,9 @@ const Divider = /*#__PURE__*/forwardRef((_ref, ref) => {
101
101
  };
102
102
  return /*#__PURE__*/_jsxs(_Fragment, {
103
103
  children: [/*#__PURE__*/_jsx(Spacer, { ...spacerProps,
104
- testID: testID ? "".concat(testID, "-Spacer-before") : undefined
104
+ testID: testID ? `${testID}-Spacer-before` : undefined
105
105
  }), divider, /*#__PURE__*/_jsx(Spacer, { ...spacerProps,
106
- testID: testID ? "".concat(testID, "-Spacer-after") : undefined
106
+ testID: testID ? `${testID}-Spacer-after` : undefined
107
107
  })]
108
108
  });
109
109
  });
@@ -44,7 +44,7 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
44
44
  const horizontalAlignLevel = getHorizontalAlignLevel();
45
45
 
46
46
  const toPercent = num => {
47
- return "".concat(num / 12 * 100, "%");
47
+ return `${num / 12 * 100}%`;
48
48
  };
49
49
 
50
50
  const calculateWidth = value => {
@@ -30,7 +30,7 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
30
30
  // TODO: systematise animations.
31
31
  // https://github.com/telus/universal-design-system/issues/487
32
32
  transition: 'transform 200ms, color 200ms',
33
- transform: [themeTokens.scale ? "scale(".concat(themeTokens.scale, ")") : '', themeTokens.translateX ? "translateX(".concat(themeTokens.translateX, "px)") : '', themeTokens.translateY ? "translateY(".concat(themeTokens.translateY, "px)") : ''].filter(exists => exists).join(' ')
33
+ transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
34
34
  },
35
35
  dataSet: dataSet,
36
36
  children: iconContent
@@ -9,7 +9,8 @@ export const tokenTypes = {
9
9
  itemFontWeight: PropTypes.string.isRequired,
10
10
  itemFontSize: PropTypes.number.isRequired,
11
11
  itemLineHeight: PropTypes.number.isRequired,
12
- itemFontName: PropTypes.string.isRequired
12
+ itemFontName: PropTypes.string.isRequired,
13
+ itemFontColor: PropTypes.string
13
14
  };
14
15
 
15
16
  const selectItemTextStyles = (_ref, themeOptions) => {
@@ -17,9 +18,11 @@ const selectItemTextStyles = (_ref, themeOptions) => {
17
18
  itemFontWeight,
18
19
  itemFontSize,
19
20
  itemLineHeight,
20
- itemFontName
21
+ itemFontName,
22
+ itemFontColor
21
23
  } = _ref;
22
24
  return applyTextStyles({
25
+ fontColor: itemFontColor,
23
26
  fontWeight: itemFontWeight,
24
27
  fontSize: itemFontSize,
25
28
  lineHeight: itemLineHeight,
@@ -15,6 +15,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const selectPressableStyles = _ref => {
16
16
  let {
17
17
  backgroundColor,
18
+ itemFontColor,
18
19
  paddingLeft,
19
20
  paddingRight,
20
21
  paddingTop,
@@ -23,6 +24,7 @@ const selectPressableStyles = _ref => {
23
24
  } = _ref;
24
25
  return {
25
26
  backgroundColor,
27
+ itemFontColor,
26
28
  paddingLeft,
27
29
  paddingRight,
28
30
  paddingTop,
@@ -83,13 +83,13 @@ const MultiSelectFilter = /*#__PURE__*/forwardRef((_ref3, ref) => {
83
83
  copy
84
84
  });
85
85
  const [isOpen, setIsOpen] = useState(false);
86
- const [checkedIds, setCheckedIds] = useState(currentValues !== null && currentValues !== void 0 ? currentValues : []);
86
+ const [checkedIds, setCheckedIds] = useState(currentValues ?? []);
87
87
  const colSize = items.length > rowLimit ? 2 : 1;
88
88
  const isSelected = currentValues.length > 0;
89
89
  const uniqueFields = ['id', 'label'];
90
90
 
91
91
  if (!containUniqueFields(items, uniqueFields)) {
92
- throw new Error("MultiSelectFilter items must have unique ".concat(uniqueFields.join(', ')));
92
+ throw new Error(`MultiSelectFilter items must have unique ${uniqueFields.join(', ')}`);
93
93
  } // Pass an object of relevant component state as first argument for any passed-in press handlers
94
94
 
95
95
 
@@ -33,8 +33,8 @@ const PageButton = /*#__PURE__*/forwardRef((_ref, ref) => {
33
33
  key: 'active-item'
34
34
  } : {};
35
35
  const accessibilityRole = href !== undefined ? 'link' : 'button';
36
- const activeLabel = isActive ? " ".concat(getCopy('currentLabel')) : '';
37
- const accessibilityLabel = "".concat(getCopy('goToLabel'), " ").concat(label).concat(activeLabel);
36
+ const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
37
+ const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
38
38
  const {
39
39
  hrefAttrs,
40
40
  rest
@@ -84,11 +84,9 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
84
84
  LinkRouter: LinkRouter,
85
85
  linkRouterProps: linkRouterProps
86
86
  }), ...items.map((_child, itemIndex) => {
87
- var _itemProps$LinkRouter;
88
-
89
- const buttonLabel = "".concat(itemIndex + 1);
87
+ const buttonLabel = `${itemIndex + 1}`;
90
88
  const itemProps = getItemProps(itemIndex);
91
- const ItemLinkRouter = (_itemProps$LinkRouter = itemProps.LinkRouter) !== null && _itemProps$LinkRouter !== void 0 ? _itemProps$LinkRouter : LinkRouter;
89
+ const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
92
90
  const itemLinkRouterProps = { ...linkRouterProps,
93
91
  ...itemProps.linkRouterProps
94
92
  };
@@ -125,7 +123,7 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
125
123
  ref: ref,
126
124
  ...selectProps(rest),
127
125
  children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
128
- .map((element, index) => [element, "page-".concat(index + 1)]).filter(_ref3 => {
126
+ .map((element, index) => [element, `page-${index + 1}`]).filter(_ref3 => {
129
127
  let [element] = _ref3;
130
128
  return element !== null;
131
129
  }).map(_ref4 => {
@@ -14,7 +14,7 @@ function usePagination(_ref) {
14
14
  );
15
15
 
16
16
  const getItemProps = index => {
17
- var _items$index$props, _items$index;
17
+ var _items$index;
18
18
 
19
19
  const {
20
20
  onPress,
@@ -22,7 +22,7 @@ function usePagination(_ref) {
22
22
  hrefAttrs,
23
23
  variant,
24
24
  tokens
25
- } = (_items$index$props = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) !== null && _items$index$props !== void 0 ? _items$index$props : {};
25
+ } = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
26
26
  return {
27
27
  onPress,
28
28
  href,
@@ -21,7 +21,7 @@ const selectBarStyles = (_ref, percentage) => {
21
21
  borderRadius,
22
22
  outlineWidth,
23
23
  outlineColor,
24
- width: "".concat(percentage, "%")
24
+ width: `${percentage}%`
25
25
  };
26
26
  };
27
27
  /**
@@ -82,7 +82,7 @@ const ProgressBar = /*#__PURE__*/forwardRef((_ref2, ref) => {
82
82
  min: 0,
83
83
  max: 100,
84
84
  now: percentage,
85
- text: "".concat(percentage, "%")
85
+ text: `${percentage}%`
86
86
  },
87
87
  ...rest
88
88
  });
@@ -90,7 +90,7 @@ const ProgressBar = /*#__PURE__*/forwardRef((_ref2, ref) => {
90
90
  ref: ref,
91
91
  style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
92
92
  ...selectedProps,
93
- children: children !== null && children !== void 0 ? children : /*#__PURE__*/_jsx(ProgressBarBackground, {
93
+ children: children ?? /*#__PURE__*/_jsx(ProgressBarBackground, {
94
94
  variant: variant
95
95
  })
96
96
  }) : null;
@@ -3,8 +3,8 @@ import ImageBackground from "react-native-web/dist/exports/ImageBackground";
3
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import { variantProp } from '../utils';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const inactiveBackground = "%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E";
7
- const negativeBackground = "%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E";
6
+ const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E`;
7
+ const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E`;
8
8
  const ProgressBarBackground = /*#__PURE__*/forwardRef((_ref, ref) => {
9
9
  let {
10
10
  variant
@@ -22,7 +22,7 @@ const ProgressBarBackground = /*#__PURE__*/forwardRef((_ref, ref) => {
22
22
  return /*#__PURE__*/_jsx(ImageBackground, {
23
23
  ref: ref,
24
24
  source: {
25
- uri: "data:image/svg+xml,".concat(source)
25
+ uri: `data:image/svg+xml,${source}`
26
26
  },
27
27
  style: staticStyles.imageBackground
28
28
  });
@@ -46,7 +46,7 @@ const selectDescriptionStyles = _ref2 => {
46
46
  labelMarginLeft = 0
47
47
  } = _ref2;
48
48
  return {
49
- marginLeft: descriptionMarginLeft !== null && descriptionMarginLeft !== void 0 ? descriptionMarginLeft : containerPaddingLeft + inputSize + labelMarginLeft,
49
+ marginLeft: descriptionMarginLeft ?? containerPaddingLeft + inputSize + labelMarginLeft,
50
50
  ...applyTextStyles({
51
51
  fontSize: descriptionFontSize,
52
52
  lineHeight: descriptionLineHeight
@@ -150,7 +150,7 @@ const Radio = /*#__PURE__*/forwardRef((_ref4, ref) => {
150
150
  };
151
151
 
152
152
  const uniqueId = useUniqueId('radio');
153
- const inputId = id !== null && id !== void 0 ? id : uniqueId;
153
+ const inputId = id ?? uniqueId;
154
154
  const selectedProps = selectProps({
155
155
  accessibilityRole: 'radio',
156
156
  accessibilityState: {
@@ -99,7 +99,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
99
99
  const uniqueFields = ['id', 'label'];
100
100
 
101
101
  if (!containUniqueFields(items, uniqueFields)) {
102
- throw new Error("RadioGroup items must have unique ".concat(uniqueFields.join(', ')));
102
+ throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
103
103
  }
104
104
 
105
105
  const radios = items.map((_ref2, index) => {
@@ -111,7 +111,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
111
111
  description,
112
112
  ...itemRest
113
113
  } = _ref2;
114
- const radioId = id || "Radio[".concat(index, "]");
114
+ const radioId = id || `Radio[${index}]`;
115
115
  const isChecked = currentValue === radioId;
116
116
 
117
117
  const handleChange = (newCheckedState, event) => {
@@ -79,7 +79,7 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
79
79
  };
80
80
 
81
81
  const uniqueId = useUniqueId('RadioCard');
82
- const inputId = id !== null && id !== void 0 ? id : uniqueId;
82
+ const inputId = id ?? uniqueId;
83
83
  const getTokens = useThemeTokensCallback('RadioCard', tokens, variant);
84
84
 
85
85
  const getCardTokens = cardState => selectPressableCardTokens(getTokens(cardState));
@@ -105,7 +105,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
105
105
  const uniqueFields = ['id'];
106
106
 
107
107
  if (!containUniqueFields(items, uniqueFields)) {
108
- throw new Error("RadioCardGroup items must have unique ".concat(uniqueFields.join(', ')));
108
+ throw new Error(`RadioCardGroup items must have unique ${uniqueFields.join(', ')}`);
109
109
  }
110
110
 
111
111
  return /*#__PURE__*/_jsx(Fieldset, {
@@ -135,7 +135,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
135
135
  onChange: itemOnChange,
136
136
  ...itemRest
137
137
  } = _ref2;
138
- const cardId = id || "RadioCard[".concat(index, "]");
138
+ const cardId = id || `RadioCard[${index}]`;
139
139
 
140
140
  const handleChange = (newCheckedState, event) => {
141
141
  if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
@@ -125,7 +125,7 @@ const Search = /*#__PURE__*/forwardRef((_ref3, ref) => {
125
125
 
126
126
  const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
127
127
 
128
- const placeholderText = placeholder !== null && placeholder !== void 0 ? placeholder : a11yLabelText;
128
+ const placeholderText = placeholder ?? a11yLabelText;
129
129
  const {
130
130
  nativeID,
131
131
  testID,
@@ -63,7 +63,7 @@ const SideNav = /*#__PURE__*/forwardRef((_ref, ref) => {
63
63
 
64
64
  const renderItem = (item, index, groupId) => {
65
65
  const {
66
- itemId = "item-".concat(index),
66
+ itemId = `item-${index}`,
67
67
  onPress
68
68
  } = item.props;
69
69
 
@@ -91,7 +91,7 @@ const SideNav = /*#__PURE__*/forwardRef((_ref, ref) => {
91
91
 
92
92
  if (child.type === ItemsGroup) {
93
93
  const {
94
- groupId = "group-".concat(index)
94
+ groupId = `group-${index}`
95
95
  } = child.props;
96
96
  const isGroupActive = active.itemId !== undefined && active.groupId === groupId;
97
97
 
@@ -124,7 +124,7 @@ const Skeleton = /*#__PURE__*/forwardRef((_ref5, ref) => {
124
124
  return /*#__PURE__*/_jsx(Component, {
125
125
  testID: "skeleton",
126
126
  style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
127
- }, "skeleton-".concat(index + 1));
127
+ }, `skeleton-${index + 1}`);
128
128
  };
129
129
 
130
130
  return /*#__PURE__*/_jsx(StackView, {
@@ -1,6 +1,6 @@
1
1
  import { ANIMATION_DURATION, DEFAULT_OPACITY, OPACITY_STOP } from './skeleton.constant';
2
2
  export default {
3
- animationDuration: "".concat(ANIMATION_DURATION, "ms"),
3
+ animationDuration: `${ANIMATION_DURATION}ms`,
4
4
  animationTimingFunction: 'ease-in-out',
5
5
  animationDelay: '0.5s',
6
6
  animationIterationCount: 'infinite',
@@ -24,14 +24,12 @@ const exampleGapValue = '1px';
24
24
  */
25
25
 
26
26
  const StackWrap = /*#__PURE__*/forwardRef((props, ref) => {
27
- var _props$gap;
28
-
29
27
  const [canUseCSSGap, setCanUseCSSGap] = useState(false);
30
28
  const {
31
29
  space
32
30
  } = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
33
31
 
34
- const gap = (_props$gap = props.gap) !== null && _props$gap !== void 0 ? _props$gap : space;
32
+ const gap = props.gap ?? space;
35
33
  const gapEqualsSpace = gap === space; // If possible, use the cleaner implementation that applies CSS `gap` styles to the container,
36
34
  // preserving direct parent-child relationships between the container and each item, which
37
35
  // can result in clearer descriptions on some screen readers (e.g. radio "X of Y" on MacOS).
@@ -48,7 +48,7 @@ const getStackedContent = (children, _ref) => {
48
48
  const topLevelChildren = preserveFragments ? children : unpackFragment(children);
49
49
  const validChildren = Children.toArray(topLevelChildren).filter(Boolean);
50
50
  const content = validChildren.reduce((newChildren, child, index) => {
51
- const boxID = "Stack-Box-".concat(index);
51
+ const boxID = `Stack-Box-${index}`;
52
52
  const item = box ?
53
53
  /*#__PURE__*/
54
54
  // If wrapped in Box, that Box needs a key.
@@ -58,7 +58,7 @@ const getStackedContent = (children, _ref) => {
58
58
  testID: boxID
59
59
  }, child) : child;
60
60
  if (!index || !space && !divider) return [...newChildren, item];
61
- const testID = "Stack-".concat(divider ? 'Divider' : 'Spacer', "-").concat(index);
61
+ const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
62
62
  const commonProps = {
63
63
  testID,
64
64
  key: testID,
@@ -37,8 +37,6 @@ const getDefaultTabItemAccessibilityRole = parentRole => {
37
37
 
38
38
 
39
39
  const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
40
- var _restProps$accessibil;
41
-
42
40
  let {
43
41
  tokens,
44
42
  itemTokens,
@@ -76,7 +74,7 @@ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
76
74
  if (hashId) setTimeout(setValue(hashId, event), 500);
77
75
  }, [items, setValue]), isPositioningReady);
78
76
  const restProps = selectProps(rest);
79
- const parentAccessibilityRole = (_restProps$accessibil = restProps.accessibilityRole) !== null && _restProps$accessibil !== void 0 ? _restProps$accessibil : 'tablist';
77
+ const parentAccessibilityRole = restProps.accessibilityRole ?? 'tablist';
80
78
  const defaultTabItemAccessibiltyRole = getDefaultTabItemAccessibilityRole(parentAccessibilityRole);
81
79
  return /*#__PURE__*/_jsx(HorizontalScroll, {
82
80
  ref: ref,
@@ -101,7 +99,7 @@ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
101
99
  linkRouterProps: itemLinkRouterProps,
102
100
  ...itemRest
103
101
  } = _ref3;
104
- const itemId = id !== null && id !== void 0 ? id : label;
102
+ const itemId = id ?? label;
105
103
  const isSelected = Boolean(currentValue && currentValue === itemId);
106
104
 
107
105
  const handlePress = event => {
@@ -108,7 +108,7 @@ const Tags = /*#__PURE__*/forwardRef((_ref2, ref) => {
108
108
  const uniqueFields = ['id', 'label'];
109
109
 
110
110
  if (!containUniqueFields(items, uniqueFields)) {
111
- throw new Error("Tags items must have unique ".concat(uniqueFields.join(', ')));
111
+ throw new Error(`Tags items must have unique ${uniqueFields.join(', ')}`);
112
112
  }
113
113
 
114
114
  return /*#__PURE__*/_jsx(StackWrap, {
@@ -182,7 +182,7 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
182
182
  };
183
183
 
184
184
  const defaultRef = useRef();
185
- const inputRef = ref !== null && ref !== void 0 ? ref : defaultRef;
185
+ const inputRef = ref ?? defaultRef;
186
186
  const {
187
187
  currentValue,
188
188
  resetValue,
@@ -7,6 +7,7 @@ import { fontBasePixels } from '@telus-uds/system-constants'; // Make design tok
7
7
 
8
8
  export function applyTextStyles(_ref) {
9
9
  let {
10
+ fontColor,
10
11
  fontSize,
11
12
  fontScaleCap,
12
13
  lineHeight,
@@ -28,7 +29,7 @@ export function applyTextStyles(_ref) {
28
29
 
29
30
  if (fontSize) {
30
31
  // If relative font sizes are needed, catch and calculate them here
31
- styles.fontSize = Platform.OS === 'web' && !forceAbsoluteFontSizing ? "".concat(fontSize / fontBasePixels, "rem") : fontSize;
32
+ styles.fontSize = Platform.OS === 'web' && !forceAbsoluteFontSizing ? `${fontSize / fontBasePixels}rem` : fontSize;
32
33
  }
33
34
 
34
35
  if (typeof lineHeight === 'number') {
@@ -44,11 +45,15 @@ export function applyTextStyles(_ref) {
44
45
  if (fontName) {
45
46
  // Don't set undefined font families. May need some validation here that the font is available.
46
47
  // Android doesn't recognise font weights natively so apply custom font weights via `fontFamily`.
47
- styles.fontFamily = "".concat(fontName).concat(fontWeight).concat(fontStyle);
48
+ styles.fontFamily = `${fontName}${fontWeight}${fontStyle}`;
48
49
  } else if (fontWeight) {
49
50
  // If using system default font, apply the font weight directly.
50
51
  // Font weight support in Android is limited to 'bold' or anything else === 'normal'.
51
52
  styles.fontWeight = Platform.OS === 'android' && Number(fontWeight) > 400 ? 'bold' : fontWeight;
53
+ }
54
+
55
+ if (fontColor) {
56
+ styles.color = fontColor;
52
57
  } // TODO: look into calculating typographic spacing with PixelRatio.getFontScale()
53
58
  // Do while implementing advanced typography e.g. paragraph etc
54
59
  // https://github.com/telus/universal-design-system/issues/89
@@ -91,7 +96,7 @@ function applyWebShadow(_ref2) {
91
96
  } = _ref2;
92
97
  const insetString = inset ? 'inset ' : '';
93
98
  const boxShadow = {
94
- boxShadow: "".concat(insetString).concat(offsetX, "px ").concat(offsetY, "px ").concat(blur, "px ").concat(spread, "px ").concat(color)
99
+ boxShadow: `${insetString}${offsetX}px ${offsetY}px ${blur}px ${spread}px ${color}`
95
100
  };
96
101
  return boxShadow;
97
102
  }
@@ -17,29 +17,27 @@ export const getComponentTheme = (theme, componentName) => {
17
17
  // Give clear and understandable error messages for common dev errors, for example,
18
18
  // typo in component name, missing export or accessing old version of theme
19
19
  if (!theme) {
20
- throw new Error("Called useTheme's getStyle on \"".concat(componentName, "\" with no theme provided"));
20
+ throw new Error(`Called useTheme's getStyle on "${componentName}" with no theme provided`);
21
21
  }
22
22
 
23
23
  const themeName = ((_theme$metadata = theme.metadata) === null || _theme$metadata === void 0 ? void 0 : _theme$metadata.name) || '';
24
24
 
25
25
  if (!theme.components) {
26
- throw new Error("Theme \"".concat(themeName, "\" has no components defined (looking for \"").concat(componentName, "\")"));
26
+ throw new Error(`Theme "${themeName}" has no components defined (looking for "${componentName}")`);
27
27
  }
28
28
 
29
29
  const componentTheme = theme.components[componentName];
30
30
 
31
31
  if (!componentTheme) {
32
- throw new Error("Theme \"".concat(themeName, "\" does not have styles for component \"").concat(componentName, "\""));
32
+ throw new Error(`Theme "${themeName}" does not have styles for component "${componentName}"`);
33
33
  }
34
34
 
35
35
  return componentTheme;
36
36
  };
37
37
  export const doesThemeConditionApply = (_ref, appearances) => {
38
- var _appearances$key;
39
-
40
38
  let [key, value] = _ref;
41
39
  // use null rather than undefined so we can serialise the value in themes
42
- const appearanceValue = (_appearances$key = appearances[key]) !== null && _appearances$key !== void 0 ? _appearances$key : null;
40
+ const appearanceValue = appearances[key] ?? null;
43
41
  return Array.isArray(value) ? value.includes(appearanceValue) : value === appearanceValue;
44
42
  };
45
43
  export const doesThemeRuleApply = (rule, appearances) => Object.entries(rule.if).every(condition => doesThemeConditionApply(condition, appearances));
@@ -158,6 +156,10 @@ export const validateThemeTokensVersion = theme => {
158
156
  const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
159
157
 
160
158
  if (!semVerSatisfies(actualThemeTokensVersion, expectedThemeTokensVersion)) {
161
- throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(pkg.name, " v").concat(pkg.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(pkg.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/docs/docs/multi-brand-usage.md"));
159
+ throw new Error(`Invalid UDS token schema version detected.
160
+
161
+ The UDS base components ${pkg.name} v${pkg.version} are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ${expectedThemeTokensVersion}. The current theme was built with @telus-uds/system-theme-tokens v${actualThemeTokensVersion}.
162
+
163
+ If you see this error than most likely you have attempted to install ${pkg.name} and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/docs/docs/multi-brand-usage.md`);
162
164
  }
163
165
  };
@@ -141,7 +141,7 @@ const Timeline = /*#__PURE__*/forwardRef((_ref7, ref) => {
141
141
  style: selectItemContentStyles(themeTokens, index + 1 === children.length),
142
142
  children: child
143
143
  })]
144
- }, "timeline-".concat(index, "-").concat(child.displayName));
144
+ }, `timeline-${index}-${child.displayName}`);
145
145
  })
146
146
  });
147
147
  });
@@ -136,7 +136,7 @@ const ToggleSwitch = /*#__PURE__*/forwardRef((_ref7, ref) => {
136
136
  const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
137
137
 
138
138
  const uniqueId = useUniqueId('toggleSwitch');
139
- const inputId = id !== null && id !== void 0 ? id : uniqueId;
139
+ const inputId = id ?? uniqueId;
140
140
  return /*#__PURE__*/_jsxs(StackView, {
141
141
  space: 2,
142
142
  direction: "row",
@@ -63,7 +63,7 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
63
63
  const uniqueFields = ['id', 'label'];
64
64
 
65
65
  if (!containUniqueFields(items, uniqueFields)) {
66
- throw new Error("ToggleSwitchGroup items must have unique ".concat(uniqueFields.join(', ')));
66
+ throw new Error(`ToggleSwitchGroup items must have unique ${uniqueFields.join(', ')}`);
67
67
  }
68
68
 
69
69
  const toggleSwitches = items.map((_ref2, index) => {