Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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/strange-knives-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Update Details component to no longer support sx
4 changes: 0 additions & 4 deletions e2e/components/Details.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ const stories: Array<{title: string; id: string}> = [
title: 'Default',
id: 'components-details--default',
},
{
title: 'SX Prop Stress Test',
id: 'components-details-dev--sx-prop-stress-test',
},
]

test.describe('Details', () => {
Expand Down
26 changes: 0 additions & 26 deletions packages/react/src/Details/Details.dev.stories.tsx

This file was deleted.

13 changes: 1 addition & 12 deletions packages/react/src/Details/Details.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@
}
],
"importPath": "@primer/react",
"props": [
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
],
"props": [],
Comment thread
francinelucca marked this conversation as resolved.
"subcomponents": [
{
"name": "Details.Summary",
Expand All @@ -30,11 +24,6 @@
{
"name": "children",
"type": "React.ReactNode"
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
]
}
Expand Down
8 changes: 3 additions & 5 deletions packages/react/src/Details/Details.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, {useEffect, useState, type ComponentPropsWithoutRef, type ReactElement} from 'react'
import type {SxProp} from '../sx'
import {clsx} from 'clsx'
import classes from './Details.module.css'
import {useMergedRefs} from '../internal/hooks/useMergedRefs'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

const Root = React.forwardRef<HTMLDetailsElement, DetailsProps>(
({className, children, ...rest}, forwardRef): ReactElement => {
Expand Down Expand Up @@ -40,11 +38,11 @@ const Root = React.forwardRef<HTMLDetailsElement, DetailsProps>(
}, [])

return (
<BoxWithFallback as="details" className={clsx(className, classes.Details)} {...rest} ref={ref}>
<details className={clsx(className, classes.Details)} {...rest} ref={ref}>
{/* Include default summary if summary is not provided */}
{!hasSummary && <Details.Summary data-default-summary>{'See Details'}</Details.Summary>}
{children}
</BoxWithFallback>
</details>
)
},
)
Expand Down Expand Up @@ -75,5 +73,5 @@ const Details = Object.assign(Root, {
Summary,
})

export type DetailsProps = ComponentPropsWithoutRef<'details'> & SxProp
export type DetailsProps = ComponentPropsWithoutRef<'details'>
export default Details
Loading