{"id":15354772,"url":"https://github.com/bokuweb/react-resizable-decorator","last_synced_at":"2025-04-15T06:20:30.453Z","repository":{"id":57343536,"uuid":"80430238","full_name":"bokuweb/react-resizable-decorator","owner":"bokuweb","description":"[Deprecated] Resizable decorator for React component.","archived":false,"fork":false,"pushed_at":"2023-12-15T20:26:38.000Z","size":511,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T06:52:41.484Z","etag":null,"topics":["component","decorators","react","resizable"],"latest_commit_sha":null,"homepage":"https://bokuweb.github.io/react-resizable-decorator/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bokuweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-30T14:48:59.000Z","updated_at":"2024-02-27T05:47:10.000Z","dependencies_parsed_at":"2024-10-01T12:21:03.516Z","dependency_job_id":"d446e810-85a0-40f8-a959-c883eb43952b","html_url":"https://github.com/bokuweb/react-resizable-decorator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-resizable-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-resizable-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-resizable-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-resizable-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bokuweb","download_url":"https://codeload.github.com/bokuweb/react-resizable-decorator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240961381,"owners_count":19885318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","decorators","react","resizable"],"created_at":"2024-10-01T12:20:56.285Z","updated_at":"2025-02-27T01:31:38.741Z","avatar_url":"https://github.com/bokuweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-resizable-decorator\n\n[![Build Status](https://img.shields.io/travis/bokuweb/react-resizable-decorator.svg?style=flat-square)](https://travis-ci.org/bokuweb/react-resizable-decorator)\n[![Version](https://img.shields.io/npm/v/react-resizable-decorator.svg?style=flat-square)](https://www.npmjs.com/package/react-resizable-decorator)\n[![Code Climate](https://img.shields.io/codeclimate/github/bokuweb/react-resizable-decorator/badges/gpa.svg?style=flat-square)](https://codeclimate.com/github/bokuweb/react-resizable-decorator)\n[![License](https://img.shields.io/npm/l/react-resizable-decorator.svg?style=flat-square)](https://github.com/bokuweb/react-resizable-decorator#license)\n\n![screenshot](https://github.com/bokuweb/react-resizable-decorator/blob/master/docs/screenshot.gif?raw=true)\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Props](#props)\n- [Method](#method)\n- [Development](#development)\n- [Test](#test)\n- [Contribute](#contribute)\n- [Changelog](#changelog)\n- [License](#license)\n\n## Install\n\n``` sh\n$ npm install --save react-resizable-decorator\n```\n\n## Usage\n\n- If you can use `decorator`, (e.g. babel-plugin-transform-decorators-legacy).\n\n``` js\nimport React, { Component } from 'react';\nimport resizable from 'react-resizable-decorator';\n\n@resizable\nclass Hello extends Component {\n  render() {\n    return (\n      \u003cdiv\u003eHello\u003c/div\u003e\n    );\n  }\n}\n\nexport default class Example extends Component {\n  render() {\n    return (\n      \u003cHello width=\"100px\" height=\"100px\"\u003eHello\u003c/Hello\u003e\n    );\n  }\n}\n```\n\n- If you can not use `decorator`.\n\n``` js\nimport React, { Component } from 'react';\nimport resizable from 'react-resizable-decorator';\n\nconst Hello = resizable(class Hello extends Component {\n  render() {\n    return (\n      \u003cdiv\u003eHello\u003c/div\u003e\n    );\n  }\n});\n\nexport default class Example extends Component {\n  render() {\n    return (\n      \u003cHello width=\"100px\" height=\"100px\"\u003eHello\u003c/Hello\u003e\n    );\n  }\n}\n```\n\n## Props\n\n#### `width: ?(number | string);`\n\nThe `width` property is used to set the initial width of a resizable component.   \nFor example, you can set `300`, `'300px'`, `50%`.     \nIf ommited, set `'auto'`.    \n\n#### `height: ?(number | string);`\n\nThe `height` property is used to set the initial height of a resizable component.    \nFor example, you can set `300`, `'300px'`, `50%`.    \nIf ommited, set `'auto'`.    \n\n#### `minWidth: ?number;`\n\nThe `minWidth` property is used to set the minimum width of a resizable component.\n\n\n#### `minHeight: ?number;`\n\nThe `minHeight` property is used to set the minimum height of a resizable component.\n\n#### `maxWidth: ?number;`\n\nThe `maxWidth` property is used to set the maximum width of a resizable component.\n\n#### `maxHeight: ?number`;\n\nThe `maxheight` property is used to set the maximum height of a resizable component.\n\n#### `grid: ?Array\u003cnumber\u003e;`\n\nThe `grid` property is used to specify the increments that resizing should snap to. Defaults to `[1, 1]`.\n\n#### `lockAspectRatio: ?boolean;`\n\nThe `lockAspectRatio` property is used to lock aspect ratio.\nIf ommited, set `false`.\n\n#### `bounds: ?('window' | 'parent');`\n\nSpecifies resize boundaries.\n\n#### `handlerStyles: ?HandlersStyles;`\n\nThe `handleStyles` property is used to override the style of one or more resize handlers.\nOnly the axis you specify will have its handler style replaced.\nIf you specify a value for `right` it will completely replace the styles for the `right` resize handler,\nbut other handler will still use the default styles.\n\n#### `handlerClasses: ?HandlersClassName;`\n\nThe `handlerClasses` property is used to set the className of one or more resize handlers.\n\n#### `isResizable: ?IsResizable;`\n\nThe `isResizable` property is used to set the resizable permission of a resizable component.\n\nThe permission of `top`, `right`, `bottom`, `left`, `topRight`, `bottomRight`, `bottomLeft`, `topLeft` direction resizing.\nIf omitted, all resizer are enabled.\nIf 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 }`. \n\n#### `onResizeStart: ?(event: SyntheticMouseEvent | SyntheticTouchEvent, direction: Direction, resizableRef: React$Component\u003c*\u003e) =\u003e void;`\n\nCalls when resizable component resize start.\n\n#### `onResize: ?(event: SyntheticMouseEvent | SyntheticTouchEvent, direction: Direction, resizableRef: React$Component\u003c*\u003e) =\u003e void;`\n\nCalls when resizable component resizing.\n\n#### `onResizeStop: ?(event: SyntheticMouseEvent | SyntheticTouchEvent, direction: Direction, resizableRef: React$Component\u003c*\u003e) =\u003e void;`\n\nCalls when resizable component resize startStop.\n\n## method\n\n#### `[resize]: (width: string | number, height: string | number) =\u003e void;`\n\nUpdate component size.\n`grid` ,`max/minWidth`, `max/minHeight` props is ignored, when this method called.\n\n- for example\n\n``` js\nimport { resize } from 'react-resizable-decorator';\n\nclass YourComponent extends Component {\n\n  update() {\n    this.resizable[resize]({ width: 200, height: 300 });\n  }\n  \n  render() {\n    return (\n      \u003cResizable ref={c =\u003e { this.resizable = c; }}\u003e\n        Hello\n      \u003c/Resizable\u003e\n    );\n  }\n}\n```\n\n## Development\n\n``` sh\nnpm start\n```\n\nOpen `localhost:3333`.\n\n## Test\n\n``` sh\n$ npm run test:ci\n```\n\n## Contribute\n\nPR welcome.\n\n## Changelog\n\n#### v0.1.1\n\n- First release.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Bokuweb\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Freact-resizable-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbokuweb%2Freact-resizable-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Freact-resizable-decorator/lists"}