@nectary/components 5.6.6 → 5.6.7
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/bundle.js +12 -2
- package/package.json +1 -1
- package/tooltip/index.js +12 -2
- package/tooltip/types.d.ts +5 -0
package/bundle.js
CHANGED
|
@@ -3427,7 +3427,7 @@ const getPopOrientation$1 = (orientation) => {
|
|
|
3427
3427
|
}
|
|
3428
3428
|
return orientation;
|
|
3429
3429
|
};
|
|
3430
|
-
const templateHTML$Q = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px;filter:drop-shadow(var(--sinch-comp-tooltip-shadow))}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;background-color:var(--sinch-local-color-background);border-radius:var(--sinch-comp-tooltip-shape-radius);pointer-events:none;opacity:0;--sinch-local-color-background:var(--sinch-comp-tooltip-color-background);--sinch-global-color-text:var(--sinch-comp-tooltip-color-text)}#text{word-break:break-word;pointer-events:none;--sinch-comp-text-font:var(--sinch-comp-tooltip-font-body)}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-local-color-background);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}:host([text-align=right]) #text{--sinch-comp-text-align:right}:host([text-align=center]) #text{--sinch-comp-text-align:center}:host([text-align=left]) #text{--sinch-comp-text-align:left}</style><sinch-pop id="pop"
|
|
3430
|
+
const templateHTML$Q = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px;filter:drop-shadow(var(--sinch-comp-tooltip-shadow))}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;background-color:var(--sinch-local-color-background);border-radius:var(--sinch-comp-tooltip-shape-radius);pointer-events:none;opacity:0;--sinch-local-color-background:var(--sinch-comp-tooltip-color-background);--sinch-global-color-text:var(--sinch-comp-tooltip-color-text)}#text{word-break:break-word;pointer-events:none;--sinch-comp-text-font:var(--sinch-comp-tooltip-font-body)}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-local-color-background);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}:host([text-align=right]) #text{--sinch-comp-text-align:right}:host([text-align=center]) #text{--sinch-comp-text-align:center}:host([text-align=left]) #text{--sinch-comp-text-align:left}</style><sinch-pop id="pop"><slot id="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><sinch-text id="text" type="s"></sinch-text><svg id="tip" width="8" height="4" aria-hidden="true"><path d="m4 4 4-4h-8l4 4Z"/></svg></div></div></sinch-pop>';
|
|
3431
3431
|
const TIP_SIZE$1 = 8;
|
|
3432
3432
|
const SHOW_DELAY_SLOW = 1e3;
|
|
3433
3433
|
const SHOW_DELAY_FAST = 250;
|
|
@@ -3497,7 +3497,8 @@ class Tooltip extends NectaryElement {
|
|
|
3497
3497
|
"type",
|
|
3498
3498
|
"aria-label",
|
|
3499
3499
|
"aria-description",
|
|
3500
|
-
"show-outside-viewport"
|
|
3500
|
+
"show-outside-viewport",
|
|
3501
|
+
"allow-scroll"
|
|
3501
3502
|
];
|
|
3502
3503
|
}
|
|
3503
3504
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -3544,6 +3545,11 @@ class Tooltip extends NectaryElement {
|
|
|
3544
3545
|
updateBooleanAttribute(this.#$pop, "disable-backdrop-close", false);
|
|
3545
3546
|
this.#tooltipState.hide();
|
|
3546
3547
|
}
|
|
3548
|
+
break;
|
|
3549
|
+
}
|
|
3550
|
+
case "allow-scroll": {
|
|
3551
|
+
updateAttribute(this.#$pop, "allow-scroll", newVal);
|
|
3552
|
+
break;
|
|
3547
3553
|
}
|
|
3548
3554
|
}
|
|
3549
3555
|
}
|
|
@@ -3650,6 +3656,10 @@ class Tooltip extends NectaryElement {
|
|
|
3650
3656
|
}
|
|
3651
3657
|
#updateTipOrientation = () => {
|
|
3652
3658
|
const orient = this.orientation;
|
|
3659
|
+
if (!("footprintRect" in this.#$pop)) {
|
|
3660
|
+
requestAnimationFrame(this.#updateTipOrientation);
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3653
3663
|
const targetRect = this.#$pop.footprintRect;
|
|
3654
3664
|
const contentRect = this.#$content.getBoundingClientRect();
|
|
3655
3665
|
const diffX = targetRect.x - contentRect.x;
|
package/package.json
CHANGED
package/tooltip/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { rectOverlap } from "../utils/rect.js";
|
|
|
6
6
|
import { getReactEventHandler } from "../utils/get-react-event-handler.js";
|
|
7
7
|
import { TooltipState } from "./tooltip-state.js";
|
|
8
8
|
import { getPopOrientation, orientationValues, textAlignValues, typeValues } from "./utils.js";
|
|
9
|
-
const templateHTML = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px;filter:drop-shadow(var(--sinch-comp-tooltip-shadow))}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;background-color:var(--sinch-local-color-background);border-radius:var(--sinch-comp-tooltip-shape-radius);pointer-events:none;opacity:0;--sinch-local-color-background:var(--sinch-comp-tooltip-color-background);--sinch-global-color-text:var(--sinch-comp-tooltip-color-text)}#text{word-break:break-word;pointer-events:none;--sinch-comp-text-font:var(--sinch-comp-tooltip-font-body)}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-local-color-background);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}:host([text-align=right]) #text{--sinch-comp-text-align:right}:host([text-align=center]) #text{--sinch-comp-text-align:center}:host([text-align=left]) #text{--sinch-comp-text-align:left}</style><sinch-pop id="pop"
|
|
9
|
+
const templateHTML = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px;filter:drop-shadow(var(--sinch-comp-tooltip-shadow))}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;background-color:var(--sinch-local-color-background);border-radius:var(--sinch-comp-tooltip-shape-radius);pointer-events:none;opacity:0;--sinch-local-color-background:var(--sinch-comp-tooltip-color-background);--sinch-global-color-text:var(--sinch-comp-tooltip-color-text)}#text{word-break:break-word;pointer-events:none;--sinch-comp-text-font:var(--sinch-comp-tooltip-font-body)}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-local-color-background);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}:host([text-align=right]) #text{--sinch-comp-text-align:right}:host([text-align=center]) #text{--sinch-comp-text-align:center}:host([text-align=left]) #text{--sinch-comp-text-align:left}</style><sinch-pop id="pop"><slot id="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><sinch-text id="text" type="s"></sinch-text><svg id="tip" width="8" height="4" aria-hidden="true"><path d="m4 4 4-4h-8l4 4Z"/></svg></div></div></sinch-pop>';
|
|
10
10
|
const TIP_SIZE = 8;
|
|
11
11
|
const SHOW_DELAY_SLOW = 1e3;
|
|
12
12
|
const SHOW_DELAY_FAST = 250;
|
|
@@ -76,7 +76,8 @@ class Tooltip extends NectaryElement {
|
|
|
76
76
|
"type",
|
|
77
77
|
"aria-label",
|
|
78
78
|
"aria-description",
|
|
79
|
-
"show-outside-viewport"
|
|
79
|
+
"show-outside-viewport",
|
|
80
|
+
"allow-scroll"
|
|
80
81
|
];
|
|
81
82
|
}
|
|
82
83
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -123,6 +124,11 @@ class Tooltip extends NectaryElement {
|
|
|
123
124
|
updateBooleanAttribute(this.#$pop, "disable-backdrop-close", false);
|
|
124
125
|
this.#tooltipState.hide();
|
|
125
126
|
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case "allow-scroll": {
|
|
130
|
+
updateAttribute(this.#$pop, "allow-scroll", newVal);
|
|
131
|
+
break;
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
}
|
|
@@ -229,6 +235,10 @@ class Tooltip extends NectaryElement {
|
|
|
229
235
|
}
|
|
230
236
|
#updateTipOrientation = () => {
|
|
231
237
|
const orient = this.orientation;
|
|
238
|
+
if (!("footprintRect" in this.#$pop)) {
|
|
239
|
+
requestAnimationFrame(this.#updateTipOrientation);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
232
242
|
const targetRect = this.#$pop.footprintRect;
|
|
233
243
|
const contentRect = this.#$content.getBoundingClientRect();
|
|
234
244
|
const diffX = targetRect.x - contentRect.x;
|
package/tooltip/types.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export type TSinchTooltipProps = {
|
|
|
15
15
|
'show-outside-viewport'?: boolean;
|
|
16
16
|
readonly footprintRect?: TRect;
|
|
17
17
|
readonly tooltipRect?: TRect;
|
|
18
|
+
/**
|
|
19
|
+
* Whether or not the tooltip allows scrolling, blocks by default, setting it
|
|
20
|
+
* to true can have unexpected behavior in dialogs
|
|
21
|
+
*/
|
|
22
|
+
'allow-scroll'?: boolean;
|
|
18
23
|
};
|
|
19
24
|
export type TSinchTooltipEvents = {
|
|
20
25
|
/** Show event handler */
|