@nectary/components 0.38.0 → 0.40.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 +47 -84
- package/accordion/types.d.ts +1 -0
- package/accordion-item/index.js +26 -53
- package/action-menu/index.d.ts +0 -1
- package/action-menu/index.js +179 -223
- package/action-menu/types.d.ts +8 -18
- package/action-menu-option/index.d.ts +1 -0
- package/action-menu-option/index.js +51 -62
- package/action-menu-option/types.d.ts +9 -0
- package/action-menu-option/utils.d.ts +2 -0
- package/action-menu-option/utils.js +3 -0
- package/alert/index.js +6 -20
- package/avatar/index.js +12 -31
- package/avatar-badge/index.js +8 -22
- package/avatar-status/index.js +1 -1
- package/button/index.js +42 -92
- package/card/index.d.ts +2 -0
- package/card/index.js +24 -87
- package/chat-avatar/index.js +8 -22
- package/chat-block/index.js +29 -69
- package/chat-bubble/index.js +6 -20
- package/checkbox/index.js +55 -107
- package/chip/index.d.ts +13 -0
- package/chip/index.js +137 -0
- package/chip/types.d.ts +38 -0
- package/color-menu/index.d.ts +13 -0
- package/color-menu/index.js +464 -0
- package/color-menu/types.d.ts +37 -0
- package/color-swatch/index.d.ts +13 -0
- package/color-swatch/index.js +59 -0
- package/color-swatch/types.d.ts +12 -0
- package/colors.json +57 -49
- package/date-picker/index.js +196 -287
- package/date-picker/types.d.ts +25 -1
- package/dialog/index.d.ts +1 -0
- package/dialog/index.js +72 -143
- package/dropdown-checkbox-option/index.js +6 -20
- package/dropdown-radio-option/index.js +6 -20
- package/field/index.js +25 -63
- package/file-drop/index.js +123 -200
- package/file-picker/index.d.ts +0 -1
- package/file-picker/index.js +55 -108
- package/file-status/index.js +15 -39
- package/help-tooltip/index.js +1 -1
- package/horizontal-stepper/index.js +33 -59
- package/horizontal-stepper-item/index.js +13 -37
- package/icon-button/index.js +39 -84
- package/icons-channel/notify/index.d.ts +11 -0
- package/icons-channel/notify/index.js +4 -0
- package/illustrations/create-illustration-class.js +1 -1
- package/inline-alert/index.js +30 -82
- package/input/index.js +113 -222
- package/link/index.js +46 -96
- package/list-item/index.js +1 -1
- package/package.json +12 -14
- package/pagination/index.js +109 -163
- package/pagination/types.d.ts +1 -0
- package/popover/index.js +224 -294
- package/progress/index.js +9 -28
- package/radio/index.js +103 -169
- package/radio/types.d.ts +1 -0
- package/radio-option/index.js +24 -48
- package/segment/index.js +50 -131
- package/segment-collapse/index.js +24 -49
- package/segment-collapse/types.d.ts +1 -0
- package/segmented-control/index.js +36 -73
- package/segmented-control/types.d.ts +1 -0
- package/segmented-control-option/index.js +41 -87
- package/segmented-icon-control/index.js +47 -84
- package/segmented-icon-control/types.d.ts +1 -0
- package/segmented-icon-control-option/index.js +38 -79
- package/select-button/index.d.ts +13 -0
- package/select-button/index.js +153 -0
- package/select-button/types.d.ts +43 -0
- package/select-menu/index.d.ts +11 -0
- package/select-menu/index.js +346 -0
- package/select-menu/types.d.ts +29 -0
- package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
- package/select-menu-option/index.js +76 -0
- package/{select-option → select-menu-option}/types.d.ts +8 -9
- package/stop-events/index.js +7 -20
- package/table-head-cell/index.js +7 -21
- package/tabs/index.js +103 -165
- package/tabs/types.d.ts +1 -0
- package/tabs-option/index.js +20 -44
- package/tag/index.d.ts +1 -1
- package/tag/index.js +42 -36
- package/tag/types.d.ts +13 -7
- package/textarea/index.js +92 -167
- package/theme.css +80 -49
- package/tile-control/index.js +55 -96
- package/tile-control-option/index.js +40 -86
- package/time-picker/index.js +224 -368
- package/time-picker/types.d.ts +5 -1
- package/title/index.js +6 -20
- package/toast/index.d.ts +17 -0
- package/toast/index.js +115 -0
- package/toast/types.d.ts +28 -0
- package/toast/utils.d.ts +5 -0
- package/toast/utils.js +6 -0
- package/toast-manager/index.d.ts +17 -0
- package/toast-manager/index.js +195 -0
- package/toast-manager/types.d.ts +7 -0
- package/toggle/index.js +55 -108
- package/toggle/types.d.ts +1 -0
- package/types.d.ts +7 -0
- package/utils/colors.d.ts +10 -0
- package/utils/colors.js +121 -0
- package/{utils.d.ts → utils/index.d.ts} +18 -9
- package/{utils.js → utils/index.js} +118 -39
- package/vertical-stepper/index.js +29 -50
- package/vertical-stepper-item/index.js +13 -37
- package/card-button/index.d.ts +0 -11
- package/card-button/index.js +0 -77
- package/card-button/types.d.ts +0 -12
- package/card-link/index.d.ts +0 -12
- package/card-link/index.js +0 -115
- package/card-link/types.d.ts +0 -14
- package/dropdown/index.d.ts +0 -12
- package/dropdown/index.js +0 -415
- package/dropdown/types.d.ts +0 -30
- package/dropdown-text-option/index.js +0 -104
- package/dropdown-text-option/types.d.ts +0 -16
- package/search/index.d.ts +0 -14
- package/search/index.js +0 -523
- package/search/types.d.ts +0 -25
- package/search-option/index.d.ts +0 -11
- package/search-option/index.js +0 -55
- package/search-option/types.d.ts +0 -9
- package/select/index.d.ts +0 -13
- package/select/index.js +0 -316
- package/select/types.d.ts +0 -53
- package/select-option/index.d.ts +0 -11
- package/select-option/index.js +0 -8
- package/tag/utils.d.ts +0 -2
- package/tag/utils.js +0 -1
- package/tag-close/index.d.ts +0 -12
- package/tag-close/index.js +0 -38
- package/tag-close/types.d.ts +0 -3
- package/tag-close/types.js +0 -1
- /package/{card-button → chip}/types.js +0 -0
- /package/{card-link → color-menu}/types.js +0 -0
- /package/{dropdown-text-option → color-swatch}/types.js +0 -0
- /package/{dropdown → select-button}/types.js +0 -0
- /package/{search → select-menu}/types.js +0 -0
- /package/{search-option → select-menu-option}/types.js +0 -0
- /package/{select → toast}/types.js +0 -0
- /package/{select-option → toast-manager}/types.js +0 -0
package/file-status/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$filename, _$contentSlot, _onContentSlotChange;
|
|
5
|
-
|
|
6
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
1
|
import '../spinner';
|
|
11
2
|
import '../icons/check-circle';
|
|
12
3
|
import '../icons/report';
|
|
@@ -14,47 +5,29 @@ import '../icons/pending-actions';
|
|
|
14
5
|
import '../icons/text-snippet';
|
|
15
6
|
import '../text';
|
|
16
7
|
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
17
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:12px 16px;box-sizing:border-box;min-height:48px;min-width:148px;background-color:var(--sinch-color-
|
|
8
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:12px 16px;box-sizing:border-box;min-height:48px;min-width:148px;background-color:var(--sinch-color-bg-primary-contrast);border-radius:var(--sinch-shape-radius-m)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}#content-wrapper{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;margin-left:16px;color:var(--sinch-color-stormy-500)}#icon-error,#icon-loading,#icon-pending,#icon-progress,#icon-success{display:none}#action{height:24px}#action ::slotted(*){position:relative;top:50%;transform:translateY(-50%)}:host([type=error]) #icon-error,:host([type=loading]) #icon-loading,:host([type=pending]) #icon-pending,:host([type=progress]) #icon-progress,:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([type=success]) #icon-success{--sinch-color-icon:var(--sinch-color-success-500)}:host([type=error]) #icon-error{--sinch-color-icon:var(--sinch-color-error-500)}</style><div id="wrapper"><sinch-spinner id="icon-loading" type="medium"></sinch-spinner><sinch-icon-check-circle id="icon-success"></sinch-icon-check-circle><sinch-icon-report id="icon-error"></sinch-icon-report><sinch-icon-pending-actions id="icon-pending"></sinch-icon-pending-actions><sinch-icon-text-snippet id="icon-progress"></sinch-icon-text-snippet><div id="content-wrapper"><sinch-text id="filename" type="m" ellipsis></sinch-text><slot name="content"></slot></div><div id="action"><slot name="action"></slot></div></div>';
|
|
18
9
|
import { assertType, typeValues } from './utils';
|
|
19
10
|
const template = document.createElement('template');
|
|
20
11
|
template.innerHTML = templateHTML;
|
|
21
|
-
defineCustomElement('sinch-file-status',
|
|
12
|
+
defineCustomElement('sinch-file-status', class extends NectaryElement {
|
|
13
|
+
#$filename;
|
|
14
|
+
#$contentSlot;
|
|
15
|
+
|
|
22
16
|
constructor() {
|
|
23
17
|
super();
|
|
24
|
-
|
|
25
|
-
_classPrivateFieldInitSpec(this, _$filename, {
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
_classPrivateFieldInitSpec(this, _$contentSlot, {
|
|
31
|
-
writable: true,
|
|
32
|
-
value: void 0
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
_classPrivateFieldInitSpec(this, _onContentSlotChange, {
|
|
36
|
-
writable: true,
|
|
37
|
-
value: () => {
|
|
38
|
-
updateBooleanAttribute(_classPrivateFieldGet(this, _$filename), 'emphasized', _classPrivateFieldGet(this, _$contentSlot).assignedElements().length > 0);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
18
|
const shadowRoot = this.attachShadow();
|
|
43
19
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_classPrivateFieldSet(this, _$contentSlot, shadowRoot.querySelector('slot[name="content"]'));
|
|
20
|
+
this.#$filename = shadowRoot.querySelector('#filename');
|
|
21
|
+
this.#$contentSlot = shadowRoot.querySelector('slot[name="content"]');
|
|
48
22
|
}
|
|
49
23
|
|
|
50
24
|
connectedCallback() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_classPrivateFieldGet(this, _onContentSlotChange).call(this);
|
|
25
|
+
this.#$contentSlot.addEventListener('slotchange', this.#onContentSlotChange);
|
|
26
|
+
this.#onContentSlotChange();
|
|
54
27
|
}
|
|
55
28
|
|
|
56
29
|
disconnectedCallback() {
|
|
57
|
-
|
|
30
|
+
this.#$contentSlot.removeEventListener('slotchange', this.#onContentSlotChange);
|
|
58
31
|
}
|
|
59
32
|
|
|
60
33
|
get type() {
|
|
@@ -91,10 +64,13 @@ defineCustomElement('sinch-file-status', (_$filename = new WeakMap(), _$contentS
|
|
|
91
64
|
|
|
92
65
|
case 'filename':
|
|
93
66
|
{
|
|
94
|
-
|
|
67
|
+
this.#$filename.textContent = newVal;
|
|
95
68
|
break;
|
|
96
69
|
}
|
|
97
70
|
}
|
|
98
71
|
}
|
|
99
72
|
|
|
100
|
-
|
|
73
|
+
#onContentSlotChange = () => {
|
|
74
|
+
updateBooleanAttribute(this.#$filename, 'emphasized', this.#$contentSlot.assignedElements().length > 0);
|
|
75
|
+
};
|
|
76
|
+
});
|
package/help-tooltip/index.js
CHANGED
|
@@ -1,77 +1,29 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$itemsSlot, _$progressBar, _updateItems;
|
|
5
|
-
|
|
6
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
1
|
import '../icons/check';
|
|
11
2
|
import '../icons/error-outline';
|
|
12
3
|
import { clampNumber, defineCustomElement, getAttribute, getIntegerAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
13
4
|
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;gap:28px;width:fit-content}#progress{position:absolute;height:1px;background-color:var(--sinch-color-snow-700);left:72px;right:72px;top:16px;transform:translateY(-50%)}#bar{position:absolute;height:1px;background-color:var(--sinch-color-stormy-400);left:0;top:0}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><slot></slot></div>';
|
|
14
5
|
const template = document.createElement('template');
|
|
15
6
|
template.innerHTML = templateHTML;
|
|
16
|
-
defineCustomElement('sinch-horizontal-stepper',
|
|
7
|
+
defineCustomElement('sinch-horizontal-stepper', class extends NectaryElement {
|
|
8
|
+
#$itemsSlot;
|
|
9
|
+
#$progressBar;
|
|
10
|
+
|
|
17
11
|
constructor() {
|
|
18
12
|
super();
|
|
19
|
-
|
|
20
|
-
_classPrivateFieldInitSpec(this, _$itemsSlot, {
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
_classPrivateFieldInitSpec(this, _$progressBar, {
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
_classPrivateFieldInitSpec(this, _updateItems, {
|
|
31
|
-
writable: true,
|
|
32
|
-
value: () => {
|
|
33
|
-
const $items = _classPrivateFieldGet(this, _$itemsSlot).assignedElements();
|
|
34
|
-
|
|
35
|
-
const activeIndex = clampNumber(getIntegerAttribute(this, 'index', 0), 0, $items.length + 1);
|
|
36
|
-
|
|
37
|
-
for (let i = 0; i < $items.length; i++) {
|
|
38
|
-
const $el = $items[i];
|
|
39
|
-
const itemIndex = i + 1;
|
|
40
|
-
$el.setAttribute('data-index', String(itemIndex));
|
|
41
|
-
|
|
42
|
-
if (itemIndex === activeIndex) {
|
|
43
|
-
$el.setAttribute('data-progress', 'active');
|
|
44
|
-
} else if (itemIndex < activeIndex) {
|
|
45
|
-
$el.setAttribute('data-progress', 'done');
|
|
46
|
-
} else {
|
|
47
|
-
$el.removeAttribute('data-progress');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const valueIndex = clampNumber(activeIndex - 1, 0, $items.length - 1);
|
|
52
|
-
_classPrivateFieldGet(this, _$progressBar).style.width = `${Math.floor(valueIndex / Math.max(1, $items.length - 1) * 100)}%`;
|
|
53
|
-
this.setAttribute('aria-valuemax', String($items.length));
|
|
54
|
-
this.setAttribute('aria-valuenow', String(valueIndex + 1));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
13
|
const shadowRoot = this.attachShadow();
|
|
59
14
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_classPrivateFieldSet(this, _$progressBar, shadowRoot.querySelector('#bar'));
|
|
15
|
+
this.#$itemsSlot = shadowRoot.querySelector('slot');
|
|
16
|
+
this.#$progressBar = shadowRoot.querySelector('#bar');
|
|
64
17
|
}
|
|
65
18
|
|
|
66
19
|
connectedCallback() {
|
|
67
20
|
this.setAttribute('role', 'progressbar');
|
|
68
21
|
this.setAttribute('aria-valuemin', '0');
|
|
69
|
-
|
|
70
|
-
_classPrivateFieldGet(this, _$itemsSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateItems));
|
|
22
|
+
this.#$itemsSlot.addEventListener('slotchange', this.#updateItems);
|
|
71
23
|
}
|
|
72
24
|
|
|
73
25
|
disconnectedCallback() {
|
|
74
|
-
|
|
26
|
+
this.#$itemsSlot.removeEventListener('slotchange', this.#updateItems);
|
|
75
27
|
}
|
|
76
28
|
|
|
77
29
|
static get observedAttributes() {
|
|
@@ -86,8 +38,7 @@ defineCustomElement('sinch-horizontal-stepper', (_$itemsSlot = new WeakMap(), _$
|
|
|
86
38
|
switch (name) {
|
|
87
39
|
case 'index':
|
|
88
40
|
{
|
|
89
|
-
|
|
90
|
-
|
|
41
|
+
this.#updateItems();
|
|
91
42
|
break;
|
|
92
43
|
}
|
|
93
44
|
}
|
|
@@ -101,4 +52,27 @@ defineCustomElement('sinch-horizontal-stepper', (_$itemsSlot = new WeakMap(), _$
|
|
|
101
52
|
return getAttribute(this, 'index', '1');
|
|
102
53
|
}
|
|
103
54
|
|
|
104
|
-
|
|
55
|
+
#updateItems = () => {
|
|
56
|
+
const $items = this.#$itemsSlot.assignedElements();
|
|
57
|
+
const activeIndex = clampNumber(getIntegerAttribute(this, 'index', 0), 0, $items.length + 1);
|
|
58
|
+
|
|
59
|
+
for (let i = 0; i < $items.length; i++) {
|
|
60
|
+
const $el = $items[i];
|
|
61
|
+
const itemIndex = i + 1;
|
|
62
|
+
$el.setAttribute('data-index', String(itemIndex));
|
|
63
|
+
|
|
64
|
+
if (itemIndex === activeIndex) {
|
|
65
|
+
$el.setAttribute('data-progress', 'active');
|
|
66
|
+
} else if (itemIndex < activeIndex) {
|
|
67
|
+
$el.setAttribute('data-progress', 'done');
|
|
68
|
+
} else {
|
|
69
|
+
$el.removeAttribute('data-progress');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const valueIndex = clampNumber(activeIndex - 1, 0, $items.length - 1);
|
|
74
|
+
this.#$progressBar.style.width = `${Math.floor(valueIndex / Math.max(1, $items.length - 1) * 100)}%`;
|
|
75
|
+
this.setAttribute('aria-valuemax', String($items.length));
|
|
76
|
+
this.setAttribute('aria-valuenow', String(valueIndex + 1));
|
|
77
|
+
};
|
|
78
|
+
});
|
|
@@ -1,46 +1,22 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$label, _$description, _$circleText;
|
|
5
|
-
|
|
6
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
1
|
import '../icons/check';
|
|
11
2
|
import '../icons/exclamation';
|
|
12
3
|
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
13
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{width:144px;min-height:64px;display:flex;flex-direction:column}#circle{position:relative;display:flex;align-items:center;justify-content:center;align-self:center;width:32px;height:32px;background-color:var(--sinch-color-snow-700);font:var(--sinch-font-title-s);line-height:32px;text-align:center;color:var(--sinch-color-stormy-500);border:1px solid transparent;border-radius:50%;box-sizing:border-box;--sinch-icon
|
|
4
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{width:144px;min-height:64px;display:flex;flex-direction:column}#circle{position:relative;display:flex;align-items:center;justify-content:center;align-self:center;width:32px;height:32px;background-color:var(--sinch-color-snow-700);font:var(--sinch-font-title-s);line-height:32px;text-align:center;color:var(--sinch-color-stormy-500);border:1px solid transparent;border-radius:50%;box-sizing:border-box;--sinch-size-icon:20px}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-500);text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-top:8px}#description{font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-300);text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-error,#icon-success{display:none}:host([data-progress=active]) #circle{color:var(--sinch-color-snow-100);background-color:var(--sinch-color-stormy-400)}:host([data-progress=done]) #circle{border-color:var(--sinch-color-stormy-400)}:host([data-progress=done]:not([status])) #icon-success{display:block}:host([data-progress=done][status=error]) #circle{background-color:var(--sinch-color-error-200);border-color:var(--sinch-color-stormy-400)}:host([data-progress=done][status=error]) #icon-error{display:block}:host([data-progress=done]:not([status=skip])) #circle-text{display:none}</style><div id="wrapper"><div id="circle" aria-hidden="true"><sinch-icon-check id="icon-success"></sinch-icon-check><sinch-icon-exclamation id="icon-error"></sinch-icon-exclamation><span id="circle-text"></span></div><span id="label"></span><span id="description"></span></div>';
|
|
14
5
|
import { statusValues } from './utils';
|
|
15
6
|
const template = document.createElement('template');
|
|
16
7
|
template.innerHTML = templateHTML;
|
|
17
|
-
defineCustomElement('sinch-horizontal-stepper-item',
|
|
8
|
+
defineCustomElement('sinch-horizontal-stepper-item', class extends NectaryElement {
|
|
9
|
+
#$label;
|
|
10
|
+
#$description;
|
|
11
|
+
#$circleText;
|
|
12
|
+
|
|
18
13
|
constructor() {
|
|
19
14
|
super();
|
|
20
|
-
|
|
21
|
-
_classPrivateFieldInitSpec(this, _$label, {
|
|
22
|
-
writable: true,
|
|
23
|
-
value: void 0
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
_classPrivateFieldInitSpec(this, _$description, {
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
_classPrivateFieldInitSpec(this, _$circleText, {
|
|
32
|
-
writable: true,
|
|
33
|
-
value: void 0
|
|
34
|
-
});
|
|
35
|
-
|
|
36
15
|
const shadowRoot = this.attachShadow();
|
|
37
16
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_classPrivateFieldSet(this, _$description, shadowRoot.querySelector('#description'));
|
|
42
|
-
|
|
43
|
-
_classPrivateFieldSet(this, _$circleText, shadowRoot.querySelector('#circle-text'));
|
|
17
|
+
this.#$label = shadowRoot.querySelector('#label');
|
|
18
|
+
this.#$description = shadowRoot.querySelector('#description');
|
|
19
|
+
this.#$circleText = shadowRoot.querySelector('#circle-text');
|
|
44
20
|
}
|
|
45
21
|
|
|
46
22
|
connectedCallback() {}
|
|
@@ -55,19 +31,19 @@ defineCustomElement('sinch-horizontal-stepper-item', (_$label = new WeakMap(), _
|
|
|
55
31
|
switch (name) {
|
|
56
32
|
case 'label':
|
|
57
33
|
{
|
|
58
|
-
|
|
34
|
+
this.#$label.textContent = newVal;
|
|
59
35
|
break;
|
|
60
36
|
}
|
|
61
37
|
|
|
62
38
|
case 'description':
|
|
63
39
|
{
|
|
64
|
-
|
|
40
|
+
this.#$description.textContent = newVal;
|
|
65
41
|
break;
|
|
66
42
|
}
|
|
67
43
|
|
|
68
44
|
case 'data-index':
|
|
69
45
|
{
|
|
70
|
-
|
|
46
|
+
this.#$circleText.textContent = newVal;
|
|
71
47
|
break;
|
|
72
48
|
}
|
|
73
49
|
}
|
|
@@ -97,4 +73,4 @@ defineCustomElement('sinch-horizontal-stepper-item', (_$label = new WeakMap(), _
|
|
|
97
73
|
updateLiteralAttribute(this, statusValues, 'status', value);
|
|
98
74
|
}
|
|
99
75
|
|
|
100
|
-
})
|
|
76
|
+
});
|
package/icon-button/index.js
CHANGED
|
@@ -1,97 +1,34 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$button, _onButtonClick, _onButtonFocus, _onButtonBlur, _onFocusReactHandler, _onBlurReactHandler, _onClickReactHandler;
|
|
5
|
-
|
|
6
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
1
|
import { defineCustomElement, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;width:48px;height:48px;cursor:pointer;contain:size;--sinch-size-icon:24px;--sinch-color-icon:var(--sinch-icon-button-color, var(--sinch-color-stormy-500));--sinch-icon-button-shape-radius:var(--sinch-shape-radius-l)}button::before{content:"";position:absolute;left:0;top:0;width:100%;height:100%;border-radius:var(--sinch-icon-button-shape-radius);pointer-events:none;box-sizing:border-box;border:1px solid transparent;background-color:transparent;mix-blend-mode:multiply}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-icon-button-shape-radius) + 4px);pointer-events:none}@supports not selector(:focus-visible){button:focus::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-icon-button-shape-radius) + 4px);pointer-events:none}}button:enabled:hover::before{background-color
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;width:48px;height:48px;cursor:pointer;contain:size;--sinch-size-icon:24px;--sinch-color-icon:var(--sinch-icon-button-color, var(--sinch-color-stormy-500));--sinch-icon-button-shape-radius:var(--sinch-shape-radius-l)}button::before{content:"";position:absolute;left:0;top:0;width:100%;height:100%;border-radius:var(--sinch-icon-button-shape-radius);pointer-events:none;box-sizing:border-box;border:1px solid transparent;background-color:transparent;mix-blend-mode:multiply}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-icon-button-shape-radius) + 4px);pointer-events:none}@supports not selector(:focus-visible){button:focus::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-icon-button-shape-radius) + 4px);pointer-events:none}}button:enabled:hover::before{background-color:#f1f2f4}button:enabled:active::before{background-color:#e3e6e8}button:disabled{background-color:transparent;cursor:initial;--sinch-color-spinner-bg:var(--sinch-color-snow-200);--sinch-color-spinner-fg:var(--sinch-color-stormy-200);--sinch-color-icon:var(--sinch-color-stormy-100)}:host([small]:not([small=false]))>button{width:32px;height:32px;--sinch-icon-button-shape-radius:var(--sinch-shape-radius-m)}button>*{pointer-events:none}</style><button><slot name="icon"></slot></button>';
|
|
12
3
|
const template = document.createElement('template');
|
|
13
4
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-icon-button',
|
|
5
|
+
defineCustomElement('sinch-icon-button', class extends NectaryElement {
|
|
6
|
+
#$button;
|
|
7
|
+
|
|
15
8
|
constructor() {
|
|
16
9
|
super();
|
|
17
|
-
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$button, {
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
_classPrivateFieldInitSpec(this, _onButtonClick, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: () => {
|
|
26
|
-
this.dispatchEvent(new CustomEvent('-click'));
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
_classPrivateFieldInitSpec(this, _onButtonFocus, {
|
|
31
|
-
writable: true,
|
|
32
|
-
value: () => {
|
|
33
|
-
this.dispatchEvent(new CustomEvent('-focus'));
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
_classPrivateFieldInitSpec(this, _onButtonBlur, {
|
|
38
|
-
writable: true,
|
|
39
|
-
value: () => {
|
|
40
|
-
this.dispatchEvent(new CustomEvent('-blur'));
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
_classPrivateFieldInitSpec(this, _onFocusReactHandler, {
|
|
45
|
-
writable: true,
|
|
46
|
-
value: () => {
|
|
47
|
-
getReactEventHandler(this, 'on-focus')?.();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
_classPrivateFieldInitSpec(this, _onBlurReactHandler, {
|
|
52
|
-
writable: true,
|
|
53
|
-
value: () => {
|
|
54
|
-
getReactEventHandler(this, 'on-blur')?.();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
_classPrivateFieldInitSpec(this, _onClickReactHandler, {
|
|
59
|
-
writable: true,
|
|
60
|
-
value: e => {
|
|
61
|
-
getReactEventHandler(this, 'on-click')?.(e);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
10
|
const shadowRoot = this.attachShadow();
|
|
66
11
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
67
|
-
|
|
68
|
-
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
|
|
12
|
+
this.#$button = shadowRoot.querySelector('button');
|
|
69
13
|
}
|
|
70
14
|
|
|
71
15
|
connectedCallback() {
|
|
72
16
|
this.setAttribute('role', 'button');
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.addEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
81
|
-
this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
82
|
-
this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
17
|
+
this.#$button.addEventListener('click', this.#onButtonClick);
|
|
18
|
+
this.#$button.addEventListener('focus', this.#onButtonFocus);
|
|
19
|
+
this.#$button.addEventListener('blur', this.#onButtonBlur);
|
|
20
|
+
this.addEventListener('-click', this.#onClickReactHandler);
|
|
21
|
+
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
22
|
+
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
83
23
|
}
|
|
84
24
|
|
|
85
25
|
disconnectedCallback() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.removeEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
93
|
-
this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
94
|
-
this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
26
|
+
this.#$button.removeEventListener('click', this.#onButtonClick);
|
|
27
|
+
this.#$button.removeEventListener('focus', this.#onButtonFocus);
|
|
28
|
+
this.#$button.removeEventListener('blur', this.#onButtonBlur);
|
|
29
|
+
this.removeEventListener('-click', this.#onClickReactHandler);
|
|
30
|
+
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
31
|
+
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
95
32
|
}
|
|
96
33
|
|
|
97
34
|
static get observedAttributes() {
|
|
@@ -103,7 +40,7 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), _onButtonCli
|
|
|
103
40
|
case 'disabled':
|
|
104
41
|
{
|
|
105
42
|
const isDisabled = isAttrTrue(newVal);
|
|
106
|
-
|
|
43
|
+
this.#$button.disabled = isDisabled;
|
|
107
44
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
108
45
|
break;
|
|
109
46
|
}
|
|
@@ -133,11 +70,29 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), _onButtonCli
|
|
|
133
70
|
}
|
|
134
71
|
|
|
135
72
|
focus() {
|
|
136
|
-
|
|
73
|
+
this.#$button.focus();
|
|
137
74
|
}
|
|
138
75
|
|
|
139
76
|
blur() {
|
|
140
|
-
|
|
77
|
+
this.#$button.blur();
|
|
141
78
|
}
|
|
142
79
|
|
|
143
|
-
|
|
80
|
+
#onButtonClick = () => {
|
|
81
|
+
this.dispatchEvent(new CustomEvent('-click'));
|
|
82
|
+
};
|
|
83
|
+
#onButtonFocus = () => {
|
|
84
|
+
this.dispatchEvent(new CustomEvent('-focus'));
|
|
85
|
+
};
|
|
86
|
+
#onButtonBlur = () => {
|
|
87
|
+
this.dispatchEvent(new CustomEvent('-blur'));
|
|
88
|
+
};
|
|
89
|
+
#onFocusReactHandler = () => {
|
|
90
|
+
getReactEventHandler(this, 'on-focus')?.();
|
|
91
|
+
};
|
|
92
|
+
#onBlurReactHandler = () => {
|
|
93
|
+
getReactEventHandler(this, 'on-blur')?.();
|
|
94
|
+
};
|
|
95
|
+
#onClickReactHandler = e => {
|
|
96
|
+
getReactEventHandler(this, 'on-click')?.(e);
|
|
97
|
+
};
|
|
98
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSinchIconChannelElement, TSinchIconChannelReact } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace JSX {
|
|
4
|
+
interface IntrinsicElements {
|
|
5
|
+
'sinch-icon-channel-notify': TSinchIconChannelReact;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'sinch-icon-channel-notify': TSinchIconChannelElement;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineCustomElement } from '../../utils';
|
|
2
|
+
import { createIconClass } from '../create-icon-class';
|
|
3
|
+
const templateHTML = '<svg viewBox="0 0 40 40" aria-hidden="true" focusable="false"><path fill="#0076BA" fill-rule="evenodd" d="M8.523 33.337C3.37 30.02 0 24.532 0 18.328 0 8.213 8.962 0 20 0s20 8.213 20 18.328c0 10.116-8.962 18.328-20 18.328-.64 0-1.273-.027-1.898-.081C16.235 38.665 13.395 40 10.22 40c-2.123 0-4.096-.597-5.729-1.617 1.911-1.195 3.357-2.97 4.033-5.047Z" clip-rule="evenodd"/><path fill="#fff" fill-rule="evenodd" d="M30.667 13.393c0-2.697-2.39-4.887-5.334-4.887H14.667c-2.944 0-5.334 2.19-5.334 4.887v9.775c0 2.698 2.39 4.888 5.334 4.888h10.666c2.944 0 5.334-2.19 5.334-4.888v-9.775Z" clip-rule="evenodd"/><path fill="#0076BA" fill-rule="evenodd" d="M17.866 23.46c0-.34.256-.635.617-.713.36-.078.733.081.899.385l2.751 5.043h-4.267V23.46Zm4.267-10.362c0 .34-.255.636-.616.714-.361.078-.733-.082-.9-.386l-2.75-5.042h4.266v4.714Z" clip-rule="evenodd"/><path fill="#0076BA" d="M29.705 13.703c2.805 0 5.078-2.084 5.078-4.654s-2.273-4.654-5.078-4.654c-2.804 0-5.078 2.084-5.078 4.654s2.274 4.654 5.078 4.654Z"/><path fill="#E44436" d="M29.705 12.226c1.915 0 3.467-1.422 3.467-3.177 0-1.754-1.552-3.177-3.467-3.177-1.914 0-3.466 1.423-3.466 3.177 0 1.755 1.552 3.177 3.466 3.177Z"/></svg>';
|
|
4
|
+
defineCustomElement('sinch-icon-channel-notify', createIconClass(templateHTML));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getIntegerAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
|
|
2
|
-
const illustrationStylesHtml = '<style>:host{display:block}svg{display:block;pointer-events:none}#wrapper{display:flex;width:100%;height:100%;align-items:center;justify-content:center;overflow:hidden}#wrapper>*{flex-shrink:0}:host([valign=top]) #wrapper{align-items:flex-start}:host([valign=bottom]) #wrapper{align-items:flex-end}:host([background=yellow]) #wrapper{background-color:var(--sinch-color-
|
|
2
|
+
const illustrationStylesHtml = '<style>:host{display:block}svg{display:block;pointer-events:none}#wrapper{display:flex;width:100%;height:100%;align-items:center;justify-content:center;overflow:hidden}#wrapper>*{flex-shrink:0}:host([valign=top]) #wrapper{align-items:flex-start}:host([valign=bottom]) #wrapper{align-items:flex-end}:host([background=yellow]) #wrapper{background-color:var(--sinch-color-bg-comp-yellow)}:host([background=green]) #wrapper{background-color:var(--sinch-color-bg-comp-green)}:host([background=blue]) #wrapper{background-color:var(--sinch-color-bg-comp-blue)}:host([background=grey]) #wrapper{background-color:var(--sinch-color-bg-primary-contrast)}:host([background=white]) #wrapper{background-color:var(--sinch-color-bg-primary-light)}</style>';
|
|
3
3
|
import { backgroundValues, valignValues } from './utils';
|
|
4
4
|
const DEFAULT_SIZE = 256;
|
|
5
5
|
const MIN_SIZE = 16;
|