@codbex/harmonia 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harmonia.css +1 -1
- package/dist/harmonia.esm.js +443 -270
- package/dist/harmonia.esm.min.js +3 -3
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +442 -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;
|
|
22719
22788
|
}
|
|
22720
22789
|
}
|
|
22790
|
+
options[0].setAttribute("tabindex", "0");
|
|
22791
|
+
options[0].focus();
|
|
22792
|
+
break;
|
|
22793
|
+
case "End":
|
|
22794
|
+
case "PageDown":
|
|
22795
|
+
event.preventDefault();
|
|
22796
|
+
for (let o = 0; o < options.length; o++) {
|
|
22797
|
+
if (options[o].getAttribute("tabindex") === "0") {
|
|
22798
|
+
options[o].setAttribute("tabindex", "-1");
|
|
22799
|
+
break;
|
|
22800
|
+
}
|
|
22801
|
+
}
|
|
22802
|
+
options[options.length - 1].setAttribute("tabindex", "0");
|
|
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 }) => {
|
|
@@ -23406,7 +23562,7 @@ function switch_default(Alpine) {
|
|
|
23406
23562
|
"before:pointer-events-none",
|
|
23407
23563
|
"before:ring-0",
|
|
23408
23564
|
"before:rounded-full",
|
|
23409
|
-
"before:shadow-
|
|
23565
|
+
"before:shadow-input",
|
|
23410
23566
|
"before:size-5",
|
|
23411
23567
|
"before:transition-transform",
|
|
23412
23568
|
"bg-muted",
|
|
@@ -23438,7 +23594,7 @@ function switch_default(Alpine) {
|
|
|
23438
23594
|
function table_default(Alpine) {
|
|
23439
23595
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
23440
23596
|
if (modifiers.includes("scroll")) {
|
|
23441
|
-
el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-
|
|
23597
|
+
el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-2", "[&_tfoot]:sticky", "[&_tfoot]:bottom-0", "[&_tfoot]:z-2", "[&_tbody_tr_th]:sticky", "[&_tbody_tr_th]:left-0", "[&_tbody_tr_th]:z-1");
|
|
23442
23598
|
} else {
|
|
23443
23599
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
23444
23600
|
}
|
|
@@ -23559,6 +23715,7 @@ function tabs_default(Alpine) {
|
|
|
23559
23715
|
"[&:not([data-floating=true])]:data-[size=lg]:group-data-[orientation=horizontal]/tabs:min-h-12",
|
|
23560
23716
|
"data-[floating=true]:border",
|
|
23561
23717
|
"data-[floating=true]:shadow-xs",
|
|
23718
|
+
"data-[floating=true]:z-1",
|
|
23562
23719
|
"data-[floating=true]:rounded-lg",
|
|
23563
23720
|
"data-[floating=true]:p-[0.188rem]"
|
|
23564
23721
|
);
|
|
@@ -23780,7 +23937,7 @@ function textarea_default(Alpine) {
|
|
|
23780
23937
|
"px-3",
|
|
23781
23938
|
"py-2",
|
|
23782
23939
|
"text-base",
|
|
23783
|
-
"shadow-
|
|
23940
|
+
"shadow-input",
|
|
23784
23941
|
"transition-[color,box-shadow]",
|
|
23785
23942
|
"outline-none",
|
|
23786
23943
|
"focus-visible:ring-[3px]",
|
|
@@ -23789,7 +23946,7 @@ function textarea_default(Alpine) {
|
|
|
23789
23946
|
"md:text-sm"
|
|
23790
23947
|
);
|
|
23791
23948
|
if (modifiers.includes("group")) {
|
|
23792
|
-
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-
|
|
23949
|
+
el.classList.remove("rounded-control", "border", "bg-input-inner", "py-2", "shadow-input", "focus-visible:ring-[3px]");
|
|
23793
23950
|
el.classList.add("flex-1", "resize-none", "rounded-none", "border-0", "bg-transparent", "py-3", "shadow-none", "focus-visible:ring-0");
|
|
23794
23951
|
el.setAttribute("data-slot", "input-group-control");
|
|
23795
23952
|
} else el.setAttribute("data-slot", "textarea");
|
|
@@ -23930,7 +24087,7 @@ var getSelectedTime = (rawTime, convertTo12) => {
|
|
|
23930
24087
|
};
|
|
23931
24088
|
function timepicker_default(Alpine) {
|
|
23932
24089
|
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
23933
|
-
el.
|
|
24090
|
+
el._h_timepicker = Alpine2.reactive({
|
|
23934
24091
|
id: void 0,
|
|
23935
24092
|
controls: `htpc${v4_default()}`,
|
|
23936
24093
|
model: void 0,
|
|
@@ -23939,8 +24096,8 @@ function timepicker_default(Alpine) {
|
|
|
23939
24096
|
locale: void 0,
|
|
23940
24097
|
seconds: void 0,
|
|
23941
24098
|
close() {
|
|
23942
|
-
el.
|
|
23943
|
-
top.removeEventListener("click", el.
|
|
24099
|
+
el._h_timepicker.expanded = false;
|
|
24100
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
23944
24101
|
}
|
|
23945
24102
|
});
|
|
23946
24103
|
el._time = {
|
|
@@ -23980,7 +24137,7 @@ function timepicker_default(Alpine) {
|
|
|
23980
24137
|
"pr-2",
|
|
23981
24138
|
"text-sm",
|
|
23982
24139
|
"whitespace-nowrap",
|
|
23983
|
-
"shadow-
|
|
24140
|
+
"shadow-input",
|
|
23984
24141
|
"transition-[color,box-shadow]",
|
|
23985
24142
|
"duration-200",
|
|
23986
24143
|
"outline-none",
|
|
@@ -24007,28 +24164,28 @@ function timepicker_default(Alpine) {
|
|
|
24007
24164
|
effect(() => {
|
|
24008
24165
|
getConfig((config) => {
|
|
24009
24166
|
if (config) {
|
|
24010
|
-
if (config["locale"]) el.
|
|
24011
|
-
el.
|
|
24167
|
+
if (config["locale"]) el._h_timepicker.locale = config.locale;
|
|
24168
|
+
el._h_timepicker.seconds = config["seconds"];
|
|
24012
24169
|
if (config["is12Hour"] !== void 0) {
|
|
24013
|
-
el.
|
|
24170
|
+
el._h_timepicker.is12Hour = config.is12Hour;
|
|
24014
24171
|
} else {
|
|
24015
|
-
el.
|
|
24172
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24016
24173
|
}
|
|
24017
24174
|
}
|
|
24018
24175
|
});
|
|
24019
24176
|
});
|
|
24020
24177
|
} else {
|
|
24021
|
-
el.
|
|
24178
|
+
el._h_timepicker.is12Hour = new Intl.DateTimeFormat(el._h_timepicker.locale, { hour: "numeric" }).resolvedOptions().hour12;
|
|
24022
24179
|
}
|
|
24023
24180
|
const handler2 = (event) => {
|
|
24024
24181
|
if (event.type === "keydown" && event.key !== "Enter") return;
|
|
24025
|
-
el.
|
|
24026
|
-
el.setAttribute("aria-expanded", el.
|
|
24182
|
+
el._h_timepicker.expanded = !el._h_timepicker.expanded;
|
|
24183
|
+
el.setAttribute("aria-expanded", el._h_timepicker.expanded);
|
|
24027
24184
|
Alpine2.nextTick(() => {
|
|
24028
|
-
if (el.
|
|
24029
|
-
top.addEventListener("click", el.
|
|
24185
|
+
if (el._h_timepicker.expanded) {
|
|
24186
|
+
top.addEventListener("click", el._h_timepicker.close);
|
|
24030
24187
|
} else {
|
|
24031
|
-
top.removeEventListener("click", el.
|
|
24188
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24032
24189
|
}
|
|
24033
24190
|
});
|
|
24034
24191
|
};
|
|
@@ -24037,14 +24194,14 @@ function timepicker_default(Alpine) {
|
|
|
24037
24194
|
cleanup(() => {
|
|
24038
24195
|
el.removeEventListener("click", handler2);
|
|
24039
24196
|
el.removeEventListener("keydown", handler2);
|
|
24040
|
-
top.removeEventListener("click", el.
|
|
24197
|
+
top.removeEventListener("click", el._h_timepicker.close);
|
|
24041
24198
|
});
|
|
24042
24199
|
});
|
|
24043
24200
|
Alpine.directive("h-time-picker-input", (el, {}, { effect, Alpine: Alpine2 }) => {
|
|
24044
24201
|
if (el.tagName !== "INPUT") {
|
|
24045
24202
|
throw new Error("h-time-picker-input must be a readonly input of type text");
|
|
24046
24203
|
}
|
|
24047
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24204
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24048
24205
|
if (!timepicker) {
|
|
24049
24206
|
throw new Error("h-time-picker-input must be inside an h-time-picker element");
|
|
24050
24207
|
}
|
|
@@ -24054,9 +24211,9 @@ function timepicker_default(Alpine) {
|
|
|
24054
24211
|
});
|
|
24055
24212
|
};
|
|
24056
24213
|
if (el.hasOwnProperty("_x_model")) {
|
|
24057
|
-
timepicker.
|
|
24214
|
+
timepicker._h_timepicker.model = el._x_model;
|
|
24058
24215
|
} else {
|
|
24059
|
-
timepicker.
|
|
24216
|
+
timepicker._h_timepicker.model = {
|
|
24060
24217
|
get() {
|
|
24061
24218
|
return el.value;
|
|
24062
24219
|
},
|
|
@@ -24066,62 +24223,62 @@ function timepicker_default(Alpine) {
|
|
|
24066
24223
|
};
|
|
24067
24224
|
}
|
|
24068
24225
|
if (el.hasAttribute("id")) {
|
|
24069
|
-
timepicker.
|
|
24226
|
+
timepicker._h_timepicker.id = el.getAttribute("id");
|
|
24070
24227
|
} else {
|
|
24071
|
-
timepicker.
|
|
24072
|
-
el.setAttribute("id", timepicker.
|
|
24228
|
+
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
24229
|
+
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
24073
24230
|
}
|
|
24074
24231
|
el.classList.add("cursor-pointer", "bg-transparent", "outline-none", "flex-1", "h-full", "border-0", "focus-visible:ring-0", "md:text-sm", "text-base", "after:block", "after:w-1");
|
|
24075
24232
|
el.readOnly = true;
|
|
24076
24233
|
el.setAttribute("aria-autocomplete", "none");
|
|
24077
|
-
el.setAttribute("aria-controls", timepicker.
|
|
24234
|
+
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
24078
24235
|
el.setAttribute("aria-expanded", "false");
|
|
24079
24236
|
el.setAttribute("aria-haspopup", "dialog");
|
|
24080
24237
|
el.setAttribute("type", "text");
|
|
24081
24238
|
el.setAttribute("data-slot", "time-picker-input");
|
|
24082
|
-
const rawTime = timepicker.
|
|
24239
|
+
const rawTime = timepicker._h_timepicker.model.get();
|
|
24083
24240
|
if (rawTime) {
|
|
24084
|
-
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker.
|
|
24085
|
-
if (timepicker.
|
|
24086
|
-
timepicker.
|
|
24087
|
-
} else if (timepicker.
|
|
24088
|
-
timepicker.
|
|
24241
|
+
const { hour, minute, second, period } = getSelectedTime(rawTime, timepicker._h_timepicker.is12Hour);
|
|
24242
|
+
if (timepicker._h_timepicker.seconds === void 0 && !second) {
|
|
24243
|
+
timepicker._h_timepicker.seconds = false;
|
|
24244
|
+
} else if (timepicker._h_timepicker.seconds === void 0 && second) {
|
|
24245
|
+
timepicker._h_timepicker.seconds = true;
|
|
24089
24246
|
}
|
|
24090
|
-
if (timepicker.
|
|
24091
|
-
if (timepicker.
|
|
24092
|
-
timepicker.
|
|
24247
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24248
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24249
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"} ${period}`);
|
|
24093
24250
|
timepicker._time.parts.second = second ?? "00";
|
|
24094
24251
|
} else {
|
|
24095
|
-
timepicker.
|
|
24252
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute} ${period}`);
|
|
24096
24253
|
}
|
|
24097
24254
|
timepicker._time.parts.hour = hour;
|
|
24098
24255
|
timepicker._time.parts.minute = minute;
|
|
24099
24256
|
timepicker._time.parts.period = period;
|
|
24100
24257
|
} else {
|
|
24101
|
-
if (timepicker.
|
|
24102
|
-
timepicker.
|
|
24258
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24259
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}:${second ?? "00"}`);
|
|
24103
24260
|
timepicker._time.parts.second = second ?? "00";
|
|
24104
24261
|
} else {
|
|
24105
|
-
timepicker.
|
|
24262
|
+
timepicker._h_timepicker.model.set(`${hour}:${minute}`);
|
|
24106
24263
|
}
|
|
24107
24264
|
timepicker._time.parts.hour = hour;
|
|
24108
24265
|
timepicker._time.parts.minute = minute;
|
|
24109
24266
|
}
|
|
24110
24267
|
}
|
|
24111
24268
|
let placeholder;
|
|
24112
|
-
if (timepicker.
|
|
24113
|
-
placeholder = timepicker.
|
|
24269
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24270
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:--:-- --" : "--:--:--";
|
|
24114
24271
|
} else {
|
|
24115
|
-
placeholder = timepicker.
|
|
24272
|
+
placeholder = timepicker._h_timepicker.is12Hour ? "--:-- --" : "--:--";
|
|
24116
24273
|
}
|
|
24117
24274
|
el.setAttribute("placeholder", placeholder);
|
|
24118
24275
|
effect(() => {
|
|
24119
|
-
el.setAttribute("data-state", timepicker.
|
|
24120
|
-
el.setAttribute("aria-expanded", timepicker.
|
|
24276
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24277
|
+
el.setAttribute("aria-expanded", timepicker._h_timepicker.expanded);
|
|
24121
24278
|
});
|
|
24122
24279
|
}).before("h-button");
|
|
24123
24280
|
Alpine.directive("h-time-picker-popup", (el, {}, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
24124
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("
|
|
24281
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
24125
24282
|
el.classList.add(
|
|
24126
24283
|
"overflow-hidden",
|
|
24127
24284
|
"outline-none",
|
|
@@ -24140,8 +24297,8 @@ function timepicker_default(Alpine) {
|
|
|
24140
24297
|
el.setAttribute("role", "dialog");
|
|
24141
24298
|
el.setAttribute("aria-modal", "true");
|
|
24142
24299
|
el.setAttribute("data-slot", "time-picker-popup");
|
|
24143
|
-
el.setAttribute("aria-labelledby", timepicker.
|
|
24144
|
-
el.setAttribute("data-state", timepicker.
|
|
24300
|
+
el.setAttribute("aria-labelledby", timepicker._h_timepicker.id);
|
|
24301
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24145
24302
|
const optionClasses = [
|
|
24146
24303
|
"px-3.5",
|
|
24147
24304
|
"py-2",
|
|
@@ -24163,7 +24320,7 @@ function timepicker_default(Alpine) {
|
|
|
24163
24320
|
const updateModel = () => {
|
|
24164
24321
|
let newValue;
|
|
24165
24322
|
if (timepicker._time.parts.hour !== null && timepicker._time.parts.minute !== null) {
|
|
24166
|
-
if (timepicker.
|
|
24323
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24167
24324
|
if (timepicker._time.parts.seconds !== null) {
|
|
24168
24325
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}:${timepicker._time.parts.second}`;
|
|
24169
24326
|
} else return;
|
|
@@ -24171,13 +24328,13 @@ function timepicker_default(Alpine) {
|
|
|
24171
24328
|
newValue = `${timepicker._time.parts.hour}:${timepicker._time.parts.minute}`;
|
|
24172
24329
|
}
|
|
24173
24330
|
} else return;
|
|
24174
|
-
if (timepicker.
|
|
24331
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24175
24332
|
if (timepicker._time.parts.period !== null) {
|
|
24176
24333
|
newValue += ` ${timepicker._time.parts.period}`;
|
|
24177
24334
|
} else return;
|
|
24178
24335
|
}
|
|
24179
24336
|
if (newValue) {
|
|
24180
|
-
timepicker.
|
|
24337
|
+
timepicker._h_timepicker.model.set(newValue);
|
|
24181
24338
|
timepicker._time.changed();
|
|
24182
24339
|
}
|
|
24183
24340
|
};
|
|
@@ -24185,22 +24342,22 @@ function timepicker_default(Alpine) {
|
|
|
24185
24342
|
let date = /* @__PURE__ */ new Date();
|
|
24186
24343
|
let hour = date.getHours();
|
|
24187
24344
|
timepicker._time.parts.period = hour >= 12 ? dayPeriodLabels.pm : dayPeriodLabels.am;
|
|
24188
|
-
if (timepicker.
|
|
24345
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24189
24346
|
hour = date.getHours() % 12 || 12;
|
|
24190
24347
|
}
|
|
24191
24348
|
let minute = date.getMinutes();
|
|
24192
24349
|
timepicker._time.parts.hour = hour < 10 ? `0${hour}` : hour.toString();
|
|
24193
24350
|
timepicker._time.parts.minute = minute < 10 ? `0${minute}` : minute.toString();
|
|
24194
|
-
if (timepicker.
|
|
24351
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24195
24352
|
let second = date.getSeconds();
|
|
24196
24353
|
timepicker._time.parts.second = second < 10 ? `0${second}` : second.toString();
|
|
24197
24354
|
}
|
|
24198
24355
|
updateModel();
|
|
24199
|
-
timepicker.
|
|
24356
|
+
timepicker._h_timepicker.close();
|
|
24200
24357
|
};
|
|
24201
24358
|
function onKeyDown(event) {
|
|
24202
24359
|
if (event.key === "Escape") {
|
|
24203
|
-
timepicker.
|
|
24360
|
+
timepicker._h_timepicker.close();
|
|
24204
24361
|
} else if (event.target.tagName === "LI") {
|
|
24205
24362
|
let list;
|
|
24206
24363
|
let inHoursList = event.target.parentElement.dataset.type === "hours";
|
|
@@ -24218,7 +24375,7 @@ function timepicker_default(Alpine) {
|
|
|
24218
24375
|
event.target.setAttribute("tabindex", "-1");
|
|
24219
24376
|
let prevElem = event.target.previousElementSibling;
|
|
24220
24377
|
if (prevElem === null || prevElem.classList.contains("hidden")) {
|
|
24221
|
-
if (inHoursList && timepicker.
|
|
24378
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24222
24379
|
prevElem = list.children[12];
|
|
24223
24380
|
} else {
|
|
24224
24381
|
prevElem = list.lastChild;
|
|
@@ -24231,7 +24388,7 @@ function timepicker_default(Alpine) {
|
|
|
24231
24388
|
event.target.setAttribute("tabindex", "-1");
|
|
24232
24389
|
let nextElem = event.target.nextElementSibling;
|
|
24233
24390
|
if (nextElem === null || nextElem.classList.contains("hidden")) {
|
|
24234
|
-
if (inHoursList && timepicker.
|
|
24391
|
+
if (inHoursList && timepicker._h_timepicker.is12Hour) {
|
|
24235
24392
|
nextElem = list.children[1];
|
|
24236
24393
|
} else {
|
|
24237
24394
|
nextElem = list.firstChild;
|
|
@@ -24254,7 +24411,7 @@ function timepicker_default(Alpine) {
|
|
|
24254
24411
|
if (selectedHour) {
|
|
24255
24412
|
selectedHour.focus();
|
|
24256
24413
|
} else {
|
|
24257
|
-
hoursList.children[timepicker.
|
|
24414
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24258
24415
|
}
|
|
24259
24416
|
event.stopPropagation();
|
|
24260
24417
|
event.preventDefault();
|
|
@@ -24319,7 +24476,7 @@ function timepicker_default(Alpine) {
|
|
|
24319
24476
|
}
|
|
24320
24477
|
const secondsList = document.createElement("ul");
|
|
24321
24478
|
secondsList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24322
|
-
if (!timepicker.
|
|
24479
|
+
if (!timepicker._h_timepicker.seconds) {
|
|
24323
24480
|
secondsList.classList.add("hidden");
|
|
24324
24481
|
}
|
|
24325
24482
|
secondsList.setAttribute("role", "listbox");
|
|
@@ -24339,7 +24496,7 @@ function timepicker_default(Alpine) {
|
|
|
24339
24496
|
}
|
|
24340
24497
|
const periodList = document.createElement("ul");
|
|
24341
24498
|
periodList.classList.add("flex-1", "overflow-y-scroll", "[scrollbar-width:thin]");
|
|
24342
|
-
if (!timepicker.
|
|
24499
|
+
if (!timepicker._h_timepicker.is12Hour) {
|
|
24343
24500
|
periodList.classList.add("hidden");
|
|
24344
24501
|
}
|
|
24345
24502
|
periodList.setAttribute("role", "listbox");
|
|
@@ -24378,7 +24535,7 @@ function timepicker_default(Alpine) {
|
|
|
24378
24535
|
okButton.setAttribute("data-action", "close");
|
|
24379
24536
|
okButton.innerText = el.dataset.labelOk ?? "OK";
|
|
24380
24537
|
okButton.disabled = true;
|
|
24381
|
-
okButton.addEventListener("click", timepicker.
|
|
24538
|
+
okButton.addEventListener("click", timepicker._h_timepicker.close);
|
|
24382
24539
|
footer.appendChild(okButton);
|
|
24383
24540
|
el.appendChild(footer);
|
|
24384
24541
|
Alpine2.initTree(footer);
|
|
@@ -24387,7 +24544,7 @@ function timepicker_default(Alpine) {
|
|
|
24387
24544
|
let selectedSecond;
|
|
24388
24545
|
let selectedPeriod;
|
|
24389
24546
|
function render() {
|
|
24390
|
-
if (timepicker.
|
|
24547
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24391
24548
|
hoursList.firstChild.classList.add("hidden");
|
|
24392
24549
|
for (let h = 1; h < 13; h++) {
|
|
24393
24550
|
if (hoursList.children[h].innerText === timepicker._time.parts.hour) {
|
|
@@ -24418,7 +24575,7 @@ function timepicker_default(Alpine) {
|
|
|
24418
24575
|
}
|
|
24419
24576
|
}
|
|
24420
24577
|
if (!selectedHour) {
|
|
24421
|
-
hoursList.children[timepicker.
|
|
24578
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].setAttribute("tabindex", "0");
|
|
24422
24579
|
}
|
|
24423
24580
|
for (let m = 0; m < minutesList.children.length; m++) {
|
|
24424
24581
|
if (minutesList.children[m].innerText === timepicker._time.parts.minute) {
|
|
@@ -24433,7 +24590,7 @@ function timepicker_default(Alpine) {
|
|
|
24433
24590
|
if (!selectedMinute) {
|
|
24434
24591
|
minutesList.firstChild.setAttribute("tabindex", "0");
|
|
24435
24592
|
}
|
|
24436
|
-
if (timepicker.
|
|
24593
|
+
if (timepicker._h_timepicker.seconds) {
|
|
24437
24594
|
secondsList.classList.remove("hidden");
|
|
24438
24595
|
for (let s = 0; s < secondsList.children.length; s++) {
|
|
24439
24596
|
if (secondsList.children[s].innerText === timepicker._time.parts.second) {
|
|
@@ -24448,20 +24605,20 @@ function timepicker_default(Alpine) {
|
|
|
24448
24605
|
if (!selectedSecond) {
|
|
24449
24606
|
secondsList.firstChild.setAttribute("tabindex", "0");
|
|
24450
24607
|
}
|
|
24451
|
-
if (timepicker.
|
|
24608
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24452
24609
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second && timepicker._time.parts.period ? false : true;
|
|
24453
24610
|
} else {
|
|
24454
24611
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.second ? false : true;
|
|
24455
24612
|
}
|
|
24456
24613
|
} else {
|
|
24457
24614
|
secondsList.classList.add("hidden");
|
|
24458
|
-
if (timepicker.
|
|
24615
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24459
24616
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute && timepicker._time.parts.period ? false : true;
|
|
24460
24617
|
} else {
|
|
24461
24618
|
okButton.disabled = timepicker._time.parts.hour && timepicker._time.parts.minute ? false : true;
|
|
24462
24619
|
}
|
|
24463
24620
|
}
|
|
24464
|
-
if (timepicker.
|
|
24621
|
+
if (timepicker._h_timepicker.is12Hour) {
|
|
24465
24622
|
periodList.classList.remove("hidden");
|
|
24466
24623
|
for (let p = 0; p < periodList.children.length; p++) {
|
|
24467
24624
|
if (periodList.children[p].innerText === timepicker._time.parts.period) {
|
|
@@ -24494,7 +24651,7 @@ function timepicker_default(Alpine) {
|
|
|
24494
24651
|
if (selectedHour) {
|
|
24495
24652
|
selectedHour.focus();
|
|
24496
24653
|
} else {
|
|
24497
|
-
hoursList.children[timepicker.
|
|
24654
|
+
hoursList.children[timepicker._h_timepicker.is12Hour ? 1 : 0].focus();
|
|
24498
24655
|
}
|
|
24499
24656
|
Object.assign(el.style, {
|
|
24500
24657
|
left: `${x}px`,
|
|
@@ -24503,13 +24660,13 @@ function timepicker_default(Alpine) {
|
|
|
24503
24660
|
});
|
|
24504
24661
|
}
|
|
24505
24662
|
effect(() => {
|
|
24506
|
-
el.setAttribute("data-state", timepicker.
|
|
24507
|
-
if (timepicker.
|
|
24663
|
+
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
24664
|
+
if (timepicker._h_timepicker.expanded) {
|
|
24508
24665
|
render();
|
|
24509
24666
|
autoUpdateCleanup = autoUpdate(timepicker, el, updatePosition);
|
|
24510
24667
|
if (selectedHour) selectedHour.scrollIntoView({ block: "center" });
|
|
24511
24668
|
if (selectedMinute) selectedMinute.scrollIntoView({ block: "center" });
|
|
24512
|
-
if (selectedSecond && timepicker.
|
|
24669
|
+
if (selectedSecond && timepicker._h_timepicker.seconds) selectedSecond.scrollIntoView({ block: "center" });
|
|
24513
24670
|
} else {
|
|
24514
24671
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
24515
24672
|
Object.assign(el.style, {
|
|
@@ -24521,7 +24678,7 @@ function timepicker_default(Alpine) {
|
|
|
24521
24678
|
cleanup(() => {
|
|
24522
24679
|
el.removeEventListener("keydown", onKeyDown);
|
|
24523
24680
|
el.removeEventListener("click", onClick);
|
|
24524
|
-
okButton.removeEventListener("click", timepicker.
|
|
24681
|
+
okButton.removeEventListener("click", timepicker._h_timepicker.close);
|
|
24525
24682
|
for (let h = 0; h < hoursList.children.length; h++) {
|
|
24526
24683
|
hoursList.children[h].removeEventListener("click", setHour);
|
|
24527
24684
|
}
|
|
@@ -24661,7 +24818,7 @@ function tooltip_default(Alpine) {
|
|
|
24661
24818
|
}
|
|
24662
24819
|
|
|
24663
24820
|
// package.json
|
|
24664
|
-
var version = "0.
|
|
24821
|
+
var version = "0.6.0";
|
|
24665
24822
|
|
|
24666
24823
|
// src/utils/breakpoint-listener.js
|
|
24667
24824
|
function getBreakpointListener(handler2, breakpoint = 768) {
|
|
@@ -24731,6 +24888,18 @@ var getColorScheme = () => {
|
|
|
24731
24888
|
};
|
|
24732
24889
|
initColorScheme();
|
|
24733
24890
|
|
|
24891
|
+
// src/utils/focus.js
|
|
24892
|
+
function focus_default(Alpine) {
|
|
24893
|
+
Alpine.directive("h-focus", (el, { expression }, { effect, evaluateLater }) => {
|
|
24894
|
+
const getValue = evaluateLater(expression);
|
|
24895
|
+
effect(() => {
|
|
24896
|
+
getValue((val) => {
|
|
24897
|
+
if (val) el.focus();
|
|
24898
|
+
});
|
|
24899
|
+
});
|
|
24900
|
+
});
|
|
24901
|
+
}
|
|
24902
|
+
|
|
24734
24903
|
// src/module.js
|
|
24735
24904
|
var registerComponents = (registerPlugin) => {
|
|
24736
24905
|
registerPlugin(accordion_default);
|
|
@@ -24745,6 +24914,7 @@ var registerComponents = (registerPlugin) => {
|
|
|
24745
24914
|
registerPlugin(datepicker_default);
|
|
24746
24915
|
registerPlugin(dialog_default);
|
|
24747
24916
|
registerPlugin(fieldset_default);
|
|
24917
|
+
registerPlugin(focus_default);
|
|
24748
24918
|
registerPlugin(icon_default);
|
|
24749
24919
|
registerPlugin(info_page_default);
|
|
24750
24920
|
registerPlugin(input_default);
|
|
@@ -24758,6 +24928,7 @@ var registerComponents = (registerPlugin) => {
|
|
|
24758
24928
|
registerPlugin(range_default);
|
|
24759
24929
|
registerPlugin(select_default);
|
|
24760
24930
|
registerPlugin(separator_default);
|
|
24931
|
+
registerPlugin(sheet_default);
|
|
24761
24932
|
registerPlugin(sidebar_default);
|
|
24762
24933
|
registerPlugin(skeleton_default);
|
|
24763
24934
|
registerPlugin(spinner_default);
|
|
@@ -24786,6 +24957,7 @@ export {
|
|
|
24786
24957
|
datepicker_default as DatePicker,
|
|
24787
24958
|
dialog_default as Dialog,
|
|
24788
24959
|
fieldset_default as Fieldset,
|
|
24960
|
+
focus_default as Focus,
|
|
24789
24961
|
icon_default as Icon,
|
|
24790
24962
|
info_page_default as InfoPage,
|
|
24791
24963
|
input_default as Input,
|
|
@@ -24799,6 +24971,7 @@ export {
|
|
|
24799
24971
|
range_default as Range,
|
|
24800
24972
|
select_default as Select,
|
|
24801
24973
|
separator_default as Separator,
|
|
24974
|
+
sheet_default as Sheet,
|
|
24802
24975
|
sidebar_default as Sidebar,
|
|
24803
24976
|
skeleton_default as Skeleton,
|
|
24804
24977
|
spinner_default as Spinner,
|