@codbex/harmonia 0.5.0 → 0.7.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 +567 -270
- package/dist/harmonia.esm.min.js +3 -3
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +565 -271
- 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,14 +18425,14 @@ 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
|
}
|
|
@@ -18440,24 +18440,24 @@ function accordion_default(Alpine) {
|
|
|
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,8 +18466,8 @@ 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
|
}
|
|
@@ -18522,17 +18522,17 @@ function accordion_default(Alpine) {
|
|
|
18522
18522
|
button.appendChild(chevronDown);
|
|
18523
18523
|
});
|
|
18524
18524
|
});
|
|
18525
|
-
button.setAttribute("id", accordionItem.
|
|
18526
|
-
button.setAttribute("aria-controls", accordionItem.
|
|
18525
|
+
button.setAttribute("id", accordionItem._h_accordionItem.id);
|
|
18526
|
+
button.setAttribute("aria-controls", accordionItem._h_accordionItem.controls);
|
|
18527
18527
|
const setAttributes = () => {
|
|
18528
|
-
button.setAttribute("data-state", accordionItem.
|
|
18529
|
-
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);
|
|
18530
18530
|
};
|
|
18531
18531
|
const handler2 = () => {
|
|
18532
|
-
accordionItem.
|
|
18532
|
+
accordionItem._h_accordionItem.expanded = !accordionItem._h_accordionItem.expanded;
|
|
18533
18533
|
setAttributes();
|
|
18534
|
-
if (accordion.
|
|
18535
|
-
accordion.
|
|
18534
|
+
if (accordion._h_accordion.single) {
|
|
18535
|
+
accordion._h_accordion.expandedId = accordionItem._h_accordionItem.id;
|
|
18536
18536
|
}
|
|
18537
18537
|
};
|
|
18538
18538
|
setAttributes();
|
|
@@ -18540,10 +18540,10 @@ function accordion_default(Alpine) {
|
|
|
18540
18540
|
cleanup(() => {
|
|
18541
18541
|
el.removeEventListener("click", handler2);
|
|
18542
18542
|
});
|
|
18543
|
-
if (accordion.
|
|
18543
|
+
if (accordion._h_accordion.single) {
|
|
18544
18544
|
effect(() => {
|
|
18545
|
-
if (accordion.
|
|
18546
|
-
accordionItem.
|
|
18545
|
+
if (accordion._h_accordion.expandedId !== accordionItem._h_accordionItem.id) {
|
|
18546
|
+
accordionItem._h_accordionItem.expanded = false;
|
|
18547
18547
|
setAttributes();
|
|
18548
18548
|
}
|
|
18549
18549
|
});
|
|
@@ -18552,13 +18552,13 @@ function accordion_default(Alpine) {
|
|
|
18552
18552
|
Alpine.directive("h-accordion-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
18553
18553
|
el.classList.add("pt-0", "pb-4", "overflow-hidden", "text-sm", "data-[state=closed]:hidden");
|
|
18554
18554
|
el.setAttribute("data-slot", "accordion-content");
|
|
18555
|
-
const parent = Alpine2.findClosest(el.parentElement, (parent2) => parent2.hasOwnProperty("
|
|
18555
|
+
const parent = Alpine2.findClosest(el.parentElement, (parent2) => parent2.hasOwnProperty("_h_accordionItem"));
|
|
18556
18556
|
if (parent) {
|
|
18557
|
-
el.setAttribute("id", parent.
|
|
18558
|
-
el.setAttribute("aria-labelledby", parent.
|
|
18559
|
-
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");
|
|
18560
18560
|
effect(() => {
|
|
18561
|
-
el.setAttribute("data-state", parent.
|
|
18561
|
+
el.setAttribute("data-state", parent._h_accordionItem.expanded ? "open" : "closed");
|
|
18562
18562
|
});
|
|
18563
18563
|
}
|
|
18564
18564
|
});
|
|
@@ -18648,7 +18648,7 @@ function avatar_default(Alpine) {
|
|
|
18648
18648
|
"[&>svg]:size-5"
|
|
18649
18649
|
);
|
|
18650
18650
|
el.setAttribute("data-slot", "avatar");
|
|
18651
|
-
el.
|
|
18651
|
+
el._h_avatar = Alpine2.reactive({
|
|
18652
18652
|
fallback: false
|
|
18653
18653
|
});
|
|
18654
18654
|
if (el.tagName === "BUTTON") {
|
|
@@ -18656,7 +18656,7 @@ function avatar_default(Alpine) {
|
|
|
18656
18656
|
}
|
|
18657
18657
|
});
|
|
18658
18658
|
Alpine.directive("h-avatar-image", (el, {}, { cleanup }) => {
|
|
18659
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18659
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
18660
18660
|
if (!avatar) {
|
|
18661
18661
|
throw new Error("h-avatar-image must be inside an h-avatar element");
|
|
18662
18662
|
}
|
|
@@ -18667,7 +18667,7 @@ function avatar_default(Alpine) {
|
|
|
18667
18667
|
function fallback(active = false) {
|
|
18668
18668
|
if (active) el.classList.add("hidden");
|
|
18669
18669
|
else el.classList.remove("hidden");
|
|
18670
|
-
avatar.
|
|
18670
|
+
avatar._h_avatar.fallback = active;
|
|
18671
18671
|
}
|
|
18672
18672
|
function completeCheck() {
|
|
18673
18673
|
if (el.complete) {
|
|
@@ -18692,14 +18692,14 @@ function avatar_default(Alpine) {
|
|
|
18692
18692
|
});
|
|
18693
18693
|
});
|
|
18694
18694
|
Alpine.directive("h-avatar-fallback", (el, {}, { effect }) => {
|
|
18695
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
18695
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
18696
18696
|
if (!avatar) {
|
|
18697
18697
|
throw new Error("h-avatar-fallback must be inside an h-avatar element");
|
|
18698
18698
|
}
|
|
18699
18699
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
18700
18700
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
18701
18701
|
effect(() => {
|
|
18702
|
-
if (avatar.
|
|
18702
|
+
if (avatar._h_avatar.fallback) el.classList.remove("hidden");
|
|
18703
18703
|
else el.classList.add("hidden");
|
|
18704
18704
|
});
|
|
18705
18705
|
});
|
|
@@ -18713,7 +18713,7 @@ function badge_default(Alpine) {
|
|
|
18713
18713
|
"inline-flex",
|
|
18714
18714
|
"items-center",
|
|
18715
18715
|
"justify-center",
|
|
18716
|
-
"rounded-
|
|
18716
|
+
"rounded-full",
|
|
18717
18717
|
"border",
|
|
18718
18718
|
"px-2",
|
|
18719
18719
|
"py-0.5",
|
|
@@ -18765,7 +18765,7 @@ var buttonVariants = {
|
|
|
18765
18765
|
default: [
|
|
18766
18766
|
"bg-secondary",
|
|
18767
18767
|
"text-secondary-foreground",
|
|
18768
|
-
"shadow-
|
|
18768
|
+
"shadow-button",
|
|
18769
18769
|
"hover:bg-secondary-hover",
|
|
18770
18770
|
"active:bg-secondary-active",
|
|
18771
18771
|
"aria-pressed:bg-secondary-active",
|
|
@@ -18776,7 +18776,7 @@ var buttonVariants = {
|
|
|
18776
18776
|
primary: [
|
|
18777
18777
|
"bg-primary",
|
|
18778
18778
|
"text-primary-foreground",
|
|
18779
|
-
"shadow-
|
|
18779
|
+
"shadow-button",
|
|
18780
18780
|
"hover:bg-primary-hover",
|
|
18781
18781
|
"active:bg-primary-active",
|
|
18782
18782
|
"aria-pressed:bg-primary-active",
|
|
@@ -18787,7 +18787,7 @@ var buttonVariants = {
|
|
|
18787
18787
|
positive: [
|
|
18788
18788
|
"bg-positive",
|
|
18789
18789
|
"text-positive-foreground",
|
|
18790
|
-
"shadow-
|
|
18790
|
+
"shadow-button",
|
|
18791
18791
|
"hover:bg-positive-hover",
|
|
18792
18792
|
"active:bg-positive-active",
|
|
18793
18793
|
"aria-pressed:bg-positive-active",
|
|
@@ -18798,7 +18798,7 @@ var buttonVariants = {
|
|
|
18798
18798
|
negative: [
|
|
18799
18799
|
"bg-negative",
|
|
18800
18800
|
"text-negative-foreground",
|
|
18801
|
-
"shadow-
|
|
18801
|
+
"shadow-button",
|
|
18802
18802
|
"hover:bg-negative-hover",
|
|
18803
18803
|
"active:bg-negative-active",
|
|
18804
18804
|
"aria-pressed:bg-negative-active",
|
|
@@ -18809,7 +18809,7 @@ var buttonVariants = {
|
|
|
18809
18809
|
warning: [
|
|
18810
18810
|
"bg-warning",
|
|
18811
18811
|
"text-warning-foreground",
|
|
18812
|
-
"shadow-
|
|
18812
|
+
"shadow-button",
|
|
18813
18813
|
"hover:bg-warning-hover",
|
|
18814
18814
|
"active:bg-warning-active",
|
|
18815
18815
|
"aria-pressed:bg-warning-active",
|
|
@@ -18900,21 +18900,24 @@ function button_default(Alpine) {
|
|
|
18900
18900
|
el.setAttribute("data-slot", "button");
|
|
18901
18901
|
}
|
|
18902
18902
|
const inGroup = modifiers.includes("group");
|
|
18903
|
+
let lastSize;
|
|
18903
18904
|
function setVariant(variant) {
|
|
18904
18905
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
18905
18906
|
el.classList.remove(...value);
|
|
18906
18907
|
}
|
|
18907
18908
|
if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
|
|
18908
18909
|
}
|
|
18909
|
-
function setSize(size3) {
|
|
18910
|
+
function setSize(size3 = "default") {
|
|
18911
|
+
el.classList.remove(...getButtonSize(lastSize, inGroup));
|
|
18910
18912
|
el.classList.add(...getButtonSize(size3, inGroup));
|
|
18911
|
-
if (size3
|
|
18913
|
+
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
18912
18914
|
console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
|
|
18913
18915
|
}
|
|
18916
|
+
lastSize = size3;
|
|
18914
18917
|
}
|
|
18915
18918
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
18916
18919
|
if (inGroup) {
|
|
18917
|
-
el.classList.remove("shadow-
|
|
18920
|
+
el.classList.remove("shadow-button", "inline-flex");
|
|
18918
18921
|
el.classList.add("shadow-none", "flex");
|
|
18919
18922
|
setSize(el.getAttribute("data-size") ?? "xs");
|
|
18920
18923
|
} else {
|
|
@@ -20454,7 +20457,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
20454
20457
|
var import_lucide2 = __toESM(require_lucide(), 1);
|
|
20455
20458
|
function calendar_default(Alpine) {
|
|
20456
20459
|
Alpine.directive("h-calendar", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
20457
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
20460
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
20458
20461
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
20459
20462
|
el.setAttribute("tabindex", "-1");
|
|
20460
20463
|
if (datepicker) {
|
|
@@ -20462,9 +20465,9 @@ function calendar_default(Alpine) {
|
|
|
20462
20465
|
el.setAttribute("role", "dialog");
|
|
20463
20466
|
el.setAttribute("aria-modal", "true");
|
|
20464
20467
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
20465
|
-
el.setAttribute("data-state", datepicker.
|
|
20468
|
+
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
20466
20469
|
} else {
|
|
20467
|
-
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");
|
|
20468
20471
|
}
|
|
20469
20472
|
let date = /* @__PURE__ */ new Date();
|
|
20470
20473
|
let selected = void 0;
|
|
@@ -20487,38 +20490,38 @@ function calendar_default(Alpine) {
|
|
|
20487
20490
|
}
|
|
20488
20491
|
}
|
|
20489
20492
|
if (datepicker) {
|
|
20490
|
-
datepicker.
|
|
20491
|
-
datepicker.
|
|
20492
|
-
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 }));
|
|
20493
20496
|
} else {
|
|
20494
20497
|
el.setAttribute("data-invalid", "false");
|
|
20495
20498
|
}
|
|
20496
20499
|
}
|
|
20497
20500
|
const onInputChange = () => {
|
|
20498
|
-
const newValue = new Date(datepicker.
|
|
20501
|
+
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
20499
20502
|
if (isNaN(newValue)) {
|
|
20500
|
-
console.error(`h-calendar: input value is not a valid date - ${datepicker.
|
|
20501
|
-
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.");
|
|
20502
20505
|
return;
|
|
20503
20506
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
20504
20507
|
selected = newValue;
|
|
20505
20508
|
modelChange();
|
|
20506
20509
|
render();
|
|
20507
20510
|
}
|
|
20508
|
-
datepicker.
|
|
20511
|
+
datepicker._h_datepicker.input.setCustomValidity("");
|
|
20509
20512
|
};
|
|
20510
20513
|
if (datepicker) {
|
|
20511
|
-
datepicker.
|
|
20514
|
+
datepicker._h_datepicker.input.addEventListener("change", onInputChange);
|
|
20512
20515
|
}
|
|
20513
20516
|
function checkForModel() {
|
|
20514
20517
|
if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
|
|
20515
20518
|
selected = new Date(el._x_model.get());
|
|
20516
20519
|
if (isNaN(selected)) {
|
|
20517
20520
|
console.error(`h-calendar: input value is not a valid date - ${el._x_model.get()}`);
|
|
20518
|
-
if (datepicker) datepicker.
|
|
20521
|
+
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
20519
20522
|
else el.setAttribute("data-invalid", "true");
|
|
20520
20523
|
} else if (datepicker) {
|
|
20521
|
-
datepicker.
|
|
20524
|
+
datepicker._h_datepicker.input.value = formatter.format(selected);
|
|
20522
20525
|
}
|
|
20523
20526
|
}
|
|
20524
20527
|
}
|
|
@@ -20528,7 +20531,7 @@ function calendar_default(Alpine) {
|
|
|
20528
20531
|
selected = new Date(focusedDay);
|
|
20529
20532
|
modelChange(true);
|
|
20530
20533
|
render();
|
|
20531
|
-
if (datepicker) datepicker.
|
|
20534
|
+
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
20532
20535
|
}
|
|
20533
20536
|
function isDisabled(d) {
|
|
20534
20537
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
@@ -20821,7 +20824,7 @@ function calendar_default(Alpine) {
|
|
|
20821
20824
|
newDay.setMonth(newDay.getMonth() + 1);
|
|
20822
20825
|
break;
|
|
20823
20826
|
case "Escape":
|
|
20824
|
-
if (datepicker) datepicker.
|
|
20827
|
+
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
20825
20828
|
return;
|
|
20826
20829
|
case "Enter":
|
|
20827
20830
|
case " ":
|
|
@@ -20885,8 +20888,8 @@ function calendar_default(Alpine) {
|
|
|
20885
20888
|
}
|
|
20886
20889
|
if (datepicker) {
|
|
20887
20890
|
effect(() => {
|
|
20888
|
-
el.setAttribute("data-state", datepicker.
|
|
20889
|
-
if (datepicker.
|
|
20891
|
+
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
20892
|
+
if (datepicker._h_datepicker.expanded) {
|
|
20890
20893
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
20891
20894
|
Alpine2.nextTick(() => {
|
|
20892
20895
|
focusDay();
|
|
@@ -20906,7 +20909,7 @@ function calendar_default(Alpine) {
|
|
|
20906
20909
|
dayCells[d].removeEventListener("click", dayClick);
|
|
20907
20910
|
}
|
|
20908
20911
|
if (datepicker) {
|
|
20909
|
-
datepicker.
|
|
20912
|
+
datepicker._h_datepicker.input.removeEventListener("change", onInputChange);
|
|
20910
20913
|
}
|
|
20911
20914
|
});
|
|
20912
20915
|
});
|
|
@@ -20991,7 +20994,7 @@ function checkbox_default(Alpine) {
|
|
|
20991
20994
|
"has-[input:invalid]:ring-negative/20",
|
|
20992
20995
|
"relative",
|
|
20993
20996
|
"rounded-[0.25rem]",
|
|
20994
|
-
"shadow-
|
|
20997
|
+
"shadow-input",
|
|
20995
20998
|
"shrink-0",
|
|
20996
20999
|
"size-5",
|
|
20997
21000
|
"transition-color"
|
|
@@ -21004,7 +21007,7 @@ function checkbox_default(Alpine) {
|
|
|
21004
21007
|
// src/components/collapsible.js
|
|
21005
21008
|
function collapsible_default(Alpine) {
|
|
21006
21009
|
Alpine.directive("h-collapsible", (el, { expression }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
21007
|
-
el.
|
|
21010
|
+
el._h_collapsible = Alpine2.reactive({
|
|
21008
21011
|
expanded: expression ? evaluate2(expression) : false
|
|
21009
21012
|
});
|
|
21010
21013
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible");
|
|
@@ -21012,13 +21015,13 @@ function collapsible_default(Alpine) {
|
|
|
21012
21015
|
const getExpanded = evaluateLater(expression);
|
|
21013
21016
|
effect(() => {
|
|
21014
21017
|
getExpanded((expanded) => {
|
|
21015
|
-
el.
|
|
21018
|
+
el._h_collapsible.expanded = expanded;
|
|
21016
21019
|
});
|
|
21017
21020
|
});
|
|
21018
21021
|
}
|
|
21019
21022
|
});
|
|
21020
21023
|
Alpine.directive("h-collapsible-trigger", (el, { modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
21021
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21024
|
+
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
21022
21025
|
if (!collapsible) {
|
|
21023
21026
|
throw new Error("h-collapsible-trigger must be inside an h-collapsible element");
|
|
21024
21027
|
}
|
|
@@ -21029,10 +21032,10 @@ function collapsible_default(Alpine) {
|
|
|
21029
21032
|
else el.classList.add("[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180", "[&[data-state=open]>svg:only-child]:rotate-180");
|
|
21030
21033
|
}
|
|
21031
21034
|
const handler2 = () => {
|
|
21032
|
-
collapsible.
|
|
21035
|
+
collapsible._h_collapsible.expanded = !collapsible._h_collapsible.expanded;
|
|
21033
21036
|
};
|
|
21034
21037
|
effect(() => {
|
|
21035
|
-
el.setAttribute("data-state", collapsible.
|
|
21038
|
+
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
21036
21039
|
});
|
|
21037
21040
|
el.addEventListener("click", handler2);
|
|
21038
21041
|
cleanup(() => {
|
|
@@ -21040,14 +21043,14 @@ function collapsible_default(Alpine) {
|
|
|
21040
21043
|
});
|
|
21041
21044
|
});
|
|
21042
21045
|
Alpine.directive("h-collapsible-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
21043
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21046
|
+
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
21044
21047
|
if (!collapsible) {
|
|
21045
21048
|
throw new Error("h-collapsible-content must be inside an h-collapsible element");
|
|
21046
21049
|
}
|
|
21047
21050
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
|
|
21048
|
-
el.classList.add("data-[state=closed]
|
|
21051
|
+
el.classList.add("data-[state=closed]:!hidden");
|
|
21049
21052
|
effect(() => {
|
|
21050
|
-
el.setAttribute("data-state", collapsible.
|
|
21053
|
+
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
21051
21054
|
});
|
|
21052
21055
|
});
|
|
21053
21056
|
}
|
|
@@ -21056,21 +21059,21 @@ function collapsible_default(Alpine) {
|
|
|
21056
21059
|
var import_lucide3 = __toESM(require_lucide(), 1);
|
|
21057
21060
|
function datepicker_default(Alpine) {
|
|
21058
21061
|
Alpine.directive("h-date-picker", (el, {}, { Alpine: Alpine2 }) => {
|
|
21059
|
-
el.
|
|
21062
|
+
el._h_datepicker = Alpine2.reactive({
|
|
21060
21063
|
id: void 0,
|
|
21061
21064
|
controls: `hdpc${v4_default()}`,
|
|
21062
21065
|
input: void 0,
|
|
21063
21066
|
expanded: false
|
|
21064
21067
|
});
|
|
21065
|
-
el.
|
|
21066
|
-
if (!el.
|
|
21068
|
+
el._h_datepicker.input = el.querySelector("input");
|
|
21069
|
+
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
21067
21070
|
throw new Error("h-date-picker must have an input inside it");
|
|
21068
|
-
} else if (el.
|
|
21069
|
-
el.
|
|
21071
|
+
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
21072
|
+
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
21070
21073
|
} else {
|
|
21071
21074
|
const id = `hdp${v4_default()}`;
|
|
21072
|
-
el.
|
|
21073
|
-
el.
|
|
21075
|
+
el._h_datepicker.input.setAttribute("id", id);
|
|
21076
|
+
el._h_datepicker.id = id;
|
|
21074
21077
|
}
|
|
21075
21078
|
el.classList.add(
|
|
21076
21079
|
"border-input",
|
|
@@ -21080,7 +21083,7 @@ function datepicker_default(Alpine) {
|
|
|
21080
21083
|
"items-center",
|
|
21081
21084
|
"rounded-control",
|
|
21082
21085
|
"border",
|
|
21083
|
-
"shadow-
|
|
21086
|
+
"shadow-input",
|
|
21084
21087
|
"transition-[color,box-shadow]",
|
|
21085
21088
|
"duration-200",
|
|
21086
21089
|
"outline-none",
|
|
@@ -21100,9 +21103,9 @@ function datepicker_default(Alpine) {
|
|
|
21100
21103
|
"dark:has-[input:invalid]:ring-negative/40"
|
|
21101
21104
|
);
|
|
21102
21105
|
el.setAttribute("data-slot", "date-picker");
|
|
21103
|
-
el.
|
|
21104
|
-
el.
|
|
21105
|
-
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");
|
|
21106
21109
|
});
|
|
21107
21110
|
Alpine.directive("h-date-picker-trigger", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
21108
21111
|
if (el.tagName !== "BUTTON") {
|
|
@@ -21111,11 +21114,11 @@ function datepicker_default(Alpine) {
|
|
|
21111
21114
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
21112
21115
|
throw new Error('h-date-picker-trigger: must have an "aria-label" or "aria-labelledby" attribute');
|
|
21113
21116
|
}
|
|
21114
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
21117
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
21115
21118
|
if (!datepicker) {
|
|
21116
21119
|
throw new Error("h-date-picker-trigger must be inside an h-date-picker element");
|
|
21117
21120
|
}
|
|
21118
|
-
el.setAttribute("aria-controls", datepicker.
|
|
21121
|
+
el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
|
|
21119
21122
|
el.setAttribute("aria-expanded", "false");
|
|
21120
21123
|
el.setAttribute("aria-haspopup", "dialog");
|
|
21121
21124
|
el.setAttribute("type", "button");
|
|
@@ -21130,17 +21133,17 @@ function datepicker_default(Alpine) {
|
|
|
21130
21133
|
})
|
|
21131
21134
|
);
|
|
21132
21135
|
effect(() => {
|
|
21133
|
-
el.setAttribute("data-state", datepicker.
|
|
21134
|
-
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);
|
|
21135
21138
|
});
|
|
21136
21139
|
const close = () => {
|
|
21137
|
-
datepicker.
|
|
21140
|
+
datepicker._h_datepicker.expanded = false;
|
|
21138
21141
|
};
|
|
21139
21142
|
const handler2 = () => {
|
|
21140
|
-
datepicker.
|
|
21141
|
-
el.setAttribute("aria-expanded", datepicker.
|
|
21143
|
+
datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
|
|
21144
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
21142
21145
|
Alpine2.nextTick(() => {
|
|
21143
|
-
if (datepicker.
|
|
21146
|
+
if (datepicker._h_datepicker.expanded) {
|
|
21144
21147
|
top.addEventListener("click", close, { once: true });
|
|
21145
21148
|
} else {
|
|
21146
21149
|
top.removeEventListener("click", close);
|
|
@@ -21173,12 +21176,24 @@ function dialog_default(Alpine) {
|
|
|
21173
21176
|
}
|
|
21174
21177
|
}
|
|
21175
21178
|
inputs[0].focus();
|
|
21179
|
+
return;
|
|
21176
21180
|
} else {
|
|
21177
|
-
const
|
|
21178
|
-
if (
|
|
21179
|
-
|
|
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;
|
|
21180
21191
|
}
|
|
21181
21192
|
}
|
|
21193
|
+
const buttons = el.getElementsByTagName("BUTTON");
|
|
21194
|
+
if (buttons.length) {
|
|
21195
|
+
buttons[0].focus();
|
|
21196
|
+
}
|
|
21182
21197
|
}
|
|
21183
21198
|
});
|
|
21184
21199
|
});
|
|
@@ -21195,7 +21210,8 @@ function dialog_default(Alpine) {
|
|
|
21195
21210
|
"top-[50%]",
|
|
21196
21211
|
"left-[50%]",
|
|
21197
21212
|
"z-50",
|
|
21198
|
-
"
|
|
21213
|
+
"flex",
|
|
21214
|
+
"flex-col",
|
|
21199
21215
|
"w-full",
|
|
21200
21216
|
"max-w-[calc(100%-2rem)]",
|
|
21201
21217
|
"translate-x-[-50%]",
|
|
@@ -21205,24 +21221,27 @@ function dialog_default(Alpine) {
|
|
|
21205
21221
|
"border",
|
|
21206
21222
|
"p-4",
|
|
21207
21223
|
"shadow-xl",
|
|
21208
|
-
"sm:max-w-lg"
|
|
21224
|
+
"sm:max-w-lg",
|
|
21225
|
+
"outline-none"
|
|
21209
21226
|
);
|
|
21210
21227
|
el.setAttribute("role", "dialog");
|
|
21211
21228
|
el.setAttribute("data-slot", "dialog");
|
|
21212
|
-
if (!el.hasAttribute("aria-labelledby")) {
|
|
21213
|
-
console.error('h-dialog: attribute "aria-labelledby" is missing');
|
|
21214
|
-
}
|
|
21215
|
-
if (!el.hasAttribute("aria-describedby")) {
|
|
21216
|
-
console.error('h-dialog: attribute "aria-describedby" is missing');
|
|
21217
|
-
}
|
|
21218
21229
|
});
|
|
21219
21230
|
Alpine.directive("h-dialog-header", (el) => {
|
|
21220
21231
|
el.classList.add("grid", "grid-cols-[1fr_auto]", "place-items-start", "gap-2", "text-center", "sm:text-left");
|
|
21221
21232
|
el.setAttribute("data-slot", "dialog-header");
|
|
21222
21233
|
});
|
|
21223
|
-
Alpine.directive("h-dialog-title", (el) => {
|
|
21234
|
+
Alpine.directive("h-dialog-title", (el, {}, { Alpine: Alpine2 }) => {
|
|
21224
21235
|
el.classList.add("text-lg", "leading-none", "font-semibold");
|
|
21225
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
|
+
}
|
|
21226
21245
|
});
|
|
21227
21246
|
Alpine.directive("h-dialog-close", (el) => {
|
|
21228
21247
|
el.classList.add(
|
|
@@ -21242,9 +21261,17 @@ function dialog_default(Alpine) {
|
|
|
21242
21261
|
);
|
|
21243
21262
|
el.setAttribute("data-slot", "dialog-close");
|
|
21244
21263
|
});
|
|
21245
|
-
Alpine.directive("h-dialog-description", (el) => {
|
|
21264
|
+
Alpine.directive("h-dialog-description", (el, {}, { Alpine: Alpine2 }) => {
|
|
21246
21265
|
el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
|
|
21247
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
|
+
}
|
|
21248
21275
|
});
|
|
21249
21276
|
Alpine.directive("h-dialog-footer", (el) => {
|
|
21250
21277
|
el.classList.add("flex", "flex-col-reverse", "gap-2", "sm:flex-row", "sm:justify-end");
|
|
@@ -21403,7 +21430,7 @@ function input_default(Alpine) {
|
|
|
21403
21430
|
"[&::-webkit-color-swatch-wrapper]:rounded-0",
|
|
21404
21431
|
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
21405
21432
|
"text-base",
|
|
21406
|
-
"shadow-
|
|
21433
|
+
"shadow-input",
|
|
21407
21434
|
"transition-[color,box-shadow]",
|
|
21408
21435
|
"outline-none",
|
|
21409
21436
|
"file:inline-flex",
|
|
@@ -21427,7 +21454,7 @@ function input_default(Alpine) {
|
|
|
21427
21454
|
"invalid:!border-negative"
|
|
21428
21455
|
);
|
|
21429
21456
|
if (modifiers.includes("group")) {
|
|
21430
|
-
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]");
|
|
21431
21458
|
el.classList.add("flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
21432
21459
|
el.setAttribute("data-slot", "input-group-control");
|
|
21433
21460
|
} else el.setAttribute("data-slot", "input");
|
|
@@ -21446,7 +21473,7 @@ function input_default(Alpine) {
|
|
|
21446
21473
|
"items-center",
|
|
21447
21474
|
"rounded-control",
|
|
21448
21475
|
"border",
|
|
21449
|
-
"shadow-
|
|
21476
|
+
"shadow-input",
|
|
21450
21477
|
"transition-[color,box-shadow]",
|
|
21451
21478
|
"outline-none",
|
|
21452
21479
|
"h-9",
|
|
@@ -21565,7 +21592,7 @@ function list_default(Alpine) {
|
|
|
21565
21592
|
"border-input",
|
|
21566
21593
|
"border",
|
|
21567
21594
|
"rounded-control",
|
|
21568
|
-
"shadow-
|
|
21595
|
+
"shadow-input",
|
|
21569
21596
|
"outline-none",
|
|
21570
21597
|
"disabled:pointer-events-none",
|
|
21571
21598
|
"disabled:cursor-not-allowed",
|
|
@@ -21664,13 +21691,11 @@ function list_default(Alpine) {
|
|
|
21664
21691
|
if (!list) {
|
|
21665
21692
|
throw new Error("h-list-header: must be placed inside an h-list element");
|
|
21666
21693
|
}
|
|
21667
|
-
if (el.hasAttribute("id")) {
|
|
21668
|
-
list.setAttribute("aria-labelledby", el.getAttribute("id"));
|
|
21669
|
-
} else {
|
|
21694
|
+
if (!el.hasAttribute("id")) {
|
|
21670
21695
|
const id = `lbh${v4_default()}`;
|
|
21671
21696
|
el.setAttribute("id", id);
|
|
21672
|
-
list.setAttribute("aria-labelledby", id);
|
|
21673
21697
|
}
|
|
21698
|
+
list.setAttribute("aria-labelledby", el.getAttribute("id"));
|
|
21674
21699
|
});
|
|
21675
21700
|
Alpine.directive("h-list-item", (el, { modifiers }) => {
|
|
21676
21701
|
el.classList.add("min-h-11", "flex", "items-center", "p-2", "gap-2", "align-middle", "outline-none");
|
|
@@ -21946,7 +21971,9 @@ function menu_default(Alpine) {
|
|
|
21946
21971
|
Alpine.directive("h-menu-item", (el, {}, { cleanup, Alpine: Alpine2 }) => {
|
|
21947
21972
|
el.classList.add(
|
|
21948
21973
|
"focus:bg-secondary-hover",
|
|
21974
|
+
"focus:text-secondary-foreground",
|
|
21949
21975
|
"hover:bg-secondary-hover",
|
|
21976
|
+
"hover:text-secondary-foreground",
|
|
21950
21977
|
"data-[variant=negative]:text-negative",
|
|
21951
21978
|
"data-[variant=negative]:focus:bg-negative/10",
|
|
21952
21979
|
"data-[variant=negative]:hover:bg-negative/10",
|
|
@@ -22062,6 +22089,7 @@ function menu_default(Alpine) {
|
|
|
22062
22089
|
Alpine2.nextTick(() => {
|
|
22063
22090
|
submenuitem.focus();
|
|
22064
22091
|
el._menu_sub.expanded = true;
|
|
22092
|
+
el.setAttribute("aria-expanded", true);
|
|
22065
22093
|
});
|
|
22066
22094
|
}
|
|
22067
22095
|
}
|
|
@@ -22071,28 +22099,33 @@ function menu_default(Alpine) {
|
|
|
22071
22099
|
if (event.type === "mouseleave") {
|
|
22072
22100
|
el._menu_sub.close();
|
|
22073
22101
|
el._menu_sub.expanded = false;
|
|
22102
|
+
el.setAttribute("aria-expanded", false);
|
|
22074
22103
|
parentMenu.pauseKeyEvents = false;
|
|
22075
|
-
el.setAttribute("aria-expanded", "false");
|
|
22076
22104
|
parentMenu.focus();
|
|
22077
22105
|
} else if (el._menu_sub.expanded) {
|
|
22078
|
-
el.setAttribute("aria-expanded", "false");
|
|
22079
22106
|
el._menu_sub.close();
|
|
22080
22107
|
el._menu_sub.expanded = false;
|
|
22108
|
+
el.setAttribute("aria-expanded", false);
|
|
22081
22109
|
parentMenu.pauseKeyEvents = false;
|
|
22082
22110
|
el.removeEventListener("keydown", onKeydown);
|
|
22083
22111
|
}
|
|
22084
22112
|
}
|
|
22085
22113
|
function focusIn(event) {
|
|
22086
22114
|
el.setAttribute("tabindex", "0");
|
|
22087
|
-
if (event.type === "
|
|
22088
|
-
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") {
|
|
22089
22121
|
el.addEventListener("mouseleave", focusOut);
|
|
22090
22122
|
el._menu_sub.open(el);
|
|
22091
22123
|
el._menu_sub.expanded = true;
|
|
22124
|
+
el.setAttribute("aria-expanded", true);
|
|
22092
22125
|
} else {
|
|
22093
22126
|
if (el._menu_sub.expanded) {
|
|
22094
|
-
el.setAttribute("aria-expanded", "false");
|
|
22095
22127
|
el._menu_sub.expanded = false;
|
|
22128
|
+
el.setAttribute("aria-expanded", false);
|
|
22096
22129
|
parentMenu.pauseKeyEvents = false;
|
|
22097
22130
|
}
|
|
22098
22131
|
el.addEventListener("keydown", onKeydown);
|
|
@@ -22100,9 +22133,11 @@ function menu_default(Alpine) {
|
|
|
22100
22133
|
}
|
|
22101
22134
|
}
|
|
22102
22135
|
el.addEventListener("mouseenter", focusIn);
|
|
22136
|
+
el.addEventListener("click", focusIn);
|
|
22103
22137
|
el.addEventListener("focus", focusIn);
|
|
22104
22138
|
cleanup(() => {
|
|
22105
22139
|
el.removeEventListener("mouseenter", focusIn);
|
|
22140
|
+
el.removeEventListener("click", focusIn);
|
|
22106
22141
|
el.removeEventListener("focus", focusIn);
|
|
22107
22142
|
el.removeEventListener("blur", focusOut);
|
|
22108
22143
|
el.removeEventListener("mouseleave", focusOut);
|
|
@@ -22562,7 +22597,7 @@ function radio_default(Alpine) {
|
|
|
22562
22597
|
"has-[input:invalid]:ring-negative/20",
|
|
22563
22598
|
"relative",
|
|
22564
22599
|
"rounded-full",
|
|
22565
|
-
"shadow-
|
|
22600
|
+
"shadow-input",
|
|
22566
22601
|
"shrink-0",
|
|
22567
22602
|
"size-5"
|
|
22568
22603
|
);
|
|
@@ -22600,7 +22635,7 @@ var FilterType = Object.freeze({
|
|
|
22600
22635
|
});
|
|
22601
22636
|
function select_default(Alpine) {
|
|
22602
22637
|
Alpine.directive("h-select", (el, {}, { Alpine: Alpine2 }) => {
|
|
22603
|
-
el.
|
|
22638
|
+
el._h_select = Alpine2.reactive({
|
|
22604
22639
|
id: void 0,
|
|
22605
22640
|
controls: `hsc${v4_default()}`,
|
|
22606
22641
|
expanded: false,
|
|
@@ -22608,17 +22643,18 @@ function select_default(Alpine) {
|
|
|
22608
22643
|
multiple: false,
|
|
22609
22644
|
label: [],
|
|
22610
22645
|
search: "",
|
|
22646
|
+
focusSearch: void 0,
|
|
22611
22647
|
filterType: FilterType["starts-with"]
|
|
22612
22648
|
});
|
|
22613
22649
|
el.setAttribute("data-slot", "select");
|
|
22614
22650
|
});
|
|
22615
22651
|
Alpine.directive("h-select-trigger", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
22616
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22652
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22617
22653
|
if (!select) {
|
|
22618
22654
|
throw new Error("h-select-trigger must be inside an h-select element");
|
|
22619
22655
|
} else if (el.hasOwnProperty("_x_model")) {
|
|
22620
|
-
select.
|
|
22621
|
-
select.
|
|
22656
|
+
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
22657
|
+
select._h_select.model = el._x_model.get();
|
|
22622
22658
|
}
|
|
22623
22659
|
setButtonClasses(el);
|
|
22624
22660
|
const setVariant = (variant) => {
|
|
@@ -22627,7 +22663,7 @@ function select_default(Alpine) {
|
|
|
22627
22663
|
return;
|
|
22628
22664
|
} else if (variant === "transparent") {
|
|
22629
22665
|
el.classList.add(...buttonVariants["transparent"]);
|
|
22630
|
-
} else el.classList.add("shadow-
|
|
22666
|
+
} else el.classList.add("shadow-input", ...buttonVariants["outline"]);
|
|
22631
22667
|
};
|
|
22632
22668
|
const setSize = (size3) => {
|
|
22633
22669
|
const sizes = ["sm", "xs", "lg"];
|
|
@@ -22659,38 +22695,38 @@ function select_default(Alpine) {
|
|
|
22659
22695
|
if (mutation.attributeName === "value") {
|
|
22660
22696
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
22661
22697
|
if (el.value) selectValue.classList.remove("text-muted-foreground");
|
|
22662
|
-
} else if (mutation.attributeName === "placeholder" && !select.
|
|
22698
|
+
} else if (mutation.attributeName === "placeholder" && !select._h_select.label.length) {
|
|
22663
22699
|
getPlaceholder();
|
|
22664
22700
|
}
|
|
22665
22701
|
});
|
|
22666
22702
|
});
|
|
22667
22703
|
observer.observe(el, { attributes: true, attributeFilter: ["value", "placeholder"] });
|
|
22668
22704
|
effect(() => {
|
|
22669
|
-
if (select.
|
|
22670
|
-
selectValue.innerText = select.
|
|
22671
|
-
} else if (select.
|
|
22672
|
-
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(", ");
|
|
22673
22709
|
} else {
|
|
22674
22710
|
getPlaceholder();
|
|
22675
22711
|
}
|
|
22676
22712
|
});
|
|
22677
22713
|
el.setAttribute("data-slot", "select-trigger");
|
|
22678
22714
|
if (el.hasAttribute("id")) {
|
|
22679
|
-
select.
|
|
22715
|
+
select._h_select.id = el.getAttribute("id");
|
|
22680
22716
|
} else {
|
|
22681
|
-
select.
|
|
22682
|
-
el.setAttribute("id", select.
|
|
22717
|
+
select._h_select.id = `hs${v4_default()}`;
|
|
22718
|
+
el.setAttribute("id", select._h_select.id);
|
|
22683
22719
|
}
|
|
22684
|
-
el.setAttribute("aria-controls", select.
|
|
22720
|
+
el.setAttribute("aria-controls", select._h_select.controls);
|
|
22685
22721
|
el.setAttribute("aria-haspopup", "listbox");
|
|
22686
22722
|
el.setAttribute("aria-autocomplete", "none");
|
|
22687
22723
|
el.setAttribute("role", "combobox");
|
|
22688
22724
|
effect(() => {
|
|
22689
|
-
el.setAttribute("data-state", select.
|
|
22690
|
-
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);
|
|
22691
22727
|
});
|
|
22692
22728
|
const close = () => {
|
|
22693
|
-
select.
|
|
22729
|
+
select._h_select.expanded = false;
|
|
22694
22730
|
};
|
|
22695
22731
|
let content;
|
|
22696
22732
|
let options;
|
|
@@ -22698,26 +22734,72 @@ function select_default(Alpine) {
|
|
|
22698
22734
|
switch (event.key) {
|
|
22699
22735
|
case "Down":
|
|
22700
22736
|
case "ArrowDown":
|
|
22737
|
+
event.preventDefault();
|
|
22738
|
+
let nextIndex = 0;
|
|
22701
22739
|
for (let o = 0; o < options.length; o++) {
|
|
22702
|
-
if (options[o] ===
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
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;
|
|
22707
22744
|
}
|
|
22708
22745
|
}
|
|
22709
|
-
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();
|
|
22710
22757
|
break;
|
|
22711
22758
|
case "Up":
|
|
22712
22759
|
case "ArrowUp":
|
|
22760
|
+
event.preventDefault();
|
|
22761
|
+
let prevIndex = options.length - 1;
|
|
22713
22762
|
for (let o = options.length - 1; o >= 0; o--) {
|
|
22714
|
-
if (options[o] ===
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
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;
|
|
22788
|
+
}
|
|
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;
|
|
22719
22800
|
}
|
|
22720
22801
|
}
|
|
22802
|
+
options[options.length - 1].setAttribute("tabindex", "0");
|
|
22721
22803
|
options[options.length - 1].focus();
|
|
22722
22804
|
break;
|
|
22723
22805
|
case "Enter":
|
|
@@ -22728,16 +22810,30 @@ function select_default(Alpine) {
|
|
|
22728
22810
|
case "Tab":
|
|
22729
22811
|
handler2();
|
|
22730
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
|
+
}
|
|
22731
22827
|
}
|
|
22732
22828
|
};
|
|
22733
22829
|
const handler2 = () => {
|
|
22734
|
-
select.
|
|
22735
|
-
if (select.
|
|
22736
|
-
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}`);
|
|
22737
22833
|
options = content.querySelectorAll("[role=option]");
|
|
22738
22834
|
}
|
|
22739
22835
|
Alpine2.nextTick(() => {
|
|
22740
|
-
if (select.
|
|
22836
|
+
if (select._h_select.expanded) {
|
|
22741
22837
|
top.addEventListener("click", close, { once: true });
|
|
22742
22838
|
el.parentElement.addEventListener("keydown", shiftFocus);
|
|
22743
22839
|
} else {
|
|
@@ -22765,7 +22861,7 @@ function select_default(Alpine) {
|
|
|
22765
22861
|
});
|
|
22766
22862
|
});
|
|
22767
22863
|
Alpine.directive("h-select-content", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
22768
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22864
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22769
22865
|
if (!select) {
|
|
22770
22866
|
throw new Error("h-select-content must be inside an h-select element");
|
|
22771
22867
|
}
|
|
@@ -22773,11 +22869,11 @@ function select_default(Alpine) {
|
|
|
22773
22869
|
el.setAttribute("data-slot", "select-content");
|
|
22774
22870
|
el.setAttribute("role", "listbox");
|
|
22775
22871
|
el.setAttribute("role", "presentation");
|
|
22776
|
-
el.setAttribute("id", select.
|
|
22872
|
+
el.setAttribute("id", select._h_select.controls);
|
|
22777
22873
|
el.setAttribute("tabindex", "-1");
|
|
22778
|
-
el.setAttribute("aria-labelledby", select.
|
|
22779
|
-
el.setAttribute("data-state", select.
|
|
22780
|
-
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}`);
|
|
22781
22877
|
if (!control) {
|
|
22782
22878
|
throw new Error("h-select-content: trigger not found");
|
|
22783
22879
|
}
|
|
@@ -22806,8 +22902,8 @@ function select_default(Alpine) {
|
|
|
22806
22902
|
});
|
|
22807
22903
|
}
|
|
22808
22904
|
effect(() => {
|
|
22809
|
-
el.setAttribute("data-state", select.
|
|
22810
|
-
if (select.
|
|
22905
|
+
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
22906
|
+
if (select._h_select.expanded) {
|
|
22811
22907
|
autoUpdateCleanup = autoUpdate(control, el, updatePosition);
|
|
22812
22908
|
} else {
|
|
22813
22909
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
@@ -22819,14 +22915,16 @@ function select_default(Alpine) {
|
|
|
22819
22915
|
});
|
|
22820
22916
|
});
|
|
22821
22917
|
Alpine.directive("h-select-search", (el, { modifiers }, { effect, cleanup }) => {
|
|
22822
|
-
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22918
|
+
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22823
22919
|
if (!select) {
|
|
22824
22920
|
throw new Error("h-select-search must be inside an h-select element");
|
|
22825
|
-
} else
|
|
22921
|
+
} else {
|
|
22922
|
+
select._h_select.filterType = FilterType[modifiers[0]] ?? FilterType["starts-with"];
|
|
22923
|
+
}
|
|
22826
22924
|
el.classList.add("flex", "h-8", "items-center", "gap-2", "border-b", "px-2");
|
|
22827
22925
|
el.setAttribute("data-slot", "select-search");
|
|
22828
|
-
el.setAttribute("aria-autocomplete", select.
|
|
22829
|
-
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);
|
|
22830
22928
|
el.setAttribute("aria-haspopup", "listbox");
|
|
22831
22929
|
el.setAttribute("role", "combobox");
|
|
22832
22930
|
el.setAttribute("autocomplete", "off");
|
|
@@ -22839,62 +22937,65 @@ function select_default(Alpine) {
|
|
|
22839
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");
|
|
22840
22938
|
el.appendChild(searchIcon);
|
|
22841
22939
|
el.appendChild(searchInput);
|
|
22940
|
+
select._h_select.focusSearch = () => {
|
|
22941
|
+
searchInput.focus();
|
|
22942
|
+
};
|
|
22842
22943
|
function handler2(event) {
|
|
22843
|
-
if (event.type === "keydown" && event.key === "Escape") return;
|
|
22944
|
+
if (event.type === "keydown" && (event.key === "Escape" || event.key === "ArrowDown" || event.key === "Down")) return;
|
|
22844
22945
|
event.stopPropagation();
|
|
22845
22946
|
}
|
|
22846
22947
|
el.addEventListener("click", handler2);
|
|
22847
22948
|
el.addEventListener("keydown", handler2);
|
|
22848
|
-
if (select.
|
|
22949
|
+
if (select._h_select.filterType !== FilterType.none) {
|
|
22849
22950
|
let onInput2 = function() {
|
|
22850
|
-
select.
|
|
22951
|
+
select._h_select.search = searchInput.value.toLowerCase();
|
|
22851
22952
|
};
|
|
22852
22953
|
searchInput.addEventListener("keyup", onInput2);
|
|
22853
22954
|
}
|
|
22854
22955
|
effect(() => {
|
|
22855
|
-
if (select.
|
|
22856
|
-
el.setAttribute("aria-expanded", select.
|
|
22956
|
+
if (select._h_select.expanded) searchInput.focus({ preventScroll: true });
|
|
22957
|
+
el.setAttribute("aria-expanded", select._h_select.expanded);
|
|
22857
22958
|
});
|
|
22858
22959
|
cleanup(() => {
|
|
22859
22960
|
el.removeEventListener("click", handler2);
|
|
22860
22961
|
el.removeEventListener("keydown", handler2);
|
|
22861
|
-
if (select.
|
|
22962
|
+
if (select._h_select.filterType !== FilterType.none) searchInput.removeEventListener("keyup", onInput);
|
|
22862
22963
|
});
|
|
22863
22964
|
});
|
|
22864
22965
|
Alpine.directive("h-select-group", (el, {}, { effect }) => {
|
|
22865
22966
|
el.setAttribute("data-slot", "select-group");
|
|
22866
|
-
el.
|
|
22967
|
+
el._h_selectGroup = Alpine.reactive({
|
|
22867
22968
|
labelledby: void 0
|
|
22868
22969
|
});
|
|
22869
22970
|
effect(() => {
|
|
22870
|
-
if (el.
|
|
22871
|
-
el.setAttribute("aria-labelledby", el.
|
|
22971
|
+
if (el._h_selectGroup.labelledby) {
|
|
22972
|
+
el.setAttribute("aria-labelledby", el._h_selectGroup.labelledby);
|
|
22872
22973
|
}
|
|
22873
22974
|
});
|
|
22874
22975
|
});
|
|
22875
22976
|
Alpine.directive("h-select-label", (el) => {
|
|
22876
22977
|
el.classList.add("text-muted-foreground", "px-2", "py-1.5", "text-xs");
|
|
22877
22978
|
el.setAttribute("data-slot", "select-label");
|
|
22878
|
-
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22979
|
+
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_selectGroup"));
|
|
22879
22980
|
if (selectGroup) {
|
|
22880
22981
|
const id = `hsl${v4_default()}`;
|
|
22881
22982
|
el.setAttribute("id", id);
|
|
22882
|
-
selectGroup.
|
|
22983
|
+
selectGroup._h_selectGroup.labelledby = id;
|
|
22883
22984
|
}
|
|
22884
22985
|
});
|
|
22885
22986
|
Alpine.directive("h-select-option", (el, { expression }, { effect, evaluateLater, cleanup }) => {
|
|
22886
|
-
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
22987
|
+
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
22887
22988
|
if (!select) {
|
|
22888
22989
|
throw new Error("h-select-option must be inside an h-select element");
|
|
22889
22990
|
}
|
|
22890
22991
|
el.classList.add(
|
|
22891
22992
|
"focus:bg-primary",
|
|
22892
22993
|
"focus:text-primary-foreground",
|
|
22893
|
-
"hover:bg-
|
|
22894
|
-
"hover:text-
|
|
22994
|
+
"hover:bg-secondary-hover",
|
|
22995
|
+
"hover:text-secondary-foreground",
|
|
22895
22996
|
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
22896
22997
|
"focus:[&_svg:not([class*='text-'])]:text-primary-foreground",
|
|
22897
|
-
"hover:[&_svg:not([class*='text-'])]:text-
|
|
22998
|
+
"hover:[&_svg:not([class*='text-'])]:text-secondary-foreground",
|
|
22898
22999
|
"relative",
|
|
22899
23000
|
"flex",
|
|
22900
23001
|
"w-full",
|
|
@@ -22938,26 +23039,26 @@ function select_default(Alpine) {
|
|
|
22938
23039
|
const getLabel = evaluateLater(expression);
|
|
22939
23040
|
effect(() => {
|
|
22940
23041
|
getLabel((label) => {
|
|
22941
|
-
if (select.
|
|
22942
|
-
select.
|
|
22943
|
-
} else if (select.
|
|
22944
|
-
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;
|
|
22945
23046
|
}
|
|
22946
23047
|
labelEl.innerText = label;
|
|
22947
23048
|
});
|
|
22948
23049
|
});
|
|
22949
23050
|
effect(() => {
|
|
22950
|
-
if (select.
|
|
22951
|
-
if (select.
|
|
22952
|
-
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)) {
|
|
22953
23054
|
el.classList.add("hidden");
|
|
22954
23055
|
} else el.classList.remove("hidden");
|
|
22955
|
-
} else if (select.
|
|
22956
|
-
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)) {
|
|
22957
23058
|
el.classList.add("hidden");
|
|
22958
23059
|
} else el.classList.remove("hidden");
|
|
22959
|
-
} else if (select.
|
|
22960
|
-
const terms = select.
|
|
23060
|
+
} else if (select._h_select.filterType === FilterType["contains-each"]) {
|
|
23061
|
+
const terms = select._h_select.search.split(" ");
|
|
22961
23062
|
const label = labelEl.innerText.toLowerCase();
|
|
22962
23063
|
if (!terms.every((term) => label.includes(term))) el.classList.add("hidden");
|
|
22963
23064
|
else el.classList.remove("hidden");
|
|
@@ -22970,11 +23071,11 @@ function select_default(Alpine) {
|
|
|
22970
23071
|
if (selected) {
|
|
22971
23072
|
indicatorEl.classList.remove("invisible");
|
|
22972
23073
|
el.setAttribute("aria-selected", "true");
|
|
22973
|
-
if (!select.
|
|
22974
|
-
select.
|
|
22975
|
-
} else if (!select.
|
|
22976
|
-
if (select.
|
|
22977
|
-
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;
|
|
22978
23079
|
}
|
|
22979
23080
|
} else {
|
|
22980
23081
|
indicatorEl.classList.add("invisible");
|
|
@@ -22982,30 +23083,30 @@ function select_default(Alpine) {
|
|
|
22982
23083
|
}
|
|
22983
23084
|
}
|
|
22984
23085
|
function removeLabel() {
|
|
22985
|
-
const lIndex = select.
|
|
22986
|
-
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);
|
|
22987
23088
|
}
|
|
22988
23089
|
effect(() => {
|
|
22989
|
-
if (select.
|
|
22990
|
-
setSelectedState(select.
|
|
23090
|
+
if (select._h_select.multiple) {
|
|
23091
|
+
setSelectedState(select._h_select.model.includes(getValue()));
|
|
22991
23092
|
} else {
|
|
22992
|
-
setSelectedState(select.
|
|
23093
|
+
setSelectedState(select._h_select.model === getValue());
|
|
22993
23094
|
}
|
|
22994
23095
|
});
|
|
22995
23096
|
const handler2 = (event) => {
|
|
22996
23097
|
if (event.type === "keydown" && event.key === "Enter" || event.type === "click") {
|
|
22997
|
-
if (select.
|
|
22998
|
-
const vIndex = select.
|
|
23098
|
+
if (select._h_select.multiple) {
|
|
23099
|
+
const vIndex = select._h_select.model.indexOf(getValue());
|
|
22999
23100
|
if (vIndex > -1) {
|
|
23000
|
-
select.
|
|
23101
|
+
select._h_select.model.splice(vIndex, 1);
|
|
23001
23102
|
removeLabel();
|
|
23002
23103
|
} else {
|
|
23003
|
-
select.
|
|
23104
|
+
select._h_select.model.push(getValue());
|
|
23004
23105
|
}
|
|
23005
|
-
} else if (select.
|
|
23006
|
-
select.
|
|
23106
|
+
} else if (select._h_select.model !== getValue()) {
|
|
23107
|
+
select._h_select.model = getValue();
|
|
23007
23108
|
} else {
|
|
23008
|
-
select.
|
|
23109
|
+
select._h_select.model = "";
|
|
23009
23110
|
removeLabel();
|
|
23010
23111
|
}
|
|
23011
23112
|
}
|
|
@@ -23045,6 +23146,61 @@ function separator_default(Alpine) {
|
|
|
23045
23146
|
});
|
|
23046
23147
|
}
|
|
23047
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
|
+
|
|
23048
23204
|
// src/components/sidebar.js
|
|
23049
23205
|
function sidebar_default(Alpine) {
|
|
23050
23206
|
Alpine.directive("h-sidebar", (el, { modifiers }, { cleanup }) => {
|
|
@@ -23382,6 +23538,128 @@ function spinner_default(Alpine) {
|
|
|
23382
23538
|
});
|
|
23383
23539
|
}
|
|
23384
23540
|
|
|
23541
|
+
// src/components/split.js
|
|
23542
|
+
function split_default(Alpine) {
|
|
23543
|
+
Alpine.directive("h-split", (el) => {
|
|
23544
|
+
el.classList.add("group/split", "flex", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
|
|
23545
|
+
el.setAttribute("tabindex", "-1");
|
|
23546
|
+
el.setAttribute("data-slot", "split");
|
|
23547
|
+
});
|
|
23548
|
+
Alpine.directive("h-split-panel", (el) => {
|
|
23549
|
+
el.setAttribute("tabindex", "-1");
|
|
23550
|
+
el.setAttribute("data-slot", "split-panel");
|
|
23551
|
+
});
|
|
23552
|
+
Alpine.directive("h-split-gutter", (el, {}, { cleanup }) => {
|
|
23553
|
+
el.classList.add(
|
|
23554
|
+
"relative",
|
|
23555
|
+
"shrink-0",
|
|
23556
|
+
"touch-none",
|
|
23557
|
+
"bg-border",
|
|
23558
|
+
"outline-none",
|
|
23559
|
+
"hover:bg-primary-hover",
|
|
23560
|
+
"active:bg-primary-active",
|
|
23561
|
+
"before:absolute",
|
|
23562
|
+
"before:top-1/2",
|
|
23563
|
+
"before:left-1/2",
|
|
23564
|
+
"before:-translate-x-1/2",
|
|
23565
|
+
"before:-translate-y-1/2",
|
|
23566
|
+
"before:block",
|
|
23567
|
+
"before:bg-transparent",
|
|
23568
|
+
"hover:before:bg-primary-hover",
|
|
23569
|
+
"group-data-[locked=true]/split:pointer-events-none",
|
|
23570
|
+
"group-data-[orientation=horizontal]/split:cursor-col-resize",
|
|
23571
|
+
"group-data-[orientation=vertical]/split:cursor-row-resize"
|
|
23572
|
+
);
|
|
23573
|
+
const borderClasses = [
|
|
23574
|
+
"bg-border",
|
|
23575
|
+
"outline-none",
|
|
23576
|
+
"hover:bg-primary-hover",
|
|
23577
|
+
"active:bg-primary-active",
|
|
23578
|
+
"before:absolute",
|
|
23579
|
+
"before:top-1/2",
|
|
23580
|
+
"before:left-1/2",
|
|
23581
|
+
"before:-translate-x-1/2",
|
|
23582
|
+
"before:-translate-y-1/2",
|
|
23583
|
+
"before:block",
|
|
23584
|
+
"before:bg-transparent",
|
|
23585
|
+
"hover:before:bg-primary-hover",
|
|
23586
|
+
"group-data-[orientation=horizontal]/split:!w-px",
|
|
23587
|
+
"group-data-[orientation=horizontal]/split:before:h-full",
|
|
23588
|
+
"group-data-[orientation=horizontal]/split:before:w-[0.313rem]",
|
|
23589
|
+
"group-data-[orientation=vertical]/split:!h-px",
|
|
23590
|
+
"group-data-[orientation=vertical]/split:before:w-full",
|
|
23591
|
+
"group-data-[orientation=vertical]/split:before:h-[0.313rem]"
|
|
23592
|
+
];
|
|
23593
|
+
const handleClasses = [
|
|
23594
|
+
"bg-transparent",
|
|
23595
|
+
"outline-none",
|
|
23596
|
+
"after:absolute",
|
|
23597
|
+
"after:block",
|
|
23598
|
+
"after:rounded-sm",
|
|
23599
|
+
"after:bg-background",
|
|
23600
|
+
"after:border-split-handle",
|
|
23601
|
+
"after:border-2",
|
|
23602
|
+
"after:shadow-xs",
|
|
23603
|
+
"after:top-1/2",
|
|
23604
|
+
"after:left-1/2",
|
|
23605
|
+
"after:-translate-x-1/2",
|
|
23606
|
+
"after:-translate-y-1/2",
|
|
23607
|
+
"hover:after:border-primary-hover",
|
|
23608
|
+
"active:after:border-primary-active",
|
|
23609
|
+
"before:absolute",
|
|
23610
|
+
"before:block",
|
|
23611
|
+
"before:top-1/2",
|
|
23612
|
+
"before:left-1/2",
|
|
23613
|
+
"before:-translate-x-1/2",
|
|
23614
|
+
"before:-translate-y-1/2",
|
|
23615
|
+
"before:rounded-sm",
|
|
23616
|
+
"before:from-transparent",
|
|
23617
|
+
"before:from-15%",
|
|
23618
|
+
"before:via-split-handle",
|
|
23619
|
+
"before:to-85%",
|
|
23620
|
+
"before:to-transparent",
|
|
23621
|
+
"hover:before:bg-primary-hover",
|
|
23622
|
+
"hover:before:via-transparent",
|
|
23623
|
+
"active:before:bg-primary-active",
|
|
23624
|
+
"active:before:via-transparent",
|
|
23625
|
+
// Orientation classes
|
|
23626
|
+
"group-data-[orientation=horizontal]/split:before:h-full",
|
|
23627
|
+
"group-data-[orientation=horizontal]/split:before:w-0.5",
|
|
23628
|
+
"group-data-[orientation=horizontal]/split:before:bg-gradient-to-b",
|
|
23629
|
+
"group-data-[orientation=vertical]/split:before:h-0.5",
|
|
23630
|
+
"group-data-[orientation=vertical]/split:before:w-full",
|
|
23631
|
+
"group-data-[orientation=vertical]/split:before:bg-gradient-to-r",
|
|
23632
|
+
// Size classes
|
|
23633
|
+
"group-data-[orientation=horizontal]/split:!w-4",
|
|
23634
|
+
"group-data-[orientation=horizontal]/split:after:w-2.5",
|
|
23635
|
+
"group-data-[orientation=horizontal]/split:after:h-5",
|
|
23636
|
+
"group-data-[orientation=vertical]/split:!h-4",
|
|
23637
|
+
"group-data-[orientation=vertical]/split:after:w-5",
|
|
23638
|
+
"group-data-[orientation=vertical]/split:after:h-2.5"
|
|
23639
|
+
];
|
|
23640
|
+
el.setAttribute("data-slot", "split-gutter");
|
|
23641
|
+
el.setAttribute("tabindex", "-1");
|
|
23642
|
+
el.setAttribute("role", "separator");
|
|
23643
|
+
function setVariant(variant = "handle") {
|
|
23644
|
+
if (variant === "border") {
|
|
23645
|
+
el.classList.remove(...handleClasses);
|
|
23646
|
+
el.classList.add(...borderClasses);
|
|
23647
|
+
} else {
|
|
23648
|
+
el.classList.remove(...borderClasses);
|
|
23649
|
+
el.classList.add(...handleClasses);
|
|
23650
|
+
}
|
|
23651
|
+
}
|
|
23652
|
+
const observer = new MutationObserver(() => {
|
|
23653
|
+
setVariant(el.parentElement.getAttribute("data-variant"));
|
|
23654
|
+
});
|
|
23655
|
+
observer.observe(el.parentElement, { attributes: true, attributeFilter: ["data-variant"] });
|
|
23656
|
+
setVariant(el.parentElement.getAttribute("data-variant"));
|
|
23657
|
+
cleanup(() => {
|
|
23658
|
+
observer.disconnect();
|
|
23659
|
+
});
|
|
23660
|
+
});
|
|
23661
|
+
}
|
|
23662
|
+
|
|
23385
23663
|
// src/components/switch.js
|
|
23386
23664
|
function switch_default(Alpine) {
|
|
23387
23665
|
Alpine.directive("h-switch", (el) => {
|
|
@@ -23406,7 +23684,7 @@ function switch_default(Alpine) {
|
|
|
23406
23684
|
"before:pointer-events-none",
|
|
23407
23685
|
"before:ring-0",
|
|
23408
23686
|
"before:rounded-full",
|
|
23409
|
-
"before:shadow-
|
|
23687
|
+
"before:shadow-input",
|
|
23410
23688
|
"before:size-5",
|
|
23411
23689
|
"before:transition-transform",
|
|
23412
23690
|
"bg-muted",
|
|
@@ -23438,7 +23716,7 @@ function switch_default(Alpine) {
|
|
|
23438
23716
|
function table_default(Alpine) {
|
|
23439
23717
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
23440
23718
|
if (modifiers.includes("scroll")) {
|
|
23441
|
-
el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-
|
|
23719
|
+
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");
|
|
23442
23720
|
} else {
|
|
23443
23721
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
23444
23722
|
}
|
|
@@ -23559,6 +23837,7 @@ function tabs_default(Alpine) {
|
|
|
23559
23837
|
"[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:min-h-12",
|
|
23560
23838
|
"data-[floating=true]:border",
|
|
23561
23839
|
"data-[floating=true]:shadow-xs",
|
|
23840
|
+
"data-[floating=true]:z-1",
|
|
23562
23841
|
"data-[floating=true]:rounded-lg",
|
|
23563
23842
|
"data-[floating=true]:p-[0.188rem]"
|
|
23564
23843
|
);
|
|
@@ -23780,7 +24059,7 @@ function textarea_default(Alpine) {
|
|
|
23780
24059
|
"px-3",
|
|
23781
24060
|
"py-2",
|
|
23782
24061
|
"text-base",
|
|
23783
|
-
"shadow-
|
|
24062
|
+
"shadow-input",
|
|
23784
24063
|
"transition-[color,box-shadow]",
|
|
23785
24064
|
"outline-none",
|
|
23786
24065
|
"focus-visible:ring-[3px]",
|
|
@@ -23789,7 +24068,7 @@ function textarea_default(Alpine) {
|
|
|
23789
24068
|
"md:text-sm"
|
|
23790
24069
|
);
|
|
23791
24070
|
if (modifiers.includes("group")) {
|
|
23792
|
-
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-
|
|
24071
|
+
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-input", "focus-visible:ring-[3px]");
|
|
23793
24072
|
el.classList.add("flex-1", "resize-none", "rounded-none", "border-0", "bg-transparent", "py-3", "shadow-none", "focus-visible:ring-0");
|
|
23794
24073
|
el.setAttribute("data-slot", "input-group-control");
|
|
23795
24074
|
} else el.setAttribute("data-slot", "textarea");
|
|
@@ -23930,7 +24209,7 @@ var getSelectedTime = (rawTime, convertTo12) => {
|
|
|
23930
24209
|
};
|
|
23931
24210
|
function timepicker_default(Alpine) {
|
|
23932
24211
|
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
23933
|
-
el.
|
|
24212
|
+
el._h_timepicker = Alpine2.reactive({
|
|
23934
24213
|
id: void 0,
|
|
23935
24214
|
controls: `htpc${v4_default()}`,
|
|
23936
24215
|
model: void 0,
|
|
@@ -23939,8 +24218,8 @@ function timepicker_default(Alpine) {
|
|
|
23939
24218
|
locale: void 0,
|
|
23940
24219
|
seconds: void 0,
|
|
23941
24220
|
close() {
|
|
23942
|
-
el.
|
|
23943
|
-
top.removeEventListener("click", el.
|
|
24221
|
+
el._h_timepicker.expanded = false;
|
|
24222
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
23944
24223
|
}
|
|
23945
24224
|
});
|
|
23946
24225
|
el._time = {
|
|
@@ -23980,7 +24259,7 @@ function timepicker_default(Alpine) {
|
|
|
23980
24259
|
"pr-2",
|
|
23981
24260
|
"text-sm",
|
|
23982
24261
|
"whitespace-nowrap",
|
|
23983
|
-
"shadow-
|
|
24262
|
+
"shadow-input",
|
|
23984
24263
|
"transition-[color,box-shadow]",
|
|
23985
24264
|
"duration-200",
|
|
23986
24265
|
"outline-none",
|
|
@@ -24007,28 +24286,28 @@ function timepicker_default(Alpine) {
|
|
|
24007
24286
|
effect(() => {
|
|
24008
24287
|
getConfig((config) => {
|
|
24009
24288
|
if (config) {
|
|
24010
|
-
if (config["locale"]) el.
|
|
24011
|
-
el.
|
|
24289
|
+
if (config["locale"]) el._h_timepicker.locale = config.locale;
|
|
24290
|
+
el._h_timepicker.seconds = config["seconds"];
|
|
24012
24291
|
if (config["is12Hour"] !== void 0) {
|
|
24013
|
-
el.
|
|
24292
|
+
el._h_timepicker.is12Hour = config.is12Hour;
|
|
24014
24293
|
} else {
|
|
24015
|
-
el.
|
|
24294
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24016
24295
|
}
|
|
24017
24296
|
}
|
|
24018
24297
|
});
|
|
24019
24298
|
});
|
|
24020
24299
|
} else {
|
|
24021
|
-
el.
|
|
24300
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24022
24301
|
}
|
|
24023
24302
|
const handler2 = (event) => {
|
|
24024
24303
|
if (event.type === "keydown" && event.key !== "Enter") return;
|
|
24025
|
-
el.
|
|
24026
|
-
el.setAttribute("aria-expanded", el.
|
|
24304
|
+
el._h_timepicker.expanded = !el._h_timepicker.expanded;
|
|
24305
|
+
el.setAttribute("aria-expanded", el._h_timepicker.expanded);
|
|
24027
24306
|
Alpine2.nextTick(() => {
|
|
24028
|
-
if (el.
|
|
24029
|
-
top.addEventListener("click", el.
|
|
24307
|
+
if (el._h_timepicker.expanded) {
|
|
24308
|
+
top.addEventListener("click", el._h_timepicker.close);
|
|
24030
24309
|
} else {
|
|
24031
|
-
top.removeEventListener("click", el.
|
|
24310
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24032
24311
|
}
|
|
24033
24312
|
});
|
|
24034
24313
|
};
|
|
@@ -24037,14 +24316,14 @@ function timepicker_default(Alpine) {
|
|
|
24037
24316
|
cleanup(() => {
|
|
24038
24317
|
el.removeEventListener("click", handler2);
|
|
24039
24318
|
el.removeEventListener("keydown", handler2);
|
|
24040
|
-
top.removeEventListener("click", el.
|
|
24319
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24041
24320
|
});
|
|
24042
24321
|
});
|
|
24043
24322
|
Alpine.directive("h-time-picker-input", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
24044
24323
|
if (el.tagName !== "INPUT") {
|
|
24045
24324
|
throw new Error("h-time-picker-input must be a readonly input of type text");
|
|
24046
24325
|
}
|
|
24047
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24326
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24048
24327
|
if (!timepicker) {
|
|
24049
24328
|
throw new Error("h-time-picker-input must be inside an h-time-picker element");
|
|
24050
24329
|
}
|
|
@@ -24054,9 +24333,9 @@ function timepicker_default(Alpine) {
|
|
|
24054
24333
|
});
|
|
24055
24334
|
};
|
|
24056
24335
|
if (el.hasOwnProperty("_x_model")) {
|
|
24057
|
-
timepicker.
|
|
24336
|
+
timepicker._h_timepicker.model = el._x_model;
|
|
24058
24337
|
} else {
|
|
24059
|
-
timepicker.
|
|
24338
|
+
timepicker._h_timepicker.model = {
|
|
24060
24339
|
get() {
|
|
24061
24340
|
return el.value;
|
|
24062
24341
|
},
|
|
@@ -24066,62 +24345,62 @@ function timepicker_default(Alpine) {
|
|
|
24066
24345
|
};
|
|
24067
24346
|
}
|
|
24068
24347
|
if (el.hasAttribute("id")) {
|
|
24069
|
-
timepicker.
|
|
24348
|
+
timepicker._h_timepicker.id = el.getAttribute("id");
|
|
24070
24349
|
} else {
|
|
24071
|
-
timepicker.
|
|
24072
|
-
el.setAttribute("id", timepicker.
|
|
24350
|
+
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
24351
|
+
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
24073
24352
|
}
|
|
24074
24353
|
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");
|
|
24075
24354
|
el.readOnly = true;
|
|
24076
24355
|
el.setAttribute("aria-autocomplete", "none");
|
|
24077
|
-
el.setAttribute("aria-controls", timepicker.
|
|
24356
|
+
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
24078
24357
|
el.setAttribute("aria-expanded", "false");
|
|
24079
24358
|
el.setAttribute("aria-haspopup", "dialog");
|
|
24080
24359
|
el.setAttribute("type", "text");
|
|
24081
24360
|
el.setAttribute("data-slot", "time-picker-input");
|
|
24082
|
-
const rawTime = timepicker.
|
|
24361
|
+
const rawTime = timepicker._h_timepicker.model.get();
|
|
24083
24362
|
if (rawTime) {
|
|
24084
|
-
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker.
|
|
24085
|
-
if (timepicker.
|
|
24086
|
-
timepicker.
|
|
24087
|
-
} else if (timepicker.
|
|
24088
|
-
timepicker.
|
|
24363
|
+
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker._h_timepicker.is12Hour);
|
|
24364
|
+
if (timepicker._h_timepicker.seconds === void 0 && !second) {
|
|
24365
|
+
timepicker._h_timepicker.seconds = false;
|
|
24366
|
+
} else if (timepicker._h_timepicker.seconds === void 0 && second) {
|
|
24367
|
+
timepicker._h_timepicker.seconds = true;
|
|
24089
24368
|
}
|
|
24090
|
-
if (timepicker.
|
|
24091
|
-
if (timepicker.
|
|
24092
|
-
timepicker.
|
|
24369
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24370
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24371
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"} ${period}`);
|
|
24093
24372
|
timepicker._time.parts.second = second ?? "00";
|
|
24094
24373
|
} else {
|
|
24095
|
-
timepicker.
|
|
24374
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute} ${period}`);
|
|
24096
24375
|
}
|
|
24097
24376
|
timepicker._time.parts.hour = hour;
|
|
24098
24377
|
timepicker._time.parts.minute = minute;
|
|
24099
24378
|
timepicker._time.parts.period = period;
|
|
24100
24379
|
} else {
|
|
24101
|
-
if (timepicker.
|
|
24102
|
-
timepicker.
|
|
24380
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24381
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"}`);
|
|
24103
24382
|
timepicker._time.parts.second = second ?? "00";
|
|
24104
24383
|
} else {
|
|
24105
|
-
timepicker.
|
|
24384
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}`);
|
|
24106
24385
|
}
|
|
24107
24386
|
timepicker._time.parts.hour = hour;
|
|
24108
24387
|
timepicker._time.parts.minute = minute;
|
|
24109
24388
|
}
|
|
24110
24389
|
}
|
|
24111
24390
|
let placeholder;
|
|
24112
|
-
if (timepicker.
|
|
24113
|
-
placeholder = timepicker.
|
|
24391
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24392
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:--:-- --" : "--:--:--";
|
|
24114
24393
|
} else {
|
|
24115
|
-
placeholder = timepicker.
|
|
24394
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:-- --" : "--:--";
|
|
24116
24395
|
}
|
|
24117
24396
|
el.setAttribute("placeholder", placeholder);
|
|
24118
24397
|
effect(() => {
|
|
24119
|
-
el.setAttribute("data-state", timepicker.
|
|
24120
|
-
el.setAttribute("aria-expanded", timepicker.
|
|
24398
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24399
|
+
el.setAttribute("aria-expanded", timepicker._h_timepicker.expanded);
|
|
24121
24400
|
});
|
|
24122
24401
|
}).before("h-button");
|
|
24123
24402
|
Alpine.directive("h-time-picker-popup", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
24124
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24403
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24125
24404
|
el.classList.add(
|
|
24126
24405
|
"overflow-hidden",
|
|
24127
24406
|
"outline-none",
|
|
@@ -24140,8 +24419,8 @@ function timepicker_default(Alpine) {
|
|
|
24140
24419
|
el.setAttribute("role", "dialog");
|
|
24141
24420
|
el.setAttribute("aria-modal", "true");
|
|
24142
24421
|
el.setAttribute("data-slot", "time-picker-popup");
|
|
24143
|
-
el.setAttribute("aria-labelledby", timepicker.
|
|
24144
|
-
el.setAttribute("data-state", timepicker.
|
|
24422
|
+
el.setAttribute("aria-labelledby", timepicker._h_timepicker.id);
|
|
24423
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24145
24424
|
const optionClasses = [
|
|
24146
24425
|
"px-3.5",
|
|
24147
24426
|
"py-2",
|
|
@@ -24163,7 +24442,7 @@ function timepicker_default(Alpine) {
|
|
|
24163
24442
|
const updateModel = () => {
|
|
24164
24443
|
let newValue;
|
|
24165
24444
|
if (timepicker._time.parts.hour !== null && timepicker._time.parts.minute !== null) {
|
|
24166
|
-
if (timepicker.
|
|
24445
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24167
24446
|
if (timepicker._time.parts.seconds !== null) {
|
|
24168
24447
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}:${timepicker._time.parts.second}`;
|
|
24169
24448
|
} else return;
|
|
@@ -24171,13 +24450,13 @@ function timepicker_default(Alpine) {
|
|
|
24171
24450
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}`;
|
|
24172
24451
|
}
|
|
24173
24452
|
} else return;
|
|
24174
|
-
if (timepicker.
|
|
24453
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24175
24454
|
if (timepicker._time.parts.period !== null) {
|
|
24176
24455
|
newValue += ` ${timepicker._time.parts.period}`;
|
|
24177
24456
|
} else return;
|
|
24178
24457
|
}
|
|
24179
24458
|
if (newValue) {
|
|
24180
|
-
timepicker.
|
|
24459
|
+
timepicker._h_timepicker.model.set(newValue);
|
|
24181
24460
|
timepicker._time.changed();
|
|
24182
24461
|
}
|
|
24183
24462
|
};
|
|
@@ -24185,22 +24464,22 @@ function timepicker_default(Alpine) {
|
|
|
24185
24464
|
let date = /* @__PURE__ */ new Date();
|
|
24186
24465
|
let hour = date.getHours();
|
|
24187
24466
|
timepicker._time.parts.period = hour >= 12 ? dayPeriodLabels.pm : dayPeriodLabels.am;
|
|
24188
|
-
if (timepicker.
|
|
24467
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24189
24468
|
hour = date.getHours() % 12 || 12;
|
|
24190
24469
|
}
|
|
24191
24470
|
let minute = date.getMinutes();
|
|
24192
24471
|
timepicker._time.parts.hour = hour < 10 ? `0${hour}` : hour.toString();
|
|
24193
24472
|
timepicker._time.parts.minute = minute < 10 ? `0${minute}` : minute.toString();
|
|
24194
|
-
if (timepicker.
|
|
24473
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24195
24474
|
let second = date.getSeconds();
|
|
24196
24475
|
timepicker._time.parts.second = second < 10 ? `0${second}` : second.toString();
|
|
24197
24476
|
}
|
|
24198
24477
|
updateModel();
|
|
24199
|
-
timepicker.
|
|
24478
|
+
timepicker._h_timepicker.close();
|
|
24200
24479
|
};
|
|
24201
24480
|
function onKeyDown(event) {
|
|
24202
24481
|
if (event.key === "Escape") {
|
|
24203
|
-
timepicker.
|
|
24482
|
+
timepicker._h_timepicker.close();
|
|
24204
24483
|
} else if (event.target.tagName === "LI") {
|
|
24205
24484
|
let list;
|
|
24206
24485
|
let inHoursList = event.target.parentElement.dataset.type === "hours";
|
|
@@ -24218,7 +24497,7 @@ function timepicker_default(Alpine) {
|
|
|
24218
24497
|
event.target.setAttribute("tabindex", "-1");
|
|
24219
24498
|
let prevElem = event.target.previousElementSibling;
|
|
24220
24499
|
if (prevElem === null || prevElem.classList.contains("hidden")) {
|
|
24221
|
-
if (inHoursList && timepicker.
|
|
24500
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24222
24501
|
prevElem = list.children[12];
|
|
24223
24502
|
} else {
|
|
24224
24503
|
prevElem = list.lastChild;
|
|
@@ -24231,7 +24510,7 @@ function timepicker_default(Alpine) {
|
|
|
24231
24510
|
event.target.setAttribute("tabindex", "-1");
|
|
24232
24511
|
let nextElem = event.target.nextElementSibling;
|
|
24233
24512
|
if (nextElem === null || nextElem.classList.contains("hidden")) {
|
|
24234
|
-
if (inHoursList && timepicker.
|
|
24513
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24235
24514
|
nextElem = list.children[1];
|
|
24236
24515
|
} else {
|
|
24237
24516
|
nextElem = list.firstChild;
|
|
@@ -24254,7 +24533,7 @@ function timepicker_default(Alpine) {
|
|
|
24254
24533
|
if (selectedHour) {
|
|
24255
24534
|
selectedHour.focus();
|
|
24256
24535
|
} else {
|
|
24257
|
-
hoursList.children[timepicker.
|
|
24536
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24258
24537
|
}
|
|
24259
24538
|
event.stopPropagation();
|
|
24260
24539
|
event.preventDefault();
|
|
@@ -24319,7 +24598,7 @@ function timepicker_default(Alpine) {
|
|
|
24319
24598
|
}
|
|
24320
24599
|
const secondsList = document.createElement("ul");
|
|
24321
24600
|
secondsList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24322
|
-
if (!timepicker.
|
|
24601
|
+
if (!timepicker._h_timepicker.seconds) {
|
|
24323
24602
|
secondsList.classList.add("hidden");
|
|
24324
24603
|
}
|
|
24325
24604
|
secondsList.setAttribute("role", "listbox");
|
|
@@ -24339,7 +24618,7 @@ function timepicker_default(Alpine) {
|
|
|
24339
24618
|
}
|
|
24340
24619
|
const periodList = document.createElement("ul");
|
|
24341
24620
|
periodList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24342
|
-
if (!timepicker.
|
|
24621
|
+
if (!timepicker._h_timepicker.is12Hour) {
|
|
24343
24622
|
periodList.classList.add("hidden");
|
|
24344
24623
|
}
|
|
24345
24624
|
periodList.setAttribute("role", "listbox");
|
|
@@ -24378,7 +24657,7 @@ function timepicker_default(Alpine) {
|
|
|
24378
24657
|
okButton.setAttribute("data-action", "close");
|
|
24379
24658
|
okButton.innerText = el.dataset.labelOk ?? "OK";
|
|
24380
24659
|
okButton.disabled = true;
|
|
24381
|
-
okButton.addEventListener("click", timepicker.
|
|
24660
|
+
okButton.addEventListener("click", timepicker._h_timepicker.close);
|
|
24382
24661
|
footer.appendChild(okButton);
|
|
24383
24662
|
el.appendChild(footer);
|
|
24384
24663
|
Alpine2.initTree(footer);
|
|
@@ -24387,7 +24666,7 @@ function timepicker_default(Alpine) {
|
|
|
24387
24666
|
let selectedSecond;
|
|
24388
24667
|
let selectedPeriod;
|
|
24389
24668
|
function render() {
|
|
24390
|
-
if (timepicker.
|
|
24669
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24391
24670
|
hoursList.firstChild.classList.add("hidden");
|
|
24392
24671
|
for (let h = 1; h < 13; h++) {
|
|
24393
24672
|
if (hoursList.children[h].innerText === timepicker._time.parts.hour) {
|
|
@@ -24418,7 +24697,7 @@ function timepicker_default(Alpine) {
|
|
|
24418
24697
|
}
|
|
24419
24698
|
}
|
|
24420
24699
|
if (!selectedHour) {
|
|
24421
|
-
hoursList.children[timepicker.
|
|
24700
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].setAttribute("tabindex", "0");
|
|
24422
24701
|
}
|
|
24423
24702
|
for (let m = 0; m < minutesList.children.length; m++) {
|
|
24424
24703
|
if (minutesList.children[m].innerText === timepicker._time.parts.minute) {
|
|
@@ -24433,7 +24712,7 @@ function timepicker_default(Alpine) {
|
|
|
24433
24712
|
if (!selectedMinute) {
|
|
24434
24713
|
minutesList.firstChild.setAttribute("tabindex", "0");
|
|
24435
24714
|
}
|
|
24436
|
-
if (timepicker.
|
|
24715
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24437
24716
|
secondsList.classList.remove("hidden");
|
|
24438
24717
|
for (let s = 0; s < secondsList.children.length; s++) {
|
|
24439
24718
|
if (secondsList.children[s].innerText === timepicker._time.parts.second) {
|
|
@@ -24448,20 +24727,20 @@ function timepicker_default(Alpine) {
|
|
|
24448
24727
|
if (!selectedSecond) {
|
|
24449
24728
|
secondsList.firstChild.setAttribute("tabindex", "0");
|
|
24450
24729
|
}
|
|
24451
|
-
if (timepicker.
|
|
24730
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24452
24731
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second && timepicker._time.parts.period ? false : true;
|
|
24453
24732
|
} else {
|
|
24454
24733
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second ? false : true;
|
|
24455
24734
|
}
|
|
24456
24735
|
} else {
|
|
24457
24736
|
secondsList.classList.add("hidden");
|
|
24458
|
-
if (timepicker.
|
|
24737
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24459
24738
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.period ? false : true;
|
|
24460
24739
|
} else {
|
|
24461
24740
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute ? false : true;
|
|
24462
24741
|
}
|
|
24463
24742
|
}
|
|
24464
|
-
if (timepicker.
|
|
24743
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24465
24744
|
periodList.classList.remove("hidden");
|
|
24466
24745
|
for (let p = 0; p < periodList.children.length; p++) {
|
|
24467
24746
|
if (periodList.children[p].innerText === timepicker._time.parts.period) {
|
|
@@ -24494,7 +24773,7 @@ function timepicker_default(Alpine) {
|
|
|
24494
24773
|
if (selectedHour) {
|
|
24495
24774
|
selectedHour.focus();
|
|
24496
24775
|
} else {
|
|
24497
|
-
hoursList.children[timepicker.
|
|
24776
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24498
24777
|
}
|
|
24499
24778
|
Object.assign(el.style, {
|
|
24500
24779
|
left: `${x}px`,
|
|
@@ -24503,13 +24782,13 @@ function timepicker_default(Alpine) {
|
|
|
24503
24782
|
});
|
|
24504
24783
|
}
|
|
24505
24784
|
effect(() => {
|
|
24506
|
-
el.setAttribute("data-state", timepicker.
|
|
24507
|
-
if (timepicker.
|
|
24785
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24786
|
+
if (timepicker._h_timepicker.expanded) {
|
|
24508
24787
|
render();
|
|
24509
24788
|
autoUpdateCleanup = autoUpdate(timepicker, el, updatePosition);
|
|
24510
24789
|
if (selectedHour) selectedHour.scrollIntoView({ block: "center" });
|
|
24511
24790
|
if (selectedMinute) selectedMinute.scrollIntoView({ block: "center" });
|
|
24512
|
-
if (selectedSecond && timepicker.
|
|
24791
|
+
if (selectedSecond && timepicker._h_timepicker.seconds) selectedSecond.scrollIntoView({ block: "center" });
|
|
24513
24792
|
} else {
|
|
24514
24793
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
24515
24794
|
Object.assign(el.style, {
|
|
@@ -24521,7 +24800,7 @@ function timepicker_default(Alpine) {
|
|
|
24521
24800
|
cleanup(() => {
|
|
24522
24801
|
el.removeEventListener("keydown", onKeyDown);
|
|
24523
24802
|
el.removeEventListener("click", onClick);
|
|
24524
|
-
okButton.removeEventListener("click", timepicker.
|
|
24803
|
+
okButton.removeEventListener("click", timepicker._h_timepicker.close);
|
|
24525
24804
|
for (let h = 0; h < hoursList.children.length; h++) {
|
|
24526
24805
|
hoursList.children[h].removeEventListener("click", setHour);
|
|
24527
24806
|
}
|
|
@@ -24661,7 +24940,7 @@ function tooltip_default(Alpine) {
|
|
|
24661
24940
|
}
|
|
24662
24941
|
|
|
24663
24942
|
// package.json
|
|
24664
|
-
var version = "0.
|
|
24943
|
+
var version = "0.7.0";
|
|
24665
24944
|
|
|
24666
24945
|
// src/utils/breakpoint-listener.js
|
|
24667
24946
|
function getBreakpointListener(handler2, breakpoint = 768) {
|
|
@@ -24731,6 +25010,18 @@ var getColorScheme = () => {
|
|
|
24731
25010
|
};
|
|
24732
25011
|
initColorScheme();
|
|
24733
25012
|
|
|
25013
|
+
// src/utils/focus.js
|
|
25014
|
+
function focus_default(Alpine) {
|
|
25015
|
+
Alpine.directive("h-focus", (el, { expression }, { effect, evaluateLater }) => {
|
|
25016
|
+
const getValue = evaluateLater(expression);
|
|
25017
|
+
effect(() => {
|
|
25018
|
+
getValue((val) => {
|
|
25019
|
+
if (val) el.focus();
|
|
25020
|
+
});
|
|
25021
|
+
});
|
|
25022
|
+
});
|
|
25023
|
+
}
|
|
25024
|
+
|
|
24734
25025
|
// src/module.js
|
|
24735
25026
|
var registerComponents = (registerPlugin) => {
|
|
24736
25027
|
registerPlugin(accordion_default);
|
|
@@ -24745,6 +25036,7 @@ var registerComponents = (registerPlugin) => {
|
|
|
24745
25036
|
registerPlugin(datepicker_default);
|
|
24746
25037
|
registerPlugin(dialog_default);
|
|
24747
25038
|
registerPlugin(fieldset_default);
|
|
25039
|
+
registerPlugin(focus_default);
|
|
24748
25040
|
registerPlugin(icon_default);
|
|
24749
25041
|
registerPlugin(info_page_default);
|
|
24750
25042
|
registerPlugin(input_default);
|
|
@@ -24758,9 +25050,11 @@ var registerComponents = (registerPlugin) => {
|
|
|
24758
25050
|
registerPlugin(range_default);
|
|
24759
25051
|
registerPlugin(select_default);
|
|
24760
25052
|
registerPlugin(separator_default);
|
|
25053
|
+
registerPlugin(sheet_default);
|
|
24761
25054
|
registerPlugin(sidebar_default);
|
|
24762
25055
|
registerPlugin(skeleton_default);
|
|
24763
25056
|
registerPlugin(spinner_default);
|
|
25057
|
+
registerPlugin(split_default);
|
|
24764
25058
|
registerPlugin(switch_default);
|
|
24765
25059
|
registerPlugin(table_default);
|
|
24766
25060
|
registerPlugin(tabs_default);
|
|
@@ -24786,6 +25080,7 @@ export {
|
|
|
24786
25080
|
datepicker_default as DatePicker,
|
|
24787
25081
|
dialog_default as Dialog,
|
|
24788
25082
|
fieldset_default as Fieldset,
|
|
25083
|
+
focus_default as Focus,
|
|
24789
25084
|
icon_default as Icon,
|
|
24790
25085
|
info_page_default as InfoPage,
|
|
24791
25086
|
input_default as Input,
|
|
@@ -24799,9 +25094,11 @@ export {
|
|
|
24799
25094
|
range_default as Range,
|
|
24800
25095
|
select_default as Select,
|
|
24801
25096
|
separator_default as Separator,
|
|
25097
|
+
sheet_default as Sheet,
|
|
24802
25098
|
sidebar_default as Sidebar,
|
|
24803
25099
|
skeleton_default as Skeleton,
|
|
24804
25100
|
spinner_default as Spinner,
|
|
25101
|
+
split_default as Split,
|
|
24805
25102
|
switch_default as Switch,
|
|
24806
25103
|
table_default as Table,
|
|
24807
25104
|
tabs_default as Tabs,
|