Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
de9df1e
remove sx from docs
llastflowers Sep 23, 2025
91be929
remove sx from ActionList/Divider
llastflowers Sep 23, 2025
ad5b233
remove sx from ActionList/Description
llastflowers Sep 23, 2025
d852c40
remove sx from ActionList/Group
llastflowers Sep 23, 2025
bc4c9f5
remove sx from ActionList/Heading
llastflowers Sep 23, 2025
4ded00e
re-remove sx and BoxWithFallback from ActionList/Item.tsx
llastflowers Sep 29, 2025
06f10ff
re-remove sx and BoxWithFallback from ActionList/List.tsx
llastflowers Sep 29, 2025
9f09248
re-remove sx and BoxWithFallback from ActionList/LinkItem.tsx
llastflowers Sep 29, 2025
6d21526
Change ActionList component to major version
llastflowers Sep 29, 2025
f46759a
remove BWF from ActionList/Description.tsx
llastflowers Sep 29, 2025
efeb724
remove BWF from ActionList/Divider.tsx
llastflowers Sep 29, 2025
595242e
remove sx from ActionList/shared.tsx
llastflowers Sep 29, 2025
c47a12d
remove sx and BWF from ActionList/Visuals.tsx
llastflowers Sep 29, 2025
3448623
update ActionList exports
llastflowers Sep 29, 2025
5aa7f17
remove ActionList-related sx usage that remained in UnderlineNav
llastflowers Sep 30, 2025
b54e0c5
fix incomplete imports for NavList
llastflowers Sep 30, 2025
4a3a9c8
fix grouped exports
llastflowers Sep 30, 2025
95e4c69
update ActionList/TrailingAction.tsx to replace polymorphicForwardRef
llastflowers Sep 30, 2025
afc959b
remove unused directives
llastflowers Sep 30, 2025
caac269
lint fix
llastflowers Sep 30, 2025
2e979e1
update ActionList/Header.tsx to replace PolymorphicForwardRef
llastflowers Sep 30, 2025
686f83c
update exports for polymorphic subcomponents
llastflowers Sep 30, 2025
7e2cf33
some ts check fixes
llastflowers Sep 30, 2025
eded99e
remove sx remaining in a story that uses ActionList
llastflowers Sep 30, 2025
3604734
sx removal from stories that were using ActionList
llastflowers Sep 30, 2025
514ae96
more ts error fixes
llastflowers Sep 30, 2025
6dd2dbd
re-add accidentally deleted comment
llastflowers Sep 30, 2025
b504c1f
update exports again
llastflowers Oct 1, 2025
4028845
revert some changes to test
llastflowers Oct 1, 2025
bb22fd7
fix type issue
llastflowers Oct 1, 2025
84ea8f8
rm sx from Heading.tsx and update styled-react stuff
llastflowers Oct 1, 2025
fdcf623
update styled-react stuff again
llastflowers Oct 1, 2025
72ef673
fix NavList to finish migration that ActionList relies on
llastflowers Oct 1, 2025
4a164bb
remove unused import
llastflowers Oct 1, 2025
c98ad56
update to fix failing test
llastflowers Oct 1, 2025
8159c02
export prop types
francinelucca Oct 2, 2025
cd6264f
fix types
francinelucca Oct 2, 2025
dc36d94
add test for item and fix sx not being passed issue
liuliu-dev Oct 2, 2025
477ed5f
fix description
liuliu-dev Oct 2, 2025
692c064
StyledActionListItem?
liuliu-dev Oct 2, 2025
6d19879
description, heading and groupheading
liuliu-dev Oct 2, 2025
ca3373d
fix export
liuliu-dev Oct 2, 2025
4643092
feedbacks
liuliu-dev Oct 3, 2025
2a99310
type fix
liuliu-dev Oct 3, 2025
ce96234
fix ref type
liuliu-dev Oct 3, 2025
e89b837
fff
liuliu-dev Oct 3, 2025
308920d
remove sx prop from ActionList and style fixes
francinelucca Oct 6, 2025
002e192
Merge branch 'llastflowers/6757/rm-sx-ActionList2' of github.com:prim…
francinelucca Oct 6, 2025
2628f94
remove unneeded styles
francinelucca Oct 6, 2025
9bc76ef
lint fix
francinelucca Oct 6, 2025
bdaf93c
support style in ItemInput (replacement for sx)
francinelucca Oct 6, 2025
c173eda
support className instead of style for ItemInput
francinelucca Oct 6, 2025
8e30feb
Merge branch 'main' of github.com:primer/react into llastflowers/6757…
francinelucca Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-cameras-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Update ActionList component and related components to no longer support sx/styled-components
56 changes: 0 additions & 56 deletions packages/react/src/ActionList/ActionList.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
"type": "AriaRole",
"defaultValue": "",
"description": "ARIA role describing the function of the list. `listbox` and `menu` are a common values."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
],
"subcomponents": [
Expand Down Expand Up @@ -113,11 +108,6 @@
"required": false,
"description": "id to attach to the root element of the Item",
"defaultValue": ""
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
Expand All @@ -144,11 +134,6 @@
"required": false,
"description": "",
"defaultValue": ""
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
Expand Down Expand Up @@ -183,11 +168,6 @@
"required": false,
"description": "Text describing why the item is inactive. This may be used when an item's usual functionality\nis unavailable due to a system error such as a database outage.",
"defaultValue": ""
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
],
"passthrough": {
Expand All @@ -204,11 +184,6 @@
"defaultValue": "",
"required": true,
"description": "Icon (or similar) positioned before item text."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
Expand All @@ -221,11 +196,6 @@
"defaultValue": "",
"required": true,
"description": "Visual positioned after item text."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
Expand Down Expand Up @@ -282,11 +252,6 @@
"defaultValue": "'inline'",
"description": "`inline` descriptions are positioned beside primary text. `block` descriptions are positioned below primary text."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
},
{
"name": "className",
"type": "string | undefined",
Expand Down Expand Up @@ -337,11 +302,6 @@
"defaultValue": "h3",
"required": false,
"description": "The level of the heading and it is only required (enforce by runtime warning) for lists. (i.e. not required for ActionMenu or listbox roles)"
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
Expand Down Expand Up @@ -385,22 +345,6 @@
"type": "AriaRole",
"defaultValue": "",
"description": "ARIA role describing the function of the list inside the group. `listbox` and `menu` are a common values."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
},
{
"filePath": "/Users/mperrotti/work-dir/react/packages/react/src/ActionList/Divider.tsx",
"name": "ActionList.Divider",
"props": [
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
}
Expand Down
15 changes: 7 additions & 8 deletions packages/react/src/ActionList/Description.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import Truncate from '../Truncate'
import type {SxProp} from '../sx'
import {ItemContext} from './shared'
import classes from './ActionList.module.css'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'
import {clsx} from 'clsx'

export type ActionListDescriptionProps = {
Expand All @@ -16,17 +14,18 @@ export type ActionListDescriptionProps = {
variant?: 'inline' | 'block'

className?: string
style?: React.CSSProperties
/**
* Whether the inline description should truncate the text on overflow.
*/
truncate?: boolean
} & SxProp
}

export const Description: React.FC<React.PropsWithChildren<ActionListDescriptionProps>> = ({
variant = 'inline',
sx,
className,
truncate,
style,
...props
}) => {
const {blockDescriptionId, inlineDescriptionId} = React.useContext(ItemContext)
Expand All @@ -45,22 +44,22 @@ export const Description: React.FC<React.PropsWithChildren<ActionListDescription

if (variant === 'block' || !truncate) {
return (
<BoxWithFallback
as="span"
sx={sx}
<span
id={variant === 'block' ? blockDescriptionId : inlineDescriptionId}
className={clsx(className, classes.Description)}
style={style}
data-component="ActionList.Description"
>
{props.children}
</BoxWithFallback>
</span>
)
} else {
return (
<Truncate
ref={containerRef}
id={inlineDescriptionId}
className={clsx(className, classes.Description)}
style={style}
title={effectiveTitle}
inline={true}
maxWidth="100%"
Expand Down
14 changes: 6 additions & 8 deletions packages/react/src/ActionList/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import type React from 'react'
import type {SxProp} from '../sx'
import {clsx} from 'clsx'
import classes from './ActionList.module.css'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

export type ActionListDividerProps = SxProp & {
export type ActionListDividerProps = {
className?: string
style?: React.CSSProperties
}

/**
* Visually separates `Item`s or `Group`s in an `ActionList`.
* Visually separates `Items` or `Groups` in an `ActionList`.
*/
export const Divider: React.FC<React.PropsWithChildren<ActionListDividerProps>> = ({sx, className}) => {
export const Divider: React.FC<React.PropsWithChildren<ActionListDividerProps>> = ({className, style}) => {
return (
<BoxWithFallback
<li
className={clsx(className, classes.Divider)}
as="li"
style={style}
aria-hidden="true"
sx={sx}
data-component="ActionList.Divider"
/>
)
Expand Down
32 changes: 10 additions & 22 deletions packages/react/src/ActionList/Group.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import React from 'react'
import {useId} from '../hooks/useId'
import type {SxProp} from '../sx'
import {ListContext, type ActionListProps} from './shared'
import type {ActionListHeadingProps} from './Heading'
import {useSlots} from '../hooks/useSlots'
import {invariant} from '../utils/invariant'
import {clsx} from 'clsx'
import classes from './ActionList.module.css'
import groupClasses from './Group.module.css'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

type HeadingProps = {
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
className?: string
children: React.ReactNode
id?: string
} & SxProp
}

const Heading: React.FC<HeadingProps & React.HTMLAttributes<HTMLHeadingElement>> = ({
as: Component = 'h3',
Expand All @@ -25,10 +23,9 @@ const Heading: React.FC<HeadingProps & React.HTMLAttributes<HTMLHeadingElement>>
...rest
}) => {
return (
// Box is temporary to support lingering sx usage
<BoxWithFallback as={Component} className={className} id={id} {...rest}>
<Component className={className} id={id} {...rest}>
{children}
</BoxWithFallback>
</Component>
)
}

Expand Down Expand Up @@ -58,12 +55,11 @@ export type ActionListGroupProps = React.HTMLAttributes<HTMLLIElement> & {
* Secondary text which provides additional information about a `Group`.
*/
auxiliaryText?: string
} & SxProp & {
/**
* Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
*/
selectionVariant?: ActionListProps['selectionVariant'] | false
}
/**
* Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
*/
selectionVariant?: ActionListProps['selectionVariant'] | false
}

type ContextProps = Pick<ActionListGroupProps, 'selectionVariant'> & {groupHeadingId: string | undefined}
export const GroupContext = React.createContext<ContextProps>({
Expand Down Expand Up @@ -101,12 +97,7 @@ export const Group: React.FC<React.PropsWithChildren<ActionListGroupProps>> = ({
}

return (
<BoxWithFallback
as="li"
className={clsx(className, groupClasses.Group)}
role={listRole ? 'none' : undefined}
{...props}
>
<li className={clsx(className, groupClasses.Group)} role={listRole ? 'none' : undefined} {...props}>
<GroupContext.Provider value={{selectionVariant, groupHeadingId}}>
{title && !slots.groupHeading ? (
// Escape hatch: supports old API <ActionList.Group title="group title"> in a non breaking way
Expand All @@ -126,13 +117,12 @@ export const Group: React.FC<React.PropsWithChildren<ActionListGroupProps>> = ({
{slots.groupHeading ? childrenWithoutSlots : props.children}
</ul>
</GroupContext.Provider>
</BoxWithFallback>
</li>
)
}

export type ActionListGroupHeadingProps = Pick<ActionListGroupProps, 'variant' | 'auxiliaryText'> &
Omit<ActionListHeadingProps, 'as'> &
SxProp &
React.HTMLAttributes<HTMLElement> & {
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
headingWrapElement?: 'div' | 'li'
Expand All @@ -156,7 +146,6 @@ export const GroupHeading: React.FC<React.PropsWithChildren<ActionListGroupHeadi
auxiliaryText,
children,
className,
sx,
headingWrapElement = 'div',
...props
}) => {
Expand Down Expand Up @@ -208,7 +197,6 @@ export const GroupHeading: React.FC<React.PropsWithChildren<ActionListGroupHeadi
className={clsx(className, groupClasses.GroupHeading)}
as={as || 'h3'}
id={groupHeadingId}
sx={sx}
{...props}
>
{_internalBackwardCompatibleTitle ?? children}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/ActionList/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {forwardRef} from 'react'
import type {SxProp} from '../sx'
import {useRefObjectAsForwardedRef} from '../hooks'
import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'
import {default as HeadingComponent} from '../Heading'
Expand All @@ -17,7 +16,8 @@ export type ActionListHeadingProps = {
size?: HeadingVariants
visuallyHidden?: boolean
className?: string
} & SxProp
style?: React.CSSProperties
}

export const Heading = forwardRef(({as, size, children, visuallyHidden = false, className, ...props}, forwardedRef) => {
const innerRef = React.useRef<HTMLHeadingElement>(null)
Expand Down
8 changes: 2 additions & 6 deletions packages/react/src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {invariant} from '../utils/invariant'
import VisuallyHidden from '../_VisuallyHidden'
import classes from './ActionList.module.css'
import {clsx} from 'clsx'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'
import {fixedForwardRef} from '../utils/modern-polymorphic'

type ActionListSubItemProps = {
Expand Down Expand Up @@ -57,7 +56,6 @@ const UnwrappedItem = <As extends React.ElementType = 'li'>(
selected = undefined,
active = false,
onSelect: onSelectUser,
sx: sxProp,
id,
role,
loading,
Expand Down Expand Up @@ -246,10 +244,8 @@ const UnwrappedItem = <As extends React.ElementType = 'li'>(
trailingVisualId,
}}
>
<BoxWithFallback
<li
{...containerProps}
as="li"
sx={sxProp}
ref={listSemantics ? forwardedRef : null}
data-variant={variant === 'danger' ? variant : undefined}
data-active={active ? true : undefined}
Expand Down Expand Up @@ -313,7 +309,7 @@ const UnwrappedItem = <As extends React.ElementType = 'li'>(
</ItemWrapper>
{!inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction}
{slots.subItem}
</BoxWithFallback>
</li>
</ItemContext.Provider>
)
}
Expand Down
5 changes: 2 additions & 3 deletions packages/react/src/ActionList/LinkItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ type LinkProps = {
// LinkItem does not support selected, loading, variants, etc.
export type ActionListLinkItemProps = Pick<
ActionListItemProps,
'active' | 'children' | 'sx' | 'inactiveText' | 'variant' | 'size'
'active' | 'children' | 'inactiveText' | 'variant' | 'size'
> &
LinkProps

export const LinkItem = React.forwardRef(
({sx, active, inactiveText, variant, size, as: Component, className, ...props}, forwardedRef) => {
({active, inactiveText, variant, size, as: Component, className, ...props}, forwardedRef) => {
return (
<Item
className={className}
Expand All @@ -35,7 +35,6 @@ export const LinkItem = React.forwardRef(
data-inactive={inactiveText ? true : undefined}
variant={variant}
size={size}
sx={sx}
_PrivateItemWrapper={({children, onClick, ...rest}) => {
const clickHandler = (event: React.MouseEvent<HTMLElement>) => {
onClick && onClick(event)
Expand Down
Loading
Loading