import { FlexLayoutType } from '../utils/flexLayout'; import { generator } from '../theme'; export const breakpoints = ['xs', 'sm', 'md', 'lg', 'phone', 'tablet', 'tabletLandscape', 'desktop'] as const; export const spaceNames = ['mb', 'ml', 'mr', 'mt', 'pb', 'pl', 'pr', 'pt'] as const; type Truthy = boolean | 'true' | 'false'; /** * Helper Types */ export type BoolPropsFromArray> = Partial>; export type BoolProps = Partial>; export type StringProps = Partial>; export type MqProp = Partial> | T; export type Breakpoint = (typeof breakpoints)[number]; /** * GeneratedPropsTypes */ type IndexKeys = Exclude; type ListProp = { name: string; list?: object; helperFn?: Function; units?: string }; type ListPropValidation = { name: string; list?: object; helperFn?: undefined; units?: string }; type ListObject = { prefix?: string; list: object }; type ListObjectValidation = { prefix?: undefined; list: object }; type ListObjectWithPrefix = { prefix: string; list: object }; type GetName

= P extends ListPropValidation ? P['name'] : never; type GetNamesWithPrefix

= P extends ListObjectWithPrefix ? keyof P['list'] : never; type GetListKeys

= P extends ListProp ? keyof P['list'] : never; type GetNames

= P extends ListObjectValidation ? keyof P['list'] : never; type GetPrefixName

= P extends { prefix: string } ? P['prefix'] : never; type PropsFromList> = { [i in IndexKeys as GetName]?: MqProp> | MqProp; }; type NamedPropsFromList> = { [i in IndexKeys as GetNames]?: boolean; }; type NamedPropsWithPrefixFromList> = { [i in IndexKeys as `${GetPrefixName}${Capitalize< string & GetNamesWithPrefix >}`]?: boolean; }; type NamedProps = NamedPropsFromList & NamedPropsWithPrefixFromList; type SpaceProps = Partial>>; type VariableProps = PropsFromList; type HelperFnsProps = { fLayout?: MqProp; margin?: MqProp; padding?: MqProp; }; export type GeneratedPropTypes = NamedProps & SpaceProps & VariableProps & HelperFnsProps;