@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.js CHANGED
@@ -1961,15 +1961,16 @@ function ToastItemCard(props) {
1961
1961
  const { toast: toast2, onRemove } = props;
1962
1962
  const [isVisible, setIsVisible] = useState(true);
1963
1963
  const removeTimeoutRef = useRef(null);
1964
+ const EXIT_ANIMATION_MS = 400;
1964
1965
  useEffect(() => {
1965
1966
  const duration = toast2.props.duration ?? 1500;
1966
- if (duration !== Infinity && duration > 300) {
1967
- const fadeOutTime = Math.max(0, duration - 300);
1967
+ if (duration !== Infinity && duration > EXIT_ANIMATION_MS) {
1968
+ const fadeOutTime = Math.max(0, duration - EXIT_ANIMATION_MS);
1968
1969
  const fadeOutTimer = setTimeout(() => {
1969
1970
  setIsVisible(false);
1970
1971
  removeTimeoutRef.current = setTimeout(() => {
1971
1972
  onRemove(toast2.id);
1972
- }, 300);
1973
+ }, EXIT_ANIMATION_MS);
1973
1974
  }, fadeOutTime);
1974
1975
  return () => {
1975
1976
  clearTimeout(fadeOutTimer);
@@ -1990,7 +1991,7 @@ function ToastItemCard(props) {
1990
1991
  }
1991
1992
  removeTimeoutRef.current = setTimeout(() => {
1992
1993
  onRemove(toast2.id);
1993
- }, 300);
1994
+ }, EXIT_ANIMATION_MS);
1994
1995
  };
1995
1996
  const handleCloseClick = (e) => {
1996
1997
  e.stopPropagation();
@@ -2017,17 +2018,15 @@ function ToastItemCard(props) {
2017
2018
  loading: "\u27F3"
2018
2019
  };
2019
2020
  if (iconTheme) {
2021
+ const colorVars = {
2022
+ "--fz-toast-icon-primary": iconTheme.primary,
2023
+ "--fz-toast-icon-secondary": iconTheme.secondary
2024
+ };
2020
2025
  if (type === "loading") {
2021
- return /* @__PURE__ */ jsx(
2022
- "span",
2023
- {
2024
- className: "h-4 w-4 shrink-0 animate-spin rounded-full",
2025
- style: {
2026
- border: `2px solid ${iconTheme.secondary}`,
2027
- borderRightColor: iconTheme.primary
2028
- }
2029
- }
2030
- );
2026
+ return /* @__PURE__ */ jsx("span", { className: "fz-toast-icon-spinner", style: colorVars });
2027
+ }
2028
+ if (type === "success" || type === "error") {
2029
+ return /* @__PURE__ */ jsx("span", { className: `fz-toast-icon-badge fz-toast-icon-badge--${type}`, style: colorVars });
2031
2030
  }
2032
2031
  return /* @__PURE__ */ jsx(
2033
2032
  "span",
@@ -2055,7 +2054,7 @@ function ToastItemCard(props) {
2055
2054
  return /* @__PURE__ */ jsxs(
2056
2055
  "div",
2057
2056
  {
2058
- 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 ?? ""}`,
2057
+ className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} ${isVisible ? "fz-toast-card-enter" : "fz-toast-card-exit"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2059
2058
  style: toast2.props.style,
2060
2059
  onClick: handleClick,
2061
2060
  children: [