@nectary/components 0.48.1 → 0.49.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/types.d.ts +2 -2
- package/accordion-item/types.d.ts +3 -3
- package/action-menu/index.js +0 -1
- package/action-menu/types.d.ts +2 -2
- package/action-menu-option/index.js +1 -1
- package/action-menu-option/types.d.ts +2 -2
- package/alert/index.d.ts +2 -1
- package/alert/index.js +4 -3
- package/alert/types.d.ts +3 -3
- package/alert/utils.d.ts +1 -1
- package/avatar/types.d.ts +3 -3
- package/avatar/utils.d.ts +1 -1
- package/badge/types.d.ts +3 -3
- package/badge/utils.d.ts +1 -1
- package/button/types.d.ts +3 -3
- package/button/utils.d.ts +1 -1
- package/card/types.d.ts +2 -2
- package/card-container/types.d.ts +2 -2
- package/chat/types.d.ts +2 -2
- package/chat-block/types.d.ts +3 -3
- package/chat-bubble/types.d.ts +4 -4
- package/checkbox/types.d.ts +2 -2
- package/chip/types.d.ts +2 -2
- package/code-tag/index.d.ts +13 -0
- package/code-tag/index.js +36 -0
- package/code-tag/types.d.ts +11 -0
- package/code-tag/types.js +1 -0
- package/color-menu/index.js +0 -3
- package/color-menu/types.d.ts +2 -2
- package/color-swatch/types.d.ts +2 -2
- package/date-picker/index.js +0 -6
- package/date-picker/types.d.ts +2 -2
- package/date-picker/utils.d.ts +6 -6
- package/dialog/index.js +0 -1
- package/dialog/types.d.ts +2 -2
- package/emoji/types.d.ts +2 -2
- package/emoji/utils.js +0 -4
- package/emoji-picker/index.js +1 -3
- package/emoji-picker/types.d.ts +4 -4
- package/field/types.d.ts +2 -2
- package/file-drop/types.d.ts +3 -3
- package/file-picker/index.js +0 -1
- package/file-picker/types.d.ts +3 -3
- package/file-status/types.d.ts +3 -3
- package/file-status/utils.d.ts +1 -1
- package/flag/types.d.ts +2 -2
- package/flag/utils.js +0 -2
- package/grid/types.d.ts +2 -2
- package/grid-item/types.d.ts +2 -2
- package/help-tooltip/types.d.ts +2 -2
- package/horizontal-stepper/types.d.ts +2 -2
- package/horizontal-stepper-item/types.d.ts +3 -3
- package/icon/types.d.ts +2 -2
- package/icon-button/types.d.ts +3 -3
- package/icon-button/utils.d.ts +1 -1
- package/icons/types.d.ts +2 -2
- package/icons-branded/types.d.ts +2 -2
- package/icons-channel/types.d.ts +2 -2
- package/illustrations/types.d.ts +4 -4
- package/inline-alert/index.d.ts +4 -3
- package/inline-alert/index.js +6 -5
- package/inline-alert/types.d.ts +3 -3
- package/inline-alert/utils.d.ts +1 -1
- package/input/index.js +17 -3
- package/input/types.d.ts +9 -3
- package/input/utils.d.ts +3 -0
- package/input/utils.js +6 -1
- package/link/types.d.ts +2 -2
- package/list/types.d.ts +2 -2
- package/list-item/types.d.ts +2 -2
- package/logo/types.d.ts +2 -2
- package/package.json +10 -9
- package/pagination/index.js +0 -6
- package/pagination/types.d.ts +2 -2
- package/pop/index.js +0 -16
- package/pop/types.d.ts +3 -3
- package/pop/utils.d.ts +1 -1
- package/popover/types.d.ts +3 -3
- package/popover/utils.d.ts +2 -2
- package/progress/types.d.ts +2 -2
- package/radio/types.d.ts +2 -2
- package/radio-option/types.d.ts +2 -2
- package/rich-text/index.d.ts +12 -0
- package/rich-text/index.js +56 -0
- package/rich-text/types.d.ts +12 -0
- package/rich-text/types.js +1 -0
- package/rich-text/utils.d.ts +5 -0
- package/rich-text/utils.js +6 -0
- package/segment/types.d.ts +2 -2
- package/segment-collapse/types.d.ts +2 -2
- package/segmented-control/types.d.ts +2 -2
- package/segmented-control-option/types.d.ts +2 -2
- package/segmented-icon-control/types.d.ts +2 -2
- package/segmented-icon-control-option/types.d.ts +2 -2
- package/select-button/index.js +1 -1
- package/select-button/types.d.ts +2 -2
- package/select-menu/index.js +0 -1
- package/select-menu/types.d.ts +2 -2
- package/select-menu-option/index.js +1 -1
- package/select-menu-option/types.d.ts +2 -2
- package/spinner/types.d.ts +2 -2
- package/table/types.d.ts +2 -2
- package/table-body/types.d.ts +2 -2
- package/table-cell/types.d.ts +3 -3
- package/table-head/types.d.ts +2 -2
- package/table-head-cell/types.d.ts +2 -2
- package/table-row/types.d.ts +2 -2
- package/tabs/types.d.ts +2 -2
- package/tabs-icon-option/index.js +1 -1
- package/tabs-icon-option/types.d.ts +2 -2
- package/tabs-option/index.js +1 -1
- package/tabs-option/types.d.ts +2 -2
- package/tag/types.d.ts +2 -2
- package/text/index.js +1 -3
- package/text/types.d.ts +3 -3
- package/text/utils.d.ts +1 -1
- package/text/utils.js +1 -1
- package/textarea/index.js +1 -1
- package/textarea/types.d.ts +2 -2
- package/theme/fonts.css +33 -0
- package/theme/fonts.json +33 -0
- package/tile-control/types.d.ts +2 -2
- package/tile-control-option/types.d.ts +2 -2
- package/time-picker/index.js +0 -4
- package/time-picker/types.d.ts +2 -2
- package/title/index.js +0 -2
- package/title/types.d.ts +4 -4
- package/title/utils.d.ts +3 -2
- package/title/utils.js +17 -0
- package/toast/types.d.ts +3 -3
- package/toast/utils.d.ts +1 -1
- package/toast-manager/index.js +0 -1
- package/toast-manager/types.d.ts +2 -2
- package/toggle/types.d.ts +2 -2
- package/tooltip/tooltip-state.d.ts +1 -1
- package/tooltip/types.d.ts +3 -3
- package/tooltip/utils.d.ts +2 -2
- package/utils/context.d.ts +5 -5
- package/utils/context.js +0 -1
- package/utils/countries.d.ts +1 -1
- package/utils/dom.d.ts +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -1
- package/utils/markdown.d.ts +1 -0
- package/utils/markdown.js +128 -0
- package/utils/rect.js +0 -1
- package/utils/size.d.ts +4 -4
- package/vertical-stepper/types.d.ts +2 -2
- package/vertical-stepper-item/types.d.ts +3 -3
package/accordion/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type TSinchAccordionElement = HTMLElement & {
|
|
4
4
|
/** Value */
|
|
5
5
|
value: string;
|
|
6
6
|
/** Allows to expand multiple items simultanously */
|
|
@@ -12,7 +12,7 @@ export declare type TSinchAccordionElement = HTMLElement & {
|
|
|
12
12
|
/** Allows to expand multiple items simultanously */
|
|
13
13
|
setAttribute(name: 'multiple', value: ''): void;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type TSinchAccordionReact = TSinchElementReact<TSinchAccordionElement> & {
|
|
16
16
|
/** Value */
|
|
17
17
|
value: string;
|
|
18
18
|
multiple?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TSinchAccordionStatusType = 'info' | 'success' | 'warn' | 'error';
|
|
3
|
+
export type TSinchAccordionItemElement = HTMLElement & {
|
|
4
4
|
/** Value */
|
|
5
5
|
value: string;
|
|
6
6
|
/** Label */
|
|
@@ -22,7 +22,7 @@ export declare type TSinchAccordionItemElement = HTMLElement & {
|
|
|
22
22
|
/** Disabled */
|
|
23
23
|
setAttribute(name: 'disabled', value: ''): void;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type TSinchAccordionItemReact = TSinchElementReact<TSinchAccordionItemElement> & {
|
|
26
26
|
/** Value */
|
|
27
27
|
value: string;
|
|
28
28
|
/** Label */
|
package/action-menu/index.js
CHANGED
|
@@ -159,7 +159,6 @@ defineCustomElement('sinch-action-menu', class extends NectaryElement {
|
|
|
159
159
|
const hasRows = this.hasAttribute('rows');
|
|
160
160
|
for (const $op of this.#getOptionElements()) {
|
|
161
161
|
const isSelected = $op === $option;
|
|
162
|
-
|
|
163
162
|
updateBooleanAttribute($op, 'data-selected', isSelected);
|
|
164
163
|
if (isSelected && hasRows) {
|
|
165
164
|
$op.scrollIntoView?.({
|
package/action-menu/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchActionMenuElement = HTMLElement & {
|
|
3
3
|
/** How many rows to show and scroll the rest */
|
|
4
4
|
rows: number | null;
|
|
5
5
|
/** How many rows to show and scroll the rest */
|
|
6
6
|
setAttribute(name: 'rows', value: string): void;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type TSinchActionMenuReact = TSinchElementReact<TSinchActionMenuElement> & {
|
|
9
9
|
/** How many rows to show and scroll the rest */
|
|
10
10
|
rows?: number;
|
|
11
11
|
/** Label that is used for a11y */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
3
|
-
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(
|
|
3
|
+
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;color:var(--sinch-color-text-default);--sinch-color-icon:var(--sinch-color-stormy-500);--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;color:var(--sinch-color-text-disabled);--sinch-color-icon:var(--sinch-color-stormy-100)}:host(:hover:not([disabled]))>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-400)}::slotted(*){margin-left:-6px}</style><div id="wrapper"><slot name="icon"></slot><sinch-text id="content" type="m" ellipsis></sinch-text></div>';
|
|
4
4
|
const template = document.createElement('template');
|
|
5
5
|
template.innerHTML = templateHTML;
|
|
6
6
|
defineCustomElement('sinch-action-menu-option', class ActionMenuOption extends NectaryElement {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchActionMenuOptionElement = HTMLElement & {
|
|
3
3
|
/** Display text */
|
|
4
4
|
text: string;
|
|
5
5
|
/** Disabled state */
|
|
@@ -11,7 +11,7 @@ export declare type TSinchActionMenuOptionElement = HTMLElement & {
|
|
|
11
11
|
/** Disabled state */
|
|
12
12
|
setAttribute(name: 'disabled', value: ''): void;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type TSinchActionMenuOptionReact = TSinchElementReact<TSinchActionMenuOptionElement> & {
|
|
15
15
|
/** Display text */
|
|
16
16
|
text: string;
|
|
17
17
|
/** Disabled state */
|
package/alert/index.d.ts
CHANGED
package/alert/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import '../icons/info';
|
|
1
2
|
import '../icons/report-problem';
|
|
2
3
|
import '../icons/report';
|
|
3
|
-
import '../
|
|
4
|
+
import '../rich-text';
|
|
4
5
|
import '../text';
|
|
5
6
|
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
6
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}#text{color:var(--sinch-color-stormy-500);flex:1;min-width:0}#icon-error,#icon-info,#icon-warn{display:none}:host([type=warn]) #wrapper{background-color:var(--sinch-color-feedback-warning-bg)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}:host([type=info]) #wrapper{background-color:var(--sinch-color-feedback-info-bg)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-feedback-warning-icon)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-feedback-info-icon)}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><sinch-text id="text"
|
|
7
|
+
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}#text{display:flex;flex-direction:column;gap:8px;color:var(--sinch-color-stormy-500);flex:1;min-width:0}#icon-error,#icon-info,#icon-warn{display:none}:host([type=warn]) #wrapper{background-color:var(--sinch-color-feedback-warning-bg)}:host([type=error]) #wrapper{background-color:var(--sinch-color-feedback-invalid-bg)}:host([type=info]) #wrapper{background-color:var(--sinch-color-feedback-info-bg)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-feedback-warning-icon)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-feedback-invalid-icon)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-feedback-info-icon)}</style><div id="wrapper"><sinch-icon-info id="icon-info"></sinch-icon-info><sinch-icon-report-problem id="icon-warn"></sinch-icon-report-problem><sinch-icon-report id="icon-error"></sinch-icon-report><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
|
|
7
8
|
import { assertType, typeValues } from './utils';
|
|
8
9
|
const template = document.createElement('template');
|
|
9
10
|
template.innerHTML = templateHTML;
|
|
@@ -44,7 +45,7 @@ defineCustomElement('sinch-alert', class extends NectaryElement {
|
|
|
44
45
|
}
|
|
45
46
|
case 'text':
|
|
46
47
|
{
|
|
47
|
-
this.#$text
|
|
48
|
+
updateAttribute(this.#$text, 'text', newVal);
|
|
48
49
|
break;
|
|
49
50
|
}
|
|
50
51
|
}
|
package/alert/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TSinchAlertType = 'info' | 'warn' | 'error';
|
|
3
|
+
export type TSinchAlertElement = HTMLElement & {
|
|
4
4
|
/** Type */
|
|
5
5
|
type: TSinchAlertType;
|
|
6
6
|
/** Text */
|
|
@@ -10,7 +10,7 @@ export declare type TSinchAlertElement = HTMLElement & {
|
|
|
10
10
|
/** Text */
|
|
11
11
|
setAttribute(name: 'text', value: string): void;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type TSinchAlertReact = TSinchElementReact<TSinchAlertElement> & {
|
|
14
14
|
/** Type */
|
|
15
15
|
type: TSinchAlertType;
|
|
16
16
|
/** Text */
|
package/alert/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchAlertType } from './types';
|
|
2
2
|
export declare const typeValues: readonly TSinchAlertType[];
|
|
3
|
-
|
|
3
|
+
type TAssertType = (value: string | null) => asserts value is TSinchAlertType;
|
|
4
4
|
export declare const assertType: TAssertType;
|
|
5
5
|
export {};
|
package/avatar/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
import type { TSinchSize } from '../utils/size';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type TSinchAvatarStatus = 'online' | 'busy' | 'away' | 'offline';
|
|
4
|
+
export type TSinchAvatarElement = HTMLElement & {
|
|
5
5
|
/** Image source */
|
|
6
6
|
src: string | null;
|
|
7
7
|
/** Alt text */
|
|
@@ -23,7 +23,7 @@ export declare type TSinchAvatarElement = HTMLElement & {
|
|
|
23
23
|
/** Status */
|
|
24
24
|
setAttribute(name: 'status', value: TSinchAvatarStatus): void;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type TSinchAvatarReact = TSinchElementReact<TSinchAvatarElement> & {
|
|
27
27
|
/** Image source */
|
|
28
28
|
src?: string;
|
|
29
29
|
/** Alt text */
|
package/avatar/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchAvatarStatus } from './types';
|
|
2
2
|
export declare const statusValues: readonly TSinchAvatarStatus[];
|
|
3
|
-
|
|
3
|
+
type TAssertStatus = (value: string | null) => asserts value is TSinchAvatarStatus;
|
|
4
4
|
export declare const assertStatus: TAssertStatus;
|
|
5
5
|
export declare const getAvatarColorBg: (id: string) => string;
|
|
6
6
|
export declare const getAvatarColorFg: (id: string) => string;
|
package/badge/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
2
|
import type { TSinchSize } from '../utils/size';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type TSinchBadgeMode = 'square' | 'circle';
|
|
4
|
+
export type TSinchBadgeElement = HTMLElement & {
|
|
5
5
|
/** Text */
|
|
6
6
|
text: string;
|
|
7
7
|
/** Size */
|
|
@@ -24,7 +24,7 @@ export declare type TSinchBadgeElement = HTMLElement & {
|
|
|
24
24
|
/** Hidden */
|
|
25
25
|
setAttribute(name: 'hidden', value: ''): void;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type TSinchBadgeReact = TSinchElementReact<TSinchBadgeElement> & {
|
|
28
28
|
/** Text */
|
|
29
29
|
text: string;
|
|
30
30
|
/** Size */
|
package/badge/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchBadgeMode } from './types';
|
|
2
2
|
export declare const modeValues: readonly TSinchBadgeMode[];
|
|
3
|
-
|
|
3
|
+
type TAssertMode = (value: string | null) => asserts value is TSinchBadgeMode;
|
|
4
4
|
export declare const assertMode: TAssertMode;
|
|
5
5
|
export declare const getBadgeColorBg: (id: string) => string;
|
|
6
6
|
export declare const getBadgeColorFg: (id: string) => string;
|
package/button/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
import type { TSinchSize } from '../utils/size';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type TSinchButtonType = 'primary' | 'secondary' | 'tertiary' | 'cta-primary' | 'cta-secondary' | 'destructive';
|
|
4
|
+
export type TSinchButtonElement = HTMLElement & {
|
|
5
5
|
/** Type, `primary` by default */
|
|
6
6
|
type: TSinchButtonType;
|
|
7
7
|
/** Size, `m` by default */
|
|
@@ -25,7 +25,7 @@ export declare type TSinchButtonElement = HTMLElement & {
|
|
|
25
25
|
/** Disabled */
|
|
26
26
|
setAttribute(attr: 'disabled', value: ''): void;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type TSinchButtonReact = TSinchElementReact<TSinchButtonElement> & {
|
|
29
29
|
/** Type, `primary` by default */
|
|
30
30
|
type?: TSinchButtonType;
|
|
31
31
|
/** Size, `m` by default */
|
package/button/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchButtonType } from './types';
|
|
2
2
|
export declare const typeValues: readonly TSinchButtonType[];
|
|
3
|
-
|
|
3
|
+
type TAssertType = (value: string | null) => asserts value is TSinchButtonType;
|
|
4
4
|
export declare const assertType: TAssertType;
|
|
5
5
|
export {};
|
package/card/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchCardElement = HTMLElement & {
|
|
3
3
|
/** Text */
|
|
4
4
|
text: string;
|
|
5
5
|
/** Caption */
|
|
@@ -17,7 +17,7 @@ export declare type TSinchCardElement = HTMLElement & {
|
|
|
17
17
|
/** Disabled */
|
|
18
18
|
setAttribute(name: 'disabled', value: ''): void;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type TSinchCardReact = TSinchElementReact<TSinchCardElement> & {
|
|
21
21
|
/** Text */
|
|
22
22
|
text: string;
|
|
23
23
|
/** Caption */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TSinchCardContainerElement = HTMLElement;
|
|
3
|
+
export type TSinchCardContainerReact = TSinchElementReact<TSinchCardContainerElement>;
|
package/chat/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TSinchChatElement = HTMLElement;
|
|
3
|
+
export type TSinchChatReact = TSinchElementReact<TSinchChatElement>;
|
package/chat-block/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TSinchChatBlockType = 'customer' | 'agent' | 'agent-prev';
|
|
3
|
+
export type TSinchChatBlockElement = HTMLElement & {
|
|
4
4
|
/** Type */
|
|
5
5
|
type: TSinchChatBlockType | null;
|
|
6
6
|
/** First name */
|
|
@@ -18,7 +18,7 @@ export declare type TSinchChatBlockElement = HTMLElement & {
|
|
|
18
18
|
/** Timestamp */
|
|
19
19
|
setAttribute(name: 'timestamp', value: string): void;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type TSinchChatBlockReact = TSinchElementReact<TSinchChatBlockElement> & {
|
|
22
22
|
/** Type */
|
|
23
23
|
type: TSinchChatBlockType;
|
|
24
24
|
/** First name */
|
package/chat-bubble/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type TSinchChatBubbleType = 'customer' | 'agent' | 'agent-prev';
|
|
3
|
+
export type TSinchChatBubbleStatus = 'sending' | 'sent' | 'received' | 'seen' | 'error';
|
|
4
|
+
export type TSinchChatBubbleElement = HTMLElement & {
|
|
5
5
|
readonly type: TSinchChatBubbleType | null;
|
|
6
6
|
/** Text */
|
|
7
7
|
text: string;
|
|
@@ -12,7 +12,7 @@ export declare type TSinchChatBubbleElement = HTMLElement & {
|
|
|
12
12
|
/** Status */
|
|
13
13
|
setAttribute(name: 'status', value: TSinchChatBubbleStatus): void;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type TSinchChatBubbleReact = TSinchElementReact<TSinchChatBubbleElement> & {
|
|
16
16
|
/** Text */
|
|
17
17
|
text: string;
|
|
18
18
|
/** Status */
|
package/checkbox/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type TSinchCheckboxElement = HTMLElement & {
|
|
4
4
|
checked: boolean;
|
|
5
5
|
indeterminate: boolean;
|
|
6
6
|
disabled: boolean;
|
|
@@ -15,7 +15,7 @@ export declare type TSinchCheckboxElement = HTMLElement & {
|
|
|
15
15
|
setAttribute(name: 'invalid', value: ''): void;
|
|
16
16
|
setAttribute(name: 'text', value: string): void;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type TSinchCheckboxReact = TSinchElementReact<TSinchCheckboxElement> & {
|
|
19
19
|
checked?: boolean;
|
|
20
20
|
indeterminate?: boolean;
|
|
21
21
|
disabled?: boolean;
|
package/chip/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchChipElement = HTMLElement & {
|
|
3
3
|
/** Text */
|
|
4
4
|
text: string;
|
|
5
5
|
/** Color, gray by default */
|
|
@@ -19,7 +19,7 @@ export declare type TSinchChipElement = HTMLElement & {
|
|
|
19
19
|
/** Small */
|
|
20
20
|
setAttribute(name: 'small', value: ''): void;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type TSinchChipReact = TSinchElementReact<TSinchChipElement> & {
|
|
23
23
|
/** Text */
|
|
24
24
|
text: string;
|
|
25
25
|
/** Color, gray by default */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../icons/open-in-new';
|
|
2
|
+
import '../icons/arrow-forward';
|
|
3
|
+
import type { TSinchCodeTagElement, TSinchCodeTagReact } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'sinch-code-tag': TSinchCodeTagReact;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sinch-code-tag': TSinchCodeTagElement;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import '../icons/open-in-new';
|
|
2
|
+
import '../icons/arrow-forward';
|
|
3
|
+
import { defineCustomElement, getAttribute, updateAttribute, NectaryElement } from '../utils';
|
|
4
|
+
const templateHTML = '<style>:host{display:inline}#content{font:var(--sinch-font-mono-text-s);font-size:inherit;line-height:inherit;text-decoration:inherit;border:1px solid var(--sinch-color-border-light);background-color:var(--sinch-color-bg-primary-contrast);padding:0 .25em;border-radius:var(--sinch-shape-radius-xs)}</style><span id="content"></span>';
|
|
5
|
+
const template = document.createElement('template');
|
|
6
|
+
template.innerHTML = templateHTML;
|
|
7
|
+
defineCustomElement('sinch-code-tag', class extends NectaryElement {
|
|
8
|
+
#$text;
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const shadowRoot = this.attachShadow();
|
|
12
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
13
|
+
this.#$text = shadowRoot.querySelector('#content');
|
|
14
|
+
}
|
|
15
|
+
get text() {
|
|
16
|
+
return getAttribute(this, 'text', '');
|
|
17
|
+
}
|
|
18
|
+
set text(value) {
|
|
19
|
+
updateAttribute(this, 'text', value);
|
|
20
|
+
}
|
|
21
|
+
static get observedAttributes() {
|
|
22
|
+
return ['text'];
|
|
23
|
+
}
|
|
24
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
25
|
+
if (oldVal === newVal) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
switch (name) {
|
|
29
|
+
case 'text':
|
|
30
|
+
{
|
|
31
|
+
this.#$text.textContent = newVal;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export type TSinchCodeTagElement = HTMLElement & {
|
|
3
|
+
/** Text content of hyperlink */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Text content of hyperlink */
|
|
6
|
+
setAttribute(name: 'text', value: string): void;
|
|
7
|
+
};
|
|
8
|
+
export type TSinchCodeTagReact = TSinchElementReact<TSinchCodeTagElement> & {
|
|
9
|
+
/** Text content of hyperlink */
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/color-menu/index.js
CHANGED
|
@@ -146,9 +146,7 @@ defineCustomElement('sinch-color-menu', class extends NectaryElement {
|
|
|
146
146
|
fragment.appendChild(optFrag);
|
|
147
147
|
}
|
|
148
148
|
this.#$listbox.replaceChildren(fragment);
|
|
149
|
-
|
|
150
149
|
this.#updateColumns();
|
|
151
|
-
|
|
152
150
|
this.#onValueChange();
|
|
153
151
|
}
|
|
154
152
|
#updateRows() {
|
|
@@ -305,7 +303,6 @@ defineCustomElement('sinch-color-menu', class extends NectaryElement {
|
|
|
305
303
|
const hasRows = this.hasAttribute('rows');
|
|
306
304
|
for (const $op of this.#getOptionElements()) {
|
|
307
305
|
const isSelected = $op === $option;
|
|
308
|
-
|
|
309
306
|
updateBooleanAttribute($op, 'data-selected', isSelected);
|
|
310
307
|
if (isSelected && hasRows) {
|
|
311
308
|
$op.scrollIntoView?.({
|
package/color-menu/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchColorMenuElement = HTMLElement & {
|
|
3
3
|
/** Value */
|
|
4
4
|
value: string;
|
|
5
5
|
/** How many rows to show and scroll the rest */
|
|
@@ -20,7 +20,7 @@ export declare type TSinchColorMenuElement = HTMLElement & {
|
|
|
20
20
|
/** How many cols to show and scroll the rest */
|
|
21
21
|
setAttribute(name: 'cols', value: string): void;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type TSinchColorMenuReact = TSinchElementReact<TSinchColorMenuElement> & {
|
|
24
24
|
/** Value */
|
|
25
25
|
value: string;
|
|
26
26
|
/** How many rows to show and scroll the rest */
|
package/color-swatch/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchColorSwatchElement = HTMLElement & {
|
|
3
3
|
/** Color name */
|
|
4
4
|
name: string | null;
|
|
5
5
|
/** Color name */
|
|
6
6
|
setAttribute(name: 'name', value: string): void;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type TSinchColorSwatchReact = TSinchElementReact<TSinchColorSwatchElement> & {
|
|
9
9
|
/** Color name */
|
|
10
10
|
name?: string;
|
|
11
11
|
};
|
package/date-picker/index.js
CHANGED
|
@@ -92,7 +92,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
92
92
|
if ('production' !== 'production') {
|
|
93
93
|
assertDate(this.#minDate, name, newVal);
|
|
94
94
|
}
|
|
95
|
-
|
|
96
95
|
if (this.#uiDate !== null) {
|
|
97
96
|
clampMinDate(this.#uiDate, this.#minDate);
|
|
98
97
|
}
|
|
@@ -108,7 +107,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
108
107
|
if ('production' !== 'production') {
|
|
109
108
|
assertDate(this.#maxDate, name, newVal);
|
|
110
109
|
}
|
|
111
|
-
|
|
112
110
|
if (this.#uiDate !== null) {
|
|
113
111
|
clampMaxDate(this.#uiDate, this.#maxDate);
|
|
114
112
|
}
|
|
@@ -305,7 +303,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
305
303
|
this.#render();
|
|
306
304
|
return;
|
|
307
305
|
}
|
|
308
|
-
|
|
309
306
|
this.dispatchEvent(new CustomEvent('change', {
|
|
310
307
|
detail: dateIso,
|
|
311
308
|
bubbles: true
|
|
@@ -326,7 +323,6 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
326
323
|
if (isValidDate(date1) && isValidDate(date2)) {
|
|
327
324
|
this.#date1 = date1;
|
|
328
325
|
this.#date2 = date2;
|
|
329
|
-
|
|
330
326
|
if (this.#uiDate === null) {
|
|
331
327
|
this.#uiDate = cloneDate(this.#date2);
|
|
332
328
|
}
|
|
@@ -347,11 +343,9 @@ defineCustomElement('sinch-date-picker', class extends NectaryElement {
|
|
|
347
343
|
if (this.#uiDate === null) {
|
|
348
344
|
this.#uiDate = today();
|
|
349
345
|
}
|
|
350
|
-
|
|
351
346
|
if (this.#minDate !== null) {
|
|
352
347
|
clampMinDate(this.#uiDate, this.#minDate);
|
|
353
348
|
}
|
|
354
|
-
|
|
355
349
|
if (this.#maxDate !== null) {
|
|
356
350
|
clampMaxDate(this.#uiDate, this.#maxDate);
|
|
357
351
|
}
|
package/date-picker/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type TSinchDatePickerElement = HTMLElement & {
|
|
4
4
|
/** Date value in ISO 8601 format */
|
|
5
5
|
value: string;
|
|
6
6
|
/** Date min limit in ISO 8601 format */
|
|
@@ -45,7 +45,7 @@ export declare type TSinchDatePickerElement = HTMLElement & {
|
|
|
45
45
|
/** Label that is used for a11y */
|
|
46
46
|
setAttribute(name: 'next-month-aria-label', value: string): void;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerElement> & {
|
|
49
49
|
/** Date value in ISO 8601 format */
|
|
50
50
|
value: string;
|
|
51
51
|
/** Date min limit in ISO 8601 format */
|
package/date-picker/utils.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
type TCalendarOptions = {
|
|
2
2
|
firstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
3
|
};
|
|
4
|
-
|
|
4
|
+
type TMaybeDate = Date | null;
|
|
5
5
|
export declare const getCalendarMonth: (date: Date, options?: TCalendarOptions) => TMaybeDate[][];
|
|
6
6
|
export declare const dateToIso: (date: Date) => string;
|
|
7
7
|
export declare const isoToDate: (value: string) => Date;
|
|
8
8
|
export declare const today: () => Date;
|
|
9
9
|
export declare const getDayNames: (locale: string) => string[];
|
|
10
10
|
export declare const getMonthNames: (locale: string) => string[];
|
|
11
|
-
|
|
11
|
+
type TAssertMinMax = (value: string | null, attrName: string) => asserts value is string;
|
|
12
12
|
export declare const assertMinMax: TAssertMinMax;
|
|
13
|
-
|
|
13
|
+
type TAssertValue = (value: string | null) => asserts value is string;
|
|
14
14
|
export declare const assertValue: TAssertValue;
|
|
15
|
-
|
|
15
|
+
type TAssertLocale = (value: string | null) => asserts value is string;
|
|
16
16
|
export declare const assertLocale: TAssertLocale;
|
|
17
|
-
|
|
17
|
+
type TAssertDate = (value: any, attrName: string, attrValue: string) => asserts value is Date;
|
|
18
18
|
export declare const isValidDate: (value: any) => value is Date;
|
|
19
19
|
export declare const assertDate: TAssertDate;
|
|
20
20
|
export declare const compareDates: (a: Date, b: Date) => number;
|
package/dialog/index.js
CHANGED
|
@@ -26,7 +26,6 @@ defineCustomElement('sinch-dialog', class extends NectaryElement {
|
|
|
26
26
|
this.#$dialog.addEventListener('mousedown', this.#onBackdropClick);
|
|
27
27
|
this.#$dialog.addEventListener('cancel', this.#onCancel);
|
|
28
28
|
this.addEventListener('-close', this.#onCloseReactHandler);
|
|
29
|
-
|
|
30
29
|
this.#setOpen(getBooleanAttribute(this, 'open'));
|
|
31
30
|
}
|
|
32
31
|
disconnectedCallback() {
|
package/dialog/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchDialogElement = HTMLElement & {
|
|
3
3
|
caption: string;
|
|
4
4
|
readonly dialogRect: TRect;
|
|
5
5
|
readonly closeButtonRect: TRect;
|
|
@@ -7,7 +7,7 @@ export declare type TSinchDialogElement = HTMLElement & {
|
|
|
7
7
|
setAttribute(name: 'caption', value: string): void;
|
|
8
8
|
setAttribute(name: 'close-aria-label', value: string): void;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type TSinchDialogReact = TSinchElementReact<TSinchDialogElement> & {
|
|
11
11
|
open: boolean;
|
|
12
12
|
caption: string;
|
|
13
13
|
'aria-label': string;
|
package/emoji/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type TSinchEmojiElement = HTMLElement & {
|
|
3
3
|
/** Emoji character */
|
|
4
4
|
char: string;
|
|
5
5
|
/** Emoji character */
|
|
6
6
|
setAttribute(name: 'char', value: string): void;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type TSinchEmojiReact = TSinchElementReact<TSinchEmojiElement> & {
|
|
9
9
|
/** Emoji character */
|
|
10
10
|
char: string;
|
|
11
11
|
};
|
package/emoji/utils.js
CHANGED
|
@@ -20,13 +20,11 @@ function toCodePoints(unicodeSurrogates) {
|
|
|
20
20
|
}
|
|
21
21
|
return points;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
23
|
let emojiUrl = null;
|
|
25
24
|
export const getEmojiUrl = (root, char) => {
|
|
26
25
|
if (char === null || char.length === 0) {
|
|
27
26
|
return '';
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
if (emojiUrl === null) {
|
|
31
29
|
emojiUrl = getCssVar(root, '--sinch-emoji-src-url');
|
|
32
30
|
if (emojiUrl !== null) {
|
|
@@ -37,10 +35,8 @@ export const getEmojiUrl = (root, char) => {
|
|
|
37
35
|
return '';
|
|
38
36
|
}
|
|
39
37
|
let codepoints = toCodePoints(removeVS16s(char)).join('-');
|
|
40
|
-
|
|
41
38
|
if (codepoints === '1f441-fe0f-200d-1f5e8-fe0f') {
|
|
42
39
|
codepoints = '1f441-200d-1f5e8';
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
return emojiUrl.replace('%s', codepoints);
|
|
46
42
|
};
|
package/emoji-picker/index.js
CHANGED
|
@@ -125,9 +125,7 @@ defineCustomElement('sinch-emoji-picker', class extends NectaryElement {
|
|
|
125
125
|
this.#handleKeydown(e.detail);
|
|
126
126
|
};
|
|
127
127
|
#onContextVisibility = e => {
|
|
128
|
-
if (e.detail) {
|
|
129
|
-
} else {
|
|
130
|
-
}
|
|
128
|
+
if (e.detail) {} else {}
|
|
131
129
|
};
|
|
132
130
|
#onListboxKeyDown = e => {
|
|
133
131
|
this.#handleKeydown(e);
|