@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
25 lines (24 loc) • 879 B
TypeScript
import type { JSX } from "react";
/**
* Create a type that expands TProps with all native props from TElement (except
* properties already on TProps, and `ref`)
* @example
* type MyProps = PropsFor<'div', {
* // any custom props
* }>
*
* const MyComponent = forwardRef<HTMLDivElement, MyProps>((props, ref) => {
* return <div {...props} ref={ref}>...</div>
* })
*/
export type PropsFor<TElementName extends keyof JSX.IntrinsicElements, TProps extends object = object> = Omit<TProps & Omit<JSX.IntrinsicElements[TElementName], keyof TProps>, "ref">;
/**
* Union of Bifrost-supported color modes.
* `"system"` means to apply either light or dark depending on current OS or
* browser setting.
*/
export type ColorMode = "light" | "dark" | "system";
/**
* Union of Bifrost-supported color themes.
*/
export type ColorTheme = "teal" | "purple" | "pink" | "yellow";