@codbex/harmonia 0.3.1 → 0.5.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
@@ -148,7 +148,7 @@
148
148
  if (!accordion) {
149
149
  throw new Error("h-accordion-item must be inside an h-accordion");
150
150
  }
151
- el.classList.add("border-b", "last:border-b-0");
151
+ el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
152
152
  el.setAttribute("data-slot", "accordion-item");
153
153
  const itemId = expression ?? `ha${v4_default()}`;
154
154
  function getIsExpanded() {
@@ -183,7 +183,18 @@
183
183
  if (!accordionItem || !accordion) {
184
184
  throw new Error("h-accordion-trigger must be inside an h-accordion-item, which must be inside an h-accordion");
185
185
  }
186
- el.classList.add("flex");
186
+ el.classList.add(
187
+ "flex",
188
+ "h-12",
189
+ "[[data-size=md]_&]:h-10",
190
+ "[[data-size=sm]_&]:h-8",
191
+ "[[data-variant=header]_&]:bg-object-header",
192
+ "[[data-variant=header]_&]:text-object-header-foreground",
193
+ "[[data-variant=header]_&]:px-4",
194
+ "[[data-variant=header]_&]:border-b",
195
+ "[[data-size=md][data-variant=header]_&]:px-3",
196
+ "[[data-size=sm][data-variant=header]_&]:px-2.5"
197
+ );
187
198
  el.setAttribute("tabIndex", "-1");
188
199
  const getLabel = evaluateLater(expression);
189
200
  const chevronDown = createElement(ChevronDown, {
@@ -202,11 +213,9 @@
202
213
  "focus-visible:ring-ring/50",
203
214
  "flex",
204
215
  "flex-1",
205
- "items-start",
216
+ "items-center",
206
217
  "justify-between",
207
218
  "gap-4",
208
- "rounded-md",
209
- "py-4",
210
219
  "text-left",
211
220
  "text-sm",
212
221
  "font-medium",
@@ -287,7 +296,7 @@
287
296
  "items-center",
288
297
  "[&>svg]:size-4",
289
298
  "[&>svg]:text-current",
290
- modifiers.includes("floating") ? "shadow-alert" : void 0
299
+ modifiers.includes("floating") ? "shadow-lg" : void 0
291
300
  );
292
301
  el.setAttribute("data-slot", "alert");
293
302
  el.setAttribute("role", "alert");
@@ -306,13 +315,11 @@
306
315
  }
307
316
  setVariant(el.getAttribute("data-variant") ?? "default");
308
317
  const observer = new MutationObserver((mutations) => {
309
- mutations.forEach((mutation) => {
310
- if (mutation.type === "attributes" && mutation.attributeName === "data-variant") {
311
- setVariant(el.getAttribute("data-variant") ?? "default");
312
- }
318
+ mutations.forEach(() => {
319
+ setVariant(el.getAttribute("data-variant") ?? "default");
313
320
  });
314
321
  });
315
- observer.observe(el, { attributes: true });
322
+ observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
316
323
  cleanup(() => {
317
324
  observer.disconnect();
318
325
  });
@@ -339,12 +346,11 @@
339
346
  "bg-secondary",
340
347
  "text-secondary-foreground",
341
348
  "fill-secondary-foreground",
342
- "hover:bg-secondary-hover",
343
- "active:bg-secondary-active",
344
349
  "[[data-slot=toolbar]:not([data-variant=transparent])_&]:border",
345
350
  "has-[img]:border-0",
346
351
  "flex",
347
352
  "size-8",
353
+ "aspect-square",
348
354
  "shrink-0",
349
355
  "overflow-hidden",
350
356
  "rounded-full",
@@ -357,6 +363,9 @@
357
363
  el._avatar = Alpine2.reactive({
358
364
  fallback: false
359
365
  });
366
+ if (el.tagName === "BUTTON") {
367
+ el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
368
+ }
360
369
  });
361
370
  Alpine.directive("h-avatar-image", (el, {}, { cleanup }) => {
362
371
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_avatar"));
@@ -384,13 +393,11 @@
384
393
  interval = setInterval(completeCheck, 10);
385
394
  }
386
395
  const observer = new MutationObserver((mutations) => {
387
- mutations.forEach((mutation) => {
388
- if (mutation.type === "attributes") {
389
- if (mutation.attributeName === "src") interval = setInterval(completeCheck, 10);
390
- }
396
+ mutations.forEach(() => {
397
+ interval = setInterval(completeCheck, 10);
391
398
  });
392
399
  });
393
- observer.observe(el, { attributes: true });
400
+ observer.observe(el, { attributes: true, attributeFilter: ["src"] });
394
401
  cleanup(() => {
395
402
  if (interval) clearInterval(interval);
396
403
  observer.disconnect();
@@ -433,12 +440,6 @@
433
440
  "focus-visible:border-ring",
434
441
  "focus-visible:ring-ring/50",
435
442
  "focus-visible:ring-[3px]",
436
- "aria-invalid:ring-negative/20",
437
- "dark:aria-invalid:ring-negative/40",
438
- "aria-invalid:border-negative",
439
- "invalid:ring-negative/20",
440
- "dark:invalid:ring-negative/40",
441
- "invalid:border-negative",
442
443
  "transition-[color,box-shadow]",
443
444
  "overflow-hidden"
444
445
  );
@@ -460,13 +461,11 @@
460
461
  }
461
462
  setVariant(el.getAttribute("data-variant") ?? "default");
462
463
  const observer = new MutationObserver((mutations) => {
463
- mutations.forEach((mutation) => {
464
- if (mutation.type === "attributes" && mutation.attributeName === "data-variant") {
465
- setVariant(el.getAttribute("data-variant") ?? "default");
466
- }
464
+ mutations.forEach(() => {
465
+ setVariant(el.getAttribute("data-variant") ?? "default");
467
466
  });
468
467
  });
469
- observer.observe(el, { attributes: true });
468
+ observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
470
469
  cleanup(() => {
471
470
  observer.disconnect();
472
471
  });
@@ -474,82 +473,155 @@
474
473
  }
475
474
 
476
475
  // src/components/button.js
476
+ var buttonVariants = {
477
+ default: [
478
+ "bg-secondary",
479
+ "text-secondary-foreground",
480
+ "shadow-control",
481
+ "hover:bg-secondary-hover",
482
+ "active:bg-secondary-active",
483
+ "aria-pressed:bg-secondary-active",
484
+ "active:data-[toggled=true]:bg-secondary-active",
485
+ "hover:data-[toggled=true]:bg-secondary-hover",
486
+ "data-[toggled=true]:bg-secondary-active"
487
+ ],
488
+ primary: [
489
+ "bg-primary",
490
+ "text-primary-foreground",
491
+ "shadow-control",
492
+ "hover:bg-primary-hover",
493
+ "active:bg-primary-active",
494
+ "aria-pressed:bg-primary-active",
495
+ "active:data-[toggled=true]:bg-primary-active",
496
+ "hover:data-[toggled=true]:bg-primary-hover",
497
+ "data-[toggled=true]:bg-primary-active"
498
+ ],
499
+ positive: [
500
+ "bg-positive",
501
+ "text-positive-foreground",
502
+ "shadow-control",
503
+ "hover:bg-positive-hover",
504
+ "active:bg-positive-active",
505
+ "aria-pressed:bg-positive-active",
506
+ "active:data-[toggled=true]:bg-positive-active",
507
+ "hover:data-[toggled=true]:bg-positive-hover",
508
+ "data-[toggled=true]:bg-positive-active"
509
+ ],
510
+ negative: [
511
+ "bg-negative",
512
+ "text-negative-foreground",
513
+ "shadow-control",
514
+ "hover:bg-negative-hover",
515
+ "active:bg-negative-active",
516
+ "aria-pressed:bg-negative-active",
517
+ "active:data-[toggled=true]:bg-negative-active",
518
+ "hover:data-[toggled=true]:bg-negative-hover",
519
+ "data-[toggled=true]:bg-negative-active"
520
+ ],
521
+ warning: [
522
+ "bg-warning",
523
+ "text-warning-foreground",
524
+ "shadow-control",
525
+ "hover:bg-warning-hover",
526
+ "active:bg-warning-active",
527
+ "aria-pressed:bg-warning-active",
528
+ "active:data-[toggled=true]:bg-warning-active",
529
+ "hover:data-[toggled=true]:bg-warning-hover",
530
+ "data-[toggled=true]:bg-warning-active"
531
+ ],
532
+ outline: [
533
+ "border",
534
+ "bg-background",
535
+ "text-foreground",
536
+ "hover:bg-secondary",
537
+ "hover:text-secondary-foreground",
538
+ "active:bg-secondary-active",
539
+ "aria-pressed:bg-secondary-active",
540
+ "active:data-[toggled=true]:bg-secondary-active",
541
+ "hover:data-[toggled=true]:bg-secondary-hover",
542
+ "data-[toggled=true]:bg-secondary-active"
543
+ ],
544
+ transparent: [
545
+ "bg-transparent",
546
+ "text-foreground",
547
+ "shadow-none",
548
+ "hover:bg-secondary",
549
+ "hover:text-secondary-foreground",
550
+ "active:bg-secondary-active",
551
+ "aria-pressed:bg-secondary-active",
552
+ "active:data-[toggled=true]:bg-secondary-active",
553
+ "hover:data-[toggled=true]:bg-secondary-hover",
554
+ "data-[toggled=true]:bg-secondary-active"
555
+ ],
556
+ link: ["text-primary", "underline-offset-4", "hover:underline"]
557
+ };
558
+ var setButtonClasses = (el) => {
559
+ el.classList.add(
560
+ "cursor-pointer",
561
+ "inline-flex",
562
+ "items-center",
563
+ "justify-center",
564
+ "gap-2",
565
+ "whitespace-nowrap",
566
+ "rounded-control",
567
+ "text-sm",
568
+ "font-medium",
569
+ "transition-all",
570
+ "disabled:pointer-events-none",
571
+ "disabled:opacity-50",
572
+ "[&_svg]:pointer-events-none",
573
+ "[&_svg:not([class*='size-'])]:size-4",
574
+ "shrink-0",
575
+ "[&_svg]:shrink-0",
576
+ "outline-none",
577
+ "focus-visible:border-ring",
578
+ "focus-visible:ring-ring/50",
579
+ "focus-visible:ring-[3px]",
580
+ "aria-invalid:ring-negative/20",
581
+ "dark:aria-invalid:ring-negative/40",
582
+ "aria-invalid:border-negative",
583
+ "invalid:!ring-negative/20",
584
+ "dark:invalid:!ring-negative/40",
585
+ "invalid:!border-negative"
586
+ );
587
+ };
588
+ var getButtonSize = (size3, inGroup = false) => {
589
+ switch (size3) {
590
+ case "xs":
591
+ return 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"];
592
+ case "sm":
593
+ return inGroup ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5"];
594
+ case "lg":
595
+ return ["h-10", "px-6", "has-[>svg]:px-4"];
596
+ case "icon-xs":
597
+ return inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"];
598
+ case "icon-sm":
599
+ return inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
600
+ case "icon":
601
+ return ["size-9"];
602
+ case "icon-lg":
603
+ return ["size-10"];
604
+ default:
605
+ return ["h-9", "px-4", "py-2", "has-[>svg]:px-3"];
606
+ }
607
+ };
477
608
  function button_default(Alpine) {
478
609
  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
- );
610
+ setButtonClasses(el);
507
611
  if (!el.hasAttribute("data-slot")) {
508
612
  el.setAttribute("data-slot", "button");
509
613
  }
510
614
  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
- const sizes = {
522
- default: ["h-9", "px-4", "py-2", "has-[>svg]:px-3"],
523
- 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"],
524
- sm: inGroup ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5"],
525
- lg: ["h-10", "px-6", "has-[>svg]:px-4"],
526
- "icon-xs": inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"],
527
- "icon-sm": inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"],
528
- 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
- ]
539
- };
540
615
  function setVariant(variant) {
541
- for (const [_, value] of Object.entries(variants)) {
616
+ for (const [_, value] of Object.entries(buttonVariants)) {
542
617
  el.classList.remove(...value);
543
618
  }
544
- if (variants.hasOwnProperty(variant)) el.classList.add(...variants[variant]);
619
+ if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
545
620
  }
546
621
  function setSize(size3) {
547
- if (sizes.hasOwnProperty(size3)) {
548
- el.classList.add(...sizes[size3]);
549
- el.setAttribute("data-size", size3);
550
- if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
551
- console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
552
- }
622
+ el.classList.add(...getButtonSize(size3, inGroup));
623
+ if (size3 && size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
624
+ console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
553
625
  }
554
626
  }
555
627
  setVariant(el.getAttribute("data-variant") ?? "default");
@@ -564,19 +636,17 @@
564
636
  if (["date-picker-trigger", "time-picker-trigger"].includes(el.getAttribute("data-slot"))) {
565
637
  setSize("icon-xs");
566
638
  } else {
567
- setSize("default");
639
+ setSize();
568
640
  }
569
641
  }
570
642
  }
571
643
  const observer = new MutationObserver((mutations) => {
572
644
  mutations.forEach((mutation) => {
573
- if (mutation.type === "attributes") {
574
- if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
575
- else if (mutation.attributeName === "data-size") setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
576
- }
645
+ if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
646
+ else setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
577
647
  });
578
648
  });
579
- observer.observe(el, { attributes: true });
649
+ observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
580
650
  cleanup(() => {
581
651
  observer.disconnect();
582
652
  });
@@ -607,10 +677,6 @@
607
677
  }
608
678
  setVariant(el.getAttribute("data-orientation") ?? "horizontal");
609
679
  });
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
680
  Alpine.directive("h-button-group-separator", (el) => {
615
681
  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
682
  el.setAttribute("role", "none");
@@ -2120,7 +2186,7 @@
2120
2186
  let firstDay = 0;
2121
2187
  let minDate = void 0;
2122
2188
  let maxDate = void 0;
2123
- function modelChange() {
2189
+ function modelChange(triggerInput = false) {
2124
2190
  Alpine2.nextTick(() => {
2125
2191
  el.dispatchEvent(new CustomEvent("change", { detail: { date: selected } }));
2126
2192
  });
@@ -2133,23 +2199,27 @@
2133
2199
  }
2134
2200
  if (datepicker) {
2135
2201
  datepicker._datepicker.input.value = formatter.format(selected);
2202
+ datepicker._datepicker.input.setCustomValidity("");
2203
+ if (triggerInput) datepicker._datepicker.input.dispatchEvent(new Event("change", { bubbles: true }));
2136
2204
  } else {
2137
2205
  el.setAttribute("data-invalid", "false");
2138
2206
  }
2139
2207
  }
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
- }
2208
+ const onInputChange = () => {
2209
+ const newValue = new Date(datepicker._datepicker.input.value);
2210
+ if (isNaN(newValue)) {
2211
+ console.error(`h-calendar: input value is not a valid date - ${datepicker._datepicker.input.value}`);
2212
+ datepicker._datepicker.input.setCustomValidity("Input value is not a valid date.");
2213
+ return;
2214
+ } else if (selected.getTime() !== newValue.getTime()) {
2215
+ selected = newValue;
2150
2216
  modelChange();
2151
2217
  render();
2152
- });
2218
+ }
2219
+ datepicker._datepicker.input.setCustomValidity("");
2220
+ };
2221
+ if (datepicker) {
2222
+ datepicker._datepicker.input.addEventListener("change", onInputChange);
2153
2223
  }
