@voidable/ui 0.5.2 → 0.5.4

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 (194) hide show
  1. package/dist/base.d.ts +5 -0
  2. package/dist/base.d.ts.map +1 -0
  3. package/dist/base.js +9 -0
  4. package/dist/chunks/decorate-DKuCkHK4.js +9 -0
  5. package/dist/components/accordion.d.ts +25 -0
  6. package/dist/components/accordion.d.ts.map +1 -0
  7. package/dist/components/accordion.js +73 -0
  8. package/dist/components/action-input.d.ts +28 -0
  9. package/dist/components/action-input.d.ts.map +1 -0
  10. package/dist/components/action-input.js +117 -0
  11. package/dist/components/alert.d.ts +20 -0
  12. package/dist/components/alert.d.ts.map +1 -0
  13. package/dist/components/alert.js +40 -0
  14. package/dist/components/avatar.d.ts +18 -0
  15. package/dist/components/avatar.d.ts.map +1 -0
  16. package/dist/components/avatar.js +36 -0
  17. package/dist/components/badge.d.ts +14 -0
  18. package/dist/components/badge.d.ts.map +1 -0
  19. package/dist/components/badge.js +24 -0
  20. package/dist/components/banner.d.ts +20 -0
  21. package/dist/components/banner.d.ts.map +1 -0
  22. package/dist/components/banner.js +40 -0
  23. package/dist/components/breadcrumbs.d.ts +16 -0
  24. package/dist/components/breadcrumbs.d.ts.map +1 -0
  25. package/dist/components/breadcrumbs.js +33 -0
  26. package/dist/components/button.d.ts +25 -0
  27. package/dist/components/button.d.ts.map +1 -0
  28. package/dist/components/button.js +56 -0
  29. package/dist/components/calendar.d.ts +75 -0
  30. package/dist/components/calendar.d.ts.map +1 -0
  31. package/dist/components/calendar.js +417 -0
  32. package/dist/components/card.d.ts +18 -0
  33. package/dist/components/card.d.ts.map +1 -0
  34. package/dist/components/card.js +32 -0
  35. package/dist/components/carousel.d.ts +41 -0
  36. package/dist/components/carousel.d.ts.map +1 -0
  37. package/dist/components/carousel.js +145 -0
  38. package/dist/components/checkbox-group.d.ts +20 -0
  39. package/dist/components/checkbox-group.d.ts.map +1 -0
  40. package/dist/components/checkbox-group.js +48 -0
  41. package/dist/components/checkbox.d.ts +25 -0
  42. package/dist/components/checkbox.d.ts.map +1 -0
  43. package/dist/components/checkbox.js +69 -0
  44. package/dist/components/collapsible.d.ts +21 -0
  45. package/dist/components/collapsible.d.ts.map +1 -0
  46. package/dist/components/collapsible.js +61 -0
  47. package/dist/components/color-picker.d.ts +47 -0
  48. package/dist/components/color-picker.d.ts.map +1 -0
  49. package/dist/components/color-picker.js +217 -0
  50. package/dist/components/combobox.d.ts +30 -0
  51. package/dist/components/combobox.d.ts.map +1 -0
  52. package/dist/components/combobox.js +89 -0
  53. package/dist/components/compose-input.d.ts +19 -0
  54. package/dist/components/compose-input.d.ts.map +1 -0
  55. package/dist/components/compose-input.js +71 -0
  56. package/dist/components/dialog.d.ts +26 -0
  57. package/dist/components/dialog.d.ts.map +1 -0
  58. package/dist/components/dialog.js +64 -0
  59. package/dist/components/divider.d.ts +16 -0
  60. package/dist/components/divider.d.ts.map +1 -0
  61. package/dist/components/divider.js +28 -0
  62. package/dist/components/drawer.d.ts +26 -0
  63. package/dist/components/drawer.d.ts.map +1 -0
  64. package/dist/components/drawer.js +62 -0
  65. package/dist/components/dropdown-menu.d.ts +29 -0
  66. package/dist/components/dropdown-menu.d.ts.map +1 -0
  67. package/dist/components/dropdown-menu.js +72 -0
  68. package/dist/components/editable.d.ts +27 -0
  69. package/dist/components/editable.d.ts.map +1 -0
  70. package/dist/components/editable.js +82 -0
  71. package/dist/components/error-fallback.d.ts +18 -0
  72. package/dist/components/error-fallback.d.ts.map +1 -0
  73. package/dist/components/error-fallback.js +35 -0
  74. package/dist/components/field.d.ts +19 -0
  75. package/dist/components/field.d.ts.map +1 -0
  76. package/dist/components/field.js +42 -0
  77. package/dist/components/file-upload.d.ts +26 -0
  78. package/dist/components/file-upload.d.ts.map +1 -0
  79. package/dist/components/file-upload.js +99 -0
  80. package/dist/components/hamburger.d.ts +18 -0
  81. package/dist/components/hamburger.d.ts.map +1 -0
  82. package/dist/components/hamburger.js +45 -0
  83. package/dist/components/hover-card.d.ts +31 -0
  84. package/dist/components/hover-card.d.ts.map +1 -0
  85. package/dist/components/hover-card.js +80 -0
  86. package/dist/components/indicator.d.ts +20 -0
  87. package/dist/components/indicator.d.ts.map +1 -0
  88. package/dist/components/indicator.js +39 -0
  89. package/dist/components/input.d.ts +23 -0
  90. package/dist/components/input.d.ts.map +1 -0
  91. package/dist/components/input.js +73 -0
  92. package/dist/components/list.d.ts +22 -0
  93. package/dist/components/list.d.ts.map +1 -0
  94. package/dist/components/list.js +45 -0
  95. package/dist/components/menu.d.ts +50 -0
  96. package/dist/components/menu.d.ts.map +1 -0
  97. package/dist/components/menu.js +162 -0
  98. package/dist/components/multiselect.d.ts +35 -0
  99. package/dist/components/multiselect.d.ts.map +1 -0
  100. package/dist/components/multiselect.js +118 -0
  101. package/dist/components/nav-bar.d.ts +18 -0
  102. package/dist/components/nav-bar.d.ts.map +1 -0
  103. package/dist/components/nav-bar.js +35 -0
  104. package/dist/components/nav-menu.d.ts +42 -0
  105. package/dist/components/nav-menu.d.ts.map +1 -0
  106. package/dist/components/nav-menu.js +122 -0
  107. package/dist/components/number-input.d.ts +41 -0
  108. package/dist/components/number-input.d.ts.map +1 -0
  109. package/dist/components/number-input.js +143 -0
  110. package/dist/components/pagination.d.ts +17 -0
  111. package/dist/components/pagination.d.ts.map +1 -0
  112. package/dist/components/pagination.js +62 -0
  113. package/dist/components/panel.d.ts +18 -0
  114. package/dist/components/panel.d.ts.map +1 -0
  115. package/dist/components/panel.js +31 -0
  116. package/dist/components/pin-input.d.ts +33 -0
  117. package/dist/components/pin-input.d.ts.map +1 -0
  118. package/dist/components/pin-input.js +132 -0
  119. package/dist/components/popover.d.ts +24 -0
  120. package/dist/components/popover.d.ts.map +1 -0
  121. package/dist/components/popover.js +52 -0
  122. package/dist/components/progress.d.ts +18 -0
  123. package/dist/components/progress.d.ts.map +1 -0
  124. package/dist/components/progress.js +38 -0
  125. package/dist/components/radio-group.d.ts +24 -0
  126. package/dist/components/radio-group.d.ts.map +1 -0
  127. package/dist/components/radio-group.js +56 -0
  128. package/dist/components/radio.d.ts +24 -0
  129. package/dist/components/radio.d.ts.map +1 -0
  130. package/dist/components/radio.js +68 -0
  131. package/dist/components/scroll-area.d.ts +17 -0
  132. package/dist/components/scroll-area.d.ts.map +1 -0
  133. package/dist/components/scroll-area.js +30 -0
  134. package/dist/components/segmented-control.d.ts +27 -0
  135. package/dist/components/segmented-control.d.ts.map +1 -0
  136. package/dist/components/segmented-control.js +70 -0
  137. package/dist/components/select.d.ts +23 -0
  138. package/dist/components/select.d.ts.map +1 -0
  139. package/dist/components/select.js +64 -0
  140. package/dist/components/sidebar.d.ts +18 -0
  141. package/dist/components/sidebar.d.ts.map +1 -0
  142. package/dist/components/sidebar.js +40 -0
  143. package/dist/components/skeleton.d.ts +12 -0
  144. package/dist/components/skeleton.d.ts.map +1 -0
  145. package/dist/components/skeleton.js +18 -0
  146. package/dist/components/slider.d.ts +24 -0
  147. package/dist/components/slider.d.ts.map +1 -0
  148. package/dist/components/slider.js +68 -0
  149. package/dist/components/spinner.d.ts +15 -0
  150. package/dist/components/spinner.d.ts.map +1 -0
  151. package/dist/components/spinner.js +28 -0
  152. package/dist/components/stat.d.ts +18 -0
  153. package/dist/components/stat.d.ts.map +1 -0
  154. package/dist/components/stat.js +41 -0
  155. package/dist/components/status-dot.d.ts +14 -0
  156. package/dist/components/status-dot.d.ts.map +1 -0
  157. package/dist/components/status-dot.js +28 -0
  158. package/dist/components/stepper.d.ts +14 -0
  159. package/dist/components/stepper.d.ts.map +1 -0
  160. package/dist/components/stepper.js +45 -0
  161. package/dist/components/switch.d.ts +20 -0
  162. package/dist/components/switch.d.ts.map +1 -0
  163. package/dist/components/switch.js +45 -0
  164. package/dist/components/table.d.ts +14 -0
  165. package/dist/components/table.d.ts.map +1 -0
  166. package/dist/components/table.js +24 -0
  167. package/dist/components/tabs.d.ts +28 -0
  168. package/dist/components/tabs.d.ts.map +1 -0
  169. package/dist/components/tabs.js +76 -0
  170. package/dist/components/tag.d.ts +20 -0
  171. package/dist/components/tag.d.ts.map +1 -0
  172. package/dist/components/tag.js +41 -0
  173. package/dist/components/tags-input.d.ts +34 -0
  174. package/dist/components/tags-input.d.ts.map +1 -0
  175. package/dist/components/tags-input.js +109 -0
  176. package/dist/components/textarea.d.ts +24 -0
  177. package/dist/components/textarea.d.ts.map +1 -0
  178. package/dist/components/textarea.js +77 -0
  179. package/dist/components/toast.d.ts +36 -0
  180. package/dist/components/toast.d.ts.map +1 -0
  181. package/dist/components/toast.js +55 -0
  182. package/dist/components/toggle-group.d.ts +24 -0
  183. package/dist/components/toggle-group.d.ts.map +1 -0
  184. package/dist/components/toggle-group.js +80 -0
  185. package/dist/components/toggle.d.ts +15 -0
  186. package/dist/components/toggle.d.ts.map +1 -0
  187. package/dist/components/toggle.js +44 -0
  188. package/dist/components/tooltip.d.ts +26 -0
  189. package/dist/components/tooltip.d.ts.map +1 -0
  190. package/dist/components/tooltip.js +45 -0
  191. package/dist/index.d.ts +64 -1157
  192. package/dist/index.d.ts.map +1 -0
  193. package/dist/index.js +64 -4078
  194. package/package.json +20 -1
