UNPKG

@renderlesskit/react

Version:

Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit

39 lines (38 loc) 1.75 kB
import { Booleanish } from "./types"; export declare const isNull: (value: any) => value is null; export declare function clamp(value: number, min?: number, max?: number): number; /** * Clamps a value to ensure it stays within the min and max range. * * @param value the value to clamp * @param min the minimum value * @param max the maximum value * * @see https://github.com/chakra-ui/chakra-ui/blob/c38892760257b9bbf1b63c05f7f9ccf1684a90b0/packages/utils/src/number.ts */ export declare function clampValue(value: number, min: number, max: number): number; /** * The candidate optimum point is the midpoint between the minimum value and * the maximum value. * * @see https://html.spec.whatwg.org/multipage/form-elements.html#the-meter-element:attr-meter-high-8:~:text=boundary.-,The%20optimum%20point */ export declare function getOptimumValue(min: number, max: number): number; /** * Convert a value to percentage based on lower and upper bound values * * @param value the value in number * @param min the minimum value * @param max the maximum value */ export declare function valueToPercent(value: number, min: number, max: number): number; export declare function isFunction(value: any): value is Function; export declare function isTouch(): boolean; export declare const dataAttr: (condition: boolean | undefined) => Booleanish; export declare const ariaAttr: (condition: boolean | undefined) => true | undefined; export declare const cx: (...classNames: any[]) => string; export declare function kebabCase(string: string): string; export declare function splitStateProps<T, P>(props: any, keys: readonly any[]): [T, P]; export * from "./date"; export * from "./useControllableState"; export * from "./useControlledState";