@nectary/components 0.41.0 → 0.42.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 (128) hide show
  1. package/accordion/index.js +0 -16
  2. package/accordion/types.d.ts +9 -1
  3. package/accordion-item/index.js +0 -24
  4. package/accordion-item/types.d.ts +18 -3
  5. package/action-menu/index.js +1 -45
  6. package/action-menu-option/index.js +0 -18
  7. package/alert/index.js +0 -10
  8. package/alert/types.d.ts +6 -0
  9. package/avatar/index.js +57 -20
  10. package/avatar/types.d.ts +25 -7
  11. package/avatar/utils.d.ts +10 -2
  12. package/avatar/utils.js +23 -2
  13. package/badge/index.d.ts +11 -0
  14. package/badge/index.js +140 -0
  15. package/badge/types.d.ts +38 -0
  16. package/badge/utils.d.ts +11 -0
  17. package/badge/utils.js +23 -0
  18. package/button/index.js +0 -18
  19. package/card/index.js +0 -16
  20. package/card/types.d.ts +15 -3
  21. package/card-container/index.js +0 -1
  22. package/chat/index.js +0 -1
  23. package/chat-block/index.js +0 -19
  24. package/chat-block/types.d.ts +16 -4
  25. package/chat-bubble/index.js +0 -9
  26. package/chat-bubble/types.d.ts +6 -0
  27. package/checkbox/index.js +0 -23
  28. package/chip/index.js +16 -25
  29. package/chip/utils.d.ts +3 -0
  30. package/chip/utils.js +11 -0
  31. package/color-menu/index.js +8 -86
  32. package/color-menu/utils.js +0 -4
  33. package/color-swatch/index.js +17 -17
  34. package/color-swatch/types.d.ts +2 -2
  35. package/color-swatch/utils.d.ts +3 -0
  36. package/color-swatch/utils.js +11 -0
  37. package/date-picker/index.js +1 -50
  38. package/date-picker/utils.js +0 -7
  39. package/dialog/index.js +1 -17
  40. package/field/index.js +0 -19
  41. package/file-drop/index.js +0 -40
  42. package/file-drop/utils.js +0 -6
  43. package/file-picker/index.js +0 -17
  44. package/file-picker/utils.js +0 -1
  45. package/file-status/index.js +0 -12
  46. package/grid/index.js +0 -1
  47. package/grid-item/index.js +0 -9
  48. package/help-tooltip/index.js +0 -14
  49. package/horizontal-stepper/index.js +0 -12
  50. package/horizontal-stepper-item/index.js +0 -14
  51. package/icon-button/index.js +0 -15
  52. package/icons/create-icon-class.js +0 -2
  53. package/icons-branded/create-icon-class.js +0 -8
  54. package/icons-channel/create-icon-class.js +0 -6
  55. package/illustrations/create-illustration-class.js +0 -11
  56. package/inline-alert/index.js +0 -14
  57. package/input/index.js +0 -37
  58. package/link/index.js +0 -25
  59. package/list/index.js +0 -2
  60. package/list-item/index.js +0 -2
  61. package/logo/create-logo-class.js +0 -9
  62. package/package.json +1 -1
  63. package/pagination/index.js +0 -31
  64. package/pop/index.js +64 -68
  65. package/pop/utils.js +0 -1
  66. package/popover/index.js +0 -33
  67. package/popover/utils.js +0 -2
  68. package/progress/index.js +0 -10
  69. package/radio/index.js +0 -30
  70. package/radio-option/index.js +0 -20
  71. package/segment/index.js +0 -15
  72. package/segment-collapse/index.js +0 -13
  73. package/segmented-control/index.js +0 -12
  74. package/segmented-control-option/index.js +0 -18
  75. package/segmented-icon-control/index.js +0 -16
  76. package/segmented-icon-control-option/index.js +0 -14
  77. package/select-button/index.js +0 -23
  78. package/select-menu/index.js +1 -63
  79. package/select-menu-option/index.js +0 -14
  80. package/spinner/index.js +0 -4
  81. package/stop-events/index.js +0 -5
  82. package/table/index.js +0 -2
  83. package/table-body/index.js +0 -2
  84. package/table-cell/index.js +0 -4
  85. package/table-head/index.js +0 -2
  86. package/table-head-cell/index.js +0 -11
  87. package/table-row/index.js +0 -6
  88. package/tabs/index.js +0 -30
  89. package/tabs-option/index.js +0 -19
  90. package/tag/index.js +18 -21
  91. package/tag/utils.d.ts +3 -0
  92. package/tag/utils.js +11 -0
  93. package/text/index.js +1 -12
  94. package/textarea/index.js +0 -40
  95. package/{utils → theme}/colors.d.ts +0 -1
  96. package/{utils → theme}/colors.js +0 -1
  97. package/theme.css +13 -209
  98. package/tile-control/index.js +0 -24
  99. package/tile-control-option/index.js +0 -18
  100. package/time-picker/index.js +2 -51
  101. package/time-picker/utils.js +0 -18
  102. package/title/index.js +1 -12
  103. package/title/utils.js +0 -5
  104. package/toast/index.js +0 -19
  105. package/toast-manager/index.js +0 -27
  106. package/toggle/index.js +0 -23
  107. package/tooltip/index.js +0 -27
  108. package/tooltip/utils.js +0 -4
  109. package/utils/animation.js +0 -20
  110. package/utils/context.js +0 -6
  111. package/utils/index.d.ts +1 -0
  112. package/utils/index.js +11 -52
  113. package/vertical-stepper/index.js +0 -12
  114. package/vertical-stepper-item/index.js +0 -14
  115. package/avatar-badge/index.d.ts +0 -11
  116. package/avatar-badge/index.js +0 -38
  117. package/avatar-badge/types.d.ts +0 -8
  118. package/avatar-status/index.d.ts +0 -11
  119. package/avatar-status/index.js +0 -37
  120. package/avatar-status/types.d.ts +0 -9
  121. package/avatar-status/types.js +0 -1
  122. package/avatar-status/utils.d.ts +0 -5
  123. package/avatar-status/utils.js +0 -6
  124. package/chat-avatar/index.d.ts +0 -12
  125. package/chat-avatar/index.js +0 -52
  126. package/chat-avatar/types.d.ts +0 -12
  127. package/chat-avatar/types.js +0 -1
  128. /package/{avatar-badge → badge}/types.js +0 -0