package/dist/index.js CHANGED
@@ -1,4078 +1,64 @@
1
- import { LitElement as e, html as t, nothing as n } from "lit";
2
- import { property as r, query as i, state as a } from "lit/decorators.js";
3
- //#region src/base.ts
4
- var o = class extends e {
5
- createRenderRoot() {
6
- return this;
7
- }
8
- };
9
- //#endregion
10
- //#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
11
- function s(e, t, n, r) {
12
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
13
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
14
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
15
- return i > 3 && a && Object.defineProperty(t, n, a), a;
16
- }
17
- //#endregion
18
- //#region src/components/badge.ts
19
- var c = class extends o {
20
- constructor(...e) {
21
- super(...e), this.color = "default", this.variant = "filled", this.size = "md";
22
- }
23
- connectedCallback() {
24
- super.connectedCallback(), this.setAttribute("role", "status");
25
- }
26
- };
27
- s([r({
28
- type: String,
29
- reflect: !0
30
- })], c.prototype, "color", void 0), s([r({
31
- type: String,
32
- reflect: !0
33
- })], c.prototype, "variant", void 0), s([r({
34
- type: String,
35
- reflect: !0
36
- })], c.prototype, "size", void 0), customElements.get("void-badge") || customElements.define("void-badge", c);
37
- //#endregion
38
- //#region src/components/button.ts
39
- var l = class extends o {
40
- static {
41
- this.formAssociated = !0;
42
- }
43
- constructor() {
44
- super(), this.variant = "outline", this.color = "default", this.disabled = !1, this.type = "button", this.size = "md", this._internals = null, this._handleClick = (e) => {
45
- if (this.disabled) {
46
- e.stopImmediatePropagation();
47
- return;
48
- }
49
- this.type === "submit" ? this._form?.requestSubmit() : this.type === "reset" && this._form?.reset(), this.dispatchEvent(new CustomEvent("void-click", {
50
- bubbles: !0,
51
- composed: !0
52
- }));
53
- }, this._handleKeydown = (e) => {
54
- (e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
55
- };
56
- try {
57
- this._internals = this.attachInternals();
58
- } catch {}
59
- }
60
- get _form() {
61
- return this._internals?.form ?? this.closest("form");
62
- }
63
- connectedCallback() {
64
- super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("tabindex", "0"), this.setAttribute("aria-disabled", String(this.disabled)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
65
- }
66
- disconnectedCallback() {
67
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
68
- }
69
- updated(e) {
70
- e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
71
- }
72
- };
73
- s([r({
74
- type: String,
75
- reflect: !0
76
- })], l.prototype, "variant", void 0), s([r({
77
- type: String,
78
- reflect: !0
79
- })], l.prototype, "color", void 0), s([r({
80
- type: Boolean,
81
- reflect: !0
82
- })], l.prototype, "disabled", void 0), s([r({
83
- type: String,
84
- reflect: !0
85
- })], l.prototype, "type", void 0), s([r({
86
- type: String,
87
- reflect: !0
88
- })], l.prototype, "size", void 0), customElements.get("void-button") || customElements.define("void-button", l);
89
- //#endregion
90
- //#region src/components/divider.ts
91
- var u = class extends o {
92
- constructor(...e) {
93
- super(...e), this.label = void 0, this.orientation = "horizontal";
94
- }
95
- connectedCallback() {
96
- super.connectedCallback(), this.setAttribute("role", "separator"), this.setAttribute("aria-orientation", this.orientation);
97
- }
98
- updated(e) {
99
- e.has("orientation") && this.setAttribute("aria-orientation", this.orientation);
100
- }
101
- render() {
102
- return this.label ? t`${this.label}` : n;
103
- }
104
- };
105
- s([r({
106
- type: String,
107
- reflect: !0
108
- })], u.prototype, "label", void 0), s([r({
109
- type: String,
110
- reflect: !0
111
- })], u.prototype, "orientation", void 0), customElements.get("void-divider") || customElements.define("void-divider", u);
112
- //#endregion
113
- //#region src/components/spinner.ts
114
- var ee = class extends o {
115
- constructor(...e) {
116
- super(...e), this.size = "md", this.label = "Loading";
117
- }
118
- connectedCallback() {
119
- super.connectedCallback(), this.setAttribute("role", "status"), this.setAttribute("aria-label", this.label);
120
- }
121
- updated(e) {
122
- e.has("label") && this.setAttribute("aria-label", this.label);
123
- }
124
- render() {
125
- return t`<span data-void-sr>${this.label}</span>`;
126
- }
127
- };
128
- s([r({
129
- type: String,
130
- reflect: !0
131
- })], ee.prototype, "size", void 0), s([r({
132
- type: String,
133
- reflect: !0
134
- })], ee.prototype, "label", void 0), customElements.get("void-spinner") || customElements.define("void-spinner", ee);
135
- //#endregion
136
- //#region src/components/skeleton.ts
137
- var te = class extends o {
138
- constructor(...e) {
139
- super(...e), this.variant = "text";
140
- }
141
- connectedCallback() {
142
- super.connectedCallback(), this.setAttribute("role", "presentation"), this.setAttribute("aria-hidden", "true");
143
- }
144
- };
145
- s([r({
146
- type: String,
147
- reflect: !0
148
- })], te.prototype, "variant", void 0), customElements.get("void-skeleton") || customElements.define("void-skeleton", te);
149
- //#endregion
150
- //#region src/components/status-dot.ts
151
- var ne = class extends o {
152
- constructor(...e) {
153
- super(...e), this.status = "offline";
154
- }
155
- connectedCallback() {
156
- super.connectedCallback(), this.setAttribute("role", "status"), this.setAttribute("aria-label", this._ariaLabel());
157
- }
158
- updated(e) {
159
- e.has("status") && this.setAttribute("aria-label", this._ariaLabel());
160
- }
161
- _ariaLabel() {
162
- switch (this.status) {
163
- case "online": return "Online";
164
- case "away": return "Away";
165
- default: return "Offline";
166
- }
167
- }
168
- };
169
- s([r({
170
- type: String,
171
- reflect: !0
172
- })], ne.prototype, "status", void 0), customElements.get("void-status-dot") || customElements.define("void-status-dot", ne);
173
- //#endregion
174
- //#region src/components/switch.ts
175
- var d = class extends o {
176
- constructor(...e) {
177
- super(...e), this.checked = !1, this.disabled = !1, this.color = "default", this.size = "md", this._handleClick = () => {
178
- this.disabled || (this.checked = !this.checked, this.dispatchEvent(new CustomEvent("void-change", {
179
- bubbles: !0,
180
- composed: !0,
181
- detail: { checked: this.checked }
182
- })));
183
- }, this._handleKeydown = (e) => {
184
- (e.key === " " || e.key === "Enter") && !this.disabled && (e.preventDefault(), this._handleClick());
185
- };
186
- }
187
- connectedCallback() {
188
- super.connectedCallback(), this.setAttribute("role", "switch"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-checked", String(this.checked)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
189
- }
190
- disconnectedCallback() {
191
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
192
- }
193
- updated(e) {
194
- e.has("checked") && this.setAttribute("aria-checked", String(this.checked)), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
195
- }
196
- render() {
197
- return t`<span class="void-switch-track"><span class="void-switch-thumb"></span></span>`;
198
- }
199
- };
200
- s([r({
201
- type: Boolean,
202
- reflect: !0
203
- })], d.prototype, "checked", void 0), s([r({
204
- type: Boolean,
205
- reflect: !0
206
- })], d.prototype, "disabled", void 0), s([r({
207
- type: String,
208
- reflect: !0
209
- })], d.prototype, "color", void 0), s([r({
210
- type: String,
211
- reflect: !0
212
- })], d.prototype, "size", void 0), customElements.get("void-switch") || customElements.define("void-switch", d);
213
- //#endregion
214
- //#region src/components/avatar.ts
215
- var f = class extends o {
216
- constructor(...e) {
217
- super(...e), this.src = "", this.alt = "", this.initials = "", this.size = "md", this._onImgError = () => {
218
- this.src = "";
219
- };
220
- }
221
- connectedCallback() {
222
- super.connectedCallback(), this.setAttribute("role", "img"), this.setAttribute("aria-label", this.alt || this.initials);
223
- }
224
- updated(e) {
225
- (e.has("alt") || e.has("initials")) && this.setAttribute("aria-label", this.alt || this.initials);
226
- }
227
- render() {
228
- return this.src ? t`<img src="${this.src}" alt="${this.alt}" @error="${this._onImgError}" />` : this.initials ? t`<span class="void-avatar-initials">${this.initials}</span>` : t``;
229
- }
230
- };
231
- s([r({
232
- type: String,
233
- reflect: !0
234
- })], f.prototype, "src", void 0), s([r({
235
- type: String,
236
- reflect: !0
237
- })], f.prototype, "alt", void 0), s([r({
238
- type: String,
239
- reflect: !0
240
- })], f.prototype, "initials", void 0), s([r({
241
- type: String,
242
- reflect: !0
243
- })], f.prototype, "size", void 0), customElements.get("void-avatar") || customElements.define("void-avatar", f);
244
- //#endregion
245
- //#region src/components/alert.ts
246
- var re = class extends o {
247
- constructor(...e) {
248
- super(...e), this.color = "default", this.dismissible = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
249
- }
250
- connectedCallback() {
251
- super.connectedCallback(), this.setAttribute("role", "alert"), this._didSetup || (this._userContent = Array.from(this.childNodes));
252
- }
253
- updated(e) {
254
- if (super.updated(e), !this._didSetup) {
255
- this._didSetup = !0;
256
- for (let e of this._userContent) this.appendChild(e);
257
- }
258
- }
259
- _dismiss() {
260
- this.dispatchEvent(new CustomEvent("void-dismiss", {
261
- bubbles: !0,
262
- composed: !0
263
- })), this.remove();
264
- }
265
- render() {
266
- return this.dismissible ? t`<button class="void-alert-close" aria-label="Dismiss" @click="${this._dismiss}">&times;</button>` : n;
267
- }
268
- };
269
- s([r({
270
- type: String,
271
- reflect: !0
272
- })], re.prototype, "color", void 0), s([r({
273
- type: Boolean,
274
- reflect: !0
275
- })], re.prototype, "dismissible", void 0), s([r({
276
- type: String,
277
- reflect: !0
278
- })], re.prototype, "variant", void 0), customElements.get("void-alert") || customElements.define("void-alert", re);
279
- //#endregion
280
- //#region src/components/tag.ts
281
- var ie = class extends o {
282
- constructor(...e) {
283
- super(...e), this.color = "default", this.removable = !1, this.size = "md", this._userContent = [], this._didSetup = !1;
284
- }
285
- connectedCallback() {
286
- super.connectedCallback(), this.setAttribute("role", "listitem"), this._didSetup || (this._userContent = Array.from(this.childNodes));
287
- }
288
- updated(e) {
289
- if (super.updated(e), !this._didSetup) {
290
- this._didSetup = !0;
291
- let e = this.querySelector(".void-tag-close");
292
- for (let t of this._userContent) e ? this.insertBefore(t, e) : this.appendChild(t);
293
- }
294
- }
295
- render() {
296
- return this.removable ? t`<button class="void-tag-close" aria-label="Remove" @click="${this._remove}">×</button>` : n;
297
- }
298
- _remove() {
299
- this.dispatchEvent(new CustomEvent("void-remove", {
300
- bubbles: !0,
301
- composed: !0
302
- })), this.remove();
303
- }
304
- };
305
- s([r({
306
- type: String,
307
- reflect: !0
308
- })], ie.prototype, "color", void 0), s([r({
309
- type: Boolean,
310
- reflect: !0
311
- })], ie.prototype, "removable", void 0), s([r({
312
- type: String,
313
- reflect: !0
314
- })], ie.prototype, "size", void 0), customElements.get("void-tag") || customElements.define("void-tag", ie);
315
- //#endregion
316
- //#region src/components/progress.ts
317
- var p = class extends o {
318
- constructor(...e) {
319
- super(...e), this.value = 0, this.max = 100, this.color = "default", this.size = "md", this.indeterminate = !1;
320
- }
321
- connectedCallback() {
322
- super.connectedCallback(), this.setAttribute("role", "progressbar"), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuemax", String(this.max)), this.indeterminate || this.setAttribute("aria-valuenow", String(this.value));
323
- }
324
- updated(e) {
325
- e.has("max") && this.setAttribute("aria-valuemax", String(this.max)), (e.has("value") || e.has("indeterminate")) && (this.indeterminate ? this.removeAttribute("aria-valuenow") : this.setAttribute("aria-valuenow", String(this.value)));
326
- }
327
- render() {
328
- let e = Math.min(100, Math.max(0, this.value / this.max * 100));
329
- return t`<div class="void-progress-track"><div class="void-progress-fill" style="--void-progress-fill: ${this.indeterminate ? "0%" : e + "%"}"></div></div>`;
330
- }
331
- };
332
- s([r({
333
- type: Number,
334
- reflect: !0
335
- })], p.prototype, "value", void 0), s([r({
336
- type: Number,
337
- reflect: !0
338
- })], p.prototype, "max", void 0), s([r({
339
- type: String,
340
- reflect: !0
341
- })], p.prototype, "color", void 0), s([r({
342
- type: String,
343
- reflect: !0
344
- })], p.prototype, "size", void 0), s([r({
345
- type: Boolean,
346
- reflect: !0
347
- })], p.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", p);
348
- //#endregion
349
- //#region src/components/panel.ts
350
- var ae = class extends o {
351
- constructor(...e) {
352
- super(...e), this.label = "", this.variant = "default", this._userContent = [], this._didSetup = !1;
353
- }
354
- connectedCallback() {
355
- super.connectedCallback(), this.setAttribute("role", "region"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes));
356
- }
357
- updated(e) {
358
- if (super.updated(e), e.has("label") && (this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label")), !this._didSetup) {
359
- this._didSetup = !0;
360
- for (let e of this._userContent) this.appendChild(e);
361
- }
362
- }
363
- render() {
364
- return this.label ? t`<div class="void-panel-label">${this.label}</div>` : n;
365
- }
366
- };
367
- s([r({
368
- type: String,
369
- reflect: !0
370
- })], ae.prototype, "label", void 0), s([r({
371
- type: String,
372
- reflect: !0
373
- })], ae.prototype, "variant", void 0), customElements.get("void-panel") || customElements.define("void-panel", ae);
374
- //#endregion
375
- //#region src/components/input.ts
376
- var m = class extends o {
377
- constructor(...e) {
378
- super(...e), this.type = "text", this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.name = "", this.size = "md", this.error = "";
379
- }
380
- connectedCallback() {
381
- super.connectedCallback(), this.setAttribute("role", "textbox");
382
- }
383
- render() {
384
- return t`
385
- <input
386
- type=${this.type}
387
- .value=${this.value}
388
- placeholder=${this.placeholder}
389
- ?disabled=${this.disabled}
390
- ?readonly=${this.readonly}
391
- ?required=${this.required}
392
- name=${this.name}
393
- aria-invalid=${this.error ? "true" : "false"}
394
- @input=${this._onInput}
395
- @change=${this._onChange}
396
- />
397
- ${this.error ? t`<span class="void-input-error">${this.error}</span>` : ""}
398
- `;
399
- }
400
- _onInput(e) {
401
- let t = e.target;
402
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
403
- bubbles: !0,
404
- composed: !0,
405
- detail: { value: this.value }
406
- }));
407
- }
408
- _onChange(e) {
409
- let t = e.target;
410
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
411
- bubbles: !0,
412
- composed: !0,
413
- detail: { value: this.value }
414
- }));
415
- }
416
- };
417
- s([r({
418
- type: String,
419
- reflect: !0
420
- })], m.prototype, "type", void 0), s([r({ type: String })], m.prototype, "value", void 0), s([r({
421
- type: String,
422
- reflect: !0
423
- })], m.prototype, "placeholder", void 0), s([r({
424
- type: Boolean,
425
- reflect: !0
426
- })], m.prototype, "disabled", void 0), s([r({
427
- type: Boolean,
428
- reflect: !0
429
- })], m.prototype, "readonly", void 0), s([r({
430
- type: Boolean,
431
- reflect: !0
432
- })], m.prototype, "required", void 0), s([r({
433
- type: String,
434
- reflect: !0
435
- })], m.prototype, "name", void 0), s([r({
436
- type: String,
437
- reflect: !0
438
- })], m.prototype, "size", void 0), s([r({
439
- type: String,
440
- reflect: !0
441
- })], m.prototype, "error", void 0), customElements.get("void-input") || customElements.define("void-input", m);
442
- //#endregion
443
- //#region src/components/textarea.ts
444
- var h = class extends o {
445
- constructor(...e) {
446
- super(...e), this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.name = "", this.rows = 3, this.resize = "vertical", this.size = "md", this.error = "";
447
- }
448
- connectedCallback() {
449
- super.connectedCallback(), this.setAttribute("role", "textbox"), this.setAttribute("aria-multiline", "true");
450
- }
451
- render() {
452
- return t`
453
- <textarea
454
- .value=${this.value}
455
- placeholder=${this.placeholder}
456
- ?disabled=${this.disabled}
457
- ?readonly=${this.readonly}
458
- ?required=${this.required}
459
- name=${this.name}
460
- rows=${this.rows}
461
- style="--void-textarea-resize: ${this.resize}"
462
- aria-invalid=${this.error ? "true" : "false"}
463
- @input=${this._onInput}
464
- @change=${this._onChange}
465
- ></textarea>
466
- ${this.error ? t`<span class="void-textarea-error">${this.error}</span>` : ""}
467
- `;
468
- }
469
- _onInput(e) {
470
- let t = e.target;
471
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
472
- bubbles: !0,
473
- composed: !0,
474
- detail: { value: this.value }
475
- }));
476
- }
477
- _onChange(e) {
478
- let t = e.target;
479
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
480
- bubbles: !0,
481
- composed: !0,
482
- detail: { value: this.value }
483
- }));
484
- }
485
- };
486
- s([r({ type: String })], h.prototype, "value", void 0), s([r({
487
- type: String,
488
- reflect: !0
489
- })], h.prototype, "placeholder", void 0), s([r({
490
- type: Boolean,
491
- reflect: !0
492
- })], h.prototype, "disabled", void 0), s([r({
493
- type: Boolean,
494
- reflect: !0
495
- })], h.prototype, "readonly", void 0), s([r({
496
- type: Boolean,
497
- reflect: !0
498
- })], h.prototype, "required", void 0), s([r({
499
- type: String,
500
- reflect: !0
501
- })], h.prototype, "name", void 0), s([r({
502
- type: Number,
503
- reflect: !0
504
- })], h.prototype, "rows", void 0), s([r({
505
- type: String,
506
- reflect: !0
507
- })], h.prototype, "resize", void 0), s([r({
508
- type: String,
509
- reflect: !0
510
- })], h.prototype, "size", void 0), s([r({
511
- type: String,
512
- reflect: !0
513
- })], h.prototype, "error", void 0), customElements.get("void-textarea") || customElements.define("void-textarea", h);
514
- //#endregion
515
- //#region src/components/select.ts
516
- var g = class extends o {
517
- constructor(...e) {
518
- super(...e), this.value = "", this.disabled = !1, this.required = !1, this.name = "", this.size = "md", this.error = "", this.placeholder = "", this._options = [], this._didSetup = !1;
519
- }
520
- connectedCallback() {
521
- super.connectedCallback(), this._didSetup || (this._options = Array.from(this.childNodes));
522
- }
523
- updated(e) {
524
- if (super.updated(e), !this._didSetup) {
525
- this._didSetup = !0;
526
- let e = this.querySelector("select");
527
- if (e) {
528
- for (let t of this._options) e.appendChild(t);
529
- this.value && (e.value = this.value);
530
- }
531
- }
532
- }
533
- render() {
534
- return t`
535
- <select
536
- ?disabled=${this.disabled}
537
- ?required=${this.required}
538
- name=${this.name}
539
- aria-invalid=${this.error ? "true" : "false"}
540
- @change=${this._onChange}
541
- ></select>
542
- ${this.error ? t`<span class="void-select-error">${this.error}</span>` : ""}
543
- `;
544
- }
545
- _onChange(e) {
546
- let t = e.target;
547
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
548
- bubbles: !0,
549
- composed: !0,
550
- detail: { value: this.value }
551
- }));
552
- }
553
- };
554
- s([r({ type: String })], g.prototype, "value", void 0), s([r({
555
- type: Boolean,
556
- reflect: !0
557
- })], g.prototype, "disabled", void 0), s([r({
558
- type: Boolean,
559
- reflect: !0
560
- })], g.prototype, "required", void 0), s([r({
561
- type: String,
562
- reflect: !0
563
- })], g.prototype, "name", void 0), s([r({
564
- type: String,
565
- reflect: !0
566
- })], g.prototype, "size", void 0), s([r({
567
- type: String,
568
- reflect: !0
569
- })], g.prototype, "error", void 0), s([r({
570
- type: String,
571
- reflect: !0
572
- })], g.prototype, "placeholder", void 0), customElements.get("void-select") || customElements.define("void-select", g);
573
- //#endregion
574
- //#region src/components/checkbox.ts
575
- var _ = class extends o {
576
- constructor(...e) {
577
- super(...e), this.checked = !1, this.disabled = !1, this.indeterminate = !1, this.name = "", this.value = "", this.color = "default", this.size = "md", this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
578
- if (this.disabled) {
579
- e.stopImmediatePropagation();
580
- return;
581
- }
582
- this.indeterminate = !1, this.checked = !this.checked;
583
- let t = this.querySelector("input[type=\"checkbox\"]");
584
- t && (t.checked = this.checked), this.dispatchEvent(new CustomEvent("void-change", {
585
- bubbles: !0,
586
- composed: !0,
587
- detail: { checked: this.checked }
588
- }));
589
- }, this._handleKeydown = (e) => {
590
- e.key === " " && !this.disabled && (e.preventDefault(), this._handleClick(e));
591
- };
592
- }
593
- connectedCallback() {
594
- super.connectedCallback(), this.setAttribute("role", "checkbox"), this.setAttribute("tabindex", "0"), this.setAttribute("aria-checked", String(this.checked)), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
595
- }
596
- disconnectedCallback() {
597
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
598
- }
599
- updated(e) {
600
- if (super.updated(e), (e.has("checked") || e.has("indeterminate")) && (this.indeterminate ? this.setAttribute("aria-checked", "mixed") : this.setAttribute("aria-checked", String(this.checked))), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0")), !this._didSetup) {
601
- this._didSetup = !0;
602
- for (let e of this._userContent) this.appendChild(e);
603
- }
604
- }
605
- render() {
606
- return t`
607
- <input type="checkbox" .checked=${this.checked} .indeterminate=${this.indeterminate} ?disabled=${this.disabled} name=${this.name} value=${this.value} tabindex="-1" aria-hidden="true" />
608
- <span class="void-checkbox-box">
609
- ${this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : ""}
610
- ${this.indeterminate && !this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M3 6h6" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round"/></svg>` : ""}
611
- </span>
612
- `;
613
- }
614
- };
615
- s([r({
616
- type: Boolean,
617
- reflect: !0
618
- })], _.prototype, "checked", void 0), s([r({
619
- type: Boolean,
620
- reflect: !0
621
- })], _.prototype, "disabled", void 0), s([r({
622
- type: Boolean,
623
- reflect: !0
624
- })], _.prototype, "indeterminate", void 0), s([r({
625
- type: String,
626
- reflect: !0
627
- })], _.prototype, "name", void 0), s([r({
628
- type: String,
629
- reflect: !0
630
- })], _.prototype, "value", void 0), s([r({
631
- type: String,
632
- reflect: !0
633
- })], _.prototype, "color", void 0), s([r({
634
- type: String,
635
- reflect: !0
636
- })], _.prototype, "size", void 0), customElements.get("void-checkbox") || customElements.define("void-checkbox", _);
637
- //#endregion
638
- //#region src/components/radio.ts
639
- var v = class extends o {
640
- constructor(...e) {
641
- super(...e), this.checked = !1, this.disabled = !1, this.name = "", this.value = "", this.color = "default", this.size = "md", this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
642
- if (this.disabled || this.checked) {
643
- this.disabled && e.stopImmediatePropagation();
644
- return;
645
- }
646
- this.checked = !0;
647
- let t = this.querySelector("input[type=\"radio\"]");
648
- t && (t.checked = !0), this.dispatchEvent(new CustomEvent("void-change", {
649
- bubbles: !0,
650
- composed: !0,
651
- detail: {
652
- value: this.value,
653
- checked: !0
654
- }
655
- }));
656
- }, this._handleKeydown = (e) => {
657
- e.key === " " && !this.disabled && (e.preventDefault(), this._handleClick(e));
658
- };
659
- }
660
- connectedCallback() {
661
- super.connectedCallback(), this.setAttribute("role", "radio"), this.setAttribute("tabindex", "0"), this.setAttribute("aria-checked", String(this.checked)), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
662
- }
663
- disconnectedCallback() {
664
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
665
- }
666
- updated(e) {
667
- if (super.updated(e), e.has("checked") && this.setAttribute("aria-checked", String(this.checked)), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0")), !this._didSetup) {
668
- this._didSetup = !0;
669
- for (let e of this._userContent) this.appendChild(e);
670
- }
671
- }
672
- render() {
673
- return t`
674
- <input type="radio" .checked=${this.checked} ?disabled=${this.disabled} name=${this.name} value=${this.value} tabindex="-1" aria-hidden="true" />
675
- <span class="void-radio-circle">
676
- ${this.checked ? t`<span class="void-radio-dot"></span>` : ""}
677
- </span>
678
- `;
679
- }
680
- };
681
- s([r({
682
- type: Boolean,
683
- reflect: !0
684
- })], v.prototype, "checked", void 0), s([r({
685
- type: Boolean,
686
- reflect: !0
687
- })], v.prototype, "disabled", void 0), s([r({
688
- type: String,
689
- reflect: !0
690
- })], v.prototype, "name", void 0), s([r({
691
- type: String,
692
- reflect: !0
693
- })], v.prototype, "value", void 0), s([r({
694
- type: String,
695
- reflect: !0
696
- })], v.prototype, "color", void 0), s([r({
697
- type: String,
698
- reflect: !0
699
- })], v.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", v);
700
- //#endregion
701
- //#region src/components/radio-group.ts
702
- var y = class extends o {
703
- constructor(...e) {
704
- super(...e), this.label = "", this.value = "", this.name = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
705
- let t = e.target;
706
- if (!(!t || t.tagName.toLowerCase() !== "void-radio") && e.detail?.checked) {
707
- e.stopImmediatePropagation(), this.value = t.value;
708
- for (let e of this._radios()) e !== t && (e.checked = !1);
709
- this.dispatchEvent(new CustomEvent("void-change", {
710
- bubbles: !0,
711
- composed: !0,
712
- detail: { value: this.value }
713
- }));
714
- }
715
- };
716
- }
717
- connectedCallback() {
718
- super.connectedCallback(), this.setAttribute("role", "radiogroup"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("void-change", this._handleChildChange);
719
- }
720
- disconnectedCallback() {
721
- super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange);
722
- }
723
- updated(e) {
724
- if (super.updated(e), e.has("label") && this.label && this.setAttribute("aria-label", this.label), e.has("name") && this._syncNames(), !this._didSetup) {
725
- this._didSetup = !0;
726
- let e = this.querySelector(".void-radio-group-options");
727
- if (e) for (let t of this._userContent) e.appendChild(t);
728
- this._syncNames(), this._syncChecked();
729
- }
730
- }
731
- _radios() {
732
- return Array.from(this.querySelectorAll("void-radio"));
733
- }
734
- _syncNames() {
735
- if (this.name) for (let e of this._radios()) e.name = this.name;
736
- }
737
- _syncChecked() {
738
- for (let e of this._radios()) e.checked = e.value === this.value;
739
- }
740
- render() {
741
- return t`
742
- ${this.label ? t`<span class="void-radio-group-label">${this.label}</span>` : n}
743
- <div class="void-radio-group-options"></div>
744
- `;
745
- }
746
- };
747
- s([r({ type: String })], y.prototype, "label", void 0), s([r({ type: String })], y.prototype, "value", void 0), s([r({ type: String })], y.prototype, "name", void 0), s([r({
748
- type: String,
749
- reflect: !0
750
- })], y.prototype, "orientation", void 0), customElements.get("void-radio-group") || customElements.define("void-radio-group", y);
751
- //#endregion
752
- //#region src/components/field.ts
753
- var b = class extends o {
754
- constructor(...e) {
755
- super(...e), this.label = "", this.error = "", this.helper = "", this.required = !1, this._userContent = [], this._didSetup = !1;
756
- }
757
- connectedCallback() {
758
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
759
- }
760
- updated(e) {
761
- if (super.updated(e), !this._didSetup) {
762
- this._didSetup = !0;
763
- let e = this.querySelector(".void-field-control");
764
- if (e) for (let t of this._userContent) e.appendChild(t);
765
- }
766
- }
767
- render() {
768
- return t`
769
- ${this.label ? t`<label class="void-field-label">${this.label}${this.required ? t`<span class="void-field-required" aria-hidden="true"> *</span>` : ""}</label>` : n}
770
- <div class="void-field-control"></div>
771
- ${this.error ? t`<span class="void-field-error">${this.error}</span>` : this.helper ? t`<span class="void-field-helper">${this.helper}</span>` : n}
772
- `;
773
- }
774
- };
775
- s([r({
776
- type: String,
777
- reflect: !0
778
- })], b.prototype, "label", void 0), s([r({
779
- type: String,
780
- reflect: !0
781
- })], b.prototype, "error", void 0), s([r({
782
- type: String,
783
- reflect: !0
784
- })], b.prototype, "helper", void 0), s([r({
785
- type: Boolean,
786
- reflect: !0
787
- })], b.prototype, "required", void 0), customElements.get("void-field") || customElements.define("void-field", b);
788
- //#endregion
789
- //#region src/components/multiselect.ts
790
- var oe = class extends o {
791
- constructor(...e) {
792
- super(...e), this.value = "", this.selected = !1;
793
- }
794
- };
795
- s([r({
796
- type: String,
797
- reflect: !0
798
- })], oe.prototype, "value", void 0), s([r({
799
- type: Boolean,
800
- reflect: !0
801
- })], oe.prototype, "selected", void 0), customElements.get("void-option") || customElements.define("void-option", oe);
802
- var x = class extends o {
803
- constructor(...e) {
804
- super(...e), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this._open = !1, this._options = [], this._didSetup = !1, this._onTriggerClick = (e) => {
805
- this.disabled || (e.stopPropagation(), this._open = !this._open, this.requestUpdate());
806
- }, this._onTriggerKeydown = (e) => {
807
- this.disabled || (e.key === "Enter" || e.key === " " ? (e.preventDefault(), this._open = !this._open, this.requestUpdate()) : e.key === "Escape" && (this._open = !1, this.requestUpdate()));
808
- }, this._onDocumentClick = (e) => {
809
- this.contains(e.target) || (this._open = !1, this.requestUpdate());
810
- }, this._onDocumentKeydown = (e) => {
811
- e.key === "Escape" && this._open && (this._open = !1, this.requestUpdate());
812
- };
813
- }
814
- get value() {
815
- return this._options.filter((e) => e.selected).map((e) => e.value);
816
- }
817
- connectedCallback() {
818
- super.connectedCallback(), this._didSetup || (this._options = Array.from(this.querySelectorAll("void-option"))), this.setAttribute("role", "combobox"), this.setAttribute("aria-haspopup", "listbox"), document.addEventListener("click", this._onDocumentClick), document.addEventListener("keydown", this._onDocumentKeydown);
819
- }
820
- disconnectedCallback() {
821
- super.disconnectedCallback(), document.removeEventListener("click", this._onDocumentClick), document.removeEventListener("keydown", this._onDocumentKeydown);
822
- }
823
- updated(e) {
824
- super.updated(e), this._didSetup ||= !0, this.setAttribute("aria-expanded", String(this._open));
825
- }
826
- render() {
827
- let e = this._options.filter((e) => e.selected);
828
- return t`
829
- <div
830
- class="void-multiselect-trigger"
831
- tabindex=${this.disabled ? "-1" : "0"}
832
- @click=${this._onTriggerClick}
833
- @keydown=${this._onTriggerKeydown}
834
- >
835
- ${e.length > 0 ? e.map((e) => t`
836
- <span class="void-multiselect-pill">
837
- <span class="void-multiselect-pill-label">${e.textContent?.trim() || e.value}</span>
838
- <button
839
- class="void-multiselect-pill-remove"
840
- aria-label="Remove ${e.textContent?.trim() || e.value}"
841
- @click=${(t) => {
842
- t.stopPropagation(), this._deselect(e);
843
- }}
844
- >×</button>
845
- </span>
846
- `) : t`<span class="void-multiselect-placeholder">${this.placeholder}</span>`}
847
- </div>
848
- ${this._open ? t`
849
- <div class="void-multiselect-dropdown" role="listbox" aria-label=${this.placeholder} aria-multiselectable="true">
850
- ${this._options.map((e) => t`
851
- <div
852
- class="void-multiselect-option"
853
- role="option"
854
- tabindex="0"
855
- aria-selected=${e.selected ? "true" : "false"}
856
- @click=${() => this._toggleOption(e)}
857
- @keydown=${(t) => {
858
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._toggleOption(e));
859
- }}
860
- >
861
- <span class="void-multiselect-checkbox">
862
- ${e.selected ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : n}
863
- </span>
864
- <span class="void-multiselect-option-label">${e.textContent?.trim() || e.value}</span>
865
- </div>
866
- `)}
867
- </div>
868
- ` : n}
869
- ${this.error ? t`<span class="void-multiselect-error">${this.error}</span>` : n}
870
- `;
871
- }
872
- _toggleOption(e) {
873
- e.selected = !e.selected, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
874
- bubbles: !0,
875
- composed: !0,
876
- detail: { values: this.value }
877
- }));
878
- }
879
- _deselect(e) {
880
- e.selected = !1, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
881
- bubbles: !0,
882
- composed: !0,
883
- detail: { values: this.value }
884
- }));
885
- }
886
- };
887
- s([r({ type: String })], x.prototype, "placeholder", void 0), s([r({
888
- type: Boolean,
889
- reflect: !0
890
- })], x.prototype, "disabled", void 0), s([r({
891
- type: String,
892
- reflect: !0
893
- })], x.prototype, "size", void 0), s([r({
894
- type: String,
895
- reflect: !0
896
- })], x.prototype, "error", void 0), s([r({
897
- type: String,
898
- reflect: !0
899
- })], x.prototype, "name", void 0), customElements.get("void-multiselect") || customElements.define("void-multiselect", x);
900
- //#endregion
901
- //#region src/components/dialog.ts
902
- var S = class extends o {
903
- constructor(...e) {
904
- super(...e), this.open = !1, this.heading = "", this.size = "md", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
905
- e.key === "Escape" && this.closable && this._close();
906
- }, this._onBackdropClick = (e) => {
907
- this.closable && e.target === e.currentTarget && this._close();
908
- }, this._onBackdropKeydown = (e) => {
909
- e.key === "Escape" && this.closable && this._close();
910
- };
911
- }
912
- connectedCallback() {
913
- super.connectedCallback(), this.setAttribute("role", "dialog"), this.setAttribute("aria-modal", "true"), this.heading && this.setAttribute("aria-label", this.heading), this._didSetup || (this._userContent = Array.from(this.childNodes));
914
- }
915
- updated(e) {
916
- if (super.updated(e), e.has("heading") && (this.heading ? this.setAttribute("aria-label", this.heading) : this.removeAttribute("aria-label")), e.has("open") && (this.open ? (document.body.style.overflow = "hidden", document.addEventListener("keydown", this._handleKeydown), this._focusFirst()) : (document.body.style.overflow = "", document.removeEventListener("keydown", this._handleKeydown))), !this._didSetup) {
917
- let e = this.querySelector(".void-dialog-body");
918
- if (e) {
919
- this._didSetup = !0;
920
- for (let t of this._userContent) e.appendChild(t);
921
- }
922
- }
923
- }
924
- disconnectedCallback() {
925
- super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown), this.open && (document.body.style.overflow = "");
926
- }
927
- _focusFirst() {
928
- requestAnimationFrame(() => {
929
- this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])")?.focus();
930
- });
931
- }
932
- _close() {
933
- this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
934
- bubbles: !0,
935
- composed: !0
936
- }));
937
- }
938
- render() {
939
- return this.open ? t`
940
- <div class="void-dialog-backdrop" @click="${this._onBackdropClick}" @keydown="${this._onBackdropKeydown}">
941
- <div class="void-dialog-panel">
942
- <div class="void-dialog-header">
943
- <span class="void-dialog-heading">${this.heading}</span>
944
- ${this.closable ? t`<button class="void-dialog-close" aria-label="Close" @click="${this._close}">&times;</button>` : n}
945
- </div>
946
- <div class="void-dialog-body"></div>
947
- </div>
948
- </div>
949
- ` : n;
950
- }
951
- };
952
- s([r({
953
- type: Boolean,
954
- reflect: !0
955
- })], S.prototype, "open", void 0), s([r({ type: String })], S.prototype, "heading", void 0), s([r({
956
- type: String,
957
- reflect: !0
958
- })], S.prototype, "size", void 0), s([r({ type: Boolean })], S.prototype, "closable", void 0), customElements.get("void-dialog") || customElements.define("void-dialog", S);
959
- //#endregion
960
- //#region src/components/tabs.ts
961
- var C = class extends o {
962
- constructor(...e) {
963
- super(...e), this.tab = "", this.label = "", this.active = !1;
964
- }
965
- connectedCallback() {
966
- super.connectedCallback(), this.setAttribute("role", "tabpanel"), this.tab && (this.id = this.tab);
967
- }
968
- updated(e) {
969
- super.updated(e), this.setAttribute("role", "tabpanel"), e.has("tab") && this.tab && (this.id = this.tab);
970
- }
971
- };
972
- s([r({
973
- type: String,
974
- reflect: !0
975
- })], C.prototype, "tab", void 0), s([r({
976
- type: String,
977
- reflect: !0
978
- })], C.prototype, "label", void 0), s([r({
979
- type: Boolean,
980
- reflect: !0
981
- })], C.prototype, "active", void 0), customElements.get("void-tab-panel") || customElements.define("void-tab-panel", C);
982
- var se = class extends o {
983
- constructor(...e) {
984
- super(...e), this.value = "", this.size = "md", this._panels = [];
985
- }
986
- connectedCallback() {
987
- super.connectedCallback(), this._panels = Array.from(this.querySelectorAll("void-tab-panel")), this._syncPanels();
988
- }
989
- _syncPanels() {
990
- for (let e of this._panels) e.active = e.tab === this.value;
991
- }
992
- updated(e) {
993
- super.updated(e), e.has("value") && this._syncPanels();
994
- }
995
- render() {
996
- return t`
997
- <div class="void-tabs-list" role="tablist">
998
- ${this._panels.map((e, n) => t`
999
- <button
1000
- class="void-tabs-tab"
1001
- role="tab"
1002
- aria-selected=${e.tab === this.value ? "true" : "false"}
1003
- aria-controls=${e.tab}
1004
- ?active=${e.tab === this.value}
1005
- tabindex=${e.tab === this.value ? "0" : "-1"}
1006
- @click=${() => this._onTabClick(e)}
1007
- @keydown=${(e) => this._onTabKeydown(e, n)}
1008
- >${e.label || e.tab}</button>
1009
- `)}
1010
- </div>
1011
- `;
1012
- }
1013
- _onTabClick(e) {
1014
- this.value = e.tab, this.requestUpdate(), this._syncPanels(), this.dispatchEvent(new CustomEvent("void-change", {
1015
- bubbles: !0,
1016
- composed: !0,
1017
- detail: { value: this.value }
1018
- }));
1019
- }
1020
- _onTabKeydown(e, t) {
1021
- let n = Array.from(this.querySelectorAll(".void-tabs-tab"));
1022
- e.key === "ArrowRight" ? (e.preventDefault(), n[(t + 1) % n.length].focus()) : e.key === "ArrowLeft" && (e.preventDefault(), n[(t - 1 + n.length) % n.length].focus());
1023
- }
1024
- };
1025
- s([r({ type: String })], se.prototype, "value", void 0), s([r({
1026
- type: String,
1027
- reflect: !0
1028
- })], se.prototype, "size", void 0), customElements.get("void-tabs") || customElements.define("void-tabs", se);
1029
- //#endregion
1030
- //#region src/components/accordion.ts
1031
- var ce = class extends o {
1032
- constructor(...e) {
1033
- super(...e), this.multiple = !1;
1034
- }
1035
- };
1036
- s([r({
1037
- type: Boolean,
1038
- reflect: !0
1039
- })], ce.prototype, "multiple", void 0), customElements.get("void-accordion") || customElements.define("void-accordion", ce);
1040
- var le = class extends o {
1041
- constructor(...e) {
1042
- super(...e), this.heading = "", this.open = !1, this._id = Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
1043
- e.preventDefault(), this.open = !this.open;
1044
- let t = this.parentElement;
1045
- if (t instanceof ce && !t.multiple) {
1046
- let e = Array.from(t.querySelectorAll("void-accordion-item"));
1047
- for (let t of e) t !== this && (t.open = !1);
1048
- }
1049
- this.dispatchEvent(new CustomEvent("void-toggle", {
1050
- bubbles: !0,
1051
- composed: !0,
1052
- detail: { open: this.open }
1053
- }));
1054
- }, this._handleKeydown = (e) => {
1055
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._handleClick(e));
1056
- };
1057
- }
1058
- connectedCallback() {
1059
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
1060
- }
1061
- updated(e) {
1062
- if (super.updated(e), !this._didSetup) {
1063
- this._didSetup = !0;
1064
- let e = this.querySelector(".void-accordion-content");
1065
- if (e) for (let t of this._userContent) e.appendChild(t);
1066
- }
1067
- }
1068
- render() {
1069
- return t`
1070
- <button
1071
- id="trigger-${this._id}"
1072
- class="void-accordion-trigger"
1073
- aria-expanded=${String(this.open)}
1074
- aria-controls="content-${this._id}"
1075
- @click=${this._handleClick}
1076
- @keydown=${this._handleKeydown}
1077
- >
1078
- ${this.heading}
1079
- <svg class="void-accordion-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
1080
- <path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
1081
- </svg>
1082
- </button>
1083
- <div
1084
- id="content-${this._id}"
1085
- class="void-accordion-content"
1086
- role="region"
1087
- aria-labelledby="trigger-${this._id}"
1088
- ></div>
1089
- `;
1090
- }
1091
- };
1092
- s([r({ type: String })], le.prototype, "heading", void 0), s([r({
1093
- type: Boolean,
1094
- reflect: !0
1095
- })], le.prototype, "open", void 0), customElements.get("void-accordion-item") || customElements.define("void-accordion-item", le);
1096
- //#endregion
1097
- //#region src/components/breadcrumbs.ts
1098
- var ue = class extends o {
1099
- constructor(...e) {
1100
- super(...e), this.separator = "/", this._items = [], this._didSetup = !1;
1101
- }
1102
- connectedCallback() {
1103
- super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Breadcrumb"), this._didSetup || (this._items = Array.from(this.children));
1104
- }
1105
- updated(e) {
1106
- if (super.updated(e), !this._didSetup) {
1107
- this._didSetup = !0;
1108
- let e = this.querySelector(".void-breadcrumbs-list");
1109
- if (!e) return;
1110
- this._items.forEach((t, n) => {
1111
- let r = document.createElement("li");
1112
- r.className = "void-breadcrumbs-item", r.setAttribute("data-separator", this.separator), n === this._items.length - 1 && r.setAttribute("aria-current", "page"), r.appendChild(t), e.appendChild(r);
1113
- });
1114
- } else if (e.has("separator")) {
1115
- let e = Array.from(this.querySelectorAll(".void-breadcrumbs-item"));
1116
- for (let t of e) t.setAttribute("data-separator", this.separator);
1117
- }
1118
- }
1119
- render() {
1120
- return t`<ol class="void-breadcrumbs-list"></ol>`;
1121
- }
1122
- };
1123
- s([r({ type: String })], ue.prototype, "separator", void 0), customElements.get("void-breadcrumbs") || customElements.define("void-breadcrumbs", ue);
1124
- //#endregion
1125
- //#region src/components/list.ts
1126
- var de = class extends o {
1127
- constructor(...e) {
1128
- super(...e), this.dividers = !1;
1129
- }
1130
- connectedCallback() {
1131
- super.connectedCallback(), this.setAttribute("role", "list");
1132
- }
1133
- };
1134
- s([r({
1135
- type: Boolean,
1136
- reflect: !0
1137
- })], de.prototype, "dividers", void 0), customElements.get("void-list") || customElements.define("void-list", de);
1138
- var fe = class extends o {
1139
- constructor(...e) {
1140
- super(...e), this.selected = !1, this.disabled = !1, this.interactive = !1, this._handleClick = () => {
1141
- this.disabled || this.dispatchEvent(new CustomEvent("void-click", {
1142
- bubbles: !0,
1143
- composed: !0,
1144
- detail: {}
1145
- }));
1146
- };
1147
- }
1148
- connectedCallback() {
1149
- super.connectedCallback(), this.setAttribute("role", "listitem");
1150
- }
1151
- updated(e) {
1152
- super.updated(e), e.has("interactive") && (this.interactive ? this.addEventListener("click", this._handleClick) : this.removeEventListener("click", this._handleClick));
1153
- }
1154
- };
1155
- s([r({
1156
- type: Boolean,
1157
- reflect: !0
1158
- })], fe.prototype, "selected", void 0), s([r({
1159
- type: Boolean,
1160
- reflect: !0
1161
- })], fe.prototype, "disabled", void 0), s([r({
1162
- type: Boolean,
1163
- reflect: !0
1164
- })], fe.prototype, "interactive", void 0), customElements.get("void-list-item") || customElements.define("void-list-item", fe);
1165
- //#endregion
1166
- //#region src/components/toast.ts
1167
- var w = class extends o {
1168
- constructor(...e) {
1169
- super(...e), this.color = "default", this.duration = 5e3, this.dismissable = !0, this.heading = "";
1170
- }
1171
- connectedCallback() {
1172
- super.connectedCallback(), this.setAttribute("role", "status"), this.duration > 0 && (this._timer = setTimeout(() => this._close(), this.duration));
1173
- }
1174
- disconnectedCallback() {
1175
- super.disconnectedCallback(), clearTimeout(this._timer);
1176
- }
1177
- _close() {
1178
- this.dispatchEvent(new CustomEvent("void-close", {
1179
- bubbles: !0,
1180
- composed: !0
1181
- })), this.remove();
1182
- }
1183
- render() {
1184
- return t`
1185
- ${this.heading ? t`<span class='void-toast-heading'>${this.heading}</span>` : n}
1186
- ${this.dismissable ? t`<button class='void-toast-close' aria-label='Close' @click='${this._close}'>&times;</button>` : n}
1187
- `;
1188
- }
1189
- };
1190
- s([r({
1191
- type: String,
1192
- reflect: !0
1193
- })], w.prototype, "color", void 0), s([r({ type: Number })], w.prototype, "duration", void 0), s([r({
1194
- type: Boolean,
1195
- reflect: !0
1196
- })], w.prototype, "dismissable", void 0), s([r({ type: String })], w.prototype, "heading", void 0), customElements.get("void-toast") || customElements.define("void-toast", w);
1197
- var pe = class extends o {
1198
- constructor(...e) {
1199
- super(...e), this.position = "bottom-right";
1200
- }
1201
- connectedCallback() {
1202
- super.connectedCallback(), this.setAttribute("role", "region"), this.setAttribute("aria-label", "Notifications"), this.setAttribute("aria-live", "polite");
1203
- }
1204
- static show(e) {
1205
- let t = document.querySelector("void-toast-container");
1206
- t || (t = document.createElement("void-toast-container"), document.body.appendChild(t));
1207
- let n = document.createElement("void-toast");
1208
- return e.color !== void 0 && (n.color = e.color), e.heading !== void 0 && (n.heading = e.heading), e.duration !== void 0 && (n.duration = e.duration), e.dismissable !== void 0 && (n.dismissable = e.dismissable), n.textContent = e.message, t.appendChild(n), n;
1209
- }
1210
- };
1211
- s([r({
1212
- type: String,
1213
- reflect: !0
1214
- })], pe.prototype, "position", void 0), customElements.get("void-toast-container") || customElements.define("void-toast-container", pe);
1215
- //#endregion
1216
- //#region src/components/stepper.ts
1217
- var me = class extends o {
1218
- constructor(...e) {
1219
- super(...e), this.value = 0, this.steps = "";
1220
- }
1221
- connectedCallback() {
1222
- super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Progress");
1223
- }
1224
- render() {
1225
- return t`${this.steps.split(",").map((e) => e.trim()).filter(Boolean).map((e, r) => {
1226
- let i = r < this.value ? "completed" : r === this.value ? "active" : "upcoming";
1227
- return t`${r > 0 ? t`<div class="void-stepper-connector" data-state=${r <= this.value ? "completed" : "upcoming"}></div>` : null}<div
1228
- class="void-stepper-step"
1229
- data-state=${i}
1230
- aria-current=${r === this.value ? "step" : n}
1231
- >
1232
- <span class="void-stepper-circle"
1233
- >${i === "completed" ? t`<svg
1234
- viewBox="0 0 12 12"
1235
- width="1em"
1236
- height="1em"
1237
- fill="none"
1238
- stroke="currentColor"
1239
- stroke-width="var(--void-icon-stroke-width)"
1240
- stroke-linecap="round"
1241
- stroke-linejoin="round"
1242
- >
1243
- <polyline points="2,6 5,9 10,3"></polyline>
1244
- </svg>` : r + 1}</span
1245
- >
1246
- <span class="void-stepper-label">${e}</span>
1247
- </div>`;
1248
- })}`;
1249
- }
1250
- };
1251
- s([r({
1252
- type: Number,
1253
- reflect: !0
1254
- })], me.prototype, "value", void 0), s([r({ reflect: !0 })], me.prototype, "steps", void 0), customElements.get("void-stepper") || customElements.define("void-stepper", me);
1255
- //#endregion
1256
- //#region src/components/drawer.ts
1257
- var T = class extends o {
1258
- constructor(...e) {
1259
- super(...e), this.open = !1, this.side = "right", this.size = "md", this.heading = "", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
1260
- e.key === "Escape" && this.open && this.closable && this._close();
1261
- }, this._handleBackdropClick = () => {
1262
- this.closable && this._close();
1263
- }, this._handleBackdropKeydown = (e) => {
1264
- e.key === "Escape" && this.closable && this._close();
1265
- };
1266
- }
1267
- connectedCallback() {
1268
- super.connectedCallback(), this.setAttribute("role", "dialog"), this.setAttribute("aria-modal", "true"), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("keydown", this._handleKeydown);
1269
- }
1270
- disconnectedCallback() {
1271
- super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeydown);
1272
- }
1273
- updated(e) {
1274
- if (super.updated(e), e.has("heading") && this.heading ? this.setAttribute("aria-label", this.heading) : e.has("heading") && !this.heading && this.removeAttribute("aria-label"), !this._didSetup) {
1275
- this._didSetup = !0;
1276
- let e = this.querySelector(".void-drawer-body");
1277
- if (e) for (let t of this._userContent) e.appendChild(t);
1278
- }
1279
- }
1280
- _close() {
1281
- this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
1282
- bubbles: !0,
1283
- composed: !0
1284
- }));
1285
- }
1286
- render() {
1287
- return this.open ? t`
1288
- <div class="void-drawer-backdrop" @click="${this._handleBackdropClick}" @keydown="${this._handleBackdropKeydown}"></div>
1289
- <div class="void-drawer-panel">
1290
- <div class="void-drawer-header">
1291
- ${this.heading ? t`<span class="void-drawer-heading">${this.heading}</span>` : n}
1292
- ${this.closable ? t`<button class="void-drawer-close" aria-label="Close" @click="${this._close}">&times;</button>` : n}
1293
- </div>
1294
- <div class="void-drawer-body"></div>
1295
- </div>
1296
- ` : n;
1297
- }
1298
- };
1299
- s([r({
1300
- type: Boolean,
1301
- reflect: !0
1302
- })], T.prototype, "open", void 0), s([r({
1303
- type: String,
1304
- reflect: !0
1305
- })], T.prototype, "side", void 0), s([r({
1306
- type: String,
1307
- reflect: !0
1308
- })], T.prototype, "size", void 0), s([r({ type: String })], T.prototype, "heading", void 0), s([r({
1309
- type: Boolean,
1310
- reflect: !0
1311
- })], T.prototype, "closable", void 0), customElements.get("void-drawer") || customElements.define("void-drawer", T);
1312
- //#endregion
1313
- //#region src/components/card.ts
1314
- var he = class extends o {
1315
- constructor(...e) {
1316
- super(...e), this.heading = "", this.variant = "default", this.padding = "md", this._userContent = [], this._didSetup = !1;
1317
- }
1318
- connectedCallback() {
1319
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
1320
- }
1321
- updated(e) {
1322
- if (super.updated(e), !this._didSetup) {
1323
- this._didSetup = !0;
1324
- let e = this.querySelector(".void-card-body");
1325
- for (let t of this._userContent) e.appendChild(t);
1326
- }
1327
- }
1328
- render() {
1329
- return t`${this.heading ? t`<div class="void-card-header"><span class="void-card-heading">${this.heading}</span></div>` : n}<div class="void-card-body"></div>`;
1330
- }
1331
- };
1332
- s([r({ type: String })], he.prototype, "heading", void 0), s([r({
1333
- type: String,
1334
- reflect: !0
1335
- })], he.prototype, "variant", void 0), s([r({
1336
- type: String,
1337
- reflect: !0
1338
- })], he.prototype, "padding", void 0), customElements.get("void-card") || customElements.define("void-card", he);
1339
- //#endregion
1340
- //#region src/components/popover.ts
1341
- var ge = class extends o {
1342
- constructor(...e) {
1343
- super(...e), this.open = !1, this.position = "bottom", this.trigger = "click", this._triggerEl = null, this._contentNodes = [], this._didSetup = !1, this._handleTriggerClick = () => {
1344
- this.open = !this.open, this.open || this._dispatchClose();
1345
- }, this._handleOutsideClick = (e) => {
1346
- this.open && !this.contains(e.target) && this._close();
1347
- }, this._handleKeydown = (e) => {
1348
- e.key === "Escape" && this.open && this._close();
1349
- };
1350
- }
1351
- connectedCallback() {
1352
- super.connectedCallback(), this._didSetup || (this._triggerEl = this.children[0] ?? null, this._contentNodes = Array.from(this.childNodes).filter((e) => e !== this._triggerEl)), document.addEventListener("mousedown", this._handleOutsideClick), document.addEventListener("keydown", this._handleKeydown);
1353
- }
1354
- disconnectedCallback() {
1355
- super.disconnectedCallback(), document.removeEventListener("mousedown", this._handleOutsideClick), document.removeEventListener("keydown", this._handleKeydown);
1356
- }
1357
- updated(e) {
1358
- if (super.updated(e), !this._didSetup) {
1359
- this._didSetup = !0, this._triggerEl && (this.appendChild(this._triggerEl), this.trigger === "click" && this._triggerEl.addEventListener("click", this._handleTriggerClick));
1360
- let e = document.createElement("div");
1361
- e.className = "void-popover-body";
1362
- for (let t of this._contentNodes) e.appendChild(t);
1363
- this.appendChild(e);
1364
- }
1365
- e.has("trigger") && this._triggerEl && (this._triggerEl.removeEventListener("click", this._handleTriggerClick), this.trigger === "click" && this._triggerEl.addEventListener("click", this._handleTriggerClick));
1366
- }
1367
- _close() {
1368
- this.open = !1, this._dispatchClose();
1369
- }
1370
- _dispatchClose() {
1371
- this.dispatchEvent(new CustomEvent("void-close", {
1372
- bubbles: !0,
1373
- composed: !0
1374
- }));
1375
- }
1376
- };
1377
- s([r({
1378
- type: Boolean,
1379
- reflect: !0
1380
- })], ge.prototype, "open", void 0), s([r({
1381
- type: String,
1382
- reflect: !0
1383
- })], ge.prototype, "position", void 0), s([r({
1384
- type: String,
1385
- reflect: !0
1386
- })], ge.prototype, "trigger", void 0), customElements.get("void-popover") || customElements.define("void-popover", ge);
1387
- //#endregion
1388
- //#region src/components/tooltip.ts
1389
- var E = class extends o {
1390
- constructor(...e) {
1391
- super(...e), this.text = "", this.position = "top", this.delay = 200, this._visible = !1, this._tooltipId = "void-tooltip-" + Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._onMouseEnter = () => {
1392
- clearTimeout(this._timerId), this._timerId = setTimeout(() => {
1393
- this._visible = !0, this.requestUpdate();
1394
- }, this.delay);
1395
- }, this._onMouseLeave = () => {
1396
- clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
1397
- }, this._onFocusIn = () => {
1398
- clearTimeout(this._timerId), this._visible = !0, this.requestUpdate();
1399
- }, this._onFocusOut = () => {
1400
- clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
1401
- };
1402
- }
1403
- connectedCallback() {
1404
- this._userContent = Array.from(this.childNodes), super.connectedCallback(), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
1405
- }
1406
- disconnectedCallback() {
1407
- super.disconnectedCallback(), clearTimeout(this._timerId), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), this.removeEventListener("focusin", this._onFocusIn), this.removeEventListener("focusout", this._onFocusOut);
1408
- }
1409
- updated() {
1410
- if (!this._didSetup) {
1411
- this._didSetup = !0;
1412
- let e = this.querySelector(".void-tooltip-bubble");
1413
- if (e) for (let t of this._userContent) this.insertBefore(t, e);
1414
- }
1415
- this._visible ? this.setAttribute("visible", "") : this.removeAttribute("visible");
1416
- let e = this.children[0];
1417
- e && (this._visible ? e.setAttribute("aria-describedby", this._tooltipId) : e.removeAttribute("aria-describedby"));
1418
- }
1419
- render() {
1420
- return t`<span id="${this._tooltipId}" class="void-tooltip-bubble" role="tooltip" aria-label=${this.text}>${this.text}</span>`;
1421
- }
1422
- };
1423
- s([r({ type: String })], E.prototype, "text", void 0), s([r({
1424
- type: String,
1425
- reflect: !0
1426
- })], E.prototype, "position", void 0), s([r({ type: Number })], E.prototype, "delay", void 0), s([a()], E.prototype, "_visible", void 0), customElements.get("void-tooltip") || customElements.define("void-tooltip", E);
1427
- //#endregion
1428
- //#region src/components/banner.ts
1429
- var _e = class extends o {
1430
- constructor(...e) {
1431
- super(...e), this.color = "default", this.dismissable = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
1432
- }
1433
- connectedCallback() {
1434
- super.connectedCallback(), this.setAttribute("role", "banner"), this._didSetup || (this._userContent = Array.from(this.childNodes));
1435
- }
1436
- updated(e) {
1437
- if (super.updated(e), !this._didSetup) {
1438
- this._didSetup = !0;
1439
- for (let e of this._userContent) this.appendChild(e);
1440
- }
1441
- }
1442
- _close() {
1443
- this.dispatchEvent(new CustomEvent("void-close", {
1444
- bubbles: !0,
1445
- composed: !0
1446
- })), this.remove();
1447
- }
1448
- render() {
1449
- return this.dismissable ? t`<button class="void-banner-close" aria-label="Close" @click="${this._close}">&times;</button>` : n;
1450
- }
1451
- };
1452
- s([r({
1453
- type: String,
1454
- reflect: !0
1455
- })], _e.prototype, "color", void 0), s([r({
1456
- type: Boolean,
1457
- reflect: !0
1458
- })], _e.prototype, "dismissable", void 0), s([r({
1459
- type: String,
1460
- reflect: !0
1461
- })], _e.prototype, "variant", void 0), customElements.get("void-banner") || customElements.define("void-banner", _e);
1462
- //#endregion
1463
- //#region src/components/scroll-area.ts
1464
- var ve = class extends o {
1465
- constructor(...e) {
1466
- super(...e), this.maxHeight = "", this.direction = "vertical", this._userContent = [], this._didSetup = !1;
1467
- }
1468
- connectedCallback() {
1469
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
1470
- }
1471
- updated(e) {
1472
- if (super.updated(e), !this._didSetup) {
1473
- this._didSetup = !0;
1474
- let e = this.querySelector(".void-scroll-area-viewport");
1475
- for (let t of this._userContent) e.appendChild(t);
1476
- }
1477
- this.style.setProperty("--void-scroll-area-max-height", this.maxHeight || "");
1478
- }
1479
- render() {
1480
- return t`<div class="void-scroll-area-viewport"></div>`;
1481
- }
1482
- };
1483
- s([r({ type: String })], ve.prototype, "maxHeight", void 0), s([r({
1484
- type: String,
1485
- reflect: !0
1486
- })], ve.prototype, "direction", void 0), customElements.get("void-scroll-area") || customElements.define("void-scroll-area", ve);
1487
- //#endregion
1488
- //#region src/components/table.ts
1489
- var D = class extends o {
1490
- constructor(...e) {
1491
- super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1;
1492
- }
1493
- };
1494
- s([r({
1495
- type: Boolean,
1496
- reflect: !0
1497
- })], D.prototype, "striped", void 0), s([r({
1498
- type: Boolean,
1499
- reflect: !0
1500
- })], D.prototype, "hoverable", void 0), s([r({
1501
- type: Boolean,
1502
- reflect: !0
1503
- })], D.prototype, "compact", void 0), s([r({
1504
- type: Boolean,
1505
- reflect: !0
1506
- })], D.prototype, "bordered", void 0), customElements.get("void-table") || customElements.define("void-table", D);
1507
- //#endregion
1508
- //#region src/components/pagination.ts
1509
- var O = class extends o {
1510
- constructor(...e) {
1511
- super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md";
1512
- }
1513
- _pages() {
1514
- let { total: e, value: t, siblings: n } = this, r = [], i = Math.max(2, t - n), a = Math.min(e - 1, t + n);
1515
- r.push(1), i > 2 && r.push("ellipsis");
1516
- for (let e = i; e <= a; e++) r.push(e);
1517
- return a < e - 1 && r.push("ellipsis"), e > 1 && r.push(e), r;
1518
- }
1519
- _go(e) {
1520
- e < 1 || e > this.total || e === this.value || (this.value = e, this.dispatchEvent(new CustomEvent("void-change", {
1521
- bubbles: !0,
1522
- composed: !0,
1523
- detail: { value: e }
1524
- })));
1525
- }
1526
- render() {
1527
- let e = this._pages(), r = 0;
1528
- return t`
1529
- <nav role="navigation" aria-label="Pagination">
1530
- <button
1531
- class="void-pagination-btn"
1532
- ?disabled=${this.value <= 1}
1533
- @click=${() => this._go(this.value - 1)}
1534
- aria-label="Previous page"
1535
- >«</button>
1536
- ${e.map((e) => e === "ellipsis" ? (r++, t`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${r}>…</span>`) : t`
1537
- <button
1538
- class="void-pagination-btn"
1539
- ?disabled=${e === this.value}
1540
- aria-current=${e === this.value ? "page" : n}
1541
- @click=${() => this._go(e)}
1542
- >${e}</button>
1543
- `)}
1544
- <button
1545
- class="void-pagination-btn"
1546
- ?disabled=${this.value >= this.total}
1547
- @click=${() => this._go(this.value + 1)}
1548
- aria-label="Next page"
1549
- >»</button>
1550
- </nav>
1551
- `;
1552
- }
1553
- };
1554
- s([r({ type: Number })], O.prototype, "total", void 0), s([r({
1555
- type: Number,
1556
- reflect: !0
1557
- })], O.prototype, "value", void 0), s([r({ type: Number })], O.prototype, "siblings", void 0), s([r({
1558
- type: String,
1559
- reflect: !0
1560
- })], O.prototype, "size", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", O);
1561
- //#endregion
1562
- //#region src/components/error-fallback.ts
1563
- var k = class extends o {
1564
- constructor(...e) {
1565
- super(...e), this.heading = "Something went wrong", this.message = "", this.retryable = !1, this.retryLabel = "Try again", this.icon = !0;
1566
- }
1567
- connectedCallback() {
1568
- super.connectedCallback(), this.setAttribute("role", "alert");
1569
- }
1570
- _retry() {
1571
- this.dispatchEvent(new CustomEvent("void-retry", {
1572
- bubbles: !0,
1573
- composed: !0
1574
- }));
1575
- }
1576
- render() {
1577
- return t`
1578
- <div class="void-error-fallback-content">
1579
- ${this.icon ? t`<span class="void-error-fallback-icon">&#9888;</span>` : n}
1580
- <span class="void-error-fallback-heading">${this.heading}</span>
1581
- ${this.message ? t`<span class="void-error-fallback-message">${this.message}</span>` : n}
1582
- ${this.retryable ? t`<button class="void-error-fallback-retry" @click="${this._retry}">${this.retryLabel}</button>` : n}
1583
- </div>
1584
- `;
1585
- }
1586
- };
1587
- s([r({ type: String })], k.prototype, "heading", void 0), s([r({ type: String })], k.prototype, "message", void 0), s([r({
1588
- type: Boolean,
1589
- reflect: !0
1590
- })], k.prototype, "retryable", void 0), s([r({ type: String })], k.prototype, "retryLabel", void 0), s([r({ type: Boolean })], k.prototype, "icon", void 0), customElements.get("void-error-fallback") || customElements.define("void-error-fallback", k);
1591
- //#endregion
1592
- //#region src/components/checkbox-group.ts
1593
- var ye = class extends o {
1594
- constructor(...e) {
1595
- super(...e), this.label = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
1596
- let t = e.target;
1597
- !t.closest("void-checkbox") || t.closest("void-checkbox")?.closest("void-checkbox-group") !== this || (e.stopImmediatePropagation(), this.dispatchEvent(new CustomEvent("void-change", {
1598
- bubbles: !0,
1599
- composed: !0,
1600
- detail: { values: this.value }
1601
- })));
1602
- };
1603
- }
1604
- get value() {
1605
- return Array.from(this.querySelectorAll("void-checkbox")).filter((e) => e.checked).map((e) => e.value);
1606
- }
1607
- connectedCallback() {
1608
- super.connectedCallback(), this.setAttribute("role", "group"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("void-change", this._handleChildChange);
1609
- }
1610
- disconnectedCallback() {
1611
- super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange);
1612
- }
1613
- updated(e) {
1614
- if (super.updated(e), e.has("label") && (this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label")), !this._didSetup) {
1615
- this._didSetup = !0;
1616
- let e = this.querySelector(".void-checkbox-group-items");
1617
- if (e) for (let t of this._userContent) e.appendChild(t);
1618
- }
1619
- }
1620
- render() {
1621
- return t`
1622
- ${this.label ? t`<span class="void-checkbox-group-label">${this.label}</span>` : n}
1623
- <div class="void-checkbox-group-items"></div>
1624
- `;
1625
- }
1626
- };
1627
- s([r({
1628
- type: String,
1629
- reflect: !0
1630
- })], ye.prototype, "label", void 0), s([r({
1631
- type: String,
1632
- reflect: !0
1633
- })], ye.prototype, "orientation", void 0), customElements.get("void-checkbox-group") || customElements.define("void-checkbox-group", ye);
1634
- //#endregion
1635
- //#region src/components/combobox.ts
1636
- var A = class extends o {
1637
- constructor(...e) {
1638
- super(...e), this.value = "", this.placeholder = "Search...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this._open = !1, this._query = "", this._options = [], this._onInputFocus = () => {
1639
- this.disabled || (this._open = !0, this._query = "", this.requestUpdate());
1640
- }, this._onInput = (e) => {
1641
- this._query = e.target.value, this._open = !0, this.requestUpdate();
1642
- }, this._onInputKeydown = (e) => {
1643
- e.key === "Escape" && (this._open = !1, this._query = "", this.requestUpdate());
1644
- }, this._onInputBlur = () => {
1645
- setTimeout(() => {
1646
- this._open = !1, this._query = "", this.requestUpdate();
1647
- }, 150);
1648
- }, this._onDocumentClick = (e) => {
1649
- this.contains(e.target) || (this._open = !1, this._query = "", this.requestUpdate());
1650
- }, this._onDocumentKeydown = (e) => {
1651
- e.key === "Escape" && this._open && (this._open = !1, this._query = "", this.requestUpdate());
1652
- };
1653
- }
1654
- connectedCallback() {
1655
- super.connectedCallback(), this._options = Array.from(this.querySelectorAll("void-option")), this.setAttribute("role", "combobox"), this.setAttribute("aria-autocomplete", "list"), document.addEventListener("click", this._onDocumentClick), document.addEventListener("keydown", this._onDocumentKeydown);
1656
- }
1657
- disconnectedCallback() {
1658
- super.disconnectedCallback(), document.removeEventListener("click", this._onDocumentClick), document.removeEventListener("keydown", this._onDocumentKeydown);
1659
- }
1660
- updated(e) {
1661
- super.updated(e), this.setAttribute("aria-expanded", String(this._open));
1662
- }
1663
- render() {
1664
- let e = this._options.filter((e) => e.textContent?.trim().toLowerCase().includes(this._query.toLowerCase())), r = this._options.find((e) => e.value === this.value);
1665
- return t`
1666
- <input
1667
- class="void-combobox-input"
1668
- .value=${this._open ? this._query : r?.textContent?.trim() || this.value || ""}
1669
- placeholder=${this.placeholder}
1670
- ?disabled=${this.disabled}
1671
- autocomplete="off"
1672
- aria-autocomplete="list"
1673
- aria-expanded=${String(this._open)}
1674
- aria-invalid=${this.error ? "true" : "false"}
1675
- @focus=${this._onInputFocus}
1676
- @input=${this._onInput}
1677
- @keydown=${this._onInputKeydown}
1678
- @blur=${this._onInputBlur}
1679
- />
1680
- ${this._open ? t`
1681
- <div class="void-combobox-dropdown" role="listbox" aria-label=${this.placeholder}>
1682
- ${e.length > 0 ? e.map((e) => t`
1683
- <div
1684
- class="void-combobox-option"
1685
- role="option"
1686
- aria-selected=${e.value === this.value ? "true" : "false"}
1687
- @mousedown=${(t) => {
1688
- t.preventDefault(), this._selectOption(e);
1689
- }}
1690
- >${e.textContent?.trim() || e.value}</div>
1691
- `) : t`<div class="void-combobox-empty">No options found</div>`}
1692
- </div>
1693
- ` : n}
1694
- ${this.error ? t`<span class="void-combobox-error">${this.error}</span>` : n}
1695
- `;
1696
- }
1697
- _selectOption(e) {
1698
- this.value = e.value, this._open = !1, this._query = "", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
1699
- bubbles: !0,
1700
- composed: !0,
1701
- detail: { value: this.value }
1702
- }));
1703
- }
1704
- };
1705
- s([r({ type: String })], A.prototype, "value", void 0), s([r({ type: String })], A.prototype, "placeholder", void 0), s([r({
1706
- type: Boolean,
1707
- reflect: !0
1708
- })], A.prototype, "disabled", void 0), s([r({
1709
- type: String,
1710
- reflect: !0
1711
- })], A.prototype, "size", void 0), s([r({
1712
- type: String,
1713
- reflect: !0
1714
- })], A.prototype, "error", void 0), s([r({
1715
- type: String,
1716
- reflect: !0
1717
- })], A.prototype, "name", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", A);
1718
- //#endregion
1719
- //#region src/components/slider.ts
1720
- var j = class extends o {
1721
- constructor(...e) {
1722
- super(...e), this.value = 50, this.min = 0, this.max = 100, this.step = 1, this.disabled = !1, this.name = "", this.showValue = !1, this.size = "md";
1723
- }
1724
- connectedCallback() {
1725
- super.connectedCallback(), this.setAttribute("role", "slider"), this.setAttribute("aria-valuemin", String(this.min)), this.setAttribute("aria-valuemax", String(this.max)), this.setAttribute("aria-valuenow", String(this.value));
1726
- }
1727
- updated(e) {
1728
- e.has("min") && this.setAttribute("aria-valuemin", String(this.min)), e.has("max") && this.setAttribute("aria-valuemax", String(this.max)), (e.has("value") || e.has("min") || e.has("max")) && this.setAttribute("aria-valuenow", String(this.value));
1729
- }
1730
- _fill() {
1731
- return (this.value - this.min) / (this.max - this.min) * 100;
1732
- }
1733
- _onInput(e) {
1734
- let t = e.target;
1735
- this.value = Number(t.value), this.dispatchEvent(new CustomEvent("void-input", {
1736
- bubbles: !0,
1737
- composed: !0,
1738
- detail: { value: this.value }
1739
- }));
1740
- }
1741
- _onChange(e) {
1742
- let t = e.target;
1743
- this.value = Number(t.value), this.dispatchEvent(new CustomEvent("void-change", {
1744
- bubbles: !0,
1745
- composed: !0,
1746
- detail: { value: this.value }
1747
- }));
1748
- }
1749
- render() {
1750
- let e = this._fill();
1751
- return t`
1752
- <input
1753
- type="range"
1754
- .value=${String(this.value)}
1755
- min=${this.min}
1756
- max=${this.max}
1757
- step=${this.step}
1758
- ?disabled=${this.disabled}
1759
- name=${this.name}
1760
- style="--void-slider-fill: ${e}%"
1761
- @input=${this._onInput}
1762
- @change=${this._onChange}
1763
- />
1764
- ${this.showValue ? t`<span class="void-slider-value">${this.value}</span>` : ""}
1765
- `;
1766
- }
1767
- };
1768
- s([r({ type: Number })], j.prototype, "value", void 0), s([r({ type: Number })], j.prototype, "min", void 0), s([r({ type: Number })], j.prototype, "max", void 0), s([r({ type: Number })], j.prototype, "step", void 0), s([r({
1769
- type: Boolean,
1770
- reflect: !0
1771
- })], j.prototype, "disabled", void 0), s([r({
1772
- type: String,
1773
- reflect: !0
1774
- })], j.prototype, "name", void 0), s([r({
1775
- type: Boolean,
1776
- reflect: !0
1777
- })], j.prototype, "showValue", void 0), s([r({
1778
- type: String,
1779
- reflect: !0
1780
- })], j.prototype, "size", void 0), customElements.get("void-slider") || customElements.define("void-slider", j);
1781
- //#endregion
1782
- //#region src/components/file-upload.ts
1783
- var M = class extends o {
1784
- constructor(...e) {
1785
- super(...e), this.accept = "", this.multiple = !1, this.disabled = !1, this.maxSize = 0, this.error = "", this._files = [], this._onDropzoneClick = () => {
1786
- this.disabled || this._input?.click();
1787
- }, this._onDropzoneKeydown = (e) => {
1788
- this.disabled || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._input?.click());
1789
- }, this._onDragOver = (e) => {
1790
- this.disabled || (e.preventDefault(), this.setAttribute("dragging", ""));
1791
- }, this._onDragLeave = () => {
1792
- this.removeAttribute("dragging");
1793
- }, this._onDrop = (e) => {
1794
- if (e.preventDefault(), this.removeAttribute("dragging"), this.disabled) return;
1795
- let t = Array.from(e.dataTransfer?.files ?? []);
1796
- this._addFiles(t);
1797
- }, this._onInputChange = (e) => {
1798
- let t = e.target, n = Array.from(t.files ?? []);
1799
- this._addFiles(n), t.value = "";
1800
- };
1801
- }
1802
- get _input() {
1803
- return this.querySelector("input[type=\"file\"]");
1804
- }
1805
- render() {
1806
- return t`
1807
- <input
1808
- type="file"
1809
- class="void-file-upload-input"
1810
- accept=${this.accept || n}
1811
- ?multiple=${this.multiple}
1812
- ?disabled=${this.disabled}
1813
- @change=${this._onInputChange}
1814
- />
1815
- <div
1816
- class="void-file-upload-dropzone"
1817
- tabindex=${this.disabled ? "-1" : "0"}
1818
- role="button"
1819
- aria-disabled=${this.disabled ? "true" : "false"}
1820
- @click=${this._onDropzoneClick}
1821
- @keydown=${this._onDropzoneKeydown}
1822
- @dragover=${this._onDragOver}
1823
- @dragleave=${this._onDragLeave}
1824
- @drop=${this._onDrop}
1825
- >
1826
- <span class="void-file-upload-text">
1827
- Drop files here or <span class="void-file-upload-browse">browse</span>
1828
- </span>
1829
- </div>
1830
- ${this._files.length > 0 ? t`
1831
- <div class="void-file-upload-files">
1832
- ${this._files.map((e, n) => t`
1833
- <div class="void-file-upload-file">
1834
- <span class="void-file-upload-filename">${e.name}</span>
1835
- <button
1836
- class="void-file-upload-remove"
1837
- aria-label="Remove ${e.name}"
1838
- ?disabled=${this.disabled}
1839
- @click=${() => this._removeFile(n)}
1840
- >×</button>
1841
- </div>
1842
- `)}
1843
- </div>
1844
- ` : n}
1845
- ${this.error ? t`<span class="void-file-upload-error">${this.error}</span>` : n}
1846
- `;
1847
- }
1848
- _addFiles(e) {
1849
- let t = e.filter((e) => !(this.maxSize > 0 && e.size > this.maxSize || this.accept && !this.accept.split(",").map((e) => e.trim()).some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t.toLowerCase()) : t.endsWith("/*") ? e.type.startsWith(t.slice(0, -1)) : e.type === t)));
1850
- t.length !== 0 && (this._files = this.multiple ? [...this._files, ...t] : t, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
1851
- bubbles: !0,
1852
- composed: !0,
1853
- detail: { files: [...this._files] }
1854
- })));
1855
- }
1856
- _removeFile(e) {
1857
- this._files = this._files.filter((t, n) => n !== e), this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
1858
- bubbles: !0,
1859
- composed: !0,
1860
- detail: { files: [...this._files] }
1861
- }));
1862
- }
1863
- };
1864
- s([r({ type: String })], M.prototype, "accept", void 0), s([r({
1865
- type: Boolean,
1866
- reflect: !0
1867
- })], M.prototype, "multiple", void 0), s([r({
1868
- type: Boolean,
1869
- reflect: !0
1870
- })], M.prototype, "disabled", void 0), s([r({ type: Number })], M.prototype, "maxSize", void 0), s([r({
1871
- type: String,
1872
- reflect: !0
1873
- })], M.prototype, "error", void 0), customElements.get("void-file-upload") || customElements.define("void-file-upload", M);
1874
- //#endregion
1875
- //#region src/components/nav-bar.ts
1876
- var N = class extends o {
1877
- constructor(...e) {
1878
- super(...e), this.sticky = !1, this.bordered = !0, this.variant = "default", this._userContent = [], this._didSetup = !1;
1879
- }
1880
- connectedCallback() {
1881
- super.connectedCallback(), this.setAttribute("role", "navigation"), this._didSetup || (this._userContent = Array.from(this.childNodes));
1882
- }
1883
- updated(e) {
1884
- if (super.updated(e), !this._didSetup) {
1885
- this._didSetup = !0;
1886
- let e = this.querySelector(".void-nav-bar-content");
1887
- for (let t of this._userContent) e.appendChild(t);
1888
- }
1889
- }
1890
- render() {
1891
- return t`<div class="void-nav-bar-content"></div>`;
1892
- }
1893
- };
1894
- s([r({
1895
- type: Boolean,
1896
- reflect: !0
1897
- })], N.prototype, "sticky", void 0), s([r({
1898
- type: Boolean,
1899
- reflect: !0
1900
- })], N.prototype, "bordered", void 0), s([r({
1901
- type: String,
1902
- reflect: !0
1903
- })], N.prototype, "variant", void 0), customElements.get("void-nav-bar") || customElements.define("void-nav-bar", N);
1904
- //#endregion
1905
- //#region src/components/hamburger.ts
1906
- var be = class extends o {
1907
- constructor(...e) {
1908
- super(...e), this.active = !1, this.size = "md", this._handleClick = () => {
1909
- this.active = !this.active, this.dispatchEvent(new CustomEvent("void-toggle", {
1910
- bubbles: !0,
1911
- composed: !0,
1912
- detail: { active: this.active }
1913
- }));
1914
- }, this._handleKeydown = (e) => {
1915
- (e.key === " " || e.key === "Enter") && (e.preventDefault(), this._handleClick());
1916
- };
1917
- }
1918
- connectedCallback() {
1919
- super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("tabindex", "0"), this.setAttribute("aria-expanded", String(this.active)), this.setAttribute("aria-label", this.active ? "Close menu" : "Menu"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
1920
- }
1921
- disconnectedCallback() {
1922
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
1923
- }
1924
- updated(e) {
1925
- e.has("active") && (this.setAttribute("aria-expanded", String(this.active)), this.setAttribute("aria-label", this.active ? "Close menu" : "Menu"));
1926
- }
1927
- render() {
1928
- return t`
1929
- <span class="void-hamburger-lines">
1930
- <span class="void-hamburger-line"></span>
1931
- <span class="void-hamburger-line"></span>
1932
- <span class="void-hamburger-line"></span>
1933
- </span>
1934
- `;
1935
- }
1936
- };
1937
- s([r({
1938
- type: Boolean,
1939
- reflect: !0
1940
- })], be.prototype, "active", void 0), s([r({
1941
- type: String,
1942
- reflect: !0
1943
- })], be.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", be);
1944
- //#endregion
1945
- //#region src/components/compose-input.ts
1946
- var P = class extends o {
1947
- constructor(...e) {
1948
- super(...e), this.value = "", this.placeholder = "Type a message...", this.disabled = !1, this.maxlength = 0;
1949
- }
1950
- render() {
1951
- return t`
1952
- <div class="void-compose-input-wrapper">
1953
- <textarea
1954
- class="void-compose-input-textarea"
1955
- .value=${this.value}
1956
- placeholder=${this.placeholder}
1957
- ?disabled=${this.disabled}
1958
- maxlength=${this.maxlength > 0 ? this.maxlength : ""}
1959
- rows="1"
1960
- @input=${this._onInput}
1961
- @keydown=${this._onKeydown}
1962
- ></textarea>
1963
- <button
1964
- class="void-compose-input-send"
1965
- type="button"
1966
- ?disabled=${this.disabled || !this.value}
1967
- @click=${this._onSend}
1968
- aria-label="Send"
1969
- >
1970
- <svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1971
- <path d="M2 8L14 8M14 8L9 3M14 8L9 13" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
1972
- </svg>
1973
- </button>
1974
- </div>
1975
- `;
1976
- }
1977
- _onInput(e) {
1978
- let t = e.target;
1979
- this.value = t.value, t.style.height = "auto";
1980
- let n = t.scrollHeight;
1981
- t.style.height = "", this.style.setProperty("--void-compose-input-height", `${n}px`), this.dispatchEvent(new CustomEvent("void-input", {
1982
- bubbles: !0,
1983
- composed: !0,
1984
- detail: { value: this.value }
1985
- }));
1986
- }
1987
- _onKeydown(e) {
1988
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this._onSend());
1989
- }
1990
- _onSend() {
1991
- if (this.disabled || !this.value) return;
1992
- let e = this.value;
1993
- this.value = "", this._textarea && (this._textarea.style.height = "", this.style.removeProperty("--void-compose-input-height")), this.dispatchEvent(new CustomEvent("void-submit", {
1994
- bubbles: !0,
1995
- composed: !0,
1996
- detail: { value: e }
1997
- }));
1998
- }
1999
- };
2000
- s([r({ type: String })], P.prototype, "value", void 0), s([r({
2001
- type: String,
2002
- reflect: !0
2003
- })], P.prototype, "placeholder", void 0), s([r({
2004
- type: Boolean,
2005
- reflect: !0
2006
- })], P.prototype, "disabled", void 0), s([r({
2007
- type: Number,
2008
- reflect: !0
2009
- })], P.prototype, "maxlength", void 0), s([i(".void-compose-input-textarea")], P.prototype, "_textarea", void 0), customElements.get("void-compose-input") || customElements.define("void-compose-input", P);
2010
- //#endregion
2011
- //#region src/components/sidebar.ts
2012
- var F = class extends o {
2013
- constructor(...e) {
2014
- super(...e), this.collapsed = !1, this.width = "var(--void-sidebar-width)", this.collapsedWidth = "var(--void-sidebar-collapsed-width)", this.position = "left";
2015
- }
2016
- connectedCallback() {
2017
- super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Sidebar navigation"), this._updateWidth();
2018
- }
2019
- disconnectedCallback() {
2020
- super.disconnectedCallback();
2021
- }
2022
- updated(e) {
2023
- e.has("collapsed") && (this._updateWidth(), this.dispatchEvent(new CustomEvent("void-toggle", {
2024
- bubbles: !0,
2025
- composed: !0,
2026
- detail: { collapsed: this.collapsed }
2027
- }))), (e.has("width") || e.has("collapsedWidth")) && this._updateWidth();
2028
- }
2029
- _updateWidth() {
2030
- this.style.setProperty("--void-sidebar-width", this.collapsed ? this.collapsedWidth : this.width);
2031
- }
2032
- };
2033
- s([r({
2034
- type: Boolean,
2035
- reflect: !0
2036
- })], F.prototype, "collapsed", void 0), s([r({
2037
- type: String,
2038
- reflect: !0
2039
- })], F.prototype, "width", void 0), s([r({
2040
- type: String,
2041
- reflect: !0
2042
- })], F.prototype, "collapsedWidth", void 0), s([r({
2043
- type: String,
2044
- reflect: !0
2045
- })], F.prototype, "position", void 0), customElements.get("void-sidebar") || customElements.define("void-sidebar", F);
2046
- //#endregion
2047
- //#region src/components/toggle.ts
2048
- var I = class extends o {
2049
- constructor(...e) {
2050
- super(...e), this.pressed = !1, this.disabled = !1, this.color = "default", this.size = "md", this.variant = "outline", this._handleClick = () => {
2051
- this.disabled || (this.pressed = !this.pressed, this.dispatchEvent(new CustomEvent("void-change", {
2052
- bubbles: !0,
2053
- composed: !0,
2054
- detail: { pressed: this.pressed }
2055
- })));
2056
- }, this._handleKeydown = (e) => {
2057
- (e.key === " " || e.key === "Enter") && !this.disabled && (e.preventDefault(), this._handleClick());
2058
- };
2059
- }
2060
- connectedCallback() {
2061
- super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-pressed", String(this.pressed)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
2062
- }
2063
- disconnectedCallback() {
2064
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
2065
- }
2066
- updated(e) {
2067
- e.has("pressed") && this.setAttribute("aria-pressed", String(this.pressed)), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
2068
- }
2069
- };
2070
- s([r({
2071
- type: Boolean,
2072
- reflect: !0
2073
- })], I.prototype, "pressed", void 0), s([r({
2074
- type: Boolean,
2075
- reflect: !0
2076
- })], I.prototype, "disabled", void 0), s([r({
2077
- type: String,
2078
- reflect: !0
2079
- })], I.prototype, "color", void 0), s([r({
2080
- type: String,
2081
- reflect: !0
2082
- })], I.prototype, "size", void 0), s([r({
2083
- type: String,
2084
- reflect: !0
2085
- })], I.prototype, "variant", void 0), customElements.get("void-toggle") || customElements.define("void-toggle", I);
2086
- //#endregion
2087
- //#region src/components/toggle-group.ts
2088
- var L = class extends o {
2089
- constructor(...e) {
2090
- super(...e), this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
2091
- let t = e.target.closest("void-toggle");
2092
- if (!t || t.closest("void-toggle-group") !== this) return;
2093
- e.stopImmediatePropagation();
2094
- let n = t.getAttribute("value") || "";
2095
- if (n) if (this.multiple) {
2096
- let e = this._selectedValues(), t = e.indexOf(n);
2097
- t >= 0 ? e.splice(t, 1) : e.push(n), this.value = e.join(","), this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
2098
- bubbles: !0,
2099
- composed: !0,
2100
- detail: { value: e }
2101
- }));
2102
- } else {
2103
- let e = this.value === n ? "" : n;
2104
- this.value = e, this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
2105
- bubbles: !0,
2106
- composed: !0,
2107
- detail: { value: e }
2108
- }));
2109
- }
2110
- }, this._handleKeydown = (e) => {
2111
- let t = this._toggles().filter((e) => !e.disabled);
2112
- if (!t.length) return;
2113
- let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
2114
- if (e.key !== r && e.key !== i) return;
2115
- e.preventDefault();
2116
- let a = t.indexOf(e.target), o;
2117
- o = e.key === r ? a < 0 ? 0 : (a + 1) % t.length : a < 0 ? t.length - 1 : (a - 1 + t.length) % t.length, t[o].focus();
2118
- };
2119
- }
2120
- connectedCallback() {
2121
- super.connectedCallback(), this.setAttribute("role", "group"), this.addEventListener("void-change", this._handleChildChange), this.addEventListener("keydown", this._handleKeydown), this._syncToggles();
2122
- }
2123
- disconnectedCallback() {
2124
- super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange), this.removeEventListener("keydown", this._handleKeydown);
2125
- }
2126
- updated(e) {
2127
- (e.has("value") || e.has("disabled") || e.has("size") || e.has("color")) && this._syncToggles();
2128
- }
2129
- _toggles() {
2130
- return Array.from(this.querySelectorAll("void-toggle"));
2131
- }
2132
- _selectedValues() {
2133
- return this.value ? this.value.split(",").map((e) => e.trim()).filter(Boolean) : [];
2134
- }
2135
- _syncToggles() {
2136
- let e = this._selectedValues();
2137
- for (let t of this._toggles()) {
2138
- let n = t.getAttribute("value") || "";
2139
- t.pressed = e.includes(n), this.disabled && (t.disabled = !0), t.size = this.size, this.color !== "default" && (t.color = this.color);
2140
- }
2141
- }
2142
- };
2143
- s([r({
2144
- type: String,
2145
- reflect: !0
2146
- })], L.prototype, "value", void 0), s([r({
2147
- type: Boolean,
2148
- reflect: !0
2149
- })], L.prototype, "multiple", void 0), s([r({
2150
- type: Boolean,
2151
- reflect: !0
2152
- })], L.prototype, "disabled", void 0), s([r({
2153
- type: String,
2154
- reflect: !0
2155
- })], L.prototype, "size", void 0), s([r({
2156
- type: String,
2157
- reflect: !0
2158
- })], L.prototype, "color", void 0), s([r({
2159
- type: String,
2160
- reflect: !0
2161
- })], L.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", L);
2162
- //#endregion
2163
- //#region src/components/segmented-control.ts
2164
- var xe = class extends o {
2165
- constructor(...e) {
2166
- super(...e), this.value = "", this.disabled = !1;
2167
- }
2168
- connectedCallback() {
2169
- super.connectedCallback(), this.setAttribute("role", "radio"), this.setAttribute("tabindex", this.disabled ? "-1" : "0");
2170
- }
2171
- updated(e) {
2172
- e.has("disabled") && this.setAttribute("tabindex", this.disabled ? "-1" : "0");
2173
- }
2174
- };
2175
- s([r({
2176
- type: String,
2177
- reflect: !0
2178
- })], xe.prototype, "value", void 0), s([r({
2179
- type: Boolean,
2180
- reflect: !0
2181
- })], xe.prototype, "disabled", void 0), customElements.get("void-segmented-control-item") || customElements.define("void-segmented-control-item", xe);
2182
- var Se = class extends o {
2183
- constructor(...e) {
2184
- super(...e), this.value = "", this.size = "md", this.color = "default", this._handleClick = (e) => {
2185
- let t = e.target.closest("void-segmented-control-item");
2186
- !t || t.disabled || (this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
2187
- bubbles: !0,
2188
- composed: !0,
2189
- detail: { value: this.value }
2190
- })));
2191
- }, this._handleKeydown = (e) => {
2192
- let t = Array.from(this.querySelectorAll("void-segmented-control-item:not([disabled])")), n = t.findIndex((e) => e.value === this.value);
2193
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
2194
- e.preventDefault();
2195
- let r = (n + 1) % t.length;
2196
- t[r].focus(), t[r].click();
2197
- } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
2198
- e.preventDefault();
2199
- let r = (n - 1 + t.length) % t.length;
2200
- t[r].focus(), t[r].click();
2201
- }
2202
- };
2203
- }
2204
- connectedCallback() {
2205
- super.connectedCallback(), this.setAttribute("role", "radiogroup"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this._syncItems();
2206
- }
2207
- disconnectedCallback() {
2208
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
2209
- }
2210
- updated(e) {
2211
- e.has("value") && this._syncItems();
2212
- }
2213
- _syncItems() {
2214
- let e = Array.from(this.querySelectorAll("void-segmented-control-item"));
2215
- for (let t of e) t.setAttribute("aria-checked", String(t.value === this.value));
2216
- }
2217
- };
2218
- s([r({
2219
- type: String,
2220
- reflect: !0
2221
- })], Se.prototype, "value", void 0), s([r({
2222
- type: String,
2223
- reflect: !0
2224
- })], Se.prototype, "size", void 0), s([r({
2225
- type: String,
2226
- reflect: !0
2227
- })], Se.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", Se);
2228
- //#endregion
2229
- //#region src/components/stat.ts
2230
- var R = class extends o {
2231
- constructor(...e) {
2232
- super(...e), this.label = "", this.value = "", this.delta = "", this.trend = null, this.color = "default", this.size = "md";
2233
- }
2234
- connectedCallback() {
2235
- super.connectedCallback(), this.setAttribute("role", "figure");
2236
- }
2237
- render() {
2238
- return t`
2239
- ${this.label ? t`<span class="void-stat-label">${this.label}</span>` : ""}
2240
- <span class="void-stat-value">${this.value}</span>
2241
- ${this.delta ? t`<span class="void-stat-delta">${this.delta}</span>` : ""}
2242
- `;
2243
- }
2244
- };
2245
- s([r({
2246
- type: String,
2247
- reflect: !0
2248
- })], R.prototype, "label", void 0), s([r({
2249
- type: String,
2250
- reflect: !0
2251
- })], R.prototype, "value", void 0), s([r({
2252
- type: String,
2253
- reflect: !0
2254
- })], R.prototype, "delta", void 0), s([r({
2255
- type: String,
2256
- reflect: !0
2257
- })], R.prototype, "trend", void 0), s([r({
2258
- type: String,
2259
- reflect: !0
2260
- })], R.prototype, "color", void 0), s([r({
2261
- type: String,
2262
- reflect: !0
2263
- })], R.prototype, "size", void 0), customElements.get("void-stat") || customElements.define("void-stat", R);
2264
- //#endregion
2265
- //#region src/components/calendar.ts
2266
- function z(e) {
2267
- let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
2268
- return t ? [
2269
- Number(t[1]),
2270
- Number(t[2]) - 1,
2271
- Number(t[3])
2272
- ] : null;
2273
- }
2274
- function Ce(e, t, n) {
2275
- return `${String(e).padStart(4, "0")}-${String(t + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
2276
- }
2277
- function we() {
2278
- let e = /* @__PURE__ */ new Date();
2279
- return Ce(e.getFullYear(), e.getMonth(), e.getDate());
2280
- }
2281
- function Te(e, t) {
2282
- return new Date(e, t + 1, 0).getDate();
2283
- }
2284
- function Ee(e, t, n) {
2285
- return t && e < t ? t : n && e > n ? n : e;
2286
- }
2287
- function De(e, t) {
2288
- let n = z(e);
2289
- if (!n) return e;
2290
- let [r, i, a] = n;
2291
- return t.replace("YYYY", String(r).padStart(4, "0")).replace("MM", String(i + 1).padStart(2, "0")).replace("DD", String(a).padStart(2, "0"));
2292
- }
2293
- var B = class extends o {
2294
- constructor(...e) {
2295
- super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
2296
- this._viewMonth === 0 ? (this._viewMonth = 11, this._viewYear--) : this._viewMonth--, this.requestUpdate();
2297
- }, this._nextMonth = () => {
2298
- this._viewMonth === 11 ? (this._viewMonth = 0, this._viewYear++) : this._viewMonth++, this.requestUpdate();
2299
- }, this._prevYear = () => {
2300
- this._viewYear--, this.requestUpdate();
2301
- }, this._nextYear = () => {
2302
- this._viewYear++, this.requestUpdate();
2303
- }, this._prevYearsPage = () => {
2304
- this._yearsPageStart -= 12, this.requestUpdate();
2305
- }, this._nextYearsPage = () => {
2306
- this._yearsPageStart += 12, this.requestUpdate();
2307
- }, this._showMonths = () => {
2308
- this._view = "months", this.requestUpdate();
2309
- }, this._showYears = () => {
2310
- this._yearsPageStart = this._viewYear - this._viewYear % 12, this._view = "years", this.requestUpdate();
2311
- }, this._onDayKeydown = (e) => {
2312
- if (this.disabled) return;
2313
- let t = e.target.getAttribute("data-date");
2314
- if (!t) return;
2315
- let n = z(t);
2316
- if (!n) return;
2317
- let [r, i] = n, a = n[2], o = !0;
2318
- switch (e.key) {
2319
- case "ArrowLeft":
2320
- a--;
2321
- break;
2322
- case "ArrowRight":
2323
- a++;
2324
- break;
2325
- case "ArrowUp":
2326
- a -= 7;
2327
- break;
2328
- case "ArrowDown":
2329
- a += 7;
2330
- break;
2331
- case "Enter":
2332
- case " ":
2333
- this._selectDate(t), e.preventDefault();
2334
- return;
2335
- default: o = !1;
2336
- }
2337
- if (!o) return;
2338
- e.preventDefault();
2339
- let s = new Date(r, i, a), c = Ee(Ce(s.getFullYear(), s.getMonth(), s.getDate()), this.min || void 0, this.max || void 0);
2340
- this._focusDate = c;
2341
- let l = z(c);
2342
- l && (this._viewYear = l[0], this._viewMonth = l[1]), this.requestUpdate(), this.updateComplete.then(() => {
2343
- this.querySelector(`[data-date="${c}"]`)?.focus();
2344
- });
2345
- };
2346
- }
2347
- connectedCallback() {
2348
- super.connectedCallback(), this.setAttribute("role", "group"), this.setAttribute("aria-label", "Calendar"), this._didInit || (this._didInit = !0, this._initView());
2349
- }
2350
- updated(e) {
2351
- super.updated(e), e.has("value") && this._syncViewToValue();
2352
- }
2353
- _initView() {
2354
- let e = z(this.value);
2355
- if (e) this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value;
2356
- else {
2357
- let e = /* @__PURE__ */ new Date();
2358
- this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate = we();
2359
- }
2360
- this._yearsPageStart = this._viewYear - this._viewYear % 12;
2361
- }
2362
- _syncViewToValue() {
2363
- let e = z(this.value);
2364
- e && (this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value, this._yearsPageStart = this._viewYear - this._viewYear % 12, this.requestUpdate());
2365
- }
2366
- render() {
2367
- return this._view === "years" ? this._renderYears() : this._view === "months" ? this._renderMonths() : this._renderDays();
2368
- }
2369
- _renderDays() {
2370
- let e = this._getDayNames(), n = this._buildDayCells(), r = this._getMonthName(this._viewMonth);
2371
- return t`
2372
- <div class="void-calendar-header">
2373
- <button
2374
- class="void-calendar-nav"
2375
- aria-label="Previous month"
2376
- ?disabled=${this.disabled}
2377
- @click=${this._prevMonth}
2378
- >
2379
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
2380
- </button>
2381
- <button
2382
- class="void-calendar-title"
2383
- aria-label="Switch to month picker"
2384
- ?disabled=${this.disabled}
2385
- @click=${this._showMonths}
2386
- >${r} ${this._viewYear}</button>
2387
- <button
2388
- class="void-calendar-nav"
2389
- aria-label="Next month"
2390
- ?disabled=${this.disabled}
2391
- @click=${this._nextMonth}
2392
- >
2393
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
2394
- </button>
2395
- </div>
2396
- <div class="void-calendar-grid" role="grid" @keydown=${this._onDayKeydown}>
2397
- <div class="void-calendar-weekdays">
2398
- ${e.map((e) => t`<div class="void-calendar-weekday">${e}</div>`)}
2399
- </div>
2400
- <div class="void-calendar-days">
2401
- ${n.map((e) => {
2402
- let n = e.iso === this.value, r = e.iso === we(), i = e.outside, a = this.disabled || e.disabled;
2403
- return t`
2404
- <button
2405
- class="void-calendar-day${n ? " selected" : ""}${r ? " today" : ""}${i ? " outside" : ""}"
2406
- ?disabled=${a}
2407
- aria-selected=${n ? "true" : "false"}
2408
- aria-label=${e.iso}
2409
- tabindex=${e.iso === this._focusDate ? "0" : "-1"}
2410
- data-date=${e.iso}
2411
- @click=${() => this._selectDate(e.iso)}
2412
- >${e.day}</button>
2413
- `;
2414
- })}
2415
- </div>
2416
- </div>
2417
- `;
2418
- }
2419
- _getDayNames() {
2420
- let e = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), t = [];
2421
- for (let n = 0; n < 7; n++) {
2422
- let r = new Date(2024, 0, 7 + (this.firstDay + n) % 7);
2423
- t.push(e.format(r));
2424
- }
2425
- return t;
2426
- }
2427
- _getMonthName(e) {
2428
- return new Intl.DateTimeFormat(this.locale, { month: "long" }).format(new Date(2024, e, 1));
2429
- }
2430
- _buildDayCells() {
2431
- let e = this._viewYear, t = this._viewMonth, n = Te(e, t), r = (new Date(e, t, 1).getDay() - this.firstDay + 7) % 7, i = [], a = t === 0 ? 11 : t - 1, o = t === 0 ? e - 1 : e, s = Te(o, a);
2432
- for (let e = r - 1; e >= 0; e--) {
2433
- let t = s - e, n = Ce(o, a, t);
2434
- i.push({
2435
- day: t,
2436
- iso: n,
2437
- outside: !0,
2438
- disabled: this._isOutOfRange(n)
2439
- });
2440
- }
2441
- for (let r = 1; r <= n; r++) {
2442
- let n = Ce(e, t, r);
2443
- i.push({
2444
- day: r,
2445
- iso: n,
2446
- outside: !1,
2447
- disabled: this._isOutOfRange(n)
2448
- });
2449
- }
2450
- let c = t === 11 ? 0 : t + 1, l = t === 11 ? e + 1 : e, u = 42 - i.length;
2451
- for (let e = 1; e <= u; e++) {
2452
- let t = Ce(l, c, e);
2453
- i.push({
2454
- day: e,
2455
- iso: t,
2456
- outside: !0,
2457
- disabled: this._isOutOfRange(t)
2458
- });
2459
- }
2460
- return i;
2461
- }
2462
- _isOutOfRange(e) {
2463
- return !!(this.min && e < this.min || this.max && e > this.max);
2464
- }
2465
- _renderMonths() {
2466
- let e = new Intl.DateTimeFormat(this.locale, { month: "short" }), n = Array.from({ length: 12 }, (t, n) => ({
2467
- index: n,
2468
- name: e.format(new Date(2024, n, 1))
2469
- }));
2470
- return t`
2471
- <div class="void-calendar-header">
2472
- <button
2473
- class="void-calendar-nav"
2474
- aria-label="Previous year"
2475
- ?disabled=${this.disabled}
2476
- @click=${this._prevYear}
2477
- >
2478
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
2479
- </button>
2480
- <button
2481
- class="void-calendar-title"
2482
- aria-label="Switch to year picker"
2483
- ?disabled=${this.disabled}
2484
- @click=${this._showYears}
2485
- >${this._viewYear}</button>
2486
- <button
2487
- class="void-calendar-nav"
2488
- aria-label="Next year"
2489
- ?disabled=${this.disabled}
2490
- @click=${this._nextYear}
2491
- >
2492
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
2493
- </button>
2494
- </div>
2495
- <div class="void-calendar-months">
2496
- ${n.map((e) => t`
2497
- <button
2498
- class="void-calendar-month${e.index === this._viewMonth && this._viewYear === (/* @__PURE__ */ new Date()).getFullYear() ? " current" : ""}"
2499
- ?disabled=${this.disabled}
2500
- @click=${() => this._pickMonth(e.index)}
2501
- >${e.name}</button>
2502
- `)}
2503
- </div>
2504
- `;
2505
- }
2506
- _renderYears() {
2507
- let e = this._yearsPageStart, n = Array.from({ length: 12 }, (t, n) => e + n), r = (/* @__PURE__ */ new Date()).getFullYear();
2508
- return t`
2509
- <div class="void-calendar-header">
2510
- <button
2511
- class="void-calendar-nav"
2512
- aria-label="Previous years"
2513
- ?disabled=${this.disabled}
2514
- @click=${this._prevYearsPage}
2515
- >
2516
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
2517
- </button>
2518
- <span class="void-calendar-title void-calendar-title--static">${e} – ${e + 11}</span>
2519
- <button
2520
- class="void-calendar-nav"
2521
- aria-label="Next years"
2522
- ?disabled=${this.disabled}
2523
- @click=${this._nextYearsPage}
2524
- >
2525
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
2526
- </button>
2527
- </div>
2528
- <div class="void-calendar-years">
2529
- ${n.map((e) => t`
2530
- <button
2531
- class="void-calendar-year${e === r ? " current" : ""}"
2532
- ?disabled=${this.disabled}
2533
- @click=${() => this._pickYear(e)}
2534
- >${e}</button>
2535
- `)}
2536
- </div>
2537
- `;
2538
- }
2539
- _pickMonth(e) {
2540
- this._viewMonth = e, this._view = "days", this.requestUpdate();
2541
- }
2542
- _pickYear(e) {
2543
- this._viewYear = e, this._yearsPageStart = e - e % 12, this._view = "months", this.requestUpdate();
2544
- }
2545
- _selectDate(e) {
2546
- if (this.disabled || this._isOutOfRange(e)) return;
2547
- this.value = e, this._focusDate = e;
2548
- let t = z(e);
2549
- this._viewYear = t[0], this._viewMonth = t[1], this._view = "days", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
2550
- bubbles: !0,
2551
- composed: !0,
2552
- detail: {
2553
- value: e,
2554
- date: new Date(t[0], t[1], t[2])
2555
- }
2556
- }));
2557
- }
2558
- };
2559
- s([r({
2560
- type: String,
2561
- reflect: !0
2562
- })], B.prototype, "value", void 0), s([r({ type: String })], B.prototype, "min", void 0), s([r({ type: String })], B.prototype, "max", void 0), s([r({
2563
- type: Boolean,
2564
- reflect: !0
2565
- })], B.prototype, "disabled", void 0), s([r({
2566
- type: String,
2567
- reflect: !0
2568
- })], B.prototype, "size", void 0), s([r({ type: String })], B.prototype, "locale", void 0), s([r({
2569
- attribute: "first-day",
2570
- type: Number
2571
- })], B.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", B);
2572
- var V = class extends o {
2573
- constructor(...e) {
2574
- super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this._toggle = () => {
2575
- this.disabled || (this.open = !this.open, this.requestUpdate());
2576
- }, this._onCalendarChange = (e) => {
2577
- e.stopPropagation(), this.value = e.detail.value, this.open = !1, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
2578
- bubbles: !0,
2579
- composed: !0,
2580
- detail: e.detail
2581
- }));
2582
- }, this._onDocumentClick = (e) => {
2583
- this.open && !this.contains(e.target) && (this.open = !1, this.requestUpdate());
2584
- }, this._onDocumentKeydown = (e) => {
2585
- e.key === "Escape" && this.open && (this.open = !1, this.requestUpdate());
2586
- }, this._onInputKeydown = (e) => {
2587
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._toggle()), e.key === "Escape" && this.open && (this.open = !1, this.requestUpdate());
2588
- };
2589
- }
2590
- connectedCallback() {
2591
- super.connectedCallback(), this.setAttribute("role", "combobox"), this.setAttribute("aria-haspopup", "dialog"), document.addEventListener("mousedown", this._onDocumentClick), document.addEventListener("keydown", this._onDocumentKeydown);
2592
- }
2593
- disconnectedCallback() {
2594
- super.disconnectedCallback(), document.removeEventListener("mousedown", this._onDocumentClick), document.removeEventListener("keydown", this._onDocumentKeydown);
2595
- }
2596
- updated(e) {
2597
- super.updated(e), this.setAttribute("aria-expanded", String(this.open));
2598
- }
2599
- render() {
2600
- return t`
2601
- <div class="void-date-picker-anchor">
2602
- <input
2603
- class="void-date-picker-input"
2604
- .value=${this.value ? De(this.value, this.format) : ""}
2605
- placeholder=${this.placeholder}
2606
- ?disabled=${this.disabled}
2607
- readonly
2608
- aria-expanded=${String(this.open)}
2609
- aria-haspopup="dialog"
2610
- @click=${this._toggle}
2611
- @keydown=${this._onInputKeydown}
2612
- />
2613
- <button
2614
- class="void-date-picker-icon"
2615
- aria-label="Toggle calendar"
2616
- ?disabled=${this.disabled}
2617
- tabindex="-1"
2618
- @click=${this._toggle}
2619
- >
2620
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
2621
- <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
2622
- <line x1="16" y1="2" x2="16" y2="6"></line>
2623
- <line x1="8" y1="2" x2="8" y2="6"></line>
2624
- <line x1="3" y1="10" x2="21" y2="10"></line>
2625
- </svg>
2626
- </button>
2627
- </div>
2628
- ${this.open ? t`
2629
- <div class="void-date-picker-dropdown" role="dialog" aria-label="Choose date">
2630
- <void-calendar
2631
- value=${this.value}
2632
- min=${this.min}
2633
- max=${this.max}
2634
- ?disabled=${this.disabled}
2635
- size=${this.size}
2636
- locale=${this.locale}
2637
- first-day=${this.firstDay}
2638
- @void-change=${this._onCalendarChange}
2639
- ></void-calendar>
2640
- </div>
2641
- ` : n}
2642
- `;
2643
- }
2644
- };
2645
- s([r({
2646
- type: String,
2647
- reflect: !0
2648
- })], V.prototype, "value", void 0), s([r({ type: String })], V.prototype, "min", void 0), s([r({ type: String })], V.prototype, "max", void 0), s([r({
2649
- type: Boolean,
2650
- reflect: !0
2651
- })], V.prototype, "disabled", void 0), s([r({
2652
- type: String,
2653
- reflect: !0
2654
- })], V.prototype, "size", void 0), s([r({ type: String })], V.prototype, "locale", void 0), s([r({
2655
- attribute: "first-day",
2656
- type: Number
2657
- })], V.prototype, "firstDay", void 0), s([r({
2658
- type: Boolean,
2659
- reflect: !0
2660
- })], V.prototype, "open", void 0), s([r({ type: String })], V.prototype, "placeholder", void 0), s([r({ type: String })], V.prototype, "format", void 0), s([r({
2661
- type: String,
2662
- reflect: !0
2663
- })], V.prototype, "color", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", V);
2664
- //#endregion
2665
- //#region src/components/carousel.ts
2666
- var Oe = class extends o {
2667
- connectedCallback() {
2668
- super.connectedCallback(), this.setAttribute("role", "group"), this.setAttribute("aria-roledescription", "slide");
2669
- }
2670
- };
2671
- customElements.get("void-carousel-slide") || customElements.define("void-carousel-slide", Oe);
2672
- var H = class extends o {
2673
- constructor(...e) {
2674
- super(...e), this.active = 0, this.loop = !1, this.autoplay = !1, this.interval = 5e3, this.size = "md", this.controls = !0, this.indicators = !0, this.orientation = "horizontal", this._slides = [], this._autoplayTimer = null, this._userContent = [], this._didSetup = !1, this._prev = () => {
2675
- this._goTo(this.active - 1);
2676
- }, this._next = () => {
2677
- this._goTo(this.active + 1);
2678
- }, this._onMouseEnter = () => {
2679
- this.autoplay && this._stopAutoplay();
2680
- }, this._onMouseLeave = () => {
2681
- this.autoplay && this._startAutoplay();
2682
- }, this._onKeydown = (e) => {
2683
- let t = this.orientation === "horizontal", n = t ? "ArrowLeft" : "ArrowUp", r = t ? "ArrowRight" : "ArrowDown";
2684
- e.key === n ? (e.preventDefault(), this._prev()) : e.key === r && (e.preventDefault(), this._next());
2685
- };
2686
- }
2687
- connectedCallback() {
2688
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.setAttribute("role", "region"), this.setAttribute("aria-roledescription", "carousel"), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("keydown", this._onKeydown);
2689
- }
2690
- disconnectedCallback() {
2691
- super.disconnectedCallback(), this._stopAutoplay(), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), this.removeEventListener("keydown", this._onKeydown);
2692
- }
2693
- updated(e) {
2694
- super.updated(e);
2695
- let t = !1;
2696
- if (!this._didSetup) {
2697
- this._didSetup = !0;
2698
- let e = this.querySelector(".void-carousel-track");
2699
- if (e) for (let t of this._userContent) e.appendChild(t);
2700
- t = !0;
2701
- }
2702
- this._slides = Array.from(this.querySelectorAll("void-carousel-slide")), this._syncSlides(), (e.has("autoplay") || e.has("interval")) && (this._stopAutoplay(), this.autoplay && this._startAutoplay()), this.style.setProperty("--void-carousel-offset", String(this.active)), t && this.requestUpdate();
2703
- }
2704
- _syncSlides() {
2705
- for (let e = 0; e < this._slides.length; e++) {
2706
- let t = this._slides[e];
2707
- t.setAttribute("aria-label", `Slide ${e + 1} of ${this._slides.length}`), e === this.active ? t.setAttribute("active", "") : t.removeAttribute("active");
2708
- }
2709
- }
2710
- _goTo(e) {
2711
- let t = this._slides.length;
2712
- if (t === 0) return;
2713
- let n = this.active;
2714
- e = this.loop ? (e % t + t) % t : Math.max(0, Math.min(e, t - 1)), e !== n && (this.active = e, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
2715
- bubbles: !0,
2716
- composed: !0,
2717
- detail: {
2718
- index: this.active,
2719
- previous: n
2720
- }
2721
- })));
2722
- }
2723
- _goToSlide(e) {
2724
- this._goTo(e);
2725
- }
2726
- _startAutoplay() {
2727
- this._autoplayTimer ||= setInterval(() => {
2728
- this._next();
2729
- }, this.interval);
2730
- }
2731
- _stopAutoplay() {
2732
- this._autoplayTimer &&= (clearInterval(this._autoplayTimer), null);
2733
- }
2734
- render() {
2735
- let e = this._slides.length, n = !this.loop && this.active === 0, r = !this.loop && this.active === e - 1;
2736
- return t`
2737
- <div class="void-carousel-viewport">
2738
- <div class="void-carousel-track" aria-live="polite"></div>
2739
- </div>
2740
- ${this.controls ? t`
2741
- <button
2742
- class="void-carousel-prev"
2743
- aria-label="Previous slide"
2744
- ?disabled=${n}
2745
- @click=${this._prev}
2746
- >
2747
- <svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
2748
- <path d="M10 4L6 8l4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
2749
- </svg>
2750
- </button>
2751
- <button
2752
- class="void-carousel-next"
2753
- aria-label="Next slide"
2754
- ?disabled=${r}
2755
- @click=${this._next}
2756
- >
2757
- <svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
2758
- <path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
2759
- </svg>
2760
- </button>
2761
- ` : ""}
2762
- ${this.indicators ? t`
2763
- <div class="void-carousel-indicators" role="tablist" aria-label="Slide indicators">
2764
- ${this._slides.map((e, n) => t`
2765
- <button
2766
- class="void-carousel-dot"
2767
- role="tab"
2768
- aria-selected=${n === this.active ? "true" : "false"}
2769
- aria-label="Go to slide ${n + 1}"
2770
- ?active=${n === this.active}
2771
- @click=${() => this._goToSlide(n)}
2772
- ></button>
2773
- `)}
2774
- </div>
2775
- ` : ""}
2776
- `;
2777
- }
2778
- };
2779
- s([r({
2780
- type: Number,
2781
- reflect: !0
2782
- })], H.prototype, "active", void 0), s([r({
2783
- type: Boolean,
2784
- reflect: !0
2785
- })], H.prototype, "loop", void 0), s([r({
2786
- type: Boolean,
2787
- reflect: !0
2788
- })], H.prototype, "autoplay", void 0), s([r({ type: Number })], H.prototype, "interval", void 0), s([r({
2789
- type: String,
2790
- reflect: !0
2791
- })], H.prototype, "size", void 0), s([r({
2792
- type: Boolean,
2793
- reflect: !0
2794
- })], H.prototype, "controls", void 0), s([r({
2795
- type: Boolean,
2796
- reflect: !0
2797
- })], H.prototype, "indicators", void 0), s([r({
2798
- type: String,
2799
- reflect: !0
2800
- })], H.prototype, "orientation", void 0), customElements.get("void-carousel") || customElements.define("void-carousel", H);
2801
- //#endregion
2802
- //#region src/components/dropdown-menu.ts
2803
- var ke = class extends o {
2804
- constructor(...e) {
2805
- super(...e), this.open = !1, this.position = "bottom-start", this._triggerEl = null, this._panel = null, this._handleTriggerClick = () => {
2806
- this.open = !this.open;
2807
- }, this._handleOutsideClick = (e) => {
2808
- this.open && !this.contains(e.target) && (this.open = !1);
2809
- }, this._handleKeydown = (e) => {
2810
- if (e.key === "Escape" && this.open && (this.open = !1, this._triggerEl?.focus()), this.open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
2811
- e.preventDefault();
2812
- let t = Array.from(this.querySelectorAll("void-dropdown-menu-item:not([disabled])"));
2813
- if (!t.length) return;
2814
- let n = t.indexOf(document.activeElement);
2815
- e.key === "ArrowDown" ? (t[n + 1] ?? t[0]).focus() : (t[n - 1] ?? t[t.length - 1]).focus();
2816
- }
2817
- };
2818
- }
2819
- connectedCallback() {
2820
- super.connectedCallback(), this._triggerEl = this.children[0] ?? null, this._panel = document.createElement("div"), this._panel.className = "void-dropdown-menu-panel", this._panel.setAttribute("role", "menu");
2821
- let e = Array.from(this.childNodes);
2822
- for (let t of e) t !== this._triggerEl && this._panel.appendChild(t);
2823
- this.appendChild(this._panel), this._triggerEl?.addEventListener("click", this._handleTriggerClick), document.addEventListener("mousedown", this._handleOutsideClick), document.addEventListener("keydown", this._handleKeydown);
2824
- }
2825
- disconnectedCallback() {
2826
- super.disconnectedCallback(), this._triggerEl?.removeEventListener("click", this._handleTriggerClick), document.removeEventListener("mousedown", this._handleOutsideClick), document.removeEventListener("keydown", this._handleKeydown);
2827
- }
2828
- };
2829
- s([r({
2830
- type: Boolean,
2831
- reflect: !0
2832
- })], ke.prototype, "open", void 0), s([r({
2833
- type: String,
2834
- reflect: !0
2835
- })], ke.prototype, "position", void 0), customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu", ke);
2836
- var Ae = class extends o {
2837
- constructor(...e) {
2838
- super(...e), this.disabled = !1, this.destructive = !1, this._handleClick = (e) => {
2839
- if (this.disabled) {
2840
- e.stopImmediatePropagation();
2841
- return;
2842
- }
2843
- this.dispatchEvent(new CustomEvent("void-select", {
2844
- bubbles: !0,
2845
- composed: !0,
2846
- detail: { item: this }
2847
- }));
2848
- }, this._handleKeydown = (e) => {
2849
- (e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
2850
- };
2851
- }
2852
- connectedCallback() {
2853
- super.connectedCallback(), this.setAttribute("role", "menuitem"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
2854
- }
2855
- disconnectedCallback() {
2856
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
2857
- }
2858
- updated(e) {
2859
- e.has("disabled") && (this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-disabled", String(this.disabled)));
2860
- }
2861
- };
2862
- s([r({
2863
- type: Boolean,
2864
- reflect: !0
2865
- })], Ae.prototype, "disabled", void 0), s([r({
2866
- type: Boolean,
2867
- reflect: !0
2868
- })], Ae.prototype, "destructive", void 0), customElements.get("void-dropdown-menu-item") || customElements.define("void-dropdown-menu-item", Ae);
2869
- //#endregion
2870
- //#region src/components/indicator.ts
2871
- var U = class extends o {
2872
- constructor(...e) {
2873
- super(...e), this.color = "default", this.position = "top-right", this.count = null, this.ping = !1, this.size = "md";
2874
- }
2875
- connectedCallback() {
2876
- super.connectedCallback(), this.setAttribute("role", "status"), this._dot = document.createElement("span"), this._dot.className = "void-indicator-dot", this._updateDot(), this.appendChild(this._dot);
2877
- }
2878
- disconnectedCallback() {
2879
- super.disconnectedCallback(), this._dot?.remove();
2880
- }
2881
- updated() {
2882
- this._updateDot();
2883
- }
2884
- _updateDot() {
2885
- this._dot && (this._dot.textContent = this.count == null ? "" : String(this.count), this.setAttribute("aria-label", this.count == null ? "notification" : `${this.count} notifications`));
2886
- }
2887
- };
2888
- s([r({
2889
- type: String,
2890
- reflect: !0
2891
- })], U.prototype, "color", void 0), s([r({
2892
- type: String,
2893
- reflect: !0
2894
- })], U.prototype, "position", void 0), s([r({
2895
- type: Number,
2896
- reflect: !0
2897
- })], U.prototype, "count", void 0), s([r({
2898
- type: Boolean,
2899
- reflect: !0
2900
- })], U.prototype, "ping", void 0), s([r({
2901
- type: String,
2902
- reflect: !0
2903
- })], U.prototype, "size", void 0), customElements.get("void-indicator") || customElements.define("void-indicator", U);
2904
- //#endregion
2905
- //#region src/components/menu.ts
2906
- var W = class extends o {
2907
- constructor(...e) {
2908
- super(...e), this.open = !1, this.searchable = !1, this.size = "md", this.placeholder = "Search...", this._query = "", this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
2909
- if (this.open) {
2910
- if (e.key === "Escape") {
2911
- e.preventDefault(), this.open = !1, this._clearSearch();
2912
- return;
2913
- }
2914
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
2915
- e.preventDefault();
2916
- let t = Array.from(this.querySelectorAll("void-menu-item:not([disabled]):not([hidden])"));
2917
- if (!t.length) return;
2918
- let n = t.indexOf(document.activeElement);
2919
- e.key === "ArrowDown" ? (t[n + 1] ?? t[0]).focus() : (t[n - 1] ?? t[t.length - 1]).focus();
2920
- }
2921
- }
2922
- }, this._onSearchInput = (e) => {
2923
- this._query = e.target.value, this._filterItems();
2924
- };
2925
- }
2926
- connectedCallback() {
2927
- super.connectedCallback(), this.setAttribute("role", "menu"), this._didSetup || (this._userContent = Array.from(this.childNodes)), document.addEventListener("keydown", this._handleKeydown);
2928
- }
2929
- disconnectedCallback() {
2930
- super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown);
2931
- }
2932
- updated(e) {
2933
- if (super.updated(e), !this._didSetup) {
2934
- this._didSetup = !0;
2935
- let e = this.querySelector(".void-menu-list");
2936
- if (e) for (let t of this._userContent) e.appendChild(t);
2937
- }
2938
- e.has("open") && this.open && this.searchable && requestAnimationFrame(() => {
2939
- this.querySelector(".void-menu-search")?.focus();
2940
- });
2941
- }
2942
- _filterItems() {
2943
- let e = this._query.toLowerCase();
2944
- this.querySelectorAll("void-menu-item").forEach((t) => {
2945
- let n = (t.textContent?.trim() ?? "").toLowerCase(), r = (t.getAttribute("value") ?? "").toLowerCase();
2946
- !e || n.includes(e) || r.includes(e) ? t.removeAttribute("hidden") : t.setAttribute("hidden", "");
2947
- }), this.querySelectorAll("void-menu-group").forEach((e) => {
2948
- e.querySelectorAll("void-menu-item:not([hidden])").length === 0 ? e.setAttribute("hidden", "") : e.removeAttribute("hidden");
2949
- }), this._updateEmptyState();
2950
- }
2951
- _updateEmptyState() {
2952
- let e = this.querySelector(".void-menu-list");
2953
- if (!e) return;
2954
- let t = this.querySelector(".void-menu-empty");
2955
- this.querySelectorAll("void-menu-item:not([hidden])").length === 0 && this._query ? t || (t = document.createElement("div"), t.className = "void-menu-empty", t.textContent = "No results found", e.appendChild(t)) : t && t.remove();
2956
- }
2957
- _clearSearch() {
2958
- this._query = "";
2959
- let e = this.querySelector(".void-menu-search");
2960
- e && (e.value = ""), this.querySelectorAll("void-menu-item[hidden], void-menu-group[hidden]").forEach((e) => {
2961
- e.removeAttribute("hidden");
2962
- });
2963
- let t = this.querySelector(".void-menu-empty");
2964
- t && t.remove();
2965
- }
2966
- render() {
2967
- return this.open ? t`
2968
- ${this.searchable ? t`
2969
- <input
2970
- class="void-menu-search"
2971
- type="text"
2972
- placeholder=${this.placeholder}
2973
- autocomplete="off"
2974
- @input=${this._onSearchInput}
2975
- />
2976
- ` : n}
2977
- <div class="void-menu-list" role="listbox" aria-label="Menu options"></div>
2978
- ` : n;
2979
- }
2980
- };
2981
- s([r({
2982
- type: Boolean,
2983
- reflect: !0
2984
- })], W.prototype, "open", void 0), s([r({
2985
- type: Boolean,
2986
- reflect: !0
2987
- })], W.prototype, "searchable", void 0), s([r({
2988
- type: String,
2989
- reflect: !0
2990
- })], W.prototype, "size", void 0), s([r({ type: String })], W.prototype, "placeholder", void 0), customElements.get("void-menu") || customElements.define("void-menu", W);
2991
- var G = class extends o {
2992
- constructor(...e) {
2993
- super(...e), this.value = "", this.disabled = !1, this.shortcut = "", this.icon = "", this._originalContent = null, this._handleClick = (e) => {
2994
- if (this.disabled) {
2995
- e.stopImmediatePropagation();
2996
- return;
2997
- }
2998
- this.dispatchEvent(new CustomEvent("void-select", {
2999
- bubbles: !0,
3000
- composed: !0,
3001
- detail: { value: this.value }
3002
- }));
3003
- }, this._handleKeydown = (e) => {
3004
- (e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
3005
- };
3006
- }
3007
- connectedCallback() {
3008
- super.connectedCallback(), this.setAttribute("role", "menuitem"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this._originalContent === null && (this._originalContent = Array.from(this.childNodes).map((e) => e.cloneNode(!0))), this._buildContent();
3009
- }
3010
- disconnectedCallback() {
3011
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
3012
- }
3013
- updated(e) {
3014
- e.has("disabled") && (this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-disabled", String(this.disabled)));
3015
- }
3016
- _buildContent() {
3017
- if (!this.icon && !this.shortcut) return;
3018
- let e = document.createDocumentFragment();
3019
- if (this.icon) {
3020
- let t = document.createElement("span");
3021
- t.className = "void-menu-item-icon", t.textContent = this.icon, e.appendChild(t);
3022
- }
3023
- let t = document.createElement("span");
3024
- if (t.className = "void-menu-item-label", this._originalContent) for (let e of this._originalContent) t.appendChild(e.cloneNode(!0));
3025
- if (e.appendChild(t), this.shortcut) {
3026
- let t = document.createElement("span");
3027
- t.className = "void-menu-item-shortcut", t.textContent = this.shortcut, e.appendChild(t);
3028
- }
3029
- this.textContent = "", this.appendChild(e);
3030
- }
3031
- };
3032
- s([r({ type: String })], G.prototype, "value", void 0), s([r({
3033
- type: Boolean,
3034
- reflect: !0
3035
- })], G.prototype, "disabled", void 0), s([r({ type: String })], G.prototype, "shortcut", void 0), s([r({ type: String })], G.prototype, "icon", void 0), customElements.get("void-menu-item") || customElements.define("void-menu-item", G);
3036
- var je = class extends o {
3037
- constructor(...e) {
3038
- super(...e), this.label = "", this._userContent = [], this._didSetup = !1;
3039
- }
3040
- connectedCallback() {
3041
- super.connectedCallback(), this.setAttribute("role", "group"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes));
3042
- }
3043
- updated(e) {
3044
- if (super.updated(e), e.has("label") && this.label && this.setAttribute("aria-label", this.label), !this._didSetup) {
3045
- this._didSetup = !0;
3046
- let e = this.querySelector(".void-menu-group-items");
3047
- if (e) for (let t of this._userContent) e.appendChild(t);
3048
- }
3049
- }
3050
- render() {
3051
- return t`
3052
- ${this.label ? t`<div class="void-menu-group-label">${this.label}</div>` : n}
3053
- <div class="void-menu-group-items"></div>
3054
- `;
3055
- }
3056
- };
3057
- s([r({
3058
- type: String,
3059
- reflect: !0
3060
- })], je.prototype, "label", void 0), customElements.get("void-menu-group") || customElements.define("void-menu-group", je);
3061
- //#endregion
3062
- //#region src/components/number-input.ts
3063
- var K = class extends o {
3064
- constructor(...e) {
3065
- super(...e), this.value = 0, this.min = -Infinity, this.max = Infinity, this.step = 1, this.precision = -1, this.disabled = !1, this.readonly = !1, this.size = "md", this.color = "default", this.placeholder = "", this.controls = "sides", this.label = "", this._pressTimer = null, this._repeatTimer = null, this._repeatInterval = 300, this._repeatCount = 0;
3066
- }
3067
- connectedCallback() {
3068
- super.connectedCallback(), this.setAttribute("role", "spinbutton"), this.label && this.setAttribute("aria-label", this.label), isFinite(this.min) && this.setAttribute("aria-valuemin", String(this.min)), isFinite(this.max) && this.setAttribute("aria-valuemax", String(this.max)), this.setAttribute("aria-valuenow", String(this.value));
3069
- }
3070
- updated(e) {
3071
- e.has("value") && this.setAttribute("aria-valuenow", String(this.value)), e.has("min") && isFinite(this.min) && this.setAttribute("aria-valuemin", String(this.min)), e.has("max") && isFinite(this.max) && this.setAttribute("aria-valuemax", String(this.max)), e.has("label") && this.setAttribute("aria-label", this.label);
3072
- }
3073
- disconnectedCallback() {
3074
- super.disconnectedCallback(), this._stopRepeat();
3075
- }
3076
- _clamp(e) {
3077
- return Math.min(Math.max(e, this.min), this.max);
3078
- }
3079
- _format(e) {
3080
- return this.precision >= 0 ? e.toFixed(this.precision) : String(e);
3081
- }
3082
- _commit(e) {
3083
- let t = this._clamp(e);
3084
- if (t === this.value) return;
3085
- let n = this.value;
3086
- this.value = t, this._input && (this._input.value = this._format(t)), this.dispatchEvent(new CustomEvent("void-change", {
3087
- bubbles: !0,
3088
- composed: !0,
3089
- detail: {
3090
- value: t,
3091
- previous: n
3092
- }
3093
- }));
3094
- }
3095
- _increment() {
3096
- this.disabled || this.readonly || this._commit(this.value + this.step);
3097
- }
3098
- _decrement() {
3099
- this.disabled || this.readonly || this._commit(this.value - this.step);
3100
- }
3101
- _startRepeat(e) {
3102
- e(), this._pressTimer = setTimeout(() => {
3103
- this._repeatInterval = 300, this._repeatCount = 0, this._repeatTimer = setInterval(() => {
3104
- if (e(), this._repeatCount++, this._repeatCount % 5 == 0 && this._repeatInterval > 50) {
3105
- let t = Math.max(50, Math.floor(this._repeatInterval / 2));
3106
- t !== this._repeatInterval && (this._repeatInterval = t, clearInterval(this._repeatTimer), this._repeatTimer = setInterval(() => {
3107
- e(), this._repeatCount++;
3108
- }, this._repeatInterval));
3109
- }
3110
- }, this._repeatInterval);
3111
- }, 400);
3112
- }
3113
- _stopRepeat() {
3114
- this._pressTimer !== null && (clearTimeout(this._pressTimer), this._pressTimer = null), this._repeatTimer !== null && (clearInterval(this._repeatTimer), this._repeatTimer = null), this._repeatCount = 0;
3115
- }
3116
- _onKeydown(e) {
3117
- this.disabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this._increment()) : e.key === "ArrowDown" && (e.preventDefault(), this._decrement()));
3118
- }
3119
- _onBlur() {
3120
- if (!this._input || this.readonly) return;
3121
- let e = parseFloat(this._input.value);
3122
- isNaN(e) ? this._input.value = this._format(this.value) : this._commit(e);
3123
- }
3124
- _onInputChange() {}
3125
- render() {
3126
- let e = t`
3127
- <button
3128
- class="void-number-input-btn void-number-input-btn-dec"
3129
- type="button"
3130
- ?disabled=${this.disabled || this.readonly || this.value <= this.min}
3131
- aria-label="Decrement"
3132
- @pointerdown=${(e) => {
3133
- e.preventDefault(), this._startRepeat(() => this._decrement());
3134
- }}
3135
- @pointerup=${() => this._stopRepeat()}
3136
- @pointerleave=${() => this._stopRepeat()}
3137
- >
3138
- <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em">
3139
- <line x1="3" y1="8" x2="13" y2="8"/>
3140
- </svg>
3141
- </button>
3142
- `, n = t`
3143
- <button
3144
- class="void-number-input-btn void-number-input-btn-inc"
3145
- type="button"
3146
- ?disabled=${this.disabled || this.readonly || this.value >= this.max}
3147
- aria-label="Increment"
3148
- @pointerdown=${(e) => {
3149
- e.preventDefault(), this._startRepeat(() => this._increment());
3150
- }}
3151
- @pointerup=${() => this._stopRepeat()}
3152
- @pointerleave=${() => this._stopRepeat()}
3153
- >
3154
- <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em">
3155
- <line x1="8" y1="3" x2="8" y2="13"/>
3156
- <line x1="3" y1="8" x2="13" y2="8"/>
3157
- </svg>
3158
- </button>
3159
- `;
3160
- return t`
3161
- ${this.controls !== "none" && this.controls !== "right" ? e : ""}
3162
- <input
3163
- class="void-number-input-field"
3164
- type="text"
3165
- inputmode="numeric"
3166
- .value=${this._format(this.value)}
3167
- placeholder=${this.placeholder}
3168
- ?disabled=${this.disabled}
3169
- ?readonly=${this.readonly}
3170
- aria-label=${this.label || "Number input"}
3171
- @keydown=${this._onKeydown}
3172
- @blur=${this._onBlur}
3173
- @change=${this._onInputChange}
3174
- />
3175
- ${this.controls === "right" ? t`<div class="void-number-input-btn-group">${n}${e}</div>` : ""}
3176
- ${this.controls === "sides" ? n : ""}
3177
- `;
3178
- }
3179
- };
3180
- s([r({
3181
- type: Number,
3182
- reflect: !0
3183
- })], K.prototype, "value", void 0), s([r({ type: Number })], K.prototype, "min", void 0), s([r({ type: Number })], K.prototype, "max", void 0), s([r({ type: Number })], K.prototype, "step", void 0), s([r({ type: Number })], K.prototype, "precision", void 0), s([r({
3184
- type: Boolean,
3185
- reflect: !0
3186
- })], K.prototype, "disabled", void 0), s([r({
3187
- type: Boolean,
3188
- reflect: !0
3189
- })], K.prototype, "readonly", void 0), s([r({
3190
- type: String,
3191
- reflect: !0
3192
- })], K.prototype, "size", void 0), s([r({
3193
- type: String,
3194
- reflect: !0
3195
- })], K.prototype, "color", void 0), s([r({ type: String })], K.prototype, "placeholder", void 0), s([r({
3196
- type: String,
3197
- reflect: !0
3198
- })], K.prototype, "controls", void 0), s([r({ type: String })], K.prototype, "label", void 0), s([i(".void-number-input-field")], K.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", K);
3199
- //#endregion
3200
- //#region src/components/collapsible.ts
3201
- var Me = class extends o {
3202
- constructor(...e) {
3203
- super(...e), this.heading = "", this.open = !1, this.disabled = !1, this._id = Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
3204
- e.preventDefault(), !this.disabled && (this.open = !this.open, this.dispatchEvent(new CustomEvent("void-toggle", {
3205
- bubbles: !0,
3206
- composed: !0,
3207
- detail: { open: this.open }
3208
- })));
3209
- }, this._handleKeydown = (e) => {
3210
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._handleClick(e));
3211
- };
3212
- }
3213
- connectedCallback() {
3214
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
3215
- }
3216
- updated(e) {
3217
- if (super.updated(e), !this._didSetup) {
3218
- this._didSetup = !0;
3219
- let e = this.querySelector(".void-collapsible-inner");
3220
- if (e) for (let t of this._userContent) e.appendChild(t);
3221
- }
3222
- }
3223
- render() {
3224
- return t`
3225
- <button
3226
- id="trigger-${this._id}"
3227
- class="void-collapsible-trigger"
3228
- aria-expanded=${String(this.open)}
3229
- aria-controls="content-${this._id}"
3230
- @click=${this._handleClick}
3231
- @keydown=${this._handleKeydown}
3232
- >
3233
- ${this.heading}
3234
- <svg class="void-collapsible-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
3235
- <path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
3236
- </svg>
3237
- </button>
3238
- <div
3239
- id="content-${this._id}"
3240
- class="void-collapsible-content"
3241
- role="region"
3242
- aria-labelledby="trigger-${this._id}"
3243
- ><div class="void-collapsible-inner"></div></div>
3244
- `;
3245
- }
3246
- };
3247
- s([r({ type: String })], Me.prototype, "heading", void 0), s([r({
3248
- type: Boolean,
3249
- reflect: !0
3250
- })], Me.prototype, "open", void 0), s([r({
3251
- type: Boolean,
3252
- reflect: !0
3253
- })], Me.prototype, "disabled", void 0), customElements.get("void-collapsible") || customElements.define("void-collapsible", Me);
3254
- //#endregion
3255
- //#region src/components/editable.ts
3256
- var q = class extends o {
3257
- constructor(...e) {
3258
- super(...e), this.value = "", this.editing = !1, this.disabled = !1, this.placeholder = "Click to edit", this.submitMode = "both", this.size = "md", this._previousValue = "", this._handleClick = () => {
3259
- this.disabled || this.editing || this._enterEditMode();
3260
- }, this._handlePreviewKeydown = (e) => {
3261
- this.disabled || this.editing || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._enterEditMode());
3262
- }, this._handleInputKeydown = (e) => {
3263
- if (e.key === "Escape") {
3264
- e.preventDefault(), this._cancel();
3265
- return;
3266
- }
3267
- e.key === "Enter" && (this.submitMode === "enter" || this.submitMode === "both") && (e.preventDefault(), this._confirm());
3268
- }, this._handleBlur = () => {
3269
- this.editing && (this.submitMode === "blur" || this.submitMode === "both" ? this._confirm() : this._cancel());
3270
- };
3271
- }
3272
- connectedCallback() {
3273
- super.connectedCallback(), this.addEventListener("click", this._handleClick), this.addEventListener("dblclick", this._handleClick);
3274
- }
3275
- disconnectedCallback() {
3276
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("dblclick", this._handleClick);
3277
- }
3278
- render() {
3279
- return t`
3280
- <span
3281
- class="void-editable-preview"
3282
- tabindex=${this.disabled ? n : "0"}
3283
- @keydown=${this._handlePreviewKeydown}
3284
- >${this.value || t`<span class="void-editable-placeholder">${this.placeholder}</span>`}</span>
3285
- <input
3286
- class="void-editable-input"
3287
- .value=${this.value}
3288
- @keydown=${this._handleInputKeydown}
3289
- @blur=${this._handleBlur}
3290
- />
3291
- `;
3292
- }
3293
- _enterEditMode() {
3294
- this._previousValue = this.value, this.editing = !0, this.updateComplete.then(() => {
3295
- let e = this.querySelector(".void-editable-input");
3296
- e && (e.focus(), e.select());
3297
- });
3298
- }
3299
- _confirm() {
3300
- let e = this.querySelector(".void-editable-input");
3301
- e && (this.value = e.value), this.editing = !1, this.dispatchEvent(new CustomEvent("void-change", {
3302
- bubbles: !0,
3303
- composed: !0,
3304
- detail: { value: this.value }
3305
- }));
3306
- }
3307
- _cancel() {
3308
- this.value = this._previousValue, this.editing = !1, this.dispatchEvent(new CustomEvent("void-cancel", {
3309
- bubbles: !0,
3310
- composed: !0
3311
- }));
3312
- }
3313
- };
3314
- s([r({
3315
- type: String,
3316
- reflect: !0
3317
- })], q.prototype, "value", void 0), s([r({
3318
- type: Boolean,
3319
- reflect: !0
3320
- })], q.prototype, "editing", void 0), s([r({
3321
- type: Boolean,
3322
- reflect: !0
3323
- })], q.prototype, "disabled", void 0), s([r({ type: String })], q.prototype, "placeholder", void 0), s([r({
3324
- type: String,
3325
- reflect: !0,
3326
- attribute: "submit-mode"
3327
- })], q.prototype, "submitMode", void 0), s([r({
3328
- type: String,
3329
- reflect: !0
3330
- })], q.prototype, "size", void 0), customElements.get("void-editable") || customElements.define("void-editable", q);
3331
- //#endregion
3332
- //#region src/components/hover-card.ts
3333
- var J = class extends o {
3334
- constructor(...e) {
3335
- super(...e), this.open = !1, this.position = "bottom", this.openDelay = 300, this.closeDelay = 300, this._triggerEl = null, this._contentNodes = [], this._didSetup = !1, this._onTriggerEnter = () => {
3336
- clearTimeout(this._closeTimerId), this._openTimerId = setTimeout(() => {
3337
- this._openCard();
3338
- }, this.openDelay);
3339
- }, this._onTriggerLeave = () => {
3340
- clearTimeout(this._openTimerId), this._closeTimerId = setTimeout(() => {
3341
- this._closeCard();
3342
- }, this.closeDelay);
3343
- }, this._onBodyEnter = () => {
3344
- clearTimeout(this._closeTimerId);
3345
- }, this._onBodyLeave = () => {
3346
- this._closeTimerId = setTimeout(() => {
3347
- this._closeCard();
3348
- }, this.closeDelay);
3349
- }, this._onFocusIn = () => {
3350
- clearTimeout(this._closeTimerId), this._openCard();
3351
- }, this._onFocusOut = () => {
3352
- this._closeTimerId = setTimeout(() => {
3353
- this._closeCard();
3354
- }, this.closeDelay);
3355
- }, this._handleKeydown = (e) => {
3356
- e.key === "Escape" && this.open && this._closeCard();
3357
- };
3358
- }
3359
- connectedCallback() {
3360
- super.connectedCallback(), this._didSetup || (this._triggerEl = this.children[0] ?? null, this._contentNodes = Array.from(this.childNodes).filter((e) => e !== this._triggerEl)), document.addEventListener("keydown", this._handleKeydown);
3361
- }
3362
- disconnectedCallback() {
3363
- super.disconnectedCallback(), clearTimeout(this._openTimerId), clearTimeout(this._closeTimerId), document.removeEventListener("keydown", this._handleKeydown);
3364
- }
3365
- updated(e) {
3366
- if (super.updated(e), !this._didSetup) {
3367
- if (this._didSetup = !0, this._triggerEl) {
3368
- let e = document.createElement("div");
3369
- e.className = "void-hover-card-trigger", e.setAttribute("aria-haspopup", "dialog"), e.setAttribute("aria-expanded", String(this.open)), e.appendChild(this._triggerEl), e.addEventListener("mouseenter", this._onTriggerEnter), e.addEventListener("mouseleave", this._onTriggerLeave), e.addEventListener("focusin", this._onFocusIn), e.addEventListener("focusout", this._onFocusOut), this.appendChild(e);
3370
- }
3371
- let e = document.createElement("div");
3372
- e.className = "void-hover-card-body", e.setAttribute("role", "dialog"), e.addEventListener("mouseenter", this._onBodyEnter), e.addEventListener("mouseleave", this._onBodyLeave);
3373
- for (let t of this._contentNodes) e.appendChild(t);
3374
- this.appendChild(e);
3375
- }
3376
- if (e.has("open")) {
3377
- let e = this.querySelector(".void-hover-card-trigger");
3378
- e && e.setAttribute("aria-expanded", String(this.open));
3379
- }
3380
- }
3381
- _openCard() {
3382
- this.open || (this.open = !0, this.dispatchEvent(new CustomEvent("void-open", {
3383
- bubbles: !0,
3384
- composed: !0
3385
- })));
3386
- }
3387
- _closeCard() {
3388
- this.open && (this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
3389
- bubbles: !0,
3390
- composed: !0
3391
- })));
3392
- }
3393
- };
3394
- s([r({
3395
- type: Boolean,
3396
- reflect: !0
3397
- })], J.prototype, "open", void 0), s([r({
3398
- type: String,
3399
- reflect: !0
3400
- })], J.prototype, "position", void 0), s([r({
3401
- type: Number,
3402
- attribute: "open-delay"
3403
- })], J.prototype, "openDelay", void 0), s([r({
3404
- type: Number,
3405
- attribute: "close-delay"
3406
- })], J.prototype, "closeDelay", void 0), customElements.get("void-hover-card") || customElements.define("void-hover-card", J);
3407
- //#endregion
3408
- //#region src/components/pin-input.ts
3409
- var Y = class extends o {
3410
- constructor(...e) {
3411
- super(...e), this.length = 6, this.groups = "", this.value = "", this.disabled = !1, this.mask = !1, this.type = "numeric", this.size = "md", this.color = "default", this.placeholder = "";
3412
- }
3413
- get _effectiveLength() {
3414
- let e = this._parsedGroups;
3415
- return e.length > 0 ? e.reduce((e, t) => e + t, 0) : this.length;
3416
- }
3417
- get _parsedGroups() {
3418
- return this.groups ? this.groups.split(",").map((e) => parseInt(e.trim(), 10)).filter((e) => e > 0) : [];
3419
- }
3420
- _separatorIndices() {
3421
- let e = this._parsedGroups;
3422
- if (e.length < 2) return /* @__PURE__ */ new Set();
3423
- let t = /* @__PURE__ */ new Set(), n = 0;
3424
- for (let r = 0; r < e.length - 1; r++) n += e[r], t.add(n);
3425
- return t;
3426
- }
3427
- connectedCallback() {
3428
- super.connectedCallback(), this.setAttribute("role", "group"), this.setAttribute("aria-label", "PIN input");
3429
- }
3430
- _getCells() {
3431
- return Array.from(this.querySelectorAll(".void-pin-cell"));
3432
- }
3433
- _focusCell(e) {
3434
- let t = this._getCells();
3435
- e >= 0 && e < t.length && (t[e].focus(), t[e].select());
3436
- }
3437
- _collectValue() {
3438
- return this._getCells().map((e) => e.value).join("");
3439
- }
3440
- _syncValue() {
3441
- let e = this.value;
3442
- this.value = this._collectValue(), this.value !== e && (this.dispatchEvent(new CustomEvent("void-change", {
3443
- bubbles: !0,
3444
- composed: !0,
3445
- detail: { value: this.value }
3446
- })), this.value.length === this._effectiveLength && this.dispatchEvent(new CustomEvent("void-complete", {
3447
- bubbles: !0,
3448
- composed: !0,
3449
- detail: { value: this.value }
3450
- })));
3451
- }
3452
- _isValidChar(e) {
3453
- return this.type === "numeric" ? /^[0-9]$/.test(e) : /^[a-zA-Z0-9]$/.test(e);
3454
- }
3455
- _onInput(e, t) {
3456
- let n = e.target, r = n.value;
3457
- if (r && !this._isValidChar(r)) {
3458
- n.value = "";
3459
- return;
3460
- }
3461
- this._syncValue(), r && t < this._effectiveLength - 1 && this._focusCell(t + 1);
3462
- }
3463
- _onKeydown(e, t) {
3464
- let n = e.target;
3465
- if (e.key === "Backspace") {
3466
- if (n.value) n.value = "", this._syncValue();
3467
- else if (t > 0) {
3468
- this._focusCell(t - 1);
3469
- let e = this._getCells()[t - 1];
3470
- e.value = "", this._syncValue();
3471
- }
3472
- e.preventDefault();
3473
- } else e.key === "ArrowLeft" ? (e.preventDefault(), this._focusCell(t - 1)) : e.key === "ArrowRight" ? (e.preventDefault(), this._focusCell(t + 1)) : e.key === "Delete" && (n.value = "", this._syncValue(), e.preventDefault());
3474
- }
3475
- _onPaste(e) {
3476
- e.preventDefault();
3477
- let t = e.clipboardData?.getData("text") ?? "", n = this._getCells(), r = e.target, i = n.indexOf(r), a = 0;
3478
- for (let e = 0; e < t.length && i + a < n.length; e++) {
3479
- let r = t[e];
3480
- this._isValidChar(r) && (n[i + a].value = r, a++);
3481
- }
3482
- this._syncValue();
3483
- let o = Math.min(i + a, this._effectiveLength - 1);
3484
- this._focusCell(o);
3485
- }
3486
- _onFocus(e) {
3487
- e.target.select();
3488
- }
3489
- render() {
3490
- let e = [], r = this._separatorIndices();
3491
- for (let i = 0; i < this._effectiveLength; i++) {
3492
- r.has(i) && e.push(t`<span class="void-pin-separator" aria-hidden="true">–</span>`);
3493
- let a = this.value[i] ?? "";
3494
- e.push(t`
3495
- <input
3496
- class="void-pin-cell"
3497
- type=${this.mask ? "password" : "text"}
3498
- inputmode=${this.type === "numeric" ? "numeric" : "text"}
3499
- maxlength="1"
3500
- .value=${a}
3501
- placeholder=${this.placeholder || n}
3502
- ?disabled=${this.disabled}
3503
- autocomplete="one-time-code"
3504
- aria-label=${`Digit ${i + 1} of ${this._effectiveLength}`}
3505
- @input=${(e) => this._onInput(e, i)}
3506
- @keydown=${(e) => this._onKeydown(e, i)}
3507
- @paste=${this._onPaste}
3508
- @focus=${this._onFocus}
3509
- />
3510
- `);
3511
- }
3512
- return t`<div class="void-pin-input">${e}</div>`;
3513
- }
3514
- };
3515
- s([r({ type: Number })], Y.prototype, "length", void 0), s([r({
3516
- type: String,
3517
- reflect: !0
3518
- })], Y.prototype, "groups", void 0), s([r({ type: String })], Y.prototype, "value", void 0), s([r({
3519
- type: Boolean,
3520
- reflect: !0
3521
- })], Y.prototype, "disabled", void 0), s([r({
3522
- type: Boolean,
3523
- reflect: !0
3524
- })], Y.prototype, "mask", void 0), s([r({
3525
- type: String,
3526
- reflect: !0
3527
- })], Y.prototype, "type", void 0), s([r({
3528
- type: String,
3529
- reflect: !0
3530
- })], Y.prototype, "size", void 0), s([r({
3531
- type: String,
3532
- reflect: !0
3533
- })], Y.prototype, "color", void 0), s([r({ type: String })], Y.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", Y);
3534
- //#endregion
3535
- //#region src/components/tags-input.ts
3536
- var X = class extends o {
3537
- constructor(...e) {
3538
- super(...e), this.value = [], this.disabled = !1, this.readonly = !1, this.max = Infinity, this.placeholder = "Add tag...", this.size = "md", this.color = "default", this.variant = "outline", this.allowDuplicates = !1;
3539
- }
3540
- _tagText(e) {
3541
- return typeof e == "string" ? e : e.text;
3542
- }
3543
- _tagColor(e) {
3544
- return typeof e == "string" ? void 0 : e.color;
3545
- }
3546
- connectedCallback() {
3547
- super.connectedCallback(), this.setAttribute("role", "listbox");
3548
- }
3549
- render() {
3550
- let e = this.value.length >= this.max;
3551
- return t`
3552
- <div class="void-tags-input" @click=${this._focusInput} @keydown=${this._onContainerKeydown}>
3553
- ${this.value.map((e, r) => {
3554
- let i = this._tagText(e);
3555
- return t`
3556
- <span
3557
- class="void-tags-input-tag"
3558
- role="option"
3559
- aria-selected="true"
3560
- data-color=${this._tagColor(e) || n}
3561
- >
3562
- <span class="void-tags-input-tag-text">${i}</span>
3563
- ${!this.disabled && !this.readonly ? t`<button
3564
- class="void-tags-input-tag-remove"
3565
- aria-label="Remove ${i}"
3566
- @click=${(e) => {
3567
- e.stopPropagation(), this._removeTag(r);
3568
- }}
3569
- >×</button>` : n}
3570
- </span>
3571
- `;
3572
- })}
3573
- ${!e && !this.readonly ? t`<input
3574
- class="void-tags-input-field"
3575
- type="text"
3576
- placeholder=${this.value.length === 0 ? this.placeholder : ""}
3577
- ?disabled=${this.disabled}
3578
- @keydown=${this._onKeydown}
3579
- @paste=${this._onPaste}
3580
- />` : n}
3581
- </div>
3582
- `;
3583
- }
3584
- _focusInput() {
3585
- this.querySelector(".void-tags-input-field")?.focus();
3586
- }
3587
- _onContainerKeydown(e) {
3588
- e.target === this.querySelector(".void-tags-input") && this._focusInput();
3589
- }
3590
- _addTag(e) {
3591
- let t = e.trim();
3592
- t && (!this.allowDuplicates && this.value.some((e) => this._tagText(e) === t) || this.value.length >= this.max || (this.value = [...this.value, t], this._dispatchChange()));
3593
- }
3594
- _removeTag(e) {
3595
- this.disabled || this.readonly || (this.value = this.value.filter((t, n) => n !== e), this._dispatchChange());
3596
- }
3597
- _onKeydown(e) {
3598
- let t = e.target;
3599
- if (e.key === "Enter" || e.key === ",") {
3600
- e.preventDefault();
3601
- let n = (e.key, t.value);
3602
- this._addTag(n), t.value = "";
3603
- } else e.key === "Backspace" && t.value === "" && this.value.length > 0 && this._removeTag(this.value.length - 1);
3604
- }
3605
- _onPaste(e) {
3606
- let t = e.clipboardData?.getData("text") ?? "";
3607
- if (t.includes(",")) {
3608
- e.preventDefault();
3609
- let n = t.split(",");
3610
- for (let e of n) this._addTag(e);
3611
- }
3612
- }
3613
- _dispatchChange() {
3614
- this.dispatchEvent(new CustomEvent("void-change", {
3615
- bubbles: !0,
3616
- composed: !0,
3617
- detail: { value: this.value }
3618
- }));
3619
- }
3620
- };
3621
- s([r({ type: Array })], X.prototype, "value", void 0), s([r({
3622
- type: Boolean,
3623
- reflect: !0
3624
- })], X.prototype, "disabled", void 0), s([r({
3625
- type: Boolean,
3626
- reflect: !0
3627
- })], X.prototype, "readonly", void 0), s([r({ type: Number })], X.prototype, "max", void 0), s([r({ type: String })], X.prototype, "placeholder", void 0), s([r({
3628
- type: String,
3629
- reflect: !0
3630
- })], X.prototype, "size", void 0), s([r({
3631
- type: String,
3632
- reflect: !0
3633
- })], X.prototype, "color", void 0), s([r({
3634
- type: String,
3635
- reflect: !0
3636
- })], X.prototype, "variant", void 0), s([r({ type: Boolean })], X.prototype, "allowDuplicates", void 0), customElements.get("void-tags-input") || customElements.define("void-tags-input", X);
3637
- //#endregion
3638
- //#region src/components/nav-menu.ts
3639
- var Ne = class extends o {
3640
- constructor(...e) {
3641
- super(...e), this.orientation = "horizontal", this.width = "", this._handleItemOpen = (e) => {
3642
- let t = e.target, n = this._getItems();
3643
- for (let e of n) e !== t && e.open && (e.open = !1, e.dispatchEvent(new CustomEvent("void-close", {
3644
- bubbles: !0,
3645
- composed: !0
3646
- })));
3647
- }, this._handleKeydown = (e) => {
3648
- let t = this._getItems();
3649
- if (!t.length) return;
3650
- let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
3651
- if (e.key === r || e.key === i) {
3652
- e.preventDefault();
3653
- let n = t.map((e) => e.querySelector(".void-nav-menu-trigger")).filter(Boolean), i = n.indexOf(document.activeElement);
3654
- e.key === r ? (n[i + 1] ?? n[0])?.focus() : (n[i - 1] ?? n[n.length - 1])?.focus();
3655
- }
3656
- if (e.key === "Enter" || e.key === " ") {
3657
- let t = document.activeElement?.closest?.("void-nav-menu-item");
3658
- t && this.contains(t) && !t.href && (e.preventDefault(), t.open = !t.open, t.open ? t.dispatchEvent(new CustomEvent("void-open", {
3659
- bubbles: !0,
3660
- composed: !0
3661
- })) : t.dispatchEvent(new CustomEvent("void-close", {
3662
- bubbles: !0,
3663
- composed: !0
3664
- })));
3665
- }
3666
- if (e.key === "Escape") for (let e of t) e.open && (e.open = !1, e.dispatchEvent(new CustomEvent("void-close", {
3667
- bubbles: !0,
3668
- composed: !0
3669
- })), e.querySelector(".void-nav-menu-trigger")?.focus());
3670
- };
3671
- }
3672
- connectedCallback() {
3673
- super.connectedCallback(), this.setAttribute("role", "menubar"), this.addEventListener("keydown", this._handleKeydown), this.addEventListener("void-open", this._handleItemOpen);
3674
- }
3675
- disconnectedCallback() {
3676
- super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeydown), this.removeEventListener("void-open", this._handleItemOpen);
3677
- }
3678
- updated(e) {
3679
- super.updated(e), e.has("width") && (this.width ? this.style.setProperty("--void-nav-menu-width", this.width) : this.style.removeProperty("--void-nav-menu-width"));
3680
- }
3681
- _getItems() {
3682
- return Array.from(this.querySelectorAll(":scope > void-nav-menu-item"));
3683
- }
3684
- };
3685
- s([r({
3686
- type: String,
3687
- reflect: !0
3688
- })], Ne.prototype, "orientation", void 0), s([r({
3689
- type: String,
3690
- reflect: !0
3691
- })], Ne.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", Ne);
3692
- var Z = class extends o {
3693
- constructor(...e) {
3694
- super(...e), this.open = !1, this.disabled = !1, this.href = "", this.active = !1, this._triggerEl = null, this._contentEl = null, this._contentNodes = [], this._didSetup = !1, this._onMouseEnter = () => {
3695
- this.disabled || !this._contentEl || (clearTimeout(this._closeTimerId), this._openTimerId = setTimeout(() => {
3696
- this._openDropdown();
3697
- }, 150));
3698
- }, this._onMouseLeave = () => {
3699
- this._contentEl && (clearTimeout(this._openTimerId), this._closeTimerId = setTimeout(() => {
3700
- this._closeDropdown();
3701
- }, 300));
3702
- }, this._onContentEnter = () => {
3703
- clearTimeout(this._closeTimerId);
3704
- }, this._onContentLeave = () => {
3705
- this._closeTimerId = setTimeout(() => {
3706
- this._closeDropdown();
3707
- }, 300);
3708
- }, this._onOutsideClick = (e) => {
3709
- this.open && !this.contains(e.target) && this._closeDropdown();
3710
- };
3711
- }
3712
- connectedCallback() {
3713
- super.connectedCallback(), this.setAttribute("role", "none"), this._didSetup || (this._contentNodes = Array.from(this.childNodes)), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), document.addEventListener("mousedown", this._onOutsideClick);
3714
- }
3715
- disconnectedCallback() {
3716
- super.disconnectedCallback(), clearTimeout(this._openTimerId), clearTimeout(this._closeTimerId), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), document.removeEventListener("mousedown", this._onOutsideClick);
3717
- }
3718
- updated(e) {
3719
- if (super.updated(e), !this._didSetup) {
3720
- this._didSetup = !0, this.href ? (this._triggerEl = document.createElement("a"), this._triggerEl.href = this.href) : (this._triggerEl = document.createElement("button"), this._triggerEl.type = "button"), this._triggerEl.className = "void-nav-menu-trigger", this._triggerEl.setAttribute("role", "menuitem"), this._triggerEl.setAttribute("tabindex", this.disabled ? "-1" : "0");
3721
- let e = [], t = [];
3722
- for (let n of this._contentNodes) n.nodeType === Node.TEXT_NODE && n.textContent?.trim() ? e.push(n) : n.nodeType === Node.ELEMENT_NODE && t.push(n);
3723
- for (let t of e) this._triggerEl.appendChild(t);
3724
- if (this.appendChild(this._triggerEl), t.length > 0) {
3725
- this._triggerEl.setAttribute("aria-haspopup", "true"), this._triggerEl.setAttribute("aria-expanded", String(this.open)), this._contentEl = document.createElement("div"), this._contentEl.className = "void-nav-menu-content", this._contentEl.setAttribute("role", "menu");
3726
- for (let e of t) this._contentEl.appendChild(e);
3727
- this._contentEl.addEventListener("mouseenter", this._onContentEnter), this._contentEl.addEventListener("mouseleave", this._onContentLeave), this.appendChild(this._contentEl);
3728
- }
3729
- }
3730
- e.has("open") && this._triggerEl && this._triggerEl.setAttribute("aria-expanded", String(this.open)), e.has("disabled") && this._triggerEl && (this._triggerEl.setAttribute("tabindex", this.disabled ? "-1" : "0"), this._triggerEl.setAttribute("aria-disabled", String(this.disabled)), this._triggerEl instanceof HTMLButtonElement && (this._triggerEl.disabled = this.disabled)), e.has("href") && this._triggerEl instanceof HTMLAnchorElement && (this._triggerEl.href = this.href);
3731
- }
3732
- _openDropdown() {
3733
- this.open || (this.open = !0, this.dispatchEvent(new CustomEvent("void-open", {
3734
- bubbles: !0,
3735
- composed: !0
3736
- })));
3737
- }
3738
- _closeDropdown() {
3739
- this.open && (this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
3740
- bubbles: !0,
3741
- composed: !0
3742
- })));
3743
- }
3744
- };
3745
- s([r({
3746
- type: Boolean,
3747
- reflect: !0
3748
- })], Z.prototype, "open", void 0), s([r({
3749
- type: Boolean,
3750
- reflect: !0
3751
- })], Z.prototype, "disabled", void 0), s([r({ type: String })], Z.prototype, "href", void 0), s([r({
3752
- type: Boolean,
3753
- reflect: !0
3754
- })], Z.prototype, "active", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", Z);
3755
- //#endregion
3756
- //#region src/components/color-picker.ts
3757
- var Q = class e extends o {
3758
- constructor(...e) {
3759
- super(...e), this.value = "#000000", this.disabled = !1, this.size = "md", this.swatches = [], this.showInput = !0, this.variant = "default", this.open = !1, this._hue = 0, this._saturation = 0, this._brightness = 0, this._dragging = null, this._boundPointerMove = null, this._boundPointerUp = null, this._onDocumentClick = (e) => {
3760
- this.open && (this.contains(e.target) || (this.open = !1));
3761
- };
3762
- }
3763
- connectedCallback() {
3764
- super.connectedCallback(), this._syncFromHex(this.value), this._boundPointerMove = this._onPointerMove.bind(this), this._boundPointerUp = this._onPointerUp.bind(this);
3765
- }
3766
- disconnectedCallback() {
3767
- super.disconnectedCallback(), document.removeEventListener("pointermove", this._boundPointerMove), document.removeEventListener("pointerup", this._boundPointerUp);
3768
- }
3769
- _applyCustomProperties() {
3770
- let e = this._hsvToHex(this._hue, 100, 100);
3771
- this.style.setProperty("--void-cp-hue", e), this.style.setProperty("--void-cp-current", this.value), this.style.setProperty("--void-cp-area-x", `${this._saturation}%`), this.style.setProperty("--void-cp-area-y", `${100 - this._brightness}%`), this.style.setProperty("--void-cp-hue-x", `${this._hue / 360 * 100}%`);
3772
- }
3773
- _hsvToRgb(e, t, n) {
3774
- let r = t / 100, i = n / 100, a = i * r, o = a * (1 - Math.abs(e / 60 % 2 - 1)), s = i - a, c = 0, l = 0, u = 0;
3775
- return e < 60 ? (c = a, l = o, u = 0) : e < 120 ? (c = o, l = a, u = 0) : e < 180 ? (c = 0, l = a, u = o) : e < 240 ? (c = 0, l = o, u = a) : e < 300 ? (c = o, l = 0, u = a) : (c = a, l = 0, u = o), [
3776
- Math.round((c + s) * 255),
3777
- Math.round((l + s) * 255),
3778
- Math.round((u + s) * 255)
3779
- ];
3780
- }
3781
- _hsvToHex(e, t, n) {
3782
- let [r, i, a] = this._hsvToRgb(e, t, n);
3783
- return `#${r.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`;
3784
- }
3785
- _hexToRgb(e) {
3786
- let t = e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);
3787
- return t ? [
3788
- parseInt(t[1], 16),
3789
- parseInt(t[2], 16),
3790
- parseInt(t[3], 16)
3791
- ] : null;
3792
- }
3793
- _rgbToHsv(e, t, n) {
3794
- let r = e / 255, i = t / 255, a = n / 255, o = Math.max(r, i, a), s = o - Math.min(r, i, a), c = 0;
3795
- s !== 0 && (c = o === r ? (i - a) / s % 6 : o === i ? (a - r) / s + 2 : (r - i) / s + 4, c = Math.round(c * 60), c < 0 && (c += 360));
3796
- let l = o === 0 ? 0 : Math.round(s / o * 100), u = Math.round(o * 100);
3797
- return [
3798
- c,
3799
- l,
3800
- u
3801
- ];
3802
- }
3803
- _syncFromHex(e) {
3804
- let t = this._hexToRgb(e);
3805
- if (!t) return;
3806
- let [n, r, i] = this._rgbToHsv(...t);
3807
- this._hue = n, this._saturation = r, this._brightness = i;
3808
- }
3809
- static isValidHex(e) {
3810
- return /^#[a-f\d]{6}$/i.test(e);
3811
- }
3812
- _updateValue() {
3813
- let e = this._hsvToHex(this._hue, this._saturation, this._brightness);
3814
- this.value = e, this.dispatchEvent(new CustomEvent("void-change", {
3815
- bubbles: !0,
3816
- composed: !0,
3817
- detail: { value: this.value }
3818
- }));
3819
- }
3820
- _onAreaPointerDown(e) {
3821
- this.disabled || (this._dragging = "area", this._updateAreaFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
3822
- }
3823
- _onHuePointerDown(e) {
3824
- this.disabled || (this._dragging = "hue", this._updateHueFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
3825
- }
3826
- _onPointerMove(e) {
3827
- this._dragging === "area" ? this._updateAreaFromPointer(e) : this._dragging === "hue" && this._updateHueFromPointer(e);
3828
- }
3829
- _onPointerUp() {
3830
- this._dragging = null, document.removeEventListener("pointermove", this._boundPointerMove), document.removeEventListener("pointerup", this._boundPointerUp);
3831
- }
3832
- _updateAreaFromPointer(e) {
3833
- let t = this.querySelector(".void-color-picker-area");
3834
- if (!t) return;
3835
- let n = t.getBoundingClientRect(), r = Math.max(0, Math.min(1, (e.clientX - n.left) / n.width)), i = Math.max(0, Math.min(1, (e.clientY - n.top) / n.height));
3836
- this._saturation = Math.round(r * 100), this._brightness = Math.round((1 - i) * 100), this._updateValue();
3837
- }
3838
- _updateHueFromPointer(e) {
3839
- let t = this.querySelector(".void-color-picker-hue");
3840
- if (!t) return;
3841
- let n = t.getBoundingClientRect(), r = Math.max(0, Math.min(1, (e.clientX - n.left) / n.width));
3842
- this._hue = Math.round(r * 360), this._updateValue();
3843
- }
3844
- _onHexInput(t) {
3845
- let n = t.target.value.trim();
3846
- n.startsWith("#") || (n = "#" + n), e.isValidHex(n) && (this._syncFromHex(n), this.value = n.toLowerCase(), this.dispatchEvent(new CustomEvent("void-change", {
3847
- bubbles: !0,
3848
- composed: !0,
3849
- detail: { value: this.value }
3850
- })));
3851
- }
3852
- _onSwatchClick(e) {
3853
- this.disabled || (this._syncFromHex(e), this.value = e.toLowerCase(), this.dispatchEvent(new CustomEvent("void-change", {
3854
- bubbles: !0,
3855
- composed: !0,
3856
- detail: { value: this.value }
3857
- })));
3858
- }
3859
- _onCompactTriggerClick() {
3860
- this.disabled || (this.open = !this.open);
3861
- }
3862
- _onCompactHexInput(e) {
3863
- this._onHexInput(e);
3864
- }
3865
- updated(e) {
3866
- e.has("value") && !this._dragging && this._syncFromHex(this.value), this._applyCustomProperties(), e.has("open") && (this.open ? document.addEventListener("click", this._onDocumentClick, !0) : document.removeEventListener("click", this._onDocumentClick, !0));
3867
- }
3868
- _renderPicker() {
3869
- return t`
3870
- <div class="void-color-picker">
3871
- <div
3872
- class="void-color-picker-area"
3873
- @pointerdown=${this._onAreaPointerDown}
3874
- >
3875
- <div class="void-color-picker-area-thumb"></div>
3876
- </div>
3877
- <div
3878
- class="void-color-picker-hue"
3879
- @pointerdown=${this._onHuePointerDown}
3880
- >
3881
- <div class="void-color-picker-hue-thumb"></div>
3882
- </div>
3883
- ${this.showInput ? t`
3884
- <div class="void-color-picker-field">
3885
- <span class="void-color-picker-field-swatch"></span>
3886
- <span class="void-color-picker-field-separator"></span>
3887
- <input
3888
- class="void-color-picker-input"
3889
- type="text"
3890
- .value=${this.value}
3891
- ?disabled=${this.disabled}
3892
- maxlength="7"
3893
- @change=${this._onHexInput}
3894
- />
3895
- </div>
3896
- ` : t`
3897
- <div class="void-color-picker-preview"></div>
3898
- `}
3899
- ${this.swatches.length > 0 ? t`
3900
- <div class="void-color-picker-swatches">
3901
- ${this.swatches.map((e) => t`
3902
- <button
3903
- class="void-color-picker-swatch"
3904
- style="--void-cp-swatch:${e}"
3905
- aria-label=${e}
3906
- ?disabled=${this.disabled}
3907
- @click=${() => this._onSwatchClick(e)}
3908
- ></button>
3909
- `)}
3910
- </div>
3911
- ` : n}
3912
- </div>
3913
- `;
3914
- }
3915
- render() {
3916
- return this.variant === "compact" ? t`
3917
- <div class="void-color-picker-compact">
3918
- <button
3919
- class="void-color-picker-compact-trigger"
3920
- @click=${this._onCompactTriggerClick}
3921
- ?disabled=${this.disabled}
3922
- aria-expanded=${String(this.open)}
3923
- aria-haspopup="dialog"
3924
- >
3925
- <span class="void-color-picker-compact-swatch"></span>
3926
- <span class="void-color-picker-field-separator"></span>
3927
- <input
3928
- class="void-color-picker-compact-input"
3929
- type="text"
3930
- .value=${this.value}
3931
- ?disabled=${this.disabled}
3932
- maxlength="7"
3933
- @click=${(e) => e.stopPropagation()}
3934
- @change=${this._onCompactHexInput}
3935
- />
3936
- </button>
3937
- ${this.open ? t`
3938
- <div class="void-color-picker-compact-dropdown" role="dialog" aria-label="Color picker">
3939
- ${this._renderPicker()}
3940
- </div>
3941
- ` : n}
3942
- </div>
3943
- ` : this._renderPicker();
3944
- }
3945
- };
3946
- s([r({
3947
- type: String,
3948
- reflect: !0
3949
- })], Q.prototype, "value", void 0), s([r({
3950
- type: Boolean,
3951
- reflect: !0
3952
- })], Q.prototype, "disabled", void 0), s([r({
3953
- type: String,
3954
- reflect: !0
3955
- })], Q.prototype, "size", void 0), s([r({ type: Array })], Q.prototype, "swatches", void 0), s([r({
3956
- type: Boolean,
3957
- reflect: !0
3958
- })], Q.prototype, "showInput", void 0), s([r({
3959
- type: String,
3960
- reflect: !0
3961
- })], Q.prototype, "variant", void 0), s([r({
3962
- type: Boolean,
3963
- reflect: !0
3964
- })], Q.prototype, "open", void 0), customElements.get("void-color-picker") || customElements.define("void-color-picker", Q);
3965
- //#endregion
3966
- //#region src/components/action-input.ts
3967
- var $ = class extends o {
3968
- constructor(...e) {
3969
- super(...e), this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.name = "", this.autocomplete = "", this.size = "md", this.color = "default", this.type = "text", this.icon = "search", this.actionLabel = "Action", this.position = "right", this.tooltipPosition = "top";
3970
- }
3971
- _renderIcon() {
3972
- switch (this.icon) {
3973
- case "copy": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666"/><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"/></svg>`;
3974
- case "search": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"/><path d="M21 21l-6 -6"/></svg>`;
3975
- case "send": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 14l11 -11"/><path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5"/></svg>`;
3976
- case "eye": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/><path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/></svg>`;
3977
- case "eye-off": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/><path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"/><path d="M3 3l18 18"/></svg>`;
3978
- case "check": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10"/></svg>`;
3979
- case "x": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 6l-12 12"/><path d="M6 6l12 12"/></svg>`;
3980
- case "arrow-right": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l14 0"/><path d="M13 18l6 -6"/><path d="M13 6l6 6"/></svg>`;
3981
- case "clipboard": return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"/><path d="M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2"/></svg>`;
3982
- default: return t`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"/><path d="M21 21l-6 -6"/></svg>`;
3983
- }
3984
- }
3985
- _onInput(e) {
3986
- let t = e.target;
3987
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
3988
- bubbles: !0,
3989
- composed: !0,
3990
- detail: { value: this.value }
3991
- }));
3992
- }
3993
- _onChange(e) {
3994
- let t = e.target;
3995
- this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
3996
- bubbles: !0,
3997
- composed: !0,
3998
- detail: { value: this.value }
3999
- }));
4000
- }
4001
- _onAction() {
4002
- this.disabled || this.dispatchEvent(new CustomEvent("void-action", {
4003
- bubbles: !0,
4004
- composed: !0,
4005
- detail: { value: this.value }
4006
- }));
4007
- }
4008
- render() {
4009
- let e = t`
4010
- <void-tooltip text=${this.actionLabel} position=${this.tooltipPosition}>
4011
- <button
4012
- class="void-action-input-btn"
4013
- type="button"
4014
- ?disabled=${this.disabled}
4015
- aria-label=${this.actionLabel}
4016
- @click=${this._onAction}
4017
- >${this._renderIcon()}</button>
4018
- </void-tooltip>
4019
- `;
4020
- return t`
4021
- ${this.position === "left" ? e : ""}
4022
- <input
4023
- class="void-action-input-field"
4024
- type=${this.type}
4025
- .value=${this.value}
4026
- placeholder=${this.placeholder}
4027
- ?disabled=${this.disabled}
4028
- ?readonly=${this.readonly}
4029
- name=${this.name}
4030
- autocomplete=${this.autocomplete}
4031
- aria-label=${this.actionLabel}
4032
- @input=${this._onInput}
4033
- @change=${this._onChange}
4034
- />
4035
- ${this.position === "right" ? e : ""}
4036
- `;
4037
- }
4038
- };
4039
- s([r({ type: String })], $.prototype, "value", void 0), s([r({
4040
- type: String,
4041
- reflect: !0
4042
- })], $.prototype, "placeholder", void 0), s([r({
4043
- type: Boolean,
4044
- reflect: !0
4045
- })], $.prototype, "disabled", void 0), s([r({
4046
- type: Boolean,
4047
- reflect: !0
4048
- })], $.prototype, "readonly", void 0), s([r({
4049
- type: String,
4050
- reflect: !0
4051
- })], $.prototype, "name", void 0), s([r({
4052
- type: String,
4053
- reflect: !0
4054
- })], $.prototype, "autocomplete", void 0), s([r({
4055
- type: String,
4056
- reflect: !0
4057
- })], $.prototype, "size", void 0), s([r({
4058
- type: String,
4059
- reflect: !0
4060
- })], $.prototype, "color", void 0), s([r({
4061
- type: String,
4062
- reflect: !0
4063
- })], $.prototype, "type", void 0), s([r({
4064
- type: String,
4065
- reflect: !0
4066
- })], $.prototype, "icon", void 0), s([r({
4067
- type: String,
4068
- attribute: "action-label"
4069
- })], $.prototype, "actionLabel", void 0), s([r({
4070
- type: String,
4071
- reflect: !0
4072
- })], $.prototype, "position", void 0), s([r({
4073
- type: String,
4074
- reflect: !0,
4075
- attribute: "tooltip-position"
4076
- })], $.prototype, "tooltipPosition", void 0), customElements.get("void-action-input") || customElements.define("void-action-input", $);
4077
- //#endregion
4078
- export { ce as VoidAccordion, le as VoidAccordionItem, $ as VoidActionInput, re as VoidAlert, f as VoidAvatar, c as VoidBadge, _e as VoidBanner, ue as VoidBreadcrumbs, l as VoidButton, B as VoidCalendar, he as VoidCard, H as VoidCarousel, Oe as VoidCarouselSlide, _ as VoidCheckbox, ye as VoidCheckboxGroup, Me as VoidCollapsible, Q as VoidColorPicker, A as VoidCombobox, P as VoidComposeInput, V as VoidDatePicker, S as VoidDialog, u as VoidDivider, T as VoidDrawer, ke as VoidDropdownMenu, Ae as VoidDropdownMenuItem, q as VoidEditable, o as VoidElement, k as VoidErrorFallback, b as VoidField, M as VoidFileUpload, be as VoidHamburger, J as VoidHoverCard, U as VoidIndicator, m as VoidInput, de as VoidList, fe as VoidListItem, W as VoidMenu, je as VoidMenuGroup, G as VoidMenuItem, x as VoidMultiselect, N as VoidNavBar, Ne as VoidNavMenu, Z as VoidNavMenuItem, K as VoidNumberInput, oe as VoidOption, O as VoidPagination, ae as VoidPanel, Y as VoidPinInput, ge as VoidPopover, p as VoidProgress, v as VoidRadio, y as VoidRadioGroup, ve as VoidScrollArea, Se as VoidSegmentedControl, xe as VoidSegmentedControlItem, g as VoidSelect, F as VoidSidebar, te as VoidSkeleton, j as VoidSlider, ee as VoidSpinner, R as VoidStat, ne as VoidStatusDot, me as VoidStepper, d as VoidSwitch, C as VoidTabPanel, D as VoidTable, se as VoidTabs, ie as VoidTag, X as VoidTagsInput, h as VoidTextarea, w as VoidToast, pe as VoidToastContainer, I as VoidToggle, L as VoidToggleGroup, E as VoidTooltip };
1
+ import { VoidElement as e } from "./base.js";
2
+ import { VoidBadge as t } from "./components/badge.js";
3
+ import { VoidButton as n } from "./components/button.js";
4
+ import { VoidDivider as r } from "./components/divider.js";
5
+ import { VoidSpinner as i } from "./components/spinner.js";
6
+ import { VoidSkeleton as a } from "./components/skeleton.js";
7
+ import { VoidStatusDot as o } from "./components/status-dot.js";
8
+ import { VoidSwitch as s } from "./components/switch.js";
9
+ import { VoidAvatar as c } from "./components/avatar.js";
10
+ import { VoidAlert as l } from "./components/alert.js";
11
+ import { VoidTag as u } from "./components/tag.js";
12
+ import { VoidProgress as d } from "./components/progress.js";
13
+ import { VoidPanel as f } from "./components/panel.js";
14
+ import { VoidInput as p } from "./components/input.js";
15
+ import { VoidTextarea as m } from "./components/textarea.js";
16
+ import { VoidSelect as h } from "./components/select.js";
17
+ import { VoidCheckbox as g } from "./components/checkbox.js";
18
+ import { VoidRadio as _ } from "./components/radio.js";
19
+ import { VoidRadioGroup as v } from "./components/radio-group.js";
20
+ import { VoidField as y } from "./components/field.js";
21
+ import { VoidMultiselect as b, VoidOption as x } from "./components/multiselect.js";
22
+ import { VoidDialog as S } from "./components/dialog.js";
23
+ import { VoidTabPanel as C, VoidTabs as w } from "./components/tabs.js";
24
+ import { VoidAccordion as T, VoidAccordionItem as E } from "./components/accordion.js";
25
+ import { VoidBreadcrumbs as D } from "./components/breadcrumbs.js";
26
+ import { VoidList as O, VoidListItem as k } from "./components/list.js";
27
+ import { VoidToast as A, VoidToastContainer as j } from "./components/toast.js";
28
+ import { VoidStepper as M } from "./components/stepper.js";
29
+ import { VoidDrawer as N } from "./components/drawer.js";
30
+ import { VoidCard as P } from "./components/card.js";
31
+ import { VoidPopover as F } from "./components/popover.js";
32
+ import { VoidTooltip as I } from "./components/tooltip.js";
33
+ import { VoidBanner as L } from "./components/banner.js";
34
+ import { VoidScrollArea as R } from "./components/scroll-area.js";
35
+ import { VoidTable as z } from "./components/table.js";
36
+ import { VoidPagination as B } from "./components/pagination.js";
37
+ import { VoidErrorFallback as V } from "./components/error-fallback.js";
38
+ import { VoidCheckboxGroup as H } from "./components/checkbox-group.js";
39
+ import { VoidCombobox as U } from "./components/combobox.js";
40
+ import { VoidSlider as W } from "./components/slider.js";
41
+ import { VoidFileUpload as G } from "./components/file-upload.js";
42
+ import { VoidNavBar as K } from "./components/nav-bar.js";
43
+ import { VoidHamburger as q } from "./components/hamburger.js";
44
+ import { VoidComposeInput as J } from "./components/compose-input.js";
45
+ import { VoidSidebar as Y } from "./components/sidebar.js";
46
+ import { VoidToggle as X } from "./components/toggle.js";
47
+ import { VoidToggleGroup as Z } from "./components/toggle-group.js";
48
+ import { VoidSegmentedControl as Q, VoidSegmentedControlItem as $ } from "./components/segmented-control.js";
49
+ import { VoidStat as ee } from "./components/stat.js";
50
+ import { VoidCalendar as te, VoidDatePicker as ne } from "./components/calendar.js";
51
+ import { VoidCarousel as re, VoidCarouselSlide as ie } from "./components/carousel.js";
52
+ import { VoidDropdownMenu as ae, VoidDropdownMenuItem as oe } from "./components/dropdown-menu.js";
53
+ import { VoidIndicator as se } from "./components/indicator.js";
54
+ import { VoidMenu as ce, VoidMenuGroup as le, VoidMenuItem as ue } from "./components/menu.js";
55
+ import { VoidNumberInput as de } from "./components/number-input.js";
56
+ import { VoidCollapsible as fe } from "./components/collapsible.js";
57
+ import { VoidEditable as pe } from "./components/editable.js";
58
+ import { VoidHoverCard as me } from "./components/hover-card.js";
59
+ import { VoidPinInput as he } from "./components/pin-input.js";
60
+ import { VoidTagsInput as ge } from "./components/tags-input.js";
61
+ import { VoidNavMenu as _e, VoidNavMenuItem as ve } from "./components/nav-menu.js";
62
+ import { VoidColorPicker as ye } from "./components/color-picker.js";
63
+ import { VoidActionInput as be } from "./components/action-input.js";
64
+ export { T as VoidAccordion, E as VoidAccordionItem, be as VoidActionInput, l as VoidAlert, c as VoidAvatar, t as VoidBadge, L as VoidBanner, D as VoidBreadcrumbs, n as VoidButton, te as VoidCalendar, P as VoidCard, re as VoidCarousel, ie as VoidCarouselSlide, g as VoidCheckbox, H as VoidCheckboxGroup, fe as VoidCollapsible, ye as VoidColorPicker, U as VoidCombobox, J as VoidComposeInput, ne as VoidDatePicker, S as VoidDialog, r as VoidDivider, N as VoidDrawer, ae as VoidDropdownMenu, oe as VoidDropdownMenuItem, pe as VoidEditable, e as VoidElement, V as VoidErrorFallback, y as VoidField, G as VoidFileUpload, q as VoidHamburger, me as VoidHoverCard, se as VoidIndicator, p as VoidInput, O as VoidList, k as VoidListItem, ce as VoidMenu, le as VoidMenuGroup, ue as VoidMenuItem, b as VoidMultiselect, K as VoidNavBar, _e as VoidNavMenu, ve as VoidNavMenuItem, de as VoidNumberInput, x as VoidOption, B as VoidPagination, f as VoidPanel, he as VoidPinInput, F as VoidPopover, d as VoidProgress, _ as VoidRadio, v as VoidRadioGroup, R as VoidScrollArea, Q as VoidSegmentedControl, $ as VoidSegmentedControlItem, h as VoidSelect, Y as VoidSidebar, a as VoidSkeleton, W as VoidSlider, i as VoidSpinner, ee as VoidStat, o as VoidStatusDot, M as VoidStepper, s as VoidSwitch, C as VoidTabPanel, z as VoidTable, w as VoidTabs, u as VoidTag, ge as VoidTagsInput, m as VoidTextarea, A as VoidToast, j as VoidToastContainer, X as VoidToggle, Z as VoidToggleGroup, I as VoidTooltip };