@underverse-ui/underverse 0.2.106 → 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 +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7159,17 +7159,20 @@ function WheelColumn({
|
|
|
7159
7159
|
},
|
|
7160
7160
|
[items.length, loop]
|
|
7161
7161
|
);
|
|
7162
|
-
React25.
|
|
7162
|
+
React25.useLayoutEffect(() => {
|
|
7163
7163
|
const el = scrollRef.current;
|
|
7164
7164
|
if (!el) return;
|
|
7165
7165
|
const maxVirtual = Math.max(0, extendedItems.length - 1);
|
|
7166
7166
|
const currentVirtual2 = clamp3(Math.round(el.scrollTop / itemHeight), 0, maxVirtual);
|
|
7167
|
-
const desiredVirtual = loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
|
|
7167
|
+
const desiredVirtual = loop && lastVirtualIndexRef.current == null ? baseOffset + valueIndex : loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
|
|
7168
7168
|
const nextTop = desiredVirtual * itemHeight;
|
|
7169
7169
|
const delta = Math.abs(el.scrollTop - nextTop);
|
|
7170
7170
|
if (delta > 1) {
|
|
7171
|
-
|
|
7172
|
-
|
|
7171
|
+
if (animate && delta <= itemHeight * 1.5) {
|
|
7172
|
+
el.scrollTo({ top: nextTop, behavior: "smooth" });
|
|
7173
|
+
} else {
|
|
7174
|
+
el.scrollTop = nextTop;
|
|
7175
|
+
}
|
|
7173
7176
|
}
|
|
7174
7177
|
lastVirtualIndexRef.current = desiredVirtual;
|
|
7175
7178
|
return () => {
|
|
@@ -7179,7 +7182,7 @@ function WheelColumn({
|
|
|
7179
7182
|
}
|
|
7180
7183
|
cancelAnimationFrame(rafRef.current);
|
|
7181
7184
|
};
|
|
7182
|
-
}, [animate, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
7185
|
+
}, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
7183
7186
|
React25.useEffect(() => {
|
|
7184
7187
|
const el = scrollRef.current;
|
|
7185
7188
|
if (!el) return;
|
|
@@ -7262,7 +7265,7 @@ function WheelColumn({
|
|
|
7262
7265
|
if (centered > max) centered -= len;
|
|
7263
7266
|
if (centered !== snappedVirtual) {
|
|
7264
7267
|
lastVirtualIndexRef.current = centered;
|
|
7265
|
-
el.
|
|
7268
|
+
el.scrollTop = centered * itemHeight;
|
|
7266
7269
|
}
|
|
7267
7270
|
}
|
|
7268
7271
|
}, 120);
|
|
@@ -7291,7 +7294,7 @@ function WheelColumn({
|
|
|
7291
7294
|
{
|
|
7292
7295
|
ref: scrollRef,
|
|
7293
7296
|
className: cn(
|
|
7294
|
-
"h-full overflow-y-auto overscroll-contain snap-y snap-mandatory
|
|
7297
|
+
"h-full overflow-y-auto overscroll-contain snap-y snap-mandatory",
|
|
7295
7298
|
"scrollbar-none",
|
|
7296
7299
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-xl"
|
|
7297
7300
|
),
|
|
@@ -7686,7 +7689,7 @@ function TimePicker({
|
|
|
7686
7689
|
emit(next);
|
|
7687
7690
|
};
|
|
7688
7691
|
const timePickerContent = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: panelSz.stackGap, children: [
|
|
7689
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-center py-
|
|
7692
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-center py-1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: cn(panelSz.timeText, "font-bold tabular-nums tracking-wide text-foreground underline underline-offset-8 decoration-primary/60"), children: display }) }),
|
|
7690
7693
|
allowManualInput && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", children: [
|
|
7691
7694
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7692
7695
|
Input_default,
|