@codbex/harmonia 0.3.1 → 0.4.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/dist/harmonia.js CHANGED
@@ -205,7 +205,6 @@
205
205
  "items-start",
206
206
  "justify-between",
207
207
  "gap-4",
208
- "rounded-md",
209
208
  "py-4",
210
209
  "text-left",
211
210
  "text-sm",
@@ -287,7 +286,7 @@
287
286
  "items-center",
288
287
  "[&>svg]:size-4",
289
288
  "[&>svg]:text-current",
290
- modifiers.includes("floating") ? "shadow-alert" : void 0
289
+ modifiers.includes("floating") ? "shadow-lg" : void 0
291
290
  );
292
291
  el.setAttribute("data-slot", "alert");
293
292
  el.setAttribute("role", "alert");
@@ -339,8 +338,6 @@
339
338
  "bg-secondary",
340
339
  "text-secondary-foreground",
341
340
  "fill-secondary-foreground",
342
- "hover:bg-secondary-hover",
343
- "active:bg-secondary-active",
344
341
  "[[data-slot=toolbar]:not([data-variant=transparent])_&]:border",
345
342
  "has-[img]:border-0",
346
343
  "flex",
@@ -357,6 +354,9 @@
357
354
  el._avatar = Alpine2.reactive({
358
355
  fallback: false
359
356
  });
357
+ if (el.tagName === "BUTTON") {
358
+ el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
359
+ }
360
360
  });
