@yamada-ui/motion
Version:
Yamada UI motion components
1 lines • 1.67 kB
Source Map (JSON)
{"version":3,"sources":["../src/motion.tsx"],"sourcesContent":["import type { Dict } from \"@yamada-ui/utils\"\nimport type { MotionProps } from \"./motion.types\"\nimport { ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { motion } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { motionForwardRef } from \"./forward-ref\"\n\nconst disableStyleProps = [\"transition\"]\n\nconst disableStyleProp = (prop: string) => disableStyleProps.includes(prop)\n\nconst Component = ui<\"div\", Dict>(\"div\", { disableStyleProp })\n\n/**\n * `Motion` is a component that allows for the easy implementation of a wide variety of animations.\n *\n * @see Docs https://yamada-ui.com/components/other/motion\n */\nexport const Motion = motionForwardRef<MotionProps, \"div\">(\n ({ as: asProp = \"div\", className, ...rest }, ref) => {\n const as = useMemo(() => motion.create(asProp), [asProp])\n\n return (\n <Component\n ref={ref}\n as={as}\n className={cx(\"ui-motion\", className)}\n {...rest}\n />\n )\n },\n)\n\nMotion.displayName = \"Motion\"\nMotion.__ui__ = \"Motion\"\n"],"mappings":";;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,eAAe;AAmBlB;AAhBN,IAAM,oBAAoB,CAAC,YAAY;AAEvC,IAAM,mBAAmB,CAAC,SAAiB,kBAAkB,SAAS,IAAI;AAE1E,IAAM,YAAY,GAAgB,OAAO,EAAE,iBAAiB,CAAC;AAOtD,IAAM,SAAS;AAAA,EACpB,CAAC,EAAE,IAAI,SAAS,OAAO,WAAW,GAAG,KAAK,GAAG,QAAQ;AACnD,UAAM,KAAK,QAAQ,MAAM,OAAO,OAAO,MAAM,GAAG,CAAC,MAAM,CAAC;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,WAAW,GAAG,aAAa,SAAS;AAAA,QACnC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;AACrB,OAAO,SAAS;","names":[]}