Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating fluent-tooltip wc styles to support custom tag names #26154

Merged
merged 5 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix fluent-tooltip not showing anchor pointer when wc prefix is changed",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
41 changes: 21 additions & 20 deletions packages/web-components/src/tooltip/tooltip.styles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { css, ElementStyles } from '@microsoft/fast-element';
import {
AnchoredRegion,
ElementDefinitionContext,
forcedColorsStylesheetBehavior,
FoundationElementDefinition,
FoundationElementDefinition
} from '@microsoft/fast-foundation';
import { elevationShadowTooltip } from '../styles/index';
import {
Expand Down Expand Up @@ -42,23 +43,23 @@ export const tooltipStyles: (
box-shadow: ${elevationShadowTooltip};
}

fluent-anchored-region {
${context.tagFor(AnchoredRegion)} {
display: flex;
justify-content: center;
align-items: center;
overflow: visible;
flex-direction: row;
}

fluent-anchored-region.right,
fluent-anchored-region.left {
${context.tagFor(AnchoredRegion)}.right,
${context.tagFor(AnchoredRegion)}.left {
flex-direction: column;
}

fluent-anchored-region.top .tooltip::after,
fluent-anchored-region.bottom .tooltip::after,
fluent-anchored-region.left .tooltip::after,
fluent-anchored-region.right .tooltip::after {
${context.tagFor(AnchoredRegion)}.top .tooltip::after,
${context.tagFor(AnchoredRegion)}.bottom .tooltip::after,
${context.tagFor(AnchoredRegion)}.left .tooltip::after,
${context.tagFor(AnchoredRegion)}.right .tooltip::after {
content: '';
width: 12px;
height: 12px;
Expand All @@ -68,43 +69,43 @@ export const tooltipStyles: (
position: absolute;
}

fluent-anchored-region.top .tooltip::after {
${context.tagFor(AnchoredRegion)}.top .tooltip::after {
transform: translateX(-50%) rotate(225deg);
bottom: 5px;
left: 50%;
}

fluent-anchored-region.top .tooltip {
${context.tagFor(AnchoredRegion)}.top .tooltip {
margin-bottom: 12px;
}

fluent-anchored-region.bottom .tooltip::after {
${context.tagFor(AnchoredRegion)}.bottom .tooltip::after {
transform: translateX(-50%) rotate(45deg);
top: 5px;
left: 50%;
}

fluent-anchored-region.bottom .tooltip {
${context.tagFor(AnchoredRegion)}.bottom .tooltip {
margin-top: 12px;
}

fluent-anchored-region.left .tooltip::after {
${context.tagFor(AnchoredRegion)}.left .tooltip::after {
transform: translateY(-50%) rotate(135deg);
top: 50%;
right: 5px;
}

fluent-anchored-region.left .tooltip {
${context.tagFor(AnchoredRegion)}.left .tooltip {
margin-right: 12px;
}

fluent-anchored-region.right .tooltip::after {
${context.tagFor(AnchoredRegion)}.right .tooltip::after {
transform: translateY(-50%) rotate(-45deg);
top: 50%;
left: 5px;
}

fluent-anchored-region.right .tooltip {
${context.tagFor(AnchoredRegion)}.right .tooltip {
margin-left: 12px;
}
`.withBehaviors(
Expand All @@ -113,10 +114,10 @@ export const tooltipStyles: (
:host([disabled]) {
opacity: 1;
}
fluent-anchored-region.top .tooltip::after,
fluent-anchored-region.bottom .tooltip::after,
fluent-anchored-region.left .tooltip::after,
fluent-anchored-region.right .tooltip::after {
${context.tagFor(AnchoredRegion)}.top .tooltip::after,
${context.tagFor(AnchoredRegion)}.bottom .tooltip::after,
${context.tagFor(AnchoredRegion)}.left .tooltip::after,
${context.tagFor(AnchoredRegion)}.right .tooltip::after {
content: '';
width: unset;
height: unset;
Expand Down