@deepfuture/dui-components 0.0.1
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/accordion-context.d.ts +15 -0
- package/accordion/accordion-context.js +3 -0
- package/accordion/accordion-item.d.ts +22 -0
- package/accordion/accordion-item.js +254 -0
- package/accordion/accordion.d.ts +20 -0
- package/accordion/accordion.js +185 -0
- package/accordion/index.d.ts +3 -0
- package/accordion/index.js +2 -0
- package/accordion/register.d.ts +1 -0
- package/accordion/register.js +8 -0
- package/alert-dialog/alert-dialog-close.d.ts +15 -0
- package/alert-dialog/alert-dialog-close.js +35 -0
- package/alert-dialog/alert-dialog-context.d.ts +13 -0
- package/alert-dialog/alert-dialog-context.js +3 -0
- package/alert-dialog/alert-dialog-popup.d.ts +34 -0
- package/alert-dialog/alert-dialog-popup.js +260 -0
- package/alert-dialog/alert-dialog-trigger.d.ts +15 -0
- package/alert-dialog/alert-dialog-trigger.js +52 -0
- package/alert-dialog/alert-dialog.d.ts +30 -0
- package/alert-dialog/alert-dialog.js +97 -0
- package/alert-dialog/index.d.ts +6 -0
- package/alert-dialog/index.js +4 -0
- package/alert-dialog/register.d.ts +1 -0
- package/alert-dialog/register.js +16 -0
- package/all.d.ts +86 -0
- package/all.js +191 -0
- package/avatar/avatar.d.ts +41 -0
- package/avatar/avatar.js +188 -0
- package/avatar/index.d.ts +2 -0
- package/avatar/index.js +1 -0
- package/avatar/register.d.ts +1 -0
- package/avatar/register.js +4 -0
- package/badge/badge.d.ts +14 -0
- package/badge/badge.js +43 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +1 -0
- package/badge/register.d.ts +1 -0
- package/badge/register.js +4 -0
- package/breadcrumb/breadcrumb-ellipsis.d.ts +14 -0
- package/breadcrumb/breadcrumb-ellipsis.js +39 -0
- package/breadcrumb/breadcrumb-item.d.ts +13 -0
- package/breadcrumb/breadcrumb-item.js +31 -0
- package/breadcrumb/breadcrumb-link.d.ts +14 -0
- package/breadcrumb/breadcrumb-link.js +32 -0
- package/breadcrumb/breadcrumb-page.d.ts +13 -0
- package/breadcrumb/breadcrumb-page.js +36 -0
- package/breadcrumb/breadcrumb-separator.d.ts +14 -0
- package/breadcrumb/breadcrumb-separator.js +36 -0
- package/breadcrumb/breadcrumb.d.ts +14 -0
- package/breadcrumb/breadcrumb.js +38 -0
- package/breadcrumb/index.d.ts +6 -0
- package/breadcrumb/index.js +6 -0
- package/breadcrumb/register.d.ts +1 -0
- package/breadcrumb/register.js +14 -0
- package/button/button.d.ts +38 -0
- package/button/button.js +143 -0
- package/button/index.d.ts +2 -0
- package/button/index.js +1 -0
- package/button/register.d.ts +1 -0
- package/button/register.js +4 -0
- package/calendar/calendar.d.ts +33 -0
- package/calendar/calendar.js +428 -0
- package/calendar/index.d.ts +1 -0
- package/calendar/index.js +1 -0
- package/calendar/register.d.ts +1 -0
- package/calendar/register.js +4 -0
- package/center/center.d.ts +14 -0
- package/center/center.js +37 -0
- package/center/index.d.ts +1 -0
- package/center/index.js +1 -0
- package/center/register.d.ts +1 -0
- package/center/register.js +4 -0
- package/checkbox/checkbox-group-context.d.ts +11 -0
- package/checkbox/checkbox-group-context.js +3 -0
- package/checkbox/checkbox-group.d.ts +34 -0
- package/checkbox/checkbox-group.js +128 -0
- package/checkbox/checkbox.d.ts +46 -0
- package/checkbox/checkbox.js +314 -0
- package/checkbox/index.d.ts +3 -0
- package/checkbox/index.js +2 -0
- package/checkbox/register.d.ts +1 -0
- package/checkbox/register.js +8 -0
- package/collapsible/collapsible.d.ts +22 -0
- package/collapsible/collapsible.js +227 -0
- package/collapsible/index.d.ts +1 -0
- package/collapsible/index.js +1 -0
- package/collapsible/register.d.ts +1 -0
- package/collapsible/register.js +4 -0
- package/combobox/combobox.d.ts +46 -0
- package/combobox/combobox.js +524 -0
- package/combobox/index.d.ts +2 -0
- package/combobox/index.js +1 -0
- package/combobox/register.d.ts +1 -0
- package/combobox/register.js +4 -0
- package/command/command-context.d.ts +30 -0
- package/command/command-context.js +3 -0
- package/command/command-empty.d.ts +10 -0
- package/command/command-empty.js +50 -0
- package/command/command-group.d.ts +15 -0
- package/command/command-group.js +79 -0
- package/command/command-input.d.ts +13 -0
- package/command/command-input.js +106 -0
- package/command/command-item.d.ts +20 -0
- package/command/command-item.js +175 -0
- package/command/command-list.d.ts +9 -0
- package/command/command-list.js +43 -0
- package/command/command-score.d.ts +6 -0
- package/command/command-score.js +31 -0
- package/command/command-separator.d.ts +7 -0
- package/command/command-separator.js +15 -0
- package/command/command-shortcut.d.ts +7 -0
- package/command/command-shortcut.js +16 -0
- package/command/command.d.ts +25 -0
- package/command/command.js +278 -0
- package/command/index.d.ts +10 -0
- package/command/index.js +9 -0
- package/command/register.d.ts +1 -0
- package/command/register.js +22 -0
- package/data-table/data-table.d.ts +59 -0
- package/data-table/data-table.js +416 -0
- package/data-table/index.d.ts +2 -0
- package/data-table/index.js +1 -0
- package/data-table/register.d.ts +1 -0
- package/data-table/register.js +4 -0
- package/dialog/dialog-close.d.ts +15 -0
- package/dialog/dialog-close.js +35 -0
- package/dialog/dialog-context.d.ts +13 -0
- package/dialog/dialog-context.js +3 -0
- package/dialog/dialog-popup.d.ts +36 -0
- package/dialog/dialog-popup.js +277 -0
- package/dialog/dialog-trigger.d.ts +15 -0
- package/dialog/dialog-trigger.js +52 -0
- package/dialog/dialog.d.ts +30 -0
- package/dialog/dialog.js +97 -0
- package/dialog/index.d.ts +6 -0
- package/dialog/index.js +4 -0
- package/dialog/register.d.ts +1 -0
- package/dialog/register.js +16 -0
- package/dropzone/dropzone.d.ts +74 -0
- package/dropzone/dropzone.js +357 -0
- package/dropzone/index.d.ts +2 -0
- package/dropzone/index.js +1 -0
- package/dropzone/register.d.ts +1 -0
- package/dropzone/register.js +4 -0
- package/field/field-context.d.ts +20 -0
- package/field/field-context.js +2 -0
- package/field/index.d.ts +2 -0
- package/field/index.js +1 -0
- package/global.d.ts +189 -0
- package/hstack/hstack.d.ts +25 -0
- package/hstack/hstack.js +141 -0
- package/hstack/index.d.ts +2 -0
- package/hstack/index.js +1 -0
- package/hstack/register.d.ts +1 -0
- package/hstack/register.js +4 -0
- package/icon/icon.d.ts +16 -0
- package/icon/icon.js +34 -0
- package/icon/index.d.ts +1 -0
- package/icon/index.js +1 -0
- package/icon/register.d.ts +1 -0
- package/icon/register.js +4 -0
- package/input/index.d.ts +1 -0
- package/input/index.js +1 -0
- package/input/input.d.ts +47 -0
- package/input/input.js +205 -0
- package/input/register.d.ts +1 -0
- package/input/register.js +4 -0
- package/link/index.d.ts +1 -0
- package/link/index.js +1 -0
- package/link/link.d.ts +27 -0
- package/link/link.js +57 -0
- package/link/register.d.ts +1 -0
- package/link/register.js +4 -0
- package/menu/index.d.ts +2 -0
- package/menu/index.js +2 -0
- package/menu/menu-item.d.ts +17 -0
- package/menu/menu-item.js +62 -0
- package/menu/menu.d.ts +15 -0
- package/menu/menu.js +228 -0
- package/menu/register.d.ts +1 -0
- package/menu/register.js +8 -0
- package/menubar/index.d.ts +2 -0
- package/menubar/index.js +1 -0
- package/menubar/menubar-context.d.ts +9 -0
- package/menubar/menubar-context.js +2 -0
- package/menubar/menubar.d.ts +19 -0
- package/menubar/menubar.js +130 -0
- package/menubar/register.d.ts +1 -0
- package/menubar/register.js +4 -0
- package/number-field/index.d.ts +1 -0
- package/number-field/index.js +1 -0
- package/number-field/number-field.d.ts +34 -0
- package/number-field/number-field.js +326 -0
- package/number-field/register.d.ts +1 -0
- package/number-field/register.js +4 -0
- package/package.json +217 -0
- package/page-inset/index.d.ts +1 -0
- package/page-inset/index.js +1 -0
- package/page-inset/page-inset.d.ts +28 -0
- package/page-inset/page-inset.js +103 -0
- package/page-inset/register.d.ts +1 -0
- package/page-inset/register.js +4 -0
- package/popover/index.d.ts +6 -0
- package/popover/index.js +4 -0
- package/popover/popover-close.d.ts +13 -0
- package/popover/popover-close.js +33 -0
- package/popover/popover-context.d.ts +17 -0
- package/popover/popover-context.js +3 -0
- package/popover/popover-popup.d.ts +20 -0
- package/popover/popover-popup.js +176 -0
- package/popover/popover-trigger.d.ts +13 -0
- package/popover/popover-trigger.js +57 -0
- package/popover/popover.d.ts +30 -0
- package/popover/popover.js +140 -0
- package/popover/register.d.ts +1 -0
- package/popover/register.js +16 -0
- package/portal/index.d.ts +2 -0
- package/portal/index.js +1 -0
- package/portal/portal.d.ts +29 -0
- package/portal/portal.js +115 -0
- package/portal/register.d.ts +1 -0
- package/portal/register.js +4 -0
- package/preview-card/index.d.ts +5 -0
- package/preview-card/index.js +3 -0
- package/preview-card/preview-card-context.d.ts +16 -0
- package/preview-card/preview-card-context.js +3 -0
- package/preview-card/preview-card-popup.d.ts +16 -0
- package/preview-card/preview-card-popup.js +167 -0
- package/preview-card/preview-card-trigger.d.ts +13 -0
- package/preview-card/preview-card-trigger.js +75 -0
- package/preview-card/preview-card.d.ts +34 -0
- package/preview-card/preview-card.js +164 -0
- package/preview-card/register.d.ts +1 -0
- package/preview-card/register.js +12 -0
- package/progress/index.d.ts +1 -0
- package/progress/index.js +1 -0
- package/progress/progress.d.ts +19 -0
- package/progress/progress.js +94 -0
- package/progress/register.d.ts +1 -0
- package/progress/register.js +4 -0
- package/radio/index.d.ts +3 -0
- package/radio/index.js +2 -0
- package/radio/radio-group-context.d.ts +11 -0
- package/radio/radio-group-context.js +2 -0
- package/radio/radio-group.d.ts +37 -0
- package/radio/radio-group.js +135 -0
- package/radio/radio.d.ts +27 -0
- package/radio/radio.js +204 -0
- package/radio/register.d.ts +1 -0
- package/radio/register.js +8 -0
- package/scroll-area/index.d.ts +1 -0
- package/scroll-area/index.js +1 -0
- package/scroll-area/register.d.ts +1 -0
- package/scroll-area/register.js +4 -0
- package/scroll-area/scroll-area.d.ts +38 -0
- package/scroll-area/scroll-area.js +453 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +1 -0
- package/select/register.d.ts +1 -0
- package/select/register.js +4 -0
- package/select/select.d.ts +36 -0
- package/select/select.js +404 -0
- package/separator/index.d.ts +1 -0
- package/separator/index.js +1 -0
- package/separator/register.d.ts +1 -0
- package/separator/register.js +4 -0
- package/separator/separator.d.ts +12 -0
- package/separator/separator.js +50 -0
- package/sidebar/index.d.ts +16 -0
- package/sidebar/index.js +13 -0
- package/sidebar/register.d.ts +1 -0
- package/sidebar/register.js +52 -0
- package/sidebar/sidebar-content.d.ts +14 -0
- package/sidebar/sidebar-content.js +30 -0
- package/sidebar/sidebar-context.d.ts +15 -0
- package/sidebar/sidebar-context.js +3 -0
- package/sidebar/sidebar-footer.d.ts +12 -0
- package/sidebar/sidebar-footer.js +21 -0
- package/sidebar/sidebar-group-label.d.ts +17 -0
- package/sidebar/sidebar-group-label.js +49 -0
- package/sidebar/sidebar-group.d.ts +15 -0
- package/sidebar/sidebar-group.js +29 -0
- package/sidebar/sidebar-header.d.ts +12 -0
- package/sidebar/sidebar-header.js +21 -0
- package/sidebar/sidebar-inset.d.ts +15 -0
- package/sidebar/sidebar-inset.js +29 -0
- package/sidebar/sidebar-menu-button.d.ts +31 -0
- package/sidebar/sidebar-menu-button.js +201 -0
- package/sidebar/sidebar-menu-item.d.ts +12 -0
- package/sidebar/sidebar-menu-item.js +20 -0
- package/sidebar/sidebar-menu.d.ts +14 -0
- package/sidebar/sidebar-menu.js +30 -0
- package/sidebar/sidebar-provider.d.ts +34 -0
- package/sidebar/sidebar-provider.js +157 -0
- package/sidebar/sidebar-separator.d.ts +12 -0
- package/sidebar/sidebar-separator.js +24 -0
- package/sidebar/sidebar-trigger.d.ts +16 -0
- package/sidebar/sidebar-trigger.js +50 -0
- package/sidebar/sidebar.d.ts +21 -0
- package/sidebar/sidebar.js +228 -0
- package/slider/index.d.ts +1 -0
- package/slider/index.js +1 -0
- package/slider/register.d.ts +1 -0
- package/slider/register.js +4 -0
- package/slider/slider.d.ts +37 -0
- package/slider/slider.js +268 -0
- package/spinner/index.d.ts +1 -0
- package/spinner/index.js +1 -0
- package/spinner/register.d.ts +1 -0
- package/spinner/register.js +4 -0
- package/spinner/spinner.d.ts +18 -0
- package/spinner/spinner.js +138 -0
- package/switch/index.d.ts +1 -0
- package/switch/index.js +1 -0
- package/switch/register.d.ts +1 -0
- package/switch/register.js +4 -0
- package/switch/switch.d.ts +29 -0
- package/switch/switch.js +201 -0
- package/tabs/index.d.ts +6 -0
- package/tabs/index.js +5 -0
- package/tabs/register.d.ts +1 -0
- package/tabs/register.js +10 -0
- package/tabs/tab.d.ts +16 -0
- package/tabs/tab.js +98 -0
- package/tabs/tabs-context.d.ts +8 -0
- package/tabs/tabs-context.js +2 -0
- package/tabs/tabs-indicator.d.ts +11 -0
- package/tabs/tabs-indicator.js +27 -0
- package/tabs/tabs-list.d.ts +17 -0
- package/tabs/tabs-list.js +85 -0
- package/tabs/tabs-panel.d.ts +18 -0
- package/tabs/tabs-panel.js +85 -0
- package/tabs/tabs.d.ts +24 -0
- package/tabs/tabs.js +111 -0
- package/textarea/index.d.ts +2 -0
- package/textarea/index.js +1 -0
- package/textarea/register.d.ts +1 -0
- package/textarea/register.js +4 -0
- package/textarea/textarea.d.ts +37 -0
- package/textarea/textarea.js +170 -0
- package/toggle/index.d.ts +3 -0
- package/toggle/index.js +2 -0
- package/toggle/register.d.ts +1 -0
- package/toggle/register.js +8 -0
- package/toggle/toggle-group-context.d.ts +9 -0
- package/toggle/toggle-group-context.js +2 -0
- package/toggle/toggle-group.d.ts +27 -0
- package/toggle/toggle-group.js +163 -0
- package/toggle/toggle.d.ts +25 -0
- package/toggle/toggle.js +124 -0
- package/toolbar/index.d.ts +1 -0
- package/toolbar/index.js +1 -0
- package/toolbar/register.d.ts +1 -0
- package/toolbar/register.js +4 -0
- package/toolbar/toolbar.d.ts +15 -0
- package/toolbar/toolbar.js +89 -0
- package/tooltip/index.d.ts +5 -0
- package/tooltip/index.js +3 -0
- package/tooltip/register.d.ts +1 -0
- package/tooltip/register.js +12 -0
- package/tooltip/tooltip-context.d.ts +17 -0
- package/tooltip/tooltip-context.js +3 -0
- package/tooltip/tooltip-popup.d.ts +16 -0
- package/tooltip/tooltip-popup.js +162 -0
- package/tooltip/tooltip-trigger.d.ts +15 -0
- package/tooltip/tooltip-trigger.js +110 -0
- package/tooltip/tooltip.d.ts +36 -0
- package/tooltip/tooltip.js +176 -0
- package/trunc/index.d.ts +1 -0
- package/trunc/index.js +1 -0
- package/trunc/register.d.ts +1 -0
- package/trunc/register.js +4 -0
- package/trunc/trunc.d.ts +19 -0
- package/trunc/trunc.js +68 -0
- package/vstack/index.d.ts +1 -0
- package/vstack/index.js +1 -0
- package/vstack/register.d.ts +1 -0
- package/vstack/register.js +4 -0
- package/vstack/vstack.d.ts +17 -0
- package/vstack/vstack.js +83 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
import { css, html, LitElement } from "lit";
|
|
9
|
+
import { property } from "lit/decorators.js";
|
|
10
|
+
import { ContextConsumer } from "@lit/context";
|
|
11
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
12
|
+
import { getComposedFocusableElements, queryComposedAutofocus, } from "@deepfuture/dui-core/dom";
|
|
13
|
+
import { dialogContext } from "./dialog-context.js";
|
|
14
|
+
const hostStyles = css `
|
|
15
|
+
:host {
|
|
16
|
+
display: contents;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host(:not([mounted])) [part="backdrop"],
|
|
20
|
+
:host(:not([mounted])) [part="popup"] {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const componentStyles = css `
|
|
25
|
+
[part="backdrop"] {
|
|
26
|
+
position: fixed;
|
|
27
|
+
min-height: 100dvh;
|
|
28
|
+
inset: 0;
|
|
29
|
+
z-index: 999;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part="popup"] {
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: 50%;
|
|
36
|
+
left: 50%;
|
|
37
|
+
transform: translate(-50%, -50%);
|
|
38
|
+
width: var(--popup-width, 24rem);
|
|
39
|
+
max-width: calc(100vw - 3rem);
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
z-index: 1000;
|
|
42
|
+
transition-property: opacity, transform;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
/**
|
|
46
|
+
* `<dui-dialog-popup>` — The popup overlay for the dialog.
|
|
47
|
+
*
|
|
48
|
+
* Renders a backdrop and a centered dialog popup with focus trapping.
|
|
49
|
+
* Handles open/close animations via `data-starting-style` / `data-ending-style`.
|
|
50
|
+
* Closes on backdrop click (unlike `<dui-alert-dialog-popup>`).
|
|
51
|
+
*
|
|
52
|
+
* Title and description are provided via named slots and rendered as
|
|
53
|
+
* semantic `<h2>` and `<p>` elements with ARIA linkage.
|
|
54
|
+
*
|
|
55
|
+
* @slot title - Title text for the dialog (rendered as `<h2>`).
|
|
56
|
+
* @slot description - Description text for the dialog (rendered as `<p>`).
|
|
57
|
+
* @slot - Default slot for dialog content (actions, form fields, etc.).
|
|
58
|
+
* @csspart backdrop - The overlay backdrop behind the dialog.
|
|
59
|
+
* @csspart popup - The dialog popup container.
|
|
60
|
+
* @csspart title - The heading element wrapping the title slot.
|
|
61
|
+
* @csspart description - The paragraph element wrapping the description slot.
|
|
62
|
+
*/
|
|
63
|
+
export class DuiDialogPopup extends LitElement {
|
|
64
|
+
static { this.tagName = "dui-dialog-popup"; }
|
|
65
|
+
static { this.styles = [base, hostStyles, componentStyles]; }
|
|
66
|
+
#keepMounted_accessor_storage = false;
|
|
67
|
+
/** Keep the popup in the DOM when closed. */
|
|
68
|
+
get keepMounted() { return this.#keepMounted_accessor_storage; }
|
|
69
|
+
set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
|
|
70
|
+
#initialFocus_accessor_storage = undefined;
|
|
71
|
+
/** CSS selector within the popup to focus when the dialog opens. */
|
|
72
|
+
get initialFocus() { return this.#initialFocus_accessor_storage; }
|
|
73
|
+
set initialFocus(value) { this.#initialFocus_accessor_storage = value; }
|
|
74
|
+
#finalFocus_accessor_storage = undefined;
|
|
75
|
+
/** CSS selector in the document to focus when the dialog closes. */
|
|
76
|
+
get finalFocus() { return this.#finalFocus_accessor_storage; }
|
|
77
|
+
set finalFocus(value) { this.#finalFocus_accessor_storage = value; }
|
|
78
|
+
#width_accessor_storage = undefined;
|
|
79
|
+
/** Width of the popup (CSS value, e.g. "32rem" or "600px"). Defaults to 24rem. */
|
|
80
|
+
get width() { return this.#width_accessor_storage; }
|
|
81
|
+
set width(value) { this.#width_accessor_storage = value; }
|
|
82
|
+
#mounted_accessor_storage = false;
|
|
83
|
+
get #mounted() { return this.#mounted_accessor_storage; }
|
|
84
|
+
set #mounted(value) { this.#mounted_accessor_storage = value; }
|
|
85
|
+
#startingStyle_accessor_storage = false;
|
|
86
|
+
get #startingStyle() { return this.#startingStyle_accessor_storage; }
|
|
87
|
+
set #startingStyle(value) { this.#startingStyle_accessor_storage = value; }
|
|
88
|
+
#endingStyle_accessor_storage = false;
|
|
89
|
+
get #endingStyle() { return this.#endingStyle_accessor_storage; }
|
|
90
|
+
set #endingStyle(value) { this.#endingStyle_accessor_storage = value; }
|
|
91
|
+
#previouslyFocused;
|
|
92
|
+
#ctx = new ContextConsumer(this, {
|
|
93
|
+
context: dialogContext,
|
|
94
|
+
subscribe: true,
|
|
95
|
+
});
|
|
96
|
+
updated() {
|
|
97
|
+
const isOpen = this.#ctx.value?.open ?? false;
|
|
98
|
+
if (isOpen && !this.#mounted) {
|
|
99
|
+
this.#animateOpen();
|
|
100
|
+
}
|
|
101
|
+
else if (!isOpen && this.#mounted && !this.#endingStyle) {
|
|
102
|
+
this.#animateClose();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async #animateOpen() {
|
|
106
|
+
this.#previouslyFocused =
|
|
107
|
+
document.activeElement ?? undefined;
|
|
108
|
+
this.#mounted = true;
|
|
109
|
+
this.#startingStyle = true;
|
|
110
|
+
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
111
|
+
this.#startingStyle = false;
|
|
112
|
+
await this.updateComplete;
|
|
113
|
+
this.#trapFocusIn();
|
|
114
|
+
}
|
|
115
|
+
#animateClose() {
|
|
116
|
+
this.#endingStyle = true;
|
|
117
|
+
const popup = this.shadowRoot?.querySelector('[part="popup"]');
|
|
118
|
+
if (!popup) {
|
|
119
|
+
this.#finishClose();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
let called = false;
|
|
123
|
+
const done = () => {
|
|
124
|
+
if (called)
|
|
125
|
+
return;
|
|
126
|
+
called = true;
|
|
127
|
+
popup.removeEventListener("transitionend", onEnd);
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
this.#finishClose();
|
|
130
|
+
};
|
|
131
|
+
const onEnd = (e) => {
|
|
132
|
+
if (e.propertyName === "opacity") {
|
|
133
|
+
done();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
popup.addEventListener("transitionend", onEnd);
|
|
137
|
+
const timer = setTimeout(done, 200);
|
|
138
|
+
}
|
|
139
|
+
#finishClose() {
|
|
140
|
+
if (!this.#endingStyle && !this.#mounted)
|
|
141
|
+
return;
|
|
142
|
+
this.#endingStyle = false;
|
|
143
|
+
if (!this.keepMounted) {
|
|
144
|
+
this.#mounted = false;
|
|
145
|
+
}
|
|
146
|
+
this.#restoreFocus();
|
|
147
|
+
}
|
|
148
|
+
#trapFocusIn() {
|
|
149
|
+
const popup = this.shadowRoot?.querySelector('[part="popup"]');
|
|
150
|
+
if (!popup)
|
|
151
|
+
return;
|
|
152
|
+
if (this.initialFocus) {
|
|
153
|
+
const target = popup.querySelector(this.initialFocus);
|
|
154
|
+
if (target) {
|
|
155
|
+
target.focus();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const autoEl = queryComposedAutofocus(popup);
|
|
160
|
+
if (autoEl) {
|
|
161
|
+
autoEl.focus();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const focusables = getComposedFocusableElements(popup);
|
|
165
|
+
if (focusables.length > 0) {
|
|
166
|
+
focusables[0].focus();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
popup.focus();
|
|
170
|
+
}
|
|
171
|
+
#restoreFocus() {
|
|
172
|
+
if (this.finalFocus) {
|
|
173
|
+
const target = document.querySelector(this.finalFocus);
|
|
174
|
+
target?.focus();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.#previouslyFocused?.focus();
|
|
178
|
+
this.#previouslyFocused = undefined;
|
|
179
|
+
}
|
|
180
|
+
#handleKeyDown = (e) => {
|
|
181
|
+
if (e.key === "Escape") {
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
e.stopPropagation();
|
|
184
|
+
this.#ctx.value?.closeDialog();
|
|
185
|
+
}
|
|
186
|
+
if (e.key === "Tab") {
|
|
187
|
+
this.#handleTabTrap(e);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
#handleTabTrap(e) {
|
|
191
|
+
const popup = this.shadowRoot?.querySelector('[part="popup"]');
|
|
192
|
+
if (!popup)
|
|
193
|
+
return;
|
|
194
|
+
const focusables = getComposedFocusableElements(popup);
|
|
195
|
+
if (focusables.length === 0) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const first = focusables[0];
|
|
200
|
+
const last = focusables[focusables.length - 1];
|
|
201
|
+
const isFirst = first.matches(":focus");
|
|
202
|
+
const isLast = last.matches(":focus");
|
|
203
|
+
const popupHasFocus = !focusables.some((el) => el.matches(":focus"));
|
|
204
|
+
if (e.shiftKey && (isFirst || popupHasFocus)) {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
last.focus();
|
|
207
|
+
}
|
|
208
|
+
else if (!e.shiftKey && isLast) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
first.focus();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
#handleBackdropClick = () => {
|
|
214
|
+
this.#ctx.value?.closeDialog();
|
|
215
|
+
};
|
|
216
|
+
willUpdate(changed) {
|
|
217
|
+
if (changed.has("width")) {
|
|
218
|
+
if (this.width)
|
|
219
|
+
this.style.setProperty("--popup-width", this.width);
|
|
220
|
+
else
|
|
221
|
+
this.style.removeProperty("--popup-width");
|
|
222
|
+
}
|
|
223
|
+
if (this.#mounted || this.keepMounted) {
|
|
224
|
+
this.setAttribute("mounted", "");
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.removeAttribute("mounted");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
render() {
|
|
231
|
+
const isOpen = this.#ctx.value?.open ?? false;
|
|
232
|
+
const titleId = this.#ctx.value?.titleId ?? "";
|
|
233
|
+
const descriptionId = this.#ctx.value?.descriptionId ?? "";
|
|
234
|
+
if (!this.#mounted && !this.keepMounted) {
|
|
235
|
+
return html ``;
|
|
236
|
+
}
|
|
237
|
+
return html `
|
|
238
|
+
<div
|
|
239
|
+
part="backdrop"
|
|
240
|
+
?data-open="${isOpen && !this.#endingStyle}"
|
|
241
|
+
?data-closed="${!isOpen || this.#endingStyle}"
|
|
242
|
+
?data-starting-style="${this.#startingStyle}"
|
|
243
|
+
?data-ending-style="${this.#endingStyle}"
|
|
244
|
+
@click="${this.#handleBackdropClick}"
|
|
245
|
+
></div>
|
|
246
|
+
<div
|
|
247
|
+
part="popup"
|
|
248
|
+
role="dialog"
|
|
249
|
+
aria-modal="true"
|
|
250
|
+
aria-labelledby="${titleId}"
|
|
251
|
+
aria-describedby="${descriptionId}"
|
|
252
|
+
?data-open="${isOpen && !this.#endingStyle}"
|
|
253
|
+
?data-closed="${!isOpen || this.#endingStyle}"
|
|
254
|
+
?data-starting-style="${this.#startingStyle}"
|
|
255
|
+
?data-ending-style="${this.#endingStyle}"
|
|
256
|
+
tabindex="-1"
|
|
257
|
+
@keydown="${this.#handleKeyDown}"
|
|
258
|
+
>
|
|
259
|
+
<h2 part="title" id="${titleId}"><slot name="title"></slot></h2>
|
|
260
|
+
<p part="description" id="${descriptionId}"><slot name="description"></slot></p>
|
|
261
|
+
<slot></slot>
|
|
262
|
+
</div>
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
__decorate([
|
|
267
|
+
property({ type: Boolean, attribute: "keep-mounted" })
|
|
268
|
+
], DuiDialogPopup.prototype, "keepMounted", null);
|
|
269
|
+
__decorate([
|
|
270
|
+
property({ attribute: "initial-focus" })
|
|
271
|
+
], DuiDialogPopup.prototype, "initialFocus", null);
|
|
272
|
+
__decorate([
|
|
273
|
+
property({ attribute: "final-focus" })
|
|
274
|
+
], DuiDialogPopup.prototype, "finalFocus", null);
|
|
275
|
+
__decorate([
|
|
276
|
+
property()
|
|
277
|
+
], DuiDialogPopup.prototype, "width", null);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-dialog-trigger>` — Behavioral wrapper that opens the dialog.
|
|
5
|
+
*
|
|
6
|
+
* Wraps slotted content and opens the dialog on click.
|
|
7
|
+
*
|
|
8
|
+
* @slot - Content that triggers the dialog (usually a `<dui-button>`).
|
|
9
|
+
*/
|
|
10
|
+
export declare class DuiDialogTrigger extends LitElement {
|
|
11
|
+
#private;
|
|
12
|
+
static tagName: "dui-dialog-trigger";
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
|
|
2
|
+
import { css, html, LitElement } from "lit";
|
|
3
|
+
import { ContextConsumer } from "@lit/context";
|
|
4
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
5
|
+
import { dialogContext } from "./dialog-context.js";
|
|
6
|
+
const hostStyles = css `
|
|
7
|
+
:host {
|
|
8
|
+
display: contents;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const componentStyles = css `
|
|
12
|
+
.Trigger {
|
|
13
|
+
display: contents;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
/**
|
|
17
|
+
* `<dui-dialog-trigger>` — Behavioral wrapper that opens the dialog.
|
|
18
|
+
*
|
|
19
|
+
* Wraps slotted content and opens the dialog on click.
|
|
20
|
+
*
|
|
21
|
+
* @slot - Content that triggers the dialog (usually a `<dui-button>`).
|
|
22
|
+
*/
|
|
23
|
+
export class DuiDialogTrigger extends LitElement {
|
|
24
|
+
static { this.tagName = "dui-dialog-trigger"; }
|
|
25
|
+
static { this.styles = [base, hostStyles, componentStyles]; }
|
|
26
|
+
#ctx = new ContextConsumer(this, {
|
|
27
|
+
context: dialogContext,
|
|
28
|
+
subscribe: true,
|
|
29
|
+
});
|
|
30
|
+
#handleClick = () => {
|
|
31
|
+
this.#ctx.value?.openDialog();
|
|
32
|
+
};
|
|
33
|
+
render() {
|
|
34
|
+
const isOpen = this.#ctx.value?.open ?? false;
|
|
35
|
+
const triggerId = this.#ctx.value?.triggerId ?? "";
|
|
36
|
+
const dialogId = this.#ctx.value?.dialogId ?? "";
|
|
37
|
+
return html `
|
|
38
|
+
<span
|
|
39
|
+
class="Trigger"
|
|
40
|
+
part="trigger"
|
|
41
|
+
id="${triggerId}"
|
|
42
|
+
aria-haspopup="dialog"
|
|
43
|
+
aria-expanded="${isOpen}"
|
|
44
|
+
aria-controls="${isOpen ? dialogId : ""}"
|
|
45
|
+
?data-popup-open="${isOpen}"
|
|
46
|
+
@click="${this.#handleClick}"
|
|
47
|
+
>
|
|
48
|
+
<slot></slot>
|
|
49
|
+
</span>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
export type DialogOpenChangeDetail = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const openChangeEvent: (detail: DialogOpenChangeDetail) => CustomEvent<DialogOpenChangeDetail>;
|
|
7
|
+
/**
|
|
8
|
+
* `<dui-dialog>` — Root element for the dialog compound component.
|
|
9
|
+
*
|
|
10
|
+
* Manages open/close state and provides context to child elements.
|
|
11
|
+
* Does not render visible DOM — uses `display: contents`.
|
|
12
|
+
*
|
|
13
|
+
* Unlike `<dui-alert-dialog>`, this dialog closes on backdrop click,
|
|
14
|
+
* following WAI-ARIA `dialog` semantics for non-critical modals.
|
|
15
|
+
*
|
|
16
|
+
* @slot - Default slot for trigger, popup, and other dialog parts.
|
|
17
|
+
* @fires open-change - Fired when the dialog opens or closes. Detail: { open: boolean }
|
|
18
|
+
*/
|
|
19
|
+
export declare class DuiDialog extends LitElement {
|
|
20
|
+
#private;
|
|
21
|
+
static tagName: "dui-dialog";
|
|
22
|
+
static styles: import("lit").CSSResult[];
|
|
23
|
+
/** Controls the dialog open state (controlled mode). */
|
|
24
|
+
accessor open: boolean | undefined;
|
|
25
|
+
/** Initial open state for uncontrolled mode. */
|
|
26
|
+
accessor defaultOpen: boolean;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
willUpdate(): void;
|
|
29
|
+
render(): TemplateResult;
|
|
30
|
+
}
|
package/dialog/dialog.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
import { css, html, LitElement } from "lit";
|
|
9
|
+
import { property } from "lit/decorators.js";
|
|
10
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
11
|
+
import { customEvent } from "@deepfuture/dui-core/event";
|
|
12
|
+
export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
|
|
13
|
+
const hostStyles = css `
|
|
14
|
+
:host {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
/**
|
|
19
|
+
* `<dui-dialog>` — Root element for the dialog compound component.
|
|
20
|
+
*
|
|
21
|
+
* Manages open/close state and provides context to child elements.
|
|
22
|
+
* Does not render visible DOM — uses `display: contents`.
|
|
23
|
+
*
|
|
24
|
+
* Unlike `<dui-alert-dialog>`, this dialog closes on backdrop click,
|
|
25
|
+
* following WAI-ARIA `dialog` semantics for non-critical modals.
|
|
26
|
+
*
|
|
27
|
+
* @slot - Default slot for trigger, popup, and other dialog parts.
|
|
28
|
+
* @fires open-change - Fired when the dialog opens or closes. Detail: { open: boolean }
|
|
29
|
+
*/
|
|
30
|
+
export class DuiDialog extends LitElement {
|
|
31
|
+
static { this.tagName = "dui-dialog"; }
|
|
32
|
+
static { this.styles = [base, hostStyles]; }
|
|
33
|
+
#open_accessor_storage = undefined;
|
|
34
|
+
/** Controls the dialog open state (controlled mode). */
|
|
35
|
+
get open() { return this.#open_accessor_storage; }
|
|
36
|
+
set open(value) { this.#open_accessor_storage = value; }
|
|
37
|
+
#defaultOpen_accessor_storage = false;
|
|
38
|
+
/** Initial open state for uncontrolled mode. */
|
|
39
|
+
get defaultOpen() { return this.#defaultOpen_accessor_storage; }
|
|
40
|
+
set defaultOpen(value) { this.#defaultOpen_accessor_storage = value; }
|
|
41
|
+
#internalOpen_accessor_storage = false;
|
|
42
|
+
get #internalOpen() { return this.#internalOpen_accessor_storage; }
|
|
43
|
+
set #internalOpen(value) { this.#internalOpen_accessor_storage = value; }
|
|
44
|
+
#instanceId = crypto.randomUUID().slice(0, 8);
|
|
45
|
+
#dialogId = `dui-dialog-${this.#instanceId}`;
|
|
46
|
+
#triggerId = `dui-trigger-${this.#instanceId}`;
|
|
47
|
+
#titleId = `dui-title-${this.#instanceId}`;
|
|
48
|
+
#descriptionId = `dui-desc-${this.#instanceId}`;
|
|
49
|
+
get #isOpen() {
|
|
50
|
+
return this.open ?? this.#internalOpen;
|
|
51
|
+
}
|
|
52
|
+
#openDialog = () => {
|
|
53
|
+
if (this.open === undefined) {
|
|
54
|
+
this.#internalOpen = true;
|
|
55
|
+
}
|
|
56
|
+
this.dispatchEvent(openChangeEvent({ open: true }));
|
|
57
|
+
};
|
|
58
|
+
#closeDialog = () => {
|
|
59
|
+
if (this.open === undefined) {
|
|
60
|
+
this.#internalOpen = false;
|
|
61
|
+
}
|
|
62
|
+
this.dispatchEvent(openChangeEvent({ open: false }));
|
|
63
|
+
};
|
|
64
|
+
#ctx_accessor_storage = this.#buildContext();
|
|
65
|
+
get #ctx() { return this.#ctx_accessor_storage; }
|
|
66
|
+
set #ctx(value) { this.#ctx_accessor_storage = value; }
|
|
67
|
+
#buildContext() {
|
|
68
|
+
return {
|
|
69
|
+
open: this.#isOpen,
|
|
70
|
+
dialogId: this.#dialogId,
|
|
71
|
+
triggerId: this.#triggerId,
|
|
72
|
+
titleId: this.#titleId,
|
|
73
|
+
descriptionId: this.#descriptionId,
|
|
74
|
+
openDialog: this.#openDialog,
|
|
75
|
+
closeDialog: this.#closeDialog,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
connectedCallback() {
|
|
79
|
+
super.connectedCallback();
|
|
80
|
+
if (this.open === undefined && this.defaultOpen) {
|
|
81
|
+
this.#internalOpen = true;
|
|
82
|
+
}
|
|
83
|
+
this.#ctx = this.#buildContext();
|
|
84
|
+
}
|
|
85
|
+
willUpdate() {
|
|
86
|
+
this.#ctx = this.#buildContext();
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
return html `<slot></slot>`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Boolean, reflect: true })
|
|
94
|
+
], DuiDialog.prototype, "open", null);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: Boolean, attribute: "default-open" })
|
|
97
|
+
], DuiDialog.prototype, "defaultOpen", null);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DuiDialog, openChangeEvent } from "./dialog.js";
|
|
2
|
+
export type { DialogOpenChangeDetail } from "./dialog.js";
|
|
3
|
+
export { DuiDialogTrigger } from "./dialog-trigger.js";
|
|
4
|
+
export { DuiDialogPopup } from "./dialog-popup.js";
|
|
5
|
+
export { DuiDialogClose } from "./dialog-close.js";
|
|
6
|
+
export type { DialogContext } from "./dialog-context.js";
|
package/dialog/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DuiDialog } from "./dialog.js";
|
|
2
|
+
import { DuiDialogTrigger } from "./dialog-trigger.js";
|
|
3
|
+
import { DuiDialogPopup } from "./dialog-popup.js";
|
|
4
|
+
import { DuiDialogClose } from "./dialog-close.js";
|
|
5
|
+
if (!customElements.get(DuiDialog.tagName)) {
|
|
6
|
+
customElements.define(DuiDialog.tagName, DuiDialog);
|
|
7
|
+
}
|
|
8
|
+
if (!customElements.get(DuiDialogTrigger.tagName)) {
|
|
9
|
+
customElements.define(DuiDialogTrigger.tagName, DuiDialogTrigger);
|
|
10
|
+
}
|
|
11
|
+
if (!customElements.get(DuiDialogPopup.tagName)) {
|
|
12
|
+
customElements.define(DuiDialogPopup.tagName, DuiDialogPopup);
|
|
13
|
+
}
|
|
14
|
+
if (!customElements.get(DuiDialogClose.tagName)) {
|
|
15
|
+
customElements.define(DuiDialogClose.tagName, DuiDialogClose);
|
|
16
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/dropzone */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
export type DropzoneErrorCode = "FILE_DIALOG_OPEN_FAILED" | "FILE_PROCESSING_FAILED";
|
|
4
|
+
export type DropzoneRejectionCode = "TOO_MANY_FILES" | "FILE_TOO_LARGE" | "FILE_TOO_SMALL" | "FILE_INVALID_TYPE";
|
|
5
|
+
export type FileRejectionError = {
|
|
6
|
+
code: DropzoneRejectionCode;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
export type RejectedFile = {
|
|
10
|
+
file: File;
|
|
11
|
+
errors: FileRejectionError[];
|
|
12
|
+
};
|
|
13
|
+
export type DropzoneDropDetail = {
|
|
14
|
+
acceptedFiles: File[];
|
|
15
|
+
rejectedFiles: RejectedFile[];
|
|
16
|
+
};
|
|
17
|
+
export type DropzoneAcceptedDetail = {
|
|
18
|
+
acceptedFiles: File[];
|
|
19
|
+
};
|
|
20
|
+
export type DropzoneRejectedDetail = {
|
|
21
|
+
rejectedFiles: RejectedFile[];
|
|
22
|
+
};
|
|
23
|
+
export type DropzoneErrorDetail = {
|
|
24
|
+
error: unknown;
|
|
25
|
+
code: DropzoneErrorCode;
|
|
26
|
+
};
|
|
27
|
+
export declare const dropzoneDropEvent: (detail: DropzoneDropDetail) => CustomEvent<DropzoneDropDetail>;
|
|
28
|
+
export declare const dropAcceptedEvent: (detail: DropzoneAcceptedDetail) => CustomEvent<DropzoneAcceptedDetail>;
|
|
29
|
+
export declare const dropRejectedEvent: (detail: DropzoneRejectedDetail) => CustomEvent<DropzoneRejectedDetail>;
|
|
30
|
+
export declare const dropzoneDragEnterEvent: (detail: void) => CustomEvent<void>;
|
|
31
|
+
export declare const dropzoneDragOverEvent: (detail: void) => CustomEvent<void>;
|
|
32
|
+
export declare const dropzoneDragLeaveEvent: (detail: void) => CustomEvent<void>;
|
|
33
|
+
export declare const dropzoneErrorEvent: (detail: DropzoneErrorDetail) => CustomEvent<DropzoneErrorDetail>;
|
|
34
|
+
/**
|
|
35
|
+
* `<dui-dropzone>` — A drag-and-drop file upload area.
|
|
36
|
+
*
|
|
37
|
+
* @slot - Custom content for the dropzone area.
|
|
38
|
+
* @csspart root - The dropzone container.
|
|
39
|
+
*
|
|
40
|
+
* @fires drop - Files dropped or selected (valid or invalid).
|
|
41
|
+
* @fires drop-accepted - Files that passed validation.
|
|
42
|
+
* @fires drop-rejected - Files that failed validation.
|
|
43
|
+
* @fires dragenter - File dragged over the dropzone.
|
|
44
|
+
* @fires dragover - File hovering over the dropzone.
|
|
45
|
+
* @fires dragleave - File dragged away from the dropzone.
|
|
46
|
+
* @fires dropzone-error - Internal error (e.g. file dialog failure).
|
|
47
|
+
*/
|
|
48
|
+
export declare class DuiDropzone extends LitElement {
|
|
49
|
+
#private;
|
|
50
|
+
static tagName: "dui-dropzone";
|
|
51
|
+
static styles: import("lit").CSSResult[];
|
|
52
|
+
static readonly ERROR_CODES: Record<DropzoneErrorCode, DropzoneErrorCode>;
|
|
53
|
+
static readonly REJECTION_CODES: Record<DropzoneRejectionCode, DropzoneRejectionCode>;
|
|
54
|
+
/** Accepted file types (e.g. "image/*,.pdf"). */
|
|
55
|
+
accessor accept: string | undefined;
|
|
56
|
+
/** Allow multiple files. */
|
|
57
|
+
accessor multiple: boolean;
|
|
58
|
+
/** Disable the dropzone. */
|
|
59
|
+
accessor disabled: boolean;
|
|
60
|
+
/** Maximum number of files allowed. */
|
|
61
|
+
accessor maxFiles: number;
|
|
62
|
+
/** Maximum file size in bytes. */
|
|
63
|
+
accessor maxSize: number;
|
|
64
|
+
/** Minimum file size in bytes. */
|
|
65
|
+
accessor minSize: number;
|
|
66
|
+
/** Auto-focus the dropzone on mount. */
|
|
67
|
+
accessor autoFocus: boolean;
|
|
68
|
+
/** Disable default dropzone styling. */
|
|
69
|
+
accessor noStyle: boolean;
|
|
70
|
+
connectedCallback(): void;
|
|
71
|
+
/** Opens the native file dialog programmatically. */
|
|
72
|
+
openFileDialog(): void;
|
|
73
|
+
render(): TemplateResult;
|
|
74
|
+
}
|