Skip to content

Commit

Permalink
chore(tooltip)!: rename childDisabled to childNotInteractive
Browse files Browse the repository at this point in the history
  • Loading branch information
dierat committed Sep 6, 2022
1 parent 8da8dbd commit 393b640
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/components/Tooltip/Tooltip.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
}

/**
* 1) When childDisabled is true and alignment is top or bottom
* 1) When childNotInteractive is true and alignment is top or bottom
*/
.tooltip__child-disabled-wrapper--vertical {
.tooltip__child-not-interactive-wrapper--vertical {
/* Needed for the top and bottom alignment to work properly */
display: inline-flex;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Tooltip/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const Disabled: StoryObj<Args> = {
>
<Tooltip
align="top"
childDisabled={true}
childNotInteractive={true}
text={defaultArgs.text}
visible={true}
>
Expand Down Expand Up @@ -189,7 +189,7 @@ export const InteractiveDisabled: StoryObj<Args> = {
>
<Tooltip
align="top"
childDisabled={true}
childNotInteractive={true}
duration={args.duration}
text={defaultArgs.text}
>
Expand Down
12 changes: 6 additions & 6 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ type TooltipProps = {
*/
children?: React.ReactElement;
/**
* If the child being passed into the Tooltip via the `children` prop is disabled (e.g. a disabled button).
* If the child being passed into the Tooltip via the `children` prop is not interactive (e.g. a disabled button or an icon).
*
* Please note that spacing and placement styling will need to be added to a wrapper around the Tooltip,
* not on the button child inside the Tooltip, because there will be a wrapper around the button child. Example:
* not on the child component inside the Tooltip, because there will be a wrapper around the child. Example:
* <div className="spacing-goes-here"><Tooltip text="Tooltip text"><Button disabled>Button text</Button></Tooltip></div>
*/
childDisabled?: boolean;
childNotInteractive?: boolean;
/**
* Custom classname for additional styles.
*
Expand Down Expand Up @@ -104,7 +104,7 @@ type Plugin = Plugins[number];
export const Tooltip = ({
variant = 'light',
align = 'top',
childDisabled,
childNotInteractive,
className,
duration = 200,
text,
Expand Down Expand Up @@ -141,12 +141,12 @@ export const Tooltip = ({
let children = rest.children;
// Tippy only works on elements with a tabindex. If the child is disabled, we need to
// wrap it in an element with a tabindex in order for it to work.
if (childDisabled) {
if (childNotInteractive) {
children = (
<span
className={clsx(
(align === 'bottom' || align === 'top') &&
styles['tooltip__child-disabled-wrapper--vertical'],
styles['tooltip__child-not-interactive-wrapper--vertical'],
)}
data-testid="disabled-child-tooltip-wrapper"
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
Expand Down
4 changes: 2 additions & 2 deletions src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ exports[`<Tooltip /> Disabled story renders snapshot 1`] = `
>
<span
aria-describedby="tippy-8"
class="tooltip__child-disabled-wrapper--vertical"
class="tooltip__child-not-interactive-wrapper--vertical"
data-testid="disabled-child-tooltip-wrapper"
tabindex="0"
>
Expand Down Expand Up @@ -207,7 +207,7 @@ exports[`<Tooltip /> InteractiveDisabled story renders snapshot 1`] = `
class="trigger--spacing-top trigger--spacing-left"
>
<span
class="tooltip__child-disabled-wrapper--vertical"
class="tooltip__child-not-interactive-wrapper--vertical"
data-testid="disabled-child-tooltip-wrapper"
tabindex="0"
>
Expand Down

0 comments on commit 393b640

Please sign in to comment.