@nectary/components 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/accordion/index.js +47 -84
  2. package/accordion-item/index.js +30 -53
  3. package/action-menu/index.d.ts +0 -1
  4. package/action-menu/index.js +177 -223
  5. package/action-menu/types.d.ts +8 -18
  6. package/action-menu-option/index.d.ts +1 -0
  7. package/action-menu-option/index.js +52 -62
  8. package/action-menu-option/types.d.ts +9 -0
  9. package/action-menu-option/utils.d.ts +2 -0
  10. package/action-menu-option/utils.js +3 -0
  11. package/alert/index.js +6 -20
  12. package/avatar/index.js +12 -31
  13. package/avatar-badge/index.js +8 -22
  14. package/avatar-status/index.js +1 -1
  15. package/button/index.js +46 -92
  16. package/button/types.d.ts +1 -1
  17. package/card/index.js +21 -59
  18. package/chat-avatar/index.js +8 -22
  19. package/chat-block/index.js +29 -69
  20. package/chat-bubble/index.js +6 -20
  21. package/checkbox/index.js +59 -107
  22. package/chip/index.d.ts +13 -0
  23. package/chip/index.js +140 -0
  24. package/chip/types.d.ts +37 -0
  25. package/color-menu/index.d.ts +14 -0
  26. package/color-menu/index.js +450 -0
  27. package/color-menu/types.d.ts +36 -0
  28. package/color-menu/utils.d.ts +1 -0
  29. package/color-menu/utils.js +15 -0
  30. package/color-swatch/index.d.ts +13 -0
  31. package/color-swatch/index.js +60 -0
  32. package/color-swatch/types.d.ts +11 -0
  33. package/colors.json +61 -49
  34. package/date-picker/index.js +162 -293
  35. package/dialog/index.js +70 -142
  36. package/field/index.js +44 -65
  37. package/file-drop/index.js +123 -200
  38. package/file-picker/index.d.ts +0 -1
  39. package/file-picker/index.js +55 -108
  40. package/file-status/index.js +15 -39
  41. package/help-tooltip/index.js +11 -28
  42. package/horizontal-stepper/index.js +33 -59
  43. package/horizontal-stepper-item/index.js +13 -37
  44. package/icon-button/index.d.ts +1 -0
  45. package/icon-button/index.js +51 -85
  46. package/icon-button/types.d.ts +16 -2
  47. package/icons-channel/notify/index.d.ts +11 -0
  48. package/icons-channel/notify/index.js +4 -0
  49. package/illustrations/create-illustration-class.js +1 -1
  50. package/inline-alert/index.js +29 -81
  51. package/input/index.js +117 -222
  52. package/link/index.js +51 -97
  53. package/list-item/index.js +1 -1
  54. package/package.json +12 -14
  55. package/pagination/index.js +113 -163
  56. package/pop/index.d.ts +11 -0
  57. package/pop/index.js +391 -0
  58. package/pop/types.d.ts +35 -0
  59. package/pop/utils.d.ts +7 -0
  60. package/pop/utils.js +18 -0
  61. package/popover/index.d.ts +1 -0
  62. package/popover/index.js +105 -314
  63. package/popover/types.d.ts +8 -1
  64. package/popover/utils.d.ts +5 -0
  65. package/popover/utils.js +17 -1
  66. package/progress/index.js +9 -28
  67. package/radio/index.js +103 -169
  68. package/radio-option/index.js +28 -48
  69. package/segment/index.js +49 -130
  70. package/segment-collapse/index.js +28 -49
  71. package/segmented-control/index.js +36 -73
  72. package/segmented-control-option/index.js +45 -87
  73. package/segmented-icon-control/index.js +47 -84
  74. package/segmented-icon-control-option/index.js +42 -79
  75. package/select-button/index.d.ts +13 -0
  76. package/select-button/index.js +158 -0
  77. package/select-button/types.d.ts +43 -0
  78. package/select-menu/index.d.ts +11 -0
  79. package/select-menu/index.js +345 -0
  80. package/select-menu/types.d.ts +29 -0
  81. package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
  82. package/select-menu-option/index.js +76 -0
  83. package/{select-option → select-menu-option}/types.d.ts +8 -9
  84. package/stop-events/index.js +7 -20
  85. package/table-head-cell/index.js +7 -21
  86. package/tabs/index.js +103 -165
  87. package/tabs-option/index.js +24 -44
  88. package/tag/index.d.ts +0 -1
  89. package/tag/index.js +35 -38
  90. package/tag/types.d.ts +12 -7
  91. package/textarea/index.js +96 -167
  92. package/theme.css +146 -49
  93. package/tile-control/index.js +55 -96
  94. package/tile-control-option/index.js +45 -87
  95. package/time-picker/index.js +216 -368
  96. package/title/index.js +6 -20
  97. package/toast/index.js +32 -70
  98. package/toast-manager/index.js +141 -217
  99. package/toggle/index.js +59 -107
  100. package/tooltip/index.d.ts +2 -0
  101. package/tooltip/index.js +160 -17
  102. package/tooltip/types.d.ts +13 -0
  103. package/tooltip/utils.d.ts +5 -0
  104. package/tooltip/utils.js +25 -1
  105. package/utils/animation.d.ts +17 -0
  106. package/utils/animation.js +142 -0
  107. package/utils/colors.d.ts +5 -0
  108. package/utils/colors.js +5 -0
  109. package/utils/context.d.ts +15 -0
  110. package/utils/context.js +57 -0
  111. package/{utils.d.ts → utils/index.d.ts} +15 -11
  112. package/{utils.js → utils/index.js} +104 -48
  113. package/vertical-stepper/index.js +29 -50
  114. package/vertical-stepper-item/index.js +13 -37
  115. package/dropdown/index.d.ts +0 -12
  116. package/dropdown/index.js +0 -415
  117. package/dropdown/types.d.ts +0 -32
  118. package/dropdown-checkbox-option/index.d.ts +0 -11
  119. package/dropdown-checkbox-option/index.js +0 -88
  120. package/dropdown-checkbox-option/types.d.ts +0 -15
  121. package/dropdown-radio-option/index.d.ts +0 -11
  122. package/dropdown-radio-option/index.js +0 -88
  123. package/dropdown-radio-option/types.d.ts +0 -15
  124. package/dropdown-text-option/index.js +0 -104
  125. package/dropdown-text-option/types.d.ts +0 -16
  126. package/select/index.d.ts +0 -13
  127. package/select/index.js +0 -316
  128. package/select/types.d.ts +0 -53
  129. package/select-option/index.d.ts +0 -11
  130. package/select-option/index.js +0 -8
  131. package/tag/utils.d.ts +0 -5
  132. package/tag/utils.js +0 -6
  133. package/tag-close/index.d.ts +0 -12
  134. package/tag-close/index.js +0 -42
  135. package/tag-close/types.d.ts +0 -5
  136. /package/{dropdown-checkbox-option → chip}/types.js +0 -0
  137. /package/{dropdown-radio-option → color-menu}/types.js +0 -0
  138. /package/{dropdown-text-option → color-swatch}/types.js +0 -0
  139. /package/{dropdown → pop}/types.js +0 -0
  140. /package/{select-option → select-button}/types.js +0 -0
  141. /package/{tag-close → select-menu}/types.js +0 -0
  142. /package/{select → select-menu-option}/types.js +0 -0
