@nectary/components 2.2.1 → 2.2.2

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.
Files changed (71) hide show
  1. package/accordion/index.js +21 -16
  2. package/accordion-item/index.js +9 -17
  3. package/action-menu/index.js +6 -9
  4. package/action-menu-option/index.js +3 -7
  5. package/alert/index.js +12 -12
  6. package/avatar/index.js +26 -23
  7. package/badge/index.js +2 -2
  8. package/button/index.js +6 -4
  9. package/card/index.js +6 -6
  10. package/checkbox/index.js +3 -3
  11. package/chip/index.js +2 -2
  12. package/code-tag/index.js +6 -9
  13. package/color-menu/index.js +10 -17
  14. package/color-menu-option/index.d.ts +0 -1
  15. package/color-menu-option/index.js +2 -6
  16. package/color-swatch/index.js +9 -9
  17. package/date-picker/index.js +0 -3
  18. package/dialog/index.js +16 -10
  19. package/dialog/types.d.ts +2 -0
  20. package/emoji/index.js +3 -0
  21. package/field/index.js +4 -4
  22. package/file-drop/index.js +21 -19
  23. package/file-picker/index.js +18 -18
  24. package/file-status/index.js +8 -5
  25. package/flag/index.js +3 -0
  26. package/help-tooltip/index.d.ts +1 -0
  27. package/help-tooltip/index.js +2 -1
  28. package/horizontal-stepper/index.js +1 -4
  29. package/horizontal-stepper-item/index.js +0 -3
  30. package/icon-button/index.js +5 -6
  31. package/input/index.js +8 -5
  32. package/link/index.js +2 -2
  33. package/package.json +1 -1
  34. package/pagination/index.js +2 -6
  35. package/pop/index.js +5 -4
  36. package/popover/index.js +2 -2
  37. package/progress/index.js +4 -4
  38. package/progress-stepper/index.js +1 -4
  39. package/progress-stepper-item/index.js +5 -5
  40. package/radio/index.js +28 -24
  41. package/radio-option/index.js +12 -34
  42. package/rich-text/index.js +12 -12
  43. package/segment/index.js +5 -2
  44. package/segmented-control/index.js +0 -3
  45. package/segmented-control-option/index.js +5 -4
  46. package/segmented-icon-control/index.js +0 -3
  47. package/segmented-icon-control-option/index.js +5 -4
  48. package/select-button/index.js +3 -4
  49. package/select-menu/index.js +0 -3
  50. package/select-menu-option/index.js +2 -2
  51. package/skeleton/index.js +0 -3
  52. package/spinner/index.js +0 -3
  53. package/table-head-cell/index.js +2 -2
  54. package/table-row/index.js +2 -2
  55. package/tabs/index.js +7 -7
  56. package/tabs-icon-option/index.js +2 -2
  57. package/tabs-option/index.js +2 -2
  58. package/tag/index.js +5 -2
  59. package/text/index.js +5 -2
  60. package/textarea/index.js +12 -6
  61. package/tile-control/index.js +2 -2
  62. package/tile-control-option/index.js +0 -3
  63. package/time-picker/index.js +3 -4
  64. package/title/index.js +4 -4
  65. package/toast/index.js +0 -3
  66. package/toggle/index.js +2 -2
  67. package/tooltip/index.js +1 -1
  68. package/utils/dom.d.ts +1 -0
  69. package/utils/dom.js +5 -2
  70. package/vertical-stepper/index.js +1 -4
  71. package/vertical-stepper-item/index.js +0 -3
@@ -1,5 +1,5 @@
1
1
  import '../text';
