@nectary/components 0.34.0 → 0.36.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 (105) hide show
  1. package/accordion/index.js +35 -10
  2. package/accordion/types.d.ts +3 -2
  3. package/accordion-item/index.js +8 -4
  4. package/action-menu/index.js +7 -8
  5. package/action-menu/types.d.ts +3 -3
  6. package/action-menu-option/index.js +23 -3
  7. package/action-menu-option/types.d.ts +2 -0
  8. package/alert/index.d.ts +4 -0
  9. package/alert/index.js +17 -32
  10. package/alert/types.d.ts +1 -7
  11. package/alert/utils.d.ts +3 -0
  12. package/alert/utils.js +6 -1
  13. package/avatar/index.js +1 -1
  14. package/button/index.js +69 -5
  15. package/button/types.d.ts +6 -0
  16. package/checkbox/index.js +64 -6
  17. package/checkbox/types.d.ts +8 -2
  18. package/date-picker/index.js +37 -12
  19. package/date-picker/types.d.ts +4 -2
  20. package/dialog/index.js +5 -6
  21. package/dialog/types.d.ts +3 -3
  22. package/dropdown/index.js +44 -28
  23. package/dropdown/types.d.ts +6 -4
  24. package/dropdown-checkbox-option/index.js +1 -1
  25. package/dropdown-checkbox-option/types.d.ts +0 -2
  26. package/dropdown-radio-option/index.js +1 -1
  27. package/dropdown-radio-option/types.d.ts +0 -2
  28. package/dropdown-text-option/index.js +1 -1
  29. package/dropdown-text-option/types.d.ts +0 -2
  30. package/horizontal-stepper/types.d.ts +4 -0
  31. package/horizontal-stepper-item/index.js +1 -1
  32. package/horizontal-stepper-item/types.d.ts +9 -0
  33. package/icon-button/index.js +75 -5
  34. package/icon-button/types.d.ts +6 -0
  35. package/icons/create-icon-class.js +1 -1
  36. package/icons-branded/create-icon-class.js +3 -7
  37. package/icons-branded/types.d.ts +3 -0
  38. package/icons-channel/create-icon-class.js +3 -7
  39. package/icons-channel/types.d.ts +3 -0
  40. package/inline-alert/index.d.ts +17 -0
  41. package/inline-alert/index.js +154 -0
  42. package/inline-alert/types.d.ts +15 -0
  43. package/inline-alert/utils.d.ts +5 -0
  44. package/inline-alert/utils.js +6 -0
  45. package/input/index.d.ts +0 -1
  46. package/input/index.js +58 -5
  47. package/input/types.d.ts +8 -2
  48. package/link/index.js +81 -3
  49. package/link/types.d.ts +9 -0
  50. package/package.json +1 -1
  51. package/pagination/index.js +24 -8
  52. package/pagination/types.d.ts +3 -1
  53. package/popover/index.js +5 -6
  54. package/popover/types.d.ts +4 -3
  55. package/radio/index.js +36 -8
  56. package/radio/types.d.ts +3 -1
  57. package/radio-option/index.js +1 -1
  58. package/search/types.d.ts +0 -1
  59. package/segment-collapse/index.js +28 -12
  60. package/segment-collapse/types.d.ts +3 -1
  61. package/segmented-control/index.js +28 -23
  62. package/segmented-control/types.d.ts +3 -2
  63. package/segmented-control-option/index.js +59 -13
  64. package/segmented-control-option/types.d.ts +4 -0
  65. package/segmented-icon-control/index.js +27 -16
  66. package/segmented-icon-control/types.d.ts +5 -2
  67. package/segmented-icon-control-option/index.js +54 -12
  68. package/segmented-icon-control-option/types.d.ts +4 -0
  69. package/select/index.js +68 -9
  70. package/select/types.d.ts +8 -2
  71. package/tabs/index.js +32 -8
  72. package/tabs/types.d.ts +3 -2
  73. package/tabs-option/index.js +2 -2
  74. package/text/index.js +1 -1
  75. package/textarea/index.js +58 -4
  76. package/textarea/types.d.ts +7 -2
  77. package/tile-control/index.d.ts +11 -0
  78. package/tile-control/index.js +181 -0
  79. package/tile-control/types.d.ts +38 -0
  80. package/tile-control/types.js +1 -0
  81. package/tile-control-option/index.d.ts +11 -0
  82. package/tile-control-option/index.js +161 -0
  83. package/tile-control-option/types.d.ts +37 -0
  84. package/time-picker/index.js +18 -4
  85. package/time-picker/types.d.ts +4 -2
  86. package/toggle/index.js +63 -5
  87. package/toggle/types.d.ts +3 -1
  88. package/vertical-stepper/index.d.ts +13 -0
  89. package/vertical-stepper/index.js +95 -0
  90. package/vertical-stepper/types.d.ts +13 -0
  91. package/vertical-stepper/types.js +1 -0
  92. package/vertical-stepper-item/index.d.ts +13 -0
  93. package/vertical-stepper-item/index.js +100 -0
  94. package/vertical-stepper-item/types.d.ts +24 -0
  95. package/vertical-stepper-item/types.js +1 -0
  96. package/vertical-stepper-item/utils.d.ts +2 -0
  97. package/vertical-stepper-item/utils.js +1 -0
  98. package/alert-button/index.d.ts +0 -11
  99. package/alert-button/index.js +0 -59
  100. package/alert-button/types.d.ts +0 -8
  101. package/alert-close/index.d.ts +0 -12
  102. package/alert-close/index.js +0 -38
  103. package/alert-close/types.d.ts +0 -3
  104. /package/{alert-button → inline-alert}/types.js +0 -0
  105. /package/{alert-close → tile-control-option}/types.js +0 -0
