@deepfuture/dui-components 0.0.11 → 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 (250) hide show
  1. package/README.md +191 -0
  2. package/_deprecated/center/center.js +2 -2
  3. package/_deprecated/center/index.d.ts +3 -1
  4. package/_deprecated/center/index.js +3 -1
  5. package/_deprecated/hstack/hstack.js +79 -33
  6. package/_deprecated/hstack/index.d.ts +3 -1
  7. package/_deprecated/hstack/index.js +3 -1
  8. package/_deprecated/page-inset/index.d.ts +3 -1
  9. package/_deprecated/page-inset/index.js +3 -1
  10. package/_deprecated/page-inset/page-inset.js +104 -56
  11. package/_deprecated/vstack/index.d.ts +3 -1
  12. package/_deprecated/vstack/index.js +3 -1
  13. package/_deprecated/vstack/vstack.js +61 -19
  14. package/accordion/accordion-item.js +217 -147
  15. package/accordion/accordion.js +214 -149
  16. package/accordion/index.d.ts +5 -2
  17. package/accordion/index.js +5 -2
  18. package/alert-dialog/alert-dialog-close.js +2 -2
  19. package/alert-dialog/alert-dialog-popup.js +230 -166
  20. package/alert-dialog/alert-dialog-trigger.js +2 -2
  21. package/alert-dialog/alert-dialog.js +128 -73
  22. package/alert-dialog/index.d.ts +9 -4
  23. package/alert-dialog/index.js +9 -4
  24. package/avatar/avatar.js +175 -115
  25. package/avatar/index.d.ts +3 -1
  26. package/avatar/index.js +3 -1
  27. package/badge/badge.js +2 -2
  28. package/badge/index.d.ts +3 -1
  29. package/badge/index.js +3 -1
  30. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  31. package/breadcrumb/breadcrumb-item.js +2 -2
  32. package/breadcrumb/breadcrumb-link.js +2 -2
  33. package/breadcrumb/breadcrumb-page.js +2 -2
  34. package/breadcrumb/breadcrumb-separator.js +2 -2
  35. package/breadcrumb/breadcrumb.js +2 -2
  36. package/breadcrumb/index.d.ts +13 -6
  37. package/breadcrumb/index.js +13 -6
  38. package/button/button.js +109 -65
  39. package/button/index.d.ts +3 -1
  40. package/button/index.js +3 -1
  41. package/calendar/calendar.js +368 -290
  42. package/calendar/index.d.ts +3 -1
  43. package/calendar/index.js +3 -1
  44. package/checkbox/checkbox-group.js +146 -87
  45. package/checkbox/checkbox.js +232 -167
  46. package/checkbox/index.d.ts +5 -2
  47. package/checkbox/index.js +5 -2
  48. package/collapsible/collapsible.js +210 -132
  49. package/collapsible/index.d.ts +3 -1
  50. package/collapsible/index.js +3 -1
  51. package/combobox/combobox.js +318 -252
  52. package/combobox/index.d.ts +3 -1
  53. package/combobox/index.js +3 -1
  54. package/command/command-empty.js +67 -25
  55. package/command/command-group.js +87 -47
  56. package/command/command-input.js +84 -44
  57. package/command/command-item.js +168 -124
  58. package/command/command-list.js +60 -18
  59. package/command/command-separator.js +2 -2
  60. package/command/command-shortcut.js +2 -2
  61. package/command/command.js +297 -232
  62. package/command/index.d.ts +17 -8
  63. package/command/index.js +17 -8
  64. package/data-table/data-table.js +225 -153
  65. package/data-table/index.d.ts +3 -1
  66. package/data-table/index.js +3 -1
  67. package/dialog/dialog-close.js +2 -2
  68. package/dialog/dialog-popup.js +247 -181
  69. package/dialog/dialog-trigger.js +2 -2
  70. package/dialog/dialog.js +128 -73
  71. package/dialog/index.d.ts +9 -4
  72. package/dialog/index.js +9 -4
  73. package/dropzone/dropzone.js +310 -249
  74. package/dropzone/index.d.ts +3 -1
  75. package/dropzone/index.js +3 -1
  76. package/icon/icon.js +2 -2
  77. package/icon/index.d.ts +3 -1
  78. package/icon/index.js +3 -1
  79. package/input/index.d.ts +3 -1
  80. package/input/index.js +3 -1
  81. package/input/input.js +204 -143
  82. package/link/index.d.ts +3 -1
  83. package/link/index.js +3 -1
  84. package/link/link.js +62 -24
  85. package/menu/index.d.ts +5 -2
  86. package/menu/index.js +5 -2
  87. package/menu/menu-item.js +66 -24
  88. package/menu/menu.js +189 -136
  89. package/menubar/index.d.ts +3 -1
  90. package/menubar/index.js +3 -1
  91. package/menubar/menubar.js +142 -91
  92. package/number-field/index.d.ts +3 -1
  93. package/number-field/index.js +3 -1
  94. package/number-field/number-field.js +277 -204
  95. package/package.json +5 -4
  96. package/popover/index.d.ts +9 -4
  97. package/popover/index.js +9 -4
  98. package/popover/popover-close.js +2 -2
  99. package/popover/popover-popup.js +126 -76
  100. package/popover/popover-trigger.js +2 -2
  101. package/popover/popover.js +181 -120
  102. package/portal/index.d.ts +3 -1
  103. package/portal/index.js +3 -1
  104. package/portal/portal.js +128 -86
  105. package/preview-card/index.d.ts +7 -3
  106. package/preview-card/index.js +7 -3
  107. package/preview-card/preview-card-popup.js +114 -66
  108. package/preview-card/preview-card-trigger.js +2 -2
  109. package/preview-card/preview-card.js +211 -142
  110. package/progress/index.d.ts +3 -1
  111. package/progress/index.js +3 -1
  112. package/progress/progress.js +91 -45
  113. package/radio/index.d.ts +5 -2
  114. package/radio/index.js +5 -2
  115. package/radio/radio-group.js +153 -90
  116. package/radio/radio.js +137 -94
  117. package/scroll-area/index.d.ts +3 -1
  118. package/scroll-area/index.js +3 -1
  119. package/scroll-area/scroll-area.js +382 -276
  120. package/select/index.d.ts +3 -1
  121. package/select/index.js +3 -1
  122. package/select/select.js +260 -203
  123. package/separator/index.d.ts +3 -1
  124. package/separator/index.js +3 -1
  125. package/separator/separator.js +60 -18
  126. package/sidebar/index.d.ts +27 -13
  127. package/sidebar/index.js +32 -13
  128. package/sidebar/sidebar-content.js +2 -2
  129. package/sidebar/sidebar-footer.js +2 -2
  130. package/sidebar/sidebar-group-label.js +2 -2
  131. package/sidebar/sidebar-group.js +2 -2
  132. package/sidebar/sidebar-header.js +2 -2
  133. package/sidebar/sidebar-inset.js +2 -2
  134. package/sidebar/sidebar-menu-button.js +118 -74
  135. package/sidebar/sidebar-menu-item.js +2 -2
  136. package/sidebar/sidebar-menu.js +2 -2
  137. package/sidebar/sidebar-provider.js +202 -129
  138. package/sidebar/sidebar-separator.js +2 -2
  139. package/sidebar/sidebar-trigger.js +2 -2
  140. package/sidebar/sidebar.js +150 -85
  141. package/slider/index.d.ts +3 -1
  142. package/slider/index.js +3 -1
  143. package/slider/slider.js +217 -159
  144. package/spinner/index.d.ts +3 -1
  145. package/spinner/index.js +3 -1
  146. package/spinner/spinner.js +70 -28
  147. package/switch/index.d.ts +3 -1
  148. package/switch/index.js +3 -1
  149. package/switch/switch.js +174 -111
  150. package/tabs/index.d.ts +11 -5
  151. package/tabs/index.js +11 -5
  152. package/tabs/tab.js +89 -47
  153. package/tabs/tabs-indicator.js +2 -2
  154. package/tabs/tabs-list.js +92 -54
  155. package/tabs/tabs-panel.js +90 -44
  156. package/tabs/tabs.js +130 -71
  157. package/textarea/index.d.ts +3 -1
  158. package/textarea/index.js +3 -1
  159. package/textarea/textarea.js +153 -95
  160. package/toggle/index.d.ts +5 -2
  161. package/toggle/index.js +5 -2
  162. package/toggle/toggle-group.js +184 -125
  163. package/toggle/toggle.js +131 -76
  164. package/toolbar/index.d.ts +3 -1
  165. package/toolbar/index.js +3 -1
  166. package/toolbar/toolbar.js +79 -33
  167. package/tooltip/index.d.ts +7 -3
  168. package/tooltip/index.js +7 -3
  169. package/tooltip/tooltip-popup.js +108 -60
  170. package/tooltip/tooltip-trigger.js +93 -55
  171. package/tooltip/tooltip.js +225 -154
  172. package/trunc/index.d.ts +3 -1
  173. package/trunc/index.js +3 -1
  174. package/trunc/trunc.js +78 -34
  175. package/accordion/register.d.ts +0 -1
  176. package/accordion/register.js +0 -8
  177. package/alert-dialog/register.d.ts +0 -1
  178. package/alert-dialog/register.js +0 -16
  179. package/avatar/register.d.ts +0 -1
  180. package/avatar/register.js +0 -4
  181. package/badge/register.d.ts +0 -1
  182. package/badge/register.js +0 -4
  183. package/breadcrumb/register.d.ts +0 -1
  184. package/breadcrumb/register.js +0 -14
  185. package/button/register.d.ts +0 -1
  186. package/button/register.js +0 -4
  187. package/calendar/register.d.ts +0 -1
  188. package/calendar/register.js +0 -4
  189. package/checkbox/register.d.ts +0 -1
  190. package/checkbox/register.js +0 -8
  191. package/collapsible/register.d.ts +0 -1
  192. package/collapsible/register.js +0 -4
  193. package/combobox/register.d.ts +0 -1
  194. package/combobox/register.js +0 -4
  195. package/command/register.d.ts +0 -1
  196. package/command/register.js +0 -22
  197. package/data-table/register.d.ts +0 -1
  198. package/data-table/register.js +0 -4
  199. package/dialog/register.d.ts +0 -1
  200. package/dialog/register.js +0 -16
  201. package/dropzone/register.d.ts +0 -1
  202. package/dropzone/register.js +0 -4
  203. package/icon/register.d.ts +0 -1
  204. package/icon/register.js +0 -4
  205. package/input/register.d.ts +0 -1
  206. package/input/register.js +0 -4
  207. package/link/register.d.ts +0 -1
  208. package/link/register.js +0 -4
  209. package/menu/register.d.ts +0 -1
  210. package/menu/register.js +0 -8
  211. package/menubar/register.d.ts +0 -1
  212. package/menubar/register.js +0 -4
  213. package/number-field/register.d.ts +0 -1
  214. package/number-field/register.js +0 -4
  215. package/popover/register.d.ts +0 -1
  216. package/popover/register.js +0 -16
  217. package/portal/register.d.ts +0 -1
  218. package/portal/register.js +0 -4
  219. package/preview-card/register.d.ts +0 -1
  220. package/preview-card/register.js +0 -12
  221. package/progress/register.d.ts +0 -1
  222. package/progress/register.js +0 -4
  223. package/radio/register.d.ts +0 -1
  224. package/radio/register.js +0 -8
  225. package/scroll-area/register.d.ts +0 -1
  226. package/scroll-area/register.js +0 -4
  227. package/select/register.d.ts +0 -1
  228. package/select/register.js +0 -4
  229. package/separator/register.d.ts +0 -1
  230. package/separator/register.js +0 -4
  231. package/sidebar/register.d.ts +0 -1
  232. package/sidebar/register.js +0 -52
  233. package/slider/register.d.ts +0 -1
  234. package/slider/register.js +0 -4
  235. package/spinner/register.d.ts +0 -1
  236. package/spinner/register.js +0 -4
  237. package/switch/register.d.ts +0 -1
  238. package/switch/register.js +0 -4
  239. package/tabs/register.d.ts +0 -1
  240. package/tabs/register.js +0 -10
  241. package/textarea/register.d.ts +0 -1
  242. package/textarea/register.js +0 -4
  243. package/toggle/register.d.ts +0 -1
  244. package/toggle/register.js +0 -8
  245. package/toolbar/register.d.ts +0 -1
  246. package/toolbar/register.js +0 -4
  247. package/tooltip/register.d.ts +0 -1
  248. package/tooltip/register.js +0 -12
  249. package/trunc/register.d.ts +0 -1
  250. package/trunc/register.js +0 -4