@@ -1,104 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
-
6
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
7
-
8
- import '../icons/check';
9
- import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
10
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:24px}#content{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}#check{display:none;margin-right:-6px}:host([data-checked]) #check{display:block}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial;--sinch-color-icon:var(--sinch-color-stormy-100)}::slotted(*){margin-left:-6px}</style><div id="wrapper"><slot name="icon"></slot><span id="content"></span><sinch-icon-check id="check"></sinch-icon-check></div>';
11
- const template = document.createElement('template');
12
- template.innerHTML = templateHTML;
13
-
14
- var _$iconSlot = new WeakMap();
15
-
16
- var _$content = new WeakMap();
17
-
18
- export class DropdownTextOption extends NectaryElement {
19
- constructor() {
20
- super();
21
-
22
- _classPrivateFieldInitSpec(this, _$iconSlot, {
23
- writable: true,
24
- value: void 0
25
- });
26
-
27
- _classPrivateFieldInitSpec(this, _$content, {
28
- writable: true,
29
- value: void 0
30
- });
31
-
32
- const shadowRoot = this.attachShadow();
33
- shadowRoot.appendChild(template.content.cloneNode(true));
34
-
35
- _classPrivateFieldSet(this, _$iconSlot, shadowRoot.querySelector('slot'));
36
-
37
- _classPrivateFieldSet(this, _$content, shadowRoot.querySelector('#content'));
38
- }
39
-
40
- connectedCallback() {
41
- this.setAttribute('role', 'option');
42
- }
43
-
44
- static get observedAttributes() {
45
- return ['text', 'checked'];
46
- }
47
-
48
- attributeChangedCallback(name, oldVal, newVal) {
49
- if (oldVal === newVal) {
50
- return;
51
- }
52
-
53
- switch (name) {
54
- case 'text':
55
- {
56
- _classPrivateFieldGet(this, _$content).textContent = newVal;
57
- break;
58
- }
59
-
60
- case 'checked':
61
- {
62
- updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
63
- }
64
- }
65
- }
66
-
67
- set value(value) {
68
- updateAttribute(this, 'value', value);
69
- }
70
-
71
- get value() {
72
- return getAttribute(this, 'value', '');
73
- }
74
-
75
- set text(value) {
76
- updateAttribute(this, 'text', value);
77
- }
78
-
79
- get text() {
80
- return getAttribute(this, 'text', '');
81
- }
82
-
83
- set disabled(isDisabled) {
84
- updateBooleanAttribute(this, 'disabled', isDisabled);
85
- }
86
-
87
- get disabled() {
88
- return getBooleanAttribute(this, 'disabled');
89
- }
90
-
91
- set checked(isChecked) {
92
- updateBooleanAttribute(this, 'checked', isChecked);
93
- }
94
-
95
- get checked() {
96
- return getBooleanAttribute(this, 'checked');
97
- }
98
-
99
- get icon() {
100
- return _classPrivateFieldGet(this, _$iconSlot).assignedElements()[0] ?? null;
101
- }
102
-
103
- }
104
- defineCustomElement('sinch-dropdown-text-option', DropdownTextOption);
@@ -1,16 +0,0 @@
1
- import type { TSinchElementReact } from '../types';
2
- export declare type TSinchDropdownTextOptionElement = HTMLElement & {
3
- value: string;
4
- text: string;
5
- disabled: boolean;
6
- readonly icon: Element | null;
7
- setAttribute(name: 'value', value: string): void;
8
- setAttribute(name: 'text', value: string): void;
9
- setAttribute(name: 'disabled', value: ''): void;
10
- };
11
- export declare type TSinchDropdownTextOptionReact = TSinchElementReact<TSinchDropdownTextOptionElement> & {
12
- value: string;
13
- text: string;
14
- disabled?: boolean;
15
- 'aria-label': string;
16
- };
package/select/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import '../dropdown';
2
- import '../icons/keyboard-arrow-down';
3
- import type { TSinchSelectElement, TSinchSelectReact } from './types';
4
- declare global {
5
- namespace JSX {
6
- interface IntrinsicElements {
7
- 'sinch-select': TSinchSelectReact;
8
- }
9
- }
10
- interface HTMLElementTagNameMap {
11
- 'sinch-select': TSinchSelectElement;
12
- }
13
- }
package/select/index.js DELETED
@@ -1,316 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$button, _$buttonContent, _$dropdown, _$optionSlot, _$sh, _createElement, _updateButtonContent, _onValueChange, _getOptionWithValue, _onDropdownClick, _onDropdownClose, _onButtonFocus, _onButtonBlur, _onChangeReactHandler, _onFocusReactHandler, _onBlurReactHandler;
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 '../dropdown';
15
- import '../icons/keyboard-arrow-down';
16
- import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateIntegerAttribute } from '../utils';
17
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#dropdown{display:block;width:100%}#button{all:initial;display:flex;align-items:center;gap:8px;border:1px solid var(--sinch-color-stormy-200);border-radius:var(--sinch-shape-radius-s);box-sizing:border-box;width:100%;height:48px;padding:0 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);cursor:pointer;--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:24px}#button:focus{border-color:var(--sinch-color-stormy-600)}#dropdown-icon{fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button[data-unselected]{color:var(--sinch-color-text-muted)}#button:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100);cursor:initial}#button:disabled #dropdown-icon{fill:var(--sinch-color-stormy-100)}:host([invalid]:not([invalid=false])) #button:enabled{border-color:var(--sinch-color-text-invalid)}#content{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host([disabled]:not([disabled=false])) #button{--sinch-color-icon:var(--sinch-color-stormy-100)}</style><sinch-dropdown id="dropdown" orientation="bottom"><button slot="target" id="button"><span id="content"></span><sinch-icon-keyboard-arrow-down id="dropdown-icon"></sinch-icon-keyboard-arrow-down></button><slot name="option" slot="option"></slot></sinch-dropdown>';
18
- const template = document.createElement('template');
19
- template.innerHTML = templateHTML;
20
- defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _$sh = new WeakMap(), _createElement = new WeakSet(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), _onButtonFocus = new WeakMap(), _onButtonBlur = new WeakMap(), _onChangeReactHandler = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), class extends NectaryElement {
21
- constructor() {
22
- super();
23
-
24
- _classPrivateMethodInitSpec(this, _getOptionWithValue);
25
-
26
- _classPrivateMethodInitSpec(this, _updateButtonContent);
27
-
28
- _classPrivateMethodInitSpec(this, _createElement);
29
-
30
- _classPrivateFieldInitSpec(this, _$button, {
31
- writable: true,
32
- value: void 0
33
- });
34
-
35
- _classPrivateFieldInitSpec(this, _$buttonContent, {
36
- writable: true,
37
- value: void 0
38
- });
39
-
40
- _classPrivateFieldInitSpec(this, _$dropdown, {
41
- writable: true,
42
- value: void 0
43
- });
44
-
45
- _classPrivateFieldInitSpec(this, _$optionSlot, {
46
- writable: true,
47
- value: void 0
48
- });
49
-
50
- _classPrivateFieldInitSpec(this, _$sh, {
51
- writable: true,
52
- value: void 0
53
- });
54
-
55
- _classPrivateFieldInitSpec(this, _onValueChange, {
56
- writable: true,
57
- value: e => {
58
- const detail = e.detail;
59
- _classPrivateFieldGet(this, _$dropdown).open = false;
60
- this.dispatchEvent(new CustomEvent('change', {
61
- detail,
62
- bubbles: true
63
- }));
64
- this.dispatchEvent(new CustomEvent('-change', {
65
- detail
66
- }));
67
- }
68
- });
69
-
70
- _classPrivateFieldInitSpec(this, _onDropdownClick, {
71
- writable: true,
72
- value: () => {
73
- _classPrivateFieldGet(this, _$dropdown).open = true;
74
- }
75
- });
76
-
77
- _classPrivateFieldInitSpec(this, _onDropdownClose, {
78
- writable: true,
79
- value: () => {
80
- _classPrivateFieldGet(this, _$dropdown).open = false;
81
- }
82
- });
83
-
84
- _classPrivateFieldInitSpec(this, _onButtonFocus, {
85
- writable: true,
86
- value: () => {
87
- this.dispatchEvent(new CustomEvent('-focus'));
88
- }
89
- });
90
-
91
- _classPrivateFieldInitSpec(this, _onButtonBlur, {
92
- writable: true,
93
- value: () => {
94
- this.dispatchEvent(new CustomEvent('-blur'));
95
- }
96
- });
97
-
98
- _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
99
- writable: true,
100
- value: e => {
101
- getReactEventHandler(this, 'on-change')?.(e);
102
- }
103
- });
104
-
105
- _classPrivateFieldInitSpec(this, _onFocusReactHandler, {
106
- writable: true,
107
- value: () => {
108
- getReactEventHandler(this, 'on-focus')?.();
109
- }
110
- });
111
-
112
- _classPrivateFieldInitSpec(this, _onBlurReactHandler, {
113
- writable: true,
114
- value: () => {
115
- getReactEventHandler(this, 'on-blur')?.();
116
- }
117
- });
118
-
119
- const shadowRoot = this.attachShadow();
120
- shadowRoot.appendChild(template.content.cloneNode(true));
121
-
122
- _classPrivateFieldSet(this, _$sh, shadowRoot);
123
-
124
- _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('#button'));
125
-
126
- _classPrivateFieldSet(this, _$buttonContent, shadowRoot.querySelector('#content'));
127
-
128
- _classPrivateFieldSet(this, _$dropdown, shadowRoot.querySelector('#dropdown'));
129
-
130
- _classPrivateFieldSet(this, _$optionSlot, shadowRoot.querySelector('slot[name="option"]'));
131
- }
132
-
133
- connectedCallback() {
134
- this.setAttribute('role', 'listbox');
135
- this.setAttribute('aria-haspopup', 'listbox');
136
-
137
- _classPrivateFieldGet(this, _$dropdown).addEventListener('-change', _classPrivateFieldGet(this, _onValueChange));
138
-
139
- _classPrivateFieldGet(this, _$dropdown).addEventListener('-close', _classPrivateFieldGet(this, _onDropdownClose));
140
-
141
- _classPrivateFieldGet(this, _$button).addEventListener('click', _classPrivateFieldGet(this, _onDropdownClick));
142
-
143
- _classPrivateFieldGet(this, _$button).addEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
144
-
145
- _classPrivateFieldGet(this, _$button).addEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
146
-
147
- this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
148
- this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
149
- this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
150
- }
151
-
152
- disconnectedCallback() {
153
- _classPrivateFieldGet(this, _$dropdown).removeEventListener('-change', _classPrivateFieldGet(this, _onValueChange));
154
-
155
- _classPrivateFieldGet(this, _$dropdown).removeEventListener('-close', _classPrivateFieldGet(this, _onDropdownClose));
156
-
157
- _classPrivateFieldGet(this, _$button).removeEventListener('click', _classPrivateFieldGet(this, _onDropdownClick));
158
-
159
- _classPrivateFieldGet(this, _$button).removeEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
160
-
161
- _classPrivateFieldGet(this, _$button).removeEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
162
-
163
- this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
164
- this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
165
- this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
166
- }
167
-
168
- static get observedAttributes() {
169
- return ['value', 'placeholder', 'invalid', 'disabled', 'maxvisibleitems'];
170
- }
171
-
172
- get nodeName() {
173
- return 'select';
174
- }
175
-
176
- set value(value) {
177
- updateAttribute(this, 'value', value);
178
- }
179
-
180
- get value() {
181
- return getAttribute(this, 'value', '');
182
- }
183
-
184
- set placeholder(value) {
185
- updateAttribute(this, 'placeholder', value);
186
- }
187
-
188
- get placeholder() {
189
- return getAttribute(this, 'placeholder', null);
190
- }
191
-
192
- set invalid(value) {
193
- updateBooleanAttribute(this, 'invalid', value);
194
- }
195
-
196
- get invalid() {
197
- return getBooleanAttribute(this, 'invalid');
198
- }
199
-
200
- set disabled(isDisabled) {
201
- updateBooleanAttribute(this, 'disabled', isDisabled);
202
- }
203
-
204
- get disabled() {
205
- return getBooleanAttribute(this, 'disabled');
206
- }
207
-
208
- set maxVisibleItems(value) {
209
- updateIntegerAttribute(this, 'maxvisibleitems', value);
210
- }
211
-
212
- get maxVisibleItems() {
213
- return getIntegerAttribute(this, 'maxvisibleitems', null);
214
- }
215
-
216
- get dropdownRect() {
217
- return _classPrivateFieldGet(this, _$dropdown).dropdownRect;
218
- }
219
-
220
- attributeChangedCallback(name, oldVal, newVal) {
221
- if (newVal === oldVal) {
222
- return;
223
- }
224
-
225
- switch (name) {
226
- case 'value':
227
- {
228
- updateAttribute(_classPrivateFieldGet(this, _$dropdown), 'value', newVal);
229
-
230
- _classPrivateMethodGet(this, _updateButtonContent, _updateButtonContent2).call(this);
231
-
232
- break;
233
- }
234
-
235
- case 'placeholder':
236
- {
237
- updateAttribute(this, 'role-description', newVal);
238
-
239
- _classPrivateMethodGet(this, _updateButtonContent, _updateButtonContent2).call(this);
240
-
241
- break;
242
- }
243
-
244
- case 'invalid':
245
- {
246
- updateExplicitBooleanAttribute(this, 'aria-invalid', isAttrTrue(newVal));
247
- break;
248
- }
249
-
250
- case 'disabled':
251
- {
252
- const isDisabled = isAttrTrue(newVal);
253
- updateBooleanAttribute(_classPrivateFieldGet(this, _$dropdown), 'disabled', isDisabled);
254
- updateBooleanAttribute(this, 'disabled', isDisabled);
255
- _classPrivateFieldGet(this, _$button).disabled = isDisabled;
256
- break;
257
- }
258
-
259
- case 'maxvisibleitems':
260
- {
261
- updateAttribute(_classPrivateFieldGet(this, _$dropdown), 'maxvisibleitems', newVal);
262
- break;
263
- }
264
- }
265
- }
266
-
267
- focus() {
268
- _classPrivateFieldGet(this, _$dropdown).focus();
269
- }
270
-
271
- blur() {
272
- _classPrivateFieldGet(this, _$dropdown).blur();
273
- }
274
-
275
- }));
276
-
277
- function _createElement2(name) {
278
- if (Reflect.has(_classPrivateFieldGet(this, _$sh), 'createElement')) {
279
- return _classPrivateFieldGet(this, _$sh).createElement(name);
280
- }
281
-
282
- return document.createElement(name);
283
- }
284
-
285
- function _updateButtonContent2() {
286
- if (_classPrivateFieldGet(this, _$button).firstElementChild !== _classPrivateFieldGet(this, _$buttonContent)) {
287
- _classPrivateFieldGet(this, _$button).removeChild(_classPrivateFieldGet(this, _$button).firstElementChild);
288
- }
289
-
290
- const $option = _classPrivateMethodGet(this, _getOptionWithValue, _getOptionWithValue2).call(this, this.value);
291
-
292
- if ($option == null) {
293
- _classPrivateFieldGet(this, _$button).setAttribute('data-unselected', '');
294
-
295
- _classPrivateFieldGet(this, _$buttonContent).textContent = this.placeholder ?? '';
296
- } else {
297
- _classPrivateFieldGet(this, _$button).removeAttribute('data-unselected');
298
-
299
- _classPrivateFieldGet(this, _$buttonContent).textContent = getAttribute($option, 'text', null);
300
- const $icon = $option.icon;
301
-
302
- if ($icon != null) {
303
- _classPrivateFieldGet(this, _$button).prepend(_classPrivateMethodGet(this, _createElement, _createElement2).call(this, $icon.tagName.toLowerCase()));
304
- }
305
- }
306
- }
307
-
308
- function _getOptionWithValue2(value) {
309
- for (const $option of _classPrivateFieldGet(this, _$optionSlot).assignedElements()) {
310
- if ($option.disabled !== true && $option.value === value) {
311
- return $option;
312
- }
313
- }
314
-
315
- return null;
316
- }
package/select/types.d.ts DELETED
@@ -1,53 +0,0 @@
1
- import type { TRect, TSinchElementReact } from '../types';
2
- import type { SyntheticEvent } from 'react';
3
- export declare type TSinchSelectElement = HTMLElement & {
4
- /** Value that matches one of the options `value` */
5
- value: string;
6
- /** Text that appears when it has no value set */
7
- placeholder: string | null;
8
- /** Invalid state */
9
- invalid: boolean;
10
- /** Disabled */
11
- disabled: boolean;
12
- /** Number of visible at the same time options in the list */
13
- maxVisibleItems: number | null;
14
- readonly dropdownRect: TRect;
15
- /** Change value event */
16
- addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
17
- /** Focus event */
18
- addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
19
- /** Blur event */
20
- addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
21
- /** Value that matches one of the options `value` */
22
- setAttribute(name: 'value', value: string): void;
23
- /** Text that appears when it has no value set */
24
- setAttribute(name: 'placeholder', value: string): void;
25
- /** Invalid state */
26
- setAttribute(name: 'invalid', value: ''): void;
27
- /** Disabled */
28
- setAttribute(name: 'disabled', value: ''): void;
29
- /** Number of visible at the same time options in the list */
30
- setAttribute(name: 'maxvisibleitems', value: string): void;
31
- };
32
- export declare type TSinchSelectReact = TSinchElementReact<TSinchSelectElement> & {
33
- /** Value that matches one of the options `value` */
34
- value: string;
35
- /** Label that is used for a11y – might be different from `label` */
36
- 'aria-label': string;
37
- /** Text that appears when it has no value set */
38
- placeholder?: string;
39
- /** Invalid state */
40
- invalid?: boolean;
41
- /** Disabled */
42
- disabled?: boolean;
43
- /** Number of visible at the same time options in the list */
44
- maxVisibleItems?: number;
45
- /** @deprecated Change value handler */
46
- onChange?: (e: SyntheticEvent<TSinchSelectElement, CustomEvent<string>>) => void;
47
- /** Change value handler */
48
- 'on-change'?: (e: CustomEvent<string>) => void;
49
- /** Focus handler */
50
- 'on-focus'?: (e: CustomEvent<void>) => void;
51
- /** Blur handler */
52
- 'on-blur'?: (e: CustomEvent<void>) => void;
53
- };
@@ -1,11 +0,0 @@
1
- import type { TSinchSelectOptionElement, TSinchSelectOptionReact } from './types';
2
- declare global {
3
- namespace JSX {
4
- interface IntrinsicElements {
5
- 'sinch-select-option': TSinchSelectOptionReact;
6
- }
7
- }
8
- interface HTMLElementTagNameMap {
9
- 'sinch-select-option': TSinchSelectOptionElement;
10
- }
11
- }
@@ -1,8 +0,0 @@
1
- import { DropdownTextOption } from '../dropdown-text-option';
2
- import { defineCustomElement } from '../utils';
3
- defineCustomElement('sinch-select-option', class extends DropdownTextOption {
4
- constructor() {
5
- super();
6
- }
7
-
8
- });
package/tag/utils.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { TSinchTagCategory } from './types';
2
- export declare const categoryValues: readonly TSinchTagCategory[];
3
- declare type TAssertCategory = (value: string | null) => asserts value is TSinchTagCategory;
4
- export declare const assertCategoryValue: TAssertCategory;
5
- export {};
package/tag/utils.js DELETED
@@ -1,6 +0,0 @@
1
- export const categoryValues = ['candy', 'bolt', 'aqua', 'grass', 'berry', 'orange', 'night', 'mud', 'dirt'];
2
- export const assertCategoryValue = value => {
3
- if (value === null || !categoryValues.includes(value)) {
4
- throw new Error(`sinch-tag: invalid category attribute: ${value}`);
5
- }
6
- };
@@ -1,12 +0,0 @@
1
- import '../icons/cancel';
2
- import type { TSinchTagCloseElement, TSinchTagCloseReact } from './types';
3
- declare global {
4
- namespace JSX {
5
- interface IntrinsicElements {
6
- 'sinch-tag-close': TSinchTagCloseReact;
7
- }
8
- }
9
- interface HTMLElementTagNameMap {
10
- 'sinch-tag-close': TSinchTagCloseElement;
11
- }
12
- }
@@ -1,42 +0,0 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$button;
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 '../icons/cancel';
11
- import { defineCustomElement, NectaryElement } from '../utils';
12
- const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:14px;height:14px}button{all:initial;position:absolute;display:flex;align-items:center;justify-content:center;width:24px;height:24px;box-sizing:border-box;left:50%;top:50%;transform:translateX(-50%) translateY(-50%);cursor:pointer}button>*{pointer-events:none}</style><div id="wrapper"><button><sinch-icon-cancel></sinch-icon-cancel></button></div>';
13
- const template = document.createElement('template');
14
- template.innerHTML = templateHTML;
15
- defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends NectaryElement {
16
- constructor() {
17
- super();
18
-
19
- _classPrivateFieldInitSpec(this, _$button, {
20
- writable: true,
21
- value: void 0
22
- });
23
-
24
- const shadowRoot = this.attachShadow();
25
- shadowRoot.appendChild(template.content.cloneNode(true));
26
-
27
- _classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
28
- }
29
-
30
- connectedCallback() {
31
- this.setAttribute('role', 'button');
32
- }
33
-
34
- focus() {
35
- _classPrivateFieldGet(this, _$button).focus();
36
- }
37
-
38
- blur() {
39
- _classPrivateFieldGet(this, _$button).blur();
40
- }
41
-
42
- }));
@@ -1,5 +0,0 @@
1
- import type { TSinchElementReact } from '../types';
2
- export declare type TSinchTagCloseElement = HTMLElement;
3
- export declare type TSinchTagCloseReact = TSinchElementReact<TSinchTagCloseElement> & {
4
- 'aria-label': string;
5
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes