react-qr-svg
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.QRCode = QRCode; | ||
@@ -19,8 +22,13 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var QRCodeImpl = require('qr.js/lib/QRCode'); | ||
var ErrorCorrectLevel = require('qr.js/lib/ErrorCorrectLevel'); | ||
var warningFired = false; | ||
function QRCode() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$value = _ref.value, | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _ref$value = _ref.value, | ||
value = _ref$value === undefined ? '' : _ref$value, | ||
@@ -33,4 +41,11 @@ size = _ref.size, | ||
_ref$fgColor = _ref.fgColor, | ||
fgColor = _ref$fgColor === undefined ? '#000000' : _ref$fgColor; | ||
fgColor = _ref$fgColor === undefined ? '#000000' : _ref$fgColor, | ||
otherProps = _objectWithoutProperties(_ref, ['value', 'size', 'level', 'bgColor', 'fgColor']); | ||
if (size && !warningFired) { | ||
/* eslint-disable no-console */ | ||
console.warn('The \'size\' prop is deprecated and will be removed in the next major version. Please use the \'style\', \'className\' or \'width\' props to size the code.'); | ||
/* eslint-enable no-console */ | ||
warningFired = true; | ||
} | ||
// adapted from https://github.com/zpao/qrcode.react/blob/master/src/index.js | ||
@@ -45,3 +60,3 @@ var qrcode = new QRCodeImpl(-1, ErrorCorrectLevel[level]); | ||
'svg', | ||
{ shapeRendering: 'crispEdges', viewBox: [0, 0, cells.length, cells.length].join(' '), width: size }, | ||
_extends({ shapeRendering: 'crispEdges', viewBox: [0, 0, cells.length, cells.length].join(' '), width: size }, otherProps), | ||
cells.map(function (row, rowIndex) { | ||
@@ -48,0 +63,0 @@ return row.map(function (cell, colIndex) { |
@@ -29,2 +29,2 @@ import * as React from "react"; | ||
*/ | ||
export function QRCode(props: QRCodeProps): React.ReactElement<{}>; | ||
export function QRCode(props: QRCodeProps & React.SVGProps): React.ReactElement<{}>; |
@@ -6,3 +6,3 @@ { | ||
"user": "no23reason", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"scripts": { | ||
@@ -53,7 +53,7 @@ "start": "webpack-dev-server", | ||
"json-loader": "^0.5.4", | ||
"purecss": "^0.6.0", | ||
"react": "~15.5.3", | ||
"react-dom": "~15.5.3", | ||
"purecss": "^1.0.0", | ||
"react": "~15.6.1", | ||
"react-dom": "~15.6.1", | ||
"react-ghfork": "^0.3.3", | ||
"react-test-renderer": "~15.5.4", | ||
"react-test-renderer": "~15.6.1", | ||
"rimraf": "^2.5.3", | ||
@@ -60,0 +60,0 @@ "semantic-release": "^6.3.2", |
@@ -38,7 +38,7 @@ [![build status](https://secure.travis-ci.org/no23reason/react-qr-svg.svg)](http://travis-ci.org/no23reason/react-qr-svg) | ||
return (<QRCode | ||
value="some text" | ||
size={512} | ||
level="Q" | ||
bgColor="#FFFFFF" | ||
fgColor="#000000" | ||
level="Q" | ||
style={{ width: 256 }} | ||
value="some text" | ||
/>); | ||
@@ -54,3 +54,3 @@ } | ||
value: '', // The value to encode in the code | ||
size: 256, // Size of the code in pixels | ||
size: 256, // Size of the code in pixels. This is obsolete and will be removed in the next major version! | ||
level: 'L', // QR Error correction level | ||
@@ -64,2 +64,4 @@ bgColor: '#FFFFFF', // Color of the bright squares | ||
You can also specify all the props that are valid for the `<svg>` React element (e.g. `style`, `className` or `width` which you can use to specify the size of the QR code). | ||
## Acknowledgements | ||
@@ -66,0 +68,0 @@ This project is heavily inspired by the [`qrcode.react`](https://github.com/zpao/qrcode.react) project. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11183
88
72