-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3156e7e
commit 8ba9468
Showing
15 changed files
with
114 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
docs/translations/api-docs/use-transitioned-element/use-transitioned-element.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 16 additions & 14 deletions
30
packages/mui-base/src/Dialog/Backdrop/useDialogBackdrop.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
import * as React from 'react'; | ||
import type { UseDialogBackdropParams, UseDialogBackdropReturnValue } from './DialogBackdrop.types'; | ||
import { useTransitionedElement } from '../../Transitions'; | ||
import { mergeReactProps } from '../../utils/mergeReactProps'; | ||
import { useAnimatedElement } from '../../utils/useAnimatedElement'; | ||
import { useForkRef } from '../../utils/useForkRef'; | ||
|
||
/** | ||
* | ||
* API: | ||
* | ||
* - [useDialogBackdrop API](https://mui.com/base-ui/api/use-dialog-backdrop/) | ||
*/ | ||
export function useDialogBackdrop(params: UseDialogBackdropParams): UseDialogBackdropReturnValue { | ||
const { open } = params; | ||
const { animated, open, ref } = params; | ||
|
||
const ref = React.useRef<HTMLElement | null>(null); | ||
const backdropRef = React.useRef<HTMLElement | null>(null); | ||
const handleRef = useForkRef(ref, backdropRef); | ||
|
||
const { getRootProps: getTransitionProps, mounted } = useTransitionedElement({ | ||
isRendered: open, | ||
elementRef: ref, | ||
const { mounted, transitionStatus } = useAnimatedElement({ | ||
open, | ||
ref: backdropRef, | ||
enabled: animated, | ||
}); | ||
|
||
const getRootProps = React.useCallback( | ||
(externalProps: React.ComponentPropsWithRef<any>) => | ||
mergeReactProps( | ||
externalProps, | ||
getTransitionProps({ | ||
role: 'presentation', | ||
ref, | ||
}), | ||
), | ||
[getTransitionProps], | ||
mergeReactProps(externalProps, { | ||
role: 'presentation', | ||
ref: handleRef, | ||
}), | ||
[handleRef], | ||
); | ||
|
||
return { | ||
getRootProps, | ||
mounted, | ||
transitionStatus, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export * from './CssAnimation'; | ||
export * from './CssTransition'; | ||
export * from './useTransitionStatus'; | ||
export * from './useTransitionedElement'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.