@zentauri-ui/zentauri-components 1.8.4 → 1.8.42

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.
Files changed (118) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +73 -63
  4. package/dist/animations/blur-in.js +2 -2
  5. package/dist/animations/blur-in.mjs +1 -1
  6. package/dist/animations/blur-out.js +2 -2
  7. package/dist/animations/blur-out.mjs +1 -1
  8. package/dist/animations/bounce.js +2 -2
  9. package/dist/animations/bounce.mjs +1 -1
  10. package/dist/animations/fade-down.js +2 -2
  11. package/dist/animations/fade-down.mjs +1 -1
  12. package/dist/animations/fade-in.js +2 -2
  13. package/dist/animations/fade-in.mjs +1 -1
  14. package/dist/animations/fade-left.js +2 -2
  15. package/dist/animations/fade-left.mjs +1 -1
  16. package/dist/animations/fade-out.js +2 -2
  17. package/dist/animations/fade-out.mjs +1 -1
  18. package/dist/animations/fade-right.js +2 -2
  19. package/dist/animations/fade-right.mjs +1 -1
  20. package/dist/animations/fade-up.js +2 -2
  21. package/dist/animations/fade-up.mjs +1 -1
  22. package/dist/animations/flip-in.js +2 -2
  23. package/dist/animations/flip-in.mjs +1 -1
  24. package/dist/animations/flip.js +2 -2
  25. package/dist/animations/flip.mjs +1 -1
  26. package/dist/animations/float.js +2 -2
  27. package/dist/animations/float.mjs +1 -1
  28. package/dist/animations/hover-lift.js +2 -2
  29. package/dist/animations/hover-lift.mjs +1 -1
  30. package/dist/animations/hover-scale.js +2 -2
  31. package/dist/animations/hover-scale.mjs +1 -1
  32. package/dist/animations/magnetic.js +2 -2
  33. package/dist/animations/magnetic.mjs +1 -1
  34. package/dist/animations/parallax.js +2 -2
  35. package/dist/animations/parallax.mjs +1 -1
  36. package/dist/animations/ping.js +2 -2
  37. package/dist/animations/ping.mjs +1 -1
  38. package/dist/animations/pop-in.js +2 -2
  39. package/dist/animations/pop-in.mjs +1 -1
  40. package/dist/animations/press.js +2 -2
  41. package/dist/animations/press.mjs +1 -1
  42. package/dist/animations/progress.js +2 -2
  43. package/dist/animations/progress.mjs +1 -1
  44. package/dist/animations/pulse.js +2 -2
  45. package/dist/animations/pulse.mjs +1 -1
  46. package/dist/animations/reorder.js +2 -2
  47. package/dist/animations/reorder.mjs +1 -1
  48. package/dist/animations/reveal-blur.js +2 -2
  49. package/dist/animations/reveal-blur.mjs +1 -1
  50. package/dist/animations/reveal-down.js +2 -2
  51. package/dist/animations/reveal-down.mjs +1 -1
  52. package/dist/animations/reveal-left.js +2 -2
  53. package/dist/animations/reveal-left.mjs +1 -1
  54. package/dist/animations/reveal-right.js +2 -2
  55. package/dist/animations/reveal-right.mjs +1 -1
  56. package/dist/animations/reveal-up.js +2 -2
  57. package/dist/animations/reveal-up.mjs +1 -1
  58. package/dist/animations/rotate-in.js +2 -2
  59. package/dist/animations/rotate-in.mjs +1 -1
  60. package/dist/animations/scale-in.js +2 -2
  61. package/dist/animations/scale-in.mjs +1 -1
  62. package/dist/animations/scale-out.js +2 -2
  63. package/dist/animations/scale-out.mjs +1 -1
  64. package/dist/animations/shake.js +2 -2
  65. package/dist/animations/shake.mjs +1 -1
  66. package/dist/animations/shared/create-motion-animation.d.ts.map +1 -1
  67. package/dist/animations/shared/index.d.ts +1 -1
  68. package/dist/animations/shared/index.d.ts.map +1 -1
  69. package/dist/animations/shared/types.d.ts +3 -1
  70. package/dist/animations/shared/types.d.ts.map +1 -1
  71. package/dist/animations/skeleton-shimmer.js +2 -2
  72. package/dist/animations/skeleton-shimmer.mjs +1 -1
  73. package/dist/animations/slide-down.js +2 -2
  74. package/dist/animations/slide-down.mjs +1 -1
  75. package/dist/animations/slide-left.js +2 -2
  76. package/dist/animations/slide-left.mjs +1 -1
  77. package/dist/animations/slide-right.js +2 -2
  78. package/dist/animations/slide-right.mjs +1 -1
  79. package/dist/animations/slide-up.js +2 -2
  80. package/dist/animations/slide-up.mjs +1 -1
  81. package/dist/animations/spin.js +2 -2
  82. package/dist/animations/spin.mjs +1 -1
  83. package/dist/animations/text-reveal.js +2 -2
  84. package/dist/animations/text-reveal.mjs +1 -1
  85. package/dist/animations/text-shimmer.js +2 -2
  86. package/dist/animations/text-shimmer.mjs +1 -1
  87. package/dist/animations/tilt.js +2 -2
  88. package/dist/animations/tilt.mjs +1 -1
  89. package/dist/animations/wiggle.js +2 -2
  90. package/dist/animations/wiggle.mjs +1 -1
  91. package/dist/{chunk-AACGI7FX.mjs → chunk-7OVJXYSS.mjs} +16 -5
  92. package/dist/chunk-7OVJXYSS.mjs.map +1 -0
  93. package/dist/{chunk-VARQ7W4G.mjs → chunk-C6NA452Q.mjs} +43 -2
  94. package/dist/chunk-C6NA452Q.mjs.map +1 -0
  95. package/dist/{chunk-JFS5PJSH.js → chunk-OKCC7E36.js} +43 -2
  96. package/dist/chunk-OKCC7E36.js.map +1 -0
  97. package/dist/{chunk-ODZM25II.js → chunk-R5LL56ZO.js} +16 -5
  98. package/dist/chunk-R5LL56ZO.js.map +1 -0
  99. package/dist/ui/buttons/button-base.d.ts +1 -1
  100. package/dist/ui/buttons/button-base.d.ts.map +1 -1
  101. package/dist/ui/buttons/types.d.ts +16 -2
  102. package/dist/ui/buttons/types.d.ts.map +1 -1
  103. package/dist/ui/buttons.js +2 -2
  104. package/dist/ui/buttons.mjs +1 -1
  105. package/dist/ui/dynamic-stepper.js +3 -3
  106. package/dist/ui/dynamic-stepper.mjs +1 -1
  107. package/package.json +30 -1
  108. package/src/animations/animations.test.tsx +113 -1
  109. package/src/animations/shared/create-motion-animation.tsx +33 -3
  110. package/src/animations/shared/index.ts +5 -1
  111. package/src/animations/shared/types.ts +9 -1
  112. package/src/ui/buttons/button-base.tsx +53 -0
  113. package/src/ui/buttons/button.test.tsx +40 -0
  114. package/src/ui/buttons/types.ts +25 -2
  115. package/dist/chunk-AACGI7FX.mjs.map +0 -1
  116. package/dist/chunk-JFS5PJSH.js.map +0 -1
  117. package/dist/chunk-ODZM25II.js.map +0 -1
  118. package/dist/chunk-VARQ7W4G.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkODZM25II_js = require('../chunk-ODZM25II.js');
