panelui-native 0.54.0 → 0.57.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 +18 -9
- package/lib/module/components/combobox/index.js +61 -7
- package/lib/module/components/combobox/index.js.map +1 -1
- package/lib/module/components/hex-chart/index.js +765 -0
- package/lib/module/components/hex-chart/index.js.map +1 -0
- 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/components/sortable/index.js +74 -12
- package/lib/module/components/sortable/index.js.map +1 -1
- package/lib/module/components/steps/index.js +95 -12
- package/lib/module/components/steps/index.js.map +1 -1
- package/lib/module/components/tag-input/index.js +435 -0
- package/lib/module/components/tag-input/index.js.map +1 -0
- package/lib/module/components/tour/index.js +661 -0
- package/lib/module/components/tour/index.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/chart.js +209 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/hex-chart/index.d.ts +277 -0
- package/lib/typescript/src/components/hex-chart/index.d.ts.map +1 -0
- 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/components/sortable/index.d.ts.map +1 -1
- package/lib/typescript/src/components/steps/index.d.ts +19 -0
- package/lib/typescript/src/components/steps/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tag-input/index.d.ts +240 -0
- package/lib/typescript/src/components/tag-input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/tour/index.d.ts +168 -0
- package/lib/typescript/src/components/tour/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +98 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/hex-chart/index.tsx +1009 -0
- package/src/components/qr-code/index.tsx +663 -0
- package/src/components/qr-code/qr-encode.ts +548 -0
- package/src/components/steps/index.tsx +103 -8
- package/src/components/tour/index.tsx +933 -0
- package/src/index.ts +41 -0
- package/src/utils/chart.ts +236 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HexChart — a whole broken into parts, counted out in cells.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <HexChart data={attribution}>
|
|
6
|
+
* <HexChart.Header title="Attributed revenue" value="$6,750" />
|
|
7
|
+
* <HexChart.Cells />
|
|
8
|
+
* <HexChart.Legend />
|
|
9
|
+
* </HexChart>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ## What it is, against the pie beside it
|
|
13
|
+
*
|
|
14
|
+
* Both divide one total. The difference is what the reader has to do to read a
|
|
15
|
+
* share off it. A pie asks them to compare angles, which is the hardest
|
|
16
|
+
* quantity there is to judge by eye; this asks them to compare *counts*, and a
|
|
17
|
+
* count is something anyone can check by looking. A series holding a tenth of
|
|
18
|
+
* the cells looks like a tenth and can be confirmed as one, which is why this
|
|
19
|
+
* is the better shape for a split someone is going to quote.
|
|
20
|
+
*
|
|
21
|
+
* What it gives up is precision at the small end. Every cell is a whole unit,
|
|
22
|
+
* so a series worth half a cell either rounds up to a full one or vanishes. It
|
|
23
|
+
* is a chart for shares of a few percent and up, not for a long tail.
|
|
24
|
+
*
|
|
25
|
+
* ## The field
|
|
26
|
+
*
|
|
27
|
+
* The cells are pointy-top hexagons on an offset grid, so each row nests half a
|
|
28
|
+
* cell into the one above it. The unfilled cells are drawn too, in the muted
|
|
29
|
+
* token: the field is the denominator made visible, and a honeycomb floating on
|
|
30
|
+
* nothing gives the eye no total to read the coloured part against.
|
|
31
|
+
*
|
|
32
|
+
* `shape` decides how the filled cells are arranged. `grid` is reading order,
|
|
33
|
+
* which is the arrangement a reader can actually count off. `blob` grows the
|
|
34
|
+
* series out from the middle of the field instead — the smallest in the centre,
|
|
35
|
+
* each larger one wrapped around it — which counts for nothing but shows the
|
|
36
|
+
* shape of the split at a glance. The blob's edge is ragged by design, and
|
|
37
|
+
* ragged the *same way* every time: the nudge that roughens it is a hash of
|
|
38
|
+
* each cell's own coordinates rather than a random number, so a re-render is
|
|
39
|
+
* not an animation and the same data screenshots twice.
|
|
40
|
+
*
|
|
41
|
+
* Cell counts are apportioned by largest remainder, so they add up to the
|
|
42
|
+
* budget exactly. A honeycomb whose parts came to one less than the whole would
|
|
43
|
+
* have a cell in it that nothing in the data accounts for.
|
|
44
|
+
*
|
|
45
|
+
* ## Drawing and animating
|
|
46
|
+
*
|
|
47
|
+
* Two hundred cells is two hundred nodes if each one is drawn on its own, which
|
|
48
|
+
* is more than this needs to spend. Every cell belonging to a series is
|
|
49
|
+
* concatenated into a *single* path instead, so the whole chart is one node per
|
|
50
|
+
* series plus one for the unfilled field — six or seven, whatever the cell
|
|
51
|
+
* count.
|
|
52
|
+
*
|
|
53
|
+
* That is also why the reveal is a clip rather than a per-cell stagger: the
|
|
54
|
+
* cells are no longer separate things to stagger. An ellipse grows from the
|
|
55
|
+
* centre of the field, in the field's own proportions, so the honeycomb is
|
|
56
|
+
* uncovered in the order the blob grew in — which is the same effect a stagger
|
|
57
|
+
* would have given, for one animated value instead of two hundred. A `grid`
|
|
58
|
+
* wipes across instead, because that is the order its cells were filled in.
|
|
59
|
+
*
|
|
60
|
+
* Touch, not hover: a series is selected by pressing one of its cells, and
|
|
61
|
+
* pressing it again clears the selection. There is no equivalent of a pointer
|
|
62
|
+
* resting somewhere without committing, so a chart that only revealed its
|
|
63
|
+
* numbers on hover would never reveal them at all.
|
|
64
|
+
*
|
|
65
|
+
* Colours come from the `--color-chart-*` tokens, so a chart follows the active
|
|
66
|
+
* theme and is put on brand by overriding those five. Nothing here hardcodes a
|
|
67
|
+
* hex.
|
|
68
|
+
*/
|
|
69
|
+
import { type ReactNode } from 'react';
|
|
70
|
+
import { type ViewProps } from 'react-native';
|
|
71
|
+
import { type HexShape } from '../../utils/chart.js';
|
|
72
|
+
/** Whether the chart is showing data or waiting for it. */
|
|
73
|
+
export type HexChartStatus = 'loading' | 'ready';
|
|
74
|
+
export type { HexShape };
|
|
75
|
+
/** One series. Its share is worked out from the others, so there is no maximum. */
|
|
76
|
+
export interface HexDatum {
|
|
77
|
+
/** Name for the legend, the readout and the accessibility label. */
|
|
78
|
+
label: string;
|
|
79
|
+
/** How much of the whole this series is. Negatives are treated as zero. */
|
|
80
|
+
value: number;
|
|
81
|
+
/** Explicit colour, overriding the `--color-chart-*` token. */
|
|
82
|
+
color?: string;
|
|
83
|
+
}
|
|
84
|
+
/** The selected series and its share, for something rendered inside the chart. */
|
|
85
|
+
export declare function useHexChart(): {
|
|
86
|
+
activeIndex: number;
|
|
87
|
+
activeSeries: HexDatum | null;
|
|
88
|
+
/** Its share of the whole, 0 to 1. */
|
|
89
|
+
activeFraction: number;
|
|
90
|
+
/** How many cells it was given, which is what the reader can count. */
|
|
91
|
+
activeCells: number;
|
|
92
|
+
};
|
|
93
|
+
export interface HexChartProps extends ViewProps {
|
|
94
|
+
className?: string;
|
|
95
|
+
/** One entry per series. */
|
|
96
|
+
data: HexDatum[];
|
|
97
|
+
/**
|
|
98
|
+
* Cells across the field. The cell size follows from it and the measured
|
|
99
|
+
* width, so this is the one knob for how fine the honeycomb is.
|
|
100
|
+
*
|
|
101
|
+
* More cells resolve a smaller share — twenty-one across a phone is around
|
|
102
|
+
* two hundred and fifty in the field, so roughly a half a percent each — at
|
|
103
|
+
* the cost of every cell getting smaller and harder to press.
|
|
104
|
+
*/
|
|
105
|
+
columns?: number;
|
|
106
|
+
/** Width over height of the field. */
|
|
107
|
+
aspectRatio?: number;
|
|
108
|
+
/**
|
|
109
|
+
* How much of the field the series fill, 0 to 1.
|
|
110
|
+
*
|
|
111
|
+
* Only meaningful with `shape="blob"`, where the unfilled cells are the
|
|
112
|
+
* margin the blob is read against; a `grid` fills every cell, because a
|
|
113
|
+
* waffle with a ragged last row is a waffle that has stopped being countable.
|
|
114
|
+
*/
|
|
115
|
+
density?: number;
|
|
116
|
+
/** How the filled cells are arranged. */
|
|
117
|
+
shape?: HexShape;
|
|
118
|
+
/**
|
|
119
|
+
* The gap between cells, as a share of the cell radius. Given as a share so
|
|
120
|
+
* the field keeps its proportions at whatever size it is measured at.
|
|
121
|
+
*/
|
|
122
|
+
cellGap?: number;
|
|
123
|
+
/** Milliseconds for the honeycomb to fill in. */
|
|
124
|
+
animationDuration?: number;
|
|
125
|
+
/** `loading` draws the field with nothing divided up yet. */
|
|
126
|
+
status?: HexChartStatus;
|
|
127
|
+
/** Selected series. Leave unset to let the chart track it. */
|
|
128
|
+
activeIndex?: number;
|
|
129
|
+
/** Fires with the selected series, or `-1` when the selection is cleared. */
|
|
130
|
+
onActiveIndexChange?: (index: number) => void;
|
|
131
|
+
children?: ReactNode;
|
|
132
|
+
}
|
|
133
|
+
/** Imperative handle: re-run the fill, for a "replay" control. */
|
|
134
|
+
export interface HexChartHandle {
|
|
135
|
+
replay: () => void;
|
|
136
|
+
}
|
|
137
|
+
export interface HexChartCellsProps {
|
|
138
|
+
/** Colour of the cells no series took. Defaults to the muted token. */
|
|
139
|
+
emptyColor?: string;
|
|
140
|
+
/** Opacity of the series that are not selected, once one is. */
|
|
141
|
+
dimOpacity?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The honeycomb: the unfilled field, and one path per series over it.
|
|
145
|
+
*
|
|
146
|
+
* One part rather than one per series. Every cell shares a radius, a gap and a
|
|
147
|
+
* grid by definition — a chart where one series' cells could be given a size of
|
|
148
|
+
* their own would be a chart drawing a lie, since the whole claim of the shape
|
|
149
|
+
* is that one cell means the same thing wherever it appears.
|
|
150
|
+
*
|
|
151
|
+
* The field is drawn outside the reveal's clip and the series inside it, so the
|
|
152
|
+
* total is there from the first frame and what fills in against it is the
|
|
153
|
+
* split. Uncovering both together would animate the denominator, which is not
|
|
154
|
+
* something that changed.
|
|
155
|
+
*/
|
|
156
|
+
declare function HexChartCells({ emptyColor, dimOpacity }: HexChartCellsProps): import("react").JSX.Element | null;
|
|
157
|
+
declare namespace HexChartCells {
|
|
158
|
+
var displayName: string;
|
|
159
|
+
var slot: "svg";
|
|
160
|
+
}
|
|
161
|
+
export interface HexChartSkeletonProps {
|
|
162
|
+
color?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The loading state: the field, with nothing divided up yet.
|
|
166
|
+
*
|
|
167
|
+
* Deliberately undivided. Placeholder shares would be a made-up split, and a
|
|
168
|
+
* reader has no way to tell an invented one from a real one until it changes
|
|
169
|
+
* under them — which is worse than showing nothing, because it is showing
|
|
170
|
+
* something wrong.
|
|
171
|
+
*/
|
|
172
|
+
declare function HexChartSkeleton({ color }: HexChartSkeletonProps): import("react").JSX.Element | null;
|
|
173
|
+
declare namespace HexChartSkeleton {
|
|
174
|
+
var displayName: string;
|
|
175
|
+
var slot: "svg";
|
|
176
|
+
}
|
|
177
|
+
export interface HexChartTooltipProps {
|
|
178
|
+
/** Format the selected series' value. Defaults to a compact number. */
|
|
179
|
+
formatValue?: (value: number, series: HexDatum) => string;
|
|
180
|
+
/** Show the count of cells beside the share. */
|
|
181
|
+
showCells?: boolean;
|
|
182
|
+
className?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The press target over the honeycomb, and the label that names what was
|
|
186
|
+
* pressed.
|
|
187
|
+
*
|
|
188
|
+
* The label hangs *above* the selected series rather than on it: it is centred
|
|
189
|
+
* across that series' cells and sits clear of the highest one, so the cells
|
|
190
|
+
* being read are never underneath the thing reading them. Two other places it
|
|
191
|
+
* could go are both worse — under the finger is the one part of the chart
|
|
192
|
+
* nobody can see, and on the middle of the series covers the mass the reader
|
|
193
|
+
* just asked about.
|
|
194
|
+
*
|
|
195
|
+
* A series reaching the top of the field pushes the label back inside it, which
|
|
196
|
+
* is the one case it does overlap. That series is the largest one, and its
|
|
197
|
+
* topmost cells are the part of it a reader is least likely to be counting.
|
|
198
|
+
*
|
|
199
|
+
* A press on an unfilled cell clears the selection, the same as pressing the
|
|
200
|
+
* selected series again. Everything outside the honeycomb is "none of them",
|
|
201
|
+
* and making that gesture do nothing would leave a chart you can select in but
|
|
202
|
+
* not out of.
|
|
203
|
+
*/
|
|
204
|
+
declare function HexChartTooltip({ formatValue, showCells, className }: HexChartTooltipProps): import("react").JSX.Element | null;
|
|
205
|
+
declare namespace HexChartTooltip {
|
|
206
|
+
var displayName: string;
|
|
207
|
+
var slot: "overlay";
|
|
208
|
+
}
|
|
209
|
+
export interface HexChartLegendProps extends ViewProps {
|
|
210
|
+
className?: string;
|
|
211
|
+
/** Show each series' share of the whole beside its name. */
|
|
212
|
+
showValue?: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* A swatch, a name and a share per series, under the chart and across the width
|
|
216
|
+
* of it. Pressable in the same way the cells are — the legend is usually the
|
|
217
|
+
* easier target of the two, and a series worth a couple of percent is a handful
|
|
218
|
+
* of cells that may not be adjacent.
|
|
219
|
+
*
|
|
220
|
+
* It wraps rather than stacking, so five or six entries take two lines instead
|
|
221
|
+
* of six. A key is a lookup table, and a lookup table read down a column of one
|
|
222
|
+
* word each is a column the eye has to walk.
|
|
223
|
+
*/
|
|
224
|
+
declare function HexChartLegend({ className, showValue, ...props }: HexChartLegendProps): import("react").JSX.Element | null;
|
|
225
|
+
declare namespace HexChartLegend {
|
|
226
|
+
var displayName: string;
|
|
227
|
+
var slot: "footer";
|
|
228
|
+
}
|
|
229
|
+
export interface HexChartHeaderProps extends ViewProps {
|
|
230
|
+
className?: string;
|
|
231
|
+
/** Small line above the value — what the chart is of. */
|
|
232
|
+
title?: string;
|
|
233
|
+
/** The readout. The largest thing on the card, and the first thing read. */
|
|
234
|
+
value?: string;
|
|
235
|
+
/** One muted line under the value — a period, a comparison, a caveat. */
|
|
236
|
+
caption?: string;
|
|
237
|
+
/** Prettier names for the series, keyed by their `label`. */
|
|
238
|
+
labels?: Record<string, string>;
|
|
239
|
+
/**
|
|
240
|
+
* Draw a swatch and a name per series along the trailing edge.
|
|
241
|
+
*
|
|
242
|
+
* For two or three short names. Past that use `HexChart.Legend`, which runs
|
|
243
|
+
* under the chart across the full width: a key of five long names crammed
|
|
244
|
+
* into the trailing corner of a header wraps to a column and leaves the title
|
|
245
|
+
* beside it a few points wide.
|
|
246
|
+
*/
|
|
247
|
+
legend?: boolean;
|
|
248
|
+
/** Trailing slot — a control, a badge, a range picker. Wins over `legend`. */
|
|
249
|
+
children?: ReactNode;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The strip above the honeycomb: what the chart is of, what it reads, and what
|
|
253
|
+
* the colours mean.
|
|
254
|
+
*
|
|
255
|
+
* It belongs to the chart rather than to the card around it because it is about
|
|
256
|
+
* the *series* — the number changes as one is selected, and the legend is the
|
|
257
|
+
* list the chart itself is holding. The card's header is a caption on the tray
|
|
258
|
+
* the chart sits in; this is the chart introducing itself.
|
|
259
|
+
*
|
|
260
|
+
* The value is not derived here even though there is a total to derive it from,
|
|
261
|
+
* because the formatting is not the chart's to guess: a total of 6750 is a
|
|
262
|
+
* count, a currency or a percentage depending on what was counted, and only the
|
|
263
|
+
* caller knows which.
|
|
264
|
+
*/
|
|
265
|
+
declare function HexChartHeader({ className, title, value, caption, labels, legend, children, ...props }: HexChartHeaderProps): import("react").JSX.Element;
|
|
266
|
+
declare namespace HexChartHeader {
|
|
267
|
+
var displayName: string;
|
|
268
|
+
var slot: "header";
|
|
269
|
+
}
|
|
270
|
+
export declare const HexChart: import("react").ForwardRefExoticComponent<HexChartProps & import("react").RefAttributes<HexChartHandle>> & {
|
|
271
|
+
Header: typeof HexChartHeader;
|
|
272
|
+
Cells: typeof HexChartCells;
|
|
273
|
+
Tooltip: typeof HexChartTooltip;
|
|
274
|
+
Legend: typeof HexChartLegend;
|
|
275
|
+
Skeleton: typeof HexChartSkeleton;
|
|
276
|
+
};
|
|
277
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/hex-chart/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAYtB,OAAO,EAaL,KAAK,QAAQ,EACd,MAAM,sBAAmB,CAAC;AAS3B,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjD,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA0DD,kFAAkF;AAClF,wBAAgB,WAAW;;;IAMvB,sCAAsC;;IAEtC,uEAAuE;;EAG1E;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,KAAK,C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EQ,eAAe;;;;AAqJxB,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,SAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,sCA8CrF;kBA9CQ,cAAc;;;;AAkDvB,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAwDrB;kBAjEQ,cAAc;;;;AAqEvB,eAAO,MAAM,QAAQ;;;;;;CAMnB,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QRCode — a string, drawn as something a camera can read.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <QRCode value="https://panelui.dev">
|
|
6
|
+
* <QRCode.Frame>
|
|
7
|
+
* <QRCode.Canvas />
|
|
8
|
+
* </QRCode.Frame>
|
|
9
|
+
* <QRCode.Caption>Scan to open the docs</QRCode.Caption>
|
|
10
|
+
* </QRCode>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Composition is the API, as everywhere else here: a code in a titled panel is
|
|
14
|
+
* one with a `QRCode.Header` in it, and a code behind a button is one wrapped
|
|
15
|
+
* in a `QRCode.Trigger` and a `QRCode.Content` — not one with a prop turned on.
|
|
16
|
+
*
|
|
17
|
+
* ## What it draws
|
|
18
|
+
*
|
|
19
|
+
* Every dark module is one subpath of a single `<Path>`, not a `<Rect>` of its
|
|
20
|
+
* own. A version 10 code is 3,481 modules; half of them dark is seventeen
|
|
21
|
+
* hundred native views for a picture that never changes, and the difference
|
|
22
|
+
* between that and one node is the difference between a code that appears and
|
|
23
|
+
* one that appears eventually.
|
|
24
|
+
*
|
|
25
|
+
* The colours come from the theme, so a code drawn on a card is legible on
|
|
26
|
+
* every one of them — and light-on-dark is drawn the way scanners expect it,
|
|
27
|
+
* with the quiet zone painted rather than left transparent. A code with
|
|
28
|
+
* nothing behind it reads at about half the distance.
|
|
29
|
+
*
|
|
30
|
+
* ## The hole in the middle
|
|
31
|
+
*
|
|
32
|
+
* `QRCode.Logo` clears a square of modules and puts its children there.
|
|
33
|
+
* Error correction is what makes that survivable — the modules are gone, and
|
|
34
|
+
* the code still reads because there is enough redundancy to reconstruct them.
|
|
35
|
+
* How much is `errorCorrection`, and a logo raises the level it needs: the
|
|
36
|
+
* default `M` tolerates about 15% loss, `H` about 30%. A logo is measured
|
|
37
|
+
* against that budget and the level is raised for you if it has to be.
|
|
38
|
+
*/
|
|
39
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
40
|
+
import { View, type ViewProps } from 'react-native';
|
|
41
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
42
|
+
import { type PopoverContentProps } from '../popover/index.js';
|
|
43
|
+
import { type ErrorCorrectionLevel } from './qr-encode.js';
|
|
44
|
+
export type { ErrorCorrectionLevel };
|
|
45
|
+
declare const qrCodeVariants: import("tailwind-variants").TVReturnType<{
|
|
46
|
+
size: {
|
|
47
|
+
sm: {};
|
|
48
|
+
md: {};
|
|
49
|
+
lg: {};
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
root: string;
|
|
53
|
+
frame: string;
|
|
54
|
+
header: string;
|
|
55
|
+
panel: string;
|
|
56
|
+
caption: string;
|
|
57
|
+
value: string;
|
|
58
|
+
}, undefined, {
|
|
59
|
+
size: {
|
|
60
|
+
sm: {};
|
|
61
|
+
md: {};
|
|
62
|
+
lg: {};
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
root: string;
|
|
66
|
+
frame: string;
|
|
67
|
+
header: string;
|
|
68
|
+
panel: string;
|
|
69
|
+
caption: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
72
|
+
size: {
|
|
73
|
+
sm: {};
|
|
74
|
+
md: {};
|
|
75
|
+
lg: {};
|
|
76
|
+
};
|
|
77
|
+
}, {
|
|
78
|
+
root: string;
|
|
79
|
+
frame: string;
|
|
80
|
+
header: string;
|
|
81
|
+
panel: string;
|
|
82
|
+
caption: string;
|
|
83
|
+
value: string;
|
|
84
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
85
|
+
type QrCodeVariantProps = VariantProps<typeof qrCodeVariants>;
|
|
86
|
+
/** How big the drawn code is. */
|
|
87
|
+
export type QRCodeSize = NonNullable<QrCodeVariantProps['size']>;
|
|
88
|
+
/** Where the code is drawn: in place, in a popover, or up from the bottom. */
|
|
89
|
+
export type QRCodePresentation = 'inline' | 'popover' | 'bottom-sheet';
|
|
90
|
+
export interface QRCodeProps extends Omit<ViewProps, 'children'>, QrCodeVariantProps {
|
|
91
|
+
className?: string;
|
|
92
|
+
/**
|
|
93
|
+
* What the code encodes. Anything: a URL, a WiFi string, a vCard. Encoded
|
|
94
|
+
* as UTF-8, and the version grows to fit it.
|
|
95
|
+
*/
|
|
96
|
+
value: string;
|
|
97
|
+
/**
|
|
98
|
+
* How much of the code can be lost and still read — `L` about 7%, `M` 15%,
|
|
99
|
+
* `Q` 25%, `H` 30%. More correction means a denser code at the same size, so
|
|
100
|
+
* `M` is the default. Raised automatically when a `QRCode.Logo` needs it.
|
|
101
|
+
*/
|
|
102
|
+
errorCorrection?: ErrorCorrectionLevel;
|
|
103
|
+
/**
|
|
104
|
+
* Fix the QR version, 1–40, instead of taking the smallest that fits. Worth
|
|
105
|
+
* setting when the content changes and the code should not visibly change
|
|
106
|
+
* density with it.
|
|
107
|
+
*/
|
|
108
|
+
version?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Where the code appears. `inline` draws it where it sits; the other two
|
|
111
|
+
* put it behind a `QRCode.Trigger` and draw it in a `QRCode.Content`.
|
|
112
|
+
*/
|
|
113
|
+
presentation?: QRCodePresentation;
|
|
114
|
+
/** Controlled open state. Ignored while `presentation` is `inline`. */
|
|
115
|
+
open?: boolean;
|
|
116
|
+
onOpenChange?: (open: boolean) => void;
|
|
117
|
+
children?: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
export interface QRCodeCanvasProps extends Omit<ViewProps, 'children'> {
|
|
120
|
+
className?: string;
|
|
121
|
+
/** Side length in points. Defaults to the size variant's. */
|
|
122
|
+
pixelSize?: number;
|
|
123
|
+
/** Dark modules. See the note below before overriding this. */
|
|
124
|
+
color?: string;
|
|
125
|
+
/** The plate the modules sit on. See the note below. */
|
|
126
|
+
backgroundColor?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface QRCodeFrameProps extends ViewProps {
|
|
129
|
+
className?: string;
|
|
130
|
+
children?: ReactNode;
|
|
131
|
+
}
|
|
132
|
+
export interface QRCodeHeaderProps extends ViewProps {
|
|
133
|
+
className?: string;
|
|
134
|
+
children?: ReactNode;
|
|
135
|
+
}
|
|
136
|
+
export interface QRCodeTitleProps {
|
|
137
|
+
className?: string;
|
|
138
|
+
children?: ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/** What the code is for. Muted — it is a caption on the tray, not a heading. */
|
|
141
|
+
declare function QRCodeTitle({ className, children }: QRCodeTitleProps): import("react").JSX.Element;
|
|
142
|
+
declare namespace QRCodeTitle {
|
|
143
|
+
var displayName: string;
|
|
144
|
+
}
|
|
145
|
+
export interface QRCodeActionProps extends ViewProps {
|
|
146
|
+
className?: string;
|
|
147
|
+
children?: ReactNode;
|
|
148
|
+
}
|
|
149
|
+
export interface QRCodePanelProps extends ViewProps {
|
|
150
|
+
className?: string;
|
|
151
|
+
children?: ReactNode;
|
|
152
|
+
}
|
|
153
|
+
export interface QRCodeDescriptionProps {
|
|
154
|
+
className?: string;
|
|
155
|
+
children?: ReactNode;
|
|
156
|
+
}
|
|
157
|
+
/** A muted line inside the panel, under the code. */
|
|
158
|
+
declare function QRCodeDescription({ className, children }: QRCodeDescriptionProps): import("react").JSX.Element;
|
|
159
|
+
declare namespace QRCodeDescription {
|
|
160
|
+
var displayName: string;
|
|
161
|
+
}
|
|
162
|
+
export interface QRCodeCaptionProps {
|
|
163
|
+
className?: string;
|
|
164
|
+
children?: ReactNode;
|
|
165
|
+
}
|
|
166
|
+
/** A line under the code saying what scanning it does. */
|
|
167
|
+
declare function QRCodeCaption({ className, children }: QRCodeCaptionProps): import("react").JSX.Element;
|
|
168
|
+
declare namespace QRCodeCaption {
|
|
169
|
+
var displayName: string;
|
|
170
|
+
}
|
|
171
|
+
export interface QRCodeValueProps {
|
|
172
|
+
className?: string;
|
|
173
|
+
/** Show the whole string rather than one line of it. */
|
|
174
|
+
full?: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The encoded string itself, for someone who cannot scan it — typing a URL out
|
|
178
|
+
* is slower than pointing a camera at it and it is the only way through when
|
|
179
|
+
* the camera is the thing you are setting up.
|
|
180
|
+
*/
|
|
181
|
+
declare function QRCodeValue({ className, full }: QRCodeValueProps): import("react").JSX.Element;
|
|
182
|
+
declare namespace QRCodeValue {
|
|
183
|
+
var displayName: string;
|
|
184
|
+
}
|
|
185
|
+
export interface QRCodeLogoProps extends ViewProps {
|
|
186
|
+
className?: string;
|
|
187
|
+
children?: ReactNode;
|
|
188
|
+
}
|
|
189
|
+
export interface QRCodeTriggerProps {
|
|
190
|
+
/** The element that opens it. Must accept `onPress`. */
|
|
191
|
+
children: ReactElement<{
|
|
192
|
+
onPress?: (...args: unknown[]) => void;
|
|
193
|
+
}>;
|
|
194
|
+
}
|
|
195
|
+
/** What opens a `popover` or `bottom-sheet` code. */
|
|
196
|
+
declare function QRCodeTrigger({ children }: QRCodeTriggerProps): import("react").JSX.Element;
|
|
197
|
+
declare namespace QRCodeTrigger {
|
|
198
|
+
var displayName: string;
|
|
199
|
+
}
|
|
200
|
+
export interface QRCodeContentProps extends PopoverContentProps {
|
|
201
|
+
}
|
|
202
|
+
/** The panel the code is drawn in, when it is not drawn in place. */
|
|
203
|
+
declare function QRCodeContent({ className, width, children, ...props }: QRCodeContentProps): import("react").JSX.Element;
|
|
204
|
+
declare namespace QRCodeContent {
|
|
205
|
+
var displayName: string;
|
|
206
|
+
}
|
|
207
|
+
export declare const QRCode: import("react").ForwardRefExoticComponent<QRCodeProps & import("react").RefAttributes<View>> & {
|
|
208
|
+
Canvas: import("react").ForwardRefExoticComponent<QRCodeCanvasProps & import("react").RefAttributes<View>>;
|
|
209
|
+
Frame: import("react").ForwardRefExoticComponent<QRCodeFrameProps & import("react").RefAttributes<View>>;
|
|
210
|
+
Header: import("react").ForwardRefExoticComponent<QRCodeHeaderProps & import("react").RefAttributes<View>>;
|
|
211
|
+
Title: typeof QRCodeTitle;
|
|
212
|
+
Action: import("react").ForwardRefExoticComponent<QRCodeActionProps & import("react").RefAttributes<View>>;
|
|
213
|
+
Panel: import("react").ForwardRefExoticComponent<QRCodePanelProps & import("react").RefAttributes<View>>;
|
|
214
|
+
Description: typeof QRCodeDescription;
|
|
215
|
+
Caption: typeof QRCodeCaption;
|
|
216
|
+
Value: typeof QRCodeValue;
|
|
217
|
+
Logo: import("react").ForwardRefExoticComponent<QRCodeLogoProps & import("react").RefAttributes<View>>;
|
|
218
|
+
Trigger: typeof QRCodeTrigger;
|
|
219
|
+
Content: typeof QRCodeContent;
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/qr-code/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,qBAAY,CAAC;AAC/D,OAAO,EAAY,KAAK,oBAAoB,EAAiB,MAAM,gBAAa,CAAC;AAEjF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAuBlB,CAAC;AAEH,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAE9D,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AAqEjE,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC;AAEvE,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,kBAAkB;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,C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 -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A QR encoder, in TypeScript, with no dependencies.
|
|
3
|
+
*
|
|
4
|
+
* Vendored rather than installed for the reason the rest of this library has
|
|
5
|
+
* no runtime dependencies: a component that needs an npm package to draw
|
|
6
|
+
* itself is one the CLI has to install on someone's behalf, and every project
|
|
7
|
+
* that copies the source in inherits it. This is a few hundred lines of
|
|
8
|
+
* arithmetic that has not changed since 2000 — it is cheaper to own.
|
|
9
|
+
*
|
|
10
|
+
* Byte mode only. The alphanumeric and numeric modes pack more into the same
|
|
11
|
+
* version, but they only accept their own alphabets, and the thing people
|
|
12
|
+
* encode is a URL. Byte mode takes anything.
|
|
13
|
+
*
|
|
14
|
+
* The output is a square matrix of booleans, dark first. Everything about how
|
|
15
|
+
* it is drawn — module size, colour, quiet zone, the hole in the middle for a
|
|
16
|
+
* logo — belongs to the component, not here.
|
|
17
|
+
*/
|
|
18
|
+
/** How much of the code can be lost and still read. */
|
|
19
|
+
export type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
|
|
20
|
+
export interface QrMatrix {
|
|
21
|
+
/** `true` is a dark module. Row-major, `[y][x]`. */
|
|
22
|
+
modules: boolean[][];
|
|
23
|
+
/** Modules per side, quiet zone excluded. */
|
|
24
|
+
size: number;
|
|
25
|
+
/** The version chosen for this data, 1–40. */
|
|
26
|
+
version: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Encode `text` as a QR matrix.
|
|
30
|
+
*
|
|
31
|
+
* `version` is chosen to be the smallest that fits unless one is given. A
|
|
32
|
+
* fixed version is worth asking for when the content changes and the code
|
|
33
|
+
* should not visibly change size with it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function encodeQr(text: string, { errorCorrection, version: requestedVersion, }?: {
|
|
36
|
+
errorCorrection?: ErrorCorrectionLevel;
|
|
37
|
+
version?: number;
|
|
38
|
+
}): QrMatrix;
|
|
39
|
+
//# sourceMappingURL=qr-encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-encode.d.ts","sourceRoot":"","sources":["../../../../../src/components/qr-code/qr-encode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AA0PzD,MAAM,WAAW,QAAQ;IACvB,oDAAoD;IACpD,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;IACrB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,EACE,eAAqB,EACrB,OAAO,EAAE,gBAAgB,GAC1B,GAAE;IAAE,eAAe,CAAC,EAAE,oBAAoB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACnE,QAAQ,CA4IV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/sortable/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,QAAQ,EAAE,EAYf,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AA0DjC,0BAA0B;AAC1B,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExD,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA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C;IACnC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,EACT,GAAO,EACP,UAAqB,EACrB,cAAoB,EACpB,OAAc,EACd,QAAgB,EAChB,SAAS,EACT,mBAAwB,EACxB,eAAmB,EACnB,WAAW,EACX,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/sortable/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,QAAQ,EAAE,EAYf,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AA0DjC,0BAA0B;AAC1B,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExD,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,CASlF;AAyPD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAA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wSf;kBAxTQ,YAAY;;;AA+TrB,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,eAAe,EACf,EAAE,EACF,QAAQ,EACR,QAAgB,EAChB,MAAc,EACd,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA4UnB;kBApVQ,YAAY;;;AA2VrB,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,QAAQ,EACR,kBAAsC,EACtC,GAAG,KAAK,EACT,EAAE,mBAAmB,+BA6DrB;kBAlEQ,cAAc;;;AAqEvB,eAAO,MAAM,QAAQ;;;CAGnB,CAAC"}
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
* Steps does not own your flow: it reflects whatever step your app says is
|
|
15
15
|
* active. Pass `value` to control it, or `defaultValue` to let it manage
|
|
16
16
|
* its own.
|
|
17
|
+
*
|
|
18
|
+
* The connectors are the component's job, not yours. The root counts the items
|
|
19
|
+
* it holds and each one draws the connector to the next, so a stepper is just
|
|
20
|
+
* its steps — there is no separator to forget, mis-order, or leave dangling
|
|
21
|
+
* past the last stop. An item that contains its own `Steps.Separator` keeps it
|
|
22
|
+
* and gets no second one, so hand-placed connectors still work; `separators`
|
|
23
|
+
* turns the automatic ones off wholesale.
|
|
24
|
+
*
|
|
25
|
+
* Knowing the count is also what lets a step say where it sits. A screen reader
|
|
26
|
+
* reaching the middle of a wizard hears "Payment, step 2 of 3, completed" —
|
|
27
|
+
* the position and the state, which are the two things the circle and its fill
|
|
28
|
+
* convey to everyone else.
|
|
17
29
|
*/
|
|
18
30
|
import { type ReactNode } from 'react';
|
|
19
31
|
import { View, type Text as RNText, type ViewProps } from 'react-native';
|
|
@@ -28,6 +40,13 @@ export interface StepsProps extends ViewProps {
|
|
|
28
40
|
value?: number;
|
|
29
41
|
onValueChange?: (value: number) => void;
|
|
30
42
|
orientation?: StepsOrientation;
|
|
43
|
+
/**
|
|
44
|
+
* Draw the connector between one item and the next. On by default — an item
|
|
45
|
+
* that holds its own `Steps.Separator` is left alone either way, so this is
|
|
46
|
+
* for a stepper that wants no connectors at all rather than for one that
|
|
47
|
+
* places them by hand.
|
|
48
|
+
*/
|
|
49
|
+
separators?: boolean;
|
|
31
50
|
children?: ReactNode;
|
|
32
51
|
}
|
|
33
52
|
export interface StepsItemProps extends ViewProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/steps/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/steps/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpF,OAAO,EAAQ,KAAK,SAAS,EAAgB,MAAM,0BAAuB,CAAC;AAG3E,MA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