@nectary/components 5.6.6 → 5.7.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/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><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"><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;
@@ -5289,9 +5299,12 @@ class Input extends NectaryElement {
5289
5299
  "value",
5290
5300
  "placeholder",
5291
5301
  "mask",
5302
+ "max",
5303
+ "min",
5292
5304
  "invalid",
5293
5305
  "disabled",
5294
5306
  "size",
5307
+ "step",
5295
5308
  "autocomplete",
5296
5309
  "autofocus",
5297
5310
  "data-size",
@@ -5389,7 +5402,10 @@ class Input extends NectaryElement {
5389
5402
  }
5390
5403
  case "autocomplete":
5391
5404
  case "maxlength":
5392
- case "required": {
5405
+ case "required":
5406
+ case "max":
5407
+ case "min":
5408
+ case "step": {
5393
5409
  updateAttribute(this.#$input, name, newVal);
5394
5410
  break;
5395
5411
  }
@@ -6581,6 +6597,7 @@ class Field extends NectaryElement {
6581
6597
  this.shouldShowTopSection();
6582
6598
  this.#$label.addEventListener("click", this.#onLabelClick, options);
6583
6599
  this.#$tooltipSlot.addEventListener("slotchange", this.#onTooltipSlotChange, options);
6600
+ this.#$inputSlot.addEventListener("slotchange", this.#onInputSlotChange, options);
6584
6601
  }
6585
6602
  disconnectedCallback() {
6586
6603
  this.#controller.abort();
@@ -6664,6 +6681,13 @@ class Field extends NectaryElement {
6664
6681
  #onTooltipSlotChange = () => {
6665
6682
  setClass(this.#$tooltipWrapper, "empty", this.#$tooltipSlot.assignedElements().length === 0);
6666
6683
  };
6684
+ #onInputSlotChange = () => {
6685
+ const inputElement = getFirstSlotElement(this.#$inputSlot);
6686
+ const labelText = this.#$label.textContent;
6687
+ if (inputElement !== null && labelText != null && labelText.length > 0) {
6688
+ inputElement.setAttribute("aria-label", "label");
6689
+ }
6690
+ };
6667
6691
  }
6668
6692
  defineCustomElement("sinch-field", Field);
6669
6693
  const doFilesSatisfySize$1 = (files, size) => {
package/field/index.js CHANGED
@@ -34,6 +34,7 @@ class Field extends NectaryElement {
34
34
  this.shouldShowTopSection();
35
35
  this.#$label.addEventListener("click", this.#onLabelClick, options);
36
36
  this.#$tooltipSlot.addEventListener("slotchange", this.#onTooltipSlotChange, options);
37
+ this.#$inputSlot.addEventListener("slotchange", this.#onInputSlotChange, options);
37
38
  }
38
39
  disconnectedCallback() {
39
40
  this.#controller.abort();
@@ -117,6 +118,13 @@ class Field extends NectaryElement {
117
118
  #onTooltipSlotChange = () => {
118
119
  setClass(this.#$tooltipWrapper, "empty", this.#$tooltipSlot.assignedElements().length === 0);
119
120
  };
121
+ #onInputSlotChange = () => {
122
+ const inputElement = getFirstSlotElement(this.#$inputSlot);
123
+ const labelText = this.#$label.textContent;
124
+ if (inputElement !== null && labelText != null && labelText.length > 0) {
125
+ inputElement.setAttribute("aria-label", "label");
126
+ }
127
+ };
120
128
  }
121
129
  defineCustomElement("sinch-field", Field);
122
130
  export {
package/input/index.js CHANGED
@@ -133,9 +133,12 @@ class Input extends NectaryElement {
133
133
  "value",
134
134
  "placeholder",
135
135
  "mask",
136
+ "max",
137
+ "min",
136
138
  "invalid",
137
139
  "disabled",
138
140
  "size",
141
+ "step",
139
142
  "autocomplete",
140
143
  "autofocus",
141
144
  "data-size",
@@ -233,7 +236,10 @@ class Input extends NectaryElement {
233
236
  }
234
237
  case "autocomplete":
235
238
  case "maxlength":
236
- case "required": {
239
+ case "required":
240
+ case "max":
241
+ case "min":
242
+ case "step": {
237
243
  updateAttribute(this.#$input, name, newVal);
238
244
  break;
239
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.6.6",
3
+ "version": "5.7.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
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" 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>';
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;
@@ -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 */