2323import * as React from 'react' ;
2424import classnames from 'classnames' ;
2525
26- // @ts -ignore no .d.ts file
27- import { MDCDialogFoundation , MDCDialogAdapter , util } from '@material/dialog/dist/mdc.dialog ' ;
28- // @ts -ignore no .d.ts file
29- import { ponyfill } from '@material/dom/dist/mdc.dom ' ;
26+ import { MDCDialogFoundation } from '@material/dialog/foundation' ;
27+ import { MDCDialogAdapter } from '@material/dialog/adapter ' ;
28+ import { createFocusTrapInstance , isScrollable , areTopsMisaligned } from '@material/dialog/util' ;
29+ import { ponyfill } from '@material/dom' ;
3030/* eslint-disable no-unused-vars */
3131import DialogContent , { DialogContentProps } from './DialogContent' ;
3232import DialogFooter , { DialogFooterProps } from './DialogFooter' ;
@@ -89,7 +89,7 @@ class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
8989 DialogState
9090 > {
9191 focusTrap ?: FocusTrap ;
92- foundation : MDCDialogFoundation ;
92+ foundation ! : MDCDialogFoundation ;
9393 dialogElement : React . RefObject < HTMLElement > = React . createRef ( ) ;
9494 labelledBy ?: string ;
9595 describedBy ?: string ;
@@ -116,7 +116,7 @@ class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
116116 this . open ( ) ;
117117 }
118118 if ( ! autoStackButtons ) {
119- this . foundation . setAutoStackButtons ( autoStackButtons ) ;
119+ this . foundation . setAutoStackButtons ( autoStackButtons ! ) ;
120120 }
121121
122122 if ( typeof escapeKeyAction === 'string' ) { // set even if empty string
@@ -136,15 +136,15 @@ class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
136136 const { open, autoStackButtons, escapeKeyAction, scrimClickAction} = this . props ;
137137
138138 if ( prevProps . autoStackButtons !== autoStackButtons ) {
139- this . foundation . setAutoStackButtons ( autoStackButtons ) ;
139+ this . foundation . setAutoStackButtons ( autoStackButtons ! ) ;
140140 }
141141
142142 if ( prevProps . escapeKeyAction !== escapeKeyAction ) {
143- this . foundation . setEscapeKeyAction ( escapeKeyAction ) ;
143+ this . foundation . setEscapeKeyAction ( escapeKeyAction ! ) ;
144144 }
145145
146146 if ( prevProps . scrimClickAction !== scrimClickAction ) {
147- this . foundation . setScrimClickAction ( scrimClickAction ) ;
147+ this . foundation . setScrimClickAction ( scrimClickAction ! ) ;
148148 }
149149
150150 if ( prevProps . open !== open ) {
@@ -181,13 +181,12 @@ class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
181181 } ;
182182
183183 private initializeFocusTrap = ( ) : void => {
184- this . focusTrap = this . props . children && util . createFocusTrapInstance ( this . dialogElement . current ) ;
184+ this . focusTrap = this . props . children && createFocusTrapInstance ( this . dialogElement . current ! ) ;
185185 } ;
186186
187- get adapter ( ) : Partial < MDCDialogAdapter > {
187+ get adapter ( ) : MDCDialogAdapter {
188188 const strings = MDCDialogFoundation . strings ;
189189 const { closest, matches} = ponyfill ;
190- const { isScrollable, areTopsMisaligned} = util ;
191190 return {
192191 addClass : ( className : string ) => {
193192 const { classList} = this . state ;
@@ -258,8 +257,8 @@ class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
258257 } ;
259258
260259 handleInteraction = ( e : React . MouseEvent < HTMLElement > | React . KeyboardEvent < HTMLElement > ) : void =>
261- this . foundation . handleInteraction ( e ) ;
262- handleDocumentKeyDown = ( e : Event ) : void =>
260+ this . foundation . handleInteraction ( e . nativeEvent ) ;
261+ handleDocumentKeyDown = ( e : KeyboardEvent ) : void =>
263262 this . foundation . handleDocumentKeydown ( e ) ;
264263 handleLayout = ( ) : void => this . foundation . layout ( ) ;
265264
0 commit comments