{"name":"react-viewer","version":"2.3.3","description":"react image viewer","main":"dist/index","scripts":{"test":"npm run lint","start":"dora --port 8001 --plugins \"webpack,webpack-hmr,browser-history?index=/demo/index.html\"","lint":"tslint -c tslint.json src/**/*.ts src/**/*.tsx","build":"atool-build --config webpack.config.prop.js && gulp","doc":"atool-build --config webpack.config.doc.js","pub":"npm run build && npm publish"},"repository":{"type":"git","url":"git+https://github.com/infeng/react-viewer.git"},"keywords":["react","image","viewer"],"author":{"name":"infeng"},"license":"MIT","bugs":{"url":"https://github.com/infeng/react-viewer/issues"},"files":["dist","lib"],"typings":"lib/index.d.ts","homepage":"https://github.com/infeng/react-viewer#readme","devDependencies":{"@types/node":"^6.0.45","@types/react":"^0.14.39","@types/react-dom":"^0.14.17","antd":"^2.13.11","atool-build":"^1.0.2","babel-plugin-import":"^1.2.1","babel-plugin-transform-runtime":"^6.15.0","babel-runtime":"^6.11.6","dora":"^0.4.5","dora-plugin-browser-history":"^0.2.0","dora-plugin-webpack":"^1.0.0","dora-plugin-webpack-hmr":"^0.2.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-typescript":"^3.0.2","html-loader":"^0.4.4","html-webpack-plugin":"^2.22.0","merge2":"^1.0.2","pre-commit":"^1.1.3","react":"^16.2.0","react-dom":"^16.2.0","through2":"^2.0.1","tslint":"^3.15.1","typescript":"^2.6.2","webpack":"^1.13.2"},"dependencies":{"classnames":"^2.2.5"},"pre-commit":["lint"],"gitHead":"66318030358bbe7f64ab08f44c2f2ff7adf606b7","_id":"react-viewer@2.3.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.2","_npmUser":{"name":"infeng","email":"fzhihao@outlook.com"},"dist":{"integrity":"sha512-PTWehuUn+uFJG5bUbwtwOGs7ZD4NDkpdUtjBc1GA8KR1tzzK5T9TxT89mRVgkmixqdmVYiJz/vn6AT7NWRZZ8A==","shasum":"584823d5adcb1ad55fd565bf87f3fe36323eb492","tarball":"http://registry-npm.ywwl.com/react-viewer/download/react-viewer-2.3.3.tgz","fileCount":31,"unpackedSize":199311,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDBLHd1CoMkYPKbdk4L+T6M//nK2w76uYVdCYSBuhLoBAiEAvae76w2v5I9U/tnO8EyonXeX3XaNHm/SYgk/AHnA2d0="}],"size":44459,"noattachment":false,"key":"/react-viewer/-/react-viewer-2.3.3.tgz"},"maintainers":[{"name":"infeng","email":"fzhihao@outlook.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-viewer_2.3.3_1519719517473_0.1059081968852933"},"_hasShrinkwrap":false,"readme":"# react-viewer\r\n\r\n[![NPM version][npm-image]][npm-url] [![](https://travis-ci.org/infeng/react-viewer.svg?branch=master)](https://travis-ci.org/infeng/react-viewer) [![codecov](https://codecov.io/gh/infeng/react-viewer/branch/master/graph/badge.svg)](https://codecov.io/gh/infeng/react-viewer)\r\n> react image viewer.\r\n\r\n## Introduction\r\n\r\nBecause I can`t be comfortable using [viewerjs](https://github.com/fengyuanchen/viewerjs) in react, so I created react-viewer to replace it.\r\n\r\n## Installation\r\n\r\n> react >= 16.8.0 | react-dom >= 16.8.0\r\n\r\n```bash\r\nnpm install react-viewer --save\r\n```\r\n\r\n## Usage\r\n\r\n```javascript\r\nimport * as React from 'react';\r\nimport Viewer from 'react-viewer';\r\n\r\nfunction App() {\r\n  const [ visible, setVisible ] = React.useState(false);\r\n\r\n  return (\r\n    <div>\r\n      <button onClick={() => { setVisible(true); } }>show</button>\r\n      <Viewer\r\n      visible={visible}\r\n      onClose={() => { setVisible(false); } }\r\n      images={[{src: '', alt: ''}]}\r\n      />\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## Server Side Rendering\r\n\r\nI'm sorry, ssr is not currently supported in `3.x`, it will be fixed in `4.0`.\r\n\r\n## Props\r\n\r\n| props        | type         | default | description                 | required |\r\n|--------------|--------------|---------|-----------------------------|----------|\r\n| visible      | string       |  false  | Viewer visible             | true |\r\n| onClose      | function       |  -      | Specify a function that will be called when Visible close   | true |\r\n| images       | [ImageDecorator](#imagedecorator)[]     | []      | image source array | true  |\r\n| activeIndex  | number       | 0       | active image index | false |\r\n| zIndex       | number       | 1000    | Viewer css z-index | false |\r\n| container    | HTMLElement  | null    | set parent node(inline mode) | false |\r\n| drag         | boolean      | true    | whether to drag image | false |\r\n| attribute    | boolean      | true    | whether to show image attribute | false |\r\n| zoomable     | boolean      | true    | whether to show 'zoom' button | false |\r\n| rotatable    | boolean      | true    | whether to show 'rotate' button | false |\r\n| scalable     | boolean      | true    | whether to show 'scale' button | false |\r\n| onMaskClick  | (e) => void  |   -     | callback function when mask is clicked | false |\r\n| downloadable     | boolean      |  false  | whether to show 'download' | false |\r\n| noClose      | boolean      |  false  | to not render close button | false |\r\n| noNavbar     | boolean      |  false  | to not render the navbar | false |\r\n| noToolbar    | boolean      |  false  | to not render the toolbar | false |\r\n| noImgDetails | boolean      |  false  | to not render image detail (WxH) | false |\r\n| noFooter     | boolean      |  false  | to not render the entire footer | false |\r\n| changeable   | boolean      |  true   | wheather to show change button  | false |\r\n| customToolbar | (defaultToolbarConfigs: [ToolbarConfig](#toolbarconfig)[]) => ToolbarConfig[] | - | customer toolbar | false |\r\n| zoomSpeed    | number       | 0.05    | zoom speed | false |\r\n| defaultSize    | [ViewerImageSize](#viewerimagesize) | - | default image size | false |\r\n| defaultImg    | [viewerdefaultimg](#viewerimagesize) | - | if load img failed, show default img | false |\r\n| disableKeyboardSupport | boolean | false | disable keyboard support | false |\r\n| noResetZoomAfterChange | boolean | false | preserve zoom after image change | false |\r\n| noLimitInitializationSize | boolean | false | no limit image initialization size | false |\r\n| defaultScale | number | 1 | set default scale | false |\r\n| onChange | (activeImage: [ImageDecorator](#imagedecorator), index: number) => void | - | callback when iamge change | false |\r\n| loop         | boolean      |  true   | whether enable image loop | false |\r\n| disableMouseZoom   | boolean      |  false   | whether disable mouse zoom | false |\r\n| downloadInNewWindow | boolean | false | whether to download in a new window | false |\r\n| className   | string    |  -  | customized CSS class | false |\r\n| showTotal   | boolean    |  true  | whether to display the total number and range | false |\r\n| maxScale   | number    |  -  | maximum scaling | false |\r\n| minScale   | number    |  0.1  | minimum scaling | false |\r\n\r\n### ImageDecorator\r\n\r\n| props       | type         | default | description                 | required |\r\n|-------------|--------------|---------|-----------------------------|----------|\r\n| src  | string  |  -  | image source | true |\r\n| alt  | string  |  -  | image description | false |\r\n| downloadUrl  | string  |  -  | image downlaod url | false |\r\n| defaultSize  | [ViewerImageSize](#viewerimagesize)  |  -  | image size | false |\r\n\r\n### ViewerImageSize\r\n\r\n| props       | type         | default | description                 | required |\r\n|-------------|--------------|---------|-----------------------------|----------|\r\n| width  | number  |  -  | image width | true |\r\n| height  | number  |  -  | image height | true |\r\n\r\n### ViewerDefaultImg\r\n\r\n| props       | type         | default | description                 | required |\r\n|-------------|--------------|---------|-----------------------------|----------|\r\n| src  | number  |  -  | image source | true |\r\n| width  | number  |  -  | image width | false |\r\n| height  | number  |  -  | image height | false |\r\n\r\n### ToolbarConfig\r\n\r\n| props       | type         | default | description                 | required |\r\n|-------------|--------------|---------|-----------------------------|----------|\r\n| key  | string  |  -  | tool key | true |\r\n| render  | React.ReactNode  |  -  | tool render | false |\r\n| onClick  | function  |  -  | callback function when action is clicked | false |\r\n\r\n## Keyboard support\r\n\r\n- `Esc`: Close viewer.\r\n- `←`: View the previous image.\r\n- `→`: View the next image.\r\n- `↑`: Zoom in the image.\r\n- `↓`: Zoom out the image.\r\n- `Ctrl + 1`: Reset the image.\r\n- `Ctrl + ←`: Rotate left the image.\r\n- `Ctrl + →`: Rotate right the image.\r\n\r\n## License\r\n\r\nMIT\r\n\r\n[npm-image]: https://badge.fury.io/js/react-viewer.svg\r\n[npm-url]: https://npmjs.org/package/react-viewer\r\n","publish_time":1519719517726,"_cnpm_publish_time":1519719517726,"dist-tags":{"latest":"3.2.6"}}