UNPKG

2.53 kBTypeScriptView Raw
1import * as React from 'react';
2import { DirectionalHint } from '../../common/DirectionalHint';
3import { IRefObject, IStyleFunctionOrObject } from '../../Utilities';
4import { IStyle, ITheme } from '../../Styling';
5import { ICalloutProps } from '../../Callout';
6/**
7 * Interface containing props common for all types of cards.
8 */
9export interface IBaseCardProps<TComponent, TStyles, TStyleProps> extends React.HTMLAttributes<HTMLDivElement> {
10 /**
11 * Optional callback to access the TComponent interface. Use this instead of ref for accessing
12 * the public methods and properties of the component.
13 */
14 componentRef?: IRefObject<TComponent>;
15 /**
16 * Additional CSS class(es) to apply to the Card content wrapper div.
17 */
18 className?: string;
19 /**
20 * How the element should be positioned
21 * @defaultvalue DirectionalHint.bottomLeftEdge
22 */
23 directionalHint?: DirectionalHint;
24 /**
25 * Make callout content show on the set side
26 * @defaultvalue true
27 */
28 directionalHintFixed?: boolean;
29 /**
30 * Focus on first element by default on card or not
31 */
32 firstFocus?: boolean;
33 /**
34 * The gap between the card and the target
35 * @defaultvalue 0
36 */
37 gapSpace?: number;
38 /**
39 * Callback upon focus or mouse enter event
40 */
41 onEnter?: (ev?: any) => void;
42 /**
43 * Callback upon blur or mouse leave event
44 */
45 onLeave?: (ev?: any) => void;
46 /**
47 * Item to be returned with onRender functions
48 */
49 renderData?: any;
50 /**
51 * Custom styles for this component
52 */
53 styles?: IStyleFunctionOrObject<TStyleProps, {
54 [P in keyof TStyles]: IStyle;
55 }>;
56 /**
57 * Element to anchor the card to.
58 */
59 targetElement?: HTMLElement;
60 /**
61 * Theme provided by HOC.
62 */
63 theme?: ITheme;
64 /**
65 * Trap focus or not
66 */
67 trapFocus?: boolean;
68 /**
69 * Custom overriding props to Callout
70 */
71 calloutProps?: ICalloutProps;
72}
73/**
74 * Interface containing styleProps common for all types of cards.
75 */
76export interface IBaseCardStyleProps {
77 /**
78 * ClassName to inject into wrapper div of the content.
79 */
80 className?: string;
81 /**
82 * Theme provided by High-Order Component.
83 */
84 theme: ITheme;
85}
86/**
87 * Interface containing style sections common for all types of cards.
88 */
89export interface IBaseCardStyles {
90 /**
91 * Style for the root element in the default enabled, non-toggled state.
92 */
93 root?: IStyle;
94}