@codbex/harmonia 1.7.2 → 1.8.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 +649 -160
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +648 -159
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +1 -1
package/dist/harmonia.js
CHANGED
|
@@ -597,12 +597,12 @@
|
|
|
597
597
|
}) : { single: false };
|
|
598
598
|
el.setAttribute("data-slot", "accordion");
|
|
599
599
|
});
|
|
600
|
-
Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, {
|
|
600
|
+
Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, { Alpine: Alpine2 }) => {
|
|
601
601
|
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
602
602
|
if (!accordion) {
|
|
603
603
|
throw new Error(`${original2} must be inside an accordion`);
|
|
604
604
|
}
|
|
605
|
-
el.classList.add("border-b", "last:border-b-0"
|
|
605
|
+
el.classList.add("border-b", "last:border-b-0");
|
|
606
606
|
el.setAttribute("data-slot", "accordion-item");
|
|
607
607
|
const itemId = expression ?? `ha${uuid_default()}`;
|
|
608
608
|
function getIsExpanded() {
|
|
@@ -622,11 +622,6 @@
|
|
|
622
622
|
controls: `ha${uuid_default()}`,
|
|
623
623
|
expanded: getIsExpanded()
|
|
624
624
|
});
|
|
625
|
-
const setAttributes = () => {
|
|
626
|
-
el.setAttribute("data-state", el._h_accordionItem.expanded ? "open" : "closed");
|
|
627
|
-
};
|
|
628
|
-
setAttributes();
|
|
629
|
-
effect(setAttributes);
|
|
630
625
|
});
|
|
631
626
|
Alpine.directive("h-accordion-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
632
627
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
@@ -637,23 +632,12 @@
|
|
|
637
632
|
if (!accordionItem || !accordion) {
|
|
638
633
|
throw new Error(`${original2} must have an accordion and accordion item parent elements`);
|
|
639
634
|
}
|
|
640
|
-
el.classList.add(
|
|
641
|
-
"flex",
|
|
642
|
-
"h-12",
|
|
643
|
-
"[[data-size=md]_&]:h-10",
|
|
644
|
-
"[[data-size=sm]_&]:h-8",
|
|
645
|
-
"[[data-variant=header]_&]:bg-object-header",
|
|
646
|
-
"[[data-variant=header]_&]:text-object-header-foreground",
|
|
647
|
-
"[[data-variant=header]_&]:px-4",
|
|
648
|
-
"[[data-variant=header]_&]:border-b",
|
|
649
|
-
"[[data-size=md][data-variant=header]_&]:px-3",
|
|
650
|
-
"[[data-size=sm][data-variant=header]_&]:px-2.5"
|
|
651
|
-
);
|
|
635
|
+
el.classList.add("flex", "h-12", "min-h-12", "[[data-size=md]_&]:h-10", "[[data-size=md]_&]:min-h-10", "[[data-size=sm]_&]:h-8", "[[data-size=sm]_&]:min-h-8");
|
|
652
636
|
el.setAttribute("tabIndex", "-1");
|
|
653
637
|
const getLabel = evaluateLater(expression);
|
|
654
638
|
const chevronDown = createSvg({
|
|
655
639
|
icon: ChevronDown,
|
|
656
|
-
classes: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200",
|
|
640
|
+
classes: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform motion-reduce:transition-none duration-200",
|
|
657
641
|
attrs: {
|
|
658
642
|
"aria-hidden": true,
|
|
659
643
|
role: "presentation"
|
|
@@ -675,12 +659,13 @@
|
|
|
675
659
|
"text-sm",
|
|
676
660
|
"font-medium",
|
|
677
661
|
"transition-all",
|
|
662
|
+
"motion-reduce:transition-none",
|
|
678
663
|
"outline-none",
|
|
679
664
|
"hover:underline",
|
|
680
665
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
681
666
|
"disabled:pointer-events-none",
|
|
682
667
|
"disabled:opacity-50",
|
|
683
|
-
"[&[
|
|
668
|
+
"[&[aria-expanded=true]>svg]:rotate-180"
|
|
684
669
|
);
|
|
685
670
|
el.appendChild(button);
|
|
686
671
|
effect(() => {
|
|
@@ -692,7 +677,6 @@
|
|
|
692
677
|
button.setAttribute("id", accordionItem._h_accordionItem.id);
|
|
693
678
|
button.setAttribute("aria-controls", accordionItem._h_accordionItem.controls);
|
|
694
679
|
const setAttributes = () => {
|
|
695
|
-
button.setAttribute("data-state", accordionItem._h_accordionItem.expanded ? "open" : "closed");
|
|
696
680
|
button.setAttribute("aria-expanded", accordionItem._h_accordionItem.expanded);
|
|
697
681
|
};
|
|
698
682
|
const handler = () => {
|
|
@@ -716,16 +700,46 @@
|
|
|
716
700
|
});
|
|
717
701
|
}
|
|
718
702
|
});
|
|
719
|
-
Alpine.directive("h-accordion-content", (el, _, { effect, Alpine: Alpine2 }) => {
|
|
720
|
-
el.classList.add("
|
|
703
|
+
Alpine.directive("h-accordion-content", (el, _, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
704
|
+
el.classList.add("pb-0", "overflow-hidden", "text-sm", "hidden", "transition-[opacity,max-height,padding-bottom]", "motion-reduce:transition-none", "duration-200", "ease-out", "opacity-0");
|
|
721
705
|
el.setAttribute("data-slot", "accordion-content");
|
|
722
706
|
const parent = Alpine2.findClosest(el.parentElement, (parent2) => parent2.hasOwnProperty("_h_accordionItem"));
|
|
723
707
|
if (parent) {
|
|
708
|
+
let onTransitionEnd = function(event) {
|
|
709
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
710
|
+
el.classList.add("hidden");
|
|
711
|
+
}
|
|
712
|
+
};
|
|
724
713
|
el.setAttribute("id", parent._h_accordionItem.controls);
|
|
725
714
|
el.setAttribute("aria-labelledby", parent._h_accordionItem.id);
|
|
726
|
-
el.setAttribute("data-state", parent._h_accordionItem.expanded ? "open" : "closed");
|
|
727
715
|
effect(() => {
|
|
728
|
-
|
|
716
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
717
|
+
el.style.removeProperty("max-height");
|
|
718
|
+
if (parent._h_accordionItem.expanded) {
|
|
719
|
+
el.classList.add("pb-4", "[[data-size=md]_&]:pb-3", "[[data-size=sm]_&]:pb-2");
|
|
720
|
+
el.classList.remove("hidden", "pb-0", "opacity-0");
|
|
721
|
+
} else {
|
|
722
|
+
el.classList.add("hidden", "pb-0", "opacity-0");
|
|
723
|
+
el.classList.remove("pb-4", "[[data-size=md]_&]:pb-3", "[[data-size=sm]_&]:pb-2");
|
|
724
|
+
}
|
|
725
|
+
} else if (parent._h_accordionItem.expanded) {
|
|
726
|
+
if (el.classList.contains("hidden")) {
|
|
727
|
+
el.classList.add("pb-4", "[[data-size=md]_&]:pb-3", "[[data-size=sm]_&]:pb-2");
|
|
728
|
+
el.classList.remove("hidden", "pb-0");
|
|
729
|
+
Alpine2.nextTick(() => {
|
|
730
|
+
el.style.maxHeight = `${el.scrollHeight}px`;
|
|
731
|
+
el.classList.remove("opacity-0");
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
el.style.maxHeight = "0px";
|
|
736
|
+
el.classList.add("opacity-0", "pb-0");
|
|
737
|
+
el.classList.remove("pb-4", "[[data-size=md]_&]:pb-3", "[[data-size=sm]_&]:pb-2");
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
741
|
+
cleanup(() => {
|
|
742
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
729
743
|
});
|
|
730
744
|
}
|
|
731
745
|
});
|
|
@@ -919,6 +933,7 @@
|
|
|
919
933
|
"focus-visible:ring-ring/50",
|
|
920
934
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
921
935
|
"transition-[color,box-shadow]",
|
|
936
|
+
"motion-reduce:transition-none",
|
|
922
937
|
"overflow-hidden"
|
|
923
938
|
);
|
|
924
939
|
el.setAttribute("data-slot", "badge");
|
|
@@ -1112,6 +1127,7 @@
|
|
|
1112
1127
|
"text-sm",
|
|
1113
1128
|
"font-medium",
|
|
1114
1129
|
"transition-all",
|
|
1130
|
+
"motion-reduce:transition-none",
|
|
1115
1131
|
"disabled:pointer-events-none",
|
|
1116
1132
|
"disabled:opacity-50",
|
|
1117
1133
|
"[&_svg]:pointer-events-none",
|
|
@@ -2722,11 +2738,25 @@
|
|
|
2722
2738
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
2723
2739
|
el.setAttribute("tabindex", "-1");
|
|
2724
2740
|
if (datepicker) {
|
|
2725
|
-
el.classList.add(
|
|
2741
|
+
el.classList.add(
|
|
2742
|
+
"absolute",
|
|
2743
|
+
"bg-popover",
|
|
2744
|
+
"text-popover-foreground",
|
|
2745
|
+
"flex",
|
|
2746
|
+
"flex-col",
|
|
2747
|
+
"hidden",
|
|
2748
|
+
"z-50",
|
|
2749
|
+
"shadow-md",
|
|
2750
|
+
"transition-[opacity,scale]",
|
|
2751
|
+
"motion-reduce:transition-none",
|
|
2752
|
+
"duration-100",
|
|
2753
|
+
"ease-out",
|
|
2754
|
+
"opacity-0",
|
|
2755
|
+
"scale-95"
|
|
2756
|
+
);
|
|
2726
2757
|
el.setAttribute("role", "dialog");
|
|
2727
2758
|
el.setAttribute("aria-modal", "true");
|
|
2728
2759
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
2729
|
-
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
2730
2760
|
} else {
|
|
2731
2761
|
el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
|
|
2732
2762
|
}
|
|
@@ -2774,16 +2804,19 @@
|
|
|
2774
2804
|
if (datepicker) {
|
|
2775
2805
|
datepicker._h_datepicker.input.addEventListener("change", onInputChange);
|
|
2776
2806
|
}
|
|
2807
|
+
function setFromModel() {
|
|
2808
|
+
selected = new Date(el._x_model.get());
|
|
2809
|
+
if (isNaN(selected)) {
|
|
2810
|
+
console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
|
|
2811
|
+
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2812
|
+
else el.setAttribute("data-invalid", "true");
|
|
2813
|
+
} else if (datepicker) {
|
|
2814
|
+
datepicker._h_datepicker.input.value = formatter.format(selected);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2777
2817
|
function checkForModel() {
|
|
2778
2818
|
if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
|
|
2779
|
-
|
|
2780
|
-
if (isNaN(selected)) {
|
|
2781
|
-
console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
|
|
2782
|
-
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2783
|
-
else el.setAttribute("data-invalid", "true");
|
|
2784
|
-
} else if (datepicker) {
|
|
2785
|
-
datepicker._h_datepicker.input.value = formatter.format(selected);
|
|
2786
|
-
}
|
|
2819
|
+
setFromModel();
|
|
2787
2820
|
}
|
|
2788
2821
|
}
|
|
2789
2822
|
function dayClick(event) {
|
|
@@ -2830,6 +2863,7 @@
|
|
|
2830
2863
|
"text-sm",
|
|
2831
2864
|
"font-medium",
|
|
2832
2865
|
"transition-all",
|
|
2866
|
+
"motion-reduce:transition-none",
|
|
2833
2867
|
"outline-none",
|
|
2834
2868
|
"focus-visible:border-ring",
|
|
2835
2869
|
"focus-visible:ring-ring/50",
|
|
@@ -2959,6 +2993,9 @@
|
|
|
2959
2993
|
"size-8",
|
|
2960
2994
|
"rounded-control",
|
|
2961
2995
|
"outline-none",
|
|
2996
|
+
"duration-100",
|
|
2997
|
+
"transition-all",
|
|
2998
|
+
"motion-reduce:transition-none",
|
|
2962
2999
|
"hover:bg-secondary-hover",
|
|
2963
3000
|
"hover:text-secondary-foreground",
|
|
2964
3001
|
"focus:bg-secondary-hover",
|
|
@@ -3162,25 +3199,59 @@
|
|
|
3162
3199
|
left: `${x}px`,
|
|
3163
3200
|
top: `${y}px`
|
|
3164
3201
|
});
|
|
3202
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
3165
3203
|
});
|
|
3166
3204
|
}
|
|
3167
3205
|
if (datepicker) {
|
|
3168
3206
|
effect(() => {
|
|
3169
|
-
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
3170
3207
|
if (datepicker._h_datepicker.state.expanded) {
|
|
3208
|
+
el.classList.remove("hidden");
|
|
3171
3209
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
3172
3210
|
Alpine2.nextTick(() => {
|
|
3173
3211
|
focusDay();
|
|
3174
3212
|
});
|
|
3175
3213
|
} else {
|
|
3214
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
3215
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
3216
|
+
Object.assign(el.style, {
|
|
3217
|
+
left: "0px",
|
|
3218
|
+
top: "0px"
|
|
3219
|
+
});
|
|
3220
|
+
} else {
|
|
3221
|
+
el.classList.add("scale-95", "opacity-0");
|
|
3222
|
+
}
|
|
3176
3223
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
3177
|
-
Object.assign(el.style, {
|
|
3178
|
-
left: "0px",
|
|
3179
|
-
top: "0px"
|
|
3180
|
-
});
|
|
3181
3224
|
}
|
|
3182
3225
|
});
|
|
3183
3226
|
}
|
|
3227
|
+
function onTransitionEnd(event) {
|
|
3228
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
3229
|
+
el.classList.add("hidden");
|
|
3230
|
+
Object.assign(el.style, {
|
|
3231
|
+
left: "0px",
|
|
3232
|
+
top: "0px"
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
if (datepicker) {
|
|
3237
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
3238
|
+
}
|
|
3239
|
+
if (el.hasOwnProperty("_x_model")) {
|
|
3240
|
+
const modelExpression = el.getAttribute("x-model");
|
|
3241
|
+
const evaluateModel = evaluateLater(modelExpression);
|
|
3242
|
+
effect(() => {
|
|
3243
|
+
evaluateModel((value) => {
|
|
3244
|
+
if (!selected && value || value && selected.getTime() !== new Date(value).getTime()) {
|
|
3245
|
+
setFromModel();
|
|
3246
|
+
render();
|
|
3247
|
+
} else if (!value) {
|
|
3248
|
+
if (datepicker) datepicker._h_datepicker.input.value = "";
|
|
3249
|
+
selected = void 0;
|
|
3250
|
+
render();
|
|
3251
|
+
}
|
|
3252
|
+
});
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3184
3255
|
cleanup(() => {
|
|
3185
3256
|
el.removeEventListener("keydown", onKeyDown);
|
|
3186
3257
|
for (let d = 0; d < dayCells.length; d++) {
|
|
@@ -3188,6 +3259,7 @@
|
|
|
3188
3259
|
}
|
|
3189
3260
|
if (datepicker) {
|
|
3190
3261
|
datepicker._h_datepicker.input.removeEventListener("change", onInputChange);
|
|
3262
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
3191
3263
|
}
|
|
3192
3264
|
});
|
|
3193
3265
|
});
|
|
@@ -3262,7 +3334,8 @@
|
|
|
3262
3334
|
"shadow-input",
|
|
3263
3335
|
"shrink-0",
|
|
3264
3336
|
"size-5",
|
|
3265
|
-
"transition-
|
|
3337
|
+
"transition-colors",
|
|
3338
|
+
"motion-reduce:transition-none"
|
|
3266
3339
|
);
|
|
3267
3340
|
el.setAttribute("tabindex", "-1");
|
|
3268
3341
|
el.setAttribute("data-slot", "checkbox");
|
|
@@ -3271,57 +3344,6 @@
|
|
|
3271
3344
|
});
|
|
3272
3345
|
}
|
|
3273
3346
|
|
|
3274
|
-
// src/components/collapsible.js
|
|
3275
|
-
function collapsible_default(Alpine) {
|
|
3276
|
-
Alpine.directive("h-collapsible", (el, { expression }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
3277
|
-
el._h_collapsible = Alpine2.reactive({
|
|
3278
|
-
expanded: expression ? evaluate2(expression) : false
|
|
3279
|
-
});
|
|
3280
|
-
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible");
|
|
3281
|
-
if (expression) {
|
|
3282
|
-
const getExpanded = evaluateLater(expression);
|
|
3283
|
-
effect(() => {
|
|
3284
|
-
getExpanded((expanded) => {
|
|
3285
|
-
el._h_collapsible.expanded = expanded;
|
|
3286
|
-
});
|
|
3287
|
-
});
|
|
3288
|
-
}
|
|
3289
|
-
});
|
|
3290
|
-
Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
3291
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
3292
|
-
if (!collapsible) {
|
|
3293
|
-
throw new Error(`${original2} must be inside a collapsible element`);
|
|
3294
|
-
}
|
|
3295
|
-
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
|
|
3296
|
-
if (modifiers.includes("chevron")) {
|
|
3297
|
-
el.classList.add("[&_svg]:transition-transform");
|
|
3298
|
-
if (modifiers.includes("90")) el.classList.add("[&[data-state=open]>svg:not(:first-child):last-child]:rotate-90", "[&[data-state=open]>svg:only-child]:rotate-90");
|
|
3299
|
-
else el.classList.add("[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180", "[&[data-state=open]>svg:only-child]:rotate-180");
|
|
3300
|
-
}
|
|
3301
|
-
const handler = () => {
|
|
3302
|
-
collapsible._h_collapsible.expanded = !collapsible._h_collapsible.expanded;
|
|
3303
|
-
};
|
|
3304
|
-
effect(() => {
|
|
3305
|
-
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
3306
|
-
});
|
|
3307
|
-
el.addEventListener("click", handler);
|
|
3308
|
-
cleanup(() => {
|
|
3309
|
-
el.removeEventListener("click", handler);
|
|
3310
|
-
});
|
|
3311
|
-
});
|
|
3312
|
-
Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
3313
|
-
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
3314
|
-
if (!collapsible) {
|
|
3315
|
-
throw new Error(`${original2} must be inside an h-collapsible element`);
|
|
3316
|
-
}
|
|
3317
|
-
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
|
|
3318
|
-
el.classList.add("data-[state=closed]:!hidden");
|
|
3319
|
-
effect(() => {
|
|
3320
|
-
el.setAttribute("data-state", collapsible._h_collapsible.expanded ? "open" : "closed");
|
|
3321
|
-
});
|
|
3322
|
-
});
|
|
3323
|
-
}
|
|
3324
|
-
|
|
3325
3347
|
// src/common/input-size.js
|
|
3326
3348
|
function setSize(el, size3) {
|
|
3327
3349
|
if (size3 === "sm") {
|
|
@@ -3370,6 +3392,7 @@
|
|
|
3370
3392
|
"flex",
|
|
3371
3393
|
"items-center",
|
|
3372
3394
|
"transition-[color,box-shadow]",
|
|
3395
|
+
"motion-reduce:transition-none",
|
|
3373
3396
|
"duration-200",
|
|
3374
3397
|
"outline-none",
|
|
3375
3398
|
"pl-3",
|
|
@@ -3510,11 +3533,20 @@
|
|
|
3510
3533
|
// src/components/dialog.js
|
|
3511
3534
|
function dialog_default(Alpine) {
|
|
3512
3535
|
Alpine.directive("h-dialog-overlay", (el, _, { cleanup }) => {
|
|
3513
|
-
el.classList.add("hidden", "
|
|
3536
|
+
el.classList.add("hidden", "fixed", "inset-0", "z-50", "bg-black/60", "transition-[opacity,scale]", "motion-reduce:transition-none", "duration-200", "ease-out", "opacity-0", "*:scale-95");
|
|
3514
3537
|
el.setAttribute("tabindex", "-1");
|
|
3515
3538
|
el.setAttribute("data-slot", "dialog-overlay");
|
|
3516
3539
|
const observer = new MutationObserver(() => {
|
|
3517
3540
|
if (el.getAttribute("data-open") === "true") {
|
|
3541
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
3542
|
+
el.classList.remove("hidden", "*:scale-95", "opacity-0");
|
|
3543
|
+
} else {
|
|
3544
|
+
el.classList.remove("hidden");
|
|
3545
|
+
Alpine.nextTick(() => {
|
|
3546
|
+
el.offsetHeight;
|
|
3547
|
+
el.classList.remove("*:scale-95", "opacity-0");
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3518
3550
|
const inputs = el.getElementsByTagName("INPUT");
|
|
3519
3551
|
if (inputs.length) {
|
|
3520
3552
|
for (let i = 0; i < inputs.length; i++) {
|
|
@@ -3542,11 +3574,24 @@
|
|
|
3542
3574
|
if (buttons.length) {
|
|
3543
3575
|
buttons[0].focus();
|
|
3544
3576
|
}
|
|
3577
|
+
} else {
|
|
3578
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
3579
|
+
el.classList.add("hidden", "*:scale-95", "opacity-0");
|
|
3580
|
+
} else {
|
|
3581
|
+
el.classList.add("*:scale-95", "opacity-0");
|
|
3582
|
+
}
|
|
3545
3583
|
}
|
|
3546
3584
|
});
|
|
3585
|
+
function onTransitionEnd(event) {
|
|
3586
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
3587
|
+
el.classList.add("hidden");
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
3547
3591
|
observer.observe(el, { attributes: true, attributeFilter: ["data-open"] });
|
|
3548
3592
|
cleanup(() => {
|
|
3549
3593
|
observer.disconnect();
|
|
3594
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
3550
3595
|
});
|
|
3551
3596
|
});
|
|
3552
3597
|
Alpine.directive("h-dialog", (el) => {
|
|
@@ -3569,7 +3614,11 @@
|
|
|
3569
3614
|
"p-4",
|
|
3570
3615
|
"shadow-xl",
|
|
3571
3616
|
"sm:max-w-lg",
|
|
3572
|
-
"outline-none"
|
|
3617
|
+
"outline-none",
|
|
3618
|
+
"transition-[opacity,scale]",
|
|
3619
|
+
"motion-reduce:transition-none",
|
|
3620
|
+
"duration-200",
|
|
3621
|
+
"ease-out"
|
|
3573
3622
|
);
|
|
3574
3623
|
el.setAttribute("role", "dialog");
|
|
3575
3624
|
el.setAttribute("data-slot", "dialog");
|
|
@@ -3598,6 +3647,7 @@
|
|
|
3598
3647
|
"rounded-xs",
|
|
3599
3648
|
"opacity-70",
|
|
3600
3649
|
"transition-opacity",
|
|
3650
|
+
"motion-reduce:transition-none",
|
|
3601
3651
|
"hover:opacity-100",
|
|
3602
3652
|
"focus:ring-2",
|
|
3603
3653
|
"focus:ring-offset-2",
|
|
@@ -3628,6 +3678,161 @@
|
|
|
3628
3678
|
});
|
|
3629
3679
|
}
|
|
3630
3680
|
|
|
3681
|
+
// src/components/expansion-panel.js
|
|
3682
|
+
function expansion_panel_default(Alpine) {
|
|
3683
|
+
Alpine.directive("h-exp-panel", (el) => {
|
|
3684
|
+
el.classList.add("vbox", "h-full", "group/exp", "data-[floating=true]:gap-2", "data-[floating=true]:overflow-visible");
|
|
3685
|
+
el.setAttribute("data-slot", "exp-panel");
|
|
3686
|
+
});
|
|
3687
|
+
Alpine.directive("h-exp-panel-item", (el, { expression }, { evaluate: evaluate2, evaluateLater, effect, Alpine: Alpine2 }) => {
|
|
3688
|
+
el.classList.add(
|
|
3689
|
+
"flex",
|
|
3690
|
+
"flex-col",
|
|
3691
|
+
"overflow-hidden",
|
|
3692
|
+
"transition-all",
|
|
3693
|
+
"motion-reduce:transition-none",
|
|
3694
|
+
"duration-300",
|
|
3695
|
+
"ease-out",
|
|
3696
|
+
"h-full",
|
|
3697
|
+
"border-b",
|
|
3698
|
+
"last:border-b-0",
|
|
3699
|
+
"min-h-12",
|
|
3700
|
+
"[[data-size=md]_&]:min-h-10",
|
|
3701
|
+
"[[data-size=sm]_&]:min-h-8",
|
|
3702
|
+
"[[data-floating=true]_&]:border-b-0",
|
|
3703
|
+
"[[data-floating=true]_&]:overflow-visible"
|
|
3704
|
+
);
|
|
3705
|
+
el.setAttribute("data-slot", "exp-panel-item");
|
|
3706
|
+
let itemId;
|
|
3707
|
+
if (el.hasAttribute("id")) {
|
|
3708
|
+
itemId = el.getAttribute("id");
|
|
3709
|
+
} else {
|
|
3710
|
+
itemId = `epi${uuid_default()}`;
|
|
3711
|
+
}
|
|
3712
|
+
function setExpanded(expanded) {
|
|
3713
|
+
if (expanded) {
|
|
3714
|
+
el.classList.add("flex-[1_1_0]");
|
|
3715
|
+
el.classList.remove("flex-[0_1_0]");
|
|
3716
|
+
} else {
|
|
3717
|
+
el.classList.add("flex-[0_1_0]");
|
|
3718
|
+
el.classList.remove("flex-[1_1_0]");
|
|
3719
|
+
}
|
|
3720
|
+
}
|
|
3721
|
+
el._h_expPanelItem = Alpine2.reactive({
|
|
3722
|
+
controls: itemId,
|
|
3723
|
+
expanded: evaluate2(expression || "false")
|
|
3724
|
+
});
|
|
3725
|
+
if (expression !== "" && expression !== void 0 && expression !== null && expression !== "true" && expression !== "false") {
|
|
3726
|
+
const getIsExpanded = evaluateLater(expression);
|
|
3727
|
+
effect(() => {
|
|
3728
|
+
getIsExpanded((expanded) => {
|
|
3729
|
+
setExpanded(expanded);
|
|
3730
|
+
});
|
|
3731
|
+
});
|
|
3732
|
+
effect(() => {
|
|
3733
|
+
if (evaluate2(expression) !== el._h_expPanelItem.expanded) {
|
|
3734
|
+
evaluate2(`${expression} = ${el._h_expPanelItem.expanded}`);
|
|
3735
|
+
}
|
|
3736
|
+
});
|
|
3737
|
+
} else {
|
|
3738
|
+
effect(() => {
|
|
3739
|
+
setExpanded(el._h_expPanelItem.expanded);
|
|
3740
|
+
});
|
|
3741
|
+
}
|
|
3742
|
+
});
|
|
3743
|
+
Alpine.directive("h-exp-panel-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
3744
|
+
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
3745
|
+
throw new Error(`${original2} must be a header element`);
|
|
3746
|
+
}
|
|
3747
|
+
const expPanelItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_expPanelItem"));
|
|
3748
|
+
if (!expPanelItem) {
|
|
3749
|
+
throw new Error(`${original2} must have an exp-panel-item parent element`);
|
|
3750
|
+
}
|
|
3751
|
+
el.classList.add(
|
|
3752
|
+
"bg-object-header",
|
|
3753
|
+
"border-b",
|
|
3754
|
+
"[[data-slot=exp-panel-item]:last-child>&]:not-has-[button[aria-expanded=true]]:group-has-[button[aria-expanded=true]]/exp:border-b-0",
|
|
3755
|
+
"flex",
|
|
3756
|
+
"h-12",
|
|
3757
|
+
"min-h-12",
|
|
3758
|
+
"px-4",
|
|
3759
|
+
"text-object-header-foreground",
|
|
3760
|
+
"[[data-floating=true]_&]:border",
|
|
3761
|
+
"[[data-floating=true]_&]:!border-b",
|
|
3762
|
+
"[[data-floating=true]_&]:rounded-lg",
|
|
3763
|
+
"[[data-floating=true]_&]:shadow-xs",
|
|
3764
|
+
"[[data-size=md]_&]:h-10",
|
|
3765
|
+
"[[data-size=md]_&]:min-h-10",
|
|
3766
|
+
"[[data-size=md]_&]:px-3",
|
|
3767
|
+
"[[data-size=sm]_&]:h-8",
|
|
3768
|
+
"[[data-size=sm]_&]:min-h-8",
|
|
3769
|
+
"[[data-size=sm]_&]:px-2.5",
|
|
3770
|
+
"[[data-variant=transparent]_&]:bg-transparent",
|
|
3771
|
+
"[[data-variant=transparent]_&]:text-foreground"
|
|
3772
|
+
);
|
|
3773
|
+
el.setAttribute("tabIndex", "-1");
|
|
3774
|
+
const getLabel = evaluateLater(expression);
|
|
3775
|
+
const chevronDown = createSvg({
|
|
3776
|
+
icon: ChevronDown,
|
|
3777
|
+
classes: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform motion-reduce:transition-none duration-200",
|
|
3778
|
+
attrs: {
|
|
3779
|
+
"aria-hidden": true,
|
|
3780
|
+
role: "presentation"
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3783
|
+
const button = document.createElement("button");
|
|
3784
|
+
button.setAttribute("type", "button");
|
|
3785
|
+
button.setAttribute("tabIndex", "0");
|
|
3786
|
+
button.setAttribute("data-slot", "exp-panel-trigger");
|
|
3787
|
+
button.classList.add(
|
|
3788
|
+
"cursor-pointer",
|
|
3789
|
+
"focus-visible:border-ring",
|
|
3790
|
+
"focus-visible:ring-ring/50",
|
|
3791
|
+
"flex",
|
|
3792
|
+
"flex-1",
|
|
3793
|
+
"items-center",
|
|
3794
|
+
"justify-between",
|
|
3795
|
+
"gap-4",
|
|
3796
|
+
"text-left",
|
|
3797
|
+
"text-sm",
|
|
3798
|
+
"font-medium",
|
|
3799
|
+
"transition-all",
|
|
3800
|
+
"motion-reduce:transition-none",
|
|
3801
|
+
"outline-none",
|
|
3802
|
+
"hover:underline",
|
|
3803
|
+
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
3804
|
+
"disabled:pointer-events-none",
|
|
3805
|
+
"disabled:opacity-50",
|
|
3806
|
+
"[&[aria-expanded=true]>svg]:rotate-180"
|
|
3807
|
+
);
|
|
3808
|
+
el.appendChild(button);
|
|
3809
|
+
effect(() => {
|
|
3810
|
+
getLabel((label) => {
|
|
3811
|
+
button.innerText = label;
|
|
3812
|
+
button.appendChild(chevronDown);
|
|
3813
|
+
});
|
|
3814
|
+
});
|
|
3815
|
+
button.setAttribute("id", expPanelItem._h_expPanelItem.id);
|
|
3816
|
+
button.setAttribute("aria-controls", expPanelItem._h_expPanelItem.controls);
|
|
3817
|
+
const setAttributes = () => {
|
|
3818
|
+
button.setAttribute("aria-expanded", expPanelItem._h_expPanelItem.expanded);
|
|
3819
|
+
};
|
|
3820
|
+
const handler = () => {
|
|
3821
|
+
expPanelItem._h_expPanelItem.expanded = !expPanelItem._h_expPanelItem.expanded;
|
|
3822
|
+
setAttributes();
|
|
3823
|
+
};
|
|
3824
|
+
setAttributes();
|
|
3825
|
+
el.addEventListener("click", handler);
|
|
3826
|
+
cleanup(() => {
|
|
3827
|
+
el.removeEventListener("click", handler);
|
|
3828
|
+
});
|
|
3829
|
+
});
|
|
3830
|
+
Alpine.directive("h-exp-panel-content", (el) => {
|
|
3831
|
+
el.classList.add("flex-1", "overflow-scroll");
|
|
3832
|
+
el.setAttribute("data-slot", "exp-panel-content");
|
|
3833
|
+
});
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3631
3836
|
// src/components/fieldset.js
|
|
3632
3837
|
function fieldset_default(Alpine) {
|
|
3633
3838
|
Alpine.directive("h-fieldset", (el) => {
|
|
@@ -3801,6 +4006,7 @@
|
|
|
3801
4006
|
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
3802
4007
|
"text-base",
|
|
3803
4008
|
"transition-[color,box-shadow]",
|
|
4009
|
+
"motion-reduce:transition-none",
|
|
3804
4010
|
"outline-none",
|
|
3805
4011
|
"file:inline-flex",
|
|
3806
4012
|
"file:h-7",
|
|
@@ -3858,6 +4064,7 @@
|
|
|
3858
4064
|
"border",
|
|
3859
4065
|
"shadow-input",
|
|
3860
4066
|
"transition-[color,box-shadow]",
|
|
4067
|
+
"motion-reduce:transition-none",
|
|
3861
4068
|
"outline-none",
|
|
3862
4069
|
"min-w-0",
|
|
3863
4070
|
"has-[>textarea]:h-auto",
|
|
@@ -3959,6 +4166,7 @@
|
|
|
3959
4166
|
"border",
|
|
3960
4167
|
"shadow-input",
|
|
3961
4168
|
"transition-[color,box-shadow]",
|
|
4169
|
+
"motion-reduce:transition-none",
|
|
3962
4170
|
"outline-none",
|
|
3963
4171
|
"min-w-0",
|
|
3964
4172
|
"has-[input:focus-visible]:border-ring",
|
|
@@ -4277,23 +4485,47 @@
|
|
|
4277
4485
|
el._menu_trigger = {
|
|
4278
4486
|
isDropdown: modifiers.includes("dropdown"),
|
|
4279
4487
|
setOpen(open) {
|
|
4280
|
-
el.setAttribute("
|
|
4488
|
+
el.setAttribute("aria-expanded", open);
|
|
4281
4489
|
}
|
|
4282
4490
|
};
|
|
4283
|
-
el.
|
|
4491
|
+
if (el._menu_trigger.isDropdown) {
|
|
4492
|
+
el.setAttribute("aria-haspopup", "true");
|
|
4493
|
+
el.setAttribute("aria-expanded", "false");
|
|
4494
|
+
if (!el.hasAttribute("id")) {
|
|
4495
|
+
el.setAttribute("id", `mt${uuid_default()}`);
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4284
4498
|
});
|
|
4285
4499
|
Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
4286
4500
|
if (el.tagName !== "UL") {
|
|
4287
4501
|
throw new Error(`${original2} must be an ul element`);
|
|
4288
4502
|
}
|
|
4289
|
-
el.classList.add(
|
|
4503
|
+
el.classList.add(
|
|
4504
|
+
"hidden",
|
|
4505
|
+
"fixed",
|
|
4506
|
+
"bg-popover",
|
|
4507
|
+
"text-popover-foreground",
|
|
4508
|
+
"font-normal",
|
|
4509
|
+
"z-50",
|
|
4510
|
+
"min-w-[8rem]",
|
|
4511
|
+
"overflow-x-hidden",
|
|
4512
|
+
"overflow-y-auto",
|
|
4513
|
+
"rounded-md",
|
|
4514
|
+
"p-1",
|
|
4515
|
+
"shadow-md",
|
|
4516
|
+
"border",
|
|
4517
|
+
"outline-none",
|
|
4518
|
+
"transition-[opacity,scale]",
|
|
4519
|
+
"motion-reduce:transition-none",
|
|
4520
|
+
"duration-100",
|
|
4521
|
+
"ease-out",
|
|
4522
|
+
"opacity-0",
|
|
4523
|
+
"scale-95"
|
|
4524
|
+
);
|
|
4290
4525
|
el.setAttribute("role", "menu");
|
|
4291
4526
|
el.setAttribute("aria-orientation", "vertical");
|
|
4292
4527
|
el.setAttribute("tabindex", "-1");
|
|
4293
4528
|
el.setAttribute("data-slot", "menu");
|
|
4294
|
-
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
4295
|
-
throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
4296
|
-
}
|
|
4297
4529
|
const isSubmenu = modifiers.includes("sub");
|
|
4298
4530
|
const menuTrigger = (() => {
|
|
4299
4531
|
if (isSubmenu) return;
|
|
@@ -4302,15 +4534,31 @@
|
|
|
4302
4534
|
sibling = sibling.previousElementSibling;
|
|
4303
4535
|
}
|
|
4304
4536
|
if (!sibling.hasOwnProperty("_menu_trigger")) {
|
|
4305
|
-
throw new Error(`${original2} must be placed after
|
|
4537
|
+
throw new Error(`${original2} menu must be placed after a menu trigger element`);
|
|
4306
4538
|
}
|
|
4307
4539
|
return sibling;
|
|
4308
4540
|
})();
|
|
4309
|
-
|
|
4310
|
-
|
|
4541
|
+
function setAriaAttrubutes(parent) {
|
|
4542
|
+
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
4543
|
+
if (parent && parent.hasAttribute("id")) {
|
|
4544
|
+
el.setAttribute("aria-labelledby", parent.id);
|
|
4545
|
+
} else {
|
|
4546
|
+
throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
4547
|
+
}
|
|
4548
|
+
}
|
|
4311
4549
|
}
|
|
4312
4550
|
let menuSubItem;
|
|
4313
|
-
if (isSubmenu)
|
|
4551
|
+
if (isSubmenu) {
|
|
4552
|
+
menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
|
|
4553
|
+
if (!menuSubItem) {
|
|
4554
|
+
throw new Error(`${original2} must be placed inside a ${Alpine2.prefixed("h-menu-sub")} element`);
|
|
4555
|
+
}
|
|
4556
|
+
setAriaAttrubutes(menuSubItem);
|
|
4557
|
+
} else if (menuTrigger) {
|
|
4558
|
+
setAriaAttrubutes(menuTrigger._menu_trigger.isDropdown ? menuTrigger : void 0);
|
|
4559
|
+
} else {
|
|
4560
|
+
setAriaAttrubutes();
|
|
4561
|
+
}
|
|
4314
4562
|
function listenForTrigger(listen) {
|
|
4315
4563
|
if (listen) {
|
|
4316
4564
|
if (menuTrigger._menu_trigger.isDropdown) menuTrigger.addEventListener("click", openDropdown);
|
|
@@ -4322,11 +4570,15 @@
|
|
|
4322
4570
|
}
|
|
4323
4571
|
function close(closeParent = false, focusTrigger = false) {
|
|
4324
4572
|
el.pauseKeyEvents = false;
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4573
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
4574
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
4575
|
+
Object.assign(el.style, {
|
|
4576
|
+
left: "0px",
|
|
4577
|
+
top: "0px"
|
|
4578
|
+
});
|
|
4579
|
+
} else {
|
|
4580
|
+
el.classList.add("scale-95", "opacity-0");
|
|
4581
|
+
}
|
|
4330
4582
|
top.removeEventListener("contextmenu", onClick);
|
|
4331
4583
|
top.removeEventListener("click", onClick);
|
|
4332
4584
|
el.removeEventListener("keydown", onKeyDown);
|
|
@@ -4486,6 +4738,7 @@
|
|
|
4486
4738
|
left: `${x}px`,
|
|
4487
4739
|
top: `${y}px`
|
|
4488
4740
|
});
|
|
4741
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
4489
4742
|
});
|
|
4490
4743
|
}
|
|
4491
4744
|
}
|
|
@@ -4519,11 +4772,22 @@
|
|
|
4519
4772
|
} else {
|
|
4520
4773
|
listenForTrigger(true);
|
|
4521
4774
|
}
|
|
4775
|
+
function onTransitionEnd(event) {
|
|
4776
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
4777
|
+
el.classList.add("hidden");
|
|
4778
|
+
Object.assign(el.style, {
|
|
4779
|
+
left: "0px",
|
|
4780
|
+
top: "0px"
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
4522
4785
|
cleanup(() => {
|
|
4523
4786
|
if (menuTrigger) listenForTrigger(false);
|
|
4524
4787
|
top.removeEventListener("click", onClick);
|
|
4525
4788
|
top.removeEventListener("contextmenu", onClick);
|
|
4526
4789
|
el.removeEventListener("keydown", onKeyDown);
|
|
4790
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
4527
4791
|
});
|
|
4528
4792
|
});
|
|
4529
4793
|
Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
@@ -4615,6 +4879,9 @@
|
|
|
4615
4879
|
el.appendChild(chevronRight);
|
|
4616
4880
|
const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
|
|
4617
4881
|
if (!parentMenu) throw new Error(`${original2} must have a parent`);
|
|
4882
|
+
if (!el.hasAttribute("id")) {
|
|
4883
|
+
el.setAttribute("id", `ms${uuid_default()}`);
|
|
4884
|
+
}
|
|
4618
4885
|
el._menu_sub = {
|
|
4619
4886
|
open: void 0,
|
|
4620
4887
|
close: void 0,
|
|
@@ -4730,6 +4997,7 @@
|
|
|
4730
4997
|
"aria-[disabled=true]:cursor-not-allowed",
|
|
4731
4998
|
"aria-[disabled=true]:opacity-50",
|
|
4732
4999
|
"transition-all",
|
|
5000
|
+
"motion-reduce:transition-none",
|
|
4733
5001
|
"overflow-hidden",
|
|
4734
5002
|
"aria-[checked=true]:[&>svg]:visible"
|
|
4735
5003
|
);
|
|
@@ -4799,6 +5067,7 @@
|
|
|
4799
5067
|
"aria-[disabled=true]:cursor-not-allowed",
|
|
4800
5068
|
"aria-[disabled=true]:opacity-50",
|
|
4801
5069
|
"transition-all",
|
|
5070
|
+
"motion-reduce:transition-none",
|
|
4802
5071
|
"overflow-hidden",
|
|
4803
5072
|
"before:invisible",
|
|
4804
5073
|
"before:bg-foreground",
|
|
@@ -5004,7 +5273,7 @@
|
|
|
5004
5273
|
const listener = {
|
|
5005
5274
|
added(item) {
|
|
5006
5275
|
const clone = notificationTemplates[item.template].content.firstElementChild.cloneNode(true);
|
|
5007
|
-
clone.classList.add("transform", "transition-all", "duration-300", "ease-out", "opacity-0");
|
|
5276
|
+
clone.classList.add("transform", "transition-all", "motion-reduce:transition-none", "duration-300", "ease-out", "opacity-0");
|
|
5008
5277
|
clone.setAttribute("id", item.id);
|
|
5009
5278
|
Alpine2.addScopeToNode(clone, item.data);
|
|
5010
5279
|
if (!isExtraLarge && !isLarge) {
|
|
@@ -5059,15 +5328,20 @@
|
|
|
5059
5328
|
removed(id) {
|
|
5060
5329
|
const element = el.querySelector(`#${id}`);
|
|
5061
5330
|
if (element) {
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
()
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5331
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
5332
|
+
Alpine2.destroyTree(element);
|
|
5333
|
+
element.remove();
|
|
5334
|
+
} else {
|
|
5335
|
+
element.addEventListener(
|
|
5336
|
+
"transitionend",
|
|
5337
|
+
() => {
|
|
5338
|
+
Alpine2.destroyTree(element);
|
|
5339
|
+
element.remove();
|
|
5340
|
+
},
|
|
5341
|
+
{ once: true }
|
|
5342
|
+
);
|
|
5343
|
+
element.classList.add(element._h_animation_class, "opacity-0");
|
|
5344
|
+
}
|
|
5071
5345
|
}
|
|
5072
5346
|
}
|
|
5073
5347
|
};
|
|
@@ -5177,6 +5451,7 @@
|
|
|
5177
5451
|
"text-sm",
|
|
5178
5452
|
"font-medium",
|
|
5179
5453
|
"transition-all",
|
|
5454
|
+
"motion-reduce:transition-none",
|
|
5180
5455
|
"disabled:pointer-events-none",
|
|
5181
5456
|
"disabled:opacity-50",
|
|
5182
5457
|
"[&_svg]:pointer-events-none",
|
|
@@ -5251,7 +5526,7 @@
|
|
|
5251
5526
|
}
|
|
5252
5527
|
el.setAttribute("type", "button");
|
|
5253
5528
|
if (modifiers.includes("chevron")) {
|
|
5254
|
-
el.classList.add("[&_svg]:transition-transform", "[&[
|
|
5529
|
+
el.classList.add("[&_svg]:transition-transform", "motion-reduce:[&_svg]:transition-none", "[&[aria-expanded=true]>svg:not(:first-child):last-child]:rotate-180");
|
|
5255
5530
|
}
|
|
5256
5531
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "popover-trigger");
|
|
5257
5532
|
if (el.hasAttribute("id")) {
|
|
@@ -5263,7 +5538,6 @@
|
|
|
5263
5538
|
el.setAttribute("aria-controls", el._popover.controls);
|
|
5264
5539
|
el.setAttribute("aria-haspopup", "dialog");
|
|
5265
5540
|
const setAttributes = () => {
|
|
5266
|
-
el.setAttribute("data-state", el._popover.expanded ? "open" : "closed");
|
|
5267
5541
|
el.setAttribute("aria-expanded", el._popover.expanded);
|
|
5268
5542
|
};
|
|
5269
5543
|
const close = () => {
|
|
@@ -5305,13 +5579,32 @@
|
|
|
5305
5579
|
if (!popover) {
|
|
5306
5580
|
throw new Error(`${original2} must be placed after a popover element`);
|
|
5307
5581
|
}
|
|
5308
|
-
el.classList.add(
|
|
5582
|
+
el.classList.add(
|
|
5583
|
+
"absolute",
|
|
5584
|
+
"bg-popover",
|
|
5585
|
+
"text-popover-foreground",
|
|
5586
|
+
"hidden",
|
|
5587
|
+
"top-0",
|
|
5588
|
+
"left-0",
|
|
5589
|
+
"z-50",
|
|
5590
|
+
"min-w-[1rem]",
|
|
5591
|
+
"rounded-md",
|
|
5592
|
+
"border",
|
|
5593
|
+
"shadow-md",
|
|
5594
|
+
"outline-hidden",
|
|
5595
|
+
"overflow-auto",
|
|
5596
|
+
"transition-[opacity,scale]",
|
|
5597
|
+
"motion-reduce:transition-none",
|
|
5598
|
+
"duration-100",
|
|
5599
|
+
"ease-out",
|
|
5600
|
+
"opacity-0",
|
|
5601
|
+
"scale-95"
|
|
5602
|
+
);
|
|
5309
5603
|
el.setAttribute("data-slot", "popover");
|
|
5310
5604
|
el.setAttribute("role", "dialog");
|
|
5311
5605
|
el.setAttribute("tabindex", "-1");
|
|
5312
5606
|
el.setAttribute("id", popover._popover.controls);
|
|
5313
5607
|
el.setAttribute("aria-labelledby", popover._popover.id);
|
|
5314
|
-
el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
|
|
5315
5608
|
let noScroll = modifiers.includes("no-scroll");
|
|
5316
5609
|
if (noScroll) {
|
|
5317
5610
|
el.classList.remove("overflow-auto");
|
|
@@ -5345,22 +5638,39 @@
|
|
|
5345
5638
|
left: `${x}px`,
|
|
5346
5639
|
top: `${y}px`
|
|
5347
5640
|
});
|
|
5641
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
5348
5642
|
});
|
|
5349
5643
|
}
|
|
5350
5644
|
effect(() => {
|
|
5351
|
-
el.setAttribute("data-state", popover._popover.expanded ? "open" : "closed");
|
|
5352
5645
|
if (popover._popover.expanded) {
|
|
5646
|
+
el.classList.remove("hidden");
|
|
5353
5647
|
autoUpdateCleanup = autoUpdate(popover, el, updatePosition);
|
|
5354
5648
|
} else {
|
|
5649
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
5650
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
5651
|
+
Object.assign(el.style, {
|
|
5652
|
+
left: "0px",
|
|
5653
|
+
top: "0px"
|
|
5654
|
+
});
|
|
5655
|
+
} else {
|
|
5656
|
+
el.classList.add("scale-95", "opacity-0");
|
|
5657
|
+
}
|
|
5355
5658
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
5659
|
+
}
|
|
5660
|
+
});
|
|
5661
|
+
function onTransitionEnd(event) {
|
|
5662
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
5663
|
+
el.classList.add("hidden");
|
|
5356
5664
|
Object.assign(el.style, {
|
|
5357
5665
|
left: "0px",
|
|
5358
5666
|
top: "0px"
|
|
5359
5667
|
});
|
|
5360
5668
|
}
|
|
5361
|
-
}
|
|
5669
|
+
}
|
|
5670
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
5362
5671
|
cleanup(() => {
|
|
5363
5672
|
el.removeEventListener("click", stopPropagation);
|
|
5673
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
5364
5674
|
});
|
|
5365
5675
|
});
|
|
5366
5676
|
}
|
|
@@ -5371,7 +5681,7 @@
|
|
|
5371
5681
|
el.classList.add("bg-secondary", "relative", "h-2", "w-full", "overflow-hidden", "rounded-full");
|
|
5372
5682
|
el.setAttribute("data-slot", "progress");
|
|
5373
5683
|
const indicator = document.createElement("div");
|
|
5374
|
-
indicator.classList.add("bg-primary", "h-full", "w-full", "flex-1", "transition-all", "rounded-full");
|
|
5684
|
+
indicator.classList.add("bg-primary", "h-full", "w-full", "flex-1", "transition-all", "motion-reduce:transition-none", "rounded-full");
|
|
5375
5685
|
indicator.setAttribute("data-slot", "progress-indicator");
|
|
5376
5686
|
Object.assign(indicator.style, {
|
|
5377
5687
|
transform: `translateX(-${100 - 0}%)`
|
|
@@ -7342,7 +7652,7 @@
|
|
|
7342
7652
|
set: void 0,
|
|
7343
7653
|
get: void 0
|
|
7344
7654
|
};
|
|
7345
|
-
el.classList.add("cursor-pointer", "outline-none", "transition-[color,box-shadow]", "duration-200", "w-full", "has-[input:disabled]:pointer-events-none", "has-[input:disabled]:opacity-50");
|
|
7655
|
+
el.classList.add("cursor-pointer", "outline-none", "transition-[color,box-shadow]", "motion-reduce:transition-none", "duration-200", "w-full", "has-[input:disabled]:pointer-events-none", "has-[input:disabled]:opacity-50");
|
|
7346
7656
|
if (modifiers.includes("table")) {
|
|
7347
7657
|
el.classList.add("h-10", "flex", "focus-visible:inset-ring-ring/50", "focus-visible:inset-ring-2", "hover:bg-table-hover", "hover:text-table-hover-foreground", "active:!bg-table-active", "active:!text-table-active-foreground");
|
|
7348
7658
|
el.setAttribute("data-slot", "cell-input-select");
|
|
@@ -7425,7 +7735,7 @@
|
|
|
7425
7735
|
fakeTrigger.appendChild(displayValue);
|
|
7426
7736
|
fakeTrigger.setAttribute("data-slot", "select-value");
|
|
7427
7737
|
fakeTrigger.setAttribute("tabindex", "0");
|
|
7428
|
-
fakeTrigger.classList.add("flex", "items-center", "justify-between", "gap-2", "outline-none", "pl-3", "pr-2", "size-full", "[&[
|
|
7738
|
+
fakeTrigger.classList.add("flex", "items-center", "justify-between", "gap-2", "outline-none", "pl-3", "pr-2", "size-full", "[&[aria-expanded=true]>svg]:rotate-180");
|
|
7429
7739
|
select._h_select.trigger = fakeTrigger;
|
|
7430
7740
|
let labelObserver;
|
|
7431
7741
|
if (label) {
|
|
@@ -7472,7 +7782,6 @@
|
|
|
7472
7782
|
fakeTrigger.setAttribute("aria-autocomplete", "none");
|
|
7473
7783
|
fakeTrigger.setAttribute("role", "combobox");
|
|
7474
7784
|
effect(() => {
|
|
7475
|
-
fakeTrigger.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
7476
7785
|
fakeTrigger.setAttribute("aria-expanded", select._h_select.expanded);
|
|
7477
7786
|
});
|
|
7478
7787
|
const close = (focusSelect = false) => {
|
|
@@ -7617,7 +7926,7 @@
|
|
|
7617
7926
|
fakeTrigger.addEventListener("click", onClick);
|
|
7618
7927
|
const chevronDown = createSvg({
|
|
7619
7928
|
icon: ChevronDown,
|
|
7620
|
-
classes: "opacity-70 text-foreground size-4 shrink-0 pointer-events-none transition-transform duration-200",
|
|
7929
|
+
classes: "opacity-70 text-foreground size-4 shrink-0 pointer-events-none transition-transform motion-reduce:transition-none duration-200",
|
|
7621
7930
|
attrs: {
|
|
7622
7931
|
"aria-hidden": true,
|
|
7623
7932
|
role: "presentation"
|
|
@@ -7648,17 +7957,37 @@
|
|
|
7648
7957
|
}
|
|
7649
7958
|
});
|
|
7650
7959
|
});
|
|
7651
|
-
Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
7960
|
+
Alpine.directive("h-select-content", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7652
7961
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
7653
7962
|
if (!select) {
|
|
7654
7963
|
throw new Error(`${original2} must be inside a select element`);
|
|
7655
7964
|
}
|
|
7656
|
-
el.classList.add(
|
|
7965
|
+
el.classList.add(
|
|
7966
|
+
"absolute",
|
|
7967
|
+
"bg-popover",
|
|
7968
|
+
"text-popover-foreground",
|
|
7969
|
+
"hidden",
|
|
7970
|
+
"p-1",
|
|
7971
|
+
"top-0",
|
|
7972
|
+
"left-0",
|
|
7973
|
+
"z-50",
|
|
7974
|
+
"min-w-[1rem]",
|
|
7975
|
+
"overflow-x-hidden",
|
|
7976
|
+
"overflow-y-auto",
|
|
7977
|
+
"rounded-md",
|
|
7978
|
+
"border",
|
|
7979
|
+
"shadow-md",
|
|
7980
|
+
"transition-[opacity,scale]",
|
|
7981
|
+
"motion-reduce:transition-none",
|
|
7982
|
+
"duration-100",
|
|
7983
|
+
"ease-out",
|
|
7984
|
+
"opacity-0",
|
|
7985
|
+
"scale-95"
|
|
7986
|
+
);
|
|
7657
7987
|
el.setAttribute("data-slot", "select-content");
|
|
7658
7988
|
el.setAttribute("role", "listbox");
|
|
7659
7989
|
el.setAttribute("id", select._h_select.controls);
|
|
7660
7990
|
el.setAttribute("tabindex", "-1");
|
|
7661
|
-
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
7662
7991
|
if (!select._h_select.trigger) {
|
|
7663
7992
|
throw new Error(`${original2}: trigger not found`);
|
|
7664
7993
|
}
|
|
@@ -7684,22 +8013,41 @@
|
|
|
7684
8013
|
left: `${x}px`,
|
|
7685
8014
|
top: `${y}px`
|
|
7686
8015
|
});
|
|
8016
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
7687
8017
|
});
|
|
7688
8018
|
}
|
|
7689
8019
|
effect(() => {
|
|
7690
8020
|
el.setAttribute("aria-labelledby", select._h_select.fieldLabelId);
|
|
7691
8021
|
});
|
|
7692
8022
|
effect(() => {
|
|
7693
|
-
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
7694
8023
|
if (select._h_select.expanded) {
|
|
8024
|
+
el.classList.remove("hidden");
|
|
7695
8025
|
autoUpdateCleanup = autoUpdate(select._h_select.trigger, el, updatePosition);
|
|
7696
8026
|
} else {
|
|
8027
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
8028
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
8029
|
+
Object.assign(el.style, {
|
|
8030
|
+
left: "0px",
|
|
8031
|
+
top: "0px"
|
|
8032
|
+
});
|
|
8033
|
+
} else {
|
|
8034
|
+
el.classList.add("scale-95", "opacity-0");
|
|
8035
|
+
}
|
|
7697
8036
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
8037
|
+
}
|
|
8038
|
+
});
|
|
8039
|
+
function onTransitionEnd(event) {
|
|
8040
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
8041
|
+
el.classList.add("hidden");
|
|
7698
8042
|
Object.assign(el.style, {
|
|
7699
8043
|
left: "0px",
|
|
7700
8044
|
top: "0px"
|
|
7701
8045
|
});
|
|
7702
8046
|
}
|
|
8047
|
+
}
|
|
8048
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
8049
|
+
cleanup(() => {
|
|
8050
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
7703
8051
|
});
|
|
7704
8052
|
});
|
|
7705
8053
|
Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
@@ -7927,16 +8275,43 @@
|
|
|
7927
8275
|
// src/components/sheet.js
|
|
7928
8276
|
function sheet_default(Alpine) {
|
|
7929
8277
|
Alpine.directive("h-sheet-overlay", (el, { expression }, { effect, evaluate: evaluate2, evaluateLater, cleanup }) => {
|
|
7930
|
-
el.
|
|
8278
|
+
el._h_sheet_overlay = {
|
|
8279
|
+
showSheet: void 0,
|
|
8280
|
+
hideSheet: void 0,
|
|
8281
|
+
state: Alpine.reactive({
|
|
8282
|
+
open: evaluate2(expression || "false")
|
|
8283
|
+
})
|
|
8284
|
+
};
|
|
8285
|
+
el.classList.add("hidden", "fixed", "inset-0", "z-50", "bg-black/50", "transition-opacity", "motion-reduce:transition-none", "duration-200", "ease-out", "opacity-0");
|
|
7931
8286
|
el.setAttribute("tabindex", "-1");
|
|
7932
8287
|
el.setAttribute("data-slot", "sheet-overlay");
|
|
7933
|
-
el.setAttribute("data-open", evaluate2(expression));
|
|
7934
8288
|
const getIsOpen = evaluateLater(expression);
|
|
7935
8289
|
effect(() => {
|
|
7936
8290
|
getIsOpen((isOpen) => {
|
|
7937
|
-
el.
|
|
8291
|
+
el._h_sheet_overlay.state.open = isOpen;
|
|
7938
8292
|
});
|
|
7939
8293
|
});
|
|
8294
|
+
effect(() => {
|
|
8295
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
8296
|
+
if (el._h_sheet_overlay.state.open) {
|
|
8297
|
+
el.classList.remove("hidden", "opacity-0");
|
|
8298
|
+
} else {
|
|
8299
|
+
el.classList.add("hidden", "opacity-0");
|
|
8300
|
+
}
|
|
8301
|
+
} else if (el._h_sheet_overlay.state.open) {
|
|
8302
|
+
el.classList.remove("hidden");
|
|
8303
|
+
el.offsetHeight;
|
|
8304
|
+
el.classList.remove("opacity-0");
|
|
8305
|
+
} else {
|
|
8306
|
+
el.classList.add("opacity-0");
|
|
8307
|
+
}
|
|
8308
|
+
});
|
|
8309
|
+
function onTransitionEnd(event) {
|
|
8310
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
8311
|
+
el.classList.add("hidden");
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
7940
8315
|
const onClick = (event) => {
|
|
7941
8316
|
if (event.target.getAttribute("data-slot") === "sheet-overlay") {
|
|
7942
8317
|
evaluate2(`${expression} = false`);
|
|
@@ -7945,12 +8320,29 @@
|
|
|
7945
8320
|
el.addEventListener("click", onClick);
|
|
7946
8321
|
cleanup(() => {
|
|
7947
8322
|
el.removeEventListener("click", onClick);
|
|
8323
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
7948
8324
|
});
|
|
7949
8325
|
});
|
|
7950
|
-
Alpine.directive("h-sheet", (el,
|
|
7951
|
-
el.
|
|
8326
|
+
Alpine.directive("h-sheet", (el, { original: original2 }, { effect, cleanup }) => {
|
|
8327
|
+
const overlay = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sheet_overlay"));
|
|
8328
|
+
if (!overlay) {
|
|
8329
|
+
throw new Error(`${original2} must be placed inside a sheet overlay`);
|
|
8330
|
+
}
|
|
8331
|
+
el.classList.add("hidden", "bg-background", "fixed", "shadow-lg", "transform", "transition-all", "motion-reduce:transition-none", "duration-200", "ease-out");
|
|
7952
8332
|
el.setAttribute("data-slot", "sheet");
|
|
7953
8333
|
let lastSide;
|
|
8334
|
+
const getTranslateClass = (side) => {
|
|
8335
|
+
switch (side) {
|
|
8336
|
+
case "top":
|
|
8337
|
+
return "-translate-y-full";
|
|
8338
|
+
case "right":
|
|
8339
|
+
return "translate-x-full";
|
|
8340
|
+
case "left":
|
|
8341
|
+
return "-translate-x-full";
|
|
8342
|
+
default:
|
|
8343
|
+
return "translate-y-full";
|
|
8344
|
+
}
|
|
8345
|
+
};
|
|
7954
8346
|
const getSideClasses = (side) => {
|
|
7955
8347
|
switch (side) {
|
|
7956
8348
|
case "top":
|
|
@@ -7972,9 +8364,32 @@
|
|
|
7972
8364
|
setSide(el.getAttribute("data-align"));
|
|
7973
8365
|
});
|
|
7974
8366
|
setSide(el.getAttribute("data-align"));
|
|
8367
|
+
el.classList.add(getTranslateClass(lastSide));
|
|
8368
|
+
function onTransitionEnd(event) {
|
|
8369
|
+
if (event.target === el && event.target.classList.contains(getTranslateClass(lastSide))) {
|
|
8370
|
+
el.classList.add("hidden");
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
8374
|
+
effect(() => {
|
|
8375
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
8376
|
+
if (overlay._h_sheet_overlay.state.open) {
|
|
8377
|
+
el.classList.remove("hidden", getTranslateClass(lastSide));
|
|
8378
|
+
} else {
|
|
8379
|
+
el.classList.add("hidden", getTranslateClass(lastSide));
|
|
8380
|
+
}
|
|
8381
|
+
} else if (overlay._h_sheet_overlay.state.open) {
|
|
8382
|
+
el.classList.remove("hidden");
|
|
8383
|
+
el.offsetHeight;
|
|
8384
|
+
el.classList.remove(getTranslateClass(lastSide));
|
|
8385
|
+
} else {
|
|
8386
|
+
el.classList.add(getTranslateClass(lastSide));
|
|
8387
|
+
}
|
|
8388
|
+
});
|
|
7975
8389
|
observer.observe(el, { attributes: true, attributeFilter: ["data-align"] });
|
|
7976
8390
|
cleanup(() => {
|
|
7977
8391
|
observer.disconnect();
|
|
8392
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
7978
8393
|
});
|
|
7979
8394
|
});
|
|
7980
8395
|
}
|
|
@@ -8050,6 +8465,7 @@
|
|
|
8050
8465
|
"font-medium",
|
|
8051
8466
|
"outline-hidden",
|
|
8052
8467
|
"transition-[margin,opacity]",
|
|
8468
|
+
"motion-reduce:transition-none",
|
|
8053
8469
|
"duration-200",
|
|
8054
8470
|
"ease-linear",
|
|
8055
8471
|
"focus-visible:ring-2",
|
|
@@ -8076,7 +8492,7 @@
|
|
|
8076
8492
|
el.appendChild(
|
|
8077
8493
|
createSvg({
|
|
8078
8494
|
icon: ChevronRight,
|
|
8079
|
-
classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
|
|
8495
|
+
classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform motion-reduce:transition-none duration-200 [[aria-expanded=true]>&]:rotate-90",
|
|
8080
8496
|
attrs: {
|
|
8081
8497
|
"aria-hidden": true,
|
|
8082
8498
|
role: "presentation"
|
|
@@ -8109,6 +8525,7 @@
|
|
|
8109
8525
|
"p-0",
|
|
8110
8526
|
"outline-hidden",
|
|
8111
8527
|
"transition-transform",
|
|
8528
|
+
"motion-reduce:transition-none",
|
|
8112
8529
|
"focus-visible:ring-2",
|
|
8113
8530
|
"[&>svg]:size-4",
|
|
8114
8531
|
"[&>svg]:shrink-0",
|
|
@@ -8241,10 +8658,11 @@
|
|
|
8241
8658
|
"text-sm",
|
|
8242
8659
|
"duration-200",
|
|
8243
8660
|
"transition-[width,height,padding]",
|
|
8661
|
+
"motion-reduce:transition-none",
|
|
8244
8662
|
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
8245
8663
|
"data-[active=true]:font-medium",
|
|
8246
|
-
"
|
|
8247
|
-
"
|
|
8664
|
+
"aria-[expanded=true]:hover:bg-sidebar-secondary",
|
|
8665
|
+
"aria-[expanded=true]:hover:text-sidebar-secondary-foreground",
|
|
8248
8666
|
"group-data-[collapsed=true]/sidebar:!size-8",
|
|
8249
8667
|
"group-data-[collapsed=true]/sidebar:!p-2",
|
|
8250
8668
|
"group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden"
|
|
@@ -8267,7 +8685,7 @@
|
|
|
8267
8685
|
el.appendChild(
|
|
8268
8686
|
createSvg({
|
|
8269
8687
|
icon: ChevronRight,
|
|
8270
|
-
classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
|
|
8688
|
+
classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform motion-reduce:transition-none duration-200 [[aria-expanded=true]>&]:rotate-90",
|
|
8271
8689
|
attrs: {
|
|
8272
8690
|
"aria-hidden": true,
|
|
8273
8691
|
role: "presentation"
|
|
@@ -8305,6 +8723,7 @@
|
|
|
8305
8723
|
"p-0",
|
|
8306
8724
|
"outline-hidden",
|
|
8307
8725
|
"transition-transform",
|
|
8726
|
+
"motion-reduce:transition-none",
|
|
8308
8727
|
"focus-visible:ring-2",
|
|
8309
8728
|
"[&>svg]:size-4",
|
|
8310
8729
|
"[&>svg]:shrink-0",
|
|
@@ -8314,7 +8733,7 @@
|
|
|
8314
8733
|
"group-data-[collapsed=true]/sidebar:hidden"
|
|
8315
8734
|
);
|
|
8316
8735
|
if (modifiers.includes("autohide")) {
|
|
8317
|
-
el.classList.add("group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "
|
|
8736
|
+
el.classList.add("group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "aria-[expanded=true]:opacity-100", "md:opacity-0");
|
|
8318
8737
|
}
|
|
8319
8738
|
if (el.tagName !== "BUTTON") {
|
|
8320
8739
|
el.setAttribute("role", "button");
|
|
@@ -8953,6 +9372,7 @@
|
|
|
8953
9372
|
"before:h-full",
|
|
8954
9373
|
"before:aspect-square",
|
|
8955
9374
|
"before:transition-transform",
|
|
9375
|
+
"before:motion-reduce:transition-none",
|
|
8956
9376
|
"bg-muted",
|
|
8957
9377
|
"border",
|
|
8958
9378
|
"data-[size=sm]:h-5",
|
|
@@ -8971,7 +9391,8 @@
|
|
|
8971
9391
|
"relative",
|
|
8972
9392
|
"rounded-full",
|
|
8973
9393
|
"shrink-0",
|
|
8974
|
-
"transition-
|
|
9394
|
+
"transition-colors",
|
|
9395
|
+
"motion-reduce:transition-none"
|
|
8975
9396
|
);
|
|
8976
9397
|
el.setAttribute("tabindex", "-1");
|
|
8977
9398
|
el.setAttribute("data-slot", "switch");
|
|
@@ -9075,10 +9496,12 @@
|
|
|
9075
9496
|
"outline-none",
|
|
9076
9497
|
"gap-2",
|
|
9077
9498
|
"transition-[color,box-shadow]",
|
|
9499
|
+
"motion-reduce:transition-none",
|
|
9078
9500
|
"[&_svg]:pointer-events-none",
|
|
9079
9501
|
"[&_svg]:opacity-70",
|
|
9080
9502
|
"[&_svg]:text-foreground",
|
|
9081
9503
|
"[&_svg]:transition-transform",
|
|
9504
|
+
"motion-reduce:[&_svg]:transition-none",
|
|
9082
9505
|
"[&_svg]:duration-200",
|
|
9083
9506
|
"[&_svg:not([class*='size-'])]:size-4",
|
|
9084
9507
|
"shrink-0",
|
|
@@ -9199,6 +9622,7 @@
|
|
|
9199
9622
|
"font-medium",
|
|
9200
9623
|
"whitespace-nowrap",
|
|
9201
9624
|
"transition-[color,box-shadow]",
|
|
9625
|
+
"motion-reduce:transition-none",
|
|
9202
9626
|
"group-data-[floating=true]/tab-bar:rounded-md",
|
|
9203
9627
|
"group-data-[floating=true]/tab-bar:border",
|
|
9204
9628
|
"group-data-[floating=true]/tab-bar:border-transparent",
|
|
@@ -9380,6 +9804,7 @@
|
|
|
9380
9804
|
"text-base",
|
|
9381
9805
|
"shadow-input",
|
|
9382
9806
|
"transition-[color,box-shadow]",
|
|
9807
|
+
"motion-reduce:transition-none",
|
|
9383
9808
|
"outline-none",
|
|
9384
9809
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
9385
9810
|
"disabled:cursor-not-allowed",
|
|
@@ -9413,9 +9838,11 @@
|
|
|
9413
9838
|
"text-sm",
|
|
9414
9839
|
"rounded-lg",
|
|
9415
9840
|
"transition-colors",
|
|
9841
|
+
"motion-reduce:transition-none",
|
|
9416
9842
|
"[a]:hover:bg-secondary-hover",
|
|
9417
9843
|
"[a]:hover:text-secondary-foreground",
|
|
9418
9844
|
"[a]:transition-colors",
|
|
9845
|
+
"[a]:motion-reduce:transition-none",
|
|
9419
9846
|
"duration-100",
|
|
9420
9847
|
"flex-wrap",
|
|
9421
9848
|
"outline-none",
|
|
@@ -9570,6 +9997,7 @@
|
|
|
9570
9997
|
"text-sm",
|
|
9571
9998
|
"whitespace-nowrap",
|
|
9572
9999
|
"transition-[color,box-shadow]",
|
|
10000
|
+
"motion-reduce:transition-none",
|
|
9573
10001
|
"duration-200",
|
|
9574
10002
|
"outline-none",
|
|
9575
10003
|
"has-[input:disabled]:pointer-events-none",
|
|
@@ -9754,7 +10182,6 @@
|
|
|
9754
10182
|
el.addEventListener("beforeinput", preventInput);
|
|
9755
10183
|
el.addEventListener("paste", preventInput);
|
|
9756
10184
|
effect(() => {
|
|
9757
|
-
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
9758
10185
|
el.setAttribute("aria-expanded", timepicker._h_timepicker.expanded);
|
|
9759
10186
|
});
|
|
9760
10187
|
cleanup(() => {
|
|
@@ -9772,11 +10199,17 @@
|
|
|
9772
10199
|
"absolute",
|
|
9773
10200
|
"bg-popover",
|
|
9774
10201
|
"text-popover-foreground",
|
|
9775
|
-
"
|
|
9776
|
-
"
|
|
9777
|
-
"
|
|
10202
|
+
"flex",
|
|
10203
|
+
"flex-col",
|
|
10204
|
+
"hidden",
|
|
9778
10205
|
"z-50",
|
|
9779
|
-
"shadow-md"
|
|
10206
|
+
"shadow-md",
|
|
10207
|
+
"transition-[opacity,scale]",
|
|
10208
|
+
"motion-reduce:transition-none",
|
|
10209
|
+
"duration-100",
|
|
10210
|
+
"ease-out",
|
|
10211
|
+
"opacity-0",
|
|
10212
|
+
"scale-95"
|
|
9780
10213
|
);
|
|
9781
10214
|
el.setAttribute("id", timepicker._h_timepicker.controls);
|
|
9782
10215
|
el.setAttribute("tabindex", "-1");
|
|
@@ -9784,7 +10217,6 @@
|
|
|
9784
10217
|
el.setAttribute("aria-modal", "true");
|
|
9785
10218
|
el.setAttribute("data-slot", "time-picker-popup");
|
|
9786
10219
|
el.setAttribute("aria-labelledby", timepicker._h_timepicker.id);
|
|
9787
|
-
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
9788
10220
|
const optionClasses = [
|
|
9789
10221
|
"px-3.5",
|
|
9790
10222
|
"py-2",
|
|
@@ -10194,6 +10626,7 @@
|
|
|
10194
10626
|
left: `${x}px`,
|
|
10195
10627
|
top: `${y}px`
|
|
10196
10628
|
});
|
|
10629
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
10197
10630
|
if (focusFirstItem) {
|
|
10198
10631
|
focusFirstItem = false;
|
|
10199
10632
|
Alpine2.nextTick(() => {
|
|
@@ -10207,25 +10640,41 @@
|
|
|
10207
10640
|
});
|
|
10208
10641
|
}
|
|
10209
10642
|
effect(() => {
|
|
10210
|
-
el.setAttribute("data-state", timepicker._h_timepicker.expanded ? "open" : "closed");
|
|
10211
10643
|
if (timepicker._h_timepicker.expanded) {
|
|
10212
10644
|
render();
|
|
10645
|
+
el.classList.remove("hidden");
|
|
10213
10646
|
autoUpdateCleanup = autoUpdate(timepicker, el, updatePosition);
|
|
10214
10647
|
if (selectedHour) scrollIntoCenter(selectedHour.parentElement, selectedHour);
|
|
10215
10648
|
if (selectedMinute) scrollIntoCenter(selectedMinute.parentElement, selectedMinute);
|
|
10216
10649
|
if (selectedSecond && timepicker._h_timepicker.seconds) scrollIntoCenter(selectedSecond.parentElement, selectedSecond);
|
|
10217
10650
|
} else {
|
|
10651
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
10652
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
10653
|
+
Object.assign(el.style, {
|
|
10654
|
+
left: "0px",
|
|
10655
|
+
top: "0px"
|
|
10656
|
+
});
|
|
10657
|
+
} else {
|
|
10658
|
+
el.classList.add("scale-95", "opacity-0");
|
|
10659
|
+
}
|
|
10218
10660
|
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
10219
10661
|
focusFirstItem = true;
|
|
10662
|
+
}
|
|
10663
|
+
});
|
|
10664
|
+
function onTransitionEnd(event) {
|
|
10665
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
10666
|
+
el.classList.add("hidden");
|
|
10220
10667
|
Object.assign(el.style, {
|
|
10221
10668
|
left: "0px",
|
|
10222
10669
|
top: "0px"
|
|
10223
10670
|
});
|
|
10224
10671
|
}
|
|
10225
|
-
}
|
|
10672
|
+
}
|
|
10673
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
10226
10674
|
cleanup(() => {
|
|
10227
10675
|
el.removeEventListener("keydown", onKeyDown);
|
|
10228
10676
|
el.removeEventListener("click", onClick);
|
|
10677
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
10229
10678
|
okButton.removeEventListener("click", timepicker._h_timepicker.close);
|
|
10230
10679
|
nowButton.removeEventListener("click", getCurrentTime);
|
|
10231
10680
|
timeContainer.removeEventListener("click", setTime);
|
|
@@ -10320,7 +10769,7 @@
|
|
|
10320
10769
|
el.removeEventListener("pointerleave", handler);
|
|
10321
10770
|
});
|
|
10322
10771
|
});
|
|
10323
|
-
Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
|
|
10772
|
+
Alpine.directive("h-tooltip", (el, { original: original2 }, { effect, cleanup }) => {
|
|
10324
10773
|
const tooltip = (() => {
|
|
10325
10774
|
let sibling = el.previousElementSibling;
|
|
10326
10775
|
while (sibling && !sibling.hasOwnProperty("_tooltip")) {
|
|
@@ -10331,7 +10780,24 @@
|
|
|
10331
10780
|
if (!tooltip) {
|
|
10332
10781
|
throw new Error(`${original2} must be placed after a tooltip trigger element`);
|
|
10333
10782
|
}
|
|
10334
|
-
el.classList.add(
|
|
10783
|
+
el.classList.add(
|
|
10784
|
+
"absolute",
|
|
10785
|
+
"bg-foreground",
|
|
10786
|
+
"text-background",
|
|
10787
|
+
"z-50",
|
|
10788
|
+
"w-fit",
|
|
10789
|
+
"rounded-md",
|
|
10790
|
+
"px-3",
|
|
10791
|
+
"py-1.5",
|
|
10792
|
+
"text-xs",
|
|
10793
|
+
"text-balance",
|
|
10794
|
+
"transition-[opacity,scale]",
|
|
10795
|
+
"motion-reduce:transition-none",
|
|
10796
|
+
"duration-100",
|
|
10797
|
+
"ease-out",
|
|
10798
|
+
"opacity-0",
|
|
10799
|
+
"scale-95"
|
|
10800
|
+
);
|
|
10335
10801
|
el.setAttribute("data-slot", "tooltip");
|
|
10336
10802
|
el.setAttribute("id", tooltip._tooltip.controls);
|
|
10337
10803
|
const arrowEl = document.createElement("span");
|
|
@@ -10346,6 +10812,7 @@
|
|
|
10346
10812
|
left: `${x}px`,
|
|
10347
10813
|
top: `${y}px`
|
|
10348
10814
|
});
|
|
10815
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
10349
10816
|
if (middlewareData.arrow) {
|
|
10350
10817
|
Object.assign(arrowEl.style, {
|
|
10351
10818
|
left: middlewareData.arrow.x != null ? `${middlewareData.arrow.x}px` : "",
|
|
@@ -10359,6 +10826,23 @@
|
|
|
10359
10826
|
el.classList.remove("hidden");
|
|
10360
10827
|
updatePosition();
|
|
10361
10828
|
} else {
|
|
10829
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
10830
|
+
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
10831
|
+
Object.assign(el.style, {
|
|
10832
|
+
left: "0px",
|
|
10833
|
+
top: "0px"
|
|
10834
|
+
});
|
|
10835
|
+
Object.assign(arrowEl.style, {
|
|
10836
|
+
left: "0px",
|
|
10837
|
+
top: "0px"
|
|
10838
|
+
});
|
|
10839
|
+
} else {
|
|
10840
|
+
el.classList.add("scale-95", "opacity-0");
|
|
10841
|
+
}
|
|
10842
|
+
}
|
|
10843
|
+
});
|
|
10844
|
+
function onTransitionEnd(event) {
|
|
10845
|
+
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
10362
10846
|
el.classList.add("hidden");
|
|
10363
10847
|
Object.assign(el.style, {
|
|
10364
10848
|
left: "0px",
|
|
@@ -10369,6 +10853,10 @@
|
|
|
10369
10853
|
top: "0px"
|
|
10370
10854
|
});
|
|
10371
10855
|
}
|
|
10856
|
+
}
|
|
10857
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
10858
|
+
cleanup(() => {
|
|
10859
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
10372
10860
|
});
|
|
10373
10861
|
});
|
|
10374
10862
|
}
|
|
@@ -10552,6 +11040,7 @@
|
|
|
10552
11040
|
"outline-hidden",
|
|
10553
11041
|
"ring-ring",
|
|
10554
11042
|
"transition-[width,height,padding]",
|
|
11043
|
+
"motion-reduce:transition-none",
|
|
10555
11044
|
"hover:bg-secondary",
|
|
10556
11045
|
"hover:text-secondary-foreground",
|
|
10557
11046
|
"focus-visible:ring-2",
|
|
@@ -10583,7 +11072,7 @@
|
|
|
10583
11072
|
if (treeItem._h_tree_item.hasSubtree) {
|
|
10584
11073
|
const chevronDown = createSvg({
|
|
10585
11074
|
icon: ChevronRight,
|
|
10586
|
-
classes: "size-4 shrink-0 transition-transform duration-200 [[data-expanded=true]>&]:rotate-90",
|
|
11075
|
+
classes: "size-4 shrink-0 transition-transform motion-reduce:transition-none duration-200 [[data-expanded=true]>&]:rotate-90",
|
|
10587
11076
|
attrs: {
|
|
10588
11077
|
"aria-hidden": true,
|
|
10589
11078
|
role: "presentation"
|
|
@@ -10785,7 +11274,7 @@
|
|
|
10785
11274
|
}
|
|
10786
11275
|
|
|
10787
11276
|
// package.json
|
|
10788
|
-
var version = "1.
|
|
11277
|
+
var version = "1.8.0";
|
|
10789
11278
|
|
|
10790
11279
|
// src/index.js
|
|
10791
11280
|
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, getSystemColorScheme, version };
|
|
@@ -10798,9 +11287,9 @@
|
|
|
10798
11287
|
window.Alpine.plugin(calendar_default);
|
|
10799
11288
|
window.Alpine.plugin(card_default);
|
|
10800
11289
|
window.Alpine.plugin(checkbox_default);
|
|
10801
|
-
window.Alpine.plugin(collapsible_default);
|
|
10802
11290
|
window.Alpine.plugin(datepicker_default);
|
|
10803
11291
|
window.Alpine.plugin(dialog_default);
|
|
11292
|
+
window.Alpine.plugin(expansion_panel_default);
|
|
10804
11293
|
window.Alpine.plugin(fieldset_default);
|
|
10805
11294
|
window.Alpine.plugin(icon_default);
|
|
10806
11295
|
window.Alpine.plugin(info_page_default);
|