@nectary/components 1.4.0 → 2.0.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.
Files changed (168) hide show
  1. package/accordion/index.js +0 -3
  2. package/accordion/types.d.ts +0 -3
  3. package/accordion-item/index.d.ts +2 -0
  4. package/accordion-item/index.js +33 -34
  5. package/action-menu-option/index.js +2 -2
  6. package/alert/index.js +2 -12
  7. package/avatar/index.js +1 -1
  8. package/avatar/utils.js +3 -3
  9. package/badge/index.js +41 -67
  10. package/badge/types.d.ts +0 -4
  11. package/badge/utils.d.ts +0 -3
  12. package/badge/utils.js +0 -11
  13. package/button/index.js +1 -1
  14. package/button/types.d.ts +2 -2
  15. package/card/index.js +5 -16
  16. package/card/types.d.ts +0 -6
  17. package/card-container/index.js +1 -1
  18. package/chat-block/index.js +1 -1
  19. package/chat-bubble/index.js +3 -24
  20. package/checkbox/index.js +31 -30
  21. package/checkbox/types.d.ts +0 -3
  22. package/chip/index.js +34 -27
  23. package/chip/utils.js +3 -3
  24. package/code-tag/index.js +1 -1
  25. package/color-menu/index.d.ts +0 -3
  26. package/color-menu/index.js +50 -99
  27. package/color-menu/types.d.ts +0 -4
  28. package/color-menu-option/index.d.ts +14 -0
  29. package/color-menu-option/index.js +52 -0
  30. package/color-menu-option/types.d.ts +9 -0
  31. package/color-menu-option/utils.d.ts +1 -0
  32. package/color-menu-option/utils.js +11 -0
  33. package/color-swatch/index.js +1 -1
  34. package/color-swatch/utils.js +3 -3
  35. package/date-picker/index.js +2 -21
  36. package/date-picker/types.d.ts +0 -3
  37. package/dialog/index.js +2 -5
  38. package/dialog/types.d.ts +0 -2
  39. package/emoji/index.js +1 -1
  40. package/emoji-picker/index.d.ts +1 -0
  41. package/emoji-picker/index.js +32 -23
  42. package/field/index.js +39 -32
  43. package/file-drop/index.js +1 -1
  44. package/file-status/index.js +2 -16
  45. package/flag/index.js +1 -1
  46. package/grid/index.js +1 -1
  47. package/help-tooltip/index.js +3 -12
  48. package/horizontal-stepper/index.js +1 -1
  49. package/horizontal-stepper-item/index.d.ts +2 -0
  50. package/horizontal-stepper-item/index.js +8 -12
  51. package/icon/index.js +1 -1
  52. package/icon-button/index.js +1 -1
  53. package/inline-alert/index.js +19 -29
  54. package/input/index.d.ts +0 -3
  55. package/input/index.js +12 -46
  56. package/input/types.d.ts +1 -5
  57. package/link/index.js +35 -37
  58. package/list-item/index.js +1 -1
  59. package/package.json +10 -9
  60. package/pagination/index.js +8 -21
  61. package/pagination/types.d.ts +0 -3
  62. package/pop/index.js +16 -13
  63. package/popover/index.js +44 -50
  64. package/progress/index.js +20 -15
  65. package/radio/index.js +19 -6
  66. package/radio/types.d.ts +3 -3
  67. package/radio-option/index.js +35 -27
  68. package/rich-text/index.js +1 -1
  69. package/segment/index.js +2 -3
  70. package/segment-collapse/index.js +2 -11
  71. package/segment-collapse/types.d.ts +0 -3
  72. package/segmented-control/index.js +0 -3
  73. package/segmented-control/types.d.ts +0 -3
  74. package/segmented-control-option/index.js +20 -19
  75. package/segmented-icon-control/index.js +1 -4
  76. package/segmented-icon-control/types.d.ts +0 -3
  77. package/segmented-icon-control-option/index.js +18 -14
  78. package/select-button/index.js +7 -12
  79. package/select-menu/index.js +12 -5
  80. package/select-menu-option/index.js +2 -5
  81. package/skeleton/index.js +1 -1
  82. package/skeleton-item/index.js +1 -1
  83. package/spinner/index.js +1 -1
  84. package/table/index.js +1 -1
  85. package/table-body/index.js +1 -1
  86. package/table-cell/index.js +1 -1
  87. package/table-head-cell/index.d.ts +1 -0
  88. package/table-head-cell/index.js +12 -3
  89. package/table-row/index.js +18 -2
  90. package/tabs/index.js +1 -4
  91. package/tabs/types.d.ts +0 -3
  92. package/tabs-icon-option/index.js +4 -2
  93. package/tabs-option/index.js +25 -20
  94. package/tag/index.js +16 -8
  95. package/tag/utils.js +3 -3
  96. package/text/index.js +30 -20
  97. package/textarea/index.js +10 -6
  98. package/textarea/types.d.ts +0 -3
  99. package/tile-control/index.js +23 -25
  100. package/tile-control/types.d.ts +0 -3
  101. package/tile-control-option/index.js +1 -1
  102. package/time-picker/index.js +2 -8
  103. package/time-picker/types.d.ts +0 -3
  104. package/title/index.js +30 -22
  105. package/toast/index.js +20 -30
  106. package/toggle/index.js +33 -30
  107. package/toggle/types.d.ts +0 -3
  108. package/tooltip/index.js +2 -8
  109. package/tooltip/types.d.ts +0 -12
  110. package/vertical-stepper/index.js +1 -1
  111. package/vertical-stepper-item/index.d.ts +2 -0
  112. package/vertical-stepper-item/index.js +8 -12
  113. package/logo/create-logo-class.d.ts +0 -1
  114. package/logo/create-logo-class.js +0 -52
  115. package/logo/engage-icon/index.d.ts +0 -11
  116. package/logo/engage-icon/index.js +0 -4
  117. package/logo/engage-icon-wordmark/index.d.ts +0 -11
  118. package/logo/engage-icon-wordmark/index.js +0 -4
  119. package/logo/sinch-icon/index.d.ts +0 -11
  120. package/logo/sinch-icon/index.js +0 -4
  121. package/logo/sinch-icon-wordmark/index.d.ts +0 -11
  122. package/logo/sinch-icon-wordmark/index.js +0 -4
  123. package/logo/types.d.ts +0 -11
  124. package/theme/accordion-item.css +0 -4
  125. package/theme/alert.css +0 -6
  126. package/theme/avatar.css +0 -25
  127. package/theme/badge.css +0 -15
  128. package/theme/button.css +0 -146
  129. package/theme/chat.css +0 -9
  130. package/theme/chip.css +0 -68
  131. package/theme/color-menu.css +0 -4
  132. package/theme/color-swatch.css +0 -71
  133. package/theme/colors.d.ts +0 -4
  134. package/theme/colors.js +0 -4
  135. package/theme/contextual.css +0 -40
  136. package/theme/date-picker.css +0 -7
  137. package/theme/dialog.css +0 -4
  138. package/theme/elevation.css +0 -7
  139. package/theme/emoji-picker.css +0 -13
  140. package/theme/emoji.css +0 -5
  141. package/theme/file-status.css +0 -7
  142. package/theme/flag.css +0 -4
  143. package/theme/fonts.css +0 -86
  144. package/theme/fonts.json +0 -89
  145. package/theme/help-tooltip.css +0 -5
  146. package/theme/horizontal-stepper.css +0 -5
  147. package/theme/icon-button.css +0 -68
  148. package/theme/icon.css +0 -7
  149. package/theme/index.css +0 -4
  150. package/theme/index.d.ts +0 -39
  151. package/theme/index.js +0 -39
  152. package/theme/inline-alert.css +0 -7
  153. package/theme/input.css +0 -10
  154. package/theme/link.css +0 -5
  155. package/theme/pagination.css +0 -5
  156. package/theme/palette.css +0 -90
  157. package/theme/segment.css +0 -4
  158. package/theme/select-button.css +0 -10
  159. package/theme/select-menu.css +0 -6
  160. package/theme/shapes.css +0 -8
  161. package/theme/size.css +0 -9
  162. package/theme/spinner.css +0 -7
  163. package/theme/tag.css +0 -67
  164. package/theme/time-picker.css +0 -4
  165. package/theme/toast.css +0 -7
  166. package/theme/typography.css +0 -16
  167. package/theme/vertical-stepper.css +0 -5
  168. /package/{logo → color-menu-option}/types.js +0 -0
