diff --git a/.changeset/young-trees-move.md b/.changeset/young-trees-move.md new file mode 100644 index 00000000000..4594b3debb3 --- /dev/null +++ b/.changeset/young-trees-move.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Tooltip2: make the text prop required diff --git a/src/drafts/Tooltip/Tooltip.docs.json b/src/drafts/Tooltip/Tooltip.docs.json index d49cf420c97..b98d1415068 100644 --- a/src/drafts/Tooltip/Tooltip.docs.json +++ b/src/drafts/Tooltip/Tooltip.docs.json @@ -13,6 +13,7 @@ }, { "name": "text", + "required": true, "type": "string", "description": "The text to be displayed in the tooltip" }, diff --git a/src/drafts/Tooltip/Tooltip.playground.stories.tsx b/src/drafts/Tooltip/Tooltip.playground.stories.tsx index c0e303e55e4..5f13fcbba2e 100644 --- a/src/drafts/Tooltip/Tooltip.playground.stories.tsx +++ b/src/drafts/Tooltip/Tooltip.playground.stories.tsx @@ -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 ( - + diff --git a/src/drafts/Tooltip/Tooltip.tsx b/src/drafts/Tooltip/Tooltip.tsx index e586905c97c..417f8e03bab 100644 --- a/src/drafts/Tooltip/Tooltip.tsx +++ b/src/drafts/Tooltip/Tooltip.tsx @@ -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 diff --git a/src/drafts/Tooltip/__tests__/Tooltip.test.tsx b/src/drafts/Tooltip/__tests__/Tooltip.test.tsx index db0dbb67c77..e8fbea212f3 100644 --- a/src/drafts/Tooltip/__tests__/Tooltip.test.tsx +++ b/src/drafts/Tooltip/__tests__/Tooltip.test.tsx @@ -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 & {text?: string}) => (