UNPKG

jade-garden

Version:

Class utilities to compose class names and variants

51 lines (50 loc) 2.51 kB
import { MergeClassFn } from './types'; /** * Returns the class names for the `raw` method in `cva` and `sva` functions. * Constructs a raw class name based on the component's name, slot, and variants. * * @param {object} options - The options object. * @param {Record<string, any> | undefined} options.compoundVariants - The compound variants object. * @param {string | undefined} options.name - The component name. * @param {Record<string, any> | undefined} options.props - The props object. * @param {Record<string, any> | undefined} options.variants - The variants object. * @param {string | undefined} [options.slotKey] - The slot key (for `sva`). * @param {Record<string, any> | undefined} [options.slotProps] - The slot props (for `sva`). * @returns {string} A string of raw class names. */ export declare const getRawClasses: (options: { compoundVariants: Record<string, any> | undefined; name: string | undefined; props: Record<string, any> | undefined; variants: Record<string, any> | undefined; slotKey?: string; slotProps?: Record<string, any>; }) => string; /** * Retrieves variant classes based on provided configuration and props. * * @param {object} options - The options object. * @param {Record<string, any> | undefined} options.defaultVariants - The default variants object. * @param {MergeClassFn} options.mergeClass - The function to merge class names. * @param {Record<string, any> | undefined} options.props - The props object. * @param {Record<string, any> | undefined} options.variants - The variants object. * @param {string | undefined} [options.slotKey] - The slot key (for `sva`). * @param {Record<string, any> | undefined} [options.slotProps] - The slot props (for `sva`). * @returns {string} A string of variant class names. */ export declare const getVariantClasses: (options: { defaultVariants: Record<string, any> | undefined; mergeClass: MergeClassFn; props: Record<string, any> | undefined; variants: Record<string, any> | undefined; slotKey?: string; slotProps?: Record<string, any>; }) => string; /** * Checks if a given configuration object matches the provided props. * * @param {Record<string, unknown>} config - The configuration object. * @param {Record<string, unknown>} props - The props object. * @returns {boolean} True if the configuration matches the props, false otherwise. */ export declare const hasProps: (config: Record<string, unknown>, props: Record<string, unknown>) => boolean;