@telus-uds/components-base 3.3.0 → 3.5.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 +28 -2
- package/lib/cjs/ActivityIndicator/Dots.js +165 -0
- package/lib/cjs/ActivityIndicator/Dots.native.js +221 -0
- package/lib/cjs/ActivityIndicator/Spinner.js +57 -50
- package/lib/cjs/ActivityIndicator/Spinner.native.js +90 -108
- package/lib/cjs/ActivityIndicator/index.js +12 -1
- package/lib/cjs/ActivityIndicator/shared.js +53 -6
- package/lib/cjs/Button/ButtonBase.js +1 -1
- package/lib/cjs/Button/ButtonLink.js +1 -0
- package/lib/cjs/Carousel/Carousel.js +18 -7
- package/lib/cjs/ExpandCollapse/ExpandCollapse.js +3 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +10 -1
- package/lib/cjs/FileUpload/FileUpload.js +31 -2
- package/lib/cjs/Link/Link.js +8 -1
- package/lib/cjs/Link/LinkBase.js +2 -0
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +3 -2
- package/lib/cjs/utils/containUniqueFields.js +5 -5
- package/lib/cjs/utils/useUniqueId.js +2 -6
- package/lib/esm/ActivityIndicator/Dots.js +158 -0
- package/lib/esm/ActivityIndicator/Dots.native.js +212 -0
- package/lib/esm/ActivityIndicator/Spinner.js +58 -51
- package/lib/esm/ActivityIndicator/Spinner.native.js +90 -110
- package/lib/esm/ActivityIndicator/index.js +12 -1
- package/lib/esm/ActivityIndicator/shared.js +52 -5
- package/lib/esm/Button/ButtonBase.js +2 -2
- package/lib/esm/Button/ButtonLink.js +2 -1
- package/lib/esm/Carousel/Carousel.js +18 -7
- package/lib/esm/ExpandCollapse/ExpandCollapse.js +4 -2
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +11 -2
- package/lib/esm/FileUpload/FileUpload.js +31 -2
- package/lib/esm/Link/Link.js +8 -1
- package/lib/esm/Link/LinkBase.js +2 -0
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +3 -2
- package/lib/esm/utils/containUniqueFields.js +5 -5
- package/lib/esm/utils/useUniqueId.js +3 -7
- package/lib/package.json +4 -3
- package/package.json +4 -3
- package/src/ActivityIndicator/Dots.jsx +200 -0
- package/src/ActivityIndicator/Dots.native.jsx +213 -0
- package/src/ActivityIndicator/Spinner.jsx +95 -59
- package/src/ActivityIndicator/Spinner.native.jsx +125 -132
- package/src/ActivityIndicator/index.jsx +17 -2
- package/src/ActivityIndicator/shared.js +52 -5
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Button/ButtonLink.jsx +3 -1
- package/src/Carousel/Carousel.jsx +28 -7
- package/src/ExpandCollapse/ExpandCollapse.jsx +9 -4
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +15 -3
- package/src/FileUpload/FileUpload.jsx +32 -2
- package/src/Link/Link.jsx +8 -1
- package/src/Link/LinkBase.jsx +2 -0
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +2 -2
- package/src/utils/containUniqueFields.js +5 -5
- package/src/utils/useUniqueId.js +3 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
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, 24 Mar 2025 16:24:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.5.0
|
|
8
|
+
|
|
9
|
+
Mon, 24 Mar 2025 16:24:15 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Code, Dynatrace alerts and vulnerabilities resolved (35577399+JoshHC@users.noreply.github.com)
|
|
14
|
+
- `ActivityIndicator`: new animation for the spinner and new `dots` variant added (35577399+JoshHC@users.noreply.github.com)
|
|
15
|
+
- `FileUpload`: add dictionary prop (guillermo.peitzner@telus.com)
|
|
16
|
+
- Bump @telus-uds/system-theme-tokens to v4.3.0
|
|
17
|
+
|
|
18
|
+
### Patches
|
|
19
|
+
|
|
20
|
+
- `Link`: Introduced `style` variant. The `alternative` and `inverse` variant is now deprecated and will be removed in future versions. (Mauricio.BatresMontejo@telus.com)
|
|
21
|
+
- `Carousel`: fix autoplay button positioning on mobile (guillermo.peitzner@telus.com)
|
|
22
|
+
- `MultiSelectFilter`: fix button when selected (guillermo.peitzner@telus.com)
|
|
23
|
+
|
|
24
|
+
## 3.4.0
|
|
25
|
+
|
|
26
|
+
Tue, 11 Mar 2025 21:16:58 GMT
|
|
27
|
+
|
|
28
|
+
### Minor changes
|
|
29
|
+
|
|
30
|
+
- `dataSet`: add new contenful attributes (sergio.ramirez@telus.com)
|
|
31
|
+
- Use React's useId hook within useUniqueId for SSR-safe ids (6854874+kyletsang@users.noreply.github.com)
|
|
32
|
+
|
|
7
33
|
## 3.3.0
|
|
8
34
|
|
|
9
|
-
Wed, 05 Mar 2025 00:
|
|
35
|
+
Wed, 05 Mar 2025 00:06:37 GMT
|
|
10
36
|
|
|
11
37
|
### Minor changes
|
|
12
38
|
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _shared = require("./shared");
|
|
9
|
+
var _A11yInfoProvider = require("../A11yInfoProvider");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const CY_PROPS = {
|
|
13
|
+
attributeName: 'cy',
|
|
14
|
+
calcMode: 'spline',
|
|
15
|
+
dur: `${_shared.DOTS_TOTAL_ANIMATION_DURATION}ms`,
|
|
16
|
+
repeatCount: 'indefinite'
|
|
17
|
+
};
|
|
18
|
+
const FILL_PROPS = {
|
|
19
|
+
attributeName: 'fill',
|
|
20
|
+
calcMode: 'linear',
|
|
21
|
+
dur: `${_shared.DOTS_TOTAL_ANIMATION_DURATION}ms`,
|
|
22
|
+
repeatCount: 'indefinite'
|
|
23
|
+
};
|
|
24
|
+
const OPACITY_PROPS = {
|
|
25
|
+
attributeName: 'opacity',
|
|
26
|
+
calcMode: 'linear',
|
|
27
|
+
dur: `${_shared.DOTS_TOTAL_ANIMATION_DURATION}ms`,
|
|
28
|
+
repeatCount: 'indefinite'
|
|
29
|
+
};
|
|
30
|
+
const Dots = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
31
|
+
let {
|
|
32
|
+
size,
|
|
33
|
+
color,
|
|
34
|
+
indicatorBackgroundColor,
|
|
35
|
+
label,
|
|
36
|
+
isStatic = false
|
|
37
|
+
} = _ref;
|
|
38
|
+
const {
|
|
39
|
+
reduceMotionEnabled
|
|
40
|
+
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
41
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
42
|
+
const spacingX = size + _shared.DOTS_SPACING_X;
|
|
43
|
+
const baseY = size * _shared.DOTS_BASE_Y_FACTOR;
|
|
44
|
+
const jumpHeight = size * _shared.DOTS_JUMP_HEIGHT_FACTOR;
|
|
45
|
+
const padding = size * _shared.DOTS_PADDING_FACTOR;
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
47
|
+
ref: ref,
|
|
48
|
+
"aria-valuetext": label,
|
|
49
|
+
role: "progressbar",
|
|
50
|
+
"aria-busy": "true",
|
|
51
|
+
width: size * 3 + spacingX * 2 + padding * 2,
|
|
52
|
+
height: size * 6,
|
|
53
|
+
viewBox: `0 0 ${size * 3 + spacingX * 2 + padding * 2} ${size * 6}`,
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
56
|
+
cx: padding + size / 2,
|
|
57
|
+
cy: baseY,
|
|
58
|
+
r: size / 2,
|
|
59
|
+
fill: color,
|
|
60
|
+
children: !reduceMotion && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
61
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
62
|
+
...CY_PROPS,
|
|
63
|
+
keyTimes: _shared.DOT1_ANIMATION_KEYTIMES,
|
|
64
|
+
keySplines: `${_shared.BOUNCY_CURVE};${_shared.BOUNCY_CURVE};${_shared.BOUNCY_CURVE}`,
|
|
65
|
+
values: `
|
|
66
|
+
${baseY};
|
|
67
|
+
${baseY - jumpHeight * _shared.OVERSHOOT_FACTOR};
|
|
68
|
+
${baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR};
|
|
69
|
+
${baseY}
|
|
70
|
+
`
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
72
|
+
...FILL_PROPS,
|
|
73
|
+
keyTimes: _shared.DOT1_COLOR_KEYTIMES,
|
|
74
|
+
values: `
|
|
75
|
+
${color};
|
|
76
|
+
${color};
|
|
77
|
+
${indicatorBackgroundColor};
|
|
78
|
+
${indicatorBackgroundColor}
|
|
79
|
+
`
|
|
80
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
81
|
+
...OPACITY_PROPS,
|
|
82
|
+
keyTimes: _shared.DOTS_FADEOUT_KEYTIMES,
|
|
83
|
+
values: _shared.DOTS_FADEOUT_VALUES
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
87
|
+
cx: padding + size + spacingX + size / 2,
|
|
88
|
+
cy: baseY,
|
|
89
|
+
r: size / 2,
|
|
90
|
+
fill: indicatorBackgroundColor,
|
|
91
|
+
children: reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
93
|
+
...CY_PROPS,
|
|
94
|
+
keyTimes: _shared.DOT2_ANIMATION_KEYTIMES,
|
|
95
|
+
keySplines: `
|
|
96
|
+
${_shared.BOUNCY_CURVE};
|
|
97
|
+
${_shared.BOUNCY_CURVE};
|
|
98
|
+
${_shared.BOUNCY_CURVE};
|
|
99
|
+
${_shared.BOUNCY_CURVE}
|
|
100
|
+
`,
|
|
101
|
+
values: `
|
|
102
|
+
${baseY};
|
|
103
|
+
${baseY};
|
|
104
|
+
${baseY - jumpHeight * _shared.OVERSHOOT_FACTOR};
|
|
105
|
+
${baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR};
|
|
106
|
+
${baseY}
|
|
107
|
+
`
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
109
|
+
...FILL_PROPS,
|
|
110
|
+
keyTimes: _shared.DOT2_COLOR_KEYTIMES,
|
|
111
|
+
values: `
|
|
112
|
+
${indicatorBackgroundColor};
|
|
113
|
+
${indicatorBackgroundColor};
|
|
114
|
+
${color};
|
|
115
|
+
${color};
|
|
116
|
+
${indicatorBackgroundColor};
|
|
117
|
+
${indicatorBackgroundColor}
|
|
118
|
+
`
|
|
119
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
120
|
+
...OPACITY_PROPS,
|
|
121
|
+
keyTimes: _shared.DOTS_FADEOUT_KEYTIMES,
|
|
122
|
+
values: _shared.DOTS_FADEOUT_VALUES
|
|
123
|
+
})]
|
|
124
|
+
})
|
|
125
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
126
|
+
cx: padding + (size + spacingX) * 2 + size / 2,
|
|
127
|
+
cy: baseY,
|
|
128
|
+
r: size / 2,
|
|
129
|
+
fill: indicatorBackgroundColor,
|
|
130
|
+
children: reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
131
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
132
|
+
...CY_PROPS,
|
|
133
|
+
keyTimes: _shared.DOT3_ANIMATION_KEYTIMES,
|
|
134
|
+
keySplines: `
|
|
135
|
+
${_shared.BOUNCY_CURVE};
|
|
136
|
+
${_shared.BOUNCY_CURVE};
|
|
137
|
+
${_shared.BOUNCY_CURVE};
|
|
138
|
+
${_shared.BOUNCY_CURVE}
|
|
139
|
+
`,
|
|
140
|
+
values: `
|
|
141
|
+
${baseY};
|
|
142
|
+
${baseY};
|
|
143
|
+
${baseY - jumpHeight * _shared.OVERSHOOT_FACTOR};
|
|
144
|
+
${baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR};
|
|
145
|
+
${baseY}
|
|
146
|
+
`
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
148
|
+
...FILL_PROPS,
|
|
149
|
+
keyTimes: _shared.DOT3_COLOR_KEYTIMES,
|
|
150
|
+
values: `
|
|
151
|
+
${indicatorBackgroundColor};
|
|
152
|
+
${indicatorBackgroundColor};
|
|
153
|
+
${color};
|
|
154
|
+
${color};
|
|
155
|
+
${color}
|
|
156
|
+
`
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
Dots.displayName = 'Dots';
|
|
164
|
+
Dots.propTypes = _shared.propTypes;
|
|
165
|
+
var _default = exports.default = Dots;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
9
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
10
|
+
var _Animated = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Animated"));
|
|
11
|
+
var _Easing = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Easing"));
|
|
12
|
+
var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
13
|
+
var _shared = require("./shared");
|
|
14
|
+
var _A11yInfoProvider = require("../A11yInfoProvider");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
const AnimatedCircle = _Animated.default.createAnimatedComponent(_reactNativeSvg.Circle);
|
|
20
|
+
const Dots = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
size,
|
|
23
|
+
color,
|
|
24
|
+
indicatorBackgroundColor,
|
|
25
|
+
label,
|
|
26
|
+
isStatic = false
|
|
27
|
+
} = _ref;
|
|
28
|
+
const {
|
|
29
|
+
reduceMotionEnabled
|
|
30
|
+
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
31
|
+
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
32
|
+
const spacingX = size + _shared.DOTS_SPACING_X;
|
|
33
|
+
const baseY = size * _shared.DOTS_BASE_Y_FACTOR;
|
|
34
|
+
const jumpHeight = size * _shared.DOTS_JUMP_HEIGHT_FACTOR;
|
|
35
|
+
const padding = size * _shared.DOTS_PADDING_FACTOR;
|
|
36
|
+
const width = (size + 1) * 6;
|
|
37
|
+
const height = size * 6;
|
|
38
|
+
const animationValue = _react.default.useRef(new _Animated.default.Value(0)).current;
|
|
39
|
+
_react.default.useEffect(() => {
|
|
40
|
+
if (reduceMotion) {
|
|
41
|
+
animationValue.stopAnimation();
|
|
42
|
+
animationValue.setValue(0);
|
|
43
|
+
return () => {};
|
|
44
|
+
}
|
|
45
|
+
const loopAnimation = _Animated.default.loop(_Animated.default.timing(animationValue, {
|
|
46
|
+
toValue: 1,
|
|
47
|
+
duration: _shared.DOTS_TOTAL_ANIMATION_DURATION,
|
|
48
|
+
easing: _Easing.default.linear,
|
|
49
|
+
useNativeDriver: false
|
|
50
|
+
}));
|
|
51
|
+
loopAnimation.start();
|
|
52
|
+
return () => loopAnimation.stop();
|
|
53
|
+
}, [reduceMotion, animationValue]);
|
|
54
|
+
const makeStepInterpolation = steps => {
|
|
55
|
+
const inputRange = [];
|
|
56
|
+
const outputRange = [];
|
|
57
|
+
steps.forEach(_ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
time,
|
|
60
|
+
value
|
|
61
|
+
} = _ref2;
|
|
62
|
+
inputRange.push(time);
|
|
63
|
+
outputRange.push(value);
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
inputRange,
|
|
67
|
+
outputRange
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// ---- DOT 1 ----
|
|
72
|
+
const dot1Cy = animationValue.interpolate({
|
|
73
|
+
inputRange: _shared.DOT1_ANIMATION_INPUT_RANGE,
|
|
74
|
+
outputRange: [baseY, baseY - jumpHeight * _shared.OVERSHOOT_FACTOR, baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR, baseY],
|
|
75
|
+
extrapolate: 'clamp'
|
|
76
|
+
});
|
|
77
|
+
const {
|
|
78
|
+
inputRange: dot1FillInputRange,
|
|
79
|
+
outputRange: dot1FillOutputRange
|
|
80
|
+
} = makeStepInterpolation([{
|
|
81
|
+
time: 0,
|
|
82
|
+
value: color
|
|
83
|
+
}, {
|
|
84
|
+
time: 0.3,
|
|
85
|
+
value: color
|
|
86
|
+
}, {
|
|
87
|
+
time: 0.4,
|
|
88
|
+
value: indicatorBackgroundColor
|
|
89
|
+
}, {
|
|
90
|
+
time: 1,
|
|
91
|
+
value: indicatorBackgroundColor
|
|
92
|
+
}]);
|
|
93
|
+
const dot1Fill = animationValue.interpolate({
|
|
94
|
+
inputRange: dot1FillInputRange,
|
|
95
|
+
outputRange: dot1FillOutputRange,
|
|
96
|
+
extrapolate: 'clamp'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Fade-out Dot 1
|
|
100
|
+
const dot1Opacity = animationValue.interpolate({
|
|
101
|
+
inputRange: _shared.DOT_FADEOUT_INPUT_RANGE,
|
|
102
|
+
outputRange: _shared.DOT_FADEOUT_OUTPUT_RANGE,
|
|
103
|
+
extrapolate: 'clamp'
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// ---- DOT 2 ----
|
|
107
|
+
const dot2Cy = animationValue.interpolate({
|
|
108
|
+
inputRange: _shared.DOT2_ANIMATION_INPUT_RANGE,
|
|
109
|
+
outputRange: [baseY, baseY, baseY - jumpHeight * _shared.OVERSHOOT_FACTOR, baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR, baseY],
|
|
110
|
+
extrapolate: 'clamp'
|
|
111
|
+
});
|
|
112
|
+
const {
|
|
113
|
+
inputRange: dot2FillInputRange,
|
|
114
|
+
outputRange: dot2FillOutputRange
|
|
115
|
+
} = makeStepInterpolation([{
|
|
116
|
+
time: 0,
|
|
117
|
+
value: indicatorBackgroundColor
|
|
118
|
+
}, {
|
|
119
|
+
time: 0.3,
|
|
120
|
+
value: indicatorBackgroundColor
|
|
121
|
+
}, {
|
|
122
|
+
time: 0.4,
|
|
123
|
+
value: color
|
|
124
|
+
}, {
|
|
125
|
+
time: 0.6,
|
|
126
|
+
value: color
|
|
127
|
+
}, {
|
|
128
|
+
time: 0.7,
|
|
129
|
+
value: indicatorBackgroundColor
|
|
130
|
+
}, {
|
|
131
|
+
time: 1,
|
|
132
|
+
value: indicatorBackgroundColor
|
|
133
|
+
}]);
|
|
134
|
+
const dot2Fill = animationValue.interpolate({
|
|
135
|
+
inputRange: dot2FillInputRange,
|
|
136
|
+
outputRange: dot2FillOutputRange,
|
|
137
|
+
extrapolate: 'clamp'
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Fade-out Dot 2
|
|
141
|
+
const dot2Opacity = animationValue.interpolate({
|
|
142
|
+
inputRange: _shared.DOT_FADEOUT_INPUT_RANGE,
|
|
143
|
+
outputRange: _shared.DOT_FADEOUT_OUTPUT_RANGE,
|
|
144
|
+
extrapolate: 'clamp'
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ---- DOT 3 ----
|
|
148
|
+
const dot3Cy = animationValue.interpolate({
|
|
149
|
+
inputRange: _shared.DOT3_ANIMATION_INPUT_RANGE,
|
|
150
|
+
outputRange: [baseY, baseY, baseY - jumpHeight * _shared.OVERSHOOT_FACTOR, baseY + jumpHeight * _shared.UNDERSHOOT_FACTOR, baseY],
|
|
151
|
+
extrapolate: 'clamp'
|
|
152
|
+
});
|
|
153
|
+
const {
|
|
154
|
+
inputRange: dot3FillInputRange,
|
|
155
|
+
outputRange: dot3FillOutputRange
|
|
156
|
+
} = makeStepInterpolation([{
|
|
157
|
+
time: 0,
|
|
158
|
+
value: indicatorBackgroundColor
|
|
159
|
+
}, {
|
|
160
|
+
time: 0.5,
|
|
161
|
+
value: indicatorBackgroundColor
|
|
162
|
+
}, {
|
|
163
|
+
time: 0.6,
|
|
164
|
+
value: color
|
|
165
|
+
}, {
|
|
166
|
+
time: 0.8,
|
|
167
|
+
value: color
|
|
168
|
+
}, {
|
|
169
|
+
time: 1,
|
|
170
|
+
value: color
|
|
171
|
+
}]);
|
|
172
|
+
const dot3Fill = animationValue.interpolate({
|
|
173
|
+
inputRange: dot3FillInputRange,
|
|
174
|
+
outputRange: dot3FillOutputRange,
|
|
175
|
+
extrapolate: 'clamp'
|
|
176
|
+
});
|
|
177
|
+
const dot3Opacity = new _Animated.default.Value(1);
|
|
178
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
179
|
+
ref: ref,
|
|
180
|
+
style: styles.container,
|
|
181
|
+
accessible: true,
|
|
182
|
+
accessibilityLabel: label,
|
|
183
|
+
accessibilityRole: "progressbar",
|
|
184
|
+
accessibilityState: {
|
|
185
|
+
busy: true
|
|
186
|
+
},
|
|
187
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSvg.default, {
|
|
188
|
+
width: width,
|
|
189
|
+
height: height,
|
|
190
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
191
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedCircle, {
|
|
192
|
+
cx: size,
|
|
193
|
+
cy: reduceMotion ? baseY : dot1Cy,
|
|
194
|
+
r: padding,
|
|
195
|
+
fill: reduceMotion ? color : dot1Fill,
|
|
196
|
+
opacity: reduceMotion ? 1 : dot1Opacity
|
|
197
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedCircle, {
|
|
198
|
+
cx: 2 * size + spacingX,
|
|
199
|
+
cy: reduceMotion ? baseY : dot2Cy,
|
|
200
|
+
r: padding,
|
|
201
|
+
fill: reduceMotion ? indicatorBackgroundColor : dot2Fill,
|
|
202
|
+
opacity: reduceMotion ? 1 : dot2Opacity
|
|
203
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedCircle, {
|
|
204
|
+
cx: 3 * size + 2 * spacingX,
|
|
205
|
+
cy: reduceMotion ? baseY : dot3Cy,
|
|
206
|
+
r: padding,
|
|
207
|
+
fill: reduceMotion ? indicatorBackgroundColor : dot3Fill,
|
|
208
|
+
opacity: reduceMotion ? 1 : dot3Opacity
|
|
209
|
+
})]
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
Dots.displayName = 'Dots';
|
|
214
|
+
Dots.propTypes = _shared.propTypes;
|
|
215
|
+
const styles = _StyleSheet.default.create({
|
|
216
|
+
container: {
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
justifyContent: 'center'
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
var _default = exports.default = Dots;
|
|
@@ -9,27 +9,15 @@ var _shared = require("./shared");
|
|
|
9
9
|
var _A11yInfoProvider = require("../A11yInfoProvider");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const MIN_SVG_LENGTH = _shared.MIN_STROKE_ANGLE / 360 * SVG_CIRCUMFERENCE;
|
|
15
|
-
const MAX_SVG_LENGTH = (1 - _shared.MIN_EMPTY_ANGLE / 360) * SVG_CIRCUMFERENCE;
|
|
16
|
-
const animationProps = {
|
|
17
|
-
begin: '0s',
|
|
18
|
-
dur: `${_shared.DURATION}ms`,
|
|
19
|
-
fill: 'freeze',
|
|
12
|
+
const animateProps = {
|
|
13
|
+
keyTimes: _shared.SPINNER_KEYTIMES,
|
|
20
14
|
repeatCount: 'indefinite'
|
|
21
15
|
};
|
|
22
|
-
const bezierProps = {
|
|
23
|
-
calcMode: 'spline',
|
|
24
|
-
keyTimes: '0; 0.5; 1',
|
|
25
|
-
keySplines: `${_shared.BEZIER.join(', ')} ; ${_shared.BEZIER.join(', ')}`
|
|
26
|
-
};
|
|
27
|
-
// We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
28
|
-
// 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.
|
|
29
16
|
const Spinner = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
30
17
|
let {
|
|
31
18
|
size,
|
|
32
19
|
color,
|
|
20
|
+
indicatorBackgroundColor,
|
|
33
21
|
thickness,
|
|
34
22
|
label,
|
|
35
23
|
isStatic = false
|
|
@@ -38,46 +26,65 @@ const Spinner = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
38
26
|
reduceMotionEnabled
|
|
39
27
|
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
40
28
|
const reduceMotion = reduceMotionEnabled || isStatic;
|
|
41
|
-
|
|
29
|
+
const strokeWidth = thickness * _shared.SVG_SIZE / size;
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
|
|
42
31
|
ref: ref,
|
|
43
32
|
width: `${size}px`,
|
|
44
33
|
height: `${size}px`,
|
|
45
|
-
viewBox:
|
|
34
|
+
viewBox: `0 0 ${_shared.SVG_SIZE} ${_shared.SVG_SIZE}`,
|
|
46
35
|
"aria-valuetext": label,
|
|
47
36
|
role: "progressbar",
|
|
48
|
-
"aria-busy": true,
|
|
49
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
37
|
+
"aria-busy": "true",
|
|
38
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
39
|
+
fill: "none",
|
|
40
|
+
stroke: indicatorBackgroundColor,
|
|
41
|
+
strokeWidth: strokeWidth,
|
|
42
|
+
cx: _shared.SVG_CENTER,
|
|
43
|
+
cy: _shared.SVG_CENTER,
|
|
44
|
+
r: _shared.SPINNER_RADIUS
|
|
45
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: color,
|
|
48
|
+
strokeWidth: strokeWidth,
|
|
49
|
+
strokeLinecap: "round",
|
|
50
|
+
cx: _shared.SVG_CENTER,
|
|
51
|
+
cy: _shared.SVG_CENTER,
|
|
52
|
+
r: _shared.SPINNER_RADIUS,
|
|
53
|
+
strokeDasharray: `${_shared.SPINNER_DASHARRAY_MIN * _shared.SVG_CIRCUMFERENCE}, ${_shared.SPINNER_DASHARRAY_MAX * _shared.SVG_CIRCUMFERENCE}`,
|
|
54
|
+
strokeDashoffset: "0"
|
|
55
|
+
// Circle rotated -90° so that 0% is at the top (12 o'clock).
|
|
56
|
+
,
|
|
57
|
+
transform: _shared.ROTATION_TRANSFORM,
|
|
58
|
+
children: reduceMotion ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animateTransform", {
|
|
60
|
+
attributeName: "transform",
|
|
61
|
+
type: "rotate",
|
|
62
|
+
from: "0 24 24",
|
|
63
|
+
to: `${_shared.SPINNER_ROTATION_DEGREES} ${_shared.SVG_CENTER} ${_shared.SVG_CENTER}`,
|
|
64
|
+
dur: `${_shared.DURATION}ms`,
|
|
65
|
+
repeatCount: "indefinite",
|
|
66
|
+
additive: "sum"
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
68
|
+
attributeName: "stroke-dasharray",
|
|
69
|
+
dur: `${_shared.DURATION}ms`,
|
|
70
|
+
values: `
|
|
71
|
+
${_shared.SPINNER_DASHARRAY_MIN * _shared.SVG_CIRCUMFERENCE},${_shared.SPINNER_DASHARRAY_MAX * _shared.SVG_CIRCUMFERENCE};
|
|
72
|
+
${_shared.SPINNER_DASHARRAY_HALF * _shared.SVG_CIRCUMFERENCE},${_shared.SPINNER_DASHARRAY_HALF * _shared.SVG_CIRCUMFERENCE};
|
|
73
|
+
${_shared.SPINNER_DASHARRAY_MIN * _shared.SVG_CIRCUMFERENCE},${_shared.SPINNER_DASHARRAY_MAX * _shared.SVG_CIRCUMFERENCE}
|
|
74
|
+
`,
|
|
75
|
+
...animateProps
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
77
|
+
attributeName: "stroke-dashoffset",
|
|
78
|
+
dur: `${_shared.DURATION}ms`,
|
|
79
|
+
values: `
|
|
80
|
+
0;
|
|
81
|
+
0;
|
|
82
|
+
-${_shared.SPINNER_DASHOFFSET_FACTOR * _shared.SVG_CIRCUMFERENCE}
|
|
83
|
+
`,
|
|
84
|
+
...animateProps
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
})]
|
|
81
88
|
});
|
|
82
89
|
});
|
|
83
90
|
Spinner.displayName = 'Spinner';
|