panelui-native 0.56.0 → 0.59.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 +21 -10
- package/lib/module/components/funnel-chart/index.js +828 -0
- package/lib/module/components/funnel-chart/index.js.map +1 -0
- package/lib/module/components/progress/index.js +67 -13
- package/lib/module/components/progress/index.js.map +1 -1
- package/lib/module/components/qr-code/index.js +641 -0
- package/lib/module/components/qr-code/index.js.map +1 -0
- package/lib/module/components/qr-code/qr-encode.js +475 -0
- package/lib/module/components/qr-code/qr-encode.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/chart.js +36 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/typescript/src/components/funnel-chart/index.d.ts +289 -0
- package/lib/typescript/src/components/funnel-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/progress/index.d.ts +9 -1
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
- package/lib/typescript/src/components/qr-code/index.d.ts +221 -0
- package/lib/typescript/src/components/qr-code/index.d.ts.map +1 -0
- package/lib/typescript/src/components/qr-code/qr-encode.d.ts +39 -0
- package/lib/typescript/src/components/qr-code/qr-encode.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +19 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/funnel-chart/index.tsx +1121 -0
- package/src/components/progress/index.tsx +64 -11
- package/src/components/qr-code/index.tsx +663 -0
- package/src/components/qr-code/qr-encode.ts +548 -0
- package/src/index.ts +35 -0
- package/src/utils/chart.ts +52 -0
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* QRCode — a string, drawn as something a camera can read.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <QRCode value="https://panelui.dev">
|
|
8
|
+
* <QRCode.Frame>
|
|
9
|
+
* <QRCode.Canvas />
|
|
10
|
+
* </QRCode.Frame>
|
|
11
|
+
* <QRCode.Caption>Scan to open the docs</QRCode.Caption>
|
|
12
|
+
* </QRCode>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Composition is the API, as everywhere else here: a code in a titled panel is
|
|
16
|
+
* one with a `QRCode.Header` in it, and a code behind a button is one wrapped
|
|
17
|
+
* in a `QRCode.Trigger` and a `QRCode.Content` — not one with a prop turned on.
|
|
18
|
+
*
|
|
19
|
+
* ## What it draws
|
|
20
|
+
*
|
|
21
|
+
* Every dark module is one subpath of a single `<Path>`, not a `<Rect>` of its
|
|
22
|
+
* own. A version 10 code is 3,481 modules; half of them dark is seventeen
|
|
23
|
+
* hundred native views for a picture that never changes, and the difference
|
|
24
|
+
* between that and one node is the difference between a code that appears and
|
|
25
|
+
* one that appears eventually.
|
|
26
|
+
*
|
|
27
|
+
* The colours come from the theme, so a code drawn on a card is legible on
|
|
28
|
+
* every one of them — and light-on-dark is drawn the way scanners expect it,
|
|
29
|
+
* with the quiet zone painted rather than left transparent. A code with
|
|
30
|
+
* nothing behind it reads at about half the distance.
|
|
31
|
+
*
|
|
32
|
+
* ## The hole in the middle
|
|
33
|
+
*
|
|
34
|
+
* `QRCode.Logo` clears a square of modules and puts its children there.
|
|
35
|
+
* Error correction is what makes that survivable — the modules are gone, and
|
|
36
|
+
* the code still reads because there is enough redundancy to reconstruct them.
|
|
37
|
+
* How much is `errorCorrection`, and a logo raises the level it needs: the
|
|
38
|
+
* default `M` tolerates about 15% loss, `H` about 30%. A logo is measured
|
|
39
|
+
* against that budget and the level is raised for you if it has to be.
|
|
40
|
+
*/
|
|
41
|
+
import { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
42
|
+
import { View } from 'react-native';
|
|
43
|
+
import Svg, { Path, Rect } from 'react-native-svg';
|
|
44
|
+
import { tv } from 'tailwind-variants';
|
|
45
|
+
import { Text } from "../../primitives/text.js";
|
|
46
|
+
import { cn } from "../../utils/cn.js";
|
|
47
|
+
import { Popover } from "../popover/index.js";
|
|
48
|
+
import { encodeQr } from "./qr-encode.js";
|
|
49
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
50
|
+
const qrCodeVariants = tv({
|
|
51
|
+
slots: {
|
|
52
|
+
root: 'items-center gap-3',
|
|
53
|
+
// The widget shell every chart in the library is shown in: a titled tray
|
|
54
|
+
// with the card flush inside it. A code is the same kind of thing — one
|
|
55
|
+
// object with a label over it — so it is the same shape.
|
|
56
|
+
frame: 'w-full overflow-hidden rounded-3xl border border-border bg-surface',
|
|
57
|
+
header: 'w-full flex-row items-center justify-between gap-3 px-4 pb-3 pt-2.5',
|
|
58
|
+
// Flush left, right and bottom: the shell's own edge is already there.
|
|
59
|
+
panel: 'relative items-center justify-center overflow-hidden rounded-t-2xl border-t border-border bg-card p-4',
|
|
60
|
+
caption: 'text-center text-sm text-muted-foreground',
|
|
61
|
+
value: 'text-center text-xs text-muted-foreground'
|
|
62
|
+
},
|
|
63
|
+
variants: {
|
|
64
|
+
size: {
|
|
65
|
+
sm: {},
|
|
66
|
+
md: {},
|
|
67
|
+
lg: {}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
size: 'md'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
/** How big the drawn code is. */
|
|
76
|
+
|
|
77
|
+
/** Side length in points per size. The module grid divides into it. */
|
|
78
|
+
const CANVAS_SIZE = {
|
|
79
|
+
sm: 128,
|
|
80
|
+
md: 180,
|
|
81
|
+
lg: 240
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The quiet zone, in modules. Four is what the specification asks for and what
|
|
86
|
+
* scanners are tuned to; less and a code against a busy background stops being
|
|
87
|
+
* found at all.
|
|
88
|
+
*/
|
|
89
|
+
const QUIET_ZONE = 4;
|
|
90
|
+
|
|
91
|
+
/** Roughly how much of the code each level can lose and still be read. */
|
|
92
|
+
const TOLERANCE = {
|
|
93
|
+
L: 0.07,
|
|
94
|
+
M: 0.15,
|
|
95
|
+
Q: 0.25,
|
|
96
|
+
H: 0.3
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** Ascending, so "the next level up" is a step through this. */
|
|
100
|
+
const LEVELS = ['L', 'M', 'Q', 'H'];
|
|
101
|
+
|
|
102
|
+
/** How much of the code a logo of this fraction covers. */
|
|
103
|
+
function coverage(logoFraction) {
|
|
104
|
+
return logoFraction * logoFraction;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The cleared square, in module coordinates.
|
|
109
|
+
*
|
|
110
|
+
* Both the canvas and the logo compute it from this, so the hole and the thing
|
|
111
|
+
* filling it are the same square. Two nearly-equal calculations is how you get
|
|
112
|
+
* a dark ring around a logo, which is the failure the screenshot showed.
|
|
113
|
+
*/
|
|
114
|
+
function holeBounds(matrixSize, logoFraction) {
|
|
115
|
+
const from = Math.floor(matrixSize * (1 - logoFraction) / 2);
|
|
116
|
+
const to = Math.ceil(matrixSize * (1 + logoFraction) / 2);
|
|
117
|
+
return {
|
|
118
|
+
from,
|
|
119
|
+
to
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The level actually used: the one asked for, unless a logo would eat more of
|
|
125
|
+
* the code than it can afford, in which case the next one that can.
|
|
126
|
+
*/
|
|
127
|
+
function levelFor(requested, logoFraction) {
|
|
128
|
+
const needed = coverage(logoFraction);
|
|
129
|
+
// Half the budget, not all of it: the rest is for the things a code in the
|
|
130
|
+
// world actually loses — glare, a fold, a thumb.
|
|
131
|
+
const affordable = level => TOLERANCE[level] / 2 >= needed;
|
|
132
|
+
if (affordable(requested)) return requested;
|
|
133
|
+
return LEVELS.slice(LEVELS.indexOf(requested)).find(affordable) ?? 'H';
|
|
134
|
+
}
|
|
135
|
+
const QRCodeContext = /*#__PURE__*/createContext(null);
|
|
136
|
+
function useQRCode(part) {
|
|
137
|
+
const context = useContext(QRCodeContext);
|
|
138
|
+
if (!context) throw new Error(`${part} must be used inside <QRCode>.`);
|
|
139
|
+
return context;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Where the code is drawn: in place, in a popover, or up from the bottom. */
|
|
143
|
+
|
|
144
|
+
const QRCodeRoot = /*#__PURE__*/forwardRef(({
|
|
145
|
+
className,
|
|
146
|
+
value,
|
|
147
|
+
errorCorrection = 'M',
|
|
148
|
+
version,
|
|
149
|
+
size = 'md',
|
|
150
|
+
presentation = 'inline',
|
|
151
|
+
open,
|
|
152
|
+
onOpenChange,
|
|
153
|
+
children,
|
|
154
|
+
...props
|
|
155
|
+
}, ref) => {
|
|
156
|
+
const slots = qrCodeVariants({
|
|
157
|
+
size
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* A logo is a child, and the matrix has to know about it before the child
|
|
162
|
+
* renders — the level it forces changes the matrix itself. Rather than
|
|
163
|
+
* inspecting children, the fraction is a constant the Logo part also uses,
|
|
164
|
+
* and the root asks whether one is present at all.
|
|
165
|
+
*/
|
|
166
|
+
const logoFraction = hasLogo(children) ? LOGO_FRACTION : 0;
|
|
167
|
+
const level = levelFor(errorCorrection, logoFraction);
|
|
168
|
+
const {
|
|
169
|
+
matrix,
|
|
170
|
+
error
|
|
171
|
+
} = useMemo(() => {
|
|
172
|
+
try {
|
|
173
|
+
return {
|
|
174
|
+
matrix: encodeQr(value, {
|
|
175
|
+
errorCorrection: level,
|
|
176
|
+
version
|
|
177
|
+
}),
|
|
178
|
+
error: null
|
|
179
|
+
};
|
|
180
|
+
} catch (cause) {
|
|
181
|
+
// Too much data, or a version too small for it. A throw here would
|
|
182
|
+
// take a screen down over a string, so it draws nothing and says why.
|
|
183
|
+
return {
|
|
184
|
+
matrix: null,
|
|
185
|
+
error: cause.message
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}, [value, level, version]);
|
|
189
|
+
const context = {
|
|
190
|
+
matrix,
|
|
191
|
+
error,
|
|
192
|
+
value,
|
|
193
|
+
size,
|
|
194
|
+
logoFraction,
|
|
195
|
+
slots
|
|
196
|
+
};
|
|
197
|
+
if (presentation !== 'inline') {
|
|
198
|
+
// The provider stays outside the Popover, and Content re-provides it
|
|
199
|
+
// inside — portal content mounts under the portal host, which is not in
|
|
200
|
+
// this subtree.
|
|
201
|
+
return /*#__PURE__*/_jsx(QRCodeContext.Provider, {
|
|
202
|
+
value: context,
|
|
203
|
+
children: /*#__PURE__*/_jsx(Popover, {
|
|
204
|
+
open: open,
|
|
205
|
+
onOpenChange: onOpenChange,
|
|
206
|
+
presentation: presentation,
|
|
207
|
+
children: children
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return /*#__PURE__*/_jsx(QRCodeContext.Provider, {
|
|
212
|
+
value: context,
|
|
213
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
214
|
+
ref: ref,
|
|
215
|
+
className: slots.root({
|
|
216
|
+
className
|
|
217
|
+
}),
|
|
218
|
+
...props,
|
|
219
|
+
children: children
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
QRCodeRoot.displayName = 'QRCode';
|
|
224
|
+
|
|
225
|
+
/* ------------------------------------------------------------------ *
|
|
226
|
+
* The code itself.
|
|
227
|
+
* ------------------------------------------------------------------ */
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Dark modules on a light plate, whatever the theme is doing.
|
|
231
|
+
*
|
|
232
|
+
* This is the one place in the library that does not follow the tokens, and it
|
|
233
|
+
* is deliberate. A QR code is not a surface — it is a thing a camera has to
|
|
234
|
+
* read, and readers expect dark on light. Inverted, a code is rejected outright
|
|
235
|
+
* by a good share of scanners and found late by most of the rest, which turns a
|
|
236
|
+
* dark theme into a bug report about a code that "sometimes does not work".
|
|
237
|
+
*
|
|
238
|
+
* On a light theme the plate is white on a near-white card, which looks like
|
|
239
|
+
* nothing at all — correct, and the intended outcome. On a dark theme it reads
|
|
240
|
+
* as a light plate holding a code, which is the shape everyone recognises.
|
|
241
|
+
*
|
|
242
|
+
* `color` and `backgroundColor` override both, for a code that is definitely
|
|
243
|
+
* being read by something you control.
|
|
244
|
+
*/
|
|
245
|
+
const PLATE = '#ffffff';
|
|
246
|
+
const MODULE = '#111111';
|
|
247
|
+
const QRCodeCanvas = /*#__PURE__*/forwardRef(({
|
|
248
|
+
className,
|
|
249
|
+
pixelSize,
|
|
250
|
+
color,
|
|
251
|
+
backgroundColor,
|
|
252
|
+
...props
|
|
253
|
+
}, ref) => {
|
|
254
|
+
const {
|
|
255
|
+
matrix,
|
|
256
|
+
error,
|
|
257
|
+
value,
|
|
258
|
+
size,
|
|
259
|
+
logoFraction
|
|
260
|
+
} = useQRCode('QRCode.Canvas');
|
|
261
|
+
const side = pixelSize ?? CANVAS_SIZE[size];
|
|
262
|
+
const dark = color ?? MODULE;
|
|
263
|
+
const light = backgroundColor ?? PLATE;
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
* One path for every dark module.
|
|
267
|
+
*
|
|
268
|
+
* The viewBox is in module units, so the path is written once and scales
|
|
269
|
+
* to whatever `side` is — no arithmetic per module, and no rounding gaps
|
|
270
|
+
* between neighbours at fractional sizes.
|
|
271
|
+
*/
|
|
272
|
+
const path = useMemo(() => {
|
|
273
|
+
if (!matrix) return '';
|
|
274
|
+
const hole = logoFraction ? holeBounds(matrix.size, logoFraction) : null;
|
|
275
|
+
let d = '';
|
|
276
|
+
for (let y = 0; y < matrix.size; y++) {
|
|
277
|
+
for (let x = 0; x < matrix.size; x++) {
|
|
278
|
+
if (!matrix.modules[y][x]) continue;
|
|
279
|
+
// Modules under the logo are not drawn at all — drawing them and
|
|
280
|
+
// covering them leaves a dark edge wherever the logo is smaller
|
|
281
|
+
// than the square it cleared.
|
|
282
|
+
if (hole && x >= hole.from && x < hole.to && y >= hole.from && y < hole.to) continue;
|
|
283
|
+
d += `M${x + QUIET_ZONE} ${y + QUIET_ZONE}h1v1h-1z`;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return d;
|
|
287
|
+
}, [matrix, logoFraction]);
|
|
288
|
+
if (error) {
|
|
289
|
+
// A box the size the code would have been, so the layout does not jump
|
|
290
|
+
// when the value becomes something that fits.
|
|
291
|
+
return /*#__PURE__*/_jsx(View, {
|
|
292
|
+
ref: ref,
|
|
293
|
+
accessibilityRole: "image",
|
|
294
|
+
accessibilityLabel: "QR code could not be generated",
|
|
295
|
+
className: cn('items-center justify-center rounded-lg bg-muted', className),
|
|
296
|
+
style: {
|
|
297
|
+
width: side,
|
|
298
|
+
height: side
|
|
299
|
+
},
|
|
300
|
+
...props
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
if (!matrix) return null;
|
|
304
|
+
const grid = matrix.size + QUIET_ZONE * 2;
|
|
305
|
+
return /*#__PURE__*/_jsx(View, {
|
|
306
|
+
ref: ref,
|
|
307
|
+
accessibilityRole: "image",
|
|
308
|
+
accessibilityLabel: `QR code for ${value}`,
|
|
309
|
+
className: className,
|
|
310
|
+
style: {
|
|
311
|
+
width: side,
|
|
312
|
+
height: side
|
|
313
|
+
},
|
|
314
|
+
...props,
|
|
315
|
+
children: /*#__PURE__*/_jsxs(Svg, {
|
|
316
|
+
width: "100%",
|
|
317
|
+
height: "100%",
|
|
318
|
+
viewBox: `0 0 ${grid} ${grid}`,
|
|
319
|
+
children: [/*#__PURE__*/_jsx(Rect, {
|
|
320
|
+
x: 0,
|
|
321
|
+
y: 0,
|
|
322
|
+
width: grid,
|
|
323
|
+
height: grid,
|
|
324
|
+
rx: 2.5,
|
|
325
|
+
fill: light
|
|
326
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
327
|
+
d: path,
|
|
328
|
+
fill: dark
|
|
329
|
+
})]
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
QRCodeCanvas.displayName = 'QRCode.Canvas';
|
|
334
|
+
|
|
335
|
+
/* ------------------------------------------------------------------ *
|
|
336
|
+
* The shells around it.
|
|
337
|
+
* ------------------------------------------------------------------ */
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The tray the code sits in — the same widget shell the charts use: a titled
|
|
341
|
+
* strip, and a card flush inside it holding the thing itself.
|
|
342
|
+
*/
|
|
343
|
+
const QRCodeFrame = /*#__PURE__*/forwardRef(({
|
|
344
|
+
className,
|
|
345
|
+
children,
|
|
346
|
+
...props
|
|
347
|
+
}, ref) => {
|
|
348
|
+
const {
|
|
349
|
+
slots
|
|
350
|
+
} = useQRCode('QRCode.Frame');
|
|
351
|
+
return /*#__PURE__*/_jsx(View, {
|
|
352
|
+
ref: ref,
|
|
353
|
+
className: slots.frame({
|
|
354
|
+
className
|
|
355
|
+
}),
|
|
356
|
+
...props,
|
|
357
|
+
children: children
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
QRCodeFrame.displayName = 'QRCode.Frame';
|
|
361
|
+
/**
|
|
362
|
+
* The strip across the top of the tray. `QRCode.Title` takes the flexible
|
|
363
|
+
* side and `QRCode.Action` the end, so a long title truncates rather than
|
|
364
|
+
* shoving the trailing slot off the edge.
|
|
365
|
+
*/
|
|
366
|
+
const QRCodeHeader = /*#__PURE__*/forwardRef(({
|
|
367
|
+
className,
|
|
368
|
+
children,
|
|
369
|
+
...props
|
|
370
|
+
}, ref) => {
|
|
371
|
+
const {
|
|
372
|
+
slots
|
|
373
|
+
} = useQRCode('QRCode.Header');
|
|
374
|
+
return /*#__PURE__*/_jsx(View, {
|
|
375
|
+
ref: ref,
|
|
376
|
+
className: slots.header({
|
|
377
|
+
className
|
|
378
|
+
}),
|
|
379
|
+
...props,
|
|
380
|
+
children: children
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
QRCodeHeader.displayName = 'QRCode.Header';
|
|
384
|
+
/** What the code is for. Muted — it is a caption on the tray, not a heading. */
|
|
385
|
+
function QRCodeTitle({
|
|
386
|
+
className,
|
|
387
|
+
children
|
|
388
|
+
}) {
|
|
389
|
+
useQRCode('QRCode.Title');
|
|
390
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
391
|
+
size: "sm",
|
|
392
|
+
muted: true,
|
|
393
|
+
numberOfLines: 1,
|
|
394
|
+
className: cn('min-w-0 shrink', className),
|
|
395
|
+
children: children
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
QRCodeTitle.displayName = 'QRCode.Title';
|
|
399
|
+
/**
|
|
400
|
+
* The trailing slot on the header row — an expiry, a count, a button. A plain
|
|
401
|
+
* string draws as muted text; anything else draws as itself.
|
|
402
|
+
*/
|
|
403
|
+
const QRCodeAction = /*#__PURE__*/forwardRef(({
|
|
404
|
+
className,
|
|
405
|
+
children,
|
|
406
|
+
...props
|
|
407
|
+
}, ref) => {
|
|
408
|
+
useQRCode('QRCode.Action');
|
|
409
|
+
return /*#__PURE__*/_jsx(View, {
|
|
410
|
+
ref: ref,
|
|
411
|
+
className: cn('shrink-0 flex-row items-center gap-2', className),
|
|
412
|
+
...props,
|
|
413
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
414
|
+
size: "sm",
|
|
415
|
+
muted: true,
|
|
416
|
+
children: children
|
|
417
|
+
}) : children
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
QRCodeAction.displayName = 'QRCode.Action';
|
|
421
|
+
/**
|
|
422
|
+
* The card the code is drawn on, flush inside the tray. It is also what the
|
|
423
|
+
* logo positions itself against, so a `QRCode.Logo` belongs in here beside the
|
|
424
|
+
* canvas rather than anywhere else.
|
|
425
|
+
*/
|
|
426
|
+
const QRCodePanel = /*#__PURE__*/forwardRef(({
|
|
427
|
+
className,
|
|
428
|
+
children,
|
|
429
|
+
...props
|
|
430
|
+
}, ref) => {
|
|
431
|
+
const {
|
|
432
|
+
slots
|
|
433
|
+
} = useQRCode('QRCode.Panel');
|
|
434
|
+
return /*#__PURE__*/_jsx(View, {
|
|
435
|
+
ref: ref,
|
|
436
|
+
className: slots.panel({
|
|
437
|
+
className
|
|
438
|
+
}),
|
|
439
|
+
...props,
|
|
440
|
+
children: children
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
QRCodePanel.displayName = 'QRCode.Panel';
|
|
444
|
+
|
|
445
|
+
/* ------------------------------------------------------------------ *
|
|
446
|
+
* The readouts.
|
|
447
|
+
* ------------------------------------------------------------------ */
|
|
448
|
+
|
|
449
|
+
/** A muted line inside the panel, under the code. */
|
|
450
|
+
function QRCodeDescription({
|
|
451
|
+
className,
|
|
452
|
+
children
|
|
453
|
+
}) {
|
|
454
|
+
useQRCode('QRCode.Description');
|
|
455
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
456
|
+
size: "sm",
|
|
457
|
+
muted: true,
|
|
458
|
+
className: cn('text-center', className),
|
|
459
|
+
children: children
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
QRCodeDescription.displayName = 'QRCode.Description';
|
|
463
|
+
/** A line under the code saying what scanning it does. */
|
|
464
|
+
function QRCodeCaption({
|
|
465
|
+
className,
|
|
466
|
+
children
|
|
467
|
+
}) {
|
|
468
|
+
const {
|
|
469
|
+
slots
|
|
470
|
+
} = useQRCode('QRCode.Caption');
|
|
471
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
472
|
+
className: slots.caption({
|
|
473
|
+
className
|
|
474
|
+
}),
|
|
475
|
+
children: children
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
QRCodeCaption.displayName = 'QRCode.Caption';
|
|
479
|
+
/**
|
|
480
|
+
* The encoded string itself, for someone who cannot scan it — typing a URL out
|
|
481
|
+
* is slower than pointing a camera at it and it is the only way through when
|
|
482
|
+
* the camera is the thing you are setting up.
|
|
483
|
+
*/
|
|
484
|
+
function QRCodeValue({
|
|
485
|
+
className,
|
|
486
|
+
full
|
|
487
|
+
}) {
|
|
488
|
+
const {
|
|
489
|
+
value,
|
|
490
|
+
slots
|
|
491
|
+
} = useQRCode('QRCode.Value');
|
|
492
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
493
|
+
className: slots.value({
|
|
494
|
+
className
|
|
495
|
+
}),
|
|
496
|
+
numberOfLines: full ? undefined : 1,
|
|
497
|
+
selectable: true,
|
|
498
|
+
children: value
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
QRCodeValue.displayName = 'QRCode.Value';
|
|
502
|
+
|
|
503
|
+
/* ------------------------------------------------------------------ *
|
|
504
|
+
* The logo.
|
|
505
|
+
* ------------------------------------------------------------------ */
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* How much of the code's width the logo hole takes.
|
|
509
|
+
*
|
|
510
|
+
* Constant rather than a prop, because the value has to be known before the
|
|
511
|
+
* matrix is built — it decides the error-correction level — and a prop on a
|
|
512
|
+
* child cannot be read from the parent without inspecting the tree. A quarter
|
|
513
|
+
* costs about 6% of the modules, which every level above `L` can afford.
|
|
514
|
+
*/
|
|
515
|
+
const LOGO_FRACTION = 0.25;
|
|
516
|
+
/** Whether the tree contains a `QRCode.Logo`, without walking it deeply. */
|
|
517
|
+
function hasLogo(children) {
|
|
518
|
+
let found = false;
|
|
519
|
+
const walk = node => {
|
|
520
|
+
if (found || !node) return;
|
|
521
|
+
if (Array.isArray(node)) {
|
|
522
|
+
node.forEach(walk);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const element = node;
|
|
526
|
+
if (typeof element !== 'object' || !('type' in element)) return;
|
|
527
|
+
if (element.type === QRCodeLogo) {
|
|
528
|
+
found = true;
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
walk(element.props?.children);
|
|
532
|
+
};
|
|
533
|
+
walk(children);
|
|
534
|
+
return found;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Content for the cleared square in the middle — a mark, an avatar, an icon.
|
|
539
|
+
* Its presence is what clears the square, and what raises the error-correction
|
|
540
|
+
* level if the one asked for could not afford it.
|
|
541
|
+
*/
|
|
542
|
+
const QRCodeLogo = /*#__PURE__*/forwardRef(({
|
|
543
|
+
className,
|
|
544
|
+
children,
|
|
545
|
+
...props
|
|
546
|
+
}, ref) => {
|
|
547
|
+
const {
|
|
548
|
+
size,
|
|
549
|
+
matrix
|
|
550
|
+
} = useQRCode('QRCode.Logo');
|
|
551
|
+
if (!matrix) return null;
|
|
552
|
+
|
|
553
|
+
/*
|
|
554
|
+
* Sized from the same square the canvas cleared, in the same units.
|
|
555
|
+
*
|
|
556
|
+
* Taking a flat 25% of the canvas instead is close, but not equal — the
|
|
557
|
+
* hole is a whole number of modules and the canvas is not necessarily
|
|
558
|
+
* divisible by them, so the two disagreed by a module or so and the
|
|
559
|
+
* difference showed as a dark ring around the logo.
|
|
560
|
+
*/
|
|
561
|
+
const {
|
|
562
|
+
from,
|
|
563
|
+
to
|
|
564
|
+
} = holeBounds(matrix.size, LOGO_FRACTION);
|
|
565
|
+
const grid = matrix.size + QUIET_ZONE * 2;
|
|
566
|
+
const box = (to - from) / grid * CANVAS_SIZE[size];
|
|
567
|
+
return (
|
|
568
|
+
/*#__PURE__*/
|
|
569
|
+
// `inset-0` and centred, not `absolute` with nothing else: an absolute
|
|
570
|
+
// box with no offsets takes its parent's alignment, which put the logo
|
|
571
|
+
// at the top of the panel rather than over the middle of the code.
|
|
572
|
+
_jsx(View, {
|
|
573
|
+
pointerEvents: "none",
|
|
574
|
+
className: "absolute bottom-0 left-0 right-0 top-0 items-center justify-center",
|
|
575
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
576
|
+
ref: ref
|
|
577
|
+
// The plate colour, so the square reads as part of the code rather
|
|
578
|
+
// than as a hole cut in it — and rounded, matching the plate.
|
|
579
|
+
,
|
|
580
|
+
className: cn('items-center justify-center overflow-hidden rounded-md', className),
|
|
581
|
+
style: {
|
|
582
|
+
width: box,
|
|
583
|
+
height: box,
|
|
584
|
+
backgroundColor: PLATE
|
|
585
|
+
},
|
|
586
|
+
...props,
|
|
587
|
+
children: children
|
|
588
|
+
})
|
|
589
|
+
})
|
|
590
|
+
);
|
|
591
|
+
});
|
|
592
|
+
QRCodeLogo.displayName = 'QRCode.Logo';
|
|
593
|
+
|
|
594
|
+
/* ------------------------------------------------------------------ *
|
|
595
|
+
* Folded away.
|
|
596
|
+
* ------------------------------------------------------------------ */
|
|
597
|
+
|
|
598
|
+
/** What opens a `popover` or `bottom-sheet` code. */
|
|
599
|
+
function QRCodeTrigger({
|
|
600
|
+
children
|
|
601
|
+
}) {
|
|
602
|
+
useQRCode('QRCode.Trigger');
|
|
603
|
+
return /*#__PURE__*/_jsx(Popover.Trigger, {
|
|
604
|
+
children: children
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
QRCodeTrigger.displayName = 'QRCode.Trigger';
|
|
608
|
+
/** The panel the code is drawn in, when it is not drawn in place. */
|
|
609
|
+
function QRCodeContent({
|
|
610
|
+
className,
|
|
611
|
+
width = 'content-fit',
|
|
612
|
+
children,
|
|
613
|
+
...props
|
|
614
|
+
}) {
|
|
615
|
+
const context = useQRCode('QRCode.Content');
|
|
616
|
+
return /*#__PURE__*/_jsx(Popover.Content, {
|
|
617
|
+
width: width,
|
|
618
|
+
className: cn('items-center gap-3', className),
|
|
619
|
+
...props,
|
|
620
|
+
children: /*#__PURE__*/_jsx(QRCodeContext.Provider, {
|
|
621
|
+
value: context,
|
|
622
|
+
children: children
|
|
623
|
+
})
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
QRCodeContent.displayName = 'QRCode.Content';
|
|
627
|
+
export const QRCode = Object.assign(QRCodeRoot, {
|
|
628
|
+
Canvas: QRCodeCanvas,
|
|
629
|
+
Frame: QRCodeFrame,
|
|
630
|
+
Header: QRCodeHeader,
|
|
631
|
+
Title: QRCodeTitle,
|
|
632
|
+
Action: QRCodeAction,
|
|
633
|
+
Panel: QRCodePanel,
|
|
634
|
+
Description: QRCodeDescription,
|
|
635
|
+
Caption: QRCodeCaption,
|
|
636
|
+
Value: QRCodeValue,
|
|
637
|
+
Logo: QRCodeLogo,
|
|
638
|
+
Trigger: QRCodeTrigger,
|
|
639
|
+
Content: QRCodeContent
|
|
640
|
+
});
|
|
641
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useContext","useMemo","View","Svg","Path","Rect","tv","Text","cn","Popover","encodeQr","jsx","_jsx","jsxs","_jsxs","qrCodeVariants","slots","root","frame","header","panel","caption","value","variants","size","sm","md","lg","defaultVariants","CANVAS_SIZE","QUIET_ZONE","TOLERANCE","L","M","Q","H","LEVELS","coverage","logoFraction","holeBounds","matrixSize","from","Math","floor","to","ceil","levelFor","requested","needed","affordable","level","slice","indexOf","find","QRCodeContext","useQRCode","part","context","Error","QRCodeRoot","className","errorCorrection","version","presentation","open","onOpenChange","children","props","ref","hasLogo","LOGO_FRACTION","matrix","error","cause","message","Provider","displayName","PLATE","MODULE","QRCodeCanvas","pixelSize","color","backgroundColor","side","dark","light","path","hole","d","y","x","modules","accessibilityRole","accessibilityLabel","style","width","height","grid","viewBox","rx","fill","QRCodeFrame","QRCodeHeader","QRCodeTitle","muted","numberOfLines","QRCodeAction","QRCodePanel","QRCodeDescription","QRCodeCaption","QRCodeValue","full","undefined","selectable","found","walk","node","Array","isArray","forEach","element","type","QRCodeLogo","box","pointerEvents","QRCodeTrigger","Trigger","QRCodeContent","Content","QRCode","Object","assign","Canvas","Frame","Header","Title","Action","Panel","Description","Caption","Value","Logo"],"sourceRoot":"../../../../src","sources":["components/qr-code/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,aAAa,EACbC,UA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