{"version":3,"file":"ConditionalWrapper.cjs","names":[],"sources":["../../../src/components/ConditionalWrapper/ConditionalWrapper.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nexport interface ConditionalWrapperProps {\n    /** When `true`, the children are passed through `wrapper`. */\n    condition: boolean;\n    /** Wrapping function applied to the children when `condition` is `true`. */\n    wrapper: (children: ReactNode) => ReactNode;\n    /** Content that may be wrapped. */\n    children: ReactNode;\n}\n\n/**\n * Conditionally wraps its children with `wrapper`.\n *\n * Renders `wrapper(children)` when `condition` is `true`, otherwise renders the\n * children unchanged. Avoids duplicating a subtree just to add an optional\n * wrapping element (e.g. a link, tooltip or boundary).\n *\n * @param props - The conditional-wrapper props.\n * @returns The wrapped children when `condition` is `true`, else the children.\n */\nexport function ConditionalWrapper({\n    condition,\n    wrapper,\n    children,\n}: ConditionalWrapperProps): ReactNode {\n    return condition ? wrapper(children) : <>{children}</>;\n}\n"],"mappings":"mCAqBA,SAAgB,EAAmB,CAC/B,YACA,UACA,YACmC,CACnC,OAAO,EAAY,EAAQ,CAAQ,GAAI,EAAA,EAAA,IAAA,CAAA,EAAA,SAAA,CAAG,UAAW,CAAA,CACzD"}