panelui-native 0.86.1 → 0.88.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 +4 -2
- package/lib/module/components/animated-badge/index.js +451 -0
- package/lib/module/components/animated-badge/index.js.map +1 -0
- package/lib/module/components/bottom-sheet/index.js +17 -6
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/bubble-chart/index.js +1782 -0
- package/lib/module/components/bubble-chart/index.js.map +1 -0
- package/lib/module/components/feedback-dialog/index.js +474 -0
- package/lib/module/components/feedback-dialog/index.js.map +1 -0
- package/lib/module/components/pyramid-chart/index.js +1143 -0
- package/lib/module/components/pyramid-chart/index.js.map +1 -0
- package/lib/module/components/scroll-blur/index.js +363 -0
- package/lib/module/components/scroll-blur/index.js.map +1 -0
- package/lib/module/components/scroll-canvas/index.js +2 -0
- package/lib/module/components/scroll-canvas/index.js.map +1 -1
- package/lib/module/components/scroll-text/index.js +3 -0
- package/lib/module/components/scroll-text/index.js.map +1 -1
- package/lib/module/components/search-bar/index.js +753 -25
- package/lib/module/components/search-bar/index.js.map +1 -1
- package/lib/module/hooks/use-keyboard-avoidance.js +21 -1
- package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
- package/lib/module/hooks/use-reveal-progress.js +21 -1
- package/lib/module/hooks/use-reveal-progress.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/chart.js +24 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/typescript/src/components/animated-badge/index.d.ts +224 -0
- package/lib/typescript/src/components/animated-badge/index.d.ts.map +1 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +1 -15
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bubble-chart/index.d.ts +481 -0
- package/lib/typescript/src/components/bubble-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/feedback-dialog/index.d.ts +156 -0
- package/lib/typescript/src/components/feedback-dialog/index.d.ts.map +1 -0
- package/lib/typescript/src/components/pyramid-chart/index.d.ts +328 -0
- package/lib/typescript/src/components/pyramid-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scroll-blur/index.d.ts +113 -0
- package/lib/typescript/src/components/scroll-blur/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scroll-canvas/index.d.ts.map +1 -1
- package/lib/typescript/src/components/search-bar/index.d.ts +350 -6
- package/lib/typescript/src/components/search-bar/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts +6 -27
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +14 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/animated-badge/index.tsx +513 -0
- package/src/components/bottom-sheet/index.tsx +23 -8
- package/src/components/bubble-chart/index.tsx +2145 -0
- package/src/components/feedback-dialog/index.tsx +557 -0
- package/src/components/pyramid-chart/index.tsx +1360 -0
- package/src/components/scroll-blur/index.tsx +466 -0
- package/src/components/scroll-canvas/index.tsx +2 -1
- package/src/components/scroll-text/index.tsx +3 -3
- package/src/components/search-bar/index.tsx +933 -45
- package/src/hooks/use-keyboard-avoidance.ts +24 -1
- package/src/hooks/use-reveal-progress.ts +30 -1
- package/src/index.ts +72 -1
- package/src/utils/chart.ts +27 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BubbleChart — one labelled circle per row, on two measured axes, with a third
|
|
3
|
+
* quantity on each circle's area.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <BubbleChart data={teams} xDataKey="efficiency" yDataKey="performance"
|
|
7
|
+
* sizeKey="headcount" labelKey="team">
|
|
8
|
+
* <BubbleChart.Grid />
|
|
9
|
+
* <BubbleChart.Bubbles />
|
|
10
|
+
* <BubbleChart.Labels />
|
|
11
|
+
* <BubbleChart.XAxis />
|
|
12
|
+
* <BubbleChart.YAxis />
|
|
13
|
+
* <BubbleChart.Tooltip />
|
|
14
|
+
* </BubbleChart>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## When this and not a scatter plot
|
|
18
|
+
*
|
|
19
|
+
* `ScatterChart` also maps a third quantity onto point area, through `sizeKey`,
|
|
20
|
+
* and it is the right component for a *series* of observations: many points of
|
|
21
|
+
* one colour, where the shape of the cloud is the finding and no single dot
|
|
22
|
+
* needs a name.
|
|
23
|
+
*
|
|
24
|
+
* This one is for a handful of named things. Each row is its own circle with
|
|
25
|
+
* its own colour and its own label written inside it, so the chart can be read
|
|
26
|
+
* entity by entity rather than as a distribution. Eight teams, twelve products,
|
|
27
|
+
* six regions — where the reader wants to find one of them and see where it
|
|
28
|
+
* sits.
|
|
29
|
+
*
|
|
30
|
+
* ## Area, not radius
|
|
31
|
+
*
|
|
32
|
+
* `sizeKey` maps to a circle's area. Doubling a radius quadruples the ink, so a
|
|
33
|
+
* chart that scaled the radius would show a doubled value as four times the
|
|
34
|
+
* size, and the reader would believe the picture. The scale runs over the whole
|
|
35
|
+
* data set, so one bubble's size means the same thing as another's.
|
|
36
|
+
*
|
|
37
|
+
* ## Labels are text, not SVG
|
|
38
|
+
*
|
|
39
|
+
* The names inside the bubbles are React Native `Text` in a layer over the
|
|
40
|
+
* plot, so they follow the theme's font and the platform's text scaling — SVG
|
|
41
|
+
* text does neither. A bubble too small to hold its own label is left without
|
|
42
|
+
* one rather than given an unreadable one; the readout still names it.
|
|
43
|
+
*/
|
|
44
|
+
import { type ReactNode } from 'react';
|
|
45
|
+
import { type ViewProps } from 'react-native';
|
|
46
|
+
import { type ChartAccessibilityProps } from '../../primitives/chart-accessibility.js';
|
|
47
|
+
type Layer = 'svg' | 'overlay' | 'header' | 'footer';
|
|
48
|
+
export type BubbleChartStatus = 'loading' | 'ready';
|
|
49
|
+
export type BubbleChartDatum = Record<string, string | number | null | undefined>;
|
|
50
|
+
/** One bubble, resolved back to the row it came from. */
|
|
51
|
+
export interface BubbleChartPoint {
|
|
52
|
+
/** Index into `data`. */
|
|
53
|
+
index: number;
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
/** The value behind the area, when `sizeKey` is set. */
|
|
57
|
+
size: number | null;
|
|
58
|
+
/** The name written inside the circle, when `labelKey` is set. */
|
|
59
|
+
label: string;
|
|
60
|
+
/** The colour it was drawn in. */
|
|
61
|
+
color: string;
|
|
62
|
+
datum: BubbleChartDatum;
|
|
63
|
+
}
|
|
64
|
+
/** A bubble with its geometry resolved. Shared by every part. */
|
|
65
|
+
interface ResolvedBubble extends BubbleChartPoint {
|
|
66
|
+
/** Radius in points, off the area scale. */
|
|
67
|
+
r: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The bubble under the finger, for something rendered *inside* the chart. A
|
|
71
|
+
* readout in the card's header is outside this provider — use
|
|
72
|
+
* `onActivePointChange` for that.
|
|
73
|
+
*/
|
|
74
|
+
export declare function useBubbleChart(): {
|
|
75
|
+
activeIndex: number;
|
|
76
|
+
activePoint: ResolvedBubble | null;
|
|
77
|
+
};
|
|
78
|
+
export interface BubbleChartProps extends ViewProps, ChartAccessibilityProps<BubbleChartDatum> {
|
|
79
|
+
className?: string;
|
|
80
|
+
/** The rows. One bubble each. */
|
|
81
|
+
data: BubbleChartDatum[];
|
|
82
|
+
/** Key holding the horizontal value. */
|
|
83
|
+
xDataKey?: string;
|
|
84
|
+
/** Key holding the vertical value. */
|
|
85
|
+
yDataKey?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Key holding the third quantity, mapped to each bubble's *area*. Without it
|
|
88
|
+
* every bubble is drawn at the middle of `sizeRange` and the chart is a
|
|
89
|
+
* scatter plot with names on it.
|
|
90
|
+
*/
|
|
91
|
+
sizeKey?: string;
|
|
92
|
+
/** Key holding the name written inside the circle. */
|
|
93
|
+
labelKey?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Key holding a colour for the row — either a CSS colour or a number from 1
|
|
96
|
+
* to 5 naming a `--color-chart-*` token. Without it the ramp cycles by row.
|
|
97
|
+
*/
|
|
98
|
+
colorKey?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Smallest and largest radius `sizeKey` maps onto, in points. The largest is
|
|
101
|
+
* also what the plot holds back at every edge, so raising it costs room.
|
|
102
|
+
*/
|
|
103
|
+
sizeRange?: [number, number];
|
|
104
|
+
/**
|
|
105
|
+
* `loading` shows a still field of muted circles and dissolves it as the real
|
|
106
|
+
* bubbles grow in. One component throughout, rather than a spinner swapped
|
|
107
|
+
* for a chart — swapping loses the transition. Add a `BubbleChart.Skeleton`
|
|
108
|
+
* for something to stand in the plot meanwhile.
|
|
109
|
+
*/
|
|
110
|
+
status?: BubbleChartStatus;
|
|
111
|
+
/** Width ÷ height. `1` is the square shape a bubble field reads best in. */
|
|
112
|
+
aspectRatio?: number;
|
|
113
|
+
/** Milliseconds for the bubbles to grow in on mount. */
|
|
114
|
+
animationDuration?: number;
|
|
115
|
+
/** Milliseconds for the axes to settle after the data changes. */
|
|
116
|
+
domainDuration?: number;
|
|
117
|
+
/** Fix the horizontal axis instead of deriving it. */
|
|
118
|
+
xDomain?: [number, number];
|
|
119
|
+
/** Fix the vertical axis instead of deriving it. */
|
|
120
|
+
yDomain?: [number, number];
|
|
121
|
+
/** The bubble under the finger, and `null` when it lifts. */
|
|
122
|
+
onActivePointChange?: (point: BubbleChartPoint | null) => void;
|
|
123
|
+
children?: ReactNode;
|
|
124
|
+
}
|
|
125
|
+
/** Imperative handle: re-run the grow-in, for a "replay" control. */
|
|
126
|
+
export interface BubbleChartHandle {
|
|
127
|
+
replay: () => void;
|
|
128
|
+
}
|
|
129
|
+
export interface BubbleChartGridProps {
|
|
130
|
+
/**
|
|
131
|
+
* Horizontal rules across the plot.
|
|
132
|
+
*
|
|
133
|
+
* Eight, which is twice the four intervals an axis is divided into by
|
|
134
|
+
* default, so every second line carries a number and the ones between it are
|
|
135
|
+
* halves of a labelled step rather than an unrelated rhythm. Squares this
|
|
136
|
+
* size recede behind the circles; the coarse grid a smaller number draws
|
|
137
|
+
* reads as blocks laid over the plot.
|
|
138
|
+
*/
|
|
139
|
+
rows?: number;
|
|
140
|
+
/** Vertical rules up it. Both axes are measured, so both earn lines. */
|
|
141
|
+
columns?: number;
|
|
142
|
+
/** Dash pattern for the rules. Pass `undefined` for solid ones. */
|
|
143
|
+
dashArray?: string;
|
|
144
|
+
color?: string;
|
|
145
|
+
opacity?: number;
|
|
146
|
+
}
|
|
147
|
+
/** Reference lines both ways, so a bubble can be placed against two numbers. */
|
|
148
|
+
declare function BubbleChartGrid({ rows, columns, dashArray, color, opacity, }: BubbleChartGridProps): import("react").JSX.Element;
|
|
149
|
+
declare namespace BubbleChartGrid {
|
|
150
|
+
var displayName: string;
|
|
151
|
+
var layer: Layer;
|
|
152
|
+
}
|
|
153
|
+
export interface BubbleChartTrendProps {
|
|
154
|
+
/**
|
|
155
|
+
* The line's slope and intercept, and how tightly the cloud sits on it, once
|
|
156
|
+
* they have been computed. `r` runs 0 to 1: 1 is every bubble on the line,
|
|
157
|
+
* 0 is a cloud with no direction at all.
|
|
158
|
+
*
|
|
159
|
+
* Given here rather than left for the caller to work out, because the fit is
|
|
160
|
+
* already being computed to draw the line and doing it twice invites the two
|
|
161
|
+
* answers to disagree.
|
|
162
|
+
*
|
|
163
|
+
* It fires when the numbers change, not on every render that produced the
|
|
164
|
+
* same ones, so putting the fit straight into state is safe.
|
|
165
|
+
*/
|
|
166
|
+
onFit?: (fit: {
|
|
167
|
+
slope: number;
|
|
168
|
+
intercept: number;
|
|
169
|
+
r: number;
|
|
170
|
+
}) => void;
|
|
171
|
+
color?: string;
|
|
172
|
+
strokeWidth?: number;
|
|
173
|
+
/** Dash pattern. Dashed by default: the line is a reading, not a measurement. */
|
|
174
|
+
dashArray?: string;
|
|
175
|
+
opacity?: number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The straight line that fits the cloud best, drawn across the plot.
|
|
179
|
+
*
|
|
180
|
+
* It is dashed and drawn under the circles, because it is not data — it is a
|
|
181
|
+
* summary of the data, and a solid rule through the middle of a field of
|
|
182
|
+
* bubbles reads as a value somebody plotted.
|
|
183
|
+
*
|
|
184
|
+
* The fit is least squares on the raw values, so it moves with the data rather
|
|
185
|
+
* than with the frame: resizing the chart never changes the line's meaning.
|
|
186
|
+
* Fewer than two bubbles, or every bubble on one vertical, has no line to draw
|
|
187
|
+
* and none is drawn.
|
|
188
|
+
*/
|
|
189
|
+
declare function BubbleChartTrend({ onFit, color, strokeWidth, dashArray, opacity, }: BubbleChartTrendProps): import("react").JSX.Element | null;
|
|
190
|
+
declare namespace BubbleChartTrend {
|
|
191
|
+
var displayName: string;
|
|
192
|
+
var layer: Layer;
|
|
193
|
+
}
|
|
194
|
+
export interface BubbleChartBubblesProps {
|
|
195
|
+
/**
|
|
196
|
+
* Fill opacity. Below 1 by default so that overlapping bubbles read as
|
|
197
|
+
* denser rather than hiding each other — in a crowded corner that overlap
|
|
198
|
+
* *is* the finding, and opaque circles erase it.
|
|
199
|
+
*/
|
|
200
|
+
opacity?: number;
|
|
201
|
+
/** One colour for every bubble, overriding the per-row ramp. */
|
|
202
|
+
color?: string;
|
|
203
|
+
}
|
|
204
|
+
/** The circles. */
|
|
205
|
+
declare function BubbleChartBubbles({ opacity, color }: BubbleChartBubblesProps): import("react").JSX.Element | null;
|
|
206
|
+
declare namespace BubbleChartBubbles {
|
|
207
|
+
var displayName: string;
|
|
208
|
+
var layer: Layer;
|
|
209
|
+
}
|
|
210
|
+
export interface BubbleChartSkeletonProps {
|
|
211
|
+
/** How many placeholder circles to scatter. */
|
|
212
|
+
count?: number;
|
|
213
|
+
color?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The loading state: a still field of muted circles where the data will be.
|
|
217
|
+
*
|
|
218
|
+
* Deliberately still. A shimmer over a field of circles reads as them *moving*,
|
|
219
|
+
* which is the one thing this chart must never appear to do — position is the
|
|
220
|
+
* entire message, and a loading state that implies it is changing is a loading
|
|
221
|
+
* state that lies.
|
|
222
|
+
*
|
|
223
|
+
* The layout is deterministic rather than random, so it does not reshuffle on
|
|
224
|
+
* every render of a component that may re-render several times while waiting.
|
|
225
|
+
* It dissolves as the real bubbles grow in, and outlives the status change by
|
|
226
|
+
* exactly that long: cut at the frame the data lands, the placeholder would
|
|
227
|
+
* disappear before anything had replaced it.
|
|
228
|
+
*/
|
|
229
|
+
declare function BubbleChartSkeleton({ count, color }: BubbleChartSkeletonProps): import("react").JSX.Element | null;
|
|
230
|
+
declare namespace BubbleChartSkeleton {
|
|
231
|
+
var displayName: string;
|
|
232
|
+
var layer: Layer;
|
|
233
|
+
}
|
|
234
|
+
export interface BubbleChartLabelsProps {
|
|
235
|
+
/**
|
|
236
|
+
* Smallest radius a bubble may have and still be given its label. Below it
|
|
237
|
+
* the name is wider than the circle it names.
|
|
238
|
+
*/
|
|
239
|
+
minRadius?: number;
|
|
240
|
+
/** Turn a bubble into its label. Defaults to the value at `labelKey`. */
|
|
241
|
+
format?: (point: BubbleChartPoint) => string;
|
|
242
|
+
className?: string;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The names, written inside the circles.
|
|
246
|
+
*
|
|
247
|
+
* Real text over the plot rather than SVG text, so they follow the theme's font
|
|
248
|
+
* and the platform's text scaling. Each one rides the same domain tweens the
|
|
249
|
+
* circle under it does, so a label never lags the bubble it belongs to.
|
|
250
|
+
*
|
|
251
|
+
* A bubble too small to hold its name is left without one. Shrinking the text
|
|
252
|
+
* to fit would make it unreadable on exactly the bubbles the reader is
|
|
253
|
+
* squinting at already; the readout names those instead.
|
|
254
|
+
*/
|
|
255
|
+
declare function BubbleChartLabels({ minRadius, format, className, }: BubbleChartLabelsProps): import("react").JSX.Element | null;
|
|
256
|
+
declare namespace BubbleChartLabels {
|
|
257
|
+
var displayName: string;
|
|
258
|
+
var layer: Layer;
|
|
259
|
+
}
|
|
260
|
+
export interface BubbleChartQuadrantsProps {
|
|
261
|
+
/** Where the vertical rule stands. Defaults to the mean of the x values. */
|
|
262
|
+
x?: number;
|
|
263
|
+
/** Where the horizontal rule lies. Defaults to the mean of the y values. */
|
|
264
|
+
y?: number;
|
|
265
|
+
/** A word for each corner, written in the corner it belongs to. */
|
|
266
|
+
labels?: {
|
|
267
|
+
topLeft?: string;
|
|
268
|
+
topRight?: string;
|
|
269
|
+
bottomLeft?: string;
|
|
270
|
+
bottomRight?: string;
|
|
271
|
+
};
|
|
272
|
+
/** Tint the high-high and low-low corners. On by default. */
|
|
273
|
+
tint?: boolean;
|
|
274
|
+
color?: string;
|
|
275
|
+
className?: string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A crosshair splitting the plot into four, with a name for each corner.
|
|
279
|
+
*
|
|
280
|
+
* A field of bubbles is usually read as four groups rather than as a cloud —
|
|
281
|
+
* which of these is doing well on both counts, which on neither — and without
|
|
282
|
+
* a divider the reader draws that line by eye, in a different place each time.
|
|
283
|
+
* Putting it on the chart makes it one line everybody sees.
|
|
284
|
+
*
|
|
285
|
+
* It stands at the mean of each axis by default, because that is the split the
|
|
286
|
+
* data itself argues for. Pass `x` and `y` for a target, a budget or last
|
|
287
|
+
* year's number — a threshold somebody decided rather than one the data
|
|
288
|
+
* produced.
|
|
289
|
+
*
|
|
290
|
+
* The tint marks the two corners a reading usually ends at. Turn it off where
|
|
291
|
+
* all four corners matter equally.
|
|
292
|
+
*/
|
|
293
|
+
declare function BubbleChartQuadrants({ x, y, labels, tint, color, className, }: BubbleChartQuadrantsProps): import("react").JSX.Element | null;
|
|
294
|
+
declare namespace BubbleChartQuadrants {
|
|
295
|
+
var displayName: string;
|
|
296
|
+
var layer: Layer;
|
|
297
|
+
}
|
|
298
|
+
export interface BubbleChartSizeKeyProps {
|
|
299
|
+
/** Which corner of the plot it sits in. */
|
|
300
|
+
placement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
301
|
+
/** Turn a value into its label. Defaults to a compact number. */
|
|
302
|
+
format?: (value: number) => string;
|
|
303
|
+
/** A word for what the area means — "people", "revenue". */
|
|
304
|
+
label?: string;
|
|
305
|
+
className?: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Three nested circles saying what a bubble's area is worth.
|
|
309
|
+
*
|
|
310
|
+
* A bubble chart's third quantity is the one it cannot state: position can be
|
|
311
|
+
* read off the axes, but area has no axis, so a reader can see that one circle
|
|
312
|
+
* is bigger than another and has no way to know by how much. This is the only
|
|
313
|
+
* part of the chart that answers that.
|
|
314
|
+
*
|
|
315
|
+
* Nested and sharing a baseline, which is how a difference in area is compared
|
|
316
|
+
* — three circles in a row are three sizes, three circles inside one another
|
|
317
|
+
* are one scale.
|
|
318
|
+
*
|
|
319
|
+
* It needs a `sizeKey` on the chart. Without one every bubble is the same size
|
|
320
|
+
* and there is no scale to key.
|
|
321
|
+
*/
|
|
322
|
+
declare function BubbleChartSizeKey({ placement, format, label, className, }: BubbleChartSizeKeyProps): import("react").JSX.Element | null;
|
|
323
|
+
declare namespace BubbleChartSizeKey {
|
|
324
|
+
var displayName: string;
|
|
325
|
+
var layer: Layer;
|
|
326
|
+
}
|
|
327
|
+
export interface BubbleChartXAxisProps {
|
|
328
|
+
/**
|
|
329
|
+
* How many intervals to divide the axis into. Yields `ticks + 1` labels.
|
|
330
|
+
*
|
|
331
|
+
* Four, and the domain is rounded out to four steps to match, so the numbers
|
|
332
|
+
* come out round. Fewer leaves most of the grid unnamed — a line with nothing
|
|
333
|
+
* beside it is a line the reader has to count their way to.
|
|
334
|
+
*/
|
|
335
|
+
ticks?: number;
|
|
336
|
+
/** Turn a value into its label. Defaults to a compact number. */
|
|
337
|
+
format?: (value: number) => string;
|
|
338
|
+
/** What the axis measures, written under the numbers. */
|
|
339
|
+
label?: string;
|
|
340
|
+
className?: string;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The x labels, evenly along the axis.
|
|
344
|
+
*
|
|
345
|
+
* Evenly spaced, because this axis is a continuous scale rather than a list of
|
|
346
|
+
* rows. There is no bubble for a label to sit under.
|
|
347
|
+
*/
|
|
348
|
+
declare function BubbleChartXAxis({ ticks, format, label, className }: BubbleChartXAxisProps): import("react").JSX.Element;
|
|
349
|
+
declare namespace BubbleChartXAxis {
|
|
350
|
+
var displayName: string;
|
|
351
|
+
var layer: Layer;
|
|
352
|
+
var axis: "x";
|
|
353
|
+
}
|
|
354
|
+
export interface BubbleChartYAxisProps {
|
|
355
|
+
/**
|
|
356
|
+
* How many intervals to divide the axis into. Yields `ticks + 1` labels.
|
|
357
|
+
*
|
|
358
|
+
* Four, matching the four steps the domain is rounded out to and every second
|
|
359
|
+
* line of the default grid.
|
|
360
|
+
*/
|
|
361
|
+
ticks?: number;
|
|
362
|
+
/** Turn a value into its label. Defaults to a compact number. */
|
|
363
|
+
format?: (value: number) => string;
|
|
364
|
+
/** What the axis measures, written up the side of it. */
|
|
365
|
+
label?: string;
|
|
366
|
+
className?: string;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Value labels down the side, evenly over the axis, and the gutter they sit in.
|
|
370
|
+
*
|
|
371
|
+
* They land on every second line of the default grid rather than on all of
|
|
372
|
+
* them: a number beside every line of a grid fine enough to read against is a
|
|
373
|
+
* column of numbers, and the reader stops seeing the chart.
|
|
374
|
+
*/
|
|
375
|
+
declare function BubbleChartYAxis({ ticks, format, label, className }: BubbleChartYAxisProps): import("react").JSX.Element;
|
|
376
|
+
declare namespace BubbleChartYAxis {
|
|
377
|
+
var displayName: string;
|
|
378
|
+
var layer: Layer;
|
|
379
|
+
var axis: "y";
|
|
380
|
+
}
|
|
381
|
+
export interface BubbleChartTooltipProps {
|
|
382
|
+
/** Float a small readout beside the selected bubble. On by default. */
|
|
383
|
+
showLabel?: boolean;
|
|
384
|
+
/** Format the x value for the readout. Defaults to a compact number. */
|
|
385
|
+
formatX?: (value: number) => string;
|
|
386
|
+
/** Format the y value for the readout. Defaults to a compact number. */
|
|
387
|
+
formatY?: (value: number) => string;
|
|
388
|
+
/** Format the size value for the readout. Defaults to a compact number. */
|
|
389
|
+
formatSize?: (value: number) => string;
|
|
390
|
+
/** Floor on the touch target, for a chart whose smallest bubbles are tiny. */
|
|
391
|
+
hitRadius?: number;
|
|
392
|
+
className?: string;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The touch target, the selection it drives, and the readout that follows it.
|
|
396
|
+
*
|
|
397
|
+
* A touch picks the nearest bubble whose own circle — or the `hitRadius` floor,
|
|
398
|
+
* whichever is larger — reaches the finger. Nearest rather than topmost,
|
|
399
|
+
* because where bubbles overlap the one drawn last is not the one being aimed
|
|
400
|
+
* at.
|
|
401
|
+
*
|
|
402
|
+
* The search runs on the UI thread over flat arrays of already-projected
|
|
403
|
+
* coordinates, and only the *index* of the winner crosses back into JS, and
|
|
404
|
+
* only when it changes. A drag across the plot therefore costs a handful of
|
|
405
|
+
* re-renders rather than one per frame.
|
|
406
|
+
*
|
|
407
|
+
* Distances are compared squared. The nearest bubble by distance is the nearest
|
|
408
|
+
* by distance-squared, and a square root per bubble per frame buys nothing.
|
|
409
|
+
*/
|
|
410
|
+
declare function BubbleChartTooltip({ showLabel, formatX, formatY, formatSize, hitRadius, className, }: BubbleChartTooltipProps): import("react").JSX.Element | null;
|
|
411
|
+
declare namespace BubbleChartTooltip {
|
|
412
|
+
var displayName: string;
|
|
413
|
+
var layer: Layer;
|
|
414
|
+
}
|
|
415
|
+
export interface BubbleChartLegendProps extends ViewProps {
|
|
416
|
+
className?: string;
|
|
417
|
+
/** Cap on how many bubbles are named. The rest are left to the readout. */
|
|
418
|
+
limit?: number;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* A swatch and a name per bubble, for a chart whose circles are too small to
|
|
422
|
+
* carry their own labels.
|
|
423
|
+
*
|
|
424
|
+
* Drawn **under** the plot rather than floating in a corner of it. A key that
|
|
425
|
+
* overlays the drawing area competes with the bubbles for the space they are
|
|
426
|
+
* plotted in, and on a square chart there is no corner that is reliably empty —
|
|
427
|
+
* the position of a bubble is the data, so nowhere can be reserved for it.
|
|
428
|
+
*
|
|
429
|
+
* It lists rows rather than series, because in this chart a row *is* a
|
|
430
|
+
* category. Use it instead of `BubbleChart.Labels`, not beside it — the same
|
|
431
|
+
* names twice is the legend telling the reader what the plot already says.
|
|
432
|
+
*/
|
|
433
|
+
declare function BubbleChartLegend({ className, limit, ...props }: BubbleChartLegendProps): import("react").JSX.Element | null;
|
|
434
|
+
declare namespace BubbleChartLegend {
|
|
435
|
+
var displayName: string;
|
|
436
|
+
var layer: Layer;
|
|
437
|
+
}
|
|
438
|
+
export interface BubbleChartHeaderProps extends ViewProps {
|
|
439
|
+
className?: string;
|
|
440
|
+
/** Small line above the value — what the chart is of. */
|
|
441
|
+
title?: string;
|
|
442
|
+
/** The readout. The largest thing on the card, and the first thing read. */
|
|
443
|
+
value?: string;
|
|
444
|
+
/** One muted line under the value — what the area means, usually. */
|
|
445
|
+
caption?: string;
|
|
446
|
+
/** Trailing slot — a control, a badge, a range picker. */
|
|
447
|
+
children?: ReactNode;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* The strip above the plot: what the chart is of, what it currently reads, and
|
|
451
|
+
* what the size of a circle means.
|
|
452
|
+
*
|
|
453
|
+
* The caption earns its place here more than on most charts. Two axes and an
|
|
454
|
+
* area is three quantities, and a reader who is not told what the area is has
|
|
455
|
+
* no way to work it out from the picture.
|
|
456
|
+
*
|
|
457
|
+
* The value is not derived here. A readout that follows the finger belongs to
|
|
458
|
+
* whoever owns the data — take it from `onActivePointChange` and pass the
|
|
459
|
+
* formatted string down.
|
|
460
|
+
*/
|
|
461
|
+
declare function BubbleChartHeader({ className, title, value, caption, children, ...props }: BubbleChartHeaderProps): import("react").JSX.Element;
|
|
462
|
+
declare namespace BubbleChartHeader {
|
|
463
|
+
var displayName: string;
|
|
464
|
+
var layer: Layer;
|
|
465
|
+
}
|
|
466
|
+
export declare const BubbleChart: import("react").ForwardRefExoticComponent<BubbleChartProps & import("react").RefAttributes<BubbleChartHandle>> & {
|
|
467
|
+
Header: typeof BubbleChartHeader;
|
|
468
|
+
Grid: typeof BubbleChartGrid;
|
|
469
|
+
Quadrants: typeof BubbleChartQuadrants;
|
|
470
|
+
Trend: typeof BubbleChartTrend;
|
|
471
|
+
Bubbles: typeof BubbleChartBubbles;
|
|
472
|
+
Labels: typeof BubbleChartLabels;
|
|
473
|
+
SizeKey: typeof BubbleChartSizeKey;
|
|
474
|
+
Skeleton: typeof BubbleChartSkeleton;
|
|
475
|
+
XAxis: typeof BubbleChartXAxis;
|
|
476
|
+
YAxis: typeof BubbleChartYAxis;
|
|
477
|
+
Tooltip: typeof BubbleChartTooltip;
|
|
478
|
+
Legend: typeof BubbleChartLegend;
|
|
479
|
+
};
|
|
480
|
+
export {};
|
|
481
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/bubble-chart/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBxF,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yCAAsC,CAAC;AAqG9C,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,I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,CAAC;IACnB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,+BA6BxB;kBApCQ,iBAAiB;;;;AAwC1B,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAatB,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeedbackDialog — a dialog whose body is something to write in, and whose
|
|
3
|
+
* actions sit in a band around it.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <FeedbackDialog open={open} onOpenChange={setOpen}>
|
|
7
|
+
* <FeedbackDialog.Content>
|
|
8
|
+
* <FeedbackDialog.Panel>
|
|
9
|
+
* <FeedbackDialog.Title>Help us improve, Gabe!</FeedbackDialog.Title>
|
|
10
|
+
* <FeedbackDialog.Close />
|
|
11
|
+
* <FeedbackDialog.Field value={text} onChangeText={setText} />
|
|
12
|
+
* </FeedbackDialog.Panel>
|
|
13
|
+
* <FeedbackDialog.Footer>
|
|
14
|
+
* <FeedbackDialog.Cancel />
|
|
15
|
+
* <FeedbackDialog.Submit onPress={send} />
|
|
16
|
+
* </FeedbackDialog.Footer>
|
|
17
|
+
* </FeedbackDialog.Content>
|
|
18
|
+
* </FeedbackDialog>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ## Why the panel is a panel and not the dialog
|
|
22
|
+
*
|
|
23
|
+
* A dialog that asks for a sentence has two jobs on screen at once: hold what
|
|
24
|
+
* is being written, and offer the two things to do with it. `Dialog` puts both
|
|
25
|
+
* on one surface, which is right when the body is a line of prose — nothing
|
|
26
|
+
* about it says "this is where you type".
|
|
27
|
+
*
|
|
28
|
+
* Here the writing surface is a well set into the dialog, and the buttons sit
|
|
29
|
+
* in the band around it. The recess is the whole affordance: it says the field
|
|
30
|
+
* is the page and everything else is the frame around it, before a word has
|
|
31
|
+
* been read. It is also why the field has no border of its own — an outline
|
|
32
|
+
* inside a well is two edges saying the same thing.
|
|
33
|
+
*
|
|
34
|
+
* ## The actions are equal, and one of them is not
|
|
35
|
+
*
|
|
36
|
+
* Cancel and Submit take the same width, because they are the same size of
|
|
37
|
+
* decision — this is a sentence somebody wrote, not a deletion. What separates
|
|
38
|
+
* them is weight: Submit is filled in the foreground colour and Cancel is a
|
|
39
|
+
* tint of it, so the difference is legible at a glance without either being
|
|
40
|
+
* hidden.
|
|
41
|
+
*
|
|
42
|
+
* ## Nothing is submitted empty
|
|
43
|
+
*
|
|
44
|
+
* `Submit` disables itself while the field is empty. A dialog that accepts an
|
|
45
|
+
* empty answer produces empty feedback, and the person who sent it believes
|
|
46
|
+
* they said something.
|
|
47
|
+
*/
|
|
48
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
49
|
+
import { TextInput, View, type TextInputProps, type ViewProps } from 'react-native';
|
|
50
|
+
import { type TextProps } from '../../primitives/text.js';
|
|
51
|
+
export interface FeedbackDialogProps {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
/** Controlled open state. */
|
|
54
|
+
open?: boolean;
|
|
55
|
+
onOpenChange?: (open: boolean) => void;
|
|
56
|
+
/** Initial state when uncontrolled. */
|
|
57
|
+
defaultOpen?: boolean;
|
|
58
|
+
/** The message, when the caller holds it. Leave unset to let the field keep it. */
|
|
59
|
+
value?: string;
|
|
60
|
+
/** Starting message for an uncontrolled field. Ignored once `value` is passed. */
|
|
61
|
+
defaultValue?: string;
|
|
62
|
+
onValueChange?: (value: string) => void;
|
|
63
|
+
}
|
|
64
|
+
declare function FeedbackDialogRoot({ children, open, onOpenChange, defaultOpen, value, defaultValue, onValueChange, }: FeedbackDialogProps): import("react").JSX.Element;
|
|
65
|
+
declare namespace FeedbackDialogRoot {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
interface FeedbackDialogTriggerProps {
|
|
69
|
+
children: ReactElement<{
|
|
70
|
+
onPress?: (...args: unknown[]) => void;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
/** Wraps its child and opens the dialog on press. */
|
|
74
|
+
declare function FeedbackDialogTrigger({ children }: FeedbackDialogTriggerProps): import("react").JSX.Element;
|
|
75
|
+
declare namespace FeedbackDialogTrigger {
|
|
76
|
+
var displayName: string;
|
|
77
|
+
}
|
|
78
|
+
export interface FeedbackDialogContentProps extends ViewProps {
|
|
79
|
+
className?: string;
|
|
80
|
+
/** Whether tapping outside or pressing back closes it. */
|
|
81
|
+
dismissible?: boolean;
|
|
82
|
+
/** Frost the screen behind instead of dimming it. Needs `expo-blur`. */
|
|
83
|
+
blur?: boolean;
|
|
84
|
+
children?: ReactNode;
|
|
85
|
+
}
|
|
86
|
+
/** The shell: the recessed band, and everything laid in it. */
|
|
87
|
+
declare function FeedbackDialogContent({ className, dismissible, blur, children, ...props }: FeedbackDialogContentProps): import("react").JSX.Element | null;
|
|
88
|
+
declare namespace FeedbackDialogContent {
|
|
89
|
+
var displayName: string;
|
|
90
|
+
}
|
|
91
|
+
export interface FeedbackDialogPanelProps extends ViewProps {
|
|
92
|
+
className?: string;
|
|
93
|
+
children?: ReactNode;
|
|
94
|
+
}
|
|
95
|
+
export interface FeedbackDialogCloseProps extends ViewProps {
|
|
96
|
+
className?: string;
|
|
97
|
+
/** How the ✕ announces itself. */
|
|
98
|
+
label?: string;
|
|
99
|
+
/** Runs instead of closing. Call `onOpenChange` yourself if you pass this. */
|
|
100
|
+
onPress?: () => void;
|
|
101
|
+
}
|
|
102
|
+
/** The ✕ in the panel's corner. */
|
|
103
|
+
declare function FeedbackDialogClose({ className, label, onPress, ...props }: FeedbackDialogCloseProps): import("react").JSX.Element;
|
|
104
|
+
declare namespace FeedbackDialogClose {
|
|
105
|
+
var displayName: string;
|
|
106
|
+
}
|
|
107
|
+
export interface FeedbackDialogFieldProps extends Omit<TextInputProps, 'value' | 'onChangeText'> {
|
|
108
|
+
className?: string;
|
|
109
|
+
/** The message. Leave unset to let the dialog hold it. */
|
|
110
|
+
value?: string;
|
|
111
|
+
onChangeText?: (value: string) => void;
|
|
112
|
+
/** Room to write in before the field starts growing. */
|
|
113
|
+
minHeight?: number;
|
|
114
|
+
}
|
|
115
|
+
export interface FeedbackDialogFooterProps extends ViewProps {
|
|
116
|
+
className?: string;
|
|
117
|
+
children?: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
export interface FeedbackDialogActionProps extends ViewProps {
|
|
120
|
+
className?: string;
|
|
121
|
+
labelClassName?: string;
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
onPress?: () => void;
|
|
124
|
+
children?: ReactNode;
|
|
125
|
+
}
|
|
126
|
+
/** Discards and closes. Give it `onPress` to do something else first. */
|
|
127
|
+
declare function FeedbackDialogCancel({ children, onPress, ...props }: FeedbackDialogActionProps): import("react").JSX.Element;
|
|
128
|
+
declare namespace FeedbackDialogCancel {
|
|
129
|
+
var displayName: string;
|
|
130
|
+
}
|
|
131
|
+
export interface FeedbackDialogSubmitProps extends FeedbackDialogActionProps {
|
|
132
|
+
/**
|
|
133
|
+
* Hand the message to the caller. The dialog does not close itself here —
|
|
134
|
+
* sending usually has to finish first, and a dialog that closed on the press
|
|
135
|
+
* would take its own error message with it.
|
|
136
|
+
*/
|
|
137
|
+
onSubmit?: (value: string) => void;
|
|
138
|
+
}
|
|
139
|
+
/** Sends. Inert while the field is empty. */
|
|
140
|
+
declare function FeedbackDialogSubmit({ children, disabled, onPress, onSubmit, ...props }: FeedbackDialogSubmitProps): import("react").JSX.Element;
|
|
141
|
+
declare namespace FeedbackDialogSubmit {
|
|
142
|
+
var displayName: string;
|
|
143
|
+
}
|
|
144
|
+
export declare const FeedbackDialog: typeof FeedbackDialogRoot & {
|
|
145
|
+
Trigger: typeof FeedbackDialogTrigger;
|
|
146
|
+
Content: typeof FeedbackDialogContent;
|
|
147
|
+
Panel: import("react").ForwardRefExoticComponent<FeedbackDialogPanelProps & import("react").RefAttributes<View>>;
|
|
148
|
+
Title: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<import("react-native").Text>>;
|
|
149
|
+
Close: typeof FeedbackDialogClose;
|
|
150
|
+
Field: import("react").ForwardRefExoticComponent<FeedbackDialogFieldProps & import("react").RefAttributes<TextInput>>;
|
|
151
|
+
Footer: import("react").ForwardRefExoticComponent<FeedbackDialogFooterProps & import("react").RefAttributes<View>>;
|
|
152
|
+
Cancel: typeof FeedbackDialogCancel;
|
|
153
|
+
Submit: typeof FeedbackDialogSubmit;
|
|
154
|
+
};
|
|
155
|
+
export {};
|
|
156
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback-dialog/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,SAAS,EACT,IAAI,EACJ,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,0BAAuB,CAAC;AAgG3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mFAAmF;IACnF,K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