pre-installations and preparations

This commit is contained in:
MuhammadKhalilzadeh committed 2024-05-05 11:21:00 +03:30
1 parent 3e5a0329cb
commit 201d621ac3
6977 files changed
+742826

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import * as React from 'react';
export interface CssAnimationProps {
children?: React.ReactNode;
className?: string;
/**
* The name of the CSS animation (the `animation-name` CSS property) applied to the component when
* the transition is requested to enter.
*/
enterAnimationName?: string;
/**
* The name of the CSS class applied to the component when the transition
* is requested to enter.
*/
enterClassName?: string;
/**
* The name of the CSS animation (the `animation-name` CSS property) applied to the component when
* the transition is requested to exit.
*/
exitAnimationName?: string;
/**
* The name of the CSS class applied to the component when the transition
* is requested to exit.
*/
exitClassName?: string;
}
/**
*
* Demos:
*
* - [Transitions](https://mui.com/base-ui/react-transitions/)
*
* API:
*
* - [CssAnimation API](https://mui.com/base-ui/react-transitions/components-api/#css-animation)
*/
declare function CssAnimation(props: CssAnimationProps): React.JSX.Element;
declare namespace CssAnimation {
var propTypes: any;
}
export { CssAnimation };
+64
View File
@@ -0,0 +1,64 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "className", "enterAnimationName", "enterClassName", "exitAnimationName", "exitClassName"];
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useTransitionStateManager } from '../useTransition';
import { jsx as _jsx } from "react/jsx-runtime";
/**
*
* Demos:
*
* - [Transitions](https://mui.com/base-ui/react-transitions/)
*
* API:
*
* - [CssAnimation API](https://mui.com/base-ui/react-transitions/components-api/#css-animation)
*/
function CssAnimation(props) {
const {
children,
className,
enterAnimationName,
enterClassName,
exitAnimationName,
exitClassName
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
requestedEnter,
onExited
} = useTransitionStateManager();
const hasExited = React.useRef(true);
React.useEffect(() => {
if (requestedEnter && hasExited.current) {
hasExited.current = false;
}
}, [requestedEnter]);
const handleAnimationEnd = React.useCallback(event => {
if (event.animationName === exitAnimationName) {
onExited();
hasExited.current = true;
} else if (event.animationName === enterAnimationName) {
hasExited.current = false;
}
}, [onExited, exitAnimationName, enterAnimationName]);
return /*#__PURE__*/_jsx("div", _extends({
onAnimationEnd: handleAnimationEnd,
className: clsx(className, requestedEnter ? enterClassName : exitClassName)
}, other, {
children: children
}));
}
process.env.NODE_ENV !== "production" ? CssAnimation.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
enterAnimationName: PropTypes.string,
enterClassName: PropTypes.string,
exitAnimationName: PropTypes.string,
exitClassName: PropTypes.string
} : void 0;
export { CssAnimation };
+36
View File
@@ -0,0 +1,36 @@
import * as React from 'react';
export interface CssTransitionProps {
children?: React.ReactNode;
className?: string;
/**
* The name of the CSS class applied to the component when the transition
* is requested to enter.
*/
enterClassName?: string;
/**
* The name of the CSS class applied to the component when the transition
* is requested to exit.
*/
exitClassName?: string;
/**
* The name of the CSS property that is transitioned the longest (has the largest `transition-duration`) on exit.
* This is used to determine when the transition has ended.
* If not specified, the transition will be considered finished end when the first property is transitioned.
* If all properties have the same `transition-duration` (or there is just one transitioned property), this can be omitted.
*/
lastTransitionedPropertyOnExit?: string;
}
/**
* A utility component that hooks up to the Base UI transitions API and
* applies a CSS transition to its children when necessary.
*
* Demos:
*
* - [Transitions](https://mui.com/base-ui/react-transitions/)
*
* API:
*
* - [CssTransition API](https://mui.com/base-ui/react-transitions/components-api/#css-transition)
*/
declare const CssTransition: React.ForwardRefExoticComponent<CssTransitionProps & React.RefAttributes<HTMLDivElement>>;
export { CssTransition };
+72
View File
@@ -0,0 +1,72 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "className", "lastTransitionedPropertyOnExit", "enterClassName", "exitClassName"];
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useTransitionStateManager } from '../useTransition';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* A utility component that hooks up to the Base UI transitions API and
* applies a CSS transition to its children when necessary.
*
* Demos:
*
* - [Transitions](https://mui.com/base-ui/react-transitions/)
*
* API:
*
* - [CssTransition API](https://mui.com/base-ui/react-transitions/components-api/#css-transition)
*/
const CssTransition = /*#__PURE__*/React.forwardRef(function CssTransition(props, forwardedRef) {
const {
children,
className,
lastTransitionedPropertyOnExit,
enterClassName,
exitClassName
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
requestedEnter,
onExited
} = useTransitionStateManager();
const [isEntering, setIsEntering] = React.useState(false);
// The `isEntering` state (which is used to determine the right CSS class to apply)
// is updated slightly (one animation frame) after the `requestedEnter` state is updated.
// Thanks to this, elements that are mounted will have their enter transition applied
// (if the `enterClassName` was applied when the element was mounted, the transition would not be fired).
React.useEffect(() => {
if (requestedEnter) {
requestAnimationFrame(() => {
setIsEntering(true);
});
} else {
setIsEntering(false);
}
}, [requestedEnter]);
const handleTransitionEnd = React.useCallback(event => {
if (!requestedEnter && (lastTransitionedPropertyOnExit == null || event.propertyName === lastTransitionedPropertyOnExit)) {
onExited();
}
}, [onExited, requestedEnter, lastTransitionedPropertyOnExit]);
return /*#__PURE__*/_jsx("div", _extends({
onTransitionEnd: handleTransitionEnd,
className: clsx(className, isEntering ? enterClassName : exitClassName)
}, other, {
ref: forwardedRef,
children: children
}));
});
process.env.NODE_ENV !== "production" ? CssTransition.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
enterClassName: PropTypes.string,
exitClassName: PropTypes.string,
lastTransitionedPropertyOnEnter: PropTypes.string,
lastTransitionedPropertyOnExit: PropTypes.string
} : void 0;
export { CssTransition };
+2
View File
@@ -0,0 +1,2 @@
export * from './CssAnimation';
export * from './CssTransition';
+2
View File
@@ -0,0 +1,2 @@
export * from './CssAnimation';
export * from './CssTransition';
+6
View File
@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "./index.js",
"main": "../node/Transitions/index.js",
"types": "./index.d.ts"
}