@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
@@ -8,7 +8,15 @@ function createPortalNode(nodeId) {
8
8
  // this way the backdrop stays in place when scrolling the window - that's why we need to
9
9
  // position it at the scroll position when rendering
10
10
 
11
- node.style.cssText = "\n position: absolute; \n top: ".concat(window.scrollY, "px;\n left: ").concat(window.scrollX, "px; \n right: 0; \n bottom: 0; \n z-index: 9999; \n pointer-events: none;\n ");
11
+ node.style.cssText = `
12
+ position: absolute;
13
+ top: ${window.scrollY}px;
14
+ left: ${window.scrollX}px;
15
+ right: 0;
16
+ bottom: 0;
17
+ z-index: 9999;
18
+ pointer-events: none;
19
+ `;
12
20
  document.body.appendChild(node);
13
21
  return node;
14
22
  }
@@ -29,7 +37,7 @@ function Backdrop(_ref) {
29
37
  } = _ref;
30
38
  const [portalNode, setPortalNode] = useState();
31
39
  useEffect(() => {
32
- const nodeId = "tooltip-backdrop-".concat(Date.now());
40
+ const nodeId = `tooltip-backdrop-${Date.now()}`;
33
41
  const node = createPortalNode(nodeId);
34
42
  setPortalNode(node);
35
43
  return () => {
@@ -236,8 +236,8 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
236
236
  style: [selectTooltipShadowStyles(themeTokens), staticStyles.tooltip, // applied separately so that it doesn't cover the arrow
237
237
  selectMobileTooltipPositionStyles({
238
238
  position: strategy,
239
- top: y !== null && y !== void 0 ? y : 0,
240
- left: x !== null && x !== void 0 ? x : 0
239
+ top: y ?? 0,
240
+ left: x ?? 0
241
241
  })],
242
242
  onLayout: onTooltipLayout,
243
243
  accessibilityRole: "alert",
@@ -33,7 +33,7 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
33
33
  ...rest
34
34
  } = _ref2;
35
35
  const defaultRef = useRef();
36
- const codeRef = ref !== null && ref !== void 0 ? ref : defaultRef;
36
+ const codeRef = ref ?? defaultRef;
37
37
  const {
38
38
  supportsProps
39
39
  } = selectProps(rest);
@@ -88,15 +88,13 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
88
88
  };
89
89
 
90
90
  const handleChangeCodeValues = (event, codeId, nextIndex) => {
91
- var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value, _codeElement$value2, _codeElement$value3;
91
+ var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value, _codeElement$value2;
92
92
 
93
93
  const codeElement = (_codeReferences$codeI = codeReferences[codeId]) === null || _codeReferences$codeI === void 0 ? void 0 : _codeReferences$codeI.current;
94
94
  const val = ((_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.value) || ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
95
95
 
96
96
  if (Number(val).toString() === 'NaN') {
97
- var _singleCodes$codeId;
98
-
99
- codeElement.value = (_singleCodes$codeId = singleCodes[codeId]) !== null && _singleCodes$codeId !== void 0 ? _singleCodes$codeId : '';
97
+ codeElement.value = singleCodes[codeId] ?? '';
100
98
  return;
101
99
  }
102
100
 
@@ -107,7 +105,7 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
107
105
  handleSingleCodes(codeId, codeElement.value, 'success');
108
106
  }
109
107
 
110
- handleSingleCodes(codeId, (_codeElement$value2 = codeElement === null || codeElement === void 0 ? void 0 : codeElement.value) !== null && _codeElement$value2 !== void 0 ? _codeElement$value2 : singleCodes[codeId], 'success');
108
+ handleSingleCodes(codeId, (codeElement === null || codeElement === void 0 ? void 0 : codeElement.value) ?? singleCodes[codeId], 'success');
111
109
  handleChangeCode();
112
110
 
113
111
  if (nextIndex === validatorsLength) {
@@ -115,7 +113,7 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
115
113
  return;
116
114
  }
117
115
 
118
- if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value3 = codeElement.value) === null || _codeElement$value3 === void 0 ? void 0 : _codeElement$value3.length) > 0) codeReferences[prefix + nextIndex].current.focus();
116
+ if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value2 = codeElement.value) === null || _codeElement$value2 === void 0 ? void 0 : _codeElement$value2.length) > 0) codeReferences[prefix + nextIndex].current.focus();
119
117
  };
