@vertz/ui-primitives 0.2.0 → 0.2.2
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.d.ts +123 -86
- package/dist/index.js +563 -198
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -222,8 +222,261 @@ var Accordion = {
|
|
|
222
222
|
return { root, state, Item };
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
// src/
|
|
225
|
+
// src/alert-dialog/alert-dialog.tsx
|
|
226
|
+
import { __element, __on } from "@vertz/ui/internals";
|
|
226
227
|
import { signal as signal2 } from "@vertz/ui";
|
|
228
|
+
|
|
229
|
+
// src/utils/focus.ts
|
|
230
|
+
var FOCUSABLE_SELECTOR = [
|
|
231
|
+
"a[href]",
|
|
232
|
+
"button:not([disabled])",
|
|
233
|
+
"input:not([disabled])",
|
|
234
|
+
"select:not([disabled])",
|
|
235
|
+
"textarea:not([disabled])",
|
|
236
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
237
|
+
"[contenteditable]"
|
|
238
|
+
].join(", ");
|
|
239
|
+
function getFocusableElements(container) {
|
|
240
|
+
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
241
|
+
}
|
|
242
|
+
function trapFocus(container) {
|
|
243
|
+
function handleKeyDown(event) {
|
|
244
|
+
if (event.key !== "Tab")
|
|
245
|
+
return;
|
|
246
|
+
const focusable = getFocusableElements(container);
|
|
247
|
+
if (focusable.length === 0)
|
|
248
|
+
return;
|
|
249
|
+
const first = focusable[0];
|
|
250
|
+
const last = focusable[focusable.length - 1];
|
|
251
|
+
if (!first || !last)
|
|
252
|
+
return;
|
|
253
|
+
if (event.shiftKey) {
|
|
254
|
+
if (document.activeElement === first) {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
last.focus();
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
if (document.activeElement === last) {
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
first.focus();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
container.addEventListener("keydown", handleKeyDown);
|
|
266
|
+
return () => {
|
|
267
|
+
container.removeEventListener("keydown", handleKeyDown);
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function focusFirst(container) {
|
|
271
|
+
const focusable = getFocusableElements(container);
|
|
272
|
+
if (focusable.length > 0) {
|
|
273
|
+
focusable[0]?.focus();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function saveFocus() {
|
|
277
|
+
const previously = document.activeElement;
|
|
278
|
+
return () => {
|
|
279
|
+
if (previously && typeof previously.focus === "function") {
|
|
280
|
+
previously.focus();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function setRovingTabindex(items, activeIndex) {
|
|
285
|
+
for (let i = 0;i < items.length; i++) {
|
|
286
|
+
items[i]?.setAttribute("tabindex", i === activeIndex ? "0" : "-1");
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/alert-dialog/alert-dialog.tsx
|
|
291
|
+
function AlertDialogRoot(options = {}) {
|
|
292
|
+
const { defaultOpen = false, onOpenChange, onAction } = options;
|
|
293
|
+
const ids = linkedIds("alertdialog");
|
|
294
|
+
const titleId = `${ids.contentId}-title`;
|
|
295
|
+
const descriptionId = `${ids.contentId}-description`;
|
|
296
|
+
const state = { open: signal2(defaultOpen) };
|
|
297
|
+
let restoreFocus = null;
|
|
298
|
+
let removeTrap = null;
|
|
299
|
+
function show() {
|
|
300
|
+
state.open.value = true;
|
|
301
|
+
setExpanded(trigger, true);
|
|
302
|
+
setHidden(overlay, false);
|
|
303
|
+
setHidden(content, false);
|
|
304
|
+
setDataState(trigger, "open");
|
|
305
|
+
setDataState(overlay, "open");
|
|
306
|
+
setDataState(content, "open");
|
|
307
|
+
restoreFocus = saveFocus();
|
|
308
|
+
removeTrap = trapFocus(content);
|
|
309
|
+
queueMicrotask(() => cancel.focus());
|
|
310
|
+
onOpenChange?.(true);
|
|
311
|
+
}
|
|
312
|
+
function hide() {
|
|
313
|
+
state.open.value = false;
|
|
314
|
+
setExpanded(trigger, false);
|
|
315
|
+
setDataState(trigger, "closed");
|
|
316
|
+
setDataState(overlay, "closed");
|
|
317
|
+
setDataState(content, "closed");
|
|
318
|
+
setHiddenAnimated(overlay, true);
|
|
319
|
+
setHiddenAnimated(content, true);
|
|
320
|
+
removeTrap?.();
|
|
321
|
+
removeTrap = null;
|
|
322
|
+
restoreFocus?.();
|
|
323
|
+
restoreFocus = null;
|
|
324
|
+
onOpenChange?.(false);
|
|
325
|
+
}
|
|
326
|
+
const trigger = (() => {
|
|
327
|
+
const __el0 = __element("button");
|
|
328
|
+
__el0.setAttribute("type", "button");
|
|
329
|
+
{
|
|
330
|
+
const __v = ids.triggerId;
|
|
331
|
+
if (__v != null && __v !== false)
|
|
332
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
333
|
+
}
|
|
334
|
+
{
|
|
335
|
+
const __v = ids.contentId;
|
|
336
|
+
if (__v != null && __v !== false)
|
|
337
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
338
|
+
}
|
|
339
|
+
{
|
|
340
|
+
const __v = defaultOpen ? "true" : "false";
|
|
341
|
+
if (__v != null && __v !== false)
|
|
342
|
+
__el0.setAttribute("aria-expanded", __v === true ? "" : __v);
|
|
343
|
+
}
|
|
344
|
+
{
|
|
345
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
346
|
+
if (__v != null && __v !== false)
|
|
347
|
+
__el0.setAttribute("data-state", __v === true ? "" : __v);
|
|
348
|
+
}
|
|
349
|
+
__on(__el0, "click", () => {
|
|
350
|
+
if (!state.open.peek())
|
|
351
|
+
show();
|
|
352
|
+
});
|
|
353
|
+
return __el0;
|
|
354
|
+
})();
|
|
355
|
+
const overlay = (() => {
|
|
356
|
+
const __el1 = __element("div");
|
|
357
|
+
__el1.setAttribute("data-alertdialog-overlay", "");
|
|
358
|
+
{
|
|
359
|
+
const __v = defaultOpen ? "false" : "true";
|
|
360
|
+
if (__v != null && __v !== false)
|
|
361
|
+
__el1.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
362
|
+
}
|
|
363
|
+
{
|
|
364
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
365
|
+
if (__v != null && __v !== false)
|
|
366
|
+
__el1.setAttribute("data-state", __v === true ? "" : __v);
|
|
367
|
+
}
|
|
368
|
+
{
|
|
369
|
+
const __v = defaultOpen ? "" : "display: none";
|
|
370
|
+
if (__v != null && __v !== false)
|
|
371
|
+
__el1.setAttribute("style", __v === true ? "" : __v);
|
|
372
|
+
}
|
|
373
|
+
return __el1;
|
|
374
|
+
})();
|
|
375
|
+
const content = (() => {
|
|
376
|
+
const __el2 = __element("div");
|
|
377
|
+
__el2.setAttribute("role", "alertdialog");
|
|
378
|
+
{
|
|
379
|
+
const __v = ids.contentId;
|
|
380
|
+
if (__v != null && __v !== false)
|
|
381
|
+
__el2.setAttribute("id", __v === true ? "" : __v);
|
|
382
|
+
}
|
|
383
|
+
__el2.setAttribute("aria-modal", "true");
|
|
384
|
+
{
|
|
385
|
+
const __v = titleId;
|
|
386
|
+
if (__v != null && __v !== false)
|
|
387
|
+
__el2.setAttribute("aria-labelledby", __v === true ? "" : __v);
|
|
388
|
+
}
|
|
389
|
+
{
|
|
390
|
+
const __v = descriptionId;
|
|
391
|
+
if (__v != null && __v !== false)
|
|
392
|
+
__el2.setAttribute("aria-describedby", __v === true ? "" : __v);
|
|
393
|
+
}
|
|
394
|
+
{
|
|
395
|
+
const __v = defaultOpen ? "false" : "true";
|
|
396
|
+
if (__v != null && __v !== false)
|
|
397
|
+
__el2.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
398
|
+
}
|
|
399
|
+
{
|
|
400
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
401
|
+
if (__v != null && __v !== false)
|
|
402
|
+
__el2.setAttribute("data-state", __v === true ? "" : __v);
|
|
403
|
+
}
|
|
404
|
+
{
|
|
405
|
+
const __v = defaultOpen ? "" : "display: none";
|
|
406
|
+
if (__v != null && __v !== false)
|
|
407
|
+
__el2.setAttribute("style", __v === true ? "" : __v);
|
|
408
|
+
}
|
|
409
|
+
return __el2;
|
|
410
|
+
})();
|
|
411
|
+
const title = (() => {
|
|
412
|
+
const __el3 = __element("h2");
|
|
413
|
+
{
|
|
414
|
+
const __v = titleId;
|
|
415
|
+
if (__v != null && __v !== false)
|
|
416
|
+
__el3.setAttribute("id", __v === true ? "" : __v);
|
|
417
|
+
}
|
|
418
|
+
return __el3;
|
|
419
|
+
})();
|
|
420
|
+
const description = (() => {
|
|
421
|
+
const __el4 = __element("p");
|
|
422
|
+
{
|
|
423
|
+
const __v = descriptionId;
|
|
424
|
+
if (__v != null && __v !== false)
|
|
425
|
+
__el4.setAttribute("id", __v === true ? "" : __v);
|
|
426
|
+
}
|
|
427
|
+
return __el4;
|
|
428
|
+
})();
|
|
429
|
+
const cancel = (() => {
|
|
430
|
+
const __el5 = __element("button");
|
|
431
|
+
__el5.setAttribute("type", "button");
|
|
432
|
+
__on(__el5, "click", () => hide());
|
|
433
|
+
return __el5;
|
|
434
|
+
})();
|
|
435
|
+
const action = (() => {
|
|
436
|
+
const __el6 = __element("button");
|
|
437
|
+
__el6.setAttribute("type", "button");
|
|
438
|
+
__on(__el6, "click", () => {
|
|
439
|
+
onAction?.();
|
|
440
|
+
hide();
|
|
441
|
+
});
|
|
442
|
+
return __el6;
|
|
443
|
+
})();
|
|
444
|
+
if (defaultOpen) {
|
|
445
|
+
restoreFocus = saveFocus();
|
|
446
|
+
removeTrap = trapFocus(content);
|
|
447
|
+
queueMicrotask(() => cancel.focus());
|
|
448
|
+
}
|
|
449
|
+
return { trigger, overlay, content, title, description, cancel, action, state, show, hide };
|
|
450
|
+
}
|
|
451
|
+
var AlertDialog = {
|
|
452
|
+
Root: AlertDialogRoot
|
|
453
|
+
};
|
|
454
|
+
// src/badge/badge.tsx
|
|
455
|
+
import { __element as __element2 } from "@vertz/ui/internals";
|
|
456
|
+
function BadgeRoot(options = {}) {
|
|
457
|
+
const { variant = "default" } = options;
|
|
458
|
+
const badge = (() => {
|
|
459
|
+
const __el0 = __element2("span");
|
|
460
|
+
{
|
|
461
|
+
const __v = uniqueId("badge");
|
|
462
|
+
if (__v != null && __v !== false)
|
|
463
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
464
|
+
}
|
|
465
|
+
__el0.setAttribute("data-slot", "badge");
|
|
466
|
+
{
|
|
467
|
+
const __v = variant;
|
|
468
|
+
if (__v != null && __v !== false)
|
|
469
|
+
__el0.setAttribute("data-variant", __v === true ? "" : __v);
|
|
470
|
+
}
|
|
471
|
+
return __el0;
|
|
472
|
+
})();
|
|
473
|
+
return { badge };
|
|
474
|
+
}
|
|
475
|
+
var Badge = {
|
|
476
|
+
Root: BadgeRoot
|
|
477
|
+
};
|
|
478
|
+
// src/button/button.ts
|
|
479
|
+
import { signal as signal3 } from "@vertz/ui";
|
|
227
480
|
function createButtonRoot(state, options) {
|
|
228
481
|
const el = document.createElement("button");
|
|
229
482
|
el.setAttribute("type", "button");
|
|
@@ -256,15 +509,15 @@ function createButtonRoot(state, options) {
|
|
|
256
509
|
var Button = {
|
|
257
510
|
Root(options = {}) {
|
|
258
511
|
const state = {
|
|
259
|
-
disabled:
|
|
260
|
-
pressed:
|
|
512
|
+
disabled: signal3(options.disabled ?? false),
|
|
513
|
+
pressed: signal3(false)
|
|
261
514
|
};
|
|
262
515
|
const root = createButtonRoot(state, options);
|
|
263
516
|
return { root, state };
|
|
264
517
|
}
|
|
265
518
|
};
|
|
266
519
|
// src/calendar/calendar.ts
|
|
267
|
-
import { signal as
|
|
520
|
+
import { signal as signal4 } from "@vertz/ui";
|
|
268
521
|
var MONTH_NAMES = [
|
|
269
522
|
"January",
|
|
270
523
|
"February",
|
|
@@ -303,9 +556,9 @@ var Calendar = {
|
|
|
303
556
|
const weekStartsOn = options.weekStartsOn ?? 0;
|
|
304
557
|
const mode = options.mode ?? "single";
|
|
305
558
|
const state = {
|
|
306
|
-
value:
|
|
307
|
-
focusedDate:
|
|
308
|
-
displayMonth:
|
|
559
|
+
value: signal4(options.defaultValue ?? null),
|
|
560
|
+
focusedDate: signal4(defaultMonth),
|
|
561
|
+
displayMonth: signal4(defaultMonth)
|
|
309
562
|
};
|
|
310
563
|
const root = document.createElement("div");
|
|
311
564
|
const header = document.createElement("div");
|
|
@@ -529,13 +782,13 @@ var Calendar = {
|
|
|
529
782
|
}
|
|
530
783
|
};
|
|
531
784
|
// src/carousel/carousel.ts
|
|
532
|
-
import { signal as
|
|
785
|
+
import { signal as signal5 } from "@vertz/ui";
|
|
533
786
|
var Carousel = {
|
|
534
787
|
Root(options = {}) {
|
|
535
788
|
const { orientation = "horizontal", loop = false, defaultIndex = 0, onSlideChange } = options;
|
|
536
789
|
const state = {
|
|
537
|
-
currentIndex:
|
|
538
|
-
slideCount:
|
|
790
|
+
currentIndex: signal5(defaultIndex),
|
|
791
|
+
slideCount: signal5(0)
|
|
539
792
|
};
|
|
540
793
|
const slides = [];
|
|
541
794
|
const root = document.createElement("div");
|
|
@@ -619,7 +872,7 @@ var Carousel = {
|
|
|
619
872
|
}
|
|
620
873
|
};
|
|
621
874
|
// src/checkbox/checkbox.ts
|
|
622
|
-
import { signal as
|
|
875
|
+
import { signal as signal6 } from "@vertz/ui";
|
|
623
876
|
function dataStateFor(checked) {
|
|
624
877
|
if (checked === "mixed")
|
|
625
878
|
return "indeterminate";
|
|
@@ -629,8 +882,8 @@ var Checkbox = {
|
|
|
629
882
|
Root(options = {}) {
|
|
630
883
|
const { defaultChecked = false, disabled = false, onCheckedChange } = options;
|
|
631
884
|
const state = {
|
|
632
|
-
checked:
|
|
633
|
-
disabled:
|
|
885
|
+
checked: signal6(defaultChecked),
|
|
886
|
+
disabled: signal6(disabled)
|
|
634
887
|
};
|
|
635
888
|
const root = document.createElement("button");
|
|
636
889
|
root.setAttribute("type", "button");
|
|
@@ -663,14 +916,14 @@ var Checkbox = {
|
|
|
663
916
|
}
|
|
664
917
|
};
|
|
665
918
|
// src/collapsible/collapsible.ts
|
|
666
|
-
import { signal as
|
|
919
|
+
import { signal as signal7 } from "@vertz/ui";
|
|
667
920
|
var Collapsible = {
|
|
668
921
|
Root(options = {}) {
|
|
669
922
|
const { defaultOpen = false, disabled = false, onOpenChange } = options;
|
|
670
923
|
const ids = linkedIds("collapsible");
|
|
671
924
|
const state = {
|
|
672
|
-
open:
|
|
673
|
-
disabled:
|
|
925
|
+
open: signal7(defaultOpen),
|
|
926
|
+
disabled: signal7(disabled)
|
|
674
927
|
};
|
|
675
928
|
const root = document.createElement("div");
|
|
676
929
|
const trigger = document.createElement("button");
|
|
@@ -712,16 +965,16 @@ var Collapsible = {
|
|
|
712
965
|
}
|
|
713
966
|
};
|
|
714
967
|
// src/combobox/combobox.ts
|
|
715
|
-
import { signal as
|
|
968
|
+
import { signal as signal8 } from "@vertz/ui";
|
|
716
969
|
var Combobox = {
|
|
717
970
|
Root(options = {}) {
|
|
718
971
|
const { defaultValue = "", onValueChange, onInputChange } = options;
|
|
719
972
|
const ids = linkedIds("combobox");
|
|
720
973
|
const state = {
|
|
721
|
-
open:
|
|
722
|
-
value:
|
|
723
|
-
inputValue:
|
|
724
|
-
activeIndex:
|
|
974
|
+
open: signal8(false),
|
|
975
|
+
value: signal8(defaultValue),
|
|
976
|
+
inputValue: signal8(defaultValue),
|
|
977
|
+
activeIndex: signal8(-1)
|
|
725
978
|
};
|
|
726
979
|
const optionElements = [];
|
|
727
980
|
const input = document.createElement("input");
|
|
@@ -843,14 +1096,14 @@ var Combobox = {
|
|
|
843
1096
|
}
|
|
844
1097
|
};
|
|
845
1098
|
// src/command/command.ts
|
|
846
|
-
import { signal as
|
|
1099
|
+
import { signal as signal9 } from "@vertz/ui";
|
|
847
1100
|
var Command = {
|
|
848
1101
|
Root(options = {}) {
|
|
849
1102
|
const { filter: customFilter, onSelect, onInputChange, placeholder } = options;
|
|
850
1103
|
const listId = uniqueId("command-list");
|
|
851
1104
|
const state = {
|
|
852
|
-
inputValue:
|
|
853
|
-
activeIndex:
|
|
1105
|
+
inputValue: signal9(""),
|
|
1106
|
+
activeIndex: signal9(0)
|
|
854
1107
|
};
|
|
855
1108
|
const allItems = [];
|
|
856
1109
|
const groups = new Map;
|
|
@@ -1005,7 +1258,7 @@ var Command = {
|
|
|
1005
1258
|
}
|
|
1006
1259
|
};
|
|
1007
1260
|
// src/context-menu/context-menu.ts
|
|
1008
|
-
import { signal as
|
|
1261
|
+
import { signal as signal10 } from "@vertz/ui";
|
|
1009
1262
|
|
|
1010
1263
|
// src/utils/dismiss.ts
|
|
1011
1264
|
function createDismiss(options) {
|
|
@@ -1120,8 +1373,8 @@ var ContextMenu = {
|
|
|
1120
1373
|
Root(options = {}) {
|
|
1121
1374
|
const { onSelect, positioning } = options;
|
|
1122
1375
|
const state = {
|
|
1123
|
-
open:
|
|
1124
|
-
activeIndex:
|
|
1376
|
+
open: signal10(false),
|
|
1377
|
+
activeIndex: signal10(-1)
|
|
1125
1378
|
};
|
|
1126
1379
|
const items = [];
|
|
1127
1380
|
let floatingCleanup = null;
|
|
@@ -1271,78 +1524,15 @@ var ContextMenu = {
|
|
|
1271
1524
|
}
|
|
1272
1525
|
};
|
|
1273
1526
|
// src/date-picker/date-picker.ts
|
|
1274
|
-
import { signal as
|
|
1275
|
-
|
|
1276
|
-
// src/popover/popover.ts
|
|
1277
|
-
import { signal as signal10 } from "@vertz/ui";
|
|
1278
|
-
|
|
1279
|
-
// src/utils/focus.ts
|
|
1280
|
-
var FOCUSABLE_SELECTOR = [
|
|
1281
|
-
"a[href]",
|
|
1282
|
-
"button:not([disabled])",
|
|
1283
|
-
"input:not([disabled])",
|
|
1284
|
-
"select:not([disabled])",
|
|
1285
|
-
"textarea:not([disabled])",
|
|
1286
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
1287
|
-
"[contenteditable]"
|
|
1288
|
-
].join(", ");
|
|
1289
|
-
function getFocusableElements(container) {
|
|
1290
|
-
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
1291
|
-
}
|
|
1292
|
-
function trapFocus(container) {
|
|
1293
|
-
function handleKeyDown(event) {
|
|
1294
|
-
if (event.key !== "Tab")
|
|
1295
|
-
return;
|
|
1296
|
-
const focusable = getFocusableElements(container);
|
|
1297
|
-
if (focusable.length === 0)
|
|
1298
|
-
return;
|
|
1299
|
-
const first = focusable[0];
|
|
1300
|
-
const last = focusable[focusable.length - 1];
|
|
1301
|
-
if (!first || !last)
|
|
1302
|
-
return;
|
|
1303
|
-
if (event.shiftKey) {
|
|
1304
|
-
if (document.activeElement === first) {
|
|
1305
|
-
event.preventDefault();
|
|
1306
|
-
last.focus();
|
|
1307
|
-
}
|
|
1308
|
-
} else {
|
|
1309
|
-
if (document.activeElement === last) {
|
|
1310
|
-
event.preventDefault();
|
|
1311
|
-
first.focus();
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
container.addEventListener("keydown", handleKeyDown);
|
|
1316
|
-
return () => {
|
|
1317
|
-
container.removeEventListener("keydown", handleKeyDown);
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
function focusFirst(container) {
|
|
1321
|
-
const focusable = getFocusableElements(container);
|
|
1322
|
-
if (focusable.length > 0) {
|
|
1323
|
-
focusable[0]?.focus();
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
function saveFocus() {
|
|
1327
|
-
const previously = document.activeElement;
|
|
1328
|
-
return () => {
|
|
1329
|
-
if (previously && typeof previously.focus === "function") {
|
|
1330
|
-
previously.focus();
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
}
|
|
1334
|
-
function setRovingTabindex(items, activeIndex) {
|
|
1335
|
-
for (let i = 0;i < items.length; i++) {
|
|
1336
|
-
items[i]?.setAttribute("tabindex", i === activeIndex ? "0" : "-1");
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1527
|
+
import { signal as signal12 } from "@vertz/ui";
|
|
1339
1528
|
|
|
1340
1529
|
// src/popover/popover.ts
|
|
1530
|
+
import { signal as signal11 } from "@vertz/ui";
|
|
1341
1531
|
var Popover = {
|
|
1342
1532
|
Root(options = {}) {
|
|
1343
1533
|
const { defaultOpen = false, onOpenChange, positioning } = options;
|
|
1344
1534
|
const ids = linkedIds("popover");
|
|
1345
|
-
const state = { open:
|
|
1535
|
+
const state = { open: signal11(defaultOpen) };
|
|
1346
1536
|
let restoreFocus = null;
|
|
1347
1537
|
let floatingCleanup = null;
|
|
1348
1538
|
let dismissCleanup = null;
|
|
@@ -1463,8 +1653,8 @@ var DatePicker = {
|
|
|
1463
1653
|
});
|
|
1464
1654
|
popover.content.appendChild(calendarResult.root);
|
|
1465
1655
|
const state = {
|
|
1466
|
-
open:
|
|
1467
|
-
value:
|
|
1656
|
+
open: signal12(false),
|
|
1657
|
+
value: signal12(defaultValue),
|
|
1468
1658
|
displayMonth: calendarResult.state.displayMonth
|
|
1469
1659
|
};
|
|
1470
1660
|
function updateTriggerText() {
|
|
@@ -1507,13 +1697,13 @@ var DatePicker = {
|
|
|
1507
1697
|
}
|
|
1508
1698
|
};
|
|
1509
1699
|
// src/dialog/dialog.ts
|
|
1510
|
-
import { signal as
|
|
1700
|
+
import { signal as signal13 } from "@vertz/ui";
|
|
1511
1701
|
var Dialog = {
|
|
1512
1702
|
Root(options = {}) {
|
|
1513
1703
|
const { modal = true, defaultOpen = false, onOpenChange } = options;
|
|
1514
1704
|
const ids = linkedIds("dialog");
|
|
1515
1705
|
const titleId = `${ids.contentId}-title`;
|
|
1516
|
-
const state = { open:
|
|
1706
|
+
const state = { open: signal13(defaultOpen) };
|
|
1517
1707
|
let restoreFocus = null;
|
|
1518
1708
|
let removeTrap = null;
|
|
1519
1709
|
const trigger = document.createElement("button");
|
|
@@ -1593,14 +1783,14 @@ var Dialog = {
|
|
|
1593
1783
|
}
|
|
1594
1784
|
};
|
|
1595
1785
|
// src/menu/menu.ts
|
|
1596
|
-
import { signal as
|
|
1786
|
+
import { signal as signal14 } from "@vertz/ui";
|
|
1597
1787
|
var Menu = {
|
|
1598
1788
|
Root(options = {}) {
|
|
1599
1789
|
const { onSelect, positioning } = options;
|
|
1600
1790
|
const ids = linkedIds("menu");
|
|
1601
1791
|
const state = {
|
|
1602
|
-
open:
|
|
1603
|
-
activeIndex:
|
|
1792
|
+
open: signal14(false),
|
|
1793
|
+
activeIndex: signal14(-1)
|
|
1604
1794
|
};
|
|
1605
1795
|
const items = [];
|
|
1606
1796
|
let floatingCleanup = null;
|
|
@@ -1800,12 +1990,12 @@ var DropdownMenu = {
|
|
|
1800
1990
|
}
|
|
1801
1991
|
};
|
|
1802
1992
|
// src/hover-card/hover-card.ts
|
|
1803
|
-
import { signal as
|
|
1993
|
+
import { signal as signal15 } from "@vertz/ui";
|
|
1804
1994
|
var HoverCard = {
|
|
1805
1995
|
Root(options = {}) {
|
|
1806
1996
|
const { openDelay = 700, closeDelay = 300, onOpenChange, positioning } = options;
|
|
1807
1997
|
const contentId = uniqueId("hovercard");
|
|
1808
|
-
const state = { open:
|
|
1998
|
+
const state = { open: signal15(false) };
|
|
1809
1999
|
let openTimeout = null;
|
|
1810
2000
|
let closeTimeout = null;
|
|
1811
2001
|
let floatingCleanup = null;
|
|
@@ -1932,11 +2122,11 @@ var HoverCard = {
|
|
|
1932
2122
|
}
|
|
1933
2123
|
};
|
|
1934
2124
|
// src/menubar/menubar.ts
|
|
1935
|
-
import { signal as
|
|
2125
|
+
import { signal as signal16 } from "@vertz/ui";
|
|
1936
2126
|
var Menubar = {
|
|
1937
2127
|
Root(options = {}) {
|
|
1938
2128
|
const { onSelect, positioning } = options;
|
|
1939
|
-
const state = { activeMenu:
|
|
2129
|
+
const state = { activeMenu: signal16(null) };
|
|
1940
2130
|
const triggers = [];
|
|
1941
2131
|
const menus = new Map;
|
|
1942
2132
|
let floatingCleanup = null;
|
|
@@ -2141,11 +2331,11 @@ var Menubar = {
|
|
|
2141
2331
|
}
|
|
2142
2332
|
};
|
|
2143
2333
|
// src/navigation-menu/navigation-menu.ts
|
|
2144
|
-
import { signal as
|
|
2334
|
+
import { signal as signal17 } from "@vertz/ui";
|
|
2145
2335
|
var NavigationMenu = {
|
|
2146
2336
|
Root(options = {}) {
|
|
2147
2337
|
const { orientation = "horizontal", delayOpen = 200, delayClose = 300 } = options;
|
|
2148
|
-
const state = { activeItem:
|
|
2338
|
+
const state = { activeItem: signal17(null) };
|
|
2149
2339
|
const triggers = [];
|
|
2150
2340
|
const items = new Map;
|
|
2151
2341
|
let openTimeout = null;
|
|
@@ -2289,11 +2479,11 @@ var NavigationMenu = {
|
|
|
2289
2479
|
}
|
|
2290
2480
|
};
|
|
2291
2481
|
// src/progress/progress.ts
|
|
2292
|
-
import { signal as
|
|
2482
|
+
import { signal as signal18 } from "@vertz/ui";
|
|
2293
2483
|
var Progress = {
|
|
2294
2484
|
Root(options = {}) {
|
|
2295
2485
|
const { defaultValue = 0, min = 0, max = 100 } = options;
|
|
2296
|
-
const state = { value:
|
|
2486
|
+
const state = { value: signal18(defaultValue) };
|
|
2297
2487
|
const root = document.createElement("div");
|
|
2298
2488
|
root.setAttribute("role", "progressbar");
|
|
2299
2489
|
root.id = uniqueId("progress");
|
|
@@ -2328,11 +2518,11 @@ var Progress = {
|
|
|
2328
2518
|
}
|
|
2329
2519
|
};
|
|
2330
2520
|
// src/radio/radio.ts
|
|
2331
|
-
import { signal as
|
|
2521
|
+
import { signal as signal19 } from "@vertz/ui";
|
|
2332
2522
|
var Radio = {
|
|
2333
2523
|
Root(options = {}) {
|
|
2334
2524
|
const { defaultValue = "", onValueChange } = options;
|
|
2335
|
-
const state = { value:
|
|
2525
|
+
const state = { value: signal19(defaultValue) };
|
|
2336
2526
|
const items = [];
|
|
2337
2527
|
const itemValues = [];
|
|
2338
2528
|
const root = document.createElement("div");
|
|
@@ -2385,11 +2575,11 @@ var Radio = {
|
|
|
2385
2575
|
}
|
|
2386
2576
|
};
|
|
2387
2577
|
// src/resizable-panel/resizable-panel.ts
|
|
2388
|
-
import { signal as
|
|
2578
|
+
import { signal as signal20 } from "@vertz/ui";
|
|
2389
2579
|
var ResizablePanel = {
|
|
2390
2580
|
Root(options = {}) {
|
|
2391
2581
|
const { orientation = "horizontal", onResize } = options;
|
|
2392
|
-
const state = { sizes:
|
|
2582
|
+
const state = { sizes: signal20([]) };
|
|
2393
2583
|
const panels = [];
|
|
2394
2584
|
const handles = [];
|
|
2395
2585
|
const root = document.createElement("div");
|
|
@@ -2523,13 +2713,13 @@ var ResizablePanel = {
|
|
|
2523
2713
|
}
|
|
2524
2714
|
};
|
|
2525
2715
|
// src/scroll-area/scroll-area.ts
|
|
2526
|
-
import { signal as
|
|
2716
|
+
import { signal as signal21 } from "@vertz/ui";
|
|
2527
2717
|
var ScrollArea = {
|
|
2528
2718
|
Root(options = {}) {
|
|
2529
2719
|
const { orientation = "vertical" } = options;
|
|
2530
2720
|
const state = {
|
|
2531
|
-
scrollTop:
|
|
2532
|
-
scrollLeft:
|
|
2721
|
+
scrollTop: signal21(0),
|
|
2722
|
+
scrollLeft: signal21(0)
|
|
2533
2723
|
};
|
|
2534
2724
|
const root = document.createElement("div");
|
|
2535
2725
|
root.style.position = "relative";
|
|
@@ -2640,15 +2830,15 @@ var ScrollArea = {
|
|
|
2640
2830
|
}
|
|
2641
2831
|
};
|
|
2642
2832
|
// src/select/select.ts
|
|
2643
|
-
import { signal as
|
|
2833
|
+
import { signal as signal22 } from "@vertz/ui";
|
|
2644
2834
|
var Select = {
|
|
2645
2835
|
Root(options = {}) {
|
|
2646
2836
|
const { defaultValue = "", placeholder = "", onValueChange, positioning } = options;
|
|
2647
2837
|
const ids = linkedIds("select");
|
|
2648
2838
|
const state = {
|
|
2649
|
-
open:
|
|
2650
|
-
value:
|
|
2651
|
-
activeIndex:
|
|
2839
|
+
open: signal22(false),
|
|
2840
|
+
value: signal22(defaultValue),
|
|
2841
|
+
activeIndex: signal22(-1)
|
|
2652
2842
|
};
|
|
2653
2843
|
const items = [];
|
|
2654
2844
|
let floatingCleanup = null;
|
|
@@ -2840,8 +3030,162 @@ var Select = {
|
|
|
2840
3030
|
return { trigger, content, state, Item, Group, Separator };
|
|
2841
3031
|
}
|
|
2842
3032
|
};
|
|
3033
|
+
// src/sheet/sheet.tsx
|
|
3034
|
+
import { __element as __element3, __on as __on2 } from "@vertz/ui/internals";
|
|
3035
|
+
import { signal as signal23 } from "@vertz/ui";
|
|
3036
|
+
function SheetRoot(options = {}) {
|
|
3037
|
+
const { side = "right", defaultOpen = false, onOpenChange } = options;
|
|
3038
|
+
const ids = linkedIds("sheet");
|
|
3039
|
+
const state = { open: signal23(defaultOpen) };
|
|
3040
|
+
let restoreFocus = null;
|
|
3041
|
+
let removeTrap = null;
|
|
3042
|
+
function show() {
|
|
3043
|
+
state.open.value = true;
|
|
3044
|
+
setExpanded(trigger, true);
|
|
3045
|
+
setHidden(overlay, false);
|
|
3046
|
+
setHidden(content, false);
|
|
3047
|
+
setDataState(trigger, "open");
|
|
3048
|
+
setDataState(overlay, "open");
|
|
3049
|
+
setDataState(content, "open");
|
|
3050
|
+
restoreFocus = saveFocus();
|
|
3051
|
+
removeTrap = trapFocus(content);
|
|
3052
|
+
queueMicrotask(() => focusFirst(content));
|
|
3053
|
+
onOpenChange?.(true);
|
|
3054
|
+
}
|
|
3055
|
+
function hide() {
|
|
3056
|
+
state.open.value = false;
|
|
3057
|
+
setExpanded(trigger, false);
|
|
3058
|
+
setDataState(trigger, "closed");
|
|
3059
|
+
setDataState(overlay, "closed");
|
|
3060
|
+
setDataState(content, "closed");
|
|
3061
|
+
setHiddenAnimated(overlay, true);
|
|
3062
|
+
setHiddenAnimated(content, true);
|
|
3063
|
+
removeTrap?.();
|
|
3064
|
+
removeTrap = null;
|
|
3065
|
+
restoreFocus?.();
|
|
3066
|
+
restoreFocus = null;
|
|
3067
|
+
onOpenChange?.(false);
|
|
3068
|
+
}
|
|
3069
|
+
const SWIPE_THRESHOLD = 50;
|
|
3070
|
+
let startX = 0;
|
|
3071
|
+
let startY = 0;
|
|
3072
|
+
function handlePointerDown(e) {
|
|
3073
|
+
startX = e.clientX;
|
|
3074
|
+
startY = e.clientY;
|
|
3075
|
+
}
|
|
3076
|
+
function handlePointerUp(e) {
|
|
3077
|
+
if (!state.open.peek())
|
|
3078
|
+
return;
|
|
3079
|
+
const deltaX = e.clientX - startX;
|
|
3080
|
+
const deltaY = e.clientY - startY;
|
|
3081
|
+
const shouldDismiss = side === "right" && deltaX >= SWIPE_THRESHOLD || side === "left" && deltaX <= -SWIPE_THRESHOLD || side === "bottom" && deltaY >= SWIPE_THRESHOLD || side === "top" && deltaY <= -SWIPE_THRESHOLD;
|
|
3082
|
+
if (shouldDismiss) {
|
|
3083
|
+
hide();
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
const trigger = (() => {
|
|
3087
|
+
const __el0 = __element3("button");
|
|
3088
|
+
__el0.setAttribute("type", "button");
|
|
3089
|
+
{
|
|
3090
|
+
const __v = ids.triggerId;
|
|
3091
|
+
if (__v != null && __v !== false)
|
|
3092
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
3093
|
+
}
|
|
3094
|
+
{
|
|
3095
|
+
const __v = ids.contentId;
|
|
3096
|
+
if (__v != null && __v !== false)
|
|
3097
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
3098
|
+
}
|
|
3099
|
+
{
|
|
3100
|
+
const __v = defaultOpen ? "true" : "false";
|
|
3101
|
+
if (__v != null && __v !== false)
|
|
3102
|
+
__el0.setAttribute("aria-expanded", __v === true ? "" : __v);
|
|
3103
|
+
}
|
|
3104
|
+
{
|
|
3105
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
3106
|
+
if (__v != null && __v !== false)
|
|
3107
|
+
__el0.setAttribute("data-state", __v === true ? "" : __v);
|
|
3108
|
+
}
|
|
3109
|
+
__on2(__el0, "click", () => {
|
|
3110
|
+
state.open.peek() ? hide() : show();
|
|
3111
|
+
});
|
|
3112
|
+
return __el0;
|
|
3113
|
+
})();
|
|
3114
|
+
const overlay = (() => {
|
|
3115
|
+
const __el1 = __element3("div");
|
|
3116
|
+
__el1.setAttribute("data-sheet-overlay", "");
|
|
3117
|
+
{
|
|
3118
|
+
const __v = defaultOpen ? "false" : "true";
|
|
3119
|
+
if (__v != null && __v !== false)
|
|
3120
|
+
__el1.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
3121
|
+
}
|
|
3122
|
+
{
|
|
3123
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
3124
|
+
if (__v != null && __v !== false)
|
|
3125
|
+
__el1.setAttribute("data-state", __v === true ? "" : __v);
|
|
3126
|
+
}
|
|
3127
|
+
{
|
|
3128
|
+
const __v = defaultOpen ? "" : "display: none";
|
|
3129
|
+
if (__v != null && __v !== false)
|
|
3130
|
+
__el1.setAttribute("style", __v === true ? "" : __v);
|
|
3131
|
+
}
|
|
3132
|
+
__on2(__el1, "click", () => hide());
|
|
3133
|
+
return __el1;
|
|
3134
|
+
})();
|
|
3135
|
+
const content = (() => {
|
|
3136
|
+
const __el2 = __element3("div");
|
|
3137
|
+
__el2.setAttribute("role", "dialog");
|
|
3138
|
+
__el2.setAttribute("aria-modal", "true");
|
|
3139
|
+
{
|
|
3140
|
+
const __v = ids.contentId;
|
|
3141
|
+
if (__v != null && __v !== false)
|
|
3142
|
+
__el2.setAttribute("id", __v === true ? "" : __v);
|
|
3143
|
+
}
|
|
3144
|
+
{
|
|
3145
|
+
const __v = side;
|
|
3146
|
+
if (__v != null && __v !== false)
|
|
3147
|
+
__el2.setAttribute("data-side", __v === true ? "" : __v);
|
|
3148
|
+
}
|
|
3149
|
+
{
|
|
3150
|
+
const __v = defaultOpen ? "false" : "true";
|
|
3151
|
+
if (__v != null && __v !== false)
|
|
3152
|
+
__el2.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
3153
|
+
}
|
|
3154
|
+
{
|
|
3155
|
+
const __v = defaultOpen ? "open" : "closed";
|
|
3156
|
+
if (__v != null && __v !== false)
|
|
3157
|
+
__el2.setAttribute("data-state", __v === true ? "" : __v);
|
|
3158
|
+
}
|
|
3159
|
+
{
|
|
3160
|
+
const __v = defaultOpen ? "" : "display: none";
|
|
3161
|
+
if (__v != null && __v !== false)
|
|
3162
|
+
__el2.setAttribute("style", __v === true ? "" : __v);
|
|
3163
|
+
}
|
|
3164
|
+
__on2(__el2, "keydown", (event) => {
|
|
3165
|
+
if (isKey(event, Keys.Escape)) {
|
|
3166
|
+
event.preventDefault();
|
|
3167
|
+
event.stopPropagation();
|
|
3168
|
+
hide();
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
__on2(__el2, "pointerdown", handlePointerDown);
|
|
3172
|
+
__on2(__el2, "pointerup", handlePointerUp);
|
|
3173
|
+
return __el2;
|
|
3174
|
+
})();
|
|
3175
|
+
const close = (() => {
|
|
3176
|
+
const __el3 = __element3("button");
|
|
3177
|
+
__el3.setAttribute("type", "button");
|
|
3178
|
+
__el3.setAttribute("aria-label", "Close");
|
|
3179
|
+
__on2(__el3, "click", () => hide());
|
|
3180
|
+
return __el3;
|
|
3181
|
+
})();
|
|
3182
|
+
return { trigger, overlay, content, close, state, show, hide };
|
|
3183
|
+
}
|
|
3184
|
+
var Sheet = {
|
|
3185
|
+
Root: SheetRoot
|
|
3186
|
+
};
|
|
2843
3187
|
// src/slider/slider.ts
|
|
2844
|
-
import { signal as
|
|
3188
|
+
import { signal as signal24 } from "@vertz/ui";
|
|
2845
3189
|
var Slider = {
|
|
2846
3190
|
Root(options = {}) {
|
|
2847
3191
|
const {
|
|
@@ -2853,8 +3197,8 @@ var Slider = {
|
|
|
2853
3197
|
onValueChange
|
|
2854
3198
|
} = options;
|
|
2855
3199
|
const state = {
|
|
2856
|
-
value:
|
|
2857
|
-
disabled:
|
|
3200
|
+
value: signal24(defaultValue),
|
|
3201
|
+
disabled: signal24(disabled)
|
|
2858
3202
|
};
|
|
2859
3203
|
const root = document.createElement("div");
|
|
2860
3204
|
root.id = uniqueId("slider");
|
|
@@ -2941,50 +3285,59 @@ var Slider = {
|
|
|
2941
3285
|
return { root, thumb, track, state };
|
|
2942
3286
|
}
|
|
2943
3287
|
};
|
|
2944
|
-
// src/switch/switch.
|
|
2945
|
-
import { signal as
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
3288
|
+
// src/switch/switch.tsx
|
|
3289
|
+
import { signal as signal25 } from "@vertz/ui";
|
|
3290
|
+
import { __attr, __element as __element4, __on as __on3 } from "@vertz/ui/internals";
|
|
3291
|
+
function SwitchRoot(options = {}) {
|
|
3292
|
+
const { defaultChecked = false, disabled = false, onCheckedChange } = options;
|
|
3293
|
+
const checked = signal25(defaultChecked);
|
|
3294
|
+
function toggle() {
|
|
3295
|
+
if (disabled)
|
|
3296
|
+
return;
|
|
3297
|
+
checked.value = !checked.value;
|
|
3298
|
+
onCheckedChange?.(checked.value);
|
|
3299
|
+
}
|
|
3300
|
+
return (() => {
|
|
3301
|
+
const __el0 = __element4("button");
|
|
3302
|
+
__el0.setAttribute("data-v-id", "SwitchRoot");
|
|
3303
|
+
__el0.setAttribute("type", "button");
|
|
3304
|
+
__el0.setAttribute("role", "switch");
|
|
3305
|
+
{
|
|
3306
|
+
const __v = uniqueId("switch");
|
|
3307
|
+
if (__v != null && __v !== false)
|
|
3308
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
3309
|
+
}
|
|
3310
|
+
__attr(__el0, "aria-checked", () => checked.value ? "true" : "false");
|
|
3311
|
+
__attr(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
|
|
3312
|
+
{
|
|
3313
|
+
const __v = disabled;
|
|
3314
|
+
if (__v != null && __v !== false)
|
|
3315
|
+
__el0.setAttribute("disabled", __v === true ? "" : __v);
|
|
3316
|
+
}
|
|
3317
|
+
{
|
|
3318
|
+
const __v = disabled ? "true" : undefined;
|
|
3319
|
+
if (__v != null && __v !== false)
|
|
3320
|
+
__el0.setAttribute("aria-disabled", __v === true ? "" : __v);
|
|
3321
|
+
}
|
|
3322
|
+
__on3(__el0, "click", toggle);
|
|
3323
|
+
__on3(__el0, "keydown", (e) => {
|
|
3324
|
+
if (isKey(e, Keys.Space)) {
|
|
3325
|
+
e.preventDefault();
|
|
2976
3326
|
toggle();
|
|
2977
3327
|
}
|
|
2978
3328
|
});
|
|
2979
|
-
return
|
|
2980
|
-
}
|
|
3329
|
+
return __el0;
|
|
3330
|
+
})();
|
|
3331
|
+
}
|
|
3332
|
+
var Switch = {
|
|
3333
|
+
Root: SwitchRoot
|
|
2981
3334
|
};
|
|
2982
3335
|
// src/tabs/tabs.ts
|
|
2983
|
-
import { signal as
|
|
3336
|
+
import { signal as signal26 } from "@vertz/ui";
|
|
2984
3337
|
var Tabs = {
|
|
2985
3338
|
Root(options = {}) {
|
|
2986
3339
|
const { defaultValue = "", orientation = "horizontal", onValueChange } = options;
|
|
2987
|
-
const state = { value:
|
|
3340
|
+
const state = { value: signal26(defaultValue) };
|
|
2988
3341
|
const triggers = [];
|
|
2989
3342
|
const panels = [];
|
|
2990
3343
|
const tabValues = [];
|
|
@@ -3061,11 +3414,11 @@ var Tabs = {
|
|
|
3061
3414
|
}
|
|
3062
3415
|
};
|
|
3063
3416
|
// src/toast/toast.ts
|
|
3064
|
-
import { signal as
|
|
3417
|
+
import { signal as signal27 } from "@vertz/ui";
|
|
3065
3418
|
var Toast = {
|
|
3066
3419
|
Root(options = {}) {
|
|
3067
3420
|
const { duration = 5000, politeness = "polite" } = options;
|
|
3068
|
-
const state = { messages:
|
|
3421
|
+
const state = { messages: signal27([]) };
|
|
3069
3422
|
const region = document.createElement("div");
|
|
3070
3423
|
region.setAttribute("role", "status");
|
|
3071
3424
|
region.setAttribute("aria-live", politeness);
|
|
@@ -3103,45 +3456,54 @@ var Toast = {
|
|
|
3103
3456
|
return { region, state, announce, dismiss };
|
|
3104
3457
|
}
|
|
3105
3458
|
};
|
|
3106
|
-
// src/toggle/toggle.
|
|
3107
|
-
import { signal as
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3459
|
+
// src/toggle/toggle.tsx
|
|
3460
|
+
import { signal as signal28 } from "@vertz/ui";
|
|
3461
|
+
import { __attr as __attr2, __element as __element5, __on as __on4 } from "@vertz/ui/internals";
|
|
3462
|
+
function ToggleRoot(options = {}) {
|
|
3463
|
+
const { defaultPressed = false, disabled = false, onPressedChange } = options;
|
|
3464
|
+
const pressed = signal28(defaultPressed);
|
|
3465
|
+
function toggle() {
|
|
3466
|
+
if (disabled)
|
|
3467
|
+
return;
|
|
3468
|
+
pressed.value = !pressed.value;
|
|
3469
|
+
onPressedChange?.(pressed.value);
|
|
3470
|
+
}
|
|
3471
|
+
return (() => {
|
|
3472
|
+
const __el0 = __element5("button");
|
|
3473
|
+
__el0.setAttribute("data-v-id", "ToggleRoot");
|
|
3474
|
+
__el0.setAttribute("type", "button");
|
|
3475
|
+
{
|
|
3476
|
+
const __v = uniqueId("toggle");
|
|
3477
|
+
if (__v != null && __v !== false)
|
|
3478
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
3479
|
+
}
|
|
3480
|
+
__attr2(__el0, "aria-pressed", () => pressed.value ? "true" : "false");
|
|
3481
|
+
__attr2(__el0, "data-state", () => pressed.value ? "on" : "off");
|
|
3482
|
+
{
|
|
3483
|
+
const __v = disabled;
|
|
3484
|
+
if (__v != null && __v !== false)
|
|
3485
|
+
__el0.setAttribute("disabled", __v === true ? "" : __v);
|
|
3486
|
+
}
|
|
3487
|
+
{
|
|
3488
|
+
const __v = disabled ? "true" : undefined;
|
|
3489
|
+
if (__v != null && __v !== false)
|
|
3490
|
+
__el0.setAttribute("aria-disabled", __v === true ? "" : __v);
|
|
3491
|
+
}
|
|
3492
|
+
__on4(__el0, "click", toggle);
|
|
3493
|
+
__on4(__el0, "keydown", (e) => {
|
|
3494
|
+
if (isKey(e, Keys.Space)) {
|
|
3495
|
+
e.preventDefault();
|
|
3137
3496
|
toggle();
|
|
3138
3497
|
}
|
|
3139
3498
|
});
|
|
3140
|
-
return
|
|
3141
|
-
}
|
|
3499
|
+
return __el0;
|
|
3500
|
+
})();
|
|
3501
|
+
}
|
|
3502
|
+
var Toggle = {
|
|
3503
|
+
Root: ToggleRoot
|
|
3142
3504
|
};
|
|
3143
3505
|
// src/toggle-group/toggle-group.ts
|
|
3144
|
-
import { signal as
|
|
3506
|
+
import { signal as signal29 } from "@vertz/ui";
|
|
3145
3507
|
var ToggleGroup = {
|
|
3146
3508
|
Root(options = {}) {
|
|
3147
3509
|
const {
|
|
@@ -3152,8 +3514,8 @@ var ToggleGroup = {
|
|
|
3152
3514
|
onValueChange
|
|
3153
3515
|
} = options;
|
|
3154
3516
|
const state = {
|
|
3155
|
-
value:
|
|
3156
|
-
disabled:
|
|
3517
|
+
value: signal29([...defaultValue]),
|
|
3518
|
+
disabled: signal29(disabled)
|
|
3157
3519
|
};
|
|
3158
3520
|
const items = [];
|
|
3159
3521
|
const root = document.createElement("div");
|
|
@@ -3219,12 +3581,12 @@ var ToggleGroup = {
|
|
|
3219
3581
|
}
|
|
3220
3582
|
};
|
|
3221
3583
|
// src/tooltip/tooltip.ts
|
|
3222
|
-
import { signal as
|
|
3584
|
+
import { signal as signal30 } from "@vertz/ui";
|
|
3223
3585
|
var Tooltip = {
|
|
3224
3586
|
Root(options = {}) {
|
|
3225
3587
|
const { delay = 300, onOpenChange, positioning } = options;
|
|
3226
3588
|
const contentId = uniqueId("tooltip");
|
|
3227
|
-
const state = { open:
|
|
3589
|
+
const state = { open: signal30(false) };
|
|
3228
3590
|
let showTimeout = null;
|
|
3229
3591
|
let floatingCleanup = null;
|
|
3230
3592
|
const trigger = document.createElement("span");
|
|
@@ -3285,6 +3647,7 @@ export {
|
|
|
3285
3647
|
Tabs,
|
|
3286
3648
|
Switch,
|
|
3287
3649
|
Slider,
|
|
3650
|
+
Sheet,
|
|
3288
3651
|
Select,
|
|
3289
3652
|
ScrollArea,
|
|
3290
3653
|
ResizablePanel,
|
|
@@ -3306,5 +3669,7 @@ export {
|
|
|
3306
3669
|
Carousel,
|
|
3307
3670
|
Calendar,
|
|
3308
3671
|
Button,
|
|
3672
|
+
Badge,
|
|
3673
|
+
AlertDialog,
|
|
3309
3674
|
Accordion
|
|
3310
3675
|
};
|