@nectary/components 0.38.0 → 0.40.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 (148) hide show
  1. package/accordion/index.js +47 -84
  2. package/accordion/types.d.ts +1 -0
  3. package/accordion-item/index.js +26 -53
  4. package/action-menu/index.d.ts +0 -1
  5. package/action-menu/index.js +179 -223
  6. package/action-menu/types.d.ts +8 -18
  7. package/action-menu-option/index.d.ts +1 -0
  8. package/action-menu-option/index.js +51 -62
  9. package/action-menu-option/types.d.ts +9 -0
  10. package/action-menu-option/utils.d.ts +2 -0
  11. package/action-menu-option/utils.js +3 -0
  12. package/alert/index.js +6 -20
  13. package/avatar/index.js +12 -31
  14. package/avatar-badge/index.js +8 -22
  15. package/avatar-status/index.js +1 -1
  16. package/button/index.js +42 -92
  17. package/card/index.d.ts +2 -0
  18. package/card/index.js +24 -87
  19. package/chat-avatar/index.js +8 -22
  20. package/chat-block/index.js +29 -69
  21. package/chat-bubble/index.js +6 -20
  22. package/checkbox/index.js +55 -107
  23. package/chip/index.d.ts +13 -0
  24. package/chip/index.js +137 -0
  25. package/chip/types.d.ts +38 -0
  26. package/color-menu/index.d.ts +13 -0
  27. package/color-menu/index.js +464 -0
  28. package/color-menu/types.d.ts +37 -0
  29. package/color-swatch/index.d.ts +13 -0
  30. package/color-swatch/index.js +59 -0
  31. package/color-swatch/types.d.ts +12 -0
  32. package/colors.json +57 -49
  33. package/date-picker/index.js +196 -287
  34. package/date-picker/types.d.ts +25 -1
  35. package/dialog/index.d.ts +1 -0
  36. package/dialog/index.js +72 -143
  37. package/dropdown-checkbox-option/index.js +6 -20
  38. package/dropdown-radio-option/index.js +6 -20
  39. package/field/index.js +25 -63
  40. package/file-drop/index.js +123 -200
  41. package/file-picker/index.d.ts +0 -1
  42. package/file-picker/index.js +55 -108
  43. package/file-status/index.js +15 -39
  44. package/help-tooltip/index.js +1 -1
  45. package/horizontal-stepper/index.js +33 -59
  46. package/horizontal-stepper-item/index.js +13 -37
  47. package/icon-button/index.js +39 -84
  48. package/icons-channel/notify/index.d.ts +11 -0
  49. package/icons-channel/notify/index.js +4 -0
  50. package/illustrations/create-illustration-class.js +1 -1
  51. package/inline-alert/index.js +30 -82
  52. package/input/index.js +113 -222
  53. package/link/index.js +46 -96
  54. package/list-item/index.js +1 -1
  55. package/package.json +12 -14
  56. package/pagination/index.js +109 -163
  57. package/pagination/types.d.ts +1 -0
  58. package/popover/index.js +224 -294
  59. package/progress/index.js +9 -28
  60. package/radio/index.js +103 -169
  61. package/radio/types.d.ts +1 -0
  62. package/radio-option/index.js +24 -48
  63. package/segment/index.js +50 -131
  64. package/segment-collapse/index.js +24 -49
  65. package/segment-collapse/types.d.ts +1 -0
  66. package/segmented-control/index.js +36 -73
  67. package/segmented-control/types.d.ts +1 -0
  68. package/segmented-control-option/index.js +41 -87
  69. package/segmented-icon-control/index.js +47 -84
  70. package/segmented-icon-control/types.d.ts +1 -0
  71. package/segmented-icon-control-option/index.js +38 -79
  72. package/select-button/index.d.ts +13 -0
  73. package/select-button/index.js +153 -0
  74. package/select-button/types.d.ts +43 -0
  75. package/select-menu/index.d.ts +11 -0
  76. package/select-menu/index.js +346 -0
  77. package/select-menu/types.d.ts +29 -0
  78. package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
  79. package/select-menu-option/index.js +76 -0
  80. package/{select-option → select-menu-option}/types.d.ts +8 -9
  81. package/stop-events/index.js +7 -20
  82. package/table-head-cell/index.js +7 -21
  83. package/tabs/index.js +103 -165
  84. package/tabs/types.d.ts +1 -0
  85. package/tabs-option/index.js +20 -44
  86. package/tag/index.d.ts +1 -1
  87. package/tag/index.js +42 -36
  88. package/tag/types.d.ts +13 -7
  89. package/textarea/index.js +92 -167
  90. package/theme.css +80 -49
  91. package/tile-control/index.js +55 -96
  92. package/tile-control-option/index.js +40 -86
  93. package/time-picker/index.js +224 -368
  94. package/time-picker/types.d.ts +5 -1
  95. package/title/index.js +6 -20
  96. package/toast/index.d.ts +17 -0
  97. package/toast/index.js +115 -0
  98. package/toast/types.d.ts +28 -0
  99. package/toast/utils.d.ts +5 -0
  100. package/toast/utils.js +6 -0
  101. package/toast-manager/index.d.ts +17 -0
  102. package/toast-manager/index.js +195 -0
  103. package/toast-manager/types.d.ts +7 -0
  104. package/toggle/index.js +55 -108
  105. package/toggle/types.d.ts +1 -0
  106. package/types.d.ts +7 -0
  107. package/utils/colors.d.ts +10 -0
  108. package/utils/colors.js +121 -0
  109. package/{utils.d.ts → utils/index.d.ts} +18 -9
  110. package/{utils.js → utils/index.js} +118 -39
  111. package/vertical-stepper/index.js +29 -50
  112. package/vertical-stepper-item/index.js +13 -37
  113. package/card-button/index.d.ts +0 -11
  114. package/card-button/index.js +0 -77
  115. package/card-button/types.d.ts +0 -12
  116. package/card-link/index.d.ts +0 -12
  117. package/card-link/index.js +0 -115
  118. package/card-link/types.d.ts +0 -14
  119. package/dropdown/index.d.ts +0 -12
  120. package/dropdown/index.js +0 -415
  121. package/dropdown/types.d.ts +0 -30
  122. package/dropdown-text-option/index.js +0 -104
  123. package/dropdown-text-option/types.d.ts +0 -16
  124. package/search/index.d.ts +0 -14
  125. package/search/index.js +0 -523
  126. package/search/types.d.ts +0 -25
  127. package/search-option/index.d.ts +0 -11
  128. package/search-option/index.js +0 -55
  129. package/search-option/types.d.ts +0 -9
  130. package/select/index.d.ts +0 -13
  131. package/select/index.js +0 -316
  132. package/select/types.d.ts +0 -53
  133. package/select-option/index.d.ts +0 -11
  134. package/select-option/index.js +0 -8
  135. package/tag/utils.d.ts +0 -2
  136. package/tag/utils.js +0 -1
  137. package/tag-close/index.d.ts +0 -12
  138. package/tag-close/index.js +0 -38
  139. package/tag-close/types.d.ts +0 -3
  140. package/tag-close/types.js +0 -1
  141. /package/{card-button → chip}/types.js +0 -0
  142. /package/{card-link → color-menu}/types.js +0 -0
  143. /package/{dropdown-text-option → color-swatch}/types.js +0 -0
  144. /package/{dropdown → select-button}/types.js +0 -0
  145. /package/{search → select-menu}/types.js +0 -0
  146. /package/{search-option → select-menu-option}/types.js +0 -0
  147. /package/{select → toast}/types.js +0 -0
  148. /package/{select-option → toast-manager}/types.js +0 -0