2
- import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
+ import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrEqual, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
3
3
  const templateHTML = '<style>:host{display:block}#button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px 16px;box-sizing:border-box;cursor:pointer;background-color:var(--sinch-comp-tab-color-default-background-initial);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);height:39px;--sinch-global-color-text:var(--sinch-comp-tab-color-default-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-tab-size-icon)}#button:hover{background-color:var(--sinch-comp-tab-color-default-background-hover)}#button:focus-visible::after{content:"";position:absolute;inset:0;bottom:-3px;border:2px solid var(--sinch-comp-tab-color-default-outline-focus);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);pointer-events:none}#button:disabled{cursor:unset;pointer-events:none;--sinch-global-color-text:var(--sinch-comp-tab-color-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-disabled-icon-initial)}:host([data-checked]) #button{--sinch-global-color-text:var(--sinch-comp-tab-color-checked-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-checked-icon-initial)}:host([data-checked]) #button::before{content:"";position:absolute;left:0;right:0;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-comp-tab-color-checked-border-initial)}#text{flex-shrink:1;flex-basis:auto;min-width:0;--sinch-comp-text-font:var(--sinch-comp-tab-font-label)}::slotted(*){display:block}</style><button id="button" tabindex="0"><slot name="icon"></slot><sinch-text id="text" type="m" ellipsis></sinch-text></button>';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
@@ -26,7 +26,7 @@ defineCustomElement('sinch-tabs-option', class extends NectaryElement {
26
26
  return ['data-checked', 'disabled', 'text'];
27
27
  }
28
28
  attributeChangedCallback(name, oldVal, newVal) {
29
- if (oldVal === newVal) {
29
+ if (isAttrEqual(oldVal, newVal)) {
30
30
  return;
31
31
  }
32
32
  switch (name) {
package/tag/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import '../text';
2
- import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue } from '../utils';
2
+ import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue, isAttrEqual } from '../utils';
3
3
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:var(--sinch-comp-tag-size-container-m);padding:0 9px;border-radius:var(--sinch-comp-tag-shape-radius);background-color:var(--sinch-comp-tag-color-default-background);box-sizing:border-box;user-select:none;--sinch-global-color-text:var(--sinch-comp-tag-color-default-foreground);--sinch-global-color-icon:var(--sinch-comp-tag-color-default-foreground);--sinch-global-size-icon:var(--sinch-comp-tag-size-icon-m)}:host([small]) #wrapper{height:var(--sinch-comp-tag-size-container-s);padding:0 8px;--sinch-global-size-icon:var(--sinch-comp-tag-size-icon-s)}#text{flex:1;--sinch-comp-text-font:var(--sinch-comp-tag-font-size-m-label)}:host([small]) #text{--sinch-comp-text-font:var(--sinch-comp-tag-font-size-s-label)}::slotted(*){margin-left:-4px}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="text" type="s" ellipsis></sinch-text></div>';
4
4
  import { getTagColorBg, getTagColorFg } from './utils';
5
5
  const template = document.createElement('template');
@@ -18,6 +18,9 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
18
18
  super.connectedCallback();
19
19
  this.#updateColor();
20
20
  }
21
+ disconnectedCallback() {
22
+ super.disconnectedCallback();
23
+ }
21
24
  get color() {
22
25
  return getAttribute(this, 'color');
23
26
  }
@@ -40,7 +43,7 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
40
43
  return ['text', 'color', 'small'];
41
44
  }
