@nectary/components 0.17.0 → 0.18.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-item/index.d.ts +3 -0
- package/accordion-item/index.js +26 -4
- package/avatar/index.d.ts +29 -0
- package/avatar/index.js +94 -0
- package/colors.json +69 -0
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/input/index.d.ts +3 -0
- package/input/index.js +24 -0
- package/package.json +3 -2
- package/search/index.d.ts +1 -0
- package/search/index.js +2 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.js +49 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '../icon/keyboard-arrow-down';
|
|
1
2
|
import type { TSinchElementReact } from '../types';
|
|
2
3
|
import type { FocusEvent } from 'react';
|
|
3
4
|
export declare const isAccordionItemElement: (element: EventTarget | Element | null) => element is TSinchAccordionItemElement;
|
|
@@ -6,6 +7,7 @@ export declare type TSinchAccordionStatusType = typeof statusValues[number];
|
|
|
6
7
|
export declare type TSinchAccordionItemElement = HTMLElement & {
|
|
7
8
|
value: string;
|
|
8
9
|
label: string;
|
|
10
|
+
optionalText: string | null;
|
|
9
11
|
disabled: boolean;
|
|
10
12
|
checked: boolean;
|
|
11
13
|
status: TSinchAccordionStatusType | null;
|
|
@@ -15,6 +17,7 @@ export declare type TSinchAccordionItemElement = HTMLElement & {
|
|
|
15
17
|
export declare type TSinchAccordionItemReact = TSinchElementReact<TSinchAccordionItemElement> & {
|
|
16
18
|
value: string;
|
|
17
19
|
label: string;
|
|
20
|
+
optionalText?: string;
|
|
18
21
|
disabled?: boolean;
|
|
19
22
|
status?: TSinchAccordionStatusType;
|
|
20
23
|
onFocus?: (e: FocusEvent<TSinchAccordionItemElement>) => void;
|
package/accordion-item/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$button, _$buttonContent, _onButtonClick;
|
|
4
|
+
var _$button, _$buttonContent, _$optionalText, _onButtonClick;
|
|
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 '../icon/keyboard-arrow-down';
|
|
10
11
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getLiteralAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute, updateLiteralAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:block;outline:0;min-height:48px}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--sinch-color-stormy-200);--sinch-size-icon:16px}#button{all:initial;cursor:pointer;display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:48px;padding:12px 8px;font:var(--sinch-font-title-4);color:var(--sinch-color-text-default);fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button:disabled{cursor:initial;color:var(--sinch-color-stormy-100);fill:var(--sinch-color-stormy-100)}#button::before{width:8px;height:8px;border-radius:50%;margin-left:2px;margin-right:8px}:host([status=success]) #button::before{content:"";background-color:var(--sinch-color-success-500)}:host([status=warn]) #button::before{content:"";background-color:var(--sinch-color-warning-500)}:host([status=error]) #button::before{content:"";background-color:var(--sinch-color-error-500)}:host([status=info]) #button::before{content:"";background-color:var(--sinch-color-informative-500)}#title{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#content{display:none;overflow-y:auto;flex-shrink:1;min-height:0;padding:0 8px 18px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}#button[aria-expanded=true]>#dropdown-icon{transform:rotate(180deg)}#button[aria-expanded=true]+#content{display:block}</style><div id="wrapper"><button id="button" aria-controls="content" aria-expanded="false"><slot name="icon"></slot><span id="title"></span> <
|
|
12
|
+
const templateHTML = '<style>:host{display:block;outline:0;min-height:48px}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--sinch-color-stormy-200);--sinch-size-icon:16px}#button{all:initial;cursor:pointer;display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:48px;padding:12px 8px;font:var(--sinch-font-title-4);color:var(--sinch-color-text-default);fill:var(--sinch-color-stormy-500)}#button>*{pointer-events:none}#button:disabled{cursor:initial;color:var(--sinch-color-stormy-100);fill:var(--sinch-color-stormy-100)}#button::before{width:8px;height:8px;border-radius:50%;margin-left:2px;margin-right:8px}:host([status=success]) #button::before{content:"";background-color:var(--sinch-color-success-500)}:host([status=warn]) #button::before{content:"";background-color:var(--sinch-color-warning-500)}:host([status=error]) #button::before{content:"";background-color:var(--sinch-color-error-500)}:host([status=info]) #button::before{content:"";background-color:var(--sinch-color-informative-500)}#title{flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#content{display:none;overflow-y:auto;flex-shrink:1;min-height:0;padding:0 8px 18px;font:var(--sinch-font-body);color:var(--sinch-color-text-default)}#dropdown-icon{--sinch-size-icon:24px}#button[aria-expanded=true]>#dropdown-icon{transform:rotate(180deg)}#button[aria-expanded=true]+#content{display:block}#optional{font:var(--sinch-font-small-text);color:var(--sinch-color-stormy-300)}</style><div id="wrapper"><button id="button" aria-controls="content" aria-expanded="false"><slot name="icon"></slot><span id="title"></span> <span id="optional"></span><sinch-icon-keyboard-arrow-down id="dropdown-icon"></sinch-icon-keyboard-arrow-down></button><div id="content" role="region" aria-labelledby="button"><slot name="content"></slot></div></div>';
|
|
12
13
|
export const isAccordionItemElement = element => {
|
|
13
14
|
return element instanceof Element && element.tagName === 'SINCH-ACCORDION-ITEM';
|
|
14
15
|
};
|
|
15
16
|
const statusValues = ['info', 'success', 'warn', 'error'];
|
|
16
17
|
const template = document.createElement('template');
|
|
17
18
|
template.innerHTML = templateHTML;
|
|
18
|
-
defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _onButtonClick = new WeakMap(), class extends HTMLElement {
|
|
19
|
+
defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonContent = new WeakMap(), _$optionalText = new WeakMap(), _onButtonClick = new WeakMap(), class extends HTMLElement {
|
|
19
20
|
constructor() {
|
|
20
21
|
super();
|
|
21
22
|
|
|
@@ -29,6 +30,11 @@ defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonC
|
|
|
29
30
|
value: void 0
|
|
30
31
|
});
|
|
31
32
|
|
|
33
|
+
_classPrivateFieldInitSpec(this, _$optionalText, {
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
|
|
32
38
|
_classPrivateFieldInitSpec(this, _onButtonClick, {
|
|
33
39
|
writable: true,
|
|
34
40
|
value: e => {
|
|
@@ -52,6 +58,8 @@ defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonC
|
|
|
52
58
|
_classPrivateFieldSet(this, _$button, shadowRoot.querySelector('#button'));
|
|
53
59
|
|
|
54
60
|
_classPrivateFieldSet(this, _$buttonContent, shadowRoot.querySelector('#title'));
|
|
61
|
+
|
|
62
|
+
_classPrivateFieldSet(this, _$optionalText, shadowRoot.querySelector('#optional'));
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
connectedCallback() {
|
|
@@ -63,7 +71,7 @@ defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonC
|
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
static get observedAttributes() {
|
|
66
|
-
return ['label', 'disabled', 'checked'];
|
|
74
|
+
return ['label', 'disabled', 'checked', 'optionaltext'];
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
set value(value) {
|
|
@@ -106,6 +114,14 @@ defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonC
|
|
|
106
114
|
updateLiteralAttribute(this, statusValues, 'status', value);
|
|
107
115
|
}
|
|
108
116
|
|
|
117
|
+
set optionalText(value) {
|
|
118
|
+
updateAttribute(this, 'optionaltext', value);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
get optionalText() {
|
|
122
|
+
return getAttribute(this, 'optionaltext', null);
|
|
123
|
+
}
|
|
124
|
+
|
|
109
125
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
110
126
|
switch (name) {
|
|
111
127
|
case 'label':
|
|
@@ -125,6 +141,12 @@ defineCustomElement('sinch-accordion-item', (_$button = new WeakMap(), _$buttonC
|
|
|
125
141
|
updateAttribute(_classPrivateFieldGet(this, _$button), 'aria-expanded', isAttrTrue(newVal));
|
|
126
142
|
break;
|
|
127
143
|
}
|
|
144
|
+
|
|
145
|
+
case 'optionaltext':
|
|
146
|
+
{
|
|
147
|
+
_classPrivateFieldGet(this, _$optionalText).textContent = newVal;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
128
150
|
}
|
|
129
151
|
}
|
|
130
152
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import '../icon/cancel';
|
|
2
|
+
import type { TSinchElementReact } from '../types';
|
|
3
|
+
declare const backgroundValues: readonly ["grey", "yellow", "blue"];
|
|
4
|
+
declare const sizeValues: readonly ["l", "m", "s"];
|
|
5
|
+
export declare type TSinchAvatarBackground = typeof backgroundValues[number];
|
|
6
|
+
export declare type TSinchAvatarSize = typeof sizeValues[number];
|
|
7
|
+
export declare type TSinchAvatarElement = HTMLElement & {
|
|
8
|
+
alt: string;
|
|
9
|
+
src: string | null;
|
|
10
|
+
background: TSinchAvatarBackground;
|
|
11
|
+
size: TSinchAvatarSize;
|
|
12
|
+
};
|
|
13
|
+
export declare type TSinchAvatarReact = TSinchElementReact<TSinchAvatarElement> & {
|
|
14
|
+
alt: string;
|
|
15
|
+
src?: string;
|
|
16
|
+
background?: TSinchAvatarBackground;
|
|
17
|
+
size?: TSinchAvatarSize;
|
|
18
|
+
};
|
|
19
|
+
declare global {
|
|
20
|
+
namespace JSX {
|
|
21
|
+
interface IntrinsicElements {
|
|
22
|
+
'sinch-avatar': TSinchAvatarReact;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'sinch-avatar': TSinchAvatarElement;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/avatar/index.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
+
|
|
4
|
+
var _$text, _$image;
|
|
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 '../icon/cancel';
|
|
11
|
+
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
12
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:32px;height:32px;font:var(--sinch-font-title-5);line-height:30px;color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-700);text-align:center;border-radius:50%;border:1px solid var(--sinch-color-snow-100);box-sizing:border-box;overflow:hidden}:host([background=blue]) #wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}:host([background=yellow]) #wrapper{background-color:var(--sinch-color-honey-500)}:host([size="l"]) #wrapper{width:40px;height:40px;font:var(--sinch-font-title-4);line-height:38px}:host([size="s"]) #wrapper{width:24px;height:24px;font:var(--sinch-font-extra-small-text);line-height:22px}#text{display:block;width:100%;height:100%;box-sizing:border-box}#image{display:none;width:100%;height:100%;object-fit:contain;position:absolute;left:0;top:0}:host([src]:not([src=""])) #image{display:block}</style><div id="wrapper"><span id="text"></span><img id="image" alt=""/></div>';
|
|
13
|
+
const backgroundValues = ['grey', 'yellow', 'blue'];
|
|
14
|
+
const sizeValues = ['l', 'm', 's'];
|
|
15
|
+
const template = document.createElement('template');
|
|
16
|
+
template.innerHTML = templateHTML;
|
|
17
|
+
defineCustomElement('sinch-avatar', (_$text = new WeakMap(), _$image = new WeakMap(), class extends HTMLElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
_classPrivateFieldInitSpec(this, _$text, {
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
_classPrivateFieldInitSpec(this, _$image, {
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const shadowRoot = this.attachShadow({
|
|
32
|
+
mode: 'closed'
|
|
33
|
+
});
|
|
34
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
35
|
+
|
|
36
|
+
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
37
|
+
|
|
38
|
+
_classPrivateFieldSet(this, _$image, shadowRoot.querySelector('#image'));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get src() {
|
|
42
|
+
return getAttribute(this, 'src', null);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
set src(value) {
|
|
46
|
+
updateAttribute(this, 'src', value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get alt() {
|
|
50
|
+
return getAttribute(this, 'alt', '');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set alt(value) {
|
|
54
|
+
updateAttribute(this, 'alt', value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get background() {
|
|
58
|
+
return getLiteralAttribute(this, backgroundValues, 'background', 'grey');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set background(value) {
|
|
62
|
+
updateLiteralAttribute(this, backgroundValues, 'background', value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get size() {
|
|
66
|
+
return getLiteralAttribute(this, sizeValues, 'size', 'm');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
set size(value) {
|
|
70
|
+
updateLiteralAttribute(this, sizeValues, 'size', value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static get observedAttributes() {
|
|
74
|
+
return ['alt', 'src'];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
attributeChangedCallback(name, _, newVal) {
|
|
78
|
+
switch (name) {
|
|
79
|
+
case 'alt':
|
|
80
|
+
{
|
|
81
|
+
_classPrivateFieldGet(this, _$text).textContent = newVal;
|
|
82
|
+
_classPrivateFieldGet(this, _$image).alt = newVal ?? '';
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
case 'src':
|
|
87
|
+
{
|
|
88
|
+
_classPrivateFieldGet(this, _$image).src = newVal ?? '';
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}));
|
package/colors.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colorHoney700": "#CC8800",
|
|
3
|
+
"colorHoney600": "#FFAA00",
|
|
4
|
+
"colorHoney500": "#FFBE3C",
|
|
5
|
+
"colorHoney400": "#FFCC66",
|
|
6
|
+
"colorHoney300": "#FFDD99",
|
|
7
|
+
"colorHoney200": "#FFEECC",
|
|
8
|
+
"colorHoney100": "#FFF7E6",
|
|
9
|
+
"colorTropical700": "#003D3D",
|
|
10
|
+
"colorTropical600": "#005757",
|
|
11
|
+
"colorTropical500": "#007171",
|
|
12
|
+
"colorTropical400": "#338D8D",
|
|
13
|
+
"colorTropical300": "#66AAAA",
|
|
14
|
+
"colorTropical200": "#99C6C6",
|
|
15
|
+
"colorTropical100": "#CCE3E3",
|
|
16
|
+
"colorStormy600": "#061927",
|
|
17
|
+
"colorStormy500": "#0A273D",
|
|
18
|
+
"colorStormy400": "#3B5264",
|
|
19
|
+
"colorStormy300": "#677784",
|
|
20
|
+
"colorStormy200": "#7F8F99",
|
|
21
|
+
"colorStormy100": "#9CA8B0",
|
|
22
|
+
"colorSnow800": "#C6CDD2",
|
|
23
|
+
"colorSnow700": "#D4DADD",
|
|
24
|
+
"colorSnow600": "#E3E6E8",
|
|
25
|
+
"colorSnow500": "#F1F3F4",
|
|
26
|
+
"colorSnow100": "#FFFFFF",
|
|
27
|
+
"colorRaspberry700": "#881125",
|
|
28
|
+
"colorRaspberry600": "#B61631",
|
|
29
|
+
"colorRaspberry500": "#E31C3D",
|
|
30
|
+
"colorRaspberry400": "#E94964",
|
|
31
|
+
"colorRaspberry300": "#EE778B",
|
|
32
|
+
"colorRaspberry200": "#F4A4B1",
|
|
33
|
+
"colorRaspberry100": "#F9D2D8",
|
|
34
|
+
"colorTextDefault": "#0A273D",
|
|
35
|
+
"colorTextInverted": "#FFFFFF",
|
|
36
|
+
"colorTextMuted": "#677784",
|
|
37
|
+
"colorTextLink": "#007171",
|
|
38
|
+
"colorTextInvalid": "#E31C3D",
|
|
39
|
+
"colorError800": "#57000E",
|
|
40
|
+
"colorError500": "#E31C3D",
|
|
41
|
+
"colorError200": "#FCD7D4",
|
|
42
|
+
"colorSuccess700": "#005419",
|
|
43
|
+
"colorSuccess500": "#2E8540",
|
|
44
|
+
"colorSuccess200": "#D7F1D8",
|
|
45
|
+
"colorInformative700": "#003B7E",
|
|
46
|
+
"colorInformative500": "#2071CE",
|
|
47
|
+
"colorInformative200": "#D5E5F8",
|
|
48
|
+
"colorWarning700": "#9C2E00",
|
|
49
|
+
"colorWarning500": "#F35B1C",
|
|
50
|
+
"colorWarning200": "#FFE8D6",
|
|
51
|
+
"colorNight400": "#3247E9",
|
|
52
|
+
"colorNight200": "#D1D6FA",
|
|
53
|
+
"colorAqua400": "#3DAED8",
|
|
54
|
+
"colorAqua200": "#AADBEE",
|
|
55
|
+
"colorGrass400": "#39B93D",
|
|
56
|
+
"colorGrass200": "#B4E4B5",
|
|
57
|
+
"colorDirt400": "#828282",
|
|
58
|
+
"colorDirt200": "#E0DDDC",
|
|
59
|
+
"colorBerry400": "#F95252",
|
|
60
|
+
"colorBerry200": "#FCA7A7",
|
|
61
|
+
"colorCandy400": "#E467C3",
|
|
62
|
+
"colorCandy200": "#F6CBEA",
|
|
63
|
+
"colorMud400": "#8B6559",
|
|
64
|
+
"colorMud200": "#D7C6C1",
|
|
65
|
+
"colorOrange400": "#FF8C34",
|
|
66
|
+
"colorOrange200": "#FFD4B3",
|
|
67
|
+
"colorBolt400": "#FFBE3C",
|
|
68
|
+
"colorBolt200": "#FFE6B3"
|
|
69
|
+
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/input/index.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare type TSinchInputElement = HTMLElement & {
|
|
|
11
11
|
invalidText: string | null;
|
|
12
12
|
additionalText: string | null;
|
|
13
13
|
disabled: boolean;
|
|
14
|
+
selectionStart: HTMLInputElement['selectionStart'];
|
|
15
|
+
selectionEnd: HTMLInputElement['selectionEnd'];
|
|
16
|
+
selectionDirection: HTMLInputElement['selectionDirection'];
|
|
14
17
|
focus(): void;
|
|
15
18
|
blur(): void;
|
|
16
19
|
};
|
package/input/index.js
CHANGED
|
@@ -208,6 +208,30 @@ defineCustomElement('sinch-input', (_$input = new WeakMap(), _$label = new WeakM
|
|
|
208
208
|
return getBooleanAttribute(this, 'disabled');
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
get selectionStart() {
|
|
212
|
+
return _classPrivateFieldGet(this, _$input).selectionStart;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
set selectionStart(value) {
|
|
216
|
+
_classPrivateFieldGet(this, _$input).selectionStart = value;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
get selectionEnd() {
|
|
220
|
+
return _classPrivateFieldGet(this, _$input).selectionEnd;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
set selectionEnd(value) {
|
|
224
|
+
_classPrivateFieldGet(this, _$input).selectionEnd = value;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
get selectionDirection() {
|
|
228
|
+
return _classPrivateFieldGet(this, _$input).selectionDirection;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
set selectionDirection(value) {
|
|
232
|
+
_classPrivateFieldGet(this, _$input).selectionDirection = value;
|
|
233
|
+
}
|
|
234
|
+
|
|
211
235
|
attributeChangedCallback(name, _, newVal) {
|
|
212
236
|
switch (name) {
|
|
213
237
|
case 'type':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nectary/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"theme.css",
|
|
6
6
|
"**/*/*.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"utils.d.ts",
|
|
10
10
|
"index.js",
|
|
11
11
|
"index.d.ts",
|
|
12
|
-
"types.d.ts"
|
|
12
|
+
"types.d.ts",
|
|
13
|
+
"colors.json"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"prebuild": "rimraf utils.{js,d.ts} index.{js,d.ts} */*.{js,d.ts} */**/*.{js,d.ts}",
|
package/search/index.d.ts
CHANGED
package/search/index.js
CHANGED
|
@@ -13,9 +13,10 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
13
13
|
|
|
14
14
|
import { isSearchOptionElement } from '../search-option';
|
|
15
15
|
import { attrValueToPixels, defineCustomElement, getAttribute, getIntegerAttribute, getRect, updateAttribute, updateIntegerAttribute } from '../utils';
|
|
16
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:100%;box-sizing:border-box;--sinch-size-icon:24px}#label{display:none;font:var(--sinch-font-title-4);color:var(--sinch-color-text-default);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;height:24px;margin-bottom:2px}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;height:48px;padding:0 44px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto)}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:focus{border-color:var(--sinch-color-stormy-600)}#icon-search{position:absolute;left:12px;top:12px;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-500)}#clear{
|
|
16
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;width:100%;box-sizing:border-box;--sinch-size-icon:24px}#label{display:none;font:var(--sinch-font-title-4);color:var(--sinch-color-text-default);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;height:24px;margin-bottom:2px}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;height:48px;padding:0 44px;padding-right:12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto)}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:focus{border-color:var(--sinch-color-stormy-600)}#icon-search{position:absolute;left:12px;top:12px;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-500)}#clear{position:absolute;right:8px;top:8px;display:none;--sinch-color-icon:red}#clear:focus{--sinch-color-icon:var(--sinch-color-stormy-500)}:host([value]:not([value=""])) #clear{display:flex}:host([value]:not([value=""])) #input{padding-right:44px}#listbox{display:none;position:absolute;z-index:1;left:0;top:calc(100% + 8px);width:100%;box-sizing:border-box;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);box-shadow:1px 2px 4px rgb(0 0 0 / 15%);overflow-y:auto;contain:content}:host([aria-expanded=true]) #listbox{display:block}:host([label]:not([label=""])) #label{display:block}</style><label id="label" for="input"></label><div id="wrapper"><input id="input" type="text"/><sinch-icon-search id="icon-search"></sinch-icon-search><sinch-icon-button id="clear" small><sinch-icon-close id="icon-close" slot="icon"></sinch-icon-close></sinch-icon-button><div id="listbox"><slot name="option"></slot></div></div>';
|
|
17
17
|
import '../icon/search';
|
|
18
18
|
import '../icon/close';
|
|
19
|
+
import '../icon-button';
|
|
19
20
|
const ITEM_HEIGHT = 40;
|
|
20
21
|
|
|
21
22
|
const findSelectedOption = elements => {
|
package/textarea/index.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export declare type TSinchTextareaElement = HTMLElement & {
|
|
|
8
8
|
invalidText: string | null;
|
|
9
9
|
additionalText: string | null;
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
selectionStart: HTMLTextAreaElement['selectionStart'];
|
|
12
|
+
selectionEnd: HTMLTextAreaElement['selectionEnd'];
|
|
13
|
+
selectionDirection: HTMLTextAreaElement['selectionDirection'];
|
|
14
|
+
rows: HTMLTextAreaElement['rows'];
|
|
15
|
+
resizable: boolean;
|
|
11
16
|
focus(): void;
|
|
12
17
|
blur(): void;
|
|
13
18
|
};
|
|
@@ -20,6 +25,8 @@ export declare type TSinchTextareaReact = TSinchElementReact<TSinchTextareaEleme
|
|
|
20
25
|
additionalText?: string;
|
|
21
26
|
disabled?: boolean;
|
|
22
27
|
'aria-label': string;
|
|
28
|
+
rows?: number;
|
|
29
|
+
resizable?: boolean;
|
|
23
30
|
onChange: (e: SyntheticEvent<TSinchTextareaElement, CustomEvent<string>>) => void;
|
|
24
31
|
onKeyPress?: DOMAttributes<TSinchTextareaElement>['onKeyPress'];
|
|
25
32
|
onFocus?: (e: FocusEvent<TSinchTextareaElement>) => void;
|
package/textarea/index.js
CHANGED
|
@@ -7,8 +7,8 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;
|
|
10
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, isAttrTrue, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0;--sinch-color-icon:var(--sinch-color-stormy-500)}#wrapper{width:100%;box-sizing:border-box}#input{all:initial;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:4px;width:100%;margin:2px 0;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);caret-color:var(--sinch-caret-color,auto);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted)}#input:disabled{border-color:var(--sinch-color-snow-500);color:var(--sinch-color-stormy-100)}#input:disabled::placeholder{color:var(--sinch-color-snow-500)}#input:focus{border-color:var(--sinch-color-stormy-600)}:host([resizable]:not([resizable=false])) #input{resize:vertical}:host([invalidtext]:not([invalidtext=""])) #input:not(:disabled){border-color:var(--sinch-color-text-invalid)}#bottom,#top{display:flex;align-items:baseline}#top{height:24px}#bottom{height:20px}#additional,#invalid,#label,#optional{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#label{font:var(--sinch-font-title-4);color:var(--sinch-color-text-default)}#optional{flex:1;text-align:right;font:var(--sinch-font-small-text);color:var(--sinch-color-text-muted)}#additional{flex:1;text-align:right;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-muted)}#invalid{font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-invalid)}::slotted(sinch-help-tooltip){align-self:center;margin:0 8px}:host([disabled]:not([disabled=false])) :is(#label,#additional,#optional,#invalid){color:var(--sinch-color-stormy-100)}:host([disabled]:not([disabled=false])){--sinch-color-icon:var(--sinch-color-stormy-100)}</style><div id="wrapper"><div id="top"><label id="label" for="input"></label><slot name="tooltip"></slot><span id="optional"></span></div><textarea id="input"></textarea><div id="bottom"><span id="invalid"></span> <span id="additional"></span></div></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new WeakMap(), _$optionalText = new WeakMap(), _$additionalText = new WeakMap(), _$invalidText = new WeakMap(), _selectionStart = new WeakMap(), _selectionEnd = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onInput = new WeakMap(), class extends HTMLElement {
|
|
@@ -137,7 +137,7 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
static get observedAttributes() {
|
|
140
|
-
return ['value', 'placeholder', 'label', 'optionaltext', 'additionaltext', 'invalidtext', 'disabled'];
|
|
140
|
+
return ['value', 'placeholder', 'label', 'optionaltext', 'additionaltext', 'invalidtext', 'disabled', 'rows'];
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -195,6 +195,12 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
195
195
|
_classPrivateFieldGet(this, _$input).disabled = isAttrTrue(newVal);
|
|
196
196
|
break;
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
case 'rows':
|
|
200
|
+
{
|
|
201
|
+
updateAttribute(_classPrivateFieldGet(this, _$input), 'rows', newVal);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -258,6 +264,46 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
258
264
|
return getBooleanAttribute(this, 'disabled');
|
|
259
265
|
}
|
|
260
266
|
|
|
267
|
+
set resizable(isResizable) {
|
|
268
|
+
updateBooleanAttribute(this, 'resizable', isResizable);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
get resizable() {
|
|
272
|
+
return getBooleanAttribute(this, 'resizable');
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
set rows(value) {
|
|
276
|
+
updateAttribute(this, 'rows', value);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
get rows() {
|
|
280
|
+
return getIntegerAttribute(this, 'rows', 0);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
get selectionStart() {
|
|
284
|
+
return _classPrivateFieldGet(this, _$input).selectionStart;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
set selectionStart(value) {
|
|
288
|
+
_classPrivateFieldGet(this, _$input).selectionStart = value;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
get selectionEnd() {
|
|
292
|
+
return _classPrivateFieldGet(this, _$input).selectionEnd;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
set selectionEnd(value) {
|
|
296
|
+
_classPrivateFieldGet(this, _$input).selectionEnd = value;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
get selectionDirection() {
|
|
300
|
+
return _classPrivateFieldGet(this, _$input).selectionDirection;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
set selectionDirection(value) {
|
|
304
|
+
_classPrivateFieldGet(this, _$input).selectionDirection = value;
|
|
305
|
+
}
|
|
306
|
+
|
|
261
307
|
focus() {
|
|
262
308
|
_classPrivateFieldGet(this, _$input).focus();
|
|
263
309
|
}
|