@wordpress/block-editor
Version:
8 lines (7 loc) • 3.32 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/components/warning/index.js"],
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nfunction Warning( { className, actions, children, secondaryActions } ) {\n\treturn (\n\t\t<div style={ { display: 'contents', all: 'initial' } }>\n\t\t\t<div className={ clsx( className, 'block-editor-warning' ) }>\n\t\t\t\t<div className=\"block-editor-warning__contents\">\n\t\t\t\t\t<p className=\"block-editor-warning__message\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t{ ( actions?.length > 0 || secondaryActions ) && (\n\t\t\t\t\t\t<div className=\"block-editor-warning__actions\">\n\t\t\t\t\t\t\t{ actions?.length > 0 &&\n\t\t\t\t\t\t\t\tactions.map( ( action, i ) => (\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__action\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ action }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ secondaryActions && (\n\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__secondary\"\n\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-warning__dropdown',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tnoIcons\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t{ secondaryActions.map(\n\t\t\t\t\t\t\t\t\t\t\t\t( item, pos ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ item.onClick }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ pos }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md\n */\nexport default Warning;\n"],
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,cAAc,WAAW,gBAAgB;AAClD,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAOxB,cAKC,YALD;AALL,SAAS,QAAS,EAAE,WAAW,SAAS,UAAU,iBAAiB,GAAI;AACtE,SACC,oBAAC,SAAI,OAAQ,EAAE,SAAS,YAAY,KAAK,UAAU,GAClD,8BAAC,SAAI,WAAY,KAAM,WAAW,sBAAuB,GACxD,+BAAC,SAAI,WAAU,kCACd;AAAA,wBAAC,OAAE,WAAU,iCACV,UACH;AAAA,KAEI,SAAS,SAAS,KAAK,qBAC1B,qBAAC,SAAI,WAAU,iCACZ;AAAA,eAAS,SAAS,KACnB,QAAQ,IAAK,CAAE,QAAQ,MACtB;AAAA,QAAC;AAAA;AAAA,UAEA,WAAU;AAAA,UAER;AAAA;AAAA,QAHI;AAAA,MAIP,CACC;AAAA,MACD,oBACD;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,MAAO;AAAA,UACP,OAAQ,GAAI,cAAe;AAAA,UAC3B,cAAe;AAAA,YACd,WAAW;AAAA,YACX,WACC;AAAA,UACF;AAAA,UACA,SAAO;AAAA,UAEL,gBACD,oBAAC,aACE,2BAAiB;AAAA,YAClB,CAAE,MAAM,QACP;AAAA,cAAC;AAAA;AAAA,gBACA,SAAU,KAAK;AAAA,gBAGb,eAAK;AAAA;AAAA,cAFD;AAAA,YAGP;AAAA,UAEF,GACD;AAAA;AAAA,MAEF;AAAA,OAEF;AAAA,KAEF,GACD,GACD;AAEF;AAKA,IAAO,kBAAQ;",
"names": []
}