@voidable/ui 0.0.0
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.
- package/LICENSE.md +25 -0
- package/README.md +38 -0
- package/dist/index.d.ts +608 -0
- package/dist/ui.js +2031 -0
- package/package.json +34 -0
package/dist/ui.js
ADDED
|
@@ -0,0 +1,2031 @@
|
|
|
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.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, "size", void 0), customElements.get("void-badge") || customElements.define("void-badge", c);
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/button.ts
|
|
36
|
+
var l = class extends o {
|
|
37
|
+
static {
|
|
38
|
+
this.formAssociated = !0;
|
|
39
|
+
}
|
|
40
|
+
constructor() {
|
|
41
|
+
super(), this.variant = "outline", this.color = "default", this.disabled = !1, this.type = "button", this.size = "md", this._internals = null, this._handleClick = (e) => {
|
|
42
|
+
if (this.disabled) {
|
|
43
|
+
e.stopImmediatePropagation();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.type === "submit" ? this._form?.requestSubmit() : this.type === "reset" && this._form?.reset(), this.dispatchEvent(new CustomEvent("void-click", {
|
|
47
|
+
bubbles: !0,
|
|
48
|
+
composed: !0
|
|
49
|
+
}));
|
|
50
|
+
}, this._handleKeydown = (e) => {
|
|
51
|
+
(e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
this._internals = this.attachInternals();
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
get _form() {
|
|
58
|
+
return this._internals?.form ?? this.closest("form");
|
|
59
|
+
}
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
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);
|
|
62
|
+
}
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
65
|
+
}
|
|
66
|
+
updated(e) {
|
|
67
|
+
e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
s([r({
|
|
71
|
+
type: String,
|
|
72
|
+
reflect: !0
|
|
73
|
+
})], l.prototype, "variant", void 0), s([r({
|
|
74
|
+
type: String,
|
|
75
|
+
reflect: !0
|
|
76
|
+
})], l.prototype, "color", void 0), s([r({
|
|
77
|
+
type: Boolean,
|
|
78
|
+
reflect: !0
|
|
79
|
+
})], l.prototype, "disabled", void 0), s([r({
|
|
80
|
+
type: String,
|
|
81
|
+
reflect: !0
|
|
82
|
+
})], l.prototype, "type", void 0), s([r({
|
|
83
|
+
type: String,
|
|
84
|
+
reflect: !0
|
|
85
|
+
})], l.prototype, "size", void 0), customElements.get("void-button") || customElements.define("void-button", l);
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/divider.ts
|
|
88
|
+
var u = class extends o {
|
|
89
|
+
constructor(...e) {
|
|
90
|
+
super(...e), this.label = void 0, this.orientation = "horizontal";
|
|
91
|
+
}
|
|
92
|
+
connectedCallback() {
|
|
93
|
+
super.connectedCallback(), this.setAttribute("role", "separator"), this.setAttribute("aria-orientation", this.orientation);
|
|
94
|
+
}
|
|
95
|
+
updated(e) {
|
|
96
|
+
e.has("orientation") && this.setAttribute("aria-orientation", this.orientation);
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
return this.label ? t`${this.label}` : n;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
s([r({
|
|
103
|
+
type: String,
|
|
104
|
+
reflect: !0
|
|
105
|
+
})], u.prototype, "label", void 0), s([r({
|
|
106
|
+
type: String,
|
|
107
|
+
reflect: !0
|
|
108
|
+
})], u.prototype, "orientation", void 0), customElements.get("void-divider") || customElements.define("void-divider", u);
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/spinner.ts
|
|
111
|
+
var d = class extends o {
|
|
112
|
+
constructor(...e) {
|
|
113
|
+
super(...e), this.size = "md", this.label = "Loading";
|
|
114
|
+
}
|
|
115
|
+
connectedCallback() {
|
|
116
|
+
super.connectedCallback(), this.setAttribute("role", "status"), this.setAttribute("aria-label", this.label);
|
|
117
|
+
}
|
|
118
|
+
updated(e) {
|
|
119
|
+
e.has("label") && this.setAttribute("aria-label", this.label);
|
|
120
|
+
}
|
|
121
|
+
render() {
|
|
122
|
+
return t`<span data-void-sr>${this.label}</span>`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
s([r({
|
|
126
|
+
type: String,
|
|
127
|
+
reflect: !0
|
|
128
|
+
})], d.prototype, "size", void 0), s([r({
|
|
129
|
+
type: String,
|
|
130
|
+
reflect: !0
|
|
131
|
+
})], d.prototype, "label", void 0), customElements.get("void-spinner") || customElements.define("void-spinner", d);
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/components/skeleton.ts
|
|
134
|
+
var ee = class extends o {
|
|
135
|
+
constructor(...e) {
|
|
136
|
+
super(...e), this.variant = "text";
|
|
137
|
+
}
|
|
138
|
+
connectedCallback() {
|
|
139
|
+
super.connectedCallback(), this.setAttribute("role", "presentation"), this.setAttribute("aria-hidden", "true");
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
s([r({
|
|
143
|
+
type: String,
|
|
144
|
+
reflect: !0
|
|
145
|
+
})], ee.prototype, "variant", void 0), customElements.get("void-skeleton") || customElements.define("void-skeleton", ee);
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/components/status-dot.ts
|
|
148
|
+
var te = class extends o {
|
|
149
|
+
constructor(...e) {
|
|
150
|
+
super(...e), this.status = "offline";
|
|
151
|
+
}
|
|
152
|
+
connectedCallback() {
|
|
153
|
+
super.connectedCallback(), this.setAttribute("role", "status"), this.setAttribute("aria-label", this._ariaLabel());
|
|
154
|
+
}
|
|
155
|
+
updated(e) {
|
|
156
|
+
e.has("status") && this.setAttribute("aria-label", this._ariaLabel());
|
|
157
|
+
}
|
|
158
|
+
_ariaLabel() {
|
|
159
|
+
switch (this.status) {
|
|
160
|
+
case "online": return "Online";
|
|
161
|
+
case "away": return "Away";
|
|
162
|
+
default: return "Offline";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
s([r({
|
|
167
|
+
type: String,
|
|
168
|
+
reflect: !0
|
|
169
|
+
})], te.prototype, "status", void 0), customElements.get("void-status-dot") || customElements.define("void-status-dot", te);
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/components/switch.ts
|
|
172
|
+
var f = class extends o {
|
|
173
|
+
constructor(...e) {
|
|
174
|
+
super(...e), this.checked = !1, this.disabled = !1, this.color = "default", this.size = "md", this._handleClick = () => {
|
|
175
|
+
this.disabled || (this.checked = !this.checked, this.dispatchEvent(new CustomEvent("void-change", {
|
|
176
|
+
bubbles: !0,
|
|
177
|
+
composed: !0,
|
|
178
|
+
detail: { checked: this.checked }
|
|
179
|
+
})));
|
|
180
|
+
}, this._handleKeydown = (e) => {
|
|
181
|
+
(e.key === " " || e.key === "Enter") && !this.disabled && (e.preventDefault(), this._handleClick());
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
connectedCallback() {
|
|
185
|
+
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);
|
|
186
|
+
}
|
|
187
|
+
disconnectedCallback() {
|
|
188
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
189
|
+
}
|
|
190
|
+
updated(e) {
|
|
191
|
+
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"));
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
194
|
+
return t`<span class="void-switch-track"><span class="void-switch-thumb"></span></span>`;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
s([r({
|
|
198
|
+
type: Boolean,
|
|
199
|
+
reflect: !0
|
|
200
|
+
})], f.prototype, "checked", void 0), s([r({
|
|
201
|
+
type: Boolean,
|
|
202
|
+
reflect: !0
|
|
203
|
+
})], f.prototype, "disabled", void 0), s([r({
|
|
204
|
+
type: String,
|
|
205
|
+
reflect: !0
|
|
206
|
+
})], f.prototype, "color", void 0), s([r({
|
|
207
|
+
type: String,
|
|
208
|
+
reflect: !0
|
|
209
|
+
})], f.prototype, "size", void 0), customElements.get("void-switch") || customElements.define("void-switch", f);
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/components/avatar.ts
|
|
212
|
+
var p = class extends o {
|
|
213
|
+
constructor(...e) {
|
|
214
|
+
super(...e), this.src = "", this.alt = "", this.initials = "", this.size = "md", this._onImgError = () => {
|
|
215
|
+
this.src = "";
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
connectedCallback() {
|
|
219
|
+
super.connectedCallback(), this.setAttribute("role", "img"), this.setAttribute("aria-label", this.alt || this.initials);
|
|
220
|
+
}
|
|
221
|
+
updated(e) {
|
|
222
|
+
(e.has("alt") || e.has("initials")) && this.setAttribute("aria-label", this.alt || this.initials);
|
|
223
|
+
}
|
|
224
|
+
render() {
|
|
225
|
+
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``;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
s([r({
|
|
229
|
+
type: String,
|
|
230
|
+
reflect: !0
|
|
231
|
+
})], p.prototype, "src", void 0), s([r({
|
|
232
|
+
type: String,
|
|
233
|
+
reflect: !0
|
|
234
|
+
})], p.prototype, "alt", void 0), s([r({
|
|
235
|
+
type: String,
|
|
236
|
+
reflect: !0
|
|
237
|
+
})], p.prototype, "initials", void 0), s([r({
|
|
238
|
+
type: String,
|
|
239
|
+
reflect: !0
|
|
240
|
+
})], p.prototype, "size", void 0), customElements.get("void-avatar") || customElements.define("void-avatar", p);
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/components/alert.ts
|
|
243
|
+
var m = class extends o {
|
|
244
|
+
constructor(...e) {
|
|
245
|
+
super(...e), this.color = "default", this.dismissible = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
|
|
246
|
+
}
|
|
247
|
+
connectedCallback() {
|
|
248
|
+
super.connectedCallback(), this.setAttribute("role", "alert"), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
249
|
+
}
|
|
250
|
+
updated(e) {
|
|
251
|
+
if (super.updated(e), !this._didSetup) {
|
|
252
|
+
this._didSetup = !0;
|
|
253
|
+
for (let e of this._userContent) this.appendChild(e);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
_dismiss() {
|
|
257
|
+
this.dispatchEvent(new CustomEvent("void-dismiss", {
|
|
258
|
+
bubbles: !0,
|
|
259
|
+
composed: !0
|
|
260
|
+
})), this.remove();
|
|
261
|
+
}
|
|
262
|
+
render() {
|
|
263
|
+
return this.dismissible ? t`<button class="void-alert-close" aria-label="Dismiss" @click="${this._dismiss}">×</button>` : n;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
s([r({
|
|
267
|
+
type: String,
|
|
268
|
+
reflect: !0
|
|
269
|
+
})], m.prototype, "color", void 0), s([r({
|
|
270
|
+
type: Boolean,
|
|
271
|
+
reflect: !0
|
|
272
|
+
})], m.prototype, "dismissible", void 0), s([r({
|
|
273
|
+
type: String,
|
|
274
|
+
reflect: !0
|
|
275
|
+
})], m.prototype, "variant", void 0), customElements.get("void-alert") || customElements.define("void-alert", m);
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/components/tag.ts
|
|
278
|
+
var h = class extends o {
|
|
279
|
+
constructor(...e) {
|
|
280
|
+
super(...e), this.color = "default", this.removable = !1, this.size = "md", this._userContent = [], this._didSetup = !1;
|
|
281
|
+
}
|
|
282
|
+
connectedCallback() {
|
|
283
|
+
super.connectedCallback(), this.setAttribute("role", "listitem"), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
284
|
+
}
|
|
285
|
+
updated(e) {
|
|
286
|
+
if (super.updated(e), !this._didSetup) {
|
|
287
|
+
this._didSetup = !0;
|
|
288
|
+
let e = this.querySelector(".void-tag-close");
|
|
289
|
+
for (let t of this._userContent) e ? this.insertBefore(t, e) : this.appendChild(t);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
render() {
|
|
293
|
+
return this.removable ? t`<button class="void-tag-close" aria-label="Remove" @click="${this._remove}">×</button>` : n;
|
|
294
|
+
}
|
|
295
|
+
_remove() {
|
|
296
|
+
this.dispatchEvent(new CustomEvent("void-remove", {
|
|
297
|
+
bubbles: !0,
|
|
298
|
+
composed: !0
|
|
299
|
+
})), this.remove();
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
s([r({
|
|
303
|
+
type: String,
|
|
304
|
+
reflect: !0
|
|
305
|
+
})], h.prototype, "color", void 0), s([r({
|
|
306
|
+
type: Boolean,
|
|
307
|
+
reflect: !0
|
|
308
|
+
})], h.prototype, "removable", void 0), s([r({
|
|
309
|
+
type: String,
|
|
310
|
+
reflect: !0
|
|
311
|
+
})], h.prototype, "size", void 0), customElements.get("void-tag") || customElements.define("void-tag", h);
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/components/progress.ts
|
|
314
|
+
var g = class extends o {
|
|
315
|
+
constructor(...e) {
|
|
316
|
+
super(...e), this.value = 0, this.max = 100, this.color = "default", this.size = "md", this.indeterminate = !1;
|
|
317
|
+
}
|
|
318
|
+
connectedCallback() {
|
|
319
|
+
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));
|
|
320
|
+
}
|
|
321
|
+
updated(e) {
|
|
322
|
+
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)));
|
|
323
|
+
}
|
|
324
|
+
render() {
|
|
325
|
+
let e = Math.min(100, Math.max(0, this.value / this.max * 100));
|
|
326
|
+
return t`<div class="void-progress-track"><div class="void-progress-fill" style="width: ${this.indeterminate ? "" : e + "%"}"></div></div>`;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
s([r({
|
|
330
|
+
type: Number,
|
|
331
|
+
reflect: !0
|
|
332
|
+
})], g.prototype, "value", void 0), s([r({
|
|
333
|
+
type: Number,
|
|
334
|
+
reflect: !0
|
|
335
|
+
})], g.prototype, "max", void 0), s([r({
|
|
336
|
+
type: String,
|
|
337
|
+
reflect: !0
|
|
338
|
+
})], g.prototype, "color", void 0), s([r({
|
|
339
|
+
type: String,
|
|
340
|
+
reflect: !0
|
|
341
|
+
})], g.prototype, "size", void 0), s([r({
|
|
342
|
+
type: Boolean,
|
|
343
|
+
reflect: !0
|
|
344
|
+
})], g.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", g);
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/components/panel.ts
|
|
347
|
+
var _ = class extends o {
|
|
348
|
+
constructor(...e) {
|
|
349
|
+
super(...e), this.label = "", this.variant = "default", this._userContent = [], this._didSetup = !1;
|
|
350
|
+
}
|
|
351
|
+
connectedCallback() {
|
|
352
|
+
super.connectedCallback(), this.setAttribute("role", "region"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
353
|
+
}
|
|
354
|
+
updated(e) {
|
|
355
|
+
if (super.updated(e), e.has("label") && (this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label")), !this._didSetup) {
|
|
356
|
+
this._didSetup = !0;
|
|
357
|
+
for (let e of this._userContent) this.appendChild(e);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
render() {
|
|
361
|
+
return this.label ? t`<div class="void-panel-label">${this.label}</div>` : n;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
s([r({
|
|
365
|
+
type: String,
|
|
366
|
+
reflect: !0
|
|
367
|
+
})], _.prototype, "label", void 0), s([r({
|
|
368
|
+
type: String,
|
|
369
|
+
reflect: !0
|
|
370
|
+
})], _.prototype, "variant", void 0), customElements.get("void-panel") || customElements.define("void-panel", _);
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/components/input.ts
|
|
373
|
+
var v = class extends o {
|
|
374
|
+
constructor(...e) {
|
|
375
|
+
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 = "";
|
|
376
|
+
}
|
|
377
|
+
connectedCallback() {
|
|
378
|
+
super.connectedCallback(), this.setAttribute("role", "textbox");
|
|
379
|
+
}
|
|
380
|
+
render() {
|
|
381
|
+
return t`
|
|
382
|
+
<input
|
|
383
|
+
type=${this.type}
|
|
384
|
+
.value=${this.value}
|
|
385
|
+
placeholder=${this.placeholder}
|
|
386
|
+
?disabled=${this.disabled}
|
|
387
|
+
?readonly=${this.readonly}
|
|
388
|
+
?required=${this.required}
|
|
389
|
+
name=${this.name}
|
|
390
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
391
|
+
@input=${this._onInput}
|
|
392
|
+
@change=${this._onChange}
|
|
393
|
+
/>
|
|
394
|
+
${this.error ? t`<span class="void-input-error">${this.error}</span>` : ""}
|
|
395
|
+
`;
|
|
396
|
+
}
|
|
397
|
+
_onInput(e) {
|
|
398
|
+
let t = e.target;
|
|
399
|
+
this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
|
|
400
|
+
bubbles: !0,
|
|
401
|
+
composed: !0,
|
|
402
|
+
detail: { value: this.value }
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
405
|
+
_onChange(e) {
|
|
406
|
+
let t = e.target;
|
|
407
|
+
this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
|
|
408
|
+
bubbles: !0,
|
|
409
|
+
composed: !0,
|
|
410
|
+
detail: { value: this.value }
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
s([r({
|
|
415
|
+
type: String,
|
|
416
|
+
reflect: !0
|
|
417
|
+
})], v.prototype, "type", void 0), s([r({ type: String })], v.prototype, "value", void 0), s([r({
|
|
418
|
+
type: String,
|
|
419
|
+
reflect: !0
|
|
420
|
+
})], v.prototype, "placeholder", void 0), s([r({
|
|
421
|
+
type: Boolean,
|
|
422
|
+
reflect: !0
|
|
423
|
+
})], v.prototype, "disabled", void 0), s([r({
|
|
424
|
+
type: Boolean,
|
|
425
|
+
reflect: !0
|
|
426
|
+
})], v.prototype, "readonly", void 0), s([r({
|
|
427
|
+
type: Boolean,
|
|
428
|
+
reflect: !0
|
|
429
|
+
})], v.prototype, "required", void 0), s([r({
|
|
430
|
+
type: String,
|
|
431
|
+
reflect: !0
|
|
432
|
+
})], v.prototype, "name", void 0), s([r({
|
|
433
|
+
type: String,
|
|
434
|
+
reflect: !0
|
|
435
|
+
})], v.prototype, "size", void 0), s([r({
|
|
436
|
+
type: String,
|
|
437
|
+
reflect: !0
|
|
438
|
+
})], v.prototype, "error", void 0), customElements.get("void-input") || customElements.define("void-input", v);
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/components/textarea.ts
|
|
441
|
+
var y = class extends o {
|
|
442
|
+
constructor(...e) {
|
|
443
|
+
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 = "";
|
|
444
|
+
}
|
|
445
|
+
connectedCallback() {
|
|
446
|
+
super.connectedCallback(), this.setAttribute("role", "textbox"), this.setAttribute("aria-multiline", "true");
|
|
447
|
+
}
|
|
448
|
+
render() {
|
|
449
|
+
return t`
|
|
450
|
+
<textarea
|
|
451
|
+
.value=${this.value}
|
|
452
|
+
placeholder=${this.placeholder}
|
|
453
|
+
?disabled=${this.disabled}
|
|
454
|
+
?readonly=${this.readonly}
|
|
455
|
+
?required=${this.required}
|
|
456
|
+
name=${this.name}
|
|
457
|
+
rows=${this.rows}
|
|
458
|
+
style="resize: ${this.resize}"
|
|
459
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
460
|
+
@input=${this._onInput}
|
|
461
|
+
@change=${this._onChange}
|
|
462
|
+
></textarea>
|
|
463
|
+
${this.error ? t`<span class="void-textarea-error">${this.error}</span>` : ""}
|
|
464
|
+
`;
|
|
465
|
+
}
|
|
466
|
+
_onInput(e) {
|
|
467
|
+
let t = e.target;
|
|
468
|
+
this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
|
|
469
|
+
bubbles: !0,
|
|
470
|
+
composed: !0,
|
|
471
|
+
detail: { value: this.value }
|
|
472
|
+
}));
|
|
473
|
+
}
|
|
474
|
+
_onChange(e) {
|
|
475
|
+
let t = e.target;
|
|
476
|
+
this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
|
|
477
|
+
bubbles: !0,
|
|
478
|
+
composed: !0,
|
|
479
|
+
detail: { value: this.value }
|
|
480
|
+
}));
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
s([r({ type: String })], y.prototype, "value", void 0), s([r({
|
|
484
|
+
type: String,
|
|
485
|
+
reflect: !0
|
|
486
|
+
})], y.prototype, "placeholder", void 0), s([r({
|
|
487
|
+
type: Boolean,
|
|
488
|
+
reflect: !0
|
|
489
|
+
})], y.prototype, "disabled", void 0), s([r({
|
|
490
|
+
type: Boolean,
|
|
491
|
+
reflect: !0
|
|
492
|
+
})], y.prototype, "readonly", void 0), s([r({
|
|
493
|
+
type: Boolean,
|
|
494
|
+
reflect: !0
|
|
495
|
+
})], y.prototype, "required", void 0), s([r({
|
|
496
|
+
type: String,
|
|
497
|
+
reflect: !0
|
|
498
|
+
})], y.prototype, "name", void 0), s([r({
|
|
499
|
+
type: Number,
|
|
500
|
+
reflect: !0
|
|
501
|
+
})], y.prototype, "rows", void 0), s([r({
|
|
502
|
+
type: String,
|
|
503
|
+
reflect: !0
|
|
504
|
+
})], y.prototype, "resize", void 0), s([r({
|
|
505
|
+
type: String,
|
|
506
|
+
reflect: !0
|
|
507
|
+
})], y.prototype, "size", void 0), s([r({
|
|
508
|
+
type: String,
|
|
509
|
+
reflect: !0
|
|
510
|
+
})], y.prototype, "error", void 0), customElements.get("void-textarea") || customElements.define("void-textarea", y);
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/components/select.ts
|
|
513
|
+
var b = class extends o {
|
|
514
|
+
constructor(...e) {
|
|
515
|
+
super(...e), this.value = "", this.disabled = !1, this.required = !1, this.name = "", this.size = "md", this.error = "", this.placeholder = "", this._options = [], this._didSetup = !1;
|
|
516
|
+
}
|
|
517
|
+
connectedCallback() {
|
|
518
|
+
super.connectedCallback(), this._didSetup || (this._options = Array.from(this.childNodes));
|
|
519
|
+
}
|
|
520
|
+
updated(e) {
|
|
521
|
+
if (super.updated(e), !this._didSetup) {
|
|
522
|
+
this._didSetup = !0;
|
|
523
|
+
let e = this.querySelector("select");
|
|
524
|
+
if (e) {
|
|
525
|
+
for (let t of this._options) e.appendChild(t);
|
|
526
|
+
this.value && (e.value = this.value);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
render() {
|
|
531
|
+
return t`
|
|
532
|
+
<select
|
|
533
|
+
?disabled=${this.disabled}
|
|
534
|
+
?required=${this.required}
|
|
535
|
+
name=${this.name}
|
|
536
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
537
|
+
@change=${this._onChange}
|
|
538
|
+
></select>
|
|
539
|
+
${this.error ? t`<span class="void-select-error">${this.error}</span>` : ""}
|
|
540
|
+
`;
|
|
541
|
+
}
|
|
542
|
+
_onChange(e) {
|
|
543
|
+
let t = e.target;
|
|
544
|
+
this.value = t.value, this.dispatchEvent(new CustomEvent("void-change", {
|
|
545
|
+
bubbles: !0,
|
|
546
|
+
composed: !0,
|
|
547
|
+
detail: { value: this.value }
|
|
548
|
+
}));
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
s([r({ type: String })], b.prototype, "value", void 0), s([r({
|
|
552
|
+
type: Boolean,
|
|
553
|
+
reflect: !0
|
|
554
|
+
})], b.prototype, "disabled", void 0), s([r({
|
|
555
|
+
type: Boolean,
|
|
556
|
+
reflect: !0
|
|
557
|
+
})], b.prototype, "required", void 0), s([r({
|
|
558
|
+
type: String,
|
|
559
|
+
reflect: !0
|
|
560
|
+
})], b.prototype, "name", void 0), s([r({
|
|
561
|
+
type: String,
|
|
562
|
+
reflect: !0
|
|
563
|
+
})], b.prototype, "size", void 0), s([r({
|
|
564
|
+
type: String,
|
|
565
|
+
reflect: !0
|
|
566
|
+
})], b.prototype, "error", void 0), s([r({
|
|
567
|
+
type: String,
|
|
568
|
+
reflect: !0
|
|
569
|
+
})], b.prototype, "placeholder", void 0), customElements.get("void-select") || customElements.define("void-select", b);
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/components/checkbox.ts
|
|
572
|
+
var x = class extends o {
|
|
573
|
+
constructor(...e) {
|
|
574
|
+
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) => {
|
|
575
|
+
if (this.disabled) {
|
|
576
|
+
e.stopImmediatePropagation();
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
this.indeterminate = !1, this.checked = !this.checked;
|
|
580
|
+
let t = this.querySelector("input[type=\"checkbox\"]");
|
|
581
|
+
t && (t.checked = this.checked), this.dispatchEvent(new CustomEvent("void-change", {
|
|
582
|
+
bubbles: !0,
|
|
583
|
+
composed: !0,
|
|
584
|
+
detail: { checked: this.checked }
|
|
585
|
+
}));
|
|
586
|
+
}, this._handleKeydown = (e) => {
|
|
587
|
+
e.key === " " && !this.disabled && (e.preventDefault(), this._handleClick(e));
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
connectedCallback() {
|
|
591
|
+
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);
|
|
592
|
+
}
|
|
593
|
+
disconnectedCallback() {
|
|
594
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
595
|
+
}
|
|
596
|
+
updated(e) {
|
|
597
|
+
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) {
|
|
598
|
+
this._didSetup = !0;
|
|
599
|
+
for (let e of this._userContent) this.appendChild(e);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
render() {
|
|
603
|
+
return t`
|
|
604
|
+
<input type="checkbox" .checked=${this.checked} .indeterminate=${this.indeterminate} ?disabled=${this.disabled} name=${this.name} value=${this.value} tabindex="-1" aria-hidden="true" />
|
|
605
|
+
<span class="void-checkbox-box">
|
|
606
|
+
${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="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>` : ""}
|
|
607
|
+
${this.indeterminate && !this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M3 6h6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>` : ""}
|
|
608
|
+
</span>
|
|
609
|
+
`;
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
s([r({
|
|
613
|
+
type: Boolean,
|
|
614
|
+
reflect: !0
|
|
615
|
+
})], x.prototype, "checked", void 0), s([r({
|
|
616
|
+
type: Boolean,
|
|
617
|
+
reflect: !0
|
|
618
|
+
})], x.prototype, "disabled", void 0), s([r({
|
|
619
|
+
type: Boolean,
|
|
620
|
+
reflect: !0
|
|
621
|
+
})], x.prototype, "indeterminate", void 0), s([r({
|
|
622
|
+
type: String,
|
|
623
|
+
reflect: !0
|
|
624
|
+
})], x.prototype, "name", void 0), s([r({
|
|
625
|
+
type: String,
|
|
626
|
+
reflect: !0
|
|
627
|
+
})], x.prototype, "value", void 0), s([r({
|
|
628
|
+
type: String,
|
|
629
|
+
reflect: !0
|
|
630
|
+
})], x.prototype, "color", void 0), s([r({
|
|
631
|
+
type: String,
|
|
632
|
+
reflect: !0
|
|
633
|
+
})], x.prototype, "size", void 0), customElements.get("void-checkbox") || customElements.define("void-checkbox", x);
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region src/components/radio.ts
|
|
636
|
+
var S = class extends o {
|
|
637
|
+
constructor(...e) {
|
|
638
|
+
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) => {
|
|
639
|
+
if (this.disabled || this.checked) {
|
|
640
|
+
this.disabled && e.stopImmediatePropagation();
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
this.checked = !0;
|
|
644
|
+
let t = this.querySelector("input[type=\"radio\"]");
|
|
645
|
+
t && (t.checked = !0), this.dispatchEvent(new CustomEvent("void-change", {
|
|
646
|
+
bubbles: !0,
|
|
647
|
+
composed: !0,
|
|
648
|
+
detail: {
|
|
649
|
+
value: this.value,
|
|
650
|
+
checked: !0
|
|
651
|
+
}
|
|
652
|
+
}));
|
|
653
|
+
}, this._handleKeydown = (e) => {
|
|
654
|
+
e.key === " " && !this.disabled && (e.preventDefault(), this._handleClick(e));
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
connectedCallback() {
|
|
658
|
+
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);
|
|
659
|
+
}
|
|
660
|
+
disconnectedCallback() {
|
|
661
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
662
|
+
}
|
|
663
|
+
updated(e) {
|
|
664
|
+
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) {
|
|
665
|
+
this._didSetup = !0;
|
|
666
|
+
for (let e of this._userContent) this.appendChild(e);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
render() {
|
|
670
|
+
return t`
|
|
671
|
+
<input type="radio" .checked=${this.checked} ?disabled=${this.disabled} name=${this.name} value=${this.value} tabindex="-1" aria-hidden="true" />
|
|
672
|
+
<span class="void-radio-circle">
|
|
673
|
+
${this.checked ? t`<span class="void-radio-dot"></span>` : ""}
|
|
674
|
+
</span>
|
|
675
|
+
`;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
s([r({
|
|
679
|
+
type: Boolean,
|
|
680
|
+
reflect: !0
|
|
681
|
+
})], S.prototype, "checked", void 0), s([r({
|
|
682
|
+
type: Boolean,
|
|
683
|
+
reflect: !0
|
|
684
|
+
})], S.prototype, "disabled", void 0), s([r({
|
|
685
|
+
type: String,
|
|
686
|
+
reflect: !0
|
|
687
|
+
})], S.prototype, "name", void 0), s([r({
|
|
688
|
+
type: String,
|
|
689
|
+
reflect: !0
|
|
690
|
+
})], S.prototype, "value", void 0), s([r({
|
|
691
|
+
type: String,
|
|
692
|
+
reflect: !0
|
|
693
|
+
})], S.prototype, "color", void 0), s([r({
|
|
694
|
+
type: String,
|
|
695
|
+
reflect: !0
|
|
696
|
+
})], S.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", S);
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/components/radio-group.ts
|
|
699
|
+
var C = class extends o {
|
|
700
|
+
constructor(...e) {
|
|
701
|
+
super(...e), this.label = "", this.value = "", this.name = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
|
|
702
|
+
let t = e.target;
|
|
703
|
+
if (!(!t || t.tagName.toLowerCase() !== "void-radio") && e.detail?.checked) {
|
|
704
|
+
e.stopImmediatePropagation(), this.value = t.value;
|
|
705
|
+
for (let e of this._radios()) e !== t && (e.checked = !1);
|
|
706
|
+
this.dispatchEvent(new CustomEvent("void-change", {
|
|
707
|
+
bubbles: !0,
|
|
708
|
+
composed: !0,
|
|
709
|
+
detail: { value: this.value }
|
|
710
|
+
}));
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
connectedCallback() {
|
|
715
|
+
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);
|
|
716
|
+
}
|
|
717
|
+
disconnectedCallback() {
|
|
718
|
+
super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange);
|
|
719
|
+
}
|
|
720
|
+
updated(e) {
|
|
721
|
+
if (super.updated(e), e.has("label") && this.label && this.setAttribute("aria-label", this.label), e.has("name") && this._syncNames(), !this._didSetup) {
|
|
722
|
+
this._didSetup = !0;
|
|
723
|
+
let e = this.querySelector(".void-radio-group-options");
|
|
724
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
725
|
+
this._syncNames(), this._syncChecked();
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
_radios() {
|
|
729
|
+
return Array.from(this.querySelectorAll("void-radio"));
|
|
730
|
+
}
|
|
731
|
+
_syncNames() {
|
|
732
|
+
if (this.name) for (let e of this._radios()) e.name = this.name;
|
|
733
|
+
}
|
|
734
|
+
_syncChecked() {
|
|
735
|
+
for (let e of this._radios()) e.checked = e.value === this.value;
|
|
736
|
+
}
|
|
737
|
+
render() {
|
|
738
|
+
return t`
|
|
739
|
+
${this.label ? t`<span class="void-radio-group-label">${this.label}</span>` : n}
|
|
740
|
+
<div class="void-radio-group-options"></div>
|
|
741
|
+
`;
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
s([r({ type: String })], C.prototype, "label", void 0), s([r({ type: String })], C.prototype, "value", void 0), s([r({ type: String })], C.prototype, "name", void 0), s([r({
|
|
745
|
+
type: String,
|
|
746
|
+
reflect: !0
|
|
747
|
+
})], C.prototype, "orientation", void 0), customElements.get("void-radio-group") || customElements.define("void-radio-group", C);
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/components/field.ts
|
|
750
|
+
var w = class extends o {
|
|
751
|
+
constructor(...e) {
|
|
752
|
+
super(...e), this.label = "", this.error = "", this.helper = "", this.required = !1, this._userContent = [], this._didSetup = !1;
|
|
753
|
+
}
|
|
754
|
+
connectedCallback() {
|
|
755
|
+
super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
756
|
+
}
|
|
757
|
+
updated(e) {
|
|
758
|
+
if (super.updated(e), !this._didSetup) {
|
|
759
|
+
this._didSetup = !0;
|
|
760
|
+
let e = this.querySelector(".void-field-control");
|
|
761
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
render() {
|
|
765
|
+
return t`
|
|
766
|
+
${this.label ? t`<label class="void-field-label">${this.label}${this.required ? t`<span class="void-field-required" aria-hidden="true"> *</span>` : ""}</label>` : n}
|
|
767
|
+
<div class="void-field-control"></div>
|
|
768
|
+
${this.error ? t`<span class="void-field-error">${this.error}</span>` : this.helper ? t`<span class="void-field-helper">${this.helper}</span>` : n}
|
|
769
|
+
`;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
s([r({
|
|
773
|
+
type: String,
|
|
774
|
+
reflect: !0
|
|
775
|
+
})], w.prototype, "label", void 0), s([r({
|
|
776
|
+
type: String,
|
|
777
|
+
reflect: !0
|
|
778
|
+
})], w.prototype, "error", void 0), s([r({
|
|
779
|
+
type: String,
|
|
780
|
+
reflect: !0
|
|
781
|
+
})], w.prototype, "helper", void 0), s([r({
|
|
782
|
+
type: Boolean,
|
|
783
|
+
reflect: !0
|
|
784
|
+
})], w.prototype, "required", void 0), customElements.get("void-field") || customElements.define("void-field", w);
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/components/multiselect.ts
|
|
787
|
+
var T = class extends o {
|
|
788
|
+
constructor(...e) {
|
|
789
|
+
super(...e), this.value = "", this.selected = !1;
|
|
790
|
+
}
|
|
791
|
+
render() {
|
|
792
|
+
return n;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
s([r({
|
|
796
|
+
type: String,
|
|
797
|
+
reflect: !0
|
|
798
|
+
})], T.prototype, "value", void 0), s([r({
|
|
799
|
+
type: Boolean,
|
|
800
|
+
reflect: !0
|
|
801
|
+
})], T.prototype, "selected", void 0), customElements.get("void-option") || customElements.define("void-option", T);
|
|
802
|
+
var E = 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="1.5" 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 })], E.prototype, "placeholder", void 0), s([r({
|
|
888
|
+
type: Boolean,
|
|
889
|
+
reflect: !0
|
|
890
|
+
})], E.prototype, "disabled", void 0), s([r({
|
|
891
|
+
type: String,
|
|
892
|
+
reflect: !0
|
|
893
|
+
})], E.prototype, "size", void 0), s([r({
|
|
894
|
+
type: String,
|
|
895
|
+
reflect: !0
|
|
896
|
+
})], E.prototype, "error", void 0), s([r({
|
|
897
|
+
type: String,
|
|
898
|
+
reflect: !0
|
|
899
|
+
})], E.prototype, "name", void 0), customElements.get("void-multiselect") || customElements.define("void-multiselect", E);
|
|
900
|
+
//#endregion
|
|
901
|
+
//#region src/components/dialog.ts
|
|
902
|
+
var D = 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
|
+
this._didSetup = !0;
|
|
918
|
+
let e = this.querySelector(".void-dialog-body");
|
|
919
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
disconnectedCallback() {
|
|
923
|
+
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown), this.open && (document.body.style.overflow = "");
|
|
924
|
+
}
|
|
925
|
+
_focusFirst() {
|
|
926
|
+
requestAnimationFrame(() => {
|
|
927
|
+
this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])")?.focus();
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
_close() {
|
|
931
|
+
this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
|
|
932
|
+
bubbles: !0,
|
|
933
|
+
composed: !0
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
render() {
|
|
937
|
+
return this.open ? t`
|
|
938
|
+
<div class="void-dialog-backdrop" @click="${this._onBackdropClick}" @keydown="${this._onBackdropKeydown}">
|
|
939
|
+
<div class="void-dialog-panel">
|
|
940
|
+
<div class="void-dialog-header">
|
|
941
|
+
<span class="void-dialog-heading">${this.heading}</span>
|
|
942
|
+
${this.closable ? t`<button class="void-dialog-close" aria-label="Close" @click="${this._close}">×</button>` : n}
|
|
943
|
+
</div>
|
|
944
|
+
<div class="void-dialog-body"></div>
|
|
945
|
+
</div>
|
|
946
|
+
</div>
|
|
947
|
+
` : n;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
s([r({
|
|
951
|
+
type: Boolean,
|
|
952
|
+
reflect: !0
|
|
953
|
+
})], D.prototype, "open", void 0), s([r({ type: String })], D.prototype, "heading", void 0), s([r({
|
|
954
|
+
type: String,
|
|
955
|
+
reflect: !0
|
|
956
|
+
})], D.prototype, "size", void 0), s([r({ type: Boolean })], D.prototype, "closable", void 0), customElements.get("void-dialog") || customElements.define("void-dialog", D);
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/components/tabs.ts
|
|
959
|
+
var O = class extends o {
|
|
960
|
+
constructor(...e) {
|
|
961
|
+
super(...e), this.tab = "", this.label = "", this.active = !1;
|
|
962
|
+
}
|
|
963
|
+
connectedCallback() {
|
|
964
|
+
super.connectedCallback(), this.setAttribute("role", "tabpanel"), this.tab && (this.id = this.tab);
|
|
965
|
+
}
|
|
966
|
+
updated(e) {
|
|
967
|
+
super.updated(e), this.setAttribute("role", "tabpanel"), e.has("tab") && this.tab && (this.id = this.tab);
|
|
968
|
+
}
|
|
969
|
+
render() {
|
|
970
|
+
return n;
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
s([r({
|
|
974
|
+
type: String,
|
|
975
|
+
reflect: !0
|
|
976
|
+
})], O.prototype, "tab", void 0), s([r({
|
|
977
|
+
type: String,
|
|
978
|
+
reflect: !0
|
|
979
|
+
})], O.prototype, "label", void 0), s([r({
|
|
980
|
+
type: Boolean,
|
|
981
|
+
reflect: !0
|
|
982
|
+
})], O.prototype, "active", void 0), customElements.get("void-tab-panel") || customElements.define("void-tab-panel", O);
|
|
983
|
+
var k = class extends o {
|
|
984
|
+
constructor(...e) {
|
|
985
|
+
super(...e), this.value = "", this.size = "md", this._panels = [];
|
|
986
|
+
}
|
|
987
|
+
connectedCallback() {
|
|
988
|
+
super.connectedCallback(), this._panels = Array.from(this.querySelectorAll("void-tab-panel")), this._syncPanels();
|
|
989
|
+
}
|
|
990
|
+
_syncPanels() {
|
|
991
|
+
for (let e of this._panels) e.active = e.tab === this.value;
|
|
992
|
+
}
|
|
993
|
+
updated(e) {
|
|
994
|
+
super.updated(e), e.has("value") && this._syncPanels();
|
|
995
|
+
}
|
|
996
|
+
render() {
|
|
997
|
+
return t`
|
|
998
|
+
<div class="void-tabs-list" role="tablist">
|
|
999
|
+
${this._panels.map((e, n) => t`
|
|
1000
|
+
<button
|
|
1001
|
+
class="void-tabs-tab"
|
|
1002
|
+
role="tab"
|
|
1003
|
+
aria-selected=${e.tab === this.value ? "true" : "false"}
|
|
1004
|
+
aria-controls=${e.tab}
|
|
1005
|
+
?active=${e.tab === this.value}
|
|
1006
|
+
tabindex=${e.tab === this.value ? "0" : "-1"}
|
|
1007
|
+
@click=${() => this._onTabClick(e)}
|
|
1008
|
+
@keydown=${(e) => this._onTabKeydown(e, n)}
|
|
1009
|
+
>${e.label || e.tab}</button>
|
|
1010
|
+
`)}
|
|
1011
|
+
</div>
|
|
1012
|
+
<slot></slot>
|
|
1013
|
+
`;
|
|
1014
|
+
}
|
|
1015
|
+
_onTabClick(e) {
|
|
1016
|
+
this.value = e.tab, this.requestUpdate(), this._syncPanels(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1017
|
+
bubbles: !0,
|
|
1018
|
+
composed: !0,
|
|
1019
|
+
detail: { value: this.value }
|
|
1020
|
+
}));
|
|
1021
|
+
}
|
|
1022
|
+
_onTabKeydown(e, t) {
|
|
1023
|
+
let n = Array.from(this.querySelectorAll(".void-tabs-tab"));
|
|
1024
|
+
e.key === "ArrowRight" ? (e.preventDefault(), n[(t + 1) % n.length].focus()) : e.key === "ArrowLeft" && (e.preventDefault(), n[(t - 1 + n.length) % n.length].focus());
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
s([r({ type: String })], k.prototype, "value", void 0), s([r({
|
|
1028
|
+
type: String,
|
|
1029
|
+
reflect: !0
|
|
1030
|
+
})], k.prototype, "size", void 0), customElements.get("void-tabs") || customElements.define("void-tabs", k);
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/components/accordion.ts
|
|
1033
|
+
var A = class extends o {
|
|
1034
|
+
constructor(...e) {
|
|
1035
|
+
super(...e), this.multiple = !1;
|
|
1036
|
+
}
|
|
1037
|
+
render() {
|
|
1038
|
+
return t`<slot></slot>`;
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
s([r({
|
|
1042
|
+
type: Boolean,
|
|
1043
|
+
reflect: !0
|
|
1044
|
+
})], A.prototype, "multiple", void 0), customElements.get("void-accordion") || customElements.define("void-accordion", A);
|
|
1045
|
+
var j = class extends o {
|
|
1046
|
+
constructor(...e) {
|
|
1047
|
+
super(...e), this.heading = "", this.open = !1, this._id = Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
|
|
1048
|
+
e.preventDefault(), this.open = !this.open;
|
|
1049
|
+
let t = this.parentElement;
|
|
1050
|
+
if (t instanceof A && !t.multiple) {
|
|
1051
|
+
let e = Array.from(t.querySelectorAll("void-accordion-item"));
|
|
1052
|
+
for (let t of e) t !== this && (t.open = !1);
|
|
1053
|
+
}
|
|
1054
|
+
this.dispatchEvent(new CustomEvent("void-toggle", {
|
|
1055
|
+
bubbles: !0,
|
|
1056
|
+
composed: !0,
|
|
1057
|
+
detail: { open: this.open }
|
|
1058
|
+
}));
|
|
1059
|
+
}, this._handleKeydown = (e) => {
|
|
1060
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._handleClick(e));
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
connectedCallback() {
|
|
1064
|
+
super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
1065
|
+
}
|
|
1066
|
+
updated(e) {
|
|
1067
|
+
if (super.updated(e), !this._didSetup) {
|
|
1068
|
+
this._didSetup = !0;
|
|
1069
|
+
let e = this.querySelector(".void-accordion-content");
|
|
1070
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
render() {
|
|
1074
|
+
return t`
|
|
1075
|
+
<button
|
|
1076
|
+
id="trigger-${this._id}"
|
|
1077
|
+
class="void-accordion-trigger"
|
|
1078
|
+
aria-expanded=${String(this.open)}
|
|
1079
|
+
aria-controls="content-${this._id}"
|
|
1080
|
+
@click=${this._handleClick}
|
|
1081
|
+
@keydown=${this._handleKeydown}
|
|
1082
|
+
>
|
|
1083
|
+
${this.heading}
|
|
1084
|
+
<svg class="void-accordion-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
1085
|
+
<path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1086
|
+
</svg>
|
|
1087
|
+
</button>
|
|
1088
|
+
<div
|
|
1089
|
+
id="content-${this._id}"
|
|
1090
|
+
class="void-accordion-content"
|
|
1091
|
+
role="region"
|
|
1092
|
+
aria-labelledby="trigger-${this._id}"
|
|
1093
|
+
></div>
|
|
1094
|
+
`;
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
s([r({ type: String })], j.prototype, "heading", void 0), s([r({
|
|
1098
|
+
type: Boolean,
|
|
1099
|
+
reflect: !0
|
|
1100
|
+
})], j.prototype, "open", void 0), customElements.get("void-accordion-item") || customElements.define("void-accordion-item", j);
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src/components/breadcrumbs.ts
|
|
1103
|
+
var M = class extends o {
|
|
1104
|
+
constructor(...e) {
|
|
1105
|
+
super(...e), this.separator = "/", this._items = [], this._didSetup = !1;
|
|
1106
|
+
}
|
|
1107
|
+
connectedCallback() {
|
|
1108
|
+
super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Breadcrumb"), this._didSetup || (this._items = Array.from(this.children));
|
|
1109
|
+
}
|
|
1110
|
+
updated(e) {
|
|
1111
|
+
if (super.updated(e), !this._didSetup) {
|
|
1112
|
+
this._didSetup = !0;
|
|
1113
|
+
let e = this.querySelector(".void-breadcrumbs-list");
|
|
1114
|
+
if (!e) return;
|
|
1115
|
+
this._items.forEach((t, n) => {
|
|
1116
|
+
let r = document.createElement("li");
|
|
1117
|
+
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);
|
|
1118
|
+
});
|
|
1119
|
+
} else if (e.has("separator")) {
|
|
1120
|
+
let e = Array.from(this.querySelectorAll(".void-breadcrumbs-item"));
|
|
1121
|
+
for (let t of e) t.setAttribute("data-separator", this.separator);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
render() {
|
|
1125
|
+
return t`<ol class="void-breadcrumbs-list"></ol>`;
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
s([r({ type: String })], M.prototype, "separator", void 0), customElements.get("void-breadcrumbs") || customElements.define("void-breadcrumbs", M);
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region src/components/list.ts
|
|
1131
|
+
var N = class extends o {
|
|
1132
|
+
constructor(...e) {
|
|
1133
|
+
super(...e), this.dividers = !1;
|
|
1134
|
+
}
|
|
1135
|
+
connectedCallback() {
|
|
1136
|
+
super.connectedCallback(), this.setAttribute("role", "list");
|
|
1137
|
+
}
|
|
1138
|
+
render() {
|
|
1139
|
+
return n;
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
s([r({
|
|
1143
|
+
type: Boolean,
|
|
1144
|
+
reflect: !0
|
|
1145
|
+
})], N.prototype, "dividers", void 0), customElements.get("void-list") || customElements.define("void-list", N);
|
|
1146
|
+
var P = class extends o {
|
|
1147
|
+
constructor(...e) {
|
|
1148
|
+
super(...e), this.selected = !1, this.disabled = !1, this.interactive = !1, this._handleClick = () => {
|
|
1149
|
+
this.disabled || this.dispatchEvent(new CustomEvent("void-click", {
|
|
1150
|
+
bubbles: !0,
|
|
1151
|
+
composed: !0,
|
|
1152
|
+
detail: {}
|
|
1153
|
+
}));
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
connectedCallback() {
|
|
1157
|
+
super.connectedCallback(), this.setAttribute("role", "listitem");
|
|
1158
|
+
}
|
|
1159
|
+
updated(e) {
|
|
1160
|
+
super.updated(e), e.has("interactive") && (this.interactive ? this.addEventListener("click", this._handleClick) : this.removeEventListener("click", this._handleClick));
|
|
1161
|
+
}
|
|
1162
|
+
render() {
|
|
1163
|
+
return n;
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
s([r({
|
|
1167
|
+
type: Boolean,
|
|
1168
|
+
reflect: !0
|
|
1169
|
+
})], P.prototype, "selected", void 0), s([r({
|
|
1170
|
+
type: Boolean,
|
|
1171
|
+
reflect: !0
|
|
1172
|
+
})], P.prototype, "disabled", void 0), s([r({
|
|
1173
|
+
type: Boolean,
|
|
1174
|
+
reflect: !0
|
|
1175
|
+
})], P.prototype, "interactive", void 0), customElements.get("void-list-item") || customElements.define("void-list-item", P);
|
|
1176
|
+
//#endregion
|
|
1177
|
+
//#region src/components/toast.ts
|
|
1178
|
+
var F = class extends o {
|
|
1179
|
+
constructor(...e) {
|
|
1180
|
+
super(...e), this.color = "default", this.duration = 5e3, this.dismissable = !0, this.heading = "";
|
|
1181
|
+
}
|
|
1182
|
+
connectedCallback() {
|
|
1183
|
+
super.connectedCallback(), this.setAttribute("role", "status"), this.duration > 0 && (this._timer = setTimeout(() => this._close(), this.duration));
|
|
1184
|
+
}
|
|
1185
|
+
disconnectedCallback() {
|
|
1186
|
+
super.disconnectedCallback(), clearTimeout(this._timer);
|
|
1187
|
+
}
|
|
1188
|
+
_close() {
|
|
1189
|
+
this.dispatchEvent(new CustomEvent("void-close", {
|
|
1190
|
+
bubbles: !0,
|
|
1191
|
+
composed: !0
|
|
1192
|
+
})), this.remove();
|
|
1193
|
+
}
|
|
1194
|
+
render() {
|
|
1195
|
+
return t`
|
|
1196
|
+
${this.heading ? t`<span class='void-toast-heading'>${this.heading}</span>` : n}
|
|
1197
|
+
<slot></slot>
|
|
1198
|
+
${this.dismissable ? t`<button class='void-toast-close' aria-label='Close' @click='${this._close}'>×</button>` : n}
|
|
1199
|
+
`;
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
s([r({
|
|
1203
|
+
type: String,
|
|
1204
|
+
reflect: !0
|
|
1205
|
+
})], F.prototype, "color", void 0), s([r({ type: Number })], F.prototype, "duration", void 0), s([r({
|
|
1206
|
+
type: Boolean,
|
|
1207
|
+
reflect: !0
|
|
1208
|
+
})], F.prototype, "dismissable", void 0), s([r({ type: String })], F.prototype, "heading", void 0), customElements.get("void-toast") || customElements.define("void-toast", F);
|
|
1209
|
+
var I = class extends o {
|
|
1210
|
+
constructor(...e) {
|
|
1211
|
+
super(...e), this.position = "bottom-right";
|
|
1212
|
+
}
|
|
1213
|
+
connectedCallback() {
|
|
1214
|
+
super.connectedCallback(), this.setAttribute("role", "region"), this.setAttribute("aria-label", "Notifications"), this.setAttribute("aria-live", "polite");
|
|
1215
|
+
}
|
|
1216
|
+
render() {
|
|
1217
|
+
return n;
|
|
1218
|
+
}
|
|
1219
|
+
static show(e) {
|
|
1220
|
+
let t = document.querySelector("void-toast-container");
|
|
1221
|
+
t || (t = document.createElement("void-toast-container"), document.body.appendChild(t));
|
|
1222
|
+
let n = document.createElement("void-toast");
|
|
1223
|
+
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;
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
s([r({
|
|
1227
|
+
type: String,
|
|
1228
|
+
reflect: !0
|
|
1229
|
+
})], I.prototype, "position", void 0), customElements.get("void-toast-container") || customElements.define("void-toast-container", I);
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/components/stepper.ts
|
|
1232
|
+
var L = class extends o {
|
|
1233
|
+
constructor(...e) {
|
|
1234
|
+
super(...e), this.value = 0, this.steps = "";
|
|
1235
|
+
}
|
|
1236
|
+
connectedCallback() {
|
|
1237
|
+
super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Progress");
|
|
1238
|
+
}
|
|
1239
|
+
render() {
|
|
1240
|
+
return t`${this.steps.split(",").map((e) => e.trim()).filter(Boolean).map((e, r) => {
|
|
1241
|
+
let i = r < this.value ? "completed" : r === this.value ? "active" : "upcoming";
|
|
1242
|
+
return t`${r > 0 ? t`<div class="void-stepper-connector" data-state=${r <= this.value ? "completed" : "upcoming"}></div>` : null}<div
|
|
1243
|
+
class="void-stepper-step"
|
|
1244
|
+
data-state=${i}
|
|
1245
|
+
aria-current=${r === this.value ? "step" : n}
|
|
1246
|
+
>
|
|
1247
|
+
<span class="void-stepper-circle"
|
|
1248
|
+
>${i === "completed" ? t`<svg
|
|
1249
|
+
viewBox="0 0 12 12"
|
|
1250
|
+
width="12"
|
|
1251
|
+
height="12"
|
|
1252
|
+
fill="none"
|
|
1253
|
+
stroke="currentColor"
|
|
1254
|
+
stroke-width="2"
|
|
1255
|
+
stroke-linecap="round"
|
|
1256
|
+
stroke-linejoin="round"
|
|
1257
|
+
>
|
|
1258
|
+
<polyline points="2,6 5,9 10,3"></polyline>
|
|
1259
|
+
</svg>` : r + 1}</span
|
|
1260
|
+
>
|
|
1261
|
+
<span class="void-stepper-label">${e}</span>
|
|
1262
|
+
</div>`;
|
|
1263
|
+
})}`;
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
s([r({
|
|
1267
|
+
type: Number,
|
|
1268
|
+
reflect: !0
|
|
1269
|
+
})], L.prototype, "value", void 0), s([r({ reflect: !0 })], L.prototype, "steps", void 0), customElements.get("void-stepper") || customElements.define("void-stepper", L);
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region src/components/drawer.ts
|
|
1272
|
+
var R = class extends o {
|
|
1273
|
+
constructor(...e) {
|
|
1274
|
+
super(...e), this.open = !1, this.side = "right", this.size = "md", this.heading = "", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
|
|
1275
|
+
e.key === "Escape" && this.open && this.closable && this._close();
|
|
1276
|
+
}, this._handleBackdropClick = () => {
|
|
1277
|
+
this.closable && this._close();
|
|
1278
|
+
}, this._handleBackdropKeydown = (e) => {
|
|
1279
|
+
e.key === "Escape" && this.closable && this._close();
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
connectedCallback() {
|
|
1283
|
+
super.connectedCallback(), this.setAttribute("role", "dialog"), this.setAttribute("aria-modal", "true"), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("keydown", this._handleKeydown);
|
|
1284
|
+
}
|
|
1285
|
+
disconnectedCallback() {
|
|
1286
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeydown);
|
|
1287
|
+
}
|
|
1288
|
+
updated(e) {
|
|
1289
|
+
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) {
|
|
1290
|
+
this._didSetup = !0;
|
|
1291
|
+
let e = this.querySelector(".void-drawer-body");
|
|
1292
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
_close() {
|
|
1296
|
+
this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
|
|
1297
|
+
bubbles: !0,
|
|
1298
|
+
composed: !0
|
|
1299
|
+
}));
|
|
1300
|
+
}
|
|
1301
|
+
render() {
|
|
1302
|
+
return this.open ? t`
|
|
1303
|
+
<div class="void-drawer-backdrop" @click="${this._handleBackdropClick}" @keydown="${this._handleBackdropKeydown}"></div>
|
|
1304
|
+
<div class="void-drawer-panel">
|
|
1305
|
+
<div class="void-drawer-header">
|
|
1306
|
+
${this.heading ? t`<span class="void-drawer-heading">${this.heading}</span>` : n}
|
|
1307
|
+
${this.closable ? t`<button class="void-drawer-close" aria-label="Close" @click="${this._close}">×</button>` : n}
|
|
1308
|
+
</div>
|
|
1309
|
+
<div class="void-drawer-body"></div>
|
|
1310
|
+
</div>
|
|
1311
|
+
` : n;
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
s([r({
|
|
1315
|
+
type: Boolean,
|
|
1316
|
+
reflect: !0
|
|
1317
|
+
})], R.prototype, "open", void 0), s([r({
|
|
1318
|
+
type: String,
|
|
1319
|
+
reflect: !0
|
|
1320
|
+
})], R.prototype, "side", void 0), s([r({
|
|
1321
|
+
type: String,
|
|
1322
|
+
reflect: !0
|
|
1323
|
+
})], R.prototype, "size", void 0), s([r({ type: String })], R.prototype, "heading", void 0), s([r({
|
|
1324
|
+
type: Boolean,
|
|
1325
|
+
reflect: !0
|
|
1326
|
+
})], R.prototype, "closable", void 0), customElements.get("void-drawer") || customElements.define("void-drawer", R);
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/components/card.ts
|
|
1329
|
+
var z = class extends o {
|
|
1330
|
+
constructor(...e) {
|
|
1331
|
+
super(...e), this.heading = "", this.variant = "default", this.padding = "md", this._userContent = [], this._didSetup = !1;
|
|
1332
|
+
}
|
|
1333
|
+
connectedCallback() {
|
|
1334
|
+
super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
1335
|
+
}
|
|
1336
|
+
updated(e) {
|
|
1337
|
+
if (super.updated(e), !this._didSetup) {
|
|
1338
|
+
this._didSetup = !0;
|
|
1339
|
+
let e = this.querySelector(".void-card-body");
|
|
1340
|
+
for (let t of this._userContent) e.appendChild(t);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
render() {
|
|
1344
|
+
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>`;
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
s([r({ type: String })], z.prototype, "heading", void 0), s([r({
|
|
1348
|
+
type: String,
|
|
1349
|
+
reflect: !0
|
|
1350
|
+
})], z.prototype, "variant", void 0), s([r({
|
|
1351
|
+
type: String,
|
|
1352
|
+
reflect: !0
|
|
1353
|
+
})], z.prototype, "padding", void 0), customElements.get("void-card") || customElements.define("void-card", z);
|
|
1354
|
+
//#endregion
|
|
1355
|
+
//#region src/components/popover.ts
|
|
1356
|
+
var B = class extends o {
|
|
1357
|
+
constructor(...e) {
|
|
1358
|
+
super(...e), this.open = !1, this.position = "bottom", this.trigger = "click", this._triggerEl = null, this._contentNodes = [], this._didSetup = !1, this._handleTriggerClick = () => {
|
|
1359
|
+
this.open = !this.open, this.open || this._dispatchClose();
|
|
1360
|
+
}, this._handleOutsideClick = (e) => {
|
|
1361
|
+
this.open && !this.contains(e.target) && this._close();
|
|
1362
|
+
}, this._handleKeydown = (e) => {
|
|
1363
|
+
e.key === "Escape" && this.open && this._close();
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
connectedCallback() {
|
|
1367
|
+
super.connectedCallback(), this._didSetup || (this._triggerEl = this.children[0] ?? null, this._contentNodes = Array.from(this.childNodes).slice(+!!this._triggerEl)), document.addEventListener("mousedown", this._handleOutsideClick), document.addEventListener("keydown", this._handleKeydown);
|
|
1368
|
+
}
|
|
1369
|
+
disconnectedCallback() {
|
|
1370
|
+
super.disconnectedCallback(), document.removeEventListener("mousedown", this._handleOutsideClick), document.removeEventListener("keydown", this._handleKeydown);
|
|
1371
|
+
}
|
|
1372
|
+
updated(e) {
|
|
1373
|
+
if (super.updated(e), !this._didSetup) {
|
|
1374
|
+
this._didSetup = !0, this._triggerEl && (this.appendChild(this._triggerEl), this.trigger === "click" && this._triggerEl.addEventListener("click", this._handleTriggerClick));
|
|
1375
|
+
let e = document.createElement("div");
|
|
1376
|
+
e.className = "void-popover-body";
|
|
1377
|
+
for (let t of this._contentNodes) e.appendChild(t);
|
|
1378
|
+
this.appendChild(e);
|
|
1379
|
+
}
|
|
1380
|
+
e.has("trigger") && this._triggerEl && (this._triggerEl.removeEventListener("click", this._handleTriggerClick), this.trigger === "click" && this._triggerEl.addEventListener("click", this._handleTriggerClick));
|
|
1381
|
+
}
|
|
1382
|
+
_close() {
|
|
1383
|
+
this.open = !1, this._dispatchClose();
|
|
1384
|
+
}
|
|
1385
|
+
_dispatchClose() {
|
|
1386
|
+
this.dispatchEvent(new CustomEvent("void-close", {
|
|
1387
|
+
bubbles: !0,
|
|
1388
|
+
composed: !0
|
|
1389
|
+
}));
|
|
1390
|
+
}
|
|
1391
|
+
render() {
|
|
1392
|
+
return n;
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
s([r({
|
|
1396
|
+
type: Boolean,
|
|
1397
|
+
reflect: !0
|
|
1398
|
+
})], B.prototype, "open", void 0), s([r({
|
|
1399
|
+
type: String,
|
|
1400
|
+
reflect: !0
|
|
1401
|
+
})], B.prototype, "position", void 0), s([r({
|
|
1402
|
+
type: String,
|
|
1403
|
+
reflect: !0
|
|
1404
|
+
})], B.prototype, "trigger", void 0), customElements.get("void-popover") || customElements.define("void-popover", B);
|
|
1405
|
+
//#endregion
|
|
1406
|
+
//#region src/components/tooltip.ts
|
|
1407
|
+
var V = class extends o {
|
|
1408
|
+
constructor(...e) {
|
|
1409
|
+
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 = () => {
|
|
1410
|
+
clearTimeout(this._timerId), this._timerId = setTimeout(() => {
|
|
1411
|
+
this._visible = !0, this.requestUpdate();
|
|
1412
|
+
}, this.delay);
|
|
1413
|
+
}, this._onMouseLeave = () => {
|
|
1414
|
+
clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
|
|
1415
|
+
}, this._onFocusIn = () => {
|
|
1416
|
+
clearTimeout(this._timerId), this._visible = !0, this.requestUpdate();
|
|
1417
|
+
}, this._onFocusOut = () => {
|
|
1418
|
+
clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
connectedCallback() {
|
|
1422
|
+
this._userContent = Array.from(this.childNodes), super.connectedCallback(), this.style.display = "inline-flex", this.style.position = "relative", this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
|
|
1423
|
+
}
|
|
1424
|
+
disconnectedCallback() {
|
|
1425
|
+
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);
|
|
1426
|
+
}
|
|
1427
|
+
updated() {
|
|
1428
|
+
if (!this._didSetup) {
|
|
1429
|
+
this._didSetup = !0;
|
|
1430
|
+
let e = this.querySelector(".void-tooltip-bubble");
|
|
1431
|
+
if (e) for (let t of this._userContent) this.insertBefore(t, e);
|
|
1432
|
+
}
|
|
1433
|
+
this._visible ? this.setAttribute("visible", "") : this.removeAttribute("visible");
|
|
1434
|
+
let e = this.children[0];
|
|
1435
|
+
e && (this._visible ? e.setAttribute("aria-describedby", this._tooltipId) : e.removeAttribute("aria-describedby"));
|
|
1436
|
+
}
|
|
1437
|
+
render() {
|
|
1438
|
+
return t`<span id="${this._tooltipId}" class="void-tooltip-bubble" role="tooltip" aria-label=${this.text}>${this.text}</span>`;
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
s([r({ type: String })], V.prototype, "text", void 0), s([r({
|
|
1442
|
+
type: String,
|
|
1443
|
+
reflect: !0
|
|
1444
|
+
})], V.prototype, "position", void 0), s([r({ type: Number })], V.prototype, "delay", void 0), s([a()], V.prototype, "_visible", void 0), customElements.get("void-tooltip") || customElements.define("void-tooltip", V);
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region src/components/banner.ts
|
|
1447
|
+
var H = class extends o {
|
|
1448
|
+
constructor(...e) {
|
|
1449
|
+
super(...e), this.color = "default", this.dismissable = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
|
|
1450
|
+
}
|
|
1451
|
+
connectedCallback() {
|
|
1452
|
+
super.connectedCallback(), this.setAttribute("role", "banner"), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
1453
|
+
}
|
|
1454
|
+
updated(e) {
|
|
1455
|
+
if (super.updated(e), !this._didSetup) {
|
|
1456
|
+
this._didSetup = !0;
|
|
1457
|
+
for (let e of this._userContent) this.appendChild(e);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
_close() {
|
|
1461
|
+
this.dispatchEvent(new CustomEvent("void-close", {
|
|
1462
|
+
bubbles: !0,
|
|
1463
|
+
composed: !0
|
|
1464
|
+
})), this.remove();
|
|
1465
|
+
}
|
|
1466
|
+
render() {
|
|
1467
|
+
return this.dismissable ? t`<button class="void-banner-close" aria-label="Close" @click="${this._close}">×</button>` : n;
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
s([r({
|
|
1471
|
+
type: String,
|
|
1472
|
+
reflect: !0
|
|
1473
|
+
})], H.prototype, "color", void 0), s([r({
|
|
1474
|
+
type: Boolean,
|
|
1475
|
+
reflect: !0
|
|
1476
|
+
})], H.prototype, "dismissable", void 0), s([r({
|
|
1477
|
+
type: String,
|
|
1478
|
+
reflect: !0
|
|
1479
|
+
})], H.prototype, "variant", void 0), customElements.get("void-banner") || customElements.define("void-banner", H);
|
|
1480
|
+
//#endregion
|
|
1481
|
+
//#region src/components/scroll-area.ts
|
|
1482
|
+
var U = class extends o {
|
|
1483
|
+
constructor(...e) {
|
|
1484
|
+
super(...e), this.maxHeight = "", this.direction = "vertical", this._userContent = [], this._didSetup = !1;
|
|
1485
|
+
}
|
|
1486
|
+
connectedCallback() {
|
|
1487
|
+
super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
1488
|
+
}
|
|
1489
|
+
updated(e) {
|
|
1490
|
+
if (super.updated(e), !this._didSetup) {
|
|
1491
|
+
this._didSetup = !0;
|
|
1492
|
+
let e = this.querySelector(".void-scroll-area-viewport");
|
|
1493
|
+
for (let t of this._userContent) e.appendChild(t);
|
|
1494
|
+
}
|
|
1495
|
+
let t = this.querySelector(".void-scroll-area-viewport");
|
|
1496
|
+
t && (t.style.maxHeight = this.maxHeight || "");
|
|
1497
|
+
}
|
|
1498
|
+
render() {
|
|
1499
|
+
return t`<div class="void-scroll-area-viewport"></div>`;
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
s([r({ type: String })], U.prototype, "maxHeight", void 0), s([r({
|
|
1503
|
+
type: String,
|
|
1504
|
+
reflect: !0
|
|
1505
|
+
})], U.prototype, "direction", void 0), customElements.get("void-scroll-area") || customElements.define("void-scroll-area", U);
|
|
1506
|
+
//#endregion
|
|
1507
|
+
//#region src/components/table.ts
|
|
1508
|
+
var W = class extends o {
|
|
1509
|
+
constructor(...e) {
|
|
1510
|
+
super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1;
|
|
1511
|
+
}
|
|
1512
|
+
render() {
|
|
1513
|
+
return n;
|
|
1514
|
+
}
|
|
1515
|
+
};
|
|
1516
|
+
s([r({
|
|
1517
|
+
type: Boolean,
|
|
1518
|
+
reflect: !0
|
|
1519
|
+
})], W.prototype, "striped", void 0), s([r({
|
|
1520
|
+
type: Boolean,
|
|
1521
|
+
reflect: !0
|
|
1522
|
+
})], W.prototype, "hoverable", void 0), s([r({
|
|
1523
|
+
type: Boolean,
|
|
1524
|
+
reflect: !0
|
|
1525
|
+
})], W.prototype, "compact", void 0), s([r({
|
|
1526
|
+
type: Boolean,
|
|
1527
|
+
reflect: !0
|
|
1528
|
+
})], W.prototype, "bordered", void 0), customElements.get("void-table") || customElements.define("void-table", W);
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/components/pagination.ts
|
|
1531
|
+
var G = class extends o {
|
|
1532
|
+
constructor(...e) {
|
|
1533
|
+
super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md";
|
|
1534
|
+
}
|
|
1535
|
+
_pages() {
|
|
1536
|
+
let { total: e, value: t, siblings: n } = this, r = [], i = Math.max(2, t - n), a = Math.min(e - 1, t + n);
|
|
1537
|
+
r.push(1), i > 2 && r.push("ellipsis");
|
|
1538
|
+
for (let e = i; e <= a; e++) r.push(e);
|
|
1539
|
+
return a < e - 1 && r.push("ellipsis"), e > 1 && r.push(e), r;
|
|
1540
|
+
}
|
|
1541
|
+
_go(e) {
|
|
1542
|
+
e < 1 || e > this.total || e === this.value || (this.value = e, this.dispatchEvent(new CustomEvent("void-change", {
|
|
1543
|
+
bubbles: !0,
|
|
1544
|
+
composed: !0,
|
|
1545
|
+
detail: { value: e }
|
|
1546
|
+
})));
|
|
1547
|
+
}
|
|
1548
|
+
render() {
|
|
1549
|
+
let e = this._pages(), r = 0;
|
|
1550
|
+
return t`
|
|
1551
|
+
<nav role="navigation" aria-label="Pagination">
|
|
1552
|
+
<button
|
|
1553
|
+
class="void-pagination-btn"
|
|
1554
|
+
?disabled=${this.value <= 1}
|
|
1555
|
+
@click=${() => this._go(this.value - 1)}
|
|
1556
|
+
aria-label="Previous page"
|
|
1557
|
+
>«</button>
|
|
1558
|
+
${e.map((e) => e === "ellipsis" ? (r++, t`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${r}>…</span>`) : t`
|
|
1559
|
+
<button
|
|
1560
|
+
class="void-pagination-btn"
|
|
1561
|
+
?disabled=${e === this.value}
|
|
1562
|
+
aria-current=${e === this.value ? "page" : n}
|
|
1563
|
+
@click=${() => this._go(e)}
|
|
1564
|
+
>${e}</button>
|
|
1565
|
+
`)}
|
|
1566
|
+
<button
|
|
1567
|
+
class="void-pagination-btn"
|
|
1568
|
+
?disabled=${this.value >= this.total}
|
|
1569
|
+
@click=${() => this._go(this.value + 1)}
|
|
1570
|
+
aria-label="Next page"
|
|
1571
|
+
>»</button>
|
|
1572
|
+
</nav>
|
|
1573
|
+
`;
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
s([r({ type: Number })], G.prototype, "total", void 0), s([r({
|
|
1577
|
+
type: Number,
|
|
1578
|
+
reflect: !0
|
|
1579
|
+
})], G.prototype, "value", void 0), s([r({ type: Number })], G.prototype, "siblings", void 0), s([r({
|
|
1580
|
+
type: String,
|
|
1581
|
+
reflect: !0
|
|
1582
|
+
})], G.prototype, "size", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", G);
|
|
1583
|
+
//#endregion
|
|
1584
|
+
//#region src/components/error-fallback.ts
|
|
1585
|
+
var K = class extends o {
|
|
1586
|
+
constructor(...e) {
|
|
1587
|
+
super(...e), this.heading = "Something went wrong", this.message = "", this.retryable = !1, this.retryLabel = "Try again", this.icon = !0;
|
|
1588
|
+
}
|
|
1589
|
+
connectedCallback() {
|
|
1590
|
+
super.connectedCallback(), this.setAttribute("role", "alert");
|
|
1591
|
+
}
|
|
1592
|
+
_retry() {
|
|
1593
|
+
this.dispatchEvent(new CustomEvent("void-retry", {
|
|
1594
|
+
bubbles: !0,
|
|
1595
|
+
composed: !0
|
|
1596
|
+
}));
|
|
1597
|
+
}
|
|
1598
|
+
render() {
|
|
1599
|
+
return t`
|
|
1600
|
+
<div class="void-error-fallback-content">
|
|
1601
|
+
${this.icon ? t`<span class="void-error-fallback-icon">⚠</span>` : n}
|
|
1602
|
+
<span class="void-error-fallback-heading">${this.heading}</span>
|
|
1603
|
+
${this.message ? t`<span class="void-error-fallback-message">${this.message}</span>` : n}
|
|
1604
|
+
${this.retryable ? t`<button class="void-error-fallback-retry" @click="${this._retry}">${this.retryLabel}</button>` : n}
|
|
1605
|
+
</div>
|
|
1606
|
+
`;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
s([r({ type: String })], K.prototype, "heading", void 0), s([r({ type: String })], K.prototype, "message", void 0), s([r({
|
|
1610
|
+
type: Boolean,
|
|
1611
|
+
reflect: !0
|
|
1612
|
+
})], 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);
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/components/checkbox-group.ts
|
|
1615
|
+
var q = class extends o {
|
|
1616
|
+
constructor(...e) {
|
|
1617
|
+
super(...e), this.label = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
|
|
1618
|
+
let t = e.target;
|
|
1619
|
+
!t.closest("void-checkbox") || t.closest("void-checkbox")?.closest("void-checkbox-group") !== this || (e.stopImmediatePropagation(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1620
|
+
bubbles: !0,
|
|
1621
|
+
composed: !0,
|
|
1622
|
+
detail: { values: this.value }
|
|
1623
|
+
})));
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
get value() {
|
|
1627
|
+
return Array.from(this.querySelectorAll("void-checkbox")).filter((e) => e.checked).map((e) => e.value);
|
|
1628
|
+
}
|
|
1629
|
+
connectedCallback() {
|
|
1630
|
+
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);
|
|
1631
|
+
}
|
|
1632
|
+
disconnectedCallback() {
|
|
1633
|
+
super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange);
|
|
1634
|
+
}
|
|
1635
|
+
updated(e) {
|
|
1636
|
+
if (super.updated(e), e.has("label") && (this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label")), !this._didSetup) {
|
|
1637
|
+
this._didSetup = !0;
|
|
1638
|
+
let e = this.querySelector(".void-checkbox-group-items");
|
|
1639
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
render() {
|
|
1643
|
+
return t`
|
|
1644
|
+
${this.label ? t`<span class="void-checkbox-group-label">${this.label}</span>` : n}
|
|
1645
|
+
<div class="void-checkbox-group-items"></div>
|
|
1646
|
+
`;
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
s([r({
|
|
1650
|
+
type: String,
|
|
1651
|
+
reflect: !0
|
|
1652
|
+
})], q.prototype, "label", void 0), s([r({
|
|
1653
|
+
type: String,
|
|
1654
|
+
reflect: !0
|
|
1655
|
+
})], q.prototype, "orientation", void 0), customElements.get("void-checkbox-group") || customElements.define("void-checkbox-group", q);
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region src/components/combobox.ts
|
|
1658
|
+
var J = class extends o {
|
|
1659
|
+
constructor(...e) {
|
|
1660
|
+
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 = () => {
|
|
1661
|
+
this.disabled || (this._open = !0, this._query = "", this.requestUpdate());
|
|
1662
|
+
}, this._onInput = (e) => {
|
|
1663
|
+
this._query = e.target.value, this._open = !0, this.requestUpdate();
|
|
1664
|
+
}, this._onInputKeydown = (e) => {
|
|
1665
|
+
e.key === "Escape" && (this._open = !1, this._query = "", this.requestUpdate());
|
|
1666
|
+
}, this._onInputBlur = () => {
|
|
1667
|
+
setTimeout(() => {
|
|
1668
|
+
this._open = !1, this._query = "", this.requestUpdate();
|
|
1669
|
+
}, 150);
|
|
1670
|
+
}, this._onDocumentClick = (e) => {
|
|
1671
|
+
this.contains(e.target) || (this._open = !1, this._query = "", this.requestUpdate());
|
|
1672
|
+
}, this._onDocumentKeydown = (e) => {
|
|
1673
|
+
e.key === "Escape" && this._open && (this._open = !1, this._query = "", this.requestUpdate());
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
connectedCallback() {
|
|
1677
|
+
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);
|
|
1678
|
+
}
|
|
1679
|
+
disconnectedCallback() {
|
|
1680
|
+
super.disconnectedCallback(), document.removeEventListener("click", this._onDocumentClick), document.removeEventListener("keydown", this._onDocumentKeydown);
|
|
1681
|
+
}
|
|
1682
|
+
updated(e) {
|
|
1683
|
+
super.updated(e), this.setAttribute("aria-expanded", String(this._open));
|
|
1684
|
+
}
|
|
1685
|
+
render() {
|
|
1686
|
+
let e = this._options.filter((e) => e.textContent?.trim().toLowerCase().includes(this._query.toLowerCase())), r = this._options.find((e) => e.value === this.value);
|
|
1687
|
+
return t`
|
|
1688
|
+
<input
|
|
1689
|
+
class="void-combobox-input"
|
|
1690
|
+
.value=${this._open ? this._query : r?.textContent?.trim() || this.value || ""}
|
|
1691
|
+
placeholder=${this.placeholder}
|
|
1692
|
+
?disabled=${this.disabled}
|
|
1693
|
+
autocomplete="off"
|
|
1694
|
+
aria-autocomplete="list"
|
|
1695
|
+
aria-expanded=${String(this._open)}
|
|
1696
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
1697
|
+
@focus=${this._onInputFocus}
|
|
1698
|
+
@input=${this._onInput}
|
|
1699
|
+
@keydown=${this._onInputKeydown}
|
|
1700
|
+
@blur=${this._onInputBlur}
|
|
1701
|
+
/>
|
|
1702
|
+
${this._open ? t`
|
|
1703
|
+
<div class="void-combobox-dropdown" role="listbox" aria-label=${this.placeholder}>
|
|
1704
|
+
${e.length > 0 ? e.map((e) => t`
|
|
1705
|
+
<div
|
|
1706
|
+
class="void-combobox-option"
|
|
1707
|
+
role="option"
|
|
1708
|
+
aria-selected=${e.value === this.value ? "true" : "false"}
|
|
1709
|
+
@mousedown=${(t) => {
|
|
1710
|
+
t.preventDefault(), this._selectOption(e);
|
|
1711
|
+
}}
|
|
1712
|
+
>${e.textContent?.trim() || e.value}</div>
|
|
1713
|
+
`) : t`<div class="void-combobox-empty">No options found</div>`}
|
|
1714
|
+
</div>
|
|
1715
|
+
` : n}
|
|
1716
|
+
${this.error ? t`<span class="void-combobox-error">${this.error}</span>` : n}
|
|
1717
|
+
`;
|
|
1718
|
+
}
|
|
1719
|
+
_selectOption(e) {
|
|
1720
|
+
this.value = e.value, this._open = !1, this._query = "", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1721
|
+
bubbles: !0,
|
|
1722
|
+
composed: !0,
|
|
1723
|
+
detail: { value: this.value }
|
|
1724
|
+
}));
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1727
|
+
s([r({ type: String })], J.prototype, "value", void 0), s([r({ type: String })], J.prototype, "placeholder", void 0), s([r({
|
|
1728
|
+
type: Boolean,
|
|
1729
|
+
reflect: !0
|
|
1730
|
+
})], J.prototype, "disabled", void 0), s([r({
|
|
1731
|
+
type: String,
|
|
1732
|
+
reflect: !0
|
|
1733
|
+
})], J.prototype, "size", void 0), s([r({
|
|
1734
|
+
type: String,
|
|
1735
|
+
reflect: !0
|
|
1736
|
+
})], J.prototype, "error", void 0), s([r({
|
|
1737
|
+
type: String,
|
|
1738
|
+
reflect: !0
|
|
1739
|
+
})], J.prototype, "name", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", J);
|
|
1740
|
+
//#endregion
|
|
1741
|
+
//#region src/components/slider.ts
|
|
1742
|
+
var Y = class extends o {
|
|
1743
|
+
constructor(...e) {
|
|
1744
|
+
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";
|
|
1745
|
+
}
|
|
1746
|
+
connectedCallback() {
|
|
1747
|
+
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));
|
|
1748
|
+
}
|
|
1749
|
+
updated(e) {
|
|
1750
|
+
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));
|
|
1751
|
+
}
|
|
1752
|
+
_fill() {
|
|
1753
|
+
return (this.value - this.min) / (this.max - this.min) * 100;
|
|
1754
|
+
}
|
|
1755
|
+
_onInput(e) {
|
|
1756
|
+
let t = e.target;
|
|
1757
|
+
this.value = Number(t.value), this.dispatchEvent(new CustomEvent("void-input", {
|
|
1758
|
+
bubbles: !0,
|
|
1759
|
+
composed: !0,
|
|
1760
|
+
detail: { value: this.value }
|
|
1761
|
+
}));
|
|
1762
|
+
}
|
|
1763
|
+
_onChange(e) {
|
|
1764
|
+
let t = e.target;
|
|
1765
|
+
this.value = Number(t.value), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1766
|
+
bubbles: !0,
|
|
1767
|
+
composed: !0,
|
|
1768
|
+
detail: { value: this.value }
|
|
1769
|
+
}));
|
|
1770
|
+
}
|
|
1771
|
+
render() {
|
|
1772
|
+
let e = this._fill();
|
|
1773
|
+
return t`
|
|
1774
|
+
<input
|
|
1775
|
+
type="range"
|
|
1776
|
+
.value=${String(this.value)}
|
|
1777
|
+
min=${this.min}
|
|
1778
|
+
max=${this.max}
|
|
1779
|
+
step=${this.step}
|
|
1780
|
+
?disabled=${this.disabled}
|
|
1781
|
+
name=${this.name}
|
|
1782
|
+
style="--fill: ${e}%"
|
|
1783
|
+
@input=${this._onInput}
|
|
1784
|
+
@change=${this._onChange}
|
|
1785
|
+
/>
|
|
1786
|
+
${this.showValue ? t`<span class="void-slider-value">${this.value}</span>` : ""}
|
|
1787
|
+
`;
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
s([r({ type: Number })], Y.prototype, "value", void 0), s([r({ type: Number })], Y.prototype, "min", void 0), s([r({ type: Number })], Y.prototype, "max", void 0), s([r({ type: Number })], Y.prototype, "step", void 0), s([r({
|
|
1791
|
+
type: Boolean,
|
|
1792
|
+
reflect: !0
|
|
1793
|
+
})], Y.prototype, "disabled", void 0), s([r({
|
|
1794
|
+
type: String,
|
|
1795
|
+
reflect: !0
|
|
1796
|
+
})], Y.prototype, "name", void 0), s([r({
|
|
1797
|
+
type: Boolean,
|
|
1798
|
+
reflect: !0
|
|
1799
|
+
})], Y.prototype, "showValue", void 0), s([r({
|
|
1800
|
+
type: String,
|
|
1801
|
+
reflect: !0
|
|
1802
|
+
})], Y.prototype, "size", void 0), customElements.get("void-slider") || customElements.define("void-slider", Y);
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region src/components/file-upload.ts
|
|
1805
|
+
var X = class extends o {
|
|
1806
|
+
constructor(...e) {
|
|
1807
|
+
super(...e), this.accept = "", this.multiple = !1, this.disabled = !1, this.maxSize = 0, this.error = "", this._files = [], this._onDropzoneClick = () => {
|
|
1808
|
+
this.disabled || this._input?.click();
|
|
1809
|
+
}, this._onDropzoneKeydown = (e) => {
|
|
1810
|
+
this.disabled || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._input?.click());
|
|
1811
|
+
}, this._onDragOver = (e) => {
|
|
1812
|
+
this.disabled || (e.preventDefault(), this.setAttribute("dragging", ""));
|
|
1813
|
+
}, this._onDragLeave = () => {
|
|
1814
|
+
this.removeAttribute("dragging");
|
|
1815
|
+
}, this._onDrop = (e) => {
|
|
1816
|
+
if (e.preventDefault(), this.removeAttribute("dragging"), this.disabled) return;
|
|
1817
|
+
let t = Array.from(e.dataTransfer?.files ?? []);
|
|
1818
|
+
this._addFiles(t);
|
|
1819
|
+
}, this._onInputChange = (e) => {
|
|
1820
|
+
let t = e.target, n = Array.from(t.files ?? []);
|
|
1821
|
+
this._addFiles(n), t.value = "";
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
get _input() {
|
|
1825
|
+
return this.querySelector("input[type=\"file\"]");
|
|
1826
|
+
}
|
|
1827
|
+
render() {
|
|
1828
|
+
return t`
|
|
1829
|
+
<input
|
|
1830
|
+
type="file"
|
|
1831
|
+
style="display:none"
|
|
1832
|
+
accept=${this.accept || n}
|
|
1833
|
+
?multiple=${this.multiple}
|
|
1834
|
+
?disabled=${this.disabled}
|
|
1835
|
+
@change=${this._onInputChange}
|
|
1836
|
+
/>
|
|
1837
|
+
<div
|
|
1838
|
+
class="void-file-upload-dropzone"
|
|
1839
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
1840
|
+
role="button"
|
|
1841
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
1842
|
+
@click=${this._onDropzoneClick}
|
|
1843
|
+
@keydown=${this._onDropzoneKeydown}
|
|
1844
|
+
@dragover=${this._onDragOver}
|
|
1845
|
+
@dragleave=${this._onDragLeave}
|
|
1846
|
+
@drop=${this._onDrop}
|
|
1847
|
+
>
|
|
1848
|
+
<span class="void-file-upload-text">
|
|
1849
|
+
Drop files here or <span class="void-file-upload-browse">browse</span>
|
|
1850
|
+
</span>
|
|
1851
|
+
</div>
|
|
1852
|
+
${this._files.length > 0 ? t`
|
|
1853
|
+
<div class="void-file-upload-files">
|
|
1854
|
+
${this._files.map((e, n) => t`
|
|
1855
|
+
<div class="void-file-upload-file">
|
|
1856
|
+
<span class="void-file-upload-filename">${e.name}</span>
|
|
1857
|
+
<button
|
|
1858
|
+
class="void-file-upload-remove"
|
|
1859
|
+
aria-label="Remove ${e.name}"
|
|
1860
|
+
?disabled=${this.disabled}
|
|
1861
|
+
@click=${() => this._removeFile(n)}
|
|
1862
|
+
>×</button>
|
|
1863
|
+
</div>
|
|
1864
|
+
`)}
|
|
1865
|
+
</div>
|
|
1866
|
+
` : n}
|
|
1867
|
+
${this.error ? t`<span class="void-file-upload-error">${this.error}</span>` : n}
|
|
1868
|
+
`;
|
|
1869
|
+
}
|
|
1870
|
+
_addFiles(e) {
|
|
1871
|
+
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)));
|
|
1872
|
+
t.length !== 0 && (this._files = this.multiple ? [...this._files, ...t] : t, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1873
|
+
bubbles: !0,
|
|
1874
|
+
composed: !0,
|
|
1875
|
+
detail: { files: [...this._files] }
|
|
1876
|
+
})));
|
|
1877
|
+
}
|
|
1878
|
+
_removeFile(e) {
|
|
1879
|
+
this._files = this._files.filter((t, n) => n !== e), this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
1880
|
+
bubbles: !0,
|
|
1881
|
+
composed: !0,
|
|
1882
|
+
detail: { files: [...this._files] }
|
|
1883
|
+
}));
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
s([r({ type: String })], X.prototype, "accept", void 0), s([r({
|
|
1887
|
+
type: Boolean,
|
|
1888
|
+
reflect: !0
|
|
1889
|
+
})], X.prototype, "multiple", void 0), s([r({
|
|
1890
|
+
type: Boolean,
|
|
1891
|
+
reflect: !0
|
|
1892
|
+
})], X.prototype, "disabled", void 0), s([r({ type: Number })], X.prototype, "maxSize", void 0), s([r({
|
|
1893
|
+
type: String,
|
|
1894
|
+
reflect: !0
|
|
1895
|
+
})], X.prototype, "error", void 0), customElements.get("void-file-upload") || customElements.define("void-file-upload", X);
|
|
1896
|
+
//#endregion
|
|
1897
|
+
//#region src/components/nav-bar.ts
|
|
1898
|
+
var Z = class extends o {
|
|
1899
|
+
constructor(...e) {
|
|
1900
|
+
super(...e), this.sticky = !1, this.bordered = !0, this.variant = "default", this._userContent = [], this._didSetup = !1;
|
|
1901
|
+
}
|
|
1902
|
+
connectedCallback() {
|
|
1903
|
+
super.connectedCallback(), this.setAttribute("role", "navigation"), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
1904
|
+
}
|
|
1905
|
+
updated(e) {
|
|
1906
|
+
if (super.updated(e), !this._didSetup) {
|
|
1907
|
+
this._didSetup = !0;
|
|
1908
|
+
let e = this.querySelector(".void-nav-bar-content");
|
|
1909
|
+
for (let t of this._userContent) e.appendChild(t);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
render() {
|
|
1913
|
+
return t`<div class="void-nav-bar-content"></div>`;
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
s([r({
|
|
1917
|
+
type: Boolean,
|
|
1918
|
+
reflect: !0
|
|
1919
|
+
})], Z.prototype, "sticky", void 0), s([r({
|
|
1920
|
+
type: Boolean,
|
|
1921
|
+
reflect: !0
|
|
1922
|
+
})], Z.prototype, "bordered", void 0), s([r({
|
|
1923
|
+
type: String,
|
|
1924
|
+
reflect: !0
|
|
1925
|
+
})], Z.prototype, "variant", void 0), customElements.get("void-nav-bar") || customElements.define("void-nav-bar", Z);
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region src/components/hamburger.ts
|
|
1928
|
+
var Q = class extends o {
|
|
1929
|
+
constructor(...e) {
|
|
1930
|
+
super(...e), this.active = !1, this.size = "md", this._handleClick = () => {
|
|
1931
|
+
this.active = !this.active, this.dispatchEvent(new CustomEvent("void-toggle", {
|
|
1932
|
+
bubbles: !0,
|
|
1933
|
+
composed: !0,
|
|
1934
|
+
detail: { active: this.active }
|
|
1935
|
+
}));
|
|
1936
|
+
}, this._handleKeydown = (e) => {
|
|
1937
|
+
(e.key === " " || e.key === "Enter") && (e.preventDefault(), this._handleClick());
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
connectedCallback() {
|
|
1941
|
+
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);
|
|
1942
|
+
}
|
|
1943
|
+
disconnectedCallback() {
|
|
1944
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
1945
|
+
}
|
|
1946
|
+
updated(e) {
|
|
1947
|
+
e.has("active") && (this.setAttribute("aria-expanded", String(this.active)), this.setAttribute("aria-label", this.active ? "Close menu" : "Menu"));
|
|
1948
|
+
}
|
|
1949
|
+
render() {
|
|
1950
|
+
return t`
|
|
1951
|
+
<span class="void-hamburger-lines">
|
|
1952
|
+
<span class="void-hamburger-line"></span>
|
|
1953
|
+
<span class="void-hamburger-line"></span>
|
|
1954
|
+
<span class="void-hamburger-line"></span>
|
|
1955
|
+
</span>
|
|
1956
|
+
`;
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
s([r({
|
|
1960
|
+
type: Boolean,
|
|
1961
|
+
reflect: !0
|
|
1962
|
+
})], Q.prototype, "active", void 0), s([r({
|
|
1963
|
+
type: String,
|
|
1964
|
+
reflect: !0
|
|
1965
|
+
})], Q.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", Q);
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region src/components/compose-input.ts
|
|
1968
|
+
var $ = class extends o {
|
|
1969
|
+
constructor(...e) {
|
|
1970
|
+
super(...e), this.value = "", this.placeholder = "Type a message...", this.disabled = !1, this.maxlength = 0;
|
|
1971
|
+
}
|
|
1972
|
+
render() {
|
|
1973
|
+
return t`
|
|
1974
|
+
<div class="void-compose-input-wrapper">
|
|
1975
|
+
<textarea
|
|
1976
|
+
class="void-compose-input-textarea"
|
|
1977
|
+
.value=${this.value}
|
|
1978
|
+
placeholder=${this.placeholder}
|
|
1979
|
+
?disabled=${this.disabled}
|
|
1980
|
+
maxlength=${this.maxlength > 0 ? this.maxlength : ""}
|
|
1981
|
+
rows="1"
|
|
1982
|
+
@input=${this._onInput}
|
|
1983
|
+
@keydown=${this._onKeydown}
|
|
1984
|
+
></textarea>
|
|
1985
|
+
<button
|
|
1986
|
+
class="void-compose-input-send"
|
|
1987
|
+
type="button"
|
|
1988
|
+
?disabled=${this.disabled || !this.value}
|
|
1989
|
+
@click=${this._onSend}
|
|
1990
|
+
aria-label="Send"
|
|
1991
|
+
>
|
|
1992
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1993
|
+
<path d="M2 8L14 8M14 8L9 3M14 8L9 13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1994
|
+
</svg>
|
|
1995
|
+
</button>
|
|
1996
|
+
</div>
|
|
1997
|
+
`;
|
|
1998
|
+
}
|
|
1999
|
+
_onInput(e) {
|
|
2000
|
+
let t = e.target;
|
|
2001
|
+
this.value = t.value, t.style.height = "auto", t.style.height = `${t.scrollHeight}px`, this.dispatchEvent(new CustomEvent("void-input", {
|
|
2002
|
+
bubbles: !0,
|
|
2003
|
+
composed: !0,
|
|
2004
|
+
detail: { value: this.value }
|
|
2005
|
+
}));
|
|
2006
|
+
}
|
|
2007
|
+
_onKeydown(e) {
|
|
2008
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this._onSend());
|
|
2009
|
+
}
|
|
2010
|
+
_onSend() {
|
|
2011
|
+
if (this.disabled || !this.value) return;
|
|
2012
|
+
let e = this.value;
|
|
2013
|
+
this.value = "", this._textarea && (this._textarea.style.height = "auto"), this.dispatchEvent(new CustomEvent("void-submit", {
|
|
2014
|
+
bubbles: !0,
|
|
2015
|
+
composed: !0,
|
|
2016
|
+
detail: { value: e }
|
|
2017
|
+
}));
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
s([r({ type: String })], $.prototype, "value", void 0), s([r({
|
|
2021
|
+
type: String,
|
|
2022
|
+
reflect: !0
|
|
2023
|
+
})], $.prototype, "placeholder", void 0), s([r({
|
|
2024
|
+
type: Boolean,
|
|
2025
|
+
reflect: !0
|
|
2026
|
+
})], $.prototype, "disabled", void 0), s([r({
|
|
2027
|
+
type: Number,
|
|
2028
|
+
reflect: !0
|
|
2029
|
+
})], $.prototype, "maxlength", void 0), s([i(".void-compose-input-textarea")], $.prototype, "_textarea", void 0), customElements.get("void-compose-input") || customElements.define("void-compose-input", $);
|
|
2030
|
+
//#endregion
|
|
2031
|
+
export { A as VoidAccordion, j as VoidAccordionItem, m as VoidAlert, p as VoidAvatar, c as VoidBadge, H as VoidBanner, M as VoidBreadcrumbs, l as VoidButton, z as VoidCard, x as VoidCheckbox, q as VoidCheckboxGroup, J as VoidCombobox, $ as VoidComposeInput, D as VoidDialog, u as VoidDivider, R as VoidDrawer, o as VoidElement, K as VoidErrorFallback, w as VoidField, X as VoidFileUpload, Q as VoidHamburger, v as VoidInput, N as VoidList, P as VoidListItem, E as VoidMultiselect, Z as VoidNavBar, T as VoidOption, G as VoidPagination, _ as VoidPanel, B as VoidPopover, g as VoidProgress, S as VoidRadio, C as VoidRadioGroup, U as VoidScrollArea, b as VoidSelect, ee as VoidSkeleton, Y as VoidSlider, d as VoidSpinner, te as VoidStatusDot, L as VoidStepper, f as VoidSwitch, O as VoidTabPanel, W as VoidTable, k as VoidTabs, h as VoidTag, y as VoidTextarea, F as VoidToast, I as VoidToastContainer, V as VoidTooltip };
|