@justeattakeaway/pie-tooltip 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -12
- package/custom-elements.json +0 -96
- package/dist/index.d.ts +1 -8
- package/dist/index.js +227 -317
- package/dist/react.d.ts +1 -8
- package/package.json +1 -1
- package/src/defs.ts +1 -1
- package/src/index.ts +2 -238
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
|
|
|
48
48
|
|---|---|---|---|
|
|
49
49
|
| `trigger` | Any string | The `id` of the element the panel is anchored to. The trigger lives elsewhere in the DOM and is never slotted into the tooltip. | `undefined` |
|
|
50
50
|
| `isOpen` | `true`, `false` | When true, the panel is visible. The component never writes to this property. | `false` |
|
|
51
|
-
| `position` | `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `left`, `left-start`, `left-end`, `right`, `right-start`, `right-end` | The
|
|
51
|
+
| `position` | `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `left`, `left-start`, `left-end`, `right`, `right-start`, `right-end` | The side of the trigger the panel sits on, and its alignment along the cross axis. | `top` |
|
|
52
52
|
| `size` | `default`, `fit-to-content`, `fill-container` | How the panel sizes itself. `default` is a fixed 280px and wraps, `fit-to-content` is as wide as its content, and `fill-container` matches the inline size of the trigger's parent element. Not applied when `type` is `icon`. | `default` |
|
|
53
53
|
| `variant` | `default`, `inverse` | The colour treatment of the panel. `default` is the dark panel, `inverse` the light one. | `default` |
|
|
54
54
|
| `type` | `default`, `icon` | The presentation of the panel. `icon` is the compact treatment intended for icon triggers: it has no arrow and is always as wide as its content, so `size` and `--tooltip-width` have no effect on it. | `default` |
|
|
@@ -106,17 +106,6 @@ right right-start right-end
|
|
|
106
106
|
|
|
107
107
|
In right-to-left languages, everything on the inline axis mirrors. The alignments follow the reading direction, so `top-start` aligns against the right-hand edge, and `left` and `right` swap: a panel asked for on the left appears on the right. The `-start` and `-end` alignments of `left` and `right` are on the block axis, which has no direction to mirror, so only the side moves.
|
|
108
108
|
|
|
109
|
-
### Collision detection
|
|
110
|
-
|
|
111
|
-
`position` is a preference, not a guarantee. Before the panel is shown, and on every scroll, resize or direction change while it is open, the component measures the panel against the space available and repositions it if the preferred position would collide.
|
|
112
|
-
|
|
113
|
-
- It flips to the opposite side first: `top` to `bottom`, and so on.
|
|
114
|
-
- It then tries the remaining sides.
|
|
115
|
-
- Within a side, it shifts the alignment (for example `top-start` to `top-end`) so the panel stays fully in view.
|
|
116
|
-
- If no position fits entirely, it uses whichever position shows the most of the panel.
|
|
117
|
-
|
|
118
|
-
The available space is the viewport, narrowed by any ancestor that clips the panel. Collision detection is always on and cannot be disabled.
|
|
119
|
-
|
|
120
109
|
## Sizing
|
|
121
110
|
|
|
122
111
|
| `size` | Behaviour |
|
package/custom-elements.json
CHANGED
|
@@ -343,14 +343,6 @@
|
|
|
343
343
|
"privacy": "private",
|
|
344
344
|
"default": "true"
|
|
345
345
|
},
|
|
346
|
-
{
|
|
347
|
-
"kind": "field",
|
|
348
|
-
"name": "_resolvedPosition",
|
|
349
|
-
"type": {
|
|
350
|
-
"text": "TooltipProps['position'] | undefined"
|
|
351
|
-
},
|
|
352
|
-
"privacy": "private"
|
|
353
|
-
},
|
|
354
346
|
{
|
|
355
347
|
"kind": "field",
|
|
356
348
|
"name": "_clippedTriggerElement",
|
|
@@ -369,24 +361,6 @@
|
|
|
369
361
|
"privacy": "private",
|
|
370
362
|
"default": "[]"
|
|
371
363
|
},
|
|
372
|
-
{
|
|
373
|
-
"kind": "field",
|
|
374
|
-
"name": "_overlayClippers",
|
|
375
|
-
"type": {
|
|
376
|
-
"text": "Array<Element>"
|
|
377
|
-
},
|
|
378
|
-
"privacy": "private",
|
|
379
|
-
"default": "[]"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"kind": "field",
|
|
383
|
-
"name": "_collisionSignature",
|
|
384
|
-
"type": {
|
|
385
|
-
"text": "string | null"
|
|
386
|
-
},
|
|
387
|
-
"privacy": "private",
|
|
388
|
-
"default": "null"
|
|
389
|
-
},
|
|
390
364
|
{
|
|
391
365
|
"kind": "field",
|
|
392
366
|
"name": "_overlayModeDirty",
|
|
@@ -538,76 +512,6 @@
|
|
|
538
512
|
}
|
|
539
513
|
}
|
|
540
514
|
},
|
|
541
|
-
{
|
|
542
|
-
"kind": "method",
|
|
543
|
-
"name": "resolveCollision",
|
|
544
|
-
"privacy": "private",
|
|
545
|
-
"return": {
|
|
546
|
-
"type": {
|
|
547
|
-
"text": "void"
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
"parameters": [
|
|
551
|
-
{
|
|
552
|
-
"name": "anchorRect",
|
|
553
|
-
"type": {
|
|
554
|
-
"text": "DOMRect"
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
]
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
"kind": "method",
|
|
561
|
-
"name": "_setResolvedPosition",
|
|
562
|
-
"privacy": "private",
|
|
563
|
-
"return": {
|
|
564
|
-
"type": {
|
|
565
|
-
"text": "void"
|
|
566
|
-
}
|
|
567
|
-
},
|
|
568
|
-
"parameters": [
|
|
569
|
-
{
|
|
570
|
-
"name": "position",
|
|
571
|
-
"type": {
|
|
572
|
-
"text": "TooltipProps['position']"
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
]
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
"kind": "method",
|
|
579
|
-
"name": "_getCollisionBoundary",
|
|
580
|
-
"privacy": "private",
|
|
581
|
-
"return": {
|
|
582
|
-
"type": {
|
|
583
|
-
"text": "DOMRect | null"
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
"kind": "method",
|
|
589
|
-
"name": "_getCandidatePositions",
|
|
590
|
-
"privacy": "private",
|
|
591
|
-
"return": {
|
|
592
|
-
"type": {
|
|
593
|
-
"text": "Array<{ side: TooltipSide; alignment: TooltipAlignment }>"
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
"parameters": [
|
|
597
|
-
{
|
|
598
|
-
"name": "preferredSide",
|
|
599
|
-
"type": {
|
|
600
|
-
"text": "TooltipSide"
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
"name": "preferredAlignment",
|
|
605
|
-
"type": {
|
|
606
|
-
"text": "TooltipAlignment"
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
]
|
|
610
|
-
},
|
|
611
515
|
{
|
|
612
516
|
"kind": "method",
|
|
613
517
|
"name": "_refreshTriggerClippers",
|
package/dist/index.d.ts
CHANGED
|
@@ -52,11 +52,8 @@ export declare class PieTooltip extends PieElement implements TooltipProps {
|
|
|
52
52
|
private _hasActionContent;
|
|
53
53
|
private _isPositioned;
|
|
54
54
|
private _isAnchorVisible;
|
|
55
|
-
private _resolvedPosition;
|
|
56
55
|
private _clippedTriggerElement;
|
|
57
56
|
private _triggerClippers;
|
|
58
|
-
private _overlayClippers;
|
|
59
|
-
private _collisionSignature;
|
|
60
57
|
private _overlayModeDirty;
|
|
61
58
|
private _triggerTrackingController;
|
|
62
59
|
private _interactionController;
|
|
@@ -78,10 +75,6 @@ export declare class PieTooltip extends PieElement implements TooltipProps {
|
|
|
78
75
|
private resolveMode;
|
|
79
76
|
private resolveOverlayMode;
|
|
80
77
|
private projectOverTrigger;
|
|
81
|
-
private resolveCollision;
|
|
82
|
-
private _setResolvedPosition;
|
|
83
|
-
private _getCollisionBoundary;
|
|
84
|
-
private _getCandidatePositions;
|
|
85
78
|
private _refreshTriggerClippers;
|
|
86
79
|
private handleCloseButtonClick;
|
|
87
80
|
private _getTriggerElement;
|
|
@@ -107,7 +100,7 @@ export declare interface TooltipProps {
|
|
|
107
100
|
trigger?: string;
|
|
108
101
|
/** When true, the panel is visible. The component never writes to this property. */
|
|
109
102
|
isOpen?: boolean;
|
|
110
|
-
/** The
|
|
103
|
+
/** The side of the trigger the panel sits on, and its alignment along the cross axis. */
|
|
111
104
|
position?: typeof positions[number];
|
|
112
105
|
/** How the panel sizes itself. Not applied when `type` is `icon`. */
|
|
113
106
|
size?: typeof sizes[number];
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { classMap as
|
|
4
|
-
import { ifDefined as
|
|
5
|
-
import { unsafeStatic as
|
|
6
|
-
import { validPropertyValues as
|
|
1
|
+
import { LitElement as $, unsafeCSS as E, nothing as b } from "lit";
|
|
2
|
+
import { property as v, queryAssignedElements as A, query as L, state as x } from "lit/decorators.js";
|
|
3
|
+
import { classMap as T } from "lit/directives/class-map.js";
|
|
4
|
+
import { ifDefined as D } from "lit/directives/if-defined.js";
|
|
5
|
+
import { unsafeStatic as M, html as y } from "lit/static-html.js";
|
|
6
|
+
import { validPropertyValues as m, safeCustomElement as P } from "@justeattakeaway/pie-webc-core";
|
|
7
7
|
import "@justeattakeaway/pie-icon-button";
|
|
8
8
|
import "@justeattakeaway/pie-icons-webc/dist/IconClose.js";
|
|
9
|
-
const
|
|
9
|
+
const w = class w extends $ {
|
|
10
10
|
willUpdate() {
|
|
11
|
-
this.getAttribute("v") || this.setAttribute("v",
|
|
11
|
+
this.getAttribute("v") || this.setAttribute("v", w.v);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
const
|
|
14
|
+
w.v = "0.6.0";
|
|
15
|
+
let _ = w;
|
|
16
|
+
const S = [
|
|
17
17
|
"top",
|
|
18
18
|
"top-start",
|
|
19
19
|
"top-end",
|
|
@@ -26,7 +26,7 @@ const Y = [
|
|
|
26
26
|
"right",
|
|
27
27
|
"right-start",
|
|
28
28
|
"right-end"
|
|
29
|
-
],
|
|
29
|
+
], B = ["default", "fit-to-content", "fill-container"], I = ["default", "inverse"], R = ["default", "icon"], q = ["h2", "h3", "h4", "h5", "h6"], rt = ["hover", "focus", "click"], st = ["tooltip", "dialog"], p = "pie-tooltip", a = "c-tooltip", F = `${p}-open`, V = `${p}-close`, g = {
|
|
30
30
|
isOpen: !1,
|
|
31
31
|
position: "top",
|
|
32
32
|
size: "default",
|
|
@@ -34,14 +34,14 @@ const Y = [
|
|
|
34
34
|
type: "default",
|
|
35
35
|
isDismissible: !1,
|
|
36
36
|
headingLevel: "h2"
|
|
37
|
-
}, tt = '*,*:after,*:before{box-sizing:inherit}:host{--tooltip-anchor-top: 0;--tooltip-anchor-left: 0;--tooltip-anchor-width: 0;--tooltip-anchor-height: 0;--tooltip-container-inline-size: 0;--tooltip-offset: var(--dt-spacing-a);--tooltip-arrow-size: 8px;--tooltip-layer-offset: calc(var(--tooltip-offset) + var(--tooltip-arrow-size));position:absolute;top:0;left:0;z-index:var(--dt-z-index-tooltip);display:block;inline-size:0;block-size:0;pointer-events:none}.c-tooltip-origin{position:absolute;top:0;left:0;inline-size:0;block-size:0}.c-tooltip-anchor{position:absolute;top:var(--tooltip-anchor-top);left:var(--tooltip-anchor-left);inline-size:var(--tooltip-anchor-width);block-size:var(--tooltip-anchor-height)}.c-tooltip-layer{position:absolute;display:grid;grid-template-columns:100%;grid-template-rows:100%;visibility:hidden;transition:visibility 0s linear .15s}.c-tooltip-layer.is-open.is-positioned.is-anchorVisible{visibility:visible;transition-delay:0s}.c-tooltip-layer--type-icon{--tooltip-layer-offset: var(--tooltip-offset)}.c-tooltip-layer--top,.c-tooltip-layer--bottom{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left,.c-tooltip-layer--right{inset-block-start:0;block-size:100%}.c-tooltip-layer--top{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top-start,.c-tooltip-layer--bottom-start{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left-start,.c-tooltip-layer--right-start{inset-block-start:0;block-size:100%}.c-tooltip-layer--top-start{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom-start{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left-start{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right-start{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top-end,.c-tooltip-layer--bottom-end{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left-end,.c-tooltip-layer--right-end{inset-block-start:0;block-size:100%}.c-tooltip-layer--top-end{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom-end{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left-end{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right-end{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top{place-items:center}.c-tooltip-layer--top-start{place-items:start}.c-tooltip-layer--top-end{place-items:end}.c-tooltip-layer--bottom{place-items:center}.c-tooltip-layer--bottom-start{place-items:start}.c-tooltip-layer--bottom-end{place-items:end}.c-tooltip-layer--left{place-items:center}.c-tooltip-layer--left-start{place-items:start}.c-tooltip-layer--left-end{place-items:end}.c-tooltip-layer--right{place-items:center}.c-tooltip-layer--right-start{place-items:start}.c-tooltip-layer--right-end{place-items:end}.c-tooltip{--tooltip-inline-size: 280px;--tooltip-max-inline-size: calc(100vw - var(--dt-spacing-d) * 2);--tooltip-background-color: var(--dt-color-container-inverse);--tooltip-content-color: var(--dt-color-content-inverse);--tooltip-border-radius: var(--dt-radius-rounded-b);--tooltip-padding-block: var(--dt-spacing-b);--tooltip-padding-inline: var(--dt-spacing-c);--tooltip-close-size: 32px;--tooltip-motion-duration: .15s;--tooltip-motion-easing: cubic-bezier(.45, 0, .55, 1);--tooltip-motion-translate-x: 0;--tooltip-motion-translate-y: 0;--tooltip-arrow-inset: calc(var(--tooltip-border-radius) + var(--tooltip-arrow-size));--tooltip-arrow-cross-inset: calc(var(--tooltip-arrow-cross-position, 50%) - var(--tooltip-arrow-size));--tooltip-arrow-main-inset-far: calc(100% - 2px) ;--tooltip-arrow-main-inset-near: calc(var(--tooltip-arrow-size) * -1);font-family:var(--dt-font-body-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-weight);font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px);position:relative;white-space:normal;text-wrap:wrap;inline-size:var(--tooltip-width, var(--tooltip-inline-size));max-inline-size:var(--tooltip-max-inline-size);padding-block-start:var(--tooltip-padding-block);padding-block-end:var(--tooltip-padding-block);padding-inline-start:var(--tooltip-padding-inline);padding-inline-end:var(--tooltip-padding-inline);border-radius:var(--tooltip-border-radius);background-color:var(--tooltip-background-color);color:var(--tooltip-content-color);pointer-events:auto;opacity:0;transform:translate(var(--tooltip-motion-translate-x),var(--tooltip-motion-translate-y));transition:opacity var(--tooltip-motion-duration) var(--tooltip-motion-easing),transform var(--tooltip-motion-duration) var(--tooltip-motion-easing)}.c-tooltip-layer.is-open.is-positioned.is-anchorVisible .c-tooltip{--tooltip-motion-duration: .2s;opacity:1;transform:translate(0)}.c-tooltip--top{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom{--tooltip-motion-translate-y: -4px}.c-tooltip--left{--tooltip-motion-translate-x: 4px}.c-tooltip--right{--tooltip-motion-translate-x: -4px}.c-tooltip--top-start{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom-start{--tooltip-motion-translate-y: -4px}.c-tooltip--left-start{--tooltip-motion-translate-x: 4px}.c-tooltip--right-start{--tooltip-motion-translate-x: -4px}.c-tooltip--top-end{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom-end{--tooltip-motion-translate-y: -4px}.c-tooltip--left-end{--tooltip-motion-translate-x: 4px}.c-tooltip--right-end{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--left{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right{--tooltip-motion-translate-x: 4px}:host(:dir(rtl)) .c-tooltip--left-start{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right-start{--tooltip-motion-translate-x: 4px}:host(:dir(rtl)) .c-tooltip--left-end{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right-end{--tooltip-motion-translate-x: 4px}@media(prefers-reduced-motion:reduce){.c-tooltip-layer,.c-tooltip{transition:none}}.c-tooltip--inverse{--tooltip-background-color: var(--dt-color-container-default);--tooltip-content-color: var(--dt-color-content-default)}.c-tooltip--size-fit-to-content{--tooltip-inline-size: max-content}.c-tooltip--size-fill-container{--tooltip-inline-size: var(--tooltip-container-inline-size);--tooltip-max-inline-size: none}.c-tooltip--type-icon{--tooltip-border-radius: var(--dt-radius-rounded-e);--tooltip-padding-block: var(--dt-spacing-a);--tooltip-padding-inline: var(--dt-spacing-c);inline-size:max-content}.c-tooltip.is-dismissible{min-block-size:calc(var(--tooltip-close-size) + var(--dt-spacing-b) * 2);padding-inline-end:calc(var(--tooltip-padding-inline) + var(--tooltip-close-size))}.c-tooltip.is-dismissible:not(.has-heading){display:flex;flex-direction:column;justify-content:center}.c-tooltip--top{--tooltip-arrow-cross-position: 50%}.c-tooltip--top-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--top-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--bottom{--tooltip-arrow-cross-position: 50%}.c-tooltip--bottom-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--bottom-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--left{--tooltip-arrow-cross-position: 50%}.c-tooltip--left-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--left-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--right{--tooltip-arrow-cross-position: 50%}.c-tooltip--right-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--right-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip-arrow{position:absolute;background-color:var(--tooltip-background-color)}.c-tooltip--top .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}.c-tooltip--top-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}.c-tooltip--top-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}:host(:dir(rtl)) .c-tooltip--left .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right .c-tooltip-arrow{transform:scaleX(-1)}:host(:dir(rtl)) .c-tooltip--left-start .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right-start .c-tooltip-arrow{transform:scaleX(-1)}:host(:dir(rtl)) .c-tooltip--left-end .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right-end .c-tooltip-arrow{transform:scaleX(-1)}.c-tooltip-heading{font-family:var(--dt-font-body-strong-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-s-weight);font-size:calc(var(--dt-font-body-strong-s-size) * 1px);line-height:calc(var(--dt-font-body-strong-s-line-height) * 1px);margin-block-start:0;margin-block-end:0}.c-tooltip-content{overflow-wrap:break-word}.c-tooltip-content:focus{outline:none}.c-tooltip.has-action .c-tooltip-action{display:flex;justify-content:flex-end;margin-block-start:var(--dt-spacing-a)}.c-tooltip.is-dismissible.has-action .c-tooltip-action{margin-inline-end:calc(var(--tooltip-close-size) * -1)}.c-tooltip.is-dismissible.has-action .c-tooltip-body{min-block-size:var(--tooltip-close-size)}.c-tooltip.is-dismissible.has-action:not(.has-heading) .c-tooltip-body{display:grid;align-content:center}.c-tooltip-close{position:absolute;inset-block-start:var(--dt-spacing-b);inset-inline-end:var(--dt-spacing-b)}.c-tooltip--top:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--top-start:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom-start:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left-start:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right-start:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--top-end:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom-end:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left-end:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right-end:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}';
|
|
38
|
-
var
|
|
39
|
-
for (var
|
|
40
|
-
(n = t[s]) && (
|
|
41
|
-
return
|
|
37
|
+
}, H = '*,*:after,*:before{box-sizing:inherit}:host{--tooltip-anchor-top: 0;--tooltip-anchor-left: 0;--tooltip-anchor-width: 0;--tooltip-anchor-height: 0;--tooltip-container-inline-size: 0;--tooltip-offset: var(--dt-spacing-a);--tooltip-arrow-size: 8px;--tooltip-layer-offset: calc(var(--tooltip-offset) + var(--tooltip-arrow-size));position:absolute;top:0;left:0;z-index:var(--dt-z-index-tooltip);display:block;inline-size:0;block-size:0;pointer-events:none}.c-tooltip-origin{position:absolute;top:0;left:0;inline-size:0;block-size:0}.c-tooltip-anchor{position:absolute;top:var(--tooltip-anchor-top);left:var(--tooltip-anchor-left);inline-size:var(--tooltip-anchor-width);block-size:var(--tooltip-anchor-height)}.c-tooltip-layer{position:absolute;display:grid;grid-template-columns:100%;grid-template-rows:100%;visibility:hidden;transition:visibility 0s linear .15s}.c-tooltip-layer.is-open.is-positioned.is-anchorVisible{visibility:visible;transition-delay:0s}.c-tooltip-layer--type-icon{--tooltip-layer-offset: var(--tooltip-offset)}.c-tooltip-layer--top,.c-tooltip-layer--bottom{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left,.c-tooltip-layer--right{inset-block-start:0;block-size:100%}.c-tooltip-layer--top{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top-start,.c-tooltip-layer--bottom-start{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left-start,.c-tooltip-layer--right-start{inset-block-start:0;block-size:100%}.c-tooltip-layer--top-start{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom-start{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left-start{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right-start{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top-end,.c-tooltip-layer--bottom-end{inset-inline-start:0;inline-size:100%}.c-tooltip-layer--left-end,.c-tooltip-layer--right-end{inset-block-start:0;block-size:100%}.c-tooltip-layer--top-end{inset-block-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--bottom-end{inset-block-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--left-end{inset-inline-end:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--right-end{inset-inline-start:calc(100% + var(--tooltip-layer-offset))}.c-tooltip-layer--top{place-items:center}.c-tooltip-layer--top-start{place-items:start}.c-tooltip-layer--top-end{place-items:end}.c-tooltip-layer--bottom{place-items:center}.c-tooltip-layer--bottom-start{place-items:start}.c-tooltip-layer--bottom-end{place-items:end}.c-tooltip-layer--left{place-items:center}.c-tooltip-layer--left-start{place-items:start}.c-tooltip-layer--left-end{place-items:end}.c-tooltip-layer--right{place-items:center}.c-tooltip-layer--right-start{place-items:start}.c-tooltip-layer--right-end{place-items:end}.c-tooltip{--tooltip-inline-size: 280px;--tooltip-max-inline-size: calc(100vw - var(--dt-spacing-d) * 2);--tooltip-background-color: var(--dt-color-container-inverse);--tooltip-content-color: var(--dt-color-content-inverse);--tooltip-border-radius: var(--dt-radius-rounded-b);--tooltip-padding-block: var(--dt-spacing-b);--tooltip-padding-inline: var(--dt-spacing-c);--tooltip-close-size: 32px;--tooltip-motion-duration: .15s;--tooltip-motion-easing: cubic-bezier(.45, 0, .55, 1);--tooltip-motion-translate-x: 0;--tooltip-motion-translate-y: 0;--tooltip-arrow-inset: calc(var(--tooltip-border-radius) + var(--tooltip-arrow-size));--tooltip-arrow-cross-inset: calc(var(--tooltip-arrow-cross-position, 50%) - var(--tooltip-arrow-size));--tooltip-arrow-main-inset-far: calc(100% - 2px) ;--tooltip-arrow-main-inset-near: calc(var(--tooltip-arrow-size) * -1);font-family:var(--dt-font-body-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-weight);font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px);position:relative;white-space:normal;text-wrap:wrap;inline-size:var(--tooltip-width, var(--tooltip-inline-size));max-inline-size:var(--tooltip-max-inline-size);padding-block-start:var(--tooltip-padding-block);padding-block-end:var(--tooltip-padding-block);padding-inline-start:var(--tooltip-padding-inline);padding-inline-end:var(--tooltip-padding-inline);border-radius:var(--tooltip-border-radius);background-color:var(--tooltip-background-color);color:var(--tooltip-content-color);pointer-events:auto;opacity:0;transform:translate(var(--tooltip-motion-translate-x),var(--tooltip-motion-translate-y));transition:opacity var(--tooltip-motion-duration) var(--tooltip-motion-easing),transform var(--tooltip-motion-duration) var(--tooltip-motion-easing)}.c-tooltip-layer.is-open.is-positioned.is-anchorVisible .c-tooltip{--tooltip-motion-duration: .2s;opacity:1;transform:translate(0)}.c-tooltip--top{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom{--tooltip-motion-translate-y: -4px}.c-tooltip--left{--tooltip-motion-translate-x: 4px}.c-tooltip--right{--tooltip-motion-translate-x: -4px}.c-tooltip--top-start{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom-start{--tooltip-motion-translate-y: -4px}.c-tooltip--left-start{--tooltip-motion-translate-x: 4px}.c-tooltip--right-start{--tooltip-motion-translate-x: -4px}.c-tooltip--top-end{--tooltip-motion-translate-y: 4px}.c-tooltip--bottom-end{--tooltip-motion-translate-y: -4px}.c-tooltip--left-end{--tooltip-motion-translate-x: 4px}.c-tooltip--right-end{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--left{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right{--tooltip-motion-translate-x: 4px}:host(:dir(rtl)) .c-tooltip--left-start{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right-start{--tooltip-motion-translate-x: 4px}:host(:dir(rtl)) .c-tooltip--left-end{--tooltip-motion-translate-x: -4px}:host(:dir(rtl)) .c-tooltip--right-end{--tooltip-motion-translate-x: 4px}@media(prefers-reduced-motion:reduce){.c-tooltip-layer,.c-tooltip{transition:none}}.c-tooltip--inverse{--tooltip-background-color: var(--dt-color-container-default);--tooltip-content-color: var(--dt-color-content-default)}.c-tooltip--size-fit-to-content{--tooltip-inline-size: max-content}.c-tooltip--size-fill-container{--tooltip-inline-size: var(--tooltip-container-inline-size);--tooltip-max-inline-size: none}.c-tooltip--type-icon{--tooltip-border-radius: var(--dt-radius-rounded-e);--tooltip-padding-block: var(--dt-spacing-a);--tooltip-padding-inline: var(--dt-spacing-c);inline-size:max-content}.c-tooltip.is-dismissible{min-block-size:calc(var(--tooltip-close-size) + var(--dt-spacing-b) * 2);padding-inline-end:calc(var(--tooltip-padding-inline) + var(--tooltip-close-size))}.c-tooltip.is-dismissible:not(.has-heading){display:flex;flex-direction:column;justify-content:center}.c-tooltip--top{--tooltip-arrow-cross-position: 50%}.c-tooltip--top-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--top-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--bottom{--tooltip-arrow-cross-position: 50%}.c-tooltip--bottom-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--bottom-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--left{--tooltip-arrow-cross-position: 50%}.c-tooltip--left-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--left-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip--right{--tooltip-arrow-cross-position: 50%}.c-tooltip--right-start{--tooltip-arrow-cross-position: var(--tooltip-arrow-inset)}.c-tooltip--right-end{--tooltip-arrow-cross-position: calc(100% - var(--tooltip-arrow-inset))}.c-tooltip-arrow{position:absolute;background-color:var(--tooltip-background-color)}.c-tooltip--top .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}.c-tooltip--top-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right-start .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}.c-tooltip--top-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(0% 0%,100% 0%,100% 2px,50% 100%,0% 2px);inset-block-start:var(--tooltip-arrow-main-inset-far);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--bottom-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) * 2);block-size:calc(var(--tooltip-arrow-size) + 2px);clip-path:polygon(50% 0%,100% var(--tooltip-arrow-size),100% 100%,0% 100%,0% var(--tooltip-arrow-size));inset-block-start:var(--tooltip-arrow-main-inset-near);inset-inline-start:var(--tooltip-arrow-cross-inset)}.c-tooltip--left-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 0%,2px 0%,100% 50%,2px 100%,0% 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-far)}.c-tooltip--right-end .c-tooltip-arrow{inline-size:calc(var(--tooltip-arrow-size) + 2px);block-size:calc(var(--tooltip-arrow-size) * 2);clip-path:polygon(0% 50%,var(--tooltip-arrow-size) 0%,100% 0%,100% 100%,var(--tooltip-arrow-size) 100%);inset-block-start:var(--tooltip-arrow-cross-inset);inset-inline-start:var(--tooltip-arrow-main-inset-near)}:host(:dir(rtl)) .c-tooltip--left .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right .c-tooltip-arrow{transform:scaleX(-1)}:host(:dir(rtl)) .c-tooltip--left-start .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right-start .c-tooltip-arrow{transform:scaleX(-1)}:host(:dir(rtl)) .c-tooltip--left-end .c-tooltip-arrow,:host(:dir(rtl)) .c-tooltip--right-end .c-tooltip-arrow{transform:scaleX(-1)}.c-tooltip-heading{font-family:var(--dt-font-body-strong-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-s-weight);font-size:calc(var(--dt-font-body-strong-s-size) * 1px);line-height:calc(var(--dt-font-body-strong-s-line-height) * 1px);margin-block-start:0;margin-block-end:0}.c-tooltip-content{overflow-wrap:break-word}.c-tooltip-content:focus{outline:none}.c-tooltip.has-action .c-tooltip-action{display:flex;justify-content:flex-end;margin-block-start:var(--dt-spacing-a)}.c-tooltip.is-dismissible.has-action .c-tooltip-action{margin-inline-end:calc(var(--tooltip-close-size) * -1)}.c-tooltip.is-dismissible.has-action .c-tooltip-body{min-block-size:var(--tooltip-close-size)}.c-tooltip.is-dismissible.has-action:not(.has-heading) .c-tooltip-body{display:grid;align-content:center}.c-tooltip-close{position:absolute;inset-block-start:var(--dt-spacing-b);inset-inline-end:var(--dt-spacing-b)}.c-tooltip--top:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--top-start:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom-start:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left-start:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right-start:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--top-end:before{content:"";position:absolute;inset-block-start:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--bottom-end:before{content:"";position:absolute;inset-block-end:100%;block-size:var(--tooltip-layer-offset);inset-inline-start:0;inline-size:100%}.c-tooltip--left-end:before{content:"";position:absolute;inset-inline-start:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}.c-tooltip--right-end:before{content:"";position:absolute;inset-inline-end:100%;inline-size:var(--tooltip-layer-offset);inset-block-start:0;block-size:100%}';
|
|
38
|
+
var j = Object.defineProperty, N = Object.getOwnPropertyDescriptor, c = (t, o, i, r) => {
|
|
39
|
+
for (var e = r > 1 ? void 0 : r ? N(o, i) : o, s = t.length - 1, n; s >= 0; s--)
|
|
40
|
+
(n = t[s]) && (e = (r ? n(o, i, e) : n(e)) || e);
|
|
41
|
+
return r && e && j(o, i, e), e;
|
|
42
42
|
};
|
|
43
|
-
const
|
|
44
|
-
const
|
|
43
|
+
const X = 5, O = () => new Promise(requestAnimationFrame), U = (t) => {
|
|
44
|
+
const o = (r) => !!r && r !== "none";
|
|
45
45
|
return [
|
|
46
46
|
t.transform,
|
|
47
47
|
t.perspective,
|
|
@@ -50,65 +50,40 @@ const et = 5, B = () => new Promise(requestAnimationFrame), rt = (t) => {
|
|
|
50
50
|
t.translate,
|
|
51
51
|
t.rotate,
|
|
52
52
|
t.scale
|
|
53
|
-
].some(
|
|
54
|
-
},
|
|
55
|
-
const { documentElement:
|
|
56
|
-
let
|
|
57
|
-
for (;
|
|
58
|
-
const
|
|
53
|
+
].some(o) || /\b(paint|layout|content|strict)\b/.test(t.contain) || t.containerType && t.containerType !== "normal" ? !0 : /\b(transform|perspective|filter|backdrop-filter|contain|translate|rotate|scale)\b/.test(t.willChange);
|
|
54
|
+
}, k = (t) => {
|
|
55
|
+
const { documentElement: o } = t.ownerDocument, i = [];
|
|
56
|
+
let r = t;
|
|
57
|
+
for (; r !== o; ) {
|
|
58
|
+
const e = r.assignedSlot ?? r.parentNode, s = e instanceof ShadowRoot ? e.host : e;
|
|
59
59
|
if (!(s instanceof Element))
|
|
60
60
|
break;
|
|
61
|
-
|
|
61
|
+
i.push(s), r = s;
|
|
62
62
|
}
|
|
63
|
-
return
|
|
64
|
-
},
|
|
65
|
-
const { documentElement:
|
|
66
|
-
return
|
|
67
|
-
if (
|
|
63
|
+
return i;
|
|
64
|
+
}, Y = (t) => {
|
|
65
|
+
const { documentElement: o, body: i } = t.ownerDocument;
|
|
66
|
+
return k(t).filter((r) => {
|
|
67
|
+
if (r === o || r === i)
|
|
68
68
|
return !1;
|
|
69
|
-
const
|
|
70
|
-
return
|
|
69
|
+
const e = getComputedStyle(r);
|
|
70
|
+
return e.overflowX !== "visible" || e.overflowY !== "visible";
|
|
71
71
|
});
|
|
72
|
-
},
|
|
73
|
-
const { left:
|
|
74
|
-
clientLeft:
|
|
75
|
-
clientTop:
|
|
72
|
+
}, W = (t) => {
|
|
73
|
+
const { left: o, top: i } = t.getBoundingClientRect(), {
|
|
74
|
+
clientLeft: r,
|
|
75
|
+
clientTop: e,
|
|
76
76
|
clientWidth: s,
|
|
77
77
|
clientHeight: n
|
|
78
78
|
} = t;
|
|
79
|
-
return new DOMRect(
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
}, nt = {
|
|
84
|
-
top: "bottom",
|
|
85
|
-
bottom: "top",
|
|
86
|
-
left: "right",
|
|
87
|
-
right: "left"
|
|
88
|
-
}, lt = {
|
|
89
|
-
top: ["left", "right"],
|
|
90
|
-
bottom: ["left", "right"],
|
|
91
|
-
left: ["top", "bottom"],
|
|
92
|
-
right: ["top", "bottom"]
|
|
93
|
-
}, at = (t) => {
|
|
94
|
-
const i = /^(top|bottom|left|right)(-start|-end)?$/.exec(t ?? "");
|
|
95
|
-
return i ? { side: i[1], alignment: i[2] ?? "" } : { side: "top", alignment: "" };
|
|
96
|
-
}, ct = (t, i) => i ? t === "left" ? "right" : t === "right" ? "left" : t : t, pt = (t, i, o, e, r, s, n) => {
|
|
97
|
-
const l = ct(t, n), h = l === "top" || l === "bottom";
|
|
98
|
-
let a = 0, v = 0;
|
|
99
|
-
return l === "top" ? v = o.top - s - r : l === "bottom" ? v = o.bottom + s : l === "left" ? a = o.left - s - e : a = o.right + s, h ? i === "" ? a = o.left + o.width / 2 - e / 2 : i === "-start" ? a = n ? o.right - e : o.left : a = n ? o.left : o.right - e : i === "" ? v = o.top + o.height / 2 - r / 2 : v = i === "-start" ? o.top : o.bottom - r, {
|
|
100
|
-
left: a,
|
|
101
|
-
top: v,
|
|
102
|
-
right: a + e,
|
|
103
|
-
bottom: v + r
|
|
104
|
-
};
|
|
105
|
-
}, dt = (t, i) => i.left >= t.left && i.right <= t.right && i.top >= t.top && i.bottom <= t.bottom, ht = (t, i) => {
|
|
106
|
-
const o = Math.min(t.right, i.right) - Math.max(t.left, i.left), e = Math.min(t.bottom, i.bottom) - Math.max(t.top, i.top);
|
|
107
|
-
return Math.max(0, o) * Math.max(0, e);
|
|
79
|
+
return new DOMRect(o + r, i + e, s, n);
|
|
80
|
+
}, G = (t, o) => {
|
|
81
|
+
const i = Math.max(t.left, o.left), r = Math.max(t.top, o.top), e = Math.min(t.right, o.right), s = Math.min(t.bottom, o.bottom);
|
|
82
|
+
return e <= i || s <= r ? null : new DOMRect(i, r, e - i, s - r);
|
|
108
83
|
};
|
|
109
|
-
let
|
|
84
|
+
let l = class extends _ {
|
|
110
85
|
constructor() {
|
|
111
|
-
super(...arguments), this.isOpen =
|
|
86
|
+
super(...arguments), this.isOpen = g.isOpen, this.position = g.position, this.size = g.size, this.variant = g.variant, this.type = g.type, this.isDismissible = g.isDismissible, this.headingLevel = g.headingLevel, this.triggers = [], this._isPositioned = !1, this._isAnchorVisible = !0, this._clippedTriggerElement = null, this._triggerClippers = [], this._overlayModeDirty = !0, this._reanchorFrame = 0, this._openedByClick = !1, this._instanceId = crypto.randomUUID();
|
|
112
87
|
}
|
|
113
88
|
get _headingId() {
|
|
114
89
|
return `pie-tooltip-heading-${this._instanceId}`;
|
|
@@ -121,10 +96,8 @@ let c = class extends E {
|
|
|
121
96
|
this.resolveMode(), this._overlayModeDirty = !0, this.resolveOverlayMode(), this.projectOverTrigger(), this._rebuildInteractionListeners();
|
|
122
97
|
}
|
|
123
98
|
updated(t) {
|
|
124
|
-
const
|
|
125
|
-
this.isOpen && t.has("isOpen") && (this._overlayModeDirty = !0), this.isOpen || (this._openedByClick = !1), t.has("trigger") && (this._overlayModeDirty = !0);
|
|
126
|
-
const o = i.some((e) => t.has(e));
|
|
127
|
-
o && (this._collisionSignature = null), this.resolveOverlayMode(), o && this.projectOverTrigger(), this.isOpen && t.has("trigger") && this.stopTrackingTrigger(), this.isOpen ? this.startTrackingTrigger() : this.stopTrackingTrigger(), (t.has("triggers") || t.has("trigger")) && this._rebuildInteractionListeners();
|
|
99
|
+
const o = ["trigger", "isOpen", "position", "size"];
|
|
100
|
+
this.isOpen && t.has("isOpen") && (this._overlayModeDirty = !0), this.isOpen || (this._openedByClick = !1), t.has("trigger") && (this._overlayModeDirty = !0), this.resolveOverlayMode(), o.some((i) => t.has(i)) && this.projectOverTrigger(), this.isOpen && t.has("trigger") && this.stopTrackingTrigger(), this.isOpen ? this.startTrackingTrigger() : this.stopTrackingTrigger(), (t.has("triggers") || t.has("trigger")) && this._rebuildInteractionListeners();
|
|
128
101
|
}
|
|
129
102
|
disconnectedCallback() {
|
|
130
103
|
this._teardownInteractionListeners(), this.stopTrackingTrigger(), super.disconnectedCallback();
|
|
@@ -132,50 +105,50 @@ let c = class extends E {
|
|
|
132
105
|
async focusPanel() {
|
|
133
106
|
if (this._mode !== "dialog")
|
|
134
107
|
return !1;
|
|
135
|
-
await this.updateComplete, await
|
|
136
|
-
const t = this.renderRoot.querySelector(`.${
|
|
108
|
+
await this.updateComplete, await O();
|
|
109
|
+
const t = this.renderRoot.querySelector(`.${a}-content`);
|
|
137
110
|
if (!t)
|
|
138
111
|
return !1;
|
|
139
|
-
const
|
|
140
|
-
var
|
|
141
|
-
return ((
|
|
112
|
+
const o = () => {
|
|
113
|
+
var i;
|
|
114
|
+
return ((i = this.shadowRoot) == null ? void 0 : i.activeElement) === t;
|
|
142
115
|
};
|
|
143
|
-
for (let
|
|
144
|
-
if (t.focus({ preventScroll: !0 }),
|
|
116
|
+
for (let i = 0; i < X; i++) {
|
|
117
|
+
if (t.focus({ preventScroll: !0 }), o())
|
|
145
118
|
return !0;
|
|
146
|
-
await
|
|
119
|
+
await O();
|
|
147
120
|
}
|
|
148
121
|
return !1;
|
|
149
122
|
}
|
|
150
123
|
startTrackingTrigger() {
|
|
151
124
|
if (this._triggerTrackingController)
|
|
152
125
|
return;
|
|
153
|
-
const t = new AbortController(), { signal:
|
|
126
|
+
const t = new AbortController(), { signal: o } = t, i = () => {
|
|
154
127
|
this._reanchorFrame || (this._reanchorFrame = requestAnimationFrame(() => {
|
|
155
128
|
this._reanchorFrame = 0, this.resolveOverlayMode(), this.projectOverTrigger();
|
|
156
129
|
}));
|
|
157
|
-
},
|
|
158
|
-
this._overlayModeDirty = !0,
|
|
130
|
+
}, r = () => {
|
|
131
|
+
this._overlayModeDirty = !0, i();
|
|
159
132
|
};
|
|
160
|
-
window.addEventListener("scroll",
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
}),
|
|
166
|
-
n.addEventListener("scroll",
|
|
133
|
+
window.addEventListener("scroll", i, { capture: !0, passive: !0, signal: o }), window.addEventListener("resize", r, { passive: !0, signal: o });
|
|
134
|
+
const e = /* @__PURE__ */ new Set();
|
|
135
|
+
k(this).forEach((n) => {
|
|
136
|
+
const d = n.getRootNode();
|
|
137
|
+
d instanceof ShadowRoot && e.add(d);
|
|
138
|
+
}), e.forEach((n) => {
|
|
139
|
+
n.addEventListener("scroll", i, { capture: !0, passive: !0, signal: o });
|
|
167
140
|
}), this._triggerObserver = new ResizeObserver(() => {
|
|
168
|
-
this._overlayModeDirty = !0,
|
|
141
|
+
this._overlayModeDirty = !0, i();
|
|
169
142
|
});
|
|
170
143
|
const s = this._getTriggerElement();
|
|
171
|
-
s && this._triggerObserver.observe(s), this._directionObserver = new MutationObserver(
|
|
144
|
+
s && this._triggerObserver.observe(s), this._directionObserver = new MutationObserver(i), this._directionObserver.observe(this.ownerDocument.documentElement, {
|
|
172
145
|
attributeFilter: ["dir"],
|
|
173
146
|
subtree: !0
|
|
174
147
|
}), this._triggerTrackingController = t;
|
|
175
148
|
}
|
|
176
149
|
stopTrackingTrigger() {
|
|
177
|
-
var t,
|
|
178
|
-
(t = this._triggerTrackingController) == null || t.abort(), this._triggerTrackingController = void 0, (
|
|
150
|
+
var t, o, i;
|
|
151
|
+
(t = this._triggerTrackingController) == null || t.abort(), this._triggerTrackingController = void 0, (o = this._directionObserver) == null || o.disconnect(), this._directionObserver = void 0, (i = this._triggerObserver) == null || i.disconnect(), this._triggerObserver = void 0, this._reanchorFrame && (cancelAnimationFrame(this._reanchorFrame), this._reanchorFrame = 0);
|
|
179
152
|
}
|
|
180
153
|
resolveMode() {
|
|
181
154
|
this._hasActionContent = this._assignedActionElements.length > 0;
|
|
@@ -184,108 +157,49 @@ let c = class extends E {
|
|
|
184
157
|
if (!this._overlayModeDirty)
|
|
185
158
|
return;
|
|
186
159
|
this._overlayModeDirty = !1;
|
|
187
|
-
let t = !1,
|
|
188
|
-
const
|
|
189
|
-
this._refreshTriggerClippers(),
|
|
190
|
-
const h = getComputedStyle(
|
|
160
|
+
let t = !1, o = !1;
|
|
161
|
+
const i = [], r = [], { documentElement: e, body: s } = this.ownerDocument;
|
|
162
|
+
this._refreshTriggerClippers(), k(this).forEach((d) => {
|
|
163
|
+
const h = getComputedStyle(d);
|
|
191
164
|
if (h.display === "contents")
|
|
192
165
|
return;
|
|
193
|
-
const
|
|
194
|
-
(
|
|
166
|
+
const f = U(h);
|
|
167
|
+
(f || h.position !== "static") && (t = !0), f && (o = !0), (h.overflowX !== "visible" || h.overflowY !== "visible") && !(d === e || d === s) && (t && i.push(d), o && r.push(d));
|
|
195
168
|
});
|
|
196
|
-
const n =
|
|
197
|
-
this.style.position = n ? "fixed" : ""
|
|
169
|
+
const n = r.length < i.length;
|
|
170
|
+
this.style.position = n ? "fixed" : "";
|
|
198
171
|
}
|
|
199
172
|
projectOverTrigger() {
|
|
200
173
|
this._isPositioned = !1;
|
|
201
174
|
const t = this._getTriggerElement();
|
|
202
175
|
if (!t || !this._originElement) {
|
|
203
|
-
["top", "left", "width", "height"].forEach((
|
|
204
|
-
this.style.removeProperty(`--tooltip-anchor-${
|
|
176
|
+
["top", "left", "width", "height"].forEach((f) => {
|
|
177
|
+
this.style.removeProperty(`--tooltip-anchor-${f}`);
|
|
205
178
|
}), this.style.removeProperty("--tooltip-container-inline-size"), this._isAnchorVisible = !0, this._isPositioned = !0;
|
|
206
179
|
return;
|
|
207
180
|
}
|
|
208
181
|
t !== this._clippedTriggerElement && this._refreshTriggerClippers();
|
|
209
|
-
const
|
|
210
|
-
(
|
|
182
|
+
const o = this._triggerClippers.reduce(
|
|
183
|
+
(f, u) => f ? G(f, W(u)) : null,
|
|
211
184
|
t.getBoundingClientRect()
|
|
212
185
|
);
|
|
213
|
-
if (this._isAnchorVisible =
|
|
186
|
+
if (this._isAnchorVisible = o !== null, !o) {
|
|
214
187
|
this._isPositioned = !0;
|
|
215
188
|
return;
|
|
216
189
|
}
|
|
217
|
-
const
|
|
218
|
-
top:
|
|
219
|
-
left:
|
|
190
|
+
const i = this._originElement.getBoundingClientRect(), {
|
|
191
|
+
top: r,
|
|
192
|
+
left: e,
|
|
220
193
|
width: s,
|
|
221
194
|
height: n
|
|
222
|
-
} =
|
|
223
|
-
this.style.setProperty("--tooltip-anchor-top", `${
|
|
224
|
-
const
|
|
225
|
-
this.style.setProperty("--tooltip-container-inline-size", `${h}px`), this.
|
|
226
|
-
}
|
|
227
|
-
resolveCollision(t) {
|
|
228
|
-
const i = this.renderRoot.querySelector(`.${p}`);
|
|
229
|
-
if (!i)
|
|
230
|
-
return;
|
|
231
|
-
const o = this._getCollisionBoundary();
|
|
232
|
-
if (!o) {
|
|
233
|
-
this._collisionSignature = null, this._setResolvedPosition(this.position ?? f.position);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const e = this.type === "icon", r = getComputedStyle(this), s = r.direction === "rtl", n = i.offsetWidth, l = i.offsetHeight, h = [
|
|
237
|
-
t.left,
|
|
238
|
-
t.top,
|
|
239
|
-
t.width,
|
|
240
|
-
t.height,
|
|
241
|
-
o.left,
|
|
242
|
-
o.top,
|
|
243
|
-
o.width,
|
|
244
|
-
o.height,
|
|
245
|
-
n,
|
|
246
|
-
l,
|
|
247
|
-
s
|
|
248
|
-
].join(":");
|
|
249
|
-
if (this._collisionSignature === h)
|
|
250
|
-
return;
|
|
251
|
-
this._collisionSignature = h;
|
|
252
|
-
const a = parseFloat(r.getPropertyValue("--tooltip-offset")) || 0, v = parseFloat(r.getPropertyValue("--tooltip-arrow-size")) || 0, y = e ? a : a + v, { side: x, alignment: C } = at(this.position ?? f.position);
|
|
253
|
-
let b, S, A = -1;
|
|
254
|
-
this._getCandidatePositions(x, C).some(({ side: $, alignment: O }) => {
|
|
255
|
-
const M = pt(
|
|
256
|
-
$,
|
|
257
|
-
O,
|
|
258
|
-
t,
|
|
259
|
-
n,
|
|
260
|
-
l,
|
|
261
|
-
y,
|
|
262
|
-
s
|
|
263
|
-
);
|
|
264
|
-
if (dt(o, M))
|
|
265
|
-
return b = { side: $, alignment: O }, !0;
|
|
266
|
-
const L = ht(o, M);
|
|
267
|
-
return L > A && (A = L, S = { side: $, alignment: O }), !1;
|
|
268
|
-
});
|
|
269
|
-
const T = b ?? S, V = T ? `${T.side}${T.alignment}` : this.position ?? f.position;
|
|
270
|
-
this._setResolvedPosition(V);
|
|
271
|
-
}
|
|
272
|
-
_setResolvedPosition(t) {
|
|
273
|
-
this._resolvedPosition !== t && (this._resolvedPosition = t);
|
|
274
|
-
}
|
|
275
|
-
_getCollisionBoundary() {
|
|
276
|
-
const { documentElement: t } = this.ownerDocument, i = new DOMRect(0, 0, t.clientWidth, t.clientHeight);
|
|
277
|
-
return this._overlayClippers.reduce(
|
|
278
|
-
(o, e) => o ? R(o, I(e)) : null,
|
|
279
|
-
i
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
_getCandidatePositions(t, i) {
|
|
283
|
-
const o = [t, nt[t], ...lt[t]], e = ["", "-start", "-end"];
|
|
284
|
-
return o.flatMap((r) => [i, ...e.filter((n) => n !== i)].map((n) => ({ side: r, alignment: n })));
|
|
195
|
+
} = o;
|
|
196
|
+
this.style.setProperty("--tooltip-anchor-top", `${r - i.top}px`), this.style.setProperty("--tooltip-anchor-left", `${e - i.left}px`), this.style.setProperty("--tooltip-anchor-width", `${s}px`), this.style.setProperty("--tooltip-anchor-height", `${n}px`);
|
|
197
|
+
const d = t.parentElement, h = d ? d.getBoundingClientRect().width : s;
|
|
198
|
+
this.style.setProperty("--tooltip-container-inline-size", `${h}px`), this._isPositioned = !0;
|
|
285
199
|
}
|
|
286
200
|
_refreshTriggerClippers() {
|
|
287
201
|
const t = this._getTriggerElement();
|
|
288
|
-
this._clippedTriggerElement = t, this._triggerClippers = t ?
|
|
202
|
+
this._clippedTriggerElement = t, this._triggerClippers = t ? Y(t) : [];
|
|
289
203
|
}
|
|
290
204
|
handleCloseButtonClick() {
|
|
291
205
|
this._requestClose();
|
|
@@ -294,10 +208,10 @@ let c = class extends E {
|
|
|
294
208
|
return this.trigger ? this.ownerDocument.getElementById(this.trigger) : null;
|
|
295
209
|
}
|
|
296
210
|
_requestOpen() {
|
|
297
|
-
this.isOpen || this.dispatchEvent(new Event(
|
|
211
|
+
this.isOpen || this.dispatchEvent(new Event(F, { bubbles: !0, composed: !0 }));
|
|
298
212
|
}
|
|
299
213
|
_requestClose() {
|
|
300
|
-
this.isOpen && this.dispatchEvent(new Event(
|
|
214
|
+
this.isOpen && this.dispatchEvent(new Event(V, { bubbles: !0, composed: !0 }));
|
|
301
215
|
}
|
|
302
216
|
_startHoverCloseTimer() {
|
|
303
217
|
this._hoverCloseTimer === void 0 && (this._hoverCloseTimer = setTimeout(() => {
|
|
@@ -308,34 +222,34 @@ let c = class extends E {
|
|
|
308
222
|
this._hoverCloseTimer !== void 0 && (clearTimeout(this._hoverCloseTimer), this._hoverCloseTimer = void 0);
|
|
309
223
|
}
|
|
310
224
|
_rebuildInteractionListeners() {
|
|
311
|
-
var
|
|
225
|
+
var r;
|
|
312
226
|
this._teardownInteractionListeners();
|
|
313
|
-
const t = new AbortController(), { signal:
|
|
314
|
-
if (this._interactionController = t, this.ownerDocument.addEventListener("keydown", (
|
|
315
|
-
|
|
316
|
-
}, { signal:
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
227
|
+
const t = new AbortController(), { signal: o } = t;
|
|
228
|
+
if (this._interactionController = t, this.ownerDocument.addEventListener("keydown", (e) => {
|
|
229
|
+
e.key === "Escape" && this.isOpen && this._requestClose();
|
|
230
|
+
}, { signal: o }), !((r = this.triggers) != null && r.length)) return;
|
|
231
|
+
const i = this._getTriggerElement();
|
|
232
|
+
if (i) {
|
|
319
233
|
if (this.triggers.includes("hover")) {
|
|
320
|
-
|
|
234
|
+
i.addEventListener("mouseenter", () => {
|
|
321
235
|
this._cancelHoverCloseTimer(), this._requestOpen();
|
|
322
|
-
}, { signal:
|
|
236
|
+
}, { signal: o }), i.addEventListener("mouseleave", () => {
|
|
323
237
|
this._startHoverCloseTimer();
|
|
324
|
-
}, { signal:
|
|
325
|
-
const
|
|
326
|
-
|
|
238
|
+
}, { signal: o });
|
|
239
|
+
const e = this.renderRoot.querySelector(".c-tooltip");
|
|
240
|
+
e && (e.addEventListener("mouseenter", () => {
|
|
327
241
|
this._cancelHoverCloseTimer();
|
|
328
|
-
}, { signal:
|
|
242
|
+
}, { signal: o }), e.addEventListener("mouseleave", () => {
|
|
329
243
|
this._startHoverCloseTimer();
|
|
330
|
-
}, { signal:
|
|
244
|
+
}, { signal: o }));
|
|
331
245
|
}
|
|
332
|
-
this.triggers.includes("focus") && (
|
|
246
|
+
this.triggers.includes("focus") && (i.addEventListener("focusin", () => {
|
|
333
247
|
this._requestOpen();
|
|
334
|
-
}, { signal:
|
|
335
|
-
const s =
|
|
248
|
+
}, { signal: o }), i.addEventListener("focusout", (e) => {
|
|
249
|
+
const s = e.relatedTarget;
|
|
336
250
|
s && (this.contains(s) || s === this) || this._requestClose();
|
|
337
|
-
}, { signal:
|
|
338
|
-
if (
|
|
251
|
+
}, { signal: o })), this.triggers.includes("click") && (i.addEventListener("click", (e) => {
|
|
252
|
+
if (e.stopPropagation(), !this.isOpen) {
|
|
339
253
|
this._openedByClick = !0, this._requestOpen();
|
|
340
254
|
return;
|
|
341
255
|
}
|
|
@@ -344,11 +258,11 @@ let c = class extends E {
|
|
|
344
258
|
return;
|
|
345
259
|
}
|
|
346
260
|
this._requestClose();
|
|
347
|
-
}, { signal:
|
|
261
|
+
}, { signal: o }), this.ownerDocument.addEventListener("click", (e) => {
|
|
348
262
|
var h;
|
|
349
|
-
const s =
|
|
350
|
-
!n && !
|
|
351
|
-
}, { signal:
|
|
263
|
+
const s = e.composedPath()[0], n = this.contains(s) || ((h = this.shadowRoot) == null ? void 0 : h.contains(s)), d = i.contains(s) || s === i;
|
|
264
|
+
!n && !d && this.isOpen && this._requestClose();
|
|
265
|
+
}, { signal: o }));
|
|
352
266
|
}
|
|
353
267
|
}
|
|
354
268
|
_teardownInteractionListeners() {
|
|
@@ -356,18 +270,18 @@ let c = class extends E {
|
|
|
356
270
|
(t = this._interactionController) == null || t.abort(), this._interactionController = void 0, this._cancelHoverCloseTimer();
|
|
357
271
|
}
|
|
358
272
|
renderHeading() {
|
|
359
|
-
const t =
|
|
360
|
-
return
|
|
273
|
+
const t = M(this.headingLevel);
|
|
274
|
+
return y`<${t}
|
|
361
275
|
id="${this._headingId}"
|
|
362
|
-
class="${
|
|
363
|
-
data-test-id="${
|
|
276
|
+
class="${a}-heading"
|
|
277
|
+
data-test-id="${p}-heading">${this.heading}</${t}>`;
|
|
364
278
|
}
|
|
365
279
|
renderCloseButton() {
|
|
366
280
|
var t;
|
|
367
|
-
return
|
|
281
|
+
return y`
|
|
368
282
|
<pie-icon-button
|
|
369
|
-
class="${
|
|
370
|
-
data-test-id="${
|
|
283
|
+
class="${a}-close"
|
|
284
|
+
data-test-id="${p}-close"
|
|
371
285
|
size="xsmall"
|
|
372
286
|
variant="${this.variant === "inverse" ? "ghost-secondary" : "ghost-inverse"}"
|
|
373
287
|
.aria="${{ label: (t = this.aria) == null ? void 0 : t.close }}"
|
|
@@ -378,134 +292,130 @@ let c = class extends E {
|
|
|
378
292
|
render() {
|
|
379
293
|
const {
|
|
380
294
|
aria: t,
|
|
381
|
-
heading:
|
|
382
|
-
isDismissible:
|
|
383
|
-
isOpen:
|
|
384
|
-
position:
|
|
295
|
+
heading: o,
|
|
296
|
+
isDismissible: i,
|
|
297
|
+
isOpen: r,
|
|
298
|
+
position: e,
|
|
385
299
|
size: s,
|
|
386
300
|
type: n,
|
|
387
|
-
variant:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
[`${
|
|
392
|
-
[`${
|
|
393
|
-
|
|
394
|
-
"is-open": !!e,
|
|
301
|
+
variant: d,
|
|
302
|
+
_mode: h
|
|
303
|
+
} = this, f = n === "icon", u = {
|
|
304
|
+
[`${a}-layer`]: !0,
|
|
305
|
+
[`${a}-layer--${e}`]: !0,
|
|
306
|
+
[`${a}-layer--type-${n}`]: !0,
|
|
307
|
+
"is-open": !!r,
|
|
395
308
|
"is-positioned": this._isPositioned,
|
|
396
309
|
"is-anchorVisible": this._isAnchorVisible
|
|
397
310
|
}, C = {
|
|
398
|
-
[
|
|
399
|
-
[`${
|
|
400
|
-
[`${
|
|
401
|
-
[`${
|
|
402
|
-
[`${
|
|
403
|
-
"is-dismissible": !!
|
|
311
|
+
[a]: !0,
|
|
312
|
+
[`${a}--${e}`]: !0,
|
|
313
|
+
[`${a}--${d}`]: !0,
|
|
314
|
+
[`${a}--type-${n}`]: !0,
|
|
315
|
+
[`${a}--size-${s}`]: !f,
|
|
316
|
+
"is-dismissible": !!i,
|
|
404
317
|
"has-action": this._hasActionContent === !0,
|
|
405
|
-
"has-heading": !!
|
|
406
|
-
},
|
|
407
|
-
return
|
|
408
|
-
<div class="${
|
|
409
|
-
<div class="${
|
|
410
|
-
<div class="${
|
|
318
|
+
"has-heading": !!o
|
|
319
|
+
}, z = h === "dialog";
|
|
320
|
+
return y`
|
|
321
|
+
<div class="${a}-origin" data-test-id="${p}-origin"></div>
|
|
322
|
+
<div class="${a}-anchor" data-test-id="${p}-anchor">
|
|
323
|
+
<div class="${T(u)}" data-test-id="${p}-layer">
|
|
411
324
|
<div
|
|
412
|
-
class="${
|
|
413
|
-
data-test-id="${
|
|
414
|
-
role="${
|
|
415
|
-
aria-hidden="${!
|
|
416
|
-
aria-labelledby="${
|
|
417
|
-
aria-label="${
|
|
418
|
-
${
|
|
419
|
-
<div class="${
|
|
420
|
-
${
|
|
325
|
+
class="${T(C)}"
|
|
326
|
+
data-test-id="${p}"
|
|
327
|
+
role="${D(h)}"
|
|
328
|
+
aria-hidden="${!r}"
|
|
329
|
+
aria-labelledby="${z && o ? this._headingId : b}"
|
|
330
|
+
aria-label="${z && !o && (t != null && t.label) ? t.label : b}">
|
|
331
|
+
${f ? b : y`<div class="${a}-arrow" data-test-id="${p}-arrow"></div>`}
|
|
332
|
+
<div class="${a}-body">
|
|
333
|
+
${o ? this.renderHeading() : b}
|
|
421
334
|
<div
|
|
422
|
-
class="${
|
|
423
|
-
tabindex="${
|
|
424
|
-
data-test-id="${
|
|
335
|
+
class="${a}-content"
|
|
336
|
+
tabindex="${z ? -1 : b}"
|
|
337
|
+
data-test-id="${p}-content">
|
|
425
338
|
<slot name="content"></slot>
|
|
426
339
|
</div>
|
|
427
340
|
</div>
|
|
428
|
-
<div class="${
|
|
341
|
+
<div class="${a}-action" data-test-id="${p}-action">
|
|
429
342
|
<slot name="action" @slotchange="${this.resolveMode}"></slot>
|
|
430
343
|
</div>
|
|
431
|
-
${
|
|
344
|
+
${i ? this.renderCloseButton() : b}
|
|
432
345
|
</div>
|
|
433
346
|
</div>
|
|
434
347
|
</div>`;
|
|
435
348
|
}
|
|
436
349
|
};
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
],
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
],
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
],
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
],
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
],
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
],
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
],
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
],
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
],
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
],
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
],
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
],
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
],
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
],
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
],
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
],
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
],
|
|
494
|
-
c = d([
|
|
495
|
-
U("pie-tooltip")
|
|
496
|
-
], c);
|
|
350
|
+
l.styles = E(H);
|
|
351
|
+
c([
|
|
352
|
+
v({ type: String })
|
|
353
|
+
], l.prototype, "trigger", 2);
|
|
354
|
+
c([
|
|
355
|
+
v({ type: Boolean })
|
|
356
|
+
], l.prototype, "isOpen", 2);
|
|
357
|
+
c([
|
|
358
|
+
v({ type: String }),
|
|
359
|
+
m(p, S, g.position)
|
|
360
|
+
], l.prototype, "position", 2);
|
|
361
|
+
c([
|
|
362
|
+
v({ type: String }),
|
|
363
|
+
m(p, B, g.size)
|
|
364
|
+
], l.prototype, "size", 2);
|
|
365
|
+
c([
|
|
366
|
+
v({ type: String }),
|
|
367
|
+
m(p, I, g.variant)
|
|
368
|
+
], l.prototype, "variant", 2);
|
|
369
|
+
c([
|
|
370
|
+
v({ type: String }),
|
|
371
|
+
m(p, R, g.type)
|
|
372
|
+
], l.prototype, "type", 2);
|
|
373
|
+
c([
|
|
374
|
+
v({ type: Boolean })
|
|
375
|
+
], l.prototype, "isDismissible", 2);
|
|
376
|
+
c([
|
|
377
|
+
v({ type: String })
|
|
378
|
+
], l.prototype, "heading", 2);
|
|
379
|
+
c([
|
|
380
|
+
v({ type: String }),
|
|
381
|
+
m(p, q, g.headingLevel)
|
|
382
|
+
], l.prototype, "headingLevel", 2);
|
|
383
|
+
c([
|
|
384
|
+
v({ type: Object })
|
|
385
|
+
], l.prototype, "aria", 2);
|
|
386
|
+
c([
|
|
387
|
+
v({ type: Array })
|
|
388
|
+
], l.prototype, "triggers", 2);
|
|
389
|
+
c([
|
|
390
|
+
A({ slot: "action" })
|
|
391
|
+
], l.prototype, "_assignedActionElements", 2);
|
|
392
|
+
c([
|
|
393
|
+
L(".c-tooltip-origin")
|
|
394
|
+
], l.prototype, "_originElement", 2);
|
|
395
|
+
c([
|
|
396
|
+
x()
|
|
397
|
+
], l.prototype, "_hasActionContent", 2);
|
|
398
|
+
c([
|
|
399
|
+
x()
|
|
400
|
+
], l.prototype, "_isPositioned", 2);
|
|
401
|
+
c([
|
|
402
|
+
x()
|
|
403
|
+
], l.prototype, "_isAnchorVisible", 2);
|
|
404
|
+
l = c([
|
|
405
|
+
P("pie-tooltip")
|
|
406
|
+
], l);
|
|
497
407
|
export {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
408
|
+
V as ON_TOOLTIP_CLOSE_EVENT,
|
|
409
|
+
F as ON_TOOLTIP_OPEN_EVENT,
|
|
410
|
+
l as PieTooltip,
|
|
411
|
+
a as componentClass,
|
|
412
|
+
p as componentSelector,
|
|
413
|
+
g as defaultProps,
|
|
414
|
+
q as headingLevels,
|
|
415
|
+
st as modes,
|
|
416
|
+
S as positions,
|
|
417
|
+
B as sizes,
|
|
418
|
+
rt as triggers,
|
|
419
|
+
R as types,
|
|
420
|
+
I as variants
|
|
511
421
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -55,11 +55,8 @@ declare class PieTooltip_2 extends PieElement implements TooltipProps {
|
|
|
55
55
|
private _hasActionContent;
|
|
56
56
|
private _isPositioned;
|
|
57
57
|
private _isAnchorVisible;
|
|
58
|
-
private _resolvedPosition;
|
|
59
58
|
private _clippedTriggerElement;
|
|
60
59
|
private _triggerClippers;
|
|
61
|
-
private _overlayClippers;
|
|
62
|
-
private _collisionSignature;
|
|
63
60
|
private _overlayModeDirty;
|
|
64
61
|
private _triggerTrackingController;
|
|
65
62
|
private _interactionController;
|
|
@@ -81,10 +78,6 @@ declare class PieTooltip_2 extends PieElement implements TooltipProps {
|
|
|
81
78
|
private resolveMode;
|
|
82
79
|
private resolveOverlayMode;
|
|
83
80
|
private projectOverTrigger;
|
|
84
|
-
private resolveCollision;
|
|
85
|
-
private _setResolvedPosition;
|
|
86
|
-
private _getCollisionBoundary;
|
|
87
|
-
private _getCandidatePositions;
|
|
88
81
|
private _refreshTriggerClippers;
|
|
89
82
|
private handleCloseButtonClick;
|
|
90
83
|
private _getTriggerElement;
|
|
@@ -117,7 +110,7 @@ export declare interface TooltipProps {
|
|
|
117
110
|
trigger?: string;
|
|
118
111
|
/** When true, the panel is visible. The component never writes to this property. */
|
|
119
112
|
isOpen?: boolean;
|
|
120
|
-
/** The
|
|
113
|
+
/** The side of the trigger the panel sits on, and its alignment along the cross axis. */
|
|
121
114
|
position?: typeof positions[number];
|
|
122
115
|
/** How the panel sizes itself. Not applied when `type` is `icon`. */
|
|
123
116
|
size?: typeof sizes[number];
|
package/package.json
CHANGED
package/src/defs.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface TooltipProps {
|
|
|
42
42
|
/** When true, the panel is visible. The component never writes to this property. */
|
|
43
43
|
isOpen?: boolean;
|
|
44
44
|
|
|
45
|
-
/** The
|
|
45
|
+
/** The side of the trigger the panel sits on, and its alignment along the cross axis. */
|
|
46
46
|
position?: typeof positions[number];
|
|
47
47
|
|
|
48
48
|
/** How the panel sizes itself. Not applied when `type` is `icon`. */
|
package/src/index.ts
CHANGED
|
@@ -125,115 +125,6 @@ const intersectRects = (a: DOMRect, b: DOMRect): DOMRect | null => {
|
|
|
125
125
|
return new DOMRect(left, top, right - left, bottom - top);
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
129
|
-
type TooltipAlignment = '' | '-start' | '-end';
|
|
130
|
-
|
|
131
|
-
interface CandidateRect {
|
|
132
|
-
left: number;
|
|
133
|
-
top: number;
|
|
134
|
-
right: number;
|
|
135
|
-
bottom: number;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const oppositeSide: Record<TooltipSide, TooltipSide> = {
|
|
139
|
-
top: 'bottom',
|
|
140
|
-
bottom: 'top',
|
|
141
|
-
left: 'right',
|
|
142
|
-
right: 'left',
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const crossSides: Record<TooltipSide, Array<TooltipSide>> = {
|
|
146
|
-
top: ['left', 'right'],
|
|
147
|
-
bottom: ['left', 'right'],
|
|
148
|
-
left: ['top', 'bottom'],
|
|
149
|
-
right: ['top', 'bottom'],
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const parsePosition = (position: TooltipProps['position']): { side: TooltipSide; alignment: TooltipAlignment } => {
|
|
153
|
-
const match = /^(top|bottom|left|right)(-start|-end)?$/.exec(position ?? '');
|
|
154
|
-
|
|
155
|
-
if (!match) {
|
|
156
|
-
return { side: 'top', alignment: '' };
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return { side: match[1] as TooltipSide, alignment: (match[2] ?? '') as TooltipAlignment };
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const toPhysicalSide = (side: TooltipSide, isRtl: boolean): TooltipSide => {
|
|
163
|
-
if (!isRtl) {
|
|
164
|
-
return side;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (side === 'left') {
|
|
168
|
-
return 'right';
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (side === 'right') {
|
|
172
|
-
return 'left';
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return side;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const getCandidateRect = (
|
|
179
|
-
side: TooltipSide,
|
|
180
|
-
alignment: TooltipAlignment,
|
|
181
|
-
anchor: DOMRect,
|
|
182
|
-
panelWidth: number,
|
|
183
|
-
panelHeight: number,
|
|
184
|
-
offset: number,
|
|
185
|
-
isRtl: boolean,
|
|
186
|
-
): CandidateRect => {
|
|
187
|
-
const physicalSide = toPhysicalSide(side, isRtl);
|
|
188
|
-
const isVerticalSide = physicalSide === 'top' || physicalSide === 'bottom';
|
|
189
|
-
|
|
190
|
-
let left = 0;
|
|
191
|
-
let top = 0;
|
|
192
|
-
|
|
193
|
-
if (physicalSide === 'top') {
|
|
194
|
-
top = anchor.top - offset - panelHeight;
|
|
195
|
-
} else if (physicalSide === 'bottom') {
|
|
196
|
-
top = anchor.bottom + offset;
|
|
197
|
-
} else if (physicalSide === 'left') {
|
|
198
|
-
left = anchor.left - offset - panelWidth;
|
|
199
|
-
} else {
|
|
200
|
-
left = anchor.right + offset;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (isVerticalSide) {
|
|
204
|
-
if (alignment === '') {
|
|
205
|
-
left = anchor.left + (anchor.width / 2) - (panelWidth / 2);
|
|
206
|
-
} else if (alignment === '-start') {
|
|
207
|
-
left = isRtl ? anchor.right - panelWidth : anchor.left;
|
|
208
|
-
} else {
|
|
209
|
-
left = isRtl ? anchor.left : anchor.right - panelWidth;
|
|
210
|
-
}
|
|
211
|
-
} else if (alignment === '') {
|
|
212
|
-
top = anchor.top + (anchor.height / 2) - (panelHeight / 2);
|
|
213
|
-
} else {
|
|
214
|
-
top = alignment === '-start' ? anchor.top : anchor.bottom - panelHeight;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
left,
|
|
219
|
-
top,
|
|
220
|
-
right: left + panelWidth,
|
|
221
|
-
bottom: top + panelHeight,
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
const containsRect = (boundary: DOMRect, rect: CandidateRect): boolean => rect.left >= boundary.left &&
|
|
226
|
-
rect.right <= boundary.right &&
|
|
227
|
-
rect.top >= boundary.top &&
|
|
228
|
-
rect.bottom <= boundary.bottom;
|
|
229
|
-
|
|
230
|
-
const getVisibleArea = (boundary: DOMRect, rect: CandidateRect): number => {
|
|
231
|
-
const width = Math.min(boundary.right, rect.right) - Math.max(boundary.left, rect.left);
|
|
232
|
-
const height = Math.min(boundary.bottom, rect.bottom) - Math.max(boundary.top, rect.top);
|
|
233
|
-
|
|
234
|
-
return Math.max(0, width) * Math.max(0, height);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
128
|
/**
|
|
238
129
|
* @tagname pie-tooltip
|
|
239
130
|
* @event {Event} pie-tooltip-open - When a configured trigger asks for the panel. Set `isOpen` to `true` in response.
|
|
@@ -291,16 +182,10 @@ export class PieTooltip extends PieElement implements TooltipProps {
|
|
|
291
182
|
|
|
292
183
|
@state() private _isAnchorVisible = true;
|
|
293
184
|
|
|
294
|
-
@state() private _resolvedPosition: TooltipProps['position'] | undefined;
|
|
295
|
-
|
|
296
185
|
private _clippedTriggerElement: Element | null = null;
|
|
297
186
|
|
|
298
187
|
private _triggerClippers: Array<Element> = [];
|
|
299
188
|
|
|
300
|
-
private _overlayClippers: Array<Element> = [];
|
|
301
|
-
|
|
302
|
-
private _collisionSignature: string | null = null;
|
|
303
|
-
|
|
304
189
|
private _overlayModeDirty = true;
|
|
305
190
|
|
|
306
191
|
private _triggerTrackingController: AbortController | undefined;
|
|
@@ -355,15 +240,9 @@ export class PieTooltip extends PieElement implements TooltipProps {
|
|
|
355
240
|
this._overlayModeDirty = true;
|
|
356
241
|
}
|
|
357
242
|
|
|
358
|
-
const isAnchoringChange = anchoringProperties.some((prop) => changedProperties.has(prop));
|
|
359
|
-
|
|
360
|
-
if (isAnchoringChange) {
|
|
361
|
-
this._collisionSignature = null;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
243
|
this.resolveOverlayMode();
|
|
365
244
|
|
|
366
|
-
if (
|
|
245
|
+
if (anchoringProperties.some((prop) => changedProperties.has(prop))) {
|
|
367
246
|
this.projectOverTrigger();
|
|
368
247
|
}
|
|
369
248
|
|
|
@@ -552,7 +431,6 @@ export class PieTooltip extends PieElement implements TooltipProps {
|
|
|
552
431
|
const useFixed = fixedClippingAncestors.length < absoluteClippingAncestors.length;
|
|
553
432
|
|
|
554
433
|
this.style.position = useFixed ? 'fixed' : '';
|
|
555
|
-
this._overlayClippers = useFixed ? fixedClippingAncestors : absoluteClippingAncestors;
|
|
556
434
|
}
|
|
557
435
|
|
|
558
436
|
private projectOverTrigger (): void {
|
|
@@ -603,121 +481,9 @@ export class PieTooltip extends PieElement implements TooltipProps {
|
|
|
603
481
|
|
|
604
482
|
this.style.setProperty('--tooltip-container-inline-size', `${containerInlineSize}px`);
|
|
605
483
|
|
|
606
|
-
this.resolveCollision(visibleRect);
|
|
607
|
-
|
|
608
484
|
this._isPositioned = true;
|
|
609
485
|
}
|
|
610
486
|
|
|
611
|
-
private resolveCollision (anchorRect: DOMRect): void {
|
|
612
|
-
const panel = this.renderRoot.querySelector<HTMLElement>(`.${componentClass}`);
|
|
613
|
-
|
|
614
|
-
if (!panel) {
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
const boundary = this._getCollisionBoundary();
|
|
619
|
-
|
|
620
|
-
if (!boundary) {
|
|
621
|
-
this._collisionSignature = null;
|
|
622
|
-
this._setResolvedPosition(this.position ?? defaultProps.position);
|
|
623
|
-
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
const isIconType = this.type === 'icon';
|
|
628
|
-
const hostStyles = getComputedStyle(this);
|
|
629
|
-
const isRtl = hostStyles.direction === 'rtl';
|
|
630
|
-
|
|
631
|
-
const panelWidth = panel.offsetWidth;
|
|
632
|
-
const panelHeight = panel.offsetHeight;
|
|
633
|
-
const signature = [
|
|
634
|
-
anchorRect.left, anchorRect.top, anchorRect.width, anchorRect.height,
|
|
635
|
-
boundary.left, boundary.top, boundary.width, boundary.height,
|
|
636
|
-
panelWidth, panelHeight,
|
|
637
|
-
isRtl,
|
|
638
|
-
].join(':');
|
|
639
|
-
|
|
640
|
-
if (this._collisionSignature === signature) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
this._collisionSignature = signature;
|
|
645
|
-
|
|
646
|
-
const offset = parseFloat(hostStyles.getPropertyValue('--tooltip-offset')) || 0;
|
|
647
|
-
const arrowSize = parseFloat(hostStyles.getPropertyValue('--tooltip-arrow-size')) || 0;
|
|
648
|
-
const layerOffset = isIconType ? offset : offset + arrowSize;
|
|
649
|
-
|
|
650
|
-
const { side: preferredSide, alignment: preferredAlignment } = parsePosition(this.position ?? defaultProps.position);
|
|
651
|
-
|
|
652
|
-
let fitting: { side: TooltipSide; alignment: TooltipAlignment } | undefined;
|
|
653
|
-
let bestFallback: { side: TooltipSide; alignment: TooltipAlignment } | undefined;
|
|
654
|
-
let bestArea = -1;
|
|
655
|
-
|
|
656
|
-
this._getCandidatePositions(preferredSide, preferredAlignment).some(({ side, alignment }) => {
|
|
657
|
-
const rect = getCandidateRect(
|
|
658
|
-
side,
|
|
659
|
-
alignment,
|
|
660
|
-
anchorRect,
|
|
661
|
-
panelWidth,
|
|
662
|
-
panelHeight,
|
|
663
|
-
layerOffset,
|
|
664
|
-
isRtl,
|
|
665
|
-
);
|
|
666
|
-
|
|
667
|
-
if (containsRect(boundary, rect)) {
|
|
668
|
-
fitting = { side, alignment };
|
|
669
|
-
|
|
670
|
-
return true;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
const area = getVisibleArea(boundary, rect);
|
|
674
|
-
|
|
675
|
-
if (area > bestArea) {
|
|
676
|
-
bestArea = area;
|
|
677
|
-
bestFallback = { side, alignment };
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
return false;
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
const resolved = fitting ?? bestFallback;
|
|
684
|
-
const resolvedPosition = resolved
|
|
685
|
-
? `${resolved.side}${resolved.alignment}` as TooltipProps['position']
|
|
686
|
-
: this.position ?? defaultProps.position;
|
|
687
|
-
|
|
688
|
-
this._setResolvedPosition(resolvedPosition);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
private _setResolvedPosition (position: TooltipProps['position']): void {
|
|
692
|
-
if (this._resolvedPosition !== position) {
|
|
693
|
-
this._resolvedPosition = position;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
private _getCollisionBoundary (): DOMRect | null {
|
|
698
|
-
const { documentElement } = this.ownerDocument;
|
|
699
|
-
const viewport = new DOMRect(0, 0, documentElement.clientWidth, documentElement.clientHeight);
|
|
700
|
-
|
|
701
|
-
return this._overlayClippers.reduce<DOMRect | null>(
|
|
702
|
-
(rect, clipper) => (rect ? intersectRects(rect, getClipRect(clipper)) : null),
|
|
703
|
-
viewport,
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
private _getCandidatePositions (
|
|
708
|
-
preferredSide: TooltipSide,
|
|
709
|
-
preferredAlignment: TooltipAlignment,
|
|
710
|
-
): Array<{ side: TooltipSide; alignment: TooltipAlignment }> {
|
|
711
|
-
const sideOrder: Array<TooltipSide> = [preferredSide, oppositeSide[preferredSide], ...crossSides[preferredSide]];
|
|
712
|
-
const allAlignments: Array<TooltipAlignment> = ['', '-start', '-end'];
|
|
713
|
-
|
|
714
|
-
return sideOrder.flatMap((side) => {
|
|
715
|
-
const alignments = [preferredAlignment, ...allAlignments.filter((alignment) => alignment !== preferredAlignment)];
|
|
716
|
-
|
|
717
|
-
return alignments.map((alignment) => ({ side, alignment }));
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
|
|
721
487
|
private _refreshTriggerClippers (): void {
|
|
722
488
|
const triggerElement = this._getTriggerElement();
|
|
723
489
|
|
|
@@ -886,15 +652,13 @@ export class PieTooltip extends PieElement implements TooltipProps {
|
|
|
886
652
|
heading,
|
|
887
653
|
isDismissible,
|
|
888
654
|
isOpen,
|
|
889
|
-
position
|
|
655
|
+
position,
|
|
890
656
|
size,
|
|
891
657
|
type,
|
|
892
658
|
variant,
|
|
893
|
-
_resolvedPosition,
|
|
894
659
|
_mode: mode,
|
|
895
660
|
} = this;
|
|
896
661
|
|
|
897
|
-
const position = _resolvedPosition ?? preferredPosition;
|
|
898
662
|
const isIconType = type === 'icon';
|
|
899
663
|
|
|
900
664
|
const layerClasses = {
|