@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.
Files changed (89) hide show
  1. package/_deprecated/center/center.js +2 -2
  2. package/_deprecated/hstack/hstack.js +79 -33
  3. package/_deprecated/page-inset/page-inset.js +104 -56
  4. package/_deprecated/vstack/vstack.js +61 -19
  5. package/accordion/accordion-item.js +217 -147
  6. package/accordion/accordion.js +214 -149
  7. package/alert-dialog/alert-dialog-close.js +2 -2
  8. package/alert-dialog/alert-dialog-popup.js +230 -166
  9. package/alert-dialog/alert-dialog-trigger.js +2 -2
  10. package/alert-dialog/alert-dialog.js +128 -73
  11. package/avatar/avatar.js +175 -115
  12. package/badge/badge.js +2 -2
  13. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  14. package/breadcrumb/breadcrumb-item.js +2 -2
  15. package/breadcrumb/breadcrumb-link.js +2 -2
  16. package/breadcrumb/breadcrumb-page.js +2 -2
  17. package/breadcrumb/breadcrumb-separator.js +2 -2
  18. package/breadcrumb/breadcrumb.js +2 -2
  19. package/button/button.js +109 -65
  20. package/calendar/calendar.js +368 -290
  21. package/checkbox/checkbox-group.js +146 -87
  22. package/checkbox/checkbox.js +232 -167
  23. package/collapsible/collapsible.js +210 -132
  24. package/combobox/combobox.js +318 -252
  25. package/command/command-empty.js +67 -25
  26. package/command/command-group.js +87 -47
  27. package/command/command-input.js +84 -44
  28. package/command/command-item.js +168 -124
  29. package/command/command-list.js +60 -18
  30. package/command/command-separator.js +2 -2
  31. package/command/command-shortcut.js +2 -2
  32. package/command/command.js +297 -232
  33. package/data-table/data-table.js +225 -153
  34. package/dialog/dialog-close.js +2 -2
  35. package/dialog/dialog-popup.js +247 -181
  36. package/dialog/dialog-trigger.js +2 -2
  37. package/dialog/dialog.js +128 -73
  38. package/dropzone/dropzone.js +310 -249
  39. package/icon/icon.js +2 -2
  40. package/input/input.js +204 -143
  41. package/link/link.js +62 -24
  42. package/menu/menu-item.js +66 -24
  43. package/menu/menu.js +189 -136
  44. package/menubar/menubar.js +142 -91
  45. package/number-field/number-field.js +277 -204
  46. package/package.json +2 -2
  47. package/popover/popover-close.js +2 -2
  48. package/popover/popover-popup.js +126 -76
  49. package/popover/popover-trigger.js +2 -2
  50. package/popover/popover.js +181 -120
  51. package/portal/portal.js +128 -86
  52. package/preview-card/preview-card-popup.js +114 -66
  53. package/preview-card/preview-card-trigger.js +2 -2
  54. package/preview-card/preview-card.js +211 -142
  55. package/progress/progress.js +91 -45
  56. package/radio/radio-group.js +153 -90
  57. package/radio/radio.js +137 -94
  58. package/scroll-area/scroll-area.js +382 -283
  59. package/select/select.js +260 -203
  60. package/separator/separator.js +60 -18
  61. package/sidebar/sidebar-content.js +2 -2
  62. package/sidebar/sidebar-footer.js +2 -2
  63. package/sidebar/sidebar-group-label.js +2 -2
  64. package/sidebar/sidebar-group.js +2 -2
  65. package/sidebar/sidebar-header.js +2 -2
  66. package/sidebar/sidebar-inset.js +2 -2
  67. package/sidebar/sidebar-menu-button.js +118 -74
  68. package/sidebar/sidebar-menu-item.js +2 -2
  69. package/sidebar/sidebar-menu.js +2 -2
  70. package/sidebar/sidebar-provider.js +202 -129
  71. package/sidebar/sidebar-separator.js +2 -2
  72. package/sidebar/sidebar-trigger.js +2 -2
  73. package/sidebar/sidebar.js +150 -85
  74. package/slider/slider.js +217 -159
  75. package/spinner/spinner.js +70 -28
  76. package/switch/switch.js +174 -111
  77. package/tabs/tab.js +89 -47
  78. package/tabs/tabs-indicator.js +2 -2
  79. package/tabs/tabs-list.js +92 -54
  80. package/tabs/tabs-panel.js +90 -44
  81. package/tabs/tabs.js +130 -71
  82. package/textarea/textarea.js +153 -95
  83. package/toggle/toggle-group.js +184 -125
  84. package/toggle/toggle.js +131 -76
  85. package/toolbar/toolbar.js +79 -33
  86. package/tooltip/tooltip-popup.js +108 -60
  87. package/tooltip/tooltip-trigger.js +93 -55
  88. package/tooltip/tooltip.js +225 -154
  89. package/trunc/trunc.js +78 -34
@@ -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
- export class DuiSidebar extends LitElement {
106
- static { this.tagName = "dui-sidebar"; }
107
- static { this.styles = [base, styles]; }
108
- #mounted_accessor_storage = false;
109
- get #mounted() { return this.#mounted_accessor_storage; }
110
- set #mounted(value) { this.#mounted_accessor_storage = value; }
111
- #startingStyle_accessor_storage = false;
112
- get #startingStyle() { return this.#startingStyle_accessor_storage; }
113
- set #startingStyle(value) { this.#startingStyle_accessor_storage = value; }
114
- #endingStyle_accessor_storage = false;
115
- get #endingStyle() { return this.#endingStyle_accessor_storage; }
116
- set #endingStyle(value) { this.#endingStyle_accessor_storage = value; }
117
- #ctx = new ContextConsumer(this, {
118
- context: sidebarContext,
119
- subscribe: true,
120
- });
121
- willUpdate() {
122
- const ctx = this.#ctx.value;
123
- if (!ctx)
124
- return;
125
- this.dataset.state = ctx.state;
126
- this.dataset.side = ctx.side;
127
- this.dataset.variant = ctx.variant;
128
- this.dataset.collapsible = ctx.collapsible;
129
- // Handle mobile panel animation
130
- if (ctx.isMobile) {
131
- if (ctx.openMobile && !this.#mounted) {
132
- this.#animateOpen();
133
- }
134
- else if (!ctx.openMobile && this.#mounted && !this.#endingStyle) {
135
- this.#animateClose();
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
- async #animateOpen() {
140
- this.#mounted = true;
141
- this.#startingStyle = true;
142
- await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
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
- let called = false;
153
- const done = () => {
154
- if (called)
208
+ #animateClose() {
209
+ this.#endingStyle = true;
210
+ const panel = this.shadowRoot?.querySelector(".MobilePanel");
211
+ if (!panel) {
212
+ this.#finishClose();
155
213
  return;
156
- called = true;
157
- panel.removeEventListener("transitionend", onEnd);
158
- clearTimeout(timer);
159
- this.#finishClose();
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
- const onEnd = () => {
162
- done();
237
+ #onMobileKeyDown = (e) => {
238
+ if (e.key === "Escape") {
239
+ e.preventDefault();
240
+ this.#ctx.value?.setOpen(false);
241
+ }
163
242
  };
164
- panel.addEventListener("transitionend", onEnd);
165
- const timer = setTimeout(done, 250);
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
- return html `
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
- if (ctx.collapsible === "none") {
212
- return html `
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
- return html `
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 };