package/spinner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineCustomElement, getLiteralAttribute, NectaryElement, subscribeContext, updateAttribute, updateLiteralAttribute } from '../utils';
2
2
  import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
3
- const templateHTML = '<style>@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host{display:block;--sinch-size-icon:var(--sinch-spinner-size-m);--sinch-spinner-thickness:3px}:host([data-size="l"]){--sinch-size-icon:var(--sinch-spinner-size-l);--sinch-spinner-thickness:4px}:host([data-size="m"]){--sinch-size-icon:var(--sinch-spinner-size-m);--sinch-spinner-thickness:3px}:host([data-size="s"]){--sinch-size-icon:var(--sinch-spinner-size-s);--sinch-spinner-thickness:2px}#wrapper{position:relative;height:var(--sinch-size-icon);width:var(--sinch-size-icon)}#bg{position:absolute;inset:1px;border:solid var(--sinch-spinner-thickness) var(--sinch-color-icon);border-radius:50%;opacity:.3}#fg{position:absolute;inset:1px;border:solid var(--sinch-spinner-thickness) transparent;border-bottom-color:var(--sinch-color-icon);border-radius:50%;will-change:transform;animation:1.5s linear infinite spinner;animation-play-state:running}</style><div id="wrapper"><div id="bg"></div><div id="fg"></div></div>';
3
+ const templateHTML = '<style>@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host{display:block}#spinner-size-l,#spinner-size-m,#spinner-size-s{display:none;will-change:transform}:host([data-size="l"])>#spinner-size-l{display:block;animation:1s linear infinite spinner}:host([data-size="m"])>#spinner-size-m{display:block;animation:1s linear infinite spinner}:host([data-size="s"])>#spinner-size-s{display:block;animation:1s linear infinite spinner}.bg{opacity:.3;stroke:var(--sinch-global-color-icon,var(--sinch-sys-color-text-default))}.fg{stroke:var(--sinch-global-color-icon,var(--sinch-sys-color-text-default))}</style><svg id="spinner-size-l" width="50" height="50" fill="none"><circle class="bg" cx="25" cy="25" r="22" stroke-width="6"/><path class="fg" d="M25 3a22 22 0 0 1 22 22" stroke-width="6" stroke-linecap="round"/></svg><svg id="spinner-size-m" width="24" height="24" fill="none"><circle class="bg" cx="12" cy="12" r="9" stroke-width="4"/><path class="fg" d="M21 12a9 9 0 0 0-9-9" stroke-width="4" stroke-linecap="round"/></svg><svg id="spinner-size-s" width="16" height="16" fill="none"><circle class="bg" cx="8" cy="8" r="6" stroke-width="2"/><path class="fg" d="M14 8a6 6 0 0 0-6-6" stroke-width="2" stroke-linecap="round"/></svg>';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
6
6
  defineCustomElement('sinch-spinner', class extends NectaryElement {
package/table/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, NectaryElement } from '../utils';
2
- const templateHTML = '<style>:host{display:table;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-stormy-500)}</style><slot></slot>';
2
+ const templateHTML = '<style>:host{display:table}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-table', class extends NectaryElement {
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, NectaryElement } from '../utils';
2
- const templateHTML = '<style>:host{display:table-row-group}::slotted(sinch-table-row:hover){background-color:var(--sinch-color-tropical-50)}::slotted(sinch-table-row[selected]:not([selected=false])){background-color:var(--sinch-color-tropical-100)}</style><slot></slot>';
2
+ const templateHTML = '<style>:host{display:table-row-group}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-table-body', class extends NectaryElement {
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-color-snow-600)}#wrapper{display:flex;flex-direction:column;justify-content:center;min-height:48px;box-sizing:border-box;padding:8px}:host([align=end]) #wrapper{text-align:end;align-items:flex-end}:host([align=center]) #wrapper{text-align:center;align-items:center}</style><div id="wrapper"><slot></slot></div>';
2
+ const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-comp-table-color-cell-default-border-initial)}#wrapper{display:flex;flex-direction:column;justify-content:center;min-height:48px;box-sizing:border-box;padding:8px}:host([align=end]) #wrapper{text-align:end;align-items:flex-end}:host([align=center]) #wrapper{text-align:center;align-items:center}</style><div id="wrapper"><slot></slot></div>';
3
3
  import { alignValues } from './utils';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
