Skip to content

Commit

Permalink
[EuiToolTip] Convert to Emotion styling (#6104)
Browse files Browse the repository at this point in the history
* convert euitooltip to function component

* account for exposed methods: forwardRef and useImperativeHandle

* convert euitooltippopover to function component

* fix aria-describedby id

* convert euitooltip to emotion styling

* convert euitooltippopover to emotion styling

* removed unused sass

* lint

* snapshot updates

* CL

* manual merge main

* remove comment

* use RTL

* refactor to make subcomponents responsible for their own styling

* fix merge

* update CL
  • Loading branch information
thompsongl authored Sep 7, 2022
1 parent 27d7b78 commit 545b362
Show file tree
Hide file tree
Showing 25 changed files with 823 additions and 488 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports[`EuiBetaBadge props size s is rendered 1`] = `

exports[`EuiBetaBadge props tooltip and anchorProps are rendered 1`] = `
<span
class="euiToolTipAnchor customAnchorClass"
class="euiToolTipAnchor customAnchorClass emotion-euiToolTipAnchor-inlineBlock"
data-test-subj="DTS"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`CollapsedItemActions render 1`] = `
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="All actions"
Expand Down
415 changes: 299 additions & 116 deletions src/components/code/__snapshots__/code_block.test.tsx.snap

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/components/datagrid/__snapshots__/data_grid.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ Array [
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Display options"
Expand All @@ -1009,7 +1009,7 @@ Array [
</div>
</div>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Enter fullscreen"
Expand Down Expand Up @@ -1435,7 +1435,7 @@ Array [
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Display options"
Expand All @@ -1454,7 +1454,7 @@ Array [
</div>
</div>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Enter fullscreen"
Expand Down Expand Up @@ -2221,7 +2221,7 @@ Array [
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Display options"
Expand All @@ -2240,7 +2240,7 @@ Array [
</div>
</div>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Enter fullscreen"
Expand Down Expand Up @@ -2665,7 +2665,7 @@ Array [
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Display options"
Expand All @@ -2684,7 +2684,7 @@ Array [
</div>
</div>
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
aria-label="Enter fullscreen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { Component, MouseEventHandler, Ref } from 'react';
import React, { Component, MouseEventHandler, ElementRef } from 'react';
import classNames from 'classnames';

import { EuiButton, EuiButtonProps } from '../../button';
Expand All @@ -15,6 +15,8 @@ import { EuiToolTip, EuiToolTipProps } from '../../tool_tip';
import { EuiBreakpointSize } from '../../../services/breakpoint';
import { EuiHideFor, EuiShowFor } from '../../responsive';

type ToolTipRef = ElementRef<typeof EuiToolTip> | null;

type EuiSuperUpdateButtonInternalProps = {
isDisabled?: boolean;
isLoading?: boolean;
Expand Down Expand Up @@ -58,7 +60,7 @@ export class EuiSuperUpdateButton extends Component<
};
_isMounted = false;
tooltipTimeout: number | undefined;
tooltip: EuiToolTip | null = null;
tooltip: ToolTipRef = null;

componentWillUnmount() {
this._isMounted = false;
Expand All @@ -82,7 +84,7 @@ export class EuiSuperUpdateButton extends Component<
}
}

setTootipRef: Ref<EuiToolTip> = (node) => {
setTootipRef = (node: ToolTipRef) => {
this.tooltip = node;
};

Expand Down
1 change: 0 additions & 1 deletion src/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@
@import 'suggest/index';
@import 'table/index';
@import 'tabs/index';
@import 'tool_tip/index';
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports[`EuiKeyPadMenuItem is rendered 1`] = `

exports[`EuiKeyPadMenuItem props betaBadge renders 1`] = `
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
class="euiKeyPadMenuItem euiKeyPadMenuItem--hasBetaBadge"
Expand Down Expand Up @@ -128,7 +128,7 @@ exports[`EuiKeyPadMenuItem props betaBadge renders 1`] = `

exports[`EuiKeyPadMenuItem props betaBadge renders extra betaBadgeTooltipProps 1`] = `
<span
class="euiToolTipAnchor customTooltipClass"
class="euiToolTipAnchor customTooltipClass emotion-euiToolTipAnchor-inlineBlock"
>
<button
class="euiKeyPadMenuItem euiKeyPadMenuItem--hasBetaBadge"
Expand Down Expand Up @@ -161,7 +161,7 @@ exports[`EuiKeyPadMenuItem props betaBadge renders extra betaBadgeTooltipProps 1

exports[`EuiKeyPadMenuItem props betaBadge renders with betaBadgeIconType 1`] = `
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
class="euiKeyPadMenuItem euiKeyPadMenuItem--hasBetaBadge"
Expand Down Expand Up @@ -199,7 +199,7 @@ exports[`EuiKeyPadMenuItem props betaBadge renders with betaBadgeIconType 1`] =

exports[`EuiKeyPadMenuItem props betaBadge renders with betaBadgeTooltipContent 1`] = `
<span
class="euiToolTipAnchor"
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<button
class="euiKeyPadMenuItem euiKeyPadMenuItem--hasBetaBadge"
Expand Down
Loading

0 comments on commit 545b362

Please sign in to comment.