@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
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 03 Apr 2023 20:33:24 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.31.0
|
|
8
|
+
|
|
9
|
+
Mon, 03 Apr 2023 20:33:24 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- added storybook stories for Koodo divider (kyle.king2@telus.com)
|
|
14
|
+
- add more icon variants to storybook (mauricio.batresmontejo@telus.com)
|
|
15
|
+
- Added color property to QuickLinksList (wlsdud194@hotmail.com)
|
|
16
|
+
- add stories for inverse and inactive buttons (evander.owusu@telus.com)
|
|
17
|
+
- Bump @telus-uds/system-theme-tokens to v2.15.0
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- add keyboard type numeric to validator (mauricio.batresmontejo@telus.com)
|
|
22
|
+
|
|
7
23
|
## 1.30.1
|
|
8
24
|
|
|
9
|
-
Thu, 23 Mar 2023 20:
|
|
25
|
+
Thu, 23 Mar 2023 20:52:43 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
package/component-docs.json
CHANGED
|
@@ -514,6 +514,7 @@
|
|
|
514
514
|
"itemBulletContainerWidth": "size",
|
|
515
515
|
"itemBulletHeight": "size",
|
|
516
516
|
"itemBulletWidth": "size",
|
|
517
|
+
"itemFontColor": "color",
|
|
517
518
|
"itemFontName": "fontName",
|
|
518
519
|
"itemFontSize": "fontSize",
|
|
519
520
|
"itemFontWeight": "fontWeight",
|
|
@@ -6706,6 +6707,7 @@
|
|
|
6706
6707
|
"itemBulletContainerWidth": "size",
|
|
6707
6708
|
"itemBulletHeight": "size",
|
|
6708
6709
|
"itemBulletWidth": "size",
|
|
6710
|
+
"itemFontColor": "color",
|
|
6709
6711
|
"itemFontName": "fontName",
|
|
6710
6712
|
"itemFontSize": "fontSize",
|
|
6711
6713
|
"itemFontWeight": "fontWeight",
|
|
@@ -6788,6 +6790,7 @@
|
|
|
6788
6790
|
"itemBulletContainerWidth": "size",
|
|
6789
6791
|
"itemBulletHeight": "size",
|
|
6790
6792
|
"itemBulletWidth": "size",
|
|
6793
|
+
"itemFontColor": "color",
|
|
6791
6794
|
"itemFontName": "fontName",
|
|
6792
6795
|
"itemFontSize": "fontSize",
|
|
6793
6796
|
"itemFontWeight": "fontWeight",
|
|
@@ -23,14 +23,14 @@ const MIN_SVG_LENGTH = _shared.MIN_STROKE_ANGLE / 360 * SVG_CIRCUMFERENCE;
|
|
|
23
23
|
const MAX_SVG_LENGTH = (1 - _shared.MIN_EMPTY_ANGLE / 360) * SVG_CIRCUMFERENCE;
|
|
24
24
|
const animationProps = {
|
|
25
25
|
begin: '0s',
|
|
26
|
-
dur:
|
|
26
|
+
dur: `${_shared.DURATION}ms`,
|
|
27
27
|
fill: 'freeze',
|
|
28
28
|
repeatCount: 'indefinite'
|
|
29
29
|
};
|
|
30
30
|
const bezierProps = {
|
|
31
31
|
calcMode: 'spline',
|
|
32
32
|
keyTimes: '0; 0.5; 1',
|
|
33
|
-
keySplines:
|
|
33
|
+
keySplines: `${_shared.BEZIER.join(', ')} ; ${_shared.BEZIER.join(', ')}`
|
|
34
34
|
}; // We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
35
35
|
// It's possible to replicate this functionality with RNW animations, but it snags on chrome at least, see https://github.com/telus/universal-design-system/pull/477 for details.
|
|
36
36
|
|
|
@@ -48,8 +48,8 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
48
48
|
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
49
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
50
50
|
ref: ref,
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
51
|
+
width: `${size}px`,
|
|
52
|
+
height: `${size}px`,
|
|
53
53
|
viewBox: "0 0 48 48",
|
|
54
54
|
"aria-valuetext": label,
|
|
55
55
|
role: "progressbar",
|
|
@@ -58,7 +58,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
58
58
|
children: [reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("animateTransform", {
|
|
59
59
|
attributeName: "transform",
|
|
60
60
|
type: "rotate",
|
|
61
|
-
values:
|
|
61
|
+
values: `-180 24 24;${360 + _shared.MIN_STROKE_ANGLE - 180} 24 24`,
|
|
62
62
|
...animationProps
|
|
63
63
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
64
64
|
fill: "none",
|
|
@@ -73,12 +73,12 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
73
73
|
children: reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
74
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
75
75
|
attributeName: "stroke-dashoffset",
|
|
76
|
-
values:
|
|
76
|
+
values: `0;-10;${MIN_SVG_LENGTH - SVG_CIRCUMFERENCE}`,
|
|
77
77
|
...animationProps,
|
|
78
78
|
...bezierProps
|
|
79
79
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
80
80
|
attributeName: "stroke-dasharray",
|
|
81
|
-
values:
|
|
81
|
+
values: `${MIN_SVG_LENGTH}, 200;${MAX_SVG_LENGTH}, 200;${MIN_SVG_LENGTH}, 200`,
|
|
82
82
|
...animationProps,
|
|
83
83
|
...bezierProps
|
|
84
84
|
})]
|
|
@@ -97,7 +97,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const direction = index ? -1 : +1;
|
|
100
|
-
return
|
|
100
|
+
return `${direction * (180 - (sa + ea)) * easing(progress) + rotation}deg`;
|
|
101
101
|
});
|
|
102
102
|
const layerStyle = {
|
|
103
103
|
width: size,
|
|
@@ -112,7 +112,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
112
112
|
layerStyle.transform = [{
|
|
113
113
|
rotate: timer.interpolate({
|
|
114
114
|
inputRange: [0, 1],
|
|
115
|
-
outputRange: [
|
|
115
|
+
outputRange: [`${0 + ea + sa}deg`, `${2 * 360 + ea + sa}deg`]
|
|
116
116
|
})
|
|
117
117
|
}];
|
|
118
118
|
viewportStyle.transform = [{
|
|
@@ -59,7 +59,7 @@ const HydrationProvider = _ref => {
|
|
|
59
59
|
}, []); // If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
|
|
60
60
|
|
|
61
61
|
const valueFromAncestor = useHydrationContext();
|
|
62
|
-
const isHydrating = valueFromAncestor
|
|
62
|
+
const isHydrating = valueFromAncestor ?? Boolean(!hasMounted && hasWebStyleTag());
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HydrationContext.Provider, {
|
|
64
64
|
value: isHydrating,
|
|
65
65
|
children: children
|
package/lib/Box/Box.js
CHANGED
|
@@ -46,7 +46,7 @@ const selectBoxStyles = tokens => {
|
|
|
46
46
|
}
|
|
47
47
|
} = tokens;
|
|
48
48
|
styles = { ...styles,
|
|
49
|
-
backgroundImage:
|
|
49
|
+
backgroundImage: `linear-gradient(${angle}deg, ${stopOne.color}, 75% , ${stopTwo.color})`
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -100,7 +100,7 @@ const selectOuterWidthStyles = _ref3 => {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
if (_Platform.default.OS === 'web') {
|
|
103
|
-
widthStyles.width =
|
|
103
|
+
widthStyles.width = `calc(${width} + ${outerBorderOffset * 2}px)`;
|
|
104
104
|
return widthStyles;
|
|
105
105
|
} // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
|
|
106
106
|
|
|
@@ -187,7 +187,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
|
187
187
|
return _Platform.default.select({
|
|
188
188
|
web: {
|
|
189
189
|
// if it would overflow the container, wraps instead
|
|
190
|
-
maxWidth:
|
|
190
|
+
maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
|
|
191
191
|
outline: 'none',
|
|
192
192
|
// removes the default browser :focus outline
|
|
193
193
|
...(0, _utils.getCursorStyle)(inactive, accessibilityRole)
|
|
@@ -93,7 +93,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
93
93
|
const uniqueFields = ['id', 'label'];
|
|
94
94
|
|
|
95
95
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
96
|
-
throw new Error(
|
|
96
|
+
throw new Error(`ButtonGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
97
97
|
} // Some web screenreaders e.g. MacOS Voiceover don't handle radiogroups properly unless radio is direct child of radiogroup
|
|
98
98
|
|
|
99
99
|
|
package/lib/Carousel/Carousel.js
CHANGED
|
@@ -159,8 +159,6 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
159
159
|
*/
|
|
160
160
|
|
|
161
161
|
const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
162
|
-
var _systemProps$accessib;
|
|
163
|
-
|
|
164
162
|
let {
|
|
165
163
|
tokens,
|
|
166
164
|
variant,
|
|
@@ -460,7 +458,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
460
458
|
const getCopyWithPlaceholders = _react.default.useCallback(copyKey => {
|
|
461
459
|
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
|
|
462
460
|
|
|
463
|
-
return
|
|
461
|
+
return `${copyText[0].toUpperCase()}${copyText.slice(1)}`;
|
|
464
462
|
}, [activeIndex, childrenArray.length, itemLabel, getCopy, title]);
|
|
465
463
|
|
|
466
464
|
const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CarouselTabsPanel.default, {
|
|
@@ -484,7 +482,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
484
482
|
// otherwise read the current position on focus
|
|
485
483
|
|
|
486
484
|
|
|
487
|
-
const containerAccessibilityLabel =
|
|
485
|
+
const containerAccessibilityLabel = systemProps.accessibilityLabel ?? isFirstFocusContainer ? `${title ? `${title} ` : ''}${getCopyWithPlaceholders('stepTrackerLabel')}` : title;
|
|
488
486
|
const containerProps = {
|
|
489
487
|
accessibilityLabel: containerAccessibilityLabel,
|
|
490
488
|
// If used for focus, attach the ref and draw a focus box around the whole carousel
|
|
@@ -54,7 +54,7 @@ function useCarousel() {
|
|
|
54
54
|
const context = _react.default.useContext(CarouselContext);
|
|
55
55
|
|
|
56
56
|
if (context === undefined) {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(`'useCarousel' must be used within a 'CarouselProvider'`);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return context;
|
|
@@ -40,7 +40,7 @@ const CarouselFirstFocus = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
40
|
} = (0, _CarouselContext.useCarousel)(); // TODO: integrate skip link description if behaving as skip link.
|
|
41
41
|
// Consider moving this content to aria-live area while only the skip link is focused.
|
|
42
42
|
|
|
43
|
-
const accessibilityLabel =
|
|
43
|
+
const accessibilityLabel = `${title}, ${getCopyWithPlaceholders('stepTrackerLabel')}`;
|
|
44
44
|
|
|
45
45
|
const accessibilityRole = _Platform.default.select({
|
|
46
46
|
web: 'link',
|
|
@@ -38,7 +38,7 @@ const CarouselThumbnail = _ref => {
|
|
|
38
38
|
goTo,
|
|
39
39
|
themeTokens
|
|
40
40
|
} = (0, _CarouselContext.useCarousel)();
|
|
41
|
-
const thumbnailTitle = alt
|
|
41
|
+
const thumbnailTitle = alt ?? getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
|
|
42
42
|
|
|
43
43
|
const handlePress = () => goTo(index);
|
|
44
44
|
|
|
@@ -81,7 +81,7 @@ const CarouselThumbnail = _ref => {
|
|
|
81
81
|
style: [styles.pressable, index === activeIndex && styles.selected],
|
|
82
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
83
83
|
accessibilityIgnoresInvertColors: true,
|
|
84
|
-
accessibilityLabel: accessibilityLabel
|
|
84
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
85
85
|
source: src,
|
|
86
86
|
style: styles.image,
|
|
87
87
|
title: thumbnailTitle
|
package/lib/Checkbox/Checkbox.js
CHANGED
|
@@ -215,7 +215,7 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
const uniqueId = (0, _useUniqueId.default)('checkbox');
|
|
218
|
-
const inputId = id
|
|
218
|
+
const inputId = id ?? uniqueId;
|
|
219
219
|
const {
|
|
220
220
|
themeOptions
|
|
221
221
|
} = (0, _ThemeProvider.useTheme)();
|
|
@@ -120,7 +120,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
120
120
|
const uniqueFields = ['id', 'label'];
|
|
121
121
|
|
|
122
122
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
123
|
-
throw new Error(
|
|
123
|
+
throw new Error(`CheckboxGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
const checkboxes = items.map((_ref2, index) => {
|
|
@@ -131,7 +131,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
131
131
|
ref: itemRef,
|
|
132
132
|
...itemRest
|
|
133
133
|
} = _ref2;
|
|
134
|
-
const checkboxId = id ||
|
|
134
|
+
const checkboxId = id || `Checkbox[${index}]`;
|
|
135
135
|
|
|
136
136
|
const handleChange = (newCheckedState, event) => {
|
|
137
137
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
package/lib/Divider/Divider.js
CHANGED
|
@@ -119,9 +119,9 @@ const Divider = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
119
119
|
};
|
|
120
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
121
121
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, { ...spacerProps,
|
|
122
|
-
testID: testID ?
|
|
122
|
+
testID: testID ? `${testID}-Spacer-before` : undefined
|
|
123
123
|
}), divider, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, { ...spacerProps,
|
|
124
|
-
testID: testID ?
|
|
124
|
+
testID: testID ? `${testID}-Spacer-after` : undefined
|
|
125
125
|
})]
|
|
126
126
|
});
|
|
127
127
|
});
|
package/lib/FlexGrid/Col/Col.js
CHANGED
|
@@ -67,7 +67,7 @@ const Col = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
67
67
|
const horizontalAlignLevel = getHorizontalAlignLevel();
|
|
68
68
|
|
|
69
69
|
const toPercent = num => {
|
|
70
|
-
return
|
|
70
|
+
return `${num / 12 * 100}%`;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const calculateWidth = value => {
|
package/lib/Icon/Icon.js
CHANGED
|
@@ -48,7 +48,7 @@ const Icon = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
48
48
|
// TODO: systematise animations.
|
|
49
49
|
// https://github.com/telus/universal-design-system/issues/487
|
|
50
50
|
transition: 'transform 200ms, color 200ms',
|
|
51
|
-
transform: [themeTokens.scale ?
|
|
51
|
+
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
|
|
52
52
|
},
|
|
53
53
|
dataSet: dataSet,
|
|
54
54
|
children: iconContent
|
|
@@ -25,7 +25,8 @@ const tokenTypes = {
|
|
|
25
25
|
itemFontWeight: _propTypes.default.string.isRequired,
|
|
26
26
|
itemFontSize: _propTypes.default.number.isRequired,
|
|
27
27
|
itemLineHeight: _propTypes.default.number.isRequired,
|
|
28
|
-
itemFontName: _propTypes.default.string.isRequired
|
|
28
|
+
itemFontName: _propTypes.default.string.isRequired,
|
|
29
|
+
itemFontColor: _propTypes.default.string
|
|
29
30
|
};
|
|
30
31
|
exports.tokenTypes = tokenTypes;
|
|
31
32
|
|
|
@@ -34,9 +35,11 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
34
35
|
itemFontWeight,
|
|
35
36
|
itemFontSize,
|
|
36
37
|
itemLineHeight,
|
|
37
|
-
itemFontName
|
|
38
|
+
itemFontName,
|
|
39
|
+
itemFontColor
|
|
38
40
|
} = _ref;
|
|
39
41
|
return (0, _ThemeProvider.applyTextStyles)({
|
|
42
|
+
fontColor: itemFontColor,
|
|
40
43
|
fontWeight: itemFontWeight,
|
|
41
44
|
fontSize: itemFontSize,
|
|
42
45
|
lineHeight: itemLineHeight,
|
|
@@ -36,6 +36,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
36
36
|
const selectPressableStyles = _ref => {
|
|
37
37
|
let {
|
|
38
38
|
backgroundColor,
|
|
39
|
+
itemFontColor,
|
|
39
40
|
paddingLeft,
|
|
40
41
|
paddingRight,
|
|
41
42
|
paddingTop,
|
|
@@ -44,6 +45,7 @@ const selectPressableStyles = _ref => {
|
|
|
44
45
|
} = _ref;
|
|
45
46
|
return {
|
|
46
47
|
backgroundColor,
|
|
48
|
+
itemFontColor,
|
|
47
49
|
paddingLeft,
|
|
48
50
|
paddingRight,
|
|
49
51
|
paddingTop,
|
|
@@ -110,13 +110,13 @@ const MultiSelectFilter = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
110
110
|
copy
|
|
111
111
|
});
|
|
112
112
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
113
|
-
const [checkedIds, setCheckedIds] = (0, _react.useState)(currentValues
|
|
113
|
+
const [checkedIds, setCheckedIds] = (0, _react.useState)(currentValues ?? []);
|
|
114
114
|
const colSize = items.length > rowLimit ? 2 : 1;
|
|
115
115
|
const isSelected = currentValues.length > 0;
|
|
116
116
|
const uniqueFields = ['id', 'label'];
|
|
117
117
|
|
|
118
118
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
119
|
-
throw new Error(
|
|
119
|
+
throw new Error(`MultiSelectFilter items must have unique ${uniqueFields.join(', ')}`);
|
|
120
120
|
} // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
121
121
|
|
|
122
122
|
|
|
@@ -54,8 +54,8 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
54
54
|
key: 'active-item'
|
|
55
55
|
} : {};
|
|
56
56
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
57
|
-
const activeLabel = isActive ?
|
|
58
|
-
const accessibilityLabel =
|
|
57
|
+
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
58
|
+
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
59
59
|
|
|
60
60
|
const {
|
|
61
61
|
hrefAttrs,
|
|
@@ -110,11 +110,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
110
110
|
LinkRouter: LinkRouter,
|
|
111
111
|
linkRouterProps: linkRouterProps
|
|
112
112
|
}), ...items.map((_child, itemIndex) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const buttonLabel = "".concat(itemIndex + 1);
|
|
113
|
+
const buttonLabel = `${itemIndex + 1}`;
|
|
116
114
|
const itemProps = getItemProps(itemIndex);
|
|
117
|
-
const ItemLinkRouter =
|
|
115
|
+
const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
|
|
118
116
|
const itemLinkRouterProps = { ...linkRouterProps,
|
|
119
117
|
...itemProps.linkRouterProps
|
|
120
118
|
};
|
|
@@ -151,7 +149,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
151
149
|
ref: ref,
|
|
152
150
|
...selectProps(rest),
|
|
153
151
|
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
154
|
-
.map((element, index) => [element,
|
|
152
|
+
.map((element, index) => [element, `page-${index + 1}`]).filter(_ref3 => {
|
|
155
153
|
let [element] = _ref3;
|
|
156
154
|
return element !== null;
|
|
157
155
|
}).map(_ref4 => {
|
|
@@ -21,7 +21,7 @@ function usePagination(_ref) {
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const getItemProps = index => {
|
|
24
|
-
var _items$index
|
|
24
|
+
var _items$index;
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
onPress,
|
|
@@ -29,7 +29,7 @@ function usePagination(_ref) {
|
|
|
29
29
|
hrefAttrs,
|
|
30
30
|
variant,
|
|
31
31
|
tokens
|
|
32
|
-
} = (
|
|
32
|
+
} = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
|
|
33
33
|
return {
|
|
34
34
|
onPress,
|
|
35
35
|
href,
|
|
@@ -43,7 +43,7 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
43
43
|
borderRadius,
|
|
44
44
|
outlineWidth,
|
|
45
45
|
outlineColor,
|
|
46
|
-
width:
|
|
46
|
+
width: `${percentage}%`
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -104,7 +104,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
104
104
|
min: 0,
|
|
105
105
|
max: 100,
|
|
106
106
|
now: percentage,
|
|
107
|
-
text:
|
|
107
|
+
text: `${percentage}%`
|
|
108
108
|
},
|
|
109
109
|
...rest
|
|
110
110
|
});
|
|
@@ -112,7 +112,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
112
112
|
ref: ref,
|
|
113
113
|
style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
|
|
114
114
|
...selectedProps,
|
|
115
|
-
children: children
|
|
115
|
+
children: children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBarBackground.default, {
|
|
116
116
|
variant: variant
|
|
117
117
|
})
|
|
118
118
|
}) : null;
|
|
@@ -21,8 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
23
|
|
|
24
|
-
const inactiveBackground =
|
|
25
|
-
const negativeBackground =
|
|
24
|
+
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`;
|
|
25
|
+
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`;
|
|
26
26
|
const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
27
27
|
let {
|
|
28
28
|
variant
|
|
@@ -40,7 +40,7 @@ const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
|
|
|
40
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageBackground.default, {
|
|
41
41
|
ref: ref,
|
|
42
42
|
source: {
|
|
43
|
-
uri:
|
|
43
|
+
uri: `data:image/svg+xml,${source}`
|
|
44
44
|
},
|
|
45
45
|
style: staticStyles.imageBackground
|
|
46
46
|
});
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -70,7 +70,7 @@ const selectDescriptionStyles = _ref2 => {
|
|
|
70
70
|
labelMarginLeft = 0
|
|
71
71
|
} = _ref2;
|
|
72
72
|
return {
|
|
73
|
-
marginLeft: descriptionMarginLeft
|
|
73
|
+
marginLeft: descriptionMarginLeft ?? containerPaddingLeft + inputSize + labelMarginLeft,
|
|
74
74
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
75
75
|
fontSize: descriptionFontSize,
|
|
76
76
|
lineHeight: descriptionLineHeight
|
|
@@ -174,7 +174,7 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const uniqueId = (0, _utils.useUniqueId)('radio');
|
|
177
|
-
const inputId = id
|
|
177
|
+
const inputId = id ?? uniqueId;
|
|
178
178
|
const selectedProps = selectProps({
|
|
179
179
|
accessibilityRole: 'radio',
|
|
180
180
|
accessibilityState: {
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -122,7 +122,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
122
122
|
const uniqueFields = ['id', 'label'];
|
|
123
123
|
|
|
124
124
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
125
|
-
throw new Error(
|
|
125
|
+
throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const radios = items.map((_ref2, index) => {
|
|
@@ -134,7 +134,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
134
134
|
description,
|
|
135
135
|
...itemRest
|
|
136
136
|
} = _ref2;
|
|
137
|
-
const radioId = id ||
|
|
137
|
+
const radioId = id || `Radio[${index}]`;
|
|
138
138
|
const isChecked = currentValue === radioId;
|
|
139
139
|
|
|
140
140
|
const handleChange = (newCheckedState, event) => {
|
|
@@ -102,7 +102,7 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const uniqueId = (0, _utils.useUniqueId)('RadioCard');
|
|
105
|
-
const inputId = id
|
|
105
|
+
const inputId = id ?? uniqueId;
|
|
106
106
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('RadioCard', tokens, variant);
|
|
107
107
|
|
|
108
108
|
const getCardTokens = cardState => (0, _Card.selectPressableCardTokens)(getTokens(cardState));
|
|
@@ -127,7 +127,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
127
127
|
const uniqueFields = ['id'];
|
|
128
128
|
|
|
129
129
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error(`RadioCardGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fieldset.default, {
|
|
@@ -157,7 +157,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
157
157
|
onChange: itemOnChange,
|
|
158
158
|
...itemRest
|
|
159
159
|
} = _ref2;
|
|
160
|
-
const cardId = id ||
|
|
160
|
+
const cardId = id || `RadioCard[${index}]`;
|
|
161
161
|
|
|
162
162
|
const handleChange = (newCheckedState, event) => {
|
|
163
163
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
package/lib/Search/Search.js
CHANGED
|
@@ -148,7 +148,7 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
148
148
|
|
|
149
149
|
const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
|
|
150
150
|
|
|
151
|
-
const placeholderText = placeholder
|
|
151
|
+
const placeholderText = placeholder ?? a11yLabelText;
|
|
152
152
|
const {
|
|
153
153
|
nativeID,
|
|
154
154
|
testID,
|
package/lib/SideNav/SideNav.js
CHANGED
|
@@ -82,7 +82,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
82
82
|
|
|
83
83
|
const renderItem = (item, index, groupId) => {
|
|
84
84
|
const {
|
|
85
|
-
itemId =
|
|
85
|
+
itemId = `item-${index}`,
|
|
86
86
|
onPress
|
|
87
87
|
} = item.props;
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
|
|
111
111
|
if (child.type === _ItemsGroup.default) {
|
|
112
112
|
const {
|
|
113
|
-
groupId =
|
|
113
|
+
groupId = `group-${index}`
|
|
114
114
|
} = child.props;
|
|
115
115
|
const isGroupActive = active.itemId !== undefined && active.groupId === groupId;
|
|
116
116
|
|
package/lib/Skeleton/Skeleton.js
CHANGED
|
@@ -150,7 +150,7 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
150
150
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
151
151
|
testID: "skeleton",
|
|
152
152
|
style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
|
|
153
|
-
},
|
|
153
|
+
}, `skeleton-${index + 1}`);
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _skeleton = require("./skeleton.constant");
|
|
9
9
|
|
|
10
10
|
var _default = {
|
|
11
|
-
animationDuration:
|
|
11
|
+
animationDuration: `${_skeleton.ANIMATION_DURATION}ms`,
|
|
12
12
|
animationTimingFunction: 'ease-in-out',
|
|
13
13
|
animationDelay: '0.5s',
|
|
14
14
|
animationIterationCount: 'infinite',
|
|
@@ -42,14 +42,12 @@ const exampleGapValue = '1px';
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
const StackWrap = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
45
|
-
var _props$gap;
|
|
46
|
-
|
|
47
45
|
const [canUseCSSGap, setCanUseCSSGap] = (0, _react.useState)(false);
|
|
48
46
|
const {
|
|
49
47
|
space
|
|
50
48
|
} = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
|
|
51
49
|
|
|
52
|
-
const gap =
|
|
50
|
+
const gap = props.gap ?? space;
|
|
53
51
|
const gapEqualsSpace = gap === space; // If possible, use the cleaner implementation that applies CSS `gap` styles to the container,
|
|
54
52
|
// preserving direct parent-child relationships between the container and each item, which
|
|
55
53
|
// can result in clearer descriptions on some screen readers (e.g. radio "X of Y" on MacOS).
|
|
@@ -65,7 +65,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
65
65
|
const validChildren = _react.Children.toArray(topLevelChildren).filter(Boolean);
|
|
66
66
|
|
|
67
67
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
68
|
-
const boxID =
|
|
68
|
+
const boxID = `Stack-Box-${index}`;
|
|
69
69
|
const item = box ?
|
|
70
70
|
/*#__PURE__*/
|
|
71
71
|
// If wrapped in Box, that Box needs a key.
|
|
@@ -75,7 +75,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
75
75
|
testID: boxID
|
|
76
76
|
}, child) : child;
|
|
77
77
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
78
|
-
const testID =
|
|
78
|
+
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
79
79
|
const commonProps = {
|
|
80
80
|
testID,
|
|
81
81
|
key: testID,
|