-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(quantic): quantic tooltip made responsive (#3428)
* quantic tooltip made responsive * quantic tooltip made responsive * quantic tooltip made responsive * quantic tooltip made responsive * quantic tooltip made responsive * animation of tooltip improved * css value simplified * Update packages/quantic/force-app/main/default/lwc/quanticTooltip/quanticTooltip.js Co-authored-by: Simon Milord <[email protected]> * animation strategy of the tooltip arrow improved * final adjustment --------- Co-authored-by: Simon Milord <[email protected]>
- Loading branch information
1 parent
8ab8716
commit 633784d
Showing
5 changed files
with
163 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 64 additions & 7 deletions
71
packages/quantic/force-app/main/default/lwc/quanticTooltip/quanticTooltip.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,81 @@ | ||
:host { | ||
--x-translation: var(--adapted-x-translation, 0px); | ||
--max-width: var(--adapted-max-width, 20rem); | ||
} | ||
|
||
.tooltip__content { | ||
left: 50%; | ||
transform: translate(-50%, -100%); | ||
transition: transform 0s linear 0s, opacity 0.1s linear 0s, visibility 0.1s linear 0s; | ||
z-index: 2; | ||
} | ||
|
||
.tooltip__content--positioned-above { | ||
transform: translate(calc(-50% + var(--x-translation)), -100%); | ||
top: -0.7rem; | ||
} | ||
|
||
.tooltip__content--positioned-below { | ||
transform: translate(calc(-50% + var(--x-translation)), 0.7rem); | ||
} | ||
|
||
.tooltip__content--visible { | ||
visibility: visible; | ||
opacity: 1; | ||
} | ||
|
||
.tooltip__content--light { | ||
.tooltip__content--light, | ||
.slds-popover_tooltip { | ||
width: max-content; | ||
max-width: var(--slds-c-tooltip-sizing-max-width, var(--sds-c-tooltip-sizing-max-width, var(--lwc-sizeMedium, 20rem))); | ||
} | ||
|
||
.slds-nubbin_bottom-left:before, | ||
.slds-nubbin_bottom-left:after { | ||
.tooltip__arrow { | ||
left: 50%; | ||
transform: translate(-50%, -100%); | ||
transition: opacity 0.1s linear 0s, visibility 0.1s linear 0s; | ||
z-index: 2; | ||
} | ||
|
||
.slds-popover_tooltip { | ||
width: max-content; | ||
.tooltip__arrow--dark { | ||
background-color: var(--slds-c-tooltip-color-background, rgb(3, 45, 96)); | ||
} | ||
|
||
.tooltip__arrow--light { | ||
background-color: var(--lwc-colorBackgroundAlt, rgb(255, 255, 255)); | ||
} | ||
|
||
.tooltip__arrow--positioned-above { | ||
top: -0.7rem; | ||
} | ||
|
||
.tooltip__arrow--positioned-below { | ||
bottom: -0.7rem; | ||
} | ||
|
||
.tooltip__arrow--light.tooltip__arrow--positioned-above { | ||
top: -0.74rem; | ||
} | ||
|
||
.tooltip__arrow--light.tooltip__arrow--positioned-below { | ||
bottom: -0.74rem; | ||
} | ||
|
||
.tooltip__body { | ||
max-width: min(20rem, var(--max-width)); | ||
width: fit-content; | ||
} | ||
|
||
.slds-nubbin_bottom:after, | ||
.slds-nubbin--bottom:after, | ||
.slds-nubbin_bottom:before, | ||
.slds-nubbin--bottom:before { | ||
clip-path: polygon(100% 0, 0% 100%, 100% 100%); | ||
border: solid 0.5px rgba(0, 0, 0, 0.16); | ||
} | ||
|
||
.slds-nubbin_top:after, | ||
.slds-nubbin--top:after, | ||
.slds-nubbin_top:before, | ||
.slds-nubbin--top:before { | ||
clip-path: polygon(100% 0, 0 0, 0 100%); | ||
border: solid 0.5px rgba(0, 0, 0, 0.16); | ||
} |
4 changes: 3 additions & 1 deletion
4
packages/quantic/force-app/main/default/lwc/quanticTooltip/quanticTooltip.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<template> | ||
<div data-cy="tooltip" class={tooltipCSSClass} aria-hidden="true"> | ||
<div class="slds-popover__body"> | ||
<div class="slds-popover__body tooltip__body"> | ||
<slot name="content"></slot> | ||
</div> | ||
</div> | ||
<div class={tooltipArrowCSSClass}> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters