@progress/kendo-react-barcodes 15.2.0-develop.1 → 15.2.0-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Barcode.d.ts CHANGED
@@ -6,50 +6,9 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import { BarcodeProps } from './BarcodeProps';
9
- import { Surface, Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
9
+ import { BarcodeHandle } from './BarcodeHandle';
10
10
  import * as React from 'react';
11
11
  /**
12
12
  * Represents the KendoReact Barcode component.
13
13
  */
14
- export declare class Barcode extends React.Component<BarcodeProps, {}> {
15
- private _baseBarcode;
16
- /**
17
- * @hidden
18
- */
19
- get barcodeInstance(): any;
20
- /**
21
- * Gets the Drawing `Surface` of the Barcode.
22
- */
23
- get surface(): Surface | null;
24
- /**
25
- * Gets the DOM element of the Barcode.
26
- */
27
- get element(): HTMLDivElement | null;
28
- /**
29
- * @hidden
30
- */
31
- render(): any;
32
- /**
33
- * Exports the component as an image. The export operation runs asynchronously and returns a promise.
34
- *
35
- * @param {ImageExportOptions} options - The parameters for the exported image.
36
- * @returns {Promise<string>} - A promise that resolves with a PNG image encoded as a Data URI.
37
- */
38
- exportImage(options?: ImageExportOptions): Promise<string>;
39
- /**
40
- * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
41
- *
42
- * @param options - The parameters for the exported file.
43
- * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
44
- */
45
- exportSVG(options?: SVGExportOptions): Promise<string>;
46
- /**
47
- * Exports a Barcode component as a Drawing `Scene`.
48
- *
49
- * @param {any} options - The parameters for the export operation.
50
- * @returns {Group} A promise that returns the root `Group` of the scene.
51
- */
52
- exportVisual(options?: any): Group;
53
- private getTarget;
54
- private deriveOptionsFromParent;
55
- }
14
+ export declare const Barcode: React.ForwardRefExoticComponent<BarcodeProps & React.RefAttributes<BarcodeHandle>>;
package/Barcode.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),i=require("./BaseBarcode.js"),u=require("@progress/kendo-charts"),o=require("@progress/kendo-drawing"),p=require("@progress/kendo-react-common");function d(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 a=d(c);class l extends a.Component{constructor(){super(...arguments),this._baseBarcode=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>Object.assign({},e,{background:this.props.background,border:this.props.border,checksum:this.props.checksum,color:this.props.color,height:this.props.height,padding:this.props.padding,text:this.props.text,type:this.props.type,value:this.props.value,width:this.props.width})}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 a.createElement(i.BaseBarcode,{...s,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:n=>{this._baseBarcode=n},barcodeConstructor:u.Barcode,getTarget:this.getTarget,className:p.classNames("k-barcode",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.Barcode=l;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),B=require("./BaseBarcode.js"),v=require("@progress/kendo-charts"),d=require("@progress/kendo-drawing"),y=require("@progress/kendo-react-common");function I(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const s=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(o,c,s.get?s:{enumerable:!0,get:()=>e[c]})}}return o.default=e,Object.freeze(o)}const n=I(h),m=n.forwardRef((e,o)=>{const{children:c,className:s,...k}=e,u=n.useRef(null),i=n.useRef(e);i.current=e;const a=n.useCallback(t=>{var f;const r=(f=u.current)==null?void 0:f.barcodeInstance;return r!=null?r.exportVisual(t):new d.Group},[]),g=n.useCallback((t={})=>d.exportImage(a(),t),[a]),b=n.useCallback((t={})=>d.exportSVG(a(),t),[a]),l=n.useRef(null);n.useImperativeHandle(l,()=>({get element(){var t,r;return(r=(t=u.current)==null?void 0:t.element)!=null?r:null},get props(){return i.current},get barcodeInstance(){var t,r;return(r=(t=u.current)==null?void 0:t.barcodeInstance)!=null?r:null},get surface(){var t,r;return(r=(t=u.current)==null?void 0:t.surface)!=null?r:null},exportImage:g,exportSVG:b,exportVisual:a}),[g,b,a]),n.useImperativeHandle(o,()=>l.current,[]);const x=()=>l.current,R=t=>({...t,background:e.background,border:e.border,checksum:e.checksum,color:e.color,height:e.height,padding:e.padding,text:e.text,type:e.type,value:e.value,width:e.width});return n.createElement(B.BaseBarcode,{...k,deriveOptionsFromParent:R,ref:u,barcodeConstructor:v.Barcode,getTarget:x,className:y.classNames("k-barcode",s)},c)});m.displayName="KendoReactBarcode";exports.Barcode=m;
package/Barcode.mjs CHANGED
@@ -5,92 +5,76 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as r from "react";
9
- import { BaseBarcode as a } from "./BaseBarcode.mjs";
10
- import { Barcode as i } from "@progress/kendo-charts";
11
- import { exportImage as n, exportSVG as p, Group as c } from "@progress/kendo-drawing";
12
- import { classNames as u } from "@progress/kendo-react-common";
13
- class g extends r.Component {
14
- constructor() {
15
- super(...arguments), this._baseBarcode = null, this.getTarget = () => this, this.deriveOptionsFromParent = (e) => Object.assign({}, e, {
16
- background: this.props.background,
17
- border: this.props.border,
18
- checksum: this.props.checksum,
19
- color: this.props.color,
20
- height: this.props.height,
21
- padding: this.props.padding,
22
- text: this.props.text,
23
- type: this.props.type,
24
- value: this.props.value,
25
- width: this.props.width
26
- });
27
- }
28
- /**
29
- * @hidden
30
- */
31
- get barcodeInstance() {
32
- return this._baseBarcode !== null ? this._baseBarcode.barcodeInstance : null;
33
- }
34
- /**
35
- * Gets the Drawing `Surface` of the Barcode.
36
- */
37
- get surface() {
38
- return this._baseBarcode !== null ? this._baseBarcode.surface : null;
39
- }
40
- /**
41
- * Gets the DOM element of the Barcode.
42
- */
43
- get element() {
44
- return this._baseBarcode !== null ? this._baseBarcode.element : null;
45
- }
46
- /**
47
- * @hidden
48
- */
49
- render() {
50
- const { children: e, className: t, ...s } = this.props;
51
- return /* @__PURE__ */ r.createElement(
52
- a,
53
- {
54
- ...s,
55
- deriveOptionsFromParent: this.deriveOptionsFromParent,
56
- ref: (o) => {
57
- this._baseBarcode = o;
58
- },
59
- barcodeConstructor: i,
60
- getTarget: this.getTarget,
61
- className: u("k-barcode", t)
8
+ import * as a from "react";
9
+ import { BaseBarcode as h } from "./BaseBarcode.mjs";
10
+ import { Barcode as R } from "@progress/kendo-charts";
11
+ import { Group as k, exportImage as B, exportSVG as I } from "@progress/kendo-drawing";
12
+ import { classNames as v } from "@progress/kendo-react-common";
13
+ const V = a.forwardRef((r, m) => {
14
+ const { children: i, className: g, ...f } = r, c = a.useRef(null), u = a.useRef(r);
15
+ u.current = r;
16
+ const n = a.useCallback((e) => {
17
+ var d;
18
+ const t = (d = c.current) == null ? void 0 : d.barcodeInstance;
19
+ return t != null ? t.exportVisual(e) : new k();
20
+ }, []), l = a.useCallback(
21
+ (e = {}) => B(n(), e),
22
+ [n]
23
+ ), s = a.useCallback(
24
+ (e = {}) => I(n(), e),
25
+ [n]
26
+ ), o = a.useRef(null);
27
+ a.useImperativeHandle(
28
+ o,
29
+ () => ({
30
+ get element() {
31
+ var e, t;
32
+ return (t = (e = c.current) == null ? void 0 : e.element) != null ? t : null;
62
33
  },
63
- e
64
- );
65
- }
66
- /**
67
- * Exports the component as an image. The export operation runs asynchronously and returns a promise.
68
- *
69
- * @param {ImageExportOptions} options - The parameters for the exported image.
70
- * @returns {Promise<string>} - A promise that resolves with a PNG image encoded as a Data URI.
71
- */
72
- exportImage(e = {}) {
73
- return n(this.exportVisual(), e);
74
- }
75
- /**
76
- * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
77
- *
78
- * @param options - The parameters for the exported file.
79
- * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
80
- */
81
- exportSVG(e = {}) {
82
- return p(this.exportVisual(), e);
83
- }
84
- /**
85
- * Exports a Barcode component as a Drawing `Scene`.
86
- *
87
- * @param {any} options - The parameters for the export operation.
88
- * @returns {Group} A promise that returns the root `Group` of the scene.
89
- */
90
- exportVisual(e) {
91
- return this.barcodeInstance !== null ? this.barcodeInstance.exportVisual(e) : new c();
92
- }
93
- }
34
+ get props() {
35
+ return u.current;
36
+ },
37
+ get barcodeInstance() {
38
+ var e, t;
39
+ return (t = (e = c.current) == null ? void 0 : e.barcodeInstance) != null ? t : null;
40
+ },
41
+ get surface() {
42
+ var e, t;
43
+ return (t = (e = c.current) == null ? void 0 : e.surface) != null ? t : null;
44
+ },
45
+ exportImage: l,
46
+ exportSVG: s,
47
+ exportVisual: n
48
+ }),
49
+ [l, s, n]
50
+ ), a.useImperativeHandle(m, () => o.current, []);
51
+ const b = () => o.current, x = (e) => ({
52
+ ...e,
53
+ background: r.background,
54
+ border: r.border,
55
+ checksum: r.checksum,
56
+ color: r.color,
57
+ height: r.height,
58
+ padding: r.padding,
59
+ text: r.text,
60
+ type: r.type,
61
+ value: r.value,
62
+ width: r.width
63
+ });
64
+ return /* @__PURE__ */ a.createElement(
65
+ h,
66
+ {
67
+ ...f,
68
+ deriveOptionsFromParent: x,
69
+ ref: c,
70
+ barcodeConstructor: R,
71
+ getTarget: b,
72
+ className: v("k-barcode", g)
73
+ },
74
+ i
75
+ );
76
+ });
77
+ V.displayName = "KendoReactBarcode";
94
78
  export {
95
- g as Barcode
79
+ V as Barcode
96
80
  };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Surface, Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
9
+ import { BarcodeProps } from './BarcodeProps';
10
+ /**
11
+ * Represents the `ref` of the Barcode component.
12
+ */
13
+ export interface BarcodeHandle {
14
+ /** The current root DOM element or `null`. */
15
+ element: HTMLDivElement | null;
16
+ /** The props of the Barcode component. */
17
+ readonly props: Readonly<BarcodeProps>;
18
+ /**
19
+ * @hidden
20
+ */
21
+ barcodeInstance: any;
22
+ /**
23
+ * Gets the Drawing `Surface` of the Barcode.
24
+ */
25
+ surface: Surface | null;
26
+ /**
27
+ * Exports the component as an image. The export operation runs asynchronously and returns a promise.
28
+ *
29
+ * @param options - The parameters for the exported image.
30
+ * @returns A promise that resolves with a PNG image encoded as a Data URI.
31
+ */
32
+ exportImage: (options?: ImageExportOptions) => Promise<string>;
33
+ /**
34
+ * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
35
+ *
36
+ * @param options - The parameters for the exported file.
37
+ * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
38
+ */
39
+ exportSVG: (options?: SVGExportOptions) => Promise<string>;
40
+ /**
41
+ * Exports a Barcode component as a Drawing `Scene`.
42
+ *
43
+ * @param options - The parameters for the export operation.
44
+ * @returns The root `Group` of the scene.
45
+ */
46
+ exportVisual: (options?: any) => Group;
47
+ }
package/BaseBarcode.d.ts CHANGED
@@ -5,80 +5,10 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { default as PropTypes } from 'prop-types';
9
- import { Surface } from '@progress/kendo-drawing';
10
8
  import { BaseBarcodePrivateProps } from './BaseBarcodeProps';
11
- import { BarcodeContextType } from './BarcodeContext.js';
9
+ import { BaseBarcodeHandle } from './BaseBarcodeHandle';
12
10
  import * as React from 'react';
13
11
  /**
14
12
  * @hidden
15
13
  */
16
- export declare class BaseBarcode extends React.Component<BaseBarcodePrivateProps, {}> {
17
- /**
18
- * @hidden
19
- */
20
- static propTypes: {
21
- dir: PropTypes.Requireable<string>;
22
- renderAs: PropTypes.Requireable<string>;
23
- };
24
- /**
25
- * @hidden
26
- */
27
- static defaultProps: {
28
- renderAs: string;
29
- };
30
- /**
31
- * @hidden
32
- */
33
- barcodeInstance: any | null;
34
- /**
35
- * @hidden
36
- */
37
- surface: Surface | null;
38
- /**
39
- * @hidden
40
- */
41
- get element(): HTMLDivElement;
42
- protected _element: HTMLDivElement | null;
43
- protected contextValue: BarcodeContextType;
44
- protected observersStore: any;
45
- private readonly showLicenseWatermark;
46
- private readonly licenseMessage?;
47
- constructor(props: BaseBarcodePrivateProps);
48
- /**
49
- * @hidden
50
- */
51
- componentDidMount(): void;
52
- /**
53
- * @hidden
54
- */
55
- componentDidUpdate(prevProps: any): void;
56
- /**
57
- * @hidden
58
- */
59
- componentWillUnmount(): void;
60
- /**
61
- * @hidden
62
- */
63
- render(): any;
64
- /**
65
- * @hidden
66
- */
67
- instantiateCoreBarcode(): void;
68
- /**
69
- * @hidden
70
- */
71
- refresh(): void;
72
- /**
73
- * @hidden
74
- */
75
- getBarcodeOptions(): any;
76
- /**
77
- * @hidden
78
- */
79
- trigger(name: string, e: any): void;
80
- /**
81
- * @hidden
82
- */
83
- onWindowResize: () => void;
84
- }
14
+ export declare const BaseBarcode: React.ForwardRefExoticComponent<BaseBarcodePrivateProps & React.RefAttributes<BaseBarcodeHandle>>;
package/BaseBarcode.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),d=require("prop-types"),v=require("./store/store.js"),f=require("./store/reducer.js"),O=require("./utils/common.js"),w=require("./BarcodeContext.js"),a=require("@progress/kendo-react-common"),l=require("./package-metadata.js");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>n[r]})}}return e.default=n,Object.freeze(e)}const o=C(b),i=class i extends o.Component{constructor(e){super(e),this.barcodeInstance=null,this.surface=null,this._element=null,this.observersStore={},this.showLicenseWatermark=!1,this.onWindowResize=()=>{this.barcodeInstance!==null&&(this.barcodeInstance.redraw(),this.trigger("render",{sender:this}))},this.showLicenseWatermark=!a.validatePackage(l.packageMetadata,{component:"Barcode"}),this.licenseMessage=a.getLicenseMessage(l.packageMetadata),this.observersStore=v.createStore(f.observersReducer),this.contextValue={observersStore:this.observersStore}}get element(){return this._element}componentDidMount(){this.instantiateCoreBarcode(),window.addEventListener("resize",this.onWindowResize),this.trigger("render",{sender:this})}componentDidUpdate(e){const{children:r,deriveOptionsFromParent:t,getTarget:s,barcodeConstructor:I,className:y,renderAs:h,...p}=this.props,{children:P,deriveOptionsFromParent:S,getTarget:k,barcodeConstructor:M,className:q,renderAs:u,...g}=e;if(this.barcodeInstance!==null){const m=O.isOptionsChanged(g,p);(h||"svg")!==(u||"svg")?(this.barcodeInstance!==null&&(this.barcodeInstance.destroy(),this.barcodeInstance=null),this.instantiateCoreBarcode()):m&&this.refresh(),this.trigger("render",{sender:this})}}componentWillUnmount(){this.barcodeInstance!==null&&(this.barcodeInstance.destroy(),this.barcodeInstance=null),window.removeEventListener("resize",this.onWindowResize)}render(){const{style:e={},className:r,children:t}=this.props;return o.createElement(w.BarcodeContext.Provider,{value:this.contextValue},o.createElement("div",{style:e,ref:s=>{this._element=s},className:r},t,this.showLicenseWatermark&&o.createElement(a.WatermarkOverlay,{message:this.licenseMessage})))}instantiateCoreBarcode(){const{barcodeConstructor:e}=this.props,r=this.getBarcodeOptions();this.barcodeInstance=new e(this.element,r,t=>{if(process.env.NODE_ENV!=="production")throw t;console.warn(t)})}refresh(){if(this.barcodeInstance!==null){const e=this.getBarcodeOptions();this.barcodeInstance.setOptions(e)}}getBarcodeOptions(){const{renderAs:e,deriveOptionsFromParent:r}=this.props;let t={renderAs:e};return r&&(t=r(t)),t}trigger(e,r){const t=this.observersStore.getState();for(let s=0;s<t.length;s++)t[s].trigger(e,r)}};i.propTypes={dir:d.string,renderAs:d.oneOf(["svg","canvas"])},i.defaultProps={renderAs:"svg"};let c=i;exports.BaseBarcode=c;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),h=require("prop-types"),x=require("./store/store.js"),z=require("./store/reducer.js"),I=require("./utils/common.js"),L=require("./BarcodeContext.js"),m=require("@progress/kendo-react-common"),P=require("./package-metadata.js");function _(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(o,s,a.get?a:{enumerable:!0,get:()=>t[s]})}}return o.default=t,Object.freeze(o)}const e=_(F),H={renderAs:"svg"},v=e.forwardRef((t,o)=>{const{renderAs:s=H.renderAs,style:a={},className:w,children:y,barcodeConstructor:M,deriveOptionsFromParent:O,getTarget:i}=t,l=e.useRef(null),r=e.useRef(null),u=e.useRef(null),E=e.useMemo(()=>!m.validatePackage(P.packageMetadata,{component:"Barcode"}),[]),N=e.useMemo(()=>m.getLicenseMessage(P.packageMetadata),[]),f=e.useMemo(()=>x.createStore(z.observersReducer),[]),T=e.useMemo(()=>({observersStore:f}),[f]),b=()=>{let n={renderAs:s};return O&&(n=O(n)),n},R=()=>{const n=b();r.current=new M(l.current,n,c=>{if(process.env.NODE_ENV!=="production")throw c;console.warn(c)})},k=()=>{if(r.current!==null){const n=b();r.current.setOptions(n)}},g=(n,c)=>{const p=f.getState();for(let d=0;d<p.length;d++)p[d].trigger(n,c)},B=()=>{r.current!==null&&(r.current.redraw(),g("render",{sender:i()}))},C=e.useRef(null);return e.useImperativeHandle(C,()=>({get barcodeInstance(){return r.current},get surface(){return null},get element(){return l.current}}),[]),e.useImperativeHandle(o,()=>C.current,[]),e.useEffect(()=>(R(),window.addEventListener("resize",B),g("render",{sender:i()}),()=>{r.current!==null&&(r.current.destroy(),r.current=null),window.removeEventListener("resize",B)}),[]),e.useEffect(()=>{if(u.current===null){u.current=t;return}const{children:n,deriveOptionsFromParent:c,getTarget:p,barcodeConstructor:d,className:W,renderAs:q,...A}=t,{children:G,deriveOptionsFromParent:V,getTarget:K,barcodeConstructor:J,className:Q,renderAs:S,...D}=u.current;if(r.current!==null){const j=I.isOptionsChanged(D,A);(q||"svg")!==(S||"svg")?(r.current!==null&&(r.current.destroy(),r.current=null),R()):j&&k(),g("render",{sender:i()})}u.current=t}),e.createElement(L.BarcodeContext.Provider,{value:T},e.createElement("div",{style:a,ref:l,className:w},y,E&&e.createElement(m.WatermarkOverlay,{message:N})))});v.propTypes={dir:h.string,renderAs:h.oneOf(["svg","canvas"])};v.displayName="KendoReactBaseBarcode";exports.BaseBarcode=v;
package/BaseBarcode.mjs CHANGED
@@ -5,128 +5,97 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as n from "react";
9
- import i from "prop-types";
10
- import { createStore as g } from "./store/store.mjs";
11
- import { observersReducer as v } from "./store/reducer.mjs";
12
- import { isOptionsChanged as u } from "./utils/common.mjs";
13
- import { BarcodeContext as b } from "./BarcodeContext.mjs";
14
- import { validatePackage as f, getLicenseMessage as O, WatermarkOverlay as w } from "@progress/kendo-react-common";
15
- import { packageMetadata as a } from "./package-metadata.mjs";
16
- const o = class o extends n.Component {
17
- constructor(e) {
18
- super(e), this.barcodeInstance = null, this.surface = null, this._element = null, this.observersStore = {}, this.showLicenseWatermark = !1, this.onWindowResize = () => {
19
- this.barcodeInstance !== null && (this.barcodeInstance.redraw(), this.trigger("render", { sender: this }));
20
- }, this.showLicenseWatermark = !f(a, { component: "Barcode" }), this.licenseMessage = O(a), this.observersStore = g(v), this.contextValue = {
21
- observersStore: this.observersStore
22
- };
23
- }
24
- /**
25
- * @hidden
26
- */
27
- get element() {
28
- return this._element;
29
- }
30
- /**
31
- * @hidden
32
- */
33
- componentDidMount() {
34
- this.instantiateCoreBarcode(), window.addEventListener("resize", this.onWindowResize), this.trigger("render", { sender: this });
35
- }
36
- /**
37
- * @hidden
38
- */
39
- componentDidUpdate(e) {
40
- const {
41
- children: r,
42
- deriveOptionsFromParent: t,
43
- getTarget: s,
44
- barcodeConstructor: C,
45
- className: I,
46
- renderAs: d,
47
- ...h
48
- } = this.props, {
49
- children: P,
50
- deriveOptionsFromParent: W,
51
- getTarget: E,
52
- barcodeConstructor: S,
53
- className: k,
54
- renderAs: l,
55
- ...p
56
- } = e;
57
- if (this.barcodeInstance !== null) {
58
- const m = u(p, h);
59
- (d || "svg") !== (l || "svg") ? (this.barcodeInstance !== null && (this.barcodeInstance.destroy(), this.barcodeInstance = null), this.instantiateCoreBarcode()) : m && this.refresh(), this.trigger("render", { sender: this });
60
- }
61
- }
62
- /**
63
- * @hidden
64
- */
65
- componentWillUnmount() {
66
- this.barcodeInstance !== null && (this.barcodeInstance.destroy(), this.barcodeInstance = null), window.removeEventListener("resize", this.onWindowResize);
67
- }
68
- /**
69
- * @hidden
70
- */
71
- render() {
72
- const { style: e = {}, className: r, children: t } = this.props;
73
- return /* @__PURE__ */ n.createElement(b.Provider, { value: this.contextValue }, /* @__PURE__ */ n.createElement(
74
- "div",
75
- {
76
- style: e,
77
- ref: (s) => {
78
- this._element = s;
79
- },
80
- className: r
81
- },
82
- t,
83
- this.showLicenseWatermark && /* @__PURE__ */ n.createElement(w, { message: this.licenseMessage })
84
- ));
85
- }
86
- /**
87
- * @hidden
88
- */
89
- instantiateCoreBarcode() {
90
- const { barcodeConstructor: e } = this.props, r = this.getBarcodeOptions();
91
- this.barcodeInstance = new e(this.element, r, (t) => {
8
+ import * as e from "react";
9
+ import O from "prop-types";
10
+ import { createStore as I } from "./store/store.mjs";
11
+ import { observersReducer as L } from "./store/reducer.mjs";
12
+ import { isOptionsChanged as z } from "./utils/common.mjs";
13
+ import { BarcodeContext as H } from "./BarcodeContext.mjs";
14
+ import { validatePackage as S, getLicenseMessage as W, WatermarkOverlay as G } from "@progress/kendo-react-common";
15
+ import { packageMetadata as R } from "./package-metadata.mjs";
16
+ const V = {
17
+ renderAs: "svg"
18
+ }, b = e.forwardRef((s, h) => {
19
+ const {
20
+ renderAs: C = V.renderAs,
21
+ style: B = {},
22
+ className: w,
23
+ children: P,
24
+ barcodeConstructor: E,
25
+ deriveOptionsFromParent: m,
26
+ getTarget: a
27
+ } = s, u = e.useRef(null), r = e.useRef(null), o = e.useRef(null), A = e.useMemo(() => !S(R, { component: "Barcode" }), []), N = e.useMemo(() => W(R), []), i = e.useMemo(() => I(L), []), y = e.useMemo(() => ({ observersStore: i }), [i]), f = () => {
28
+ let t = { renderAs: C };
29
+ return m && (t = m(t)), t;
30
+ }, p = () => {
31
+ const t = f();
32
+ r.current = new E(u.current, t, (n) => {
92
33
  if (process.env.NODE_ENV !== "production")
93
- throw t;
94
- console.warn(t);
34
+ throw n;
35
+ console.warn(n);
95
36
  });
96
- }
97
- /**
98
- * @hidden
99
- */
100
- refresh() {
101
- if (this.barcodeInstance !== null) {
102
- const e = this.getBarcodeOptions();
103
- this.barcodeInstance.setOptions(e);
37
+ }, M = () => {
38
+ if (r.current !== null) {
39
+ const t = f();
40
+ r.current.setOptions(t);
104
41
  }
105
- }
106
- /**
107
- * @hidden
108
- */
109
- getBarcodeOptions() {
110
- const { renderAs: e, deriveOptionsFromParent: r } = this.props;
111
- let t = { renderAs: e };
112
- return r && (t = r(t)), t;
113
- }
114
- /**
115
- * @hidden
116
- */
117
- trigger(e, r) {
118
- const t = this.observersStore.getState();
119
- for (let s = 0; s < t.length; s++)
120
- t[s].trigger(e, r);
121
- }
122
- };
123
- o.propTypes = {
124
- dir: i.string,
125
- renderAs: i.oneOf(["svg", "canvas"])
126
- }, o.defaultProps = {
127
- renderAs: "svg"
42
+ }, d = (t, n) => {
43
+ const l = i.getState();
44
+ for (let c = 0; c < l.length; c++)
45
+ l[c].trigger(t, n);
46
+ }, v = () => {
47
+ r.current !== null && (r.current.redraw(), d("render", { sender: a() }));
48
+ }, g = e.useRef(null);
49
+ return e.useImperativeHandle(
50
+ g,
51
+ () => ({
52
+ get barcodeInstance() {
53
+ return r.current;
54
+ },
55
+ get surface() {
56
+ return null;
57
+ },
58
+ get element() {
59
+ return u.current;
60
+ }
61
+ }),
62
+ []
63
+ ), e.useImperativeHandle(h, () => g.current, []), e.useEffect(() => (p(), window.addEventListener("resize", v), d("render", { sender: a() }), () => {
64
+ r.current !== null && (r.current.destroy(), r.current = null), window.removeEventListener("resize", v);
65
+ }), []), e.useEffect(() => {
66
+ if (o.current === null) {
67
+ o.current = s;
68
+ return;
69
+ }
70
+ const {
71
+ children: t,
72
+ deriveOptionsFromParent: n,
73
+ getTarget: l,
74
+ barcodeConstructor: c,
75
+ className: K,
76
+ renderAs: T,
77
+ ...F
78
+ } = s, {
79
+ children: _,
80
+ deriveOptionsFromParent: j,
81
+ getTarget: q,
82
+ barcodeConstructor: J,
83
+ className: Q,
84
+ renderAs: k,
85
+ ...x
86
+ } = o.current;
87
+ if (r.current !== null) {
88
+ const D = z(x, F);
89
+ (T || "svg") !== (k || "svg") ? (r.current !== null && (r.current.destroy(), r.current = null), p()) : D && M(), d("render", { sender: a() });
90
+ }
91
+ o.current = s;
92
+ }), /* @__PURE__ */ e.createElement(H.Provider, { value: y }, /* @__PURE__ */ e.createElement("div", { style: B, ref: u, className: w }, P, A && /* @__PURE__ */ e.createElement(G, { message: N })));
93
+ });
94
+ b.propTypes = {
95
+ dir: O.string,
96
+ renderAs: O.oneOf(["svg", "canvas"])
128
97
  };
129
- let c = o;
98
+ b.displayName = "KendoReactBaseBarcode";
130
99
  export {
131
- c as BaseBarcode
100
+ b as BaseBarcode
132
101
  };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Surface } from '@progress/kendo-drawing';
9
+ /**
10
+ * @hidden
11
+ */
12
+ export interface BaseBarcodeHandle {
13
+ /** @hidden */
14
+ barcodeInstance: any;
15
+ /** @hidden */
16
+ surface: Surface | null;
17
+ /** @hidden */
18
+ element: HTMLDivElement | null;
19
+ }
package/QRCode.d.ts CHANGED
@@ -6,50 +6,9 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import { QRCodeProps } from './QRCodeProps';
9
- import { Surface, Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
9
+ import { QRCodeHandle } from './QRCodeHandle';
10
10
  import * as React from 'react';
11
11
  /**
12
12
  * Represents the KendoReact QRCode component.
13
13
  */
14
- export declare class QRCode extends React.Component<QRCodeProps, {}> {
15
- private _baseBarcode;
16
- /**
17
- * @hidden
18
- */
19
- get barcodeInstance(): any;
20
- /**
21
- * Gets the Drawing `Surface` of the Barcode.
22
- */
23
- get surface(): Surface | null;
24
- /**
25
- * Gets the DOM element of the Barcode.
26
- */
27
- get element(): HTMLDivElement | null;
28
- /**
29
- * @hidden
30
- */
31
- render(): any;
32
- /**
33
- * Exports the component as an image. The export operation runs asynchronously and returns a promise.
34
- *
35
- * @param {ImageExportOptions} options - The parameters for the exported image.
36
- * @returns {Promise<string>} - A promise that resolves with a PNG image encoded as a Data URI.
37
- */
38
- exportImage(options?: ImageExportOptions): Promise<string>;
39
- /**
40
- * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
41
- *
42
- * @param options - The parameters for the exported file.
43
- * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
44
- */
45
- exportSVG(options?: SVGExportOptions): Promise<string>;
46
- /**
47
- * Exports a Barcode component as a Drawing `Scene`.
48
- *
49
- * @param {any} options - The parameters for the export operation.
50
- * @returns {Group} A promise that returns the root `Group` of the scene.
51
- */
52
- exportVisual(options?: any): Group;
53
- private getTarget;
54
- private deriveOptionsFromParent;
55
- }
14
+ export declare const QRCode: React.ForwardRefExoticComponent<QRCodeProps & React.RefAttributes<QRCodeHandle>>;
package/QRCode.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),v=require("./BaseBarcode.js"),x=require("@progress/kendo-charts"),d=require("@progress/kendo-drawing"),E=require("@progress/kendo-react-common");function I(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(a,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return a.default=e,Object.freeze(a)}const n=I(k),y="#000",q="#fff",B="L",b=n.forwardRef((e,a)=>{const{children:o,className:s,...m}=e,u=n.useRef(null),i=n.useRef(e);i.current=e;const c=n.useCallback(r=>{var R;const t=(R=u.current)==null?void 0:R.barcodeInstance;return t!=null?t.exportVisual(r):new d.Group},[]),g=n.useCallback((r={})=>d.exportImage(c(),r),[c]),f=n.useCallback((r={})=>d.exportSVG(c(),r),[c]),l=n.useRef(null);n.useImperativeHandle(l,()=>({get element(){var r,t;return(t=(r=u.current)==null?void 0:r.element)!=null?t:null},get props(){return i.current},get barcodeInstance(){var r,t;return(t=(r=u.current)==null?void 0:r.barcodeInstance)!=null?t:null},get surface(){var r,t;return(t=(r=u.current)==null?void 0:r.surface)!=null?t:null},exportImage:g,exportSVG:f,exportVisual:c}),[g,f,c]),n.useImperativeHandle(a,()=>l.current,[]);const C=()=>l.current,O=r=>({...r,background:e.background||q,border:e.border,color:e.color||y,encoding:e.encoding,errorCorrection:e.errorCorrection||B,overlay:e.overlay||{},padding:e.padding,renderAs:e.renderAs,size:e.size,value:e.value});return n.createElement(v.BaseBarcode,{...m,deriveOptionsFromParent:O,ref:u,barcodeConstructor:x.QRCode,getTarget:C,className:E.classNames("k-qrcode",s)},o)});b.displayName="KendoReactQRCode";exports.QRCode=b;
package/QRCode.mjs CHANGED
@@ -5,93 +5,76 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as e from "react";
9
- import { BaseBarcode as a } from "./BaseBarcode.mjs";
10
- import { QRCode as n } from "@progress/kendo-charts";
11
- import { exportImage as i, exportSVG as c, Group as p } from "@progress/kendo-drawing";
12
- import { classNames as d } from "@progress/kendo-react-common";
13
- const u = "#000", l = "#fff", h = "L";
14
- class _ extends e.Component {
15
- constructor() {
16
- super(...arguments), this._baseBarcode = null, this.getTarget = () => this, this.deriveOptionsFromParent = (r) => Object.assign({}, r, {
17
- background: this.props.background || l,
18
- border: this.props.border,
19
- color: this.props.color || u,
20
- encoding: this.props.encoding,
21
- errorCorrection: this.props.errorCorrection || h,
22
- overlay: this.props.overlay || {},
23
- padding: this.props.padding,
24
- renderAs: this.props.renderAs,
25
- size: this.props.size,
26
- value: this.props.value
27
- });
28
- }
29
- /**
30
- * @hidden
31
- */
32
- get barcodeInstance() {
33
- return this._baseBarcode !== null ? this._baseBarcode.barcodeInstance : null;
34
- }
35
- /**
36
- * Gets the Drawing `Surface` of the Barcode.
37
- */
38
- get surface() {
39
- return this._baseBarcode !== null ? this._baseBarcode.surface : null;
40
- }
41
- /**
42
- * Gets the DOM element of the Barcode.
43
- */
44
- get element() {
45
- return this._baseBarcode !== null ? this._baseBarcode.element : null;
46
- }
47
- /**
48
- * @hidden
49
- */
50
- render() {
51
- const { children: r, className: t, ...s } = this.props;
52
- return /* @__PURE__ */ e.createElement(
53
- a,
54
- {
55
- ...s,
56
- deriveOptionsFromParent: this.deriveOptionsFromParent,
57
- ref: (o) => {
58
- this._baseBarcode = o;
59
- },
60
- barcodeConstructor: n,
61
- getTarget: this.getTarget,
62
- className: d("k-qrcode", t)
8
+ import * as n from "react";
9
+ import { BaseBarcode as b } from "./BaseBarcode.mjs";
10
+ import { QRCode as x } from "@progress/kendo-charts";
11
+ import { Group as E, exportImage as I, exportSVG as v } from "@progress/kendo-drawing";
12
+ import { classNames as O } from "@progress/kendo-react-common";
13
+ const k = "#000", A = "#fff", N = "L", V = n.forwardRef((r, i) => {
14
+ const { children: m, className: f, ...R } = r, a = n.useRef(null), u = n.useRef(r);
15
+ u.current = r;
16
+ const o = n.useCallback((e) => {
17
+ var d;
18
+ const t = (d = a.current) == null ? void 0 : d.barcodeInstance;
19
+ return t != null ? t.exportVisual(e) : new E();
20
+ }, []), s = n.useCallback(
21
+ (e = {}) => I(o(), e),
22
+ [o]
23
+ ), l = n.useCallback(
24
+ (e = {}) => v(o(), e),
25
+ [o]
26
+ ), c = n.useRef(null);
27
+ n.useImperativeHandle(
28
+ c,
29
+ () => ({
30
+ get element() {
31
+ var e, t;
32
+ return (t = (e = a.current) == null ? void 0 : e.element) != null ? t : null;
63
33
  },
64
- r
65
- );
66
- }
67
- /**
68
- * Exports the component as an image. The export operation runs asynchronously and returns a promise.
69
- *
70
- * @param {ImageExportOptions} options - The parameters for the exported image.
71
- * @returns {Promise<string>} - A promise that resolves with a PNG image encoded as a Data URI.
72
- */
73
- exportImage(r = {}) {
74
- return i(this.exportVisual(), r);
75
- }
76
- /**
77
- * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
78
- *
79
- * @param options - The parameters for the exported file.
80
- * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
81
- */
82
- exportSVG(r = {}) {
83
- return c(this.exportVisual(), r);
84
- }
85
- /**
86
- * Exports a Barcode component as a Drawing `Scene`.
87
- *
88
- * @param {any} options - The parameters for the export operation.
89
- * @returns {Group} A promise that returns the root `Group` of the scene.
90
- */
91
- exportVisual(r) {
92
- return this.barcodeInstance !== null ? this.barcodeInstance.exportVisual(r) : new p();
93
- }
94
- }
34
+ get props() {
35
+ return u.current;
36
+ },
37
+ get barcodeInstance() {
38
+ var e, t;
39
+ return (t = (e = a.current) == null ? void 0 : e.barcodeInstance) != null ? t : null;
40
+ },
41
+ get surface() {
42
+ var e, t;
43
+ return (t = (e = a.current) == null ? void 0 : e.surface) != null ? t : null;
44
+ },
45
+ exportImage: s,
46
+ exportSVG: l,
47
+ exportVisual: o
48
+ }),
49
+ [s, l, o]
50
+ ), n.useImperativeHandle(i, () => c.current, []);
51
+ const g = () => c.current, C = (e) => ({
52
+ ...e,
53
+ background: r.background || A,
54
+ border: r.border,
55
+ color: r.color || k,
56
+ encoding: r.encoding,
57
+ errorCorrection: r.errorCorrection || N,
58
+ overlay: r.overlay || {},
59
+ padding: r.padding,
60
+ renderAs: r.renderAs,
61
+ size: r.size,
62
+ value: r.value
63
+ });
64
+ return /* @__PURE__ */ n.createElement(
65
+ b,
66
+ {
67
+ ...R,
68
+ deriveOptionsFromParent: C,
69
+ ref: a,
70
+ barcodeConstructor: x,
71
+ getTarget: g,
72
+ className: O("k-qrcode", f)
73
+ },
74
+ m
75
+ );
76
+ });
77
+ V.displayName = "KendoReactQRCode";
95
78
  export {
96
- _ as QRCode
79
+ V as QRCode
97
80
  };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Surface, Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
9
+ import { QRCodeProps } from './QRCodeProps';
10
+ /**
11
+ * Represents the `ref` of the QRCode component.
12
+ */
13
+ export interface QRCodeHandle {
14
+ /** The current root DOM element or `null`. */
15
+ element: HTMLDivElement | null;
16
+ /** The props of the QRCode component. */
17
+ readonly props: Readonly<QRCodeProps>;
18
+ /**
19
+ * @hidden
20
+ */
21
+ barcodeInstance: any;
22
+ /**
23
+ * Gets the Drawing `Surface` of the QRCode.
24
+ */
25
+ surface: Surface | null;
26
+ /**
27
+ * Exports the component as an image. The export operation runs asynchronously and returns a promise.
28
+ *
29
+ * @param options - The parameters for the exported image.
30
+ * @returns A promise that resolves with a PNG image encoded as a Data URI.
31
+ */
32
+ exportImage: (options?: ImageExportOptions) => Promise<string>;
33
+ /**
34
+ * Exports the component as an SVG document. The export operation runs asynchronously and returns a promise.
35
+ *
36
+ * @param options - The parameters for the exported file.
37
+ * @returns A promise that resolves with an SVG document that is encoded as a Data URI.
38
+ */
39
+ exportSVG: (options?: SVGExportOptions) => Promise<string>;
40
+ /**
41
+ * Exports a QRCode component as a Drawing `Scene`.
42
+ *
43
+ * @param options - The parameters for the export operation.
44
+ * @returns The root `Group` of the scene.
45
+ */
46
+ exportVisual: (options?: any) => Group;
47
+ }
@@ -5,7 +5,7 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { Barcode } from './../Barcode.js';
9
- import { QRCode } from './../QRCode.js';
10
- type Barcodes = Barcode | QRCode;
8
+ import { BarcodeHandle } from './../BarcodeHandle';
9
+ import { QRCodeHandle } from './../QRCodeHandle';
10
+ type Barcodes = BarcodeHandle | QRCodeHandle;
11
11
  export { Barcodes };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-charts"),require("@progress/kendo-drawing")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-charts","@progress/kendo-drawing"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactBarcodes={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoCharts,e.KendoDrawing)}(this,function(e,t,r,s,n,o){"use strict";function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var i=a(t);const c=1e3/60,d=(e,t)=>{if(!t.type)return[];switch(t.type){case"add":return[...e,t.payload];case"remove":return e.filter(e=>e!==t.payload);default:return e}},l=e=>"object"==typeof e,p=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in e)if(e.hasOwnProperty(r)){const s=e[r],n=t[r];if(l(s)&&l(n)?p(s,n):s!==n)return!0}return!1},h=(e,t)=>{if(!e||!t||(e=[].concat(e),t=[].concat(t),e.length!==t.length))return!0;for(let r=0;r<e.length;r++)if(p(e[r],t[r]))return!0;return!1},u=i.createContext(null);u.displayName="BarcodeContext";const g=Object.freeze({name:"@progress/kendo-react-barcodes",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"15.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),b=class extends i.Component{constructor(e){super(e),this.barcodeInstance=null,this.surface=null,this._element=null,this.observersStore={},this.showLicenseWatermark=!1,this.onWindowResize=()=>{null!==this.barcodeInstance&&(this.barcodeInstance.redraw(),this.trigger("render",{sender:this}))},this.showLicenseWatermark=!s.validatePackage(g,{component:"Barcode"}),this.licenseMessage=s.getLicenseMessage(g),this.observersStore=(e=>{let t,r,n=[];const o=o=>{t=e(t,o),s.canUseDOM&&(window.clearTimeout(r),r=window.setTimeout(()=>n.forEach(e=>e()),c))};return o({}),{getState:()=>t,dispatch:o,subscribe:e=>(n.push(e),()=>n=n.filter(t=>t!==e))}})(d),this.contextValue={observersStore:this.observersStore}}get element(){return this._element}componentDidMount(){this.instantiateCoreBarcode(),window.addEventListener("resize",this.onWindowResize),this.trigger("render",{sender:this})}componentDidUpdate(e){const{children:t,deriveOptionsFromParent:r,getTarget:s,barcodeConstructor:n,className:o,renderAs:a,...i}=this.props,{children:c,deriveOptionsFromParent:d,getTarget:l,barcodeConstructor:p,className:u,renderAs:g,...b}=e;if(null!==this.barcodeInstance){const e=h(b,i);(a||"svg")!==(g||"svg")?(null!==this.barcodeInstance&&(this.barcodeInstance.destroy(),this.barcodeInstance=null),this.instantiateCoreBarcode()):e&&this.refresh(),this.trigger("render",{sender:this})}}componentWillUnmount(){null!==this.barcodeInstance&&(this.barcodeInstance.destroy(),this.barcodeInstance=null),window.removeEventListener("resize",this.onWindowResize)}render(){const{style:e={},className:t,children:r}=this.props;return i.createElement(u.Provider,{value:this.contextValue},i.createElement("div",{style:e,ref:e=>{this._element=e},className:t},r,this.showLicenseWatermark&&i.createElement(s.WatermarkOverlay,{message:this.licenseMessage})))}instantiateCoreBarcode(){const{barcodeConstructor:e}=this.props,t=this.getBarcodeOptions();this.barcodeInstance=new e(this.element,t,e=>{if("production"!==process.env.NODE_ENV)throw e;console.warn(e)})}refresh(){if(null!==this.barcodeInstance){const e=this.getBarcodeOptions();this.barcodeInstance.setOptions(e)}}getBarcodeOptions(){const{renderAs:e,deriveOptionsFromParent:t}=this.props;let r={renderAs:e};return t&&(r=t(r)),r}trigger(e,t){const r=this.observersStore.getState();for(let s=0;s<r.length;s++)r[s].trigger(e,t)}};b.propTypes={dir:r.string,renderAs:r.oneOf(["svg","canvas"])},b.defaultProps={renderAs:"svg"};let m=b;class f extends i.Component{constructor(){super(...arguments),this._baseBarcode=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>Object.assign({},e,{background:this.props.background,border:this.props.border,checksum:this.props.checksum,color:this.props.color,height:this.props.height,padding:this.props.padding,text:this.props.text,type:this.props.type,value:this.props.value,width:this.props.width})}get barcodeInstance(){return null!==this._baseBarcode?this._baseBarcode.barcodeInstance:null}get surface(){return null!==this._baseBarcode?this._baseBarcode.surface:null}get element(){return null!==this._baseBarcode?this._baseBarcode.element:null}render(){const{children:e,className:t,...r}=this.props;return i.createElement(m,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>{this._baseBarcode=e},barcodeConstructor:n.Barcode,getTarget:this.getTarget,className:s.classNames("k-barcode",t)},e)}exportImage(e={}){return o.exportImage(this.exportVisual(),e)}exportSVG(e={}){return o.exportSVG(this.exportVisual(),e)}exportVisual(e){return null!==this.barcodeInstance?this.barcodeInstance.exportVisual(e):new o.Group}}class v extends i.Component{constructor(){super(...arguments),this._baseBarcode=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>Object.assign({},e,{background:this.props.background||"#fff",border:this.props.border,color:this.props.color||"#000",encoding:this.props.encoding,errorCorrection:this.props.errorCorrection||"L",overlay:this.props.overlay||{},padding:this.props.padding,renderAs:this.props.renderAs,size:this.props.size,value:this.props.value})}get barcodeInstance(){return null!==this._baseBarcode?this._baseBarcode.barcodeInstance:null}get surface(){return null!==this._baseBarcode?this._baseBarcode.surface:null}get element(){return null!==this._baseBarcode?this._baseBarcode.element:null}render(){const{children:e,className:t,...r}=this.props;return i.createElement(m,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>{this._baseBarcode=e},barcodeConstructor:n.QRCode,getTarget:this.getTarget,className:s.classNames("k-qrcode",t)},e)}exportImage(e={}){return o.exportImage(this.exportVisual(),e)}exportSVG(e={}){return o.exportSVG(this.exportVisual(),e)}exportVisual(e){return null!==this.barcodeInstance?this.barcodeInstance.exportVisual(e):new o.Group}}e.Barcode=f,e.QRCode=v});
15
+ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-charts"),require("@progress/kendo-drawing")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-charts","@progress/kendo-drawing"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactBarcodes={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoCharts,e.KendoDrawing)}(this,function(e,r,t,n,o,c){"use strict";function a(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var s=a(r);const u=1e3/60,l=(e,r)=>{if(!r.type)return[];switch(r.type){case"add":return[...e,r.payload];case"remove":return e.filter(e=>e!==r.payload);default:return e}},d=e=>"object"==typeof e,i=(e,r)=>{if(Object.keys(e).length!==Object.keys(r).length)return!0;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t],o=r[t];if(d(n)&&d(o)?i(n,o):n!==o)return!0}return!1},p=(e,r)=>{if(!e||!r||(e=[].concat(e),r=[].concat(r),e.length!==r.length))return!0;for(let t=0;t<e.length;t++)if(i(e[t],r[t]))return!0;return!1},f=s.createContext(null);f.displayName="BarcodeContext";const g=Object.freeze({name:"@progress/kendo-react-barcodes",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"15.2.0-develop.3",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),m={renderAs:"svg"},v=s.forwardRef((e,r)=>{const{renderAs:t=m.renderAs,style:o={},className:c,children:a,barcodeConstructor:d,deriveOptionsFromParent:i,getTarget:v}=e,b=s.useRef(null),h=s.useRef(null),y=s.useRef(null),k=s.useMemo(()=>!n.validatePackage(g,{component:"Barcode"}),[]),w=s.useMemo(()=>n.getLicenseMessage(g),[]),R=s.useMemo(()=>(e=>{let r,t,o=[];const c=c=>{r=e(r,c),n.canUseDOM&&(window.clearTimeout(t),t=window.setTimeout(()=>o.forEach(e=>e()),u))};return c({}),{getState:()=>r,dispatch:c,subscribe:e=>(o.push(e),()=>o=o.filter(r=>r!==e))}})(l),[]),C=s.useMemo(()=>({observersStore:R}),[R]),O=()=>{let e={renderAs:t};return i&&(e=i(e)),e},I=()=>{const e=O();h.current=new d(b.current,e,e=>{if("production"!==process.env.NODE_ENV)throw e;console.warn(e)})},N=(e,r)=>{const t=R.getState();for(let n=0;n<t.length;n++)t[n].trigger(e,r)},x=()=>{null!==h.current&&(h.current.redraw(),N("render",{sender:v()}))},E=s.useRef(null);return s.useImperativeHandle(E,()=>({get barcodeInstance(){return h.current},get surface(){return null},get element(){return b.current}}),[]),s.useImperativeHandle(r,()=>E.current,[]),s.useEffect(()=>(I(),window.addEventListener("resize",x),N("render",{sender:v()}),()=>{null!==h.current&&(h.current.destroy(),h.current=null),window.removeEventListener("resize",x)}),[]),s.useEffect(()=>{if(null===y.current)return void(y.current=e);const{children:r,deriveOptionsFromParent:t,getTarget:n,barcodeConstructor:o,className:c,renderAs:a,...s}=e,{children:u,deriveOptionsFromParent:l,getTarget:d,barcodeConstructor:i,className:f,renderAs:g,...m}=y.current;if(null!==h.current){const e=p(m,s);(a||"svg")!==(g||"svg")?(null!==h.current&&(h.current.destroy(),h.current=null),I()):e&&(()=>{if(null!==h.current){const e=O();h.current.setOptions(e)}})(),N("render",{sender:v()})}y.current=e}),s.createElement(f.Provider,{value:C},s.createElement("div",{style:o,ref:b,className:c},a,k&&s.createElement(n.WatermarkOverlay,{message:w})))});v.propTypes={dir:t.string,renderAs:t.oneOf(["svg","canvas"])},v.displayName="KendoReactBaseBarcode";const b=s.forwardRef((e,r)=>{const{children:t,className:a,...u}=e,l=s.useRef(null),d=s.useRef(e);d.current=e;const i=s.useCallback(e=>{var r;const t=null==(r=l.current)?void 0:r.barcodeInstance;return null!=t?t.exportVisual(e):new c.Group},[]),p=s.useCallback((e={})=>c.exportImage(i(),e),[i]),f=s.useCallback((e={})=>c.exportSVG(i(),e),[i]),g=s.useRef(null);s.useImperativeHandle(g,()=>({get element(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.element)?r:null},get props(){return d.current},get barcodeInstance(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.barcodeInstance)?r:null},get surface(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.surface)?r:null},exportImage:p,exportSVG:f,exportVisual:i}),[p,f,i]),s.useImperativeHandle(r,()=>g.current,[]);return s.createElement(v,{...u,deriveOptionsFromParent:r=>({...r,background:e.background,border:e.border,checksum:e.checksum,color:e.color,height:e.height,padding:e.padding,text:e.text,type:e.type,value:e.value,width:e.width}),ref:l,barcodeConstructor:o.Barcode,getTarget:()=>g.current,className:n.classNames("k-barcode",a)},t)});b.displayName="KendoReactBarcode";const h=s.forwardRef((e,r)=>{const{children:t,className:a,...u}=e,l=s.useRef(null),d=s.useRef(e);d.current=e;const i=s.useCallback(e=>{var r;const t=null==(r=l.current)?void 0:r.barcodeInstance;return null!=t?t.exportVisual(e):new c.Group},[]),p=s.useCallback((e={})=>c.exportImage(i(),e),[i]),f=s.useCallback((e={})=>c.exportSVG(i(),e),[i]),g=s.useRef(null);s.useImperativeHandle(g,()=>({get element(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.element)?r:null},get props(){return d.current},get barcodeInstance(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.barcodeInstance)?r:null},get surface(){var e,r;return null!=(r=null==(e=l.current)?void 0:e.surface)?r:null},exportImage:p,exportSVG:f,exportVisual:i}),[p,f,i]),s.useImperativeHandle(r,()=>g.current,[]);return s.createElement(v,{...u,deriveOptionsFromParent:r=>({...r,background:e.background||"#fff",border:e.border,color:e.color||"#000",encoding:e.encoding,errorCorrection:e.errorCorrection||"L",overlay:e.overlay||{},padding:e.padding,renderAs:e.renderAs,size:e.size,value:e.value}),ref:l,barcodeConstructor:o.QRCode,getTarget:()=>g.current,className:n.classNames("k-qrcode",a)},t)});h.displayName="KendoReactQRCode",e.Barcode=b,e.QRCode=h});
package/index.d.mts CHANGED
@@ -6,8 +6,10 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import { Barcode } from './Barcode.js';
9
+ import { BarcodeHandle } from './BarcodeHandle';
9
10
  import { BarcodeProps } from './BarcodeProps';