package/input/index.js CHANGED
@@ -1,19 +1,18 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$input, _$label, _$optionalText, _$additionalText, _$invalidText, _$iconSlot, _$iconWrapper, _$rightSlot, _$rightWrapper, _cursorPos, _isPendingDk, _onCompositionStart, _onSelectionChange, _onInput, _onIconSlotChange, _onRightSlotChange;
4
+ var _$input, _$label, _$optionalText, _$additionalText, _$invalidText, _$iconSlot, _$iconWrapper, _$rightSlot, _$rightWrapper, _cursorPos, _isPendingDk, _onCompositionStart, _onSelectionChange, _onInput, _onIconSlotChange, _onRightSlotChange, _onInputFocus, _onInputBlur, _onChangeReactHandler, _onFocusReactHandler, _onBlurReactHandler;
5
5
 
6
6
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
7
 
8
8
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
9
 
10
- import '../stop-events';
11
- import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateLiteralAttribute } from '../utils';
12
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input-wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;height:48px;background-color:var(--sinch-color-snow-100)}#input{all:initial;flex:1;min-width:0;height:48px;padding:0 12px 0 44px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto)}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#border{position:absolute;border:1px solid var(--sinch-color-stormy-200);border-radius:var(--sinch-shape-radius-s);left:0;right:0;top:0;bottom:0;pointer-events:none}:host([invalidtext]:not([invalidtext=""]):not([disabled])) #border{border-color:var(--sinch-color-text-invalid)}#input:disabled{color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:disabled+#border{border-color:var(--sinch-color-snow-500)}#input:focus+#border{border-color:var(--sinch-color-stormy-600)}#input[type=password]{font-size:1.5em;letter-spacing:.1em}#bottom,#top{display:flex;align-items:baseline}#top{height:24px;margin-bottom:2px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted);line-height:20px;margin-top:2px}#additional:empty{display:none}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid);line-height:20px;margin-top:2px}#invalid:empty{display:none}#icon{position:absolute;left:12px;top:12px;pointer-events:none;--sinch-icon-size:24px}#icon.empty{display:none}#icon.empty~#input{padding-left:12px}#right{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-right:8px}#right.empty{display:none}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><div id="input-wrapper"><div id="icon"><slot name="icon"></slot></div><input id="input" type="text"/><div id="border"></div><div id="right"><sinch-stop-events events="input,change,focusin,focusout"><slot name="right"></slot></sinch-stop-events></div></div><div id="bottom"><div id="invalid"></div><div id="additional"></div></div></div>';
10
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateLiteralAttribute } from '../utils';
11
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input-wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;height:48px;background-color:var(--sinch-color-snow-100)}#input{all:initial;flex:1;min-width:0;height:48px;padding:0 12px 0 44px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto)}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#border{position:absolute;border:1px solid var(--sinch-color-stormy-200);border-radius:var(--sinch-shape-radius-s);left:0;right:0;top:0;bottom:0;pointer-events:none}:host([invalidtext]:not([invalidtext=""]):not([disabled])) #border{border-color:var(--sinch-color-text-invalid)}#input:disabled{color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:disabled+#border{border-color:var(--sinch-color-snow-500)}#input:focus+#border{border-color:var(--sinch-color-stormy-600)}#input[type=password]{font-size:1.5em;letter-spacing:.1em}#bottom,#top{display:flex;align-items:baseline}#top{height:24px;margin-bottom:2px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted);line-height:20px;margin-top:2px}#additional:empty{display:none}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid);line-height:20px;margin-top:2px}#invalid:empty{display:none}#icon{position:absolute;left:12px;top:12px;pointer-events:none;--sinch-icon-size:24px}#icon.empty{display:none}#icon.empty~#input{padding-left:12px}#right{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;padding-right:8px}#right.empty{display:none}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><div id="input-wrapper"><div id="icon"><slot name="icon"></slot></div><input id="input" type="text"/><div id="border"></div><div id="right"><slot name="right"></slot></div></div><div id="bottom"><div id="invalid"></div><div id="additional"></div></div></div>';
13
12
  import { inputTypes } from './utils';
