@lglab/react-qr-code 1.0.1 → 1.2.0

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/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # @lglab/react-qr-code
2
+
3
+ A highly customizable and lightweight QR code generator for React applications.
4
+
5
+ 🚀 **Live Demo:** [reactqrcode.com/demo](https://reactqrcode.com/demo)
6
+ 📖 **Documentation:** [reactqrcode.com](https://reactqrcode.com/)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
- import { Ref } from 'react';
2
+
3
+ /**
4
+ * ReactQRCode props.
5
+ */
6
+ export declare type BackgroundSettings = string | GradientSettings;
3
7
 
4
8
  export declare type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
5
9
 
@@ -9,11 +13,16 @@ export declare interface DataModulesSettings {
9
13
  randomSize?: boolean;
10
14
  }
11
15
 
12
- /**
13
- * ReactQRCode props.
14
- */
15
16
  export declare type DataModulesStyle = 'square' | 'square-sm' | 'rounded' | 'leaf' | 'vertical-line' | 'horizontal-line' | 'circle' | 'diamond' | 'star' | 'heart';
16
17
 
18
+ export declare type DownloadFileFormat = 'svg' | 'png' | 'jpeg';
19
+
20
+ export declare interface DownloadOptions {
21
+ name?: string;
22
+ format?: DownloadFileFormat;
23
+ size?: number;
24
+ }
25
+
17
26
  export declare type ERROR_LEVEL_MAPPED_TYPE = {
18
27
  [index in ErrorCorrectionLevel]: qrcodegen.QrCode.Ecc;
19
28
  };
@@ -41,6 +50,19 @@ export declare interface FinderPatternOuterSettings {
41
50
 
42
51
  export declare type FinderPatternOuterStyle = 'square' | 'rounded-sm' | 'rounded' | 'rounded-lg' | 'circle' | 'inpoint-sm' | 'inpoint' | 'inpoint-lg' | 'outpoint-sm' | 'outpoint' | 'outpoint-lg' | 'leaf-sm' | 'leaf' | 'leaf-lg';
43
52
 
53
+ export declare interface GradientSettings {
54
+ type: GradientSettingsType;
55
+ stops: GradientSettingsStop[];
56
+ rotation?: number;
57
+ }
58
+
59
+ export declare interface GradientSettingsStop {
60
+ offset: string;
61
+ color: string;
62
+ }
63
+
64
+ export declare type GradientSettingsType = 'linear' | 'radial';
65
+
44
66
  /**
45
67
  * Image settings for the QR Code.
46
68
  */
@@ -202,7 +224,7 @@ export declare const ReactQRCode: {
202
224
  };
203
225
 
204
226
  export declare interface ReactQRCodeProps {
205
- ref?: Ref<SVGSVGElement>;
227
+ ref?: React.Ref<ReactQRCodeRef>;
206
228
  /**
207
229
  * The value to encode into the QR Code. An array of strings can be passed in
208
230
  * to represent multiple segments to further optimize the QR Code.
@@ -226,10 +248,6 @@ export declare interface ReactQRCodeProps {
226
248
  * @defaultValue 0
227
249
  */
228
250
  marginSize?: number;
229
- /**
230
- * The title to assign to the QR Code. Used for accessibility reasons.
231
- */
232
- title?: string;
233
251
  /**
234
252
  * The minimum version used when encoding the QR Code. Valid values are 1-40
235
253
  * with higher values resulting in more complex QR Codes. The optimal
@@ -246,11 +264,14 @@ export declare interface ReactQRCodeProps {
246
264
  */
247
265
  boostLevel?: boolean;
248
266
  /**
249
- * The background color used to render the QR Code.
250
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
267
+ * The QR code background either a hex color or GradientSettings.
251
268
  * @defaultValue #FFFFFF
252
269
  */
253
- bgColor?: string;
270
+ background?: BackgroundSettings;
271
+ /**
272
+ * The gradient settings applied to the qr code data modules and finder patterns.
273
+ */
274
+ gradient?: GradientSettings;
254
275
  /**
255
276
  * The settings for the data modules.
256
277
  */
@@ -273,4 +294,9 @@ export declare interface ReactQRCodeProps {
273
294
  svgProps?: React.SVGProps<SVGSVGElement>;
274
295
  }
275
296
 
297
+ export declare interface ReactQRCodeRef {
298
+ svg: SVGSVGElement | null;
299
+ download: (options: DownloadOptions) => void;
300
+ }
301
+
276
302
  export { }