@codbex/harmonia 0.9.1 → 1.0.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/README.md +3 -3
- package/dist/harmonia.css +1 -1
- package/dist/harmonia.esm.js +253 -80
- package/dist/harmonia.esm.min.js +3 -3
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +253 -80
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +2 -2
package/dist/harmonia.js
CHANGED
|
@@ -594,24 +594,20 @@
|
|
|
594
594
|
"invalid:!border-negative"
|
|
595
595
|
);
|
|
596
596
|
};
|
|
597
|
-
var getButtonSize = (size3,
|
|
597
|
+
var getButtonSize = (size3, isAddon = false) => {
|
|
598
598
|
switch (size3) {
|
|
599
|
-
case "xs":
|
|
600
|
-
return inGroup ? ["h-6", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2.5"];
|
|
601
599
|
case "sm":
|
|
602
|
-
return
|
|
603
|
-
case "
|
|
604
|
-
return ["h-
|
|
605
|
-
case "icon-xs":
|
|
606
|
-
return inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"];
|
|
600
|
+
return isAddon ? ["h-6", "[[data-slot=input-group][data-size=sm]_&]:h-5", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2", "has-[>[data-slot=spinner]]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2", "has-[>[data-slot=spinner]]:px-2"];
|
|
601
|
+
case "md":
|
|
602
|
+
return isAddon ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5", "has-[>[data-slot=spinner]]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5", "has-[>[data-slot=spinner]]:px-2.5"];
|
|
607
603
|
case "icon-sm":
|
|
608
|
-
return
|
|
604
|
+
return isAddon ? ["size-6", "[[data-slot=input-group][data-size=sm]_&]:size-5", "p-0", "has-[>svg]:p-0", "has-[>[data-slot=spinner]]:p-0"] : ["size-6.5"];
|
|
605
|
+
case "icon-md":
|
|
606
|
+
return isAddon ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
|
|
609
607
|
case "icon":
|
|
610
608
|
return ["size-9"];
|
|
611
|
-
case "icon-lg":
|
|
612
|
-
return ["size-10"];
|
|
613
609
|
default:
|
|
614
|
-
return ["h-9", "px-4", "py-2", "has-[>svg]:px-3"];
|
|
610
|
+
return ["h-9", "px-4", "py-2", "has-[>svg]:px-3", "has-[>[data-slot=spinner]]:px-3"];
|
|
615
611
|
}
|
|
616
612
|
};
|
|
617
613
|
function button_default(Alpine) {
|
|
@@ -620,7 +616,7 @@
|
|
|
620
616
|
if (!el.hasAttribute("data-slot")) {
|
|
621
617
|
el.setAttribute("data-slot", "button");
|
|
622
618
|
}
|
|
623
|
-
const
|
|
619
|
+
const isAddon = modifiers.includes("addon");
|
|
624
620
|
let lastSize;
|
|
625
621
|
function setVariant(variant) {
|
|
626
622
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
@@ -628,34 +624,34 @@
|
|
|
628
624
|
}
|
|
629
625
|
if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
|
|
630
626
|
}
|
|
631
|
-
function
|
|
632
|
-
el.classList.remove(...getButtonSize(lastSize,
|
|
633
|
-
el.classList.add(...getButtonSize(size3,
|
|
627
|
+
function setSize2(size3 = "default") {
|
|
628
|
+
el.classList.remove(...getButtonSize(lastSize, isAddon));
|
|
629
|
+
el.classList.add(...getButtonSize(size3, isAddon));
|
|
634
630
|
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
635
631
|
console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
636
632
|
}
|
|
637
633
|
lastSize = size3;
|
|
638
634
|
}
|
|
639
635
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
640
|
-
if (
|
|
636
|
+
if (isAddon) {
|
|
641
637
|
el.classList.remove("shadow-button", "inline-flex");
|
|
642
638
|
el.classList.add("shadow-none", "flex");
|
|
643
|
-
|
|
639
|
+
setSize2(el.getAttribute("data-size") ?? "sm");
|
|
644
640
|
} else {
|
|
645
641
|
if (el.hasAttribute("data-size")) {
|
|
646
|
-
|
|
642
|
+
setSize2(el.getAttribute("data-size"));
|
|
647
643
|
} else {
|
|
648
644
|
if (["date-picker-trigger", "time-picker-trigger"].includes(el.getAttribute("data-slot"))) {
|
|
649
|
-
|
|
645
|
+
setSize2("icon-sm");
|
|
650
646
|
} else {
|
|
651
|
-
|
|
647
|
+
setSize2();
|
|
652
648
|
}
|
|
653
649
|
}
|
|
654
650
|
}
|
|
655
651
|
const observer = new MutationObserver((mutations) => {
|
|
656
652
|
mutations.forEach((mutation) => {
|
|
657
653
|
if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
|
|
658
|
-
else
|
|
654
|
+
else setSize2(el.getAttribute("data-size") ?? (isAddon ? "sm" : "default"));
|
|
659
655
|
});
|
|
660
656
|
});
|
|
661
657
|
observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
|
|
@@ -2956,8 +2952,8 @@
|
|
|
2956
2952
|
"flex-col",
|
|
2957
2953
|
"w-full",
|
|
2958
2954
|
"max-w-[calc(100%-2rem)]",
|
|
2959
|
-
"translate-x-
|
|
2960
|
-
"translate-y-
|
|
2955
|
+
"-translate-x-1/2",
|
|
2956
|
+
"-translate-y-1/2",
|
|
2961
2957
|
"gap-4",
|
|
2962
2958
|
"rounded-lg",
|
|
2963
2959
|
"border",
|
|
@@ -3036,7 +3032,7 @@
|
|
|
3036
3032
|
el.setAttribute("data-slot", "field-group");
|
|
3037
3033
|
});
|
|
3038
3034
|
Alpine.directive("h-field", (el) => {
|
|
3039
|
-
el.classList.add("group/field", "w-full", "gap-3", "
|
|
3035
|
+
el.classList.add("group/field", "w-full", "gap-3", "has-[input:invalid]:text-negative", "has-[textarea:invalid]:text-negative", "has-[[aria-invalid=true]]:text-negative");
|
|
3040
3036
|
switch (el.getAttribute("data-orientation")) {
|
|
3041
3037
|
case "horizontal":
|
|
3042
3038
|
el.classList.add("hbox", "items-center", "[&>[data-slot=field-label]]:flex-auto", "has-[>[data-slot=field-content]]:items-start", "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px");
|
|
@@ -3083,9 +3079,32 @@
|
|
|
3083
3079
|
"[&>a]:underline-offset-4"
|
|
3084
3080
|
);
|
|
3085
3081
|
el.setAttribute("data-slot", "field-description");
|
|
3082
|
+
if (el.getAttribute("data-hide-on-error") === "true") {
|
|
3083
|
+
el.classList.add(
|
|
3084
|
+
"[[data-slot=field]_input:invalid~&]:hidden",
|
|
3085
|
+
"[[data-slot=field]_textarea:invalid~&]:hidden",
|
|
3086
|
+
"[[data-slot=field]_[aria-invalid=true]~&]:hidden",
|
|
3087
|
+
"group-has-[input:invalid]/field:hidden",
|
|
3088
|
+
"group-has-[textarea:invalid)]/field:hidden",
|
|
3089
|
+
"group-has-[[aria-invalid=true]]/field:hidden"
|
|
3090
|
+
);
|
|
3091
|
+
}
|
|
3086
3092
|
});
|
|
3087
3093
|
Alpine.directive("h-field-error", (el) => {
|
|
3088
|
-
el.classList.add(
|
|
3094
|
+
el.classList.add(
|
|
3095
|
+
"hidden",
|
|
3096
|
+
"[[data-slot=field]_input:invalid~&]:block",
|
|
3097
|
+
"[[data-slot=field]_textarea:invalid~&]:block",
|
|
3098
|
+
"[[data-slot=field]_[aria-invalid=true]~&]:block",
|
|
3099
|
+
"group-has-[input:invalid]/field:block",
|
|
3100
|
+
"group-has-[textarea:invalid)]/field:block",
|
|
3101
|
+
"group-has-[[aria-invalid=true]]/field:block",
|
|
3102
|
+
"text-negative",
|
|
3103
|
+
"text-sm",
|
|
3104
|
+
"leading-normal",
|
|
3105
|
+
"font-normal",
|
|
3106
|
+
"group-has-[[data-orientation=horizontal]]/field:text-balance"
|
|
3107
|
+
);
|
|
3089
3108
|
el.setAttribute("data-slot", "field-error");
|
|
3090
3109
|
});
|
|
3091
3110
|
}
|
|
@@ -3150,20 +3169,35 @@
|
|
|
3150
3169
|
});
|
|
3151
3170
|
}
|
|
3152
3171
|
|
|
3172
|
+
// src/common/input-size.js
|
|
3173
|
+
function setSize(el, size3) {
|
|
3174
|
+
if (size3 === "sm") {
|
|
3175
|
+
el.classList.add("h-6.5");
|
|
3176
|
+
el.classList.remove("h-9");
|
|
3177
|
+
} else {
|
|
3178
|
+
el.classList.add("h-9");
|
|
3179
|
+
el.classList.remove("h-6.5");
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
function sizeObserver(el) {
|
|
3183
|
+
const observer = new MutationObserver(() => {
|
|
3184
|
+
setSize(el, el.getAttribute("data-size"));
|
|
3185
|
+
});
|
|
3186
|
+
setSize(el, el.getAttribute("data-size"));
|
|
3187
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-size"] });
|
|
3188
|
+
return observer;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3153
3191
|
// src/components/input.js
|
|
3154
3192
|
function input_default(Alpine) {
|
|
3155
|
-
Alpine.directive("h-input", (el, { modifiers }) => {
|
|
3193
|
+
Alpine.directive("h-input", (el, { modifiers }, { cleanup }) => {
|
|
3156
3194
|
el.classList.add(
|
|
3157
3195
|
"file:text-foreground",
|
|
3158
3196
|
"placeholder:text-muted-foreground",
|
|
3159
3197
|
"selection:bg-primary",
|
|
3160
3198
|
"selection:text-primary-foreground",
|
|
3161
|
-
"bg-input-inner",
|
|
3162
3199
|
"border-input",
|
|
3163
|
-
"w-full",
|
|
3164
3200
|
"min-w-0",
|
|
3165
|
-
"rounded-control",
|
|
3166
|
-
"border",
|
|
3167
3201
|
"[&:not([type='color'])]:px-3",
|
|
3168
3202
|
"[&:not([type='color'])]:py-1",
|
|
3169
3203
|
"[&[type='color']]:overflow-hidden",
|
|
@@ -3172,7 +3206,6 @@
|
|
|
3172
3206
|
"[&::-webkit-color-swatch-wrapper]:rounded-0",
|
|
3173
3207
|
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
3174
3208
|
"text-base",
|
|
3175
|
-
"shadow-input",
|
|
3176
3209
|
"transition-[color,box-shadow]",
|
|
3177
3210
|
"outline-none",
|
|
3178
3211
|
"file:inline-flex",
|
|
@@ -3187,7 +3220,6 @@
|
|
|
3187
3220
|
"md:text-sm",
|
|
3188
3221
|
"focus-visible:border-ring",
|
|
3189
3222
|
"focus-visible:ring-ring/50",
|
|
3190
|
-
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
3191
3223
|
"aria-invalid:ring-negative/20",
|
|
3192
3224
|
"dark:aria-invalid:ring-negative/40",
|
|
3193
3225
|
"aria-invalid:border-negative",
|
|
@@ -3196,15 +3228,18 @@
|
|
|
3196
3228
|
"invalid:!border-negative"
|
|
3197
3229
|
);
|
|
3198
3230
|
if (modifiers.includes("group")) {
|
|
3199
|
-
el.classList.
|
|
3200
|
-
el.classList.add("flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
3231
|
+
el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
3201
3232
|
el.setAttribute("data-slot", "input-group-control");
|
|
3202
|
-
} else
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3233
|
+
} else {
|
|
3234
|
+
el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
|
|
3235
|
+
el.setAttribute("data-slot", "input");
|
|
3236
|
+
const observer = sizeObserver(el);
|
|
3237
|
+
cleanup(() => {
|
|
3238
|
+
observer.disconnect();
|
|
3239
|
+
});
|
|
3240
|
+
}
|
|
3206
3241
|
});
|
|
3207
|
-
Alpine.directive("h-input-group", (el) => {
|
|
3242
|
+
Alpine.directive("h-input-group", (el, _, { cleanup }) => {
|
|
3208
3243
|
el.classList.add(
|
|
3209
3244
|
"group/input-group",
|
|
3210
3245
|
"border-input",
|
|
@@ -3218,7 +3253,6 @@
|
|
|
3218
3253
|
"shadow-input",
|
|
3219
3254
|
"transition-[color,box-shadow]",
|
|
3220
3255
|
"outline-none",
|
|
3221
|
-
"h-9",
|
|
3222
3256
|
"min-w-0",
|
|
3223
3257
|
"has-[>textarea]:h-auto",
|
|
3224
3258
|
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
@@ -3238,6 +3272,10 @@
|
|
|
3238
3272
|
);
|
|
3239
3273
|
el.setAttribute("role", "group");
|
|
3240
3274
|
el.setAttribute("data-slot", "input-group");
|
|
3275
|
+
const observer = sizeObserver(el);
|
|
3276
|
+
cleanup(() => {
|
|
3277
|
+
observer.disconnect();
|
|
3278
|
+
});
|
|
3241
3279
|
});
|
|
3242
3280
|
Alpine.directive("h-input-group-addon", (el, _, { cleanup }) => {
|
|
3243
3281
|
el.classList.add(
|
|
@@ -3248,7 +3286,6 @@
|
|
|
3248
3286
|
"items-center",
|
|
3249
3287
|
"justify-center",
|
|
3250
3288
|
"gap-2",
|
|
3251
|
-
"py-1.5",
|
|
3252
3289
|
"text-sm",
|
|
3253
3290
|
"font-medium",
|
|
3254
3291
|
"select-none",
|
|
@@ -3260,8 +3297,24 @@
|
|
|
3260
3297
|
el.setAttribute("role", "group");
|
|
3261
3298
|
el.setAttribute("data-slot", "input-group-addon");
|
|
3262
3299
|
const variants = {
|
|
3263
|
-
"inline-start": [
|
|
3264
|
-
|
|
3300
|
+
"inline-start": [
|
|
3301
|
+
"order-first",
|
|
3302
|
+
"pl-3",
|
|
3303
|
+
"[[data-slot=input-group][data-size=sm]_&]:pl-1.25",
|
|
3304
|
+
"has-[>button]:pl-1.25",
|
|
3305
|
+
"[[data-slot=input-group][data-size=sm]_&]:has-[>button]:pl-0.5",
|
|
3306
|
+
"has-[>[data-slot|=tag]]:pl-1.5",
|
|
3307
|
+
"[[data-slot=input-group][data-size=sm]_&]:has-[>[data-slot|=tag]]:pl-0.5"
|
|
3308
|
+
],
|
|
3309
|
+
"inline-end": [
|
|
3310
|
+
"order-last",
|
|
3311
|
+
"pr-3",
|
|
3312
|
+
"[[data-slot=input-group][data-size=sm]_&]:pr-1.25",
|
|
3313
|
+
"has-[>button]:pr-1.25",
|
|
3314
|
+
"[[data-slot=input-group][data-size=sm]_&]:has-[>button]:pr-0.5",
|
|
3315
|
+
"has-[>[data-slot|=tag]]:pr-1.5",
|
|
3316
|
+
"[[data-slot=input-group][data-size=sm]_&]:has-[>[data-slot|=tag]]:pr-0.5"
|
|
3317
|
+
],
|
|
3265
3318
|
"block-start": ["order-first", "w-full", "justify-start", "px-3", "pt-3", "[.border-b]:pb-3", "group-has-[>input]/input-group:pt-2.5"],
|
|
3266
3319
|
"block-end": ["order-last", "w-full", "justify-start", "px-3", "pb-3", "[.border-t]:pt-3", "group-has-[>input]/input-group:pb-2.5"]
|
|
3267
3320
|
};
|
|
@@ -3286,6 +3339,136 @@
|
|
|
3286
3339
|
el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
|
|
3287
3340
|
el.setAttribute("data-slot", "label");
|
|
3288
3341
|
});
|
|
3342
|
+
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
3343
|
+
el.classList.add(
|
|
3344
|
+
"group/input-number",
|
|
3345
|
+
"border-input",
|
|
3346
|
+
"bg-input-inner",
|
|
3347
|
+
"relative",
|
|
3348
|
+
"flex",
|
|
3349
|
+
"w-full",
|
|
3350
|
+
"items-center",
|
|
3351
|
+
"rounded-control",
|
|
3352
|
+
"border",
|
|
3353
|
+
"shadow-input",
|
|
3354
|
+
"transition-[color,box-shadow]",
|
|
3355
|
+
"outline-none",
|
|
3356
|
+
"min-w-0",
|
|
3357
|
+
"has-[[data-slot=input-number-control]:focus-visible]:border-ring",
|
|
3358
|
+
"has-[[data-slot=input-number-control]:focus-visible]:ring-ring/50",
|
|
3359
|
+
"has-[[data-slot=input-number-control]:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
3360
|
+
"has-[[data-slot][aria-invalid=true]]:ring-negative/20",
|
|
3361
|
+
"has-[[data-slot][aria-invalid=true]]:border-negative",
|
|
3362
|
+
"dark:has-[[data-slot][aria-invalid=true]]:ring-negative/40"
|
|
3363
|
+
);
|
|
3364
|
+
el.setAttribute("role", "group");
|
|
3365
|
+
el.setAttribute("data-slot", "input-number");
|
|
3366
|
+
const input = el.querySelector("input");
|
|
3367
|
+
if (!input || input.getAttribute("type") !== "number") {
|
|
3368
|
+
throw new Error(`${original} must contain an input of type 'number'`);
|
|
3369
|
+
}
|
|
3370
|
+
if (!input.hasAttribute("type")) input.setAttribute("type", "number");
|
|
3371
|
+
if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
|
|
3372
|
+
if (!input.hasAttribute("aria-roledescription")) {
|
|
3373
|
+
input.setAttribute("aria-roledescription", "Number field");
|
|
3374
|
+
}
|
|
3375
|
+
if (!input.hasAttribute("id")) {
|
|
3376
|
+
input.setAttribute("id", `in${v4_default()}`);
|
|
3377
|
+
}
|
|
3378
|
+
input.setAttribute("tabindex", "0");
|
|
3379
|
+
input.setAttribute("autocomplete", "off");
|
|
3380
|
+
input.setAttribute("autocorrect", "off");
|
|
3381
|
+
input.setAttribute("spellcheck", "off");
|
|
3382
|
+
input.setAttribute("data-slot", "input-number-control");
|
|
3383
|
+
input.classList.add("rounded-l-control", "size-full", "px-3", "py-1", "outline-none");
|
|
3384
|
+
const stepDown = document.createElement("button");
|
|
3385
|
+
stepDown.setAttribute("type", "button");
|
|
3386
|
+
stepDown.setAttribute("tabIndex", "-1");
|
|
3387
|
+
stepDown.setAttribute("aria-label", "Decrease");
|
|
3388
|
+
stepDown.setAttribute("aria-controls", input.getAttribute("id"));
|
|
3389
|
+
stepDown.setAttribute("data-slot", "step-up-trigger");
|
|
3390
|
+
stepDown.classList.add(
|
|
3391
|
+
"border-l",
|
|
3392
|
+
"border-input",
|
|
3393
|
+
"h-full",
|
|
3394
|
+
"aspect-square",
|
|
3395
|
+
"bg-transparent",
|
|
3396
|
+
"hover:bg-secondary",
|
|
3397
|
+
"active:bg-secondary-active",
|
|
3398
|
+
"outline-none",
|
|
3399
|
+
"relative",
|
|
3400
|
+
"before:block",
|
|
3401
|
+
"before:rounded-full",
|
|
3402
|
+
"before:h-0.5",
|
|
3403
|
+
"before:min-h-px",
|
|
3404
|
+
"before:w-3",
|
|
3405
|
+
"before:mx-auto",
|
|
3406
|
+
"before:bg-foreground",
|
|
3407
|
+
"before:hover:bg-secondary-foreground"
|
|
3408
|
+
);
|
|
3409
|
+
el.appendChild(stepDown);
|
|
3410
|
+
const onStepDown = () => {
|
|
3411
|
+
input.stepDown();
|
|
3412
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3413
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
3414
|
+
};
|
|
3415
|
+
stepDown.addEventListener("click", onStepDown);
|
|
3416
|
+
const stepUp = document.createElement("button");
|
|
3417
|
+
stepUp.setAttribute("type", "button");
|
|
3418
|
+
stepUp.setAttribute("tabIndex", "-1");
|
|
3419
|
+
stepUp.setAttribute("aria-label", "Increase");
|
|
3420
|
+
stepUp.setAttribute("aria-controls", input.getAttribute("id"));
|
|
3421
|
+
stepUp.setAttribute("data-slot", "step-up-trigger");
|
|
3422
|
+
stepUp.classList.add(
|
|
3423
|
+
"border-l",
|
|
3424
|
+
"border-input",
|
|
3425
|
+
"rounded-r-control",
|
|
3426
|
+
"h-full",
|
|
3427
|
+
"aspect-square",
|
|
3428
|
+
"bg-transparent",
|
|
3429
|
+
"hover:bg-secondary",
|
|
3430
|
+
"active:bg-secondary-active",
|
|
3431
|
+
"outline-none",
|
|
3432
|
+
"relative",
|
|
3433
|
+
"before:block",
|
|
3434
|
+
"before:absolute",
|
|
3435
|
+
"before:rounded-full",
|
|
3436
|
+
"before:h-0.5",
|
|
3437
|
+
"before:min-h-px",
|
|
3438
|
+
"before:w-3",
|
|
3439
|
+
"before:top-1/2",
|
|
3440
|
+
"before:left-1/2",
|
|
3441
|
+
"before:-translate-x-1/2",
|
|
3442
|
+
"before:-translate-y-1/2",
|
|
3443
|
+
"before:bg-foreground",
|
|
3444
|
+
"before:hover:bg-secondary-foreground",
|
|
3445
|
+
"after:block",
|
|
3446
|
+
"after:absolute",
|
|
3447
|
+
"after:rounded-full",
|
|
3448
|
+
"after:h-3",
|
|
3449
|
+
"after:min-w-px",
|
|
3450
|
+
"after:w-0.5",
|
|
3451
|
+
"after:top-1/2",
|
|
3452
|
+
"after:left-1/2",
|
|
3453
|
+
"after:-translate-x-1/2",
|
|
3454
|
+
"after:-translate-y-1/2",
|
|
3455
|
+
"after:bg-foreground",
|
|
3456
|
+
"after:hover:bg-secondary-foreground"
|
|
3457
|
+
);
|
|
3458
|
+
el.appendChild(stepUp);
|
|
3459
|
+
const onStepUp = () => {
|
|
3460
|
+
input.stepUp();
|
|
3461
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3462
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
3463
|
+
};
|
|
3464
|
+
stepUp.addEventListener("click", onStepUp);
|
|
3465
|
+
const observer = sizeObserver(el);
|
|
3466
|
+
cleanup(() => {
|
|
3467
|
+
observer.disconnect();
|
|
3468
|
+
stepDown.removeEventListener("click", onStepDown);
|
|
3469
|
+
stepUp.removeEventListener("click", onStepUp);
|
|
3470
|
+
});
|
|
3471
|
+
});
|
|
3289
3472
|
}
|
|
3290
3473
|
|
|
3291
3474
|
// src/components/label.js
|
|
@@ -6286,23 +6469,7 @@
|
|
|
6286
6469
|
"[&_svg]:opacity-50"
|
|
6287
6470
|
);
|
|
6288
6471
|
el.setAttribute("data-slot", "select");
|
|
6289
|
-
const
|
|
6290
|
-
if (size3 === "sm") {
|
|
6291
|
-
el.classList.add("h-8");
|
|
6292
|
-
el.classList.remove("h-9", "h-6.5");
|
|
6293
|
-
} else if (size3 === "xs") {
|
|
6294
|
-
el.classList.add("h-6.5");
|
|
6295
|
-
el.classList.remove("h-9", "h-8");
|
|
6296
|
-
} else {
|
|
6297
|
-
el.classList.add("h-9");
|
|
6298
|
-
el.classList.remove("h-8", "h-6.5");
|
|
6299
|
-
}
|
|
6300
|
-
};
|
|
6301
|
-
setSize(el.getAttribute("data-size"));
|
|
6302
|
-
const observer = new MutationObserver(() => {
|
|
6303
|
-
setSize(el.getAttribute("data-size"));
|
|
6304
|
-
});
|
|
6305
|
-
observer.observe(el, { attributes: true, attributeFilter: ["data-size"] });
|
|
6472
|
+
const observer = sizeObserver(el);
|
|
6306
6473
|
cleanup(() => {
|
|
6307
6474
|
observer.disconnect();
|
|
6308
6475
|
});
|
|
@@ -7044,13 +7211,13 @@
|
|
|
7044
7211
|
sm: ["h-7", "text-xs"],
|
|
7045
7212
|
lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
|
|
7046
7213
|
};
|
|
7047
|
-
function
|
|
7214
|
+
function setSize2(size3) {
|
|
7048
7215
|
if (sizes.hasOwnProperty(size3)) {
|
|
7049
7216
|
el.classList.add(...sizes[size3]);
|
|
7050
7217
|
}
|
|
7051
7218
|
}
|
|
7052
7219
|
if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
|
|
7053
|
-
|
|
7220
|
+
setSize2(el.getAttribute("data-size"));
|
|
7054
7221
|
});
|
|
7055
7222
|
Alpine.directive("h-sidebar-menu-action", (el, { modifiers }) => {
|
|
7056
7223
|
el.classList.add(
|
|
@@ -7182,13 +7349,13 @@
|
|
|
7182
7349
|
sm: ["text-xs"],
|
|
7183
7350
|
md: ["text-sm"]
|
|
7184
7351
|
};
|
|
7185
|
-
function
|
|
7352
|
+
function setSize2(size3) {
|
|
7186
7353
|
if (sizes.hasOwnProperty(size3)) {
|
|
7187
7354
|
el.classList.add(...sizes[size3]);
|
|
7188
7355
|
}
|
|
7189
7356
|
}
|
|
7190
7357
|
if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "md");
|
|
7191
|
-
|
|
7358
|
+
setSize2(el.getAttribute("data-size"));
|
|
7192
7359
|
});
|
|
7193
7360
|
Alpine.directive("h-sidebar-footer", (el) => {
|
|
7194
7361
|
el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
|
|
@@ -7204,10 +7371,10 @@
|
|
|
7204
7371
|
if (modifiers.includes("control")) {
|
|
7205
7372
|
el.classList.add("rounded-control");
|
|
7206
7373
|
switch (el.getAttribute("data-size")) {
|
|
7207
|
-
case "
|
|
7374
|
+
case "sm":
|
|
7208
7375
|
el.classList.add("h-6.5");
|
|
7209
7376
|
break;
|
|
7210
|
-
case "
|
|
7377
|
+
case "md":
|
|
7211
7378
|
el.classList.add("h-8");
|
|
7212
7379
|
break;
|
|
7213
7380
|
default:
|
|
@@ -7226,7 +7393,20 @@
|
|
|
7226
7393
|
// src/components/spinner.js
|
|
7227
7394
|
function spinner_default(Alpine) {
|
|
7228
7395
|
Alpine.directive("h-spinner", (el) => {
|
|
7229
|
-
el.classList.add(
|
|
7396
|
+
el.classList.add(
|
|
7397
|
+
"size-4",
|
|
7398
|
+
"border-2",
|
|
7399
|
+
"border-primary",
|
|
7400
|
+
"[[data-slot=button]_&]:border-secondary-foreground",
|
|
7401
|
+
"[[data-slot=button][data-variant=primary]_&]:border-primary-foreground",
|
|
7402
|
+
"[[data-slot=button][data-variant=positive]_&]:border-positive-foreground",
|
|
7403
|
+
"[[data-slot=button][data-variant=negative]_&]:border-negative-foreground",
|
|
7404
|
+
"[[data-slot=button][data-variant=warning]_&]:border-warning-foreground",
|
|
7405
|
+
"[[data-slot=button][data-variant=information]_&]:border-information-foreground",
|
|
7406
|
+
"!border-t-transparent",
|
|
7407
|
+
"rounded-full",
|
|
7408
|
+
"animate-spin"
|
|
7409
|
+
);
|
|
7230
7410
|
el.setAttribute("role", "status");
|
|
7231
7411
|
el.setAttribute("data-slot", "spinner");
|
|
7232
7412
|
if (!el.hasAttribute("aria-label")) el.setAttribute("aria-label", "Loading");
|
|
@@ -7785,6 +7965,10 @@
|
|
|
7785
7965
|
"group/tile",
|
|
7786
7966
|
"flex",
|
|
7787
7967
|
"items-center",
|
|
7968
|
+
"py-3",
|
|
7969
|
+
"px-4",
|
|
7970
|
+
"has-data-[slot=tile-header]:py-4",
|
|
7971
|
+
"gap-2.5",
|
|
7788
7972
|
"text-sm",
|
|
7789
7973
|
"rounded-lg",
|
|
7790
7974
|
"transition-colors",
|
|
@@ -7799,14 +7983,6 @@
|
|
|
7799
7983
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]"
|
|
7800
7984
|
);
|
|
7801
7985
|
el.setAttribute("data-slot", "tile");
|
|
7802
|
-
const sizes = {
|
|
7803
|
-
default: ["p-4", "gap-4"],
|
|
7804
|
-
sm: ["py-3", "px-4", "gap-2.5"]
|
|
7805
|
-
};
|
|
7806
|
-
function setSize(size3) {
|
|
7807
|
-
el.classList.add(...sizes[size3]);
|
|
7808
|
-
el.setAttribute("data-size", size3);
|
|
7809
|
-
}
|
|
7810
7986
|
switch (el.getAttribute("data-variant")) {
|
|
7811
7987
|
case "outline":
|
|
7812
7988
|
el.classList.add("border", "border-border");
|
|
@@ -7820,9 +7996,6 @@
|
|
|
7820
7996
|
default:
|
|
7821
7997
|
el.classList.add("border", "bg-transparent", "border-transparent");
|
|
7822
7998
|
}
|
|
7823
|
-
if (el.getAttribute("data-size") === "sm") {
|
|
7824
|
-
setSize("sm");
|
|
7825
|
-
} else setSize("sm");
|
|
7826
7999
|
});
|
|
7827
8000
|
Alpine.directive("h-tile-header", (el) => {
|
|
7828
8001
|
el.classList.add("flex", "basis-full", "items-center", "justify-between", "gap-2");
|
|
@@ -9077,7 +9250,7 @@
|
|
|
9077
9250
|
}
|
|
9078
9251
|
|
|
9079
9252
|
// package.json
|
|
9080
|
-
var version = "0.
|
|
9253
|
+
var version = "1.0.0";
|
|
9081
9254
|
|
|
9082
9255
|
// src/index.js
|
|
9083
9256
|
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };
|