@primer/react 0.0.0-20260617185512 → 0.0.0-20260617201327
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 +6 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +7 -3
- package/dist/ConfirmationDialog/useConfirm.d.ts.map +1 -1
- package/dist/ConfirmationDialog/useConfirm.js +4 -8
- package/dist/hooks/useMergedRefs.js +17 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260617201327
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -25,10 +25,14 @@
|
|
|
25
25
|
|
|
26
26
|
- [#7976](https://github.com/primer/react/pull/7976) [`1fac927`](https://github.com/primer/react/commit/1fac9270c497c1904acbb3eb60805630aab82a97) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - NavList: add a small gap between items for readability, including before expanded sub-navs, behind the `primer_react_action_list_item_gap` feature flag
|
|
27
27
|
|
|
28
|
-
- [#7999](https://github.com/primer/react/pull/7999) [`
|
|
28
|
+
- [#7999](https://github.com/primer/react/pull/7999) [`eada357`](https://github.com/primer/react/commit/eada3574ff15bfd7680602f34e19308ea766a972) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Breadcrumbs: Improve rendering performance and refresh the overflow menu when breadcrumb content changes without changing the number of items.
|
|
29
|
+
|
|
30
|
+
- [#7935](https://github.com/primer/react/pull/7935) [`2765933`](https://github.com/primer/react/commit/276593387ec84f72aeba02a940b5e0a4d0a026a9) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - ConfirmationDialog: `useConfirm`/`confirm` now removes its host element from `document.body` after the dialog is closed, and uses a fresh host element per call, so the empty container no longer lingers or leaks into other components and tests
|
|
29
31
|
|
|
30
32
|
- [#7929](https://github.com/primer/react/pull/7929) [`48c34ca`](https://github.com/primer/react/commit/48c34ca452a5449b0ba901783edb169b6a1e1882) Thanks [@joshblack](https://github.com/joshblack)! - FilteredActionList: Make body skeleton widths stable for server rendering
|
|
31
33
|
|
|
34
|
+
- [#7985](https://github.com/primer/react/pull/7985) [`969c874`](https://github.com/primer/react/commit/969c8749b40a8f5075dd9ca91314cde5c41e3814) Thanks [@joshblack](https://github.com/joshblack)! - AnchoredOverlay: Render the popover target attribute correctly for popover anchors
|
|
35
|
+
|
|
32
36
|
- [#7984](https://github.com/primer/react/pull/7984) [`06fdad4`](https://github.com/primer/react/commit/06fdad432ad274878b15921d3ee25a157c61e70d) Thanks [@joshblack](https://github.com/joshblack)! - CircleBadge, ActionList: Prevent internal props from rendering on DOM elements
|
|
33
37
|
|
|
34
38
|
- Fake entry to force publishing
|
|
@@ -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,EAAmC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAChE,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/A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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;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA4TnF,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
7
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { widthMap } from '../Overlay/constants.js';
|
|
10
|
+
import { reactMajorVersion } from '../utils/environment.js';
|
|
10
11
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
12
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
12
13
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
@@ -138,6 +139,11 @@ const AnchoredOverlay = ({
|
|
|
138
139
|
...focusTrapSettings
|
|
139
140
|
});
|
|
140
141
|
const popoverId = useId();
|
|
142
|
+
const popoverTargetProps = shouldRenderAsPopover ? reactMajorVersion >= 19 ? {
|
|
143
|
+
popoverTarget: popoverId
|
|
144
|
+
} : {
|
|
145
|
+
popovertarget: popoverId
|
|
146
|
+
} : {};
|
|
141
147
|
const id = popoverId.replaceAll(':', '_'); // popoverId can contain colons which are invalid in CSS custom property names, so we replace them with underscores
|
|
142
148
|
const anchorName = `--anchored-overlay-anchor-${id}`;
|
|
143
149
|
|
|
@@ -234,9 +240,7 @@ const AnchoredOverlay = ({
|
|
|
234
240
|
tabIndex: 0,
|
|
235
241
|
onClick: onAnchorClick,
|
|
236
242
|
onKeyDown: onAnchorKeyDown,
|
|
237
|
-
...
|
|
238
|
-
popoverTarget: popoverId
|
|
239
|
-
} : {})
|
|
243
|
+
...popoverTargetProps
|
|
240
244
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
241
245
|
returnFocusRef: anchorRef,
|
|
242
246
|
onClickOutside: onClickOutside,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfirm.d.ts","sourceRoot":"","sources":["../../src/ConfirmationDialog/useConfirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAqB,KAAK,uBAAuB,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useConfirm.d.ts","sourceRoot":"","sources":["../../src/ConfirmationDialog/useConfirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAqB,KAAK,uBAAuB,EAAC,MAAM,sBAAsB,CAAA;AAErF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,CAAA;AAuBlG;;;;GAIG;AACH,wBAAgB,UAAU,cACa,cAAc,sBAIpD"}
|
|
@@ -3,23 +3,19 @@ import { createRoot } from 'react-dom/client';
|
|
|
3
3
|
import BaseStyles from '../BaseStyles.js';
|
|
4
4
|
import { ConfirmationDialog } from './ConfirmationDialog.js';
|
|
5
5
|
|
|
6
|
-
let hostElement = null;
|
|
7
6
|
async function confirm(options) {
|
|
8
7
|
const {
|
|
9
8
|
content,
|
|
10
9
|
...confirmationDialogProps
|
|
11
10
|
} = options;
|
|
12
11
|
return new Promise(resolve => {
|
|
13
|
-
hostElement
|
|
14
|
-
|
|
12
|
+
const hostElement = document.createElement('div');
|
|
13
|
+
document.body.append(hostElement);
|
|
15
14
|
const root = createRoot(hostElement);
|
|
16
15
|
const onClose = gesture => {
|
|
17
16
|
root.unmount();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} else {
|
|
21
|
-
resolve(false);
|
|
22
|
-
}
|
|
17
|
+
hostElement.remove();
|
|
18
|
+
resolve(gesture === 'confirm');
|
|
23
19
|
};
|
|
24
20
|
root.render(/*#__PURE__*/React.createElement(BaseStyles, null, /*#__PURE__*/React.createElement(ConfirmationDialog, {
|
|
25
21
|
...confirmationDialogProps,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'react';
|
|
1
|
+
import { useCallback } from 'react';
|
|
3
2
|
import { reactMajorVersion, isExperimentalReactVersion } from '../utils/environment.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -42,35 +41,23 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
|
|
|
42
41
|
* }
|
|
43
42
|
*/
|
|
44
43
|
function useMergedRefs(refA, refB) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (cleanupB) {
|
|
61
|
-
cleanupB();
|
|
62
|
-
} else {
|
|
63
|
-
setRef(refB, null);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
44
|
+
return useCallback(value => {
|
|
45
|
+
const cleanupA = setRef(refA, value);
|
|
46
|
+
const cleanupB = setRef(refB, value);
|
|
47
|
+
|
|
48
|
+
// TODO: remove when we are on React 19
|
|
49
|
+
if (!supportsRefCleanup) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Only works in React 19. In React 18, the cleanup function will be ignored and the ref will get called with
|
|
54
|
+
// `null` which will be passed to each ref as expected.
|
|
55
|
+
return () => {
|
|
56
|
+
// For object refs and callback refs that don't return cleanups, we still need to pass `null` on cleanup
|
|
57
|
+
if (cleanupA) cleanupA();else setRef(refA, null);
|
|
58
|
+
if (cleanupB) cleanupB();else setRef(refB, null);
|
|
66
59
|
};
|
|
67
|
-
|
|
68
|
-
$[1] = refB;
|
|
69
|
-
$[2] = t0;
|
|
70
|
-
} else {
|
|
71
|
-
t0 = $[2];
|
|
72
|
-
}
|
|
73
|
-
return t0;
|
|
60
|
+
}, [refA, refB]);
|
|
74
61
|
}
|
|
75
62
|
|
|
76
63
|
/**
|
package/package.json
CHANGED