@geneui/components 3.0.0-next-06dadf3-29102024 → 3.0.0-next-48d0ef7-31102024

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.
Files changed (247) hide show
  1. package/Avatar.js +63 -0
  2. package/Divider.js +23 -0
  3. package/{GeneUIProvider/index.js → GeneUIProvider.js} +51 -64
  4. package/HelperText.js +69 -0
  5. package/Info.js +64 -0
  6. package/Label.js +38 -0
  7. package/Loader.js +21 -0
  8. package/Pill.js +64 -0
  9. package/TextLink.js +20 -0
  10. package/{index-c7646e48.js → Tooltip.js} +101 -79
  11. package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
  12. package/components/atoms/Avatar/index.d.ts +1 -0
  13. package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
  14. package/components/atoms/Divider/index.d.ts +1 -0
  15. package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
  16. package/components/atoms/HelperText/index.d.ts +1 -0
  17. package/{lib → components}/atoms/Info/Info.d.ts +5 -5
  18. package/components/atoms/Info/index.d.ts +1 -0
  19. package/{lib → components}/atoms/Label/Label.d.ts +3 -3
  20. package/components/atoms/Label/index.d.ts +1 -0
  21. package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
  22. package/components/atoms/Loader/index.d.ts +1 -0
  23. package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
  24. package/components/atoms/Pill/index.d.ts +1 -0
  25. package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
  26. package/components/atoms/TextLink/index.d.ts +1 -0
  27. package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
  28. package/components/molecules/Tooltip/index.d.ts +1 -0
  29. package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
  30. package/components/providers/GeneUIProvider/index.d.ts +1 -0
  31. package/hooks/index.d.ts +2 -20
  32. package/hooks/useDebounceCallback/index.d.ts +1 -0
  33. package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
  34. package/hooks/useEllipsisDetection/index.d.ts +1 -1
  35. package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
  36. package/{index-031ff73c.js → index-ce02421b.js} +4 -4
  37. package/index.d.ts +11 -121
  38. package/index.js +12 -159
  39. package/package.json +24 -43
  40. package/tokens-0abb4e1b.js +6 -0
  41. package/types/index.d.ts +0 -3
  42. package/useEllipsisDetection-46d712b6.js +34 -0
  43. package/ActionableList/index.js +0 -1694
  44. package/AdvancedSearch/index.js +0 -892
  45. package/Alert/index.js +0 -98
  46. package/Avatar/index.js +0 -58
  47. package/Badge/index.js +0 -29
  48. package/Breadcrumb/index.js +0 -130
  49. package/BusyLoader/index.js +0 -31
  50. package/Button/index.js +0 -30
  51. package/Card/index.js +0 -502
  52. package/CardList/index.js +0 -662
  53. package/CellMeasurerCache-26f3693c.js +0 -229
  54. package/Charts/index.js +0 -17662
  55. package/Checkbox/index.js +0 -229
  56. package/CheckboxGroup/index.js +0 -203
  57. package/CheckboxGroupWithSearch/index.js +0 -280
  58. package/Collapse/index.js +0 -195
  59. package/ColorPicker/index.js +0 -210
  60. package/ComboBox/index.js +0 -524
  61. package/Copy/index.js +0 -56
  62. package/Counter/index.js +0 -312
  63. package/DateFilter/index.js +0 -183
  64. package/DatePicker/index.js +0 -1229
  65. package/DatePickerInput/index.js +0 -883
  66. package/Divider/index.js +0 -23
  67. package/Drawer/index.js +0 -261
  68. package/Dropdown/index.js +0 -43
  69. package/Editor/index.js +0 -22975
  70. package/Empty/index.js +0 -76
  71. package/ExtendedInput/index.js +0 -590
  72. package/Form/index.js +0 -85
  73. package/FormContainer/index.js +0 -189
  74. package/FormableCheckbox/index.js +0 -24
  75. package/FormableDatePicker/index.js +0 -43
  76. package/FormableDropdown/index.js +0 -50
  77. package/FormableEditor/index.js +0 -26
  78. package/FormableHOC-85f89a81.js +0 -83
  79. package/FormableMultiSelectDropdown/index.js +0 -50
  80. package/FormableNumberInput/index.js +0 -34
  81. package/FormableRadio/index.js +0 -22
  82. package/FormableSwitcher/index.js +0 -22
  83. package/FormableTextInput/index.js +0 -34
  84. package/FormableUploader/index.js +0 -44
  85. package/Grid/index.js +0 -167
  86. package/HelperText/index.js +0 -86
  87. package/Holder/index.js +0 -261
  88. package/Icon/index.js +0 -62
  89. package/Image/index.js +0 -45
  90. package/ImagePreview/index.js +0 -217
  91. package/Info/index.js +0 -41
  92. package/InfoOutline-dd2e89d9.js +0 -29
  93. package/InteractiveWidget/index.js +0 -78
  94. package/KeyValue/index.js +0 -22
  95. package/Label/index.js +0 -48
  96. package/LinkButton/index.js +0 -34
  97. package/Loader/index.js +0 -23
  98. package/Menu/index.js +0 -281
  99. package/MobileNavigation/index.js +0 -94
  100. package/MobilePopup/index.js +0 -182
  101. package/Modal/index.js +0 -251
  102. package/ModuleTitle/index.js +0 -141
  103. package/NavigationMenu/index.js +0 -222
  104. package/Notification/index.js +0 -120
  105. package/Option/index.js +0 -184
  106. package/Overlay/index.js +0 -187
  107. package/Overspread/index.js +0 -291
  108. package/Pagination/index.js +0 -261
  109. package/Paper/index.js +0 -96
  110. package/Pill/index.js +0 -67
  111. package/Popover/index.js +0 -725
  112. package/PopoverV2/index.js +0 -19
  113. package/Portal/index.js +0 -58
  114. package/Products/index.js +0 -115
  115. package/Profile/index.js +0 -589
  116. package/Progress/index.js +0 -200
  117. package/QRCode/index.js +0 -814
  118. package/Radio/index.js +0 -151
  119. package/RadioGroup/index.js +0 -104
  120. package/Range/index.js +0 -191
  121. package/Rating/index.js +0 -174
  122. package/RichEditor/index.js +0 -13
  123. package/RichEditor-6ca8346f.js +0 -228
  124. package/Scrollbar/index.js +0 -1585
  125. package/Search/index.js +0 -75
  126. package/SearchWithDropdown/index.js +0 -140
  127. package/Section/index.js +0 -61
  128. package/SkeletonLoader/index.js +0 -81
  129. package/Slider/index.js +0 -261
  130. package/Status/index.js +0 -97
  131. package/Steps/index.js +0 -314
  132. package/SuggestionList/index.js +0 -385
  133. package/Switcher/index.js +0 -193
  134. package/Table/index.js +0 -57
  135. package/TableCompositions/index.js +0 -16995
  136. package/Tabs/index.js +0 -235
  137. package/Tag/index.js +0 -102
  138. package/TextLink/index.js +0 -20
  139. package/Textarea/index.js +0 -242
  140. package/Time/index.js +0 -62
  141. package/TimePicker/index.js +0 -575
  142. package/Timeline/index.js +0 -113
  143. package/Title/index.js +0 -65
  144. package/Toaster/index.js +0 -116
  145. package/Tooltip/index.js +0 -6
  146. package/TransferList/index.js +0 -493
  147. package/Uploader/index.js +0 -992
  148. package/ValidatableCheckbox/index.js +0 -123
  149. package/ValidatableDatePicker/index.js +0 -316
  150. package/ValidatableDropdown/index.js +0 -141
  151. package/ValidatableElements/index.js +0 -67
  152. package/ValidatableMultiSelectDropdown/index.js +0 -152
  153. package/ValidatableNumberInput/index.js +0 -204
  154. package/ValidatableRadio/index.js +0 -116
  155. package/ValidatableSwitcher/index.js +0 -93
  156. package/ValidatableTextInput/index.js +0 -167
  157. package/ValidatableTimeInput/index.js +0 -174
  158. package/ValidatableUploader/index.js +0 -98
  159. package/Widget/index.js +0 -225
  160. package/_commonjsHelpers-24198af3.js +0 -35
  161. package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
  162. package/callAfterDelay-7272faca.js +0 -12
  163. package/checkTimeValidation-e56771be.js +0 -16
  164. package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
  165. package/clsx.m-2bb6df4b.js +0 -3
  166. package/config-1053d64d.js +0 -20
  167. package/configs-00612ce0.js +0 -103
  168. package/configs.js +0 -111
  169. package/dateValidation-67caec66.js +0 -225
  170. package/debounce-4419bc2f.js +0 -17
  171. package/guid-8ddf77b3.js +0 -16
  172. package/hooks/useBodyScroll.js +0 -16
  173. package/hooks/useClick.js +0 -18
  174. package/hooks/useClickOutside.js +0 -25
  175. package/hooks/useDebounce.js +0 -28
  176. package/hooks/useDeviceType.js +0 -17
  177. package/hooks/useDidMount.js +0 -15
  178. package/hooks/useForceUpdate.js +0 -8
  179. package/hooks/useHover.js +0 -20
  180. package/hooks/useImgDownload.js +0 -18
  181. package/hooks/useKeyDown.js +0 -21
  182. package/hooks/useMount.js +0 -13
  183. package/hooks/useMutationObserver.js +0 -21
  184. package/hooks/usePrevious.js +0 -10
  185. package/hooks/useThrottle.js +0 -16
  186. package/hooks/useToggle.js +0 -11
  187. package/hooks/useUpdatableRef.js +0 -14
  188. package/hooks/useUpdate.js +0 -10
  189. package/hooks/useWidth.js +0 -16
  190. package/hooks/useWindowSize.js +0 -40
  191. package/index-122432cd.js +0 -270
  192. package/index-262edd7a.js +0 -77
  193. package/index-3188e46e.js +0 -1940
  194. package/index-45eafea6.js +0 -90
  195. package/index-5f37f281.js +0 -168
  196. package/index-ce12e4a9.js +0 -10032
  197. package/index-d0ecb950.js +0 -6483
  198. package/index-fcbae78d.js +0 -4
  199. package/index.mobile.d.ts +0 -14
  200. package/lib/atoms/Avatar/index.d.ts +0 -1
  201. package/lib/atoms/Badge/Badge.d.ts +0 -36
  202. package/lib/atoms/Badge/index.d.ts +0 -1
  203. package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
  204. package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
  205. package/lib/atoms/BusyLoader/index.d.ts +0 -1
  206. package/lib/atoms/Button/Button.d.ts +0 -70
  207. package/lib/atoms/Button/index.d.ts +0 -1
  208. package/lib/atoms/Divider/index.d.ts +0 -1
  209. package/lib/atoms/Empty/Empty.d.ts +0 -39
  210. package/lib/atoms/Empty/index.d.ts +0 -1
  211. package/lib/atoms/Empty/utils.d.ts +0 -9
  212. package/lib/atoms/HelperText/index.d.ts +0 -1
  213. package/lib/atoms/Image/Image.d.ts +0 -51
  214. package/lib/atoms/Image/index.d.ts +0 -1
  215. package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
  216. package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
  217. package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
  218. package/lib/atoms/ImagePreview/index.d.ts +0 -1
  219. package/lib/atoms/Info/index.d.ts +0 -1
  220. package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
  221. package/lib/atoms/KeyValue/index.d.ts +0 -1
  222. package/lib/atoms/Label/index.d.ts +0 -1
  223. package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
  224. package/lib/atoms/LinkButton/index.d.ts +0 -1
  225. package/lib/atoms/Loader/index.d.ts +0 -1
  226. package/lib/atoms/Pill/index.d.ts +0 -1
  227. package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
  228. package/lib/atoms/Rating/Rating.d.ts +0 -49
  229. package/lib/atoms/Rating/index.d.ts +0 -1
  230. package/lib/atoms/TextLink/index.d.ts +0 -1
  231. package/lib/molecules/Copy/Copy.d.ts +0 -38
  232. package/lib/molecules/Copy/index.d.ts +0 -1
  233. package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
  234. package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
  235. package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
  236. package/lib/molecules/Tooltip/index.d.ts +0 -1
  237. package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
  238. package/lib/providers/GeneUIProvider/index.d.ts +0 -1
  239. package/localization-4ba17032.js +0 -46
  240. package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
  241. package/rangeAndSlider-740a236c.js +0 -8676
  242. package/react-beautiful-dnd.esm-8c7b5a83.js +0 -10116
  243. package/react-lifecycles-compat.es-6e1f3768.js +0 -158
  244. package/redux-e591c1b8.js +0 -536
  245. package/tokens-8ab1179c.js +0 -6
  246. package/tslib.es6-f211516f.js +0 -35
  247. package/useEllipsisDetection-c1c9ad94.js +0 -38
