{"version":3,"file":"component.mjs","names":[],"sources":["../../../src/tools-panel/tools-panel-item/component.tsx"],"sourcesContent":["import type { ForwardedRef } from 'react';\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst UnconnectedToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nexport const ToolsPanelItem = contextConnect(\n\tUnconnectedToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ToolsPanelItem;\n"],"mappings":";;;;;AASA,MAAM,6BACL,OACA,iBACI;CACJ,MAAM,EACL,UACA,SACA,yBACA,GAAG,wBACA,kBAAmB,KAAM;CAE7B,IAAK,CAAE,SACN,OAAO,0BACN,oBAAC,MAAD;EAAM,GAAK;EAAsB,KAAM;CAAgB,CAAA,IACpD;CAGL,OACC,oBAAC,MAAD;EAAM,GAAK;EAAsB,KAAM;EACpC;CACG,CAAA;AAER;AAEA,MAAa,iBAAiB,eAC7B,2BACA,gBACD"}