@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/spinner/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCustomElement, getLiteralAttribute, NectaryElement, subscribeContext, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
2
2
|
import { assertSize, DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host{display:block
|
|
3
|
+
const templateHTML = '<style>@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host{display:block}#spinner-size-l,#spinner-size-m,#spinner-size-s{display:none;will-change:transform}:host([data-size="l"])>#spinner-size-l{display:block;animation:1s linear infinite spinner}:host([data-size="m"])>#spinner-size-m{display:block;animation:1s linear infinite spinner}:host([data-size="s"])>#spinner-size-s{display:block;animation:1s linear infinite spinner}.bg{opacity:.3;stroke:var(--sinch-global-color-icon,var(--sinch-sys-color-text-default))}.fg{stroke:var(--sinch-global-color-icon,var(--sinch-sys-color-text-default))}</style><svg id="spinner-size-l" width="50" height="50" fill="none"><circle class="bg" cx="25" cy="25" r="22" stroke-width="6"/><path class="fg" d="M25 3a22 22 0 0 1 22 22" stroke-width="6" stroke-linecap="round"/></svg><svg id="spinner-size-m" width="24" height="24" fill="none"><circle class="bg" cx="12" cy="12" r="9" stroke-width="4"/><path class="fg" d="M21 12a9 9 0 0 0-9-9" stroke-width="4" stroke-linecap="round"/></svg><svg id="spinner-size-s" width="16" height="16" fill="none"><circle class="bg" cx="8" cy="8" r="6" stroke-width="2"/><path class="fg" d="M14 8a6 6 0 0 0-6-6" stroke-width="2" stroke-linecap="round"/></svg>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-spinner', class extends NectaryElement {
|
package/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:table
|
|
2
|
+
const templateHTML = '<style>:host{display:table}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-table', class extends NectaryElement {
|
package/table-body/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:table-row-group}
|
|
2
|
+
const templateHTML = '<style>:host{display:table-row-group}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-table-body', class extends NectaryElement {
|
package/table-cell/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-color-
|
|
2
|
+
const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-comp-table-color-cell-default-border-initial)}#wrapper{display:flex;flex-direction:column;justify-content:center;min-height:48px;box-sizing:border-box;padding:8px}:host([align=end]) #wrapper{text-align:end;align-items:flex-end}:host([align=center]) #wrapper{text-align:center;align-items:center}</style><div id="wrapper"><slot></slot></div>';
|
|
3
3
|
import { alignValues } from './utils';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
package/table-head-cell/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import '../text';
|
|
1
2
|
import { alignValues } from '../table-cell/utils';
|
|
2
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-color-
|
|
3
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
4
|
+
const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-comp-table-color-head-cell-default-border-initial);vertical-align:middle}#wrapper{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:100%;padding:8px;box-sizing:border-box;--sinch-global-color-icon:var(--sinch-comp-table-color-head-cell-default-icon-initial)}#text{flex-shrink:1;min-width:0;--sinch-global-color-text:var(--sinch-comp-table-color-head-cell-default-text-initial)}#text:empty{display:none}:host([align=center])>#wrapper{justify-content:center}:host([align=end])>#wrapper{justify-content:flex-end}:host([fit]){width:1px}</style><div id="wrapper"><slot name="checkbox"></slot><slot name="left"></slot><sinch-text id="text" type="m"></sinch-text><slot name="tooltip"></slot><slot name="right"></slot></div>';
|
|
4
5
|
const template = document.createElement('template');
|
|
5
6
|
template.innerHTML = templateHTML;
|
|
6
7
|
defineCustomElement('sinch-table-head-cell', class extends NectaryElement {
|
|
@@ -16,15 +17,23 @@ defineCustomElement('sinch-table-head-cell', class extends NectaryElement {
|
|
|
16
17
|
this.setAttribute('scope', 'col');
|
|
17
18
|
}
|
|
18
19
|
static get observedAttributes() {
|
|
19
|
-
return ['text'];
|
|
20
|
+
return ['text', 'fit'];
|
|
20
21
|
}
|
|
21
22
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
23
|
+
if (oldVal === newVal) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
22
26
|
switch (name) {
|
|
23
27
|
case 'text':
|
|
24
28
|
{
|
|
25
29
|
this.#$text.textContent = newVal;
|
|
26
30
|
break;
|
|
27
31
|
}
|
|
32
|
+
case 'fit':
|
|
33
|
+
{
|
|
34
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
set text(value) {
|
package/table-row/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineCustomElement, getBooleanAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:table-row}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-color-
|
|
1
|
+
import { defineCustomElement, getBooleanAttribute, isAttrTrue, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
2
|
+
const templateHTML = '<style>:host{display:table-row;background-color:var(--sinch-comp-table-color-row-default-background-initial)}:host([selected]){background-color:var(--sinch-comp-table-color-row-checked-background-initial)}:host(:hover){background-color:var(--sinch-comp-table-color-row-default-background-hover)}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-comp-table-color-row-default-background-sticky)}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-table-row', class extends NectaryElement {
|
|
@@ -11,6 +11,22 @@ defineCustomElement('sinch-table-row', class extends NectaryElement {
|
|
|
11
11
|
connectedCallback() {
|
|
12
12
|
this.setAttribute('role', 'row');
|
|
13
13
|
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return ['sticky', 'selected'];
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
18
|
+
if (oldVal === newVal) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
switch (name) {
|
|
22
|
+
case 'sticky':
|
|
23
|
+
case 'selected':
|
|
24
|
+
{
|
|
25
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
14
30
|
set sticky(isSticky) {
|
|
15
31
|
updateBooleanAttribute(this, 'sticky', isSticky);
|
|
16
32
|
}
|
package/tabs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;width:100%;height:40px;border-bottom:1px solid var(--sinch-color-border-
|
|
2
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;width:100%;height:40px;border-bottom:1px solid var(--sinch-comp-tab-color-default-border-initial);box-sizing:border-box}</style><div id="wrapper"><slot></slot></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-tabs', class extends NectaryElement {
|
|
@@ -33,9 +33,6 @@ defineCustomElement('sinch-tabs', class extends NectaryElement {
|
|
|
33
33
|
static get observedAttributes() {
|
|
34
34
|
return ['value'];
|
|
35
35
|
}
|
|
36
|
-
get nodeName() {
|
|
37
|
-
return 'select';
|
|
38
|
-
}
|
|
39
36
|
set value(value) {
|
|
40
37
|
updateAttribute(this, 'value', value);
|
|
41
38
|
}
|
package/tabs/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
-
import type { SyntheticEvent } from 'react';
|
|
3
2
|
export type TSinchTabsElement = HTMLElement & {
|
|
4
3
|
/** Value */
|
|
5
4
|
value: string;
|
|
@@ -14,8 +13,6 @@ export type TSinchTabsReact = TSinchElementReact<TSinchTabsElement> & {
|
|
|
14
13
|
value: string;
|
|
15
14
|
/** Label that is used for a11y */
|
|
16
15
|
'aria-label': string;
|
|
17
|
-
/** @deprecated Change value handler */
|
|
18
|
-
onChange?: (event: SyntheticEvent<TSinchTabsElement, CustomEvent<string>>) => void;
|
|
19
16
|
/** Change value event */
|
|
20
17
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
21
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:column;padding:12px 16px 0;box-sizing:border-box;cursor:pointer;border-top-left-radius:var(--sinch-shape-radius
|
|
2
|
+
const templateHTML = '<style>:host{display:block;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:column;padding:12px 16px 0;box-sizing:border-box;cursor:pointer;background-color:var(--sinch-comp-tab-color-default-background-initial);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);height:39px;--sinch-global-color-icon:var(--sinch-comp-tab-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-tab-size-icon)}#button:hover{background-color:var(--sinch-comp-tab-color-default-background-hover)}#button:focus-visible::before{content:"";position:absolute;inset:0;bottom:-3px;border:2px solid var(--sinch-comp-tab-color-default-outline-focus);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);pointer-events:none}#button:disabled{cursor:unset;pointer-events:none;--sinch-global-color-icon:var(--sinch-comp-tab-color-disabled-icon-initial)}:host([data-checked]) #button{--sinch-global-color-icon:var(--sinch-comp-tab-color-checked-icon-initial)}:host([data-checked]) #button::after{content:"";position:absolute;left:4px;right:4px;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-comp-tab-color-checked-border-initial)}::slotted(*){display:block}</style><sinch-tooltip id="tooltip"><button id="button"><slot name="icon"></slot></button></sinch-tooltip>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-tabs-icon-option', class extends NectaryElement {
|
|
@@ -46,7 +46,9 @@ defineCustomElement('sinch-tabs-icon-option', class extends NectaryElement {
|
|
|
46
46
|
}
|
|
47
47
|
case 'disabled':
|
|
48
48
|
{
|
|
49
|
-
|
|
49
|
+
const isDisabled = isAttrTrue(newVal);
|
|
50
|
+
this.#$button.disabled = isDisabled;
|
|
51
|
+
updateBooleanAttribute(this, name, isDisabled);
|
|
50
52
|
break;
|
|
51
53
|
}
|
|
52
54
|
case 'aria-label':
|
package/tabs-option/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:block}#button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px 16px;box-sizing:border-box;cursor:pointer;border-top-left-radius:var(--sinch-shape-radius
|
|
3
|
+
const templateHTML = '<style>:host{display:block}#button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px 16px;box-sizing:border-box;cursor:pointer;background-color:var(--sinch-comp-tab-color-default-background-initial);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);height:39px;--sinch-global-color-text:var(--sinch-comp-tab-color-default-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-tab-size-icon)}#button:hover{background-color:var(--sinch-comp-tab-color-default-background-hover)}#button:focus-visible::before{content:"";position:absolute;inset:0;bottom:-3px;border:2px solid var(--sinch-comp-tab-color-default-outline-focus);border-top-left-radius:var(--sinch-comp-tab-shape-radius);border-top-right-radius:var(--sinch-comp-tab-shape-radius);pointer-events:none}#button:disabled{cursor:unset;pointer-events:none;--sinch-global-color-text:var(--sinch-comp-tab-color-disabled-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-disabled-icon-initial)}:host([data-checked]) #button{--sinch-global-color-text:var(--sinch-comp-tab-color-checked-text-initial);--sinch-global-color-icon:var(--sinch-comp-tab-color-checked-icon-initial)}:host([data-checked]) #button::after{content:"";position:absolute;left:4px;right:4px;bottom:-1px;pointer-events:none;border-top:2px solid var(--sinch-comp-tab-color-checked-border-initial)}#text{flex-shrink:1;flex-basis:auto;min-width:0;--sinch-comp-text-font:var(--sinch-comp-tab-font-label)}::slotted(*){display:block}</style><button id="button"><slot name="icon"></slot><sinch-text id="text" type="m" ellipsis></sinch-text></button>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-tabs-option', class extends NectaryElement {
|
|
@@ -23,6 +23,30 @@ defineCustomElement('sinch-tabs-option', class extends NectaryElement {
|
|
|
23
23
|
static get observedAttributes() {
|
|
24
24
|
return ['data-checked', 'disabled', 'text'];
|
|
25
25
|
}
|
|
26
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
27
|
+
if (oldVal === newVal) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
switch (name) {
|
|
31
|
+
case 'text':
|
|
32
|
+
{
|
|
33
|
+
this.#$text.textContent = newVal;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'data-checked':
|
|
37
|
+
{
|
|
38
|
+
updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'disabled':
|
|
42
|
+
{
|
|
43
|
+
const isDisabled = isAttrTrue(newVal);
|
|
44
|
+
this.#$button.disabled = isDisabled;
|
|
45
|
+
updateBooleanAttribute(this, name, isDisabled);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
26
50
|
set value(value) {
|
|
27
51
|
updateAttribute(this, 'value', value);
|
|
28
52
|
}
|
|
@@ -41,25 +65,6 @@ defineCustomElement('sinch-tabs-option', class extends NectaryElement {
|
|
|
41
65
|
get text() {
|
|
42
66
|
return getAttribute(this, 'text', '');
|
|
43
67
|
}
|
|
44
|
-
attributeChangedCallback(name, _, newVal) {
|
|
45
|
-
switch (name) {
|
|
46
|
-
case 'text':
|
|
47
|
-
{
|
|
48
|
-
this.#$text.textContent = newVal;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
case 'data-checked':
|
|
52
|
-
{
|
|
53
|
-
updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
case 'disabled':
|
|
57
|
-
{
|
|
58
|
-
this.#$button.disabled = isAttrTrue(newVal);
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
68
|
get focusable() {
|
|
64
69
|
return true;
|
|
65
70
|
}
|
package/tag/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../text';
|
|
2
|
-
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:
|
|
2
|
+
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, isAttrTrue } from '../utils';
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:var(--sinch-comp-tag-size-container-m);padding:0 9px;border-radius:var(--sinch-comp-tag-shape-radius);background-color:var(--sinch-comp-tag-color-default-background);box-sizing:border-box;user-select:none;--sinch-global-color-text:var(--sinch-comp-tag-color-default-foreground);--sinch-global-color-icon:var(--sinch-comp-tag-color-default-foreground);--sinch-global-size-icon:var(--sinch-comp-tag-size-icon-m)}:host([small]) #wrapper{height:var(--sinch-comp-tag-size-container-s);padding:0 8px;--sinch-global-size-icon:var(--sinch-comp-tag-size-icon-s)}#text{flex:1;--sinch-comp-text-font:var(--sinch-comp-tag-font-size-m-label)}:host([small]) #text{--sinch-comp-text-font:var(--sinch-comp-tag-font-size-s-label)}::slotted(*){margin-left:-4px}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="text" type="s" ellipsis></sinch-text></div>';
|
|
4
4
|
import { assertTagColor, getTagColorBg, getTagColorFg } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
|
@@ -37,9 +37,12 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
|
|
|
37
37
|
updateBooleanAttribute(this, 'small', isSmall);
|
|
38
38
|
}
|
|
39
39
|
static get observedAttributes() {
|
|
40
|
-
return ['text', 'color'];
|
|
40
|
+
return ['text', 'color', 'small'];
|
|
41
41
|
}
|
|
42
|
-
attributeChangedCallback(name,
|
|
42
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
43
|
+
if (oldVal === newVal) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
43
46
|
switch (name) {
|
|
44
47
|
case 'color':
|
|
45
48
|
{
|
|
@@ -51,6 +54,11 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
|
|
|
51
54
|
this.#$text.textContent = newVal;
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
57
|
+
case 'small':
|
|
58
|
+
{
|
|
59
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
#updateColor() {
|
|
@@ -65,12 +73,12 @@ defineCustomElement('sinch-tag', class extends NectaryElement {
|
|
|
65
73
|
const bg = getTagColorBg(colorName);
|
|
66
74
|
const fg = getTagColorFg(colorName);
|
|
67
75
|
this.#$wrapper.style.setProperty('background-color', bg);
|
|
68
|
-
this.#$wrapper.style.setProperty('color', fg);
|
|
69
|
-
this.#$wrapper.style.setProperty('--sinch-color-icon', fg);
|
|
76
|
+
this.#$wrapper.style.setProperty('--sinch-global-color-text', fg);
|
|
77
|
+
this.#$wrapper.style.setProperty('--sinch-global-color-icon', fg);
|
|
70
78
|
} else {
|
|
71
79
|
this.#$wrapper.style.removeProperty('background-color');
|
|
72
|
-
this.#$wrapper.style.removeProperty('color');
|
|
73
|
-
this.#$wrapper.style.removeProperty('--sinch-color-icon');
|
|
80
|
+
this.#$wrapper.style.removeProperty('--sinch-global-color-text');
|
|
81
|
+
this.#$wrapper.style.removeProperty('--sinch-global-color-icon');
|
|
74
82
|
}
|
|
75
83
|
}
|
|
76
84
|
});
|
package/tag/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const getTagColorBg = id => {
|
|
2
|
-
return `var(--sinch-tag-color-${id}-
|
|
2
|
+
return `var(--sinch-comp-tag-color-${id}-background)`;
|
|
3
3
|
};
|
|
4
4
|
export const getTagColorFg = id => {
|
|
5
|
-
return `var(--sinch-tag-color-${id}-
|
|
5
|
+
return `var(--sinch-comp-tag-color-${id}-foreground)`;
|
|
6
6
|
};
|
|
7
7
|
export const assertTagColor = (root, id) => {
|
|
8
|
-
if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-tag-color-${id}-
|
|
8
|
+
if (id === null || window.getComputedStyle(root).getPropertyValue(`--sinch-comp-tag-color-${id}-background`).length === 0) {
|
|
9
9
|
throw new Error(`Invalid sinch-tag color name: ${id}`);
|
|
10
10
|
}
|
|
11
11
|
};
|
package/text/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute, NectaryElement, getLiteralAttribute, updateLiteralAttribute, isAttrTrue } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block;font:var(--sinch-font-text-
|
|
2
|
+
const templateHTML = '<style>:host{display:block;font:var(--sinch-comp-text-font);color:var(--sinch-global-color-text,var(--sinch-sys-color-text-default));--sinch-comp-text-font:var(--sinch-sys-font-body-m)}:host([inline]){display:inline}:host([type="s"]){--sinch-comp-text-font:var(--sinch-sys-font-body-s)}:host([type=xs]){--sinch-comp-text-font:var(--sinch-sys-font-body-xs)}:host([type=xxs]){--sinch-comp-text-font:var(--sinch-sys-font-body-xxs)}:host([type="m"][emphasized]){--sinch-comp-text-font:var(--sinch-sys-font-body-emphasize)}:host([type="s"][emphasized]){--sinch-comp-text-font:var(--sinch-sys-font-body-emphasize-s)}:host([ellipsis]){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;--sinch-global-text-white-space:nowrap}</style><slot></slot>';
|
|
3
3
|
import { assertType, typeValues } from './utils';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
@@ -10,7 +10,33 @@ defineCustomElement('sinch-text', class extends NectaryElement {
|
|
|
10
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
11
11
|
}
|
|
12
12
|
connectedCallback() {
|
|
13
|
-
this
|
|
13
|
+
this.#updateRole();
|
|
14
|
+
}
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return ['type', 'inline', 'ellipsis', 'emphasized'];
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback(name, _, newVal) {
|
|
19
|
+
switch (name) {
|
|
20
|
+
case 'type':
|
|
21
|
+
{
|
|
22
|
+
if ('production' !== 'production') {
|
|
23
|
+
assertType(newVal);
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'inline':
|
|
28
|
+
{
|
|
29
|
+
this.#updateRole();
|
|
30
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case 'ellipsis':
|
|
34
|
+
case 'emphasized':
|
|
35
|
+
{
|
|
36
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
14
40
|
}
|
|
15
41
|
get type() {
|
|
16
42
|
return getLiteralAttribute(this, typeValues, 'type');
|
|
@@ -36,23 +62,7 @@ defineCustomElement('sinch-text', class extends NectaryElement {
|
|
|
36
62
|
get emphasized() {
|
|
37
63
|
return getBooleanAttribute(this, 'emphasized');
|
|
38
64
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
attributeChangedCallback(name, _, newVal) {
|
|
43
|
-
switch (name) {
|
|
44
|
-
case 'type':
|
|
45
|
-
{
|
|
46
|
-
if ('production' !== 'production') {
|
|
47
|
-
assertType(newVal);
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
case 'inline':
|
|
52
|
-
{
|
|
53
|
-
this.setAttribute('role', isAttrTrue(newVal) ? 'text' : 'paragraph');
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
65
|
+
#updateRole() {
|
|
66
|
+
this.setAttribute('role', getBooleanAttribute(this, 'inline') ? 'text' : 'paragraph');
|
|
57
67
|
}
|
|
58
68
|
});
|
package/textarea/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
2
2
|
import { DEFAULT_SIZE } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle
|
|
3
|
+
const templateHTML = '<style>:host{all:initial;display:inline-block;vertical-align:middle}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;box-sizing:border-box;background-color:var(--sinch-comp-textarea-color-default-background-initial);border-radius:var(--sinch-local-shape-radius);padding-right:2px;padding-bottom:2px;overflow:hidden;--sinch-local-shape-radius:var(--sinch-comp-textarea-shape-radius)}#input{all:initial;display:block;font:var(--sinch-comp-textarea-font-input);color:var(--sinch-comp-textarea-color-default-text-initial);resize:none;white-space:pre-wrap;overflow-wrap:break-word;padding:8px 10px 8px 12px;border:none}#input::placeholder{color:var(--sinch-comp-textarea-color-default-text-placeholder);opacity:1}#input:disabled{color:var(--sinch-comp-textarea-color-disabled-text-initial);-webkit-text-fill-color:var(--sinch-comp-textarea-color-disabled-text-initial)}:host([resizable]) #input{resize:vertical}#border{position:absolute;border:1px solid var(--sinch-comp-textarea-color-default-border-initial);border-radius:var(--sinch-local-shape-radius);inset:0;pointer-events:none}:host([invalid]) #border{border-color:var(--sinch-comp-textarea-color-invalid-border-initial)}#input:focus+#border{border-color:var(--sinch-comp-textarea-color-default-border-focus);border-width:2px}#input:disabled+#border{border-color:var(--sinch-comp-textarea-color-disabled-border-initial)}#bottom{display:flex;flex-direction:row;align-items:center;gap:8px;padding:8px 10px 10px 12px}#bottom.empty{display:none}</style><div id="wrapper"><textarea id="input"></textarea><div id="border"></div><div id="bottom"><slot name="bottom"></slot></div></div>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
@@ -47,7 +47,7 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
47
47
|
this.#controller.abort();
|
|
48
48
|
}
|
|
49
49
|
static get observedAttributes() {
|
|
50
|
-
return ['value', 'placeholder', 'invalid', 'disabled', 'rows'];
|
|
50
|
+
return ['value', 'placeholder', 'invalid', 'disabled', 'rows', 'resizable'];
|
|
51
51
|
}
|
|
52
52
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
53
53
|
if (oldVal === newVal) {
|
|
@@ -76,7 +76,9 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
76
76
|
}
|
|
77
77
|
case 'invalid':
|
|
78
78
|
{
|
|
79
|
-
|
|
79
|
+
const isInvalid = isAttrTrue(newVal);
|
|
80
|
+
updateExplicitBooleanAttribute(this, 'aria-invalid', isInvalid);
|
|
81
|
+
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
80
82
|
break;
|
|
81
83
|
}
|
|
82
84
|
case 'disabled':
|
|
@@ -91,11 +93,13 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
91
93
|
updateAttribute(this.#$input, 'rows', newVal);
|
|
92
94
|
break;
|
|
93
95
|
}
|
|
96
|
+
case 'resizable':
|
|
97
|
+
{
|
|
98
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
|
-
get nodeName() {
|
|
97
|
-
return 'textarea';
|
|
98
|
-
}
|
|
99
103
|
set value(value) {
|
|
100
104
|
updateAttribute(this, 'value', value);
|
|
101
105
|
}
|
package/textarea/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 TSinchTextareaElement = HTMLElement & {
|
|
4
3
|
/** Value */
|
|
5
4
|
value: string;
|
|
@@ -49,8 +48,6 @@ export type TSinchTextareaReact = TSinchElementReact<TSinchTextareaElement> & {
|
|
|
49
48
|
rows?: number;
|
|
50
49
|
/** Whether the text field is resizable */
|
|
51
50
|
resizable?: boolean;
|
|
52
|
-
/** @deprecated Change value handler */
|
|
53
|
-
onChange?: (e: SyntheticEvent<TSinchTextareaElement, CustomEvent<string>>) => void;
|
|
54
51
|
/** Change value handler */
|
|
55
52
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
56
53
|
/** Focus handler */
|
package/tile-control/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block;outline:0;--sinch-grid-num-columns:1}#wrapper{display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),auto);gap:16px;width:fit-content}:host([small]
|
|
1
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, isAttrTrue } from '../utils';
|
|
2
|
+
const templateHTML = '<style>:host{display:block;outline:0;--sinch-grid-num-columns:1}#wrapper{display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),auto);gap:16px;width:fit-content}:host([small]) #wrapper{gap:8px}:host([cols="2"]){--sinch-grid-num-columns:2}:host([cols="3"]){--sinch-grid-num-columns:3}:host([cols="4"]){--sinch-grid-num-columns:4}:host([cols="5"]){--sinch-grid-num-columns:5}:host([cols="6"]){--sinch-grid-num-columns:6}:host([cols="7"]){--sinch-grid-num-columns:7}:host([cols="8"]){--sinch-grid-num-columns:8}</style><div id="wrapper"><slot></slot></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
@@ -24,8 +24,27 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
|
24
24
|
static get observedAttributes() {
|
|
25
25
|
return ['value', 'small', 'multiple'];
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
28
|
+
if (oldVal === newVal) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
switch (name) {
|
|
32
|
+
case 'value':
|
|
33
|
+
{
|
|
34
|
+
this.#onValueChange(newVal ?? '');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'small':
|
|
38
|
+
{
|
|
39
|
+
this.#onSmallChange();
|
|
40
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'multiple':
|
|
44
|
+
{
|
|
45
|
+
this.#onValueChange(this.value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
29
48
|
}
|
|
30
49
|
set value(value) {
|
|
31
50
|
updateAttribute(this, 'value', value);
|
|
@@ -51,27 +70,6 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
|
51
70
|
get cols() {
|
|
52
71
|
return getIntegerAttribute(this, 'cols', 1);
|
|
53
72
|
}
|
|
54
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
55
|
-
if (oldVal === newVal) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
switch (name) {
|
|
59
|
-
case 'value':
|
|
60
|
-
{
|
|
61
|
-
this.#onValueChange(newVal ?? '');
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case 'small':
|
|
65
|
-
{
|
|
66
|
-
this.#onSmallChange();
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case 'multiple':
|
|
70
|
-
{
|
|
71
|
-
this.#onValueChange(this.value);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
73
|
#onSlotChange = () => {
|
|
76
74
|
this.#onValueChange(this.value);
|
|
77
75
|
this.#onSmallChange();
|
package/tile-control/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 TSinchTileControlElement = HTMLElement & {
|
|
4
3
|
/** Value */
|
|
5
4
|
value: string;
|
|
@@ -31,8 +30,6 @@ export type TSinchTileControlReact = TSinchElementReact<TSinchTileControlElement
|
|
|
31
30
|
cols: number;
|
|
32
31
|
/** Label that is used for a11y */
|
|
33
32
|
'aria-label': string;
|
|
34
|
-
/** @deprecated Change value handler */
|
|
35
|
-
onChange?: (event: SyntheticEvent<TSinchTileControlElement, CustomEvent<string>>) => void;
|
|
36
33
|
/** Change value handler */
|
|
37
34
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
38
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:var(--sinch-local-size);height:var(--sinch-local-size);padding:16px 8px 8px;border-radius:var(--sinch-local-shape-radius);background-color:var(--sinch-local-color-background);box-shadow:var(--sinch-local-shadow);cursor:pointer;--sinch-local-color-background:var(--sinch-comp-tile-control-color-default-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-default-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-default-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-default-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-initial);--sinch-local-shape-radius:var(--sinch-comp-tile-control-shape-radius-l);--sinch-local-size:88px;--sinch-local-size-icon:var(--sinch-comp-tile-control-size-m-icon)}button::before{content:"";position:absolute;inset:0;border:1px solid var(--sinch-local-color-border);border-radius:var(--sinch-local-shape-radius);pointer-events:none}button:focus-visible::after{position:absolute;content:"";inset:-4px;padding:2px;border:2px solid var(--sinch-comp-tile-control-color-default-outline-focus);border-radius:calc(var(--sinch-local-shape-radius) + 4px);pointer-events:none}:host([data-small])>button{padding:12px 4px 4px;--sinch-local-shape-radius:var(--sinch-comp-tile-control-shape-radius-s);--sinch-local-size:64px;--sinch-local-size-icon:var(--sinch-comp-tile-control-size-s-icon)}button:enabled:hover{--sinch-local-color-background:var(--sinch-comp-tile-control-color-default-background-hover);--sinch-local-color-border:var(--sinch-comp-tile-control-color-default-border-hover);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-hover)}:host([data-checked])>button:enabled,button:enabled:active{--sinch-local-color-background:var(--sinch-comp-tile-control-color-checked-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-checked-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-checked-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-checked-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-active)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px}button:disabled{cursor:initial;--sinch-local-color-background:var(--sinch-comp-tile-control-color-disabled-background-initial);--sinch-local-color-border:var(--sinch-comp-tile-control-color-disabled-border-initial);--sinch-local-color-text:var(--sinch-comp-tile-control-color-disabled-text-initial);--sinch-local-color-icon:var(--sinch-comp-tile-control-color-disabled-icon-initial);--sinch-local-shadow:var(--sinch-comp-tile-control-shadow-disabled)}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-comp-tile-control-font-label);color:var(--sinch-local-color-text);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:var(--sinch-local-size-icon);height:var(--sinch-local-size-icon);align-self:center;--sinch-global-size-icon:var(--sinch-local-size-icon);--sinch-global-color-icon:var(--sinch-local-color-icon)}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|