@nectary/components 0.34.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/accordion/index.js +35 -10
- package/accordion/types.d.ts +3 -2
- package/accordion-item/index.js +8 -4
- package/action-menu/index.js +7 -8
- package/action-menu/types.d.ts +3 -3
- package/action-menu-option/index.js +23 -3
- package/action-menu-option/types.d.ts +2 -0
- 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/avatar/index.js +1 -1
- package/button/index.js +69 -5
- package/button/types.d.ts +6 -0
- package/checkbox/index.js +64 -6
- package/checkbox/types.d.ts +8 -2
- package/date-picker/index.js +37 -12
- package/date-picker/types.d.ts +4 -2
- package/dialog/index.js +5 -6
- package/dialog/types.d.ts +3 -3
- package/dropdown/index.js +44 -28
- package/dropdown/types.d.ts +6 -4
- package/dropdown-checkbox-option/index.js +1 -1
- package/dropdown-checkbox-option/types.d.ts +0 -2
- package/dropdown-radio-option/index.js +1 -1
- package/dropdown-radio-option/types.d.ts +0 -2
- package/dropdown-text-option/index.js +1 -1
- package/dropdown-text-option/types.d.ts +0 -2
- package/horizontal-stepper/types.d.ts +4 -0
- package/horizontal-stepper-item/index.js +1 -1
- package/horizontal-stepper-item/types.d.ts +9 -0
- package/icon-button/index.js +75 -5
- package/icon-button/types.d.ts +6 -0
- package/icons/create-icon-class.js +1 -1
- package/icons-branded/create-icon-class.js +3 -7
- package/icons-branded/types.d.ts +3 -0
- package/icons-channel/create-icon-class.js +3 -7
- package/icons-channel/types.d.ts +3 -0
- 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/input/index.d.ts +0 -1
- package/input/index.js +58 -5
- package/input/types.d.ts +8 -2
- package/link/index.js +81 -3
- package/link/types.d.ts +9 -0
- package/package.json +1 -1
- package/pagination/index.js +24 -8
- package/pagination/types.d.ts +3 -1
- package/popover/index.js +5 -6
- package/popover/types.d.ts +4 -3
- package/radio/index.js +36 -8
- package/radio/types.d.ts +3 -1
- package/radio-option/index.js +1 -1
- package/search/types.d.ts +0 -1
- package/segment-collapse/index.js +28 -12
- package/segment-collapse/types.d.ts +3 -1
- package/segmented-control/index.js +28 -23
- package/segmented-control/types.d.ts +3 -2
- package/segmented-control-option/index.js +59 -13
- package/segmented-control-option/types.d.ts +4 -0
- package/segmented-icon-control/index.js +27 -16
- package/segmented-icon-control/types.d.ts +5 -2
- package/segmented-icon-control-option/index.js +54 -12
- package/segmented-icon-control-option/types.d.ts +4 -0
- package/select/index.js +68 -9
- package/select/types.d.ts +8 -2
- package/tabs/index.js +32 -8
- package/tabs/types.d.ts +3 -2
- package/tabs-option/index.js +2 -2
- package/text/index.js +1 -1
- package/textarea/index.js +58 -4
- package/textarea/types.d.ts +7 -2
- package/tile-control/index.d.ts +11 -0
- package/tile-control/index.js +181 -0
- package/tile-control/types.d.ts +38 -0
- package/tile-control/types.js +1 -0
- package/tile-control-option/index.d.ts +11 -0
- package/tile-control-option/index.js +161 -0
- package/tile-control-option/types.d.ts +37 -0
- package/time-picker/index.js +18 -4
- package/time-picker/types.d.ts +4 -2
- package/toggle/index.js +63 -5
- package/toggle/types.d.ts +3 -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/types.js +1 -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 → tile-control-option}/types.js +0 -0
|
@@ -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, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:4px 10px 4px 6px;align-items:center;gap:6px;user-select:none;cursor:pointer}#text{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-container{position:relative;width:32px;height:32px}#icon-container::before{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-snow-100);border:2px solid var(--sinch-color-stormy-300);transition:background-color .1s linear;box-sizing:border-box}#icon-knob{position:absolute;left:11px;top:11px;width:10px;height:10px;border-radius:50%;transition:opacity .1s linear;opacity:0;background-color:var(--sinch-color-tropical-500);pointer-events:none}:host([checked]
|
|
11
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:4px 10px 4px 6px;align-items:center;gap:6px;user-select:none;cursor:pointer}#text{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-container{position:relative;width:32px;height:32px}#icon-container::before{content:"";position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:50%;pointer-events:none;background-color:var(--sinch-color-snow-100);border:2px solid var(--sinch-color-stormy-300);transition:background-color .1s linear;box-sizing:border-box}#icon-knob{position:absolute;left:11px;top:11px;width:10px;height:10px;border-radius:50%;transition:opacity .1s linear;opacity:0;background-color:var(--sinch-color-tropical-500);pointer-events:none}:host([data-checked]) #icon-container::before{border-color:var(--sinch-color-tropical-500)}:host([data-checked]) #icon-knob{opacity:1}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial}:host([disabled]:not([disabled=false])) #icon-container::before{border-color:var(--sinch-color-stormy-100)}@media (prefers-reduced-motion){#icon-container::before,#icon-knob{transition:none}}</style><div id="wrapper"><div id="icon-container"><div id="icon-knob"></div></div><span id="text"></span></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-dropdown-radio-option', (_$text = new WeakMap(), class extends NectaryElement {
|
|
@@ -2,11 +2,9 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchDropdownRadioOptionElement = HTMLElement & {
|
|
3
3
|
value: string;
|
|
4
4
|
text: string;
|
|
5
|
-
checked: boolean;
|
|
6
5
|
disabled: boolean;
|
|
7
6
|
setAttribute(name: 'value', value: string): void;
|
|
8
7
|
setAttribute(name: 'text', value: string): void;
|
|
9
|
-
setAttribute(name: 'checked', value: ''): void;
|
|
10
8
|
setAttribute(name: 'disabled', value: ''): void;
|
|
11
9
|
};
|
|
12
10
|
export declare type TSinchDropdownRadioOptionReact = TSinchElementReact<TSinchDropdownRadioOptionElement> & {
|
|
@@ -7,7 +7,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
7
7
|
|
|
8
8
|
import '../icons/check';
|
|
9
9
|
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
10
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;--sinch-size-icon:24px}#content{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}#check{display:none;margin-right:-6px}:host([checked]
|
|
10
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;--sinch-size-icon:24px}#content{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}#check{display:none;margin-right:-6px}:host([data-checked]) #check{display:block}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial;--sinch-color-icon:var(--sinch-color-stormy-100)}::slotted(*){margin-left:-6px}</style><div id="wrapper"><slot name="icon"></slot><span id="content"></span><sinch-icon-check id="check"></sinch-icon-check></div>';
|
|
11
11
|
const template = document.createElement('template');
|
|
12
12
|
template.innerHTML = templateHTML;
|
|
13
13
|
|
|
@@ -2,12 +2,10 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchDropdownTextOptionElement = HTMLElement & {
|
|
3
3
|
value: string;
|
|
4
4
|
text: string;
|
|
5
|
-
checked: boolean;
|
|
6
5
|
disabled: boolean;
|
|
7
6
|
readonly icon: Element | null;
|
|
8
7
|
setAttribute(name: 'value', value: string): void;
|
|
9
8
|
setAttribute(name: 'text', value: string): void;
|
|
10
|
-
setAttribute(name: 'checked', value: ''): void;
|
|
11
9
|
setAttribute(name: 'disabled', value: ''): void;
|
|
12
10
|
};
|
|
13
11
|
export declare type TSinchDropdownTextOptionReact = TSinchElementReact<TSinchDropdownTextOptionElement> & {
|
|
@@ -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
|
};
|
|
@@ -10,7 +10,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
10
10
|
import '../icons/check';
|
|
11
11
|
import '../icons/exclamation';
|
|
12
12
|
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-size: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
|
|
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-size: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
14
|
import { statusValues } from './utils';
|
|
15
15
|
const template = document.createElement('template');
|
|
16
16
|
template.innerHTML = templateHTML;
|
|
@@ -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
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$button;
|
|
4
|
+
var _$button, _onButtonClick, _onButtonFocus, _onButtonBlur, _onFocusReactHandler, _onBlurReactHandler, _onClickReactHandler;
|
|
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 { defineCustomElement, getBooleanAttribute, 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
|
-
defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extends NectaryElement {
|
|
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 {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
@@ -20,6 +20,48 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extend
|
|
|
20
20
|
value: void 0
|
|
21
21
|
});
|
|
22
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
|
+
|
|
23
65
|
const shadowRoot = this.attachShadow();
|
|
24
66
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
25
67
|
|
|
@@ -28,10 +70,32 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extend
|
|
|
28
70
|
|
|
29
71
|
connectedCallback() {
|
|
30
72
|
this.setAttribute('role', 'button');
|
|
73
|
+
|
|
74
|
+
_classPrivateFieldGet(this, _$button).addEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
|
|
75
|
+
|
|
76
|
+
_classPrivateFieldGet(this, _$button).addEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
|
|
77
|
+
|
|
78
|
+
_classPrivateFieldGet(this, _$button).addEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
|
|
79
|
+
|
|
80
|
+
this.addEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
81
|
+
this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
82
|
+
this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
disconnectedCallback() {
|
|
86
|
+
_classPrivateFieldGet(this, _$button).removeEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
|
|
87
|
+
|
|
88
|
+
_classPrivateFieldGet(this, _$button).removeEventListener('focus', _classPrivateFieldGet(this, _onButtonFocus));
|
|
89
|
+
|
|
90
|
+
_classPrivateFieldGet(this, _$button).removeEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
|
|
91
|
+
|
|
92
|
+
this.removeEventListener('-click', _classPrivateFieldGet(this, _onClickReactHandler));
|
|
93
|
+
this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
94
|
+
this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
31
95
|
}
|
|
32
96
|
|
|
33
97
|
static get observedAttributes() {
|
|
34
|
-
return ['disabled'];
|
|
98
|
+
return ['disabled', 'aria-label'];
|
|
35
99
|
}
|
|
36
100
|
|
|
37
101
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -43,6 +107,12 @@ defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extend
|
|
|
43
107
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
44
108
|
break;
|
|
45
109
|
}
|
|
110
|
+
|
|
111
|
+
case 'aria-label':
|
|
112
|
+
{
|
|
113
|
+
updateAttribute(this, 'title', newVal);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
46
116
|
}
|
|
47
117
|
}
|
|
48
118
|
|
package/icon-button/types.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchIconButtonElement = HTMLElement & {
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
small: boolean;
|
|
5
|
+
addEventListener(type: '-click', listener: (e: CustomEvent<void>) => void): void;
|
|
6
|
+
addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
|
|
7
|
+
addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
|
|
5
8
|
setAttribute(name: 'disabled', value: ''): void;
|
|
6
9
|
setAttribute(name: 'small', value: ''): void;
|
|
7
10
|
};
|
|
@@ -9,4 +12,7 @@ export declare type TSinchIconButtonReact = TSinchElementReact<TSinchIconButtonE
|
|
|
9
12
|
'aria-label': string;
|
|
10
13
|
disabled?: boolean;
|
|
11
14
|
small?: boolean;
|
|
15
|
+
'on-click'?: (e: CustomEvent<void>) => void;
|
|
16
|
+
'on-focus'?: (e: CustomEvent<void>) => void;
|
|
17
|
+
'on-blur'?: (e: CustomEvent<void>) => void;
|
|
12
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NectaryElement, updateAttribute } from '../utils';
|
|
2
|
-
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-icon,--sinch-color-text-default);height:var(--sinch-size-icon,24px)}</style>';
|
|
2
|
+
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;pointer-events:none;fill:var(--sinch-color-icon,--sinch-color-text-default);height:var(--sinch-size-icon,24px)}</style>';
|
|
3
3
|
export const createIconClass = templateHTML => {
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = iconStylesHtml + templateHTML;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute
|
|
2
|
-
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-stormy-500)}.accent{fill:var(--sinch-color-text-link)}:host([inverted]:not([inverted=false])) svg{fill:var(--sinch-color-snow-100)}:host([inverted]:not([inverted=false])) .accent{fill:var(--sinch-color-honey-500)}</style>';
|
|
1
|
+
import { attrValueToPixels, getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
2
|
+
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;pointer-events:none;fill:var(--sinch-color-stormy-500);height:var(--sinch-size-icon,48px)}.accent{fill:var(--sinch-color-text-link)}:host([inverted]:not([inverted=false])) svg{fill:var(--sinch-color-snow-100)}:host([inverted]:not([inverted=false])) .accent{fill:var(--sinch-color-honey-500)}</style>';
|
|
3
3
|
const DEFAULT_SIZE = 48;
|
|
4
4
|
const MIN_SIZE = 4;
|
|
5
5
|
const MAX_SIZE = 256;
|
|
@@ -36,17 +36,13 @@ export const createIconClass = templateHTML => {
|
|
|
36
36
|
|
|
37
37
|
connectedCallback() {
|
|
38
38
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
39
|
-
|
|
40
|
-
if (!this.hasAttribute('size')) {
|
|
41
|
-
updateAttribute(this, 'size', DEFAULT_SIZE);
|
|
42
|
-
}
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
attributeChangedCallback(name, _, newVal) {
|
|
46
42
|
switch (name) {
|
|
47
43
|
case 'size':
|
|
48
44
|
{
|
|
49
|
-
|
|
45
|
+
this.$svg.style.height = attrValueToPixels(newVal, {
|
|
50
46
|
min: MIN_SIZE,
|
|
51
47
|
max: MAX_SIZE
|
|
52
48
|
});
|
package/icons-branded/types.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchIconBrandedElement = HTMLElement & {
|
|
3
|
+
/** @deprecated */
|
|
3
4
|
size: number;
|
|
4
5
|
inverted: boolean;
|
|
6
|
+
/** @deprecated */
|
|
5
7
|
setAttribute(name: 'size', value: string): void;
|
|
6
8
|
setAttribute(name: 'inverted', value: ''): void;
|
|
7
9
|
};
|
|
8
10
|
export declare type TSinchIconBrandedReact = TSinchElementReact<TSinchIconBrandedElement> & {
|
|
11
|
+
/** @deprecated */
|
|
9
12
|
size?: number;
|
|
10
13
|
inverted?: boolean;
|
|
11
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getIntegerAttribute, NectaryElement, updateAttribute
|
|
2
|
-
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;pointer-events:none}</style>';
|
|
1
|
+
import { attrValueToPixels, getIntegerAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
2
|
+
const iconStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;pointer-events:none;height:var(--sinch-size-icon,48px)}</style>';
|
|
3
3
|
const DEFAULT_SIZE = 48;
|
|
4
4
|
const MIN_SIZE = 4;
|
|
5
5
|
const MAX_SIZE = 256;
|
|
@@ -28,17 +28,13 @@ export const createIconClass = templateHTML => {
|
|
|
28
28
|
|
|
29
29
|
connectedCallback() {
|
|
30
30
|
updateAttribute(this.$svg, 'preserveAspectRatio', 'xMinYMin meet');
|
|
31
|
-
|
|
32
|
-
if (!this.hasAttribute('size')) {
|
|
33
|
-
updateAttribute(this, 'size', DEFAULT_SIZE);
|
|
34
|
-
}
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
attributeChangedCallback(name, _, newVal) {
|
|
38
34
|
switch (name) {
|
|
39
35
|
case 'size':
|
|
40
36
|
{
|
|
41
|
-
|
|
37
|
+
this.$svg.style.height = attrValueToPixels(newVal, {
|
|
42
38
|
min: MIN_SIZE,
|
|
43
39
|
max: MAX_SIZE
|
|
44
40
|
});
|
package/icons-channel/types.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchIconChannelElement = HTMLElement & {
|
|
3
|
+
/** @deprecated */
|
|
3
4
|
size: number;
|
|
5
|
+
/** @deprecated */
|
|
4
6
|
setAttribute(name: 'size', value: string): void;
|
|
5
7
|
};
|
|
6
8
|
export declare type TSinchIconChannelReact = TSinchElementReact<TSinchIconChannelElement> & {
|
|
9
|
+
/** @deprecated */
|
|
7
10
|
size?: number;
|
|
8
11
|
};
|
|
@@ -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/input/index.d.ts
CHANGED