@nectary/components 1.4.0 → 2.0.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 +0 -3
- package/accordion/types.d.ts +0 -3
- package/accordion-item/index.d.ts +2 -0
- package/accordion-item/index.js +33 -34
- package/action-menu-option/index.js +2 -2
- package/alert/index.js +2 -12
- package/avatar/index.js +1 -1
- package/avatar/utils.js +3 -3
- package/badge/index.js +41 -67
- package/badge/types.d.ts +0 -4
- package/badge/utils.d.ts +0 -3
- package/badge/utils.js +0 -11
- package/button/index.js +1 -1
- package/button/types.d.ts +2 -2
- package/card/index.js +5 -16
- package/card/types.d.ts +0 -6
- package/card-container/index.js +1 -1
- package/chat-block/index.js +1 -1
- package/chat-bubble/index.js +3 -24
- package/checkbox/index.js +31 -30
- package/checkbox/types.d.ts +0 -3
- package/chip/index.js +34 -27
- package/chip/utils.js +3 -3
- package/code-tag/index.js +1 -1
- package/color-menu/index.d.ts +0 -3
- package/color-menu/index.js +50 -99
- package/color-menu/types.d.ts +0 -4
- package/color-menu-option/index.d.ts +14 -0
- package/color-menu-option/index.js +52 -0
- package/color-menu-option/types.d.ts +9 -0
- package/color-menu-option/utils.d.ts +1 -0
- package/color-menu-option/utils.js +11 -0
- package/color-swatch/index.js +1 -1
- package/color-swatch/utils.js +3 -3
- package/date-picker/index.js +2 -21
- package/date-picker/types.d.ts +0 -3
- package/dialog/index.js +2 -5
- package/dialog/types.d.ts +0 -2
- package/emoji/index.js +1 -1
- package/emoji-picker/index.d.ts +1 -0
- package/emoji-picker/index.js +32 -23
- package/field/index.js +39 -32
- package/file-drop/index.js +1 -1
- package/file-status/index.js +2 -16
- package/flag/index.js +1 -1
- package/grid/index.js +1 -1
- package/help-tooltip/index.js +3 -12
- package/horizontal-stepper/index.js +1 -1
- package/horizontal-stepper-item/index.d.ts +2 -0
- package/horizontal-stepper-item/index.js +8 -12
- package/icon/index.js +1 -1
- package/icon-button/index.js +1 -1
- package/inline-alert/index.js +19 -29
- package/input/index.d.ts +0 -3
- package/input/index.js +12 -46
- package/input/types.d.ts +1 -5
- package/link/index.js +35 -37
- package/list-item/index.js +1 -1
- package/package.json +10 -9
- package/pagination/index.js +8 -21
- package/pagination/types.d.ts +0 -3
- package/pop/index.js +16 -13
- package/popover/index.js +44 -50
- package/progress/index.js +20 -15
- package/radio/index.js +19 -6
- package/radio/types.d.ts +3 -3
- package/radio-option/index.js +35 -27
- package/rich-text/index.js +1 -1
- package/segment/index.js +2 -3
- package/segment-collapse/index.js +2 -11
- package/segment-collapse/types.d.ts +0 -3
- package/segmented-control/index.js +0 -3
- package/segmented-control/types.d.ts +0 -3
- package/segmented-control-option/index.js +20 -19
- package/segmented-icon-control/index.js +1 -4
- package/segmented-icon-control/types.d.ts +0 -3
- package/segmented-icon-control-option/index.js +18 -14
- package/select-button/index.js +7 -12
- package/select-menu/index.js +12 -5
- package/select-menu-option/index.js +2 -5
- package/skeleton/index.js +1 -1
- package/skeleton-item/index.js +1 -1
- package/spinner/index.js +1 -1
- package/table/index.js +1 -1
- package/table-body/index.js +1 -1
- package/table-cell/index.js +1 -1
- package/table-head-cell/index.d.ts +1 -0
- package/table-head-cell/index.js +12 -3
- package/table-row/index.js +18 -2
- package/tabs/index.js +1 -4
- package/tabs/types.d.ts +0 -3
- package/tabs-icon-option/index.js +4 -2
- package/tabs-option/index.js +25 -20
- package/tag/index.js +16 -8
- package/tag/utils.js +3 -3
- package/text/index.js +30 -20
- package/textarea/index.js +10 -6
- package/textarea/types.d.ts +0 -3
- package/tile-control/index.js +23 -25
- package/tile-control/types.d.ts +0 -3
- package/tile-control-option/index.js +1 -1
- package/time-picker/index.js +2 -8
- package/time-picker/types.d.ts +0 -3
- package/title/index.js +30 -22
- package/toast/index.js +20 -30
- package/toggle/index.js +33 -30
- package/toggle/types.d.ts +0 -3
- package/tooltip/index.js +2 -8
- package/tooltip/types.d.ts +0 -12
- package/vertical-stepper/index.js +1 -1
- package/vertical-stepper-item/index.d.ts +2 -0
- package/vertical-stepper-item/index.js +8 -12
- package/logo/create-logo-class.d.ts +0 -1
- package/logo/create-logo-class.js +0 -52
- package/logo/engage-icon/index.d.ts +0 -11
- package/logo/engage-icon/index.js +0 -4
- package/logo/engage-icon-wordmark/index.d.ts +0 -11
- package/logo/engage-icon-wordmark/index.js +0 -4
- package/logo/sinch-icon/index.d.ts +0 -11
- package/logo/sinch-icon/index.js +0 -4
- package/logo/sinch-icon-wordmark/index.d.ts +0 -11
- package/logo/sinch-icon-wordmark/index.js +0 -4
- package/logo/types.d.ts +0 -11
- package/theme/accordion-item.css +0 -4
- package/theme/alert.css +0 -6
- package/theme/avatar.css +0 -25
- package/theme/badge.css +0 -15
- package/theme/button.css +0 -146
- package/theme/chat.css +0 -9
- package/theme/chip.css +0 -68
- package/theme/color-menu.css +0 -4
- package/theme/color-swatch.css +0 -71
- package/theme/colors.d.ts +0 -4
- package/theme/colors.js +0 -4
- package/theme/contextual.css +0 -40
- package/theme/date-picker.css +0 -7
- package/theme/dialog.css +0 -4
- package/theme/elevation.css +0 -7
- package/theme/emoji-picker.css +0 -13
- package/theme/emoji.css +0 -5
- package/theme/file-status.css +0 -7
- package/theme/flag.css +0 -4
- package/theme/fonts.css +0 -86
- package/theme/fonts.json +0 -89
- package/theme/help-tooltip.css +0 -5
- package/theme/horizontal-stepper.css +0 -5
- package/theme/icon-button.css +0 -68
- package/theme/icon.css +0 -7
- package/theme/index.css +0 -4
- package/theme/index.d.ts +0 -39
- package/theme/index.js +0 -39
- package/theme/inline-alert.css +0 -7
- package/theme/input.css +0 -10
- package/theme/link.css +0 -5
- package/theme/pagination.css +0 -5
- package/theme/palette.css +0 -90
- package/theme/segment.css +0 -4
- package/theme/select-button.css +0 -10
- package/theme/select-menu.css +0 -6
- package/theme/shapes.css +0 -8
- package/theme/size.css +0 -9
- package/theme/spinner.css +0 -7
- package/theme/tag.css +0 -67
- package/theme/time-picker.css +0 -4
- package/theme/toast.css +0 -7
- package/theme/typography.css +0 -16
- package/theme/vertical-stepper.css +0 -5
- /package/{logo → color-menu-option}/types.js +0 -0
package/time-picker/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import '../icon-button';
|
|
|
2
2
|
import '../icon';
|
|
3
3
|
import '../segmented-control';
|
|
4
4
|
import '../segmented-control-option';
|
|
5
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute,
|
|
6
|
-
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-
|
|
5
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
6
|
+
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-comp-time-picker-header-font);line-height:48px;user-select:none;color:var(--sinch-comp-time-picker-header-color-default-text-initial)}#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-comp-time-picker-watch-face-color-default-border-initial);background-color:var(--sinch-comp-time-picker-watch-face-color-default-background-initial)}#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;text-align:center;top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-12{font:var(--sinch-comp-time-picker-digit-font-default-h12);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-h12-initial)}.digit-hour-12.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h12);color:var(--sinch-comp-time-picker-digit-color-checked-h12-default)}.digit-hour-24{font:var(--sinch-comp-time-picker-digit-font-default-h24);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-h24-initial)}.digit-hour-24.selected{font:var(--sinch-comp-time-picker-digit-font-checked-h24);color:var(--sinch-comp-time-picker-digit-color-checked-h24-initial)}.digit-minute{font:var(--sinch-comp-time-picker-digit-font-default-h12);line-height:28px;color:var(--sinch-comp-time-picker-digit-color-default-minute-initial)}.digit-minute.selected{color:var(--sinch-comp-time-picker-digit-color-checked-minute-initial)}#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-comp-time-picker-needle-color-default-background-initial)}#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;outline:0}@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-hour:focus-visible,#needle-minute:focus-visible{background-color:var(--sinch-comp-time-picker-needle-color-default-background-focus)}#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-comp-time-picker-digit-color-checked-minute-initial)}#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}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}#submit-icon{--sinch-global-color-icon:var(--sinch-comp-time-picker-header-color-default-icon-initial)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><div id="header-colon">:</div><div id="header-minutes" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span></div><sinch-icon-button id="submit" size="s" aria-label="Submit"><sinch-icon id="icon-submit" slot="icon" name="done"></sinch-icon></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" tabindex="0"></div><div id="needle-minute" tabindex="0"></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>';
|
|
7
7
|
import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
|
|
8
8
|
const template = document.createElement('template');
|
|
9
9
|
template.innerHTML = templateHTML;
|
|
@@ -29,7 +29,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
29
29
|
#$headerMinutesText;
|
|
30
30
|
#$ampm;
|
|
31
31
|
#$submitButton;
|
|
32
|
-
#$iconSubmit;
|
|
33
32
|
#hour = 0;
|
|
34
33
|
#minute = 0;
|
|
35
34
|
#controller = null;
|
|
@@ -48,7 +47,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
48
47
|
this.#$headerMinutesText = shadowRoot.querySelector('#header-minutes > span');
|
|
49
48
|
this.#$ampm = shadowRoot.querySelector('#ampm');
|
|
50
49
|
this.#$submitButton = shadowRoot.querySelector('#submit');
|
|
51
|
-
this.#$iconSubmit = shadowRoot.querySelector('#icon-submit');
|
|
52
50
|
this.#$needleMinute.style.height = `${NEEDLE_MINUTE_LENGTH}px`;
|
|
53
51
|
this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
|
|
54
52
|
const MINUTE_DIGIT_RADIUS = MINUTE_RADIUS + MINUTE_DIGIT_SIZE / 2;
|
|
@@ -104,7 +102,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
104
102
|
this.#$needleHour.addEventListener('keydown', this.#onHoursKeydown, options);
|
|
105
103
|
this.#$needleMinute.addEventListener('keydown', this.#onMinutesKeydown, options);
|
|
106
104
|
this.addEventListener('-change', this.#onChangeReactHandler, options);
|
|
107
|
-
updateAttribute(this.#$iconSubmit, 'name', getCssVar(this, '--sinch-time-picker-icon-submit'));
|
|
108
105
|
}
|
|
109
106
|
disconnectedCallback() {
|
|
110
107
|
this.#controller.abort();
|
|
@@ -145,9 +142,6 @@ defineCustomElement('sinch-time-picker', class extends NectaryElement {
|
|
|
145
142
|
}
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
|
-
get nodeName() {
|
|
149
|
-
return 'select';
|
|
150
|
-
}
|
|
151
145
|
set value(value) {
|
|
152
146
|
updateAttribute(this, 'value', value);
|
|
153
147
|
}
|
package/time-picker/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
-
import type { SyntheticEvent } from 'react';
|
|
3
2
|
export type TSinchTimePickerElement = HTMLElement & {
|
|
4
3
|
/** Time value in ISO 8601 format */
|
|
5
4
|
value: string;
|
|
@@ -30,8 +29,6 @@ export type TSinchTimePickerReact = TSinchElementReact<TSinchTimePickerElement>
|
|
|
30
29
|
'aria-label': string;
|
|
31
30
|
/** Submit button label that is used for a11y */
|
|
32
31
|
'submit-aria-label': string;
|
|
33
|
-
/** @deprecated Change value handler, return time in ISO 8601 format */
|
|
34
|
-
onChange?: (e: SyntheticEvent<TSinchTimePickerElement, CustomEvent<string>>) => void;
|
|
35
32
|
/** Change value handler, return time in ISO 8601 format */
|
|
36
33
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
37
34
|
};
|
package/title/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement, updateBooleanAttribute, getBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block
|
|
1
|
+
import { defineCustomElement, getAttribute, updateAttribute, updateLiteralAttribute, getLiteralAttribute, NectaryElement, updateBooleanAttribute, getBooleanAttribute, isAttrTrue } from '../utils';
|
|
2
|
+
const templateHTML = '<style>:host{display:block;--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-m)}:host([type=xl]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-xl)}:host([type="l"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-l)}:host([type="m"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-m)}:host([type="s"]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-s)}:host([type=xs]){--sinch-comp-title-font:var(--sinch-sys-font-desktop-title-xs)}#text{letter-spacing:-2%;color:var(--sinch-global-color-text,var(--sinch-sys-color-text-default));font:var(--sinch-comp-title-font)}:host([ellipsis]) #text{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}</style><span id="text"></span>';
|
|
3
3
|
import { assertLevel, assertType, typeValues } from './utils';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
@@ -14,28 +14,13 @@ defineCustomElement('sinch-title', class extends NectaryElement {
|
|
|
14
14
|
connectedCallback() {
|
|
15
15
|
this.setAttribute('role', 'heading');
|
|
16
16
|
}
|
|
17
|
-
get text() {
|
|
18
|
-
return getAttribute(this, 'text', '');
|
|
19
|
-
}
|
|
20
|
-
set text(value) {
|
|
21
|
-
updateAttribute(this, 'text', value);
|
|
22
|
-
}
|
|
23
|
-
set type(value) {
|
|
24
|
-
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
25
|
-
}
|
|
26
|
-
get type() {
|
|
27
|
-
return getLiteralAttribute(this, typeValues, 'type');
|
|
28
|
-
}
|
|
29
|
-
set ellipsis(isEllipsis) {
|
|
30
|
-
updateBooleanAttribute(this, 'ellipsis', isEllipsis);
|
|
31
|
-
}
|
|
32
|
-
get ellipsis() {
|
|
33
|
-
return getBooleanAttribute(this, 'ellipsis');
|
|
34
|
-
}
|
|
35
17
|
static get observedAttributes() {
|
|
36
|
-
return ['text', 'type', 'level'];
|
|
18
|
+
return ['text', 'type', 'level', 'ellipsis'];
|
|
37
19
|
}
|
|
38
|
-
attributeChangedCallback(name,
|
|
20
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
21
|
+
if (oldVal === newVal) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
39
24
|
switch (name) {
|
|
40
25
|
case 'text':
|
|
41
26
|
{
|
|
@@ -57,6 +42,29 @@ defineCustomElement('sinch-title', class extends NectaryElement {
|
|
|
57
42
|
}
|
|
58
43
|
break;
|
|
59
44
|
}
|
|
45
|
+
case 'ellipsis':
|
|
46
|
+
{
|
|
47
|
+
updateBooleanAttribute(this, 'ellipsis', isAttrTrue(newVal));
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
60
50
|
}
|
|
61
51
|
}
|
|
52
|
+
get text() {
|
|
53
|
+
return getAttribute(this, 'text', '');
|
|
54
|
+
}
|
|
55
|
+
set text(value) {
|
|
56
|
+
updateAttribute(this, 'text', value);
|
|
57
|
+
}
|
|
58
|
+
set type(value) {
|
|
59
|
+
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
60
|
+
}
|
|
61
|
+
get type() {
|
|
62
|
+
return getLiteralAttribute(this, typeValues, 'type');
|
|
63
|
+
}
|
|
64
|
+
set ellipsis(isEllipsis) {
|
|
65
|
+
updateBooleanAttribute(this, 'ellipsis', isEllipsis);
|
|
66
|
+
}
|
|
67
|
+
get ellipsis() {
|
|
68
|
+
return getBooleanAttribute(this, 'ellipsis');
|
|
69
|
+
}
|
|
62
70
|
});
|
package/toast/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import '../icon';
|
|
2
2
|
import '../title';
|
|
3
3
|
import '../text';
|
|
4
|
-
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, getReactEventHandler, getBooleanAttribute, updateBooleanAttribute
|
|
5
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:center;gap:8px;width:328px;padding:8px 16px;box-sizing:border-box;border-radius:var(--sinch-shape-radius
|
|
4
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, getReactEventHandler, getBooleanAttribute, updateBooleanAttribute } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;align-items:center;gap:8px;width:328px;padding:8px 16px;box-sizing:border-box;border-radius:var(--sinch-comp-toast-shape-radius);box-shadow:var(--sinch-comp-toast-shadow)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-toast-color-success-default-background)}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-toast-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-toast-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-toast-color-info-default-background)}#text{padding:4px 0 4px 4px;flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-toast-font-body)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-toast-color-success-default-text)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-toast-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-toast-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-toast-color-info-default-text)}#icon{align-self:flex-start;margin:4px 0}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-success{--sinch-global-color-icon:var(--sinch-comp-toast-color-success-default-icon)}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-toast-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-toast-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-toast-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}</style><div id="wrapper"><sinch-icon id="icon-info" name="info"></sinch-icon><sinch-icon id="icon-success" name="check_circle"></sinch-icon><sinch-icon id="icon-warn" name="report_problem"></sinch-icon><sinch-icon id="icon-error" name="report"></sinch-icon><sinch-text id="text" type="m"></sinch-text><slot name="action"></slot><slot name="close"></slot></div>';
|
|
6
6
|
import { assertType, typeValues } from './utils';
|
|
7
7
|
const TIMEOUT = 5000;
|
|
8
8
|
const template = document.createElement('template');
|
|
9
9
|
template.innerHTML = templateHTML;
|
|
10
10
|
defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
11
|
-
#$icon;
|
|
12
11
|
#$text;
|
|
13
12
|
#tid = null;
|
|
14
13
|
constructor() {
|
|
@@ -16,7 +15,6 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
|
16
15
|
const shadowRoot = this.attachShadow();
|
|
17
16
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
18
17
|
this.#$text = shadowRoot.querySelector('#text');
|
|
19
|
-
this.#$icon = shadowRoot.querySelector('#icon');
|
|
20
18
|
}
|
|
21
19
|
connectedCallback() {
|
|
22
20
|
super.connectedCallback();
|
|
@@ -24,31 +22,12 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
|
24
22
|
this.setAttribute('aria-live', 'polite');
|
|
25
23
|
this.addEventListener('-timeout', this.#onTimeoutReactHandler);
|
|
26
24
|
this.#updateTimeout();
|
|
27
|
-
this.#updateIcon();
|
|
28
25
|
}
|
|
29
26
|
disconnectedCallback() {
|
|
30
27
|
super.disconnectedCallback();
|
|
31
28
|
this.removeEventListener('-timeout', this.#onTimeoutReactHandler);
|
|
32
29
|
this.#clearTimeout();
|
|
33
30
|
}
|
|
34
|
-
get type() {
|
|
35
|
-
return getLiteralAttribute(this, typeValues, 'type');
|
|
36
|
-
}
|
|
37
|
-
set type(value) {
|
|
38
|
-
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
39
|
-
}
|
|
40
|
-
get text() {
|
|
41
|
-
return getAttribute(this, 'text', '');
|
|
42
|
-
}
|
|
43
|
-
set text(value) {
|
|
44
|
-
updateAttribute(this, 'text', value);
|
|
45
|
-
}
|
|
46
|
-
get persistent() {
|
|
47
|
-
return getBooleanAttribute(this, 'persistent');
|
|
48
|
-
}
|
|
49
|
-
set persistent(isPersistent) {
|
|
50
|
-
updateBooleanAttribute(this, 'persistent', isPersistent);
|
|
51
|
-
}
|
|
52
31
|
static get observedAttributes() {
|
|
53
32
|
return ['text', 'type', 'persistent'];
|
|
54
33
|
}
|
|
@@ -62,7 +41,6 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
|
62
41
|
if ('production' !== 'production') {
|
|
63
42
|
assertType(newVal);
|
|
64
43
|
}
|
|
65
|
-
this.#updateIcon();
|
|
66
44
|
break;
|
|
67
45
|
}
|
|
68
46
|
case 'text':
|
|
@@ -77,6 +55,24 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
|
77
55
|
}
|
|
78
56
|
}
|
|
79
57
|
}
|
|
58
|
+
get type() {
|
|
59
|
+
return getLiteralAttribute(this, typeValues, 'type');
|
|
60
|
+
}
|
|
61
|
+
set type(value) {
|
|
62
|
+
updateLiteralAttribute(this, typeValues, 'type', value);
|
|
63
|
+
}
|
|
64
|
+
get text() {
|
|
65
|
+
return getAttribute(this, 'text', '');
|
|
66
|
+
}
|
|
67
|
+
set text(value) {
|
|
68
|
+
updateAttribute(this, 'text', value);
|
|
69
|
+
}
|
|
70
|
+
get persistent() {
|
|
71
|
+
return getBooleanAttribute(this, 'persistent');
|
|
72
|
+
}
|
|
73
|
+
set persistent(isPersistent) {
|
|
74
|
+
updateBooleanAttribute(this, 'persistent', isPersistent);
|
|
75
|
+
}
|
|
80
76
|
#updateTimeout() {
|
|
81
77
|
if (this.persistent) {
|
|
82
78
|
this.#clearTimeout();
|
|
@@ -86,12 +82,6 @@ defineCustomElement('sinch-toast', class extends NectaryElement {
|
|
|
86
82
|
this.#tid = window.setTimeout(this.#onTimeout, TIMEOUT);
|
|
87
83
|
}
|
|
88
84
|
}
|
|
89
|
-
#updateIcon() {
|
|
90
|
-
if (!this.isConnected) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
updateAttribute(this.#$icon, 'name', getCssVar(this, `--sinch-toast-icon-${this.type}`));
|
|
94
|
-
}
|
|
95
85
|
#onTimeout = () => {
|
|
96
86
|
this.dispatchEvent(new CustomEvent('-timeout'));
|
|
97
87
|
};
|
package/toggle/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;width:100%;height:
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;width:100%;height:var(--sinch-local-size);--sinch-local-size:24px}:host([small]) #wrapper{--sinch-local-size:22px}#input{all:initial;display:block;position:absolute;left:0;top:2px;width:40px;height:20px;cursor:pointer;pointer-events:initial}#input:disabled{cursor:initial}#input:focus-visible::after{position:absolute;content:"";left:-4px;top:-4px;right:-4px;bottom:-4px;border:2px solid var(--sinch-comp-toggle-color-default-outline-focus);border-radius:18px;pointer-events:none}:host([small]) #input{width:32px;height:16px;top:3px}#knob-container{position:relative;box-sizing:border-box;width:40px;height:20px;border-radius:10px;pointer-events:none;padding:2px;background-color:var(--sinch-comp-toggle-color-default-background-initial);overflow:hidden}:host([small]) #knob-container{width:32px;height:16px;border-radius:8px}#input:checked~#knob-container{background-color:var(--sinch-comp-toggle-color-checked-background-initial)}#input:disabled~#knob-container{background-color:var(--sinch-comp-toggle-color-disabled-background-initial)}#input:checked:disabled~#knob-container{background-color:var(--sinch-comp-toggle-color-checked-disabled-background-initial)}#knob{position:relative;box-sizing:border-box;width:16px;height:16px;border-radius:50%;background-color:var(--sinch-comp-toggle-color-default-knob-background-initial);box-shadow:var(--sinch-comp-toggle-shadow-knob-default);transform:translateX(0);transition:transform .1s ease-in-out;will-change:transform}:host([small]) #knob{width:12px;height:12px}#input:disabled+#knob-container>#knob{box-shadow:var(--sinch-comp-toggle-shadow-knob-disabled)}#input:checked+#knob-container>#knob{transform:translateX(20px)}:host([small]) #input:checked+#knob-container>#knob{transform:translateX(16px)}#knob::after,#knob::before{font:var(--sinch-comp-toggle-font-size-m-inside-text);color:var(--sinch-comp-toggle-color-default-text-inside-initial);text-transform:uppercase;font-size:8px;line-height:16px;display:none;position:absolute;top:0;padding:0 3px}#knob::before{content:"on";right:100%}#knob::after{content:"off";left:100%}:host([labeled]:not([small])) #knob::after,:host([labeled]:not([small])) #knob::before{display:block}@media (prefers-reduced-motion){#knob{transition:none}}#label{flex:1;align-self:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:8px;font:var(--sinch-comp-toggle-font-size-m-label);color:var(--sinch-comp-toggle-color-default-label-initial)}#label:empty{display:none}:host([small]) #label{font:var(--sinch-comp-toggle-font-size-s-label)}#input:disabled~#label{color:var(--sinch-comp-toggle-color-disabled-label-initial)}</style><div id="wrapper"><input id="input" type="checkbox"><div id="knob-container"><div id="knob"></div></div><label id="label" for="input"></label></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-toggle', class extends NectaryElement {
|
|
@@ -30,13 +30,39 @@ defineCustomElement('sinch-toggle', class extends NectaryElement {
|
|
|
30
30
|
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
31
31
|
}
|
|
32
32
|
static get observedAttributes() {
|
|
33
|
-
return ['checked', 'disabled', 'text'];
|
|
33
|
+
return ['checked', 'disabled', 'text', 'labeled', 'small'];
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
36
|
+
if (oldVal === newVal) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
switch (name) {
|
|
40
|
+
case 'text':
|
|
41
|
+
{
|
|
42
|
+
this.#$label.textContent = newVal;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case 'checked':
|
|
46
|
+
{
|
|
47
|
+
const isChecked = isAttrTrue(newVal);
|
|
48
|
+
this.#$input.checked = isChecked;
|
|
49
|
+
updateExplicitBooleanAttribute(this, 'aria-checked', isChecked);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case 'disabled':
|
|
53
|
+
{
|
|
54
|
+
const isDisabled = isAttrTrue(newVal);
|
|
55
|
+
this.#$input.disabled = isDisabled;
|
|
56
|
+
updateBooleanAttribute(this, name, isDisabled);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case 'small':
|
|
60
|
+
case 'labeled':
|
|
61
|
+
{
|
|
62
|
+
updateBooleanAttribute(this, name, isAttrTrue(newVal));
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
40
66
|
}
|
|
41
67
|
set checked(isChecked) {
|
|
42
68
|
updateBooleanAttribute(this, 'checked', isChecked);
|
|
@@ -68,29 +94,6 @@ defineCustomElement('sinch-toggle', class extends NectaryElement {
|
|
|
68
94
|
get text() {
|
|
69
95
|
return getAttribute(this, 'text');
|
|
70
96
|
}
|
|
71
|
-
attributeChangedCallback(name, _, newVal) {
|
|
72
|
-
switch (name) {
|
|
73
|
-
case 'text':
|
|
74
|
-
{
|
|
75
|
-
this.#$label.textContent = newVal;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case 'checked':
|
|
79
|
-
{
|
|
80
|
-
const isChecked = isAttrTrue(newVal);
|
|
81
|
-
this.#$input.checked = isChecked;
|
|
82
|
-
updateExplicitBooleanAttribute(this, 'aria-checked', isChecked);
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'disabled':
|
|
86
|
-
{
|
|
87
|
-
const isDisabled = isAttrTrue(newVal);
|
|
88
|
-
this.#$input.disabled = isDisabled;
|
|
89
|
-
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
97
|
get focusable() {
|
|
95
98
|
return true;
|
|
96
99
|
}
|
package/toggle/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
import type { SyntheticEvent } from 'react';
|
|
3
2
|
export type TSinchToggleElement = HTMLElement & {
|
|
4
3
|
checked: boolean;
|
|
5
4
|
small: boolean;
|
|
@@ -21,7 +20,5 @@ export type TSinchToggleReact = TSinchElementReact<TSinchToggleElement> & {
|
|
|
21
20
|
disabled?: boolean;
|
|
22
21
|
text?: string;
|
|
23
22
|
'aria-label': string;
|
|
24
|
-
/** @deprecated */
|
|
25
|
-
onChange?: (e: SyntheticEvent<TSinchToggleElement, CustomEvent<boolean>>) => void;
|
|
26
23
|
'on-change'?: (e: CustomEvent<boolean>) => void;
|
|
27
24
|
};
|
package/tooltip/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import '../pop';
|
|
3
|
-
import { defineCustomElement,
|
|
4
|
-
const templateHTML = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px
|
|
3
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass, rectOverlap, getReactEventHandler, shouldReduceMotion } from '../utils';
|
|
4
|
+
const templateHTML = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px;filter:drop-shadow(var(--sinch-comp-tooltip-shadow))}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;background-color:var(--sinch-local-color-background);border-radius:var(--sinch-comp-tooltip-shape-radius);pointer-events:none;opacity:0;--sinch-local-color-background:var(--sinch-comp-tooltip-color-background);--sinch-global-color-text:var(--sinch-comp-tooltip-color-text)}#text{word-break:break-word;pointer-events:none;--sinch-comp-text-font:var(--sinch-comp-tooltip-font-body)}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-local-color-background);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}</style><sinch-pop id="pop"><slot id="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><sinch-text id="text" type="s"></sinch-text><svg id="tip" width="8" height="4" aria-hidden="true"><path d="m4 4 4-4h-8l4 4Z"/></svg></div></div></sinch-pop>';
|
|
5
5
|
import { TooltipState } from './tooltip-state';
|
|
6
6
|
import { assertOrientation, assertType, getPopOrientation, orientationValues, typeValues } from './utils';
|
|
7
7
|
const TIP_SIZE = 8;
|
|
@@ -101,12 +101,6 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
101
101
|
set text(value) {
|
|
102
102
|
updateAttribute(this, 'text', value);
|
|
103
103
|
}
|
|
104
|
-
get inverted() {
|
|
105
|
-
return getBooleanAttribute(this, 'inverted');
|
|
106
|
-
}
|
|
107
|
-
set inverted(isInverted) {
|
|
108
|
-
updateBooleanAttribute(this, 'inverted', isInverted);
|
|
109
|
-
}
|
|
110
104
|
get orientation() {
|
|
111
105
|
return getLiteralAttribute(this, orientationValues, 'orientation', 'top');
|
|
112
106
|
}
|
package/tooltip/types.d.ts
CHANGED
|
@@ -4,10 +4,6 @@ export type TSinchTooltipType = 'slow' | 'fast';
|
|
|
4
4
|
export type TSinchTooltipElement = HTMLElement & {
|
|
5
5
|
/** Text */
|
|
6
6
|
text: string;
|
|
7
|
-
/** @deprecated */
|
|
8
|
-
width: number | null;
|
|
9
|
-
/** Inverted */
|
|
10
|
-
inverted: boolean;
|
|
11
7
|
/** Orientation, where it *points to* from origin */
|
|
12
8
|
orientation: TSinchTooltipOrientation;
|
|
13
9
|
/** Type */
|
|
@@ -20,10 +16,6 @@ export type TSinchTooltipElement = HTMLElement & {
|
|
|
20
16
|
addEventListener(type: '-hide', listener: (e: CustomEvent<void>) => void): void;
|
|
21
17
|
/** Text */
|
|
22
18
|
setAttribute(name: 'text', value: string): void;
|
|
23
|
-
/** @deprecated */
|
|
24
|
-
setAttribute(name: 'width', value: string): void;
|
|
25
|
-
/** Inverted */
|
|
26
|
-
setAttribute(name: 'inverted', value: ''): void;
|
|
27
19
|
/** Orientation, where it *points to* from origin */
|
|
28
20
|
setAttribute(name: 'orientation', value: TSinchTooltipOrientation): void;
|
|
29
21
|
/** Type */
|
|
@@ -32,10 +24,6 @@ export type TSinchTooltipElement = HTMLElement & {
|
|
|
32
24
|
export type TSinchTooltipReact = TSinchElementReact<TSinchTooltipElement> & {
|
|
33
25
|
/** Text */
|
|
34
26
|
text: string;
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
width?: number;
|
|
37
|
-
/** Inverted */
|
|
38
|
-
inverted?: boolean;
|
|
39
27
|
/** Orientation, where it *points to* from origin */
|
|
40
28
|
orientation?: TSinchTooltipOrientation;
|
|
41
29
|
/** Type */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clampNumber, defineCustomElement, getAttribute, getIntegerAttribute, NectaryElement, updateAttribute } from '../utils';
|
|
2
|
-
const templateHTML = '<style>:host{display:block;outline:0
|
|
2
|
+
const templateHTML = '<style>:host{display:block;outline:0;--sinch-comp-vertical-stepper-color-background-default:var(--sinch-sys-color-container-contrast-primary-default);--sinch-comp-vertical-stepper-color-background-visited-skip:var(--sinch-sys-color-container-contrast-primary-default);--sinch-comp-vertical-stepper-color-background-active:var(--sinch-ref-color-main-stormy-400);--sinch-comp-vertical-stepper-color-background-visited:var(--sinch-ref-color-main-snow-700);--sinch-comp-vertical-stepper-color-background-visited-error:var(--sinch-sys-color-feedback-invalid-background);--sinch-comp-vertical-stepper-color-border-default:transparent;--sinch-comp-vertical-stepper-color-border-visited-skip:var(--sinch-ref-color-main-stormy-400);--sinch-comp-vertical-stepper-color-border-active:transparent;--sinch-comp-vertical-stepper-color-border-visited:var(--sinch-ref-color-main-stormy-400);--sinch-comp-vertical-stepper-color-border-visited-error:var(--sinch-ref-color-main-stormy-400);--sinch-comp-vertical-stepper-color-icon-default:var(--sinch-ref-color-main-stormy-700);--sinch-comp-vertical-stepper-color-icon-visited-skip:var(--sinch-ref-color-main-stormy-700);--sinch-comp-vertical-stepper-color-icon-active:var(--sinch-ref-color-main-snow-100);--sinch-comp-vertical-stepper-color-icon-visited:var(--sinch-ref-color-main-stormy-700);--sinch-comp-vertical-stepper-color-icon-visited-error:var(--sinch-ref-color-main-stormy-700);--sinch-comp-vertical-stepper-color-label:var(--sinch-sys-color-text-default);--sinch-comp-vertical-stepper-color-description:var(--sinch-sys-color-text-muted);--sinch-comp-vertical-stepper-color-progress:var(--sinch-ref-color-main-snow-700);--sinch-comp-vertical-stepper-color-progress-visited:var(--sinch-ref-color-main-stormy-400)}#wrapper{position:relative;display:flex;flex-direction:column;width:100%}</style><div id="wrapper"><slot></slot></div>';
|
|
3
3
|
const template = document.createElement('template');
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-vertical-stepper', class extends NectaryElement {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import '../icon';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import '../title';
|
|
3
|
+
import '../text';
|
|
4
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
5
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;min-height:68px}#circle-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:8px;min-width:0}#circle{display:flex;align-items:center;justify-content:center;width:32px;height:32px;background-color:var(--sinch-local-color-background);font:var(--sinch-sys-font-desktop-title-s);line-height:32px;text-align:center;color:var(--sinch-local-color-text);border:1px solid var(--sinch-local-color-border);border-radius:50%;box-sizing:border-box;--sinch-local-color-background:var(--sinch-comp-vertical-stepper-color-background-default);--sinch-local-color-border:var(--sinch-comp-vertical-stepper-color-border-default);--sinch-local-color-text:var(--sinch-comp-vertical-stepper-color-icon-default);--sinch-local-color-icon:var(--sinch-comp-vertical-stepper-color-icon-default);--sinch-global-size-icon:20px}:host([data-progress=active]) #circle{--sinch-local-color-background:var(--sinch-comp-vertical-stepper-color-background-active);--sinch-local-color-border:var(--sinch-comp-vertical-stepper-color-border-active);--sinch-local-color-text:var(--sinch-comp-vertical-stepper-color-icon-active);--sinch-local-color-icon:var(--sinch-comp-vertical-stepper-color-icon-active)}:host([data-progress=done]) #circle{--sinch-local-color-background:var(--sinch-comp-vertical-stepper-color-background-visited);--sinch-local-color-border:var(--sinch-comp-vertical-stepper-color-border-visited);--sinch-local-color-text:var(--sinch-comp-vertical-stepper-color-icon-visited);--sinch-local-color-icon:var(--sinch-comp-vertical-stepper-color-icon-visited)}:host([data-progress=done][status=error]) #circle{--sinch-local-color-background:var(--sinch-comp-vertical-stepper-color-background-visited-error);--sinch-local-color-border:var(--sinch-comp-vertical-stepper-color-border-visited-error);--sinch-local-color-text:var(--sinch-comp-vertical-stepper-color-icon-visited-error);--sinch-local-color-icon:var(--sinch-comp-vertical-stepper-color-icon-visited-error)}:host([data-progress=done][status=skip]) #circle{--sinch-local-color-background:var(--sinch-comp-vertical-stepper-color-background-visited-skip);--sinch-local-color-border:var(--sinch-comp-vertical-stepper-color-border-visited-skip);--sinch-local-color-text:var(--sinch-comp-vertical-stepper-color-icon-visited-skip);--sinch-local-color-icon:var(--sinch-comp-vertical-stepper-color-icon-visited-skip)}#icon-error,#icon-success{display:none}:host([data-progress=done]:not([status])) #icon-success{display:block}:host([data-progress=done][status=error]) #icon-error{display:block}:host([data-progress=done]:not([status=skip])) #circle-text{display:none}#content{display:none;padding:16px 0 16px 40px}:host([data-progress=active]) #content{display:block}#progress{position:absolute;width:1px;left:15.5px;top:32px;bottom:0;background-color:var(--sinch-comp-vertical-stepper-color-progress)}#bar{position:absolute;width:1px;height:0;background-color:var(--sinch-comp-vertical-stepper-color-progress-visited);left:0;top:0}:host([data-progress=done]) #bar{height:100%}:host(:last-of-type) #progress{display:none}#label-wrapper{margin-top:4px;min-width:0;flex:1}#label{--sinch-global-color-text:var(--sinch-comp-vertical-stepper-color-label)}#description{--sinch-global-color-text:var(--sinch-comp-vertical-stepper-color-description)}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><div id="circle-wrapper"><div id="circle" aria-hidden="true"><sinch-icon id="icon-success" name="check"></sinch-icon><sinch-icon id="icon-error" name="exclamation"></sinch-icon><span id="circle-text"></span></div><div id="label-wrapper"><sinch-title id="label" type="s" level="3" ellipsis></sinch-title><sinch-text id="description" type="xs" ellipsis></sinch-text></div></div><div id="content"><slot></slot></div></div>';
|
|
4
6
|
import { statusValues } from './utils';
|
|
5
7
|
const template = document.createElement('template');
|
|
6
8
|
template.innerHTML = templateHTML;
|
|
@@ -8,8 +10,6 @@ defineCustomElement('sinch-vertical-stepper-item', class extends NectaryElement
|
|
|
8
10
|
#$label;
|
|
9
11
|
#$description;
|
|
10
12
|
#$circleText;
|
|
11
|
-
#$iconSuccess;
|
|
12
|
-
#$iconError;
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
const shadowRoot = this.attachShadow();
|
|
@@ -17,22 +17,18 @@ defineCustomElement('sinch-vertical-stepper-item', class extends NectaryElement
|
|
|
17
17
|
this.#$label = shadowRoot.querySelector('#label');
|
|
18
18
|
this.#$description = shadowRoot.querySelector('#description');
|
|
19
19
|
this.#$circleText = shadowRoot.querySelector('#circle-text');
|
|
20
|
-
this.#$iconSuccess = shadowRoot.querySelector('#icon-success');
|
|
21
|
-
this.#$iconError = shadowRoot.querySelector('#icon-error');
|
|
22
|
-
}
|
|
23
|
-
connectedCallback() {
|
|
24
|
-
const [successName, errorName] = getCssVars(this, ['--sinch-vertical-stepper-icon-success', '--sinch-vertical-stepper-icon-error']);
|
|
25
|
-
updateAttribute(this.#$iconSuccess, 'name', successName);
|
|
26
|
-
updateAttribute(this.#$iconError, 'name', errorName);
|
|
27
20
|
}
|
|
28
21
|
static get observedAttributes() {
|
|
29
22
|
return ['label', 'description', 'data-index'];
|
|
30
23
|
}
|
|
31
24
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
25
|
+
if (oldVal === newVal) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
32
28
|
switch (name) {
|
|
33
29
|
case 'label':
|
|
34
30
|
{
|
|
35
|
-
this.#$label
|
|
31
|
+
updateAttribute(this.#$label, 'text', newVal);
|
|
36
32
|
break;
|
|
37
33
|
}
|
|
38
34
|
case 'description':
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createLogoClass: (templateHTML: string) => CustomElementConstructor;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { getBooleanAttribute, getIntegerAttribute, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute } from '../utils';
|
|
2
|
-
const logoStylesHtml = '<style>:host{display:inline-block;vertical-align:middle}svg{display:block;fill:var(--sinch-color-stormy-500)}:host([inverted]:not([inverted=false])) svg{fill:var(--sinch-color-snow-100)}</style>';
|
|
3
|
-
const DEFAULT_SIZE = 16;
|
|
4
|
-
const MIN_SIZE = 4;
|
|
5
|
-
const MAX_SIZE = 256;
|
|
6
|
-
export const createLogoClass = templateHTML => {
|
|
7
|
-
const template = document.createElement('template');
|
|
8
|
-
template.innerHTML = logoStylesHtml + templateHTML;
|
|
9
|
-
return class extends NectaryElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
const shadowRoot = this.attachShadow();
|
|
13
|
-
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
|
-
this.$svg = shadowRoot.querySelector('svg');
|
|
15
|
-
}
|
|
16
|
-
static get observedAttributes() {
|
|
17
|
-
return ['size'];
|
|
18
|
-
}
|
|
19
|
-
set size(value) {
|
|
20
|
-
updateAttribute(this, 'size', value);
|
|
21
|
-
}
|
|
22
|
-
get size() {
|
|
23
|
-
return getIntegerAttribute(this, 'size', DEFAULT_SIZE);
|
|
24
|
-
}
|
|
25
|
-
set inverted(isInverted) {
|
|
26
|
-
updateBooleanAttribute(this, 'inverted', isInverted);
|
|
27
|
-
}
|
|
28
|
-
get inverted() {
|
|
29
|
-
return getBooleanAttribute(this, 'inverted');
|
|
30
|
-
}
|
|
31
|
-
connectedCallback() {
|
|
32
|
-
if (!this.$svg.hasAttribute('preserveAspectRatio')) {
|
|
33
|
-
this.$svg.setAttribute('preserveAspectRatio', 'xMinYMin meet');
|
|
34
|
-
}
|
|
35
|
-
if (!this.hasAttribute('size')) {
|
|
36
|
-
this.size = DEFAULT_SIZE;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
attributeChangedCallback(name, _, newVal) {
|
|
40
|
-
switch (name) {
|
|
41
|
-
case 'size':
|
|
42
|
-
{
|
|
43
|
-
updateIntegerAttribute(this.$svg, 'height', newVal, {
|
|
44
|
-
min: MIN_SIZE,
|
|
45
|
-
max: MAX_SIZE
|
|
46
|
-
});
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TSinchLogoElement, TSinchLogoReact } from '../types';
|
|
2
|
-
declare global {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
'sinch-logo-engage-icon': TSinchLogoReact;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface HTMLElementTagNameMap {
|
|
9
|
-
'sinch-logo-engage-icon': TSinchLogoElement;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement } from '../../utils';
|
|
2
|
-
import { createLogoClass } from '../create-logo-class';
|
|
3
|
-
const templateHTML = '<svg viewBox="0 0 48 48" aria-hidden="true"><path d="M46.398 19.2a17.48 17.48 0 0 1-5.155 12.443A17.488 17.488 0 0 1 28.8 36.798H24l4.8-4.8c7.057 0 12.799-5.741 12.799-12.798S35.857 6.402 28.8 6.402c-7.057 0-12.799 5.741-12.799 12.798v.25a15.66 15.66 0 0 0-2.801-.25h-.798c-.402 0-.803.014-1.2.046V19.2a17.48 17.48 0 0 1 5.155-12.443A17.488 17.488 0 0 1 28.8 1.602c4.698 0 9.12 1.832 12.443 5.155A17.488 17.488 0 0 1 46.398 19.2Z"/><path d="M24.046 46.398H12.8c-6.176 0-11.202-5.026-11.202-11.201 0-6.176 5.026-11.202 11.202-11.202 6.174 0 11.2 5.026 11.2 11.202v1.601h-4.8v-1.601c0-3.53-2.87-6.402-6.401-6.402a6.408 6.408 0 0 0-6.402 6.402c0 3.53 2.87 6.401 6.402 6.401h6.447l4.8 4.8Z"/></svg>';
|
|
4
|
-
defineCustomElement('sinch-logo-engage-icon', createLogoClass(templateHTML));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TSinchLogoElement, TSinchLogoReact } from '../types';
|
|
2
|
-
declare global {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
'sinch-logo-engage-icon-wordmark': TSinchLogoReact;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface HTMLElementTagNameMap {
|
|
9
|
-
'sinch-logo-engage-icon-wordmark': TSinchLogoElement;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement } from '../../utils';
|
|
2
|
-
import { createLogoClass } from '../create-logo-class';
|
|
3
|
-
const templateHTML = '<svg viewBox="0 0 159 48" aria-hidden="true"><path d="M53.94 40.214V16.722h15.338v3.456H58.236v6.444h10.035v3.356H58.236v6.78h11.042v3.456H53.94Zm17.62 0V23.568h3.792l.336 2.819a5.862 5.862 0 0 1 2.231-2.35c.974-.582 2.119-.872 3.44-.872 2.06 0 3.658.65 4.8 1.947 1.14 1.296 1.711 3.2 1.711 5.705v9.397h-4.296V31.22c0-1.43-.29-2.53-.872-3.29-.583-.758-1.49-1.14-2.719-1.14-1.229 0-2.198.423-2.97 1.275-.772.852-1.158 2.035-1.158 3.557v8.592H71.56Zm25.774-4.967a8.905 8.905 0 0 1-2.248-.269l-1.242 1.242c.382.202.893.37 1.544.504.65.134 1.699.268 3.154.402 2.215.202 3.826.726 4.833 1.578 1.007.851 1.51 2.026 1.51 3.524 0 .985-.268 1.917-.805 2.802s-1.364 1.598-2.484 2.148c-1.12.55-2.55.822-4.295.822-2.37 0-4.284-.44-5.74-1.326-1.455-.885-2.18-2.21-2.18-3.977 0-1.497.725-2.798 2.18-3.893a7.352 7.352 0 0 1-1.157-.637 6.089 6.089 0 0 1-.856-.705v-.772l2.92-3.087c-1.296-1.142-1.947-2.606-1.947-4.397 0-1.12.273-2.135.823-3.054.55-.919 1.325-1.644 2.332-2.181 1.007-.537 2.228-.806 3.658-.806.94 0 1.813.134 2.618.403h6.309v2.618l-2.852.201c.449.852.671 1.791.671 2.82 0 1.12-.269 2.134-.806 3.053s-1.313 1.645-2.332 2.181c-1.02.537-2.22.806-3.608.806Zm-4.027 7.014c0 .827.386 1.447 1.158 1.863.772.415 1.715.62 2.836.62 1.12 0 1.946-.218 2.617-.654.672-.436 1.007-1.023 1.007-1.762a1.97 1.97 0 0 0-.654-1.51c-.437-.403-1.305-.65-2.601-.738a26.661 26.661 0 0 1-2.55-.302c-.651.356-1.113.75-1.394 1.174-.28.424-.42.86-.42 1.31Zm4.027-10.303c.873 0 1.594-.235 2.165-.705.57-.47.856-1.14.856-2.013s-.286-1.544-.856-2.014c-.57-.47-1.292-.705-2.165-.705-.919 0-1.657.235-2.215.705-.558.47-.839 1.141-.839 2.014 0 .872.281 1.543.84 2.013.557.47 1.295.705 2.214.705Zm16.109 8.659c-1.43 0-2.605-.231-3.524-.688-.918-.458-1.598-1.07-2.047-1.83a4.851 4.851 0 0 1-.671-2.516c0-1.544.604-2.798 1.812-3.76 1.208-.96 3.021-1.442 5.437-1.442h4.229v-.403c0-1.141-.323-1.98-.973-2.517-.651-.537-1.456-.805-2.417-.805-.872 0-1.632.205-2.282.62-.65.416-1.053 1.024-1.208 1.83h-4.195c.113-1.209.52-2.262 1.225-3.155.705-.894 1.615-1.582 2.735-2.064 1.12-.483 2.37-.722 3.759-.722 2.37 0 4.241.592 5.604 1.779 1.364 1.187 2.048 2.865 2.048 5.034v10.236h-3.659l-.402-2.685a6.205 6.205 0 0 1-2.064 2.215c-.885.583-2.018.873-3.407.873Zm.974-3.356c1.229 0 2.185-.403 2.869-1.209.684-.805 1.112-1.8 1.292-2.986h-3.658c-1.141 0-1.959.205-2.45.62-.491.416-.738.923-.738 1.527 0 .65.247 1.154.738 1.51.491.357 1.141.538 1.947.538Zm18.022-2.014a8.905 8.905 0 0 1-2.249-.269l-1.242 1.242c.382.202.894.37 1.544.504s1.699.268 3.155.402c2.215.202 3.826.726 4.833 1.578 1.006.851 1.51 2.026 1.51 3.524 0 .985-.269 1.917-.806 2.802s-1.363 1.598-2.483 2.148-2.551.822-4.296.822c-2.37 0-4.283-.44-5.739-1.326-1.456-.885-2.181-2.21-2.181-3.977 0-1.497.725-2.798 2.181-3.893a7.349 7.349 0 0 1-1.158-.637 6.052 6.052 0 0 1-.855-.705v-.772l2.919-3.087c-1.296-1.142-1.946-2.606-1.946-4.397 0-1.12.272-2.135.822-3.054.55-.919 1.326-1.644 2.333-2.181 1.006-.537 2.227-.806 3.658-.806.939 0 1.812.134 2.617.403h6.31v2.618l-2.853.201c.449.852.671 1.791.671 2.82 0 1.12-.268 2.134-.805 3.053s-1.313 1.645-2.333 2.181c-1.019.537-2.219.806-3.607.806Zm-4.028 7.014c0 .827.386 1.447 1.158 1.863.772.415 1.716.62 2.836.62 1.12 0 1.947-.218 2.618-.654.671-.436 1.007-1.023 1.007-1.762 0-.604-.219-1.107-.655-1.51-.436-.403-1.304-.65-2.601-.738a26.617 26.617 0 0 1-2.55-.302c-.651.356-1.112.75-1.393 1.174-.281.424-.42.86-.42 1.31Zm4.028-10.303c.872 0 1.594-.235 2.164-.705.571-.47.856-1.14.856-2.013s-.285-1.544-.856-2.014c-.57-.47-1.292-.705-2.164-.705-.919 0-1.657.235-2.215.705-.558.47-.839 1.141-.839 2.014 0 .872.281 1.543.839 2.013.558.47 1.296.705 2.215.705Zm17.787 8.659c-1.678 0-3.168-.357-4.464-1.074a7.806 7.806 0 0 1-3.054-3.02c-.738-1.297-1.107-2.799-1.107-4.498 0-1.699.365-3.255 1.09-4.598a7.911 7.911 0 0 1 3.021-3.137c1.288-.751 2.802-1.125 4.547-1.125 1.632 0 3.075.357 4.33 1.074a7.715 7.715 0 0 1 2.936 2.937c.705 1.241 1.057 2.622 1.057 4.144 0 .248-.004.504-.016.772-.013.269-.03.55-.051.84h-12.652c.088 1.296.541 2.315 1.359 3.053.818.739 1.808 1.108 2.97 1.108.873 0 1.607-.197 2.198-.588a3.632 3.632 0 0 0 1.326-1.527h4.363a7.93 7.93 0 0 1-1.561 2.87 7.688 7.688 0 0 1-2.684 2.03c-1.062.491-2.266.739-3.608.739Zm.033-13.961c-1.053 0-1.98.297-2.785.889-.806.591-1.322 1.493-1.544 2.701h8.29c-.068-1.094-.47-1.967-1.209-2.617-.738-.65-1.657-.974-2.752-.974ZM56.944 11.742c-.604 0-1.137-.105-1.598-.31a2.524 2.524 0 0 1-1.091-.894c-.264-.386-.403-.86-.411-1.414h1.586c.016.386.155.71.415.97s.625.394 1.087.394c.398 0 .717-.097.952-.29a.944.944 0 0 0 .352-.768c0-.318-.105-.6-.31-.788-.206-.189-.483-.34-.827-.457l-1.103-.378c-.634-.218-1.12-.5-1.452-.847-.331-.344-.499-.802-.499-1.376-.008-.487.11-.902.348-1.25a2.37 2.37 0 0 1 .982-.81c.415-.193.894-.29 1.435-.29s1.032.097 1.451.294c.42.197.747.47.986.822.24.353.365.772.382 1.259h-1.611a1.109 1.109 0 0 0-.336-.768c-.214-.222-.516-.336-.897-.336-.328-.008-.604.072-.827.24-.222.167-.335.41-.335.734 0 .272.088.49.26.65.172.16.407.298.704.407.298.109.638.226 1.024.352.407.143.78.307 1.116.495.336.19.608.437.81.747.205.31.306.705.306 1.191 0 .433-.11.831-.327 1.2-.218.37-.546.663-.974.885-.432.223-.96.336-1.585.336h-.013Zm6.553-.138V3.38h1.502v8.223h-1.502Zm5.449 0V3.38h1.502l3.864 5.79V3.38h1.502v8.223h-1.502l-3.864-5.781v5.78h-1.502Zm14.544.138c-.83 0-1.543-.176-2.139-.533a3.565 3.565 0 0 1-1.376-1.493c-.323-.638-.482-1.376-.482-2.215 0-.84.159-1.578.482-2.22a3.56 3.56 0 0 1 1.376-1.501c.596-.361 1.309-.541 2.14-.541.985 0 1.795.243 2.424.734.63.49 1.024 1.174 1.18 2.06h-1.658a1.782 1.782 0 0 0-.65-1.053c-.332-.256-.772-.382-1.322-.382-.759 0-1.355.26-1.787.776-.432.516-.646 1.225-.646 2.127 0 .902.214 1.606.646 2.118.432.512 1.028.768 1.787.768.55 0 .99-.117 1.322-.357.331-.239.55-.57.65-.994h1.657c-.155.848-.55 1.506-1.179 1.984-.629.479-1.439.718-2.425.718v.004Zm7.283-.138V3.38h1.502V6.8h3.687V3.38h1.502v8.223h-1.502V8.02h-3.687v3.582h-1.502Zm-48.6 5.847c0 4.275-1.665 8.29-4.686 11.31a15.895 15.895 0 0 1-11.31 4.686h-4.363l4.363-4.363c6.415 0 11.633-5.218 11.633-11.633 0-6.414-5.218-11.632-11.633-11.632-6.414 0-11.633 5.218-11.633 11.633v.226a14.231 14.231 0 0 0-2.546-.227h-.726c-.365 0-.73.013-1.09.042v-.041c0-4.275 1.665-8.29 4.685-11.31a15.895 15.895 0 0 1 11.31-4.686c4.27 0 8.29 1.665 11.31 4.686a15.896 15.896 0 0 1 4.686 11.31Z"/><path d="M21.856 42.173H11.633c-5.613 0-10.181-4.568-10.181-10.181 0-5.613 4.568-10.182 10.181-10.182 5.613 0 10.181 4.569 10.181 10.182v1.455h-4.362v-1.455c0-3.21-2.61-5.819-5.819-5.819a5.824 5.824 0 0 0-5.819 5.819 5.824 5.824 0 0 0 5.819 5.818h5.86l4.363 4.363Z"/></svg>';
|
|
4
|
-
defineCustomElement('sinch-logo-engage-icon-wordmark', createLogoClass(templateHTML));
|