@deepfuture/dui-components 0.0.10 → 0.0.11
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/_deprecated/center/index.d.ts +1 -0
- package/_deprecated/center/index.js +1 -0
- package/_deprecated/center/register.d.ts +1 -0
- package/_deprecated/center/register.js +4 -0
- package/_deprecated/hstack/index.d.ts +2 -0
- package/_deprecated/hstack/index.js +1 -0
- package/_deprecated/hstack/register.d.ts +1 -0
- package/_deprecated/hstack/register.js +4 -0
- package/_deprecated/page-inset/index.d.ts +1 -0
- package/_deprecated/page-inset/index.js +1 -0
- package/_deprecated/page-inset/register.d.ts +1 -0
- package/_deprecated/page-inset/register.js +4 -0
- package/_deprecated/vstack/index.d.ts +1 -0
- package/_deprecated/vstack/index.js +1 -0
- package/_deprecated/vstack/register.d.ts +1 -0
- package/_deprecated/vstack/register.js +4 -0
- package/accordion/index.d.ts +2 -5
- package/accordion/index.js +2 -5
- package/accordion/register.d.ts +1 -0
- package/accordion/register.js +8 -0
- package/alert-dialog/alert-dialog.d.ts +2 -0
- package/alert-dialog/alert-dialog.js +12 -6
- package/alert-dialog/index.d.ts +4 -9
- package/alert-dialog/index.js +4 -9
- package/alert-dialog/register.d.ts +1 -0
- package/alert-dialog/register.js +16 -0
- package/all.d.ts +16 -64
- package/all.js +132 -144
- package/avatar/index.d.ts +1 -3
- package/avatar/index.js +1 -3
- package/avatar/register.d.ts +1 -0
- package/avatar/register.js +4 -0
- package/badge/index.d.ts +1 -3
- package/badge/index.js +1 -3
- package/badge/register.d.ts +1 -0
- package/badge/register.js +4 -0
- package/breadcrumb/index.d.ts +6 -13
- package/breadcrumb/index.js +6 -13
- package/breadcrumb/register.d.ts +1 -0
- package/breadcrumb/register.js +14 -0
- package/button/index.d.ts +1 -3
- package/button/index.js +1 -3
- package/button/register.d.ts +1 -0
- package/button/register.js +4 -0
- package/calendar/index.d.ts +1 -3
- package/calendar/index.js +1 -3
- package/calendar/register.d.ts +1 -0
- package/calendar/register.js +4 -0
- package/checkbox/checkbox-group.d.ts +2 -0
- package/checkbox/checkbox-group.js +12 -6
- package/checkbox/checkbox.d.ts +2 -0
- package/checkbox/checkbox.js +17 -11
- package/checkbox/index.d.ts +2 -5
- package/checkbox/index.js +2 -5
- package/checkbox/register.d.ts +1 -0
- package/checkbox/register.js +8 -0
- package/collapsible/index.d.ts +1 -3
- package/collapsible/index.js +1 -3
- package/collapsible/register.d.ts +1 -0
- package/collapsible/register.js +4 -0
- package/combobox/index.d.ts +1 -3
- package/combobox/index.js +1 -3
- package/combobox/register.d.ts +1 -0
- package/combobox/register.js +4 -0
- package/command/index.d.ts +8 -17
- package/command/index.js +8 -17
- package/command/register.d.ts +1 -0
- package/command/register.js +22 -0
- package/data-table/index.d.ts +1 -3
- package/data-table/index.js +1 -3
- package/data-table/register.d.ts +1 -0
- package/data-table/register.js +4 -0
- package/dialog/dialog.d.ts +2 -0
- package/dialog/dialog.js +12 -6
- package/dialog/index.d.ts +4 -9
- package/dialog/index.js +4 -9
- package/dialog/register.d.ts +1 -0
- package/dialog/register.js +16 -0
- package/dropzone/index.d.ts +1 -3
- package/dropzone/index.js +1 -3
- package/dropzone/register.d.ts +1 -0
- package/dropzone/register.js +4 -0
- package/global.d.ts +0 -8
- package/icon/index.d.ts +1 -3
- package/icon/index.js +1 -3
- package/icon/register.d.ts +1 -0
- package/icon/register.js +4 -0
- package/input/index.d.ts +1 -3
- package/input/index.js +1 -3
- package/input/input.d.ts +2 -0
- package/input/input.js +24 -18
- package/input/register.d.ts +1 -0
- package/input/register.js +4 -0
- package/link/index.d.ts +1 -3
- package/link/index.js +1 -3
- package/link/register.d.ts +1 -0
- package/link/register.js +4 -0
- package/menu/index.d.ts +2 -5
- package/menu/index.js +2 -5
- package/menu/register.d.ts +1 -0
- package/menu/register.js +8 -0
- package/menubar/index.d.ts +1 -3
- package/menubar/index.js +1 -3
- package/menubar/menubar.d.ts +2 -0
- package/menubar/menubar.js +11 -5
- package/menubar/register.d.ts +1 -0
- package/menubar/register.js +4 -0
- package/number-field/index.d.ts +1 -3
- package/number-field/index.js +1 -3
- package/number-field/number-field.d.ts +2 -0
- package/number-field/number-field.js +18 -12
- package/number-field/register.d.ts +1 -0
- package/number-field/register.js +4 -0
- package/package.json +4 -21
- package/popover/index.d.ts +4 -9
- package/popover/index.js +4 -9
- package/popover/popover.d.ts +2 -1
- package/popover/popover.js +14 -8
- package/popover/register.d.ts +1 -0
- package/popover/register.js +16 -0
- package/portal/index.d.ts +1 -3
- package/portal/index.js +1 -3
- package/portal/register.d.ts +1 -0
- package/portal/register.js +4 -0
- package/preview-card/index.d.ts +3 -7
- package/preview-card/index.js +3 -7
- package/preview-card/preview-card.d.ts +2 -1
- package/preview-card/preview-card.js +14 -8
- package/preview-card/register.d.ts +1 -0
- package/preview-card/register.js +12 -0
- package/progress/index.d.ts +1 -3
- package/progress/index.js +1 -3
- package/progress/register.d.ts +1 -0
- package/progress/register.js +4 -0
- package/radio/index.d.ts +2 -5
- package/radio/index.js +2 -5
- package/radio/radio-group.d.ts +2 -0
- package/radio/radio-group.js +12 -6
- package/radio/radio.d.ts +2 -0
- package/radio/radio.js +15 -9
- package/radio/register.d.ts +1 -0
- package/radio/register.js +8 -0
- package/scroll-area/index.d.ts +1 -3
- package/scroll-area/index.js +1 -3
- package/scroll-area/register.d.ts +1 -0
- package/scroll-area/register.js +4 -0
- package/scroll-area/scroll-area.js +0 -7
- package/select/index.d.ts +1 -3
- package/select/index.js +1 -3
- package/select/register.d.ts +1 -0
- package/select/register.js +4 -0
- package/select/select.d.ts +2 -0
- package/select/select.js +19 -13
- package/separator/index.d.ts +1 -3
- package/separator/index.js +1 -3
- package/separator/register.d.ts +1 -0
- package/separator/register.js +4 -0
- package/sidebar/index.d.ts +13 -27
- package/sidebar/index.js +13 -32
- package/sidebar/register.d.ts +1 -0
- package/sidebar/register.js +52 -0
- package/sidebar/sidebar-provider.d.ts +2 -0
- package/sidebar/sidebar-provider.js +12 -6
- package/slider/index.d.ts +1 -3
- package/slider/index.js +1 -3
- package/slider/register.d.ts +1 -0
- package/slider/register.js +4 -0
- package/spinner/index.d.ts +1 -3
- package/spinner/index.js +1 -3
- package/spinner/register.d.ts +1 -0
- package/spinner/register.js +4 -0
- package/switch/index.d.ts +1 -3
- package/switch/index.js +1 -3
- package/switch/register.d.ts +1 -0
- package/switch/register.js +4 -0
- package/switch/switch.d.ts +2 -0
- package/switch/switch.js +15 -9
- package/tabs/index.d.ts +5 -11
- package/tabs/index.js +5 -11
- package/tabs/register.d.ts +1 -0
- package/tabs/register.js +10 -0
- package/textarea/index.d.ts +1 -3
- package/textarea/index.js +1 -3
- package/textarea/register.d.ts +1 -0
- package/textarea/register.js +4 -0
- package/toggle/index.d.ts +2 -5
- package/toggle/index.js +2 -5
- package/toggle/register.d.ts +1 -0
- package/toggle/register.js +8 -0
- package/toggle/toggle-group.d.ts +2 -0
- package/toggle/toggle-group.js +12 -6
- package/toggle/toggle.d.ts +2 -0
- package/toggle/toggle.js +15 -9
- package/toolbar/index.d.ts +1 -3
- package/toolbar/index.js +1 -3
- package/toolbar/register.d.ts +1 -0
- package/toolbar/register.js +4 -0
- package/tooltip/index.d.ts +3 -7
- package/tooltip/index.js +3 -7
- package/tooltip/register.d.ts +1 -0
- package/tooltip/register.js +12 -0
- package/tooltip/tooltip.d.ts +2 -1
- package/tooltip/tooltip.js +14 -8
- package/trunc/index.d.ts +1 -3
- package/trunc/index.js +1 -3
- package/trunc/register.d.ts +1 -0
- package/trunc/register.js +4 -0
- package/README.md +0 -191
- package/center/index.d.ts +0 -3
- package/center/index.js +0 -3
- package/hstack/index.d.ts +0 -4
- package/hstack/index.js +0 -3
- package/page-inset/index.d.ts +0 -3
- package/page-inset/index.js +0 -3
- package/vstack/index.d.ts +0 -3
- package/vstack/index.js +0 -3
- /package/{center → _deprecated/center}/center.d.ts +0 -0
- /package/{center → _deprecated/center}/center.js +0 -0
- /package/{hstack → _deprecated/hstack}/hstack.d.ts +0 -0
- /package/{hstack → _deprecated/hstack}/hstack.js +0 -0
- /package/{page-inset → _deprecated/page-inset}/page-inset.d.ts +0 -0
- /package/{page-inset → _deprecated/page-inset}/page-inset.js +0 -0
- /package/{vstack → _deprecated/vstack}/vstack.d.ts +0 -0
- /package/{vstack → _deprecated/vstack}/vstack.js +0 -0
package/radio/radio.js
CHANGED
|
@@ -6,10 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
import { css, html, LitElement, nothing } from "lit";
|
|
9
|
-
import { property } from "lit/decorators.js";
|
|
9
|
+
import { property, state } from "lit/decorators.js";
|
|
10
10
|
import { ContextConsumer } from "@lit/context";
|
|
11
|
+
import { consume } from "@lit/context";
|
|
11
12
|
import { base } from "@deepfuture/dui-core/base";
|
|
12
13
|
import { radioGroupContext } from "./radio-group-context.js";
|
|
14
|
+
import { fieldContext } from "@deepfuture/dui-components/field";
|
|
13
15
|
/** Structural styles only — layout CSS. */
|
|
14
16
|
const styles = css `
|
|
15
17
|
:host {
|
|
@@ -93,16 +95,16 @@ export class DuiRadio extends LitElement {
|
|
|
93
95
|
context: radioGroupContext,
|
|
94
96
|
subscribe: true,
|
|
95
97
|
});
|
|
96
|
-
#
|
|
97
|
-
get
|
|
98
|
-
set
|
|
98
|
+
#_fieldCtx_accessor_storage;
|
|
99
|
+
get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
|
|
100
|
+
set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
|
|
99
101
|
get #isChecked() {
|
|
100
102
|
return this.#groupCtx.value?.value === this.value;
|
|
101
103
|
}
|
|
102
104
|
get #isDisabled() {
|
|
103
105
|
return (this.disabled ||
|
|
104
106
|
(this.#groupCtx.value?.disabled ?? false) ||
|
|
105
|
-
(this
|
|
107
|
+
(this._fieldCtx?.disabled ?? false));
|
|
106
108
|
}
|
|
107
109
|
get #isReadOnly() {
|
|
108
110
|
return this.readOnly || (this.#groupCtx.value?.readOnly ?? false);
|
|
@@ -111,7 +113,7 @@ export class DuiRadio extends LitElement {
|
|
|
111
113
|
return this.#groupCtx.value?.required ?? false;
|
|
112
114
|
}
|
|
113
115
|
get #isInvalid() {
|
|
114
|
-
return this
|
|
116
|
+
return this._fieldCtx?.invalid ?? false;
|
|
115
117
|
}
|
|
116
118
|
connectedCallback() {
|
|
117
119
|
super.connectedCallback();
|
|
@@ -132,8 +134,8 @@ export class DuiRadio extends LitElement {
|
|
|
132
134
|
const ctx = this.#groupCtx.value;
|
|
133
135
|
if (ctx) {
|
|
134
136
|
ctx.select(this.value);
|
|
135
|
-
this
|
|
136
|
-
this
|
|
137
|
+
this._fieldCtx?.markDirty();
|
|
138
|
+
this._fieldCtx?.markTouched();
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
#handleKeyDown = (e) => {
|
|
@@ -148,7 +150,7 @@ export class DuiRadio extends LitElement {
|
|
|
148
150
|
const isReadOnly = this.#isReadOnly;
|
|
149
151
|
const isRequired = this.#isRequired;
|
|
150
152
|
const isInvalid = this.#isInvalid;
|
|
151
|
-
const controlId = this
|
|
153
|
+
const controlId = this._fieldCtx?.controlId ?? "";
|
|
152
154
|
return html `
|
|
153
155
|
<span
|
|
154
156
|
part="root"
|
|
@@ -201,3 +203,7 @@ __decorate([
|
|
|
201
203
|
__decorate([
|
|
202
204
|
property({ type: Boolean, reflect: true, attribute: "read-only" })
|
|
203
205
|
], DuiRadio.prototype, "readOnly", null);
|
|
206
|
+
__decorate([
|
|
207
|
+
consume({ context: fieldContext, subscribe: true }),
|
|
208
|
+
state()
|
|
209
|
+
], DuiRadio.prototype, "_fieldCtx", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DuiRadio } from "./radio.js";
|
|
2
|
+
import { DuiRadioGroup } from "./radio-group.js";
|
|
3
|
+
if (!customElements.get(DuiRadio.tagName)) {
|
|
4
|
+
customElements.define(DuiRadio.tagName, DuiRadio);
|
|
5
|
+
}
|
|
6
|
+
if (!customElements.get(DuiRadioGroup.tagName)) {
|
|
7
|
+
customElements.define(DuiRadioGroup.tagName, DuiRadioGroup);
|
|
8
|
+
}
|
package/scroll-area/index.d.ts
CHANGED
package/scroll-area/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -198,16 +198,9 @@ export class DuiScrollArea extends LitElement {
|
|
|
198
198
|
this.#resizeObserver.observe(viewport);
|
|
199
199
|
const slot = viewport.querySelector("slot");
|
|
200
200
|
if (slot) {
|
|
201
|
-
const observe = () => {
|
|
202
|
-
for (const node of slot.assignedElements()) {
|
|
203
|
-
this.#resizeObserver.observe(node);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
201
|
slot.addEventListener("slotchange", () => {
|
|
207
|
-
observe();
|
|
208
202
|
requestAnimationFrame(() => this.#measure());
|
|
209
203
|
});
|
|
210
|
-
observe();
|
|
211
204
|
}
|
|
212
205
|
this.#measure();
|
|
213
206
|
}
|
package/select/index.d.ts
CHANGED
package/select/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/select/select.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/select */
|
|
2
2
|
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
import { type FieldContext } from "../field/field-context.js";
|
|
3
4
|
export type SelectOption = {
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
@@ -32,5 +33,6 @@ export declare class DuiSelect extends LitElement {
|
|
|
32
33
|
accessor disabled: boolean;
|
|
33
34
|
/** Name for form submission. */
|
|
34
35
|
accessor name: string;
|
|
36
|
+
accessor _fieldCtx: FieldContext;
|
|
35
37
|
render(): TemplateResult;
|
|
36
38
|
}
|
package/select/select.js
CHANGED
|
@@ -6,11 +6,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
import { css, html, LitElement, nothing } from "lit";
|
|
9
|
-
import { property } from "lit/decorators.js";
|
|
9
|
+
import { property, state } from "lit/decorators.js";
|
|
10
10
|
import { repeat } from "lit/directives/repeat.js";
|
|
11
|
+
import { consume } from "@lit/context";
|
|
11
12
|
import { base } from "@deepfuture/dui-core/base";
|
|
12
13
|
import { customEvent } from "@deepfuture/dui-core/event";
|
|
13
14
|
import { FloatingPortalController } from "@deepfuture/dui-core/floating-portal-controller";
|
|
15
|
+
import { fieldContext } from "../field/field-context.js";
|
|
14
16
|
export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
|
|
15
17
|
/** Structural styles only — layout CSS. */
|
|
16
18
|
const hostStyles = css `
|
|
@@ -115,9 +117,9 @@ export class DuiSelect extends LitElement {
|
|
|
115
117
|
/** Name for form submission. */
|
|
116
118
|
get name() { return this.#name_accessor_storage; }
|
|
117
119
|
set name(value) { this.#name_accessor_storage = value; }
|
|
118
|
-
#
|
|
119
|
-
get
|
|
120
|
-
set
|
|
120
|
+
#_fieldCtx_accessor_storage;
|
|
121
|
+
get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
|
|
122
|
+
set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
|
|
121
123
|
#highlightedIndex_accessor_storage = -1;
|
|
122
124
|
get #highlightedIndex() { return this.#highlightedIndex_accessor_storage; }
|
|
123
125
|
set #highlightedIndex(value) { this.#highlightedIndex_accessor_storage = value; }
|
|
@@ -131,7 +133,7 @@ export class DuiSelect extends LitElement {
|
|
|
131
133
|
},
|
|
132
134
|
onClose: () => {
|
|
133
135
|
this.#highlightedIndex = -1;
|
|
134
|
-
this
|
|
136
|
+
this._fieldCtx?.markTouched();
|
|
135
137
|
},
|
|
136
138
|
renderPopup: (portal) => {
|
|
137
139
|
return html `
|
|
@@ -144,7 +146,7 @@ export class DuiSelect extends LitElement {
|
|
|
144
146
|
class="Listbox"
|
|
145
147
|
id="${this.#listboxId}"
|
|
146
148
|
role="listbox"
|
|
147
|
-
aria-labelledby="${this
|
|
149
|
+
aria-labelledby="${this._fieldCtx?.labelId ?? ""}"
|
|
148
150
|
@mousedown="${this.#onListMouseDown}"
|
|
149
151
|
>
|
|
150
152
|
${repeat(this.options, (option) => option.value, this.#renderItem)}
|
|
@@ -155,10 +157,10 @@ export class DuiSelect extends LitElement {
|
|
|
155
157
|
});
|
|
156
158
|
// ---- Computed ----
|
|
157
159
|
get #isDisabled() {
|
|
158
|
-
return this.disabled || (this
|
|
160
|
+
return this.disabled || (this._fieldCtx?.disabled ?? false);
|
|
159
161
|
}
|
|
160
162
|
get #isInvalid() {
|
|
161
|
-
return this
|
|
163
|
+
return this._fieldCtx?.invalid ?? false;
|
|
162
164
|
}
|
|
163
165
|
get #selectedOption() {
|
|
164
166
|
return this.options.find((o) => o.value === this.value);
|
|
@@ -265,8 +267,8 @@ export class DuiSelect extends LitElement {
|
|
|
265
267
|
// ---- Selection ----
|
|
266
268
|
#selectOption(option) {
|
|
267
269
|
this.value = option.value;
|
|
268
|
-
this
|
|
269
|
-
this
|
|
270
|
+
this._fieldCtx?.markDirty();
|
|
271
|
+
this._fieldCtx?.setFilled(this.value.length > 0);
|
|
270
272
|
this.dispatchEvent(valueChangeEvent({ value: option.value, option }));
|
|
271
273
|
this.#popup.close();
|
|
272
274
|
this.#focusTrigger();
|
|
@@ -325,15 +327,15 @@ export class DuiSelect extends LitElement {
|
|
|
325
327
|
aria-activedescendant="${this.#highlightedIndex >= 0
|
|
326
328
|
? `${this.#listboxId}-option-${this.#highlightedIndex}`
|
|
327
329
|
: nothing}"
|
|
328
|
-
aria-labelledby="${this
|
|
330
|
+
aria-labelledby="${this._fieldCtx?.labelId ?? ""}"
|
|
329
331
|
aria-invalid="${this.#isInvalid}"
|
|
330
332
|
?data-disabled="${this.#isDisabled}"
|
|
331
333
|
?data-invalid="${this.#isInvalid}"
|
|
332
334
|
?data-open="${this.#popup.isOpen}"
|
|
333
335
|
@click="${this.#onTriggerClick}"
|
|
334
336
|
@keydown="${this.#onTriggerKeyDown}"
|
|
335
|
-
@focus="${() => this
|
|
336
|
-
@blur="${() => this
|
|
337
|
+
@focus="${() => this._fieldCtx?.setFocused(true)}"
|
|
338
|
+
@blur="${() => this._fieldCtx?.setFocused(false)}"
|
|
337
339
|
>
|
|
338
340
|
<span
|
|
339
341
|
class="Value"
|
|
@@ -368,3 +370,7 @@ __decorate([
|
|
|
368
370
|
__decorate([
|
|
369
371
|
property({ type: String })
|
|
370
372
|
], DuiSelect.prototype, "name", null);
|
|
373
|
+
__decorate([
|
|
374
|
+
consume({ context: fieldContext, subscribe: true }),
|
|
375
|
+
state()
|
|
376
|
+
], DuiSelect.prototype, "_fieldCtx", null);
|
package/separator/index.d.ts
CHANGED
package/separator/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/sidebar/index.d.ts
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
export { DuiSidebarProvider, openChangeEvent };
|
|
1
|
+
export { DuiSidebarProvider, openChangeEvent } from "./sidebar-provider.js";
|
|
3
2
|
export type { SidebarOpenChangeDetail } from "./sidebar-provider.js";
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
import { DuiSidebarGroupLabel } from "./sidebar-group-label.js";
|
|
17
|
-
export { DuiSidebarGroupLabel };
|
|
18
|
-
import { DuiSidebarMenu } from "./sidebar-menu.js";
|
|
19
|
-
export { DuiSidebarMenu };
|
|
20
|
-
import { DuiSidebarMenuItem } from "./sidebar-menu-item.js";
|
|
21
|
-
export { DuiSidebarMenuItem };
|
|
22
|
-
import { DuiSidebarMenuButton } from "./sidebar-menu-button.js";
|
|
23
|
-
export { DuiSidebarMenuButton };
|
|
24
|
-
import { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
25
|
-
export { DuiSidebarSeparator };
|
|
26
|
-
import { DuiSidebarInset } from "./sidebar-inset.js";
|
|
27
|
-
export { DuiSidebarInset };
|
|
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 { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
14
|
+
export { DuiSidebarInset } from "./sidebar-inset.js";
|
|
28
15
|
export type { SidebarContext } from "./sidebar-context.js";
|
|
29
|
-
export declare const sidebarFamily: (typeof DuiSidebarProvider | typeof DuiSidebar | typeof DuiSidebarTrigger | typeof DuiSidebarContent | typeof DuiSidebarHeader | typeof DuiSidebarFooter | typeof DuiSidebarGroup | typeof DuiSidebarGroupLabel | typeof DuiSidebarMenu | typeof DuiSidebarMenuItem | typeof DuiSidebarMenuButton | typeof DuiSidebarSeparator | typeof DuiSidebarInset)[];
|
package/sidebar/index.js
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
export { DuiSidebarGroup };
|
|
15
|
-
import { DuiSidebarGroupLabel } from "./sidebar-group-label.js";
|
|
16
|
-
export { DuiSidebarGroupLabel };
|
|
17
|
-
import { DuiSidebarMenu } from "./sidebar-menu.js";
|
|
18
|
-
export { DuiSidebarMenu };
|
|
19
|
-
import { DuiSidebarMenuItem } from "./sidebar-menu-item.js";
|
|
20
|
-
export { DuiSidebarMenuItem };
|
|
21
|
-
import { DuiSidebarMenuButton } from "./sidebar-menu-button.js";
|
|
22
|
-
export { DuiSidebarMenuButton };
|
|
23
|
-
import { DuiSidebarSeparator } from "./sidebar-separator.js";
|
|
24
|
-
export { DuiSidebarSeparator };
|
|
25
|
-
import { DuiSidebarInset } from "./sidebar-inset.js";
|
|
26
|
-
export { DuiSidebarInset };
|
|
27
|
-
export const sidebarFamily = [
|
|
28
|
-
DuiSidebarProvider, DuiSidebar, DuiSidebarTrigger, DuiSidebarContent,
|
|
29
|
-
DuiSidebarHeader, DuiSidebarFooter, DuiSidebarGroup, DuiSidebarGroupLabel,
|
|
30
|
-
DuiSidebarMenu, DuiSidebarMenuItem, DuiSidebarMenuButton,
|
|
31
|
-
DuiSidebarSeparator, DuiSidebarInset,
|
|
32
|
-
];
|
|
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
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
2
2
|
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
import { type SidebarContext } from "./sidebar-context.js";
|
|
3
4
|
export type SidebarOpenChangeDetail = {
|
|
4
5
|
open: boolean;
|
|
5
6
|
};
|
|
@@ -27,6 +28,7 @@ export declare class DuiSidebarProvider extends LitElement {
|
|
|
27
28
|
accessor variant: string;
|
|
28
29
|
/** How the sidebar collapses. */
|
|
29
30
|
accessor collapsible: "offcanvas" | "icon" | "none";
|
|
31
|
+
accessor _ctx: SidebarContext;
|
|
30
32
|
connectedCallback(): void;
|
|
31
33
|
disconnectedCallback(): void;
|
|
32
34
|
willUpdate(): void;
|
|
@@ -6,9 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
import { css, html, LitElement } from "lit";
|
|
9
|
-
import { property } from "lit/decorators.js";
|
|
9
|
+
import { property, state } from "lit/decorators.js";
|
|
10
|
+
import { provide } from "@lit/context";
|
|
10
11
|
import { base } from "@deepfuture/dui-core/base";
|
|
11
12
|
import { customEvent } from "@deepfuture/dui-core/event";
|
|
13
|
+
import { sidebarContext } from "./sidebar-context.js";
|
|
12
14
|
export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
|
|
13
15
|
const styles = css `
|
|
14
16
|
:host {
|
|
@@ -95,9 +97,9 @@ export class DuiSidebarProvider extends LitElement {
|
|
|
95
97
|
this.#toggleSidebar();
|
|
96
98
|
}
|
|
97
99
|
};
|
|
98
|
-
#
|
|
99
|
-
get
|
|
100
|
-
set
|
|
100
|
+
#_ctx_accessor_storage = this.#buildContext();
|
|
101
|
+
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
102
|
+
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
101
103
|
#buildContext() {
|
|
102
104
|
return {
|
|
103
105
|
state: this.#isOpen ? "expanded" : "collapsed",
|
|
@@ -122,7 +124,7 @@ export class DuiSidebarProvider extends LitElement {
|
|
|
122
124
|
this.#mediaQuery.addEventListener("change", this.#boundOnMediaChange);
|
|
123
125
|
this.#boundOnKeyDown = this.#onKeyDown.bind(this);
|
|
124
126
|
document.addEventListener("keydown", this.#boundOnKeyDown);
|
|
125
|
-
this
|
|
127
|
+
this._ctx = this.#buildContext();
|
|
126
128
|
}
|
|
127
129
|
disconnectedCallback() {
|
|
128
130
|
super.disconnectedCallback();
|
|
@@ -134,7 +136,7 @@ export class DuiSidebarProvider extends LitElement {
|
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
willUpdate() {
|
|
137
|
-
this
|
|
139
|
+
this._ctx = this.#buildContext();
|
|
138
140
|
}
|
|
139
141
|
render() {
|
|
140
142
|
return html `<slot></slot>`;
|
|
@@ -155,3 +157,7 @@ __decorate([
|
|
|
155
157
|
__decorate([
|
|
156
158
|
property({ reflect: true })
|
|
157
159
|
], DuiSidebarProvider.prototype, "collapsible", null);
|
|
160
|
+
__decorate([
|
|
161
|
+
provide({ context: sidebarContext }),
|
|
162
|
+
state()
|
|
163
|
+
], DuiSidebarProvider.prototype, "_ctx", null);
|
package/slider/index.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { DuiSlider, valueChangeEvent, valueCommittedEvent };
|
|
3
|
-
export declare const sliderFamily: (typeof DuiSlider)[];
|
|
1
|
+
export { DuiSlider, valueChangeEvent, valueCommittedEvent } from "./slider.js";
|
package/slider/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/spinner/index.d.ts
CHANGED
package/spinner/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/switch/index.d.ts
CHANGED
package/switch/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/switch/switch.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
import { type FieldContext } from "../field/field-context.js";
|
|
2
3
|
export declare const checkedChangeEvent: (detail: {
|
|
3
4
|
checked: boolean;
|
|
4
5
|
}) => CustomEvent<{
|
|
@@ -23,6 +24,7 @@ export declare class DuiSwitch extends LitElement {
|
|
|
23
24
|
accessor name: string | undefined;
|
|
24
25
|
accessor value: string;
|
|
25
26
|
accessor uncheckedValue: string;
|
|
27
|
+
accessor _fieldCtx: FieldContext;
|
|
26
28
|
connectedCallback(): void;
|
|
27
29
|
disconnectedCallback(): void;
|
|
28
30
|
render(): TemplateResult;
|
package/switch/switch.js
CHANGED
|
@@ -5,9 +5,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { css, html, LitElement, nothing } from "lit";
|
|
8
|
-
import { property } from "lit/decorators.js";
|
|
8
|
+
import { property, state } from "lit/decorators.js";
|
|
9
|
+
import { consume } from "@lit/context";
|
|
9
10
|
import { base } from "@deepfuture/dui-core/base";
|
|
10
11
|
import { customEvent } from "@deepfuture/dui-core/event";
|
|
12
|
+
import { fieldContext } from "../field/field-context.js";
|
|
11
13
|
export const checkedChangeEvent = customEvent("checked-change", { bubbles: true, composed: true });
|
|
12
14
|
/** Structural styles only — layout and behavioral CSS. */
|
|
13
15
|
const styles = css `
|
|
@@ -89,17 +91,17 @@ export class DuiSwitch extends LitElement {
|
|
|
89
91
|
#internalChecked_accessor_storage = false;
|
|
90
92
|
get #internalChecked() { return this.#internalChecked_accessor_storage; }
|
|
91
93
|
set #internalChecked(value) { this.#internalChecked_accessor_storage = value; }
|
|
92
|
-
#
|
|
93
|
-
get
|
|
94
|
-
set
|
|
94
|
+
#_fieldCtx_accessor_storage;
|
|
95
|
+
get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
|
|
96
|
+
set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
|
|
95
97
|
get #isChecked() {
|
|
96
98
|
return this.checked ?? this.#internalChecked;
|
|
97
99
|
}
|
|
98
100
|
get #isDisabled() {
|
|
99
|
-
return this.disabled || (this
|
|
101
|
+
return this.disabled || (this._fieldCtx?.disabled ?? false);
|
|
100
102
|
}
|
|
101
103
|
get #isInvalid() {
|
|
102
|
-
return this
|
|
104
|
+
return this._fieldCtx?.invalid ?? false;
|
|
103
105
|
}
|
|
104
106
|
connectedCallback() {
|
|
105
107
|
super.connectedCallback();
|
|
@@ -122,8 +124,8 @@ export class DuiSwitch extends LitElement {
|
|
|
122
124
|
if (this.checked === undefined) {
|
|
123
125
|
this.#internalChecked = newChecked;
|
|
124
126
|
}
|
|
125
|
-
this
|
|
126
|
-
this
|
|
127
|
+
this._fieldCtx?.markDirty();
|
|
128
|
+
this._fieldCtx?.markTouched();
|
|
127
129
|
this.dispatchEvent(checkedChangeEvent({ checked: newChecked }));
|
|
128
130
|
};
|
|
129
131
|
#handleKeyDown = (e) => {
|
|
@@ -136,7 +138,7 @@ export class DuiSwitch extends LitElement {
|
|
|
136
138
|
const isChecked = this.#isChecked;
|
|
137
139
|
const isDisabled = this.#isDisabled;
|
|
138
140
|
const isInvalid = this.#isInvalid;
|
|
139
|
-
const controlId = this
|
|
141
|
+
const controlId = this._fieldCtx?.controlId ?? "";
|
|
140
142
|
return html `
|
|
141
143
|
<span
|
|
142
144
|
part="root"
|
|
@@ -197,3 +199,7 @@ __decorate([
|
|
|
197
199
|
__decorate([
|
|
198
200
|
property({ attribute: "unchecked-value" })
|
|
199
201
|
], DuiSwitch.prototype, "uncheckedValue", null);
|
|
202
|
+
__decorate([
|
|
203
|
+
consume({ context: fieldContext, subscribe: true }),
|
|
204
|
+
state()
|
|
205
|
+
], DuiSwitch.prototype, "_fieldCtx", null);
|