@almadar/ui 2.26.0 → 2.27.0

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.
@@ -4659,6 +4659,289 @@ var AnimatedCounter = ({
4659
4659
  ] });
4660
4660
  };
4661
4661
  AnimatedCounter.displayName = "AnimatedCounter";
4662
+ var initialStyles = {
4663
+ "fade-up": { opacity: 0, transform: "translateY(24px)" },
4664
+ "fade-down": { opacity: 0, transform: "translateY(-24px)" },
4665
+ "fade-in": { opacity: 0 },
4666
+ "fade-left": { opacity: 0, transform: "translateX(24px)" },
4667
+ "fade-right": { opacity: 0, transform: "translateX(-24px)" },
4668
+ "scale": { opacity: 0, transform: "scale(0.92)" },
4669
+ "scale-up": { opacity: 0, transform: "scale(0.92) translateY(16px)" },
4670
+ "none": {}
4671
+ };
4672
+ var animatedStyles = {
4673
+ "fade-up": { opacity: 1, transform: "translateY(0)" },
4674
+ "fade-down": { opacity: 1, transform: "translateY(0)" },
4675
+ "fade-in": { opacity: 1 },
4676
+ "fade-left": { opacity: 1, transform: "translateX(0)" },
4677
+ "fade-right": { opacity: 1, transform: "translateX(0)" },
4678
+ "scale": { opacity: 1, transform: "scale(1)" },
4679
+ "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
4680
+ "none": {}
4681
+ };
4682
+ var AnimatedReveal = React5__default.default.forwardRef(
4683
+ ({
4684
+ trigger = "scroll",
4685
+ animation = "fade-up",
4686
+ duration = 600,
4687
+ delay = 0,
4688
+ threshold = 0.15,
4689
+ once = true,
4690
+ animate: manualAnimate,
4691
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
4692
+ children,
4693
+ className,
4694
+ style,
4695
+ ...props
4696
+ }, forwardedRef) => {
4697
+ const [isAnimated, setIsAnimated] = React5.useState(false);
4698
+ const internalRef = React5.useRef(null);
4699
+ const hasAnimated = React5.useRef(false);
4700
+ const setRef = React5.useCallback(
4701
+ (node) => {
4702
+ internalRef.current = node;
4703
+ if (typeof forwardedRef === "function") forwardedRef(node);
4704
+ else if (forwardedRef) forwardedRef.current = node;
4705
+ },
4706
+ [forwardedRef]
4707
+ );
4708
+ React5.useEffect(() => {
4709
+ if (trigger !== "scroll") return;
4710
+ const el = internalRef.current;
4711
+ if (!el) return;
4712
+ const observer = new IntersectionObserver(
4713
+ ([entry]) => {
4714
+ if (entry.isIntersecting) {
4715
+ if (once && hasAnimated.current) return;
4716
+ hasAnimated.current = true;
4717
+ setIsAnimated(true);
4718
+ } else if (!once) {
4719
+ setIsAnimated(false);
4720
+ }
4721
+ },
4722
+ { threshold }
4723
+ );
4724
+ observer.observe(el);
4725
+ return () => observer.disconnect();
4726
+ }, [trigger, threshold, once]);
4727
+ const handleMouseEnter = trigger === "hover" ? () => setIsAnimated(true) : void 0;
4728
+ const handleMouseLeave = trigger === "hover" ? () => {
4729
+ if (!once || !hasAnimated.current) {
4730
+ hasAnimated.current = true;
4731
+ setIsAnimated(false);
4732
+ }
4733
+ } : void 0;
4734
+ React5.useEffect(() => {
4735
+ if (trigger === "manual" && manualAnimate !== void 0) {
4736
+ setIsAnimated(manualAnimate);
4737
+ }
4738
+ }, [trigger, manualAnimate]);
4739
+ const active = isAnimated;
4740
+ const currentStyle = active ? animatedStyles[animation] : initialStyles[animation];
4741
+ return /* @__PURE__ */ jsxRuntime.jsx(
4742
+ "div",
4743
+ {
4744
+ ref: setRef,
4745
+ className: cn("will-change-[opacity,transform]", className),
4746
+ style: {
4747
+ ...currentStyle,
4748
+ transitionProperty: "opacity, transform",
4749
+ transitionDuration: `${duration}ms`,
4750
+ transitionDelay: `${delay}ms`,
4751
+ transitionTimingFunction: easing,
4752
+ ...style
4753
+ },
4754
+ onMouseEnter: handleMouseEnter,
4755
+ onMouseLeave: handleMouseLeave,
4756
+ ...props,
4757
+ children: typeof children === "function" ? children(active) : children
4758
+ }
4759
+ );
4760
+ }
4761
+ );
4762
+ AnimatedReveal.displayName = "AnimatedReveal";
4763
+ function useFetchedSvg(src) {
4764
+ const [svg, setSvg] = React5.useState(null);
4765
+ const cache = React5.useRef({});
4766
+ React5.useEffect(() => {
4767
+ if (!src) {
4768
+ setSvg(null);
4769
+ return;
4770
+ }
4771
+ if (cache.current[src]) {
4772
+ setSvg(cache.current[src]);
4773
+ return;
4774
+ }
4775
+ let cancelled = false;
4776
+ fetch(src).then((res) => {
4777
+ if (!res.ok) throw new Error(`Failed to fetch SVG: ${res.status}`);
4778
+ return res.text();
4779
+ }).then((text) => {
4780
+ if (cancelled) return;
4781
+ cache.current[src] = text;
4782
+ setSvg(text);
4783
+ }).catch(() => {
4784
+ if (!cancelled) setSvg(null);
4785
+ });
4786
+ return () => {
4787
+ cancelled = true;
4788
+ };
4789
+ }, [src]);
4790
+ return svg;
4791
+ }
4792
+ function applyDrawAnimation(container, animate, duration, delay, easing) {
4793
+ const paths = container.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4794
+ paths.forEach((el) => {
4795
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
4796
+ const len = el.getTotalLength();
4797
+ el.style.strokeDasharray = `${len}`;
4798
+ el.style.strokeDashoffset = animate ? "0" : `${len}`;
4799
+ el.style.transition = `stroke-dashoffset ${duration}ms ${easing} ${delay}ms`;
4800
+ }
4801
+ });
4802
+ }
4803
+ function applyFillAnimation(container, animate, duration, delay, easing, fillColor) {
4804
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
4805
+ paths.forEach((el) => {
4806
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
4807
+ const geom = el;
4808
+ const len = geom.getTotalLength();
4809
+ geom.style.strokeDasharray = `${len}`;
4810
+ geom.style.strokeDashoffset = animate ? "0" : `${len}`;
4811
+ geom.style.transition = `stroke-dashoffset ${duration * 0.6}ms ${easing} ${delay}ms, fill-opacity ${duration * 0.4}ms ${easing} ${delay + duration * 0.6}ms`;
4812
+ }
4813
+ if (fillColor) el.style.fill = fillColor;
4814
+ el.style.fillOpacity = animate ? "1" : "0";
4815
+ });
4816
+ }
4817
+ function applyPulseAnimation(container, animate, duration) {
4818
+ const svg = container.querySelector("svg");
4819
+ if (!svg) return;
4820
+ if (animate) {
4821
+ svg.style.animation = `ag-pulse ${duration}ms ease-in-out infinite`;
4822
+ } else {
4823
+ svg.style.animation = "none";
4824
+ }
4825
+ }
4826
+ function applyMorphAnimation(container, animate, duration, delay, easing) {
4827
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
4828
+ paths.forEach((el) => {
4829
+ el.style.transition = `all ${duration}ms ${easing} ${delay}ms`;
4830
+ el.style.transform = animate ? "scale(1)" : "scale(0)";
4831
+ el.style.transformOrigin = "center";
4832
+ el.style.opacity = animate ? "1" : "0";
4833
+ });
4834
+ }
4835
+ var AnimatedGraphic = React5__default.default.forwardRef(
4836
+ ({
4837
+ src,
4838
+ svgContent,
4839
+ animation = "draw",
4840
+ animate = false,
4841
+ duration = 1200,
4842
+ delay = 0,
4843
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
4844
+ width,
4845
+ height,
4846
+ strokeColor,
4847
+ fillColor,
4848
+ alt,
4849
+ className,
4850
+ style,
4851
+ children,
4852
+ ...props
4853
+ }, ref) => {
4854
+ const containerRef = React5.useRef(null);
4855
+ const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
4856
+ const resolvedSvg = svgContent ?? fetchedSvg;
4857
+ const prevAnimateRef = React5.useRef(animate);
4858
+ const setRef = React5__default.default.useCallback(
4859
+ (node) => {
4860
+ containerRef.current = node;
4861
+ if (typeof ref === "function") ref(node);
4862
+ else if (ref) ref.current = node;
4863
+ },
4864
+ [ref]
4865
+ );
4866
+ React5.useEffect(() => {
4867
+ const el = containerRef.current;
4868
+ if (!el || !strokeColor) return;
4869
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4870
+ paths.forEach((p) => {
4871
+ p.style.stroke = strokeColor;
4872
+ });
4873
+ }, [resolvedSvg, strokeColor]);
4874
+ React5.useEffect(() => {
4875
+ const el = containerRef.current;
4876
+ if (!el || !resolvedSvg) return;
4877
+ if (animation === "draw" || animation === "fill") {
4878
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4879
+ paths.forEach((p) => {
4880
+ if ("getTotalLength" in p && typeof p.getTotalLength === "function") {
4881
+ const len = p.getTotalLength();
4882
+ p.style.strokeDasharray = `${len}`;
4883
+ p.style.strokeDashoffset = `${len}`;
4884
+ }
4885
+ if (animation === "fill") {
4886
+ p.style.fillOpacity = "0";
4887
+ }
4888
+ });
4889
+ }
4890
+ if (animation === "morph") {
4891
+ const paths = el.querySelectorAll("path, circle, ellipse, rect, polygon");
4892
+ paths.forEach((p) => {
4893
+ p.style.transform = "scale(0)";
4894
+ p.style.transformOrigin = "center";
4895
+ p.style.opacity = "0";
4896
+ });
4897
+ }
4898
+ }, [resolvedSvg, animation]);
4899
+ React5.useEffect(() => {
4900
+ const el = containerRef.current;
4901
+ if (!el) return;
4902
+ const id = requestAnimationFrame(() => {
4903
+ switch (animation) {
4904
+ case "draw":
4905
+ applyDrawAnimation(el, animate, duration, delay, easing);
4906
+ break;
4907
+ case "fill":
4908
+ applyFillAnimation(el, animate, duration, delay, easing, fillColor);
4909
+ break;
4910
+ case "pulse":
4911
+ applyPulseAnimation(el, animate, duration);
4912
+ break;
4913
+ case "morph":
4914
+ applyMorphAnimation(el, animate, duration, delay, easing);
4915
+ break;
4916
+ }
4917
+ });
4918
+ prevAnimateRef.current = animate;
4919
+ return () => cancelAnimationFrame(id);
4920
+ }, [animate, animation, duration, delay, easing, fillColor, resolvedSvg]);
4921
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4922
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `@keyframes ag-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.04); opacity: 0.85; } }` }),
4923
+ /* @__PURE__ */ jsxRuntime.jsx(
4924
+ "div",
4925
+ {
4926
+ ref: setRef,
4927
+ className: cn("inline-flex items-center justify-center", className),
4928
+ style: { width, height, ...style },
4929
+ role: alt ? "img" : void 0,
4930
+ "aria-label": alt,
4931
+ ...props,
4932
+ children: resolvedSvg ? /* @__PURE__ */ jsxRuntime.jsx(
4933
+ "div",
4934
+ {
4935
+ className: "w-full h-full [&>svg]:w-full [&>svg]:h-full",
4936
+ dangerouslySetInnerHTML: { __html: resolvedSvg }
4937
+ }
4938
+ ) : children
4939
+ }
4940
+ )
4941
+ ] });
4942
+ }
4943
+ );
4944
+ AnimatedGraphic.displayName = "AnimatedGraphic";
4662
4945
  var PI = Math.PI;
