@nectary/components 0.39.0 → 0.41.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 (142) hide show
  1. package/accordion/index.js +47 -84
  2. package/accordion-item/index.js +30 -53
  3. package/action-menu/index.d.ts +0 -1
  4. package/action-menu/index.js +177 -223
  5. package/action-menu/types.d.ts +8 -18
  6. package/action-menu-option/index.d.ts +1 -0
  7. package/action-menu-option/index.js +52 -62
  8. package/action-menu-option/types.d.ts +9 -0
  9. package/action-menu-option/utils.d.ts +2 -0
  10. package/action-menu-option/utils.js +3 -0
  11. package/alert/index.js +6 -20
  12. package/avatar/index.js +12 -31
  13. package/avatar-badge/index.js +8 -22
  14. package/avatar-status/index.js +1 -1
  15. package/button/index.js +46 -92
  16. package/button/types.d.ts +1 -1
  17. package/card/index.js +21 -59
  18. package/chat-avatar/index.js +8 -22
  19. package/chat-block/index.js +29 -69
  20. package/chat-bubble/index.js +6 -20
  21. package/checkbox/index.js +59 -107
  22. package/chip/index.d.ts +13 -0
  23. package/chip/index.js +140 -0
  24. package/chip/types.d.ts +37 -0
  25. package/color-menu/index.d.ts +14 -0
  26. package/color-menu/index.js +450 -0
  27. package/color-menu/types.d.ts +36 -0
  28. package/color-menu/utils.d.ts +1 -0
  29. package/color-menu/utils.js +15 -0
  30. package/color-swatch/index.d.ts +13 -0
  31. package/color-swatch/index.js +60 -0
  32. package/color-swatch/types.d.ts +11 -0
  33. package/colors.json +61 -49
  34. package/date-picker/index.js +162 -293
  35. package/dialog/index.js +70 -142
  36. package/field/index.js +44 -65
  37. package/file-drop/index.js +123 -200
  38. package/file-picker/index.d.ts +0 -1
  39. package/file-picker/index.js +55 -108
  40. package/file-status/index.js +15 -39
  41. package/help-tooltip/index.js +11 -28
  42. package/horizontal-stepper/index.js +33 -59
  43. package/horizontal-stepper-item/index.js +13 -37
  44. package/icon-button/index.d.ts +1 -0
  45. package/icon-button/index.js +51 -85
  46. package/icon-button/types.d.ts +16 -2
  47. package/icons-channel/notify/index.d.ts +11 -0
  48. package/icons-channel/notify/index.js +4 -0
  49. package/illustrations/create-illustration-class.js +1 -1
  50. package/inline-alert/index.js +29 -81
  51. package/input/index.js +117 -222
  52. package/link/index.js +51 -97
  53. package/list-item/index.js +1 -1
  54. package/package.json +12 -14
  55. package/pagination/index.js +113 -163
  56. package/pop/index.d.ts +11 -0
  57. package/pop/index.js +391 -0
  58. package/pop/types.d.ts +35 -0
  59. package/pop/utils.d.ts +7 -0
  60. package/pop/utils.js +18 -0
  61. package/popover/index.d.ts +1 -0
  62. package/popover/index.js +105 -314
  63. package/popover/types.d.ts +8 -1
  64. package/popover/utils.d.ts +5 -0
  65. package/popover/utils.js +17 -1
  66. package/progress/index.js +9 -28
  67. package/radio/index.js +103 -169
  68. package/radio-option/index.js +28 -48
  69. package/segment/index.js +49 -130
  70. package/segment-collapse/index.js +28 -49
  71. package/segmented-control/index.js +36 -73
  72. package/segmented-control-option/index.js +45 -87
  73. package/segmented-icon-control/index.js +47 -84
  74. package/segmented-icon-control-option/index.js +42 -79
  75. package/select-button/index.d.ts +13 -0
  76. package/select-button/index.js +158 -0
  77. package/select-button/types.d.ts +43 -0
  78. package/select-menu/index.d.ts +11 -0
  79. package/select-menu/index.js +345 -0
  80. package/select-menu/types.d.ts +29 -0
  81. package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
  82. package/select-menu-option/index.js +76 -0
  83. package/{select-option → select-menu-option}/types.d.ts +8 -9
  84. package/stop-events/index.js +7 -20
  85. package/table-head-cell/index.js +7 -21
  86. package/tabs/index.js +103 -165
  87. package/tabs-option/index.js +24 -44
  88. package/tag/index.d.ts +0 -1
  89. package/tag/index.js +35 -38
  90. package/tag/types.d.ts +12 -7
  91. package/textarea/index.js +96 -167
  92. package/theme.css +146 -49
  93. package/tile-control/index.js +55 -96
  94. package/tile-control-option/index.js +45 -87
  95. package/time-picker/index.js +216 -368
  96. package/title/index.js +6 -20
  97. package/toast/index.js +32 -70
  98. package/toast-manager/index.js +141 -217
  99. package/toggle/index.js +59 -107
  100. package/tooltip/index.d.ts +2 -0
  101. package/tooltip/index.js +160 -17
  102. package/tooltip/types.d.ts +13 -0
  103. package/tooltip/utils.d.ts +5 -0
  104. package/tooltip/utils.js +25 -1
  105. package/utils/animation.d.ts +17 -0
  106. package/utils/animation.js +142 -0
  107. package/utils/colors.d.ts +5 -0
  108. package/utils/colors.js +5 -0
  109. package/utils/context.d.ts +15 -0
  110. package/utils/context.js +57 -0
  111. package/{utils.d.ts → utils/index.d.ts} +15 -11
  112. package/{utils.js → utils/index.js} +104 -48
  113. package/vertical-stepper/index.js +29 -50
  114. package/vertical-stepper-item/index.js +13 -37
  115. package/dropdown/index.d.ts +0 -12
  116. package/dropdown/index.js +0 -415
  117. package/dropdown/types.d.ts +0 -32
  118. package/dropdown-checkbox-option/index.d.ts +0 -11
  119. package/dropdown-checkbox-option/index.js +0 -88
  120. package/dropdown-checkbox-option/types.d.ts +0 -15
  121. package/dropdown-radio-option/index.d.ts +0 -11
  122. package/dropdown-radio-option/index.js +0 -88
  123. package/dropdown-radio-option/types.d.ts +0 -15
  124. package/dropdown-text-option/index.js +0 -104
  125. package/dropdown-text-option/types.d.ts +0 -16
  126. package/select/index.d.ts +0 -13
  127. package/select/index.js +0 -316
  128. package/select/types.d.ts +0 -53
  129. package/select-option/index.d.ts +0 -11
  130. package/select-option/index.js +0 -8
  131. package/tag/utils.d.ts +0 -5
  132. package/tag/utils.js +0 -6
  133. package/tag-close/index.d.ts +0 -12
  134. package/tag-close/index.js +0 -42
  135. package/tag-close/types.d.ts +0 -5
  136. /package/{dropdown-checkbox-option → chip}/types.js +0 -0
  137. /package/{dropdown-radio-option → color-menu}/types.js +0 -0
  138. /package/{dropdown-text-option → color-swatch}/types.js +0 -0
  139. /package/{dropdown → pop}/types.js +0 -0
  140. /package/{select-option → select-button}/types.js +0 -0
  141. /package/{tag-close → select-menu}/types.js +0 -0
  142. /package/{select → select-menu-option}/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
