@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
package/radio/index.js CHANGED
@@ -1,133 +1,30 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$slot, _onOptionKeyDown, _onSlotChange, _onOptionChange, _onValueChange, _dispatchChangeEvent, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _getEnabledRadioElements, _findSelectedOption, _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, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
15
2
  const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%}</style><div id="wrapper"><slot></slot></div>';
16
3
  const template = document.createElement('template');
17
4
  template.innerHTML = templateHTML;
18
- defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), _findSelectedOption = new WeakSet(), _onChangeReactHandler = new WeakMap(), class extends NectaryElement {
5
+ defineCustomElement('sinch-radio', class extends NectaryElement {
6
+ #$slot;
7
+
19
8
  constructor() {
20
9
  super();
21
-
22
- _classPrivateMethodInitSpec(this, _findSelectedOption);
23
-
24
- _classPrivateMethodInitSpec(this, _getEnabledRadioElements);
25
-
26
- _classPrivateMethodInitSpec(this, _getPrevOption);
27
-
28
- _classPrivateMethodInitSpec(this, _getNextOption);
29
-
30
- _classPrivateMethodInitSpec(this, _getLastOption);
31
-
32
- _classPrivateMethodInitSpec(this, _getFirstOption);
33
-
34
- _classPrivateMethodInitSpec(this, _dispatchChangeEvent);
35
-
36
- _classPrivateMethodInitSpec(this, _onValueChange);
37
-
38
- _classPrivateFieldInitSpec(this, _$slot, {
39
- writable: true,
40
- value: void 0
41
- });
42
-
43
- _classPrivateFieldInitSpec(this, _onOptionKeyDown, {
44
- writable: true,
45
- value: e => {
46
- switch (e.code) {
47
- case 'ArrowUp':
48
- case 'ArrowLeft':
49
- {
50
- e.preventDefault();
51
-
52
- const $option = _classPrivateMethodGet(this, _getPrevOption, _getPrevOption2).call(this);
53
-
54
- if ($option !== null) {
55
- $option.focus();
56
-
57
- _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option.value);
58
- }
59
-
60
- break;
61
- }
62
-
63
- case 'ArrowDown':
64
- case 'ArrowRight':
65
- {
66
- e.preventDefault();
67
-
68
- const $option = _classPrivateMethodGet(this, _getNextOption, _getNextOption2).call(this);
69
-
70
- if ($option !== null) {
71
- $option.focus();
72
-
73
- _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option.value);
74
- }
75
-
76
- break;
77
- }
78
- }
79
- }
80
- });
81
-
82
- _classPrivateFieldInitSpec(this, _onSlotChange, {
83
- writable: true,
84
- value: () => {
85
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
86
- }
87
- });
88
-
89
- _classPrivateFieldInitSpec(this, _onOptionChange, {
90
- writable: true,
91
- value: e => {
92
- e.stopPropagation();
93
-
94
- _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, e.detail);
95
- }
96
- });
97
-
98
- _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
99
- writable: true,
100
- value: e => {
101
- getReactEventHandler(this, 'on-change')?.(e);
102
- }
103
- });
104
-
105
10
  const shadowRoot = this.attachShadow();
106
11
  shadowRoot.appendChild(template.content.cloneNode(true));
107
-
108
- _classPrivateFieldSet(this, _$slot, shadowRoot.querySelector('slot'));
12
+ this.#$slot = shadowRoot.querySelector('slot');
109
13
  }
110
14
 