3
+ var chunkR5LL56ZO_js = require('../chunk-R5LL56ZO.js');
4
4
  require('../chunk-ZS5756ZC.js');
5
5
 
6
6
  // src/animations/tilt/presets.ts
@@ -16,7 +16,7 @@ var tiltPreset = {
16
16
  };
17
17
 
18
18
  // src/animations/tilt/tilt.tsx
19
- var Tilt = chunkODZM25II_js.createMotionAnimation("Tilt", "animation-tilt", tiltPreset);
19
+ var Tilt = chunkR5LL56ZO_js.createMotionAnimation("Tilt", "animation-tilt", tiltPreset);
20
20
 
21
21
  exports.Tilt = Tilt;
22
22
  exports.tiltPreset = tiltPreset;
@@ -1,4 +1,4 @@
1
- import { createMotionAnimation } from '../chunk-AACGI7FX.mjs';
1
+ import { createMotionAnimation } from '../chunk-7OVJXYSS.mjs';
2
2
  import '../chunk-4D54YOL6.mjs';
3
3
 
4
4
  // src/animations/tilt/presets.ts
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkODZM25II_js = require('../chunk-ODZM25II.js');
3
+ var chunkR5LL56ZO_js = require('../chunk-R5LL56ZO.js');
4
4
  require('../chunk-ZS5756ZC.js');
5
5
 
6
6
  // src/animations/wiggle/presets.ts
@@ -17,7 +17,7 @@ var wigglePreset = {
17
17
  };
18
18
 
19
19
  // src/animations/wiggle/wiggle.tsx
