Skip to content

Commit 16a5344

Browse files
committed
conflicts
2 parents f7fc4c6 + d122122 commit 16a5344

File tree

19 files changed

+133
-55
lines changed

19 files changed

+133
-55
lines changed

.changeset/pink-rockets-win.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Update Tooltip component to no longer support sx.

.changeset/tricky-boats-visit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Removes `sx` prop from VisuallyHidden component, and as a result also removes `sx` prop from CheckboxGroup.Label and RadioGroup.Label

packages/react/src/CheckboxGroup/CheckboxGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import FormControl from '../FormControl'
1010
import Checkbox from '../Checkbox/Checkbox'
1111
import {CheckboxGroupContext} from './CheckboxGroupContext'
1212

13-
type CheckboxGroupProps = {
13+
export type CheckboxGroupProps = {
1414
/**
1515
* An onChange handler that gets called when any of the checkboxes change
1616
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export {default, CheckboxGroupContext} from './CheckboxGroup'
1+
export {default, CheckboxGroupContext, type CheckboxGroupProps} from './CheckboxGroup'

packages/react/src/RadioGroup/RadioGroup.docs.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@
8484
"type": "boolean",
8585
"defaultValue": "false",
8686
"description": "If true, the fieldset legend will be visually hidden"
87-
},
88-
{
89-
"name": "sx",
90-
"type": "SystemStyleObject",
91-
"deprecated": true
9287
}
9388
]
9489
},
@@ -132,4 +127,4 @@
132127
]
133128
}
134129
]
135-
}
130+
}

packages/react/src/Tooltip/Tooltip.docs.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@
3131
"name": "wrap",
3232
"type": "boolean",
3333
"description": "Use `true` to allow text within tooltip to wrap."
34-
},
35-
{
36-
"name": "sx",
37-
"type": "SystemStyleObject",
38-
"deprecated": true
3934
}
4035
],
4136
"subcomponents": []
42-
}
37+
}

packages/react/src/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ import {clsx} from 'clsx'
22
import React, {useMemo} from 'react'
33
import styled from 'styled-components'
44
import {get} from '../constants'
5-
import type {SxProp} from '../sx'
6-
import sx from '../sx'
75
import type {ComponentProps} from '../utils/types'
86
import {useId} from '../hooks'
97

108
/* Tooltip v1 */
119

12-
const TooltipBase = styled.span<SxProp>`
10+
const TooltipBase = styled.span`
1311
position: relative;
1412
display: inline-block;
1513
@@ -182,8 +180,6 @@ const TooltipBase = styled.span<SxProp>`
182180
left: 0;
183181
margin-left: 0;
184182
}
185-
186-
${sx};
187183
`
188184

189185
/**

packages/react/src/TooltipV2/Tooltip.docs.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,7 @@
5757
"name": "keybindingHint",
5858
"type": "string",
5959
"description": "Optional keybinding hint to indicate the availability of a keyboard shortcut. Supported syntax is described in the docs for the `KeybindingHint` component."
60-
},
61-
{
62-
"name": "sx",
63-
"type": "SystemStyleObject",
64-
"deprecated": true
6560
}
6661
],
6762
"subcomponents": []
68-
}
63+
}

packages/react/src/TooltipV2/Tooltip.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {Children, useEffect, useRef, useState, useMemo} from 'react'
2-
import type {SxProp} from '../sx'
32
import {useId, useProvidedRefOrCreate, useOnEscapePress, useIsMacOS} from '../hooks'
43
import {invariant} from '../utils/invariant'
54
import {warning} from '../utils/warning'
@@ -11,17 +10,14 @@ import classes from './Tooltip.module.css'
1110
import {getAccessibleKeybindingHintString, KeybindingHint, type KeybindingHintProps} from '../KeybindingHint'
1211
import VisuallyHidden from '../_VisuallyHidden'
1312
import useSafeTimeout from '../hooks/useSafeTimeout'
14-
import {BoxWithFallback} from '../internal/components/BoxWithFallback'
1513

1614
export type TooltipDirection = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w'
17-
export type TooltipProps = React.PropsWithChildren<
18-
{
19-
direction?: TooltipDirection
20-
text: string
21-
type?: 'label' | 'description'
22-
keybindingHint?: KeybindingHintProps['keys']
23-
} & SxProp
24-
> &
15+
export type TooltipProps = React.PropsWithChildren<{
16+
direction?: TooltipDirection
17+
text: string
18+
type?: 'label' | 'description'
19+
keybindingHint?: KeybindingHintProps['keys']
20+
}> &
2521
React.HTMLAttributes<HTMLElement>
2622

2723
type TriggerPropsType = Pick<
@@ -298,8 +294,7 @@ export const Tooltip = React.forwardRef(
298294
child.props.onMouseLeave?.(event)
299295
},
300296
})}
301-
<BoxWithFallback
302-
as="span"
297+
<span
303298
className={clsx(className, classes.Tooltip)}
304299
ref={tooltipElRef}
305300
data-direction={calculatedDirection}
@@ -332,7 +327,7 @@ export const Tooltip = React.forwardRef(
332327
) : (
333328
text
334329
)}
335-
</BoxWithFallback>
330+
</span>
336331
</>
337332
</TooltipContext.Provider>
338333
)

packages/react/src/_VisuallyHidden.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
import classes from './_VisuallyHidden.module.css'
22
import {clsx} from 'clsx'
3-
import {BoxWithFallback} from './internal/components/BoxWithFallback'
4-
import type {SxProp} from './sx'
3+
import type {PolymorphicProps} from './utils/modern-polymorphic'
4+
import type {ElementType} from 'react'
55

6-
interface Props extends React.ComponentPropsWithoutRef<'span'> {
7-
isVisible?: boolean
8-
as?: React.ElementType
9-
}
6+
type VisuallyHiddenProps<As extends ElementType = 'span'> = PolymorphicProps<
7+
As,
8+
'span',
9+
{
10+
isVisible?: boolean
11+
}
12+
>
1013

11-
function VisuallyHidden({isVisible, children, as = 'span', className, ...rest}: Props & SxProp) {
14+
function VisuallyHidden<As extends ElementType = 'span'>({
15+
isVisible,
16+
children,
17+
as,
18+
className,
19+
...rest
20+
}: VisuallyHiddenProps<As>) {
21+
const Component = as || 'span'
1222
return (
13-
<BoxWithFallback as={as} className={clsx(className, {[classes.InternalVisuallyHidden]: !isVisible})} {...rest}>
23+
<Component className={clsx(className, {[classes.InternalVisuallyHidden]: !isVisible})} {...rest}>
1424
{children}
15-
</BoxWithFallback>
25+
</Component>
1626
)
1727
}
1828

0 commit comments

Comments
 (0)