@codbex/harmonia 0.4.0 → 0.6.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.css +1 -1
- package/dist/harmonia.esm.js +619 -456
- package/dist/harmonia.esm.min.js +3 -3
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +573 -412
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +1 -1
package/dist/harmonia.esm.js
CHANGED
|
@@ -18425,39 +18425,39 @@ var v4_default = v4;
|
|
|
18425
18425
|
// src/components/accordion.js
|
|
18426
18426
|
function accordion_default(Alpine) {
|
|
18427
18427
|
Alpine.directive("h-accordion", (el, { expression, modifiers }, { Alpine: Alpine2 }) => {
|
|
18428
|
-
el.
|
|
18428
|
+
el._h_accordion = modifiers.includes("single") ? Alpine2.reactive({
|
|
18429
18429
|
single: true,
|
|
18430
18430
|
expandedId: expression ?? ""
|
|
18431
18431
|
}) : { single: false };
|
|
18432
18432
|
el.setAttribute("data-slot", "accordion");
|
|
18433
18433
|
});
|
|
18434
18434
|
Alpine.directive("h-accordion-item", (el, { expression, modifiers }, { effect, Alpine: Alpine2 }) => {
|
|
18435
|
-
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18435
|
+
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
18436
18436
|
if (!accordion) {
|
|
18437
18437
|
throw new Error("h-accordion-item must be inside an h-accordion");
|
|
18438
18438
|
}
|
|
18439
|
-
el.classList.add("border-b", "last:border-b-0");
|
|
18439
|
+
el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
|
|
18440
18440
|
el.setAttribute("data-slot", "accordion-item");
|
|
18441
18441
|
const itemId = expression ?? `ha${v4_default()}`;
|
|
18442
18442
|
function getIsExpanded() {
|
|
18443
|
-
if (accordion.
|
|
18444
|
-
if (accordion.
|
|
18445
|
-
return accordion.
|
|
18443
|
+
if (accordion._h_accordion.single) {
|
|
18444
|
+
if (accordion._h_accordion.expandedId !== "") {
|
|
18445
|
+
return accordion._h_accordion.expandedId === itemId;
|
|
18446
18446
|
} else if (modifiers.includes("default")) {
|
|
18447
|
-
accordion.
|
|
18447
|
+
accordion._h_accordion.expandedId = itemId;
|
|
18448
18448
|
return true;
|
|
18449
18449
|
}
|
|
18450
18450
|
return false;
|
|
18451
18451
|
}
|
|
18452
18452
|
return modifiers.includes("default");
|
|
18453
18453
|
}
|
|
18454
|
-
el.
|
|
18454
|
+
el._h_accordionItem = Alpine2.reactive({
|
|
18455
18455
|
id: itemId,
|
|
18456
18456
|
controls: `ha${v4_default()}`,
|
|
18457
18457
|
expanded: getIsExpanded()
|
|
18458
18458
|
});
|
|
18459
18459
|
const setAttributes = () => {
|
|
18460
|
-
el.setAttribute("data-state", el.
|
|
18460
|
+
el.setAttribute("data-state", el._h_accordionItem.expanded ? "open" : "closed");
|
|
18461
18461
|
};
|
|
18462
18462
|
setAttributes();
|
|
18463
18463
|
effect(setAttributes);
|
|
@@ -18466,12 +18466,23 @@ function accordion_default(Alpine) {
|
|
|
18466
18466
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
18467
18467
|
throw new Error("h-accordion-trigger must be a header element");
|
|
18468
18468
|
}
|
|
18469
|
-
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18470
|
-
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18469
|
+
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
18470
|
+
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordionItem"));
|
|
18471
18471
|
if (!accordionItem || !accordion) {
|
|
18472
18472
|
throw new Error("h-accordion-trigger must be inside an h-accordion-item, which must be inside an h-accordion");
|
|
18473
18473
|
}
|
|
18474
|
-
el.classList.add(
|
|
18474
|
+
el.classList.add(
|
|
18475
|
+
"flex",
|
|
18476
|
+
"h-12",
|
|
18477
|
+
"[[data-size=md]_&]:h-10",
|
|
18478
|
+
"[[data-size=sm]_&]:h-8",
|
|
18479
|
+
"[[data-variant=header]_&]:bg-object-header",
|
|
18480
|
+
"[[data-variant=header]_&]:text-object-header-foreground",
|
|
18481
|
+
"[[data-variant=header]_&]:px-4",
|
|
18482
|
+
"[[data-variant=header]_&]:border-b",
|
|
18483
|
+
"[[data-size=md][data-variant=header]_&]:px-3",
|
|
18484
|
+
"[[data-size=sm][data-variant=header]_&]:px-2.5"
|
|
18485
|
+
);
|
|
18475
18486
|
el.setAttribute("tabIndex", "-1");
|
|
18476
18487
|
const getLabel = evaluateLater(expression);
|
|
18477
18488
|
const chevronDown = (0, import_lucide.createElement)(import_lucide.ChevronDown, {
|
|
@@ -18490,10 +18501,9 @@ function accordion_default(Alpine) {
|
|
|
18490
18501
|
"focus-visible:ring-ring/50",
|
|
18491
18502
|
"flex",
|
|
18492
18503
|
"flex-1",
|
|
18493
|
-
"items-
|
|
18504
|
+
"items-center",
|
|
18494
18505
|
"justify-between",
|
|
18495
18506
|
"gap-4",
|
|
18496
|
-
"py-4",
|
|
18497
18507
|
"text-left",
|
|
18498
18508
|
"text-sm",
|
|
18499
18509
|
"font-medium",
|
|
@@ -18512,17 +18522,17 @@ function accordion_default(Alpine) {
|
|
|
18512
18522
|
button.appendChild(chevronDown);
|
|
18513
18523
|
});
|
|
18514
18524
|
});
|
|
18515
|
-
button.setAttribute("id", accordionItem.
|
|
18516
|
-
button.setAttribute("aria-controls", accordionItem.
|
|
18525
|
+
button.setAttribute("id", accordionItem._h_accordionItem.id);
|
|
18526
|
+
button.setAttribute("aria-controls", accordionItem._h_accordionItem.controls);
|
|
18517
18527
|
const setAttributes = () => {
|
|
18518
|
-
button.setAttribute("data-state", accordionItem.
|
|
18519
|
-
button.setAttribute("aria-expanded", accordionItem.
|
|
18528
|
+
button.setAttribute("data-state", accordionItem._h_accordionItem.expanded ? "open" : "closed");
|
|
18529
|
+
button.setAttribute("aria-expanded", accordionItem._h_accordionItem.expanded);
|
|
18520
18530
|
};
|
|
18521
18531
|
const handler2 = () => {
|
|
18522
|
-
accordionItem.
|
|
18532
|
+
accordionItem._h_accordionItem.expanded = !accordionItem._h_accordionItem.expanded;
|
|
18523
18533
|
setAttributes();
|
|
18524
|
-
if (accordion.
|
|
18525
|
-
accordion.
|
|
18534
|
+
if (accordion._h_accordion.single) {
|
|
18535
|
+
accordion._h_accordion.expandedId = accordionItem._h_accordionItem.id;
|
|
18526
18536
|
}
|
|
18527
18537
|
};
|
|
18528
18538
|
setAttributes();
|
|
@@ -18530,10 +18540,10 @@ function accordion_default(Alpine) {
|
|
|
18530
18540
|
cleanup(() => {
|
|
18531
18541
|
el.removeEventListener("click", handler2);
|
|
18532
18542
|
});
|
|
18533
|
-
if (accordion.
|
|
18543
|
+
if (accordion._h_accordion.single) {
|
|
18534
18544
|
effect(() => {
|
|
18535
|
-
if (accordion.
|
|
18536
|
-
accordionItem.
|
|
18545
|
+
if (accordion._h_accordion.expandedId !== accordionItem._h_accordionItem.id) {
|
|
18546
|
+
accordionItem._h_accordionItem.expanded = false;
|
|
18537
18547
|
setAttributes();
|
|
18538
18548
|
}
|
|
18539
18549
|
});
|
|
@@ -18542,13 +18552,13 @@ function accordion_default(Alpine) {
|
|
|
18542
18552
|
Alpine.directive("h-accordion-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
18543
18553
|
el.classList.add("pt-0", "pb-4", "overflow-hidden", "text-sm", "data-[state=closed]:hidden");
|
|
18544
18554
|
el.setAttribute("data-slot", "accordion-content");
|
|
18545
|
-
const parent = Alpine2.findClosest(el.parentElement, (parent2) => parent2.hasOwnProperty("
|
|
18555
|
+
const parent = Alpine2.findClosest(el.parentElement, (parent2) => parent2.hasOwnProperty("_h_accordionItem"));
|
|
18546
18556
|
if (parent) {
|
|
18547
|
-
el.setAttribute("id", parent.
|
|
18548
|
-
el.setAttribute("aria-labelledby", parent.
|
|
18549
|
-
el.setAttribute("data-state", parent.
|
|
18557
|
+
el.setAttribute("id", parent._h_accordionItem.controls);
|
|
18558
|
+
el.setAttribute("aria-labelledby", parent._h_accordionItem.id);
|
|
18559
|
+
el.setAttribute("data-state", parent._h_accordionItem.expanded ? "open" : "closed");
|
|
18550
18560
|
effect(() => {
|
|
18551
|
-
el.setAttribute("data-state", parent.
|
|
18561
|
+
el.setAttribute("data-state", parent._h_accordionItem.expanded ? "open" : "closed");
|
|
18552
18562
|
});
|
|
18553
18563
|
}
|
|
18554
18564
|
});
|
|
@@ -18593,13 +18603,11 @@ function alert_default(Alpine) {
|
|
|
18593
18603
|
}
|
|
18594
18604
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18595
18605
|
const observer = new MutationObserver((mutations) => {
|
|
18596
|
-
mutations.forEach((
|
|
18597
|
-
|
|
18598
|
-
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18599
|
-
}
|
|
18606
|
+
mutations.forEach(() => {
|
|
18607
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18600
18608
|
});
|
|
18601
18609
|
});
|
|
18602
|
-
observer.observe(el, { attributes: true });
|
|
18610
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
18603
18611
|
cleanup(() => {
|
|
18604
18612
|
observer.disconnect();
|
|
18605
18613
|
});
|
|
@@ -18630,6 +18638,7 @@ function avatar_default(Alpine) {
|
|
|
18630
18638
|
"has-[img]:border-0",
|
|
18631
18639
|
"flex",
|
|
18632
18640
|
"size-8",
|
|
18641
|
+
"aspect-square",
|
|
18633
18642
|
"shrink-0",
|
|
18634
18643
|
"overflow-hidden",
|
|
18635
18644
|
"rounded-full",
|
|
@@ -18639,7 +18648,7 @@ function avatar_default(Alpine) {
|
|
|
18639
18648
|
"[&>svg]:size-5"
|
|
18640
18649
|
);
|
|
18641
18650
|
el.setAttribute("data-slot", "avatar");
|
|
18642
|
-
el.
|
|
18651
|
+
el._h_avatar = Alpine2.reactive({
|
|
18643
18652
|
fallback: false
|
|
18644
18653
|
});
|
|
18645
18654
|
if (el.tagName === "BUTTON") {
|
|
@@ -18647,7 +18656,7 @@ function avatar_default(Alpine) {
|
|
|
18647
18656
|
}
|
|
18648
18657
|
});
|
|
18649
18658
|
Alpine.directive("h-avatar-image", (el, {}, { cleanup }) => {
|
|
18650
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18659
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
18651
18660
|
if (!avatar) {
|
|
18652
18661
|
throw new Error("h-avatar-image must be inside an h-avatar element");
|
|
18653
18662
|
}
|
|
@@ -18658,7 +18667,7 @@ function avatar_default(Alpine) {
|
|
|
18658
18667
|
function fallback(active = false) {
|
|
18659
18668
|
if (active) el.classList.add("hidden");
|
|
18660
18669
|
else el.classList.remove("hidden");
|
|
18661
|
-
avatar.
|
|
18670
|
+
avatar._h_avatar.fallback = active;
|
|
18662
18671
|
}
|
|
18663
18672
|
function completeCheck() {
|
|
18664
18673
|
if (el.complete) {
|
|
@@ -18672,27 +18681,25 @@ function avatar_default(Alpine) {
|
|
|
18672
18681
|
interval = setInterval(completeCheck, 10);
|
|
18673
18682
|
}
|
|
18674
18683
|
const observer = new MutationObserver((mutations) => {
|
|
18675
|
-
mutations.forEach((
|
|
18676
|
-
|
|
18677
|
-
if (mutation.attributeName === "src") interval = setInterval(completeCheck, 10);
|
|
18678
|
-
}
|
|
18684
|
+
mutations.forEach(() => {
|
|
18685
|
+
interval = setInterval(completeCheck, 10);
|
|
18679
18686
|
});
|
|
18680
18687
|
});
|
|
18681
|
-
observer.observe(el, { attributes: true });
|
|
18688
|
+
observer.observe(el, { attributes: true, attributeFilter: ["src"] });
|
|
18682
18689
|
cleanup(() => {
|
|
18683
18690
|
if (interval) clearInterval(interval);
|
|
18684
18691
|
observer.disconnect();
|
|
18685
18692
|
});
|
|
18686
18693
|
});
|
|
18687
18694
|
Alpine.directive("h-avatar-fallback", (el, {}, { effect }) => {
|
|
18688
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18695
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
18689
18696
|
if (!avatar) {
|
|
18690
18697
|
throw new Error("h-avatar-fallback must be inside an h-avatar element");
|
|
18691
18698
|
}
|
|
18692
18699
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
18693
18700
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
18694
18701
|
effect(() => {
|
|
18695
|
-
if (avatar.
|
|
18702
|
+
if (avatar._h_avatar.fallback) el.classList.remove("hidden");
|
|
18696
18703
|
else el.classList.add("hidden");
|
|
18697
18704
|
});
|
|
18698
18705
|
});
|
|
@@ -18706,7 +18713,7 @@ function badge_default(Alpine) {
|
|
|
18706
18713
|
"inline-flex",
|
|
18707
18714
|
"items-center",
|
|
18708
18715
|
"justify-center",
|
|
18709
|
-
"rounded-
|
|
18716
|
+
"rounded-full",
|
|
18710
18717
|
"border",
|
|
18711
18718
|
"px-2",
|
|
18712
18719
|
"py-0.5",
|
|
@@ -18721,12 +18728,6 @@ function badge_default(Alpine) {
|
|
|
18721
18728
|
"focus-visible:border-ring",
|
|
18722
18729
|
"focus-visible:ring-ring/50",
|
|
18723
18730
|
"focus-visible:ring-[3px]",
|
|
18724
|
-
"aria-invalid:ring-negative/20",
|
|
18725
|
-
"dark:aria-invalid:ring-negative/40",
|
|
18726
|
-
"aria-invalid:border-negative",
|
|
18727
|
-
"invalid:ring-negative/20",
|
|
18728
|
-
"dark:invalid:ring-negative/40",
|
|
18729
|
-
"invalid:border-negative",
|
|
18730
18731
|
"transition-[color,box-shadow]",
|
|
18731
18732
|
"overflow-hidden"
|
|
18732
18733
|
);
|
|
@@ -18748,13 +18749,11 @@ function badge_default(Alpine) {
|
|
|
18748
18749
|
}
|
|
18749
18750
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18750
18751
|
const observer = new MutationObserver((mutations) => {
|
|
18751
|
-
mutations.forEach((
|
|
18752
|
-
|
|
18753
|
-
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18754
|
-
}
|
|
18752
|
+
mutations.forEach(() => {
|
|
18753
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18755
18754
|
});
|
|
18756
18755
|
});
|
|
18757
|
-
observer.observe(el, { attributes: true });
|
|
18756
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
18758
18757
|
cleanup(() => {
|
|
18759
18758
|
observer.disconnect();
|
|
18760
18759
|
});
|
|
@@ -18766,7 +18765,7 @@ var buttonVariants = {
|
|
|
18766
18765
|
default: [
|
|
18767
18766
|
"bg-secondary",
|
|
18768
18767
|
"text-secondary-foreground",
|
|
18769
|
-
"shadow-
|
|
18768
|
+
"shadow-button",
|
|
18770
18769
|
"hover:bg-secondary-hover",
|
|
18771
18770
|
"active:bg-secondary-active",
|
|
18772
18771
|
"aria-pressed:bg-secondary-active",
|
|
@@ -18777,7 +18776,7 @@ var buttonVariants = {
|
|
|
18777
18776
|
primary: [
|
|
18778
18777
|
"bg-primary",
|
|
18779
18778
|
"text-primary-foreground",
|
|
18780
|
-
"shadow-
|
|
18779
|
+
"shadow-button",
|
|
18781
18780
|
"hover:bg-primary-hover",
|
|
18782
18781
|
"active:bg-primary-active",
|
|
18783
18782
|
"aria-pressed:bg-primary-active",
|
|
@@ -18788,7 +18787,7 @@ var buttonVariants = {
|
|
|
18788
18787
|
positive: [
|
|
18789
18788
|
"bg-positive",
|
|
18790
18789
|
"text-positive-foreground",
|
|
18791
|
-
"shadow-
|
|
18790
|
+
"shadow-button",
|
|
18792
18791
|
"hover:bg-positive-hover",
|
|
18793
18792
|
"active:bg-positive-active",
|
|
18794
18793
|
"aria-pressed:bg-positive-active",
|
|
@@ -18799,7 +18798,7 @@ var buttonVariants = {
|
|
|
18799
18798
|
negative: [
|
|
18800
18799
|
"bg-negative",
|
|
18801
18800
|
"text-negative-foreground",
|
|
18802
|
-
"shadow-
|
|
18801
|
+
"shadow-button",
|
|
18803
18802
|
"hover:bg-negative-hover",
|
|
18804
18803
|
"active:bg-negative-active",
|
|
18805
18804
|
"aria-pressed:bg-negative-active",
|
|
@@ -18810,7 +18809,7 @@ var buttonVariants = {
|
|
|
18810
18809
|
warning: [
|
|
18811
18810
|
"bg-warning",
|
|
18812
18811
|
"text-warning-foreground",
|
|
18813
|
-
"shadow-
|
|
18812
|
+
"shadow-button",
|
|
18814
18813
|
"hover:bg-warning-hover",
|
|
18815
18814
|
"active:bg-warning-active",
|
|
18816
18815
|
"aria-pressed:bg-warning-active",
|
|
@@ -18822,7 +18821,6 @@ var buttonVariants = {
|
|
|
18822
18821
|
"border",
|
|
18823
18822
|
"bg-background",
|
|
18824
18823
|
"text-foreground",
|
|
18825
|
-
"shadow-none",
|
|
18826
18824
|
"hover:bg-secondary",
|
|
18827
18825
|
"hover:text-secondary-foreground",
|
|
18828
18826
|
"active:bg-secondary-active",
|
|
@@ -18870,11 +18868,31 @@ var setButtonClasses = (el) => {
|
|
|
18870
18868
|
"aria-invalid:ring-negative/20",
|
|
18871
18869
|
"dark:aria-invalid:ring-negative/40",
|
|
18872
18870
|
"aria-invalid:border-negative",
|
|
18873
|
-
"invalid
|
|
18874
|
-
"dark:invalid
|
|
18875
|
-
"invalid
|
|
18871
|
+
"invalid:!ring-negative/20",
|
|
18872
|
+
"dark:invalid:!ring-negative/40",
|
|
18873
|
+
"invalid:!border-negative"
|
|
18876
18874
|
);
|
|
18877
18875
|
};
|
|
18876
|
+
var getButtonSize = (size3, inGroup = false) => {
|
|
18877
|
+
switch (size3) {
|
|
18878
|
+
case "xs":
|
|
18879
|
+
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"];
|
|
18880
|
+
case "sm":
|
|
18881
|
+
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"];
|
|
18882
|
+
case "lg":
|
|
18883
|
+
return ["h-10", "px-6", "has-[>svg]:px-4"];
|
|
18884
|
+
case "icon-xs":
|
|
18885
|
+
return inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"];
|
|
18886
|
+
case "icon-sm":
|
|
18887
|
+
return inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
|
|
18888
|
+
case "icon":
|
|
18889
|
+
return ["size-9"];
|
|
18890
|
+
case "icon-lg":
|
|
18891
|
+
return ["size-10"];
|
|
18892
|
+
default:
|
|
18893
|
+
return ["h-9", "px-4", "py-2", "has-[>svg]:px-3"];
|
|
18894
|
+
}
|
|
18895
|
+
};
|
|
18878
18896
|
function button_default(Alpine) {
|
|
18879
18897
|
Alpine.directive("h-button", (el, { modifiers }, { cleanup }) => {
|
|
18880
18898
|
setButtonClasses(el);
|
|
@@ -18882,34 +18900,24 @@ function button_default(Alpine) {
|
|
|
18882
18900
|
el.setAttribute("data-slot", "button");
|
|
18883
18901
|
}
|
|
18884
18902
|
const inGroup = modifiers.includes("group");
|
|
18885
|
-
|
|
18886
|
-
default: ["h-9", "px-4", "py-2", "has-[>svg]:px-3"],
|
|
18887
|
-
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"],
|
|
18888
|
-
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"],
|
|
18889
|
-
lg: ["h-10", "px-6", "has-[>svg]:px-4"],
|
|
18890
|
-
"icon-xs": inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"],
|
|
18891
|
-
"icon-sm": inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"],
|
|
18892
|
-
icon: ["size-9"],
|
|
18893
|
-
"icon-lg": ["size-10"]
|
|
18894
|
-
};
|
|
18903
|
+
let lastSize;
|
|
18895
18904
|
function setVariant(variant) {
|
|
18896
18905
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
18897
18906
|
el.classList.remove(...value);
|
|
18898
18907
|
}
|
|
18899
18908
|
if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
|
|
18900
18909
|
}
|
|
18901
|
-
function setSize(size3) {
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
|
|
18907
|
-
}
|
|
18910
|
+
function setSize(size3 = "default") {
|
|
18911
|
+
el.classList.remove(...getButtonSize(lastSize, inGroup));
|
|
18912
|
+
el.classList.add(...getButtonSize(size3, inGroup));
|
|
18913
|
+
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
18914
|
+
console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
|
|
18908
18915
|
}
|
|
18916
|
+
lastSize = size3;
|
|
18909
18917
|
}
|
|
18910
18918
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18911
18919
|
if (inGroup) {
|
|
18912
|
-
el.classList.remove("shadow-
|
|
18920
|
+
el.classList.remove("shadow-button", "inline-flex");
|
|
18913
18921
|
el.classList.add("shadow-none", "flex");
|
|
18914
18922
|
setSize(el.getAttribute("data-size") ?? "xs");
|
|
18915
18923
|
} else {
|
|
@@ -18919,19 +18927,17 @@ function button_default(Alpine) {
|
|
|
18919
18927
|
if (["date-picker-trigger", "time-picker-trigger"].includes(el.getAttribute("data-slot"))) {
|
|
18920
18928
|
setSize("icon-xs");
|
|
18921
18929
|
} else {
|
|
18922
|
-
setSize(
|
|
18930
|
+
setSize();
|
|
18923
18931
|
}
|
|
18924
18932
|
}
|
|
18925
18933
|
}
|
|
18926
18934
|
const observer = new MutationObserver((mutations) => {
|
|
18927
18935
|
mutations.forEach((mutation) => {
|
|
18928
|
-
if (mutation.
|
|
18929
|
-
|
|
18930
|
-
else if (mutation.attributeName === "data-size") setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
|
|
18931
|
-
}
|
|
18936
|
+
if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18937
|
+
else setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
|
|
18932
18938
|
});
|
|
18933
18939
|
});
|
|
18934
|
-
observer.observe(el, { attributes: true });
|
|
18940
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
|
|
18935
18941
|
cleanup(() => {
|
|
18936
18942
|
observer.disconnect();
|
|
18937
18943
|
});
|
|
@@ -20451,7 +20457,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
20451
20457
|
var import_lucide2 = __toESM(require_lucide(), 1);
|
|
20452
20458
|
function calendar_default(Alpine) {
|
|
20453
20459
|
Alpine.directive("h-calendar", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
20454
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
20460
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
20455
20461
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
20456
20462
|
el.setAttribute("tabindex", "-1");
|
|
20457
20463
|
if (datepicker) {
|
|
@@ -20459,9 +20465,9 @@ function calendar_default(Alpine) {
|
|
|
20459
20465
|
el.setAttribute("role", "dialog");
|
|
20460
20466
|
el.setAttribute("aria-modal", "true");
|
|
20461
20467
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
20462
|
-
el.setAttribute("data-state", datepicker.
|
|
20468
|
+
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
20463
20469
|
} else {
|
|
20464
|
-
el.classList.add("shadow-
|
|
20470
|
+
el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
|
|
20465
20471
|
}
|
|
20466
20472
|
let date = /* @__PURE__ */ new Date();
|
|
20467
20473
|
let selected = void 0;
|
|
@@ -20484,38 +20490,38 @@ function calendar_default(Alpine) {
|
|
|
20484
20490
|
}
|
|
20485
20491
|
}
|
|
20486
20492
|
if (datepicker) {
|
|
20487
|
-
datepicker.
|
|
20488
|
-
datepicker.
|
|
20489
|
-
if (triggerInput) datepicker.
|
|
20493
|
+
datepicker._h_datepicker.input.value = formatter.format(selected);
|
|
20494
|
+
datepicker._h_datepicker.input.setCustomValidity("");
|
|
20495
|
+
if (triggerInput) datepicker._h_datepicker.input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
20490
20496
|
} else {
|
|
20491
20497
|
el.setAttribute("data-invalid", "false");
|
|
20492
20498
|
}
|
|
20493
20499
|
}
|
|
20494
20500
|
const onInputChange = () => {
|
|
20495
|
-
const newValue = new Date(datepicker.
|
|
20501
|
+
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
20496
20502
|
if (isNaN(newValue)) {
|
|
20497
|
-
console.error(`h-calendar: input value is not a valid date - ${datepicker.
|
|
20498
|
-
datepicker.
|
|
20503
|
+
console.error(`h-calendar: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
|
|
20504
|
+
datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
20499
20505
|
return;
|
|
20500
20506
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
20501
20507
|
selected = newValue;
|
|
20502
20508
|
modelChange();
|
|
20503
20509
|
render();
|
|
20504
20510
|
}
|
|
20505
|
-
datepicker.
|
|
20511
|
+
datepicker._h_datepicker.input.setCustomValidity("");
|
|
20506
20512
|
};
|
|
20507
20513
|
if (datepicker) {
|
|
20508
|
-
datepicker.
|
|
20514
|
+
datepicker._h_datepicker.input.addEventListener("change", onInputChange);
|
|
20509
20515
|
}
|
|
20510
20516
|
function checkForModel() {
|
|
20511
20517
|
if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
|
|
20512
20518
|
selected = new Date(el._x_model.get());
|
|
20513
20519
|
if (isNaN(selected)) {
|
|
20514
20520
|
console.error(`h-calendar: input value is not a valid date - ${el._x_model.get()}`);
|
|
20515
|
-
if (datepicker) datepicker.
|
|
20521
|
+
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
20516
20522
|
else el.setAttribute("data-invalid", "true");
|
|
20517
20523
|
} else if (datepicker) {
|
|
20518
|
-
datepicker.
|
|
20524
|
+
datepicker._h_datepicker.input.value = formatter.format(selected);
|
|
20519
20525
|
}
|
|
20520
20526
|
}
|
|
20521
20527
|
}
|
|
@@ -20525,7 +20531,7 @@ function calendar_default(Alpine) {
|
|
|
20525
20531
|
selected = new Date(focusedDay);
|
|
20526
20532
|
modelChange(true);
|
|
20527
20533
|
render();
|
|
20528
|
-
if (datepicker) datepicker.
|
|
20534
|
+
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
20529
20535
|
}
|
|
20530
20536
|
function isDisabled(d) {
|
|
20531
20537
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
@@ -20818,7 +20824,7 @@ function calendar_default(Alpine) {
|
|
|
20818
20824
|
newDay.setMonth(newDay.getMonth() + 1);
|
|
20819
20825
|
break;
|
|
20820
20826
|
case "Escape":
|
|
20821
|
-
if (datepicker) datepicker.
|
|
20827
|
+
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
20822
20828
|
return;
|
|
20823
20829
|
case "Enter":
|
|
20824
20830
|
case " ":
|
|
@@ -20882,8 +20888,8 @@ function calendar_default(Alpine) {
|
|
|
20882
20888
|
}
|
|
20883
20889
|
if (datepicker) {
|
|
20884
20890
|
effect(() => {
|
|
20885
|
-
el.setAttribute("data-state", datepicker.
|
|
20886
|
-
if (datepicker.
|
|
20891
|
+
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
20892
|
+
if (datepicker._h_datepicker.expanded) {
|
|
20887
20893
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
20888
20894
|
Alpine2.nextTick(() => {
|
|
20889
20895
|
focusDay();
|
|
@@ -20903,7 +20909,7 @@ function calendar_default(Alpine) {
|
|
|
20903
20909
|
dayCells[d].removeEventListener("click", dayClick);
|
|
20904
20910
|
}
|
|
20905
20911
|
if (datepicker) {
|
|
20906
|
-
datepicker.
|
|
20912
|
+
datepicker._h_datepicker.input.removeEventListener("change", onInputChange);
|
|
20907
20913
|
}
|
|
20908
20914
|
});
|
|
20909
20915
|
});
|
|
@@ -20988,7 +20994,7 @@ function checkbox_default(Alpine) {
|
|
|
20988
20994
|
"has-[input:invalid]:ring-negative/20",
|
|
20989
20995
|
"relative",
|
|
20990
20996
|
"rounded-[0.25rem]",
|
|
20991
|
-
"shadow-
|
|
20997
|
+
"shadow-input",
|
|
20992
20998
|
"shrink-0",
|
|
20993
20999
|
"size-5",
|
|
20994
21000
|
"transition-color"
|
|
@@ -21001,7 +21007,7 @@ function checkbox_default(Alpine) {
|
|
|
21001
21007
|
// src/components/collapsible.js
|
|
21002
21008
|
function collapsible_default(Alpine) {
|
|
21003
21009
|
Alpine.directive("h-collapsible", (el, { expression }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
21004
|
-
el.
|
|
21010
|
+
el._h_collapsible = Alpine2.reactive({
|
|
21005
21011
|
expanded: expression ? evaluate2(expression) : false
|
|
21006
21012
|
});
|
|
21007
21013
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible");
|
|
@@ -21009,13 +21015,13 @@ function collapsible_default(Alpine) {
|
|
|
21009
21015
|
const getExpanded = evaluateLater(expression);
|
|
21010
21016
|
effect(() => {
|
|
21011
21017
|
getExpanded((expanded) => {
|
|
21012
|
-
el.
|
|
21018
|
+
el._h_collapsible.expanded = expanded;
|
|
21013
21019
|
});
|
|
21014
21020
|
});
|
|
21015
21021
|
}
|
|
21016
21022
|
});
|
|
21017
21023
|
Alpine.directive("h-collapsible-trigger", (el, { modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
21018
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21024
|
+
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
21019
21025
|
if (!collapsible) {
|
|
21020
21026
|
throw new Error("h-collapsible-trigger must be inside an h-collapsible element");
|
|
21021
21027
|
}
|
|
@@ -21026,10 +21032,10 @@ function collapsible_default(Alpine) {
|
|
|
21026
21032
|
else el.classList.add("[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180", "[&[data-state=open]>svg:only-child]:rotate-180");
|
|
21027
21033
|
}
|
|
21028
21034
|
const handler2 = () => {
|
|
21029
|
-
collapsible.
|
|
21035
|
+
collapsible._h_collapsible.expanded = !collapsible._h_collapsible.expanded;
|
|
21030
21036
|
};
|
|
21031
21037
|
effect(() => {
|
|
21032
|
-
el.setAttribute("data-state", collapsible.
|
|
21038
|
+
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
21033
21039
|
});
|
|
21034
21040
|
el.addEventListener("click", handler2);
|
|
21035
21041
|
cleanup(() => {
|
|
@@ -21037,14 +21043,14 @@ function collapsible_default(Alpine) {
|
|
|
21037
21043
|
});
|
|
21038
21044
|
});
|
|
21039
21045
|
Alpine.directive("h-collapsible-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
21040
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21046
|
+
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
21041
21047
|
if (!collapsible) {
|
|
21042
21048
|
throw new Error("h-collapsible-content must be inside an h-collapsible element");
|
|
21043
21049
|
}
|
|
21044
21050
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
|
|
21045
|
-
el.classList.add("data-[state=closed]
|
|
21051
|
+
el.classList.add("data-[state=closed]:!hidden");
|
|
21046
21052
|
effect(() => {
|
|
21047
|
-
el.setAttribute("data-state", collapsible.
|
|
21053
|
+
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
21048
21054
|
});
|
|
21049
21055
|
});
|
|
21050
21056
|
}
|
|
@@ -21053,21 +21059,21 @@ function collapsible_default(Alpine) {
|
|
|
21053
21059
|
var import_lucide3 = __toESM(require_lucide(), 1);
|
|
21054
21060
|
function datepicker_default(Alpine) {
|
|
21055
21061
|
Alpine.directive("h-date-picker", (el, {}, { Alpine: Alpine2 }) => {
|
|
21056
|
-
el.
|
|
21062
|
+
el._h_datepicker = Alpine2.reactive({
|
|
21057
21063
|
id: void 0,
|
|
21058
21064
|
controls: `hdpc${v4_default()}`,
|
|
21059
21065
|
input: void 0,
|
|
21060
21066
|
expanded: false
|
|
21061
21067
|
});
|
|
21062
|
-
el.
|
|
21063
|
-
if (!el.
|
|
21068
|
+
el._h_datepicker.input = el.querySelector("input");
|
|
21069
|
+
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
21064
21070
|
throw new Error("h-date-picker must have an input inside it");
|
|
21065
|
-
} else if (el.
|
|
21066
|
-
el.
|
|
21071
|
+
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
21072
|
+
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
21067
21073
|
} else {
|
|
21068
21074
|
const id = `hdp${v4_default()}`;
|
|
21069
|
-
el.
|
|
21070
|
-
el.
|
|
21075
|
+
el._h_datepicker.input.setAttribute("id", id);
|
|
21076
|
+
el._h_datepicker.id = id;
|
|
21071
21077
|
}
|
|
21072
21078
|
el.classList.add(
|
|
21073
21079
|
"border-input",
|
|
@@ -21077,7 +21083,7 @@ function datepicker_default(Alpine) {
|
|
|
21077
21083
|
"items-center",
|
|
21078
21084
|
"rounded-control",
|
|
21079
21085
|
"border",
|
|
21080
|
-
"shadow-
|
|
21086
|
+
"shadow-input",
|
|
21081
21087
|
"transition-[color,box-shadow]",
|
|
21082
21088
|
"duration-200",
|
|
21083
21089
|
"outline-none",
|
|
@@ -21097,9 +21103,9 @@ function datepicker_default(Alpine) {
|
|
|
21097
21103
|
"dark:has-[input:invalid]:ring-negative/40"
|
|
21098
21104
|
);
|
|
21099
21105
|
el.setAttribute("data-slot", "date-picker");
|
|
21100
|
-
el.
|
|
21101
|
-
el.
|
|
21102
|
-
el.
|
|
21106
|
+
el._h_datepicker.input.classList.add("bg-transparent", "outline-none", "flex-1", "border-0", "focus-visible:ring-0", "disabled:pointer-events-none", "disabled:cursor-not-allowed", "disabled:opacity-50", "md:text-sm", "text-base");
|
|
21107
|
+
el._h_datepicker.input.setAttribute("aria-autocomplete", "none");
|
|
21108
|
+
el._h_datepicker.input.setAttribute("type", "text");
|
|
21103
21109
|
});
|
|
21104
21110
|
Alpine.directive("h-date-picker-trigger", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
21105
21111
|
if (el.tagName !== "BUTTON") {
|
|
@@ -21108,11 +21114,11 @@ function datepicker_default(Alpine) {
|
|
|
21108
21114
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
21109
21115
|
throw new Error('h-date-picker-trigger: must have an "aria-label" or "aria-labelledby" attribute');
|
|
21110
21116
|
}
|
|
21111
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21117
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
21112
21118
|
if (!datepicker) {
|
|
21113
21119
|
throw new Error("h-date-picker-trigger must be inside an h-date-picker element");
|
|
21114
21120
|
}
|
|
21115
|
-
el.setAttribute("aria-controls", datepicker.
|
|
21121
|
+
el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
|
|
21116
21122
|
el.setAttribute("aria-expanded", "false");
|
|
21117
21123
|
el.setAttribute("aria-haspopup", "dialog");
|
|
21118
21124
|
el.setAttribute("type", "button");
|
|
@@ -21127,17 +21133,17 @@ function datepicker_default(Alpine) {
|
|
|
21127
21133
|
})
|
|
21128
21134
|
);
|
|
21129
21135
|
effect(() => {
|
|
21130
|
-
el.setAttribute("data-state", datepicker.
|
|
21131
|
-
el.setAttribute("aria-expanded", datepicker.
|
|
21136
|
+
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
21137
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
21132
21138
|
});
|
|
21133
21139
|
const close = () => {
|
|
21134
|
-
datepicker.
|
|
21140
|
+
datepicker._h_datepicker.expanded = false;
|
|
21135
21141
|
};
|
|
21136
21142
|
const handler2 = () => {
|
|
21137
|
-
datepicker.
|
|
21138
|
-
el.setAttribute("aria-expanded", datepicker.
|
|
21143
|
+
datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
|
|
21144
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
21139
21145
|
Alpine2.nextTick(() => {
|
|
21140
|
-
if (datepicker.
|
|
21146
|
+
if (datepicker._h_datepicker.expanded) {
|
|
21141
21147
|
top.addEventListener("click", close, { once: true });
|
|
21142
21148
|
} else {
|
|
21143
21149
|
top.removeEventListener("click", close);
|
|
@@ -21159,8 +21165,8 @@ function dialog_default(Alpine) {
|
|
|
21159
21165
|
el.setAttribute("tabindex", "-1");
|
|
21160
21166
|
el.setAttribute("data-slot", "dialog-overlay");
|
|
21161
21167
|
const observer = new MutationObserver((mutations) => {
|
|
21162
|
-
mutations.forEach((
|
|
21163
|
-
if (
|
|
21168
|
+
mutations.forEach(() => {
|
|
21169
|
+
if (el.getAttribute("data-open") === "true") {
|
|
21164
21170
|
const inputs = el.getElementsByTagName("INPUT");
|
|
21165
21171
|
if (inputs.length) {
|
|
21166
21172
|
for (let i = 0; i < inputs.length; i++) {
|
|
@@ -21170,16 +21176,28 @@ function dialog_default(Alpine) {
|
|
|
21170
21176
|
}
|
|
21171
21177
|
}
|
|
21172
21178
|
inputs[0].focus();
|
|
21179
|
+
return;
|
|
21173
21180
|
} else {
|
|
21174
|
-
const
|
|
21175
|
-
if (
|
|
21176
|
-
|
|
21181
|
+
const textareas = el.getElementsByTagName("TEXTAREA");
|
|
21182
|
+
if (textareas.length) {
|
|
21183
|
+
for (let i = 0; i < textareas.length; i++) {
|
|
21184
|
+
if (textareas[i].autofocus) {
|
|
21185
|
+
textareas[i].focus();
|
|
21186
|
+
return;
|
|
21187
|
+
}
|
|
21188
|
+
}
|
|
21189
|
+
textareas[0].focus();
|
|
21190
|
+
return;
|
|
21177
21191
|
}
|
|
21178
21192
|
}
|
|
21193
|
+
const buttons = el.getElementsByTagName("BUTTON");
|
|
21194
|
+
if (buttons.length) {
|
|
21195
|
+
buttons[0].focus();
|
|
21196
|
+
}
|
|
21179
21197
|
}
|
|
21180
21198
|
});
|
|
21181
21199
|
});
|
|
21182
|
-
observer.observe(el, { attributes: true });
|
|
21200
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-open"] });
|
|
21183
21201
|
cleanup(() => {
|
|
21184
21202
|
observer.disconnect();
|
|
21185
21203
|
});
|
|
@@ -21192,7 +21210,8 @@ function dialog_default(Alpine) {
|
|
|
21192
21210
|
"top-[50%]",
|
|
21193
21211
|
"left-[50%]",
|
|
21194
21212
|
"z-50",
|
|
21195
|
-
"
|
|
21213
|
+
"flex",
|
|
21214
|
+
"flex-col",
|
|
21196
21215
|
"w-full",
|
|
21197
21216
|
"max-w-[calc(100%-2rem)]",
|
|
21198
21217
|
"translate-x-[-50%]",
|
|
@@ -21202,24 +21221,27 @@ function dialog_default(Alpine) {
|
|
|
21202
21221
|
"border",
|
|
21203
21222
|
"p-4",
|
|
21204
21223
|
"shadow-xl",
|
|
21205
|
-
"sm:max-w-lg"
|
|
21224
|
+
"sm:max-w-lg",
|
|
21225
|
+
"outline-none"
|
|
21206
21226
|
);
|
|
21207
21227
|
el.setAttribute("role", "dialog");
|
|
21208
21228
|
el.setAttribute("data-slot", "dialog");
|
|
21209
|
-
if (!el.hasAttribute("aria-labelledby")) {
|
|
21210
|
-
console.error('h-dialog: attribute "aria-labelledby" is missing');
|
|
21211
|
-
}
|
|
21212
|
-
if (!el.hasAttribute("aria-describedby")) {
|
|
21213
|
-
console.error('h-dialog: attribute "aria-describedby" is missing');
|
|
21214
|
-
}
|
|
21215
21229
|
});
|
|
21216
21230
|
Alpine.directive("h-dialog-header", (el) => {
|
|
21217
21231
|
el.classList.add("grid", "grid-cols-[1fr_auto]", "place-items-start", "gap-2", "text-center", "sm:text-left");
|
|
21218
21232
|
el.setAttribute("data-slot", "dialog-header");
|
|
21219
21233
|
});
|
|
21220
|
-
Alpine.directive("h-dialog-title", (el) => {
|
|
21234
|
+
Alpine.directive("h-dialog-title", (el, {}, { Alpine: Alpine2 }) => {
|
|
21221
21235
|
el.classList.add("text-lg", "leading-none", "font-semibold");
|
|
21222
21236
|
el.setAttribute("data-slot", "dialog-title");
|
|
21237
|
+
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
21238
|
+
if (dialog && (!dialog.hasAttribute("aria-labelledby") || !dialog.hasAttribute("aria-label"))) {
|
|
21239
|
+
if (!el.hasAttribute("id")) {
|
|
21240
|
+
const id = `dht${v4_default()}`;
|
|
21241
|
+
el.setAttribute("id", id);
|
|
21242
|
+
}
|
|
21243
|
+
dialog.setAttribute("aria-labelledby", el.getAttribute("id"));
|
|
21244
|
+
}
|
|
21223
21245
|
});
|
|
21224
21246
|
Alpine.directive("h-dialog-close", (el) => {
|
|
21225
21247
|
el.classList.add(
|
|
@@ -21239,9 +21261,17 @@ function dialog_default(Alpine) {
|
|
|
21239
21261
|
);
|
|
21240
21262
|
el.setAttribute("data-slot", "dialog-close");
|
|
21241
21263
|
});
|
|
21242
|
-
Alpine.directive("h-dialog-description", (el) => {
|
|
21264
|
+
Alpine.directive("h-dialog-description", (el, {}, { Alpine: Alpine2 }) => {
|
|
21243
21265
|
el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
|
|
21244
21266
|
el.setAttribute("data-slot", "dialog-description");
|
|
21267
|
+
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
21268
|
+
if (dialog && (!dialog.hasAttribute("aria-describedby") || !dialog.hasAttribute("aria-description"))) {
|
|
21269
|
+
if (!el.hasAttribute("id")) {
|
|
21270
|
+
const id = `dhd${v4_default()}`;
|
|
21271
|
+
el.setAttribute("id", id);
|
|
21272
|
+
}
|
|
21273
|
+
dialog.setAttribute("aria-describedby", el.getAttribute("id"));
|
|
21274
|
+
}
|
|
21245
21275
|
});
|
|
21246
21276
|
Alpine.directive("h-dialog-footer", (el) => {
|
|
21247
21277
|
el.classList.add("flex", "flex-col-reverse", "gap-2", "sm:flex-row", "sm:justify-end");
|
|
@@ -21400,7 +21430,7 @@ function input_default(Alpine) {
|
|
|
21400
21430
|
"[&::-webkit-color-swatch-wrapper]:rounded-0",
|
|
21401
21431
|
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
21402
21432
|
"text-base",
|
|
21403
|
-
"shadow-
|
|
21433
|
+
"shadow-input",
|
|
21404
21434
|
"transition-[color,box-shadow]",
|
|
21405
21435
|
"outline-none",
|
|
21406
21436
|
"file:inline-flex",
|
|
@@ -21419,12 +21449,12 @@ function input_default(Alpine) {
|
|
|
21419
21449
|
"aria-invalid:ring-negative/20",
|
|
21420
21450
|
"dark:aria-invalid:ring-negative/40",
|
|
21421
21451
|
"aria-invalid:border-negative",
|
|
21422
|
-
"invalid
|
|
21423
|
-
"dark:invalid
|
|
21424
|
-
"invalid
|
|
21452
|
+
"invalid:!ring-negative/20",
|
|
21453
|
+
"dark:invalid:!ring-negative/40",
|
|
21454
|
+
"invalid:!border-negative"
|
|
21425
21455
|
);
|
|
21426
21456
|
if (modifiers.includes("group")) {
|
|
21427
|
-
el.classList.remove("rounded-control", "border", "bg-input-inner", "shadow-
|
|
21457
|
+
el.classList.remove("rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[3px]");
|
|
21428
21458
|
el.classList.add("flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
21429
21459
|
el.setAttribute("data-slot", "input-group-control");
|
|
21430
21460
|
} else el.setAttribute("data-slot", "input");
|
|
@@ -21443,7 +21473,7 @@ function input_default(Alpine) {
|
|
|
21443
21473
|
"items-center",
|
|
21444
21474
|
"rounded-control",
|
|
21445
21475
|
"border",
|
|
21446
|
-
"shadow-
|
|
21476
|
+
"shadow-input",
|
|
21447
21477
|
"transition-[color,box-shadow]",
|
|
21448
21478
|
"outline-none",
|
|
21449
21479
|
"h-9",
|
|
@@ -21562,7 +21592,7 @@ function list_default(Alpine) {
|
|
|
21562
21592
|
"border-input",
|
|
21563
21593
|
"border",
|
|
21564
21594
|
"rounded-control",
|
|
21565
|
-
"shadow-
|
|
21595
|
+
"shadow-input",
|
|
21566
21596
|
"outline-none",
|
|
21567
21597
|
"disabled:pointer-events-none",
|
|
21568
21598
|
"disabled:cursor-not-allowed",
|
|
@@ -21573,9 +21603,9 @@ function list_default(Alpine) {
|
|
|
21573
21603
|
"aria-invalid:ring-negative/20",
|
|
21574
21604
|
"dark:aria-invalid:ring-negative/40",
|
|
21575
21605
|
"aria-invalid:border-negative",
|
|
21576
|
-
"invalid
|
|
21577
|
-
"dark:invalid
|
|
21578
|
-
"invalid
|
|
21606
|
+
"invalid:!ring-negative/20",
|
|
21607
|
+
"dark:invalid:!ring-negative/40",
|
|
21608
|
+
"invalid:!border-negative",
|
|
21579
21609
|
"[&>ul:first-child>*:first-child]:rounded-t-control",
|
|
21580
21610
|
"[&>ul:last-child>*:last-child]:rounded-b-control"
|
|
21581
21611
|
);
|
|
@@ -21661,13 +21691,11 @@ function list_default(Alpine) {
|
|
|
21661
21691
|
if (!list) {
|
|
21662
21692
|
throw new Error("h-list-header: must be placed inside an h-list element");
|
|
21663
21693
|
}
|
|
21664
|
-
if (el.hasAttribute("id")) {
|
|
21665
|
-
list.setAttribute("aria-labelledby", el.getAttribute("id"));
|
|
21666
|
-
} else {
|
|
21694
|
+
if (!el.hasAttribute("id")) {
|
|
21667
21695
|
const id = `lbh${v4_default()}`;
|
|
21668
21696
|
el.setAttribute("id", id);
|
|
21669
|
-
list.setAttribute("aria-labelledby", id);
|
|
21670
21697
|
}
|
|
21698
|
+
list.setAttribute("aria-labelledby", el.getAttribute("id"));
|
|
21671
21699
|
});
|
|
21672
21700
|
Alpine.directive("h-list-item", (el, { modifiers }) => {
|
|
21673
21701
|
el.classList.add("min-h-11", "flex", "items-center", "p-2", "gap-2", "align-middle", "outline-none");
|
|
@@ -21943,7 +21971,9 @@ function menu_default(Alpine) {
|
|
|
21943
21971
|
Alpine.directive("h-menu-item", (el, {}, { cleanup, Alpine: Alpine2 }) => {
|
|
21944
21972
|
el.classList.add(
|
|
21945
21973
|
"focus:bg-secondary-hover",
|
|
21974
|
+
"focus:text-secondary-foreground",
|
|
21946
21975
|
"hover:bg-secondary-hover",
|
|
21976
|
+
"hover:text-secondary-foreground",
|
|
21947
21977
|
"data-[variant=negative]:text-negative",
|
|
21948
21978
|
"data-[variant=negative]:focus:bg-negative/10",
|
|
21949
21979
|
"data-[variant=negative]:hover:bg-negative/10",
|
|
@@ -22059,6 +22089,7 @@ function menu_default(Alpine) {
|
|
|
22059
22089
|
Alpine2.nextTick(() => {
|
|
22060
22090
|
submenuitem.focus();
|
|
22061
22091
|
el._menu_sub.expanded = true;
|
|
22092
|
+
el.setAttribute("aria-expanded", true);
|
|
22062
22093
|
});
|
|
22063
22094
|
}
|
|
22064
22095
|
}
|
|
@@ -22068,28 +22099,33 @@ function menu_default(Alpine) {
|
|
|
22068
22099
|
if (event.type === "mouseleave") {
|
|
22069
22100
|
el._menu_sub.close();
|
|
22070
22101
|
el._menu_sub.expanded = false;
|
|
22102
|
+
el.setAttribute("aria-expanded", false);
|
|
22071
22103
|
parentMenu.pauseKeyEvents = false;
|
|
22072
|
-
el.setAttribute("aria-expanded", "false");
|
|
22073
22104
|
parentMenu.focus();
|
|
22074
22105
|
} else if (el._menu_sub.expanded) {
|
|
22075
|
-
el.setAttribute("aria-expanded", "false");
|
|
22076
22106
|
el._menu_sub.close();
|
|
22077
22107
|
el._menu_sub.expanded = false;
|
|
22108
|
+
el.setAttribute("aria-expanded", false);
|
|
22078
22109
|
parentMenu.pauseKeyEvents = false;
|
|
22079
22110
|
el.removeEventListener("keydown", onKeydown);
|
|
22080
22111
|
}
|
|
22081
22112
|
}
|
|
22082
22113
|
function focusIn(event) {
|
|
22083
22114
|
el.setAttribute("tabindex", "0");
|
|
22084
|
-
if (event.type === "
|
|
22085
|
-
el.
|
|
22115
|
+
if (event.type === "click" && event.pointerType === "touch" && (event.target === el || event.target.parentElement === el)) {
|
|
22116
|
+
el._menu_sub.open(el);
|
|
22117
|
+
el._menu_sub.expanded = true;
|
|
22118
|
+
el.setAttribute("aria-expanded", true);
|
|
22119
|
+
event.stopPropagation();
|
|
22120
|
+
} else if (event.type === "mouseenter") {
|
|
22086
22121
|
el.addEventListener("mouseleave", focusOut);
|
|
22087
22122
|
el._menu_sub.open(el);
|
|
22088
22123
|
el._menu_sub.expanded = true;
|
|
22124
|
+
el.setAttribute("aria-expanded", true);
|
|
22089
22125
|
} else {
|
|
22090
22126
|
if (el._menu_sub.expanded) {
|
|
22091
|
-
el.setAttribute("aria-expanded", "false");
|
|
22092
22127
|
el._menu_sub.expanded = false;
|
|
22128
|
+
el.setAttribute("aria-expanded", false);
|
|
22093
22129
|
parentMenu.pauseKeyEvents = false;
|
|
22094
22130
|
}
|
|
22095
22131
|
el.addEventListener("keydown", onKeydown);
|
|
@@ -22097,9 +22133,11 @@ function menu_default(Alpine) {
|
|
|
22097
22133
|
}
|
|
22098
22134
|
}
|
|
22099
22135
|
el.addEventListener("mouseenter", focusIn);
|
|
22136
|
+
el.addEventListener("click", focusIn);
|
|
22100
22137
|
el.addEventListener("focus", focusIn);
|
|
22101
22138
|
cleanup(() => {
|
|
22102
22139
|
el.removeEventListener("mouseenter", focusIn);
|
|
22140
|
+
el.removeEventListener("click", focusIn);
|
|
22103
22141
|
el.removeEventListener("focus", focusIn);
|
|
22104
22142
|
el.removeEventListener("blur", focusOut);
|
|
22105
22143
|
el.removeEventListener("mouseleave", focusOut);
|
|
@@ -22559,7 +22597,7 @@ function radio_default(Alpine) {
|
|
|
22559
22597
|
"has-[input:invalid]:ring-negative/20",
|
|
22560
22598
|
"relative",
|
|
22561
22599
|
"rounded-full",
|
|
22562
|
-
"shadow-
|
|
22600
|
+
"shadow-input",
|
|
22563
22601
|
"shrink-0",
|
|
22564
22602
|
"size-5"
|
|
22565
22603
|
);
|
|
@@ -22597,7 +22635,7 @@ var FilterType = Object.freeze({
|
|
|
22597
22635
|
});
|
|
22598
22636
|
function select_default(Alpine) {
|
|
22599
22637
|
Alpine.directive("h-select", (el, {}, { Alpine: Alpine2 }) => {
|
|
22600
|
-
el.
|
|
22638
|
+
el._h_select = Alpine2.reactive({
|
|
22601
22639
|
id: void 0,
|
|
22602
22640
|
controls: `hsc${v4_default()}`,
|
|
22603
22641
|
expanded: false,
|
|
@@ -22605,22 +22643,41 @@ function select_default(Alpine) {
|
|
|
22605
22643
|
multiple: false,
|
|
22606
22644
|
label: [],
|
|
22607
22645
|
search: "",
|
|
22646
|
+
focusSearch: void 0,
|
|
22608
22647
|
filterType: FilterType["starts-with"]
|
|
22609
22648
|
});
|
|
22610
22649
|
el.setAttribute("data-slot", "select");
|
|
22611
22650
|
});
|
|
22612
22651
|
Alpine.directive("h-select-trigger", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
22613
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22652
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22614
22653
|
if (!select) {
|
|
22615
22654
|
throw new Error("h-select-trigger must be inside an h-select element");
|
|
22616
22655
|
} else if (el.hasOwnProperty("_x_model")) {
|
|
22617
|
-
select.
|
|
22618
|
-
select.
|
|
22656
|
+
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
22657
|
+
select._h_select.model = el._x_model.get();
|
|
22619
22658
|
}
|
|
22659
|
+
setButtonClasses(el);
|
|
22660
|
+
const setVariant = (variant) => {
|
|
22661
|
+
if (variant === "secondary") {
|
|
22662
|
+
el.classList.add(...buttonVariants["default"]);
|
|
22663
|
+
return;
|
|
22664
|
+
} else if (variant === "transparent") {
|
|
22665
|
+
el.classList.add(...buttonVariants["transparent"]);
|
|
22666
|
+
} else el.classList.add("shadow-input", ...buttonVariants["outline"]);
|
|
22667
|
+
};
|
|
22668
|
+
const setSize = (size3) => {
|
|
22669
|
+
const sizes = ["sm", "xs", "lg"];
|
|
22670
|
+
if (sizes.includes(size3)) {
|
|
22671
|
+
el.classList.add(...getButtonSize(size3));
|
|
22672
|
+
} else el.classList.add(...getButtonSize());
|
|
22673
|
+
};
|
|
22674
|
+
setVariant(el.getAttribute("data-variant"));
|
|
22675
|
+
setSize(el.getAttribute("data-size"));
|
|
22676
|
+
el.classList.add("w-full", "[&_svg]:opacity-50", "[&[data-state=open]>svg]:rotate-180");
|
|
22620
22677
|
el.setAttribute("type", "button");
|
|
22621
22678
|
const selectValue = document.createElement("span");
|
|
22622
22679
|
selectValue.setAttribute("data-slot", "select-value");
|
|
22623
|
-
selectValue.classList.add("pointer-events-none");
|
|
22680
|
+
selectValue.classList.add("text-left", "truncate", "pointer-events-none", "w-full");
|
|
22624
22681
|
function getPlaceholder() {
|
|
22625
22682
|
if (!el.value) {
|
|
22626
22683
|
const value = el.getAttribute("placeholder");
|
|
@@ -22635,100 +22692,41 @@ function select_default(Alpine) {
|
|
|
22635
22692
|
getPlaceholder();
|
|
22636
22693
|
const observer = new MutationObserver((mutations) => {
|
|
22637
22694
|
mutations.forEach((mutation) => {
|
|
22638
|
-
if (mutation.
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
getPlaceholder();
|
|
22644
|
-
}
|
|
22695
|
+
if (mutation.attributeName === "value") {
|
|
22696
|
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
22697
|
+
if (el.value) selectValue.classList.remove("text-muted-foreground");
|
|
22698
|
+
} else if (mutation.attributeName === "placeholder" && !select._h_select.label.length) {
|
|
22699
|
+
getPlaceholder();
|
|
22645
22700
|
}
|
|
22646
22701
|
});
|
|
22647
22702
|
});
|
|
22648
|
-
observer.observe(el, { attributes: true });
|
|
22703
|
+
observer.observe(el, { attributes: true, attributeFilter: ["value", "placeholder"] });
|
|
22649
22704
|
effect(() => {
|
|
22650
|
-
if (select.
|
|
22651
|
-
selectValue.innerText = select.
|
|
22652
|
-
} else if (select.
|
|
22653
|
-
selectValue.innerText = select.
|
|
22705
|
+
if (select._h_select.label.length === 1) {
|
|
22706
|
+
selectValue.innerText = select._h_select.label[0];
|
|
22707
|
+
} else if (select._h_select.label.length > 1) {
|
|
22708
|
+
selectValue.innerText = select._h_select.label.join(", ");
|
|
22654
22709
|
} else {
|
|
22655
22710
|
getPlaceholder();
|
|
22656
22711
|
}
|
|
22657
22712
|
});
|
|
22658
|
-
el.classList.add(
|
|
22659
|
-
"[&>*]:pointer-events-none",
|
|
22660
|
-
"cursor-pointer",
|
|
22661
|
-
"border-input",
|
|
22662
|
-
"focus-visible:border-ring",
|
|
22663
|
-
"focus-visible:ring-ring/50",
|
|
22664
|
-
"aria-invalid:ring-negative/20",
|
|
22665
|
-
"dark:aria-invalid:ring-negative/40",
|
|
22666
|
-
"aria-invalid:border-negative",
|
|
22667
|
-
"invalid:ring-negative/20",
|
|
22668
|
-
"dark:invalid:ring-negative/40",
|
|
22669
|
-
"invalid:border-negative",
|
|
22670
|
-
"hover:bg-secondary-hover",
|
|
22671
|
-
"active:bg-secondary-active",
|
|
22672
|
-
"flex",
|
|
22673
|
-
"w-full",
|
|
22674
|
-
"items-center",
|
|
22675
|
-
"justify-between",
|
|
22676
|
-
"gap-2",
|
|
22677
|
-
"rounded-control",
|
|
22678
|
-
"border",
|
|
22679
|
-
"bg-input-inner",
|
|
22680
|
-
"px-3",
|
|
22681
|
-
"text-sm",
|
|
22682
|
-
"whitespace-nowrap",
|
|
22683
|
-
"shadow-control",
|
|
22684
|
-
"transition-[color,box-shadow]",
|
|
22685
|
-
"outline-none",
|
|
22686
|
-
"focus-visible:ring-[3px]",
|
|
22687
|
-
"disabled:cursor-not-allowed",
|
|
22688
|
-
"disabled:opacity-50",
|
|
22689
|
-
"*:data-[slot=select-value]:line-clamp-1",
|
|
22690
|
-
"*:data-[slot=select-value]:flex",
|
|
22691
|
-
"*:data-[slot=select-value]:items-center",
|
|
22692
|
-
"*:data-[slot=select-value]:gap-2",
|
|
22693
|
-
"[&_svg]:pointer-events-none",
|
|
22694
|
-
"[&_svg]:shrink-0",
|
|
22695
|
-
"[&_svg:not([class*='size-'])]:size-4",
|
|
22696
|
-
"[&_svg]:size-4",
|
|
22697
|
-
"[&_svg]:opacity-50",
|
|
22698
|
-
"[&[data-state=open]>svg]:rotate-180"
|
|
22699
|
-
);
|
|
22700
22713
|
el.setAttribute("data-slot", "select-trigger");
|
|
22701
22714
|
if (el.hasAttribute("id")) {
|
|
22702
|
-
select.
|
|
22715
|
+
select._h_select.id = el.getAttribute("id");
|
|
22703
22716
|
} else {
|
|
22704
|
-
select.
|
|
22705
|
-
el.setAttribute("id", select.
|
|
22717
|
+
select._h_select.id = `hs${v4_default()}`;
|
|
22718
|
+
el.setAttribute("id", select._h_select.id);
|
|
22706
22719
|
}
|
|
22707
|
-
el.setAttribute("aria-controls", select.
|
|
22720
|
+
el.setAttribute("aria-controls", select._h_select.controls);
|
|
22708
22721
|
el.setAttribute("aria-haspopup", "listbox");
|
|
22709
22722
|
el.setAttribute("aria-autocomplete", "none");
|
|
22710
22723
|
el.setAttribute("role", "combobox");
|
|
22711
|
-
const sizes = {
|
|
22712
|
-
default: ["h-9", "py-2"],
|
|
22713
|
-
xs: ["h-6.5", "py-[0.188rem]"],
|
|
22714
|
-
sm: ["h-8", "py-1.5"]
|
|
22715
|
-
};
|
|
22716
|
-
function setSize(size3) {
|
|
22717
|
-
for (const [_, value] of Object.entries(sizes)) {
|
|
22718
|
-
el.classList.remove(...value);
|
|
22719
|
-
}
|
|
22720
|
-
if (sizes.hasOwnProperty(size3)) {
|
|
22721
|
-
el.classList.add(...sizes[size3]);
|
|
22722
|
-
}
|
|
22723
|
-
}
|
|
22724
|
-
if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
|
|
22725
|
-
setSize(el.getAttribute("data-size"));
|
|
22726
22724
|
effect(() => {
|
|
22727
|
-
el.setAttribute("data-state", select.
|
|
22728
|
-
el.setAttribute("aria-expanded", select.
|
|
22725
|
+
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
22726
|
+
el.setAttribute("aria-expanded", select._h_select.expanded);
|
|
22729
22727
|
});
|
|
22730
22728
|
const close = () => {
|
|
22731
|
-
select.
|
|
22729
|
+
select._h_select.expanded = false;
|
|
22732
22730
|
};
|
|
22733
22731
|
let content;
|
|
22734
22732
|
let options;
|
|
@@ -22736,26 +22734,72 @@ function select_default(Alpine) {
|
|
|
22736
22734
|
switch (event.key) {
|
|
22737
22735
|
case "Down":
|
|
22738
22736
|
case "ArrowDown":
|
|
22737
|
+
event.preventDefault();
|
|
22738
|
+
let nextIndex = 0;
|
|
22739
22739
|
for (let o = 0; o < options.length; o++) {
|
|
22740
|
-
if (options[o] ===
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
return;
|
|
22740
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22741
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22742
|
+
if (o < options.length - 1) nextIndex = o + 1;
|
|
22743
|
+
break;
|
|
22745
22744
|
}
|
|
22746
22745
|
}
|
|
22747
|
-
options[
|
|
22746
|
+
if (options[nextIndex].getAttribute("data-disabled") === "true") {
|
|
22747
|
+
if (nextIndex === options.length - 1) nextIndex = 0;
|
|
22748
|
+
for (let o = nextIndex; o < options.length; o++) {
|
|
22749
|
+
if (options[o].getAttribute("data-disabled") !== "true") {
|
|
22750
|
+
nextIndex = o;
|
|
22751
|
+
break;
|
|
22752
|
+
}
|
|
22753
|
+
}
|
|
22754
|
+
}
|
|
22755
|
+
options[nextIndex].setAttribute("tabindex", "0");
|
|
22756
|
+
options[nextIndex].focus();
|
|
22748
22757
|
break;
|
|
22749
22758
|
case "Up":
|
|
22750
22759
|
case "ArrowUp":
|
|
22760
|
+
event.preventDefault();
|
|
22761
|
+
let prevIndex = options.length - 1;
|
|
22751
22762
|
for (let o = options.length - 1; o >= 0; o--) {
|
|
22752
|
-
if (options[o] ===
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22763
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22764
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22765
|
+
if (o !== 0) prevIndex = o - 1;
|
|
22766
|
+
break;
|
|
22767
|
+
}
|
|
22768
|
+
}
|
|
22769
|
+
if (options[prevIndex].getAttribute("data-disabled") === "true") {
|
|
22770
|
+
if (prevIndex === 0) prevIndex = options.length - 1;
|
|
22771
|
+
for (let o = prevIndex; o >= 0; o--) {
|
|
22772
|
+
if (options[o].getAttribute("data-disabled") !== "true") {
|
|
22773
|
+
prevIndex = o;
|
|
22774
|
+
break;
|
|
22775
|
+
}
|
|
22776
|
+
}
|
|
22777
|
+
}
|
|
22778
|
+
options[prevIndex].setAttribute("tabindex", "0");
|
|
22779
|
+
options[prevIndex].focus();
|
|
22780
|
+
break;
|
|
22781
|
+
case "Home":
|
|
22782
|
+
case "PageUp":
|
|
22783
|
+
event.preventDefault();
|
|
22784
|
+
for (let o = 0; o < options.length; o++) {
|
|
22785
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22786
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22787
|
+
break;
|
|
22757
22788
|
}
|
|
22758
22789
|
}
|
|
22790
|
+
options[0].setAttribute("tabindex", "0");
|
|
22791
|
+
options[0].focus();
|
|
22792
|
+
break;
|
|
22793
|
+
case "End":
|
|
22794
|
+
case "PageDown":
|
|
22795
|
+
event.preventDefault();
|
|
22796
|
+
for (let o = 0; o < options.length; o++) {
|
|
22797
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22798
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22799
|
+
break;
|
|
22800
|
+
}
|
|
22801
|
+
}
|
|
22802
|
+
options[options.length - 1].setAttribute("tabindex", "0");
|
|
22759
22803
|
options[options.length - 1].focus();
|
|
22760
22804
|
break;
|
|
22761
22805
|
case "Enter":
|
|
@@ -22766,16 +22810,30 @@ function select_default(Alpine) {
|
|
|
22766
22810
|
case "Tab":
|
|
22767
22811
|
handler2();
|
|
22768
22812
|
break;
|
|
22813
|
+
case "Control":
|
|
22814
|
+
case "Shift":
|
|
22815
|
+
case "Alt":
|
|
22816
|
+
break;
|
|
22817
|
+
default:
|
|
22818
|
+
if (select._h_select.focusSearch) {
|
|
22819
|
+
for (let o = 0; o < options.length; o++) {
|
|
22820
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22821
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22822
|
+
break;
|
|
22823
|
+
}
|
|
22824
|
+
}
|
|
22825
|
+
select._h_select.focusSearch();
|
|
22826
|
+
}
|
|
22769
22827
|
}
|
|
22770
22828
|
};
|
|
22771
22829
|
const handler2 = () => {
|
|
22772
|
-
select.
|
|
22773
|
-
if (select.
|
|
22774
|
-
if (!content) content = select.querySelector(`#${select.
|
|
22830
|
+
select._h_select.expanded = !select._h_select.expanded;
|
|
22831
|
+
if (select._h_select.expanded) {
|
|
22832
|
+
if (!content) content = select.querySelector(`#${select._h_select.controls}`);
|
|
22775
22833
|
options = content.querySelectorAll("[role=option]");
|
|
22776
22834
|
}
|
|
22777
22835
|
Alpine2.nextTick(() => {
|
|
22778
|
-
if (select.
|
|
22836
|
+
if (select._h_select.expanded) {
|
|
22779
22837
|
top.addEventListener("click", close, { once: true });
|
|
22780
22838
|
el.parentElement.addEventListener("keydown", shiftFocus);
|
|
22781
22839
|
} else {
|
|
@@ -22803,19 +22861,19 @@ function select_default(Alpine) {
|
|
|
22803
22861
|
});
|
|
22804
22862
|
});
|
|
22805
22863
|
Alpine.directive("h-select-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
22806
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22864
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22807
22865
|
if (!select) {
|
|
22808
22866
|
throw new Error("h-select-content must be inside an h-select element");
|
|
22809
22867
|
}
|
|
22810
|
-
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-
|
|
22868
|
+
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");
|
|
22811
22869
|
el.setAttribute("data-slot", "select-content");
|
|
22812
22870
|
el.setAttribute("role", "listbox");
|
|
22813
22871
|
el.setAttribute("role", "presentation");
|
|
22814
|
-
el.setAttribute("id", select.
|
|
22872
|
+
el.setAttribute("id", select._h_select.controls);
|
|
22815
22873
|
el.setAttribute("tabindex", "-1");
|
|
22816
|
-
el.setAttribute("aria-labelledby", select.
|
|
22817
|
-
el.setAttribute("data-state", select.
|
|
22818
|
-
const control = select.querySelector(`#${select.
|
|
22874
|
+
el.setAttribute("aria-labelledby", select._h_select.id);
|
|
22875
|
+
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
22876
|
+
const control = select.querySelector(`#${select._h_select.id}`);
|
|
22819
22877
|
if (!control) {
|
|
22820
22878
|
throw new Error("h-select-content: trigger not found");
|
|
22821
22879
|
}
|
|
@@ -22844,8 +22902,8 @@ function select_default(Alpine) {
|
|
|
22844
22902
|
});
|
|
22845
22903
|
}
|
|
22846
22904
|
effect(() => {
|
|
22847
|
-
el.setAttribute("data-state", select.
|
|
22848
|
-
if (select.
|
|
22905
|
+
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
22906
|
+
if (select._h_select.expanded) {
|
|
22849
22907
|
autoUpdateCleanup = autoUpdate(control, el, updatePosition);
|
|
22850
22908
|
} else {
|
|
22851
22909
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
@@ -22857,14 +22915,16 @@ function select_default(Alpine) {
|
|
|
22857
22915
|
});
|
|
22858
22916
|
});
|
|
22859
22917
|
Alpine.directive("h-select-search", (el, { modifiers }, { effect, cleanup }) => {
|
|
22860
|
-
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22918
|
+
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22861
22919
|
if (!select) {
|
|
22862
22920
|
throw new Error("h-select-search must be inside an h-select element");
|
|
22863
|
-
} else
|
|
22921
|
+
} else {
|
|
22922
|
+
select._h_select.filterType = FilterType[modifiers[0]] ?? FilterType["starts-with"];
|
|
22923
|
+
}
|
|
22864
22924
|
el.classList.add("flex", "h-8", "items-center", "gap-2", "border-b", "px-2");
|
|
22865
22925
|
el.setAttribute("data-slot", "select-search");
|
|
22866
|
-
el.setAttribute("aria-autocomplete", select.
|
|
22867
|
-
el.setAttribute("aria-controls", select.
|
|
22926
|
+
el.setAttribute("aria-autocomplete", select._h_select.filterType === FilterType.none ? "both" : "list");
|
|
22927
|
+
el.setAttribute("aria-controls", select._h_select.controls);
|
|
22868
22928
|
el.setAttribute("aria-haspopup", "listbox");
|
|
22869
22929
|
el.setAttribute("role", "combobox");
|
|
22870
22930
|
el.setAttribute("autocomplete", "off");
|
|
@@ -22877,69 +22937,72 @@ function select_default(Alpine) {
|
|
|
22877
22937
|
searchInput.classList.add("placeholder:text-muted-foreground", "flex", "h-10", "w-full", "rounded-md", "bg-transparent", "py-3", "text-sm", "outline-hidden", "disabled:cursor-not-allowed", "disabled:opacity-50");
|
|
22878
22938
|
el.appendChild(searchIcon);
|
|
22879
22939
|
el.appendChild(searchInput);
|
|
22940
|
+
select._h_select.focusSearch = () => {
|
|
22941
|
+
searchInput.focus();
|
|
22942
|
+
};
|
|
22880
22943
|
function handler2(event) {
|
|
22881
|
-
if (event.type === "keydown" && event.key === "Escape") return;
|
|
22944
|
+
if (event.type === "keydown" && (event.key === "Escape" || event.key === "ArrowDown" || event.key === "Down")) return;
|
|
22882
22945
|
event.stopPropagation();
|
|
22883
22946
|
}
|
|
22884
22947
|
el.addEventListener("click", handler2);
|
|
22885
22948
|
el.addEventListener("keydown", handler2);
|
|
22886
|
-
if (select.
|
|
22949
|
+
if (select._h_select.filterType !== FilterType.none) {
|
|
22887
22950
|
let onInput2 = function() {
|
|
22888
|
-
select.
|
|
22951
|
+
select._h_select.search = searchInput.value.toLowerCase();
|
|
22889
22952
|
};
|
|
22890
22953
|
searchInput.addEventListener("keyup", onInput2);
|
|
22891
22954
|
}
|
|
22892
22955
|
effect(() => {
|
|
22893
|
-
if (select.
|
|
22894
|
-
el.setAttribute("aria-expanded", select.
|
|
22956
|
+
if (select._h_select.expanded) searchInput.focus({ preventScroll: true });
|
|
22957
|
+
el.setAttribute("aria-expanded", select._h_select.expanded);
|
|
22895
22958
|
});
|
|
22896
22959
|
cleanup(() => {
|
|
22897
22960
|
el.removeEventListener("click", handler2);
|
|
22898
22961
|
el.removeEventListener("keydown", handler2);
|
|
22899
|
-
if (select.
|
|
22962
|
+
if (select._h_select.filterType !== FilterType.none) searchInput.removeEventListener("keyup", onInput);
|
|
22900
22963
|
});
|
|
22901
22964
|
});
|
|
22902
22965
|
Alpine.directive("h-select-group", (el, {}, { effect }) => {
|
|
22903
22966
|
el.setAttribute("data-slot", "select-group");
|
|
22904
|
-
el.
|
|
22967
|
+
el._h_selectGroup = Alpine.reactive({
|
|
22905
22968
|
labelledby: void 0
|
|
22906
22969
|
});
|
|
22907
22970
|
effect(() => {
|
|
22908
|
-
if (el.
|
|
22909
|
-
el.setAttribute("aria-labelledby", el.
|
|
22971
|
+
if (el._h_selectGroup.labelledby) {
|
|
22972
|
+
el.setAttribute("aria-labelledby", el._h_selectGroup.labelledby);
|
|
22910
22973
|
}
|
|
22911
22974
|
});
|
|
22912
22975
|
});
|
|
22913
22976
|
Alpine.directive("h-select-label", (el) => {
|
|
22914
22977
|
el.classList.add("text-muted-foreground", "px-2", "py-1.5", "text-xs");
|
|
22915
22978
|
el.setAttribute("data-slot", "select-label");
|
|
22916
|
-
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22979
|
+
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_selectGroup"));
|
|
22917
22980
|
if (selectGroup) {
|
|
22918
22981
|
const id = `hsl${v4_default()}`;
|
|
22919
22982
|
el.setAttribute("id", id);
|
|
22920
|
-
selectGroup.
|
|
22983
|
+
selectGroup._h_selectGroup.labelledby = id;
|
|
22921
22984
|
}
|
|
22922
22985
|
});
|
|
22923
22986
|
Alpine.directive("h-select-option", (el, { expression }, { effect, evaluateLater, cleanup }) => {
|
|
22924
|
-
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22987
|
+
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22925
22988
|
if (!select) {
|
|
22926
22989
|
throw new Error("h-select-option must be inside an h-select element");
|
|
22927
22990
|
}
|
|
22928
22991
|
el.classList.add(
|
|
22929
22992
|
"focus:bg-primary",
|
|
22930
22993
|
"focus:text-primary-foreground",
|
|
22931
|
-
"hover:bg-
|
|
22932
|
-
"hover:text-
|
|
22994
|
+
"hover:bg-secondary-hover",
|
|
22995
|
+
"hover:text-secondary-foreground",
|
|
22933
22996
|
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
22934
22997
|
"focus:[&_svg:not([class*='text-'])]:text-primary-foreground",
|
|
22935
|
-
"hover:[&_svg:not([class*='text-'])]:text-
|
|
22998
|
+
"hover:[&_svg:not([class*='text-'])]:text-secondary-foreground",
|
|
22936
22999
|
"relative",
|
|
22937
23000
|
"flex",
|
|
22938
23001
|
"w-full",
|
|
22939
23002
|
"cursor-default",
|
|
22940
23003
|
"items-center",
|
|
22941
23004
|
"gap-2",
|
|
22942
|
-
"rounded-
|
|
23005
|
+
"rounded-sm",
|
|
22943
23006
|
"py-1.5",
|
|
22944
23007
|
"pr-8",
|
|
22945
23008
|
"pl-2",
|
|
@@ -22976,26 +23039,26 @@ function select_default(Alpine) {
|
|
|
22976
23039
|
const getLabel = evaluateLater(expression);
|
|
22977
23040
|
effect(() => {
|
|
22978
23041
|
getLabel((label) => {
|
|
22979
|
-
if (select.
|
|
22980
|
-
select.
|
|
22981
|
-
} else if (select.
|
|
22982
|
-
select.
|
|
23042
|
+
if (select._h_select.multiple && select._h_select.model.includes(getValue())) {
|
|
23043
|
+
select._h_select.label[select._h_select.label.indexOf(labelEl.innerText)] = label;
|
|
23044
|
+
} else if (select._h_select.model === getValue()) {
|
|
23045
|
+
select._h_select.label[0] = label;
|
|
22983
23046
|
}
|
|
22984
23047
|
labelEl.innerText = label;
|
|
22985
23048
|
});
|
|
22986
23049
|
});
|
|
22987
23050
|
effect(() => {
|
|
22988
|
-
if (select.
|
|
22989
|
-
if (select.
|
|
22990
|
-
if (!labelEl.innerText.toLowerCase().startsWith(select.
|
|
23051
|
+
if (select._h_select.search) {
|
|
23052
|
+
if (select._h_select.filterType === FilterType["starts-with"]) {
|
|
23053
|
+
if (!labelEl.innerText.toLowerCase().startsWith(select._h_select.search)) {
|
|
22991
23054
|
el.classList.add("hidden");
|
|
22992
23055
|
} else el.classList.remove("hidden");
|
|
22993
|
-
} else if (select.
|
|
22994
|
-
if (!labelEl.innerText.toLowerCase().includes(select.
|
|
23056
|
+
} else if (select._h_select.filterType === FilterType.contains) {
|
|
23057
|
+
if (!labelEl.innerText.toLowerCase().includes(select._h_select.search)) {
|
|
22995
23058
|
el.classList.add("hidden");
|
|
22996
23059
|
} else el.classList.remove("hidden");
|
|
22997
|
-
} else if (select.
|
|
22998
|
-
const terms = select.
|
|
23060
|
+
} else if (select._h_select.filterType === FilterType["contains-each"]) {
|
|
23061
|
+
const terms = select._h_select.search.split(" ");
|
|
22999
23062
|
const label = labelEl.innerText.toLowerCase();
|
|
23000
23063
|
if (!terms.every((term) => label.includes(term))) el.classList.add("hidden");
|
|
23001
23064
|
else el.classList.remove("hidden");
|
|
@@ -23008,11 +23071,11 @@ function select_default(Alpine) {
|
|
|
23008
23071
|
if (selected) {
|
|
23009
23072
|
indicatorEl.classList.remove("invisible");
|
|
23010
23073
|
el.setAttribute("aria-selected", "true");
|
|
23011
|
-
if (!select.
|
|
23012
|
-
select.
|
|
23013
|
-
} else if (!select.
|
|
23014
|
-
if (select.
|
|
23015
|
-
else select.
|
|
23074
|
+
if (!select._h_select.label.length) {
|
|
23075
|
+
select._h_select.label.push(labelEl.innerText);
|
|
23076
|
+
} else if (!select._h_select.label.includes(labelEl.innerText)) {
|
|
23077
|
+
if (select._h_select.multiple) select._h_select.label.push(labelEl.innerText);
|
|
23078
|
+
else select._h_select.label[0] = labelEl.innerText;
|
|
23016
23079
|
}
|
|
23017
23080
|
} else {
|
|
23018
23081
|
indicatorEl.classList.add("invisible");
|
|
@@ -23020,30 +23083,30 @@ function select_default(Alpine) {
|
|
|
23020
23083
|
}
|
|
23021
23084
|
}
|
|
23022
23085
|
function removeLabel() {
|
|
23023
|
-
const lIndex = select.
|
|
23024
|
-
if (lIndex > -1) select.
|
|
23086
|
+
const lIndex = select._h_select.label.indexOf(labelEl.innerText);
|
|
23087
|
+
if (lIndex > -1) select._h_select.label.splice(lIndex, 1);
|
|
23025
23088
|
}
|
|
23026
23089
|
effect(() => {
|
|
23027
|
-
if (select.
|
|
23028
|
-
setSelectedState(select.
|
|
23090
|
+
if (select._h_select.multiple) {
|
|
23091
|
+
setSelectedState(select._h_select.model.includes(getValue()));
|
|
23029
23092
|
} else {
|
|
23030
|
-
setSelectedState(select.
|
|
23093
|
+
setSelectedState(select._h_select.model === getValue());
|
|
23031
23094
|
}
|
|
23032
23095
|
});
|
|
23033
23096
|
const handler2 = (event) => {
|
|
23034
23097
|
if (event.type === "keydown" && event.key === "Enter" || event.type === "click") {
|
|
23035
|
-
if (select.
|
|
23036
|
-
const vIndex = select.
|
|
23098
|
+
if (select._h_select.multiple) {
|
|
23099
|
+
const vIndex = select._h_select.model.indexOf(getValue());
|
|
23037
23100
|
if (vIndex > -1) {
|
|
23038
|
-
select.
|
|
23101
|
+
select._h_select.model.splice(vIndex, 1);
|
|
23039
23102
|
removeLabel();
|
|
23040
23103
|
} else {
|
|
23041
|
-
select.
|
|
23104
|
+
select._h_select.model.push(getValue());
|
|
23042
23105
|
}
|
|
23043
|
-
} else if (select.
|
|
23044
|
-
select.
|
|
23106
|
+
} else if (select._h_select.model !== getValue()) {
|
|
23107
|
+
select._h_select.model = getValue();
|
|
23045
23108
|
} else {
|
|
23046
|
-
select.
|
|
23109
|
+
select._h_select.model = "";
|
|
23047
23110
|
removeLabel();
|
|
23048
23111
|
}
|
|
23049
23112
|
}
|
|
@@ -23083,6 +23146,61 @@ function separator_default(Alpine) {
|
|
|
23083
23146
|
});
|
|
23084
23147
|
}
|
|
23085
23148
|
|
|
23149
|
+
// src/components/sheet.js
|
|
23150
|
+
function sheet_default(Alpine) {
|
|
23151
|
+
Alpine.directive("h-sheet-overlay", (el, { expression }, { effect, evaluate: evaluate2, evaluateLater, cleanup }) => {
|
|
23152
|
+
el.classList.add("data-[open=false]:hidden", "fixed", "inset-0", "z-50", "bg-black/50");
|
|
23153
|
+
el.setAttribute("tabindex", "-1");
|
|
23154
|
+
el.setAttribute("data-slot", "sheet-overlay");
|
|
23155
|
+
el.setAttribute("data-open", evaluate2(expression));
|
|
23156
|
+
const getIsOpen = evaluateLater(expression);
|
|
23157
|
+
effect(() => {
|
|
23158
|
+
getIsOpen((isOpen) => {
|
|
23159
|
+
el.setAttribute("data-open", isOpen);
|
|
23160
|
+
});
|
|
23161
|
+
});
|
|
23162
|
+
const onClick = (event) => {
|
|
23163
|
+
if (event.target.getAttribute("data-slot") === "sheet-overlay") {
|
|
23164
|
+
evaluate2(`${expression} = false`);
|
|
23165
|
+
}
|
|
23166
|
+
};
|
|
23167
|
+
el.addEventListener("click", onClick);
|
|
23168
|
+
cleanup(() => {
|
|
23169
|
+
el.removeEventListener("click", onClick);
|
|
23170
|
+
});
|
|
23171
|
+
});
|
|
23172
|
+
Alpine.directive("h-sheet", (el, {}, { cleanup }) => {
|
|
23173
|
+
el.classList.add("bg-background", "fixed", "shadow-lg");
|
|
23174
|
+
el.setAttribute("data-slot", "sheet");
|
|
23175
|
+
let lastSide;
|
|
23176
|
+
const getSideClasses = (side) => {
|
|
23177
|
+
switch (side) {
|
|
23178
|
+
case "top":
|
|
23179
|
+
return ["inset-x-0", "top-0", "h-auto"];
|
|
23180
|
+
case "right":
|
|
23181
|
+
return ["inset-y-0", "right-0", "h-full", "w-auto", "sm:max-w-sm"];
|
|
23182
|
+
case "left":
|
|
23183
|
+
return ["inset-y-0", "left-0", "h-full", "w-auto", "sm:max-w-sm"];
|
|
23184
|
+
default:
|
|
23185
|
+
return ["inset-x-0", "bottom-0", "h-auto"];
|
|
23186
|
+
}
|
|
23187
|
+
};
|
|
23188
|
+
const setSide = (side) => {
|
|
23189
|
+
el.classList.remove(...getSideClasses(lastSide));
|
|
23190
|
+
el.classList.add(...getSideClasses(side));
|
|
23191
|
+
lastSide = side;
|
|
23192
|
+
};
|
|
23193
|
+
const observer = new MutationObserver(() => {
|
|
23194
|
+
setSide(el.getAttribute("data-align"));
|
|
23195
|
+
});
|
|
23196
|
+
setSide(el.getAttribute("data-align"));
|
|
23197
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-align"] });
|
|
23198
|
+
cleanup(() => {
|
|
23199
|
+
observer.disconnect();
|
|
23200
|
+
});
|
|
23201
|
+
});
|
|
23202
|
+
}
|
|
23203
|
+
|
|
23086
23204
|
// src/components/sidebar.js
|
|
23087
23205
|
function sidebar_default(Alpine) {
|
|
23088
23206
|
Alpine.directive("h-sidebar", (el, { modifiers }, { cleanup }) => {
|
|
@@ -23099,15 +23217,11 @@ function sidebar_default(Alpine) {
|
|
|
23099
23217
|
};
|
|
23100
23218
|
setFloating();
|
|
23101
23219
|
const observer = new MutationObserver((mutations) => {
|
|
23102
|
-
mutations.forEach((
|
|
23103
|
-
|
|
23104
|
-
if (mutation.attributeName === "data-floating") {
|
|
23105
|
-
setFloating();
|
|
23106
|
-
}
|
|
23107
|
-
}
|
|
23220
|
+
mutations.forEach(() => {
|
|
23221
|
+
setFloating();
|
|
23108
23222
|
});
|
|
23109
23223
|
});
|
|
23110
|
-
observer.observe(el, { attributes: true });
|
|
23224
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-floating"] });
|
|
23111
23225
|
cleanup(() => {
|
|
23112
23226
|
observer.disconnect();
|
|
23113
23227
|
});
|
|
@@ -23394,10 +23508,21 @@ function skeleton_default(Alpine) {
|
|
|
23394
23508
|
el.classList.add("bg-secondary", "animate-pulse");
|
|
23395
23509
|
if (modifiers.includes("control")) {
|
|
23396
23510
|
el.classList.add("rounded-control");
|
|
23511
|
+
switch (el.getAttribute("data-size")) {
|
|
23512
|
+
case "xs":
|
|
23513
|
+
el.classList.add("h-6.5");
|
|
23514
|
+
break;
|
|
23515
|
+
case "sm":
|
|
23516
|
+
el.classList.add("h-8");
|
|
23517
|
+
break;
|
|
23518
|
+
default:
|
|
23519
|
+
el.classList.add("h-9");
|
|
23520
|
+
break;
|
|
23521
|
+
}
|
|
23397
23522
|
} else if (modifiers.includes("card")) {
|
|
23398
23523
|
el.classList.add("rounded-lg");
|
|
23399
23524
|
} else if (modifiers.includes("avatar")) {
|
|
23400
|
-
el.classList.add("rounded-full", "size-8");
|
|
23525
|
+
el.classList.add("rounded-full", "size-8", "aspect-square");
|
|
23401
23526
|
} else el.classList.add("rounded-md");
|
|
23402
23527
|
el.setAttribute("data-slot", "skeleton");
|
|
23403
23528
|
});
|
|
@@ -23437,7 +23562,7 @@ function switch_default(Alpine) {
|
|
|
23437
23562
|
"before:pointer-events-none",
|
|
23438
23563
|
"before:ring-0",
|
|
23439
23564
|
"before:rounded-full",
|
|
23440
|
-
"before:shadow-
|
|
23565
|
+
"before:shadow-input",
|
|
23441
23566
|
"before:size-5",
|
|
23442
23567
|
"before:transition-transform",
|
|
23443
23568
|
"bg-muted",
|
|
@@ -23469,7 +23594,7 @@ function switch_default(Alpine) {
|
|
|
23469
23594
|
function table_default(Alpine) {
|
|
23470
23595
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
23471
23596
|
if (modifiers.includes("scroll")) {
|
|
23472
|
-
el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-
|
|
23597
|
+
el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-2", "[&_tfoot]:sticky", "[&_tfoot]:bottom-0", "[&_tfoot]:z-2", "[&_tbody_tr_th]:sticky", "[&_tbody_tr_th]:left-0", "[&_tbody_tr_th]:z-1");
|
|
23473
23598
|
} else {
|
|
23474
23599
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
23475
23600
|
}
|
|
@@ -23590,6 +23715,7 @@ function tabs_default(Alpine) {
|
|
|
23590
23715
|
"[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:min-h-12",
|
|
23591
23716
|
"data-[floating=true]:border",
|
|
23592
23717
|
"data-[floating=true]:shadow-xs",
|
|
23718
|
+
"data-[floating=true]:z-1",
|
|
23593
23719
|
"data-[floating=true]:rounded-lg",
|
|
23594
23720
|
"data-[floating=true]:p-[0.188rem]"
|
|
23595
23721
|
);
|
|
@@ -23760,8 +23886,11 @@ function text_default(Alpine) {
|
|
|
23760
23886
|
case "blockquote":
|
|
23761
23887
|
el.classList.add("mt-6", "border-l-2", "pl-6", "italic");
|
|
23762
23888
|
break;
|
|
23889
|
+
case "code-inline":
|
|
23890
|
+
el.classList.add("bg-muted", "relative", "rounded", "px-[0.3rem]", "py-[0.2rem]", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
|
|
23891
|
+
break;
|
|
23763
23892
|
case "code":
|
|
23764
|
-
el.classList.add("bg-muted", "relative", "rounded", "
|
|
23893
|
+
el.classList.add("bg-muted", "relative", "rounded", "p-3", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
|
|
23765
23894
|
break;
|
|
23766
23895
|
case "lead":
|
|
23767
23896
|
el.classList.add("text-muted-foreground", "text-xl");
|
|
@@ -23795,9 +23924,9 @@ function textarea_default(Alpine) {
|
|
|
23795
23924
|
"aria-invalid:ring-negative/20",
|
|
23796
23925
|
"dark:aria-invalid:ring-negative/40",
|
|
23797
23926
|
"aria-invalid:border-negative",
|
|
23798
|
-
"invalid
|
|
23799
|
-
"dark:invalid
|
|
23800
|
-
"invalid
|
|
23927
|
+
"invalid:!ring-negative/20",
|
|
23928
|
+
"dark:invalid:!ring-negative/40",
|
|
23929
|
+
"invalid:!border-negative",
|
|
23801
23930
|
"bg-input-inner",
|
|
23802
23931
|
"flex",
|
|
23803
23932
|
"field-sizing-content",
|
|
@@ -23808,7 +23937,7 @@ function textarea_default(Alpine) {
|
|
|
23808
23937
|
"px-3",
|
|
23809
23938
|
"py-2",
|
|
23810
23939
|
"text-base",
|
|
23811
|
-
"shadow-
|
|
23940
|
+
"shadow-input",
|
|
23812
23941
|
"transition-[color,box-shadow]",
|
|
23813
23942
|
"outline-none",
|
|
23814
23943
|
"focus-visible:ring-[3px]",
|
|
@@ -23817,7 +23946,7 @@ function textarea_default(Alpine) {
|
|
|
23817
23946
|
"md:text-sm"
|
|
23818
23947
|
);
|
|
23819
23948
|
if (modifiers.includes("group")) {
|
|
23820
|
-
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-
|
|
23949
|
+
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-input", "focus-visible:ring-[3px]");
|
|
23821
23950
|
el.classList.add("flex-1", "resize-none", "rounded-none", "border-0", "bg-transparent", "py-3", "shadow-none", "focus-visible:ring-0");
|
|
23822
23951
|
el.setAttribute("data-slot", "input-group-control");
|
|
23823
23952
|
} else el.setAttribute("data-slot", "textarea");
|
|
@@ -23958,7 +24087,7 @@ var getSelectedTime = (rawTime, convertTo12) => {
|
|
|
23958
24087
|
};
|
|
23959
24088
|
function timepicker_default(Alpine) {
|
|
23960
24089
|
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
23961
|
-
el.
|
|
24090
|
+
el._h_timepicker = Alpine2.reactive({
|
|
23962
24091
|
id: void 0,
|
|
23963
24092
|
controls: `htpc${v4_default()}`,
|
|
23964
24093
|
model: void 0,
|
|
@@ -23967,8 +24096,8 @@ function timepicker_default(Alpine) {
|
|
|
23967
24096
|
locale: void 0,
|
|
23968
24097
|
seconds: void 0,
|
|
23969
24098
|
close() {
|
|
23970
|
-
el.
|
|
23971
|
-
top.removeEventListener("click", el.
|
|
24099
|
+
el._h_timepicker.expanded = false;
|
|
24100
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
23972
24101
|
}
|
|
23973
24102
|
});
|
|
23974
24103
|
el._time = {
|
|
@@ -24008,7 +24137,7 @@ function timepicker_default(Alpine) {
|
|
|
24008
24137
|
"pr-2",
|
|
24009
24138
|
"text-sm",
|
|
24010
24139
|
"whitespace-nowrap",
|
|
24011
|
-
"shadow-
|
|
24140
|
+
"shadow-input",
|
|
24012
24141
|
"transition-[color,box-shadow]",
|
|
24013
24142
|
"duration-200",
|
|
24014
24143
|
"outline-none",
|
|
@@ -24035,28 +24164,28 @@ function timepicker_default(Alpine) {
|
|
|
24035
24164
|
effect(() => {
|
|
24036
24165
|
getConfig((config) => {
|
|
24037
24166
|
if (config) {
|
|
24038
|
-
if (config["locale"]) el.
|
|
24039
|
-
el.
|
|
24167
|
+
if (config["locale"]) el._h_timepicker.locale = config.locale;
|
|
24168
|
+
el._h_timepicker.seconds = config["seconds"];
|
|
24040
24169
|
if (config["is12Hour"] !== void 0) {
|
|
24041
|
-
el.
|
|
24170
|
+
el._h_timepicker.is12Hour = config.is12Hour;
|
|
24042
24171
|
} else {
|
|
24043
|
-
el.
|
|
24172
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24044
24173
|
}
|
|
24045
24174
|
}
|
|
24046
24175
|
});
|
|
24047
24176
|
});
|
|
24048
24177
|
} else {
|
|
24049
|
-
el.
|
|
24178
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24050
24179
|
}
|
|
24051
24180
|
const handler2 = (event) => {
|
|
24052
24181
|
if (event.type === "keydown" && event.key !== "Enter") return;
|
|
24053
|
-
el.
|
|
24054
|
-
el.setAttribute("aria-expanded", el.
|
|
24182
|
+
el._h_timepicker.expanded = !el._h_timepicker.expanded;
|
|
24183
|
+
el.setAttribute("aria-expanded", el._h_timepicker.expanded);
|
|
24055
24184
|
Alpine2.nextTick(() => {
|
|
24056
|
-
if (el.
|
|
24057
|
-
top.addEventListener("click", el.
|
|
24185
|
+
if (el._h_timepicker.expanded) {
|
|
24186
|
+
top.addEventListener("click", el._h_timepicker.close);
|
|
24058
24187
|
} else {
|
|
24059
|
-
top.removeEventListener("click", el.
|
|
24188
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24060
24189
|
}
|
|
24061
24190
|
});
|
|
24062
24191
|
};
|
|
@@ -24065,14 +24194,14 @@ function timepicker_default(Alpine) {
|
|
|
24065
24194
|
cleanup(() => {
|
|
24066
24195
|
el.removeEventListener("click", handler2);
|
|
24067
24196
|
el.removeEventListener("keydown", handler2);
|
|
24068
|
-
top.removeEventListener("click", el.
|
|
24197
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24069
24198
|
});
|
|
24070
24199
|
});
|
|
24071
24200
|
Alpine.directive("h-time-picker-input", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
24072
24201
|
if (el.tagName !== "INPUT") {
|
|
24073
24202
|
throw new Error("h-time-picker-input must be a readonly input of type text");
|
|
24074
24203
|
}
|
|
24075
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24204
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24076
24205
|
if (!timepicker) {
|
|
24077
24206
|
throw new Error("h-time-picker-input must be inside an h-time-picker element");
|
|
24078
24207
|
}
|
|
@@ -24082,9 +24211,9 @@ function timepicker_default(Alpine) {
|
|
|
24082
24211
|
});
|
|
24083
24212
|
};
|
|
24084
24213
|
if (el.hasOwnProperty("_x_model")) {
|
|
24085
|
-
timepicker.
|
|
24214
|
+
timepicker._h_timepicker.model = el._x_model;
|
|
24086
24215
|
} else {
|
|
24087
|
-
timepicker.
|
|
24216
|
+
timepicker._h_timepicker.model = {
|
|
24088
24217
|
get() {
|
|
24089
24218
|
return el.value;
|
|
24090
24219
|
},
|
|
@@ -24094,62 +24223,62 @@ function timepicker_default(Alpine) {
|
|
|
24094
24223
|
};
|
|
24095
24224
|
}
|
|
24096
24225
|
if (el.hasAttribute("id")) {
|
|
24097
|
-
timepicker.
|
|
24226
|
+
timepicker._h_timepicker.id = el.getAttribute("id");
|
|
24098
24227
|
} else {
|
|
24099
|
-
timepicker.
|
|
24100
|
-
el.setAttribute("id", timepicker.
|
|
24228
|
+
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
24229
|
+
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
24101
24230
|
}
|
|
24102
24231
|
el.classList.add("cursor-pointer", "bg-transparent", "outline-none", "flex-1", "h-full", "border-0", "focus-visible:ring-0", "md:text-sm", "text-base", "after:block", "after:w-1");
|
|
24103
24232
|
el.readOnly = true;
|
|
24104
24233
|
el.setAttribute("aria-autocomplete", "none");
|
|
24105
|
-
el.setAttribute("aria-controls", timepicker.
|
|
24234
|
+
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
24106
24235
|
el.setAttribute("aria-expanded", "false");
|
|
24107
24236
|
el.setAttribute("aria-haspopup", "dialog");
|
|
24108
24237
|
el.setAttribute("type", "text");
|
|
24109
24238
|
el.setAttribute("data-slot", "time-picker-input");
|
|
24110
|
-
const rawTime = timepicker.
|
|
24239
|
+
const rawTime = timepicker._h_timepicker.model.get();
|
|
24111
24240
|
if (rawTime) {
|
|
24112
|
-
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker.
|
|
24113
|
-
if (timepicker.
|
|
24114
|
-
timepicker.
|
|
24115
|
-
} else if (timepicker.
|
|
24116
|
-
timepicker.
|
|
24241
|
+
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker._h_timepicker.is12Hour);
|
|
24242
|
+
if (timepicker._h_timepicker.seconds === void 0 && !second) {
|
|
24243
|
+
timepicker._h_timepicker.seconds = false;
|
|
24244
|
+
} else if (timepicker._h_timepicker.seconds === void 0 && second) {
|
|
24245
|
+
timepicker._h_timepicker.seconds = true;
|
|
24117
24246
|
}
|
|
24118
|
-
if (timepicker.
|
|
24119
|
-
if (timepicker.
|
|
24120
|
-
timepicker.
|
|
24247
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24248
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24249
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"} ${period}`);
|
|
24121
24250
|
timepicker._time.parts.second = second ?? "00";
|
|
24122
24251
|
} else {
|
|
24123
|
-
timepicker.
|
|
24252
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute} ${period}`);
|
|
24124
24253
|
}
|
|
24125
24254
|
timepicker._time.parts.hour = hour;
|
|
24126
24255
|
timepicker._time.parts.minute = minute;
|
|
24127
24256
|
timepicker._time.parts.period = period;
|
|
24128
24257
|
} else {
|
|
24129
|
-
if (timepicker.
|
|
24130
|
-
timepicker.
|
|
24258
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24259
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"}`);
|
|
24131
24260
|
timepicker._time.parts.second = second ?? "00";
|
|
24132
24261
|
} else {
|
|
24133
|
-
timepicker.
|
|
24262
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}`);
|
|
24134
24263
|
}
|
|
24135
24264
|
timepicker._time.parts.hour = hour;
|
|
24136
24265
|
timepicker._time.parts.minute = minute;
|
|
24137
24266
|
}
|
|
24138
24267
|
}
|
|
24139
24268
|
let placeholder;
|
|
24140
|
-
if (timepicker.
|
|
24141
|
-
placeholder = timepicker.
|
|
24269
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24270
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:--:-- --" : "--:--:--";
|
|
24142
24271
|
} else {
|
|
24143
|
-
placeholder = timepicker.
|
|
24272
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:-- --" : "--:--";
|
|
24144
24273
|
}
|
|
24145
24274
|
el.setAttribute("placeholder", placeholder);
|
|
24146
24275
|
effect(() => {
|
|
24147
|
-
el.setAttribute("data-state", timepicker.
|
|
24148
|
-
el.setAttribute("aria-expanded", timepicker.
|
|
24276
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24277
|
+
el.setAttribute("aria-expanded", timepicker._h_timepicker.expanded);
|
|
24149
24278
|
});
|
|
24150
24279
|
}).before("h-button");
|
|
24151
24280
|
Alpine.directive("h-time-picker-popup", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
24152
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24281
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24153
24282
|
el.classList.add(
|
|
24154
24283
|
"overflow-hidden",
|
|
24155
24284
|
"outline-none",
|
|
@@ -24168,8 +24297,8 @@ function timepicker_default(Alpine) {
|
|
|
24168
24297
|
el.setAttribute("role", "dialog");
|
|
24169
24298
|
el.setAttribute("aria-modal", "true");
|
|
24170
24299
|
el.setAttribute("data-slot", "time-picker-popup");
|
|
24171
|
-
el.setAttribute("aria-labelledby", timepicker.
|
|
24172
|
-
el.setAttribute("data-state", timepicker.
|
|
24300
|
+
el.setAttribute("aria-labelledby", timepicker._h_timepicker.id);
|
|
24301
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24173
24302
|
const optionClasses = [
|
|
24174
24303
|
"px-3.5",
|
|
24175
24304
|
"py-2",
|
|
@@ -24191,7 +24320,7 @@ function timepicker_default(Alpine) {
|
|
|
24191
24320
|
const updateModel = () => {
|
|
24192
24321
|
let newValue;
|
|
24193
24322
|
if (timepicker._time.parts.hour !== null && timepicker._time.parts.minute !== null) {
|
|
24194
|
-
if (timepicker.
|
|
24323
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24195
24324
|
if (timepicker._time.parts.seconds !== null) {
|
|
24196
24325
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}:${timepicker._time.parts.second}`;
|
|
24197
24326
|
} else return;
|
|
@@ -24199,13 +24328,13 @@ function timepicker_default(Alpine) {
|
|
|
24199
24328
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}`;
|
|
24200
24329
|
}
|
|
24201
24330
|
} else return;
|
|
24202
|
-
if (timepicker.
|
|
24331
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24203
24332
|
if (timepicker._time.parts.period !== null) {
|
|
24204
24333
|
newValue += ` ${timepicker._time.parts.period}`;
|
|
24205
24334
|
} else return;
|
|
24206
24335
|
}
|
|
24207
24336
|
if (newValue) {
|
|
24208
|
-
timepicker.
|
|
24337
|
+
timepicker._h_timepicker.model.set(newValue);
|
|
24209
24338
|
timepicker._time.changed();
|
|
24210
24339
|
}
|
|
24211
24340
|
};
|
|
@@ -24213,22 +24342,22 @@ function timepicker_default(Alpine) {
|
|
|
24213
24342
|
let date = /* @__PURE__ */ new Date();
|
|
24214
24343
|
let hour = date.getHours();
|
|
24215
24344
|
timepicker._time.parts.period = hour >= 12 ? dayPeriodLabels.pm : dayPeriodLabels.am;
|
|
24216
|
-
if (timepicker.
|
|
24345
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24217
24346
|
hour = date.getHours() % 12 || 12;
|
|
24218
24347
|
}
|
|
24219
24348
|
let minute = date.getMinutes();
|
|
24220
24349
|
timepicker._time.parts.hour = hour < 10 ? `0${hour}` : hour.toString();
|
|
24221
24350
|
timepicker._time.parts.minute = minute < 10 ? `0${minute}` : minute.toString();
|
|
24222
|
-
if (timepicker.
|
|
24351
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24223
24352
|
let second = date.getSeconds();
|
|
24224
24353
|
timepicker._time.parts.second = second < 10 ? `0${second}` : second.toString();
|
|
24225
24354
|
}
|
|
24226
24355
|
updateModel();
|
|
24227
|
-
timepicker.
|
|
24356
|
+
timepicker._h_timepicker.close();
|
|
24228
24357
|
};
|
|
24229
24358
|
function onKeyDown(event) {
|
|
24230
24359
|
if (event.key === "Escape") {
|
|
24231
|
-
timepicker.
|
|
24360
|
+
timepicker._h_timepicker.close();
|
|
24232
24361
|
} else if (event.target.tagName === "LI") {
|
|
24233
24362
|
let list;
|
|
24234
24363
|
let inHoursList = event.target.parentElement.dataset.type === "hours";
|
|
@@ -24246,7 +24375,7 @@ function timepicker_default(Alpine) {
|
|
|
24246
24375
|
event.target.setAttribute("tabindex", "-1");
|
|
24247
24376
|
let prevElem = event.target.previousElementSibling;
|
|
24248
24377
|
if (prevElem === null || prevElem.classList.contains("hidden")) {
|
|
24249
|
-
if (inHoursList && timepicker.
|
|
24378
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24250
24379
|
prevElem = list.children[12];
|
|
24251
24380
|
} else {
|
|
24252
24381
|
prevElem = list.lastChild;
|
|
@@ -24259,7 +24388,7 @@ function timepicker_default(Alpine) {
|
|
|
24259
24388
|
event.target.setAttribute("tabindex", "-1");
|
|
24260
24389
|
let nextElem = event.target.nextElementSibling;
|
|
24261
24390
|
if (nextElem === null || nextElem.classList.contains("hidden")) {
|
|
24262
|
-
if (inHoursList && timepicker.
|
|
24391
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24263
24392
|
nextElem = list.children[1];
|
|
24264
24393
|
} else {
|
|
24265
24394
|
nextElem = list.firstChild;
|
|
@@ -24282,7 +24411,7 @@ function timepicker_default(Alpine) {
|
|
|
24282
24411
|
if (selectedHour) {
|
|
24283
24412
|
selectedHour.focus();
|
|
24284
24413
|
} else {
|
|
24285
|
-
hoursList.children[timepicker.
|
|
24414
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24286
24415
|
}
|
|
24287
24416
|
event.stopPropagation();
|
|
24288
24417
|
event.preventDefault();
|
|
@@ -24347,7 +24476,7 @@ function timepicker_default(Alpine) {
|
|
|
24347
24476
|
}
|
|
24348
24477
|
const secondsList = document.createElement("ul");
|
|
24349
24478
|
secondsList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24350
|
-
if (!timepicker.
|
|
24479
|
+
if (!timepicker._h_timepicker.seconds) {
|
|
24351
24480
|
secondsList.classList.add("hidden");
|
|
24352
24481
|
}
|
|
24353
24482
|
secondsList.setAttribute("role", "listbox");
|
|
@@ -24367,7 +24496,7 @@ function timepicker_default(Alpine) {
|
|
|
24367
24496
|
}
|
|
24368
24497
|
const periodList = document.createElement("ul");
|
|
24369
24498
|
periodList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24370
|
-
if (!timepicker.
|
|
24499
|
+
if (!timepicker._h_timepicker.is12Hour) {
|
|
24371
24500
|
periodList.classList.add("hidden");
|
|
24372
24501
|
}
|
|
24373
24502
|
periodList.setAttribute("role", "listbox");
|
|
@@ -24406,7 +24535,7 @@ function timepicker_default(Alpine) {
|
|
|
24406
24535
|
okButton.setAttribute("data-action", "close");
|
|
24407
24536
|
okButton.innerText = el.dataset.labelOk ?? "OK";
|
|
24408
24537
|
okButton.disabled = true;
|
|
24409
|
-
okButton.addEventListener("click", timepicker.
|
|
24538
|
+
okButton.addEventListener("click", timepicker._h_timepicker.close);
|
|
24410
24539
|
footer.appendChild(okButton);
|
|
24411
24540
|
el.appendChild(footer);
|
|
24412
24541
|
Alpine2.initTree(footer);
|
|
@@ -24415,7 +24544,7 @@ function timepicker_default(Alpine) {
|
|
|
24415
24544
|
let selectedSecond;
|
|
24416
24545
|
let selectedPeriod;
|
|
24417
24546
|
function render() {
|
|
24418
|
-
if (timepicker.
|
|
24547
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24419
24548
|
hoursList.firstChild.classList.add("hidden");
|
|
24420
24549
|
for (let h = 1; h < 13; h++) {
|
|
24421
24550
|
if (hoursList.children[h].innerText === timepicker._time.parts.hour) {
|
|
@@ -24446,7 +24575,7 @@ function timepicker_default(Alpine) {
|
|
|
24446
24575
|
}
|
|
24447
24576
|
}
|
|
24448
24577
|
if (!selectedHour) {
|
|
24449
|
-
hoursList.children[timepicker.
|
|
24578
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].setAttribute("tabindex", "0");
|
|
24450
24579
|
}
|
|
24451
24580
|
for (let m = 0; m < minutesList.children.length; m++) {
|
|
24452
24581
|
if (minutesList.children[m].innerText === timepicker._time.parts.minute) {
|
|
@@ -24461,7 +24590,7 @@ function timepicker_default(Alpine) {
|
|
|
24461
24590
|
if (!selectedMinute) {
|
|
24462
24591
|
minutesList.firstChild.setAttribute("tabindex", "0");
|
|
24463
24592
|
}
|
|
24464
|
-
if (timepicker.
|
|
24593
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24465
24594
|
secondsList.classList.remove("hidden");
|
|
24466
24595
|
for (let s = 0; s < secondsList.children.length; s++) {
|
|
24467
24596
|
if (secondsList.children[s].innerText === timepicker._time.parts.second) {
|
|
@@ -24476,20 +24605,20 @@ function timepicker_default(Alpine) {
|
|
|
24476
24605
|
if (!selectedSecond) {
|
|
24477
24606
|
secondsList.firstChild.setAttribute("tabindex", "0");
|
|
24478
24607
|
}
|
|
24479
|
-
if (timepicker.
|
|
24608
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24480
24609
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second && timepicker._time.parts.period ? false : true;
|
|
24481
24610
|
} else {
|
|
24482
24611
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second ? false : true;
|
|
24483
24612
|
}
|
|
24484
24613
|
} else {
|
|
24485
24614
|
secondsList.classList.add("hidden");
|
|
24486
|
-
if (timepicker.
|
|
24615
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24487
24616
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.period ? false : true;
|
|
24488
24617
|
} else {
|
|
24489
24618
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute ? false : true;
|
|
24490
24619
|
}
|
|
24491
24620
|
}
|
|
24492
|
-
if (timepicker.
|
|
24621
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24493
24622
|
periodList.classList.remove("hidden");
|
|
24494
24623
|
for (let p = 0; p < periodList.children.length; p++) {
|
|
24495
24624
|
if (periodList.children[p].innerText === timepicker._time.parts.period) {
|
|
@@ -24522,7 +24651,7 @@ function timepicker_default(Alpine) {
|
|
|
24522
24651
|
if (selectedHour) {
|
|
24523
24652
|
selectedHour.focus();
|
|
24524
24653
|
} else {
|
|
24525
|
-
hoursList.children[timepicker.
|
|
24654
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24526
24655
|
}
|
|
24527
24656
|
Object.assign(el.style, {
|
|
24528
24657
|
left: `${x}px`,
|
|
@@ -24531,13 +24660,13 @@ function timepicker_default(Alpine) {
|
|
|
24531
24660
|
});
|
|
24532
24661
|
}
|
|
24533
24662
|
effect(() => {
|
|
24534
|
-
el.setAttribute("data-state", timepicker.
|
|
24535
|
-
if (timepicker.
|
|
24663
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24664
|
+
if (timepicker._h_timepicker.expanded) {
|
|
24536
24665
|
render();
|
|
24537
24666
|
autoUpdateCleanup = autoUpdate(timepicker, el, updatePosition);
|
|
24538
24667
|
if (selectedHour) selectedHour.scrollIntoView({ block: "center" });
|
|
24539
24668
|
if (selectedMinute) selectedMinute.scrollIntoView({ block: "center" });
|
|
24540
|
-
if (selectedSecond && timepicker.
|
|
24669
|
+
if (selectedSecond && timepicker._h_timepicker.seconds) selectedSecond.scrollIntoView({ block: "center" });
|
|
24541
24670
|
} else {
|
|
24542
24671
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
24543
24672
|
Object.assign(el.style, {
|
|
@@ -24549,7 +24678,7 @@ function timepicker_default(Alpine) {
|
|
|
24549
24678
|
cleanup(() => {
|
|
24550
24679
|
el.removeEventListener("keydown", onKeyDown);
|
|
24551
24680
|
el.removeEventListener("click", onClick);
|
|
24552
|
-
okButton.removeEventListener("click", timepicker.
|
|
24681
|
+
okButton.removeEventListener("click", timepicker._h_timepicker.close);
|
|
24553
24682
|
for (let h = 0; h < hoursList.children.length; h++) {
|
|
24554
24683
|
hoursList.children[h].removeEventListener("click", setHour);
|
|
24555
24684
|
}
|
|
@@ -24583,6 +24712,7 @@ function toolbar_default(Alpine) {
|
|
|
24583
24712
|
"w-full",
|
|
24584
24713
|
"h-12",
|
|
24585
24714
|
"data-[size=sm]:h-8",
|
|
24715
|
+
"data-[size=md]:h-10",
|
|
24586
24716
|
"data-[variant=transparent]:bg-transparent",
|
|
24587
24717
|
"data-[variant=transparent]:text-foreground",
|
|
24588
24718
|
"data-[floating=true]:shadow-xs",
|
|
@@ -24592,11 +24722,11 @@ function toolbar_default(Alpine) {
|
|
|
24592
24722
|
el.setAttribute("data-slot", "toolbar");
|
|
24593
24723
|
});
|
|
24594
24724
|
Alpine.directive("h-toolbar-image", (el) => {
|
|
24595
|
-
el.classList.add("size-8", "[[data-size=sm]_&]:size-6");
|
|
24725
|
+
el.classList.add("size-8", "[[data-size=md]_&]:size-7", "[[data-size=sm]_&]:size-6");
|
|
24596
24726
|
el.setAttribute("data-slot", "toolbar-image");
|
|
24597
24727
|
});
|
|
24598
24728
|
Alpine.directive("h-toolbar-title", (el) => {
|
|
24599
|
-
el.classList.add("text", "[[data-size=sm]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
|
|
24729
|
+
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");
|
|
24600
24730
|
el.setAttribute("data-slot", "toolbar-title");
|
|
24601
24731
|
});
|
|
24602
24732
|
Alpine.directive("h-toolbar-spacer", (el) => {
|
|
@@ -24605,7 +24735,7 @@ function toolbar_default(Alpine) {
|
|
|
24605
24735
|
el.setAttribute("data-slot", "toolbar-spacer");
|
|
24606
24736
|
});
|
|
24607
24737
|
Alpine.directive("h-toolbar-separator", (el) => {
|
|
24608
|
-
el.classList.add("w-px", "h-8", "[[data-size=sm]_&]:h-6", "border-l");
|
|
24738
|
+
el.classList.add("w-px", "h-8", "[[data-size=md]_&]:h-6", "[[data-size=sm]_&]:h-6", "border-l");
|
|
24609
24739
|
el.setAttribute("data-slot", "toolbar-separator");
|
|
24610
24740
|
});
|
|
24611
24741
|
}
|
|
@@ -24688,7 +24818,24 @@ function tooltip_default(Alpine) {
|
|
|
24688
24818
|
}
|
|
24689
24819
|
|
|
24690
24820
|
// package.json
|
|
24691
|
-
var version = "0.
|
|
24821
|
+
var version = "0.6.0";
|
|
24822
|
+
|
|
24823
|
+
// src/utils/breakpoint-listener.js
|
|
24824
|
+
function getBreakpointListener(handler2, breakpoint = 768) {
|
|
24825
|
+
const mql = top.matchMedia(`(width <= ${breakpoint}px)`);
|
|
24826
|
+
const onWidthChange = (event) => {
|
|
24827
|
+
handler2(event.matches);
|
|
24828
|
+
};
|
|
24829
|
+
mql.addEventListener("change", onWidthChange);
|
|
24830
|
+
handler2(mql.matches);
|
|
24831
|
+
return {
|
|
24832
|
+
_mql: mql,
|
|
24833
|
+
_onWidthChange: onWidthChange,
|
|
24834
|
+
remove() {
|
|
24835
|
+
this._mql.removeEventListener("change", this._onWidthChange);
|
|
24836
|
+
}
|
|
24837
|
+
};
|
|
24838
|
+
}
|
|
24692
24839
|
|
|
24693
24840
|
// src/utils/theme.js
|
|
24694
24841
|
var colorSchemeKey = "codbex.harmonia.colorMode";
|
|
@@ -24741,53 +24888,62 @@ var getColorScheme = () => {
|
|
|
24741
24888
|
};
|
|
24742
24889
|
initColorScheme();
|
|
24743
24890
|
|
|
24891
|
+
// src/utils/focus.js
|
|
24892
|
+
function focus_default(Alpine) {
|
|
24893
|
+
Alpine.directive("h-focus", (el, { expression }, { effect, evaluateLater }) => {
|
|
24894
|
+
const getValue = evaluateLater(expression);
|
|
24895
|
+
effect(() => {
|
|
24896
|
+
getValue((val) => {
|
|
24897
|
+
if (val) el.focus();
|
|
24898
|
+
});
|
|
24899
|
+
});
|
|
24900
|
+
});
|
|
24901
|
+
}
|
|
24902
|
+
|
|
24744
24903
|
// src/module.js
|
|
24745
|
-
var
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
setColorScheme,
|
|
24787
|
-
getColorScheme,
|
|
24788
|
-
version
|
|
24904
|
+
var registerComponents = (registerPlugin) => {
|
|
24905
|
+
registerPlugin(accordion_default);
|
|
24906
|
+
registerPlugin(alert_default);
|
|
24907
|
+
registerPlugin(avatar_default);
|
|
24908
|
+
registerPlugin(badge_default);
|
|
24909
|
+
registerPlugin(button_default);
|
|
24910
|
+
registerPlugin(calendar_default);
|
|
24911
|
+
registerPlugin(card_default);
|
|
24912
|
+
registerPlugin(checkbox_default);
|
|
24913
|
+
registerPlugin(collapsible_default);
|
|
24914
|
+
registerPlugin(datepicker_default);
|
|
24915
|
+
registerPlugin(dialog_default);
|
|
24916
|
+
registerPlugin(fieldset_default);
|
|
24917
|
+
registerPlugin(focus_default);
|
|
24918
|
+
registerPlugin(icon_default);
|
|
24919
|
+
registerPlugin(info_page_default);
|
|
24920
|
+
registerPlugin(input_default);
|
|
24921
|
+
registerPlugin(label_default);
|
|
24922
|
+
registerPlugin(list_default);
|
|
24923
|
+
registerPlugin(menu_default);
|
|
24924
|
+
registerPlugin(pagination_default);
|
|
24925
|
+
registerPlugin(popover_default);
|
|
24926
|
+
registerPlugin(progress_default);
|
|
24927
|
+
registerPlugin(radio_default);
|
|
24928
|
+
registerPlugin(range_default);
|
|
24929
|
+
registerPlugin(select_default);
|
|
24930
|
+
registerPlugin(separator_default);
|
|
24931
|
+
registerPlugin(sheet_default);
|
|
24932
|
+
registerPlugin(sidebar_default);
|
|
24933
|
+
registerPlugin(skeleton_default);
|
|
24934
|
+
registerPlugin(spinner_default);
|
|
24935
|
+
registerPlugin(switch_default);
|
|
24936
|
+
registerPlugin(table_default);
|
|
24937
|
+
registerPlugin(tabs_default);
|
|
24938
|
+
registerPlugin(tag_default);
|
|
24939
|
+
registerPlugin(text_default);
|
|
24940
|
+
registerPlugin(textarea_default);
|
|
24941
|
+
registerPlugin(tile_default);
|
|
24942
|
+
registerPlugin(timepicker_default);
|
|
24943
|
+
registerPlugin(toolbar_default);
|
|
24944
|
+
registerPlugin(tooltip_default);
|
|
24789
24945
|
};
|
|
24790
|
-
var module_default =
|
|
24946
|
+
var module_default = registerComponents;
|
|
24791
24947
|
export {
|
|
24792
24948
|
accordion_default as Accordion,
|
|
24793
24949
|
alert_default as Alert,
|
|
@@ -24801,6 +24957,7 @@ export {
|
|
|
24801
24957
|
datepicker_default as DatePicker,
|
|
24802
24958
|
dialog_default as Dialog,
|
|
24803
24959
|
fieldset_default as Fieldset,
|
|
24960
|
+
focus_default as Focus,
|
|
24804
24961
|
icon_default as Icon,
|
|
24805
24962
|
info_page_default as InfoPage,
|
|
24806
24963
|
input_default as Input,
|
|
@@ -24814,6 +24971,7 @@ export {
|
|
|
24814
24971
|
range_default as Range,
|
|
24815
24972
|
select_default as Select,
|
|
24816
24973
|
separator_default as Separator,
|
|
24974
|
+
sheet_default as Sheet,
|
|
24817
24975
|
sidebar_default as Sidebar,
|
|
24818
24976
|
skeleton_default as Skeleton,
|
|
24819
24977
|
spinner_default as Spinner,
|
|
@@ -24827,7 +24985,12 @@ export {
|
|
|
24827
24985
|
timepicker_default as TimePicker,
|
|
24828
24986
|
toolbar_default as Toolbar,
|
|
24829
24987
|
tooltip_default as Tooltip,
|
|
24830
|
-
module_default as default
|
|
24988
|
+
module_default as default,
|
|
24989
|
+
getBreakpointListener,
|
|
24990
|
+
getColorScheme,
|
|
24991
|
+
registerComponents,
|
|
24992
|
+
setColorScheme,
|
|
24993
|
+
version
|
|
24831
24994
|
};
|
|
24832
24995
|
/*! Bundled license information:
|
|
24833
24996
|
|