# All files / Dialog Dialog.type.ts

0% Statements 0/2
100% Branches 0/0
100% Functions 0/0
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

     import * as React from 'react'
    import * as PropTypes from 'prop-types'
    import { StandardProps, StyledProps } from '..'
    import Title from './components/Title'
    import Content from './components/Content'
    import Actions from './components/Actions'

    export type DialogClassProps = 'root' | 'title' | 'content' | 'actions' | 'mask'

    export type DialogChild =
      | React.ReactComponentElement<typeof Title>
      | React.ReactComponentElement<typeof Content>
      | React.ReactComponentElement<typeof Actions>
      | any

    export interface DialogContainer {
      title?: React.ReactComponentElement<typeof Title>
      content: React.ReactComponentElement<typeof Content>[]
      actions?: React.ReactComponentElement<typeof Actions>
    }

    export interface DialogProps
      extends StandardProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement, 'onChange'>,
        StyledProps {
      children: DialogChild[] | DialogChild
      visible: boolean
      onChange?: (visible: boolean) => void
    }

    export interface DialogType extends React.ForwardRefExoticComponent<DialogProps> {
      Title: typeof Title
      Content: typeof Content
      Actions: typeof Actions
    }

    export interface DialogContextType {
      onChange: (visible: boolean) => void
    }

    export interface DialogTitleProps {
      children: React.ReactText
    }

    export const DialogPropTypes = {
      children: PropTypes.oneOfType([
        PropTypes.element,
        // @ts-ignore
        PropTypes.arrayOf<PropTypes.Requireable<PropTypes.ReactElementLike>>(PropTypes.element)
      ]).isRequired,
      visible: PropTypes.bool.isRequired,
      onChange: PropTypes.func
    }