@mlw-packages/react-components 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +31 -3
- package/dist/index.js +96 -205
- package/dist/index.mjs +96 -205
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1043,6 +1043,9 @@ body {
|
|
|
1043
1043
|
.max-h-\[--radix-popover-content-available-height\] {
|
|
1044
1044
|
max-height: var(--radix-popover-content-available-height);
|
|
1045
1045
|
}
|
|
1046
|
+
.max-h-\[100dvh\] {
|
|
1047
|
+
max-height: 100dvh;
|
|
1048
|
+
}
|
|
1046
1049
|
.max-h-\[300px\] {
|
|
1047
1050
|
max-height: 300px;
|
|
1048
1051
|
}
|
|
@@ -1613,6 +1616,15 @@ body {
|
|
|
1613
1616
|
.resize {
|
|
1614
1617
|
resize: both;
|
|
1615
1618
|
}
|
|
1619
|
+
.snap-y {
|
|
1620
|
+
scroll-snap-type: y var(--tw-scroll-snap-strictness);
|
|
1621
|
+
}
|
|
1622
|
+
.snap-mandatory {
|
|
1623
|
+
--tw-scroll-snap-strictness: mandatory;
|
|
1624
|
+
}
|
|
1625
|
+
.snap-center {
|
|
1626
|
+
scroll-snap-align: center;
|
|
1627
|
+
}
|
|
1616
1628
|
.list-inside {
|
|
1617
1629
|
list-style-position: inside;
|
|
1618
1630
|
}
|
|
@@ -1843,6 +1855,9 @@ body {
|
|
|
1843
1855
|
.overflow-y-scroll {
|
|
1844
1856
|
overflow-y: scroll;
|
|
1845
1857
|
}
|
|
1858
|
+
.overscroll-contain {
|
|
1859
|
+
overscroll-behavior: contain;
|
|
1860
|
+
}
|
|
1846
1861
|
.scroll-smooth {
|
|
1847
1862
|
scroll-behavior: smooth;
|
|
1848
1863
|
}
|
|
@@ -2701,6 +2716,9 @@ body {
|
|
|
2701
2716
|
.bg-gradient-to-r {
|
|
2702
2717
|
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
|
2703
2718
|
}
|
|
2719
|
+
.bg-gradient-to-t {
|
|
2720
|
+
background-image: linear-gradient(to top, var(--tw-gradient-stops));
|
|
2721
|
+
}
|
|
2704
2722
|
.from-background {
|
|
2705
2723
|
--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);
|
|
2706
2724
|
--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);
|
|
@@ -2736,6 +2754,13 @@ body {
|
|
|
2736
2754
|
--tw-gradient-to: hsl(var(--ring) / 0) var(--tw-gradient-to-position);
|
|
2737
2755
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
2738
2756
|
}
|
|
2757
|
+
.via-background\/80 {
|
|
2758
|
+
--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);
|
|
2759
|
+
--tw-gradient-stops:
|
|
2760
|
+
var(--tw-gradient-from),
|
|
2761
|
+
hsl(var(--background) / 0.8) var(--tw-gradient-via-position),
|
|
2762
|
+
var(--tw-gradient-to);
|
|
2763
|
+
}
|
|
2739
2764
|
.via-ring\/10 {
|
|
2740
2765
|
--tw-gradient-to: hsl(var(--ring) / 0) var(--tw-gradient-to-position);
|
|
2741
2766
|
--tw-gradient-stops:
|
|
@@ -2761,6 +2786,9 @@ body {
|
|
|
2761
2786
|
.to-ring\/20 {
|
|
2762
2787
|
--tw-gradient-to: hsl(var(--ring) / 0.2) var(--tw-gradient-to-position);
|
|
2763
2788
|
}
|
|
2789
|
+
.to-transparent {
|
|
2790
|
+
--tw-gradient-to: transparent var(--tw-gradient-to-position);
|
|
2791
|
+
}
|
|
2764
2792
|
.bg-clip-text {
|
|
2765
2793
|
-webkit-background-clip: text;
|
|
2766
2794
|
background-clip: text;
|
|
@@ -3318,6 +3346,9 @@ body {
|
|
|
3318
3346
|
.text-muted-foreground\/50 {
|
|
3319
3347
|
color: hsl(var(--muted-foreground) / 0.5);
|
|
3320
3348
|
}
|
|
3349
|
+
.text-muted-foreground\/60 {
|
|
3350
|
+
color: hsl(var(--muted-foreground) / 0.6);
|
|
3351
|
+
}
|
|
3321
3352
|
.text-muted-foreground\/70 {
|
|
3322
3353
|
color: hsl(var(--muted-foreground) / 0.7);
|
|
3323
3354
|
}
|
|
@@ -6193,9 +6224,6 @@ body {
|
|
|
6193
6224
|
.sm\:w-12 {
|
|
6194
6225
|
width: 3rem;
|
|
6195
6226
|
}
|
|
6196
|
-
.sm\:w-16 {
|
|
6197
|
-
width: 4rem;
|
|
6198
|
-
}
|
|
6199
6227
|
.sm\:w-20 {
|
|
6200
6228
|
width: 5rem;
|
|
6201
6229
|
}
|
package/dist/index.js
CHANGED
|
@@ -688,7 +688,7 @@ var DialogContentBase = React33__namespace.forwardRef(
|
|
|
688
688
|
{
|
|
689
689
|
ref,
|
|
690
690
|
className: cn(
|
|
691
|
-
"fixed left-[50%] top-[50%] z-50 w-
|
|
691
|
+
"fixed left-[50%] top-[50%] z-50 w-lg grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-auto rounded-md border-border",
|
|
692
692
|
className
|
|
693
693
|
),
|
|
694
694
|
"data-testid": dataTestId,
|
|
@@ -696,8 +696,8 @@ var DialogContentBase = React33__namespace.forwardRef(
|
|
|
696
696
|
onWheel: userOnWheel,
|
|
697
697
|
children: [
|
|
698
698
|
children,
|
|
699
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-
|
|
700
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "h-
|
|
699
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "h-6 w-6 sm:h-4 sm:w-4 hover:text-red-500 font-extrabold" }),
|
|
701
701
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
702
702
|
] })
|
|
703
703
|
]
|
|
@@ -712,7 +712,7 @@ var DialogHeaderBase = React33__namespace.forwardRef(({ className, testid: dataT
|
|
|
712
712
|
{
|
|
713
713
|
ref,
|
|
714
714
|
className: cn(
|
|
715
|
-
"flex flex-col space-y-1
|
|
715
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
716
716
|
className
|
|
717
717
|
),
|
|
718
718
|
"data-testid": dataTestId,
|
|
@@ -725,7 +725,7 @@ var DialogFooterBase = React33__namespace.forwardRef(({ className, testid: dataT
|
|
|
725
725
|
{
|
|
726
726
|
ref,
|
|
727
727
|
className: cn(
|
|
728
|
-
"flex flex-col-reverse
|
|
728
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
729
729
|
className
|
|
730
730
|
),
|
|
731
731
|
"data-testid": dataTestId,
|
|
@@ -7679,175 +7679,68 @@ function useScrollColumn({
|
|
|
7679
7679
|
}) {
|
|
7680
7680
|
const containerRef = React33.useRef(null);
|
|
7681
7681
|
const items = getItems(max, step);
|
|
7682
|
-
const [isDragging, setIsDragging] = React33.useState(false);
|
|
7683
|
-
const [startY, setStartY] = React33.useState(0);
|
|
7684
|
-
const [scrollTop, setScrollTop] = React33.useState(0);
|
|
7685
7682
|
const scrollTimeoutRef = React33.useRef(null);
|
|
7686
|
-
const
|
|
7687
|
-
const
|
|
7688
|
-
const
|
|
7689
|
-
const
|
|
7690
|
-
const momentumAnimationRef = React33.useRef(null);
|
|
7683
|
+
const isScrollingRef = React33.useRef(false);
|
|
7684
|
+
const [isDragging, setIsDragging] = React33.useState(false);
|
|
7685
|
+
const startYRef = React33.useRef(0);
|
|
7686
|
+
const startScrollRef = React33.useRef(0);
|
|
7691
7687
|
const itemHeight = ITEM_HEIGHT;
|
|
7692
7688
|
const centerIndex = CENTER_INDEX;
|
|
7693
7689
|
const visibleItems = VISIBLE_ITEMS;
|
|
7694
7690
|
const containerHeight = visibleItems * itemHeight;
|
|
7695
7691
|
React33.useEffect(() => {
|
|
7696
|
-
if (containerRef.current && !
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
const scrollPosition = clampedIndex * itemHeight;
|
|
7702
|
-
containerRef.current.scrollTop = scrollPosition;
|
|
7703
|
-
}
|
|
7704
|
-
});
|
|
7692
|
+
if (containerRef.current && !isScrollingRef.current) {
|
|
7693
|
+
const index = Math.round(value / step);
|
|
7694
|
+
const clampedIndex = Math.max(0, Math.min(items.length - 1, index));
|
|
7695
|
+
const scrollPosition = clampedIndex * itemHeight;
|
|
7696
|
+
containerRef.current.scrollTop = scrollPosition;
|
|
7705
7697
|
}
|
|
7706
|
-
}, [value,
|
|
7698
|
+
}, [value, itemHeight, step, items.length]);
|
|
7707
7699
|
React33.useEffect(() => {
|
|
7708
|
-
const animationRef = momentumAnimationRef.current;
|
|
7709
7700
|
return () => {
|
|
7710
7701
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7711
|
-
if (animationRef) {
|
|
7712
|
-
cancelAnimationFrame(animationRef);
|
|
7713
|
-
}
|
|
7714
7702
|
};
|
|
7715
7703
|
}, []);
|
|
7716
|
-
const handleScroll = (
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
if (!containerRef.current || isDragging) return;
|
|
7704
|
+
const handleScroll = () => {
|
|
7705
|
+
if (!containerRef.current) return;
|
|
7706
|
+
isScrollingRef.current = true;
|
|
7720
7707
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7721
7708
|
scrollTimeoutRef.current = setTimeout(() => {
|
|
7722
7709
|
if (!containerRef.current) return;
|
|
7723
7710
|
const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
|
|
7724
7711
|
const newValue = items[newIndex];
|
|
7725
|
-
if (newValue !== void 0) {
|
|
7726
|
-
|
|
7727
|
-
if (newValue !== value) onChange(newValue);
|
|
7712
|
+
if (newValue !== void 0 && newValue !== value) {
|
|
7713
|
+
onChange(newValue);
|
|
7728
7714
|
}
|
|
7729
|
-
|
|
7715
|
+
isScrollingRef.current = false;
|
|
7716
|
+
}, 150);
|
|
7730
7717
|
};
|
|
7731
|
-
const
|
|
7718
|
+
const handleMouseDown = (e) => {
|
|
7732
7719
|
if (!containerRef.current) return;
|
|
7733
|
-
if (momentumAnimationRef.current) {
|
|
7734
|
-
cancelAnimationFrame(momentumAnimationRef.current);
|
|
7735
|
-
momentumAnimationRef.current = null;
|
|
7736
|
-
}
|
|
7737
7720
|
setIsDragging(true);
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
lastTouchY.current = pageY;
|
|
7742
|
-
lastTouchTime.current = Date.now();
|
|
7721
|
+
startYRef.current = e.clientY;
|
|
7722
|
+
startScrollRef.current = containerRef.current.scrollTop;
|
|
7723
|
+
e.preventDefault();
|
|
7743
7724
|
};
|
|
7744
|
-
const
|
|
7725
|
+
const handleMouseMove = (e) => {
|
|
7745
7726
|
if (!isDragging || !containerRef.current) return;
|
|
7746
|
-
const
|
|
7747
|
-
|
|
7748
|
-
if (timeDelta > 0) {
|
|
7749
|
-
const delta = pageY - lastTouchY.current;
|
|
7750
|
-
velocityRef.current = delta / timeDelta;
|
|
7751
|
-
}
|
|
7752
|
-
lastTouchY.current = pageY;
|
|
7753
|
-
lastTouchTime.current = now;
|
|
7754
|
-
const multiplier = isTouchRef.current ? 1 : 1;
|
|
7755
|
-
containerRef.current.scrollTop = scrollTop + (startY - pageY) * multiplier;
|
|
7727
|
+
const deltaY = startYRef.current - e.clientY;
|
|
7728
|
+
containerRef.current.scrollTop = startScrollRef.current + deltaY;
|
|
7756
7729
|
};
|
|
7757
|
-
const
|
|
7758
|
-
if (!containerRef.current) return;
|
|
7730
|
+
const handleMouseUp = () => {
|
|
7759
7731
|
setIsDragging(false);
|
|
7760
|
-
if (isTouchRef.current && Math.abs(velocityRef.current) > 0.1) {
|
|
7761
|
-
let velocity = velocityRef.current * -30;
|
|
7762
|
-
const friction = 0.92;
|
|
7763
|
-
const minVelocity = 0.5;
|
|
7764
|
-
const animate = () => {
|
|
7765
|
-
if (!containerRef.current) return;
|
|
7766
|
-
velocity *= friction;
|
|
7767
|
-
if (Math.abs(velocity) < minVelocity) {
|
|
7768
|
-
const newIndex = Math.round(
|
|
7769
|
-
containerRef.current.scrollTop / itemHeight
|
|
7770
|
-
);
|
|
7771
|
-
const newValue = items[newIndex];
|
|
7772
|
-
if (newValue !== void 0) {
|
|
7773
|
-
const targetScroll = newIndex * itemHeight;
|
|
7774
|
-
const currentScroll = containerRef.current.scrollTop;
|
|
7775
|
-
const diff = targetScroll - currentScroll;
|
|
7776
|
-
if (Math.abs(diff) > 0.5) {
|
|
7777
|
-
containerRef.current.scrollTop += diff * 0.3;
|
|
7778
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7779
|
-
} else {
|
|
7780
|
-
containerRef.current.scrollTop = targetScroll;
|
|
7781
|
-
onChange(newValue);
|
|
7782
|
-
momentumAnimationRef.current = null;
|
|
7783
|
-
}
|
|
7784
|
-
}
|
|
7785
|
-
return;
|
|
7786
|
-
}
|
|
7787
|
-
containerRef.current.scrollTop += velocity;
|
|
7788
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7789
|
-
};
|
|
7790
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7791
|
-
} else {
|
|
7792
|
-
requestAnimationFrame(() => {
|
|
7793
|
-
if (!containerRef.current) return;
|
|
7794
|
-
const newIndex = Math.round(
|
|
7795
|
-
containerRef.current.scrollTop / itemHeight
|
|
7796
|
-
);
|
|
7797
|
-
const newValue = items[newIndex];
|
|
7798
|
-
if (newValue !== void 0) {
|
|
7799
|
-
containerRef.current.scrollTop = newIndex * itemHeight;
|
|
7800
|
-
onChange(newValue);
|
|
7801
|
-
}
|
|
7802
|
-
});
|
|
7803
|
-
}
|
|
7804
|
-
};
|
|
7805
|
-
const handlers = {
|
|
7806
|
-
onScroll: handleScroll,
|
|
7807
|
-
onWheel: (e) => e.stopPropagation(),
|
|
7808
|
-
onMouseDown: (e) => {
|
|
7809
|
-
isTouchRef.current = false;
|
|
7810
|
-
handleStart(e.pageY);
|
|
7811
|
-
},
|
|
7812
|
-
onMouseMove: (e) => {
|
|
7813
|
-
if (isDragging) {
|
|
7814
|
-
e.preventDefault();
|
|
7815
|
-
handleMove(e.pageY);
|
|
7816
|
-
}
|
|
7817
|
-
},
|
|
7818
|
-
onMouseUp: () => handleEnd(),
|
|
7819
|
-
onMouseLeave: () => {
|
|
7820
|
-
if (isDragging) handleEnd();
|
|
7821
|
-
},
|
|
7822
|
-
onTouchStart: (e) => {
|
|
7823
|
-
isTouchRef.current = true;
|
|
7824
|
-
handleStart(e.touches[0].pageY);
|
|
7825
|
-
},
|
|
7826
|
-
onTouchMove: (e) => {
|
|
7827
|
-
if (isDragging) {
|
|
7828
|
-
if (e.cancelable) e.preventDefault();
|
|
7829
|
-
handleMove(e.touches[0].pageY);
|
|
7830
|
-
}
|
|
7831
|
-
},
|
|
7832
|
-
onTouchEnd: () => {
|
|
7833
|
-
isTouchRef.current = false;
|
|
7834
|
-
handleEnd();
|
|
7835
|
-
}
|
|
7836
|
-
};
|
|
7837
|
-
const scrollToIndex = (index) => {
|
|
7838
|
-
if (!containerRef.current) return;
|
|
7839
|
-
const clamped = Math.max(0, Math.min(items.length - 1, index));
|
|
7840
|
-
containerRef.current.scrollTop = clamped * itemHeight;
|
|
7841
7732
|
};
|
|
7842
7733
|
return {
|
|
7843
7734
|
items,
|
|
7844
7735
|
containerRef,
|
|
7845
|
-
isDragging,
|
|
7846
7736
|
itemHeight,
|
|
7847
7737
|
containerHeight,
|
|
7848
7738
|
centerIndex,
|
|
7849
|
-
|
|
7850
|
-
|
|
7739
|
+
handleScroll,
|
|
7740
|
+
handleMouseDown,
|
|
7741
|
+
handleMouseMove,
|
|
7742
|
+
handleMouseUp,
|
|
7743
|
+
isDragging
|
|
7851
7744
|
};
|
|
7852
7745
|
}
|
|
7853
7746
|
function ScrollColumn({
|
|
@@ -7860,57 +7753,68 @@ function ScrollColumn({
|
|
|
7860
7753
|
const {
|
|
7861
7754
|
items,
|
|
7862
7755
|
containerRef,
|
|
7863
|
-
isDragging,
|
|
7864
7756
|
itemHeight,
|
|
7865
7757
|
containerHeight,
|
|
7866
7758
|
centerIndex,
|
|
7867
|
-
|
|
7759
|
+
handleScroll,
|
|
7760
|
+
handleMouseDown,
|
|
7761
|
+
handleMouseMove,
|
|
7762
|
+
handleMouseUp,
|
|
7763
|
+
isDragging
|
|
7868
7764
|
} = useScrollColumn({ value, onChange, max, step });
|
|
7869
7765
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
7870
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm
|
|
7871
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7872
|
-
"div",
|
|
7873
|
-
{
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
"
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7766
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm text-center pb-2 uppercase tracking-wider", children: label }),
|
|
7767
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-24 sm:w-20"), children: [
|
|
7768
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 h-16 bg-gradient-to-b from-background via-background/80 to-transparent pointer-events-none z-20" }),
|
|
7769
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background via-background/80 to-transparent pointer-events-none z-20" }),
|
|
7770
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7771
|
+
"div",
|
|
7772
|
+
{
|
|
7773
|
+
className: "absolute left-0 right-0 pointer-events-none bg-muted/50 backdrop-blur-sm rounded-md border border-border",
|
|
7774
|
+
style: {
|
|
7775
|
+
top: `${centerIndex * itemHeight}px`,
|
|
7776
|
+
height: `${itemHeight}px`
|
|
7777
|
+
}
|
|
7778
|
+
}
|
|
7779
|
+
),
|
|
7780
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7781
|
+
"div",
|
|
7782
|
+
{
|
|
7783
|
+
ref: containerRef,
|
|
7784
|
+
onScroll: handleScroll,
|
|
7785
|
+
onMouseDown: handleMouseDown,
|
|
7786
|
+
onMouseMove: handleMouseMove,
|
|
7787
|
+
onMouseUp: handleMouseUp,
|
|
7788
|
+
onMouseLeave: handleMouseUp,
|
|
7789
|
+
className: cn(
|
|
7790
|
+
"overflow-y-scroll snap-y snap-mandatory [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] overscroll-contain",
|
|
7791
|
+
isDragging && "cursor-grabbing"
|
|
7792
|
+
),
|
|
7793
|
+
style: {
|
|
7794
|
+
height: `${containerHeight}px`,
|
|
7795
|
+
paddingTop: `${centerIndex * itemHeight}px`,
|
|
7796
|
+
paddingBottom: `${centerIndex * itemHeight}px`,
|
|
7797
|
+
cursor: isDragging ? "grabbing" : "grab"
|
|
7798
|
+
},
|
|
7799
|
+
children: items.map((item, idx) => {
|
|
7800
|
+
const itemIndex = items.indexOf(value);
|
|
7801
|
+
const isCentered = idx === itemIndex;
|
|
7802
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7803
|
+
"div",
|
|
7804
|
+
{
|
|
7805
|
+
className: cn(
|
|
7806
|
+
"snap-center flex items-center justify-center select-none font-bold tabular-nums transition-all duration-200",
|
|
7807
|
+
isCentered ? "text-2xl sm:text-xl text-foreground scale-110" : "text-base sm:text-sm text-muted-foreground/60"
|
|
7808
|
+
),
|
|
7809
|
+
style: { height: `${itemHeight}px` },
|
|
7810
|
+
children: item.toString().padStart(2, "0")
|
|
7906
7811
|
},
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
) })
|
|
7812
|
+
item
|
|
7813
|
+
);
|
|
7814
|
+
})
|
|
7815
|
+
}
|
|
7816
|
+
)
|
|
7817
|
+
] })
|
|
7914
7818
|
] });
|
|
7915
7819
|
}
|
|
7916
7820
|
function TimeScrollPicker({
|
|
@@ -7919,8 +7823,6 @@ function TimeScrollPicker({
|
|
|
7919
7823
|
hideSeconds = false
|
|
7920
7824
|
}) {
|
|
7921
7825
|
const currentDate = date || /* @__PURE__ */ new Date();
|
|
7922
|
-
const itemHeight = ITEM_HEIGHT;
|
|
7923
|
-
const centerIndex = CENTER_INDEX;
|
|
7924
7826
|
const handleTimeChange = (type, value) => {
|
|
7925
7827
|
const newDate = new Date(currentDate);
|
|
7926
7828
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -7928,17 +7830,7 @@ function TimeScrollPicker({
|
|
|
7928
7830
|
else newDate.setSeconds(value);
|
|
7929
7831
|
setDate(newDate);
|
|
7930
7832
|
};
|
|
7931
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
7932
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7933
|
-
"div",
|
|
7934
|
-
{
|
|
7935
|
-
className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
|
|
7936
|
-
style: {
|
|
7937
|
-
top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
|
|
7938
|
-
height: `${itemHeight}px`
|
|
7939
|
-
}
|
|
7940
|
-
}
|
|
7941
|
-
),
|
|
7833
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex gap-2 sm:gap-3", children: [
|
|
7942
7834
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7943
7835
|
ScrollColumn,
|
|
7944
7836
|
{
|
|
@@ -7946,7 +7838,7 @@ function TimeScrollPicker({
|
|
|
7946
7838
|
onChange: (v) => handleTimeChange("hours", v),
|
|
7947
7839
|
max: 24,
|
|
7948
7840
|
label: "Hora",
|
|
7949
|
-
|
|
7841
|
+
step: 1
|
|
7950
7842
|
}
|
|
7951
7843
|
),
|
|
7952
7844
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7956,8 +7848,7 @@ function TimeScrollPicker({
|
|
|
7956
7848
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7957
7849
|
max: 60,
|
|
7958
7850
|
step: 5,
|
|
7959
|
-
label: "Min"
|
|
7960
|
-
hideSeconds
|
|
7851
|
+
label: "Min"
|
|
7961
7852
|
}
|
|
7962
7853
|
),
|
|
7963
7854
|
!hideSeconds && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7967,7 +7858,7 @@ function TimeScrollPicker({
|
|
|
7967
7858
|
onChange: (v) => handleTimeChange("seconds", v),
|
|
7968
7859
|
max: 60,
|
|
7969
7860
|
label: "Seg",
|
|
7970
|
-
|
|
7861
|
+
step: 1
|
|
7971
7862
|
}
|
|
7972
7863
|
)
|
|
7973
7864
|
] }) });
|
|
@@ -8263,7 +8154,7 @@ function DateTimePicker({
|
|
|
8263
8154
|
}
|
|
8264
8155
|
),
|
|
8265
8156
|
/* @__PURE__ */ jsxRuntime.jsx(ErrorMessage_default, { error }),
|
|
8266
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1
|
|
8157
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
|
|
8267
8158
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
8268
8159
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8269
8160
|
PopoverTriggerBase,
|
package/dist/index.mjs
CHANGED
|
@@ -645,7 +645,7 @@ var DialogContentBase = React33.forwardRef(
|
|
|
645
645
|
{
|
|
646
646
|
ref,
|
|
647
647
|
className: cn(
|
|
648
|
-
"fixed left-[50%] top-[50%] z-50 w-
|
|
648
|
+
"fixed left-[50%] top-[50%] z-50 w-lg grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-auto rounded-md border-border",
|
|
649
649
|
className
|
|
650
650
|
),
|
|
651
651
|
"data-testid": dataTestId,
|
|
@@ -653,8 +653,8 @@ var DialogContentBase = React33.forwardRef(
|
|
|
653
653
|
onWheel: userOnWheel,
|
|
654
654
|
children: [
|
|
655
655
|
children,
|
|
656
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-
|
|
657
|
-
/* @__PURE__ */ jsx(XIcon, { className: "h-
|
|
656
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
|
|
657
|
+
/* @__PURE__ */ jsx(XIcon, { className: "h-6 w-6 sm:h-4 sm:w-4 hover:text-red-500 font-extrabold" }),
|
|
658
658
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
659
659
|
] })
|
|
660
660
|
]
|
|
@@ -669,7 +669,7 @@ var DialogHeaderBase = React33.forwardRef(({ className, testid: dataTestId = "di
|
|
|
669
669
|
{
|
|
670
670
|
ref,
|
|
671
671
|
className: cn(
|
|
672
|
-
"flex flex-col space-y-1
|
|
672
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
673
673
|
className
|
|
674
674
|
),
|
|
675
675
|
"data-testid": dataTestId,
|
|
@@ -682,7 +682,7 @@ var DialogFooterBase = React33.forwardRef(({ className, testid: dataTestId = "di
|
|
|
682
682
|
{
|
|
683
683
|
ref,
|
|
684
684
|
className: cn(
|
|
685
|
-
"flex flex-col-reverse
|
|
685
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
686
686
|
className
|
|
687
687
|
),
|
|
688
688
|
"data-testid": dataTestId,
|
|
@@ -7636,175 +7636,68 @@ function useScrollColumn({
|
|
|
7636
7636
|
}) {
|
|
7637
7637
|
const containerRef = useRef(null);
|
|
7638
7638
|
const items = getItems(max, step);
|
|
7639
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
7640
|
-
const [startY, setStartY] = useState(0);
|
|
7641
|
-
const [scrollTop, setScrollTop] = useState(0);
|
|
7642
7639
|
const scrollTimeoutRef = useRef(null);
|
|
7643
|
-
const
|
|
7644
|
-
const
|
|
7645
|
-
const
|
|
7646
|
-
const
|
|
7647
|
-
const momentumAnimationRef = useRef(null);
|
|
7640
|
+
const isScrollingRef = useRef(false);
|
|
7641
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
7642
|
+
const startYRef = useRef(0);
|
|
7643
|
+
const startScrollRef = useRef(0);
|
|
7648
7644
|
const itemHeight = ITEM_HEIGHT;
|
|
7649
7645
|
const centerIndex = CENTER_INDEX;
|
|
7650
7646
|
const visibleItems = VISIBLE_ITEMS;
|
|
7651
7647
|
const containerHeight = visibleItems * itemHeight;
|
|
7652
7648
|
useEffect(() => {
|
|
7653
|
-
if (containerRef.current && !
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
const scrollPosition = clampedIndex * itemHeight;
|
|
7659
|
-
containerRef.current.scrollTop = scrollPosition;
|
|
7660
|
-
}
|
|
7661
|
-
});
|
|
7649
|
+
if (containerRef.current && !isScrollingRef.current) {
|
|
7650
|
+
const index = Math.round(value / step);
|
|
7651
|
+
const clampedIndex = Math.max(0, Math.min(items.length - 1, index));
|
|
7652
|
+
const scrollPosition = clampedIndex * itemHeight;
|
|
7653
|
+
containerRef.current.scrollTop = scrollPosition;
|
|
7662
7654
|
}
|
|
7663
|
-
}, [value,
|
|
7655
|
+
}, [value, itemHeight, step, items.length]);
|
|
7664
7656
|
useEffect(() => {
|
|
7665
|
-
const animationRef = momentumAnimationRef.current;
|
|
7666
7657
|
return () => {
|
|
7667
7658
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7668
|
-
if (animationRef) {
|
|
7669
|
-
cancelAnimationFrame(animationRef);
|
|
7670
|
-
}
|
|
7671
7659
|
};
|
|
7672
7660
|
}, []);
|
|
7673
|
-
const handleScroll = (
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
if (!containerRef.current || isDragging) return;
|
|
7661
|
+
const handleScroll = () => {
|
|
7662
|
+
if (!containerRef.current) return;
|
|
7663
|
+
isScrollingRef.current = true;
|
|
7677
7664
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7678
7665
|
scrollTimeoutRef.current = setTimeout(() => {
|
|
7679
7666
|
if (!containerRef.current) return;
|
|
7680
7667
|
const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
|
|
7681
7668
|
const newValue = items[newIndex];
|
|
7682
|
-
if (newValue !== void 0) {
|
|
7683
|
-
|
|
7684
|
-
if (newValue !== value) onChange(newValue);
|
|
7669
|
+
if (newValue !== void 0 && newValue !== value) {
|
|
7670
|
+
onChange(newValue);
|
|
7685
7671
|
}
|
|
7686
|
-
|
|
7672
|
+
isScrollingRef.current = false;
|
|
7673
|
+
}, 150);
|
|
7687
7674
|
};
|
|
7688
|
-
const
|
|
7675
|
+
const handleMouseDown = (e) => {
|
|
7689
7676
|
if (!containerRef.current) return;
|
|
7690
|
-
if (momentumAnimationRef.current) {
|
|
7691
|
-
cancelAnimationFrame(momentumAnimationRef.current);
|
|
7692
|
-
momentumAnimationRef.current = null;
|
|
7693
|
-
}
|
|
7694
7677
|
setIsDragging(true);
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
lastTouchY.current = pageY;
|
|
7699
|
-
lastTouchTime.current = Date.now();
|
|
7678
|
+
startYRef.current = e.clientY;
|
|
7679
|
+
startScrollRef.current = containerRef.current.scrollTop;
|
|
7680
|
+
e.preventDefault();
|
|
7700
7681
|
};
|
|
7701
|
-
const
|
|
7682
|
+
const handleMouseMove = (e) => {
|
|
7702
7683
|
if (!isDragging || !containerRef.current) return;
|
|
7703
|
-
const
|
|
7704
|
-
|
|
7705
|
-
if (timeDelta > 0) {
|
|
7706
|
-
const delta = pageY - lastTouchY.current;
|
|
7707
|
-
velocityRef.current = delta / timeDelta;
|
|
7708
|
-
}
|
|
7709
|
-
lastTouchY.current = pageY;
|
|
7710
|
-
lastTouchTime.current = now;
|
|
7711
|
-
const multiplier = isTouchRef.current ? 1 : 1;
|
|
7712
|
-
containerRef.current.scrollTop = scrollTop + (startY - pageY) * multiplier;
|
|
7684
|
+
const deltaY = startYRef.current - e.clientY;
|
|
7685
|
+
containerRef.current.scrollTop = startScrollRef.current + deltaY;
|
|
7713
7686
|
};
|
|
7714
|
-
const
|
|
7715
|
-
if (!containerRef.current) return;
|
|
7687
|
+
const handleMouseUp = () => {
|
|
7716
7688
|
setIsDragging(false);
|
|
7717
|
-
if (isTouchRef.current && Math.abs(velocityRef.current) > 0.1) {
|
|
7718
|
-
let velocity = velocityRef.current * -30;
|
|
7719
|
-
const friction = 0.92;
|
|
7720
|
-
const minVelocity = 0.5;
|
|
7721
|
-
const animate = () => {
|
|
7722
|
-
if (!containerRef.current) return;
|
|
7723
|
-
velocity *= friction;
|
|
7724
|
-
if (Math.abs(velocity) < minVelocity) {
|
|
7725
|
-
const newIndex = Math.round(
|
|
7726
|
-
containerRef.current.scrollTop / itemHeight
|
|
7727
|
-
);
|
|
7728
|
-
const newValue = items[newIndex];
|
|
7729
|
-
if (newValue !== void 0) {
|
|
7730
|
-
const targetScroll = newIndex * itemHeight;
|
|
7731
|
-
const currentScroll = containerRef.current.scrollTop;
|
|
7732
|
-
const diff = targetScroll - currentScroll;
|
|
7733
|
-
if (Math.abs(diff) > 0.5) {
|
|
7734
|
-
containerRef.current.scrollTop += diff * 0.3;
|
|
7735
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7736
|
-
} else {
|
|
7737
|
-
containerRef.current.scrollTop = targetScroll;
|
|
7738
|
-
onChange(newValue);
|
|
7739
|
-
momentumAnimationRef.current = null;
|
|
7740
|
-
}
|
|
7741
|
-
}
|
|
7742
|
-
return;
|
|
7743
|
-
}
|
|
7744
|
-
containerRef.current.scrollTop += velocity;
|
|
7745
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7746
|
-
};
|
|
7747
|
-
momentumAnimationRef.current = requestAnimationFrame(animate);
|
|
7748
|
-
} else {
|
|
7749
|
-
requestAnimationFrame(() => {
|
|
7750
|
-
if (!containerRef.current) return;
|
|
7751
|
-
const newIndex = Math.round(
|
|
7752
|
-
containerRef.current.scrollTop / itemHeight
|
|
7753
|
-
);
|
|
7754
|
-
const newValue = items[newIndex];
|
|
7755
|
-
if (newValue !== void 0) {
|
|
7756
|
-
containerRef.current.scrollTop = newIndex * itemHeight;
|
|
7757
|
-
onChange(newValue);
|
|
7758
|
-
}
|
|
7759
|
-
});
|
|
7760
|
-
}
|
|
7761
|
-
};
|
|
7762
|
-
const handlers = {
|
|
7763
|
-
onScroll: handleScroll,
|
|
7764
|
-
onWheel: (e) => e.stopPropagation(),
|
|
7765
|
-
onMouseDown: (e) => {
|
|
7766
|
-
isTouchRef.current = false;
|
|
7767
|
-
handleStart(e.pageY);
|
|
7768
|
-
},
|
|
7769
|
-
onMouseMove: (e) => {
|
|
7770
|
-
if (isDragging) {
|
|
7771
|
-
e.preventDefault();
|
|
7772
|
-
handleMove(e.pageY);
|
|
7773
|
-
}
|
|
7774
|
-
},
|
|
7775
|
-
onMouseUp: () => handleEnd(),
|
|
7776
|
-
onMouseLeave: () => {
|
|
7777
|
-
if (isDragging) handleEnd();
|
|
7778
|
-
},
|
|
7779
|
-
onTouchStart: (e) => {
|
|
7780
|
-
isTouchRef.current = true;
|
|
7781
|
-
handleStart(e.touches[0].pageY);
|
|
7782
|
-
},
|
|
7783
|
-
onTouchMove: (e) => {
|
|
7784
|
-
if (isDragging) {
|
|
7785
|
-
if (e.cancelable) e.preventDefault();
|
|
7786
|
-
handleMove(e.touches[0].pageY);
|
|
7787
|
-
}
|
|
7788
|
-
},
|
|
7789
|
-
onTouchEnd: () => {
|
|
7790
|
-
isTouchRef.current = false;
|
|
7791
|
-
handleEnd();
|
|
7792
|
-
}
|
|
7793
|
-
};
|
|
7794
|
-
const scrollToIndex = (index) => {
|
|
7795
|
-
if (!containerRef.current) return;
|
|
7796
|
-
const clamped = Math.max(0, Math.min(items.length - 1, index));
|
|
7797
|
-
containerRef.current.scrollTop = clamped * itemHeight;
|
|
7798
7689
|
};
|
|
7799
7690
|
return {
|
|
7800
7691
|
items,
|
|
7801
7692
|
containerRef,
|
|
7802
|
-
isDragging,
|
|
7803
7693
|
itemHeight,
|
|
7804
7694
|
containerHeight,
|
|
7805
7695
|
centerIndex,
|
|
7806
|
-
|
|
7807
|
-
|
|
7696
|
+
handleScroll,
|
|
7697
|
+
handleMouseDown,
|
|
7698
|
+
handleMouseMove,
|
|
7699
|
+
handleMouseUp,
|
|
7700
|
+
isDragging
|
|
7808
7701
|
};
|
|
7809
7702
|
}
|
|
7810
7703
|
function ScrollColumn({
|
|
@@ -7817,57 +7710,68 @@ function ScrollColumn({
|
|
|
7817
7710
|
const {
|
|
7818
7711
|
items,
|
|
7819
7712
|
containerRef,
|
|
7820
|
-
isDragging,
|
|
7821
7713
|
itemHeight,
|
|
7822
7714
|
containerHeight,
|
|
7823
7715
|
centerIndex,
|
|
7824
|
-
|
|
7716
|
+
handleScroll,
|
|
7717
|
+
handleMouseDown,
|
|
7718
|
+
handleMouseMove,
|
|
7719
|
+
handleMouseUp,
|
|
7720
|
+
isDragging
|
|
7825
7721
|
} = useScrollColumn({ value, onChange, max, step });
|
|
7826
7722
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
7827
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm
|
|
7828
|
-
/* @__PURE__ */
|
|
7829
|
-
"div",
|
|
7830
|
-
{
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
"
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7723
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm text-center pb-2 uppercase tracking-wider", children: label }),
|
|
7724
|
+
/* @__PURE__ */ jsxs("div", { className: cn("relative w-24 sm:w-20"), children: [
|
|
7725
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-0 left-0 right-0 h-16 bg-gradient-to-b from-background via-background/80 to-transparent pointer-events-none z-20" }),
|
|
7726
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background via-background/80 to-transparent pointer-events-none z-20" }),
|
|
7727
|
+
/* @__PURE__ */ jsx(
|
|
7728
|
+
"div",
|
|
7729
|
+
{
|
|
7730
|
+
className: "absolute left-0 right-0 pointer-events-none bg-muted/50 backdrop-blur-sm rounded-md border border-border",
|
|
7731
|
+
style: {
|
|
7732
|
+
top: `${centerIndex * itemHeight}px`,
|
|
7733
|
+
height: `${itemHeight}px`
|
|
7734
|
+
}
|
|
7735
|
+
}
|
|
7736
|
+
),
|
|
7737
|
+
/* @__PURE__ */ jsx(
|
|
7738
|
+
"div",
|
|
7739
|
+
{
|
|
7740
|
+
ref: containerRef,
|
|
7741
|
+
onScroll: handleScroll,
|
|
7742
|
+
onMouseDown: handleMouseDown,
|
|
7743
|
+
onMouseMove: handleMouseMove,
|
|
7744
|
+
onMouseUp: handleMouseUp,
|
|
7745
|
+
onMouseLeave: handleMouseUp,
|
|
7746
|
+
className: cn(
|
|
7747
|
+
"overflow-y-scroll snap-y snap-mandatory [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] overscroll-contain",
|
|
7748
|
+
isDragging && "cursor-grabbing"
|
|
7749
|
+
),
|
|
7750
|
+
style: {
|
|
7751
|
+
height: `${containerHeight}px`,
|
|
7752
|
+
paddingTop: `${centerIndex * itemHeight}px`,
|
|
7753
|
+
paddingBottom: `${centerIndex * itemHeight}px`,
|
|
7754
|
+
cursor: isDragging ? "grabbing" : "grab"
|
|
7755
|
+
},
|
|
7756
|
+
children: items.map((item, idx) => {
|
|
7757
|
+
const itemIndex = items.indexOf(value);
|
|
7758
|
+
const isCentered = idx === itemIndex;
|
|
7759
|
+
return /* @__PURE__ */ jsx(
|
|
7760
|
+
"div",
|
|
7761
|
+
{
|
|
7762
|
+
className: cn(
|
|
7763
|
+
"snap-center flex items-center justify-center select-none font-bold tabular-nums transition-all duration-200",
|
|
7764
|
+
isCentered ? "text-2xl sm:text-xl text-foreground scale-110" : "text-base sm:text-sm text-muted-foreground/60"
|
|
7765
|
+
),
|
|
7766
|
+
style: { height: `${itemHeight}px` },
|
|
7767
|
+
children: item.toString().padStart(2, "0")
|
|
7863
7768
|
},
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
) })
|
|
7769
|
+
item
|
|
7770
|
+
);
|
|
7771
|
+
})
|
|
7772
|
+
}
|
|
7773
|
+
)
|
|
7774
|
+
] })
|
|
7871
7775
|
] });
|
|
7872
7776
|
}
|
|
7873
7777
|
function TimeScrollPicker({
|
|
@@ -7876,8 +7780,6 @@ function TimeScrollPicker({
|
|
|
7876
7780
|
hideSeconds = false
|
|
7877
7781
|
}) {
|
|
7878
7782
|
const currentDate = date || /* @__PURE__ */ new Date();
|
|
7879
|
-
const itemHeight = ITEM_HEIGHT;
|
|
7880
|
-
const centerIndex = CENTER_INDEX;
|
|
7881
7783
|
const handleTimeChange = (type, value) => {
|
|
7882
7784
|
const newDate = new Date(currentDate);
|
|
7883
7785
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -7885,17 +7787,7 @@ function TimeScrollPicker({
|
|
|
7885
7787
|
else newDate.setSeconds(value);
|
|
7886
7788
|
setDate(newDate);
|
|
7887
7789
|
};
|
|
7888
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxs("div", { className:
|
|
7889
|
-
/* @__PURE__ */ jsx(
|
|
7890
|
-
"div",
|
|
7891
|
-
{
|
|
7892
|
-
className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
|
|
7893
|
-
style: {
|
|
7894
|
-
top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
|
|
7895
|
-
height: `${itemHeight}px`
|
|
7896
|
-
}
|
|
7897
|
-
}
|
|
7898
|
-
),
|
|
7790
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxs("div", { className: "relative flex gap-2 sm:gap-3", children: [
|
|
7899
7791
|
/* @__PURE__ */ jsx(
|
|
7900
7792
|
ScrollColumn,
|
|
7901
7793
|
{
|
|
@@ -7903,7 +7795,7 @@ function TimeScrollPicker({
|
|
|
7903
7795
|
onChange: (v) => handleTimeChange("hours", v),
|
|
7904
7796
|
max: 24,
|
|
7905
7797
|
label: "Hora",
|
|
7906
|
-
|
|
7798
|
+
step: 1
|
|
7907
7799
|
}
|
|
7908
7800
|
),
|
|
7909
7801
|
/* @__PURE__ */ jsx(
|
|
@@ -7913,8 +7805,7 @@ function TimeScrollPicker({
|
|
|
7913
7805
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7914
7806
|
max: 60,
|
|
7915
7807
|
step: 5,
|
|
7916
|
-
label: "Min"
|
|
7917
|
-
hideSeconds
|
|
7808
|
+
label: "Min"
|
|
7918
7809
|
}
|
|
7919
7810
|
),
|
|
7920
7811
|
!hideSeconds && /* @__PURE__ */ jsx(
|
|
@@ -7924,7 +7815,7 @@ function TimeScrollPicker({
|
|
|
7924
7815
|
onChange: (v) => handleTimeChange("seconds", v),
|
|
7925
7816
|
max: 60,
|
|
7926
7817
|
label: "Seg",
|
|
7927
|
-
|
|
7818
|
+
step: 1
|
|
7928
7819
|
}
|
|
7929
7820
|
)
|
|
7930
7821
|
] }) });
|
|
@@ -8220,7 +8111,7 @@ function DateTimePicker({
|
|
|
8220
8111
|
}
|
|
8221
8112
|
),
|
|
8222
8113
|
/* @__PURE__ */ jsx(ErrorMessage_default, { error }),
|
|
8223
|
-
/* @__PURE__ */ jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "overflow-y-auto flex-1
|
|
8114
|
+
/* @__PURE__ */ jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
|
|
8224
8115
|
] }) : /* @__PURE__ */ jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
8225
8116
|
/* @__PURE__ */ jsx(
|
|
8226
8117
|
PopoverTriggerBase,
|