Gathering detailed insights and metrics for jsweetman-re-resizable
Gathering detailed insights and metrics for jsweetman-re-resizable
Gathering detailed insights and metrics for jsweetman-re-resizable
Gathering detailed insights and metrics for jsweetman-re-resizable
npm install jsweetman-re-resizable
Typescript
Module System
Node Version
NPM Version
73.6
Supply Chain
99.4
Quality
75.1
Maintenance
100
Vulnerability
100
License
TypeScript (95.13%)
JavaScript (3.34%)
HTML (0.89%)
Shell (0.51%)
CSS (0.13%)
Total Downloads
30,227
Last Day
2
Last Week
5
Last Month
10
Last Year
111
2,506 Stars
1,049 Commits
221 Forks
13 Watching
61 Branches
58 Contributors
Minified
Minified + Gzipped
Latest Version
4.7.2
Package Id
jsweetman-re-resizable@4.7.2
Unpacked Size
116.00 kB
Size
21.60 kB
File Count
10
NPM Version
6.1.0
Node Version
10.6.0
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
66.7%
5
Compared to previous week
Last month
0%
10
Compared to previous month
Last year
-22.9%
111
Compared to previous year
38
📏 A resizable component for React.
1$ npm install --save re-resizable
defaultSize
1<Resizable 2 defaultSize={{ 3 width:320, 4 height:200, 5 }} 6> 7 Sample with default size 8</Resizable>
size
If you use size
props, please manage state by yourself.
1<Resizable 2 size={{ width: this.state.width, height: this.state.height }} 3 onResizeStop={(e, direction, ref, d) => { 4 this.setState({ 5 width: this.state.width + d.width, 6 height: this.state.height + d.height, 7 }); 8 }} 9> 10 Sample with size 11</Resizable>
defaultSize?: { width: (number | string), height: (number | string) };
Specifies the width
and height
that the dragged item should start at.
For example, you can set 300
, '300px'
, 50%
.
If both defaultSize
and size
omitted, set 'auto'
.
defaultSize
will be ignored when size
set.
size?: { width: (number | string), height: (number | string) };
The size
property is used to set the size of the component.
For example, you can set 300
, '300px'
, 50%
.
Use size
if you need to control size state by yourself.
className?: string;
The className
property is used to set the custom className
of a resizable component.
style?: { [key: string]: string };
The style
property is used to set the custom style
of a resizable component.
minWidth?: number | string;
The minWidth
property is used to set the minimum width of a resizable component. Defaults to 10px.
minHeight?: number | string;
The minHeight
property is used to set the minimum height of a resizable component. Defaults to 10px.
maxWidth?: number | string;
The maxWidth
property is used to set the maximum width of a resizable component.
maxHeight?: number | string
;The maxHeight
property is used to set the maximum height of a resizable component.
grid?: [number, number];
The grid
property is used to specify the increments that resizing should snap to. Defaults to [1, 1]
.
lockAspectRatio?: boolean | number;
The lockAspectRatio
property is used to lock aspect ratio.
Set to true
to lock the aspect ratio based on the initial size.
Set to a numeric value to lock a specific aspect ratio (such as 16/9
).
If set to numeric, make sure to set initial height/width to values with correct aspect ratio.
If omitted, set false
.
lockAspectRatioExtraWidth?: number;
The lockAspectRatioExtraWidth
property enables a resizable component to maintain an aspect ratio plus extra width.
For instance, a video could be displayed 16:9 with a 50px side bar.
If omitted, set 0
.
lockAspectRatioExtraHeight?: number;
The lockAspectRatioExtraHeight
property enables a resizable component to maintain an aspect ratio plus extra height.
For instance, a video could be displayed 16:9 with a 50px header bar.
If omitted, set 0
.
bounds?: ('window' | 'parent' | HTMLElement);
Specifies resize boundaries.
handleStyles?: HandleStyles;
The handleStyles
property is used to override the style of one or more resize handles.
Only the axis you specify will have its handle style replaced.
If you specify a value for right
it will completely replace the styles for the right
resize handle,
but other handle will still use the default styles.
handleClasses?: HandleClassName;
The handleClasses
property is used to set the className of one or more resize handles.
handleComponent?: HandleComponent;
The handleComponent
property is used to pass a React Component to be rendered as one or more resize handle. For example, this could be used to use an arrow icon as a handle..
handleWrapperStyle?: { [key: string]: string };
The handleWrapperStyle
property is used to override the style of resize handles wrapper.
handleWrapperClass?: string;
The handleWrapperClass
property is used to override the className of resize handles wrapper.
enable?: ?Enable;
The enable
property is used to set the resizable permission of a resizable component.
The permission of top
, right
, bottom
, left
, topRight
, bottomRight
, bottomLeft
, topLeft
direction resizing.
If omitted, all resizer are enabled.
If you want to permit only right direction resizing, set { top:false, right:true, bottom:false, left:false, topRight:false, bottomRight:false, bottomLeft:false, topLeft:false }
.
onResizeStart?: ResizeStartCallBack;
ResizeStartCallBack
type is below.
1type ResizeStartCallback = ( 2 e: SyntheticMouseEvent<HTMLDivElement> | SyntheticTouchEvent<HTMLDivElement>, 3 dir: ResizableDirection, 4 refToElement: HTMLDivElement, 5) => void;
Calls when resizable component resize start.
onResize?: ResizeCallback;
ResizeCallback
type is below.
1type ResizeCallback = ( 2 event: MouseEvent | TouchEvent, 3 direction: ResizableDirection, 4 refToElement: HTMLDivElement, 5 delta: NumberSize, 6) => void;
Calls when resizable component resizing.
onResizeStop?: ResizeCallback;
ResizeCallback
type is below.
1type ResizeCallback = ( 2 event: MouseEvent | TouchEvent, 3 direction: ResizableDirection, 4 refToElement: HTMLDivElement, 5 delta: NumberSize, 6) => void;
Calls when resizable component resize stop.
updateSize(size: { width: number | string, height: number | string }): void
🚫 Depreacted - Please use controlled state with size
.
Update component size.
grid
,max/minWidth
, max/minHeight
props is ignored, when this method called.
1class YourComponent extends Component { 2 3 ... 4 5 update() { 6 this.resizable.updateSize({ width: 200, height: 300 }); 7 } 8 9 render() { 10 return ( 11 <Resizable ref={c => { this.resizable = c; }}> 12 example 13 </Resizable> 14 ); 15 } 16 17 ... 18}
If you have a feature request, please add it as an issue or make a pull request.
If you have a bug to report, please reproduce the bug in CodeSandbox to help us easily isolate it.
1npm test
index.d.ts
, HTMLElement
to HTMLDivElement
and other.index.d.ts
to allow number for aspectLatio.rollup
version, because v0.61.0 break re-resizable
build.index.d.ts
, HTMLElement
to HTMLDivElement
and other.index.d.ts
to allow number for aspectLatio.index.d.ts
to allow HTMLDivElement
properties. #292Array.from
error in IE11relative
position when get base sizeauto
overwritten by px value #179width
and height
.defaultSize
and size
,extendsProps
.You can add extendsProps as follows.
<Resizable data-foo="foo" />
ResizeStartCallBack
-> ResizeStartCallback
.ResizeDirection
type.Callback
to ResizeCallback
.react-resizable-box
-> re-resizable
.handleWrapperStyle
and handleWrapperClass
props.handersClasses
-> handleClasses
handersStyles
-> handleStyles
shouldUpdateComponent
(#135).lodash.isEqual
.border-box
.flowtype
.extendsProps
prop to other props (e.g. data-*
, aria-*
, and other ).updateSize
method.lockAspectRatio
property.grid
props to snap grid. (thanks @paulyoung)userSelect: none
when resize get srated.require
.onResizeStart
callback argument.'px'
and '%'
for width and height props.The MIT License (MIT)
Copyright (c) 2018 bokuweb
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
6 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 7
Reason
Found 7/25 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-13
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More