@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
33 lines (32 loc) • 1.85 kB
TypeScript
import React from "react";
import { ContentBlobTogglerProps } from "./..";
export interface StringPreviewContentBlobTogglerProps extends Omit<ContentBlobTogglerProps, "previewContent" | "enableToggler"> {
/**
The preview content will be cut to this length if it is too long.
*/
previewMaxLength?: number;
/**
The content string. If it is smaller than previewMaxLength this will be displayed in full, else fullviewContent will be displayed.
*/
content: string;
/** If only the first non-empty line should be shown in the preview. This will in addition also be shortened according to previewMaxLength. */
firstNonEmptyLineOnly?: boolean;
/** If enabled the preview is rendered as markdown. */
renderPreviewAsMarkdown?: boolean;
/** White-listing of HTML elements that will be rendered when renderPreviewAsMarkdown is enabled. */
allowedHtmlElementsInPreview?: string[];
/** Allows to add non-string elements at the end of the content if the full description is shown, i.e. no toggler is necessary.
* This allows to add non-string elements to both the full-view content and the pure string content.
*/
noTogglerContentSuffix?: JSX.Element;
}
/** Version of the content toggler for text only content. */
export declare function StringPreviewContentBlobToggler({ className, previewMaxLength, toggleExtendText, toggleReduceText, content, fullviewContent, startExtended, firstNonEmptyLineOnly, renderPreviewAsMarkdown, allowedHtmlElementsInPreview, noTogglerContentSuffix, }: StringPreviewContentBlobTogglerProps): React.JSX.Element;
/**
* Takes the first non-empty line from a preview string.
*/
declare function firstNonEmptyLine(preview: string): string;
export declare const stringPreviewContentBlobTogglerUtils: {
firstNonEmptyLine: typeof firstNonEmptyLine;
};
export {};