@@ -8,7 +8,6 @@ defineCustomElement('sinch-chat-block', class extends NectaryElement {
8
8
  #$lastName;
9
9
  #$timeStamp;
10
10
  #$bubbleSlot;
11
-
12
11
  constructor() {
13
12
  super();
14
13
  const shadowRoot = this.attachShadow();
@@ -18,19 +17,15 @@ defineCustomElement('sinch-chat-block', class extends NectaryElement {
18
17
  this.#$timeStamp = shadowRoot.querySelector('#time');
19
18
  this.#$bubbleSlot = shadowRoot.querySelector('slot[name="bubble"]');
20
19
  }
21
-
22
20
  connectedCallback() {
23
21
  this.#$bubbleSlot.addEventListener('slotchange', this.#onBubbleSlotChange);
24
22
  }
25
-
26
23
  disconnectedCallback() {
27
24
  this.#$bubbleSlot.removeEventListener('slotchange', this.#onBubbleSlotChange);
28
25
  }
29
-
30
26
  static get observedAttributes() {
31
27
  return ['firstname', 'lastname', 'timestamp', 'type'];
32
28
  }
33
-
34
29
  attributeChangedCallback(name, _, newVal) {
35
30
  switch (name) {
36
31
  case 'firstname':
@@ -38,19 +33,16 @@ defineCustomElement('sinch-chat-block', class extends NectaryElement {
38
33
  this.#$firstName.textContent = newVal;
39
34
  break;
40
35
  }
41
-
42
36
  case 'lastname':
43
37
  {
44
38
  this.#$lastName.textContent = newVal;
45
39
  break;
46
40
  }
47
-
48
41
  case 'timestamp':
49
42
  {
50
43
  this.#$timeStamp.textContent = newVal;
51
44
  break;
52
45
  }
53
-
54
46
  case 'type':
55
47
  {
56
48
  this.#updateBubbleTypes();
@@ -58,48 +50,37 @@ defineCustomElement('sinch-chat-block', class extends NectaryElement {
58
50
  }
59
51
  }
60
52
  }
61
-
62
53
  set type(value) {
63
54
  updateLiteralAttribute(this, typeValues, 'type', value);
64
55
  }
65
-
66
56
  get type() {
67
57
  return getLiteralAttribute(this, typeValues, 'type', null);
68
58
  }
69
-
70
59
  set firstName(value) {
71
60
  updateAttribute(this, 'firstname', value);
72
61
  }
73
-
74
62
  get firstName() {
75
63
  return getAttribute(this, 'firstname');
76
64
  }
77
-
78
65
  set lastName(value) {
79
66
  updateAttribute(this, 'lastname', value);
80
67
  }
81
-
82
68
  get lastName() {
83
69
  return getAttribute(this, 'lastname');
84
70
  }
85
-
86
71
  set timestamp(value) {
87
72
  updateAttribute(this, 'timestamp', value);
88
73
  }
89
-
90
74
  get timestamp() {
91
75
  return getAttribute(this, 'timestamp');
92
76
  }
93
-
94
77
  #onBubbleSlotChange = () => {
95
78
  this.#updateBubbleTypes();
96
79
  };
97
-
98
80
  #updateBubbleTypes() {
99
81
  const typeValue = getAttribute(this, 'type');
100
82
  this.#$bubbleSlot.assignedElements().forEach(el => {
101
83
  updateAttribute(el, 'data-type', typeValue);
102
84
  });
103
85
  }
104
-
105
86
  });
@@ -1,18 +1,30 @@
1
- import type { TSinchChatBubbleType } from '../chat-bubble/types';
2
1
  import type { TSinchElementReact } from '../types';
2
+ export declare type TSinchChatBlockType = 'customer' | 'agent' | 'agent-prev';
3
3
  export declare type TSinchChatBlockElement = HTMLElement & {
4
- type: TSinchChatBubbleType | null;
4
+ /** Type */
5
+ type: TSinchChatBlockType | null;
6
+ /** First name */
5
7
  firstName: string | null;
8
+ /** Last name */
6
9
  lastName: string | null;
10
+ /** Timestamp */
7
11
  timestamp: string | null;
8
- setAttribute(name: 'type', value: TSinchChatBubbleType): void;
12
+ /** Type */
13
+ setAttribute(name: 'type', value: TSinchChatBlockType): void;
14
+ /** First name */
9
15
  setAttribute(name: 'firstName', value: string): void;
16
+ /** Last name */
10
17
  setAttribute(name: 'lastName', value: string): void;
18
+ /** Timestamp */
11
19
  setAttribute(name: 'timestamp', value: string): void;
12
20
  };
13
21
  export declare type TSinchChatBlockReact = TSinchElementReact<TSinchChatBlockElement> & {
14
- type: TSinchChatBubbleType;
22
+ /** Type */
23
+ type: TSinchChatBlockType;
24
+ /** First name */
15
25
  firstName?: string;
26
+ /** Last name */
16
27
  lastName?: string;
28
+ /** Timestamp */
17
29
  timestamp?: string;
18
30
  };
@@ -9,18 +9,15 @@ const template = document.createElement('template');
9
9
  template.innerHTML = templateHTML;
10
10
  defineCustomElement('sinch-chat-bubble', class extends NectaryElement {
11
11
  #$text;
12
-
13
12
  constructor() {
14
13
  super();
15
14
  const shadowRoot = this.attachShadow();
16
15
  shadowRoot.appendChild(template.content.cloneNode(true));
17
16
  this.#$text = shadowRoot.querySelector('#text');
18
17
  }
19
-
20
18
  static get observedAttributes() {
21
19
  return ['text'];
22
20
  }
23
-
24
21
  attributeChangedCallback(name, _, newVal) {
25
22
  switch (name) {
26
23
  case 'text':
@@ -30,25 +27,19 @@ defineCustomElement('sinch-chat-bubble', class extends NectaryElement {
30
27
  }
31
28
  }
32
29
  }
33
-
34
30
  set text(value) {
35
31
  updateAttribute(this, 'text', value);
36
32
  }
37
-
38
33
  get text() {
39
34
  return getAttribute(this, 'text', '');
40
35
  }
41
-
42
36
  get type() {
43
37
  return getLiteralAttribute(this, typeValues, 'data-type', null);
44
38
  }
45
-
46
39
  set status(value) {
47
40
  updateLiteralAttribute(this, statusValues, 'status', value);
48
41
  }
49
-
50
42
  get status() {
51
43
  return getLiteralAttribute(this, statusValues, 'status', null);
52
44
  }
53
-
54
45
  });
@@ -3,12 +3,18 @@ export declare type TSinchChatBubbleType = 'customer' | 'agent' | 'agent-prev';
3
3
  export declare type TSinchChatBubbleStatus = 'sending' | 'sent' | 'received' | 'seen' | 'error';
4
4
  export declare type TSinchChatBubbleElement = HTMLElement & {
5
5
  readonly type: TSinchChatBubbleType | null;
6
+ /** Text */
6
7
  text: string;
8
+ /** Status */
7
9
  status: TSinchChatBubbleStatus | null;
10
+ /** Text */
8
11
  setAttribute(name: 'text', value: string): void;
12
+ /** Status */
9
13
  setAttribute(name: 'status', value: TSinchChatBubbleStatus): void;
10
14
  };
11
15
  export declare type TSinchChatBubbleReact = TSinchElementReact<TSinchChatBubbleElement> & {
16
+ /** Text */
12
17
  text: string;
18
+ /** Status */
13
19
  status?: TSinchChatBubbleStatus;
14
20
  };
package/checkbox/index.js CHANGED
@@ -5,7 +5,6 @@ template.innerHTML = templateHTML;
5
5
  defineCustomElement('sinch-checkbox', class extends NectaryElement {
6
6
  #$input;
7
7
  #$label;
8
-
9
8
  constructor() {
10
9
  super();
11
10
  const shadowRoot = this.attachShadow();
@@ -13,7 +12,6 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
13
12
  this.#$input = shadowRoot.querySelector('input');
14
13
  this.#$label = shadowRoot.querySelector('label');
15
14
  }
16
-
17
15
  connectedCallback() {
18
16
  this.setAttribute('role', 'checkbox');
19
17
  this.#$input.addEventListener('input', this.#onCheckboxInput);
@@ -23,7 +21,6 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
23
21
  this.addEventListener('-focus', this.#onFocusReactHandler);
24
22
  this.addEventListener('-blur', this.#onBlurReactHandler);
25
23
  }
26
-
27
24
  disconnectedCallback() {
28
25
  this.#$input.removeEventListener('input', this.#onCheckboxInput);
29
26
  this.#$input.removeEventListener('focus', this.#onCheckboxFocus);
@@ -32,59 +29,45 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
32
29
  this.removeEventListener('-focus', this.#onFocusReactHandler);
33
30
  this.removeEventListener('-blur', this.#onBlurReactHandler);
34
31
  }
35
-
36
32
  static get observedAttributes() {
37
33
  return ['checked', 'disabled', 'text'];
38
34
  }
39
-
40
35
  get type() {
41
36
  return 'text';
42
37
  }
43
-
44
38
  get nodeName() {
45
39
  return 'input';
46
40
  }
47
-
48
41
  set checked(isChecked) {
49
42
  updateBooleanAttribute(this, 'checked', isChecked);
50
43
  }
51
-
52
44
  get checked() {
53
45
  return getBooleanAttribute(this, 'checked');
54
46
  }
55
-
56
47
  set indeterminate(isIndeterminate) {
57
48
  updateBooleanAttribute(this, 'indeterminate', isIndeterminate);
58
49
  }
59
-
60
50
  get indeterminate() {
61
51
  return getBooleanAttribute(this, 'indeterminate');
62
52
  }
63
-
64
53
  set disabled(isDisabled) {
65
54
  updateBooleanAttribute(this, 'disabled', isDisabled);
66
55
  }
67
-
68
56
  get disabled() {
69
57
  return getBooleanAttribute(this, 'disabled');
70
58
  }
71
-
72
59
  set invalid(isInvalid) {
73
60
  updateBooleanAttribute(this, 'invalid', isInvalid);
74
61
  }
75
-
76
62
  get invalid() {
77
63
  return getBooleanAttribute(this, 'invalid');
78
64
  }
79
-
80
65
  set text(value) {
81
66
  updateAttribute(this, 'text', value);
82
67
  }
83
-
84
68
  get text() {
85
69
  return getAttribute(this, 'text');
86
70
  }
87
-
88
71
  attributeChangedCallback(name, _, newVal) {
89
72
  switch (name) {
90
73
  case 'text':
@@ -92,7 +75,6 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
92
75
  this.#$label.textContent = newVal;
93
76
  break;
94
77
  }
95
-
96
78
  case 'checked':
97
79
  {
98
80
  const isChecked = isAttrTrue(newVal);
@@ -100,7 +82,6 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
100
82
  updateExplicitBooleanAttribute(this, 'aria-checked', isChecked);
101
83
  break;
102
84
  }
103
-
104
85
  case 'disabled':
105
86
  {
106
87
  const isDisabled = isAttrTrue(newVal);
@@ -110,19 +91,15 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
110
91
  }
111
92
  }
112
93
  }
113
-
114
94
  get focusable() {
115
95
  return true;
116
96
  }
117
-
118
97
  focus() {
119
98
  this.#$input.focus();
120
99
  }
121
-
122
100
  blur() {
123
101
  this.#$input.blur();
124
102
  }
125
-
126
103
  #onCheckboxInput = e => {
127
104
  e.stopPropagation();
128
105
  const isChecked = this.#$input.checked;
package/chip/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import '../text';
2
2
  import '../icons/cancel';
3
3
  import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, getReactEventHandler } from '../utils';
4
- import { NO_COLOR } from '../utils/colors';
5
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;padding:0 5px 0 9px;border-radius:12px;background-color:var(--sinch-color-snow-500);color:var(--sinch-color-text-default);box-sizing:border-box;cursor:pointer;--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:16px}#button:focus-visible::after{content:"";position:absolute;inset:-4px;border-radius:16px;border:2px solid var(--sinch-color-border-focus);pointer-events:none}@supports not selector(:focus-visible){#button:focus::after{content:"";position:absolute;inset:-4px;border-radius:16px;border:2px solid var(--sinch-color-border-focus);pointer-events:none}:host([small]:not([small=false])) #button:focus::after{border-radius:14px}}#text{flex:1}:host([small]:not([small=false])) #button{height:20px;border-radius:10px;padding:0 3px 0 7px}:host([small]:not([small=false])) #button:focus-visible::after{border-radius:14px}::slotted(*){margin-left:-4px}</style><button id="button"><slot name="icon"></slot><sinch-text id="text" type="xs" ellipsis></sinch-text><sinch-icon-cancel id="close"></sinch-icon-cancel></button>';
4
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;padding:0 5px 0 9px;border-radius:12px;background-color:var(--sinch-chip-color-default-bg);color:var(--sinch-chip-color-default-fg);box-sizing:border-box;cursor:pointer;--sinch-color-icon:var(--sinch-chip-color-default-fg);--sinch-size-icon:16px}#button:focus-visible::after{content:"";position:absolute;inset:-4px;border-radius:16px;border:2px solid var(--sinch-color-border-focus);pointer-events:none}@supports not selector(:focus-visible){#button:focus::after{content:"";position:absolute;inset:-4px;border-radius:16px;border:2px solid var(--sinch-color-border-focus);pointer-events:none}:host([small]:not([small=false])) #button:focus::after{border-radius:14px}}#text{flex:1}:host([small]:not([small=false])) #button{height:20px;border-radius:10px;padding:0 3px 0 7px}:host([small]:not([small=false])) #button:focus-visible::after{border-radius:14px}::slotted(*){margin-left:-4px}</style><button id="button"><slot name="icon"></slot><sinch-text id="text" type="xs" ellipsis></sinch-text><sinch-icon-cancel id="close"></sinch-icon-cancel></button>';
5
+ import { assertChipColor, getChipColorBg, getChipColorFg } from './utils';
6
6
  const template = document.createElement('template');
7
7
  template.innerHTML = templateHTML;
8
8
  defineCustomElement('sinch-chip', class extends NectaryElement {
9
9
  #$text;
10
10
  #$button;
11
+ #isConnected = false;
11
12
  #controller = null;
12
-
13
13
  constructor() {
14
14
  super();
15
15
  const shadowRoot = this.attachShadow();
@@ -17,7 +17,6 @@ defineCustomElement('sinch-chip', class extends NectaryElement {
17
17
  this.#$button = shadowRoot.querySelector('#button');
18
18
  this.#$text = shadowRoot.querySelector('#text');
19
19
  }
20
-
21
20
  connectedCallback() {
22
21
  this.#controller = new AbortController();
23
22
  const {
@@ -42,41 +41,34 @@ defineCustomElement('sinch-chip', class extends NectaryElement {
42
41
  this.addEventListener('-blur', this.#onBlurReactHandler, {
43
42
  signal
44
43
  });
44
+ this.#isConnected = true;
45
45
  this.#updateColor();
46
46
  }
47
-
48
47
  disconnectedCallback() {
49
48
  this.#controller.abort();
49
+ this.#isConnected = false;
50
50
  }
51
-
52
51
  get color() {
53
52
  return getAttribute(this, 'color');
54
53
  }
55
-
56
54
  set color(value) {
57
55
  updateAttribute(this, 'color', value);
58
56
  }
59
-
60
57
  get text() {
61
58
  return getAttribute(this, 'text', '');
62
59
  }
63
-
64
60
  set text(value) {
65
61
  updateAttribute(this, 'text', value);
66
62
  }
67
-
68
63
  get small() {
69
64
  return getBooleanAttribute(this, 'small');
70
65
  }
71
-
72
66
  set small(isSmall) {
73
67
  updateBooleanAttribute(this, 'small', isSmall);
74
68
  }
75
-
76
69
  static get observedAttributes() {
77
70
  return ['text', 'color'];
78
71
  }
79
-
80
72
  attributeChangedCallback(name, _, newVal) {
81
73
  switch (name) {
82
74
  case 'color':
@@ -84,7 +76,6 @@ defineCustomElement('sinch-chip', class extends NectaryElement {
84
76
  this.#updateColor();
85
77
  break;
86
78
  }
87
-
88
79
  case 'text':
89
80
  {
90
81
  this.#$text.textContent = newVal;
@@ -92,33 +83,33 @@ defineCustomElement('sinch-chip', class extends NectaryElement {
92
83
  }
93
84
  }
94
85
  }
95
-
96
86
  #updateColor() {
97
- const colorName = this.color ?? NO_COLOR;
98
-
99
- if (colorName !== NO_COLOR) {
100
- this.#$button.style.setProperty('background-color', `var(--sinch-color-map-${colorName}-bg)`);
101
- this.#$button.style.setProperty('color', `var(--sinch-color-map-${colorName}-fg)`);
102
- this.#$button.style.setProperty('--sinch-color-icon', `var(--sinch-color-map-${colorName}-fg)`);
87
+ if (!this.#isConnected) {
88
+ return;
89
+ }
90
+ const colorName = this.color;
91
+ if (colorName !== null && colorName.length > 0) {
92
+ assertChipColor(this, colorName);
93
+ const bg = getChipColorBg(colorName);
94
+ const fg = getChipColorFg(colorName);
95
+ this.#$button.style.setProperty('background-color', bg);
96
+ this.#$button.style.setProperty('color', fg);
97
+ this.#$button.style.setProperty('--sinch-color-icon', fg);
103
98
  } else {
104
99
  this.#$button.style.removeProperty('background-color');
105
100
  this.#$button.style.removeProperty('color');
106
101
  this.#$button.style.removeProperty('--sinch-color-icon');
107
102
  }
108
103
  }
109
-
110
104
  get focusable() {
111
105
  return true;
112
106
  }
113
-
114
107
  focus() {
115
108
  this.#$button.focus();
116
109
  }
117
-
118
110
  blur() {
119
111
  this.#$button.blur();
120
112
  }
121
-
122
113
  #onButtonClick = () => {
123
114
  this.dispatchEvent(new CustomEvent('-click'));
124
115
  };
@@ -0,0 +1,3 @@
1
+ export declare const getChipColorBg: (id: string) => string;
2
+ export declare const getChipColorFg: (id: string) => string;
3
+ export declare const assertChipColor: (root: Element, id: string | null) => void;
package/chip/utils.js ADDED
@@ -0,0 +1,11 @@
1
+ export const getChipColorBg = id => {
2
+ return `var(--sinch-chip-color-${id}-bg)`;
3
+ };
4
+ export const getChipColorFg = id => {
5
+ return `var(--sinch-chip-color-${id}-fg)`;
6
+ };
7
+ export const assertChipColor = (root, id) => {
8
+ if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-chip-color-${id}-bg`).length === 0) {
9
+ throw new Error(`Invalid sinch-chip color name: ${id}`);
10
+ }
11
+ };