@primer/react 38.5.0 → 38.6.0-rc.83fd63ead
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 +8 -0
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts +9 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +3 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +135 -38
- package/generated/components.json +6 -0
- package/package.json +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 38.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7157](https://github.com/primer/react/pull/7157) [`eddd934`](https://github.com/primer/react/commit/eddd9340cab24ebf8054c79ca855028ed511c495) Thanks [@joshblack](https://github.com/joshblack)! - Add feature flag to control whether Spinner animations are synchronized
|
|
8
|
+
|
|
9
|
+
- [#7277](https://github.com/primer/react/pull/7277) [`4a1c9a5`](https://github.com/primer/react/commit/4a1c9a5e48cdce7059358cd37a6d7f3f23e20c43) Thanks [@kendallgassner](https://github.com/kendallgassner)! - Added callback prop onActiveDescendantChanged to FilteredActionList
|
|
10
|
+
|
|
3
11
|
## 38.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAQ9B,CAAA"}
|
|
@@ -6,7 +6,8 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
|
6
6
|
primer_react_overlay_overflow: false,
|
|
7
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
8
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
9
|
-
primer_react_select_panel_remove_active_descendant: false
|
|
9
|
+
primer_react_select_panel_remove_active_descendant: false,
|
|
10
|
+
primer_react_spinner_synchronize_animations: false
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
export { DefaultFeatureFlags };
|
|
@@ -40,6 +40,14 @@ export interface FilteredActionListProps extends Partial<Omit<GroupedListProps,
|
|
|
40
40
|
* @default 'wrap'
|
|
41
41
|
*/
|
|
42
42
|
focusOutBehavior?: 'stop' | 'wrap';
|
|
43
|
+
/**
|
|
44
|
+
* Callback function that is called when the active descendant changes.
|
|
45
|
+
*
|
|
46
|
+
* @param newActiveDescendant - The new active descendant element.
|
|
47
|
+
* @param previousActiveDescendant - The previous active descendant element.
|
|
48
|
+
* @param directlyActivated - Whether the active descendant was directly activated (e.g., by a keyboard event).
|
|
49
|
+
*/
|
|
50
|
+
onActiveDescendantChanged?: (newActiveDescendant: HTMLElement | undefined, previousActiveDescendant: HTMLElement | undefined, directlyActivated: boolean) => void;
|
|
43
51
|
/**
|
|
44
52
|
* Private API for use internally only. Adds the ability to switch between
|
|
45
53
|
* `active-descendant` and roving tabindex.
|
|
@@ -70,7 +78,7 @@ export interface FilteredActionListProps extends Partial<Omit<GroupedListProps,
|
|
|
70
78
|
*/
|
|
71
79
|
setInitialFocus?: boolean;
|
|
72
80
|
}
|
|
73
|
-
export declare function FilteredActionList({ loading, placeholderText, filterValue: externalFilterValue, loadingType, onFilterChange, onListContainerRefChanged, onInputRefChanged, items, textInputProps, inputRef: providedInputRef, scrollContainerRef: providedScrollContainerRef, groupMetadata, showItemDividers, message, messageText, className, selectionVariant, announcementsEnabled, fullScreenOnNarrow, onSelectAllChange, actionListProps, focusOutBehavior, _PrivateFocusManagement, disableSelectOnHover, setInitialFocus, ...listProps }: FilteredActionListProps): JSX.Element;
|
|
81
|
+
export declare function FilteredActionList({ loading, placeholderText, filterValue: externalFilterValue, loadingType, onFilterChange, onListContainerRefChanged, onInputRefChanged, items, textInputProps, inputRef: providedInputRef, scrollContainerRef: providedScrollContainerRef, groupMetadata, showItemDividers, message, messageText, className, selectionVariant, announcementsEnabled, fullScreenOnNarrow, onSelectAllChange, actionListProps, focusOutBehavior, _PrivateFocusManagement, onActiveDescendantChanged, disableSelectOnHover, setInitialFocus, ...listProps }: FilteredActionListProps): JSX.Element;
|
|
74
82
|
export declare namespace FilteredActionList {
|
|
75
83
|
var displayName: string;
|
|
76
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;AAOhF,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,6BAA6B,CAAA;AAW9E,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,aAAa;IAClH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAA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;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAe,EACf,eAAe,EACf,WAAW,EAAE,mBAAmB,EAChC,WAAwD,EACxD,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,EAAE,0BAA0B,EAC9C,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,oBAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAyB,EACzB,uBAA6C,EAC7C,oBAA4B,EAC5B,eAAuB,EACvB,GAAG,SAAS,EACb,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;AAOhF,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,6BAA6B,CAAA;AAW9E,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,aAAa;IAClH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,6BAA6B,CAAA;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,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,CAAA;IACT;;;;;;;;;;;;;;;;;;OAkBG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,CAAA;IACjE;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAe,EACf,eAAe,EACf,WAAW,EAAE,mBAAmB,EAChC,WAAwD,EACxD,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,EAAE,0BAA0B,EAC9C,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,oBAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAyB,EACzB,uBAA6C,EAC7C,yBAAyB,EACzB,oBAA4B,EAC5B,eAAuB,EACvB,GAAG,SAAS,EACb,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAiUvC;yBA7Ve,kBAAkB"}
|
|
@@ -46,6 +46,7 @@ function FilteredActionList({
|
|
|
46
46
|
actionListProps,
|
|
47
47
|
focusOutBehavior = 'wrap',
|
|
48
48
|
_PrivateFocusManagement = 'active-descendant',
|
|
49
|
+
onActiveDescendantChanged,
|
|
49
50
|
disableSelectOnHover = false,
|
|
50
51
|
setInitialFocus = false,
|
|
51
52
|
...listProps
|
|
@@ -142,10 +143,11 @@ function FilteredActionList({
|
|
|
142
143
|
if (current && scrollContainerRef.current && directlyActivated) {
|
|
143
144
|
scrollIntoView(current, scrollContainerRef.current, menuScrollMargins);
|
|
144
145
|
}
|
|
146
|
+
onActiveDescendantChanged === null || onActiveDescendantChanged === void 0 ? void 0 : onActiveDescendantChanged(current, previous, directlyActivated);
|
|
145
147
|
},
|
|
146
148
|
focusInStrategy: setInitialFocus ? 'initial' : 'previous',
|
|
147
149
|
ignoreHoverEvents: disableSelectOnHover
|
|
148
|
-
} : undefined, [listContainerElement, usingRovingTabindex]);
|
|
150
|
+
} : undefined, [listContainerElement, usingRovingTabindex, onActiveDescendantChanged]);
|
|
149
151
|
useEffect(() => {
|
|
150
152
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
|
151
153
|
scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAMlE,QAAA,MAAM,OAAO;;;;CAIZ,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,OAAO,OAAO,CAAA;IAC3B,0KAA0K;IAC1K,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,kBAAkB,CAAA;AAEtB,iBAAS,OAAO,CAAC,EACf,IAAI,EAAE,OAAkB,EACxB,MAAkB,EAClB,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,KAAK,EACL,KAAa,EACb,GAAG,KAAK,EACT,EAAE,YAAY,4BA2Dd;kBAnEQ,OAAO;;;AAkMhB,eAAe,OAAO,CAAA"}
|
package/dist/Spinner/Spinner.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import classes from './Spinner.module.css.js';
|
|
4
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { useState, useEffect, useRef, useSyncExternalStore } from 'react';
|
|
4
|
+
import classes from './Spinner.module.css.js';
|
|
5
|
+
import { useMedia } from '../hooks/useMedia.js';
|
|
5
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
6
8
|
import { useId } from '../hooks/useId.js';
|
|
7
9
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
8
10
|
|
|
@@ -13,7 +15,7 @@ const sizeMap = {
|
|
|
13
15
|
};
|
|
14
16
|
function Spinner(t0) {
|
|
15
17
|
var _ariaLabel;
|
|
16
|
-
const $ = c(
|
|
18
|
+
const $ = c(30);
|
|
17
19
|
let ariaLabel;
|
|
18
20
|
let className;
|
|
19
21
|
let props;
|
|
@@ -51,6 +53,8 @@ function Spinner(t0) {
|
|
|
51
53
|
const sizeKey = t1 === undefined ? "medium" : t1;
|
|
52
54
|
const srText = t2 === undefined ? "Loading" : t2;
|
|
53
55
|
const delay = t3 === undefined ? false : t3;
|
|
56
|
+
const syncAnimationsEnabled = useFeatureFlag("primer_react_spinner_synchronize_animations");
|
|
57
|
+
const animationRef = useSpinnerAnimation();
|
|
54
58
|
const size = sizeMap[sizeKey];
|
|
55
59
|
const hasHiddenLabel = srText !== null && ariaLabel === undefined;
|
|
56
60
|
const labelId = useId();
|
|
@@ -78,20 +82,21 @@ function Spinner(t0) {
|
|
|
78
82
|
if (!isVisible) {
|
|
79
83
|
return null;
|
|
80
84
|
}
|
|
81
|
-
const t6 =
|
|
82
|
-
const t7 =
|
|
83
|
-
|
|
85
|
+
const t6 = syncAnimationsEnabled ? animationRef : undefined;
|
|
86
|
+
const t7 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : undefined;
|
|
87
|
+
const t8 = hasHiddenLabel ? labelId : undefined;
|
|
88
|
+
let t9;
|
|
84
89
|
if ($[11] !== className) {
|
|
85
|
-
|
|
90
|
+
t9 = clsx(className, classes.SpinnerAnimation);
|
|
86
91
|
$[11] = className;
|
|
87
|
-
$[12] =
|
|
92
|
+
$[12] = t9;
|
|
88
93
|
} else {
|
|
89
|
-
|
|
94
|
+
t9 = $[12];
|
|
90
95
|
}
|
|
91
96
|
let t10;
|
|
92
|
-
let
|
|
97
|
+
let t11;
|
|
93
98
|
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
94
|
-
|
|
99
|
+
t10 = /*#__PURE__*/jsx("circle", {
|
|
95
100
|
cx: "8",
|
|
96
101
|
cy: "8",
|
|
97
102
|
r: "7",
|
|
@@ -100,7 +105,7 @@ function Spinner(t0) {
|
|
|
100
105
|
strokeWidth: "2",
|
|
101
106
|
vectorEffect: "non-scaling-stroke"
|
|
102
107
|
});
|
|
103
|
-
|
|
108
|
+
t11 = /*#__PURE__*/jsx("path", {
|
|
104
109
|
d: "M15 8a7.002 7.002 0 00-7-7",
|
|
105
110
|
stroke: "currentColor",
|
|
106
111
|
strokeWidth: "2",
|
|
@@ -108,25 +113,26 @@ function Spinner(t0) {
|
|
|
108
113
|
vectorEffect: "non-scaling-stroke"
|
|
109
114
|
});
|
|
110
115
|
$[13] = t10;
|
|
111
|
-
$[14] =
|
|
116
|
+
$[14] = t11;
|
|
112
117
|
} else {
|
|
113
118
|
t10 = $[13];
|
|
114
|
-
|
|
119
|
+
t11 = $[14];
|
|
115
120
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[15] !== props || $[16] !== size || $[17] !== style || $[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
|
|
118
|
-
|
|
121
|
+
let t12;
|
|
122
|
+
if ($[15] !== props || $[16] !== size || $[17] !== style || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 || $[21] !== t9) {
|
|
123
|
+
t12 = /*#__PURE__*/jsxs("svg", {
|
|
124
|
+
ref: t6,
|
|
119
125
|
height: size,
|
|
120
126
|
width: size,
|
|
121
127
|
viewBox: "0 0 16 16",
|
|
122
128
|
fill: "none",
|
|
123
129
|
"aria-hidden": true,
|
|
124
|
-
"aria-label":
|
|
125
|
-
"aria-labelledby":
|
|
126
|
-
className:
|
|
130
|
+
"aria-label": t7,
|
|
131
|
+
"aria-labelledby": t8,
|
|
132
|
+
className: t9,
|
|
127
133
|
style: style,
|
|
128
134
|
...props,
|
|
129
|
-
children: [
|
|
135
|
+
children: [t10, t11]
|
|
130
136
|
});
|
|
131
137
|
$[15] = props;
|
|
132
138
|
$[16] = size;
|
|
@@ -134,37 +140,128 @@ function Spinner(t0) {
|
|
|
134
140
|
$[18] = t6;
|
|
135
141
|
$[19] = t7;
|
|
136
142
|
$[20] = t8;
|
|
137
|
-
$[21] =
|
|
143
|
+
$[21] = t9;
|
|
144
|
+
$[22] = t12;
|
|
138
145
|
} else {
|
|
139
|
-
|
|
146
|
+
t12 = $[22];
|
|
140
147
|
}
|
|
141
|
-
let
|
|
142
|
-
if ($[
|
|
143
|
-
|
|
148
|
+
let t13;
|
|
149
|
+
if ($[23] !== hasHiddenLabel || $[24] !== labelId || $[25] !== srText) {
|
|
150
|
+
t13 = hasHiddenLabel ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
144
151
|
id: labelId,
|
|
145
152
|
children: srText
|
|
146
153
|
}) : null;
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
154
|
+
$[23] = hasHiddenLabel;
|
|
155
|
+
$[24] = labelId;
|
|
156
|
+
$[25] = srText;
|
|
157
|
+
$[26] = t13;
|
|
151
158
|
} else {
|
|
152
|
-
|
|
159
|
+
t13 = $[26];
|
|
153
160
|
}
|
|
154
|
-
let
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
161
|
+
let t14;
|
|
162
|
+
if ($[27] !== t12 || $[28] !== t13) {
|
|
163
|
+
t14 = /*#__PURE__*/jsxs("span", {
|
|
157
164
|
className: classes.Box,
|
|
158
|
-
children: [
|
|
165
|
+
children: [t12, t13]
|
|
159
166
|
});
|
|
160
|
-
$[26] = t11;
|
|
161
167
|
$[27] = t12;
|
|
162
168
|
$[28] = t13;
|
|
169
|
+
$[29] = t14;
|
|
163
170
|
} else {
|
|
164
|
-
|
|
171
|
+
t14 = $[29];
|
|
165
172
|
}
|
|
166
|
-
return
|
|
173
|
+
return t14;
|
|
167
174
|
}
|
|
168
175
|
Spinner.displayName = 'Spinner';
|
|
176
|
+
const animationTimingStore = {
|
|
177
|
+
subscribers: new Set(),
|
|
178
|
+
value: {
|
|
179
|
+
startTime: null
|
|
180
|
+
},
|
|
181
|
+
update(startTime) {
|
|
182
|
+
const value = {
|
|
183
|
+
startTime
|
|
184
|
+
};
|
|
185
|
+
animationTimingStore.value = value;
|
|
186
|
+
for (const subscriber of animationTimingStore.subscribers) {
|
|
187
|
+
subscriber();
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
subscribe(subscriber) {
|
|
191
|
+
animationTimingStore.subscribers.add(subscriber);
|
|
192
|
+
return () => {
|
|
193
|
+
animationTimingStore.subscribers.delete(subscriber);
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
getSnapshot() {
|
|
197
|
+
return animationTimingStore.value;
|
|
198
|
+
},
|
|
199
|
+
getServerSnapshot() {
|
|
200
|
+
return animationTimingStore.value;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* A utility hook for reading a common `startTime` value so that all animations
|
|
206
|
+
* are in sync. This is a global value and is coordinated through `useSyncExternalStore`.
|
|
207
|
+
*/
|
|
208
|
+
function useAnimationTiming() {
|
|
209
|
+
return useSyncExternalStore(animationTimingStore.subscribe, animationTimingStore.getSnapshot, animationTimingStore.getServerSnapshot);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Uses a technique from Spectrum to coordinate animations:
|
|
214
|
+
* @see https://github.com/adobe/react-spectrum/blob/ab5e6f3dba4235dafab9f81f8b5c506ce5f11230/packages/%40react-spectrum/s2/src/Skeleton.tsx#L21
|
|
215
|
+
*/
|
|
216
|
+
function useSpinnerAnimation() {
|
|
217
|
+
const $ = c(3);
|
|
218
|
+
const ref = useRef(null);
|
|
219
|
+
const noMotionPreference = useMedia("(prefers-reduced-motion: no-preference)", false);
|
|
220
|
+
const animationTiming = useAnimationTiming();
|
|
221
|
+
let t0;
|
|
222
|
+
if ($[0] !== animationTiming || $[1] !== noMotionPreference) {
|
|
223
|
+
t0 = element => {
|
|
224
|
+
if (!element) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (ref.current !== null) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (noMotionPreference) {
|
|
231
|
+
const cssAnimation = element.getAnimations().find(_temp);
|
|
232
|
+
cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.pause();
|
|
233
|
+
ref.current = element.animate([{
|
|
234
|
+
transform: "rotate(0deg)"
|
|
235
|
+
}, {
|
|
236
|
+
transform: "rotate(360deg)"
|
|
237
|
+
}], {
|
|
238
|
+
duration: 1000,
|
|
239
|
+
easing: "cubic-bezier(0,0,1,1)",
|
|
240
|
+
iterations: Infinity
|
|
241
|
+
});
|
|
242
|
+
if (animationTiming.startTime === null) {
|
|
243
|
+
var _cssAnimation$startTi;
|
|
244
|
+
const startTime = (_cssAnimation$startTi = cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.startTime) !== null && _cssAnimation$startTi !== void 0 ? _cssAnimation$startTi : 0;
|
|
245
|
+
animationTimingStore.update(startTime);
|
|
246
|
+
ref.current.startTime = startTime;
|
|
247
|
+
} else {
|
|
248
|
+
ref.current.startTime = animationTiming.startTime;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
$[0] = animationTiming;
|
|
253
|
+
$[1] = noMotionPreference;
|
|
254
|
+
$[2] = t0;
|
|
255
|
+
} else {
|
|
256
|
+
t0 = $[2];
|
|
257
|
+
}
|
|
258
|
+
return t0;
|
|
259
|
+
}
|
|
260
|
+
function _temp(animation) {
|
|
261
|
+
if (animation instanceof CSSAnimation) {
|
|
262
|
+
return animation.animationName.startsWith("Spinner") && animation.animationName.endsWith("rotate-keyframes");
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
169
266
|
|
|
170
267
|
export { Spinner as default };
|
|
@@ -6269,6 +6269,12 @@
|
|
|
6269
6269
|
"type": "'start' | 'wrap'",
|
|
6270
6270
|
"defaultValue": "'wrap'",
|
|
6271
6271
|
"description": "Determines how keyboard focus behaves when navigating beyond the first or last item in the list."
|
|
6272
|
+
},
|
|
6273
|
+
{
|
|
6274
|
+
"name": "onActiveDescendantChanged",
|
|
6275
|
+
"type": "(newActiveDescendant: HTMLElement | undefined, previousActiveDescendant: HTMLElement | undefined, directlyActivated: boolean) => void | undefined",
|
|
6276
|
+
"defaultValue": "undefined",
|
|
6277
|
+
"description": "Callback function that is called when the active descendant changes."
|
|
6272
6278
|
}
|
|
6273
6279
|
],
|
|
6274
6280
|
"subcomponents": []
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.
|
|
4
|
+
"version": "38.6.0-rc.83fd63ead",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -112,8 +112,6 @@
|
|
|
112
112
|
"@rollup/plugin-commonjs": "29.0.0",
|
|
113
113
|
"@rollup/plugin-json": "6.1.0",
|
|
114
114
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
115
|
-
"@rollup/plugin-replace": "6.0.3",
|
|
116
|
-
"@rollup/plugin-terser": "0.4.4",
|
|
117
115
|
"@rollup/plugin-typescript": "12.3.0",
|
|
118
116
|
"@rollup/plugin-virtual": "3.0.2",
|
|
119
117
|
"@storybook/addon-a11y": "^10.1.4",
|
|
@@ -174,8 +172,6 @@
|
|
|
174
172
|
"rimraf": "5.0.5",
|
|
175
173
|
"rollup": "4.53.3",
|
|
176
174
|
"rollup-plugin-import-css": "^0.0.0",
|
|
177
|
-
"rollup-plugin-postcss": "4.0.2",
|
|
178
|
-
"rollup-plugin-visualizer": "6.0.5",
|
|
179
175
|
"storybook": "^10.1.4",
|
|
180
176
|
"terser": "5.36.0",
|
|
181
177
|
"ts-toolbelt": "9.6.0",
|