@wix/design-system
Version:
@wix/design-system
64 lines • 2.34 kB
TypeScript
import React from 'react';
import { EllipsisCommonProps } from '../common/Ellipsis';
import { ValuesOf } from '../utils/typeUtils';
import { SKINS, TYPE_POSITIONS_MAP } from './Notification.constants';
export type NotificationSkin = ValuesOf<typeof SKINS>;
export type NotificationTheme = NotificationSkin;
export type NotificationType = ValuesOf<typeof TYPE_POSITIONS_MAP>;
export interface NotificationProps {
/** Can be either:
* - `<Notification.TextLabel/>` (required)
* - `<Notification.CloseButton/>`
* - `<Notification.ActionButton/>` */
children?: React.ReactNode;
dataHook?: string;
/** when set to `true`, notification is shown */
show?: boolean;
/** @deprecated use `skin` instead
* @default 'standard'
*/
theme?: NotificationSkin;
/** Notification skin */
skin?: NotificationSkin;
/** Sets how <Notification/> should be displayed:
* - `type="global"` will take up space and push the content down.
* - `type="local"` will not take up space and will be displayed on top of content
* - `type="sticky"` will not take up space and will be displayed at the top of whole page and on top of content (position: fixed;)
*/
type?: NotificationType;
/** When provided, then the Notification will be hidden after the specified timeout. */
autoHideTimeout?: number;
/** Notification z-index */
zIndex?: number;
/** @default null */
onClose?: (source: string) => void;
}
interface TextLinkActionButtonProps {
children?: React.ReactNode;
type: 'textLink';
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
link?: string;
target?: string;
}
interface ButtonActionButtonProps {
children?: React.ReactNode;
type?: 'button';
onClick?: React.MouseEventHandler<HTMLButtonElement>;
}
export type ActionButtonProps = ButtonActionButtonProps | TextLinkActionButtonProps;
export type TextLabelProps = EllipsisCommonProps & {
children: React.ReactNode;
};
export interface MappedChildren {
label?: React.ReactElement;
ctaButton?: React.ReactElement;
closeButton?: React.ReactElement;
}
export interface NotificationState {
hideByCloseClick: boolean;
hideByTimer: boolean;
height: number;
showChildren: boolean;
}
export {};
//# sourceMappingURL=Notification.types.d.ts.map