@nectary/components 1.4.0 → 2.1.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 (209) 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/index.js +5 -1
  6. package/action-menu-option/index.js +2 -2
  7. package/alert/index.js +4 -21
  8. package/alert/utils.d.ts +0 -3
  9. package/alert/utils.js +1 -6
  10. package/avatar/index.js +5 -21
  11. package/avatar/utils.d.ts +0 -4
  12. package/avatar/utils.js +2 -15
  13. package/badge/index.js +36 -68
  14. package/badge/types.d.ts +0 -4
  15. package/badge/utils.d.ts +0 -6
  16. package/badge/utils.js +1 -17
  17. package/button/index.js +25 -27
  18. package/button/types.d.ts +2 -2
  19. package/button/utils.d.ts +0 -3
  20. package/button/utils.js +1 -9
  21. package/card/index.js +5 -16
  22. package/card/types.d.ts +0 -6
  23. package/card-container/index.js +1 -1
  24. package/chat-block/index.js +1 -1
  25. package/chat-bubble/index.d.ts +0 -1
  26. package/chat-bubble/index.js +3 -25
  27. package/checkbox/index.js +32 -33
  28. package/checkbox/types.d.ts +0 -3
  29. package/chip/index.js +54 -44
  30. package/chip/utils.d.ts +0 -1
  31. package/chip/utils.js +2 -7
  32. package/code-tag/index.js +1 -1
  33. package/color-menu/index.d.ts +0 -3
  34. package/color-menu/index.js +55 -101
  35. package/color-menu/types.d.ts +0 -4
  36. package/color-menu-option/index.d.ts +14 -0
  37. package/color-menu-option/index.js +52 -0
  38. package/color-menu-option/types.d.ts +9 -0
  39. package/color-menu-option/utils.d.ts +1 -0
  40. package/color-menu-option/utils.js +11 -0
  41. package/color-swatch/index.js +2 -5
  42. package/color-swatch/utils.d.ts +0 -1
  43. package/color-swatch/utils.js +2 -7
  44. package/date-picker/index.js +3 -40
  45. package/date-picker/types.d.ts +0 -3
  46. package/date-picker/utils.d.ts +0 -8
  47. package/date-picker/utils.js +0 -20
  48. package/dialog/index.js +2 -6
  49. package/dialog/types.d.ts +0 -2
  50. package/emoji/index.js +1 -1
  51. package/emoji-picker/index.d.ts +1 -0
  52. package/emoji-picker/index.js +36 -34
  53. package/field/index.js +39 -32
  54. package/file-drop/index.js +1 -1
  55. package/file-status/index.js +4 -25
  56. package/file-status/utils.d.ts +0 -3
  57. package/file-status/utils.js +1 -6
  58. package/flag/index.js +1 -1
  59. package/grid/index.js +1 -1
  60. package/help-tooltip/index.d.ts +0 -1
  61. package/help-tooltip/index.js +3 -13
  62. package/horizontal-stepper/index.js +1 -1
  63. package/horizontal-stepper-item/index.d.ts +2 -0
  64. package/horizontal-stepper-item/index.js +8 -12
  65. package/icon/index.js +1 -1
  66. package/icon-button/index.js +23 -27
  67. package/icon-button/utils.d.ts +0 -3
  68. package/icon-button/utils.js +1 -9
  69. package/inline-alert/index.js +20 -37
  70. package/inline-alert/utils.d.ts +0 -3
  71. package/inline-alert/utils.js +1 -6
  72. package/input/index.d.ts +0 -3
  73. package/input/index.js +22 -58
  74. package/input/types.d.ts +1 -5
  75. package/input/utils.d.ts +0 -3
  76. package/input/utils.js +1 -6
  77. package/link/index.js +35 -37
  78. package/list-item/index.js +1 -1
  79. package/package.json +11 -11
  80. package/pagination/index.js +8 -21
  81. package/pagination/types.d.ts +0 -3
  82. package/pop/index.js +39 -38
  83. package/pop/utils.d.ts +0 -3
  84. package/pop/utils.js +0 -5
  85. package/popover/index.js +42 -51
  86. package/popover/utils.d.ts +0 -3
  87. package/popover/utils.js +0 -5
  88. package/progress/index.js +20 -15
  89. package/radio/index.js +19 -6
  90. package/radio/types.d.ts +3 -3
  91. package/radio-option/index.js +35 -27
  92. package/rich-text/index.js +3 -10
  93. package/rich-text/utils.d.ts +0 -3
  94. package/rich-text/utils.js +1 -6
  95. package/segment/index.js +3 -7
  96. package/segment-collapse/index.js +2 -11
  97. package/segment-collapse/types.d.ts +0 -3
  98. package/segmented-control/index.js +0 -3
  99. package/segmented-control/types.d.ts +0 -3
  100. package/segmented-control-option/index.js +20 -19
  101. package/segmented-icon-control/index.js +1 -4
  102. package/segmented-icon-control/types.d.ts +0 -3
  103. package/segmented-icon-control-option/index.js +18 -14
  104. package/select-button/index.js +29 -31
  105. package/select-menu/index.js +18 -8
  106. package/select-menu-option/index.js +2 -5
  107. package/skeleton/index.js +1 -1
  108. package/skeleton-item/index.js +1 -1
  109. package/spinner/index.js +3 -10
  110. package/table/index.js +1 -1
  111. package/table-body/index.js +1 -1
  112. package/table-cell/index.js +1 -1
  113. package/table-head-cell/index.d.ts +1 -0
  114. package/table-head-cell/index.js +12 -3
  115. package/table-row/index.js +18 -2
  116. package/tabs/index.js +1 -4
  117. package/tabs/types.d.ts +0 -3
  118. package/tabs-icon-option/index.js +4 -2
  119. package/tabs-option/index.js +25 -20
  120. package/tag/index.js +17 -12
  121. package/tag/utils.d.ts +0 -1
  122. package/tag/utils.js +2 -7
  123. package/text/index.js +24 -21
  124. package/text/utils.d.ts +0 -3
  125. package/text/utils.js +1 -6
  126. package/textarea/index.js +10 -6
  127. package/textarea/types.d.ts +0 -3
  128. package/tile-control/index.js +23 -25
  129. package/tile-control/types.d.ts +0 -3
  130. package/tile-control-option/index.js +1 -1
  131. package/time-picker/index.js +2 -11
  132. package/time-picker/types.d.ts +0 -3
  133. package/time-picker/utils.d.ts +1 -1
  134. package/time-picker/utils.js +17 -5
  135. package/title/index.js +28 -30
  136. package/title/utils.d.ts +0 -7
  137. package/title/utils.js +1 -29
  138. package/toast/index.js +22 -39
  139. package/toast/utils.d.ts +0 -3
  140. package/toast/utils.js +1 -6
  141. package/toggle/index.js +33 -30
  142. package/toggle/types.d.ts +0 -3
  143. package/tooltip/index.js +3 -15
  144. package/tooltip/types.d.ts +0 -12
  145. package/tooltip/utils.d.ts +0 -5
  146. package/tooltip/utils.js +0 -10
  147. package/utils/dom.js +0 -5
  148. package/utils/element.js +2 -2
  149. package/utils/size.d.ts +0 -5
  150. package/utils/size.js +1 -17
  151. package/vertical-stepper/index.js +1 -1
  152. package/vertical-stepper-item/index.d.ts +2 -0
  153. package/vertical-stepper-item/index.js +8 -12
  154. package/logo/create-logo-class.d.ts +0 -1
  155. package/logo/create-logo-class.js +0 -52
  156. package/logo/engage-icon/index.d.ts +0 -11
  157. package/logo/engage-icon/index.js +0 -4
  158. package/logo/engage-icon-wordmark/index.d.ts +0 -11
  159. package/logo/engage-icon-wordmark/index.js +0 -4
  160. package/logo/sinch-icon/index.d.ts +0 -11
  161. package/logo/sinch-icon/index.js +0 -4
  162. package/logo/sinch-icon-wordmark/index.d.ts +0 -11
  163. package/logo/sinch-icon-wordmark/index.js +0 -4
  164. package/logo/types.d.ts +0 -11
  165. package/theme/accordion-item.css +0 -4
  166. package/theme/alert.css +0 -6
  167. package/theme/avatar.css +0 -25
  168. package/theme/badge.css +0 -15
  169. package/theme/button.css +0 -146
  170. package/theme/chat.css +0 -9
  171. package/theme/chip.css +0 -68
  172. package/theme/color-menu.css +0 -4
  173. package/theme/color-swatch.css +0 -71
  174. package/theme/colors.d.ts +0 -4
  175. package/theme/colors.js +0 -4
  176. package/theme/contextual.css +0 -40
  177. package/theme/date-picker.css +0 -7
  178. package/theme/dialog.css +0 -4
  179. package/theme/elevation.css +0 -7
  180. package/theme/emoji-picker.css +0 -13
  181. package/theme/emoji.css +0 -5
  182. package/theme/file-status.css +0 -7
  183. package/theme/flag.css +0 -4
  184. package/theme/fonts.css +0 -86
  185. package/theme/fonts.json +0 -89
  186. package/theme/help-tooltip.css +0 -5
  187. package/theme/horizontal-stepper.css +0 -5
  188. package/theme/icon-button.css +0 -68
  189. package/theme/icon.css +0 -7
  190. package/theme/index.css +0 -4
  191. package/theme/index.d.ts +0 -39
  192. package/theme/index.js +0 -39
  193. package/theme/inline-alert.css +0 -7
  194. package/theme/input.css +0 -10
  195. package/theme/link.css +0 -5
  196. package/theme/pagination.css +0 -5
  197. package/theme/palette.css +0 -90
  198. package/theme/segment.css +0 -4
  199. package/theme/select-button.css +0 -10
  200. package/theme/select-menu.css +0 -6
  201. package/theme/shapes.css +0 -8
  202. package/theme/size.css +0 -9
  203. package/theme/spinner.css +0 -7
  204. package/theme/tag.css +0 -67
  205. package/theme/time-picker.css +0 -4
  206. package/theme/toast.css +0 -7
  207. package/theme/typography.css +0 -16
  208. package/theme/vertical-stepper.css +0 -5
  209. /package/{logo → color-menu-option}/types.js +0 -0
