@underverse-ui/underverse 0.2.105 → 0.2.107
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 +19 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6984,17 +6984,20 @@ function WheelColumn({
|
|
|
6984
6984
|
},
|
|
6985
6985
|
[items.length, loop]
|
|
6986
6986
|
);
|
|
6987
|
-
React25.
|
|
6987
|
+
React25.useLayoutEffect(() => {
|
|
6988
6988
|
const el = scrollRef.current;
|
|
6989
6989
|
if (!el) return;
|
|
6990
6990
|
const maxVirtual = Math.max(0, extendedItems.length - 1);
|
|
6991
6991
|
const currentVirtual2 = clamp3(Math.round(el.scrollTop / itemHeight), 0, maxVirtual);
|
|
6992
|
-
const desiredVirtual = loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
|
|
6992
|
+
const desiredVirtual = loop && lastVirtualIndexRef.current == null ? baseOffset + valueIndex : loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
|
|
6993
6993
|
const nextTop = desiredVirtual * itemHeight;
|
|
6994
6994
|
const delta = Math.abs(el.scrollTop - nextTop);
|
|
6995
6995
|
if (delta > 1) {
|
|
6996
|
-
|
|
6997
|
-
|
|
6996
|
+
if (animate && delta <= itemHeight * 1.5) {
|
|
6997
|
+
el.scrollTo({ top: nextTop, behavior: "smooth" });
|
|
6998
|
+
} else {
|
|
6999
|
+
el.scrollTop = nextTop;
|
|
7000
|
+
}
|
|
6998
7001
|
}
|
|
6999
7002
|
lastVirtualIndexRef.current = desiredVirtual;
|
|
7000
7003
|
return () => {
|
|
@@ -7004,7 +7007,7 @@ function WheelColumn({
|
|
|
7004
7007
|
}
|
|
7005
7008
|
cancelAnimationFrame(rafRef.current);
|
|
7006
7009
|
};
|
|
7007
|
-
}, [animate, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
7010
|
+
}, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
7008
7011
|
React25.useEffect(() => {
|
|
7009
7012
|
const el = scrollRef.current;
|
|
7010
7013
|
if (!el) return;
|
|
@@ -7087,7 +7090,7 @@ function WheelColumn({
|
|
|
7087
7090
|
if (centered > max) centered -= len;
|
|
7088
7091
|
if (centered !== snappedVirtual) {
|
|
7089
7092
|
lastVirtualIndexRef.current = centered;
|
|
7090
|
-
el.
|
|
7093
|
+
el.scrollTop = centered * itemHeight;
|
|
7091
7094
|
}
|
|
7092
7095
|
}
|
|
7093
7096
|
}, 120);
|
|
@@ -7109,14 +7112,14 @@ function WheelColumn({
|
|
|
7109
7112
|
style: { height: itemHeight }
|
|
7110
7113
|
}
|
|
7111
7114
|
),
|
|
7112
|
-
/* @__PURE__ */ jsx31("div", { className: cn("pointer-events-none absolute inset-x-0 top-0 bg-linear-to-b from-
|
|
7113
|
-
/* @__PURE__ */ jsx31("div", { className: cn("pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-
|
|
7115
|
+
/* @__PURE__ */ jsx31("div", { className: cn("pointer-events-none absolute inset-x-0 top-0 bg-linear-to-b from-muted/20 via-muted/5 to-transparent z-10", ui.fadeHeight) }),
|
|
7116
|
+
/* @__PURE__ */ jsx31("div", { className: cn("pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-muted/20 via-muted/5 to-transparent z-10", ui.fadeHeight) }),
|
|
7114
7117
|
/* @__PURE__ */ jsx31(
|
|
7115
7118
|
"div",
|
|
7116
7119
|
{
|
|
7117
7120
|
ref: scrollRef,
|
|
7118
7121
|
className: cn(
|
|
7119
|
-
"h-full overflow-y-auto overscroll-contain snap-y snap-mandatory
|
|
7122
|
+
"h-full overflow-y-auto overscroll-contain snap-y snap-mandatory",
|
|
7120
7123
|
"scrollbar-none",
|
|
7121
7124
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-xl"
|
|
7122
7125
|
),
|
|
@@ -7129,8 +7132,11 @@ function WheelColumn({
|
|
|
7129
7132
|
onScroll: handleScroll,
|
|
7130
7133
|
children: /* @__PURE__ */ jsx31("div", { children: extendedItems.map((n, index) => {
|
|
7131
7134
|
const dist = Math.abs(index - currentVirtual);
|
|
7132
|
-
const
|
|
7133
|
-
const
|
|
7135
|
+
const distForVisual = Math.min(dist, 2);
|
|
7136
|
+
const t = distForVisual / 2;
|
|
7137
|
+
const ease = t * t;
|
|
7138
|
+
const scale = 1 - ease * 0.18;
|
|
7139
|
+
const opacity = 1 - ease * 0.55;
|
|
7134
7140
|
const isSelected = index === currentVirtual;
|
|
7135
7141
|
return /* @__PURE__ */ jsx31(
|
|
7136
7142
|
"button",
|
|
@@ -7508,7 +7514,7 @@ function TimePicker({
|
|
|
7508
7514
|
emit(next);
|
|
7509
7515
|
};
|
|
7510
7516
|
const timePickerContent = /* @__PURE__ */ jsxs26("div", { className: panelSz.stackGap, children: [
|
|
7511
|
-
/* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-
|
|
7517
|
+
/* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-1", children: /* @__PURE__ */ jsx31("span", { className: cn(panelSz.timeText, "font-bold tabular-nums tracking-wide text-foreground underline underline-offset-8 decoration-primary/60"), children: display }) }),
|
|
7512
7518
|
allowManualInput && /* @__PURE__ */ jsxs26("div", { className: "relative", children: [
|
|
7513
7519
|
/* @__PURE__ */ jsx31(
|
|
7514
7520
|
Input_default,
|
|
@@ -7800,7 +7806,7 @@ function TimePicker({
|
|
|
7800
7806
|
contentWidth: matchTriggerWidth ? void 0 : contentWidth,
|
|
7801
7807
|
contentClassName: cn(
|
|
7802
7808
|
panelSz.contentPadding,
|
|
7803
|
-
"rounded-2xl border bg-popover/
|
|
7809
|
+
"rounded-2xl border bg-popover/98 backdrop-blur-md shadow-2xl",
|
|
7804
7810
|
error && "border-destructive/40",
|
|
7805
7811
|
success && "border-success/40",
|
|
7806
7812
|
!error && !success && "border-border/60",
|