4663
4946
  function lineIntersection(x1, y1, x2, y2, x3, y3, x4, y4) {
4664
4947
  const denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
@@ -5675,6 +5958,8 @@ var EdgeDecoration = ({
5675
5958
  EdgeDecoration.displayName = "EdgeDecoration";
5676
5959
 
5677
5960
  exports.AnimatedCounter = AnimatedCounter;
5961
+ exports.AnimatedGraphic = AnimatedGraphic;
5962
+ exports.AnimatedReveal = AnimatedReveal;
5678
5963
  exports.ArticleSection = ArticleSection;
5679
5964
  exports.Badge = Badge;
5680
5965
  exports.Box = Box;
@@ -828,6 +828,59 @@ interface AnimatedCounterProps {
828
828
  }
829
829
  declare const AnimatedCounter: React.FC<AnimatedCounterProps>;
830
830
 
831
+ type RevealTrigger = 'scroll' | 'hover' | 'manual';
832
+ type RevealAnimation = 'fade-up' | 'fade-down' | 'fade-in' | 'fade-left' | 'fade-right' | 'scale' | 'scale-up' | 'none';
833
+ interface AnimatedRevealProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
834
+ /** What triggers the animation */
835
+ trigger?: RevealTrigger;
836
+ /** Built-in animation preset */
837
+ animation?: RevealAnimation;
838
+ /** Animation duration in ms (default: 600) */
839
+ duration?: number;
840
+ /** Delay before animation starts in ms (default: 0) */
841
+ delay?: number;
842
+ /** How much of the element must be visible before triggering, 0-1 (default: 0.15) */
843
+ threshold?: number;
844
+ /** Animate only the first time the element enters the viewport (default: true) */
845
+ once?: boolean;
846
+ /** Manual control: when trigger='manual', set this to true to animate */
847
+ animate?: boolean;
848
+ /** Easing function (default: cubic-bezier(0.16, 1, 0.3, 1)) */
849
+ easing?: string;
850
+ /** Children: ReactNode or render function receiving animated state */
851
+ children: React.ReactNode | ((animated: boolean) => React.ReactNode);
852
+ }
853
+ declare const AnimatedReveal: React.ForwardRefExoticComponent<AnimatedRevealProps & React.RefAttributes<HTMLDivElement>>;
854
+
855
+ type GraphicAnimation = 'draw' | 'fill' | 'pulse' | 'morph';
856
+ interface AnimatedGraphicProps extends React.HTMLAttributes<HTMLDivElement> {
857
+ /** URL to an SVG file. Fetched and inlined to enable stroke/fill animations. */
858
+ src?: string;
859
+ /** Inline SVG string. Takes precedence over src if both provided. */
860
+ svgContent?: string;
861
+ /** Animation type applied to SVG paths/shapes */
862
+ animation?: GraphicAnimation;
863
+ /** Whether to run the animation (default: false). Controlled externally or via AnimatedReveal. */
864
+ animate?: boolean;
865
+ /** Animation duration in ms (default: 1200) */
866
+ duration?: number;
867
+ /** Delay before animation starts in ms (default: 0) */
868
+ delay?: number;
869
+ /** Easing function (default: cubic-bezier(0.16, 1, 0.3, 1)) */
870
+ easing?: string;
871
+ /** Width of the graphic container */
872
+ width?: string | number;
873
+ /** Height of the graphic container */
874
+ height?: string | number;
875
+ /** Stroke color override for SVG paths */
876
+ strokeColor?: string;
877
+ /** Fill color for the 'fill' animation end state */
878
+ fillColor?: string;
879
+ /** Alt text for accessibility */
880
+ alt?: string;
881
+ }
882
+ declare const AnimatedGraphic: React.ForwardRefExoticComponent<AnimatedGraphicProps & React.RefAttributes<HTMLDivElement>>;
883
+
831
884
  /**
832
885
  * PatternTile Atom
833
886
  *
@@ -939,4 +992,4 @@ interface EdgeDecorationProps {
939
992
  }
940
993
  declare const EdgeDecoration: React.FC<EdgeDecorationProps>;
941
994
 
942
- export { AnimatedCounter, type AnimatedCounterProps, ArticleSection, type ArticleSectionProps, Badge, Box, Button, CTABanner, type CTABannerProps, Card, CaseStudyCard, type CaseStudyCardProps, Center, CommunityLinks, type CommunityLinksProps, ContentSection, type ContentSectionProps, Divider, EdgeDecoration, type EdgeDecorationProps, type EdgeSide, type EdgeVariant, FeatureCard, type FeatureCardProps, FeatureGrid, type FeatureGridProps, type FooterLinkColumn, type FooterLinkItem, GeometricPattern, type GeometricPatternProps, GradientDivider, type GradientDividerProps, HStack, HeroSection, type HeroSectionProps, Icon, InstallBox, type InstallBoxProps, MarketingFooter, type MarketingFooterProps, PatternTile, type PatternTileProps, type PatternVariant, PricingCard, type PricingCardProps, PricingGrid, type PricingGridProps, PullQuote, type PullQuoteProps, ServiceCatalog, type ServiceCatalogProps, ShowcaseCard, type ShowcaseCardProps, SimpleGrid, Spacer, SplitSection, type SplitSectionProps, StatsGrid, type StatsGridProps, StepFlow, type StepFlowProps, type StepItemProps, TagCloud, type TagCloudProps, TeamCard, type TeamCardProps, Typography, VStack, getTileDimensions };
995
+ export { AnimatedCounter, type AnimatedCounterProps, AnimatedGraphic, type AnimatedGraphicProps, AnimatedReveal, type AnimatedRevealProps, ArticleSection, type ArticleSectionProps, Badge, Box, Button, CTABanner, type CTABannerProps, Card, CaseStudyCard, type CaseStudyCardProps, Center, CommunityLinks, type CommunityLinksProps, ContentSection, type ContentSectionProps, Divider, EdgeDecoration, type EdgeDecorationProps, type EdgeSide, type EdgeVariant, FeatureCard, type FeatureCardProps, FeatureGrid, type FeatureGridProps, type FooterLinkColumn, type FooterLinkItem, GeometricPattern, type GeometricPatternProps, GradientDivider, type GradientDividerProps, type GraphicAnimation, HStack, HeroSection, type HeroSectionProps, Icon, InstallBox, type InstallBoxProps, MarketingFooter, type MarketingFooterProps, PatternTile, type PatternTileProps, type PatternVariant, PricingCard, type PricingCardProps, PricingGrid, type PricingGridProps, PullQuote, type PullQuoteProps, type RevealAnimation, type RevealTrigger, ServiceCatalog, type ServiceCatalogProps, ShowcaseCard, type ShowcaseCardProps, SimpleGrid, Spacer, SplitSection, type SplitSectionProps, StatsGrid, type StatsGridProps, StepFlow, type StepFlowProps, type StepItemProps, TagCloud, type TagCloudProps, TeamCard, type TeamCardProps, Typography, VStack, getTileDimensions };
@@ -60,6 +60,10 @@ export { PullQuote } from '../components/molecules/PullQuote';
60
60
  export type { PullQuoteProps } from '../components/molecules/PullQuote';
61
61
  export { AnimatedCounter } from '../components/molecules/AnimatedCounter';
62
62
  export type { AnimatedCounterProps } from '../components/molecules/AnimatedCounter';
63
+ export { AnimatedReveal } from '../components/atoms/AnimatedReveal';
64
+ export type { AnimatedRevealProps, RevealTrigger, RevealAnimation } from '../components/atoms/AnimatedReveal';
65
+ export { AnimatedGraphic } from '../components/atoms/AnimatedGraphic';
66
+ export type { AnimatedGraphicProps, GraphicAnimation } from '../components/atoms/AnimatedGraphic';
63
67
  export { PatternTile, getTileDimensions } from '../components/atoms/PatternTile';
64
68
  export type { PatternTileProps, PatternVariant } from '../components/atoms/PatternTile';
65
69
  export { GeometricPattern } from '../components/molecules/GeometricPattern';
@@ -1,4 +1,4 @@
1
- import React5, { createContext, useCallback, useContext, useState, useRef, useEffect, useId } from 'react';
1
+ import React5, { createContext, useCallback, useState, useRef, useEffect, useContext, useId } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import * as LucideIcons from 'lucide-react';
4
4
  import { Loader2, Check, User } from 'lucide-react';
@@ -4635,6 +4635,289 @@ var AnimatedCounter = ({
4635
4635
  ] });
4636
4636
  };
4637
4637
  AnimatedCounter.displayName = "AnimatedCounter";
4638
+ var initialStyles = {
4639
+ "fade-up": { opacity: 0, transform: "translateY(24px)" },
4640
+ "fade-down": { opacity: 0, transform: "translateY(-24px)" },
4641
+ "fade-in": { opacity: 0 },
4642
+ "fade-left": { opacity: 0, transform: "translateX(24px)" },
4643
+ "fade-right": { opacity: 0, transform: "translateX(-24px)" },
4644
+ "scale": { opacity: 0, transform: "scale(0.92)" },
4645
+ "scale-up": { opacity: 0, transform: "scale(0.92) translateY(16px)" },
4646
+ "none": {}
4647
+ };
4648
+ var animatedStyles = {
4649
+ "fade-up": { opacity: 1, transform: "translateY(0)" },
4650
+ "fade-down": { opacity: 1, transform: "translateY(0)" },
4651
+ "fade-in": { opacity: 1 },
4652
+ "fade-left": { opacity: 1, transform: "translateX(0)" },
4653
+ "fade-right": { opacity: 1, transform: "translateX(0)" },
4654
+ "scale": { opacity: 1, transform: "scale(1)" },
4655
+ "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
4656
+ "none": {}
4657
+ };
4658
+ var AnimatedReveal = React5.forwardRef(
4659
+ ({
4660
+ trigger = "scroll",
4661
+ animation = "fade-up",
4662
+ duration = 600,
4663
+ delay = 0,
4664
+ threshold = 0.15,
4665
+ once = true,
4666
+ animate: manualAnimate,
4667
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
4668
+ children,
4669
+ className,
4670
+ style,
4671
+ ...props
4672
+ }, forwardedRef) => {
4673
+ const [isAnimated, setIsAnimated] = useState(false);
4674
+ const internalRef = useRef(null);
4675
+ const hasAnimated = useRef(false);
4676
+ const setRef = useCallback(
4677
+ (node) => {
4678
+ internalRef.current = node;
4679
+ if (typeof forwardedRef === "function") forwardedRef(node);
4680
+ else if (forwardedRef) forwardedRef.current = node;
4681
+ },
4682
+ [forwardedRef]
4683
+ );
4684
+ useEffect(() => {
4685
+ if (trigger !== "scroll") return;
4686
+ const el = internalRef.current;
4687
+ if (!el) return;
4688
+ const observer = new IntersectionObserver(
4689
+ ([entry]) => {
4690
+ if (entry.isIntersecting) {
4691
+ if (once && hasAnimated.current) return;
4692
+ hasAnimated.current = true;
4693
+ setIsAnimated(true);
4694
+ } else if (!once) {
4695
+ setIsAnimated(false);
4696
+ }
4697
+ },
4698
+ { threshold }
4699
+ );
4700
+ observer.observe(el);
4701
+ return () => observer.disconnect();
4702
+ }, [trigger, threshold, once]);
4703
+ const handleMouseEnter = trigger === "hover" ? () => setIsAnimated(true) : void 0;
4704
+ const handleMouseLeave = trigger === "hover" ? () => {
4705
+ if (!once || !hasAnimated.current) {
4706
+ hasAnimated.current = true;
4707
+ setIsAnimated(false);
4708
+ }
4709
+ } : void 0;
4710
+ useEffect(() => {
4711
+ if (trigger === "manual" && manualAnimate !== void 0) {
4712
+ setIsAnimated(manualAnimate);
4713
+ }
4714
+ }, [trigger, manualAnimate]);
4715
+ const active = isAnimated;
4716
+ const currentStyle = active ? animatedStyles[animation] : initialStyles[animation];
4717
+ return /* @__PURE__ */ jsx(
4718
+ "div",
4719
+ {
4720
+ ref: setRef,
4721
+ className: cn("will-change-[opacity,transform]", className),
4722
+ style: {
4723
+ ...currentStyle,
4724
+ transitionProperty: "opacity, transform",
4725
+ transitionDuration: `${duration}ms`,
4726
+ transitionDelay: `${delay}ms`,
4727
+ transitionTimingFunction: easing,
4728
+ ...style
4729
+ },
4730
+ onMouseEnter: handleMouseEnter,
4731
+ onMouseLeave: handleMouseLeave,
4732
+ ...props,
4733
+ children: typeof children === "function" ? children(active) : children
4734
+ }
4735
+ );
4736
+ }
4737
+ );
4738
+ AnimatedReveal.displayName = "AnimatedReveal";
4739
+ function useFetchedSvg(src) {
4740
+ const [svg, setSvg] = useState(null);
4741
+ const cache = useRef({});
4742
+ useEffect(() => {
4743
+ if (!src) {
4744
+ setSvg(null);
4745
+ return;
4746
+ }
4747
+ if (cache.current[src]) {
4748
+ setSvg(cache.current[src]);
4749
+ return;
4750
+ }
4751
+ let cancelled = false;
4752
+ fetch(src).then((res) => {
4753
+ if (!res.ok) throw new Error(`Failed to fetch SVG: ${res.status}`);
4754
+ return res.text();
4755
+ }).then((text) => {
4756
+ if (cancelled) return;
4757
+ cache.current[src] = text;
4758
+ setSvg(text);
4759
+ }).catch(() => {
4760
+ if (!cancelled) setSvg(null);
4761
+ });
4762
+ return () => {
4763
+ cancelled = true;
4764
+ };
4765
+ }, [src]);
4766
+ return svg;
4767
+ }
4768
+ function applyDrawAnimation(container, animate, duration, delay, easing) {
4769
+ const paths = container.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4770
+ paths.forEach((el) => {
4771
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
4772
+ const len = el.getTotalLength();
4773
+ el.style.strokeDasharray = `${len}`;
4774
+ el.style.strokeDashoffset = animate ? "0" : `${len}`;
4775
+ el.style.transition = `stroke-dashoffset ${duration}ms ${easing} ${delay}ms`;
4776
+ }
4777
+ });
4778
+ }
4779
+ function applyFillAnimation(container, animate, duration, delay, easing, fillColor) {
4780
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
4781
+ paths.forEach((el) => {
4782
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
4783
+ const geom = el;
4784
+ const len = geom.getTotalLength();
4785
+ geom.style.strokeDasharray = `${len}`;
4786
+ geom.style.strokeDashoffset = animate ? "0" : `${len}`;
4787
+ geom.style.transition = `stroke-dashoffset ${duration * 0.6}ms ${easing} ${delay}ms, fill-opacity ${duration * 0.4}ms ${easing} ${delay + duration * 0.6}ms`;
4788
+ }
4789
+ if (fillColor) el.style.fill = fillColor;
4790
+ el.style.fillOpacity = animate ? "1" : "0";
4791
+ });
4792
+ }
4793
+ function applyPulseAnimation(container, animate, duration) {
4794
+ const svg = container.querySelector("svg");
4795
+ if (!svg) return;
4796
+ if (animate) {
4797
+ svg.style.animation = `ag-pulse ${duration}ms ease-in-out infinite`;
4798
+ } else {
4799
+ svg.style.animation = "none";
4800
+ }
4801
+ }
4802
+ function applyMorphAnimation(container, animate, duration, delay, easing) {
4803
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
4804
+ paths.forEach((el) => {
4805
+ el.style.transition = `all ${duration}ms ${easing} ${delay}ms`;
4806
+ el.style.transform = animate ? "scale(1)" : "scale(0)";
4807
+ el.style.transformOrigin = "center";
4808
+ el.style.opacity = animate ? "1" : "0";
4809
+ });
4810
+ }
4811
+ var AnimatedGraphic = React5.forwardRef(
4812
+ ({
4813
+ src,
4814
+ svgContent,
4815
+ animation = "draw",
4816
+ animate = false,
4817
+ duration = 1200,
4818
+ delay = 0,
4819
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
4820
+ width,
4821
+ height,
4822
+ strokeColor,
4823
+ fillColor,
4824
+ alt,
4825
+ className,
4826
+ style,
4827
+ children,
4828
+ ...props
4829
+ }, ref) => {
4830
+ const containerRef = useRef(null);
4831
+ const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
4832
+ const resolvedSvg = svgContent ?? fetchedSvg;
4833
+ const prevAnimateRef = useRef(animate);
4834
+ const setRef = React5.useCallback(
4835
+ (node) => {
4836
+ containerRef.current = node;
4837
+ if (typeof ref === "function") ref(node);
4838
+ else if (ref) ref.current = node;
4839
+ },
4840
+ [ref]
4841
+ );
4842
+ useEffect(() => {
4843
+ const el = containerRef.current;
4844
+ if (!el || !strokeColor) return;
4845
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4846
+ paths.forEach((p) => {
4847
+ p.style.stroke = strokeColor;
4848
+ });
4849
+ }, [resolvedSvg, strokeColor]);
4850
+ useEffect(() => {
4851
+ const el = containerRef.current;
4852
+ if (!el || !resolvedSvg) return;
4853
+ if (animation === "draw" || animation === "fill") {
4854
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
4855
+ paths.forEach((p) => {
4856
+ if ("getTotalLength" in p && typeof p.getTotalLength === "function") {
4857
+ const len = p.getTotalLength();
4858
+ p.style.strokeDasharray = `${len}`;
4859
+ p.style.strokeDashoffset = `${len}`;
4860
+ }
4861
+ if (animation === "fill") {
4862
+ p.style.fillOpacity = "0";
4863
+ }
4864
+ });
4865
+ }
4866
+ if (animation === "morph") {
4867
+ const paths = el.querySelectorAll("path, circle, ellipse, rect, polygon");
4868
+ paths.forEach((p) => {
4869
+ p.style.transform = "scale(0)";
4870
+ p.style.transformOrigin = "center";
4871
+ p.style.opacity = "0";
4872
+ });
4873
+ }
4874
+ }, [resolvedSvg, animation]);
4875
+ useEffect(() => {
4876
+ const el = containerRef.current;
4877
+ if (!el) return;
4878
+ const id = requestAnimationFrame(() => {
4879
+ switch (animation) {
4880
+ case "draw":
4881
+ applyDrawAnimation(el, animate, duration, delay, easing);
4882
+ break;
4883
+ case "fill":
4884
+ applyFillAnimation(el, animate, duration, delay, easing, fillColor);
4885
+ break;
4886
+ case "pulse":
4887
+ applyPulseAnimation(el, animate, duration);
4888
+ break;
4889
+ case "morph":
4890
+ applyMorphAnimation(el, animate, duration, delay, easing);
4891
+ break;
4892
+ }
4893
+ });
4894
+ prevAnimateRef.current = animate;
4895
+ return () => cancelAnimationFrame(id);
4896
+ }, [animate, animation, duration, delay, easing, fillColor, resolvedSvg]);
4897
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4898
+ /* @__PURE__ */ jsx("style", { children: `@keyframes ag-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.04); opacity: 0.85; } }` }),
4899
+ /* @__PURE__ */ jsx(
4900
+ "div",
4901
+ {
4902
+ ref: setRef,
4903
+ className: cn("inline-flex items-center justify-center", className),
4904
+ style: { width, height, ...style },
4905
+ role: alt ? "img" : void 0,
4906
+ "aria-label": alt,
4907
+ ...props,
4908
+ children: resolvedSvg ? /* @__PURE__ */ jsx(
4909
+ "div",
4910
+ {
4911
+ className: "w-full h-full [&>svg]:w-full [&>svg]:h-full",
4912
+ dangerouslySetInnerHTML: { __html: resolvedSvg }
4913
+ }
4914
+ ) : children
4915
+ }
4916
+ )
4917
+ ] });
4918
+ }
4919
+ );
4920
+ AnimatedGraphic.displayName = "AnimatedGraphic";
4638
4921
  var PI = Math.PI;
