Debian Codegraph @

node/@patternfly/react-core/dist/js/components/ExpandableSection/ExpandableSection.d.ts

raw
1 import { Component } from 'react';
2 import { PickOptional } from '../../helpers/typeUtils';
3 export declare enum ExpandableSectionVariant {
4 default = "default",
5 truncate = "truncate"
6 }
7 /** The main expandable section component. */
8 export interface ExpandableSectionProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onToggle'> {
9 /** Content rendered inside the expandable section. */
10 children?: React.ReactNode;
11 /** Additional classes added to the expandable section. */
12 className?: string;
13 /** Id of the content of the expandable section. When passing in the isDetached property, this
14 * property's value should match the contentId property of the expandable section toggle sub-component.
15 */
16 contentId?: string;
17 /** Id of the toggle of the expandable section, which provides an accessible name to the
18 * expandable section content via the aria-labelledby attribute. When the isDetached property
19 * is also passed in, the value of this property must match the toggleId property of the
20 * expandable section toggle sub-component.
21 */
22 toggleId?: string;
23 /** Display size variant. Set to "lg" for disclosure styling. */
24 displaySize?: 'default' | 'lg';
25 /** Flag indicating that the expandable section and expandable toggle are detached from one another. */
26 isDetached?: boolean;
27 /** Flag to indicate if the content is expanded. */
28 isExpanded?: boolean;
29 /** Flag to indicate if the content is indented. */
30 isIndented?: boolean;
31 /** Flag to indicate the width of the component is limited. Set to "true" for disclosure styling. */
32 isWidthLimited?: boolean;
33 /** Callback function to toggle the expandable section. Detached expandable sections should
34 * use the onToggle property of the expandable section toggle sub-component.
35 */
36 onToggle?: (event: React.MouseEvent, isExpanded: boolean) => void;
37 /** React node that appears in the attached toggle in place of the toggleText property.
38 * Can also be a function that receives the expanded state and returns a React node.
39 */
40 toggleContent?: React.ReactNode | ((isExpanded: boolean) => React.ReactNode);
41 /** Text that appears in the attached toggle. */
42 toggleText?: string;
43 /** Text that appears in the attached toggle when collapsed (will override toggleText if
44 * both are specified; used for uncontrolled expandable with dynamic toggle text).
45 */
46 toggleTextCollapsed?: string;
47 /** Text that appears in the attached toggle when expanded (will override toggleText if
48 * both are specified; used for uncontrolled expandable with dynamic toggle text).
49 */
50 toggleTextExpanded?: string;
51 /** Accessible name via human readable string for the expandable section toggle. */
52 toggleAriaLabel?: string;
53 /** Accessible name via space delimtted list of IDs for the expandable section toggle. */
54 toggleAriaLabelledBy?: string;
55 /** Icon shown in toggle when variant is not truncated. */
56 toggleIcon?: React.ReactNode;
57 /** Whether to show a toggle icon when variant is not truncated. If omitted, it is important to ensure the current state of the ExpandableSection is conveyed, most likely by having dynamic toggle text. */
58 hasToggleIcon?: boolean;
59 /** Truncates the expandable content to the specified number of lines when using the
60 * "truncate" variant.
61 */
62 truncateMaxLines?: number;
63 /** Determines the variant of the expandable section. When passing in "truncate" as the
64 * variant, the expandable content will be truncated after 3 lines by default.
65 */
66 variant?: 'default' | 'truncate';
67 /** Sets the direction of the expandable animation when isDetached is true. If this prop is not passed,
68 * animation will not occur.
69 */
70 direction?: 'up' | 'down';
71 /** The HTML element to use for the toggle wrapper. Can be 'div' (default) or any heading level.
72 * When using heading elements, the button will be rendered inside the heading for proper semantics.
73 * This is useful when the toggle text should function as a heading in the document structure.
74 */
75 toggleWrapper?: 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
76 }
77 interface ExpandableSectionState {
78 isExpanded: boolean;
79 hasToggle: boolean;
80 previousWidth: number;
81 }
82 declare class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSectionState> {
83 static displayName: string;
84 constructor(props: ExpandableSectionProps);
85 expandableContentRef: import("react").RefObject<HTMLDivElement>;
86 observer: any;
87 static defaultProps: PickOptional<ExpandableSectionProps>;
88 private calculateToggleText;
89 componentDidMount(): void;
90 componentDidUpdate(prevProps: ExpandableSectionProps): void;
91 componentWillUnmount(): void;
92 checkToggleVisibility: () => void;
93 resize: () => void;
94 handleResize: (...args: any[]) => void;
95 render(): import("react/jsx-runtime").JSX.Element;
96 }
97 export { ExpandableSection };
98 //# sourceMappingURL=ExpandableSection.d.ts.map