Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
return <div>{this.props.foo}</div>;
}
},
);
;
class PredefinedComponentClass extends Component<{ bar: number }> {
handleFocusOutside() {
console.log('Hello World!');
}
render() {
return <div>{this.props.bar}</div>;
}
}
const EnhancedComponentPredefinedClass = C.withFocusOutside(PredefinedComponentClass);
;
})();
(() => {
const EnhancedComponentClassExpression = C.withFocusOutside(
class extends Component<{ foo: string }> {
handleFocusOutside() {
console.log('Hello World!');
}
render() {
return <div>{this.props.foo}</div>;
}
},
);
;
class PredefinedComponentClass extends Component<{ bar: number }> {
handleFocusOutside() {
console.log('Hello World!');
}
render() {
import { Component } from '@wordpress/element';
/**
* WordPress transitional dependency: using a locally modified copy, until `@wordpress/components` updates the the SelectControl
* and implements the `disabled` attribute of its options.
* PR 15976: https://github.com/WordPress/gutenberg/pull/15976
*/
import BaseComponent from './wordpress-components-select-control-modified.js';
/**
* Internal dependencies
*/
import murielClassnames from '../../../shared/js/muriel-classnames';
import './style.scss';
const SelectControl = withFocusOutside(
class extends Component {
/**
* Constructor.
*/
constructor( props ) {
super( props );
this.state = {
isFocused: false,
};
}
/**
* A `withFocusOutside` HOC's default handler.
*/
handleFocusOutside() {
this.setState( { isFocused: false } );
this.getClassName( disabled, isEmpty, isActive )
);
return (
this.handleOnClick( onClick ) }
onFocus={ () => this.handleOnFocus( onFocus ) }
{ ...otherProps }
/>
);
}
}
export default withFocusOutside( TextControl );