@carbon/ibm-products
Version:
Carbon for IBM Products
81 lines (80 loc) • 2.84 kB
TypeScript
/**
* Copyright IBM Corp. 2020, 2021
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { ElementType, ReactNode } from 'react';
import '../../global/js/utils/props-helper';
import { ButtonProps, LinkProps } from '@carbon/react';
declare enum sizes {
lg = "lg",
sm = "sm"
}
export declare const defaults: {
position: string;
size: sizes;
};
export interface EmptyStateAction extends ButtonProps<React.ElementType> {
kind?: 'primary' | 'secondary' | 'tertiary';
text?: string;
}
export interface CustomLink extends LinkProps<React.ElementType> {
text?: ReactNode;
}
export interface EmptyStateProps {
/**
* Empty state action button
*/
action?: EmptyStateAction;
/**
* Provide an optional class to be applied to the containing node.
*/
className?: string;
/**
* Empty state illustration, specify the `src` for a provided illustration to be displayed. In the case of requiring a light and dark illustration of your own, simply pass the corresponding illustration based on the current theme of your application.
* For example: `illustration={appTheme === 'dark' ? darkIllustration : lightIllustration}`
*/
illustration?: string;
/**
* The alt text for empty state svg images. If not provided , title will be used.
*/
illustrationDescription?: string;
/**
* Designates the position of the illustration relative to the content
*/
illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
/**
* Empty state link object
*/
link?: CustomLink;
/**
* Customize the heading element. Set to "h1" when EmptyState is full page, i.e. there is no higher header.
* Otherwise, you normally don't need to specify this: EmptyState will automatically pick the right heading level
* (h2-h6) by leveraging Section and Heading.
*/
headingAs?: (() => ReactNode) | string | ElementType;
/**
* Empty state size
*/
size?: 'lg' | 'sm';
/**
* Empty state subtitle
*/
subtitle?: string | ReactNode;
/**
* Empty state title
*/
title: string | ReactNode;
/**
* Designates which version of the EmptyState component is being used.
* Refer to V2 documentation separately.
*/
v2?: boolean;
}
export type EmptyStatePresetProps = Omit<EmptyStateProps, 'illustration'>;
/**
* The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
*/
export declare let EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
export {};