111
15
  connectedCallback() {
112
16
  this.setAttribute('role', 'radiogroup');
113
-
114
- _classPrivateFieldGet(this, _$slot).addEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
115
-
116
- _classPrivateFieldGet(this, _$slot).addEventListener('keydown', _classPrivateFieldGet(this, _onOptionKeyDown));
117
-
118
- _classPrivateFieldGet(this, _$slot).addEventListener('option-change', _classPrivateFieldGet(this, _onOptionChange));
119
-
120
- this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
17
+ this.#$slot.addEventListener('slotchange', this.#onSlotChange);
18
+ this.#$slot.addEventListener('keydown', this.#onOptionKeyDown);
19
+ this.#$slot.addEventListener('option-change', this.#onOptionChange);
20
+ this.addEventListener('-change', this.#onChangeReactHandler);
121
21
  }
122
22
 
123
23
  disconnectedCallback() {
124
- _classPrivateFieldGet(this, _$slot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
125
-
126
- _classPrivateFieldGet(this, _$slot).removeEventListener('keydown', _classPrivateFieldGet(this, _onOptionKeyDown));
127
-
128
- _classPrivateFieldGet(this, _$slot).removeEventListener('option-change', _classPrivateFieldGet(this, _onOptionChange));
129
-
130
- this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
24
+ this.#$slot.removeEventListener('slotchange', this.#onSlotChange);
25
+ this.#$slot.removeEventListener('keydown', this.#onOptionKeyDown);
26
+ this.#$slot.removeEventListener('option-change', this.#onOptionChange);
27
+ this.removeEventListener('-change', this.#onChangeReactHandler);
131
28
  }
132
29
 
133
30
  static get observedAttributes() {
@@ -154,84 +51,121 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
154
51
  switch (name) {
155
52
  case 'value':
156
53
  {
157
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, newVal ?? '');
158
-
54
+ this.#onValueChange(newVal ?? '');
159
55
  break;
160
56
  }
161
57
  }
162
58
  }
163
59
 
164
- }));
60
+ #onOptionKeyDown = e => {
61
+ switch (e.code) {
62
+ case 'ArrowUp':
63
+ case 'ArrowLeft':
64
+ {
65
+ e.preventDefault();
66
+ const $option = this.#getPrevOption();
165
67
 
166
- function _onValueChange2(value) {
167
- for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
168
- const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
169
- updateBooleanAttribute($option, 'checked', isChecked);
170
- }
171
- }
68
+ if ($option !== null) {
69
+ $option.focus();
70
+ this.#dispatchChangeEvent($option.value);
71
+ }
172
72
 
173
- function _dispatchChangeEvent2(value) {
174
- this.dispatchEvent(new CustomEvent('change', {
175
- detail: value,
176
- bubbles: true
177
- }));
178
- this.dispatchEvent(new CustomEvent('-change', {
179
- detail: value
180
- }));
181
- }
73
+ break;
74
+ }
182
75
 
183
- function _getFirstOption2() {
184
- for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
185
- if ($option.disabled !== true) {
186
- return $option;
187
- }
188
- }
76
+ case 'ArrowDown':
77
+ case 'ArrowRight':
78
+ {
79
+ e.preventDefault();
80
+ const $option = this.#getNextOption();
189
81
 
190
- return null;
191
- }
82
+ if ($option !== null) {
83
+ $option.focus();
84
+ this.#dispatchChangeEvent($option.value);
85
+ }
192
86
 
193
- function _getLastOption2() {
194
- for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements().reverse()) {
195
- if ($option.disabled !== true) {
196
- return $option;
87
+ break;
88
+ }
89
+ }
90
+ };
91
+ #onSlotChange = () => {
92
+ this.#onValueChange(this.value);
93
+ };
94
+ #onOptionChange = e => {
95
+ e.stopPropagation();
96
+ this.#dispatchChangeEvent(e.detail);
97
+ };
98
+
99
+ #onValueChange(value) {
100
+ for (const $option of this.#$slot.assignedElements()) {
101
+ const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
102
+ updateBooleanAttribute($option, 'checked', isChecked);
197
103
  }
198
104
  }
199
105
 
200
- return null;
201
- }
106
+ #dispatchChangeEvent(value) {
107
+ this.dispatchEvent(new CustomEvent('change', {
108
+ detail: value,
109
+ bubbles: true
110
+ }));
111
+ this.dispatchEvent(new CustomEvent('-change', {
112
+ detail: value
113
+ }));
114
+ }
202
115
 