42
45
  attributeChangedCallback(name, oldVal, newVal) {
43
- if (oldVal === newVal) {
46
+ if (isAttrEqual(oldVal, newVal)) {
44
47
  return;
45
48
  }
46
49
  switch (name) {
package/text/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute, NectaryElement, getLiteralAttribute, updateLiteralAttribute, isAttrTrue } from '../utils';
1
+ import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute, NectaryElement, getLiteralAttribute, updateLiteralAttribute, isAttrTrue, isAttrEqual } from '../utils';
2
2
  const templateHTML = '<style>:host{display:block;font:var(--sinch-comp-text-font);color:var(--sinch-global-color-text,var(--sinch-sys-color-text-default));--sinch-comp-text-font:var(--sinch-sys-font-body-m)}:host([inline]){display:inline}:host([type="s"]){--sinch-comp-text-font:var(--sinch-sys-font-body-s)}:host([type=xs]){--sinch-comp-text-font:var(--sinch-sys-font-body-xs)}:host([type=xxs]){--sinch-comp-text-font:var(--sinch-sys-font-body-xxs)}:host([type="m"][emphasized]){--sinch-comp-text-font:var(--sinch-sys-font-body-emphasize)}:host([type="s"][emphasized]){--sinch-comp-text-font:var(--sinch-sys-font-body-emphasize-s)}:host([ellipsis]){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;--sinch-global-text-white-space:nowrap}</style><slot></slot>';
3
3
  import { typeValues } from './utils';
4
4
  const template = document.createElement('template');
@@ -15,7 +15,10 @@ defineCustomElement('sinch-text', class extends NectaryElement {
15
15
  static get observedAttributes() {
16
16
  return ['inline', 'ellipsis', 'emphasized'];
17
17
  }
18
- attributeChangedCallback(name, _, newVal) {
18
+ attributeChangedCallback(name, oldVal, newVal) {
19
+ if (isAttrEqual(oldVal, newVal)) {
20
+ return;
21
+ }
19
22
  switch (name) {
20
23
  case 'inline':
21
24
  {
package/textarea/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Context, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
1
+ import { Context, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrEqual, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
2
  import { DEFAULT_SIZE } from '../utils/size';
3
3
  const templateHTML = '<style>:host{all:initial;display:inline-block;vertical-align:middle}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;box-sizing:border-box;background-color:var(--sinch-comp-textarea-color-default-background-initial);border-radius:var(--sinch-local-shape-radius);padding-right:2px;padding-bottom:2px;overflow:hidden;--sinch-local-shape-radius:var(--sinch-comp-textarea-shape-radius)}#input{all:initial;display:block;font:var(--sinch-comp-textarea-font-input);color:var(--sinch-comp-textarea-color-default-text-initial);resize:none;white-space:pre-wrap;overflow-wrap:break-word;padding:8px 10px 8px 12px;border:none}#input::placeholder{color:var(--sinch-comp-textarea-color-default-text-placeholder);opacity:1}#input:disabled{color:var(--sinch-comp-textarea-color-disabled-text-initial);-webkit-text-fill-color:var(--sinch-comp-textarea-color-disabled-text-initial)}:host([resizable]) #input{resize:vertical}#border{position:absolute;border:1px solid var(--sinch-comp-textarea-color-default-border-initial);border-radius:var(--sinch-local-shape-radius);inset:0;pointer-events:none}:host([invalid]) #border{border-color:var(--sinch-comp-textarea-color-invalid-border-initial)}#input:focus+#border{border-color:var(--sinch-comp-textarea-color-default-border-focus);border-width:2px}#input:disabled+#border{border-color:var(--sinch-comp-textarea-color-disabled-border-initial)}#bottom{display:flex;flex-direction:row;align-items:center;gap:8px;padding:8px 10px 10px 12px}#bottom.empty{display:none}</style><div id="wrapper"><textarea id="input"></textarea><div id="border"></div><div id="bottom"><slot name="bottom"></slot></div></div>';
4
4
  const template = document.createElement('template');
@@ -28,8 +28,8 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
28
28
  const options = {
29
29
  signal: this.#controller.signal
30
30
  };
31
- this.setAttribute('role', 'textbox');
32
- this.setAttribute('aria-multiline', 'true');
31
+ this.role = 'textbox';
32
+ this.ariaMultiLine = 'true';
33
33
  this.#$input.addEventListener('input', this.#onInput, options);
34
34
  this.#$input.addEventListener('compositionstart', this.#onCompositionStart, options);
35
35
  this.#$input.addEventListener('mousedown', this.#onSelectionChange, options);
@@ -53,9 +53,6 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
53
53
  return ['value', 'placeholder', 'invalid', 'disabled', 'rows', 'resizable'];
54
54
  }
55
55
  attributeChangedCallback(name, oldVal, newVal) {
56
- if (oldVal === newVal) {
57
- return;
58
- }
59
56
  switch (name) {
60
57
  case 'value':
61
58
  {
@@ -79,6 +76,9 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
79
76
  }
80
77
  case 'invalid':
81
78
  {
79
+ if (isAttrEqual(oldVal, newVal)) {
80
+ break;
81
+ }
82
82
  const isInvalid = isAttrTrue(newVal);
83
83
  updateExplicitBooleanAttribute(this, 'aria-invalid', isInvalid);
84
84
  updateBooleanAttribute(this, 'invalid', isInvalid);
@@ -86,6 +86,9 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
86
86
  }
87
87
  case 'disabled':
88
88
  {
89
+ if (isAttrEqual(oldVal, newVal)) {
90
+ break;
91
+ }
89
92
  const isDisabled = isAttrTrue(newVal);
90
93
  this.#$input.disabled = isDisabled;
91
94
  updateBooleanAttribute(this, 'disabled', isDisabled);
@@ -98,6 +101,9 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
98
101
  }
99
102
  case 'resizable':
100
103
  {
104
+ if (isAttrEqual(oldVal, newVal)) {
105
+ break;
106
+ }
101
107
  updateBooleanAttribute(this, name, isAttrTrue(newVal));
102
108
  break;
103
109
  }
@@ -1,4 +1,4 @@
1
- import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, isAttrTrue } from '../utils';
1
+ import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, isAttrTrue, isAttrEqual } from '../utils';
2
2
  const templateHTML = '<style>:host{display:block;outline:0;--sinch-grid-num-columns:1}#wrapper{display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),auto);gap:16px;width:fit-content}:host([small]) #wrapper{gap:8px}:host([cols="2"]){--sinch-grid-num-columns:2}:host([cols="3"]){--sinch-grid-num-columns:3}:host([cols="4"]){--sinch-grid-num-columns:4}:host([cols="5"]){--sinch-grid-num-columns:5}:host([cols="6"]){--sinch-grid-num-columns:6}:host([cols="7"]){--sinch-grid-num-columns:7}:host([cols="8"]){--sinch-grid-num-columns:8}</style><div id="wrapper"><slot></slot></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
@@ -25,7 +25,7 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
25
25
  return ['value', 'small', 'multiple'];
26
26
  }
27
27
  attributeChangedCallback(name, oldVal, newVal) {
28
- if (oldVal === newVal) {
28
+ if (isAttrEqual(oldVal, newVal)) {
29
29
  return;
30
30
  }
31
31
  switch (name) {
@@ -31,9 +31,6 @@ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
31
31
  return ['data-checked', 'text', 'disabled'];
32
32
  }
33
33
  attributeChangedCallback(name, oldVal, newVal) {
34
- if (oldVal === newVal) {
35
- return;
36
- }
37
34
  switch (name) {
38
35
  case 'text':
39
36
  {
@@ -2,7 +2,7 @@ import '../icon-button';
2
2
  import '../icon';
3
3
  import '../segmented-control';
4
4
  import '../segmented-control-option';
5
- import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
5
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrEqual, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
6
6
  const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-comp-time-picker-header-font);line-height:48px;user-select:none;color:var(--sinch-comp-time-picker-header-color-default-text-initial)}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-comp-time-picker-watch-face-color-default-border-initial);background-color:var(--sinch-comp-time-picker-watch-face-color-default-background-initial)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;text-align:center;top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-12{font:var(--sinch-comp-time-picker-digit-font-default-h12);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-h12-initial)}.digit-hour-12.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h12);color:var(--sinch-comp-time-picker-digit-color-checked-h12-default)}.digit-hour-24{font:var(--sinch-comp-time-picker-digit-font-default-h24);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-h24-initial)}.digit-hour-24.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h24);color:var(--sinch-comp-time-picker-digit-color-checked-h24-initial)}.digit-minute{font:var(--sinch-comp-time-picker-digit-font-default-h12);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-minute-initial)}.digit-minute.selected{color:var(--sinch-comp-time-picker-digit-color-checked-minute-initial)}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-comp-time-picker-needle-color-default-background-initial)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2;outline:0}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-hour:focus-visible,#needle-minute:focus-visible{background-color:var(--sinch-comp-time-picker-needle-color-default-background-focus)}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-comp-time-picker-digit-color-checked-minute-initial)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}#submit-icon{--sinch-global-color-icon:var(--sinch-comp-time-picker-header-color-default-icon-initial)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><div id="header-colon">&colon;</div><div id="header-minutes" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><sinch-icon-button id="submit" size="s" aria-label="Submit"><sinch-icon id="icon-submit" slot="icon" name="done"></sinch-icon></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour" tabindex="0"></div><div id="needle-minute" tabindex="0"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