@@ -1,28 +1,25 @@
1
1
  import '../spinner';
2
2
  import '../icon';
3
3
  import '../text';
4
- import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, updateBooleanAttribute, getCssVar } from '../utils';
5
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:12px 16px;box-sizing:border-box;min-height:48px;min-width:148px;background-color:var(--sinch-color-bg-primary-contrast);border-radius:var(--sinch-shape-radius-m)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}#content-wrapper{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;min-height:24px;margin-left:16px;color:var(--sinch-color-stormy-500)}#icon,#icon-loading{display:none;--sinch-color-icon:var(--sinch-color-stormy-500)}#action{display:flex;gap:4px;height:32px;margin-top:-4px;margin-bottom:-4px}:host([type=error]) #icon,:host([type=loading]) #icon-loading,:host([type=pending]) #icon,:host([type=progress]) #icon,:host([type=success]) #icon{display:block}:host([type=success]) #icon{--sinch-color-icon:var(--sinch-color-feedback-success-icon)}:host([type=error]) #icon{--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}</style><div id="wrapper"><sinch-spinner id="icon-loading" size="m"></sinch-spinner><sinch-icon id="icon"></sinch-icon><div id="content-wrapper"><sinch-text id="filename" type="m" ellipsis></sinch-text><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
6
- import { assertType, typeValues } from './utils';
4
+ import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
5
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:12px 16px;box-sizing:border-box;min-height:48px;min-width:148px;border-radius:var(--sinch-comp-file-status-shape-radius)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-file-status-color-error-background)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-file-status-color-success-background)}:host([type=pending]) #wrapper{background-color:var(--sinch-comp-file-status-color-pending-background)}:host([type=progress]) #wrapper{background-color:var(--sinch-comp-file-status-color-progress-background)}:host([type=loading]) #wrapper{background-color:var(--sinch-comp-file-status-color-loading-background)}#content-wrapper{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;min-height:24px;margin-left:16px}:host([type=error]) #filename{--sinch-global-color-text:var(--sinch-comp-file-status-color-error-text)}:host([type=success]) #filename{--sinch-global-color-text:var(--sinch-comp-file-status-color-success-text)}:host([type=pending]) #filename{--sinch-global-color-text:var(--sinch-comp-file-status-color-pending-text)}:host([type=progress]) #filename{--sinch-global-color-text:var(--sinch-comp-file-status-color-progress-text)}:host([type=loading]) #filename{--sinch-global-color-text:var(--sinch-comp-file-status-color-loading-text)}#action{display:flex;gap:4px;height:32px;margin-top:-4px;margin-bottom:-4px}#icon-error,#icon-loading,#icon-pending,#icon-progress,#icon-success{display:none}#icon-pending{--sinch-global-color-icon:var(--sinch-comp-file-status-color-pending-icon)}#icon-success{--sinch-global-color-icon:var(--sinch-comp-file-status-color-success-icon)}#icon-progress{--sinch-global-color-icon:var(--sinch-comp-file-status-color-progress-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-file-status-color-error-icon)}#icon-loading{--sinch-global-color-icon:var(--sinch-comp-file-status-color-loading-icon)}:host([type=error]) #icon-error,:host([type=loading]) #icon-loading,:host([type=pending]) #icon-pending,:host([type=progress]) #icon-progress,:host([type=success]) #icon-success{display:block}</style><div id="wrapper"><sinch-spinner id="icon-loading" size="m"></sinch-spinner><sinch-icon id="icon-pending" name="pending_actions"></sinch-icon><sinch-icon id="icon-success" name="check_circle"></sinch-icon><sinch-icon id="icon-progress" name="text_snippet"></sinch-icon><sinch-icon id="icon-error" name="report"></sinch-icon><div id="content-wrapper"><sinch-text id="filename" type="m" ellipsis></sinch-text><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
6
+ import { typeValues } from './utils';
7
7
  const template = document.createElement('template');
8
8
  template.innerHTML = templateHTML;
