panelui-native 0.87.0 → 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/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 +557 -41
- package/lib/module/components/bubble-chart/index.js.map +1 -1
- 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/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 +390 -45
- 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 +3 -0
- package/lib/module/index.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 +150 -7
- package/lib/typescript/src/components/bubble-chart/index.d.ts.map +1 -1
- 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/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 +142 -7
- 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 +5 -2
- package/lib/typescript/src/index.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 +664 -46
- package/src/components/feedback-dialog/index.tsx +557 -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 +471 -41
- package/src/hooks/use-keyboard-avoidance.ts +24 -1
- package/src/hooks/use-reveal-progress.ts +30 -1
- package/src/index.ts +27 -0
|
@@ -127,19 +127,70 @@ export interface BubbleChartHandle {
|
|
|
127
127
|
replay: () => void;
|
|
128
128
|
}
|
|
129
129
|
export interface BubbleChartGridProps {
|
|
130
|
-
/**
|
|
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
|
+
*/
|
|
131
139
|
rows?: number;
|
|
132
140
|
/** Vertical rules up it. Both axes are measured, so both earn lines. */
|
|
133
141
|
columns?: number;
|
|
142
|
+
/** Dash pattern for the rules. Pass `undefined` for solid ones. */
|
|
143
|
+
dashArray?: string;
|
|
134
144
|
color?: string;
|
|
135
145
|
opacity?: number;
|
|
136
146
|
}
|
|
137
147
|
/** Reference lines both ways, so a bubble can be placed against two numbers. */
|
|
138
|
-
declare function BubbleChartGrid({ rows, columns, color, opacity, }: BubbleChartGridProps): import("react").JSX.Element;
|
|
148
|
+
declare function BubbleChartGrid({ rows, columns, dashArray, color, opacity, }: BubbleChartGridProps): import("react").JSX.Element;
|
|
139
149
|
declare namespace BubbleChartGrid {
|
|
140
150
|
var displayName: string;
|
|
141
151
|
var layer: Layer;
|
|
142
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
|
+
}
|
|
143
194
|
export interface BubbleChartBubblesProps {
|
|
144
195
|
/**
|
|
145
196
|
* Fill opacity. Below 1 by default so that overlapping bubbles read as
|
|
@@ -206,11 +257,86 @@ declare namespace BubbleChartLabels {
|
|
|
206
257
|
var displayName: string;
|
|
207
258
|
var layer: Layer;
|
|
208
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
|
+
}
|
|
209
327
|
export interface BubbleChartXAxisProps {
|
|
210
|
-
/**
|
|
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
|
+
*/
|
|
211
335
|
ticks?: number;
|
|
212
336
|
/** Turn a value into its label. Defaults to a compact number. */
|
|
213
337
|
format?: (value: number) => string;
|
|
338
|
+
/** What the axis measures, written under the numbers. */
|
|
339
|
+
label?: string;
|
|
214
340
|
className?: string;
|
|
215
341
|
}
|
|
216
342
|
/**
|
|
@@ -219,20 +345,34 @@ export interface BubbleChartXAxisProps {
|
|
|
219
345
|
* Evenly spaced, because this axis is a continuous scale rather than a list of
|
|
220
346
|
* rows. There is no bubble for a label to sit under.
|
|
221
347
|
*/
|
|
222
|
-
declare function BubbleChartXAxis({ ticks, format, className }: BubbleChartXAxisProps): import("react").JSX.Element;
|
|
348
|
+
declare function BubbleChartXAxis({ ticks, format, label, className }: BubbleChartXAxisProps): import("react").JSX.Element;
|
|
223
349
|
declare namespace BubbleChartXAxis {
|
|
224
350
|
var displayName: string;
|
|
225
351
|
var layer: Layer;
|
|
352
|
+
var axis: "x";
|
|
226
353
|
}
|
|
227
354
|
export interface BubbleChartYAxisProps {
|
|
228
|
-
/**
|
|
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
|
+
*/
|
|
229
361
|
ticks?: number;
|
|
230
362
|
/** Turn a value into its label. Defaults to a compact number. */
|
|
231
363
|
format?: (value: number) => string;
|
|
364
|
+
/** What the axis measures, written up the side of it. */
|
|
365
|
+
label?: string;
|
|
232
366
|
className?: string;
|
|
233
367
|
}
|
|
234
|
-
/**
|
|
235
|
-
|
|
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;
|
|
236
376
|
declare namespace BubbleChartYAxis {
|
|
237
377
|
var displayName: string;
|
|
238
378
|
var layer: Layer;
|
|
@@ -326,8 +466,11 @@ declare namespace BubbleChartHeader {
|
|
|
326
466
|
export declare const BubbleChart: import("react").ForwardRefExoticComponent<BubbleChartProps & import("react").RefAttributes<BubbleChartHandle>> & {
|
|
327
467
|
Header: typeof BubbleChartHeader;
|
|
328
468
|
Grid: typeof BubbleChartGrid;
|
|
469
|
+
Quadrants: typeof BubbleChartQuadrants;
|
|
470
|
+
Trend: typeof BubbleChartTrend;
|
|
329
471
|
Bubbles: typeof BubbleChartBubbles;
|
|
330
472
|
Labels: typeof BubbleChartLabels;
|
|
473
|
+
SizeKey: typeof BubbleChartSizeKey;
|
|
331
474
|
Skeleton: typeof BubbleChartSkeleton;
|
|
332
475
|
XAxis: typeof BubbleChartXAxis;
|
|
333
476
|
YAxis: typeof BubbleChartYAxis;
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.d.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GAeG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,SAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAsB,EACtB,SAAS,GACV,EAAE,uBAAuB,sCAmNzB;kBA1NQ,kBAAkB;;;;AA8N3B,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,KAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,sCA2BpF;kBA3BQ,iBAAiB;;;;AAmC1B,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,SAAS,CAAC,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;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OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA+BD,yEAAyE;AACzE,iBAAS,oBAAoB,CAAC,EAC5B,QAAmB,EACnB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAO3B;kBAXQ,oBAAoB;;;AAc7B,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC5B,QAAmB,EACnB,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAkB3B;kBAxBQ,oBAAoB;;;AA2B7B,eAAO,MAAM,cAAc;;;;;;;;;;CAUzB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
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":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAe,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACrF,OAAiB,EAIf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAkBjC,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7E,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,iDAAiD;IACjD,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,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