@@ -1,3 +1,4 @@
1
+ import '../text';
1
2
  import type { TSinchTableHeaderCellElement, TSinchTableHeaderCellReact } from './types';
2
3
  declare global {
3
4
  namespace JSX {
@@ -1,6 +1,7 @@
1
+ import '../text';
1
2
  import { alignValues } from '../table-cell/utils';
2
- import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
3
- const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-color-stormy-200);vertical-align:middle;--sinch-color-icon:var(--sinch-color-stormy-200)}#wrapper{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:100%;padding:8px;box-sizing:border-box;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-300);--sinch-icon-button-color:var(--sinch-color-stormy-100)}#text{flex-shrink:1;min-width:0;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-200)}:host([align=center])>#wrapper{justify-content:center}:host([align=end])>#wrapper{justify-content:flex-end}:host(:is([text=""],:not([text]))) #text{display:none}:host([fit]:not([fit=false])){width:1px}</style><div id="wrapper"><slot name="checkbox"></slot><slot name="left"></slot><span id="text"></span><slot name="tooltip"></slot><slot name="right"></slot></div>';
3
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
4
+ const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-comp-table-color-head-cell-default-border-initial);vertical-align:middle}#wrapper{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:100%;padding:8px;box-sizing:border-box;--sinch-global-color-icon:var(--sinch-comp-table-color-head-cell-default-icon-initial)}#text{flex-shrink:1;min-width:0;--sinch-global-color-text:var(--sinch-comp-table-color-head-cell-default-text-initial)}#text:empty{display:none}:host([align=center])>#wrapper{justify-content:center}:host([align=end])>#wrapper{justify-content:flex-end}:host([fit]){width:1px}</style><div id="wrapper"><slot name="checkbox"></slot><slot name="left"></slot><sinch-text id="text" type="m"></sinch-text><slot name="tooltip"></slot><slot name="right"></slot></div>';
4
5
  const template = document.createElement('template');
