@nectary/components 2.1.0 → 2.1.1
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/action-menu-option/index.js +2 -4
- package/button/index.js +1 -1
- package/checkbox/index.js +4 -5
- package/chip/index.js +1 -1
- package/date-picker/index.js +0 -8
- package/file-picker/index.js +11 -9
- 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 +1 -1
- package/skeleton/index.js +45 -9
- package/skeleton-item/index.js +1 -28
- 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
|
}));
|
|
@@ -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;
|
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/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/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/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 {
|
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/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;
|