7
7
  import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
8
8
  const template = document.createElement('template');
@@ -111,7 +111,7 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
111
111
  return ['value', 'ampm', 'submit-aria-label'];
112
112
  }
113
113
  attributeChangedCallback(name, prevValue, newVal) {
114
- if (newVal === prevValue) {
114
+ if (isAttrEqual(prevValue, newVal)) {
115
115
  return;
116
116
  }
117
117
  switch (name) {
@@ -128,9 +128,8 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
128
128
  }
129
129
  case 'ampm':
130
130
  {
131
- const isAmpm = isAttrTrue(newVal);
132
- updateBooleanAttribute(this, 'ampm', isAmpm);
133
131
  this.#render();
132
+ updateBooleanAttribute(this, 'ampm', isAttrTrue(newVal));
134
133
  break;
135
134
  }
136
135
  case 'submit-aria-label':
package/title/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement, updateBooleanAttribute, getBooleanAttribute, isAttrTrue } from '../utils';
1
+ import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement, updateBooleanAttribute, getBooleanAttribute, isAttrTrue, isAttrEqual } from '../utils';
2
2
  const templateHTML = '<style>:host{display:block;--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-m)}:host([type=xl]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-xl)}:host([type="l"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-l)}:host([type="m"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-m)}:host([type="s"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-s)}:host([type=xs]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-xs)}#text{letter-spacing:-2%;color:var(--sinch-global-color-text,var(--sinch-sys-color-text-default));font:var(--sinch-comp-title-font)}:host([ellipsis]) #text{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}</style><span id="text"></span>';
