@nectary/components 0.37.0 → 0.39.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 +1 -0
- package/alert/index.js +1 -1
- package/card/index.d.ts +2 -0
- package/card/index.js +6 -31
- package/date-picker/index.js +42 -2
- package/date-picker/types.d.ts +25 -1
- package/dialog/index.d.ts +1 -0
- package/dialog/index.js +3 -2
- package/dropdown/types.d.ts +2 -0
- package/file-drop/index.d.ts +13 -0
- package/file-drop/index.js +320 -0
- package/file-drop/types.d.ts +50 -0
- package/file-drop/utils.d.ts +2 -0
- package/file-drop/utils.js +37 -0
- package/file-picker/index.d.ts +12 -0
- package/file-picker/index.js +170 -0
- package/file-picker/types.d.ts +32 -0
- package/file-picker/utils.d.ts +1 -0
- package/file-picker/utils.js +9 -0
- package/file-status/index.d.ts +17 -0
- package/file-status/index.js +100 -0
- package/file-status/types.d.ts +18 -0
- package/file-status/utils.d.ts +5 -0
- package/file-status/utils.js +6 -0
- package/icons-branded/easytouse/index.d.ts +11 -0
- package/icons-branded/easytouse/index.js +4 -0
- package/inline-alert/index.js +1 -1
- package/inline-alert/types.d.ts +2 -2
- package/package.json +1 -1
- package/pagination/types.d.ts +1 -0
- package/progress/index.d.ts +17 -0
- package/progress/index.js +87 -0
- package/progress/types.d.ts +12 -0
- package/radio/types.d.ts +1 -0
- package/segment/index.js +1 -1
- package/segment-collapse/types.d.ts +1 -0
- package/segmented-control/types.d.ts +1 -0
- package/segmented-icon-control/types.d.ts +1 -0
- package/select/types.d.ts +1 -1
- package/spinner/index.js +1 -1
- package/tabs/types.d.ts +1 -0
- package/tag/index.d.ts +1 -0
- package/tag/index.js +10 -3
- package/tag/utils.d.ts +3 -0
- package/tag/utils.js +6 -1
- package/tag-close/index.js +5 -1
- package/tag-close/types.d.ts +3 -1
- package/text/index.js +9 -1
- package/text/types.d.ts +3 -0
- package/time-picker/index.js +9 -1
- package/time-picker/types.d.ts +5 -1
- package/title/index.js +10 -2
- package/title/types.d.ts +3 -0
- package/toast/index.d.ts +17 -0
- package/toast/index.js +153 -0
- package/toast/types.d.ts +28 -0
- package/toast/types.js +1 -0
- package/toast/utils.d.ts +5 -0
- package/toast/utils.js +6 -0
- package/toast-manager/index.d.ts +17 -0
- package/toast-manager/index.js +271 -0
- package/toast-manager/types.d.ts +7 -0
- package/toast-manager/types.js +1 -0
- package/toggle/index.js +3 -4
- package/toggle/types.d.ts +1 -0
- package/utils.d.ts +2 -0
- package/utils.js +40 -1
- package/card-button/index.d.ts +0 -11
- package/card-button/index.js +0 -77
- package/card-button/types.d.ts +0 -12
- package/card-link/index.d.ts +0 -12
- package/card-link/index.js +0 -115
- package/card-link/types.d.ts +0 -14
- package/search/index.d.ts +0 -14
- package/search/index.js +0 -523
- package/search/types.d.ts +0 -25
- package/search-option/index.d.ts +0 -11
- package/search-option/index.js +0 -55
- package/search-option/types.d.ts +0 -9
- /package/{card-button → file-drop}/types.js +0 -0
- /package/{card-link → file-picker}/types.js +0 -0
- /package/{search-option → file-status}/types.js +0 -0
- /package/{search → progress}/types.js +0 -0
package/accordion/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare type TSinchAccordionElement = HTMLElement & {
|
|
|
10
10
|
export declare type TSinchAccordionReact = TSinchElementReact<TSinchAccordionElement> & {
|
|
11
11
|
multiple?: boolean;
|
|
12
12
|
value: string;
|
|
13
|
+
/** @deprecated */
|
|
13
14
|
onChange?: (e: SyntheticEvent<TSinchAccordionElement, CustomEvent<string>>) => void;
|
|
14
15
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
15
16
|
};
|
package/alert/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import '../icons/report';
|
|
|
12
12
|
import '../icons/info';
|
|
13
13
|
import '../text';
|
|
14
14
|
import { defineCustomElement, getAttribute, getLiteralAttribute, updateAttribute, updateLiteralAttribute, NectaryElement } from '../utils';
|
|
15
|
-
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:
|
|
15
|
+
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-warning-200)}:host([type=error]) #wrapper{background-color:var(--sinch-color-error-200)}:host([type=info]) #wrapper{background-color:var(--sinch-color-informative-200)}:host([type=warn]) #icon-warn{display:block;--sinch-color-icon:var(--sinch-color-warning-500)}:host([type=error]) #icon-error{display:block;--sinch-color-icon:var(--sinch-color-error-500)}:host([type=info]) #icon-info{display:block;--sinch-color-icon:var(--sinch-color-informative-500)}</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" type="m"></sinch-text><slot name="action"></slot><slot name="close"></slot></div>';
|
|
16
16
|
import { assertType, typeValues } from './utils';
|
|
17
17
|
const template = document.createElement('template');
|
|
18
18
|
template.innerHTML = templateHTML;
|
package/card/index.d.ts
CHANGED
package/card/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$text, _$label, _$caption, _$illustrationSlot, _$
|
|
4
|
+
var _$text, _$label, _$caption, _$illustrationSlot, _$illustrationSlotWrapper, _onIllustrationSlotChange;
|
|
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 '../title';
|
|
11
|
+
import '../text';
|
|
10
12
|
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute, setClass, NectaryElement } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{
|
|
13
|
+
const templateHTML = '<style>:host{display:block;outline:0}#wrapper{border-radius:var(--sinch-shape-radius-l);border:1px solid var(--sinch-color-snow-700);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-level-0);overflow:hidden}:host(:hover) #wrapper{box-shadow:var(--sinch-elevation-level-1)}#card-body{padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px}#illustration-wrapper{display:none;overflow:hidden;height:240px}#illustration-wrapper.active{display:block}#label{color:var(--sinch-color-stormy-300)}#label:empty{display:none}#header{display:flex;flex-direction:row;align-items:center;gap:8px;--sinch-size-icon:48px}#caption{color:var(--sinch-color-stormy-500);flex:1;min-width:0}#description{color:var(--sinch-color-stormy-500);flex:1;min-height:0;max-height:120px;overflow-y:auto}#description:empty{display:none}:host([disabled]:not([disabled=false])) :is(#illustration-wrapper,#description,#header,#label){opacity:.6}slot[name=action]::slotted(*){margin-top:20px;align-self:flex-start;max-width:100%}</style><div id="wrapper"><div id="illustration-wrapper"><slot name="illustration"></slot></div><div id="card-body"><sinch-text id="label" type="s" emphasized ellipsis></sinch-text><div id="header"><slot name="icon"></slot><sinch-title id="caption" type="m" level="3" ellipsis></sinch-title></div><sinch-text id="description" type="m"></sinch-text><slot name="action"></slot></div></div>';
|
|
12
14
|
const template = document.createElement('template');
|
|
13
15
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap(), _$caption = new WeakMap(), _$illustrationSlot = new WeakMap(), _$
|
|
16
|
+
defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap(), _$caption = new WeakMap(), _$illustrationSlot = new WeakMap(), _$illustrationSlotWrapper = new WeakMap(), _onIllustrationSlotChange = new WeakMap(), class extends NectaryElement {
|
|
15
17
|
constructor() {
|
|
16
18
|
super();
|
|
17
19
|
|
|
@@ -35,11 +37,6 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
35
37
|
value: void 0
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
_classPrivateFieldInitSpec(this, _$actionSlot, {
|
|
39
|
-
writable: true,
|
|
40
|
-
value: void 0
|
|
41
|
-
});
|
|
42
|
-
|
|
43
40
|
_classPrivateFieldInitSpec(this, _$illustrationSlotWrapper, {
|
|
44
41
|
writable: true,
|
|
45
42
|
value: void 0
|
|
@@ -52,15 +49,6 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
52
49
|
}
|
|
53
50
|
});
|
|
54
51
|
|
|
55
|
-
_classPrivateFieldInitSpec(this, _updateDisabledAttributeInChildren, {
|
|
56
|
-
writable: true,
|
|
57
|
-
value: () => {
|
|
58
|
-
for (const $el of _classPrivateFieldGet(this, _$actionSlot).assignedElements()) {
|
|
59
|
-
updateAttribute($el, 'disabled', this.getAttribute('disabled'));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
52
|
const shadowRoot = this.attachShadow();
|
|
65
53
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
66
54
|
|
|
@@ -72,21 +60,15 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
72
60
|
|
|
73
61
|
_classPrivateFieldSet(this, _$illustrationSlot, shadowRoot.querySelector('slot[name="illustration"]'));
|
|
74
62
|
|
|
75
|
-
_classPrivateFieldSet(this, _$actionSlot, shadowRoot.querySelector('slot[name="action"]'));
|
|
76
|
-
|
|
77
63
|
_classPrivateFieldSet(this, _$illustrationSlotWrapper, shadowRoot.querySelector('#illustration-wrapper'));
|
|
78
64
|
}
|
|
79
65
|
|
|
80
66
|
connectedCallback() {
|
|
81
67
|
_classPrivateFieldGet(this, _$illustrationSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _onIllustrationSlotChange));
|
|
82
|
-
|
|
83
|
-
_classPrivateFieldGet(this, _$actionSlot).addEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
|
|
84
68
|
}
|
|
85
69
|
|
|
86
70
|
disconnectedCallback() {
|
|
87
71
|
_classPrivateFieldGet(this, _$illustrationSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _onIllustrationSlotChange));
|
|
88
|
-
|
|
89
|
-
_classPrivateFieldGet(this, _$actionSlot).removeEventListener('slotchange', _classPrivateFieldGet(this, _updateDisabledAttributeInChildren));
|
|
90
72
|
}
|
|
91
73
|
|
|
92
74
|
static get observedAttributes() {
|
|
@@ -109,14 +91,7 @@ defineCustomElement('sinch-card', (_$text = new WeakMap(), _$label = new WeakMap
|
|
|
109
91
|
|
|
110
92
|
case 'caption':
|
|
111
93
|
{
|
|
112
|
-
_classPrivateFieldGet(this, _$caption)
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
case 'disabled':
|
|
117
|
-
{
|
|
118
|
-
_classPrivateFieldGet(this, _updateDisabledAttributeInChildren).call(this);
|
|
119
|
-
|
|
94
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
|
|
120
95
|
break;
|
|
121
96
|
}
|
|
122
97
|
}
|
package/date-picker/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import '../icons/delete-outline';
|
|
|
20
20
|
import '../icons/today';
|
|
21
21
|
import '../text';
|
|
22
22
|
import { defineCustomElement, getAttribute, getReactEventHandler, getRect, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
23
|
-
const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"><div id="content-header"><sinch-icon-button
|
|
23
|
+
const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"><div id="content-header"><sinch-icon-button id="prev-year" small><sinch-icon-keyboard-double-arrow-left slot="icon"></sinch-icon-keyboard-double-arrow-left></sinch-icon-button><sinch-icon-button id="prev-month" small><sinch-icon-keyboard-arrow-left slot="icon"></sinch-icon-keyboard-arrow-left></sinch-icon-button><sinch-text id="date" type="m" emphasized aria-live="polite"></sinch-text><sinch-icon-button id="next-month" small><sinch-icon-keyboard-arrow-right slot="icon"></sinch-icon-keyboard-arrow-right></sinch-icon-button><sinch-icon-button id="next-year" small><sinch-icon-keyboard-double-arrow-right slot="icon"></sinch-icon-keyboard-double-arrow-right></sinch-icon-button></div><div id="week-day-names"><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div></div><div id="month"><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div><div class="week"><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button><button class="day"></button></div></div></div>';
|
|
24
24
|
import { areDatesEqual, assertDate, assertLocale, assertMinMax, assertValue, canGoNextMonth, canGoNextYear, canGoPrevMonth, canGoPrevYear, clampMaxDate, clampMinDate, dateToIso, decMonth, decYear, getCalendarMonth, getDayNames, getMonthNames, incMonth, incYear, isDateBetween, isoToDate, isValidDate, today } from './utils';
|
|
25
25
|
const template = document.createElement('template');
|
|
26
26
|
template.innerHTML = templateHTML;
|
|
@@ -220,7 +220,7 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
static get observedAttributes() {
|
|
223
|
-
return ['value', 'min', 'max', 'locale'];
|
|
223
|
+
return ['value', 'min', 'max', 'locale', 'prev-year-aria-label', 'next-year-aria-label', 'prev-month-aria-label', 'next-month-aria-label'];
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
attributeChangedCallback(name, prevValue, newVal) {
|
|
@@ -301,6 +301,30 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
|
|
|
301
301
|
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
304
|
+
|
|
305
|
+
case 'prev-year-aria-label':
|
|
306
|
+
{
|
|
307
|
+
updateAttribute(_classPrivateFieldGet(this, _$prevYear), 'aria-label', newVal);
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
case 'next-year-aria-label':
|
|
312
|
+
{
|
|
313
|
+
updateAttribute(_classPrivateFieldGet(this, _$nextYear), 'aria-label', newVal);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
case 'prev-month-aria-label':
|
|
318
|
+
{
|
|
319
|
+
updateAttribute(_classPrivateFieldGet(this, _$prevMonth), 'aria-label', newVal);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
case 'next-month-aria-label':
|
|
324
|
+
{
|
|
325
|
+
updateAttribute(_classPrivateFieldGet(this, _$nextMonth), 'aria-label', newVal);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
304
328
|
}
|
|
305
329
|
}
|
|
306
330
|
|
|
@@ -340,6 +364,22 @@ defineCustomElement('sinch-date-picker', (_$month = new WeakMap(), _$weeks = new
|
|
|
340
364
|
return getAttribute(this, 'max', '');
|
|
341
365
|
}
|
|
342
366
|
|
|
367
|
+
set prevMonthAriaLabel(value) {
|
|
368
|
+
updateAttribute(this, 'prev-month-aria-label', value);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
get prevMonthAriaLabel() {
|
|
372
|
+
return getAttribute(this, 'prev-month-aria-label', '');
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
set nextMonthAriaLabel(value) {
|
|
376
|
+
updateAttribute(this, 'next-month-aria-label', value);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
get nextMonthAriaLabel() {
|
|
380
|
+
return getAttribute(this, 'next-month-aria-label', '');
|
|
381
|
+
}
|
|
382
|
+
|
|
343
383
|
get prevYearButtonRect() {
|
|
344
384
|
return getRect(_classPrivateFieldGet(this, _$prevYear));
|
|
345
385
|
}
|
package/date-picker/types.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export declare type TSinchDatePickerElement = HTMLElement & {
|
|
|
9
9
|
max: string;
|
|
10
10
|
/** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
|
|
11
11
|
locale: string;
|
|
12
|
+
/** Label that is used for a11y */
|
|
13
|
+
prevYearAriaLabel: string;
|
|
14
|
+
/** Label that is used for a11y */
|
|
15
|
+
nextYearAriaLabel: string;
|
|
16
|
+
/** Label that is used for a11y */
|
|
17
|
+
prevMonthAriaLabel: string;
|
|
18
|
+
/** Label that is used for a11y */
|
|
19
|
+
nextMonthAriaLabel: string;
|
|
12
20
|
readonly prevYearButtonRect: TRect;
|
|
13
21
|
readonly nextYearButtonRect: TRect;
|
|
14
22
|
readonly prevMonthButtonRect: TRect;
|
|
@@ -24,6 +32,14 @@ export declare type TSinchDatePickerElement = HTMLElement & {
|
|
|
24
32
|
setAttribute(name: 'max', value: string): void;
|
|
25
33
|
/** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
|
|
26
34
|
setAttribute(name: 'locale', value: string): void;
|
|
35
|
+
/** Label that is used for a11y */
|
|
36
|
+
setAttribute(name: 'prev-year-aria-label', value: string): void;
|
|
37
|
+
/** Label that is used for a11y */
|
|
38
|
+
setAttribute(name: 'next-year-aria-label', value: string): void;
|
|
39
|
+
/** Label that is used for a11y */
|
|
40
|
+
setAttribute(name: 'prev-month-aria-label', value: string): void;
|
|
41
|
+
/** Label that is used for a11y */
|
|
42
|
+
setAttribute(name: 'next-month-aria-label', value: string): void;
|
|
27
43
|
};
|
|
28
44
|
export declare type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerElement> & {
|
|
29
45
|
/** Date value in ISO 8601 format */
|
|
@@ -36,7 +52,15 @@ export declare type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerE
|
|
|
36
52
|
locale: string;
|
|
37
53
|
/** Label that is used for a11y */
|
|
38
54
|
'aria-label': string;
|
|
39
|
-
/**
|
|
55
|
+
/** Label that is used for a11y */
|
|
56
|
+
'prev-year-aria-label': string;
|
|
57
|
+
/** Label that is used for a11y */
|
|
58
|
+
'next-year-aria-label': string;
|
|
59
|
+
/** Label that is used for a11y */
|
|
60
|
+
'prev-month-aria-label': string;
|
|
61
|
+
/** Label that is used for a11y */
|
|
62
|
+
'next-month-aria-label': string;
|
|
63
|
+
/** @deprecated Change value handler, return date in ISO 8601 format */
|
|
40
64
|
onChange?: (e: SyntheticEvent<TSinchDatePickerElement, CustomEvent<string>>) => void;
|
|
41
65
|
/** Change value handler, return date in ISO 8601 format */
|
|
42
66
|
'on-change'?: (e: CustomEvent<string>) => void;
|
package/dialog/index.d.ts
CHANGED
package/dialog/index.js
CHANGED
|
@@ -15,8 +15,9 @@ import dialogPolyfill from 'dialog-polyfill';
|
|
|
15
15
|
import '../icon-button';
|
|
16
16
|
import '../icons/close';
|
|
17
17
|
import '../stop-events';
|
|
18
|
+
import '../title';
|
|
18
19
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getRect, isAttrTrue, updateAttribute, getReactEventHandler, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
19
|
-
const templateHTML = '<style>:host{display:inline-block}dialog{position:fixed;left:0;right:0;margin:auto;display:flex;flex-direction:column;padding:24px;max-width:var(--sinch-dialog-max-width,512px);max-height:unset;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;contain:content;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:var(--sinch-elevation-level-3)}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.55}dialog::backdrop{background-color:#000;opacity:.55}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}#header{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;margin-bottom:16px}#caption{
|
|
20
|
+
const templateHTML = '<style>:host{display:inline-block}dialog{position:fixed;left:0;right:0;margin:auto;display:flex;flex-direction:column;padding:24px;max-width:var(--sinch-dialog-max-width,512px);max-height:unset;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;contain:content;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:var(--sinch-elevation-level-3)}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.55}dialog::backdrop{background-color:#000;opacity:.55}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}#header{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;margin-bottom:16px}#caption{color:var(--sinch-color-text-default)}#content{min-height:0;overflow:auto;max-height:var(--sinch-dialog-max-height,50vh)}#buttons{display:flex;flex-direction:row;justify-content:flex-end;gap:16px;margin-top:24px}sinch-icon-button{transform:translate(4px,-4px)}</style><dialog><div id="header"><sinch-title id="caption" type="m" level="3" ellipsis></sinch-title><sinch-icon-button id="close" small tabindex="0"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></div><div id="content"><sinch-stop-events events="close"><slot name="content"></slot></sinch-stop-events></div><div id="buttons"><sinch-stop-events events="close"><slot name="buttons"></slot></sinch-stop-events></div></dialog>';
|
|
20
21
|
const template = document.createElement('template');
|
|
21
22
|
template.innerHTML = templateHTML;
|
|
22
23
|
defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = new WeakMap(), _$caption = new WeakMap(), _isConnected = new WeakMap(), _prevOverflowValue = new WeakMap(), _onCancel = new WeakMap(), _onCloseClick = new WeakMap(), _onBackdropClick = new WeakMap(), _onCloseReactHandler = new WeakMap(), _dispatchCloseEvent = new WeakSet(), _setOpen = new WeakSet(), class extends NectaryElement {
|
|
@@ -142,7 +143,7 @@ defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = n
|
|
|
142
143
|
switch (name) {
|
|
143
144
|
case 'caption':
|
|
144
145
|
{
|
|
145
|
-
_classPrivateFieldGet(this, _$caption)
|
|
146
|
+
updateAttribute(_classPrivateFieldGet(this, _$caption), 'text', newVal);
|
|
146
147
|
break;
|
|
147
148
|
}
|
|
148
149
|
|
package/dropdown/types.d.ts
CHANGED
|
@@ -23,8 +23,10 @@ export declare type TSinchDropdownReact = TSinchElementReact<TSinchDropdownEleme
|
|
|
23
23
|
value: string;
|
|
24
24
|
maxVisibleItems?: number;
|
|
25
25
|
'aria-label': string;
|
|
26
|
+
/** @deprecated */
|
|
26
27
|
onClose?: () => void;
|
|
27
28
|
'on-close'?: (e: CustomEvent<void>) => void;
|
|
29
|
+
/** @deprecated */
|
|
28
30
|
onChange?: (e: SyntheticEvent<TSinchDropdownElement, CustomEvent<string>>) => void;
|
|
29
31
|
'on-change'?: (e: CustomEvent<string>) => void;
|
|
30
32
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '../text';
|
|
2
|
+
import '../file-picker';
|
|
3
|
+
import type { TSinchFileDropElement, TSinchFileDropReact } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'sinch-file-drop': TSinchFileDropReact;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sinch-file-drop': TSinchFileDropElement;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
+
|
|
4
|
+
var _$filePicker, _$dropArea, _$placeholder, _setDragEffect, _onDragEnter, _onDragLeave, _onDragOver, _onDrop, _onFilePickerChange, _onFilePickerInvalid, _onChangeReactHandler, _onInvalidReactHandler, _dispatchChangeEvent, _dispatchInvalidEvent;
|
|
5
|
+
|
|
6
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
7
|
+
|
|
8
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
9
|
+
|
|
10
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
11
|
+
|
|
12
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
13
|
+
|
|
14
|
+
import '../text';
|
|
15
|
+
import '../file-picker';
|
|
16
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getIntegerAttribute, getReactEventHandler, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
17
|
+
const templateHTML = '<style>:host{display:block}#wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;align-content:center;gap:8px;height:148px;min-width:148px;box-sizing:border-box;padding:16px;border-radius:var(--sinch-shape-radius-m);background-color:var(--sinch-color-background-grey)}#wrapper.drop.valid{background-color:var(--sinch-color-background-blue)}#wrapper::after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;border:1px dashed var(--sinch-color-stormy-100);border-radius:var(--sinch-shape-radius-m);pointer-events:none}#placeholder{align-self:center;text-align:center}:host([invalid]) #wrapper::after{border-color:var(--sinch-color-text-invalid);border-width:1px}#wrapper.drop::after{pointer-events:all}#wrapper.drop.valid::after{border-color:var(--sinch-color-aqua-400);border-width:2px}#wrapper.drop #placeholder{color:var(--sinch-color-text-muted)}:host([disabled]) #wrapper #placeholder{color:var(--sinch-color-stormy-100)}:host([disabled]) #wrapper{background-color:var(--sinch-color-snow-100)}:host([disabled]) #wrapper::after{border-color:var(--sinch-color-stormy-100);border-width:1px}</style><div id="wrapper"><sinch-text id="placeholder" type="m" aria-hidden="true"></sinch-text><sinch-file-picker id="file-picker"><slot></slot></sinch-file-picker></div>';
|
|
18
|
+
import { areFilesAccepted, doFilesSatisfySize } from './utils';
|
|
19
|
+
const template = document.createElement('template');
|
|
20
|
+
template.innerHTML = templateHTML;
|
|
21
|
+
defineCustomElement('sinch-file-drop', (_$filePicker = new WeakMap(), _$dropArea = new WeakMap(), _$placeholder = new WeakMap(), _setDragEffect = new WeakSet(), _onDragEnter = new WeakMap(), _onDragLeave = new WeakMap(), _onDragOver = new WeakMap(), _onDrop = new WeakMap(), _onFilePickerChange = new WeakMap(), _onFilePickerInvalid = new WeakMap(), _onChangeReactHandler = new WeakMap(), _onInvalidReactHandler = new WeakMap(), _dispatchChangeEvent = new WeakSet(), _dispatchInvalidEvent = new WeakSet(), class extends NectaryElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
|
|
25
|
+
_classPrivateMethodInitSpec(this, _dispatchInvalidEvent);
|
|
26
|
+
|
|
27
|
+
_classPrivateMethodInitSpec(this, _dispatchChangeEvent);
|
|
28
|
+
|
|
29
|
+
_classPrivateMethodInitSpec(this, _setDragEffect);
|
|
30
|
+
|
|
31
|
+
_classPrivateFieldInitSpec(this, _$filePicker, {
|
|
32
|
+
writable: true,
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
_classPrivateFieldInitSpec(this, _$dropArea, {
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
_classPrivateFieldInitSpec(this, _$placeholder, {
|
|
42
|
+
writable: true,
|
|
43
|
+
value: void 0
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_classPrivateFieldInitSpec(this, _onDragEnter, {
|
|
47
|
+
writable: true,
|
|
48
|
+
value: e => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
const hasTypes = e.dataTransfer?.types?.includes('Files') === true;
|
|
52
|
+
const hasItems = e.dataTransfer?.items != null && e.dataTransfer.items.length > 0;
|
|
53
|
+
|
|
54
|
+
_classPrivateMethodGet(this, _setDragEffect, _setDragEffect2).call(this, true, hasTypes || hasItems);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
_classPrivateFieldInitSpec(this, _onDragLeave, {
|
|
59
|
+
writable: true,
|
|
60
|
+
value: e => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
|
|
64
|
+
_classPrivateMethodGet(this, _setDragEffect, _setDragEffect2).call(this, false);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
_classPrivateFieldInitSpec(this, _onDragOver, {
|
|
69
|
+
writable: true,
|
|
70
|
+
value: e => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
_classPrivateFieldInitSpec(this, _onDrop, {
|
|
77
|
+
writable: true,
|
|
78
|
+
value: e => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
|
|
82
|
+
_classPrivateMethodGet(this, _setDragEffect, _setDragEffect2).call(this, false);
|
|
83
|
+
|
|
84
|
+
if (this.disabled) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const dt = e.dataTransfer;
|
|
89
|
+
|
|
90
|
+
if (dt === null) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (dt.files.length === 0) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!this.multiple && dt.files.length > 1) {
|
|
99
|
+
_classPrivateMethodGet(this, _dispatchInvalidEvent, _dispatchInvalidEvent2).call(this, 'multiple');
|
|
100
|
+
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const files = Array.from(dt.files);
|
|
105
|
+
|
|
106
|
+
if (!areFilesAccepted(files, this.accept)) {
|
|
107
|
+
_classPrivateMethodGet(this, _dispatchInvalidEvent, _dispatchInvalidEvent2).call(this, 'accept');
|
|
108
|
+
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!doFilesSatisfySize(files, this.size)) {
|
|
113
|
+
_classPrivateMethodGet(this, _dispatchInvalidEvent, _dispatchInvalidEvent2).call(this, 'size');
|
|
114
|
+
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, files);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
_classPrivateFieldInitSpec(this, _onFilePickerChange, {
|
|
123
|
+
writable: true,
|
|
124
|
+
value: e => {
|
|
125
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, e.detail);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
_classPrivateFieldInitSpec(this, _onFilePickerInvalid, {
|
|
130
|
+
writable: true,
|
|
131
|
+
value: e => {
|
|
132
|
+
_classPrivateMethodGet(this, _dispatchInvalidEvent, _dispatchInvalidEvent2).call(this, e.detail);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
_classPrivateFieldInitSpec(this, _onChangeReactHandler, {
|
|
137
|
+
writable: true,
|
|
138
|
+
value: e => {
|
|
139
|
+
getReactEventHandler(this, 'on-change')?.(e);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
_classPrivateFieldInitSpec(this, _onInvalidReactHandler, {
|
|
144
|
+
writable: true,
|
|
145
|
+
value: e => {
|
|
146
|
+
getReactEventHandler(this, 'on-invalid')?.(e);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const shadowRoot = this.attachShadow();
|
|
151
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
152
|
+
|
|
153
|
+
_classPrivateFieldSet(this, _$dropArea, shadowRoot.querySelector('#wrapper'));
|
|
154
|
+
|
|
155
|
+
_classPrivateFieldSet(this, _$placeholder, shadowRoot.querySelector('#placeholder'));
|
|
156
|
+
|
|
157
|
+
_classPrivateFieldSet(this, _$filePicker, shadowRoot.querySelector('#file-picker'));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
162
|
+
this.addEventListener('-invalid', _classPrivateFieldGet(this, _onInvalidReactHandler));
|
|
163
|
+
this.addEventListener('dragenter', _classPrivateFieldGet(this, _onDragEnter));
|
|
164
|
+
this.addEventListener('dragleave', _classPrivateFieldGet(this, _onDragLeave));
|
|
165
|
+
this.addEventListener('dragover', _classPrivateFieldGet(this, _onDragOver));
|
|
166
|
+
this.addEventListener('drop', _classPrivateFieldGet(this, _onDrop));
|
|
167
|
+
|
|
168
|
+
_classPrivateFieldGet(this, _$filePicker).addEventListener('-change', _classPrivateFieldGet(this, _onFilePickerChange));
|
|
169
|
+
|
|
170
|
+
_classPrivateFieldGet(this, _$filePicker).addEventListener('-invalid', _classPrivateFieldGet(this, _onFilePickerInvalid));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
disconnectedCallback() {
|
|
174
|
+
this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
175
|
+
this.removeEventListener('-invalid', _classPrivateFieldGet(this, _onInvalidReactHandler));
|
|
176
|
+
this.removeEventListener('dragenter', _classPrivateFieldGet(this, _onDragEnter));
|
|
177
|
+
this.removeEventListener('dragleave', _classPrivateFieldGet(this, _onDragLeave));
|
|
178
|
+
this.removeEventListener('dragover', _classPrivateFieldGet(this, _onDragOver));
|
|
179
|
+
this.removeEventListener('drop', _classPrivateFieldGet(this, _onDrop));
|
|
180
|
+
|
|
181
|
+
_classPrivateFieldGet(this, _$filePicker).removeEventListener('-change', _classPrivateFieldGet(this, _onFilePickerChange));
|
|
182
|
+
|
|
183
|
+
_classPrivateFieldGet(this, _$filePicker).removeEventListener('-invalid', _classPrivateFieldGet(this, _onFilePickerInvalid));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static get observedAttributes() {
|
|
187
|
+
return ['accept', 'multiple', 'placeholder', 'disabled', 'invalid', 'size'];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
191
|
+
if (newVal === oldVal) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
switch (name) {
|
|
196
|
+
case 'multiple':
|
|
197
|
+
{
|
|
198
|
+
updateAttribute(_classPrivateFieldGet(this, _$filePicker), 'multiple', newVal);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
case 'accept':
|
|
203
|
+
{
|
|
204
|
+
updateAttribute(_classPrivateFieldGet(this, _$filePicker), 'accept', newVal);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
case 'placeholder':
|
|
209
|
+
{
|
|
210
|
+
_classPrivateFieldGet(this, _$placeholder).textContent = newVal;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
case 'disabled':
|
|
215
|
+
{
|
|
216
|
+
updateBooleanAttribute(this, 'disabled', isAttrTrue(newVal));
|
|
217
|
+
|
|
218
|
+
_classPrivateMethodGet(this, _setDragEffect, _setDragEffect2).call(this, false);
|
|
219
|
+
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
case 'invalid':
|
|
224
|
+
{
|
|
225
|
+
updateBooleanAttribute(this, 'invalid', isAttrTrue(newVal));
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
case 'size':
|
|
230
|
+
{
|
|
231
|
+
updateAttribute(_classPrivateFieldGet(this, _$filePicker), 'size', newVal);
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
set multiple(isMultiple) {
|
|
238
|
+
updateBooleanAttribute(this, 'multiple', isMultiple);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
get multiple() {
|
|
242
|
+
return getBooleanAttribute(this, 'multiple');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
set accept(value) {
|
|
246
|
+
updateAttribute(this, 'accept', value);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
get accept() {
|
|
250
|
+
return getAttribute(this, 'accept', null);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
get size() {
|
|
254
|
+
return getIntegerAttribute(this, 'size', null);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
set size(value) {
|
|
258
|
+
updateAttribute(this, 'size', value);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
set text(value) {
|
|
262
|
+
updateAttribute(this, 'text', value);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
get text() {
|
|
266
|
+
return getAttribute(this, 'text', '');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
set placeholder(value) {
|
|
270
|
+
updateAttribute(this, 'placeholder', value);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
get placeholder() {
|
|
274
|
+
return getAttribute(this, 'placeholder', '');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
set disabled(isDisabled) {
|
|
278
|
+
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
get disabled() {
|
|
282
|
+
return getBooleanAttribute(this, 'disabled');
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
set invalid(isInvalid) {
|
|
286
|
+
updateBooleanAttribute(this, 'invalid', isInvalid);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
get invalid() {
|
|
290
|
+
return getBooleanAttribute(this, 'invalid');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
}));
|
|
294
|
+
|
|
295
|
+
function _setDragEffect2(shouldEnable) {
|
|
296
|
+
let isValid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
297
|
+
const isElementEnabled = !this.disabled;
|
|
298
|
+
|
|
299
|
+
if (shouldEnable) {
|
|
300
|
+
if (isElementEnabled) {
|
|
301
|
+
setClass(_classPrivateFieldGet(this, _$dropArea), 'drop', true);
|
|
302
|
+
setClass(_classPrivateFieldGet(this, _$dropArea), 'valid', isValid);
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
setClass(_classPrivateFieldGet(this, _$dropArea), 'drop', false);
|
|
306
|
+
setClass(_classPrivateFieldGet(this, _$dropArea), 'valid', false);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function _dispatchChangeEvent2(files) {
|
|
311
|
+
this.dispatchEvent(new CustomEvent('-change', {
|
|
312
|
+
detail: files
|
|
313
|
+
}));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function _dispatchInvalidEvent2(type) {
|
|
317
|
+
this.dispatchEvent(new CustomEvent('-invalid', {
|
|
318
|
+
detail: type
|
|
319
|
+
}));
|
|
320
|
+
}
|