@underverse-ui/underverse 0.2.107 → 0.2.109
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/index.cjs +534 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +623 -278
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3795,7 +3795,7 @@ var Popover = ({
|
|
|
3795
3795
|
"div",
|
|
3796
3796
|
{
|
|
3797
3797
|
className: cn(
|
|
3798
|
-
"rounded-2xl border bg-popover text-popover-foreground shadow-md",
|
|
3798
|
+
"rounded-2xl md:rounded-3xl border bg-popover text-popover-foreground shadow-md",
|
|
3799
3799
|
"backdrop-blur-sm bg-popover/95 border-border/60 p-4",
|
|
3800
3800
|
contentClassName
|
|
3801
3801
|
),
|
|
@@ -4930,98 +4930,108 @@ var Combobox = ({
|
|
|
4930
4930
|
`${itemValue}-${index}`
|
|
4931
4931
|
);
|
|
4932
4932
|
};
|
|
4933
|
-
const dropdownBody = /* @__PURE__ */ jsxs22(
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
e
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4933
|
+
const dropdownBody = /* @__PURE__ */ jsxs22(
|
|
4934
|
+
"div",
|
|
4935
|
+
{
|
|
4936
|
+
"data-combobox-dropdown": true,
|
|
4937
|
+
"data-state": open ? "open" : "closed",
|
|
4938
|
+
role: "listbox",
|
|
4939
|
+
id: `${resolvedId}-listbox`,
|
|
4940
|
+
className: "w-full rounded-2xl md:rounded-3xl overflow-hidden",
|
|
4941
|
+
children: [
|
|
4942
|
+
enableSearch && /* @__PURE__ */ jsx25("div", { className: "relative p-2.5 border-b border-border/30", children: /* @__PURE__ */ jsxs22("div", { className: "relative", children: [
|
|
4943
|
+
/* @__PURE__ */ jsx25(Search3, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/60 transition-colors peer-focus:text-primary" }),
|
|
4944
|
+
/* @__PURE__ */ jsx25(
|
|
4945
|
+
"input",
|
|
4946
|
+
{
|
|
4947
|
+
ref: inputRef,
|
|
4948
|
+
value: query,
|
|
4949
|
+
onChange: (e) => {
|
|
4950
|
+
setQuery(e.target.value);
|
|
4951
|
+
setActiveIndex(null);
|
|
4952
|
+
},
|
|
4953
|
+
onKeyDown: (e) => {
|
|
4954
|
+
if (e.key === "ArrowDown") {
|
|
4955
|
+
e.preventDefault();
|
|
4956
|
+
setActiveIndex((prev) => {
|
|
4957
|
+
const next = prev === null ? 0 : prev + 1;
|
|
4958
|
+
return next >= filteredOptions.length ? 0 : next;
|
|
4959
|
+
});
|
|
4960
|
+
} else if (e.key === "ArrowUp") {
|
|
4961
|
+
e.preventDefault();
|
|
4962
|
+
setActiveIndex((prev) => {
|
|
4963
|
+
const next = prev === null ? filteredOptions.length - 1 : prev - 1;
|
|
4964
|
+
return next < 0 ? filteredOptions.length - 1 : next;
|
|
4965
|
+
});
|
|
4966
|
+
} else if (e.key === "Enter") {
|
|
4967
|
+
e.preventDefault();
|
|
4968
|
+
if (activeIndex !== null && filteredOptions[activeIndex] && !getOptionDisabled(filteredOptions[activeIndex])) {
|
|
4969
|
+
handleSelect(filteredOptions[activeIndex]);
|
|
4970
|
+
}
|
|
4971
|
+
} else if (e.key === "Escape") {
|
|
4972
|
+
e.preventDefault();
|
|
4973
|
+
setOpen(false);
|
|
4974
|
+
}
|
|
4975
|
+
},
|
|
4976
|
+
placeholder: searchPlaceholder,
|
|
4977
|
+
className: cn(
|
|
4978
|
+
"peer w-full rounded-xl bg-muted/40 py-2.5 pl-9 pr-3 text-sm",
|
|
4979
|
+
"border border-transparent",
|
|
4980
|
+
"focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
|
|
4981
|
+
"transition-all duration-200",
|
|
4982
|
+
"placeholder:text-muted-foreground/50"
|
|
4983
|
+
),
|
|
4984
|
+
"aria-autocomplete": "list",
|
|
4985
|
+
"aria-activedescendant": activeIndex != null ? `combobox-item-${activeIndex}` : void 0
|
|
4966
4986
|
}
|
|
4967
|
-
},
|
|
4968
|
-
placeholder: searchPlaceholder,
|
|
4969
|
-
className: cn(
|
|
4970
|
-
"peer w-full rounded-xl bg-muted/40 py-2.5 pl-9 pr-3 text-sm",
|
|
4971
|
-
"border border-transparent",
|
|
4972
|
-
"focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
|
|
4973
|
-
"transition-all duration-200",
|
|
4974
|
-
"placeholder:text-muted-foreground/50"
|
|
4975
4987
|
),
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
] }) }) }) })
|
|
5024
|
-
] });
|
|
4988
|
+
query && /* @__PURE__ */ jsx25(
|
|
4989
|
+
"button",
|
|
4990
|
+
{
|
|
4991
|
+
type: "button",
|
|
4992
|
+
onClick: () => setQuery(""),
|
|
4993
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 p-0.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
|
|
4994
|
+
children: /* @__PURE__ */ jsx25(X8, { className: "h-3.5 w-3.5" })
|
|
4995
|
+
}
|
|
4996
|
+
)
|
|
4997
|
+
] }) }),
|
|
4998
|
+
/* @__PURE__ */ jsx25("div", { className: "overflow-y-auto overscroll-contain", style: { maxHeight }, children: /* @__PURE__ */ jsx25("div", { className: "p-1.5", children: loading2 ? /* @__PURE__ */ jsx25("div", { className: "px-3 py-10 text-center", children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center gap-3 animate-in fade-in-0 zoom-in-95 duration-300", children: [
|
|
4999
|
+
/* @__PURE__ */ jsx25("div", { className: "relative", children: /* @__PURE__ */ jsx25("div", { className: "w-10 h-10 rounded-full border-2 border-primary/20 border-t-primary animate-spin" }) }),
|
|
5000
|
+
/* @__PURE__ */ jsx25("span", { className: "text-sm text-muted-foreground", children: loadingText })
|
|
5001
|
+
] }) }) : filteredOptions.length > 0 ? groupedOptions ? (
|
|
5002
|
+
// Render grouped options with global index tracking
|
|
5003
|
+
(() => {
|
|
5004
|
+
let globalIndex = 0;
|
|
5005
|
+
return Object.entries(groupedOptions).map(([group, items]) => /* @__PURE__ */ jsxs22("div", { className: cn(globalIndex > 0 && "mt-2 pt-2 border-t border-border/30"), children: [
|
|
5006
|
+
/* @__PURE__ */ jsx25("div", { className: "px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: group }),
|
|
5007
|
+
/* @__PURE__ */ jsx25("ul", { className: "space-y-0.5", children: items.map((item) => {
|
|
5008
|
+
const index = globalIndex++;
|
|
5009
|
+
return renderOptionItem(item, index);
|
|
5010
|
+
}) })
|
|
5011
|
+
] }, group));
|
|
5012
|
+
})()
|
|
5013
|
+
) : (
|
|
5014
|
+
// Render flat options
|
|
5015
|
+
/* @__PURE__ */ jsx25("ul", { className: "space-y-0.5", children: filteredOptions.map((item, index) => renderOptionItem(item, index)) })
|
|
5016
|
+
) : /* @__PURE__ */ jsx25("div", { className: "px-3 py-10 text-center", children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center gap-3 animate-in fade-in-0 zoom-in-95 duration-300", children: [
|
|
5017
|
+
/* @__PURE__ */ jsx25("div", { className: "w-12 h-12 rounded-full bg-muted/50 flex items-center justify-center", children: /* @__PURE__ */ jsx25(SearchX, { className: "h-6 w-6 text-muted-foreground/60" }) }),
|
|
5018
|
+
/* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
|
|
5019
|
+
/* @__PURE__ */ jsx25("span", { className: "block text-sm font-medium text-foreground", children: emptyText }),
|
|
5020
|
+
query && /* @__PURE__ */ jsx25("span", { className: "block text-xs text-muted-foreground", children: "Try a different search term" })
|
|
5021
|
+
] }),
|
|
5022
|
+
query && /* @__PURE__ */ jsx25(
|
|
5023
|
+
"button",
|
|
5024
|
+
{
|
|
5025
|
+
type: "button",
|
|
5026
|
+
onClick: () => setQuery(""),
|
|
5027
|
+
className: "px-3 py-1.5 text-xs font-medium text-primary bg-primary/10 rounded-full hover:bg-primary/20 transition-colors",
|
|
5028
|
+
children: "Clear search"
|
|
5029
|
+
}
|
|
5030
|
+
)
|
|
5031
|
+
] }) }) }) })
|
|
5032
|
+
]
|
|
5033
|
+
}
|
|
5034
|
+
);
|
|
5025
5035
|
const sizeStyles8 = {
|
|
5026
5036
|
sm: "h-8 py-1.5 text-sm md:h-7 md:text-xs",
|
|
5027
5037
|
md: "h-10 py-2 text-sm",
|
|
@@ -5034,7 +5044,7 @@ var Combobox = ({
|
|
|
5034
5044
|
filled: "border-0 bg-muted/50 hover:bg-muted/80"
|
|
5035
5045
|
};
|
|
5036
5046
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
5037
|
-
const radiusClass =
|
|
5047
|
+
const radiusClass = "rounded-full";
|
|
5038
5048
|
const verticalGap = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
5039
5049
|
const triggerButtonBaseProps = {
|
|
5040
5050
|
ref: triggerRef,
|
|
@@ -5139,12 +5149,12 @@ var Combobox = ({
|
|
|
5139
5149
|
placement: "bottom-start",
|
|
5140
5150
|
matchTriggerWidth: true,
|
|
5141
5151
|
className: "z-9999",
|
|
5142
|
-
contentClassName: "p-0",
|
|
5152
|
+
contentClassName: "p-0 overflow-hidden rounded-2xl md:rounded-3xl",
|
|
5143
5153
|
children: dropdownBody
|
|
5144
5154
|
}
|
|
5145
5155
|
) : /* @__PURE__ */ jsxs22("div", { className: "relative", children: [
|
|
5146
5156
|
triggerButtonInline,
|
|
5147
|
-
open && /* @__PURE__ */ jsx25("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ jsx25("div", { className: "rounded-2xl border text-popover-foreground shadow-md backdrop-blur-sm bg-popover/95 border-border/60", children: dropdownBody }) })
|
|
5157
|
+
open && /* @__PURE__ */ jsx25("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ jsx25("div", { className: "rounded-2xl md:rounded-3xl overflow-hidden border text-popover-foreground shadow-md backdrop-blur-sm bg-popover/95 border-border/60", children: dropdownBody }) })
|
|
5148
5158
|
] }),
|
|
5149
5159
|
(helperText || error) && /* @__PURE__ */ jsxs22("p", { className: cn("text-xs transition-colors duration-200 flex items-center gap-1.5", error ? "text-destructive" : "text-muted-foreground"), children: [
|
|
5150
5160
|
error && /* @__PURE__ */ jsx25("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", className: "w-3.5 h-3.5 shrink-0", children: /* @__PURE__ */ jsx25(
|
|
@@ -5979,7 +5989,7 @@ var DatePicker = ({
|
|
|
5979
5989
|
contentClassName: cn(
|
|
5980
5990
|
"p-0",
|
|
5981
5991
|
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
5982
|
-
"rounded-2xl",
|
|
5992
|
+
"rounded-2xl md:rounded-3xl",
|
|
5983
5993
|
// Keep usable on small viewports (wheel scroll should stay within the popover if it overflows)
|
|
5984
5994
|
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
5985
5995
|
size === "sm" ? "p-4" : "p-5",
|
|
@@ -6282,7 +6292,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6282
6292
|
contentClassName: cn(
|
|
6283
6293
|
"p-0",
|
|
6284
6294
|
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
6285
|
-
"rounded-2xl",
|
|
6295
|
+
"rounded-2xl md:rounded-3xl",
|
|
6286
6296
|
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
6287
6297
|
size === "sm" ? "p-3" : "p-5",
|
|
6288
6298
|
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
@@ -6935,6 +6945,14 @@ function WheelColumn({
|
|
|
6935
6945
|
const wheelDeltaRef = React25.useRef(0);
|
|
6936
6946
|
const scrollEndTimeoutRef = React25.useRef(null);
|
|
6937
6947
|
const suppressScrollSelectUntilRef = React25.useRef(0);
|
|
6948
|
+
const suppressItemClickUntilRef = React25.useRef(0);
|
|
6949
|
+
const dragRef = React25.useRef(null);
|
|
6950
|
+
const draggingRef = React25.useRef(false);
|
|
6951
|
+
const inertialRef = React25.useRef(false);
|
|
6952
|
+
const inertiaRafRef = React25.useRef(null);
|
|
6953
|
+
const inertiaVelocityRef = React25.useRef(0);
|
|
6954
|
+
const inertiaLastTimeRef = React25.useRef(0);
|
|
6955
|
+
const moveSamplesRef = React25.useRef([]);
|
|
6938
6956
|
const loop = true;
|
|
6939
6957
|
const ui = React25.useMemo(() => {
|
|
6940
6958
|
if (size === "sm") {
|
|
@@ -7005,6 +7023,10 @@ function WheelColumn({
|
|
|
7005
7023
|
window.clearTimeout(scrollEndTimeoutRef.current);
|
|
7006
7024
|
scrollEndTimeoutRef.current = null;
|
|
7007
7025
|
}
|
|
7026
|
+
if (inertiaRafRef.current != null) {
|
|
7027
|
+
cancelAnimationFrame(inertiaRafRef.current);
|
|
7028
|
+
inertiaRafRef.current = null;
|
|
7029
|
+
}
|
|
7008
7030
|
cancelAnimationFrame(rafRef.current);
|
|
7009
7031
|
};
|
|
7010
7032
|
}, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
@@ -7102,6 +7124,138 @@ function WheelColumn({
|
|
|
7102
7124
|
const from = lastVirtualIndexRef.current ?? fallback;
|
|
7103
7125
|
return getNearestVirtualIndex(valueIndex, from);
|
|
7104
7126
|
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
7127
|
+
const commitFromScrollTop = React25.useCallback(
|
|
7128
|
+
(behavior) => {
|
|
7129
|
+
const el = scrollRef.current;
|
|
7130
|
+
if (!el) return;
|
|
7131
|
+
if (items.length <= 0) return;
|
|
7132
|
+
const len = items.length;
|
|
7133
|
+
const maxVirtual = Math.max(0, extendedItems.length - 1);
|
|
7134
|
+
const idxVirtual = clamp3(Math.round(el.scrollTop / itemHeight), 0, maxVirtual);
|
|
7135
|
+
const realIndex = (idxVirtual % len + len) % len;
|
|
7136
|
+
const snappedVirtual = loop ? getNearestVirtualIndex(realIndex, idxVirtual) : realIndex;
|
|
7137
|
+
lastVirtualIndexRef.current = snappedVirtual;
|
|
7138
|
+
suppressScrollSelectUntilRef.current = Date.now() + 350;
|
|
7139
|
+
if (behavior === "auto") el.scrollTop = snappedVirtual * itemHeight;
|
|
7140
|
+
else el.scrollTo({ top: snappedVirtual * itemHeight, behavior });
|
|
7141
|
+
onSelect(items[realIndex]);
|
|
7142
|
+
if (loop) {
|
|
7143
|
+
const min = len;
|
|
7144
|
+
const max = len * 2 - 1;
|
|
7145
|
+
let centered = snappedVirtual;
|
|
7146
|
+
if (centered < min) centered += len;
|
|
7147
|
+
if (centered > max) centered -= len;
|
|
7148
|
+
if (centered !== snappedVirtual) {
|
|
7149
|
+
lastVirtualIndexRef.current = centered;
|
|
7150
|
+
el.scrollTop = centered * itemHeight;
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
},
|
|
7154
|
+
[extendedItems.length, getNearestVirtualIndex, itemHeight, items, loop, onSelect, scrollRef]
|
|
7155
|
+
);
|
|
7156
|
+
const onPointerDown = (e) => {
|
|
7157
|
+
if (e.pointerType !== "mouse") return;
|
|
7158
|
+
if (e.button !== 0) return;
|
|
7159
|
+
const el = scrollRef.current;
|
|
7160
|
+
if (!el) return;
|
|
7161
|
+
e.preventDefault();
|
|
7162
|
+
setFocusedColumn(column);
|
|
7163
|
+
draggingRef.current = true;
|
|
7164
|
+
inertialRef.current = false;
|
|
7165
|
+
if (inertiaRafRef.current != null) {
|
|
7166
|
+
cancelAnimationFrame(inertiaRafRef.current);
|
|
7167
|
+
inertiaRafRef.current = null;
|
|
7168
|
+
}
|
|
7169
|
+
if (scrollEndTimeoutRef.current != null) {
|
|
7170
|
+
window.clearTimeout(scrollEndTimeoutRef.current);
|
|
7171
|
+
scrollEndTimeoutRef.current = null;
|
|
7172
|
+
}
|
|
7173
|
+
dragRef.current = { pointerId: e.pointerId, startY: e.clientY, startScrollTop: el.scrollTop, moved: false };
|
|
7174
|
+
moveSamplesRef.current = [{ t: performance.now(), top: el.scrollTop }];
|
|
7175
|
+
try {
|
|
7176
|
+
el.setPointerCapture(e.pointerId);
|
|
7177
|
+
} catch {
|
|
7178
|
+
}
|
|
7179
|
+
};
|
|
7180
|
+
const onPointerMove = (e) => {
|
|
7181
|
+
const el = scrollRef.current;
|
|
7182
|
+
const drag = dragRef.current;
|
|
7183
|
+
if (!el || !drag) return;
|
|
7184
|
+
if (e.pointerId !== drag.pointerId) return;
|
|
7185
|
+
e.preventDefault();
|
|
7186
|
+
const dy = e.clientY - drag.startY;
|
|
7187
|
+
if (!drag.moved && Math.abs(dy) < 4) return;
|
|
7188
|
+
if (!drag.moved) {
|
|
7189
|
+
drag.moved = true;
|
|
7190
|
+
suppressItemClickUntilRef.current = Date.now() + 400;
|
|
7191
|
+
}
|
|
7192
|
+
suppressScrollSelectUntilRef.current = Date.now() + 500;
|
|
7193
|
+
el.scrollTop = drag.startScrollTop - dy;
|
|
7194
|
+
const now = performance.now();
|
|
7195
|
+
const samples = moveSamplesRef.current;
|
|
7196
|
+
samples.push({ t: now, top: el.scrollTop });
|
|
7197
|
+
while (samples.length > 6 && samples[0] && now - samples[0].t > 120) samples.shift();
|
|
7198
|
+
while (samples.length > 8) samples.shift();
|
|
7199
|
+
if (samples.length >= 2) {
|
|
7200
|
+
const oldest = samples[0];
|
|
7201
|
+
const dt = now - oldest.t;
|
|
7202
|
+
if (dt > 0) inertiaVelocityRef.current = (el.scrollTop - oldest.top) / dt;
|
|
7203
|
+
}
|
|
7204
|
+
};
|
|
7205
|
+
const startInertia = React25.useCallback(() => {
|
|
7206
|
+
const el = scrollRef.current;
|
|
7207
|
+
if (!el) return;
|
|
7208
|
+
if (items.length <= 0) return;
|
|
7209
|
+
inertialRef.current = true;
|
|
7210
|
+
suppressItemClickUntilRef.current = Date.now() + 600;
|
|
7211
|
+
inertiaLastTimeRef.current = performance.now();
|
|
7212
|
+
const len = items.length;
|
|
7213
|
+
const cycle = len * itemHeight;
|
|
7214
|
+
const frictionPerFrame = 0.92;
|
|
7215
|
+
const tick = () => {
|
|
7216
|
+
const now = performance.now();
|
|
7217
|
+
const last = inertiaLastTimeRef.current || now;
|
|
7218
|
+
const dt = Math.min(48, Math.max(0, now - last));
|
|
7219
|
+
inertiaLastTimeRef.current = now;
|
|
7220
|
+
let v = inertiaVelocityRef.current;
|
|
7221
|
+
el.scrollTop += v * dt;
|
|
7222
|
+
if (loop && cycle > 0) {
|
|
7223
|
+
if (el.scrollTop < cycle * 0.5) el.scrollTop += cycle;
|
|
7224
|
+
else if (el.scrollTop > cycle * 2.5) el.scrollTop -= cycle;
|
|
7225
|
+
}
|
|
7226
|
+
const decay = Math.pow(frictionPerFrame, dt / 16);
|
|
7227
|
+
v *= decay;
|
|
7228
|
+
inertiaVelocityRef.current = v;
|
|
7229
|
+
if (Math.abs(v) < 0.03) {
|
|
7230
|
+
inertialRef.current = false;
|
|
7231
|
+
inertiaRafRef.current = null;
|
|
7232
|
+
commitFromScrollTop("smooth");
|
|
7233
|
+
return;
|
|
7234
|
+
}
|
|
7235
|
+
inertiaRafRef.current = requestAnimationFrame(tick);
|
|
7236
|
+
};
|
|
7237
|
+
inertiaRafRef.current = requestAnimationFrame(tick);
|
|
7238
|
+
}, [commitFromScrollTop, itemHeight, items.length, loop, scrollRef]);
|
|
7239
|
+
const endDrag = (pointerId) => {
|
|
7240
|
+
const el = scrollRef.current;
|
|
7241
|
+
const drag = dragRef.current;
|
|
7242
|
+
if (!el || !drag) return;
|
|
7243
|
+
if (pointerId !== drag.pointerId) return;
|
|
7244
|
+
dragRef.current = null;
|
|
7245
|
+
draggingRef.current = false;
|
|
7246
|
+
try {
|
|
7247
|
+
el.releasePointerCapture(pointerId);
|
|
7248
|
+
} catch {
|
|
7249
|
+
}
|
|
7250
|
+
const v = inertiaVelocityRef.current;
|
|
7251
|
+
const shouldFlick = drag.moved && Math.abs(v) >= 0.35;
|
|
7252
|
+
if (shouldFlick) {
|
|
7253
|
+
startInertia();
|
|
7254
|
+
} else {
|
|
7255
|
+
inertialRef.current = false;
|
|
7256
|
+
commitFromScrollTop("smooth");
|
|
7257
|
+
}
|
|
7258
|
+
};
|
|
7105
7259
|
return /* @__PURE__ */ jsxs26("div", { className: cn("flex-1", ui.columnWidth), children: [
|
|
7106
7260
|
/* @__PURE__ */ jsx31("div", { className: cn(ui.label, "font-bold uppercase tracking-wider text-muted-foreground/70 text-center"), children: labelText }),
|
|
7107
7261
|
/* @__PURE__ */ jsxs26("div", { className: "relative rounded-xl bg-muted/30 overflow-hidden", style: { height }, children: [
|
|
@@ -7121,6 +7275,7 @@ function WheelColumn({
|
|
|
7121
7275
|
className: cn(
|
|
7122
7276
|
"h-full overflow-y-auto overscroll-contain snap-y snap-mandatory",
|
|
7123
7277
|
"scrollbar-none",
|
|
7278
|
+
"select-none cursor-grab active:cursor-grabbing",
|
|
7124
7279
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-xl"
|
|
7125
7280
|
),
|
|
7126
7281
|
style: { paddingTop: paddingY, paddingBottom: paddingY },
|
|
@@ -7129,7 +7284,15 @@ function WheelColumn({
|
|
|
7129
7284
|
tabIndex: focused ? 0 : -1,
|
|
7130
7285
|
onKeyDown: (e) => onKeyDown(e, column),
|
|
7131
7286
|
onFocus: () => setFocusedColumn(column),
|
|
7132
|
-
onScroll:
|
|
7287
|
+
onScroll: () => {
|
|
7288
|
+
if (draggingRef.current) return;
|
|
7289
|
+
if (inertialRef.current) return;
|
|
7290
|
+
handleScroll();
|
|
7291
|
+
},
|
|
7292
|
+
onPointerDown,
|
|
7293
|
+
onPointerMove,
|
|
7294
|
+
onPointerUp: (e) => endDrag(e.pointerId),
|
|
7295
|
+
onPointerCancel: (e) => endDrag(e.pointerId),
|
|
7133
7296
|
children: /* @__PURE__ */ jsx31("div", { children: extendedItems.map((n, index) => {
|
|
7134
7297
|
const dist = Math.abs(index - currentVirtual);
|
|
7135
7298
|
const distForVisual = Math.min(dist, 2);
|
|
@@ -7154,6 +7317,7 @@ function WheelColumn({
|
|
|
7154
7317
|
opacity
|
|
7155
7318
|
},
|
|
7156
7319
|
onClick: () => {
|
|
7320
|
+
if (Date.now() < suppressItemClickUntilRef.current) return;
|
|
7157
7321
|
const el = scrollRef.current;
|
|
7158
7322
|
if (!el) return;
|
|
7159
7323
|
suppressScrollSelectUntilRef.current = Date.now() + 350;
|
|
@@ -7775,7 +7939,13 @@ function TimePicker({
|
|
|
7775
7939
|
label,
|
|
7776
7940
|
required && /* @__PURE__ */ jsx31("span", { className: "text-destructive ml-1", children: "*" })
|
|
7777
7941
|
] }) }),
|
|
7778
|
-
/* @__PURE__ */ jsx31(
|
|
7942
|
+
/* @__PURE__ */ jsx31(
|
|
7943
|
+
"div",
|
|
7944
|
+
{
|
|
7945
|
+
className: cn(panelSz.contentPadding, "rounded-2xl md:rounded-3xl border border-border/60 bg-card/95 backdrop-blur-sm shadow-xl", className),
|
|
7946
|
+
children: timePickerContent
|
|
7947
|
+
}
|
|
7948
|
+
)
|
|
7779
7949
|
] });
|
|
7780
7950
|
}
|
|
7781
7951
|
return /* @__PURE__ */ jsxs26("div", { className: "w-full", ...rest, children: [
|
|
@@ -7806,7 +7976,7 @@ function TimePicker({
|
|
|
7806
7976
|
contentWidth: matchTriggerWidth ? void 0 : contentWidth,
|
|
7807
7977
|
contentClassName: cn(
|
|
7808
7978
|
panelSz.contentPadding,
|
|
7809
|
-
"rounded-2xl border bg-popover/98 backdrop-blur-md shadow-2xl",
|
|
7979
|
+
"rounded-2xl md:rounded-3xl border bg-popover/98 backdrop-blur-md shadow-2xl",
|
|
7810
7980
|
error && "border-destructive/40",
|
|
7811
7981
|
success && "border-success/40",
|
|
7812
7982
|
!error && !success && "border-border/60",
|
|
@@ -7987,7 +8157,7 @@ var DateTimePicker = ({
|
|
|
7987
8157
|
}
|
|
7988
8158
|
),
|
|
7989
8159
|
contentClassName: cn(
|
|
7990
|
-
"w-auto p-0 rounded-2xl",
|
|
8160
|
+
"w-auto p-0 rounded-2xl md:rounded-3xl",
|
|
7991
8161
|
// Keep the popover usable on small viewports
|
|
7992
8162
|
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto"
|
|
7993
8163
|
),
|
|
@@ -10597,7 +10767,7 @@ var MultiCombobox = ({
|
|
|
10597
10767
|
item.value
|
|
10598
10768
|
);
|
|
10599
10769
|
};
|
|
10600
|
-
const dropdownBody = /* @__PURE__ */ jsxs34("div", { "data-combobox-dropdown": true, "data-state": open ? "open" : "closed", className: "w-full", children: [
|
|
10770
|
+
const dropdownBody = /* @__PURE__ */ jsxs34("div", { "data-combobox-dropdown": true, "data-state": open ? "open" : "closed", className: "w-full rounded-2xl md:rounded-3xl overflow-hidden", children: [
|
|
10601
10771
|
value.length > 0 && /* @__PURE__ */ jsxs34("div", { className: "px-3 py-2 border-b border-border/40 flex items-center justify-between bg-muted/30", children: [
|
|
10602
10772
|
/* @__PURE__ */ jsxs34("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
10603
10773
|
value.length,
|
|
@@ -10701,7 +10871,7 @@ var MultiCombobox = ({
|
|
|
10701
10871
|
"aria-controls": listboxId,
|
|
10702
10872
|
"aria-invalid": !!error,
|
|
10703
10873
|
className: cn(
|
|
10704
|
-
"group flex w-full items-center gap-2 rounded-
|
|
10874
|
+
"group flex w-full items-center gap-2 rounded-full min-h-10 transition-all duration-200",
|
|
10705
10875
|
"px-3 py-2",
|
|
10706
10876
|
variantStyles6[variant],
|
|
10707
10877
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:border-primary",
|
|
@@ -10835,7 +11005,7 @@ var MultiCombobox = ({
|
|
|
10835
11005
|
placement: "bottom-start",
|
|
10836
11006
|
matchTriggerWidth: true,
|
|
10837
11007
|
className: "z-9999",
|
|
10838
|
-
contentClassName: "p-0",
|
|
11008
|
+
contentClassName: "p-0 overflow-hidden rounded-2xl md:rounded-3xl",
|
|
10839
11009
|
children: dropdownBody
|
|
10840
11010
|
}
|
|
10841
11011
|
),
|
|
@@ -11127,7 +11297,7 @@ RadioGroupItem.displayName = "RadioGroupItem";
|
|
|
11127
11297
|
|
|
11128
11298
|
// ../../components/ui/Slider.tsx
|
|
11129
11299
|
import * as React34 from "react";
|
|
11130
|
-
import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11300
|
+
import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11131
11301
|
var SIZE_STYLES = {
|
|
11132
11302
|
sm: {
|
|
11133
11303
|
track: "h-1",
|
|
@@ -11145,16 +11315,22 @@ var SIZE_STYLES = {
|
|
|
11145
11315
|
container: "py-3"
|
|
11146
11316
|
}
|
|
11147
11317
|
};
|
|
11318
|
+
var clamp5 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
11148
11319
|
var Slider = React34.forwardRef(
|
|
11149
11320
|
({
|
|
11150
11321
|
className,
|
|
11322
|
+
mode = "single",
|
|
11151
11323
|
value,
|
|
11152
11324
|
defaultValue = 0,
|
|
11325
|
+
rangeValue,
|
|
11326
|
+
defaultRangeValue,
|
|
11153
11327
|
min = 0,
|
|
11154
11328
|
max = 100,
|
|
11155
11329
|
step = 1,
|
|
11156
11330
|
onChange,
|
|
11157
11331
|
onValueChange,
|
|
11332
|
+
onRangeChange,
|
|
11333
|
+
onRangeValueChange,
|
|
11158
11334
|
onMouseUp,
|
|
11159
11335
|
onTouchEnd,
|
|
11160
11336
|
label,
|
|
@@ -11171,20 +11347,125 @@ var Slider = React34.forwardRef(
|
|
|
11171
11347
|
noFocus = true,
|
|
11172
11348
|
...props
|
|
11173
11349
|
}, ref) => {
|
|
11350
|
+
const isRange = mode === "range";
|
|
11351
|
+
const trackRef = React34.useRef(null);
|
|
11174
11352
|
const [internalValue, setInternalValue] = React34.useState(defaultValue);
|
|
11353
|
+
const [internalRange, setInternalRange] = React34.useState(() => {
|
|
11354
|
+
if (defaultRangeValue) return defaultRangeValue;
|
|
11355
|
+
const v = clamp5(defaultValue, min, max);
|
|
11356
|
+
return [min, v];
|
|
11357
|
+
});
|
|
11358
|
+
const [activeThumb, setActiveThumb] = React34.useState(null);
|
|
11359
|
+
const dragRef = React34.useRef(null);
|
|
11175
11360
|
const isControlled = value !== void 0;
|
|
11176
11361
|
const currentValue = isControlled ? value : internalValue;
|
|
11177
|
-
const
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11362
|
+
const isRangeControlled = rangeValue !== void 0;
|
|
11363
|
+
const currentRange = isRangeControlled ? rangeValue : internalRange;
|
|
11364
|
+
const rangeMin = clamp5(currentRange[0] ?? min, min, max);
|
|
11365
|
+
const rangeMax = clamp5(currentRange[1] ?? max, min, max);
|
|
11366
|
+
const normalizedRange = rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin];
|
|
11367
|
+
const handleSingleChange = React34.useCallback(
|
|
11368
|
+
(e) => {
|
|
11369
|
+
const newValue = Number(e.target.value);
|
|
11370
|
+
if (!isControlled) {
|
|
11371
|
+
setInternalValue(newValue);
|
|
11372
|
+
}
|
|
11373
|
+
onChange?.(newValue);
|
|
11374
|
+
onValueChange?.(newValue);
|
|
11375
|
+
},
|
|
11376
|
+
[isControlled, onChange, onValueChange]
|
|
11377
|
+
);
|
|
11378
|
+
const emitRange = React34.useCallback(
|
|
11379
|
+
(next) => {
|
|
11380
|
+
onRangeChange?.(next);
|
|
11381
|
+
onRangeValueChange?.(next);
|
|
11382
|
+
},
|
|
11383
|
+
[onRangeChange, onRangeValueChange]
|
|
11384
|
+
);
|
|
11385
|
+
const handleRangeChange = React34.useCallback(
|
|
11386
|
+
(thumb) => (e) => {
|
|
11387
|
+
const nextVal = Number(e.target.value);
|
|
11388
|
+
const [curMin, curMax] = normalizedRange;
|
|
11389
|
+
const next = thumb === "min" ? [Math.min(nextVal, curMax), curMax] : [curMin, Math.max(nextVal, curMin)];
|
|
11390
|
+
if (!isRangeControlled) setInternalRange(next);
|
|
11391
|
+
emitRange(next);
|
|
11392
|
+
},
|
|
11393
|
+
[emitRange, isRangeControlled, normalizedRange]
|
|
11394
|
+
);
|
|
11395
|
+
const denom = Math.max(1e-9, max - min);
|
|
11396
|
+
const percentage = (currentValue - min) / denom * 100;
|
|
11397
|
+
const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
|
|
11398
|
+
const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
|
|
11399
|
+
const sizeStyles8 = SIZE_STYLES[size];
|
|
11400
|
+
const displayValue = React34.useMemo(() => {
|
|
11401
|
+
if (isRange) {
|
|
11402
|
+
const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
|
|
11403
|
+
const b = formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString();
|
|
11404
|
+
return `${a} \u2013 ${b}`;
|
|
11405
|
+
}
|
|
11406
|
+
return formatValue ? formatValue(currentValue) : currentValue.toString();
|
|
11407
|
+
}, [currentValue, formatValue, isRange, normalizedRange]);
|
|
11408
|
+
const quantize = React34.useCallback(
|
|
11409
|
+
(v) => {
|
|
11410
|
+
const stepped = Math.round((v - min) / step) * step + min;
|
|
11411
|
+
const fixed = Number(stepped.toFixed(10));
|
|
11412
|
+
return clamp5(fixed, min, max);
|
|
11413
|
+
},
|
|
11414
|
+
[max, min, step]
|
|
11415
|
+
);
|
|
11416
|
+
const valueFromClientX = React34.useCallback(
|
|
11417
|
+
(clientX) => {
|
|
11418
|
+
const el = trackRef.current;
|
|
11419
|
+
if (!el) return min;
|
|
11420
|
+
const rect = el.getBoundingClientRect();
|
|
11421
|
+
const x = clamp5(clientX - rect.left, 0, rect.width);
|
|
11422
|
+
const ratio = rect.width <= 0 ? 0 : x / rect.width;
|
|
11423
|
+
return quantize(min + ratio * (max - min));
|
|
11424
|
+
},
|
|
11425
|
+
[max, min, quantize]
|
|
11426
|
+
);
|
|
11427
|
+
const startRangeDrag = (e) => {
|
|
11428
|
+
if (!isRange) return;
|
|
11429
|
+
if (disabled) return;
|
|
11430
|
+
if (orientation !== "horizontal") return;
|
|
11431
|
+
if (e.button !== 0) return;
|
|
11432
|
+
const nextValue = valueFromClientX(e.clientX);
|
|
11433
|
+
const [curMin, curMax] = normalizedRange;
|
|
11434
|
+
const distToMin = Math.abs(nextValue - curMin);
|
|
11435
|
+
const distToMax = Math.abs(nextValue - curMax);
|
|
11436
|
+
const thumb = distToMin <= distToMax ? "min" : "max";
|
|
11437
|
+
setActiveThumb(thumb);
|
|
11438
|
+
dragRef.current = { pointerId: e.pointerId, thumb };
|
|
11439
|
+
try {
|
|
11440
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
11441
|
+
} catch {
|
|
11442
|
+
}
|
|
11443
|
+
const next = thumb === "min" ? [Math.min(nextValue, curMax), curMax] : [curMin, Math.max(nextValue, curMin)];
|
|
11444
|
+
if (!isRangeControlled) setInternalRange(next);
|
|
11445
|
+
emitRange(next);
|
|
11446
|
+
};
|
|
11447
|
+
const moveRangeDrag = (e) => {
|
|
11448
|
+
const drag = dragRef.current;
|
|
11449
|
+
if (!drag) return;
|
|
11450
|
+
if (e.pointerId !== drag.pointerId) return;
|
|
11451
|
+
const nextValue = valueFromClientX(e.clientX);
|
|
11452
|
+
const [curMin, curMax] = normalizedRange;
|
|
11453
|
+
const next = drag.thumb === "min" ? [Math.min(nextValue, curMax), curMax] : [curMin, Math.max(nextValue, curMin)];
|
|
11454
|
+
if (!isRangeControlled) setInternalRange(next);
|
|
11455
|
+
emitRange(next);
|
|
11456
|
+
};
|
|
11457
|
+
const endRangeDrag = (e) => {
|
|
11458
|
+
const drag = dragRef.current;
|
|
11459
|
+
if (!drag) return;
|
|
11460
|
+
if (e.pointerId !== drag.pointerId) return;
|
|
11461
|
+
dragRef.current = null;
|
|
11462
|
+
onMouseUp?.();
|
|
11463
|
+
onTouchEnd?.();
|
|
11464
|
+
try {
|
|
11465
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
11466
|
+
} catch {
|
|
11181
11467
|
}
|
|
11182
|
-
onChange?.(newValue);
|
|
11183
|
-
onValueChange?.(newValue);
|
|
11184
11468
|
};
|
|
11185
|
-
const percentage = (currentValue - min) / (max - min) * 100;
|
|
11186
|
-
const sizeStyles8 = SIZE_STYLES[size];
|
|
11187
|
-
const displayValue = formatValue ? formatValue(currentValue) : currentValue.toString();
|
|
11188
11469
|
if (orientation === "vertical") {
|
|
11189
11470
|
}
|
|
11190
11471
|
return /* @__PURE__ */ jsxs36("div", { className: cn("w-full space-y-2", containerClassName), children: [
|
|
@@ -11192,65 +11473,129 @@ var Slider = React34.forwardRef(
|
|
|
11192
11473
|
label && /* @__PURE__ */ jsx41("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
|
|
11193
11474
|
showValue && /* @__PURE__ */ jsx41("span", { className: cn("text-xs font-mono text-muted-foreground min-w-8 text-right", valueClassName), children: displayValue })
|
|
11194
11475
|
] }),
|
|
11195
|
-
/* @__PURE__ */ jsxs36("div", { className: cn("relative flex items-center", sizeStyles8.container), children: [
|
|
11196
|
-
/* @__PURE__ */ jsx41("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden", sizeStyles8.track, trackClassName), children: /* @__PURE__ */ jsx41(
|
|
11197
|
-
|
|
11198
|
-
"input",
|
|
11476
|
+
/* @__PURE__ */ jsxs36("div", { ref: trackRef, className: cn("relative flex items-center", sizeStyles8.container), children: [
|
|
11477
|
+
/* @__PURE__ */ jsx41("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden", sizeStyles8.track, trackClassName), children: isRange ? /* @__PURE__ */ jsx41(
|
|
11478
|
+
"div",
|
|
11199
11479
|
{
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
min,
|
|
11203
|
-
max,
|
|
11204
|
-
step,
|
|
11205
|
-
value: currentValue,
|
|
11206
|
-
onChange: handleChange,
|
|
11207
|
-
onMouseUp,
|
|
11208
|
-
onTouchEnd,
|
|
11209
|
-
disabled,
|
|
11210
|
-
className: cn(
|
|
11211
|
-
// Base styles
|
|
11212
|
-
"absolute w-full h-full appearance-none bg-transparent cursor-pointer",
|
|
11213
|
-
!noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
|
|
11214
|
-
noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
|
|
11215
|
-
// Webkit styles for thumb
|
|
11216
|
-
"[&::-webkit-slider-thumb]:appearance-none",
|
|
11217
|
-
"[&::-webkit-slider-thumb]:bg-primary",
|
|
11218
|
-
"[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
|
|
11219
|
-
"[&::-webkit-slider-thumb]:rounded-full",
|
|
11220
|
-
"[&::-webkit-slider-thumb]:shadow-md",
|
|
11221
|
-
"[&::-webkit-slider-thumb]:cursor-pointer",
|
|
11222
|
-
"[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-150",
|
|
11223
|
-
size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
|
|
11224
|
-
size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
|
|
11225
|
-
size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
|
|
11226
|
-
// Firefox styles for thumb
|
|
11227
|
-
"[&::-moz-range-thumb]:bg-primary",
|
|
11228
|
-
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
|
|
11229
|
-
"[&::-moz-range-thumb]:rounded-full",
|
|
11230
|
-
"[&::-moz-range-thumb]:shadow-md",
|
|
11231
|
-
"[&::-moz-range-thumb]:cursor-pointer",
|
|
11232
|
-
"[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-150",
|
|
11233
|
-
size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
|
|
11234
|
-
size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
|
|
11235
|
-
size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
|
|
11236
|
-
// Remove default track in Firefox
|
|
11237
|
-
"[&::-moz-range-track]:bg-transparent",
|
|
11238
|
-
"[&::-moz-range-track]:border-transparent",
|
|
11239
|
-
// Hover effects
|
|
11240
|
-
"hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-lg",
|
|
11241
|
-
"hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-lg",
|
|
11242
|
-
// Disabled styles
|
|
11243
|
-
disabled && [
|
|
11244
|
-
"cursor-not-allowed opacity-50",
|
|
11245
|
-
"[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50",
|
|
11246
|
-
"[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50"
|
|
11247
|
-
],
|
|
11248
|
-
className,
|
|
11249
|
-
thumbClassName
|
|
11250
|
-
),
|
|
11251
|
-
...props
|
|
11480
|
+
className: "absolute top-0 h-full bg-primary rounded-full",
|
|
11481
|
+
style: { left: `${rangeStartPct}%`, width: `${Math.max(0, rangeEndPct - rangeStartPct)}%` }
|
|
11252
11482
|
}
|
|
11253
|
-
)
|
|
11483
|
+
) : /* @__PURE__ */ jsx41("div", { className: "absolute left-0 top-0 h-full bg-primary rounded-full", style: { width: `${percentage}%` } }) }),
|
|
11484
|
+
(() => {
|
|
11485
|
+
const baseInputClassName = cn(
|
|
11486
|
+
// Base styles
|
|
11487
|
+
"absolute w-full h-full appearance-none bg-transparent cursor-pointer",
|
|
11488
|
+
!noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
|
|
11489
|
+
noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
|
|
11490
|
+
// Webkit styles for thumb
|
|
11491
|
+
"[&::-webkit-slider-thumb]:appearance-none",
|
|
11492
|
+
"[&::-webkit-slider-thumb]:bg-primary",
|
|
11493
|
+
"[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
|
|
11494
|
+
"[&::-webkit-slider-thumb]:rounded-full",
|
|
11495
|
+
"[&::-webkit-slider-thumb]:shadow-md",
|
|
11496
|
+
"[&::-webkit-slider-thumb]:cursor-pointer",
|
|
11497
|
+
"[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-150",
|
|
11498
|
+
size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
|
|
11499
|
+
size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
|
|
11500
|
+
size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
|
|
11501
|
+
// Firefox styles for thumb
|
|
11502
|
+
"[&::-moz-range-thumb]:bg-primary",
|
|
11503
|
+
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
|
|
11504
|
+
"[&::-moz-range-thumb]:rounded-full",
|
|
11505
|
+
"[&::-moz-range-thumb]:shadow-md",
|
|
11506
|
+
"[&::-moz-range-thumb]:cursor-pointer",
|
|
11507
|
+
"[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-150",
|
|
11508
|
+
size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
|
|
11509
|
+
size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
|
|
11510
|
+
size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
|
|
11511
|
+
// Remove default track in Firefox
|
|
11512
|
+
"[&::-moz-range-track]:bg-transparent",
|
|
11513
|
+
"[&::-moz-range-track]:border-transparent",
|
|
11514
|
+
// Hover effects
|
|
11515
|
+
"hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-lg",
|
|
11516
|
+
"hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-lg",
|
|
11517
|
+
// Disabled styles
|
|
11518
|
+
disabled && [
|
|
11519
|
+
"cursor-not-allowed opacity-50",
|
|
11520
|
+
"[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50",
|
|
11521
|
+
"[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50"
|
|
11522
|
+
],
|
|
11523
|
+
className,
|
|
11524
|
+
thumbClassName
|
|
11525
|
+
);
|
|
11526
|
+
if (!isRange) {
|
|
11527
|
+
return /* @__PURE__ */ jsx41(
|
|
11528
|
+
"input",
|
|
11529
|
+
{
|
|
11530
|
+
ref,
|
|
11531
|
+
type: "range",
|
|
11532
|
+
min,
|
|
11533
|
+
max,
|
|
11534
|
+
step,
|
|
11535
|
+
value: currentValue,
|
|
11536
|
+
onChange: handleSingleChange,
|
|
11537
|
+
onMouseUp,
|
|
11538
|
+
onTouchEnd,
|
|
11539
|
+
disabled,
|
|
11540
|
+
className: baseInputClassName,
|
|
11541
|
+
...props
|
|
11542
|
+
}
|
|
11543
|
+
);
|
|
11544
|
+
}
|
|
11545
|
+
const minZ = activeThumb === "min" ? "z-20" : "z-10";
|
|
11546
|
+
const maxZ = activeThumb === "max" ? "z-20" : "z-10";
|
|
11547
|
+
return /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11548
|
+
/* @__PURE__ */ jsx41(
|
|
11549
|
+
"div",
|
|
11550
|
+
{
|
|
11551
|
+
className: cn("absolute inset-0 z-30", disabled ? "cursor-not-allowed" : "cursor-pointer"),
|
|
11552
|
+
onPointerDown: startRangeDrag,
|
|
11553
|
+
onPointerMove: moveRangeDrag,
|
|
11554
|
+
onPointerUp: endRangeDrag,
|
|
11555
|
+
onPointerCancel: endRangeDrag
|
|
11556
|
+
}
|
|
11557
|
+
),
|
|
11558
|
+
/* @__PURE__ */ jsx41(
|
|
11559
|
+
"input",
|
|
11560
|
+
{
|
|
11561
|
+
ref,
|
|
11562
|
+
type: "range",
|
|
11563
|
+
min,
|
|
11564
|
+
max,
|
|
11565
|
+
step,
|
|
11566
|
+
value: normalizedRange[0],
|
|
11567
|
+
onChange: handleRangeChange("min"),
|
|
11568
|
+
onMouseUp,
|
|
11569
|
+
onTouchEnd,
|
|
11570
|
+
disabled,
|
|
11571
|
+
"aria-label": "Minimum value",
|
|
11572
|
+
onPointerDown: () => setActiveThumb("min"),
|
|
11573
|
+
onFocus: () => setActiveThumb("min"),
|
|
11574
|
+
className: cn(baseInputClassName, minZ, "pointer-events-none"),
|
|
11575
|
+
...props
|
|
11576
|
+
}
|
|
11577
|
+
),
|
|
11578
|
+
/* @__PURE__ */ jsx41(
|
|
11579
|
+
"input",
|
|
11580
|
+
{
|
|
11581
|
+
type: "range",
|
|
11582
|
+
min,
|
|
11583
|
+
max,
|
|
11584
|
+
step,
|
|
11585
|
+
value: normalizedRange[1],
|
|
11586
|
+
onChange: handleRangeChange("max"),
|
|
11587
|
+
onMouseUp,
|
|
11588
|
+
onTouchEnd,
|
|
11589
|
+
disabled,
|
|
11590
|
+
"aria-label": "Maximum value",
|
|
11591
|
+
onPointerDown: () => setActiveThumb("max"),
|
|
11592
|
+
onFocus: () => setActiveThumb("max"),
|
|
11593
|
+
className: cn(baseInputClassName, maxZ, "pointer-events-none"),
|
|
11594
|
+
...props
|
|
11595
|
+
}
|
|
11596
|
+
)
|
|
11597
|
+
] });
|
|
11598
|
+
})()
|
|
11254
11599
|
] })
|
|
11255
11600
|
] });
|
|
11256
11601
|
}
|
|
@@ -11260,7 +11605,7 @@ Slider.displayName = "Slider";
|
|
|
11260
11605
|
// ../../components/ui/OverlayControls.tsx
|
|
11261
11606
|
import { Dot as Dot2, Maximize2, Pause, Play, RotateCcw, RotateCw, Volume2, VolumeX } from "lucide-react";
|
|
11262
11607
|
import React35 from "react";
|
|
11263
|
-
import { Fragment as
|
|
11608
|
+
import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
11264
11609
|
function OverlayControls({
|
|
11265
11610
|
mode,
|
|
11266
11611
|
value,
|
|
@@ -11483,7 +11828,7 @@ function OverlayControls({
|
|
|
11483
11828
|
const handleSliderMouseLeave = () => {
|
|
11484
11829
|
setPreviewData(null);
|
|
11485
11830
|
};
|
|
11486
|
-
return /* @__PURE__ */ jsxs37(
|
|
11831
|
+
return /* @__PURE__ */ jsxs37(Fragment15, { children: [
|
|
11487
11832
|
keyboardFeedback && /* @__PURE__ */ jsx42(
|
|
11488
11833
|
"div",
|
|
11489
11834
|
{
|
|
@@ -11693,7 +12038,7 @@ function OverlayControls({
|
|
|
11693
12038
|
// ../../components/ui/CategoryTreeSelect.tsx
|
|
11694
12039
|
import { useState as useState29, useEffect as useEffect19 } from "react";
|
|
11695
12040
|
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown4, Check as Check6, FolderTree, Layers } from "lucide-react";
|
|
11696
|
-
import { Fragment as
|
|
12041
|
+
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11697
12042
|
var defaultLabels = {
|
|
11698
12043
|
emptyText: "No categories",
|
|
11699
12044
|
selectedText: (count) => `${count} selected`
|
|
@@ -11904,7 +12249,7 @@ function CategoryTreeSelect(props) {
|
|
|
11904
12249
|
// Modern trigger button styling
|
|
11905
12250
|
"group flex w-full items-center justify-between px-3 py-2.5",
|
|
11906
12251
|
"bg-background/80 backdrop-blur-sm border border-border/60",
|
|
11907
|
-
"rounded-
|
|
12252
|
+
"rounded-full h-11 text-sm",
|
|
11908
12253
|
"hover:bg-accent/10 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
|
|
11909
12254
|
"transition-all duration-300 ease-out",
|
|
11910
12255
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
@@ -11930,14 +12275,14 @@ function CategoryTreeSelect(props) {
|
|
|
11930
12275
|
]
|
|
11931
12276
|
}
|
|
11932
12277
|
),
|
|
11933
|
-
isOpen && !disabled && /* @__PURE__ */ jsxs38(
|
|
12278
|
+
isOpen && !disabled && /* @__PURE__ */ jsxs38(Fragment16, { children: [
|
|
11934
12279
|
/* @__PURE__ */ jsx43("div", { className: "fixed inset-0 z-10", onClick: () => setIsOpen(false) }),
|
|
11935
12280
|
/* @__PURE__ */ jsx43(
|
|
11936
12281
|
"div",
|
|
11937
12282
|
{
|
|
11938
12283
|
className: cn(
|
|
11939
12284
|
"absolute z-20 mt-2 w-full max-h-80 overflow-auto",
|
|
11940
|
-
"rounded-2xl border border-border/40 bg-popover/95 text-popover-foreground",
|
|
12285
|
+
"rounded-2xl md:rounded-3xl overflow-hidden border border-border/40 bg-popover/95 text-popover-foreground",
|
|
11941
12286
|
"shadow-2xl backdrop-blur-xl",
|
|
11942
12287
|
"p-2",
|
|
11943
12288
|
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
@@ -11950,7 +12295,7 @@ function CategoryTreeSelect(props) {
|
|
|
11950
12295
|
}
|
|
11951
12296
|
|
|
11952
12297
|
// ../../components/ui/ImageUpload.tsx
|
|
11953
|
-
import { useState as useState30, useRef as
|
|
12298
|
+
import { useState as useState30, useRef as useRef14, useCallback as useCallback11 } from "react";
|
|
11954
12299
|
import { Upload, X as X12, Image as ImageIcon, Loader2 as Loader25, Check as Check7 } from "lucide-react";
|
|
11955
12300
|
import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
11956
12301
|
function ImageUpload({
|
|
@@ -11971,7 +12316,7 @@ function ImageUpload({
|
|
|
11971
12316
|
const [isDragging, setIsDragging] = useState30(false);
|
|
11972
12317
|
const [uploading, setUploading] = useState30(false);
|
|
11973
12318
|
const [uploadedImages, setUploadedImages] = useState30([]);
|
|
11974
|
-
const fileInputRef =
|
|
12319
|
+
const fileInputRef = useRef14(null);
|
|
11975
12320
|
const { addToast } = useToast();
|
|
11976
12321
|
const t = useTranslations("OCR.imageUpload");
|
|
11977
12322
|
const previewSizes = {
|
|
@@ -11979,7 +12324,7 @@ function ImageUpload({
|
|
|
11979
12324
|
md: "w-24 h-24",
|
|
11980
12325
|
lg: "w-32 h-32"
|
|
11981
12326
|
};
|
|
11982
|
-
const handleDragOver =
|
|
12327
|
+
const handleDragOver = useCallback11(
|
|
11983
12328
|
(e) => {
|
|
11984
12329
|
e.preventDefault();
|
|
11985
12330
|
if (!disabled) {
|
|
@@ -11988,11 +12333,11 @@ function ImageUpload({
|
|
|
11988
12333
|
},
|
|
11989
12334
|
[disabled]
|
|
11990
12335
|
);
|
|
11991
|
-
const handleDragLeave =
|
|
12336
|
+
const handleDragLeave = useCallback11((e) => {
|
|
11992
12337
|
e.preventDefault();
|
|
11993
12338
|
setIsDragging(false);
|
|
11994
12339
|
}, []);
|
|
11995
|
-
const handleFiles =
|
|
12340
|
+
const handleFiles = useCallback11(
|
|
11996
12341
|
async (files) => {
|
|
11997
12342
|
if (files.length === 0) return;
|
|
11998
12343
|
const validFiles = files.filter((file) => {
|
|
@@ -12059,7 +12404,7 @@ function ImageUpload({
|
|
|
12059
12404
|
},
|
|
12060
12405
|
[maxSize, addToast, onUpload]
|
|
12061
12406
|
);
|
|
12062
|
-
const handleDrop =
|
|
12407
|
+
const handleDrop = useCallback11(
|
|
12063
12408
|
(e) => {
|
|
12064
12409
|
e.preventDefault();
|
|
12065
12410
|
setIsDragging(false);
|
|
@@ -12069,7 +12414,7 @@ function ImageUpload({
|
|
|
12069
12414
|
},
|
|
12070
12415
|
[disabled, handleFiles]
|
|
12071
12416
|
);
|
|
12072
|
-
const handleFileSelect =
|
|
12417
|
+
const handleFileSelect = useCallback11(
|
|
12073
12418
|
(e) => {
|
|
12074
12419
|
const files = Array.from(e.target.files || []);
|
|
12075
12420
|
handleFiles(files);
|
|
@@ -12174,7 +12519,7 @@ function ImageUpload({
|
|
|
12174
12519
|
// ../../components/ui/Carousel.tsx
|
|
12175
12520
|
import * as React37 from "react";
|
|
12176
12521
|
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight7 } from "lucide-react";
|
|
12177
|
-
import { Fragment as
|
|
12522
|
+
import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
12178
12523
|
function Carousel({
|
|
12179
12524
|
children,
|
|
12180
12525
|
autoScroll = true,
|
|
@@ -12386,7 +12731,7 @@ function Carousel({
|
|
|
12386
12731
|
))
|
|
12387
12732
|
}
|
|
12388
12733
|
),
|
|
12389
|
-
showArrows && totalSlides > slidesToShow && /* @__PURE__ */ jsxs40(
|
|
12734
|
+
showArrows && totalSlides > slidesToShow && /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
12390
12735
|
/* @__PURE__ */ jsx45(
|
|
12391
12736
|
Button_default,
|
|
12392
12737
|
{
|
|
@@ -12748,7 +13093,7 @@ function FallingIcons({
|
|
|
12748
13093
|
// ../../components/ui/List.tsx
|
|
12749
13094
|
import * as React39 from "react";
|
|
12750
13095
|
import { ChevronRight as ChevronRight8 } from "lucide-react";
|
|
12751
|
-
import { Fragment as
|
|
13096
|
+
import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
12752
13097
|
var SIZE_STYLES2 = {
|
|
12753
13098
|
xs: { label: "text-xs", desc: "text-[11px]", icon: "h-3.5 w-3.5", avatar: "h-6 w-6" },
|
|
12754
13099
|
sm: { label: "text-[13px]", desc: "text-[12px]", icon: "h-4 w-4", avatar: "h-8 w-8" },
|
|
@@ -12900,7 +13245,7 @@ var ListItem = React39.forwardRef(
|
|
|
12900
13245
|
}
|
|
12901
13246
|
}
|
|
12902
13247
|
} : {};
|
|
12903
|
-
const inner = /* @__PURE__ */ jsxs42(
|
|
13248
|
+
const inner = /* @__PURE__ */ jsxs42(Fragment18, { children: [
|
|
12904
13249
|
/* @__PURE__ */ jsxs42("div", { className: cn("flex items-center gap-3", contentClassName, "group/item relative"), ...headerProps, children: [
|
|
12905
13250
|
avatar && /* @__PURE__ */ jsx47("div", { className: cn("shrink-0", sz.avatar), children: typeof avatar === "string" ? /* @__PURE__ */ jsx47("img", { src: avatar, alt: "", className: cn("rounded-full object-cover", sz.avatar) }) : avatar }),
|
|
12906
13251
|
Left && !avatar && /* @__PURE__ */ jsx47("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ jsx47(Left, { className: cn(sz.icon) }) }),
|
|
@@ -12945,7 +13290,7 @@ var List_default = List;
|
|
|
12945
13290
|
// ../../components/ui/Watermark.tsx
|
|
12946
13291
|
import * as React40 from "react";
|
|
12947
13292
|
import { createPortal as createPortal5 } from "react-dom";
|
|
12948
|
-
import { Fragment as
|
|
13293
|
+
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12949
13294
|
var PRESETS2 = {
|
|
12950
13295
|
confidential: { text: "CONFIDENTIAL", color: "rgba(220, 38, 38, 0.15)", rotate: -22, fontSize: 16, fontWeight: "bold" },
|
|
12951
13296
|
draft: { text: "DRAFT", color: "rgba(59, 130, 246, 0.15)", rotate: -22, fontSize: 18, fontWeight: "bold" },
|
|
@@ -13224,7 +13569,7 @@ var Watermark = ({
|
|
|
13224
13569
|
}
|
|
13225
13570
|
);
|
|
13226
13571
|
if (fullPage) {
|
|
13227
|
-
return /* @__PURE__ */ jsxs43(
|
|
13572
|
+
return /* @__PURE__ */ jsxs43(Fragment19, { children: [
|
|
13228
13573
|
children,
|
|
13229
13574
|
typeof window !== "undefined" ? createPortal5(overlay, document.body) : null
|
|
13230
13575
|
] });
|
|
@@ -13516,7 +13861,7 @@ var Timeline_default = Timeline;
|
|
|
13516
13861
|
import * as React42 from "react";
|
|
13517
13862
|
import { Pipette, X as X13, Copy, Check as Check8, Palette, History } from "lucide-react";
|
|
13518
13863
|
import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
13519
|
-
var
|
|
13864
|
+
var clamp6 = (n, min, max) => Math.max(min, Math.min(max, n));
|
|
13520
13865
|
function hexToRgb(hex) {
|
|
13521
13866
|
const str = hex.replace(/^#/, "").trim();
|
|
13522
13867
|
if (str.length === 3) {
|
|
@@ -13534,7 +13879,7 @@ function hexToRgb(hex) {
|
|
|
13534
13879
|
return null;
|
|
13535
13880
|
}
|
|
13536
13881
|
function rgbToHex(r, g, b) {
|
|
13537
|
-
return `#${[r, g, b].map((v) =>
|
|
13882
|
+
return `#${[r, g, b].map((v) => clamp6(Math.round(v), 0, 255).toString(16).padStart(2, "0")).join("")}`;
|
|
13538
13883
|
}
|
|
13539
13884
|
function rgbToHsl(r, g, b) {
|
|
13540
13885
|
r /= 255;
|
|
@@ -13595,10 +13940,10 @@ function parseAnyColor(input) {
|
|
|
13595
13940
|
}
|
|
13596
13941
|
const rgbaMatch = s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/i);
|
|
13597
13942
|
if (rgbaMatch) {
|
|
13598
|
-
const r =
|
|
13599
|
-
const g =
|
|
13600
|
-
const b =
|
|
13601
|
-
const a = rgbaMatch[4] != null ?
|
|
13943
|
+
const r = clamp6(parseInt(rgbaMatch[1], 10), 0, 255);
|
|
13944
|
+
const g = clamp6(parseInt(rgbaMatch[2], 10), 0, 255);
|
|
13945
|
+
const b = clamp6(parseInt(rgbaMatch[3], 10), 0, 255);
|
|
13946
|
+
const a = rgbaMatch[4] != null ? clamp6(parseFloat(rgbaMatch[4]), 0, 1) : 1;
|
|
13602
13947
|
return { r, g, b, a };
|
|
13603
13948
|
}
|
|
13604
13949
|
const hslaMatch = s.match(/hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,?\s*(\d{1,3}(?:\.\d+)?)%?\s*,?\s*(\d{1,3}(?:\.\d+)?)%?(?:\s*,?\s*(\d*\.?\d+))?\s*\)/i);
|
|
@@ -13606,7 +13951,7 @@ function parseAnyColor(input) {
|
|
|
13606
13951
|
const h = parseFloat(hslaMatch[1]);
|
|
13607
13952
|
const sl = parseFloat(hslaMatch[2]);
|
|
13608
13953
|
const l = parseFloat(hslaMatch[3]);
|
|
13609
|
-
const a = hslaMatch[4] != null ?
|
|
13954
|
+
const a = hslaMatch[4] != null ? clamp6(parseFloat(hslaMatch[4]), 0, 1) : 1;
|
|
13610
13955
|
const rgb = hslToRgb(h, sl, l);
|
|
13611
13956
|
return { ...rgb, a };
|
|
13612
13957
|
}
|
|
@@ -13619,12 +13964,12 @@ function formatOutput({ r, g, b, a }, withAlpha, format) {
|
|
|
13619
13964
|
if (format === "hsl" || format === "hsla") {
|
|
13620
13965
|
const hsl = rgbToHsl(r, g, b);
|
|
13621
13966
|
if (format === "hsla" || withAlpha) {
|
|
13622
|
-
return `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%, ${
|
|
13967
|
+
return `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%, ${clamp6(a, 0, 1)})`;
|
|
13623
13968
|
}
|
|
13624
13969
|
return `hsl(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%)`;
|
|
13625
13970
|
}
|
|
13626
13971
|
if (withAlpha || a !== 1) {
|
|
13627
|
-
return `rgba(${
|
|
13972
|
+
return `rgba(${clamp6(r, 0, 255)}, ${clamp6(g, 0, 255)}, ${clamp6(b, 0, 255)}, ${clamp6(a, 0, 1)})`;
|
|
13628
13973
|
}
|
|
13629
13974
|
return rgbToHex(r, g, b);
|
|
13630
13975
|
}
|
|
@@ -13758,7 +14103,7 @@ function ColorPicker({
|
|
|
13758
14103
|
emit(next);
|
|
13759
14104
|
};
|
|
13760
14105
|
const setAlpha = (aPct) => {
|
|
13761
|
-
const a =
|
|
14106
|
+
const a = clamp6(aPct / 100, 0, 1);
|
|
13762
14107
|
const next = { ...rgba, a };
|
|
13763
14108
|
setRgba(next);
|
|
13764
14109
|
emit(next);
|
|
@@ -13837,7 +14182,7 @@ function ColorPicker({
|
|
|
13837
14182
|
placement: "bottom-start",
|
|
13838
14183
|
matchTriggerWidth: variant === "minimal",
|
|
13839
14184
|
contentWidth: contentWidthByVariant[variant],
|
|
13840
|
-
contentClassName: cn("p-3 rounded-
|
|
14185
|
+
contentClassName: cn("p-3 rounded-2xl md:rounded-3xl border border-border bg-card shadow-lg", contentClassName),
|
|
13841
14186
|
children: /* @__PURE__ */ jsxs45("div", { className: "space-y-3", children: [
|
|
13842
14187
|
variant !== "minimal" && /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
13843
14188
|
/* @__PURE__ */ jsx50(
|
|
@@ -14036,7 +14381,7 @@ function ColorPicker({
|
|
|
14036
14381
|
|
|
14037
14382
|
// ../../components/ui/Grid.tsx
|
|
14038
14383
|
import React43, { useId as useId7 } from "react";
|
|
14039
|
-
import { Fragment as
|
|
14384
|
+
import { Fragment as Fragment20, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
14040
14385
|
var BP_MIN = {
|
|
14041
14386
|
sm: 640,
|
|
14042
14387
|
md: 768,
|
|
@@ -14193,7 +14538,7 @@ var GridItem = React43.forwardRef(
|
|
|
14193
14538
|
st.opacity = 0;
|
|
14194
14539
|
st.animation = `uvGridItemFadeIn 0.5s ease-out forwards`;
|
|
14195
14540
|
}
|
|
14196
|
-
return /* @__PURE__ */ jsxs46(
|
|
14541
|
+
return /* @__PURE__ */ jsxs46(Fragment20, { children: [
|
|
14197
14542
|
animationDelay != null && /* @__PURE__ */ jsx51(
|
|
14198
14543
|
"style",
|
|
14199
14544
|
{
|
|
@@ -14223,12 +14568,12 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
14223
14568
|
var Grid_default = Grid;
|
|
14224
14569
|
|
|
14225
14570
|
// ../../components/ui/LineChart.tsx
|
|
14226
|
-
import { useMemo as
|
|
14571
|
+
import { useMemo as useMemo14, useState as useState37, useRef as useRef16 } from "react";
|
|
14227
14572
|
|
|
14228
14573
|
// ../../components/ui/ChartTooltip.tsx
|
|
14229
14574
|
import { useEffect as useEffect23, useState as useState36 } from "react";
|
|
14230
14575
|
import { createPortal as createPortal6 } from "react-dom";
|
|
14231
|
-
import { Fragment as
|
|
14576
|
+
import { Fragment as Fragment21, jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
14232
14577
|
function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, secondaryValue, items, containerRef }) {
|
|
14233
14578
|
const [isMounted, setIsMounted] = useState36(false);
|
|
14234
14579
|
const [position, setPosition] = useState36(null);
|
|
@@ -14275,7 +14620,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
14275
14620
|
":"
|
|
14276
14621
|
] }),
|
|
14277
14622
|
/* @__PURE__ */ jsx52("span", { className: "font-semibold ml-auto", children: item.value })
|
|
14278
|
-
] }, i)) }) : /* @__PURE__ */ jsxs47(
|
|
14623
|
+
] }, i)) }) : /* @__PURE__ */ jsxs47(Fragment21, { children: [
|
|
14279
14624
|
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2", children: [
|
|
14280
14625
|
color && /* @__PURE__ */ jsx52("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: color } }),
|
|
14281
14626
|
/* @__PURE__ */ jsx52("span", { className: "font-semibold", children: value })
|
|
@@ -14302,7 +14647,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
14302
14647
|
}
|
|
14303
14648
|
|
|
14304
14649
|
// ../../components/ui/LineChart.tsx
|
|
14305
|
-
import { Fragment as
|
|
14650
|
+
import { Fragment as Fragment22, jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
14306
14651
|
function LineChart({
|
|
14307
14652
|
data,
|
|
14308
14653
|
width = 400,
|
|
@@ -14317,12 +14662,12 @@ function LineChart({
|
|
|
14317
14662
|
curved = true,
|
|
14318
14663
|
className = ""
|
|
14319
14664
|
}) {
|
|
14320
|
-
const svgRef =
|
|
14665
|
+
const svgRef = useRef16(null);
|
|
14321
14666
|
const padding = { top: 20, right: 20, bottom: 40, left: 40 };
|
|
14322
14667
|
const chartWidth = width - padding.left - padding.right;
|
|
14323
14668
|
const chartHeight = height - padding.top - padding.bottom;
|
|
14324
14669
|
const [hoveredPoint, setHoveredPoint] = useState37(null);
|
|
14325
|
-
const { minValue, maxValue, points, linePath, areaPath } =
|
|
14670
|
+
const { minValue, maxValue, points, linePath, areaPath } = useMemo14(() => {
|
|
14326
14671
|
if (!data.length) return { minValue: 0, maxValue: 0, points: [], linePath: "", areaPath: "" };
|
|
14327
14672
|
const values = data.map((d) => d.value);
|
|
14328
14673
|
const min = Math.min(...values);
|
|
@@ -14357,7 +14702,7 @@ function LineChart({
|
|
|
14357
14702
|
}
|
|
14358
14703
|
return { minValue: min, maxValue: max, points: pts, linePath: path, areaPath: area };
|
|
14359
14704
|
}, [data, chartWidth, chartHeight, curved, padding.left, padding.top]);
|
|
14360
|
-
const gridLines =
|
|
14705
|
+
const gridLines = useMemo14(() => {
|
|
14361
14706
|
const lines = [];
|
|
14362
14707
|
const steps = 5;
|
|
14363
14708
|
for (let i = 0; i <= steps; i++) {
|
|
@@ -14367,7 +14712,7 @@ function LineChart({
|
|
|
14367
14712
|
}
|
|
14368
14713
|
return lines;
|
|
14369
14714
|
}, [minValue, maxValue, chartHeight, padding.top]);
|
|
14370
|
-
return /* @__PURE__ */ jsxs48(
|
|
14715
|
+
return /* @__PURE__ */ jsxs48(Fragment22, { children: [
|
|
14371
14716
|
/* @__PURE__ */ jsxs48("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
14372
14717
|
showGrid && /* @__PURE__ */ jsx53("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsxs48("g", { children: [
|
|
14373
14718
|
/* @__PURE__ */ jsx53("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
@@ -14475,8 +14820,8 @@ function LineChart({
|
|
|
14475
14820
|
}
|
|
14476
14821
|
|
|
14477
14822
|
// ../../components/ui/BarChart.tsx
|
|
14478
|
-
import { useMemo as
|
|
14479
|
-
import { Fragment as
|
|
14823
|
+
import { useMemo as useMemo15, useState as useState38, useRef as useRef17 } from "react";
|
|
14824
|
+
import { Fragment as Fragment23, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
14480
14825
|
function BarChart({
|
|
14481
14826
|
data,
|
|
14482
14827
|
width = 400,
|
|
@@ -14491,12 +14836,12 @@ function BarChart({
|
|
|
14491
14836
|
barGap = 0.3,
|
|
14492
14837
|
className = ""
|
|
14493
14838
|
}) {
|
|
14494
|
-
const svgRef =
|
|
14839
|
+
const svgRef = useRef17(null);
|
|
14495
14840
|
const padding = horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 };
|
|
14496
14841
|
const chartWidth = width - padding.left - padding.right;
|
|
14497
14842
|
const chartHeight = height - padding.top - padding.bottom;
|
|
14498
14843
|
const [hoveredBar, setHoveredBar] = useState38(null);
|
|
14499
|
-
const { maxValue, bars, gridLines } =
|
|
14844
|
+
const { maxValue, bars, gridLines } = useMemo15(() => {
|
|
14500
14845
|
if (!data.length) return { maxValue: 0, bars: [], gridLines: [] };
|
|
14501
14846
|
const max = Math.max(...data.map((d) => d.value));
|
|
14502
14847
|
const barCount = data.length;
|
|
@@ -14545,12 +14890,12 @@ function BarChart({
|
|
|
14545
14890
|
}
|
|
14546
14891
|
return { maxValue: max, bars: barsData, gridLines: lines };
|
|
14547
14892
|
}, [data, chartWidth, chartHeight, horizontal, barGap, padding, width, height]);
|
|
14548
|
-
return /* @__PURE__ */ jsxs49(
|
|
14893
|
+
return /* @__PURE__ */ jsxs49(Fragment23, { children: [
|
|
14549
14894
|
/* @__PURE__ */ jsxs49("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
14550
|
-
showGrid && /* @__PURE__ */ jsx54("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsx54("g", { children: horizontal ? /* @__PURE__ */ jsxs49(
|
|
14895
|
+
showGrid && /* @__PURE__ */ jsx54("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsx54("g", { children: horizontal ? /* @__PURE__ */ jsxs49(Fragment23, { children: [
|
|
14551
14896
|
/* @__PURE__ */ jsx54("line", { x1: line.x, y1: line.y1, x2: line.x, y2: line.y2, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
14552
14897
|
/* @__PURE__ */ jsx54("text", { x: line.x, y: height - 8, textAnchor: "middle", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
|
|
14553
|
-
] }) : /* @__PURE__ */ jsxs49(
|
|
14898
|
+
] }) : /* @__PURE__ */ jsxs49(Fragment23, { children: [
|
|
14554
14899
|
/* @__PURE__ */ jsx54("line", { x1: line.x1, y1: line.y, x2: line.x2, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
14555
14900
|
/* @__PURE__ */ jsx54("text", { x: padding.left - 8, y: line.y + 4, textAnchor: "end", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
|
|
14556
14901
|
] }) }, i)) }),
|
|
@@ -14657,7 +15002,7 @@ function BarChart({
|
|
|
14657
15002
|
}
|
|
14658
15003
|
|
|
14659
15004
|
// ../../components/ui/PieChart.tsx
|
|
14660
|
-
import { useMemo as
|
|
15005
|
+
import { useMemo as useMemo16, useState as useState39, useRef as useRef18 } from "react";
|
|
14661
15006
|
import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
14662
15007
|
function PieChart({
|
|
14663
15008
|
data,
|
|
@@ -14671,11 +15016,11 @@ function PieChart({
|
|
|
14671
15016
|
startAngle = -90,
|
|
14672
15017
|
className = ""
|
|
14673
15018
|
}) {
|
|
14674
|
-
const containerRef =
|
|
15019
|
+
const containerRef = useRef18(null);
|
|
14675
15020
|
const center = size / 2;
|
|
14676
15021
|
const radius = size / 2 - 10;
|
|
14677
15022
|
const innerRadius = donut ? radius - donutWidth : 0;
|
|
14678
|
-
const { segments, total } =
|
|
15023
|
+
const { segments, total } = useMemo16(() => {
|
|
14679
15024
|
if (!data.length) return { segments: [], total: 0 };
|
|
14680
15025
|
const sum = data.reduce((acc, d) => acc + d.value, 0);
|
|
14681
15026
|
let currentAngle = startAngle;
|
|
@@ -14822,7 +15167,7 @@ function PieChart({
|
|
|
14822
15167
|
}
|
|
14823
15168
|
|
|
14824
15169
|
// ../../components/ui/AreaChart.tsx
|
|
14825
|
-
import { useMemo as
|
|
15170
|
+
import { useMemo as useMemo17, useState as useState40, useRef as useRef19 } from "react";
|
|
14826
15171
|
import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
14827
15172
|
function getCatmullRomSpline(points) {
|
|
14828
15173
|
if (points.length < 2) return "";
|
|
@@ -14857,12 +15202,12 @@ function AreaChart({
|
|
|
14857
15202
|
curved = true,
|
|
14858
15203
|
className = ""
|
|
14859
15204
|
}) {
|
|
14860
|
-
const containerRef =
|
|
15205
|
+
const containerRef = useRef19(null);
|
|
14861
15206
|
const padding = { top: 20, right: 20, bottom: 40, left: 50 };
|
|
14862
15207
|
const chartWidth = width - padding.left - padding.right;
|
|
14863
15208
|
const chartHeight = height - padding.top - padding.bottom;
|
|
14864
15209
|
const [hoveredPoint, setHoveredPoint] = useState40(null);
|
|
14865
|
-
const { processedSeries, gridLines, maxValue, labels } =
|
|
15210
|
+
const { processedSeries, gridLines, maxValue, labels } = useMemo17(() => {
|
|
14866
15211
|
if (!series.length || !series[0]?.data?.length) {
|
|
14867
15212
|
return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
|
|
14868
15213
|
}
|
|
@@ -15076,7 +15421,7 @@ function AreaChart({
|
|
|
15076
15421
|
}
|
|
15077
15422
|
|
|
15078
15423
|
// ../../components/ui/Sparkline.tsx
|
|
15079
|
-
import { useMemo as
|
|
15424
|
+
import { useMemo as useMemo18 } from "react";
|
|
15080
15425
|
import { jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
15081
15426
|
function getCatmullRomSpline2(points) {
|
|
15082
15427
|
if (points.length < 2) return "";
|
|
@@ -15115,7 +15460,7 @@ function Sparkline({
|
|
|
15115
15460
|
const padding = 4;
|
|
15116
15461
|
const chartWidth = width - padding * 2;
|
|
15117
15462
|
const chartHeight = height - padding * 2;
|
|
15118
|
-
const { points, linePath, areaPath, lineLength, trend } =
|
|
15463
|
+
const { points, linePath, areaPath, lineLength, trend } = useMemo18(() => {
|
|
15119
15464
|
const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
|
|
15120
15465
|
if (!normalizedData.length) {
|
|
15121
15466
|
return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
|
|
@@ -15219,7 +15564,7 @@ function Sparkline({
|
|
|
15219
15564
|
}
|
|
15220
15565
|
|
|
15221
15566
|
// ../../components/ui/RadarChart.tsx
|
|
15222
|
-
import { useMemo as
|
|
15567
|
+
import { useMemo as useMemo19, useState as useState41, useRef as useRef20 } from "react";
|
|
15223
15568
|
import { jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
15224
15569
|
function RadarChart({
|
|
15225
15570
|
series,
|
|
@@ -15231,11 +15576,11 @@ function RadarChart({
|
|
|
15231
15576
|
animated = true,
|
|
15232
15577
|
className = ""
|
|
15233
15578
|
}) {
|
|
15234
|
-
const containerRef =
|
|
15579
|
+
const containerRef = useRef20(null);
|
|
15235
15580
|
const center = size / 2;
|
|
15236
15581
|
const radius = size / 2 - 40;
|
|
15237
15582
|
const [hoveredPoint, setHoveredPoint] = useState41(null);
|
|
15238
|
-
const { axes, processedSeries, levelPaths } =
|
|
15583
|
+
const { axes, processedSeries, levelPaths } = useMemo19(() => {
|
|
15239
15584
|
if (!series.length || !series[0]?.data?.length) {
|
|
15240
15585
|
return { axes: [], processedSeries: [], levelPaths: [] };
|
|
15241
15586
|
}
|
|
@@ -15419,7 +15764,7 @@ function RadarChart({
|
|
|
15419
15764
|
}
|
|
15420
15765
|
|
|
15421
15766
|
// ../../components/ui/GaugeChart.tsx
|
|
15422
|
-
import { useMemo as
|
|
15767
|
+
import { useMemo as useMemo20 } from "react";
|
|
15423
15768
|
import { jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
15424
15769
|
function GaugeChart({
|
|
15425
15770
|
value,
|
|
@@ -15439,7 +15784,7 @@ function GaugeChart({
|
|
|
15439
15784
|
}) {
|
|
15440
15785
|
const center = size / 2;
|
|
15441
15786
|
const radius = center - thickness / 2 - 10;
|
|
15442
|
-
const { backgroundPath, valuePath, percentage, needleAngle } =
|
|
15787
|
+
const { backgroundPath, valuePath, percentage, needleAngle } = useMemo20(() => {
|
|
15443
15788
|
const normalizedValue = Math.min(Math.max(value, min), max);
|
|
15444
15789
|
const pct = (normalizedValue - min) / (max - min);
|
|
15445
15790
|
const totalAngle = endAngle - startAngle;
|
|
@@ -15588,16 +15933,16 @@ function GaugeChart({
|
|
|
15588
15933
|
|
|
15589
15934
|
// ../../components/ui/ClientOnly.tsx
|
|
15590
15935
|
import { useEffect as useEffect24, useState as useState42 } from "react";
|
|
15591
|
-
import { Fragment as
|
|
15936
|
+
import { Fragment as Fragment24, jsx as jsx60 } from "react/jsx-runtime";
|
|
15592
15937
|
function ClientOnly({ children, fallback = null }) {
|
|
15593
15938
|
const [hasMounted, setHasMounted] = useState42(false);
|
|
15594
15939
|
useEffect24(() => {
|
|
15595
15940
|
setHasMounted(true);
|
|
15596
15941
|
}, []);
|
|
15597
15942
|
if (!hasMounted) {
|
|
15598
|
-
return /* @__PURE__ */ jsx60(
|
|
15943
|
+
return /* @__PURE__ */ jsx60(Fragment24, { children: fallback });
|
|
15599
15944
|
}
|
|
15600
|
-
return /* @__PURE__ */ jsx60(
|
|
15945
|
+
return /* @__PURE__ */ jsx60(Fragment24, { children });
|
|
15601
15946
|
}
|
|
15602
15947
|
|
|
15603
15948
|
// ../../components/ui/Loading.tsx
|
|
@@ -16239,7 +16584,7 @@ function validateColumns(columns) {
|
|
|
16239
16584
|
}
|
|
16240
16585
|
|
|
16241
16586
|
// ../../components/ui/DataTable/DataTable.tsx
|
|
16242
|
-
import { Fragment as
|
|
16587
|
+
import { Fragment as Fragment25, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
16243
16588
|
function DataTable({
|
|
16244
16589
|
columns,
|
|
16245
16590
|
data,
|
|
@@ -16477,17 +16822,17 @@ function DataTable({
|
|
|
16477
16822
|
isCenterAlign && "justify-center",
|
|
16478
16823
|
!isRightAlign && !isCenterAlign && "justify-start"
|
|
16479
16824
|
),
|
|
16480
|
-
children: isRightAlign ? /* @__PURE__ */ jsxs59(
|
|
16825
|
+
children: isRightAlign ? /* @__PURE__ */ jsxs59(Fragment25, { children: [
|
|
16481
16826
|
filterContent,
|
|
16482
16827
|
titleContent
|
|
16483
|
-
] }) : /* @__PURE__ */ jsxs59(
|
|
16828
|
+
] }) : /* @__PURE__ */ jsxs59(Fragment25, { children: [
|
|
16484
16829
|
titleContent,
|
|
16485
16830
|
filterContent
|
|
16486
16831
|
] })
|
|
16487
16832
|
}
|
|
16488
16833
|
);
|
|
16489
16834
|
};
|
|
16490
|
-
const renderHeader = /* @__PURE__ */ jsx65(
|
|
16835
|
+
const renderHeader = /* @__PURE__ */ jsx65(Fragment25, { children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsx65(TableRow, { children: row.map((headerCell, cellIndex) => {
|
|
16491
16836
|
const { column: col, colSpan, rowSpan, isLeaf } = headerCell;
|
|
16492
16837
|
const prevCell = cellIndex > 0 ? row[cellIndex - 1] : null;
|
|
16493
16838
|
const prevCol = prevCell?.column;
|
|
@@ -16976,9 +17321,9 @@ function AccessDenied({
|
|
|
16976
17321
|
|
|
16977
17322
|
// ../../components/ui/ThemeToggleHeadless.tsx
|
|
16978
17323
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
16979
|
-
import { useEffect as useEffect26, useRef as
|
|
17324
|
+
import { useEffect as useEffect26, useRef as useRef21, useState as useState43 } from "react";
|
|
16980
17325
|
import { createPortal as createPortal7 } from "react-dom";
|
|
16981
|
-
import { Fragment as
|
|
17326
|
+
import { Fragment as Fragment26, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
16982
17327
|
function ThemeToggleHeadless({
|
|
16983
17328
|
theme,
|
|
16984
17329
|
onChange,
|
|
@@ -16987,7 +17332,7 @@ function ThemeToggleHeadless({
|
|
|
16987
17332
|
}) {
|
|
16988
17333
|
const [isOpen, setIsOpen] = useState43(false);
|
|
16989
17334
|
const [mounted, setMounted] = useState43(false);
|
|
16990
|
-
const triggerRef =
|
|
17335
|
+
const triggerRef = useRef21(null);
|
|
16991
17336
|
const [dropdownPosition, setDropdownPosition] = useState43(null);
|
|
16992
17337
|
useEffect26(() => setMounted(true), []);
|
|
16993
17338
|
const themes = [
|
|
@@ -17029,7 +17374,7 @@ function ThemeToggleHeadless({
|
|
|
17029
17374
|
children: /* @__PURE__ */ jsx70(CurrentIcon, { className: "h-5 w-5" })
|
|
17030
17375
|
}
|
|
17031
17376
|
),
|
|
17032
|
-
isOpen && /* @__PURE__ */ jsxs64(
|
|
17377
|
+
isOpen && /* @__PURE__ */ jsxs64(Fragment26, { children: [
|
|
17033
17378
|
typeof window !== "undefined" && createPortal7(/* @__PURE__ */ jsx70("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
17034
17379
|
typeof window !== "undefined" && dropdownPosition && createPortal7(
|
|
17035
17380
|
/* @__PURE__ */ jsx70(
|
|
@@ -17078,10 +17423,10 @@ function ThemeToggleHeadless({
|
|
|
17078
17423
|
}
|
|
17079
17424
|
|
|
17080
17425
|
// ../../components/ui/LanguageSwitcherHeadless.tsx
|
|
17081
|
-
import { useRef as
|
|
17426
|
+
import { useRef as useRef22, useState as useState44 } from "react";
|
|
17082
17427
|
import { createPortal as createPortal8 } from "react-dom";
|
|
17083
17428
|
import { Globe } from "lucide-react";
|
|
17084
|
-
import { Fragment as
|
|
17429
|
+
import { Fragment as Fragment27, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
17085
17430
|
function LanguageSwitcherHeadless({
|
|
17086
17431
|
locales,
|
|
17087
17432
|
currentLocale,
|
|
@@ -17091,7 +17436,7 @@ function LanguageSwitcherHeadless({
|
|
|
17091
17436
|
}) {
|
|
17092
17437
|
const [isOpen, setIsOpen] = useState44(false);
|
|
17093
17438
|
const [dropdownPosition, setDropdownPosition] = useState44(null);
|
|
17094
|
-
const triggerButtonRef =
|
|
17439
|
+
const triggerButtonRef = useRef22(null);
|
|
17095
17440
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
17096
17441
|
const calculatePosition = () => {
|
|
17097
17442
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -17126,7 +17471,7 @@ function LanguageSwitcherHeadless({
|
|
|
17126
17471
|
children: /* @__PURE__ */ jsx71(Globe, { className: "h-5 w-5" })
|
|
17127
17472
|
}
|
|
17128
17473
|
),
|
|
17129
|
-
isOpen && /* @__PURE__ */ jsxs65(
|
|
17474
|
+
isOpen && /* @__PURE__ */ jsxs65(Fragment27, { children: [
|
|
17130
17475
|
typeof window !== "undefined" && createPortal8(/* @__PURE__ */ jsx71("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
17131
17476
|
typeof window !== "undefined" && dropdownPosition && createPortal8(
|
|
17132
17477
|
/* @__PURE__ */ jsx71(
|
|
@@ -18042,7 +18387,7 @@ function useSmartLocale() {
|
|
|
18042
18387
|
}
|
|
18043
18388
|
|
|
18044
18389
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
18045
|
-
import { useEffect as useEffect31, useMemo as
|
|
18390
|
+
import { useEffect as useEffect31, useMemo as useMemo23 } from "react";
|
|
18046
18391
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
18047
18392
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
18048
18393
|
|
|
@@ -18085,7 +18430,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
18085
18430
|
import { Extension } from "@tiptap/core";
|
|
18086
18431
|
import Suggestion from "@tiptap/suggestion";
|
|
18087
18432
|
import { ReactRenderer } from "@tiptap/react";
|
|
18088
|
-
import { forwardRef as forwardRef13, useEffect as useEffect27, useImperativeHandle, useRef as
|
|
18433
|
+
import { forwardRef as forwardRef13, useEffect as useEffect27, useImperativeHandle, useRef as useRef23, useState as useState45 } from "react";
|
|
18089
18434
|
import {
|
|
18090
18435
|
FileCode,
|
|
18091
18436
|
Heading1,
|
|
@@ -18103,7 +18448,7 @@ import tippy from "tippy.js";
|
|
|
18103
18448
|
import { jsx as jsx74, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
18104
18449
|
var CommandList = forwardRef13((props, ref) => {
|
|
18105
18450
|
const [selectedIndex, setSelectedIndex] = useState45(0);
|
|
18106
|
-
const listRef =
|
|
18451
|
+
const listRef = useRef23(null);
|
|
18107
18452
|
useEffect27(() => {
|
|
18108
18453
|
setSelectedIndex(0);
|
|
18109
18454
|
}, [props.items]);
|
|
@@ -18416,7 +18761,7 @@ var ClipboardImages = Extension2.create({
|
|
|
18416
18761
|
});
|
|
18417
18762
|
|
|
18418
18763
|
// ../../components/ui/UEditor/resizable-image.tsx
|
|
18419
|
-
import { useEffect as useEffect28, useRef as
|
|
18764
|
+
import { useEffect as useEffect28, useRef as useRef24, useState as useState46 } from "react";
|
|
18420
18765
|
import Image3 from "@tiptap/extension-image";
|
|
18421
18766
|
import { mergeAttributes } from "@tiptap/core";
|
|
18422
18767
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -18431,19 +18776,19 @@ function toNullableNumber(value) {
|
|
|
18431
18776
|
}
|
|
18432
18777
|
return null;
|
|
18433
18778
|
}
|
|
18434
|
-
function
|
|
18779
|
+
function clamp7(value, min, max) {
|
|
18435
18780
|
return Math.min(max, Math.max(min, value));
|
|
18436
18781
|
}
|
|
18437
18782
|
function ResizableImageNodeView(props) {
|
|
18438
18783
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
18439
|
-
const wrapperRef =
|
|
18440
|
-
const imgRef =
|
|
18784
|
+
const wrapperRef = useRef24(null);
|
|
18785
|
+
const imgRef = useRef24(null);
|
|
18441
18786
|
const [isHovered, setIsHovered] = useState46(false);
|
|
18442
18787
|
const [isResizing, setIsResizing] = useState46(false);
|
|
18443
18788
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
18444
18789
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
18445
18790
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
18446
|
-
const dragStateRef =
|
|
18791
|
+
const dragStateRef = useRef24(null);
|
|
18447
18792
|
useEffect28(() => {
|
|
18448
18793
|
const img = imgRef.current;
|
|
18449
18794
|
if (!img) return;
|
|
@@ -18493,18 +18838,18 @@ function ResizableImageNodeView(props) {
|
|
|
18493
18838
|
let nextH = drag.startH;
|
|
18494
18839
|
if (event.ctrlKey) {
|
|
18495
18840
|
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
18496
|
-
nextW =
|
|
18497
|
-
nextH =
|
|
18841
|
+
nextW = clamp7(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
|
|
18842
|
+
nextH = clamp7(nextW / drag.aspect, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
|
|
18498
18843
|
} else {
|
|
18499
|
-
nextH =
|
|
18500
|
-
nextW =
|
|
18844
|
+
nextH = clamp7(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
|
|
18845
|
+
nextW = clamp7(nextH * drag.aspect, MIN_IMAGE_SIZE_PX, drag.maxW);
|
|
18501
18846
|
}
|
|
18502
18847
|
} else {
|
|
18503
18848
|
if (!drag.axis && (Math.abs(dx) > AXIS_LOCK_THRESHOLD_PX || Math.abs(dy) > AXIS_LOCK_THRESHOLD_PX)) {
|
|
18504
18849
|
drag.axis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
|
|
18505
18850
|
}
|
|
18506
|
-
if (drag.axis === "x") nextW =
|
|
18507
|
-
if (drag.axis === "y") nextH =
|
|
18851
|
+
if (drag.axis === "x") nextW = clamp7(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
|
|
18852
|
+
if (drag.axis === "y") nextH = clamp7(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
|
|
18508
18853
|
}
|
|
18509
18854
|
drag.lastW = nextW;
|
|
18510
18855
|
drag.lastH = nextH;
|
|
@@ -18736,7 +19081,7 @@ function buildUEditorExtensions({
|
|
|
18736
19081
|
}
|
|
18737
19082
|
|
|
18738
19083
|
// ../../components/ui/UEditor/toolbar.tsx
|
|
18739
|
-
import React65, { useRef as
|
|
19084
|
+
import React65, { useRef as useRef26, useState as useState48 } from "react";
|
|
18740
19085
|
import { useTranslations as useTranslations4 } from "next-intl";
|
|
18741
19086
|
import {
|
|
18742
19087
|
AlignCenter,
|
|
@@ -18774,13 +19119,13 @@ import {
|
|
|
18774
19119
|
} from "lucide-react";
|
|
18775
19120
|
|
|
18776
19121
|
// ../../components/ui/UEditor/colors.tsx
|
|
18777
|
-
import { useMemo as
|
|
19122
|
+
import { useMemo as useMemo21 } from "react";
|
|
18778
19123
|
import { useTranslations as useTranslations2 } from "next-intl";
|
|
18779
19124
|
import { X as X14 } from "lucide-react";
|
|
18780
19125
|
import { jsx as jsx76, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
18781
19126
|
var useEditorColors = () => {
|
|
18782
19127
|
const t = useTranslations2("UEditor");
|
|
18783
|
-
const textColors =
|
|
19128
|
+
const textColors = useMemo21(
|
|
18784
19129
|
() => [
|
|
18785
19130
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
18786
19131
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -18793,7 +19138,7 @@ var useEditorColors = () => {
|
|
|
18793
19138
|
],
|
|
18794
19139
|
[t]
|
|
18795
19140
|
);
|
|
18796
|
-
const highlightColors =
|
|
19141
|
+
const highlightColors = useMemo21(
|
|
18797
19142
|
() => [
|
|
18798
19143
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
18799
19144
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -18838,7 +19183,7 @@ var EditorColorPalette = ({
|
|
|
18838
19183
|
] });
|
|
18839
19184
|
|
|
18840
19185
|
// ../../components/ui/UEditor/inputs.tsx
|
|
18841
|
-
import { useEffect as useEffect29, useRef as
|
|
19186
|
+
import { useEffect as useEffect29, useRef as useRef25, useState as useState47 } from "react";
|
|
18842
19187
|
import { useTranslations as useTranslations3 } from "next-intl";
|
|
18843
19188
|
import { Check as Check9, X as X15 } from "lucide-react";
|
|
18844
19189
|
import { jsx as jsx77, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
@@ -18856,7 +19201,7 @@ var LinkInput = ({
|
|
|
18856
19201
|
}) => {
|
|
18857
19202
|
const t = useTranslations3("UEditor");
|
|
18858
19203
|
const [url, setUrl] = useState47(initialUrl);
|
|
18859
|
-
const inputRef =
|
|
19204
|
+
const inputRef = useRef25(null);
|
|
18860
19205
|
useEffect29(() => {
|
|
18861
19206
|
inputRef.current?.focus();
|
|
18862
19207
|
inputRef.current?.select();
|
|
@@ -18886,7 +19231,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
18886
19231
|
const t = useTranslations3("UEditor");
|
|
18887
19232
|
const [url, setUrl] = useState47("");
|
|
18888
19233
|
const [alt, setAlt] = useState47("");
|
|
18889
|
-
const inputRef =
|
|
19234
|
+
const inputRef = useRef25(null);
|
|
18890
19235
|
useEffect29(() => {
|
|
18891
19236
|
inputRef.current?.focus();
|
|
18892
19237
|
}, []);
|
|
@@ -18940,7 +19285,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
18940
19285
|
};
|
|
18941
19286
|
|
|
18942
19287
|
// ../../components/ui/UEditor/toolbar.tsx
|
|
18943
|
-
import { Fragment as
|
|
19288
|
+
import { Fragment as Fragment28, jsx as jsx78, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
18944
19289
|
function fileToDataUrl2(file) {
|
|
18945
19290
|
return new Promise((resolve, reject) => {
|
|
18946
19291
|
const reader = new FileReader();
|
|
@@ -18988,7 +19333,7 @@ var EditorToolbar = ({
|
|
|
18988
19333
|
const t = useTranslations4("UEditor");
|
|
18989
19334
|
const { textColors, highlightColors } = useEditorColors();
|
|
18990
19335
|
const [showImageInput, setShowImageInput] = useState48(false);
|
|
18991
|
-
const fileInputRef =
|
|
19336
|
+
const fileInputRef = useRef26(null);
|
|
18992
19337
|
const [isUploadingImage, setIsUploadingImage] = useState48(false);
|
|
18993
19338
|
const [imageUploadError, setImageUploadError] = useState48(null);
|
|
18994
19339
|
const insertImageFiles = async (files) => {
|
|
@@ -19297,7 +19642,7 @@ var EditorToolbar = ({
|
|
|
19297
19642
|
},
|
|
19298
19643
|
onCancel: () => setShowImageInput(false)
|
|
19299
19644
|
}
|
|
19300
|
-
) : /* @__PURE__ */ jsxs70(
|
|
19645
|
+
) : /* @__PURE__ */ jsxs70(Fragment28, { children: [
|
|
19301
19646
|
/* @__PURE__ */ jsx78(DropdownMenuItem, { icon: LinkIcon, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true) }),
|
|
19302
19647
|
/* @__PURE__ */ jsx78(
|
|
19303
19648
|
DropdownMenuItem,
|
|
@@ -19407,7 +19752,7 @@ var EditorToolbar = ({
|
|
|
19407
19752
|
};
|
|
19408
19753
|
|
|
19409
19754
|
// ../../components/ui/UEditor/menus.tsx
|
|
19410
|
-
import { useCallback as
|
|
19755
|
+
import { useCallback as useCallback14, useEffect as useEffect30, useMemo as useMemo22, useRef as useRef27, useState as useState49 } from "react";
|
|
19411
19756
|
import { createPortal as createPortal9 } from "react-dom";
|
|
19412
19757
|
import { useTranslations as useTranslations5 } from "next-intl";
|
|
19413
19758
|
import {
|
|
@@ -19437,8 +19782,8 @@ import { jsx as jsx79, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
|
19437
19782
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
19438
19783
|
const t = useTranslations5("UEditor");
|
|
19439
19784
|
const [selectedIndex, setSelectedIndex] = useState49(0);
|
|
19440
|
-
const menuRef =
|
|
19441
|
-
const allCommands =
|
|
19785
|
+
const menuRef = useRef27(null);
|
|
19786
|
+
const allCommands = useMemo22(
|
|
19442
19787
|
() => [
|
|
19443
19788
|
{
|
|
19444
19789
|
icon: Type3,
|
|
@@ -19509,7 +19854,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
19509
19854
|
],
|
|
19510
19855
|
[editor, t]
|
|
19511
19856
|
);
|
|
19512
|
-
const commands =
|
|
19857
|
+
const commands = useMemo22(() => {
|
|
19513
19858
|
if (!filterText) return allCommands;
|
|
19514
19859
|
const lowerFilter = filterText.toLowerCase();
|
|
19515
19860
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
@@ -19521,7 +19866,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
19521
19866
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
19522
19867
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
19523
19868
|
}, [selectedIndex]);
|
|
19524
|
-
const selectCommand =
|
|
19869
|
+
const selectCommand = useCallback14(
|
|
19525
19870
|
(index) => {
|
|
19526
19871
|
const command = commands[index];
|
|
19527
19872
|
if (command) {
|
|
@@ -19744,9 +20089,9 @@ var BubbleMenuContent = ({
|
|
|
19744
20089
|
var CustomBubbleMenu = ({ editor }) => {
|
|
19745
20090
|
const [isVisible, setIsVisible] = useState49(false);
|
|
19746
20091
|
const [position, setPosition] = useState49({ top: 0, left: 0 });
|
|
19747
|
-
const menuRef =
|
|
19748
|
-
const keepOpenRef =
|
|
19749
|
-
const setKeepOpen =
|
|
20092
|
+
const menuRef = useRef27(null);
|
|
20093
|
+
const keepOpenRef = useRef27(false);
|
|
20094
|
+
const setKeepOpen = useCallback14((next) => {
|
|
19750
20095
|
keepOpenRef.current = next;
|
|
19751
20096
|
if (next) setIsVisible(true);
|
|
19752
20097
|
}, []);
|
|
@@ -19901,7 +20246,7 @@ var UEditor = ({
|
|
|
19901
20246
|
}) => {
|
|
19902
20247
|
const t = useTranslations7("UEditor");
|
|
19903
20248
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
19904
|
-
const extensions =
|
|
20249
|
+
const extensions = useMemo23(
|
|
19905
20250
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
19906
20251
|
[effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
19907
20252
|
);
|