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.161
d3-scale-chromatic
, following d3's lead in release 5.0.0. #270@vx/scale
: schemeCategory10
, schemeCategory20
, schemeCategory20b
, schemeCategory20c
. #270containerProps
as a second HOC "config" argument of withTooltip(BaseComponent [, containerProps])
. This exposes a hook to enable users to customize any props on the container element. #272width
and height
to inherit
by default on the container. I'm kind of on the edge with this and am open to removing it because it may be an edge case, but my reasoning is as follows: if a user is combining withTooltip
and a responsive component like ParentSize
like this example, they'll have to update the withTooltip
container div
to also have full width/height so this would be a "smart default". #272d3-scale-chromatic
with vx/scale
. #270@vx/tooltip
components + enhancer. #272<AxisRight />
to /axis demo tile. #280npm run docs
script. #281Changes:
- @vx/annotation: 0.0.160 => 0.0.161
- @vx/axis: 0.0.160 => 0.0.161
- @vx/bounds: 0.0.153 => 0.0.161
- @vx/boxplot: 0.0.153 => 0.0.161
- @vx/brush: 0.0.153 => 0.0.161
- @vx/clip-path: 0.0.153 => 0.0.161
- @vx/curve: 0.0.153 => 0.0.161
- @vx/demo: 0.0.160 => 0.0.161
- @vx/drag: 0.0.157 => 0.0.161
- @vx/event: 0.0.153 => 0.0.161
- @vx/geo: 0.0.153 => 0.0.161
- @vx/glyph: 0.0.153 => 0.0.161
- @vx/gradient: 0.0.153 => 0.0.161
- @vx/grid: 0.0.160 => 0.0.161
- @vx/group: 0.0.153 => 0.0.161
- @vx/heatmap: 0.0.153 => 0.0.161
- @vx/hierarchy: 0.0.153 => 0.0.161
- @vx/legend: 0.0.154 => 0.0.161
- @vx/marker: 0.0.160 => 0.0.161
- @vx/mock-data: 0.0.153 => 0.0.161
- @vx/network: 0.0.153 => 0.0.161
- @vx/pattern: 0.0.153 => 0.0.161
- @vx/point: 0.0.153 => 0.0.161
- @vx/responsive: 0.0.158 => 0.0.161
- @vx/scale: 0.0.153 => 0.0.161
- @vx/shape: 0.0.160 => 0.0.161
- @vx/stats: 0.0.153 => 0.0.161
- @vx/text: 0.0.159 => 0.0.161
- @vx/tooltip: 0.0.160 => 0.0.161
- @vx/voronoi: 0.0.153 => 0.0.161
- @vx/vx: 0.0.160 => 0.0.161
- @vx/zoom: 0.0.153 => 0.0.161
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.