203
- function _getNextOption2() {
204
- const $options = _classPrivateMethodGet(this, _getEnabledRadioElements, _getEnabledRadioElements2).call(this);
116
+ #getFirstOption() {
117
+ for (const $option of this.#$slot.assignedElements()) {
118
+ if ($option.disabled !== true) {
119
+ return $option;
120
+ }
121
+ }
205
122
 
206
- const $selectedOption = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, $options);
123
+ return null;
124
+ }
207
125
 
208
- const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
126
+ #getLastOption() {
127
+ for (const $option of this.#$slot.assignedElements().reverse()) {
128
+ if ($option.disabled !== true) {
129
+ return $option;
130
+ }
131
+ }
209
132
 
210
- if (currentIndex < 0) {
211
- return _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this);
133
+ return null;
212
134
  }
213
135
 
214
- return $options[(currentIndex + 1) % $options.length];
215
- }
136
+ #getNextOption() {
137
+ const $options = this.#getEnabledRadioElements();
138
+ const $selectedOption = this.#findSelectedOption($options);
139
+ const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
140
+
141
+ if (currentIndex < 0) {
142
+ return this.#getFirstOption();
143
+ }
216
144
 
217
- function _getPrevOption2() {
218
- const $options = _classPrivateMethodGet(this, _getEnabledRadioElements, _getEnabledRadioElements2).call(this);
145
+ return $options[(currentIndex + 1) % $options.length];
146
+ }
219
147
 
220
- const $selectedOption = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, $options);
148
+ #getPrevOption() {
149
+ const $options = this.#getEnabledRadioElements();
150
+ const $selectedOption = this.#findSelectedOption($options);
151
+ const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
221
152
 
222
- const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
153
+ if (currentIndex < 0) {
154
+ return this.#getLastOption();
155
+ }
223
156
 
224
- if (currentIndex < 0) {
225
- return _classPrivateMethodGet(this, _getLastOption, _getLastOption2).call(this);
157
+ return $options[(currentIndex - 1 + $options.length) % $options.length];
226
158
  }
227
159
 
228
- return $options[(currentIndex - 1 + $options.length) % $options.length];
229
- }
160
+ #getEnabledRadioElements() {
161
+ return this.#$slot.assignedElements().filter(el => el.disabled !== true);
162
+ }
230
163
 
231
- function _getEnabledRadioElements2() {
232
- return _classPrivateFieldGet(this, _$slot).assignedElements().filter(el => el.disabled !== true);
233
- }
164
+ #findSelectedOption(elements) {
165
+ return elements.find(el => el.checked) ?? null;
166
+ }
234
167
 
