@telus-uds/components-base 1.77.0 → 1.77.1
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 +12 -2
- package/lib/Link/InlinePressable.js +1 -0
- package/lib/Pagination/PageButton.js +6 -7
- package/lib/StackView/getStackedContent.js +2 -3
- package/lib/StepTracker/StepTracker.js +8 -2
- package/lib/StepTracker/dictionary.js +2 -2
- package/lib-module/Link/InlinePressable.js +1 -0
- package/lib-module/Pagination/PageButton.js +7 -7
- package/lib-module/StackView/getStackedContent.js +2 -3
- package/lib-module/StepTracker/StepTracker.js +8 -2
- package/lib-module/StepTracker/dictionary.js +2 -2
- package/package.json +2 -1
- package/src/Link/InlinePressable.jsx +2 -0
- package/src/Pagination/PageButton.jsx +3 -3
- package/src/StackView/getStackedContent.jsx +12 -3
- package/src/StepTracker/StepTracker.jsx +9 -8
- package/src/StepTracker/dictionary.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 20 Feb 2024 23:07:37 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.77.1
|
|
8
|
+
|
|
9
|
+
Tue, 20 Feb 2024 23:07:37 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- refactor getsteplabel function so step tracker displays multiple labels (evander.owusu@telus.com)
|
|
14
|
+
- fix pagination button-base props warning (guillermo.peitzner@telus.com)
|
|
15
|
+
- fix unexpected scroll when pressing the chevron-link component using the space key (guillermo.peitzner@telus.com)
|
|
16
|
+
|
|
7
17
|
## 1.77.0
|
|
8
18
|
|
|
9
|
-
Wed, 14 Feb 2024 02:
|
|
19
|
+
Wed, 14 Feb 2024 02:29:37 GMT
|
|
10
20
|
|
|
11
21
|
### Minor changes
|
|
12
22
|
|
|
@@ -11,7 +11,6 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
11
11
|
var _utils = require("../utils");
|
|
12
12
|
var _useCopy = _interopRequireDefault(require("../utils/useCopy"));
|
|
13
13
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
16
|
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; }
|
|
@@ -34,11 +33,11 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
34
33
|
const getButtonTokens = buttonState => (0, _utils.selectTokens)('Button', getTokens(buttonState));
|
|
35
34
|
const activeProps = isActive ? {
|
|
36
35
|
selected: true,
|
|
37
|
-
..._utils.a11yProps.nonFocusableProps
|
|
36
|
+
..._utils.a11yProps.nonFocusableProps
|
|
38
37
|
// a brute fix for the focus state being stuck on an active item since it becomes non-focusable
|
|
39
38
|
// (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
|
|
40
|
-
key: 'active-item'
|
|
41
39
|
} : {};
|
|
40
|
+
const key = isActive ? 'active-item' : undefined;
|
|
42
41
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
43
42
|
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
44
43
|
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
@@ -54,13 +53,13 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
54
53
|
hrefAttrs,
|
|
55
54
|
...rest
|
|
56
55
|
};
|
|
57
|
-
return /*#__PURE__*/(0,
|
|
56
|
+
return /*#__PURE__*/(0, _react.createElement)(_ButtonBase.default, {
|
|
58
57
|
ref: ref,
|
|
59
58
|
...buttonProps,
|
|
60
59
|
tokens: getButtonTokens,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
60
|
+
key: key,
|
|
61
|
+
...activeProps
|
|
62
|
+
}, label);
|
|
64
63
|
});
|
|
65
64
|
PageButton.displayName = 'PageButton';
|
|
66
65
|
PageButton.propTypes = {
|
|
@@ -68,17 +68,16 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
68
68
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
69
69
|
const commonProps = {
|
|
70
70
|
testID,
|
|
71
|
-
key: testID,
|
|
72
71
|
space
|
|
73
72
|
};
|
|
74
73
|
const separator = divider ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
75
74
|
vertical: direction.startsWith('row'),
|
|
76
75
|
...dividerProps,
|
|
77
76
|
...commonProps
|
|
78
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
77
|
+
}, testID) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
79
78
|
direction: direction.startsWith('row') ? 'row' : 'column',
|
|
80
79
|
...commonProps
|
|
81
|
-
});
|
|
80
|
+
}, testID);
|
|
82
81
|
return [...newChildren, separator, item];
|
|
83
82
|
}, []);
|
|
84
83
|
return content;
|
|
@@ -74,7 +74,7 @@ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
|
|
|
74
74
|
* ## Usability and A11y guidelines
|
|
75
75
|
*
|
|
76
76
|
* Keep in mind that in its current implementation this is not an interactive
|
|
77
|
-
* component and can
|
|
77
|
+
* component and can't be used to navigate between steps. The application
|
|
78
78
|
* must provide its own navigation mechanism and state control. That is the
|
|
79
79
|
* main reason the component assumes the `progressbar` role in terms of
|
|
80
80
|
* accessibility. This also makes it extremely important to make sure you
|
|
@@ -118,7 +118,13 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
118
118
|
copy
|
|
119
119
|
});
|
|
120
120
|
const stepTrackerLabel = showStepTrackerLabel ? (typeof copy === 'string' ? getCopy(textStepTrackerLabel ?? 1).stepTrackerLabel : getCopy('stepTrackerLabel')).replace('%{stepNumber}', current < steps.length ? current + 1 : steps.length).replace('%{stepCount}', steps.length).replace('%{stepLabel}', current < steps.length ? steps[current] : steps[steps.length - 1]) : '';
|
|
121
|
-
const getStepLabel = index =>
|
|
121
|
+
const getStepLabel = index => {
|
|
122
|
+
if (themeTokens.showStepLabel) {
|
|
123
|
+
var _getCopy;
|
|
124
|
+
return (_getCopy = getCopy(index + 1)) === null || _getCopy === void 0 ? void 0 : _getCopy.stepLabel.replace('%{stepNumber}', index + 1);
|
|
125
|
+
}
|
|
126
|
+
return '';
|
|
127
|
+
};
|
|
122
128
|
const {
|
|
123
129
|
themeOptions
|
|
124
130
|
} = (0, _ThemeProvider.useTheme)();
|
|
@@ -11,7 +11,7 @@ var _default = {
|
|
|
11
11
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
12
12
|
},
|
|
13
13
|
2: {
|
|
14
|
-
stepLabel: '%{stepNumber}
|
|
14
|
+
stepLabel: 'Step %{stepNumber}',
|
|
15
15
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
16
16
|
},
|
|
17
17
|
3: {
|
|
@@ -25,7 +25,7 @@ var _default = {
|
|
|
25
25
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
26
26
|
},
|
|
27
27
|
2: {
|
|
28
|
-
stepLabel: '%{stepNumber}
|
|
28
|
+
stepLabel: 'Étape %{stepNumber}',
|
|
29
29
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
30
30
|
},
|
|
31
31
|
3: {
|
|
@@ -5,7 +5,7 @@ import { useThemeTokensCallback } from '../ThemeProvider';
|
|
|
5
5
|
import { a11yProps, copyPropTypes, getTokensPropType, hrefAttrsProp, linkProps, selectTokens, variantProp, withLinkRouter } from '../utils';
|
|
6
6
|
import useCopy from '../utils/useCopy';
|
|
7
7
|
import dictionary from './dictionary';
|
|
8
|
-
import {
|
|
8
|
+
import { createElement as _createElement } from "react";
|
|
9
9
|
const PageButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
10
10
|
let {
|
|
11
11
|
label,
|
|
@@ -25,11 +25,11 @@ const PageButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
25
25
|
const getButtonTokens = buttonState => selectTokens('Button', getTokens(buttonState));
|
|
26
26
|
const activeProps = isActive ? {
|
|
27
27
|
selected: true,
|
|
28
|
-
...a11yProps.nonFocusableProps
|
|
28
|
+
...a11yProps.nonFocusableProps
|
|
29
29
|
// a brute fix for the focus state being stuck on an active item since it becomes non-focusable
|
|
30
30
|
// (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
|
|
31
|
-
key: 'active-item'
|
|
32
31
|
} : {};
|
|
32
|
+
const key = isActive ? 'active-item' : undefined;
|
|
33
33
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
34
34
|
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
35
35
|
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
@@ -45,13 +45,13 @@ const PageButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
45
45
|
hrefAttrs,
|
|
46
46
|
...rest
|
|
47
47
|
};
|
|
48
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/_createElement(ButtonBase, {
|
|
49
49
|
ref: ref,
|
|
50
50
|
...buttonProps,
|
|
51
51
|
tokens: getButtonTokens,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
52
|
+
key: key,
|
|
53
|
+
...activeProps
|
|
54
|
+
}, label);
|
|
55
55
|
});
|
|
56
56
|
PageButton.displayName = 'PageButton';
|
|
57
57
|
PageButton.propTypes = {
|
|
@@ -62,17 +62,16 @@ const getStackedContent = (children, _ref) => {
|
|
|
62
62
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
63
63
|
const commonProps = {
|
|
64
64
|
testID,
|
|
65
|
-
key: testID,
|
|
66
65
|
space
|
|
67
66
|
};
|
|
68
67
|
const separator = divider ? /*#__PURE__*/_jsx(Divider, {
|
|
69
68
|
vertical: direction.startsWith('row'),
|
|
70
69
|
...dividerProps,
|
|
71
70
|
...commonProps
|
|
72
|
-
}) : /*#__PURE__*/_jsx(Spacer, {
|
|
71
|
+
}, testID) : /*#__PURE__*/_jsx(Spacer, {
|
|
73
72
|
direction: direction.startsWith('row') ? 'row' : 'column',
|
|
74
73
|
...commonProps
|
|
75
|
-
});
|
|
74
|
+
}, testID);
|
|
76
75
|
return [...newChildren, separator, item];
|
|
77
76
|
}, []);
|
|
78
77
|
return content;
|
|
@@ -66,7 +66,7 @@ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
|
|
|
66
66
|
* ## Usability and A11y guidelines
|
|
67
67
|
*
|
|
68
68
|
* Keep in mind that in its current implementation this is not an interactive
|
|
69
|
-
* component and can
|
|
69
|
+
* component and can't be used to navigate between steps. The application
|
|
70
70
|
* must provide its own navigation mechanism and state control. That is the
|
|
71
71
|
* main reason the component assumes the `progressbar` role in terms of
|
|
72
72
|
* accessibility. This also makes it extremely important to make sure you
|
|
@@ -110,7 +110,13 @@ const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
110
110
|
copy
|
|
111
111
|
});
|
|
112
112
|
const stepTrackerLabel = showStepTrackerLabel ? (typeof copy === 'string' ? getCopy(textStepTrackerLabel ?? 1).stepTrackerLabel : getCopy('stepTrackerLabel')).replace('%{stepNumber}', current < steps.length ? current + 1 : steps.length).replace('%{stepCount}', steps.length).replace('%{stepLabel}', current < steps.length ? steps[current] : steps[steps.length - 1]) : '';
|
|
113
|
-
const getStepLabel = index =>
|
|
113
|
+
const getStepLabel = index => {
|
|
114
|
+
if (themeTokens.showStepLabel) {
|
|
115
|
+
var _getCopy;
|
|
116
|
+
return (_getCopy = getCopy(index + 1)) === null || _getCopy === void 0 ? void 0 : _getCopy.stepLabel.replace('%{stepNumber}', index + 1);
|
|
117
|
+
}
|
|
118
|
+
return '';
|
|
119
|
+
};
|
|
114
120
|
const {
|
|
115
121
|
themeOptions
|
|
116
122
|
} = useTheme();
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
6
6
|
},
|
|
7
7
|
2: {
|
|
8
|
-
stepLabel: '%{stepNumber}
|
|
8
|
+
stepLabel: 'Step %{stepNumber}',
|
|
9
9
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
10
10
|
},
|
|
11
11
|
3: {
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
20
20
|
},
|
|
21
21
|
2: {
|
|
22
|
-
stepLabel: '%{stepNumber}
|
|
22
|
+
stepLabel: 'Étape %{stepNumber}',
|
|
23
23
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
24
24
|
},
|
|
25
25
|
3: {
|
package/package.json
CHANGED
|
@@ -28,12 +28,12 @@ const PageButton = forwardRef(
|
|
|
28
28
|
const activeProps = isActive
|
|
29
29
|
? {
|
|
30
30
|
selected: true,
|
|
31
|
-
...a11yProps.nonFocusableProps
|
|
31
|
+
...a11yProps.nonFocusableProps
|
|
32
32
|
// a brute fix for the focus state being stuck on an active item since it becomes non-focusable
|
|
33
33
|
// (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
|
|
34
|
-
key: 'active-item'
|
|
35
34
|
}
|
|
36
35
|
: {}
|
|
36
|
+
const key = isActive ? 'active-item' : undefined
|
|
37
37
|
|
|
38
38
|
const accessibilityRole = href !== undefined ? 'link' : 'button'
|
|
39
39
|
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : ''
|
|
@@ -50,7 +50,7 @@ const PageButton = forwardRef(
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
|
-
<ButtonBase ref={ref} {...buttonProps} tokens={getButtonTokens} {...activeProps}>
|
|
53
|
+
<ButtonBase ref={ref} {...buttonProps} tokens={getButtonTokens} key={key} {...activeProps}>
|
|
54
54
|
{label}
|
|
55
55
|
</ButtonBase>
|
|
56
56
|
)
|
|
@@ -54,11 +54,20 @@ const getStackedContent = (
|
|
|
54
54
|
if (!index || (!space && !divider)) return [...newChildren, item]
|
|
55
55
|
|
|
56
56
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`
|
|
57
|
-
const commonProps = { testID,
|
|
57
|
+
const commonProps = { testID, space }
|
|
58
58
|
const separator = divider ? (
|
|
59
|
-
<Divider
|
|
59
|
+
<Divider
|
|
60
|
+
vertical={direction.startsWith('row')}
|
|
61
|
+
key={testID}
|
|
62
|
+
{...dividerProps}
|
|
63
|
+
{...commonProps}
|
|
64
|
+
/>
|
|
60
65
|
) : (
|
|
61
|
-
<Spacer
|
|
66
|
+
<Spacer
|
|
67
|
+
direction={direction.startsWith('row') ? 'row' : 'column'}
|
|
68
|
+
key={testID}
|
|
69
|
+
{...commonProps}
|
|
70
|
+
/>
|
|
62
71
|
)
|
|
63
72
|
return [...newChildren, separator, item]
|
|
64
73
|
}, [])
|
|
@@ -51,7 +51,7 @@ const selectStepTrackerLabelStyles = (
|
|
|
51
51
|
* ## Usability and A11y guidelines
|
|
52
52
|
*
|
|
53
53
|
* Keep in mind that in its current implementation this is not an interactive
|
|
54
|
-
* component and can
|
|
54
|
+
* component and can't be used to navigate between steps. The application
|
|
55
55
|
* must provide its own navigation mechanism and state control. That is the
|
|
56
56
|
* main reason the component assumes the `progressbar` role in terms of
|
|
57
57
|
* accessibility. This also makes it extremely important to make sure you
|
|
@@ -106,13 +106,14 @@ const StepTracker = forwardRef(
|
|
|
106
106
|
current < steps.length ? steps[current] : steps[steps.length - 1]
|
|
107
107
|
)
|
|
108
108
|
: ''
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
|
|
110
|
+
const getStepLabel = (index) => {
|
|
111
|
+
if (themeTokens.showStepLabel) {
|
|
112
|
+
return getCopy(index + 1)?.stepLabel.replace('%{stepNumber}', index + 1)
|
|
113
|
+
}
|
|
114
|
+
return ''
|
|
115
|
+
}
|
|
116
|
+
|
|
116
117
|
const { themeOptions } = useTheme()
|
|
117
118
|
if (!steps.length) return null
|
|
118
119
|
const selectedProps = selectProps({
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
6
6
|
},
|
|
7
7
|
2: {
|
|
8
|
-
stepLabel: '%{stepNumber}
|
|
8
|
+
stepLabel: 'Step %{stepNumber}',
|
|
9
9
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
10
10
|
},
|
|
11
11
|
3: {
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
20
20
|
},
|
|
21
21
|
2: {
|
|
22
|
-
stepLabel: '%{stepNumber}
|
|
22
|
+
stepLabel: 'Étape %{stepNumber}',
|
|
23
23
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
24
24
|
},
|
|
25
25
|
3: {
|