14
13
  const template = document.createElement('template');
15
14
  template.innerHTML = templateHTML;
16
- defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$iconSlot = new WeakMap(), _$iconWrapper = new WeakMap(), _$rightSlot = new WeakMap(), _$rightWrapper = new WeakMap(), _cursorPos = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onSelectionChange = new WeakMap(), _onInput = new WeakMap(), _onIconSlotChange = new WeakMap(), _onRightSlotChange = new WeakMap(), class extends NectaryElement {
15
+ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$iconSlot = new WeakMap(), _$iconWrapper = new WeakMap(), _$rightSlot = new WeakMap(), _$rightWrapper = new WeakMap(), _cursorPos = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onSelectionChange = new WeakMap(), _onInput = new WeakMap(), _onIconSlotChange = new WeakMap(), _onRightSlotChange = new WeakMap(), _onInputFocus = new WeakMap(), _onInputBlur = new WeakMap(), _onChangeReactHandler = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), class extends NectaryElement {
17
16
  constructor() {
18
17
  super();
19
18
 
@@ -118,6 +117,9 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
118
117
  detail: nextValue,
119
118
  bubbles: true
120
119
  }));
120
+ this.dispatchEvent(new CustomEvent('-change', {
121
+ detail: nextValue
122
+ }));
121
123
  }
122
124
  }
123
125
  });
@@ -136,6 +138,41 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
136
138
  }
137
139
  });
138
140
 
141
+ _classPrivateFieldInitSpec(this, _onInputFocus, {
142
+ writable: true,
143
+ value: () => {
144
+ this.dispatchEvent(new CustomEvent('-focus'));
145
+ }
146
+ });
147
+
148
+ _classPrivateFieldInitSpec(this, _onInputBlur, {
149
+ writable: true,
150
+ value: () => {
151
+ this.dispatchEvent(new CustomEvent('-blur'));
152
+ }
153
+ });
154
+
155
+ _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
156
+ writable: true,
157
+ value: e => {
158
+ getReactEventHandler(this, 'on-change')?.(e);
159
+ }
160
+ });
161
+
162
+ _classPrivateFieldInitSpec(this, _onFocusReactHandler, {
163
+ writable: true,
164
+ value: () => {
165
+ getReactEventHandler(this, 'on-focus')?.();
166
+ }
167
+ });
168
+
169
+ _classPrivateFieldInitSpec(this, _onBlurReactHandler, {
170
+ writable: true,
171
+ value: () => {
172
+ getReactEventHandler(this, 'on-blur')?.();
173
+ }
174
+ });
175
+
139
176
  const shadowRoot = this.attachShadow();
140
177
  shadowRoot.appendChild(template.content.cloneNode(true));
141
178
 
@@ -169,10 +206,18 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
169
206
 
170
207
  _classPrivateFieldGet(this, _$input).addEventListener('keydown', _classPrivateFieldGet(this, _onSelectionChange));
171
208
 
209
+ _classPrivateFieldGet(this, _$input).addEventListener('focus', _classPrivateFieldGet(this, _onInputFocus));
210
+
211
+ _classPrivateFieldGet(this, _$input).addEventListener('blur', _classPrivateFieldGet(this, _onInputBlur));
212
+
172
213
  _classPrivateFieldGet(this, _$iconSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onIconSlotChange));
173
214
 
174
215
  _classPrivateFieldGet(this, _$rightSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onRightSlotChange));
175
216
 
217
+ this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
218
+ this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
219
+ this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
220
+
176
221
  _classPrivateFieldGet(this, _onIconSlotChange).call(this);
177
222
 
178
223
  _classPrivateFieldGet(this, _onRightSlotChange).call(this);
@@ -187,9 +232,17 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
187
232
 
188
233
  _classPrivateFieldGet(this, _$input).removeEventListener('keydown', _classPrivateFieldGet(this, _onSelectionChange));
189
234
 
235
+ _classPrivateFieldGet(this, _$input).removeEventListener('focus', _classPrivateFieldGet(this, _onInputFocus));
236
+
237
+ _classPrivateFieldGet(this, _$input).removeEventListener('blur', _classPrivateFieldGet(this, _onInputBlur));
238
+
190
239
  _classPrivateFieldGet(this, _$iconSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onIconSlotChange));
