UNPKG

@wordpress/block-library

Version:
1 lines • 1.88 kB
{"version":3,"file":"deleted-navigation-warning.cjs","names":["useState","createInterpolateElement","__","Button","WCNotice","Warning"],"sources":["../../../src/navigation/edit/deleted-navigation-warning.jsx"],"sourcesContent":["import { Warning } from '@wordpress/block-editor';\nimport { Button, Notice as WCNotice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\nfunction DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {\n\tconst [ isButtonDisabled, setIsButtonDisabled ] = useState( false );\n\n\tconst handleButtonClick = () => {\n\t\tsetIsButtonDisabled( true );\n\t\tonCreateNew();\n\t};\n\n\tconst message = createInterpolateElement(\n\t\t__(\n\t\t\t'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tdisabled={ isButtonDisabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn isNotice ? (\n\t\t<WCNotice status=\"warning\" isDismissible={ false }>\n\t\t\t{ message }\n\t\t</WCNotice>\n\t) : (\n\t\t<Warning>{ message }</Warning>\n\t);\n}\n\nexport default DeletedNavigationWarning;\n"],"mappings":";;;;;;;;;;;AAKA,SAAS,yBAA0B,EAAE,aAAa,WAAW,SAAU;CACtE,MAAM,CAAE,kBAAkB,wBAAA,GAAwBA,mBAAAA,SAAAA,CAAU,KAAM;CAElE,MAAM,0BAA0B;EAC/B,oBAAqB,IAAK;EAC1B,YAAY;CACb;CAEA,MAAM,WAAA,GAAUC,mBAAAA,yBAAAA,EAAAA,GACfC,gBAAAA,GAAAA,CACC,yFACD,GACA,EACC,QACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EACC,uBAAA;EACA,SAAU;EACV,SAAQ;EACR,UAAW;EACX,wBAAA;CACA,CAAA,EAEH,CACD;CAEA,OAAO,WACN,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EAAU,QAAO;EAAU,eAAgB;EACxC,UAAA;CACO,CAAA,IAEV,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAD,EAAA,UAAW,QAAkB,CAAA;AAE/B"}