@nectary/components 0.41.1 → 0.42.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.
- package/accordion/index.js +0 -16
- package/accordion/types.d.ts +9 -1
- package/accordion-item/index.js +0 -24
- package/accordion-item/types.d.ts +18 -3
- package/action-menu/index.js +1 -45
- package/action-menu-option/index.js +0 -18
- package/alert/index.js +0 -10
- package/alert/types.d.ts +6 -0
- package/avatar/index.js +57 -20
- package/avatar/types.d.ts +25 -7
- package/avatar/utils.d.ts +10 -2
- package/avatar/utils.js +23 -2
- package/badge/index.d.ts +11 -0
- package/badge/index.js +140 -0
- package/badge/types.d.ts +38 -0
- package/badge/utils.d.ts +11 -0
- package/badge/utils.js +23 -0
- package/button/index.js +0 -18
- package/card/index.js +0 -16
- package/card/types.d.ts +15 -3
- package/card-container/index.js +0 -1
- package/chat/index.js +0 -1
- package/chat-block/index.js +0 -19
- package/chat-block/types.d.ts +16 -4
- package/chat-bubble/index.js +0 -9
- package/chat-bubble/types.d.ts +6 -0
- package/checkbox/index.js +0 -23
- package/chip/index.js +16 -25
- package/chip/utils.d.ts +3 -0
- package/chip/utils.js +11 -0
- package/color-menu/index.js +8 -86
- package/color-menu/utils.js +0 -4
- package/color-swatch/index.js +17 -17
- package/color-swatch/types.d.ts +2 -2
- package/color-swatch/utils.d.ts +3 -0
- package/color-swatch/utils.js +11 -0
- package/date-picker/index.js +1 -50
- package/date-picker/utils.js +0 -7
- package/dialog/index.js +1 -17
- package/field/index.js +0 -19
- package/file-drop/index.js +0 -40
- package/file-drop/utils.js +0 -6
- package/file-picker/index.js +0 -17
- package/file-picker/utils.js +0 -1
- package/file-status/index.js +0 -12
- package/grid/index.js +0 -1
- package/grid-item/index.js +0 -9
- package/help-tooltip/index.js +0 -14
- package/horizontal-stepper/index.js +0 -12
- package/horizontal-stepper-item/index.js +0 -14
- package/icon-button/index.js +0 -15
- package/icons/create-icon-class.js +0 -2
- package/icons-branded/create-icon-class.js +0 -8
- package/icons-channel/create-icon-class.js +0 -6
- package/illustrations/create-illustration-class.js +0 -11
- package/inline-alert/index.js +0 -14
- package/input/index.js +0 -37
- package/link/index.js +0 -25
- package/list/index.js +0 -2
- package/list-item/index.js +0 -2
- package/logo/create-logo-class.js +0 -9
- package/package.json +1 -1
- package/pagination/index.js +0 -31
- package/pop/index.js +26 -68
- package/pop/utils.js +0 -1
- package/popover/index.js +0 -33
- package/popover/utils.js +0 -2
- package/progress/index.js +0 -10
- package/radio/index.js +0 -30
- package/radio-option/index.js +0 -20
- package/segment/index.js +0 -15
- package/segment-collapse/index.js +0 -13
- package/segmented-control/index.js +0 -12
- package/segmented-control-option/index.js +0 -18
- package/segmented-icon-control/index.js +0 -16
- package/segmented-icon-control-option/index.js +0 -14
- package/select-button/index.js +0 -23
- package/select-menu/index.js +1 -63
- package/select-menu-option/index.js +0 -14
- package/spinner/index.js +0 -4
- package/stop-events/index.js +0 -5
- package/table/index.js +0 -2
- package/table-body/index.js +0 -2
- package/table-cell/index.js +0 -4
- package/table-head/index.js +0 -2
- package/table-head-cell/index.js +0 -11
- package/table-row/index.js +0 -6
- package/tabs/index.js +0 -30
- package/tabs-option/index.js +0 -19
- package/tag/index.js +18 -21
- package/tag/utils.d.ts +3 -0
- package/tag/utils.js +11 -0
- package/text/index.js +1 -12
- package/textarea/index.js +0 -40
- package/{utils → theme}/colors.d.ts +0 -1
- package/{utils → theme}/colors.js +0 -1
- package/theme.css +13 -209
- package/tile-control/index.js +0 -24
- package/tile-control-option/index.js +0 -18
- package/time-picker/index.js +2 -51
- package/time-picker/utils.js +0 -18
- package/title/index.js +1 -12
- package/title/utils.js +0 -5
- package/toast/index.js +0 -19
- package/toast-manager/index.js +0 -27
- package/toggle/index.js +0 -23
- package/tooltip/index.js +0 -27
- package/tooltip/utils.js +0 -4
- package/utils/animation.js +0 -20
- package/utils/context.js +0 -6
- package/utils/index.d.ts +1 -0
- package/utils/index.js +11 -52
- package/vertical-stepper/index.js +0 -12
- package/vertical-stepper-item/index.js +0 -14
- package/avatar-badge/index.d.ts +0 -11
- package/avatar-badge/index.js +0 -38
- package/avatar-badge/types.d.ts +0 -8
- package/avatar-status/index.d.ts +0 -11
- package/avatar-status/index.js +0 -37
- package/avatar-status/types.d.ts +0 -9
- package/avatar-status/types.js +0 -1
- package/avatar-status/utils.d.ts +0 -5
- package/avatar-status/utils.js +0 -6
- package/chat-avatar/index.d.ts +0 -12
- package/chat-avatar/index.js +0 -52
- package/chat-avatar/types.d.ts +0 -12
- package/chat-avatar/types.js +0 -1
- /package/{avatar-badge → badge}/types.js +0 -0
package/file-drop/index.js
CHANGED
|
@@ -9,7 +9,6 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
9
9
|
#$filePicker;
|
|
10
10
|
#$dropArea;
|
|
11
11
|
#$placeholder;
|
|
12
|
-
|
|
13
12
|
constructor() {
|
|
14
13
|
super();
|
|
15
14
|
const shadowRoot = this.attachShadow();
|
|
@@ -18,7 +17,6 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
18
17
|
this.#$placeholder = shadowRoot.querySelector('#placeholder');
|
|
19
18
|
this.#$filePicker = shadowRoot.querySelector('#file-picker');
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
connectedCallback() {
|
|
23
21
|
this.addEventListener('-change', this.#onChangeReactHandler);
|
|
24
22
|
this.addEventListener('-invalid', this.#onInvalidReactHandler);
|
|
@@ -29,7 +27,6 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
29
27
|
this.#$filePicker.addEventListener('-change', this.#onFilePickerChange);
|
|
30
28
|
this.#$filePicker.addEventListener('-invalid', this.#onFilePickerInvalid);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
disconnectedCallback() {
|
|
34
31
|
this.removeEventListener('-change', this.#onChangeReactHandler);
|
|
35
32
|
this.removeEventListener('-invalid', this.#onInvalidReactHandler);
|
|
@@ -40,48 +37,40 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
40
37
|
this.#$filePicker.removeEventListener('-change', this.#onFilePickerChange);
|
|
41
38
|
this.#$filePicker.removeEventListener('-invalid', this.#onFilePickerInvalid);
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
static get observedAttributes() {
|
|
45
41
|
return ['accept', 'multiple', 'placeholder', 'disabled', 'invalid', 'size'];
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
49
44
|
if (newVal === oldVal) {
|
|
50
45
|
return;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
47
|
switch (name) {
|
|
54
48
|
case 'multiple':
|
|
55
49
|
{
|
|
56
50
|
updateAttribute(this.#$filePicker, 'multiple', newVal);
|
|
57
51
|
break;
|
|
58
52
|
}
|
|
59
|
-
|
|
60
53
|
case 'accept':
|
|
61
54
|
{
|
|
62
55
|
updateAttribute(this.#$filePicker, 'accept', newVal);
|
|
63
56
|
break;
|
|
64
57
|
}
|
|
65
|
-
|
|
66
58
|
case 'placeholder':
|
|
67
59
|
{
|
|
68
60
|
this.#$placeholder.textContent = newVal;
|
|
69
61
|
break;
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
case 'disabled':
|
|
73
64
|
{
|
|
74
65
|
updateBooleanAttribute(this, 'disabled', isAttrTrue(newVal));
|
|
75
66
|
this.#setDragEffect(false);
|
|
76
67
|
break;
|
|
77
68
|
}
|
|
78
|
-
|
|
79
69
|
case 'invalid':
|
|
80
70
|
{
|
|
81
71
|
updateBooleanAttribute(this, 'invalid', isAttrTrue(newVal));
|
|
82
72
|
break;
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
case 'size':
|
|
86
75
|
{
|
|
87
76
|
updateAttribute(this.#$filePicker, 'size', newVal);
|
|
@@ -89,67 +78,51 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
89
78
|
}
|
|
90
79
|
}
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
set multiple(isMultiple) {
|
|
94
82
|
updateBooleanAttribute(this, 'multiple', isMultiple);
|
|
95
83
|
}
|
|
96
|
-
|
|
97
84
|
get multiple() {
|
|
98
85
|
return getBooleanAttribute(this, 'multiple');
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
set accept(value) {
|
|
102
88
|
updateAttribute(this, 'accept', value);
|
|
103
89
|
}
|
|
104
|
-
|
|
105
90
|
get accept() {
|
|
106
91
|
return getAttribute(this, 'accept');
|
|
107
92
|
}
|
|
108
|
-
|
|
109
93
|
get size() {
|
|
110
94
|
return getIntegerAttribute(this, 'size', null);
|
|
111
95
|
}
|
|
112
|
-
|
|
113
96
|
set size(value) {
|
|
114
97
|
updateAttribute(this, 'size', value);
|
|
115
98
|
}
|
|
116
|
-
|
|
117
99
|
set text(value) {
|
|
118
100
|
updateAttribute(this, 'text', value);
|
|
119
101
|
}
|
|
120
|
-
|
|
121
102
|
get text() {
|
|
122
103
|
return getAttribute(this, 'text', '');
|
|
123
104
|
}
|
|
124
|
-
|
|
125
105
|
set placeholder(value) {
|
|
126
106
|
updateAttribute(this, 'placeholder', value);
|
|
127
107
|
}
|
|
128
|
-
|
|
129
108
|
get placeholder() {
|
|
130
109
|
return getAttribute(this, 'placeholder', '');
|
|
131
110
|
}
|
|
132
|
-
|
|
133
111
|
set disabled(isDisabled) {
|
|
134
112
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
135
113
|
}
|
|
136
|
-
|
|
137
114
|
get disabled() {
|
|
138
115
|
return getBooleanAttribute(this, 'disabled');
|
|
139
116
|
}
|
|
140
|
-
|
|
141
117
|
set invalid(isInvalid) {
|
|
142
118
|
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
143
119
|
}
|
|
144
|
-
|
|
145
120
|
get invalid() {
|
|
146
121
|
return getBooleanAttribute(this, 'invalid');
|
|
147
122
|
}
|
|
148
|
-
|
|
149
123
|
#setDragEffect(shouldEnable) {
|
|
150
124
|
let isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
151
125
|
const isElementEnabled = !this.disabled;
|
|
152
|
-
|
|
153
126
|
if (shouldEnable) {
|
|
154
127
|
if (isElementEnabled) {
|
|
155
128
|
setClass(this.#$dropArea, 'drop', true);
|
|
@@ -160,7 +133,6 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
160
133
|
setClass(this.#$dropArea, 'valid', false);
|
|
161
134
|
}
|
|
162
135
|
}
|
|
163
|
-
|
|
164
136
|
#onDragEnter = e => {
|
|
165
137
|
e.stopPropagation();
|
|
166
138
|
e.preventDefault();
|
|
@@ -181,38 +153,29 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
181
153
|
e.stopPropagation();
|
|
182
154
|
e.preventDefault();
|
|
183
155
|
this.#setDragEffect(false);
|
|
184
|
-
|
|
185
156
|
if (this.disabled) {
|
|
186
157
|
return;
|
|
187
158
|
}
|
|
188
|
-
|
|
189
159
|
const dt = e.dataTransfer;
|
|
190
|
-
|
|
191
160
|
if (dt === null) {
|
|
192
161
|
return;
|
|
193
162
|
}
|
|
194
|
-
|
|
195
163
|
if (dt.files.length === 0) {
|
|
196
164
|
return;
|
|
197
165
|
}
|
|
198
|
-
|
|
199
166
|
if (!this.multiple && dt.files.length > 1) {
|
|
200
167
|
this.#dispatchInvalidEvent('multiple');
|
|
201
168
|
return;
|
|
202
169
|
}
|
|
203
|
-
|
|
204
170
|
const files = Array.from(dt.files);
|
|
205
|
-
|
|
206
171
|
if (!areFilesAccepted(files, this.accept)) {
|
|
207
172
|
this.#dispatchInvalidEvent('accept');
|
|
208
173
|
return;
|
|
209
174
|
}
|
|
210
|
-
|
|
211
175
|
if (!doFilesSatisfySize(files, this.size)) {
|
|
212
176
|
this.#dispatchInvalidEvent('size');
|
|
213
177
|
return;
|
|
214
178
|
}
|
|
215
|
-
|
|
216
179
|
this.#dispatchChangeEvent(files);
|
|
217
180
|
};
|
|
218
181
|
#onFilePickerChange = e => {
|
|
@@ -227,17 +190,14 @@ defineCustomElement('sinch-file-drop', class extends NectaryElement {
|
|
|
227
190
|
#onInvalidReactHandler = e => {
|
|
228
191
|
getReactEventHandler(this, 'on-invalid')?.(e);
|
|
229
192
|
};
|
|
230
|
-
|
|
231
193
|
#dispatchChangeEvent(files) {
|
|
232
194
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
233
195
|
detail: files
|
|
234
196
|
}));
|
|
235
197
|
}
|
|
236
|
-
|
|
237
198
|
#dispatchInvalidEvent(type) {
|
|
238
199
|
this.dispatchEvent(new CustomEvent('-invalid', {
|
|
239
200
|
detail: type
|
|
240
201
|
}));
|
|
241
202
|
}
|
|
242
|
-
|
|
243
203
|
});
|
package/file-drop/utils.js
CHANGED
|
@@ -2,26 +2,21 @@ export const areFilesAccepted = (files, accept) => {
|
|
|
2
2
|
if (accept === null) {
|
|
3
3
|
return true;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
const acceptValues = accept.split(/\s*,\s*/);
|
|
7
6
|
return files.every(file => {
|
|
8
7
|
return acceptValues.some(acceptValue => {
|
|
9
8
|
if (acceptValue.startsWith('.')) {
|
|
10
9
|
return file.name.endsWith(acceptValue);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
if (acceptValue === 'image/*') {
|
|
14
12
|
return file.type.startsWith('image/');
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
if (acceptValue === 'video/*') {
|
|
18
15
|
return file.type.startsWith('video/');
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
if (acceptValue === 'audio/*') {
|
|
22
18
|
return file.type.startsWith('audio/');
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
return acceptValue === file.type;
|
|
26
21
|
});
|
|
27
22
|
});
|
|
@@ -30,7 +25,6 @@ export const doFilesSatisfySize = (files, size) => {
|
|
|
30
25
|
if (size === null || size <= 0) {
|
|
31
26
|
return true;
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
return files.every(file => {
|
|
35
29
|
return file.size <= size;
|
|
36
30
|
});
|
package/file-picker/index.js
CHANGED
|
@@ -7,7 +7,6 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
7
7
|
#$input;
|
|
8
8
|
#$targetSlot;
|
|
9
9
|
#$target = null;
|
|
10
|
-
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
const shadowRoot = this.attachShadow();
|
|
@@ -16,7 +15,6 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
16
15
|
this.#$input.type = 'file';
|
|
17
16
|
this.#$targetSlot = shadowRoot.querySelector('slot');
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
connectedCallback() {
|
|
21
19
|
this.#$targetSlot.addEventListener('slotchange', this.#onTargetSlotChange);
|
|
22
20
|
this.#$input.addEventListener('change', this.#onInputChange);
|
|
@@ -24,7 +22,6 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
24
22
|
this.addEventListener('-invalid', this.#onInvalidReactHandler);
|
|
25
23
|
this.#onTargetSlotChange();
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
disconnectedCallback() {
|
|
29
26
|
this.#$targetSlot.removeEventListener('slotchange', this.#onTargetSlotChange);
|
|
30
27
|
this.#$input.removeEventListener('change', this.#onInputChange);
|
|
@@ -33,47 +30,37 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
33
30
|
this.#$target?.removeEventListener('-click', this.#onTargetClick);
|
|
34
31
|
this.#$target = null;
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
static get observedAttributes() {
|
|
38
34
|
return ['accept', 'multiple'];
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
set multiple(isMultiple) {
|
|
42
37
|
updateBooleanAttribute(this, 'multiple', isMultiple);
|
|
43
38
|
}
|
|
44
|
-
|
|
45
39
|
get multiple() {
|
|
46
40
|
return getBooleanAttribute(this, 'multiple');
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
set accept(value) {
|
|
50
43
|
updateAttribute(this, 'accept', value);
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
get accept() {
|
|
54
46
|
return getAttribute(this, 'accept');
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
get size() {
|
|
58
49
|
return getIntegerAttribute(this, 'size', null);
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
set size(value) {
|
|
62
52
|
updateAttribute(this, 'size', value);
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
66
55
|
if (newVal === oldVal) {
|
|
67
56
|
return;
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
switch (name) {
|
|
71
59
|
case 'multiple':
|
|
72
60
|
{
|
|
73
61
|
updateBooleanAttribute(this.#$input, 'multiple', isAttrTrue(newVal));
|
|
74
62
|
break;
|
|
75
63
|
}
|
|
76
|
-
|
|
77
64
|
case 'accept':
|
|
78
65
|
{
|
|
79
66
|
updateAttribute(this.#$input, 'accept', newVal);
|
|
@@ -81,7 +68,6 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
81
68
|
}
|
|
82
69
|
}
|
|
83
70
|
}
|
|
84
|
-
|
|
85
71
|
#onTargetSlotChange = () => {
|
|
86
72
|
this.#$target?.removeEventListener('-click', this.#onTargetClick);
|
|
87
73
|
this.#$target = getFirstSlotElement(this.#$targetSlot, true);
|
|
@@ -94,16 +80,13 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
94
80
|
if (this.#$input.files === null) {
|
|
95
81
|
return;
|
|
96
82
|
}
|
|
97
|
-
|
|
98
83
|
const files = Array.from(this.#$input.files);
|
|
99
|
-
|
|
100
84
|
if (!doFilesSatisfySize(files, this.size)) {
|
|
101
85
|
this.dispatchEvent(new CustomEvent('-invalid', {
|
|
102
86
|
detail: 'size'
|
|
103
87
|
}));
|
|
104
88
|
return;
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
108
91
|
detail: files
|
|
109
92
|
}));
|
package/file-picker/utils.js
CHANGED
package/file-status/index.js
CHANGED
|
@@ -12,7 +12,6 @@ template.innerHTML = templateHTML;
|
|
|
12
12
|
defineCustomElement('sinch-file-status', class extends NectaryElement {
|
|
13
13
|
#$filename;
|
|
14
14
|
#$contentSlot;
|
|
15
|
-
|
|
16
15
|
constructor() {
|
|
17
16
|
super();
|
|
18
17
|
const shadowRoot = this.attachShadow();
|
|
@@ -20,48 +19,38 @@ defineCustomElement('sinch-file-status', class extends NectaryElement {
|
|
|
20
19
|
this.#$filename = shadowRoot.querySelector('#filename');
|
|
21
20
|
this.#$contentSlot = shadowRoot.querySelector('slot[name="content"]');
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
connectedCallback() {
|
|
25
23
|
this.#$contentSlot.addEventListener('slotchange', this.#onContentSlotChange);
|
|
26
24
|
this.#onContentSlotChange();
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
disconnectedCallback() {
|
|
30
27
|
this.#$contentSlot.removeEventListener('slotchange', this.#onContentSlotChange);
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
get type() {
|
|
34
30
|
return getLiteralAttribute(this, typeValues, 'type');
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
set type(value) {
|
|
38
33
|
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
get filename() {
|
|
42
36
|
return getAttribute(this, 'filename', '');
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
set filename(value) {
|
|
46
39
|
updateAttribute(this, 'filename', value);
|
|
47
40
|
}
|
|
48
|
-
|
|
49
41
|
static get observedAttributes() {
|
|
50
42
|
return ['filename', 'type'];
|
|
51
43
|
}
|
|
52
|
-
|
|
53
44
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
54
45
|
if (oldVal === newVal) {
|
|
55
46
|
return;
|
|
56
47
|
}
|
|
57
|
-
|
|
58
48
|
switch (name) {
|
|
59
49
|
case 'type':
|
|
60
50
|
{
|
|
61
51
|
assertType(newVal);
|
|
62
52
|
break;
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
case 'filename':
|
|
66
55
|
{
|
|
67
56
|
this.#$filename.textContent = newVal;
|
|
@@ -69,7 +58,6 @@ defineCustomElement('sinch-file-status', class extends NectaryElement {
|
|
|
69
58
|
}
|
|
70
59
|
}
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
#onContentSlotChange = () => {
|
|
74
62
|
updateBooleanAttribute(this.#$filename, 'emphasized', this.#$contentSlot.assignedElements().length > 0);
|
|
75
63
|
};
|
package/grid/index.js
CHANGED
package/grid-item/index.js
CHANGED
|
@@ -8,37 +8,28 @@ defineCustomElement('sinch-grid-item', class extends NectaryElement {
|
|
|
8
8
|
const shadowRoot = this.attachShadow();
|
|
9
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
get s() {
|
|
13
12
|
return getIntegerAttribute(this, 's', null);
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
set s(value) {
|
|
17
15
|
updateIntegerAttribute(this, 's', value);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
get m() {
|
|
21
18
|
return getIntegerAttribute(this, 'm', null);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
set m(value) {
|
|
25
21
|
updateIntegerAttribute(this, 'm', value);
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
get l() {
|
|
29
24
|
return getIntegerAttribute(this, 'l', null);
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
set l(value) {
|
|
33
27
|
updateIntegerAttribute(this, 'l', value);
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
get xl() {
|
|
37
30
|
return getIntegerAttribute(this, 'xl', null);
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
set xl(value) {
|
|
41
33
|
updateIntegerAttribute(this, 'xl', value);
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
});
|
package/help-tooltip/index.js
CHANGED
|
@@ -6,60 +6,46 @@ const template = document.createElement('template');
|
|
|
6
6
|
template.innerHTML = templateHTML;
|
|
7
7
|
defineCustomElement('sinch-help-tooltip', class extends NectaryElement {
|
|
8
8
|
#$tooltip;
|
|
9
|
-
|
|
10
9
|
constructor() {
|
|
11
10
|
super();
|
|
12
11
|
const shadowRoot = this.attachShadow();
|
|
13
12
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
13
|
this.#$tooltip = shadowRoot.querySelector('sinch-tooltip');
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
static get observedAttributes() {
|
|
18
16
|
return ['text', 'width', 'orientation', 'inverted'];
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
get text() {
|
|
22
19
|
return getAttribute(this, 'text', '');
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
set text(value) {
|
|
26
22
|
updateAttribute(this, 'text', value);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
get width() {
|
|
30
25
|
return getIntegerAttribute(this, 'width');
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
set width(value) {
|
|
34
28
|
updateIntegerAttribute(this, 'width', value);
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
get inverted() {
|
|
38
31
|
return getBooleanAttribute(this, 'inverted');
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
set inverted(isInverted) {
|
|
42
34
|
updateBooleanAttribute(this, 'inverted', isInverted);
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
get orientation() {
|
|
46
37
|
return getAttribute(this, 'orientation', 'top');
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
set orientation(value) {
|
|
50
40
|
updateAttribute(this, 'orientation', value);
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
get footprintRect() {
|
|
54
43
|
return this.#$tooltip.footprintRect;
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
get tooltipRect() {
|
|
58
46
|
return this.#$tooltip.tooltipRect;
|
|
59
47
|
}
|
|
60
|
-
|
|
61
48
|
attributeChangedCallback(name, _, newVal) {
|
|
62
49
|
updateAttribute(this.#$tooltip, name, newVal);
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
});
|
|
@@ -7,7 +7,6 @@ template.innerHTML = templateHTML;
|
|
|
7
7
|
defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
|
|
8
8
|
#$itemsSlot;
|
|
9
9
|
#$progressBar;
|
|
10
|
-
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
const shadowRoot = this.attachShadow();
|
|
@@ -15,26 +14,21 @@ defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
|
|
|
15
14
|
this.#$itemsSlot = shadowRoot.querySelector('slot');
|
|
16
15
|
this.#$progressBar = shadowRoot.querySelector('#bar');
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
connectedCallback() {
|
|
20
18
|
this.setAttribute('role', 'progressbar');
|
|
21
19
|
this.setAttribute('aria-valuemin', '0');
|
|
22
20
|
this.#$itemsSlot.addEventListener('slotchange', this.#updateItems);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
disconnectedCallback() {
|
|
26
23
|
this.#$itemsSlot.removeEventListener('slotchange', this.#updateItems);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
static get observedAttributes() {
|
|
30
26
|
return ['index'];
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
34
29
|
if (oldVal === newVal) {
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
switch (name) {
|
|
39
33
|
case 'index':
|
|
40
34
|
{
|
|
@@ -43,24 +37,19 @@ defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
|
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
set index(value) {
|
|
48
41
|
updateAttribute(this, 'index', value);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
get index() {
|
|
52
44
|
return getAttribute(this, 'index', '1');
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
#updateItems = () => {
|
|
56
47
|
const $items = this.#$itemsSlot.assignedElements();
|
|
57
48
|
const activeIndex = clampNumber(getIntegerAttribute(this, 'index', 0), 0, $items.length + 1);
|
|
58
|
-
|
|
59
49
|
for (let i = 0; i < $items.length; i++) {
|
|
60
50
|
const $el = $items[i];
|
|
61
51
|
const itemIndex = i + 1;
|
|
62
52
|
$el.setAttribute('data-index', String(itemIndex));
|
|
63
|
-
|
|
64
53
|
if (itemIndex === activeIndex) {
|
|
65
54
|
$el.setAttribute('data-progress', 'active');
|
|
66
55
|
} else if (itemIndex < activeIndex) {
|
|
@@ -69,7 +58,6 @@ defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
|
|
|
69
58
|
$el.removeAttribute('data-progress');
|
|
70
59
|
}
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
const valueIndex = clampNumber(activeIndex - 1, 0, $items.length - 1);
|
|
74
62
|
this.#$progressBar.style.width = `${Math.floor(valueIndex / Math.max(1, $items.length - 1) * 100)}%`;
|
|
75
63
|
this.setAttribute('aria-valuemax', String($items.length));
|
|
@@ -9,7 +9,6 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
|
|
|
9
9
|
#$label;
|
|
10
10
|
#$description;
|
|
11
11
|
#$circleText;
|
|
12
|
-
|
|
13
12
|
constructor() {
|
|
14
13
|
super();
|
|
15
14
|
const shadowRoot = this.attachShadow();
|
|
@@ -18,15 +17,11 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
|
|
|
18
17
|
this.#$description = shadowRoot.querySelector('#description');
|
|
19
18
|
this.#$circleText = shadowRoot.querySelector('#circle-text');
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
connectedCallback() {}
|
|
23
|
-
|
|
24
21
|
disconnectedCallback() {}
|
|
25
|
-
|
|
26
22
|
static get observedAttributes() {
|
|
27
23
|
return ['label', 'description', 'data-index'];
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
31
26
|
switch (name) {
|
|
32
27
|
case 'label':
|
|
@@ -34,13 +29,11 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
|
|
|
34
29
|
this.#$label.textContent = newVal;
|
|
35
30
|
break;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
case 'description':
|
|
39
33
|
{
|
|
40
34
|
this.#$description.textContent = newVal;
|
|
41
35
|
break;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
case 'data-index':
|
|
45
38
|
{
|
|
46
39
|
this.#$circleText.textContent = newVal;
|
|
@@ -48,29 +41,22 @@ defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElemen
|
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
set label(value) {
|
|
53
45
|
updateAttribute(this, 'label', value);
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
get label() {
|
|
57
48
|
return getAttribute(this, 'label', '');
|
|
58
49
|
}
|
|
59
|
-
|
|
60
50
|
set description(value) {
|
|
61
51
|
updateAttribute(this, 'description', value);
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
get description() {
|
|
65
54
|
return getAttribute(this, 'description', '');
|
|
66
55
|
}
|
|
67
|
-
|
|
68
56
|
get status() {
|
|
69
57
|
return getLiteralAttribute(this, statusValues, 'status', null);
|
|
70
58
|
}
|
|
71
|
-
|
|
72
59
|
set status(value) {
|
|
73
60
|
updateLiteralAttribute(this, statusValues, 'status', value);
|
|
74
61
|
}
|
|
75
|
-
|
|
76
62
|
});
|