3
3
  import { typeValues } from './utils';
4
4
  const template = document.createElement('template');
@@ -18,9 +18,6 @@ defineCustomElement('sinch-title', class extends NectaryElement {
18
18
  return ['text', 'level', 'ellipsis'];
19
19
  }
20
20
  attributeChangedCallback(name, oldVal, newVal) {
21
- if (oldVal === newVal) {
22
- return;
23
- }
24
21
  switch (name) {
25
22
  case 'text':
26
23
  {
@@ -34,6 +31,9 @@ defineCustomElement('sinch-title', class extends NectaryElement {
34
31
  }
35
32
  case 'ellipsis':
36
33
  {
34
+ if (isAttrEqual(oldVal, newVal)) {
35
+ break;
36
+ }
37
37
  updateBooleanAttribute(this, 'ellipsis', isAttrTrue(newVal));
38
38
  break;
39
39
  }
package/toast/index.js CHANGED
@@ -32,9 +32,6 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
32
32
  return ['text', 'persistent'];
33
33
  }
34
34
  attributeChangedCallback(name, oldVal, newVal) {
35
- if (oldVal === newVal) {
36
- return;
37
- }
38
35
  switch (name) {
39
36
  case 'text':
40
37
  {
package/toggle/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
1
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrEqual, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
2
  const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;width:100%;height:var(--sinch-local-size);--sinch-local-size:24px}:host([small]) #wrapper{--sinch-local-size:22px}#input{all:initial;display:block;position:absolute;left:0;top:2px;width:40px;height:20px;cursor:pointer;pointer-events:initial}:host([disabled]) #input{cursor:initial}:host(:focus-visible) #input::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-comp-toggle-color-default-outline-focus);border-radius:18px;pointer-events:none}:host([small]) #input{width:32px;height:16px;top:3px}#knob-container{position:relative;box-sizing:border-box;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-comp-toggle-color-default-background-initial);overflow:hidden}:host([small]) #knob-container{width:32px;height:16px;border-radius:8px}:host([checked]) #knob-container{background-color:var(--sinch-comp-toggle-color-checked-background-initial)}:host([disabled]) #knob-container{background-color:var(--sinch-comp-toggle-color-disabled-background-initial)}:host([checked][disabled]) #knob-container{background-color:var(--sinch-comp-toggle-color-checked-disabled-background-initial)}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-comp-toggle-color-default-knob-background-initial);box-shadow:var(--sinch-comp-toggle-shadow-knob-default);transform:translateX(0);transition:transform .1s ease-in-out;will-change:transform}:host([small]) #knob{width:12px;height:12px}:host([disabled]) #knob-container>#knob{box-shadow:var(--sinch-comp-toggle-shadow-knob-disabled)}:host([checked]) #knob-container>#knob{transform:translateX(20px)}:host([small][checked]) #knob-container>#knob{transform:translateX(16px)}#knob::after,#knob::before{font:var(--sinch-comp-toggle-font-size-m-inside-text);color:var(--sinch-comp-toggle-color-default-text-inside-initial);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([small])) #knob::after,:host([labeled]:not([small])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-comp-toggle-font-size-m-label);color:var(--sinch-comp-toggle-color-default-label-initial);cursor:pointer}#label:empty{display:none}:host([small]) #label{font:var(--sinch-comp-toggle-font-size-s-label)}:host([disabled]) #label{color:var(--sinch-comp-toggle-color-disabled-label-initial);cursor:initial}</style><div id="wrapper"><div id="input"></div><div id="knob-container"><div id="knob"></div></div><span id="label"></span></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
@@ -36,7 +36,7 @@ defineCustomElement('sinch-toggle', class extends NectaryElement {
36
36
  return ['checked', 'disabled', 'text', 'labeled', 'small'];
37
37
  }
38
38
  attributeChangedCallback(name, oldVal, newVal) {
39
- if (oldVal === newVal) {
39
+ if (isAttrEqual(oldVal, newVal)) {
40
40
  return;
41
41
  }
42
42
  switch (name) {
package/tooltip/index.js CHANGED
@@ -57,8 +57,8 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
57
57
  this.#updateText();
58
58
  }
59
59
  disconnectedCallback() {
60
- this.#tooltipState.destroy();
61
60
  super.disconnectedCallback();
61
+ this.#tooltipState.destroy();
62
62
  this.#controller.abort();
63
63
  this.#controller = null;
64
64
  }
package/utils/dom.d.ts CHANGED
@@ -30,4 +30,5 @@ export declare const getCssVar: (element: Element, variableName: string) => stri
30
30
  export declare const getCssVars: (element: Element, variableNames: string[]) => (string | null)[];
31
31
  export declare const cloneNode: (el: Element, deep: boolean) => Element;
32
32
  export declare const shouldReduceMotion: () => boolean;
33
+ export declare const isAttrEqual: (oldVal: string | null, newVal: string | null) => boolean;
33
34
  export {};
package/utils/dom.js CHANGED
@@ -2,7 +2,7 @@ export const updateExplicitBooleanAttribute = ($element, attrName, attrValue) =>
2
2
  $element.setAttribute(attrName, attrValue === true ? 'true' : 'false');
3
3
  };
4
4
  export const isAttrTrue = attrValue => {
5
- return attrValue === '' || attrValue !== 'false' && attrValue !== null;
5
+ return attrValue !== null && attrValue !== 'false';
6
6
  };
7
7
  export const getBooleanAttribute = ($element, attrName) => {
8
8
  return isAttrTrue($element.getAttribute(attrName));
@@ -148,4 +148,7 @@ export const cloneNode = (el, deep) => {
148
148
  }
149
149
  return el.cloneNode(deep);
150
150
  };
151
- export const shouldReduceMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
151
+ export const shouldReduceMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
152
+ export const isAttrEqual = (oldVal, newVal) => {
153
+ return oldVal === newVal || newVal === null && oldVal === 'false' || newVal === '' && oldVal === 'true';
154
+ };
@@ -21,10 +21,7 @@ defineCustomElement('sinch-vertical-stepper', class extends NectaryElement {
21
21
  static get observedAttributes() {
22
22
  return ['index'];
23
23
  }
24
- attributeChangedCallback(name, oldVal, newVal) {
25
- if (oldVal === newVal) {
26
- return;
27
- }
24
+ attributeChangedCallback(name) {
28
25
  switch (name) {
29
26
  case 'index':
30
27
  {
@@ -22,9 +22,6 @@ defineCustomElement('sinch-vertical-stepper-item', class extends NectaryElement
22
22
  return ['label', 'description', 'data-index'];
23
23
  }
24
24
  attributeChangedCallback(name, oldVal, newVal) {
25
- if (oldVal === newVal) {
26
- return;
27
- }
28
25
  switch (name) {
29
26
  case 'label':
30
27
  {