From 6c0b60f96cf1f8691b1ecadd3bc03d03efa93e4b Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Wed, 3 Apr 2019 13:20:23 -0700 Subject: [PATCH] Reactstrap: Add new Toast component. --- types/reactstrap/index.d.ts | 11 ++++++++++- types/reactstrap/lib/Toast.d.ts | 16 ++++++++++++++++ types/reactstrap/lib/ToastBody.d.ts | 12 ++++++++++++ types/reactstrap/lib/ToastHeader.d.ts | 17 +++++++++++++++++ types/reactstrap/reactstrap-tests.tsx | 26 ++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 types/reactstrap/lib/Toast.d.ts create mode 100644 types/reactstrap/lib/ToastBody.d.ts create mode 100644 types/reactstrap/lib/ToastHeader.d.ts diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index adadd7886a..e396a4f4a7 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for reactstrap 7.1 +// Type definitions for reactstrap 8.0 // Project: https://github.com/reactstrap/reactstrap#readme // Definitions by: Ali Hammad Baig // Marco Falkenberg @@ -237,6 +237,15 @@ export { TabPaneProps } from './lib/TabPane'; import { default as Tag_ } from './lib/Tag'; export class Tag extends Tag_ {} export { TagProps } from './lib/Tag'; +import { default as Toast_ } from './lib/Toast'; +export class Toast extends Toast_ {} +export { ToastProps } from './lib/Toast'; +import { default as ToastBody_ } from './lib/ToastBody'; +export class ToastBody extends ToastBody_ {} +export { ToastBodyProps } from './lib/ToastBody'; +import { default as ToastHeader_ } from './lib/ToastHeader'; +export class ToastHeader extends ToastHeader_ {} +export { ToastHeaderProps } from './lib/ToastHeader'; import { default as Tooltip_ } from './lib/Tooltip'; export class Tooltip extends Tooltip_ {} export { TooltipProps } from './lib/Tooltip'; diff --git a/types/reactstrap/lib/Toast.d.ts b/types/reactstrap/lib/Toast.d.ts new file mode 100644 index 0000000000..44824bd155 --- /dev/null +++ b/types/reactstrap/lib/Toast.d.ts @@ -0,0 +1,16 @@ +import * as React from "react"; +import { CSSModule } from "../index"; +import { FadeProps } from "./Fade"; + +export type ToastProps = React.HTMLAttributes & { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + innerRef?: React.Ref; + isOpen?: boolean; + fade?: boolean; + transition?: FadeProps; +} & T; + +declare class Toast extends React.Component> {} +export default Toast; diff --git a/types/reactstrap/lib/ToastBody.d.ts b/types/reactstrap/lib/ToastBody.d.ts new file mode 100644 index 0000000000..55ae7ae502 --- /dev/null +++ b/types/reactstrap/lib/ToastBody.d.ts @@ -0,0 +1,12 @@ +import * as React from 'react'; +import { CSSModule } from '../index'; + +export type ToastBodyProps = React.HTMLAttributes & { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + innerRef?: React.Ref; +} & T; + +declare class ToastBody extends React.Component> {} +export default ToastBody; diff --git a/types/reactstrap/lib/ToastHeader.d.ts b/types/reactstrap/lib/ToastHeader.d.ts new file mode 100644 index 0000000000..3fe589c11e --- /dev/null +++ b/types/reactstrap/lib/ToastHeader.d.ts @@ -0,0 +1,17 @@ +import * as React from 'react'; +import { CSSModule } from '../index'; + +export type ToastHeaderProps = React.HTMLAttributes & { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + wrapTag?: React.ReactType; + toggle?: () => void; + icon?: string | React.ReactNode; + close?: React.ReactNode; + charCode?: string | number; + closeAriaLabel?: string; +} & T; + +declare class ToastHeader extends React.Component> {} +export default ToastHeader; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 67c24bce28..a50dbec582 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -79,6 +79,9 @@ import { TabContent, Table, Tag, + Toast, + ToastBody, + ToastHeader, Tooltip, Spinner, UncontrolledPopover, @@ -4357,3 +4360,26 @@ function Example126() { ); } + +function Example127() { + return ( +
+ + + Reactstrap + + + This is a toast with a primary icon — check it out! + + + + } toggle={() => {}}> + Reactstrap + + + This is a toast with a custom icon — check it out! + + +
+ ); +}