@xiping/react-components 1.0.9 → 1.0.11
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/dist/cjs/components/qr-code/index.d.ts +116 -0
- package/dist/cjs/components/toast/index.d.ts +4 -0
- package/dist/cjs/react-components.css +1 -1
- package/dist/es/components/qr-code/index.d.ts +116 -0
- package/dist/es/components/toast/index.d.ts +4 -0
- package/dist/es/react-components.css +1 -1
- package/package.json +32 -34
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type ErrorCorrectionLevel = "L" | "M" | "Q" | "H";
|
|
3
|
+
type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
|
|
4
|
+
type ImageSettings = {
|
|
5
|
+
/**
|
|
6
|
+
* The URI of the embedded image.
|
|
7
|
+
*/
|
|
8
|
+
src: string;
|
|
9
|
+
/**
|
|
10
|
+
* The height, in pixels, of the image.
|
|
11
|
+
*/
|
|
12
|
+
height: number;
|
|
13
|
+
/**
|
|
14
|
+
* The width, in pixels, of the image.
|
|
15
|
+
*/
|
|
16
|
+
width: number;
|
|
17
|
+
/**
|
|
18
|
+
* Whether or not to "excavate" the modules around the embedded image. This
|
|
19
|
+
* means that any modules the embedded image overlaps will use the background
|
|
20
|
+
* color.
|
|
21
|
+
*/
|
|
22
|
+
excavate: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The horiztonal offset of the embedded image, starting from the top left corner.
|
|
25
|
+
* Will center if not specified.
|
|
26
|
+
*/
|
|
27
|
+
x?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The vertical offset of the embedded image, starting from the top left corner.
|
|
30
|
+
* Will center if not specified.
|
|
31
|
+
*/
|
|
32
|
+
y?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The opacity of the embedded image in the range of 0-1.
|
|
35
|
+
* @defaultValue 1
|
|
36
|
+
*/
|
|
37
|
+
opacity?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The cross-origin value to use when loading the image. This is used to
|
|
40
|
+
* ensure compatibility with CORS, particularly when extracting image data
|
|
41
|
+
* from QRCodeCanvas.
|
|
42
|
+
* Note: `undefined` is treated differently than the seemingly equivalent
|
|
43
|
+
* empty string. This is intended to align with HTML behavior where omitting
|
|
44
|
+
* the attribute behaves differently than the empty string.
|
|
45
|
+
*/
|
|
46
|
+
crossOrigin?: CrossOrigin;
|
|
47
|
+
};
|
|
48
|
+
export interface QRCodeProps {
|
|
49
|
+
/**
|
|
50
|
+
* The value to encode into the QR Code. An array of strings can be passed in
|
|
51
|
+
* to represent multiple segments to further optimize the QR Code.
|
|
52
|
+
*/
|
|
53
|
+
value: string | string[];
|
|
54
|
+
/**
|
|
55
|
+
* The size, in pixels, to render the QR Code.
|
|
56
|
+
* @defaultValue 128
|
|
57
|
+
*/
|
|
58
|
+
size?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The Error Correction Level to use.
|
|
61
|
+
* @see https://www.qrcode.com/en/about/error_correction.html
|
|
62
|
+
* @defaultValue L
|
|
63
|
+
*/
|
|
64
|
+
level?: ErrorCorrectionLevel;
|
|
65
|
+
/**
|
|
66
|
+
* The background color used to render the QR Code.
|
|
67
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
|
68
|
+
* @defaultValue #FFFFFF
|
|
69
|
+
*/
|
|
70
|
+
bgColor?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The foregtound color used to render the QR Code.
|
|
73
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
|
74
|
+
* @defaultValue #000000
|
|
75
|
+
*/
|
|
76
|
+
fgColor?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Whether or not a margin of 4 modules should be rendered as a part of the
|
|
79
|
+
* QR Code.
|
|
80
|
+
* @deprecated Use `marginSize` instead.
|
|
81
|
+
* @defaultValue false
|
|
82
|
+
*/
|
|
83
|
+
includeMargin?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The number of _modules_ to use for margin. The QR Code specification
|
|
86
|
+
* requires `4`, however you can specify any number. Values will be turned to
|
|
87
|
+
* integers with `Math.floor`. Overrides `includeMargin` when both are specified.
|
|
88
|
+
* @defaultValue 0
|
|
89
|
+
*/
|
|
90
|
+
marginSize?: number;
|
|
91
|
+
/**
|
|
92
|
+
* The title to assign to the QR Code. Used for accessibility reasons.
|
|
93
|
+
*/
|
|
94
|
+
title?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The minimum version used when encoding the QR Code. Valid values are 1-40
|
|
97
|
+
* with higher values resulting in more complex QR Codes. The optimal
|
|
98
|
+
* (lowest) version is determined for the `value` provided, using `minVersion`
|
|
99
|
+
* as the lower bound.
|
|
100
|
+
* @defaultValue 1
|
|
101
|
+
*/
|
|
102
|
+
minVersion?: number;
|
|
103
|
+
/**
|
|
104
|
+
* If enabled, the Error Correction Level of the result may be higher than
|
|
105
|
+
* the specified Error Correction Level option if it can be done without
|
|
106
|
+
* increasing the version.
|
|
107
|
+
* @defaultValue true
|
|
108
|
+
*/
|
|
109
|
+
boostLevel?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The settings for the embedded image.
|
|
112
|
+
*/
|
|
113
|
+
imageSettings?: ImageSettings;
|
|
114
|
+
}
|
|
115
|
+
export declare const QRCode: React.FC<QRCodeProps>;
|
|
116
|
+
export default QRCode;
|