@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,326 @@
|
|
|
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, nothing } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { live } from "lit/directives/live.js";
|
|
10
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
11
|
+
import { customEvent } from "@deepfuture/dui-core/event";
|
|
12
|
+
export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
|
|
13
|
+
/** Structural styles only — layout CSS. */
|
|
14
|
+
const styles = css `
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[part="root"] {
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[part="input"] {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
outline: none;
|
|
27
|
+
border: none;
|
|
28
|
+
background: none;
|
|
29
|
+
font: inherit;
|
|
30
|
+
color: inherit;
|
|
31
|
+
text-align: center;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[part="input"]:disabled {
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part="decrement"],
|
|
40
|
+
[part="increment"] {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
border: none;
|
|
46
|
+
background: none;
|
|
47
|
+
padding: 0;
|
|
48
|
+
margin: 0;
|
|
49
|
+
font: inherit;
|
|
50
|
+
color: inherit;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[part="decrement"]:disabled,
|
|
55
|
+
[part="increment"]:disabled {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.HiddenInput {
|
|
60
|
+
position: absolute;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
margin: 0;
|
|
64
|
+
width: 0;
|
|
65
|
+
height: 0;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
/**
|
|
69
|
+
* `<dui-number-field>` — A numeric input with increment/decrement buttons.
|
|
70
|
+
*
|
|
71
|
+
* @csspart root - The outer container.
|
|
72
|
+
* @csspart input - The text input element.
|
|
73
|
+
* @csspart decrement - The decrement button.
|
|
74
|
+
* @csspart increment - The increment button.
|
|
75
|
+
* @fires value-change - Fired when value changes. Detail: { value: number }
|
|
76
|
+
*/
|
|
77
|
+
export class DuiNumberField extends LitElement {
|
|
78
|
+
static { this.tagName = "dui-number-field"; }
|
|
79
|
+
static { this.shadowRootOptions = {
|
|
80
|
+
...LitElement.shadowRootOptions,
|
|
81
|
+
delegatesFocus: true,
|
|
82
|
+
}; }
|
|
83
|
+
static { this.styles = [base, styles]; }
|
|
84
|
+
#value_accessor_storage = undefined;
|
|
85
|
+
get value() { return this.#value_accessor_storage; }
|
|
86
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
87
|
+
#defaultValue_accessor_storage = undefined;
|
|
88
|
+
get defaultValue() { return this.#defaultValue_accessor_storage; }
|
|
89
|
+
set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
|
|
90
|
+
#min_accessor_storage = undefined;
|
|
91
|
+
get min() { return this.#min_accessor_storage; }
|
|
92
|
+
set min(value) { this.#min_accessor_storage = value; }
|
|
93
|
+
#max_accessor_storage = undefined;
|
|
94
|
+
get max() { return this.#max_accessor_storage; }
|
|
95
|
+
set max(value) { this.#max_accessor_storage = value; }
|
|
96
|
+
#step_accessor_storage = 1;
|
|
97
|
+
get step() { return this.#step_accessor_storage; }
|
|
98
|
+
set step(value) { this.#step_accessor_storage = value; }
|
|
99
|
+
#largeStep_accessor_storage = 10;
|
|
100
|
+
get largeStep() { return this.#largeStep_accessor_storage; }
|
|
101
|
+
set largeStep(value) { this.#largeStep_accessor_storage = value; }
|
|
102
|
+
#disabled_accessor_storage = false;
|
|
103
|
+
get disabled() { return this.#disabled_accessor_storage; }
|
|
104
|
+
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
105
|
+
#readOnly_accessor_storage = false;
|
|
106
|
+
get readOnly() { return this.#readOnly_accessor_storage; }
|
|
107
|
+
set readOnly(value) { this.#readOnly_accessor_storage = value; }
|
|
108
|
+
#required_accessor_storage = false;
|
|
109
|
+
get required() { return this.#required_accessor_storage; }
|
|
110
|
+
set required(value) { this.#required_accessor_storage = value; }
|
|
111
|
+
#name_accessor_storage = undefined;
|
|
112
|
+
get name() { return this.#name_accessor_storage; }
|
|
113
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
114
|
+
#internalValue_accessor_storage = undefined;
|
|
115
|
+
get #internalValue() { return this.#internalValue_accessor_storage; }
|
|
116
|
+
set #internalValue(value) { this.#internalValue_accessor_storage = value; }
|
|
117
|
+
#inputText_accessor_storage = "";
|
|
118
|
+
get #inputText() { return this.#inputText_accessor_storage; }
|
|
119
|
+
set #inputText(value) { this.#inputText_accessor_storage = value; }
|
|
120
|
+
#fieldCtx_accessor_storage;
|
|
121
|
+
get #fieldCtx() { return this.#fieldCtx_accessor_storage; }
|
|
122
|
+
set #fieldCtx(value) { this.#fieldCtx_accessor_storage = value; }
|
|
123
|
+
get #currentValue() {
|
|
124
|
+
return this.value ?? this.#internalValue;
|
|
125
|
+
}
|
|
126
|
+
get #isDisabled() {
|
|
127
|
+
return this.disabled || (this.#fieldCtx?.disabled ?? false);
|
|
128
|
+
}
|
|
129
|
+
get #isInvalid() {
|
|
130
|
+
return this.#fieldCtx?.invalid ?? false;
|
|
131
|
+
}
|
|
132
|
+
get #canDecrement() {
|
|
133
|
+
const v = this.#currentValue;
|
|
134
|
+
if (v === undefined)
|
|
135
|
+
return true;
|
|
136
|
+
return this.min === undefined || v > this.min;
|
|
137
|
+
}
|
|
138
|
+
get #canIncrement() {
|
|
139
|
+
const v = this.#currentValue;
|
|
140
|
+
if (v === undefined)
|
|
141
|
+
return true;
|
|
142
|
+
return this.max === undefined || v < this.max;
|
|
143
|
+
}
|
|
144
|
+
connectedCallback() {
|
|
145
|
+
super.connectedCallback();
|
|
146
|
+
if (this.value === undefined && this.defaultValue !== undefined) {
|
|
147
|
+
this.#internalValue = this.#clamp(this.defaultValue);
|
|
148
|
+
}
|
|
149
|
+
this.#syncInputText();
|
|
150
|
+
}
|
|
151
|
+
willUpdate() {
|
|
152
|
+
this.#syncInputText();
|
|
153
|
+
}
|
|
154
|
+
#syncInputText() {
|
|
155
|
+
const v = this.#currentValue;
|
|
156
|
+
this.#inputText = v !== undefined ? String(v) : "";
|
|
157
|
+
}
|
|
158
|
+
#clamp(val) {
|
|
159
|
+
if (this.min !== undefined)
|
|
160
|
+
val = Math.max(this.min, val);
|
|
161
|
+
if (this.max !== undefined)
|
|
162
|
+
val = Math.min(this.max, val);
|
|
163
|
+
return val;
|
|
164
|
+
}
|
|
165
|
+
#setValue(val) {
|
|
166
|
+
const clamped = this.#clamp(val);
|
|
167
|
+
if (this.value === undefined) {
|
|
168
|
+
this.#internalValue = clamped;
|
|
169
|
+
}
|
|
170
|
+
this.#fieldCtx?.markDirty();
|
|
171
|
+
this.#fieldCtx?.setFilled(true);
|
|
172
|
+
this.dispatchEvent(valueChangeEvent({ value: clamped }));
|
|
173
|
+
}
|
|
174
|
+
#increment = (amount) => {
|
|
175
|
+
if (this.#isDisabled || this.readOnly)
|
|
176
|
+
return;
|
|
177
|
+
const current = this.#currentValue ?? this.min ?? 0;
|
|
178
|
+
this.#setValue(current + amount);
|
|
179
|
+
};
|
|
180
|
+
#decrement = (amount) => {
|
|
181
|
+
if (this.#isDisabled || this.readOnly)
|
|
182
|
+
return;
|
|
183
|
+
const current = this.#currentValue ?? this.max ?? 0;
|
|
184
|
+
this.#setValue(current - amount);
|
|
185
|
+
};
|
|
186
|
+
#commitInput() {
|
|
187
|
+
const parsed = parseFloat(this.#inputText);
|
|
188
|
+
if (Number.isNaN(parsed)) {
|
|
189
|
+
this.#syncInputText();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.#setValue(parsed);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
#onInput = (e) => {
|
|
196
|
+
this.#inputText = e.target.value;
|
|
197
|
+
};
|
|
198
|
+
#onBlur = () => {
|
|
199
|
+
this.#commitInput();
|
|
200
|
+
this.#fieldCtx?.setFocused(false);
|
|
201
|
+
this.#fieldCtx?.markTouched();
|
|
202
|
+
};
|
|
203
|
+
#onFocus = () => {
|
|
204
|
+
this.#fieldCtx?.setFocused(true);
|
|
205
|
+
};
|
|
206
|
+
#onKeyDown = (e) => {
|
|
207
|
+
switch (e.key) {
|
|
208
|
+
case "ArrowUp":
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
this.#increment(e.shiftKey ? this.largeStep : this.step);
|
|
211
|
+
break;
|
|
212
|
+
case "ArrowDown":
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
this.#decrement(e.shiftKey ? this.largeStep : this.step);
|
|
215
|
+
break;
|
|
216
|
+
case "Home":
|
|
217
|
+
if (this.min !== undefined) {
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
this.#setValue(this.min);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
case "End":
|
|
223
|
+
if (this.max !== undefined) {
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
this.#setValue(this.max);
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
case "Enter":
|
|
229
|
+
this.#commitInput();
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
#onDecrementClick = () => {
|
|
234
|
+
this.#decrement(this.step);
|
|
235
|
+
};
|
|
236
|
+
#onIncrementClick = () => {
|
|
237
|
+
this.#increment(this.step);
|
|
238
|
+
};
|
|
239
|
+
render() {
|
|
240
|
+
const isDisabled = this.#isDisabled;
|
|
241
|
+
const isInvalid = this.#isInvalid;
|
|
242
|
+
const controlId = this.#fieldCtx?.controlId ?? "";
|
|
243
|
+
const currentValue = this.#currentValue;
|
|
244
|
+
return html `
|
|
245
|
+
<div
|
|
246
|
+
part="root"
|
|
247
|
+
?data-disabled="${isDisabled}"
|
|
248
|
+
?data-invalid="${isInvalid}"
|
|
249
|
+
>
|
|
250
|
+
<button
|
|
251
|
+
part="decrement"
|
|
252
|
+
type="button"
|
|
253
|
+
tabindex="-1"
|
|
254
|
+
aria-label="Decrease"
|
|
255
|
+
?disabled="${isDisabled || this.readOnly || !this.#canDecrement}"
|
|
256
|
+
@click="${this.#onDecrementClick}"
|
|
257
|
+
>
|
|
258
|
+
<slot name="decrement">−</slot>
|
|
259
|
+
</button>
|
|
260
|
+
<input
|
|
261
|
+
part="input"
|
|
262
|
+
id="${controlId || nothing}"
|
|
263
|
+
type="text"
|
|
264
|
+
inputmode="decimal"
|
|
265
|
+
.value="${live(this.#inputText)}"
|
|
266
|
+
?disabled="${isDisabled}"
|
|
267
|
+
?readonly="${this.readOnly}"
|
|
268
|
+
?required="${this.required}"
|
|
269
|
+
aria-invalid="${isInvalid ? "true" : nothing}"
|
|
270
|
+
?data-disabled="${isDisabled}"
|
|
271
|
+
@input="${this.#onInput}"
|
|
272
|
+
@keydown="${this.#onKeyDown}"
|
|
273
|
+
@focus="${this.#onFocus}"
|
|
274
|
+
@blur="${this.#onBlur}"
|
|
275
|
+
/>
|
|
276
|
+
<button
|
|
277
|
+
part="increment"
|
|
278
|
+
type="button"
|
|
279
|
+
tabindex="-1"
|
|
280
|
+
aria-label="Increase"
|
|
281
|
+
?disabled="${isDisabled || this.readOnly || !this.#canIncrement}"
|
|
282
|
+
@click="${this.#onIncrementClick}"
|
|
283
|
+
>
|
|
284
|
+
<slot name="increment">+</slot>
|
|
285
|
+
</button>
|
|
286
|
+
${this.name
|
|
287
|
+
? html `<input
|
|
288
|
+
type="hidden"
|
|
289
|
+
name="${this.name}"
|
|
290
|
+
.value="${String(currentValue ?? "")}"
|
|
291
|
+
/>`
|
|
292
|
+
: nothing}
|
|
293
|
+
</div>
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
__decorate([
|
|
298
|
+
property({ type: Number })
|
|
299
|
+
], DuiNumberField.prototype, "value", null);
|
|
300
|
+
__decorate([
|
|
301
|
+
property({ type: Number, attribute: "default-value" })
|
|
302
|
+
], DuiNumberField.prototype, "defaultValue", null);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ type: Number })
|
|
305
|
+
], DuiNumberField.prototype, "min", null);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ type: Number })
|
|
308
|
+
], DuiNumberField.prototype, "max", null);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: Number })
|
|
311
|
+
], DuiNumberField.prototype, "step", null);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ type: Number, attribute: "large-step" })
|
|
314
|
+
], DuiNumberField.prototype, "largeStep", null);
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: Boolean, reflect: true })
|
|
317
|
+
], DuiNumberField.prototype, "disabled", null);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: Boolean, reflect: true, attribute: "read-only" })
|
|
320
|
+
], DuiNumberField.prototype, "readOnly", null);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: Boolean })
|
|
323
|
+
], DuiNumberField.prototype, "required", null);
|
|
324
|
+
__decorate([
|
|
325
|
+
property()
|
|
326
|
+
], DuiNumberField.prototype, "name", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepfuture/dui-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "DUI unstyled web components — structural CSS only, themed via applyTheme()",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/nicholasgasior/dui.git",
|
|
10
|
+
"directory": "packages/components"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./button": {
|
|
14
|
+
"import": "./button/index.js",
|
|
15
|
+
"types": "./button/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./switch": {
|
|
18
|
+
"import": "./switch/index.js",
|
|
19
|
+
"types": "./switch/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./accordion": {
|
|
22
|
+
"import": "./accordion/index.js",
|
|
23
|
+
"types": "./accordion/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./badge": {
|
|
26
|
+
"import": "./badge/index.js",
|
|
27
|
+
"types": "./badge/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./icon": {
|
|
30
|
+
"import": "./icon/index.js",
|
|
31
|
+
"types": "./icon/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./scroll-area": {
|
|
34
|
+
"import": "./scroll-area/index.js",
|
|
35
|
+
"types": "./scroll-area/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./combobox": {
|
|
38
|
+
"import": "./combobox/index.js",
|
|
39
|
+
"types": "./combobox/index.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./menu": {
|
|
42
|
+
"import": "./menu/index.js",
|
|
43
|
+
"types": "./menu/index.d.ts"
|
|
44
|
+
},
|
|
45
|
+
"./popover": {
|
|
46
|
+
"import": "./popover/index.js",
|
|
47
|
+
"types": "./popover/index.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./tooltip": {
|
|
50
|
+
"import": "./tooltip/index.js",
|
|
51
|
+
"types": "./tooltip/index.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"./dialog": {
|
|
54
|
+
"import": "./dialog/index.js",
|
|
55
|
+
"types": "./dialog/index.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./alert-dialog": {
|
|
58
|
+
"import": "./alert-dialog/index.js",
|
|
59
|
+
"types": "./alert-dialog/index.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./breadcrumb": {
|
|
62
|
+
"import": "./breadcrumb/index.js",
|
|
63
|
+
"types": "./breadcrumb/index.d.ts"
|
|
64
|
+
},
|
|
65
|
+
"./checkbox": {
|
|
66
|
+
"import": "./checkbox/index.js",
|
|
67
|
+
"types": "./checkbox/index.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./collapsible": {
|
|
70
|
+
"import": "./collapsible/index.js",
|
|
71
|
+
"types": "./collapsible/index.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./toolbar": {
|
|
74
|
+
"import": "./toolbar/index.js",
|
|
75
|
+
"types": "./toolbar/index.d.ts"
|
|
76
|
+
},
|
|
77
|
+
"./slider": {
|
|
78
|
+
"import": "./slider/index.js",
|
|
79
|
+
"types": "./slider/index.d.ts"
|
|
80
|
+
},
|
|
81
|
+
"./spinner": {
|
|
82
|
+
"import": "./spinner/index.js",
|
|
83
|
+
"types": "./spinner/index.d.ts"
|
|
84
|
+
},
|
|
85
|
+
"./tabs": {
|
|
86
|
+
"import": "./tabs/index.js",
|
|
87
|
+
"types": "./tabs/index.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./textarea": {
|
|
90
|
+
"import": "./textarea/index.js",
|
|
91
|
+
"types": "./textarea/index.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./trunc": {
|
|
94
|
+
"import": "./trunc/index.js",
|
|
95
|
+
"types": "./trunc/index.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./center": {
|
|
98
|
+
"import": "./center/index.js",
|
|
99
|
+
"types": "./center/index.d.ts"
|
|
100
|
+
},
|
|
101
|
+
"./hstack": {
|
|
102
|
+
"import": "./hstack/index.js",
|
|
103
|
+
"types": "./hstack/index.d.ts"
|
|
104
|
+
},
|
|
105
|
+
"./vstack": {
|
|
106
|
+
"import": "./vstack/index.js",
|
|
107
|
+
"types": "./vstack/index.d.ts"
|
|
108
|
+
},
|
|
109
|
+
"./page-inset": {
|
|
110
|
+
"import": "./page-inset/index.js",
|
|
111
|
+
"types": "./page-inset/index.d.ts"
|
|
112
|
+
},
|
|
113
|
+
"./link": {
|
|
114
|
+
"import": "./link/index.js",
|
|
115
|
+
"types": "./link/index.d.ts"
|
|
116
|
+
},
|
|
117
|
+
"./avatar": {
|
|
118
|
+
"import": "./avatar/index.js",
|
|
119
|
+
"types": "./avatar/index.d.ts"
|
|
120
|
+
},
|
|
121
|
+
"./portal": {
|
|
122
|
+
"import": "./portal/index.js",
|
|
123
|
+
"types": "./portal/index.d.ts"
|
|
124
|
+
},
|
|
125
|
+
"./field": {
|
|
126
|
+
"import": "./field/index.js",
|
|
127
|
+
"types": "./field/index.d.ts"
|
|
128
|
+
},
|
|
129
|
+
"./input": {
|
|
130
|
+
"import": "./input/index.js",
|
|
131
|
+
"types": "./input/index.d.ts"
|
|
132
|
+
},
|
|
133
|
+
"./radio": {
|
|
134
|
+
"import": "./radio/index.js",
|
|
135
|
+
"types": "./radio/index.d.ts"
|
|
136
|
+
},
|
|
137
|
+
"./dropzone": {
|
|
138
|
+
"import": "./dropzone/index.js",
|
|
139
|
+
"types": "./dropzone/index.d.ts"
|
|
140
|
+
},
|
|
141
|
+
"./select": {
|
|
142
|
+
"import": "./select/index.js",
|
|
143
|
+
"types": "./select/index.d.ts"
|
|
144
|
+
},
|
|
145
|
+
"./preview-card": {
|
|
146
|
+
"import": "./preview-card/index.js",
|
|
147
|
+
"types": "./preview-card/index.d.ts"
|
|
148
|
+
},
|
|
149
|
+
"./data-table": {
|
|
150
|
+
"import": "./data-table/index.js",
|
|
151
|
+
"types": "./data-table/index.d.ts"
|
|
152
|
+
},
|
|
153
|
+
"./command": {
|
|
154
|
+
"import": "./command/index.js",
|
|
155
|
+
"types": "./command/index.d.ts"
|
|
156
|
+
},
|
|
157
|
+
"./sidebar": {
|
|
158
|
+
"import": "./sidebar/index.js",
|
|
159
|
+
"types": "./sidebar/index.d.ts"
|
|
160
|
+
},
|
|
161
|
+
"./separator": {
|
|
162
|
+
"import": "./separator/index.js",
|
|
163
|
+
"types": "./separator/index.d.ts"
|
|
164
|
+
},
|
|
165
|
+
"./progress": {
|
|
166
|
+
"import": "./progress/index.js",
|
|
167
|
+
"types": "./progress/index.d.ts"
|
|
168
|
+
},
|
|
169
|
+
"./toggle": {
|
|
170
|
+
"import": "./toggle/index.js",
|
|
171
|
+
"types": "./toggle/index.d.ts"
|
|
172
|
+
},
|
|
173
|
+
"./number-field": {
|
|
174
|
+
"import": "./number-field/index.js",
|
|
175
|
+
"types": "./number-field/index.d.ts"
|
|
176
|
+
},
|
|
177
|
+
"./menubar": {
|
|
178
|
+
"import": "./menubar/index.js",
|
|
179
|
+
"types": "./menubar/index.d.ts"
|
|
180
|
+
},
|
|
181
|
+
"./calendar": {
|
|
182
|
+
"import": "./calendar/index.js",
|
|
183
|
+
"types": "./calendar/index.d.ts"
|
|
184
|
+
},
|
|
185
|
+
"./all": {
|
|
186
|
+
"import": "./all.js",
|
|
187
|
+
"types": "./all.d.ts"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"files": [
|
|
191
|
+
"**/*.js",
|
|
192
|
+
"**/*.d.ts",
|
|
193
|
+
"**/*.css"
|
|
194
|
+
],
|
|
195
|
+
"dependencies": {
|
|
196
|
+
"@deepfuture/dui-core": "0.0.1",
|
|
197
|
+
"lit": "^3.3.2",
|
|
198
|
+
"@lit/context": "^1.1.3"
|
|
199
|
+
},
|
|
200
|
+
"sideEffects": false,
|
|
201
|
+
"keywords": [
|
|
202
|
+
"web-components",
|
|
203
|
+
"lit",
|
|
204
|
+
"unstyled",
|
|
205
|
+
"components",
|
|
206
|
+
"dui",
|
|
207
|
+
"theme"
|
|
208
|
+
],
|
|
209
|
+
"types": "./global.d.ts",
|
|
210
|
+
"typesVersions": {
|
|
211
|
+
"*": {
|
|
212
|
+
"*": [
|
|
213
|
+
"./*"
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiPageInset } from "./page-inset.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DuiPageInset } from "./page-inset.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/page-inset */
|
|
2
|
+
import { LitElement, type PropertyValues, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-page-inset>` — Centers content with max-width constraints and configurable padding.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Content to be centered within the inset area.
|
|
7
|
+
* @csspart root - The outer container element.
|
|
8
|
+
* @csspart inner - The inner content wrapper with max-width constraint.
|
|
9
|
+
* @cssprop --page-inset-pad-x - Horizontal padding (default: var(--space-16)).
|
|
10
|
+
* @cssprop --page-inset-pad-y - Vertical padding (default: var(--space-12)).
|
|
11
|
+
* @cssprop --page-inset-max-width - Max width of inner content (default: 48rem).
|
|
12
|
+
* @cssprop --page-inset-min-width - Min width of inner content (default: auto).
|
|
13
|
+
*/
|
|
14
|
+
export declare class DuiPageInset extends LitElement {
|
|
15
|
+
#private;
|
|
16
|
+
static tagName: "dui-page-inset";
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
/** Maximum width of the inner content area. Overrides --page-inset-max-width. */
|
|
19
|
+
accessor maxWidth: string | undefined;
|
|
20
|
+
/** Minimum width of the inner content area. Overrides --page-inset-min-width. */
|
|
21
|
+
accessor minWidth: string | undefined;
|
|
22
|
+
/** Horizontal padding. Overrides --page-inset-pad-x. */
|
|
23
|
+
accessor padX: string | undefined;
|
|
24
|
+
/** Vertical padding. Overrides --page-inset-pad-y. */
|
|
25
|
+
accessor padY: string | undefined;
|
|
26
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
27
|
+
render(): TemplateResult;
|
|
28
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Ported from original DUI: deep-future-app/app/client/components/dui/page-inset */
|
|
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
|
+
/** Structural styles only — layout CSS. */
|
|
12
|
+
const styles = css `
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
--page-inset-pad-x: var(--space-16);
|
|
16
|
+
--page-inset-pad-y: var(--space-12);
|
|
17
|
+
--page-inset-max-width: 48rem;
|
|
18
|
+
--page-inset-min-width: auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[part="root"] {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
padding: var(--page-inset-pad-y) var(--page-inset-pad-x);
|
|
26
|
+
min-height: 100cqh;
|
|
27
|
+
max-width: 100cqw;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[part="inner"] {
|
|
31
|
+
max-width: var(--page-inset-max-width);
|
|
32
|
+
min-width: var(--page-inset-min-width);
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
/**
|
|
37
|
+
* `<dui-page-inset>` — Centers content with max-width constraints and configurable padding.
|
|
38
|
+
*
|
|
39
|
+
* @slot - Content to be centered within the inset area.
|
|
40
|
+
* @csspart root - The outer container element.
|
|
41
|
+
* @csspart inner - The inner content wrapper with max-width constraint.
|
|
42
|
+
* @cssprop --page-inset-pad-x - Horizontal padding (default: var(--space-16)).
|
|
43
|
+
* @cssprop --page-inset-pad-y - Vertical padding (default: var(--space-12)).
|
|
44
|
+
* @cssprop --page-inset-max-width - Max width of inner content (default: 48rem).
|
|
45
|
+
* @cssprop --page-inset-min-width - Min width of inner content (default: auto).
|
|
46
|
+
*/
|
|
47
|
+
export class DuiPageInset extends LitElement {
|
|
48
|
+
static { this.tagName = "dui-page-inset"; }
|
|
49
|
+
static { this.styles = [base, styles]; }
|
|
50
|
+
#maxWidth_accessor_storage;
|
|
51
|
+
/** Maximum width of the inner content area. Overrides --page-inset-max-width. */
|
|
52
|
+
get maxWidth() { return this.#maxWidth_accessor_storage; }
|
|
53
|
+
set maxWidth(value) { this.#maxWidth_accessor_storage = value; }
|
|
54
|
+
#minWidth_accessor_storage;
|
|
55
|
+
/** Minimum width of the inner content area. Overrides --page-inset-min-width. */
|
|
56
|
+
get minWidth() { return this.#minWidth_accessor_storage; }
|
|
57
|
+
set minWidth(value) { this.#minWidth_accessor_storage = value; }
|
|
58
|
+
#padX_accessor_storage;
|
|
59
|
+
/** Horizontal padding. Overrides --page-inset-pad-x. */
|
|
60
|
+
get padX() { return this.#padX_accessor_storage; }
|
|
61
|
+
set padX(value) { this.#padX_accessor_storage = value; }
|
|
62
|
+
#padY_accessor_storage;
|
|
63
|
+
/** Vertical padding. Overrides --page-inset-pad-y. */
|
|
64
|
+
get padY() { return this.#padY_accessor_storage; }
|
|
65
|
+
set padY(value) { this.#padY_accessor_storage = value; }
|
|
66
|
+
#setOrRemove(prop, value) {
|
|
67
|
+
if (value)
|
|
68
|
+
this.style.setProperty(prop, value);
|
|
69
|
+
else
|
|
70
|
+
this.style.removeProperty(prop);
|
|
71
|
+
}
|
|
72
|
+
willUpdate(changed) {
|
|
73
|
+
if (changed.has("maxWidth"))
|
|
74
|
+
this.#setOrRemove("--page-inset-max-width", this.maxWidth);
|
|
75
|
+
if (changed.has("minWidth"))
|
|
76
|
+
this.#setOrRemove("--page-inset-min-width", this.minWidth);
|
|
77
|
+
if (changed.has("padX"))
|
|
78
|
+
this.#setOrRemove("--page-inset-pad-x", this.padX);
|
|
79
|
+
if (changed.has("padY"))
|
|
80
|
+
this.#setOrRemove("--page-inset-pad-y", this.padY);
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
return html `
|
|
84
|
+
<div part="root">
|
|
85
|
+
<div part="inner">
|
|
86
|
+
<slot></slot>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ attribute: "max-width" })
|
|
94
|
+
], DuiPageInset.prototype, "maxWidth", null);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ attribute: "min-width" })
|
|
97
|
+
], DuiPageInset.prototype, "minWidth", null);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ attribute: "pad-x" })
|
|
100
|
+
], DuiPageInset.prototype, "padX", null);
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ attribute: "pad-y" })
|
|
103
|
+
], DuiPageInset.prototype, "padY", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|