@nectary/components 0.41.0 → 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 +64 -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/icon-button/index.js
CHANGED
|
@@ -7,7 +7,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
|
7
7
|
#$button;
|
|
8
8
|
#$tooltip;
|
|
9
9
|
#controller = null;
|
|
10
|
-
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
const shadowRoot = this.attachShadow();
|
|
@@ -15,7 +14,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
|
15
14
|
this.#$button = shadowRoot.querySelector('#button');
|
|
16
15
|
this.#$tooltip = shadowRoot.querySelector('#tooltip');
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
connectedCallback() {
|
|
20
18
|
this.#controller = new AbortController();
|
|
21
19
|
const options = {
|
|
@@ -29,15 +27,12 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
|
29
27
|
this.addEventListener('-focus', this.#onFocusReactHandler, options);
|
|
30
28
|
this.addEventListener('-blur', this.#onBlurReactHandler, options);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
disconnectedCallback() {
|
|
34
31
|
this.#controller.abort();
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
static get observedAttributes() {
|
|
38
34
|
return ['disabled', 'aria-label'];
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
attributeChangedCallback(name, _, newVal) {
|
|
42
37
|
switch (name) {
|
|
43
38
|
case 'disabled':
|
|
@@ -47,7 +42,6 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
|
47
42
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
48
43
|
break;
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
case 'aria-label':
|
|
52
46
|
{
|
|
53
47
|
updateAttribute(this.#$tooltip, 'text', newVal);
|
|
@@ -55,39 +49,30 @@ defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
|
-
|
|
59
52
|
set disabled(isDisabled) {
|
|
60
53
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
61
54
|
}
|
|
62
|
-
|
|
63
55
|
get disabled() {
|
|
64
56
|
return getBooleanAttribute(this, 'disabled');
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
set small(isSmall) {
|
|
68
59
|
updateBooleanAttribute(this, 'small', isSmall);
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
get small() {
|
|
72
62
|
return getBooleanAttribute(this, 'small');
|
|
73
63
|
}
|
|
74
|
-
|
|
75
64
|
get tooltipRect() {
|
|
76
65
|
return this.#$tooltip.tooltipRect;
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
get focusable() {
|
|
80
68
|
return true;
|
|
81
69
|
}
|
|
82
|
-
|
|
83
70
|
focus() {
|
|
84
71
|
this.#$button.focus();
|
|
85
72
|
}
|
|
86
|
-
|
|
87
73
|
blur() {
|
|
88
74
|
this.#$button.blur();
|
|
89
75
|
}
|
|
90
|
-
|
|
91
76
|
#onButtonClick = () => {
|
|
92
77
|
this.dispatchEvent(new CustomEvent('-click'));
|
|
93
78
|
};
|
|
@@ -10,10 +10,8 @@ export const createIconClass = templateHTML => {
|
|
|
10
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
11
11
|
this.$svg = shadowRoot.querySelector('svg');
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
connectedCallback() {
|
|
15
14
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
};
|
|
19
17
|
};
|
|
@@ -13,31 +13,24 @@ export const createIconClass = templateHTML => {
|
|
|
13
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
14
|
this.$svg = shadowRoot.querySelector('svg');
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
static get observedAttributes() {
|
|
18
17
|
return ['size'];
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
set size(value) {
|
|
22
20
|
updateAttribute(this, 'size', value);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
get size() {
|
|
26
23
|
return getIntegerAttribute(this, 'size', DEFAULT_SIZE);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
set inverted(isInverted) {
|
|
30
26
|
updateBooleanAttribute(this, 'inverted', isInverted);
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
get inverted() {
|
|
34
29
|
return getBooleanAttribute(this, 'inverted');
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
connectedCallback() {
|
|
38
32
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
attributeChangedCallback(name, _, newVal) {
|
|
42
35
|
switch (name) {
|
|
43
36
|
case 'size':
|
|
@@ -50,6 +43,5 @@ export const createIconClass = templateHTML => {
|
|
|
50
43
|
}
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
};
|
|
55
47
|
};
|
|
@@ -13,23 +13,18 @@ export const createIconClass = templateHTML => {
|
|
|
13
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
14
|
this.$svg = shadowRoot.querySelector('svg');
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
static get observedAttributes() {
|
|
18
17
|
return ['size'];
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
set size(value) {
|
|
22
20
|
updateAttribute(this, 'size', value);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
get size() {
|
|
26
23
|
return getIntegerAttribute(this, 'size', DEFAULT_SIZE);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
connectedCallback() {
|
|
30
26
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
attributeChangedCallback(name, _, newVal) {
|
|
34
29
|
switch (name) {
|
|
35
30
|
case 'size':
|
|
@@ -42,6 +37,5 @@ export const createIconClass = templateHTML => {
|
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
};
|
|
47
41
|
};
|
|
@@ -14,43 +14,33 @@ export const createIllustrationClass = templateHTML => {
|
|
|
14
14
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
15
15
|
this.$svg = shadowRoot.querySelector('svg');
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
static get observedAttributes() {
|
|
19
18
|
return ['size'];
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
set size(value) {
|
|
23
21
|
updateAttribute(this, 'size', value);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
get size() {
|
|
27
24
|
return getIntegerAttribute(this, 'size', DEFAULT_SIZE);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
get background() {
|
|
31
27
|
return getLiteralAttribute(this, backgroundValues, 'background', null);
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
set background(value) {
|
|
35
30
|
updateLiteralAttribute(this, backgroundValues, 'background', value);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
get valign() {
|
|
39
33
|
return getLiteralAttribute(this, valignValues, 'valign', null);
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
set valign(value) {
|
|
43
36
|
updateLiteralAttribute(this, valignValues, 'valign', value);
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
connectedCallback() {
|
|
47
39
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
48
|
-
|
|
49
40
|
if (!this.hasAttribute('size')) {
|
|
50
41
|
updateAttribute(this, 'size', DEFAULT_SIZE);
|
|
51
42
|
}
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
attributeChangedCallback(name, _, newVal) {
|
|
55
45
|
switch (name) {
|
|
56
46
|
case 'size':
|
|
@@ -63,6 +53,5 @@ export const createIllustrationClass = templateHTML => {
|
|
|
63
53
|
}
|
|
64
54
|
}
|
|
65
55
|
}
|
|
66
|
-
|
|
67
56
|
};
|
|
68
57
|
};
|
package/inline-alert/index.js
CHANGED
|
@@ -16,7 +16,6 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
|
|
|
16
16
|
#$closeSlot;
|
|
17
17
|
#$actionWrapper;
|
|
18
18
|
#$actionSlot;
|
|
19
|
-
|
|
20
19
|
constructor() {
|
|
21
20
|
super();
|
|
22
21
|
const shadowRoot = this.attachShadow();
|
|
@@ -28,7 +27,6 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
|
|
|
28
27
|
this.#$actionWrapper = shadowRoot.querySelector('#action');
|
|
29
28
|
this.#$actionSlot = shadowRoot.querySelector('slot[name="action"]');
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
connectedCallback() {
|
|
33
31
|
this.setAttribute('aria-atomic', 'true');
|
|
34
32
|
this.setAttribute('aria-live', 'polite');
|
|
@@ -37,40 +35,31 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
|
|
|
37
35
|
this.#onCloseSlotChange();
|
|
38
36
|
this.#onActionSlotChange();
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
disconnectedCallback() {
|
|
42
39
|
this.#$closeSlot.removeEventListener('slotchange', this.#onCloseSlotChange);
|
|
43
40
|
this.#$actionSlot.removeEventListener('slotchange', this.#onActionSlotChange);
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
get type() {
|
|
47
43
|
return getLiteralAttribute(this, typeValues, 'type');
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
set type(value) {
|
|
51
46
|
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
52
47
|
}
|
|
53
|
-
|
|
54
48
|
get text() {
|
|
55
49
|
return getAttribute(this, 'text', '');
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
set text(value) {
|
|
59
52
|
updateAttribute(this, 'text', value);
|
|
60
53
|
}
|
|
61
|
-
|
|
62
54
|
get caption() {
|
|
63
55
|
return getAttribute(this, 'caption', '');
|
|
64
56
|
}
|
|
65
|
-
|
|
66
57
|
set caption(value) {
|
|
67
58
|
updateAttribute(this, 'caption', value);
|
|
68
59
|
}
|
|
69
|
-
|
|
70
60
|
static get observedAttributes() {
|
|
71
61
|
return ['text', 'caption', 'type'];
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
attributeChangedCallback(name, _, newVal) {
|
|
75
64
|
switch (name) {
|
|
76
65
|
case 'type':
|
|
@@ -78,13 +67,11 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
|
|
|
78
67
|
assertType(newVal);
|
|
79
68
|
break;
|
|
80
69
|
}
|
|
81
|
-
|
|
82
70
|
case 'text':
|
|
83
71
|
{
|
|
84
72
|
this.#$text.textContent = newVal;
|
|
85
73
|
break;
|
|
86
74
|
}
|
|
87
|
-
|
|
88
75
|
case 'caption':
|
|
89
76
|
{
|
|
90
77
|
updateAttribute(this.#$caption, 'text', newVal);
|
|
@@ -92,7 +79,6 @@ defineCustomElement('sinch-inline-alert', class extends NectaryElement {
|
|
|
92
79
|
}
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
|
-
|
|
96
82
|
#onCloseSlotChange = () => {
|
|
97
83
|
setClass(this.#$closeWrapper, 'empty', this.#$closeSlot.assignedElements().length === 0);
|
|
98
84
|
};
|
package/input/index.js
CHANGED
|
@@ -11,7 +11,6 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
11
11
|
#$rightWrapper;
|
|
12
12
|
#cursorPos = null;
|
|
13
13
|
#isPendingDk = false;
|
|
14
|
-
|
|
15
14
|
constructor() {
|
|
16
15
|
super();
|
|
17
16
|
const shadowRoot = this.attachShadow();
|
|
@@ -22,7 +21,6 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
22
21
|
this.#$rightSlot = shadowRoot.querySelector('slot[name="right"]');
|
|
23
22
|
this.#$rightWrapper = shadowRoot.querySelector('#right');
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
connectedCallback() {
|
|
27
25
|
this.setAttribute('role', 'textbox');
|
|
28
26
|
this.#$input.addEventListener('input', this.#onInput);
|
|
@@ -39,7 +37,6 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
39
37
|
this.#onIconSlotChange();
|
|
40
38
|
this.#onRightSlotChange();
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
disconnectedCallback() {
|
|
44
41
|
this.#$input.removeEventListener('input', this.#onInput);
|
|
45
42
|
this.#$input.removeEventListener('compositionstart', this.#onCompositionStart);
|
|
@@ -53,79 +50,60 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
53
50
|
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
54
51
|
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
static get observedAttributes() {
|
|
58
54
|
return ['type', 'value', 'placeholder', 'invalid', 'disabled'];
|
|
59
55
|
}
|
|
60
|
-
|
|
61
56
|
get nodeName() {
|
|
62
57
|
return 'input';
|
|
63
58
|
}
|
|
64
|
-
|
|
65
59
|
set type(value) {
|
|
66
60
|
updateAttribute(this, 'type', value);
|
|
67
61
|
}
|
|
68
|
-
|
|
69
62
|
get type() {
|
|
70
63
|
return getLiteralAttribute(this, inputTypes, 'type', 'text');
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
set value(value) {
|
|
74
66
|
updateAttribute(this, 'value', value);
|
|
75
67
|
}
|
|
76
|
-
|
|
77
68
|
get value() {
|
|
78
69
|
return getAttribute(this, 'value', '');
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
set placeholder(value) {
|
|
82
72
|
updateAttribute(this, 'placeholder', value);
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
get placeholder() {
|
|
86
75
|
return getAttribute(this, 'placeholder');
|
|
87
76
|
}
|
|
88
|
-
|
|
89
77
|
set invalid(isInvalid) {
|
|
90
78
|
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
91
79
|
}
|
|
92
|
-
|
|
93
80
|
get invalid() {
|
|
94
81
|
return getBooleanAttribute(this, 'invalid');
|
|
95
82
|
}
|
|
96
|
-
|
|
97
83
|
set disabled(isDisabled) {
|
|
98
84
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
99
85
|
}
|
|
100
|
-
|
|
101
86
|
get disabled() {
|
|
102
87
|
return getBooleanAttribute(this, 'disabled');
|
|
103
88
|
}
|
|
104
|
-
|
|
105
89
|
get selectionStart() {
|
|
106
90
|
return this.#$input.selectionStart;
|
|
107
91
|
}
|
|
108
|
-
|
|
109
92
|
set selectionStart(value) {
|
|
110
93
|
this.#$input.selectionStart = value;
|
|
111
94
|
}
|
|
112
|
-
|
|
113
95
|
get selectionEnd() {
|
|
114
96
|
return this.#$input.selectionEnd;
|
|
115
97
|
}
|
|
116
|
-
|
|
117
98
|
set selectionEnd(value) {
|
|
118
99
|
this.#$input.selectionEnd = value;
|
|
119
100
|
}
|
|
120
|
-
|
|
121
101
|
get selectionDirection() {
|
|
122
102
|
return this.#$input.selectionDirection;
|
|
123
103
|
}
|
|
124
|
-
|
|
125
104
|
set selectionDirection(value) {
|
|
126
105
|
this.#$input.selectionDirection = value;
|
|
127
106
|
}
|
|
128
|
-
|
|
129
107
|
attributeChangedCallback(name, _, newVal) {
|
|
130
108
|
switch (name) {
|
|
131
109
|
case 'type':
|
|
@@ -133,38 +111,31 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
133
111
|
updateLiteralAttribute(this.#$input, inputTypes, 'type', newVal);
|
|
134
112
|
break;
|
|
135
113
|
}
|
|
136
|
-
|
|
137
114
|
case 'value':
|
|
138
115
|
{
|
|
139
116
|
const nextVal = newVal ?? '';
|
|
140
117
|
const prevVal = this.#$input.value;
|
|
141
|
-
|
|
142
118
|
if (nextVal !== prevVal) {
|
|
143
119
|
const prevCursorPos = this.#$input.selectionEnd;
|
|
144
120
|
const isPrevCursorEnd = prevCursorPos === prevVal.length;
|
|
145
121
|
this.#$input.value = nextVal;
|
|
146
|
-
|
|
147
122
|
if (!isPrevCursorEnd) {
|
|
148
123
|
this.#$input.setSelectionRange(this.#cursorPos, this.#cursorPos);
|
|
149
124
|
}
|
|
150
125
|
}
|
|
151
|
-
|
|
152
126
|
break;
|
|
153
127
|
}
|
|
154
|
-
|
|
155
128
|
case 'placeholder':
|
|
156
129
|
{
|
|
157
130
|
this.#$input.placeholder = newVal ?? '';
|
|
158
131
|
updateAttribute(this, 'aria-placeholder', newVal);
|
|
159
132
|
break;
|
|
160
133
|
}
|
|
161
|
-
|
|
162
134
|
case 'invalid':
|
|
163
135
|
{
|
|
164
136
|
updateExplicitBooleanAttribute(this, 'aria-invalid', isAttrTrue(newVal));
|
|
165
137
|
break;
|
|
166
138
|
}
|
|
167
|
-
|
|
168
139
|
case 'disabled':
|
|
169
140
|
{
|
|
170
141
|
const isDisabled = isAttrTrue(newVal);
|
|
@@ -174,19 +145,15 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
174
145
|
}
|
|
175
146
|
}
|
|
176
147
|
}
|
|
177
|
-
|
|
178
148
|
get focusable() {
|
|
179
149
|
return true;
|
|
180
150
|
}
|
|
181
|
-
|
|
182
151
|
focus() {
|
|
183
152
|
this.#$input.focus();
|
|
184
153
|
}
|
|
185
|
-
|
|
186
154
|
blur() {
|
|
187
155
|
this.#$input.blur();
|
|
188
156
|
}
|
|
189
|
-
|
|
190
157
|
#onCompositionStart = () => {
|
|
191
158
|
this.#isPendingDk = true;
|
|
192
159
|
};
|
|
@@ -197,20 +164,16 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
197
164
|
e.stopPropagation();
|
|
198
165
|
const nextValue = this.#$input.value;
|
|
199
166
|
const prevValue = this.value;
|
|
200
|
-
|
|
201
167
|
if (prevValue !== nextValue) {
|
|
202
168
|
const nextCursorPos = this.#$input.selectionEnd;
|
|
203
|
-
|
|
204
169
|
if (!this.#isPendingDk) {
|
|
205
170
|
this.#$input.value = prevValue;
|
|
206
171
|
const prevCursorPos = this.#cursorPos;
|
|
207
172
|
const isPrevCursorEnd = prevCursorPos === null || prevCursorPos === prevValue.length;
|
|
208
|
-
|
|
209
173
|
if (!isPrevCursorEnd) {
|
|
210
174
|
this.#$input.setSelectionRange(prevCursorPos, prevCursorPos);
|
|
211
175
|
}
|
|
212
176
|
}
|
|
213
|
-
|
|
214
177
|
this.#isPendingDk = false;
|
|
215
178
|
this.#cursorPos = nextCursorPos;
|
|
216
179
|
this.dispatchEvent(new CustomEvent('change', {
|
package/link/index.js
CHANGED
|
@@ -7,7 +7,6 @@ template.innerHTML = templateHTML;
|
|
|
7
7
|
defineCustomElement('sinch-link', class extends NectaryElement {
|
|
8
8
|
#$anchor;
|
|
9
9
|
#$text;
|
|
10
|
-
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
const shadowRoot = this.attachShadow();
|
|
@@ -15,7 +14,6 @@ defineCustomElement('sinch-link', class extends NectaryElement {
|
|
|
15
14
|
this.#$anchor = shadowRoot.querySelector('a');
|
|
16
15
|
this.#$text = shadowRoot.querySelector('#content');
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
connectedCallback() {
|
|
20
18
|
this.setAttribute('role', 'link');
|
|
21
19
|
this.#$anchor.addEventListener('click', this.#onAnchorClick);
|
|
@@ -25,7 +23,6 @@ defineCustomElement('sinch-link', class extends NectaryElement {
|
|
|
25
23
|
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
26
24
|
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
disconnectedCallback() {
|
|
30
27
|
this.#$anchor.removeEventListener('click', this.#onAnchorClick);
|
|
31
28
|
this.#$anchor.removeEventListener('focus', this.#onAnchorFocus);
|
|
@@ -34,77 +31,60 @@ defineCustomElement('sinch-link', class extends NectaryElement {
|
|
|
34
31
|
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
35
32
|
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
get text() {
|
|
39
35
|
return getAttribute(this, 'text', '');
|
|
40
36
|
}
|
|
41
|
-
|
|
42
37
|
set text(value) {
|
|
43
38
|
updateAttribute(this, 'text', value);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
get href() {
|
|
47
41
|
return getAttribute(this, 'href', '');
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
set href(value) {
|
|
51
44
|
updateAttribute(this, 'href', value);
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
set disabled(isDisabled) {
|
|
55
47
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
get disabled() {
|
|
59
50
|
return getBooleanAttribute(this, 'disabled');
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
set external(isExternal) {
|
|
63
53
|
updateBooleanAttribute(this, 'external', isExternal);
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
get external() {
|
|
67
56
|
return getBooleanAttribute(this, 'external');
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
set standalone(isstandalone) {
|
|
71
59
|
updateBooleanAttribute(this, 'standalone', isstandalone);
|
|
72
60
|
}
|
|
73
|
-
|
|
74
61
|
get standalone() {
|
|
75
62
|
return getBooleanAttribute(this, 'standalone');
|
|
76
63
|
}
|
|
77
|
-
|
|
78
64
|
set preventDefault(isPrevented) {
|
|
79
65
|
updateBooleanAttribute(this, 'preventdefault', isPrevented);
|
|
80
66
|
}
|
|
81
|
-
|
|
82
67
|
get preventDefault() {
|
|
83
68
|
return getBooleanAttribute(this, 'preventdefault');
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
static get observedAttributes() {
|
|
87
71
|
return ['text', 'href', 'external'];
|
|
88
72
|
}
|
|
89
|
-
|
|
90
73
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
91
74
|
if (oldVal === newVal) {
|
|
92
75
|
return;
|
|
93
76
|
}
|
|
94
|
-
|
|
95
77
|
switch (name) {
|
|
96
78
|
case 'text':
|
|
97
79
|
{
|
|
98
80
|
this.#$text.textContent = newVal;
|
|
99
81
|
break;
|
|
100
82
|
}
|
|
101
|
-
|
|
102
83
|
case 'href':
|
|
103
84
|
{
|
|
104
85
|
updateAttribute(this.#$anchor, 'href', newVal);
|
|
105
86
|
break;
|
|
106
87
|
}
|
|
107
|
-
|
|
108
88
|
case 'external':
|
|
109
89
|
{
|
|
110
90
|
updateAttribute(this.#$anchor, 'target', isAttrTrue(newVal) ? '_blank' : null);
|
|
@@ -112,24 +92,19 @@ defineCustomElement('sinch-link', class extends NectaryElement {
|
|
|
112
92
|
}
|
|
113
93
|
}
|
|
114
94
|
}
|
|
115
|
-
|
|
116
95
|
get focusable() {
|
|
117
96
|
return true;
|
|
118
97
|
}
|
|
119
|
-
|
|
120
98
|
focus() {
|
|
121
99
|
this.#$anchor.focus();
|
|
122
100
|
}
|
|
123
|
-
|
|
124
101
|
blur() {
|
|
125
102
|
this.#$anchor.blur();
|
|
126
103
|
}
|
|
127
|
-
|
|
128
104
|
#onAnchorClick = e => {
|
|
129
105
|
if (this.preventDefault) {
|
|
130
106
|
e.preventDefault();
|
|
131
107
|
}
|
|
132
|
-
|
|
133
108
|
this.dispatchEvent(new CustomEvent('-click'));
|
|
134
109
|
};
|
|
135
110
|
#onAnchorFocus = () => {
|
package/list/index.js
CHANGED
package/list-item/index.js
CHANGED
|
@@ -9,9 +9,7 @@ defineCustomElement('sinch-list-item', class extends NectaryElement {
|
|
|
9
9
|
const shadowRoot = this.attachShadow();
|
|
10
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
connectedCallback() {
|
|
14
13
|
this.setAttribute('role', 'listitem');
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
});
|
|
@@ -13,37 +13,29 @@ export const createLogoClass = templateHTML => {
|
|
|
13
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
14
|
this.$svg = shadowRoot.querySelector('svg');
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
static get observedAttributes() {
|
|
18
17
|
return ['size'];
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
set size(value) {
|
|
22
20
|
updateAttribute(this, 'size', value);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
get size() {
|
|
26
23
|
return getIntegerAttribute(this, 'size', DEFAULT_SIZE);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
set inverted(isInverted) {
|
|
30
26
|
updateBooleanAttribute(this, 'inverted', isInverted);
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
get inverted() {
|
|
34
29
|
return getBooleanAttribute(this, 'inverted');
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
connectedCallback() {
|
|
38
32
|
if (!this.$svg.hasAttribute('preserveAspectRatio')) {
|
|
39
33
|
this.$svg.setAttribute('preserveAspectRatio', 'xMinYMin meet');
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
if (!this.hasAttribute('size')) {
|
|
43
36
|
this.size = DEFAULT_SIZE;
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
attributeChangedCallback(name, _, newVal) {
|
|
48
40
|
switch (name) {
|
|
49
41
|
case 'size':
|
|
@@ -56,6 +48,5 @@ export const createLogoClass = templateHTML => {
|
|
|
56
48
|
}
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
};
|
|
61
52
|
};
|