import { depth as depthTokens } from '@workday/canvas-kit-react/tokens' ; export type DepthTokens = typeof depthTokens ; export type DepthTokenKeys = keyof DepthTokens ; export type DepthTokenValues = DepthTokens [ keyof DepthTokens ] ; /** style props to for depth styles */ export type DepthStyleProps = { /** sets depth styles (box-shadow & border) */ depth ? : DepthTokenKeys ; } ; const depthProps = { depth : ( token ) => depthTokens [ token ] , } ; example export function depth < P extends DepthStyleProps > ( props ) { for ( const key in props ) { if ( key in depthProps ) { const token = props [ key as keyof DepthStyleProps ] as DepthTokenKeys ; const depthFn = depthProps [ key as keyof DepthStyleProps ] ; return depthFn ( token ) ; } } return { } as DepthTokenValues ; }