UNPKG

@progress/kendo-react-barcodes

Version:

React Barcodes provide a set of React components to build beautiful and customizable barcodes. KendoReact Barcodes package

9 lines (8 loc) 2.15 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),c=require("./BaseBarcode.js"),u=require("@progress/kendo-charts"),o=require("@progress/kendo-drawing"),d=require("@progress/kendo-react-common");function l(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const n=l(i),p="#000",h="#fff",b="L";class g extends n.Component{constructor(){super(...arguments),this._baseBarcode=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>Object.assign({},e,{background:this.props.background||h,border:this.props.border,color:this.props.color||p,encoding:this.props.encoding,errorCorrection:this.props.errorCorrection||b,overlay:this.props.overlay||{},padding:this.props.padding,renderAs:this.props.renderAs,size:this.props.size,value:this.props.value})}get barcodeInstance(){return this._baseBarcode!==null?this._baseBarcode.barcodeInstance:null}get surface(){return this._baseBarcode!==null?this._baseBarcode.surface:null}get element(){return this._baseBarcode!==null?this._baseBarcode.element:null}render(){const{children:e,className:t,...s}=this.props;return n.createElement(c.BaseBarcode,{...s,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:a=>this._baseBarcode=a,barcodeConstructor:u.QRCode,getTarget:this.getTarget,className:d.classNames("k-qrcode",t)},e)}exportImage(e={}){return o.exportImage(this.exportVisual(),e)}exportSVG(e={}){return o.exportSVG(this.exportVisual(),e)}exportVisual(e){return this.barcodeInstance!==null?this.barcodeInstance.exportVisual(e):new o.Group}}exports.QRCode=g;