@telus-uds/components-base 1.30.1 → 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.
- package/CHANGELOG.md +18 -2
- package/component-docs.json +3 -0
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/BaseProvider/HydrationContext.js +1 -1
- package/lib/Box/Box.js +1 -1
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +2 -4
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselThumbnail.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/List/ListItemContent.js +5 -2
- package/lib/List/PressableListItemBase.js +2 -0
- package/lib/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +3 -5
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Search/Search.js +1 -1
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +1 -3
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +2 -4
- package/lib/Tags/Tags.js +1 -1
- package/lib/TextInput/TextInputBase.js +1 -1
- package/lib/ThemeProvider/utils/styles.js +8 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib/Timeline/Timeline.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.js +2 -2
- package/lib/Validator/Validator.js +14 -15
- package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +2 -2
- package/lib/utils/input.js +13 -7
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +7 -7
- package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
- package/lib-module/BaseProvider/HydrationContext.js +1 -1
- package/lib-module/Box/Box.js +1 -1
- package/lib-module/Button/ButtonBase.js +2 -2
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +2 -4
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselThumbnail.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +1 -1
- package/lib-module/Checkbox/CheckboxGroup.js +2 -2
- package/lib-module/Divider/Divider.js +2 -2
- package/lib-module/FlexGrid/Col/Col.js +1 -1
- package/lib-module/Icon/Icon.js +1 -1
- package/lib-module/List/ListItemContent.js +5 -2
- package/lib-module/List/PressableListItemBase.js +2 -0
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib-module/Pagination/PageButton.js +2 -2
- package/lib-module/Pagination/Pagination.js +3 -5
- package/lib-module/Pagination/usePagination.js +2 -2
- package/lib-module/Progress/ProgressBar.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +3 -3
- package/lib-module/Radio/Radio.js +2 -2
- package/lib-module/Radio/RadioGroup.js +2 -2
- package/lib-module/RadioCard/RadioCard.js +1 -1
- package/lib-module/RadioCard/RadioCardGroup.js +2 -2
- package/lib-module/Search/Search.js +1 -1
- package/lib-module/SideNav/SideNav.js +2 -2
- package/lib-module/Skeleton/Skeleton.js +1 -1
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/StackView/StackWrap.js +1 -3
- package/lib-module/StackView/getStackedContent.js +2 -2
- package/lib-module/Tabs/Tabs.js +2 -4
- package/lib-module/Tags/Tags.js +1 -1
- package/lib-module/TextInput/TextInputBase.js +1 -1
- package/lib-module/ThemeProvider/utils/styles.js +8 -3
- package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib-module/Timeline/Timeline.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib-module/Tooltip/Backdrop.js +10 -2
- package/lib-module/Tooltip/Tooltip.js +2 -2
- package/lib-module/Validator/Validator.js +14 -15
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib-module/utils/children.js +2 -2
- package/lib-module/utils/input.js +13 -7
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +2 -2
- package/lib-module/utils/useSpacingScale.js +1 -3
- package/lib-module/utils/useUniqueId.js +1 -1
- package/package.json +2 -2
- package/src/List/ListItemContent.jsx +4 -2
- package/src/List/PressableListItemBase.jsx +2 -0
- package/src/ThemeProvider/utils/styles.js +5 -0
- package/src/Validator/Validator.jsx +2 -1
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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, (
|
|
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$
|
|
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
|
-
|
|
138
|
+
keyboardType: 'numeric',
|
|
139
|
+
ref: codeReferences[codeId] ?? null,
|
|
143
140
|
validation: strValidation || singleCodes[codeId + sufixValidation],
|
|
144
141
|
tokens: selectCodeTextInputTokens(themeTokens),
|
|
145
|
-
onFocus: () =>
|
|
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
|
-
|
|
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 =
|
|
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) =>
|
|
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] =
|
|
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(
|
|
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(
|
|
34
|
+
usageError(`has \`value${s}\` prop without \`onChange\` or \`readOnly\``);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
if (initialValue && value) {
|
|
32
|
-
usageError(
|
|
38
|
+
usageError(`has both \`initialValue${s}\` and \`value${s}\``);
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
if (isControlled && !isCurrentlyControlled) {
|
|
36
|
-
usageError(
|
|
42
|
+
usageError(`stopped receiving \`value${s}\` from parent after delegating state management`);
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
if (!isControlled && isCurrentlyControlled) {
|
|
40
|
-
usageError(
|
|
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
|
|
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
|
|
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 ?
|
|
30
|
-
return new Error(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 ?
|
|
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 && ((
|
|
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, {
|
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.
|
|
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.
|
|
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]
|
|
116
|
+
onFocus: () => codeReferences[codeId]?.current?.select() ?? null,
|
|
116
117
|
onKeyPress: (event) => handleKeyPress(event, i, i - 1),
|
|
117
118
|
onMouseOver: handleMouseOver,
|
|
118
119
|
onMouseOut: handleMouseOut,
|