@@ -1,88 +1,28 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$slot, _onSlotChange, _onOptionChange, _onValueChange, _onSmallChange, _onChangeReactHandler;
5
-
6
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
-
8
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
9
-
10
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
11
-
12
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
13
-
14
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getCsvSet, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute } from '../utils';
15
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>';
16
3
  const template = document.createElement('template');
17
4
  template.innerHTML = templateHTML;
18
- defineCustomElement('sinch-tile-control', (_$slot = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _onSmallChange = new WeakSet(), _onChangeReactHandler = new WeakMap(), class extends NectaryElement {
5
+ defineCustomElement('sinch-tile-control', class extends NectaryElement {
6
+ #$slot;
7
+
19
8
  constructor() {
20
9
  super();
21
-
22
- _classPrivateMethodInitSpec(this, _onSmallChange);
23
-
24
- _classPrivateMethodInitSpec(this, _onValueChange);
25
-
26
- _classPrivateFieldInitSpec(this, _$slot, {
27
- writable: true,
28
- value: void 0
29
- });
30
-
31
- _classPrivateFieldInitSpec(this, _onSlotChange, {
32
- writable: true,
33
- value: () => {
34
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
35
-
36
- _classPrivateMethodGet(this, _onSmallChange, _onSmallChange2).call(this);
37
- }
38
- });
39
-
40
- _classPrivateFieldInitSpec(this, _onOptionChange, {
41
- writable: true,
42
- value: e => {
43
- e.stopPropagation();
44
- const $elem = e.target;
45
- const value = e.detail;
46
- const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
47
- this.dispatchEvent(new CustomEvent('change', {
48
- detail,
49
- bubbles: true
50
- }));
51
- this.dispatchEvent(new CustomEvent('-change', {
52
- detail
53
- }));
54
- }
55
- });
56
-
57
- _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
58
- writable: true,
59
- value: e => {
60
- getReactEventHandler(this, 'on-change')?.(e);
61
- }
62
- });
63
-
64
10
  const shadowRoot = this.attachShadow();
65
11
  shadowRoot.appendChild(template.content.cloneNode(true));
66
-
67
- _classPrivateFieldSet(this, _$slot, shadowRoot.querySelector('slot'));
12
+ this.#$slot = shadowRoot.querySelector('slot');
68
13
  }
69
14
 
70
15
  connectedCallback() {
71
16
  this.setAttribute('role', 'tablist');
72
-
73
- _classPrivateFieldGet(this, _$slot).addEventListener('option-change', _classPrivateFieldGet(this, _onOptionChange));
74
-
75
- _classPrivateFieldGet(this, _$slot).addEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
76
-
77
- this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
17
+ this.#$slot.addEventListener('option-change', this.#onOptionChange);
18
+ this.#$slot.addEventListener('slotchange', this.#onSlotChange);
19
+ this.addEventListener('-change', this.#onChangeReactHandler);
78
20
  }
79
21
 
80
22
  disconnectedCallback() {
81
- _classPrivateFieldGet(this, _$slot).removeEventListener('option-change', _classPrivateFieldGet(this, _onOptionChange));
82
-
83
- _classPrivateFieldGet(this, _$slot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
84
-
85
- this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
23
+ this.#$slot.removeEventListener('option-change', this.#onOptionChange);
24
+ this.#$slot.removeEventListener('slotchange', this.#onSlotChange);
25
+ this.removeEventListener('-change', this.#onChangeReactHandler);
86
26
  }
87
27
 
88
28
  static get observedAttributes() {
@@ -133,49 +73,68 @@ defineCustomElement('sinch-tile-control', (_$slot = new WeakMap(), _onSlotChange
133
73
  switch (name) {
134
74
  case 'value':
135
75
  {
136
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, newVal ?? '');
137
-
76
+ this.#onValueChange(newVal ?? '');
138
77
  break;
139
78
  }
140
79
 
141
80
  case 'small':
142
81
  {
143
- _classPrivateMethodGet(this, _onSmallChange, _onSmallChange2).call(this);
144
-
82
+ this.#onSmallChange();
145
83
  break;
146
84
  }
147
85
 
148
86
  case 'multiple':
149
87
  {
150
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
88
+ this.#onValueChange(this.value);
151
89
  }
152
90
  }
153
91
  }
154
92
 
155
- }));
156
-
157
- function _onValueChange2(csv) {
158
- if (this.multiple) {
159
- const values = getCsvSet(csv);
160
-
161
- for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
162
- const isChecked = !getBooleanAttribute($option, 'disabled') && values.has(getAttribute($option, 'value', ''));
163
- updateBooleanAttribute($option, 'data-checked', isChecked);
164
- }
165
- } else {
166
- const value = getFirstCsvValue(csv);
93
+ #onSlotChange = () => {
94
+ this.#onValueChange(this.value);
95
+ this.#onSmallChange();
96
+ };
97
+ #onOptionChange = e => {
98
+ e.stopPropagation();
99
+ const $elem = e.target;
100
+ const value = e.detail;
101
+ const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
102
+ this.dispatchEvent(new CustomEvent('change', {
103
+ detail,
104
+ bubbles: true
105
+ }));
106
+ this.dispatchEvent(new CustomEvent('-change', {
107
+ detail
108
+ }));
109
+ };
110
+
111
+ #onValueChange(csv) {
112
+ if (this.multiple) {
113
+ const values = getCsvSet(csv);
114
+
115
+ for (const $option of this.#$slot.assignedElements()) {
116
+ const isChecked = !getBooleanAttribute($option, 'disabled') && values.has(getAttribute($option, 'value', ''));
117
+ updateBooleanAttribute($option, 'data-checked', isChecked);
118
+ }
119
+ } else {
120
+ const value = getFirstCsvValue(csv);
167
121
 
168
- for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
169
- const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
170
- updateBooleanAttribute($option, 'data-checked', isChecked);
122
+ for (const $option of this.#$slot.assignedElements()) {
123
+ const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
124
+ updateBooleanAttribute($option, 'data-checked', isChecked);
125
+ }
171
126
  }
172
127
  }
173
- }
174
128
 
175
- function _onSmallChange2() {
176
- const isSmall = this.small;
129
+ #onSmallChange() {
130
+ const isSmall = this.small;
177
131
 
178
- for (const $opt of _classPrivateFieldGet(this, _$slot).assignedElements()) {
179
- updateBooleanAttribute($opt, 'data-small', isSmall);
132
+ for (const $opt of this.#$slot.assignedElements()) {
133
+ updateBooleanAttribute($opt, 'data-small', isSmall);
134
+ }
180
135
  }
181
- }
136
+
137
+ #onChangeReactHandler = e => {
138
+ getReactEventHandler(this, 'on-change')?.(e);
139
+ };
140
+ });
@@ -1,99 +1,34 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$button, _$text, _onButtonClick, _onButtonFocus, _onButtonBlur, _onFocusReactHandler, _onBlurReactHandler;
5
-
6
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
-
8
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
-
10
1
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
11
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-aqua-400);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)}@supports not selector(:focus-visible){button:focus::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-shape-radius-l) + 4px)}:host([data-small])>button:focus::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>';
12
3
  const template = document.createElement('template');