2154
2224
  function checkForModel() {
2155
2225
  if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
@@ -2167,7 +2237,7 @@
2167
2237
  if (event.target.getAttribute("aria-disabled") === "true") return;
2168
2238
  focusedDay = new Date(event.target.dataset.year, event.target.dataset.month, event.target.dataset.day);
2169
2239
  selected = new Date(focusedDay);
2170
- modelChange();
2240
+ modelChange(true);
2171
2241
  render();
2172
2242
  if (datepicker) datepicker._datepicker.expanded = false;
2173
2243
  }
@@ -2330,7 +2400,7 @@
2330
2400
  "align-middle",
2331
2401
  "text-center",
2332
2402
  "size-8",
2333
- "rounded-sm",
2403
+ "rounded-control",
2334
2404
  "outline-none",
2335
2405
  "hover:bg-secondary-hover",
2336
2406
  "hover:text-secondary-foreground",
@@ -2546,6 +2616,9 @@
2546
2616
  for (let d = 0; d < dayCells.length; d++) {
2547
2617
  dayCells[d].removeEventListener("click", dayClick);
2548
2618
  }
2619
+ if (datepicker) {
2620
+ datepicker._datepicker.input.removeEventListener("change", onInputChange);
2621
+ }
2549
2622
  });
2550
2623
  });
2551
2624
  }
@@ -2553,7 +2626,7 @@
2553
2626
  // src/components/card.js
