@wordpress/components
Version:
UI components for WordPress.
1 lines • 2.02 kB
Source Map (JSON)
{"version":3,"file":"row.cjs","names":["useRef","useMergeRefs","forwardRef"],"sources":["../../src/tree-grid/row.tsx"],"sourcesContent":["import { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport type { WordPressComponentProps } from '../context';\nimport type { TreeGridRowProps } from './types';\nimport { useValidateTreeGridStructure } from './use-validate-tree-grid-structure';\n\nfunction UnforwardedTreeGridRow(\n\t{\n\t\tchildren,\n\t\tlevel,\n\t\tpositionInSet,\n\t\tsetSize,\n\t\tisExpanded,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridRowProps, 'tr', false >,\n\tref: React.ForwardedRef< HTMLTableRowElement >\n) {\n\tconst rowRef = useRef< HTMLTableRowElement >( null );\n\tconst refs = useMergeRefs( [ rowRef, ref ] );\n\tuseValidateTreeGridStructure( 'TreeGridRow', rowRef );\n\n\treturn (\n\t\t<tr\n\t\t\t{ ...props }\n\t\t\tref={ refs }\n\t\t\trole=\"row\"\n\t\t\taria-level={ level }\n\t\t\taria-posinset={ positionInSet }\n\t\t\taria-setsize={ setSize }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t{ children }\n\t\t</tr>\n\t);\n}\n\n/**\n * `TreeGridRow` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGridRow = forwardRef( UnforwardedTreeGridRow );\nTreeGridRow.displayName = 'TreeGridRow';\n\nexport default TreeGridRow;\n"],"mappings":";;;;;;;;;;AAMA,SAAS,uBACR,EACC,UACA,OACA,eACA,SACA,YACA,GAAG,SAEJ,KACC;CACD,MAAM,UAAA,GAASA,mBAAAA,OAAAA,CAA+B,IAAK;CACnD,MAAM,QAAA,GAAOC,mBAAAA,aAAAA,CAAc,CAAE,QAAQ,GAAI,CAAE;CAC3C,CAAA,GAAA,sCAAA,6BAAA,CAA8B,eAAe,MAAO;CAEpD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EACC,GAAK;EACL,KAAM;EACN,MAAK;EACL,cAAa;EACb,iBAAgB;EAChB,gBAAe;EACf,iBAAgB;EAEd;CACC,CAAA;AAEN;;;;;;;;AASA,MAAa,eAAA,GAAcC,mBAAAA,WAAAA,CAAY,sBAAuB;AAC9D,YAAY,cAAc"}