@deepfuture/dui-components 0.0.12 → 0.0.13
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/center.js +2 -2
- package/_deprecated/hstack/hstack.js +79 -33
- package/_deprecated/page-inset/page-inset.js +104 -56
- package/_deprecated/vstack/vstack.js +61 -19
- package/accordion/accordion-item.js +217 -147
- package/accordion/accordion.js +214 -149
- package/alert-dialog/alert-dialog-close.js +2 -2
- package/alert-dialog/alert-dialog-popup.js +230 -166
- package/alert-dialog/alert-dialog-trigger.js +2 -2
- package/alert-dialog/alert-dialog.js +128 -73
- package/avatar/avatar.js +175 -115
- package/badge/badge.js +2 -2
- package/breadcrumb/breadcrumb-ellipsis.js +2 -2
- package/breadcrumb/breadcrumb-item.js +2 -2
- package/breadcrumb/breadcrumb-link.js +2 -2
- package/breadcrumb/breadcrumb-page.js +2 -2
- package/breadcrumb/breadcrumb-separator.js +2 -2
- package/breadcrumb/breadcrumb.js +2 -2
- package/button/button.js +109 -65
- package/calendar/calendar.js +368 -290
- package/checkbox/checkbox-group.js +146 -87
- package/checkbox/checkbox.js +232 -167
- package/collapsible/collapsible.js +210 -132
- package/combobox/combobox.js +318 -252
- package/command/command-empty.js +67 -25
- package/command/command-group.js +87 -47
- package/command/command-input.js +84 -44
- package/command/command-item.js +168 -124
- package/command/command-list.js +60 -18
- package/command/command-separator.js +2 -2
- package/command/command-shortcut.js +2 -2
- package/command/command.js +297 -232
- package/data-table/data-table.js +225 -153
- package/dialog/dialog-close.js +2 -2
- package/dialog/dialog-popup.js +247 -181
- package/dialog/dialog-trigger.js +2 -2
- package/dialog/dialog.js +128 -73
- package/dropzone/dropzone.js +310 -249
- package/icon/icon.js +2 -2
- package/input/input.js +204 -143
- package/link/link.js +62 -24
- package/menu/menu-item.js +66 -24
- package/menu/menu.js +189 -136
- package/menubar/menubar.js +142 -91
- package/number-field/number-field.js +277 -204
- package/package.json +2 -2
- package/popover/popover-close.js +2 -2
- package/popover/popover-popup.js +126 -76
- package/popover/popover-trigger.js +2 -2
- package/popover/popover.js +181 -120
- package/portal/portal.js +128 -86
- package/preview-card/preview-card-popup.js +114 -66
- package/preview-card/preview-card-trigger.js +2 -2
- package/preview-card/preview-card.js +211 -142
- package/progress/progress.js +91 -45
- package/radio/radio-group.js +153 -90
- package/radio/radio.js +137 -94
- package/scroll-area/scroll-area.js +382 -283
- package/select/select.js +260 -203
- package/separator/separator.js +60 -18
- package/sidebar/sidebar-content.js +2 -2
- package/sidebar/sidebar-footer.js +2 -2
- package/sidebar/sidebar-group-label.js +2 -2
- package/sidebar/sidebar-group.js +2 -2
- package/sidebar/sidebar-header.js +2 -2
- package/sidebar/sidebar-inset.js +2 -2
- package/sidebar/sidebar-menu-button.js +118 -74
- package/sidebar/sidebar-menu-item.js +2 -2
- package/sidebar/sidebar-menu.js +2 -2
- package/sidebar/sidebar-provider.js +202 -129
- package/sidebar/sidebar-separator.js +2 -2
- package/sidebar/sidebar-trigger.js +2 -2
- package/sidebar/sidebar.js +150 -85
- package/slider/slider.js +217 -159
- package/spinner/spinner.js +70 -28
- package/switch/switch.js +174 -111
- package/tabs/tab.js +89 -47
- package/tabs/tabs-indicator.js +2 -2
- package/tabs/tabs-list.js +92 -54
- package/tabs/tabs-panel.js +90 -44
- package/tabs/tabs.js +130 -71
- package/textarea/textarea.js +153 -95
- package/toggle/toggle-group.js +184 -125
- package/toggle/toggle.js +131 -76
- package/toolbar/toolbar.js +79 -33
- package/tooltip/tooltip-popup.js +108 -60
- package/tooltip/tooltip-trigger.js +93 -55
- package/tooltip/tooltip.js +225 -154
- package/trunc/trunc.js +78 -34
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/collapsible */
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 });
|
|
7
39
|
};
|
|
8
40
|
import { css, html, LitElement, nothing } from "lit";
|
|
9
|
-
import { property } from "lit/decorators.js";
|
|
41
|
+
import { property, state } from "lit/decorators.js";
|
|
10
42
|
import { base } from "@deepfuture/dui-core/base";
|
|
11
43
|
import { customEvent } from "@deepfuture/dui-core/event";
|
|
12
44
|
export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
|
|
@@ -56,129 +88,185 @@ const chevronSvg = html `<svg
|
|
|
56
88
|
>
|
|
57
89
|
<path d="m6 9 6 6 6-6" />
|
|
58
90
|
</svg>`;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
let DuiCollapsible = (() => {
|
|
92
|
+
let _classSuper = LitElement;
|
|
93
|
+
let _open_decorators;
|
|
94
|
+
let _open_initializers = [];
|
|
95
|
+
let _open_extraInitializers = [];
|
|
96
|
+
let _defaultOpen_decorators;
|
|
97
|
+
let _defaultOpen_initializers = [];
|
|
98
|
+
let _defaultOpen_extraInitializers = [];
|
|
99
|
+
let _disabled_decorators;
|
|
100
|
+
let _disabled_initializers = [];
|
|
101
|
+
let _disabled_extraInitializers = [];
|
|
102
|
+
let _keepMounted_decorators;
|
|
103
|
+
let _keepMounted_initializers = [];
|
|
104
|
+
let _keepMounted_extraInitializers = [];
|
|
105
|
+
let _private_starting_decorators;
|
|
106
|
+
let _private_starting_initializers = [];
|
|
107
|
+
let _private_starting_extraInitializers = [];
|
|
108
|
+
let _private_starting_descriptor;
|
|
109
|
+
let _private_ending_decorators;
|
|
110
|
+
let _private_ending_initializers = [];
|
|
111
|
+
let _private_ending_extraInitializers = [];
|
|
112
|
+
let _private_ending_descriptor;
|
|
113
|
+
let _private_panelHeight_decorators;
|
|
114
|
+
let _private_panelHeight_initializers = [];
|
|
115
|
+
let _private_panelHeight_extraInitializers = [];
|
|
116
|
+
let _private_panelHeight_descriptor;
|
|
117
|
+
let _private_visible_decorators;
|
|
118
|
+
let _private_visible_initializers = [];
|
|
119
|
+
let _private_visible_extraInitializers = [];
|
|
120
|
+
let _private_visible_descriptor;
|
|
121
|
+
let _private_internalOpen_decorators;
|
|
122
|
+
let _private_internalOpen_initializers = [];
|
|
123
|
+
let _private_internalOpen_extraInitializers = [];
|
|
124
|
+
let _private_internalOpen_descriptor;
|
|
125
|
+
return class DuiCollapsible extends _classSuper {
|
|
126
|
+
static {
|
|
127
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
128
|
+
_open_decorators = [property({ type: Boolean, reflect: true })];
|
|
129
|
+
_defaultOpen_decorators = [property({ type: Boolean, attribute: "default-open" })];
|
|
130
|
+
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
131
|
+
_keepMounted_decorators = [property({ type: Boolean, attribute: "keep-mounted" })];
|
|
132
|
+
_private_starting_decorators = [state()];
|
|
133
|
+
_private_ending_decorators = [state()];
|
|
134
|
+
_private_panelHeight_decorators = [state()];
|
|
135
|
+
_private_visible_decorators = [state()];
|
|
136
|
+
_private_internalOpen_decorators = [state()];
|
|
137
|
+
__esDecorate(this, null, _open_decorators, { kind: "accessor", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
|
|
138
|
+
__esDecorate(this, null, _defaultOpen_decorators, { kind: "accessor", name: "defaultOpen", static: false, private: false, access: { has: obj => "defaultOpen" in obj, get: obj => obj.defaultOpen, set: (obj, value) => { obj.defaultOpen = value; } }, metadata: _metadata }, _defaultOpen_initializers, _defaultOpen_extraInitializers);
|
|
139
|
+
__esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
|
|
140
|
+
__esDecorate(this, null, _keepMounted_decorators, { kind: "accessor", name: "keepMounted", static: false, private: false, access: { has: obj => "keepMounted" in obj, get: obj => obj.keepMounted, set: (obj, value) => { obj.keepMounted = value; } }, metadata: _metadata }, _keepMounted_initializers, _keepMounted_extraInitializers);
|
|
141
|
+
__esDecorate(this, _private_starting_descriptor = { get: __setFunctionName(function () { return this.#starting_accessor_storage; }, "#starting", "get"), set: __setFunctionName(function (value) { this.#starting_accessor_storage = value; }, "#starting", "set") }, _private_starting_decorators, { kind: "accessor", name: "#starting", static: false, private: true, access: { has: obj => #starting in obj, get: obj => obj.#starting, set: (obj, value) => { obj.#starting = value; } }, metadata: _metadata }, _private_starting_initializers, _private_starting_extraInitializers);
|
|
142
|
+
__esDecorate(this, _private_ending_descriptor = { get: __setFunctionName(function () { return this.#ending_accessor_storage; }, "#ending", "get"), set: __setFunctionName(function (value) { this.#ending_accessor_storage = value; }, "#ending", "set") }, _private_ending_decorators, { kind: "accessor", name: "#ending", static: false, private: true, access: { has: obj => #ending in obj, get: obj => obj.#ending, set: (obj, value) => { obj.#ending = value; } }, metadata: _metadata }, _private_ending_initializers, _private_ending_extraInitializers);
|
|
143
|
+
__esDecorate(this, _private_panelHeight_descriptor = { get: __setFunctionName(function () { return this.#panelHeight_accessor_storage; }, "#panelHeight", "get"), set: __setFunctionName(function (value) { this.#panelHeight_accessor_storage = value; }, "#panelHeight", "set") }, _private_panelHeight_decorators, { kind: "accessor", name: "#panelHeight", static: false, private: true, access: { has: obj => #panelHeight in obj, get: obj => obj.#panelHeight, set: (obj, value) => { obj.#panelHeight = value; } }, metadata: _metadata }, _private_panelHeight_initializers, _private_panelHeight_extraInitializers);
|
|
144
|
+
__esDecorate(this, _private_visible_descriptor = { get: __setFunctionName(function () { return this.#visible_accessor_storage; }, "#visible", "get"), set: __setFunctionName(function (value) { this.#visible_accessor_storage = value; }, "#visible", "set") }, _private_visible_decorators, { kind: "accessor", name: "#visible", static: false, private: true, access: { has: obj => #visible in obj, get: obj => obj.#visible, set: (obj, value) => { obj.#visible = value; } }, metadata: _metadata }, _private_visible_initializers, _private_visible_extraInitializers);
|
|
145
|
+
__esDecorate(this, _private_internalOpen_descriptor = { get: __setFunctionName(function () { return this.#internalOpen_accessor_storage; }, "#internalOpen", "get"), set: __setFunctionName(function (value) { this.#internalOpen_accessor_storage = value; }, "#internalOpen", "set") }, _private_internalOpen_decorators, { kind: "accessor", name: "#internalOpen", static: false, private: true, access: { has: obj => #internalOpen in obj, get: obj => obj.#internalOpen, set: (obj, value) => { obj.#internalOpen = value; } }, metadata: _metadata }, _private_internalOpen_initializers, _private_internalOpen_extraInitializers);
|
|
146
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
104
147
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
148
|
+
static tagName = "dui-collapsible";
|
|
149
|
+
static styles = [base, styles];
|
|
150
|
+
#open_accessor_storage = __runInitializers(this, _open_initializers, false);
|
|
151
|
+
/** Controlled open state. When set, the component is fully controlled. */
|
|
152
|
+
get open() { return this.#open_accessor_storage; }
|
|
153
|
+
set open(value) { this.#open_accessor_storage = value; }
|
|
154
|
+
#defaultOpen_accessor_storage = (__runInitializers(this, _open_extraInitializers), __runInitializers(this, _defaultOpen_initializers, false));
|
|
155
|
+
/** Uncontrolled initial open state. Only used on first render. */
|
|
156
|
+
get defaultOpen() { return this.#defaultOpen_accessor_storage; }
|
|
157
|
+
set defaultOpen(value) { this.#defaultOpen_accessor_storage = value; }
|
|
158
|
+
#disabled_accessor_storage = (__runInitializers(this, _defaultOpen_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
159
|
+
get disabled() { return this.#disabled_accessor_storage; }
|
|
160
|
+
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
161
|
+
#keepMounted_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _keepMounted_initializers, false));
|
|
162
|
+
/** Keep panel content mounted when closed. */
|
|
163
|
+
get keepMounted() { return this.#keepMounted_accessor_storage; }
|
|
164
|
+
set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
|
|
165
|
+
#starting_accessor_storage = (__runInitializers(this, _keepMounted_extraInitializers), __runInitializers(this, _private_starting_initializers, false));
|
|
166
|
+
get #starting() { return _private_starting_descriptor.get.call(this); }
|
|
167
|
+
set #starting(value) { return _private_starting_descriptor.set.call(this, value); }
|
|
168
|
+
#ending_accessor_storage = (__runInitializers(this, _private_starting_extraInitializers), __runInitializers(this, _private_ending_initializers, false));
|
|
169
|
+
get #ending() { return _private_ending_descriptor.get.call(this); }
|
|
170
|
+
set #ending(value) { return _private_ending_descriptor.set.call(this, value); }
|
|
171
|
+
#panelHeight_accessor_storage = (__runInitializers(this, _private_ending_extraInitializers), __runInitializers(this, _private_panelHeight_initializers, "0"));
|
|
172
|
+
get #panelHeight() { return _private_panelHeight_descriptor.get.call(this); }
|
|
173
|
+
set #panelHeight(value) { return _private_panelHeight_descriptor.set.call(this, value); }
|
|
174
|
+
#visible_accessor_storage = (__runInitializers(this, _private_panelHeight_extraInitializers), __runInitializers(this, _private_visible_initializers, false));
|
|
175
|
+
get #visible() { return _private_visible_descriptor.get.call(this); }
|
|
176
|
+
set #visible(value) { return _private_visible_descriptor.set.call(this, value); }
|
|
177
|
+
#internalOpen_accessor_storage = (__runInitializers(this, _private_visible_extraInitializers), __runInitializers(this, _private_internalOpen_initializers, false));
|
|
178
|
+
get #internalOpen() { return _private_internalOpen_descriptor.get.call(this); }
|
|
179
|
+
set #internalOpen(value) { return _private_internalOpen_descriptor.set.call(this, value); }
|
|
180
|
+
#prevOpen = (__runInitializers(this, _private_internalOpen_extraInitializers), undefined);
|
|
181
|
+
#animGen = 0;
|
|
182
|
+
#controlled = false;
|
|
183
|
+
get #isOpen() {
|
|
184
|
+
return this.#controlled ? this.open : this.#internalOpen;
|
|
110
185
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.#
|
|
186
|
+
connectedCallback() {
|
|
187
|
+
super.connectedCallback();
|
|
188
|
+
// Check if `open` attribute was explicitly set (controlled mode)
|
|
189
|
+
this.#controlled = this.hasAttribute("open");
|
|
190
|
+
if (!this.#controlled && this.defaultOpen) {
|
|
191
|
+
this.#internalOpen = true;
|
|
192
|
+
}
|
|
115
193
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
194
|
+
willUpdate(changed) {
|
|
195
|
+
// If `open` property is set after initial render, switch to controlled mode
|
|
196
|
+
if (changed.has("open") && this.#prevOpen !== undefined) {
|
|
197
|
+
this.#controlled = true;
|
|
198
|
+
}
|
|
199
|
+
const isOpen = this.#isOpen;
|
|
200
|
+
if (this.#prevOpen === undefined) {
|
|
201
|
+
this.#visible = isOpen;
|
|
202
|
+
this.#panelHeight = isOpen ? "auto" : "0";
|
|
119
203
|
}
|
|
120
|
-
else {
|
|
121
|
-
|
|
204
|
+
else if (this.#prevOpen !== isOpen) {
|
|
205
|
+
if (isOpen) {
|
|
206
|
+
this.#startOpenAnimation();
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this.#startCloseAnimation();
|
|
210
|
+
}
|
|
122
211
|
}
|
|
212
|
+
this.#prevOpen = isOpen;
|
|
123
213
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
214
|
+
#startOpenAnimation() {
|
|
215
|
+
const gen = ++this.#animGen;
|
|
216
|
+
this.#ending = false;
|
|
217
|
+
this.#visible = true;
|
|
218
|
+
this.#starting = true;
|
|
219
|
+
this.#panelHeight = "0";
|
|
220
|
+
requestAnimationFrame(() => {
|
|
221
|
+
if (this.#animGen !== gen)
|
|
222
|
+
return;
|
|
223
|
+
const panel = this.shadowRoot?.querySelector("[part='panel']");
|
|
224
|
+
if (panel) {
|
|
225
|
+
this.#panelHeight = `${panel.scrollHeight}px`;
|
|
226
|
+
}
|
|
227
|
+
this.#starting = false;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
#startCloseAnimation() {
|
|
231
|
+
const gen = ++this.#animGen;
|
|
232
|
+
this.#starting = false;
|
|
135
233
|
const panel = this.shadowRoot?.querySelector("[part='panel']");
|
|
136
234
|
if (panel) {
|
|
137
235
|
this.#panelHeight = `${panel.scrollHeight}px`;
|
|
138
236
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const panel = this.shadowRoot?.querySelector("[part='panel']");
|
|
146
|
-
if (panel) {
|
|
147
|
-
this.#panelHeight = `${panel.scrollHeight}px`;
|
|
237
|
+
requestAnimationFrame(() => {
|
|
238
|
+
if (this.#animGen !== gen)
|
|
239
|
+
return;
|
|
240
|
+
this.#ending = true;
|
|
241
|
+
this.#panelHeight = "0";
|
|
242
|
+
});
|
|
148
243
|
}
|
|
149
|
-
|
|
150
|
-
if (
|
|
244
|
+
#onTransitionEnd = (event) => {
|
|
245
|
+
if (event.propertyName !== "height")
|
|
151
246
|
return;
|
|
152
|
-
this.#ending
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (event.propertyName !== "height")
|
|
158
|
-
return;
|
|
159
|
-
if (this.#ending) {
|
|
160
|
-
this.#ending = false;
|
|
161
|
-
if (!this.keepMounted) {
|
|
162
|
-
this.#visible = false;
|
|
247
|
+
if (this.#ending) {
|
|
248
|
+
this.#ending = false;
|
|
249
|
+
if (!this.keepMounted) {
|
|
250
|
+
this.#visible = false;
|
|
251
|
+
}
|
|
163
252
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return html `
|
|
253
|
+
else if (this.#isOpen) {
|
|
254
|
+
this.#panelHeight = "auto";
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
#onClick = () => {
|
|
258
|
+
if (this.disabled)
|
|
259
|
+
return;
|
|
260
|
+
const nextOpen = !this.#isOpen;
|
|
261
|
+
if (!this.#controlled) {
|
|
262
|
+
this.#internalOpen = nextOpen;
|
|
263
|
+
}
|
|
264
|
+
this.dispatchEvent(openChangeEvent({ open: nextOpen }));
|
|
265
|
+
};
|
|
266
|
+
render() {
|
|
267
|
+
const isOpen = this.#isOpen;
|
|
268
|
+
const shouldRender = this.#visible || this.keepMounted;
|
|
269
|
+
return html `
|
|
182
270
|
<button
|
|
183
271
|
part="trigger"
|
|
184
272
|
aria-expanded=${isOpen}
|
|
@@ -191,7 +279,7 @@ export class DuiCollapsible extends LitElement {
|
|
|
191
279
|
${chevronSvg}
|
|
192
280
|
</button>
|
|
193
281
|
${shouldRender
|
|
194
|
-
|
|
282
|
+
? html `
|
|
195
283
|
<div
|
|
196
284
|
part="panel"
|
|
197
285
|
role="region"
|
|
@@ -207,19 +295,9 @@ export class DuiCollapsible extends LitElement {
|
|
|
207
295
|
</div>
|
|
208
296
|
</div>
|
|
209
297
|
`
|
|
210
|
-
|
|
298
|
+
: nothing}
|
|
211
299
|
`;
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
], DuiCollapsible.prototype, "open", null);
|
|
217
|
-
__decorate([
|
|
218
|
-
property({ type: Boolean, attribute: "default-open" })
|
|
219
|
-
], DuiCollapsible.prototype, "defaultOpen", null);
|
|
220
|
-
__decorate([
|
|
221
|
-
property({ type: Boolean, reflect: true })
|
|
222
|
-
], DuiCollapsible.prototype, "disabled", null);
|
|
223
|
-
__decorate([
|
|
224
|
-
property({ type: Boolean, attribute: "keep-mounted" })
|
|
225
|
-
], DuiCollapsible.prototype, "keepMounted", null);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
})();
|
|
303
|
+
export { DuiCollapsible };
|