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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /*
Copyright (c) 2018-2019 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
/* eslint-disable flowtype/generic-spacing */
import * as React from 'react';
import type {OverrideT} from '../helpers/overrides.js';
import {KIND, PLACEMENT, TYPE} from './constants.js';
export type KindTypeT = $Values<typeof KIND>;
export type NotificationTypeT = $Values<typeof TYPE>;
export type PlacementTypeT = $Values<typeof PLACEMENT>;
export type SharedStylePropsArgT = {
$color?: string,
$size?: number | string,
$kind: KindTypeT,
$type: NotificationTypeT,
$closeable: boolean,
$isRendered: boolean,
$isVisible: boolean,
};
export type ToasterSharedStylePropsArgT = {
$placement: PlacementTypeT,
};
export type OverridesT = {
Body?: OverrideT<SharedStylePropsArgT>,
CloseIcon?: OverrideT<SharedStylePropsArgT>,
};
export type ComponentRenderPropT = (props: {dismiss: () => void}) => React.Node;
export type ChildT = React.Node;
export type ChildrenT = React.ChildrenArray<ChildT>;
export type ToastPrivateStateT = {
isVisible: boolean,
isRendered: boolean,
};
export type ToastPropsT = {
/** The number of milliseconds to wait before automatically dismissing a
* notification. This behavior is disabled when the value is set to 0.*/
autoHideDuration: number,
/** Toast notification content. The children-as-function
* receives a dismiss method that can be called to
* dismiss the notification and can be used as a
* handler for an action inside the toast content. */
children: ChildrenT | ComponentRenderPropT,
/** When set to true a close button is displayed and the notification can be dismissed by a user. */
closeable: boolean,
/** Defines the type of notification. */
kind: KindTypeT,
notificationType: NotificationTypeT,
/** A callback function called when a notification is dismissed. */
onClose: () => mixed,
onBlur: (e: Event) => mixed,
onFocus: (e: Event) => mixed,
onMouseEnter: (e: Event) => mixed,
onMouseLeave: (e: Event) => mixed,
'data-baseweb'?: string,
overrides: OverridesT,
key: React.Key,
};
export type ToasterOverridesT = {
Root?: OverrideT<ToasterSharedStylePropsArgT>,
ToastBody?: OverrideT<SharedStylePropsArgT>,
ToastCloseIcon?: OverrideT<SharedStylePropsArgT>,
};
export type ToasterPropsT = {
overrides: ToasterOverridesT,
placement: PlacementTypeT,
usePortal: boolean,
/** The number of milliseconds to wait before automatically dismissing a
* notification. This behavior is disabled when the value is set to 0.*/
autoHideDuration: number,
};
export type ToasterContainerStateT = {
isMounted: boolean,
toasts: Array<$Shape<ToastPropsT> & {key: React.Key}>,
};
|