jade-garden
Version:
Class utilities to compose class names and variants
46 lines (45 loc) • 2.23 kB
TypeScript
import { ClassNameValue, ClassProp, ClassValue, NestedTraits } from './types';
/**
* Conditionally combines class names, allowing for exclusion and inclusion of specific classes.
*
* @template T - The type of the input class value, which can be a string, number, array, or object.
* @param {T} input - The input class value to be processed by `cx`.
* @param {ClassNameValue} [exclude] - Class names to exclude from the result.
* @param {ClassNameValue} [include] - Class names to include in the result.
* @returns {string} A string of class names, conditionally combined and modified based on the options.
*/
export declare const cm: <T extends ClassValue>(input: T, exclude?: ClassNameValue, include?: ClassNameValue) => string;
export {
/**
* **This is an alias for [clsx/lite](https://github.com/lukeed/clsx/tree/master?tab=readme-ov-file#clsxlite)**.
* - Conditionally generates a string of class names from string arguments.
* - It concatenates the provided string arguments, separated by spaces,
* excluding any falsy values (null, undefined, '', 0, false).
*
* @param {...string} args - String arguments to conditionally include in the class name string.
* @returns {string} A string of class names.
*/
clsx as cn } from 'clsx/lite';
export {
/**
* **This is an alias for [clsx](https://github.com/lukeed/clsx)**.
* - Conditionally generates a string of class names.
* - Accepts multiple arguments of various types to build a class name string.
*
* @param {...*} args - Arguments to conditionally include in the class name string.
* Arguments can be strings, numbers, arrays, or objects.
* - Strings and numbers are directly appended.
* - Arrays are recursively processed.
* - Objects are processed where keys are class names and values are conditions.
* @returns {string} A string of class names.
*/
clsx as cx } from 'clsx';
/**
* Generates CSS class names and data attributes for a part of an anatomy.
*
* @template T - An interface defining the shape of the data attributes.
* @returns {string} A string of merged class names and data attributes.
*/
export declare const traits: <T extends Record<string, NestedTraits | ClassNameValue>>(props?: ClassProp & {
data?: T;
}) => string;