@moontra/moonui 2.4.5 → 2.4.7

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.mjs CHANGED
@@ -10,7 +10,7 @@ import { twMerge } from 'tailwind-merge';
10
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
11
  import { cva } from 'class-variance-authority';
12
12
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
13
- import { motion, AnimatePresence, useMotionValue, useTransform, useAnimation, useInView, animate } from 'framer-motion';
13
+ import { motion, AnimatePresence, useMotionValue, useTransform, animate } from 'framer-motion';
14
14
  import { format, isSameMonth, isToday, isValid, subMonths, addMonths, isSameDay, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek } from 'date-fns';
15
15
  export { format } from 'date-fns';
16
16
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
@@ -10814,88 +10814,85 @@ var ScrollBar = t.forwardRef(({ className, orientation = "vertical", ...props },
10814
10814
  }
10815
10815
  ));
10816
10816
  ScrollBar.displayName = ScrollAreaScrollbar.displayName;
10817
- var defaultVariants = {
10818
- up: {
10819
- hidden: { opacity: 0, y: 50 },
10820
- visible: { opacity: 1, y: 0 }
10821
- },
10822
- down: {
10823
- hidden: { opacity: 0, y: -50 },
10824
- visible: { opacity: 1, y: 0 }
10825
- },
10826
- left: {
10827
- hidden: { opacity: 0, x: 50 },
10828
- visible: { opacity: 1, x: 0 }
10829
- },
10830
- right: {
10831
- hidden: { opacity: 0, x: -50 },
10832
- visible: { opacity: 1, x: 0 }
10833
- },
10834
- fade: {
10835
- hidden: { opacity: 0 },
10836
- visible: { opacity: 1 }
10837
- },
10838
- scale: {
10839
- hidden: { opacity: 0, scale: 0.8 },
10840
- visible: { opacity: 1, scale: 1 }
10841
- },
10842
- blur: {
10843
- hidden: { opacity: 0, filter: "blur(10px)" },
10844
- visible: { opacity: 1, filter: "blur(0px)" }
10845
- }
10817
+ var createDefaultVariants = (direction, distance) => {
10818
+ const baseVariants = {
10819
+ up: {
10820
+ hidden: { opacity: 0, y: distance },
10821
+ visible: { opacity: 1, y: 0 }
10822
+ },
10823
+ down: {
10824
+ hidden: { opacity: 0, y: -distance },
10825
+ visible: { opacity: 1, y: 0 }
10826
+ },
10827
+ left: {
10828
+ hidden: { opacity: 0, x: distance },
10829
+ visible: { opacity: 1, x: 0 }
10830
+ },
10831
+ right: {
10832
+ hidden: { opacity: 0, x: -distance },
10833
+ visible: { opacity: 1, x: 0 }
10834
+ },
10835
+ fade: {
10836
+ hidden: { opacity: 0 },
10837
+ visible: { opacity: 1 }
10838
+ },
10839
+ scale: {
10840
+ hidden: { opacity: 0, scale: 0.85 },
10841
+ visible: { opacity: 1, scale: 1 }
10842
+ },
10843
+ blur: {
10844
+ hidden: { opacity: 0, filter: "blur(10px)" },
10845
+ visible: { opacity: 1, filter: "blur(0px)" }
10846
+ }
10847
+ };
10848
+ return baseVariants[direction] || baseVariants.up;
10849
+ };
10850
+ var defaultTransition = {
10851
+ duration: 0.5,
10852
+ ease: [0.25, 0.46, 0.45, 0.94]
10853
+ // Custom cubic-bezier for smooth motion
10846
10854
  };
10847
10855
  var ScrollReveal = t.forwardRef(
10848
10856
  ({
10849
10857
  children,
10850
10858
  direction = "up",
10851
10859
  delay = 0,
10852
- duration = 0.6,
10860
+ duration = 0.5,
10853
10861
  distance = 50,
10854
- threshold = 0.1,
10855
- triggerOnce = true,
10862
+ threshold = 0.3,
10863
+ // Increased from 0.1 for better visibility
10864
+ once = true,
10865
+ triggerOnce,
10866
+ // Backward compatibility
10856
10867
  stagger = 0,
10857
10868
  className,
10858
10869
  variants,
10859
10870
  animate: animate2 = true,
10860
10871
  style,
10861
- id
10872
+ id,
10873
+ viewport
10862
10874
  }, ref) => {
10863
- const controls = useAnimation();
10864
- const elementRef = t.useRef(null);
10865
- const isInView = useInView(elementRef, {
10866
- amount: threshold,
10867
- once: triggerOnce
10868
- });
10869
- const customVariants = t.useMemo(() => {
10875
+ const shouldTriggerOnce = triggerOnce !== void 0 ? triggerOnce : once;
10876
+ const animationVariants = t.useMemo(() => {
10870
10877
  if (variants)
10871
10878
  return variants;
10872
- const baseVariants = defaultVariants[direction] || defaultVariants.up;
10873
- return {
10874
- hidden: {
10875
- ...baseVariants.hidden,
10876
- ...direction === "up" && { y: distance },
10877
- ...direction === "down" && { y: -distance },
10878
- ...direction === "left" && { x: distance },
10879
- ...direction === "right" && { x: -distance }
10880
- },
10881
- visible: baseVariants.visible
10882
- };
10879
+ return createDefaultVariants(direction, distance);
10883
10880
  }, [direction, distance, variants]);
10884
- t.useEffect(() => {
10885
- if (!animate2)
10886
- return;
10887
- if (isInView) {
10888
- controls.start("visible");
10889
- } else if (!triggerOnce) {
10890
- controls.start("hidden");
10891
- }
10892
- }, [isInView, controls, triggerOnce, animate2]);
10893
- t.useImperativeHandle(ref, () => elementRef.current);
10881
+ const transition = t.useMemo(() => ({
10882
+ ...defaultTransition,
10883
+ duration,
10884
+ delay: delay + stagger
10885
+ }), [duration, delay, stagger]);
10886
+ const viewportConfig = t.useMemo(() => ({
10887
+ once: shouldTriggerOnce,
10888
+ amount: threshold,
10889
+ ...viewport
10890
+ }), [shouldTriggerOnce, threshold, viewport]);
10894
10891
  if (!animate2) {
10895
10892
  return /* @__PURE__ */ jsx(
10896
10893
  "div",
10897
10894
  {
10898
- ref: elementRef,
10895
+ ref,
10899
10896
  className,
10900
10897
  style,
10901
10898
  id,
@@ -10906,15 +10903,12 @@ var ScrollReveal = t.forwardRef(
10906
10903
  return /* @__PURE__ */ jsx(
10907
10904
  motion.div,
10908
10905
  {
10909
- ref: elementRef,
10910
- variants: customVariants,
10906
+ ref,
10911
10907
  initial: "hidden",
10912
- animate: controls,
10913
- transition: {
10914
- duration,
10915
- delay: delay + stagger,
10916
- ease: "easeOut"
10917
- },
10908
+ whileInView: "visible",
10909
+ viewport: viewportConfig,
10910
+ variants: animationVariants,
10911
+ transition,
10918
10912
  className: cn(className),
10919
10913
  style,
10920
10914
  id,
@@ -10925,24 +10919,40 @@ var ScrollReveal = t.forwardRef(
10925
10919
  );
10926
10920
  ScrollReveal.displayName = "ScrollReveal";
10927
10921
  var ScrollRevealContainer = t.forwardRef(
10928
- ({ children, stagger = 0.1, className, style, id }, ref) => {
10929
- const containerRef = t.useRef(null);
10930
- const isInView = useInView(containerRef, { amount: 0.1, once: true });
10931
- t.useImperativeHandle(ref, () => containerRef.current);
10922
+ ({
10923
+ children,
10924
+ stagger = 0.1,
10925
+ className,
10926
+ style,
10927
+ id,
10928
+ threshold = 0.3,
10929
+ once = true,
10930
+ triggerOnce,
10931
+ viewport
10932
+ }, ref) => {
10933
+ const shouldTriggerOnce = triggerOnce !== void 0 ? triggerOnce : once;
10934
+ const viewportConfig = t.useMemo(() => ({
10935
+ once: shouldTriggerOnce,
10936
+ amount: threshold,
10937
+ ...viewport
10938
+ }), [shouldTriggerOnce, threshold, viewport]);
10939
+ const containerVariants = {
10940
+ hidden: {},
10941
+ visible: {
10942
+ transition: {
10943
+ staggerChildren: stagger,
10944
+ delayChildren: 0
10945
+ }
10946
+ }
10947
+ };
10932
10948
  return /* @__PURE__ */ jsx(
10933
10949
  motion.div,
10934
10950
  {
10935
- ref: containerRef,
10951
+ ref,
10936
10952
  initial: "hidden",
10937
- animate: isInView ? "visible" : "hidden",
10938
- variants: {
10939
- hidden: {},
10940
- visible: {
10941
- transition: {
10942
- staggerChildren: stagger
10943
- }
10944
- }
10945
- },
10953
+ whileInView: "visible",
10954
+ viewport: viewportConfig,
10955
+ variants: containerVariants,
10946
10956
  className: cn(className),
10947
10957
  style,
10948
10958
  id,
@@ -10956,37 +10966,28 @@ var ScrollRevealItem = t.forwardRef(
10956
10966
  ({
10957
10967
  children,
10958
10968
  direction = "up",
10959
- duration = 0.6,
10969
+ duration = 0.5,
10960
10970
  distance = 50,
10961
10971
  className,
10962
10972
  variants,
10963
10973
  style,
10964
10974
  id
10965
10975
  }, ref) => {
10966
- const customVariants = t.useMemo(() => {
10976
+ const animationVariants = t.useMemo(() => {
10967
10977
  if (variants)
10968
10978
  return variants;
10969
- const baseVariants = defaultVariants[direction] || defaultVariants.up;
10970
- return {
10971
- hidden: {
10972
- ...baseVariants.hidden,
10973
- ...direction === "up" && { y: distance },
10974
- ...direction === "down" && { y: -distance },
10975
- ...direction === "left" && { x: distance },
10976
- ...direction === "right" && { x: -distance }
10977
- },
10978
- visible: baseVariants.visible
10979
- };
10979
+ return createDefaultVariants(direction, distance);
10980
10980
  }, [direction, distance, variants]);
10981
+ const transition = t.useMemo(() => ({
10982
+ ...defaultTransition,
10983
+ duration
10984
+ }), [duration]);
10981
10985
  return /* @__PURE__ */ jsx(
10982
10986
  motion.div,
10983
10987
  {
10984
10988
  ref,
10985
- variants: customVariants,
10986
- transition: {
10987
- duration,
10988
- ease: "easeOut"
10989
- },
10989
+ variants: animationVariants,
10990
+ transition,
10990
10991
  className: cn(className),
10991
10992
  style,
10992
10993
  id,
@@ -12307,7 +12308,7 @@ var TagsInput = t.forwardRef(
12307
12308
  "div",
12308
12309
  {
12309
12310
  className: cn(
12310
- "flex min-h-[2.5rem] w-full flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
12311
+ "flex items-center min-h-[2.5rem] w-full flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
12311
12312
  "dark:bg-zinc-950/50 dark:border-zinc-800",
12312
12313
  "focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
12313
12314
  disabled && "cursor-not-allowed opacity-50",