Skip to content
Open
Show file tree
Hide file tree
Changes from all 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/pink-rockets-win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Update Tooltip component to no longer support sx.
7 changes: 1 addition & 6 deletions packages/react/src/Tooltip/Tooltip.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@
"name": "wrap",
"type": "boolean",
"description": "Use `true` to allow text within tooltip to wrap."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
],
"subcomponents": []
}
}
6 changes: 1 addition & 5 deletions packages/react/src/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import {clsx} from 'clsx'
import React, {useMemo} from 'react'
import styled from 'styled-components'
import {get} from '../constants'
import type {SxProp} from '../sx'
import sx from '../sx'
import type {ComponentProps} from '../utils/types'
import {useId} from '../hooks'

/* Tooltip v1 */

const TooltipBase = styled.span<SxProp>`
const TooltipBase = styled.span`
position: relative;
display: inline-block;

Expand Down Expand Up @@ -182,8 +180,6 @@ const TooltipBase = styled.span<SxProp>`
left: 0;
margin-left: 0;
}

${sx};
`

/**
Expand Down
7 changes: 1 addition & 6 deletions packages/react/src/TooltipV2/Tooltip.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@
"name": "keybindingHint",
"type": "string",
"description": "Optional keybinding hint to indicate the availability of a keyboard shortcut. Supported syntax is described in the docs for the `KeybindingHint` component."
},
{
"name": "sx",
"type": "SystemStyleObject",
"deprecated": true
}
],
"subcomponents": []
}
}
21 changes: 8 additions & 13 deletions packages/react/src/TooltipV2/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {Children, useEffect, useRef, useState, useMemo} from 'react'
import type {SxProp} from '../sx'
import {useId, useProvidedRefOrCreate, useOnEscapePress, useIsMacOS} from '../hooks'
import {invariant} from '../utils/invariant'
import {warning} from '../utils/warning'
Expand All @@ -11,17 +10,14 @@ import classes from './Tooltip.module.css'
import {getAccessibleKeybindingHintString, KeybindingHint, type KeybindingHintProps} from '../KeybindingHint'
import VisuallyHidden from '../_VisuallyHidden'
import useSafeTimeout from '../hooks/useSafeTimeout'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

export type TooltipDirection = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w'
export type TooltipProps = React.PropsWithChildren<
{
direction?: TooltipDirection
text: string
type?: 'label' | 'description'
keybindingHint?: KeybindingHintProps['keys']
} & SxProp
> &
export type TooltipProps = React.PropsWithChildren<{
direction?: TooltipDirection
text: string
type?: 'label' | 'description'
keybindingHint?: KeybindingHintProps['keys']
}> &
React.HTMLAttributes<HTMLElement>

type TriggerPropsType = Pick<
Expand Down Expand Up @@ -298,8 +294,7 @@ export const Tooltip = React.forwardRef(
child.props.onMouseLeave?.(event)
},
})}
<BoxWithFallback
as="span"
<span
className={clsx(className, classes.Tooltip)}
ref={tooltipElRef}
data-direction={calculatedDirection}
Expand Down Expand Up @@ -332,7 +327,7 @@ export const Tooltip = React.forwardRef(
) : (
text
)}
</BoxWithFallback>
</span>
</>
</TooltipContext.Provider>
)
Expand Down
Loading