361
361
  Alpine.directive("h-avatar-image", (el, {}, { cleanup }) => {
362
362
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_avatar"));
@@ -474,50 +474,126 @@
474
474
  }
475
475
 
476
476
  // src/components/button.js
477
+ var buttonVariants = {
478
+ default: [
479
+ "bg-secondary",
480
+ "text-secondary-foreground",
481
+ "shadow-control",
482
+ "hover:bg-secondary-hover",
483
+ "active:bg-secondary-active",
484
+ "aria-pressed:bg-secondary-active",
485
+ "active:data-[toggled=true]:bg-secondary-active",
486
+ "hover:data-[toggled=true]:bg-secondary-hover",
487
+ "data-[toggled=true]:bg-secondary-active"
488
+ ],
489
+ primary: [
490
+ "bg-primary",
491
+ "text-primary-foreground",
492
+ "shadow-control",
493
+ "hover:bg-primary-hover",
494
+ "active:bg-primary-active",
495
+ "aria-pressed:bg-primary-active",
496
+ "active:data-[toggled=true]:bg-primary-active",
497
+ "hover:data-[toggled=true]:bg-primary-hover",
498
+ "data-[toggled=true]:bg-primary-active"
499
+ ],
500
+ positive: [
501
+ "bg-positive",
502
+ "text-positive-foreground",
503
+ "shadow-control",
504
+ "hover:bg-positive-hover",
505
+ "active:bg-positive-active",
506
+ "aria-pressed:bg-positive-active",
507
+ "active:data-[toggled=true]:bg-positive-active",
508
+ "hover:data-[toggled=true]:bg-positive-hover",
509
+ "data-[toggled=true]:bg-positive-active"
510
+ ],
511
+ negative: [
512
+ "bg-negative",
513
+ "text-negative-foreground",
514
+ "shadow-control",
515
+ "hover:bg-negative-hover",
516
+ "active:bg-negative-active",
517
+ "aria-pressed:bg-negative-active",
518
+ "active:data-[toggled=true]:bg-negative-active",
519
+ "hover:data-[toggled=true]:bg-negative-hover",
520
+ "data-[toggled=true]:bg-negative-active"
521
+ ],
522
+ warning: [
523
+ "bg-warning",
524
+ "text-warning-foreground",
525
+ "shadow-control",
526
+ "hover:bg-warning-hover",
527
+ "active:bg-warning-active",
528
+ "aria-pressed:bg-warning-active",
529
+ "active:data-[toggled=true]:bg-warning-active",
530
+ "hover:data-[toggled=true]:bg-warning-hover",
531
+ "data-[toggled=true]:bg-warning-active"
532
+ ],
533
+ outline: [
534
+ "border",
535
+ "bg-background",
536
+ "text-foreground",
537
+ "shadow-none",
538
+ "hover:bg-secondary",
539
+ "hover:text-secondary-foreground",
540
+ "active:bg-secondary-active",
541
+ "aria-pressed:bg-secondary-active",
542
+ "active:data-[toggled=true]:bg-secondary-active",
543
+ "hover:data-[toggled=true]:bg-secondary-hover",
544
+ "data-[toggled=true]:bg-secondary-active"
545
+ ],
546
+ transparent: [
547
+ "bg-transparent",
548
+ "text-foreground",
549
+ "shadow-none",
550
+ "hover:bg-secondary",
551
+ "hover:text-secondary-foreground",
552
+ "active:bg-secondary-active",
553
+ "aria-pressed:bg-secondary-active",
554
+ "active:data-[toggled=true]:bg-secondary-active",
555
+ "hover:data-[toggled=true]:bg-secondary-hover",
556
+ "data-[toggled=true]:bg-secondary-active"
557
+ ],
558
+ link: ["text-primary", "underline-offset-4", "hover:underline"]
559
+ };
560
+ var setButtonClasses = (el) => {
561
+ el.classList.add(
562
+ "cursor-pointer",
563
+ "inline-flex",
564
+ "items-center",
565
+ "justify-center",
566
+ "gap-2",
567
+ "whitespace-nowrap",
568
+ "rounded-control",
569
+ "text-sm",
570
+ "font-medium",
571
+ "transition-all",
572
+ "disabled:pointer-events-none",
573
+ "disabled:opacity-50",
574
+ "[&_svg]:pointer-events-none",
575
+ "[&_svg:not([class*='size-'])]:size-4",
576
+ "shrink-0",
577
+ "[&_svg]:shrink-0",
578
+ "outline-none",
579
+ "focus-visible:border-ring",
580
+ "focus-visible:ring-ring/50",
581
+ "focus-visible:ring-[3px]",
582
+ "aria-invalid:ring-negative/20",
583
+ "dark:aria-invalid:ring-negative/40",
584
+ "aria-invalid:border-negative",
585
+ "invalid:ring-negative/20",
586
+ "dark:invalid:ring-negative/40",
587
+ "invalid:border-negative"
588
+ );
589
+ };
477
590
  function button_default(Alpine) {
478
591
  Alpine.directive("h-button", (el, { modifiers }, { cleanup }) => {
479
- el.classList.add(
480
- "cursor-pointer",
481
- "inline-flex",
482
- "items-center",
483
- "justify-center",
484
- "gap-2",
485
- "whitespace-nowrap",
486
- "rounded-control",
487
- "text-sm",
488
- "font-medium",
489
- "transition-all",
490
- "disabled:pointer-events-none",
491
- "disabled:opacity-50",
492
- "[&_svg]:pointer-events-none",
493
- "[&_svg:not([class*='size-'])]:size-4",
494
- "shrink-0",
495
- "[&_svg]:shrink-0",
496
- "outline-none",
497
- "focus-visible:border-ring",
498
- "focus-visible:ring-ring/50",
499
- "focus-visible:ring-[3px]",
500
- "aria-invalid:ring-negative/20",
501
- "dark:aria-invalid:ring-negative/40",
502
- "aria-invalid:border-negative",
503
- "invalid:ring-negative/20",
504
- "dark:invalid:ring-negative/40",
505
- "invalid:border-negative"
506
- );
592
+ setButtonClasses(el);
507
593
  if (!el.hasAttribute("data-slot")) {
508
594
  el.setAttribute("data-slot", "button");
509
595
  }
510
596
  const inGroup = modifiers.includes("group");
511
- const variants = {
512
- default: ["bg-secondary", "text-secondary-foreground", "shadow-control", "hover:bg-secondary-hover", "active:bg-secondary-active", "aria-pressed:bg-secondary-active"],
513
- primary: ["bg-primary", "text-primary-foreground", "shadow-control", "hover:bg-primary-hover", "active:bg-primary-active", "aria-pressed:bg-primary-active"],
514
- positive: ["bg-positive", "text-positive-foreground", "shadow-control", "hover:bg-positive-hover", "active:bg-positive-active", "aria-pressed:bg-positive-active"],
515
- negative: ["bg-negative", "text-negative-foreground", "shadow-control", "hover:bg-negative-hover", "active:bg-negative-active", "aria-pressed:bg-negative-active"],
516
- warning: ["bg-warning", "text-warning-foreground", "shadow-control", "hover:bg-warning-hover", "active:bg-warning-active", "aria-pressed:bg-warning-active"],
517
- outline: ["border", "bg-background", "text-foreground", "shadow-none", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active", "aria-pressed:bg-secondary-active"],
518
- transparent: ["bg-transparent", "text-foreground", "shadow-none", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active", "aria-pressed:bg-secondary-active"],
519
- link: ["text-primary", "underline-offset-4", "hover:underline"]
520
- };
521
597
  const sizes = {
522
598
  default: ["h-9", "px-4", "py-2", "has-[>svg]:px-3"],
523
599
  xs: inGroup ? ["h-6", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2.5"],
@@ -526,22 +602,13 @@
526
602
  "icon-xs": inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"],
527
603
  "icon-sm": inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"],
528
604
  icon: ["size-9"],
529
- "icon-lg": ["size-10"],
530
- "icon-tab": [
531
- "group-data-[orientation=horizontal]/tabs:aspect-square",
532
- "group-data-[orientation=horizontal]/tabs:w-auto",
533
- "group-data-[style=float]/tab-bar:group-data-[orientation=horizontal]/tabs:h-full",
534
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:h-[80%]",
535
- "group-data-[orientation=vertical]/tabs:h-9",
536
- "group-data-[style=float]/tab-bar:group-data-[orientation=vertical]/tabs:w-full",
537
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:w-[80%]"
538
- ]
605
+ "icon-lg": ["size-10"]
539
606
  };
540
607
  function setVariant(variant) {
541
- for (const [_, value] of Object.entries(variants)) {
608
+ for (const [_, value] of Object.entries(buttonVariants)) {
542
609
  el.classList.remove(...value);
543
610
  }
544
- if (variants.hasOwnProperty(variant)) el.classList.add(...variants[variant]);
611
+ if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
545
612
  }
546
613
  function setSize(size3) {
547
614
  if (sizes.hasOwnProperty(size3)) {
@@ -607,10 +674,6 @@
607
674
  }
608
675
  setVariant(el.getAttribute("data-orientation") ?? "horizontal");
609
676
  });
610
- Alpine.directive("h-button-group-text", (el) => {
611
- el.classList.add("bg-muted", "flex", "items-center", "gap-2", "rounded-control", "border", "px-4", "text-sm", "font-medium", "shadow-xs", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
612
- el.setAttribute("data-slot", "button-group-text");
613
- });
614
677
  Alpine.directive("h-button-group-separator", (el) => {
615
678
  el.classList.add("bg-foreground/20", "shrink-0", "[[data-orientation=vertical]_&]:h-px", "[[data-orientation=vertical]_&]:w-full", "h-auto", "w-px", "relative", "!m-0", "self-stretch");
616
679
  el.setAttribute("role", "none");
@@ -2120,7 +2183,7 @@
2120
2183
  let firstDay = 0;
2121
2184
  let minDate = void 0;
2122
2185
  let maxDate = void 0;
2123
- function modelChange() {
2186
+ function modelChange(triggerInput = false) {
2124
2187
  Alpine2.nextTick(() => {
2125
2188
  el.dispatchEvent(new CustomEvent("change", { detail: { date: selected } }));
2126
2189
  });
@@ -2133,23 +2196,27 @@
2133
2196
  }
2134
2197
  if (datepicker) {
2135
2198
  datepicker._datepicker.input.value = formatter.format(selected);
2199
+ datepicker._datepicker.input.setCustomValidity("");
2200
+ if (triggerInput) datepicker._datepicker.input.dispatchEvent(new Event("change", { bubbles: true }));
2136
2201
  } else {
2137
2202
  el.setAttribute("data-invalid", "false");
2138
2203
  }
2139
2204
  }
2140
- if (datepicker) {
2141
- datepicker._datepicker.input.addEventListener("change", () => {
2142
- selected = new Date(datepicker._datepicker.input.value);
2143
- if (isNaN(selected)) {
2144
- console.error(`h-calendar: input value is not a valid date - ${datepicker._datepicker.input.value}`);
2145
- datepicker._datepicker.input.setCustomValidity("Input value is not a valid date.");
2146
- return;
2147
- } else {
2148
- datepicker._datepicker.input.setCustomValidity("");
2149
- }
2205
+ const onInputChange = () => {
2206
+ const newValue = new Date(datepicker._datepicker.input.value);
2207
+ if (isNaN(newValue)) {
2208
+ console.error(`h-calendar: input value is not a valid date - ${datepicker._datepicker.input.value}`);
2209
+ datepicker._datepicker.input.setCustomValidity("Input value is not a valid date.");
2210
+ return;
2211
+ } else if (selected.getTime() !== newValue.getTime()) {
2212
+ selected = newValue;
2150
2213
  modelChange();
2151
2214
  render();
2152
- });
2215
+ }
2216
+ datepicker._datepicker.input.setCustomValidity("");
2217
+ };
2218
+ if (datepicker) {
2219
+ datepicker._datepicker.input.addEventListener("change", onInputChange);
2153
2220
  }
2154
2221
  function checkForModel() {
2155
2222
  if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
@@ -2167,7 +2234,7 @@
2167
2234
  if (event.target.getAttribute("aria-disabled") === "true") return;
2168
2235
  focusedDay = new Date(event.target.dataset.year, event.target.dataset.month, event.target.dataset.day);
2169
2236
  selected = new Date(focusedDay);
2170
- modelChange();
2237
+ modelChange(true);
2171
2238
  render();
2172
2239
  if (datepicker) datepicker._datepicker.expanded = false;
2173
2240
  }
@@ -2330,7 +2397,7 @@
2330
2397
  "align-middle",
2331
2398
  "text-center",
2332
2399
  "size-8",
2333
- "rounded-sm",
2400
+ "rounded-control",
2334
2401
  "outline-none",
2335
2402
  "hover:bg-secondary-hover",
2336
2403
  "hover:text-secondary-foreground",
@@ -2546,6 +2613,9 @@
2546
2613
  for (let d = 0; d < dayCells.length; d++) {
2547
2614
  dayCells[d].removeEventListener("click", dayClick);
2548
2615
  }
2616
+ if (datepicker) {
2617
+ datepicker._datepicker.input.removeEventListener("change", onInputChange);
2618
+ }
2549
2619
  });
2550
2620
  });
2551
2621
  }
@@ -2553,7 +2623,7 @@
2553
2623
  // src/components/card.js
2554
2624
  function card_default(Alpine) {
2555
2625
  Alpine.directive("h-card", (el) => {
2556
- el.classList.add("bg-card", "text-card-foreground", "vbox", "gap-6", "rounded-xl", "border", "py-6", "shadow-sm");
2626
+ el.classList.add("bg-card", "text-card-foreground", "vbox", "gap-4", "rounded-xl", "border", "py-6", "shadow-sm");
2557
2627
  el.setAttribute("data-slot", "card");
2558
2628
  });
2559
2629
  Alpine.directive("h-card-header", (el) => {
@@ -2584,56 +2654,58 @@
2584
2654
 
2585
2655
  // src/components/checkbox.js
2586
2656
  function checkbox_default(Alpine) {
2587
- Alpine.directive("h-checkbox", (el, {}, { cleanup }) => {
2657
+ Alpine.directive("h-checkbox", (el) => {
2588
2658
  el.classList.add(
2589
- "appearance-none",
2590
- "border-input",
2591
- "bg-input-inner",
2592
- "data-[state=checked]:bg-primary",
2593
- "data-[state=checked]:text-primary-foreground",
2594
- "data-[state=checked]:border-primary",
2595
- "focus-visible:border-ring",
2596
- "focus-visible:ring-ring/50",
2597
- "aria-invalid:ring-negative/20",
2598
- "dark:aria-invalid:ring-negative/40",
2599
- "aria-invalid:border-negative",
2600
- "invalid:ring-negative/20",
2601
- "dark:invalid:ring-negative/40",
2602
- "invalid:border-negative",
2603
- "size-4",
2604
- "shrink-0",
2605
- "rounded-[4px]",
2606
- "border",
2607
- "shadow-control",
2608
- "transition-all",
2609
- "outline-none",
2610
- "focus-visible:ring-[3px]",
2611
- "disabled:cursor-not-allowed",
2612
- "disabled:opacity-50",
2613
- "overflow-hidden",
2614
- "before:block",
2659
+ "[&>input]:absolute",
2660
+ "[&>input]:appearance-none",
2661
+ "[&>input]:bg-transparent",
2662
+ "[&>input]:border-0",
2663
+ "[&>input]:cursor-pointer",
2664
+ "[&>input]:focus-visible:border-ring",
2665
+ "[&>input]:focus-visible:ring-[3px]",
2666
+ "[&>input]:focus-visible:ring-ring/50",
2667
+ "[&>input]:left-0",
2668
+ "[&>input]:outline-none",
2669
+ "[&>input]:rounded-[0.25rem]",
2670
+ "[&>input]:size-full",
2671
+ "[&>input]:top-0",
2672
+ "aspect-square",
2615
2673
  "before:bg-transparent",
2616
- "before:border-l-2",
2674
+ "before:block",
2617
2675
  "before:border-b-2",
2676
+ "before:border-l-2",
2618
2677
  "before:border-primary-foreground",
2678
+ "before:h-2",
2679
+ "before:invisible",
2619
2680
  "before:pointer-events-none",
2620
- "before:w-2.5",
2621
- "before:h-1.5",
2622
- "before:rounded-[0.125rem]",
2623
2681
  "before:-rotate-45",
2624
2682
  "before:translate-x-0.5",
2625
2683
  "before:translate-y-0.75",
2626
- "data-[state=unchecked]:before:hidden"
2684
+ "before:w-3.5",
2685
+ "bg-input-inner",
2686
+ "border",
2687
+ "border-input",
2688
+ "dark:has-[aria-invalid=true]:ring-negative/40",
2689
+ "dark:has-[input:invalid]:ring-negative/40",
2690
+ "duration-200",
2691
+ "has-[aria-invalid=true]:border-negative",
2692
+ "has-[aria-invalid=true]:ring-negative/20",
2693
+ "has-[input:checked]:before:visible",
2694
+ "has-[input:checked]:bg-primary",
2695
+ "has-[input:checked]:border-primary",
2696
+ "has-[input:disabled]:cursor-not-allowed",
2697
+ "has-[input:disabled]:opacity-50",
2698
+ "has-[input:invalid]:border-negative",
2699
+ "has-[input:invalid]:ring-negative/20",
2700
+ "relative",
2701
+ "rounded-[0.25rem]",
2702
+ "shadow-control",
2703
+ "shrink-0",
2704
+ "size-5",
2705
+ "transition-color"
2627
2706
  );
2707
+ el.setAttribute("tabindex", "-1");
2628
2708
  el.setAttribute("data-slot", "checkbox");
2629
- function setState() {
2630
- el.setAttribute("data-state", el.checked ? "checked" : "unchecked");
2631
- }
2632
- setState();
2633
- el.addEventListener("change", setState);
2634
- cleanup(() => {
2635
- el.removeEventListener("change", setState);
2636
- });
2637
2709
  });
2638
2710
  }
2639
2711
 
@@ -2717,6 +2789,7 @@
2717
2789
  "border",
2718
2790
  "shadow-control",
2719
2791
  "transition-[color,box-shadow]",
2792
+ "duration-200",
2720
2793
  "outline-none",
2721
2794
  "h-9",
2722
2795
  "pl-3",
@@ -2838,7 +2911,7 @@
2838
2911
  "rounded-lg",
2839
2912
  "border",
2840
2913
  "p-4",
2841
- "shadow-lg",
2914
+ "shadow-xl",
2842
2915
  "sm:max-w-lg"
2843
2916
  );
2844
2917
  el.setAttribute("role", "dialog");
@@ -2996,7 +3069,7 @@
2996
3069
  el.setAttribute("data-slot", "info-page-header");
2997
3070
  });
2998
3071
  Alpine.directive("h-info-page-media", (el, { modifiers }) => {
2999
- el.classList.add("hbox", "shrink-0", "items-center", "justify-center", "mb-2", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0");
3072
+ el.classList.add("hbox", "shrink-0", "items-center", "justify-center", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0");
3000
3073
  if (modifiers.includes("icon")) el.classList.add("bg-muted", "text-foreground", "size-10", "shrink-0", "items-center", "justify-center", "rounded-lg", "[&_svg:not([class*='size-'])]:size-6");
3001
3074
  else el.classList.add("bg-transparent");
3002
3075
  el.setAttribute("data-slot", "info-page-media");
@@ -3189,6 +3262,156 @@
3189
3262
  });
3190
3263
  }
3191
3264
 
3265
+ // src/components/list.js
3266
+ function list_default(Alpine) {
3267
+ Alpine.directive("h-listbox", (el, {}, { cleanup }) => {
3268
+ el.classList.add(
3269
+ "divide-solid",
3270
+ "divide-y",
3271
+ "bg-input-inner",
3272
+ "border-input",
3273
+ "border",
3274
+ "rounded-control",
3275
+ "shadow-control",
3276
+ "outline-none",
3277
+ "disabled:pointer-events-none",
3278
+ "disabled:cursor-not-allowed",
3279
+ "disabled:opacity-50",
3280
+ "focus-visible:border-ring",
3281
+ "focus-visible:ring-ring/50",
3282
+ "focus-visible:ring-[3px]",
3283
+ "aria-invalid:ring-negative/20",
3284
+ "dark:aria-invalid:ring-negative/40",
3285
+ "aria-invalid:border-negative",
3286
+ "invalid:ring-negative/20",
3287
+ "dark:invalid:ring-negative/40",
3288
+ "invalid:border-negative",
3289
+ "[&>ul:first-child>*:first-child]:rounded-t-control",
3290
+ "[&>ul:last-child>*:last-child]:rounded-b-control"
3291
+ );
3292
+ el.setAttribute("data-slot", "listbox");
3293
+ el.setAttribute("role", "listbox");
3294
+ function focusFirstOption(elem) {
3295
+ const firstOption = elem.querySelector('[role="option"]');
3296
+ if (firstOption) firstOption.focus();
3297
+ }
3298
+ function focusLastOption(elem) {
3299
+ const itemList = elem.querySelectorAll('[role="option"]');
3300
+ if (itemList.length) {
3301
+ itemList[itemList.length - 1].focus();
3302
+ }
3303
+ }
3304
+ function selectOption(option) {
3305
+ const selected = el.querySelector('[aria-selected="true"]');
3306
+ if (selected) selected.removeAttribute("aria-selected");
3307
+ if (selected !== option) option.setAttribute("aria-selected", "true");
3308
+ }
3309
+ function onKeyDown(event) {
3310
+ switch (event.key) {
3311
+ case "PageUp":
3312
+ case "PageDown":
3313
+ event.preventDefault();
3314
+ break;
3315
+ case "Home":
3316
+ focusFirstOption(el);
3317
+ break;
3318
+ case "End":
3319
+ focusLastOption(el);
3320
+ break;
3321
+ case "ArrowUp":
3322
+ let prevElem = event.target.previousElementSibling;
3323
+ if (prevElem && prevElem.getAttribute("data-slot") !== "list-header") {
3324
+ prevElem.focus();
3325
+ } else {
3326
+ prevElem = event.target.parentElement.previousElementSibling;
3327
+ if (prevElem && prevElem.tagName === "UL") {
3328
+ focusLastOption(prevElem);
3329
+ }
3330
+ }
3331
+ break;
3332
+ case "ArrowDown":
3333
+ let nextElem = event.target.nextElementSibling;
3334
+ if (nextElem) {
3335
+ nextElem.focus();
3336
+ } else {
3337
+ nextElem = event.target.parentElement.nextElementSibling;
3338
+ if (nextElem && nextElem.tagName === "UL") {
3339
+ focusFirstOption(nextElem);
3340
+ }
3341
+ }
3342
+ break;
3343
+ case " ":
3344
+ case "Enter":
3345
+ selectOption(event.target);
3346
+ break;
3347
+ default:
3348
+ break;
3349
+ }
3350
+ }
3351
+ function onClick(event) {
3352
+ if (event.target.getAttribute("data-slot") === "list-item") selectOption(event.target);
3353
+ }
3354
+ el.addEventListener("click", onClick);
3355
+ el.addEventListener("keydown", onKeyDown);
3356
+ cleanup(() => {
3357
+ el.removeEventListener("keydown", onKeyDown);
3358
+ el.removeEventListener("click", onClick);
3359
+ });
3360
+ });
3361
+ Alpine.directive("h-list", (el) => {
3362
+ el.classList.add("divide-solid", "divide-y");
3363
+ el.setAttribute("data-slot", "list");
3364
+ el.setAttribute("role", "group");
3365
+ });
3366
+ Alpine.directive("h-list-header", (el, {}, { Alpine: Alpine2 }) => {
3367
+ el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
3368
+ el.setAttribute("role", "presentation");
3369
+ el.setAttribute("data-slot", "list-header");
3370
+ const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
3371
+ if (!list) {
3372
+ throw new Error("h-list-header: must be placed inside an h-list element");
3373
+ }
3374
+ if (el.hasAttribute("id")) {
3375
+ list.setAttribute("aria-labelledby", el.getAttribute("id"));
3376
+ } else {
3377
+ const id = `lbh${v4_default()}`;
3378
+ el.setAttribute("id", id);
3379
+ list.setAttribute("aria-labelledby", id);
3380
+ }
3381
+ });
3382
+ Alpine.directive("h-list-item", (el, { modifiers }) => {
3383
+ el.classList.add("min-h-11", "flex", "items-center", "p-2", "gap-2", "align-middle", "outline-none");
3384
+ el.setAttribute("data-slot", "list-item");
3385
+ const listbox = Alpine.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "listbox");
3386
+ function setInteractive() {
3387
+ el.classList.add(
3388
+ "focus:bg-table-hover",
3389
+ "focus:text-table-hover-foreground",
3390
+ "hover:bg-table-hover",
3391
+ "hover:text-table-hover-foreground",
3392
+ "active:bg-table-active",
3393
+ "active:text-table-active-foreground",
3394
+ "aria-selected:bg-primary",
3395
+ "aria-selected:text-primary-foreground",
3396
+ "[&[aria-selected=true]:hover]:bg-primary-hover",
3397
+ "[&[aria-selected=true]:hover]:text-primary-hover-foreground",
3398
+ "[&[aria-selected=true]:focus]:bg-primary-hover",
3399
+ "[&[aria-selected=true]:focus]:text-primary-hover-foreground"
3400
+ );
3401
+ el.setAttribute("tabindex", "0");
3402
+ }
3403
+ if (listbox) {
3404
+ setInteractive();
3405
+ el.setAttribute("role", "option");
3406
+ el.setAttribute("tabindex", "0");
3407
+ } else if (modifiers.includes("interactive")) {
3408
+ setInteractive();
3409
+ } else {
3410
+ el.setAttribute("tabindex", "-1");
3411
+ }
3412
+ });
3413
+ }
3414
+
3192
3415
  // src/components/menu.js
3193
3416
  function menu_default(Alpine) {
3194
3417
  Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
@@ -3205,11 +3428,18 @@
3205
3428
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3206
3429
  throw new Error('h-menu: must have an "aria-label" or "aria-labelledby" attribute');
3207
3430
  }
3208
- const menuTrigger = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_menu_trigger"));
3209
- if (!menuTrigger) {
3210
- throw new Error("h-menu: menu must be inside an h-menu-trigger");
3431
+ const isSubmenu = modifiers.includes("sub");
3432
+ const menuTrigger = (() => {
3433
+ if (isSubmenu) return;
3434
+ let sibling = el.previousElementSibling;
3435
+ while (sibling && !sibling.hasOwnProperty("_menu_trigger")) {
3436
+ sibling = sibling.previousElementSibling;
3437
+ }
3438
+ return sibling;
3439
+ })();
3440
+ if (!isSubmenu && !menuTrigger) {
3441
+ throw new Error("h-menu: menu must be placed after an h-menu-trigger element");
3211
3442
  }
3212
- let isSubmenu = modifiers.includes("sub");
3213
3443
  let menuSubItem;
3214
3444
  if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
3215
3445
  function listenForTrigger(listen) {
@@ -3268,12 +3498,17 @@
3268
3498
  switch (event.key) {
3269
3499
  case "Left":
3270
3500
  case "ArrowLeft":
3501
+ if (isSubmenu) {
3502
+ Alpine2.nextTick(() => menuSubItem.focus());
3503
+ close();
3504
+ }
3505
+ break;
3271
3506
  case "Esc":
3272
3507
  case "Escape":
3273
- close();
3274
3508
  if (isSubmenu) {
3275
- setTimeout(() => menuSubItem.focus(), 0);
3509
+ Alpine2.nextTick(() => menuSubItem.focus());
3276
3510
  }
3511
+ close();
3277
3512
  break;
3278
3513
  case "Tab":
3279
3514
  case " ":
@@ -3365,16 +3600,19 @@
3365
3600
  })
3366
3601
  ]
3367
3602
  }).then(({ x, y }) => {
3603
+ if (!isSubmenu) {
3604
+ Alpine2.nextTick(() => el.focus());
3605
+ listenForTrigger(false);
3606
+ }
3607
+ Alpine2.nextTick(() => {
3608
+ top.addEventListener("contextmenu", onClick);
3609
+ top.addEventListener("click", onClick);
3610
+ el.addEventListener("keydown", onKeydown);
3611
+ });
3368
3612
  Object.assign(el.style, {
3369
3613
  left: `${x}px`,
3370
3614
  top: `${y}px`
3371
3615
  });
3372
- if (!isSubmenu) Alpine2.nextTick(() => el.focus());
3373
- setTimeout(() => {
3374
- top.addEventListener("contextmenu", onClick);
3375
- top.addEventListener("click", onClick);
3376
- el.addEventListener("keydown", onKeydown);
3377
- }, 0);
3378
3616
  });
3379
3617
  }
3380
3618
  }
@@ -3628,27 +3866,19 @@
3628
3866
  el.setAttribute("role", "menuitemcheckbox");
3629
3867
  el.setAttribute("data-slot", "menu-checkbox-item");
3630
3868
  function setState(checked, dispatch = true) {
3631
- el.setAttribute("aria-checked", checked);
3632
3869
  if (dispatch)
3633
- setTimeout(() => {
3870
+ Alpine2.nextTick(() => {
3634
3871
  el.dispatchEvent(new Event("change", { bubbles: true }));
3635
- }, 0);
3872
+ });
3873
+ el.setAttribute("aria-checked", checked);
3636
3874
  }
3637
3875
  if (el.hasOwnProperty("_x_model")) {
3638
- let handler2 = function(event) {
3639
- if (event.type === "keydown") {
3640
- if (event.key !== " " && event.key !== "Enter") {
3641
- return;
3642
- } else if (event.key === " ") {
3643
- event.preventDefault();
3644
- }
3645
- }
3876
+ let handler2 = function() {
3646
3877
  el._x_model.set(!el._x_model.get());
3647
3878
  setState(el._x_model.get());
3648
3879
  };
3649
3880
  setState(el._x_model.get(), false);
3650
3881
  el.addEventListener("click", handler2);
3651
- el.addEventListener("keydown", handler2);
3652
3882
  }
3653
3883
  const menu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
3654
3884
  function focusOut(event) {
@@ -3854,14 +4084,13 @@
3854
4084
 
3855
4085
  // src/components/popover.js
3856
4086
  function popover_default(Alpine) {
3857
- Alpine.directive("h-popover", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
4087
+ Alpine.directive("h-popover-trigger", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2, cleanup }) => {
3858
4088
  el._popover = Alpine2.reactive({
3859
4089
  id: void 0,
3860
4090
  controls: `hpc${v4_default()}`,
3861
- auto: modifiers.includes("auto"),
4091
+ auto: expression ? false : true,
3862
4092
  expanded: expression ? evaluate2(expression) : false
3863
4093
  });
3864
- el.setAttribute("data-slot", "popover");
3865
4094
  if (expression) {
3866
4095
  const getExpanded = evaluateLater(expression);
3867
4096
  effect(() => {
@@ -3870,43 +4099,39 @@
3870
4099
  });
3871
4100
  });
3872
4101
  }
3873
- });
3874
- Alpine.directive("h-popover-trigger", (el, { modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
3875
- const popover = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_popover"));
3876
- if (!popover) {
3877
- throw new Error("h-popover-trigger must be inside an h-popover element");
3878
- }
3879
4102
  el.setAttribute("type", "button");
3880
4103
  if (modifiers.includes("chevron")) {
3881
4104
  el.classList.add("[&_svg]:transition-transform", "[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180");
3882
4105
  }
3883
4106
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "popover-trigger");
3884
4107
  if (el.hasAttribute("id")) {
3885
- popover._popover.id = el.getAttribute("id");
4108
+ el._popover.id = el.getAttribute("id");
3886
4109
  } else {
3887
- popover._popover.id = `hp${v4_default()}`;
3888
- el.setAttribute("id", popover._popover.id);
4110
+ el._popover.id = `hp${v4_default()}`;
4111
+ el.setAttribute("id", el._popover.id);
3889
4112
  }
3890
- el.setAttribute("aria-controls", popover._popover.controls);
4113
+ el.setAttribute("aria-controls", el._popover.controls);
3891
4114
  el.setAttribute("aria-haspopup", "dialog");
3892
4115
  const setAttributes = () => {
3893
- el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
3894
- el.setAttribute("aria-expanded", popover._popover.expanded);
4116
+ el.setAttribute("data-state", el._popover.expanded ? "open" : "closed");
4117
+ el.setAttribute("aria-expanded", el._popover.expanded);
3895
4118
  };
3896
4119
  const close = () => {
3897
- popover._popover.expanded = false;
4120
+ el._popover.expanded = false;
4121
+ el.addEventListener("click", handler2);
3898
4122
  };
3899
4123
  const handler2 = () => {
3900
- popover._popover.expanded = !popover._popover.expanded;
4124
+ el._popover.expanded = !el._popover.expanded;
3901
4125
  setAttributes();
3902
4126
  Alpine2.nextTick(() => {
3903
- if (popover._popover.auto && popover._popover.expanded) {
4127
+ if (el._popover.auto && el._popover.expanded) {
3904
4128
  top.addEventListener("click", close, { once: true });
4129
+ el.removeEventListener("click", handler2);
3905
4130
  }
3906
4131
  });
3907
4132
  };
3908
4133
  setAttributes();
3909
- if (popover._popover.auto) {
4134
+ if (el._popover.auto) {
3910
4135
  el.addEventListener("click", handler2);
3911
4136
  cleanup(() => {
3912
4137
  el.removeEventListener("click", handler2);
@@ -3918,13 +4143,19 @@
3918
4143
  });
3919
4144
  }
3920
4145
  });
3921
- Alpine.directive("h-popover-content", (el, { modifiers }, { effect, Alpine: Alpine2 }) => {
3922
- const popover = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_popover"));
4146
+ Alpine.directive("h-popover", (el, { modifiers }, { effect }) => {
4147
+ const popover = (() => {
4148
+ let sibling = el.previousElementSibling;
4149
+ while (sibling && !sibling.hasOwnProperty("_popover")) {
4150
+ sibling = sibling.previousElementSibling;
4151
+ }
4152
+ return sibling;
4153
+ })();
3923
4154
  if (!popover) {
3924
- throw new Error("h-popover-content must be inside an h-popover element");
4155
+ throw new Error("h-popover-content must be placed after an h-popover element");
3925
4156
  }
3926
- el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-control", "border", "shadow-md", "outline-hidden", "overflow-scroll");
3927
- el.setAttribute("data-slot", "popover-content");
4157
+ el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-md", "border", "shadow-md", "outline-hidden", "overflow-scroll");
4158
+ el.setAttribute("data-slot", "popover");
3928
4159
  el.setAttribute("role", "dialog");
3929
4160
  el.setAttribute("tabindex", "-1");
3930
4161
  el.setAttribute("id", popover._popover.controls);
@@ -3935,13 +4166,9 @@
3935
4166
  el.classList.remove("overflow-scroll");
3936
4167
  el.classList.add("overflow-none");
3937
4168
  }
3938
- const control = popover.querySelector(`#${popover._popover.id}`);
3939
- if (!control) {
3940
- throw new Error("h-popover-content: trigger not found");
3941
- }
3942
4169
  let autoUpdateCleanup;
3943
4170
  function updatePosition() {
3944
- computePosition2(control, el, {
4171
+ computePosition2(popover, el, {
3945
4172
  placement: el.getAttribute("data-align") || "bottom-start",
3946
4173
  middleware: [
3947
4174
  offset2(4),
@@ -3966,7 +4193,7 @@
3966
4193
  effect(() => {
3967
4194
  el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
3968
4195
  if (popover._popover.expanded) {
3969
- autoUpdateCleanup = autoUpdate(control, el, updatePosition);
4196
+ autoUpdateCleanup = autoUpdate(popover, el, updatePosition);
3970
4197
  } else {
3971
4198
  if (autoUpdateCleanup) autoUpdateCleanup();
3972
4199
  Object.assign(el.style, {
@@ -4005,40 +4232,48 @@
4005
4232
  function radio_default(Alpine) {
4006
4233
  Alpine.directive("h-radio", (el) => {
4007
4234
  el.classList.add(
4008
- "appearance-none",
4009
- "border-input",
4010
- "bg-input-inner",
4011
- "text-primary",
4012
- "focus-visible:border-ring",
4013
- "focus-visible:ring-ring/50",
4014
- "aria-invalid:ring-negative/20",
4015
- "dark:aria-invalid:ring-negative/40",
4016
- "aria-invalid:border-negative",
4017
- "invalid:ring-negative/20",
4018
- "dark:invalid:ring-negative/40",
4019
- "invalid:border-negative",
4235
+ "[&>input]:absolute",
4236
+ "[&>input]:appearance-none",
4237
+ "[&>input]:bg-transparent",
4238
+ "[&>input]:border-0",
4239
+ "[&>input]:cursor-pointer",
4240
+ "[&>input]:focus-visible:border-ring",
4241
+ "[&>input]:focus-visible:ring-[3px]",
4242
+ "[&>input]:focus-visible:ring-ring/50",
4243
+ "[&>input]:left-0",
4244
+ "[&>input]:outline-none",
4245
+ "[&>input]:rounded-full",
4246
+ "[&>input]:size-full",
4247
+ "[&>input]:top-0",
4020
4248
  "aspect-square",
4021
- "size-4",
4022
- "shrink-0",
4023
- "rounded-full",
4024
- "border",
4025
- "shadow-control",
4026
- "transition-color",
4027
- "duration-200",
4028
- "outline-none",
4029
- "focus-visible:ring-[3px]",
4030
- "disabled:cursor-not-allowed",
4031
- "disabled:opacity-50",
4032
- "before:block",
4033
4249
  "before:bg-clip-padding",
4034
- "before:rounded-full",
4035
- "before:h-full",
4036
- "before:w-full",
4037
4250
  "before:bg-primary",
4038
- "before:border-input-inner",
4251
+ "before:block",
4039
4252
  "before:border-3",
4040
- "not-checked:before:hidden"
4253
+ "before:border-transparent",
4254
+ "before:invisible",
4255
+ "before:pointer-events-none",
4256
+ "before:rounded-full",
4257
+ "before:size-full",
4258
+ "bg-input-inner",
4259
+ "border",
4260
+ "border-input",
4261
+ "dark:has-[aria-invalid=true]:ring-negative/40",
4262
+ "dark:has-[input:invalid]:ring-negative/40",
4263
+ "has-[aria-invalid=true]:border-negative",
4264
+ "has-[aria-invalid=true]:ring-negative/20",
4265
+ "has-[input:checked]:before:visible",
4266
+ "has-[input:disabled]:cursor-not-allowed",
4267
+ "has-[input:disabled]:opacity-50",
4268
+ "has-[input:invalid]:border-negative",
4269
+ "has-[input:invalid]:ring-negative/20",
4270
+ "relative",
4271
+ "rounded-full",
4272
+ "shadow-control",
4273
+ "shrink-0",
4274
+ "size-5"
4041
4275
  );
4276
+ el.setAttribute("tabindex", "-1");
4042
4277
  el.setAttribute("data-slot", "radio");
4043
4278
  });
4044
4279
  }
@@ -6418,21 +6653,40 @@
6418
6653
 
6419
6654
  // src/components/sidebar.js
6420
6655
  function sidebar_default(Alpine) {
6421
- Alpine.directive("h-sidebar", (el, { modifiers }) => {
6422
- el.classList.add("group/sidebar", "bg-sidebar", "text-sidebar-foreground", "border-sidebar-border", "vbox", "h-full", "w-(--sidebar-width,16rem)");
6423
- if (modifiers.includes("floating")) {
6424
- el.classList.add("border", "rounded-lg", "shadow-sm", "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]");
6425
- } else el.classList.add("group-data-[collapsible=icon]:w-(--sidebar-width-icon)");
6656
+ Alpine.directive("h-sidebar", (el, { modifiers }, { cleanup }) => {
6657
+ el.classList.add("group/sidebar", "bg-sidebar", "text-sidebar-foreground", "border-sidebar-border", "vbox", "h-full", "w-(--sidebar-width,16rem)", "data-[collapsed=true]:w-min");
6426
6658
  if (modifiers.includes("right")) el.classList.add("border-l");
6427
6659
  else el.classList.add("border-r");
6428
6660
  el.setAttribute("data-slot", "sidebar");
6661
+ const setFloating = () => {
6662
+ if (el.getAttribute("data-floating") === "true") {
6663
+ el.classList.add("border", "rounded-lg", "shadow-sm");
6664
+ } else {
6665
+ el.classList.remove("border", "rounded-lg", "shadow-sm");
6666
+ }
6667
+ };
6668
+ setFloating();
6669
+ const observer = new MutationObserver((mutations) => {
6670
+ mutations.forEach((mutation) => {
6671
+ if (mutation.type === "attributes") {
6672
+ if (mutation.attributeName === "data-floating") {
6673
+ setFloating();
6674
+ }
6675
+ }
6676
+ });
6677
+ });
6678
+ observer.observe(el, { attributes: true });
6679
+ cleanup(() => {
6680
+ observer.disconnect();
6681
+ });
6429
6682
  });
6430
6683
  Alpine.directive("h-sidebar-header", (el) => {
6431
- el.classList.add("vbox", "gap-2", "p-2");
6684
+ el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-b");
6685
+ if (el.dataset.borderless && el.dataset.borderless === "true") el.classList.remove("border-b");
6432
6686
  el.setAttribute("data-slot", "sidebar-header");
6433
6687
  });
6434
6688
  Alpine.directive("h-sidebar-content", (el) => {
6435
- el.classList.add("vbox", "min-h-0", "flex-1", "gap-2", "overflow-auto", "group-data-[collapsible=icon]:overflow-hidden");
6689
+ el.classList.add("vbox", "min-h-0", "flex-1", "gap-2", "overflow-auto", "group-data-[collapsed=true]/sidebar:overflow-hidden");
6436
6690
  el.setAttribute("data-slot", "sidebar-content");
6437
6691
  });
6438
6692
  Alpine.directive("h-sidebar-group", (el) => {
@@ -6458,8 +6712,7 @@
6458
6712
  "focus-visible:ring-2",
6459
6713
  "[&>svg]:size-4",
6460
6714
  "[&>svg]:shrink-0",
6461
- "group-data-[collapsible=icon]:-mt-8",
6462
- "group-data-[collapsible=icon]:opacity-0"
6715
+ "group-data-[collapsed=true]/sidebar:!hidden"
6463
6716
  );
6464
6717
  if (modifiers.includes("action")) el.classList.add("hover:bg-secondary-hover", "active:bg-secondary-active");
6465
6718
  el.setAttribute("data-slot", "sidebar-group-label");
@@ -6488,7 +6741,7 @@
6488
6741
  "after:absolute",
6489
6742
  "after:-inset-2",
6490
6743
  "md:after:hidden",
6491
- "group-data-[collapsible=icon]:hidden"
6744
+ "group-data-[collapsed=true]/sidebar:hidden"
6492
6745
  );
6493
6746
  el.setAttribute("data-slot", "sidebar-group-action");
6494
6747
  });
@@ -6535,8 +6788,9 @@
6535
6788
  "data-[active=true]:text-sidebar-primary-foreground",
6536
6789
  "data-[state=open]:hover:bg-sidebar-secondary",
6537
6790
  "data-[state=open]:hover:text-sidebar-secondary-foreground",
6538
- "group-data-[collapsible=icon]:size-8!",
6539
- "group-data-[collapsible=icon]:p-2!",
6791
+ "group-data-[collapsed=true]/sidebar:!size-8",
6792
+ "group-data-[collapsed=true]/sidebar:!p-2",
6793
+ "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden",
6540
6794
  "[&>span]:truncate",
6541
6795
  "[&>span]:align-middle",
6542
6796
  "[&>svg]:size-4",
@@ -6547,7 +6801,7 @@
6547
6801
  const sizes = {
6548
6802
  default: ["h-8", "text-sm"],
6549
6803
  sm: ["h-7", "text-xs"],
6550
- lg: ["h-12", "text-sm", "group-data-[collapsible=icon]:p-0!"]
6804
+ lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
6551
6805
  };
6552
6806
  function setSize(size3) {
6553
6807
  if (sizes.hasOwnProperty(size3)) {
@@ -6585,7 +6839,7 @@
6585
6839
  "peer-data-[size=sm]/menu-button:top-1",
6586
6840
  "peer-data-[size=default]/menu-button:top-1.5",
6587
6841
  "peer-data-[size=lg]/menu-button:top-2.5",
6588
- "group-data-[collapsible=icon]:hidden"
6842
+ "group-data-[collapsed=true]/sidebar:hidden"
6589
6843
  );
6590
6844
  if (modifiers.includes("autohide")) {
6591
6845
  el.classList.add("peer-data-[active=true]/menu-button:text-sidebar-secondary-foreground", "group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
@@ -6614,7 +6868,7 @@
6614
6868
  "peer-data-[size=sm]/menu-button:top-1",
6615
6869
  "peer-data-[size=default]/menu-button:top-1.5",
6616
6870
  "peer-data-[size=lg]/menu-button:top-2.5",
6617
- "group-data-[collapsible=icon]:hidden"
6871
+ "group-data-[collapsed=true]/sidebar:hidden"
6618
6872
  );
6619
6873
  el.setAttribute("data-slot", "sidebar-menu-badge");
6620
6874
  });
@@ -6637,7 +6891,7 @@
6637
6891
  el.setAttribute("role", "none");
6638
6892
  });
6639
6893
  Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
6640
- el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsible=icon]:hidden");
6894
+ el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:hidden");
6641
6895
  if (!modifiers.includes("flat")) {
6642
6896
  el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
6643
6897
  }
@@ -6680,7 +6934,7 @@
6680
6934
  "[&>svg:not(:first-child):last-child]:ml-auto",
6681
6935
  "data-[active=true]:bg-sidebar-primary",
6682
6936
  "data-[active=true]:text-sidebar-primary-foreground",
6683
- "group-data-[collapsible=icon]:hidden"
6937
+ "group-data-[collapsed=true]/sidebar:hidden"
6684
6938
  );
6685
6939
  el.setAttribute("data-slot", "sidebar-menu-sub-button");
6686
6940
  const sizes = {
@@ -6696,7 +6950,8 @@
6696
6950
  setSize(el.getAttribute("data-size"));
6697
6951
  });
6698
6952
  Alpine.directive("h-sidebar-footer", (el) => {
6699
- el.classList.add("vbox", "gap-2", "p-2");
6953
+ el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
6954
+ if (el.dataset.borderless && el.dataset.borderless === "true") el.classList.remove("border-t");
6700
6955
  el.setAttribute("data-slot", "sidebar-footer");
6701
6956
  });
6702
6957
  }
@@ -6708,7 +6963,7 @@
6708
6963
  if (modifiers.includes("control")) {
6709
6964
  el.classList.add("rounded-control");
6710
6965
  } else if (modifiers.includes("card")) {
6711
- el.classList.add("rounded-xl");
6966
+ el.classList.add("rounded-lg");
6712
6967
  } else if (modifiers.includes("avatar")) {
6713
6968
  el.classList.add("rounded-full", "size-8");
6714
6969
  } else el.classList.add("rounded-md");
@@ -6728,52 +6983,53 @@
6728
6983
 
6729
6984
  // src/components/switch.js
6730
6985
  function switch_default(Alpine) {
6731
- Alpine.directive("h-switch", (el, {}, { cleanup }) => {
6986
+ Alpine.directive("h-switch", (el) => {
6732
6987
  el.classList.add(
6733
- "appearance-none",
6734
- "peer",
6735
- "data-[state=checked]:bg-primary",
6736
- "data-[state=unchecked]:bg-input",
6737
- "focus-visible:border-ring",
6738
- "focus-visible:ring-ring/50",
6739
- "inline-flex",
6740
- "data-[size=sm]:h-5",
6741
- "data-[size=sm]:w-8",
6742
- "h-6",
6743
- "w-10",
6744
- "shrink-0",
6745
- "items-center",
6746
- "rounded-full",
6747
- "border",
6748
- "border-transparent",
6749
- "shadow-control",
6750
- "transition-all",
6751
- "duration-200",
6752
- "outline-none",
6753
- "focus-visible:ring-[3px]",
6754
- "disabled:cursor-not-allowed",
6755
- "disabled:opacity-50",
6756
- "before:block",
6988
+ "[&>input]:absolute",
6989
+ "[&>input]:appearance-none",
6990
+ "[&>input]:bg-transparent",
6991
+ "[&>input]:border-0",
6992
+ "[&>input]:cursor-pointer",
6993
+ "[&>input]:focus-visible:border-ring",
6994
+ "[&>input]:focus-visible:ring-[3px]",
6995
+ "[&>input]:focus-visible:ring-ring/50",
6996
+ "[&>input]:left-0",
6997
+ "[&>input]:outline-none",
6998
+ "[&>input]:rounded-full",
6999
+ "[&>input]:size-full",
7000
+ "[&>input]:top-0",
6757
7001
  "before:bg-background",
7002
+ "before:duration-200",
7003
+ "before:inline-block",
7004
+ "before:m-[1px]",
6758
7005
  "before:pointer-events-none",
6759
- "data-[size=sm]:before:size-4",
6760
- "before:size-5",
6761
- "before:rounded-full",
6762
7006
  "before:ring-0",
7007
+ "before:rounded-full",
7008
+ "before:shadow-control",
7009
+ "before:size-5",
6763
7010
  "before:transition-transform",
6764
- "before:duration-200",
6765
- "data-[state=checked]:before:translate-x-[calc(100%-3px)]",
6766
- "data-[state=unchecked]:before:translate-x-[1px]"
7011
+ "bg-muted",
7012
+ "border",
7013
+ "data-[size=sm]:before:size-4",
7014
+ "data-[size=sm]:h-5",
7015
+ "data-[size=sm]:max-w-8",
7016
+ "data-[size=sm]:min-w-8",
7017
+ "duration-200",
7018
+ "h-6",
7019
+ "has-[input:checked]:before:translate-x-[calc(100%-var(--spacing)*1)]",
7020
+ "has-[input:checked]:bg-primary",
7021
+ "has-[input:checked]:border-primary-active",
7022
+ "has-[input:disabled]:cursor-not-allowed",
7023
+ "has-[input:disabled]:opacity-50",
7024
+ "max-w-10",
7025
+ "min-w-10",
7026
+ "relative",
7027
+ "rounded-full",
7028
+ "shrink-0",
7029
+ "transition-color"
6767
7030
  );
7031
+ el.setAttribute("tabindex", "-1");
6768
7032
  el.setAttribute("data-slot", "switch");
6769
- function setState() {
6770
- el.setAttribute("data-state", el.checked ? "checked" : "unchecked");
6771
- }
6772
- setState();
6773
- el.addEventListener("change", setState);
6774
- cleanup(() => {
6775
- el.removeEventListener("change", setState);
6776
- });
6777
7033
  });
6778
7034
  }
6779
7035
 
@@ -6811,19 +7067,60 @@
6811
7067
  el.setAttribute("data-slot", "table-header");
6812
7068
  });
6813
7069
  Alpine.directive("h-table-head", (el) => {
6814
- el.classList.add("text-foreground", "h-10", "px-2", "text-left", "align-middle", "font-medium", "whitespace-nowrap", "[&:has([role=checkbox])]:pr-0", "[&>[role=checkbox]]:flex", "[&>[role=checkbox]]:items-center");
7070
+ el.classList.add(
7071
+ "text-foreground",
7072
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7073
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7074
+ "[&[data-activable=true]:active]:!bg-table-active",
7075
+ "[&[data-activable=true]:active]:!text-table-active-foreground",
7076
+ "h-10",
7077
+ "px-2",
7078
+ "text-left",
7079
+ "align-middle",
7080
+ "font-medium",
7081
+ "whitespace-nowrap",
7082
+ "[&:has([role=checkbox])]:pr-0",
7083
+ "[&>[role=checkbox]]:flex",
7084
+ "[&>[role=checkbox]]:items-center"
7085
+ );
6815
7086
  el.setAttribute("data-slot", "table-head");
6816
7087
  });
6817
7088
  Alpine.directive("h-table-cell", (el) => {
6818
- el.classList.add("p-2", "align-middle", "whitespace-nowrap", "[&:has([role=checkbox])]:pr-0", "[&>[role=checkbox]]:flex", "[&>[role=checkbox]]:items-center");
7089
+ el.classList.add(
7090
+ "p-2",
7091
+ "align-middle",
7092
+ "whitespace-nowrap",
7093
+ "[&:has([role=checkbox])]:pr-0",
7094
+ "[&>[role=checkbox]]:flex",
7095
+ "[&>[role=checkbox]]:items-center",
7096
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7097
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7098
+ "[&[data-activable=true]:active]:!bg-table-active",
7099
+ "[&[data-activable=true]:active]:!text-table-active-foreground"
7100
+ );
6819
7101
  el.setAttribute("data-slot", "table-cell");
6820
7102
  });
6821
7103
  Alpine.directive("h-table-body", (el) => {
6822
- el.classList.add("[&_tr:last-child_td]:border-b-0", "[&_tr:last-child_th]:border-b-0", "[&_tr_th]:bg-table-header", "[&_tr:hover_th]:bg-table-hover", "[&_tr:hover_th]:text-table-hover-foreground");
7104
+ el.classList.add(
7105
+ "[&_tr:last-child_td]:border-b-0",
7106
+ "[&_tr:last-child_th]:border-b-0",
7107
+ "[&_tr_th]:bg-table-header",
7108
+ "[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
7109
+ "[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
7110
+ "[&_tr[data-activable=true]:active_th]:!bg-table-active",
7111
+ "[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
7112
+ );
6823
7113
  el.setAttribute("data-slot", "table-body");
6824
7114
  });
6825
7115
  Alpine.directive("h-table-row", (el) => {
6826
- el.classList.add("hover:bg-table-hover", "hover:text-table-hover-foreground", "data-[state=selected]:bg-muted");
7116
+ el.classList.add(
7117
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7118
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7119
+ "[&[data-activable=true]:active]:!bg-table-active",
7120
+ "[&[data-activable=true]:active]:!text-table-active-foreground",
7121
+ "data-[state=selected]:bg-table-active",
7122
+ "data-[state=selected]:text-table-active-foreground"
7123
+ );
6827
7124
  el.setAttribute("data-slot", "table-row");
6828
7125
  });
6829
7126
  Alpine.directive("h-table-caption", (el) => {
@@ -6846,18 +7143,23 @@
6846
7143
  el.classList.add(
6847
7144
  "group/tab-bar",
6848
7145
  "flex",
6849
- "gap-1.5",
7146
+ "gap-1",
6850
7147
  "bg-object-header",
6851
7148
  "text-object-header-foreground",
6852
7149
  "group-data-[orientation=horizontal]/tabs:flex-row",
6853
7150
  "group-data-[orientation=vertical]/tabs:flex-col",
6854
- "data-[style=inline]:group-data-[orientation=horizontal]/tabs:inset-shadow-[0_-.063rem_var(--border)]",
6855
- "data-[style=inline]:group-data-[orientation=vertical]/tabs:inset-shadow-[-.063rem_0_var(--border)]",
6856
- "data-[style=inline]:group-data-[orientation=horizontal]/tabs:h-11",
6857
- "data-[style=inline]:data-[size=sm]:group-data-[orientation=horizontal]/tabs:h-8",
6858
- "data-[style=float]:border",
6859
- "data-[style=float]:rounded-lg",
6860
- "data-[style=float]:p-[3px]"
7151
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:inset-shadow-[0_-.063rem_var(--border)]",
7152
+ "[&:not([data-floating=true])]:group-data-[orientation=vertical]/tabs:inset-shadow-[-.063rem_0_var(--border)]",
7153
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:h-10",
7154
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:min-h-10",
7155
+ "[&:not([data-floating=true])]:data-[size=sm]:group-data-[orientation=horizontal]/tabs:h-8",
7156
+ "[&:not([data-floating=true])]:data-[size=sm]:group-data-[orientation=horizontal]/tabs:min-h-8",
7157
+ "[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:h-12",
7158
+ "[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:min-h-12",
7159
+ "data-[floating=true]:border",
7160
+ "data-[floating=true]:shadow-xs",
7161
+ "data-[floating=true]:rounded-lg",
7162
+ "data-[floating=true]:p-[0.188rem]"
6861
7163
  );
6862
7164
  el.setAttribute("data-slot", "tab-bar");
6863
7165
  });
@@ -6870,8 +7172,8 @@
6870
7172
  "group-data-[orientation=horizontal]/tabs:flex-row",
6871
7173
  "group-data-[orientation=vertical]/tabs:flex-col",
6872
7174
  "group-data-[orientation=vertical]/tabs:h-fit",
6873
- "group-data-[style=inline]/tab-bar:gap-2",
6874
- "group-data-[style=float]/tab-bar:gap-1"
7175
+ "gap-2",
7176
+ "group-data-[floating=true]/tab-bar:gap-1"
6875
7177
  );
6876
7178
  el.setAttribute("role", "tablist");
6877
7179
  el.setAttribute("data-slot", "tab-list");
@@ -6887,8 +7189,7 @@
6887
7189
  "aria-selected:text-foreground",
6888
7190
  "inline-flex",
6889
7191
  "group-data-[orientation=vertical]/tabs:w-full",
6890
- "group-data-[orientation=vertical]/tabs:h-9",
6891
- "group-data-[orientation=vertical]/tabs:group-data-[size=sm]/tab-bar:h-8",
7192
+ "group-data-[orientation=vertical]/tabs:h-8",
6892
7193
  "group-data-[orientation=horizontal]/tabs:h-full",
6893
7194
  "items-center",
6894
7195
  "justify-start",
@@ -6899,21 +7200,21 @@
6899
7200
  "font-medium",
6900
7201
  "whitespace-nowrap",
6901
7202
  "transition-[color,box-shadow]",
6902
- "group-data-[style=float]/tab-bar:rounded-md",
6903
- "group-data-[style=float]/tab-bar:border",
6904
- "group-data-[style=float]/tab-bar:border-transparent",
6905
- "group-data-[style=float]/tab-bar:aria-selected:bg-background",
6906
- "group-data-[style=float]/tab-bar:aria-selected:border-border",
6907
- "group-data-[style=float]/tab-bar:hover:bg-background",
6908
- "group-data-[style=float]/tab-bar:hover:border-border",
6909
- "group-data-[style=inline]/tab-bar:border-0",
6910
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:inset-shadow-[0_-.188rem_var(--border)]",
6911
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:aria-selected:inset-shadow-[0_-.125rem_var(--primary)]",
6912
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:aria-selected:inset-shadow-[0_-.188rem_var(--primary)]",
6913
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:px-3.5",
6914
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:hover:inset-shadow-[-.188rem_0_var(--border)]",
6915
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:aria-selected:inset-shadow-[-.125rem_0_var(--primary)]",
6916
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:hover:aria-selected:inset-shadow-[-.188rem_0_var(--primary)]",
7203
+ "group-data-[floating=true]/tab-bar:rounded-md",
7204
+ "group-data-[floating=true]/tab-bar:border",
7205
+ "group-data-[floating=true]/tab-bar:border-transparent",
7206
+ "group-data-[floating=true]/tab-bar:aria-selected:bg-background",
7207
+ "group-data-[floating=true]/tab-bar:aria-selected:border-border",
7208
+ "group-data-[floating=true]/tab-bar:hover:bg-background",
7209
+ "group-data-[floating=true]/tab-bar:hover:border-border",
7210
+ "group-[&:not([data-floating=true])]/tab-bar:border-0",
7211
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:inset-shadow-[0_-.188rem_var(--border)]",
7212
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:aria-selected:inset-shadow-[0_-.125rem_var(--primary)]",
7213
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:aria-selected:inset-shadow-[0_-.188rem_var(--primary)]",
7214
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:px-3",
7215
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:hover:inset-shadow-[-.188rem_0_var(--border)]",
7216
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:aria-selected:inset-shadow-[-.125rem_0_var(--primary)]",
7217
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:hover:aria-selected:inset-shadow-[-.188rem_0_var(--primary)]",
6917
7218
  "focus-visible:ring-[3px]",
6918
7219
  "focus-visible:outline-1",
6919
7220
  "disabled:pointer-events-none",
@@ -6937,12 +7238,28 @@
6937
7238
  if (modifiers.includes("end"))
6938
7239
  el.classList.add(
6939
7240
  "group-data-[orientation=horizontal]/tabs:ml-auto",
6940
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:mr-1.5",
7241
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:mr-1.5",
6941
7242
  "group-data-[orientation=vertical]/tabs:mt-auto",
6942
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:mb-1.5"
7243
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:mb-1.5"
6943
7244
  );
6944
7245
  el.setAttribute("data-slot", "tab-list-actions");
6945
7246
  });
7247
+ Alpine.directive("h-tab-list-action", (el) => {
7248
+ setButtonClasses(el);
7249
+ el.classList.add(
7250
+ "group-data-[floating=true]/tab-bar:rounded-md",
7251
+ "group-data-[orientation=horizontal]/tabs:aspect-square",
7252
+ "group-data-[orientation=horizontal]/tabs:w-auto",
7253
+ "group-data-[floating=true]/tab-bar:group-data-[orientation=horizontal]/tabs:h-full",
7254
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:h-[75%]",
7255
+ "group-data-[orientation=vertical]/tabs:h-9",
7256
+ "group-data-[floating=true]/tab-bar:group-data-[orientation=vertical]/tabs:w-full",
7257
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:w-[80%]"
7258
+ );
7259
+ el.classList.add(...buttonVariants[el.getAttribute("data-variant") ?? "outline"]);
7260
+ el.setAttribute("role", "button");
7261
+ el.setAttribute("data-slot", "tab-list-action");
7262
+ });
6946
7263
  Alpine.directive("h-tabs-content", (el) => {
6947
7264
  el.classList.add("flex-1", "outline-none");
6948
7265
  el.setAttribute("role", "tabpanel");
@@ -7088,7 +7405,7 @@
7088
7405
  "flex",
7089
7406
  "items-center",
7090
7407
  "text-sm",
7091
- "rounded-xl",
7408
+ "rounded-lg",
7092
7409
  "transition-colors",
7093
7410
  "[a]:hover:bg-secondary-hover",
7094
7411
  "[a]:hover:text-secondary-foreground",
@@ -7136,10 +7453,10 @@
7136
7453
  el.setAttribute("data-slot", "tile-media");
7137
7454
  switch (el.getAttribute("data-variant")) {
7138
7455
  case "icon":
7139
- el.classList.add("size-8", "border", "rounded-xl", "bg-muted", "[&_svg:not([class*='size-'])]:size-4");
7456
+ el.classList.add("size-8", "border", "rounded-lg", "bg-muted", "[&_svg:not([class*='size-'])]:size-4");
7140
7457
  break;
7141
7458
  case "image":
7142
- el.classList.add("size-10", "rounded-xl", "overflow-hidden", "[&_img]:size-full", "[&_img]:object-cover");
7459
+ el.classList.add("size-10", "rounded-lg", "overflow-hidden", "[&_img]:size-full", "[&_img]:object-cover");
7143
7460
  break;
7144
7461
  default:
7145
7462
  el.classList.add("bg-transparent");
@@ -7233,14 +7550,16 @@
7233
7550
  el.classList.add(
7234
7551
  "cursor-pointer",
7235
7552
  "border-input",
7236
- "focus-visible:border-ring",
7237
- "focus-visible:ring-ring/50",
7238
- "aria-invalid:ring-negative/20",
7239
- "dark:aria-invalid:ring-negative/40",
7240
- "aria-invalid:border-negative",
7241
- "invalid:ring-negative/20",
7242
- "dark:invalid:ring-negative/40",
7243
- "invalid:border-negative",
7553
+ "[&>input]:appearance-none",
7554
+ "has-[input:focus-visible]:border-ring",
7555
+ "has-[input:focus-visible]:ring-[3px]",
7556
+ "has-[input:focus-visible]:ring-ring/50",
7557
+ "dark:has-[aria-invalid=true]:ring-negative/40",
7558
+ "dark:has-[input:invalid]:ring-negative/40",
7559
+ "has-[aria-invalid=true]:border-negative",
7560
+ "has-[aria-invalid=true]:ring-negative/20",
7561
+ "has-[input:invalid]:border-negative",
7562
+ "has-[input:invalid]:ring-negative/20",
7244
7563
  "hover:bg-secondary-hover",
7245
7564
  "active:bg-secondary-active",
7246
7565
  "flex",
@@ -7258,8 +7577,8 @@
7258
7577
  "whitespace-nowrap",
7259
7578
  "shadow-control",
7260
7579
  "transition-[color,box-shadow]",
7580
+ "duration-200",
7261
7581
  "outline-none",
7262
- "focus-visible:ring-[3px]",
7263
7582
  "has-[input:disabled]:pointer-events-none",
7264
7583
  "has-[input:disabled]:opacity-50",
7265
7584
  "[&_svg]:pointer-events-none",
@@ -7268,6 +7587,7 @@
7268
7587
  "[&_svg]:opacity-50"
7269
7588
  );
7270
7589
  el.setAttribute("data-slot", "time-picker");
7590
+ el.setAttribute("tabindex", "-1");
7271
7591
  el.appendChild(
7272
7592
  createElement(Clock, {
7273
7593
  class: ["opacity-50 size-4 transition-transform duration-200"],
@@ -7295,7 +7615,8 @@
7295
7615
  } else {
7296
7616
  el._timepicker.is12Hour = new Intl.DateTimeFormat(el._timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
7297
7617
  }
7298
- const handler2 = () => {
7618
+ const handler2 = (event) => {
7619
+ if (event.type === "keydown" && event.key !== "Enter") return;
7299
7620
  el._timepicker.expanded = !el._timepicker.expanded;
7300
7621
  el.setAttribute("aria-expanded", el._timepicker.expanded);
7301
7622
  Alpine2.nextTick(() => {
@@ -7307,8 +7628,10 @@
7307
7628
  });
7308
7629
  };
7309
7630
  el.addEventListener("click", handler2);
7631
+ el.addEventListener("keydown", handler2);
7310
7632
  cleanup(() => {
7311
7633
  el.removeEventListener("click", handler2);
7634
+ el.removeEventListener("keydown", handler2);
7312
7635
  top.removeEventListener("click", el._timepicker.close);
7313
7636
  });
7314
7637
  });
@@ -7819,14 +8142,19 @@
7819
8142
  "hbox",
7820
8143
  "shrink-0",
7821
8144
  "items-center",
7822
- "px-2",
8145
+ "px-1",
8146
+ 'has-[>[data-slot="avatar"]:last-child]:pr-2',
8147
+ 'has-[>[data-slot="toolbar-image"]:first-child]:pl-2',
7823
8148
  "gap-1",
7824
8149
  modifiers.includes("footer") ? "border-t" : "border-b",
7825
8150
  "w-full",
7826
- "h-11",
8151
+ "h-12",
7827
8152
  "data-[size=sm]:h-8",
7828
8153
  "data-[variant=transparent]:bg-transparent",
7829
- "data-[variant=transparent]:text-foreground"
8154
+ "data-[variant=transparent]:text-foreground",
8155
+ "data-[floating=true]:shadow-xs",
8156
+ "data-[floating=true]:rounded-lg",
8157
+ "data-[floating=true]:border"
7830
8158
  );
7831
8159
  el.setAttribute("data-slot", "toolbar");
7832
8160
  });
@@ -7835,11 +8163,12 @@
7835
8163
  el.setAttribute("data-slot", "toolbar-image");
7836
8164
  });
7837
8165
  Alpine.directive("h-toolbar-title", (el) => {
7838
- el.classList.add("text", "[[data-size=sm]_&]:text-sm", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
8166
+ el.classList.add("text", "[[data-size=sm]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
7839
8167
  el.setAttribute("data-slot", "toolbar-title");
7840
8168
  });
7841
8169
  Alpine.directive("h-toolbar-spacer", (el) => {
7842
8170
  el.classList.add("flex-[1_auto]", "h-full");
8171
+ el.setAttribute("tabindex", "-1");
7843
8172
  el.setAttribute("data-slot", "toolbar-spacer");
7844
8173
  });
7845
8174
  Alpine.directive("h-toolbar-separator", (el) => {
@@ -7850,28 +8179,21 @@
7850
8179
 
7851
8180
  // src/components/tooltip.js
7852
8181
  function tooltip_default(Alpine) {
7853
- Alpine.directive("h-tooltip", (el, {}, { Alpine: Alpine2 }) => {
8182
+ Alpine.directive("h-tooltip-trigger", (el, {}, { Alpine: Alpine2, cleanup }) => {
7854
8183
  el._tooltip = Alpine2.reactive({
7855
8184
  id: void 0,
7856
8185
  controls: `hpc${v4_default()}`,
7857
8186
  shown: false
7858
8187
  });
7859
- el.setAttribute("data-slot", "tooltip");
7860
- });
7861
- Alpine.directive("h-tooltip-trigger", (el, {}, { Alpine: Alpine2, cleanup }) => {
7862
- const tooltip = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_tooltip"));
7863
- if (!tooltip) {
7864
- throw new Error("h-tooltip-trigger must be inside an h-tooltip element");
7865
- }
7866
8188
  if (el.hasAttribute("id")) {
7867
- tooltip._tooltip.id = el.getAttribute("id");
8189
+ el._tooltip.id = el.getAttribute("id");
7868
8190
  } else {
7869
- tooltip._tooltip.id = `hp${v4_default()}`;
7870
- el.setAttribute("id", tooltip._tooltip.id);
8191
+ el._tooltip.id = `hp${v4_default()}`;
8192
+ el.setAttribute("id", el._tooltip.id);
7871
8193
  }
7872
- el.setAttribute("aria-describedby", tooltip._tooltip.controls);
8194
+ el.setAttribute("aria-describedby", el._tooltip.controls);
7873
8195
  const handler2 = (event) => {
7874
- tooltip._tooltip.shown = event.type === "pointerenter";
8196
+ el._tooltip.shown = event.type === "pointerenter";
7875
8197
  };
7876
8198
  el.addEventListener("pointerenter", handler2);
7877
8199
  el.addEventListener("pointerleave", handler2);
@@ -7880,20 +8202,25 @@
7880
8202
  el.removeEventListener("pointerleave", handler2);
7881
8203
  });
7882
8204
  });
7883
- Alpine.directive("h-tooltip-content", (el, {}, { effect, Alpine: Alpine2 }) => {
7884
- const tooltip = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_tooltip"));
8205
+ Alpine.directive("h-tooltip", (el, {}, { effect }) => {
8206
+ const tooltip = (() => {
8207
+ let sibling = el.previousElementSibling;
8208
+ while (sibling && !sibling.hasOwnProperty("_tooltip")) {
8209
+ sibling = sibling.previousElementSibling;
8210
+ }
8211
+ return sibling;
8212
+ })();
7885
8213
  if (!tooltip) {
7886
- throw new Error("h-tooltip-content must be inside an h-tooltip element");
8214
+ throw new Error("h-tooltip must be placed after an h-tooltip-trigger element");
7887
8215
  }
7888
8216
  el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
7889
- el.setAttribute("data-slot", "tooltip-content");
8217
+ el.setAttribute("data-slot", "tooltip");
7890
8218
  el.setAttribute("id", tooltip._tooltip.controls);
7891
- const control = tooltip.querySelector(`#${tooltip._tooltip.id}`);
7892
8219
  const arrowEl = document.createElement("span");
7893
8220
  arrowEl.classList.add("absolute", "bg-foreground", "fill-foreground", "z-50", "size-2.5", "rotate-45", "rounded-[2px]");
7894
8221
  el.appendChild(arrowEl);
7895
8222
  function updatePosition() {
7896
- computePosition2(control, el, {
8223
+ computePosition2(tooltip, el, {
7897
8224
  placement: "top",
7898
8225
  middleware: [offset2(10), flip2(), shift2({ padding: 4 }), arrow2({ element: arrowEl })]
7899
8226
  }).then(({ x, y, middlewareData, placement }) => {
@@ -7951,20 +8278,38 @@
7951
8278
  };
7952
8279
  var setColorScheme = (mode) => {
7953
8280
  if (mode === "dark") {
8281
+ document.documentElement.classList.add("dark");
7954
8282
  localStorage.setItem(colorSchemeKey, "dark");
7955
8283
  window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", colorSchemeChange);
7956
8284
  } else if (mode === "light") {
8285
+ document.documentElement.classList.remove("dark");
7957
8286
  localStorage.setItem(colorSchemeKey, "light");
7958
8287
  window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", colorSchemeChange);
7959
8288
  } else {
8289
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
8290
+ document.documentElement.classList.add("dark");
8291
+ } else {
8292
+ document.documentElement.classList.remove("dark");
8293
+ }
7960
8294
  localStorage.setItem(colorSchemeKey, "auto");
7961
8295
  window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", colorSchemeChange);
7962
8296
  }
7963
8297
  };
8298
+ var getColorScheme = () => {
8299
+ const theme = localStorage.getItem(colorSchemeKey);
8300
+ if (theme) return theme;
8301
+ else if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
8302
+ return "dark";
8303
+ }
8304
+ return "light";
8305
+ };
7964
8306
  initColorScheme();
7965
8307
 
8308
+ // package.json
8309
+ var version = "0.4.0";
8310
+
7966
8311
  // src/index.js
7967
- window.Harmonia = { setColorScheme };
8312
+ window.Harmonia = { getColorScheme, setColorScheme, version };
7968
8313
  document.addEventListener("alpine:init", () => {
7969
8314
  window.Alpine.plugin(accordion_default);
7970
8315
  window.Alpine.plugin(alert_default);
@@ -7982,6 +8327,7 @@
7982
8327
  window.Alpine.plugin(info_page_default);
7983
8328
  window.Alpine.plugin(input_default);
7984
8329
  window.Alpine.plugin(label_default);
8330
+ window.Alpine.plugin(list_default);
7985
8331
  window.Alpine.plugin(menu_default);
7986
8332
  window.Alpine.plugin(pagination_default);
7987
8333
  window.Alpine.plugin(popover_default);