From 5a3cf56603552fa298990e4d73ce8ee504ff81aa Mon Sep 17 00:00:00 2001 From: Nishchal Gautam Date: Tue, 15 Aug 2017 14:01:27 +0700 Subject: [PATCH] Update type definition update type definition for contentLabel props (it was not required, but as of react-modal: 2.2.4, it's required). And order the props in same order as react-modal's source code so it's easy to compare in future. --- types/react-modal/index.d.ts | 59 ++++++++++++++++--------- types/react-modal/react-modal-tests.tsx | 1 + 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index a8eff75970..10e50d7cd3 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -38,36 +38,51 @@ declare namespace ReactModal { interface Props { /* Boolean describing if the modal should be shown or not. Defaults to false. */ isOpen: boolean; + /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ style?: Styles; - /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - appElement?: HTMLElement | {}; - /* Function that will be run after the modal has opened. */ - onAfterOpen?(): void; - /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ - onRequestClose?(event: (MouseEvent | KeyboardEvent)): void; - /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ - closeTimeoutMS?: number; - /* Boolean indicating if the appElement should be hidden. Defaults to true. */ - ariaHideApp?: boolean; - /* Boolean indicating if the overlay should close the modal. Defaults to true. */ - shouldCloseOnOverlayClick?: boolean; + /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ portalClassName?: string; - /* String or object className to be applied to the overlay. */ - overlayClassName?: string | Classes; - /* String or object className to be applied to the modal content. */ - className?: string | Classes; - /* String indicating how the content container should be announced to screenreaders. */ - contentLabel?: string; - /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ - role?: string; - /* Function that will be called to get the parent element that the modal will be attached to. */ - parentSelector?(): HTMLElement; + /* String className to be applied to the document.body. */ bodyOpenClassName?: string; + + /* String or object className to be applied to the modal content. */ + className?: string | Classes; + + /* String or object className to be applied to the overlay. */ + overlayClassName?: string | Classes; + + /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + appElement?: HTMLElement | {}; + + /* Function that will be run after the modal has opened. */ + onAfterOpen?(): void; + + /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ + onRequestClose?(event: (MouseEvent | KeyboardEvent)): void; + + /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ + closeTimeoutMS?: number; + + /* Boolean indicating if the appElement should be hidden. Defaults to true. */ + ariaHideApp?: boolean; + + /* Boolean indicating if the overlay should close the modal. Defaults to true. */ + shouldCloseOnOverlayClick?: boolean; + + /* Function that will be called to get the parent element that the modal will be attached to. */ + parentSelector?(): HTMLElement; + /* Additional aria attributes. */ aria?: Aria; + + /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ + role?: string; + + /* String indicating how the content container should be announced to screenreaders. */ + contentLabel: string; } } diff --git a/types/react-modal/react-modal-tests.tsx b/types/react-modal/react-modal-tests.tsx index 4a37341b1e..b48cc188e6 100644 --- a/types/react-modal/react-modal-tests.tsx +++ b/types/react-modal/react-modal-tests.tsx @@ -48,6 +48,7 @@ class ExampleOfUsingReactModal extends React.Component { isOpen={true} onAfterOpen={onAfterOpenFn} onRequestClose={onRequestCloseFn} + contentLabel="demo label" closeTimeoutMS={1000} style={customStyle} className={customClasses}