- 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>';
2
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px);pointer-events:none}:host([data-small])>button:focus-visible::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}@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-border-focus);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
  }
@@ -150,12 +85,35 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
150
85
  return getAttribute(this, 'text', '');
151
86
  }
152
87
 
88
+ get focusable() {
89
+ return true;
90
+ }
91
+
153
92
  focus() {
154
- _classPrivateFieldGet(this, _$button).focus();
93
+ this.#$button.focus();
155
94
  }
156
95
 
157
96
  blur() {
158
- _classPrivateFieldGet(this, _$button).blur();
97
+ this.#$button.blur();
159
98
  }
160
99
 
161
- }));
100
+ #onButtonClick = e => {
101
+ e.stopPropagation();
102
+ this.dispatchEvent(new CustomEvent('option-change', {
103
+ detail: this.value,
104
+ bubbles: true
105
+ }));
106
+ };
107
+ #onButtonFocus = () => {
108
+ this.dispatchEvent(new CustomEvent('-focus'));
109
+ };
110
+ #onButtonBlur = () => {
111
+ this.dispatchEvent(new CustomEvent('-blur'));
112
+ };
113
+ #onFocusReactHandler = () => {
114
+ getReactEventHandler(this, 'on-focus')?.();
115
+ };
116
+ #onBlurReactHandler = () => {
117
+ getReactEventHandler(this, 'on-blur')?.();
118
+ };
119
+ });