@@ -1,9 +1,37 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/vstack */
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";
@@ -63,21 +91,35 @@ const styles = css `
63
91
  * @csspart root - The stack container.
64
92
  * @cssprop --vstack-gap - Override gap between items.
65
93
  */
66
- export class DuiVstack extends LitElement {
67
- static { this.tagName = "dui-vstack"; }
68
- static { this.styles = [base, styles]; }
69
- #gap_accessor_storage = "4";
70
- /** Gap between stack items. Maps to space tokens. */
71
- get gap() { return this.#gap_accessor_storage; }
72
- set gap(value) { this.#gap_accessor_storage = value; }
73
- render() {
74
- return html `
94
+ let DuiVstack = (() => {
95
+ let _classSuper = LitElement;
96
+ let _gap_decorators;
97
+ let _gap_initializers = [];
98
+ let _gap_extraInitializers = [];
99
+ return class DuiVstack extends _classSuper {
100
+ static {
101
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
102
+ _gap_decorators = [property({ reflect: true })];
103
+ __esDecorate(this, null, _gap_decorators, { kind: "accessor", name: "gap", static: false, private: false, access: { has: obj => "gap" in obj, get: obj => obj.gap, set: (obj, value) => { obj.gap = value; } }, metadata: _metadata }, _gap_initializers, _gap_extraInitializers);
104
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
105
+ }
106
+ static tagName = "dui-vstack";
107
+ static styles = [base, styles];
108
+ #gap_accessor_storage = __runInitializers(this, _gap_initializers, "4");
109
+ /** Gap between stack items. Maps to space tokens. */
110
+ get gap() { return this.#gap_accessor_storage; }
111
+ set gap(value) { this.#gap_accessor_storage = value; }
112
+ render() {
113
+ return html `
75
114
  <div part="root">
76
115
  <slot></slot>
77
116
  </div>
78
117
  `;
79
- }
80
- }
81
- __decorate([
82
- property({ reflect: true })
83
- ], DuiVstack.prototype, "gap", null);
118
+ }
119
+ constructor() {
120
+ super(...arguments);
121
+ __runInitializers(this, _gap_extraInitializers);
122
+ }
123
+ };
124
+ })();
125
+ export { DuiVstack };
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/accordion */
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, nothing } from "lit";
9
- import { property } from "lit/decorators.js";
41
+ import { property, state } from "lit/decorators.js";
10
42
  import { consume } from "@lit/context";
