UNPKG

@mujo/box

Version:

A React utility to add a style guide to primative components

36 lines (35 loc) 1.27 kB
import { CSSObject } from '@emotion/react'; import React from 'react'; declare type FlexAlignment = 'flexStart' | 'flexEnd' | 'stretch' | 'center' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly'; export interface BoxStyleProps { alignItems: FlexAlignment; alignSelf: FlexAlignment; flexDirection: 'row' | 'column' | 'rowReverse' | 'columnReverse'; flexWrap: 'nowrap' | 'wrap' | 'wrap-reverse'; flex: number; flexShrink: number; flexBasis: number; justifyContent: FlexAlignment; } declare type PassedComponent = React.ElementType; declare type ElementProps<T, K> = Exclude<K, keyof T>; export declare type BoxProps<T, K = React.BaseHTMLAttributes<HTMLDivElement>> = ElementProps<T, K> & { Component: PassedComponent; css: CSSObject; }; export declare type MakeBoxProps<T, K = React.BaseHTMLAttributes<HTMLDivElement>> = Partial<BoxProps<T, K> & SubObjectKeys<T>>; export declare type SubObjectKeys<T> = { [K in keyof T]: T[K] extends object ? keyof T[K] : never; }; export interface StyleGuideHash { [key: string]: { [value: string]: { [property: string]: unknown; }; }; } export interface StyleGuideValue { defaultComponent: PassedComponent; styleGuide: StyleGuideHash; } export {};