diff --git a/packages/tablev2/TooltipHeaderCell.tsx b/packages/tablev2/TooltipHeaderCell.tsx index 473883e94..18d63cde6 100644 --- a/packages/tablev2/TooltipHeaderCell.tsx +++ b/packages/tablev2/TooltipHeaderCell.tsx @@ -1,10 +1,8 @@ import * as React from "react"; import * as style from "./style"; import { useId } from "react-id-generator"; -import { greyLightDarken2 } from "../design-tokens/build/js/designTokens"; import { Flex, FlexItem } from "../styleUtils/layout"; -import { Tooltip } from "../tooltip"; -import { Icon } from "../icon"; +import { Tooltip, TooltipIcon } from "../tooltip"; import { SystemIcons } from "../icons/dist/system-icons-enum"; import { textTruncate } from "../shared/styles/styleUtils"; import { css } from "@emotion/css"; @@ -18,11 +16,16 @@ export interface TooltipHeaderCellProps { * Helper content that explains the content in the column. */ tooltipContent?: React.ReactNode; + /** + * Icon to display for the tooltip. + */ + tooltipIcon?: SystemIcons.CircleInformation | SystemIcons.CircleQuestion; children?: React.ReactNode; } export const TooltipHeaderCell = ({ children, + tooltipIcon, tooltipContent }: TooltipHeaderCellProps) => { const [generatedId] = useId(1, "colTooltip"); @@ -34,11 +37,7 @@ export const TooltipHeaderCell = ({ id={`${generatedId}-tooltip`} trigger={
- +
} > diff --git a/packages/tablev2/__snapshots__/tablev2.test.tsx.snap b/packages/tablev2/__snapshots__/tablev2.test.tsx.snap index d2a09eed3..e216d01b6 100644 --- a/packages/tablev2/__snapshots__/tablev2.test.tsx.snap +++ b/packages/tablev2/__snapshots__/tablev2.test.tsx.snap @@ -86,7 +86,7 @@ exports[`Table v2 rendering renders default 1`] = ` > { + return ; +}; + +export default TooltipIcon; diff --git a/packages/tooltip/index.ts b/packages/tooltip/index.ts index 225c76293..d3815a7bc 100644 --- a/packages/tooltip/index.ts +++ b/packages/tooltip/index.ts @@ -1 +1,2 @@ export { default as Tooltip } from "./components/Tooltip"; +export { default as TooltipIcon } from "./components/TooltipIcon"; diff --git a/packages/tooltip/stories/Tooltip.stories.tsx b/packages/tooltip/stories/Tooltip.stories.tsx index 046618ede..72c512aef 100644 --- a/packages/tooltip/stories/Tooltip.stories.tsx +++ b/packages/tooltip/stories/Tooltip.stories.tsx @@ -11,6 +11,7 @@ import { directionsValues, directionsValuesLabels } from "../../storybookHelpers/controlConstants"; +import TooltipIcon from "../components/TooltipIcon"; const tooltipStoryDecorator = storyFn => (
@@ -29,18 +30,6 @@ export default { preferredDirections: { options: directionsValues, mapping: directionsValuesLabels - }, - className: { - control: { disable: true } - }, - trigger: { - control: { disable: true } - }, - ariaLabel: { - control: { disable: true } - }, - "data-cy": { - control: { disable: true } } } } as Meta; @@ -131,3 +120,8 @@ export const ContentWidth = { ) }; + +export const WithTooltipIcon = { + render: Template, + args: { trigger: } +};