UNPKG

3.1 kBTypeScriptView Raw
1import * as React from 'react';
2import { IStyle, ITheme } from '../../Styling';
3import { IBaseProps, IRefObject, IStyleFunctionOrObject } from '../../Utilities';
4/**
5 * {@docCategory DocumentCard}
6 */
7export interface IDocumentCard {
8 /**
9 * Sets focus to the DocumentCard.
10 */
11 focus: () => void;
12}
13/**
14 * {@docCategory DocumentCard}
15 */
16export interface IDocumentCardProps extends IBaseProps<IDocumentCard>, React.HTMLAttributes<HTMLDivElement> {
17 /**
18 * Optional callback to access the IDocumentCard interface. Use this instead of ref for accessing
19 * the public methods and properties of the component.
20 */
21 componentRef?: IRefObject<IDocumentCard>;
22 /**
23 * The type of DocumentCard to display.
24 * @defaultvalue DocumentCardType.normal
25 */
26 type?: DocumentCardType;
27 /**
28 * Function to call when the card is clicked or keyboard Enter/Space is pushed.
29 */
30 onClick?: (ev?: React.SyntheticEvent<HTMLElement>) => void;
31 /**
32 * A URL to navigate to when the card is clicked. If a function has also been provided,
33 * it will be used instead of the URL.
34 */
35 onClickHref?: string;
36 /**
37 * A target browser context for opening the link. If not specified, will open in the same tab/window.
38 */
39 onClickTarget?: string;
40 /**
41 * Aria role assigned to the documentCard (Eg. button, link).
42 * Use this to override the default assignment.
43 * @defaultvalue When `onClick` is provided, default role will be 'button'.
44 * When `onClickHref` is provided, default role will be 'link'.
45 */
46 role?: string;
47 /**
48 * Hex color value of the line below the card, which should correspond to the document type.
49 * This should only be supplied when using the 'compact' card layout.
50 *
51 * Deprecated at v4.17.1, to be removed at \>= v5.0.0.
52 * @deprecated To be removed at v5.0.0.
53 */
54 accentColor?: string;
55 /**
56 * Child components to render within the card.
57 */
58 children?: React.ReactNode;
59 /**
60 * Call to provide customized styling that will layer on top of the variant rules
61 */
62 styles?: IStyleFunctionOrObject<IDocumentCardStyleProps, IDocumentCardStyles>;
63 /**
64 * Theme provided by HOC.
65 */
66 theme?: ITheme;
67 /**
68 * Optional override class name
69 */
70 className?: string;
71}
72/**
73 * {@docCategory DocumentCard}
74 */
75export declare enum DocumentCardType {
76 /**
77 * Standard DocumentCard.
78 */
79 normal = 0,
80 /**
81 * Compact layout. Displays the preview beside the details, rather than above.
82 */
83 compact = 1
84}
85/**
86 * {@docCategory DocumentCard}
87 */
88export interface IDocumentCardStyleProps {
89 /**
90 * Accept theme prop.
91 */
92 theme: ITheme;
93 /**
94 * Optional override class name
95 */
96 className?: string;
97 /**
98 * True when the card has a click action.
99 */
100 actionable?: boolean;
101 /**
102 * Compact variant of the card.
103 */
104 compact?: boolean;
105}
106/**
107 * {@docCategory DocumentCard}
108 */
109export interface IDocumentCardStyles {
110 root: IStyle;
111}