@nectary/components 5.6.1 → 5.6.3

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 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" allow-scroll hide-outside-viewport><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>';
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" allow-scroll><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;
@@ -3479,6 +3479,7 @@ class Tooltip extends NectaryElement {
3479
3479
  this.addEventListener("-show", this.#onShowReactHandler, options);
3480
3480
  this.addEventListener("-hide", this.#onHideReactHandler, options);
3481
3481
  updateAttribute(this.#$pop, "orientation", getPopOrientation$1(this.orientation));
3482
+ updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
3482
3483
  this.#updateText();
3483
3484
  }
3484
3485
  disconnectedCallback() {
@@ -3495,7 +3496,8 @@ class Tooltip extends NectaryElement {
3495
3496
  "text-align",
3496
3497
  "type",
3497
3498
  "aria-label",
3498
- "aria-description"
3499
+ "aria-description",
3500
+ "show-outside-viewport"
3499
3501
  ];
3500
3502
  }
3501
3503
  attributeChangedCallback(name, _, newVal) {
@@ -3527,6 +3529,10 @@ class Tooltip extends NectaryElement {
3527
3529
  updateAttribute(this.#$pop, name, newVal);
3528
3530
  break;
3529
3531
  }
3532
+ case "show-outside-viewport": {
3533
+ updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
3534
+ break;
3535
+ }
3530
3536
  case "is-opened": {
3531
3537
  this.#tooltipState.updateOptions({
3532
3538
  isOpened: this.isOpenedControlled
@@ -3545,6 +3551,9 @@ class Tooltip extends NectaryElement {
3545
3551
  const isOpenedAttr = getAttribute(this, "is-opened");
3546
3552
  return isOpenedAttr === null ? void 0 : isOpenedAttr !== "false";
3547
3553
  }
3554
+ get showOutsideViewport() {
3555
+ return getBooleanAttribute(this, "show-outside-viewport");
3556
+ }
3548
3557
  get text() {
3549
3558
  return getAttribute(this, "text", "");
3550
3559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.6.1",
3
+ "version": "5.6.3",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.22.15",
27
- "@nectary/assets": "3.2.1"
27
+ "@nectary/assets": "3.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/cli": "^7.22.15",
@@ -40,6 +40,6 @@
40
40
  "vite": "^7.0.6"
41
41
  },
42
42
  "peerDependencies": {
43
- "@nectary/theme-base": "1.6.0"
43
+ "@nectary/theme-base": "1.7.0"
44
44
  }
45
45
  }
@@ -12,6 +12,7 @@ export declare class Tooltip extends NectaryElement {
12
12
  static get observedAttributes(): string[];
13
13
  attributeChangedCallback(name: string, _: string | null, newVal: string | null): void;
14
14
  get isOpenedControlled(): boolean | undefined;
15
+ get showOutsideViewport(): boolean;
15
16
  get text(): string;
16
17
  set text(value: string);
17
18
  get orientation(): TSinchTooltipOrientation;
package/tooltip/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import "../text/index.js";
2
2
  import "../pop/index.js";
3
- import { shouldReduceMotion, updateAttribute, updateBooleanAttribute, getAttribute, getLiteralAttribute, updateLiteralAttribute, setClass } from "../utils/dom.js";
3
+ import { shouldReduceMotion, updateAttribute, updateBooleanAttribute, getAttribute, getBooleanAttribute, getLiteralAttribute, updateLiteralAttribute, setClass } from "../utils/dom.js";
4
4
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
5
5
  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" allow-scroll hide-outside-viewport><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>';
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" allow-scroll><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;
@@ -58,6 +58,7 @@ class Tooltip extends NectaryElement {
58
58
  this.addEventListener("-show", this.#onShowReactHandler, options);
59
59
  this.addEventListener("-hide", this.#onHideReactHandler, options);
60
60
  updateAttribute(this.#$pop, "orientation", getPopOrientation(this.orientation));
61
+ updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
61
62
  this.#updateText();
62
63
  }
63
64
  disconnectedCallback() {
@@ -74,7 +75,8 @@ class Tooltip extends NectaryElement {
74
75
  "text-align",
75
76
  "type",
76
77
  "aria-label",
77
- "aria-description"
78
+ "aria-description",
79
+ "show-outside-viewport"
78
80
  ];
79
81
  }
80
82
  attributeChangedCallback(name, _, newVal) {
@@ -106,6 +108,10 @@ class Tooltip extends NectaryElement {
106
108
  updateAttribute(this.#$pop, name, newVal);
107
109
  break;
108
110
  }
111
+ case "show-outside-viewport": {
112
+ updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
113
+ break;
114
+ }
109
115
  case "is-opened": {
110
116
  this.#tooltipState.updateOptions({
111
117
  isOpened: this.isOpenedControlled
@@ -124,6 +130,9 @@ class Tooltip extends NectaryElement {
124
130
  const isOpenedAttr = getAttribute(this, "is-opened");
125
131
  return isOpenedAttr === null ? void 0 : isOpenedAttr !== "false";
126
132
  }
133
+ get showOutsideViewport() {
134
+ return getBooleanAttribute(this, "show-outside-viewport");
135
+ }
127
136
  get text() {
128
137
  return getAttribute(this, "text", "");
129
138
  }
@@ -12,6 +12,7 @@ export type TSinchTooltipProps = {
12
12
  type?: TSinchTooltipType;
13
13
  /** Text Align */
14
14
  'text-align'?: TSinchTooltipTextAlign;
15
+ 'show-outside-viewport'?: boolean;
15
16
  readonly footprintRect?: TRect;
16
17
  readonly tooltipRect?: TRect;
17
18
  };