@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
|
@@ -1,68 +1,27 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$itemsSlot, _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:column;width:100%}#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"><slot></slot></div>';
|
|
14
5
|
const template = document.createElement('template');
|
|
15
6
|
template.innerHTML = templateHTML;
|
|
16
|
-
defineCustomElement('sinch-vertical-stepper',
|
|
7
|
+
defineCustomElement('sinch-vertical-stepper', class extends NectaryElement {
|
|
8
|
+
#$itemsSlot;
|
|
9
|
+
|
|
17
10
|
constructor() {
|
|
18
11
|
super();
|
|
19
|
-
|
|
20
|
-
_classPrivateFieldInitSpec(this, _$itemsSlot, {
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
_classPrivateFieldInitSpec(this, _updateItems, {
|
|
26
|
-
writable: true,
|
|
27
|
-
value: () => {
|
|
28
|
-
const $items = _classPrivateFieldGet(this, _$itemsSlot).assignedElements();
|
|
29
|
-
|
|
30
|
-
const activeIndex = clampNumber(getIntegerAttribute(this, 'index', 0), 0, $items.length + 1);
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < $items.length; i++) {
|
|
33
|
-
const $el = $items[i];
|
|
34
|
-
const itemIndex = i + 1;
|
|
35
|
-
$el.setAttribute('data-index', String(itemIndex));
|
|
36
|
-
|
|
37
|
-
if (itemIndex === activeIndex) {
|
|
38
|
-
$el.setAttribute('data-progress', 'active');
|
|
39
|
-
} else if (itemIndex < activeIndex) {
|
|
40
|
-
$el.setAttribute('data-progress', 'done');
|
|
41
|
-
} else {
|
|
42
|
-
$el.removeAttribute('data-progress');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this.setAttribute('aria-valuemax', String($items.length));
|
|
47
|
-
this.setAttribute('aria-valuenow', String(clampNumber(activeIndex, 0, $items.length)));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
12
|
const shadowRoot = this.attachShadow();
|
|
52
13
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
53
|
-
|
|
54
|
-
_classPrivateFieldSet(this, _$itemsSlot, shadowRoot.querySelector('slot'));
|
|
14
|
+
this.#$itemsSlot = shadowRoot.querySelector('slot');
|
|
55
15
|
}
|
|
56
16
|
|
|
57
17
|
connectedCallback() {
|
|
58
18
|
this.setAttribute('role', 'progressbar');
|
|
59
19
|
this.setAttribute('aria-valuemin', '0');
|
|
60
|
-
|
|
61
|
-
_classPrivateFieldGet(this, _$itemsSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateItems));
|
|
20
|
+
this.#$itemsSlot.addEventListener('slotchange', this.#updateItems);
|
|
62
21
|
}
|
|
63
22
|
|
|
64
23
|
disconnectedCallback() {
|
|
65
|
-
|
|
24
|
+
this.#$itemsSlot.removeEventListener('slotchange', this.#updateItems);
|
|
66
25
|
}
|
|
67
26
|
|
|
68
27
|
static get observedAttributes() {
|
|
@@ -77,8 +36,7 @@ defineCustomElement('sinch-vertical-stepper', (_$itemsSlot = new WeakMap(), _upd
|
|
|
77
36
|
switch (name) {
|
|
78
37
|
case 'index':
|
|
79
38
|
{
|
|
80
|
-
|
|
81
|
-
|
|
39
|
+
this.#updateItems();
|
|
82
40
|
break;
|
|
83
41
|
}
|
|
84
42
|
}
|
|
@@ -92,4 +50,25 @@ defineCustomElement('sinch-vertical-stepper', (_$itemsSlot = new WeakMap(), _upd
|
|
|
92
50
|
return getAttribute(this, 'index', '1');
|
|
93
51
|
}
|
|
94
52
|
|
|
95
|
-
|
|
53
|
+
#updateItems = () => {
|
|
54
|
+
const $items = this.#$itemsSlot.assignedElements();
|
|
55
|
+
const activeIndex = clampNumber(getIntegerAttribute(this, 'index', 0), 0, $items.length + 1);
|
|
56
|
+
|
|
57
|
+
for (let i = 0; i < $items.length; i++) {
|
|
58
|
+
const $el = $items[i];
|
|
59
|
+
const itemIndex = i + 1;
|
|
60
|
+
$el.setAttribute('data-index', String(itemIndex));
|
|
61
|
+
|
|
62
|
+
if (itemIndex === activeIndex) {
|
|
63
|
+
$el.setAttribute('data-progress', 'active');
|
|
64
|
+
} else if (itemIndex < activeIndex) {
|
|
65
|
+
$el.setAttribute('data-progress', 'done');
|
|
66
|
+
} else {
|
|
67
|
+
$el.removeAttribute('data-progress');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.setAttribute('aria-valuemax', String($items.length));
|
|
72
|
+
this.setAttribute('aria-valuenow', String(clampNumber(activeIndex, 0, $items.length)));
|
|
73
|
+
};
|
|
74
|
+
});
|
|
@@ -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{display:flex;flex-direction:column;position:relative;width:100%;min-height:68px}#circle-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:8px;min-width:0}#circle{display:flex;align-items:center;justify-content: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{display:flex;flex-direction:column;position:relative;width:100%;min-height:68px}#circle-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:8px;min-width:0}#circle{display:flex;align-items:center;justify-content: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-wrapper{margin-top:4px;min-width:0;flex:1}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#description{font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-300);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-error,#icon-success{display:none}#content{display:none;padding:16px 0 16px 40px}#progress{position:absolute;width:1px;left:16px;top:32px;bottom:0;background-color:var(--sinch-color-snow-700);transform:translateX(-50%)}#bar{position:absolute;width:1px;height:0;background-color:var(--sinch-color-stormy-400);left:0;top:0}:host(:last-of-type) #progress{display:none}:host([data-progress=active]) #content{display:block}: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}:host([data-progress=done]) #bar{height:100%}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><div id="circle-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><div id="label-wrapper"><div id="label"></div><div id="description"></div></div></div><div id="content"><slot></slot></div></div>';
|
|
14
5
|
import { statusValues } from './utils';
|
|
15
6
|
const template = document.createElement('template');
|
|
16
7
|
template.innerHTML = templateHTML;
|
|
17
|
-
defineCustomElement('sinch-vertical-stepper-item',
|
|
8
|
+
defineCustomElement('sinch-vertical-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-vertical-stepper-item', (_$label = new WeakMap(), _$d
|
|
|
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-vertical-stepper-item', (_$label = new WeakMap(), _$d
|
|
|
97
73
|
updateLiteralAttribute(this, statusValues, 'status', value);
|
|
98
74
|
}
|
|
99
75
|
|
|
100
|
-
})
|
|
76
|
+
});
|
package/card-button/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TSinchCardButtonElement, TSinchCardButtonReact } from './types';
|
|
2
|
-
declare global {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
'sinch-card-button': TSinchCardButtonReact;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface HTMLElementTagNameMap {
|
|
9
|
-
'sinch-card-button': TSinchCardButtonElement;
|
|
10
|
-
}
|
|
11
|
-
}
|
package/card-button/index.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$button;
|
|
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
|
-
import { defineCustomElement, getBooleanAttribute, getAttribute, updateAttribute, NectaryElement } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;outline:0}sinch-button{display:block}</style><sinch-button type="primary" small></sinch-button>';
|
|
12
|
-
const template = document.createElement('template');
|
|
13
|
-
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-card-button', (_$button = new WeakMap(), class extends NectaryElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$button, {
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const shadowRoot = this.attachShadow();
|
|
24
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
25
|
-
|
|
26
|
-
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('sinch-button'));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
connectedCallback() {
|
|
30
|
-
this.setAttribute('role', 'button');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static get observedAttributes() {
|
|
34
|
-
return ['text', 'disabled'];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
attributeChangedCallback(name, _, newVal) {
|
|
38
|
-
switch (name) {
|
|
39
|
-
case 'text':
|
|
40
|
-
{
|
|
41
|
-
updateAttribute(_classPrivateFieldGet(this, _$button), 'text', newVal);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
case 'disabled':
|
|
46
|
-
{
|
|
47
|
-
updateAttribute(_classPrivateFieldGet(this, _$button), 'disabled', newVal);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
set text(value) {
|
|
54
|
-
updateAttribute(this, 'text', value);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get text() {
|
|
58
|
-
return getAttribute(this, 'text', '');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
set disabled(isDisabled) {
|
|
62
|
-
updateAttribute(this, 'disabled', isDisabled);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get disabled() {
|
|
66
|
-
return getBooleanAttribute(this, 'disabled');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
focus() {
|
|
70
|
-
_classPrivateFieldGet(this, _$button).focus();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
blur() {
|
|
74
|
-
_classPrivateFieldGet(this, _$button).blur();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}));
|
package/card-button/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export declare type TSinchCardButtonElement = HTMLElement & {
|
|
3
|
-
text: string;
|
|
4
|
-
disabled: boolean;
|
|
5
|
-
setAttribute(name: 'text', value: string): void;
|
|
6
|
-
setAttribute(name: 'disabled', value: ''): void;
|
|
7
|
-
};
|
|
8
|
-
export declare type TSinchCardButtonReact = TSinchElementReact<TSinchCardButtonElement> & {
|
|
9
|
-
text: string;
|
|
10
|
-
'aria-label': string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
};
|
package/card-link/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '../icons/arrow-forward';
|
|
2
|
-
import type { TSinchCardLinkElement, TSinchCardLinkReact } from './types';
|
|
3
|
-
declare global {
|
|
4
|
-
namespace JSX {
|
|
5
|
-
interface IntrinsicElements {
|
|
6
|
-
'sinch-card-link': TSinchCardLinkReact;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface HTMLElementTagNameMap {
|
|
10
|
-
'sinch-card-link': TSinchCardLinkElement;
|
|
11
|
-
}
|
|
12
|
-
}
|
package/card-link/index.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$anchor, _$text, _onClick;
|
|
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
|
-
import '../icons/arrow-forward';
|
|
11
|
-
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, NectaryElement } from '../utils';
|
|
12
|
-
const templateHTML = '<style>:host{display:inline;outline:0}a{display:flex;flex-direction:row;gap:8px;font:var(--sinch-font-emphasized-body);color:var(--sinch-color-tropical-500);text-decoration:none;outline:0;--sinch-color-icon:var(--sinch-color-tropical-500);--sinch-size-icon:24px}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-300);pointer-events:none;cursor:initial;--sinch-color-icon:var(--sinch-color-tropical-300)}span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex-shrink:1}</style><a><span></span><sinch-icon-arrow-forward></sinch-icon-arrow-forward></a>';
|
|
13
|
-
const template = document.createElement('template');
|
|
14
|
-
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-card-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), _onClick = new WeakMap(), class extends NectaryElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
|
|
19
|
-
_classPrivateFieldInitSpec(this, _$anchor, {
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
_classPrivateFieldInitSpec(this, _onClick, {
|
|
30
|
-
writable: true,
|
|
31
|
-
value: e => {
|
|
32
|
-
if (this.disabled) {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
e.stopPropagation();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const shadowRoot = this.attachShadow();
|
|
40
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
41
|
-
|
|
42
|
-
_classPrivateFieldSet(this, _$anchor, shadowRoot.querySelector('a'));
|
|
43
|
-
|
|
44
|
-
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('span'));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
connectedCallback() {
|
|
48
|
-
_classPrivateFieldGet(this, _$anchor).addEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
disconnectedCallback() {
|
|
52
|
-
_classPrivateFieldGet(this, _$anchor).removeEventListener('click', _classPrivateFieldGet(this, _onClick));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get text() {
|
|
56
|
-
return getAttribute(this, 'text', '');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
set text(value) {
|
|
60
|
-
updateAttribute(this, 'text', value);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get href() {
|
|
64
|
-
return getAttribute(this, 'href', '');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
set href(value) {
|
|
68
|
-
updateAttribute(this, 'href', value);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
set disabled(isDisabled) {
|
|
72
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get disabled() {
|
|
76
|
-
return getBooleanAttribute(this, 'disabled');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
set external(isExternal) {
|
|
80
|
-
updateBooleanAttribute(this, 'external', isExternal);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get external() {
|
|
84
|
-
return getBooleanAttribute(this, 'external');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
static get observedAttributes() {
|
|
88
|
-
return ['text', 'href'];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
attributeChangedCallback(name, _, newVal) {
|
|
92
|
-
switch (name) {
|
|
93
|
-
case 'text':
|
|
94
|
-
{
|
|
95
|
-
_classPrivateFieldGet(this, _$text).textContent = newVal;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
case 'href':
|
|
100
|
-
{
|
|
101
|
-
updateAttribute(_classPrivateFieldGet(this, _$anchor), 'href', newVal);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
focus() {
|
|
108
|
-
_classPrivateFieldGet(this, _$anchor).focus();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
blur() {
|
|
112
|
-
_classPrivateFieldGet(this, _$anchor).blur();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}));
|
package/card-link/types.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export declare type TSinchCardLinkElement = HTMLElement & {
|
|
3
|
-
text: string;
|
|
4
|
-
href: string;
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
setAttribute(name: 'text', value: string): void;
|
|
7
|
-
setAttribute(name: 'href', value: string): void;
|
|
8
|
-
setAttribute(name: 'disabled', value: ''): void;
|
|
9
|
-
};
|
|
10
|
-
export declare type TSinchCardLinkReact = TSinchElementReact<TSinchCardLinkElement> & {
|
|
11
|
-
text: string;
|
|
12
|
-
href: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
};
|
package/dropdown/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '../popover';
|
|
2
|
-
import type { TSinchDropdownElement, TSinchDropdownReact } from './types';
|
|
3
|
-
declare global {
|
|
4
|
-
namespace JSX {
|
|
5
|
-
interface IntrinsicElements {
|
|
6
|
-
'sinch-dropdown': TSinchDropdownReact;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface HTMLElementTagNameMap {
|
|
10
|
-
'sinch-dropdown': TSinchDropdownElement;
|
|
11
|
-
}
|
|
12
|
-
}
|