UNPKG

@wordpress/block-library

Version:
8 lines (7 loc) 1.82 kB
{ "version": 3, "sources": ["../../../src/navigation/edit/deleted-navigation-warning.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button, Notice } 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<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t{ message }\n\t\t</Notice>\n\t) : (\n\t\t<Warning>{ message }</Warning>\n\t);\n}\n\nexport default DeletedNavigationWarning;\n"], "mappings": ";AAGA,SAAS,eAAe;AACxB,SAAS,QAAQ,cAAc;AAC/B,SAAS,UAAU;AACnB,SAAS,UAAU,gCAAgC;AAgB/C;AAdJ,SAAS,yBAA0B,EAAE,aAAa,WAAW,MAAM,GAAI;AACtE,QAAM,CAAE,kBAAkB,mBAAoB,IAAI,SAAU,KAAM;AAElE,QAAM,oBAAoB,MAAM;AAC/B,wBAAqB,IAAK;AAC1B,gBAAY;AAAA,EACb;AAEA,QAAM,UAAU;AAAA,IACf;AAAA,MACC;AAAA,IACD;AAAA,IACA;AAAA,MACC,QACC;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,SAAU;AAAA,UACV,SAAQ;AAAA,UACR,UAAW;AAAA,UACX,wBAAsB;AAAA;AAAA,MACvB;AAAA,IAEF;AAAA,EACD;AAEA,SAAO,WACN,oBAAC,UAAO,QAAO,WAAU,eAAgB,OACtC,mBACH,IAEA,oBAAC,WAAU,mBAAS;AAEtB;AAEA,IAAO,qCAAQ;", "names": [] }