@wordpress/components
Version:
UI components for WordPress.
8 lines (7 loc) • 2.13 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/tabs/tabpanel.tsx"],
"sourcesContent": ["/**\n * External dependencies\n */\nimport { useStoreState } from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { TabPanel as StyledTabPanel } from './styles';\nimport warning from '@wordpress/warning';\nimport { useTabsContext } from './context';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const TabPanel = forwardRef(function TabPanel({\n children,\n tabId,\n focusable = true,\n ...otherProps\n}, ref) {\n const context = useTabsContext();\n const selectedId = useStoreState(context?.store, 'selectedId');\n if (!context) {\n globalThis.SCRIPT_DEBUG === true ? warning('`Tabs.TabPanel` must be wrapped in a `Tabs` component.') : void 0;\n return null;\n }\n const {\n store,\n instanceId\n } = context;\n const instancedTabId = `${instanceId}-${tabId}`;\n return /*#__PURE__*/_jsx(StyledTabPanel, {\n ref: ref,\n store: store\n // For TabPanel, the id passed here is the id attribute of the DOM\n // element.\n // `tabId` is the id of the tab that controls this panel.\n ,\n id: `${instancedTabId}-view`,\n tabId: instancedTabId,\n focusable: focusable,\n ...otherProps,\n children: selectedId === instancedTabId && children\n });\n});"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAK9B,qBAA2B;AAM3B,oBAA2C;AAC3C,qBAAoB;AACpB,qBAA+B;AAC/B,yBAA4B;AACrB,IAAM,eAAW,2BAAW,SAASA,UAAS;AAAA,EACnD;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,GAAG,KAAK;AACN,QAAM,cAAU,+BAAe;AAC/B,QAAM,iBAAa,4BAAc,SAAS,OAAO,YAAY;AAC7D,MAAI,CAAC,SAAS;AACZ,eAAW,iBAAiB,WAAO,eAAAC,SAAQ,wDAAwD,IAAI;AACvG,WAAO;AAAA,EACT;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,iBAAiB,GAAG,UAAU,IAAI,KAAK;AAC7C,SAAoB,uCAAAC,KAAK,cAAAC,UAAgB;AAAA,IACvC;AAAA,IACA;AAAA,IAKA,IAAI,GAAG,cAAc;AAAA,IACrB,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,IACH,UAAU,eAAe,kBAAkB;AAAA,EAC7C,CAAC;AACH,CAAC;",
"names": ["TabPanel", "warning", "_jsx", "StyledTabPanel"]
}