@lundal/zed-solid 0.0.1

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/dist/index.js ADDED
@@ -0,0 +1,969 @@
1
+ import './style.css';
2
+ import "@fontsource/inter/400.css";
3
+ import "@fontsource/inter/500.css";
4
+ import { sharedConfig, createRenderEffect, untrack, createComponent, For, createMemo, createSignal, onMount } from "solid-js";
5
+ import { A } from "@solidjs/router";
6
+ const style$1 = "";
7
+ function reconcileArrays(parentNode, a, b) {
8
+ let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
9
+ while (aStart < aEnd || bStart < bEnd) {
10
+ if (a[aStart] === b[bStart]) {
11
+ aStart++;
12
+ bStart++;
13
+ continue;
14
+ }
15
+ while (a[aEnd - 1] === b[bEnd - 1]) {
16
+ aEnd--;
17
+ bEnd--;
18
+ }
19
+ if (aEnd === aStart) {
20
+ const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
21
+ while (bStart < bEnd)
22
+ parentNode.insertBefore(b[bStart++], node);
23
+ } else if (bEnd === bStart) {
24
+ while (aStart < aEnd) {
25
+ if (!map || !map.has(a[aStart]))
26
+ a[aStart].remove();
27
+ aStart++;
28
+ }
29
+ } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
30
+ const node = a[--aEnd].nextSibling;
31
+ parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
32
+ parentNode.insertBefore(b[--bEnd], node);
33
+ a[aEnd] = b[bEnd];
34
+ } else {
35
+ if (!map) {
36
+ map = /* @__PURE__ */ new Map();
37
+ let i = bStart;
38
+ while (i < bEnd)
39
+ map.set(b[i], i++);
40
+ }
41
+ const index = map.get(a[aStart]);
42
+ if (index != null) {
43
+ if (bStart < index && index < bEnd) {
44
+ let i = aStart, sequence = 1, t;
45
+ while (++i < aEnd && i < bEnd) {
46
+ if ((t = map.get(a[i])) == null || t !== index + sequence)
47
+ break;
48
+ sequence++;
49
+ }
50
+ if (sequence > index - bStart) {
51
+ const node = a[aStart];
52
+ while (bStart < index)
53
+ parentNode.insertBefore(b[bStart++], node);
54
+ } else
55
+ parentNode.replaceChild(b[bStart++], a[aStart++]);
56
+ } else
57
+ aStart++;
58
+ } else
59
+ a[aStart++].remove();
60
+ }
61
+ }
62
+ }
63
+ const $$EVENTS = "_$DX_DELEGATE";
64
+ function template(html, isCE, isSVG) {
65
+ let node;
66
+ const create = () => {
67
+ const t = document.createElement("template");
68
+ t.innerHTML = html;
69
+ return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
70
+ };
71
+ const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
72
+ fn.cloneNode = fn;
73
+ return fn;
74
+ }
75
+ function delegateEvents(eventNames, document2 = window.document) {
76
+ const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
77
+ for (let i = 0, l = eventNames.length; i < l; i++) {
78
+ const name = eventNames[i];
79
+ if (!e.has(name)) {
80
+ e.add(name);
81
+ document2.addEventListener(name, eventHandler);
82
+ }
83
+ }
84
+ }
85
+ function setAttribute(node, name, value) {
86
+ if (value == null)
87
+ node.removeAttribute(name);
88
+ else
89
+ node.setAttribute(name, value);
90
+ }
91
+ function className(node, value) {
92
+ if (value == null)
93
+ node.removeAttribute("class");
94
+ else
95
+ node.className = value;
96
+ }
97
+ function style(node, value, prev) {
98
+ if (!value)
99
+ return prev ? setAttribute(node, "style") : value;
100
+ const nodeStyle = node.style;
101
+ if (typeof value === "string")
102
+ return nodeStyle.cssText = value;
103
+ typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
104
+ prev || (prev = {});
105
+ value || (value = {});
106
+ let v, s;
107
+ for (s in prev) {
108
+ value[s] == null && nodeStyle.removeProperty(s);
109
+ delete prev[s];
110
+ }
111
+ for (s in value) {
112
+ v = value[s];
113
+ if (v !== prev[s]) {
114
+ nodeStyle.setProperty(s, v);
115
+ prev[s] = v;
116
+ }
117
+ }
118
+ return prev;
119
+ }
120
+ function use(fn, element, arg) {
121
+ return untrack(() => fn(element, arg));
122
+ }
123
+ function insert(parent, accessor, marker, initial) {
124
+ if (marker !== void 0 && !initial)
125
+ initial = [];
126
+ if (typeof accessor !== "function")
127
+ return insertExpression(parent, accessor, initial, marker);
128
+ createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
129
+ }
130
+ function eventHandler(e) {
131
+ const key = `$$${e.type}`;
132
+ let node = e.composedPath && e.composedPath()[0] || e.target;
133
+ if (e.target !== node) {
134
+ Object.defineProperty(e, "target", {
135
+ configurable: true,
136
+ value: node
137
+ });
138
+ }
139
+ Object.defineProperty(e, "currentTarget", {
140
+ configurable: true,
141
+ get() {
142
+ return node || document;
143
+ }
144
+ });
145
+ if (sharedConfig.registry && !sharedConfig.done)
146
+ sharedConfig.done = _$HY.done = true;
147
+ while (node) {
148
+ const handler = node[key];
149
+ if (handler && !node.disabled) {
150
+ const data = node[`${key}Data`];
151
+ data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
152
+ if (e.cancelBubble)
153
+ return;
154
+ }
155
+ node = node._$host || node.parentNode || node.host;
156
+ }
157
+ }
158
+ function insertExpression(parent, value, current, marker, unwrapArray) {
159
+ if (sharedConfig.context) {
160
+ !current && (current = [...parent.childNodes]);
161
+ let cleaned = [];
162
+ for (let i = 0; i < current.length; i++) {
163
+ const node = current[i];
164
+ if (node.nodeType === 8 && node.data.slice(0, 2) === "!$")
165
+ node.remove();
166
+ else
167
+ cleaned.push(node);
168
+ }
169
+ current = cleaned;
170
+ }
171
+ while (typeof current === "function")
172
+ current = current();
173
+ if (value === current)
174
+ return current;
175
+ const t = typeof value, multi = marker !== void 0;
176
+ parent = multi && current[0] && current[0].parentNode || parent;
177
+ if (t === "string" || t === "number") {
178
+ if (sharedConfig.context)
179
+ return current;
180
+ if (t === "number")
181
+ value = value.toString();
182
+ if (multi) {
183
+ let node = current[0];
184
+ if (node && node.nodeType === 3) {
185
+ node.data = value;
186
+ } else
187
+ node = document.createTextNode(value);
188
+ current = cleanChildren(parent, current, marker, node);
189
+ } else {
190
+ if (current !== "" && typeof current === "string") {
191
+ current = parent.firstChild.data = value;
192
+ } else
193
+ current = parent.textContent = value;
194
+ }
195
+ } else if (value == null || t === "boolean") {
196
+ if (sharedConfig.context)
197
+ return current;
198
+ current = cleanChildren(parent, current, marker);
199
+ } else if (t === "function") {
200
+ createRenderEffect(() => {
201
+ let v = value();
202
+ while (typeof v === "function")
203
+ v = v();
204
+ current = insertExpression(parent, v, current, marker);
205
+ });
206
+ return () => current;
207
+ } else if (Array.isArray(value)) {
208
+ const array = [];
209
+ const currentArray = current && Array.isArray(current);
210
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
211
+ createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
212
+ return () => current;
213
+ }
214
+ if (sharedConfig.context) {
215
+ if (!array.length)
216
+ return current;
217
+ for (let i = 0; i < array.length; i++) {
218
+ if (array[i].parentNode)
219
+ return current = array;
220
+ }
221
+ }
222
+ if (array.length === 0) {
223
+ current = cleanChildren(parent, current, marker);
224
+ if (multi)
225
+ return current;
226
+ } else if (currentArray) {
227
+ if (current.length === 0) {
228
+ appendNodes(parent, array, marker);
229
+ } else
230
+ reconcileArrays(parent, current, array);
231
+ } else {
232
+ current && cleanChildren(parent);
233
+ appendNodes(parent, array);
234
+ }
235
+ current = array;
236
+ } else if (value.nodeType) {
237
+ if (sharedConfig.context && value.parentNode)
238
+ return current = multi ? [value] : value;
239
+ if (Array.isArray(current)) {
240
+ if (multi)
241
+ return current = cleanChildren(parent, current, marker, value);
242
+ cleanChildren(parent, current, null, value);
243
+ } else if (current == null || current === "" || !parent.firstChild) {
244
+ parent.appendChild(value);
245
+ } else
246
+ parent.replaceChild(value, parent.firstChild);
247
+ current = value;
248
+ } else
249
+ console.warn(`Unrecognized value. Skipped inserting`, value);
250
+ return current;
251
+ }
252
+ function normalizeIncomingArray(normalized, array, current, unwrap) {
253
+ let dynamic = false;
254
+ for (let i = 0, len = array.length; i < len; i++) {
255
+ let item = array[i], prev = current && current[i], t;
256
+ if (item == null || item === true || item === false)
257
+ ;
258
+ else if ((t = typeof item) === "object" && item.nodeType) {
259
+ normalized.push(item);
260
+ } else if (Array.isArray(item)) {
261
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
262
+ } else if (t === "function") {
263
+ if (unwrap) {
264
+ while (typeof item === "function")
265
+ item = item();
266
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
267
+ } else {
268
+ normalized.push(item);
269
+ dynamic = true;
270
+ }
271
+ } else {
272
+ const value = String(item);
273
+ if (prev && prev.nodeType === 3 && prev.data === value)
274
+ normalized.push(prev);
275
+ else
276
+ normalized.push(document.createTextNode(value));
277
+ }
278
+ }
279
+ return dynamic;
280
+ }
281
+ function appendNodes(parent, array, marker = null) {
282
+ for (let i = 0, len = array.length; i < len; i++)
283
+ parent.insertBefore(array[i], marker);
284
+ }
285
+ function cleanChildren(parent, current, marker, replacement) {
286
+ if (marker === void 0)
287
+ return parent.textContent = "";
288
+ const node = replacement || document.createTextNode("");
289
+ if (current.length) {
290
+ let inserted = false;
291
+ for (let i = current.length - 1; i >= 0; i--) {
292
+ const el = current[i];
293
+ if (node !== el) {
294
+ const isParent = el.parentNode === parent;
295
+ if (!inserted && !i)
296
+ isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
297
+ else
298
+ isParent && el.remove();
299
+ } else
300
+ inserted = true;
301
+ }
302
+ } else
303
+ parent.insertBefore(node, marker);
304
+ return [node];
305
+ }
306
+ function mergeClasses(a, b) {
307
+ if (a && b)
308
+ return `${a} ${b}`;
309
+ if (a)
310
+ return a;
311
+ if (b)
312
+ return b;
313
+ return void 0;
314
+ }
315
+ const _tmpl$$k = /* @__PURE__ */ template(`<div>`);
316
+ function App(props) {
317
+ return (() => {
318
+ const _el$ = _tmpl$$k();
319
+ insert(_el$, () => props.children);
320
+ createRenderEffect((_p$) => {
321
+ const _v$ = mergeClasses(`z-app z-app--layout-${props.layout} z-theme--${props.theme}`, props.class), _v$2 = props.style;
322
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
323
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
324
+ return _p$;
325
+ }, {
326
+ _v$: void 0,
327
+ _v$2: void 0
328
+ });
329
+ return _el$;
330
+ })();
331
+ }
332
+ const _tmpl$$j = /* @__PURE__ */ template(`<button>`);
333
+ function Button(props) {
334
+ return (() => {
335
+ const _el$ = _tmpl$$j();
336
+ _el$.$$click = () => !props.busy && props.onClick();
337
+ insert(_el$, () => props.label);
338
+ createRenderEffect((_p$) => {
339
+ const _v$ = mergeClasses(`z-button z-button--${props.type}`, props.class), _v$2 = props.style, _v$3 = props.busy;
340
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
341
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
342
+ _v$3 !== _p$._v$3 && setAttribute(_el$, "aria-busy", _p$._v$3 = _v$3);
343
+ return _p$;
344
+ }, {
345
+ _v$: void 0,
346
+ _v$2: void 0,
347
+ _v$3: void 0
348
+ });
349
+ return _el$;
350
+ })();
351
+ }
352
+ delegateEvents(["click"]);
353
+ const _tmpl$$i = /* @__PURE__ */ template(`<div>`);
354
+ function Card(props) {
355
+ return (() => {
356
+ const _el$ = _tmpl$$i();
357
+ insert(_el$, () => props.children);
358
+ createRenderEffect((_p$) => {
359
+ const _v$ = mergeClasses("z-card", props.class), _v$2 = props.style;
360
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
361
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
362
+ return _p$;
363
+ }, {
364
+ _v$: void 0,
365
+ _v$2: void 0
366
+ });
367
+ return _el$;
368
+ })();
369
+ }
370
+ const _tmpl$$h = /* @__PURE__ */ template(`<div><input type="checkbox"><label>`);
371
+ function CheckBox(props) {
372
+ return (() => {
373
+ const _el$ = _tmpl$$h(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
374
+ _el$2.addEventListener("change", () => props.onChange(!props.value));
375
+ insert(_el$3, () => props.label);
376
+ createRenderEffect((_p$) => {
377
+ const _v$ = mergeClasses("z-checkbox", props.class), _v$2 = props.style, _v$3 = props.id, _v$4 = props.invalid, _v$5 = props.errormessage, _v$6 = props.id;
378
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
379
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
380
+ _v$3 !== _p$._v$3 && setAttribute(_el$2, "id", _p$._v$3 = _v$3);
381
+ _v$4 !== _p$._v$4 && setAttribute(_el$2, "aria-invalid", _p$._v$4 = _v$4);
382
+ _v$5 !== _p$._v$5 && setAttribute(_el$2, "aria-errormessage", _p$._v$5 = _v$5);
383
+ _v$6 !== _p$._v$6 && setAttribute(_el$3, "for", _p$._v$6 = _v$6);
384
+ return _p$;
385
+ }, {
386
+ _v$: void 0,
387
+ _v$2: void 0,
388
+ _v$3: void 0,
389
+ _v$4: void 0,
390
+ _v$5: void 0,
391
+ _v$6: void 0
392
+ });
393
+ createRenderEffect(() => _el$2.checked = props.value);
394
+ return _el$;
395
+ })();
396
+ }
397
+ const _tmpl$$g = /* @__PURE__ */ template(`<fieldset><legend>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class="z-checkbox"><input type="checkbox"><label>`), _tmpl$3$3 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$2 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
398
+ function CheckBoxes(props) {
399
+ return (() => {
400
+ const _el$ = _tmpl$$g(), _el$2 = _el$.firstChild;
401
+ insert(_el$2, () => props.label);
402
+ insert(_el$, createComponent(For, {
403
+ get each() {
404
+ return props.options;
405
+ },
406
+ children: (option, index) => (() => {
407
+ const _el$3 = _tmpl$2$5(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
408
+ _el$4.addEventListener("change", () => option.onChange(!option.value));
409
+ insert(_el$5, () => option.label);
410
+ createRenderEffect((_p$) => {
411
+ const _v$3 = `${props.id}-${index()}`, _v$4 = !!props.error, _v$5 = props.error ? `${props.id}-error` : void 0, _v$6 = `${props.id}-${index()}`;
412
+ _v$3 !== _p$._v$3 && setAttribute(_el$4, "id", _p$._v$3 = _v$3);
413
+ _v$4 !== _p$._v$4 && setAttribute(_el$4, "aria-invalid", _p$._v$4 = _v$4);
414
+ _v$5 !== _p$._v$5 && setAttribute(_el$4, "aria-errormessage", _p$._v$5 = _v$5);
415
+ _v$6 !== _p$._v$6 && setAttribute(_el$5, "for", _p$._v$6 = _v$6);
416
+ return _p$;
417
+ }, {
418
+ _v$3: void 0,
419
+ _v$4: void 0,
420
+ _v$5: void 0,
421
+ _v$6: void 0
422
+ });
423
+ createRenderEffect(() => _el$4.checked = option.value);
424
+ return _el$3;
425
+ })()
426
+ }), null);
427
+ insert(_el$, (() => {
428
+ const _c$ = createMemo(() => !!props.error);
429
+ return () => _c$() && (() => {
430
+ const _el$6 = _tmpl$3$3();
431
+ insert(_el$6, () => props.error);
432
+ createRenderEffect(() => setAttribute(_el$6, "id", `${props.id}-error`));
433
+ return _el$6;
434
+ })();
435
+ })(), null);
436
+ insert(_el$, (() => {
437
+ const _c$2 = createMemo(() => !!(!props.error && props.errorPlaceholder !== false));
438
+ return () => _c$2() && _tmpl$4$2();
439
+ })(), null);
440
+ createRenderEffect((_p$) => {
441
+ const _v$ = mergeClasses("z-fieldset", props.class), _v$2 = props.style;
442
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
443
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
444
+ return _p$;
445
+ }, {
446
+ _v$: void 0,
447
+ _v$2: void 0
448
+ });
449
+ return _el$;
450
+ })();
451
+ }
452
+ const _tmpl$$f = /* @__PURE__ */ template(`<div>`);
453
+ function Column(props) {
454
+ return (() => {
455
+ const _el$ = _tmpl$$f();
456
+ insert(_el$, () => props.children);
457
+ createRenderEffect((_p$) => {
458
+ const _v$ = mergeClasses("z-column", props.class), _v$2 = props.style;
459
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
460
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
461
+ return _p$;
462
+ }, {
463
+ _v$: void 0,
464
+ _v$2: void 0
465
+ });
466
+ return _el$;
467
+ })();
468
+ }
469
+ const _tmpl$$e = /* @__PURE__ */ template(`<dialog>`);
470
+ function Dialog(props) {
471
+ const [wasOutside, setWasOutside] = createSignal(false);
472
+ function isOutside(e) {
473
+ const rect = e.target.getBoundingClientRect();
474
+ return e.clientX <= rect.left || e.clientX >= rect.right || e.clientY <= rect.top || e.clientY >= rect.bottom;
475
+ }
476
+ let dialog;
477
+ onMount(() => {
478
+ dialog == null ? void 0 : dialog.showModal();
479
+ dialog == null ? void 0 : dialog.classList.add("z-dialog--open");
480
+ });
481
+ function close() {
482
+ dialog == null ? void 0 : dialog.classList.remove("z-dialog--open");
483
+ setTimeout(() => {
484
+ dialog == null ? void 0 : dialog.close();
485
+ props.onClose();
486
+ }, 100);
487
+ }
488
+ return (() => {
489
+ const _el$ = _tmpl$$e();
490
+ _el$.$$click = (e) => {
491
+ if (wasOutside() && isOutside(e)) {
492
+ e.preventDefault();
493
+ close();
494
+ }
495
+ };
496
+ _el$.$$mousedown = (e) => {
497
+ setWasOutside(isOutside(e));
498
+ };
499
+ _el$.addEventListener("cancel", (e) => {
500
+ e.preventDefault();
501
+ close();
502
+ });
503
+ const _ref$ = dialog;
504
+ typeof _ref$ === "function" ? use(_ref$, _el$) : dialog = _el$;
505
+ insert(_el$, () => props.children(close));
506
+ createRenderEffect((_p$) => {
507
+ const _v$ = mergeClasses("z-dialog", props.class), _v$2 = props.style;
508
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
509
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
510
+ return _p$;
511
+ }, {
512
+ _v$: void 0,
513
+ _v$2: void 0
514
+ });
515
+ return _el$;
516
+ })();
517
+ }
518
+ delegateEvents(["mousedown", "click"]);
519
+ const _tmpl$$d = /* @__PURE__ */ template(`<div>`), _tmpl$2$4 = /* @__PURE__ */ template(`<label>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
520
+ function Field(props) {
521
+ return (() => {
522
+ const _el$ = _tmpl$$d();
523
+ insert(_el$, (() => {
524
+ const _c$ = createMemo(() => !!props.label);
525
+ return () => _c$() && (() => {
526
+ const _el$2 = _tmpl$2$4();
527
+ insert(_el$2, () => props.label);
528
+ createRenderEffect(() => setAttribute(_el$2, "for", props.id));
529
+ return _el$2;
530
+ })();
531
+ })(), null);
532
+ insert(_el$, () => props.children(() => ({
533
+ id: props.id,
534
+ invalid: !!props.error,
535
+ errorId: props.error ? `${props.id}-error` : void 0
536
+ })), null);
537
+ insert(_el$, (() => {
538
+ const _c$2 = createMemo(() => !!props.error);
539
+ return () => _c$2() && (() => {
540
+ const _el$3 = _tmpl$3$2();
541
+ insert(_el$3, () => props.error);
542
+ createRenderEffect(() => setAttribute(_el$3, "id", `${props.id}-error`));
543
+ return _el$3;
544
+ })();
545
+ })(), null);
546
+ insert(_el$, (() => {
547
+ const _c$3 = createMemo(() => !!(!props.error && props.errorPlaceholder !== false));
548
+ return () => _c$3() && _tmpl$4$1();
549
+ })(), null);
550
+ createRenderEffect((_p$) => {
551
+ const _v$ = mergeClasses("z-field", props.class), _v$2 = props.style;
552
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
553
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
554
+ return _p$;
555
+ }, {
556
+ _v$: void 0,
557
+ _v$2: void 0
558
+ });
559
+ return _el$;
560
+ })();
561
+ }
562
+ const _tmpl$$c = /* @__PURE__ */ template(`<div>`);
563
+ function Form(props) {
564
+ return (() => {
565
+ const _el$ = _tmpl$$c();
566
+ _el$.addEventListener("submit", (event) => {
567
+ event.preventDefault();
568
+ props.onSubmit();
569
+ });
570
+ insert(_el$, () => props.children);
571
+ createRenderEffect((_p$) => {
572
+ const _v$ = props.class, _v$2 = props.style;
573
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
574
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
575
+ return _p$;
576
+ }, {
577
+ _v$: void 0,
578
+ _v$2: void 0
579
+ });
580
+ return _el$;
581
+ })();
582
+ }
583
+ const _tmpl$$b = /* @__PURE__ */ template(`<header><a class="z-header--app" href="/"><span></span></a><div class="z-header--buttons">`);
584
+ function Header(props) {
585
+ return (() => {
586
+ const _el$ = _tmpl$$b(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
587
+ insert(_el$2, () => props.appIcon, _el$3);
588
+ insert(_el$3, () => props.appName);
589
+ insert(_el$4, () => props.children);
590
+ createRenderEffect((_p$) => {
591
+ const _v$ = mergeClasses("z-header", props.class), _v$2 = props.style;
592
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
593
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
594
+ return _p$;
595
+ }, {
596
+ _v$: void 0,
597
+ _v$2: void 0
598
+ });
599
+ return _el$;
600
+ })();
601
+ }
602
+ const _tmpl$$a = /* @__PURE__ */ template(`<h1>`), _tmpl$2$3 = /* @__PURE__ */ template(`<h2>`), _tmpl$3$1 = /* @__PURE__ */ template(`<h3>`);
603
+ function H1(props) {
604
+ return (() => {
605
+ const _el$ = _tmpl$$a();
606
+ insert(_el$, () => props.children);
607
+ createRenderEffect((_p$) => {
608
+ const _v$ = mergeClasses("z-" + (props.lookLike ?? "h1"), props.class), _v$2 = props.style;
609
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
610
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
611
+ return _p$;
612
+ }, {
613
+ _v$: void 0,
614
+ _v$2: void 0
615
+ });
616
+ return _el$;
617
+ })();
618
+ }
619
+ function H2(props) {
620
+ return (() => {
621
+ const _el$2 = _tmpl$2$3();
622
+ insert(_el$2, () => props.children);
623
+ createRenderEffect((_p$) => {
624
+ const _v$3 = mergeClasses("z-" + (props.lookLike ?? "h2"), props.class), _v$4 = props.style;
625
+ _v$3 !== _p$._v$3 && className(_el$2, _p$._v$3 = _v$3);
626
+ _p$._v$4 = style(_el$2, _v$4, _p$._v$4);
627
+ return _p$;
628
+ }, {
629
+ _v$3: void 0,
630
+ _v$4: void 0
631
+ });
632
+ return _el$2;
633
+ })();
634
+ }
635
+ function H3(props) {
636
+ return (() => {
637
+ const _el$3 = _tmpl$3$1();
638
+ insert(_el$3, () => props.children);
639
+ createRenderEffect((_p$) => {
640
+ const _v$5 = mergeClasses("z-" + (props.lookLike ?? "h3"), props.class), _v$6 = props.style;
641
+ _v$5 !== _p$._v$5 && className(_el$3, _p$._v$5 = _v$5);
642
+ _p$._v$6 = style(_el$3, _v$6, _p$._v$6);
643
+ return _p$;
644
+ }, {
645
+ _v$5: void 0,
646
+ _v$6: void 0
647
+ });
648
+ return _el$3;
649
+ })();
650
+ }
651
+ const _tmpl$$9 = /* @__PURE__ */ template(`<svg>`), _tmpl$2$2 = /* @__PURE__ */ template(`<svg><path fill="currentColor"></svg>`, false, true);
652
+ function Icon(props) {
653
+ const data = createMemo(() => {
654
+ const [width, height, , , paths] = props.definition.icon;
655
+ return {
656
+ width,
657
+ height,
658
+ paths: Array.isArray(paths) ? paths : [paths]
659
+ };
660
+ });
661
+ return (() => {
662
+ const _el$ = _tmpl$$9();
663
+ insert(_el$, createComponent(For, {
664
+ get each() {
665
+ return data().paths;
666
+ },
667
+ children: (path) => (() => {
668
+ const _el$2 = _tmpl$2$2();
669
+ setAttribute(_el$2, "d", path);
670
+ return _el$2;
671
+ })()
672
+ }));
673
+ createRenderEffect((_p$) => {
674
+ const _v$ = props.class, _v$2 = props.style, _v$3 = `0 0 ${data().width} ${data().height}`;
675
+ _v$ !== _p$._v$ && setAttribute(_el$, "class", _p$._v$ = _v$);
676
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
677
+ _v$3 !== _p$._v$3 && setAttribute(_el$, "viewBox", _p$._v$3 = _v$3);
678
+ return _p$;
679
+ }, {
680
+ _v$: void 0,
681
+ _v$2: void 0,
682
+ _v$3: void 0
683
+ });
684
+ return _el$;
685
+ })();
686
+ }
687
+ const _tmpl$$8 = /* @__PURE__ */ template(`<button>`);
688
+ function IconButton(props) {
689
+ return (() => {
690
+ const _el$ = _tmpl$$8();
691
+ _el$.$$click = () => !props.busy && props.onClick();
692
+ insert(_el$, () => props.icon);
693
+ createRenderEffect((_p$) => {
694
+ const _v$ = mergeClasses(`z-button z-button--icon z-button--${props.type}`, props.class), _v$2 = props.style, _v$3 = props.busy, _v$4 = props.label, _v$5 = props.label;
695
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
696
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
697
+ _v$3 !== _p$._v$3 && setAttribute(_el$, "aria-busy", _p$._v$3 = _v$3);
698
+ _v$4 !== _p$._v$4 && setAttribute(_el$, "aria-label", _p$._v$4 = _v$4);
699
+ _v$5 !== _p$._v$5 && setAttribute(_el$, "title", _p$._v$5 = _v$5);
700
+ return _p$;
701
+ }, {
702
+ _v$: void 0,
703
+ _v$2: void 0,
704
+ _v$3: void 0,
705
+ _v$4: void 0,
706
+ _v$5: void 0
707
+ });
708
+ return _el$;
709
+ })();
710
+ }
711
+ delegateEvents(["click"]);
712
+ function Link(props) {
713
+ return createComponent(A, {
714
+ get ["class"]() {
715
+ return mergeClasses("z-link", props.class);
716
+ },
717
+ get style() {
718
+ return props.style;
719
+ },
720
+ activeClass: "",
721
+ inactiveClass: "",
722
+ get href() {
723
+ return props.href;
724
+ },
725
+ end: true,
726
+ get children() {
727
+ return props.children;
728
+ }
729
+ });
730
+ }
731
+ const _tmpl$$7 = /* @__PURE__ */ template(`<nav>`);
732
+ function Nav(props) {
733
+ return (() => {
734
+ const _el$ = _tmpl$$7();
735
+ insert(_el$, () => props.children);
736
+ createRenderEffect((_p$) => {
737
+ const _v$ = mergeClasses("z-nav", props.class), _v$2 = props.style;
738
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
739
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
740
+ return _p$;
741
+ }, {
742
+ _v$: void 0,
743
+ _v$2: void 0
744
+ });
745
+ return _el$;
746
+ })();
747
+ }
748
+ const _tmpl$$6 = /* @__PURE__ */ template(`<div>`);
749
+ function NavHeader(props) {
750
+ return (() => {
751
+ const _el$ = _tmpl$$6();
752
+ insert(_el$, () => props.children);
753
+ createRenderEffect((_p$) => {
754
+ const _v$ = mergeClasses("z-nav--header", props.class), _v$2 = props.style;
755
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
756
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
757
+ return _p$;
758
+ }, {
759
+ _v$: void 0,
760
+ _v$2: void 0
761
+ });
762
+ return _el$;
763
+ })();
764
+ }
765
+ const _tmpl$$5 = /* @__PURE__ */ template(`<span>`);
766
+ function NavLink(props) {
767
+ return createComponent(A, {
768
+ get ["class"]() {
769
+ return mergeClasses("z-nav--link", props.class);
770
+ },
771
+ get style() {
772
+ return props.style;
773
+ },
774
+ activeClass: "z-nav--link-active",
775
+ inactiveClass: "",
776
+ get href() {
777
+ return props.href;
778
+ },
779
+ end: true,
780
+ get children() {
781
+ return [createMemo(() => props.icon), (() => {
782
+ const _el$ = _tmpl$$5();
783
+ insert(_el$, () => props.text);
784
+ return _el$;
785
+ })()];
786
+ }
787
+ });
788
+ }
789
+ const _tmpl$$4 = /* @__PURE__ */ template(`<fieldset><legend>`), _tmpl$2$1 = /* @__PURE__ */ template(`<div class="z-radiobutton"><input type="radio"><label>`), _tmpl$3 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
790
+ function RadioButtons(props) {
791
+ return (() => {
792
+ const _el$ = _tmpl$$4(), _el$2 = _el$.firstChild;
793
+ insert(_el$2, () => props.label);
794
+ insert(_el$, createComponent(For, {
795
+ get each() {
796
+ return props.options;
797
+ },
798
+ children: (option, index) => (() => {
799
+ const _el$3 = _tmpl$2$1(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
800
+ _el$4.addEventListener("change", () => props.onChange(option.value));
801
+ insert(_el$5, () => option.label);
802
+ createRenderEffect((_p$) => {
803
+ const _v$3 = props.id, _v$4 = `${props.id}-${index()}`, _v$5 = !!props.error, _v$6 = props.error ? `${props.id}-error` : void 0, _v$7 = `${props.id}-${index()}`;
804
+ _v$3 !== _p$._v$3 && setAttribute(_el$4, "name", _p$._v$3 = _v$3);
805
+ _v$4 !== _p$._v$4 && setAttribute(_el$4, "id", _p$._v$4 = _v$4);
806
+ _v$5 !== _p$._v$5 && setAttribute(_el$4, "aria-invalid", _p$._v$5 = _v$5);
807
+ _v$6 !== _p$._v$6 && setAttribute(_el$4, "aria-errormessage", _p$._v$6 = _v$6);
808
+ _v$7 !== _p$._v$7 && setAttribute(_el$5, "for", _p$._v$7 = _v$7);
809
+ return _p$;
810
+ }, {
811
+ _v$3: void 0,
812
+ _v$4: void 0,
813
+ _v$5: void 0,
814
+ _v$6: void 0,
815
+ _v$7: void 0
816
+ });
817
+ createRenderEffect(() => _el$4.checked = option.value === props.value);
818
+ return _el$3;
819
+ })()
820
+ }), null);
821
+ insert(_el$, (() => {
822
+ const _c$ = createMemo(() => !!props.error);
823
+ return () => _c$() && (() => {
824
+ const _el$6 = _tmpl$3();
825
+ insert(_el$6, () => props.error);
826
+ createRenderEffect(() => setAttribute(_el$6, "id", `${props.id}-error`));
827
+ return _el$6;
828
+ })();
829
+ })(), null);
830
+ insert(_el$, (() => {
831
+ const _c$2 = createMemo(() => !!(!props.error && props.errorPlaceholder !== false));
832
+ return () => _c$2() && _tmpl$4();
833
+ })(), null);
834
+ createRenderEffect((_p$) => {
835
+ const _v$ = mergeClasses("z-fieldset", props.class), _v$2 = props.style;
836
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
837
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
838
+ return _p$;
839
+ }, {
840
+ _v$: void 0,
841
+ _v$2: void 0
842
+ });
843
+ return _el$;
844
+ })();
845
+ }
846
+ const _tmpl$$3 = /* @__PURE__ */ template(`<div>`);
847
+ function Row(props) {
848
+ return (() => {
849
+ const _el$ = _tmpl$$3();
850
+ insert(_el$, () => props.children);
851
+ createRenderEffect((_p$) => {
852
+ const _v$ = mergeClasses("z-row", props.class), _v$2 = props.style;
853
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
854
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
855
+ return _p$;
856
+ }, {
857
+ _v$: void 0,
858
+ _v$2: void 0
859
+ });
860
+ return _el$;
861
+ })();
862
+ }
863
+ const _tmpl$$2 = /* @__PURE__ */ template(`<select>`), _tmpl$2 = /* @__PURE__ */ template(`<option>`);
864
+ function Select(props) {
865
+ return (() => {
866
+ const _el$ = _tmpl$$2();
867
+ _el$.addEventListener("change", (e) => {
868
+ const option = props.options[Number(e.target.value)];
869
+ props.onChange(option.value);
870
+ });
871
+ insert(_el$, createComponent(For, {
872
+ get each() {
873
+ return props.options;
874
+ },
875
+ children: (option, index) => (() => {
876
+ const _el$2 = _tmpl$2();
877
+ insert(_el$2, () => option.label);
878
+ createRenderEffect(() => _el$2.value = index());
879
+ return _el$2;
880
+ })()
881
+ }));
882
+ createRenderEffect((_p$) => {
883
+ const _v$ = mergeClasses("z-select", props.class), _v$2 = props.style, _v$3 = props.id, _v$4 = props.invalid, _v$5 = props.errorId;
884
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
885
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
886
+ _v$3 !== _p$._v$3 && setAttribute(_el$, "id", _p$._v$3 = _v$3);
887
+ _v$4 !== _p$._v$4 && setAttribute(_el$, "aria-invalid", _p$._v$4 = _v$4);
888
+ _v$5 !== _p$._v$5 && setAttribute(_el$, "aria-errormessage", _p$._v$5 = _v$5);
889
+ return _p$;
890
+ }, {
891
+ _v$: void 0,
892
+ _v$2: void 0,
893
+ _v$3: void 0,
894
+ _v$4: void 0,
895
+ _v$5: void 0
896
+ });
897
+ createRenderEffect(() => _el$.value = props.options.findIndex((it) => it.value === props.value));
898
+ return _el$;
899
+ })();
900
+ }
901
+ const _tmpl$$1 = /* @__PURE__ */ template(`<div>`);
902
+ function Spinner(props) {
903
+ return (() => {
904
+ const _el$ = _tmpl$$1();
905
+ createRenderEffect((_p$) => {
906
+ const _v$ = mergeClasses(`z-spinner z-spinner--${props.size ?? "normal"}`, props.class), _v$2 = props.style;
907
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
908
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
909
+ return _p$;
910
+ }, {
911
+ _v$: void 0,
912
+ _v$2: void 0
913
+ });
914
+ return _el$;
915
+ })();
916
+ }
917
+ const _tmpl$ = /* @__PURE__ */ template(`<input>`);
918
+ function TextBox(props) {
919
+ return (() => {
920
+ const _el$ = _tmpl$();
921
+ _el$.$$input = (e) => props.onChange(e.target.value);
922
+ createRenderEffect((_p$) => {
923
+ const _v$ = mergeClasses("z-textbox", props.class), _v$2 = props.style, _v$3 = props.hidden ? "password" : "text", _v$4 = props.id, _v$5 = props.invalid, _v$6 = props.errorId;
924
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
925
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
926
+ _v$3 !== _p$._v$3 && setAttribute(_el$, "type", _p$._v$3 = _v$3);
927
+ _v$4 !== _p$._v$4 && setAttribute(_el$, "id", _p$._v$4 = _v$4);
928
+ _v$5 !== _p$._v$5 && setAttribute(_el$, "aria-invalid", _p$._v$5 = _v$5);
929
+ _v$6 !== _p$._v$6 && setAttribute(_el$, "aria-errormessage", _p$._v$6 = _v$6);
930
+ return _p$;
931
+ }, {
932
+ _v$: void 0,
933
+ _v$2: void 0,
934
+ _v$3: void 0,
935
+ _v$4: void 0,
936
+ _v$5: void 0,
937
+ _v$6: void 0
938
+ });
939
+ createRenderEffect(() => _el$.value = props.value);
940
+ return _el$;
941
+ })();
942
+ }
943
+ delegateEvents(["input"]);
944
+ export {
945
+ App,
946
+ Button,
947
+ Card,
948
+ CheckBox,
949
+ CheckBoxes,
950
+ Column,
951
+ Dialog,
952
+ Field,
953
+ Form,
954
+ H1,
955
+ H2,
956
+ H3,
957
+ Header,
958
+ Icon,
959
+ IconButton,
960
+ Link,
961
+ Nav,
962
+ NavHeader,
963
+ NavLink,
964
+ RadioButtons,
965
+ Row,
966
+ Select,
967
+ Spinner,
968
+ TextBox
969
+ };