191
240
 
192
241
  _classPrivateFieldGet(this, _$rightSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onRightSlotChange));
242
+
243
+ this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
244
+ this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
245
+ this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
193
246
  }
194
247
 
195
248
  static get observedAttributes() {
package/input/types.d.ts CHANGED
@@ -22,7 +22,9 @@ export declare type TSinchInputElement = HTMLElement & {
22
22
  selectionEnd: number | null;
23
23
  selectionDirection: 'forward' | 'backward' | 'none' | null;
24
24
  /** Change value event */
25
- addEventListener(type: 'change', listener: (e: CustomEvent<string>) => void): void;
25
+ addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
26
+ addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
27
+ addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
26
28
  /** Text field type, `text` by default */
27
29
  setAttribute(name: 'type', value: TSinchInputType): void;
28
30
  /** Value */
@@ -59,6 +61,10 @@ export declare type TSinchInputReact = TSinchElementReact<TSinchInputElement> &
59
61
  invalidText?: string;
60
62
  /** Disabled */
61
63
  disabled?: boolean;
64
+ /** @deprecated Change value handler */
65
+ onChange?: (e: SyntheticEvent<TSinchInputElement, CustomEvent<string>>) => void;
62
66
  /** Change value handler */
63
- onChange: (e: SyntheticEvent<TSinchInputElement, CustomEvent<string>>) => void;
67
+ 'on-change'?: (e: CustomEvent<string>) => void;
68
+ 'on-focus'?: (e: CustomEvent<void>) => void;
69
+ 'on-blur'?: (e: CustomEvent<void>) => void;
64
70
  };
package/link/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$anchor, _$text;
4
+ var _$anchor, _$text, _onAnchorClick, _onAnchorFocus, _onAnchorBlur, _onFocusReactHandler, _onBlurReactHandler, _onClickReactHandler;
5
5
 
6
6
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
7
 
8
8
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
9
 
10
10
  import '../icons/open-in-new';
11
- import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue } from '../utils';
11
+ import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue, getReactEventHandler } from '../utils';
12
12
  const templateHTML = '<style>:host{display:inline;outline:0}a{font:var(--sinch-font-body);font-size:inherit;line-height:inherit;color:var(--sinch-color-text-link);fill:var(--sinch-color-text-link);--sinch-size-icon:1em}#icon{display:none;margin-left:.2em;vertical-align:-.25em}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-200);pointer-events:none;cursor:initial;fill:var(--sinch-color-tropical-200)}:host([external]:not([external=false])) #icon{display:inline-block}</style><a><span id="content"></span><sinch-icon-open-in-new id="icon"></sinch-icon-open-in-new></a>';
13
13
  const template = document.createElement('template');
14
14
  template.innerHTML = templateHTML;
15
- defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), class extends NectaryElement {
15
+ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), _onAnchorClick = new WeakMap(), _onAnchorFocus = new WeakMap(), _onAnchorBlur = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), _onClickReactHandler = new WeakMap(), class extends NectaryElement {
16
16
  constructor() {
17
17
  super();
18
18
 
@@ -26,6 +26,52 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
26
26
  value: void 0
27
27
  });
28
28
 
29
+ _classPrivateFieldInitSpec(this, _onAnchorClick, {
30
+ writable: true,
31
+ value: e => {
32
+ if (this.preventDefault) {
33
+ e.preventDefault();
34
+ }
35
+
36
+ this.dispatchEvent(new CustomEvent('-click'));
37
+ }
38
+ });
39
+
40
+ _classPrivateFieldInitSpec(this, _onAnchorFocus, {
41
+ writable: true,
42
+ value: () => {
43
+ this.dispatchEvent(new CustomEvent('-focus'));
44
+ }
45
+ });
46
+
47
+ _classPrivateFieldInitSpec(this, _onAnchorBlur, {
48
+ writable: true,
49
+ value: () => {
50
+ this.dispatchEvent(new CustomEvent('-blur'));
51
+ }
52
+ });
53
+
54
+ _classPrivateFieldInitSpec(this, _onFocusReactHandler, {
55
+ writable: true,
56
+ value: () => {
57
+ getReactEventHandler(this, 'on-focus')?.();
58
+ }
59
+ });
60
+
61
+ _classPrivateFieldInitSpec(this, _onBlurReactHandler, {
62
+ writable: true,
63
+ value: () => {
64
+ getReactEventHandler(this, 'on-blur')?.();
65
+ }
66
+ });
67
+
68
+ _classPrivateFieldInitSpec(this, _onClickReactHandler, {
69
+ writable: true,
70
+ value: e => {
71
+ getReactEventHandler(this, 'on-click')?.(e);
72
+ }
73
+ });
74
+
29
75
  const shadowRoot = this.attachShadow();
