@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
package/portal/portal.js CHANGED
@@ -1,9 +1,37 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/portal */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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;
7
35
  };
8
36
  import { css, html, LitElement } from "lit";
9
37
  import { property } from "lit/decorators.js";
@@ -25,91 +53,105 @@ const styles = css `
25
53
  * @attr {string} target - CSS selector for the destination container (default: "body").
26
54
  * @attr {"shadow" | "document"} target-root - Where to resolve the target selector.
27
55
  */
28
- export class DuiPortal extends LitElement {
29
- static { this.tagName = "dui-portal"; }
30
- static { this.styles = [styles]; }
31
- #target_accessor_storage = "body";
32
- /** CSS selector for the destination container. */
33
- get target() { return this.#target_accessor_storage; }
34
- set target(value) { this.#target_accessor_storage = value; }
35
- #targetRoot_accessor_storage = "document";
36
- /** Where to resolve the target selector: "document" (default) or "shadow". */
37
- get targetRoot() { return this.#targetRoot_accessor_storage; }
38
- set targetRoot(value) { this.#targetRoot_accessor_storage = value; }
39
- #targetElement_accessor_storage;
40
- /** Direct element reference for cross-shadow-root targets. Takes precedence over `target` selector. */
41
- get targetElement() { return this.#targetElement_accessor_storage; }
42
- set targetElement(value) { this.#targetElement_accessor_storage = value; }
43
- #container = undefined;
44
- #movedNodes = new Set();
45
- #isMoving = false;
46
- #queryTarget() {
47
- const root = getRootDocument(this, {
48
- composed: this.targetRoot === "document",
49
- });
50
- return root?.querySelector(this.target) ?? undefined;
51
- }
52
- connectedCallback() {
53
- super.connectedCallback();
54
- this.#container = this.targetElement ?? this.#queryTarget();
55
- if (this.#container && this.childNodes.length > 0) {
56
- this.#moveChildrenToTarget();
56
+ let DuiPortal = (() => {
57
+ let _classSuper = LitElement;
58
+ let _target_decorators;
59
+ let _target_initializers = [];
60
+ let _target_extraInitializers = [];
61
+ let _targetRoot_decorators;
62
+ let _targetRoot_initializers = [];
63
+ let _targetRoot_extraInitializers = [];
64
+ let _targetElement_decorators;
65
+ let _targetElement_initializers = [];
66
+ let _targetElement_extraInitializers = [];
67
+ return class DuiPortal extends _classSuper {
68
+ static {
69
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
70
+ _target_decorators = [property({ type: String })];
71
+ _targetRoot_decorators = [property({ type: String, attribute: "target-root", reflect: true })];
72
+ _targetElement_decorators = [property({ attribute: false })];
73
+ __esDecorate(this, null, _target_decorators, { kind: "accessor", name: "target", static: false, private: false, access: { has: obj => "target" in obj, get: obj => obj.target, set: (obj, value) => { obj.target = value; } }, metadata: _metadata }, _target_initializers, _target_extraInitializers);
74
+ __esDecorate(this, null, _targetRoot_decorators, { kind: "accessor", name: "targetRoot", static: false, private: false, access: { has: obj => "targetRoot" in obj, get: obj => obj.targetRoot, set: (obj, value) => { obj.targetRoot = value; } }, metadata: _metadata }, _targetRoot_initializers, _targetRoot_extraInitializers);
75
+ __esDecorate(this, null, _targetElement_decorators, { kind: "accessor", name: "targetElement", static: false, private: false, access: { has: obj => "targetElement" in obj, get: obj => obj.targetElement, set: (obj, value) => { obj.targetElement = value; } }, metadata: _metadata }, _targetElement_initializers, _targetElement_extraInitializers);
76
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
77
  }
58
- }
59
- disconnectedCallback() {
60
- super.disconnectedCallback();
61
- this.#detach();
62
- }
63
- updated(changed) {
64
- if (changed.has("target") ||
65
- changed.has("targetRoot") ||
66
- changed.has("targetElement")) {
78
+ static tagName = "dui-portal";
79
+ static styles = [styles];
80
+ #target_accessor_storage = __runInitializers(this, _target_initializers, "body");
81
+ /** CSS selector for the destination container. */
82
+ get target() { return this.#target_accessor_storage; }
83
+ set target(value) { this.#target_accessor_storage = value; }
84
+ #targetRoot_accessor_storage = (__runInitializers(this, _target_extraInitializers), __runInitializers(this, _targetRoot_initializers, "document"));
85
+ /** Where to resolve the target selector: "document" (default) or "shadow". */
86
+ get targetRoot() { return this.#targetRoot_accessor_storage; }
87
+ set targetRoot(value) { this.#targetRoot_accessor_storage = value; }
88
+ #targetElement_accessor_storage = (__runInitializers(this, _targetRoot_extraInitializers), __runInitializers(this, _targetElement_initializers, void 0));
89
+ /** Direct element reference for cross-shadow-root targets. Takes precedence over `target` selector. */
90
+ get targetElement() { return this.#targetElement_accessor_storage; }
91
+ set targetElement(value) { this.#targetElement_accessor_storage = value; }
92
+ #container = (__runInitializers(this, _targetElement_extraInitializers), undefined);
93
+ #movedNodes = new Set();
94
+ #isMoving = false;
95
+ #queryTarget() {
96
+ const root = getRootDocument(this, {
97
+ composed: this.targetRoot === "document",
98
+ });
99
+ return root?.querySelector(this.target) ?? undefined;
100
+ }
101
+ connectedCallback() {
102
+ super.connectedCallback();
103
+ this.#container = this.targetElement ?? this.#queryTarget();
104
+ if (this.#container && this.childNodes.length > 0) {
105
+ this.#moveChildrenToTarget();
106
+ }
107
+ }
108
+ disconnectedCallback() {
109
+ super.disconnectedCallback();
67
110
  this.#detach();
68
- this.#attach();
69
111
  }
70
- }
71
- #attach() {
72
- this.#container = this.targetElement ?? this.#queryTarget();
73
- this.#moveChildrenToTarget();
74
- }
75
- #detach() {
76
- if (this.#movedNodes.size === 0)
77
- return;
78
- this.#isMoving = true;
79
- for (const node of this.#movedNodes) {
80
- this.append(node);
112
+ updated(changed) {
113
+ if (changed.has("target") ||
114
+ changed.has("targetRoot") ||
115
+ changed.has("targetElement")) {
116
+ this.#detach();
117
+ this.#attach();
118
+ }
81
119
  }
82
- this.#movedNodes.clear();
83
- this.#isMoving = false;
84
- this.#container = undefined;
85
- }
86
- #moveChildrenToTarget() {
87
- if (!this.#container) {
88
- throw new Error(`Portal target does not exist: ${this.target}`);
120
+ #attach() {
121
+ this.#container = this.targetElement ?? this.#queryTarget();
122
+ this.#moveChildrenToTarget();
89
123
  }
90
- this.#isMoving = true;
91
- const nodes = Array.from(this.childNodes);
92
- for (const node of nodes) {
93
- this.#container.appendChild(node);
94
- this.#movedNodes.add(node);
124
+ #detach() {
125
+ if (this.#movedNodes.size === 0)
126
+ return;
127
+ this.#isMoving = true;
128
+ for (const node of this.#movedNodes) {
129
+ this.append(node);
130
+ }
131
+ this.#movedNodes.clear();
132
+ this.#isMoving = false;
133
+ this.#container = undefined;
134
+ }
135
+ #moveChildrenToTarget() {
136
+ if (!this.#container) {
137
+ throw new Error(`Portal target does not exist: ${this.target}`);
138
+ }
139
+ this.#isMoving = true;
140
+ const nodes = Array.from(this.childNodes);
141
+ for (const node of nodes) {
142
+ this.#container.appendChild(node);
143
+ this.#movedNodes.add(node);
144
+ }
145
+ this.#isMoving = false;
146
+ }
147
+ #handleSlotChange = () => {
148
+ if (this.#isMoving || !this.#container)
149
+ return;
150
+ this.#moveChildrenToTarget();
151
+ };
152
+ render() {
153
+ return html `<slot @slotchange=${this.#handleSlotChange}></slot>`;
95
154
  }
