@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,41 @@
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 } from "lit";
9
41
  import { property, state } from "lit/decorators.js";
@@ -25,129 +57,181 @@ const styles = css `
25
57
  flex-direction: column;
26
58
  }
27
59
  `;
28
- export class DuiAccordion extends LitElement {
29
- static { this.tagName = "dui-accordion"; }
30
- static { this.styles = [base, styles]; }
31
- #value_accessor_storage = undefined;
32
- get value() { return this.#value_accessor_storage; }
33
- set value(value) { this.#value_accessor_storage = value; }
34
- #defaultValue_accessor_storage = [];
35
- get defaultValue() { return this.#defaultValue_accessor_storage; }
36
- set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
37
- #disabled_accessor_storage = false;
38
- get disabled() { return this.#disabled_accessor_storage; }
39
- set disabled(value) { this.#disabled_accessor_storage = value; }
40
- #multiple_accessor_storage = false;
41
- get multiple() { return this.#multiple_accessor_storage; }
42
- set multiple(value) { this.#multiple_accessor_storage = value; }
43
- #loopFocus_accessor_storage = true;
44
- get loopFocus() { return this.#loopFocus_accessor_storage; }
45
- set loopFocus(value) { this.#loopFocus_accessor_storage = value; }
46
- #orientation_accessor_storage = "vertical";
47
- get orientation() { return this.#orientation_accessor_storage; }
48
- set orientation(value) { this.#orientation_accessor_storage = value; }
49
- #keepMounted_accessor_storage = false;
50
- get keepMounted() { return this.#keepMounted_accessor_storage; }
51
- set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
52
- #internalOpenValues_accessor_storage = [];
53
- get #internalOpenValues() { return this.#internalOpenValues_accessor_storage; }
54
- set #internalOpenValues(value) { this.#internalOpenValues_accessor_storage = value; }
55
- #itemRegistry = new Map();
56
- #itemOrder = [];
57
- #getOpenValues = () => this.value ?? this.#internalOpenValues;
58
- #toggle = (value) => {
59
- const current = [...this.#getOpenValues()];
60
- const index = current.indexOf(value);
61
- let next;
62
- if (index >= 0) {
63
- next = current.filter((v) => v !== value);
64
- }
65
- else if (this.multiple) {
66
- next = [...current, value];
60
+ let DuiAccordion = (() => {
61
+ let _classSuper = LitElement;
62
+ let _value_decorators;
63
+ let _value_initializers = [];
64
+ let _value_extraInitializers = [];
65
+ let _defaultValue_decorators;
66
+ let _defaultValue_initializers = [];
67
+ let _defaultValue_extraInitializers = [];
68
+ let _disabled_decorators;
69
+ let _disabled_initializers = [];
70
+ let _disabled_extraInitializers = [];
71
+ let _multiple_decorators;
72
+ let _multiple_initializers = [];
73
+ let _multiple_extraInitializers = [];
74
+ let _loopFocus_decorators;
75
+ let _loopFocus_initializers = [];
76
+ let _loopFocus_extraInitializers = [];
77
+ let _orientation_decorators;
78
+ let _orientation_initializers = [];
79
+ let _orientation_extraInitializers = [];
80
+ let _keepMounted_decorators;
81
+ let _keepMounted_initializers = [];
82
+ let _keepMounted_extraInitializers = [];
83
+ let _private_internalOpenValues_decorators;
84
+ let _private_internalOpenValues_initializers = [];
85
+ let _private_internalOpenValues_extraInitializers = [];
86
+ let _private_internalOpenValues_descriptor;
87
+ let __ctx_decorators;
88
+ let __ctx_initializers = [];
89
+ let __ctx_extraInitializers = [];
90
+ return class DuiAccordion extends _classSuper {
91
+ static {
92
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
93
+ _value_decorators = [property({ type: Array })];
94
+ _defaultValue_decorators = [property({ type: Array, attribute: "default-value" })];
95
+ _disabled_decorators = [property({ type: Boolean })];
96
+ _multiple_decorators = [property({ type: Boolean })];
97
+ _loopFocus_decorators = [property({ type: Boolean, attribute: "loop-focus" })];
98
+ _orientation_decorators = [property({ type: String })];
99
+ _keepMounted_decorators = [property({ type: Boolean, attribute: "keep-mounted" })];
100
+ _private_internalOpenValues_decorators = [state()];
101
+ __ctx_decorators = [provide({ context: accordionContext }), state()];
102
+ __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);
103
+ __esDecorate(this, null, _defaultValue_decorators, { kind: "accessor", name: "defaultValue", static: false, private: false, access: { has: obj => "defaultValue" in obj, get: obj => obj.defaultValue, set: (obj, value) => { obj.defaultValue = value; } }, metadata: _metadata }, _defaultValue_initializers, _defaultValue_extraInitializers);
104
+ __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);
105
+ __esDecorate(this, null, _multiple_decorators, { kind: "accessor", name: "multiple", static: false, private: false, access: { has: obj => "multiple" in obj, get: obj => obj.multiple, set: (obj, value) => { obj.multiple = value; } }, metadata: _metadata }, _multiple_initializers, _multiple_extraInitializers);
106
+ __esDecorate(this, null, _loopFocus_decorators, { kind: "accessor", name: "loopFocus", static: false, private: false, access: { has: obj => "loopFocus" in obj, get: obj => obj.loopFocus, set: (obj, value) => { obj.loopFocus = value; } }, metadata: _metadata }, _loopFocus_initializers, _loopFocus_extraInitializers);
107
+ __esDecorate(this, null, _orientation_decorators, { kind: "accessor", name: "orientation", static: false, private: false, access: { has: obj => "orientation" in obj, get: obj => obj.orientation, set: (obj, value) => { obj.orientation = value; } }, metadata: _metadata }, _orientation_initializers, _orientation_extraInitializers);
108
+ __esDecorate(this, null, _keepMounted_decorators, { kind: "accessor", name: "keepMounted", static: false, private: false, access: { has: obj => "keepMounted" in obj, get: obj => obj.keepMounted, set: (obj, value) => { obj.keepMounted = value; } }, metadata: _metadata }, _keepMounted_initializers, _keepMounted_extraInitializers);
109
+ __esDecorate(this, _private_internalOpenValues_descriptor = { get: __setFunctionName(function () { return this.#internalOpenValues_accessor_storage; }, "#internalOpenValues", "get"), set: __setFunctionName(function (value) { this.#internalOpenValues_accessor_storage = value; }, "#internalOpenValues", "set") }, _private_internalOpenValues_decorators, { kind: "accessor", name: "#internalOpenValues", static: false, private: true, access: { has: obj => #internalOpenValues in obj, get: obj => obj.#internalOpenValues, set: (obj, value) => { obj.#internalOpenValues = value; } }, metadata: _metadata }, _private_internalOpenValues_initializers, _private_internalOpenValues_extraInitializers);
110
+ __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);
111
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
67
112
  }
68
- else {
69
- next = [value];
70
- }
71
- if (this.value === undefined) {
72
- this.#internalOpenValues = next;
73
- }
74
- this.dispatchEvent(valueChangeEvent(next));
75
- };
76
- #registerItem = (value, el) => {
77
- this.#itemRegistry.set(value, el);
78
- if (!this.#itemOrder.includes(value)) {
79
- this.#itemOrder.push(value);
80
- }
81
- };
82
- #unregisterItem = (value) => {
83
- this.#itemRegistry.delete(value);
84
- this.#itemOrder = this.#itemOrder.filter((v) => v !== value);
85
- };
86
- #focusItem = (value, direction) => {
87
- const currentIndex = this.#itemOrder.indexOf(value);
88
- if (currentIndex === -1)
89
- return;
90
- const len = this.#itemOrder.length;
91
- let targetIndex;
92
- switch (direction) {
93
- case "next":
94
- if (currentIndex < len - 1) {
95
- targetIndex = currentIndex + 1;
96
- }
97
- else if (this.loopFocus) {
113
+ static tagName = "dui-accordion";
114
+ static styles = [base, styles];
115
+ #value_accessor_storage = __runInitializers(this, _value_initializers, undefined);
116
+ get value() { return this.#value_accessor_storage; }
117
+ set value(value) { this.#value_accessor_storage = value; }
118
+ #defaultValue_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _defaultValue_initializers, []));
119
+ get defaultValue() { return this.#defaultValue_accessor_storage; }
120
+ set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
121
+ #disabled_accessor_storage = (__runInitializers(this, _defaultValue_extraInitializers), __runInitializers(this, _disabled_initializers, false));
122
+ get disabled() { return this.#disabled_accessor_storage; }
123
+ set disabled(value) { this.#disabled_accessor_storage = value; }
124
+ #multiple_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _multiple_initializers, false));
125
+ get multiple() { return this.#multiple_accessor_storage; }
126
+ set multiple(value) { this.#multiple_accessor_storage = value; }
127
+ #loopFocus_accessor_storage = (__runInitializers(this, _multiple_extraInitializers), __runInitializers(this, _loopFocus_initializers, true));
128
+ get loopFocus() { return this.#loopFocus_accessor_storage; }
129
+ set loopFocus(value) { this.#loopFocus_accessor_storage = value; }
130
+ #orientation_accessor_storage = (__runInitializers(this, _loopFocus_extraInitializers), __runInitializers(this, _orientation_initializers, "vertical"));
131
+ get orientation() { return this.#orientation_accessor_storage; }
132
+ set orientation(value) { this.#orientation_accessor_storage = value; }
133
+ #keepMounted_accessor_storage = (__runInitializers(this, _orientation_extraInitializers), __runInitializers(this, _keepMounted_initializers, false));
134
+ get keepMounted() { return this.#keepMounted_accessor_storage; }
135
+ set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
136
+ #internalOpenValues_accessor_storage = (__runInitializers(this, _keepMounted_extraInitializers), __runInitializers(this, _private_internalOpenValues_initializers, []));
137
+ get #internalOpenValues() { return _private_internalOpenValues_descriptor.get.call(this); }
138
+ set #internalOpenValues(value) { return _private_internalOpenValues_descriptor.set.call(this, value); }
139
+ #itemRegistry = (__runInitializers(this, _private_internalOpenValues_extraInitializers), new Map());
140
+ #itemOrder = [];
141
+ #getOpenValues = () => this.value ?? this.#internalOpenValues;
142
+ #toggle = (value) => {
143
+ const current = [...this.#getOpenValues()];
144
+ const index = current.indexOf(value);
145
+ let next;
146
+ if (index >= 0) {
147
+ next = current.filter((v) => v !== value);
148
+ }
149
+ else if (this.multiple) {
150
+ next = [...current, value];
151
+ }
152
+ else {
153
+ next = [value];
154
+ }
155
+ if (this.value === undefined) {
156
+ this.#internalOpenValues = next;
157
+ }
158
+ this.dispatchEvent(valueChangeEvent(next));
159
+ };
160
+ #registerItem = (value, el) => {
161
+ this.#itemRegistry.set(value, el);
162
+ if (!this.#itemOrder.includes(value)) {
163
+ this.#itemOrder.push(value);
164
+ }
165
+ };
166
+ #unregisterItem = (value) => {
167
+ this.#itemRegistry.delete(value);
168
+ this.#itemOrder = this.#itemOrder.filter((v) => v !== value);
169
+ };
170
+ #focusItem = (value, direction) => {
171
+ const currentIndex = this.#itemOrder.indexOf(value);
172
+ if (currentIndex === -1)
173
+ return;
174
+ const len = this.#itemOrder.length;
175
+ let targetIndex;
176
+ switch (direction) {
177
+ case "next":
178
+ if (currentIndex < len - 1) {
179
+ targetIndex = currentIndex + 1;
180
+ }
181
+ else if (this.loopFocus) {
182
+ targetIndex = 0;
183
+ }
184
+ break;
185
+ case "prev":
186
+ if (currentIndex > 0) {
187
+ targetIndex = currentIndex - 1;
188
+ }
189
+ else if (this.loopFocus) {
190
+ targetIndex = len - 1;
191
+ }
192
+ break;
193
+ case "first":
98
194
  targetIndex = 0;
99
- }
100
- break;
101
- case "prev":
102
- if (currentIndex > 0) {
103
- targetIndex = currentIndex - 1;
104
- }
105
- else if (this.loopFocus) {
195
+ break;
196
+ case "last":
106
197
  targetIndex = len - 1;
107
- }
108
- break;
109
- case "first":
110
- targetIndex = 0;
111
- break;
112
- case "last":
113
- targetIndex = len - 1;
114
- break;
198
+ break;
199
+ }
200
+ if (targetIndex !== undefined) {
201
+ const targetValue = this.#itemOrder[targetIndex];
202
+ const targetEl = this.#itemRegistry.get(targetValue);
203
+ const trigger = targetEl?.shadowRoot?.querySelector("[part='trigger']");
204
+ trigger?.focus();
205
+ }
206
+ };
207
+ #_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
208
+ get _ctx() { return this.#_ctx_accessor_storage; }
209
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
210
+ #buildContext() {
211
+ return {
212
+ openValues: this.#getOpenValues(),
213
+ disabled: this.disabled,
214
+ orientation: this.orientation,
215
+ loopFocus: this.loopFocus,
216
+ keepMounted: this.keepMounted,
217
+ toggle: this.#toggle,
218
+ registerItem: this.#registerItem,
219
+ unregisterItem: this.#unregisterItem,
220
+ focusItem: this.#focusItem,
221
+ };
115
222
  }
116
- if (targetIndex !== undefined) {
117
- const targetValue = this.#itemOrder[targetIndex];
118
- const targetEl = this.#itemRegistry.get(targetValue);
119
- const trigger = targetEl?.shadowRoot?.querySelector("[part='trigger']");
120
- trigger?.focus();
223
+ connectedCallback() {
224
+ super.connectedCallback();
225
+ if (this.value === undefined && this.defaultValue.length > 0) {
226
+ this.#internalOpenValues = [...this.defaultValue];
227
+ }
228
+ this._ctx = this.#buildContext();
121
229
  }
122
- };
123
- #_ctx_accessor_storage = this.#buildContext();
124
- get _ctx() { return this.#_ctx_accessor_storage; }
125
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
126
- #buildContext() {
127
- return {
128
- openValues: this.#getOpenValues(),
129
- disabled: this.disabled,
130
- orientation: this.orientation,
131
- loopFocus: this.loopFocus,
132
- keepMounted: this.keepMounted,
133
- toggle: this.#toggle,
134
- registerItem: this.#registerItem,
135
- unregisterItem: this.#unregisterItem,
136
- focusItem: this.#focusItem,
137
- };
138
- }
139
- connectedCallback() {
140
- super.connectedCallback();
141
- if (this.value === undefined && this.defaultValue.length > 0) {
142
- this.#internalOpenValues = [...this.defaultValue];
230
+ willUpdate() {
231
+ this._ctx = this.#buildContext();
143
232
  }
144
- this._ctx = this.#buildContext();
145
- }
146
- willUpdate() {
147
- this._ctx = this.#buildContext();
148
- }
149
- render() {
150
- return html `
233
+ render() {
234
+ return html `
151
235
  <div
152
236
  part="root"
153
237
  data-orientation=${this.orientation}
@@ -156,30 +240,11 @@ export class DuiAccordion extends LitElement {
156
240
  <slot></slot>
157
241
  </div>
158
242
  `;
159
- }
160
- }
161
- __decorate([
162
- property({ type: Array })
163
- ], DuiAccordion.prototype, "value", null);
164
- __decorate([
165
- property({ type: Array, attribute: "default-value" })
166
- ], DuiAccordion.prototype, "defaultValue", null);
167
- __decorate([
168
- property({ type: Boolean })
169
- ], DuiAccordion.prototype, "disabled", null);
170
- __decorate([
171
- property({ type: Boolean })
172
- ], DuiAccordion.prototype, "multiple", null);
173
- __decorate([
174
- property({ type: Boolean, attribute: "loop-focus" })
175
- ], DuiAccordion.prototype, "loopFocus", null);
176
- __decorate([
177
- property({ type: String })
178
- ], DuiAccordion.prototype, "orientation", null);
179
- __decorate([
180
- property({ type: Boolean, attribute: "keep-mounted" })
181
- ], DuiAccordion.prototype, "keepMounted", null);
182
- __decorate([
183
- provide({ context: accordionContext }),
184
- state()
185
- ], DuiAccordion.prototype, "_ctx", null);
243
+ }
244
+ constructor() {
245
+ super(...arguments);
246
+ __runInitializers(this, __ctx_extraInitializers);
247
+ }
248
+ };
249
+ })();
250
+ export { DuiAccordion };
@@ -1,3 +1,6 @@
1
- export { DuiAccordion, valueChangeEvent } from "./accordion.js";
2
- export { DuiAccordionItem, openChangeEvent } from "./accordion-item.js";
1
+ import { DuiAccordion, valueChangeEvent } from "./accordion.js";
2
+ export { DuiAccordion, valueChangeEvent };
3
+ import { DuiAccordionItem, openChangeEvent } from "./accordion-item.js";
4
+ export { DuiAccordionItem, openChangeEvent };
3
5
  export type { AccordionContext } from "./accordion-context.js";
6
+ export declare const accordionFamily: (typeof DuiAccordion | typeof DuiAccordionItem)[];
@@ -1,2 +1,5 @@
1
- export { DuiAccordion, valueChangeEvent } from "./accordion.js";
2
- export { DuiAccordionItem, openChangeEvent } from "./accordion-item.js";
1
+ import { DuiAccordion, valueChangeEvent } from "./accordion.js";
2
+ export { DuiAccordion, valueChangeEvent };
3
+ import { DuiAccordionItem, openChangeEvent } from "./accordion-item.js";
4
+ export { DuiAccordionItem, openChangeEvent };
5
+ export const accordionFamily = [DuiAccordion, DuiAccordionItem];
@@ -16,8 +16,8 @@ const hostStyles = css `
16
16
  * @slot - Content that closes the alert dialog (usually a button).
17
17
  */
18
18
  export class DuiAlertDialogClose extends LitElement {
19
- static { this.tagName = "dui-alert-dialog-close"; }
20
- static { this.styles = [base, hostStyles]; }
19
+ static tagName = "dui-alert-dialog-close";
20
+ static styles = [base, hostStyles];
21
21
  #ctx = new ContextConsumer(this, {
22
22
  context: alertDialogContext,
23
23
  subscribe: true,