package/QRCode/index.js DELETED
@@ -1,814 +0,0 @@
1
- import React__default from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
- // src/third-party/qrcodegen/index.ts
34
- /**
35
- * @license QR Code generator library (TypeScript)
36
- * Copyright (c) Project Nayuki.
37
- * SPDX-License-Identifier: MIT
38
- */
39
- var qrcodegen;
40
- ((qrcodegen2) => {
41
- const _QrCode = class {
42
- constructor(version, errorCorrectionLevel, dataCodewords, msk) {
43
- this.version = version;
44
- this.errorCorrectionLevel = errorCorrectionLevel;
45
- this.modules = [];
46
- this.isFunction = [];
47
- if (version < _QrCode.MIN_VERSION || version > _QrCode.MAX_VERSION)
48
- throw new RangeError("Version value out of range");
49
- if (msk < -1 || msk > 7)
50
- throw new RangeError("Mask value out of range");
51
- this.size = version * 4 + 17;
52
- let row = [];
53
- for (let i = 0; i < this.size; i++)
54
- row.push(false);
55
- for (let i = 0; i < this.size; i++) {
56
- this.modules.push(row.slice());
57
- this.isFunction.push(row.slice());
58
- }
59
- this.drawFunctionPatterns();
60
- const allCodewords = this.addEccAndInterleave(dataCodewords);
61
- this.drawCodewords(allCodewords);
62
- if (msk == -1) {
63
- let minPenalty = 1e9;
64
- for (let i = 0; i < 8; i++) {
65
- this.applyMask(i);
66
- this.drawFormatBits(i);
67
- const penalty = this.getPenaltyScore();
68
- if (penalty < minPenalty) {
69
- msk = i;
70
- minPenalty = penalty;
71
- }
72
- this.applyMask(i);
73
- }
74
- }
75
- assert(0 <= msk && msk <= 7);
76
- this.mask = msk;
77
- this.applyMask(msk);
78
- this.drawFormatBits(msk);
79
- this.isFunction = [];
80
- }
81
- static encodeText(text, ecl) {
82
- const segs = qrcodegen2.QrSegment.makeSegments(text);
83
- return _QrCode.encodeSegments(segs, ecl);
84
- }
85
- static encodeBinary(data, ecl) {
86
- const seg = qrcodegen2.QrSegment.makeBytes(data);
87
- return _QrCode.encodeSegments([seg], ecl);
88
- }
89
- static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {
90
- if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7)
91
- throw new RangeError("Invalid value");
92
- let version;
93
- let dataUsedBits;
94
- for (version = minVersion; ; version++) {
95
- const dataCapacityBits2 = _QrCode.getNumDataCodewords(version, ecl) * 8;
96
- const usedBits = QrSegment.getTotalBits(segs, version);
97
- if (usedBits <= dataCapacityBits2) {
98
- dataUsedBits = usedBits;
99
- break;
100
- }
101
- if (version >= maxVersion)
102
- throw new RangeError("Data too long");
103
- }
104
- for (const newEcl of [_QrCode.Ecc.MEDIUM, _QrCode.Ecc.QUARTILE, _QrCode.Ecc.HIGH]) {
105
- if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version, newEcl) * 8)
106
- ecl = newEcl;
107
- }
108
- let bb = [];
109
- for (const seg of segs) {
110
- appendBits(seg.mode.modeBits, 4, bb);
111
- appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
112
- for (const b of seg.getData())
113
- bb.push(b);
114
- }
115
- assert(bb.length == dataUsedBits);
116
- const dataCapacityBits = _QrCode.getNumDataCodewords(version, ecl) * 8;
117
- assert(bb.length <= dataCapacityBits);
118
- appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
119
- appendBits(0, (8 - bb.length % 8) % 8, bb);
120
- assert(bb.length % 8 == 0);
121
- for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)
122
- appendBits(padByte, 8, bb);
123
- let dataCodewords = [];
124
- while (dataCodewords.length * 8 < bb.length)
125
- dataCodewords.push(0);
126
- bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));
127
- return new _QrCode(version, ecl, dataCodewords, mask);
128
- }
129
- getModule(x, y) {
130
- return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
131
- }
132
- getModules() {
133
- return this.modules;
134
- }
135
- drawFunctionPatterns() {
136
- for (let i = 0; i < this.size; i++) {
137
- this.setFunctionModule(6, i, i % 2 == 0);
138
- this.setFunctionModule(i, 6, i % 2 == 0);
139
- }
140
- this.drawFinderPattern(3, 3);
141
- this.drawFinderPattern(this.size - 4, 3);
142
- this.drawFinderPattern(3, this.size - 4);
143
- const alignPatPos = this.getAlignmentPatternPositions();
144
- const numAlign = alignPatPos.length;
145
- for (let i = 0; i < numAlign; i++) {
146
- for (let j = 0; j < numAlign; j++) {
147
- if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
148
- this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
149
- }
150
- }
151
- this.drawFormatBits(0);
152
- this.drawVersion();
153
- }
154
- drawFormatBits(mask) {
155
- const data = this.errorCorrectionLevel.formatBits << 3 | mask;
156
- let rem = data;
157
- for (let i = 0; i < 10; i++)
158
- rem = rem << 1 ^ (rem >>> 9) * 1335;
159
- const bits = (data << 10 | rem) ^ 21522;
160
- assert(bits >>> 15 == 0);
161
- for (let i = 0; i <= 5; i++)
162
- this.setFunctionModule(8, i, getBit(bits, i));
163
- this.setFunctionModule(8, 7, getBit(bits, 6));
164
- this.setFunctionModule(8, 8, getBit(bits, 7));
165
- this.setFunctionModule(7, 8, getBit(bits, 8));
166
- for (let i = 9; i < 15; i++)
167
- this.setFunctionModule(14 - i, 8, getBit(bits, i));
168
- for (let i = 0; i < 8; i++)
169
- this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
170
- for (let i = 8; i < 15; i++)
171
- this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
172
- this.setFunctionModule(8, this.size - 8, true);
173
- }
174
- drawVersion() {
175
- if (this.version < 7)
176
- return;
177
- let rem = this.version;
178
- for (let i = 0; i < 12; i++)
179
- rem = rem << 1 ^ (rem >>> 11) * 7973;
180
- const bits = this.version << 12 | rem;
181
- assert(bits >>> 18 == 0);
182
- for (let i = 0; i < 18; i++) {
183
- const color = getBit(bits, i);
184
- const a = this.size - 11 + i % 3;
185
- const b = Math.floor(i / 3);
186
- this.setFunctionModule(a, b, color);
187
- this.setFunctionModule(b, a, color);
188
- }
189
- }
190
- drawFinderPattern(x, y) {
191
- for (let dy = -4; dy <= 4; dy++) {
192
- for (let dx = -4; dx <= 4; dx++) {
193
- const dist = Math.max(Math.abs(dx), Math.abs(dy));
194
- const xx = x + dx;
195
- const yy = y + dy;
196
- if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
197
- this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
198
- }
199
- }
200
- }
201
- drawAlignmentPattern(x, y) {
202
- for (let dy = -2; dy <= 2; dy++) {
203
- for (let dx = -2; dx <= 2; dx++)
204
- this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
205
- }
206
- }
207
- setFunctionModule(x, y, isDark) {
208
- this.modules[y][x] = isDark;
209
- this.isFunction[y][x] = true;
210
- }
211
- addEccAndInterleave(data) {
212
- const ver = this.version;
213
- const ecl = this.errorCorrectionLevel;
214
- if (data.length != _QrCode.getNumDataCodewords(ver, ecl))
215
- throw new RangeError("Invalid argument");
216
- const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
217
- const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
218
- const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8);
219
- const numShortBlocks = numBlocks - rawCodewords % numBlocks;
220
- const shortBlockLen = Math.floor(rawCodewords / numBlocks);
221
- let blocks = [];
222
- const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen);
223
- for (let i = 0, k = 0; i < numBlocks; i++) {
224
- let dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
225
- k += dat.length;
226
- const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv);
227
- if (i < numShortBlocks)
228
- dat.push(0);
229
- blocks.push(dat.concat(ecc));
230
- }
231
- let result = [];
232
- for (let i = 0; i < blocks[0].length; i++) {
233
- blocks.forEach((block, j) => {
234
- if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)
235
- result.push(block[i]);
236
- });
237
- }
238
- assert(result.length == rawCodewords);
239
- return result;
240
- }
241
- drawCodewords(data) {
242
- if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8))
243
- throw new RangeError("Invalid argument");
244
- let i = 0;
245
- for (let right = this.size - 1; right >= 1; right -= 2) {
246
- if (right == 6)
247
- right = 5;
248
- for (let vert = 0; vert < this.size; vert++) {
249
- for (let j = 0; j < 2; j++) {
250
- const x = right - j;
251
- const upward = (right + 1 & 2) == 0;
252
- const y = upward ? this.size - 1 - vert : vert;
253
- if (!this.isFunction[y][x] && i < data.length * 8) {
254
- this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
255
- i++;
256
- }
257
- }
258
- }
259
- }
260
- assert(i == data.length * 8);
261
- }
262
- applyMask(mask) {
263
- if (mask < 0 || mask > 7)
264
- throw new RangeError("Mask value out of range");
265
- for (let y = 0; y < this.size; y++) {
266
- for (let x = 0; x < this.size; x++) {
267
- let invert;
268
- switch (mask) {
269
- case 0:
270
- invert = (x + y) % 2 == 0;
271
- break;
272
- case 1:
273
- invert = y % 2 == 0;
274
- break;
275
- case 2:
276
- invert = x % 3 == 0;
277
- break;
278
- case 3:
279
- invert = (x + y) % 3 == 0;
280
- break;
281
- case 4:
282
- invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
283
- break;
284
- case 5:
285
- invert = x * y % 2 + x * y % 3 == 0;
286
- break;
287
- case 6:
288
- invert = (x * y % 2 + x * y % 3) % 2 == 0;
289
- break;
290
- case 7:
291
- invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
292
- break;
293
- default:
294
- throw new Error("Unreachable");
295
- }
296
- if (!this.isFunction[y][x] && invert)
297
- this.modules[y][x] = !this.modules[y][x];
298
- }
299
- }
300
- }
301
- getPenaltyScore() {
302
- let result = 0;
303
- for (let y = 0; y < this.size; y++) {
304
- let runColor = false;
305
- let runX = 0;
306
- let runHistory = [0, 0, 0, 0, 0, 0, 0];
307
- for (let x = 0; x < this.size; x++) {
308
- if (this.modules[y][x] == runColor) {
309
- runX++;
310
- if (runX == 5)
311
- result += _QrCode.PENALTY_N1;
312
- else if (runX > 5)
313
- result++;
314
- } else {
315
- this.finderPenaltyAddHistory(runX, runHistory);
316
- if (!runColor)
317
- result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
318
- runColor = this.modules[y][x];
319
- runX = 1;
320
- }
321
- }
322
- result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3;
323
- }
324
- for (let x = 0; x < this.size; x++) {
325
- let runColor = false;
326
- let runY = 0;
327
- let runHistory = [0, 0, 0, 0, 0, 0, 0];
328
- for (let y = 0; y < this.size; y++) {
329
- if (this.modules[y][x] == runColor) {
330
- runY++;
331
- if (runY == 5)
332
- result += _QrCode.PENALTY_N1;
333
- else if (runY > 5)
334
- result++;
335
- } else {
336
- this.finderPenaltyAddHistory(runY, runHistory);
337
- if (!runColor)
338
- result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
339
- runColor = this.modules[y][x];
340
- runY = 1;
341
- }
342
- }
343
- result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3;
344
- }
345
- for (let y = 0; y < this.size - 1; y++) {
346
- for (let x = 0; x < this.size - 1; x++) {
347
- const color = this.modules[y][x];
348
- if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])
349
- result += _QrCode.PENALTY_N2;
350
- }
351
- }
352
- let dark = 0;
353
- for (const row of this.modules)
354
- dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
355
- const total = this.size * this.size;
356
- const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
357
- assert(0 <= k && k <= 9);
358
- result += k * _QrCode.PENALTY_N4;
359
- assert(0 <= result && result <= 2568888);
360
- return result;
361
- }
362
- getAlignmentPatternPositions() {
363
- if (this.version == 1)
364
- return [];
365
- else {
366
- const numAlign = Math.floor(this.version / 7) + 2;
367
- const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
368
- let result = [6];
369
- for (let pos = this.size - 7; result.length < numAlign; pos -= step)
370
- result.splice(1, 0, pos);
371
- return result;
372
- }
373
- }
374
- static getNumRawDataModules(ver) {
375
- if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION)
376
- throw new RangeError("Version number out of range");
377
- let result = (16 * ver + 128) * ver + 64;
378
- if (ver >= 2) {
379
- const numAlign = Math.floor(ver / 7) + 2;
380
- result -= (25 * numAlign - 10) * numAlign - 55;
381
- if (ver >= 7)
382
- result -= 36;
383
- }
384
- assert(208 <= result && result <= 29648);
385
- return result;
386
- }
387
- static getNumDataCodewords(ver, ecl) {
388
- return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
389
- }
390
- static reedSolomonComputeDivisor(degree) {
391
- if (degree < 1 || degree > 255)
392
- throw new RangeError("Degree out of range");
393
- let result = [];
394
- for (let i = 0; i < degree - 1; i++)
395
- result.push(0);
396
- result.push(1);
397
- let root = 1;
398
- for (let i = 0; i < degree; i++) {
399
- for (let j = 0; j < result.length; j++) {
400
- result[j] = _QrCode.reedSolomonMultiply(result[j], root);
401
- if (j + 1 < result.length)
402
- result[j] ^= result[j + 1];
403
- }
404
- root = _QrCode.reedSolomonMultiply(root, 2);
405
- }
406
- return result;
407
- }
408
- static reedSolomonComputeRemainder(data, divisor) {
409
- let result = divisor.map((_) => 0);
410
- for (const b of data) {
411
- const factor = b ^ result.shift();
412
- result.push(0);
413
- divisor.forEach((coef, i) => result[i] ^= _QrCode.reedSolomonMultiply(coef, factor));
414
- }
415
- return result;
416
- }
417
- static reedSolomonMultiply(x, y) {
418
- if (x >>> 8 != 0 || y >>> 8 != 0)
419
- throw new RangeError("Byte out of range");
420
- let z = 0;
421
- for (let i = 7; i >= 0; i--) {
422
- z = z << 1 ^ (z >>> 7) * 285;
423
- z ^= (y >>> i & 1) * x;
424
- }
425
- assert(z >>> 8 == 0);
426
- return z;
427
- }
428
- finderPenaltyCountPatterns(runHistory) {
429
- const n = runHistory[1];
430
- assert(n <= this.size * 3);
431
- const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
432
- return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
433
- }
434
- finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
435
- if (currentRunColor) {
436
- this.finderPenaltyAddHistory(currentRunLength, runHistory);
437
- currentRunLength = 0;
438
- }
439
- currentRunLength += this.size;
440
- this.finderPenaltyAddHistory(currentRunLength, runHistory);
441
- return this.finderPenaltyCountPatterns(runHistory);
442
- }
443
- finderPenaltyAddHistory(currentRunLength, runHistory) {
444
- if (runHistory[0] == 0)
445
- currentRunLength += this.size;
446
- runHistory.pop();
447
- runHistory.unshift(currentRunLength);
448
- }
449
- };
450
- let QrCode = _QrCode;
451
- QrCode.MIN_VERSION = 1;
452
- QrCode.MAX_VERSION = 40;
453
- QrCode.PENALTY_N1 = 3;
454
- QrCode.PENALTY_N2 = 3;
455
- QrCode.PENALTY_N3 = 40;
456
- QrCode.PENALTY_N4 = 10;
457
- QrCode.ECC_CODEWORDS_PER_BLOCK = [
458
- [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
459
- [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
460
- [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
461
- [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
462
- ];
463
- QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
464
- [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
465
- [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
466
- [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
467
- [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
468
- ];
469
- qrcodegen2.QrCode = QrCode;
470
- function appendBits(val, len, bb) {
471
- if (len < 0 || len > 31 || val >>> len != 0)
472
- throw new RangeError("Value out of range");
473
- for (let i = len - 1; i >= 0; i--)
474
- bb.push(val >>> i & 1);
475
- }
476
- function getBit(x, i) {
477
- return (x >>> i & 1) != 0;
478
- }
479
- function assert(cond) {
480
- if (!cond)
481
- throw new Error("Assertion error");
482
- }
483
- const _QrSegment = class {
484
- constructor(mode, numChars, bitData) {
485
- this.mode = mode;
486
- this.numChars = numChars;
487
- this.bitData = bitData;
488
- if (numChars < 0)
489
- throw new RangeError("Invalid argument");
490
- this.bitData = bitData.slice();
491
- }
492
- static makeBytes(data) {
493
- let bb = [];
494
- for (const b of data)
495
- appendBits(b, 8, bb);
496
- return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb);
497
- }
498
- static makeNumeric(digits) {
499
- if (!_QrSegment.isNumeric(digits))
500
- throw new RangeError("String contains non-numeric characters");
501
- let bb = [];
502
- for (let i = 0; i < digits.length; ) {
503
- const n = Math.min(digits.length - i, 3);
504
- appendBits(parseInt(digits.substr(i, n), 10), n * 3 + 1, bb);
505
- i += n;
506
- }
507
- return new _QrSegment(_QrSegment.Mode.NUMERIC, digits.length, bb);
508
- }
509
- static makeAlphanumeric(text) {
510
- if (!_QrSegment.isAlphanumeric(text))
511
- throw new RangeError("String contains unencodable characters in alphanumeric mode");
512
- let bb = [];
513
- let i;
514
- for (i = 0; i + 2 <= text.length; i += 2) {
515
- let temp = _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
516
- temp += _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
517
- appendBits(temp, 11, bb);
518
- }
519
- if (i < text.length)
520
- appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
521
- return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text.length, bb);
522
- }
523
- static makeSegments(text) {
524
- if (text == "")
525
- return [];
526
- else if (_QrSegment.isNumeric(text))
527
- return [_QrSegment.makeNumeric(text)];
528
- else if (_QrSegment.isAlphanumeric(text))
529
- return [_QrSegment.makeAlphanumeric(text)];
530
- else
531
- return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text))];
532
- }
533
- static makeEci(assignVal) {
534
- let bb = [];
535
- if (assignVal < 0)
536
- throw new RangeError("ECI assignment value out of range");
537
- else if (assignVal < 1 << 7)
538
- appendBits(assignVal, 8, bb);
539
- else if (assignVal < 1 << 14) {
540
- appendBits(2, 2, bb);
541
- appendBits(assignVal, 14, bb);
542
- } else if (assignVal < 1e6) {
543
- appendBits(6, 3, bb);
544
- appendBits(assignVal, 21, bb);
545
- } else
546
- throw new RangeError("ECI assignment value out of range");
547
- return new _QrSegment(_QrSegment.Mode.ECI, 0, bb);
548
- }
549
- static isNumeric(text) {
550
- return _QrSegment.NUMERIC_REGEX.test(text);
551
- }
552
- static isAlphanumeric(text) {
553
- return _QrSegment.ALPHANUMERIC_REGEX.test(text);
554
- }
555
- getData() {
556
- return this.bitData.slice();
557
- }
558
- static getTotalBits(segs, version) {
559
- let result = 0;
560
- for (const seg of segs) {
561
- const ccbits = seg.mode.numCharCountBits(version);
562
- if (seg.numChars >= 1 << ccbits)
563
- return Infinity;
564
- result += 4 + ccbits + seg.bitData.length;
565
- }
566
- return result;
567
- }
568
- static toUtf8ByteArray(str) {
569
- str = encodeURI(str);
570
- let result = [];
571
- for (let i = 0; i < str.length; i++) {
572
- if (str.charAt(i) != "%")
573
- result.push(str.charCodeAt(i));
574
- else {
575
- result.push(parseInt(str.substr(i + 1, 2), 16));
576
- i += 2;
577
- }
578
- }
579
- return result;
580
- }
581
- };
582
- let QrSegment = _QrSegment;
583
- QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
584
- QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
585
- QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
586
- qrcodegen2.QrSegment = QrSegment;
587
- })(qrcodegen || (qrcodegen = {}));
588
- ((qrcodegen2) => {
589
- ((QrCode2) => {
590
- const _Ecc = class {
591
- constructor(ordinal, formatBits) {
592
- this.ordinal = ordinal;
593
- this.formatBits = formatBits;
594
- }
595
- };
596
- let Ecc = _Ecc;
597
- Ecc.LOW = new _Ecc(0, 1);
598
- Ecc.MEDIUM = new _Ecc(1, 0);
599
- Ecc.QUARTILE = new _Ecc(2, 3);
600
- Ecc.HIGH = new _Ecc(3, 2);
601
- QrCode2.Ecc = Ecc;
602
- })(qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
603
- })(qrcodegen || (qrcodegen = {}));
604
- ((qrcodegen2) => {
605
- ((QrSegment2) => {
606
- const _Mode = class {
607
- constructor(modeBits, numBitsCharCount) {
608
- this.modeBits = modeBits;
609
- this.numBitsCharCount = numBitsCharCount;
610
- }
611
- numCharCountBits(ver) {
612
- return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
613
- }
614
- };
615
- let Mode = _Mode;
616
- Mode.NUMERIC = new _Mode(1, [10, 12, 14]);
617
- Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]);
618
- Mode.BYTE = new _Mode(4, [8, 16, 16]);
619
- Mode.KANJI = new _Mode(8, [8, 10, 12]);
620
- Mode.ECI = new _Mode(7, [0, 0, 0]);
621
- QrSegment2.Mode = Mode;
622
- })(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
623
- })(qrcodegen || (qrcodegen = {}));
624
- var qrcodegen_default = qrcodegen;
625
-
626
- // src/index.tsx
627
- /**
628
- * @license qrcode.react
629
- * Copyright (c) Paul O'Shannessy
630
- * SPDX-License-Identifier: ISC
631
- */
632
- var ERROR_LEVEL_MAP = {
633
- L: qrcodegen_default.QrCode.Ecc.LOW,
634
- M: qrcodegen_default.QrCode.Ecc.MEDIUM,
635
- Q: qrcodegen_default.QrCode.Ecc.QUARTILE,
636
- H: qrcodegen_default.QrCode.Ecc.HIGH
637
- };
638
- var DEFAULT_SIZE = 128;
639
- var DEFAULT_LEVEL = "L";
640
- var DEFAULT_BGCOLOR = "#FFFFFF";
641
- var DEFAULT_FGCOLOR = "#000000";
642
- var DEFAULT_INCLUDEMARGIN = false;
643
- var MARGIN_SIZE = 4;
644
- var DEFAULT_IMG_SCALE = 0.1;
645
- function generatePath(modules, margin = 0) {
646
- const ops = [];
647
- modules.forEach(function(row, y) {
648
- let start = null;
649
- row.forEach(function(cell, x) {
650
- if (!cell && start !== null) {
651
- ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`);
652
- start = null;
653
- return;
654
- }
655
- if (x === row.length - 1) {
656
- if (!cell) {
657
- return;
658
- }
659
- if (start === null) {
660
- ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
661
- } else {
662
- ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
663
- }
664
- return;
665
- }
666
- if (cell && start === null) {
667
- start = x;
668
- }
669
- });
670
- });
671
- return ops.join("");
672
- }
673
- function excavateModules(modules, excavation) {
674
- return modules.slice().map((row, y) => {
675
- if (y < excavation.y || y >= excavation.y + excavation.h) {
676
- return row;
677
- }
678
- return row.map((cell, x) => {
679
- if (x < excavation.x || x >= excavation.x + excavation.w) {
680
- return cell;
681
- }
682
- return false;
683
- });
684
- });
685
- }
686
- function getImageSettings(cells, size, includeMargin, imageSettings) {
687
- if (imageSettings == null) {
688
- return null;
689
- }
690
- const margin = includeMargin ? MARGIN_SIZE : 0;
691
- const numCells = cells.length + margin * 2;
692
- const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
693
- const scale = numCells / size;
694
- const w = (imageSettings.width || defaultSize) * scale;
695
- const h = (imageSettings.height || defaultSize) * scale;
696
- const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
697
- const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
698
- let excavation = null;
699
- if (imageSettings.excavate) {
700
- let floorX = Math.floor(x);
701
- let floorY = Math.floor(y);
702
- let ceilW = Math.ceil(w + x - floorX);
703
- let ceilH = Math.ceil(h + y - floorY);
704
- excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
705
- }
706
- return { x, y, h, w, excavation };
707
- }
708
- (function() {
709
- try {
710
- new Path2D().addPath(new Path2D());
711
- } catch (e) {
712
- return false;
713
- }
714
- return true;
715
- })();
716
- function QRCodeSVG(props) {
717
- const _a = props, {
718
- value,
719
- size = DEFAULT_SIZE,
720
- level = DEFAULT_LEVEL,
721
- bgColor = DEFAULT_BGCOLOR,
722
- fgColor = DEFAULT_FGCOLOR,
723
- includeMargin = DEFAULT_INCLUDEMARGIN,
724
- imageSettings
725
- } = _a, otherProps = __objRest(_a, [
726
- "value",
727
- "size",
728
- "level",
729
- "bgColor",
730
- "fgColor",
731
- "includeMargin",
732
- "imageSettings"
733
- ]);
734
- let cells = qrcodegen_default.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
735
- const margin = includeMargin ? MARGIN_SIZE : 0;
736
- const numCells = cells.length + margin * 2;
737
- const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
738
- let image = null;
739
- if (imageSettings != null && calculatedImageSettings != null) {
740
- if (calculatedImageSettings.excavation != null) {
741
- cells = excavateModules(cells, calculatedImageSettings.excavation);
742
- }
743
- image = /* @__PURE__ */ React__default.createElement("image", {
744
- xlinkHref: imageSettings.src,
745
- height: calculatedImageSettings.h,
746
- width: calculatedImageSettings.w,
747
- x: calculatedImageSettings.x + margin,
748
- y: calculatedImageSettings.y + margin,
749
- preserveAspectRatio: "none"
750
- });
751
- }
752
- const fgPath = generatePath(cells, margin);
753
- return /* @__PURE__ */ React__default.createElement("svg", __spreadValues({
754
- height: size,
755
- width: size,
756
- viewBox: `0 0 ${numCells} ${numCells}`
757
- }, otherProps), /* @__PURE__ */ React__default.createElement("path", {
758
- fill: bgColor,
759
- d: `M0,0 h${numCells}v${numCells}H0z`,
760
- shapeRendering: "crispEdges"
761
- }), /* @__PURE__ */ React__default.createElement("path", {
762
- fill: fgColor,
763
- d: fgPath,
764
- shapeRendering: "crispEdges"
765
- }), image);
766
- }
767
-
768
- const QRConfig = {
769
- levels: {
770
- L: 'L',
771
- M: 'M',
772
- Q: 'Q',
773
- H: 'H'
774
- }
775
- };
776
- function QRCode(_ref) {
777
- let {
778
- value,
779
- level,
780
- maxSize
781
- } = _ref;
782
- return /*#__PURE__*/React__default.createElement(QRCodeSVG, {
783
- value: value,
784
- size: maxSize,
785
- bgColor: "rgba(255,255,255,0)",
786
- fgColor: "rgba(var(--background-sc-rgb), 1)",
787
- level: level,
788
- includeMargin: false
789
- });
790
- }
791
- QRCode.propTypes = {
792
- /**
793
- * If you'd like to apply styles to the single container div that your popover content is rendered within via stylesheets
794
- */
795
- value: PropTypes.string.isRequired,
796
- /**
797
- * Specifies the maximum size of QRCode component in pixels.
798
- * The component behaves adaptively and listens to the parent wrapper.
799
- */
800
- maxSize: PropTypes.number,
801
- /**
802
- * Level L (Low) 7% of data bytes can be restored.
803
- * Level M (Medium) 15% of data bytes can be restored.
804
- * Level Q (Quartile)[76] 25% of data bytes can be restored.
805
- * Level H (High) 30% of data bytes can be restored.
806
- */
807
- level: PropTypes.oneOf(Object.keys(QRConfig.levels))
808
- };
809
- QRCode.defaultProps = {
810
- maxSize: 400,
811
- level: QRConfig.levels.M
812
- };
813
-
814
- export { QRCode as default };