From 0c2ca6e339f635cd4974cb0af916927c6a1b6e91 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Thu, 24 Feb 2022 13:55:54 +0100 Subject: [PATCH] Prefix component with types exported from ActionList2 and ActionMenu2 (#1883) * prefix component name to types * add changeset * Update .changeset/actionlist2-actionmenu2-prefix-types.md Co-authored-by: Cole Bemis Co-authored-by: Cole Bemis --- .../actionlist2-actionmenu2-prefix-types.md | 21 +++++++++++++++++++ src/ActionList2/index.ts | 11 ++++++---- src/ActionMenu2.tsx | 6 +++--- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 .changeset/actionlist2-actionmenu2-prefix-types.md diff --git a/.changeset/actionlist2-actionmenu2-prefix-types.md b/.changeset/actionlist2-actionmenu2-prefix-types.md new file mode 100644 index 00000000000..b7d4cd11224 --- /dev/null +++ b/.changeset/actionlist2-actionmenu2-prefix-types.md @@ -0,0 +1,21 @@ +--- +'@primer/react': major +--- + +`ActionList2` exported types are now prefixed with `ActionList`: + +``` +ListProps → ActionListProps +GroupProps → ActionListGroupProps +ItemProps → ActionListItemProps +DescriptionProps → ActionListDescriptionProps +LeadingVisualProps → ActionListLeadingVisualProps, +TrailingVisualProps → ActionListTrailingVisualProps +``` + +`ActionMenu2` exported types are now prefixed with `ActionMenu`: + +``` +MenuButtonProps → ActionMenuButtonProps +MenuAnchorProps → ActionMenuAnchorProps +``` diff --git a/src/ActionList2/index.ts b/src/ActionList2/index.ts index d05da47652f..f27a3b53d50 100644 --- a/src/ActionList2/index.ts +++ b/src/ActionList2/index.ts @@ -7,10 +7,13 @@ import {Description} from './Description' import {LeadingVisual, TrailingVisual} from './Visuals' export type {ListProps as ActionListProps} from './List' -export type {GroupProps} from './Group' -export type {ItemProps} from './Item' -export type {DescriptionProps} from './Description' -export type {LeadingVisualProps, TrailingVisualProps} from './Visuals' +export type {GroupProps as ActionListGroupProps} from './Group' +export type {ItemProps as ActionListItemProps} from './Item' +export type {DescriptionProps as ActionListDescriptionProps} from './Description' +export type { + LeadingVisualProps as ActionListLeadingVisualProps, + TrailingVisualProps as ActionListTrailingVisualProps +} from './Visuals' /** * Collection of list-related components. diff --git a/src/ActionMenu2.tsx b/src/ActionMenu2.tsx index 1fab1223264..97622d2a101 100644 --- a/src/ActionMenu2.tsx +++ b/src/ActionMenu2.tsx @@ -64,15 +64,15 @@ const Menu: React.FC = ({ ) } -export type MenuAnchorProps = {children: React.ReactElement} -const Anchor = React.forwardRef( +export type ActionMenuAnchorProps = {children: React.ReactElement} +const Anchor = React.forwardRef( ({children, ...anchorProps}, anchorRef) => { return React.cloneElement(children, {...anchorProps, ref: anchorRef}) } ) /** this component is syntactical sugar 🍭 */ -export type MenuButtonProps = ButtonProps +export type ActionMenuButtonProps = ButtonProps const MenuButton = React.forwardRef((props, anchorRef) => { return (