@fibrae/semi-foundation 0.1.0 → 0.2.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/dist/anchor/foundation.d.ts +1 -1
- package/dist/anchor/foundation.js +21 -21
- package/dist/audio-player/foundation.d.ts +10 -10
- package/dist/audio-player/foundation.js +19 -19
- package/dist/auto-complete/foundation.d.ts +12 -12
- package/dist/auto-complete/foundation.js +51 -51
- package/dist/avatar/foundation.d.ts +5 -5
- package/dist/avatar/foundation.js +16 -16
- package/dist/backtop/foundation.d.ts +2 -2
- package/dist/backtop/foundation.js +7 -7
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -8
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -3
- package/dist/base/foundation.js +12 -11
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.js +1 -1
- package/dist/calendar/foundation.js +4 -4
- package/dist/calendar/month-foundation.d.ts +2 -2
- package/dist/calendar/month-foundation.js +6 -6
- package/dist/carousel/foundation.d.ts +17 -17
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +34 -26
- package/dist/cascader/foundation.js +143 -121
- package/dist/checkbox/checkbox-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-foundation.js +15 -15
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -1
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/cropper/foundation.d.ts +15 -15
- package/dist/cropper/foundation.js +26 -23
- package/dist/date-picker/_utils/picker-type.d.ts +1 -1
- package/dist/date-picker/foundation.d.ts +36 -36
- package/dist/date-picker/foundation.js +125 -129
- package/dist/date-picker/input-foundation.d.ts +9 -9
- package/dist/date-picker/input-foundation.js +28 -28
- package/dist/date-picker/months-grid-foundation.d.ts +17 -17
- package/dist/date-picker/months-grid-foundation.js +64 -65
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -2
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -5
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -1
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -9
- package/dist/feedback/foundation.js +33 -33
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -61
- package/dist/highlight/foundation.js +1 -1
- package/dist/hot-keys/foundation.d.ts +2 -2
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -4
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -3
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -8
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -9
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -10
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -3
- package/dist/input/text-entry-foundation.js +14 -14
- package/dist/input/textarea-foundation.d.ts +7 -7
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/foundation.d.ts +16 -14
- package/dist/input-number/foundation.js +54 -53
- package/dist/json-viewer/foundation.d.ts +8 -8
- package/dist/json-viewer/foundation.js +23 -23
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +1 -1
- package/dist/markdown-render/foundation.js +4 -4
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -1
- package/dist/navigation/foundation.js +14 -14
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -3
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -7
- package/dist/notification/notification-list-foundation.js +12 -12
- package/dist/overflow-list/foundation.d.ts +4 -4
- package/dist/overflow-list/foundation.js +18 -18
- package/dist/pagination/foundation.d.ts +8 -8
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +5 -5
- package/dist/pincode/foundation.js +22 -22
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/radio/radio-foundation.d.ts +5 -5
- package/dist/radio/radio-foundation.js +15 -15
- package/dist/radio/radio-group-foundation.d.ts +2 -2
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -10
- package/dist/rating/foundation.js +35 -35
- package/dist/resizable/group/index.d.ts +6 -6
- package/dist/resizable/group/index.js +40 -40
- package/dist/resizable/single/index.d.ts +2 -2
- package/dist/resizable/single/index.js +9 -9
- package/dist/scroll-list/item-foundation.d.ts +7 -7
- package/dist/scroll-list/item-foundation.js +35 -35
- package/dist/select/foundation.d.ts +42 -56
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -27
- package/dist/select/option-foundation.js +10 -18
- package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
- package/dist/side-sheet/side-sheet-foundation.js +22 -22
- package/dist/slider/foundation.d.ts +16 -16
- package/dist/slider/foundation.js +46 -46
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -2
- package/dist/spin/foundation.js +6 -6
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -2
- package/dist/switch/foundation.js +7 -7
- package/dist/table/foundation.d.ts +14 -14
- package/dist/table/foundation.js +93 -93
- package/dist/table/utils.d.ts +2 -2
- package/dist/tabs/foundation.d.ts +5 -5
- package/dist/tabs/foundation.js +17 -17
- package/dist/tag-input/foundation.d.ts +11 -11
- package/dist/tag-input/foundation.js +52 -52
- package/dist/time-picker/foundation.d.ts +13 -13
- package/dist/time-picker/foundation.js +39 -39
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/foundation.d.ts +9 -9
- package/dist/tooltip/foundation.js +67 -61
- package/dist/transfer/foundation.d.ts +22 -9
- package/dist/transfer/foundation.js +38 -23
- package/dist/tree/foundation.d.ts +14 -14
- package/dist/tree/foundation.js +61 -61
- package/dist/tree/shared.d.ts +1 -1
- package/dist/tree-select/foundation.d.ts +26 -20
- package/dist/tree-select/foundation.js +91 -83
- package/dist/typography/ellipsis.d.ts +4 -4
- package/dist/typography/ellipsis.js +8 -8
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -17
- package/dist/upload/foundation.js +92 -92
- package/dist/upload/utils.d.ts +3 -3
- package/dist/upload/utils.js +6 -6
- package/dist/user-guide/foundation.d.ts +3 -3
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +1 -1
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/focus-handle.d.ts +1 -1
- package/dist/utils/focus-handle.js +1 -2
- package/dist/utils/focus-scope.d.ts +5 -5
- package/dist/utils/focus-scope.js +10 -10
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -2
- package/dist/video-player/progress-foundation.js +12 -12
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
18
18
|
const next = {};
|
|
19
19
|
if (!Array.isArray(fileList)) {
|
|
20
20
|
this.#localUrls = {};
|
|
21
|
-
this.
|
|
21
|
+
this.adapter.updateLocalUrls([]);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
fileList.forEach((item) => {
|
|
@@ -28,7 +28,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
28
28
|
if (uid && typeof url === "string" && url.startsWith("blob:") && fileInstance instanceof File) next[uid] = url;
|
|
29
29
|
});
|
|
30
30
|
this.#localUrls = next;
|
|
31
|
-
this.
|
|
31
|
+
this.adapter.updateLocalUrls(Object.values(this.#localUrls));
|
|
32
32
|
}
|
|
33
33
|
#releaseFileUrl(uid) {
|
|
34
34
|
if (!uid) return;
|
|
@@ -38,7 +38,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
38
38
|
const next = { ...this.#localUrls };
|
|
39
39
|
delete next[uid];
|
|
40
40
|
this.#localUrls = next;
|
|
41
|
-
this.
|
|
41
|
+
this.adapter.updateLocalUrls(Object.values(this.#localUrls));
|
|
42
42
|
}
|
|
43
43
|
#releaseAllFileUrls() {
|
|
44
44
|
const localUrls = this.#localUrls;
|
|
@@ -48,7 +48,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
48
48
|
if (url) this.#releaseBlob(url);
|
|
49
49
|
});
|
|
50
50
|
this.#localUrls = {};
|
|
51
|
-
this.
|
|
51
|
+
this.adapter.updateLocalUrls([]);
|
|
52
52
|
}
|
|
53
53
|
#getFileIndex(file, fileList) {
|
|
54
54
|
return fileList.findIndex((item) => item.uid === file.uid);
|
|
@@ -59,7 +59,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
59
59
|
if (uid && next[uid] && next[uid] !== url) this.#releaseBlob(next[uid]);
|
|
60
60
|
if (uid) next[uid] = url;
|
|
61
61
|
this.#localUrls = next;
|
|
62
|
-
this.
|
|
62
|
+
this.adapter.updateLocalUrls(Object.values(this.#localUrls));
|
|
63
63
|
return url;
|
|
64
64
|
}
|
|
65
65
|
#releaseBlob(url) {
|
|
@@ -67,7 +67,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
67
67
|
}
|
|
68
68
|
#updateFileListInternal(newFileList, callback) {
|
|
69
69
|
this.#latestFileList = newFileList;
|
|
70
|
-
this.
|
|
70
|
+
this.adapter.updateFileList(newFileList, callback);
|
|
71
71
|
}
|
|
72
72
|
#getLatestFileList() {
|
|
73
73
|
return this.#latestFileList || this.getFileList();
|
|
@@ -80,7 +80,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
80
80
|
if (this.checkFileSize(file)) {
|
|
81
81
|
file._sizeInvalid = true;
|
|
82
82
|
file.status = FILE_STATUS_VALID_FAIL;
|
|
83
|
-
this.
|
|
83
|
+
this.adapter.notifySizeError(file, fileList);
|
|
84
84
|
}
|
|
85
85
|
return file;
|
|
86
86
|
}
|
|
@@ -88,7 +88,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
88
88
|
const { uploadTrigger } = this.getProps();
|
|
89
89
|
this.#releaseAllFileUrls();
|
|
90
90
|
const currentFiles = files.map((item) => this.buildFileItem(item, uploadTrigger));
|
|
91
|
-
this.
|
|
91
|
+
this.adapter.notifyChange({
|
|
92
92
|
fileList: currentFiles,
|
|
93
93
|
currentFile: currentFiles[0]
|
|
94
94
|
});
|
|
@@ -109,7 +109,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
109
109
|
lastAdded = file;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
if (lastAdded) this.
|
|
112
|
+
if (lastAdded) this.adapter.notifyChange({
|
|
113
113
|
fileList,
|
|
114
114
|
currentFile: lastAdded
|
|
115
115
|
});
|
|
@@ -130,7 +130,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
130
130
|
}
|
|
131
131
|
if (typeof beforeUpload === "function") {
|
|
132
132
|
const fileList = this.#getLatestFileList();
|
|
133
|
-
const buResult = this.
|
|
133
|
+
const buResult = this.adapter.notifyBeforeUpload({
|
|
134
134
|
file,
|
|
135
135
|
fileList
|
|
136
136
|
});
|
|
@@ -201,7 +201,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
201
201
|
newFileList[index] = currentFile;
|
|
202
202
|
}
|
|
203
203
|
this.#updateFileListInternal(newFileList);
|
|
204
|
-
this.
|
|
204
|
+
this.adapter.notifyChange({
|
|
205
205
|
fileList: newFileList,
|
|
206
206
|
currentFile
|
|
207
207
|
});
|
|
@@ -275,9 +275,9 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
275
275
|
percent,
|
|
276
276
|
status: FILE_STATUS_UPLOADING
|
|
277
277
|
};
|
|
278
|
-
this.
|
|
278
|
+
this.adapter.notifyProgress(percent, fileInstance, newFileList);
|
|
279
279
|
this.#updateFileListInternal(newFileList);
|
|
280
|
-
this.
|
|
280
|
+
this.adapter.notifyChange({
|
|
281
281
|
fileList: newFileList,
|
|
282
282
|
currentFile: newFileList[index]
|
|
283
283
|
});
|
|
@@ -313,9 +313,9 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
313
313
|
};
|
|
314
314
|
if (e) currentFile.event = e;
|
|
315
315
|
newFileList[index] = currentFile;
|
|
316
|
-
this.
|
|
316
|
+
this.adapter.notifyProgress(100, fileInstance, newFileList);
|
|
317
317
|
if (afterUpload && typeof afterUpload === "function") {
|
|
318
|
-
const { autoRemove, status, validateMessage, name, url } = this.
|
|
318
|
+
const { autoRemove, status, validateMessage, name, url } = this.adapter.notifyAfterUpload({
|
|
319
319
|
response: body,
|
|
320
320
|
file: currentFile,
|
|
321
321
|
fileList: newFileList
|
|
@@ -334,8 +334,8 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
334
334
|
newFileList.splice(index, 1);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
this.
|
|
338
|
-
this.
|
|
337
|
+
this.adapter.notifySuccess(body, fileInstance, newFileList);
|
|
338
|
+
this.adapter.notifyChange({
|
|
339
339
|
fileList: newFileList,
|
|
340
340
|
currentFile
|
|
341
341
|
});
|
|
@@ -358,9 +358,9 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
358
358
|
response: error,
|
|
359
359
|
event: e
|
|
360
360
|
};
|
|
361
|
-
this.
|
|
361
|
+
this.adapter.notifyError(error, fileInstance, newFileList, xhr);
|
|
362
362
|
this.#updateFileListInternal(newFileList);
|
|
363
|
-
this.
|
|
363
|
+
this.adapter.notifyChange({
|
|
364
364
|
currentFile: newFileList[index],
|
|
365
365
|
fileList: newFileList
|
|
366
366
|
});
|
|
@@ -370,8 +370,8 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
370
370
|
const items = [].slice.call(e.dataTransfer.items);
|
|
371
371
|
const files = await mapFileTree(items);
|
|
372
372
|
this.#selectFiles(files, false);
|
|
373
|
-
this.
|
|
374
|
-
this.
|
|
373
|
+
this.adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
374
|
+
this.adapter.notifyDrop(e, files, fileList);
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* Keeps the files accept allows and reports the others. When accept leaves nothing it returns undefined after
|
|
@@ -381,7 +381,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
381
381
|
const { accept } = this.getProps();
|
|
382
382
|
if (typeof accept === "undefined") return files;
|
|
383
383
|
const invalidFiles = files.filter((item) => !this.checkFileFormat(accept, item));
|
|
384
|
-
if (invalidFiles.length !== 0) this.
|
|
384
|
+
if (invalidFiles.length !== 0) this.adapter.notifyAcceptInvalid(invalidFiles);
|
|
385
385
|
const accepted = files.filter((item) => !invalidFiles.includes(item));
|
|
386
386
|
if (accepted.length === 0) {
|
|
387
387
|
reset?.();
|
|
@@ -394,7 +394,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
394
394
|
const used = this.getFileList().length;
|
|
395
395
|
if (typeof limit === "undefined" || used + files.length <= limit) return files;
|
|
396
396
|
if (limit === 1) return files.slice(-1);
|
|
397
|
-
this.
|
|
397
|
+
this.adapter.notifyExceed(files);
|
|
398
398
|
return files.slice(0, Math.max(0, limit - used));
|
|
399
399
|
}
|
|
400
400
|
#dispatchFiles(files, isReplaceOperation) {
|
|
@@ -407,7 +407,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
407
407
|
try {
|
|
408
408
|
return await beforeCrop(file, files) !== false;
|
|
409
409
|
} catch (error) {
|
|
410
|
-
this.
|
|
410
|
+
this.adapter.notifyCropError(error);
|
|
411
411
|
return false;
|
|
412
412
|
}
|
|
413
413
|
}
|
|
@@ -430,7 +430,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
430
430
|
}
|
|
431
431
|
/** Filters by accept, then crops the images (when `crop` is on and allowed) or adds the files to the list */
|
|
432
432
|
#selectFiles(currentFileList, allowCrop) {
|
|
433
|
-
let files = this.#acceptFiles(currentFileList, () => this.
|
|
433
|
+
let files = this.#acceptFiles(currentFileList, () => this.adapter.resetInput());
|
|
434
434
|
if (!files) return;
|
|
435
435
|
if (allowCrop && this.getProps().crop && files.some(isImageFile)) {
|
|
436
436
|
if (this.getStates().cropperVisible) return;
|
|
@@ -455,18 +455,18 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
455
455
|
if (total > limit) {
|
|
456
456
|
if (limit === 1) {
|
|
457
457
|
files = files.slice(-1);
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
458
|
+
this.adapter.notifyFileSelect(files);
|
|
459
|
+
this.adapter.resetInput();
|
|
460
460
|
this.#replaceFileList(files);
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
|
-
this.
|
|
463
|
+
this.adapter.notifyExceed(files);
|
|
464
464
|
const restNum = Math.max(0, limit - fileList.length);
|
|
465
465
|
files = files.slice(0, restNum);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
this.
|
|
469
|
-
this.
|
|
468
|
+
this.adapter.notifyFileSelect(files);
|
|
469
|
+
this.adapter.resetInput();
|
|
470
470
|
this.#addFilesToList(files);
|
|
471
471
|
}
|
|
472
472
|
#replaceFile(file) {
|
|
@@ -475,21 +475,21 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
475
475
|
const fileList = this.getFileList();
|
|
476
476
|
const index = fileList.findIndex((item) => item.uid === replaceUid);
|
|
477
477
|
if (index < 0) {
|
|
478
|
-
this.
|
|
478
|
+
this.adapter.resetReplaceInput();
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
481
|
const newFile = this.#prepareFile(file, fileList);
|
|
482
|
-
this.
|
|
482
|
+
this.adapter.notifyFileSelect([newFile]);
|
|
483
483
|
const newFileItem = this.buildFileItem(newFile, uploadTrigger);
|
|
484
484
|
const newFileList = [...fileList];
|
|
485
485
|
this.#releaseFileUrl(replaceUid);
|
|
486
486
|
newFileList.splice(index, 1, newFileItem);
|
|
487
|
-
this.
|
|
487
|
+
this.adapter.notifyChange({
|
|
488
488
|
currentFile: newFileItem,
|
|
489
489
|
fileList: newFileList
|
|
490
490
|
});
|
|
491
491
|
this.#updateFileListInternal(newFileList, () => {
|
|
492
|
-
this.
|
|
492
|
+
this.adapter.resetReplaceInput();
|
|
493
493
|
if (!newFileItem._sizeInvalid) this.#upload(newFileItem);
|
|
494
494
|
});
|
|
495
495
|
}
|
|
@@ -550,7 +550,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
/** Closes the cropper and drops the queue; the files already cropped are discarded */
|
|
553
|
-
cancelCrop() {
|
|
553
|
+
cancelCrop = () => {
|
|
554
554
|
const { cropperSrc } = this.getStates();
|
|
555
555
|
if (cropperSrc) URL.revokeObjectURL(cropperSrc);
|
|
556
556
|
this.setState({
|
|
@@ -562,15 +562,15 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
562
562
|
croppedFiles: [],
|
|
563
563
|
isReplaceOperation: false
|
|
564
564
|
});
|
|
565
|
-
this.
|
|
566
|
-
this.
|
|
567
|
-
}
|
|
565
|
+
this.adapter.resetInput();
|
|
566
|
+
this.adapter.resetReplaceInput();
|
|
567
|
+
};
|
|
568
568
|
/** Crops the current image, then moves to the next queued one or adds every result once the queue drains */
|
|
569
|
-
async
|
|
569
|
+
confirmCrop = async () => {
|
|
570
570
|
const { cropperFile, cropperSrc, pendingImageFiles, nonImageFiles, croppedFiles, isReplaceOperation } = this.getStates();
|
|
571
571
|
const { crop } = this.getProps();
|
|
572
572
|
try {
|
|
573
|
-
const canvas = this.
|
|
573
|
+
const canvas = this.adapter.getCropperCanvas();
|
|
574
574
|
if (!canvas || !cropperFile) throw new Error("Cropper instance not found");
|
|
575
575
|
const quality = (typeof crop === "object" ? crop.quality : void 0) ?? .92;
|
|
576
576
|
const type = cropperFile.type || "image/png";
|
|
@@ -597,17 +597,17 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
597
597
|
this.cancelCrop();
|
|
598
598
|
this.#dispatchFiles([...nextCropped, ...nonImageFiles], isReplaceOperation);
|
|
599
599
|
} catch (error) {
|
|
600
|
-
this.
|
|
600
|
+
this.adapter.notifyCropError(error);
|
|
601
601
|
}
|
|
602
|
-
}
|
|
602
|
+
};
|
|
603
603
|
/** Keep the synchronous snapshot aligned with an externally controlled fileList. */
|
|
604
|
-
syncLatestFileList(fileList) {
|
|
604
|
+
syncLatestFileList = (fileList) => {
|
|
605
605
|
this.#latestFileList = fileList.slice();
|
|
606
|
-
}
|
|
606
|
+
};
|
|
607
607
|
/** A fileList prop that goes back to undefined clears the list (a form reset) and leaves it uncontrolled */
|
|
608
|
-
handleFileListPropChange(fileList) {
|
|
608
|
+
handleFileListPropChange = (fileList) => {
|
|
609
609
|
if (fileList === void 0) this.#updateFileListInternal([]);
|
|
610
|
-
}
|
|
610
|
+
};
|
|
611
611
|
/** The list on screen: the fileList prop when controlled, otherwise the fileList state. */
|
|
612
612
|
getFileList() {
|
|
613
613
|
const props = this.getProps();
|
|
@@ -618,7 +618,7 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
618
618
|
this.#syncLocalUrlsFromFileList();
|
|
619
619
|
}
|
|
620
620
|
/** Adds the files of a paste on the page; the host listens only while addOnPasting is on and not disabled */
|
|
621
|
-
handlePasting(e) {
|
|
621
|
+
handlePasting = (e) => {
|
|
622
622
|
if (!e.clipboardData) return;
|
|
623
623
|
const files = [];
|
|
624
624
|
for (const item of e.clipboardData.items) {
|
|
@@ -626,28 +626,28 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
626
626
|
try {
|
|
627
627
|
const file = item.getAsFile();
|
|
628
628
|
if (file) files.push(file);
|
|
629
|
-
else this.
|
|
629
|
+
else this.adapter.notifyPastingError(/* @__PURE__ */ new Error("Failed to read a pasted file from the clipboard"));
|
|
630
630
|
} catch (error) {
|
|
631
|
-
this.
|
|
631
|
+
this.adapter.notifyPastingError(error);
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
if (files.length > 0) {
|
|
635
635
|
e.preventDefault();
|
|
636
636
|
this.addFiles(files);
|
|
637
637
|
}
|
|
638
|
-
}
|
|
638
|
+
};
|
|
639
639
|
/** Entry for picked, dropped and pasted files: with crop on, images are cropped before they are added */
|
|
640
|
-
addFiles(currentFileList) {
|
|
640
|
+
addFiles = (currentFileList) => {
|
|
641
641
|
this.#selectFiles(Array.from(currentFileList), true);
|
|
642
|
-
}
|
|
642
|
+
};
|
|
643
643
|
/** Entry for the file picked to replace the item `replaceUid` names; with crop on, an image is cropped first */
|
|
644
|
-
handleReplaceChange(currentFileList) {
|
|
644
|
+
handleReplaceChange = (currentFileList) => {
|
|
645
645
|
const newFile = Array.from(currentFileList).pop();
|
|
646
|
-
if (!newFile || !this.#acceptFiles([newFile], () => this.
|
|
646
|
+
if (!newFile || !this.#acceptFiles([newFile], () => this.adapter.resetReplaceInput())) return;
|
|
647
647
|
if (this.getProps().crop && isImageFile(newFile)) this.#startCrop([newFile], true);
|
|
648
648
|
else this.#replaceFile(newFile);
|
|
649
|
-
}
|
|
650
|
-
insertFileToList(files, index) {
|
|
649
|
+
};
|
|
650
|
+
insertFileToList = (files, index) => {
|
|
651
651
|
const { limit, uploadTrigger } = this.getProps();
|
|
652
652
|
const fileList = this.getFileList();
|
|
653
653
|
const accepted = this.#acceptFiles(Array.from(files));
|
|
@@ -658,12 +658,12 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
658
658
|
if (total > limit) {
|
|
659
659
|
if (limit === 1) {
|
|
660
660
|
currentFileList = currentFileList.slice(-1);
|
|
661
|
-
this.
|
|
662
|
-
this.
|
|
661
|
+
this.adapter.notifyFileSelect(currentFileList);
|
|
662
|
+
this.adapter.resetInput();
|
|
663
663
|
this.#replaceFileList(currentFileList);
|
|
664
664
|
return;
|
|
665
665
|
}
|
|
666
|
-
this.
|
|
666
|
+
this.adapter.notifyExceed(currentFileList);
|
|
667
667
|
const restNum = Math.max(0, limit - fileList.length);
|
|
668
668
|
currentFileList = currentFileList.slice(0, restNum);
|
|
669
669
|
}
|
|
@@ -672,58 +672,58 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
672
672
|
const newFileList = fileList.slice();
|
|
673
673
|
if (typeof index !== "undefined") newFileList.splice(index, 0, ...fileItemList);
|
|
674
674
|
else newFileList.push(...fileItemList);
|
|
675
|
-
this.
|
|
676
|
-
this.
|
|
675
|
+
this.adapter.notifyFileSelect(currentFileList);
|
|
676
|
+
this.adapter.notifyChange({
|
|
677
677
|
fileList: newFileList,
|
|
678
678
|
currentFile: null
|
|
679
679
|
});
|
|
680
680
|
this.#updateFileListInternal(newFileList, () => {
|
|
681
681
|
if (uploadTrigger === TRIGGER_AUTO) this.#startUpload(fileItemList);
|
|
682
682
|
});
|
|
683
|
-
}
|
|
684
|
-
manualUpload() {
|
|
683
|
+
};
|
|
684
|
+
manualUpload = () => {
|
|
685
685
|
const waitToUploadFileList = this.#getLatestFileList().filter((item) => item.status === FILE_STATUS_WAIT_UPLOAD);
|
|
686
686
|
this.#startUpload(waitToUploadFileList);
|
|
687
|
-
}
|
|
688
|
-
handleRemove(file) {
|
|
687
|
+
};
|
|
688
|
+
handleRemove = (file) => {
|
|
689
689
|
const { disabled } = this.getProps();
|
|
690
690
|
if (disabled) return;
|
|
691
691
|
const fileList = this.getFileList();
|
|
692
|
-
Promise.resolve(this.
|
|
692
|
+
Promise.resolve(this.adapter.notifyBeforeRemove(file, fileList)).then((res) => {
|
|
693
693
|
if (res === false) return;
|
|
694
694
|
const newFileList = this.#getLatestFileList().slice();
|
|
695
695
|
const index = this.#getFileIndex(file, newFileList);
|
|
696
696
|
if (index < 0) return;
|
|
697
697
|
newFileList.splice(index, 1);
|
|
698
698
|
this.#releaseFileUrl(file.uid);
|
|
699
|
-
this.
|
|
699
|
+
this.adapter.notifyRemove(file.fileInstance, newFileList, file);
|
|
700
700
|
this.#updateFileListInternal(newFileList);
|
|
701
|
-
this.
|
|
701
|
+
this.adapter.notifyChange({
|
|
702
702
|
fileList: newFileList,
|
|
703
703
|
currentFile: file
|
|
704
704
|
});
|
|
705
705
|
}, () => {});
|
|
706
|
-
}
|
|
707
|
-
handleClear() {
|
|
706
|
+
};
|
|
707
|
+
handleClear = () => {
|
|
708
708
|
const { disabled } = this.getProps();
|
|
709
709
|
const fileList = this.getFileList();
|
|
710
710
|
if (disabled) return;
|
|
711
|
-
Promise.resolve(this.
|
|
711
|
+
Promise.resolve(this.adapter.notifyBeforeClear(fileList)).then((res) => {
|
|
712
712
|
if (res === false) return;
|
|
713
713
|
this.#releaseAllFileUrls();
|
|
714
714
|
this.#updateFileListInternal([]);
|
|
715
|
-
this.
|
|
716
|
-
this.
|
|
715
|
+
this.adapter.notifyClear();
|
|
716
|
+
this.adapter.notifyChange({ fileList: [] });
|
|
717
717
|
}, () => {});
|
|
718
|
-
}
|
|
719
|
-
handleDragEnter(e) {
|
|
718
|
+
};
|
|
719
|
+
handleDragEnter = (e) => {
|
|
720
720
|
e.preventDefault();
|
|
721
721
|
e.stopPropagation();
|
|
722
722
|
this.#dragDepth++;
|
|
723
723
|
const { disabled } = this.getProps();
|
|
724
|
-
if (!disabled) this.
|
|
725
|
-
}
|
|
726
|
-
handleDrop(e) {
|
|
724
|
+
if (!disabled) this.adapter.updateDragAreaStatus(DRAG_AREA_LEGAL);
|
|
725
|
+
};
|
|
726
|
+
handleDrop = (e) => {
|
|
727
727
|
e.preventDefault();
|
|
728
728
|
e.stopPropagation();
|
|
729
729
|
this.#dragDepth = 0;
|
|
@@ -736,27 +736,27 @@ var UploadFoundation = class extends BaseFoundation {
|
|
|
736
736
|
}
|
|
737
737
|
const files = Array.from(e.dataTransfer.files);
|
|
738
738
|
this.addFiles(files);
|
|
739
|
-
this.
|
|
740
|
-
this.
|
|
739
|
+
this.adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
740
|
+
this.adapter.notifyDrop(e, files, fileList);
|
|
741
741
|
}
|
|
742
|
-
}
|
|
743
|
-
handleDragOver(e) {
|
|
742
|
+
};
|
|
743
|
+
handleDragOver = (e) => {
|
|
744
744
|
e.preventDefault();
|
|
745
745
|
e.stopPropagation();
|
|
746
|
-
}
|
|
747
|
-
handleDragLeave(e) {
|
|
746
|
+
};
|
|
747
|
+
handleDragLeave = (e) => {
|
|
748
748
|
e.preventDefault();
|
|
749
749
|
e.stopPropagation();
|
|
750
750
|
this.#dragDepth = Math.max(0, this.#dragDepth - 1);
|
|
751
|
-
if (this.#dragDepth === 0) this.
|
|
752
|
-
}
|
|
753
|
-
retry(fileItem) {
|
|
751
|
+
if (this.#dragDepth === 0) this.adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
752
|
+
};
|
|
753
|
+
retry = (fileItem) => {
|
|
754
754
|
if (this.getProps().disabled) return;
|
|
755
|
-
this.
|
|
755
|
+
this.adapter.notifyRetry(fileItem);
|
|
756
756
|
if (fileItem.fileInstance) this.#post(fileItem);
|
|
757
|
-
}
|
|
758
|
-
handlePreviewClick(fileItem) {
|
|
759
|
-
this.
|
|
760
|
-
}
|
|
757
|
+
};
|
|
758
|
+
handlePreviewClick = (fileItem) => {
|
|
759
|
+
this.adapter.notifyPreviewClick(fileItem);
|
|
760
|
+
};
|
|
761
761
|
};
|
|
762
762
|
export { UploadFoundation as default };
|
package/dist/upload/utils.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export declare function getFocusHandoverTarget(cards: ArrayLike<Element>, index:
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class ListFocusTracker {
|
|
18
18
|
#private;
|
|
19
|
-
track(node: Node, cards: ArrayLike<Element>)
|
|
20
|
-
untrack(node: Node)
|
|
21
|
-
restore(cards: ArrayLike<Element>, addArea: HTMLElement | null)
|
|
19
|
+
track: (node: Node, cards: ArrayLike<Element>) => void;
|
|
20
|
+
untrack: (node: Node) => void;
|
|
21
|
+
restore: (cards: ArrayLike<Element>, addArea: HTMLElement | null) => void;
|
|
22
22
|
}
|
|
23
23
|
export declare function getFileSize(number: number): string;
|
|
24
24
|
export declare function loopFiles(item: FileSystemDirectoryEntry): Promise<Array<FileSystemEntry>>;
|
package/dist/upload/utils.js
CHANGED
|
@@ -38,23 +38,23 @@ function getFocusHandoverTarget(cards, index, addArea) {
|
|
|
38
38
|
*/
|
|
39
39
|
var ListFocusTracker = class {
|
|
40
40
|
#focused = null;
|
|
41
|
-
track(node, cards) {
|
|
41
|
+
track = (node, cards) => {
|
|
42
42
|
this.#focused = {
|
|
43
43
|
node,
|
|
44
44
|
index: indexOfCard(cards, node)
|
|
45
45
|
};
|
|
46
|
-
}
|
|
47
|
-
untrack(node) {
|
|
46
|
+
};
|
|
47
|
+
untrack = (node) => {
|
|
48
48
|
queueMicrotask(() => {
|
|
49
49
|
if (this.#focused?.node === node && node.isConnected) this.#focused = null;
|
|
50
50
|
});
|
|
51
|
-
}
|
|
52
|
-
restore(cards, addArea) {
|
|
51
|
+
};
|
|
52
|
+
restore = (cards, addArea) => {
|
|
53
53
|
const lost = this.#focused;
|
|
54
54
|
if (!lost || lost.node.isConnected) return;
|
|
55
55
|
this.#focused = null;
|
|
56
56
|
handoverFocus(lost.node, getFocusHandoverTarget(cards, lost.index, addArea));
|
|
57
|
-
}
|
|
57
|
+
};
|
|
58
58
|
};
|
|
59
59
|
function getFileSize(number) {
|
|
60
60
|
if (number < 1024) return `${(number / byteKB).toFixed(2)}KB`;
|
|
@@ -38,9 +38,9 @@ export default class UserGuideFoundation<P extends UserGuideBaseProps = UserGuid
|
|
|
38
38
|
} | undefined, spotlightPadding: number | undefined, scrollIntoView: boolean): DOMRect | null;
|
|
39
39
|
static isSameRect(a?: DOMRect | null, b?: DOMRect | null): boolean;
|
|
40
40
|
destroy(): void;
|
|
41
|
-
beforeShow()
|
|
42
|
-
releaseScroll()
|
|
43
|
-
afterHide()
|
|
41
|
+
beforeShow: () => void;
|
|
42
|
+
releaseScroll: () => void;
|
|
43
|
+
afterHide: () => void;
|
|
44
44
|
handlePrev: () => void;
|
|
45
45
|
handleNext: () => void;
|
|
46
46
|
handleSkip: () => void;
|
|
@@ -6,7 +6,7 @@ var UserGuideFoundation = class UserGuideFoundation extends BaseFoundation {
|
|
|
6
6
|
return UserGuideFoundation.deriveCurrent(this.getProps(), this.getStates());
|
|
7
7
|
}
|
|
8
8
|
getIsControlledComponent() {
|
|
9
|
-
return this.
|
|
9
|
+
return this.isControlledComponent("current");
|
|
10
10
|
}
|
|
11
11
|
static deriveCurrent(props, state) {
|
|
12
12
|
return props.current === void 0 ? state.current : props.current;
|
|
@@ -37,37 +37,37 @@ var UserGuideFoundation = class UserGuideFoundation extends BaseFoundation {
|
|
|
37
37
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
38
38
|
}
|
|
39
39
|
destroy() {
|
|
40
|
-
this.
|
|
40
|
+
this.adapter.enabledBodyScroll();
|
|
41
41
|
}
|
|
42
|
-
beforeShow() {
|
|
43
|
-
this.
|
|
44
|
-
}
|
|
45
|
-
releaseScroll() {
|
|
46
|
-
this.
|
|
47
|
-
}
|
|
48
|
-
afterHide() {
|
|
42
|
+
beforeShow = () => {
|
|
43
|
+
this.adapter.disabledBodyScroll();
|
|
44
|
+
};
|
|
45
|
+
releaseScroll = () => {
|
|
46
|
+
this.adapter.enabledBodyScroll();
|
|
47
|
+
};
|
|
48
|
+
afterHide = () => {
|
|
49
49
|
this.releaseScroll();
|
|
50
|
-
this.
|
|
51
|
-
}
|
|
50
|
+
this.adapter.setCurrent(numbers.DEFAULT_CURRENT);
|
|
51
|
+
};
|
|
52
52
|
handlePrev = () => {
|
|
53
53
|
const newCurrent = this.#getCurrent() - 1;
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
if (!this.getIsControlledComponent()) this.
|
|
54
|
+
this.adapter.notifyChange(newCurrent);
|
|
55
|
+
this.adapter.notifyPrev(newCurrent);
|
|
56
|
+
if (!this.getIsControlledComponent()) this.adapter.setCurrent(newCurrent);
|
|
57
57
|
};
|
|
58
58
|
handleNext = () => {
|
|
59
59
|
const { steps } = this.getProps();
|
|
60
60
|
const current = this.#getCurrent();
|
|
61
|
-
if (current === steps.length - 1) this.
|
|
61
|
+
if (current === steps.length - 1) this.adapter.notifyFinish();
|
|
62
62
|
else {
|
|
63
63
|
const newCurrent = current + 1;
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
if (!this.getIsControlledComponent()) this.
|
|
64
|
+
this.adapter.notifyChange(newCurrent);
|
|
65
|
+
this.adapter.notifyNext(newCurrent);
|
|
66
|
+
if (!this.getIsControlledComponent()) this.adapter.setCurrent(newCurrent);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
handleSkip = () => {
|
|
70
|
-
this.
|
|
70
|
+
this.adapter.notifySkip();
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
export { UserGuideFoundation as default };
|
package/dist/utils/a11y.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function handlePrevent(event:
|
|
1
|
+
export declare function handlePrevent(event: Pick<Event, 'stopPropagation' | 'preventDefault'>): void;
|
|
2
2
|
/**
|
|
3
3
|
* Space-separated ids for aria-labelledby and aria-describedby, undefined when there are none; the caller's ids go
|
|
4
4
|
* first, so the Form's ids are added to them instead of replacing them
|
|
@@ -30,6 +30,6 @@ export default class Announcer {
|
|
|
30
30
|
* `read` runs at write time, when the message elements are in the document. Messages queued together are read as one;
|
|
31
31
|
* a later call with the same `key` replaces the earlier one, so an in-place update is announced once.
|
|
32
32
|
*/
|
|
33
|
-
announce(key: string, read: () => string)
|
|
34
|
-
dispose()
|
|
33
|
+
announce: (key: string, read: () => string) => void;
|
|
34
|
+
dispose: () => void;
|
|
35
35
|
}
|
package/dist/utils/announcer.js
CHANGED
|
@@ -36,7 +36,7 @@ var Announcer = class {
|
|
|
36
36
|
* `read` runs at write time, when the message elements are in the document. Messages queued together are read as one;
|
|
37
37
|
* a later call with the same `key` replaces the earlier one, so an in-place update is announced once.
|
|
38
38
|
*/
|
|
39
|
-
announce(key, read) {
|
|
39
|
+
announce = (key, read) => {
|
|
40
40
|
this.#pending.set(key, read);
|
|
41
41
|
clearTimeout(this.#timer);
|
|
42
42
|
this.#timer = setTimeout(() => {
|
|
@@ -45,10 +45,10 @@ var Announcer = class {
|
|
|
45
45
|
this.#write(text);
|
|
46
46
|
this.#timer = setTimeout(() => this.#write(""), ANNOUNCE_HOLD);
|
|
47
47
|
}, 100);
|
|
48
|
-
}
|
|
49
|
-
dispose() {
|
|
48
|
+
};
|
|
49
|
+
dispose = () => {
|
|
50
50
|
clearTimeout(this.#timer);
|
|
51
51
|
this.#pending.clear();
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
};
|
|
54
54
|
export { ANNOUNCE_DELAY, ANNOUNCE_HOLD, Announcer as default, isAlertType, pickFreshAnnouncements, readNoticeText };
|
|
@@ -31,7 +31,7 @@ export default class FocusTrapHandle {
|
|
|
31
31
|
* Where a dialog puts focus on open when nothing inside has it: the element focused on the first open, the
|
|
32
32
|
* autofocus element when `autofocus` is set, the footer button named by `initialFocus`, else the first focusable.
|
|
33
33
|
*/
|
|
34
|
-
static pickInitialFocus(dialog: HTMLElement,
|
|
34
|
+
static pickInitialFocus(dialog: HTMLElement, { remembered, footer, initialFocus, autofocus }: {
|
|
35
35
|
remembered?: HTMLElement | null;
|
|
36
36
|
footer?: Element | null;
|
|
37
37
|
initialFocus?: string;
|
|
@@ -75,8 +75,7 @@ var FocusTrapHandle = class FocusTrapHandle {
|
|
|
75
75
|
* Where a dialog puts focus on open when nothing inside has it: the element focused on the first open, the
|
|
76
76
|
* autofocus element when `autofocus` is set, the footer button named by `initialFocus`, else the first focusable.
|
|
77
77
|
*/
|
|
78
|
-
static pickInitialFocus(dialog,
|
|
79
|
-
const { remembered, footer, initialFocus, autofocus } = options;
|
|
78
|
+
static pickInitialFocus(dialog, { remembered, footer, initialFocus, autofocus }) {
|
|
80
79
|
const button = initialFocus ? footer?.querySelector(`[data-type="${initialFocus}"]`) : null;
|
|
81
80
|
return (remembered?.isConnected ? remembered : null) ?? (autofocus ? FocusTrapHandle.findAutofocus(dialog) : null) ?? button ?? FocusTrapHandle.getFocusableElements(dialog)[0];
|
|
82
81
|
}
|