@telus-uds/components-base 1.23.0 → 1.24.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 +18 -2
- package/component-docs.json +11 -11
- package/lib/ActivityIndicator/Spinner.js +6 -4
- package/lib/ActivityIndicator/Spinner.native.js +8 -6
- package/lib/ActivityIndicator/index.js +10 -3
- package/lib/ActivityIndicator/shared.js +2 -1
- package/lib/Feedback/Feedback.js +2 -5
- package/lib/Fieldset/Fieldset.js +3 -1
- package/lib/List/ListItem.js +10 -2
- package/lib/Radio/RadioGroup.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +6 -4
- package/lib-module/ActivityIndicator/Spinner.native.js +8 -6
- package/lib-module/ActivityIndicator/index.js +10 -3
- package/lib-module/ActivityIndicator/shared.js +2 -1
- package/lib-module/Feedback/Feedback.js +2 -5
- package/lib-module/Fieldset/Fieldset.js +3 -1
- package/lib-module/List/ListItem.js +10 -2
- package/lib-module/Radio/RadioGroup.js +1 -1
- package/package.json +1 -1
- package/src/ActivityIndicator/Spinner.jsx +5 -6
- package/src/ActivityIndicator/Spinner.native.jsx +7 -6
- package/src/ActivityIndicator/index.jsx +9 -3
- package/src/ActivityIndicator/shared.js +2 -1
- package/src/Feedback/Feedback.jsx +3 -8
- package/src/Fieldset/Fieldset.jsx +1 -1
- package/src/List/ListItem.jsx +3 -1
- package/src/Radio/RadioGroup.jsx +1 -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 Thu, 05 Jan 2023 03:41:27 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.24.1
|
|
8
|
+
|
|
9
|
+
Thu, 05 Jan 2023 03:41:27 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fix the list with headings in docs and storybook (mauricio.batresmontejo@telus.com)
|
|
14
|
+
|
|
15
|
+
## 1.24.0
|
|
16
|
+
|
|
17
|
+
Thu, 15 Dec 2022 23:08:41 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- Add `isStatic` prop to `ActivityIndicator` and `Spinner` (shahzaibkhalidmalik@outlook.com)
|
|
22
|
+
|
|
7
23
|
## 1.23.0
|
|
8
24
|
|
|
9
|
-
Wed, 14 Dec 2022 01:
|
|
25
|
+
Wed, 14 Dec 2022 01:46:10 GMT
|
|
10
26
|
|
|
11
27
|
### Minor changes
|
|
12
28
|
|
package/component-docs.json
CHANGED
|
@@ -2541,6 +2541,17 @@
|
|
|
2541
2541
|
"docs": {
|
|
2542
2542
|
"description": "`ActivityIndicator` renders a visual loading state.\nIt does not handle positioning or layout of that visual loader.",
|
|
2543
2543
|
"props": {
|
|
2544
|
+
"isStatic": {
|
|
2545
|
+
"defaultValue": {
|
|
2546
|
+
"value": "false",
|
|
2547
|
+
"computed": false
|
|
2548
|
+
},
|
|
2549
|
+
"type": {
|
|
2550
|
+
"name": "bool"
|
|
2551
|
+
},
|
|
2552
|
+
"required": false,
|
|
2553
|
+
"description": "If true, it should render a static spinner"
|
|
2554
|
+
},
|
|
2544
2555
|
"variant": {
|
|
2545
2556
|
"type": {
|
|
2546
2557
|
"name": "objectOf",
|
|
@@ -3452,17 +3463,6 @@
|
|
|
3452
3463
|
"docs": {
|
|
3453
3464
|
"description": "A feedback box commonly used with form fields.\n\n### Standalone usage\nWhile its primary use is to facilitate feedback states for other form components such as `TextInput`,\nyou may use it standalone.\n\n### Complex content\nYou may pass any React tree as the children of this component, bear in mind that a render function\nis better suited for styling children based on Feedback's variant.\n\n### Using a render function\nWhen a function is passed for rendering content, it will receive the feedback text styles and\nvariant as arguments.\n\n### Accessibility\nAll accessibility props set on this component will be applied to the outer container.",
|
|
3454
3465
|
"props": {
|
|
3455
|
-
"showFeedbackIcon": {
|
|
3456
|
-
"defaultValue": {
|
|
3457
|
-
"value": "false",
|
|
3458
|
-
"computed": false
|
|
3459
|
-
},
|
|
3460
|
-
"type": {
|
|
3461
|
-
"name": "bool"
|
|
3462
|
-
},
|
|
3463
|
-
"required": false,
|
|
3464
|
-
"description": ""
|
|
3465
|
-
},
|
|
3466
3466
|
"title": {
|
|
3467
3467
|
"type": {
|
|
3468
3468
|
"name": "string"
|
|
@@ -39,11 +39,13 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
39
39
|
size,
|
|
40
40
|
color,
|
|
41
41
|
thickness,
|
|
42
|
-
label
|
|
42
|
+
label,
|
|
43
|
+
isStatic = false
|
|
43
44
|
} = _ref;
|
|
44
45
|
const {
|
|
45
46
|
reduceMotionEnabled
|
|
46
47
|
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
48
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
47
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
48
50
|
ref: ref,
|
|
49
51
|
width: "".concat(size, "px"),
|
|
@@ -53,7 +55,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
53
55
|
role: "progressbar",
|
|
54
56
|
"aria-busy": true,
|
|
55
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
56
|
-
children: [
|
|
58
|
+
children: [reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("animateTransform", {
|
|
57
59
|
attributeName: "transform",
|
|
58
60
|
type: "rotate",
|
|
59
61
|
values: "-180 24 24;".concat(360 + _shared.MIN_STROKE_ANGLE - 180, " 24 24"),
|
|
@@ -66,9 +68,9 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
66
68
|
cx: "24",
|
|
67
69
|
cy: "24",
|
|
68
70
|
r: "20",
|
|
69
|
-
strokeDasharray:
|
|
71
|
+
strokeDasharray: reduceMotion ? MAX_SVG_LENGTH : [MIN_SVG_LENGTH, SVG_CIRCUMFERENCE],
|
|
70
72
|
strokeDashoffset: 0,
|
|
71
|
-
children:
|
|
73
|
+
children: reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
72
74
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
73
75
|
attributeName: "stroke-dashoffset",
|
|
74
76
|
values: "0;-10;".concat(MIN_SVG_LENGTH - SVG_CIRCUMFERENCE),
|
|
@@ -34,7 +34,8 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
34
34
|
size,
|
|
35
35
|
color,
|
|
36
36
|
thickness,
|
|
37
|
-
label
|
|
37
|
+
label,
|
|
38
|
+
isStatic = false
|
|
38
39
|
} = _ref;
|
|
39
40
|
|
|
40
41
|
const {
|
|
@@ -44,6 +45,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
44
45
|
const {
|
|
45
46
|
reduceMotionEnabled
|
|
46
47
|
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
48
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
47
49
|
|
|
48
50
|
_react.default.useLayoutEffect(() => {
|
|
49
51
|
const loop = _Animated.default.timing(timer, {
|
|
@@ -55,8 +57,8 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
55
57
|
isInteraction: false
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
if (!
|
|
59
|
-
}, [timer,
|
|
60
|
+
if (!reduceMotion) _Animated.default.loop(loop).start();else loop.stop();
|
|
61
|
+
}, [timer, reduceMotion]);
|
|
60
62
|
|
|
61
63
|
const frames = 60 * _shared.DURATION / 1000;
|
|
62
64
|
|
|
@@ -64,10 +66,10 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
64
66
|
|
|
65
67
|
const containerStyle = {
|
|
66
68
|
width: size,
|
|
67
|
-
height: size / (
|
|
69
|
+
height: size / (reduceMotion ? 1.5 : 2),
|
|
68
70
|
overflow: 'hidden'
|
|
69
71
|
};
|
|
70
|
-
const animationFrequency =
|
|
72
|
+
const animationFrequency = reduceMotion ? [0] : [0, 1]; // Credit to https://github.com/n4kz/react-native-indicators and https://github.com/callstack/react-native-paper for this
|
|
71
73
|
|
|
72
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
73
75
|
ref: ref,
|
|
@@ -106,7 +108,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
106
108
|
height: size
|
|
107
109
|
};
|
|
108
110
|
|
|
109
|
-
if (!
|
|
111
|
+
if (!reduceMotion) {
|
|
110
112
|
layerStyle.transform = [{
|
|
111
113
|
rotate: timer.interpolate({
|
|
112
114
|
inputRange: [0, 1],
|
|
@@ -27,7 +27,8 @@ const ActivityIndicator = _ref => {
|
|
|
27
27
|
let {
|
|
28
28
|
variant,
|
|
29
29
|
tokens,
|
|
30
|
-
label
|
|
30
|
+
label,
|
|
31
|
+
isStatic = false
|
|
31
32
|
} = _ref;
|
|
32
33
|
const {
|
|
33
34
|
size,
|
|
@@ -38,7 +39,8 @@ const ActivityIndicator = _ref => {
|
|
|
38
39
|
size: size,
|
|
39
40
|
color: color,
|
|
40
41
|
thickness: thickness,
|
|
41
|
-
label: label
|
|
42
|
+
label: label,
|
|
43
|
+
isStatic: isStatic
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -49,7 +51,12 @@ ActivityIndicator.propTypes = {
|
|
|
49
51
|
/**
|
|
50
52
|
* A visually hidden accessible label describing the action taking place
|
|
51
53
|
*/
|
|
52
|
-
label: _propTypes.default.string.isRequired
|
|
54
|
+
label: _propTypes.default.string.isRequired,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* If true, it should render a static spinner
|
|
58
|
+
*/
|
|
59
|
+
isStatic: _propTypes.default.bool
|
|
53
60
|
};
|
|
54
61
|
var _default = ActivityIndicator;
|
|
55
62
|
exports.default = _default;
|
|
@@ -22,6 +22,7 @@ const propTypes = {
|
|
|
22
22
|
color: _propTypes.default.string.isRequired,
|
|
23
23
|
label: _propTypes.default.string.isRequired,
|
|
24
24
|
size: _propTypes.default.number.isRequired,
|
|
25
|
-
thickness: _propTypes.default.number.isRequired
|
|
25
|
+
thickness: _propTypes.default.number.isRequired,
|
|
26
|
+
isStatic: _propTypes.default.bool
|
|
26
27
|
};
|
|
27
28
|
exports.propTypes = propTypes;
|
package/lib/Feedback/Feedback.js
CHANGED
|
@@ -105,12 +105,10 @@ const Feedback = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
105
105
|
validation,
|
|
106
106
|
tokens,
|
|
107
107
|
variant,
|
|
108
|
-
showFeedbackIcon = false,
|
|
109
108
|
...rest
|
|
110
109
|
} = _ref5;
|
|
111
110
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Feedback', tokens, { ...variant,
|
|
112
|
-
validation
|
|
113
|
-
icon: showFeedbackIcon
|
|
111
|
+
validation
|
|
114
112
|
});
|
|
115
113
|
const {
|
|
116
114
|
space
|
|
@@ -176,8 +174,7 @@ Feedback.propTypes = { ...selectedSystemPropTypes,
|
|
|
176
174
|
/** @ignore */
|
|
177
175
|
id: _propTypes.default.string,
|
|
178
176
|
tokens: (0, _utils.getTokensPropType)('Feedback'),
|
|
179
|
-
variant: _utils.variantProp.propType
|
|
180
|
-
showFeedbackIcon: _propTypes.default.bool
|
|
177
|
+
variant: _utils.variantProp.propType
|
|
181
178
|
};
|
|
182
179
|
var _default = Feedback;
|
|
183
180
|
exports.default = _default;
|
package/lib/Fieldset/Fieldset.js
CHANGED
|
@@ -78,7 +78,9 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
78
78
|
id: feedbackId,
|
|
79
79
|
title: feedback,
|
|
80
80
|
validation: validation,
|
|
81
|
-
|
|
81
|
+
variant: {
|
|
82
|
+
icon: showIcon
|
|
83
|
+
}
|
|
82
84
|
}); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
|
|
83
85
|
// and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
|
|
84
86
|
// fieldset as much as possible, but also allow different spacing within content and between
|
package/lib/List/ListItem.js
CHANGED
|
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _ListItemBase = _interopRequireDefault(require("./ListItemBase"));
|
|
11
11
|
|
|
12
|
+
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
13
|
+
|
|
12
14
|
var _ThemeProvider = require("../ThemeProvider");
|
|
13
15
|
|
|
14
16
|
var _utils = require("../utils");
|
|
@@ -29,14 +31,20 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
29
31
|
tokens,
|
|
30
32
|
variant,
|
|
31
33
|
children,
|
|
34
|
+
title,
|
|
32
35
|
...listItemProps
|
|
33
36
|
} = _ref;
|
|
34
37
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListItemBase.default, {
|
|
36
39
|
tokens: themeTokens,
|
|
37
40
|
ref: ref,
|
|
38
41
|
...listItemProps,
|
|
39
|
-
children:
|
|
42
|
+
children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
43
|
+
variant: {
|
|
44
|
+
size: 'h4'
|
|
45
|
+
},
|
|
46
|
+
children: title
|
|
47
|
+
}), children]
|
|
40
48
|
});
|
|
41
49
|
});
|
|
42
50
|
ListItem.displayName = 'ListItem';
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -168,8 +168,8 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
168
168
|
feedback: feedback,
|
|
169
169
|
inactive: inactive,
|
|
170
170
|
validation: validation,
|
|
171
|
-
showIcon: true,
|
|
172
171
|
showErrorBorder: true,
|
|
172
|
+
showIcon: true,
|
|
173
173
|
accessibilityRole: "radiogroup",
|
|
174
174
|
...selectProps(rest),
|
|
175
175
|
children: (0, _StackView.getStackedContent)(radios, {
|
|
@@ -26,11 +26,13 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
26
26
|
size,
|
|
27
27
|
color,
|
|
28
28
|
thickness,
|
|
29
|
-
label
|
|
29
|
+
label,
|
|
30
|
+
isStatic = false
|
|
30
31
|
} = _ref;
|
|
31
32
|
const {
|
|
32
33
|
reduceMotionEnabled
|
|
33
34
|
} = useA11yInfo();
|
|
35
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
34
36
|
return /*#__PURE__*/_jsx("svg", {
|
|
35
37
|
ref: ref,
|
|
36
38
|
width: "".concat(size, "px"),
|
|
@@ -40,7 +42,7 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
40
42
|
role: "progressbar",
|
|
41
43
|
"aria-busy": true,
|
|
42
44
|
children: /*#__PURE__*/_jsxs("g", {
|
|
43
|
-
children: [
|
|
45
|
+
children: [reduceMotion ? null : /*#__PURE__*/_jsx("animateTransform", {
|
|
44
46
|
attributeName: "transform",
|
|
45
47
|
type: "rotate",
|
|
46
48
|
values: "-180 24 24;".concat(360 + MIN_STROKE_ANGLE - 180, " 24 24"),
|
|
@@ -53,9 +55,9 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
53
55
|
cx: "24",
|
|
54
56
|
cy: "24",
|
|
55
57
|
r: "20",
|
|
56
|
-
strokeDasharray:
|
|
58
|
+
strokeDasharray: reduceMotion ? MAX_SVG_LENGTH : [MIN_SVG_LENGTH, SVG_CIRCUMFERENCE],
|
|
57
59
|
strokeDashoffset: 0,
|
|
58
|
-
children:
|
|
60
|
+
children: reduceMotion ? null : /*#__PURE__*/_jsxs(_Fragment, {
|
|
59
61
|
children: [/*#__PURE__*/_jsx("animate", {
|
|
60
62
|
attributeName: "stroke-dashoffset",
|
|
61
63
|
values: "0;-10;".concat(MIN_SVG_LENGTH - SVG_CIRCUMFERENCE),
|
|
@@ -13,7 +13,8 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
13
13
|
size,
|
|
14
14
|
color,
|
|
15
15
|
thickness,
|
|
16
|
-
label
|
|
16
|
+
label,
|
|
17
|
+
isStatic = false
|
|
17
18
|
} = _ref;
|
|
18
19
|
const {
|
|
19
20
|
current: timer
|
|
@@ -21,6 +22,7 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
21
22
|
const {
|
|
22
23
|
reduceMotionEnabled
|
|
23
24
|
} = useA11yInfo();
|
|
25
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
24
26
|
React.useLayoutEffect(() => {
|
|
25
27
|
const loop = Animated.timing(timer, {
|
|
26
28
|
duration: DURATION,
|
|
@@ -30,16 +32,16 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
30
32
|
toValue: 1,
|
|
31
33
|
isInteraction: false
|
|
32
34
|
});
|
|
33
|
-
if (!
|
|
34
|
-
}, [timer,
|
|
35
|
+
if (!reduceMotion) Animated.loop(loop).start();else loop.stop();
|
|
36
|
+
}, [timer, reduceMotion]);
|
|
35
37
|
const frames = 60 * DURATION / 1000;
|
|
36
38
|
const easing = Easing.bezier(...BEZIER);
|
|
37
39
|
const containerStyle = {
|
|
38
40
|
width: size,
|
|
39
|
-
height: size / (
|
|
41
|
+
height: size / (reduceMotion ? 1.5 : 2),
|
|
40
42
|
overflow: 'hidden'
|
|
41
43
|
};
|
|
42
|
-
const animationFrequency =
|
|
44
|
+
const animationFrequency = reduceMotion ? [0] : [0, 1]; // Credit to https://github.com/n4kz/react-native-indicators and https://github.com/callstack/react-native-paper for this
|
|
43
45
|
|
|
44
46
|
return /*#__PURE__*/_jsx(View, {
|
|
45
47
|
ref: ref,
|
|
@@ -78,7 +80,7 @@ const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
78
80
|
height: size
|
|
79
81
|
};
|
|
80
82
|
|
|
81
|
-
if (!
|
|
83
|
+
if (!reduceMotion) {
|
|
82
84
|
layerStyle.transform = [{
|
|
83
85
|
rotate: timer.interpolate({
|
|
84
86
|
inputRange: [0, 1],
|
|
@@ -14,7 +14,8 @@ const ActivityIndicator = _ref => {
|
|
|
14
14
|
let {
|
|
15
15
|
variant,
|
|
16
16
|
tokens,
|
|
17
|
-
label
|
|
17
|
+
label,
|
|
18
|
+
isStatic = false
|
|
18
19
|
} = _ref;
|
|
19
20
|
const {
|
|
20
21
|
size,
|
|
@@ -25,7 +26,8 @@ const ActivityIndicator = _ref => {
|
|
|
25
26
|
size: size,
|
|
26
27
|
color: color,
|
|
27
28
|
thickness: thickness,
|
|
28
|
-
label: label
|
|
29
|
+
label: label,
|
|
30
|
+
isStatic: isStatic
|
|
29
31
|
});
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -36,6 +38,11 @@ ActivityIndicator.propTypes = {
|
|
|
36
38
|
/**
|
|
37
39
|
* A visually hidden accessible label describing the action taking place
|
|
38
40
|
*/
|
|
39
|
-
label: PropTypes.string.isRequired
|
|
41
|
+
label: PropTypes.string.isRequired,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If true, it should render a static spinner
|
|
45
|
+
*/
|
|
46
|
+
isStatic: PropTypes.bool
|
|
40
47
|
};
|
|
41
48
|
export default ActivityIndicator;
|
|
@@ -84,12 +84,10 @@ const Feedback = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
84
84
|
validation,
|
|
85
85
|
tokens,
|
|
86
86
|
variant,
|
|
87
|
-
showFeedbackIcon = false,
|
|
88
87
|
...rest
|
|
89
88
|
} = _ref5;
|
|
90
89
|
const themeTokens = useThemeTokens('Feedback', tokens, { ...variant,
|
|
91
|
-
validation
|
|
92
|
-
icon: showFeedbackIcon
|
|
90
|
+
validation
|
|
93
91
|
});
|
|
94
92
|
const {
|
|
95
93
|
space
|
|
@@ -155,8 +153,7 @@ Feedback.propTypes = { ...selectedSystemPropTypes,
|
|
|
155
153
|
/** @ignore */
|
|
156
154
|
id: PropTypes.string,
|
|
157
155
|
tokens: getTokensPropType('Feedback'),
|
|
158
|
-
variant: variantProp.propType
|
|
159
|
-
showFeedbackIcon: PropTypes.bool
|
|
156
|
+
variant: variantProp.propType
|
|
160
157
|
};
|
|
161
158
|
export default Feedback;
|
|
162
159
|
const staticStyles = StyleSheet.create({
|
|
@@ -59,7 +59,9 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
59
59
|
id: feedbackId,
|
|
60
60
|
title: feedback,
|
|
61
61
|
validation: validation,
|
|
62
|
-
|
|
62
|
+
variant: {
|
|
63
|
+
icon: showIcon
|
|
64
|
+
}
|
|
63
65
|
}); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
|
|
64
66
|
// and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
|
|
65
67
|
// fieldset as much as possible, but also allow different spacing within content and between
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import ListItemBase from './ListItemBase';
|
|
3
|
+
import Typography from '../Typography';
|
|
3
4
|
import { useThemeTokens } from '../ThemeProvider';
|
|
4
5
|
import { variantProp } from '../utils';
|
|
5
6
|
/**
|
|
@@ -7,19 +8,26 @@ import { variantProp } from '../utils';
|
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
const ListItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
13
|
let {
|
|
12
14
|
tokens,
|
|
13
15
|
variant,
|
|
14
16
|
children,
|
|
17
|
+
title,
|
|
15
18
|
...listItemProps
|
|
16
19
|
} = _ref;
|
|
17
20
|
const themeTokens = useThemeTokens('List', tokens, variant);
|
|
18
|
-
return /*#__PURE__*/
|
|
21
|
+
return /*#__PURE__*/_jsxs(ListItemBase, {
|
|
19
22
|
tokens: themeTokens,
|
|
20
23
|
ref: ref,
|
|
21
24
|
...listItemProps,
|
|
22
|
-
children:
|
|
25
|
+
children: [Boolean(title) && /*#__PURE__*/_jsx(Typography, {
|
|
26
|
+
variant: {
|
|
27
|
+
size: 'h4'
|
|
28
|
+
},
|
|
29
|
+
children: title
|
|
30
|
+
}), children]
|
|
23
31
|
});
|
|
24
32
|
});
|
|
25
33
|
ListItem.displayName = 'ListItem';
|
|
@@ -145,8 +145,8 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
145
145
|
feedback: feedback,
|
|
146
146
|
inactive: inactive,
|
|
147
147
|
validation: validation,
|
|
148
|
-
showIcon: true,
|
|
149
148
|
showErrorBorder: true,
|
|
149
|
+
showIcon: true,
|
|
150
150
|
accessibilityRole: "radiogroup",
|
|
151
151
|
...selectProps(rest),
|
|
152
152
|
children: getStackedContent(radios, {
|
package/package.json
CHANGED
|
@@ -21,8 +21,9 @@ const bezierProps = {
|
|
|
21
21
|
}
|
|
22
22
|
// We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
23
23
|
// 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.
|
|
24
|
-
const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
24
|
+
const Spinner = forwardRef(({ size, color, thickness, label, isStatic = false }, ref) => {
|
|
25
25
|
const { reduceMotionEnabled } = useA11yInfo()
|
|
26
|
+
const reduceMotion = reduceMotionEnabled || isStatic
|
|
26
27
|
return (
|
|
27
28
|
<svg
|
|
28
29
|
ref={ref}
|
|
@@ -34,7 +35,7 @@ const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
|
34
35
|
aria-busy={true}
|
|
35
36
|
>
|
|
36
37
|
<g>
|
|
37
|
-
{
|
|
38
|
+
{reduceMotion ? null : (
|
|
38
39
|
<animateTransform
|
|
39
40
|
attributeName="transform"
|
|
40
41
|
type="rotate"
|
|
@@ -50,12 +51,10 @@ const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
|
50
51
|
cx="24"
|
|
51
52
|
cy="24"
|
|
52
53
|
r="20"
|
|
53
|
-
strokeDasharray={
|
|
54
|
-
reduceMotionEnabled ? MAX_SVG_LENGTH : [MIN_SVG_LENGTH, SVG_CIRCUMFERENCE]
|
|
55
|
-
}
|
|
54
|
+
strokeDasharray={reduceMotion ? MAX_SVG_LENGTH : [MIN_SVG_LENGTH, SVG_CIRCUMFERENCE]}
|
|
56
55
|
strokeDashoffset={0}
|
|
57
56
|
>
|
|
58
|
-
{
|
|
57
|
+
{reduceMotion ? null : (
|
|
59
58
|
<>
|
|
60
59
|
<animate
|
|
61
60
|
attributeName="stroke-dashoffset"
|
|
@@ -6,9 +6,10 @@ import { useA11yInfo } from '../A11yInfoProvider'
|
|
|
6
6
|
const ea = MIN_EMPTY_ANGLE / 2
|
|
7
7
|
const sa = MIN_STROKE_ANGLE / 2
|
|
8
8
|
|
|
9
|
-
const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
9
|
+
const Spinner = forwardRef(({ size, color, thickness, label, isStatic = false }, ref) => {
|
|
10
10
|
const { current: timer } = React.useRef(new Animated.Value(0))
|
|
11
11
|
const { reduceMotionEnabled } = useA11yInfo()
|
|
12
|
+
const reduceMotion = reduceMotionEnabled || isStatic
|
|
12
13
|
|
|
13
14
|
React.useLayoutEffect(() => {
|
|
14
15
|
const loop = Animated.timing(timer, {
|
|
@@ -20,18 +21,18 @@ const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
|
20
21
|
isInteraction: false
|
|
21
22
|
})
|
|
22
23
|
|
|
23
|
-
if (!
|
|
24
|
+
if (!reduceMotion) Animated.loop(loop).start()
|
|
24
25
|
else loop.stop()
|
|
25
|
-
}, [timer,
|
|
26
|
+
}, [timer, reduceMotion])
|
|
26
27
|
|
|
27
28
|
const frames = (60 * DURATION) / 1000
|
|
28
29
|
const easing = Easing.bezier(...BEZIER)
|
|
29
30
|
const containerStyle = {
|
|
30
31
|
width: size,
|
|
31
|
-
height: size / (
|
|
32
|
+
height: size / (reduceMotion ? 1.5 : 2),
|
|
32
33
|
overflow: 'hidden'
|
|
33
34
|
}
|
|
34
|
-
const animationFrequency =
|
|
35
|
+
const animationFrequency = reduceMotion ? [0] : [0, 1]
|
|
35
36
|
|
|
36
37
|
// Credit to https://github.com/n4kz/react-native-indicators and https://github.com/callstack/react-native-paper for this
|
|
37
38
|
return (
|
|
@@ -72,7 +73,7 @@ const Spinner = forwardRef(({ size, color, thickness, label }, ref) => {
|
|
|
72
73
|
height: size
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
if (!
|
|
76
|
+
if (!reduceMotion) {
|
|
76
77
|
layerStyle.transform = [
|
|
77
78
|
{
|
|
78
79
|
rotate: timer.interpolate({
|
|
@@ -9,9 +9,11 @@ import Spinner from './Spinner'
|
|
|
9
9
|
* `ActivityIndicator` renders a visual loading state.
|
|
10
10
|
* It does not handle positioning or layout of that visual loader.
|
|
11
11
|
*/
|
|
12
|
-
const ActivityIndicator = ({ variant, tokens, label }) => {
|
|
12
|
+
const ActivityIndicator = ({ variant, tokens, label, isStatic = false }) => {
|
|
13
13
|
const { size, color, thickness } = useThemeTokens('ActivityIndicator', tokens, variant)
|
|
14
|
-
return
|
|
14
|
+
return (
|
|
15
|
+
<Spinner size={size} color={color} thickness={thickness} label={label} isStatic={isStatic} />
|
|
16
|
+
)
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
ActivityIndicator.propTypes = {
|
|
@@ -20,7 +22,11 @@ ActivityIndicator.propTypes = {
|
|
|
20
22
|
/**
|
|
21
23
|
* A visually hidden accessible label describing the action taking place
|
|
22
24
|
*/
|
|
23
|
-
label: PropTypes.string.isRequired
|
|
25
|
+
label: PropTypes.string.isRequired,
|
|
26
|
+
/**
|
|
27
|
+
* If true, it should render a static spinner
|
|
28
|
+
*/
|
|
29
|
+
isStatic: PropTypes.bool
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
export default ActivityIndicator
|
|
@@ -56,14 +56,10 @@ const selectIconContainerStyles = ({ iconGap }) => ({
|
|
|
56
56
|
* All accessibility props set on this component will be applied to the outer container.
|
|
57
57
|
*/
|
|
58
58
|
const Feedback = forwardRef(
|
|
59
|
-
(
|
|
60
|
-
{ title, children, id, validation, tokens, variant, showFeedbackIcon = false, ...rest },
|
|
61
|
-
ref
|
|
62
|
-
) => {
|
|
59
|
+
({ title, children, id, validation, tokens, variant, ...rest }, ref) => {
|
|
63
60
|
const themeTokens = useThemeTokens('Feedback', tokens, {
|
|
64
61
|
...variant,
|
|
65
|
-
validation
|
|
66
|
-
icon: showFeedbackIcon
|
|
62
|
+
validation
|
|
67
63
|
})
|
|
68
64
|
const { space } = themeTokens
|
|
69
65
|
|
|
@@ -121,8 +117,7 @@ Feedback.propTypes = {
|
|
|
121
117
|
/** @ignore */
|
|
122
118
|
id: PropTypes.string,
|
|
123
119
|
tokens: getTokensPropType('Feedback'),
|
|
124
|
-
variant: variantProp.propType
|
|
125
|
-
showFeedbackIcon: PropTypes.bool
|
|
120
|
+
variant: variantProp.propType
|
|
126
121
|
}
|
|
127
122
|
|
|
128
123
|
export default Feedback
|
package/src/List/ListItem.jsx
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
3
|
import ListItemBase from './ListItemBase'
|
|
4
|
+
import Typography from '../Typography'
|
|
4
5
|
import { useThemeTokens } from '../ThemeProvider'
|
|
5
6
|
import { variantProp } from '../utils'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* ListItem is responsible for rendering icon or a bullet as side item
|
|
9
10
|
*/
|
|
10
|
-
const ListItem = forwardRef(({ tokens, variant, children, ...listItemProps }, ref) => {
|
|
11
|
+
const ListItem = forwardRef(({ tokens, variant, children, title, ...listItemProps }, ref) => {
|
|
11
12
|
const themeTokens = useThemeTokens('List', tokens, variant)
|
|
12
13
|
return (
|
|
13
14
|
<ListItemBase tokens={themeTokens} ref={ref} {...listItemProps}>
|
|
15
|
+
{Boolean(title) && <Typography variant={{ size: 'h4' }}>{title}</Typography>}
|
|
14
16
|
{children}
|
|
15
17
|
</ListItemBase>
|
|
16
18
|
)
|
package/src/Radio/RadioGroup.jsx
CHANGED