UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

49 lines (48 loc) 2.28 kB
import React from "react"; import { ContentBlobTogglerProps } from "./../../index"; 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; /** * Use only parts of `content` in the preview. * `firstMarkdownSection` uses the content until the first double line return. * Currently overwritten by `firstNonEmptyLineOnly`. */ useOnly?: "firstNonEmptyLine" | "firstMarkdownSection"; /** * 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; /** * If only the first non-empty line should be shown in the preview. * This will in addition also be shortened according to `previewMaxLength`. * @deprecated (v26) use `useOnly="firstNonEmptyLine"` instead */ firstNonEmptyLineOnly?: boolean; } /** Version of the content toggler for text centric content. */ export declare function StringPreviewContentBlobToggler({ className, previewMaxLength, toggleExtendText, toggleReduceText, content, fullviewContent, startExtended, useOnly, renderPreviewAsMarkdown, allowedHtmlElementsInPreview, noTogglerContentSuffix, firstNonEmptyLineOnly, }: 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 {};