20
- var Wiggle = chunkODZM25II_js.createMotionAnimation(
20
+ var Wiggle = chunkR5LL56ZO_js.createMotionAnimation(
21
21
  "Wiggle",
22
22
  "animation-wiggle",
23
23
  wigglePreset
@@ -1,4 +1,4 @@
1
- import { createMotionAnimation } from '../chunk-AACGI7FX.mjs';
1
+ import { createMotionAnimation } from '../chunk-7OVJXYSS.mjs';
2
2
  import '../chunk-4D54YOL6.mjs';
3
3
 
4
4
  // src/animations/wiggle/presets.ts
@@ -19,6 +19,9 @@ function mergeTargetOverrides(target, overrides) {
19
19
  ...blur === void 0 ? null : { filter: formatBlurValue(blur) }
20
20
  };
21
21
  }
22
+ function isTargetObject(target) {
23
+ return target !== null && typeof target === "object" && !Array.isArray(target);
24
+ }
22
25
  function createMotionAnimation(displayName, slot, preset) {
23
26
  function MotionAnimation(props) {
24
27
  const {
@@ -30,6 +33,7 @@ function createMotionAnimation(displayName, slot, preset) {
30
33
  transition,
31
34
  layout,
32
35
  whileHover,
36
+ whileInView,
33
37
  whileTap,
34
38
  from,
35
39
  to,
@@ -37,20 +41,27 @@ function createMotionAnimation(displayName, slot, preset) {
37
41
  ...rest
38
42
  } = props;
39
43
  const shouldReduceMotion = useReducedMotion();
40
- const resolvedAnimate = animate ?? mergeTargetOverrides(preset.animate, to);
41
- const resolvedInitial = initial ?? (shouldReduceMotion ? resolvedAnimate : mergeTargetOverrides(preset.initial, from));
44
+ const resolvedAnimateTarget = mergeTargetOverrides(preset.animate, to);
45
+ const resolvedAnimate = animate ?? resolvedAnimateTarget;
46
+ const shouldAnimateInView = whileInView !== void 0;
47
+ const usesPresetWhileInView = whileInView === true;
48
+ const resolvedWhileInView = whileInView === void 0 ? void 0 : usesPresetWhileInView ? resolvedAnimateTarget : isTargetObject(whileInView) ? { ...resolvedAnimateTarget, ...whileInView } : whileInView;
49
+ const reducedMotionTarget = shouldAnimateInView ? resolvedWhileInView : resolvedAnimate;
50
+ const resolvedInitial = initial ?? (shouldReduceMotion ? reducedMotionTarget : mergeTargetOverrides(preset.initial, from));
42
51
  const resolvedExit = exit ?? mergeTargetOverrides(preset.exit, exitTo);
43
52
  const resolvedTransition = transition ? { ...preset.transition, ...transition } : preset.transition;
53
+ const shouldDisableAnimate = usesPresetWhileInView || shouldReduceMotion && shouldAnimateInView;
44
54
  return /* @__PURE__ */ jsx(
45
55
  motion.div,
46
56
  {
47
57
  "data-slot": slot,
48
58
  className: cn(className),
49
59
  initial: resolvedInitial,
50
- animate: resolvedAnimate,
60
+ animate: shouldDisableAnimate ? void 0 : resolvedAnimate,
51
61
  exit: resolvedExit,
52
62
  layout: layout ?? preset.layout,
53
63
  whileHover: whileHover ?? preset.whileHover,
64
+ whileInView: shouldReduceMotion ? void 0 : shouldAnimateInView ? resolvedWhileInView : void 0,
54
65
  whileTap: whileTap ?? preset.whileTap,
55
66
  transition: resolvedTransition,
56
67
  ...rest,
@@ -63,5 +74,5 @@ function createMotionAnimation(displayName, slot, preset) {
63
74
  }
64
75
 
65
76
  export { createMotionAnimation };
66
- //# sourceMappingURL=chunk-AACGI7FX.mjs.map
67
- //# sourceMappingURL=chunk-AACGI7FX.mjs.map
77
+ //# sourceMappingURL=chunk-7OVJXYSS.mjs.map
78
+ //# sourceMappingURL=chunk-7OVJXYSS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/animations/shared/create-motion-animation.tsx"],"names":[],"mappings":";;;;AAYA,SAAS,gBAAgB,KAAA,EAAwB;AAC/C,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,QAAQ,KAAK,CAAA,GAAA,CAAA;AAAA,EACtB;AACA,EAAA,OAAO,MAAM,QAAA,CAAS,GAAG,CAAA,GAAI,KAAA,GAAQ,QAAQ,KAAK,CAAA,CAAA,CAAA;AACpD;AAEA,SAAS,oBAAA,CACP,QACA,SAAA,EACA;AACA,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,EAAE,IAAA,EAAM,GAAG,IAAA,EAAK,GAAI,SAAA;AAC1B,EAAA,OAAO;AAAA,IACL,GAAI,UAAU,EAAC;AAAA,IACf,GAAG,IAAA;AAAA,IACH,GAAI,SAAS,MAAA,GAAY,IAAA,GAAO,EAAE,MAAA,EAAQ,eAAA,CAAgB,IAAI,CAAA;AAAE,GAClE;AACF;AAEA,SAAS,eACP,MAAA,EAC4C;AAC5C,EAAA,OAAO,MAAA,KAAW,QAAQ,OAAO,MAAA,KAAW,YAAY,CAAC,KAAA,C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0B,kBAAA,IAAsB,mBAAA;AAElD,IAAA,uBACE,GAAA;AAAA,MAAC,MAAA,CAAO,GAAA;AAAA,MAAP;AAAA,QACC,WAAA,EAAW,IAAA;AAAA,QACX,SAAA,EAAW,GAAG,SAAS,CAAA;AAAA,QACvB,OAAA,EAAS,eAAA;AAAA,QACT,OAAA,EAAS,uBAAuB,MAAA,GAAY,eAAA;AAAA,QAC5C,IAAA,EAAM,YAAA;AAAA,QACN,MAAA,EAAQ,UAAU,MAAA,CAAO,MAAA;AAAA,QACzB,UAAA,EAAY,cAAc,MAAA,CAAO,UAAA;AAAA,QACjC,WAAA,EACE,kBAAA,GACI,MAAA,GACA,mBAAA,GACE,mBAAA,GACA,MAAA;AAAA,QAER,QAAA,EAAU,YAAY,MAAA,CAAO,QAAA;AAAA,QAC7B,UAAA,EAAY,kBAAA;AAAA,QACX,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,eAAA,CAAgB,WAAA,GAAc,WAAA;AAC9B,EAAA,OAAO,eAAA;AACT","file":"chunk-7OVJXYSS.mjs","sourcesContent":["\"use client\";\n\nimport { motion, useReducedMotion } from \"framer-motion\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type {\n MotionAnimationPreset,\n MotionAnimationProps,\n MotionAnimationTargetOverrides,\n} from \"./types\";\n\nfunction formatBlurValue(value: number | string) {\n if (typeof value === \"number\") {\n return `blur(${value}px)`;\n }\n return value.includes(\"(\") ? value : `blur(${value})`;\n}\n\nfunction mergeTargetOverrides(\n target: MotionAnimationPreset[\"initial\"] | undefined,\n overrides: MotionAnimationTargetOverrides | undefined,\n) {\n if (!overrides) {\n return target;\n }\n\n const { blur, ...rest } = overrides;\n return {\n ...(target ?? {}),\n ...rest,\n ...(blur === undefined ? null : { filter: formatBlurValue(blur) }),\n };\n}\n\nfunction isTargetObject(\n target: NonNullable<MotionAnimationProps[\"whileInView\"]>,\n): target is MotionAnimationPreset[\"animate\"] {\n return target !== null && typeof target === \"object\" && !Array.isArray(target);\n}\n\nexport function createMotionAnimation(\n displayName: string,\n slot: string,\n preset: MotionAnimationPreset,\n) {\n function MotionAnimation(props: MotionAnimationProps) {\n const {\n children,\n className,\n initial,\n animate,\n exit,\n transition,\n layout,\n whileHover,\n whileInView,\n whileTap,\n from,\n to,\n exitTo,\n ...rest\n } = props;\n const shouldReduceMotion = useReducedMotion();\n const resolvedAnimateTarget = mergeTargetOverrides(preset.animate, to);\n const resolvedAnimate = animate ?? resolvedAnimateTarget;\n const shouldAnimateInView = whileInView !== undefined;\n const usesPresetWhileInView = whileInView === true;\n const resolvedWhileInView =\n whileInView === undefined\n ? undefined\n : usesPresetWhileInView\n ? resolvedAnimateTarget\n : isTargetObject(whileInView)\n ? { ...resolvedAnimateTarget, ...whileInView }\n : whileInView;\n const reducedMotionTarget = shouldAnimateInView\n ? resolvedWhileInView\n : resolvedAnimate;\n const resolvedInitial =\n initial ??\n (shouldReduceMotion\n ? reducedMotionTarget\n : mergeTargetOverrides(preset.initial, from));\n const resolvedExit = exit ?? mergeTargetOverrides(preset.exit, exitTo);\n const resolvedTransition = transition\n ? { ...preset.transition, ...transition }\n : preset.transition;\n const shouldDisableAnimate =\n usesPresetWhileInView || (shouldReduceMotion && shouldAnimateInView);\n\n return (\n <motion.div\n data-slot={slot}\n className={cn(className)}\n initial={resolvedInitial}\n animate={shouldDisableAnimate ? undefined : resolvedAnimate}\n exit={resolvedExit}\n layout={layout ?? preset.layout}\n whileHover={whileHover ?? preset.whileHover}\n whileInView={\n shouldReduceMotion\n ? undefined\n : shouldAnimateInView\n ? resolvedWhileInView\n : undefined\n }\n whileTap={whileTap ?? preset.whileTap}\n transition={resolvedTransition}\n {...rest}\n >\n {children}\n </motion.div>\n );\n }\n\n MotionAnimation.displayName = displayName;\n return MotionAnimation;\n}\n"]}
@@ -1,8 +1,49 @@
1
1
  import { buttonVariants } from './chunk-CIEZFHCO.mjs';
2
2
  import { cn } from './chunk-4D54YOL6.mjs';
3
+ import { isValidElement, cloneElement } from 'react';
3
4
  import { jsx } from 'react/jsx-runtime';
4
5
 
5
6
  var ButtonBase = (props) => {
7
+ if ("asChild" in props && props.asChild) {
8
+ const {
9
+ className: className2,
10
+ appearance: appearance2,
11
+ size: size2,
12
+ children: children2,
13
+ asChild: _asChild,
14
+ disabled,
15
+ onClick,
16
+ ...rest2
17
+ } = props;
18
+ if (!isValidElement(children2)) {
19
+ return null;
20
+ }
21
+ const isNativeButton = children2.type === "button";
22
+ const childOnClick = children2.props.onClick;
23
+ const handleClick = (event) => {
24
+ if (disabled) {
25
+ event.preventDefault();
26
+ event.stopPropagation();
27
+ return;
28
+ }
29
+ onClick?.(event);
30
+ if (!event.defaultPrevented) {
31
+ childOnClick?.(event);
32
+ }
33
+ };
34
+ return cloneElement(children2, {
35
+ ...rest2,
36
+ ...children2.props,
37
+ ...disabled ? isNativeButton ? { disabled: true } : { "aria-disabled": true, tabIndex: -1 } : null,
38
+ "data-slot": "button",
39
+ onClick: handleClick,
40
+ className: cn(
41
+ buttonVariants({ appearance: appearance2, size: size2 }),
42
+ children2.props.className,
43
+ className2
44
+ )
45
+ });
46
+ }
6
47
  if (props.as === "link") {
7
48
  const {
8
49
  className: className2,
@@ -56,5 +97,5 @@ var Button = (props) => {
56
97
  Button.displayName = "Button";
57
98
 
58
99
  export { Button };
59
- //# sourceMappingURL=chunk-VARQ7W4G.mjs.map
60
- //# sourceMappingURL=chunk-VARQ7W4G.mjs.map
100
+ //# sourceMappingURL=chunk-C6NA452Q.mjs.map
101
+ //# sourceMappingURL=chunk-C6NA452Q.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/buttons/button-base.tsx","../src/ui/buttons/button.tsx"],"names":["className","appearance","size","children","rest","ref","jsx"],"mappings":";;;;;AASO,IAAM,UAAA,GAAa,CAAC,KAAA,KAAuB;AAChD,EAAA,IAAI,SAAA,IAAa,KAAA,IAAS,KAAA,CAAM,OAAA,EAAS;AACvC,IAAA,MA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IAAM,MAAA,GAAS,CAAC,KAAA,KAAuB;AAC5C,EAAA,uBAAOG,GAAAA,CAAC,UAAA,EAAA,EAAY,GAAG,KAAA,EAAO,CAAA;AAChC;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-C6NA452Q.mjs","sourcesContent":["\"use client\";\n\nimport { cloneElement, isValidElement, type MouseEventHandler } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { ButtonProps } from \"./types\";\nimport { buttonVariants } from \"./variants\";\n\nexport const ButtonBase = (props: ButtonProps) => {\n if (\"asChild\" in props && props.asChild) {\n const {\n className,\n appearance,\n size,\n children,\n asChild: _asChild,\n disabled,\n onClick,\n ...rest\n } = props;\n\n if (!isValidElement<{ className?: string }>(children)) {\n return null;\n }\n\n const isNativeButton = children.type === \"button\";\n const childOnClick = children.props.onClick as\n | MouseEventHandler<HTMLElement>\n | undefined;\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n if (!event.defaultPrevented) {\n childOnClick?.(event);\n }\n };\n\n return cloneElement(children, {\n ...rest,\n ...children.props,\n ...(disabled\n ? isNativeButton\n ? { disabled: true }\n : { \"aria-disabled\": true, tabIndex: -1 }\n : null),\n \"data-slot\": \"button\",\n onClick: handleClick,\n className: cn(\n buttonVariants({ appearance, size }),\n children.props.className,\n className,\n ),\n });\n }\n\n if (props.as === \"link\") {\n const {\n className,\n appearance,\n size,\n children,\n ref,\n href,\n target,\n ...rest\n } = props;\n\n return (\n <a\n ref={ref}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n data-slot=\"button\"\n className={cn(buttonVariants({ appearance, size }), className)}\n {...rest}\n >\n {children}\n </a>\n );\n }\n\n const {\n className,\n appearance,\n size,\n type = \"button\",\n children,\n ref,\n ...rest\n } = props;\n\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"button\"\n className={cn(buttonVariants({ appearance, size }), className)}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nButtonBase.displayName = \"Button\";\n","// button.tsx — default static entry (no framer-motion)\nimport { ButtonBase } from \"./button-base\";\nimport type { ButtonProps } from \"./types\";\n\nexport const Button = (props: ButtonProps) => {\n return <ButtonBase {...props} />;\n};\n\nButton.displayName = \"Button\";\n"]}
@@ -2,9 +2,50 @@
2
2
 
3
3
  var chunk466QDL44_js = require('./chunk-466QDL44.js');
4
4
  var chunkZS5756ZC_js = require('./chunk-ZS5756ZC.js');
5
+ var react = require('react');
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
7
 
7
8
  var ButtonBase = (props) => {
9
+ if ("asChild" in props && props.asChild) {
10
+ const {
11
+ className: className2,
12
+ appearance: appearance2,
13
+ size: size2,
14
+ children: children2,
15
+ asChild: _asChild,
16
+ disabled,
17
+ onClick,
18
+ ...rest2
19
+ } = props;
20
+ if (!react.isValidElement(children2)) {
21
+ return null;
22
+ }
23
+ const isNativeButton = children2.type === "button";
24
+ const childOnClick = children2.props.onClick;
25
+ const handleClick = (event) => {
26
+ if (disabled) {
27
+ event.preventDefault();
28
+ event.stopPropagation();
29
+ return;
30
+ }
31
+ onClick?.(event);
32
+ if (!event.defaultPrevented) {
33
+ childOnClick?.(event);
34
+ }
35
+ };
36
+ return react.cloneElement(children2, {
37
+ ...rest2,
38
+ ...children2.props,
39
+ ...disabled ? isNativeButton ? { disabled: true } : { "aria-disabled": true, tabIndex: -1 } : null,
40
+ "data-slot": "button",
41
+ onClick: handleClick,
42
+ className: chunkZS5756ZC_js.cn(
43
+ chunk466QDL44_js.buttonVariants({ appearance: appearance2, size: size2 }),
44
+ children2.props.className,
45
+ className2
46
+ )
47
+ });
48
+ }
8
49
  if (props.as === "link") {
9
50
  const {
10
51
  className: className2,
@@ -58,5 +99,5 @@ var Button = (props) => {
58
99
  Button.displayName = "Button";
59
100
 
60
101
  exports.Button = Button;
61
- //# sourceMappingURL=chunk-JFS5PJSH.js.map
62
- //# sourceMappingURL=chunk-JFS5PJSH.js.map
102
+ //# sourceMappingURL=chunk-OKCC7E36.js.map
103
+ //# sourceMappingURL=chunk-OKCC7E36.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/buttons/button-base.tsx","../src/ui/buttons/button.tsx"],"names":["className","appearance","size","children","rest","isValidElement","cloneElement","cn","buttonVariants","ref","jsx"],"mappings":";;;;;;;AASO,IAAM,UAAA,GAAa,CAAC,KAAA,KAAuB;AAChD,EAAA,IAAI,SAAA,IAAa,KAAA,IAAS,KAAA,CAAM,OAAA,EAAS;AACvC,IAAA,MAAM;AAAA,MACJ,SAAA,EAAAA,UAAAA;AAAA,MACA,UAAA,EAAAC,WAAAA;AAAA,MACA,IAAA,EAAAC,KAAAA;AAAA,MACA,QAAA,EAAAC,SAAAA;AAAA,MACA,OAAA,EAAS,QAAA;AAAA,MACT,QAAA;AAAA,MACA,OAAA;AAAA,MACA,GAAGC;AAAA,KACL,GAAI,KAAA;AAEJ,IAAA,IAAI,CAACC,oBAAA,CAAuCF,SAAQ,CAAA,EAAG;AACrD,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,cAAA,GAAiBA,UAAS,IAAA,KAAS,QAAA;AACzC,IAAA,MAAM,YAAA,GAAeA,UAAS,KAAA,CAAM,OAAA;AAGpC,IAAA,MAAM,WAAA,GAA8C,CAAC,KAAA,KAAU;AAC7D,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,KAAA,CAAM,cAAA,EAAe;AACrB,QAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,QAAA;AAAA,MACF;AAEA,MAAA,OAAA,GAAU,KAAK,CAAA;AACf,MAAA,IAAI,CAAC,MAAM,gBAAA,EAAkB;AAC3B,QAAA,YAAA,GAAe,KAAK,CAAA;AAAA,MACtB;AAAA,IACF,CAAA;AAEA,IAAA,OAAOG,mBAAaH,SAAAA,EAAU;AAAA,MAC5B,GAAGC,KAAAA;AAAA,MACH,GAAGD,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O,QAAA;AAAA,IACP,QAAA;AAAA,IACA,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,uBACEO,cAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAWH,oBAAGC,+BAAA,CAAe,EAAE,YAAY,IAAA,EAAM,GAAG,SAAS,CAAA;AAAA,MAC5D,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ,CAAA;AAEA,UAAA,CAAW,WAAA,GAAc,QAAA;AC3GlB,IAAM,MAAA,GAAS,CAAC,KAAA,KAAuB;AAC5C,EAAA,uBAAOE,cAAAA,CAAC,UAAA,EAAA,EAAY,GAAG,KAAA,EAAO,CAAA;AAChC;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-OKCC7E36.js","sourcesContent":["\"use client\";\n\nimport { cloneElement, isValidElement, type MouseEventHandler } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { ButtonProps } from \"./types\";\nimport { buttonVariants } from \"./variants\";\n\nexport const ButtonBase = (props: ButtonProps) => {\n if (\"asChild\" in props && props.asChild) {\n const {\n className,\n appearance,\n size,\n children,\n asChild: _asChild,\n disabled,\n onClick,\n ...rest\n } = props;\n\n if (!isValidElement<{ className?: string }>(children)) {\n return null;\n }\n\n const isNativeButton = children.type === \"button\";\n const childOnClick = children.props.onClick as\n | MouseEventHandler<HTMLElement>\n | undefined;\n const handleClick: MouseEventHandler<HTMLElement> = (event) => {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n if (!event.defaultPrevented) {\n childOnClick?.(event);\n }\n };\n\n return cloneElement(children, {\n ...rest,\n ...children.props,\n ...(disabled\n ? isNativeButton\n ? { disabled: true }\n : { \"aria-disabled\": true, tabIndex: -1 }\n : null),\n \"data-slot\": \"button\",\n onClick: handleClick,\n className: cn(\n buttonVariants({ appearance, size }),\n children.props.className,\n className,\n ),\n });\n }\n\n if (props.as === \"link\") {\n const {\n className,\n appearance,\n size,\n children,\n ref,\n href,\n target,\n ...rest\n } = props;\n\n return (\n <a\n ref={ref}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n data-slot=\"button\"\n className={cn(buttonVariants({ appearance, size }), className)}\n {...rest}\n >\n {children}\n </a>\n );\n }\n\n const {\n className,\n appearance,\n size,\n type = \"button\",\n children,\n ref,\n ...rest\n } = props;\n\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"button\"\n className={cn(buttonVariants({ appearance, size }), className)}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nButtonBase.displayName = \"Button\";\n","// button.tsx — default static entry (no framer-motion)\nimport { ButtonBase } from \"./button-base\";\nimport type { ButtonProps } from \"./types\";\n\nexport const Button = (props: ButtonProps) => {\n return <ButtonBase {...props} />;\n};\n\nButton.displayName = \"Button\";\n"]}
@@ -21,6 +21,9 @@ function mergeTargetOverrides(target, overrides) {
21
21
  ...blur === void 0 ? null : { filter: formatBlurValue(blur) }
22
22
  };
23
23
  }
24
+ function isTargetObject(target) {
25
+ return target !== null && typeof target === "object" && !Array.isArray(target);
26
+ }
24
27
  function createMotionAnimation(displayName, slot, preset) {
25
28
  function MotionAnimation(props) {
26
29
  const {
@@ -32,6 +35,7 @@ function createMotionAnimation(displayName, slot, preset) {
32
35
  transition,
33
36
  layout,
34
37
  whileHover,
38
+ whileInView,
35
39
  whileTap,
36
40
  from,
37
41
  to,
@@ -39,20 +43,27 @@ function createMotionAnimation(displayName, slot, preset) {
39
43
  ...rest
40
44
  } = props;
41
45
  const shouldReduceMotion = framerMotion.useReducedMotion();
42
- const resolvedAnimate = animate ?? mergeTargetOverrides(preset.animate, to);
43
- const resolvedInitial = initial ?? (shouldReduceMotion ? resolvedAnimate : mergeTargetOverrides(preset.initial, from));
46
+ const resolvedAnimateTarget = mergeTargetOverrides(preset.animate, to);
47
+ const resolvedAnimate = animate ?? resolvedAnimateTarget;
48
+ const shouldAnimateInView = whileInView !== void 0;
49
+ const usesPresetWhileInView = whileInView === true;
50
+ const resolvedWhileInView = whileInView === void 0 ? void 0 : usesPresetWhileInView ? resolvedAnimateTarget : isTargetObject(whileInView) ? { ...resolvedAnimateTarget, ...whileInView } : whileInView;
51
+ const reducedMotionTarget = shouldAnimateInView ? resolvedWhileInView : resolvedAnimate;
52
+ const resolvedInitial = initial ?? (shouldReduceMotion ? reducedMotionTarget : mergeTargetOverrides(preset.initial, from));
44
53
  const resolvedExit = exit ?? mergeTargetOverrides(preset.exit, exitTo);
45
54
  const resolvedTransition = transition ? { ...preset.transition, ...transition } : preset.transition;
55
+ const shouldDisableAnimate = usesPresetWhileInView || shouldReduceMotion && shouldAnimateInView;
46
56
  return /* @__PURE__ */ jsxRuntime.jsx(
47
57
  framerMotion.motion.div,
48
58
  {
49
59
  "data-slot": slot,
50
60
  className: chunkZS5756ZC_js.cn(className),
51
61
  initial: resolvedInitial,
52
- animate: resolvedAnimate,
62
+ animate: shouldDisableAnimate ? void 0 : resolvedAnimate,
53
63
  exit: resolvedExit,
54
64
  layout: layout ?? preset.layout,
55
65
  whileHover: whileHover ?? preset.whileHover,
66
+ whileInView: shouldReduceMotion ? void 0 : shouldAnimateInView ? resolvedWhileInView : void 0,
56
67
  whileTap: whileTap ?? preset.whileTap,
57
68
  transition: resolvedTransition,
58
69
  ...rest,
@@ -65,5 +76,5 @@ function createMotionAnimation(displayName, slot, preset) {
65
76
  }
66
77
 
67
78
  exports.createMotionAnimation = createMotionAnimation;
68
- //# sourceMappingURL=chunk-ODZM25II.js.map
69
- //# sourceMappingURL=chunk-ODZM25II.js.map
79
+ //# sourceMappingURL=chunk-R5LL56ZO.js.map
80
+ //# sourceMappingURL=chunk-R5LL56ZO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/animations/shared/create-motion-animation.tsx"],"names":["useReducedMotion","jsx","motion","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AAA,EAAY,kBAAA;AAAA,QACX,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,eAAA,CAAgB,WAAA,GAAc,WAAA;AAC9B,EAAA,OAAO,eAAA;AACT","file":"chunk-R5LL56ZO.js","sourcesContent":["\"use client\";\n\nimport { motion, useReducedMotion } from \"framer-motion\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type {\n MotionAnimationPreset,\n MotionAnimationProps,\n MotionAnimationTargetOverrides,\n} from \"./types\";\n\nfunction formatBlurValue(value: number | string) {\n if (typeof value === \"number\") {\n return `blur(${value}px)`;\n }\n return value.includes(\"(\") ? value : `blur(${value})`;\n}\n\nfunction mergeTargetOverrides(\n target: MotionAnimationPreset[\"initial\"] | undefined,\n overrides: MotionAnimationTargetOverrides | undefined,\n) {\n if (!overrides) {\n return target;\n }\n\n const { blur, ...rest } = overrides;\n return {\n ...(target ?? {}),\n ...rest,\n ...(blur === undefined ? null : { filter: formatBlurValue(blur) }),\n };\n}\n\nfunction isTargetObject(\n target: NonNullable<MotionAnimationProps[\"whileInView\"]>,\n): target is MotionAnimationPreset[\"animate\"] {\n return target !== null && typeof target === \"object\" && !Array.isArray(target);\n}\n\nexport function createMotionAnimation(\n displayName: string,\n slot: string,\n preset: MotionAnimationPreset,\n) {\n function MotionAnimation(props: MotionAnimationProps) {\n const {\n children,\n className,\n initial,\n animate,\n exit,\n transition,\n layout,\n whileHover,\n whileInView,\n whileTap,\n from,\n to,\n exitTo,\n ...rest\n } = props;\n const shouldReduceMotion = useReducedMotion();\n const resolvedAnimateTarget = mergeTargetOverrides(preset.animate, to);\n const resolvedAnimate = animate ?? resolvedAnimateTarget;\n const shouldAnimateInView = whileInView !== undefined;\n const usesPresetWhileInView = whileInView === true;\n const resolvedWhileInView =\n whileInView === undefined\n ? undefined\n : usesPresetWhileInView\n ? resolvedAnimateTarget\n : isTargetObject(whileInView)\n ? { ...resolvedAnimateTarget, ...whileInView }\n : whileInView;\n const reducedMotionTarget = shouldAnimateInView\n ? resolvedWhileInView\n : resolvedAnimate;\n const resolvedInitial =\n initial ??\n (shouldReduceMotion\n ? reducedMotionTarget\n : mergeTargetOverrides(preset.initial, from));\n const resolvedExit = exit ?? mergeTargetOverrides(preset.exit, exitTo);\n const resolvedTransition = transition\n ? { ...preset.transition, ...transition }\n : preset.transition;\n const shouldDisableAnimate =\n usesPresetWhileInView || (shouldReduceMotion && shouldAnimateInView);\n\n return (\n <motion.div\n data-slot={slot}\n className={cn(className)}\n initial={resolvedInitial}\n animate={shouldDisableAnimate ? undefined : resolvedAnimate}\n exit={resolvedExit}\n layout={layout ?? preset.layout}\n whileHover={whileHover ?? preset.whileHover}\n whileInView={\n shouldReduceMotion\n ? undefined\n : shouldAnimateInView\n ? resolvedWhileInView\n : undefined\n }\n whileTap={whileTap ?? preset.whileTap}\n transition={resolvedTransition}\n {...rest}\n >\n {children}\n </motion.div>\n );\n }\n\n MotionAnimation.displayName = displayName;\n return MotionAnimation;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { ButtonProps } from "./types";
2
2
  export declare const ButtonBase: {
3
- (props: ButtonProps): import("react/jsx-runtime").JSX.Element;
3
+ (props: ButtonProps): import("react/jsx-runtime").JSX.Element | null;
4
4
  displayName: string;
5
5
  };
6
6
  //# sourceMappingURL=button-base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../../src/ui/buttons/button-base.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,UAAU;YAAW,WAAW;;CAiD5C,CAAC"}
1
+ {"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../../src/ui/buttons/button-base.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,UAAU;YAAW,WAAW;;CAoG5C,CAAC"}
@@ -1,10 +1,24 @@
1
1
  import type { VariantProps } from "class-variance-authority";
2
- import type { ComponentPropsWithRef } from "react";
2
+ import type { ComponentPropsWithRef, MouseEventHandler, ReactElement } from "react";
3
3
  import type { buttonVariants } from "./variants";
4
4
  export type ButtonSharedStatic = VariantProps<typeof buttonVariants>;
5
- export type ButtonProps = (ButtonSharedStatic & ComponentPropsWithRef<"button"> & {
5
+ export type ButtonProps = (ButtonSharedStatic & Omit<ComponentPropsWithRef<"button">, "children" | "onClick" | "ref" | "type"> & {
6
+ asChild: true;
7
+ as?: never;
8
+ children: ReactElement<{
9
+ "aria-disabled"?: boolean | "false" | "true";
10
+ className?: string;
11
+ "data-slot"?: string;
12
+ disabled?: boolean;
13
+ onClick?: MouseEventHandler<HTMLElement>;
14
+ tabIndex?: number;
15
+ }>;
16
+ onClick?: MouseEventHandler<HTMLElement>;
17
+ }) | (ButtonSharedStatic & ComponentPropsWithRef<"button"> & {
6
18
  as?: "button";
19
+ asChild?: false;
7
20
  }) | (ButtonSharedStatic & ComponentPropsWithRef<"a"> & {
8
21
  as: "link";
22
+ asChild?: false;
9
23
  });
10
24
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/buttons/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAErE,MAAM,MAAM,WAAW,GACnB,CAAC,kBAAkB,GACjB,qBAAqB,CAAC,QAAQ,CAAC,GAAG;IAChC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,CAAC,GACJ,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,GAAG,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AC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkJFS5PJSH_js = require('../chunk-JFS5PJSH.js');
4
+ var chunkOKCC7E36_js = require('../chunk-OKCC7E36.js');
5
5
  var chunk466QDL44_js = require('../chunk-466QDL44.js');
6
6
  require('../chunk-MUP7DVQR.js');
7
7
  require('../chunk-ZS5756ZC.js');
@@ -10,7 +10,7 @@ require('../chunk-ZS5756ZC.js');
10
10
 
11
11
  Object.defineProperty(exports, "Button", {
12
12
  enumerable: true,
13
- get: function () { return chunkJFS5PJSH_js.Button; }
13
+ get: function () { return chunkOKCC7E36_js.Button; }
14
14
  });
15
15
  Object.defineProperty(exports, "buttonVariants", {
16
16
  enumerable: true,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { Button } from '../chunk-VARQ7W4G.mjs';
2
+ export { Button } from '../chunk-C6NA452Q.mjs';
3
3
  export { buttonVariants } from '../chunk-CIEZFHCO.mjs';
4
4
  import '../chunk-4ZP444GA.mjs';
5
5
  import '../chunk-4D54YOL6.mjs';
@@ -3,7 +3,7 @@
3
3
 
4
4
  var chunkVMCOX3Z2_js = require('../chunk-VMCOX3Z2.js');
5
5
  require('../chunk-HPN7H5ZM.js');
6
- var chunkJFS5PJSH_js = require('../chunk-JFS5PJSH.js');
6
+ var chunkOKCC7E36_js = require('../chunk-OKCC7E36.js');
7
7
  require('../chunk-466QDL44.js');
8
8
  require('../chunk-MUP7DVQR.js');
9
9
  var chunkZS5756ZC_js = require('../chunk-ZS5756ZC.js');
@@ -215,7 +215,7 @@ var DynamicStepper = ({
215
215
  ...rest,
216
216
  children: [
217
217
  /* @__PURE__ */ jsxRuntime.jsx(
218
- chunkJFS5PJSH_js.Button,
218
+ chunkOKCC7E36_js.Button,
219
219
  {
220
220
  id: previousId,
221
221
  "data-slot": "dynamic-stepper-previous",
@@ -294,7 +294,7 @@ var DynamicStepper = ({
294
294
  }
295
295
  ),
296
296
  /* @__PURE__ */ jsxRuntime.jsx(
297
- chunkJFS5PJSH_js.Button,
297
+ chunkOKCC7E36_js.Button,
298
298
  {
299
299
  id: nextId,
300
300
  "data-slot": "dynamic-stepper-next",
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useDynamicStepper } from '../chunk-4MPNRGUA.mjs';
3
3
  import '../chunk-NWOE2TZN.mjs';
4
- import { Button } from '../chunk-VARQ7W4G.mjs';
4
+ import { Button } from '../chunk-C6NA452Q.mjs';
5
5
  import '../chunk-CIEZFHCO.mjs';
6
6
  import '../chunk-4ZP444GA.mjs';
7
7
  import { cn } from '../chunk-4D54YOL6.mjs';
package/package.json CHANGED
@@ -1,9 +1,37 @@
1
1
  {
2
2
  "name": "@zentauri-ui/zentauri-components",
3
- "version": "1.8.4",
3
+ "version": "1.8.42",
4
4
  "description": "React + Tailwind UI kit with charts, ESM/CJS builds, per-entry exports, and a zentauri-components / zentauri-ui CLI to vendor UI or hook source into your app",
5
+ "keywords": [
6
+ "react",
7
+ "tailwindcss",
8
+ "tailwind",
9
+ "component-library",
10
+ "ui-kit",
11
+ "design-system",
12
+ "typescript",
13
+ "nextjs",
14
+ "charts",
15
+ "hooks",
16
+ "animations"
17
+ ],
18
+ "homepage": "https://zentauri-ui.vercel.app/",
19
+ "bugs": {
20
+ "url": "https://github.com/ShubhamTiwari909/zentauri-ui/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/ShubhamTiwari909/zentauri-ui.git",
25
+ "directory": "packages/components"
26
+ },
27
+ "author": {
28
+ "name": "Shubham Tiwari",
29
+ "url": "https://www.linkedin.com/in/shubham-tiwari-b7544b193/"
30
+ },
5
31
  "license": "MIT",
6
32
  "files": [
33
+ "CHANGELOG.md",
34
+ "LICENSE",
7
35
  "dist",
8
36
  "src/ui",
9
37
  "src/animations",
@@ -64,6 +92,7 @@
64
92
  "build:types": "tsc -p tsconfig.emit-types.json",
65
93
  "build": "npm run build:js && npm run build:types",
66
94
  "generate:registry": "node scripts/generate-registry.mjs",
95
+ "update:test-health": "node scripts/update-test-health.mjs",
67
96
  "check:exports": "node scripts/check-exports.mjs",
68
97
  "prepack": "npm run build && node scripts/generate-registry.mjs && node scripts/check-exports.mjs",
69
98
  "test": "vitest run",
@@ -1,5 +1,59 @@
1
1
  import { render, screen } from "@testing-library/react";
2
- import { describe, expect, it } from "vitest";
2
+ import { beforeEach, describe, expect, it, vi } from "vitest";
3
+
4
+ const motionMockState = vi.hoisted(() => ({
5
+ shouldReduceMotion: false,
6
+ }));
7
+
8
+ vi.mock("framer-motion", async () => {
9
+ const React = await import("react");
10
+
11
+ function serializeMotionValue(value: unknown) {
12
+ return value === undefined ? "undefined" : JSON.stringify(value);
13
+ }
14
+
15
+ return {
16
+ motion: {
17
+ div: React.forwardRef<HTMLDivElement, Record<string, unknown>>(
18
+ (
19
+ {
20
+ animate,
21
+ children,
22
+ exit,
23
+ initial,
24
+ layout,
25
+ transition,
26
+ viewport,
27
+ whileHover,
28
+ whileInView,
29
+ whileTap,
30
+ ...props
31
+ },
32
+ ref,
33
+ ) =>
34
+ React.createElement(
35
+ "div",
36
+ {
37
+ ...props,
38
+ ref,
39
+ "data-motion-animate": serializeMotionValue(animate),
40
+ "data-motion-exit": serializeMotionValue(exit),
41
+ "data-motion-initial": serializeMotionValue(initial),
42
+ "data-motion-layout": serializeMotionValue(layout),
43
+ "data-motion-transition": serializeMotionValue(transition),
44
+ "data-motion-viewport": serializeMotionValue(viewport),
45
+ "data-motion-while-hover": serializeMotionValue(whileHover),
46
+ "data-motion-while-in-view":
47
+ serializeMotionValue(whileInView),
48
+ "data-motion-while-tap": serializeMotionValue(whileTap),
49
+ },
50
+ children as React.ReactNode,
51
+ ),
52
+ ),
53
+ },
54
+ useReducedMotion: () => motionMockState.shouldReduceMotion,
55
+ };
56
+ });
3
57
 
4
58
  import { BlurIn } from "./blur-in";
5
59
  import { BlurOut } from "./blur-out";
@@ -88,6 +142,10 @@ const animations = [
88
142
  ] as const;
89
143
 
90
144
  describe("animation primitives", () => {
145
+ beforeEach(() => {
146
+ motionMockState.shouldReduceMotion = false;
147
+ });
148
+
91
149
  for (const [displayName, Component, slot] of animations) {
92
150
  it(`${displayName} stamps the animation slot and forwards content`, () => {
93
151
  render(<Component className="custom-motion">Preview</Component>);
@@ -126,4 +184,58 @@ describe("animation primitives", () => {
126
184
  expect(root).not.toHaveAttribute("to");
127
185
  expect(root).not.toHaveAttribute("exitTo");
128
186
  });
187
+
188
+ it("can defer the preset animate target until the element enters the viewport", () => {
189
+ render(
190
+ <FadeUp viewport={{ once: true, amount: 0.35 }} whileInView>
191
+ Viewport gated
192
+ </FadeUp>,
193
+ );
194
+
195
+ const root = screen.getByText("Viewport gated");
196
+
197
+ expect(root).toHaveAttribute("data-motion-animate", "undefined");
198
+ expect(root).toHaveAttribute(
199
+ "data-motion-while-in-view",
200
+ JSON.stringify({ opacity: 1, y: 0 }),
201
+ );
202
+ expect(root).toHaveAttribute(
203
+ "data-motion-viewport",
204
+ JSON.stringify({ once: true, amount: 0.35 }),
205
+ );
206
+ });
207
+
208
+ it("keeps the preset animate target when whileInView receives a custom target", () => {
209
+ render(
210
+ <FadeUp whileInView={{ scale: 1.05 }}>Custom viewport target</FadeUp>,
211
+ );
212
+
213
+ const root = screen.getByText("Custom viewport target");
214
+
215
+ expect(root).toHaveAttribute(
216
+ "data-motion-animate",
217
+ JSON.stringify({ opacity: 1, y: 0 }),
218
+ );
219
+ expect(root).toHaveAttribute(
220
+ "data-motion-while-in-view",
221
+ JSON.stringify({ opacity: 1, y: 0, scale: 1.05 }),
222
+ );
223
+ });
224
+
225
+ it("renders the effective whileInView target immediately when motion is reduced", () => {
226
+ motionMockState.shouldReduceMotion = true;
227
+
228
+ render(
229
+ <FadeUp whileInView={{ scale: 1.05 }}>Reduced viewport target</FadeUp>,
230
+ );
231
+
232
+ const root = screen.getByText("Reduced viewport target");
233
+
234
+ expect(root).toHaveAttribute(
235
+ "data-motion-initial",
236
+ JSON.stringify({ opacity: 1, y: 0, scale: 1.05 }),
237
+ );
238
+ expect(root).toHaveAttribute("data-motion-animate", "undefined");
239
+ expect(root).toHaveAttribute("data-motion-while-in-view", "undefined");
240
+ });
129
241
  });