2554
2627
  function card_default(Alpine) {
2555
2628
  Alpine.directive("h-card", (el) => {
2556
- el.classList.add("bg-card", "text-card-foreground", "vbox", "gap-6", "rounded-xl", "border", "py-6", "shadow-sm");
2629
+ el.classList.add("bg-card", "text-card-foreground", "vbox", "gap-4", "rounded-xl", "border", "py-6", "shadow-sm");
2557
2630
  el.setAttribute("data-slot", "card");
2558
2631
  });
2559
2632
  Alpine.directive("h-card-header", (el) => {
@@ -2584,56 +2657,58 @@
2584
2657
 
2585
2658
  // src/components/checkbox.js
2586
2659
  function checkbox_default(Alpine) {
2587
- Alpine.directive("h-checkbox", (el, {}, { cleanup }) => {
2660
+ Alpine.directive("h-checkbox", (el) => {
2588
2661
  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",
2662
+ "[&>input]:absolute",
2663
+ "[&>input]:appearance-none",
2664
+ "[&>input]:bg-transparent",
2665
+ "[&>input]:border-0",
2666
+ "[&>input]:cursor-pointer",
2667
+ "[&>input]:focus-visible:border-ring",
2668
+ "[&>input]:focus-visible:ring-[3px]",
2669
+ "[&>input]:focus-visible:ring-ring/50",
2670
+ "[&>input]:left-0",
2671
+ "[&>input]:outline-none",
2672
+ "[&>input]:rounded-[0.25rem]",
2673
+ "[&>input]:size-full",
2674
+ "[&>input]:top-0",
2675
+ "aspect-square",
2615
2676
  "before:bg-transparent",
2616
- "before:border-l-2",
2677
+ "before:block",
2617
2678
  "before:border-b-2",
2679
+ "before:border-l-2",
2618
2680
  "before:border-primary-foreground",
2681
+ "before:h-2",
2682
+ "before:invisible",
2619
2683
  "before:pointer-events-none",
2620
- "before:w-2.5",
2621
- "before:h-1.5",
2622
- "before:rounded-[0.125rem]",
2623
2684
  "before:-rotate-45",
2624
2685
  "before:translate-x-0.5",
2625
2686
  "before:translate-y-0.75",
2626
- "data-[state=unchecked]:before:hidden"
2687
+ "before:w-3.5",
2688
+ "bg-input-inner",
2689
+ "border",
2690
+ "border-input",
2691
+ "dark:has-[aria-invalid=true]:ring-negative/40",
2692
+ "dark:has-[input:invalid]:ring-negative/40",
2693
+ "duration-200",
2694
+ "has-[aria-invalid=true]:border-negative",
2695
+ "has-[aria-invalid=true]:ring-negative/20",
2696
+ "has-[input:checked]:before:visible",
2697
+ "has-[input:checked]:bg-primary",
2698
+ "has-[input:checked]:border-primary",
2699
+ "has-[input:disabled]:cursor-not-allowed",
2700
+ "has-[input:disabled]:opacity-50",
2701
+ "has-[input:invalid]:border-negative",
2702
+ "has-[input:invalid]:ring-negative/20",
2703
+ "relative",
2704
+ "rounded-[0.25rem]",
2705
+ "shadow-control",
2706
+ "shrink-0",
2707
+ "size-5",
2708
+ "transition-color"
2627
2709
  );
2710
+ el.setAttribute("tabindex", "-1");
2628
2711
  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
2712
  });
2638
2713
  }
2639
2714
 
@@ -2717,6 +2792,7 @@
2717
2792
  "border",
2718
2793
  "shadow-control",
2719
2794
  "transition-[color,box-shadow]",
2795
+ "duration-200",
2720
2796
  "outline-none",
2721
2797
  "h-9",
2722
2798
  "pl-3",
@@ -2796,8 +2872,8 @@
2796
2872
  el.setAttribute("tabindex", "-1");
2797
2873
  el.setAttribute("data-slot", "dialog-overlay");
2798
2874
  const observer = new MutationObserver((mutations) => {
2799
- mutations.forEach((mutation) => {
2800
- if (mutation.type === "attributes" && mutation.attributeName === "data-open" && el.getAttribute("data-open") === "true") {
2875
+ mutations.forEach(() => {
2876
+ if (el.getAttribute("data-open") === "true") {
2801
2877
  const inputs = el.getElementsByTagName("INPUT");
2802
2878
  if (inputs.length) {
2803
2879
  for (let i = 0; i < inputs.length; i++) {
@@ -2816,7 +2892,7 @@
2816
2892
  }
2817
2893
  });
2818
2894
  });
2819
- observer.observe(el, { attributes: true });
2895
+ observer.observe(el, { attributes: true, attributeFilter: ["data-open"] });
2820
2896
  cleanup(() => {
2821
2897
  observer.disconnect();
2822
2898
  });
@@ -2838,7 +2914,7 @@
2838
2914
  "rounded-lg",
2839
2915
  "border",
2840
2916
  "p-4",
2841
- "shadow-lg",
2917
+ "shadow-xl",
2842
2918
  "sm:max-w-lg"
2843
2919
  );
2844
2920
  el.setAttribute("role", "dialog");
@@ -2996,7 +3072,7 @@
2996
3072
  el.setAttribute("data-slot", "info-page-header");
2997
3073
  });
2998
3074
  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");
3075
+ el.classList.add("hbox", "shrink-0", "items-center", "justify-center", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0");
3000
3076
  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
3077
  else el.classList.add("bg-transparent");
3002
3078
  el.setAttribute("data-slot", "info-page-media");
@@ -3056,9 +3132,9 @@
3056
3132
  "aria-invalid:ring-negative/20",
3057
3133
  "dark:aria-invalid:ring-negative/40",
3058
3134
  "aria-invalid:border-negative",
3059
- "invalid:ring-negative/20",
3060
- "dark:invalid:ring-negative/40",
3061
- "invalid:border-negative"
3135
+ "invalid:!ring-negative/20",
3136
+ "dark:invalid:!ring-negative/40",
3137
+ "invalid:!border-negative"
3062
3138
  );
3063
3139
  if (modifiers.includes("group")) {
3064
3140
  el.classList.remove("rounded-control", "border", "bg-input-inner", "shadow-control", "focus-visible:ring-[3px]");
@@ -3189,6 +3265,156 @@
3189
3265
  });
3190
3266
  }
3191
3267
 
3268
+ // src/components/list.js
3269
+ function list_default(Alpine) {
3270
+ Alpine.directive("h-listbox", (el, {}, { cleanup }) => {
3271
+ el.classList.add(
3272
+ "divide-solid",
3273
+ "divide-y",
3274
+ "bg-input-inner",
3275
+ "border-input",
3276
+ "border",
3277
+ "rounded-control",
3278
+ "shadow-control",
3279
+ "outline-none",
3280
+ "disabled:pointer-events-none",
3281
+ "disabled:cursor-not-allowed",
3282
+ "disabled:opacity-50",
3283
+ "focus-visible:border-ring",
3284
+ "focus-visible:ring-ring/50",
3285
+ "focus-visible:ring-[3px]",
3286
+ "aria-invalid:ring-negative/20",
3287
+ "dark:aria-invalid:ring-negative/40",
3288
+ "aria-invalid:border-negative",
3289
+ "invalid:!ring-negative/20",
3290
+ "dark:invalid:!ring-negative/40",
3291
+ "invalid:!border-negative",
3292
+ "[&>ul:first-child>*:first-child]:rounded-t-control",
3293
+ "[&>ul:last-child>*:last-child]:rounded-b-control"
3294
+ );
3295
+ el.setAttribute("data-slot", "listbox");
3296
+ el.setAttribute("role", "listbox");
3297
+ function focusFirstOption(elem) {
3298
+ const firstOption = elem.querySelector('[role="option"]');
3299
+ if (firstOption) firstOption.focus();
3300
+ }
3301
+ function focusLastOption(elem) {
3302
+ const itemList = elem.querySelectorAll('[role="option"]');
3303
+ if (itemList.length) {
3304
+ itemList[itemList.length - 1].focus();
3305
+ }
3306
+ }
3307
+ function selectOption(option) {
3308
+ const selected = el.querySelector('[aria-selected="true"]');
3309
+ if (selected) selected.removeAttribute("aria-selected");
3310
+ if (selected !== option) option.setAttribute("aria-selected", "true");
3311
+ }
3312
+ function onKeyDown(event) {
3313
+ switch (event.key) {
3314
+ case "PageUp":
3315
+ case "PageDown":
3316
+ event.preventDefault();
3317
+ break;
3318
+ case "Home":
3319
+ focusFirstOption(el);
3320
+ break;
3321
+ case "End":
3322
+ focusLastOption(el);
3323
+ break;
3324
+ case "ArrowUp":
3325
+ let prevElem = event.target.previousElementSibling;
3326
+ if (prevElem && prevElem.getAttribute("data-slot") !== "list-header") {
3327
+ prevElem.focus();
3328
+ } else {
3329
+ prevElem = event.target.parentElement.previousElementSibling;
3330
+ if (prevElem && prevElem.tagName === "UL") {
3331
+ focusLastOption(prevElem);
3332
+ }
3333
+ }
3334
+ break;
3335
+ case "ArrowDown":
3336
+ let nextElem = event.target.nextElementSibling;
3337
+ if (nextElem) {
3338
+ nextElem.focus();
3339
+ } else {
3340
+ nextElem = event.target.parentElement.nextElementSibling;
3341
+ if (nextElem && nextElem.tagName === "UL") {
3342
+ focusFirstOption(nextElem);
3343
+ }
3344
+ }
3345
+ break;
3346
+ case " ":
3347
+ case "Enter":
3348
+ selectOption(event.target);
3349
+ break;
3350
+ default:
3351
+ break;
3352
+ }
3353
+ }
3354
+ function onClick(event) {
3355
+ if (event.target.getAttribute("data-slot") === "list-item") selectOption(event.target);
3356
+ }
3357
+ el.addEventListener("click", onClick);
3358
+ el.addEventListener("keydown", onKeyDown);
3359
+ cleanup(() => {
3360
+ el.removeEventListener("keydown", onKeyDown);
3361
+ el.removeEventListener("click", onClick);
3362
+ });
3363
+ });
3364
+ Alpine.directive("h-list", (el) => {
3365
+ el.classList.add("divide-solid", "divide-y");
3366
+ el.setAttribute("data-slot", "list");
3367
+ el.setAttribute("role", "group");
3368
+ });
3369
+ Alpine.directive("h-list-header", (el, {}, { Alpine: Alpine2 }) => {
3370
+ el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
3371
+ el.setAttribute("role", "presentation");
3372
+ el.setAttribute("data-slot", "list-header");
3373
+ const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
3374
+ if (!list) {
3375
+ throw new Error("h-list-header: must be placed inside an h-list element");
3376
+ }
3377
+ if (el.hasAttribute("id")) {
3378
+ list.setAttribute("aria-labelledby", el.getAttribute("id"));
3379
+ } else {
3380
+ const id = `lbh${v4_default()}`;
3381
+ el.setAttribute("id", id);
3382
+ list.setAttribute("aria-labelledby", id);
3383
+ }
3384
+ });
3385
+ Alpine.directive("h-list-item", (el, { modifiers }) => {
3386
+ el.classList.add("min-h-11", "flex", "items-center", "p-2", "gap-2", "align-middle", "outline-none");
3387
+ el.setAttribute("data-slot", "list-item");
3388
+ const listbox = Alpine.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "listbox");
3389
+ function setInteractive() {
3390
+ el.classList.add(
3391
+ "focus:bg-table-hover",
3392
+ "focus:text-table-hover-foreground",
3393
+ "hover:bg-table-hover",
3394
+ "hover:text-table-hover-foreground",
3395
+ "active:bg-table-active",
3396
+ "active:text-table-active-foreground",
3397
+ "aria-selected:bg-primary",
3398
+ "aria-selected:text-primary-foreground",
3399
+ "[&[aria-selected=true]:hover]:bg-primary-hover",
3400
+ "[&[aria-selected=true]:hover]:text-primary-hover-foreground",
3401
+ "[&[aria-selected=true]:focus]:bg-primary-hover",
3402
+ "[&[aria-selected=true]:focus]:text-primary-hover-foreground"
3403
+ );
3404
+ el.setAttribute("tabindex", "0");
3405
+ }
3406
+ if (listbox) {
3407
+ setInteractive();
3408
+ el.setAttribute("role", "option");
3409
+ el.setAttribute("tabindex", "0");
3410
+ } else if (modifiers.includes("interactive")) {
3411
+ setInteractive();
3412
+ } else {
3413
+ el.setAttribute("tabindex", "-1");
3414
+ }
3415
+ });
3416
+ }
3417
+
3192
3418
  // src/components/menu.js
3193
3419
  function menu_default(Alpine) {
3194
3420
  Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
@@ -3205,11 +3431,18 @@
3205
3431
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3206
3432
  throw new Error('h-menu: must have an "aria-label" or "aria-labelledby" attribute');
3207
3433
  }
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");
3434
+ const isSubmenu = modifiers.includes("sub");
3435
+ const menuTrigger = (() => {
3436
+ if (isSubmenu) return;
3437
+ let sibling = el.previousElementSibling;
3438
+ while (sibling && !sibling.hasOwnProperty("_menu_trigger")) {
3439
+ sibling = sibling.previousElementSibling;
3440
+ }
3441
+ return sibling;
3442
+ })();
3443
+ if (!isSubmenu && !menuTrigger) {
3444
+ throw new Error("h-menu: menu must be placed after an h-menu-trigger element");
3211
3445
  }
3212
- let isSubmenu = modifiers.includes("sub");
3213
3446
  let menuSubItem;
3214
3447
  if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
3215
3448
  function listenForTrigger(listen) {
@@ -3268,12 +3501,17 @@
3268
3501
  switch (event.key) {
3269
3502
  case "Left":
3270
3503
  case "ArrowLeft":
3504
+ if (isSubmenu) {
3505
+ Alpine2.nextTick(() => menuSubItem.focus());
3506
+ close();
3507
+ }
3508
+ break;
3271
3509
  case "Esc":
3272
3510
  case "Escape":
3273
- close();
3274
3511
  if (isSubmenu) {
3275
- setTimeout(() => menuSubItem.focus(), 0);
3512
+ Alpine2.nextTick(() => menuSubItem.focus());
3276
3513
  }
3514
+ close();
3277
3515
  break;
3278
3516
  case "Tab":
3279
3517
  case " ":
@@ -3365,16 +3603,19 @@
3365
3603
  })
3366
3604
  ]
3367
3605
  }).then(({ x, y }) => {
3606
+ if (!isSubmenu) {
3607
+ Alpine2.nextTick(() => el.focus());
3608
+ listenForTrigger(false);
3609
+ }
3610
+ Alpine2.nextTick(() => {
3611
+ top.addEventListener("contextmenu", onClick);
3612
+ top.addEventListener("click", onClick);
3613
+ el.addEventListener("keydown", onKeydown);
3614
+ });
3368
3615
  Object.assign(el.style, {
3369
3616
  left: `${x}px`,
3370
3617
  top: `${y}px`
3371
3618
  });
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
3619
  });
