{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/components/IfElse/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype Condition = boolean | (() => boolean);\n\ninterface IfElseProps {\n  condition: Condition;\n  truthyComponent: React.ReactNode;\n  falsyComponent: React.ReactNode;\n}\n\nconst getConditionResult = (condition: Condition) => {\n  return typeof condition === 'function' ? condition() : condition;\n};\n\n/**\n * @description If-Else 조건부 렌더링을 사용하기 위한 컴포넌트입니다.\n *\n * @param {IfElseProps} props\n * @param {Condition} props.condition - 렌더링 조건 (boolean 또는 boolean을 반환하는 함수)\n * @param {React.ReactNode} props.truthyComponent - condition이 true일 때 렌더링될 컴포넌트\n * @param {React.ReactNode} props.falsyComponent - condition이 false일 때 렌더링될 컴포넌트\n * @returns {React.JSX.Element} 조건에 따라 trueComponent 또는 falseComponent를 렌더링\n *\n * @example\n * <IfElse\n *   condition={condition}\n *   truthyComponent={<TruthyComponent />}\n *   falsyComponent={<FalsyComponent />}\n * />\n */\nexport const IfElse = ({\n  condition,\n  truthyComponent,\n  falsyComponent,\n}: IfElseProps): React.JSX.Element => {\n  const conditionResult = getConditionResult(condition);\n  return <>{conditionResult ? truthyComponent : falsyComponent}</>;\n};\n"],"mappings":";;;;;AAUA,MAAM,sBAAsB,cAAyB;CACnD,OAAO,OAAO,cAAc,aAAa,WAAW,GAAG;;;;;;;;;;;;;;;;;;AAmBzD,MAAa,UAAU,EACrB,WACA,iBACA,qBACoC;CAEpC,OAAO,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UADiB,mBAAmB,UAClB,GAAG,kBAAkB,gBAAkB,CAAA"}