@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
package/select/select.js
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/select */
|
|
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, nothing } from "lit";
|
|
9
|
+
import { property } from "lit/decorators.js";
|
|
10
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
11
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
12
|
+
import { customEvent } from "@deepfuture/dui-core/event";
|
|
13
|
+
import { FloatingPortalController } from "@deepfuture/dui-core/floating-portal-controller";
|
|
14
|
+
export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
|
|
15
|
+
/** Structural styles only — layout CSS. */
|
|
16
|
+
const hostStyles = css `
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const componentStyles = css `
|
|
22
|
+
.Trigger {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
width: 100%;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
user-select: none;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
transition-property: border-color, box-shadow, background, filter, transform;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.Trigger[data-disabled] {
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.Value {
|
|
38
|
+
flex: 1;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.Icon {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/** Styles injected into the portal positioner. */
|
|
49
|
+
const portalPopupStyles = [
|
|
50
|
+
css `
|
|
51
|
+
.Popup {
|
|
52
|
+
background: var(--popover);
|
|
53
|
+
border: var(--border-width-thin) solid var(--border);
|
|
54
|
+
border-radius: var(--radius-md);
|
|
55
|
+
box-shadow: var(--shadow-md);
|
|
56
|
+
max-height: 240px;
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
overscroll-behavior: contain;
|
|
59
|
+
opacity: 1;
|
|
60
|
+
transform: translateY(0);
|
|
61
|
+
transition-property: opacity, transform;
|
|
62
|
+
transition-duration: var(--duration-fast);
|
|
63
|
+
transition-timing-function: var(--ease-out-3);
|
|
64
|
+
pointer-events: auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.Popup[data-starting-style],
|
|
68
|
+
.Popup[data-ending-style] {
|
|
69
|
+
opacity: 0;
|
|
70
|
+
transform: translateY(calc(var(--space-1) * -1));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.Listbox {
|
|
74
|
+
padding: var(--space-1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.Item {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: var(--space-2);
|
|
81
|
+
padding: var(--space-1_5) var(--space-2);
|
|
82
|
+
border-radius: var(--radius-sm);
|
|
83
|
+
font-size: var(--font-size-sm);
|
|
84
|
+
font-family: var(--font-sans);
|
|
85
|
+
color: var(--popover-foreground);
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.Item:hover,
|
|
90
|
+
.Item[data-highlighted] {
|
|
91
|
+
background: var(--secondary);
|
|
92
|
+
color: var(--foreground);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.Item[data-selected] {
|
|
96
|
+
font-weight: var(--font-weight-medium);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.Item[data-disabled] {
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ItemIndicator {
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
width: var(--space-3_5);
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ItemIndicator dui-icon {
|
|
113
|
+
--icon-size: var(--space-3_5);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ItemText {
|
|
117
|
+
flex: 1;
|
|
118
|
+
}
|
|
119
|
+
`,
|
|
120
|
+
];
|
|
121
|
+
/**
|
|
122
|
+
* `<dui-select>` — A dropdown select for choosing from a list of options.
|
|
123
|
+
*
|
|
124
|
+
* @csspart trigger - The trigger button.
|
|
125
|
+
* @csspart value - The displayed value text.
|
|
126
|
+
* @fires value-change - Fired when the selected value changes.
|
|
127
|
+
* Detail: { value: string, option: SelectOption }
|
|
128
|
+
*/
|
|
129
|
+
export class DuiSelect extends LitElement {
|
|
130
|
+
static { this.tagName = "dui-select"; }
|
|
131
|
+
static { this.styles = [base, hostStyles, componentStyles]; }
|
|
132
|
+
#options_accessor_storage = [];
|
|
133
|
+
/** The available options. */
|
|
134
|
+
get options() { return this.#options_accessor_storage; }
|
|
135
|
+
set options(value) { this.#options_accessor_storage = value; }
|
|
136
|
+
#value_accessor_storage = "";
|
|
137
|
+
/** Currently selected value. */
|
|
138
|
+
get value() { return this.#value_accessor_storage; }
|
|
139
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
140
|
+
#placeholder_accessor_storage = "Select...";
|
|
141
|
+
/** Placeholder text shown when no value is selected. */
|
|
142
|
+
get placeholder() { return this.#placeholder_accessor_storage; }
|
|
143
|
+
set placeholder(value) { this.#placeholder_accessor_storage = value; }
|
|
144
|
+
#disabled_accessor_storage = false;
|
|
145
|
+
/** Whether the select is disabled. */
|
|
146
|
+
get disabled() { return this.#disabled_accessor_storage; }
|
|
147
|
+
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
148
|
+
#name_accessor_storage = "";
|
|
149
|
+
/** Name for form submission. */
|
|
150
|
+
get name() { return this.#name_accessor_storage; }
|
|
151
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
152
|
+
#ctx_accessor_storage;
|
|
153
|
+
get #ctx() { return this.#ctx_accessor_storage; }
|
|
154
|
+
set #ctx(value) { this.#ctx_accessor_storage = value; }
|
|
155
|
+
#highlightedIndex_accessor_storage = -1;
|
|
156
|
+
get #highlightedIndex() { return this.#highlightedIndex_accessor_storage; }
|
|
157
|
+
set #highlightedIndex(value) { this.#highlightedIndex_accessor_storage = value; }
|
|
158
|
+
#triggerId = `select-trigger-${crypto.randomUUID().slice(0, 8)}`;
|
|
159
|
+
#listboxId = `select-listbox-${crypto.randomUUID().slice(0, 8)}`;
|
|
160
|
+
#popup = new FloatingPortalController(this, {
|
|
161
|
+
getAnchor: () => this.shadowRoot?.querySelector(".Trigger"),
|
|
162
|
+
styles: portalPopupStyles,
|
|
163
|
+
onOpen: () => {
|
|
164
|
+
this.#highlightedIndex = this.#selectedIndex;
|
|
165
|
+
},
|
|
166
|
+
onClose: () => {
|
|
167
|
+
this.#highlightedIndex = -1;
|
|
168
|
+
this.#ctx?.markTouched();
|
|
169
|
+
},
|
|
170
|
+
renderPopup: (portal) => {
|
|
171
|
+
return html `
|
|
172
|
+
<div
|
|
173
|
+
class="Popup"
|
|
174
|
+
?data-starting-style="${portal.isStarting}"
|
|
175
|
+
?data-ending-style="${portal.isEnding}"
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
class="Listbox"
|
|
179
|
+
id="${this.#listboxId}"
|
|
180
|
+
role="listbox"
|
|
181
|
+
aria-labelledby="${this.#ctx?.labelId ?? ""}"
|
|
182
|
+
@mousedown="${this.#onListMouseDown}"
|
|
183
|
+
>
|
|
184
|
+
${repeat(this.options, (option) => option.value, this.#renderItem)}
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
`;
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
// ---- Computed ----
|
|
191
|
+
get #isDisabled() {
|
|
192
|
+
return this.disabled || (this.#ctx?.disabled ?? false);
|
|
193
|
+
}
|
|
194
|
+
get #isInvalid() {
|
|
195
|
+
return this.#ctx?.invalid ?? false;
|
|
196
|
+
}
|
|
197
|
+
get #selectedOption() {
|
|
198
|
+
return this.options.find((o) => o.value === this.value);
|
|
199
|
+
}
|
|
200
|
+
get #selectedIndex() {
|
|
201
|
+
return this.options.findIndex((o) => o.value === this.value);
|
|
202
|
+
}
|
|
203
|
+
get #displayValue() {
|
|
204
|
+
return this.#selectedOption?.label ?? "";
|
|
205
|
+
}
|
|
206
|
+
// ---- Event handlers ----
|
|
207
|
+
#onTriggerClick = (event) => {
|
|
208
|
+
event.stopPropagation();
|
|
209
|
+
if (this.#isDisabled)
|
|
210
|
+
return;
|
|
211
|
+
if (this.#popup.isOpen) {
|
|
212
|
+
this.#popup.close();
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.#popup.open();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
#onTriggerKeyDown = (event) => {
|
|
219
|
+
if (this.#isDisabled)
|
|
220
|
+
return;
|
|
221
|
+
switch (event.key) {
|
|
222
|
+
case "Enter":
|
|
223
|
+
case " ": {
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
if (this.#popup.isOpen) {
|
|
226
|
+
const option = this.options[this.#highlightedIndex];
|
|
227
|
+
if (option && !option.disabled) {
|
|
228
|
+
this.#selectOption(option);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.#popup.open();
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
case "ArrowDown": {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
if (!this.#popup.isOpen) {
|
|
239
|
+
this.#popup.open();
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.#highlightedIndex = this.#nextEnabledIndex(this.#highlightedIndex, 1);
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
case "ArrowUp": {
|
|
247
|
+
event.preventDefault();
|
|
248
|
+
if (!this.#popup.isOpen) {
|
|
249
|
+
this.#popup.open();
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
this.#highlightedIndex = this.#nextEnabledIndex(this.#highlightedIndex, -1);
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
case "Home": {
|
|
257
|
+
if (this.#popup.isOpen) {
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
this.#highlightedIndex = this.#nextEnabledIndex(-1, 1);
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "End": {
|
|
264
|
+
if (this.#popup.isOpen) {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
this.#highlightedIndex = this.#nextEnabledIndex(this.options.length, -1);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case "Escape": {
|
|
271
|
+
if (this.#popup.isOpen) {
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
this.#popup.close();
|
|
274
|
+
this.#focusTrigger();
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
case "Tab": {
|
|
279
|
+
if (this.#popup.isOpen) {
|
|
280
|
+
this.#popup.close();
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
#onListMouseDown = (event) => {
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
};
|
|
289
|
+
#onItemClick = (option) => {
|
|
290
|
+
if (option.disabled)
|
|
291
|
+
return;
|
|
292
|
+
this.#selectOption(option);
|
|
293
|
+
};
|
|
294
|
+
#onItemMouseEnter = (index) => {
|
|
295
|
+
if (!this.options[index]?.disabled) {
|
|
296
|
+
this.#highlightedIndex = index;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
// ---- Selection ----
|
|
300
|
+
#selectOption(option) {
|
|
301
|
+
this.value = option.value;
|
|
302
|
+
this.#ctx?.markDirty();
|
|
303
|
+
this.#ctx?.setFilled(this.value.length > 0);
|
|
304
|
+
this.dispatchEvent(valueChangeEvent({ value: option.value, option }));
|
|
305
|
+
this.#popup.close();
|
|
306
|
+
this.#focusTrigger();
|
|
307
|
+
}
|
|
308
|
+
#nextEnabledIndex(current, direction) {
|
|
309
|
+
const len = this.options.length;
|
|
310
|
+
let next = current + direction;
|
|
311
|
+
while (next >= 0 && next < len) {
|
|
312
|
+
if (!this.options[next].disabled)
|
|
313
|
+
return next;
|
|
314
|
+
next += direction;
|
|
315
|
+
}
|
|
316
|
+
return current;
|
|
317
|
+
}
|
|
318
|
+
#focusTrigger() {
|
|
319
|
+
const trigger = this.shadowRoot?.querySelector(".Trigger");
|
|
320
|
+
trigger?.focus();
|
|
321
|
+
}
|
|
322
|
+
// ---- Render ----
|
|
323
|
+
#renderItem = (option, index) => {
|
|
324
|
+
const isSelected = option.value === this.value;
|
|
325
|
+
const isHighlighted = index === this.#highlightedIndex;
|
|
326
|
+
return html `
|
|
327
|
+
<div
|
|
328
|
+
class="Item"
|
|
329
|
+
role="option"
|
|
330
|
+
id="${this.#listboxId}-option-${index}"
|
|
331
|
+
aria-selected="${isSelected}"
|
|
332
|
+
?data-selected="${isSelected}"
|
|
333
|
+
?data-highlighted="${isHighlighted}"
|
|
334
|
+
?data-disabled="${option.disabled}"
|
|
335
|
+
@click="${() => this.#onItemClick(option)}"
|
|
336
|
+
@mouseenter="${() => this.#onItemMouseEnter(index)}"
|
|
337
|
+
>
|
|
338
|
+
<span class="ItemIndicator">
|
|
339
|
+
${isSelected
|
|
340
|
+
? html `<dui-icon><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg></dui-icon>`
|
|
341
|
+
: nothing}
|
|
342
|
+
</span>
|
|
343
|
+
<span class="ItemText">${option.label}</span>
|
|
344
|
+
</div>
|
|
345
|
+
`;
|
|
346
|
+
};
|
|
347
|
+
render() {
|
|
348
|
+
const hasValue = this.value !== "" && this.#selectedOption != null;
|
|
349
|
+
return html `
|
|
350
|
+
<div
|
|
351
|
+
class="Trigger"
|
|
352
|
+
part="trigger"
|
|
353
|
+
id="${this.#triggerId}"
|
|
354
|
+
role="combobox"
|
|
355
|
+
tabindex="${this.#isDisabled ? -1 : 0}"
|
|
356
|
+
aria-haspopup="listbox"
|
|
357
|
+
aria-expanded="${this.#popup.isOpen}"
|
|
358
|
+
aria-controls="${this.#listboxId}"
|
|
359
|
+
aria-activedescendant="${this.#highlightedIndex >= 0
|
|
360
|
+
? `${this.#listboxId}-option-${this.#highlightedIndex}`
|
|
361
|
+
: nothing}"
|
|
362
|
+
aria-labelledby="${this.#ctx?.labelId ?? ""}"
|
|
363
|
+
aria-invalid="${this.#isInvalid}"
|
|
364
|
+
?data-disabled="${this.#isDisabled}"
|
|
365
|
+
?data-invalid="${this.#isInvalid}"
|
|
366
|
+
?data-open="${this.#popup.isOpen}"
|
|
367
|
+
@click="${this.#onTriggerClick}"
|
|
368
|
+
@keydown="${this.#onTriggerKeyDown}"
|
|
369
|
+
@focus="${() => this.#ctx?.setFocused(true)}"
|
|
370
|
+
@blur="${() => this.#ctx?.setFocused(false)}"
|
|
371
|
+
>
|
|
372
|
+
<span
|
|
373
|
+
class="Value"
|
|
374
|
+
part="value"
|
|
375
|
+
?data-placeholder="${!hasValue}"
|
|
376
|
+
>
|
|
377
|
+
${hasValue ? this.#displayValue : this.placeholder}
|
|
378
|
+
</span>
|
|
379
|
+
<span class="Icon">
|
|
380
|
+
<dui-icon><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></dui-icon>
|
|
381
|
+
</span>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
${this.name
|
|
385
|
+
? html `<input type="hidden" name="${this.name}" .value="${this.value}" />`
|
|
386
|
+
: nothing}
|
|
387
|
+
`;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
__decorate([
|
|
391
|
+
property({ attribute: false })
|
|
392
|
+
], DuiSelect.prototype, "options", null);
|
|
393
|
+
__decorate([
|
|
394
|
+
property({ type: String })
|
|
395
|
+
], DuiSelect.prototype, "value", null);
|
|
396
|
+
__decorate([
|
|
397
|
+
property({ type: String })
|
|
398
|
+
], DuiSelect.prototype, "placeholder", null);
|
|
399
|
+
__decorate([
|
|
400
|
+
property({ type: Boolean, reflect: true })
|
|
401
|
+
], DuiSelect.prototype, "disabled", null);
|
|
402
|
+
__decorate([
|
|
403
|
+
property({ type: String })
|
|
404
|
+
], DuiSelect.prototype, "name", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiSeparator } from "./separator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiSeparator } from "./separator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* `<dui-separator>` — A visual divider between content sections.
|
|
4
|
+
*
|
|
5
|
+
* @csspart root - The separator element.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DuiSeparator extends LitElement {
|
|
8
|
+
static tagName: "dui-separator";
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
accessor orientation: "horizontal" | "vertical";
|
|
11
|
+
render(): TemplateResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
:host([orientation="vertical"]) {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
align-self: stretch;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[part="root"] {
|
|
22
|
+
border: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
/**
|
|
28
|
+
* `<dui-separator>` — A visual divider between content sections.
|
|
29
|
+
*
|
|
30
|
+
* @csspart root - The separator element.
|
|
31
|
+
*/
|
|
32
|
+
export class DuiSeparator extends LitElement {
|
|
33
|
+
static { this.tagName = "dui-separator"; }
|
|
34
|
+
static { this.styles = [base, styles]; }
|
|
35
|
+
#orientation_accessor_storage = "horizontal";
|
|
36
|
+
get orientation() { return this.#orientation_accessor_storage; }
|
|
37
|
+
set orientation(value) { this.#orientation_accessor_storage = value; }
|
|
38
|
+
render() {
|
|
39
|
+
return html `
|
|
40
|
+
<div
|
|
41
|
+
part="root"
|
|
42
|
+
role="separator"
|
|
43
|
+
aria-orientation="${this.orientation}"
|
|
44
|
+
></div>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ reflect: true })
|
|
50
|
+
], DuiSeparator.prototype, "orientation", null);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { DuiSidebarProvider, openChangeEvent } from "./sidebar-provider.js";
|
|
2
|
+
export type { SidebarOpenChangeDetail } from "./sidebar-provider.js";
|
|
3
|
+
export { DuiSidebar } from "./sidebar.js";
|
|
4
|
+
export { DuiSidebarTrigger } from "./sidebar-trigger.js";
|
|
5
|
+
export { DuiSidebarContent } from "./sidebar-content.js";
|
|
6
|
+
export { DuiSidebarHeader } from "./sidebar-header.js";
|
|
7
|
+
export { DuiSidebarFooter } from "./sidebar-footer.js";
|
|
8
|
+
export { DuiSidebarGroup } from "./sidebar-group.js";
|
|
9
|
+
export { DuiSidebarGroupLabel } from "./sidebar-group-label.js";
|
|
10
|
+
export { DuiSidebarMenu } from "./sidebar-menu.js";
|
|
11
|
+
export { DuiSidebarMenuItem } from "./sidebar-menu-item.js";
|
|
12
|
+
export { DuiSidebarMenuButton } from "./sidebar-menu-button.js";
|
|
13
|
+
export type { SidebarMenuButtonSize } from "./sidebar-menu-button.js";
|
|
14
|
+
export { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
15
|
+
export { DuiSidebarInset } from "./sidebar-inset.js";
|
|
16
|
+
export type { SidebarContext } from "./sidebar-context.js";
|
package/sidebar/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { DuiSidebarProvider, openChangeEvent } from "./sidebar-provider.js";
|
|
2
|
+
export { DuiSidebar } from "./sidebar.js";
|
|
3
|
+
export { DuiSidebarTrigger } from "./sidebar-trigger.js";
|
|
4
|
+
export { DuiSidebarContent } from "./sidebar-content.js";
|
|
5
|
+
export { DuiSidebarHeader } from "./sidebar-header.js";
|
|
6
|
+
export { DuiSidebarFooter } from "./sidebar-footer.js";
|
|
7
|
+
export { DuiSidebarGroup } from "./sidebar-group.js";
|
|
8
|
+
export { DuiSidebarGroupLabel } from "./sidebar-group-label.js";
|
|
9
|
+
export { DuiSidebarMenu } from "./sidebar-menu.js";
|
|
10
|
+
export { DuiSidebarMenuItem } from "./sidebar-menu-item.js";
|
|
11
|
+
export { DuiSidebarMenuButton } from "./sidebar-menu-button.js";
|
|
12
|
+
export { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
13
|
+
export { DuiSidebarInset } from "./sidebar-inset.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DuiSidebarProvider } from "./sidebar-provider.js";
|
|
2
|
+
import { DuiSidebar } from "./sidebar.js";
|
|
3
|
+
import { DuiSidebarTrigger } from "./sidebar-trigger.js";
|
|
4
|
+
import { DuiSidebarContent } from "./sidebar-content.js";
|
|
5
|
+
import { DuiSidebarHeader } from "./sidebar-header.js";
|
|
6
|
+
import { DuiSidebarFooter } from "./sidebar-footer.js";
|
|
7
|
+
import { DuiSidebarGroup } from "./sidebar-group.js";
|
|
8
|
+
import { DuiSidebarGroupLabel } from "./sidebar-group-label.js";
|
|
9
|
+
import { DuiSidebarMenu } from "./sidebar-menu.js";
|
|
10
|
+
import { DuiSidebarMenuItem } from "./sidebar-menu-item.js";
|
|
11
|
+
import { DuiSidebarMenuButton } from "./sidebar-menu-button.js";
|
|
12
|
+
import { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
13
|
+
import { DuiSidebarInset } from "./sidebar-inset.js";
|
|
14
|
+
if (!customElements.get(DuiSidebarProvider.tagName)) {
|
|
15
|
+
customElements.define(DuiSidebarProvider.tagName, DuiSidebarProvider);
|
|
16
|
+
}
|
|
17
|
+
if (!customElements.get(DuiSidebar.tagName)) {
|
|
18
|
+
customElements.define(DuiSidebar.tagName, DuiSidebar);
|
|
19
|
+
}
|
|
20
|
+
if (!customElements.get(DuiSidebarTrigger.tagName)) {
|
|
21
|
+
customElements.define(DuiSidebarTrigger.tagName, DuiSidebarTrigger);
|
|
22
|
+
}
|
|
23
|
+
if (!customElements.get(DuiSidebarContent.tagName)) {
|
|
24
|
+
customElements.define(DuiSidebarContent.tagName, DuiSidebarContent);
|
|
25
|
+
}
|
|
26
|
+
if (!customElements.get(DuiSidebarHeader.tagName)) {
|
|
27
|
+
customElements.define(DuiSidebarHeader.tagName, DuiSidebarHeader);
|
|
28
|
+
}
|
|
29
|
+
if (!customElements.get(DuiSidebarFooter.tagName)) {
|
|
30
|
+
customElements.define(DuiSidebarFooter.tagName, DuiSidebarFooter);
|
|
31
|
+
}
|
|
32
|
+
if (!customElements.get(DuiSidebarGroup.tagName)) {
|
|
33
|
+
customElements.define(DuiSidebarGroup.tagName, DuiSidebarGroup);
|
|
34
|
+
}
|
|
35
|
+
if (!customElements.get(DuiSidebarGroupLabel.tagName)) {
|
|
36
|
+
customElements.define(DuiSidebarGroupLabel.tagName, DuiSidebarGroupLabel);
|
|
37
|
+
}
|
|
38
|
+
if (!customElements.get(DuiSidebarMenu.tagName)) {
|
|
39
|
+
customElements.define(DuiSidebarMenu.tagName, DuiSidebarMenu);
|
|
40
|
+
}
|
|
41
|
+
if (!customElements.get(DuiSidebarMenuItem.tagName)) {
|
|
42
|
+
customElements.define(DuiSidebarMenuItem.tagName, DuiSidebarMenuItem);
|
|
43
|
+
}
|
|
44
|
+
if (!customElements.get(DuiSidebarMenuButton.tagName)) {
|
|
45
|
+
customElements.define(DuiSidebarMenuButton.tagName, DuiSidebarMenuButton);
|
|
46
|
+
}
|
|
47
|
+
if (!customElements.get(DuiSidebarSeparator.tagName)) {
|
|
48
|
+
customElements.define(DuiSidebarSeparator.tagName, DuiSidebarSeparator);
|
|
49
|
+
}
|
|
50
|
+
if (!customElements.get(DuiSidebarInset.tagName)) {
|
|
51
|
+
customElements.define(DuiSidebarInset.tagName, DuiSidebarInset);
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-sidebar-content>` — Scrollable content section of the sidebar.
|
|
5
|
+
*
|
|
6
|
+
* Wraps its slot in a scroll area to provide overflow scrolling.
|
|
7
|
+
*
|
|
8
|
+
* @slot - Default slot for sidebar groups, menus, etc.
|
|
9
|
+
*/
|
|
10
|
+
export declare class DuiSidebarContent extends LitElement {
|
|
11
|
+
static tagName: "dui-sidebar-content";
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
render(): TemplateResult;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
|
+
import { css, html, LitElement } from "lit";
|
|
3
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
4
|
+
const styles = css `
|
|
5
|
+
:host {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
flex: 1;
|
|
9
|
+
min-height: 0;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
/**
|
|
14
|
+
* `<dui-sidebar-content>` — Scrollable content section of the sidebar.
|
|
15
|
+
*
|
|
16
|
+
* Wraps its slot in a scroll area to provide overflow scrolling.
|
|
17
|
+
*
|
|
18
|
+
* @slot - Default slot for sidebar groups, menus, etc.
|
|
19
|
+
*/
|
|
20
|
+
export class DuiSidebarContent extends LitElement {
|
|
21
|
+
static { this.tagName = "dui-sidebar-content"; }
|
|
22
|
+
static { this.styles = [base, styles]; }
|
|
23
|
+
render() {
|
|
24
|
+
return html `
|
|
25
|
+
<dui-scroll-area>
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</dui-scroll-area>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
|
+
export type SidebarContext = {
|
|
3
|
+
readonly state: "expanded" | "collapsed";
|
|
4
|
+
readonly open: boolean;
|
|
5
|
+
readonly openMobile: boolean;
|
|
6
|
+
readonly isMobile: boolean;
|
|
7
|
+
readonly side: "left" | "right";
|
|
8
|
+
readonly variant: "sidebar" | "floating" | "inset";
|
|
9
|
+
readonly collapsible: "offcanvas" | "icon" | "none";
|
|
10
|
+
readonly setOpen: (open: boolean) => void;
|
|
11
|
+
readonly toggleSidebar: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const sidebarContext: {
|
|
14
|
+
__context__: SidebarContext;
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-sidebar-footer>` — Bottom section of the sidebar.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Default slot for footer content (user info, settings, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export declare class DuiSidebarFooter extends LitElement {
|
|
9
|
+
static tagName: "dui-sidebar-footer";
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
render(): TemplateResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
|
+
import { css, html, LitElement } from "lit";
|
|
3
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
4
|
+
const styles = css `
|
|
5
|
+
:host {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
/**
|
|
11
|
+
* `<dui-sidebar-footer>` — Bottom section of the sidebar.
|
|
12
|
+
*
|
|
13
|
+
* @slot - Default slot for footer content (user info, settings, etc.).
|
|
14
|
+
*/
|
|
15
|
+
export class DuiSidebarFooter extends LitElement {
|
|
16
|
+
static { this.tagName = "dui-sidebar-footer"; }
|
|
17
|
+
static { this.styles = [base, styles]; }
|
|
18
|
+
render() {
|
|
19
|
+
return html `<slot></slot>`;
|
|
20
|
+
}
|
|
21
|
+
}
|