Skip to content

Commit

Permalink
feat: v2 tooltip to 1030 (#1190)
Browse files Browse the repository at this point in the history
* feat: tooltip to 1030

* chore: update snap

Co-authored-by: Lee Chase <[email protected]>
  • Loading branch information
lee-chase and lee-chase authored May 12, 2021
1 parent b8a4fd6 commit 6a18cf6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 34 deletions.
60 changes: 30 additions & 30 deletions packages/core/__tests__/__snapshots__/cv-tooltip.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction a
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip bx--tooltip--shown"
class="bx--tooltip bx--tooltip--shown bx--tooltip--left bx--tooltip--align-center"
data-floating-menu-direction="left"
id="test-1"
role="dialog"
Expand All @@ -78,7 +78,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction a
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -92,7 +92,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction a
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -111,7 +111,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--bottom bx--tooltip--align-center"
data-floating-menu-direction="bottom"
id="test-1"
role="dialog"
Expand All @@ -120,7 +120,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -134,7 +134,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -153,7 +153,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--left bx--tooltip--align-center"
data-floating-menu-direction="left"
id="test-1"
role="dialog"
Expand All @@ -162,7 +162,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -176,7 +176,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -195,7 +195,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--right bx--tooltip--align-center"
data-floating-menu-direction="right"
id="test-1"
role="dialog"
Expand All @@ -204,7 +204,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -218,7 +218,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -237,7 +237,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -246,7 +246,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -260,7 +260,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with direction s
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -279,7 +279,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`cont
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -288,7 +288,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`cont
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -309,7 +309,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`cont
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -330,7 +330,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`labe
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -339,7 +339,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`labe
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -353,7 +353,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`labe
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -372,7 +372,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`trig
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -381,7 +381,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`trig
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -395,7 +395,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with slot \`trig
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -414,7 +414,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with visible set
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip bx--tooltip--shown"
class="bx--tooltip bx--tooltip--shown bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -423,7 +423,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with visible set
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -437,7 +437,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip with visible set
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand All @@ -456,7 +456,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip: minimal as expe
aria-describedby="test-1-body"
aria-hidden="true"
aria-labelledby="test-1-label"
class="bx--tooltip"
class="bx--tooltip bx--tooltip--top bx--tooltip--align-center"
data-floating-menu-direction="top"
id="test-1"
role="dialog"
Expand All @@ -465,7 +465,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip: minimal as expe
>
<div
class="cv-interactive-tooltip__before-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
Expand All @@ -479,7 +479,7 @@ exports[`CvInteractiveTooltip should render interactive tooltip: minimal as expe
<div
class="cv-interactive-tooltip__after-content"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
tabindex="0"
/>
</div>
Expand Down
14 changes: 11 additions & 3 deletions packages/core/src/components/cv-tooltip/cv-interactive-tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
:id="uid"
aria-hidden="true"
:data-floating-menu-direction="direction"
:class="[`${carbonPrefix}--tooltip`, { [`${carbonPrefix}--tooltip--shown`]: dataVisible }]"
:class="[
`${carbonPrefix}--tooltip`,
{
[`${carbonPrefix}--tooltip--shown`]: dataVisible,
[`${carbonPrefix}--tooltip--${direction}`]: direction,
[`${carbonPrefix}--tooltip--align-${alignment}`]: alignment,
},
]"
ref="popup"
role="dialog"
:aria-describedby="`${uid}-body`"
Expand All @@ -39,7 +46,7 @@
class="cv-interactive-tooltip__before-content"
ref="beforeContent"
tabindex="0"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
@focus="focusBeforeContent"
/>
<span :class="`${carbonPrefix}--tooltip__caret`"></span>
Expand All @@ -50,7 +57,7 @@
class="cv-interactive-tooltip__after-content"
ref="afterContent"
tabindex="0"
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
style="position: absolute; left: -9999px; width: 1px; height: 1px;"
@focus="focusAfterContent"
/>
</div>
Expand All @@ -66,6 +73,7 @@ export default {
mixins: [uidMixin, carbonPrefixMixin],
components: { Information16 },
props: {
alignment: { type: String, default: 'center', validator: val => ['start', 'center', 'end'].includes(val) },
direction: {
type: String,
default: 'top',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ http://www.carbondesignsystem.com/components/tooltip/code
## Usage

```html
<cv-interactive-tooltip direction="bottom">
<cv-interactive-tooltip alignment="center" direction="bottom">
<template slot="label">Tooltip label</template>
<template slot="trigger">
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
Expand Down

0 comments on commit 6a18cf6

Please sign in to comment.