@oslokommune/punkt-react
Version:
React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo
21 lines (20 loc) • 827 B
TypeScript
import { JSX } from 'react';
export interface IMiddleTruncate {
children: string;
/** Trailing chars to preserve when the name is long enough to split. */
tail?: number;
}
type TTruncateContext = {
tail: number | undefined;
};
export declare const TruncateContext: import('react').Context<TTruncateContext>;
/**
* Middle-truncate a filename. Renders as a React fragment — the parent element
* (typically a `<p className="…__title">`) is the grid container that drives
* the layout via CSS in `_fileupload.scss`. The split threshold is shared with
* the Lit implementation through `splitFilenameForTruncation`.
*
* For short filenames the tail span is omitted and the text renders unwrapped.
*/
export declare const Truncate: ({ children, tail: tailProp }: IMiddleTruncate) => JSX.Element;
export {};