3379
3620
  }
3380
3621
  }
@@ -3628,27 +3869,19 @@
3628
3869
  el.setAttribute("role", "menuitemcheckbox");
3629
3870
  el.setAttribute("data-slot", "menu-checkbox-item");
3630
3871
  function setState(checked, dispatch = true) {
3631
- el.setAttribute("aria-checked", checked);
3632
3872
  if (dispatch)
3633
- setTimeout(() => {
3873
+ Alpine2.nextTick(() => {
3634
3874
  el.dispatchEvent(new Event("change", { bubbles: true }));
3635
- }, 0);
3875
+ });
3876
+ el.setAttribute("aria-checked", checked);
3636
3877
  }
3637
3878
  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
- }
3879
+ let handler2 = function() {
3646
3880
  el._x_model.set(!el._x_model.get());
3647
3881
  setState(el._x_model.get());
3648
3882
  };
3649
3883
  setState(el._x_model.get(), false);
3650
3884
  el.addEventListener("click", handler2);
3651
- el.addEventListener("keydown", handler2);
3652
3885
  }
3653
3886
  const menu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
3654
3887
  function focusOut(event) {
@@ -3854,14 +4087,13 @@
3854
4087
 
3855
4088
  // src/components/popover.js
3856
4089
  function popover_default(Alpine) {
3857
- Alpine.directive("h-popover", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
4090
+ Alpine.directive("h-popover-trigger", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2, cleanup }) => {
3858
4091
  el._popover = Alpine2.reactive({
3859
4092
  id: void 0,
3860
4093
  controls: `hpc${v4_default()}`,
3861
- auto: modifiers.includes("auto"),
4094
+ auto: expression ? false : true,
3862
4095
  expanded: expression ? evaluate2(expression) : false
3863
4096
  });
3864
- el.setAttribute("data-slot", "popover");
3865
4097
  if (expression) {
3866
4098
  const getExpanded = evaluateLater(expression);
3867
4099
  effect(() => {
@@ -3870,43 +4102,39 @@
3870
4102
  });
3871
4103
  });
3872
4104
  }
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
4105
  el.setAttribute("type", "button");
3880
4106
  if (modifiers.includes("chevron")) {
3881
4107
  el.classList.add("[&_svg]:transition-transform", "[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180");
3882
4108
  }
3883
4109
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "popover-trigger");
3884
4110
  if (el.hasAttribute("id")) {
3885
- popover._popover.id = el.getAttribute("id");
4111
+ el._popover.id = el.getAttribute("id");
3886
4112
  } else {
3887
- popover._popover.id = `hp${v4_default()}`;
3888
- el.setAttribute("id", popover._popover.id);
4113
+ el._popover.id = `hp${v4_default()}`;
4114
+ el.setAttribute("id", el._popover.id);
3889
4115
  }
3890
- el.setAttribute("aria-controls", popover._popover.controls);
4116
+ el.setAttribute("aria-controls", el._popover.controls);
3891
4117
  el.setAttribute("aria-haspopup", "dialog");
3892
4118
  const setAttributes = () => {
3893
- el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
3894
- el.setAttribute("aria-expanded", popover._popover.expanded);
4119
+ el.setAttribute("data-state", el._popover.expanded ? "open" : "closed");
4120
+ el.setAttribute("aria-expanded", el._popover.expanded);
3895
4121
  };
3896
4122
  const close = () => {
3897
- popover._popover.expanded = false;
4123
+ el._popover.expanded = false;
4124
+ el.addEventListener("click", handler2);
3898
4125
  };
3899
4126
  const handler2 = () => {
3900
- popover._popover.expanded = !popover._popover.expanded;
4127
+ el._popover.expanded = !el._popover.expanded;
3901
4128
  setAttributes();
3902
4129
  Alpine2.nextTick(() => {
3903
- if (popover._popover.auto && popover._popover.expanded) {
4130
+ if (el._popover.auto && el._popover.expanded) {
3904
4131
  top.addEventListener("click", close, { once: true });
4132
+ el.removeEventListener("click", handler2);
3905
4133
  }
3906
4134
  });
3907
4135
  };
3908
4136
  setAttributes();
3909
- if (popover._popover.auto) {
4137
+ if (el._popover.auto) {
3910
4138
  el.addEventListener("click", handler2);
3911
4139
  cleanup(() => {
3912
4140
  el.removeEventListener("click", handler2);
@@ -3918,13 +4146,19 @@
3918
4146
  });
3919
4147
  }
3920
4148
  });