30
76
  shadowRoot.appendChild(template.content.cloneNode(true));
31
77
 
@@ -34,6 +80,30 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
34
80
  _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#content'));
35
81
  }
36
82
 
83
+ connectedCallback() {
84
+ _classPrivateFieldGet(this, _$anchor).addEventListener('click', _classPrivateFieldGet(this, _onAnchorClick));
85
+
86
+ _classPrivateFieldGet(this, _$anchor).addEventListener('focus', _classPrivateFieldGet(this, _onAnchorFocus));
87
+
88
+ _classPrivateFieldGet(this, _$anchor).addEventListener('blur', _classPrivateFieldGet(this, _onAnchorBlur));
89
+
90
+ this.addEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
91
+ this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
92
+ this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
93
+ }
94
+
95
+ disconnectedCallback() {
96
+ _classPrivateFieldGet(this, _$anchor).removeEventListener('click', _classPrivateFieldGet(this, _onAnchorClick));
97
+
98
+ _classPrivateFieldGet(this, _$anchor).removeEventListener('focus', _classPrivateFieldGet(this, _onAnchorFocus));
99
+
100
+ _classPrivateFieldGet(this, _$anchor).removeEventListener('blur', _classPrivateFieldGet(this, _onAnchorBlur));
101
+
102
+ this.removeEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
103
+ this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
104
+ this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
105
+ }
106
+
37
107
  get text() {
38
108
  return getAttribute(this, 'text', '');
39
109
  }
@@ -66,6 +136,14 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
66
136
  return getBooleanAttribute(this, 'external');
67
137
  }
68
138
 
139
+ set preventDefault(isPrevented) {
140
+ updateBooleanAttribute(this, 'preventdefault', isPrevented);
141
+ }
142
+
143
+ get preventDefault() {
144
+ return getBooleanAttribute(this, 'preventdefault');
145
+ }
146
+
69
147
  static get observedAttributes() {
70
148
  return ['text', 'href', 'external', 'disabled'];
71
149
  }
package/link/types.d.ts CHANGED
@@ -4,14 +4,23 @@ export declare type TSinchLinkElement = HTMLElement & {
4
4
  href: string;
5
5
  disabled: boolean;
6
6
  external: boolean;
7
+ preventDefault: boolean;
8
+ addEventListener(type: '-click', listener: (e: CustomEvent<void>) => void): void;
9
+ addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
10
+ addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
7
11
  setAttribute(name: 'text', value: string): void;
8
12
  setAttribute(name: 'href', value: string): void;
9
13
  setAttribute(name: 'disabled', value: ''): void;
10
14
  setAttribute(name: 'external', value: ''): void;
15
+ setAttribute(name: 'preventdefault', value: ''): void;
11
16
  };
