@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,62 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/menu */
|
|
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
|
+
const hostStyles = css `
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([disabled]) {
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const componentStyles = css `
|
|
21
|
+
.Item {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: var(--space-2);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
/**
|
|
29
|
+
* `<dui-menu-item>` — An item within a `dui-menu`.
|
|
30
|
+
*
|
|
31
|
+
* @slot default - Item content (text, icons, etc.).
|
|
32
|
+
*/
|
|
33
|
+
export class DuiMenuItem extends LitElement {
|
|
34
|
+
static { this.tagName = "dui-menu-item"; }
|
|
35
|
+
static { this.styles = [base, hostStyles, componentStyles]; }
|
|
36
|
+
#variant_accessor_storage = "default";
|
|
37
|
+
/** Visual variant. */
|
|
38
|
+
get variant() { return this.#variant_accessor_storage; }
|
|
39
|
+
set variant(value) { this.#variant_accessor_storage = value; }
|
|
40
|
+
#disabled_accessor_storage = false;
|
|
41
|
+
/** Whether the item is disabled. */
|
|
42
|
+
get disabled() { return this.#disabled_accessor_storage; }
|
|
43
|
+
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
44
|
+
connectedCallback() {
|
|
45
|
+
super.connectedCallback();
|
|
46
|
+
this.setAttribute("role", "menuitem");
|
|
47
|
+
this.setAttribute("tabindex", "-1");
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
return html `
|
|
51
|
+
<div class="Item" part="root" aria-disabled="${this.disabled}">
|
|
52
|
+
<slot></slot>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: String, reflect: true })
|
|
59
|
+
], DuiMenuItem.prototype, "variant", null);
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: Boolean, reflect: true })
|
|
62
|
+
], DuiMenuItem.prototype, "disabled", null);
|
package/menu/menu.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/menu */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-menu>` — A popup menu triggered by a slotted element.
|
|
5
|
+
*
|
|
6
|
+
* @slot trigger - The element that opens the menu on click.
|
|
7
|
+
* @slot default - `dui-menu-item` children rendered inside the popup.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DuiMenu extends LitElement {
|
|
10
|
+
#private;
|
|
11
|
+
static tagName: "dui-menu";
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
protected updated(): void;
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
}
|
package/menu/menu.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/menu */
|
|
2
|
+
import { css, html, LitElement } from "lit";
|
|
3
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
4
|
+
import { FloatingPortalController } from "@deepfuture/dui-core/floating-portal-controller";
|
|
5
|
+
import { DuiMenuItem } from "./menu-item.js";
|
|
6
|
+
const hostStyles = css `
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const componentStyles = css `
|
|
12
|
+
.Trigger {
|
|
13
|
+
display: contents;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
/** Styles injected into the portal positioner. */
|
|
18
|
+
const portalPopupStyles = [
|
|
19
|
+
css `
|
|
20
|
+
.Popup {
|
|
21
|
+
background: var(--popover);
|
|
22
|
+
border: var(--border-width-thin) solid var(--border);
|
|
23
|
+
border-radius: var(--radius-md);
|
|
24
|
+
box-shadow: var(--shadow-md);
|
|
25
|
+
max-height: 240px;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
overscroll-behavior: contain;
|
|
28
|
+
opacity: 1;
|
|
29
|
+
transform: translateY(0);
|
|
30
|
+
transition-property: opacity, transform;
|
|
31
|
+
transition-duration: var(--duration-fast);
|
|
32
|
+
transition-timing-function: var(--ease-out-3);
|
|
33
|
+
pointer-events: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.Popup[data-starting-style],
|
|
37
|
+
.Popup[data-ending-style] {
|
|
38
|
+
opacity: 0;
|
|
39
|
+
transform: translateY(calc(var(--space-1) * -1));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.Menu {
|
|
43
|
+
padding: var(--space-1);
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* `<dui-menu>` — A popup menu triggered by a slotted element.
|
|
49
|
+
*
|
|
50
|
+
* @slot trigger - The element that opens the menu on click.
|
|
51
|
+
* @slot default - `dui-menu-item` children rendered inside the popup.
|
|
52
|
+
*/
|
|
53
|
+
export class DuiMenu extends LitElement {
|
|
54
|
+
static { this.tagName = "dui-menu"; }
|
|
55
|
+
static { this.styles = [base, hostStyles, componentStyles]; }
|
|
56
|
+
#highlightedIndex_accessor_storage = -1;
|
|
57
|
+
get #highlightedIndex() { return this.#highlightedIndex_accessor_storage; }
|
|
58
|
+
set #highlightedIndex(value) { this.#highlightedIndex_accessor_storage = value; }
|
|
59
|
+
#getTriggerElement = () => {
|
|
60
|
+
const slot = this.shadowRoot?.querySelector('slot[name="trigger"]');
|
|
61
|
+
return slot?.assignedElements()?.[0];
|
|
62
|
+
};
|
|
63
|
+
#popup = new FloatingPortalController(this, {
|
|
64
|
+
getAnchor: () => this.#getTriggerElement() ?? this,
|
|
65
|
+
matchWidth: false,
|
|
66
|
+
styles: portalPopupStyles,
|
|
67
|
+
contentContainer: ".Menu",
|
|
68
|
+
contentSelector: "dui-menu-item",
|
|
69
|
+
onOpen: () => {
|
|
70
|
+
this.#highlightedIndex = -1;
|
|
71
|
+
this.#getTriggerElement()?.setAttribute("data-open", "");
|
|
72
|
+
},
|
|
73
|
+
onClose: () => {
|
|
74
|
+
this.#highlightedIndex = -1;
|
|
75
|
+
this.#getTriggerElement()?.removeAttribute("data-open");
|
|
76
|
+
},
|
|
77
|
+
renderPopup: (portal) => html `
|
|
78
|
+
<div
|
|
79
|
+
class="Popup"
|
|
80
|
+
?data-starting-style="${portal.isStarting}"
|
|
81
|
+
?data-ending-style="${portal.isEnding}"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="Menu"
|
|
85
|
+
id="${this.#menuId}"
|
|
86
|
+
role="menu"
|
|
87
|
+
@click="${this.#onItemSlotClick}"
|
|
88
|
+
@mousemove="${this.#onMenuMouseMove}"
|
|
89
|
+
></div>
|
|
90
|
+
</div>
|
|
91
|
+
`,
|
|
92
|
+
});
|
|
93
|
+
#menuId = `menu-${crypto.randomUUID().slice(0, 8)}`;
|
|
94
|
+
get #items() {
|
|
95
|
+
const container = this.#popup.renderRoot?.querySelector(".Menu") ?? this;
|
|
96
|
+
return [...container.querySelectorAll("dui-menu-item")];
|
|
97
|
+
}
|
|
98
|
+
updated() {
|
|
99
|
+
const items = this.#items;
|
|
100
|
+
for (let i = 0; i < items.length; i++) {
|
|
101
|
+
if (i === this.#highlightedIndex) {
|
|
102
|
+
items[i].setAttribute("data-highlighted", "");
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
items[i].removeAttribute("data-highlighted");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
#togglePopup() {
|
|
110
|
+
if (this.#popup.isOpen) {
|
|
111
|
+
this.#popup.close();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.#popup.open();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
#onTriggerClick = (event) => {
|
|
118
|
+
event.stopPropagation();
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
this.#togglePopup();
|
|
121
|
+
};
|
|
122
|
+
#onItemSlotClick = (event) => {
|
|
123
|
+
const item = event
|
|
124
|
+
.composedPath()
|
|
125
|
+
.find((el) => el instanceof HTMLElement && el.matches(DuiMenuItem.tagName));
|
|
126
|
+
if (item && !item.disabled) {
|
|
127
|
+
this.#popup.close();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
#onKeyDown = (event) => {
|
|
131
|
+
const items = this.#items;
|
|
132
|
+
switch (event.key) {
|
|
133
|
+
case "ArrowDown": {
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
if (!this.#popup.isOpen) {
|
|
136
|
+
this.#popup.open();
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
let next = this.#highlightedIndex + 1;
|
|
140
|
+
while (next < items.length && items[next]?.disabled)
|
|
141
|
+
next++;
|
|
142
|
+
if (next < items.length)
|
|
143
|
+
this.#highlightedIndex = next;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case "ArrowUp": {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
if (!this.#popup.isOpen) {
|
|
150
|
+
this.#popup.open();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
let prev = this.#highlightedIndex - 1;
|
|
154
|
+
while (prev >= 0 && items[prev]?.disabled)
|
|
155
|
+
prev--;
|
|
156
|
+
if (prev >= 0)
|
|
157
|
+
this.#highlightedIndex = prev;
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case "Home":
|
|
162
|
+
if (this.#popup.isOpen) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
const firstEnabled = items.findIndex((item) => !item.disabled);
|
|
165
|
+
if (firstEnabled >= 0)
|
|
166
|
+
this.#highlightedIndex = firstEnabled;
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "End":
|
|
170
|
+
if (this.#popup.isOpen) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
173
|
+
if (!items[i]?.disabled) {
|
|
174
|
+
this.#highlightedIndex = i;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case "Enter":
|
|
181
|
+
case " ": {
|
|
182
|
+
if (this.#popup.isOpen && this.#highlightedIndex >= 0) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
const item = items[this.#highlightedIndex];
|
|
185
|
+
if (item && !item.disabled) {
|
|
186
|
+
item.click();
|
|
187
|
+
this.#popup.close();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else if (!this.#popup.isOpen) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
this.#popup.open();
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case "Escape":
|
|
197
|
+
if (this.#popup.isOpen) {
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
this.#popup.close();
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
case "Tab":
|
|
203
|
+
if (this.#popup.isOpen) {
|
|
204
|
+
this.#popup.close();
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
#onMenuMouseMove = () => {
|
|
210
|
+
if (this.#highlightedIndex >= 0) {
|
|
211
|
+
this.#highlightedIndex = -1;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
render() {
|
|
215
|
+
return html `
|
|
216
|
+
<div
|
|
217
|
+
class="Trigger"
|
|
218
|
+
aria-haspopup="menu"
|
|
219
|
+
aria-expanded="${this.#popup.isOpen}"
|
|
220
|
+
aria-controls="${this.#menuId}"
|
|
221
|
+
@click="${this.#onTriggerClick}"
|
|
222
|
+
@keydown="${this.#onKeyDown}"
|
|
223
|
+
>
|
|
224
|
+
<slot name="trigger"></slot>
|
|
225
|
+
</div>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/menu/register.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DuiMenu } from "./menu.js";
|
|
2
|
+
import { DuiMenuItem } from "./menu-item.js";
|
|
3
|
+
if (!customElements.get(DuiMenu.tagName)) {
|
|
4
|
+
customElements.define(DuiMenu.tagName, DuiMenu);
|
|
5
|
+
}
|
|
6
|
+
if (!customElements.get(DuiMenuItem.tagName)) {
|
|
7
|
+
customElements.define(DuiMenuItem.tagName, DuiMenuItem);
|
|
8
|
+
}
|
package/menubar/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiMenubar } from "./menubar.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type MenubarContext = {
|
|
2
|
+
readonly activeMenuId: string | null;
|
|
3
|
+
readonly openMenu: (id: string) => void;
|
|
4
|
+
readonly closeAll: () => void;
|
|
5
|
+
readonly navigateToMenu: (direction: "next" | "prev") => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const menubarContext: {
|
|
8
|
+
__context__: MenubarContext;
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* `<dui-menubar>` — A horizontal bar of menus with coordinated open/close.
|
|
4
|
+
*
|
|
5
|
+
* Contains `<dui-menu>` children. When one menu is open, hovering another
|
|
6
|
+
* menu trigger opens it and closes the previous one.
|
|
7
|
+
*
|
|
8
|
+
* @slot - `dui-menu` children.
|
|
9
|
+
* @csspart root - The menubar container.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DuiMenubar extends LitElement {
|
|
12
|
+
#private;
|
|
13
|
+
static tagName: "dui-menubar";
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
accessor loop: boolean;
|
|
16
|
+
accessor orientation: "horizontal" | "vertical";
|
|
17
|
+
willUpdate(): void;
|
|
18
|
+
render(): TemplateResult;
|
|
19
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, LitElement } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
10
|
+
/** Structural styles only — layout CSS. */
|
|
11
|
+
const styles = css `
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[part="root"] {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([orientation="vertical"]) [part="root"] {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
/**
|
|
27
|
+
* `<dui-menubar>` — A horizontal bar of menus with coordinated open/close.
|
|
28
|
+
*
|
|
29
|
+
* Contains `<dui-menu>` children. When one menu is open, hovering another
|
|
30
|
+
* menu trigger opens it and closes the previous one.
|
|
31
|
+
*
|
|
32
|
+
* @slot - `dui-menu` children.
|
|
33
|
+
* @csspart root - The menubar container.
|
|
34
|
+
*/
|
|
35
|
+
export class DuiMenubar extends LitElement {
|
|
36
|
+
static { this.tagName = "dui-menubar"; }
|
|
37
|
+
static { this.styles = [base, styles]; }
|
|
38
|
+
#loop_accessor_storage = true;
|
|
39
|
+
get loop() { return this.#loop_accessor_storage; }
|
|
40
|
+
set loop(value) { this.#loop_accessor_storage = value; }
|
|
41
|
+
#orientation_accessor_storage = "horizontal";
|
|
42
|
+
get orientation() { return this.#orientation_accessor_storage; }
|
|
43
|
+
set orientation(value) { this.#orientation_accessor_storage = value; }
|
|
44
|
+
#activeMenuId_accessor_storage = null;
|
|
45
|
+
get #activeMenuId() { return this.#activeMenuId_accessor_storage; }
|
|
46
|
+
set #activeMenuId(value) { this.#activeMenuId_accessor_storage = value; }
|
|
47
|
+
#getMenus() {
|
|
48
|
+
return [...this.querySelectorAll("dui-menu")];
|
|
49
|
+
}
|
|
50
|
+
#openMenu = (id) => {
|
|
51
|
+
this.#activeMenuId = id;
|
|
52
|
+
};
|
|
53
|
+
#closeAll = () => {
|
|
54
|
+
this.#activeMenuId = null;
|
|
55
|
+
};
|
|
56
|
+
#navigateToMenu = (direction) => {
|
|
57
|
+
const menus = this.#getMenus();
|
|
58
|
+
if (menus.length === 0)
|
|
59
|
+
return;
|
|
60
|
+
const currentIndex = menus.findIndex((m) => m.getAttribute("data-menubar-id") === this.#activeMenuId);
|
|
61
|
+
let nextIndex;
|
|
62
|
+
if (direction === "next") {
|
|
63
|
+
nextIndex = currentIndex + 1;
|
|
64
|
+
if (nextIndex >= menus.length) {
|
|
65
|
+
nextIndex = this.loop ? 0 : menus.length - 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
nextIndex = currentIndex - 1;
|
|
70
|
+
if (nextIndex < 0) {
|
|
71
|
+
nextIndex = this.loop ? menus.length - 1 : 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const nextMenu = menus[nextIndex];
|
|
75
|
+
if (!nextMenu)
|
|
76
|
+
return;
|
|
77
|
+
const nextId = nextMenu.getAttribute("data-menubar-id");
|
|
78
|
+
if (nextId) {
|
|
79
|
+
this.#activeMenuId = nextId;
|
|
80
|
+
}
|
|
81
|
+
// Focus the trigger of the next menu
|
|
82
|
+
const trigger = nextMenu.querySelector('[slot="trigger"]');
|
|
83
|
+
trigger?.focus();
|
|
84
|
+
};
|
|
85
|
+
#ctx_accessor_storage = this.#buildContext();
|
|
86
|
+
get #ctx() { return this.#ctx_accessor_storage; }
|
|
87
|
+
set #ctx(value) { this.#ctx_accessor_storage = value; }
|
|
88
|
+
#buildContext() {
|
|
89
|
+
return {
|
|
90
|
+
activeMenuId: this.#activeMenuId,
|
|
91
|
+
openMenu: this.#openMenu,
|
|
92
|
+
closeAll: this.#closeAll,
|
|
93
|
+
navigateToMenu: this.#navigateToMenu,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
willUpdate() {
|
|
97
|
+
this.#ctx = this.#buildContext();
|
|
98
|
+
}
|
|
99
|
+
#onKeyDown = (e) => {
|
|
100
|
+
const isHorizontal = this.orientation === "horizontal";
|
|
101
|
+
const nextKey = isHorizontal ? "ArrowRight" : "ArrowDown";
|
|
102
|
+
const prevKey = isHorizontal ? "ArrowLeft" : "ArrowUp";
|
|
103
|
+
if (e.key === nextKey) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
this.#navigateToMenu("next");
|
|
106
|
+
}
|
|
107
|
+
else if (e.key === prevKey) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
this.#navigateToMenu("prev");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
render() {
|
|
113
|
+
return html `
|
|
114
|
+
<div
|
|
115
|
+
part="root"
|
|
116
|
+
role="menubar"
|
|
117
|
+
aria-orientation="${this.orientation}"
|
|
118
|
+
@keydown="${this.#onKeyDown}"
|
|
119
|
+
>
|
|
120
|
+
<slot></slot>
|
|
121
|
+
</div>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean })
|
|
127
|
+
], DuiMenubar.prototype, "loop", null);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ reflect: true })
|
|
130
|
+
], DuiMenubar.prototype, "orientation", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiNumberField, valueChangeEvent } from "./number-field.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiNumberField, valueChangeEvent } from "./number-field.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
export declare const valueChangeEvent: (detail: {
|
|
3
|
+
value: number;
|
|
4
|
+
}) => CustomEvent<{
|
|
5
|
+
value: number;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* `<dui-number-field>` — A numeric input with increment/decrement buttons.
|
|
9
|
+
*
|
|
10
|
+
* @csspart root - The outer container.
|
|
11
|
+
* @csspart input - The text input element.
|
|
12
|
+
* @csspart decrement - The decrement button.
|
|
13
|
+
* @csspart increment - The increment button.
|
|
14
|
+
* @fires value-change - Fired when value changes. Detail: { value: number }
|
|
15
|
+
*/
|
|
16
|
+
export declare class DuiNumberField extends LitElement {
|
|
17
|
+
#private;
|
|
18
|
+
static tagName: "dui-number-field";
|
|
19
|
+
static shadowRootOptions: ShadowRootInit;
|
|
20
|
+
static styles: import("lit").CSSResult[];
|
|
21
|
+
accessor value: number | undefined;
|
|
22
|
+
accessor defaultValue: number | undefined;
|
|
23
|
+
accessor min: number | undefined;
|
|
24
|
+
accessor max: number | undefined;
|
|
25
|
+
accessor step: number;
|
|
26
|
+
accessor largeStep: number;
|
|
27
|
+
accessor disabled: boolean;
|
|
28
|
+
accessor readOnly: boolean;
|
|
29
|
+
accessor required: boolean;
|
|
30
|
+
accessor name: string | undefined;
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
willUpdate(): void;
|
|
33
|
+
render(): TemplateResult;
|
|
34
|
+
}
|