3921
- Alpine.directive("h-popover-content", (el, { modifiers }, { effect, Alpine: Alpine2 }) => {
3922
- const popover = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_popover"));
4149
+ Alpine.directive("h-popover", (el, { modifiers }, { effect }) => {
4150
+ const popover = (() => {
4151
+ let sibling = el.previousElementSibling;
4152
+ while (sibling && !sibling.hasOwnProperty("_popover")) {
4153
+ sibling = sibling.previousElementSibling;
4154
+ }
4155
+ return sibling;
4156
+ })();
3923
4157
  if (!popover) {
3924
- throw new Error("h-popover-content must be inside an h-popover element");
4158
+ throw new Error("h-popover-content must be placed after an h-popover element");
3925
4159
  }
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");
4160
+ 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");
4161
+ el.setAttribute("data-slot", "popover");
3928
4162
  el.setAttribute("role", "dialog");
3929
4163
  el.setAttribute("tabindex", "-1");
3930
4164
  el.setAttribute("id", popover._popover.controls);
@@ -3935,13 +4169,9 @@
3935
4169
  el.classList.remove("overflow-scroll");
3936
4170
  el.classList.add("overflow-none");
3937
4171
  }
3938
- const control = popover.querySelector(`#${popover._popover.id}`);
3939
- if (!control) {
3940
- throw new Error("h-popover-content: trigger not found");
3941
- }
3942
4172
  let autoUpdateCleanup;
3943
4173
  function updatePosition() {
3944
- computePosition2(control, el, {
4174
+ computePosition2(popover, el, {
3945
4175
  placement: el.getAttribute("data-align") || "bottom-start",
3946
4176
  middleware: [
3947
4177
  offset2(4),
@@ -3966,7 +4196,7 @@
3966
4196
  effect(() => {
3967
4197
  el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
3968
4198
  if (popover._popover.expanded) {
3969
- autoUpdateCleanup = autoUpdate(control, el, updatePosition);
4199
+ autoUpdateCleanup = autoUpdate(popover, el, updatePosition);
3970
4200
  } else {
3971
4201
  if (autoUpdateCleanup) autoUpdateCleanup();
3972
4202
  Object.assign(el.style, {
@@ -4005,40 +4235,48 @@
4005
4235
  function radio_default(Alpine) {
4006
4236
  Alpine.directive("h-radio", (el) => {
4007
4237
  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",
4238
+ "[&>input]:absolute",
4239
+ "[&>input]:appearance-none",
4240
+ "[&>input]:bg-transparent",
4241
+ "[&>input]:border-0",
4242
+ "[&>input]:cursor-pointer",
4243
+ "[&>input]:focus-visible:border-ring",
4244
+ "[&>input]:focus-visible:ring-[3px]",
4245
+ "[&>input]:focus-visible:ring-ring/50",
4246
+ "[&>input]:left-0",
4247
+ "[&>input]:outline-none",
4248
+ "[&>input]:rounded-full",
4249
+ "[&>input]:size-full",
4250
+ "[&>input]:top-0",
4020
4251
  "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
4252
  "before:bg-clip-padding",
4034
- "before:rounded-full",
4035
- "before:h-full",
4036
- "before:w-full",
4037
4253
  "before:bg-primary",
4038
- "before:border-input-inner",
4254
+ "before:block",
4039
4255
  "before:border-3",
4040
- "not-checked:before:hidden"
4256
+ "before:border-transparent",
4257
+ "before:invisible",
4258
+ "before:pointer-events-none",
4259
+ "before:rounded-full",
4260
+ "before:size-full",
4261
+ "bg-input-inner",
4262
+ "border",
4263
+ "border-input",
4264
+ "dark:has-[aria-invalid=true]:ring-negative/40",
4265
+ "dark:has-[input:invalid]:ring-negative/40",
4266
+ "has-[aria-invalid=true]:border-negative",
4267
+ "has-[aria-invalid=true]:ring-negative/20",
4268
+ "has-[input:checked]:before:visible",
4269
+ "has-[input:disabled]:cursor-not-allowed",
4270
+ "has-[input:disabled]:opacity-50",
4271
+ "has-[input:invalid]:border-negative",
4272
+ "has-[input:invalid]:ring-negative/20",
4273
+ "relative",
4274
+ "rounded-full",
4275
+ "shadow-control",
4276
+ "shrink-0",
4277
+ "size-5"
4041
4278
  );
4279
+ el.setAttribute("tabindex", "-1");
4042
4280
  el.setAttribute("data-slot", "radio");
4043
4281
  });
4044
4282
  }
@@ -5950,10 +6188,28 @@
5950
6188
  select._select.multiple = Array.isArray(el._x_model.get());
5951
6189
  select._select.model = el._x_model.get();
5952
6190
  }
6191
+ setButtonClasses(el);
6192
+ const setVariant = (variant) => {
6193
+ if (variant === "secondary") {
6194
+ el.classList.add(...buttonVariants["default"]);
6195
+ return;
6196
+ } else if (variant === "transparent") {
6197
+ el.classList.add(...buttonVariants["transparent"]);
6198
+ } else el.classList.add("shadow-control", ...buttonVariants["outline"]);
6199
+ };
6200
+ const setSize = (size3) => {
6201
+ const sizes = ["sm", "xs", "lg"];
6202
+ if (sizes.includes(size3)) {
6203
+ el.classList.add(...getButtonSize(size3));
6204
+ } else el.classList.add(...getButtonSize());
6205
+ };
6206
+ setVariant(el.getAttribute("data-variant"));
6207
+ setSize(el.getAttribute("data-size"));
6208
+ el.classList.add("w-full", "[&_svg]:opacity-50", "[&[data-state=open]>svg]:rotate-180");
5953
6209
  el.setAttribute("type", "button");
5954
6210
  const selectValue = document.createElement("span");
5955
6211
  selectValue.setAttribute("data-slot", "select-value");
5956
- selectValue.classList.add("pointer-events-none");
6212
+ selectValue.classList.add("text-left", "truncate", "pointer-events-none", "w-full");
5957
6213
  function getPlaceholder() {
5958
6214
  if (!el.value) {
5959
6215
  const value = el.getAttribute("placeholder");
@@ -5968,17 +6224,15 @@
5968
6224
  getPlaceholder();
5969
6225
  const observer = new MutationObserver((mutations) => {
5970
6226
  mutations.forEach((mutation) => {
5971
- if (mutation.type === "attributes") {
5972
- if (mutation.attributeName === "value") {
5973
- el.dispatchEvent(new Event("change", { bubbles: true }));
5974
- if (el.value) selectValue.classList.remove("text-muted-foreground");
5975
- } else if (mutation.attributeName === "placeholder" && !select._select.label.length) {
5976
- getPlaceholder();
5977
- }
6227
+ if (mutation.attributeName === "value") {
6228
+ el.dispatchEvent(new Event("change", { bubbles: true }));
6229
+ if (el.value) selectValue.classList.remove("text-muted-foreground");
6230
+ } else if (mutation.attributeName === "placeholder" && !select._select.label.length) {
6231
+ getPlaceholder();
5978
6232
  }
5979
6233
  });
5980
6234
  });
5981
- observer.observe(el, { attributes: true });
6235
+ observer.observe(el, { attributes: true, attributeFilter: ["value", "placeholder"] });
5982
6236
  effect(() => {
5983
6237
  if (select._select.label.length === 1) {
5984
6238
  selectValue.innerText = select._select.label[0];
@@ -5988,48 +6242,6 @@
5988
6242
  getPlaceholder();
5989
6243
  }
5990
6244
  });
5991
- el.classList.add(
5992
- "[&>*]:pointer-events-none",
5993
- "cursor-pointer",
5994
- "border-input",
5995
- "focus-visible:border-ring",
5996
- "focus-visible:ring-ring/50",
5997
- "aria-invalid:ring-negative/20",
5998
- "dark:aria-invalid:ring-negative/40",
5999
- "aria-invalid:border-negative",
6000
- "invalid:ring-negative/20",
6001
- "dark:invalid:ring-negative/40",
6002
- "invalid:border-negative",
6003
- "hover:bg-secondary-hover",
6004
- "active:bg-secondary-active",
6005
- "flex",
6006
- "w-full",
6007
- "items-center",
6008
- "justify-between",
6009
- "gap-2",
6010
- "rounded-control",
6011
- "border",
6012
- "bg-input-inner",
6013
- "px-3",
6014
- "text-sm",
6015
- "whitespace-nowrap",
6016
- "shadow-control",
6017
- "transition-[color,box-shadow]",
6018
- "outline-none",
6019
- "focus-visible:ring-[3px]",
6020
- "disabled:cursor-not-allowed",
6021
- "disabled:opacity-50",
6022
- "*:data-[slot=select-value]:line-clamp-1",
6023
- "*:data-[slot=select-value]:flex",
6024
- "*:data-[slot=select-value]:items-center",
6025
- "*:data-[slot=select-value]:gap-2",
6026
- "[&_svg]:pointer-events-none",
6027
- "[&_svg]:shrink-0",
6028
- "[&_svg:not([class*='size-'])]:size-4",
6029
- "[&_svg]:size-4",
6030
- "[&_svg]:opacity-50",
6031
- "[&[data-state=open]>svg]:rotate-180"
6032
- );
6033
6245
  el.setAttribute("data-slot", "select-trigger");
6034
6246
  if (el.hasAttribute("id")) {
6035
6247
  select._select.id = el.getAttribute("id");
@@ -6041,21 +6253,6 @@
6041
6253
  el.setAttribute("aria-haspopup", "listbox");
6042
6254
  el.setAttribute("aria-autocomplete", "none");
6043
6255
  el.setAttribute("role", "combobox");
6044
- const sizes = {
6045
- default: ["h-9", "py-2"],
6046
- xs: ["h-6.5", "py-[0.188rem]"],
6047
- sm: ["h-8", "py-1.5"]
6048
- };
6049
- function setSize(size3) {
6050
- for (const [_, value] of Object.entries(sizes)) {
6051
- el.classList.remove(...value);
6052
- }
6053
- if (sizes.hasOwnProperty(size3)) {
6054
- el.classList.add(...sizes[size3]);
6055
- }
6056
- }
6057
- if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
6058
- setSize(el.getAttribute("data-size"));
6059
6256
  effect(() => {
6060
6257
  el.setAttribute("data-state", select._select.expanded ? "open" : "closed");
6061
6258
  el.setAttribute("aria-expanded", select._select.expanded);
@@ -6140,7 +6337,7 @@
6140
6337
  if (!select) {
6141
6338
  throw new Error("h-select-content must be inside an h-select element");
6142
6339
  }
6143
- el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-control", "border", "shadow-md");
6340
+ el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "shadow-md");
6144
6341
  el.setAttribute("data-slot", "select-content");
6145
6342
  el.setAttribute("role", "listbox");
6146
6343
  el.setAttribute("role", "presentation");
@@ -6272,7 +6469,7 @@
6272
6469
  "cursor-default",
6273
6470
  "items-center",
6274
6471
  "gap-2",
6275
- "rounded-control",
6472
+ "rounded-sm",
6276
6473
  "py-1.5",
6277
6474
  "pr-8",
6278
6475
  "pl-2",
@@ -6418,21 +6615,36 @@
6418
6615
 
6419
6616
  // src/components/sidebar.js
6420
6617
  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)");
6618
+ Alpine.directive("h-sidebar", (el, { modifiers }, { cleanup }) => {
6619
+ 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
6620
  if (modifiers.includes("right")) el.classList.add("border-l");
6427
6621
  else el.classList.add("border-r");
6428
6622
  el.setAttribute("data-slot", "sidebar");
6623
+ const setFloating = () => {
6624
+ if (el.getAttribute("data-floating") === "true") {
6625
+ el.classList.add("border", "rounded-lg", "shadow-sm");
6626
+ } else {
6627
+ el.classList.remove("border", "rounded-lg", "shadow-sm");
6628
+ }
6629
+ };
6630
+ setFloating();
6631
+ const observer = new MutationObserver((mutations) => {
6632
+ mutations.forEach(() => {
6633
+ setFloating();
6634
+ });
6635
+ });
6636
+ observer.observe(el, { attributes: true, attributeFilter: ["data-floating"] });
6637
+ cleanup(() => {
6638
+ observer.disconnect();
6639
+ });
6429
6640
  });
6430
6641
  Alpine.directive("h-sidebar-header", (el) => {
6431
- el.classList.add("vbox", "gap-2", "p-2");
6642
+ el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-b");
6643
+ if (el.dataset.borderless && el.dataset.borderless === "true") el.classList.remove("border-b");
6432
6644
  el.setAttribute("data-slot", "sidebar-header");
6433
6645
  });
6434
6646
  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");
6647
+ el.classList.add("vbox", "min-h-0", "flex-1", "gap-2", "overflow-auto", "group-data-[collapsed=true]/sidebar:overflow-hidden");
6436
6648
  el.setAttribute("data-slot", "sidebar-content");
6437
6649
  });
6438
6650
  Alpine.directive("h-sidebar-group", (el) => {
@@ -6458,8 +6670,7 @@
6458
6670
  "focus-visible:ring-2",
6459
6671
  "[&>svg]:size-4",
6460
6672
  "[&>svg]:shrink-0",
6461
- "group-data-[collapsible=icon]:-mt-8",
6462
- "group-data-[collapsible=icon]:opacity-0"
6673
+ "group-data-[collapsed=true]/sidebar:!hidden"
6463
6674
  );
6464
6675
  if (modifiers.includes("action")) el.classList.add("hover:bg-secondary-hover", "active:bg-secondary-active");
6465
6676
  el.setAttribute("data-slot", "sidebar-group-label");
@@ -6488,7 +6699,7 @@
6488
6699
  "after:absolute",
6489
6700
  "after:-inset-2",
6490
6701
  "md:after:hidden",
6491
- "group-data-[collapsible=icon]:hidden"
6702
+ "group-data-[collapsed=true]/sidebar:hidden"
6492
6703
  );
6493
6704
  el.setAttribute("data-slot", "sidebar-group-action");
6494
6705
  });
@@ -6535,8 +6746,9 @@
6535
6746
  "data-[active=true]:text-sidebar-primary-foreground",
6536
6747
  "data-[state=open]:hover:bg-sidebar-secondary",
6537
6748
  "data-[state=open]:hover:text-sidebar-secondary-foreground",
6538
- "group-data-[collapsible=icon]:size-8!",
6539
- "group-data-[collapsible=icon]:p-2!",
6749
+ "group-data-[collapsed=true]/sidebar:!size-8",
6750
+ "group-data-[collapsed=true]/sidebar:!p-2",
6751
+ "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden",
6540
6752
  "[&>span]:truncate",
6541
6753
  "[&>span]:align-middle",
6542
6754
  "[&>svg]:size-4",
@@ -6547,7 +6759,7 @@
6547
6759
  const sizes = {
6548
6760
  default: ["h-8", "text-sm"],
6549
6761
  sm: ["h-7", "text-xs"],
6550
- lg: ["h-12", "text-sm", "group-data-[collapsible=icon]:p-0!"]
6762
+ lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
6551
6763
  };
6552
6764
  function setSize(size3) {
6553
6765
  if (sizes.hasOwnProperty(size3)) {
@@ -6585,7 +6797,7 @@
6585
6797
  "peer-data-[size=sm]/menu-button:top-1",
6586
6798
  "peer-data-[size=default]/menu-button:top-1.5",
6587
6799
  "peer-data-[size=lg]/menu-button:top-2.5",
6588
- "group-data-[collapsible=icon]:hidden"
6800
+ "group-data-[collapsed=true]/sidebar:hidden"
6589
6801
  );
6590
6802
  if (modifiers.includes("autohide")) {
6591
6803
  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 +6826,7 @@
6614
6826
  "peer-data-[size=sm]/menu-button:top-1",
6615
6827
  "peer-data-[size=default]/menu-button:top-1.5",
6616
6828
  "peer-data-[size=lg]/menu-button:top-2.5",
6617
- "group-data-[collapsible=icon]:hidden"
6829
+ "group-data-[collapsed=true]/sidebar:hidden"
6618
6830
  );
6619
6831
  el.setAttribute("data-slot", "sidebar-menu-badge");
6620
6832
  });
@@ -6637,7 +6849,7 @@
6637
6849
  el.setAttribute("role", "none");
6638
6850
  });
6639
6851
  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");
6852
+ el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:hidden");
6641
6853
  if (!modifiers.includes("flat")) {
6642
6854
  el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
6643
6855
  }
@@ -6680,7 +6892,7 @@
6680
6892
  "[&>svg:not(:first-child):last-child]:ml-auto",
6681
6893
  "data-[active=true]:bg-sidebar-primary",
6682
6894
  "data-[active=true]:text-sidebar-primary-foreground",
6683
- "group-data-[collapsible=icon]:hidden"
6895
+ "group-data-[collapsed=true]/sidebar:hidden"
6684
6896
  );
6685
6897
  el.setAttribute("data-slot", "sidebar-menu-sub-button");
6686
6898
  const sizes = {
@@ -6696,7 +6908,8 @@
6696
6908
  setSize(el.getAttribute("data-size"));
6697
6909
  });
6698
6910
  Alpine.directive("h-sidebar-footer", (el) => {
6699
- el.classList.add("vbox", "gap-2", "p-2");
6911
+ el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
6912
+ if (el.dataset.borderless && el.dataset.borderless === "true") el.classList.remove("border-t");
6700
6913
  el.setAttribute("data-slot", "sidebar-footer");
6701
6914
  });
6702
6915
  }
@@ -6707,10 +6920,21 @@
6707
6920
  el.classList.add("bg-secondary", "animate-pulse");
6708
6921
  if (modifiers.includes("control")) {
6709
6922
  el.classList.add("rounded-control");
6923
+ switch (el.getAttribute("data-size")) {
6924
+ case "xs":
6925
+ el.classList.add("h-6.5");
6926
+ break;
6927
+ case "sm":
6928
+ el.classList.add("h-8");
6929
+ break;
6930
+ default:
6931
+ el.classList.add("h-9");
6932
+ break;
6933
+ }
6710
6934
  } else if (modifiers.includes("card")) {
6711
- el.classList.add("rounded-xl");
6935
+ el.classList.add("rounded-lg");
6712
6936
  } else if (modifiers.includes("avatar")) {
6713
- el.classList.add("rounded-full", "size-8");
6937
+ el.classList.add("rounded-full", "size-8", "aspect-square");
6714
6938
  } else el.classList.add("rounded-md");
6715
6939
  el.setAttribute("data-slot", "skeleton");
6716
6940
  });
@@ -6728,52 +6952,53 @@
6728
6952
 
6729
6953
  // src/components/switch.js
6730
6954
  function switch_default(Alpine) {
6731
- Alpine.directive("h-switch", (el, {}, { cleanup }) => {
6955
+ Alpine.directive("h-switch", (el) => {
6732
6956
  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",
6957
+ "[&>input]:absolute",
6958
+ "[&>input]:appearance-none",
6959
+ "[&>input]:bg-transparent",
6960
+ "[&>input]:border-0",
6961
+ "[&>input]:cursor-pointer",
6962
+ "[&>input]:focus-visible:border-ring",
6963
+ "[&>input]:focus-visible:ring-[3px]",
6964
+ "[&>input]:focus-visible:ring-ring/50",
6965
+ "[&>input]:left-0",
6966
+ "[&>input]:outline-none",
6967
+ "[&>input]:rounded-full",
6968
+ "[&>input]:size-full",
6969
+ "[&>input]:top-0",
6757
6970
  "before:bg-background",
6971
+ "before:duration-200",
6972
+ "before:inline-block",
6973
+ "before:m-[1px]",
6758
6974
  "before:pointer-events-none",
6759
- "data-[size=sm]:before:size-4",
6760
- "before:size-5",
6761
- "before:rounded-full",
6762
6975
  "before:ring-0",
6976
+ "before:rounded-full",
6977
+ "before:shadow-control",
6978
+ "before:size-5",
6763
6979
  "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]"
6980
+ "bg-muted",
6981
+ "border",
6982
+ "data-[size=sm]:before:size-4",
6983
+ "data-[size=sm]:h-5",
6984
+ "data-[size=sm]:max-w-8",
6985
+ "data-[size=sm]:min-w-8",
6986
+ "duration-200",
6987
+ "h-6",
6988
+ "has-[input:checked]:before:translate-x-[calc(100%-var(--spacing)*1)]",
6989
+ "has-[input:checked]:bg-primary",
6990
+ "has-[input:checked]:border-primary-active",
6991
+ "has-[input:disabled]:cursor-not-allowed",
6992
+ "has-[input:disabled]:opacity-50",
6993
+ "max-w-10",
6994
+ "min-w-10",
6995
+ "relative",
6996
+ "rounded-full",
6997
+ "shrink-0",
6998
+ "transition-color"
6767
6999
  );
7000
+ el.setAttribute("tabindex", "-1");
6768
7001
  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
7002
  });
6778
7003
  }
6779
7004
 
@@ -6811,19 +7036,60 @@
6811
7036
  el.setAttribute("data-slot", "table-header");
6812
7037
  });
6813
7038
  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");
7039
+ el.classList.add(
7040
+ "text-foreground",
7041
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7042
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7043
+ "[&[data-activable=true]:active]:!bg-table-active",
7044
+ "[&[data-activable=true]:active]:!text-table-active-foreground",
7045
+ "h-10",
7046
+ "px-2",
7047
+ "text-left",
7048
+ "align-middle",
7049
+ "font-medium",
7050
+ "whitespace-nowrap",
7051
+ "[&:has([role=checkbox])]:pr-0",
7052
+ "[&>[role=checkbox]]:flex",
7053
+ "[&>[role=checkbox]]:items-center"
7054
+ );
6815
7055
  el.setAttribute("data-slot", "table-head");
6816
7056
  });
6817
7057
  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");
7058
+ el.classList.add(
7059
+ "p-2",
7060
+ "align-middle",
7061
+ "whitespace-nowrap",
7062
+ "[&:has([role=checkbox])]:pr-0",
7063
+ "[&>[role=checkbox]]:flex",
7064
+ "[&>[role=checkbox]]:items-center",
7065
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7066
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7067
+ "[&[data-activable=true]:active]:!bg-table-active",
7068
+ "[&[data-activable=true]:active]:!text-table-active-foreground"
7069
+ );
6819
7070
  el.setAttribute("data-slot", "table-cell");
6820
7071
  });