96
- this.#isMoving = false;
97
- }
98
- #handleSlotChange = () => {
99
- if (this.#isMoving || !this.#container)
100
- return;
101
- this.#moveChildrenToTarget();
102
155
  };
103
- render() {
104
- return html `<slot @slotchange=${this.#handleSlotChange}></slot>`;
105
- }
106
- }
107
- __decorate([
108
- property({ type: String })
109
- ], DuiPortal.prototype, "target", null);
110
- __decorate([
111
- property({ type: String, attribute: "target-root", reflect: true })
112
- ], DuiPortal.prototype, "targetRoot", null);
113
- __decorate([
114
- property({ attribute: false })
115
- ], DuiPortal.prototype, "targetElement", null);
156
+ })();
157
+ export { DuiPortal };
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/preview-card */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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 } from "lit";
9
- import { property } from "lit/decorators.js";
41
+ import { property, state } from "lit/decorators.js";
10
42
  import { ContextConsumer } from "@lit/context";
11
43
  import { base } from "@deepfuture/dui-core/base";
12
44
  import { previewCardContext } from "./preview-card-context.js";
@@ -67,37 +99,54 @@ const portalPopupStyles = [
67
99
  *
68
100
  * @slot - Preview card content.
69
101
  */
70
- export class DuiPreviewCardPopup extends LitElement {
71
- static { this.tagName = "dui-preview-card-popup"; }
72
- static { this.styles = [base, hostStyles]; }
73
- #showArrow_accessor_storage = true;
74
- /** Whether to show an arrow pointing to the trigger. */
75
- get showArrow() { return this.#showArrow_accessor_storage; }
76
- set showArrow(value) { this.#showArrow_accessor_storage = value; }
77
- #side_accessor_storage = "top";
78
- get #side() { return this.#side_accessor_storage; }
79
- set #side(value) { this.#side_accessor_storage = value; }
80
- #ctx = new ContextConsumer(this, {
81
- context: previewCardContext,
82
- subscribe: true,
83
- });
84
- #wasOpen = false;
85
- #portal = new FloatingPortalController(this, {
86
- getAnchor: () => this.#ctx.value?.triggerEl,
87
- matchWidth: false,
88
- placement: "top",
89
- offset: 8,
90
- styles: portalPopupStyles,
91
- contentContainer: ".PreviewCardContent",
92
- onPosition: ({ placement }) => {
93
- const actualSide = placement.split("-")[0];
94
- if (actualSide !== this.#side) {
95
- this.#side = actualSide;
96
- }
97
- },
98
- renderPopup: (portal) => {
99
- const popupId = this.#ctx.value?.popupId ?? "";
100
- return html `
102
+ let DuiPreviewCardPopup = (() => {
103
+ let _classSuper = LitElement;
104
+ let _showArrow_decorators;
105
+ let _showArrow_initializers = [];
106
+ let _showArrow_extraInitializers = [];
107
+ let _private_side_decorators;
108
+ let _private_side_initializers = [];
109
+ let _private_side_extraInitializers = [];
110
+ let _private_side_descriptor;
111
+ return class DuiPreviewCardPopup extends _classSuper {
112
+ static {
113
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
114
+ _showArrow_decorators = [property({ type: Boolean, attribute: "show-arrow" })];
115
+ _private_side_decorators = [state()];
116
+ __esDecorate(this, null, _showArrow_decorators, { kind: "accessor", name: "showArrow", static: false, private: false, access: { has: obj => "showArrow" in obj, get: obj => obj.showArrow, set: (obj, value) => { obj.showArrow = value; } }, metadata: _metadata }, _showArrow_initializers, _showArrow_extraInitializers);
117
+ __esDecorate(this, _private_side_descriptor = { get: __setFunctionName(function () { return this.#side_accessor_storage; }, "#side", "get"), set: __setFunctionName(function (value) { this.#side_accessor_storage = value; }, "#side", "set") }, _private_side_decorators, { kind: "accessor", name: "#side", static: false, private: true, access: { has: obj => #side in obj, get: obj => obj.#side, set: (obj, value) => { obj.#side = value; } }, metadata: _metadata }, _private_side_initializers, _private_side_extraInitializers);
118
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
119
+ }
120
+ static tagName = "dui-preview-card-popup";
121
+ static styles = [base, hostStyles];
122
+ #showArrow_accessor_storage = __runInitializers(this, _showArrow_initializers, true);
123
+ /** Whether to show an arrow pointing to the trigger. */
124
+ get showArrow() { return this.#showArrow_accessor_storage; }
125
+ set showArrow(value) { this.#showArrow_accessor_storage = value; }
126
+ #side_accessor_storage = (__runInitializers(this, _showArrow_extraInitializers), __runInitializers(this, _private_side_initializers, "top"));
127
+ get #side() { return _private_side_descriptor.get.call(this); }
128
+ set #side(value) { return _private_side_descriptor.set.call(this, value); }
129
+ #ctx = (__runInitializers(this, _private_side_extraInitializers), new ContextConsumer(this, {
130
+ context: previewCardContext,
131
+ subscribe: true,
132
+ }));
133
+ #wasOpen = false;
134
+ #portal = new FloatingPortalController(this, {
135
+ getAnchor: () => this.#ctx.value?.triggerEl,
136
+ matchWidth: false,
137
+ placement: "top",
138
+ offset: 8,
139
+ styles: portalPopupStyles,
140
+ contentContainer: ".PreviewCardContent",
141
+ onPosition: ({ placement }) => {
142
+ const actualSide = placement.split("-")[0];
143
+ if (actualSide !== this.#side) {
144
+ this.#side = actualSide;
145
+ }
146
+ },
147
+ renderPopup: (portal) => {
148
+ const popupId = this.#ctx.value?.popupId ?? "";
149
+ return html `
101
150
  <div
102
151
  class="Popup"
103
152
  id="${popupId}"
@@ -112,34 +161,33 @@ export class DuiPreviewCardPopup extends LitElement {
112
161
  ${this.showArrow ? renderArrow(this.#side) : ""}
113
162
  </div>
114
163
  `;
115
- },
116
- });
117
- #handleMouseEnter = () => {
118
- this.#ctx.value?.openPreviewCard();
119
- };
120
- #handleMouseLeave = () => {
121
- this.#ctx.value?.closePreviewCard();
122
- };
123
- updated() {
124
- const isOpen = this.#ctx.value?.open ?? false;
125
- if (isOpen && !this.#wasOpen) {
126
- this.#updatePlacement();
127
- this.#portal.open();
164
+ },
165
+ });
166
+ #handleMouseEnter = () => {
167
+ this.#ctx.value?.openPreviewCard();
168
+ };
169
+ #handleMouseLeave = () => {
170
+ this.#ctx.value?.closePreviewCard();
171
+ };
172
+ updated() {
173
+ const isOpen = this.#ctx.value?.open ?? false;
174
+ if (isOpen && !this.#wasOpen) {
175
+ this.#updatePlacement();
176
+ this.#portal.open();
177
+ }
178
+ else if (!isOpen && this.#wasOpen) {
179
+ this.#portal.close();
180
+ }
181
+ this.#wasOpen = isOpen;
128
182
  }
129
- else if (!isOpen && this.#wasOpen) {
130
- this.#portal.close();
183
+ #updatePlacement() {
184
+ const side = this.#ctx.value?.side ?? "top";
185
+ this.#portal.placement = side;
186
+ this.#portal.offset = this.#ctx.value?.sideOffset ?? 8;
131
187
  }
132
- this.#wasOpen = isOpen;
133
- }
134
- #updatePlacement() {
135
- const side = this.#ctx.value?.side ?? "top";
136
- this.#portal.placement = side;
137
- this.#portal.offset = this.#ctx.value?.sideOffset ?? 8;
138
- }
139
- render() {
140
- return html `<slot></slot>`;
141
- }
142
- }
143
- __decorate([
144
- property({ type: Boolean, attribute: "show-arrow" })
145
- ], DuiPreviewCardPopup.prototype, "showArrow", null);
188
+ render() {
189
+ return html `<slot></slot>`;
190
+ }
191
+ };
192
+ })();
193
+ export { DuiPreviewCardPopup };
@@ -19,8 +19,8 @@ const componentStyles = css `
19
19
  * @slot - Content that triggers the preview card.
20
20
  */
21
21
  export class DuiPreviewCardTrigger extends LitElement {
22
- static { this.tagName = "dui-preview-card-trigger"; }
23
- static { this.styles = [base, hostStyles, componentStyles]; }
22
+ static tagName = "dui-preview-card-trigger";
23
+ static styles = [base, hostStyles, componentStyles];
24
24
  #ctx = new ContextConsumer(this, {
25
25
  context: previewCardContext,
26
26
  subscribe: true,