@codbex/harmonia 1.1.2 → 1.2.1
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 +2 -2
- package/dist/harmonia.esm.js +910 -330
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +3 -3
- package/dist/harmonia.js +910 -330
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +3 -3
- package/package.json +13 -11
package/dist/harmonia.esm.js
CHANGED
|
@@ -1971,6 +1971,8 @@ var ChevronsRight = 6;
|
|
|
1971
1971
|
var Clock = 7;
|
|
1972
1972
|
var Search = 8;
|
|
1973
1973
|
var Ellipsis = 9;
|
|
1974
|
+
var Minus = 10;
|
|
1975
|
+
var Plus = 11;
|
|
1974
1976
|
function setCalendarContent(svg) {
|
|
1975
1977
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1976
1978
|
path.setAttributeNS(
|
|
@@ -2083,6 +2085,20 @@ function setEllipsisContent(svg) {
|
|
|
2083
2085
|
circle3.setAttributeNS(null, "r", "1.5");
|
|
2084
2086
|
svg.appendChild(circle3);
|
|
2085
2087
|
}
|
|
2088
|
+
function setMinusContent(svg) {
|
|
2089
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2090
|
+
path.setAttributeNS(null, "d", "m2.75 7.25h10.5c0.4155 0 0.75 0.3345 0.75 0.75s-0.3345 0.75-0.75 0.75h-10.5c-0.4155 0-0.75-0.3345-0.75-0.75s0.3345-0.75 0.75-0.75z");
|
|
2091
|
+
svg.appendChild(path);
|
|
2092
|
+
}
|
|
2093
|
+
function setPlusContent(svg) {
|
|
2094
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2095
|
+
path.setAttributeNS(
|
|
2096
|
+
null,
|
|
2097
|
+
"d",
|
|
2098
|
+
"m8 2c-0.4155 0-0.75 0.3345-0.75 0.75v4.5h-4.5c-0.4155 0-0.75 0.3345-0.75 0.75s0.3345 0.75 0.75 0.75h4.5v4.5c0 0.4155 0.3345 0.75 0.75 0.75s0.75-0.3345 0.75-0.75v-4.5h4.5c0.4155 0 0.75-0.3345 0.75-0.75s-0.3345-0.75-0.75-0.75h-4.5v-4.5c0-0.4155-0.3345-0.75-0.75-0.75z"
|
|
2099
|
+
);
|
|
2100
|
+
svg.appendChild(path);
|
|
2101
|
+
}
|
|
2086
2102
|
function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
2087
2103
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2088
2104
|
svg.setAttributeNS(null, "width", "16");
|
|
@@ -2126,9 +2142,64 @@ function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
|
2126
2142
|
case Ellipsis:
|
|
2127
2143
|
setEllipsisContent(svg);
|
|
2128
2144
|
break;
|
|
2145
|
+
case Minus:
|
|
2146
|
+
setMinusContent(svg);
|
|
2147
|
+
break;
|
|
2148
|
+
case Plus:
|
|
2149
|
+
setPlusContent(svg);
|
|
2150
|
+
break;
|
|
2151
|
+
default:
|
|
2152
|
+
break;
|
|
2129
2153
|
}
|
|
2130
2154
|
return svg;
|
|
2131
2155
|
}
|
|
2156
|
+
function setSvgContent(svg, icon) {
|
|
2157
|
+
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2158
|
+
svg.setAttribute("width", "16");
|
|
2159
|
+
svg.setAttribute("height", "16");
|
|
2160
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
2161
|
+
svg.setAttribute("fill", "currentColor");
|
|
2162
|
+
switch (icon) {
|
|
2163
|
+
case "calendar":
|
|
2164
|
+
setCalendarContent(svg);
|
|
2165
|
+
break;
|
|
2166
|
+
case "check":
|
|
2167
|
+
setCheckContent(svg);
|
|
2168
|
+
break;
|
|
2169
|
+
case "chevron-down":
|
|
2170
|
+
setChevronDownContent(svg);
|
|
2171
|
+
break;
|
|
2172
|
+
case "chevron-left":
|
|
2173
|
+
setChevronLeftContent(svg);
|
|
2174
|
+
break;
|
|
2175
|
+
case "chevron-right":
|
|
2176
|
+
setChevronRightContent(svg);
|
|
2177
|
+
break;
|
|
2178
|
+
case "chevrons-left":
|
|
2179
|
+
setChevronsLeftContent(svg);
|
|
2180
|
+
break;
|
|
2181
|
+
case "chevrons-right":
|
|
2182
|
+
setChevronsRightContent(svg);
|
|
2183
|
+
break;
|
|
2184
|
+
case "clock":
|
|
2185
|
+
setClockContent(svg);
|
|
2186
|
+
break;
|
|
2187
|
+
case "search":
|
|
2188
|
+
setSearchContent(svg);
|
|
2189
|
+
break;
|
|
2190
|
+
case "ellipsis":
|
|
2191
|
+
setEllipsisContent(svg);
|
|
2192
|
+
break;
|
|
2193
|
+
case "minus":
|
|
2194
|
+
setMinusContent(svg);
|
|
2195
|
+
break;
|
|
2196
|
+
case "plus":
|
|
2197
|
+
setPlusContent(svg);
|
|
2198
|
+
break;
|
|
2199
|
+
default:
|
|
2200
|
+
break;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2132
2203
|
|
|
2133
2204
|
// src/components/accordion.js
|
|
2134
2205
|
function accordion_default(Alpine) {
|
|
@@ -2139,10 +2210,10 @@ function accordion_default(Alpine) {
|
|
|
2139
2210
|
}) : { single: false };
|
|
2140
2211
|
el.setAttribute("data-slot", "accordion");
|
|
2141
2212
|
});
|
|
2142
|
-
Alpine.directive("h-accordion-item", (el, { original, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
|
|
2213
|
+
Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
|
|
2143
2214
|
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
2144
2215
|
if (!accordion) {
|
|
2145
|
-
throw new Error(`${
|
|
2216
|
+
throw new Error(`${original2} must be inside an accordion`);
|
|
2146
2217
|
}
|
|
2147
2218
|
el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
|
|
2148
2219
|
el.setAttribute("data-slot", "accordion-item");
|
|
@@ -2170,14 +2241,14 @@ function accordion_default(Alpine) {
|
|
|
2170
2241
|
setAttributes();
|
|
2171
2242
|
effect(setAttributes);
|
|
2172
2243
|
});
|
|
2173
|
-
Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
2244
|
+
Alpine.directive("h-accordion-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
2174
2245
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
2175
|
-
throw new Error(`${
|
|
2246
|
+
throw new Error(`${original2} must be a header element`);
|
|
2176
2247
|
}
|
|
2177
2248
|
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
2178
2249
|
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordionItem"));
|
|
2179
2250
|
if (!accordionItem || !accordion) {
|
|
2180
|
-
throw new Error(`${
|
|
2251
|
+
throw new Error(`${original2} must have an accordion and accordion item parent elements`);
|
|
2181
2252
|
}
|
|
2182
2253
|
el.classList.add(
|
|
2183
2254
|
"flex",
|
|
@@ -2362,10 +2433,10 @@ function avatar_default(Alpine) {
|
|
|
2362
2433
|
el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
|
|
2363
2434
|
}
|
|
2364
2435
|
});
|
|
2365
|
-
Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
|
|
2436
|
+
Alpine.directive("h-avatar-image", (el, { original: original2 }, { cleanup }) => {
|
|
2366
2437
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
2367
2438
|
if (!avatar) {
|
|
2368
|
-
throw new Error(`${
|
|
2439
|
+
throw new Error(`${original2} must be inside an avatar element`);
|
|
2369
2440
|
}
|
|
2370
2441
|
el.classList.add("aspect-square", "size-full");
|
|
2371
2442
|
el.setAttribute("data-slot", "avatar-image");
|
|
@@ -2396,10 +2467,10 @@ function avatar_default(Alpine) {
|
|
|
2396
2467
|
observer.disconnect();
|
|
2397
2468
|
});
|
|
2398
2469
|
});
|
|
2399
|
-
Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
|
|
2470
|
+
Alpine.directive("h-avatar-fallback", (el, { original: original2 }, { effect }) => {
|
|
2400
2471
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
2401
2472
|
if (!avatar) {
|
|
2402
|
-
throw new Error(`${
|
|
2473
|
+
throw new Error(`${original2} must be inside an avatar element`);
|
|
2403
2474
|
}
|
|
2404
2475
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
2405
2476
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
@@ -2608,7 +2679,7 @@ var getButtonSize = (size3, isAddon = false) => {
|
|
|
2608
2679
|
}
|
|
2609
2680
|
};
|
|
2610
2681
|
function button_default(Alpine) {
|
|
2611
|
-
Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
|
|
2682
|
+
Alpine.directive("h-button", (el, { original: original2, modifiers }, { cleanup }) => {
|
|
2612
2683
|
setButtonClasses(el);
|
|
2613
2684
|
if (!el.hasAttribute("data-slot")) {
|
|
2614
2685
|
el.setAttribute("data-slot", "button");
|
|
@@ -2625,7 +2696,7 @@ function button_default(Alpine) {
|
|
|
2625
2696
|
el.classList.remove(...getButtonSize(lastSize, isAddon));
|
|
2626
2697
|
el.classList.add(...getButtonSize(size3, isAddon));
|
|
2627
2698
|
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
2628
|
-
console.error(`${
|
|
2699
|
+
console.error(`${original2}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
2629
2700
|
}
|
|
2630
2701
|
lastSize = size3;
|
|
2631
2702
|
}
|
|
@@ -2876,6 +2947,62 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
2876
2947
|
}
|
|
2877
2948
|
return coords;
|
|
2878
2949
|
}
|
|
2950
|
+
async function detectOverflow(state, options) {
|
|
2951
|
+
var _await$platform$isEle;
|
|
2952
|
+
if (options === void 0) {
|
|
2953
|
+
options = {};
|
|
2954
|
+
}
|
|
2955
|
+
const {
|
|
2956
|
+
x,
|
|
2957
|
+
y,
|
|
2958
|
+
platform: platform2,
|
|
2959
|
+
rects,
|
|
2960
|
+
elements,
|
|
2961
|
+
strategy
|
|
2962
|
+
} = state;
|
|
2963
|
+
const {
|
|
2964
|
+
boundary = "clippingAncestors",
|
|
2965
|
+
rootBoundary = "viewport",
|
|
2966
|
+
elementContext = "floating",
|
|
2967
|
+
altBoundary = false,
|
|
2968
|
+
padding = 0
|
|
2969
|
+
} = evaluate(options, state);
|
|
2970
|
+
const paddingObject = getPaddingObject(padding);
|
|
2971
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2972
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
2973
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2974
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
2975
|
+
boundary,
|
|
2976
|
+
rootBoundary,
|
|
2977
|
+
strategy
|
|
2978
|
+
}));
|
|
2979
|
+
const rect = elementContext === "floating" ? {
|
|
2980
|
+
x,
|
|
2981
|
+
y,
|
|
2982
|
+
width: rects.floating.width,
|
|
2983
|
+
height: rects.floating.height
|
|
2984
|
+
} : rects.reference;
|
|
2985
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2986
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2987
|
+
x: 1,
|
|
2988
|
+
y: 1
|
|
2989
|
+
} : {
|
|
2990
|
+
x: 1,
|
|
2991
|
+
y: 1
|
|
2992
|
+
};
|
|
2993
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2994
|
+
elements,
|
|
2995
|
+
rect,
|
|
2996
|
+
offsetParent,
|
|
2997
|
+
strategy
|
|
2998
|
+
}) : rect);
|
|
2999
|
+
return {
|
|
3000
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
3001
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
3002
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
3003
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
3004
|
+
};
|
|
3005
|
+
}
|
|
2879
3006
|
var computePosition = async (reference, floating, config) => {
|
|
2880
3007
|
const {
|
|
2881
3008
|
placement = "bottom",
|
|
@@ -2898,6 +3025,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2898
3025
|
let middlewareData = {};
|
|
2899
3026
|
let resetCount = 0;
|
|
2900
3027
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
3028
|
+
var _platform$detectOverf;
|
|
2901
3029
|
const {
|
|
2902
3030
|
name,
|
|
2903
3031
|
fn
|
|
@@ -2915,7 +3043,10 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2915
3043
|
strategy,
|
|
2916
3044
|
middlewareData,
|
|
2917
3045
|
rects,
|
|
2918
|
-
platform:
|
|
3046
|
+
platform: {
|
|
3047
|
+
...platform2,
|
|
3048
|
+
detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
3049
|
+
},
|
|
2919
3050
|
elements: {
|
|
2920
3051
|
reference,
|
|
2921
3052
|
floating
|
|
@@ -2959,62 +3090,6 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2959
3090
|
middlewareData
|
|
2960
3091
|
};
|
|
2961
3092
|
};
|
|
2962
|
-
async function detectOverflow(state, options) {
|
|
2963
|
-
var _await$platform$isEle;
|
|
2964
|
-
if (options === void 0) {
|
|
2965
|
-
options = {};
|
|
2966
|
-
}
|
|
2967
|
-
const {
|
|
2968
|
-
x,
|
|
2969
|
-
y,
|
|
2970
|
-
platform: platform2,
|
|
2971
|
-
rects,
|
|
2972
|
-
elements,
|
|
2973
|
-
strategy
|
|
2974
|
-
} = state;
|
|
2975
|
-
const {
|
|
2976
|
-
boundary = "clippingAncestors",
|
|
2977
|
-
rootBoundary = "viewport",
|
|
2978
|
-
elementContext = "floating",
|
|
2979
|
-
altBoundary = false,
|
|
2980
|
-
padding = 0
|
|
2981
|
-
} = evaluate(options, state);
|
|
2982
|
-
const paddingObject = getPaddingObject(padding);
|
|
2983
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2984
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
2985
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2986
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
2987
|
-
boundary,
|
|
2988
|
-
rootBoundary,
|
|
2989
|
-
strategy
|
|
2990
|
-
}));
|
|
2991
|
-
const rect = elementContext === "floating" ? {
|
|
2992
|
-
x,
|
|
2993
|
-
y,
|
|
2994
|
-
width: rects.floating.width,
|
|
2995
|
-
height: rects.floating.height
|
|
2996
|
-
} : rects.reference;
|
|
2997
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2998
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2999
|
-
x: 1,
|
|
3000
|
-
y: 1
|
|
3001
|
-
} : {
|
|
3002
|
-
x: 1,
|
|
3003
|
-
y: 1
|
|
3004
|
-
};
|
|
3005
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
3006
|
-
elements,
|
|
3007
|
-
rect,
|
|
3008
|
-
offsetParent,
|
|
3009
|
-
strategy
|
|
3010
|
-
}) : rect);
|
|
3011
|
-
return {
|
|
3012
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
3013
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
3014
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
3015
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
3016
|
-
};
|
|
3017
|
-
}
|
|
3018
3093
|
var arrow = (options) => ({
|
|
3019
3094
|
name: "arrow",
|
|
3020
3095
|
options,
|
|
@@ -3116,7 +3191,7 @@ var flip = function(options) {
|
|
|
3116
3191
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
3117
3192
|
}
|
|
3118
3193
|
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
3119
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3194
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3120
3195
|
const overflows = [];
|
|
3121
3196
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
3122
3197
|
if (checkMainAxis) {
|
|
@@ -3265,7 +3340,8 @@ var shift = function(options) {
|
|
|
3265
3340
|
const {
|
|
3266
3341
|
x,
|
|
3267
3342
|
y,
|
|
3268
|
-
placement
|
|
3343
|
+
placement,
|
|
3344
|
+
platform: platform2
|
|
3269
3345
|
} = state;
|
|
3270
3346
|
const {
|
|
3271
3347
|
mainAxis: checkMainAxis = true,
|
|
@@ -3288,7 +3364,7 @@ var shift = function(options) {
|
|
|
3288
3364
|
x,
|
|
3289
3365
|
y
|
|
3290
3366
|
};
|
|
3291
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3367
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3292
3368
|
const crossAxis = getSideAxis(getSide(placement));
|
|
3293
3369
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
3294
3370
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -3346,7 +3422,7 @@ var size = function(options) {
|
|
|
3346
3422
|
},
|
|
3347
3423
|
...detectOverflowOptions
|
|
3348
3424
|
} = evaluate(options, state);
|
|
3349
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3425
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3350
3426
|
const side = getSide(placement);
|
|
3351
3427
|
const alignment = getAlignment(placement);
|
|
3352
3428
|
const isYAxis = getSideAxis(placement) === "y";
|
|
@@ -4169,7 +4245,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
4169
4245
|
|
|
4170
4246
|
// src/components/calendar.js
|
|
4171
4247
|
function calendar_default(Alpine) {
|
|
4172
|
-
Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4248
|
+
Alpine.directive("h-calendar", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4173
4249
|
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
4174
4250
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
4175
4251
|
el.setAttribute("tabindex", "-1");
|
|
@@ -4178,7 +4254,7 @@ function calendar_default(Alpine) {
|
|
|
4178
4254
|
el.setAttribute("role", "dialog");
|
|
4179
4255
|
el.setAttribute("aria-modal", "true");
|
|
4180
4256
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
4181
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4257
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
4182
4258
|
} else {
|
|
4183
4259
|
el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
|
|
4184
4260
|
}
|
|
@@ -4213,7 +4289,7 @@ function calendar_default(Alpine) {
|
|
|
4213
4289
|
const onInputChange = () => {
|
|
4214
4290
|
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
4215
4291
|
if (isNaN(newValue)) {
|
|
4216
|
-
console.error(`${
|
|
4292
|
+
console.error(`${original2}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
|
|
4217
4293
|
datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
4218
4294
|
return;
|
|
4219
4295
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
@@ -4230,7 +4306,7 @@ function calendar_default(Alpine) {
|
|
|
4230
4306
|
if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
|
|
4231
4307
|
selected = new Date(el._x_model.get());
|
|
4232
4308
|
if (isNaN(selected)) {
|
|
4233
|
-
console.error(`${
|
|
4309
|
+
console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
|
|
4234
4310
|
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
4235
4311
|
else el.setAttribute("data-invalid", "true");
|
|
4236
4312
|
} else if (datepicker) {
|
|
@@ -4244,7 +4320,7 @@ function calendar_default(Alpine) {
|
|
|
4244
4320
|
selected = new Date(focusedDay);
|
|
4245
4321
|
modelChange(true);
|
|
4246
4322
|
render();
|
|
4247
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
4323
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
4248
4324
|
}
|
|
4249
4325
|
function isDisabled(d) {
|
|
4250
4326
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
@@ -4554,7 +4630,7 @@ function calendar_default(Alpine) {
|
|
|
4554
4630
|
break;
|
|
4555
4631
|
case "Escape":
|
|
4556
4632
|
event.preventDefault();
|
|
4557
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
4633
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
4558
4634
|
return;
|
|
4559
4635
|
case "Enter":
|
|
4560
4636
|
case " ":
|
|
@@ -4618,8 +4694,8 @@ function calendar_default(Alpine) {
|
|
|
4618
4694
|
}
|
|
4619
4695
|
if (datepicker) {
|
|
4620
4696
|
effect(() => {
|
|
4621
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4622
|
-
if (datepicker._h_datepicker.expanded) {
|
|
4697
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
4698
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
4623
4699
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
4624
4700
|
Alpine2.nextTick(() => {
|
|
4625
4701
|
focusDay();
|
|
@@ -4739,10 +4815,10 @@ function collapsible_default(Alpine) {
|
|
|
4739
4815
|
});
|
|
4740
4816
|
}
|
|
4741
4817
|
});
|
|
4742
|
-
Alpine.directive("h-collapsible-trigger", (el, { original, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
4818
|
+
Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
4743
4819
|
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
4744
4820
|
if (!collapsible) {
|
|
4745
|
-
throw new Error(`${
|
|
4821
|
+
throw new Error(`${original2} must be inside a collapsible element`);
|
|
4746
4822
|
}
|
|
4747
4823
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
|
|
4748
4824
|
if (modifiers.includes("chevron")) {
|
|
@@ -4761,10 +4837,10 @@ function collapsible_default(Alpine) {
|
|
|
4761
4837
|
el.removeEventListener("click", handler);
|
|
4762
4838
|
});
|
|
4763
4839
|
});
|
|
4764
|
-
Alpine.directive("h-collapsible-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
4840
|
+
Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
4765
4841
|
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
4766
4842
|
if (!collapsible) {
|
|
4767
|
-
throw new Error(`${
|
|
4843
|
+
throw new Error(`${original2} must be inside an h-collapsible element`);
|
|
4768
4844
|
}
|
|
4769
4845
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
|
|
4770
4846
|
el.classList.add("data-[state=closed]:!hidden");
|
|
@@ -4795,16 +4871,20 @@ function sizeObserver(el) {
|
|
|
4795
4871
|
|
|
4796
4872
|
// src/components/datepicker.js
|
|
4797
4873
|
function datepicker_default(Alpine) {
|
|
4798
|
-
Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2, cleanup }) => {
|
|
4799
|
-
|
|
4874
|
+
Alpine.directive("h-date-picker", (el, { original: original2, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
4875
|
+
const state = Alpine2.reactive({
|
|
4876
|
+
expanded: false
|
|
4877
|
+
});
|
|
4878
|
+
el._h_datepicker = {
|
|
4800
4879
|
id: void 0,
|
|
4801
4880
|
controls: `hdpc${v4_default()}`,
|
|
4802
4881
|
input: void 0,
|
|
4803
|
-
|
|
4804
|
-
|
|
4882
|
+
state,
|
|
4883
|
+
inTable: modifiers.includes("table")
|
|
4884
|
+
};
|
|
4805
4885
|
el._h_datepicker.input = el.querySelector("input");
|
|
4806
4886
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
4807
|
-
throw new Error(`${
|
|
4887
|
+
throw new Error(`${original2} must contain an input`);
|
|
4808
4888
|
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
4809
4889
|
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
4810
4890
|
} else {
|
|
@@ -4813,30 +4893,50 @@ function datepicker_default(Alpine) {
|
|
|
4813
4893
|
el._h_datepicker.id = id;
|
|
4814
4894
|
}
|
|
4815
4895
|
el.classList.add(
|
|
4896
|
+
"overflow-hidden",
|
|
4816
4897
|
"border-input",
|
|
4817
|
-
"bg-input-inner",
|
|
4818
4898
|
"flex",
|
|
4819
|
-
"w-full",
|
|
4820
4899
|
"items-center",
|
|
4821
|
-
"rounded-control",
|
|
4822
|
-
"border",
|
|
4823
|
-
"shadow-input",
|
|
4824
4900
|
"transition-[color,box-shadow]",
|
|
4825
4901
|
"duration-200",
|
|
4826
4902
|
"outline-none",
|
|
4827
4903
|
"pl-3",
|
|
4828
4904
|
"min-w-0",
|
|
4829
|
-
"has-[input:
|
|
4830
|
-
"has-[input:
|
|
4831
|
-
"has-[input:
|
|
4832
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
4833
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
4834
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
4835
|
-
"has-[input:invalid]:ring-negative/20",
|
|
4836
|
-
"has-[input:invalid]:border-negative",
|
|
4837
|
-
"dark:has-[input:invalid]:ring-negative/40"
|
|
4905
|
+
"has-[input:disabled]:pointer-events-none",
|
|
4906
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
4907
|
+
"has-[input:disabled]:opacity-50"
|
|
4838
4908
|
);
|
|
4839
|
-
el.
|
|
4909
|
+
if (el._h_datepicker.inTable) {
|
|
4910
|
+
el.classList.add(
|
|
4911
|
+
"size-full",
|
|
4912
|
+
"h-10",
|
|
4913
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
4914
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
4915
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
4916
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
4917
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
4918
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
4919
|
+
);
|
|
4920
|
+
el.setAttribute("data-slot", "cell-input-date");
|
|
4921
|
+
} else {
|
|
4922
|
+
el.classList.add(
|
|
4923
|
+
"w-full",
|
|
4924
|
+
"rounded-control",
|
|
4925
|
+
"border",
|
|
4926
|
+
"bg-input-inner",
|
|
4927
|
+
"shadow-input",
|
|
4928
|
+
"has-[input:focus-visible]:border-ring",
|
|
4929
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
4930
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
4931
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
4932
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
4933
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
4934
|
+
"has-[input:invalid]:ring-negative/20",
|
|
4935
|
+
"has-[input:invalid]:border-negative",
|
|
4936
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
4937
|
+
);
|
|
4938
|
+
el.setAttribute("data-slot", "date-picker");
|
|
4939
|
+
}
|
|
4840
4940
|
el._h_datepicker.input.classList.add(
|
|
4841
4941
|
"bg-transparent",
|
|
4842
4942
|
"outline-none",
|
|
@@ -4861,39 +4961,40 @@ function datepicker_default(Alpine) {
|
|
|
4861
4961
|
observer.disconnect();
|
|
4862
4962
|
});
|
|
4863
4963
|
});
|
|
4864
|
-
Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
4964
|
+
Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
4865
4965
|
if (el.tagName !== "BUTTON") {
|
|
4866
|
-
throw new Error(`${
|
|
4966
|
+
throw new Error(`${original2} must be a button`);
|
|
4867
4967
|
}
|
|
4868
4968
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
4869
|
-
throw new Error(`${
|
|
4969
|
+
throw new Error(`${original2}: must have an "aria-label" or "aria-labelledby" attribute`);
|
|
4870
4970
|
}
|
|
4871
4971
|
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
4872
4972
|
if (!datepicker) {
|
|
4873
|
-
throw new Error(`${
|
|
4973
|
+
throw new Error(`${original2} must be inside an date-picker element`);
|
|
4974
|
+
}
|
|
4975
|
+
el.classList.add("cursor-pointer", "inline-flex", "items-center", "justify-center", "h-full", "aspect-square", "bg-transparent", "hover:bg-secondary", "active:bg-secondary-active", "outline-none");
|
|
4976
|
+
if (datepicker._h_datepicker.inTable) {
|
|
4977
|
+
el.classList.add(
|
|
4978
|
+
"focus-visible:inset-ring-ring/50",
|
|
4979
|
+
"focus-visible:inset-ring-2",
|
|
4980
|
+
"[input[aria-invalid=true]~&]:inset-ring-negative/20",
|
|
4981
|
+
"dark:[input[aria-invalid=true]~&]:inset-ring-negative/40",
|
|
4982
|
+
"[input:invalid~&]:!inset-ring-negative/20",
|
|
4983
|
+
"dark:[input:invalid~&]:!inset-ring-negative/40"
|
|
4984
|
+
);
|
|
4985
|
+
} else {
|
|
4986
|
+
el.classList.add(
|
|
4987
|
+
"focus-visible:border-ring",
|
|
4988
|
+
"focus-visible:ring-ring/50",
|
|
4989
|
+
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
4990
|
+
"[input[aria-invalid=true]~&]:ring-negative/20",
|
|
4991
|
+
"[input[aria-invalid=true]~&]:border-negative",
|
|
4992
|
+
"dark:[input[aria-invalid=true]~&]:ring-negative/40",
|
|
4993
|
+
"[input:invalid~&]:ring-negative/20",
|
|
4994
|
+
"[input:invalid~&]:border-negative",
|
|
4995
|
+
"dark:[input:invalid~&]:ring-negative/40"
|
|
4996
|
+
);
|
|
4874
4997
|
}
|
|
4875
|
-
el.classList.add(
|
|
4876
|
-
"cursor-pointer",
|
|
4877
|
-
"inline-flex",
|
|
4878
|
-
"items-center",
|
|
4879
|
-
"justify-center",
|
|
4880
|
-
"rounded-r-control",
|
|
4881
|
-
"h-full",
|
|
4882
|
-
"aspect-square",
|
|
4883
|
-
"bg-transparent",
|
|
4884
|
-
"hover:bg-secondary",
|
|
4885
|
-
"active:bg-secondary-active",
|
|
4886
|
-
"outline-none",
|
|
4887
|
-
"focus-visible:border-ring",
|
|
4888
|
-
"focus-visible:ring-ring/50",
|
|
4889
|
-
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
4890
|
-
"[input[aria-invalid=true]~&]:ring-negative/20",
|
|
4891
|
-
"[input[aria-invalid=true]~&]:border-negative",
|
|
4892
|
-
"dark:[input[aria-invalid=true]~&]:ring-negative/40",
|
|
4893
|
-
"[input:invalid~&]:ring-negative/20",
|
|
4894
|
-
"[input:invalid~&]:border-negative",
|
|
4895
|
-
"dark:[input:invalid~&]:ring-negative/40"
|
|
4896
|
-
);
|
|
4897
4998
|
el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
|
|
4898
4999
|
el.setAttribute("aria-expanded", "false");
|
|
4899
5000
|
el.setAttribute("aria-haspopup", "dialog");
|
|
@@ -4910,17 +5011,16 @@ function datepicker_default(Alpine) {
|
|
|
4910
5011
|
})
|
|
4911
5012
|
);
|
|
4912
5013
|
effect(() => {
|
|
4913
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4914
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
5014
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
5015
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.state.expanded);
|
|
4915
5016
|
});
|
|
4916
5017
|
const close = () => {
|
|
4917
|
-
datepicker._h_datepicker.expanded = false;
|
|
5018
|
+
datepicker._h_datepicker.state.expanded = false;
|
|
4918
5019
|
};
|
|
4919
5020
|
const handler = () => {
|
|
4920
|
-
datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
|
|
4921
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
5021
|
+
datepicker._h_datepicker.state.expanded = !datepicker._h_datepicker.state.expanded;
|
|
4922
5022
|
Alpine2.nextTick(() => {
|
|
4923
|
-
if (datepicker._h_datepicker.expanded) {
|
|
5023
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
4924
5024
|
top.addEventListener("click", close, { once: true });
|
|
4925
5025
|
} else {
|
|
4926
5026
|
top.removeEventListener("click", close);
|
|
@@ -5007,7 +5107,7 @@ function dialog_default(Alpine) {
|
|
|
5007
5107
|
el.setAttribute("data-slot", "dialog-header");
|
|
5008
5108
|
});
|
|
5009
5109
|
Alpine.directive("h-dialog-title", (el, _, { Alpine: Alpine2 }) => {
|
|
5010
|
-
el.classList.add("text-lg", "leading-none", "font-semibold");
|
|
5110
|
+
el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
|
|
5011
5111
|
el.setAttribute("data-slot", "dialog-title");
|
|
5012
5112
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5013
5113
|
if (dialog && (!dialog.hasAttribute("aria-labelledby") || !dialog.hasAttribute("aria-label"))) {
|
|
@@ -5020,6 +5120,7 @@ function dialog_default(Alpine) {
|
|
|
5020
5120
|
});
|
|
5021
5121
|
Alpine.directive("h-dialog-close", (el) => {
|
|
5022
5122
|
el.classList.add(
|
|
5123
|
+
"order-2",
|
|
5023
5124
|
"ring-offset-background",
|
|
5024
5125
|
"focus:ring-ring",
|
|
5025
5126
|
"rounded-xs",
|
|
@@ -5035,9 +5136,10 @@ function dialog_default(Alpine) {
|
|
|
5035
5136
|
"[&_svg:not([class*='size-'])]:size-4"
|
|
5036
5137
|
);
|
|
5037
5138
|
el.setAttribute("data-slot", "dialog-close");
|
|
5139
|
+
el.setAttribute("type", "button");
|
|
5038
5140
|
});
|
|
5039
5141
|
Alpine.directive("h-dialog-description", (el, _, { Alpine: Alpine2 }) => {
|
|
5040
|
-
el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
|
|
5142
|
+
el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
|
|
5041
5143
|
el.setAttribute("data-slot", "dialog-description");
|
|
5042
5144
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5043
5145
|
if (dialog && (!dialog.hasAttribute("aria-describedby") || !dialog.hasAttribute("aria-description"))) {
|
|
@@ -5148,13 +5250,13 @@ function fieldset_default(Alpine) {
|
|
|
5148
5250
|
|
|
5149
5251
|
// src/components/icon.js
|
|
5150
5252
|
function icon_default(Alpine) {
|
|
5151
|
-
Alpine.directive("h-icon", (el, { original }) => {
|
|
5253
|
+
Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
|
|
5152
5254
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
5153
|
-
throw new Error(`${
|
|
5255
|
+
throw new Error(`${original2} works only on svg elements`);
|
|
5154
5256
|
} else if (!el.hasAttribute("role")) {
|
|
5155
|
-
throw new Error(`${
|
|
5257
|
+
throw new Error(`${original2} must have a role`);
|
|
5156
5258
|
} else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
5157
|
-
throw new Error(`${
|
|
5259
|
+
throw new Error(`${original2}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
|
|
5158
5260
|
}
|
|
5159
5261
|
el.classList.add("fill-current");
|
|
5160
5262
|
el.setAttribute("data-slot", "icon");
|
|
@@ -5172,6 +5274,8 @@ function icon_default(Alpine) {
|
|
|
5172
5274
|
}).catch((response) => {
|
|
5173
5275
|
console.error(response);
|
|
5174
5276
|
});
|
|
5277
|
+
} else if (modifiers[0]) {
|
|
5278
|
+
setSvgContent(el, modifiers[0]);
|
|
5175
5279
|
}
|
|
5176
5280
|
});
|
|
5177
5281
|
}
|
|
@@ -5248,6 +5352,18 @@ function input_default(Alpine) {
|
|
|
5248
5352
|
if (modifiers.includes("group")) {
|
|
5249
5353
|
el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
5250
5354
|
el.setAttribute("data-slot", "input-group-control");
|
|
5355
|
+
} else if (modifiers.includes("table")) {
|
|
5356
|
+
el.classList.add(
|
|
5357
|
+
"size-full",
|
|
5358
|
+
"h-10",
|
|
5359
|
+
"focus-visible:inset-ring-ring/50",
|
|
5360
|
+
"focus-visible:inset-ring-2",
|
|
5361
|
+
"aria-invalid:inset-ring-negative/20",
|
|
5362
|
+
"dark:aria-invalid:inset-ring-negative/40",
|
|
5363
|
+
"invalid:!inset-ring-negative/20",
|
|
5364
|
+
"dark:invalid:!inset-ring-negative/40"
|
|
5365
|
+
);
|
|
5366
|
+
el.setAttribute("data-slot", "cell-input");
|
|
5251
5367
|
} else {
|
|
5252
5368
|
el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
|
|
5253
5369
|
el.setAttribute("data-slot", "input");
|
|
@@ -5357,8 +5473,9 @@ function input_default(Alpine) {
|
|
|
5357
5473
|
el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
|
|
5358
5474
|
el.setAttribute("data-slot", "label");
|
|
5359
5475
|
});
|
|
5360
|
-
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
5476
|
+
Alpine.directive("h-input-number", (el, { original: original2 }, { cleanup }) => {
|
|
5361
5477
|
el.classList.add(
|
|
5478
|
+
"overflow-hidden",
|
|
5362
5479
|
"group/input-number",
|
|
5363
5480
|
"border-input",
|
|
5364
5481
|
"bg-input-inner",
|
|
@@ -5372,18 +5489,24 @@ function input_default(Alpine) {
|
|
|
5372
5489
|
"transition-[color,box-shadow]",
|
|
5373
5490
|
"outline-none",
|
|
5374
5491
|
"min-w-0",
|
|
5375
|
-
"has-[
|
|
5376
|
-
"has-[
|
|
5377
|
-
"has-[
|
|
5378
|
-
"has-[[
|
|
5379
|
-
"has-[[
|
|
5380
|
-
"dark:has-[[
|
|
5492
|
+
"has-[input:focus-visible]:border-ring",
|
|
5493
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
5494
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
5495
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
5496
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
5497
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
5498
|
+
"has-[input:invalid]:ring-negative/20",
|
|
5499
|
+
"has-[input:invalid]:border-negative",
|
|
5500
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
5501
|
+
"has-[input:disabled]:pointer-events-none",
|
|
5502
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
5503
|
+
"has-[input:disabled]:opacity-50"
|
|
5381
5504
|
);
|
|
5382
5505
|
el.setAttribute("role", "group");
|
|
5383
5506
|
el.setAttribute("data-slot", "input-number");
|
|
5384
5507
|
const input = el.querySelector("input");
|
|
5385
5508
|
if (!input || input.getAttribute("type") !== "number") {
|
|
5386
|
-
throw new Error(`${
|
|
5509
|
+
throw new Error(`${original2} must contain an input of type 'number'`);
|
|
5387
5510
|
}
|
|
5388
5511
|
if (!input.hasAttribute("type")) input.setAttribute("type", "number");
|
|
5389
5512
|
if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
|
|
@@ -5398,14 +5521,27 @@ function input_default(Alpine) {
|
|
|
5398
5521
|
input.setAttribute("autocorrect", "off");
|
|
5399
5522
|
input.setAttribute("spellcheck", "off");
|
|
5400
5523
|
input.setAttribute("data-slot", "input-number-control");
|
|
5401
|
-
input.classList.add("
|
|
5524
|
+
input.classList.add("size-full", "px-3", "py-1", "outline-none");
|
|
5402
5525
|
const stepDown = document.createElement("button");
|
|
5403
5526
|
stepDown.setAttribute("type", "button");
|
|
5404
5527
|
stepDown.setAttribute("tabIndex", "-1");
|
|
5405
5528
|
stepDown.setAttribute("aria-label", "Decrease");
|
|
5406
5529
|
stepDown.setAttribute("aria-controls", input.getAttribute("id"));
|
|
5407
5530
|
stepDown.setAttribute("data-slot", "step-up-trigger");
|
|
5531
|
+
stepDown.appendChild(
|
|
5532
|
+
createSvg({
|
|
5533
|
+
icon: Minus,
|
|
5534
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
5535
|
+
attrs: {
|
|
5536
|
+
"aria-hidden": true,
|
|
5537
|
+
role: "presentation"
|
|
5538
|
+
}
|
|
5539
|
+
})
|
|
5540
|
+
);
|
|
5408
5541
|
stepDown.classList.add(
|
|
5542
|
+
"inline-flex",
|
|
5543
|
+
"items-center",
|
|
5544
|
+
"justify-center",
|
|
5409
5545
|
"cursor-pointer",
|
|
5410
5546
|
"border-l",
|
|
5411
5547
|
"border-input",
|
|
@@ -5418,15 +5554,7 @@ function input_default(Alpine) {
|
|
|
5418
5554
|
"active:bg-secondary-active",
|
|
5419
5555
|
"outline-none",
|
|
5420
5556
|
"relative",
|
|
5421
|
-
"
|
|
5422
|
-
"before:opacity-70",
|
|
5423
|
-
"before:rounded-full",
|
|
5424
|
-
"before:h-0.5",
|
|
5425
|
-
"before:min-h-px",
|
|
5426
|
-
"before:w-3",
|
|
5427
|
-
"before:mx-auto",
|
|
5428
|
-
"before:bg-foreground",
|
|
5429
|
-
"before:hover:bg-secondary-foreground"
|
|
5557
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
5430
5558
|
);
|
|
5431
5559
|
el.appendChild(stepDown);
|
|
5432
5560
|
const onStepDown = () => {
|
|
@@ -5441,13 +5569,25 @@ function input_default(Alpine) {
|
|
|
5441
5569
|
stepUp.setAttribute("aria-label", "Increase");
|
|
5442
5570
|
stepUp.setAttribute("aria-controls", input.getAttribute("id"));
|
|
5443
5571
|
stepUp.setAttribute("data-slot", "step-up-trigger");
|
|
5572
|
+
stepUp.appendChild(
|
|
5573
|
+
createSvg({
|
|
5574
|
+
icon: Plus,
|
|
5575
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
5576
|
+
attrs: {
|
|
5577
|
+
"aria-hidden": true,
|
|
5578
|
+
role: "presentation"
|
|
5579
|
+
}
|
|
5580
|
+
})
|
|
5581
|
+
);
|
|
5444
5582
|
stepUp.classList.add(
|
|
5583
|
+
"inline-flex",
|
|
5584
|
+
"items-center",
|
|
5585
|
+
"justify-center",
|
|
5445
5586
|
"cursor-pointer",
|
|
5446
5587
|
"border-l",
|
|
5447
5588
|
"border-input",
|
|
5448
5589
|
"[input[aria-invalid=true]~&]:border-negative",
|
|
5449
5590
|
"[input:invalid~&]:border-negative",
|
|
5450
|
-
"rounded-r-control",
|
|
5451
5591
|
"h-full",
|
|
5452
5592
|
"aspect-square",
|
|
5453
5593
|
"bg-transparent",
|
|
@@ -5455,32 +5595,7 @@ function input_default(Alpine) {
|
|
|
5455
5595
|
"active:bg-secondary-active",
|
|
5456
5596
|
"outline-none",
|
|
5457
5597
|
"relative",
|
|
5458
|
-
"
|
|
5459
|
-
"before:opacity-70",
|
|
5460
|
-
"before:absolute",
|
|
5461
|
-
"before:rounded-full",
|
|
5462
|
-
"before:h-0.5",
|
|
5463
|
-
"before:min-h-px",
|
|
5464
|
-
"before:w-3",
|
|
5465
|
-
"before:top-1/2",
|
|
5466
|
-
"before:left-1/2",
|
|
5467
|
-
"before:-translate-x-1/2",
|
|
5468
|
-
"before:-translate-y-1/2",
|
|
5469
|
-
"before:bg-foreground",
|
|
5470
|
-
"before:hover:bg-secondary-foreground",
|
|
5471
|
-
"after:block",
|
|
5472
|
-
"after:opacity-70",
|
|
5473
|
-
"after:absolute",
|
|
5474
|
-
"after:rounded-full",
|
|
5475
|
-
"after:h-3",
|
|
5476
|
-
"after:min-w-px",
|
|
5477
|
-
"after:w-0.5",
|
|
5478
|
-
"after:top-1/2",
|
|
5479
|
-
"after:left-1/2",
|
|
5480
|
-
"after:-translate-x-1/2",
|
|
5481
|
-
"after:-translate-y-1/2",
|
|
5482
|
-
"after:bg-foreground",
|
|
5483
|
-
"after:hover:bg-secondary-foreground"
|
|
5598
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
5484
5599
|
);
|
|
5485
5600
|
el.appendChild(stepUp);
|
|
5486
5601
|
const onStepUp = () => {
|
|
@@ -5637,13 +5752,13 @@ function list_default(Alpine) {
|
|
|
5637
5752
|
el.setAttribute("data-slot", "list");
|
|
5638
5753
|
el.setAttribute("role", "group");
|
|
5639
5754
|
});
|
|
5640
|
-
Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
|
|
5755
|
+
Alpine.directive("h-list-header", (el, { original: original2 }, { Alpine: Alpine2 }) => {
|
|
5641
5756
|
el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
|
|
5642
5757
|
el.setAttribute("role", "presentation");
|
|
5643
5758
|
el.setAttribute("data-slot", "list-header");
|
|
5644
5759
|
const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
|
|
5645
5760
|
if (!list) {
|
|
5646
|
-
throw new Error(`${
|
|
5761
|
+
throw new Error(`${original2} must be placed inside a list element`);
|
|
5647
5762
|
}
|
|
5648
5763
|
if (!el.hasAttribute("id")) {
|
|
5649
5764
|
const id = `lbh${v4_default()}`;
|
|
@@ -5688,17 +5803,24 @@ function list_default(Alpine) {
|
|
|
5688
5803
|
function menu_default(Alpine) {
|
|
5689
5804
|
Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
|
|
5690
5805
|
el._menu_trigger = {
|
|
5691
|
-
isDropdown: modifiers.includes("dropdown")
|
|
5806
|
+
isDropdown: modifiers.includes("dropdown"),
|
|
5807
|
+
setOpen(open) {
|
|
5808
|
+
el.setAttribute("data-state", open ? "open" : "closed");
|
|
5809
|
+
}
|
|
5692
5810
|
};
|
|
5811
|
+
el.setAttribute("data-state", "closed");
|
|
5693
5812
|
});
|
|
5694
|
-
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
5813
|
+
Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
5814
|
+
if (el.tagName !== "UL") {
|
|
5815
|
+
throw new Error(`${original2} must be an ul element`);
|
|
5816
|
+
}
|
|
5695
5817
|
el.classList.add("hidden", "fixed", "bg-popover", "text-popover-foreground", "font-normal", "z-50", "min-w-[8rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "p-1", "shadow-md", "border", "outline-none");
|
|
5696
5818
|
el.setAttribute("role", "menu");
|
|
5697
5819
|
el.setAttribute("aria-orientation", "vertical");
|
|
5698
5820
|
el.setAttribute("tabindex", "-1");
|
|
5699
5821
|
el.setAttribute("data-slot", "menu");
|
|
5700
5822
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
5701
|
-
throw new Error(`${
|
|
5823
|
+
throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
5702
5824
|
}
|
|
5703
5825
|
const isSubmenu = modifiers.includes("sub");
|
|
5704
5826
|
const menuTrigger = (() => {
|
|
@@ -5710,7 +5832,7 @@ function menu_default(Alpine) {
|
|
|
5710
5832
|
return sibling;
|
|
5711
5833
|
})();
|
|
5712
5834
|
if (!isSubmenu && !menuTrigger) {
|
|
5713
|
-
throw new Error(`${
|
|
5835
|
+
throw new Error(`${original2} menu must be placed after a menu trigger element`);
|
|
5714
5836
|
}
|
|
5715
5837
|
let menuSubItem;
|
|
5716
5838
|
if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
|
|
@@ -5740,6 +5862,9 @@ function menu_default(Alpine) {
|
|
|
5740
5862
|
} else {
|
|
5741
5863
|
listenForTrigger(true);
|
|
5742
5864
|
if (focusTrigger) menuTrigger.focus();
|
|
5865
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
5866
|
+
menuTrigger._menu_trigger.setOpen(false);
|
|
5867
|
+
}
|
|
5743
5868
|
}
|
|
5744
5869
|
}
|
|
5745
5870
|
el._menu = { close };
|
|
@@ -5890,6 +6015,9 @@ function menu_default(Alpine) {
|
|
|
5890
6015
|
}
|
|
5891
6016
|
}
|
|
5892
6017
|
function openDropdown() {
|
|
6018
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
6019
|
+
menuTrigger._menu_trigger.setOpen(true);
|
|
6020
|
+
}
|
|
5893
6021
|
open(menuTrigger);
|
|
5894
6022
|
}
|
|
5895
6023
|
function onContextmenu(event) {
|
|
@@ -5923,7 +6051,10 @@ function menu_default(Alpine) {
|
|
|
5923
6051
|
el.removeEventListener("keydown", onKeyDown);
|
|
5924
6052
|
});
|
|
5925
6053
|
});
|
|
5926
|
-
Alpine.directive("h-menu-item", (el,
|
|
6054
|
+
Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
6055
|
+
if (el.tagName !== "LI") {
|
|
6056
|
+
throw new Error(`${original2} must be a li element`);
|
|
6057
|
+
}
|
|
5927
6058
|
el.classList.add(
|
|
5928
6059
|
"focus:bg-secondary-hover",
|
|
5929
6060
|
"focus:text-secondary-foreground",
|
|
@@ -5976,7 +6107,7 @@ function menu_default(Alpine) {
|
|
|
5976
6107
|
el.removeEventListener("mouseleave", focusOut);
|
|
5977
6108
|
});
|
|
5978
6109
|
});
|
|
5979
|
-
Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
6110
|
+
Alpine.directive("h-menu-sub", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
5980
6111
|
el.classList.add(
|
|
5981
6112
|
"focus:bg-secondary-hover",
|
|
5982
6113
|
"hover:bg-secondary-hover",
|
|
@@ -6008,7 +6139,7 @@ function menu_default(Alpine) {
|
|
|
6008
6139
|
const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
|
|
6009
6140
|
el.appendChild(chevronRight);
|
|
6010
6141
|
const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
|
|
6011
|
-
if (!parentMenu) throw new Error(`${
|
|
6142
|
+
if (!parentMenu) throw new Error(`${original2} must have a parent`);
|
|
6012
6143
|
el._menu_sub = {
|
|
6013
6144
|
open: void 0,
|
|
6014
6145
|
close: void 0,
|
|
@@ -6102,7 +6233,10 @@ function menu_default(Alpine) {
|
|
|
6102
6233
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
6103
6234
|
el.setAttribute("data-slot", "menu-label");
|
|
6104
6235
|
});
|
|
6105
|
-
Alpine.directive("h-menu-checkbox-item", (el,
|
|
6236
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
6237
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
6238
|
+
throw new Error(`${original2} must be a li or div element`);
|
|
6239
|
+
}
|
|
6106
6240
|
el.classList.add(
|
|
6107
6241
|
"focus:bg-secondary-hover",
|
|
6108
6242
|
"hover:bg-secondary-hover",
|
|
@@ -6167,7 +6301,10 @@ function menu_default(Alpine) {
|
|
|
6167
6301
|
el.removeEventListener("mouseleave", focusOut);
|
|
6168
6302
|
});
|
|
6169
6303
|
});
|
|
6170
|
-
Alpine.directive("h-menu-radio-item", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
6304
|
+
Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
6305
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
6306
|
+
throw new Error(`${original2} must be a li or div element`);
|
|
6307
|
+
}
|
|
6171
6308
|
el.classList.add(
|
|
6172
6309
|
"focus:bg-secondary-hover",
|
|
6173
6310
|
"hover:bg-secondary-hover",
|
|
@@ -6394,7 +6531,7 @@ function popover_default(Alpine) {
|
|
|
6394
6531
|
});
|
|
6395
6532
|
}
|
|
6396
6533
|
});
|
|
6397
|
-
Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
|
|
6534
|
+
Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
|
|
6398
6535
|
const popover = (() => {
|
|
6399
6536
|
let sibling = el.previousElementSibling;
|
|
6400
6537
|
while (sibling && !sibling.hasOwnProperty("_popover")) {
|
|
@@ -6403,7 +6540,7 @@ function popover_default(Alpine) {
|
|
|
6403
6540
|
return sibling;
|
|
6404
6541
|
})();
|
|
6405
6542
|
if (!popover) {
|
|
6406
|
-
throw new Error(`${
|
|
6543
|
+
throw new Error(`${original2} must be placed after a popover element`);
|
|
6407
6544
|
}
|
|
6408
6545
|
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-md", "border", "shadow-md", "outline-hidden", "overflow-scroll");
|
|
6409
6546
|
el.setAttribute("data-slot", "popover");
|
|
@@ -6556,7 +6693,7 @@ var FilterType = Object.freeze({
|
|
|
6556
6693
|
none: 3
|
|
6557
6694
|
});
|
|
6558
6695
|
function select_default(Alpine) {
|
|
6559
|
-
Alpine.directive("h-select", (el,
|
|
6696
|
+
Alpine.directive("h-select", (el, { modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
6560
6697
|
el._h_select = Alpine2.reactive({
|
|
6561
6698
|
id: void 0,
|
|
6562
6699
|
controls: `hsc${v4_default()}`,
|
|
@@ -6573,46 +6710,45 @@ function select_default(Alpine) {
|
|
|
6573
6710
|
set: void 0,
|
|
6574
6711
|
get: void 0
|
|
6575
6712
|
};
|
|
6576
|
-
el.classList.add(
|
|
6577
|
-
|
|
6578
|
-
"
|
|
6579
|
-
"
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
"
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
});
|
|
6713
|
+
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");
|
|
6714
|
+
if (modifiers.includes("table")) {
|
|
6715
|
+
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");
|
|
6716
|
+
el.setAttribute("data-slot", "cell-input-select");
|
|
6717
|
+
} else {
|
|
6718
|
+
el.classList.add(
|
|
6719
|
+
"border-input",
|
|
6720
|
+
"has-focus-visible:border-ring",
|
|
6721
|
+
"has-focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
6722
|
+
"has-focus-visible:ring-ring/50",
|
|
6723
|
+
"dark:has-[aria-invalid=true]:ring-negative/40",
|
|
6724
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
6725
|
+
"has-[aria-invalid=true]:border-negative",
|
|
6726
|
+
"has-[aria-invalid=true]:ring-negative/20",
|
|
6727
|
+
"has-[input:invalid]:border-negative",
|
|
6728
|
+
"has-[input:invalid]:ring-negative/20",
|
|
6729
|
+
"hover:bg-secondary-hover",
|
|
6730
|
+
"active:bg-secondary-active",
|
|
6731
|
+
"rounded-control",
|
|
6732
|
+
"border",
|
|
6733
|
+
"bg-input-inner",
|
|
6734
|
+
"text-sm",
|
|
6735
|
+
"whitespace-nowrap",
|
|
6736
|
+
"shadow-input"
|
|
6737
|
+
);
|
|
6738
|
+
el.setAttribute("data-slot", "select");
|
|
6739
|
+
const observer = sizeObserver(el);
|
|
6740
|
+
cleanup(() => {
|
|
6741
|
+
observer.disconnect();
|
|
6742
|
+
});
|
|
6743
|
+
}
|
|
6608
6744
|
});
|
|
6609
|
-
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6745
|
+
Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6610
6746
|
if (el.tagName !== "INPUT") {
|
|
6611
|
-
throw new Error(`${
|
|
6747
|
+
throw new Error(`${original2} must be a readonly input of type "text"`);
|
|
6612
6748
|
}
|
|
6613
6749
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
6614
6750
|
if (!select) {
|
|
6615
|
-
throw new Error(`${
|
|
6751
|
+
throw new Error(`${original2} must be inside a select element`);
|
|
6616
6752
|
} else if (el.hasOwnProperty("_x_model")) {
|
|
6617
6753
|
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
6618
6754
|
select._h_model.set = (value) => {
|
|
@@ -6865,10 +7001,10 @@ function select_default(Alpine) {
|
|
|
6865
7001
|
observer.disconnect();
|
|
6866
7002
|
});
|
|
6867
7003
|
});
|
|
6868
|
-
Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
7004
|
+
Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
6869
7005
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
6870
7006
|
if (!select) {
|
|
6871
|
-
throw new Error(`${
|
|
7007
|
+
throw new Error(`${original2} must be inside a select element`);
|
|
6872
7008
|
}
|
|
6873
7009
|
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "shadow-md");
|
|
6874
7010
|
el.setAttribute("data-slot", "select-content");
|
|
@@ -6879,7 +7015,7 @@ function select_default(Alpine) {
|
|
|
6879
7015
|
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
6880
7016
|
const control = select.querySelector(`#${select._h_select.id}`);
|
|
6881
7017
|
if (!control) {
|
|
6882
|
-
throw new Error(`${
|
|
7018
|
+
throw new Error(`${original2}: trigger not found`);
|
|
6883
7019
|
}
|
|
6884
7020
|
let autoUpdateCleanup;
|
|
6885
7021
|
function updatePosition() {
|
|
@@ -6921,10 +7057,10 @@ function select_default(Alpine) {
|
|
|
6921
7057
|
}
|
|
6922
7058
|
});
|
|
6923
7059
|
});
|
|
6924
|
-
Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7060
|
+
Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6925
7061
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
6926
7062
|
if (!select) {
|
|
6927
|
-
throw new Error(`${
|
|
7063
|
+
throw new Error(`${original2} must be inside an h-select element`);
|
|
6928
7064
|
} else {
|
|
6929
7065
|
select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
|
|
6930
7066
|
}
|
|
@@ -6996,10 +7132,10 @@ function select_default(Alpine) {
|
|
|
6996
7132
|
selectGroup._h_selectGroup.labelledby = id;
|
|
6997
7133
|
}
|
|
6998
7134
|
});
|
|
6999
|
-
Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
|
|
7135
|
+
Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
|
|
7000
7136
|
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
7001
7137
|
if (!select) {
|
|
7002
|
-
throw new Error(`${
|
|
7138
|
+
throw new Error(`${original2} must be inside an h-select element`);
|
|
7003
7139
|
}
|
|
7004
7140
|
el.classList.add(
|
|
7005
7141
|
"focus:bg-primary",
|
|
@@ -7284,6 +7420,11 @@ function sidebar_default(Alpine) {
|
|
|
7284
7420
|
"md:after:hidden",
|
|
7285
7421
|
"group-data-[collapsed=true]/sidebar:hidden"
|
|
7286
7422
|
);
|
|
7423
|
+
if (el.tagName !== "BUTTON") {
|
|
7424
|
+
el.setAttribute("role", "button");
|
|
7425
|
+
} else {
|
|
7426
|
+
el.setAttribute("type", "button");
|
|
7427
|
+
}
|
|
7287
7428
|
el.setAttribute("data-slot", "sidebar-group-action");
|
|
7288
7429
|
});
|
|
7289
7430
|
Alpine.directive("h-sidebar-group-content", (el) => {
|
|
@@ -7294,11 +7435,18 @@ function sidebar_default(Alpine) {
|
|
|
7294
7435
|
el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
|
|
7295
7436
|
el.setAttribute("data-slot", "sidebar-menu");
|
|
7296
7437
|
});
|
|
7297
|
-
Alpine.directive("h-sidebar-menu-item", (el) => {
|
|
7438
|
+
Alpine.directive("h-sidebar-menu-item", (el, { original: original2 }) => {
|
|
7439
|
+
if (el.tagName !== "BUTTON") {
|
|
7440
|
+
throw new Error(`${original2} must be a button`);
|
|
7441
|
+
}
|
|
7298
7442
|
el.classList.add("group/menu-item", "relative");
|
|
7443
|
+
el.setAttribute("type", "button");
|
|
7299
7444
|
el.setAttribute("data-slot", "sidebar-menu-item");
|
|
7300
7445
|
});
|
|
7301
7446
|
Alpine.directive("h-sidebar-menu-button", (el) => {
|
|
7447
|
+
if (el.tagName !== "BUTTON") {
|
|
7448
|
+
throw new Error(`${original} must be a button`);
|
|
7449
|
+
}
|
|
7302
7450
|
el.classList.add(
|
|
7303
7451
|
"peer/menu-button",
|
|
7304
7452
|
"flex",
|
|
@@ -7338,6 +7486,7 @@ function sidebar_default(Alpine) {
|
|
|
7338
7486
|
"[&>svg]:shrink-0",
|
|
7339
7487
|
"[&>svg:not(:first-child):last-child]:ml-auto"
|
|
7340
7488
|
);
|
|
7489
|
+
el.setAttribute("type", "button");
|
|
7341
7490
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
|
|
7342
7491
|
const sizes = {
|
|
7343
7492
|
default: ["h-8", "text-sm"],
|
|
@@ -7385,6 +7534,11 @@ function sidebar_default(Alpine) {
|
|
|
7385
7534
|
if (modifiers.includes("autohide")) {
|
|
7386
7535
|
el.classList.add("peer-data-[active=true]/menu-button:text-sidebar-secondary-foreground", "group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
|
|
7387
7536
|
}
|
|
7537
|
+
if (el.tagName !== "BUTTON") {
|
|
7538
|
+
el.setAttribute("role", "button");
|
|
7539
|
+
} else {
|
|
7540
|
+
el.setAttribute("type", "button");
|
|
7541
|
+
}
|
|
7388
7542
|
el.setAttribute("data-slot", "sidebar-menu-action");
|
|
7389
7543
|
});
|
|
7390
7544
|
Alpine.directive("h-sidebar-menu-badge", (el) => {
|
|
@@ -7432,7 +7586,7 @@ function sidebar_default(Alpine) {
|
|
|
7432
7586
|
el.setAttribute("role", "none");
|
|
7433
7587
|
});
|
|
7434
7588
|
Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
|
|
7435
|
-
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar
|
|
7589
|
+
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
|
|
7436
7590
|
if (!modifiers.includes("flat")) {
|
|
7437
7591
|
el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
|
|
7438
7592
|
}
|
|
@@ -7443,6 +7597,9 @@ function sidebar_default(Alpine) {
|
|
|
7443
7597
|
el.setAttribute("data-slot", "sidebar-menu-sub-item");
|
|
7444
7598
|
});
|
|
7445
7599
|
Alpine.directive("h-sidebar-menu-sub-button", (el) => {
|
|
7600
|
+
if (el.tagName !== "BUTTON") {
|
|
7601
|
+
throw new Error(`${original} must be a button`);
|
|
7602
|
+
}
|
|
7446
7603
|
el.classList.add(
|
|
7447
7604
|
"text-sidebar-foreground",
|
|
7448
7605
|
"ring-sidebar-ring",
|
|
@@ -7477,6 +7634,7 @@ function sidebar_default(Alpine) {
|
|
|
7477
7634
|
"data-[active=true]:text-sidebar-primary-foreground",
|
|
7478
7635
|
"group-data-[collapsed=true]/sidebar:hidden"
|
|
7479
7636
|
);
|
|
7637
|
+
el.setAttribute("type", "button");
|
|
7480
7638
|
el.setAttribute("data-slot", "sidebar-menu-sub-button");
|
|
7481
7639
|
const sizes = {
|
|
7482
7640
|
sm: ["text-xs"],
|
|
@@ -7548,18 +7706,212 @@ function spinner_default(Alpine) {
|
|
|
7548
7706
|
|
|
7549
7707
|
// src/components/split.js
|
|
7550
7708
|
function split_default(Alpine) {
|
|
7551
|
-
Alpine.directive("h-split", (el) => {
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7709
|
+
Alpine.directive("h-split", (el, {}, { cleanup, Alpine: Alpine2 }) => {
|
|
7710
|
+
const panels = [];
|
|
7711
|
+
const state = Alpine2.reactive({
|
|
7712
|
+
isHorizontal: el.getAttribute("data-orientation") === "horizontal",
|
|
7713
|
+
isBorder: el.getAttribute("data-variant") === "border"
|
|
7714
|
+
});
|
|
7715
|
+
const storageKey = el.getAttribute("data-key");
|
|
7716
|
+
const loadSizes = () => {
|
|
7717
|
+
if (!storageKey) return null;
|
|
7718
|
+
try {
|
|
7719
|
+
const raw = localStorage.getItem(storageKey);
|
|
7720
|
+
if (!raw) return null;
|
|
7721
|
+
return JSON.parse(raw);
|
|
7722
|
+
} catch {
|
|
7723
|
+
return null;
|
|
7724
|
+
}
|
|
7725
|
+
};
|
|
7726
|
+
let saveTimer = null;
|
|
7727
|
+
const SAVE_DELAY = 200;
|
|
7728
|
+
const saveSizes = () => {
|
|
7729
|
+
if (!storageKey) return;
|
|
7730
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7731
|
+
saveTimer = setTimeout(() => {
|
|
7732
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7733
|
+
const sizes = visible.map((p) => p.size / usableSize());
|
|
7734
|
+
localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
7735
|
+
saveTimer = null;
|
|
7736
|
+
}, SAVE_DELAY);
|
|
7737
|
+
};
|
|
7738
|
+
const sizeProp = () => state.isHorizontal ? "width" : "height";
|
|
7739
|
+
const containerSize = () => state.isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
|
|
7740
|
+
const gutterSize = () => {
|
|
7741
|
+
const panel = panels.find((p) => p.gutter.parentElement);
|
|
7742
|
+
if (panel) {
|
|
7743
|
+
return panel.gutter.getBoundingClientRect()[sizeProp()] ?? 0;
|
|
7744
|
+
}
|
|
7745
|
+
return 0;
|
|
7746
|
+
};
|
|
7747
|
+
const usableSize = () => {
|
|
7748
|
+
const visiblePanels = panels.filter((p) => !p.hidden);
|
|
7749
|
+
const gutters = Math.max(0, visiblePanels.length - 1);
|
|
7750
|
+
return containerSize() - gutters * gutterSize();
|
|
7751
|
+
};
|
|
7752
|
+
const normalize = (value) => {
|
|
7753
|
+
if (value == null) return null;
|
|
7754
|
+
if (typeof value === "number") return value;
|
|
7755
|
+
if (value.endsWith("%")) {
|
|
7756
|
+
return parseFloat(value) / 100 * usableSize();
|
|
7757
|
+
}
|
|
7758
|
+
return parseFloat(value);
|
|
7759
|
+
};
|
|
7760
|
+
let initialized = false;
|
|
7761
|
+
const DELTA_ABS = 0.01;
|
|
7762
|
+
const layout = () => {
|
|
7763
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7764
|
+
if (!visible.length) return;
|
|
7765
|
+
const total = usableSize();
|
|
7766
|
+
if (!initialized) {
|
|
7767
|
+
initialized = true;
|
|
7768
|
+
const visible2 = panels.filter((p) => !p.hidden);
|
|
7769
|
+
const stored = loadSizes();
|
|
7770
|
+
if (stored && stored.length === visible2.length) {
|
|
7771
|
+
visible2.forEach((p, i) => {
|
|
7772
|
+
p.size = stored[i] * usableSize();
|
|
7773
|
+
p.explicit = true;
|
|
7774
|
+
});
|
|
7775
|
+
} else {
|
|
7776
|
+
const explicitTotal = visible2.filter((p) => p.explicit).reduce((sum, p) => sum + p.declaredSize, 0);
|
|
7777
|
+
const autoPanels = visible2.filter((p) => !p.explicit);
|
|
7778
|
+
const remaining = total - explicitTotal;
|
|
7779
|
+
const share = autoPanels.length ? remaining / autoPanels.length : 0;
|
|
7780
|
+
visible2.forEach((p) => {
|
|
7781
|
+
if (p.explicit) {
|
|
7782
|
+
p.size = p.declaredSize;
|
|
7783
|
+
} else {
|
|
7784
|
+
p.size = share;
|
|
7785
|
+
}
|
|
7786
|
+
p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
|
|
7787
|
+
});
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
visible.forEach((p) => {
|
|
7791
|
+
if (p.size == null) {
|
|
7792
|
+
p.size = p.min ?? 0;
|
|
7793
|
+
}
|
|
7794
|
+
p.size = Math.min(Math.max(p.size, p.min), p.max);
|
|
7795
|
+
});
|
|
7796
|
+
let currentTotal = visible.reduce((sum, p) => sum + p.size, 0);
|
|
7797
|
+
let delta = total - currentTotal;
|
|
7798
|
+
if (Math.abs(delta) < DELTA_ABS) {
|
|
7799
|
+
visible.forEach((p) => p.apply());
|
|
7800
|
+
return;
|
|
7801
|
+
}
|
|
7802
|
+
let flexible = visible.filter((p) => {
|
|
7803
|
+
if (p.collapsed) return false;
|
|
7804
|
+
if (delta > 0) {
|
|
7805
|
+
return p.size < p.max;
|
|
7806
|
+
} else {
|
|
7807
|
+
return p.size > p.min;
|
|
7808
|
+
}
|
|
7809
|
+
});
|
|
7810
|
+
while (flexible.length && Math.abs(delta) > DELTA_ABS) {
|
|
7811
|
+
const share = delta / flexible.length;
|
|
7812
|
+
let consumed = 0;
|
|
7813
|
+
const nextFlexible = [];
|
|
7814
|
+
flexible.forEach((p) => {
|
|
7815
|
+
const proposed = p.size + share;
|
|
7816
|
+
const clamped = Math.min(Math.max(proposed, p.min), p.max);
|
|
7817
|
+
const actualChange = clamped - p.size;
|
|
7818
|
+
if (Math.abs(actualChange) > DELTA_ABS) {
|
|
7819
|
+
p.size = clamped;
|
|
7820
|
+
consumed += actualChange;
|
|
7821
|
+
}
|
|
7822
|
+
if (delta > 0) {
|
|
7823
|
+
if (p.size < p.max) nextFlexible.push(p);
|
|
7824
|
+
} else {
|
|
7825
|
+
if (p.size > p.min) nextFlexible.push(p);
|
|
7826
|
+
}
|
|
7827
|
+
});
|
|
7828
|
+
delta -= consumed;
|
|
7829
|
+
flexible = nextFlexible;
|
|
7830
|
+
if (Math.abs(consumed) < DELTA_ABS) break;
|
|
7831
|
+
}
|
|
7832
|
+
visible.forEach((p) => p.apply());
|
|
7833
|
+
};
|
|
7834
|
+
let layoutFrame = null;
|
|
7835
|
+
const queueLayout = () => {
|
|
7836
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7837
|
+
layoutFrame = requestAnimationFrame(() => {
|
|
7838
|
+
layout();
|
|
7839
|
+
saveSizes();
|
|
7840
|
+
layoutFrame = null;
|
|
7841
|
+
});
|
|
7842
|
+
};
|
|
7843
|
+
const refreshGutters = () => {
|
|
7844
|
+
panels.forEach((p, i) => p.setGutter(i === panels.length - 1));
|
|
7845
|
+
};
|
|
7846
|
+
el._h_split = {
|
|
7847
|
+
state,
|
|
7848
|
+
panels,
|
|
7849
|
+
addPanel(panel) {
|
|
7850
|
+
panels.push(panel);
|
|
7851
|
+
if (panel.size == null) {
|
|
7852
|
+
panel.size = null;
|
|
7853
|
+
}
|
|
7854
|
+
initialized = false;
|
|
7855
|
+
refreshGutters();
|
|
7856
|
+
queueLayout();
|
|
7857
|
+
},
|
|
7858
|
+
removePanel(panel) {
|
|
7859
|
+
const i = panels.indexOf(panel);
|
|
7860
|
+
if (i !== -1) panels.splice(i, 1);
|
|
7861
|
+
initialized = false;
|
|
7862
|
+
refreshGutters();
|
|
7863
|
+
queueLayout();
|
|
7864
|
+
},
|
|
7865
|
+
panelHidden() {
|
|
7866
|
+
initialized = false;
|
|
7867
|
+
refreshGutters();
|
|
7868
|
+
queueLayout();
|
|
7869
|
+
},
|
|
7870
|
+
panelChange() {
|
|
7871
|
+
queueLayout();
|
|
7872
|
+
},
|
|
7873
|
+
normalize,
|
|
7874
|
+
saveSizes
|
|
7875
|
+
};
|
|
7876
|
+
el.classList.add("flex", "flex-1", "min-w-0", "min-h-0", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
|
|
7877
|
+
const observer = new MutationObserver((mutations) => {
|
|
7878
|
+
mutations.forEach((mutation) => {
|
|
7879
|
+
if (mutation.attributeName === "data-orientation") {
|
|
7880
|
+
state.isHorizontal = el.getAttribute("data-orientation") === "horizontal";
|
|
7881
|
+
queueLayout();
|
|
7882
|
+
} else if (mutation.attributeName === "data-variant") {
|
|
7883
|
+
state.isBorder = el.getAttribute("data-variant") === "border";
|
|
7884
|
+
queueLayout();
|
|
7885
|
+
} else {
|
|
7886
|
+
panels.forEach((p) => p.setLocked(el.getAttribute("data-locked") === "true"));
|
|
7887
|
+
}
|
|
7888
|
+
});
|
|
7889
|
+
});
|
|
7890
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-orientation", "data-variant", "data-locked"] });
|
|
7891
|
+
const containerObserver = new ResizeObserver(queueLayout);
|
|
7892
|
+
containerObserver.observe(el);
|
|
7893
|
+
cleanup(() => {
|
|
7894
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7895
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7896
|
+
containerObserver.disconnect();
|
|
7897
|
+
observer.disconnect();
|
|
7898
|
+
});
|
|
7555
7899
|
});
|
|
7556
|
-
Alpine.directive("h-split-panel", (el) => {
|
|
7557
|
-
el.
|
|
7900
|
+
Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7901
|
+
const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
|
|
7902
|
+
if (!split) {
|
|
7903
|
+
throw new Error(`${original2} must be inside an split element`);
|
|
7904
|
+
}
|
|
7905
|
+
el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
|
|
7558
7906
|
el.setAttribute("tabindex", "-1");
|
|
7559
7907
|
el.setAttribute("data-slot", "split-panel");
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
el.
|
|
7908
|
+
const gutter = document.createElement("span");
|
|
7909
|
+
gutter.setAttribute("data-slot", "split-gutter");
|
|
7910
|
+
gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
|
|
7911
|
+
gutter.setAttribute("tabindex", "-1");
|
|
7912
|
+
gutter.setAttribute("role", "separator");
|
|
7913
|
+
gutter.classList.add(
|
|
7914
|
+
"overflow-visible",
|
|
7563
7915
|
"relative",
|
|
7564
7916
|
"shrink-0",
|
|
7565
7917
|
"touch-none",
|
|
@@ -7567,15 +7919,8 @@ function split_default(Alpine) {
|
|
|
7567
7919
|
"outline-none",
|
|
7568
7920
|
"hover:bg-primary-hover",
|
|
7569
7921
|
"active:bg-primary-active",
|
|
7570
|
-
"before:absolute",
|
|
7571
|
-
"before:top-1/2",
|
|
7572
|
-
"before:left-1/2",
|
|
7573
|
-
"before:-translate-x-1/2",
|
|
7574
|
-
"before:-translate-y-1/2",
|
|
7575
|
-
"before:block",
|
|
7576
|
-
"before:bg-transparent",
|
|
7577
7922
|
"hover:before:bg-primary-hover",
|
|
7578
|
-
"
|
|
7923
|
+
"aria-disabled:pointer-events-none",
|
|
7579
7924
|
"[[data-orientation=horizontal]>&]:cursor-col-resize",
|
|
7580
7925
|
"[[data-orientation=vertical]>&]:cursor-row-resize"
|
|
7581
7926
|
);
|
|
@@ -7585,19 +7930,23 @@ function split_default(Alpine) {
|
|
|
7585
7930
|
"hover:bg-primary-hover",
|
|
7586
7931
|
"active:bg-primary-active",
|
|
7587
7932
|
"before:absolute",
|
|
7588
|
-
"before:top-1/2",
|
|
7589
|
-
"before:left-1/2",
|
|
7590
|
-
"before:-translate-x-1/2",
|
|
7591
|
-
"before:-translate-y-1/2",
|
|
7592
7933
|
"before:block",
|
|
7593
7934
|
"before:bg-transparent",
|
|
7594
7935
|
"hover:before:bg-primary-hover",
|
|
7936
|
+
"[[data-orientation=horizontal]>&]:before:-translate-x-1/2",
|
|
7937
|
+
"[[data-orientation=horizontal]>&[data-edge=end]]:before:-translate-x-1",
|
|
7938
|
+
"[[data-orientation=horizontal]>&[data-edge=start]]:before:translate-x-0",
|
|
7939
|
+
"[[data-orientation=horizontal]>&]:before:left-1/2",
|
|
7595
7940
|
"[[data-orientation=horizontal]>&]:!w-px",
|
|
7596
7941
|
"[[data-orientation=horizontal]>&]:before:h-full",
|
|
7597
|
-
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1
|
|
7942
|
+
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1)]",
|
|
7943
|
+
"[[data-orientation=vertical]>&]:before:-translate-y-1/2",
|
|
7944
|
+
"[[data-orientation=vertical]>&[data-edge=end]]:before:-translate-y-1",
|
|
7945
|
+
"[[data-orientation=vertical]>&[data-edge=start]]:before:translate-y-0",
|
|
7946
|
+
"[[data-orientation=vertical]>&]:before:top-1/2",
|
|
7598
7947
|
"[[data-orientation=vertical]>&]:!h-px",
|
|
7599
7948
|
"[[data-orientation=vertical]>&]:before:w-full",
|
|
7600
|
-
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1
|
|
7949
|
+
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1)]"
|
|
7601
7950
|
];
|
|
7602
7951
|
const handleClasses = [
|
|
7603
7952
|
"bg-transparent",
|
|
@@ -7646,24 +7995,175 @@ function split_default(Alpine) {
|
|
|
7646
7995
|
"[[data-orientation=vertical]>&]:after:w-5",
|
|
7647
7996
|
"[[data-orientation=vertical]>&]:after:h-2.5"
|
|
7648
7997
|
];
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
if (variant === "border") {
|
|
7654
|
-
el.classList.remove(...handleClasses);
|
|
7655
|
-
el.classList.add(...borderClasses);
|
|
7998
|
+
const setVariant = () => {
|
|
7999
|
+
if (split._h_split.state.isBorder) {
|
|
8000
|
+
gutter.classList.remove(...handleClasses);
|
|
8001
|
+
gutter.classList.add(...borderClasses);
|
|
7656
8002
|
} else {
|
|
7657
|
-
|
|
7658
|
-
|
|
8003
|
+
gutter.classList.remove(...borderClasses);
|
|
8004
|
+
gutter.classList.add(...handleClasses);
|
|
7659
8005
|
}
|
|
7660
|
-
}
|
|
7661
|
-
|
|
7662
|
-
|
|
8006
|
+
};
|
|
8007
|
+
setVariant();
|
|
8008
|
+
effect(setVariant);
|
|
8009
|
+
const initialSize = split._h_split.normalize(el.getAttribute("data-size"));
|
|
8010
|
+
let handleSize = 0;
|
|
8011
|
+
const panel = {
|
|
8012
|
+
el,
|
|
8013
|
+
gutter,
|
|
8014
|
+
hidden: el.getAttribute("data-hidden") === "true",
|
|
8015
|
+
declaredSize: initialSize,
|
|
8016
|
+
size: initialSize,
|
|
8017
|
+
explicit: initialSize != null,
|
|
8018
|
+
min: split._h_split.normalize(el.getAttribute("data-min")) ?? 0,
|
|
8019
|
+
max: split._h_split.normalize(el.getAttribute("data-max")) ?? Infinity,
|
|
8020
|
+
collapsed: false,
|
|
8021
|
+
prevSize: null,
|
|
8022
|
+
apply() {
|
|
8023
|
+
el.style.flexBasis = `${this.size.toFixed(2)}px`;
|
|
8024
|
+
if (split._h_split.state.isBorder) {
|
|
8025
|
+
this.setHandleOffset();
|
|
8026
|
+
}
|
|
8027
|
+
},
|
|
8028
|
+
setGutter(last) {
|
|
8029
|
+
if (this.hidden || last) {
|
|
8030
|
+
gutter.remove();
|
|
8031
|
+
} else if (!gutter.parentElement) {
|
|
8032
|
+
el.after(gutter);
|
|
8033
|
+
handleSize = this.getHandleSize();
|
|
8034
|
+
}
|
|
8035
|
+
},
|
|
8036
|
+
setHandleOffset() {
|
|
8037
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
8038
|
+
const index = panels.indexOf(panel);
|
|
8039
|
+
const next = panels[index + 1];
|
|
8040
|
+
if (!next) return;
|
|
8041
|
+
if (next.size < handleSize) {
|
|
8042
|
+
gutter.setAttribute("data-edge", "end");
|
|
8043
|
+
} else if (this.size < handleSize) {
|
|
8044
|
+
gutter.setAttribute("data-edge", "start");
|
|
8045
|
+
} else {
|
|
8046
|
+
gutter.removeAttribute("data-edge");
|
|
8047
|
+
}
|
|
8048
|
+
},
|
|
8049
|
+
getHandleSize() {
|
|
8050
|
+
if (split._h_split.state.isBorder) {
|
|
8051
|
+
const beforeStyle = window.getComputedStyle(gutter, "::before");
|
|
8052
|
+
return Number(beforeStyle[split._h_split.state.isHorizontal ? "width" : "height"].replace("px", "")) / 2;
|
|
8053
|
+
} else {
|
|
8054
|
+
return 0;
|
|
8055
|
+
}
|
|
8056
|
+
},
|
|
8057
|
+
setLocked(locked = false) {
|
|
8058
|
+
const panelLocked = el.getAttribute("data-locked") === "true";
|
|
8059
|
+
if (locked) {
|
|
8060
|
+
gutter.classList.add("pointer-events-none");
|
|
8061
|
+
} else if (panelLocked) {
|
|
8062
|
+
gutter.classList.add("pointer-events-none");
|
|
8063
|
+
} else {
|
|
8064
|
+
gutter.classList.remove("pointer-events-none");
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
};
|
|
8068
|
+
split._h_split.addPanel(panel);
|
|
8069
|
+
const drag = (e) => {
|
|
8070
|
+
e.preventDefault();
|
|
8071
|
+
gutter.setPointerCapture(e.pointerId);
|
|
8072
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
8073
|
+
const index = panels.indexOf(panel);
|
|
8074
|
+
const next = panels[index + 1];
|
|
8075
|
+
if (!next) return;
|
|
8076
|
+
const startPos = split._h_split.state.isHorizontal ? e.clientX : e.clientY;
|
|
8077
|
+
const startA = panel.size;
|
|
8078
|
+
const startB = next.size;
|
|
8079
|
+
const minDelta = Math.max(
|
|
8080
|
+
panel.min - startA,
|
|
8081
|
+
// how much panel A can shrink
|
|
8082
|
+
startB - next.max
|
|
8083
|
+
// how much panel B can grow
|
|
8084
|
+
);
|
|
8085
|
+
const maxDelta = Math.min(
|
|
8086
|
+
panel.max - startA,
|
|
8087
|
+
// how much panel A can grow
|
|
8088
|
+
startB - next.min
|
|
8089
|
+
// how much panel B can shrink
|
|
8090
|
+
);
|
|
8091
|
+
const move = (e2) => {
|
|
8092
|
+
const currentPos = split._h_split.state.isHorizontal ? e2.clientX : e2.clientY;
|
|
8093
|
+
const delta = currentPos - startPos;
|
|
8094
|
+
const clamped = Math.min(maxDelta, Math.max(minDelta, delta));
|
|
8095
|
+
panel.size = startA + clamped;
|
|
8096
|
+
next.size = startB - clamped;
|
|
8097
|
+
panel.explicit = false;
|
|
8098
|
+
if (panel.collapsed) {
|
|
8099
|
+
panel.collapsed = false;
|
|
8100
|
+
}
|
|
8101
|
+
if (next.collapsed) {
|
|
8102
|
+
next.collapsed = false;
|
|
8103
|
+
}
|
|
8104
|
+
split._h_split.panelChange();
|
|
8105
|
+
};
|
|
8106
|
+
const up = () => {
|
|
8107
|
+
gutter.releasePointerCapture(e.pointerId);
|
|
8108
|
+
gutter.removeEventListener("pointermove", move);
|
|
8109
|
+
gutter.removeEventListener("pointerup", up);
|
|
8110
|
+
};
|
|
8111
|
+
gutter.addEventListener("pointermove", move);
|
|
8112
|
+
gutter.addEventListener("pointerup", up);
|
|
8113
|
+
};
|
|
8114
|
+
gutter.addEventListener("pointerdown", drag);
|
|
8115
|
+
const collapse = () => {
|
|
8116
|
+
if (panel.collapsed) return;
|
|
8117
|
+
panel.prevSize = panel.size;
|
|
8118
|
+
panel.size = panel.min ?? 0;
|
|
8119
|
+
panel.collapsed = true;
|
|
8120
|
+
panel.explicit = true;
|
|
8121
|
+
split._h_split.panelChange();
|
|
8122
|
+
};
|
|
8123
|
+
const expand = () => {
|
|
8124
|
+
if (!panel.collapsed) return;
|
|
8125
|
+
const target = panel.prevSize ?? panel.min ?? 0;
|
|
8126
|
+
const delta = target - panel.size;
|
|
8127
|
+
const visible = split._h_split.panels.filter((p) => !p.hidden && p !== panel);
|
|
8128
|
+
let remaining = delta;
|
|
8129
|
+
for (const p of visible) {
|
|
8130
|
+
const available = p.size - p.min;
|
|
8131
|
+
const take = Math.min(available, remaining);
|
|
8132
|
+
p.size -= take;
|
|
8133
|
+
remaining -= take;
|
|
8134
|
+
if (remaining <= 0) break;
|
|
8135
|
+
}
|
|
8136
|
+
panel.size = target - remaining;
|
|
8137
|
+
panel.collapsed = false;
|
|
8138
|
+
panel.explicit = true;
|
|
8139
|
+
split._h_split.panelChange();
|
|
8140
|
+
};
|
|
8141
|
+
const observer = new MutationObserver((mutations) => {
|
|
8142
|
+
mutations.forEach((mutation) => {
|
|
8143
|
+
if (mutation.attributeName === "data-hidden") {
|
|
8144
|
+
panel.hidden = el.getAttribute("data-hidden") === "true";
|
|
8145
|
+
if (panel.hidden) {
|
|
8146
|
+
el.classList.add("hidden");
|
|
8147
|
+
} else {
|
|
8148
|
+
el.classList.remove("hidden");
|
|
8149
|
+
}
|
|
8150
|
+
split._h_split.panelHidden();
|
|
8151
|
+
} else if (mutation.attributeName === "data-locked") {
|
|
8152
|
+
panel.setLocked();
|
|
8153
|
+
} else {
|
|
8154
|
+
if (el.getAttribute("data-collapse") === "true") {
|
|
8155
|
+
collapse();
|
|
8156
|
+
} else {
|
|
8157
|
+
expand();
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
});
|
|
7663
8161
|
});
|
|
7664
|
-
observer.observe(el
|
|
7665
|
-
setVariant(el.parentElement.getAttribute("data-variant"));
|
|
8162
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
|
|
7666
8163
|
cleanup(() => {
|
|
8164
|
+
gutter.remove();
|
|
8165
|
+
gutter.removeEventListener("pointerdown", drag);
|
|
8166
|
+
split._h_split.removePanel(panel);
|
|
7667
8167
|
observer.disconnect();
|
|
7668
8168
|
});
|
|
7669
8169
|
});
|
|
@@ -7725,7 +8225,18 @@ function switch_default(Alpine) {
|
|
|
7725
8225
|
function table_default(Alpine) {
|
|
7726
8226
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
7727
8227
|
if (modifiers.includes("scroll")) {
|
|
7728
|
-
el.classList.add(
|
|
8228
|
+
el.classList.add(
|
|
8229
|
+
"overflow-scroll",
|
|
8230
|
+
"[&_thead[data-slot|=table]]:sticky",
|
|
8231
|
+
"[&_thead[data-slot|=table]]:top-0",
|
|
8232
|
+
"[&_thead[data-slot|=table]]:z-2",
|
|
8233
|
+
"[&_tfoot[data-slot|=table]]:sticky",
|
|
8234
|
+
"[&_tfoot[data-slot|=table]]:bottom-0",
|
|
8235
|
+
"[&_tfoot[data-slot|=table]]:z-2",
|
|
8236
|
+
"[&_tbody_tr_th[data-slot|=table]]:sticky",
|
|
8237
|
+
"[&_tbody_tr_th[data-slot|=table]]:left-0",
|
|
8238
|
+
"[&_tbody_tr_th[data-slot|=table]]:z-1"
|
|
8239
|
+
);
|
|
7729
8240
|
} else {
|
|
7730
8241
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
7731
8242
|
}
|
|
@@ -7740,13 +8251,19 @@ function table_default(Alpine) {
|
|
|
7740
8251
|
el.setAttribute("data-slot", "table");
|
|
7741
8252
|
switch (el.getAttribute("data-borders")) {
|
|
7742
8253
|
case "rows":
|
|
7743
|
-
el.classList.add("[&_tr_td]:border-b", "[&_tr_th]:border-b", "first:[&_tfoot_tr_td]:border-t", "first:[&_tfoot_tr_th]:border-t");
|
|
8254
|
+
el.classList.add("[&_tr_td[data-slot|=table]]:border-b", "[&_tr_th[data-slot|=table]]:border-b", "first:[&_tfoot_tr_td[data-slot|=table]]:border-t", "first:[&_tfoot_tr_th[data-slot|=table]]:border-t");
|
|
7744
8255
|
break;
|
|
7745
8256
|
case "columns":
|
|
7746
|
-
el.classList.add("[&_tr]:divide-x");
|
|
8257
|
+
el.classList.add("[&_tr[data-slot|=table]]:divide-x");
|
|
7747
8258
|
break;
|
|
7748
8259
|
case "both":
|
|
7749
|
-
el.classList.add(
|
|
8260
|
+
el.classList.add(
|
|
8261
|
+
"[&_tr_td[data-slot|=table]]:border-b",
|
|
8262
|
+
"[&_tr_th[data-slot|=table]]:border-b",
|
|
8263
|
+
"first:[&_tfoot_tr_td[data-slot|=table]]:border-t",
|
|
8264
|
+
"first:[&_tfoot_tr_th[data-slot|=table]]:border-t",
|
|
8265
|
+
"[&_tr[data-slot|=table]]:divide-x"
|
|
8266
|
+
);
|
|
7750
8267
|
break;
|
|
7751
8268
|
}
|
|
7752
8269
|
});
|
|
@@ -7776,6 +8293,7 @@ function table_default(Alpine) {
|
|
|
7776
8293
|
Alpine.directive("h-table-cell", (el) => {
|
|
7777
8294
|
el.classList.add(
|
|
7778
8295
|
"p-2",
|
|
8296
|
+
"[&:has([data-slot|=cell-input])]:p-0",
|
|
7779
8297
|
"align-middle",
|
|
7780
8298
|
"whitespace-nowrap",
|
|
7781
8299
|
"[&:has([role=checkbox])]:pr-0",
|
|
@@ -7788,15 +8306,47 @@ function table_default(Alpine) {
|
|
|
7788
8306
|
);
|
|
7789
8307
|
el.setAttribute("data-slot", "table-cell");
|
|
7790
8308
|
});
|
|
8309
|
+
Alpine.directive("h-table-cell-button", (el) => {
|
|
8310
|
+
el.classList.add(
|
|
8311
|
+
"px-2",
|
|
8312
|
+
"size-full",
|
|
8313
|
+
"h-10",
|
|
8314
|
+
"cursor-pointer",
|
|
8315
|
+
"inline-flex",
|
|
8316
|
+
"items-center",
|
|
8317
|
+
"justify-between",
|
|
8318
|
+
"outline-none",
|
|
8319
|
+
"gap-2",
|
|
8320
|
+
"transition-[color,box-shadow]",
|
|
8321
|
+
"[&_svg]:pointer-events-none",
|
|
8322
|
+
"[&_svg]:opacity-70",
|
|
8323
|
+
"[&_svg]:text-foreground",
|
|
8324
|
+
"[&_svg]:transition-transform",
|
|
8325
|
+
"[&_svg]:duration-200",
|
|
8326
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
8327
|
+
"shrink-0",
|
|
8328
|
+
"[&_svg]:shrink-0",
|
|
8329
|
+
"focus-visible:inset-ring-ring/50",
|
|
8330
|
+
"focus-visible:inset-ring-2",
|
|
8331
|
+
"hover:bg-table-hover",
|
|
8332
|
+
"hover:text-table-hover-foreground",
|
|
8333
|
+
"active:!bg-table-active",
|
|
8334
|
+
"active:!text-table-active-foreground",
|
|
8335
|
+
"[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180",
|
|
8336
|
+
"[&[data-state=open]>svg:only-child]:rotate-180"
|
|
8337
|
+
);
|
|
8338
|
+
el.setAttribute("type", "button");
|
|
8339
|
+
el.setAttribute("data-slot", "cell-input-button");
|
|
8340
|
+
});
|
|
7791
8341
|
Alpine.directive("h-table-body", (el) => {
|
|
7792
8342
|
el.classList.add(
|
|
7793
|
-
"[&_tr:last-child_td]:border-b-0",
|
|
7794
|
-
"[&_tr:last-child_th]:border-b-0",
|
|
7795
|
-
"[&_tr_th]:bg-table-header",
|
|
7796
|
-
"[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
|
|
7797
|
-
"[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
|
|
7798
|
-
"[&_tr[data-activable=true]:active_th]:!bg-table-active",
|
|
7799
|
-
"[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
|
|
8343
|
+
"[&_tr:last-child_td[data-slot|=table]]:border-b-0",
|
|
8344
|
+
"[&_tr:last-child_th[data-slot|=table]]:border-b-0",
|
|
8345
|
+
"[&_tr_th[data-slot|=table]]:bg-table-header",
|
|
8346
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:bg-table-hover",
|
|
8347
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:text-table-hover-foreground",
|
|
8348
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!bg-table-active",
|
|
8349
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!text-table-active-foreground"
|
|
7800
8350
|
);
|
|
7801
8351
|
el.setAttribute("data-slot", "table-body");
|
|
7802
8352
|
});
|
|
@@ -7816,7 +8366,7 @@ function table_default(Alpine) {
|
|
|
7816
8366
|
el.setAttribute("data-slot", "table-caption");
|
|
7817
8367
|
});
|
|
7818
8368
|
Alpine.directive("h-table-footer", (el) => {
|
|
7819
|
-
el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td]:border-b-0", "last:[&>tr_th]:border-b-0");
|
|
8369
|
+
el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td[data-slot|=table]]:border-b-0", "last:[&>tr_th[data-slot|=table]]:border-b-0");
|
|
7820
8370
|
el.setAttribute("data-slot", "table-footer");
|
|
7821
8371
|
});
|
|
7822
8372
|
}
|
|
@@ -7870,7 +8420,7 @@ function tabs_default(Alpine) {
|
|
|
7870
8420
|
el.setAttribute("role", "tablist");
|
|
7871
8421
|
el.setAttribute("data-slot", "tab-list");
|
|
7872
8422
|
});
|
|
7873
|
-
Alpine.directive("h-tab", (el, { original }) => {
|
|
8423
|
+
Alpine.directive("h-tab", (el, { original: original2 }) => {
|
|
7874
8424
|
el.classList.add(
|
|
7875
8425
|
"cursor-pointer",
|
|
7876
8426
|
"focus-visible:border-ring",
|
|
@@ -7917,8 +8467,8 @@ function tabs_default(Alpine) {
|
|
|
7917
8467
|
);
|
|
7918
8468
|
el.setAttribute("role", "tab");
|
|
7919
8469
|
el.setAttribute("data-slot", "tab");
|
|
7920
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
7921
|
-
if (!el.hasAttribute("aria-controls")) throw new Error(`${
|
|
8470
|
+
if (!el.hasAttribute("id")) throw new Error(`${original2}: Tabs must have an id`);
|
|
8471
|
+
if (!el.hasAttribute("aria-controls")) throw new Error(`${original2}: aria-controls must be set to the tab-content id.`);
|
|
7922
8472
|
});
|
|
7923
8473
|
Alpine.directive("h-tab-action", (el) => {
|
|
7924
8474
|
el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
|
|
@@ -7952,13 +8502,13 @@ function tabs_default(Alpine) {
|
|
|
7952
8502
|
el.setAttribute("role", "button");
|
|
7953
8503
|
el.setAttribute("data-slot", "tab-list-action");
|
|
7954
8504
|
});
|
|
7955
|
-
Alpine.directive("h-tabs-content", (el, { original }) => {
|
|
8505
|
+
Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
|
|
7956
8506
|
el.classList.add("flex-1", "outline-none");
|
|
7957
8507
|
el.setAttribute("role", "tabpanel");
|
|
7958
8508
|
el.setAttribute("tabindex", "0");
|
|
7959
8509
|
el.setAttribute("data-slot", "tabs-content");
|
|
7960
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
7961
|
-
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${
|
|
8510
|
+
if (!el.hasAttribute("id")) throw new Error(`${original2}: Tab content must have an id`);
|
|
8511
|
+
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original2}: aria-labelledby must be set to the tab id.`);
|
|
7962
8512
|
});
|
|
7963
8513
|
}
|
|
7964
8514
|
|
|
@@ -8221,7 +8771,7 @@ function scrollIntoCenter(container, element, behavior = "instant") {
|
|
|
8221
8771
|
});
|
|
8222
8772
|
}
|
|
8223
8773
|
function timepicker_default(Alpine) {
|
|
8224
|
-
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8774
|
+
Alpine.directive("h-time-picker", (el, { expression, modifiers }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8225
8775
|
el._h_timepicker = Alpine2.reactive({
|
|
8226
8776
|
id: void 0,
|
|
8227
8777
|
controls: `htpc${v4_default()}`,
|
|
@@ -8251,39 +8801,55 @@ function timepicker_default(Alpine) {
|
|
|
8251
8801
|
el.classList.add(
|
|
8252
8802
|
"cursor-pointer",
|
|
8253
8803
|
"border-input",
|
|
8254
|
-
"[&>input]:appearance-none",
|
|
8255
|
-
"has-[input:focus-visible]:border-ring",
|
|
8256
|
-
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8257
|
-
"has-[input:focus-visible]:ring-ring/50",
|
|
8258
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8259
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
8260
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8261
|
-
"has-[input:invalid]:ring-negative/20",
|
|
8262
|
-
"has-[input:invalid]:border-negative",
|
|
8263
|
-
"dark:has-[input:invalid]:ring-negative/40",
|
|
8264
8804
|
"hover:bg-secondary-hover",
|
|
8265
8805
|
"active:bg-secondary-active",
|
|
8266
8806
|
"flex",
|
|
8267
|
-
"w-full",
|
|
8268
8807
|
"items-center",
|
|
8269
8808
|
"justify-between",
|
|
8270
8809
|
"gap-2",
|
|
8271
|
-
"rounded-control",
|
|
8272
|
-
"border",
|
|
8273
|
-
"bg-input-inner",
|
|
8274
8810
|
"pl-3",
|
|
8275
8811
|
"pr-2",
|
|
8276
8812
|
"data-[size=sm]:pr-1",
|
|
8277
8813
|
"text-sm",
|
|
8278
8814
|
"whitespace-nowrap",
|
|
8279
|
-
"shadow-input",
|
|
8280
8815
|
"transition-[color,box-shadow]",
|
|
8281
8816
|
"duration-200",
|
|
8282
8817
|
"outline-none",
|
|
8283
8818
|
"has-[input:disabled]:pointer-events-none",
|
|
8819
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
8284
8820
|
"has-[input:disabled]:opacity-50"
|
|
8285
8821
|
);
|
|
8286
|
-
|
|
8822
|
+
if (modifiers.includes("table")) {
|
|
8823
|
+
el.classList.add(
|
|
8824
|
+
"size-full",
|
|
8825
|
+
"h-10",
|
|
8826
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
8827
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
8828
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
8829
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
8830
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
8831
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
8832
|
+
);
|
|
8833
|
+
el.setAttribute("data-slot", "cell-input-time");
|
|
8834
|
+
} else {
|
|
8835
|
+
el.classList.add(
|
|
8836
|
+
"w-full",
|
|
8837
|
+
"rounded-control",
|
|
8838
|
+
"border",
|
|
8839
|
+
"bg-input-inner",
|
|
8840
|
+
"shadow-input",
|
|
8841
|
+
"has-[input:focus-visible]:border-ring",
|
|
8842
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8843
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
8844
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8845
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
8846
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8847
|
+
"has-[input:invalid]:ring-negative/20",
|
|
8848
|
+
"has-[input:invalid]:border-negative",
|
|
8849
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
8850
|
+
);
|
|
8851
|
+
el.setAttribute("data-slot", "time-picker");
|
|
8852
|
+
}
|
|
8287
8853
|
el.setAttribute("tabindex", "-1");
|
|
8288
8854
|
el.appendChild(
|
|
8289
8855
|
createSvg({
|
|
@@ -8335,13 +8901,13 @@ function timepicker_default(Alpine) {
|
|
|
8335
8901
|
top.removeEventListener("click", el._h_timepicker.close);
|
|
8336
8902
|
});
|
|
8337
8903
|
});
|
|
8338
|
-
Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8904
|
+
Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8339
8905
|
if (el.tagName !== "INPUT") {
|
|
8340
|
-
throw new Error(`${
|
|
8906
|
+
throw new Error(`${original2} must be a readonly input of type "text"`);
|
|
8341
8907
|
}
|
|
8342
8908
|
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
8343
8909
|
if (!timepicker) {
|
|
8344
|
-
throw new Error(`${
|
|
8910
|
+
throw new Error(`${original2} must be inside a time-picker element`);
|
|
8345
8911
|
}
|
|
8346
8912
|
timepicker._h_timepicker.focusInput = () => {
|
|
8347
8913
|
el.focus();
|
|
@@ -8369,7 +8935,20 @@ function timepicker_default(Alpine) {
|
|
|
8369
8935
|
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
8370
8936
|
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
8371
8937
|
}
|
|
8372
|
-
el.classList.add(
|
|
8938
|
+
el.classList.add(
|
|
8939
|
+
"appearance-none",
|
|
8940
|
+
"cursor-pointer",
|
|
8941
|
+
"bg-transparent",
|
|
8942
|
+
"text-transparent",
|
|
8943
|
+
"text-shadow-[0_0_0_var(--foreground)]",
|
|
8944
|
+
"placeholder:text-muted-foreground",
|
|
8945
|
+
"outline-none",
|
|
8946
|
+
"size-full",
|
|
8947
|
+
"border-0",
|
|
8948
|
+
"md:text-sm",
|
|
8949
|
+
"text-base",
|
|
8950
|
+
"truncate"
|
|
8951
|
+
);
|
|
8373
8952
|
el.setAttribute("aria-autocomplete", "none");
|
|
8374
8953
|
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
8375
8954
|
el.setAttribute("aria-expanded", "false");
|
|
@@ -8917,8 +9496,8 @@ function toolbar_default(Alpine) {
|
|
|
8917
9496
|
"shrink-0",
|
|
8918
9497
|
"items-center",
|
|
8919
9498
|
"px-1",
|
|
8920
|
-
'has-[>[data-slot="avatar"]:last-
|
|
8921
|
-
'has-[>[data-slot="toolbar-image"]:first-
|
|
9499
|
+
'has-[>[data-slot="avatar"]:last-of-type]:pr-2',
|
|
9500
|
+
'has-[>[data-slot="toolbar-image"]:first-of-type]:pl-2',
|
|
8922
9501
|
"gap-1",
|
|
8923
9502
|
modifiers.includes("footer") ? "border-t" : "border-b",
|
|
8924
9503
|
"w-full",
|
|
@@ -8977,7 +9556,7 @@ function tooltip_default(Alpine) {
|
|
|
8977
9556
|
el.removeEventListener("pointerleave", handler);
|
|
8978
9557
|
});
|
|
8979
9558
|
});
|
|
8980
|
-
Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
|
|
9559
|
+
Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
|
|
8981
9560
|
const tooltip = (() => {
|
|
8982
9561
|
let sibling = el.previousElementSibling;
|
|
8983
9562
|
while (sibling && !sibling.hasOwnProperty("_tooltip")) {
|
|
@@ -8986,7 +9565,7 @@ function tooltip_default(Alpine) {
|
|
|
8986
9565
|
return sibling;
|
|
8987
9566
|
})();
|
|
8988
9567
|
if (!tooltip) {
|
|
8989
|
-
throw new Error(`${
|
|
9568
|
+
throw new Error(`${original2} must be placed after a tooltip trigger element`);
|
|
8990
9569
|
}
|
|
8991
9570
|
el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
|
|
8992
9571
|
el.setAttribute("data-slot", "tooltip");
|
|
@@ -9192,9 +9771,9 @@ function tree_default(Alpine) {
|
|
|
9192
9771
|
});
|
|
9193
9772
|
}
|
|
9194
9773
|
});
|
|
9195
|
-
Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
|
|
9774
|
+
Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
|
|
9196
9775
|
const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
|
|
9197
|
-
if (!treeItem) throw new Error(`${
|
|
9776
|
+
if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
|
|
9198
9777
|
el.classList.add(
|
|
9199
9778
|
"flex",
|
|
9200
9779
|
"w-full",
|
|
@@ -9257,7 +9836,7 @@ function tree_default(Alpine) {
|
|
|
9257
9836
|
}
|
|
9258
9837
|
|
|
9259
9838
|
// package.json
|
|
9260
|
-
var version = "1.1
|
|
9839
|
+
var version = "1.2.1";
|
|
9261
9840
|
|
|
9262
9841
|
// src/utils/breakpoint-listener.js
|
|
9263
9842
|
function getBreakpointListener(handler, breakpoint = 768) {
|
|
@@ -9364,7 +9943,7 @@ function focus_default(Alpine) {
|
|
|
9364
9943
|
|
|
9365
9944
|
// src/utils/template.js
|
|
9366
9945
|
function template_default(Alpine) {
|
|
9367
|
-
Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
9946
|
+
Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
9368
9947
|
if (el.hasAttribute(Alpine2.prefixed("data"))) {
|
|
9369
9948
|
const template = evaluate2(expression);
|
|
9370
9949
|
const clone = template.content.cloneNode(true).firstElementChild;
|
|
@@ -9374,10 +9953,11 @@ function template_default(Alpine) {
|
|
|
9374
9953
|
Alpine2.initTree(clone);
|
|
9375
9954
|
});
|
|
9376
9955
|
cleanup(() => {
|
|
9956
|
+
Alpine2.destroyTree(clone);
|
|
9377
9957
|
clone.remove();
|
|
9378
9958
|
});
|
|
9379
9959
|
} else {
|
|
9380
|
-
console.error(`${
|
|
9960
|
+
console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
|
|
9381
9961
|
}
|
|
9382
9962
|
});
|
|
9383
9963
|
}
|