9
9
  defineCustomElement('sinch-file-status', class extends NectaryElement {
10
10
  #$filename;
11
11
  #$contentSlot;
12
- #$icon;
13
12
  constructor() {
14
13
  super();
15
14
  const shadowRoot = this.attachShadow();
16
15
  shadowRoot.appendChild(template.content.cloneNode(true));
17
16
  this.#$filename = shadowRoot.querySelector('#filename');
18
17
  this.#$contentSlot = shadowRoot.querySelector('slot[name="content"]');
19
- this.#$icon = shadowRoot.querySelector('#icon');
20
18
  }
21
19
  connectedCallback() {
22
20
  super.connectedCallback();
23
21
  this.#$contentSlot.addEventListener('slotchange', this.#onContentSlotChange);
24
22
  this.#onContentSlotChange();
25
- this.#updateIcon();
26
23
  }
27
24
  disconnectedCallback() {
28
25
  super.disconnectedCallback();
@@ -41,21 +38,13 @@ defineCustomElement('sinch-file-status', class extends NectaryElement {
41
38
  updateAttribute(this, 'filename', value);
42
39
  }
43
40
  static get observedAttributes() {
44
- return ['filename', 'type'];
41
+ return ['filename'];
45
42
  }
46
43
  attributeChangedCallback(name, oldVal, newVal) {
47
44
  if (oldVal === newVal) {
48
45
  return;
49
46
  }
50
47
  switch (name) {
51
- case 'type':
52
- {
53
- if ('production' !== 'production') {
54
- assertType(newVal);
55
- }
56
- this.#updateIcon();
57
- break;
58
- }
59
48
  case 'filename':
60
49
  {
61
50
  this.#$filename.textContent = newVal;
@@ -63,16 +52,6 @@ defineCustomElement('sinch-file-status', class extends NectaryElement {
63
52
  }
64
53
  }
65
54
  }
66
- #updateIcon() {
67
- if (!this.isConnected) {
68
- return;
69
- }
70
- const type = this.type;
71
- if (type === 'loading') {
72
- return;
73
- }
74
- updateAttribute(this.#$icon, 'name', getCssVar(this, `--sinch-file-status-icon-${type}`));
75
- }
76
55
  #onContentSlotChange = () => {
77
56
  updateBooleanAttribute(this.#$filename, 'emphasized', this.#$contentSlot.assignedElements().length > 0);
78
57
  };
@@ -1,5 +1,2 @@
1
1
  import type { TSinchFileStatusType } from './types';
2
2
  export declare const typeValues: readonly TSinchFileStatusType[];
3
- type TAssertType = (value: string | null) => asserts value is TSinchFileStatusType;
4
- export declare const assertType: TAssertType;
5
- export {};
@@ -1,6 +1 @@
1
- export const typeValues = ['pending', 'loading', 'progress', 'success', 'error'];
2
- export const assertType = value => {
3
- if (value === null || !typeValues.includes(value)) {
4
- throw new Error(`sinch-file-status: invalid type attribute: ${value}`);
5
- }
6
- };
1
+ export const typeValues = ['pending', 'loading', 'progress', 'success', 'error'];
package/flag/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, NectaryElement, updateAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:contents}#image{pointer-events:none;width:var(--sinch-size-icon,48px);height:var(--sinch-size-icon,48px);object-fit:contain}</style><img id="image" src="" alt="" loading="lazy"/>';
2
+ const templateHTML = '<style>:host{display:contents}#image{pointer-events:none;width:var(--sinch-global-size-icon,48px);height:var(--sinch-global-size-icon,48px);object-fit:contain}</style><img id="image" src="" alt="" loading="lazy"/>';
3
3
  import { getFlagUrl } from './utils';
4
4
  const template = document.createElement('template');
5
5
  template.innerHTML = templateHTML;
package/grid/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, NectaryElement } from '../utils';
2
- const templateHTML = '<style>:host{--sinch-grid-gutter:24px;--sinch-grid-margin:32px;--sinch-grid-num-columns:12;display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),minmax(0,1fr));grid-column-gap:var(--sinch-grid-gutter);grid-row-gap:var(--sinch-grid-gutter);padding:var(--sinch-grid-margin)}@media only screen and (max-width:1439px){:host{--sinch-grid-gutter:24px;--sinch-grid-margin:24px;--sinch-grid-num-columns:12}}@media only screen and (max-width:1023px){:host{--sinch-grid-gutter:24px;--sinch-grid-margin:24px;--sinch-grid-num-columns:8}}@media only screen and (max-width:767px){:host{--sinch-grid-gutter:16px;--sinch-grid-margin:16px;--sinch-grid-num-columns:4}}</style><slot name="item"></slot>';
2
+ const templateHTML = '<style>:host{--sinch-comp-grid-gutter:24px;--sinch-comp-grid-margin:32px;--sinch-comp-grid-num-columns:12;display:grid;grid-template-columns:repeat(var(--sinch-comp-grid-num-columns),minmax(0,1fr));grid-column-gap:var(--sinch-comp-grid-gutter);grid-row-gap:var(--sinch-comp-grid-gutter);padding:var(--sinch-comp-grid-margin)}@media only screen and (max-width:1439px){:host{--sinch-comp-grid-gutter:24px;--sinch-comp-grid-margin:24px;--sinch-comp-grid-num-columns:12}}@media only screen and (max-width:1023px){:host{--sinch-comp-grid-gutter:24px;--sinch-comp-grid-margin:24px;--sinch-comp-grid-num-columns:8}}@media only screen and (max-width:767px){:host{--sinch-comp-grid-gutter:16px;--sinch-comp-grid-margin:16px;--sinch-comp-grid-num-columns:4}}</style><slot name="item"></slot>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-grid', class extends NectaryElement {
@@ -1,5 +1,4 @@
1
1
  import '../tooltip';
2
- import '../icon';
3
2
  import type { TSinchHelpTooltipElement, TSinchHelpTooltipReact } from './types';
4
3
  declare global {
5
4
  namespace JSX {
@@ -1,11 +1,9 @@
1
1
  import '../tooltip';
2
- import '../icon';
3
- import { defineCustomElement, getAttribute, getBooleanAttribute, getCssVar, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
4
- const templateHTML = '<style>:host{display:contents}#icon{--sinch-size-icon:18px;--sinch-icon-font-variation-settings:var(--sinch-help-tooltip-icon-font-variation-settings)}</style><sinch-tooltip type="fast"><sinch-icon id="icon"></sinch-icon></sinch-tooltip>';
2
+ import { defineCustomElement, getAttribute, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateIntegerAttribute } from '../utils';
3
+ const templateHTML = '<style>:host{display:contents;--sinch-comp-help-tooltip-color-icon:var(--sinch-sys-color-text-default)}#icon{height:18px;fill:var(--sinch-comp-help-tooltip-color-icon)}</style><sinch-tooltip type="fast"><svg id="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2Zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8Zm-1-4h2v2h-2v-2Zm1.61-9.96c-2.06-.3-3.88.97-4.43 2.79-.18.58.26 1.17.87 1.17h.2c.41 0 .74-.29.88-.67.32-.89 1.27-1.5 2.3-1.28.95.2 1.65 1.13 1.57 2.1-.1 1.34-1.62 1.63-2.45 2.88 0 .01-.01.01-.01.02-.01.02-.02.03-.03.05-.09.15-.18.32-.25.5-.01.03-.03.05-.04.08-.01.02-.01.04-.02.07-.12.34-.2.75-.2 1.25h2c0-.42.11-.77.28-1.07.02-.03.03-.06.05-.09.08-.14.18-.27.28-.39.01-.01.02-.03.03-.04.1-.12.21-.23.33-.34.96-.91 2.26-1.65 1.99-3.56-.24-1.74-1.61-3.21-3.35-3.47Z"/></svg></sinch-tooltip>';
5
4
  const template = document.createElement('template');
6
5
  template.innerHTML = templateHTML;
7
6
  defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
8
- #$icon;
9
7
  #$tooltip;
10
8
  #controller = null;
11
9
  constructor() {
@@ -13,7 +11,6 @@ defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
13
11
  const shadowRoot = this.attachShadow();
14
12
  shadowRoot.appendChild(template.content.cloneNode(true));
15
13
  this.#$tooltip = shadowRoot.querySelector('sinch-tooltip');
16
- this.#$icon = shadowRoot.querySelector('#icon');
17
14
  }
18
15
  connectedCallback() {
19
16
  super.connectedCallback();
@@ -25,14 +22,13 @@ defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
25
22
  this.#$tooltip.addEventListener('-hide', this.#onTooltipHide, options);
26
23
  this.addEventListener('-show', this.#onTooltipShowReactHandler, options);
27
24
  this.addEventListener('-hide', this.#onTooltipHideReactHandler, options);
28
- updateAttribute(this.#$icon, 'name', getCssVar(this, '--sinch-help-tooltip-icon-help'));
29
25
  }
30
26
  disconnectedCallback() {
31
27
  super.disconnectedCallback();
32
28
  this.#controller.abort();
33
29
  }
34
30
  static get observedAttributes() {
35
- return ['text', 'width', 'orientation', 'inverted'];
31
+ return ['text', 'width', 'orientation'];
36
32
  }
37
33
  attributeChangedCallback(name, _, newVal) {
38
34
  updateAttribute(this.#$tooltip, name, newVal);
@@ -49,12 +45,6 @@ defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
49
45
  set width(value) {
50
46
  updateIntegerAttribute(this, 'width', value);
51
47
  }
52
- get inverted() {
53
- return getBooleanAttribute(this, 'inverted');
54
- }
55
- set inverted(isInverted) {
56
- updateBooleanAttribute(this, 'inverted', isInverted);
57
- }
58
48
  get orientation() {
59
49
  return getAttribute(this, 'orientation', 'top');
60
50
  }
@@ -1,5 +1,5 @@
1
1
  import { clampNumber, defineCustomElement, getAttribute, getIntegerAttribute, NectaryElement, updateAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;gap:28px;width:fit-content}#progress{position:absolute;height:1px;background-color:var(--sinch-color-snow-700);left:72px;right:72px;top:16px;transform:translateY(-50%)}#bar{position:absolute;height:1px;background-color:var(--sinch-color-stormy-400);left:0;top:0}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><slot></slot></div>';
2
+ const templateHTML = '<style>:host{display:block;outline:0;--sinch-comp-horizontal-stepper-color-background-default:var(--sinch-sys-color-container-contrast-primary-default);--sinch-comp-horizontal-stepper-color-background-visited-skip:var(--sinch-sys-color-container-contrast-primary-default);--sinch-comp-horizontal-stepper-color-background-active:var(--sinch-ref-color-main-stormy-400);--sinch-comp-horizontal-stepper-color-background-visited:var(--sinch-ref-color-main-snow-700);--sinch-comp-horizontal-stepper-color-background-visited-error:var(--sinch-sys-color-feedback-invalid-background);--sinch-comp-horizontal-stepper-color-border-default:transparent;--sinch-comp-horizontal-stepper-color-border-visited-skip:var(--sinch-ref-color-main-stormy-400);--sinch-comp-horizontal-stepper-color-border-active:transparent;--sinch-comp-horizontal-stepper-color-border-visited:var(--sinch-ref-color-main-stormy-400);--sinch-comp-horizontal-stepper-color-border-visited-error:var(--sinch-ref-color-main-stormy-400);--sinch-comp-horizontal-stepper-color-icon-default:var(--sinch-ref-color-main-stormy-700);--sinch-comp-horizontal-stepper-color-icon-visited-skip:var(--sinch-ref-color-main-stormy-700);--sinch-comp-horizontal-stepper-color-icon-active:var(--sinch-ref-color-main-snow-100);--sinch-comp-horizontal-stepper-color-icon-visited:var(--sinch-ref-color-main-stormy-700);--sinch-comp-horizontal-stepper-color-icon-visited-error:var(--sinch-ref-color-main-stormy-700);--sinch-comp-horizontal-stepper-color-label:var(--sinch-sys-color-text-default);--sinch-comp-horizontal-stepper-color-description:var(--sinch-sys-color-text-muted);--sinch-comp-horizontal-stepper-color-progress:var(--sinch-ref-color-main-snow-700);--sinch-comp-horizontal-stepper-color-progress-visited:var(--sinch-ref-color-main-stormy-400)}#wrapper{position:relative;display:flex;flex-direction:row;gap:28px;width:fit-content}#progress{position:absolute;height:1px;background-color:var(--sinch-comp-horizontal-stepper-color-progress);left:72px;right:72px;top:16px;transform:translateY(-50%)}#bar{position:absolute;height:1px;background-color:var(--sinch-comp-horizontal-stepper-color-progress-visited);left:0;top:0}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><slot></slot></div>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
@@ -1,4 +1,6 @@
1
1
  import '../icon';
2
+ import '../title';
3
+ import '../text';
2
4
  import type { TSinchHorizontalStepperItemElement, TSinchHorizontalStepperItemReact } from './types';
3
5
  declare global {
4
6
  namespace JSX {
@@ -1,6 +1,8 @@
1
1
  import '../icon';
2
- import { defineCustomElement, getAttribute, getCssVars, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
3
- const templateHTML = '<style>:host{display:block;outline:0}#wrapper{width:144px;min-height:64px;display:flex;flex-direction:column}#circle{position:relative;display:flex;align-items:center;justify-content:center;align-self:center;width:32px;height:32px;background-color:var(--sinch-color-snow-700);font:var(--sinch-font-title-s);line-height:32px;text-align:center;color:var(--sinch-color-stormy-500);border:1px solid transparent;border-radius:50%;box-sizing:border-box;--sinch-size-icon:20px}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-500);text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-top:8px}#description{font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-300);text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-error,#icon-success{display:none}:host([data-progress=active]) #circle{color:var(--sinch-color-snow-100);background-color:var(--sinch-color-stormy-400)}:host([data-progress=done]) #circle{border-color:var(--sinch-color-stormy-400)}:host([data-progress=done]:not([status])) #icon-success{display:block}:host([data-progress=done][status=error]) #circle{background-color:var(--sinch-color-feedback-invalid-bg);border-color:var(--sinch-color-stormy-400)}:host([data-progress=done][status=error]) #icon-error{display:block}:host([data-progress=done]:not([status=skip])) #circle-text{display:none}</style><div id="wrapper"><div id="circle" aria-hidden="true"><sinch-icon id="icon-success"></sinch-icon><sinch-icon id="icon-error"></sinch-icon><span id="circle-text"></span></div><span id="label"></span><span id="description"></span></div>';
2
+ import '../title';
3
+ import '../text';
4
+ import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
5
+ const templateHTML = '<style>:host{display:block;outline:0}#wrapper{width:144px;min-height:64px;display:flex;flex-direction:column}#circle{position:relative;display:flex;align-items:center;justify-content:center;align-self:center;width:32px;height:32px;background-color:var(--sinch-local-color-background);font:var(--sinch-sys-font-desktop-title-s);line-height:32px;text-align:center;color:var(--sinch-local-color-text);border:1px solid var(--sinch-local-color-border);border-radius:50%;box-sizing:border-box;--sinch-local-color-background:var(--sinch-comp-horizontal-stepper-color-background-default);--sinch-local-color-border:var(--sinch-comp-horizontal-stepper-color-border-default);--sinch-local-color-text:var(--sinch-comp-horizontal-stepper-color-icon-default);--sinch-local-color-icon:var(--sinch-comp-horizontal-stepper-color-icon-default);--sinch-global-size-icon:20px}:host([data-progress=active]) #circle{--sinch-local-color-background:var(--sinch-comp-horizontal-stepper-color-background-active);--sinch-local-color-border:var(--sinch-comp-horizontal-stepper-color-border-active);--sinch-local-color-text:var(--sinch-comp-horizontal-stepper-color-icon-active);--sinch-local-color-icon:var(--sinch-comp-horizontal-stepper-color-icon-active)}:host([data-progress=done]) #circle{--sinch-local-color-background:var(--sinch-comp-horizontal-stepper-color-background-visited);--sinch-local-color-border:var(--sinch-comp-horizontal-stepper-color-border-visited);--sinch-local-color-text:var(--sinch-comp-horizontal-stepper-color-icon-visited);--sinch-local-color-icon:var(--sinch-comp-horizontal-stepper-color-icon-visited)}:host([data-progress=done][status=error]) #circle{--sinch-local-color-background:var(--sinch-comp-horizontal-stepper-color-background-visited-error);--sinch-local-color-border:var(--sinch-comp-horizontal-stepper-color-border-visited-error);--sinch-local-color-text:var(--sinch-comp-horizontal-stepper-color-icon-visited-error);--sinch-local-color-icon:var(--sinch-comp-horizontal-stepper-color-icon-visited-error)}:host([data-progress=done][status=skip]) #circle{--sinch-local-color-background:var(--sinch-comp-horizontal-stepper-color-background-visited-skip);--sinch-local-color-border:var(--sinch-comp-horizontal-stepper-color-border-visited-skip);--sinch-local-color-text:var(--sinch-comp-horizontal-stepper-color-icon-visited-skip);--sinch-local-color-icon:var(--sinch-comp-horizontal-stepper-color-icon-visited-skip)}#icon-error,#icon-success{display:none}:host([data-progress=done]:not([status])) #icon-success{display:block}:host([data-progress=done][status=error]) #icon-error{display:block}:host([data-progress=done]:not([status=skip])) #circle-text{display:none}#label{text-align:center;margin-top:8px;--sinch-global-color-text:var(--sinch-comp-horizontal-stepper-color-label)}#description{text-align:center;--sinch-global-color-text:var(--sinch-comp-horizontal-stepper-color-description)}</style><div id="wrapper"><div id="circle" aria-hidden="true"><sinch-icon id="icon-success" name="check"></sinch-icon><sinch-icon id="icon-error" name="exclamation"></sinch-icon><span id="circle-text"></span></div><sinch-title id="label" type="s" ellipsis></sinch-title><sinch-text id="description" type="xs" ellipsis></sinch-text></div>';
4
6
  import { statusValues } from './utils';
5
7
  const template = document.createElement('template');
6
8
  template.innerHTML = templateHTML;
@@ -8,8 +10,6 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
8
10
  #$label;
9
11
  #$description;
10
12
  #$circleText;
11
- #$iconSuccess;
12
- #$iconError;
13
13
  constructor() {
14
14
  super();
15
15
  const shadowRoot = this.attachShadow();
@@ -17,22 +17,18 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
17
17
  this.#$label = shadowRoot.querySelector('#label');
18
18
  this.#$description = shadowRoot.querySelector('#description');
19
19
  this.#$circleText = shadowRoot.querySelector('#circle-text');
20
- this.#$iconSuccess = shadowRoot.querySelector('#icon-success');
21
- this.#$iconError = shadowRoot.querySelector('#icon-error');
22
- }
23
- connectedCallback() {
24
- const [successName, errorName] = getCssVars(this, ['--sinch-horizontal-stepper-icon-success', '--sinch-horizontal-stepper-icon-error']);
25
- updateAttribute(this.#$iconSuccess, 'name', successName);
26
- updateAttribute(this.#$iconError, 'name', errorName);
27
20
  }
28
21
  static get observedAttributes() {
29
22
  return ['label', 'description', 'data-index'];
30
23
  }
31
24
  attributeChangedCallback(name, oldVal, newVal) {
25
+ if (oldVal === newVal) {
26
+ return;
27
+ }
32
28
  switch (name) {
33
29
  case 'label':
34
30
  {
35
- this.#$label.textContent = newVal;
31
+ updateAttribute(this.#$label, 'text', newVal);
36
32
  break;
37
33
  }
38
34
  case 'description':
package/icon/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineCustomElement, getAttribute, NectaryElement, updateAttribute } from '../utils';
2
- const templateHTML = '<style>:host{display:inline-block}#icon{display:block;font-family:var(--sinch-icon-font-family);font-weight:var(--sinch-icon-font-weight);font-size:var(--sinch-size-icon, 24px);font-feature-settings:var(--sinch-icon-font-feature-settings);font-variation-settings:var(--sinch-icon-font-variation-settings);-webkit-font-smoothing:antialiased;line-height:1;white-space:nowrap;width:var(--sinch-size-icon,24px);height:var(--sinch-size-icon,24px);color:var(--sinch-color-icon,var(--sinch-color-stormy-500));user-select:none}</style><span id="icon" role="img"></span>';
2
+ const templateHTML = '<style>:host{display:inline-block}#icon{display:block;font-family:var(--sinch-comp-icon-font-family);font-weight:var(--sinch-comp-icon-font-weight);font-size:var(--sinch-global-size-icon, 24px);font-feature-settings:var(--sinch-comp-icon-font-feature-settings);-webkit-font-smoothing:antialiased;line-height:1;white-space:nowrap;width:var(--sinch-global-size-icon,24px);height:var(--sinch-global-size-icon,24px);color:var(--sinch-global-color-icon,var(--sinch-sys-color-text-default));user-select:none}</style><span id="icon" role="img"></span>';
3
3
  const template = document.createElement('template');
4
4
  template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-icon', class extends NectaryElement {
@@ -1,8 +1,8 @@
1
1
  import '../tooltip';
2
2
  import { defineCustomElement, getBooleanAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, subscribeContext, updateAttribute, updateBooleanAttribute, updateLiteralAttribute, Context, getAttribute } from '../utils';
3
- import { assertSizeEx, DEFAULT_SIZE, sizeExValues } from '../utils/size';
4
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-icon-button-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m)}#button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;width:var(--sinch-size);height:var(--sinch-size);cursor:pointer;contain:size;--sinch-color-icon:var(--sinch-icon-button-color-icon)}:host([data-size="l"]){--sinch-size:var(--sinch-size-l);--sinch-size-icon:var(--sinch-icon-button-icon-size-l);--sinch-shape-radius:var(--sinch-shape-radius-l)}:host([data-size="m"]){--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-icon-button-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m)}:host([data-size="s"]){--sinch-size:var(--sinch-size-s);--sinch-size-icon:var(--sinch-icon-button-icon-size-s);--sinch-shape-radius:var(--sinch-shape-radius-s)}:host([data-size=xs]){--sinch-size:var(--sinch-size-xs);--sinch-size-icon:var(--sinch-icon-button-icon-size-xs);--sinch-shape-radius:var(--sinch-shape-radius-xs)}:host([type=primary]){--sinch-icon-button-color-background:var(--sinch-icon-button-primary-color-background);--sinch-icon-button-color-background-hover:var(--sinch-icon-button-primary-color-background-hover);--sinch-icon-button-color-background-active:var(--sinch-icon-button-primary-color-background-active);--sinch-icon-button-color-background-disabled:var(--sinch-icon-button-primary-color-background-disabled);--sinch-icon-button-color-border:var(--sinch-icon-button-primary-color-border);--sinch-icon-button-color-border-hover:var(--sinch-icon-button-primary-color-border-hover);--sinch-icon-button-color-border-active:var(--sinch-icon-button-primary-color-border-active);--sinch-icon-button-color-border-disabled:var(--sinch-icon-button-primary-color-border-disabled);--sinch-icon-button-color-icon:var(--sinch-icon-button-primary-color-icon);--sinch-icon-button-color-icon-hover:var(--sinch-icon-button-primary-color-icon-hover);--sinch-icon-button-color-icon-active:var(--sinch-icon-button-primary-color-icon-active);--sinch-icon-button-color-icon-disabled:var(--sinch-icon-button-primary-color-icon-disabled);--sinch-icon-button-mix-blend-mode:var(--sinch-icon-button-primary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=secondary]){--sinch-icon-button-color-background:var(--sinch-icon-button-secondary-color-background);--sinch-icon-button-color-background-hover:var(--sinch-icon-button-secondary-color-background-hover);--sinch-icon-button-color-background-active:var(--sinch-icon-button-secondary-color-background-active);--sinch-icon-button-color-background-disabled:var(--sinch-icon-button-secondary-color-background-disabled);--sinch-icon-button-color-border:var(--sinch-icon-button-secondary-color-border);--sinch-icon-button-color-border-hover:var(--sinch-icon-button-secondary-color-border-hover);--sinch-icon-button-color-border-active:var(--sinch-icon-button-secondary-color-border-active);--sinch-icon-button-color-border-disabled:var(--sinch-icon-button-secondary-color-border-disabled);--sinch-icon-button-color-icon:var(--sinch-icon-button-secondary-color-icon);--sinch-icon-button-color-icon-hover:var(--sinch-icon-button-secondary-color-icon-hover);--sinch-icon-button-color-icon-active:var(--sinch-icon-button-secondary-color-icon-active);--sinch-icon-button-color-icon-disabled:var(--sinch-icon-button-secondary-color-icon-disabled);--sinch-icon-button-mix-blend-mode:var(--sinch-icon-button-secondary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=tertiary]){--sinch-icon-button-color-background:var(--sinch-icon-button-tertiary-color-background);--sinch-icon-button-color-background-hover:var(--sinch-icon-button-tertiary-color-background-hover);--sinch-icon-button-color-background-active:var(--sinch-icon-button-tertiary-color-background-active);--sinch-icon-button-color-background-disabled:var(--sinch-icon-button-tertiary-color-background-disabled);--sinch-icon-button-color-border:var(--sinch-icon-button-tertiary-color-border);--sinch-icon-button-color-border-hover:var(--sinch-icon-button-tertiary-color-border-hover);--sinch-icon-button-color-border-active:var(--sinch-icon-button-tertiary-color-border-active);--sinch-icon-button-color-border-disabled:var(--sinch-icon-button-tertiary-color-border-disabled);--sinch-icon-button-color-icon:var(--sinch-icon-button-tertiary-color-icon);--sinch-icon-button-color-icon-hover:var(--sinch-icon-button-tertiary-color-icon-hover);--sinch-icon-button-color-icon-active:var(--sinch-icon-button-tertiary-color-icon-active);--sinch-icon-button-color-icon-disabled:var(--sinch-icon-button-tertiary-color-icon-disabled);--sinch-icon-button-mix-blend-mode:var(--sinch-icon-button-tertiary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-0)}#button::before{content:"";position:absolute;inset:0;border-radius:var(--sinch-shape-radius);border:1px solid var(--sinch-icon-button-color-border);background-color:var(--sinch-icon-button-color-background);box-shadow:var(--sinch-elevation-level);pointer-events:none;mix-blend-mode:var(--sinch-icon-button-mix-blend-mode)}#button:focus-visible::after{content:"";position:absolute;inset:-3px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius) + 3px);pointer-events:none}#button:disabled{cursor:initial;--sinch-color-icon:var(--sinch-icon-button-color-icon-disabled)}#button:disabled::before{background-color:var(--sinch-icon-button-color-background-disabled);border-color:var(--sinch-icon-button-color-border-disabled);box-shadow:var(--sinch-elevation-level-0)}#button:enabled:hover{--sinch-color-icon:var(--sinch-icon-button-color-icon-hover)}#button:enabled:hover::before{background-color:var(--sinch-icon-button-color-background-hover);border-color:var(--sinch-icon-button-color-border-hover)}#button:enabled:active{--sinch-color-icon:var(--sinch-icon-button-color-icon-active)}#button:enabled:active::before{background-color:var(--sinch-icon-button-color-background-active);border-color:var(--sinch-icon-button-color-border-active);box-shadow:var(--sinch-elevation-level-0)}#content{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%}#button *{pointer-events:none}</style><sinch-tooltip id="tooltip" inverted><button id="button"><div id="content"><slot name="icon"></slot></div></button></sinch-tooltip>';
5
- import { assertType, typeValues } from './utils';
3
+ import { DEFAULT_SIZE, sizeExValues } from '../utils/size';
4
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#button{display:block;position:relative;width:var(--sinch-local-size);height:var(--sinch-local-size);cursor:pointer;contain:size;--sinch-global-color-icon:var(--sinch-local-color-icon)}:host([disabled]) #button{cursor:initial}:host([data-size="l"]) #button{--sinch-local-size:var(--sinch-comp-icon-button-size-container-l);--sinch-global-size-icon:var(--sinch-comp-icon-button-size-icon-l);--sinch-local-shape-radius:var(--sinch-comp-icon-button-shape-radius-size-l)}#button,:host([data-size="m"]) #button{--sinch-local-size:var(--sinch-comp-icon-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-icon-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-icon-button-shape-radius-size-m)}:host([data-size="s"]) #button{--sinch-local-size:var(--sinch-comp-icon-button-size-container-s);--sinch-global-size-icon:var(--sinch-comp-icon-button-size-icon-s);--sinch-local-shape-radius:var(--sinch-comp-icon-button-shape-radius-size-s)}:host([data-size=xs]) #button{--sinch-local-size:var(--sinch-comp-icon-button-size-container-xs);--sinch-global-size-icon:var(--sinch-comp-icon-button-size-icon-xs);--sinch-local-shape-radius:var(--sinch-comp-icon-button-shape-radius-size-xs)}:host([type=primary]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-primary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-primary-default-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-primary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-primary-initial);--sinch-local-color-outline:var(--sinch-comp-icon-button-color-primary-default-outline-focus)}:host([type=secondary]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-secondary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-secondary-default-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-secondary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-secondary-initial);--sinch-local-color-outline:var(--sinch-comp-icon-button-color-secondary-default-outline-focus)}#button,:host([type=tertiary]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-tertiary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-tertiary-default-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-tertiary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-tertiary-initial);--sinch-local-color-outline:var(--sinch-comp-icon-button-color-tertiary-default-outline-focus)}:host([type=primary][disabled]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-primary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-primary-disabled-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-primary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-primary-disabled)}:host([type=secondary][disabled]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-secondary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-secondary-disabled-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-secondary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-secondary-disabled)}:host([disabled]) #button,:host([type=tertiary][disabled]) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-tertiary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-icon-button-color-tertiary-disabled-border-initial);--sinch-local-color-icon:var(--sinch-comp-icon-button-color-tertiary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-tertiary-disabled)}:host([type=primary]:focus) #button{--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-primary-focus)}:host([type=secondary]:focus) #button{--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-secondary-focus)}:host(:focus),:host([type=tertiary]:focus) #button{--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-tertiary-focus)}:host([type=primary]:not([disabled]):hover) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-primary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-primary-hover)}:host([type=secondary]:not([disabled]):hover) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-secondary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-secondary-hover)}:host(:not([disabled]):hover) #button,:host([type=tertiary]:not([disabled]):active) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-tertiary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-tertiary-hover)}:host([type=primary]:not([disabled]):active) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-primary-default-background-active);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-primary-active)}:host([type=secondary]:not([disabled]):active) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-secondary-default-background-active);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-secondary-active)}:host(:not([disabled]):active) #button,:host([type=tertiary]:not([disabled]):active) #button{--sinch-local-color-background:var(--sinch-comp-icon-button-color-tertiary-default-background-active);--sinch-local-shadow:var(--sinch-comp-icon-button-shadow-tertiary-active)}#button::before{content:"";position:absolute;inset:0;background-color:var(--sinch-local-color-background);border:1px solid var(--sinch-local-color-border);border-radius:var(--sinch-local-shape-radius);box-shadow:var(--sinch-local-shadow);pointer-events:none}:host(:focus-visible) #button::after{content:"";position:absolute;inset:-3px;border:2px solid var(--sinch-local-color-outline);border-radius:calc(var(--sinch-local-shape-radius) + 3px);pointer-events:none}#content{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%}</style><sinch-tooltip id="tooltip"><div id="button"><div id="content" inert><slot name="icon"></slot></div></div></sinch-tooltip>';
5
+ import { typeValues } from './utils';
6
6
  const template = document.createElement('template');
7
7
  template.innerHTML = templateHTML;
8
8
  defineCustomElement('sinch-icon-button', class extends NectaryElement {
@@ -13,7 +13,7 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
13
13
  constructor() {
14
14
  super();
15
15
  const shadowRoot = this.attachShadow({
16
- delegatesFocus: true
16
+ delegatesFocus: false
17
17
  });
18
18
  shadowRoot.appendChild(template.content.cloneNode(true));
19
19
  this.#$button = shadowRoot.querySelector('#button');
@@ -26,10 +26,12 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
26
26
  const options = {
27
27
  signal: this.#controller.signal
28
28
  };
29
- this.setAttribute('role', 'button');
30
- this.#$button.addEventListener('click', this.#onButtonClick, options);
31
- this.#$button.addEventListener('focus', this.#onButtonFocus, options);
32
- this.#$button.addEventListener('blur', this.#onButtonBlur, options);
29
+ this.role = 'button';
30
+ this.tabIndex = 0;
31
+ this.addEventListener('click', this.#onButtonClick, options);
32
+ this.addEventListener('focus', this.#onButtonFocus, options);
33
+ this.addEventListener('blur', this.#onButtonBlur, options);
34
+ this.addEventListener('keydown', this.#onButtonKeydown, options);
33
35
  this.addEventListener('-click', this.#onClickReactHandler, options);
34
36
  this.addEventListener('-focus', this.#onFocusReactHandler, options);
35
37
  this.addEventListener('-blur', this.#onBlurReactHandler, options);
@@ -46,7 +48,7 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
46
48
  this.#controller.abort();
47
49
  }
48
50
  static get observedAttributes() {
49
- return ['type', 'size', 'disabled', 'aria-label', 'data-size'];
51
+ return ['size', 'disabled', 'aria-label', 'data-size'];
50
52
  }
51
53
  attributeChangedCallback(name, oldVal, newVal) {
52
54
  if (oldVal === newVal) {
@@ -56,7 +58,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
56
58
  case 'disabled':
57
59
  {
58
60
  const isDisabled = isAttrTrue(newVal);
59
- this.#$button.disabled = isDisabled;
60
61
  updateBooleanAttribute(this, 'disabled', isDisabled);
61
62
  break;
62
63
  }
@@ -65,13 +66,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
65
66
  updateAttribute(this.#$tooltip, 'text', newVal);
66
67
  break;
67
68
  }
68
- case 'type':
69
- {
70
- if ('production' !== 'production') {
71
- assertType(newVal);
72
- }
73
- break;
74
- }
75
69
  case 'size':
76
70
  {
77
71
  updateAttribute(this, 'data-size', newVal);
@@ -79,9 +73,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
79
73
  }
80
74
  case 'data-size':
81
75
  {
82
- if ('production' !== 'production') {
83
- assertSizeEx(newVal, 'sinch-icon-button');
84
- }
85
76
  this.#onSizeUpdate();
86
77
  break;
87
78
  }
@@ -111,12 +102,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
111
102
  get focusable() {
112
103
  return true;
113
104
  }
114
- focus() {
115
- this.#$button.focus();
116
- }
117
- blur() {
118
- this.#$button.blur();
119
- }
120
105
  #onSizeUpdate() {
121
106
  if (!this.isConnected) {
122
107
  return;
@@ -146,7 +131,9 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
146
131
  }
147
132
  };
148
133
  #onButtonClick = () => {
149
- this.dispatchEvent(new CustomEvent('-click'));
134
+ if (!this.disabled) {
135
+ this.dispatchEvent(new CustomEvent('-click'));
136
+ }
150
137
  };
151
138
  #onButtonFocus = () => {
152
139
  this.dispatchEvent(new CustomEvent('-focus'));
@@ -154,6 +141,15 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
154
141
  #onButtonBlur = () => {
155
142
  this.dispatchEvent(new CustomEvent('-blur'));
156
143
  };
144
+ #onButtonKeydown = e => {
145
+ switch (e.code) {
146
+ case 'Space':
147
+ case 'Enter':
148
+ {
149
+ this.click();
150
+ }
151
+ }
152
+ };
157
153
  #onTooltipShow = () => {
158
154
  this.dispatchEvent(new CustomEvent('-tooltip-show'));
159
155
  };
@@ -1,5 +1,2 @@
1
1
  import type { TSinchIconButtonType } from './types';
2
2
  export declare const typeValues: readonly TSinchIconButtonType[];
3
- type TAssertType = (value: string | null) => asserts value is TSinchIconButtonType;
4
- export declare const assertType: TAssertType;
5
- export {};
@@ -1,9 +1 @@
1
- export const typeValues = ['primary', 'secondary', 'tertiary'];
2
- export const assertType = value => {
3
- if (value === null || value.length === 0) {
4
- return;
5
- }
6
- if (!typeValues.includes(value)) {
7
- throw new Error(`sinch-icon-button: invalid type attribute: ${value}`);
8
- }
9
- };
1
+ export const typeValues = ['primary', 'secondary', 'tertiary'];
@@ -2,13 +2,12 @@ import '../icon';
2
2
  import '../rich-text';
3
3
  import '../text';
4
4
  import '../title';
5
- import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass, getCssVar } from '../utils';
6
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:16px;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;width:100%}#body-wrapper{display:flex;flex-direction:column;align-items:flex-start;margin-left:8px;min-width:0;flex:1}#caption{color:var(--sinch-color-stormy-500);align-self:stretch}#text{display:flex;flex-direction:column;gap:8px;color:var(--sinch-color-stormy-500);margin-top:4px;align-self:stretch}:host([type=success]) #wrapper{background-color:var(--sinch-color-feedback-success-bg)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-feedback-warning-bg)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}:host([type=info]) #wrapper{background-color:var(--sinch-color-feedback-info-bg)}:host([type=success]) #icon{--sinch-color-icon:var(--sinch-color-feedback-success-icon)}:host([type=warn]) #icon{--sinch-color-icon:var(--sinch-color-feedback-warning-icon)}:host([type=error]) #icon{--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}:host([type=info]) #icon{--sinch-color-icon:var(--sinch-color-feedback-info-icon)}#action{display:flex;margin-top:16px;min-width:0}#action.empty{display:none}#close{margin-left:16px}#close.empty{display:none}</style><div id="wrapper"><sinch-icon id="icon"></sinch-icon><div id="body-wrapper"><sinch-title id="caption" level="3" type="s" ellipsis></sinch-title><sinch-rich-text id="text"></sinch-rich-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
7
- import { assertType, typeValues } from './utils';
5
+ import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass } from '../utils';
6
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:16px;border-radius:var(--sinch-comp-inline-alert-shape-radius);box-sizing:border-box;width:100%}:host([type=success]) #wrapper{background-color:var(--sinch-comp-inline-alert-color-success-default-background)}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-inline-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-inline-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-inline-alert-color-info-default-background)}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-success{--sinch-global-color-icon:var(--sinch-comp-inline-alert-color-success-default-icon)}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-inline-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-inline-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-inline-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}#body-wrapper{display:flex;flex-direction:column;align-items:flex-start;margin-left:8px;min-width:0;flex:1}#caption{align-self:stretch;--sinch-comp-title-font:var(--sinch-comp-inline-alert-font-title)}:host([type=success]) #caption{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-success-default-text)}:host([type=warn]) #caption{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-warning-default-text)}:host([type=error]) #caption{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-error-default-text)}:host([type=info]) #caption{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-info-default-text)}#text{display:flex;flex-direction:column;gap:8px;margin-top:4px;align-self:stretch;--sinch-comp-rich-text-font:var(--sinch-comp-inline-alert-font-body)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-success-default-text)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-inline-alert-color-info-default-text)}#action{display:flex;margin-top:16px;min-width:0}#action.empty{display:none}#close{margin-left:16px}#close.empty{display:none}</style><div id="wrapper"><sinch-icon id="icon-info" name="info"></sinch-icon><sinch-icon id="icon-success" name="check_circle"></sinch-icon><sinch-icon id="icon-warn" name="report_problem"></sinch-icon><sinch-icon id="icon-error" name="report"></sinch-icon><div id="body-wrapper"><sinch-title id="caption" level="3" type="s" ellipsis></sinch-title><sinch-rich-text id="text"></sinch-rich-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
7
+ import { typeValues } from './utils';
8
8
  const template = document.createElement('template');
9
9
  template.innerHTML = templateHTML;
10
10
  defineCustomElement('sinch-inline-alert', class extends NectaryElement {
11
- #$icon;
12
11
  #$text;
13
12
  #$caption;
14
13
  #$closeWrapper;
@@ -19,7 +18,6 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
19
18
  super();
20
19
  const shadowRoot = this.attachShadow();
21
20
  shadowRoot.appendChild(template.content.cloneNode(true));
22
- this.#$icon = shadowRoot.querySelector('#icon');
23
21
  this.#$text = shadowRoot.querySelector('#text');
24
22
  this.#$caption = shadowRoot.querySelector('#caption');
25
23
  this.#$closeWrapper = shadowRoot.querySelector('#close');
@@ -35,13 +33,29 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
35
33
  this.#$actionSlot.addEventListener('slotchange', this.#onActionSlotChange);
36
34
  this.#onCloseSlotChange();
37
35
  this.#onActionSlotChange();
38
- this.#updateIcon();
39
36
  }
40
37
  disconnectedCallback() {
41
38
  super.disconnectedCallback();
42
39
  this.#$closeSlot.removeEventListener('slotchange', this.#onCloseSlotChange);
43
40
  this.#$actionSlot.removeEventListener('slotchange', this.#onActionSlotChange);
44
41
  }
42
+ static get observedAttributes() {
43
+ return ['text', 'caption'];
44
+ }
45
+ attributeChangedCallback(name, _, newVal) {
46
+ switch (name) {
47
+ case 'text':
48
+ {
49
+ updateAttribute(this.#$text, 'text', newVal);
50
+ break;
51
+ }
52
+ case 'caption':
53
+ {
54
+ updateAttribute(this.#$caption, 'text', newVal);
55
+ break;
56
+ }
57
+ }
58
+ }
45
59
  get type() {
46
60
  return getLiteralAttribute(this, typeValues, 'type');
47
61
  }
@@ -60,37 +74,6 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
60
74
  set caption(value) {
61
75
  updateAttribute(this, 'caption', value);
62
76
  }
63
- static get observedAttributes() {
64
- return ['text', 'caption', 'type'];
65
- }
66
- attributeChangedCallback(name, _, newVal) {
67
- switch (name) {
68
- case 'type':
69
- {
70
- if ('production' !== 'production') {
71
- assertType(newVal);
72
- }
73
- this.#updateIcon();
74
- break;
75
- }
76
- case 'text':
77
- {
78
- updateAttribute(this.#$text, 'text', newVal);
79
- break;
80
- }
81
- case 'caption':
82
- {
83
- updateAttribute(this.#$caption, 'text', newVal);
84
- break;
85
- }
86
- }
87
- }
88
- #updateIcon() {
89
- if (!this.isConnected) {
90
- return;
91
- }
92
- updateAttribute(this.#$icon, 'name', getCssVar(this, `--sinch-inline-alert-icon-${this.type}`));
93
- }
94
77
  #onCloseSlotChange = () => {
95
78
  setClass(this.#$closeWrapper, 'empty', this.#$closeSlot.assignedElements().length === 0);
96
79
  };
@@ -1,5 +1,2 @@
1
1
  import type { TSinchInlineAlertType } from './types';
2
2
  export declare const typeValues: readonly TSinchInlineAlertType[];
3
- type TAssertType = (value: string | null) => asserts value is TSinchInlineAlertType;
4
- export declare const assertType: TAssertType;
5
- export {};
@@ -1,6 +1 @@
1
- export const typeValues = ['info', 'success', 'warn', 'error'];
2
- export const assertType = value => {
3
- if (value === null || !typeValues.includes(value)) {
4
- throw new Error(`sinch-inline-alert: invalid type attribute: ${value}`);
5
- }
6
- };
1
+ export const typeValues = ['info', 'success', 'warn', 'error'];
package/input/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import '../icon-button';
2
- import '../icon';
3
- import '../stop-events';
4
1
  import type { TSinchInputElement, TSinchInputReact } from './types';
5
2
  declare global {
6
3
  namespace JSX {