6821
7072
  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");
7073
+ el.classList.add(
7074
+ "[&_tr:last-child_td]:border-b-0",
7075
+ "[&_tr:last-child_th]:border-b-0",
7076
+ "[&_tr_th]:bg-table-header",
7077
+ "[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
7078
+ "[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
7079
+ "[&_tr[data-activable=true]:active_th]:!bg-table-active",
7080
+ "[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
7081
+ );
6823
7082
  el.setAttribute("data-slot", "table-body");
6824
7083
  });
6825
7084
  Alpine.directive("h-table-row", (el) => {
6826
- el.classList.add("hover:bg-table-hover", "hover:text-table-hover-foreground", "data-[state=selected]:bg-muted");
7085
+ el.classList.add(
7086
+ "[&[data-hoverable=true]:hover]:bg-table-hover",
7087
+ "[&[data-hoverable=true]:hover]:text-table-hover-foreground",
7088
+ "[&[data-activable=true]:active]:!bg-table-active",
7089
+ "[&[data-activable=true]:active]:!text-table-active-foreground",
7090
+ "data-[state=selected]:bg-table-active",
7091
+ "data-[state=selected]:text-table-active-foreground"
7092
+ );
6827
7093
  el.setAttribute("data-slot", "table-row");
6828
7094
  });
