@farmzone/fz-react-ui 1.1.12 → 1.1.13

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
@@ -1998,15 +1998,16 @@ function ToastItemCard(props) {
1998
1998
  const { toast: toast2, onRemove } = props;
1999
1999
  const [isVisible, setIsVisible] = React6.useState(true);
2000
2000
  const removeTimeoutRef = React6.useRef(null);
2001
+ const EXIT_ANIMATION_MS = 400;
2001
2002
  React6.useEffect(() => {
2002
2003
  const duration = toast2.props.duration ?? 1500;
2003
- if (duration !== Infinity && duration > 300) {
2004
- const fadeOutTime = Math.max(0, duration - 300);
2004
+ if (duration !== Infinity && duration > EXIT_ANIMATION_MS) {
2005
+ const fadeOutTime = Math.max(0, duration - EXIT_ANIMATION_MS);
2005
2006
  const fadeOutTimer = setTimeout(() => {
2006
2007
  setIsVisible(false);
2007
2008
  removeTimeoutRef.current = setTimeout(() => {
2008
2009
  onRemove(toast2.id);
2009
- }, 300);
2010
+ }, EXIT_ANIMATION_MS);
2010
2011
  }, fadeOutTime);
2011
2012
  return () => {
2012
2013
  clearTimeout(fadeOutTimer);
@@ -2027,7 +2028,7 @@ function ToastItemCard(props) {
2027
2028
  }
2028
2029
  removeTimeoutRef.current = setTimeout(() => {
2029
2030
  onRemove(toast2.id);
2030
- }, 300);
2031
+ }, EXIT_ANIMATION_MS);
2031
2032
  };
2032
2033
  const handleCloseClick = (e) => {
2033
2034
  e.stopPropagation();
@@ -2054,17 +2055,15 @@ function ToastItemCard(props) {
2054
2055
  loading: "\u27F3"
2055
2056
  };
2056
2057
  if (iconTheme) {
2058
+ const colorVars = {
2059
+ "--fz-toast-icon-primary": iconTheme.primary,
2060
+ "--fz-toast-icon-secondary": iconTheme.secondary
2061
+ };
2057
2062
  if (type === "loading") {
2058
- return /* @__PURE__ */ jsxRuntime.jsx(
2059
- "span",
2060
- {
2061
- className: "h-4 w-4 shrink-0 animate-spin rounded-full",
2062
- style: {
2063
- border: `2px solid ${iconTheme.secondary}`,
2064
- borderRightColor: iconTheme.primary
2065
- }
2066
- }
2067
- );
2063
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fz-toast-icon-spinner", style: colorVars });
2064
+ }
2065
+ if (type === "success" || type === "error") {
2066
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `fz-toast-icon-badge fz-toast-icon-badge--${type}`, style: colorVars });
2068
2067
  }
2069
2068
  return /* @__PURE__ */ jsxRuntime.jsx(
2070
2069
  "span",
@@ -2092,7 +2091,7 @@ function ToastItemCard(props) {
2092
2091
  return /* @__PURE__ */ jsxRuntime.jsxs(
2093
2092
  "div",
2094
2093
  {
2095
- className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} transition-all duration-300 ${isVisible ? "animate-in slide-in-from-top-2 fade-in-0 duration-300 opacity-100" : "animate-out slide-out-to-top-2 fade-out-0 duration-300 opacity-0"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2094
+ className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} ${isVisible ? "fz-toast-card-enter" : "fz-toast-card-exit"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2096
2095
  style: toast2.props.style,
2097
2096
  onClick: handleClick,
2098
2097
  children: [