@primer/react 0.0.0-20260330091632 → 0.0.0-20260330122640
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260330122640
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
- [#7683](https://github.com/primer/react/pull/7683) [`f05fcac`](https://github.com/primer/react/commit/f05fcacedafe8a9a1af9caa6a762403d47851250) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Dialog: dynamically switch footer button layout based on available height.
|
|
22
22
|
|
|
23
|
-
- [#7619](https://github.com/primer/react/pull/7619) [`8d96f15`](https://github.com/primer/react/commit/8d96f15fafbd39e2519de7901570b28d9ee5be1d) Thanks [@hectahertz](https://github.com/hectahertz)! - Memoize ActionMenu context values to prevent unnecessary re-renders of menu items
|
|
24
|
-
|
|
25
23
|
- [#7676](https://github.com/primer/react/pull/7676) [`35ca056`](https://github.com/primer/react/commit/35ca05690910ffb8286a2aeef01c043af377a6c2) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Remove link underline effect on hover for both Link (inline) and Button with variant link (no visuals)
|
|
26
24
|
|
|
27
25
|
- [#7631](https://github.com/primer/react/pull/7631) [`0ecaf6f`](https://github.com/primer/react/commit/0ecaf6f64c50235081416515b7d5b6b2e364b33f) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add test to validate that the `muted` prop is not leaked as a bare DOM attribute on `Link`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAGl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AA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAGD,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IAEH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAE7D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC,GAAG,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAA;AA8I3C,MAAM,MAAM,qBAAqB,GAAG;IAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AA2DxH,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAA;AAe/C,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,GAC3C,IAAI,CAAC,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;AA6GH,eAAO,MAAM,UAAU;;;kBA1LP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CAyL4E,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext,
|
|
1
|
+
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
4
4
|
import { Divider } from '../ActionList/Divider.js';
|
|
@@ -137,18 +137,17 @@ const Menu = ({
|
|
|
137
137
|
return child;
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
const isSubmenu = parentMenuContext.isSubmenu !== undefined;
|
|
141
|
-
const menuContextValue = useMemo(() => ({
|
|
142
|
-
anchorRef,
|
|
143
|
-
renderAnchor,
|
|
144
|
-
anchorId,
|
|
145
|
-
open: combinedOpenState,
|
|
146
|
-
onOpen,
|
|
147
|
-
onClose,
|
|
148
|
-
isSubmenu
|
|
149
|
-
}), [anchorRef, renderAnchor, anchorId, combinedOpenState, onOpen, onClose, isSubmenu]);
|
|
150
140
|
return /*#__PURE__*/jsx(MenuContext.Provider, {
|
|
151
|
-
value:
|
|
141
|
+
value: {
|
|
142
|
+
anchorRef,
|
|
143
|
+
renderAnchor,
|
|
144
|
+
anchorId,
|
|
145
|
+
open: combinedOpenState,
|
|
146
|
+
onOpen,
|
|
147
|
+
onClose,
|
|
148
|
+
// will be undefined for the outermost level, then false for the top menu, then true inside that
|
|
149
|
+
isSubmenu: parentMenuContext.isSubmenu !== undefined
|
|
150
|
+
},
|
|
152
151
|
children: contents
|
|
153
152
|
});
|
|
154
153
|
};
|
|
@@ -265,15 +264,6 @@ const Overlay = ({
|
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
266
|
}, [anchorRef]);
|
|
268
|
-
const afterSelect = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('item-select'), [onClose]);
|
|
269
|
-
const overlayContextValue = useMemo(() => ({
|
|
270
|
-
container: 'ActionMenu',
|
|
271
|
-
listRole: 'menu',
|
|
272
|
-
listLabelledBy: ariaLabelledby || anchorAriaLabelledby || anchorId,
|
|
273
|
-
selectionAttribute: 'aria-checked',
|
|
274
|
-
afterSelect,
|
|
275
|
-
enableFocusZone: isNarrowFullscreen
|
|
276
|
-
}), [ariaLabelledby, anchorAriaLabelledby, anchorId, afterSelect, isNarrowFullscreen]);
|
|
277
267
|
const featureFlagMaxHeightClampToViewport = useFeatureFlag('primer_react_overlay_max_height_clamp_to_viewport');
|
|
278
268
|
const isInsideDialog = useContext(DialogContext) !== undefined;
|
|
279
269
|
return /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
@@ -308,7 +298,16 @@ const Overlay = ({
|
|
|
308
298
|
[`data-max-height-${overlayProps.maxHeight}`]: ''
|
|
309
299
|
} : {}),
|
|
310
300
|
children: /*#__PURE__*/jsx(ActionListContainerContext.Provider, {
|
|
311
|
-
value:
|
|
301
|
+
value: {
|
|
302
|
+
container: 'ActionMenu',
|
|
303
|
+
listRole: 'menu',
|
|
304
|
+
// If there is a custom aria-labelledby, use that. Otherwise, if exists, use the id that labels the anchor such as tooltip. If none of them exist, use anchor id.
|
|
305
|
+
listLabelledBy: ariaLabelledby || anchorAriaLabelledby || anchorId,
|
|
306
|
+
selectionAttribute: 'aria-checked',
|
|
307
|
+
// Should this be here?
|
|
308
|
+
afterSelect: () => onClose === null || onClose === void 0 ? void 0 : onClose('item-select'),
|
|
309
|
+
enableFocusZone: isNarrowFullscreen // AnchoredOverlay takes care of focus zone. We only want to enable this if menu is narrow fullscreen.
|
|
310
|
+
},
|
|
312
311
|
children: children
|
|
313
312
|
})
|
|
314
313
|
})
|
package/package.json
CHANGED