@nectary/components 2.1.0 → 2.1.2
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 -4
- package/accordion-item/index.js +1 -1
- package/action-menu/index.js +1 -1
- package/action-menu-option/index.js +2 -4
- package/button/index.js +2 -1
- package/checkbox/index.js +4 -5
- package/chip/index.js +1 -1
- package/color-menu/index.js +3 -3
- package/date-picker/index.js +0 -8
- package/emoji-picker/index.js +1 -34
- package/file-picker/index.js +11 -9
- package/icon-button/index.js +1 -0
- package/input/index.js +0 -4
- package/package.json +1 -1
- package/pagination/index.js +0 -4
- package/pagination/types.d.ts +0 -1
- package/radio/index.js +0 -4
- package/radio/types.d.ts +0 -1
- package/segment-collapse/index.js +0 -4
- package/segment-collapse/types.d.ts +0 -1
- package/segmented-control/index.js +0 -4
- package/segmented-icon-control/index.js +0 -4
- package/select-button/index.js +2 -1
- package/select-menu/index.js +4 -10
- package/skeleton/index.js +45 -9
- package/skeleton-item/index.js +1 -28
- package/table-row/index.js +1 -1
- package/tabs/index.js +0 -4
- package/textarea/index.js +0 -4
- package/tile-control/index.js +0 -4
- package/time-picker/index.js +1 -6
- package/toggle/index.js +0 -4
- package/toggle/types.d.ts +0 -1
package/accordion/index.js
CHANGED
|
@@ -56,10 +56,6 @@ defineCustomElement('sinch-accordion', class extends NectaryElement {
|
|
|
56
56
|
const $elem = e.target;
|
|
57
57
|
const value = e.detail;
|
|
58
58
|
const result = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : getBooleanAttribute($elem, 'data-checked') ? '' : value;
|
|
59
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
60
|
-
detail: result,
|
|
61
|
-
bubbles: true
|
|
62
|
-
}));
|
|
63
59
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
64
60
|
detail: result
|
|
65
61
|
}));
|
package/accordion-item/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import '../icon';
|
|
|
2
2
|
import '../title';
|
|
3
3
|
import '../text';
|
|
4
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>';
|
|
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)}:host(:last-child)>#wrapper{border-bottom:none}#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>';
|
|
6
6
|
import { statusValues } from './utils';
|
|
7
7
|
const template = document.createElement('template');
|
|
8
8
|
template.innerHTML = templateHTML;
|
package/action-menu/index.js
CHANGED
|
@@ -92,9 +92,9 @@ defineCustomElement('sinch-action-menu', class extends NectaryElement {
|
|
|
92
92
|
case 'Enter':
|
|
93
93
|
case 'Space':
|
|
94
94
|
{
|
|
95
|
+
e.preventDefault();
|
|
95
96
|
const $opt = this.#findSelectedOption();
|
|
96
97
|
if ($opt !== null) {
|
|
97
|
-
e.preventDefault();
|
|
98
98
|
$opt.click();
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
@@ -1,17 +1,15 @@
|
|
|
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;
|
|
3
|
+
const templateHTML = '<style>:host{display:block;cursor:pointer}:host([disabled]){cursor:initial}#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;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{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" inert><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 {
|
|
7
|
-
#$wrapper;
|
|
8
7
|
#$content;
|
|
9
8
|
#controller = null;
|
|
10
9
|
constructor() {
|
|
11
10
|
super();
|
|
12
11
|
const shadowRoot = this.attachShadow();
|
|
13
12
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
|
-
this.#$wrapper = shadowRoot.querySelector('#wrapper');
|
|
15
13
|
this.#$content = shadowRoot.querySelector('#content');
|
|
16
14
|
}
|
|
17
15
|
connectedCallback() {
|
|
@@ -20,7 +18,7 @@ defineCustomElement('sinch-action-menu-option', class ActionMenuOption extends N
|
|
|
20
18
|
signal
|
|
21
19
|
} = this.#controller;
|
|
22
20
|
this.setAttribute('role', 'option');
|
|
23
|
-
this
|
|
21
|
+
this.addEventListener('mousedown', this.#onMouseDown, {
|
|
24
22
|
signal
|
|
25
23
|
});
|
|
26
24
|
this.addEventListener('-click', this.#onClickReactHandler, {
|
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 { DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
3
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#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]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-focus)}:host([type=secondary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-focus)}:host([type=tertiary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-focus)}:host([type=cta-primary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-focus)}:host([type=cta-secondary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-focus)}:host([type=destructive]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-destructive-focus)}:host([type=primary]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--sinch-local-color-background:var(--sinch-comp-button-color-danger-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-danger-active)}:host([type=primary][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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)}#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}:host(:not([disabled]):active) #button::before{border-width:2px}:host(:focus-visible) #button::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><div id="button" inert><div id="content"><slot name="left-icon"></slot><span id="text"></span><slot name="right-icon"></slot></div></div>';
|
|
3
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;cursor:pointer}:host([disabled]){cursor:initial}#button{all:initial;display:block;position:relative;width:100%;height:var(--sinch-local-size);--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)}: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]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-primary-focus)}:host([type=secondary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-secondary-focus)}:host([type=tertiary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-tertiary-focus)}:host([type=cta-primary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-primary-focus)}:host([type=cta-secondary]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-cta-secondary-focus)}:host([type=destructive]:focus-visible)>#button{--sinch-local-shadow:var(--sinch-comp-button-shadow-destructive-focus)}:host([type=primary]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--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]:hover)>#button{--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]:active)>#button{--sinch-local-color-background:var(--sinch-comp-button-color-danger-default-background-active);--sinch-local-shadow:var(--sinch-comp-button-shadow-danger-active)}:host([type=primary][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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][disabled])>#button{--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)}#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}:host(:not([disabled]):active) #button::before{border-width:2px}:host(:focus-visible) #button::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><div id="button" inert><div id="content"><slot name="left-icon"></slot><span id="text"></span><slot name="right-icon"></slot></div></div>';
|
|
4
4
|
import { typeValues } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
|
@@ -139,6 +139,7 @@ defineCustomElement('sinch-button', class extends NectaryElement {
|
|
|
139
139
|
case 'Space':
|
|
140
140
|
case 'Enter':
|
|
141
141
|
{
|
|
142
|
+
e.preventDefault();
|
|
142
143
|
this.click();
|
|
143
144
|
}
|
|
144
145
|
}
|
package/checkbox/index.js
CHANGED
|
@@ -32,7 +32,10 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
|
|
|
32
32
|
static get observedAttributes() {
|
|
33
33
|
return ['checked', 'disabled', 'text', 'invalid', 'indeterminate'];
|
|
34
34
|
}
|
|
35
|
-
attributeChangedCallback(name,
|
|
35
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
36
|
+
if (newVal === oldVal) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
36
39
|
switch (name) {
|
|
37
40
|
case 'text':
|
|
38
41
|
{
|
|
@@ -105,10 +108,6 @@ defineCustomElement('sinch-checkbox', class extends NectaryElement {
|
|
|
105
108
|
e.stopPropagation();
|
|
106
109
|
const isChecked = this.#$input.checked;
|
|
107
110
|
this.#$input.checked = this.checked;
|
|
108
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
109
|
-
detail: isChecked,
|
|
110
|
-
bubbles: true
|
|
111
|
-
}));
|
|
112
111
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
113
112
|
detail: isChecked
|
|
114
113
|
}));
|
package/chip/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import '../icon';
|
|
3
3
|
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement, getReactEventHandler, isAttrTrue } from '../utils';
|
|
4
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#button{all:initial;position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:var(--sinch-comp-chip-size-container-m);padding:0 5px 0 9px;border-radius:var(--sinch-comp-chip-shape-radius);background-color:var(--sinch-comp-chip-color-neutral-default-background-initial);box-sizing:border-box
|
|
4
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;cursor:pointer}#button{all:initial;position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:var(--sinch-comp-chip-size-container-m);padding:0 5px 0 9px;border-radius:var(--sinch-comp-chip-shape-radius);background-color:var(--sinch-comp-chip-color-neutral-default-background-initial);box-sizing:border-box;--sinch-global-color-text:var(--sinch-comp-chip-color-neutral-default-foreground-initial);--sinch-global-color-icon:var(--sinch-comp-chip-color-neutral-default-foreground-initial);--sinch-global-size-icon:var(--sinch-comp-chip-size-icon-m)}:host(:focus-visible)>#button::after{content:"";position:absolute;inset:-4px;border-radius:calc(var(--sinch-comp-chip-shape-radius) + 4px);border:2px solid var(--sinch-comp-chip-color-outiline-focus);pointer-events:none}#text{flex:1;--sinch-comp-text-font:var(--sinch-comp-chip-font-size-m-label)}:host([small]) #button{height:var(--sinch-comp-chip-size-container-s);padding:0 3px 0 7px;--sinch-global-size-icon:var(--sinch-comp-chip-size-icon-s)}:host([small]) #text{--sinch-comp-text-font:var(--sinch-comp-chip-font-size-s-label)}::slotted(*){margin-left:-4px}</style><div id="button" inert><slot name="icon"></slot><sinch-text id="text" type="xs" ellipsis></sinch-text><sinch-icon id="icon-close" name="cancel"></sinch-icon></div>';
|
|
5
5
|
import { getChipColorBg, getChipColorFg } from './utils';
|
|
6
6
|
const template = document.createElement('template');
|
|
7
7
|
template.innerHTML = templateHTML;
|
package/color-menu/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, getRect, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateIntegerAttribute, subscribeContext } from '../utils';
|
|
1
|
+
import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, getRect, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateIntegerAttribute, subscribeContext, isTargetEqual } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:block;outline:0}#listbox{display:flex;flex-direction:row;flex-wrap:wrap;padding:4px 10px;overflow-y:auto}#listbox.empty{display:none}</style><div id="listbox" role="presentation"><slot id="options"></slot></div>';
|
|
3
3
|
const NUM_COLS_DEFAULT = 5;
|
|
4
4
|
const ITEM_WIDTH = 44;
|
|
@@ -132,7 +132,7 @@ defineCustomElement('sinch-color-menu', class extends NectaryElement {
|
|
|
132
132
|
};
|
|
133
133
|
#onListboxClick = e => {
|
|
134
134
|
const $elem = e.target;
|
|
135
|
-
if (
|
|
135
|
+
if (isTargetEqual(e, this.#$listbox)) {
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
this.focus();
|
|
@@ -156,9 +156,9 @@ defineCustomElement('sinch-color-menu', class extends NectaryElement {
|
|
|
156
156
|
case 'Space':
|
|
157
157
|
case 'Enter':
|
|
158
158
|
{
|
|
159
|
+
e.preventDefault();
|
|
159
160
|
const $option = this.#findSelectedOption();
|
|
160
161
|
if ($option !== null) {
|
|
161
|
-
e.preventDefault();
|
|
162
162
|
this.#dispatchChangeEvent($option);
|
|
163
163
|
}
|
|
164
164
|
break;
|
package/date-picker/index.js
CHANGED
|
@@ -259,10 +259,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
259
259
|
this.#date2 = dateTuple[1];
|
|
260
260
|
this.#unsubscribeRangeHover();
|
|
261
261
|
this.#render();
|
|
262
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
263
|
-
detail: value,
|
|
264
|
-
bubbles: true
|
|
265
|
-
}));
|
|
266
262
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
267
263
|
detail: value
|
|
268
264
|
}));
|
|
@@ -274,10 +270,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
274
270
|
this.#render();
|
|
275
271
|
return;
|
|
276
272
|
}
|
|
277
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
278
|
-
detail: dateIso,
|
|
279
|
-
bubbles: true
|
|
280
|
-
}));
|
|
281
273
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
282
274
|
detail: dateIso
|
|
283
275
|
}));
|
package/emoji-picker/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import '../tabs-icon-option';
|
|
|
9
9
|
import '../emoji';
|
|
10
10
|
import '../text';
|
|
11
11
|
import '../icon';
|
|
12
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, getReactEventHandler, getRect,
|
|
12
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, getReactEventHandler, getRect, debounceTimeout, setClass } from '../utils';
|
|
13
13
|
import dataJson from './data.json';
|
|
14
14
|
const templateHTML = '<style>:host{display:block}#wrapper{width:384px;max-height:504px;display:flex;flex-direction:column;gap:8px;padding:12px 0}#toolbar{display:flex;gap:8px;padding:0 12px}#search{flex:1;min-width:0}#search-clear:not(.active){display:none}#list-wrapper{overflow-y:auto;overflow-x:hidden;width:384px;box-sizing:border-box;scrollbar-gutter:stable}#list{display:flex;flex-wrap:wrap;gap:8px;padding:4px 12px 0;width:384px;box-sizing:border-box}#not-found{display:none;width:100%;height:48px;align-items:center;justify-content:center;pointer-events:none;user-select:none;--sinch-global-color-text:var(--sinch-comp-emoji-picker-color-default-text-not-found);--sinch-comp-text-font:var(--sinch-comp-emoji-picker-font-not-found)}#not-found.active{display:flex}#tabs svg{pointer-events:none;height:var(--sinch-global-size-icon);fill:var(--sinch-global-color-icon)}</style><div id="wrapper"><div id="toolbar"><sinch-input id="search" size="l" aria-label="Search emojis"><sinch-icon id="icon-search" slot="icon" name="search"></sinch-icon><sinch-icon-button id="search-clear" slot="right" aria-label="Clear"><sinch-icon slot="icon" name="close"></sinch-icon></sinch-icon-button></sinch-input><sinch-popover id="skin-popover" orientation="bottom-left" aria-label="Emoji skin tone select"><sinch-icon-button id="skin-button" slot="target" size="l" aria-label="Select emoji skin tones"><sinch-color-swatch id="skin-swatch" slot="icon" name="skintone-default"></sinch-color-swatch></sinch-icon-button><sinch-color-menu id="skin-menu" slot="content" cols="1" value="skintone-default" aria-label="Emoji skin tone menu"><sinch-color-menu-option value="skintone-default"></sinch-color-menu-option><sinch-color-menu-option value="skintone-light"></sinch-color-menu-option><sinch-color-menu-option value="skintone-light-medium"></sinch-color-menu-option><sinch-color-menu-option value="skintone-medium"></sinch-color-menu-option><sinch-color-menu-option value="skintone-medium-dark"></sinch-color-menu-option><sinch-color-menu-option value="skintone-dark"></sinch-color-menu-option></sinch-color-menu></sinch-popover></div><sinch-tabs id="tabs" aria-label="Emoji groups"><sinch-tabs-icon-option id="tab-emotions"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M15.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm-7 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2ZM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8Zm4.41-6.11a.745.745 0 0 0-1.03.24A3.98 3.98 0 0 1 12 16c-1.38 0-2.64-.7-3.38-1.88a.747.747 0 1 0-1.27.79A5.446 5.446 0 0 0 12 17.5c1.9 0 3.63-.97 4.65-2.58.22-.35.11-.81-.24-1.03Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-people"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 6a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/><path d="M15.89 8.11C15.5 7.72 14.83 7 13.53 7h-2.54a5.023 5.023 0 0 1-4.92-4.15.998.998 0 0 0-.98-.85c-.61 0-1.09.54-1 1.14A7.037 7.037 0 0 0 9 8.71V21c0 .55.45 1 1 1s1-.45 1-1v-5h2v5c0 .55.45 1 1 1s1-.45 1-1V10.05l3.24 3.24a.996.996 0 1 0 1.41-1.41l-3.76-3.77Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-animals"><svg slot="icon" viewBox="0 0 24 24"><path d="M17 14c-.24-.24-.44-.49-.65-.75C17.51 11.5 19 8.56 19 5c0-1.95-.74-3-2-3-1.54 0-3.96 2.06-5 5.97C10.96 4.06 8.54 2 7 2 5.74 2 5 3.05 5 5c0 3.56 1.49 6.5 2.65 8.25-.21.26-.41.51-.65.75-.25.25-2 1.39-2 3.5C5 19.98 7.02 22 9.5 22c1.5 0 2.5-.5 2.5-.5s1 .5 2.5.5c2.48 0 4.5-2.02 4.5-4.5 0-2.11-1.75-3.25-2-3.5Zm-.12-9.97c.06.17.12.48.12.97 0 2.84-1.11 5.24-2.07 6.78-.38-.26-.83-.48-1.4-.62.24-4.52 2.44-6.83 3.35-7.13ZM7 5c0-.49.06-.8.12-.97.91.3 3.11 2.61 3.36 7.13-.58.14-1.03.35-1.4.62C8.11 10.24 7 7.84 7 5Zm7.5 15c-1 0-1.8-.33-2.22-.56.42-.18.72-.71.72-.94 0-.28-.45-.5-1-.5s-1 .22-1 .5c0 .23.3.76.72.94-.42.23-1.22.56-2.22.56A2.5 2.5 0 0 1 7 17.5c0-.7.43-1.24 1-1.73.44-.36.61-.52 1.3-1.37.76-.95 1.09-1.4 2.7-1.4s1.94.45 2.7 1.4c.69.85.86 1.01 1.3 1.37.57.49 1 1.03 1 1.73a2.5 2.5 0 0 1-2.5 2.5Zm-.5-4c0 .41-.22.75-.5.75s-.5-.34-.5-.75.22-.75.5-.75.5.34.5.75Zm-3 0c0 .41-.22.75-.5.75s-.5-.34-.5-.75.22-.75.5-.75.5.34.5.75Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-food"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19 19H3c-.55 0-1 .45-1 1s.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1Zm1-16H9v2.4l1.81 1.45c.12.09.19.24.19.39v4.26c0 .28-.22.5-.5.5h-4c-.28 0-.5-.22-.5-.5V7.24c0-.15.07-.3.19-.39L8 5.4V3H6c-1.1 0-2 .9-2 2v8c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm0 5h-2V5h2v3Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-travel"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m21.99 14.77-1.43-4.11c-.14-.4-.52-.66-.97-.66H12.4c-.46 0-.83.26-.98.66L10 14.77v5.24c0 .55.45.99 1 .99s1-.45 1-1v-1h8v1a1 1 0 0 0 2 .01l-.01-5.24Zm-10.38-1.43.69-2c.05-.2.24-.34.46-.34h6.48c.21 0 .4.14.47.34l.69 2a.5.5 0 0 1-.47.66h-7.85a.5.5 0 0 1-.47-.66Zm.38 3.66c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1Zm8 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1Z"/><path d="M14 4.5V9h1V4c0-.55-.45-1-1-1H8c-.55 0-1 .45-1 1v4H3c-.55 0-1 .45-1 1v12h1V9.5c0-.28.22-.5.5-.5h4c.28 0 .5-.22.5-.5v-4c0-.28.22-.5.5-.5h5c.28 0 .5.22.5.5Z"/><path d="M7 11H5v2h2v-2Zm5-6h-2v2h2V5ZM7 15H5v2h2v-2Zm0 4H5v2h2v-2Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-sports"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19.52 2.49C17.18.15 12.9.62 9.97 3.55c-1.6 1.6-2.52 3.87-2.54 5.46-.02 1.58.26 3.89-1.35 5.5l-3.54 3.53c-.39.39-.39 1.02 0 1.42.39.39 1.02.39 1.42 0l3.53-3.54c1.61-1.61 3.92-1.33 5.5-1.35 1.58-.02 3.86-.94 5.46-2.54 2.93-2.92 3.41-7.2 1.07-9.54Zm-9.2 9.19c-1.53-1.53-1.05-4.61 1.06-6.72 2.11-2.11 5.18-2.59 6.72-1.06 1.53 1.53 1.05 4.61-1.06 6.72-2.11 2.11-5.18 2.59-6.72 1.06ZM18 17c.53 0 1.04.21 1.41.59.78.78.78 2.05 0 2.83-.37.37-.88.58-1.41.58-.53 0-1.04-.21-1.41-.59-.78-.78-.78-2.05 0-2.83.37-.37.88-.58 1.41-.58Zm0-2a3.998 3.998 0 0 0-2.83 6.83c.78.78 1.81 1.17 2.83 1.17a3.998 3.998 0 0 0 2.83-6.83A3.998 3.998 0 0 0 18 15Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-objects"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 3c-.46 0-.93.04-1.4.14-2.76.53-4.96 2.76-5.48 5.52-.48 2.61.48 5.01 2.22 6.56.43.38.66.91.66 1.47V19c0 1.1.9 2 2 2h.28a1.98 1.98 0 0 0 3.44 0H14c1.1 0 2-.9 2-2v-2.31c0-.55.22-1.09.64-1.46A6.956 6.956 0 0 0 19 10c0-3.87-3.13-7-7-7Zm.5 11h-1v-2.59L9.67 9.59l.71-.71L12 10.5l1.62-1.62.71.71-1.83 1.83V14Zm1 5c-.01 0-.02-.01-.03-.01V19h-2.94v-.01c-.01 0-.02.01-.03.01-.28 0-.5-.22-.5-.5s.22-.5.5-.5c.01 0 .02.01.03.01V18h2.94v.01c.01 0 .02-.01.03-.01.28 0 .5.22.5.5s-.22.5-.5.5Zm0-2h-3c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h3c.28 0 .5.22.5.5s-.22.5-.5.5Z"/></svg></sinch-tabs-icon-option><sinch-tabs-icon-option id="tab-symbols"><svg slot="icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M10 5H4c-.55 0-1 .45-1 1s.45 1 1 1h2v3c0 .55.45 1 1 1s1-.45 1-1V7h2c.55 0 1-.45 1-1s-.45-1-1-1Zm0-3H4c-.55 0-1 .45-1 1s.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1Zm10.89 11.11a.996.996 0 0 0-1.41 0l-6.36 6.36a.996.996 0 1 0 1.41 1.41l6.36-6.36a.996.996 0 0 0 0-1.41ZM14.5 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm5 5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm-4-10A2.5 2.5 0 0 0 18 8.5V4h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1v3.51c-.42-.32-.93-.51-1.5-.51a2.5 2.5 0 0 0 0 5Zm-5.05 7.09a.996.996 0 1 0-1.41-1.41l-.71.71-.71-.71.35-.35a2.499 2.499 0 0 0-1.77-4.27 2.499 2.499 0 0 0-1.77 4.27l.35.35-1.06 1.06c-.98.98-.98 2.56 0 3.54.5.48 1.14.72 1.78.72.64 0 1.28-.24 1.77-.73l1.06-1.06.71.71a.996.996 0 1 0 1.41-1.41l-.71-.71.71-.71Zm-4.6-3.89a.5.5 0 0 1 .35-.15.5.5 0 0 1 .35.15c.19.2.19.51 0 .71l-.35.35-.35-.36a.5.5 0 0 1-.15-.35.5.5 0 0 1 .15-.35Zm0 5.65a.5.5 0 0 1-.35.15.5.5 0 0 1-.35-.15.5.5 0 0 1-.15-.35.5.5 0 0 1 .15-.35l1.06-1.06.71.71-1.07 1.05Z"/></svg></sinch-tabs-icon-option></sinch-tabs><div id="list-wrapper"><div id="list"></div><div id="not-found"><sinch-text type="m">No results</sinch-text></div></div></div>';
|
|
15
15
|
const groupLabels = ['Emotions', 'People', 'Animals and nature', 'Food and drinks', 'Travel and places', 'Sports and activities', 'Objects', 'Symbols and flags'];
|
|
@@ -63,9 +63,6 @@ defineCustomElement('sinch-emoji-picker', class extends NectaryElement {
|
|
|
63
63
|
this.#$searchClearButton.addEventListener('-click', this.#onSearchClearClick, {
|
|
64
64
|
signal
|
|
65
65
|
});
|
|
66
|
-
this.addEventListener('keydown', this.#onListboxKeyDown, {
|
|
67
|
-
signal
|
|
68
|
-
});
|
|
69
66
|
this.#$skinButton.addEventListener('-click', this.#onSkinButtonClick, {
|
|
70
67
|
signal
|
|
71
68
|
});
|
|
@@ -81,8 +78,6 @@ defineCustomElement('sinch-emoji-picker', class extends NectaryElement {
|
|
|
81
78
|
this.addEventListener('-change', this.#onChangeReactHandler, {
|
|
82
79
|
signal
|
|
83
80
|
});
|
|
84
|
-
subscribeContext(this, 'keydown', this.#onContextKeyDown, signal);
|
|
85
|
-
subscribeContext(this, 'visibility', this.#onContextVisibility, signal);
|
|
86
81
|
this.#updateTabs();
|
|
87
82
|
this.#updateEmojis();
|
|
88
83
|
}
|
|
@@ -118,34 +113,6 @@ defineCustomElement('sinch-emoji-picker', class extends NectaryElement {
|
|
|
118
113
|
detail: value
|
|
119
114
|
}));
|
|
120
115
|
};
|
|
121
|
-
#onContextKeyDown = e => {
|
|
122
|
-
this.#handleKeydown(e.detail);
|
|
123
|
-
};
|
|
124
|
-
#onContextVisibility = e => {
|
|
125
|
-
if (e.detail) {} else {}
|
|
126
|
-
};
|
|
127
|
-
#onListboxKeyDown = e => {
|
|
128
|
-
this.#handleKeydown(e);
|
|
129
|
-
};
|
|
130
|
-
#handleKeydown(e) {
|
|
131
|
-
switch (e.code) {
|
|
132
|
-
case 'Space':
|
|
133
|
-
case 'Enter':
|
|
134
|
-
{
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
case 'ArrowUp':
|
|
138
|
-
{
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
case 'ArrowDown':
|
|
143
|
-
{
|
|
144
|
-
e.preventDefault();
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
116
|
#onTabsChange = e => {
|
|
150
117
|
const value = e.detail;
|
|
151
118
|
updateAttribute(this.#$tabs, 'value', value);
|
package/file-picker/index.js
CHANGED
|
@@ -7,6 +7,7 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
7
7
|
#$input;
|
|
8
8
|
#$targetSlot;
|
|
9
9
|
#$target = null;
|
|
10
|
+
#controller = null;
|
|
10
11
|
constructor() {
|
|
11
12
|
super();
|
|
12
13
|
const shadowRoot = this.attachShadow();
|
|
@@ -16,18 +17,19 @@ defineCustomElement('sinch-file-picker', class extends NectaryElement {
|
|
|
16
17
|
this.#$targetSlot = shadowRoot.querySelector('slot');
|
|
17
18
|
}
|
|
18
19
|
connectedCallback() {
|
|
19
|
-
this
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
this.#controller = new AbortController();
|
|
21
|
+
const options = {
|
|
22
|
+
signal: this.#controller.signal
|
|
23
|
+
};
|
|
24
|
+
this.#$targetSlot.addEventListener('slotchange', this.#onTargetSlotChange, options);
|
|
25
|
+
this.#$input.addEventListener('change', this.#onInputChange, options);
|
|
26
|
+
this.addEventListener('-change', this.#onChangeReactHandler, options);
|
|
27
|
+
this.addEventListener('-invalid', this.#onInvalidReactHandler, options);
|
|
23
28
|
this.#onTargetSlotChange();
|
|
24
29
|
}
|
|
25
30
|
disconnectedCallback() {
|
|
26
|
-
this
|
|
27
|
-
this
|
|
28
|
-
this.removeEventListener('-change', this.#onChangeReactHandler);
|
|
29
|
-
this.removeEventListener('-invalid', this.#onInvalidReactHandler);
|
|
30
|
-
this.#$target?.removeEventListener('-click', this.#onTargetClick);
|
|
31
|
+
this.#controller.abort();
|
|
32
|
+
this.#controller = null;
|
|
31
33
|
this.#$target = null;
|
|
32
34
|
}
|
|
33
35
|
static get observedAttributes() {
|
package/icon-button/index.js
CHANGED
package/input/index.js
CHANGED
|
@@ -242,10 +242,6 @@ defineCustomElement('sinch-input', class extends NectaryElement {
|
|
|
242
242
|
}
|
|
243
243
|
this.#isPendingDk = false;
|
|
244
244
|
this.#cursorPos = nextCursorPos;
|
|
245
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
246
|
-
detail: nextValue,
|
|
247
|
-
bubbles: true
|
|
248
|
-
}));
|
|
249
245
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
250
246
|
detail: nextValue
|
|
251
247
|
}));
|
package/package.json
CHANGED
package/pagination/index.js
CHANGED
|
@@ -120,10 +120,6 @@ defineCustomElement('sinch-pagination', class extends NectaryElement {
|
|
|
120
120
|
}
|
|
121
121
|
#dispatchChangeEvent(value) {
|
|
122
122
|
const detail = this.#clamp(value);
|
|
123
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
124
|
-
detail,
|
|
125
|
-
bubbles: true
|
|
126
|
-
}));
|
|
127
123
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
128
124
|
detail
|
|
129
125
|
}));
|
package/pagination/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export type TSinchPaginationElement = HTMLElement & {
|
|
|
5
5
|
readonly prevButtonRect: TRect;
|
|
6
6
|
readonly nextButtonRect: TRect;
|
|
7
7
|
nthButtonRect(index: number): TRect | null;
|
|
8
|
-
addEventListener(type: 'change', listener: (e: CustomEvent<number>) => void): void;
|
|
9
8
|
addEventListener(type: '-change', listener: (e: CustomEvent<number>) => void): void;
|
|
10
9
|
setAttribute(name: 'value', value: string): void;
|
|
11
10
|
setAttribute(name: 'max', value: string): void;
|
package/radio/index.js
CHANGED
|
@@ -95,10 +95,6 @@ defineCustomElement('sinch-radio', class extends NectaryElement {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
#dispatchChangeEvent(value) {
|
|
98
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
99
|
-
detail: value,
|
|
100
|
-
bubbles: true
|
|
101
|
-
}));
|
|
102
98
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
103
99
|
detail: value
|
|
104
100
|
}));
|
package/radio/types.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export type TSinchRadioElement = HTMLElement & {
|
|
3
3
|
value: string;
|
|
4
4
|
invalid: boolean;
|
|
5
|
-
addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
6
5
|
addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
7
6
|
setAttribute(name: 'value', value: string): void;
|
|
8
7
|
setAttribute(name: 'invalid', value: ''): void;
|
|
@@ -50,10 +50,6 @@ defineCustomElement('sinch-segment-collapse', class extends NectaryElement {
|
|
|
50
50
|
}
|
|
51
51
|
#onClick = () => {
|
|
52
52
|
const detail = !this.value;
|
|
53
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
54
|
-
detail,
|
|
55
|
-
bubbles: true
|
|
56
|
-
}));
|
|
57
53
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
58
54
|
detail
|
|
59
55
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export type TSinchSegmentExpandElement = HTMLElement & {
|
|
3
3
|
value: boolean;
|
|
4
|
-
addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
5
4
|
addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
6
5
|
setAttribute(name: 'value', value: string): void;
|
|
7
6
|
};
|
|
@@ -48,10 +48,6 @@ defineCustomElement('sinch-segmented-control', class extends NectaryElement {
|
|
|
48
48
|
#onOptionChange = e => {
|
|
49
49
|
e.stopPropagation();
|
|
50
50
|
const detail = e.detail;
|
|
51
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
52
|
-
detail,
|
|
53
|
-
bubbles: true
|
|
54
|
-
}));
|
|
55
51
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
56
52
|
detail
|
|
57
53
|
}));
|
|
@@ -56,10 +56,6 @@ defineCustomElement('sinch-segmented-icon-control', class extends NectaryElement
|
|
|
56
56
|
const $elem = e.target;
|
|
57
57
|
const value = e.detail;
|
|
58
58
|
const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
|
|
59
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
60
|
-
detail,
|
|
61
|
-
bubbles: true
|
|
62
|
-
}));
|
|
63
59
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
64
60
|
detail
|
|
65
61
|
}));
|
package/select-button/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import '../text';
|
|
|
2
2
|
import '../icon';
|
|
3
3
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, subscribeContext, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateLiteralAttribute, Context } from '../utils';
|
|
4
4
|
import { DEFAULT_SIZE, sizeValues } from '../utils/size';
|
|
5
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:var(--sinch-local-size);padding:0 8px 0 12px;background-color:var(--sinch-comp-select-button-color-default-background-initial);border-radius:var(--sinch-local-shape-radius)
|
|
5
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;cursor:pointer}:host([disabled]){cursor:initial}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:var(--sinch-local-size);padding:0 8px 0 12px;background-color:var(--sinch-comp-select-button-color-default-background-initial);border-radius:var(--sinch-local-shape-radius);--sinch-local-size:var(--sinch-comp-select-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-m);--sinch-global-color-icon:var(--sinch-comp-select-button-color-default-icon-initial)}:host([data-size="l"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-l);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-l);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-l)}:host([data-size="m"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-m);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-m);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-m)}:host([data-size="s"])>#wrapper{--sinch-local-size:var(--sinch-comp-select-button-size-container-s);--sinch-global-size-icon:var(--sinch-comp-select-button-size-icon-s);--sinch-local-shape-radius:var(--sinch-comp-select-button-shape-radius-size-s)}:host([data-size="l"]) #wrapper{padding:0 12px}:host([data-size="m"]) #wrapper{padding:0 8px 0 12px}:host([data-size="s"]) #wrapper{padding:0 4px 0 12px}:host([disabled]) #wrapper{--sinch-global-color-icon:var(--sinch-comp-select-button-color-disabled-icon-initial)}#text{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-button-font-input);--sinch-global-color-text:var(--sinch-comp-select-button-color-default-text-initial)}#text:empty{display:none}#placeholder{display:none;flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-button-font-placeholder);--sinch-global-color-text:var(--sinch-comp-select-button-color-default-placeholder-initial)}#text:empty+#placeholder{display:block}#border{position:absolute;border:1px solid var(--sinch-comp-select-button-color-default-border-initial);border-radius:var(--sinch-local-shape-radius);inset:0;pointer-events:none}:host(:focus-visible) #border{border-color:var(--sinch-comp-select-button-color-default-border-focus);border-width:2px}:host([invalid]) #border{border-color:var(--sinch-comp-select-button-color-invalid-border-initial)}:host([disabled]) #border{border-color:var(--sinch-comp-select-button-color-disabled-border-initial)}:host([disabled]) #text{--sinch-global-color-text:var(--sinch-comp-select-button-color-disabled-text-initial)}:host([disabled]) #placeholder{--sinch-global-color-text:var(--sinch-comp-select-button-color-disabled-placeholder-initial)}#left{display:flex;flex-direction:row;align-self:stretch;align-items:center;gap:4px;margin-left:-4px}#left.empty{display:none}#dropdown-icon{margin-left:-4px}</style><div id="wrapper" inert><div id="border"></div><div id="left"><slot name="left"></slot></div><slot name="icon"></slot><sinch-text id="text" type="m" ellipsis></sinch-text><sinch-text id="placeholder" type="m" ellipsis></sinch-text><sinch-icon id="dropdown-icon" name="keyboard_arrow_down"></sinch-icon></div>';
|
|
6
6
|
const template = document.createElement('template');
|
|
7
7
|
template.innerHTML = templateHTML;
|
|
8
8
|
defineCustomElement('sinch-select-button', class extends NectaryElement {
|
|
@@ -180,6 +180,7 @@ defineCustomElement('sinch-select-button', class extends NectaryElement {
|
|
|
180
180
|
case 'Space':
|
|
181
181
|
case 'Enter':
|
|
182
182
|
{
|
|
183
|
+
e.preventDefault();
|
|
183
184
|
this.click();
|
|
184
185
|
}
|
|
185
186
|
}
|
package/select-menu/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import '../input';
|
|
|
2
2
|
import '../icon-button';
|
|
3
3
|
import '../icon';
|
|
4
4
|
import '../text';
|
|
5
|
-
import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateExplicitBooleanAttribute, updateIntegerAttribute, debounceTimeout, setClass, subscribeContext, hasClass } from '../utils';
|
|
5
|
+
import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, unpackCsv, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateExplicitBooleanAttribute, updateIntegerAttribute, debounceTimeout, setClass, subscribeContext, hasClass, isTargetEqual } from '../utils';
|
|
6
6
|
const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#not-found{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#not-found:not(.active){display:none}::slotted(.hidden){display:none}</style><sinch-input id="search" size="s" placeholder="Search"><sinch-icon id="icon-search" slot="icon" name="search"></sinch-icon><sinch-icon-button id="search-clear" slot="right"><sinch-icon slot="icon" name="close"></sinch-icon></sinch-icon-button></sinch-input><div id="not-found"><sinch-text type="m">No results</sinch-text></div><div id="listbox" role="presentation"><slot></slot></div>';
|
|
7
7
|
const ITEM_HEIGHT = 40;
|
|
8
8
|
const NUM_ITEMS_SEARCH = 7;
|
|
@@ -39,7 +39,6 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
|
|
|
39
39
|
this.addEventListener('keydown', this.#onListboxKeyDown, options);
|
|
40
40
|
this.addEventListener('focus', this.#onFocus, options);
|
|
41
41
|
this.addEventListener('blur', this.#onListboxBlur, options);
|
|
42
|
-
this.#$listbox.addEventListener('mousedown', this.#onListboxMousedown, options);
|
|
43
42
|
this.#$listbox.addEventListener('click', this.#onListboxClick, options);
|
|
44
43
|
this.#$search.addEventListener('-change', this.#onSearchChange, options);
|
|
45
44
|
this.#$searchClear.addEventListener('-click', this.#onSearchClearClick, options);
|
|
@@ -109,20 +108,15 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
|
|
|
109
108
|
this.#$search.focus();
|
|
110
109
|
}
|
|
111
110
|
};
|
|
112
|
-
#onListboxMousedown = e => {
|
|
113
|
-
const $elem = e.target;
|
|
114
|
-
if (!getBooleanAttribute($elem, 'disabled')) {
|
|
115
|
-
this.#dispatchChangeEvent($elem);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
111
|
#onListboxBlur = () => {
|
|
119
112
|
this.#selectOption(null);
|
|
120
113
|
};
|
|
121
114
|
#onListboxClick = e => {
|
|
122
115
|
const $elem = e.target;
|
|
123
116
|
this.focus();
|
|
124
|
-
if (!getBooleanAttribute($elem, 'disabled')) {
|
|
117
|
+
if (!isTargetEqual(e, this.#$listbox) && !getBooleanAttribute($elem, 'disabled')) {
|
|
125
118
|
this.#selectOption($elem);
|
|
119
|
+
this.#dispatchChangeEvent($elem);
|
|
126
120
|
}
|
|
127
121
|
};
|
|
128
122
|
#onSearchChange = e => {
|
|
@@ -167,9 +161,9 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
|
|
|
167
161
|
case 'Space':
|
|
168
162
|
case 'Enter':
|
|
169
163
|
{
|
|
164
|
+
e.preventDefault();
|
|
170
165
|
const $option = this.#findSelectedOption();
|
|
171
166
|
if ($option !== null) {
|
|
172
|
-
e.preventDefault();
|
|
173
167
|
this.#dispatchChangeEvent($option);
|
|
174
168
|
}
|
|
175
169
|
break;
|
package/skeleton/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineCustomElement, getUid, isAttrTrue, NectaryElement, shouldReduceMotion } from '../utils';
|
|
1
|
+
import { attrValueToInteger, defineCustomElement, getCssVar, getUid, isAttrTrue, NectaryElement, shouldReduceMotion } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:block}#wrapper{position:relative;display:flex;flex-direction:column;gap:16px;height:100%;box-sizing:border-box;overflow:hidden}:host([card]:not([card=false]))>#wrapper{padding:16px;background-color:var(--sinch-sys-color-container-main-default);border-radius:var(--sinch-sys-shape-radius-l);border:1px solid var(--sinch-sys-color-border-light)}#shimmer{position:absolute;inset:0;background-image:linear-gradient(90deg,transparent 0,var(--sinch-sys-color-container-contrast-primary-default) 100px,transparent 200px);clip-path:url("#clip")}#svg{display:block;width:0;height:0}</style><svg id="svg"><defs><clipPath id="clip"></clipPath></defs></svg><div id="wrapper"><slot></slot><div id="shimmer"></div></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
@@ -7,14 +7,20 @@ const BORDER_WIDTH = 1;
|
|
|
7
7
|
defineCustomElement('sinch-skeleton', class extends NectaryElement {
|
|
8
8
|
#animation = null;
|
|
9
9
|
#shimmer;
|
|
10
|
+
#wrapper;
|
|
11
|
+
#slot;
|
|
10
12
|
#controller = null;
|
|
11
13
|
#clip;
|
|
12
14
|
#borderWidth = 0;
|
|
15
|
+
#bb = null;
|
|
16
|
+
#observer = null;
|
|
13
17
|
constructor() {
|
|
14
18
|
super();
|
|
15
19
|
const shadowRoot = this.attachShadow();
|
|
16
20
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
17
21
|
this.#shimmer = shadowRoot.querySelector('#shimmer');
|
|
22
|
+
this.#slot = shadowRoot.querySelector('slot');
|
|
23
|
+
this.#wrapper = shadowRoot.querySelector('#wrapper');
|
|
18
24
|
this.#clip = shadowRoot.querySelector('#clip');
|
|
19
25
|
}
|
|
20
26
|
connectedCallback() {
|
|
@@ -23,10 +29,24 @@ defineCustomElement('sinch-skeleton', class extends NectaryElement {
|
|
|
23
29
|
this.#clip.setAttribute('id', id);
|
|
24
30
|
this.#controller = new AbortController();
|
|
25
31
|
if (!shouldReduceMotion()) {
|
|
26
|
-
this.addEventListener('
|
|
32
|
+
this.#slot.addEventListener('slotchange', this.#onSlotChange, {
|
|
27
33
|
signal: this.#controller.signal
|
|
28
34
|
});
|
|
29
|
-
this.#
|
|
35
|
+
this.#observer = new IntersectionObserver(entries => {
|
|
36
|
+
this.#bb = entries[0].boundingClientRect;
|
|
37
|
+
if (this.#bb.width === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.#updateAnimation();
|
|
41
|
+
for (const child of this.#slot.assignedElements()) {
|
|
42
|
+
this.#handleSkeletonItemData(child);
|
|
43
|
+
}
|
|
44
|
+
this.#observer.disconnect();
|
|
45
|
+
this.#observer = null;
|
|
46
|
+
}, {
|
|
47
|
+
threshold: 1
|
|
48
|
+
});
|
|
49
|
+
this.#observer.observe(this.#wrapper);
|
|
30
50
|
}
|
|
31
51
|
}
|
|
32
52
|
disconnectedCallback() {
|
|
@@ -34,6 +54,8 @@ defineCustomElement('sinch-skeleton', class extends NectaryElement {
|
|
|
34
54
|
this.#animation = null;
|
|
35
55
|
this.#controller.abort();
|
|
36
56
|
this.#controller = null;
|
|
57
|
+
this.#observer?.disconnect();
|
|
58
|
+
this.#observer = null;
|
|
37
59
|
}
|
|
38
60
|
static get observedAttributes() {
|
|
39
61
|
return ['card'];
|
|
@@ -51,7 +73,7 @@ defineCustomElement('sinch-skeleton', class extends NectaryElement {
|
|
|
51
73
|
}
|
|
52
74
|
}
|
|
53
75
|
#updateAnimation() {
|
|
54
|
-
const bb = this
|
|
76
|
+
const bb = this.#bb;
|
|
55
77
|
const bgWidth = bb.width * 4;
|
|
56
78
|
this.#shimmer.style.setProperty('background-size', `${bgWidth}px`);
|
|
57
79
|
this.#animation = this.#shimmer.animate({
|
|
@@ -61,15 +83,29 @@ defineCustomElement('sinch-skeleton', class extends NectaryElement {
|
|
|
61
83
|
iterations: Infinity
|
|
62
84
|
});
|
|
63
85
|
}
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
#onSlotChange = () => {
|
|
87
|
+
this.#clip.innerHTML = '';
|
|
88
|
+
if (this.#bb === null) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
for (const child of this.#slot.assignedElements()) {
|
|
92
|
+
this.#handleSkeletonItemData(child);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
#handleSkeletonItemData(child) {
|
|
96
|
+
const data = child.getBoundingClientRect();
|
|
97
|
+
const radiusStr = getCssVar(child, '--sinch-local-shape-radius') ?? '0';
|
|
98
|
+
const radius = attrValueToInteger(radiusStr, {
|
|
99
|
+
min: 0,
|
|
100
|
+
defaultValue: 0
|
|
101
|
+
});
|
|
102
|
+
const bb = this.#bb;
|
|
67
103
|
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
|
68
104
|
rect.setAttribute('x', (data.x - bb.x - this.#borderWidth).toString());
|
|
69
105
|
rect.setAttribute('y', (data.y - bb.y - this.#borderWidth).toString());
|
|
70
106
|
rect.setAttribute('width', data.width.toString());
|
|
71
107
|
rect.setAttribute('height', data.height.toString());
|
|
72
|
-
rect.setAttribute('rx',
|
|
108
|
+
rect.setAttribute('rx', radius.toString());
|
|
73
109
|
this.#clip.appendChild(rect);
|
|
74
|
-
}
|
|
110
|
+
}
|
|
75
111
|
});
|
package/skeleton-item/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineCustomElement,
|
|
1
|
+
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:block;height:var(--sinch-sys-size-m);--sinch-local-shape-radius:var(--sinch-sys-shape-radius-m)}:host([size=xs]){height:var(--sinch-sys-size-xs);--sinch-local-shape-radius:var(--sinch-sys-shape-radius-xs)}:host([size="s"]){height:var(--sinch-sys-size-s);--sinch-local-shape-radius:var(--sinch-sys-shape-radius-s)}:host([size="m"]){height:var(--sinch-sys-size-m);--sinch-local-shape-radius:var(--sinch-sys-shape-radius-m)}:host([size="l"]){height:var(--sinch-sys-size-l);--sinch-local-shape-radius:var(--sinch-sys-shape-radius-l)}#content{height:100%;background-color:var(--sinch-sys-color-border-light);border-radius:var(--sinch-local-shape-radius)}</style><div id="content"></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
@@ -8,31 +8,4 @@ defineCustomElement('sinch-skeleton-item', class extends NectaryElement {
|
|
|
8
8
|
const shadowRoot = this.attachShadow();
|
|
9
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
10
10
|
}
|
|
11
|
-
connectedCallback() {
|
|
12
|
-
if (!shouldReduceMotion()) {
|
|
13
|
-
requestAnimationFrame(() => {
|
|
14
|
-
const {
|
|
15
|
-
x,
|
|
16
|
-
y,
|
|
17
|
-
width,
|
|
18
|
-
height
|
|
19
|
-
} = this.getBoundingClientRect();
|
|
20
|
-
const radiusStr = getCssVar(this, '--sinch-shape-radius') ?? '0';
|
|
21
|
-
const radius = attrValueToInteger(radiusStr, {
|
|
22
|
-
min: 0,
|
|
23
|
-
defaultValue: 0
|
|
24
|
-
});
|
|
25
|
-
this.dispatchEvent(new CustomEvent('skeleton-item-data', {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
detail: {
|
|
28
|
-
x,
|
|
29
|
-
y,
|
|
30
|
-
width,
|
|
31
|
-
height,
|
|
32
|
-
radius
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
11
|
});
|
package/table-row/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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>';
|
|
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)}:host(:last-child) ::slotted(sinch-table-cell){border-bottom:none}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-table-row', class extends NectaryElement {
|
package/tabs/index.js
CHANGED
|
@@ -69,10 +69,6 @@ defineCustomElement('sinch-tabs', class extends NectaryElement {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
#dispatchChangeEvent(value) {
|
|
72
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
73
|
-
detail: value,
|
|
74
|
-
bubbles: true
|
|
75
|
-
}));
|
|
76
72
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
77
73
|
detail: value
|
|
78
74
|
}));
|
package/textarea/index.js
CHANGED
|
@@ -185,10 +185,6 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
185
185
|
}
|
|
186
186
|
this.#isPendingDk = false;
|
|
187
187
|
this.#cursorPos = nextCursorPos;
|
|
188
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
189
|
-
detail: nextValue,
|
|
190
|
-
bubbles: true
|
|
191
|
-
}));
|
|
192
188
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
193
189
|
detail: nextValue
|
|
194
190
|
}));
|
package/tile-control/index.js
CHANGED
|
@@ -79,10 +79,6 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
|
79
79
|
const $elem = e.target;
|
|
80
80
|
const value = e.detail;
|
|
81
81
|
const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
|
|
82
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
83
|
-
detail,
|
|
84
|
-
bubbles: true
|
|
85
|
-
}));
|
|
86
82
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
87
83
|
detail
|
|
88
84
|
}));
|
package/time-picker/index.js
CHANGED
|
@@ -97,7 +97,7 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
97
97
|
signal: this.#controller.signal
|
|
98
98
|
};
|
|
99
99
|
this.#$pickerTouch.addEventListener('click', this.#onPickerClick, options);
|
|
100
|
-
this.#$ampm.addEventListener('change', this.#onAmPmChange, options);
|
|
100
|
+
this.#$ampm.addEventListener('-change', this.#onAmPmChange, options);
|
|
101
101
|
this.#$submitButton.addEventListener('click', this.#onSubmitButtonClick, options);
|
|
102
102
|
this.#$needleHour.addEventListener('keydown', this.#onHoursKeydown, options);
|
|
103
103
|
this.#$needleMinute.addEventListener('keydown', this.#onMinutesKeydown, options);
|
|
@@ -269,7 +269,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
269
269
|
this.#$needleMinute.style.transform = `rotate(${minuteCssDeg}deg)`;
|
|
270
270
|
}
|
|
271
271
|
#onAmPmChange = e => {
|
|
272
|
-
e.stopPropagation();
|
|
273
272
|
const value = e.detail;
|
|
274
273
|
switch (value) {
|
|
275
274
|
case 'am':
|
|
@@ -292,10 +291,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
292
291
|
};
|
|
293
292
|
#onSubmitButtonClick = () => {
|
|
294
293
|
const value = stringifyTime(this.#hour, this.#minute);
|
|
295
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
296
|
-
bubbles: true,
|
|
297
|
-
detail: value
|
|
298
|
-
}));
|
|
299
294
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
300
295
|
detail: value
|
|
301
296
|
}));
|
package/toggle/index.js
CHANGED
|
@@ -107,10 +107,6 @@ defineCustomElement('sinch-toggle', class extends NectaryElement {
|
|
|
107
107
|
e.stopPropagation();
|
|
108
108
|
const isChecked = this.#$input.checked;
|
|
109
109
|
this.#$input.checked = this.checked;
|
|
110
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
111
|
-
detail: isChecked,
|
|
112
|
-
bubbles: true
|
|
113
|
-
}));
|
|
114
110
|
this.dispatchEvent(new CustomEvent('-change', {
|
|
115
111
|
detail: isChecked
|
|
116
112
|
}));
|
package/toggle/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export type TSinchToggleElement = HTMLElement & {
|
|
|
5
5
|
labeled: boolean;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
text: string | null;
|
|
8
|
-
addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
9
8
|
addEventListener(type: '-change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
10
9
|
setAttribute(name: 'checked', value: ''): void;
|
|
11
10
|
setAttribute(name: 'small', value: ''): void;
|