UNPKG

@wordpress/components

Version:
8 lines (7 loc) 1.45 kB
{ "version": 3, "sources": ["../../src/tree-grid/roving-tab-index.tsx"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { RovingTabIndexProvider } from './roving-tab-index-context';\n\n/**\n * Provider for adding roving tab index behaviors to tree grid structures.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default function RovingTabIndex({\n children\n}) {\n const [lastFocusedElement, setLastFocusedElement] = useState();\n\n // Use `useMemo` to avoid creation of a new object for the providerValue\n // on every render. Only create a new object when the `lastFocusedElement`\n // value changes.\n const providerValue = useMemo(() => ({\n lastFocusedElement,\n setLastFocusedElement\n }), [lastFocusedElement]);\n return /*#__PURE__*/_jsx(RovingTabIndexProvider, {\n value: providerValue,\n children: children\n });\n}"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAKlC,sCAAuC;AAOvC,yBAA4B;AACb,SAAR,eAAgC;AAAA,EACrC;AACF,GAAG;AACD,QAAM,CAAC,oBAAoB,qBAAqB,QAAI,yBAAS;AAK7D,QAAM,oBAAgB,wBAAQ,OAAO;AAAA,IACnC;AAAA,IACA;AAAA,EACF,IAAI,CAAC,kBAAkB,CAAC;AACxB,SAAoB,uCAAAA,KAAK,wDAAwB;AAAA,IAC/C,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;", "names": ["_jsx"] }