@deepfuture/dui-components 0.0.19 → 0.0.21
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/all.d.ts +6 -2
- package/all.js +12 -4
- package/card/card.d.ts +29 -0
- package/card/card.js +179 -0
- package/card/index.d.ts +3 -0
- package/card/index.js +3 -0
- package/checkbox/checkbox.d.ts +3 -2
- package/checkbox/checkbox.js +21 -46
- package/combobox/combobox.d.ts +3 -0
- package/combobox/combobox.js +21 -10
- package/data-table/data-table.js +4 -4
- package/dropzone/dropzone.js +1 -0
- package/field/field.d.ts +32 -0
- package/field/field.js +363 -0
- package/field/index.d.ts +1 -2
- package/field/index.js +1 -1
- package/fieldset/fieldset.d.ts +20 -0
- package/fieldset/fieldset.js +116 -0
- package/fieldset/index.d.ts +1 -0
- package/fieldset/index.js +1 -0
- package/global.d.ts +0 -2
- package/input/input.d.ts +4 -2
- package/input/input.js +27 -52
- package/menu/menu.d.ts +2 -0
- package/menu/menu.js +13 -3
- package/number-field/number-field.d.ts +2 -2
- package/number-field/number-field.js +13 -49
- package/package.json +10 -6
- package/preview-card/preview-card-popup.js +1 -0
- package/radio/radio.d.ts +3 -2
- package/radio/radio.js +22 -44
- package/scroll-area/scroll-area.d.ts +1 -1
- package/scroll-area/scroll-area.js +5 -16
- package/select/select.d.ts +5 -2
- package/select/select.js +38 -34
- package/separator/separator.js +1 -0
- package/slider/slider.d.ts +3 -0
- package/slider/slider.js +12 -5
- package/split-button/split-button.d.ts +2 -0
- package/split-button/split-button.js +11 -1
- package/stepper/stepper.d.ts +0 -2
- package/stepper/stepper.js +7 -38
- package/switch/switch.d.ts +3 -2
- package/switch/switch.js +16 -41
- package/textarea/textarea.d.ts +4 -0
- package/textarea/textarea.js +20 -0
- package/field/field-context.d.ts +0 -20
- package/field/field-context.js +0 -2
- package/link/index.d.ts +0 -3
- package/link/index.js +0 -3
- package/link/link.d.ts +0 -27
- package/link/link.js +0 -95
package/all.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ import { DuiButton } from "./button/index.js";
|
|
|
29
29
|
export { DuiButton };
|
|
30
30
|
import { DuiCalendar } from "./calendar/index.js";
|
|
31
31
|
export { DuiCalendar };
|
|
32
|
+
import { DuiCard } from "./card/index.js";
|
|
33
|
+
export { DuiCard };
|
|
32
34
|
import { DuiCheckbox, DuiCheckboxGroup } from "./checkbox/index.js";
|
|
33
35
|
export { DuiCheckbox, DuiCheckboxGroup };
|
|
34
36
|
export type { CheckboxGroupContext } from "./checkbox/index.js";
|
|
@@ -48,13 +50,15 @@ export { DuiDialog, DuiDialogTrigger, DuiDialogPopup, DuiDialogClose, };
|
|
|
48
50
|
export type { DialogOpenChangeDetail, DialogContext } from "./dialog/index.js";
|
|
49
51
|
import { DuiDropzone } from "./dropzone/index.js";
|
|
50
52
|
export { DuiDropzone };
|
|
53
|
+
import { DuiField } from "./field/index.js";
|
|
54
|
+
export { DuiField };
|
|
55
|
+
import { DuiFieldset } from "./fieldset/index.js";
|
|
56
|
+
export { DuiFieldset };
|
|
51
57
|
export type { DropzoneErrorCode, DropzoneRejectionCode, FileRejectionError, RejectedFile, DropzoneDropDetail, DropzoneAcceptedDetail, DropzoneRejectedDetail, DropzoneErrorDetail, } from "./dropzone/index.js";
|
|
52
58
|
import { DuiIcon } from "./icon/index.js";
|
|
53
59
|
export { DuiIcon };
|
|
54
60
|
import { DuiInput } from "./input/index.js";
|
|
55
61
|
export { DuiInput };
|
|
56
|
-
import { DuiLink } from "./link/index.js";
|
|
57
|
-
export { DuiLink };
|
|
58
62
|
import { DuiMenu, DuiMenuItem } from "./menu/index.js";
|
|
59
63
|
export { DuiMenu, DuiMenuItem };
|
|
60
64
|
import { DuiMenubar } from "./menubar/index.js";
|
package/all.js
CHANGED
|
@@ -32,6 +32,9 @@ export { DuiButton };
|
|
|
32
32
|
// --- Calendar ---
|
|
33
33
|
import { DuiCalendar } from "./calendar/index.js";
|
|
34
34
|
export { DuiCalendar };
|
|
35
|
+
// --- Card ---
|
|
36
|
+
import { DuiCard } from "./card/index.js";
|
|
37
|
+
export { DuiCard };
|
|
35
38
|
// --- Checkbox ---
|
|
36
39
|
import { DuiCheckbox, DuiCheckboxGroup } from "./checkbox/index.js";
|
|
37
40
|
export { DuiCheckbox, DuiCheckboxGroup };
|
|
@@ -53,15 +56,18 @@ export { DuiDialog, DuiDialogTrigger, DuiDialogPopup, DuiDialogClose, };
|
|
|
53
56
|
// --- Dropzone ---
|
|
54
57
|
import { DuiDropzone } from "./dropzone/index.js";
|
|
55
58
|
export { DuiDropzone };
|
|
59
|
+
// --- Field ---
|
|
60
|
+
import { DuiField } from "./field/index.js";
|
|
61
|
+
export { DuiField };
|
|
62
|
+
// --- Fieldset ---
|
|
63
|
+
import { DuiFieldset } from "./fieldset/index.js";
|
|
64
|
+
export { DuiFieldset };
|
|
56
65
|
// --- Icon ---
|
|
57
66
|
import { DuiIcon } from "./icon/index.js";
|
|
58
67
|
export { DuiIcon };
|
|
59
68
|
// --- Input ---
|
|
60
69
|
import { DuiInput } from "./input/index.js";
|
|
61
70
|
export { DuiInput };
|
|
62
|
-
// --- Link ---
|
|
63
|
-
import { DuiLink } from "./link/index.js";
|
|
64
|
-
export { DuiLink };
|
|
65
71
|
// --- Menu ---
|
|
66
72
|
import { DuiMenu, DuiMenuItem } from "./menu/index.js";
|
|
67
73
|
export { DuiMenu, DuiMenuItem };
|
|
@@ -152,6 +158,7 @@ export const allComponents = [
|
|
|
152
158
|
DuiBreadcrumbEllipsis,
|
|
153
159
|
DuiButton,
|
|
154
160
|
DuiCalendar,
|
|
161
|
+
DuiCard,
|
|
155
162
|
DuiCheckbox,
|
|
156
163
|
DuiCheckboxGroup,
|
|
157
164
|
DuiCollapsible,
|
|
@@ -170,9 +177,10 @@ export const allComponents = [
|
|
|
170
177
|
DuiDialogPopup,
|
|
171
178
|
DuiDialogClose,
|
|
172
179
|
DuiDropzone,
|
|
180
|
+
DuiField,
|
|
181
|
+
DuiFieldset,
|
|
173
182
|
DuiIcon,
|
|
174
183
|
DuiInput,
|
|
175
|
-
DuiLink,
|
|
176
184
|
DuiMenu,
|
|
177
185
|
DuiMenuItem,
|
|
178
186
|
DuiMenubar,
|
package/card/card.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Ported from ShadCN/ui: https://ui.shadcn.com/docs/components/card */
|
|
2
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-card>` — A container for grouped content with header, body,
|
|
5
|
+
* and footer sections.
|
|
6
|
+
*
|
|
7
|
+
* Uses flex-column + gap for vertical rhythm. The card owns all internal
|
|
8
|
+
* spacing; consumers slot content into named regions.
|
|
9
|
+
*
|
|
10
|
+
* @slot - Main card content (body).
|
|
11
|
+
* @slot title - Card heading text.
|
|
12
|
+
* @slot description - Helper text below the title.
|
|
13
|
+
* @slot action - Top-right header action (button, badge, etc.).
|
|
14
|
+
* @slot footer - Footer content (buttons, links, etc.).
|
|
15
|
+
*
|
|
16
|
+
* @csspart root - The outer card container.
|
|
17
|
+
* @csspart header - The header section (title + description + action).
|
|
18
|
+
* @csspart header-text - The vertical stack holding title and description.
|
|
19
|
+
* @csspart content - The wrapper around the default slot.
|
|
20
|
+
* @csspart footer - The footer section.
|
|
21
|
+
*/
|
|
22
|
+
export declare class DuiCard extends LitElement {
|
|
23
|
+
#private;
|
|
24
|
+
static tagName: "dui-card";
|
|
25
|
+
static styles: import("lit").CSSResult[];
|
|
26
|
+
/** Card size — controls internal spacing via `--card-*` tokens. */
|
|
27
|
+
accessor size: string;
|
|
28
|
+
render(): TemplateResult;
|
|
29
|
+
}
|
package/card/card.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/** Ported from ShadCN/ui: https://ui.shadcn.com/docs/components/card */
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
+
};
|
|
40
|
+
import { css, html, LitElement } from "lit";
|
|
41
|
+
import { property, state } from "lit/decorators.js";
|
|
42
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
43
|
+
/** Structural styles only — layout CSS. */
|
|
44
|
+
const styles = css `
|
|
45
|
+
:host {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[part="root"] {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part="header"]:not([hidden]) {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: start;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[part="header-text"] {
|
|
61
|
+
flex: 1;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
[part="action"] {
|
|
68
|
+
height: 0;
|
|
69
|
+
overflow: visible;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: start;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part="footer"]:not([hidden]) {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
/**
|
|
80
|
+
* `<dui-card>` — A container for grouped content with header, body,
|
|
81
|
+
* and footer sections.
|
|
82
|
+
*
|
|
83
|
+
* Uses flex-column + gap for vertical rhythm. The card owns all internal
|
|
84
|
+
* spacing; consumers slot content into named regions.
|
|
85
|
+
*
|
|
86
|
+
* @slot - Main card content (body).
|
|
87
|
+
* @slot title - Card heading text.
|
|
88
|
+
* @slot description - Helper text below the title.
|
|
89
|
+
* @slot action - Top-right header action (button, badge, etc.).
|
|
90
|
+
* @slot footer - Footer content (buttons, links, etc.).
|
|
91
|
+
*
|
|
92
|
+
* @csspart root - The outer card container.
|
|
93
|
+
* @csspart header - The header section (title + description + action).
|
|
94
|
+
* @csspart header-text - The vertical stack holding title and description.
|
|
95
|
+
* @csspart content - The wrapper around the default slot.
|
|
96
|
+
* @csspart footer - The footer section.
|
|
97
|
+
*/
|
|
98
|
+
let DuiCard = (() => {
|
|
99
|
+
let _classSuper = LitElement;
|
|
100
|
+
let _size_decorators;
|
|
101
|
+
let _size_initializers = [];
|
|
102
|
+
let _size_extraInitializers = [];
|
|
103
|
+
let _private_hasHeader_decorators;
|
|
104
|
+
let _private_hasHeader_initializers = [];
|
|
105
|
+
let _private_hasHeader_extraInitializers = [];
|
|
106
|
+
let _private_hasHeader_descriptor;
|
|
107
|
+
let _private_hasFooter_decorators;
|
|
108
|
+
let _private_hasFooter_initializers = [];
|
|
109
|
+
let _private_hasFooter_extraInitializers = [];
|
|
110
|
+
let _private_hasFooter_descriptor;
|
|
111
|
+
return class DuiCard extends _classSuper {
|
|
112
|
+
static {
|
|
113
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
114
|
+
_size_decorators = [property({ reflect: true })];
|
|
115
|
+
_private_hasHeader_decorators = [state()];
|
|
116
|
+
_private_hasFooter_decorators = [state()];
|
|
117
|
+
__esDecorate(this, null, _size_decorators, { kind: "accessor", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
|
|
118
|
+
__esDecorate(this, _private_hasHeader_descriptor = { get: __setFunctionName(function () { return this.#hasHeader_accessor_storage; }, "#hasHeader", "get"), set: __setFunctionName(function (value) { this.#hasHeader_accessor_storage = value; }, "#hasHeader", "set") }, _private_hasHeader_decorators, { kind: "accessor", name: "#hasHeader", static: false, private: true, access: { has: obj => #hasHeader in obj, get: obj => obj.#hasHeader, set: (obj, value) => { obj.#hasHeader = value; } }, metadata: _metadata }, _private_hasHeader_initializers, _private_hasHeader_extraInitializers);
|
|
119
|
+
__esDecorate(this, _private_hasFooter_descriptor = { get: __setFunctionName(function () { return this.#hasFooter_accessor_storage; }, "#hasFooter", "get"), set: __setFunctionName(function (value) { this.#hasFooter_accessor_storage = value; }, "#hasFooter", "set") }, _private_hasFooter_decorators, { kind: "accessor", name: "#hasFooter", static: false, private: true, access: { has: obj => #hasFooter in obj, get: obj => obj.#hasFooter, set: (obj, value) => { obj.#hasFooter = value; } }, metadata: _metadata }, _private_hasFooter_initializers, _private_hasFooter_extraInitializers);
|
|
120
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
121
|
+
}
|
|
122
|
+
static tagName = "dui-card";
|
|
123
|
+
static styles = [base, styles];
|
|
124
|
+
#size_accessor_storage = __runInitializers(this, _size_initializers, "");
|
|
125
|
+
/** Card size — controls internal spacing via `--card-*` tokens. */
|
|
126
|
+
get size() { return this.#size_accessor_storage; }
|
|
127
|
+
set size(value) { this.#size_accessor_storage = value; }
|
|
128
|
+
#hasHeader_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _private_hasHeader_initializers, false));
|
|
129
|
+
get #hasHeader() { return _private_hasHeader_descriptor.get.call(this); }
|
|
130
|
+
set #hasHeader(value) { return _private_hasHeader_descriptor.set.call(this, value); }
|
|
131
|
+
#hasFooter_accessor_storage = (__runInitializers(this, _private_hasHeader_extraInitializers), __runInitializers(this, _private_hasFooter_initializers, false));
|
|
132
|
+
get #hasFooter() { return _private_hasFooter_descriptor.get.call(this); }
|
|
133
|
+
set #hasFooter(value) { return _private_hasFooter_descriptor.set.call(this, value); }
|
|
134
|
+
#titleFilled = (__runInitializers(this, _private_hasFooter_extraInitializers), false);
|
|
135
|
+
#descFilled = false;
|
|
136
|
+
#actionFilled = false;
|
|
137
|
+
#onHeaderSlotChange = (e) => {
|
|
138
|
+
const slot = e.target;
|
|
139
|
+
const filled = slot.assignedElements().length > 0;
|
|
140
|
+
if (slot.name === "title")
|
|
141
|
+
this.#titleFilled = filled;
|
|
142
|
+
else if (slot.name === "description")
|
|
143
|
+
this.#descFilled = filled;
|
|
144
|
+
else if (slot.name === "action")
|
|
145
|
+
this.#actionFilled = filled;
|
|
146
|
+
this.#hasHeader = this.#titleFilled || this.#descFilled ||
|
|
147
|
+
this.#actionFilled;
|
|
148
|
+
};
|
|
149
|
+
#onFooterSlotChange = (e) => {
|
|
150
|
+
const slot = e.target;
|
|
151
|
+
this.#hasFooter = slot.assignedElements().length > 0;
|
|
152
|
+
};
|
|
153
|
+
render() {
|
|
154
|
+
return html `
|
|
155
|
+
<div part="root">
|
|
156
|
+
<div part="header" ?hidden=${!this.#hasHeader}>
|
|
157
|
+
<div part="header-text">
|
|
158
|
+
<slot name="title" @slotchange=${this.#onHeaderSlotChange}></slot>
|
|
159
|
+
<slot
|
|
160
|
+
name="description"
|
|
161
|
+
@slotchange=${this.#onHeaderSlotChange}
|
|
162
|
+
></slot>
|
|
163
|
+
</div>
|
|
164
|
+
<div part="action">
|
|
165
|
+
<slot name="action" @slotchange=${this.#onHeaderSlotChange}></slot>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
<div part="content">
|
|
169
|
+
<slot></slot>
|
|
170
|
+
</div>
|
|
171
|
+
<div part="footer" ?hidden=${!this.#hasFooter}>
|
|
172
|
+
<slot name="footer" @slotchange=${this.#onFooterSlotChange}></slot>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
})();
|
|
179
|
+
export { DuiCard };
|
package/card/index.d.ts
ADDED
package/card/index.js
ADDED
package/checkbox/checkbox.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/checkbox */
|
|
2
2
|
import { LitElement, type TemplateResult } from "lit";
|
|
3
|
-
import { type FieldContext } from "../field/field-context.js";
|
|
4
3
|
export declare const checkedChangeEvent: (detail: {
|
|
5
4
|
checked: boolean;
|
|
6
5
|
indeterminate: boolean;
|
|
@@ -22,7 +21,9 @@ export declare const checkedChangeEvent: (detail: {
|
|
|
22
21
|
export declare class DuiCheckbox extends LitElement {
|
|
23
22
|
#private;
|
|
24
23
|
static tagName: "dui-checkbox";
|
|
24
|
+
static formAssociated: boolean;
|
|
25
25
|
static styles: import("lit").CSSResult[];
|
|
26
|
+
constructor();
|
|
26
27
|
/** Whether the checkbox is checked (controlled). */
|
|
27
28
|
accessor checked: boolean | undefined;
|
|
28
29
|
/** Initial checked state for uncontrolled usage. */
|
|
@@ -41,8 +42,8 @@ export declare class DuiCheckbox extends LitElement {
|
|
|
41
42
|
accessor value: string | undefined;
|
|
42
43
|
/** When true, acts as a parent (select-all) checkbox within a group. */
|
|
43
44
|
accessor parent: boolean;
|
|
44
|
-
accessor _fieldCtx: FieldContext;
|
|
45
45
|
connectedCallback(): void;
|
|
46
|
+
willUpdate(): void;
|
|
46
47
|
disconnectedCallback(): void;
|
|
47
48
|
render(): TemplateResult;
|
|
48
49
|
}
|
package/checkbox/checkbox.js
CHANGED
|
@@ -40,10 +40,8 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
40
40
|
import { css, html, LitElement, nothing } from "lit";
|
|
41
41
|
import { property, state } from "lit/decorators.js";
|
|
42
42
|
import { ContextConsumer } from "@lit/context";
|
|
43
|
-
import { consume } from "@lit/context";
|
|
44
43
|
import { base } from "@deepfuture/dui-core/base";
|
|
45
44
|
import { customEvent } from "@deepfuture/dui-core/event";
|
|
46
|
-
import { fieldContext } from "../field/field-context.js";
|
|
47
45
|
import { checkboxGroupContext } from "./checkbox-group-context.js";
|
|
48
46
|
export const checkedChangeEvent = customEvent("checked-change", { bubbles: true, composed: true });
|
|
49
47
|
/** Structural styles only — layout and behavioral CSS. */
|
|
@@ -71,6 +69,7 @@ const styles = css `
|
|
|
71
69
|
border: none;
|
|
72
70
|
outline: 0;
|
|
73
71
|
cursor: pointer;
|
|
72
|
+
user-select: none;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
[part="root"][data-disabled] {
|
|
@@ -89,14 +88,6 @@ const styles = css `
|
|
|
89
88
|
display: none;
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
.HiddenInput {
|
|
93
|
-
position: absolute;
|
|
94
|
-
pointer-events: none;
|
|
95
|
-
opacity: 0;
|
|
96
|
-
margin: 0;
|
|
97
|
-
width: 0;
|
|
98
|
-
height: 0;
|
|
99
|
-
}
|
|
100
91
|
`;
|
|
101
92
|
const checkIcon = html `
|
|
102
93
|
<svg
|
|
@@ -170,9 +161,6 @@ let DuiCheckbox = (() => {
|
|
|
170
161
|
let _private_internalChecked_initializers = [];
|
|
171
162
|
let _private_internalChecked_extraInitializers = [];
|
|
172
163
|
let _private_internalChecked_descriptor;
|
|
173
|
-
let __fieldCtx_decorators;
|
|
174
|
-
let __fieldCtx_initializers = [];
|
|
175
|
-
let __fieldCtx_extraInitializers = [];
|
|
176
164
|
return class DuiCheckbox extends _classSuper {
|
|
177
165
|
static {
|
|
178
166
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -186,7 +174,6 @@ let DuiCheckbox = (() => {
|
|
|
186
174
|
_value_decorators = [property()];
|
|
187
175
|
_parent_decorators = [property({ type: Boolean })];
|
|
188
176
|
_private_internalChecked_decorators = [state()];
|
|
189
|
-
__fieldCtx_decorators = [consume({ context: fieldContext, subscribe: true }), state()];
|
|
190
177
|
__esDecorate(this, null, _checked_decorators, { kind: "accessor", name: "checked", static: false, private: false, access: { has: obj => "checked" in obj, get: obj => obj.checked, set: (obj, value) => { obj.checked = value; } }, metadata: _metadata }, _checked_initializers, _checked_extraInitializers);
|
|
191
178
|
__esDecorate(this, null, _defaultChecked_decorators, { kind: "accessor", name: "defaultChecked", static: false, private: false, access: { has: obj => "defaultChecked" in obj, get: obj => obj.defaultChecked, set: (obj, value) => { obj.defaultChecked = value; } }, metadata: _metadata }, _defaultChecked_initializers, _defaultChecked_extraInitializers);
|
|
192
179
|
__esDecorate(this, null, _indeterminate_decorators, { kind: "accessor", name: "indeterminate", static: false, private: false, access: { has: obj => "indeterminate" in obj, get: obj => obj.indeterminate, set: (obj, value) => { obj.indeterminate = value; } }, metadata: _metadata }, _indeterminate_initializers, _indeterminate_extraInitializers);
|
|
@@ -197,11 +184,16 @@ let DuiCheckbox = (() => {
|
|
|
197
184
|
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
198
185
|
__esDecorate(this, null, _parent_decorators, { kind: "accessor", name: "parent", static: false, private: false, access: { has: obj => "parent" in obj, get: obj => obj.parent, set: (obj, value) => { obj.parent = value; } }, metadata: _metadata }, _parent_initializers, _parent_extraInitializers);
|
|
199
186
|
__esDecorate(this, _private_internalChecked_descriptor = { get: __setFunctionName(function () { return this.#internalChecked_accessor_storage; }, "#internalChecked", "get"), set: __setFunctionName(function (value) { this.#internalChecked_accessor_storage = value; }, "#internalChecked", "set") }, _private_internalChecked_decorators, { kind: "accessor", name: "#internalChecked", static: false, private: true, access: { has: obj => #internalChecked in obj, get: obj => obj.#internalChecked, set: (obj, value) => { obj.#internalChecked = value; } }, metadata: _metadata }, _private_internalChecked_initializers, _private_internalChecked_extraInitializers);
|
|
200
|
-
__esDecorate(this, null, __fieldCtx_decorators, { kind: "accessor", name: "_fieldCtx", static: false, private: false, access: { has: obj => "_fieldCtx" in obj, get: obj => obj._fieldCtx, set: (obj, value) => { obj._fieldCtx = value; } }, metadata: _metadata }, __fieldCtx_initializers, __fieldCtx_extraInitializers);
|
|
201
187
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
202
188
|
}
|
|
203
189
|
static tagName = "dui-checkbox";
|
|
190
|
+
static formAssociated = true;
|
|
204
191
|
static styles = [base, styles];
|
|
192
|
+
#internals;
|
|
193
|
+
constructor() {
|
|
194
|
+
super();
|
|
195
|
+
this.#internals = this.attachInternals();
|
|
196
|
+
}
|
|
205
197
|
#checked_accessor_storage = __runInitializers(this, _checked_initializers, undefined);
|
|
206
198
|
/** Whether the checkbox is checked (controlled). */
|
|
207
199
|
get checked() { return this.#checked_accessor_storage; }
|
|
@@ -245,9 +237,6 @@ let DuiCheckbox = (() => {
|
|
|
245
237
|
context: checkboxGroupContext,
|
|
246
238
|
subscribe: true,
|
|
247
239
|
}));
|
|
248
|
-
#_fieldCtx_accessor_storage = __runInitializers(this, __fieldCtx_initializers, void 0);
|
|
249
|
-
get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
|
|
250
|
-
set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
|
|
251
240
|
get #isChecked() {
|
|
252
241
|
const ctx = this.#groupCtx.value;
|
|
253
242
|
if (ctx && this.value !== undefined) {
|
|
@@ -269,11 +258,7 @@ let DuiCheckbox = (() => {
|
|
|
269
258
|
}
|
|
270
259
|
get #isDisabled() {
|
|
271
260
|
return (this.disabled ||
|
|
272
|
-
(this.#groupCtx.value?.disabled ?? false)
|
|
273
|
-
(this._fieldCtx?.disabled ?? false));
|
|
274
|
-
}
|
|
275
|
-
get #isInvalid() {
|
|
276
|
-
return this._fieldCtx?.invalid ?? false;
|
|
261
|
+
(this.#groupCtx.value?.disabled ?? false));
|
|
277
262
|
}
|
|
278
263
|
connectedCallback() {
|
|
279
264
|
super.connectedCallback();
|
|
@@ -282,13 +267,24 @@ let DuiCheckbox = (() => {
|
|
|
282
267
|
}
|
|
283
268
|
this.addEventListener("click", this.#handleHostClick);
|
|
284
269
|
}
|
|
270
|
+
willUpdate() {
|
|
271
|
+
this.#syncFormValue();
|
|
272
|
+
}
|
|
273
|
+
#syncFormValue() {
|
|
274
|
+
if (this.#isChecked) {
|
|
275
|
+
this.#internals.setFormValue(this.value ?? "on");
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this.#internals.setFormValue(null);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
285
281
|
disconnectedCallback() {
|
|
286
282
|
super.disconnectedCallback();
|
|
287
283
|
this.removeEventListener("click", this.#handleHostClick);
|
|
288
284
|
}
|
|
289
|
-
#handleHostClick = (
|
|
285
|
+
#handleHostClick = (_e) => {
|
|
290
286
|
this.#handleClick();
|
|
291
|
-
}
|
|
287
|
+
};
|
|
292
288
|
#handleClick = () => {
|
|
293
289
|
if (this.#isDisabled || this.readOnly)
|
|
294
290
|
return;
|
|
@@ -301,8 +297,6 @@ let DuiCheckbox = (() => {
|
|
|
301
297
|
else {
|
|
302
298
|
ctx.toggle(this.value);
|
|
303
299
|
}
|
|
304
|
-
this._fieldCtx?.markDirty();
|
|
305
|
-
this._fieldCtx?.markTouched();
|
|
306
300
|
return;
|
|
307
301
|
}
|
|
308
302
|
// Standalone behavior
|
|
@@ -311,8 +305,6 @@ let DuiCheckbox = (() => {
|
|
|
311
305
|
this.#internalChecked = newChecked;
|
|
312
306
|
this.indeterminate = false;
|
|
313
307
|
}
|
|
314
|
-
this._fieldCtx?.markDirty();
|
|
315
|
-
this._fieldCtx?.markTouched();
|
|
316
308
|
this.dispatchEvent(checkedChangeEvent({
|
|
317
309
|
checked: newChecked,
|
|
318
310
|
indeterminate: false,
|
|
@@ -328,19 +320,15 @@ let DuiCheckbox = (() => {
|
|
|
328
320
|
const isChecked = this.#isChecked;
|
|
329
321
|
const isIndeterminate = this.#isIndeterminate;
|
|
330
322
|
const isDisabled = this.#isDisabled;
|
|
331
|
-
const isInvalid = this.#isInvalid;
|
|
332
323
|
const showIndicator = isChecked || isIndeterminate;
|
|
333
|
-
const controlId = this._fieldCtx?.controlId ?? "";
|
|
334
324
|
return html `
|
|
335
325
|
<span
|
|
336
326
|
part="root"
|
|
337
327
|
role="checkbox"
|
|
338
|
-
id="${controlId || nothing}"
|
|
339
328
|
aria-checked="${isIndeterminate ? "mixed" : String(isChecked)}"
|
|
340
329
|
aria-disabled="${isDisabled ? "true" : nothing}"
|
|
341
330
|
aria-readonly="${this.readOnly ? "true" : nothing}"
|
|
342
331
|
aria-required="${this.required ? "true" : nothing}"
|
|
343
|
-
aria-invalid="${isInvalid ? "true" : nothing}"
|
|
344
332
|
tabindex="${isDisabled ? nothing : "0"}"
|
|
345
333
|
?data-checked="${isChecked && !isIndeterminate}"
|
|
346
334
|
?data-unchecked="${!isChecked && !isIndeterminate}"
|
|
@@ -348,7 +336,6 @@ let DuiCheckbox = (() => {
|
|
|
348
336
|
?data-disabled="${isDisabled}"
|
|
349
337
|
?data-readonly="${this.readOnly}"
|
|
350
338
|
?data-required="${this.required}"
|
|
351
|
-
?data-invalid="${isInvalid}"
|
|
352
339
|
@keydown="${this.#handleKeyDown}"
|
|
353
340
|
>
|
|
354
341
|
<span
|
|
@@ -363,18 +350,6 @@ let DuiCheckbox = (() => {
|
|
|
363
350
|
: checkIcon
|
|
364
351
|
: nothing}
|
|
365
352
|
</span>
|
|
366
|
-
<input
|
|
367
|
-
type="checkbox"
|
|
368
|
-
name="${this.name ?? nothing}"
|
|
369
|
-
value="${this.value ?? nothing}"
|
|
370
|
-
.checked="${isChecked}"
|
|
371
|
-
.indeterminate="${isIndeterminate}"
|
|
372
|
-
?disabled="${isDisabled}"
|
|
373
|
-
?required="${this.required}"
|
|
374
|
-
class="HiddenInput"
|
|
375
|
-
aria-hidden="true"
|
|
376
|
-
tabindex="-1"
|
|
377
|
-
/>
|
|
378
353
|
</span>
|
|
379
354
|
<slot></slot>
|
|
380
355
|
`;
|
package/combobox/combobox.d.ts
CHANGED
|
@@ -27,7 +27,9 @@ export declare const valuesChangeEvent: (detail: ComboboxValuesChangeDetail) =>
|
|
|
27
27
|
export declare class DuiCombobox extends LitElement {
|
|
28
28
|
#private;
|
|
29
29
|
static tagName: "dui-combobox";
|
|
30
|
+
static formAssociated: boolean;
|
|
30
31
|
static styles: import("lit").CSSResult[];
|
|
32
|
+
constructor();
|
|
31
33
|
/** The available options. */
|
|
32
34
|
accessor options: SelectOption[];
|
|
33
35
|
/** Currently selected value (single-select mode). */
|
|
@@ -42,5 +44,6 @@ export declare class DuiCombobox extends LitElement {
|
|
|
42
44
|
accessor disabled: boolean;
|
|
43
45
|
/** Name for form submission. */
|
|
44
46
|
accessor name: string;
|
|
47
|
+
willUpdate(): void;
|
|
45
48
|
render(): TemplateResult;
|
|
46
49
|
}
|
package/combobox/combobox.js
CHANGED
|
@@ -224,7 +224,13 @@ let DuiCombobox = (() => {
|
|
|
224
224
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
225
225
|
}
|
|
226
226
|
static tagName = "dui-combobox";
|
|
227
|
+
static formAssociated = true;
|
|
227
228
|
static styles = [base, hostStyles, componentStyles];
|
|
229
|
+
#internals;
|
|
230
|
+
constructor() {
|
|
231
|
+
super();
|
|
232
|
+
this.#internals = this.attachInternals();
|
|
233
|
+
}
|
|
228
234
|
#options_accessor_storage = __runInitializers(this, _options_initializers, []);
|
|
229
235
|
/** The available options. */
|
|
230
236
|
get options() { return this.#options_accessor_storage; }
|
|
@@ -253,6 +259,21 @@ let DuiCombobox = (() => {
|
|
|
253
259
|
/** Name for form submission. */
|
|
254
260
|
get name() { return this.#name_accessor_storage; }
|
|
255
261
|
set name(value) { this.#name_accessor_storage = value; }
|
|
262
|
+
willUpdate() {
|
|
263
|
+
this.#syncFormValue();
|
|
264
|
+
}
|
|
265
|
+
#syncFormValue() {
|
|
266
|
+
if (this.multiple) {
|
|
267
|
+
const formData = new FormData();
|
|
268
|
+
for (const v of this.values) {
|
|
269
|
+
formData.append(this.name || "values", v);
|
|
270
|
+
}
|
|
271
|
+
this.#internals.setFormValue(formData);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this.#internals.setFormValue(this.value || null);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
256
277
|
#highlightedIndex_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _private_highlightedIndex_initializers, -1));
|
|
257
278
|
get #highlightedIndex() { return _private_highlightedIndex_descriptor.get.call(this); }
|
|
258
279
|
set #highlightedIndex(value) { return _private_highlightedIndex_descriptor.set.call(this, value); }
|
|
@@ -531,11 +552,6 @@ let DuiCombobox = (() => {
|
|
|
531
552
|
${inputHtml}
|
|
532
553
|
<dui-icon class="Arrow"><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>
|
|
533
554
|
</div>
|
|
534
|
-
${this.name
|
|
535
|
-
? repeat(Array.from(this.values), (v) => v, (v) => html `
|
|
536
|
-
<input type="hidden" name="${this.name}" .value="${v}" />
|
|
537
|
-
`)
|
|
538
|
-
: nothing}
|
|
539
555
|
`;
|
|
540
556
|
}
|
|
541
557
|
return html `
|
|
@@ -543,11 +559,6 @@ let DuiCombobox = (() => {
|
|
|
543
559
|
${inputHtml}
|
|
544
560
|
<dui-icon class="Arrow"><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>
|
|
545
561
|
</div>
|
|
546
|
-
${this.name
|
|
547
|
-
? html `
|
|
548
|
-
<input type="hidden" name="${this.name}" .value="${this.value}" />
|
|
549
|
-
`
|
|
550
|
-
: nothing}
|
|
551
562
|
`;
|
|
552
563
|
}
|
|
553
564
|
};
|
package/data-table/data-table.js
CHANGED
|
@@ -433,7 +433,7 @@ let DuiDataTable = (() => {
|
|
|
433
433
|
@click=${() => this.#goToPage(1)}
|
|
434
434
|
aria-label="First page"
|
|
435
435
|
>
|
|
436
|
-
<dui-icon style="--icon-size: var(--
|
|
436
|
+
<dui-icon style="--icon-size: var(--text-sm)"><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="m11 17-5-5 5-5"/><path d="m18 17-5-5 5-5"/></svg></dui-icon>
|
|
437
437
|
</button>
|
|
438
438
|
<button
|
|
439
439
|
class="PageButton"
|
|
@@ -441,7 +441,7 @@ let DuiDataTable = (() => {
|
|
|
441
441
|
@click=${() => this.#goToPage(this.#page - 1)}
|
|
442
442
|
aria-label="Previous page"
|
|
443
443
|
>
|
|
444
|
-
<dui-icon style="--icon-size: var(--
|
|
444
|
+
<dui-icon style="--icon-size: var(--text-sm)"><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="m15 18-6-6 6-6"/></svg></dui-icon>
|
|
445
445
|
</button>
|
|
446
446
|
<button
|
|
447
447
|
class="PageButton"
|
|
@@ -449,7 +449,7 @@ let DuiDataTable = (() => {
|
|
|
449
449
|
@click=${() => this.#goToPage(this.#page + 1)}
|
|
450
450
|
aria-label="Next page"
|
|
451
451
|
>
|
|
452
|
-
<dui-icon style="--icon-size: var(--
|
|
452
|
+
<dui-icon style="--icon-size: var(--text-sm)"><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="m9 18 6-6-6-6"/></svg></dui-icon>
|
|
453
453
|
</button>
|
|
454
454
|
<button
|
|
455
455
|
class="PageButton"
|
|
@@ -457,7 +457,7 @@ let DuiDataTable = (() => {
|
|
|
457
457
|
@click=${() => this.#goToPage(this.#totalPages)}
|
|
458
458
|
aria-label="Last page"
|
|
459
459
|
>
|
|
460
|
-
<dui-icon style="--icon-size: var(--
|
|
460
|
+
<dui-icon style="--icon-size: var(--text-sm)"><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 17 5-5-5-5"/><path d="m13 17 5-5-5-5"/></svg></dui-icon>
|
|
461
461
|
</button>
|
|
462
462
|
</div>
|
|
463
463
|
</div>
|
package/dropzone/dropzone.js
CHANGED
|
@@ -389,6 +389,7 @@ let DuiDropzone = (() => {
|
|
|
389
389
|
part="root"
|
|
390
390
|
tabindex="${this.disabled ? -1 : 0}"
|
|
391
391
|
?data-dragover="${this.#isDragOver}"
|
|
392
|
+
?data-disabled="${this.disabled}"
|
|
392
393
|
@dragenter="${this.#handleDragEnter}"
|
|
393
394
|
@dragover="${this.#handleDragOver}"
|
|
394
395
|
@dragleave="${this.#handleDragLeave}"
|