120
118
 
121
119
  const handleKeyPress = (event, currentIndex, previousIndex) => {
@@ -134,15 +132,18 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
134
132
  const components = [];
135
133
 
136
134
  for (let i = 0; validatorsLength && i < validatorsLength; i += 1) {
137
- var _codeReferences$codeI2;
138
-
139
135
  const codeId = prefix + i;
140
136
  const codeInputProps = {
141
137
  nativeID: codeId,
142
- ref: (_codeReferences$codeI2 = codeReferences[codeId]) !== null && _codeReferences$codeI2 !== void 0 ? _codeReferences$codeI2 : null,
138
+ keyboardType: 'numeric',
139
+ ref: codeReferences[codeId] ?? null,
143
140
  validation: strValidation || singleCodes[codeId + sufixValidation],
144
141
  tokens: selectCodeTextInputTokens(themeTokens),
145
- onFocus: () => codeReferences[codeId].current.select(),
142
+ onFocus: () => {
143
+ var _codeReferences$codeI2, _codeReferences$codeI3;
144
+
145
+ return ((_codeReferences$codeI2 = codeReferences[codeId]) === null || _codeReferences$codeI2 === void 0 ? void 0 : (_codeReferences$codeI3 = _codeReferences$codeI2.current) === null || _codeReferences$codeI3 === void 0 ? void 0 : _codeReferences$codeI3.select()) ?? null;
146
+ },
146
147
  onKeyPress: event => handleKeyPress(event, i, i - 1),
147
148
  onMouseOver: handleMouseOver,
148
149
  onMouseOut: handleMouseOut,
@@ -167,10 +168,8 @@ const Validator = /*#__PURE__*/forwardRef((_ref2, ref) => {
167
168
 
168
169
  useEffect(() => {
169
170
  for (let i = 0; i < validatorsLength; i += 1) {
170
- var _text$i, _text$i2;
171
-
172
- codeReferences[prefix + i].current.value = (_text$i = text[i]) !== null && _text$i !== void 0 ? _text$i : '';
173
- handleSingleCodes(prefix + i, (_text$i2 = text[i]) !== null && _text$i2 !== void 0 ? _text$i2 : '', text[i] ? 'success' : '');
171
+ codeReferences[prefix + i].current.value = text[i] ?? '';
172
+ handleSingleCodes(prefix + i, text[i] ?? '', text[i] ? 'success' : '');
174
173
  }
175
174
  }, [text]);
176
175
  /* eslint-disable react-hooks/exhaustive-deps */
@@ -72,7 +72,7 @@ function useVerticalExpandAnimation(_ref) {
72
72
  }
73
73
  } else if (Platform.OS === 'web') {
74
74
  const transitionDuration = isExpanded ? expandDuration : collapseDuration;
75
- containerStyles.transition = "height ".concat(transitionDuration, "ms ease-in-out");
75
+ containerStyles.transition = `height ${transitionDuration}ms ease-in-out`;
76
76
  containerStyles.height = isExpanded ? containerHeight : 0;
77
77
  } else if (Platform.OS === 'ios' && isExpanded && !isAnimating && !expandStateChanged && typeof containerHeight === 'number') {
78
78
  // iOS reflows text while the height animation is in progress. Sometimes, it hits a timing bug where
@@ -55,7 +55,7 @@ const isWrapable = child => {
55
55
  return isStringOrNumber(child) || child.type === A11yText || ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'FootnoteLink';
56
56
  };
57
57
 
58
- const combineKeys = childrenArray => childrenArray.reduce((newKey, child) => "".concat(newKey).concat(child.key || ''), ''); // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
58
+ const combineKeys = childrenArray => childrenArray.reduce((newKey, child) => `${newKey}${child.key || ''}`, ''); // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
59
59
 
60
60
 
61
61
  const wrapChild = (child, wrappedText) => {
@@ -64,7 +64,7 @@ const wrapChild = (child, wrappedText) => {
64
64
 
65
65
  if (lastIndex >= 0 && isStringOrNumber(child) && isStringOrNumber(wrappedText[lastIndex])) {
66
66
  /* eslint-disable-next-line no-param-reassign */
67
- wrappedText[lastIndex] = "".concat(wrappedText[lastIndex]).concat(child);
67
+ wrappedText[lastIndex] = `${wrappedText[lastIndex]}${child}`;
68
68
  } else {
69
69
  wrappedText.push(child);
70
70
  }
@@ -21,23 +21,29 @@ const validateProps = (_ref, _ref2, hookName) => {
21
21
  const usageError = error => {
22
22
  // Errors inside hooks in React Native get incomplete stack traces pointing at parent component only.
23
23
  // Help devs out by telling them exactly which hook threw the error as well as why.
24
- throw new Error("".concat(hookName, " ").concat(error, ".\n\nConsumers of this hook must be one of:\n1. An \"uncontrolled\" component responding directly to user actions, with an optional `initialValue").concat(s, "` but no `value").concat(s, "` prop,\n2. A \"controlled\" component where an always-defined `value").concat(s, "` prop is managed by an `onChange` handler, with no `initialValue").concat(s, "`,\n3. A \"read-only\" component, with `readOnly` prop set as `true`.\n"));
24
+ throw new Error(`${hookName} ${error}.
25
+
26
+ Consumers of this hook must be one of:
27
+ 1. An "uncontrolled" component responding directly to user actions, with an optional \`initialValue${s}\` but no \`value${s}\` prop,
28
+ 2. A "controlled" component where an always-defined \`value${s}\` prop is managed by an \`onChange\` handler, with no \`initialValue${s}\`,
29
+ 3. A "read-only" component, with \`readOnly\` prop set as \`true\`.
30
+ `);
25
31
  };
26
32
 
27
33
  if (value && !onChange && !readOnly) {
28
- usageError("has `value".concat(s, "` prop without `onChange` or `readOnly`"));
34
+ usageError(`has \`value${s}\` prop without \`onChange\` or \`readOnly\``);
29
35
  }
30
36
 
31
37
  if (initialValue && value) {
32
- usageError("has both `initialValue".concat(s, "` and `value").concat(s, "`"));
38
+ usageError(`has both \`initialValue${s}\` and \`value${s}\``);
33
39
  }
34
40
 
35
41
  if (isControlled && !isCurrentlyControlled) {
36
- usageError("stopped receiving `value".concat(s, "` from parent after delegating state management"));
42
+ usageError(`stopped receiving \`value${s}\` from parent after delegating state management`);
37
43
  }
38
44
 
39
45
  if (!isControlled && isCurrentlyControlled) {
40
- usageError("started receiving `value".concat(s, "` from parent after starting managing own state"));
46
+ usageError(`started receiving \`value${s}\` from parent after starting managing own state`);
41
47
  }
42
48
  };
43
49
  /**
@@ -98,7 +104,7 @@ export const useInputValue = function () {
98
104
 
99
105
  if (!isControlled) {
100
106
  setOwnValue(newValue);
101
- if (inputRef !== null && inputRef !== void 0 && inputRef.current) inputRef.current.value = newValue !== null && newValue !== void 0 ? newValue : '';
107
+ if (inputRef !== null && inputRef !== void 0 && inputRef.current) inputRef.current.value = newValue ?? '';
102
108
  } // Call onChange handler if there's something for it to handle (event or a changed value)
103
109
 
104
110
 
@@ -156,7 +162,7 @@ export const useMultipleInputValues = function () {
156
162
  onChange,
157
163
  value: values,
158
164
  // if we're controlling our own state, always start with an array
159
- initialValue: initialValues !== null && initialValues !== void 0 ? initialValues : values === undefined ? [] : undefined
165
+ initialValue: initialValues ?? (values === undefined ? [] : undefined)
160
166
  }, 'useMultipleInputValues');
161
167
  const enforceMaxValues = useCallback(newValues => {
162
168
  if (!maxValues) return newValues;
@@ -26,8 +26,8 @@ export default function componentPropType(passedName) {
26
26
  const nameInProp = ((_props$propName$type = props[propName].type) === null || _props$propName$type === void 0 ? void 0 : _props$propName$type.displayName) || ((_props$propName$type2 = props[propName].type) === null || _props$propName$type2 === void 0 ? void 0 : _props$propName$type2.name);
27
27
 
28
28
  if (!nameInProp || !passedNames.includes(nameInProp)) {
29
- const propDescription = nameInProp ? "Component ".concat(nameInProp) : typeof props[propName];
30
- return new Error("".concat(componentName, ": ").concat(propDescription, " was passed to `").concat(propName, "` prop; should be ").concat(passedNames.join(' or ')));
29
+ const propDescription = nameInProp ? `Component ${nameInProp}` : typeof props[propName];
30
+ return new Error(`${componentName}: ${propDescription} was passed to \`${propName}\` prop; should be ${passedNames.join(' or ')}`);
31
31
  }
32
32
 
33
33
  return undefined;
@@ -35,7 +35,7 @@ export default function componentPropType(passedName) {
35
35
 
36
36
  const checkRequired = (props, propName, componentName) => {
37
37
  if (props[propName] === undefined) {
38
- return new Error("The prop `".concat(propName, "` is marked as required in `").concat(componentName, "`, but its value is ").concat(props[propName], "."));
38
+ return new Error(`The prop \`${propName}\` is marked as required in \`${componentName}\`, but its value is ${props[propName]}.`);
39
39
  }
40
40
 
41
41
  return undefined;
@@ -3,7 +3,7 @@
3
3
  export default function selectSystemProps(systemPropHelpers) {
4
4
  const selectProps = props => systemPropHelpers.reduce((acc, propHelper) => {
5
5
  if (typeof (propHelper === null || propHelper === void 0 ? void 0 : propHelper.select) !== 'function') {
6
- throw new Error("An invalid system prop helper has been passed to 'selectSystemProps': prop selector ('.select') is missing in ".concat(propHelper));
6
+ throw new Error(`An invalid system prop helper has been passed to 'selectSystemProps': prop selector ('.select') is missing in ${propHelper}`);
7
7
  }
8
8
 
9
9
  return { ...acc,
@@ -13,7 +13,7 @@ export default function selectSystemProps(systemPropHelpers) {
13
13
 
14
14
  const selectedPropTypes = systemPropHelpers.reduce((acc, propHelper) => {
15
15
  if (!(propHelper !== null && propHelper !== void 0 && propHelper.types)) {
16
- throw new Error("An invalid system prop helper has been passed to 'selectSystemProps': types selector ('.types') is missing in ".concat(propHelper));
16
+ throw new Error(`An invalid system prop helper has been passed to 'selectSystemProps': types selector ('.types') is missing in ${propHelper}`);
17
17
  }
18
18
 
19
19
  return { ...acc,
@@ -9,7 +9,7 @@ export const getTokenNames = componentName => {
9
9
  const componentTokenSchema = tokenKeys[componentName];
10
10
 
11
11
  if (!componentTokenSchema) {
12
- throw new Error("No \"".concat(componentName, "\" tokenKeys in @telus-uds/system-theme-tokens"));
12
+ throw new Error(`No "${componentName}" tokenKeys in @telus-uds/system-theme-tokens`);
13
13
  }
14
14
 
15
15
  return Object.keys(componentTokenSchema);
@@ -47,7 +47,7 @@ export const getTokenNames = componentName => {
47
47
  export const selectTokens = (specifier, tokens, prefix) => {
48
48
  const tokenNames = typeof specifier === 'string' ? getTokenNames(specifier) : specifier;
49
49
  const filteredTokens = tokenNames.reduce((validTokens, key) => {
50
- const prefixedKey = prefix ? "".concat(prefix).concat(key[0].toUpperCase()).concat(key.slice(1)) : key;
50
+ const prefixedKey = prefix ? `${prefix}${key[0].toUpperCase()}${key.slice(1)}` : key;
51
51
  const token = tokens[prefixedKey];
52
52
  return token !== undefined ? { ...validTokens,
53
53
  [key]: token
@@ -101,8 +101,6 @@ const resolveSpacingOptions = space => {
101
101
 
102
102
 
103
103
  const useSpacingScale = spaceValue => {
104
- var _spaceValue$space;
105
-
106
104
  // In future, may need to consider window height as well as width, particularly for native apps,
107
105
  // e.g. to ensure designs don't look lost on large, tall, not-so-wide portrait screens.
108
106
  const viewport = useViewport();
@@ -112,7 +110,7 @@ const useSpacingScale = spaceValue => {
112
110
  overridden,
113
111
  subtract = 0
114
112
  } = resolveSpacingOptions(spaceValue);
115
- const space = !overridden && ((_spaceValue$space = spaceValue === null || spaceValue === void 0 ? void 0 : spaceValue.space) !== null && _spaceValue$space !== void 0 ? _spaceValue$space : resolveResponsiveProp(spaceValue, viewport, 0));
113
+ const space = !overridden && ((spaceValue === null || spaceValue === void 0 ? void 0 : spaceValue.space) ?? resolveResponsiveProp(spaceValue, viewport, 0));
116
114
  const {
117
115
  size
118
116
  } = useThemeTokens('spacingScale', tokens, variant, {
@@ -5,7 +5,7 @@ function useUniqueId() {
5
5
  let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
6
6
  const [uniqueId] = useState(() => {
7
7
  id += 1;
8
- return "".concat(prefix, "-").concat(id);
8
+ return `${prefix}-${id}`;
9
9
  });
10
10
  return uniqueId;
11
11
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "@floating-ui/react-native": "^0.8.1",
12
12
  "@gorhom/portal": "^1.0.14",
13
13
  "@telus-uds/system-constants": "^1.2.0",
14
- "@telus-uds/system-theme-tokens": "^2.13.0",
14
+ "@telus-uds/system-theme-tokens": "^2.15.0",
15
15
  "airbnb-prop-types": "^2.16.0",
16
16
  "lodash.debounce": "^4.0.8",
17
17
  "lodash.merge": "^4.6.2",
@@ -72,5 +72,5 @@
72
72
  "standard-engine": {
73
73
  "skip": true
74
74
  },
75
- "version": "1.30.0"
75
+ "version": "1.31.0"
76
76
  }
@@ -9,14 +9,16 @@ 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 = (
16
- { itemFontWeight, itemFontSize, itemLineHeight, itemFontName },
17
+ { itemFontWeight, itemFontSize, itemLineHeight, itemFontName, itemFontColor },
17
18
  themeOptions
18
19
  ) =>
19
20
  applyTextStyles({
21
+ fontColor: itemFontColor,
20
22
  fontWeight: itemFontWeight,
21
23
  fontSize: itemFontSize,
22
24
  lineHeight: itemLineHeight,
@@ -19,6 +19,7 @@ import ListItemMark from './ListItemMark'
19
19
 
20
20
  const selectPressableStyles = ({
21
21
  backgroundColor,
22
+ itemFontColor,
22
23
  paddingLeft,
23
24
  paddingRight,
24
25
  paddingTop,
@@ -26,6 +27,7 @@ const selectPressableStyles = ({
26
27
  interItemMargin
27
28
  }) => ({
28
29
  backgroundColor,
30
+ itemFontColor,
29
31
  paddingLeft,
30
32
  paddingRight,
31
33
  paddingTop,
@@ -8,6 +8,7 @@ import { fontBasePixels } from '@telus-uds/system-constants'
8
8
 
9
9
  // Make design tokens fit React Native's text styles' specific requirements and quirks
10
10
  export function applyTextStyles({
11
+ fontColor,
11
12
  fontSize,
12
13
  fontScaleCap,
13
14
  lineHeight,
@@ -51,6 +52,10 @@ export function applyTextStyles({
51
52
  styles.fontWeight = Platform.OS === 'android' && Number(fontWeight) > 400 ? 'bold' : fontWeight
52
53
  }
53
54
 
55
+ if (fontColor) {
56
+ styles.color = fontColor
57
+ }
58
+
54
59
  // TODO: look into calculating typographic spacing with PixelRatio.getFontScale()
55
60
  // Do while implementing advanced typography e.g. paragraph etc
56
61
  // https://github.com/telus/universal-design-system/issues/89
@@ -109,10 +109,11 @@ const Validator = forwardRef(
109
109
  const codeId = prefix + i
110
110
  const codeInputProps = {
111
111
  nativeID: codeId,
112
+ keyboardType: 'numeric',
112
113
  ref: codeReferences[codeId] ?? null,
113
114
  validation: strValidation || singleCodes[codeId + sufixValidation],
114
115
  tokens: selectCodeTextInputTokens(themeTokens),
115
- onFocus: () => codeReferences[codeId].current.select(),
116
+ onFocus: () => codeReferences[codeId]?.current?.select() ?? null,
116
117
  onKeyPress: (event) => handleKeyPress(event, i, i - 1),
117
118
  onMouseOver: handleMouseOver,
118
119
  onMouseOut: handleMouseOut,