5
6
  template.innerHTML = templateHTML;
6
7
  defineCustomElement('sinch-table-head-cell', class extends NectaryElement {
@@ -16,15 +17,23 @@ defineCustomElement('sinch-table-head-cell', class extends NectaryElement {
16
17
  this.setAttribute('scope', 'col');
17
18
  }
18
19
  static get observedAttributes() {
19
- return ['text'];
20
+ return ['text', 'fit'];
20
21
  }
21
22
  attributeChangedCallback(name, oldVal, newVal) {
23
+ if (oldVal === newVal) {
24
+ return;
25
+ }
22
26
  switch (name) {
23
27
  case 'text':
24
28
  {
25
29
  this.#$text.textContent = newVal;
26
30
  break;
27
31
  }
32
+ case 'fit':
33
+ {
34
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
35
+ break;
36
+ }
28
37
  }
29
38
  }
30
39
  set text(value) {
@@ -1,5 +1,5 @@
1
- import { defineCustomElement, getBooleanAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:table-row}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-color-snow-100)}</style><slot></slot>';
1
+ import { defineCustomElement, getBooleanAttribute, isAttrTrue, NectaryElement, updateBooleanAttribute } from '../utils';
2
+ const templateHTML = '<style>:host{display:table-row;background-color:var(--sinch-comp-table-color-row-default-background-initial)}:host([selected]){background-color:var(--sinch-comp-table-color-row-checked-background-initial)}:host(:hover){background-color:var(--sinch-comp-table-color-row-default-background-hover)}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-comp-table-color-row-default-background-sticky)}</style><slot></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-table-row', class extends NectaryElement {
@@ -11,6 +11,22 @@ defineCustomElement('sinch-table-row', class extends NectaryElement {
11
11
  connectedCallback() {
12
12
  this.setAttribute('role', 'row');
13
13
  }
14
+ static get observedAttributes() {
15
+ return ['sticky', 'selected'];
16
+ }
17
+ attributeChangedCallback(name, oldVal, newVal) {
18
+ if (oldVal === newVal) {
19
+ return;
20
+ }
21
+ switch (name) {
22
+ case 'sticky':
23
+ case 'selected':
24
+ {
25
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
26
+ break;
27
+ }
28
+ }
29
+ }
14
30
  set sticky(isSticky) {
15
31
  updateBooleanAttribute(this, 'sticky', isSticky);
16
32
  }
package/tabs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;width:100%;height:40px;border-bottom:1px solid var(--sinch-color-border-default);box-sizing:border-box}</style><div id="wrapper"><slot></slot></div>';
2
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;width:100%;height:40px;border-bottom:1px solid var(--sinch-comp-tab-color-default-border-initial);box-sizing:border-box}</style><div id="wrapper"><slot></slot></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-tabs', class extends NectaryElement {
@@ -33,9 +33,6 @@ defineCustomElement('sinch-tabs', class extends NectaryElement {
33
33
  static get observedAttributes() {
34
34
  return ['value'];
35
35
  }
36
- get nodeName() {
37
- return 'select';
38
- }
39
36
  set value(value) {
40
37
  updateAttribute(this, 'value', value);
41
38
  }
package/tabs/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { TRect, TSinchElementReact } from '../types';
2
- import type { SyntheticEvent } from 'react';
3
2
  export type TSinchTabsElement = HTMLElement & {
4
3
  /** Value */
5
4
  value: string;
@@ -14,8 +13,6 @@ export type TSinchTabsReact = TSinchElementReact<TSinchTabsElement> & {
14
13
  value: string;
15
14
  /** Label that is used for a11y */
16
15
  'aria-label': string;
17
- /** @deprecated Change value handler */
18
- onChange?: (event: SyntheticEvent<TSinchTabsElement, CustomEvent<string>>) => void;
19
16
  /** Change value event */
20
17
  'on-change'?: (e: CustomEvent<string>) => void;
21
18
  };
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:block;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:column;padding:12px 16px 0;box-sizing:border-box;cursor:pointer;border-top-left-radius:var(--sinch-shape-radius-l);border-top-right-radius:var(--sinch-shape-radius-l);height:39px;--sinch-color-icon:var(--sinch-color-stormy-300);--sinch-size-icon:16px}#button:hover{background-color:var(--sinch-color-tropical-100)}#button:focus-visible::before{content:"";position:absolute;inset:0;bottom:-3px;border:2px solid var(--sinch-color-border-focus);border-top-left-radius:var(--sinch-shape-radius-l);border-top-right-radius:var(--sinch-shape-radius-l);pointer-events:none}#button:disabled{cursor:unset;pointer-events:none;--sinch-color-icon:var(--sinch-color-border-default)}:host([data-checked]) #button{--sinch-color-icon:var(--sinch-color-tropical-500)}:host([data-checked]) #button::after{content:"";position:absolute;left:4px;right:4px;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-color-tropical-500)}::slotted(*){display:block}</style><sinch-tooltip id="tooltip" inverted><button id="button"><slot name="icon"></slot></button></sinch-tooltip>';
2
+ const templateHTML = '<style>:host{display:block;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:column;padding:12px 16px 0;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-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::before{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-icon:var(--sinch-comp-tab-color-disabled-icon-initial)}:host([data-checked]) #button{--sinch-global-color-icon:var(--sinch-comp-tab-color-checked-icon-initial)}:host([data-checked]) #button::after{content:"";position:absolute;left:4px;right:4px;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-comp-tab-color-checked-border-initial)}::slotted(*){display:block}</style><sinch-tooltip id="tooltip"><button id="button"><slot name="icon"></slot></button></sinch-tooltip>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-tabs-icon-option', class extends NectaryElement {
@@ -46,7 +46,9 @@ defineCustomElement('sinch-tabs-icon-option', class extends NectaryElement {
46
46
  }
47
47
  case 'disabled':
48
48
  {
49
- this.#$button.disabled = isAttrTrue(newVal);
49
+ const isDisabled = isAttrTrue(newVal);
50
+ this.#$button.disabled = isDisabled;
51
+ updateBooleanAttribute(this, name, isDisabled);
50
52
  break;
51
53
  }
52
54
  case 'aria-label':
@@ -1,6 +1,6 @@
1
1
  import '../text';
2
2
  import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
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;border-top-left-radius:var(--sinch-shape-radius-l);border-top-right-radius:var(--sinch-shape-radius-l);height:39px;color:var(--sinch-color-stormy-300);--sinch-color-icon:var(--sinch-color-stormy-300);--sinch-size-icon:16px}#button:hover{background-color:var(--sinch-color-tropical-100)}#button:focus-visible::before{content:"";position:absolute;inset:0;bottom:-3px;border:2px solid var(--sinch-color-border-focus);border-top-left-radius:var(--sinch-shape-radius-l);border-top-right-radius:var(--sinch-shape-radius-l);pointer-events:none}#button:disabled{cursor:unset;pointer-events:none;color:var(--sinch-color-border-default);--sinch-color-icon:var(--sinch-color-border-default)}:host([data-checked]) #button{color:var(--sinch-color-tropical-500);--sinch-color-icon:var(--sinch-color-tropical-500)}:host([data-checked]) #button::after{content:"";position:absolute;left:4px;right:4px;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-color-tropical-500)}#text{flex-shrink:1;flex-basis:auto;min-width:0}::slotted(*){display:block}</style><button id="button"><slot name="icon"></slot><sinch-text id="text" type="m" ellipsis></sinch-text></button>';
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::before{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::after{content:"";position:absolute;left:4px;right:4px;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"><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;
6
6
  defineCustomElement('sinch-tabs-option', class extends NectaryElement {
@@ -23,6 +23,30 @@ defineCustomElement('sinch-tabs-option', class extends NectaryElement {
23
23
  static get observedAttributes() {
24
24
  return ['data-checked', 'disabled', 'text'];
25
25
  }
26
+ attributeChangedCallback(name, oldVal, newVal) {
27
+ if (oldVal === newVal) {
28
+ return;
29
+ }
30
+ switch (name) {
31
+ case 'text':
32
+ {
33
+ this.#$text.textContent = newVal;
34
+ break;
35
+ }
36
+ case 'data-checked':
37
+ {
38
+ updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
39
+ break;
40
+ }
41
+ case 'disabled':
42
+ {
43
+ const isDisabled = isAttrTrue(newVal);
44
+ this.#$button.disabled = isDisabled;
45
+ updateBooleanAttribute(this, name, isDisabled);
46
+ break;
47
+ }
48
+ }
49
+ }
26
50
  set value(value) {
27
51
  updateAttribute(this, 'value', value);
28
52
  }
@@ -41,25 +65,6 @@ defineCustomElement('sinch-tabs-option', class extends NectaryElement {
41
65
  get text() {
42
66
  return getAttribute(this, 'text', '');
43
67
  }
44
- attributeChangedCallback(name, _, newVal) {
45
- switch (name) {
46
- case 'text':
47
- {
48
- this.#$text.textContent = newVal;
49
- break;
50
- }
51
- case 'data-checked':
52
- {
53
- updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
54
- break;
55
- }
56
- case 'disabled':
57
- {
58
- this.#$button.disabled = isAttrTrue(newVal);
59
- break;
60
- }
61
- }
62
- }
63
68
  get focusable() {
64
69
  return true;
65
70
  }
package/tag/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import '../text';
2
- import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement } from '../utils';
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:24px;padding:0 9px;border-radius:12px;background-color:var(--sinch-tag-color-default-bg);color:var(--sinch-tag-color-default-fg);box-sizing:border-box;user-select:none;--sinch-color-icon:var(--sinch-tag-color-default-fg);--sinch-size-icon:16px}#text{flex:1}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px}::slotted(*){margin-left:-4px}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="text" type="xs" ellipsis></sinch-text></div>';
2
+ import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue } from '../utils';
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 { assertTagColor, getTagColorBg, getTagColorFg } from './utils';
5
5
  const template = document.createElement('template');
6
6
  template.innerHTML = templateHTML;
@@ -37,9 +37,12 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
37
37
  updateBooleanAttribute(this, 'small', isSmall);
38
38
  }
39
39
  static get observedAttributes() {
40
- return ['text', 'color'];
40
+ return ['text', 'color', 'small'];
41
41
  }
42
- attributeChangedCallback(name, _, newVal) {
42
+ attributeChangedCallback(name, oldVal, newVal) {
43
+ if (oldVal === newVal) {
44
+ return;
45
+ }
43
46
  switch (name) {
44
47
  case 'color':
45
48
  {
@@ -51,6 +54,11 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
51
54
  this.#$text.textContent = newVal;
52
55
  break;
53
56
  }
57
+ case 'small':
58
+ {
59
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
60
+ break;
61
+ }
54
62
  }
55
63
  }
56
64
  #updateColor() {
@@ -65,12 +73,12 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
65
73
  const bg = getTagColorBg(colorName);
66
74
  const fg = getTagColorFg(colorName);
67
75
  this.#$wrapper.style.setProperty('background-color', bg);
68
- this.#$wrapper.style.setProperty('color', fg);
69
- this.#$wrapper.style.setProperty('--sinch-color-icon', fg);
76
+ this.#$wrapper.style.setProperty('--sinch-global-color-text', fg);
77
+ this.#$wrapper.style.setProperty('--sinch-global-color-icon', fg);
70
78
  } else {
71
79
  this.#$wrapper.style.removeProperty('background-color');
72
- this.#$wrapper.style.removeProperty('color');
73
- this.#$wrapper.style.removeProperty('--sinch-color-icon');
80
+ this.#$wrapper.style.removeProperty('--sinch-global-color-text');
81
+ this.#$wrapper.style.removeProperty('--sinch-global-color-icon');
74
82
  }
75
83
  }
76
84
  });
package/tag/utils.js CHANGED
@@ -1,11 +1,11 @@
1
1
  export const getTagColorBg = id => {
2
- return `var(--sinch-tag-color-${id}-bg)`;
2
+ return `var(--sinch-comp-tag-color-${id}-background)`;
3
3
  };
4
4
  export const getTagColorFg = id => {
5
- return `var(--sinch-tag-color-${id}-fg)`;
5
+ return `var(--sinch-comp-tag-color-${id}-foreground)`;
6
6
  };
7
7
  export const assertTagColor = (root, id) => {
8
- if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-tag-color-${id}-bg`).length === 0) {
8
+ if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-comp-tag-color-${id}-background`).length === 0) {
9
9
  throw new Error(`Invalid sinch-tag color name: ${id}`);
10
10
  }
11
11
  };
package/text/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute, NectaryElement, getLiteralAttribute, updateLiteralAttribute, isAttrTrue } from '../utils';
2
- const templateHTML = '<style>:host{display:block;font:var(--sinch-font-text-m);font-style:inherit;font-weight:inherit;text-decoration:inherit}:host([inline]:not([inline=false])){display:inline}:host([type="s"]){font:var(--sinch-font-text-s)}:host([type=xs]){font:var(--sinch-font-text-xs)}:host([type=xxs]){font:var(--sinch-font-text-xxs)}:host([emphasized]:not([emphasized=false])){font-weight:var(--sinch-font-weight-emphasized)}:host([ellipsis]:not([ellipsis=false])){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;--sinch-text-white-space:nowrap}</style><slot></slot>';
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 { assertType, typeValues } from './utils';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
@@ -10,7 +10,33 @@ defineCustomElement('sinch-text', class extends NectaryElement {
10
10
  shadowRoot.appendChild(template.content.cloneNode(true));
11
11
  }
12
12
  connectedCallback() {
13
- this.setAttribute('role', getBooleanAttribute(this, 'inline') ? 'text' : 'paragraph');
13
+ this.#updateRole();
14
+ }
15
+ static get observedAttributes() {
16
+ return ['type', 'inline', 'ellipsis', 'emphasized'];
17
+ }
18
+ attributeChangedCallback(name, _, newVal) {
19
+ switch (name) {
20
+ case 'type':
21
+ {
22
+ if ('production' !== 'production') {
23
+ assertType(newVal);
24
+ }
25
+ break;
26
+ }
27
+ case 'inline':
28
+ {
29
+ this.#updateRole();
30
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
31
+ break;
32
+ }
33
+ case 'ellipsis':
34
+ case 'emphasized':
35
+ {
36
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
37
+ break;
38
+ }
39
+ }
14
40
  }
15
41
  get type() {
16
42
  return getLiteralAttribute(this, typeValues, 'type');
@@ -36,23 +62,7 @@ defineCustomElement('sinch-text', class extends NectaryElement {
36
62
  get emphasized() {
37
63
  return getBooleanAttribute(this, 'emphasized');
38
64
  }
39
- static get observedAttributes() {
40
- return ['type', 'inline'];
41
- }
42
- attributeChangedCallback(name, _, newVal) {
43
- switch (name) {
44
- case 'type':
45
- {
46
- if ('production' !== 'production') {
47
- assertType(newVal);
48
- }
49
- break;
50
- }
51
- case 'inline':
52
- {
53
- this.setAttribute('role', isAttrTrue(newVal) ? 'text' : 'paragraph');
54
- break;
55
- }
56
- }
65
+ #updateRole() {
66
+ this.setAttribute('role', getBooleanAttribute(this, 'inline') ? 'text' : 'paragraph');
57
67
  }
58
68
  });
package/textarea/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Context, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
2
  import { DEFAULT_SIZE } from '../utils/size';
3
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-input-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m)}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;box-sizing:border-box;background-color:var(--sinch-color-snow-100);border-radius:var(--sinch-shape-radius);padding-right:2px;padding-bottom:2px;overflow:hidden}#input{all:initial;display:block;font:var(--sinch-font-text-m);color:var(--sinch-color-text-default);resize:none;white-space:pre-wrap;overflow-wrap:break-word;padding:8px 10px 8px 12px}#input::placeholder{font:var(--sinch-font-text-m);color:var(--sinch-color-text-muted);opacity:1}#input:disabled{color:var(--sinch-color-text-disabled);-webkit-text-fill-color:var(--sinch-color-text-disabled)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:focus{border-color:var(--sinch-color-stormy-600)}:host([resizable]:not([resizable=false])) #input{resize:vertical}#border{position:absolute;border:1px solid var(--sinch-color-border-dark);border-radius:var(--sinch-shape-radius);inset:0;pointer-events:none}:host([invalid]:not([invalid=false])) #border{border-color:var(--sinch-color-text-invalid)}#input:focus+#border{border-color:var(--sinch-color-border-focus);border-width:2px}#input:disabled+#border{border-color:var(--sinch-color-snow-500)}#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>';
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');
5
5
  template.innerHTML = templateHTML;
6
6
  defineCustomElement('sinch-textarea', class extends NectaryElement {
@@ -47,7 +47,7 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
47
47
  this.#controller.abort();
48
48
  }
49
49
  static get observedAttributes() {
50
- return ['value', 'placeholder', 'invalid', 'disabled', 'rows'];
50
+ return ['value', 'placeholder', 'invalid', 'disabled', 'rows', 'resizable'];
51
51
  }
52
52
  attributeChangedCallback(name, oldVal, newVal) {
53
53
  if (oldVal === newVal) {
@@ -76,7 +76,9 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
76
76
  }
77
77
  case 'invalid':
78
78
  {
79
- updateExplicitBooleanAttribute(this, 'aria-invalid', isAttrTrue(newVal));
79
+ const isInvalid = isAttrTrue(newVal);
80
+ updateExplicitBooleanAttribute(this, 'aria-invalid', isInvalid);
81
+ updateBooleanAttribute(this, 'invalid', isInvalid);
80
82
  break;
81
83
  }
82
84
  case 'disabled':
@@ -91,11 +93,13 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
91
93
  updateAttribute(this.#$input, 'rows', newVal);
92
94
  break;
93
95
  }
96
+ case 'resizable':
97
+ {
98
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
99
+ break;
100
+ }
94
101
  }
95
102
  }
96
- get nodeName() {
97
- return 'textarea';
98
- }
99
103
  set value(value) {
100
104
  updateAttribute(this, 'value', value);
101
105
  }
@@ -1,5 +1,4 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- import type { SyntheticEvent } from 'react';
3
2
  export type TSinchTextareaElement = HTMLElement & {
4
3
  /** Value */
5
4
  value: string;
@@ -49,8 +48,6 @@ export type TSinchTextareaReact = TSinchElementReact<TSinchTextareaElement> & {
49
48
  rows?: number;
50
49
  /** Whether the text field is resizable */
51
50
  resizable?: boolean;
52
- /** @deprecated Change value handler */
53
- onChange?: (e: SyntheticEvent<TSinchTextareaElement, CustomEvent<string>>) => void;
54
51
  /** Change value handler */
55
52
  'on-change'?: (e: CustomEvent<string>) => void;
56
53
  /** Focus handler */
@@ -1,5 +1,5 @@
1
- import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute } from '../utils';
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]:not([small=false])) #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>';
1
+ import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, isAttrTrue } from '../utils';
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;
5
5
  defineCustomElement('sinch-tile-control', class extends NectaryElement {
@@ -24,8 +24,27 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
24
24
  static get observedAttributes() {
25
25
  return ['value', 'small', 'multiple'];
26
26
  }
27
- get nodeName() {
28
- return 'select';
27
+ attributeChangedCallback(name, oldVal, newVal) {
28
+ if (oldVal === newVal) {
29
+ return;
30
+ }
31
+ switch (name) {
32
+ case 'value':
33
+ {
34
+ this.#onValueChange(newVal ?? '');
35
+ break;
36
+ }
37
+ case 'small':
38
+ {
39
+ this.#onSmallChange();
40
+ updateBooleanAttribute(this, name, isAttrTrue(newVal));
41
+ break;
42
+ }
43
+ case 'multiple':
44
+ {
45
+ this.#onValueChange(this.value);
46
+ }
47
+ }
29
48
  }
30
49
  set value(value) {
31
50
  updateAttribute(this, 'value', value);
@@ -51,27 +70,6 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
51
70
  get cols() {
52
71
  return getIntegerAttribute(this, 'cols', 1);
53
72
  }
54
- attributeChangedCallback(name, oldVal, newVal) {
55
- if (oldVal === newVal) {
56
- return;
57
- }
58
- switch (name) {
59
- case 'value':
60
- {
61
- this.#onValueChange(newVal ?? '');
62
- break;
63
- }
64
- case 'small':
65
- {
66
- this.#onSmallChange();
67
- break;
68
- }
69
- case 'multiple':
70
- {
71
- this.#onValueChange(this.value);
72
- }
73
- }
74
- }
75
73
  #onSlotChange = () => {
76
74
  this.#onValueChange(this.value);
77
75
  this.#onSmallChange();
@@ -1,5 +1,4 @@
1
1
  import type { TSinchElementReact } from '../types';
2
- import type { SyntheticEvent } from 'react';
3
2
  export type TSinchTileControlElement = HTMLElement & {
4
3
  /** Value */
5
4
  value: string;
@@ -31,8 +30,6 @@ export type TSinchTileControlReact = TSinchElementReact<TSinchTileControlElement
31
30
  cols: number;
32
31
  /** Label that is used for a11y */
33
32
  'aria-label': string;
34
- /** @deprecated Change value handler */
35
- onChange?: (event: SyntheticEvent<TSinchTileControlElement, CustomEvent<string>>) => void;
36
33
  /** Change value handler */
37
34
  'on-change'?: (e: CustomEvent<string>) => void;
38
35
  };
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px);pointer-events:none}:host([data-small])>button:focus-visible::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}button:enabled:hover{background-color:var(--sinch-color-tropical-100)}button:enabled:hover::before{border-color:var(--sinch-color-tropical-100)}:host([data-checked])>button:enabled,button:enabled:active{box-shadow:var(--sinch-elevation-level-0)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px;border-color:var(--sinch-color-stormy-500)}button:disabled{cursor:initial}button:disabled>#icon,button:disabled>#text{opacity:.5}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:32px;height:32px;align-self:center;--sinch-size-icon:32px;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([data-small]) #icon{width:24px;height:24px;--sinch-size-icon:24px}button>*{pointer-events:none}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
2
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:var(--sinch-local-size);height:var(--sinch-local-size);padding:16px 8px 8px;border-radius:var(--sinch-local-shape-radius);background-color:var(--sinch-local-color-background);box-shadow:var(--sinch-local-shadow);cursor:pointer;--sinch-local-color-background:var(--sinch-comp-tile-control-color-default-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-default-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-initial);--sinch-local-shape-radius:var(--sinch-comp-tile-control-shape-radius-l);--sinch-local-size:88px;--sinch-local-size-icon:var(--sinch-comp-tile-control-size-m-icon)}button::before{content:"";position:absolute;inset:0;border:1px solid var(--sinch-local-color-border);border-radius:var(--sinch-local-shape-radius);pointer-events:none}button:focus-visible::after{position:absolute;content:"";inset:-4px;padding:2px;border:2px solid var(--sinch-comp-tile-control-color-default-outline-focus);border-radius:calc(var(--sinch-local-shape-radius) + 4px);pointer-events:none}:host([data-small])>button{padding:12px 4px 4px;--sinch-local-shape-radius:var(--sinch-comp-tile-control-shape-radius-s);--sinch-local-size:64px;--sinch-local-size-icon:var(--sinch-comp-tile-control-size-s-icon)}button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-tile-control-color-default-background-hover);--sinch-local-color-border:var(--sinch-comp-tile-control-color-default-border-hover);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-hover)}:host([data-checked])>button:enabled,button:enabled:active{--sinch-local-color-background:var(--sinch-comp-tile-control-color-checked-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-checked-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-checked-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-checked-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-active)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px}button:disabled{cursor:initial;--sinch-local-color-background:var(--sinch-comp-tile-control-color-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-disabled-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-disabled)}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-comp-tile-control-font-label);color:var(--sinch-local-color-text);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:var(--sinch-local-size-icon);height:var(--sinch-local-size-icon);align-self:center;--sinch-global-size-icon:var(--sinch-local-size-icon);--sinch-global-color-icon:var(--sinch-local-color-icon)}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-tile-control-option', class extends NectaryElement {