UNPKG

@wordpress/block-editor

Version:
8 lines (7 loc) 1.56 kB
{ "version": 3, "sources": ["../../../src/components/fit-text-size-warning/index.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Notice } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Component that checks if the fit text computed font size is below a minimum\n * threshold and displays a warning notice.\n *\n * @return {Element|null} Warning notice element or null.\n */\nexport default function FitTextSizeWarning() {\n\tconst message = __(\n\t\t'The text may be too small to read. Consider using a larger container or less text.'\n\t);\n\n\t// Note: The `Notice` component can speak messages via its `spokenMessage`\n\t// prop, but similar to the contrast checker, we use granular control over\n\t// when the announcements are made.\n\tuseEffect( () => {\n\t\tspeak( message );\n\t}, [ message ] );\n\n\treturn (\n\t\t<div className=\"block-editor-fit-text-size-warning\">\n\t\t\t<Notice\n\t\t\t\tspokenMessage={ null }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tisDismissible={ false }\n\t\t\t>\n\t\t\t\t{ message }\n\t\t\t</Notice>\n\t\t</div>\n\t);\n}\n"], "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,aAAa;AAsBnB;AAdY,SAAR,qBAAsC;AAC5C,QAAM,UAAU;AAAA,IACf;AAAA,EACD;AAKA,YAAW,MAAM;AAChB,UAAO,OAAQ;AAAA,EAChB,GAAG,CAAE,OAAQ,CAAE;AAEf,SACC,oBAAC,SAAI,WAAU,sCACd;AAAA,IAAC;AAAA;AAAA,MACA,eAAgB;AAAA,MAChB,QAAO;AAAA,MACP,eAAgB;AAAA,MAEd;AAAA;AAAA,EACH,GACD;AAEF;", "names": [] }