@nectary/components 0.38.0 → 0.40.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 +47 -84
- package/accordion/types.d.ts +1 -0
- package/accordion-item/index.js +26 -53
- package/action-menu/index.d.ts +0 -1
- package/action-menu/index.js +179 -223
- package/action-menu/types.d.ts +8 -18
- package/action-menu-option/index.d.ts +1 -0
- package/action-menu-option/index.js +51 -62
- package/action-menu-option/types.d.ts +9 -0
- package/action-menu-option/utils.d.ts +2 -0
- package/action-menu-option/utils.js +3 -0
- package/alert/index.js +6 -20
- package/avatar/index.js +12 -31
- package/avatar-badge/index.js +8 -22
- package/avatar-status/index.js +1 -1
- package/button/index.js +42 -92
- package/card/index.d.ts +2 -0
- package/card/index.js +24 -87
- package/chat-avatar/index.js +8 -22
- package/chat-block/index.js +29 -69
- package/chat-bubble/index.js +6 -20
- package/checkbox/index.js +55 -107
- package/chip/index.d.ts +13 -0
- package/chip/index.js +137 -0
- package/chip/types.d.ts +38 -0
- package/color-menu/index.d.ts +13 -0
- package/color-menu/index.js +464 -0
- package/color-menu/types.d.ts +37 -0
- package/color-swatch/index.d.ts +13 -0
- package/color-swatch/index.js +59 -0
- package/color-swatch/types.d.ts +12 -0
- package/colors.json +57 -49
- package/date-picker/index.js +196 -287
- package/date-picker/types.d.ts +25 -1
- package/dialog/index.d.ts +1 -0
- package/dialog/index.js +72 -143
- package/dropdown-checkbox-option/index.js +6 -20
- package/dropdown-radio-option/index.js +6 -20
- package/field/index.js +25 -63
- package/file-drop/index.js +123 -200
- package/file-picker/index.d.ts +0 -1
- package/file-picker/index.js +55 -108
- package/file-status/index.js +15 -39
- package/help-tooltip/index.js +1 -1
- package/horizontal-stepper/index.js +33 -59
- package/horizontal-stepper-item/index.js +13 -37
- package/icon-button/index.js +39 -84
- package/icons-channel/notify/index.d.ts +11 -0
- package/icons-channel/notify/index.js +4 -0
- package/illustrations/create-illustration-class.js +1 -1
- package/inline-alert/index.js +30 -82
- package/input/index.js +113 -222
- package/link/index.js +46 -96
- package/list-item/index.js +1 -1
- package/package.json +12 -14
- package/pagination/index.js +109 -163
- package/pagination/types.d.ts +1 -0
- package/popover/index.js +224 -294
- package/progress/index.js +9 -28
- package/radio/index.js +103 -169
- package/radio/types.d.ts +1 -0
- package/radio-option/index.js +24 -48
- package/segment/index.js +50 -131
- package/segment-collapse/index.js +24 -49
- package/segment-collapse/types.d.ts +1 -0
- package/segmented-control/index.js +36 -73
- package/segmented-control/types.d.ts +1 -0
- package/segmented-control-option/index.js +41 -87
- package/segmented-icon-control/index.js +47 -84
- package/segmented-icon-control/types.d.ts +1 -0
- package/segmented-icon-control-option/index.js +38 -79
- package/select-button/index.d.ts +13 -0
- package/select-button/index.js +153 -0
- package/select-button/types.d.ts +43 -0
- package/select-menu/index.d.ts +11 -0
- package/select-menu/index.js +346 -0
- package/select-menu/types.d.ts +29 -0
- package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
- package/select-menu-option/index.js +76 -0
- package/{select-option → select-menu-option}/types.d.ts +8 -9
- package/stop-events/index.js +7 -20
- package/table-head-cell/index.js +7 -21
- package/tabs/index.js +103 -165
- package/tabs/types.d.ts +1 -0
- package/tabs-option/index.js +20 -44
- package/tag/index.d.ts +1 -1
- package/tag/index.js +42 -36
- package/tag/types.d.ts +13 -7
- package/textarea/index.js +92 -167
- package/theme.css +80 -49
- package/tile-control/index.js +55 -96
- package/tile-control-option/index.js +40 -86
- package/time-picker/index.js +224 -368
- package/time-picker/types.d.ts +5 -1
- package/title/index.js +6 -20
- package/toast/index.d.ts +17 -0
- package/toast/index.js +115 -0
- package/toast/types.d.ts +28 -0
- package/toast/utils.d.ts +5 -0
- package/toast/utils.js +6 -0
- package/toast-manager/index.d.ts +17 -0
- package/toast-manager/index.js +195 -0
- package/toast-manager/types.d.ts +7 -0
- package/toggle/index.js +55 -108
- package/toggle/types.d.ts +1 -0
- package/types.d.ts +7 -0
- package/utils/colors.d.ts +10 -0
- package/utils/colors.js +121 -0
- package/{utils.d.ts → utils/index.d.ts} +18 -9
- package/{utils.js → utils/index.js} +118 -39
- package/vertical-stepper/index.js +29 -50
- package/vertical-stepper-item/index.js +13 -37
- package/card-button/index.d.ts +0 -11
- package/card-button/index.js +0 -77
- package/card-button/types.d.ts +0 -12
- package/card-link/index.d.ts +0 -12
- package/card-link/index.js +0 -115
- package/card-link/types.d.ts +0 -14
- package/dropdown/index.d.ts +0 -12
- package/dropdown/index.js +0 -415
- package/dropdown/types.d.ts +0 -30
- package/dropdown-text-option/index.js +0 -104
- package/dropdown-text-option/types.d.ts +0 -16
- package/search/index.d.ts +0 -14
- package/search/index.js +0 -523
- package/search/types.d.ts +0 -25
- package/search-option/index.d.ts +0 -11
- package/search-option/index.js +0 -55
- package/search-option/types.d.ts +0 -9
- package/select/index.d.ts +0 -13
- package/select/index.js +0 -316
- package/select/types.d.ts +0 -53
- package/select-option/index.d.ts +0 -11
- package/select-option/index.js +0 -8
- package/tag/utils.d.ts +0 -2
- package/tag/utils.js +0 -1
- package/tag-close/index.d.ts +0 -12
- package/tag-close/index.js +0 -38
- package/tag-close/types.d.ts +0 -3
- package/tag-close/types.js +0 -1
- /package/{card-button → chip}/types.js +0 -0
- /package/{card-link → color-menu}/types.js +0 -0
- /package/{dropdown-text-option → color-swatch}/types.js +0 -0
- /package/{dropdown → select-button}/types.js +0 -0
- /package/{search → select-menu}/types.js +0 -0
- /package/{search-option → select-menu-option}/types.js +0 -0
- /package/{select → toast}/types.js +0 -0
- /package/{select-option → toast-manager}/types.js +0 -0
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchActionMenuOptionElement = HTMLElement & {
|
|
3
|
+
/** Display text */
|
|
3
4
|
text: string;
|
|
5
|
+
/** Disabled state */
|
|
4
6
|
disabled: boolean;
|
|
7
|
+
/** Click event */
|
|
5
8
|
addEventListener(type: '-click', listener: (e: CustomEvent<void>) => void): void;
|
|
9
|
+
/** Display text */
|
|
6
10
|
setAttribute(name: 'text', value: string): void;
|
|
11
|
+
/** Disabled state */
|
|
7
12
|
setAttribute(name: 'disabled', value: ''): void;
|
|
8
13
|
};
|
|
9
14
|
export declare type TSinchActionMenuOptionReact = TSinchElementReact<TSinchActionMenuOptionElement> & {
|
|
15
|
+
/** Display text */
|
|
10
16
|
text: string;
|
|
17
|
+
/** Disabled state */
|
|
11
18
|
disabled?: boolean;
|
|
19
|
+
/** Label that is used for a11y */
|
|
12
20
|
'aria-label': string;
|
|
21
|
+
/** Click event handler */
|
|
13
22
|
'on-click'?: (e: CustomEvent<void>) => void;
|
|
14
23
|
};
|
package/alert/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
import '../icons/report-problem';
|
|
11
2
|
import '../icons/report';
|
|
12
3
|
import '../icons/info';
|
|
@@ -16,19 +7,14 @@ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-dire
|
|
|
16
7
|
import { assertType, typeValues } from './utils';
|
|
17
8
|
const template = document.createElement('template');
|
|
18
9
|
template.innerHTML = templateHTML;
|
|
19
|
-
defineCustomElement('sinch-alert',
|
|
10
|
+
defineCustomElement('sinch-alert', class extends NectaryElement {
|
|
11
|
+
#$text;
|
|
12
|
+
|
|
20
13
|
constructor() {
|
|
21
14
|
super();
|
|
22
|
-
|
|
23
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
|
|
28
15
|
const shadowRoot = this.attachShadow();
|
|
29
16
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
30
|
-
|
|
31
|
-
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
17
|
+
this.#$text = shadowRoot.querySelector('#text');
|
|
32
18
|
}
|
|
33
19
|
|
|
34
20
|
connectedCallback() {
|
|
@@ -65,10 +51,10 @@ defineCustomElement('sinch-alert', (_$text = new WeakMap(), class extends Nectar
|
|
|
65
51
|
|
|
66
52
|
case 'text':
|
|
67
53
|
{
|
|
68
|
-
|
|
54
|
+
this.#$text.textContent = newVal;
|
|
69
55
|
break;
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
59
|
|
|
74
|
-
})
|
|
60
|
+
});
|
package/avatar/index.js
CHANGED
|
@@ -1,41 +1,22 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$text, _$image;
|
|
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
1
|
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:40px;height:40px;
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:40px;height:40px;background-color:var(--sinch-color-snow-100);border-radius:50%;--sinch-avatar-badge-size:16px;--sinch-avatar-badge-font:700 12px/14px "Gilroy","Arial","sans-serif"}#circle{position:relative;width:calc(100% - 2px);height:calc(100% - 2px);left:1px;top:1px;border-radius:50%;-webkit-mask:linear-gradient(#fff,#000);mask:linear-gradient(#fff,#000)}#text{display:block;width:100%;height:100%;font:var(--sinch-font-title-s);line-height:38px;text-transform:uppercase;text-align:center;background-color:var(--sinch-color-snow-700);color:var(--sinch-color-text-default)}:host([background=blue]) #text{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}:host([background=yellow]) #text{background-color:var(--sinch-color-honey-500)}:host([size="l"]) #wrapper{width:56px;height:56px;--sinch-avatar-badge-size:20px;--sinch-avatar-badge-font:700 12px/18px "Gilroy","Arial","sans-serif"}:host([size="l"]) #text{font:var(--sinch-font-title-m);line-height:54px}:host([size="s"]) #wrapper{width:24px;height:24px;--sinch-avatar-badge-size:11px;--sinch-avatar-badge-font:500 8px/9px "Gilroy","Arial","sans-serif"}:host([size="s"]) #text{font:var(--sinch-font-extra-small-text);line-height:22px}#image{display:none;position:absolute;left:0;top:0;width:100%;height:100%;object-fit:contain}:host([src]:not([src=""])) #image{display:block}::slotted(sinch-avatar-badge){position:absolute;top:-1px;left:calc(100% - 16px)}:host([size="l"]) ::slotted(sinch-avatar-badge){left:calc(100% - 20px)}:host([size="s"]) ::slotted(sinch-avatar-badge){left:calc(100% - 10px)}::slotted(sinch-avatar-status){position:absolute;bottom:-1px;right:-1px}:host([size="l"]) ::slotted(sinch-avatar-status){bottom:3px;right:3px}</style><div id="wrapper"><div id="circle"><span id="text"></span><img id="image" alt=""/></div><slot name="badge"></slot><slot name="status"></slot></div>';
|
|
12
3
|
import { backgroundValues, sizeValues } from './utils';
|
|
13
4
|
const template = document.createElement('template');
|
|
14
5
|
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-avatar',
|
|
6
|
+
defineCustomElement('sinch-avatar', class extends NectaryElement {
|
|
7
|
+
#$text;
|
|
8
|
+
#$image;
|
|
9
|
+
|
|
16
10
|
constructor() {
|
|
17
11
|
super();
|
|
18
|
-
|
|
19
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
_classPrivateFieldInitSpec(this, _$image, {
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
|
|
29
12
|
const shadowRoot = this.attachShadow();
|
|
30
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_classPrivateFieldSet(this, _$image, shadowRoot.querySelector('#image'));
|
|
14
|
+
this.#$text = shadowRoot.querySelector('#text');
|
|
15
|
+
this.#$image = shadowRoot.querySelector('#image');
|
|
35
16
|
}
|
|
36
17
|
|
|
37
18
|
get src() {
|
|
38
|
-
return getAttribute(this, 'src'
|
|
19
|
+
return getAttribute(this, 'src');
|
|
39
20
|
}
|
|
40
21
|
|
|
41
22
|
set src(value) {
|
|
@@ -74,17 +55,17 @@ defineCustomElement('sinch-avatar', (_$text = new WeakMap(), _$image = new WeakM
|
|
|
74
55
|
switch (name) {
|
|
75
56
|
case 'alt':
|
|
76
57
|
{
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
this.#$text.textContent = newVal;
|
|
59
|
+
this.#$image.alt = newVal ?? '';
|
|
79
60
|
break;
|
|
80
61
|
}
|
|
81
62
|
|
|
82
63
|
case 'src':
|
|
83
64
|
{
|
|
84
|
-
|
|
65
|
+
this.#$image.src = newVal ?? '';
|
|
85
66
|
break;
|
|
86
67
|
}
|
|
87
68
|
}
|
|
88
69
|
}
|
|
89
70
|
|
|
90
|
-
})
|
|
71
|
+
});
|
package/avatar-badge/index.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
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
1
|
import { defineCustomElement, getAttribute, NectaryElement, setClass, updateAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{width:fit-content;background-color:var(--sinch-color-snow-100);border-radius:calc(var(--sinch-avatar-badge-size)/ 2);padding:1px;box-sizing:border-box}#text{width:calc(var(--sinch-avatar-badge-size) - 2px);height:calc(var(--sinch-avatar-badge-size) - 2px);font:var(--sinch-avatar-badge-font);color:var(--sinch-color-snow-100);text-align:center;background-color:var(--sinch-color-raspberry-500);border-radius:calc(var(--sinch-avatar-badge-size)/ 2 - 1px)}#text.long{width:fit-content;padding:0 calc(var(--sinch-avatar-badge-size)/ 4)}</style><div id="wrapper"><div id="text"></div></div>';
|
|
12
3
|
const template = document.createElement('template');
|
|
13
4
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-avatar-badge',
|
|
5
|
+
defineCustomElement('sinch-avatar-badge', class extends NectaryElement {
|
|
6
|
+
#$text;
|
|
7
|
+
|
|
15
8
|
constructor() {
|
|
16
9
|
super();
|
|
17
|
-
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
|
|
23
10
|
const shadowRoot = this.attachShadow();
|
|
24
11
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
25
|
-
|
|
26
|
-
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
12
|
+
this.#$text = shadowRoot.querySelector('#text');
|
|
27
13
|
}
|
|
28
14
|
|
|
29
15
|
get text() {
|
|
@@ -42,11 +28,11 @@ defineCustomElement('sinch-avatar-badge', (_$text = new WeakMap(), class extends
|
|
|
42
28
|
switch (name) {
|
|
43
29
|
case 'text':
|
|
44
30
|
{
|
|
45
|
-
|
|
46
|
-
setClass(
|
|
31
|
+
this.#$text.textContent = newVal;
|
|
32
|
+
setClass(this.#$text, 'long', newVal !== null && newVal.length > 1);
|
|
47
33
|
break;
|
|
48
34
|
}
|
|
49
35
|
}
|
|
50
36
|
}
|
|
51
37
|
|
|
52
|
-
})
|
|
38
|
+
});
|
package/avatar-status/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{width:10px;height:10px;padding:1px;box-sizing:border-box;border-radius:50%;background-color:var(--sinch-color-snow-100)}#circle{width:8px;height:8px;border-radius:50%}:host([color=grey]) #circle{background-color:var(--sinch-color-snow-600)}:host([color=yellow]) #circle{background-color:var(--sinch-color-honey-500)}:host([color=red]) #circle{background-color:var(--sinch-color-raspberry-500)}:host([color=green]) #circle{background-color:var(--sinch-color-grass-400)}</style><div id="wrapper"><div id="circle"></div></div>';
|
|
3
3
|
import { assertColor, colorValues } from './utils';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
package/button/index.js
CHANGED
|
@@ -1,105 +1,37 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$button, _$text, _onButtonClick, _onButtonFocus, _onButtonBlur, _onFocusReactHandler, _onBlurReactHandler, _onClickReactHandler;
|
|
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
1
|
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, isAttrTrue, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, getReactEventHandler } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{--sinch-button-color-background:var(--sinch-color-tropical-500);--sinch-button-color-background-hover:var(--sinch-color-tropical-400);--sinch-button-color-background-active:var(--sinch-color-tropical-600);--sinch-button-color-background-disabled:var(--sinch-color-tropical-100);--sinch-button-color-border:var(--sinch-color-transparent);--sinch-button-color-border-disabled:var(--sinch-color-transparent);--sinch-button-color-text:var(--sinch-color-snow-100);--sinch-button-color-text-disabled:var(--sinch-color-snow-100);--sinch-button-shape-radius:var(--sinch-shape-radius-l);display:inline-block;vertical-align:middle;outline:0}#button{--sinch-color-icon:var(--sinch-button-color-text);--sinch-color-spinner-bg:var(--sinch-color-tropical-300);--sinch-color-spinner-fg:var(--sinch-color-snow-100)}#button:disabled{--sinch-color-icon:var(--sinch-button-color-text-disabled);--sinch-color-spinner-bg:var(--sinch-color-snow-100);--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([small]:not([small=false])){--sinch-button-shape-radius:var(--sinch-shape-radius-m)}:host([type=secondary]){--sinch-button-color-background:var(--sinch-color-snow-100);--sinch-button-color-background-hover:var(--sinch-color-tropical-100);--sinch-button-color-background-active:var(--sinch-color-tropical-100);--sinch-button-color-background-disabled:var(--sinch-color-snow-100);--sinch-button-color-border:var(--sinch-color-tropical-500);--sinch-button-color-border-disabled:var(--sinch-color-tropical-200);--sinch-button-color-text:var(--sinch-color-tropical-500);--sinch-button-color-text-disabled:var(--sinch-color-tropical-200)}:host([type=secondary])>#button{--sinch-color-spinner-bg:var(--sinch-color-tropical-500);--sinch-color-spinner-fg:var(--sinch-color-tropical-100)}:host([type=secondary]) #button:enabled:active,:host([type=secondary]) #button:enabled:hover{--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([type=secondary]) #button:disabled{--sinch-color-spinner-bg:var(--sinch-color-tropical-200)}:host([type=cta-primary]){--sinch-button-color-background:var(--sinch-color-honey-500);--sinch-button-color-background-hover:var(--sinch-color-honey-400);--sinch-button-color-background-active:var(--sinch-color-honey-600);--sinch-button-color-background-disabled:var(--sinch-color-honey-200);--sinch-button-color-text:var(--sinch-color-stormy-500);--sinch-button-color-text-disabled:var(--sinch-color-stormy-300)}:host([type=cta-primary])>#button{--sinch-color-spinner-bg:var(--sinch-color-honey-700);--sinch-color-spinner-fg:var(--sinch-color-stormy-500)}:host([type=cta-primary])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-honey-100);--sinch-color-spinner-fg:var(--sinch-color-stormy-300)}:host([type=cta-secondary]){--sinch-button-color-background:transparent;--sinch-button-color-background-hover
|
|
2
|
+
const templateHTML = '<style>:host{--sinch-button-color-background:var(--sinch-color-tropical-500);--sinch-button-color-background-hover:var(--sinch-color-tropical-400);--sinch-button-color-background-active:var(--sinch-color-tropical-600);--sinch-button-color-background-disabled:var(--sinch-color-tropical-100);--sinch-button-color-border:var(--sinch-color-transparent);--sinch-button-color-border-disabled:var(--sinch-color-transparent);--sinch-button-color-text:var(--sinch-color-snow-100);--sinch-button-color-text-disabled:var(--sinch-color-snow-100);--sinch-button-shape-radius:var(--sinch-shape-radius-l);display:inline-block;vertical-align:middle;outline:0}#button{--sinch-color-icon:var(--sinch-button-color-text);--sinch-color-spinner-bg:var(--sinch-color-tropical-300);--sinch-color-spinner-fg:var(--sinch-color-snow-100)}#button:disabled{--sinch-color-icon:var(--sinch-button-color-text-disabled);--sinch-color-spinner-bg:var(--sinch-color-snow-100);--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([small]:not([small=false])){--sinch-button-shape-radius:var(--sinch-shape-radius-m)}:host([type=secondary]){--sinch-button-color-background:var(--sinch-color-snow-100);--sinch-button-color-background-hover:var(--sinch-color-tropical-100);--sinch-button-color-background-active:var(--sinch-color-tropical-100);--sinch-button-color-background-disabled:var(--sinch-color-snow-100);--sinch-button-color-border:var(--sinch-color-tropical-500);--sinch-button-color-border-disabled:var(--sinch-color-tropical-200);--sinch-button-color-text:var(--sinch-color-tropical-500);--sinch-button-color-text-disabled:var(--sinch-color-tropical-200)}:host([type=secondary])>#button{--sinch-color-spinner-bg:var(--sinch-color-tropical-500);--sinch-color-spinner-fg:var(--sinch-color-tropical-100)}:host([type=secondary]) #button:enabled:active,:host([type=secondary]) #button:enabled:hover{--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([type=secondary]) #button:disabled{--sinch-color-spinner-bg:var(--sinch-color-tropical-200)}:host([type=cta-primary]){--sinch-button-color-background:var(--sinch-color-honey-500);--sinch-button-color-background-hover:var(--sinch-color-honey-400);--sinch-button-color-background-active:var(--sinch-color-honey-600);--sinch-button-color-background-disabled:var(--sinch-color-honey-200);--sinch-button-color-text:var(--sinch-color-stormy-500);--sinch-button-color-text-disabled:var(--sinch-color-stormy-300)}:host([type=cta-primary])>#button{--sinch-color-spinner-bg:var(--sinch-color-honey-700);--sinch-color-spinner-fg:var(--sinch-color-stormy-500)}:host([type=cta-primary])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-honey-100);--sinch-color-spinner-fg:var(--sinch-color-stormy-300)}:host([type=cta-secondary]){--sinch-button-color-background:transparent;--sinch-button-color-background-hover:#F1F3F4;--sinch-button-color-background-active:#E3E6E8;--sinch-button-color-background-disabled:transparent;--sinch-button-color-text:var(--sinch-color-stormy-500);--sinch-button-color-text-disabled:var(--sinch-color-stormy-100);--sinch-button-color-border:var(--sinch-color-stormy-500);--sinch-button-color-border-disabled:var(--sinch-color-stormy-100)}:host([type=cta-secondary])>#button{--sinch-color-spinner-bg:var(--sinch-color-snow-700);--sinch-color-spinner-fg:var(--sinch-color-stormy-500)}:host([type=cta-secondary])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-snow-500);--sinch-color-spinner-fg:var(--sinch-color-stormy-100)}:host([type=cta-secondary])>#button::before{mix-blend-mode:multiply}:host([type=destructive]){--sinch-button-color-background:var(--sinch-color-snow-100);--sinch-button-color-background-hover:var(--sinch-color-raspberry-100);--sinch-button-color-background-active:var(--sinch-color-raspberry-100);--sinch-button-color-background-disabled:var(--sinch-color-snow-100);--sinch-button-color-text:var(--sinch-color-raspberry-500);--sinch-button-color-text-disabled:var(--sinch-color-raspberry-200);--sinch-button-color-border:var(--sinch-color-raspberry-500);--sinch-button-color-border-disabled:var(--sinch-color-raspberry-200)}:host([type=destructive])>#button{--sinch-color-spinner-bg:var(--sinch-color-raspberry-100);--sinch-color-spinner-fg:var(--sinch-color-raspberry-500)}:host([type=destructive])>#button:enabled:active,:host([type=destructive])>#button:enabled:hover{--sinch-color-spinner-bg:var(--sinch-color-raspberry-200);--sinch-color-spinner-fg:var(--sinch-color-raspberry-500)}:host([type=destructive])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-raspberry-100);--sinch-color-spinner-fg:var(--sinch-color-raspberry-200)}#button{all:initial;display:block;position:relative;width:100%;height:48px;font:var(--sinch-font-title-s);color:var(--sinch-button-color-text);cursor:pointer;--sinch-size-icon:24px}#button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-button-color-border);border-radius:var(--sinch-button-shape-radius);background-color:var(--sinch-button-color-background);box-shadow:var(--sinch-elevation-level-1);pointer-events:none}#button:focus-visible::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-button-shape-radius) + 4px);pointer-events:none}@supports not selector(:focus-visible){#button:focus::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-button-shape-radius) + 4px);pointer-events:none}}#button:enabled:hover::before{background-color:var(--sinch-button-color-background-hover)}#button:enabled:active::before{background-color:var(--sinch-button-color-background-active);border-width:2px;box-shadow:var(--sinch-elevation-level-0)}#button:disabled{color:var(--sinch-button-color-text-disabled);cursor:initial}#button:disabled::before{background-color:var(--sinch-button-color-background-disabled);border-color:var(--sinch-button-color-border-disabled)}:host([type=cta-primary])>#button::before,:host([type=primary])>#button::before{border-width:0}#content{position:relative;display:flex;align-items:center;justify-content:center;gap:12px;width:100%;height:100%;padding:0 16px;box-sizing:border-box;pointer-events:none}:host([small]:not([small=false]))>#button{font:var(--sinch-font-title-xs);height:32px;--sinch-size-icon:16px}:host([small]:not([small=false])) #content{padding:0 12px;gap:8px}#text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0}</style><button id="button"><div id="content"><slot name="left-icon"></slot><span id="text"></span><slot name="right-icon"></slot></div></button>';
|
|
12
3
|
import { buttonTypes } from './utils';
|
|
13
4
|
const template = document.createElement('template');
|
|
14
5
|
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-button',
|
|
6
|
+
defineCustomElement('sinch-button', class extends NectaryElement {
|
|
7
|
+
#$button;
|
|
8
|
+
#$text;
|
|
9
|
+
|
|
16
10
|
constructor() {
|
|
17
11
|
super();
|
|
18
|
-
|
|
19
|
-
_classPrivateFieldInitSpec(this, _$button, {
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
_classPrivateFieldInitSpec(this, _onButtonClick, {
|
|
30
|
-
writable: true,
|
|
31
|
-
value: () => {
|
|
32
|
-
this.dispatchEvent(new CustomEvent('-click'));
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
_classPrivateFieldInitSpec(this, _onButtonFocus, {
|
|
37
|
-
writable: true,
|
|
38
|
-
value: () => {
|
|
39
|
-
this.dispatchEvent(new CustomEvent('-focus'));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
_classPrivateFieldInitSpec(this, _onButtonBlur, {
|
|
44
|
-
writable: true,
|
|
45
|
-
value: () => {
|
|
46
|
-
this.dispatchEvent(new CustomEvent('-blur'));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
_classPrivateFieldInitSpec(this, _onFocusReactHandler, {
|
|
51
|
-
writable: true,
|
|
52
|
-
value: () => {
|
|
53
|
-
getReactEventHandler(this, 'on-focus')?.();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
_classPrivateFieldInitSpec(this, _onBlurReactHandler, {
|
|
58
|
-
writable: true,
|
|
59
|
-
value: () => {
|
|
60
|
-
getReactEventHandler(this, 'on-blur')?.();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
_classPrivateFieldInitSpec(this, _onClickReactHandler, {
|
|
65
|
-
writable: true,
|
|
66
|
-
value: e => {
|
|
67
|
-
getReactEventHandler(this, 'on-click')?.(e);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
12
|
const shadowRoot = this.attachShadow();
|
|
72
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
14
|
+
this.#$button = shadowRoot.querySelector('#button');
|
|
15
|
+
this.#$text = shadowRoot.querySelector('#text');
|
|
77
16
|
}
|
|
78
17
|
|
|
79
18
|
connectedCallback() {
|
|
80
19
|
this.setAttribute('role', 'button');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.addEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
89
|
-
this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
90
|
-
this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
20
|
+
this.#$button.addEventListener('click', this.#onButtonClick);
|
|
21
|
+
this.#$button.addEventListener('focus', this.#onButtonFocus);
|
|
22
|
+
this.#$button.addEventListener('blur', this.#onButtonBlur);
|
|
23
|
+
this.addEventListener('-click', this.#onClickReactHandler);
|
|
24
|
+
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
25
|
+
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
91
26
|
}
|
|
92
27
|
|
|
93
28
|
disconnectedCallback() {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.removeEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
101
|
-
this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
102
|
-
this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
29
|
+
this.#$button.removeEventListener('click', this.#onButtonClick);
|
|
30
|
+
this.#$button.removeEventListener('focus', this.#onButtonFocus);
|
|
31
|
+
this.#$button.removeEventListener('blur', this.#onButtonBlur);
|
|
32
|
+
this.removeEventListener('-click', this.#onClickReactHandler);
|
|
33
|
+
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
34
|
+
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
103
35
|
}
|
|
104
36
|
|
|
105
37
|
static get observedAttributes() {
|
|
@@ -110,14 +42,14 @@ defineCustomElement('sinch-button', (_$button = new WeakMap(), _$text = new Weak
|
|
|
110
42
|
switch (name) {
|
|
111
43
|
case 'text':
|
|
112
44
|
{
|
|
113
|
-
|
|
45
|
+
this.#$text.textContent = newVal;
|
|
114
46
|
break;
|
|
115
47
|
}
|
|
116
48
|
|
|
117
49
|
case 'disabled':
|
|
118
50
|
{
|
|
119
51
|
const isDisabled = isAttrTrue(newVal);
|
|
120
|
-
|
|
52
|
+
this.#$button.disabled = isDisabled;
|
|
121
53
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
122
54
|
break;
|
|
123
55
|
}
|
|
@@ -157,11 +89,29 @@ defineCustomElement('sinch-button', (_$button = new WeakMap(), _$text = new Weak
|
|
|
157
89
|
}
|
|
158
90
|
|
|
159
91
|
focus() {
|
|
160
|
-
|
|
92
|
+
this.#$button.focus();
|
|
161
93
|
}
|
|
162
94
|
|
|
163
95
|
blur() {
|
|
164
|
-
|
|
96
|
+
this.#$button.blur();
|
|
165
97
|
}
|
|
166
98
|
|
|
167
|
-
|
|
99
|
+
#onButtonClick = () => {
|
|
100
|
+
this.dispatchEvent(new CustomEvent('-click'));
|
|
101
|
+
};
|
|
102
|
+
#onButtonFocus = () => {
|
|
103
|
+
this.dispatchEvent(new CustomEvent('-focus'));
|
|
104
|
+
};
|
|
105
|
+
#onButtonBlur = () => {
|
|
106
|
+
this.dispatchEvent(new CustomEvent('-blur'));
|
|
107
|
+
};
|
|
108
|
+
#onFocusReactHandler = () => {
|
|
109
|
+
getReactEventHandler(this, 'on-focus')?.();
|
|
110
|
+
};
|
|
111
|
+
#onBlurReactHandler = () => {
|
|
112
|
+
getReactEventHandler(this, 'on-blur')?.();
|
|
113
|
+
};
|
|
114
|
+
#onClickReactHandler = e => {
|
|
115
|
+
getReactEventHandler(this, 'on-click')?.(e);
|
|
116
|
+
};
|
|
117
|
+
});
|
package/card/index.d.ts
CHANGED
package/card/index.js
CHANGED
|
@@ -1,92 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
var _$text, _$label, _$caption, _$illustrationSlot, _$actionSlot, _$illustrationSlotWrapper, _onIllustrationSlotChange, _updateDisabledAttributeInChildren;
|
|
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
|
-
|
|
1
|
+
import '../title';
|
|
2
|
+
import '../text';
|
|
10
3
|
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, setClass, NectaryElement } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{
|
|
4
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{color:var(--sinch-color-stormy-300)}#label:empty{display:none}#header{display:flex;flex-direction:row;align-items:center;gap:8px;--sinch-size-icon:48px}#caption{color:var(--sinch-color-stormy-500);flex:1;min-width:0}#description{color:var(--sinch-color-stormy-500);flex:1;min-height:0;max-height:120px;overflow-y:auto}#description:empty{display:none}:host([disabled]:not([disabled=false])) :is(#illustration-wrapper,#description,#header,#label){opacity:.6}slot[name=action]::slotted(*){margin-top:20px;align-self:flex-start;max-width:100%}</style><div id="wrapper"><div id="illustration-wrapper"><slot name="illustration"></slot></div><div id="card-body"><sinch-text id="label" type="s" emphasized ellipsis></sinch-text><div id="header"><slot name="icon"></slot><sinch-title id="caption" type="m" level="3" ellipsis></sinch-title></div><sinch-text id="description" type="m"></sinch-text><slot name="action"></slot></div></div>';
|
|
12
5
|
const template = document.createElement('template');
|
|
13
6
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-card',
|
|
7
|
+
defineCustomElement('sinch-card', class extends NectaryElement {
|
|
8
|
+
#$text;
|
|
9
|
+
#$label;
|
|
10
|
+
#$caption;
|
|
11
|
+
#$illustrationSlot;
|
|
12
|
+
#$illustrationSlotWrapper;
|
|
13
|
+
|
|
15
14
|
constructor() {
|
|
16
15
|
super();
|
|
17
|
-
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
_classPrivateFieldInitSpec(this, _$label, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
_classPrivateFieldInitSpec(this, _$caption, {
|
|
29
|
-
writable: true,
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
_classPrivateFieldInitSpec(this, _$illustrationSlot, {
|
|
34
|
-
writable: true,
|
|
35
|
-
value: void 0
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
_classPrivateFieldInitSpec(this, _$actionSlot, {
|
|
39
|
-
writable: true,
|
|
40
|
-
value: void 0
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
_classPrivateFieldInitSpec(this, _$illustrationSlotWrapper, {
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
_classPrivateFieldInitSpec(this, _onIllustrationSlotChange, {
|
|
49
|
-
writable: true,
|
|
50
|
-
value: () => {
|
|
51
|
-
setClass(_classPrivateFieldGet(this, _$illustrationSlotWrapper), 'active', _classPrivateFieldGet(this, _$illustrationSlot).assignedElements().length > 0);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
_classPrivateFieldInitSpec(this, _updateDisabledAttributeInChildren, {
|
|
56
|
-
writable: true,
|
|
57
|
-
value: () => {
|
|
58
|
-
for (const $el of _classPrivateFieldGet(this, _$actionSlot).assignedElements()) {
|
|
59
|
-
updateAttribute($el, 'disabled', this.getAttribute('disabled'));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
16
|
const shadowRoot = this.attachShadow();
|
|
65
17
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_classPrivateFieldSet(this, _$caption, shadowRoot.querySelector('#caption'));
|
|
72
|
-
|
|
73
|
-
_classPrivateFieldSet(this, _$illustrationSlot, shadowRoot.querySelector('slot[name="illustration"]'));
|
|
74
|
-
|
|
75
|
-
_classPrivateFieldSet(this, _$actionSlot, shadowRoot.querySelector('slot[name="action"]'));
|
|
76
|
-
|
|
77
|
-
_classPrivateFieldSet(this, _$illustrationSlotWrapper, shadowRoot.querySelector('#illustration-wrapper'));
|
|
18
|
+
this.#$text = shadowRoot.querySelector('#description');
|
|
19
|
+
this.#$label = shadowRoot.querySelector('#label');
|
|
20
|
+
this.#$caption = shadowRoot.querySelector('#caption');
|
|
21
|
+
this.#$illustrationSlot = shadowRoot.querySelector('slot[name="illustration"]');
|
|
22
|
+
this.#$illustrationSlotWrapper = shadowRoot.querySelector('#illustration-wrapper');
|
|
78
23
|
}
|
|
79
24
|
|
|
80
25
|
connectedCallback() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_classPrivateFieldGet(this, _$actionSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
|
|
26
|
+
this.#$illustrationSlot.addEventListener('slotchange', this.#onIllustrationSlotChange);
|
|
84
27
|
}
|
|
85
28
|
|
|
86
29
|
disconnectedCallback() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
_classPrivateFieldGet(this, _$actionSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
|
|
30
|
+
this.#$illustrationSlot.removeEventListener('slotchange', this.#onIllustrationSlotChange);
|
|
90
31
|
}
|
|
91
32
|
|
|
92
33
|
static get observedAttributes() {
|
|
@@ -97,26 +38,19 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
97
38
|
switch (name) {
|
|
98
39
|
case 'text':
|
|
99
40
|
{
|
|
100
|
-
|
|
41
|
+
this.#$text.textContent = newVal;
|
|
101
42
|
break;
|
|
102
43
|
}
|
|
103
44
|
|
|
104
45
|
case 'label':
|
|
105
46
|
{
|
|
106
|
-
|
|
47
|
+
this.#$label.textContent = newVal;
|
|
107
48
|
break;
|
|
108
49
|
}
|
|
109
50
|
|
|
110
51
|
case 'caption':
|
|
111
52
|
{
|
|
112
|
-
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
case 'disabled':
|
|
117
|
-
{
|
|
118
|
-
_classPrivateFieldGet(this, _updateDisabledAttributeInChildren).call(this);
|
|
119
|
-
|
|
53
|
+
updateAttribute(this.#$caption, 'text', newVal);
|
|
120
54
|
break;
|
|
121
55
|
}
|
|
122
56
|
}
|
|
@@ -154,4 +88,7 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
154
88
|
return getBooleanAttribute(this, 'disabled');
|
|
155
89
|
}
|
|
156
90
|
|
|
157
|
-
|
|
91
|
+
#onIllustrationSlotChange = () => {
|
|
92
|
+
setClass(this.#$illustrationSlotWrapper, 'active', this.#$illustrationSlot.assignedElements().length > 0);
|
|
93
|
+
};
|
|
94
|
+
});
|