
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
React component for handling clicks and focuses outside, which works with portals
React component for handling clicks and focuses outside
import Foco from 'react-foco';
const MyComponent3000 = () => (
<Foco
onClickOutside={() => console.log('Click Outside')}
onFocusOutside={() => console.log('Focus Outside')}
>
<button>Click Me</button>
{React.createPortal(<MyAnotherComponent />, portalNode)}
</Foco>
);
https://github.com/nanot1m/react-foco/releases
onClickOutside
— function called on clicks outside of wrapping nodesonFocusOutside
— function called on focus outside of wrapping nodesrender
— prop allows for inline rendering foco contentclassName
— class passed to wrapping nodestyle
— object with css properties passed to wrapping nodechildren
— children react elements or function the same as prop render
component
— component or tag which is used to render wrapper nodeThis prop are passed for callback in props render or children
className?: string
— class name provided from Foco componentstyle?: React.CSSProperties
— styles provided from Foco componentonMouseDown: React.MouseEventHandler
— handler for checking clicks outsideonFocus: React.FocusEventHandler
— handler for checking focuses outsideonTouchStart: React.TouchEventHandler
— handler for checking touches outsidefunction MyComponent() {
return (
<Foco onClickOutside={() => alert('click out')}>
{wrapperProps => (
<div
{...wrapperProps}
style={{ border: '1px solid skyblue', textAlign: 'center' }}
>
<p>Hola! Clicks outside would trigger alerts</p>
</div>
)}
</Foco>
);
}
yarn storybook
yarn test
FAQs
React component for handling clicks and focuses outside, which works with portals
We found that react-foco demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.