Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@bmunozg/react-image-area
Advanced tools
Changelog
1.1.0-beta.2 (2022-07-28)
Readme
React component to select multiple areas/regions of images.
npm i @bmunozg/react-image-area
Usage with types
import { AreaSelector, IArea } from '@bmunozg/react-image-area'
const ExampleComponent = () => {
const [areas, setAreas] = useState<IArea[]>([]);
const onChangeHandler = (areas: IArea[]) => {
setAreas(areas);
}
return (
<AreaSelector
areas={areas}
onChange={onChangeHandler}
>
<img src='my-image.jpg' alt='my image'/>
</AreaSelector>
)
}
areas: IArea[]
Starting with no areas:
// ...
const [areas,setAreas] = useState<IArea[]>([])
// ...
return (
<AreaSelector
areas={areas}
>
<img src='my-image.jpg' alt='my image'/>
</AreaSelector>
)
// ...
onChange: (areas: IArea[]) => void
A callback which happens for every change on the selection area.
// ...
const [areas,setAreas] = useState<IArea[]>()
// ...
return (
<AreaSelector
onChange={setAreas}
>
<img src='my-image.jpg' alt='my image'/>
</AreaSelector>
)
// ...
maxAreas: number
Default: Infinity
Set the maximum areas that can be drawn, by default there are no limit.
unit: 'pixel' | 'percentage'
Default: pixel
Set the unit you want to work with.
minWidth: number
Default: 0
Min width of the areas.
minHeight: number
Default: 0
Min height of the areas.
debug: boolean
Default: false
Display info of the current areas.
maxWidth: number
Max width of the areas.
maxHeight: number
Max height of the areas.
wrapperStyle: CSSProperties
Apply styles to the wrapper element.
Omited Styles: touchAction
| boxSizing
wrapperStyle={{
border: '2px solid black'
}}
globalAreaStyle: CSSProperties
Apply global styles to the areas.
Omited Styles: position
| touchAction
| top
| left
| width
|
height
| boxSizing
globalAreaStyle={{
border: '1.5px dashed blue',
backgroundColor: 'lightblue',
opacity: '0.5'
}}
customAreaRenderer: (areaProps: IAreaRendererProps) => ReactNode
Custom render function to display info inside the areas. Remember to add a key
import { AreaSelector, IAreaRendererProps } from '@bmunozg/react-image-area'
// ...
const customRender = (areaProps: IAreaRendererProps) => {
if (!areaProps.isChanging) {
return (
<div key={areaProps.areaNumber}>
{areaProps.areaNumber}
</div>
);
}
};
// ...
return (
<AreaSelector
{/*...*/}
customAreaRenderer={customRender}
>
<img src='my-image.jpg' />
</AreaSelector>
);
// ...
mediaWrapperClassName: string
Classname to apply to the media wrapper (image passed as children).
// ...
return (
<AreaSelector>
<img src="my-image.jpg" />
</AreaSelector>
);
// ...
inside the component :arrow_down:
// ...
return (
<div {/*wrapperStyle*/}>
<div className={mediaWrapperClassName}>
{/*image passed as children*/}
</div>
{/*...Areas*/}
</div>
)
//...
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
FAQs
React component to select multiple areas/regions of images.
The npm package @bmunozg/react-image-area receives a total of 377 weekly downloads. As such, @bmunozg/react-image-area popularity was classified as not popular.
We found that @bmunozg/react-image-area 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.