@nectary/components 1.3.3 → 2.0.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 -3
- package/accordion/types.d.ts +0 -3
- package/accordion-item/index.d.ts +2 -0
- package/accordion-item/index.js +33 -34
- package/action-menu-option/index.js +2 -2
- package/alert/index.js +2 -12
- package/avatar/index.js +1 -1
- package/avatar/utils.js +3 -3
- package/badge/index.js +41 -67
- package/badge/types.d.ts +0 -4
- package/badge/utils.d.ts +0 -3
- package/badge/utils.js +0 -11
- package/button/index.js +1 -1
- package/button/types.d.ts +2 -2
- package/card/index.js +5 -16
- package/card/types.d.ts +0 -6
- package/card-container/index.js +1 -1
- package/chat-block/index.js +1 -1
- package/chat-bubble/index.js +3 -24
- package/checkbox/index.js +31 -30
- package/checkbox/types.d.ts +0 -3
- package/chip/index.js +34 -27
- package/chip/utils.js +3 -3
- package/code-tag/index.js +1 -1
- package/color-menu/index.d.ts +0 -3
- package/color-menu/index.js +50 -99
- package/color-menu/types.d.ts +0 -4
- package/color-menu-option/index.d.ts +14 -0
- package/color-menu-option/index.js +52 -0
- package/color-menu-option/types.d.ts +9 -0
- package/color-menu-option/utils.d.ts +1 -0
- package/color-menu-option/utils.js +11 -0
- package/color-swatch/index.js +1 -1
- package/color-swatch/utils.js +3 -3
- package/date-picker/index.js +2 -24
- package/date-picker/types.d.ts +0 -3
- package/dialog/index.js +2 -5
- package/dialog/types.d.ts +0 -2
- package/emoji/index.js +1 -1
- package/emoji-picker/index.d.ts +1 -0
- package/emoji-picker/index.js +32 -23
- package/field/index.js +39 -32
- package/file-drop/index.js +1 -1
- package/file-status/index.js +2 -16
- package/flag/index.js +1 -1
- package/grid/index.js +1 -1
- package/help-tooltip/index.js +3 -12
- package/horizontal-stepper/index.js +1 -1
- package/horizontal-stepper-item/index.d.ts +2 -0
- package/horizontal-stepper-item/index.js +8 -12
- package/icon/index.js +1 -1
- package/icon-button/index.js +1 -1
- package/inline-alert/index.js +19 -29
- package/input/index.d.ts +0 -3
- package/input/index.js +12 -46
- package/input/types.d.ts +1 -5
- package/link/index.js +35 -37
- package/list-item/index.js +1 -1
- package/package.json +10 -10
- package/pagination/index.js +8 -21
- package/pagination/types.d.ts +0 -3
- package/pop/index.js +16 -13
- package/popover/index.js +44 -50
- package/progress/index.js +20 -15
- package/radio/index.js +19 -6
- package/radio/types.d.ts +3 -3
- package/radio-option/index.js +35 -27
- package/rich-text/index.js +1 -1
- package/segment/index.js +2 -3
- package/segment-collapse/index.js +2 -11
- package/segment-collapse/types.d.ts +0 -3
- package/segmented-control/index.js +0 -3
- package/segmented-control/types.d.ts +0 -3
- package/segmented-control-option/index.js +20 -19
- package/segmented-icon-control/index.js +1 -4
- package/segmented-icon-control/types.d.ts +0 -3
- package/segmented-icon-control-option/index.js +18 -14
- package/select-button/index.js +7 -12
- package/select-menu/index.js +12 -5
- package/select-menu-option/index.js +2 -5
- package/skeleton/index.js +1 -1
- package/skeleton-item/index.js +1 -1
- package/spinner/index.js +1 -1
- package/table/index.js +1 -1
- package/table-body/index.js +1 -1
- package/table-cell/index.js +1 -1
- package/table-head-cell/index.d.ts +1 -0
- package/table-head-cell/index.js +12 -3
- package/table-row/index.js +18 -2
- package/tabs/index.js +1 -4
- package/tabs/types.d.ts +0 -3
- package/tabs-icon-option/index.js +4 -2
- package/tabs-option/index.js +25 -20
- package/tag/index.js +16 -8
- package/tag/utils.js +3 -3
- package/text/index.js +30 -20
- package/textarea/index.js +10 -6
- package/textarea/types.d.ts +0 -3
- package/tile-control/index.js +23 -25
- package/tile-control/types.d.ts +0 -3
- package/tile-control-option/index.js +1 -1
- package/time-picker/index.js +2 -8
- package/time-picker/types.d.ts +0 -3
- package/title/index.js +30 -22
- package/toast/index.js +20 -30
- package/toggle/index.js +33 -30
- package/toggle/types.d.ts +0 -3
- package/tooltip/index.js +41 -30
- package/tooltip/tooltip-state.d.ts +1 -0
- package/tooltip/tooltip-state.js +6 -0
- package/tooltip/types.d.ts +7 -12
- package/tooltip/utils.d.ts +4 -1
- package/tooltip/utils.js +7 -1
- package/vertical-stepper/index.js +1 -1
- package/vertical-stepper-item/index.d.ts +2 -0
- package/vertical-stepper-item/index.js +8 -12
- package/logo/create-logo-class.d.ts +0 -1
- package/logo/create-logo-class.js +0 -52
- package/logo/engage-icon/index.d.ts +0 -11
- package/logo/engage-icon/index.js +0 -4
- package/logo/engage-icon-wordmark/index.d.ts +0 -11
- package/logo/engage-icon-wordmark/index.js +0 -4
- package/logo/sinch-icon/index.d.ts +0 -11
- package/logo/sinch-icon/index.js +0 -4
- package/logo/sinch-icon-wordmark/index.d.ts +0 -11
- package/logo/sinch-icon-wordmark/index.js +0 -4
- package/logo/types.d.ts +0 -11
- package/theme/accordion-item.css +0 -4
- package/theme/alert.css +0 -6
- package/theme/avatar.css +0 -25
- package/theme/badge.css +0 -15
- package/theme/button.css +0 -146
- package/theme/chat.css +0 -9
- package/theme/chip.css +0 -68
- package/theme/color-menu.css +0 -4
- package/theme/color-swatch.css +0 -71
- package/theme/colors.d.ts +0 -4
- package/theme/colors.js +0 -4
- package/theme/contextual.css +0 -40
- package/theme/date-picker.css +0 -7
- package/theme/dialog.css +0 -4
- package/theme/elevation.css +0 -7
- package/theme/emoji-picker.css +0 -13
- package/theme/emoji.css +0 -5
- package/theme/file-status.css +0 -7
- package/theme/flag.css +0 -4
- package/theme/fonts.css +0 -86
- package/theme/fonts.json +0 -89
- package/theme/help-tooltip.css +0 -5
- package/theme/horizontal-stepper.css +0 -5
- package/theme/icon-button.css +0 -68
- package/theme/icon.css +0 -7
- package/theme/index.css +0 -4
- package/theme/index.d.ts +0 -39
- package/theme/index.js +0 -39
- package/theme/inline-alert.css +0 -7
- package/theme/input.css +0 -10
- package/theme/link.css +0 -5
- package/theme/pagination.css +0 -5
- package/theme/palette.css +0 -90
- package/theme/segment.css +0 -4
- package/theme/select-button.css +0 -10
- package/theme/select-menu.css +0 -6
- package/theme/shapes.css +0 -8
- package/theme/size.css +0 -9
- package/theme/spinner.css +0 -7
- package/theme/tag.css +0 -67
- package/theme/time-picker.css +0 -4
- package/theme/toast.css +0 -7
- package/theme/typography.css +0 -16
- package/theme/vertical-stepper.css +0 -5
- /package/{logo → color-menu-option}/types.js +0 -0
package/accordion/index.js
CHANGED
|
@@ -24,9 +24,6 @@ defineCustomElement('sinch-accordion', class extends NectaryElement {
|
|
|
24
24
|
this.#$slot.removeEventListener('option-change', this.#onOptionChange);
|
|
25
25
|
this.removeEventListener('-change', this.#onChangeReactHandler);
|
|
26
26
|
}
|
|
27
|
-
get nodeName() {
|
|
28
|
-
return 'select';
|
|
29
|
-
}
|
|
30
27
|
set value(value) {
|
|
31
28
|
updateAttribute(this, 'value', value);
|
|
32
29
|
}
|
package/accordion/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
import type { SyntheticEvent } from 'react';
|
|
3
2
|
export type TSinchAccordionElement = HTMLElement & {
|
|
4
3
|
/** Value */
|
|
5
4
|
value: string;
|
|
@@ -17,8 +16,6 @@ export type TSinchAccordionReact = TSinchElementReact<TSinchAccordionElement> &
|
|
|
17
16
|
value: string;
|
|
18
17
|
multiple?: boolean;
|
|
19
18
|
/** Allows to expand multiple items simultanously */
|
|
20
|
-
/** @deprecated */
|
|
21
|
-
onChange?: (e: SyntheticEvent<TSinchAccordionElement, CustomEvent<string>>) => void;
|
|
22
19
|
/** Change value handler */
|
|
23
20
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
24
21
|
};
|
package/accordion-item/index.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import '../icon';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import '../title';
|
|
3
|
+
import '../text';
|
|
4
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block;outline:0;min-height:48px}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--sinch-comp-accordion-color-default-border-initial)}#button{all:initial;cursor:pointer;display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:48px;padding:12px 8px;--sinch-global-color-icon:var(--sinch-comp-accordion-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-accordion-size-icon)}#button>*{pointer-events:none}#button:disabled{cursor:initial;--sinch-global-color-icon:var(--sinch-comp-accordion-color-disabled-icon-initial)}#button::before{width:8px;height:8px;border-radius:50%;margin-left:2px;margin-right:8px}:host([status=success]) #button::before{content:"";background-color:var(--sinch-comp-accordion-color-default-status-success)}:host([status=warn]) #button::before{content:"";background-color:var(--sinch-comp-accordion-color-default-status-warning)}:host([status=error]) #button::before{content:"";background-color:var(--sinch-comp-accordion-color-default-status-error)}:host([status=info]) #button::before{content:"";background-color:var(--sinch-comp-accordion-color-default-status-info)}#title{flex:1;min-width:0;--sinch-comp-title-font:var(--sinch-comp-accordion-font-title);--sinch-global-color-text:var(--sinch-comp-accordion-color-default-title-initial)}#button:disabled>#title{--sinch-global-color-text:var(--sinch-comp-accordion-color-disabled-title-initial)}#content{display:none;overflow-y:auto;flex-shrink:1;min-height:0;padding:0 8px 18px}#dropdown-icon{transform:rotate(0)}#button[aria-expanded=true]>#dropdown-icon{transform:rotate(180deg)}#button[aria-expanded=true]+#content{display:block}#optional{--sinch-comp-text-font:var(--sinch-comp-accordion-font-optional-text);--sinch-global-color-text:var(--sinch-comp-accordion-color-default-optional-text-initial)}#button:disabled>#optional{--sinch-global-color-text:var(--sinch-comp-accordion-color-disabled-optional-text-initial)}</style><div id="wrapper"><button id="button" aria-controls="content" aria-expanded="false"><slot name="icon"></slot><sinch-title id="title" level="3" type="m" ellipsis></sinch-title><sinch-text id="optional" type="m"></sinch-text><sinch-icon id="dropdown-icon" name="keyboard_arrow_down"></sinch-icon></button><div id="content" role="region" aria-labelledby="button"><slot name="content"></slot></div></div>';
|
|
4
6
|
import { statusValues } from './utils';
|
|
5
7
|
const template = document.createElement('template');
|
|
6
8
|
template.innerHTML = templateHTML;
|
|
7
9
|
defineCustomElement('sinch-accordion-item', class extends NectaryElement {
|
|
8
10
|
#$button;
|
|
9
|
-
#$
|
|
10
|
-
#$buttonContent;
|
|
11
|
+
#$title;
|
|
11
12
|
#$optionalText;
|
|
12
13
|
constructor() {
|
|
13
14
|
super();
|
|
14
15
|
const shadowRoot = this.attachShadow();
|
|
15
16
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
16
17
|
this.#$button = shadowRoot.querySelector('#button');
|
|
17
|
-
this.#$
|
|
18
|
-
this.#$buttonContent = shadowRoot.querySelector('#title');
|
|
18
|
+
this.#$title = shadowRoot.querySelector('#title');
|
|
19
19
|
this.#$optionalText = shadowRoot.querySelector('#optional');
|
|
20
20
|
}
|
|
21
21
|
connectedCallback() {
|
|
22
22
|
this.#$button.addEventListener('click', this.#onButtonClick);
|
|
23
|
-
updateAttribute(this.#$icon, 'name', getCssVar(this, '--sinch-accordion-item-icon-dropdown'));
|
|
24
23
|
}
|
|
25
24
|
disconnectedCallback() {
|
|
26
25
|
this.#$button.removeEventListener('click', this.#onButtonClick);
|
|
@@ -28,6 +27,33 @@ defineCustomElement('sinch-accordion-item', class extends NectaryElement {
|
|
|
28
27
|
static get observedAttributes() {
|
|
29
28
|
return ['label', 'disabled', 'data-checked', 'optionaltext'];
|
|
30
29
|
}
|
|
30
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
31
|
+
if (oldVal === newVal) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
switch (name) {
|
|
35
|
+
case 'label':
|
|
36
|
+
{
|
|
37
|
+
updateAttribute(this.#$title, 'text', newVal);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case 'disabled':
|
|
41
|
+
{
|
|
42
|
+
this.#$button.disabled = isAttrTrue(newVal);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case 'data-checked':
|
|
46
|
+
{
|
|
47
|
+
updateExplicitBooleanAttribute(this.#$button, 'aria-expanded', isAttrTrue(newVal));
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case 'optionaltext':
|
|
51
|
+
{
|
|
52
|
+
this.#$optionalText.textContent = newVal;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
31
57
|
set value(value) {
|
|
32
58
|
updateAttribute(this, 'value', value);
|
|
33
59
|
}
|
|
@@ -58,33 +84,6 @@ defineCustomElement('sinch-accordion-item', class extends NectaryElement {
|
|
|
58
84
|
get optionalText() {
|
|
59
85
|
return getAttribute(this, 'optionaltext');
|
|
60
86
|
}
|
|
61
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
62
|
-
if (oldVal === newVal) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
switch (name) {
|
|
66
|
-
case 'label':
|
|
67
|
-
{
|
|
68
|
-
this.#$buttonContent.textContent = newVal;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
case 'disabled':
|
|
72
|
-
{
|
|
73
|
-
this.#$button.disabled = isAttrTrue(newVal);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case 'data-checked':
|
|
77
|
-
{
|
|
78
|
-
updateExplicitBooleanAttribute(this.#$button, 'aria-expanded', isAttrTrue(newVal));
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case 'optionaltext':
|
|
82
|
-
{
|
|
83
|
-
this.#$optionalText.textContent = newVal;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
87
|
#onButtonClick = e => {
|
|
89
88
|
e.stopPropagation();
|
|
90
89
|
this.dispatchEvent(new CustomEvent('option-change', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-
|
|
3
|
+
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;background-color:var(--sinch-comp-action-menu-color-default-background-initial);--sinch-global-color-text:var(--sinch-comp-action-menu-color-default-text-initial);--sinch-global-color-icon:var(--sinch-comp-action-menu-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-action-menu-size-icon)}:host([data-selected])>#wrapper{background-color:var(--sinch-comp-action-menu-color-default-background-selected)}:host(:hover)>#wrapper{background-color:var(--sinch-comp-action-menu-color-default-background-hover)}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;background-color:var(--sinch-comp-action-menu-color-disabled-background-initial);--sinch-global-color-text:var(--sinch-comp-action-menu-color-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-action-menu-color-disabled-icon-initial)}#content{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-action-menu-font-option)}::slotted(*){margin-left:-6px}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="content" type="m" ellipsis></sinch-text></div>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-action-menu-option', class ActionMenuOption extends NectaryElement {
|
|
@@ -45,7 +45,7 @@ defineCustomElement('sinch-action-menu-option', class ActionMenuOption extends N
|
|
|
45
45
|
}
|
|
46
46
|
case 'disabled':
|
|
47
47
|
{
|
|
48
|
-
updateBooleanAttribute(this,
|
|
48
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case 'data-selected':
|
package/alert/index.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import '../icon';
|
|
2
2
|
import '../rich-text';
|
|
3
3
|
import '../text';
|
|
4
|
-
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement
|
|
5
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}#
|
|
4
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}#icon-error,#icon-info,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}</style><div id="wrapper"><sinch-icon id="icon-info" name="info"></sinch-icon><sinch-icon id="icon-warn" name="report_problem"></sinch-icon><sinch-icon id="icon-error" name="report"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
|
|
6
6
|
import { assertType, typeValues } from './utils';
|
|
7
7
|
const template = document.createElement('template');
|
|
8
8
|
template.innerHTML = templateHTML;
|
|
9
9
|
defineCustomElement('sinch-alert', class extends NectaryElement {
|
|
10
10
|
#$text;
|
|
11
|
-
#$icon;
|
|
12
11
|
constructor() {
|
|
13
12
|
super();
|
|
14
13
|
const shadowRoot = this.attachShadow();
|
|
15
14
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
16
15
|
this.#$text = shadowRoot.querySelector('#text');
|
|
17
|
-
this.#$icon = shadowRoot.querySelector('#icon');
|
|
18
16
|
}
|
|
19
17
|
connectedCallback() {
|
|
20
18
|
super.connectedCallback();
|
|
21
19
|
this.setAttribute('role', 'alert');
|
|
22
|
-
this.#updateIcon();
|
|
23
20
|
}
|
|
24
21
|
disconnectedCallback() {
|
|
25
22
|
super.disconnectedCallback();
|
|
@@ -46,7 +43,6 @@ defineCustomElement('sinch-alert', class extends NectaryElement {
|
|
|
46
43
|
if ('production' !== 'production') {
|
|
47
44
|
assertType(newVal);
|
|
48
45
|
}
|
|
49
|
-
this.#updateIcon();
|
|
50
46
|
break;
|
|
51
47
|
}
|
|
52
48
|
case 'text':
|
|
@@ -56,10 +52,4 @@ defineCustomElement('sinch-alert', class extends NectaryElement {
|
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
#updateIcon() {
|
|
60
|
-
if (!this.isConnected) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
updateAttribute(this.#$icon, 'name', getCssVar(this, `--sinch-alert-icon-${this.type}`));
|
|
64
|
-
}
|
|
65
55
|
});
|
package/avatar/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
2
2
|
import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:var(--sinch-local-size);height:var(--sinch-local-size);background-color:var(--sinch-comp-avatar-border-color-default-initial);border-radius:var(--sinch-comp-avatar-shape-radius);--sinch-local-size:var(--sinch-comp-avatar-size-m)}:host([size="l"]) #wrapper{--sinch-local-size:var(--sinch-comp-avatar-size-l)}:host([size="s"]) #wrapper{--sinch-local-size:var(--sinch-comp-avatar-size-s)}#text{display:block;width:100%;height:100%;font:var(--sinch-comp-avatar-container-font-size-m-text);line-height:calc(var(--sinch-local-size) - 2px);text-transform:uppercase;text-align:center}:host([size="l"]) #text{font:var(--sinch-comp-avatar-container-font-size-l-text);line-height:calc(var(--sinch-local-size) - 2px)}:host([size="s"]) #text{font:var(--sinch-comp-avatar-container-font-size-s-text);line-height:calc(var(--sinch-local-size) - 2px)}#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);background-color:var(--sinch-comp-avatar-container-color-default-background);color:var(--sinch-comp-avatar-container-color-default-foreground)}#image{display:none;position:absolute;left:0;top:0;width:100%;height:100%;object-fit:contain}:host([src]:not([src=""])) #image{display:block}#status-wrapper{position:absolute;left:calc(85% - 5px);top:calc(85% - 5px);width:10px;height:10px;padding:1px;box-sizing:border-box;border-radius:50%;background-color:var(--sinch-comp-avatar-border-color-default-initial);display:none;pointer-events:none}#status{width:8px;height:8px;border-radius:50%}:host([status=away]) #status-wrapper,:host([status=busy]) #status-wrapper,:host([status=offline]) #status-wrapper,:host([status=online]) #status-wrapper{display:block}:host([status=online]) #status{background-color:var(--sinch-comp-avatar-status-color-online-default-background)}:host([status=away]) #status{background-color:var(--sinch-comp-avatar-status-color-away-default-background)}:host([status=busy]) #status{background-color:var(--sinch-comp-avatar-status-color-busy-default-background)}:host([status=offline]) #status{background-color:var(--sinch-comp-avatar-status-color-offline-default-background)}</style><div id="wrapper"><div id="circle"><span id="text"></span><img id="image" alt=""/></div><div id="status-wrapper"><div id="status"></div></div></div>';
|
|
4
4
|
import { assertAvatarColor, assertStatus, getAvatarColorBg, getAvatarColorFg, statusValues } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
package/avatar/utils.js
CHANGED
|
@@ -8,13 +8,13 @@ export const assertStatus = value => {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
export const getAvatarColorBg = id => {
|
|
11
|
-
return `var(--sinch-avatar-color-${id}-
|
|
11
|
+
return `var(--sinch-comp-avatar-container-color-${id}-background)`;
|
|
12
12
|
};
|
|
13
13
|
export const getAvatarColorFg = id => {
|
|
14
|
-
return `var(--sinch-avatar-color-${id}-
|
|
14
|
+
return `var(--sinch-comp-avatar-container-color-${id}-foreground)`;
|
|
15
15
|
};
|
|
16
16
|
export const assertAvatarColor = (root, id) => {
|
|
17
|
-
if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-avatar-color-${id}-
|
|
17
|
+
if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-comp-avatar-container-color-${id}-background`).length === 0) {
|
|
18
18
|
throw new Error(`Invalid sinch-avatar color name: ${id}`);
|
|
19
19
|
}
|
|
20
20
|
};
|
package/badge/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getRect, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
1
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
2
2
|
import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-flex;flex-direction:column;position:relative}#badge-wrapper{position:absolute;left:0;top:0;width:fit-content;border-radius:
|
|
4
|
-
import {
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-flex;flex-direction:column;position:relative}#badge-wrapper{position:absolute;left:0;top:0;width:fit-content;border-radius:var(--sinch-comp-badge-shape-radius);padding:1px;pointer-events:none;background-color:var(--sinch-comp-badge-color-border)}#badge{box-sizing:border-box;color:var(--sinch-comp-badge-color-text);background-color:var(--sinch-comp-badge-color-background);width:20px;height:20px;border-radius:var(--sinch-comp-badge-shape-radius)}#badge.long{width:fit-content;padding:0 5px}#text{display:block;width:100%;height:100%;text-align:center;font:var(--sinch-comp-badge-font-size-l);line-height:20px;text-rendering:optimizelegibility}:host([size="m"]) #badge-wrapper{left:calc(100% - 8px);top:-8px}:host([size="m"]) #badge{width:14px;height:14px}:host([size="m"]) #badge.long{width:fit-content;padding:0 3px}:host([size="m"]) #text{font:var(--sinch-comp-badge-font-size-m);line-height:14px}:host([size="s"]) #badge{width:8px;height:8px;padding:0}:host([size="s"]) #text{display:none}:host([hidden]) #badge-wrapper{display:none}</style><slot id="slot"></slot><div id="badge-wrapper"><div id="badge"><span id="text"></span></div></div>';
|
|
4
|
+
import { assertMode, modeValues } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
|
7
7
|
defineCustomElement('sinch-badge', class extends NectaryElement {
|
|
@@ -20,13 +20,50 @@ defineCustomElement('sinch-badge', class extends NectaryElement {
|
|
|
20
20
|
}
|
|
21
21
|
connectedCallback() {
|
|
22
22
|
super.connectedCallback();
|
|
23
|
-
this.#updateColor();
|
|
24
23
|
this.#observer.observe(this);
|
|
25
24
|
}
|
|
26
25
|
disconnectedCallback() {
|
|
27
26
|
super.disconnectedCallback();
|
|
28
27
|
this.#observer.unobserve(this);
|
|
29
28
|
}
|
|
29
|
+
static get observedAttributes() {
|
|
30
|
+
return ['text', 'size', 'mode', 'hidden'];
|
|
31
|
+
}
|
|
32
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
33
|
+
if (oldVal === newVal) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
switch (name) {
|
|
37
|
+
case 'text':
|
|
38
|
+
{
|
|
39
|
+
this.#$text.textContent = newVal;
|
|
40
|
+
setClass(this.#$badge, 'long', newVal !== null && newVal.length > 1);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'size':
|
|
44
|
+
{
|
|
45
|
+
if ('production' !== 'production') {
|
|
46
|
+
assertSize(newVal, 'sinch-badge');
|
|
47
|
+
}
|
|
48
|
+
this.#updatePosition();
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'mode':
|
|
52
|
+
{
|
|
53
|
+
if ('production' !== 'production') {
|
|
54
|
+
assertMode(newVal);
|
|
55
|
+
}
|
|
56
|
+
this.#updatePosition();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case 'hidden':
|
|
60
|
+
{
|
|
61
|
+
this.#updatePosition();
|
|
62
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
30
67
|
get text() {
|
|
31
68
|
return getAttribute(this, 'text', '');
|
|
32
69
|
}
|
|
@@ -45,12 +82,6 @@ defineCustomElement('sinch-badge', class extends NectaryElement {
|
|
|
45
82
|
set mode(value) {
|
|
46
83
|
updateLiteralAttribute(this, modeValues, 'mode', value);
|
|
47
84
|
}
|
|
48
|
-
get color() {
|
|
49
|
-
return getAttribute(this, 'color');
|
|
50
|
-
}
|
|
51
|
-
set color(value) {
|
|
52
|
-
updateAttribute(this, 'color', value);
|
|
53
|
-
}
|
|
54
85
|
get hidden() {
|
|
55
86
|
return getBooleanAttribute(this, 'hidden');
|
|
56
87
|
}
|
|
@@ -69,63 +100,6 @@ defineCustomElement('sinch-badge', class extends NectaryElement {
|
|
|
69
100
|
}
|
|
70
101
|
return getRect(this.#$badgeWrapper);
|
|
71
102
|
}
|
|
72
|
-
static get observedAttributes() {
|
|
73
|
-
return ['text', 'size', 'mode', 'color', 'hidden'];
|
|
74
|
-
}
|
|
75
|
-
attributeChangedCallback(name, _, newVal) {
|
|
76
|
-
switch (name) {
|
|
77
|
-
case 'text':
|
|
78
|
-
{
|
|
79
|
-
this.#$text.textContent = newVal;
|
|
80
|
-
setClass(this.#$badge, 'long', newVal !== null && newVal.length > 1);
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case 'size':
|
|
84
|
-
{
|
|
85
|
-
if ('production' !== 'production') {
|
|
86
|
-
assertSize(newVal, 'sinch-badge');
|
|
87
|
-
}
|
|
88
|
-
this.#updatePosition();
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case 'mode':
|
|
92
|
-
{
|
|
93
|
-
if ('production' !== 'production') {
|
|
94
|
-
assertMode(newVal);
|
|
95
|
-
}
|
|
96
|
-
this.#updatePosition();
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case 'color':
|
|
100
|
-
{
|
|
101
|
-
this.#updateColor();
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
case 'hidden':
|
|
105
|
-
{
|
|
106
|
-
this.#updatePosition();
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
#updateColor() {
|
|
112
|
-
if (!this.isConnected) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const colorName = this.color;
|
|
116
|
-
if (colorName !== null && colorName.length > 0) {
|
|
117
|
-
if ('production' !== 'production') {
|
|
118
|
-
assertBadgeColor(this, colorName);
|
|
119
|
-
}
|
|
120
|
-
const bg = getBadgeColorBg(colorName);
|
|
121
|
-
const fg = getBadgeColorFg(colorName);
|
|
122
|
-
this.#$badge.style.setProperty('background-color', bg);
|
|
123
|
-
this.#$badge.style.setProperty('color', fg);
|
|
124
|
-
} else {
|
|
125
|
-
this.#$badge.style.removeProperty('background-color');
|
|
126
|
-
this.#$badge.style.removeProperty('color');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
103
|
#updatePosition() {
|
|
130
104
|
if (this.hidden) {
|
|
131
105
|
return;
|
package/badge/types.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ export type TSinchBadgeElement = HTMLElement & {
|
|
|
8
8
|
size: TSinchSize;
|
|
9
9
|
/** Mode, `square` by default */
|
|
10
10
|
mode: TSinchBadgeMode;
|
|
11
|
-
/** Color */
|
|
12
|
-
color: string | null;
|
|
13
11
|
/** Hidden */
|
|
14
12
|
hidden: boolean;
|
|
15
13
|
readonly badgeRect: TRect;
|
|
@@ -31,8 +29,6 @@ export type TSinchBadgeReact = TSinchElementReact<TSinchBadgeElement> & {
|
|
|
31
29
|
size?: TSinchSize;
|
|
32
30
|
/** Mode, `square` by default */
|
|
33
31
|
mode?: TSinchBadgeMode;
|
|
34
|
-
/** Color */
|
|
35
|
-
color?: string;
|
|
36
32
|
/** Hidden */
|
|
37
33
|
hidden?: boolean;
|
|
38
34
|
};
|
package/badge/utils.d.ts
CHANGED
|
@@ -2,7 +2,4 @@ import type { TSinchBadgeMode } from './types';
|
|
|
2
2
|
export declare const modeValues: readonly TSinchBadgeMode[];
|
|
3
3
|
type TAssertMode = (value: string | null) => asserts value is TSinchBadgeMode;
|
|
4
4
|
export declare const assertMode: TAssertMode;
|
|
5
|
-
export declare const getBadgeColorBg: (id: string) => string;
|
|
6
|
-
export declare const getBadgeColorFg: (id: string) => string;
|
|
7
|
-
export declare const assertBadgeColor: (root: Element, id: string | null) => void;
|
|
8
5
|
export {};
|
package/badge/utils.js
CHANGED
|
@@ -3,15 +3,4 @@ export const assertMode = value => {
|
|
|
3
3
|
if (value === null || !modeValues.includes(value)) {
|
|
4
4
|
throw new Error(`sinch-badge: invalid mode attribute: ${value}`);
|
|
5
5
|
}
|
|
6
|
-
};
|
|
7
|
-
export const getBadgeColorBg = id => {
|
|
8
|
-
return `var(--sinch-badge-color-${id}-bg)`;
|
|
9
|
-
};
|
|
10
|
-
export const getBadgeColorFg = id => {
|
|
11
|
-
return `var(--sinch-badge-color-${id}-fg)`;
|
|
12
|
-
};
|
|
13
|
-
export const assertBadgeColor = (root, id) => {
|
|
14
|
-
if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-badge-color-${id}-bg`).length === 0) {
|
|
15
|
-
throw new Error(`Invalid sinch-badge color name: ${id}`);
|
|
16
|
-
}
|
|
17
6
|
};
|
package/button/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCustomElement, getBooleanAttribute, getAttribute, isAttrTrue, updateBooleanAttribute, updateAttribute, NectaryElement, getReactEventHandler, getLiteralAttribute, updateLiteralAttribute, Context, subscribeContext } from '../utils';
|
|
2
2
|
import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-button-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m);--sinch-button-font:var(--sinch-button-font-m)}:host([data-size="l"]){--sinch-size:var(--sinch-size-l);--sinch-size-icon:var(--sinch-button-icon-size-l);--sinch-shape-radius:var(--sinch-shape-radius-l);--sinch-button-font:var(--sinch-button-font-l)}:host([data-size="m"]){--sinch-size:var(--sinch-size-m);--sinch-size-icon:var(--sinch-button-icon-size-m);--sinch-shape-radius:var(--sinch-shape-radius-m);--sinch-button-font:var(--sinch-button-font-m)}:host([data-size="s"]){--sinch-size:var(--sinch-size-s);--sinch-size-icon:var(--sinch-button-icon-size-s);--sinch-shape-radius:var(--sinch-shape-radius-s);--sinch-button-font:var(--sinch-button-font-s)}:host([type=primary]){--sinch-button-color-background:var(--sinch-button-primary-color-background);--sinch-button-color-background-hover:var(--sinch-button-primary-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-primary-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-primary-color-background-disabled);--sinch-button-color-border:var(--sinch-button-primary-color-border);--sinch-button-color-border-hover:var(--sinch-button-primary-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-primary-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-primary-color-border-disabled);--sinch-button-color-text:var(--sinch-button-primary-color-text);--sinch-button-color-text-hover:var(--sinch-button-primary-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-primary-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-primary-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-primary-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-primary-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-primary-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-primary-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-primary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=secondary]){--sinch-button-color-background:var(--sinch-button-secondary-color-background);--sinch-button-color-background-hover:var(--sinch-button-secondary-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-secondary-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-secondary-color-background-disabled);--sinch-button-color-border:var(--sinch-button-secondary-color-border);--sinch-button-color-border-hover:var(--sinch-button-secondary-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-secondary-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-secondary-color-border-disabled);--sinch-button-color-text:var(--sinch-button-secondary-color-text);--sinch-button-color-text-hover:var(--sinch-button-secondary-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-secondary-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-secondary-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-secondary-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-secondary-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-secondary-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-secondary-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-secondary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=tertiary]){--sinch-button-color-background:var(--sinch-button-tertiary-color-background);--sinch-button-color-background-hover:var(--sinch-button-tertiary-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-tertiary-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-tertiary-color-background-disabled);--sinch-button-color-border:var(--sinch-button-tertiary-color-border);--sinch-button-color-border-hover:var(--sinch-button-tertiary-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-tertiary-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-tertiary-color-border-disabled);--sinch-button-color-text:var(--sinch-button-tertiary-color-text);--sinch-button-color-text-hover:var(--sinch-button-tertiary-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-tertiary-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-tertiary-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-tertiary-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-tertiary-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-tertiary-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-tertiary-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-tertiary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-0)}:host([type=cta-primary]){--sinch-button-color-background:var(--sinch-button-cta-primary-color-background);--sinch-button-color-background-hover:var(--sinch-button-cta-primary-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-cta-primary-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-cta-primary-color-background-disabled);--sinch-button-color-border:var(--sinch-button-cta-primary-color-border);--sinch-button-color-border-hover:var(--sinch-button-cta-primary-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-cta-primary-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-cta-primary-color-border-disabled);--sinch-button-color-text:var(--sinch-button-cta-primary-color-text);--sinch-button-color-text-hover:var(--sinch-button-cta-primary-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-cta-primary-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-cta-primary-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-cta-primary-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-cta-primary-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-cta-primary-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-cta-primary-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-cta-primary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=cta-secondary]){--sinch-button-color-background:var(--sinch-button-cta-secondary-color-background);--sinch-button-color-background-hover:var(--sinch-button-cta-secondary-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-cta-secondary-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-cta-secondary-color-background-disabled);--sinch-button-color-border:var(--sinch-button-cta-secondary-color-border);--sinch-button-color-border-hover:var(--sinch-button-cta-secondary-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-cta-secondary-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-cta-secondary-color-border-disabled);--sinch-button-color-text:var(--sinch-button-cta-secondary-color-text);--sinch-button-color-text-hover:var(--sinch-button-cta-secondary-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-cta-secondary-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-cta-secondary-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-cta-secondary-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-cta-secondary-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-cta-secondary-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-cta-secondary-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-cta-secondary-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}:host([type=destructive]){--sinch-button-color-background:var(--sinch-button-destructive-color-background);--sinch-button-color-background-hover:var(--sinch-button-destructive-color-background-hover);--sinch-button-color-background-active:var(--sinch-button-destructive-color-background-active);--sinch-button-color-background-disabled:var(--sinch-button-destructive-color-background-disabled);--sinch-button-color-border:var(--sinch-button-destructive-color-border);--sinch-button-color-border-hover:var(--sinch-button-destructive-color-border-hover);--sinch-button-color-border-active:var(--sinch-button-destructive-color-border-active);--sinch-button-color-border-disabled:var(--sinch-button-destructive-color-border-disabled);--sinch-button-color-text:var(--sinch-button-destructive-color-text);--sinch-button-color-text-hover:var(--sinch-button-destructive-color-text-hover);--sinch-button-color-text-active:var(--sinch-button-destructive-color-text-active);--sinch-button-color-text-disabled:var(--sinch-button-destructive-color-text-disabled);--sinch-button-color-icon:var(--sinch-button-destructive-color-icon);--sinch-button-color-icon-hover:var(--sinch-button-destructive-color-icon-hover);--sinch-button-color-icon-active:var(--sinch-button-destructive-color-icon-active);--sinch-button-color-icon-disabled:var(--sinch-button-destructive-color-icon-disabled);--sinch-button-mix-blend-mode:var(--sinch-button-destructive-mix-blend-mode);--sinch-elevation-level:var(--sinch-elevation-level-1)}#button{all:initial;display:block;position:relative;width:100%;height:var(--sinch-size);font:var(--sinch-button-font);color:var(--sinch-button-color-text);cursor:pointer;--sinch-color-icon:var(--sinch-button-color-icon)}#button::before{content:"";position:absolute;inset:0;background-color:var(--sinch-button-color-background);border:1px solid var(--sinch-button-color-border);border-radius:var(--sinch-shape-radius);box-shadow:var(--sinch-elevation-level);pointer-events:none;mix-blend-mode:var(--sinch-button-mix-blend-mode)}#button:focus-visible::after{position:absolute;content:"";inset:-3px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius) + 3px);pointer-events:none}#button:disabled{color:var(--sinch-button-color-text-disabled);cursor:initial;--sinch-color-icon:var(--sinch-button-color-icon-disabled)}#button:disabled::before{background-color:var(--sinch-button-color-background-disabled);border-color:var(--sinch-button-color-border-disabled);box-shadow:var(--sinch-elevation-level-0)}#button:enabled:hover{--sinch-color-icon:var(--sinch-button-color-icon-hover)}#button:enabled:hover::before{background-color:var(--sinch-button-color-background-hover);border-color:var(--sinch-button-color-border-hover)}#button:enabled:active{--sinch-color-icon:var(--sinch-button-color-icon-active)}#button:enabled:active::before{background-color:var(--sinch-button-color-background-active);border-color:var(--sinch-button-color-border-active);border-width:2px;box-shadow:var(--sinch-elevation-level-0)}#content{position:relative;display:flex;align-items:center;justify-content:center;gap:.75em;width:100%;height:100%;padding:0 1em;box-sizing:border-box;pointer-events:none}#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>';
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#button{all:initial;display:block;position:relative;width:100%;height:var(--sinch-local-size);cursor:pointer;--sinch-local-size:var(--sinch-comp-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-button-size-icon-m);--sinch-local-font:var(--sinch-comp-button-font-size-m-text);--sinch-local-shape-radius:var(--sinch-comp-button-shape-radius-size-m);--sinch-global-color-icon:var(--sinch-local-color-icon)}#button:disabled{cursor:initial}:host([data-size="l"])>#button{--sinch-local-size:var(--sinch-comp-button-size-container-l);--sinch-global-size-icon:var(--sinch-comp-button-size-icon-l);--sinch-local-shape-radius:var(--sinch-comp-button-shape-radius-size-l);--sinch-local-font:var(--sinch-comp-button-font-size-l-text)}:host([data-size="m"])>#button{--sinch-local-size:var(--sinch-comp-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-button-shape-radius-size-m);--sinch-local-font:var(--sinch-comp-button-font-size-m-text)}:host([data-size="s"])>#button{--sinch-local-size:var(--sinch-comp-button-size-container-s);--sinch-global-size-icon:var(--sinch-comp-button-size-icon-s);--sinch-local-shape-radius:var(--sinch-comp-button-shape-radius-size-s);--sinch-local-font:var(--sinch-comp-button-font-size-s-text)}:host([type=primary])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-primary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-primary-default-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-primary-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-button-color-primary-default-icon-initial);--sinch-local-color-outline-focus:var(--sinch-comp-button-color-primary-default-outilne-focus);--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-initial)}:host([type=secondary])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-secondary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-secondary-default-border-initial);--sinch-local-color-outline-focus:var(--sinch-comp-button-color-secondary-default-outline-focus);--sinch-local-color-text:var(--sinch-comp-button-color-secondary-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-button-color-secondary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-initial)}:host([type=tertiary])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-tertiary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-tertiary-default-border-initial);--sinch-local-color-outline-focus:var(--sinch-comp-button-color-tertiary-default-outline-focus);--sinch-local-color-text:var(--sinch-comp-button-color-tertiary-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-button-color-tertiary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-initial)}:host([type=cta-primary])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-cta-primary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-cta-primary-default-border-initial);--sinch-local-color-outline-focus:var(--sinch-comp-button-color-cta-primary-default-outline-focus);--sinch-local-color-text:var(--sinch-comp-button-color-cta-primary-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-button-color-cta-primary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-initial)}:host([type=cta-secondary])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-cta-secondary-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-cta-secondary-default-border-initial);--sinch-local-color-outline-focus:var(--sinch-comp-button-color-cta-secondary-default-outline-focus);--sinch-local-color-text:var(--sinch-comp-button-color-cta-secondary-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-button-color-cta-secondary-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-initial)}:host([type=destructive])>#button{--sinch-local-color-background:var(--sinch-comp-button-color-danger-default-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-danger-default-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-danger-default-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-danger-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-destructive-initial)}:host([type=primary])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-primary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-primary-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-primary-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-primary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-disabled)}:host([type=secondary])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-secondary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-secondary-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-secondary-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-secondary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-disabled)}:host([type=tertiary])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-tertiary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-tertiary-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-tertiary-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-tertiary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-disabled)}:host([type=cta-primary])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-cta-primary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-cta-primary-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-cta-primary-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-cta-primary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-disabled)}:host([type=cta-secondary])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-cta-secondary-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-cta-secondary-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-cta-secondary-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-cta-secondary-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-disabled)}:host([type=destructive])>#button:disabled{--sinch-local-color-background:var(--sinch-comp-button-color-danger-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-button-color-danger-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-button-color-danger-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-button-color-danger-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-button-shadow-danger-disabled)}:host([type=primary])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-focus)}:host([type=secondary])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-focus)}:host([type=tertiary])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-focus)}:host([type=cta-primary])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-focus)}:host([type=cta-secondary])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-focus)}:host([type=destructive])>#button:focus{--sinch-local-shadow:var(--sinch-comp-button-shadow-destructive-focus)}:host([type=primary])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-primary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-hover)}:host([type=primary])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-primary-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-active)}:host([type=secondary])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-secondary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-hover)}:host([type=secondary])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-secondary-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-active)}:host([type=tertiary])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-tertiary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-hover)}:host([type=tertiary])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-tertiary-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-active)}:host([type=cta-primary])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-cta-primary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-hover)}:host([type=cta-primary])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-cta-primary-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-active)}:host([type=cta-secondary])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-cta-secondary-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-hover)}:host([type=cta-secondary])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-cta-secondary-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-active)}:host([type=destructive])>#button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-button-color-danger-default-background-hover);--sinch-local-shadow:var(--sinch-comp-button-shadow-danger-hover)}:host([type=destructive])>#button:enabled:active{--sinch-local-color-background:var(--sinch-comp-button-color-danger-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-danger-active)}#button::before{content:"";position:absolute;inset:0;background-color:var(--sinch-local-color-background);border:1px solid var(--sinch-local-color-border);border-radius:var(--sinch-local-shape-radius);box-shadow:var(--sinch-local-shadow);pointer-events:none}#button:active::before{border-width:2px}#button:focus-visible::after{position:absolute;content:"";inset:-3px;border:2px solid var(--sinch-local-color-outline-focus);border-radius:calc(var(--sinch-local-shape-radius) + 3px);pointer-events:none}#content{position:relative;display:flex;align-items:center;justify-content:center;gap:.75em;width:100%;height:100%;padding:0 1em;box-sizing:border-box;pointer-events:none}#text{font:var(--sinch-local-font);color:var(--sinch-local-color-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>';
|
|
4
4
|
import { assertType, typeValues } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
package/button/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
import type { TSinchSize } from '../utils/size';
|
|
3
3
|
export type TSinchButtonType = 'primary' | 'secondary' | 'tertiary' | 'cta-primary' | 'cta-secondary' | 'destructive';
|
|
4
4
|
export type TSinchButtonElement = HTMLElement & {
|
|
5
|
-
/** Type
|
|
5
|
+
/** Button Type */
|
|
6
6
|
type: TSinchButtonType;
|
|
7
7
|
/** Size, `m` by default */
|
|
8
8
|
size: TSinchSize;
|
|
@@ -26,7 +26,7 @@ export type TSinchButtonElement = HTMLElement & {
|
|
|
26
26
|
setAttribute(attr: 'disabled', value: ''): void;
|
|
27
27
|
};
|
|
28
28
|
export type TSinchButtonReact = TSinchElementReact<TSinchButtonElement> & {
|
|
29
|
-
/** Type
|
|
29
|
+
/** Button Type */
|
|
30
30
|
type?: TSinchButtonType;
|
|
31
31
|
/** Size, `m` by default */
|
|
32
32
|
size?: TSinchSize;
|
package/card/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../title';
|
|
2
2
|
import '../text';
|
|
3
|
-
import { defineCustomElement, getBooleanAttribute, getAttribute,
|
|
4
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius
|
|
3
|
+
import { defineCustomElement, getBooleanAttribute, getAttribute, updateAttribute, setClass, NectaryElement, isAttrTrue, getRect } from '../utils';
|
|
4
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-comp-card-shape-radius);border:1px solid var(--sinch-comp-card-color-white-default-border-initial);background-color:var(--sinch-comp-card-color-white-default-background-initial);box-shadow:var(--sinch-comp-card-shadow-initial);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-comp-card-shadow-hover)}#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{--sinch-comp-text-font:var(--sinch-comp-card-font-label);--sinch-global-color-text:var(--sinch-comp-card-color-white-default-text-title)}#label:empty{display:none}#header{display:flex;flex-direction:row;align-items:center;gap:8px;--sinch-global-size-icon:var(--sinch-comp-card-size-icon)}#caption{flex:1;min-width:0;--sinch-comp-title-font:var(--sinch-comp-card-font-title);--sinch-global-color-text:var(--sinch-comp-card-color-white-default-text-title)}#description{flex:1;min-height:0;max-height:120px;overflow-y:auto;--sinch-comp-text-font:var(--sinch-comp-card-font-description);--sinch-global-color-text:var(--sinch-comp-card-color-white-default-text-description)}#description:empty{display:none}slot[name=action]::slotted(*){margin-top:20px;align-self:flex-start;max-width:100%}:host([draggable=true]) #header{cursor:grab}</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>';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
|
7
7
|
defineCustomElement('sinch-card', class extends NectaryElement {
|
|
@@ -47,10 +47,10 @@ defineCustomElement('sinch-card', class extends NectaryElement {
|
|
|
47
47
|
this.#controller.abort();
|
|
48
48
|
}
|
|
49
49
|
static get observedAttributes() {
|
|
50
|
-
return ['text', 'label', 'caption', '
|
|
50
|
+
return ['text', 'label', 'caption', 'draggable'];
|
|
51
51
|
}
|
|
52
|
-
attributeChangedCallback(name,
|
|
53
|
-
if (
|
|
52
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
53
|
+
if (oldVal === newVal) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
switch (name) {
|
|
@@ -69,11 +69,6 @@ defineCustomElement('sinch-card', class extends NectaryElement {
|
|
|
69
69
|
updateAttribute(this.#$caption, 'text', newVal);
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
|
-
case 'disabled':
|
|
73
|
-
{
|
|
74
|
-
updateBooleanAttribute(this, 'disabled', isAttrTrue(newVal));
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
72
|
case 'draggable':
|
|
78
73
|
{
|
|
79
74
|
const isDraggingEnabled = isAttrTrue(newVal);
|
|
@@ -105,12 +100,6 @@ defineCustomElement('sinch-card', class extends NectaryElement {
|
|
|
105
100
|
get label() {
|
|
106
101
|
return getAttribute(this, 'label', '');
|
|
107
102
|
}
|
|
108
|
-
set disabled(isDisabled) {
|
|
109
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
110
|
-
}
|
|
111
|
-
get disabled() {
|
|
112
|
-
return getBooleanAttribute(this, 'disabled');
|
|
113
|
-
}
|
|
114
103
|
get dragRect() {
|
|
115
104
|
return this.#isDraggingSubscribed ? getRect(this.#$header) : null;
|
|
116
105
|
}
|
package/card/types.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ export type TSinchCardElement = HTMLElement & {
|
|
|
6
6
|
caption: string;
|
|
7
7
|
/** Label */
|
|
8
8
|
label: string | null;
|
|
9
|
-
/** Disabled */
|
|
10
|
-
disabled: boolean;
|
|
11
9
|
readonly dragRect: TRect | null;
|
|
12
10
|
/** Text */
|
|
13
11
|
setAttribute(name: 'text', value: string): void;
|
|
@@ -15,8 +13,6 @@ export type TSinchCardElement = HTMLElement & {
|
|
|
15
13
|
setAttribute(name: 'caption', value: string): void;
|
|
16
14
|
/** Label */
|
|
17
15
|
setAttribute(name: 'label', value: string): void;
|
|
18
|
-
/** Disabled */
|
|
19
|
-
setAttribute(name: 'disabled', value: ''): void;
|
|
20
16
|
/** Draggable */
|
|
21
17
|
setAttribute(name: 'draggable', value: ''): void;
|
|
22
18
|
};
|
|
@@ -27,8 +23,6 @@ export type TSinchCardReact = TSinchElementReact<TSinchCardElement> & {
|
|
|
27
23
|
caption: string;
|
|
28
24
|
/** Label */
|
|
29
25
|
label?: string;
|
|
30
|
-
/** Disabled */
|
|
31
|
-
disabled?: boolean;
|
|
32
26
|
/** Draggable */
|
|
33
27
|
draggable?: boolean;
|
|
34
28
|
};
|
package/card-container/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block}#wrapper{height:100%;padding:20px 0;box-sizing:border-box;background-color:var(--sinch-color-
|
|
2
|
+
const templateHTML = '<style>:host{display:block}#wrapper{height:100%;padding:20px 0;box-sizing:border-box;background-color:var(--sinch-comp-card-color-white-default-background-initial);border-radius:var(--sinch-comp-card-shape-radius);border:1px solid var(--sinch-comp-card-color-white-default-border-initial)}#scroll{overflow:auto;height:100%;box-sizing:border-box;padding:4px 24px}</style><div id="wrapper"><div id="scroll"><slot></slot></div></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-card-container', class extends NectaryElement {
|
package/chat-block/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { typeValues } from '../chat-bubble/utils';
|
|
2
2
|
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;display:flex;flex-direction:column;gap:4px;align-items:flex-end;padding-left:72px}#stamp{display:flex;gap:4px;margin:0;font:var(--sinch-font-
|
|
3
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;display:flex;flex-direction:column;gap:4px;align-items:flex-end;padding-left:72px}#stamp{display:flex;gap:4px;margin:0;font:var(--sinch-sys-font-body-xs);color:var(--sinch-sys-color-text-default)}#avatar{display:none;position:absolute;left:0;top:24px}:host([type=customer])>#wrapper{align-items:flex-start}:host([type=customer]) #avatar{display:block}</style><div id="wrapper"><div id="avatar"><slot name="avatar"></slot></div><p id="stamp"><span id="firstname"></span><span id="lastname"></span>•<span id="time"></span></p><slot name="bubble"></slot></div>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-chat-block', class extends NectaryElement {
|