@underverse-ui/underverse 0.2.113 → 0.2.115
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 +217 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +218 -175
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1384,6 +1384,9 @@ interface SliderProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>
|
|
|
1384
1384
|
disabled?: boolean;
|
|
1385
1385
|
orientation?: "horizontal" | "vertical";
|
|
1386
1386
|
noFocus?: boolean;
|
|
1387
|
+
showTooltip?: boolean;
|
|
1388
|
+
tooltipClassName?: string;
|
|
1389
|
+
useGradient?: boolean;
|
|
1387
1390
|
}
|
|
1388
1391
|
declare const Slider: React$1.ForwardRefExoticComponent<SliderProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1389
1392
|
|
|
@@ -1420,6 +1423,7 @@ interface Category {
|
|
|
1420
1423
|
id: number;
|
|
1421
1424
|
name: string;
|
|
1422
1425
|
parent_id?: number | null;
|
|
1426
|
+
icon?: React__default.ReactNode;
|
|
1423
1427
|
}
|
|
1424
1428
|
interface CategoryTreeSelectLabels {
|
|
1425
1429
|
/** Text shown when no categories available */
|
package/dist/index.d.ts
CHANGED
|
@@ -1384,6 +1384,9 @@ interface SliderProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>
|
|
|
1384
1384
|
disabled?: boolean;
|
|
1385
1385
|
orientation?: "horizontal" | "vertical";
|
|
1386
1386
|
noFocus?: boolean;
|
|
1387
|
+
showTooltip?: boolean;
|
|
1388
|
+
tooltipClassName?: string;
|
|
1389
|
+
useGradient?: boolean;
|
|
1387
1390
|
}
|
|
1388
1391
|
declare const Slider: React$1.ForwardRefExoticComponent<SliderProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1389
1392
|
|
|
@@ -1420,6 +1423,7 @@ interface Category {
|
|
|
1420
1423
|
id: number;
|
|
1421
1424
|
name: string;
|
|
1422
1425
|
parent_id?: number | null;
|
|
1426
|
+
icon?: React__default.ReactNode;
|
|
1423
1427
|
}
|
|
1424
1428
|
interface CategoryTreeSelectLabels {
|
|
1425
1429
|
/** Text shown when no categories available */
|
package/dist/index.js
CHANGED
|
@@ -11467,17 +11467,20 @@ var SIZE_STYLES = {
|
|
|
11467
11467
|
sm: {
|
|
11468
11468
|
track: "h-1",
|
|
11469
11469
|
thumb: "w-3 h-3",
|
|
11470
|
-
container: "py-1"
|
|
11470
|
+
container: "py-1",
|
|
11471
|
+
tooltip: "text-xs px-2 py-1"
|
|
11471
11472
|
},
|
|
11472
11473
|
md: {
|
|
11473
11474
|
track: "h-2",
|
|
11474
11475
|
thumb: "w-4 h-4",
|
|
11475
|
-
container: "py-2"
|
|
11476
|
+
container: "py-2",
|
|
11477
|
+
tooltip: "text-sm px-2.5 py-1.5"
|
|
11476
11478
|
},
|
|
11477
11479
|
lg: {
|
|
11478
11480
|
track: "h-3",
|
|
11479
11481
|
thumb: "w-5 h-5",
|
|
11480
|
-
container: "py-3"
|
|
11482
|
+
container: "py-3",
|
|
11483
|
+
tooltip: "text-sm px-3 py-2"
|
|
11481
11484
|
}
|
|
11482
11485
|
};
|
|
11483
11486
|
var clamp5 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
@@ -11510,6 +11513,9 @@ var Slider = React35.forwardRef(
|
|
|
11510
11513
|
disabled = false,
|
|
11511
11514
|
orientation = "horizontal",
|
|
11512
11515
|
noFocus = true,
|
|
11516
|
+
showTooltip = true,
|
|
11517
|
+
tooltipClassName,
|
|
11518
|
+
useGradient = true,
|
|
11513
11519
|
...props
|
|
11514
11520
|
}, ref) => {
|
|
11515
11521
|
const isRange = mode === "range";
|
|
@@ -11522,6 +11528,8 @@ var Slider = React35.forwardRef(
|
|
|
11522
11528
|
});
|
|
11523
11529
|
const [activeThumb, setActiveThumb] = React35.useState(null);
|
|
11524
11530
|
const dragRef = React35.useRef(null);
|
|
11531
|
+
const [isHovering, setIsHovering] = React35.useState(false);
|
|
11532
|
+
const [isDragging, setIsDragging] = React35.useState(false);
|
|
11525
11533
|
const isControlled = value !== void 0;
|
|
11526
11534
|
const currentValue = isControlled ? value : internalValue;
|
|
11527
11535
|
const isRangeControlled = rangeValue !== void 0;
|
|
@@ -11600,6 +11608,7 @@ var Slider = React35.forwardRef(
|
|
|
11600
11608
|
const distToMax = Math.abs(nextValue - curMax);
|
|
11601
11609
|
const thumb = distToMin <= distToMax ? "min" : "max";
|
|
11602
11610
|
setActiveThumb(thumb);
|
|
11611
|
+
setIsDragging(true);
|
|
11603
11612
|
dragRef.current = { pointerId: e.pointerId, thumb };
|
|
11604
11613
|
try {
|
|
11605
11614
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
@@ -11624,6 +11633,7 @@ var Slider = React35.forwardRef(
|
|
|
11624
11633
|
if (!drag) return;
|
|
11625
11634
|
if (e.pointerId !== drag.pointerId) return;
|
|
11626
11635
|
dragRef.current = null;
|
|
11636
|
+
setIsDragging(false);
|
|
11627
11637
|
onMouseUp?.();
|
|
11628
11638
|
onTouchEnd?.();
|
|
11629
11639
|
try {
|
|
@@ -11633,135 +11643,198 @@ var Slider = React35.forwardRef(
|
|
|
11633
11643
|
};
|
|
11634
11644
|
if (orientation === "vertical") {
|
|
11635
11645
|
}
|
|
11646
|
+
const Tooltip2 = ({ value: value2, position }) => {
|
|
11647
|
+
const shouldShow = showTooltip && !disabled && (isHovering || isDragging);
|
|
11648
|
+
const displayVal = formatValue ? formatValue(value2) : value2.toString();
|
|
11649
|
+
return /* @__PURE__ */ jsxs36(
|
|
11650
|
+
"div",
|
|
11651
|
+
{
|
|
11652
|
+
className: cn(
|
|
11653
|
+
"absolute pointer-events-none transition-all duration-200 ease-out",
|
|
11654
|
+
"bg-popover text-popover-foreground rounded-lg shadow-lg border border-border",
|
|
11655
|
+
"whitespace-nowrap font-medium -translate-x-1/2 z-50",
|
|
11656
|
+
sizeStyles8.tooltip,
|
|
11657
|
+
shouldShow ? "opacity-100 -translate-y-10 scale-100" : "opacity-0 -translate-y-8 scale-95",
|
|
11658
|
+
tooltipClassName
|
|
11659
|
+
),
|
|
11660
|
+
style: {
|
|
11661
|
+
left: `${position}%`,
|
|
11662
|
+
bottom: "100%"
|
|
11663
|
+
},
|
|
11664
|
+
children: [
|
|
11665
|
+
displayVal,
|
|
11666
|
+
/* @__PURE__ */ jsx41("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-4 border-transparent border-t-border" }),
|
|
11667
|
+
/* @__PURE__ */ jsx41("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-[3px] border-transparent border-t-popover -mt-px" })
|
|
11668
|
+
]
|
|
11669
|
+
}
|
|
11670
|
+
);
|
|
11671
|
+
};
|
|
11636
11672
|
return /* @__PURE__ */ jsxs36("div", { className: cn("w-full space-y-2", containerClassName), children: [
|
|
11637
11673
|
(label || showValue) && /* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between", children: [
|
|
11638
11674
|
label && /* @__PURE__ */ jsx41("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
|
|
11639
11675
|
showValue && /* @__PURE__ */ jsx41("span", { className: cn("text-xs font-mono text-muted-foreground min-w-8 text-right", valueClassName), children: displayValue })
|
|
11640
11676
|
] }),
|
|
11641
|
-
/* @__PURE__ */ jsxs36(
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
const baseInputClassName = cn(
|
|
11651
|
-
// Base styles
|
|
11652
|
-
"absolute w-full h-full appearance-none bg-transparent cursor-pointer",
|
|
11653
|
-
!noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
|
|
11654
|
-
noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
|
|
11655
|
-
// Webkit styles for thumb
|
|
11656
|
-
"[&::-webkit-slider-thumb]:appearance-none",
|
|
11657
|
-
"[&::-webkit-slider-thumb]:bg-primary",
|
|
11658
|
-
"[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
|
|
11659
|
-
"[&::-webkit-slider-thumb]:rounded-full",
|
|
11660
|
-
"[&::-webkit-slider-thumb]:shadow-md",
|
|
11661
|
-
"[&::-webkit-slider-thumb]:cursor-pointer",
|
|
11662
|
-
"[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-150",
|
|
11663
|
-
size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
|
|
11664
|
-
size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
|
|
11665
|
-
size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
|
|
11666
|
-
// Firefox styles for thumb
|
|
11667
|
-
"[&::-moz-range-thumb]:bg-primary",
|
|
11668
|
-
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
|
|
11669
|
-
"[&::-moz-range-thumb]:rounded-full",
|
|
11670
|
-
"[&::-moz-range-thumb]:shadow-md",
|
|
11671
|
-
"[&::-moz-range-thumb]:cursor-pointer",
|
|
11672
|
-
"[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-150",
|
|
11673
|
-
size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
|
|
11674
|
-
size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
|
|
11675
|
-
size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
|
|
11676
|
-
// Remove default track in Firefox
|
|
11677
|
-
"[&::-moz-range-track]:bg-transparent",
|
|
11678
|
-
"[&::-moz-range-track]:border-transparent",
|
|
11679
|
-
// Hover effects
|
|
11680
|
-
"hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-lg",
|
|
11681
|
-
"hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-lg",
|
|
11682
|
-
// Disabled styles
|
|
11683
|
-
disabled && [
|
|
11684
|
-
"cursor-not-allowed opacity-50",
|
|
11685
|
-
"[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50",
|
|
11686
|
-
"[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50"
|
|
11687
|
-
],
|
|
11688
|
-
className,
|
|
11689
|
-
thumbClassName
|
|
11690
|
-
);
|
|
11691
|
-
if (!isRange) {
|
|
11692
|
-
return /* @__PURE__ */ jsx41(
|
|
11693
|
-
"input",
|
|
11694
|
-
{
|
|
11695
|
-
ref,
|
|
11696
|
-
type: "range",
|
|
11697
|
-
min,
|
|
11698
|
-
max,
|
|
11699
|
-
step,
|
|
11700
|
-
value: currentValue,
|
|
11701
|
-
onChange: handleSingleChange,
|
|
11702
|
-
onMouseUp,
|
|
11703
|
-
onTouchEnd,
|
|
11704
|
-
disabled,
|
|
11705
|
-
className: baseInputClassName,
|
|
11706
|
-
...props
|
|
11707
|
-
}
|
|
11708
|
-
);
|
|
11709
|
-
}
|
|
11710
|
-
const minZ = activeThumb === "min" ? "z-20" : "z-10";
|
|
11711
|
-
const maxZ = activeThumb === "max" ? "z-20" : "z-10";
|
|
11712
|
-
return /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11713
|
-
/* @__PURE__ */ jsx41(
|
|
11677
|
+
/* @__PURE__ */ jsxs36(
|
|
11678
|
+
"div",
|
|
11679
|
+
{
|
|
11680
|
+
ref: trackRef,
|
|
11681
|
+
className: cn("relative flex items-center", sizeStyles8.container),
|
|
11682
|
+
onMouseEnter: () => setIsHovering(true),
|
|
11683
|
+
onMouseLeave: () => setIsHovering(false),
|
|
11684
|
+
children: [
|
|
11685
|
+
/* @__PURE__ */ jsx41("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden shadow-inner", sizeStyles8.track, trackClassName), children: isRange ? /* @__PURE__ */ jsx41(
|
|
11714
11686
|
"div",
|
|
11715
11687
|
{
|
|
11716
|
-
className: cn(
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11688
|
+
className: cn(
|
|
11689
|
+
"absolute top-0 h-full rounded-full transition-all duration-150",
|
|
11690
|
+
useGradient ? "bg-linear-to-r from-primary via-primary to-primary/80 shadow-[0_0_8px_rgba(var(--primary-rgb,147,51,234),0.3)]" : "bg-primary"
|
|
11691
|
+
),
|
|
11692
|
+
style: { left: `${rangeStartPct}%`, width: `${Math.max(0, rangeEndPct - rangeStartPct)}%` }
|
|
11721
11693
|
}
|
|
11722
|
-
)
|
|
11723
|
-
|
|
11724
|
-
"input",
|
|
11694
|
+
) : /* @__PURE__ */ jsx41(
|
|
11695
|
+
"div",
|
|
11725
11696
|
{
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
value: normalizedRange[0],
|
|
11732
|
-
onChange: handleRangeChange("min"),
|
|
11733
|
-
onMouseUp,
|
|
11734
|
-
onTouchEnd,
|
|
11735
|
-
disabled,
|
|
11736
|
-
"aria-label": "Minimum value",
|
|
11737
|
-
onPointerDown: () => setActiveThumb("min"),
|
|
11738
|
-
onFocus: () => setActiveThumb("min"),
|
|
11739
|
-
className: cn(baseInputClassName, minZ, "pointer-events-none"),
|
|
11740
|
-
...props
|
|
11697
|
+
className: cn(
|
|
11698
|
+
"absolute left-0 top-0 h-full rounded-full transition-all duration-150",
|
|
11699
|
+
useGradient ? "bg-linear-to-r from-primary via-primary to-primary/80 shadow-[0_0_8px_rgba(var(--primary-rgb,147,51,234),0.3)]" : "bg-primary"
|
|
11700
|
+
),
|
|
11701
|
+
style: { width: `${percentage}%` }
|
|
11741
11702
|
}
|
|
11742
|
-
),
|
|
11743
|
-
/* @__PURE__ */ jsx41(
|
|
11744
|
-
|
|
11745
|
-
{
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
"
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11703
|
+
) }),
|
|
11704
|
+
!isRange && /* @__PURE__ */ jsx41(Tooltip2, { value: currentValue, position: percentage }),
|
|
11705
|
+
isRange && /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11706
|
+
/* @__PURE__ */ jsx41(Tooltip2, { value: normalizedRange[0], position: rangeStartPct }),
|
|
11707
|
+
/* @__PURE__ */ jsx41(Tooltip2, { value: normalizedRange[1], position: rangeEndPct })
|
|
11708
|
+
] }),
|
|
11709
|
+
(() => {
|
|
11710
|
+
const baseInputClassName = cn(
|
|
11711
|
+
// Base styles
|
|
11712
|
+
"absolute w-full h-full appearance-none bg-transparent cursor-pointer",
|
|
11713
|
+
!noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
|
|
11714
|
+
noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
|
|
11715
|
+
// Webkit styles for thumb
|
|
11716
|
+
"[&::-webkit-slider-thumb]:appearance-none",
|
|
11717
|
+
"[&::-webkit-slider-thumb]:bg-linear-to-br [&::-webkit-slider-thumb]:from-primary [&::-webkit-slider-thumb]:to-primary/80",
|
|
11718
|
+
"[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
|
|
11719
|
+
"[&::-webkit-slider-thumb]:rounded-full",
|
|
11720
|
+
"[&::-webkit-slider-thumb]:shadow-[0_2px_8px_rgba(0,0,0,0.15),0_0_0_1px_rgba(0,0,0,0.05)]",
|
|
11721
|
+
"[&::-webkit-slider-thumb]:cursor-pointer",
|
|
11722
|
+
"[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-200 [&::-webkit-slider-thumb]:ease-out",
|
|
11723
|
+
size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
|
|
11724
|
+
size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
|
|
11725
|
+
size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
|
|
11726
|
+
// Firefox styles for thumb
|
|
11727
|
+
"[&::-moz-range-thumb]:bg-linear-to-br [&::-moz-range-thumb]:from-primary [&::-moz-range-thumb]:to-primary/80",
|
|
11728
|
+
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
|
|
11729
|
+
"[&::-moz-range-thumb]:rounded-full",
|
|
11730
|
+
"[&::-moz-range-thumb]:shadow-[0_2px_8px_rgba(0,0,0,0.15),0_0_0_1px_rgba(0,0,0,0.05)]",
|
|
11731
|
+
"[&::-moz-range-thumb]:cursor-pointer",
|
|
11732
|
+
"[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-200 [&::-moz-range-thumb]:ease-out",
|
|
11733
|
+
size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
|
|
11734
|
+
size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
|
|
11735
|
+
size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
|
|
11736
|
+
// Remove default track in Firefox
|
|
11737
|
+
"[&::-moz-range-track]:bg-transparent",
|
|
11738
|
+
"[&::-moz-range-track]:border-transparent",
|
|
11739
|
+
// Hover effects - Enhanced premium look
|
|
11740
|
+
"hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-[0_4px_16px_rgba(0,0,0,0.2),0_0_12px_rgba(var(--primary-rgb,147,51,234),0.4)]",
|
|
11741
|
+
"hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-[0_4px_16px_rgba(0,0,0,0.2),0_0_12px_rgba(var(--primary-rgb,147,51,234),0.4)]",
|
|
11742
|
+
// Active/dragging effects
|
|
11743
|
+
"active:[&::-webkit-slider-thumb]:scale-105 active:[&::-webkit-slider-thumb]:shadow-[0_2px_12px_rgba(0,0,0,0.25),0_0_16px_rgba(var(--primary-rgb,147,51,234),0.5)]",
|
|
11744
|
+
"active:[&::-moz-range-thumb]:scale-105 active:[&::-moz-range-thumb]:shadow-[0_2px_12px_rgba(0,0,0,0.25),0_0_16px_rgba(var(--primary-rgb,147,51,234),0.5)]",
|
|
11745
|
+
// Disabled styles
|
|
11746
|
+
disabled && [
|
|
11747
|
+
"cursor-not-allowed opacity-50",
|
|
11748
|
+
"[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50 [&::-webkit-slider-thumb]:shadow-none",
|
|
11749
|
+
"[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50 [&::-moz-range-thumb]:shadow-none"
|
|
11750
|
+
],
|
|
11751
|
+
className,
|
|
11752
|
+
thumbClassName
|
|
11753
|
+
);
|
|
11754
|
+
if (!isRange) {
|
|
11755
|
+
return /* @__PURE__ */ jsx41(
|
|
11756
|
+
"input",
|
|
11757
|
+
{
|
|
11758
|
+
ref,
|
|
11759
|
+
type: "range",
|
|
11760
|
+
min,
|
|
11761
|
+
max,
|
|
11762
|
+
step,
|
|
11763
|
+
value: currentValue,
|
|
11764
|
+
onChange: handleSingleChange,
|
|
11765
|
+
onMouseDown: () => setIsDragging(true),
|
|
11766
|
+
onMouseUp: () => {
|
|
11767
|
+
setIsDragging(false);
|
|
11768
|
+
onMouseUp?.();
|
|
11769
|
+
},
|
|
11770
|
+
onTouchStart: () => setIsDragging(true),
|
|
11771
|
+
onTouchEnd: () => {
|
|
11772
|
+
setIsDragging(false);
|
|
11773
|
+
onTouchEnd?.();
|
|
11774
|
+
},
|
|
11775
|
+
disabled,
|
|
11776
|
+
className: baseInputClassName,
|
|
11777
|
+
...props
|
|
11778
|
+
}
|
|
11779
|
+
);
|
|
11760
11780
|
}
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11781
|
+
const minZ = activeThumb === "min" ? "z-20" : "z-10";
|
|
11782
|
+
const maxZ = activeThumb === "max" ? "z-20" : "z-10";
|
|
11783
|
+
return /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11784
|
+
/* @__PURE__ */ jsx41(
|
|
11785
|
+
"div",
|
|
11786
|
+
{
|
|
11787
|
+
className: cn("absolute inset-0 z-30", disabled ? "cursor-not-allowed" : "cursor-pointer"),
|
|
11788
|
+
onPointerDown: startRangeDrag,
|
|
11789
|
+
onPointerMove: moveRangeDrag,
|
|
11790
|
+
onPointerUp: endRangeDrag,
|
|
11791
|
+
onPointerCancel: endRangeDrag
|
|
11792
|
+
}
|
|
11793
|
+
),
|
|
11794
|
+
/* @__PURE__ */ jsx41(
|
|
11795
|
+
"input",
|
|
11796
|
+
{
|
|
11797
|
+
ref,
|
|
11798
|
+
type: "range",
|
|
11799
|
+
min,
|
|
11800
|
+
max,
|
|
11801
|
+
step,
|
|
11802
|
+
value: normalizedRange[0],
|
|
11803
|
+
onChange: handleRangeChange("min"),
|
|
11804
|
+
onMouseUp,
|
|
11805
|
+
onTouchEnd,
|
|
11806
|
+
disabled,
|
|
11807
|
+
"aria-label": "Minimum value",
|
|
11808
|
+
onPointerDown: () => setActiveThumb("min"),
|
|
11809
|
+
onFocus: () => setActiveThumb("min"),
|
|
11810
|
+
className: cn(baseInputClassName, minZ, "pointer-events-none"),
|
|
11811
|
+
...props
|
|
11812
|
+
}
|
|
11813
|
+
),
|
|
11814
|
+
/* @__PURE__ */ jsx41(
|
|
11815
|
+
"input",
|
|
11816
|
+
{
|
|
11817
|
+
type: "range",
|
|
11818
|
+
min,
|
|
11819
|
+
max,
|
|
11820
|
+
step,
|
|
11821
|
+
value: normalizedRange[1],
|
|
11822
|
+
onChange: handleRangeChange("max"),
|
|
11823
|
+
onMouseUp,
|
|
11824
|
+
onTouchEnd,
|
|
11825
|
+
disabled,
|
|
11826
|
+
"aria-label": "Maximum value",
|
|
11827
|
+
onPointerDown: () => setActiveThumb("max"),
|
|
11828
|
+
onFocus: () => setActiveThumb("max"),
|
|
11829
|
+
className: cn(baseInputClassName, maxZ, "pointer-events-none"),
|
|
11830
|
+
...props
|
|
11831
|
+
}
|
|
11832
|
+
)
|
|
11833
|
+
] });
|
|
11834
|
+
})()
|
|
11835
|
+
]
|
|
11836
|
+
}
|
|
11837
|
+
)
|
|
11765
11838
|
] });
|
|
11766
11839
|
}
|
|
11767
11840
|
);
|
|
@@ -12202,7 +12275,7 @@ function OverlayControls({
|
|
|
12202
12275
|
|
|
12203
12276
|
// ../../components/ui/CategoryTreeSelect.tsx
|
|
12204
12277
|
import { useState as useState30, useEffect as useEffect20 } from "react";
|
|
12205
|
-
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown4,
|
|
12278
|
+
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown4, FolderTree, Layers } from "lucide-react";
|
|
12206
12279
|
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
12207
12280
|
var defaultLabels = {
|
|
12208
12281
|
emptyText: "No categories",
|
|
@@ -12291,8 +12364,9 @@ function CategoryTreeSelect(props) {
|
|
|
12291
12364
|
/* @__PURE__ */ jsxs38(
|
|
12292
12365
|
"div",
|
|
12293
12366
|
{
|
|
12367
|
+
onClick: () => !viewOnly && handleSelect(category.id, category),
|
|
12294
12368
|
className: cn(
|
|
12295
|
-
"relative flex items-center gap-2.5 px-3 py-2.5 transition-all duration-200 rounded-lg",
|
|
12369
|
+
"relative flex items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-lg",
|
|
12296
12370
|
// Không phân biệt parent/child - đồng bộ màu
|
|
12297
12371
|
!viewOnly && "cursor-pointer",
|
|
12298
12372
|
!viewOnly && !isSelected && "hover:bg-accent/50",
|
|
@@ -12311,9 +12385,9 @@ function CategoryTreeSelect(props) {
|
|
|
12311
12385
|
},
|
|
12312
12386
|
className: cn(
|
|
12313
12387
|
"p-1.5 rounded-lg transition-all duration-200",
|
|
12314
|
-
"hover:
|
|
12388
|
+
"hover:scale-110 active:scale-95",
|
|
12315
12389
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
|
|
12316
|
-
isExpanded && "
|
|
12390
|
+
isExpanded && "text-primary"
|
|
12317
12391
|
),
|
|
12318
12392
|
children: /* @__PURE__ */ jsx43("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-90"), children: /* @__PURE__ */ jsx43(ChevronRight6, { className: "w-4 h-4" }) })
|
|
12319
12393
|
}
|
|
@@ -12321,57 +12395,14 @@ function CategoryTreeSelect(props) {
|
|
|
12321
12395
|
viewOnly ? (
|
|
12322
12396
|
// View-only mode: just display the name with folder icon
|
|
12323
12397
|
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2.5", children: [
|
|
12324
|
-
hasChildren ? /* @__PURE__ */ jsx43(FolderTree, { className: "w-4 h-4 text-muted-foreground/60" }) : /* @__PURE__ */ jsx43("div", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/40" }),
|
|
12398
|
+
category.icon ? /* @__PURE__ */ jsx43("div", { className: "w-4 h-4 flex items-center justify-center text-muted-foreground/60", children: category.icon }) : hasChildren ? /* @__PURE__ */ jsx43(FolderTree, { className: "w-4 h-4 text-muted-foreground/60" }) : /* @__PURE__ */ jsx43("div", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/40" }),
|
|
12325
12399
|
/* @__PURE__ */ jsx43("span", { className: "text-sm font-medium", children: category.name })
|
|
12326
12400
|
] })
|
|
12327
|
-
) : singleSelect ? (
|
|
12328
|
-
// Single select mode: radio-style indicator
|
|
12329
|
-
/* @__PURE__ */ jsxs38("div", { onClick: () => handleSelect(category.id, category), className: "flex items-center gap-2.5 flex-1", children: [
|
|
12330
|
-
/* @__PURE__ */ jsx43(
|
|
12331
|
-
"div",
|
|
12332
|
-
{
|
|
12333
|
-
className: cn(
|
|
12334
|
-
"w-5 h-5 border-2 rounded-full flex items-center justify-center transition-all duration-200",
|
|
12335
|
-
isSelected ? "border-primary bg-primary/10 shadow-sm shadow-primary/20" : "border-muted-foreground/30 hover:border-primary/50"
|
|
12336
|
-
),
|
|
12337
|
-
children: isSelected && /* @__PURE__ */ jsx43("div", { className: "w-2.5 h-2.5 rounded-full bg-linear-to-br from-primary to-primary/80 shadow-sm" })
|
|
12338
|
-
}
|
|
12339
|
-
),
|
|
12340
|
-
/* @__PURE__ */ jsx43(
|
|
12341
|
-
"span",
|
|
12342
|
-
{
|
|
12343
|
-
className: cn(
|
|
12344
|
-
"text-sm transition-all duration-200",
|
|
12345
|
-
isSelected ? "font-semibold text-primary" : "text-foreground/80 hover:text-foreground"
|
|
12346
|
-
),
|
|
12347
|
-
children: category.name
|
|
12348
|
-
}
|
|
12349
|
-
),
|
|
12350
|
-
hasChildren && !isSelected && /* @__PURE__ */ jsx43("span", { className: "ml-auto text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
|
|
12351
|
-
] })
|
|
12352
12401
|
) : (
|
|
12353
|
-
// Multi select mode:
|
|
12354
|
-
/* @__PURE__ */ jsxs38("div", {
|
|
12355
|
-
/* @__PURE__ */ jsx43(
|
|
12356
|
-
|
|
12357
|
-
{
|
|
12358
|
-
className: cn(
|
|
12359
|
-
"w-5 h-5 border-2 rounded-lg flex items-center justify-center transition-all duration-200",
|
|
12360
|
-
isSelected ? "bg-linear-to-br from-primary to-primary/80 border-primary shadow-sm shadow-primary/25" : "border-muted-foreground/30 hover:border-primary/50 hover:bg-primary/5"
|
|
12361
|
-
),
|
|
12362
|
-
children: isSelected && /* @__PURE__ */ jsx43(Check6, { className: "w-3 h-3 text-primary-foreground", strokeWidth: 3 })
|
|
12363
|
-
}
|
|
12364
|
-
),
|
|
12365
|
-
/* @__PURE__ */ jsx43(
|
|
12366
|
-
"span",
|
|
12367
|
-
{
|
|
12368
|
-
className: cn(
|
|
12369
|
-
"text-sm transition-all duration-200",
|
|
12370
|
-
isSelected ? "font-semibold text-primary" : "text-foreground/80 hover:text-foreground"
|
|
12371
|
-
),
|
|
12372
|
-
children: category.name
|
|
12373
|
-
}
|
|
12374
|
-
),
|
|
12402
|
+
// Single/Multi select mode: icon + text + badge
|
|
12403
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2.5 flex-1", children: [
|
|
12404
|
+
category.icon && /* @__PURE__ */ jsx43("div", { className: "w-4 h-4 flex items-center justify-center text-current", children: category.icon }),
|
|
12405
|
+
/* @__PURE__ */ jsx43("span", { className: cn("text-sm transition-all duration-200", isSelected ? "font-semibold text-primary" : "text-foreground/80"), children: category.name }),
|
|
12375
12406
|
hasChildren && !isSelected && /* @__PURE__ */ jsx43("span", { className: "ml-auto text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
|
|
12376
12407
|
] })
|
|
12377
12408
|
)
|
|
@@ -12402,7 +12433,19 @@ function CategoryTreeSelect(props) {
|
|
|
12402
12433
|
);
|
|
12403
12434
|
}
|
|
12404
12435
|
const selectedCount = valueArray.length;
|
|
12405
|
-
|
|
12436
|
+
let displayText;
|
|
12437
|
+
if (singleSelect) {
|
|
12438
|
+
displayText = selectedCount > 0 ? categories.find((c) => c.id === valueArray[0])?.name || placeholder : placeholder;
|
|
12439
|
+
} else {
|
|
12440
|
+
if (selectedCount === 0) {
|
|
12441
|
+
displayText = placeholder;
|
|
12442
|
+
} else if (selectedCount <= 3) {
|
|
12443
|
+
const selectedNames = valueArray.map((id) => categories.find((c) => c.id === id)?.name).filter(Boolean).join(", ");
|
|
12444
|
+
displayText = selectedNames || placeholder;
|
|
12445
|
+
} else {
|
|
12446
|
+
displayText = mergedLabels.selectedText(selectedCount);
|
|
12447
|
+
}
|
|
12448
|
+
}
|
|
12406
12449
|
return /* @__PURE__ */ jsxs38("div", { className: cn("relative", className), children: [
|
|
12407
12450
|
/* @__PURE__ */ jsxs38(
|
|
12408
12451
|
"button",
|
|
@@ -12447,7 +12490,7 @@ function CategoryTreeSelect(props) {
|
|
|
12447
12490
|
{
|
|
12448
12491
|
className: cn(
|
|
12449
12492
|
"absolute z-20 mt-2 w-full max-h-80 overflow-auto",
|
|
12450
|
-
"rounded-2xl md:rounded-3xl
|
|
12493
|
+
"rounded-2xl md:rounded-3xl border border-border/40 bg-popover/95 text-popover-foreground",
|
|
12451
12494
|
"shadow-2xl backdrop-blur-xl",
|
|
12452
12495
|
"p-2",
|
|
12453
12496
|
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|