@wordpress/components
Version:
UI components for WordPress.
8 lines (7 loc) • 2.05 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": ";AAGA,SAAS,qBAAqB;AAK9B,SAAS,kBAAkB;AAM3B,SAAS,YAAY,sBAAsB;AAC3C,OAAO,aAAa;AACpB,SAAS,sBAAsB;AAC/B,SAAS,OAAO,YAAY;AACrB,IAAM,WAAW,WAAW,SAASA,UAAS;AAAA,EACnD;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,GAAG,KAAK;AACN,QAAM,UAAU,eAAe;AAC/B,QAAM,aAAa,cAAc,SAAS,OAAO,YAAY;AAC7D,MAAI,CAAC,SAAS;AACZ,eAAW,iBAAiB,OAAO,QAAQ,wDAAwD,IAAI;AACvG,WAAO;AAAA,EACT;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,iBAAiB,GAAG,UAAU,IAAI,KAAK;AAC7C,SAAoB,qBAAK,gBAAgB;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"]
}