@primer/react 0.0.0-20260303162234 → 0.0.0-20260303163914
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 +4 -2
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +9 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-93b9aedd.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-93b9aedd.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +34 -9
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +37 -70
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/Overlay/Overlay-99fc96c9.css +2 -0
- package/dist/Overlay/{Overlay-15519c09.css.map → Overlay-99fc96c9.css.map} +1 -1
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +26 -17
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +106 -152
- package/package.json +2 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css.map +0 -1
- package/dist/Overlay/Overlay-15519c09.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260303163914
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- [#7604](https://github.com/primer/react/pull/7604) [`d79584d`](https://github.com/primer/react/commit/d79584d0656ea92bd476820ecc1e4a3fcf25f9c1) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add CSS Anchor Positioning to `AnchoredOverlay` (under a feature flag)
|
|
8
|
+
|
|
7
9
|
- [#7524](https://github.com/primer/react/pull/7524) [`f7bdd1c`](https://github.com/primer/react/commit/f7bdd1c04f8cbb17b6a913ba55f7d0855c8eebf1) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: always render ActionMenu in viewport when inside Dialog under feature flag
|
|
8
10
|
|
|
9
11
|
### Patch Changes
|
|
10
12
|
|
|
11
13
|
- Fake entry to force publishing
|
|
12
14
|
|
|
13
|
-
- [#
|
|
15
|
+
- [#7550](https://github.com/primer/react/pull/7550) [`9585669`](https://github.com/primer/react/commit/958566907a580b54b484ff2339b32315b8a3b4b7) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Spinner): replace Web Animations API with CSS animation-delay sync
|
|
14
16
|
|
|
15
17
|
- [#7588](https://github.com/primer/react/pull/7588) [`e649da3`](https://github.com/primer/react/commit/e649da3c89b38f477fb574acf5bb06a49b41ee9d) Thanks [@lukasoppermann](https://github.com/lukasoppermann)! - ToggleSwitch: Updated with a 1px space around the knob to work better with updated primitives.
|
|
16
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAGlF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,W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AAC,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;CACpE,CAAA;AAgHH,eAAO,MAAM,UAAU;;;kBA7LP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CA4L4E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
2
3
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
3
4
|
import { Divider } from '../ActionList/Divider.js';
|
|
4
5
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -43,6 +44,9 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
|
|
|
43
44
|
};
|
|
44
45
|
mergedAnchorProps.onKeyDown = mergedOnAnchorKeyDown;
|
|
45
46
|
}
|
|
47
|
+
if (buttonProps.className) {
|
|
48
|
+
mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
|
|
49
|
+
}
|
|
46
50
|
return mergedAnchorProps;
|
|
47
51
|
};
|
|
48
52
|
const Menu = ({
|
|
@@ -120,7 +124,10 @@ const Menu = ({
|
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
} else {
|
|
123
|
-
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child,
|
|
127
|
+
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child, {
|
|
128
|
+
...anchorProps,
|
|
129
|
+
className: clsx(anchorProps.className, child.props.className)
|
|
130
|
+
});
|
|
124
131
|
}
|
|
125
132
|
return null;
|
|
126
133
|
} else if (child.type === MenuButton || isSlot(child, MenuButton)) {
|
|
@@ -181,6 +188,7 @@ const Anchor = /*#__PURE__*/React.forwardRef(({
|
|
|
181
188
|
children: /*#__PURE__*/React.cloneElement(child, {
|
|
182
189
|
...anchorProps,
|
|
183
190
|
ref: anchorRef,
|
|
191
|
+
className: clsx(anchorProps.className, child.props.className),
|
|
184
192
|
onClick: onButtonClick,
|
|
185
193
|
onKeyDown: onButtonKeyDown
|
|
186
194
|
})
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-Wrapper-w6jU3{anchor-scope:--anchored-overlay-anchor}.prc-AnchoredOverlay-Anchor-DWRfK{anchor-name:--anchored-overlay-anchor}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-anchor:--anchored-overlay-anchor;position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
|
|
2
|
+
/*# sourceMappingURL=AnchoredOverlay-93b9aedd.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,mCACE,sCACF,CAEA,kCAEE,qCACF,CAEA,2CAEE,yCAA0C,CAC1C,oEAGwB,CACxB,mCAAoC,CAEpC,cAAe,CADf,WAyBF,CArBE,qEAEE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CADnB,uCAEF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-93b9aedd.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.Wrapper {\n anchor-scope: --anchored-overlay-anchor;\n}\n\n.Anchor {\n /* Anchor name, this is currently tied to `renderAnchor` */\n anchor-name: --anchored-overlay-anchor;\n}\n\n.AnchoredOverlay {\n /* Anchor position, this is currently tied to `<Overlay>` */\n position-anchor: --anchored-overlay-anchor;\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed;\n\n /* stylelint-disable primer/spacing, declaration-property-value-no-unknown -- anchor() is a valid CSS Anchor Positioning value */\n &[data-side='outside-bottom'] {\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;AAO1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,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AAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAe9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA6KnF,CAAA"}
|
|
@@ -4,14 +4,21 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
|
4
4
|
import { useId } from '../hooks/useId.js';
|
|
5
5
|
import { IconButton } from '../Button/IconButton.js';
|
|
6
6
|
import { XIcon } from '@primer/octicons-react';
|
|
7
|
+
import polyfill from '@oddbird/css-anchor-positioning/fn';
|
|
7
8
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
9
|
import { clsx } from 'clsx';
|
|
9
10
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
10
12
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
11
13
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
14
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
13
15
|
import Overlay from '../Overlay/Overlay.js';
|
|
14
16
|
|
|
17
|
+
const applyAnchorPositioningPolyfill = () => {
|
|
18
|
+
if (typeof window !== 'undefined' && !('anchorName' in document.documentElement.style)) {
|
|
19
|
+
polyfill();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
15
22
|
const defaultVariant = {
|
|
16
23
|
regular: 'anchored',
|
|
17
24
|
narrow: 'anchored'
|
|
@@ -48,6 +55,7 @@ const AnchoredOverlay = ({
|
|
|
48
55
|
displayCloseButton = true,
|
|
49
56
|
closeButtonProps = defaultCloseButtonProps
|
|
50
57
|
}) => {
|
|
58
|
+
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
51
59
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
52
60
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
53
61
|
const anchorId = useId(externalAnchorId);
|
|
@@ -96,7 +104,10 @@ const AnchoredOverlay = ({
|
|
|
96
104
|
if (!open && overlayRef.current) {
|
|
97
105
|
updateOverlayRef(null);
|
|
98
106
|
}
|
|
99
|
-
|
|
107
|
+
if (cssAnchorPositioning && open) {
|
|
108
|
+
applyAnchorPositioningPolyfill();
|
|
109
|
+
}
|
|
110
|
+
}, [open, overlayRef, updateOverlayRef, cssAnchorPositioning]);
|
|
100
111
|
useFocusZone({
|
|
101
112
|
containerRef: overlayRef,
|
|
102
113
|
disabled: !open || !position_0,
|
|
@@ -110,7 +121,11 @@ const AnchoredOverlay = ({
|
|
|
110
121
|
const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
|
|
111
122
|
const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
|
|
112
123
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
113
|
-
|
|
124
|
+
const {
|
|
125
|
+
className: overlayClassName,
|
|
126
|
+
...restOverlayProps
|
|
127
|
+
} = overlayProps || {};
|
|
128
|
+
const innerContent = /*#__PURE__*/jsxs(Fragment, {
|
|
114
129
|
children: [renderAnchor && renderAnchor({
|
|
115
130
|
ref: anchorRef,
|
|
116
131
|
id: anchorId,
|
|
@@ -118,30 +133,33 @@ const AnchoredOverlay = ({
|
|
|
118
133
|
'aria-expanded': open,
|
|
119
134
|
tabIndex: 0,
|
|
120
135
|
onClick: onAnchorClick,
|
|
121
|
-
onKeyDown: onAnchorKeyDown
|
|
136
|
+
onKeyDown: onAnchorKeyDown,
|
|
137
|
+
className: classes.Anchor
|
|
122
138
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
123
139
|
returnFocusRef: anchorRef,
|
|
124
140
|
onClickOutside: onClickOutside,
|
|
125
141
|
ignoreClickRefs: [anchorRef],
|
|
126
142
|
onEscape: onEscape,
|
|
127
143
|
role: "none",
|
|
128
|
-
visibility: position_0 ? 'visible' : 'hidden',
|
|
144
|
+
visibility: cssAnchorPositioning || position_0 ? 'visible' : 'hidden',
|
|
129
145
|
height: height,
|
|
130
146
|
width: width,
|
|
131
|
-
top: (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
132
|
-
left: (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
147
|
+
top: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
148
|
+
left: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
133
149
|
responsiveVariant: variant.narrow === 'fullscreen' ? 'fullscreen' : undefined,
|
|
134
|
-
anchorSide: position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
135
|
-
className: className,
|
|
150
|
+
anchorSide: cssAnchorPositioning ? undefined : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
151
|
+
className: clsx(className, overlayClassName, cssAnchorPositioning ? classes.AnchoredOverlay : undefined),
|
|
136
152
|
preventOverflow: preventOverflow,
|
|
137
153
|
"data-component": "AnchoredOverlay",
|
|
138
|
-
...
|
|
154
|
+
...restOverlayProps,
|
|
139
155
|
ref: node => {
|
|
140
156
|
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
141
157
|
assignRef(overlayProps.ref, node);
|
|
142
158
|
}
|
|
143
159
|
updateOverlayRef(node);
|
|
144
160
|
},
|
|
161
|
+
"data-anchor-position": cssAnchorPositioning,
|
|
162
|
+
"data-side": position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
145
163
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
146
164
|
className: classes.ResponsiveCloseButtonContainer,
|
|
147
165
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -164,6 +182,13 @@ const AnchoredOverlay = ({
|
|
|
164
182
|
}) : null, children]
|
|
165
183
|
}) : null]
|
|
166
184
|
});
|
|
185
|
+
if (cssAnchorPositioning) {
|
|
186
|
+
return /*#__PURE__*/jsx("div", {
|
|
187
|
+
className: classes.Wrapper,
|
|
188
|
+
children: innerContent
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return innerContent;
|
|
167
192
|
};
|
|
168
193
|
function assignRef(ref, value) {
|
|
169
194
|
if (typeof ref === 'function') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './AnchoredOverlay-
|
|
1
|
+
import './AnchoredOverlay-93b9aedd.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx"};
|
|
3
|
+
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Wrapper":"prc-AnchoredOverlay-Wrapper-w6jU3","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteMenu.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAK7E,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAA;AAI1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAOrD,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAA;AAClD,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,mBAAmB,EAAE,IAAI,CAAC,GAAG;IAE3E,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrG,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,cAAc,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;CACvG,CAAA;
|
|
1
|
+
{"version":3,"file":"AutocompleteMenu.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAK7E,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAA;AAI1E,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G;IAEH,eAAe,EAAE,MAAM,EAAE,CAAA;IAEzB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IAE5D;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAExC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAEtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAEtC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErE,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAUD,iBAAS,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,CAAC,qBAqRjG;kBArRQ,gBAAgB;;;;AAyRzB,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC3E,eAAe,gBAAgB,CAAA"}
|
|
@@ -33,40 +33,6 @@ function getdefaultCheckedSelectionChange(setInputValueFn) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const isItemSelected = (itemId, selectedItemIds) => selectedItemIds.includes(itemId);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Memoized wrapper around ActionList.Item that skips re-rendering when props
|
|
39
|
-
* haven't changed. Combined with the `highlightedItem` ref (instead of state),
|
|
40
|
-
* arrow-key navigation no longer triggers re-renders of the item list.
|
|
41
|
-
*/
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
const MemoizedAutocompleteItem = /*#__PURE__*/React.memo(function MemoizedAutocompleteItem({
|
|
44
|
-
item
|
|
45
|
-
}) {
|
|
46
|
-
const {
|
|
47
|
-
id,
|
|
48
|
-
onAction,
|
|
49
|
-
children,
|
|
50
|
-
text,
|
|
51
|
-
leadingVisual: LeadingVisual,
|
|
52
|
-
trailingVisual: TrailingVisual,
|
|
53
|
-
key,
|
|
54
|
-
role,
|
|
55
|
-
...itemProps
|
|
56
|
-
} = item;
|
|
57
|
-
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
58
|
-
onSelect: () => onAction(item),
|
|
59
|
-
...itemProps,
|
|
60
|
-
id: id,
|
|
61
|
-
"data-id": id,
|
|
62
|
-
role: role,
|
|
63
|
-
children: [LeadingVisual && /*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
64
|
-
children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
|
|
65
|
-
}), children !== null && children !== void 0 ? children : text, TrailingVisual && /*#__PURE__*/jsx(ActionList.TrailingVisual, {
|
|
66
|
-
children: isElement(TrailingVisual) ? TrailingVisual : /*#__PURE__*/jsx(TrailingVisual, {})
|
|
67
|
-
})]
|
|
68
|
-
}, key !== null && key !== void 0 ? key : id);
|
|
69
|
-
});
|
|
70
36
|
function getItemById(itemId, items) {
|
|
71
37
|
return items.find(item => item.id === itemId);
|
|
72
38
|
}
|
|
@@ -119,11 +85,7 @@ function AutocompleteMenu(props) {
|
|
|
119
85
|
} = props;
|
|
120
86
|
const listContainerRef = useRef(null);
|
|
121
87
|
const allItemsToRenderRef = useRef([]);
|
|
122
|
-
|
|
123
|
-
// on every arrow-key press. The active styling was already handled via DOM by
|
|
124
|
-
// useFocusZone (data-is-active-descendant) before this change, but the
|
|
125
|
-
// previous useState caused React to re-render the entire item list anyway.
|
|
126
|
-
const highlightedItemRef = useRef();
|
|
88
|
+
const [highlightedItem, setHighlightedItem] = useState();
|
|
127
89
|
const [sortedItemIds, setSortedItemIds] = useState(items.map(({
|
|
128
90
|
id: itemId
|
|
129
91
|
}) => itemId));
|
|
@@ -133,6 +95,7 @@ function AutocompleteMenu(props) {
|
|
|
133
95
|
...selectableItem,
|
|
134
96
|
role: 'option',
|
|
135
97
|
id: selectableItem.id,
|
|
98
|
+
active: (highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.id) === selectableItem.id,
|
|
136
99
|
selected: selectionVariant === 'multiple' ? selectedItemIds.includes(selectableItem.id) : undefined,
|
|
137
100
|
onAction: item => {
|
|
138
101
|
const otherSelectedItemIds = selectedItemIds.filter(selectedItemId => selectedItemId !== item.id);
|
|
@@ -149,7 +112,7 @@ function AutocompleteMenu(props) {
|
|
|
149
112
|
}
|
|
150
113
|
}
|
|
151
114
|
};
|
|
152
|
-
}), [items, selectedItemIds, inputRef, onSelectedChange, selectionVariant, setAutocompleteSuggestion, setInputValue, setShowMenu]);
|
|
115
|
+
}), [highlightedItem, items, selectedItemIds, inputRef, onSelectedChange, selectionVariant, setAutocompleteSuggestion, setInputValue, setShowMenu]);
|
|
153
116
|
const itemSortOrderData = useMemo(() => sortedItemIds.reduce((acc, curr, i) => {
|
|
154
117
|
acc[curr] = i;
|
|
155
118
|
return acc;
|
|
@@ -163,6 +126,7 @@ function AutocompleteMenu(props) {
|
|
|
163
126
|
...addNewItem,
|
|
164
127
|
role: 'option',
|
|
165
128
|
key: addNewItem.id,
|
|
129
|
+
active: (highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.id) === addNewItem.id,
|
|
166
130
|
selected: selectionVariant === 'multiple' ? selectedItemIds.includes(addNewItem.id) : undefined,
|
|
167
131
|
leadingVisual: () => /*#__PURE__*/jsx(PlusIcon, {}),
|
|
168
132
|
onAction: item => {
|
|
@@ -177,7 +141,7 @@ function AutocompleteMenu(props) {
|
|
|
177
141
|
setAutocompleteSuggestion('');
|
|
178
142
|
}
|
|
179
143
|
}
|
|
180
|
-
}] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue, generatedUniqueId, selectedItemIds]);
|
|
144
|
+
}] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue, generatedUniqueId, highlightedItem, selectedItemIds]);
|
|
181
145
|
React.useEffect(() => {
|
|
182
146
|
allItemsToRenderRef.current = allItemsToRender;
|
|
183
147
|
});
|
|
@@ -195,28 +159,13 @@ function AutocompleteMenu(props) {
|
|
|
195
159
|
activeDescendantFocus: inputRef,
|
|
196
160
|
onActiveDescendantChanged: (current, _previous, directlyActivated) => {
|
|
197
161
|
activeDescendantRef.current = current || null;
|
|
198
|
-
|
|
199
|
-
// Active styling was already handled via DOM before this change:
|
|
200
|
-
// useFocusZone sets `data-is-active-descendant` on the active element,
|
|
201
|
-
// and ActionList styles that attribute in CSS. The key change is that
|
|
202
|
-
// we no longer call setHighlightedItem (state), avoiding re-renders.
|
|
203
|
-
|
|
204
162
|
if (current) {
|
|
205
|
-
var _selectedItem$text;
|
|
206
|
-
const currentLi = current.closest('li');
|
|
207
163
|
const selectedItem = allItemsToRenderRef.current.find(item => {
|
|
208
|
-
|
|
164
|
+
var _current$closest;
|
|
165
|
+
return item.id === ((_current$closest = current.closest('li')) === null || _current$closest === void 0 ? void 0 : _current$closest.getAttribute('data-id'));
|
|
209
166
|
});
|
|
210
|
-
|
|
167
|
+
setHighlightedItem(selectedItem);
|
|
211
168
|
setIsMenuDirectlyActivated(directlyActivated);
|
|
212
|
-
|
|
213
|
-
// Update autocomplete suggestion inline (moved from the useEffect
|
|
214
|
-
// that previously depended on highlightedItem state)
|
|
215
|
-
if (selectedItem !== null && selectedItem !== void 0 && (_selectedItem$text = selectedItem.text) !== null && _selectedItem$text !== void 0 && _selectedItem$text.startsWith(deferredInputValue) && !selectedItemIds.includes(selectedItem.id)) {
|
|
216
|
-
setAutocompleteSuggestion(selectedItem.text);
|
|
217
|
-
} else {
|
|
218
|
-
setAutocompleteSuggestion('');
|
|
219
|
-
}
|
|
220
169
|
}
|
|
221
170
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) {
|
|
222
171
|
scrollIntoView(current, customScrollContainerRef.current, menuScrollMargins);
|
|
@@ -226,16 +175,15 @@ function AutocompleteMenu(props) {
|
|
|
226
175
|
}
|
|
227
176
|
}, [loading]);
|
|
228
177
|
useEffect(() => {
|
|
229
|
-
var
|
|
230
|
-
//
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
setAutocompleteSuggestion(highlighted.text);
|
|
178
|
+
var _highlightedItem$text;
|
|
179
|
+
// Use deferredInputValue to avoid running this effect on every keystroke
|
|
180
|
+
// The Input component guards against stale suggestions
|
|
181
|
+
if (highlightedItem !== null && highlightedItem !== void 0 && (_highlightedItem$text = highlightedItem.text) !== null && _highlightedItem$text !== void 0 && _highlightedItem$text.startsWith(deferredInputValue) && !selectedItemIds.includes(highlightedItem.id)) {
|
|
182
|
+
setAutocompleteSuggestion(highlightedItem.text);
|
|
235
183
|
} else {
|
|
236
184
|
setAutocompleteSuggestion('');
|
|
237
185
|
}
|
|
238
|
-
}, [deferredInputValue, selectedItemIds, setAutocompleteSuggestion]);
|
|
186
|
+
}, [highlightedItem, deferredInputValue, selectedItemIds, setAutocompleteSuggestion]);
|
|
239
187
|
useEffect(() => {
|
|
240
188
|
const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn(itemId => isItemSelected(itemId, selectedItemIds)));
|
|
241
189
|
const sortResultMatchesState = itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element, index) => element === sortedItemIds[index]);
|
|
@@ -267,10 +215,29 @@ function AutocompleteMenu(props) {
|
|
|
267
215
|
id: `${id}-listbox`,
|
|
268
216
|
"aria-labelledby": ariaLabelledBy,
|
|
269
217
|
children: allItemsToRender.map(item => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
218
|
+
const {
|
|
219
|
+
id,
|
|
220
|
+
onAction,
|
|
221
|
+
children,
|
|
222
|
+
text,
|
|
223
|
+
leadingVisual: LeadingVisual,
|
|
224
|
+
trailingVisual: TrailingVisual,
|
|
225
|
+
key,
|
|
226
|
+
role,
|
|
227
|
+
...itemProps
|
|
228
|
+
} = item;
|
|
229
|
+
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
230
|
+
onSelect: () => onAction(item),
|
|
231
|
+
...itemProps,
|
|
232
|
+
id: id,
|
|
233
|
+
"data-id": id,
|
|
234
|
+
role: role,
|
|
235
|
+
children: [LeadingVisual && /*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
236
|
+
children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
|
|
237
|
+
}), children !== null && children !== void 0 ? children : text, TrailingVisual && /*#__PURE__*/jsx(ActionList.TrailingVisual, {
|
|
238
|
+
children: isElement(TrailingVisual) ? TrailingVisual : /*#__PURE__*/jsx(TrailingVisual, {})
|
|
239
|
+
})]
|
|
240
|
+
}, key !== null && key !== void 0 ? key : id);
|
|
274
241
|
})
|
|
275
242
|
}) : emptyStateText !== false && emptyStateText !== null ? /*#__PURE__*/jsx("div", {
|
|
276
243
|
className: classes.EmptyStateWrapper,
|
|
@@ -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,kBAS9B,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
|
2
2
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
4
|
primer_react_breadcrumbs_overflow_menu: false,
|
|
5
|
+
primer_react_css_anchor_positioning: false,
|
|
5
6
|
primer_react_css_has_selector_perf: false,
|
|
6
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
7
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@keyframes prc-Overlay-overlay-appear-JpFey{0%{opacity:0}to{opacity:1}}.prc-Overlay-Overlay-jfs-T{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:auto;position:absolute;width:auto}.prc-Overlay-Overlay-jfs-T[data-anchor-position=false]{bottom:var(--bottom,auto);left:var(--left,auto);right:var(--right,auto);top:var(--top,auto)}.prc-Overlay-Overlay-jfs-T:focus{outline:none}@media (forced-colors:active){.prc-Overlay-Overlay-jfs-T{outline:1px solid transparent}}.prc-Overlay-Overlay-jfs-T:where([data-reflow-container=true]){max-width:calc(100vw - 2rem)}.prc-Overlay-Overlay-jfs-T:where([data-overflow-auto]){overflow:auto}.prc-Overlay-Overlay-jfs-T:where([data-overflow-hidden]){overflow:hidden}.prc-Overlay-Overlay-jfs-T:where([data-overflow-scroll]){overflow:scroll}.prc-Overlay-Overlay-jfs-T:where([data-overflow-visible]){overflow:visible}.prc-Overlay-Overlay-jfs-T:where([data-height-xsmall]){height:192px}.prc-Overlay-Overlay-jfs-T:where([data-height-small]){height:256px}.prc-Overlay-Overlay-jfs-T:where([data-height-medium]){height:320px}.prc-Overlay-Overlay-jfs-T:where([data-height-large]){height:432px}.prc-Overlay-Overlay-jfs-T:where([data-height-xlarge]){height:600px}.prc-Overlay-Overlay-jfs-T:where([data-height-auto]),.prc-Overlay-Overlay-jfs-T:where([data-height-initial]){height:auto}.prc-Overlay-Overlay-jfs-T:where([data-height-fit-content]){height:-moz-fit-content;height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:192px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:432px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:600px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-fit-content]){max-height:-moz-fit-content;max-height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-width-small]){width:256px}.prc-Overlay-Overlay-jfs-T:where([data-width-medium]){width:320px}.prc-Overlay-Overlay-jfs-T:where([data-width-large]){width:480px}.prc-Overlay-Overlay-jfs-T:where([data-width-xlarge]){width:640px}.prc-Overlay-Overlay-jfs-T:where([data-width-xxlarge]){width:960px}.prc-Overlay-Overlay-jfs-T:where([data-width-auto]){width:auto}.prc-Overlay-Overlay-jfs-T:where([data-max-width-small]){max-width:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-medium]){max-width:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-large]){max-width:480px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xlarge]){max-width:640px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xxlarge]){max-width:960px}.prc-Overlay-Overlay-jfs-T:where([data-visibility-visible]){visibility:visible}.prc-Overlay-Overlay-jfs-T:where([data-visibility-hidden]){visibility:hidden}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){border-radius:unset;height:100vh;left:0;margin:0;max-height:none;max-width:none;position:fixed;top:0;width:100vw}}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-variant=fullscreen]){height:100dvh}}@media (prefers-reduced-motion:no-preference){.prc-Overlay-Overlay-jfs-T{animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1)}}
|
|
2
|
+
/*# sourceMappingURL=Overlay-99fc96c9.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,mEAAwC,CACxC,8CAAwC,
|
|
1
|
+
{"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,mEAAwC,CACxC,8CAAwC,CACxC,mEAAwC,CALxC,WAAY,CACZ,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAElB,UAiLF,CAxKE,uDAQE,yBAA2B,CAJ3B,qBAAuB,CAEvB,uBAAyB,CAJzB,mBAOF,CAEA,iCACE,YACF,CAEA,8BA3BF,2BA6BI,6BAuJJ,CAtJE,CAEA,+DACE,4BACF,CAEA,uDACE,aACF,CAEA,yDACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,gBACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,6GAEE,WACF,CAEA,4DACE,uBAAmB,CAAnB,kBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,gEACE,2BAAuB,CAAvB,sBACF,CAEA,qDACE,WACF,CAEA,sDACE,WACF,CAEA,qDAEE,WACF,CAEA,sDAEE,WACF,CAEA,uDAEE,WACF,CAEA,oDACE,UACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,2DACE,eACF,CAEA,4DACE,kBACF,CAEA,2DACE,iBACF,CAGE,mDADF,+DAUI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAJf,cAAe,CACf,KAAM,CAEN,WAOJ,CADE,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-99fc96c9.css","sourcesContent":["@keyframes overlay-appear {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.Overlay {\n position: absolute;\n max-width: calc(100vw - 2rem);\n width: auto;\n min-width: 192px;\n height: auto;\n max-height: 100vh;\n overflow: auto;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n box-shadow: var(--shadow-floating-small);\n\n &[data-anchor-position='false'] {\n /* stylelint-disable-next-line primer/spacing */\n top: var(--top, auto);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--left, auto);\n /* stylelint-disable-next-line primer/spacing */\n right: var(--right, auto);\n /* stylelint-disable-next-line primer/spacing */\n bottom: var(--bottom, auto);\n }\n\n &:focus {\n outline: none;\n }\n\n @media (forced-colors: active) {\n /* Support for Windows high contrast https://sarahmhigley.com/writing/whcm-quick-tips */\n outline: solid 1px transparent;\n }\n\n &:where([data-reflow-container='true']) {\n max-width: calc(100vw - 2rem);\n }\n\n &:where([data-overflow-auto]) {\n overflow: auto;\n }\n\n &:where([data-overflow-hidden]) {\n overflow: hidden;\n }\n\n &:where([data-overflow-scroll]) {\n overflow: scroll;\n }\n\n &:where([data-overflow-visible]) {\n overflow: visible;\n }\n\n &:where([data-height-xsmall]) {\n height: 192px;\n }\n\n &:where([data-height-small]) {\n height: 256px;\n }\n\n &:where([data-height-medium]) {\n height: 320px;\n }\n\n &:where([data-height-large]) {\n height: 432px;\n }\n\n &:where([data-height-xlarge]) {\n height: 600px;\n }\n\n &:where([data-height-auto]),\n &:where([data-height-initial]) {\n height: auto;\n }\n\n &:where([data-height-fit-content]) {\n height: fit-content;\n }\n\n &:where([data-max-height-xsmall]) {\n max-height: 192px;\n }\n\n &:where([data-max-height-small]) {\n max-height: 256px;\n }\n\n &:where([data-max-height-medium]) {\n max-height: 320px;\n }\n\n &:where([data-max-height-large]) {\n max-height: 432px;\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: 600px;\n }\n\n &:where([data-max-height-fit-content]) {\n max-height: fit-content;\n }\n\n &:where([data-width-small]) {\n width: 256px;\n }\n\n &:where([data-width-medium]) {\n width: 320px;\n }\n\n &:where([data-width-large]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-width-xlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n }\n\n &:where([data-width-xxlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 960px;\n }\n\n &:where([data-width-auto]) {\n width: auto;\n }\n\n &:where([data-max-width-small]) {\n max-width: 256px;\n }\n\n &:where([data-max-width-medium]) {\n max-width: 320px;\n }\n\n &:where([data-max-width-large]) {\n max-width: 480px;\n }\n\n &:where([data-max-width-xlarge]) {\n max-width: 640px;\n }\n\n &:where([data-max-width-xxlarge]) {\n max-width: 960px;\n }\n\n &:where([data-visibility-visible]) {\n visibility: visible;\n }\n\n &:where([data-visibility-hidden]) {\n visibility: hidden;\n }\n\n &:where([data-responsive='fullscreen']) {\n @media screen and (--viewportRange-narrow) {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n max-width: none;\n height: 100vh;\n max-height: none;\n margin: 0;\n border-radius: unset;\n }\n }\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n &:where([data-variant='fullscreen']) {\n height: 100dvh;\n }\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .Overlay {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,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zB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CACpD,CAAA;AAED,KAAK,oBAAoB,GAAG,KAAK,CAAC,eAAe,EAAE,cAAc,CAAC,CAAA;AAElE;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,OAAO,EAuFR,8BAA8B,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAA;AAEhE,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAA;AAEhE,eAAe,OAAO,CAAA"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -6,6 +6,7 @@ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.
|
|
|
6
6
|
import classes from './Overlay.module.css.js';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
9
10
|
import { useOverlay } from '../hooks/useOverlay.js';
|
|
10
11
|
|
|
11
12
|
const heightMap = {
|
|
@@ -115,7 +116,7 @@ const BaseOverlay = /*#__PURE__*/React.forwardRef(({
|
|
|
115
116
|
|
|
116
117
|
*/
|
|
117
118
|
const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
118
|
-
const $ = c(
|
|
119
|
+
const $ = c(46);
|
|
119
120
|
let anchorSide;
|
|
120
121
|
let ignoreClickRefs;
|
|
121
122
|
let initialFocusRef;
|
|
@@ -195,6 +196,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
195
196
|
const role = t3 === undefined ? "none" : t3;
|
|
196
197
|
const visibility = t4 === undefined ? "visible" : t4;
|
|
197
198
|
const width = t5 === undefined ? "auto" : t5;
|
|
199
|
+
const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
|
|
198
200
|
const overlayRef = useRef(null);
|
|
199
201
|
useRefObjectAsForwardedRef(forwardedRef, overlayRef);
|
|
200
202
|
let t6;
|
|
@@ -268,9 +270,10 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
268
270
|
useIsomorphicLayoutEffect(t9, t10);
|
|
269
271
|
const leftPosition = left === undefined && right === undefined ? 0 : left;
|
|
270
272
|
const t11 = !preventOverflow ? true : undefined;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
const t12 = cssAnchorPositioning ? "true" : "false";
|
|
274
|
+
let t13;
|
|
275
|
+
if ($[32] !== height || $[33] !== leftPosition || $[34] !== props || $[35] !== responsiveVariant || $[36] !== right || $[37] !== role || $[38] !== t11 || $[39] !== t12 || $[40] !== visibility || $[41] !== width) {
|
|
276
|
+
t13 = /*#__PURE__*/jsx(BaseOverlay, {
|
|
274
277
|
role: role,
|
|
275
278
|
width: width,
|
|
276
279
|
"data-reflow-container": t11,
|
|
@@ -280,6 +283,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
280
283
|
height: height,
|
|
281
284
|
visibility: visibility,
|
|
282
285
|
"data-responsive": responsiveVariant,
|
|
286
|
+
"data-anchor-position": t12,
|
|
283
287
|
...props
|
|
284
288
|
});
|
|
285
289
|
$[32] = height;
|
|
@@ -289,25 +293,30 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
289
293
|
$[36] = right;
|
|
290
294
|
$[37] = role;
|
|
291
295
|
$[38] = t11;
|
|
292
|
-
$[39] =
|
|
293
|
-
$[40] =
|
|
294
|
-
$[41] =
|
|
296
|
+
$[39] = t12;
|
|
297
|
+
$[40] = visibility;
|
|
298
|
+
$[41] = width;
|
|
299
|
+
$[42] = t13;
|
|
295
300
|
} else {
|
|
296
|
-
|
|
301
|
+
t13 = $[42];
|
|
297
302
|
}
|
|
298
|
-
|
|
299
|
-
if (
|
|
300
|
-
|
|
303
|
+
const overlayContent = t13;
|
|
304
|
+
if (cssAnchorPositioning) {
|
|
305
|
+
return overlayContent;
|
|
306
|
+
}
|
|
307
|
+
let t14;
|
|
308
|
+
if ($[43] !== overlayContent || $[44] !== portalContainerName) {
|
|
309
|
+
t14 = /*#__PURE__*/jsx(Portal, {
|
|
301
310
|
containerName: portalContainerName,
|
|
302
|
-
children:
|
|
311
|
+
children: overlayContent
|
|
303
312
|
});
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
313
|
+
$[43] = overlayContent;
|
|
314
|
+
$[44] = portalContainerName;
|
|
315
|
+
$[45] = t14;
|
|
307
316
|
} else {
|
|
308
|
-
|
|
317
|
+
t14 = $[45];
|
|
309
318
|
}
|
|
310
|
-
return
|
|
319
|
+
return t14;
|
|
311
320
|
});
|
|
312
321
|
|
|
313
322
|
export { BaseOverlay, Overlay as default, heightMap };
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAQlE,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,4MAA4M;IAC5M,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;CAC5C,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,4BAiEd;kBAzEQ,OAAO;;;AA0FhB,eAAe,OAAO,CAAA"}
|
package/dist/Spinner/Spinner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { useState, useEffect
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
4
|
import classes from './Spinner.module.css.js';
|
|
5
5
|
import { useMedia } from '../hooks/useMedia.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -8,6 +8,7 @@ import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
|
8
8
|
import { useId } from '../hooks/useId.js';
|
|
9
9
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
10
10
|
|
|
11
|
+
const ANIMATION_DURATION_MS = 1000;
|
|
11
12
|
const sizeMap = {
|
|
12
13
|
small: '16px',
|
|
13
14
|
medium: '32px',
|
|
@@ -15,7 +16,7 @@ const sizeMap = {
|
|
|
15
16
|
};
|
|
16
17
|
function Spinner(t0) {
|
|
17
18
|
var _ariaLabel;
|
|
18
|
-
const $ = c(
|
|
19
|
+
const $ = c(35);
|
|
19
20
|
let ariaLabel;
|
|
20
21
|
let className;
|
|
21
22
|
let props;
|
|
@@ -54,50 +55,82 @@ function Spinner(t0) {
|
|
|
54
55
|
const srText = t2 === undefined ? "Loading" : t2;
|
|
55
56
|
const delay = t3 === undefined ? false : t3;
|
|
56
57
|
const syncAnimationsEnabled = useFeatureFlag("primer_react_spinner_synchronize_animations");
|
|
57
|
-
const
|
|
58
|
+
const noMotionPreference = useMedia("(prefers-reduced-motion: no-preference)", false);
|
|
58
59
|
const size = sizeMap[sizeKey];
|
|
59
60
|
const hasHiddenLabel = srText !== null && ariaLabel === undefined;
|
|
60
61
|
const labelId = useId();
|
|
61
|
-
const [isVisible, setIsVisible] = useState(!delay);
|
|
62
62
|
let t4;
|
|
63
|
-
let t5;
|
|
64
63
|
if ($[8] !== delay) {
|
|
65
|
-
t4 = () => {
|
|
64
|
+
t4 = () => ({
|
|
65
|
+
isVisible: !delay,
|
|
66
|
+
syncDelay: !delay ? computeSyncDelay() : 0
|
|
67
|
+
});
|
|
68
|
+
$[8] = delay;
|
|
69
|
+
$[9] = t4;
|
|
70
|
+
} else {
|
|
71
|
+
t4 = $[9];
|
|
72
|
+
}
|
|
73
|
+
const [t5, setVisibleState] = useState(t4);
|
|
74
|
+
const {
|
|
75
|
+
isVisible,
|
|
76
|
+
syncDelay
|
|
77
|
+
} = t5;
|
|
78
|
+
let t6;
|
|
79
|
+
let t7;
|
|
80
|
+
if ($[10] !== delay) {
|
|
81
|
+
t6 = () => {
|
|
66
82
|
if (delay) {
|
|
67
83
|
const delayDuration = typeof delay === "number" ? delay : delay === "short" ? 300 : 1000;
|
|
68
84
|
const timeoutId = setTimeout(() => {
|
|
69
|
-
|
|
85
|
+
setVisibleState({
|
|
86
|
+
isVisible: true,
|
|
87
|
+
syncDelay: computeSyncDelay()
|
|
88
|
+
});
|
|
70
89
|
}, delayDuration);
|
|
71
90
|
return () => clearTimeout(timeoutId);
|
|
72
91
|
}
|
|
73
92
|
};
|
|
74
|
-
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
93
|
+
t7 = [delay];
|
|
94
|
+
$[10] = delay;
|
|
95
|
+
$[11] = t6;
|
|
96
|
+
$[12] = t7;
|
|
78
97
|
} else {
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
t6 = $[11];
|
|
99
|
+
t7 = $[12];
|
|
81
100
|
}
|
|
82
|
-
useEffect(
|
|
101
|
+
useEffect(t6, t7);
|
|
83
102
|
if (!isVisible) {
|
|
84
103
|
return null;
|
|
85
104
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
$[
|
|
105
|
+
const shouldSync = syncAnimationsEnabled && noMotionPreference;
|
|
106
|
+
let t8;
|
|
107
|
+
if ($[13] !== shouldSync || $[14] !== style || $[15] !== syncDelay) {
|
|
108
|
+
t8 = shouldSync ? {
|
|
109
|
+
...style,
|
|
110
|
+
animationDelay: `${syncDelay}ms`
|
|
111
|
+
} : style;
|
|
112
|
+
$[13] = shouldSync;
|
|
113
|
+
$[14] = style;
|
|
114
|
+
$[15] = syncDelay;
|
|
115
|
+
$[16] = t8;
|
|
94
116
|
} else {
|
|
95
|
-
|
|
117
|
+
t8 = $[16];
|
|
96
118
|
}
|
|
97
|
-
|
|
119
|
+
const mergedStyle = t8;
|
|
120
|
+
const t9 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : undefined;
|
|
121
|
+
const t10 = hasHiddenLabel ? labelId : undefined;
|
|
98
122
|
let t11;
|
|
99
|
-
if ($[
|
|
100
|
-
|
|
123
|
+
if ($[17] !== className) {
|
|
124
|
+
t11 = clsx(className, classes.SpinnerAnimation);
|
|
125
|
+
$[17] = className;
|
|
126
|
+
$[18] = t11;
|
|
127
|
+
} else {
|
|
128
|
+
t11 = $[18];
|
|
129
|
+
}
|
|
130
|
+
let t12;
|
|
131
|
+
let t13;
|
|
132
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
|
+
t12 = /*#__PURE__*/jsx("circle", {
|
|
101
134
|
cx: "8",
|
|
102
135
|
cy: "8",
|
|
103
136
|
r: "7",
|
|
@@ -106,163 +139,84 @@ function Spinner(t0) {
|
|
|
106
139
|
strokeWidth: "2",
|
|
107
140
|
vectorEffect: "non-scaling-stroke"
|
|
108
141
|
});
|
|
109
|
-
|
|
142
|
+
t13 = /*#__PURE__*/jsx("path", {
|
|
110
143
|
d: "M15 8a7.002 7.002 0 00-7-7",
|
|
111
144
|
stroke: "currentColor",
|
|
112
145
|
strokeWidth: "2",
|
|
113
146
|
strokeLinecap: "round",
|
|
114
147
|
vectorEffect: "non-scaling-stroke"
|
|
115
148
|
});
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
149
|
+
$[19] = t12;
|
|
150
|
+
$[20] = t13;
|
|
118
151
|
} else {
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
t12 = $[19];
|
|
153
|
+
t13 = $[20];
|
|
121
154
|
}
|
|
122
|
-
let
|
|
123
|
-
if ($[
|
|
124
|
-
|
|
125
|
-
ref: t6,
|
|
155
|
+
let t14;
|
|
156
|
+
if ($[21] !== mergedStyle || $[22] !== props || $[23] !== size || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
|
|
157
|
+
t14 = /*#__PURE__*/jsxs("svg", {
|
|
126
158
|
height: size,
|
|
127
159
|
width: size,
|
|
128
160
|
viewBox: "0 0 16 16",
|
|
129
161
|
fill: "none",
|
|
130
162
|
"aria-hidden": true,
|
|
131
|
-
"aria-label":
|
|
132
|
-
"aria-labelledby":
|
|
133
|
-
className:
|
|
134
|
-
style:
|
|
163
|
+
"aria-label": t9,
|
|
164
|
+
"aria-labelledby": t10,
|
|
165
|
+
className: t11,
|
|
166
|
+
style: mergedStyle,
|
|
135
167
|
...props,
|
|
136
|
-
children: [
|
|
168
|
+
children: [t12, t13]
|
|
137
169
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[22] = t12;
|
|
170
|
+
$[21] = mergedStyle;
|
|
171
|
+
$[22] = props;
|
|
172
|
+
$[23] = size;
|
|
173
|
+
$[24] = t10;
|
|
174
|
+
$[25] = t11;
|
|
175
|
+
$[26] = t9;
|
|
176
|
+
$[27] = t14;
|
|
146
177
|
} else {
|
|
147
|
-
|
|
178
|
+
t14 = $[27];
|
|
148
179
|
}
|
|
149
|
-
let
|
|
150
|
-
if ($[
|
|
151
|
-
|
|
180
|
+
let t15;
|
|
181
|
+
if ($[28] !== hasHiddenLabel || $[29] !== labelId || $[30] !== srText) {
|
|
182
|
+
t15 = hasHiddenLabel ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
152
183
|
id: labelId,
|
|
153
184
|
children: srText
|
|
154
185
|
}) : null;
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
186
|
+
$[28] = hasHiddenLabel;
|
|
187
|
+
$[29] = labelId;
|
|
188
|
+
$[30] = srText;
|
|
189
|
+
$[31] = t15;
|
|
159
190
|
} else {
|
|
160
|
-
|
|
191
|
+
t15 = $[31];
|
|
161
192
|
}
|
|
162
|
-
let
|
|
163
|
-
if ($[
|
|
164
|
-
|
|
193
|
+
let t16;
|
|
194
|
+
if ($[32] !== t14 || $[33] !== t15) {
|
|
195
|
+
t16 = /*#__PURE__*/jsxs("span", {
|
|
165
196
|
className: classes.Box,
|
|
166
|
-
children: [
|
|
197
|
+
children: [t14, t15]
|
|
167
198
|
});
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
199
|
+
$[32] = t14;
|
|
200
|
+
$[33] = t15;
|
|
201
|
+
$[34] = t16;
|
|
171
202
|
} else {
|
|
172
|
-
|
|
203
|
+
t16 = $[34];
|
|
173
204
|
}
|
|
174
|
-
return
|
|
205
|
+
return t16;
|
|
175
206
|
}
|
|
176
207
|
Spinner.displayName = 'Spinner';
|
|
177
|
-
const animationTimingStore = {
|
|
178
|
-
subscribers: new Set(),
|
|
179
|
-
value: {
|
|
180
|
-
startTime: null
|
|
181
|
-
},
|
|
182
|
-
update(startTime) {
|
|
183
|
-
const value = {
|
|
184
|
-
startTime
|
|
185
|
-
};
|
|
186
|
-
animationTimingStore.value = value;
|
|
187
|
-
for (const subscriber of animationTimingStore.subscribers) {
|
|
188
|
-
subscriber();
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
subscribe(subscriber) {
|
|
192
|
-
animationTimingStore.subscribers.add(subscriber);
|
|
193
|
-
return () => {
|
|
194
|
-
animationTimingStore.subscribers.delete(subscriber);
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
getSnapshot() {
|
|
198
|
-
return animationTimingStore.value;
|
|
199
|
-
},
|
|
200
|
-
getServerSnapshot() {
|
|
201
|
-
return animationTimingStore.value;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* A utility hook for reading a common `startTime` value so that all animations
|
|
207
|
-
* are in sync. This is a global value and is coordinated through `useSyncExternalStore`.
|
|
208
|
-
*/
|
|
209
|
-
function useAnimationTiming() {
|
|
210
|
-
return useSyncExternalStore(animationTimingStore.subscribe, animationTimingStore.getSnapshot, animationTimingStore.getServerSnapshot);
|
|
211
|
-
}
|
|
212
208
|
|
|
213
209
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
210
|
+
* Computes a negative animation-delay so all spinners land at the same
|
|
211
|
+
* rotation angle regardless of when they mount. Because every instance
|
|
212
|
+
* references the same clock (performance.now()), the CSS animation engine
|
|
213
|
+
* keeps them visually in sync without any Web Animations API calls
|
|
214
|
+
* (getAnimations, element.animate, startTime), which are significantly
|
|
215
|
+
* slower in Safari/WebKit.
|
|
216
216
|
*/
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
const noMotionPreference = useMedia("(prefers-reduced-motion: no-preference)", false);
|
|
221
|
-
const animationTiming = useAnimationTiming();
|
|
222
|
-
let t0;
|
|
223
|
-
if ($[0] !== animationTiming || $[1] !== noMotionPreference) {
|
|
224
|
-
t0 = element => {
|
|
225
|
-
if (!element) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (ref.current !== null) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (noMotionPreference) {
|
|
232
|
-
const cssAnimation = element.getAnimations().find(_temp);
|
|
233
|
-
cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.pause();
|
|
234
|
-
ref.current = element.animate([{
|
|
235
|
-
transform: "rotate(0deg)"
|
|
236
|
-
}, {
|
|
237
|
-
transform: "rotate(360deg)"
|
|
238
|
-
}], {
|
|
239
|
-
duration: 1000,
|
|
240
|
-
easing: "cubic-bezier(0,0,1,1)",
|
|
241
|
-
iterations: Infinity
|
|
242
|
-
});
|
|
243
|
-
if (animationTiming.startTime === null) {
|
|
244
|
-
var _cssAnimation$startTi;
|
|
245
|
-
const startTime = (_cssAnimation$startTi = cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.startTime) !== null && _cssAnimation$startTi !== void 0 ? _cssAnimation$startTi : 0;
|
|
246
|
-
animationTimingStore.update(startTime);
|
|
247
|
-
ref.current.startTime = startTime;
|
|
248
|
-
} else {
|
|
249
|
-
ref.current.startTime = animationTiming.startTime;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
$[0] = animationTiming;
|
|
254
|
-
$[1] = noMotionPreference;
|
|
255
|
-
$[2] = t0;
|
|
256
|
-
} else {
|
|
257
|
-
t0 = $[2];
|
|
258
|
-
}
|
|
259
|
-
return t0;
|
|
260
|
-
}
|
|
261
|
-
function _temp(animation) {
|
|
262
|
-
if (animation instanceof CSSAnimation) {
|
|
263
|
-
return animation.animationName.startsWith("Spinner") && animation.animationName.endsWith("rotate-keyframes");
|
|
264
|
-
}
|
|
265
|
-
return false;
|
|
217
|
+
function computeSyncDelay() {
|
|
218
|
+
const now = typeof performance !== 'undefined' ? performance.now() : 0;
|
|
219
|
+
return -(now % ANIMATION_DURATION_MS);
|
|
266
220
|
}
|
|
267
221
|
|
|
268
222
|
export { Spinner as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260303163914",
|
|
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",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@github/relative-time-element": "^4.5.0",
|
|
79
79
|
"@github/tab-container-element": "^4.8.2",
|
|
80
80
|
"@lit-labs/react": "1.2.1",
|
|
81
|
+
"@oddbird/css-anchor-positioning": "^0.9.0",
|
|
81
82
|
"@oddbird/popover-polyfill": "^0.5.2",
|
|
82
83
|
"@primer/behaviors": "^1.10.2",
|
|
83
84
|
"@primer/live-region-element": "^0.7.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}
|
|
2
|
-
/*# sourceMappingURL=AnchoredOverlay-73c1b2d1.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE","file":"AnchoredOverlay-73c1b2d1.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
@keyframes prc-Overlay-overlay-appear-JpFey{0%{opacity:0}to{opacity:1}}.prc-Overlay-Overlay-jfs-T{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);bottom:var(--bottom,auto);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;left:var(--left,auto);max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:auto;position:absolute;right:var(--right,auto);top:var(--top,auto);width:auto}.prc-Overlay-Overlay-jfs-T:focus{outline:none}@media (forced-colors:active){.prc-Overlay-Overlay-jfs-T{outline:1px solid transparent}}.prc-Overlay-Overlay-jfs-T:where([data-reflow-container=true]){max-width:calc(100vw - 2rem)}.prc-Overlay-Overlay-jfs-T:where([data-overflow-auto]){overflow:auto}.prc-Overlay-Overlay-jfs-T:where([data-overflow-hidden]){overflow:hidden}.prc-Overlay-Overlay-jfs-T:where([data-overflow-scroll]){overflow:scroll}.prc-Overlay-Overlay-jfs-T:where([data-overflow-visible]){overflow:visible}.prc-Overlay-Overlay-jfs-T:where([data-height-xsmall]){height:192px}.prc-Overlay-Overlay-jfs-T:where([data-height-small]){height:256px}.prc-Overlay-Overlay-jfs-T:where([data-height-medium]){height:320px}.prc-Overlay-Overlay-jfs-T:where([data-height-large]){height:432px}.prc-Overlay-Overlay-jfs-T:where([data-height-xlarge]){height:600px}.prc-Overlay-Overlay-jfs-T:where([data-height-auto]),.prc-Overlay-Overlay-jfs-T:where([data-height-initial]){height:auto}.prc-Overlay-Overlay-jfs-T:where([data-height-fit-content]){height:-moz-fit-content;height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:192px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:432px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:600px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-fit-content]){max-height:-moz-fit-content;max-height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-width-small]){width:256px}.prc-Overlay-Overlay-jfs-T:where([data-width-medium]){width:320px}.prc-Overlay-Overlay-jfs-T:where([data-width-large]){width:480px}.prc-Overlay-Overlay-jfs-T:where([data-width-xlarge]){width:640px}.prc-Overlay-Overlay-jfs-T:where([data-width-xxlarge]){width:960px}.prc-Overlay-Overlay-jfs-T:where([data-width-auto]){width:auto}.prc-Overlay-Overlay-jfs-T:where([data-max-width-small]){max-width:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-medium]){max-width:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-large]){max-width:480px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xlarge]){max-width:640px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xxlarge]){max-width:960px}.prc-Overlay-Overlay-jfs-T:where([data-visibility-visible]){visibility:visible}.prc-Overlay-Overlay-jfs-T:where([data-visibility-hidden]){visibility:hidden}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){border-radius:unset;height:100vh;left:0;margin:0;max-height:none;max-width:none;position:fixed;top:0;width:100vw}}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-variant=fullscreen]){height:100dvh}}@media (prefers-reduced-motion:no-preference){.prc-Overlay-Overlay-jfs-T{animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1)}}
|
|
2
|
-
/*# sourceMappingURL=Overlay-15519c09.css.map */
|