11
43
  import { base } from "@deepfuture/dui-core/base";
12
44
  import { customEvent } from "@deepfuture/dui-core/event";
@@ -58,145 +90,190 @@ const chevronSvg = html `<svg
58
90
  >
59
91
  <path d="m6 9 6 6 6-6" />
60
92
  </svg>`;
61
- export class DuiAccordionItem extends LitElement {
62
- static { this.tagName = "dui-accordion-item"; }
63
- static { this.styles = [base, styles]; }
64
- #value_accessor_storage = "";
65
- get value() { return this.#value_accessor_storage; }
66
- set value(value) { this.#value_accessor_storage = value; }
67
- #disabled_accessor_storage = false;
68
- get disabled() { return this.#disabled_accessor_storage; }
69
- set disabled(value) { this.#disabled_accessor_storage = value; }
70
- #_ctx_accessor_storage;
71
- get _ctx() { return this.#_ctx_accessor_storage; }
72
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
73
- #starting_accessor_storage = false;
74
- get #starting() { return this.#starting_accessor_storage; }
75
- set #starting(value) { this.#starting_accessor_storage = value; }
76
- #ending_accessor_storage = false;
77
- get #ending() { return this.#ending_accessor_storage; }
78
- set #ending(value) { this.#ending_accessor_storage = value; }
79
- #panelHeight_accessor_storage = "0";
80
- get #panelHeight() { return this.#panelHeight_accessor_storage; }
81
- set #panelHeight(value) { this.#panelHeight_accessor_storage = value; }
82
- #visible_accessor_storage = false;
83
- get #visible() { return this.#visible_accessor_storage; }
84
- set #visible(value) { this.#visible_accessor_storage = value; }
85
- #prevOpen = undefined;
86
- #animGen = 0;
87
- get #open() {
88
- return this._ctx?.openValues.includes(this.value) ?? false;
89
- }
90
- get #isDisabled() {
91
- return this.disabled || this._ctx?.disabled;
92
- }
93
- get #triggerId() {
94
- return `dui-trigger-${this.value}`;
95
- }
96
- get #panelId() {
97
- return `dui-panel-${this.value}`;
98
- }
99
- connectedCallback() {
100
- super.connectedCallback();
101
- this._ctx?.registerItem(this.value, this);
102
- }
103
- disconnectedCallback() {
104
- super.disconnectedCallback();
105
- this._ctx?.unregisterItem(this.value);
106
- }
107
- willUpdate() {
108
- const isOpen = this.#open;
109
- if (this.#prevOpen === undefined) {
110
- this.#visible = isOpen;
111
- this.#panelHeight = isOpen ? "auto" : "0";
93
+ let DuiAccordionItem = (() => {
94
+ let _classSuper = LitElement;
95
+ let _value_decorators;
96
+ let _value_initializers = [];
97
+ let _value_extraInitializers = [];
98
+ let _disabled_decorators;
99
+ let _disabled_initializers = [];
100
+ let _disabled_extraInitializers = [];
101
+ let __ctx_decorators;
102
+ let __ctx_initializers = [];
103
+ let __ctx_extraInitializers = [];
104
+ let _private_starting_decorators;
105
+ let _private_starting_initializers = [];
106
+ let _private_starting_extraInitializers = [];
107
+ let _private_starting_descriptor;
108
+ let _private_ending_decorators;
109
+ let _private_ending_initializers = [];
110
+ let _private_ending_extraInitializers = [];
111
+ let _private_ending_descriptor;
112
+ let _private_panelHeight_decorators;
113
+ let _private_panelHeight_initializers = [];
114
+ let _private_panelHeight_extraInitializers = [];
115
+ let _private_panelHeight_descriptor;
116
+ let _private_visible_decorators;
117
+ let _private_visible_initializers = [];
118
+ let _private_visible_extraInitializers = [];
119
+ let _private_visible_descriptor;
120
+ return class DuiAccordionItem extends _classSuper {
121
+ static {
122
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
123
+ _value_decorators = [property({ type: String })];
124
+ _disabled_decorators = [property({ type: Boolean })];
125
+ __ctx_decorators = [consume({ context: accordionContext, subscribe: true })];
126
+ _private_starting_decorators = [state()];
127
+ _private_ending_decorators = [state()];
128
+ _private_panelHeight_decorators = [state()];
129
+ _private_visible_decorators = [state()];
130
+ __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);
131
+ __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);
132
+ __esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
133
+ __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);
134
+ __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);
135
+ __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);
136
+ __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);
137
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
138
+ }
139
+ static tagName = "dui-accordion-item";
140
+ static styles = [base, styles];
141
+ #value_accessor_storage = __runInitializers(this, _value_initializers, "");
142
+ get value() { return this.#value_accessor_storage; }
143
+ set value(value) { this.#value_accessor_storage = value; }
144
+ #disabled_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _disabled_initializers, false));
145
+ get disabled() { return this.#disabled_accessor_storage; }
146
+ set disabled(value) { this.#disabled_accessor_storage = value; }
147
+ #_ctx_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, __ctx_initializers, void 0));
148
+ get _ctx() { return this.#_ctx_accessor_storage; }
149
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
150
+ #starting_accessor_storage = (__runInitializers(this, __ctx_extraInitializers), __runInitializers(this, _private_starting_initializers, false));
151
+ get #starting() { return _private_starting_descriptor.get.call(this); }
152
+ set #starting(value) { return _private_starting_descriptor.set.call(this, value); }
153
+ #ending_accessor_storage = (__runInitializers(this, _private_starting_extraInitializers), __runInitializers(this, _private_ending_initializers, false));
154
+ get #ending() { return _private_ending_descriptor.get.call(this); }
155
+ set #ending(value) { return _private_ending_descriptor.set.call(this, value); }
156
+ #panelHeight_accessor_storage = (__runInitializers(this, _private_ending_extraInitializers), __runInitializers(this, _private_panelHeight_initializers, "0"));
157
+ get #panelHeight() { return _private_panelHeight_descriptor.get.call(this); }
158
+ set #panelHeight(value) { return _private_panelHeight_descriptor.set.call(this, value); }
159
+ #visible_accessor_storage = (__runInitializers(this, _private_panelHeight_extraInitializers), __runInitializers(this, _private_visible_initializers, false));
160
+ get #visible() { return _private_visible_descriptor.get.call(this); }
161
+ set #visible(value) { return _private_visible_descriptor.set.call(this, value); }
162
+ #prevOpen = (__runInitializers(this, _private_visible_extraInitializers), undefined);
163
+ #animGen = 0;
164
+ get #open() {
165
+ return this._ctx?.openValues.includes(this.value) ?? false;
166
+ }
167
+ get #isDisabled() {
168
+ return this.disabled || this._ctx?.disabled;
169
+ }
170
+ get #triggerId() {
171
+ return `dui-trigger-${this.value}`;
172
+ }
173
+ get #panelId() {
174
+ return `dui-panel-${this.value}`;
112
175
  }
113
- else if (this.#prevOpen !== isOpen) {
114
- if (isOpen) {
115
- this.#startOpenAnimation();
176
+ connectedCallback() {
177
+ super.connectedCallback();
178
+ this._ctx?.registerItem(this.value, this);
179
+ }
180
+ disconnectedCallback() {
181
+ super.disconnectedCallback();
182
+ this._ctx?.unregisterItem(this.value);
183
+ }
184
+ willUpdate() {
185
+ const isOpen = this.#open;
186
+ if (this.#prevOpen === undefined) {
187
+ this.#visible = isOpen;
188
+ this.#panelHeight = isOpen ? "auto" : "0";
116
189
  }
117
- else {
118
- this.#startCloseAnimation();
190
+ else if (this.#prevOpen !== isOpen) {
191
+ if (isOpen) {
192
+ this.#startOpenAnimation();
193
+ }
194
+ else {
195
+ this.#startCloseAnimation();
196
+ }
197
+ this.dispatchEvent(openChangeEvent({ value: this.value, open: isOpen }));
119
198
  }
120
- this.dispatchEvent(openChangeEvent({ value: this.value, open: isOpen }));
199
+ this.#prevOpen = isOpen;
121
200
  }
122
- this.#prevOpen = isOpen;
123
- }
124
- #startOpenAnimation() {
125
- const gen = ++this.#animGen;
126
- this.#ending = false;
127
- this.#visible = true;
128
- this.#starting = true;
129
- this.#panelHeight = "0";
130
- requestAnimationFrame(() => {
131
- if (this.#animGen !== gen)
132
- return;
201
+ #startOpenAnimation() {
202
+ const gen = ++this.#animGen;
203
+ this.#ending = false;
204
+ this.#visible = true;
205
+ this.#starting = true;
206
+ this.#panelHeight = "0";
207
+ requestAnimationFrame(() => {
208
+ if (this.#animGen !== gen)
209
+ return;
210
+ const panel = this.shadowRoot?.querySelector("[part='panel']");
211
+ if (panel) {
212
+ this.#panelHeight = `${panel.scrollHeight}px`;
213
+ }
214
+ this.#starting = false;
215
+ });
216
+ }
217
+ #startCloseAnimation() {
218
+ const gen = ++this.#animGen;
219
+ this.#starting = false;
133
220
  const panel = this.shadowRoot?.querySelector("[part='panel']");
134
221
  if (panel) {
135
222
  this.#panelHeight = `${panel.scrollHeight}px`;
136
223
  }
137
- this.#starting = false;
138
- });
139
- }
140
- #startCloseAnimation() {
141
- const gen = ++this.#animGen;
142
- this.#starting = false;
143
- const panel = this.shadowRoot?.querySelector("[part='panel']");
144
- if (panel) {
145
- this.#panelHeight = `${panel.scrollHeight}px`;
224
+ requestAnimationFrame(() => {
225
+ if (this.#animGen !== gen)
226
+ return;
227
+ this.#ending = true;
228
+ this.#panelHeight = "0";
229
+ });
146
230
  }
147
- requestAnimationFrame(() => {
148
- if (this.#animGen !== gen)
231
+ #onTransitionEnd = (event) => {
232
+ if (event.propertyName !== "height")
149
233
  return;
150
- this.#ending = true;
151
- this.#panelHeight = "0";
152
- });
153
- }
154
- #onTransitionEnd = (event) => {
155
- if (event.propertyName !== "height")
156
- return;
157
- if (this.#ending) {
158
- this.#ending = false;
159
- if (!this._ctx?.keepMounted) {
160
- this.#visible = false;
234
+ if (this.#ending) {
235
+ this.#ending = false;
236
+ if (!this._ctx?.keepMounted) {
237
+ this.#visible = false;
238
+ }
161
239
  }
162
- }
163
- else if (this.#open) {
164
- this.#panelHeight = "auto";
165
- }
166
- };
167
- #onClick = () => {
168
- if (this.#isDisabled)
169
- return;
170
- this._ctx.toggle(this.value);
171
- };
172
- #onKeyDown = (event) => {
173
- if (this.#isDisabled)
174
- return;
175
- const isVertical = this._ctx.orientation === "vertical";
176
- const nextKey = isVertical ? "ArrowDown" : "ArrowRight";
177
- const prevKey = isVertical ? "ArrowUp" : "ArrowLeft";
178
- switch (event.key) {
179
- case nextKey:
180
- event.preventDefault();
181
- this._ctx.focusItem(this.value, "next");
182
- break;
183
- case prevKey:
184
- event.preventDefault();
185
- this._ctx.focusItem(this.value, "prev");
186
- break;
187
- case "Home":
188
- event.preventDefault();
189
- this._ctx.focusItem(this.value, "first");
190
- break;
191
- case "End":
192
- event.preventDefault();
193
- this._ctx.focusItem(this.value, "last");
194
- break;
195
- }
196
- };
197
- render() {
198
- const shouldRender = this.#visible || this._ctx?.keepMounted;
199
- return html `
240
+ else if (this.#open) {
241
+ this.#panelHeight = "auto";
242
+ }
243
+ };
244
+ #onClick = () => {
245
+ if (this.#isDisabled)
246
+ return;
247
+ this._ctx.toggle(this.value);
248
+ };
249
+ #onKeyDown = (event) => {
250
+ if (this.#isDisabled)
251
+ return;
252
+ const isVertical = this._ctx.orientation === "vertical";
253
+ const nextKey = isVertical ? "ArrowDown" : "ArrowRight";
254
+ const prevKey = isVertical ? "ArrowUp" : "ArrowLeft";
255
+ switch (event.key) {
256
+ case nextKey:
257
+ event.preventDefault();
258
+ this._ctx.focusItem(this.value, "next");
259
+ break;
260
+ case prevKey:
261
+ event.preventDefault();
262
+ this._ctx.focusItem(this.value, "prev");
263
+ break;
264
+ case "Home":
265
+ event.preventDefault();
266
+ this._ctx.focusItem(this.value, "first");
267
+ break;
268
+ case "End":
269
+ event.preventDefault();
270
+ this._ctx.focusItem(this.value, "last");
271
+ break;
272
+ }
273
+ };
274
+ render() {
275
+ const shouldRender = this.#visible || this._ctx?.keepMounted;
276
+ return html `
200
277
  <div
201
278
  part="item"
202
279
  ?data-open=${this.#open}
@@ -218,7 +295,7 @@ export class DuiAccordionItem extends LitElement {
218
295
  </button>
219
296
  </h3>
220
297
  ${shouldRender
221
- ? html `
298
+ ? html `
222
299
  <div
223
300
  part="panel"
224
301
  id=${this.#panelId}
@@ -236,17 +313,10 @@ export class DuiAccordionItem extends LitElement {
236
313
  </div>
237
314
  </div>
238
315
  `
239
- : nothing}
316
+ : nothing}
240
317
  </div>
241
318
  `;
242
- }
243
- }
244
- __decorate([
245
- property({ type: String })
246
- ], DuiAccordionItem.prototype, "value", null);
247
- __decorate([
248
- property({ type: Boolean })
249
- ], DuiAccordionItem.prototype, "disabled", null);
250
- __decorate([
251
- consume({ context: accordionContext, subscribe: true })
252
- ], DuiAccordionItem.prototype, "_ctx", null);
319
+ }
320
+ };
321
+ })();
322
+ export { DuiAccordionItem };