@nectary/components 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/index.js +1 -1
- package/avatar-badge/index.js +1 -1
- package/avatar-status/index.js +1 -1
- package/button/types.d.ts +6 -0
- package/chat-avatar/index.js +1 -1
- package/dialog/index.js +1 -1
- package/dropdown-text-option/index.js +1 -1
- package/field/index.d.ts +11 -0
- package/field/index.js +144 -0
- package/field/types.d.ts +35 -0
- package/field/types.js +1 -0
- package/illustrations/create-illustration-class.js +1 -1
- package/inline-alert/index.js +1 -1
- package/input/index.js +10 -82
- package/input/types.d.ts +10 -24
- package/link/index.d.ts +1 -0
- package/link/index.js +19 -12
- package/link/types.d.ts +29 -0
- package/package.json +2 -2
- package/popover/index.js +102 -70
- package/search/index.js +1 -1
- package/select/index.d.ts +1 -0
- package/select/index.js +12 -94
- package/select/types.d.ts +10 -24
- package/select-option/types.d.ts +26 -3
- package/tag/index.js +1 -1
- package/textarea/index.js +15 -83
- package/textarea/types.d.ts +28 -12
- package/time-picker/index.js +8 -0
- package/utils.d.ts +1 -0
- package/utils.js +8 -0
- package/vertical-stepper-item/index.js +1 -1
package/select/types.d.ts
CHANGED
|
@@ -3,16 +3,10 @@ import type { SyntheticEvent } from 'react';
|
|
|
3
3
|
export declare type TSinchSelectElement = HTMLElement & {
|
|
4
4
|
/** Value that matches one of the options `value` */
|
|
5
5
|
value: string;
|
|
6
|
-
/** Label */
|
|
7
|
-
label: string;
|
|
8
6
|
/** Text that appears when it has no value set */
|
|
9
7
|
placeholder: string | null;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/** Additional text */
|
|
13
|
-
additionalText: string | null;
|
|
14
|
-
/** Invalid text, controls the overall invalid state */
|
|
15
|
-
invalidText: string | null;
|
|
8
|
+
/** Invalid state */
|
|
9
|
+
invalid: boolean;
|
|
16
10
|
/** Disabled */
|
|
17
11
|
disabled: boolean;
|
|
18
12
|
/** Number of visible at the same time options in the list */
|
|
@@ -20,20 +14,16 @@ export declare type TSinchSelectElement = HTMLElement & {
|
|
|
20
14
|
readonly dropdownRect: TRect;
|
|
21
15
|
/** Change value event */
|
|
22
16
|
addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
|
|
17
|
+
/** Focus event */
|
|
23
18
|
addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
|
|
19
|
+
/** Blur event */
|
|
24
20
|
addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
|
|
25
21
|
/** Value that matches one of the options `value` */
|
|
26
22
|
setAttribute(name: 'value', value: string): void;
|
|
27
|
-
/** Label */
|
|
28
|
-
setAttribute(name: 'label', value: string): void;
|
|
29
23
|
/** Text that appears when it has no value set */
|
|
30
24
|
setAttribute(name: 'placeholder', value: string): void;
|
|
31
|
-
/**
|
|
32
|
-
setAttribute(name: '
|
|
33
|
-
/** Additional text */
|
|
34
|
-
setAttribute(name: 'additionaltext', value: string): void;
|
|
35
|
-
/** Invalid text, controls the overall invalid state */
|
|
36
|
-
setAttribute(name: 'invalidtext', value: string): void;
|
|
25
|
+
/** Invalid state */
|
|
26
|
+
setAttribute(name: 'invalid', value: ''): void;
|
|
37
27
|
/** Disabled */
|
|
38
28
|
setAttribute(name: 'disabled', value: ''): void;
|
|
39
29
|
/** Number of visible at the same time options in the list */
|
|
@@ -42,18 +32,12 @@ export declare type TSinchSelectElement = HTMLElement & {
|
|
|
42
32
|
export declare type TSinchSelectReact = TSinchElementReact<TSinchSelectElement> & {
|
|
43
33
|
/** Value that matches one of the options `value` */
|
|
44
34
|
value: string;
|
|
45
|
-
/** Label */
|
|
46
|
-
label: string;
|
|
47
35
|
/** Label that is used for a11y – might be different from `label` */
|
|
48
36
|
'aria-label': string;
|
|
49
37
|
/** Text that appears when it has no value set */
|
|
50
38
|
placeholder?: string;
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/** Additional text */
|
|
54
|
-
additionalText?: string;
|
|
55
|
-
/** Invalid text, controls the overall invalid state */
|
|
56
|
-
invalidText?: string;
|
|
39
|
+
/** Invalid state */
|
|
40
|
+
invalid?: boolean;
|
|
57
41
|
/** Disabled */
|
|
58
42
|
disabled?: boolean;
|
|
59
43
|
/** Number of visible at the same time options in the list */
|
|
@@ -62,6 +46,8 @@ export declare type TSinchSelectReact = TSinchElementReact<TSinchSelectElement>
|
|
|
62
46
|
onChange?: (e: SyntheticEvent<TSinchSelectElement, CustomEvent<string>>) => void;
|
|
63
47
|
/** Change value handler */
|
|
64
48
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
49
|
+
/** Focus handler */
|
|
65
50
|
'on-focus'?: (e: CustomEvent<void>) => void;
|
|
51
|
+
/** Blur handler */
|
|
66
52
|
'on-blur'?: (e: CustomEvent<void>) => void;
|
|
67
53
|
};
|
package/select-option/types.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare type TSinchSelectOptionElement =
|
|
3
|
-
|
|
1
|
+
import type { TSinchElementReact } from '../types';
|
|
2
|
+
export declare type TSinchSelectOptionElement = HTMLElement & {
|
|
3
|
+
/** Value */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Text */
|
|
6
|
+
text: string;
|
|
7
|
+
/** Disabled */
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
readonly icon: Element | null;
|
|
10
|
+
/** Value */
|
|
11
|
+
setAttribute(name: 'value', value: string): void;
|
|
12
|
+
/** Text */
|
|
13
|
+
setAttribute(name: 'text', value: string): void;
|
|
14
|
+
/** Disabled */
|
|
15
|
+
setAttribute(name: 'disabled', value: ''): void;
|
|
16
|
+
};
|
|
17
|
+
export declare type TSinchSelectOptionReact = TSinchElementReact<TSinchSelectOptionElement> & {
|
|
18
|
+
/** Value */
|
|
19
|
+
value: string;
|
|
20
|
+
/** Text */
|
|
21
|
+
text: string;
|
|
22
|
+
/** Disabled */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Label that is used for a11y */
|
|
25
|
+
'aria-label': string;
|
|
26
|
+
};
|
package/tag/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
9
9
|
|
|
10
10
|
import '../icons/cancel';
|
|
11
11
|
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
12
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;padding:2px 8px;border-radius:12px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);box-sizing:border-box;--sinch-color-icon:var(--sinch-color-stormy-400);--sinch-size-icon:16px}:host([category=candy])>#wrapper{background-color:var(--sinch-color-candy-200)}:host([category=bolt])>#wrapper{background-color:var(--sinch-color-bolt-200)}:host([category=aqua])>#wrapper{background-color:var(--sinch-color-aqua-200)}:host([category=grass])>#wrapper{background-color:var(--sinch-color-grass-200)}:host([category=berry])>#wrapper{background-color:var(--sinch-color-berry-200)}:host([category=orange])>#wrapper{background-color:var(--sinch-color-orange-200)}:host([category=night])>#wrapper{background-color:var(--sinch-color-night-200)}:host([category=mud])>#wrapper{background-color:var(--sinch-color-mud-200)}:host([category=dirt])>#wrapper{background-color:var(--sinch-color-dirt-200)}:host([inverted]:not([inverted=false]))>#wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-snow-100)}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px;--sinch-size-icon:14px}#text{text-overflow:ellipsis;white-space:nowrap;overflow:
|
|
12
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px;width:100%;height:24px;padding:2px 8px;border-radius:12px;font:var(--sinch-font-extra-small-text);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);box-sizing:border-box;--sinch-color-icon:var(--sinch-color-stormy-400);--sinch-size-icon:16px}:host([category=candy])>#wrapper{background-color:var(--sinch-color-candy-200)}:host([category=bolt])>#wrapper{background-color:var(--sinch-color-bolt-200)}:host([category=aqua])>#wrapper{background-color:var(--sinch-color-aqua-200)}:host([category=grass])>#wrapper{background-color:var(--sinch-color-grass-200)}:host([category=berry])>#wrapper{background-color:var(--sinch-color-berry-200)}:host([category=orange])>#wrapper{background-color:var(--sinch-color-orange-200)}:host([category=night])>#wrapper{background-color:var(--sinch-color-night-200)}:host([category=mud])>#wrapper{background-color:var(--sinch-color-mud-200)}:host([category=dirt])>#wrapper{background-color:var(--sinch-color-dirt-200)}:host([inverted]:not([inverted=false]))>#wrapper{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100);--sinch-color-icon:var(--sinch-color-snow-100)}:host([small]:not([small=false])) #wrapper{height:20px;border-radius:10px;padding:0 8px;--sinch-size-icon:14px}#text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;flex:1}</style><div id="wrapper"><slot name="icon"></slot><span id="text"></span><slot name="close"></slot></div>';
|
|
13
13
|
import { categoryValues } from './utils';
|
|
14
14
|
const template = document.createElement('template');
|
|
15
15
|
template.innerHTML = templateHTML;
|
package/textarea/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$input,
|
|
4
|
+
var _$input, _cursorPos, _isPendingDk, _onCompositionStart, _onSelectionChange, _onInput, _onInputFocus, _onInputBlur, _onChangeReactHandler, _onFocusReactHandler, _onBlurReactHandler;
|
|
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
10
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle
|
|
11
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle}#input{all:initial;display:block;border:1px solid var(--sinch-color-stormy-200);box-sizing:border-box;border-radius:var(--sinch-shape-radius-s);width:100%;padding:8px 12px;font:var(--sinch-font-body);color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-100);resize:none}#input::placeholder{font:var(--sinch-font-body);color:var(--sinch-color-text-muted);opacity:1}#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([invalid]:not([invalid=false])) #input:enabled{border-color:var(--sinch-color-text-invalid)}</style><textarea id="input"></textarea>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-textarea', (_$input = new WeakMap(),
|
|
14
|
+
defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _cursorPos = new WeakMap(), _isPendingDk = new WeakMap(), _onCompositionStart = new WeakMap(), _onSelectionChange = new WeakMap(), _onInput = new WeakMap(), _onInputFocus = new WeakMap(), _onInputBlur = new WeakMap(), _onChangeReactHandler = new WeakMap(), _onFocusReactHandler = new WeakMap(), _onBlurReactHandler = new WeakMap(), class extends NectaryElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
@@ -20,26 +20,6 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
20
20
|
value: void 0
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
_classPrivateFieldInitSpec(this, _$label, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
_classPrivateFieldInitSpec(this, _$optionalText, {
|
|
29
|
-
writable: true,
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
_classPrivateFieldInitSpec(this, _$additionalText, {
|
|
34
|
-
writable: true,
|
|
35
|
-
value: void 0
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
_classPrivateFieldInitSpec(this, _$invalidText, {
|
|
39
|
-
writable: true,
|
|
40
|
-
value: void 0
|
|
41
|
-
});
|
|
42
|
-
|
|
43
23
|
_classPrivateFieldInitSpec(this, _cursorPos, {
|
|
44
24
|
writable: true,
|
|
45
25
|
value: null
|
|
@@ -142,14 +122,6 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
142
122
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
143
123
|
|
|
144
124
|
_classPrivateFieldSet(this, _$input, shadowRoot.querySelector('#input'));
|
|
145
|
-
|
|
146
|
-
_classPrivateFieldSet(this, _$label, shadowRoot.querySelector('#label'));
|
|
147
|
-
|
|
148
|
-
_classPrivateFieldSet(this, _$optionalText, shadowRoot.querySelector('#optional'));
|
|
149
|
-
|
|
150
|
-
_classPrivateFieldSet(this, _$additionalText, shadowRoot.querySelector('#additional'));
|
|
151
|
-
|
|
152
|
-
_classPrivateFieldSet(this, _$invalidText, shadowRoot.querySelector('#invalid'));
|
|
153
125
|
}
|
|
154
126
|
|
|
155
127
|
connectedCallback() {
|
|
@@ -192,10 +164,14 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
192
164
|
}
|
|
193
165
|
|
|
194
166
|
static get observedAttributes() {
|
|
195
|
-
return ['value', 'placeholder', '
|
|
167
|
+
return ['value', 'placeholder', 'invalid', 'disabled', 'rows'];
|
|
196
168
|
}
|
|
197
169
|
|
|
198
|
-
attributeChangedCallback(name,
|
|
170
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
171
|
+
if (oldVal === newVal) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
199
175
|
switch (name) {
|
|
200
176
|
case 'value':
|
|
201
177
|
{
|
|
@@ -217,12 +193,6 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
217
193
|
break;
|
|
218
194
|
}
|
|
219
195
|
|
|
220
|
-
case 'label':
|
|
221
|
-
{
|
|
222
|
-
_classPrivateFieldGet(this, _$label).textContent = newVal;
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
196
|
case 'placeholder':
|
|
227
197
|
{
|
|
228
198
|
_classPrivateFieldGet(this, _$input).placeholder = newVal ?? '';
|
|
@@ -230,23 +200,9 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
230
200
|
break;
|
|
231
201
|
}
|
|
232
202
|
|
|
233
|
-
case '
|
|
234
|
-
{
|
|
235
|
-
_classPrivateFieldGet(this, _$optionalText).textContent = newVal;
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
case 'additionaltext':
|
|
240
|
-
{
|
|
241
|
-
_classPrivateFieldGet(this, _$additionalText).textContent = newVal;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
case 'invalidtext':
|
|
203
|
+
case 'invalid':
|
|
246
204
|
{
|
|
247
|
-
|
|
248
|
-
_classPrivateFieldGet(this, _$invalidText).textContent = newVal;
|
|
249
|
-
updateExplicitBooleanAttribute(this, 'aria-invalid', isInvalid);
|
|
205
|
+
updateExplicitBooleanAttribute(this, 'aria-invalid', isAttrTrue(newVal));
|
|
250
206
|
break;
|
|
251
207
|
}
|
|
252
208
|
|
|
@@ -286,36 +242,12 @@ defineCustomElement('sinch-textarea', (_$input = new WeakMap(), _$label = new We
|
|
|
286
242
|
return getAttribute(this, 'placeholder', null);
|
|
287
243
|
}
|
|
288
244
|
|
|
289
|
-
set
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
get label() {
|
|
294
|
-
return getAttribute(this, 'label', '');
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
set optionalText(value) {
|
|
298
|
-
updateAttribute(this, 'optionaltext', value);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
get optionalText() {
|
|
302
|
-
return getAttribute(this, 'optionaltext', null);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
set additionalText(value) {
|
|
306
|
-
updateAttribute(this, 'additionaltext', value);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
get additionalText() {
|
|
310
|
-
return getAttribute(this, 'additionaltext', null);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
set invalidText(value) {
|
|
314
|
-
updateAttribute(this, 'invalidtext', value);
|
|
245
|
+
set invalid(value) {
|
|
246
|
+
updateBooleanAttribute(this, 'invalid', value);
|
|
315
247
|
}
|
|
316
248
|
|
|
317
|
-
get
|
|
318
|
-
return
|
|
249
|
+
get invalid() {
|
|
250
|
+
return getBooleanAttribute(this, 'invalid');
|
|
319
251
|
}
|
|
320
252
|
|
|
321
253
|
set disabled(isDisabled) {
|
package/textarea/types.d.ts
CHANGED
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
3
|
export declare type TSinchTextareaElement = HTMLElement & {
|
|
4
|
+
/** Value */
|
|
4
5
|
value: string;
|
|
5
|
-
|
|
6
|
+
/** Text that appears in the text field when it has no value set */
|
|
6
7
|
placeholder: string | null;
|
|
7
|
-
|
|
8
|
-
invalidText: string | null;
|
|
9
|
-
additionalText: string | null;
|
|
8
|
+
/** Disabled */
|
|
10
9
|
disabled: boolean;
|
|
10
|
+
/** Invalid state */
|
|
11
|
+
invalid: boolean;
|
|
11
12
|
selectionStart: HTMLTextAreaElement['selectionStart'];
|
|
12
13
|
selectionEnd: HTMLTextAreaElement['selectionEnd'];
|
|
13
14
|
selectionDirection: HTMLTextAreaElement['selectionDirection'];
|
|
15
|
+
/** Number of rows */
|
|
14
16
|
rows: HTMLTextAreaElement['rows'];
|
|
17
|
+
/** Whether the text field is resizable */
|
|
15
18
|
resizable: boolean;
|
|
19
|
+
/** Change value event */
|
|
16
20
|
addEventListener(type: '-change', listener: (e: CustomEvent<string>) => void): void;
|
|
21
|
+
/** Focus event */
|
|
17
22
|
addEventListener(type: '-focus', listener: (e: CustomEvent<void>) => void): void;
|
|
23
|
+
/** Blur event */
|
|
18
24
|
addEventListener(type: '-blur', listener: (e: CustomEvent<void>) => void): void;
|
|
25
|
+
/** Value */
|
|
19
26
|
setAttribute(name: 'value', value: string): void;
|
|
20
|
-
|
|
27
|
+
/** Text that appears in the text field when it has no value set */
|
|
21
28
|
setAttribute(name: 'placeholder', value: string): void;
|
|
22
|
-
|
|
23
|
-
setAttribute(name: '
|
|
24
|
-
|
|
29
|
+
/** Invalid state */
|
|
30
|
+
setAttribute(name: 'invalid', value: ''): void;
|
|
31
|
+
/** Disabled */
|
|
25
32
|
setAttribute(name: 'disabled', value: ''): void;
|
|
33
|
+
/** Number of rows */
|
|
26
34
|
setAttribute(name: 'rows', value: string): void;
|
|
35
|
+
/** Whether the text field is resizable */
|
|
27
36
|
setAttribute(name: 'resizable', value: ''): void;
|
|
28
37
|
};
|
|
29
38
|
export declare type TSinchTextareaReact = TSinchElementReact<TSinchTextareaElement> & {
|
|
39
|
+
/** Value */
|
|
30
40
|
value: string;
|
|
31
|
-
|
|
41
|
+
/** Text that appears in the text field when it has no value set */
|
|
32
42
|
placeholder?: string;
|
|
33
|
-
|
|
34
|
-
invalidText?: string;
|
|
35
|
-
additionalText?: string;
|
|
43
|
+
/** Disabled */
|
|
36
44
|
disabled?: boolean;
|
|
45
|
+
/** Invalid state */
|
|
46
|
+
invalid?: boolean;
|
|
37
47
|
'aria-label': string;
|
|
48
|
+
/** Number of rows */
|
|
38
49
|
rows?: number;
|
|
50
|
+
/** Whether the text field is resizable */
|
|
39
51
|
resizable?: boolean;
|
|
52
|
+
/** @deprecated Change value handler */
|
|
40
53
|
onChange?: (e: SyntheticEvent<TSinchTextareaElement, CustomEvent<string>>) => void;
|
|
54
|
+
/** Change value handler */
|
|
41
55
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
56
|
+
/** Focus handler */
|
|
42
57
|
'on-focus'?: (e: CustomEvent<void>) => void;
|
|
58
|
+
/** Blur handler */
|
|
43
59
|
'on-blur'?: (e: CustomEvent<void>) => void;
|
|
44
60
|
};
|
package/time-picker/index.js
CHANGED
|
@@ -194,6 +194,8 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
|
|
|
194
194
|
switch (e.key) {
|
|
195
195
|
case 'ArrowUp':
|
|
196
196
|
{
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
|
|
197
199
|
_classPrivateFieldSet(this, _hour, (_classPrivateFieldGet(this, _hour) + 1) % 24);
|
|
198
200
|
|
|
199
201
|
_classPrivateMethodGet(this, _render, _render2).call(this);
|
|
@@ -203,6 +205,8 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
|
|
|
203
205
|
|
|
204
206
|
case 'ArrowDown':
|
|
205
207
|
{
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
|
|
206
210
|
_classPrivateFieldSet(this, _hour, (_classPrivateFieldGet(this, _hour) + 23) % 24);
|
|
207
211
|
|
|
208
212
|
_classPrivateMethodGet(this, _render, _render2).call(this);
|
|
@@ -219,6 +223,8 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
|
|
|
219
223
|
switch (e.key) {
|
|
220
224
|
case 'ArrowUp':
|
|
221
225
|
{
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
|
|
222
228
|
_classPrivateFieldSet(this, _minute, (_classPrivateFieldGet(this, _minute) + 1) % 60);
|
|
223
229
|
|
|
224
230
|
_classPrivateMethodGet(this, _render, _render2).call(this);
|
|
@@ -228,6 +234,8 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
|
|
|
228
234
|
|
|
229
235
|
case 'ArrowDown':
|
|
230
236
|
{
|
|
237
|
+
e.preventDefault();
|
|
238
|
+
|
|
231
239
|
_classPrivateFieldSet(this, _minute, (_classPrivateFieldGet(this, _minute) + 59) % 60);
|
|
232
240
|
|
|
233
241
|
_classPrivateMethodGet(this, _render, _render2).call(this);
|
package/utils.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare global {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class NectaryElement extends HTMLElement {
|
|
10
10
|
attachShadow(options?: Partial<ShadowRootInit>): ShadowRoot;
|
|
11
|
+
__version: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const getReactEventHandler: ($element: HTMLElement, handlerName: string) => ((arg?: any) => void) | null;
|
|
13
14
|
export declare const updateExplicitBooleanAttribute: ($element: Element, attrName: string, attrValue: boolean | null | undefined) => void;
|
package/utils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import pkg from './package.json';
|
|
1
3
|
const nectaryDefinitions = new Map();
|
|
2
4
|
let nectaryRegistry = null;
|
|
3
5
|
export const defineCustomElement = (name, constructor) => {
|
|
@@ -27,6 +29,12 @@ export const setNectaryRegistry = registry => {
|
|
|
27
29
|
nectaryDefinitions.clear();
|
|
28
30
|
};
|
|
29
31
|
export class NectaryElement extends HTMLElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, '__version', pkg.version);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
attachShadow(options) {
|
|
31
39
|
return super.attachShadow({
|
|
32
40
|
mode: 'closed',
|
|
@@ -10,7 +10,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
10
10
|
import '../icons/check';
|
|
11
11
|
import '../icons/exclamation';
|
|
12
12
|
import { defineCustomElement, getAttribute, getLiteralAttribute, NectaryElement, updateAttribute, updateLiteralAttribute } from '../utils';
|
|
13
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{position:relative;width:100%;min-height:68px
|
|
13
|
+
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-color-snow-700);font:var(--sinch-font-title-s);line-height:32px;text-align:center;color:var(--sinch-color-stormy-500);border:1px solid transparent;border-radius:50%;box-sizing:border-box;--sinch-icon-size:20px}#label-wrapper{margin-top:4px;min-width:0;flex:1}#label{font:var(--sinch-font-title-s);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#description{font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-300);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon-error,#icon-success{display:none}#content{display:none;padding:16px 0 16px 40px}#progress{position:absolute;width:1px;left:16px;top:32px;bottom:0;background-color:var(--sinch-color-snow-700);transform:translateX(-50%)}#bar{position:absolute;width:1px;height:0;background-color:var(--sinch-color-stormy-400);left:0;top:0}:host(:last-of-type) #progress{display:none}:host([data-progress=active]) #content{display:block}:host([data-progress=active]) #circle{color:var(--sinch-color-snow-100);background-color:var(--sinch-color-stormy-400)}:host([data-progress=done]) #circle{border-color:var(--sinch-color-stormy-400)}:host([data-progress=done]:not([status])) #icon-success{display:block}:host([data-progress=done][status=error]) #circle{background-color:var(--sinch-color-error-200);border-color:var(--sinch-color-stormy-400)}:host([data-progress=done][status=error]) #icon-error{display:block}:host([data-progress=done]:not([status=skip])) #circle-text{display:none}:host([data-progress=done]) #bar{height:100%}</style><div id="wrapper"><div id="progress"><div id="bar"></div></div><div id="circle-wrapper"><div id="circle" aria-hidden="true"><sinch-icon-check id="icon-success"></sinch-icon-check><sinch-icon-exclamation id="icon-error"></sinch-icon-exclamation><span id="circle-text"></span></div><div id="label-wrapper"><div id="label"></div><div id="description"></div></div></div><div id="content"><slot></slot></div></div>';
|
|
14
14
|
import { statusValues } from './utils';
|
|
15
15
|
const template = document.createElement('template');
|
|
16
16
|
template.innerHTML = templateHTML;
|