@nectary/components 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +3 -6
- package/accordion-item/index.js +3 -6
- package/alert/index.js +3 -5
- package/alert-button/index.js +3 -6
- package/alert-close/index.js +3 -6
- package/avatar/index.js +3 -5
- package/avatar-badge/index.js +3 -5
- package/avatar-status/index.js +3 -5
- package/button/index.js +3 -6
- package/card/index.js +3 -6
- package/card-button/index.js +3 -6
- package/card-container/index.js +3 -6
- package/card-link/index.js +3 -6
- package/chat/index.js +3 -6
- package/chat-avatar/index.js +3 -6
- package/chat-block/index.js +3 -6
- package/chat-bubble/index.js +3 -6
- package/checkbox/index.js +3 -6
- package/colors.json +2 -0
- package/dialog/index.d.ts +2 -3
- package/dialog/index.js +3 -6
- package/dropdown/index.js +4 -7
- package/dropdown-option/index.d.ts +2 -1
- package/dropdown-option/index.js +4 -6
- package/grid/index.js +3 -5
- package/grid-item/index.js +3 -5
- package/help-tooltip/index.js +3 -5
- package/icon-button/index.js +3 -6
- package/icons/create-icon-class.d.ts +1 -1
- package/icons/create-icon-class.js +3 -5
- package/icons-branded/create-icon-class.d.ts +1 -1
- package/icons-branded/create-icon-class.js +3 -5
- package/icons-channel/create-icon-class.d.ts +1 -1
- package/icons-channel/create-icon-class.js +3 -5
- package/illustration/create-illustration-class.d.ts +1 -1
- package/illustration/create-illustration-class.js +3 -5
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/input/index.js +3 -6
- package/link/index.js +5 -26
- package/logo/create-logo-class.d.ts +1 -1
- package/logo/create-logo-class.js +3 -5
- package/package.json +3 -5
- package/pagination/index.d.ts +4 -1
- package/pagination/index.js +17 -6
- package/popover/index.js +3 -6
- package/radio/index.js +3 -6
- package/radio-option/index.js +3 -6
- package/search/index.js +38 -26
- package/search-option/index.js +3 -5
- package/segment/index.js +3 -6
- package/segment-collapse/index.js +13 -33
- package/segmented-control/index.d.ts +20 -0
- package/segmented-control/index.js +208 -0
- package/segmented-control-option/index.d.ts +29 -0
- package/segmented-control-option/index.js +112 -0
- package/select/index.js +22 -8
- package/spinner/index.js +3 -5
- package/table/index.js +3 -5
- package/table-body/index.js +3 -5
- package/table-cell/index.js +3 -5
- package/table-head/index.js +3 -5
- package/table-head-cell/index.js +3 -5
- package/table-row/index.js +3 -5
- package/tabs/index.js +4 -7
- package/tabs-option/index.js +12 -31
- package/tag/index.js +3 -5
- package/tag-close/index.js +3 -6
- package/textarea/index.js +3 -6
- package/title/index.js +3 -6
- package/toggle/index.js +3 -6
- package/tooltip/index.js +3 -5
- package/utils.d.ts +10 -3
- package/utils.js +22 -14
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
+
|
|
3
|
+
var _onClick;
|
|
4
|
+
|
|
5
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
6
|
+
|
|
7
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
8
|
+
|
|
9
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
10
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;position:relative;flex-direction:row;align-items:center;gap:12px;width:100%;height:42px;padding:8px 20px;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-100);border-left-width:0;border-right-width:0;color:var(--sinch-color-stormy-500);background-color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:16px}#wrapper:hover{background-color:var(--sinch-color-snow-500)}:host(:first-child) #wrapper{border-left-width:1px;border-top-left-radius:4px;border-bottom-left-radius:4px}:host(:last-child) #wrapper{border-right-width:1px;border-top-right-radius:4px;border-bottom-right-radius:4px}#content{font:var(--sinch-font-title-s);flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([checked]:not([checked=false])) #wrapper{border-color:var(--sinch-color-stormy-500)}:host([checked]:not([checked=false]):not(:first-child)) #wrapper::before{content:"";width:1px;background-color:var(--sinch-color-stormy-500);position:absolute;left:0;top:-1px;bottom:-1px}:host([checked]:not([checked=false]):not(:last-child)) #wrapper::after{content:"";width:1px;background-color:var(--sinch-color-stormy-500);position:absolute;right:0;top:-1px;bottom:-1px}#button{all:initial;position:absolute;left:0;top:0;box-sizing:border-box;width:100%;height:100%;cursor:pointer;z-index:1}#button:focus::before{content:"";position:absolute;left:-3px;right:-3px;top:-4px;bottom:-4px;border:2px solid var(--sinch-color-aqua-400)}#button:disabled{cursor:unset}:host(:first-child) #button:focus::before{left:-4px;border-top-left-radius:6px;border-bottom-left-radius:6px}:host(:last-child) #button:focus::before{right:-4px;border-top-right-radius:6px;border-bottom-right-radius:6px}:host([disabled]:not([disabled=false])) #wrapper{background-color:var(--sinch-color-snow-100);color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><slot name="icon"></slot><label for="button" id="content"></label> <button id="button"></button></div>';
|
|
11
|
+
export const isSegmentedControlOptionElement = element => {
|
|
12
|
+
return element instanceof Element && element.tagName === 'SINCH-SEGMENTED-CONTROL-OPTION';
|
|
13
|
+
};
|
|
14
|
+
const template = document.createElement('template');
|
|
15
|
+
template.innerHTML = templateHTML;
|
|
16
|
+
defineCustomElement('sinch-segmented-control-option', (_onClick = new WeakMap(), class extends NectaryElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
_classPrivateFieldInitSpec(this, _onClick, {
|
|
21
|
+
writable: true,
|
|
22
|
+
value: e => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
25
|
+
bubbles: true,
|
|
26
|
+
detail: this.value
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const shadowRoot = this.attachShadow();
|
|
32
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
33
|
+
this.$button = shadowRoot.querySelector('#button');
|
|
34
|
+
this.$label = shadowRoot.querySelector('#content');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
this.setAttribute('role', 'tab');
|
|
39
|
+
this.$button.addEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this.$button.removeEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static get observedAttributes() {
|
|
47
|
+
return ['checked', 'disabled', 'text', 'value'];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set checked(isChecked) {
|
|
51
|
+
updateBooleanAttribute(this, 'checked', isChecked);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get checked() {
|
|
55
|
+
return getBooleanAttribute(this, 'checked');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
set value(value) {
|
|
59
|
+
updateAttribute(this, 'value', value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get value() {
|
|
63
|
+
return getAttribute(this, 'value', '');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
set disabled(isDisabled) {
|
|
67
|
+
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get disabled() {
|
|
71
|
+
return getBooleanAttribute(this, 'disabled');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set text(value) {
|
|
75
|
+
updateAttribute(this, 'text', value);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get text() {
|
|
79
|
+
return getAttribute(this, 'text', '');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
attributeChangedCallback(name, _, newVal) {
|
|
83
|
+
switch (name) {
|
|
84
|
+
case 'text':
|
|
85
|
+
{
|
|
86
|
+
this.$label.textContent = newVal;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
case 'checked':
|
|
91
|
+
{
|
|
92
|
+
updateAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
case 'disabled':
|
|
97
|
+
{
|
|
98
|
+
this.$button.disabled = isAttrTrue(newVal);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
focus() {
|
|
105
|
+
this.$button.focus();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
blur() {
|
|
109
|
+
this.$button.blur();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}));
|
package/select/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$button, _$buttonContent, _$label, _$optionalText, _$additionalText, _$invalidText, _$dropdown, _$optionSlot, _updateButtonContent, _onValueChange, _getOptionWithValue, _onLabelClick, _onDropdownClick, _onDropdownClose;
|
|
4
|
+
var _$button, _$buttonContent, _$label, _$optionalText, _$additionalText, _$invalidText, _$dropdown, _$optionSlot, _$sh, _createElement, _updateButtonContent, _onValueChange, _getOptionWithValue, _onLabelClick, _onDropdownClick, _onDropdownClose;
|
|
5
5
|
|
|
6
6
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
7
7
|
|
|
@@ -14,11 +14,11 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
14
14
|
import { isDropdownOptionElement } from '../dropdown-option';
|
|
15
15
|
import '../select-option';
|
|
16
16
|
import '../dropdown';
|
|
17
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
|
|
17
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
|
|
18
18
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{position:relative}sinch-dropdown{display:block}#button{all:initial;display:flex;align-items:center;gap:8px;border:1px solid var(--sinch-color-stormy-200);border-radius:4px;box-sizing:border-box;width:100%;height:48px;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);cursor:pointer}#button:focus{border-color:var(--sinch-color-stormy-600)}#dropdown-icon{fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button[data-unselected]{color:var(--sinch-color-text-muted)}#button:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100);cursor:initial}#button:disabled #dropdown-icon{fill:var(--sinch-color-stormy-100)}:host([invalidtext]:not([invalidtext=""])) #button:not(:disabled){border-color:var(--sinch-color-text-invalid)}#content{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}#listbox{position:absolute;left:0;top:0;padding-top:74px;width:100%;display:none;list-style:none;outline:0;z-index:1}#listbox-body{font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);border:1px solid var(--sinch-color-stormy-500);border-top-width:0;border-bottom-left-radius:2px;border-bottom-right-radius:2px;width:100%;box-sizing:border-box;box-shadow:1px 2px 4px rgba(0,0,0,.15);overflow-y:auto}#button[aria-expanded=true]~#listbox{display:block}</style><div id="wrapper"><div id="top"><label id="label" for="dropdown"></label><slot name="tooltip"></slot><span id="optional"></span></div><sinch-dropdown id="dropdown"><button slot="target" id="button"><span id="content"></span> <svg id="dropdown-icon" width="12" height="8" aria-hidden="true"><path d="M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2 1.41.59Z"/></svg></button><slot name="option" slot="option"></slot></sinch-dropdown><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
|
|
19
19
|
const template = document.createElement('template');
|
|
20
20
|
template.innerHTML = templateHTML;
|
|
21
|
-
defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onLabelClick = new WeakMap(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), class extends
|
|
21
|
+
defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _$dropdown = new WeakMap(), _$optionSlot = new WeakMap(), _$sh = new WeakMap(), _createElement = new WeakSet(), _updateButtonContent = new WeakSet(), _onValueChange = new WeakMap(), _getOptionWithValue = new WeakSet(), _onLabelClick = new WeakMap(), _onDropdownClick = new WeakMap(), _onDropdownClose = new WeakMap(), class extends NectaryElement {
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
24
|
|
|
@@ -26,6 +26,8 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
|
|
|
26
26
|
|
|
27
27
|
_classPrivateMethodInitSpec(this, _updateButtonContent);
|
|
28
28
|
|
|
29
|
+
_classPrivateMethodInitSpec(this, _createElement);
|
|
30
|
+
|
|
29
31
|
_classPrivateFieldInitSpec(this, _$button, {
|
|
30
32
|
writable: true,
|
|
31
33
|
value: void 0
|
|
@@ -66,6 +68,11 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
|
|
|
66
68
|
value: void 0
|
|
67
69
|
});
|
|
68
70
|
|
|
71
|
+
_classPrivateFieldInitSpec(this, _$sh, {
|
|
72
|
+
writable: true,
|
|
73
|
+
value: void 0
|
|
74
|
+
});
|
|
75
|
+
|
|
69
76
|
_classPrivateFieldInitSpec(this, _onValueChange, {
|
|
70
77
|
writable: true,
|
|
71
78
|
value: e => {
|
|
@@ -98,12 +105,11 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
|
|
|
98
105
|
}
|
|
99
106
|
});
|
|
100
107
|
|
|
101
|
-
const shadowRoot = this.attachShadow(
|
|
102
|
-
mode: 'closed',
|
|
103
|
-
delegatesFocus: true
|
|
104
|
-
});
|
|
108
|
+
const shadowRoot = this.attachShadow();
|
|
105
109
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
106
110
|
|
|
111
|
+
_classPrivateFieldSet(this, _$sh, shadowRoot);
|
|
112
|
+
|
|
107
113
|
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('#button'));
|
|
108
114
|
|
|
109
115
|
_classPrivateFieldSet(this, _$buttonContent, shadowRoot.querySelector('#content'));
|
|
@@ -289,6 +295,14 @@ defineCustomElement('sinch-select', (_$button = new WeakMap(), _$buttonContent =
|
|
|
289
295
|
|
|
290
296
|
}));
|
|
291
297
|
|
|
298
|
+
function _createElement2(name) {
|
|
299
|
+
if (Reflect.has(_classPrivateFieldGet(this, _$sh), 'createElement')) {
|
|
300
|
+
return _classPrivateFieldGet(this, _$sh).createElement(name);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return document.createElement(name);
|
|
304
|
+
}
|
|
305
|
+
|
|
292
306
|
function _updateButtonContent2() {
|
|
293
307
|
if (_classPrivateFieldGet(this, _$button).firstElementChild !== _classPrivateFieldGet(this, _$buttonContent)) {
|
|
294
308
|
_classPrivateFieldGet(this, _$button).removeChild(_classPrivateFieldGet(this, _$button).firstElementChild);
|
|
@@ -307,7 +321,7 @@ function _updateButtonContent2() {
|
|
|
307
321
|
const $icon = $option.icon;
|
|
308
322
|
|
|
309
323
|
if ($icon != null) {
|
|
310
|
-
_classPrivateFieldGet(this, _$button).prepend($icon.
|
|
324
|
+
_classPrivateFieldGet(this, _$button).prepend(_classPrivateMethodGet(this, _createElement, _createElement2).call(this, $icon.tagName.toLowerCase()));
|
|
311
325
|
}
|
|
312
326
|
}
|
|
313
327
|
}
|
package/spinner/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { defineCustomElement, getLiteralAttribute, updateLiteralAttribute } from '../utils';
|
|
1
|
+
import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}div{animation:1.5s linear infinite spinner;animation-play-state:running;border:solid 3px var(--sinch-color-spinner-bg,#d4dadd);border-bottom-color:var(--sinch-color-spinner-fg,#0a273d);border-radius:50%;height:20px;width:20px;box-sizing:border-box;will-change:transform}:host([type=large]) div{height:46px;width:46px;border-width:4px}:host([type=small]) div{height:14px;width:14px;border-width:2px}:host([static]:not([static=false])) div{animation-play-state:paused}</style><div></div>';
|
|
3
3
|
const spinnerTypes = ['large', 'medium', 'small'];
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
|
-
defineCustomElement('sinch-spinner', class extends
|
|
6
|
+
defineCustomElement('sinch-spinner', class extends NectaryElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
|
-
const shadowRoot = this.attachShadow(
|
|
10
|
-
mode: 'closed'
|
|
11
|
-
});
|
|
9
|
+
const shadowRoot = this.attachShadow();
|
|
12
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
13
11
|
}
|
|
14
12
|
|
package/table/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineCustomElement } from '../utils';
|
|
1
|
+
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:table;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
|
-
defineCustomElement('sinch-table', class extends
|
|
5
|
+
defineCustomElement('sinch-table', class extends NectaryElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
const shadowRoot = this.attachShadow(
|
|
9
|
-
mode: 'closed'
|
|
10
|
-
});
|
|
8
|
+
const shadowRoot = this.attachShadow();
|
|
11
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
12
10
|
}
|
|
13
11
|
|
package/table-body/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineCustomElement } from '../utils';
|
|
1
|
+
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:table-row-group}::slotted(sinch-table-row:hover){background-color:var(--sinch-color-tropical-50)}::slotted(sinch-table-row[selected]:not([selected=false])){background-color:var(--sinch-color-tropical-100)}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
|
-
defineCustomElement('sinch-table-body', class extends
|
|
5
|
+
defineCustomElement('sinch-table-body', class extends NectaryElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
const shadowRoot = this.attachShadow(
|
|
9
|
-
mode: 'closed'
|
|
10
|
-
});
|
|
8
|
+
const shadowRoot = this.attachShadow();
|
|
11
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
12
10
|
}
|
|
13
11
|
|
package/table-cell/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { defineCustomElement, getLiteralAttribute, updateLiteralAttribute } from '../utils';
|
|
1
|
+
import { defineCustomElement, getLiteralAttribute, NectaryElement, updateLiteralAttribute } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:table-cell;vertical-align:top;border-bottom:1px solid var(--sinch-color-snow-600)}#wrapper{display:flex;flex-direction:column;justify-content:center;min-height:48px;box-sizing:border-box;padding:8px 4px}:host(:first-child) #wrapper{padding-left:8px}:host(:last-child) #wrapper{padding-right:8px}:host([align=end]) #wrapper{text-align:end;align-items:flex-end}:host([align=center]) #wrapper{text-align:center;align-items:center}</style><div id="wrapper"><slot></slot></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
const alignValues = ['start', 'center', 'end'];
|
|
6
|
-
defineCustomElement('sinch-table-cell', class extends
|
|
6
|
+
defineCustomElement('sinch-table-cell', class extends NectaryElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
|
-
const shadowRoot = this.attachShadow(
|
|
10
|
-
mode: 'closed'
|
|
11
|
-
});
|
|
9
|
+
const shadowRoot = this.attachShadow();
|
|
12
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
13
11
|
}
|
|
14
12
|
|
package/table-head/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineCustomElement } from '../utils';
|
|
1
|
+
import { defineCustomElement, NectaryElement } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:table-header-group}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
|
-
defineCustomElement('sinch-table-head', class extends
|
|
5
|
+
defineCustomElement('sinch-table-head', class extends NectaryElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
const shadowRoot = this.attachShadow(
|
|
9
|
-
mode: 'closed'
|
|
10
|
-
});
|
|
8
|
+
const shadowRoot = this.attachShadow();
|
|
11
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
12
10
|
}
|
|
13
11
|
|
package/table-head-cell/index.js
CHANGED
|
@@ -7,12 +7,12 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
10
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
11
11
|
const templateHTML = '<style>:host{display:table-cell;border-bottom:1px solid var(--sinch-color-stormy-200);height:48px;vertical-align:middle;padding:0 6px;--sinch-color-icon:var(--sinch-color-stormy-200)}:host(:first-child){padding-left:8px}:host(:last-child){padding-right:8px}#wrapper{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:100%;box-sizing:border-box;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-300);--sinch-icon-button-color:var(--sinch-color-stormy-100)}#text{flex-shrink:1;min-width:0;font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-200);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([align=center])>#wrapper{justify-content:center}:host([align=end])>#wrapper{justify-content:flex-end}:host(:is([text=""],:not([text])))>#wrapper{display:none}:host([fit]:not([fit=false])){width:1px}</style><slot name="checkbox"></slot><div id="wrapper"><slot name="left"></slot><span id="text"></span><slot name="tooltip"></slot><slot name="right"></slot></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
const alignValues = ['start', 'center', 'end'];
|
|
15
|
-
defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class extends
|
|
15
|
+
defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class extends NectaryElement {
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
|
|
@@ -21,9 +21,7 @@ defineCustomElement('sinch-table-head-cell', (_$text = new WeakMap(), class exte
|
|
|
21
21
|
value: void 0
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const shadowRoot = this.attachShadow(
|
|
25
|
-
mode: 'closed'
|
|
26
|
-
});
|
|
24
|
+
const shadowRoot = this.attachShadow();
|
|
27
25
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
28
26
|
|
|
29
27
|
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
package/table-row/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute } from '../utils';
|
|
1
|
+
import { defineCustomElement, getBooleanAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
2
2
|
const templateHTML = '<style>:host{display:table-row}:host([sticky]) ::slotted(sinch-table-head-cell){position:sticky;top:0;z-index:1;background-color:var(--sinch-color-snow-100)}</style><slot></slot>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
|
-
defineCustomElement('sinch-table-row', class extends
|
|
5
|
+
defineCustomElement('sinch-table-row', class extends NectaryElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
const shadowRoot = this.attachShadow(
|
|
9
|
-
mode: 'closed'
|
|
10
|
-
});
|
|
8
|
+
const shadowRoot = this.attachShadow();
|
|
11
9
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
12
10
|
}
|
|
13
11
|
|
package/tabs/index.js
CHANGED
|
@@ -12,8 +12,8 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
12
12
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
13
13
|
|
|
14
14
|
import { isTabsOptionElement } from '../tabs-option';
|
|
15
|
-
import { defineCustomElement, getAttribute, updateAttribute } from '../utils';
|
|
16
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:row;height:
|
|
15
|
+
import { defineCustomElement, getAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
16
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:row;height:44px;width:100%;box-sizing:border-box}</style><div id="wrapper"><slot></slot></div>';
|
|
17
17
|
|
|
18
18
|
const findSelectedOption = elements => {
|
|
19
19
|
return elements.find(el => el.checked) ?? null;
|
|
@@ -21,7 +21,7 @@ const findSelectedOption = elements => {
|
|
|
21
21
|
|
|
22
22
|
const template = document.createElement('template');
|
|
23
23
|
template.innerHTML = templateHTML;
|
|
24
|
-
defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), class extends
|
|
24
|
+
defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), class extends NectaryElement {
|
|
25
25
|
constructor() {
|
|
26
26
|
super();
|
|
27
27
|
|
|
@@ -99,10 +99,7 @@ defineCustomElement('sinch-tabs', (_$slot = new WeakMap(), _onOptionKeyDown = ne
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
const shadowRoot = this.attachShadow(
|
|
103
|
-
mode: 'closed',
|
|
104
|
-
delegatesFocus: true
|
|
105
|
-
});
|
|
102
|
+
const shadowRoot = this.attachShadow();
|
|
106
103
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
107
104
|
shadowRoot.addEventListener('keydown', _classPrivateFieldGet(this, _onOptionKeyDown));
|
|
108
105
|
shadowRoot.addEventListener('change', _classPrivateFieldGet(this, _onOptionChange));
|
package/tabs-option/index.js
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _onClick;
|
|
4
4
|
|
|
5
5
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
6
6
|
|
|
7
7
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
8
8
|
|
|
9
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
10
|
-
const templateHTML = '<style>:host{display:
|
|
9
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
10
|
+
const templateHTML = '<style>:host{display:block;outline:0}:host()>*{pointer-events:none}#wrapper{display:flex;flex-direction:row;align-items:center;gap:12px;position:relative;width:100%;height:42px;padding:8px 20px;box-sizing:border-box;box-shadow:0 1px 0 0 var(--sinch-color-stormy-100);color:var(--sinch-color-stormy-500);background-color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:16px}#content{font:var(--sinch-font-title-s);flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([checked]:not([checked=false])) #wrapper{box-shadow:0 2px 0 0 var(--sinch-color-stormy-500)}#button{all:initial;position:absolute;left:0;top:0;box-sizing:border-box;width:100%;height:100%;cursor:pointer}#button:disabled{cursor:unset}:host([disabled]:not([disabled=false])) #wrapper{color:var(--sinch-color-stormy-100);--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><slot name="icon"></slot><label for="input" id="content"></label> <button id="button" type="radio"/></div>';
|
|
11
11
|
export const isTabsOptionElement = element => {
|
|
12
12
|
return element instanceof Element && element.tagName === 'SINCH-TABS-OPTION';
|
|
13
13
|
};
|
|
14
14
|
const template = document.createElement('template');
|
|
15
15
|
template.innerHTML = templateHTML;
|
|
16
|
-
defineCustomElement('sinch-tabs-option', (
|
|
16
|
+
defineCustomElement('sinch-tabs-option', (_onClick = new WeakMap(), class extends NectaryElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super();
|
|
19
19
|
|
|
20
|
-
_classPrivateFieldInitSpec(this,
|
|
20
|
+
_classPrivateFieldInitSpec(this, _onClick, {
|
|
21
21
|
writable: true,
|
|
22
22
|
value: e => {
|
|
23
23
|
e.stopPropagation();
|
|
24
|
-
this.$input.checked = false;
|
|
25
24
|
this.dispatchEvent(new CustomEvent('change', {
|
|
26
25
|
bubbles: true,
|
|
27
26
|
detail: this.value
|
|
@@ -29,22 +28,19 @@ defineCustomElement('sinch-tabs-option', (_onInput = new WeakMap(), class extend
|
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
const shadowRoot = this.attachShadow(
|
|
33
|
-
mode: 'closed',
|
|
34
|
-
delegatesFocus: true
|
|
35
|
-
});
|
|
31
|
+
const shadowRoot = this.attachShadow();
|
|
36
32
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
37
|
-
this.$
|
|
33
|
+
this.$button = shadowRoot.querySelector('#button');
|
|
38
34
|
this.$label = shadowRoot.querySelector('#content');
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
connectedCallback() {
|
|
42
38
|
this.setAttribute('role', 'tab');
|
|
43
|
-
this.$
|
|
39
|
+
this.$button.addEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
disconnectedCallback() {
|
|
47
|
-
this.$
|
|
43
|
+
this.$button.removeEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
static get observedAttributes() {
|
|
@@ -93,39 +89,24 @@ defineCustomElement('sinch-tabs-option', (_onInput = new WeakMap(), class extend
|
|
|
93
89
|
|
|
94
90
|
case 'checked':
|
|
95
91
|
{
|
|
96
|
-
const isChecked = isAttrTrue(newVal);
|
|
97
|
-
this.$input.checked = isChecked;
|
|
98
|
-
|
|
99
|
-
if (isChecked) {
|
|
100
|
-
this.scrollIntoView?.({
|
|
101
|
-
block: 'nearest'
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
92
|
updateAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
106
93
|
break;
|
|
107
94
|
}
|
|
108
95
|
|
|
109
96
|
case 'disabled':
|
|
110
97
|
{
|
|
111
|
-
this.$
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
case 'value':
|
|
116
|
-
{
|
|
117
|
-
this.$input.value = newVal ?? '';
|
|
98
|
+
this.$button.disabled = isAttrTrue(newVal);
|
|
118
99
|
break;
|
|
119
100
|
}
|
|
120
101
|
}
|
|
121
102
|
}
|
|
122
103
|
|
|
123
104
|
focus() {
|
|
124
|
-
this.$
|
|
105
|
+
this.$button.focus();
|
|
125
106
|
}
|
|
126
107
|
|
|
127
108
|
blur() {
|
|
128
|
-
this.$
|
|
109
|
+
this.$button.blur();
|
|
129
110
|
}
|
|
130
111
|
|
|
131
112
|
}));
|
package/tag/index.js
CHANGED
|
@@ -8,12 +8,12 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import '../icons/cancel';
|
|
11
|
-
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
11
|
+
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
12
12
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;align-items:center;gap:4px;position:relative;padding:2px 8px;border-radius:12px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);width:100%;height:24px;box-sizing:border-box;--sinch-color-icon:var(--sinch-color-stormy-400);--sinch-size-icon:16px}:host([category=candy])>#wrapper{background-color:var(--sinch-color-candy-200)}:host([category=bolt])>#wrapper{background-color:var(--sinch-color-bolt-200)}:host([category=aqua])>#wrapper{background-color:var(--sinch-color-aqua-200)}:host([category=grass])>#wrapper{background-color:var(--sinch-color-grass-200)}:host([category=berry])>#wrapper{background-color:var(--sinch-color-berry-200)}:host([category=orange])>#wrapper{background-color:var(--sinch-color-orange-200)}:host([category=night])>#wrapper{background-color:var(--sinch-color-night-200)}:host([category=mud])>#wrapper{background-color:var(--sinch-color-mud-200)}:host([category=dirt])>#wrapper{background-color:var(--sinch-color-dirt-200)}:host([inverted]:not([inverted=false]))>#wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-snow-100)}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px;--sinch-size-icon:14px}#text{text-overflow:ellipsis;white-space:nowrap;overflow:auto;flex:1}</style><div id="wrapper"><slot name="icon"></slot><span id="text"></span><slot name="close"></slot></div>';
|
|
13
13
|
const categoryValues = ['candy', 'bolt', 'aqua', 'grass', 'berry', 'orange', 'night', 'mud', 'dirt'];
|
|
14
14
|
const template = document.createElement('template');
|
|
15
15
|
template.innerHTML = templateHTML;
|
|
16
|
-
defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends
|
|
16
|
+
defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends NectaryElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super();
|
|
19
19
|
|
|
@@ -22,9 +22,7 @@ defineCustomElement('sinch-tag', (_$text = new WeakMap(), class extends HTMLElem
|
|
|
22
22
|
value: void 0
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const shadowRoot = this.attachShadow(
|
|
26
|
-
mode: 'closed'
|
|
27
|
-
});
|
|
25
|
+
const shadowRoot = this.attachShadow();
|
|
28
26
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
29
27
|
|
|
30
28
|
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
package/tag-close/index.js
CHANGED
|
@@ -8,11 +8,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import '../icons/cancel';
|
|
11
|
-
import { defineCustomElement } from '../utils';
|
|
11
|
+
import { defineCustomElement, NectaryElement } from '../utils';
|
|
12
12
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:14px;height:14px}button{all:initial;position:absolute;display:flex;align-items:center;justify-content:center;width:24px;height:24px;box-sizing:border-box;left:50%;top:50%;transform:translateX(-50%) translateY(-50%);cursor:pointer}button>*{pointer-events:none}</style><div id="wrapper"><button aria-label="dismiss tag"><sinch-icon-cancel></sinch-icon-cancel></button></div>';
|
|
13
13
|
const template = document.createElement('template');
|
|
14
14
|
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends
|
|
15
|
+
defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends NectaryElement {
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
|
|
@@ -21,10 +21,7 @@ defineCustomElement('sinch-tag-close', (_$button = new WeakMap(), class extends
|
|
|
21
21
|
value: void 0
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const shadowRoot = this.attachShadow(
|
|
25
|
-
mode: 'closed',
|
|
26
|
-
delegatesFocus: true
|
|
27
|
-
});
|
|
24
|
+
const shadowRoot = this.attachShadow();
|
|
28
25
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
29
26
|
|
|
30
27
|
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
|
package/textarea/index.js
CHANGED
|
@@ -7,11 +7,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
10
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
11
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:focus{border-color:var(--sinch-color-stormy-600)}:host([resizable]:not([resizable=false])) #input{resize:vertical}:host([invalidtext]:not([invalidtext=""])) #input:not(:disabled){border-color:var(--sinch-color-text-invalid)}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><textarea id="input"></textarea><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends
|
|
14
|
+
defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
@@ -104,10 +104,7 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
const shadowRoot = this.attachShadow(
|
|
108
|
-
mode: 'closed',
|
|
109
|
-
delegatesFocus: true
|
|
110
|
-
});
|
|
107
|
+
const shadowRoot = this.attachShadow();
|
|
111
108
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
112
109
|
|
|
113
110
|
_classPrivateFieldSet(this, _$input, shadowRoot.querySelector('#input'));
|
package/title/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import '../icons/cancel';
|
|
11
|
-
import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute } from '../utils';
|
|
11
|
+
import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement } from '../utils';
|
|
12
12
|
const templateHTML = '<style>:host{display:block}:host([type=xl])>*{font:var(--sinch-font-title-xl)}:host([type="l"])>*{font:var(--sinch-font-title-l)}:host([type="m"])>*{font:var(--sinch-font-title-m)}:host([type="s"])>*{font:var(--sinch-font-title-s)}:host([type=xs])>*{font:var(--sinch-font-title-xs)}</style><span id="text"></span>';
|
|
13
13
|
const typeValues = ['xl', 'l', 'm', 's', 'xs'];
|
|
14
14
|
const levelValues = ['1', '2', '3', '4', '5', '6'];
|
|
@@ -27,7 +27,7 @@ const assertType = value => {
|
|
|
27
27
|
|
|
28
28
|
const template = document.createElement('template');
|
|
29
29
|
template.innerHTML = templateHTML;
|
|
30
|
-
defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends
|
|
30
|
+
defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends NectaryElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super();
|
|
33
33
|
|
|
@@ -36,10 +36,7 @@ defineCustomElement('sinch-title', (_$text = new WeakMap(), class extends HTMLEl
|
|
|
36
36
|
value: void 0
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const shadowRoot = this.attachShadow(
|
|
40
|
-
mode: 'closed',
|
|
41
|
-
delegatesFocus: true
|
|
42
|
-
});
|
|
39
|
+
const shadowRoot = this.attachShadow();
|
|
43
40
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
44
41
|
|
|
45
42
|
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
package/toggle/index.js
CHANGED
|
@@ -7,11 +7,11 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
10
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
11
|
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;flex-direction:row;box-sizing:border-box;width:100%;height:32px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);text-align:initial}:host([small]:not([small=false])) #wrapper{font:var(--sinch-font-small-text)}#checkbox{all:initial;display:block;position:absolute;left:0;top:0;width:40px;height:20px;cursor:pointer;pointer-events:initial}#checkbox:disabled{cursor:initial}#knob-container{position:relative;box-sizing:border-box;align-self:center;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-color-stormy-100);overflow:hidden}:host([checked]:not([checked=false])) #knob-container{background-color:var(--sinch-color-tropical-500)}:host([small]:not([small=false])) #knob-container{width:32px;height:16px;border-radius:8px}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-color-snow-100);transform:translateX(0);transition:transform .1s ease-in-out}:host([checked]:not([checked=false])) #knob{transform:translateX(20px)}:host([small]:not([small=false])) #knob{width:12px;height:12px}:host([small]:not([small=false])[checked]:not([checked=false])) #knob{transform:translateX(16px)}#knob::after,#knob::before{color:var(--sinch-color-snow-100);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::after,:host([labeled]:not([labeled=false]):is(:not([small]),[small=false])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{display:none;flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px}:host([text]:not([text=""])) #label{display:block}:host([disabled]:not([disabled=false])) #label{color:var(--sinch-color-stormy-200)}:host([disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-snow-700)}:host([checked]:not([checked=false])[disabled]:not([disabled=false])) #knob-container{background-color:var(--sinch-color-tropical-100)}</style><div id="wrapper"><div id="knob-container"><div id="knob"></div><input id="checkbox" type="checkbox"></div><label for="checkbox" id="label"></label></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends
|
|
14
|
+
defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new WeakMap(), _onInput = new WeakMap(), class extends NectaryElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
@@ -40,10 +40,7 @@ defineCustomElement('sinch-toggle', (_$input = new WeakMap(), _$label = new Weak
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const shadowRoot = this.attachShadow(
|
|
44
|
-
mode: 'closed',
|
|
45
|
-
delegatesFocus: true
|
|
46
|
-
});
|
|
43
|
+
const shadowRoot = this.attachShadow();
|
|
47
44
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
48
45
|
|
|
49
46
|
_classPrivateFieldSet(this, _$input, shadowRoot.querySelector('input'));
|