12
17
  export declare type TSinchLinkReact = TSinchElementReact<TSinchLinkElement> & {
13
18
  text: string;
14
19
  href: string;
15
20
  disabled?: boolean;
16
21
  external?: boolean;
22
+ preventDefault?: boolean;
23
+ 'on-click'?: (e: CustomEvent<void>) => void;
24
+ 'on-focus'?: (e: CustomEvent<void>) => void;
25
+ 'on-blur'?: (e: CustomEvent<void>) => void;
17
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "files": [
5
5
  "theme.css",
6
6
  "**/*/*.js",
@@ -1,7 +1,7 @@
1
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
2
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$left, _$right, _$buttons, _$wrapper, _onValueChange, _onButtonClick, _clamp, _dispatchChangeEvent;
4
+ var _$left, _$right, _$buttons, _$wrapper, _onValueChange, _onButtonClick, _clamp, _dispatchChangeEvent, _onChangeReactHandler;
5
5
 
6
6
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
7
 
@@ -13,8 +13,8 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
13
13
 
14
14
  import '../icons/keyboard-arrow-left';
15
15
  import '../icons/keyboard-arrow-right';
16
- import { defineCustomElement, updateAttribute, getIntegerAttribute, setClass, NectaryElement, getRect } from '../utils';
17
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;justify-content:center;gap:8px;width:100%;box-sizing:border-box}button{all:initial;width:28px;height:28px;box-sizing:border-box;cursor:pointer;text-align:center;contain:strict;--sinch-color-icon:var(--sinch-color-stormy-500)}button:disabled{--sinch-color-icon:var(--sinch-color-stormy-100);cursor:initial}button>*{pointer-events:none}.page{border-radius:50%;font:var(--sinch-font-body);color:var(--sinch-color-stormy-500)}.page.dots>span{display:none}.page.dots::after{content:"..."}.page.active{font:var(--sinch-font-emphasized-body);background-color:var(--sinch-color-snow-600);pointer-events:none;cursor:initial}.page.hidden{display:none}</style><div id="wrapper"><button id="left"><sinch-icon-keyboard-arrow-left></sinch-icon-keyboard-arrow-left></button> <button class="page"><span>1</span></button> <button class="page active"><span>2</span></button> <button class="page"><span>3</span></button> <button class="page"><span>4</span></button> <button class="page"><span>5</span></button> <button class="page dots"><span>6</span></button> <button class="page"><span>20</span></button> <button id="right"><sinch-icon-keyboard-arrow-right></sinch-icon-keyboard-arrow-right></button></div>';
16
+ import { defineCustomElement, updateAttribute, getIntegerAttribute, setClass, NectaryElement, getRect, getReactEventHandler } from '../utils';
17
+ const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;justify-content:center;gap:8px;width:100%;box-sizing:border-box}button{all:initial;width:28px;height:28px;box-sizing:border-box;cursor:pointer;text-align:center;contain:strict;--sinch-color-icon:var(--sinch-color-stormy-500)}button:disabled{--sinch-color-icon:var(--sinch-color-stormy-100);cursor:initial}button>*{pointer-events:none}.page{border-radius:50%;font:var(--sinch-font-body);color:var(--sinch-color-stormy-500)}.page.dots>span{display:none}.page.dots::after{content:"..."}.page.active{font:var(--sinch-font-emphasized-body);background-color:var(--sinch-color-snow-600);pointer-events:none;cursor:initial}.page.hidden{display:none}</style><div id="wrapper"><button id="left"><sinch-icon-keyboard-arrow-left></sinch-icon-keyboard-arrow-left></button><button class="page"><span>1</span></button><button class="page active"><span>2</span></button><button class="page"><span>3</span></button><button class="page"><span>4</span></button><button class="page"><span>5</span></button><button class="page dots"><span>6</span></button><button class="page"><span>20</span></button><button id="right"><sinch-icon-keyboard-arrow-right></sinch-icon-keyboard-arrow-right></button></div>';
18
18
  const NUM_BUTTONS = 7;
19
19
  const MIDDLE_BTN_INDEX = Math.floor(NUM_BUTTONS / 2);
20
20
  const FIRST_BTN_INDEX = 0;
@@ -23,7 +23,7 @@ const DOTS_LEFT_INDEX = 1;
23
23
  const DOTS_RIGHT_INDEX = LAST_BTN_INDEX - 1;
24
24
  const template = document.createElement('template');
25
25
  template.innerHTML = templateHTML;
26
- defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new WeakMap(), _$buttons = new WeakMap(), _$wrapper = new WeakMap(), _onValueChange = new WeakSet(), _onButtonClick = new WeakMap(), _clamp = new WeakSet(), _dispatchChangeEvent = new WeakSet(), class extends NectaryElement {
26
+ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new WeakMap(), _$buttons = new WeakMap(), _$wrapper = new WeakMap(), _onValueChange = new WeakSet(), _onButtonClick = new WeakMap(), _clamp = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _onChangeReactHandler = new WeakMap(), class extends NectaryElement {
27
27
  constructor() {
28
28
  super();
29
29
 
@@ -92,6 +92,13 @@ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new W
92
92
  }
93
93
  });
94
94
 
95
+ _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
96
+ writable: true,
97
+ value: e => {
98
+ getReactEventHandler(this, 'on-change')?.(e);
99
+ }
100
+ });
101
+
95
102
  const shadowRoot = this.attachShadow();
96
103
  shadowRoot.appendChild(template.content.cloneNode(true));
97
104
 
@@ -108,10 +115,14 @@ defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new W
108
115
  _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
109
116
 
110
117
  _classPrivateFieldGet(this, _$wrapper).addEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
118
+
119
+ this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
111
120
  }
112
121
 
113
122
  disconnectedCallback() {
114
123
  _classPrivateFieldGet(this, _$wrapper).removeEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
124
+
125
+ this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
115
126
  }
116
127
 
