@inertiaui/modal-react 2.0.0-beta.1 → 3.0.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/dist/ModalLink.d.ts +2 -2
- package/dist/cache.d.ts +12 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/inertiaui-modal.js +92 -75
- package/dist/inertiaui-modal.js.map +1 -1
- package/dist/inertiaui-modal.umd.cjs +92 -74
- package/dist/inertiaui-modal.umd.cjs.map +1 -1
- package/dist/inertiauiModal.d.ts +1 -1
- package/dist/types.d.ts +12 -12
- package/package.json +11 -8
- package/src/ModalLink.tsx +2 -2
- package/src/ModalRoot.tsx +92 -126
- package/src/cache.ts +64 -0
- package/src/helpers.ts +3 -0
- package/src/inertiauiModal.ts +1 -0
- package/src/types.ts +13 -13
package/src/types.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { AxiosResponse } from 'axios'
|
|
2
1
|
import type { ComponentType, ReactNode } from 'react'
|
|
3
|
-
import type { RequestPayload } from '@inertiajs/core'
|
|
2
|
+
import type { RequestPayload, HttpResponse, Method } from '@inertiajs/core'
|
|
3
|
+
|
|
4
|
+
import type { ModalTypeConfig } from './config'
|
|
5
|
+
|
|
6
|
+
export type HttpMethod = Method
|
|
4
7
|
|
|
5
8
|
export interface ModalResponseData {
|
|
6
9
|
id?: string
|
|
@@ -14,24 +17,22 @@ export interface ModalResponseData {
|
|
|
14
17
|
baseUrl?: string
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
export
|
|
18
|
-
[key: string]: unknown
|
|
19
|
-
}
|
|
20
|
+
export type ModalConfig = Partial<ModalTypeConfig & { slideover: boolean }>
|
|
20
21
|
|
|
21
22
|
export interface ReloadOptions {
|
|
22
23
|
only?: string[]
|
|
23
24
|
except?: string[]
|
|
24
|
-
method?:
|
|
25
|
+
method?: HttpMethod
|
|
25
26
|
data?: Record<string, unknown>
|
|
26
27
|
headers?: Record<string, string>
|
|
27
28
|
onStart?: () => void
|
|
28
|
-
onSuccess?: (response:
|
|
29
|
+
onSuccess?: (response: HttpResponse) => void
|
|
29
30
|
onError?: (error: unknown) => void
|
|
30
31
|
onFinish?: () => void
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export interface VisitOptions {
|
|
34
|
-
method?:
|
|
35
|
+
method?: HttpMethod
|
|
35
36
|
data?: RequestPayload
|
|
36
37
|
headers?: Record<string, string>
|
|
37
38
|
config?: ModalConfig
|
|
@@ -40,7 +41,7 @@ export interface VisitOptions {
|
|
|
40
41
|
queryStringArrayFormat?: 'brackets' | 'indices'
|
|
41
42
|
navigate?: boolean
|
|
42
43
|
onStart?: () => void
|
|
43
|
-
onSuccess?: (response?:
|
|
44
|
+
onSuccess?: (response?: HttpResponse) => void
|
|
44
45
|
onError?: (...args: unknown[]) => void
|
|
45
46
|
listeners?: Record<string, (...args: unknown[]) => void>
|
|
46
47
|
// Props to pass to local modals (#152)
|
|
@@ -51,7 +52,7 @@ export interface VisitOptions {
|
|
|
51
52
|
export type PrefetchOption = boolean | 'hover' | 'click' | 'mount' | Array<'hover' | 'click' | 'mount'>
|
|
52
53
|
|
|
53
54
|
export interface PrefetchOptions {
|
|
54
|
-
method?:
|
|
55
|
+
method?: HttpMethod
|
|
55
56
|
data?: RequestPayload
|
|
56
57
|
headers?: Record<string, string>
|
|
57
58
|
queryStringArrayFormat?: 'brackets' | 'indices'
|
|
@@ -117,7 +118,7 @@ export interface ModalStackContextValue {
|
|
|
117
118
|
reset: () => void
|
|
118
119
|
visit: (
|
|
119
120
|
href: string,
|
|
120
|
-
method:
|
|
121
|
+
method: HttpMethod,
|
|
121
122
|
payload?: RequestPayload,
|
|
122
123
|
headers?: Record<string, string>,
|
|
123
124
|
config?: ModalConfig,
|
|
@@ -126,7 +127,7 @@ export interface ModalStackContextValue {
|
|
|
126
127
|
queryStringArrayFormat?: 'brackets' | 'indices',
|
|
127
128
|
useBrowserHistory?: boolean,
|
|
128
129
|
onStart?: (() => void) | null,
|
|
129
|
-
onSuccess?: ((response?:
|
|
130
|
+
onSuccess?: ((response?: HttpResponse) => void) | null,
|
|
130
131
|
onError?: ((...args: unknown[]) => void) | null,
|
|
131
132
|
) => Promise<Modal>
|
|
132
133
|
visitModal: (url: string, options?: VisitOptions) => Promise<Modal>
|
|
@@ -138,7 +139,6 @@ export interface PageProps {
|
|
|
138
139
|
initialPage?: {
|
|
139
140
|
version?: string
|
|
140
141
|
}
|
|
141
|
-
resolveComponent?: ComponentResolver
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export interface ModalRootProps {
|