@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.js CHANGED
@@ -743,16 +743,13 @@ var VIEWPORT_CLASSES = {
743
743
  "bottom-center": "fixed bottom-4 left-1/2 flex flex-col-reverse items-center -translate-x-1/2"
744
744
  };
745
745
  function getInitialMotion(pos, reduced) {
746
- if (reduced) return { opacity: 0, x: 0, y: 0, scale: 1 };
747
- const right = pos.endsWith("right");
748
- const left = pos.endsWith("left");
749
- const center = pos.endsWith("center");
746
+ if (reduced) return { opacity: 0, y: 0, scale: 1 };
750
747
  const bottom = pos.startsWith("bottom");
751
748
  return {
752
749
  opacity: 0,
753
- x: right ? 40 : left ? -40 : 0,
754
- y: center ? bottom ? 12 : -12 : 0,
755
- scale: center ? 0.96 : 1
750
+ y: bottom ? 10 : -10,
751
+ // drop in from above (top) or rise from below (bottom)
752
+ scale: 0.94
756
753
  };
757
754
  }
758
755
  function TypeIcon({ type }) {
@@ -785,27 +782,31 @@ function NotificationItem({
785
782
  onClose,
786
783
  reduced
787
784
  }) {
785
+ const [hovered, setHovered] = useState(false);
788
786
  const initial = getInitialMotion(pos, reduced);
789
787
  const center = pos.endsWith("center");
788
+ const duration = n.duration ?? 4e3;
789
+ const showProgress = !reduced && isFinite(duration) && duration > 0;
790
790
  return /* @__PURE__ */ jsx(
791
791
  motion.div,
792
792
  {
793
793
  layout: true,
794
794
  initial,
795
- animate: { opacity: 1, x: 0, y: 0, scale: 1 },
796
- exit: { ...initial, opacity: 0 },
795
+ animate: { opacity: 1, y: 0, scale: 1 },
796
+ exit: initial,
797
797
  transition: reduced ? { duration: 0 } : {
798
- opacity: { duration: 0.14 },
799
- x: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
800
- y: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
801
- scale: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
802
- layout: { duration: 0.18 }
798
+ opacity: { duration: 0.18 },
799
+ y: { type: "tween", duration: 0.24, ease: [0.16, 1, 0.3, 1] },
800
+ scale: { type: "tween", duration: 0.24, ease: [0.16, 1, 0.3, 1] },
801
+ layout: { duration: 0.2, ease: [0.16, 1, 0.3, 1] }
803
802
  },
804
- children: /* @__PURE__ */ jsx(
803
+ onMouseEnter: () => setHovered(true),
804
+ onMouseLeave: () => setHovered(false),
805
+ children: /* @__PURE__ */ jsxs(
805
806
  Toast.Root,
806
807
  {
807
808
  open: true,
808
- duration: n.duration,
809
+ duration,
809
810
  onOpenChange: (o) => {
810
811
  if (!o) onClose(n.id);
811
812
  },
@@ -815,22 +816,34 @@ function NotificationItem({
815
816
  "focus:outline-none",
816
817
  TYPE_BG[n.type ?? "info"]
817
818
  ].join(" "),
818
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-3 pr-2.5", children: [
819
- /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex-shrink-0 text-white/90", children: /* @__PURE__ */ jsx(TypeIcon, { type: n.type ?? "info" }) }),
820
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
821
- /* @__PURE__ */ jsx(Toast.Title, { className: "text-sm font-semibold text-white leading-snug", children: n.title }),
822
- n.description && /* @__PURE__ */ jsx(Toast.Description, { className: "mt-0.5 text-xs text-white/75 leading-relaxed", children: n.description })
819
+ children: [
820
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-3 pr-2.5", children: [
821
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex-shrink-0 text-white/90", children: /* @__PURE__ */ jsx(TypeIcon, { type: n.type ?? "info" }) }),
822
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
823
+ /* @__PURE__ */ jsx(Toast.Title, { className: "text-sm font-semibold text-white leading-snug", children: n.title }),
824
+ n.description && /* @__PURE__ */ jsx(Toast.Description, { className: "mt-0.5 text-xs text-white/75 leading-relaxed", children: n.description })
825
+ ] }),
826
+ /* @__PURE__ */ jsx(Toast.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsx(
827
+ "button",
828
+ {
829
+ "aria-label": "Close",
830
+ onClick: () => onClose(n.id),
831
+ 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",
832
+ children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
833
+ }
834
+ ) })
823
835
  ] }),
824
- /* @__PURE__ */ jsx(Toast.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsx(
825
- "button",
836
+ showProgress && /* @__PURE__ */ jsx("div", { className: "relative h-[3px] bg-white/20 overflow-hidden", children: /* @__PURE__ */ jsx(
837
+ "div",
826
838
  {
827
- "aria-label": "Close",
828
- onClick: () => onClose(n.id),
829
- 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",
830
- children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
839
+ className: "absolute inset-0 bg-white/60 [transform-origin:left]",
840
+ style: {
841
+ animation: `notification-progress ${duration}ms linear forwards`,
842
+ animationPlayState: hovered ? "paused" : "running"
843
+ }
831
844
  }
832
845
  ) })
833
- ] })
846
+ ]
834
847
  }
835
848
  )
836
849
  }