@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
package/dropdown/index.js DELETED
@@ -1,415 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$optionSlot, _$listbox, _$popover, _onListboxClick, _onListboxKeyDown, _onOptionSlotChange, _onValueChange, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _selectOption, _getOptionWithValue, _getOptionElements, _findSelectedOption, _getEnabledOptionElements, _dispatchChangeEvent, _onClose, _onCloseReactHandler, _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
- import { orientationValues } from '../popover/utils';
15
- import '../popover';
16
- import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getCsvSet, getFirstCsvValue, getIntegerAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
17
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{width:100%;--sinch-popover-shape-radius:var(--sinch-shape-radius-s)}#listbox{overflow-y:auto}</style><sinch-popover id="wrapper" modal><slot name="target" slot="target"></slot><div id="listbox" slot="content"><slot name="option"></slot></div></sinch-popover>';
18
- const ITEM_HEIGHT = 40;
19
- const template = document.createElement('template');
20
- template.innerHTML = templateHTML;
21
- defineCustomElement('sinch-dropdown', (_$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _$popover = new WeakMap(), _onListboxClick = new WeakMap(), _onListboxKeyDown = new WeakMap(), _onOptionSlotChange = new WeakMap(), _onValueChange = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionWithValue = new WeakSet(), _getOptionElements = new WeakSet(), _findSelectedOption = new WeakSet(), _getEnabledOptionElements = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _onClose = new WeakMap(), _onCloseReactHandler = new WeakMap(), _onChangeReactHandler = new WeakMap(), class extends NectaryElement {
22
- constructor() {
23
- super();
24
-
25
- _classPrivateMethodInitSpec(this, _dispatchChangeEvent);
26
-
27
- _classPrivateMethodInitSpec(this, _getEnabledOptionElements);
28
-
29
- _classPrivateMethodInitSpec(this, _findSelectedOption);
30
-
31
- _classPrivateMethodInitSpec(this, _getOptionElements);
32
-
33
- _classPrivateMethodInitSpec(this, _getOptionWithValue);
34
-
35
- _classPrivateMethodInitSpec(this, _selectOption);
36
-
37
- _classPrivateMethodInitSpec(this, _getPrevOption);
38
-
39
- _classPrivateMethodInitSpec(this, _getNextOption);
40
-
41
- _classPrivateMethodInitSpec(this, _getLastOption);
42
-
43
- _classPrivateMethodInitSpec(this, _getFirstOption);
44
-
45
- _classPrivateMethodInitSpec(this, _onValueChange);
46
-
47
- _classPrivateFieldInitSpec(this, _$optionSlot, {
48
- writable: true,
49
- value: void 0
50
- });
51
-
52
- _classPrivateFieldInitSpec(this, _$listbox, {
53
- writable: true,
54
- value: void 0
55
- });
56
-
57
- _classPrivateFieldInitSpec(this, _$popover, {
58
- writable: true,
59
- value: void 0
60
- });
61
-
62
- _classPrivateFieldInitSpec(this, _onListboxClick, {
63
- writable: true,
64
- value: e => {
65
- const $elem = e.target;
66
-
67
- if (getBooleanAttribute($elem, 'disabled')) {
68
- return;
69
- }
70
-
71
- e.stopPropagation();
72
-
73
- _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $elem);
74
- }
75
- });
76
-
77
- _classPrivateFieldInitSpec(this, _onListboxKeyDown, {
78
- writable: true,
79
- value: e => {
80
- switch (e.code) {
81
- case 'Space':
82
- case 'Enter':
83
- {
84
- const $option = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this));
85
-
86
- if ($option !== null) {
87
- e.preventDefault();
88
-
89
- _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option);
90
- }
91
-
92
- break;
93
- }
94
-
95
- case 'ArrowUp':
96
- case 'ArrowLeft':
97
- {
98
- e.preventDefault();
99
-
100
- _classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, _classPrivateMethodGet(this, _getPrevOption, _getPrevOption2).call(this));
101
-
102
- break;
103
- }
104
-
105
- case 'ArrowDown':
106
- case 'ArrowRight':
107
- {
108
- e.preventDefault();
109
-
110
- _classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, _classPrivateMethodGet(this, _getNextOption, _getNextOption2).call(this));
111
-
112
- break;
113
- }
114
- }
115
- }
116
- });
117
-
118
- _classPrivateFieldInitSpec(this, _onOptionSlotChange, {
119
- writable: true,
120
- value: () => {
121
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
122
- }
123
- });
124
-
125
- _classPrivateFieldInitSpec(this, _onClose, {
126
- writable: true,
127
- value: () => {
128
- this.dispatchEvent(new CustomEvent('-close'));
129
- }
130
- });
131
-
132
- _classPrivateFieldInitSpec(this, _onCloseReactHandler, {
133
- writable: true,
134
- value: e => {
135
- getReactEventHandler(this, 'onClose')?.();
136
- getReactEventHandler(this, 'on-close')?.(e);
137
- }
138
- });
139
-
140
- _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
141
- writable: true,
142
- value: e => {
143
- getReactEventHandler(this, 'on-change')?.(e);
144
- }
145
- });
146
-
147
- const shadowRoot = this.attachShadow();
148
- shadowRoot.appendChild(template.content.cloneNode(true));
149
-
150
- _classPrivateFieldSet(this, _$optionSlot, shadowRoot.querySelector('slot[name="option"]'));
151
-
152
- _classPrivateFieldSet(this, _$listbox, shadowRoot.querySelector('#listbox'));
153
-
154
- _classPrivateFieldSet(this, _$popover, shadowRoot.querySelector('sinch-popover'));
155
- }
156
-
157
- connectedCallback() {
158
- this.setAttribute('role', 'listbox');
159
-
160
- _classPrivateFieldGet(this, _$optionSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onOptionSlotChange));
161
-
162
- this.addEventListener('-close', _classPrivateFieldGet(this, _onCloseReactHandler));
163
- this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
164
- }
165
-
166
- disconnectedCallback() {
167
- _classPrivateFieldGet(this, _$optionSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onOptionSlotChange));
168
-
169
- this.removeEventListener('-close', _classPrivateFieldGet(this, _onCloseReactHandler));
170
- this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
171
- }
172
-
173
- static get observedAttributes() {
174
- return ['open', 'value', 'orientation', 'maxvisibleitems', 'multiple'];
175
- }
176
-
177
- get nodeName() {
178
- return 'select';
179
- }
180
-
181
- set value(value) {
182
- updateAttribute(this, 'value', value);
183
- }
184
-
185
- get value() {
186
- return getAttribute(this, 'value', '');
187
- }
188
-
189
- set maxVisibleItems(value) {
190
- updateIntegerAttribute(this, 'maxvisibleitems', value);
191
- }
192
-
193
- get maxVisibleItems() {
194
- return getIntegerAttribute(this, 'maxvisibleitems', null);
195
- }
196
-
197
- get orientation() {
198
- return getLiteralAttribute(this, orientationValues, 'orientation', 'bottom-right');
199
- }
200
-
201
- set orientation(value) {
202
- updateLiteralAttribute(this, orientationValues, 'orientation', value);
203
- }
204
-
205
- set open(isOpen) {
206
- updateBooleanAttribute(this, 'open', isOpen);
207
- }
208
-
209
- get open() {
210
- return getBooleanAttribute(this, 'open');
211
- }
212
-
213
- set multiple(isMultiple) {
214
- updateBooleanAttribute(this, 'multiple', isMultiple);
215
- }
216
-
217
- get multiple() {
218
- return getBooleanAttribute(this, 'multiple');
219
- }
220
-
221
- get dropdownRect() {
222
- return _classPrivateFieldGet(this, _$popover).popoverRect;
223
- }
224
-
225
- attributeChangedCallback(name, oldVal, newVal) {
226
- if (oldVal === newVal) {
227
- return;
228
- }
229
-
230
- switch (name) {
231
- case 'open':
232
- {
233
- updateAttribute(_classPrivateFieldGet(this, _$popover), 'open', newVal);
234
-
235
- if (isAttrTrue(newVal)) {
236
- _classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, _classPrivateMethodGet(this, _getOptionWithValue, _getOptionWithValue2).call(this, getFirstCsvValue(this.value)) ?? _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this));
237
-
238
- _classPrivateFieldGet(this, _$popover).addEventListener('keydown', _classPrivateFieldGet(this, _onListboxKeyDown));
239
-
240
- _classPrivateFieldGet(this, _$listbox).addEventListener('click', _classPrivateFieldGet(this, _onListboxClick));
241
-
242
- _classPrivateFieldGet(this, _$popover).addEventListener('-close', _classPrivateFieldGet(this, _onClose));
243
- } else {
244
- _classPrivateFieldGet(this, _$popover).removeEventListener('keydown', _classPrivateFieldGet(this, _onListboxKeyDown));
245
-
246
- _classPrivateFieldGet(this, _$listbox).removeEventListener('click', _classPrivateFieldGet(this, _onListboxClick));
247
-
248
- _classPrivateFieldGet(this, _$popover).removeEventListener('-close', _classPrivateFieldGet(this, _onClose));
249
- }
250
-
251
- break;
252
- }
253
-
254
- case 'multiple':
255
- {
256
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
257
-
258
- break;
259
- }
260
-
261
- case 'orientation':
262
- {
263
- updateAttribute(_classPrivateFieldGet(this, _$popover), 'orientation', newVal);
264
- break;
265
- }
266
-
267
- case 'value':
268
- {
269
- _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, newVal ?? '');
270
-
271
- break;
272
- }
273
-
274
- case 'maxvisibleitems':
275
- {
276
- const $list = _classPrivateFieldGet(this, _$listbox);
277
-
278
- if (newVal === '0') {
279
- $list.style.maxHeight = 'unset';
280
- } else {
281
- $list.style.maxHeight = attrValueToPixels(newVal, {
282
- min: 2,
283
- multiplier: ITEM_HEIGHT
284
- });
285
- }
286
-
287
- break;
288
- }
289
- }
290
- }
291
-
292
- }));
293
-
294
- function _onValueChange2(csv) {
295
- if (this.multiple) {
296
- const values = getCsvSet(csv);
297
-
298
- for (const $option of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
299
- const isChecked = !getBooleanAttribute($option, 'disabled') && values.has(getAttribute($option, 'value', ''));
300
- updateBooleanAttribute($option, 'data-checked', isChecked);
301
- }
302
- } else {
303
- const value = getFirstCsvValue(csv);
304
-
305
- for (const $option of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
306
- const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
307
- updateBooleanAttribute($option, 'data-checked', isChecked);
308
- }
309
- }
310
- }
311
-
312
- function _getFirstOption2() {
313
- return _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this)[0] ?? null;
314
- }
315
-
316
- function _getLastOption2() {
317
- return _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this).reverse()[0] ?? null;
318
- }
319
-
320
- function _getNextOption2() {
321
- const $options = _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this);
322
-
323
- const $selectedOption = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, $options);
324
-
325
- const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
326
-
327
- if (currentIndex < 0) {
328
- return _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this);
329
- }
330
-
331
- return $options[(currentIndex + 1) % $options.length];
332
- }
333
-
334
- function _getPrevOption2() {
335
- const $options = _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this);
336
-
337
- const $selectedOption = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, $options);
338
-
339
- const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
340
-
341
- if (currentIndex < 0) {
342
- return _classPrivateMethodGet(this, _getLastOption, _getLastOption2).call(this);
343
- }
344
-
345
- return $options[(currentIndex - 1 + $options.length) % $options.length];
346
- }
347
-
348
- function _selectOption2($option) {
349
- const hasMaxVisibleItems = this.hasAttribute('maxvisibleitems');
350
-
351
- for (const $op of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
352
- const isSelected = $op === $option;
353
- updateBooleanAttribute($op, 'data-selected', isSelected);
354
-
355
- if (isSelected && hasMaxVisibleItems) {
356
- $op.scrollIntoView?.({
357
- block: 'nearest'
358
- });
359
- }
360
- }
361
- }
362
-
363
- function _getOptionWithValue2(value) {
364
- if (value === null) {
365
- return null;
366
- }
367
-
368
- for (const $option of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
369
- if ($option.disabled !== true && $option.value === value) {
370
- return $option;
371
- }
372
- }
373
-
374
- return null;
375
- }
376
-
377
- function _getOptionElements2() {
378
- let $elements = _classPrivateFieldGet(this, _$optionSlot).assignedElements();
379
-
380
- if ($elements.length === 1 && $elements[0].tagName === 'SLOT') {
381
- $elements = $elements[0].assignedElements();
382
- }
383
-
384
- return $elements;
385
- }
386
-
387
- function _findSelectedOption2(elements) {
388
- for (const el of elements) {
389
- if (getBooleanAttribute(el, 'data-selected')) {
390
- return el;
391
- }
392
- }
393
-
394
- return null;
395
- }
396
-
397
- function _getEnabledOptionElements2() {
398
- return _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this).filter(opt => opt.disabled !== true);
399
- }
400
-
401
- function _dispatchChangeEvent2($opt) {
402
- if ($opt === null) {
403
- return;
404
- }
405
-
406
- const value = $opt.value;
407
- const result = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($opt, 'data-checked')) : value;
408
- this.dispatchEvent(new CustomEvent('change', {
409
- detail: result,
410
- bubbles: true
411
- }));
412
- this.dispatchEvent(new CustomEvent('-change', {
413
- detail: result
414
- }));
415
- }
@@ -1,32 +0,0 @@
1
- import type { TSinchPopoverOrientation } from '../popover/types';
2
- import type { TRect, TSinchElementReact } from '../types';
3
- import type { SyntheticEvent } from 'react';
4
- export declare type TSinchDropdownElement = HTMLElement & {
5
- open: boolean;
6
- multiple: boolean;
7
- orientation: TSinchPopoverOrientation;
8
- value: string;
9
- maxVisibleItems: number | null;
10
- readonly dropdownRect: TRect;
11
- addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
12
- addEventListener(type: '-close', listener: (e: CustomEvent<void>) => void): void;
13
- setAttribute(name: 'open', value: ''): void;
14
- setAttribute(name: 'multiple', value: ''): void;
15
- setAttribute(name: 'orientation', value: TSinchPopoverOrientation): void;
16
- setAttribute(name: 'value', value: string): void;
17
- setAttribute(name: 'maxvisibleitems', value: string): void;
18
- };
19
- export declare type TSinchDropdownReact = TSinchElementReact<TSinchDropdownElement> & {
20
- open: boolean;
21
- multiple?: boolean;
22
- orientation?: TSinchPopoverOrientation;
23
- value: string;
24
- maxVisibleItems?: number;
25
- 'aria-label': string;
26
- /** @deprecated */
27
- onClose?: () => void;
28
- 'on-close'?: (e: CustomEvent<void>) => void;
29
- /** @deprecated */
30
- onChange?: (e: SyntheticEvent<TSinchDropdownElement, CustomEvent<string>>) => void;
31
- 'on-change'?: (e: CustomEvent<string>) => void;
32
- };
@@ -1,11 +0,0 @@
1
- import type { TSinchDropdownCheckboxOptionElement, TSinchDropdownCheckboxOptionReact } from './types';
2
- declare global {
3
- namespace JSX {
4
- interface IntrinsicElements {
5
- 'sinch-dropdown-checkbox-option': TSinchDropdownCheckboxOptionReact;
6
- }
7
- }
8
- interface HTMLElementTagNameMap {
9
- 'sinch-dropdown-checkbox-option': TSinchDropdownCheckboxOptionElement;
10
- }
11
- }
@@ -1,88 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$text;
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
- import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
11
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:4px 10px 4px 6px;align-items:center;gap:6px;user-select:none;cursor:pointer}#text{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-container{position:relative;width:32px;height:32px}#icon-container::before{content:"";position:absolute;top:7px;left:7px;width:18px;height:18px;border-radius:var(--sinch-shape-radius-xs);pointer-events:none;background-color:var(--sinch-color-snow-100);border:2px solid var(--sinch-color-stormy-300);transition:background-color .1s linear;box-sizing:border-box}#icon-checkmark{position:absolute;left:9px;top:10px;transition:opacity .1s linear;opacity:0;pointer-events:none;fill:var(--sinch-color-snow-100)}:host([data-checked]) #icon-container::before{background-color:var(--sinch-color-tropical-500);border-color:var(--sinch-color-tropical-500)}:host([data-checked]) #icon-checkmark{opacity:1}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial}:host([disabled]:not([disabled=false])) #icon-container::before{border-color:var(--sinch-color-stormy-100)}@media (prefers-reduced-motion){#icon-checkmark,#icon-container::before{transition:none}}</style><div id="wrapper"><div id="icon-container"><svg id="icon-checkmark" width="14" height="11" aria-hidden="true"><path d="M14 1.99999L12.59 0.579987L4.98995 8.17L1.49997 4.5L0.0799694 5.91L4.98995 11L14 1.99999Z"/></svg></div><span id="text"></span></div>';
12
- const template = document.createElement('template');
13
- template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-dropdown-checkbox-option', (_$text = new WeakMap(), class extends NectaryElement {
15
- constructor() {
16
- super();
17
-
18
- _classPrivateFieldInitSpec(this, _$text, {
19
- writable: true,
20
- value: void 0
21
- });
22
-
23
- const shadowRoot = this.attachShadow();
24
- shadowRoot.appendChild(template.content.cloneNode(true));
25
-
26
- _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
27
- }
28
-
29
- connectedCallback() {
30
- this.setAttribute('role', 'option');
31
- }
32
-
33
- static get observedAttributes() {
34
- return ['text', 'checked'];
35
- }
36
-
37
- attributeChangedCallback(name, oldVal, newVal) {
38
- if (oldVal === newVal) {
39
- return;
40
- }
41
-
42
- switch (name) {
43
- case 'text':
44
- {
45
- _classPrivateFieldGet(this, _$text).textContent = newVal;
46
- break;
47
- }
48
-
49
- case 'checked':
50
- {
51
- updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
52
- }
53
- }
54
- }
55
-
56
- set value(value) {
57
- updateAttribute(this, 'value', value);
58
- }
59
-
60
- get value() {
61
- return getAttribute(this, 'value', '');
62
- }
63
-
64
- set text(value) {
65
- updateAttribute(this, 'text', value);
66
- }
67
-
68
- get text() {
69
- return getAttribute(this, 'text', '');
70
- }
71
-
72
- set disabled(isDisabled) {
73
- updateBooleanAttribute(this, 'disabled', isDisabled);
74
- }
75
-
76
- get disabled() {
77
- return getBooleanAttribute(this, 'disabled');
78
- }
79
-
80
- set checked(isChecked) {
81
- updateBooleanAttribute(this, 'checked', isChecked);
82
- }
83
-
84
- get checked() {
85
- return getBooleanAttribute(this, 'checked');
86
- }
87
-
88
- }));
@@ -1,15 +0,0 @@
1
- import type { TSinchElementReact } from '../types';
2
- export declare type TSinchDropdownCheckboxOptionElement = HTMLElement & {
3
- value: string;
4
- text: string;
5
- disabled: boolean;
6
- setAttribute(name: 'value', value: string): void;
7
- setAttribute(name: 'text', value: string): void;
8
- setAttribute(name: 'disabled', value: ''): void;
9
- };
10
- export declare type TSinchDropdownCheckboxOptionReact = TSinchElementReact<TSinchDropdownCheckboxOptionElement> & {
11
- value: string;
12
- text: string;
13
- disabled?: boolean;
14
- 'aria-label': string;
15
- };
@@ -1,11 +0,0 @@
1
- import type { TSinchDropdownRadioOptionElement, TSinchDropdownRadioOptionReact } from './types';
2
- declare global {
3
- namespace JSX {
4
- interface IntrinsicElements {
5
- 'sinch-dropdown-radio-option': TSinchDropdownRadioOptionReact;
6
- }
7
- }
8
- interface HTMLElementTagNameMap {
9
- 'sinch-dropdown-radio-option': TSinchDropdownRadioOptionElement;
10
- }
11
- }
@@ -1,88 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$text;
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
- import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
11
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:4px 10px 4px 6px;align-items:center;gap:6px;user-select:none;cursor:pointer}#text{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-container{position:relative;width:32px;height:32px}#icon-container::before{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-snow-100);border:2px solid var(--sinch-color-stormy-300);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-tropical-500);pointer-events:none}:host([data-checked]) #icon-container::before{border-color:var(--sinch-color-tropical-500)}:host([data-checked]) #icon-knob{opacity:1}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial}:host([disabled]:not([disabled=false])) #icon-container::before{border-color:var(--sinch-color-stormy-100)}@media (prefers-reduced-motion){#icon-container::before,#icon-knob{transition:none}}</style><div id="wrapper"><div id="icon-container"><div id="icon-knob"></div></div><span id="text"></span></div>';
12
- const template = document.createElement('template');
13
- template.innerHTML = templateHTML;
14
- defineCustomElement('sinch-dropdown-radio-option', (_$text = new WeakMap(), class extends NectaryElement {
15
- constructor() {
16
- super();
17
-
18
- _classPrivateFieldInitSpec(this, _$text, {
19
- writable: true,
20
- value: void 0
21
- });
22
-
23
- const shadowRoot = this.attachShadow();
24
- shadowRoot.appendChild(template.content.cloneNode(true));
25
-
26
- _classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
27
- }
28
-
29
- connectedCallback() {
30
- this.setAttribute('role', 'option');
31
- }
32
-
33
- static get observedAttributes() {
34
- return ['text', 'checked'];
35
- }
36
-
37
- attributeChangedCallback(name, oldVal, newVal) {
38
- if (oldVal === newVal) {
39
- return;
40
- }
41
-
42
- switch (name) {
43
- case 'text':
44
- {
45
- _classPrivateFieldGet(this, _$text).textContent = newVal;
46
- break;
47
- }
48
-
49
- case 'checked':
50
- {
51
- updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
52
- }
53
- }
54
- }
55
-
56
- set value(value) {
57
- updateAttribute(this, 'value', value);
58
- }
59
-
60
- get value() {
61
- return getAttribute(this, 'value', '');
62
- }
63
-
64
- set text(value) {
65
- updateAttribute(this, 'text', value);
66
- }
67
-
68
- get text() {
69
- return getAttribute(this, 'text', '');
70
- }
71
-
72
- set disabled(isDisabled) {
73
- updateBooleanAttribute(this, 'disabled', isDisabled);
74
- }
75
-
76
- get disabled() {
77
- return getBooleanAttribute(this, 'disabled');
78
- }
79
-
80
- set checked(isChecked) {
81
- updateBooleanAttribute(this, 'checked', isChecked);
82
- }
83
-
84
- get checked() {
85
- return getBooleanAttribute(this, 'checked');
86
- }
87
-
88
- }));
@@ -1,15 +0,0 @@
1
- import type { TSinchElementReact } from '../types';
2
- export declare type TSinchDropdownRadioOptionElement = HTMLElement & {
3
- value: string;
4
- text: string;
5
- disabled: boolean;
6
- setAttribute(name: 'value', value: string): void;
7
- setAttribute(name: 'text', value: string): void;
8
- setAttribute(name: 'disabled', value: ''): void;
9
- };
10
- export declare type TSinchDropdownRadioOptionReact = TSinchElementReact<TSinchDropdownRadioOptionElement> & {
11
- value: string;
12
- text: string;
13
- disabled?: boolean;
14
- 'aria-label': string;
15
- };