@moontra/moonui 2.4.4 → 2.4.6

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
@@ -10846,88 +10846,85 @@ var ScrollBar = t__namespace.forwardRef(({ className, orientation = "vertical",
10846
10846
  }
10847
10847
  ));
10848
10848
  ScrollBar.displayName = ScrollAreaScrollbar.displayName;
10849
- var defaultVariants = {
10850
- up: {
10851
- hidden: { opacity: 0, y: 50 },
10852
- visible: { opacity: 1, y: 0 }
10853
- },
10854
- down: {
10855
- hidden: { opacity: 0, y: -50 },
10856
- visible: { opacity: 1, y: 0 }
10857
- },
10858
- left: {
10859
- hidden: { opacity: 0, x: 50 },
10860
- visible: { opacity: 1, x: 0 }
10861
- },
10862
- right: {
10863
- hidden: { opacity: 0, x: -50 },
10864
- visible: { opacity: 1, x: 0 }
10865
- },
10866
- fade: {
10867
- hidden: { opacity: 0 },
10868
- visible: { opacity: 1 }
10869
- },
10870
- scale: {
10871
- hidden: { opacity: 0, scale: 0.8 },
10872
- visible: { opacity: 1, scale: 1 }
10873
- },
10874
- blur: {
10875
- hidden: { opacity: 0, filter: "blur(10px)" },
10876
- visible: { opacity: 1, filter: "blur(0px)" }
10877
- }
10849
+ var createDefaultVariants = (direction, distance) => {
10850
+ const baseVariants = {
10851
+ up: {
10852
+ hidden: { opacity: 0, y: distance },
10853
+ visible: { opacity: 1, y: 0 }
10854
+ },
10855
+ down: {
10856
+ hidden: { opacity: 0, y: -distance },
10857
+ visible: { opacity: 1, y: 0 }
10858
+ },
10859
+ left: {
10860
+ hidden: { opacity: 0, x: distance },
10861
+ visible: { opacity: 1, x: 0 }
10862
+ },
10863
+ right: {
10864
+ hidden: { opacity: 0, x: -distance },
10865
+ visible: { opacity: 1, x: 0 }
10866
+ },
10867
+ fade: {
10868
+ hidden: { opacity: 0 },
10869
+ visible: { opacity: 1 }
10870
+ },
10871
+ scale: {
10872
+ hidden: { opacity: 0, scale: 0.85 },
10873
+ visible: { opacity: 1, scale: 1 }
10874
+ },
10875
+ blur: {
10876
+ hidden: { opacity: 0, filter: "blur(10px)" },
10877
+ visible: { opacity: 1, filter: "blur(0px)" }
10878
+ }
10879
+ };
10880
+ return baseVariants[direction] || baseVariants.up;
10881
+ };
10882
+ var defaultTransition = {
10883
+ duration: 0.5,
10884
+ ease: [0.25, 0.46, 0.45, 0.94]
10885
+ // Custom cubic-bezier for smooth motion
10878
10886
  };
10879
10887
  var ScrollReveal = t__namespace.forwardRef(
10880
10888
  ({
10881
10889
  children,
10882
10890
  direction = "up",
10883
10891
  delay = 0,
10884
- duration = 0.6,
10892
+ duration = 0.5,
10885
10893
  distance = 50,
10886
- threshold = 0.1,
10887
- triggerOnce = true,
10894
+ threshold = 0.3,
10895
+ // Increased from 0.1 for better visibility
10896
+ once = true,
10897
+ triggerOnce,
10898
+ // Backward compatibility
10888
10899
  stagger = 0,
10889
10900
  className,
10890
10901
  variants,
10891
10902
  animate: animate2 = true,
10892
10903
  style,
10893
- id
10904
+ id,
10905
+ viewport
10894
10906
  }, ref) => {
10895
- const controls = framerMotion.useAnimation();
10896
- const elementRef = t__namespace.useRef(null);
10897
- const isInView = framerMotion.useInView(elementRef, {
10898
- amount: threshold,
10899
- once: triggerOnce
10900
- });
10901
- const customVariants = t__namespace.useMemo(() => {
10907
+ const shouldTriggerOnce = triggerOnce !== void 0 ? triggerOnce : once;
10908
+ const animationVariants = t__namespace.useMemo(() => {
10902
10909
  if (variants)
10903
10910
  return variants;
10904
- const baseVariants = defaultVariants[direction] || defaultVariants.up;
10905
- return {
10906
- hidden: {
10907
- ...baseVariants.hidden,
10908
- ...direction === "up" && { y: distance },
10909
- ...direction === "down" && { y: -distance },
10910
- ...direction === "left" && { x: distance },
10911
- ...direction === "right" && { x: -distance }
10912
- },
10913
- visible: baseVariants.visible
10914
- };
10911
+ return createDefaultVariants(direction, distance);
10915
10912
  }, [direction, distance, variants]);
10916
- t__namespace.useEffect(() => {
10917
- if (!animate2)
10918
- return;
10919
- if (isInView) {
10920
- controls.start("visible");
10921
- } else if (!triggerOnce) {
10922
- controls.start("hidden");
10923
- }
10924
- }, [isInView, controls, triggerOnce, animate2]);
10925
- t__namespace.useImperativeHandle(ref, () => elementRef.current);
10913
+ const transition = t__namespace.useMemo(() => ({
10914
+ ...defaultTransition,
10915
+ duration,
10916
+ delay: delay + stagger
10917
+ }), [duration, delay, stagger]);
10918
+ const viewportConfig = t__namespace.useMemo(() => ({
10919
+ once: shouldTriggerOnce,
10920
+ amount: threshold,
10921
+ ...viewport
10922
+ }), [shouldTriggerOnce, threshold, viewport]);
10926
10923
  if (!animate2) {
10927
10924
  return /* @__PURE__ */ jsxRuntime.jsx(
10928
10925
  "div",
10929
10926
  {
10930
- ref: elementRef,
10927
+ ref,
10931
10928
  className,
10932
10929
  style,
10933
10930
  id,
@@ -10938,15 +10935,12 @@ var ScrollReveal = t__namespace.forwardRef(
10938
10935
  return /* @__PURE__ */ jsxRuntime.jsx(
10939
10936
  framerMotion.motion.div,
10940
10937
  {
10941
- ref: elementRef,
10942
- variants: customVariants,
10938
+ ref,
10943
10939
  initial: "hidden",
10944
- animate: controls,
10945
- transition: {
10946
- duration,
10947
- delay: delay + stagger,
10948
- ease: "easeOut"
10949
- },
10940
+ whileInView: "visible",
10941
+ viewport: viewportConfig,
10942
+ variants: animationVariants,
10943
+ transition,
10950
10944
  className: cn(className),
10951
10945
  style,
10952
10946
  id,
@@ -10957,24 +10951,40 @@ var ScrollReveal = t__namespace.forwardRef(
10957
10951
  );
10958
10952
  ScrollReveal.displayName = "ScrollReveal";
10959
10953
  var ScrollRevealContainer = t__namespace.forwardRef(
10960
- ({ children, stagger = 0.1, className, style, id }, ref) => {
10961
- const containerRef = t__namespace.useRef(null);
10962
- const isInView = framerMotion.useInView(containerRef, { amount: 0.1, once: true });
10963
- t__namespace.useImperativeHandle(ref, () => containerRef.current);
10954
+ ({
10955
+ children,
10956
+ stagger = 0.1,
10957
+ className,
10958
+ style,
10959
+ id,
10960
+ threshold = 0.3,
10961
+ once = true,
10962
+ triggerOnce,
10963
+ viewport
10964
+ }, ref) => {
10965
+ const shouldTriggerOnce = triggerOnce !== void 0 ? triggerOnce : once;
10966
+ const viewportConfig = t__namespace.useMemo(() => ({
10967
+ once: shouldTriggerOnce,
10968
+ amount: threshold,
10969
+ ...viewport
10970
+ }), [shouldTriggerOnce, threshold, viewport]);
10971
+ const containerVariants = {
10972
+ hidden: {},
10973
+ visible: {
10974
+ transition: {
10975
+ staggerChildren: stagger,
10976
+ delayChildren: 0
10977
+ }
10978
+ }
10979
+ };
10964
10980
  return /* @__PURE__ */ jsxRuntime.jsx(
10965
10981
  framerMotion.motion.div,
10966
10982
  {
10967
- ref: containerRef,
10983
+ ref,
10968
10984
  initial: "hidden",
10969
- animate: isInView ? "visible" : "hidden",
10970
- variants: {
10971
- hidden: {},
10972
- visible: {
10973
- transition: {
10974
- staggerChildren: stagger
10975
- }
10976
- }
10977
- },
10985
+ whileInView: "visible",
10986
+ viewport: viewportConfig,
10987
+ variants: containerVariants,
10978
10988
  className: cn(className),
10979
10989
  style,
10980
10990
  id,
@@ -10988,37 +10998,28 @@ var ScrollRevealItem = t__namespace.forwardRef(
10988
10998
  ({
10989
10999
  children,
10990
11000
  direction = "up",
10991
- duration = 0.6,
11001
+ duration = 0.5,
10992
11002
  distance = 50,
10993
11003
  className,
10994
11004
  variants,
10995
11005
  style,
10996
11006
  id
10997
11007
  }, ref) => {
10998
- const customVariants = t__namespace.useMemo(() => {
11008
+ const animationVariants = t__namespace.useMemo(() => {
10999
11009
  if (variants)
11000
11010
  return variants;
11001
- const baseVariants = defaultVariants[direction] || defaultVariants.up;
11002
- return {
11003
- hidden: {
11004
- ...baseVariants.hidden,
11005
- ...direction === "up" && { y: distance },
11006
- ...direction === "down" && { y: -distance },
11007
- ...direction === "left" && { x: distance },
11008
- ...direction === "right" && { x: -distance }
11009
- },
11010
- visible: baseVariants.visible
11011
- };
11011
+ return createDefaultVariants(direction, distance);
11012
11012
  }, [direction, distance, variants]);
11013
+ const transition = t__namespace.useMemo(() => ({
11014
+ ...defaultTransition,
11015
+ duration
11016
+ }), [duration]);
11013
11017
  return /* @__PURE__ */ jsxRuntime.jsx(
11014
11018
  framerMotion.motion.div,
11015
11019
  {
11016
11020
  ref,
11017
- variants: customVariants,
11018
- transition: {
11019
- duration,
11020
- ease: "easeOut"
11021
- },
11021
+ variants: animationVariants,
11022
+ transition,
11022
11023
  className: cn(className),
11023
11024
  style,
11024
11025
  id,