1 | {"version":3,"file":"warnConditionallyRequiredProps.js","sourceRoot":"../src/","sources":["warn/warnConditionallyRequiredProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B;;;;;;;;;GASG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAqB,EACrB,KAAQ,EACR,aAAuB,EACvB,mBAA2B,EAC3B,SAAkB;IAElB,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAC/D,KAA+B,UAAa,EAAb,+BAAa,EAAb,2BAAa,EAAb,IAAa,EAAE;YAAzC,IAAM,gBAAgB,sBAAA;YACzB,IAAI,CAAC,CAAC,gBAAgB,IAAI,KAAK,CAAC,EAAE;gBAChC,IAAI,CAAI,aAAa,mBAAc,gBAAgB,4BAAuB,mBAAmB,gBAAa,CAAC,CAAC;aAC7G;SACF;KACF;AACH,CAAC","sourcesContent":["import { warn } from './warn';\n/**\n * Warns when props are required if a condition is met.\n *\n * @public\n * @param componentName - The name of the component being used.\n * @param props - The props passed into the component.\n * @param requiredProps - The name of the props that are required when the condition is met.\n * @param conditionalPropName - The name of the prop that the condition is based on.\n * @param condition - Whether the condition is met.\n */\nexport function warnConditionallyRequiredProps<P>(\n componentName: string,\n props: P,\n requiredProps: string[],\n conditionalPropName: string,\n condition: boolean,\n): void {\n if (condition === true && process.env.NODE_ENV !== 'production') {\n for (const requiredPropName of requiredProps) {\n if (!(requiredPropName in props)) {\n warn(`${componentName} property '${requiredPropName}' is required when '${conditionalPropName}' is used.'`);\n }\n }\n }\n}\n"]} |