117
128
  static get observedAttributes() {
@@ -217,14 +228,19 @@ function _onValueChange2() {
217
228
  _classPrivateFieldGet(this, _$right).disabled = isValueBad || value === max - 1;
218
229
  }
219
230
 
220
- function _clamp2(value, max) {
221
- return Math.max(0, Math.min(max - 1, value));
231
+ function _clamp2(value) {
232
+ const max = getIntegerAttribute(this, 'max', 0);
233
+ return Math.max(0, Math.min(max - 1, value)) + 1;
222
234
  }
223
235
 
224
236
  function _dispatchChangeEvent2(value) {
225
- const max = getIntegerAttribute(this, 'max', 0);
237
+ const detail = _classPrivateMethodGet(this, _clamp, _clamp2).call(this, value);
238
+
226
239
  this.dispatchEvent(new CustomEvent('change', {
227
- detail: _classPrivateMethodGet(this, _clamp, _clamp2).call(this, value, max) + 1,
240
+ detail,
228
241
  bubbles: true
229
242
  }));
243
+ this.dispatchEvent(new CustomEvent('-change', {
244
+ detail
245
+ }));
230
246
  }
@@ -7,11 +7,13 @@ export declare type TSinchPaginationElement = HTMLElement & {
7
7
  readonly nextButtonRect: TRect;
8
8
  nthButtonRect(index: number): TRect | null;
9
9
  addEventListener(type: 'change', listener: (e: CustomEvent<number>) => void): void;
10
+ addEventListener(type: '-change', listener: (e: CustomEvent<number>) => void): void;
10
11
  setAttribute(name: 'value', value: string): void;
11
12
  setAttribute(name: 'max', value: string): void;
12
13
  };
13
14
  export declare type TSinchPaginationReact = TSinchElementReact<TSinchPaginationElement> & {
14
15
  value: number;
15
16
  max: number;
16
- onChange: (event: SyntheticEvent<TSinchPaginationElement, CustomEvent<number>>) => void;
17
+ onChange?: (event: SyntheticEvent<TSinchPaginationElement, CustomEvent<number>>) => void;
18
+ 'on-change': (e: CustomEvent<number>) => void;
17
19
  };
package/popover/index.js CHANGED
@@ -159,8 +159,9 @@ defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new W
159
159
 
160
160
  _classPrivateFieldInitSpec(this, _onCloseReactHandler, {
161
161
  writable: true,
162
- value: () => {
162
+ value: e => {
163
163
  getReactEventHandler(this, 'onClose')?.();
164
+ getReactEventHandler(this, 'on-close')?.(e);
164
165
  }
165
166
  });
166
167
 
@@ -201,7 +202,7 @@ defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new W
201
202
 
202
203
  _classPrivateFieldGet(this, _$dialog).addEventListener('mousedown', _classPrivateFieldGet(this, _onBackdropMouseDown));
203
204
 
204
- this.addEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
205
+ this.addEventListener('-close', _classPrivateFieldGet(this, _onCloseReactHandler));
205
206
 
206
207
  _classPrivateFieldSet(this, _isConnected, true);
207
208
 
@@ -217,7 +218,7 @@ defineCustomElement('sinch-popover', (_$target = new WeakMap(), _$dialog = new W
217
218
 
218
219
  _classPrivateFieldGet(this, _$dialog).removeEventListener('mousedown', _classPrivateFieldGet(this, _onBackdropMouseDown));
219
220
 
220
- this.removeEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
221
+ this.removeEventListener('-close', _classPrivateFieldGet(this, _onCloseReactHandler));
221
222
 
222
223
  _classPrivateMethodGet(this, _onCollapse, _onCollapse2).call(this);
223
224
 
@@ -356,7 +357,5 @@ function _isOpen2() {
356
357
  }
357
358
 
358
359
  function _dispatchCloseEvent2() {
359
- this.dispatchEvent(new CustomEvent('close', {
360
- bubbles: true
361
- }));
360
+ this.dispatchEvent(new CustomEvent('-close'));
362
361
  }
@@ -1,5 +1,4 @@
1
1
  import type { TRect, TSinchElementReact } from '../types';
2
- import type { SyntheticEvent } from 'react';
3
2
  export declare type TSinchPopoverOrientation = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'bottom' | 'top';
4
3
  export declare type TSinchPopoverElement = HTMLElement & {
5
4
  /** Open/close state */
@@ -10,7 +9,7 @@ export declare type TSinchPopoverElement = HTMLElement & {
10
9
  modal: boolean;
11
10
  readonly popoverRect: TRect;
12
11
  /** Close event */
13
- addEventListener(type: 'close', listener: (e: CustomEvent<void>) => void): void;
12
+ addEventListener(type: '-close', listener: (e: CustomEvent<void>) => void): void;
14
13
  /** Open/close state */
15
14
  setAttribute(name: 'open', value: ''): void;
16
15
  /** Orientation, where it *points to* from origin */
@@ -28,5 +27,7 @@ export declare type TSinchPopoverReact = TSinchElementReact<TSinchPopoverElement
28
27
  /** Label that is used for a11y */
29
28
  'aria-label': string;
30
29
  /** Close event handler */
31
- onClose?: (event: SyntheticEvent<TSinchPopoverElement, CustomEvent<void>>) => void;
30
+ onClose?: () => void;
31
+ /** Close event handler */
32
+ 'on-close'?: (e: CustomEvent<void>) => void;
32
33
  };
package/radio/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
2
1
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
+ import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
3
 
4
- var _$slot, _onOptionKeyDown, _onSlotChange, _onOptionChange, _onValueChange, _dispatchChangeEvent, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _getEnabledRadioElements, _findSelectedOption;
4
+ var _$slot, _onOptionKeyDown, _onSlotChange, _onOptionChange, _onValueChange, _dispatchChangeEvent, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _getEnabledRadioElements, _findSelectedOption, _onChangeReactHandler;
5
5
 
6
6
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
7
 
@@ -11,11 +11,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
11
11
 
12
12
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
13
13
 
14
- import { defineCustomElement, getAttribute, getBooleanAttribute, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
14
+ import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
15
15
  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
16
  const template = document.createElement('template');
17
17
  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(), class extends NectaryElement {
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 {
19
19
  constructor() {
20
20
  super();
21
21
 
@@ -95,18 +95,39 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
95
95
  }
96
96
  });
97
97
 
98
+ _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
99
+ writable: true,
100
+ value: e => {
101
+ getReactEventHandler(this, 'on-change')?.(e);
102
+ }
103
+ });
104
+
98
105
  const shadowRoot = this.attachShadow();
99
106
  shadowRoot.appendChild(template.content.cloneNode(true));
100
- shadowRoot.addEventListener('keydown', _classPrivateFieldGet(this, _onOptionKeyDown));
101
- shadowRoot.addEventListener('change', _classPrivateFieldGet(this, _onOptionChange));
102
107
 
103
108
  _classPrivateFieldSet(this, _$slot, shadowRoot.querySelector('slot'));
104
-
105
- _classPrivateFieldGet(this, _$slot).addEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
106
109
  }
107
110
 
108
111
  connectedCallback() {
109
112
  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));
121
+ }
122
+
123
+ 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));
110
131
  }