13
4
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$text = new WeakMap(), _onButtonClick = new WeakMap(), _onButtonFocus = new WeakMap(), _onButtonBlur = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), class extends NectaryElement {
5
+ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
6
+ #$button;
7
+ #$text;
8
+
15
9
  constructor() {
16
10
  super();
17
-
18
- _classPrivateFieldInitSpec(this, _$button, {
19
- writable: true,
20
- value: void 0
21
- });
22
-
23
- _classPrivateFieldInitSpec(this, _$text, {
24
- writable: true,
25
- value: void 0
26
- });
27
-
28
- _classPrivateFieldInitSpec(this, _onButtonClick, {
29
- writable: true,
30
- value: e => {
31
- e.stopPropagation();
32
- this.dispatchEvent(new CustomEvent('option-change', {
33
- detail: this.value,
34
- bubbles: true
35
- }));
36
- }
37
- });
38
-
39
- _classPrivateFieldInitSpec(this, _onButtonFocus, {
40
- writable: true,
41
- value: () => {
42
- this.dispatchEvent(new CustomEvent('-focus'));
43
- }
44
- });
45
-
46
- _classPrivateFieldInitSpec(this, _onButtonBlur, {
47
- writable: true,
48
- value: () => {
49
- this.dispatchEvent(new CustomEvent('-blur'));
50
- }
51
- });
52
-
53
- _classPrivateFieldInitSpec(this, _onFocusReactHandler, {
54
- writable: true,
55
- value: () => {
56
- getReactEventHandler(this, 'on-focus')?.();
57
- }
58
- });
59
-
60
- _classPrivateFieldInitSpec(this, _onBlurReactHandler, {
61
- writable: true,
62
- value: () => {
63
- getReactEventHandler(this, 'on-blur')?.();
64
- }
65
- });
66
-
67
11
  const shadowRoot = this.attachShadow();
68
12
  shadowRoot.appendChild(template.content.cloneNode(true));
69
-
70
- _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
71
-
72
- _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
13
+ this.#$button = shadowRoot.querySelector('button');
14
+ this.#$text = shadowRoot.querySelector('#text');
73
15
  }
74
16
 
75
17
  connectedCallback() {
76
18
  this.setAttribute('role', 'tab');
77
-
78
- _classPrivateFieldGet(this, _$button).addEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
79
-
80
- _classPrivateFieldGet(this, _$button).addEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
81
-
82
- _classPrivateFieldGet(this, _$button).addEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
83
-
84
- this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
85
- this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
19
+ this.#$button.addEventListener('click', this.#onButtonClick);
20
+ this.#$button.addEventListener('focus', this.#onButtonFocus);
21
+ this.#$button.addEventListener('blur', this.#onButtonBlur);
22
+ this.addEventListener('-focus', this.#onFocusReactHandler);
23
+ this.addEventListener('-blur', this.#onBlurReactHandler);
86
24
  }
87
25
 
88
26
  disconnectedCallback() {
89
- _classPrivateFieldGet(this, _$button).removeEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
90
-
91
- _classPrivateFieldGet(this, _$button).removeEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
92
-
93
- _classPrivateFieldGet(this, _$button).removeEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
94
-
95
- this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
96
- this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
27
+ this.#$button.removeEventListener('click', this.#onButtonClick);
28
+ this.#$button.removeEventListener('focus', this.#onButtonFocus);
29
+ this.#$button.removeEventListener('blur', this.#onButtonBlur);
30
+ this.removeEventListener('-focus', this.#onFocusReactHandler);
31
+ this.removeEventListener('-blur', this.#onBlurReactHandler);
97
32
  }
98
33
 
99
34
  static get observedAttributes() {
@@ -108,7 +43,7 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
108
43
  switch (name) {
109
44
  case 'text':
110
45
  {
111
- _classPrivateFieldGet(this, _$text).textContent = newVal;
46
+ this.#$text.textContent = newVal;
112
47
  break;
113
48
  }
114
49
 
@@ -120,7 +55,7 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
120
55
 
121
56
  case 'disabled':
122
57
  {
123
- _classPrivateFieldGet(this, _$button).disabled = isAttrTrue(newVal);
58
+ this.#$button.disabled = isAttrTrue(newVal);
124
59
  break;
125
60
  }
126
61
  }
@@ -151,11 +86,30 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
151
86
  }
152
87
 
153
88
  focus() {
154
- _classPrivateFieldGet(this, _$button).focus();
89
+ this.#$button.focus();
155
90
  }
156
91
 
157
92
  blur() {
158
- _classPrivateFieldGet(this, _$button).blur();
93
+ this.#$button.blur();
159
94
  }
160
95
 
161
- }));
96
+ #onButtonClick = e => {
97
+ e.stopPropagation();
98
+ this.dispatchEvent(new CustomEvent('option-change', {
99
+ detail: this.value,
100
+ bubbles: true
101
+ }));
102
+ };
103
+ #onButtonFocus = () => {
104
+ this.dispatchEvent(new CustomEvent('-focus'));
105
+ };
106
+ #onButtonBlur = () => {
107
+ this.dispatchEvent(new CustomEvent('-blur'));
108
+ };
109
+ #onFocusReactHandler = () => {
110
+ getReactEventHandler(this, 'on-focus')?.();
111
+ };
112
+ #onBlurReactHandler = () => {
113
+ getReactEventHandler(this, 'on-blur')?.();
114
+ };
115
+ });