@deepfuture/dui-components 0.0.12 → 0.0.14
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 -3
- 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
package/sidebar/sidebar.js
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/sidebar */
|
|
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
|
+
};
|
|
2
40
|
import { css, html, LitElement } from "lit";
|
|
41
|
+
import { state } from "lit/decorators.js";
|
|
3
42
|
import { ContextConsumer } from "@lit/context";
|
|
4
43
|
import { base } from "@deepfuture/dui-core/base";
|
|
5
44
|
import { sidebarContext } from "./sidebar-context.js";
|
|
@@ -102,91 +141,115 @@ const styles = css `
|
|
|
102
141
|
* @csspart backdrop - The mobile backdrop overlay.
|
|
103
142
|
* @csspart mobile-panel - The sliding mobile panel.
|
|
104
143
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
let DuiSidebar = (() => {
|
|
145
|
+
let _classSuper = LitElement;
|
|
146
|
+
let _private_mounted_decorators;
|
|
147
|
+
let _private_mounted_initializers = [];
|
|
148
|
+
let _private_mounted_extraInitializers = [];
|
|
149
|
+
let _private_mounted_descriptor;
|
|
150
|
+
let _private_startingStyle_decorators;
|
|
151
|
+
let _private_startingStyle_initializers = [];
|
|
152
|
+
let _private_startingStyle_extraInitializers = [];
|
|
153
|
+
let _private_startingStyle_descriptor;
|
|
154
|
+
let _private_endingStyle_decorators;
|
|
155
|
+
let _private_endingStyle_initializers = [];
|
|
156
|
+
let _private_endingStyle_extraInitializers = [];
|
|
157
|
+
let _private_endingStyle_descriptor;
|
|
158
|
+
return class DuiSidebar extends _classSuper {
|
|
159
|
+
static {
|
|
160
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
161
|
+
_private_mounted_decorators = [state()];
|
|
162
|
+
_private_startingStyle_decorators = [state()];
|
|
163
|
+
_private_endingStyle_decorators = [state()];
|
|
164
|
+
__esDecorate(this, _private_mounted_descriptor = { get: __setFunctionName(function () { return this.#mounted_accessor_storage; }, "#mounted", "get"), set: __setFunctionName(function (value) { this.#mounted_accessor_storage = value; }, "#mounted", "set") }, _private_mounted_decorators, { kind: "accessor", name: "#mounted", static: false, private: true, access: { has: obj => #mounted in obj, get: obj => obj.#mounted, set: (obj, value) => { obj.#mounted = value; } }, metadata: _metadata }, _private_mounted_initializers, _private_mounted_extraInitializers);
|
|
165
|
+
__esDecorate(this, _private_startingStyle_descriptor = { get: __setFunctionName(function () { return this.#startingStyle_accessor_storage; }, "#startingStyle", "get"), set: __setFunctionName(function (value) { this.#startingStyle_accessor_storage = value; }, "#startingStyle", "set") }, _private_startingStyle_decorators, { kind: "accessor", name: "#startingStyle", static: false, private: true, access: { has: obj => #startingStyle in obj, get: obj => obj.#startingStyle, set: (obj, value) => { obj.#startingStyle = value; } }, metadata: _metadata }, _private_startingStyle_initializers, _private_startingStyle_extraInitializers);
|
|
166
|
+
__esDecorate(this, _private_endingStyle_descriptor = { get: __setFunctionName(function () { return this.#endingStyle_accessor_storage; }, "#endingStyle", "get"), set: __setFunctionName(function (value) { this.#endingStyle_accessor_storage = value; }, "#endingStyle", "set") }, _private_endingStyle_decorators, { kind: "accessor", name: "#endingStyle", static: false, private: true, access: { has: obj => #endingStyle in obj, get: obj => obj.#endingStyle, set: (obj, value) => { obj.#endingStyle = value; } }, metadata: _metadata }, _private_endingStyle_initializers, _private_endingStyle_extraInitializers);
|
|
167
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
168
|
+
}
|
|
169
|
+
static tagName = "dui-sidebar";
|
|
170
|
+
static styles = [base, styles];
|
|
171
|
+
#mounted_accessor_storage = __runInitializers(this, _private_mounted_initializers, false);
|
|
172
|
+
get #mounted() { return _private_mounted_descriptor.get.call(this); }
|
|
173
|
+
set #mounted(value) { return _private_mounted_descriptor.set.call(this, value); }
|
|
174
|
+
#startingStyle_accessor_storage = (__runInitializers(this, _private_mounted_extraInitializers), __runInitializers(this, _private_startingStyle_initializers, false));
|
|
175
|
+
get #startingStyle() { return _private_startingStyle_descriptor.get.call(this); }
|
|
176
|
+
set #startingStyle(value) { return _private_startingStyle_descriptor.set.call(this, value); }
|
|
177
|
+
#endingStyle_accessor_storage = (__runInitializers(this, _private_startingStyle_extraInitializers), __runInitializers(this, _private_endingStyle_initializers, false));
|
|
178
|
+
get #endingStyle() { return _private_endingStyle_descriptor.get.call(this); }
|
|
179
|
+
set #endingStyle(value) { return _private_endingStyle_descriptor.set.call(this, value); }
|
|
180
|
+
#ctx = (__runInitializers(this, _private_endingStyle_extraInitializers), new ContextConsumer(this, {
|
|
181
|
+
context: sidebarContext,
|
|
182
|
+
subscribe: true,
|
|
183
|
+
}));
|
|
184
|
+
willUpdate() {
|
|
185
|
+
const ctx = this.#ctx.value;
|
|
186
|
+
if (!ctx)
|
|
187
|
+
return;
|
|
188
|
+
this.dataset.state = ctx.state;
|
|
189
|
+
this.dataset.side = ctx.side;
|
|
190
|
+
this.dataset.variant = ctx.variant;
|
|
191
|
+
this.dataset.collapsible = ctx.collapsible;
|
|
192
|
+
// Handle mobile panel animation
|
|
193
|
+
if (ctx.isMobile) {
|
|
194
|
+
if (ctx.openMobile && !this.#mounted) {
|
|
195
|
+
this.#animateOpen();
|
|
196
|
+
}
|
|
197
|
+
else if (!ctx.openMobile && this.#mounted && !this.#endingStyle) {
|
|
198
|
+
this.#animateClose();
|
|
199
|
+
}
|
|
136
200
|
}
|
|
137
201
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.#startingStyle = false;
|
|
144
|
-
}
|
|
145
|
-
#animateClose() {
|
|
146
|
-
this.#endingStyle = true;
|
|
147
|
-
const panel = this.shadowRoot?.querySelector(".MobilePanel");
|
|
148
|
-
if (!panel) {
|
|
149
|
-
this.#finishClose();
|
|
150
|
-
return;
|
|
202
|
+
async #animateOpen() {
|
|
203
|
+
this.#mounted = true;
|
|
204
|
+
this.#startingStyle = true;
|
|
205
|
+
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
206
|
+
this.#startingStyle = false;
|
|
151
207
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
208
|
+
#animateClose() {
|
|
209
|
+
this.#endingStyle = true;
|
|
210
|
+
const panel = this.shadowRoot?.querySelector(".MobilePanel");
|
|
211
|
+
if (!panel) {
|
|
212
|
+
this.#finishClose();
|
|
155
213
|
return;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
214
|
+
}
|
|
215
|
+
let called = false;
|
|
216
|
+
const done = () => {
|
|
217
|
+
if (called)
|
|
218
|
+
return;
|
|
219
|
+
called = true;
|
|
220
|
+
panel.removeEventListener("transitionend", onEnd);
|
|
221
|
+
clearTimeout(timer);
|
|
222
|
+
this.#finishClose();
|
|
223
|
+
};
|
|
224
|
+
const onEnd = () => {
|
|
225
|
+
done();
|
|
226
|
+
};
|
|
227
|
+
panel.addEventListener("transitionend", onEnd);
|
|
228
|
+
const timer = setTimeout(done, 250);
|
|
229
|
+
}
|
|
230
|
+
#finishClose() {
|
|
231
|
+
this.#endingStyle = false;
|
|
232
|
+
this.#mounted = false;
|
|
233
|
+
}
|
|
234
|
+
#onBackdropClick = () => {
|
|
235
|
+
this.#ctx.value?.setOpen(false);
|
|
160
236
|
};
|
|
161
|
-
|
|
162
|
-
|
|
237
|
+
#onMobileKeyDown = (e) => {
|
|
238
|
+
if (e.key === "Escape") {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
this.#ctx.value?.setOpen(false);
|
|
241
|
+
}
|
|
163
242
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#finishClose() {
|
|
168
|
-
this.#endingStyle = false;
|
|
169
|
-
this.#mounted = false;
|
|
170
|
-
}
|
|
171
|
-
#onBackdropClick = () => {
|
|
172
|
-
this.#ctx.value?.setOpen(false);
|
|
173
|
-
};
|
|
174
|
-
#onMobileKeyDown = (e) => {
|
|
175
|
-
if (e.key === "Escape") {
|
|
176
|
-
e.preventDefault();
|
|
177
|
-
this.#ctx.value?.setOpen(false);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
render() {
|
|
181
|
-
const ctx = this.#ctx.value;
|
|
182
|
-
if (!ctx)
|
|
183
|
-
return html ``;
|
|
184
|
-
const side = ctx.side;
|
|
185
|
-
const startX = side === "left" ? "-100%" : "100%";
|
|
186
|
-
if (ctx.isMobile) {
|
|
187
|
-
if (!this.#mounted)
|
|
243
|
+
render() {
|
|
244
|
+
const ctx = this.#ctx.value;
|
|
245
|
+
if (!ctx)
|
|
188
246
|
return html ``;
|
|
189
|
-
|
|
247
|
+
const side = ctx.side;
|
|
248
|
+
const startX = side === "left" ? "-100%" : "100%";
|
|
249
|
+
if (ctx.isMobile) {
|
|
250
|
+
if (!this.#mounted)
|
|
251
|
+
return html ``;
|
|
252
|
+
return html `
|
|
190
253
|
<div
|
|
191
254
|
class="Backdrop"
|
|
192
255
|
part="backdrop"
|
|
@@ -207,22 +270,24 @@ export class DuiSidebar extends LitElement {
|
|
|
207
270
|
<slot></slot>
|
|
208
271
|
</div>
|
|
209
272
|
`;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
273
|
+
}
|
|
274
|
+
if (ctx.collapsible === "none") {
|
|
275
|
+
return html `
|
|
213
276
|
<div class="DesktopOuter" part="desktop-outer">
|
|
214
277
|
<div class="DesktopInner" part="desktop-inner">
|
|
215
278
|
<slot></slot>
|
|
216
279
|
</div>
|
|
217
280
|
</div>
|
|
218
281
|
`;
|
|
219
|
-
|
|
220
|
-
|
|
282
|
+
}
|
|
283
|
+
return html `
|
|
221
284
|
<div class="DesktopOuter" part="desktop-outer">
|
|
222
285
|
<div class="DesktopInner" part="desktop-inner">
|
|
223
286
|
<slot></slot>
|
|
224
287
|
</div>
|
|
225
288
|
</div>
|
|
226
289
|
`;
|
|
227
|
-
|
|
228
|
-
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
})();
|
|
293
|
+
export { DuiSidebar };
|