@inertiajs/react 3.0.0-beta.3 → 3.0.0-beta.4
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/dist/index.js +176 -91
- package/dist/index.js.map +3 -3
- package/package.json +5 -6
- package/types/index.d.ts +2 -2
- package/types/layoutProps.d.ts +4 -7
- package/types/types.d.ts +3 -2
- package/types/useFormState.d.ts +2 -2
- package/types/useHttp.d.ts +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/react",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The React adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -57,10 +57,9 @@
|
|
|
57
57
|
"react-dom": "^19.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"
|
|
61
|
-
"laravel-precognition": "2.0.0-beta.
|
|
62
|
-
"
|
|
63
|
-
"@inertiajs/core": "3.0.0-beta.3"
|
|
60
|
+
"es-toolkit": "^1.33.0",
|
|
61
|
+
"laravel-precognition": "2.0.0-beta.5",
|
|
62
|
+
"@inertiajs/core": "3.0.0-beta.4"
|
|
64
63
|
},
|
|
65
64
|
"scripts": {
|
|
66
65
|
"build": "pnpm clean && ./build.js && tsc",
|
|
@@ -69,6 +68,6 @@
|
|
|
69
68
|
"dev": "pnpx concurrently -c \"#ffcf00,#3178c6\" \"pnpm dev:build\" \"pnpm dev:types\" --names build,types",
|
|
70
69
|
"dev:build": "./build.js --watch",
|
|
71
70
|
"dev:types": "tsc --watch --preserveWatchOutput",
|
|
72
|
-
"
|
|
71
|
+
"es2022-check": "pnpm build:with-deps && es-check es2022 \"dist/index.js\" --checkFeatures --module --noCache --verbose"
|
|
73
72
|
}
|
|
74
73
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export { default as Deferred } from './Deferred';
|
|
|
6
6
|
export { default as Form, useFormContext } from './Form';
|
|
7
7
|
export { default as Head } from './Head';
|
|
8
8
|
export { default as InfiniteScroll } from './InfiniteScroll';
|
|
9
|
-
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor
|
|
9
|
+
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor } from './layoutProps';
|
|
10
10
|
export { InertiaLinkProps, default as Link } from './Link';
|
|
11
|
-
export { ReactComponent as ResolvedComponent } from './types';
|
|
11
|
+
export { LayoutCallback, ReactComponent as ResolvedComponent } from './types';
|
|
12
12
|
export { InertiaForm, InertiaFormProps, InertiaPrecognitiveFormProps, SetDataAction, SetDataByKeyValuePair, SetDataByMethod, SetDataByObject, default as useForm, } from './useForm';
|
|
13
13
|
export { default as useHttp } from './useHttp';
|
|
14
14
|
export { default as usePage } from './usePage';
|
package/types/layoutProps.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
1
|
+
import { type LayoutProps, type NamedLayoutProps } from '@inertiajs/core';
|
|
2
|
+
export declare const store: import("@inertiajs/core").LayoutPropsStore;
|
|
3
|
+
export declare function setLayoutProps(props: Partial<LayoutProps>): void;
|
|
4
|
+
export declare function setLayoutPropsFor<K extends keyof NamedLayoutProps>(name: K, props: Partial<NamedLayoutProps[K]>): void;
|
|
3
5
|
export declare function resetLayoutProps(): void;
|
|
4
|
-
export declare const LayoutPropsContext: import("react").Context<{
|
|
5
|
-
staticProps: Record<string, unknown>;
|
|
6
|
-
name?: string;
|
|
7
|
-
}>;
|
|
8
|
-
export declare function useLayoutProps<T extends Record<string, unknown>>(defaults: T): T;
|
package/types/types.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { PageHandler } from '@inertiajs/core';
|
|
1
|
+
import { PageHandler, SharedPageProps } from '@inertiajs/core';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
export type LayoutFunction = (page: ReactNode) => ReactNode;
|
|
4
|
+
export type LayoutCallback = (props: SharedPageProps) => unknown;
|
|
4
5
|
export type LayoutComponent = ComponentType<{
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
}>;
|
|
7
8
|
export type ReactComponent = ComponentType<any> & {
|
|
8
|
-
layout?: LayoutComponent | LayoutComponent[] | LayoutFunction;
|
|
9
|
+
layout?: LayoutComponent | LayoutComponent[] | LayoutFunction | LayoutCallback;
|
|
9
10
|
};
|
|
10
11
|
export type ReactPageHandlerArgs = Parameters<PageHandler<ComponentType>>[0];
|
|
11
12
|
export type ReactInertiaAppConfig = {
|
package/types/useFormState.d.ts
CHANGED
|
@@ -62,8 +62,8 @@ export interface UseFormStateReturn<TForm extends object> {
|
|
|
62
62
|
precognitionEndpointRef: React.MutableRefObject<(() => UrlMethodPair) | null>;
|
|
63
63
|
dataRef: React.MutableRefObject<TForm>;
|
|
64
64
|
isMounted: React.MutableRefObject<boolean>;
|
|
65
|
-
setProcessing:
|
|
66
|
-
setProgress:
|
|
65
|
+
setProcessing: (value: boolean) => void;
|
|
66
|
+
setProgress: (value: Progress | null) => void;
|
|
67
67
|
markAsSuccessful: () => void;
|
|
68
68
|
clearErrors: (...fields: string[]) => void;
|
|
69
69
|
setError: (fieldOrFields: FormDataKeys<TForm> | FormDataErrors<TForm>, maybeValue?: ErrorValue) => void;
|
package/types/useHttp.d.ts
CHANGED
|
@@ -28,12 +28,12 @@ export interface UseHttpProps<TForm extends object, TResponse = unknown> {
|
|
|
28
28
|
<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): void;
|
|
29
29
|
(errors: FormDataErrors<TForm>): void;
|
|
30
30
|
};
|
|
31
|
-
submit: (...args: UseHttpSubmitArguments<
|
|
32
|
-
get: (url: string, options?: UseHttpSubmitOptions<
|
|
33
|
-
post: (url: string, options?: UseHttpSubmitOptions<
|
|
34
|
-
put: (url: string, options?: UseHttpSubmitOptions<
|
|
35
|
-
patch: (url: string, options?: UseHttpSubmitOptions<
|
|
36
|
-
delete: (url: string, options?: UseHttpSubmitOptions<
|
|
31
|
+
submit: <R = TResponse>(...args: UseHttpSubmitArguments<R, TForm>) => Promise<R>;
|
|
32
|
+
get: <R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>) => Promise<R>;
|
|
33
|
+
post: <R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>) => Promise<R>;
|
|
34
|
+
put: <R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>) => Promise<R>;
|
|
35
|
+
patch: <R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>) => Promise<R>;
|
|
36
|
+
delete: <R = TResponse>(url: string, options?: UseHttpSubmitOptions<R, TForm>) => Promise<R>;
|
|
37
37
|
cancel: () => void;
|
|
38
38
|
dontRemember: <K extends FormDataKeys<TForm>>(...fields: K[]) => UseHttpProps<TForm, TResponse>;
|
|
39
39
|
optimistic: (callback: (currentData: TForm) => Partial<TForm>) => UseHttpProps<TForm, TResponse>;
|