6829
7095
  Alpine.directive("h-table-caption", (el) => {
@@ -6846,18 +7112,23 @@
6846
7112
  el.classList.add(
6847
7113
  "group/tab-bar",
6848
7114
  "flex",
6849
- "gap-1.5",
7115
+ "gap-1",
6850
7116
  "bg-object-header",
6851
7117
  "text-object-header-foreground",
6852
7118
  "group-data-[orientation=horizontal]/tabs:flex-row",
6853
7119
  "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]"
7120
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:inset-shadow-[0_-.063rem_var(--border)]",
7121
+ "[&:not([data-floating=true])]:group-data-[orientation=vertical]/tabs:inset-shadow-[-.063rem_0_var(--border)]",
7122
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:h-10",
7123
+ "[&:not([data-floating=true])]:group-data-[orientation=horizontal]/tabs:min-h-10",
7124
+ "[&:not([data-floating=true])]:data-[size=sm]:group-data-[orientation=horizontal]/tabs:h-8",
7125
+ "[&:not([data-floating=true])]:data-[size=sm]:group-data-[orientation=horizontal]/tabs:min-h-8",
7126
+ "[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:h-12",
7127
+ "[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:min-h-12",
7128
+ "data-[floating=true]:border",
7129
+ "data-[floating=true]:shadow-xs",
7130
+ "data-[floating=true]:rounded-lg",
7131
+ "data-[floating=true]:p-[0.188rem]"
6861
7132
  );
6862
7133
  el.setAttribute("data-slot", "tab-bar");
6863
7134
  });
@@ -6870,8 +7141,8 @@
6870
7141
  "group-data-[orientation=horizontal]/tabs:flex-row",
6871
7142
  "group-data-[orientation=vertical]/tabs:flex-col",
6872
7143
  "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"
7144
+ "gap-2",
7145
+ "group-data-[floating=true]/tab-bar:gap-1"
6875
7146
  );
6876
7147
  el.setAttribute("role", "tablist");
6877
7148
  el.setAttribute("data-slot", "tab-list");
@@ -6887,8 +7158,7 @@
6887
7158
  "aria-selected:text-foreground",
6888
7159
  "inline-flex",
6889
7160
  "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",
7161
+ "group-data-[orientation=vertical]/tabs:h-8",
6892
7162
  "group-data-[orientation=horizontal]/tabs:h-full",
6893
7163
  "items-center",
6894
7164
  "justify-start",
@@ -6899,21 +7169,21 @@
6899
7169
  "font-medium",
6900
7170
  "whitespace-nowrap",
6901
7171
  "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)]",
7172
+ "group-data-[floating=true]/tab-bar:rounded-md",
7173
+ "group-data-[floating=true]/tab-bar:border",
7174
+ "group-data-[floating=true]/tab-bar:border-transparent",
7175
+ "group-data-[floating=true]/tab-bar:aria-selected:bg-background",
7176
+ "group-data-[floating=true]/tab-bar:aria-selected:border-border",
7177
+ "group-data-[floating=true]/tab-bar:hover:bg-background",
7178
+ "group-data-[floating=true]/tab-bar:hover:border-border",
7179
+ "group-[&:not([data-floating=true])]/tab-bar:border-0",
7180
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:inset-shadow-[0_-.188rem_var(--border)]",
7181
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:aria-selected:inset-shadow-[0_-.125rem_var(--primary)]",
7182
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:hover:aria-selected:inset-shadow-[0_-.188rem_var(--primary)]",
7183
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:px-3",
7184
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:hover:inset-shadow-[-.188rem_0_var(--border)]",
7185
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:aria-selected:inset-shadow-[-.125rem_0_var(--primary)]",
7186
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:hover:aria-selected:inset-shadow-[-.188rem_0_var(--primary)]",
6917
7187
  "focus-visible:ring-[3px]",
6918
7188
  "focus-visible:outline-1",
6919
7189
  "disabled:pointer-events-none",
@@ -6937,12 +7207,28 @@
6937
7207
  if (modifiers.includes("end"))
6938
7208
  el.classList.add(
6939
7209
  "group-data-[orientation=horizontal]/tabs:ml-auto",
6940
- "group-data-[style=inline]/tab-bar:group-data-[orientation=horizontal]/tabs:mr-1.5",
7210
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:mr-1.5",
6941
7211
  "group-data-[orientation=vertical]/tabs:mt-auto",
6942
- "group-data-[style=inline]/tab-bar:group-data-[orientation=vertical]/tabs:mb-1.5"
7212
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:mb-1.5"
6943
7213
  );
6944
7214
  el.setAttribute("data-slot", "tab-list-actions");
6945
7215
  });
