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

fix: tooltip within modal #2206

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@
"license": "MPL-2.0",
"dependencies": {
"@duetds/date-picker": "1.2.0",
"@floating-ui/dom": "^0.5.4",
"@floating-ui/dom": "^1.2.8",
"@stencil/core": "^2.17.0",
"@telekom/design-tokens": "1.0.0-beta.10",
"@telekom/scale-design-tokens": "^3.0.0-beta.143",
"classnames": "^2.2.6",
"classnames": "^2.2.6",
"composed-offset-position": "^0.0.4",
"stencil-inline-svg": "^1.0.1"
}
}
3 changes: 2 additions & 1 deletion packages/components/src/components/tooltip/tooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
--line-height: var(--telekom-typography-line-spacing-standard);
--spacing: var(--telekom-spacing-composition-space-02)
var(--telekom-spacing-composition-space-04);
--width: 'min-content';
felix-ico marked this conversation as resolved.
Show resolved Hide resolved

/* arrow */
--arrow-size: 12px;
Expand All @@ -34,12 +35,12 @@
--z-index: var(--scl-z-index-70);

display: contents;
position: relative;
box-sizing: border-box;
}

[part='tooltip'] {
position: absolute;
width: var(--width);
z-index: var(--z-index);
top: 0;
left: 0;
Expand Down
15 changes: 14 additions & 1 deletion packages/components/src/components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ import {
State,
Listen,
} from '@stencil/core';
import { computePosition, offset, flip, shift, arrow } from '@floating-ui/dom';
import {
computePosition,
offset,
flip,
shift,
arrow,
platform,
} from '@floating-ui/dom';
import { offsetParent } from 'composed-offset-position';
import { isClickOutside } from '../../utils/utils';
import statusNote from '../../utils/status-note';

Expand Down Expand Up @@ -161,6 +169,11 @@ export class Tooltip {
arrow({ element: this.arrowEl, padding: this.arrowPadding }),
shift({ crossAxis: true }),
],
platform: {
...platform,
getOffsetParent: (element) =>
platform.getOffsetParent(element, offsetParent),
},
}
);
Object.assign(this.tooltipEl.style, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const FocusTemplate = (args, { argTypes }) => ({
--line-height: var(--telekom-typography-line-spacing-standard);
--spacing: var(--telekom-spacing-composition-space-02)
var(--telekom-spacing-composition-space-04);
--width: 'min-content';

/* arrow */
--arrow-size: 12px;
Expand Down
31 changes: 22 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3526,17 +3526,25 @@
unique-filename "^1.1.1"
which "^1.3.1"

"@floating-ui/core@^0.7.3":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-0.7.3.tgz#d274116678ffae87f6b60e90f88cc4083eefab86"
integrity sha512-buc8BXHmG9l82+OQXOFU3Kr2XQx9ys01U/Q9HMIrZ300iLc8HLMgh7dcCqgYzAzf4BkoQvDcXf5Y+CuEZ5JBYg==
"@floating-ui/core@^1.4.2":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.5.0.tgz#5c05c60d5ae2d05101c3021c1a2a350ddc027f8c"
integrity sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg==
dependencies:
"@floating-ui/utils" "^0.1.3"

"@floating-ui/dom@^0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-0.5.4.tgz#4eae73f78bcd4bd553ae2ade30e6f1f9c73fe3f1"
integrity sha512-419BMceRLq0RrmTSDxn8hf9R3VCJv2K9PUfugh5JyEFmdjzDo+e8U5EdR8nzKq8Yj1htzLm3b6eQEEam3/rrtg==
"@floating-ui/dom@^1.2.8":
version "1.5.3"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.5.3.tgz#54e50efcb432c06c23cd33de2b575102005436fa"
integrity sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA==
dependencies:
"@floating-ui/core" "^0.7.3"
"@floating-ui/core" "^1.4.2"
"@floating-ui/utils" "^0.1.3"

"@floating-ui/utils@^0.1.3":
version "0.1.6"
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.6.tgz#22958c042e10b67463997bd6ea7115fe28cbcaf9"
integrity sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==

"@hapi/[email protected]":
version "2.1.4"
Expand Down Expand Up @@ -8472,6 +8480,11 @@ component-emitter@^1.2.1:
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz"
integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==

composed-offset-position@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/composed-offset-position/-/composed-offset-position-0.0.4.tgz#ca8854abf15e3c235ecf4df125a27fe88af76ea4"
integrity sha512-vMlvu1RuNegVE0YsCDSV/X4X10j56mq7PCIyOKK74FxkXzGLwhOUmdkJLSdOBOMwWycobGUMgft2lp+YgTe8hw==

compressible@~2.0.16:
version "2.0.18"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
Expand Down
Loading