Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@vx/bounds
Advanced tools
npm install --save @vx/bounds
withBoundingRects
HOCIt's often useful to determine whether elements (e.g., tooltips) overflow the bounds of their parent container and adjust positioning accordingly. The withBoundingRects
higher-order component is meant to simplify this computation by passing in a component's bounding rect as well as its parent's bounding rect.
Example usage with a <Tooltip />
component
import React from 'react';
import PropTypes from 'prop-types';
import { withBoundingRects, withBoundingRectsProps } from '@vx/bounds';
const propTypes = {
...withBoundingRectsProps,
left: PropTypes.number.isRequired,
top: PropTypes.number.isRequired,
children: PropTypes.node,
};
const defaultProps = {
children: null,
};
function Tooltip({
left: initialLeft,
top: initialTop,
rect,
parentRect,
children,
}) {
let left = initialLeft;
let top = initialTop;
if (rect && parentRect) {
left = rect.right > parentRect.right ? (left - rect.width) : left;
top = rect.bottom > parentRect.bottom ? (top - rect.height) : top;
}
return (
<div style={{ top, left, ...myTheme }}>
{children}
</div>
);
}
Tooltip.propTypes = propTypes;
Tooltip.defaultProps = defaultProps;
export default withBoundingRects(Tooltip);
v0.0.195
useTooltip
hook addeduseState
, requires bumping the peerDep
for react to ^16.8.0-0
useState
to readme, add advice on HOC vs hooksBarStack
demo to use useTooltip
instead of withTooltip
Changes:
- @vx/annotation: 0.0.194 => 0.0.195
- @vx/axis: 0.0.194 => 0.0.195
- @vx/bounds: 0.0.194 => 0.0.195
- @vx/brush: 0.0.194 => 0.0.195
- @vx/chord: 0.0.194 => 0.0.195
- @vx/clip-path: 0.0.194 => 0.0.195
- @vx/curve: 0.0.194 => 0.0.195
- @vx/demo: 0.0.194 => 0.0.195
- @vx/drag: 0.0.194 => 0.0.195
- @vx/event: 0.0.194 => 0.0.195
- @vx/geo: 0.0.194 => 0.0.195
- @vx/glyph: 0.0.194 => 0.0.195
- @vx/gradient: 0.0.194 => 0.0.195
- @vx/grid: 0.0.194 => 0.0.195
- @vx/group: 0.0.194 => 0.0.195
- @vx/heatmap: 0.0.194 => 0.0.195
- @vx/hierarchy: 0.0.194 => 0.0.195
- @vx/legend: 0.0.194 => 0.0.195
- @vx/marker: 0.0.194 => 0.0.195
- @vx/mock-data: 0.0.194 => 0.0.195
- @vx/network: 0.0.194 => 0.0.195
- @vx/pattern: 0.0.194 => 0.0.195
- @vx/point: 0.0.194 => 0.0.195
- @vx/responsive: 0.0.194 => 0.0.195
- @vx/scale: 0.0.194 => 0.0.195
- @vx/shape: 0.0.194 => 0.0.195
- @vx/stats: 0.0.194 => 0.0.195
- @vx/text: 0.0.194 => 0.0.195
- @vx/threshold: 0.0.194 => 0.0.195
- @vx/tooltip: 0.0.194 => 0.0.195
- @vx/voronoi: 0.0.194 => 0.0.195
- @vx/vx: 0.0.194 => 0.0.195
- @vx/zoom: 0.0.194 => 0.0.195
FAQs
Utilities to make your life with bounding boxes better
The npm package @vx/bounds receives a total of 67,166 weekly downloads. As such, @vx/bounds popularity was classified as popular.
We found that @vx/bounds demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.