@spaced-out/ui-design-system
Version:
Sense UI components library
42 lines • 1.8 kB
TypeScript
interface TokenObject {
[key: string]: string;
}
export type SortOrder = 'asc' | 'desc';
export type SortBy = 'name' | 'value';
export interface TableDataItem {
id: string | number;
name: string;
value: string;
demo: string;
[key: string]: unknown;
}
export type TableData = Array<TableDataItem>;
export interface DataVariation {
title: string;
description: string;
}
export declare const dataVariations: Array<DataVariation>;
/**
*
* This function takes in an object containing key-value pairs of tokens,
* where values are strings representing numerical
* values with optional percentage or viewport units. It also takes in an optional
* sort order ('asc' or 'desc') and an optional sort by parameter ('name' or 'value').
*
* The function sorts the tokens by either their key names (if sortBy='name') or their
* numerical values (if sortBy='value'). The sort order can be specified as
* ascending (order='asc') or descending (order='desc').
*
* The function handles values with different units by comparing their numerical values.
* If both values have the same unit, their numerical values are compared directly.
* If their units are different, tokens with percentage values are considered greater than
* those with viewport units, and tokens without a percentage or viewport unit are compared
* based on their numerical values.
*
*/
export declare const getSortedTokenNames: (obj: TokenObject, order?: SortOrder, sortBy?: SortBy) => Array<string>;
export declare const filterTableDataBySearchText: (TABLE_DATA: TableData, searchText: string) => TableData;
export declare const getRandomDataVariation: () => DataVariation;
export declare const handleDownload: (filePath: string, fileName: string) => void;
export {};
//# sourceMappingURL=tokens.d.ts.map