UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

1 lines 1.69 kB
{"version":3,"sources":["../../../src/system/types.ts"],"sourcesContent":["import type {\n RecipeVariantFn,\n RecipeVariantRecord,\n SlotRecipeVariantFn,\n SlotRecipeVariantRecord,\n} from 'styled-system/types'\nimport type { WithCss } from '../types'\nimport type { ElementType, PropsWithChildren } from 'react'\nimport type { ark } from '@ark-ui/react/factory'\n\n// Method signatures for recipes\n\ntype RecipeBase = {\n splitVariantProps: (\n props: Record<string, unknown>,\n ) => [Record<string, unknown>, Record<string, unknown>]\n}\n\nexport type CerberusRecipe = RecipeVariantFn<RecipeVariantRecord> & RecipeBase\nexport type CerberusSlotRecipe<T extends string> = SlotRecipeVariantFn<\n string,\n SlotRecipeVariantRecord<T>\n> &\n RecipeBase\n\nexport type CerberusPrimitiveRecipe =\n | CerberusRecipe\n | CerberusSlotRecipe<string>\n\nexport type WithRecipeOptions = {\n defaultProps?: Record<string, unknown>\n}\n\n// Primitive Response\n\nexport type CerberusPrimitiveProps<T> = WithCss & PropsWithChildren<T>\nexport type CerberusPrimitiveEl<T = object> = ElementType<\n CerberusPrimitiveProps<T>\n>\n\n// Factory\n\nexport type ArkPropsWithRef<T extends keyof typeof ark> = {\n [K in keyof (typeof ark)[T]]: K extends 'asChild' ? never : (typeof ark)[T][K]\n} & {\n asChild?: boolean\n}\n\nexport type CerberusFactoryFn = <T extends Record<string, unknown>>(\n component: keyof typeof ark,\n defaultProps?: T,\n) => CerberusPrimitiveEl\n\nexport type CerberusFactoryObject = {\n [K in keyof typeof ark]: CerberusPrimitiveEl\n}\n\nexport type CerberusFactory = CerberusFactoryFn & CerberusFactoryObject\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}