type Class = string | null | undefined | Class[];
export declare const concatClasses: (...classes: Class[]) => string | undefined;
/**
* Create an array from the src parameter.
* @param {*} src
* @returns src, if it is already an array; otherwise, an array containing src.
*/
export declare const toArray: (src: string | string[] | undefined | null) => string[];
/**
* Should be used to convert from a number between 1 and 12 to the corresponding months name.
* @param {*} month
* @returns The name of the month corresponding to the number given.
*/
export declare const MONTH_NAMES: string[];
export declare const getMonthName: (month: string, shorthand?: boolean) => string;
export declare const shortMonthText: (date: string) => string;
export declare const interpolateStringOperations: {
uppercase: (value: string) => string;
lowercase: (value: string) => string;
apostrophize: (value: string) => string;
increment: (value: number) => number;
shortMonthText: (value: string) => string;
};
/**
* Interpolate a string (potentially HTML) with variables.
* @param {*} template The template string
* @param {*} variables The values to be used in the interpolation
* @param {*} fallback (defaults to '')
* @returns A fully interpolated string.
* @example
* interpolateString('${item.label}', { item: { id: '1', label: 'Item 1' } });
* // Item 1
* @example
* interpolateString('${forename} ${surname}', { forename: 'William' }, 'Fallback-Smith');
* // William Fallback-Smith
*/
export declare const interpolateString: (template: any, variables: any, fallback?: string) => string;
/**
* Should be used for easy handling of BEM classes.
* @param {*} block
* @param {*} blockModifiers
* @param {*} blockExtra
* @returns A function that will itself return a string representation of the classes to apply to an element.
*/
export declare const classBuilder: (block: string, blockModifiers: string | string[] | null | undefined, blockExtra?: string[] | string | null) => (element?: string | null, elementModifiers?: string | string[] | null | undefined, elementExtra?: string[] | string | null | undefined) => string | undefined;
export declare const itemLabel: (structure: {
value: string;
label: string;
format?: string | undefined;
} | undefined | null) => (item: any) => any;
/**
* Takes an array and returns a string containing the entries in the array
* written out as a list.
*
* e.g. toWrittenList([ 'Bob', 'Sally', 'Fred'])
* > Bob, Sally and Fred
*
* e.g. toWrittenList([ 'jpeg', 'png', 'tif'], ' or', true)
* > JPEG, PNG or TIF
*
* @param {Array} array The array of entries to write as a list.
* @param {string} finalSeparator The string to use before the final entry, defaults to ' and'.
* @param {Boolean} uppercase Whether entries should be made uppercase.
* @returns The array as a written list.
*/
export declare const toWrittenList: (array: string[], finalSeparator?: string, uppercase?: boolean) => string;
/**
* Takes a value in bytes and returns the written version of that
* amount.
*
* e.g. toWrittenBytes(10500)
* > 10.50KB
*
* e.g. toWrittenBytes(25817000, 1)
* > 25.8MB
*
* @param {number} amount The amount to write out, in bytes.
* @param {number} decimals The number of decimal places to use, defaults to 2.
* @returns A written string of the given amount.
*/
export declare const toWrittenBytes: (amount: number | string, decimals?: number) => string;
export declare const COMPONENT_TYPES: {
DETAILS: string;
FILE_UPLOAD: string;
INPUT: string;
LABEL: string;
TEXT_AREA: string;
};
export declare const cleanHtmlAttributes: (attrs: Record, type?: string) => {
[k: string]: unknown;
};
declare const Utils: {
classBuilder: (block: string, blockModifiers: string | string[] | null | undefined, blockExtra?: string[] | string | null) => (element?: string | null, elementModifiers?: string | string[] | null | undefined, elementExtra?: string[] | string | null | undefined) => string | undefined;
cleanHtmlAttributes: (attrs: Record, type?: string) => {
[k: string]: unknown;
};
getMonthName: (month: string, shorthand?: boolean) => string;
interpolateString: (template: any, variables: any, fallback?: string) => string;
toArray: (src: string | string[] | undefined | null) => string[];
itemLabel: (structure: {
value: string;
label: string;
format?: string | undefined;
} | undefined | null) => (item: any) => any;
toWrittenList: (array: string[], finalSeparator?: string, uppercase?: boolean) => string;
toWrittenBytes: (amount: number | string, decimals?: number) => string;
};
export default Utils;