11/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
22import React , { forwardRef , HTMLAttributes } from "react" ;
33import cn from "classnames" ;
4- import CSSTransition , {
5- CSSTransitionClassNames ,
6- } from "react-transition-group/CSSTransition" ;
4+ import CSSTransition from "react-transition-group/CSSTransition" ;
75import {
86 ConditionalPortal ,
97 RenderConditionalPortalProps ,
108} from "@react-md/portal" ;
119import { OverridableCSSTransitionProps } from "@react-md/transition" ;
1210import { bem } from "@react-md/utils" ;
1311
12+ import {
13+ DEFAULT_OVERLAY_TIMEOUT ,
14+ DEFAULT_OVERLAY_CLASSNAMES ,
15+ } from "./constants" ;
16+
1417export interface OverlayProps
1518 extends OverridableCSSTransitionProps ,
1619 RenderConditionalPortalProps ,
@@ -46,12 +49,6 @@ export interface OverlayProps
4649
4750const block = bem ( "rmd-overlay" ) ;
4851
49- const DEFAULT_OVERLAY_CLASSNAMES : CSSTransitionClassNames = {
50- appearActive : "rmd-overlay--active" ,
51- enterActive : "rmd-overlay--active" ,
52- enterDone : "rmd-overlay--active" ,
53- } ;
54-
5552/**
5653 * The `Overlay` component is a simple component used to render a full page
5754 * overlay in the page with an enter and exit animation. If there are overflow
@@ -64,7 +61,8 @@ const Overlay = forwardRef<HTMLDivElement, OverlayProps>(function Overlay(
6461 visible,
6562 hidden = false ,
6663 clickable = true ,
67- timeout = 150 ,
64+ timeout = DEFAULT_OVERLAY_TIMEOUT ,
65+ classNames = DEFAULT_OVERLAY_CLASSNAMES ,
6866 children,
6967 mountOnEnter = true ,
7068 unmountOnExit = true ,
@@ -78,7 +76,6 @@ const Overlay = forwardRef<HTMLDivElement, OverlayProps>(function Overlay(
7876 portal,
7977 portalInto,
8078 portalIntoId,
81- classNames = DEFAULT_OVERLAY_CLASSNAMES ,
8279 tabIndex = - 1 ,
8380 ...props
8481 } ,
0 commit comments