235
- function _findSelectedOption2(elements) {
236
- return elements.find(el => el.checked) ?? null;
237
- }
168
+ #onChangeReactHandler = e => {
169
+ getReactEventHandler(this, 'on-change')?.(e);
170
+ };
171
+ });
package/radio/types.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare type TSinchRadioElement = HTMLElement & {
9
9
  export declare type TSinchRadioReact = TSinchElementReact<TSinchRadioElement> & {
10
10
  value: string;
11
11
  'aria-label': string;
12
+ /** @deprecated */
12
13
  onChange?: (event: SyntheticEvent<TSinchRadioElement, CustomEvent<boolean>>) => void;
13
14
  'on-change'?: (e: CustomEvent<string>) => void;
14
15
  };
@@ -1,58 +1,26 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$input, _$label, _onInput;
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, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
11
- const templateHTML = '<style>:host{--sinch-color-radio-outer-circle:var(--sinch-color-transparent);--sinch-color-radio-background:var(--sinch-color-snow-100);--sinch-color-radio-border:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-checked:var(--sinch-color-transparent);--sinch-color-radio-border-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-hover:var(--sinch-color-snow-500);--sinch-color-radio-border-hover:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-hover-checked:var(--sinch-color-tropical-100);--sinch-color-radio-border-hover-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-focus:var(--sinch-color-snow-800);--sinch-color-radio-border-focus:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-focus-checked:var(--sinch-color-tropical-200);--sinch-color-radio-border-focus-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-active:var(--sinch-color-stormy-100);--sinch-color-radio-border-active:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-active-checked:var(--sinch-color-tropical-300);--sinch-color-radio-border-active-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-disabled:var(--sinch-color-transparent);--sinch-color-radio-border-disabled:var(--sinch-color-stormy-100);--sinch-color-radio-outer-circle-disabled-checked:var(--sinch-color-transparent);--sinch-color-radio-border-disabled-checked:var(--sinch-color-stormy-100);display:block;outline:0}#wrapper{display:flex;height:32px;box-sizing:border-box;width:100%}#input{all:initial;display:block;width:32px;height:32px;cursor:pointer}#input:disabled{cursor:initial}#icon-container{position:relative;width:32px;height:32px}#input::before{content:"";position:absolute;top:0;left:0;width:32px;height:32px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-outer-circle);transition:background-color .1s linear}#input::after{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-background);border:2px solid var(--sinch-color-radio-border);transition:background-color .1s linear;box-sizing:border-box}#icon-knob{position:absolute;left:11px;top:11px;width:10px;height:10px;border-radius:50%;transition:opacity .1s linear;opacity:0;background-color:var(--sinch-color-radio-border);pointer-events:none}@media (prefers-reduced-motion){#icon-knob,#input::after,#input::before{transition:none}}#label{align-self:center;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}#input:checked::before{background-color:var(--sinch-color-radio-outer-circle-checked)}#input:checked::after{border-color:var(--sinch-color-radio-border-checked)}#input:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-checked)}#input:focus::before{background-color:var(--sinch-color-radio-outer-circle-focus)}#input:focus::after{border-color:var(--sinch-color-radio-border-focus)}#input:focus~#icon-knob{background-color:var(--sinch-color-radio-border-focus)}#input:hover::before{background-color:var(--sinch-color-radio-outer-circle-hover)}#input:hover::after{border-color:var(--sinch-color-radio-border-hover)}#input:hover~#icon-knob{background-color:var(--sinch-color-radio-border-hover)}#input:active::before{background-color:var(--sinch-color-radio-outer-circle-active)}#input:active::after{border-color:var(--sinch-color-radio-border-active)}#input:active~#icon-knob{background-color:var(--sinch-color-radio-border-active)}#input:disabled::before{background-color:var(--sinch-color-radio-outer-circle-disabled)}#input:disabled::after{border-color:var(--sinch-color-radio-border-disabled)}#input:disabled~#icon-knob{background-color:var(--sinch-color-radio-border-disabled)}#input:focus:checked::before{background-color:var(--sinch-color-radio-outer-circle-focus-checked)}#input:focus:checked::after{border-color:var(--sinch-color-radio-border-focus-checked)}#input:focus:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-focus-checked)}#input:hover:checked::before{background-color:var(--sinch-color-radio-outer-circle-hover-checked)}#input:hover:checked::after{border-color:var(--sinch-color-radio-border-hover-checked)}#input:hover:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-hover-checked)}#input:active:checked::before{background-color:var(--sinch-color-radio-outer-circle-active-checked)}#input:active:checked::after{border-color:var(--sinch-color-radio-border-active-checked)}#input:active:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-active-checked)}#input:disabled:checked::before{background-color:var(--sinch-color-radio-outer-circle-disabled-checked)}#input:disabled:checked::after{border-color:var(--sinch-color-radio-border-disabled-checked)}#input:disabled:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-disabled-checked)}</style><div id="wrapper"><div id="icon-container"><input id="input" type="radio"/><div id="icon-knob"></div></div><label for="input" id="label"></label></div>';
2
+ const templateHTML = '<style>:host{--sinch-color-radio-outer-circle:var(--sinch-color-transparent);--sinch-color-radio-background:var(--sinch-color-snow-100);--sinch-color-radio-border:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-checked:var(--sinch-color-transparent);--sinch-color-radio-border-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-hover:var(--sinch-color-snow-500);--sinch-color-radio-border-hover:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-hover-checked:var(--sinch-color-tropical-100);--sinch-color-radio-border-hover-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-focus:var(--sinch-color-snow-700);--sinch-color-radio-border-focus:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-focus-checked:var(--sinch-color-tropical-200);--sinch-color-radio-border-focus-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-active:var(--sinch-color-stormy-100);--sinch-color-radio-border-active:var(--sinch-color-stormy-300);--sinch-color-radio-outer-circle-active-checked:var(--sinch-color-tropical-300);--sinch-color-radio-border-active-checked:var(--sinch-color-tropical-500);--sinch-color-radio-outer-circle-disabled:var(--sinch-color-transparent);--sinch-color-radio-border-disabled:var(--sinch-color-stormy-100);--sinch-color-radio-outer-circle-disabled-checked:var(--sinch-color-transparent);--sinch-color-radio-border-disabled-checked:var(--sinch-color-stormy-100);display:block;outline:0}#wrapper{display:flex;height:32px;box-sizing:border-box;width:100%}#input{all:initial;display:block;width:32px;height:32px;cursor:pointer}#input:disabled{cursor:initial}#icon-container{position:relative;width:32px;height:32px}#input::before{content:"";position:absolute;top:0;left:0;width:32px;height:32px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-outer-circle);transition:background-color .1s linear}#input::after{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-radio-background);border:2px solid var(--sinch-color-radio-border);transition:background-color .1s linear;box-sizing:border-box}#icon-knob{position:absolute;left:11px;top:11px;width:10px;height:10px;border-radius:50%;transition:opacity .1s linear;opacity:0;background-color:var(--sinch-color-radio-border);pointer-events:none}@media (prefers-reduced-motion){#icon-knob,#input::after,#input::before{transition:none}}#label{align-self:center;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}#input:checked::before{background-color:var(--sinch-color-radio-outer-circle-checked)}#input:checked::after{border-color:var(--sinch-color-radio-border-checked)}#input:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-checked)}#input:focus::before{background-color:var(--sinch-color-radio-outer-circle-focus)}#input:focus::after{border-color:var(--sinch-color-radio-border-focus)}#input:focus~#icon-knob{background-color:var(--sinch-color-radio-border-focus)}#input:hover::before{background-color:var(--sinch-color-radio-outer-circle-hover)}#input:hover::after{border-color:var(--sinch-color-radio-border-hover)}#input:hover~#icon-knob{background-color:var(--sinch-color-radio-border-hover)}#input:active::before{background-color:var(--sinch-color-radio-outer-circle-active)}#input:active::after{border-color:var(--sinch-color-radio-border-active)}#input:active~#icon-knob{background-color:var(--sinch-color-radio-border-active)}#input:disabled::before{background-color:var(--sinch-color-radio-outer-circle-disabled)}#input:disabled::after{border-color:var(--sinch-color-radio-border-disabled)}#input:disabled~#icon-knob{background-color:var(--sinch-color-radio-border-disabled)}#input:focus:checked::before{background-color:var(--sinch-color-radio-outer-circle-focus-checked)}#input:focus:checked::after{border-color:var(--sinch-color-radio-border-focus-checked)}#input:focus:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-focus-checked)}#input:hover:checked::before{background-color:var(--sinch-color-radio-outer-circle-hover-checked)}#input:hover:checked::after{border-color:var(--sinch-color-radio-border-hover-checked)}#input:hover:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-hover-checked)}#input:active:checked::before{background-color:var(--sinch-color-radio-outer-circle-active-checked)}#input:active:checked::after{border-color:var(--sinch-color-radio-border-active-checked)}#input:active:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-active-checked)}#input:disabled:checked::before{background-color:var(--sinch-color-radio-outer-circle-disabled-checked)}#input:disabled:checked::after{border-color:var(--sinch-color-radio-border-disabled-checked)}#input:disabled:checked~#icon-knob{opacity:1;background-color:var(--sinch-color-radio-border-disabled-checked)}</style><div id="wrapper"><div id="icon-container"><input id="input" type="radio"/><div id="icon-knob"></div></div><label for="input" id="label"></label></div>';
12
3
  const template = document.createElement('template');
13
4
  template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
5
+ defineCustomElement('sinch-radio-option', class extends NectaryElement {
6
+ #$input;
7
+ #$label;
8
+
15
9
  constructor() {
16
10
  super();
17
-
18
- _classPrivateFieldInitSpec(this, _$input, {
19
- writable: true,
20
- value: void 0
21
- });
22
-
23
- _classPrivateFieldInitSpec(this, _$label, {
24
- writable: true,
25
- value: void 0
26
- });
27
-
28
- _classPrivateFieldInitSpec(this, _onInput, {
29
- writable: true,
30
- value: e => {
31
- e.stopPropagation();
32
- _classPrivateFieldGet(this, _$input).checked = false;
33
- this.dispatchEvent(new CustomEvent('option-change', {
34
- bubbles: true,
35
- detail: this.value
36
- }));
37
- }
38
- });
39
-
40
11
  const shadowRoot = this.attachShadow();
41
12
  shadowRoot.appendChild(template.content.cloneNode(true));
42
-
43
- _classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));
44
-
45
- _classPrivateFieldSet(this, _$label, shadowRoot.querySelector('label'));
13
+ this.#$input = shadowRoot.querySelector('input');
14
+ this.#$label = shadowRoot.querySelector('label');
46
15
  }
47
16
 
48
17
  connectedCallback() {
49
18
  this.setAttribute('role', 'radio');
50
-
51
- _classPrivateFieldGet(this, _$input).addEventListener('input', _classPrivateFieldGet(this, _onInput));
19
+ this.#$input.addEventListener('input', this.#onInput);
52
20
  }
53
21
 
54
22
  disconnectedCallback() {
55
- _classPrivateFieldGet(this, _$input).removeEventListener('input', _classPrivateFieldGet(this, _onInput));
23
+ this.#$input.removeEventListener('input', this.#onInput);
56
24
  }
57
25
 
58
26
  static get observedAttributes() {
@@ -95,13 +63,13 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
95
63
  switch (name) {
96
64
  case 'text':
97
65
  {
98
- _classPrivateFieldGet(this, _$label).textContent = newVal;
66
+ this.#$label.textContent = newVal;
99
67
  break;
100
68
  }
101
69
 
102
70
  case 'checked':
103
71
  {
104
- _classPrivateFieldGet(this, _$input).checked = isAttrTrue(newVal);
72
+ this.#$input.checked = isAttrTrue(newVal);
105
73
  updateAttribute(this, 'aria-checked', isAttrTrue(newVal));
106
74
  break;
107
75
  }
@@ -109,25 +77,33 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
109
77
  case 'disabled':
110
78
  {
111
79
  const isDisabled = isAttrTrue(newVal);
112
- _classPrivateFieldGet(this, _$input).disabled = isDisabled;
80
+ this.#$input.disabled = isDisabled;
113
81
  updateBooleanAttribute(this, 'disabled', isDisabled);
114
82
  break;
115
83
  }
116
84
 
117
85
  case 'value':
118
86
  {
119
- _classPrivateFieldGet(this, _$input).value = newVal ?? '';
87
+ this.#$input.value = newVal ?? '';
120
88
  break;
121
89
  }
122
90
  }
123
91
  }
124
92
 
125
93
  focus() {
126
- _classPrivateFieldGet(this, _$input).focus();
94
+ this.#$input.focus();
127
95
  }
128
96
 
129
97
  blur() {
130
- _classPrivateFieldGet(this, _$input).blur();
98
+ this.#$input.blur();
131
99
  }
132
100
 
133
- }));
101
+ #onInput = e => {
102
+ e.stopPropagation();
103
+ this.#$input.checked = false;
104
+ this.dispatchEvent(new CustomEvent('option-change', {
105
+ bubbles: true,
106
+ detail: this.value
107
+ }));
108
+ };
109
+ });