
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
@eps1lon/mui-react-events
Advanced tools
React is a JavaScript library for building user interfaces.
react-events
This package is experimental. It is intended for use with the experimental React events API that is not available in open source builds.
Event components do not render a host node. They listen to native browser events dispatched on the host node of their child and transform those events into high-level events for applications.
The Focus
module responds to focus and blur events on the element it wraps.
Focus events are dispatched for mouse
, pen
, touch
, and keyboard
pointer types.
// Example
const TextField = (props) => (
<Focus
onBlur={props.onBlur}
onFocus={props.onFocus}
>
<textarea></textarea>
</Focus>
);
// Types
type FocusEvent = {
target: Element,
type: 'blur' | 'focus' | 'focuschange'
}
Disables all Focus
events.
Called when the element loses focus.
Called when the element gains focus.
Called when the element changes hover state (i.e., after onBlur
and
onFocus
).
The Hover
module responds to hover events on the element it wraps. Hover
events are only dispatched for mouse
pointer types. Hover begins when the
pointer enters the element's bounds and ends when the pointer leaves.
// Example
const Link = (props) => (
const [ hovered, setHovered ] = useState(false);
return (
<Hover onHoverChange={setHovered}>
<a
{...props}
href={props.href}
style={{
...props.style,
textDecoration: hovered ? 'underline': 'none'
}}
/>
</Hover>
);
);
// Types
type HoverEvent = {
pointerType: 'mouse',
target: Element,
type: 'hoverstart' | 'hoverend' | 'hovermove' | 'hoverchange'
}
The duration of the delay between when hover ends and when onHoverEnd
is
called.
The duration of the delay between when hover starts and when onHoverStart
is
called.
Disables all Hover
events.
Called when the element changes hover state (i.e., after onHoverStart
and
onHoverEnd
).
Called once the element is no longer hovered. It will be cancelled if the
pointer leaves the element before the delayHoverStart
threshold is exceeded.
Called when the pointer moves within the hit bounds of the element. onHoverMove
is
called immediately and doesn't wait for delayed onHoverStart
.
Called once the element is hovered. It will not be called if the pointer leaves
the element before the delayHoverStart
threshold is exceeded. And it will not
be called more than once before onHoverEnd
is called.
Whether to preventDefault()
native events.
The Press
module responds to press events on the element it wraps. Press
events are dispatched for mouse
, pen
, touch
, and keyboard
pointer types.
Press events are only dispatched for keyboards when pressing the Enter or
Spacebar keys. If neither onPress
nor onLongPress
are called, this signifies
that the press ended outside of the element hit bounds (i.e., the user aborted
the press).
// Example
const Button = (props) => (
const [ pressed, setPressed ] = useState(false);
return (
<Press
onPress={props.onPress}
onPressChange={setPressed}
onLongPress={props.onLongPress}
>
<div
{...props}
role="button"
tabIndex={0}
style={
...buttonStyles,
...(pressed && pressedStyles)
}}
/>
</Press>
);
);
// Types
type PressEvent = {
pointerType: 'mouse' | 'touch' | 'pen' | 'keyboard',
target: Element,
type: 'press' | 'pressstart' | 'pressend' | 'presschange' | 'pressmove' | 'longpress' | 'longpresschange'
}
type PressOffset = {
top: number,
right: number,
bottom: number,
right: number
};
The duration of a press before onLongPress
and onLongPressChange
are called.
The duration of the delay between when the press ends and when onPressEnd
is
called.
The duration of a delay between when the press starts and when onPressStart
is
called. This delay is cut short (and onPressStart
is called) if the press is
released before the threshold is exceeded.
Disables all Press
events.
Called once the element has been pressed for the length of delayLongPress
. If
the press point moves more than 10px onLongPress
is cancelled.
Called when the element changes long-press state.
Determines whether calling onPress
should be cancelled if onLongPress
or
onLongPressChange
have already been called. Default is false
.
Called immediately after a press is released, unless either 1) the press is
released outside the hit bounds of the element (accounting for
pressRetentionOffset
and TouchHitTarget
), or 2) the press was a long press,
and onLongPress
or onLongPressChange
props are provided, and
onLongPressCancelsPress()
is true
.
Called when the element changes press state (i.e., after onPressStart
and
onPressEnd
).
Called once the element is no longer pressed (because it was released, or moved
beyond the hit bounds). If the press starts again before the delayPressEnd
threshold is exceeded then the delay is reset to prevent onPressEnd
being
called during a press.
Called when a press moves within the hit bounds of the element. onPressMove
is
called immediately and doesn't wait for delayed onPressStart
. Never called for
keyboard-initiated press events.
Called once the element is pressed down. If the press is released before the
delayPressStart
threshold is exceeded then the delay is cut short and
onPressStart
is called immediately.
Defines how far the pointer (while held down) may move outside the bounds of the element before it is deactivated. Once deactivated, the pointer (still held down) can be moved back within the bounds of the element to reactivate it. Ensure you pass in a constant to reduce memory allocations.
Whether to preventDefault()
native events. Native behavior is prevented by
default. If an anchor is the child of Press
, internal and external navigation
should be performed in onPress
/onLongPress
. To rely on native behavior
instead, set preventDefault
to false
, but be aware that native behavior will
take place immediately after interaction without respect for delays or long
press.
FAQs
React is a JavaScript library for building user interfaces.
The npm package @eps1lon/mui-react-events receives a total of 0 weekly downloads. As such, @eps1lon/mui-react-events popularity was classified as not popular.
We found that @eps1lon/mui-react-events 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.