@geomak/ui 1.5.3 → 1.6.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.cjs CHANGED
@@ -775,16 +775,13 @@ var VIEWPORT_CLASSES = {
775
775
  "bottom-center": "fixed bottom-4 left-1/2 flex flex-col-reverse items-center -translate-x-1/2"
776
776
  };
777
777
  function getInitialMotion(pos, reduced) {
778
- if (reduced) return { opacity: 0, x: 0, y: 0, scale: 1 };
779
- const right = pos.endsWith("right");
780
- const left = pos.endsWith("left");
781
- const center = pos.endsWith("center");
778
+ if (reduced) return { opacity: 0, y: 0, scale: 1 };
782
779
  const bottom = pos.startsWith("bottom");
783
780
  return {
784
781
  opacity: 0,
785
- x: right ? 40 : left ? -40 : 0,
786
- y: center ? bottom ? 12 : -12 : 0,
787
- scale: center ? 0.96 : 1
782
+ y: bottom ? 10 : -10,
783
+ // drop in from above (top) or rise from below (bottom)
784
+ scale: 0.94
788
785
  };
789
786
  }
790
787
  function TypeIcon({ type }) {
@@ -817,27 +814,31 @@ function NotificationItem({
817
814
  onClose,
818
815
  reduced
819
816
  }) {
817
+ const [hovered, setHovered] = React9.useState(false);
820
818
  const initial = getInitialMotion(pos, reduced);
821
819
  const center = pos.endsWith("center");
820
+ const duration = n.duration ?? 4e3;
821
+ const showProgress = !reduced && isFinite(duration) && duration > 0;
822
822
  return /* @__PURE__ */ jsxRuntime.jsx(
823
823
  framerMotion.motion.div,
824
824
  {
825
825
  layout: true,
826
826
  initial,
827
- animate: { opacity: 1, x: 0, y: 0, scale: 1 },
828
- exit: { ...initial, opacity: 0 },
827
+ animate: { opacity: 1, y: 0, scale: 1 },
828
+ exit: initial,
829
829
  transition: reduced ? { duration: 0 } : {
830
- opacity: { duration: 0.14 },
831
- x: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
832
- y: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
833
- scale: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
834
- layout: { duration: 0.18 }
830
+ opacity: { duration: 0.18 },
831
+ y: { type: "tween", duration: 0.24, ease: [0.16, 1, 0.3, 1] },
832
+ scale: { type: "tween", duration: 0.24, ease: [0.16, 1, 0.3, 1] },
833
+ layout: { duration: 0.2, ease: [0.16, 1, 0.3, 1] }
835
834
  },
836
- children: /* @__PURE__ */ jsxRuntime.jsx(
835
+ onMouseEnter: () => setHovered(true),
836
+ onMouseLeave: () => setHovered(false),
837
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
837
838
  Toast__namespace.Root,
838
839
  {
839
840
  open: true,
840
- duration: n.duration,
841
+ duration,
841
842
  onOpenChange: (o) => {
842
843
  if (!o) onClose(n.id);
843
844
  },
@@ -847,22 +848,34 @@ function NotificationItem({
847
848
  "focus:outline-none",
848
849
  TYPE_BG[n.type ?? "info"]
849
850
  ].join(" "),
850
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 p-3 pr-2.5", children: [
851
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 flex-shrink-0 text-white/90", children: /* @__PURE__ */ jsxRuntime.jsx(TypeIcon, { type: n.type ?? "info" }) }),
852
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
853
- /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Title, { className: "text-sm font-semibold text-white leading-snug", children: n.title }),
854
- n.description && /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Description, { className: "mt-0.5 text-xs text-white/75 leading-relaxed", children: n.description })
851
+ children: [
852
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 p-3 pr-2.5", children: [
853
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 flex-shrink-0 text-white/90", children: /* @__PURE__ */ jsxRuntime.jsx(TypeIcon, { type: n.type ?? "info" }) }),
854
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
855
+ /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Title, { className: "text-sm font-semibold text-white leading-snug", children: n.title }),
856
+ n.description && /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Description, { className: "mt-0.5 text-xs text-white/75 leading-relaxed", children: n.description })
857
+ ] }),
858
+ /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsxRuntime.jsx(
859
+ "button",
860
+ {
861
+ "aria-label": "Close",
862
+ onClick: () => onClose(n.id),
863
+ className: "flex-shrink-0 mt-0.5 rounded p-1 text-white/60 hover:text-white hover:bg-white/15 transition-colors duration-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-white/50",
864
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
865
+ }
866
+ ) })
855
867
  ] }),
856
- /* @__PURE__ */ jsxRuntime.jsx(Toast__namespace.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsxRuntime.jsx(
857
- "button",
868
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-[3px] bg-white/20 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
869
+ "div",
858
870
  {
859
- "aria-label": "Close",
860
- onClick: () => onClose(n.id),
861
- className: "flex-shrink-0 mt-0.5 rounded p-1 text-white/60 hover:text-white hover:bg-white/15 transition-colors duration-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-white/50",
862
- children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
871
+ className: "absolute inset-0 bg-white/60 [transform-origin:left]",
872
+ style: {
873
+ animation: `notification-progress ${duration}ms linear forwards`,
874
+ animationPlayState: hovered ? "paused" : "running"
875
+ }
863
876
  }
864
877
  ) })
865
- ] })
878
+ ]
866
879
  }
867
880
  )
868
881
  }