@wordpress/components
Version:
UI components for WordPress.
1 lines • 1.26 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/isolated-event-container/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, MouseEvent } from 'react';\nimport { forwardRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\nfunction stopPropagation( event: MouseEvent ) {\n\tevent.stopPropagation();\n}\n\ntype DivProps = ComponentPropsWithoutRef< 'div' >;\n\nconst IsolatedEventContainer = forwardRef< HTMLDivElement, DivProps >(\n\t( props, ref ) => {\n\t\tdeprecated( 'wp.components.IsolatedEventContainer', {\n\t\t\tsince: '5.7',\n\t\t} );\n\n\t\t// Disable reason: this stops certain events from propagating outside of the component.\n\t\t// - onMouseDown is disabled as this can cause interactions with other DOM elements.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\treturn <div { ...props } ref={ ref } onMouseDown={ stopPropagation } />;\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\t}\n);\n\nexport default IsolatedEventContainer;\n"],"mappings":";;;;AAIA,SAAS,gBAAiB,OAAoB;CAC7C,MAAM,gBAAgB;AACvB;AAIA,MAAM,yBAAyB,YAC5B,OAAO,QAAS;CACjB,WAAY,wCAAwC,EACnD,OAAO,MACR,CAAE;CAKF,OAAO,oBAAC,OAAD;EAAK,GAAK;EAAc;EAAM,aAAc;CAAmB,CAAA;AAEvE,CACD"}