import { createElement } from "react";
/**
 * External dependencies
 */

/**
 * WordPress dependencies
 */

import { forwardRef } from '@wordpress/element';

/**
 * Internal dependencies
 */

import { TabPanel as StyledTabPanel } from './styles';
import warning from '@wordpress/warning';
import { useTabsContext } from './context';
export const TabPanel = forwardRef(function TabPanel({
  children,
  tabId,
  focusable = true,
  ...otherProps
}, ref) {
  const context = useTabsContext();
  if (!context) {
    typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning('`Tabs.TabPanel` must be wrapped in a `Tabs` component.') : void 0;
    return null;
  }
  const {
    store,
    instanceId
  } = context;
  const instancedTabId = `${instanceId}-${tabId}`;
  return createElement(StyledTabPanel, {
    ref: ref,
    store: store,
    id: instancedTabId,
    focusable: focusable,
    ...otherProps
  }, children);
});
//# sourceMappingURL=tabpanel.js.map