UNPKG

@wordpress/block-editor

Version:
8 lines (7 loc) 1.91 kB
{ "version": 3, "sources": ["../../../src/components/inserter-listbox/item.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Button, Composite } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\n\nfunction InserterListboxItem(\n\t{ isFirst, as: Component, children, ...props },\n\tref\n) {\n\treturn (\n\t\t<Composite.Item\n\t\t\tref={ ref }\n\t\t\trole=\"option\"\n\t\t\t// Use the Composite.Item `accessibleWhenDisabled` prop\n\t\t\t// over Button's `isFocusable`. The latter was shown to\n\t\t\t// cause an issue with tab order in the inserter list.\n\t\t\taccessibleWhenDisabled\n\t\t\t{ ...props }\n\t\t\trender={ ( htmlProps ) => {\n\t\t\t\tconst propsWithTabIndex = {\n\t\t\t\t\t...htmlProps,\n\t\t\t\t\ttabIndex: isFirst ? 0 : htmlProps.tabIndex,\n\t\t\t\t};\n\t\t\t\tif ( Component ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Component { ...propsWithTabIndex }>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</Component>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( typeof children === 'function' ) {\n\t\t\t\t\treturn children( propsWithTabIndex );\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<Button __next40pxDefaultSize { ...propsWithTabIndex }>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( InserterListboxItem );\n"], "mappings": ";AAGA,SAAS,QAAQ,iBAAiB;AAClC,SAAS,kBAAkB;AAsBrB;AApBN,SAAS,oBACR,EAAE,SAAS,IAAI,WAAW,UAAU,GAAG,MAAM,GAC7C,KACC;AACD,SACC;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MAIL,wBAAsB;AAAA,MACpB,GAAG;AAAA,MACL,QAAS,CAAE,cAAe;AACzB,cAAM,oBAAoB;AAAA,UACzB,GAAG;AAAA,UACH,UAAU,UAAU,IAAI,UAAU;AAAA,QACnC;AACA,YAAK,WAAY;AAChB,iBACC,oBAAC,aAAY,GAAG,mBACb,UACH;AAAA,QAEF;AACA,YAAK,OAAO,aAAa,YAAa;AACrC,iBAAO,SAAU,iBAAkB;AAAA,QACpC;AACA,eACC,oBAAC,UAAO,uBAAqB,MAAG,GAAG,mBAChC,UACH;AAAA,MAEF;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,eAAQ,WAAY,mBAAoB;", "names": [] }