4639
4922
  function lineIntersection(x1, y1, x2, y2, x3, y3, x4, y4) {
4640
4923
  const denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
@@ -5650,4 +5933,4 @@ var EdgeDecoration = ({
5650
5933
  };
5651
5934
  EdgeDecoration.displayName = "EdgeDecoration";
5652
5935
 
5653
- export { AnimatedCounter, ArticleSection, Badge, Box, Button, CTABanner, Card, CaseStudyCard, Center, CommunityLinks, ContentSection, Divider, EdgeDecoration, FeatureCard, FeatureGrid, GeometricPattern, GradientDivider, HStack, HeroSection, Icon, InstallBox, MarketingFooter, PatternTile, PricingCard, PricingGrid, PullQuote, ServiceCatalog, ShowcaseCard, SimpleGrid, Spacer, SplitSection, StatsGrid, StepFlow, TagCloud, TeamCard, Typography, VStack, getTileDimensions };
5936
+ export { AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Badge, Box, Button, CTABanner, Card, CaseStudyCard, Center, CommunityLinks, ContentSection, Divider, EdgeDecoration, FeatureCard, FeatureGrid, GeometricPattern, GradientDivider, HStack, HeroSection, Icon, InstallBox, MarketingFooter, PatternTile, PricingCard, PricingGrid, PullQuote, ServiceCatalog, ShowcaseCard, SimpleGrid, Spacer, SplitSection, StatsGrid, StepFlow, TagCloud, TeamCard, Typography, VStack, getTileDimensions };