Skip to content
Merged
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/young-trees-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Tooltip2: make the text prop required
1 change: 1 addition & 0 deletions src/drafts/Tooltip/Tooltip.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
{
"name": "text",
"required": true,
"type": "string",
"description": "The text to be displayed in the tooltip"
},
Expand Down
4 changes: 2 additions & 2 deletions src/drafts/Tooltip/Tooltip.playground.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default {
export const Playground: StoryFn = args => {
// this is a hack to remove the `type` prop from the args because for this example type label is not a valid choice and violates accessibility
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const {type, ...rest} = args
const {text, type, ...rest} = args
return (
<Box sx={{p: 6}}>
<Tooltip type="description" {...rest}>
<Tooltip text={text} type="description" {...rest}>
<Button>Delete</Button>
</Tooltip>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/drafts/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type TooltipDirection = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w'
export type TooltipProps = React.PropsWithChildren<
{
direction?: TooltipDirection
text?: string
text: string
type?: 'label' | 'description'
} & SxProp &
ComponentProps<typeof StyledTooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/drafts/Tooltip/__tests__/Tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {render as HTMLRender} from '@testing-library/react'
import theme from '../../../theme'
import {Button, ActionMenu, ActionList, ThemeProvider, SSRProvider, BaseStyles} from '../../../'

const TooltipComponent = (props: TooltipProps) => (
const TooltipComponent = (props: Omit<TooltipProps, 'text'> & {text?: string}) => (
<Tooltip text="Tooltip text" {...props}>
<Button>Button Text</Button>
</Tooltip>
Expand Down