7216
+ Alpine.directive("h-tab-list-action", (el) => {
7217
+ setButtonClasses(el);
7218
+ el.classList.add(
7219
+ "group-data-[floating=true]/tab-bar:rounded-md",
7220
+ "group-data-[orientation=horizontal]/tabs:aspect-square",
7221
+ "group-data-[orientation=horizontal]/tabs:w-auto",
7222
+ "group-data-[floating=true]/tab-bar:group-data-[orientation=horizontal]/tabs:h-full",
7223
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=horizontal]/tabs:h-[75%]",
7224
+ "group-data-[orientation=vertical]/tabs:h-9",
7225
+ "group-data-[floating=true]/tab-bar:group-data-[orientation=vertical]/tabs:w-full",
7226
+ "group-[&:not([data-floating=true])]/tab-bar:group-data-[orientation=vertical]/tabs:w-[80%]"
7227
+ );
7228
+ el.classList.add(...buttonVariants[el.getAttribute("data-variant") ?? "outline"]);
7229
+ el.setAttribute("role", "button");
7230
+ el.setAttribute("data-slot", "tab-list-action");
7231
+ });
6946
7232
  Alpine.directive("h-tabs-content", (el) => {
6947
7233
  el.classList.add("flex-1", "outline-none");
6948
7234
  el.setAttribute("role", "tabpanel");
@@ -7011,8 +7297,11 @@
7011
7297
  case "blockquote":
7012
7298
  el.classList.add("mt-6", "border-l-2", "pl-6", "italic");
7013
7299
  break;
7300
+ case "code-inline":
7301
+ el.classList.add("bg-muted", "relative", "rounded", "px-[0.3rem]", "py-[0.2rem]", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
7302
+ break;
7014
7303
  case "code":
7015
- el.classList.add("bg-muted", "relative", "rounded", "px-[0.3rem]", "py-[0.2rem]", "font-mono", "text-sm", "font-semibold");
7304
+ el.classList.add("bg-muted", "relative", "rounded", "p-3", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
7016
7305
  break;
7017
7306
  case "lead":
7018
7307
  el.classList.add("text-muted-foreground", "text-xl");
@@ -7046,9 +7335,9 @@
7046
7335
  "aria-invalid:ring-negative/20",
7047
7336
  "dark:aria-invalid:ring-negative/40",
7048
7337
  "aria-invalid:border-negative",
7049
- "invalid:ring-negative/20",
7050
- "dark:invalid:ring-negative/40",
7051
- "invalid:border-negative",
7338
+ "invalid:!ring-negative/20",
7339
+ "dark:invalid:!ring-negative/40",
7340
+ "invalid:!border-negative",
7052
7341
  "bg-input-inner",
7053
7342
  "flex",
7054
7343
  "field-sizing-content",
@@ -7088,7 +7377,7 @@
7088
7377
  "flex",
7089
7378
  "items-center",
7090
7379
  "text-sm",
7091
- "rounded-xl",
7380
+ "rounded-lg",
7092
7381
  "transition-colors",
7093
7382
  "[a]:hover:bg-secondary-hover",
7094
7383
  "[a]:hover:text-secondary-foreground",
@@ -7136,10 +7425,10 @@
7136
7425
  el.setAttribute("data-slot", "tile-media");
7137
7426
  switch (el.getAttribute("data-variant")) {
7138
7427
  case "icon":
7139
- el.classList.add("size-8", "border", "rounded-xl", "bg-muted", "[&_svg:not([class*='size-'])]:size-4");
7428
+ el.classList.add("size-8", "border", "rounded-lg", "bg-muted", "[&_svg:not([class*='size-'])]:size-4");
7140
7429
  break;
7141
7430
  case "image":
7142
- el.classList.add("size-10", "rounded-xl", "overflow-hidden", "[&_img]:size-full", "[&_img]:object-cover");
7431
+ el.classList.add("size-10", "rounded-lg", "overflow-hidden", "[&_img]:size-full", "[&_img]:object-cover");
7143
7432
  break;
7144
7433
  default:
7145
7434
  el.classList.add("bg-transparent");
@@ -7233,14 +7522,16 @@
7233
7522
  el.classList.add(
7234
7523
  "cursor-pointer",
7235
7524
  "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",
7525
+ "[&>input]:appearance-none",
7526
+ "has-[input:focus-visible]:border-ring",
7527
+ "has-[input:focus-visible]:ring-[3px]",
7528
+ "has-[input:focus-visible]:ring-ring/50",
7529
+ "dark:has-[aria-invalid=true]:ring-negative/40",
7530
+ "dark:has-[input:invalid]:ring-negative/40",
7531
+ "has-[aria-invalid=true]:border-negative",
7532
+ "has-[aria-invalid=true]:ring-negative/20",
7533
+ "has-[input:invalid]:border-negative",
7534
+ "has-[input:invalid]:ring-negative/20",
7244
7535
  "hover:bg-secondary-hover",
7245
7536
  "active:bg-secondary-active",
7246
7537
  "flex",
@@ -7258,8 +7549,8 @@
7258
7549
  "whitespace-nowrap",
7259
7550
  "shadow-control",
7260
7551
  "transition-[color,box-shadow]",
7552
+ "duration-200",
7261
7553
  "outline-none",
7262
- "focus-visible:ring-[3px]",
7263
7554
  "has-[input:disabled]:pointer-events-none",
7264
7555
  "has-[input:disabled]:opacity-50",
7265
7556
  "[&_svg]:pointer-events-none",
@@ -7268,6 +7559,7 @@
7268
7559
  "[&_svg]:opacity-50"
7269
7560
  );
7270
7561
  el.setAttribute("data-slot", "time-picker");
7562
+ el.setAttribute("tabindex", "-1");
7271
7563
  el.appendChild(
7272
7564
  createElement(Clock, {
7273
7565
  class: ["opacity-50 size-4 transition-transform duration-200"],
@@ -7295,7 +7587,8 @@
7295
7587
  } else {
7296
7588
  el._timepicker.is12Hour = new Intl.DateTimeFormat(el._timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
7297
7589
  }
7298
- const handler2 = () => {
7590
+ const handler2 = (event) => {
7591
+ if (event.type === "keydown" && event.key !== "Enter") return;
7299
7592
  el._timepicker.expanded = !el._timepicker.expanded;
7300
7593
  el.setAttribute("aria-expanded", el._timepicker.expanded);
7301
7594
  Alpine2.nextTick(() => {
@@ -7307,8 +7600,10 @@
7307
7600
  });
7308
7601
  };
7309
7602
  el.addEventListener("click", handler2);
7603
+ el.addEventListener("keydown", handler2);
7310
7604
  cleanup(() => {
7311
7605
  el.removeEventListener("click", handler2);
7606
+ el.removeEventListener("keydown", handler2);
7312
7607
  top.removeEventListener("click", el._timepicker.close);
7313
7608
  });
7314
7609
  });
@@ -7819,59 +8114,59 @@
7819
8114
  "hbox",
7820
8115
  "shrink-0",
7821
8116
  "items-center",
7822
- "px-2",
8117
+ "px-1",
8118
+ 'has-[>[data-slot="avatar"]:last-child]:pr-2',
8119
+ 'has-[>[data-slot="toolbar-image"]:first-child]:pl-2',
7823
8120
  "gap-1",
7824
8121
  modifiers.includes("footer") ? "border-t" : "border-b",
7825
8122
  "w-full",
7826
- "h-11",
8123
+ "h-12",
7827
8124
  "data-[size=sm]:h-8",
8125
+ "data-[size=md]:h-10",
7828
8126
  "data-[variant=transparent]:bg-transparent",
7829
- "data-[variant=transparent]:text-foreground"
8127
+ "data-[variant=transparent]:text-foreground",
8128
+ "data-[floating=true]:shadow-xs",
8129
+ "data-[floating=true]:rounded-lg",
8130
+ "data-[floating=true]:border"
7830
8131
  );
7831
8132
  el.setAttribute("data-slot", "toolbar");
7832
8133
  });
7833
8134
  Alpine.directive("h-toolbar-image", (el) => {
7834
- el.classList.add("size-8", "[[data-size=sm]_&]:size-6");
8135
+ el.classList.add("size-8", "[[data-size=md]_&]:size-7", "[[data-size=sm]_&]:size-6");
7835
8136
  el.setAttribute("data-slot", "toolbar-image");
7836
8137
  });
7837
8138
  Alpine.directive("h-toolbar-title", (el) => {
7838
- el.classList.add("text", "[[data-size=sm]_&]:text-sm", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
8139
+ el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
7839
8140
  el.setAttribute("data-slot", "toolbar-title");
7840
8141
  });
7841
8142
  Alpine.directive("h-toolbar-spacer", (el) => {
7842
8143
  el.classList.add("flex-[1_auto]", "h-full");
8144
+ el.setAttribute("tabindex", "-1");
7843
8145
  el.setAttribute("data-slot", "toolbar-spacer");
7844
8146
  });
7845
8147
  Alpine.directive("h-toolbar-separator", (el) => {
7846
- el.classList.add("w-px", "h-8", "[[data-size=sm]_&]:h-6", "border-l");
8148
+ el.classList.add("w-px", "h-8", "[[data-size=md]_&]:h-6", "[[data-size=sm]_&]:h-6", "border-l");
7847
8149
  el.setAttribute("data-slot", "toolbar-separator");
7848
8150
  });
7849
8151
  }
7850
8152
 
7851
8153
  // src/components/tooltip.js
7852
8154
  function tooltip_default(Alpine) {
7853
- Alpine.directive("h-tooltip", (el, {}, { Alpine: Alpine2 }) => {
8155
+ Alpine.directive("h-tooltip-trigger", (el, {}, { Alpine: Alpine2, cleanup }) => {
7854
8156
  el._tooltip = Alpine2.reactive({
7855
8157
  id: void 0,
7856
8158
  controls: `hpc${v4_default()}`,
7857
8159
  shown: false
7858
8160
  });
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
8161
  if (el.hasAttribute("id")) {
7867
- tooltip._tooltip.id = el.getAttribute("id");
8162
+ el._tooltip.id = el.getAttribute("id");
7868
8163
  } else {
7869
- tooltip._tooltip.id = `hp${v4_default()}`;
7870
- el.setAttribute("id", tooltip._tooltip.id);
8164
+ el._tooltip.id = `hp${v4_default()}`;
8165
+ el.setAttribute("id", el._tooltip.id);
7871
8166
  }
7872
- el.setAttribute("aria-describedby", tooltip._tooltip.controls);
8167
+ el.setAttribute("aria-describedby", el._tooltip.controls);
7873
8168
  const handler2 = (event) => {
7874
- tooltip._tooltip.shown = event.type === "pointerenter";
8169
+ el._tooltip.shown = event.type === "pointerenter";
7875
8170
  };
7876
8171
  el.addEventListener("pointerenter", handler2);
7877
8172
  el.addEventListener("pointerleave", handler2);
@@ -7880,20 +8175,25 @@
7880
8175
  el.removeEventListener("pointerleave", handler2);
7881
8176
  });
7882
8177
  });
7883
- Alpine.directive("h-tooltip-content", (el, {}, { effect, Alpine: Alpine2 }) => {
7884
- const tooltip = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_tooltip"));
8178
+ Alpine.directive("h-tooltip", (el, {}, { effect }) => {
8179
+ const tooltip = (() => {
8180
+ let sibling = el.previousElementSibling;
8181
+ while (sibling && !sibling.hasOwnProperty("_tooltip")) {
8182
+ sibling = sibling.previousElementSibling;
8183
+ }
8184
+ return sibling;
8185
+ })();
7885
8186
  if (!tooltip) {
7886
- throw new Error("h-tooltip-content must be inside an h-tooltip element");
8187
+ throw new Error("h-tooltip must be placed after an h-tooltip-trigger element");
7887
8188
  }
7888
8189
  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");
8190
+ el.setAttribute("data-slot", "tooltip");
7890
8191
  el.setAttribute("id", tooltip._tooltip.controls);
7891
- const control = tooltip.querySelector(`#${tooltip._tooltip.id}`);
7892
8192
  const arrowEl = document.createElement("span");
7893
8193
  arrowEl.classList.add("absolute", "bg-foreground", "fill-foreground", "z-50", "size-2.5", "rotate-45", "rounded-[2px]");
7894
8194
  el.appendChild(arrowEl);
7895
8195
  function updatePosition() {
7896
- computePosition2(control, el, {
8196
+ computePosition2(tooltip, el, {
7897
8197
  placement: "top",
7898
8198
  middleware: [offset2(10), flip2(), shift2({ padding: 4 }), arrow2({ element: arrowEl })]
7899
8199
  }).then(({ x, y, middlewareData, placement }) => {
@@ -7951,20 +8251,55 @@
7951
8251
  };
7952
8252
  var setColorScheme = (mode) => {
7953
8253
  if (mode === "dark") {
8254
+ document.documentElement.classList.add("dark");
7954
8255
  localStorage.setItem(colorSchemeKey, "dark");
7955
8256
  window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", colorSchemeChange);
7956
8257
  } else if (mode === "light") {
8258
+ document.documentElement.classList.remove("dark");
7957
8259
  localStorage.setItem(colorSchemeKey, "light");
7958
8260
  window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", colorSchemeChange);
7959
8261
  } else {
8262
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
8263
+ document.documentElement.classList.add("dark");
8264
+ } else {
8265
+ document.documentElement.classList.remove("dark");
8266
+ }
7960
8267
  localStorage.setItem(colorSchemeKey, "auto");
7961
8268
  window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", colorSchemeChange);
7962
8269
  }
7963
8270
  };
8271
+ var getColorScheme = () => {
8272
+ const theme = localStorage.getItem(colorSchemeKey);
8273
+ if (theme) return theme;
8274
+ else if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
8275
+ return "dark";
8276
+ }
8277
+ return "light";
8278
+ };
7964
8279
  initColorScheme();
7965
8280
 
8281
+ // src/utils/breakpoint-listener.js
8282
+ function getBreakpointListener(handler2, breakpoint = 768) {
8283
+ const mql = top.matchMedia(`(width <= ${breakpoint}px)`);
8284
+ const onWidthChange = (event) => {
8285
+ handler2(event.matches);
8286
+ };
8287
+ mql.addEventListener("change", onWidthChange);
8288
+ handler2(mql.matches);
8289
+ return {
8290
+ _mql: mql,
8291
+ _onWidthChange: onWidthChange,
8292
+ remove() {
8293
+ this._mql.removeEventListener("change", this._onWidthChange);
8294
+ }
8295
+ };
8296
+ }
8297
+
8298
+ // package.json
8299
+ var version = "0.5.0";
8300
+
7966
8301
  // src/index.js
7967
- window.Harmonia = { setColorScheme };
8302
+ window.Harmonia = { getBreakpointListener, getColorScheme, setColorScheme, version };
7968
8303
  document.addEventListener("alpine:init", () => {
7969
8304
  window.Alpine.plugin(accordion_default);
7970
8305
  window.Alpine.plugin(alert_default);
@@ -7982,6 +8317,7 @@
7982
8317
  window.Alpine.plugin(info_page_default);
7983
8318
  window.Alpine.plugin(input_default);
7984
8319
  window.Alpine.plugin(label_default);
8320
+ window.Alpine.plugin(list_default);
7985
8321
  window.Alpine.plugin(menu_default);
7986
8322
  window.Alpine.plugin(pagination_default);
7987
8323
  window.Alpine.plugin(popover_default);