@@ -18,11 +18,19 @@ type PrimerActionListTrailingActionProps = React.ComponentProps<typeof PrimerAct
1818
1919export type ActionListProps < As extends React . ElementType = 'ul' > = PrimerActionListProps < As > & SxProp
2020export type ActionListItemProps = React . PropsWithChildren < PrimerActionListItemProps & SxProp >
21- export type ActionListLinkItemProps = React . PropsWithChildren < PrimerActionListLinkItemProps & SxProp >
22- export type ActionListGroupProps = React . PropsWithChildren < PrimerActionListGroupProps & SxProp >
21+ export type ActionListLinkItemProps = React . PropsWithChildren < PrimerActionListLinkItemProps & SxProp > & {
22+ as ?: React . ElementType
23+ }
24+ export type ActionListGroupProps = React . PropsWithChildren < PrimerActionListGroupProps & SxProp > & {
25+ as ?: React . ElementType
26+ }
2327export type ActionListDividerProps = React . PropsWithChildren < PrimerActionListDividerProps & SxProp >
24- export type ActionListLeadingVisualProps = React . PropsWithChildren < PrimerActionListLeadingVisualProps & SxProp >
25- export type ActionListTrailingVisualProps = React . PropsWithChildren < PrimerActionListTrailingVisualProps & SxProp >
28+ export type ActionListLeadingVisualProps = React . PropsWithChildren < PrimerActionListLeadingVisualProps & SxProp > & {
29+ as ?: React . ElementType
30+ }
31+ export type ActionListTrailingVisualProps = React . PropsWithChildren < PrimerActionListTrailingVisualProps & SxProp > & {
32+ as ?: React . ElementType
33+ }
2634export type ActionListTrailingActionProps = React . PropsWithChildren < PrimerActionListTrailingActionProps & SxProp >
2735
2836const StyledActionList = styled ( PrimerActionList ) . withConfig ( {
@@ -40,14 +48,23 @@ const ActionListImpl = React.forwardRef(function ActionListImpl<As extends React
4048 return < StyledActionList ref = { ref } { ...rest } { ...( as ? { forwardedAs : as } : { } ) } />
4149} )
4250
43- const ActionListLinkItem : ForwardRefComponent < 'a' , ActionListLinkItemProps > & SlotMarker = styled (
51+ const StyledActionListLinkItem : ForwardRefComponent < 'a' , ActionListLinkItemProps > & SlotMarker = styled (
4452 PrimerActionList . LinkItem ,
4553) . withConfig < ActionListLinkItemProps > ( {
4654 shouldForwardProp : prop => prop !== 'sx' ,
4755} ) `
4856 ${ sx }
4957`
5058
59+ const ActionListLinkItem = React . forwardRef < HTMLAnchorElement , ActionListLinkItemProps > (
60+ ( { children, as, ...props } , ref ) => (
61+ < StyledActionListLinkItem ref = { ref } { ...props } { ...( as ? { forwardedAs : as } : { } ) } >
62+ { children }
63+ </ StyledActionListLinkItem >
64+ ) ,
65+ ) as ForwardRefComponent < 'a' , ActionListLinkItemProps > & SlotMarker
66+ ActionListLinkItem . displayName = 'ActionList.LinkItem'
67+
5168type TrailingActionElements = 'button' | 'a'
5269const StyledActionListTrailingAction = styled ( PrimerActionList . TrailingAction ) . withConfig ( {
5370 shouldForwardProp : ( prop : keyof ActionListTrailingActionProps ) => prop !== 'sx' ,
@@ -82,14 +99,21 @@ const ActionListItem = React.forwardRef<HTMLLIElement, ActionListItemProps>(({ch
8299 </ StyledActionListItem >
83100) ) as ForwardRefComponent < 'li' , ActionListItemProps > & SlotMarker
84101
85- const ActionListGroup : React . ComponentType < ActionListGroupProps > & SlotMarker = styled (
102+ const StyledActionListGroup : React . ComponentType < ActionListGroupProps > & SlotMarker = styled (
86103 PrimerActionList . Group ,
87104) . withConfig < ActionListGroupProps > ( {
88105 shouldForwardProp : prop => prop !== 'sx' ,
89106} ) `
90107 ${ sx }
91108`
92109
110+ const ActionListGroup : React . ComponentType < ActionListGroupProps > & SlotMarker = ( { children, as, ...props } ) => (
111+ < StyledActionListGroup { ...props } { ...( as ? { forwardedAs : as } : { } ) } >
112+ { children }
113+ </ StyledActionListGroup >
114+ )
115+ ActionListGroup . displayName = 'ActionList.Group'
116+
93117const ActionListDivider : React . ComponentType < ActionListDividerProps > & SlotMarker = styled (
94118 PrimerActionList . Divider ,
95119) . withConfig < ActionListDividerProps > ( {
@@ -98,22 +122,44 @@ const ActionListDivider: React.ComponentType<ActionListDividerProps> & SlotMarke
98122 ${ sx }
99123`
100124
101- const ActionListLeadingVisual : React . ComponentType < ActionListLeadingVisualProps > & SlotMarker = styled (
125+ const StyledActionListLeadingVisual : React . ComponentType < ActionListLeadingVisualProps > & SlotMarker = styled (
102126 PrimerActionList . LeadingVisual ,
103127) . withConfig < ActionListLeadingVisualProps > ( {
104128 shouldForwardProp : prop => prop !== 'sx' ,
105129} ) `
106130 ${ sx }
107131`
108132
109- const ActionListTrailingVisual : React . ComponentType < ActionListTrailingVisualProps > & SlotMarker = styled (
133+ const ActionListLeadingVisual : React . ComponentType < ActionListLeadingVisualProps > & SlotMarker = ( {
134+ children,
135+ as,
136+ ...props
137+ } ) => (
138+ < StyledActionListLeadingVisual { ...props } { ...( as ? { forwardedAs : as } : { } ) } >
139+ { children }
140+ </ StyledActionListLeadingVisual >
141+ )
142+ ActionListLeadingVisual . displayName = 'ActionList.LeadingVisual'
143+
144+ const StyledActionListTrailingVisual : React . ComponentType < ActionListTrailingVisualProps > & SlotMarker = styled (
110145 PrimerActionList . TrailingVisual ,
111146) . withConfig < ActionListTrailingVisualProps > ( {
112147 shouldForwardProp : prop => prop !== 'sx' ,
113148} ) `
114149 ${ sx }
115150`
116151
152+ const ActionListTrailingVisual : React . ComponentType < ActionListTrailingVisualProps > & SlotMarker = ( {
153+ children,
154+ as,
155+ ...props
156+ } ) => (
157+ < StyledActionListTrailingVisual { ...props } { ...( as ? { forwardedAs : as } : { } ) } >
158+ { children }
159+ </ StyledActionListTrailingVisual >
160+ )
161+ ActionListTrailingVisual . displayName = 'ActionList.TrailingVisual'
162+
117163export const ActionList : typeof ActionListImpl & {
118164 Item : typeof ActionListItem
119165 LinkItem : typeof ActionListLinkItem
0 commit comments