111
132
 
112
133
  static get observedAttributes() {
@@ -126,6 +147,10 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
126
147
  }
127
148
 
128
149
  attributeChangedCallback(name, oldVal, newVal) {
150
+ if (oldVal === newVal) {
151
+ return;
152
+ }
153
+
129
154
  switch (name) {
130
155
  case 'value':
131
156
  {
@@ -150,6 +175,9 @@ function _dispatchChangeEvent2(value) {
150
175
  detail: value,
151
176
  bubbles: true
152
177
  }));
178
+ this.dispatchEvent(new CustomEvent('-change', {
179
+ detail: value
180
+ }));
153
181
  }
154
182
 
155
183
  function _getFirstOption2() {
package/radio/types.d.ts CHANGED
@@ -3,10 +3,12 @@ import type { SyntheticEvent } from 'react';
3
3
  export declare type TSinchRadioElement = HTMLElement & {
4
4
  value: string;
5
5
  addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
6
+ addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
6
7
  setAttribute(name: 'value', value: string): void;
7
8
  };
8
9
  export declare type TSinchRadioReact = TSinchElementReact<TSinchRadioElement> & {
9
10
  value: string;
10
11
  'aria-label': string;
11
- onChange: (event: SyntheticEvent<TSinchRadioElement, CustomEvent<boolean>>) => void;
12
+ onChange?: (event: SyntheticEvent<TSinchRadioElement, CustomEvent<boolean>>) => void;
13
+ 'on-change'?: (e: CustomEvent<string>) => void;
12
14
  };
@@ -30,7 +30,7 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
30
30
  value: e => {
31
31
  e.stopPropagation();
32
32
  _classPrivateFieldGet(this, _$input).checked = false;
33
- this.dispatchEvent(new CustomEvent('change', {
33
+ this.dispatchEvent(new CustomEvent('option-change', {
34
34
  bubbles: true,
35
35
  detail: this.value
36
36
  }));
package/search/types.d.ts CHANGED
@@ -9,7 +9,6 @@ export declare type TSinchSearchElement = HTMLElement & {
9
9
  selectionEnd: HTMLInputElement['selectionEnd'];
10
10
  selectionDirection: HTMLInputElement['selectionDirection'];
11
11
  readonly dropdownRect: TRect;
12
- addEventListener(type: 'change', listener: (e: CustomEvent<string>) => void): void;
13
12
  setAttribute(name: 'value', value: string): void;
14
13
  setAttribute(name: 'label', value: string): void;
15
14
  setAttribute(name: 'placeholder', value: string): void;