@nectary/components 0.35.0 → 0.36.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/alert/index.d.ts +4 -0
- package/alert/index.js +17 -32
- package/alert/types.d.ts +1 -7
- package/alert/utils.d.ts +3 -0
- package/alert/utils.js +6 -1
- package/button/index.js +2 -2
- package/horizontal-stepper/types.d.ts +4 -0
- package/horizontal-stepper-item/types.d.ts +9 -0
- package/icon-button/index.js +9 -3
- package/inline-alert/index.d.ts +17 -0
- package/inline-alert/index.js +154 -0
- package/inline-alert/types.d.ts +15 -0
- package/inline-alert/utils.d.ts +5 -0
- package/inline-alert/utils.js +6 -0
- package/package.json +1 -1
- package/text/index.js +1 -1
- package/time-picker/index.js +1 -1
- package/vertical-stepper/index.d.ts +13 -0
- package/vertical-stepper/index.js +95 -0
- package/vertical-stepper/types.d.ts +13 -0
- package/vertical-stepper/types.js +1 -0
- package/vertical-stepper-item/index.d.ts +13 -0
- package/vertical-stepper-item/index.js +100 -0
- package/vertical-stepper-item/types.d.ts +24 -0
- package/vertical-stepper-item/utils.d.ts +2 -0
- package/vertical-stepper-item/utils.js +1 -0
- package/alert-button/index.d.ts +0 -11
- package/alert-button/index.js +0 -59
- package/alert-button/types.d.ts +0 -8
- package/alert-close/index.d.ts +0 -12
- package/alert-close/index.js +0 -38
- package/alert-close/types.d.ts +0 -3
- /package/{alert-button → inline-alert}/types.js +0 -0
- /package/{alert-close → vertical-stepper-item}/types.js +0 -0
package/alert/index.d.ts
CHANGED
package/alert/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$text
|
|
4
|
+
var _$text;
|
|
5
5
|
|
|
6
6
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
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
|
|
11
|
-
|
|
12
|
-
import
|
|
10
|
+
import '../icons/report-problem';
|
|
11
|
+
import '../icons/report';
|
|
12
|
+
import '../icons/info';
|
|
13
|
+
import '../text';
|
|
14
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
15
|
+
const templateHTML = '<style>#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:0 16px;box-sizing:border-box;width:100%;height:48px}#text{color:var(--sinch-color-stormy-500);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}#icon-error,#icon-info,#icon-warn{display:none}:host([type=warn]) #wrapper{background-color:var(--sinch-color-warning-200)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}:host([type=info]) #wrapper{background-color:var(--sinch-color-informative-200)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-warning-500)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-error-500)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-informative-500)}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><sinch-text id="text" type="m"></sinch-text><slot name="action"></slot><slot name="close"></slot></div>';
|
|
16
|
+
import { assertType, typeValues } from './utils';
|
|
13
17
|
const template = document.createElement('template');
|
|
14
18
|
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-alert', (_$text = new WeakMap(),
|
|
19
|
+
defineCustomElement('sinch-alert', (_$text = new WeakMap(), class extends NectaryElement {
|
|
16
20
|
constructor() {
|
|
17
21
|
super();
|
|
18
22
|
|
|
@@ -21,17 +25,14 @@ defineCustomElement('sinch-alert', (_$text = new WeakMap(), _$caption = new Weak
|
|
|
21
25
|
value: void 0
|
|
22
26
|
});
|
|
23
27
|
|
|
24
|
-
_classPrivateFieldInitSpec(this, _$caption, {
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
|
|
29
28
|
const shadowRoot = this.attachShadow();
|
|
30
29
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
31
30
|
|
|
32
31
|
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this.setAttribute('role', 'alert');
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
get type() {
|
|
@@ -50,37 +51,21 @@ defineCustomElement('sinch-alert', (_$text = new WeakMap(), _$caption = new Weak
|
|
|
50
51
|
updateAttribute(this, 'text', value);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
get caption() {
|
|
54
|
-
return getAttribute(this, 'caption', '');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
set caption(value) {
|
|
58
|
-
updateAttribute(this, 'caption', value);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get multiline() {
|
|
62
|
-
return getBooleanAttribute(this, 'multiline');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
set multiline(isMultiline) {
|
|
66
|
-
updateBooleanAttribute(this, 'multiline', isMultiline);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
54
|
static get observedAttributes() {
|
|
70
|
-
return ['text', '
|
|
55
|
+
return ['text', 'type'];
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
attributeChangedCallback(name, _, newVal) {
|
|
74
59
|
switch (name) {
|
|
75
|
-
case '
|
|
60
|
+
case 'type':
|
|
76
61
|
{
|
|
77
|
-
|
|
62
|
+
assertType(newVal);
|
|
78
63
|
break;
|
|
79
64
|
}
|
|
80
65
|
|
|
81
|
-
case '
|
|
66
|
+
case 'text':
|
|
82
67
|
{
|
|
83
|
-
_classPrivateFieldGet(this, _$
|
|
68
|
+
_classPrivateFieldGet(this, _$text).textContent = newVal;
|
|
84
69
|
break;
|
|
85
70
|
}
|
|
86
71
|
}
|
package/alert/types.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export declare type TSinchAlertType = 'info' | '
|
|
2
|
+
export declare type TSinchAlertType = 'info' | 'warn' | 'error';
|
|
3
3
|
export declare type TSinchAlertElement = HTMLElement & {
|
|
4
4
|
type: TSinchAlertType;
|
|
5
5
|
text: string;
|
|
6
|
-
caption: string;
|
|
7
|
-
multiline: boolean;
|
|
8
6
|
setAttribute(name: 'type', value: TSinchAlertType): void;
|
|
9
7
|
setAttribute(name: 'text', value: string): void;
|
|
10
|
-
setAttribute(name: 'caption', value: string): void;
|
|
11
|
-
setAttribute(name: 'multiline', value: ''): void;
|
|
12
8
|
};
|
|
13
9
|
export declare type TSinchAlertReact = TSinchElementReact<TSinchAlertElement> & {
|
|
14
10
|
type: TSinchAlertType;
|
|
15
11
|
text: string;
|
|
16
|
-
caption?: string;
|
|
17
|
-
multiline?: boolean;
|
|
18
12
|
};
|
package/alert/utils.d.ts
CHANGED
package/alert/utils.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export const typeValues = ['info', '
|
|
1
|
+
export const typeValues = ['info', 'warn', 'error'];
|
|
2
|
+
export const assertType = value => {
|
|
3
|
+
if (value === null || !typeValues.includes(value)) {
|
|
4
|
+
throw new Error(`sinch-alert: invalid type attribute: ${value}`);
|
|
5
|
+
}
|
|
6
|
+
};
|
package/button/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 { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, isAttrTrue, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, getReactEventHandler } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{--sinch-color-
|
|
11
|
+
const templateHTML = '<style>:host{--sinch-button-color-background:var(--sinch-color-tropical-500);--sinch-button-color-background-hover:var(--sinch-color-tropical-400);--sinch-button-color-background-active:var(--sinch-color-tropical-600);--sinch-button-color-background-disabled:var(--sinch-color-tropical-100);--sinch-button-color-border:var(--sinch-color-transparent);--sinch-button-color-border-disabled:var(--sinch-color-transparent);--sinch-button-color-text:var(--sinch-color-snow-100);--sinch-button-color-text-disabled:var(--sinch-color-snow-100);--sinch-button-shape-radius:var(--sinch-shape-radius-l);display:inline-block;vertical-align:middle;outline:0}#button{--sinch-color-icon:var(--sinch-button-color-text);--sinch-color-spinner-bg:var(--sinch-color-tropical-300);--sinch-color-spinner-fg:var(--sinch-color-snow-100)}#button:disabled{--sinch-color-icon:var(--sinch-button-color-text-disabled);--sinch-color-spinner-bg:var(--sinch-color-snow-100);--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([small]:not([small=false])){--sinch-button-shape-radius:var(--sinch-shape-radius-m)}:host([type=secondary]){--sinch-button-color-background:var(--sinch-color-snow-100);--sinch-button-color-background-hover:var(--sinch-color-tropical-100);--sinch-button-color-background-active:var(--sinch-color-tropical-100);--sinch-button-color-background-disabled:var(--sinch-color-snow-100);--sinch-button-color-border:var(--sinch-color-tropical-500);--sinch-button-color-border-disabled:var(--sinch-color-tropical-200);--sinch-button-color-text:var(--sinch-color-tropical-500);--sinch-button-color-text-disabled:var(--sinch-color-tropical-200)}:host([type=secondary])>#button{--sinch-color-spinner-bg:var(--sinch-color-tropical-500);--sinch-color-spinner-fg:var(--sinch-color-tropical-100)}:host([type=secondary]) #button:enabled:active,:host([type=secondary]) #button:enabled:hover{--sinch-color-spinner-fg:var(--sinch-color-tropical-200)}:host([type=secondary]) #button:disabled{--sinch-color-spinner-bg:var(--sinch-color-tropical-200)}:host([type=cta-primary]){--sinch-button-color-background:var(--sinch-color-honey-500);--sinch-button-color-background-hover:var(--sinch-color-honey-400);--sinch-button-color-background-active:var(--sinch-color-honey-600);--sinch-button-color-background-disabled:var(--sinch-color-honey-200);--sinch-button-color-text:var(--sinch-color-stormy-500);--sinch-button-color-text-disabled:var(--sinch-color-stormy-300)}:host([type=cta-primary])>#button{--sinch-color-spinner-bg:var(--sinch-color-honey-700);--sinch-color-spinner-fg:var(--sinch-color-stormy-500)}:host([type=cta-primary])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-honey-100);--sinch-color-spinner-fg:var(--sinch-color-stormy-300)}:host([type=cta-secondary]){--sinch-button-color-background:transparent;--sinch-button-color-background-hover:var(--sinch-color-snow-500);--sinch-button-color-background-active:var(--sinch-color-snow-500);--sinch-button-color-background-disabled:transparent;--sinch-button-color-text:var(--sinch-color-stormy-500);--sinch-button-color-text-disabled:var(--sinch-color-stormy-100);--sinch-button-color-border:var(--sinch-color-stormy-500);--sinch-button-color-border-disabled:var(--sinch-color-stormy-100)}:host([type=cta-secondary])>#button{--sinch-color-spinner-bg:var(--sinch-color-snow-700);--sinch-color-spinner-fg:var(--sinch-color-stormy-500)}:host([type=cta-secondary])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-snow-500);--sinch-color-spinner-fg:var(--sinch-color-stormy-100)}:host([type=cta-secondary])>#button::before{mix-blend-mode:multiply}:host([type=destructive]){--sinch-button-color-background:var(--sinch-color-snow-100);--sinch-button-color-background-hover:var(--sinch-color-raspberry-100);--sinch-button-color-background-active:var(--sinch-color-raspberry-100);--sinch-button-color-background-disabled:var(--sinch-color-snow-100);--sinch-button-color-text:var(--sinch-color-raspberry-500);--sinch-button-color-text-disabled:var(--sinch-color-raspberry-200);--sinch-button-color-border:var(--sinch-color-raspberry-500);--sinch-button-color-border-disabled:var(--sinch-color-raspberry-200)}:host([type=destructive])>#button{--sinch-color-spinner-bg:var(--sinch-color-raspberry-100);--sinch-color-spinner-fg:var(--sinch-color-raspberry-500)}:host([type=destructive])>#button:enabled:active,:host([type=destructive])>#button:enabled:hover{--sinch-color-spinner-bg:var(--sinch-color-raspberry-200);--sinch-color-spinner-fg:var(--sinch-color-raspberry-500)}:host([type=destructive])>#button:disabled{--sinch-color-spinner-bg:var(--sinch-color-raspberry-100);--sinch-color-spinner-fg:var(--sinch-color-raspberry-200)}#button{all:initial;display:block;position:relative;width:100%;height:48px;font:var(--sinch-font-title-s);color:var(--sinch-button-color-text);cursor:pointer;--sinch-size-icon:24px}#button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-button-color-border);border-radius:var(--sinch-button-shape-radius);background-color:var(--sinch-button-color-background);box-shadow:var(--sinch-elevation-level-1);pointer-events:none}#button:focus-visible::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-button-shape-radius) + 4px);pointer-events:none}@supports not selector(:focus-visible){#button:focus::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-button-shape-radius) + 4px);pointer-events:none}}#button:enabled:hover::before{background-color:var(--sinch-button-color-background-hover)}#button:enabled:active::before{background-color:var(--sinch-button-color-background-active);border-width:2px;box-shadow:var(--sinch-elevation-level-0)}#button:disabled{color:var(--sinch-button-color-text-disabled);cursor:initial}#button:disabled::before{background-color:var(--sinch-button-color-background-disabled);border-color:var(--sinch-button-color-border-disabled)}:host([type=cta-primary])>#button::before,:host([type=primary])>#button::before{border-width:0}#content{position:relative;display:flex;align-items:center;justify-content:center;gap:12px;width:100%;height:100%;padding:0 16px;box-sizing:border-box;pointer-events:none}:host([small]:not([small=false]))>#button{font:var(--sinch-font-title-xs);height:32px;--sinch-size-icon:16px}:host([small]:not([small=false])) #content{padding:0 12px;gap:8px}#text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0}</style><button id="button"><div id="content"><slot name="left-icon"></slot><span id="text"></span><slot name="right-icon"></slot></div></button>';
|
|
12
12
|
import { buttonTypes } from './utils';
|
|
13
13
|
const template = document.createElement('template');
|
|
14
14
|
template.innerHTML = templateHTML;
|
|
@@ -71,7 +71,7 @@ defineCustomElement('sinch-button', (_$button = new WeakMap(), _$text = new Weak
|
|
|
71
71
|
const shadowRoot = this.attachShadow();
|
|
72
72
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
73
73
|
|
|
74
|
-
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
|
|
74
|
+
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('#button'));
|
|
75
75
|
|
|
76
76
|
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
77
77
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchHorizontalStepperElement = HTMLElement & {
|
|
3
|
+
/** Current item index, starting from 1 */
|
|
3
4
|
index: string;
|
|
5
|
+
/** Current item index, starting from 1 */
|
|
4
6
|
setAttribute(name: 'index', value: string): void;
|
|
5
7
|
};
|
|
6
8
|
export declare type TSinchHorizontalStepperReact = TSinchElementReact<TSinchHorizontalStepperElement> & {
|
|
9
|
+
/** Current item index, starting from 1 */
|
|
7
10
|
index: string;
|
|
11
|
+
/** Label that is used for a11y */
|
|
8
12
|
'aria-label': string;
|
|
9
13
|
};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchHorizontalStepperStatusType = 'error' | 'skip';
|
|
3
3
|
export declare type TSinchHorizontalStepperItemElement = HTMLElement & {
|
|
4
|
+
/** Label */
|
|
4
5
|
label: string;
|
|
6
|
+
/** Description */
|
|
5
7
|
description: string | null;
|
|
8
|
+
/** Status */
|
|
6
9
|
status: TSinchHorizontalStepperStatusType | null;
|
|
10
|
+
/** Label */
|
|
7
11
|
setAttribute(name: 'label', value: string): void;
|
|
12
|
+
/** Description */
|
|
8
13
|
setAttribute(name: 'description', value: string): void;
|
|
14
|
+
/** Status */
|
|
9
15
|
setAttribute(name: 'status', value: TSinchHorizontalStepperStatusType): void;
|
|
10
16
|
};
|
|
11
17
|
export declare type TSinchHorizontalStepperItemReact = TSinchElementReact<TSinchHorizontalStepperItemElement> & {
|
|
18
|
+
/** Label */
|
|
12
19
|
label: string;
|
|
20
|
+
/** Description */
|
|
13
21
|
description?: string;
|
|
22
|
+
/** Status */
|
|
14
23
|
status?: TSinchHorizontalStepperStatusType;
|
|
15
24
|
};
|
package/icon-button/index.js
CHANGED
|
@@ -7,8 +7,8 @@ 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, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, 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;
|
|
10
|
+
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:var(--sinch-color-snow-500)}button:enabled:active::before{background-color:var(--sinch-color-snow-600)}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
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), _onButtonClick = new WeakMap(), _onButtonFocus = new WeakMap(), _onButtonBlur = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), _onClickReactHandler = new WeakMap(), class extends NectaryElement {
|
|
@@ -95,7 +95,7 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), _onButtonCli
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
static get observedAttributes() {
|
|
98
|
-
return ['disabled'];
|
|
98
|
+
return ['disabled', 'aria-label'];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -107,6 +107,12 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), _onButtonCli
|
|
|
107
107
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
case 'aria-label':
|
|
112
|
+
{
|
|
113
|
+
updateAttribute(this, 'title', newVal);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '../icons/report-problem';
|
|
2
|
+
import '../icons/report';
|
|
3
|
+
import '../icons/check-circle';
|
|
4
|
+
import '../icons/info';
|
|
5
|
+
import '../title';
|
|
6
|
+
import '../text';
|
|
7
|
+
import type { TSinchInlineAlertElement, TSinchInlineAlertReact } from './types';
|
|
8
|
+
declare global {
|
|
9
|
+
namespace JSX {
|
|
10
|
+
interface IntrinsicElements {
|
|
11
|
+
'sinch-inline-alert': TSinchInlineAlertReact;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'sinch-inline-alert': TSinchInlineAlertElement;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
+
|
|
4
|
+
var _$text, _$caption, _$closeWrapper, _$closeSlot, _$actionWrapper, _$actionSlot, _onCloseSlotChange, _onActionSlotChange;
|
|
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/report-problem';
|
|
11
|
+
import '../icons/report';
|
|
12
|
+
import '../icons/check-circle';
|
|
13
|
+
import '../icons/info';
|
|
14
|
+
import '../title';
|
|
15
|
+
import '../text';
|
|
16
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass } from '../utils';
|
|
17
|
+
const templateHTML = '<style>#wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:16px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-alert-info-background);box-sizing:border-box;width:100%}#body-wrapper{display:flex;flex-direction:column;align-items:flex-start;margin-left:8px;min-width:0;flex:1}#caption{color:var(--sinch-color-stormy-500)}#text{color:var(--sinch-color-stormy-500);margin-top:4px}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}:host([type=success]) #wrapper{background-color:var(--sinch-color-success-200)}:host([type=warn]) #wrapper{background-color:var(--sinch-color-warning-200)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}:host([type=info]) #wrapper{background-color:var(--sinch-color-informative-200)}:host([type=success]) #icon-success{display:block;--sinch-color-icon:var(--sinch-color-success-500)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-warning-500)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-error-500)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-informative-500)}#action{display:flex;margin-top:16px;min-width:0}#action.empty{display:none}#close{margin-left:16px}#close.empty{display:none}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-check-circle id="icon-success"></sinch-icon-check-circle><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><div id="body-wrapper"><sinch-title id="caption" level="3" type="s"></sinch-title><sinch-text id="text" type="m"></sinch-text><div id="action"><slot name="action"></slot></div></div><div id="close"><slot name="close"></slot></div></div>';
|
|
18
|
+
import { assertType, typeValues } from './utils';
|
|
19
|
+
const template = document.createElement('template');
|
|
20
|
+
template.innerHTML = templateHTML;
|
|
21
|
+
defineCustomElement('sinch-inline-alert', (_$text = new WeakMap(), _$caption = new WeakMap(), _$closeWrapper = new WeakMap(), _$closeSlot = new WeakMap(), _$actionWrapper = new WeakMap(), _$actionSlot = new WeakMap(), _onCloseSlotChange = new WeakMap(), _onActionSlotChange = new WeakMap(), class extends NectaryElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
|
|
25
|
+
_classPrivateFieldInitSpec(this, _$text, {
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
_classPrivateFieldInitSpec(this, _$caption, {
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
_classPrivateFieldInitSpec(this, _$closeWrapper, {
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
_classPrivateFieldInitSpec(this, _$closeSlot, {
|
|
41
|
+
writable: true,
|
|
42
|
+
value: void 0
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
_classPrivateFieldInitSpec(this, _$actionWrapper, {
|
|
46
|
+
writable: true,
|
|
47
|
+
value: void 0
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
_classPrivateFieldInitSpec(this, _$actionSlot, {
|
|
51
|
+
writable: true,
|
|
52
|
+
value: void 0
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
_classPrivateFieldInitSpec(this, _onCloseSlotChange, {
|
|
56
|
+
writable: true,
|
|
57
|
+
value: () => {
|
|
58
|
+
setClass(_classPrivateFieldGet(this, _$closeWrapper), 'empty', _classPrivateFieldGet(this, _$closeSlot).assignedElements().length === 0);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
_classPrivateFieldInitSpec(this, _onActionSlotChange, {
|
|
63
|
+
writable: true,
|
|
64
|
+
value: () => {
|
|
65
|
+
setClass(_classPrivateFieldGet(this, _$actionWrapper), 'empty', _classPrivateFieldGet(this, _$actionSlot).assignedElements().length === 0);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const shadowRoot = this.attachShadow();
|
|
70
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
71
|
+
|
|
72
|
+
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
73
|
+
|
|
74
|
+
_classPrivateFieldSet(this, _$caption, shadowRoot.querySelector('#caption'));
|
|
75
|
+
|
|
76
|
+
_classPrivateFieldSet(this, _$closeWrapper, shadowRoot.querySelector('#close'));
|
|
77
|
+
|
|
78
|
+
_classPrivateFieldSet(this, _$closeSlot, shadowRoot.querySelector('slot[name="close"]'));
|
|
79
|
+
|
|
80
|
+
_classPrivateFieldSet(this, _$actionWrapper, shadowRoot.querySelector('#action'));
|
|
81
|
+
|
|
82
|
+
_classPrivateFieldSet(this, _$actionSlot, shadowRoot.querySelector('slot[name="action"]'));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
connectedCallback() {
|
|
86
|
+
this.setAttribute('aria-atomic', 'true');
|
|
87
|
+
this.setAttribute('aria-live', 'polite');
|
|
88
|
+
|
|
89
|
+
_classPrivateFieldGet(this, _$closeSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onCloseSlotChange));
|
|
90
|
+
|
|
91
|
+
_classPrivateFieldGet(this, _$actionSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onActionSlotChange));
|
|
92
|
+
|
|
93
|
+
_classPrivateFieldGet(this, _onCloseSlotChange).call(this);
|
|
94
|
+
|
|
95
|
+
_classPrivateFieldGet(this, _onActionSlotChange).call(this);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
disconnectedCallback() {
|
|
99
|
+
_classPrivateFieldGet(this, _$closeSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onCloseSlotChange));
|
|
100
|
+
|
|
101
|
+
_classPrivateFieldGet(this, _$actionSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onActionSlotChange));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get type() {
|
|
105
|
+
return getLiteralAttribute(this, typeValues, 'type');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
set type(value) {
|
|
109
|
+
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get text() {
|
|
113
|
+
return getAttribute(this, 'text', '');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
set text(value) {
|
|
117
|
+
updateAttribute(this, 'text', value);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get caption() {
|
|
121
|
+
return getAttribute(this, 'caption', '');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
set caption(value) {
|
|
125
|
+
updateAttribute(this, 'caption', value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static get observedAttributes() {
|
|
129
|
+
return ['text', 'caption', 'type'];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
attributeChangedCallback(name, _, newVal) {
|
|
133
|
+
switch (name) {
|
|
134
|
+
case 'type':
|
|
135
|
+
{
|
|
136
|
+
assertType(newVal);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
case 'text':
|
|
141
|
+
{
|
|
142
|
+
_classPrivateFieldGet(this, _$text).textContent = newVal;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
case 'caption':
|
|
147
|
+
{
|
|
148
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export declare type TSinchInlineAlertType = 'info' | 'success' | 'warn' | 'error';
|
|
3
|
+
export declare type TSinchInlineAlertElement = HTMLElement & {
|
|
4
|
+
type: TSinchInlineAlertType;
|
|
5
|
+
text: string;
|
|
6
|
+
caption: string;
|
|
7
|
+
setAttribute(name: 'type', value: TSinchInlineAlertType): void;
|
|
8
|
+
setAttribute(name: 'text', value: string): void;
|
|
9
|
+
setAttribute(name: 'caption', value: string): void;
|
|
10
|
+
};
|
|
11
|
+
export declare type TSinchInlineAlertReact = TSinchElementReact<TSinchInlineAlertElement> & {
|
|
12
|
+
type: TSinchInlineAlertType;
|
|
13
|
+
text: string;
|
|
14
|
+
caption: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TSinchInlineAlertType } from './types';
|
|
2
|
+
export declare const typeValues: readonly TSinchInlineAlertType[];
|
|
3
|
+
declare type TAssertType = (value: string | null) => asserts value is TSinchInlineAlertType;
|
|
4
|
+
export declare const assertType: TAssertType;
|
|
5
|
+
export {};
|
package/package.json
CHANGED
package/text/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../icons/cancel';
|
|
2
2
|
import { defineCustomElement, getBooleanAttribute, updateBooleanAttribute, NectaryElement, getLiteralAttribute, updateLiteralAttribute, isAttrTrue } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:block;font:var(--sinch-font-text-m)}:host([inline]:not([inline=false])){display:inline}:host([
|
|
3
|
+
const templateHTML = '<style>:host{display:block;font:var(--sinch-font-text-m)}:host([inline]:not([inline=false])){display:inline}:host([type="s"]){font:var(--sinch-font-text-s)}:host([type=xs]){font:var(--sinch-font-text-xs)}:host([type=xxs]){font:var(--sinch-font-text-xxs)}:host([emphasized]:not([emphasized=false])){font-weight:var(--sinch-font-weight-emphasized)}</style><slot></slot>';
|
|
4
4
|
import { assertType, typeValues } from './utils';
|
|
5
5
|
const template = document.createElement('template');
|
|
6
6
|
template.innerHTML = templateHTML;
|
package/time-picker/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import '../icons/arrow-drop-down';
|
|
|
18
18
|
import '../segmented-control';
|
|
19
19
|
import '../segmented-control-option';
|
|
20
20
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
21
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#
|
|
21
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;font:var(--sinch-font-text-s);line-height:28px;text-align:center;color:var(--sinch-color-text-default);top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-24{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-minute{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-hour-12:hover,.digit-hour-24:hover,.digit-minute:hover{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected,.digit-hour-24.selected,.digit-minute.selected{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected{font-size:16px}.digit-hour-24.selected{font-size:16px}.digit-minute.selected{font-size:16px}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-color-stormy-500)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-color-tropical-500)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0;--sinch-icon-size:24px}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-hours::before,#header-minutes::before{content:"";display:none;position:absolute;border-radius:12px;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%);padding:1px;border:1px solid var(--sinch-color-aqua-400)}#header-hours-down,#header-hours-up,#header-minutes-down,#header-minutes-up{display:none;position:absolute;left:50%;transform:translateX(-50%)}#header-hours-up,#header-minutes-up{top:-18px}#header-hours-down,#header-minutes-down{bottom:-18px}#header-hours:focus #header-hours-down,#header-hours:focus #header-hours-up,#header-hours:focus::before{display:block}#header-minutes:focus #header-minutes-down,#header-minutes:focus #header-minutes-up,#header-minutes:focus::before{display:block}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-hours-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-hours-down"></sinch-icon-arrow-drop-down></div><div id="header-colon">:</div><div id="header-minutes" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-minutes-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-minutes-down"></sinch-icon-arrow-drop-down></div><sinch-icon-button id="submit" small aria-label="Submit"><sinch-icon-done slot="icon"></sinch-icon-done></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour"></div><div id="needle-minute"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
|
|
22
22
|
import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
|
|
23
23
|
const template = document.createElement('template');
|
|
24
24
|
template.innerHTML = templateHTML;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../icons/check';
|
|
2
|
+
import '../icons/error-outline';
|
|
3
|
+
import type { TSinchVerticalStepperElement, TSinchVerticalStepperReact } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'sinch-vertical-stepper': TSinchVerticalStepperReact;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sinch-vertical-stepper': TSinchVerticalStepperElement;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
import '../icons/check';
|
|
11
|
+
import '../icons/error-outline';
|
|
12
|
+
import { clampNumber, defineCustomElement, getAttribute, getIntegerAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
13
|
+
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
|
+
const template = document.createElement('template');
|
|
15
|
+
template.innerHTML = templateHTML;
|
|
16
|
+
defineCustomElement('sinch-vertical-stepper', (_$itemsSlot = new WeakMap(), _updateItems = new WeakMap(), class extends NectaryElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
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
|
+
const shadowRoot = this.attachShadow();
|
|
52
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
53
|
+
|
|
54
|
+
_classPrivateFieldSet(this, _$itemsSlot, shadowRoot.querySelector('slot'));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
this.setAttribute('role', 'progressbar');
|
|
59
|
+
this.setAttribute('aria-valuemin', '0');
|
|
60
|
+
|
|
61
|
+
_classPrivateFieldGet(this, _$itemsSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateItems));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
_classPrivateFieldGet(this, _$itemsSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _updateItems));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static get observedAttributes() {
|
|
69
|
+
return ['index'];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
73
|
+
if (oldVal === newVal) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
switch (name) {
|
|
78
|
+
case 'index':
|
|
79
|
+
{
|
|
80
|
+
_classPrivateFieldGet(this, _updateItems).call(this);
|
|
81
|
+
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set index(value) {
|
|
88
|
+
updateAttribute(this, 'index', value);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get index() {
|
|
92
|
+
return getAttribute(this, 'index', '1');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export declare type TSinchVerticalStepperElement = HTMLElement & {
|
|
3
|
+
/** Current item index, starting from 1 */
|
|
4
|
+
index: string;
|
|
5
|
+
/** Current item index, starting from 1 */
|
|
6
|
+
setAttribute(name: 'index', value: string): void;
|
|
7
|
+
};
|
|
8
|
+
export declare type TSinchVerticalStepperReact = TSinchElementReact<TSinchVerticalStepperElement> & {
|
|
9
|
+
/** Current item index, starting from 1 */
|
|
10
|
+
index: string;
|
|
11
|
+
/** Label that is used for a11y */
|
|
12
|
+
'aria-label': string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../icons/check';
|
|
2
|
+
import '../icons/exclamation';
|
|
3
|
+
import type { TSinchVerticalStepperItemElement, TSinchVerticalStepperItemReact } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'sinch-vertical-stepper-item': TSinchVerticalStepperItemReact;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sinch-vertical-stepper-item': TSinchVerticalStepperItemElement;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
import '../icons/check';
|
|
11
|
+
import '../icons/exclamation';
|
|
12
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
13
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;width:100%;min-height:68px;display:flex;flex-direction:column}#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-size: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
|
+
import { statusValues } from './utils';
|
|
15
|
+
const template = document.createElement('template');
|
|
16
|
+
template.innerHTML = templateHTML;
|
|
17
|
+
defineCustomElement('sinch-vertical-stepper-item', (_$label = new WeakMap(), _$description = new WeakMap(), _$circleText = new WeakMap(), class extends NectaryElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
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
|
+
const shadowRoot = this.attachShadow();
|
|
37
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
38
|
+
|
|
39
|
+
_classPrivateFieldSet(this, _$label, shadowRoot.querySelector('#label'));
|
|
40
|
+
|
|
41
|
+
_classPrivateFieldSet(this, _$description, shadowRoot.querySelector('#description'));
|
|
42
|
+
|
|
43
|
+
_classPrivateFieldSet(this, _$circleText, shadowRoot.querySelector('#circle-text'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
connectedCallback() {}
|
|
47
|
+
|
|
48
|
+
disconnectedCallback() {}
|
|
49
|
+
|
|
50
|
+
static get observedAttributes() {
|
|
51
|
+
return ['label', 'description', 'data-index'];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
55
|
+
switch (name) {
|
|
56
|
+
case 'label':
|
|
57
|
+
{
|
|
58
|
+
_classPrivateFieldGet(this, _$label).textContent = newVal;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
case 'description':
|
|
63
|
+
{
|
|
64
|
+
_classPrivateFieldGet(this, _$description).textContent = newVal;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
case 'data-index':
|
|
69
|
+
{
|
|
70
|
+
_classPrivateFieldGet(this, _$circleText).textContent = newVal;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
set label(value) {
|
|
77
|
+
updateAttribute(this, 'label', value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get label() {
|
|
81
|
+
return getAttribute(this, 'label', '');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
set description(value) {
|
|
85
|
+
updateAttribute(this, 'description', value);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get description() {
|
|
89
|
+
return getAttribute(this, 'description', '');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get status() {
|
|
93
|
+
return getLiteralAttribute(this, statusValues, 'status', null);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
set status(value) {
|
|
97
|
+
updateLiteralAttribute(this, statusValues, 'status', value);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export declare type TSinchVerticalStepperStatusType = 'error' | 'skip';
|
|
3
|
+
export declare type TSinchVerticalStepperItemElement = HTMLElement & {
|
|
4
|
+
/** Label */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Description */
|
|
7
|
+
description: string | null;
|
|
8
|
+
/** Status */
|
|
9
|
+
status: TSinchVerticalStepperStatusType | null;
|
|
10
|
+
/** Label */
|
|
11
|
+
setAttribute(name: 'label', value: string): void;
|
|
12
|
+
/** Description */
|
|
13
|
+
setAttribute(name: 'description', value: string): void;
|
|
14
|
+
/** Status */
|
|
15
|
+
setAttribute(name: 'status', value: TSinchVerticalStepperStatusType): void;
|
|
16
|
+
};
|
|
17
|
+
export declare type TSinchVerticalStepperItemReact = TSinchElementReact<TSinchVerticalStepperItemElement> & {
|
|
18
|
+
/** Label */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Description */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Status */
|
|
23
|
+
status?: TSinchVerticalStepperStatusType;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const statusValues = ['skip', 'error'];
|
package/alert-button/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TSinchAlertButtonElement, TSinchAlertButtonReact } from './types';
|
|
2
|
-
declare global {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
'sinch-alert-button': TSinchAlertButtonReact;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface HTMLElementTagNameMap {
|
|
9
|
-
'sinch-alert-button': TSinchAlertButtonElement;
|
|
10
|
-
}
|
|
11
|
-
}
|
package/alert-button/index.js
DELETED
|
@@ -1,59 +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, getAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;padding:9px 16px;border:1px solid var(--sinch-color-stormy-500);border-radius:var(--sinch-shape-radius-s);font:var(--sinch-font-body);font-size:14px;line-height:14px;color:var(--sinch-color-stormy-500);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;cursor:pointer;height:32px;box-sizing:border-box}</style><button></button>';
|
|
12
|
-
const template = document.createElement('template');
|
|
13
|
-
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-alert-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('button'));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get text() {
|
|
30
|
-
return getAttribute(this, 'text', '');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
set text(value) {
|
|
34
|
-
updateAttribute(this, 'text', value);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static get observedAttributes() {
|
|
38
|
-
return ['text'];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
attributeChangedCallback(name, _, newVal) {
|
|
42
|
-
switch (name) {
|
|
43
|
-
case 'text':
|
|
44
|
-
{
|
|
45
|
-
_classPrivateFieldGet(this, _$button).textContent = newVal;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
focus() {
|
|
52
|
-
_classPrivateFieldGet(this, _$button).focus();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
blur() {
|
|
56
|
-
_classPrivateFieldGet(this, _$button).blur();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}));
|
package/alert-button/types.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export declare type TSinchAlertButtonElement = HTMLElement & {
|
|
3
|
-
text: string;
|
|
4
|
-
setAttribute(name: 'text', value: string): void;
|
|
5
|
-
};
|
|
6
|
-
export declare type TSinchAlertButtonReact = TSinchElementReact<TSinchAlertButtonElement> & {
|
|
7
|
-
text: string;
|
|
8
|
-
};
|
package/alert-close/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '../icons/close';
|
|
2
|
-
import type { TSinchAlertCloseElement, TSinchAlertCloseReact } from './types';
|
|
3
|
-
declare global {
|
|
4
|
-
namespace JSX {
|
|
5
|
-
interface IntrinsicElements {
|
|
6
|
-
'sinch-alert-close': TSinchAlertCloseReact;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface HTMLElementTagNameMap {
|
|
10
|
-
'sinch-alert-close': TSinchAlertCloseElement;
|
|
11
|
-
}
|
|
12
|
-
}
|
package/alert-close/index.js
DELETED
|
@@ -1,38 +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 '../icons/close';
|
|
11
|
-
import { defineCustomElement, NectaryElement } from '../utils';
|
|
12
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;display:block;width:24px;height:24px;box-sizing:border-box;cursor:pointer;--sinch-size-icon:24px}sinch-icon-close{display:block;pointer-events:none}</style><button aria-label="close"><sinch-icon-close></sinch-icon-close></button>';
|
|
13
|
-
const template = document.createElement('template');
|
|
14
|
-
template.innerHTML = templateHTML;
|
|
15
|
-
defineCustomElement('sinch-alert-close', (_$button = new WeakMap(), class extends NectaryElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
|
|
19
|
-
_classPrivateFieldInitSpec(this, _$button, {
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const shadowRoot = this.attachShadow();
|
|
25
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
26
|
-
|
|
27
|
-
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('button'));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
focus() {
|
|
31
|
-
_classPrivateFieldGet(this, _$button).focus();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
blur() {
|
|
35
|
-
_classPrivateFieldGet(this, _$button).blur();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}));
|
package/alert-close/types.d.ts
DELETED
|
File without changes
|
|
File without changes
|