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,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PyramidChart — two series mirrored about a centre line, drawn and animated on
|
|
3
|
+
* the UI thread.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <PyramidChart data={penguins} xDataKey="species">
|
|
7
|
+
* <PyramidChart.Grid />
|
|
8
|
+
* <PyramidChart.Bar dataKey="male" side="start" />
|
|
9
|
+
* <PyramidChart.Bar dataKey="female" side="end" />
|
|
10
|
+
* <PyramidChart.XAxis />
|
|
11
|
+
* <PyramidChart.YAxis />
|
|
12
|
+
* <PyramidChart.Tooltip />
|
|
13
|
+
* </PyramidChart>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## The two wings share one scale
|
|
17
|
+
*
|
|
18
|
+
* This is the whole contract, and everything else here follows from it. The
|
|
19
|
+
* domain is derived from the larger of the two series' extents and used by
|
|
20
|
+
* both, so a bar twice as long as the one facing it means twice as much.
|
|
21
|
+
* Scaling each side to its own maximum produces a chart whose halves cannot be
|
|
22
|
+
* compared — which is the only thing a pyramid is for.
|
|
23
|
+
*
|
|
24
|
+
* For the same reason the centre is zero and stays there. There is no `yDomain`
|
|
25
|
+
* that starts anywhere else, because a wing cropped at its base is a length
|
|
26
|
+
* that lies.
|
|
27
|
+
*
|
|
28
|
+
* ## Lengths, not signed values
|
|
29
|
+
*
|
|
30
|
+
* Which side a series is on comes from `side`, not from the sign of its
|
|
31
|
+
* numbers, so a value is a distance outward from the centre. A negative one has
|
|
32
|
+
* no direction left to grow in and is drawn as nothing; it still appears in the
|
|
33
|
+
* readout, so a data error shows up as a gap rather than as a bar pointing the
|
|
34
|
+
* wrong way.
|
|
35
|
+
*
|
|
36
|
+
* ## Where the category names go
|
|
37
|
+
*
|
|
38
|
+
* `labelPlacement="above"`, the default, gives each row a line of its own over
|
|
39
|
+
* its pair of bars. That leaves the two wings meeting in the middle with
|
|
40
|
+
* nothing standing between them, and puts the name where it is read before the
|
|
41
|
+
* lengths it belongs to rather than beside them.
|
|
42
|
+
*
|
|
43
|
+
* `"center"` puts the names in a gutter between the wings instead — taken off
|
|
44
|
+
* the bars rather than off the edges, so both wings stay equal — and `"start"`
|
|
45
|
+
* puts them down the left, for a chart with room to spare on that side.
|
|
46
|
+
*
|
|
47
|
+
* ## Every series is one path
|
|
48
|
+
*
|
|
49
|
+
* A `Bar` draws all its rectangles as subpaths of a single animated path, split
|
|
50
|
+
* in two so the row under the finger keeps full ink while the rest fade. Thirty
|
|
51
|
+
* rows is two animated props a frame rather than thirty.
|
|
52
|
+
*/
|
|
53
|
+
import { type ReactNode } from 'react';
|
|
54
|
+
import { type ViewProps } from 'react-native';
|
|
55
|
+
import { type ChartAccessibilityProps } from '../../primitives/chart-accessibility.js';
|
|
56
|
+
import { type SeriesColorIndex } from '../../utils/chart.js';
|
|
57
|
+
type Layer = 'svg' | 'overlay' | 'header';
|
|
58
|
+
export type PyramidChartStatus = 'loading' | 'ready';
|
|
59
|
+
/** Which wing a series grows into. */
|
|
60
|
+
export type PyramidChartSide = 'start' | 'end';
|
|
61
|
+
/** Where the category names sit. */
|
|
62
|
+
export type PyramidChartLabelPlacement = 'above' | 'center' | 'start';
|
|
63
|
+
export type PyramidChartDatum = Record<string, string | number | null | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* The row under the finger, for something rendered *inside* the chart. A
|
|
66
|
+
* readout in the card's header is outside this provider — use
|
|
67
|
+
* `onActiveIndexChange` for that.
|
|
68
|
+
*/
|
|
69
|
+
export declare function usePyramidChart(): {
|
|
70
|
+
activeIndex: number;
|
|
71
|
+
activePoint: PyramidChartDatum | null;
|
|
72
|
+
xDataKey: string;
|
|
73
|
+
};
|
|
74
|
+
export interface PyramidChartProps extends ViewProps, ChartAccessibilityProps<PyramidChartDatum> {
|
|
75
|
+
className?: string;
|
|
76
|
+
/** The rows. Each one is a band across the chart, with a wing either side. */
|
|
77
|
+
data: PyramidChartDatum[];
|
|
78
|
+
/** Key holding the category label. Used by the axis and the readout. */
|
|
79
|
+
xDataKey?: string;
|
|
80
|
+
/**
|
|
81
|
+
* `loading` holds the bars at the centre and grows them out into the real
|
|
82
|
+
* ones when it turns `ready`. One component throughout, rather than a spinner
|
|
83
|
+
* swapped for a chart — swapping loses the transition. Add a
|
|
84
|
+
* `PyramidChart.Skeleton` for something to stand in the plot meanwhile.
|
|
85
|
+
*/
|
|
86
|
+
status?: PyramidChartStatus;
|
|
87
|
+
/** Width ÷ height. `1.2` suits three or four rows in a card. */
|
|
88
|
+
aspectRatio?: number;
|
|
89
|
+
/** Milliseconds for the bars to grow out on mount. */
|
|
90
|
+
animationDuration?: number;
|
|
91
|
+
/** Milliseconds for the scale to settle after the data changes. */
|
|
92
|
+
domainDuration?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Fix the far end of the shared scale instead of deriving it. The near end is
|
|
95
|
+
* zero either way — a pyramid measures outward from its centre.
|
|
96
|
+
*/
|
|
97
|
+
maxValue?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Where the category names sit. `above`, the default, gives each row a line
|
|
100
|
+
* of its own over its pair of bars, so the two wings meet in the middle with
|
|
101
|
+
* nothing standing between them. `center` puts the names in a gutter between
|
|
102
|
+
* the wings instead, and `start` down the left edge.
|
|
103
|
+
*/
|
|
104
|
+
labelPlacement?: PyramidChartLabelPlacement;
|
|
105
|
+
/**
|
|
106
|
+
* Fraction of each band left empty, `0` to `1`. A fraction rather than a
|
|
107
|
+
* pixel gap so the proportions hold at any height.
|
|
108
|
+
*/
|
|
109
|
+
barGap?: number;
|
|
110
|
+
/** Fixed bar thickness in points. Derived from the band when omitted. */
|
|
111
|
+
barWidth?: number;
|
|
112
|
+
/** Corner radius on the outward end of a bar. */
|
|
113
|
+
cornerRadius?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Smallest length a non-zero bar is drawn at, in points. A value that rounds
|
|
116
|
+
* to nothing still happened, and a bar of zero length says it did not.
|
|
117
|
+
*/
|
|
118
|
+
minBarLength?: number;
|
|
119
|
+
/** Opacity of the rows that are not under the finger. */
|
|
120
|
+
fadedOpacity?: number;
|
|
121
|
+
/**
|
|
122
|
+
* The row under the finger as it moves, and `-1`/`null` when it lifts.
|
|
123
|
+
* Fires when the index changes, not per frame.
|
|
124
|
+
*/
|
|
125
|
+
onActiveIndexChange?: (index: number, datum: PyramidChartDatum | null) => void;
|
|
126
|
+
children?: ReactNode;
|
|
127
|
+
}
|
|
128
|
+
/** Imperative handle: re-run the grow-out, for a "replay" control. */
|
|
129
|
+
export interface PyramidChartHandle {
|
|
130
|
+
replay: () => void;
|
|
131
|
+
}
|
|
132
|
+
export interface PyramidChartGridProps {
|
|
133
|
+
/** How many lines to draw per wing, not counting the centre. */
|
|
134
|
+
columns?: number;
|
|
135
|
+
color?: string;
|
|
136
|
+
dashArray?: string;
|
|
137
|
+
opacity?: number;
|
|
138
|
+
/** Draw the solid line down the middle the wings are measured from. */
|
|
139
|
+
centreLine?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Lines up the value axis, mirrored, so a bar can be read against a number
|
|
143
|
+
* rather than only against the bar facing it.
|
|
144
|
+
*
|
|
145
|
+
* The centre line is drawn solid and undashed where the others are dashed: it
|
|
146
|
+
* is not a tick, it is the zero both wings are measured from.
|
|
147
|
+
*/
|
|
148
|
+
declare function PyramidChartGrid({ columns, color, dashArray, opacity, centreLine, }: PyramidChartGridProps): import("react").JSX.Element;
|
|
149
|
+
declare namespace PyramidChartGrid {
|
|
150
|
+
var displayName: string;
|
|
151
|
+
var layer: Layer;
|
|
152
|
+
}
|
|
153
|
+
export interface PyramidChartBarProps {
|
|
154
|
+
/** Column in the data holding this series' values. */
|
|
155
|
+
dataKey: string;
|
|
156
|
+
/** Which wing it grows into. */
|
|
157
|
+
side?: PyramidChartSide;
|
|
158
|
+
/** Explicit colour. Defaults to the `--color-chart-*` token for `colorIndex`. */
|
|
159
|
+
color?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Which of the five chart tokens to take. Defaults to a different one per
|
|
162
|
+
* side, so two bars declared with nothing but a `dataKey` and a `side` are
|
|
163
|
+
* already told apart.
|
|
164
|
+
*/
|
|
165
|
+
colorIndex?: SeriesColorIndex;
|
|
166
|
+
/** Corner radius, overriding the chart's. */
|
|
167
|
+
cornerRadius?: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* One wing.
|
|
171
|
+
*
|
|
172
|
+
* Drawn as two paths rather than one rectangle per row: the row under the
|
|
173
|
+
* finger, and everything else. That is the fewest animated props that can still
|
|
174
|
+
* dim the rest — one path could not, since a path has one opacity, and a view
|
|
175
|
+
* per bar would be one animated prop per bar for the same picture.
|
|
176
|
+
*/
|
|
177
|
+
declare function PyramidChartBar({ dataKey, side, color, colorIndex, cornerRadius, }: PyramidChartBarProps): import("react").JSX.Element;
|
|
178
|
+
declare namespace PyramidChartBar {
|
|
179
|
+
var displayName: string;
|
|
180
|
+
var layer: Layer;
|
|
181
|
+
}
|
|
182
|
+
export interface PyramidChartSkeletonProps {
|
|
183
|
+
/**
|
|
184
|
+
* How many placeholder rows to draw. Defaults to one per row of data, and to
|
|
185
|
+
* five when the data has not arrived — the count is the one thing a loading
|
|
186
|
+
* chart can be honest about only if it already has the rows.
|
|
187
|
+
*/
|
|
188
|
+
rows?: number;
|
|
189
|
+
/** Milliseconds for one pass of the sweep. */
|
|
190
|
+
duration?: number;
|
|
191
|
+
color?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The loading state: equal stubs either side of the centre, with a highlight
|
|
195
|
+
* travelling across them.
|
|
196
|
+
*
|
|
197
|
+
* Equal on purpose. Placeholder wings of differing lengths are a distribution
|
|
198
|
+
* the reader has no way to tell from the real one until it changes under them,
|
|
199
|
+
* so these say only how many rows there will be and where the centre is.
|
|
200
|
+
*/
|
|
201
|
+
declare function PyramidChartSkeleton({ rows, duration, color }: PyramidChartSkeletonProps): import("react").JSX.Element | null;
|
|
202
|
+
declare namespace PyramidChartSkeleton {
|
|
203
|
+
var displayName: string;
|
|
204
|
+
var layer: Layer;
|
|
205
|
+
}
|
|
206
|
+
export interface PyramidChartXAxisProps {
|
|
207
|
+
/** How many labels per wing, not counting the zero in the middle. */
|
|
208
|
+
ticks?: number;
|
|
209
|
+
/** Format a value for its label. Defaults to a compact number. */
|
|
210
|
+
format?: (value: number) => string;
|
|
211
|
+
className?: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The value labels along the bottom, mirrored either side of a zero in the
|
|
215
|
+
* middle — the same magnitudes twice, because both wings are read outward from
|
|
216
|
+
* the centre rather than along one continuous axis.
|
|
217
|
+
*
|
|
218
|
+
* Real text rather than SVG text, so the labels follow the theme's font and the
|
|
219
|
+
* platform's text scaling. SVG text does neither.
|
|
220
|
+
*/
|
|
221
|
+
declare function PyramidChartXAxis({ ticks, format, className }: PyramidChartXAxisProps): import("react").JSX.Element | null;
|
|
222
|
+
declare namespace PyramidChartXAxis {
|
|
223
|
+
var displayName: string;
|
|
224
|
+
var layer: Layer;
|
|
225
|
+
}
|
|
226
|
+
export interface PyramidChartYAxisProps {
|
|
227
|
+
/** Turn a row into its label. Defaults to the value at `xDataKey`. */
|
|
228
|
+
format?: (datum: PyramidChartDatum, index: number) => string;
|
|
229
|
+
className?: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The category names, one per row.
|
|
233
|
+
*
|
|
234
|
+
* `above` puts each name on its own line over the pair of bars it belongs to,
|
|
235
|
+
* which leaves the two wings meeting in the middle — the name is read first and
|
|
236
|
+
* the bars are then read outward from a centre nothing is standing in.
|
|
237
|
+
*
|
|
238
|
+
* One box per band rather than a spaced column, in every placement: a row owns
|
|
239
|
+
* a *band*, so names spread evenly would be half a band out at the top and
|
|
240
|
+
* bottom.
|
|
241
|
+
*/
|
|
242
|
+
declare function PyramidChartYAxis({ format, className }: PyramidChartYAxisProps): import("react").JSX.Element | null;
|
|
243
|
+
declare namespace PyramidChartYAxis {
|
|
244
|
+
var displayName: string;
|
|
245
|
+
var layer: Layer;
|
|
246
|
+
var axis: "y";
|
|
247
|
+
}
|
|
248
|
+
export interface PyramidChartTooltipProps {
|
|
249
|
+
/** Format one series' value. Defaults to a compact number. */
|
|
250
|
+
formatValue?: (value: number, key: string) => string;
|
|
251
|
+
/** Format the readout's heading from the row. Defaults to the value at xDataKey. */
|
|
252
|
+
formatX?: (datum: PyramidChartDatum) => string;
|
|
253
|
+
className?: string;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* The readout, and the gesture that drives it.
|
|
257
|
+
*
|
|
258
|
+
* There is no crosshair. A bar is already the thing being pointed at, so
|
|
259
|
+
* highlighting its row and dimming the rest says the same thing without drawing
|
|
260
|
+
* a line through the chart.
|
|
261
|
+
*
|
|
262
|
+
* The hit area is the whole plot. A readout you have to land on the bar to
|
|
263
|
+
* summon is a readout nobody finds.
|
|
264
|
+
*/
|
|
265
|
+
declare function PyramidChartTooltip({ formatValue, formatX, className, }: PyramidChartTooltipProps): import("react").JSX.Element | null;
|
|
266
|
+
declare namespace PyramidChartTooltip {
|
|
267
|
+
var displayName: string;
|
|
268
|
+
var layer: Layer;
|
|
269
|
+
}
|
|
270
|
+
export interface PyramidChartLegendProps extends ViewProps {
|
|
271
|
+
className?: string;
|
|
272
|
+
/** Prettier names for the series keys. */
|
|
273
|
+
labels?: Record<string, string>;
|
|
274
|
+
}
|
|
275
|
+
/** A swatch and a name per series, in the order the series were declared. */
|
|
276
|
+
declare function PyramidChartLegend({ className, labels, ...props }: PyramidChartLegendProps): import("react").JSX.Element | null;
|
|
277
|
+
declare namespace PyramidChartLegend {
|
|
278
|
+
var displayName: string;
|
|
279
|
+
var layer: Layer;
|
|
280
|
+
}
|
|
281
|
+
export interface PyramidChartHeaderProps extends ViewProps {
|
|
282
|
+
className?: string;
|
|
283
|
+
/** Small line above the value — what the chart is of. */
|
|
284
|
+
title?: string;
|
|
285
|
+
/** The readout. The largest thing on the card, and the first thing read. */
|
|
286
|
+
value?: string;
|
|
287
|
+
/** One muted line under the value — a period, a comparison, a total. */
|
|
288
|
+
caption?: string;
|
|
289
|
+
/** Prettier names for the series keys, as the legend takes. */
|
|
290
|
+
labels?: Record<string, string>;
|
|
291
|
+
/**
|
|
292
|
+
* Draw a swatch and a name per series along the trailing edge. Prefer this to
|
|
293
|
+
* `PyramidChart.Legend` on a chart that has a header: the legend floats over
|
|
294
|
+
* the plot, where it competes with the bars for the same corner.
|
|
295
|
+
*/
|
|
296
|
+
legend?: boolean;
|
|
297
|
+
/** Trailing slot — a control, a badge, a range picker. Wins over `legend`. */
|
|
298
|
+
children?: ReactNode;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The strip above the plot: what the chart is of, what it currently reads, and
|
|
302
|
+
* what the two colours mean.
|
|
303
|
+
*
|
|
304
|
+
* It belongs to the chart rather than to the card around it because it is about
|
|
305
|
+
* the *plot* — the number changes as a finger moves down the rows, and the
|
|
306
|
+
* legend is the series list the chart itself is holding.
|
|
307
|
+
*
|
|
308
|
+
* The value is not derived here. A readout that follows the finger belongs to
|
|
309
|
+
* whoever owns the data — take it from `onActiveIndexChange` and pass the
|
|
310
|
+
* formatted string down.
|
|
311
|
+
*/
|
|
312
|
+
declare function PyramidChartHeader({ className, title, value, caption, labels, legend, children, ...props }: PyramidChartHeaderProps): import("react").JSX.Element;
|
|
313
|
+
declare namespace PyramidChartHeader {
|
|
314
|
+
var displayName: string;
|
|
315
|
+
var layer: Layer;
|
|
316
|
+
}
|
|
317
|
+
export declare const PyramidChart: import("react").ForwardRefExoticComponent<PyramidChartProps & import("react").RefAttributes<PyramidChartHandle>> & {
|
|
318
|
+
Header: typeof PyramidChartHeader;
|
|
319
|
+
Grid: typeof PyramidChartGrid;
|
|
320
|
+
Bar: typeof PyramidChartBar;
|
|
321
|
+
Skeleton: typeof PyramidChartSkeleton;
|
|
322
|
+
XAxis: typeof PyramidChartXAxis;
|
|
323
|
+
YAxis: typeof PyramidChartYAxis;
|
|
324
|
+
Tooltip: typeof PyramidChartTooltip;
|
|
325
|
+
Legend: typeof PyramidChartLegend;
|
|
326
|
+
};
|
|
327
|
+
export {};
|
|
328
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/pyramid-chart/index.tsx"],"names":[],"mappings":"AAAA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
|
+
/**
|
|
2
|
+
* ScrollBlur — blurs the edges of a scroll container.
|
|
3
|
+
*
|
|
4
|
+
* Content that runs past a boundary reads better receding than being cut off,
|
|
5
|
+
* and a receding edge doubles as an affordance: an edge that is going soft is
|
|
6
|
+
* an edge with more content behind it.
|
|
7
|
+
*
|
|
8
|
+
* A blur says that where a fade cannot: a fade takes the content towards the
|
|
9
|
+
* colour behind the scroller, so it only works where that colour is known and
|
|
10
|
+
* flat. A blur takes it out of focus instead, which is true over a photograph,
|
|
11
|
+
* a gradient, or a list of coloured cards. It is also what belongs under
|
|
12
|
+
* something laid *over* the scroller — a button, a header, a search field —
|
|
13
|
+
* because the content passing beneath stays visible as shape and colour while
|
|
14
|
+
* losing the detail that would compete with the thing on top.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <ScrollBlur>
|
|
18
|
+
* <ScrollView>…</ScrollView>
|
|
19
|
+
* </ScrollBlur>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ## The ramp is a stack and a wash, because neither alone is smooth
|
|
23
|
+
*
|
|
24
|
+
* A blur that goes from nothing to full across a band needs a per-pixel blur
|
|
25
|
+
* radius, and there is no such thing on either platform — a blur view has one
|
|
26
|
+
* strength for its whole rectangle.
|
|
27
|
+
*
|
|
28
|
+
* So the ramp is built out of several of them: each layer covers a shorter
|
|
29
|
+
* span than the last, measured from the edge, and each blurs what the layer
|
|
30
|
+
* under it has already blurred. The spans are spaced on a curve rather than
|
|
31
|
+
* evenly, which puts most of the layers in the outer third where the blur is
|
|
32
|
+
* changing fastest and the steps would otherwise be widest.
|
|
33
|
+
*
|
|
34
|
+
* That alone is not enough. Every layer has a hard edge, and a stack of hard
|
|
35
|
+
* edges is a stack of visible lines however many there are. So a gradient of
|
|
36
|
+
* `color` is washed over the top — opaque at the outer edge, clear at the
|
|
37
|
+
* inner one. It hides the seams, and it is what makes the band read as one
|
|
38
|
+
* material rather than as a pile of rectangles: the content goes soft and
|
|
39
|
+
* fades into the surface at the same time, which is what the eye expects an
|
|
40
|
+
* edge to do.
|
|
41
|
+
*
|
|
42
|
+
* That wash is why `color` matters even when the blur is drawn. Give it the
|
|
43
|
+
* surface the scrollable actually sits on — a sheet, a card, the page — or the
|
|
44
|
+
* band fades towards a colour that is not there.
|
|
45
|
+
*
|
|
46
|
+
* ## Where it cannot blur, it fades
|
|
47
|
+
*
|
|
48
|
+
* A real blur needs a native view. `expo-blur` is optional, and Reduce
|
|
49
|
+
* Transparency is a preference that outranks the design, so both cases fall
|
|
50
|
+
* back to a gradient towards `color` — the same thing `ScrollFade` draws. A
|
|
51
|
+
* blur you cannot draw is better shown as a fade than as a hard edge, and far
|
|
52
|
+
* better than as a crash.
|
|
53
|
+
*
|
|
54
|
+
* Because of that fallback, pass `color` whenever the scroller does not sit on
|
|
55
|
+
* the theme background. It is unused in the blurred case and the whole effect
|
|
56
|
+
* in the other one.
|
|
57
|
+
*
|
|
58
|
+
* Scroll position, content size and viewport size are held in shared values
|
|
59
|
+
* and read on the UI thread, so scrolling never re-renders React.
|
|
60
|
+
*/
|
|
61
|
+
import { type ReactNode } from 'react';
|
|
62
|
+
import { type ViewProps } from 'react-native';
|
|
63
|
+
/** Which way the material tints. `default` follows the app's theme. */
|
|
64
|
+
export type ScrollBlurTint = 'light' | 'dark' | 'default';
|
|
65
|
+
export interface ScrollBlurProps extends ViewProps {
|
|
66
|
+
className?: string;
|
|
67
|
+
/** Depth of the blurred band in pixels. */
|
|
68
|
+
size?: number;
|
|
69
|
+
/** Which edges blur. */
|
|
70
|
+
edges?: 'both' | 'start' | 'end' | 'none';
|
|
71
|
+
/**
|
|
72
|
+
* Scroll axis. Inferred from the child's `horizontal` prop when omitted —
|
|
73
|
+
* pass it explicitly for children that scroll horizontally without that prop
|
|
74
|
+
* (a `FlatList` with `horizontal` set through `contentContainerStyle`, say).
|
|
75
|
+
*/
|
|
76
|
+
orientation?: 'horizontal' | 'vertical';
|
|
77
|
+
/**
|
|
78
|
+
* How many blur views make up the ramp. More is smoother and costs more; the
|
|
79
|
+
* band shows visible steps below four, and past eight nobody can tell.
|
|
80
|
+
*/
|
|
81
|
+
layers?: number;
|
|
82
|
+
/** Blur strength at the very edge, 0–100. The layers share it between them. */
|
|
83
|
+
intensity?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Which way the material tints. Defaults to the app's theme rather than the
|
|
86
|
+
* phone's, so an app running dark on a light phone does not blur light.
|
|
87
|
+
*/
|
|
88
|
+
material?: ScrollBlurTint;
|
|
89
|
+
/**
|
|
90
|
+
* The colour the band fades towards — washed over the blur, and the whole
|
|
91
|
+
* effect where there is no blur to draw.
|
|
92
|
+
*
|
|
93
|
+
* Defaults to the theme's background. Pass the surface the scrollable
|
|
94
|
+
* actually sits on, or the band fades towards a colour that is not there.
|
|
95
|
+
*/
|
|
96
|
+
color?: string;
|
|
97
|
+
/**
|
|
98
|
+
* How opaque that wash gets at the outer edge, 0 to 1. Lower it to let more
|
|
99
|
+
* of the content show through the far end of the band; `0` leaves the blur
|
|
100
|
+
* bare, along with the seams between its layers.
|
|
101
|
+
*/
|
|
102
|
+
tint?: number;
|
|
103
|
+
/** Distance in pixels over which an edge comes in from clear to full. */
|
|
104
|
+
fadeInDistance?: number;
|
|
105
|
+
/** Set false to render the child with no bands at all. */
|
|
106
|
+
enabled?: boolean;
|
|
107
|
+
children?: ReactNode;
|
|
108
|
+
}
|
|
109
|
+
export declare function ScrollBlur({ className, size, edges, orientation, layers, intensity, material, tint, color, fadeInDistance, enabled, children, ...props }: ScrollBlurProps): import("react").JSX.Element;
|
|
110
|
+
export declare namespace ScrollBlur {
|
|
111
|
+
var displayName: string;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/scroll-blur/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAqCtB,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAUD,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,IAAS,EACT,KAAc,EACd,WAAW,EACX,MAAU,EACV,SAAc,EACd,QAAoB,EACpB,IAAW,EACX,KAAK,EACL,cAAyC,EACzC,OAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,+BA0HjB;yBAxIe,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/scroll-canvas/index.tsx"],"names":[],"mappings":"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