panelui-native 0.14.0 → 0.19.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 +2 -0
- package/lib/module/components/bottom-sheet/index.js +38 -10
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/checkbox/index.js +24 -11
- package/lib/module/components/checkbox/index.js.map +1 -1
- package/lib/module/components/direction/index.js +86 -0
- package/lib/module/components/direction/index.js.map +1 -0
- package/lib/module/components/field/index.js +337 -0
- package/lib/module/components/field/index.js.map +1 -0
- package/lib/module/components/flow/flow-paths.js +378 -0
- package/lib/module/components/flow/flow-paths.js.map +1 -0
- package/lib/module/components/flow/index.js +1598 -0
- package/lib/module/components/flow/index.js.map +1 -0
- package/lib/module/components/form/index.js +77 -0
- package/lib/module/components/form/index.js.map +1 -0
- package/lib/module/components/form/use-field.js +50 -0
- package/lib/module/components/form/use-field.js.map +1 -0
- package/lib/module/components/form/use-form.js +217 -0
- package/lib/module/components/form/use-form.js.map +1 -0
- package/lib/module/components/frame/index.js +124 -22
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/message/index.js +16 -1
- package/lib/module/components/message/index.js.map +1 -1
- package/lib/module/components/otp-input/index.js +303 -0
- package/lib/module/components/otp-input/index.js.map +1 -0
- package/lib/module/components/signature/index.js +500 -0
- package/lib/module/components/signature/index.js.map +1 -0
- package/lib/module/components/soundwave/index.js +813 -0
- package/lib/module/components/soundwave/index.js.map +1 -0
- package/lib/module/components/typography/index.js +196 -5
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/icons/index.js +287 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +8 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +15 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/checkbox/index.d.ts +8 -0
- package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/direction/index.d.ts +64 -0
- package/lib/typescript/src/components/direction/index.d.ts.map +1 -0
- package/lib/typescript/src/components/field/index.d.ts +94 -0
- package/lib/typescript/src/components/field/index.d.ts.map +1 -0
- package/lib/typescript/src/components/flow/flow-paths.d.ts +89 -0
- package/lib/typescript/src/components/flow/flow-paths.d.ts.map +1 -0
- package/lib/typescript/src/components/flow/index.d.ts +310 -0
- package/lib/typescript/src/components/flow/index.d.ts.map +1 -0
- package/lib/typescript/src/components/form/index.d.ts +64 -0
- package/lib/typescript/src/components/form/index.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-field.d.ts +16 -0
- package/lib/typescript/src/components/form/use-field.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-form.d.ts +37 -0
- package/lib/typescript/src/components/form/use-form.d.ts.map +1 -0
- package/lib/typescript/src/components/frame/index.d.ts +39 -2
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message/index.d.ts.map +1 -1
- package/lib/typescript/src/components/otp-input/index.d.ts +141 -0
- package/lib/typescript/src/components/otp-input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/signature/index.d.ts +254 -0
- package/lib/typescript/src/components/signature/index.d.ts.map +1 -0
- package/lib/typescript/src/components/soundwave/index.d.ts +91 -0
- package/lib/typescript/src/components/soundwave/index.d.ts.map +1 -0
- package/lib/typescript/src/components/typography/index.d.ts +154 -1
- package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/src/icons/index.d.ts +23 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +9 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +9 -1
- package/src/components/bottom-sheet/index.tsx +50 -12
- package/src/components/checkbox/index.tsx +40 -12
- package/src/components/direction/index.tsx +90 -0
- package/src/components/field/index.tsx +329 -0
- package/src/components/flow/flow-paths.ts +348 -0
- package/src/components/flow/index.tsx +1924 -0
- package/src/components/form/index.tsx +85 -0
- package/src/components/form/use-field.ts +65 -0
- package/src/components/form/use-form.ts +252 -0
- package/src/components/frame/index.tsx +162 -14
- package/src/components/message/index.tsx +17 -1
- package/src/components/otp-input/index.tsx +396 -0
- package/src/components/signature/index.tsx +681 -0
- package/src/components/soundwave/index.tsx +1029 -0
- package/src/components/typography/index.tsx +231 -10
- package/src/icons/index.tsx +195 -0
- package/src/index.ts +87 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { TextInput, type TextInputProps } from 'react-native';
|
|
2
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
+
declare const otpVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
size: {
|
|
5
|
+
sm: {
|
|
6
|
+
cell: string;
|
|
7
|
+
char: string;
|
|
8
|
+
caret: string;
|
|
9
|
+
separator: string;
|
|
10
|
+
};
|
|
11
|
+
md: {
|
|
12
|
+
cell: string;
|
|
13
|
+
char: string;
|
|
14
|
+
caret: string;
|
|
15
|
+
separator: string;
|
|
16
|
+
};
|
|
17
|
+
lg: {
|
|
18
|
+
cell: string;
|
|
19
|
+
char: string;
|
|
20
|
+
caret: string;
|
|
21
|
+
separator: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
disabled: {
|
|
25
|
+
true: {
|
|
26
|
+
row: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
container: string;
|
|
31
|
+
row: string;
|
|
32
|
+
cell: string;
|
|
33
|
+
char: string;
|
|
34
|
+
caret: string;
|
|
35
|
+
separator: string;
|
|
36
|
+
error: string;
|
|
37
|
+
}, undefined, {
|
|
38
|
+
size: {
|
|
39
|
+
sm: {
|
|
40
|
+
cell: string;
|
|
41
|
+
char: string;
|
|
42
|
+
caret: string;
|
|
43
|
+
separator: string;
|
|
44
|
+
};
|
|
45
|
+
md: {
|
|
46
|
+
cell: string;
|
|
47
|
+
char: string;
|
|
48
|
+
caret: string;
|
|
49
|
+
separator: string;
|
|
50
|
+
};
|
|
51
|
+
lg: {
|
|
52
|
+
cell: string;
|
|
53
|
+
char: string;
|
|
54
|
+
caret: string;
|
|
55
|
+
separator: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
disabled: {
|
|
59
|
+
true: {
|
|
60
|
+
row: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
container: string;
|
|
65
|
+
row: string;
|
|
66
|
+
cell: string;
|
|
67
|
+
char: string;
|
|
68
|
+
caret: string;
|
|
69
|
+
separator: string;
|
|
70
|
+
error: string;
|
|
71
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
72
|
+
size: {
|
|
73
|
+
sm: {
|
|
74
|
+
cell: string;
|
|
75
|
+
char: string;
|
|
76
|
+
caret: string;
|
|
77
|
+
separator: string;
|
|
78
|
+
};
|
|
79
|
+
md: {
|
|
80
|
+
cell: string;
|
|
81
|
+
char: string;
|
|
82
|
+
caret: string;
|
|
83
|
+
separator: string;
|
|
84
|
+
};
|
|
85
|
+
lg: {
|
|
86
|
+
cell: string;
|
|
87
|
+
char: string;
|
|
88
|
+
caret: string;
|
|
89
|
+
separator: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
disabled: {
|
|
93
|
+
true: {
|
|
94
|
+
row: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
container: string;
|
|
99
|
+
row: string;
|
|
100
|
+
cell: string;
|
|
101
|
+
char: string;
|
|
102
|
+
caret: string;
|
|
103
|
+
separator: string;
|
|
104
|
+
error: string;
|
|
105
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
106
|
+
type OtpVariantProps = VariantProps<typeof otpVariants>;
|
|
107
|
+
export interface OtpInputProps extends Omit<TextInputProps, 'value' | 'defaultValue' | 'onChangeText' | 'maxLength' | 'children'>, Omit<OtpVariantProps, 'disabled'> {
|
|
108
|
+
className?: string;
|
|
109
|
+
/** Class applied to every cell — for a taller box or a different radius. */
|
|
110
|
+
cellClassName?: string;
|
|
111
|
+
/** How many cells, i.e. the length of the code. */
|
|
112
|
+
length?: number;
|
|
113
|
+
/** Controlled value. Longer strings and stray characters are trimmed to fit. */
|
|
114
|
+
value?: string;
|
|
115
|
+
/** Starting value when the field manages its own state. */
|
|
116
|
+
defaultValue?: string;
|
|
117
|
+
onChangeText?: (value: string) => void;
|
|
118
|
+
/** Fires once, the moment the last cell is filled. */
|
|
119
|
+
onComplete?: (value: string) => void;
|
|
120
|
+
/**
|
|
121
|
+
* What the keyboard offers and what the field accepts. `numeric` keeps
|
|
122
|
+
* digits only and asks for the number pad; `text` accepts any character.
|
|
123
|
+
*/
|
|
124
|
+
type?: 'numeric' | 'text';
|
|
125
|
+
/** Hide each filled character behind a dot, the way a passcode field does. */
|
|
126
|
+
mask?: boolean;
|
|
127
|
+
/** A single character shown, dimmed, in every cell still waiting for input. */
|
|
128
|
+
placeholder?: string;
|
|
129
|
+
/** Draw a separator between groups of this many cells — 3 gives `xxx — xxx`. */
|
|
130
|
+
groupEvery?: number;
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
/** Tint the field in its error colour and announce it as invalid. */
|
|
133
|
+
isInvalid?: boolean;
|
|
134
|
+
/** Error line under the field. Setting it also puts the field in its invalid state. */
|
|
135
|
+
errorMessage?: string;
|
|
136
|
+
/** Announced by a screen reader as the field's name. */
|
|
137
|
+
accessibilityLabel?: string;
|
|
138
|
+
}
|
|
139
|
+
export declare const OtpInput: import("react").ForwardRefExoticComponent<OtpInputProps & import("react").RefAttributes<TextInput>>;
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/otp-input/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAa,SAAS,EAAQ,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAW/E,OA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AO,MAAM,QAAQ,qGAqKpB,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signature — a surface you sign with a finger, and a handle for getting the
|
|
3
|
+
* result back out.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* const pad = useRef<SignatureHandle>(null);
|
|
7
|
+
*
|
|
8
|
+
* <Signature ref={pad} guideline />
|
|
9
|
+
* <Button onPress={() => pad.current?.save({ filename: 'agreement' })}>
|
|
10
|
+
* Finish signing
|
|
11
|
+
* </Button>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## Why the stroke never reaches React
|
|
15
|
+
*
|
|
16
|
+
* A finger produces touch events far faster than a component tree can usefully
|
|
17
|
+
* re-render, and a signature is exactly the case where the lag shows: the line
|
|
18
|
+
* trails the fingertip and the whole thing feels like drawing through syrup.
|
|
19
|
+
*
|
|
20
|
+
* So the stroke being drawn lives in a shared value and is turned into an SVG
|
|
21
|
+
* `d` string by a worklet on the UI thread — React is not involved in a single
|
|
22
|
+
* frame of it. When the finger lifts, that one finished string crosses to
|
|
23
|
+
* JavaScript once and becomes a static path. Committed strokes are ordinary
|
|
24
|
+
* elements that never animate again, so the hundredth stroke costs what the
|
|
25
|
+
* first one did.
|
|
26
|
+
*
|
|
27
|
+
* Points closer together than `minDistance` are dropped as they arrive. A slow
|
|
28
|
+
* finger otherwise emits a point per frame in the same spot, which is a longer
|
|
29
|
+
* path describing the same shape.
|
|
30
|
+
*
|
|
31
|
+
* ## Smoothing
|
|
32
|
+
*
|
|
33
|
+
* Raw touch points joined with straight lines look like a seismograph. Each
|
|
34
|
+
* segment is drawn as a quadratic curve through the midpoint between two
|
|
35
|
+
* points instead — the point itself becomes the control handle, the midpoints
|
|
36
|
+
* become the anchors, and consecutive curves meet with a shared tangent. It
|
|
37
|
+
* needs no lookahead, so a point can be appended to a stroke already on screen
|
|
38
|
+
* without redrawing what came before it differently.
|
|
39
|
+
*
|
|
40
|
+
* ## Getting it out
|
|
41
|
+
*
|
|
42
|
+
* `toSVG()` is pure string building and always works. Writing a file needs
|
|
43
|
+
* `expo-file-system`, and rasterising to PNG needs `react-native-view-shot` as
|
|
44
|
+
* well; both are optional and both are resolved lazily, so a project that only
|
|
45
|
+
* ever reads the SVG installs neither. Asking for something the missing
|
|
46
|
+
* package provides throws with its name in the message rather than failing
|
|
47
|
+
* somewhere further down.
|
|
48
|
+
*/
|
|
49
|
+
import { type ReactNode } from 'react';
|
|
50
|
+
import { type ViewProps } from 'react-native';
|
|
51
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
52
|
+
import { type AnimatedPressableProps } from '../../primitives/animated-pressable.js';
|
|
53
|
+
/** True when a signature can be written to a file. */
|
|
54
|
+
export declare const hasSignatureFileSystem: boolean;
|
|
55
|
+
/** True when a signature can be rasterised to PNG. */
|
|
56
|
+
export declare const hasSignatureRaster: boolean;
|
|
57
|
+
declare const signatureVariants: import("tailwind-variants").TVReturnType<{
|
|
58
|
+
size: {
|
|
59
|
+
sm: {
|
|
60
|
+
root: string;
|
|
61
|
+
};
|
|
62
|
+
md: {
|
|
63
|
+
root: string;
|
|
64
|
+
};
|
|
65
|
+
lg: {
|
|
66
|
+
root: string;
|
|
67
|
+
};
|
|
68
|
+
/** Fills whatever it is given — for a full-screen signing surface. */
|
|
69
|
+
full: {
|
|
70
|
+
root: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
disabled: {
|
|
74
|
+
true: {
|
|
75
|
+
root: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
root: string;
|
|
80
|
+
pad: string;
|
|
81
|
+
placeholder: string;
|
|
82
|
+
guide: string;
|
|
83
|
+
toolbar: string;
|
|
84
|
+
}, undefined, {
|
|
85
|
+
size: {
|
|
86
|
+
sm: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
md: {
|
|
90
|
+
root: string;
|
|
91
|
+
};
|
|
92
|
+
lg: {
|
|
93
|
+
root: string;
|
|
94
|
+
};
|
|
95
|
+
/** Fills whatever it is given — for a full-screen signing surface. */
|
|
96
|
+
full: {
|
|
97
|
+
root: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
disabled: {
|
|
101
|
+
true: {
|
|
102
|
+
root: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
106
|
+
root: string;
|
|
107
|
+
pad: string;
|
|
108
|
+
placeholder: string;
|
|
109
|
+
guide: string;
|
|
110
|
+
toolbar: string;
|
|
111
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
112
|
+
size: {
|
|
113
|
+
sm: {
|
|
114
|
+
root: string;
|
|
115
|
+
};
|
|
116
|
+
md: {
|
|
117
|
+
root: string;
|
|
118
|
+
};
|
|
119
|
+
lg: {
|
|
120
|
+
root: string;
|
|
121
|
+
};
|
|
122
|
+
/** Fills whatever it is given — for a full-screen signing surface. */
|
|
123
|
+
full: {
|
|
124
|
+
root: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
disabled: {
|
|
128
|
+
true: {
|
|
129
|
+
root: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}, {
|
|
133
|
+
root: string;
|
|
134
|
+
pad: string;
|
|
135
|
+
placeholder: string;
|
|
136
|
+
guide: string;
|
|
137
|
+
toolbar: string;
|
|
138
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
139
|
+
type SignatureVariantProps = VariantProps<typeof signatureVariants>;
|
|
140
|
+
export interface SignatureProps extends Omit<ViewProps, 'children'>, Omit<SignatureVariantProps, 'disabled'> {
|
|
141
|
+
className?: string;
|
|
142
|
+
/** How tall the pad is. `full` fills its parent instead. */
|
|
143
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
144
|
+
/** Ink colour. Defaults to the theme's foreground. */
|
|
145
|
+
strokeColor?: string;
|
|
146
|
+
/** Ink width in points. */
|
|
147
|
+
strokeWidth?: number;
|
|
148
|
+
/**
|
|
149
|
+
* Points closer together than this are dropped as they arrive, so a finger
|
|
150
|
+
* resting still does not add hundreds of points describing one spot.
|
|
151
|
+
*/
|
|
152
|
+
minDistance?: number;
|
|
153
|
+
/** Draw the baseline and its ✕ mark, the way a paper form does. */
|
|
154
|
+
guideline?: boolean;
|
|
155
|
+
/** Caption beside the baseline. Only shown with `guideline`. */
|
|
156
|
+
guidelineLabel?: string;
|
|
157
|
+
/** Prompt shown over an empty pad. Pass `null` for none. */
|
|
158
|
+
placeholder?: ReactNode;
|
|
159
|
+
/** Take no input. The strokes already there stay visible. */
|
|
160
|
+
disabled?: boolean;
|
|
161
|
+
/** A stroke has started. */
|
|
162
|
+
onBegin?: () => void;
|
|
163
|
+
/** A stroke has finished. */
|
|
164
|
+
onEnd?: () => void;
|
|
165
|
+
/**
|
|
166
|
+
* The number of committed strokes changed — by drawing, undoing, redoing or
|
|
167
|
+
* clearing. The cheap way to enable a Save button only once something is
|
|
168
|
+
* there to save.
|
|
169
|
+
*/
|
|
170
|
+
onChange?: (strokeCount: number) => void;
|
|
171
|
+
/** Class on the drawing surface inside the border. */
|
|
172
|
+
padClassName?: string;
|
|
173
|
+
/** Class on the empty-pad prompt. */
|
|
174
|
+
placeholderClassName?: string;
|
|
175
|
+
/** Class on the baseline. */
|
|
176
|
+
guideClassName?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface SignatureSaveOptions {
|
|
179
|
+
/**
|
|
180
|
+
* Directory to write into, as a `file://` URI. Defaults to the app's own
|
|
181
|
+
* document directory, which survives restarts and is not visible to the user.
|
|
182
|
+
*/
|
|
183
|
+
directory?: string;
|
|
184
|
+
/** Filename without an extension. Defaults to `signature-<timestamp>`. */
|
|
185
|
+
filename?: string;
|
|
186
|
+
/** `svg` needs no extra packages; `png` rasterises the pad. */
|
|
187
|
+
format?: 'svg' | 'png';
|
|
188
|
+
/** PNG only — pixels per point. Higher is sharper and larger. */
|
|
189
|
+
scale?: number;
|
|
190
|
+
}
|
|
191
|
+
export interface SignatureFile {
|
|
192
|
+
/** Where it was written, as a `file://` URI. */
|
|
193
|
+
uri: string;
|
|
194
|
+
format: 'svg' | 'png';
|
|
195
|
+
/** The pad's size in points, which is the SVG's coordinate space. */
|
|
196
|
+
width: number;
|
|
197
|
+
height: number;
|
|
198
|
+
}
|
|
199
|
+
export interface SignatureHandle {
|
|
200
|
+
/** Drop every stroke. */
|
|
201
|
+
clear(): void;
|
|
202
|
+
/** Remove the last stroke. Repeatable down to empty. */
|
|
203
|
+
undo(): void;
|
|
204
|
+
/** Put back the last undone stroke. Drawing again discards the redo stack. */
|
|
205
|
+
redo(): void;
|
|
206
|
+
/** True until the first stroke lands. */
|
|
207
|
+
isEmpty(): boolean;
|
|
208
|
+
/** How many strokes are on the pad. */
|
|
209
|
+
strokeCount(): number;
|
|
210
|
+
/**
|
|
211
|
+
* The signature as a standalone SVG document, sized to the pad. Pure string
|
|
212
|
+
* building — no optional package, no async, safe to call every render.
|
|
213
|
+
*/
|
|
214
|
+
toSVG(): string;
|
|
215
|
+
/**
|
|
216
|
+
* A `data:` URI. `svg` is always available; `png` needs
|
|
217
|
+
* `react-native-view-shot` and throws by name without it.
|
|
218
|
+
*/
|
|
219
|
+
toDataURL(format?: 'svg' | 'png'): Promise<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Write the signature to a file and resolve where it went. Needs
|
|
222
|
+
* `expo-file-system`, plus `react-native-view-shot` for `png`.
|
|
223
|
+
*/
|
|
224
|
+
save(options?: SignatureSaveOptions): Promise<SignatureFile>;
|
|
225
|
+
}
|
|
226
|
+
export interface SignatureToolbarProps extends ViewProps {
|
|
227
|
+
className?: string;
|
|
228
|
+
children?: ReactNode;
|
|
229
|
+
}
|
|
230
|
+
/** A row of controls under or over the pad. Purely layout. */
|
|
231
|
+
declare function SignatureToolbar({ className, ...props }: SignatureToolbarProps): import("react").JSX.Element;
|
|
232
|
+
declare namespace SignatureToolbar {
|
|
233
|
+
var displayName: string;
|
|
234
|
+
}
|
|
235
|
+
export interface SignatureButtonProps extends Omit<AnimatedPressableProps, 'children'> {
|
|
236
|
+
className?: string;
|
|
237
|
+
/** Take no input, and dim to say so. */
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
/** Replaces the default icon. */
|
|
240
|
+
children?: ReactNode;
|
|
241
|
+
}
|
|
242
|
+
export declare const Signature: import("react").ForwardRefExoticComponent<SignatureProps & import("react").RefAttributes<SignatureHandle>> & {
|
|
243
|
+
Toolbar: typeof SignatureToolbar;
|
|
244
|
+
Undo: {
|
|
245
|
+
({ className, disabled, children, accessibilityLabel, ...props }: SignatureButtonProps): import("react").JSX.Element;
|
|
246
|
+
displayName: string;
|
|
247
|
+
};
|
|
248
|
+
Clear: {
|
|
249
|
+
({ className, disabled, children, accessibilityLabel, ...props }: SignatureButtonProps): import("react").JSX.Element;
|
|
250
|
+
displayName: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export {};
|
|
254
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/signature/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,EASL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASpD,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wCAAqC,CAAC;AAyC7C,sDAAsD;AACtD,eAAO,MAAM,sBAAsB,SAAsB,CAAC;AAE1D,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,SAAsB,CAAC;AAEtD,QAAA,MAAM,iBAAiB;;;;;;;;;;;QAajB,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAtE,sEAAsE;;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,SAAS,CAAC;CACtB;AA8CD,eAAO,MAAM,SAAS;;;0EA7BjB,oBAAoB;;;;0EAApB,oBAAoB;;;CAiCvB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
3
|
+
export type SoundwaveVariant = 'pills' | 'bars' | 'line' | 'ambient';
|
|
4
|
+
export type SoundwaveState = 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
5
|
+
export interface SoundwaveProps extends Omit<ViewProps, 'children'> {
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Which look to draw: `pills` for a few capsules over a microphone button,
|
|
9
|
+
* `bars` for a metering strip, `line` for a travelling wave, `ambient` for a
|
|
10
|
+
* glow that fills its parent.
|
|
11
|
+
*/
|
|
12
|
+
variant?: SoundwaveVariant;
|
|
13
|
+
/**
|
|
14
|
+
* What the app is doing. With no `level` supplied this picks the motion the
|
|
15
|
+
* wave runs on its own; it always sets what a screen reader announces.
|
|
16
|
+
*/
|
|
17
|
+
state?: SoundwaveState;
|
|
18
|
+
/**
|
|
19
|
+
* Input level, 0–1, from your own recorder's metering. Pass a `SharedValue`
|
|
20
|
+
* to keep updates off the JS thread entirely. Omit it and the wave animates
|
|
21
|
+
* plausible motion for the current `state`.
|
|
22
|
+
*/
|
|
23
|
+
level?: number | SharedValue<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Per-band levels, 0–1 each, for `bars` in `static` mode when the app has a
|
|
26
|
+
* real frequency analysis — or the stored shape of a finished recording.
|
|
27
|
+
* Resampled to the bar count, and drawn still rather than animated.
|
|
28
|
+
*/
|
|
29
|
+
levels?: number[];
|
|
30
|
+
/**
|
|
31
|
+
* Playback position through a recording, 0–1. Bars behind it keep full ink
|
|
32
|
+
* and the rest are dimmed, which is the voice-note progress bar. `bars` only,
|
|
33
|
+
* and it goes with `levels` — a recording has a fixed shape to play through.
|
|
34
|
+
*/
|
|
35
|
+
progress?: number | SharedValue<number>;
|
|
36
|
+
/** How many capsules (`pills`) or bars (`bars`) to draw. */
|
|
37
|
+
bars?: number;
|
|
38
|
+
/** Capsule width, or bar stroke width. Also the stroke width of `line`. */
|
|
39
|
+
barWidth?: number;
|
|
40
|
+
/** Gap between capsules. `bars` spaces itself evenly across the width. */
|
|
41
|
+
barGap?: number;
|
|
42
|
+
/** Drawing height. `ambient` ignores it and fills its parent. */
|
|
43
|
+
height?: number;
|
|
44
|
+
/**
|
|
45
|
+
* `static` gives every bar a band of the current level; `scrolling` keeps a
|
|
46
|
+
* history that slides across, newest at the trailing edge. `bars` only.
|
|
47
|
+
*/
|
|
48
|
+
mode?: 'static' | 'scrolling';
|
|
49
|
+
/** Grow bars from the middle out rather than up from the baseline. */
|
|
50
|
+
centered?: boolean;
|
|
51
|
+
/** Fade the wave out at both ends, so it does not stop at a hard edge. */
|
|
52
|
+
fadeEdges?: boolean;
|
|
53
|
+
/** Multiplier on the incoming level, applied before it is clamped to 1. */
|
|
54
|
+
sensitivity?: number;
|
|
55
|
+
/** Multiplier on the wave's own tempo, including how fast history scrolls. */
|
|
56
|
+
speed?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Ink. Takes a colour — `#f97316`, `rgba(…)` — or a **theme token name**,
|
|
59
|
+
* `color="--color-info"`, which resolves against the active theme and follows
|
|
60
|
+
* it into dark mode.
|
|
61
|
+
*
|
|
62
|
+
* Left unset, a wave inside a surface that publishes a foreground (a chat
|
|
63
|
+
* bubble, a button) is drawn in that foreground, and anywhere else in
|
|
64
|
+
* `--color-foreground` — or `--color-info` for `ambient`.
|
|
65
|
+
*/
|
|
66
|
+
color?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Colour across the wave instead of one flat ink: two or more colours spread
|
|
69
|
+
* left to right, or ramped up from the bottom edge for `ambient`. Literal
|
|
70
|
+
* colours only — for a themed one, resolve the tokens with `useCSSVariable`
|
|
71
|
+
* and pass the result.
|
|
72
|
+
*/
|
|
73
|
+
gradient?: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Colour of the part of a recording that has not played yet. Defaults to the
|
|
76
|
+
* ink at low opacity, which is right for most surfaces; set it when you want
|
|
77
|
+
* the track to read as its own thing. `bars` with `progress`.
|
|
78
|
+
*/
|
|
79
|
+
trackColor?: string;
|
|
80
|
+
/** Freeze on the current frame. */
|
|
81
|
+
paused?: boolean;
|
|
82
|
+
/** Corner radius `ambient` traces. Match it to the screen it sits on. */
|
|
83
|
+
radius?: number;
|
|
84
|
+
/** Overrides the per-state default announced to screen readers. */
|
|
85
|
+
accessibilityLabel?: string;
|
|
86
|
+
}
|
|
87
|
+
export declare function Soundwave({ className, variant, state, level, levels, progress, bars, barWidth, barGap, height, mode, centered, fadeEdges, sensitivity, speed, color, gradient, trackColor, paused, radius, accessibilityLabel, style, ...props }: SoundwaveProps): import("react").JSX.Element;
|
|
88
|
+
export declare namespace Soundwave {
|
|
89
|
+
var displayName: string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/soundwave/index.tsx"],"names":[],"mappings":"AA6CA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAiB,EAMf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAQjC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAwrB5E,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,c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