10
11
  import { QRCode } from './QRCode.js';
12
+ import { QRCodeHandle } from './QRCodeHandle';
11
13
  import { QRCodeProps } from './QRCodeProps';
12
14
  export * from './types';
13
- export { Barcode, BarcodeProps, QRCode, QRCodeProps };
15
+ export { Barcode, BarcodeHandle, BarcodeProps, QRCode, QRCodeHandle, QRCodeProps };
package/index.d.ts CHANGED
@@ -6,8 +6,10 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import { Barcode } from './Barcode.js';
9
+ import { BarcodeHandle } from './BarcodeHandle';
9
10
  import { BarcodeProps } from './BarcodeProps';
10
11
  import { QRCode } from './QRCode.js';
12
+ import { QRCodeHandle } from './QRCodeHandle';
11
13
  import { QRCodeProps } from './QRCodeProps';
12
14
  export * from './types';
13
- export { Barcode, BarcodeProps, QRCode, QRCodeProps };
15
+ export { Barcode, BarcodeHandle, BarcodeProps, QRCode, QRCodeHandle, QRCodeProps };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-barcodes",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1784273818,version:"15.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"});exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-barcodes",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1785775471,version:"15.2.0-develop.3",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"});exports.packageMetadata=e;
@@ -7,7 +7,7 @@ export const packageMetadata = Object.freeze({
7
7
  productName: 'KendoReact',
8
8
  productCode: 'KENDOUIREACT',
9
9
  productCodes: ['KENDOUIREACT'],
10
- publishDate: 1784273818,
11
- version: '15.2.0-develop.1',
10
+ publishDate: 1785775471,
11
+ version: '15.2.0-develop.3',
12
12
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/components/my-license/'
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-barcodes",
3
- "version": "15.2.0-develop.1",
3
+ "version": "15.2.0-develop.3",
4
4
  "description": "React Barcodes provide a set of React components to build beautiful and customizable barcodes. KendoReact Barcodes package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -25,11 +25,11 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "peerDependencies": {
28
- "@progress/kendo-charts": "2.12.2",
28
+ "@progress/kendo-charts": "2.13.0",
29
29
  "@progress/kendo-drawing": "^1.21.2",
30
30
  "@progress/kendo-licensing": "^1.7.2",
31
- "@progress/kendo-react-common": "15.2.0-develop.1",
32
- "@progress/kendo-react-intl": "15.2.0-develop.1",
31
+ "@progress/kendo-react-common": "15.2.0-develop.3",
32
+ "@progress/kendo-react-intl": "15.2.0-develop.3",
33
33
  "react": "^18.0.0 || ^19.0.0",
34
34
  "react-dom": "^18.0.0 || ^19.0.0"
35
35
  },
@@ -56,7 +56,7 @@
56
56
  "package": {
57
57
  "productName": "KendoReact",
58
58
  "productCode": "KENDOUIREACT",
59
- "publishDate": 1784273818,
59
+ "publishDate": 1785775471,
60
60
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
61
61
  }
62
62
  },