
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
React component to temporary show some components/elements.
autoHide
property).onShow
property) or hidden (onHide
property).visible
property.npm install tempshow --save
import TempShow from 'tempshow';
// ...
export class Foo extends React.Component {
constructor(props) {
super(props);
this.handleVisibleChange = this.handleVisibleChange.bind(this);
}
// ...
/**
* Handle component's visibility change.
*
* @param {boolean} visible
* `true`, when component became visible, `false`, when component became invisible.
*/
handleVisibleChange(visible) {
// ...
}
render() {
// ...
return (
<TempShow
className="overlay"
showClassName="opaque"
hideClassName="transparent"
autoHide={10}
onShow={this.handleVisibleChange}
onHide={this.handleVisibleChange}
visible={boolValueToControlVisibility}
showOnMouseOver={boolValueToControlShowOnMouseOver}
hideOnMouseLeave={true}
toggleVisibleOnClick={false}
>
<div className="content">
Some content here.
</div>
</TempShow>
);
}
}
Prop | Type | Default | Description |
---|---|---|---|
autoHide | number | 5 | Number of seconds after which component should be hidden automatically. When zero or negative value is specified auto hiding is not applied. |
children | React node | Component's children. | |
className | string | A CSS class that should be set for component's root element. | |
component | React elementType | div | Component's root element type. |
componentProps | object | Any properties (except for className and style ) that should be passed to component. | |
componentRef | function, object | An optional ref callback to get reference to the root (top-most) element of the rendered component. Just like other refs, this will provide null when it unmounts. | |
hideClassName | string | An additional CSS class that should be set for component's root element when component is hidden. | |
hideForClick | function | hideForClick | Function that will be used to determine whether component should be hidden on a mouse click when value of hideOnAnyClick prop is false . The following arguments will be passed into function: event data (SyntheticEvent ) and component's object. If function returns a true value, component will be hidden. |
hideOnAnyClick | boolean | false | Whether component should be hidden on any mouse click. |
hideOnBlur | boolean or function | false | Whether component should be hidden on blur event. A function can be specified to determine whether component should be hidden. The following arguments will be passed into function: event data (SyntheticEvent ) and component's object. If the function returns a true value, component will be hidden. |
hideOnMouseLeave | boolean | false | Whether component should be hidden when mouse leaves area of component's root DOM element. |
hideStyle | object | Styles that should be assigned for hidden component. | |
postponeAutoHide | boolean | true | Whether component's autohiding should be postponed when component props are changed. |
showClassName | string | An additional CSS class that should be set for component's root element when component is visible. | |
showOnFocus | boolean or function | true | Whether component should be shown on focus event. A function can be specified to determine whether component should be shown. The following arguments will be passed into function: event data (SyntheticEvent ) and component's object. If the function returns a true value, component will be shown. |
showOnMouseOver | boolean | true | Should component be shown on mouse over? |
showStyle | object | Styles that should be assigned for visible component. | |
toggleVisibleOnClick | boolean | true | Whether component visibility should be toggled on a mouse click. |
visible | boolean | false | Should component be visible? Can be used to explicitly control component's visibility. |
onHide | function | Function that should be called on component hidding. | |
onShow | function | Function that should be called on component show. |
Default function that is used to determine whether component should be hidden on a mouse click.
Return true
when component's root DOM element is clicked.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add tests for any new functionality.
Copyright (c) 2019-2020 Denis Sikuler
Licensed under the MIT license.
[1.1.0] - 2020-09-14
componentProps
, hideOnBlur
and showOnFocus
properties.FAQs
React component to temporary show some components/elements
We found that tempshow 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.