@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 CHANGED
@@ -7159,17 +7159,20 @@ function WheelColumn({
7159
7159
  },
7160
7160
  [items.length, loop]
7161
7161
  );
7162
- React25.useEffect(() => {
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
- const behavior = animate && delta <= itemHeight * 1.5 ? "smooth" : "auto";
7172
- el.scrollTo({ top: nextTop, behavior });
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.scrollTo({ top: centered * itemHeight, behavior: "auto" });
7268
+ el.scrollTop = centered * itemHeight;
7266
7269
  }
7267
7270
  }
7268
7271
  }, 120);
@@ -7284,14 +7287,14 @@ function WheelColumn({
7284
7287
  style: { height: itemHeight }
7285
7288
  }
7286
7289
  ),
7287
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("pointer-events-none absolute inset-x-0 top-0 bg-linear-to-b from-background/95 via-background/60 to-transparent z-10", ui.fadeHeight) }),
7288
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-background/95 via-background/60 to-transparent z-10", ui.fadeHeight) }),
7290
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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) }),
7291
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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) }),
7289
7292
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7290
7293
  "div",
7291
7294
  {
7292
7295
  ref: scrollRef,
7293
7296
  className: cn(
7294
- "h-full overflow-y-auto overscroll-contain snap-y snap-mandatory scroll-smooth",
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
  ),
@@ -7304,8 +7307,11 @@ function WheelColumn({
7304
7307
  onScroll: handleScroll,
7305
7308
  children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: extendedItems.map((n, index) => {
7306
7309
  const dist = Math.abs(index - currentVirtual);
7307
- const scale = 1 - Math.min(dist * 0.12, 0.36);
7308
- const opacity = 1 - Math.min(dist * 0.22, 0.75);
7310
+ const distForVisual = Math.min(dist, 2);
7311
+ const t = distForVisual / 2;
7312
+ const ease = t * t;
7313
+ const scale = 1 - ease * 0.18;
7314
+ const opacity = 1 - ease * 0.55;
7309
7315
  const isSelected = index === currentVirtual;
7310
7316
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7311
7317
  "button",
@@ -7683,7 +7689,7 @@ function TimePicker({
7683
7689
  emit(next);
7684
7690
  };
7685
7691
  const timePickerContent = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: panelSz.stackGap, children: [
7686
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-center py-2 px-3 rounded-xl bg-linear-to-r from-primary/10 via-primary/5 to-primary/10 border border-primary/20", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: cn(panelSz.timeText, "font-bold tabular-nums tracking-wide text-foreground"), children: display }) }),
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 }) }),
7687
7693
  allowManualInput && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", children: [
7688
7694
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7689
7695
  Input_default,
@@ -7975,7 +7981,7 @@ function TimePicker({
7975
7981
  contentWidth: matchTriggerWidth ? void 0 : contentWidth,
7976
7982
  contentClassName: cn(
7977
7983
  panelSz.contentPadding,
7978
- "rounded-2xl border bg-popover/95 backdrop-blur-xl shadow-2xl",
7984
+ "rounded-2xl border bg-popover/98 backdrop-blur-md shadow-2xl",
7979
7985
  error && "border-destructive/40",
7980
7986
  success && "border-success/40",
7981
7987
  !error && !success && "border-border/60",