@ereo/client 0.1.6
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 +93 -0
- package/dist/error-boundary.d.ts +215 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/form.d.ts +436 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/hooks.d.ts +261 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hydration.d.ts +67 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2081 -0
- package/dist/islands.d.ts +103 -0
- package/dist/islands.d.ts.map +1 -0
- package/dist/link.d.ts +91 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/navigation.d.ts +121 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/prefetch.d.ts +57 -0
- package/dist/prefetch.d.ts.map +1 -0
- package/dist/typed-link.d.ts +189 -0
- package/dist/typed-link.d.ts.map +1 -0
- package/dist/typed-navigate.d.ts +238 -0
- package/dist/typed-navigate.d.ts.map +1 -0
- package/package.json +46 -0
package/dist/form.d.ts
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Form Component with Progressive Enhancement
|
|
3
|
+
*
|
|
4
|
+
* Form handling that works without JavaScript (progressive enhancement)
|
|
5
|
+
* and enhances with client-side submission when JS is available.
|
|
6
|
+
*/
|
|
7
|
+
import { createElement } from 'react';
|
|
8
|
+
import type { FormHTMLAttributes, ReactNode, FormEvent, RefObject } from 'react';
|
|
9
|
+
import type { NavigationState } from './navigation';
|
|
10
|
+
/**
|
|
11
|
+
* Result from a form action submission.
|
|
12
|
+
*/
|
|
13
|
+
export interface ActionResult<T = unknown> {
|
|
14
|
+
data?: T;
|
|
15
|
+
error?: Error;
|
|
16
|
+
status: number;
|
|
17
|
+
ok: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Submission state for tracking form submissions.
|
|
21
|
+
*/
|
|
22
|
+
export type SubmissionState = 'idle' | 'submitting' | 'loading' | 'error';
|
|
23
|
+
/**
|
|
24
|
+
* Form props extending standard HTML form attributes.
|
|
25
|
+
*/
|
|
26
|
+
export interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, 'method' | 'action' | 'encType'> {
|
|
27
|
+
/** HTTP method - defaults to POST */
|
|
28
|
+
method?: 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
29
|
+
/** Action URL - defaults to current route */
|
|
30
|
+
action?: string;
|
|
31
|
+
/** Called when submission starts */
|
|
32
|
+
onSubmitStart?: () => void;
|
|
33
|
+
/** Called when submission completes */
|
|
34
|
+
onSubmitEnd?: (result: ActionResult) => void;
|
|
35
|
+
/** Replace history instead of push */
|
|
36
|
+
replace?: boolean;
|
|
37
|
+
/** Prevent scroll reset after navigation */
|
|
38
|
+
preventScrollReset?: boolean;
|
|
39
|
+
/** Encoding type */
|
|
40
|
+
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data';
|
|
41
|
+
/** Fetch options for the request */
|
|
42
|
+
fetcherKey?: string;
|
|
43
|
+
/** Form children */
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Submit options for programmatic submission.
|
|
48
|
+
*/
|
|
49
|
+
export interface SubmitOptions {
|
|
50
|
+
/** HTTP method - defaults to POST */
|
|
51
|
+
method?: 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
52
|
+
/** Action URL - defaults to current route */
|
|
53
|
+
action?: string;
|
|
54
|
+
/** Replace history instead of push */
|
|
55
|
+
replace?: boolean;
|
|
56
|
+
/** Prevent scroll reset after navigation */
|
|
57
|
+
preventScrollReset?: boolean;
|
|
58
|
+
/** Encoding type */
|
|
59
|
+
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data';
|
|
60
|
+
/** Fetch options for the request */
|
|
61
|
+
fetcherKey?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Fetcher state for non-navigation submissions.
|
|
65
|
+
*/
|
|
66
|
+
export interface FetcherState<T = unknown> {
|
|
67
|
+
state: SubmissionState;
|
|
68
|
+
data?: T;
|
|
69
|
+
error?: Error;
|
|
70
|
+
formData?: FormData;
|
|
71
|
+
formMethod?: string;
|
|
72
|
+
formAction?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Fetcher hook return type.
|
|
76
|
+
*/
|
|
77
|
+
export interface Fetcher<T = unknown> extends FetcherState<T> {
|
|
78
|
+
/** Form component for the fetcher */
|
|
79
|
+
Form: (props: Omit<FormProps, 'fetcherKey'>) => ReturnType<typeof createElement>;
|
|
80
|
+
/** Submit function for programmatic submission */
|
|
81
|
+
submit: (target: HTMLFormElement | FormData | URLSearchParams | Record<string, string>, options?: SubmitOptions) => Promise<void>;
|
|
82
|
+
/** Load data from an action */
|
|
83
|
+
load: (href: string) => Promise<void>;
|
|
84
|
+
/** Reset fetcher state */
|
|
85
|
+
reset: () => void;
|
|
86
|
+
}
|
|
87
|
+
export interface FormContextValue {
|
|
88
|
+
/** Current action data from the last submission */
|
|
89
|
+
actionData: unknown;
|
|
90
|
+
/** Current submission state */
|
|
91
|
+
state: SubmissionState;
|
|
92
|
+
/** Update action data */
|
|
93
|
+
setActionData: (data: unknown) => void;
|
|
94
|
+
/** Update submission state */
|
|
95
|
+
setState: (state: SubmissionState) => void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Form context provider for managing form state.
|
|
99
|
+
*/
|
|
100
|
+
export declare function FormProvider({ children, initialActionData, }: {
|
|
101
|
+
children: ReactNode;
|
|
102
|
+
initialActionData?: unknown;
|
|
103
|
+
}): import("react").FunctionComponentElement<import("react").ProviderProps<FormContextValue | null>>;
|
|
104
|
+
/**
|
|
105
|
+
* Hook to access form context.
|
|
106
|
+
*/
|
|
107
|
+
export declare function useFormContext(): FormContextValue | null;
|
|
108
|
+
/**
|
|
109
|
+
* Form component with progressive enhancement.
|
|
110
|
+
* Works without JavaScript as a standard HTML form.
|
|
111
|
+
* With JavaScript, intercepts submission and uses fetch.
|
|
112
|
+
*/
|
|
113
|
+
export declare function Form({ method, action, onSubmitStart, onSubmitEnd, replace, preventScrollReset, encType, fetcherKey, children, onSubmit, ...props }: FormProps): import("react").DetailedReactHTMLElement<{
|
|
114
|
+
slot?: string | undefined | undefined;
|
|
115
|
+
style?: import("react").CSSProperties | undefined;
|
|
116
|
+
title?: string | undefined | undefined;
|
|
117
|
+
onError?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
118
|
+
hidden?: boolean | undefined | undefined;
|
|
119
|
+
onClick?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
120
|
+
acceptCharset?: string | undefined | undefined;
|
|
121
|
+
autoComplete?: string | undefined | undefined;
|
|
122
|
+
name?: string | undefined | undefined;
|
|
123
|
+
noValidate?: boolean | undefined | undefined;
|
|
124
|
+
target?: string | undefined | undefined;
|
|
125
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
126
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
127
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
128
|
+
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
129
|
+
accessKey?: string | undefined | undefined;
|
|
130
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
131
|
+
autoFocus?: boolean | undefined | undefined;
|
|
132
|
+
className?: string | undefined | undefined;
|
|
133
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
134
|
+
contextMenu?: string | undefined | undefined;
|
|
135
|
+
dir?: string | undefined | undefined;
|
|
136
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
137
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
138
|
+
id?: string | undefined | undefined;
|
|
139
|
+
lang?: string | undefined | undefined;
|
|
140
|
+
nonce?: string | undefined | undefined;
|
|
141
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
142
|
+
tabIndex?: number | undefined | undefined;
|
|
143
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
144
|
+
radioGroup?: string | undefined | undefined;
|
|
145
|
+
role?: import("react").AriaRole | undefined;
|
|
146
|
+
about?: string | undefined | undefined;
|
|
147
|
+
content?: string | undefined | undefined;
|
|
148
|
+
datatype?: string | undefined | undefined;
|
|
149
|
+
inlist?: any;
|
|
150
|
+
prefix?: string | undefined | undefined;
|
|
151
|
+
property?: string | undefined | undefined;
|
|
152
|
+
rel?: string | undefined | undefined;
|
|
153
|
+
resource?: string | undefined | undefined;
|
|
154
|
+
rev?: string | undefined | undefined;
|
|
155
|
+
typeof?: string | undefined | undefined;
|
|
156
|
+
vocab?: string | undefined | undefined;
|
|
157
|
+
autoCorrect?: string | undefined | undefined;
|
|
158
|
+
autoSave?: string | undefined | undefined;
|
|
159
|
+
color?: string | undefined | undefined;
|
|
160
|
+
itemProp?: string | undefined | undefined;
|
|
161
|
+
itemScope?: boolean | undefined | undefined;
|
|
162
|
+
itemType?: string | undefined | undefined;
|
|
163
|
+
itemID?: string | undefined | undefined;
|
|
164
|
+
itemRef?: string | undefined | undefined;
|
|
165
|
+
results?: number | undefined | undefined;
|
|
166
|
+
security?: string | undefined | undefined;
|
|
167
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
168
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
169
|
+
is?: string | undefined | undefined;
|
|
170
|
+
exportparts?: string | undefined | undefined;
|
|
171
|
+
part?: string | undefined | undefined;
|
|
172
|
+
"aria-activedescendant"?: string | undefined | undefined;
|
|
173
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
174
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
175
|
+
"aria-braillelabel"?: string | undefined | undefined;
|
|
176
|
+
"aria-brailleroledescription"?: string | undefined | undefined;
|
|
177
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
178
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
179
|
+
"aria-colcount"?: number | undefined | undefined;
|
|
180
|
+
"aria-colindex"?: number | undefined | undefined;
|
|
181
|
+
"aria-colindextext"?: string | undefined | undefined;
|
|
182
|
+
"aria-colspan"?: number | undefined | undefined;
|
|
183
|
+
"aria-controls"?: string | undefined | undefined;
|
|
184
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
|
|
185
|
+
"aria-describedby"?: string | undefined | undefined;
|
|
186
|
+
"aria-description"?: string | undefined | undefined;
|
|
187
|
+
"aria-details"?: string | undefined | undefined;
|
|
188
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
189
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
190
|
+
"aria-errormessage"?: string | undefined | undefined;
|
|
191
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
192
|
+
"aria-flowto"?: string | undefined | undefined;
|
|
193
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
194
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
|
|
195
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
196
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
|
|
197
|
+
"aria-keyshortcuts"?: string | undefined | undefined;
|
|
198
|
+
"aria-label"?: string | undefined | undefined;
|
|
199
|
+
"aria-labelledby"?: string | undefined | undefined;
|
|
200
|
+
"aria-level"?: number | undefined | undefined;
|
|
201
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
202
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
203
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
204
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
205
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
|
|
206
|
+
"aria-owns"?: string | undefined | undefined;
|
|
207
|
+
"aria-placeholder"?: string | undefined | undefined;
|
|
208
|
+
"aria-posinset"?: number | undefined | undefined;
|
|
209
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
210
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
211
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
212
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
213
|
+
"aria-roledescription"?: string | undefined | undefined;
|
|
214
|
+
"aria-rowcount"?: number | undefined | undefined;
|
|
215
|
+
"aria-rowindex"?: number | undefined | undefined;
|
|
216
|
+
"aria-rowindextext"?: string | undefined | undefined;
|
|
217
|
+
"aria-rowspan"?: number | undefined | undefined;
|
|
218
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
219
|
+
"aria-setsize"?: number | undefined | undefined;
|
|
220
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
221
|
+
"aria-valuemax"?: number | undefined | undefined;
|
|
222
|
+
"aria-valuemin"?: number | undefined | undefined;
|
|
223
|
+
"aria-valuenow"?: number | undefined | undefined;
|
|
224
|
+
"aria-valuetext"?: string | undefined | undefined;
|
|
225
|
+
dangerouslySetInnerHTML?: {
|
|
226
|
+
__html: string | TrustedHTML;
|
|
227
|
+
} | undefined | undefined;
|
|
228
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
229
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
230
|
+
onCut?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
231
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
232
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
233
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLFormElement> | undefined;
|
|
234
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
235
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
236
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
237
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
238
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
239
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLFormElement> | undefined;
|
|
240
|
+
onFocus?: import("react").FocusEventHandler<HTMLFormElement> | undefined;
|
|
241
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLFormElement> | undefined;
|
|
242
|
+
onBlur?: import("react").FocusEventHandler<HTMLFormElement> | undefined;
|
|
243
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLFormElement> | undefined;
|
|
244
|
+
onChange?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
245
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
246
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLFormElement> | undefined;
|
|
247
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
248
|
+
onInput?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
249
|
+
onInputCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
250
|
+
onReset?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
251
|
+
onResetCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
252
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
253
|
+
onInvalid?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
254
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLFormElement> | undefined;
|
|
255
|
+
onLoad?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
256
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
257
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
258
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
259
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
260
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
261
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
262
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
263
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLFormElement> | undefined;
|
|
264
|
+
onAbort?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
265
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
266
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
267
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
268
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
269
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
270
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
271
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
272
|
+
onEmptied?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
273
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
274
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
275
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
276
|
+
onEnded?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
277
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
278
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
279
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
280
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
281
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
282
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
283
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
284
|
+
onPause?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
285
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
286
|
+
onPlay?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
287
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
288
|
+
onPlaying?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
289
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
290
|
+
onProgress?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
291
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
292
|
+
onRateChange?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
293
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
294
|
+
onSeeked?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
295
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
296
|
+
onSeeking?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
297
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
298
|
+
onStalled?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
299
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
300
|
+
onSuspend?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
301
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
302
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
303
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
304
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
305
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
306
|
+
onWaiting?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
307
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
308
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
309
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
310
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
311
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
312
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
313
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
314
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
315
|
+
onDrag?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
316
|
+
onDragCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
317
|
+
onDragEnd?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
318
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
319
|
+
onDragEnter?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
320
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
321
|
+
onDragExit?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
322
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
323
|
+
onDragLeave?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
324
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
325
|
+
onDragOver?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
326
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
327
|
+
onDragStart?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
328
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
329
|
+
onDrop?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
330
|
+
onDropCapture?: import("react").DragEventHandler<HTMLFormElement> | undefined;
|
|
331
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
332
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
333
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
334
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
335
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
336
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
337
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
338
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
339
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
340
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
341
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
342
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLFormElement> | undefined;
|
|
343
|
+
onSelect?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
344
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLFormElement> | undefined;
|
|
345
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
346
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
347
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
348
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
349
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
350
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
351
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
352
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLFormElement> | undefined;
|
|
353
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
354
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
355
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
356
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
357
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
358
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
359
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
360
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
361
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
362
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
363
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
364
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
365
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
366
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
367
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
368
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
369
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
370
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLFormElement> | undefined;
|
|
371
|
+
onScroll?: import("react").UIEventHandler<HTMLFormElement> | undefined;
|
|
372
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLFormElement> | undefined;
|
|
373
|
+
onWheel?: import("react").WheelEventHandler<HTMLFormElement> | undefined;
|
|
374
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLFormElement> | undefined;
|
|
375
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
376
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
377
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
378
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
379
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
380
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLFormElement> | undefined;
|
|
381
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLFormElement> | undefined;
|
|
382
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLFormElement> | undefined;
|
|
383
|
+
ref: RefObject<HTMLFormElement>;
|
|
384
|
+
method: string;
|
|
385
|
+
action: string;
|
|
386
|
+
encType: "application/x-www-form-urlencoded" | "multipart/form-data";
|
|
387
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => Promise<void>;
|
|
388
|
+
}, HTMLFormElement>;
|
|
389
|
+
/**
|
|
390
|
+
* Hook for programmatic form submission.
|
|
391
|
+
* Returns a submit function that can be called with form data.
|
|
392
|
+
*/
|
|
393
|
+
export declare function useSubmit(): (target: HTMLFormElement | FormData | URLSearchParams | Record<string, string>, options?: SubmitOptions) => Promise<ActionResult>;
|
|
394
|
+
/**
|
|
395
|
+
* Hook for non-navigation form submissions.
|
|
396
|
+
* Useful for inline updates that don't require page navigation.
|
|
397
|
+
*/
|
|
398
|
+
export declare function useFetcher<T = unknown>(key?: string): Fetcher<T>;
|
|
399
|
+
/**
|
|
400
|
+
* Hook to access the action data from the last form submission.
|
|
401
|
+
*/
|
|
402
|
+
export declare function useActionData<T = unknown>(): T | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* Navigation state extended with form submission info.
|
|
405
|
+
*/
|
|
406
|
+
export interface FormNavigationState extends NavigationState {
|
|
407
|
+
/** Current navigation/submission state */
|
|
408
|
+
state: SubmissionState;
|
|
409
|
+
/** Form data being submitted */
|
|
410
|
+
formData?: FormData;
|
|
411
|
+
/** Form method being used */
|
|
412
|
+
formMethod?: string;
|
|
413
|
+
/** Form action URL */
|
|
414
|
+
formAction?: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Hook to get the current navigation state including form submission state.
|
|
418
|
+
*/
|
|
419
|
+
export declare function useNavigation(): FormNavigationState;
|
|
420
|
+
/**
|
|
421
|
+
* Serialize form data to URL-encoded string.
|
|
422
|
+
*/
|
|
423
|
+
export declare function serializeFormData(formData: FormData): string;
|
|
424
|
+
/**
|
|
425
|
+
* Parse URL-encoded string to FormData.
|
|
426
|
+
*/
|
|
427
|
+
export declare function parseFormData(data: string): FormData;
|
|
428
|
+
/**
|
|
429
|
+
* Convert FormData to a plain object.
|
|
430
|
+
*/
|
|
431
|
+
export declare function formDataToObject(formData: FormData): Record<string, string | string[]>;
|
|
432
|
+
/**
|
|
433
|
+
* Convert a plain object to FormData.
|
|
434
|
+
*/
|
|
435
|
+
export declare function objectToFormData(obj: Record<string, string | string[] | number | boolean>): FormData;
|
|
436
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAuE,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3G,qCAAqC;IACrC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,aAAa,CAAC,EA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